Confirm before starting SD print (#13616)

This commit is contained in:
Scott Lahteine
2019-04-08 13:44:35 -05:00
committed by GitHub
parent 7e0008f5b3
commit 9abe9aff56
87 changed files with 276 additions and 22 deletions

View File

@ -97,7 +97,7 @@ static void fontgroup_drawwchar(font_group_t *group, const font_t *fnt_default,
* @param utf8_msg : the UTF-8 string
* @param cb_read_byte : how to read the utf8_msg, from RAM or ROM (call read_byte_ram or pgm_read_byte)
* @param userdata : User's data
* @param cb_draw_ram : the callback function of userdata to draw a !RAM! string (actural it is to draw a one byte string in RAM)
* @param cb_draw_ram : the callback function of userdata to draw a !RAM! string (actually it is to draw a one byte string in RAM)
*
* @return N/A
*

View File

@ -401,6 +401,27 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
}
}
inline void draw_boxed_string(const uint8_t x, const uint8_t y, PGM_P const pstr, const bool inv) {
const uint8_t len = utf8_strlen_P(pstr), bw = len * (MENU_FONT_WIDTH),
bx = x * (MENU_FONT_WIDTH), by = (y + 1) * (MENU_FONT_HEIGHT);
if (inv) {
u8g.setColorIndex(1);
u8g.drawBox(bx - 1, by - (MENU_FONT_ASCENT) + 1, bw + 2, MENU_FONT_HEIGHT - 1);
u8g.setColorIndex(0);
}
lcd_moveto(bx, by);
lcd_put_u8str_P(pstr);
if (inv) u8g.setColorIndex(1);
}
void 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) {
SETCURSOR(0, 0); lcd_put_u8str_P(pref);
if (string) wrap_string(1, string);
if (suff) lcd_put_u8str_P(suff);
draw_boxed_string(1, LCD_HEIGHT - 1, no, !yesno);
draw_boxed_string(LCD_WIDTH - (utf8_strlen_P(yes) + 1), LCD_HEIGHT - 1, yes, yesno);
}
#if ENABLED(SDSUPPORT)
void draw_sd_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir) {