Miscellaneous LCD code renaming, reordering (#12430)

* Move special characters to language.h
* Apply some naming standards
* Clean up menu item draw functions
* Rename some Temperature methods
* UI => ExtUI
This commit is contained in:
Scott Lahteine
2018-11-14 13:13:51 -06:00
committed by GitHub
parent edfd106bc5
commit d82c350de7
17 changed files with 197 additions and 210 deletions

View File

@@ -265,13 +265,13 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
#endif // ADVANCED_PAUSE_FEATURE
// Set the colors for a menu item based on whether it is selected
static bool mark_as_selected(const uint8_t row, const bool isSelected) {
static bool mark_as_selected(const uint8_t row, const bool sel) {
row_y1 = row * (MENU_FONT_HEIGHT) + 1;
row_y2 = row_y1 + MENU_FONT_HEIGHT - 1;
if (!PAGE_CONTAINS(row_y1 + 1, row_y2 + 2)) return false;
if (isSelected) {
if (sel) {
#if ENABLED(MENU_HOLLOW_FRAME)
u8g.drawHLine(0, row_y1 + 1, LCD_PIXEL_WIDTH);
u8g.drawHLine(0, row_y2 + 2, LCD_PIXEL_WIDTH);
@@ -314,10 +314,10 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
}
// Draw a generic menu item
void draw_menu_item_generic(const bool isSelected, const uint8_t row, PGM_P const pstr, const char pre_char, const char post_char) {
void draw_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, const char pre_char, const char post_char) {
UNUSED(pre_char);
if (mark_as_selected(row, isSelected)) {
if (mark_as_selected(row, sel)) {
uint8_t n = LCD_WIDTH - 2;
n *= MENU_FONT_WIDTH;
n -= lcd_put_u8str_max_P(pstr, n);
@@ -329,8 +329,8 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
}
// Draw a menu item with an editable value
void _drawmenu_setting_edit_generic(const bool isSelected, const uint8_t row, PGM_P const pstr, const char* const data, const bool pgm) {
if (mark_as_selected(row, isSelected)) {
void _draw_menu_item_edit(const bool sel, const uint8_t row, PGM_P const pstr, const char* const data, const bool pgm) {
if (mark_as_selected(row, sel)) {
const uint8_t vallen = (pgm ? utf8_strlen_P(data) : utf8_strlen((char*)data));
uint8_t n = LCD_WIDTH - 2 - vallen;
n *= MENU_FONT_WIDTH;
@@ -396,10 +396,10 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
#if ENABLED(SDSUPPORT)
void draw_sd_menu_item(const bool isSelected, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir) {
void draw_sd_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir) {
UNUSED(pstr);
mark_as_selected(row, isSelected);
mark_as_selected(row, sel);
if (!PAGE_CONTAINS(row_y1, row_y2)) return;
@@ -408,7 +408,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
if (theCard.longFilename[0]) {
#if ENABLED(SCROLL_LONG_FILENAMES)
static uint8_t filename_scroll_hash;
if (isSelected) {
if (sel) {
uint8_t name_hash = row;
for (uint8_t l = FILENAME_LENGTH; l--;)
name_hash = ((name_hash << 1) | (name_hash >> 7)) ^ theCard.filename[l]; // rotate, xor