From 1187b8082a8f7d2dbd36f7ff898c7b0a2634e5ef Mon Sep 17 00:00:00 2001 From: DiSlord Date: Thu, 4 Mar 2021 00:13:27 +0300 Subject: [PATCH] Better solve draw_menu on menu_push_submenu call Shift text up on 2 pixels for slider forms --- ui.c | 11 ++++++++--- ui_sa.c | 1 - 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ui.c b/ui.c index 2163212..69dbfa8 100644 --- a/ui.c +++ b/ui.c @@ -1342,7 +1342,6 @@ menu_move_back_and_leave_ui(void) static void menu_push_submenu(const menuitem_t *submenu) { - ui_mode = UI_MENU; // Only needed for auto mode setting erase_menu_buttons(); if (menu_current_level < MENU_STACK_DEPTH_MAX-1) menu_current_level++; @@ -1359,6 +1358,10 @@ menu_push_submenu(const menuitem_t *submenu) // request_to_redraw_grid(); area_width = AREA_WIDTH_NORMAL - MENU_BUTTON_WIDTH; } + if (ui_mode != UI_MENU){ + draw_menu(); // Draw menu only on enter menu mode + ui_mode = UI_MENU; // Only needed for auto mode setting + } } void @@ -1898,8 +1901,6 @@ draw_menu_buttons(const menuitem_t *menu) blit8BitWidthBitmap(button_start+3, y+(MENU_BUTTON_HEIGHT-ICON_HEIGHT)/2, ICON_WIDTH, ICON_HEIGHT, &check_box[button.icon*2*ICON_HEIGHT]); text_offs = button_start+6+ICON_WIDTH+1; } -// ili9341_drawstring_size(button.text, text_offs, y+(button_height-2*FONT_GET_HEIGHT)/2, 2); - ili9341_drawstring_10x14(button.text, text_offs, y+(button_height-wFONT_GET_HEIGHT)/2); #ifdef __ICONS__ if (menu[i].type & MT_ICON) { blit8BitWidthBitmap(button_start+MENU_FORM_WIDTH-2*FORM_ICON_WIDTH-8,y+(button_height-FORM_ICON_HEIGHT)/2,FORM_ICON_WIDTH,FORM_ICON_HEIGHT,& left_icons[((menu[i].data >>4)&0xf)*2*FORM_ICON_HEIGHT]); @@ -1907,7 +1908,9 @@ draw_menu_buttons(const menuitem_t *menu) } #endif int local_slider_positions = 0; + int local_text_shift = 0; if (MT_MASK(menu[i].type) == MT_KEYPAD) { + local_text_shift = 2; if (menu[i].data == KM_CENTER) { local_slider_positions = LCD_WIDTH/2+setting.slider_position; plot_printf(step_text_freq[0], sizeof step_text_freq[0], "-%3.0FHz", (float)setting.slider_span); @@ -1942,6 +1945,8 @@ draw_menu_buttons(const menuitem_t *menu) goto draw_slider; } #endif +// ili9341_drawstring_size(button.text, text_offs, y+(button_height-2*FONT_GET_HEIGHT)/2-local_text_shift, 2); + ili9341_drawstring_10x14(button.text, text_offs, y+(button_height-wFONT_GET_HEIGHT)/2-local_text_shift); } else { int button_width = MENU_BUTTON_WIDTH; int button_start = LCD_WIDTH - MENU_BUTTON_WIDTH; diff --git a/ui_sa.c b/ui_sa.c index ef5dc4c..41976ef 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -2537,7 +2537,6 @@ int invoke_quick_menu(int y) selection = -1; menu_current_level = 0; menu_push_submenu(quick_menu[i]); - draw_menu(); } return TRUE; }