1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-29 23:07:42 +00:00

🚸 Better "Bed Tramming Done" dialog (#23616)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
Keith Bennett 2022-01-26 10:33:10 -08:00 committed by Scott Lahteine
parent 361dab93b3
commit 758dc7af9d
9 changed files with 33 additions and 22 deletions

View File

@ -1117,11 +1117,15 @@ void MarlinUI::draw_status_screen() {
// The Select Screen presents a prompt and two "buttons"
void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string/*=nullptr*/, PGM_P const suff/*=nullptr*/) {
ui.draw_select_screen_prompt(pref, string, suff);
if (no) {
SETCURSOR(0, LCD_HEIGHT - 1);
lcd_put_wchar(yesno ? ' ' : '['); lcd_put_u8str_P(no); lcd_put_wchar(yesno ? ' ' : ']');
}
if (yes) {
SETCURSOR_RJ(utf8_strlen_P(yes) + 2, LCD_HEIGHT - 1);
lcd_put_wchar(yesno ? '[' : ' '); lcd_put_u8str_P(yes); lcd_put_wchar(yesno ? ']' : ' ');
}
}
#if ENABLED(SDSUPPORT)

View File

@ -1003,11 +1003,15 @@ void MarlinUI::draw_status_screen() {
void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string, PGM_P const suff) {
if (!PanelDetected) return;
ui.draw_select_screen_prompt(pref, string, suff);
lcd.setCursor(0, MIDDLE_Y);
lcd.write(COLOR_EDIT);
if (no) {
lcd.setCursor(0, MIDDLE_Y);
lcd.write(yesno ? ' ' : '['); lcd_put_u8str_P(no); lcd.write(yesno ? ' ' : ']');
}
if (yes) {
lcd.setCursor(LCD_WIDTH - utf8_strlen_P(yes) - 3, MIDDLE_Y);
lcd.write(yesno ? '[' : ' '); lcd_put_u8str_P(yes); lcd.write(yesno ? ']' : ' ');
}
lcd.print_line();
}

View File

@ -519,8 +519,8 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string/*=nullptr*/, PGM_P const suff/*=nullptr*/) {
ui.draw_select_screen_prompt(pref, string, suff);
draw_boxed_string(1, LCD_HEIGHT - 1, no, !yesno);
draw_boxed_string(LCD_WIDTH - (utf8_strlen_P(yes) * (USE_WIDE_GLYPH ? 2 : 1) + 1), LCD_HEIGHT - 1, yes, yesno);
if (no) draw_boxed_string(1, LCD_HEIGHT - 1, no, !yesno);
if (yes) draw_boxed_string(LCD_WIDTH - (utf8_strlen_P(yes) * (USE_WIDE_GLYPH ? 2 : 1) + 1), LCD_HEIGHT - 1, yes, yesno);
}
#if ENABLED(SDSUPPORT)

View File

@ -437,8 +437,8 @@ void MarlinUI::draw_status_message(const bool blink) {
dwin_font.solid = false;
dwin_font.fg = Color_White;
ui.draw_select_screen_prompt(pref, string, suff);
draw_boxed_string(false, no, !yesno);
draw_boxed_string(true, yes, yesno);
if (no) draw_boxed_string(false, no, !yesno);
if (yes) draw_boxed_string(true, yes, yesno);
}
#if ENABLED(SDSUPPORT)

View File

@ -111,7 +111,7 @@ namespace Language_fr {
LSTR MSG_LEVEL_BED = _UxGT("Niveau du lit");
LSTR MSG_BED_TRAMMING = _UxGT("Niveau des coins");
LSTR MSG_BED_TRAMMING_RAISE = _UxGT("Relever le coin jusqu'à la sonde");
LSTR MSG_BED_TRAMMING_IN_RANGE = _UxGT("Coins dans la tolérance. Niveau lit ");
LSTR MSG_BED_TRAMMING_IN_RANGE = _UxGT("Coins dans la tolérance. Niveau lit.");
LSTR MSG_NEXT_CORNER = _UxGT("Coin suivant");
LSTR MSG_MESH_EDITOR = _UxGT("Modif. maille"); // 13 car. max
LSTR MSG_EDIT_MESH = _UxGT("Modifier grille");

View File

@ -368,7 +368,8 @@ void MenuItem_confirm::select_screen(
PGM_P const pref, const char * const string/*=nullptr*/, PGM_P const suff/*=nullptr*/
) {
ui.defer_status_screen();
const bool ui_selection = ui.update_selection(), got_click = ui.use_click();
const bool ui_selection = !yes ? false : !no || ui.update_selection(),
got_click = ui.use_click();
if (got_click || ui.should_draw()) {
draw_select_screen(yes, no, ui_selection, pref, string, suff);
if (got_click) {

View File

@ -207,11 +207,13 @@ static void _lcd_level_bed_corners_get_next_position() {
void _lcd_draw_level_prompt() {
if (!ui.should_draw()) return;
MenuItem_confirm::confirm_screen(
[]{ queue.inject(TERN(HAS_LEVELING, F("G29N"), FPSTR(G28_STR))); ui.return_to_status(); }
, ui.goto_previous_screen_no_defer
MenuItem_confirm::select_screen(
GET_TEXT(TERN(HAS_LEVELING, MSG_BUTTON_LEVEL, MSG_BUTTON_DONE)),
TERN(HAS_LEVELING, GET_TEXT(MSG_BUTTON_BACK), nullptr)
, []{ queue.inject(TERN(HAS_LEVELING, F("G29N"), FPSTR(G28_STR))); ui.return_to_status(); }
, TERN(HAS_LEVELING, ui.goto_previous_screen_no_defer, []{})
, GET_TEXT(MSG_BED_TRAMMING_IN_RANGE)
, (const char*)nullptr, PSTR("?")
, (const char*)nullptr, NUL_STR
);
}

View File

@ -440,8 +440,8 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
}
#if ENABLED(TOUCH_SCREEN)
add_control(48, TFT_HEIGHT - 64, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL);
add_control(208, TFT_HEIGHT - 64, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM));
if (no) add_control( 48, TFT_HEIGHT - 64, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL);
if (yes) add_control(208, TFT_HEIGHT - 64, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM));
#endif
}

View File

@ -445,8 +445,8 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
tft.add_text(tft_string.center(TFT_WIDTH), 0, COLOR_MENU_TEXT, tft_string);
}
#if ENABLED(TOUCH_SCREEN)
add_control(88, TFT_HEIGHT - 64, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL);
add_control(328, TFT_HEIGHT - 64, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM));
if (no) add_control( 88, TFT_HEIGHT - 64, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL);
if (yes) add_control(328, TFT_HEIGHT - 64, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM));
#endif
}