Refactor ui sizes

This changes line 3 to line 3 large and adds
two new lines, line 3 and line 4, similar to
line 1 and line 2
This commit is contained in:
marco 2023-08-31 20:37:55 +02:00 committed by silseva
parent ffdc04be3e
commit d7578c4441
4 changed files with 69 additions and 27 deletions

View File

@ -152,6 +152,8 @@ typedef struct layout_t
uint16_t line1_h;
uint16_t line2_h;
uint16_t line3_h;
uint16_t line3_large_h;
uint16_t line4_h;
uint16_t menu_h;
uint16_t bottom_h;
uint16_t bottom_pad;
@ -162,12 +164,20 @@ typedef struct layout_t
point_t line1_pos;
point_t line2_pos;
point_t line3_pos;
point_t line3_large_pos;
point_t line4_pos;
point_t bottom_pos;
fontSize_t top_font;
symbolSize_t top_symbol_size;
fontSize_t line1_font;
symbolSize_t line1_symbol_size;
fontSize_t line2_font;
symbolSize_t line2_symbol_size;
fontSize_t line3_font;
symbolSize_t line3_symbol_size;
fontSize_t line3_large_font;
fontSize_t line4_font;
symbolSize_t line4_symbol_size;
fontSize_t bottom_font;
fontSize_t input_font;
fontSize_t menu_font;

View File

@ -285,7 +285,9 @@ static layout_t _ui_calculateLayout()
const uint16_t top_pad = 4;
const uint16_t line1_h = 20;
const uint16_t line2_h = 20;
const uint16_t line3_h = 40;
const uint16_t line3_h = 20;
const uint16_t line3_large_h = 40;
const uint16_t line4_h = 20;
const uint16_t menu_h = 16;
const uint16_t bottom_h = 23;
const uint16_t bottom_pad = top_pad;
@ -299,9 +301,15 @@ static layout_t _ui_calculateLayout()
const symbolSize_t top_symbol_size = SYMBOLS_SIZE_8PT;
// Text line font: 8 pt
const fontSize_t line1_font = FONT_SIZE_8PT;
const symbolSize_t line1_symbol_size = SYMBOLS_SIZE_8PT;
const fontSize_t line2_font = FONT_SIZE_8PT;
const symbolSize_t line2_symbol_size = SYMBOLS_SIZE_8PT;
const fontSize_t line3_font = FONT_SIZE_8PT;
const symbolSize_t line3_symbol_size = SYMBOLS_SIZE_8PT;
const fontSize_t line4_font = FONT_SIZE_8PT;
const symbolSize_t line4_symbol_size = SYMBOLS_SIZE_8PT;
// Frequency line font: 16 pt
const fontSize_t line3_font = FONT_SIZE_16PT;
const fontSize_t line3_large_font = FONT_SIZE_16PT;
// Bottom bar font: 8 pt
const fontSize_t bottom_font = FONT_SIZE_8PT;
// TimeDate/Frequency input font
@ -321,7 +329,9 @@ static layout_t _ui_calculateLayout()
const uint16_t top_pad = 1;
const uint16_t line1_h = 10;
const uint16_t line2_h = 10;
const uint16_t line3_h = 16;
const uint16_t line3_h = 10;
const uint16_t line3_large_h = 16;
const uint16_t line4_h = 10;
const uint16_t menu_h = 10;
const uint16_t bottom_h = 15;
const uint16_t bottom_pad = 0;
@ -335,8 +345,14 @@ static layout_t _ui_calculateLayout()
const symbolSize_t top_symbol_size = SYMBOLS_SIZE_6PT;
// Middle line fonts: 5, 8, 8 pt
const fontSize_t line1_font = FONT_SIZE_6PT;
const symbolSize_t line1_symbol_size = SYMBOLS_SIZE_6PT;
const fontSize_t line2_font = FONT_SIZE_6PT;
const fontSize_t line3_font = FONT_SIZE_10PT;
const symbolSize_t line2_symbol_size = SYMBOLS_SIZE_6PT;
const fontSize_t line3_font = FONT_SIZE_6PT;
const symbolSize_t line3_symbol_size = SYMBOLS_SIZE_6PT;
const fontSize_t line3_large_font = FONT_SIZE_10PT;
const fontSize_t line4_font = FONT_SIZE_6PT;
const symbolSize_t line4_symbol_size = SYMBOLS_SIZE_6PT;
// Bottom bar font: 6 pt
const fontSize_t bottom_font = FONT_SIZE_6PT;
// TimeDate/Frequency input font
@ -356,7 +372,9 @@ static layout_t _ui_calculateLayout()
const uint16_t top_pad = 1;
const uint16_t line1_h = 0;
const uint16_t line2_h = 10;
const uint16_t line3_h = 18;
const uint16_t line3_h = 10;
const uint16_t line3_large_h = 18;
const uint16_t line4_h = 10;
const uint16_t menu_h = 10;
const uint16_t bottom_h = 0;
const uint16_t bottom_pad = 0;
@ -370,7 +388,9 @@ static layout_t _ui_calculateLayout()
const symbolSize_t top_symbol_size = SYMBOLS_SIZE_6PT;
// Middle line fonts: 16, 16
const fontSize_t line2_font = FONT_SIZE_6PT;
const fontSize_t line3_font = FONT_SIZE_12PT;
const fontSize_t line3_font = FONT_SIZE_6PT;
const fontSize_t line4_font = FONT_SIZE_6PT;
const fontSize_t line3_large_font = FONT_SIZE_12PT;
// TimeDate/Frequency input font
const fontSize_t input_font = FONT_SIZE_8PT;
// Menu font
@ -391,7 +411,9 @@ static layout_t _ui_calculateLayout()
point_t top_pos = {horizontal_pad, top_h - status_v_pad - text_v_offset};
point_t line1_pos = {horizontal_pad, top_h + top_pad + line1_h - small_line_v_pad - text_v_offset};
point_t line2_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h - small_line_v_pad - text_v_offset};
point_t line3_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h + line3_h - big_line_v_pad - text_v_offset};
point_t line3_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h + line3_h - small_line_v_pad - text_v_offset};
point_t line4_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h + line3_h + line4_h - small_line_v_pad - text_v_offset};
point_t line3_large_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h + line3_large_h - big_line_v_pad - text_v_offset};
point_t bottom_pos = {horizontal_pad, SCREEN_HEIGHT - bottom_pad - status_v_pad - text_v_offset};
layout_t new_layout =
@ -401,6 +423,8 @@ static layout_t _ui_calculateLayout()
line1_h,
line2_h,
line3_h,
line3_large_h,
line4_h,
menu_h,
bottom_h,
bottom_pad,
@ -411,12 +435,20 @@ static layout_t _ui_calculateLayout()
line1_pos,
line2_pos,
line3_pos,
line3_large_pos,
line4_pos,
bottom_pos,
top_font,
top_symbol_size,
line1_font,
line1_symbol_size,
line2_font,
line2_symbol_size,
line3_font,
line3_symbol_size,
line3_large_font,
line4_font,
line4_symbol_size,
bottom_font,
input_font,
menu_font,

View File

@ -146,7 +146,7 @@ void _ui_drawFrequency()
frequency = last_state.channel.tx_frequency : last_state.channel.rx_frequency;
// Print big numbers frequency
gfx_print(layout.line3_pos, layout.line3_font, TEXT_ALIGN_CENTER,
gfx_print(layout.line3_large_pos, layout.line3_large_font, TEXT_ALIGN_CENTER,
color_white, "%03lu.%05lu",
(unsigned long)frequency/1000000,
(unsigned long)frequency%1000000/10);
@ -177,7 +177,7 @@ void _ui_drawVFOMiddleInput(ui_state_t* ui_state)
gfx_print(layout.line2_pos, layout.input_font, TEXT_ALIGN_CENTER,
color_white, ui_state->new_rx_freq_buf);
}
gfx_print(layout.line3_pos, layout.input_font, TEXT_ALIGN_CENTER,
gfx_print(layout.line3_large_pos, layout.input_font, TEXT_ALIGN_CENTER,
color_white, " Tx:%03lu.%04lu",
(unsigned long)last_state.channel.tx_frequency/1000000,
(unsigned long)(last_state.channel.tx_frequency%1000000)/100);
@ -191,7 +191,7 @@ void _ui_drawVFOMiddleInput(ui_state_t* ui_state)
// Replace Rx frequency with underscorses
if(ui_state->input_position == 0)
{
gfx_print(layout.line3_pos, layout.input_font, TEXT_ALIGN_CENTER,
gfx_print(layout.line3_large_pos, layout.input_font, TEXT_ALIGN_CENTER,
color_white, ">Tx:%03lu.%04lu",
(unsigned long)ui_state->new_rx_frequency/1000000,
(unsigned long)(ui_state->new_rx_frequency%1000000)/100);
@ -201,7 +201,7 @@ void _ui_drawVFOMiddleInput(ui_state_t* ui_state)
if(ui_state->input_position == 1)
strcpy(ui_state->new_tx_freq_buf, ">Tx:___.____");
ui_state->new_tx_freq_buf[insert_pos] = input_char;
gfx_print(layout.line3_pos, layout.input_font, TEXT_ALIGN_CENTER,
gfx_print(layout.line3_large_pos, layout.input_font, TEXT_ALIGN_CENTER,
color_white, ui_state->new_tx_freq_buf);
}
}

View File

@ -539,13 +539,13 @@ void _ui_drawMenuGPS()
point_t fix_pos = {layout.line2_pos.x, SCREEN_HEIGHT * 2 / 5};
// Print GPS status, if no fix, hide details
if(!last_state.settings.gps_enabled)
gfx_print(fix_pos, layout.line3_font, TEXT_ALIGN_CENTER,
gfx_print(fix_pos, layout.line3_large_font, TEXT_ALIGN_CENTER,
color_white, currentLanguage->gpsOff);
else if (last_state.gps_data.fix_quality == 0)
gfx_print(fix_pos, layout.line3_font, TEXT_ALIGN_CENTER,
gfx_print(fix_pos, layout.line3_large_font, TEXT_ALIGN_CENTER,
color_white, currentLanguage->noFix);
else if (last_state.gps_data.fix_quality == 6)
gfx_print(fix_pos, layout.line3_font, TEXT_ALIGN_CENTER,
gfx_print(fix_pos, layout.line3_large_font, TEXT_ALIGN_CENTER,
color_white, currentLanguage->fixLost);
else
{
@ -609,7 +609,7 @@ void _ui_drawMenuGPS()
last_state.gps_data.fix_quality != 0 &&
last_state.gps_data.fix_quality != 6);
// Draw satellites bar graph
point_t bar_pos = {layout.line3_pos.x + SCREEN_WIDTH * 1 / 3, SCREEN_HEIGHT / 2};
point_t bar_pos = {layout.line3_large_pos.x + SCREEN_WIDTH * 1 / 3, SCREEN_HEIGHT / 2};
gfx_drawGPSgraph(bar_pos,
(SCREEN_WIDTH * 2 / 3) - layout.horizontal_pad,
SCREEN_HEIGHT / 3,
@ -704,11 +704,11 @@ void _ui_drawMenuInfo(ui_state_t* ui_state)
void _ui_drawMenuAbout()
{
gfx_clearScreen();
point_t openrtx_pos = {layout.horizontal_pad, layout.line3_h};
point_t openrtx_pos = {layout.horizontal_pad, layout.line3_large_h};
if(SCREEN_HEIGHT >= 100)
ui_drawSplashScreen(false);
else
gfx_print(openrtx_pos, layout.line3_font, TEXT_ALIGN_CENTER,
gfx_print(openrtx_pos, layout.line3_large_font, TEXT_ALIGN_CENTER,
color_white, currentLanguage->openRTX);
uint8_t line_h = layout.menu_h;
point_t pos = {SCREEN_WIDTH / 7, SCREEN_HEIGHT - (line_h * (author_num - 1)) - 5};
@ -758,7 +758,7 @@ void _ui_drawSettingsTimeDate()
gfx_print(layout.line2_pos, layout.input_font, TEXT_ALIGN_CENTER,
color_white, "%02d/%02d/%02d",
local_time.date, local_time.month, local_time.year);
gfx_print(layout.line3_pos, layout.input_font, TEXT_ALIGN_CENTER,
gfx_print(layout.line3_large_pos, layout.input_font, TEXT_ALIGN_CENTER,
color_white, "%02d:%02d:%02d",
local_time.hour, local_time.minute, local_time.second);
}
@ -799,7 +799,7 @@ void _ui_drawSettingsTimeDateSet(ui_state_t* ui_state)
}
gfx_print(layout.line2_pos, layout.input_font, TEXT_ALIGN_CENTER,
color_white, ui_state->new_date_buf);
gfx_print(layout.line3_pos, layout.input_font, TEXT_ALIGN_CENTER,
gfx_print(layout.line3_large_pos, layout.input_font, TEXT_ALIGN_CENTER,
color_white, ui_state->new_time_buf);
}
#endif
@ -951,7 +951,7 @@ bool _ui_drawMacroMenu()
// Second row
// Calculate symmetric second row position, line2_pos is asymmetric like main screen
point_t pos_2 = {layout.line1_pos.x, layout.line1_pos.y +
(layout.line3_pos.y - layout.line1_pos.y)/2};
(layout.line3_large_pos.y - layout.line1_pos.y)/2};
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_LEFT,
yellow_fab413, "4");
if (last_state.channel.mode == OPMODE_FM)
@ -1000,24 +1000,24 @@ bool _ui_drawMacroMenu()
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_RIGHT,
color_white, "%.1gW", dBmToWatt(last_state.channel.power));
// Third row
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_LEFT,
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_LEFT,
yellow_fab413, "7");
#ifdef SCREEN_BRIGHTNESS
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_LEFT,
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_LEFT,
color_white, " B-");
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_LEFT,
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_LEFT,
color_white, " %5d",
state.settings.brightness);
#endif
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_CENTER,
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_CENTER,
yellow_fab413, "8");
#ifdef SCREEN_BRIGHTNESS
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_CENTER,
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_CENTER,
color_white, " B+");
#endif
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_RIGHT,
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_RIGHT,
yellow_fab413, "9 ");
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_RIGHT,
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_RIGHT,
color_white, "Lck");
// Draw S-meter bar