Browse Source

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

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
Keith Bennett 3 years ago
parent
commit
5b35f3a955
No account linked to committer's email address

+ 8
- 4
Marlin/src/lcd/HD44780/marlinui_HD44780.cpp View File

1117
   // The Select Screen presents a prompt and two "buttons"
1117
   // The Select Screen presents a prompt and two "buttons"
1118
   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*/) {
1118
   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*/) {
1119
     ui.draw_select_screen_prompt(pref, string, suff);
1119
     ui.draw_select_screen_prompt(pref, string, suff);
1120
-    SETCURSOR(0, LCD_HEIGHT - 1);
1121
-    lcd_put_wchar(yesno ? ' ' : '['); lcd_put_u8str_P(no); lcd_put_wchar(yesno ? ' ' : ']');
1122
-    SETCURSOR_RJ(utf8_strlen_P(yes) + 2, LCD_HEIGHT - 1);
1123
-    lcd_put_wchar(yesno ? '[' : ' '); lcd_put_u8str_P(yes); lcd_put_wchar(yesno ? ']' : ' ');
1120
+    if (no) {
1121
+      SETCURSOR(0, LCD_HEIGHT - 1);
1122
+      lcd_put_wchar(yesno ? ' ' : '['); lcd_put_u8str_P(no); lcd_put_wchar(yesno ? ' ' : ']');
1123
+    }
1124
+    if (yes) {
1125
+      SETCURSOR_RJ(utf8_strlen_P(yes) + 2, LCD_HEIGHT - 1);
1126
+      lcd_put_wchar(yesno ? '[' : ' '); lcd_put_u8str_P(yes); lcd_put_wchar(yesno ? ']' : ' ');
1127
+    }
1124
   }
1128
   }
1125
 
1129
 
1126
   #if ENABLED(SDSUPPORT)
1130
   #if ENABLED(SDSUPPORT)

+ 8
- 4
Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp View File

1003
   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) {
1003
   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) {
1004
     if (!PanelDetected) return;
1004
     if (!PanelDetected) return;
1005
     ui.draw_select_screen_prompt(pref, string, suff);
1005
     ui.draw_select_screen_prompt(pref, string, suff);
1006
-    lcd.setCursor(0, MIDDLE_Y);
1007
     lcd.write(COLOR_EDIT);
1006
     lcd.write(COLOR_EDIT);
1008
-    lcd.write(yesno ? ' ' : '['); lcd_put_u8str_P(no); lcd.write(yesno ? ' ' : ']');
1009
-    lcd.setCursor(LCD_WIDTH - utf8_strlen_P(yes) - 3, MIDDLE_Y);
1010
-    lcd.write(yesno ? '[' : ' '); lcd_put_u8str_P(yes); lcd.write(yesno ? ']' : ' ');
1007
+    if (no) {
1008
+      lcd.setCursor(0, MIDDLE_Y);
1009
+      lcd.write(yesno ? ' ' : '['); lcd_put_u8str_P(no); lcd.write(yesno ? ' ' : ']');
1010
+    }
1011
+    if (yes) {
1012
+      lcd.setCursor(LCD_WIDTH - utf8_strlen_P(yes) - 3, MIDDLE_Y);
1013
+      lcd.write(yesno ? '[' : ' '); lcd_put_u8str_P(yes); lcd.write(yesno ? ']' : ' ');
1014
+    }
1011
     lcd.print_line();
1015
     lcd.print_line();
1012
   }
1016
   }
1013
 
1017
 

+ 2
- 2
Marlin/src/lcd/dogm/marlinui_DOGM.cpp View File

519
 
519
 
520
   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*/) {
520
   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*/) {
521
     ui.draw_select_screen_prompt(pref, string, suff);
521
     ui.draw_select_screen_prompt(pref, string, suff);
522
-    draw_boxed_string(1, LCD_HEIGHT - 1, no, !yesno);
523
-    draw_boxed_string(LCD_WIDTH - (utf8_strlen_P(yes) * (USE_WIDE_GLYPH ? 2 : 1) + 1), LCD_HEIGHT - 1, yes, yesno);
522
+    if (no)  draw_boxed_string(1, LCD_HEIGHT - 1, no, !yesno);
523
+    if (yes) draw_boxed_string(LCD_WIDTH - (utf8_strlen_P(yes) * (USE_WIDE_GLYPH ? 2 : 1) + 1), LCD_HEIGHT - 1, yes, yesno);
524
   }
524
   }
525
 
525
 
526
   #if ENABLED(SDSUPPORT)
526
   #if ENABLED(SDSUPPORT)

+ 2
- 2
Marlin/src/lcd/e3v2/marlinui/ui_common.cpp View File

437
     dwin_font.solid = false;
437
     dwin_font.solid = false;
438
     dwin_font.fg = Color_White;
438
     dwin_font.fg = Color_White;
439
     ui.draw_select_screen_prompt(pref, string, suff);
439
     ui.draw_select_screen_prompt(pref, string, suff);
440
-    draw_boxed_string(false, no, !yesno);
441
-    draw_boxed_string(true, yes,  yesno);
440
+    if (no)  draw_boxed_string(false, no, !yesno);
441
+    if (yes) draw_boxed_string(true, yes,  yesno);
442
   }
442
   }
443
 
443
 
444
   #if ENABLED(SDSUPPORT)
444
   #if ENABLED(SDSUPPORT)

+ 1
- 1
Marlin/src/lcd/language/language_fr.h View File

111
   LSTR MSG_LEVEL_BED                      = _UxGT("Niveau du lit");
111
   LSTR MSG_LEVEL_BED                      = _UxGT("Niveau du lit");
112
   LSTR MSG_BED_TRAMMING                   = _UxGT("Niveau des coins");
112
   LSTR MSG_BED_TRAMMING                   = _UxGT("Niveau des coins");
113
   LSTR MSG_BED_TRAMMING_RAISE             = _UxGT("Relever le coin jusqu'à la sonde");
113
   LSTR MSG_BED_TRAMMING_RAISE             = _UxGT("Relever le coin jusqu'à la sonde");
114
-  LSTR MSG_BED_TRAMMING_IN_RANGE          = _UxGT("Coins dans la tolérance. Niveau lit ");
114
+  LSTR MSG_BED_TRAMMING_IN_RANGE          = _UxGT("Coins dans la tolérance. Niveau lit.");
115
   LSTR MSG_NEXT_CORNER                    = _UxGT("Coin suivant");
115
   LSTR MSG_NEXT_CORNER                    = _UxGT("Coin suivant");
116
   LSTR MSG_MESH_EDITOR                    = _UxGT("Modif. maille"); // 13 car. max
116
   LSTR MSG_MESH_EDITOR                    = _UxGT("Modif. maille"); // 13 car. max
117
   LSTR MSG_EDIT_MESH                      = _UxGT("Modifier grille");
117
   LSTR MSG_EDIT_MESH                      = _UxGT("Modifier grille");

+ 2
- 1
Marlin/src/lcd/menu/menu.cpp View File

368
   PGM_P const pref, const char * const string/*=nullptr*/, PGM_P const suff/*=nullptr*/
368
   PGM_P const pref, const char * const string/*=nullptr*/, PGM_P const suff/*=nullptr*/
369
 ) {
369
 ) {
370
   ui.defer_status_screen();
370
   ui.defer_status_screen();
371
-  const bool ui_selection = ui.update_selection(), got_click = ui.use_click();
371
+  const bool ui_selection = !yes ? false : !no || ui.update_selection(),
372
+             got_click = ui.use_click();
372
   if (got_click || ui.should_draw()) {
373
   if (got_click || ui.should_draw()) {
373
     draw_select_screen(yes, no, ui_selection, pref, string, suff);
374
     draw_select_screen(yes, no, ui_selection, pref, string, suff);
374
     if (got_click) {
375
     if (got_click) {

+ 6
- 4
Marlin/src/lcd/menu/menu_bed_corners.cpp View File

207
 
207
 
208
   void _lcd_draw_level_prompt() {
208
   void _lcd_draw_level_prompt() {
209
     if (!ui.should_draw()) return;
209
     if (!ui.should_draw()) return;
210
-    MenuItem_confirm::confirm_screen(
211
-        []{ queue.inject(TERN(HAS_LEVELING, F("G29N"), FPSTR(G28_STR))); ui.return_to_status(); }
212
-      , ui.goto_previous_screen_no_defer
210
+    MenuItem_confirm::select_screen(
211
+        GET_TEXT(TERN(HAS_LEVELING, MSG_BUTTON_LEVEL, MSG_BUTTON_DONE)),
212
+        TERN(HAS_LEVELING, GET_TEXT(MSG_BUTTON_BACK), nullptr)
213
+      , []{ queue.inject(TERN(HAS_LEVELING, F("G29N"), FPSTR(G28_STR))); ui.return_to_status(); }
214
+      , TERN(HAS_LEVELING, ui.goto_previous_screen_no_defer, []{})
213
       , GET_TEXT(MSG_BED_TRAMMING_IN_RANGE)
215
       , GET_TEXT(MSG_BED_TRAMMING_IN_RANGE)
214
-      , (const char*)nullptr, PSTR("?")
216
+      , (const char*)nullptr, NUL_STR
215
     );
217
     );
216
   }
218
   }
217
 
219
 

+ 2
- 2
Marlin/src/lcd/tft/ui_320x240.cpp View File

440
     tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
440
     tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
441
   }
441
   }
442
   #if ENABLED(TOUCH_SCREEN)
442
   #if ENABLED(TOUCH_SCREEN)
443
-    add_control(48, TFT_HEIGHT - 64, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL);
444
-    add_control(208, TFT_HEIGHT - 64, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM));
443
+    if (no)  add_control( 48, TFT_HEIGHT - 64, CANCEL,  imgCancel,  true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL);
444
+    if (yes) add_control(208, TFT_HEIGHT - 64, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM));
445
   #endif
445
   #endif
446
 }
446
 }
447
 
447
 

+ 2
- 2
Marlin/src/lcd/tft/ui_480x320.cpp View File

445
     tft.add_text(tft_string.center(TFT_WIDTH), 0, COLOR_MENU_TEXT, tft_string);
445
     tft.add_text(tft_string.center(TFT_WIDTH), 0, COLOR_MENU_TEXT, tft_string);
446
   }
446
   }
447
   #if ENABLED(TOUCH_SCREEN)
447
   #if ENABLED(TOUCH_SCREEN)
448
-    add_control(88, TFT_HEIGHT - 64, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL);
449
-    add_control(328, TFT_HEIGHT - 64, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM));
448
+    if (no)  add_control( 88, TFT_HEIGHT - 64, CANCEL,  imgCancel,  true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL);
449
+    if (yes) add_control(328, TFT_HEIGHT - 64, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM));
450
   #endif
450
   #endif
451
 }
451
 }
452
 
452
 

Loading…
Cancel
Save