Skip to content

Commit

Permalink
Reduce font size of mix source string is long.
Browse files Browse the repository at this point in the history
  • Loading branch information
philmoz committed Feb 15, 2025
1 parent cad12ca commit aab1105
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion radio/src/gui/colorlcd/libui/list_line_button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ InputMixButtonBase::InputMixButtonBase(Window* parent, uint8_t index) :
source = lv_label_create(lvobj);
lv_obj_set_pos(source, SRC_X, SRC_Y);
lv_obj_set_size(source, SRC_W, SRC_H);
etx_font(source, FONT_XS_INDEX, LV_STATE_USER_1);

opts = lv_label_create(lvobj);
lv_obj_set_pos(opts, OPT_X, OPT_Y);
Expand Down Expand Up @@ -103,7 +104,12 @@ void InputMixButtonBase::setWeight(gvar_t value, gvar_t min, gvar_t max)
void InputMixButtonBase::setSource(mixsrc_t idx)
{
char* s = getSourceString(idx);
lv_label_set_text(source, s);
if (getTextWidth(s, 0, FONT(STD)) > SRC_W)
lv_obj_add_state(source, LV_STATE_USER_1);
else
lv_obj_clear_state(source, LV_STATE_USER_1);

lv_label_set_text(source, s);
}

void InputMixButtonBase::setOpts(const char* s)
Expand Down

0 comments on commit aab1105

Please sign in to comment.