♻️ Apply F() to more LCD code (#24228)
This commit is contained in:
@@ -36,36 +36,36 @@ void lcd_move_z();
|
||||
// SUBMENU(LABEL, screen_handler)
|
||||
class MenuItem_submenu : public MenuItemBase {
|
||||
public:
|
||||
FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, ...) {
|
||||
_draw(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0]);
|
||||
FORCE_INLINE static void draw(const bool sel, const uint8_t row, FSTR_P const fstr, ...) {
|
||||
_draw(sel, row, fstr, '>', LCD_STR_ARROW_RIGHT[0]);
|
||||
}
|
||||
static void action(PGM_P const, const screenFunc_t func) { ui.push_current_screen(); ui.goto_screen(func); }
|
||||
static void action(FSTR_P const, const screenFunc_t func) { ui.push_current_screen(); ui.goto_screen(func); }
|
||||
};
|
||||
|
||||
// Any menu item that invokes an immediate action
|
||||
class MenuItem_button : public MenuItemBase {
|
||||
public:
|
||||
// Button-y Items are selectable lines with no other indicator
|
||||
static void draw(const bool sel, const uint8_t row, PGM_P const pstr, ...) {
|
||||
_draw(sel, row, pstr, '>', ' ');
|
||||
static void draw(const bool sel, const uint8_t row, FSTR_P const fstr, ...) {
|
||||
_draw(sel, row, fstr, '>', ' ');
|
||||
}
|
||||
};
|
||||
|
||||
// ACTION_ITEM(LABEL, FUNC)
|
||||
class MenuItem_function : public MenuItem_button {
|
||||
public:
|
||||
//static void action(PGM_P const, const uint8_t, const menuAction_t func) { (*func)(); };
|
||||
static void action(PGM_P const, const menuAction_t func) { if (func) (*func)(); };
|
||||
//static void action(FSTR_P const, const uint8_t, const menuAction_t func) { (*func)(); };
|
||||
static void action(FSTR_P const, const menuAction_t func) { if (func) (*func)(); };
|
||||
};
|
||||
|
||||
// GCODES_ITEM(LABEL, GCODES)
|
||||
class MenuItem_gcode : public MenuItem_button {
|
||||
public:
|
||||
FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, ...) {
|
||||
_draw(sel, row, pstr, '>', ' ');
|
||||
FORCE_INLINE static void draw(const bool sel, const uint8_t row, FSTR_P const fstr, ...) {
|
||||
_draw(sel, row, fstr, '>', ' ');
|
||||
}
|
||||
static void action(PGM_P const, PGM_P const pgcode) { queue.inject(FPSTR(pgcode)); }
|
||||
static void action(PGM_P const pstr, const uint8_t, PGM_P const pgcode) { action(pstr, pgcode); }
|
||||
static void action(FSTR_P const, FSTR_P const fgcode) { queue.inject(fgcode); }
|
||||
static void action(FSTR_P const fstr, const uint8_t, FSTR_P const fgcode) { action(fstr, fgcode); }
|
||||
};
|
||||
|
||||
////////////////////////////////////////////
|
||||
@@ -82,16 +82,16 @@ class TMenuEditItem : MenuEditItemBase {
|
||||
static const char* to_string(const int32_t value) { return NAME::strfunc(unscale(value)); }
|
||||
static void load(void *ptr, const int32_t value) { *((type_t*)ptr) = unscale(value); }
|
||||
public:
|
||||
FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, type_t * const data, ...) {
|
||||
MenuEditItemBase::draw(sel, row, pstr, NAME::strfunc(*(data)));
|
||||
FORCE_INLINE static void draw(const bool sel, const uint8_t row, FSTR_P const fstr, type_t * const data, ...) {
|
||||
MenuEditItemBase::draw(sel, row, fstr, NAME::strfunc(*(data)));
|
||||
}
|
||||
FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, type_t (*pget)(), ...) {
|
||||
MenuEditItemBase::draw(sel, row, pstr, NAME::strfunc(pget()));
|
||||
FORCE_INLINE static void draw(const bool sel, const uint8_t row, FSTR_P const fstr, type_t (*pget)(), ...) {
|
||||
MenuEditItemBase::draw(sel, row, fstr, NAME::strfunc(pget()));
|
||||
}
|
||||
// Edit screen for this type of item
|
||||
static void edit_screen() { MenuEditItemBase::edit_screen(to_string, load); }
|
||||
static void action(
|
||||
PGM_P const pstr, // Edit label
|
||||
FSTR_P const fstr, // Edit label
|
||||
type_t * const ptr, // Value pointer
|
||||
const type_t minValue, // Value range
|
||||
const type_t maxValue,
|
||||
@@ -101,7 +101,7 @@ class TMenuEditItem : MenuEditItemBase {
|
||||
// Make sure minv and maxv fit within int32_t
|
||||
const int32_t minv = _MAX(scale(minValue), INT32_MIN),
|
||||
maxv = _MIN(scale(maxValue), INT32_MAX);
|
||||
goto_edit_screen(pstr, ptr, minv, maxv - minv, scale(*ptr) - minv,
|
||||
goto_edit_screen(fstr, ptr, minv, maxv - minv, scale(*ptr) - minv,
|
||||
edit_screen, callback, live);
|
||||
}
|
||||
};
|
||||
@@ -168,16 +168,16 @@ DEFINE_MENU_EDIT_ITEM_TYPE(long5_25 ,uint32_t ,ftostr5rj , 0.04f );
|
||||
|
||||
class MenuItem_bool : public MenuEditItemBase {
|
||||
public:
|
||||
FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, const bool onoff) {
|
||||
MenuEditItemBase::draw(sel, row, pstr, onoff ? GET_TEXT(MSG_LCD_ON) : GET_TEXT(MSG_LCD_OFF), true);
|
||||
FORCE_INLINE static void draw(const bool sel, const uint8_t row, FSTR_P const fstr, const bool onoff) {
|
||||
MenuEditItemBase::draw(sel, row, fstr, onoff ? GET_TEXT_F(MSG_LCD_ON) : GET_TEXT_F(MSG_LCD_OFF));
|
||||
}
|
||||
FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, bool * const data, ...) {
|
||||
draw(sel, row, pstr, *data);
|
||||
FORCE_INLINE static void draw(const bool sel, const uint8_t row, FSTR_P const fstr, bool * const data, ...) {
|
||||
draw(sel, row, fstr, *data);
|
||||
}
|
||||
FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, PGM_P const, bool (*pget)(), ...) {
|
||||
draw(sel, row, pstr, pget());
|
||||
FORCE_INLINE static void draw(const bool sel, const uint8_t row, FSTR_P const fstr, FSTR_P const, bool (*pget)(), ...) {
|
||||
draw(sel, row, fstr, pget());
|
||||
}
|
||||
static void action(PGM_P const pstr, bool * const ptr, const screenFunc_t callbackFunc=nullptr) {
|
||||
static void action(FSTR_P const fstr, bool * const ptr, const screenFunc_t callbackFunc=nullptr) {
|
||||
*ptr ^= true; ui.refresh();
|
||||
if (callbackFunc) (*callbackFunc)();
|
||||
}
|
||||
@@ -250,16 +250,16 @@ class MenuItem_bool : public MenuEditItemBase {
|
||||
*
|
||||
* Examples:
|
||||
* BACK_ITEM(MSG_INFO_SCREEN)
|
||||
* MenuItem_back::action(plabel, ...)
|
||||
* MenuItem_back::draw(sel, row, plabel, ...)
|
||||
* MenuItem_back::action(flabel, ...)
|
||||
* MenuItem_back::draw(sel, row, flabel, ...)
|
||||
*
|
||||
* ACTION_ITEM(MSG_PAUSE_PRINT, lcd_sdcard_pause)
|
||||
* MenuItem_function::action(plabel, lcd_sdcard_pause)
|
||||
* MenuItem_function::draw(sel, row, plabel, lcd_sdcard_pause)
|
||||
* MenuItem_function::action(flabel, lcd_sdcard_pause)
|
||||
* MenuItem_function::draw(sel, row, flabel, lcd_sdcard_pause)
|
||||
*
|
||||
* EDIT_ITEM(int3, MSG_SPEED, &feedrate_percentage, 10, 999)
|
||||
* MenuItem_int3::action(plabel, &feedrate_percentage, 10, 999)
|
||||
* MenuItem_int3::draw(sel, row, plabel, &feedrate_percentage, 10, 999)
|
||||
* MenuItem_int3::action(flabel, &feedrate_percentage, 10, 999)
|
||||
* MenuItem_int3::draw(sel, row, flabel, &feedrate_percentage, 10, 999)
|
||||
*/
|
||||
|
||||
#if ENABLED(ENCODER_RATE_MULTIPLIER)
|
||||
@@ -268,19 +268,19 @@ class MenuItem_bool : public MenuEditItemBase {
|
||||
#define _MENU_ITEM_MULTIPLIER_CHECK(USE_MULTIPLIER)
|
||||
#endif
|
||||
|
||||
#define _MENU_INNER_P(TYPE, USE_MULTIPLIER, PLABEL, V...) do { \
|
||||
PGM_P const plabel = PLABEL; \
|
||||
#define _MENU_INNER_P(TYPE, USE_MULTIPLIER, FLABEL, V...) do { \
|
||||
FSTR_P const flabel = FLABEL; \
|
||||
if (encoderLine == _thisItemNr && ui.use_click()) { \
|
||||
_MENU_ITEM_MULTIPLIER_CHECK(USE_MULTIPLIER); \
|
||||
MenuItem_##TYPE::action(plabel, ##V); \
|
||||
MenuItem_##TYPE::action(flabel, ##V); \
|
||||
if (ui.screen_changed) return; \
|
||||
} \
|
||||
if (ui.should_draw()) \
|
||||
MenuItem_##TYPE::draw \
|
||||
(encoderLine == _thisItemNr, _lcdLineNr, plabel, ##V); \
|
||||
(encoderLine == _thisItemNr, _lcdLineNr, flabel, ##V); \
|
||||
}while(0)
|
||||
|
||||
#define _MENU_ITEM_P(TYPE, V...) do { \
|
||||
#define _MENU_ITEM_F(TYPE, V...) do { \
|
||||
if (_menuLineNr == _thisItemNr) { \
|
||||
_skipStatic = false; \
|
||||
_MENU_INNER_P(TYPE, ##V); \
|
||||
@@ -289,7 +289,7 @@ class MenuItem_bool : public MenuEditItemBase {
|
||||
}while(0)
|
||||
|
||||
// Indexed items set a global index value and optional data
|
||||
#define _MENU_ITEM_N_S_P(TYPE, N, S, V...) do{ \
|
||||
#define _MENU_ITEM_N_S_F(TYPE, N, S, V...) do{ \
|
||||
if (_menuLineNr == _thisItemNr) { \
|
||||
_skipStatic = false; \
|
||||
MenuItemBase::init(N, S); \
|
||||
@@ -299,7 +299,7 @@ class MenuItem_bool : public MenuEditItemBase {
|
||||
}while(0)
|
||||
|
||||
// Indexed items set a global index value
|
||||
#define _MENU_ITEM_N_P(TYPE, N, V...) do{ \
|
||||
#define _MENU_ITEM_N_F(TYPE, N, V...) do{ \
|
||||
if (_menuLineNr == _thisItemNr) { \
|
||||
_skipStatic = false; \
|
||||
MenuItemBase::itemIndex = N; \
|
||||
@@ -309,7 +309,7 @@ class MenuItem_bool : public MenuEditItemBase {
|
||||
}while(0)
|
||||
|
||||
// Items with a unique string
|
||||
#define _MENU_ITEM_S_P(TYPE, S, V...) do{ \
|
||||
#define _MENU_ITEM_S_F(TYPE, S, V...) do{ \
|
||||
if (_menuLineNr == _thisItemNr) { \
|
||||
_skipStatic = false; \
|
||||
MenuItemBase::itemString = S; \
|
||||
@@ -321,25 +321,25 @@ class MenuItem_bool : public MenuEditItemBase {
|
||||
// STATIC_ITEM draws a styled string with no highlight.
|
||||
// Parameters: label [, style [, char *value] ]
|
||||
|
||||
#define STATIC_ITEM_INNER_P(PLABEL, V...) do{ \
|
||||
#define STATIC_ITEM_INNER_F(FLABEL, V...) do{ \
|
||||
if (_skipStatic && encoderLine <= _thisItemNr) { \
|
||||
ui.encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \
|
||||
++encoderLine; \
|
||||
} \
|
||||
if (ui.should_draw()) \
|
||||
MenuItem_static::draw(_lcdLineNr, PLABEL, ##V); \
|
||||
MenuItem_static::draw(_lcdLineNr, FLABEL, ##V); \
|
||||
} while(0)
|
||||
|
||||
#define STATIC_ITEM_P(PLABEL, V...) do{ \
|
||||
#define STATIC_ITEM_F(FLABEL, V...) do{ \
|
||||
if (_menuLineNr == _thisItemNr) \
|
||||
STATIC_ITEM_INNER_P(PLABEL, ##V); \
|
||||
STATIC_ITEM_INNER_F(FLABEL, ##V); \
|
||||
NEXT_ITEM(); \
|
||||
} while(0)
|
||||
|
||||
#define STATIC_ITEM_N_P(PLABEL, N, V...) do{ \
|
||||
#define STATIC_ITEM_N_F(FLABEL, N, V...) do{ \
|
||||
if (_menuLineNr == _thisItemNr) { \
|
||||
MenuItemBase::init(N); \
|
||||
STATIC_ITEM_INNER_P(PLABEL, ##V); \
|
||||
STATIC_ITEM_INNER_F(FLABEL, ##V); \
|
||||
} \
|
||||
NEXT_ITEM(); \
|
||||
}while(0)
|
||||
@@ -347,124 +347,124 @@ class MenuItem_bool : public MenuEditItemBase {
|
||||
// PSTRING_ITEM is like STATIC_ITEM but it takes
|
||||
// two PSTRs with the style as the last parameter.
|
||||
|
||||
#define PSTRING_ITEM_P(PLABEL, PVAL, STYL) do{ \
|
||||
#define PSTRING_ITEM_F(FLABEL, PVAL, STYL) do{ \
|
||||
constexpr int m = 20; \
|
||||
char msg[m+1]; \
|
||||
msg[0] = ':'; msg[1] = ' '; \
|
||||
strncpy_P(msg+2, PSTR(PVAL), m-2); \
|
||||
if (msg[m-1] & 0x80) msg[m-1] = '\0'; \
|
||||
STATIC_ITEM_P(PLABEL, STYL, msg); \
|
||||
STATIC_ITEM_F(FLABEL, STYL, msg); \
|
||||
}while(0)
|
||||
|
||||
#define PSTRING_ITEM(LABEL, V...) PSTRING_ITEM_P(GET_TEXT(LABEL), ##V)
|
||||
#define PSTRING_ITEM(LABEL, V...) PSTRING_ITEM_F(GET_TEXT_F(LABEL), ##V)
|
||||
|
||||
#define STATIC_ITEM(LABEL, V...) STATIC_ITEM_P(GET_TEXT(LABEL), ##V)
|
||||
#define STATIC_ITEM_N(LABEL, N, V...) STATIC_ITEM_N_P(GET_TEXT(LABEL), N, ##V)
|
||||
#define STATIC_ITEM(LABEL, V...) STATIC_ITEM_F(GET_TEXT_F(LABEL), ##V)
|
||||
#define STATIC_ITEM_N(LABEL, N, V...) STATIC_ITEM_N_F(GET_TEXT_F(LABEL), N, ##V)
|
||||
|
||||
#define MENU_ITEM_N_S_P(TYPE, N, S, PLABEL, V...) _MENU_ITEM_N_S_P(TYPE, N, S, false, PLABEL, ##V)
|
||||
#define MENU_ITEM_N_S(TYPE, N, S, LABEL, V...) MENU_ITEM_N_S_P(TYPE, N, S, GET_TEXT(LABEL), ##V)
|
||||
#define MENU_ITEM_S_P(TYPE, S, PLABEL, V...) _MENU_ITEM_S_P(TYPE, S, false, PLABEL, ##V)
|
||||
#define MENU_ITEM_S(TYPE, S, LABEL, V...) MENU_ITEM_S_P(TYPE, S, GET_TEXT(LABEL), ##V)
|
||||
#define MENU_ITEM_N_P(TYPE, N, PLABEL, V...) _MENU_ITEM_N_P(TYPE, N, false, PLABEL, ##V)
|
||||
#define MENU_ITEM_N(TYPE, N, LABEL, V...) MENU_ITEM_N_P(TYPE, N, GET_TEXT(LABEL), ##V)
|
||||
#define MENU_ITEM_P(TYPE, PLABEL, V...) _MENU_ITEM_P(TYPE, false, PLABEL, ##V)
|
||||
#define MENU_ITEM(TYPE, LABEL, V...) MENU_ITEM_P(TYPE, GET_TEXT(LABEL), ##V)
|
||||
#define MENU_ITEM_N_S_F(TYPE, N, S, FLABEL, V...) _MENU_ITEM_N_S_F(TYPE, N, S, false, FLABEL, ##V)
|
||||
#define MENU_ITEM_N_S(TYPE, N, S, LABEL, V...) MENU_ITEM_N_S_F(TYPE, N, S, GET_TEXT_F(LABEL), ##V)
|
||||
#define MENU_ITEM_S_F(TYPE, S, FLABEL, V...) _MENU_ITEM_S_F(TYPE, S, false, FLABEL, ##V)
|
||||
#define MENU_ITEM_S(TYPE, S, LABEL, V...) MENU_ITEM_S_F(TYPE, S, GET_TEXT_F(LABEL), ##V)
|
||||
#define MENU_ITEM_N_F(TYPE, N, FLABEL, V...) _MENU_ITEM_N_F(TYPE, N, false, FLABEL, ##V)
|
||||
#define MENU_ITEM_N(TYPE, N, LABEL, V...) MENU_ITEM_N_F(TYPE, N, GET_TEXT_F(LABEL), ##V)
|
||||
#define MENU_ITEM_F(TYPE, FLABEL, V...) _MENU_ITEM_F(TYPE, false, FLABEL, ##V)
|
||||
#define MENU_ITEM(TYPE, LABEL, V...) MENU_ITEM_F(TYPE, GET_TEXT_F(LABEL), ##V)
|
||||
|
||||
#define BACK_ITEM_P(PLABEL) MENU_ITEM_P(back, PLABEL)
|
||||
#define BACK_ITEM_F(FLABEL) MENU_ITEM_F(back, FLABEL)
|
||||
#define BACK_ITEM(LABEL) MENU_ITEM(back, LABEL)
|
||||
|
||||
#define ACTION_ITEM_N_S_P(N, S, PLABEL, ACTION) MENU_ITEM_N_S_P(function, N, S, PLABEL, ACTION)
|
||||
#define ACTION_ITEM_N_S(N, S, LABEL, ACTION) ACTION_ITEM_N_S_P(N, S, GET_TEXT(LABEL), ACTION)
|
||||
#define ACTION_ITEM_S_P(S, PLABEL, ACTION) MENU_ITEM_S_P(function, S, PLABEL, ACTION)
|
||||
#define ACTION_ITEM_S(S, LABEL, ACTION) ACTION_ITEM_S_P(S, GET_TEXT(LABEL), ACTION)
|
||||
#define ACTION_ITEM_N_P(N, PLABEL, ACTION) MENU_ITEM_N_P(function, N, PLABEL, ACTION)
|
||||
#define ACTION_ITEM_N(N, LABEL, ACTION) ACTION_ITEM_N_P(N, GET_TEXT(LABEL), ACTION)
|
||||
#define ACTION_ITEM_P(PLABEL, ACTION) MENU_ITEM_P(function, PLABEL, ACTION)
|
||||
#define ACTION_ITEM(LABEL, ACTION) ACTION_ITEM_P(GET_TEXT(LABEL), ACTION)
|
||||
#define ACTION_ITEM_N_S_F(N, S, FLABEL, ACTION) MENU_ITEM_N_S_F(function, N, S, FLABEL, ACTION)
|
||||
#define ACTION_ITEM_N_S(N, S, LABEL, ACTION) ACTION_ITEM_N_S_F(N, S, GET_TEXT_F(LABEL), ACTION)
|
||||
#define ACTION_ITEM_S_F(S, FLABEL, ACTION) MENU_ITEM_S_F(function, S, FLABEL, ACTION)
|
||||
#define ACTION_ITEM_S(S, LABEL, ACTION) ACTION_ITEM_S_F(S, GET_TEXT_F(LABEL), ACTION)
|
||||
#define ACTION_ITEM_N_F(N, FLABEL, ACTION) MENU_ITEM_N_F(function, N, FLABEL, ACTION)
|
||||
#define ACTION_ITEM_N(N, LABEL, ACTION) ACTION_ITEM_N_F(N, GET_TEXT_F(LABEL), ACTION)
|
||||
#define ACTION_ITEM_F(FLABEL, ACTION) MENU_ITEM_F(function, FLABEL, ACTION)
|
||||
#define ACTION_ITEM(LABEL, ACTION) ACTION_ITEM_F(GET_TEXT_F(LABEL), ACTION)
|
||||
|
||||
#define GCODES_ITEM_N_S_P(N, S, PLABEL, GCODES) MENU_ITEM_N_S_P(gcode, N, S, PLABEL, GCODES)
|
||||
#define GCODES_ITEM_N_S(N, S, LABEL, GCODES) GCODES_ITEM_N_S_P(N, S, GET_TEXT(LABEL), GCODES)
|
||||
#define GCODES_ITEM_S_P(S, PLABEL, GCODES) MENU_ITEM_S_P(gcode, S, PLABEL, GCODES)
|
||||
#define GCODES_ITEM_S(S, LABEL, GCODES) GCODES_ITEM_S_P(S, GET_TEXT(LABEL), GCODES)
|
||||
#define GCODES_ITEM_N_P(N, PLABEL, GCODES) MENU_ITEM_N_P(gcode, N, PLABEL, GCODES)
|
||||
#define GCODES_ITEM_N(N, LABEL, GCODES) GCODES_ITEM_N_P(N, GET_TEXT(LABEL), GCODES)
|
||||
#define GCODES_ITEM_P(PLABEL, GCODES) MENU_ITEM_P(gcode, PLABEL, GCODES)
|
||||
#define GCODES_ITEM(LABEL, GCODES) GCODES_ITEM_P(GET_TEXT(LABEL), GCODES)
|
||||
#define GCODES_ITEM_N_S_F(N, S, FLABEL, GCODES) MENU_ITEM_N_S_F(gcode, N, S, FLABEL, GCODES)
|
||||
#define GCODES_ITEM_N_S(N, S, LABEL, GCODES) GCODES_ITEM_N_S_F(N, S, GET_TEXT_F(LABEL), GCODES)
|
||||
#define GCODES_ITEM_S_F(S, FLABEL, GCODES) MENU_ITEM_S_F(gcode, S, FLABEL, GCODES)
|
||||
#define GCODES_ITEM_S(S, LABEL, GCODES) GCODES_ITEM_S_F(S, GET_TEXT_F(LABEL), GCODES)
|
||||
#define GCODES_ITEM_N_F(N, FLABEL, GCODES) MENU_ITEM_N_F(gcode, N, FLABEL, GCODES)
|
||||
#define GCODES_ITEM_N(N, LABEL, GCODES) GCODES_ITEM_N_F(N, GET_TEXT_F(LABEL), GCODES)
|
||||
#define GCODES_ITEM_F(FLABEL, GCODES) MENU_ITEM_F(gcode, FLABEL, GCODES)
|
||||
#define GCODES_ITEM(LABEL, GCODES) GCODES_ITEM_F(GET_TEXT_F(LABEL), GCODES)
|
||||
|
||||
#define SUBMENU_N_S_P(N, S, PLABEL, DEST) MENU_ITEM_N_S_P(submenu, N, S, PLABEL, DEST)
|
||||
#define SUBMENU_N_S(N, S, LABEL, DEST) SUBMENU_N_S_P(N, S, GET_TEXT(LABEL), DEST)
|
||||
#define SUBMENU_S_P(S, PLABEL, DEST) MENU_ITEM_S_P(submenu, S, PLABEL, DEST)
|
||||
#define SUBMENU_S(S, LABEL, DEST) SUBMENU_S_P(S, GET_TEXT(LABEL), DEST)
|
||||
#define SUBMENU_N_P(N, PLABEL, DEST) MENU_ITEM_N_P(submenu, N, PLABEL, DEST)
|
||||
#define SUBMENU_N(N, LABEL, DEST) SUBMENU_N_P(N, GET_TEXT(LABEL), DEST)
|
||||
#define SUBMENU_P(PLABEL, DEST) MENU_ITEM_P(submenu, PLABEL, DEST)
|
||||
#define SUBMENU(LABEL, DEST) SUBMENU_P(GET_TEXT(LABEL), DEST)
|
||||
#define SUBMENU_N_S_F(N, S, FLABEL, DEST) MENU_ITEM_N_S_F(submenu, N, S, FLABEL, DEST)
|
||||
#define SUBMENU_N_S(N, S, LABEL, DEST) SUBMENU_N_S_F(N, S, GET_TEXT_F(LABEL), DEST)
|
||||
#define SUBMENU_S_F(S, FLABEL, DEST) MENU_ITEM_S_F(submenu, S, FLABEL, DEST)
|
||||
#define SUBMENU_S(S, LABEL, DEST) SUBMENU_S_F(S, GET_TEXT_F(LABEL), DEST)
|
||||
#define SUBMENU_N_F(N, FLABEL, DEST) MENU_ITEM_N_F(submenu, N, FLABEL, DEST)
|
||||
#define SUBMENU_N(N, LABEL, DEST) SUBMENU_N_F(N, GET_TEXT_F(LABEL), DEST)
|
||||
#define SUBMENU_F(FLABEL, DEST) MENU_ITEM_F(submenu, FLABEL, DEST)
|
||||
#define SUBMENU(LABEL, DEST) SUBMENU_F(GET_TEXT_F(LABEL), DEST)
|
||||
|
||||
#define EDIT_ITEM_N_S_P(TYPE, N, S, PLABEL, V...) MENU_ITEM_N_S_P(TYPE, N, S, PLABEL, ##V)
|
||||
#define EDIT_ITEM_N_S(TYPE, N, S, LABEL, V...) EDIT_ITEM_N_S_P(TYPE, N, S, GET_TEXT(LABEL), ##V)
|
||||
#define EDIT_ITEM_S_P(TYPE, S, PLABEL, V...) MENU_ITEM_S_P(TYPE, S, PLABEL, ##V)
|
||||
#define EDIT_ITEM_S(TYPE, S, LABEL, V...) EDIT_ITEM_S_P(TYPE, S, GET_TEXT(LABEL), ##V)
|
||||
#define EDIT_ITEM_N_P(TYPE, N, PLABEL, V...) MENU_ITEM_N_P(TYPE, N, PLABEL, ##V)
|
||||
#define EDIT_ITEM_N(TYPE, N, LABEL, V...) EDIT_ITEM_N_P(TYPE, N, GET_TEXT(LABEL), ##V)
|
||||
#define EDIT_ITEM_P(TYPE, PLABEL, V...) MENU_ITEM_P(TYPE, PLABEL, ##V)
|
||||
#define EDIT_ITEM(TYPE, LABEL, V...) EDIT_ITEM_P(TYPE, GET_TEXT(LABEL), ##V)
|
||||
#define EDIT_ITEM_N_S_F(TYPE, N, S, FLABEL, V...) MENU_ITEM_N_S_F(TYPE, N, S, FLABEL, ##V)
|
||||
#define EDIT_ITEM_N_S(TYPE, N, S, LABEL, V...) EDIT_ITEM_N_S_F(TYPE, N, S, GET_TEXT_F(LABEL), ##V)
|
||||
#define EDIT_ITEM_S_F(TYPE, S, FLABEL, V...) MENU_ITEM_S_F(TYPE, S, FLABEL, ##V)
|
||||
#define EDIT_ITEM_S(TYPE, S, LABEL, V...) EDIT_ITEM_S_F(TYPE, S, GET_TEXT_F(LABEL), ##V)
|
||||
#define EDIT_ITEM_N_F(TYPE, N, FLABEL, V...) MENU_ITEM_N_F(TYPE, N, FLABEL, ##V)
|
||||
#define EDIT_ITEM_N(TYPE, N, LABEL, V...) EDIT_ITEM_N_F(TYPE, N, GET_TEXT_F(LABEL), ##V)
|
||||
#define EDIT_ITEM_F(TYPE, FLABEL, V...) MENU_ITEM_F(TYPE, FLABEL, ##V)
|
||||
#define EDIT_ITEM(TYPE, LABEL, V...) EDIT_ITEM_F(TYPE, GET_TEXT_F(LABEL), ##V)
|
||||
|
||||
#define EDIT_ITEM_FAST_N_S_P(TYPE, N, S, PLABEL, V...) _MENU_ITEM_N_S_P(TYPE, N, S, true, PLABEL, ##V)
|
||||
#define EDIT_ITEM_FAST_N_S(TYPE, N, S, LABEL, V...) EDIT_ITEM_FAST_N_S_P(TYPE, N, S, true, GET_TEXT(LABEL), ##V)
|
||||
#define EDIT_ITEM_FAST_S_P(TYPE, S, PLABEL, V...) _MENU_ITEM_S_P(TYPE, S, true, PLABEL, ##V)
|
||||
#define EDIT_ITEM_FAST_S(TYPE, S, LABEL, V...) EDIT_ITEM_FAST_S_P(TYPE, S, GET_TEXT(LABEL), ##V)
|
||||
#define EDIT_ITEM_FAST_N_P(TYPE, N, PLABEL, V...) _MENU_ITEM_N_P(TYPE, N, true, PLABEL, ##V)
|
||||
#define EDIT_ITEM_FAST_N(TYPE, N, LABEL, V...) EDIT_ITEM_FAST_N_P(TYPE, N, GET_TEXT(LABEL), ##V)
|
||||
#define EDIT_ITEM_FAST_P(TYPE, PLABEL, V...) _MENU_ITEM_P(TYPE, true, PLABEL, ##V)
|
||||
#define EDIT_ITEM_FAST(TYPE, LABEL, V...) EDIT_ITEM_FAST_P(TYPE, GET_TEXT(LABEL), ##V)
|
||||
#define EDIT_ITEM_FAST_N_S_F(TYPE, N, S, FLABEL, V...) _MENU_ITEM_N_S_F(TYPE, N, S, true, FLABEL, ##V)
|
||||
#define EDIT_ITEM_FAST_N_S(TYPE, N, S, LABEL, V...) EDIT_ITEM_FAST_N_S_F(TYPE, N, S, true, GET_TEXT_F(LABEL), ##V)
|
||||
#define EDIT_ITEM_FAST_S_F(TYPE, S, FLABEL, V...) _MENU_ITEM_S_F(TYPE, S, true, FLABEL, ##V)
|
||||
#define EDIT_ITEM_FAST_S(TYPE, S, LABEL, V...) EDIT_ITEM_FAST_S_F(TYPE, S, GET_TEXT_F(LABEL), ##V)
|
||||
#define EDIT_ITEM_FAST_N_F(TYPE, N, FLABEL, V...) _MENU_ITEM_N_F(TYPE, N, true, FLABEL, ##V)
|
||||
#define EDIT_ITEM_FAST_N(TYPE, N, LABEL, V...) EDIT_ITEM_FAST_N_F(TYPE, N, GET_TEXT_F(LABEL), ##V)
|
||||
#define EDIT_ITEM_FAST_F(TYPE, FLABEL, V...) _MENU_ITEM_F(TYPE, true, FLABEL, ##V)
|
||||
#define EDIT_ITEM_FAST(TYPE, LABEL, V...) EDIT_ITEM_FAST_F(TYPE, GET_TEXT_F(LABEL), ##V)
|
||||
|
||||
#define _CONFIRM_ITEM_INNER_P(PLABEL, V...) do { \
|
||||
#define _CONFIRM_ITEM_INNER_F(FLABEL, V...) do { \
|
||||
if (encoderLine == _thisItemNr && ui.use_click()) { \
|
||||
ui.push_current_screen(); \
|
||||
ui.goto_screen([]{MenuItem_confirm::select_screen(V);}); \
|
||||
return; \
|
||||
} \
|
||||
if (ui.should_draw()) MenuItem_confirm::draw \
|
||||
(encoderLine == _thisItemNr, _lcdLineNr, PLABEL, ##V); \
|
||||
(encoderLine == _thisItemNr, _lcdLineNr, FLABEL, ##V); \
|
||||
}while(0)
|
||||
|
||||
// Indexed items set a global index value and optional data
|
||||
#define _CONFIRM_ITEM_P(PLABEL, V...) do { \
|
||||
#define _CONFIRM_ITEM_F(FLABEL, V...) do { \
|
||||
if (_menuLineNr == _thisItemNr) { \
|
||||
_skipStatic = false; \
|
||||
_CONFIRM_ITEM_INNER_P(PLABEL, ##V); \
|
||||
_CONFIRM_ITEM_INNER_F(FLABEL, ##V); \
|
||||
} \
|
||||
NEXT_ITEM(); \
|
||||
}while(0)
|
||||
|
||||
// Indexed items set a global index value
|
||||
#define _CONFIRM_ITEM_N_S_P(N, S, V...) do{ \
|
||||
#define _CONFIRM_ITEM_N_S_F(N, S, V...) do{ \
|
||||
if (_menuLineNr == _thisItemNr) { \
|
||||
_skipStatic = false; \
|
||||
MenuItemBase::init(N, S); \
|
||||
_CONFIRM_ITEM_INNER_P(TYPE, ##V); \
|
||||
_CONFIRM_ITEM_INNER_F(TYPE, ##V); \
|
||||
} \
|
||||
NEXT_ITEM(); \
|
||||
}while(0)
|
||||
|
||||
// Indexed items set a global index value
|
||||
#define _CONFIRM_ITEM_N_P(N, V...) _CONFIRM_ITEM_N_S_P(N, nullptr, V)
|
||||
#define _CONFIRM_ITEM_N_F(N, V...) _CONFIRM_ITEM_N_S_F(N, nullptr, V)
|
||||
|
||||
#define CONFIRM_ITEM_P(PLABEL,A,B,V...) _CONFIRM_ITEM_P(PLABEL, GET_TEXT(A), GET_TEXT(B), ##V)
|
||||
#define CONFIRM_ITEM(LABEL, V...) CONFIRM_ITEM_P(GET_TEXT(LABEL), ##V)
|
||||
#define CONFIRM_ITEM_F(FLABEL,A,B,V...) _CONFIRM_ITEM_F(FLABEL, GET_TEXT_F(A), GET_TEXT_F(B), ##V)
|
||||
#define CONFIRM_ITEM(LABEL, V...) CONFIRM_ITEM_F(GET_TEXT_F(LABEL), ##V)
|
||||
|
||||
#define YESNO_ITEM_P(PLABEL, V...) CONFIRM_ITEM_P(PLABEL, MSG_YES, MSG_NO, ##V)
|
||||
#define YESNO_ITEM(LABEL, V...) YESNO_ITEM_P(GET_TEXT(LABEL), ##V)
|
||||
#define YESNO_ITEM_F(FLABEL, V...) CONFIRM_ITEM_F(FLABEL, MSG_YES, MSG_NO, ##V)
|
||||
#define YESNO_ITEM(LABEL, V...) YESNO_ITEM_F(GET_TEXT_F(LABEL), ##V)
|
||||
|
||||
#define CONFIRM_ITEM_N_S_P(N,S,PLABEL,A,B,V...) _CONFIRM_ITEM_N_S_P(N, S, PLABEL, GET_TEXT(A), GET_TEXT(B), ##V)
|
||||
#define CONFIRM_ITEM_N_S(N,S,LABEL,V...) CONFIRM_ITEM_N_S_P(N, S, GET_TEXT(LABEL), ##V)
|
||||
#define CONFIRM_ITEM_N_P(N,PLABEL,A,B,V...) _CONFIRM_ITEM_N_P(N, PLABEL, GET_TEXT(A), GET_TEXT(B), ##V)
|
||||
#define CONFIRM_ITEM_N(N,LABEL, V...) CONFIRM_ITEM_N_P(N, GET_TEXT(LABEL), ##V)
|
||||
#define CONFIRM_ITEM_N_S_F(N,S,FLABEL,A,B,V...) _CONFIRM_ITEM_N_S_F(N, S, FLABEL, GET_TEXT_F(A), GET_TEXT_F(B), ##V)
|
||||
#define CONFIRM_ITEM_N_S(N,S,LABEL,V...) CONFIRM_ITEM_N_S_F(N, S, GET_TEXT_F(LABEL), ##V)
|
||||
#define CONFIRM_ITEM_N_F(N,FLABEL,A,B,V...) _CONFIRM_ITEM_N_F(N, FLABEL, GET_TEXT_F(A), GET_TEXT_F(B), ##V)
|
||||
#define CONFIRM_ITEM_N(N,LABEL, V...) CONFIRM_ITEM_N_F(N, GET_TEXT_F(LABEL), ##V)
|
||||
|
||||
#define YESNO_ITEM_N_S_P(N,S,PLABEL, V...) _CONFIRM_ITEM_N_S_P(N, S, PLABEL, MSG_YES, MSG_NO, ##V)
|
||||
#define YESNO_ITEM_N_S(N,S,LABEL, V...) YESNO_ITEM_N_S_P(N, S, GET_TEXT(LABEL), ##V)
|
||||
#define YESNO_ITEM_N_P(N,PLABEL, V...) CONFIRM_ITEM_N_P(N, PLABEL, MSG_YES, MSG_NO, ##V)
|
||||
#define YESNO_ITEM_N(N,LABEL, V...) YESNO_ITEM_N_P(N, GET_TEXT(LABEL), ##V)
|
||||
#define YESNO_ITEM_N_S_F(N,S,FLABEL, V...) _CONFIRM_ITEM_N_S_F(N, S, FLABEL, MSG_YES, MSG_NO, ##V)
|
||||
#define YESNO_ITEM_N_S(N,S,LABEL, V...) YESNO_ITEM_N_S_F(N, S, GET_TEXT_F(LABEL), ##V)
|
||||
#define YESNO_ITEM_N_F(N,FLABEL, V...) CONFIRM_ITEM_N_F(N, FLABEL, MSG_YES, MSG_NO, ##V)
|
||||
#define YESNO_ITEM_N(N,LABEL, V...) YESNO_ITEM_N_F(N, GET_TEXT_F(LABEL), ##V)
|
||||
|
||||
#if ENABLED(LEVEL_BED_CORNERS)
|
||||
void _lcd_level_bed_corners();
|
||||
|
||||
Reference in New Issue
Block a user