Преглед изворни кода

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

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
Keith Bennett пре 2 година
родитељ
комит
5b35f3a955
No account linked to committer's email address

+ 8
- 4
Marlin/src/lcd/HD44780/marlinui_HD44780.cpp Прегледај датотеку

@@ -1117,10 +1117,14 @@ void MarlinUI::draw_status_screen() {
1117 1117
   // The Select Screen presents a prompt and two "buttons"
1118 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 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 1130
   #if ENABLED(SDSUPPORT)

+ 8
- 4
Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp Прегледај датотеку

@@ -1003,11 +1003,15 @@ void MarlinUI::draw_status_screen() {
1003 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 1004
     if (!PanelDetected) return;
1005 1005
     ui.draw_select_screen_prompt(pref, string, suff);
1006
-    lcd.setCursor(0, MIDDLE_Y);
1007 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 1015
     lcd.print_line();
1012 1016
   }
1013 1017
 

+ 2
- 2
Marlin/src/lcd/dogm/marlinui_DOGM.cpp Прегледај датотеку

@@ -519,8 +519,8 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
519 519
 
520 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 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 526
   #if ENABLED(SDSUPPORT)

+ 2
- 2
Marlin/src/lcd/e3v2/marlinui/ui_common.cpp Прегледај датотеку

@@ -437,8 +437,8 @@ void MarlinUI::draw_status_message(const bool blink) {
437 437
     dwin_font.solid = false;
438 438
     dwin_font.fg = Color_White;
439 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 444
   #if ENABLED(SDSUPPORT)

+ 1
- 1
Marlin/src/lcd/language/language_fr.h Прегледај датотеку

@@ -111,7 +111,7 @@ namespace Language_fr {
111 111
   LSTR MSG_LEVEL_BED                      = _UxGT("Niveau du lit");
112 112
   LSTR MSG_BED_TRAMMING                   = _UxGT("Niveau des coins");
113 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 115
   LSTR MSG_NEXT_CORNER                    = _UxGT("Coin suivant");
116 116
   LSTR MSG_MESH_EDITOR                    = _UxGT("Modif. maille"); // 13 car. max
117 117
   LSTR MSG_EDIT_MESH                      = _UxGT("Modifier grille");

+ 2
- 1
Marlin/src/lcd/menu/menu.cpp Прегледај датотеку

@@ -368,7 +368,8 @@ void MenuItem_confirm::select_screen(
368 368
   PGM_P const pref, const char * const string/*=nullptr*/, PGM_P const suff/*=nullptr*/
369 369
 ) {
370 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 373
   if (got_click || ui.should_draw()) {
373 374
     draw_select_screen(yes, no, ui_selection, pref, string, suff);
374 375
     if (got_click) {

+ 6
- 4
Marlin/src/lcd/menu/menu_bed_corners.cpp Прегледај датотеку

@@ -207,11 +207,13 @@ static void _lcd_level_bed_corners_get_next_position() {
207 207
 
208 208
   void _lcd_draw_level_prompt() {
209 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 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 Прегледај датотеку

@@ -440,8 +440,8 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
440 440
     tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
441 441
   }
442 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 445
   #endif
446 446
 }
447 447
 

+ 2
- 2
Marlin/src/lcd/tft/ui_480x320.cpp Прегледај датотеку

@@ -445,8 +445,8 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
445 445
     tft.add_text(tft_string.center(TFT_WIDTH), 0, COLOR_MENU_TEXT, tft_string);
446 446
   }
447 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 450
   #endif
451 451
 }
452 452
 

Loading…
Откажи
Сачувај