Browse Source

⚡️ Fix, enhance FTDI Eve Touch UI (#22619)

Marcio T 4 years ago
parent
commit
6e40dbe0d3
No account linked to committer's email address

+ 8
- 4
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_box.cpp View File

23
 
23
 
24
 #if ENABLED(FTDI_EXTENDED)
24
 #if ENABLED(FTDI_EXTENDED)
25
 
25
 
26
+#define IS_LINE_SEPARATOR(c) c == '\n' || c == '\t'
27
+#define IS_WORD_SEPARATOR(c) c == ' '
28
+#define IS_SEPARATOR(c) IS_LINE_SEPARATOR(c) || IS_WORD_SEPARATOR(c)
29
+
26
 namespace FTDI {
30
 namespace FTDI {
27
   /**
31
   /**
28
    * Given a str, end will be set to the position at which a line needs to
32
    * Given a str, end will be set to the position at which a line needs to
37
       const char *next = p;
41
       const char *next = p;
38
       const utf8_char_t c = get_utf8_char_and_inc(next);
42
       const utf8_char_t c = get_utf8_char_and_inc(next);
39
       // Decide whether to break the string at this location
43
       // Decide whether to break the string at this location
40
-      if (c == '\n' || c == '\0' || c == ' ') {
44
+      if (IS_SEPARATOR(c) || c == '\0' ) {
41
         end = p;
45
         end = p;
42
         result = lw;
46
         result = lw;
43
       }
47
       }
44
-      if (c == '\n' || c == '\0') break;
48
+      if (IS_LINE_SEPARATOR(c) || c == '\0') break;
45
       // Measure the next character
49
       // Measure the next character
46
       const uint16_t cw = use_utf8 ? utf8_fm.get_char_width(c) : clcd_fm.char_widths[(uint8_t)c];
50
       const uint16_t cw = use_utf8 ? utf8_fm.get_char_width(c) : clcd_fm.char_widths[(uint8_t)c];
47
       // Stop processing once string exceeds the display width
51
       // Stop processing once string exceeds the display width
69
       const uint16_t line_width = find_line_break(utf8_fm, clcd_fm, wrap_width, line_start, line_end, use_utf8);
73
       const uint16_t line_width = find_line_break(utf8_fm, clcd_fm, wrap_width, line_start, line_end, use_utf8);
70
       width  = max(width, line_width);
74
       width  = max(width, line_width);
71
       height += utf8_fm.get_height();
75
       height += utf8_fm.get_height();
72
-      if (*line_end == '\n' || *line_end == ' ') line_end++;
76
+      if (IS_SEPARATOR(*line_end)) line_end++;
73
       if (*line_end == '\0') break;
77
       if (*line_end == '\0') break;
74
       if (line_end == line_start) break;
78
       if (line_end == line_start) break;
75
       line_start = line_end;
79
       line_start = line_end;
124
       }
128
       }
125
       y += utf8_fm.get_height();
129
       y += utf8_fm.get_height();
126
 
130
 
127
-      if (*line_end == '\n' || *line_end == ' ') line_end++;
131
+      if (IS_SEPARATOR(*line_end)) line_end++;
128
       if (*line_end == '\0') break;
132
       if (*line_end == '\0') break;
129
       if (line_end == line_start) break;
133
       if (line_end == line_start) break;
130
       line_start = line_end;
134
       line_start = line_end;

+ 26
- 0
Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/bitmaps.h View File

229
     0x00, 0x0F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00
229
     0x00, 0x0F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00
230
   };
230
   };
231
 
231
 
232
+  constexpr PROGMEM bitmap_info_t Light_Bulb_Info = {
233
+    .format       = L1,
234
+    .linestride   = 4,
235
+    .filter       = BILINEAR,
236
+    .wrapx        = BORDER,
237
+    .wrapy        = BORDER,
238
+    .RAMG_offset  = 8685,
239
+    .width        = 31,
240
+    .height       = 32,
241
+  };
242
+  
243
+  const unsigned char Light_Bulb[128] PROGMEM = {
244
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
245
+    0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x40,
246
+    0x02, 0x00, 0x00, 0x80, 0x01, 0x00, 0x01, 0x00, 0x00, 0x80, 0x02, 0x00,
247
+    0x00, 0x0F, 0xE0, 0x00, 0x00, 0x18, 0x30, 0x00, 0x00, 0x36, 0x18, 0x00,
248
+    0x00, 0x2C, 0x08, 0x00, 0x00, 0x58, 0x04, 0x00, 0x00, 0x50, 0x04, 0x00,
249
+    0x7C, 0x50, 0x04, 0x7C, 0x00, 0x40, 0x04, 0x00, 0x00, 0x40, 0x04, 0x00,
250
+    0x00, 0x60, 0x0C, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x10, 0x10, 0x00,
251
+    0x00, 0x10, 0x10, 0x00, 0x00, 0x88, 0x22, 0x00, 0x01, 0x08, 0x21, 0x00,
252
+    0x02, 0x08, 0x20, 0x80, 0x04, 0x0F, 0xE0, 0x40, 0x00, 0x07, 0xC0, 0x00,
253
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00,
254
+    0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00
255
+  };
256
+
232
   constexpr PROGMEM uint32_t UTF8_FONT_OFFSET  = 10000;
257
   constexpr PROGMEM uint32_t UTF8_FONT_OFFSET  = 10000;
258
+  constexpr PROGMEM uint32_t BACKGROUND_OFFSET = 40000;
233
 }; // namespace Theme
259
 }; // namespace Theme

Loading…
Cancel
Save