|
|
|
@@ -330,13 +330,13 @@ void MarlinUI::update_language_font() {
|
|
|
|
|
// The kill screen is displayed for unrecoverable conditions
|
|
|
|
|
void MarlinUI::draw_kill_screen() {
|
|
|
|
|
TERN_(LIGHTWEIGHT_UI, ST7920_Lite_Status_Screen::clear_text_buffer());
|
|
|
|
|
const u8g_uint_t h4 = u8g.getHeight() / 4;
|
|
|
|
|
const u8g_uint_t x = 0, h4 = u8g.getHeight() / 4;
|
|
|
|
|
u8g.firstPage();
|
|
|
|
|
do {
|
|
|
|
|
set_font(FONT_MENU);
|
|
|
|
|
lcd_put_u8str(0, h4 * 1, status_message);
|
|
|
|
|
lcd_put_u8str(0, h4 * 2, GET_TEXT_F(MSG_HALTED));
|
|
|
|
|
lcd_put_u8str(0, h4 * 3, GET_TEXT_F(MSG_PLEASE_RESET));
|
|
|
|
|
lcd_put_u8str(x, h4 * 1, status_message);
|
|
|
|
|
lcd_put_u8str(x, h4 * 2, GET_TEXT_F(MSG_HALTED));
|
|
|
|
|
lcd_put_u8str(x, h4 * 3, GET_TEXT_F(MSG_PLEASE_RESET));
|
|
|
|
|
} while (u8g.nextPage());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -412,28 +412,28 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Draw a static line of text in the same idiom as a menu item
|
|
|
|
|
void MenuItem_static::draw(const uint8_t row, FSTR_P const fstr, const uint8_t style/*=SS_DEFAULT*/, const char * const vstr/*=nullptr*/) {
|
|
|
|
|
void MenuItem_static::draw(const uint8_t row, FSTR_P const ftpl, const uint8_t style/*=SS_DEFAULT*/, const char * const vstr/*=nullptr*/) {
|
|
|
|
|
|
|
|
|
|
if (mark_as_selected(row, style & SS_INVERT)) {
|
|
|
|
|
pixel_len_t n = LCD_PIXEL_WIDTH; // pixel width of string allowed
|
|
|
|
|
|
|
|
|
|
const int plen = fstr ? calculateWidth(FTOP(fstr)) : 0,
|
|
|
|
|
const int plen = ftpl ? calculateWidth(ftpl) : 0,
|
|
|
|
|
vlen = vstr ? utf8_strlen(vstr) : 0;
|
|
|
|
|
if (style & SS_CENTER) {
|
|
|
|
|
int pad = (LCD_PIXEL_WIDTH - plen - vlen * MENU_FONT_WIDTH) / MENU_FONT_WIDTH / 2;
|
|
|
|
|
while (--pad >= 0) n -= lcd_put_wchar(' ');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (plen) n = lcd_put_u8str_ind(fstr, itemIndex, itemString, n / (MENU_FONT_WIDTH)) * (MENU_FONT_WIDTH);
|
|
|
|
|
if (plen) n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, n / (MENU_FONT_WIDTH)) * (MENU_FONT_WIDTH);
|
|
|
|
|
if (vlen) n -= lcd_put_u8str_max(vstr, n);
|
|
|
|
|
while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' ');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Draw a generic menu item
|
|
|
|
|
void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char, const char post_char) {
|
|
|
|
|
void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char, const char post_char) {
|
|
|
|
|
if (mark_as_selected(row, sel)) {
|
|
|
|
|
pixel_len_t n = lcd_put_u8str_ind(fstr, itemIndex, itemString, LCD_WIDTH - 1) * (MENU_FONT_WIDTH);
|
|
|
|
|
pixel_len_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 1) * (MENU_FONT_WIDTH);
|
|
|
|
|
while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' ');
|
|
|
|
|
lcd_put_wchar(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH), row_y2, post_char);
|
|
|
|
|
lcd_put_wchar(' ');
|
|
|
|
@@ -441,27 +441,27 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Draw a menu item with an editable value
|
|
|
|
|
void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char * const inStr, const bool pgm) {
|
|
|
|
|
void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char * const inStr, const bool pgm) {
|
|
|
|
|
if (mark_as_selected(row, sel)) {
|
|
|
|
|
const uint8_t vallen = (pgm ? utf8_strlen_P(inStr) : utf8_strlen((char*)inStr)),
|
|
|
|
|
pixelwidth = (pgm ? uxg_GetUtf8StrPixelWidthP(u8g.getU8g(), inStr) : uxg_GetUtf8StrPixelWidth(u8g.getU8g(), (char*)inStr));
|
|
|
|
|
const uint8_t vallen = (pgm ? utf8_strlen_P(inStr) : utf8_strlen(inStr)),
|
|
|
|
|
pixelwidth = (pgm ? uxg_GetUtf8StrPixelWidthP(u8g.getU8g(), inStr) : uxg_GetUtf8StrPixelWidth(u8g.getU8g(), inStr));
|
|
|
|
|
const u8g_uint_t prop = USE_WIDE_GLYPH ? 2 : 1;
|
|
|
|
|
|
|
|
|
|
pixel_len_t n = lcd_put_u8str_ind(fstr, itemIndex, itemString, LCD_WIDTH - 2 - vallen * prop) * (MENU_FONT_WIDTH);
|
|
|
|
|
pixel_len_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2 - vallen * prop) * (MENU_FONT_WIDTH);
|
|
|
|
|
if (vallen) {
|
|
|
|
|
lcd_put_wchar(':');
|
|
|
|
|
while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' ');
|
|
|
|
|
lcd_moveto(LCD_PIXEL_WIDTH - _MAX((MENU_FONT_WIDTH) * vallen, pixelwidth + 2), row_y2);
|
|
|
|
|
if (pgm) lcd_put_u8str_P(inStr); else lcd_put_u8str((char*)inStr);
|
|
|
|
|
if (pgm) lcd_put_u8str_P(inStr); else lcd_put_u8str(inStr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MenuEditItemBase::draw_edit_screen(FSTR_P const fstr, const char * const value/*=nullptr*/) {
|
|
|
|
|
void MenuEditItemBase::draw_edit_screen(FSTR_P const ftpl, const char * const value/*=nullptr*/) {
|
|
|
|
|
ui.encoder_direction_normal();
|
|
|
|
|
|
|
|
|
|
const u8g_uint_t prop = USE_WIDE_GLYPH ? 2 : 1;
|
|
|
|
|
const u8g_uint_t labellen = utf8_strlen(fstr), vallen = utf8_strlen(value);
|
|
|
|
|
const u8g_uint_t labellen = utf8_strlen(ftpl), vallen = utf8_strlen(value);
|
|
|
|
|
bool extra_row = labellen * prop > LCD_WIDTH - 2 - vallen * prop;
|
|
|
|
|
|
|
|
|
|
#if ENABLED(USE_BIG_EDIT_FONT)
|
|
|
|
@@ -490,7 +490,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
|
|
|
|
|
|
|
|
|
// Assume the label is alpha-numeric (with a descender)
|
|
|
|
|
bool onpage = PAGE_CONTAINS(baseline - (EDIT_FONT_ASCENT - 1), baseline + EDIT_FONT_DESCENT);
|
|
|
|
|
if (onpage) lcd_put_u8str_ind(0, baseline, fstr, itemIndex, itemString);
|
|
|
|
|
if (onpage) lcd_put_u8str(0, baseline, ftpl, itemIndex, itemStringC, itemStringF);
|
|
|
|
|
|
|
|
|
|
// If a value is included, print a colon, then print the value right-justified
|
|
|
|
|
if (value) {
|
|
|
|
@@ -522,8 +522,8 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
|
|
|
|
if (inv) u8g.setColorIndex(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, const bool yesno, FSTR_P const pref, const char * const string/*=nullptr*/, FSTR_P const suff/*=nullptr*/) {
|
|
|
|
|
ui.draw_select_screen_prompt(pref, string, suff);
|
|
|
|
|
void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, const bool yesno, FSTR_P const fpre, const char * const string/*=nullptr*/, FSTR_P const suff/*=nullptr*/) {
|
|
|
|
|
ui.draw_select_screen_prompt(fpre, string, suff);
|
|
|
|
|
if (no) draw_boxed_string(1, LCD_HEIGHT - 1, no, !yesno);
|
|
|
|
|
if (yes) draw_boxed_string(LCD_WIDTH - (utf8_strlen(yes) * (USE_WIDE_GLYPH ? 2 : 1) + 1), LCD_HEIGHT - 1, yes, yesno);
|
|
|
|
|
}
|
|
|
|
|