Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move 'draw' methods into Menu Item classes #15760

Conversation

thinkyhead
Copy link
Member

Description

Move menu item draw functions into custom menu item classes.

Benefits

  • More logical organization of menu item types and behaviors.
  • Saves a small amount of program memory (thanks to FORCE_INLINE).

This PR is a preliminary refactor ahead of introducing menu items that also take an index number. The index is used by draw and action methods and allows us to use a loop to draw several extruder-oriented menu items, for example, to simplify the addition of more extruders, fans, etc.

@thinkyhead thinkyhead force-pushed the bf2_refactor_menuitem_draw_PR branch 6 times, most recently from 9fc7f8f to 8f74137 Compare November 2, 2019 09:12
@thinkyhead thinkyhead force-pushed the bf2_refactor_menuitem_draw_PR branch from 8f74137 to 857b66b Compare November 2, 2019 11:10
@thinkyhead thinkyhead merged commit ea3217c into MarlinFirmware:bugfix-2.0.x Nov 2, 2019
@thinkyhead thinkyhead deleted the bf2_refactor_menuitem_draw_PR branch November 2, 2019 12:28
@vivian-ng
Copy link
Contributor

menu_bed_corners.cpp line 100 to 106:

      GET_TEXT((
        #if ENABLED(LEVEL_CENTER_TOO)
          MSG_LEVEL_BED_NEXT_POINT
        #else
          MSG_NEXT_CORNER
        #endif
      )), (PGM_P)nullptr, PSTR("?")

does not compile, gives expected unqualified-id before '(' token error.

When I removed the set of brackets in GETTEXT to this:

      GET_TEXT(
        #if ENABLED(LEVEL_CENTER_TOO)
          MSG_LEVEL_BED_NEXT_POINT
        #else
          MSG_NEXT_CORNER
        #endif
      ), (PGM_P)nullptr, PSTR("?")

it was able to compile.

philippniethammer pushed a commit to philippniethammer/Marlin that referenced this pull request Dec 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants