diff --git a/openrtx/include/ui.h b/openrtx/include/ui.h index f1ae5db1..e02527ff 100644 --- a/openrtx/include/ui.h +++ b/openrtx/include/ui.h @@ -119,6 +119,7 @@ typedef struct layout_t uint16_t line1_h; uint16_t line2_h; uint16_t line3_h; + uint16_t menu_h; uint16_t bottom_h; uint16_t status_v_pad; uint16_t horizontal_pad; @@ -134,6 +135,7 @@ typedef struct layout_t fontSize_t line3_font; fontSize_t bottom_font; fontSize_t input_font; + fontSize_t menu_font; } layout_t; /** diff --git a/openrtx/src/ui/ui.c b/openrtx/src/ui/ui.c index 5ec1e917..29b63647 100644 --- a/openrtx/src/ui/ui.c +++ b/openrtx/src/ui/ui.c @@ -205,6 +205,7 @@ layout_t _ui_calculateLayout() const uint16_t line1_h = 20; const uint16_t line2_h = 20; const uint16_t line3_h = 40; + const uint16_t menu_h = 16; const uint16_t bottom_h = 20; const uint16_t bottom_pad = top_pad; const uint16_t status_v_pad = 2; @@ -223,6 +224,8 @@ layout_t _ui_calculateLayout() const fontSize_t bottom_font = FONT_SIZE_8PT; // TimeDate/Frequency input font const fontSize_t input_font = FONT_SIZE_12PT; + // Menu font + const fontSize_t menu_font = FONT_SIZE_8PT; // Radioddity GD-77 #elif SCREEN_HEIGHT > 63 @@ -233,6 +236,7 @@ layout_t _ui_calculateLayout() const uint16_t line1_h = 10; const uint16_t line2_h = 10; const uint16_t line3_h = 16; + const uint16_t menu_h = 10; const uint16_t bottom_h = 8; const uint16_t bottom_pad = 0; const uint16_t status_v_pad = 1; @@ -250,6 +254,8 @@ layout_t _ui_calculateLayout() const fontSize_t bottom_font = FONT_SIZE_6PT; // TimeDate/Frequency input font const fontSize_t input_font = FONT_SIZE_8PT; + // Menu font + const fontSize_t menu_font = FONT_SIZE_6PT; // Radioddity RD-5R #elif SCREEN_HEIGHT > 47 @@ -260,6 +266,7 @@ layout_t _ui_calculateLayout() const uint16_t line1_h = 0; const uint16_t line2_h = 10; const uint16_t line3_h = 18; + const uint16_t menu_h = 10; const uint16_t bottom_h = 0; const uint16_t bottom_pad = 0; const uint16_t status_v_pad = 1; @@ -274,6 +281,8 @@ layout_t _ui_calculateLayout() const fontSize_t line3_font = FONT_SIZE_12PT; // TimeDate/Frequency input font const fontSize_t input_font = FONT_SIZE_8PT; + // Menu font + const fontSize_t menu_font = FONT_SIZE_6PT; // Not present on this resolution const fontSize_t line1_font = 0; const fontSize_t bottom_font = 0; @@ -296,6 +305,7 @@ layout_t _ui_calculateLayout() line1_h, line2_h, line3_h, + menu_h, bottom_h, status_v_pad, horizontal_pad, @@ -310,7 +320,8 @@ layout_t _ui_calculateLayout() line2_font, line3_font, bottom_font, - input_font + input_font, + menu_font }; return new_layout; } diff --git a/openrtx/src/ui/ui_menu.c b/openrtx/src/ui/ui_menu.c index d32eb7f4..0f9cc3c3 100644 --- a/openrtx/src/ui/ui_menu.c +++ b/openrtx/src/ui/ui_menu.c @@ -29,7 +29,7 @@ void _ui_drawMenuList(uint8_t selected, int (*getCurrentEntry)(char *buf, uint8_ { point_t pos = layout.line1_pos; // Number of menu entries that fit in the screen height - uint8_t entries_in_screen = (SCREEN_HEIGHT - 1 - pos.y) / layout.top_h + 1; + uint8_t entries_in_screen = (SCREEN_HEIGHT - 1 - pos.y) / layout.menu_h + 1; uint8_t scroll = 0; char entry_buf[MAX_ENTRY_LEN] = ""; color_t text_color = color_white; @@ -47,11 +47,11 @@ void _ui_drawMenuList(uint8_t selected, int (*getCurrentEntry)(char *buf, uint8_ { text_color = color_black; // Draw rectangle under selected item, compensating for text height - point_t rect_pos = {0, pos.y - layout.top_h + 3}; - gfx_drawRect(rect_pos, SCREEN_WIDTH, layout.top_h, color_white, true); + point_t rect_pos = {0, pos.y - layout.menu_h + 3}; + gfx_drawRect(rect_pos, SCREEN_WIDTH, layout.menu_h, color_white, true); } - gfx_print(pos, entry_buf, layout.top_font, TEXT_ALIGN_LEFT, text_color); - pos.y += layout.top_h; + gfx_print(pos, entry_buf, layout.menu_font, TEXT_ALIGN_LEFT, text_color); + pos.y += layout.menu_h; } } } @@ -62,7 +62,7 @@ void _ui_drawMenuListValue(ui_state_t* ui_state, uint8_t selected, { point_t pos = layout.line1_pos; // Number of menu entries that fit in the screen height - uint8_t entries_in_screen = (SCREEN_HEIGHT - 1 - pos.y) / layout.top_h + 1; + uint8_t entries_in_screen = (SCREEN_HEIGHT - 1 - pos.y) / layout.menu_h + 1; uint8_t scroll = 0; char entry_buf[MAX_ENTRY_LEN] = ""; char value_buf[MAX_ENTRY_LEN] = ""; @@ -90,12 +90,12 @@ void _ui_drawMenuListValue(ui_state_t* ui_state, uint8_t selected, text_color = color_white; full_rect = false; } - point_t rect_pos = {0, pos.y - layout.top_h + 3}; - gfx_drawRect(rect_pos, SCREEN_WIDTH, layout.top_h, color_white, full_rect); + point_t rect_pos = {0, pos.y - layout.menu_h + 3}; + gfx_drawRect(rect_pos, SCREEN_WIDTH, layout.menu_h, color_white, full_rect); } - gfx_print(pos, entry_buf, layout.top_font, TEXT_ALIGN_LEFT, text_color); - gfx_print(pos, value_buf, layout.top_font, TEXT_ALIGN_RIGHT, text_color); - pos.y += layout.top_h; + gfx_print(pos, entry_buf, layout.menu_font, TEXT_ALIGN_LEFT, text_color); + gfx_print(pos, value_buf, layout.menu_font, TEXT_ALIGN_RIGHT, text_color); + pos.y += layout.menu_h; } } } @@ -403,7 +403,7 @@ void _ui_drawMenuAbout() gfx_clearScreen(); ui_drawSplashScreen(false); char author_buf[MAX_ENTRY_LEN] = ""; - uint8_t line_h = layout.top_h; + uint8_t line_h = layout.menu_h; point_t pos = {SCREEN_WIDTH / 7, SCREEN_HEIGHT - (line_h * (author_num - 1)) - 5}; for(int author = 0; author < author_num; author++) {