|
@@ -305,11 +305,8 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
305
|
305
|
while (--pad >= 0) { lcd_put_wchar(' '); n--; }
|
306
|
306
|
}
|
307
|
307
|
n -= lcd_put_u8str_max_P(pstr, n);
|
308
|
|
- if (NULL != valstr) {
|
309
|
|
- n -= lcd_put_u8str_max(valstr, n);
|
310
|
|
- }
|
311
|
|
-
|
312
|
|
- while (n - MENU_FONT_WIDTH > 0) { n -= lcd_put_wchar(' '); }
|
|
308
|
+ if (valstr) n -= lcd_put_u8str_max(valstr, n);
|
|
309
|
+ while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' ');
|
313
|
310
|
}
|
314
|
311
|
}
|
315
|
312
|
|
|
@@ -318,10 +315,9 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
318
|
315
|
UNUSED(pre_char);
|
319
|
316
|
|
320
|
317
|
if (mark_as_selected(row, sel)) {
|
321
|
|
- uint8_t n = LCD_WIDTH - 2;
|
322
|
|
- n *= MENU_FONT_WIDTH;
|
|
318
|
+ uint8_t n = (LCD_WIDTH - 2) * (MENU_FONT_WIDTH);
|
323
|
319
|
n -= lcd_put_u8str_max_P(pstr, n);
|
324
|
|
- while (n - MENU_FONT_WIDTH > 0) { n -= lcd_put_wchar(' '); }
|
|
320
|
+ while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' ');
|
325
|
321
|
lcd_moveto(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH), row_y2);
|
326
|
322
|
lcd_put_wchar(post_char);
|
327
|
323
|
lcd_put_wchar(' ');
|
|
@@ -332,11 +328,10 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
332
|
328
|
void _draw_menu_item_edit(const bool sel, const uint8_t row, PGM_P const pstr, const char* const data, const bool pgm) {
|
333
|
329
|
if (mark_as_selected(row, sel)) {
|
334
|
330
|
const uint8_t vallen = (pgm ? utf8_strlen_P(data) : utf8_strlen((char*)data));
|
335
|
|
- uint8_t n = LCD_WIDTH - 2 - vallen;
|
336
|
|
- n *= MENU_FONT_WIDTH;
|
|
331
|
+ uint8_t n = (LCD_WIDTH - 2 - vallen) * (MENU_FONT_WIDTH);
|
337
|
332
|
n -= lcd_put_u8str_max_P(pstr, n);
|
338
|
333
|
lcd_put_wchar(':');
|
339
|
|
- while (n - MENU_FONT_WIDTH > 0) { n -= lcd_put_wchar(' '); }
|
|
334
|
+ while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' ');
|
340
|
335
|
lcd_moveto(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH) * vallen, row_y2);
|
341
|
336
|
if (pgm) lcd_put_u8str_P(data); else lcd_put_u8str((char*)data);
|
342
|
337
|
}
|
|
@@ -399,37 +394,13 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
399
|
394
|
void draw_sd_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir) {
|
400
|
395
|
UNUSED(pstr);
|
401
|
396
|
|
402
|
|
- mark_as_selected(row, sel);
|
403
|
|
-
|
404
|
|
- if (!PAGE_CONTAINS(row_y1, row_y2)) return;
|
405
|
|
-
|
406
|
|
- constexpr uint8_t maxlen = LCD_WIDTH - 1;
|
407
|
|
- const char *outstr = theCard.longest_filename();
|
408
|
|
- if (theCard.longFilename[0]) {
|
409
|
|
- #if ENABLED(SCROLL_LONG_FILENAMES)
|
410
|
|
- static uint8_t filename_scroll_hash;
|
411
|
|
- if (sel) {
|
412
|
|
- uint8_t name_hash = row;
|
413
|
|
- for (uint8_t l = FILENAME_LENGTH; l--;)
|
414
|
|
- name_hash = ((name_hash << 1) | (name_hash >> 7)) ^ theCard.filename[l]; // rotate, xor
|
415
|
|
- if (filename_scroll_hash != name_hash) { // If the hash changed...
|
416
|
|
- filename_scroll_hash = name_hash; // Save the new hash
|
417
|
|
- ui.filename_scroll_max = MAX(0, utf8_strlen(theCard.longFilename) - maxlen); // Update the scroll limit
|
418
|
|
- ui.filename_scroll_pos = 0; // Reset scroll to the start
|
419
|
|
- ui.lcd_status_update_delay = 8; // Don't scroll right away
|
420
|
|
- }
|
421
|
|
- outstr += ui.filename_scroll_pos;
|
422
|
|
- }
|
423
|
|
- #else
|
424
|
|
- theCard.longFilename[maxlen] = '\0'; // cutoff at screen edge
|
425
|
|
- #endif
|
|
397
|
+ if (mark_as_selected(row, sel)) {
|
|
398
|
+ if (isDir) lcd_put_wchar(LCD_STR_FOLDER[0]);
|
|
399
|
+ constexpr uint8_t maxlen = LCD_WIDTH - 1;
|
|
400
|
+ const uint8_t pixw = maxlen * (MENU_FONT_WIDTH);
|
|
401
|
+ uint8_t n = pixw - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), pixw);
|
|
402
|
+ while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' ');
|
426
|
403
|
}
|
427
|
|
-
|
428
|
|
- if (isDir) lcd_put_wchar(LCD_STR_FOLDER[0]);
|
429
|
|
-
|
430
|
|
- uint8_t n = lcd_put_u8str_max(outstr, maxlen * (MENU_FONT_WIDTH));
|
431
|
|
- n = maxlen * (MENU_FONT_WIDTH) - n;
|
432
|
|
- while (n - MENU_FONT_WIDTH > 0) { n -= lcd_put_wchar(' '); }
|
433
|
404
|
}
|
434
|
405
|
|
435
|
406
|
#endif // SDSUPPORT
|