Browse Source

Fix Menu Mixer for Color UI (#20566)

Victor Oliveira 3 years ago
parent
commit
185e31d322
No account linked to committer's email address

+ 9
- 0
Marlin/src/lcd/menu/menu_mixer.cpp View File

@@ -33,6 +33,10 @@
33 33
 
34 34
 #include "../../feature/mixing.h"
35 35
 
36
+#if HAS_GRAPHICAL_TFT
37
+  #include "../tft/tft.h"
38
+#endif
39
+
36 40
 #define CHANNEL_MIX_EDITING !HAS_DUAL_MIXING
37 41
 
38 42
 #if ENABLED(GRADIENT_MIX)
@@ -67,6 +71,9 @@
67 71
       mixer.refresh_gradient();
68 72
       ui.goto_previous_screen();
69 73
     }
74
+    else {
75
+      TERN_(HAS_GRAPHICAL_TFT, tft.draw_edit_screen_buttons());
76
+    }
70 77
   }
71 78
 
72 79
   void lcd_mixer_edit_gradient_menu() {
@@ -155,6 +162,8 @@ void lcd_mixer_mix_edit() {
155 162
       ui.goto_previous_screen();
156 163
     }
157 164
 
165
+    TERN_(HAS_GRAPHICAL_TFT, tft.draw_edit_screen_buttons());
166
+
158 167
   #else
159 168
 
160 169
     START_MENU();

+ 1
- 0
Marlin/src/lcd/tft/tft.h View File

@@ -93,6 +93,7 @@ class TFT {
93 93
     static inline void add_image(int16_t x, int16_t y, MarlinImage image, uint16_t color_main = COLOR_WHITE, uint16_t color_background = COLOR_BACKGROUND, uint16_t color_shadow = COLOR_BLACK) { queue.add_image(x, y, image, color_main,  color_background, color_shadow); }
94 94
     static inline void add_bar(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.add_bar(x, y, width, height, color); }
95 95
     static inline void add_rectangle(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.add_rectangle(x, y, width, height, color); }
96
+    static void draw_edit_screen_buttons();
96 97
 };
97 98
 
98 99
 extern TFT tft;

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

@@ -442,6 +442,10 @@ void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char* const valu
442 442
     #endif
443 443
   }
444 444
 
445
+  tft.draw_edit_screen_buttons();
446
+}
447
+
448
+void TFT::draw_edit_screen_buttons() {
445 449
   #if ENABLED(TOUCH_SCREEN)
446 450
     add_control(32, 176, DECREASE, imgDecrease);
447 451
     add_control(224, 176, INCREASE, imgIncrease);
@@ -658,6 +662,23 @@ void menu_item(const uint8_t row, bool sel ) {
658 662
   #endif
659 663
 }
660 664
 
665
+void lcd_moveto(const lcd_uint_t col, const lcd_uint_t row) {
666
+  #define TFT_COL_WIDTH ((TFT_WIDTH) / (LCD_WIDTH))
667
+  tft.canvas(col * TFT_COL_WIDTH, 4 + 45 * row, TFT_WIDTH - (col * TFT_COL_WIDTH), 43);
668
+  tft.set_background(COLOR_BACKGROUND);
669
+}
670
+
671
+int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
672
+  tft_string.set(utf8_str_P);
673
+  tft_string.trim();
674
+  tft.add_text(MENU_TEXT_X_OFFSET, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
675
+  return tft_string.width();
676
+}
677
+
678
+int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) {
679
+  return lcd_put_u8str_max_P(utf8_str, max_length);
680
+}
681
+
661 682
 void MarlinUI::move_axis_screen() {
662 683
 }
663 684
 

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

@@ -445,6 +445,10 @@ void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char* const valu
445 445
     #endif
446 446
   }
447 447
 
448
+  tft.draw_edit_screen_buttons();
449
+}
450
+
451
+void TFT::draw_edit_screen_buttons() {
448 452
   #if ENABLED(TOUCH_SCREEN)
449 453
     add_control(64, 256, DECREASE, imgDecrease);
450 454
     add_control(352, 256, INCREASE, imgIncrease);
@@ -661,6 +665,23 @@ void menu_item(const uint8_t row, bool sel ) {
661 665
   #endif
662 666
 }
663 667
 
668
+void lcd_moveto(const lcd_uint_t col, const lcd_uint_t row) {
669
+  #define TFT_COL_WIDTH ((TFT_WIDTH) / (LCD_WIDTH))
670
+  tft.canvas(col * TFT_COL_WIDTH, 4 + 45 * row, TFT_WIDTH - (col * TFT_COL_WIDTH), 43);
671
+  tft.set_background(COLOR_BACKGROUND);
672
+}
673
+
674
+int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
675
+  tft_string.set(utf8_str_P);
676
+  tft_string.trim();
677
+  tft.add_text(MENU_TEXT_X_OFFSET, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
678
+  return tft_string.width();
679
+}
680
+
681
+int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) {
682
+  return lcd_put_u8str_max_P(utf8_str, max_length);
683
+}
684
+
664 685
 #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
665 686
   #include "../../feature/babystep.h"
666 687
 #endif

Loading…
Cancel
Save