fix(color): Make size/appearance of number/text edit controls consistent with other UI elements (#3481)
* Fix minor layout issues arising from libopenui PR 89. * chore: Bump libopenui --------- Co-authored-by: Phil Mitchell <phil.a.mitchell@gmail.com>
This commit is contained in:
@@ -237,8 +237,10 @@ class LogicalSwitchEditPage : public Page
|
|||||||
void buildBody(FormWindow* window)
|
void buildBody(FormWindow* window)
|
||||||
{
|
{
|
||||||
window->setFlexLayout();
|
window->setFlexLayout();
|
||||||
|
window->padAll(0);
|
||||||
|
window->padLeft(4);
|
||||||
|
window->padRight(4);
|
||||||
FlexGridLayout grid(col_dsc, row_dsc, 2);
|
FlexGridLayout grid(col_dsc, row_dsc, 2);
|
||||||
lv_obj_set_style_pad_all(window->getLvObj(), lv_dpx(8), 0);
|
|
||||||
|
|
||||||
LogicalSwitchData* cs = lswAddress(index);
|
LogicalSwitchData* cs = lswAddress(index);
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class USBChannelEditStatusBar : public Window
|
|||||||
Window(parent, rect), _channel(channel)
|
Window(parent, rect), _channel(channel)
|
||||||
{
|
{
|
||||||
channelBar = new ComboChannelBar(this, {USBCH_EDIT_STATUS_BAR_MARGIN, 0, rect.w - (USBCH_EDIT_STATUS_BAR_MARGIN * 2), rect.h}, channel);
|
channelBar = new ComboChannelBar(this, {USBCH_EDIT_STATUS_BAR_MARGIN, 0, rect.w - (USBCH_EDIT_STATUS_BAR_MARGIN * 2), rect.h}, channel);
|
||||||
channelBar->setLeftMargin(0);
|
channelBar->setLeftMargin(15);
|
||||||
channelBar->setTextColor(COLOR_THEME_PRIMARY2);
|
channelBar->setTextColor(COLOR_THEME_PRIMARY2);
|
||||||
channelBar->setOutputChannelBarLimitColor(COLOR_THEME_EDIT);
|
channelBar->setOutputChannelBarLimitColor(COLOR_THEME_EDIT);
|
||||||
}
|
}
|
||||||
@@ -215,7 +215,7 @@ class USBChannelEditWindow : public Page
|
|||||||
Page(ICON_MODEL_USB), channel(channel)
|
Page(ICON_MODEL_USB), channel(channel)
|
||||||
{
|
{
|
||||||
auto form = new FormWindow(&body, rect_t{});
|
auto form = new FormWindow(&body, rect_t{});
|
||||||
form->padAll(4);
|
form->padAll(2);
|
||||||
form->padLeft(8);
|
form->padLeft(8);
|
||||||
form->padRight(8);
|
form->padRight(8);
|
||||||
|
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ PreflightChecks::PreflightChecks() : Page(ICON_MODEL_SETUP)
|
|||||||
#if NUM_POTS + NUM_SLIDERS
|
#if NUM_POTS + NUM_SLIDERS
|
||||||
line = form->newLine(&grid);
|
line = form->newLine(&grid);
|
||||||
new StaticText(line, rect_t{}, STR_POTWARNINGSTATE, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_POTWARNINGSTATE, 0, COLOR_THEME_PRIMARY1);
|
||||||
auto pots_wm = new Choice(line, rect_t{}, {STR_PREFLIGHT_POTSLIDER_CHECK}, 0, 2,
|
auto pots_wm = new Choice(line, rect_t{}, STR_PREFLIGHT_POTSLIDER_CHECK, 0, 2,
|
||||||
GET_SET_DEFAULT(g_model.potsWarnMode));
|
GET_SET_DEFAULT(g_model.potsWarnMode));
|
||||||
#if (NUM_POTS)
|
#if (NUM_POTS)
|
||||||
// Pot warnings
|
// Pot warnings
|
||||||
|
|||||||
@@ -181,21 +181,18 @@ class ThemedTextEdit : public TextEdit
|
|||||||
public:
|
public:
|
||||||
ThemedTextEdit(Window *parent, const rect_t &rect, char *text,
|
ThemedTextEdit(Window *parent, const rect_t &rect, char *text,
|
||||||
int colorBackgroundIndex, int colorTextIndex) :
|
int colorBackgroundIndex, int colorTextIndex) :
|
||||||
TextEdit(parent, rect, text, strlen(text)),
|
TextEdit(parent, rect, text, strlen(text), NO_FOCUS),
|
||||||
_colorBackgroundIndex(colorBackgroundIndex),
|
_colorBackgroundIndex(colorBackgroundIndex),
|
||||||
_colorTextIndex(colorTextIndex)
|
_colorTextIndex(colorTextIndex)
|
||||||
{
|
{
|
||||||
setBackgroundHandler([=] (FormField *field) {
|
|
||||||
return COLOR(_colorBackgroundIndex);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void paint(BitmapBuffer *dc) override
|
void paint(BitmapBuffer *dc) override
|
||||||
{
|
{
|
||||||
colorMaintainer.applyColorValues();
|
colorMaintainer.applyColorValues();
|
||||||
|
lv_obj_set_style_bg_color(lvobj, makeLvColor(COLOR(_colorBackgroundIndex)), LV_PART_MAIN);
|
||||||
|
lv_obj_set_style_text_color(lvobj, lv_color_white(), LV_PART_MAIN);
|
||||||
FormField::paint(dc);
|
FormField::paint(dc);
|
||||||
|
|
||||||
dc->drawSizedText(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, length, COLOR(_colorTextIndex));
|
|
||||||
colorMaintainer.restoreColorValues();
|
colorMaintainer.restoreColorValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,7 +203,6 @@ class ThemedTextEdit : public TextEdit
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(HARDWARE_KEYS)
|
#if defined(HARDWARE_KEYS)
|
||||||
void onEvent(event_t event) override
|
void onEvent(event_t event) override
|
||||||
{
|
{
|
||||||
@@ -214,7 +210,6 @@ class ThemedTextEdit : public TextEdit
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int _colorBackgroundIndex;
|
int _colorBackgroundIndex;
|
||||||
int _colorTextIndex;
|
int _colorTextIndex;
|
||||||
@@ -243,15 +238,13 @@ class PreviewWindow : public FormGroup
|
|||||||
new ThemedStaticText(this, {5, 115, 100, LINE_HEIGHT}, "Warning Text", COLOR_THEME_WARNING_INDEX);
|
new ThemedStaticText(this, {5, 115, 100, LINE_HEIGHT}, "Warning Text", COLOR_THEME_WARNING_INDEX);
|
||||||
new ThemedStaticText(this, {5, 140, 100, LINE_HEIGHT}, "Disabled Text", COLOR_THEME_DISABLED_INDEX);
|
new ThemedStaticText(this, {5, 140, 100, LINE_HEIGHT}, "Disabled Text", COLOR_THEME_DISABLED_INDEX);
|
||||||
|
|
||||||
static char EditText[128];
|
static char EditText[] = "Edit";
|
||||||
strcpy(EditText, "Edit");
|
|
||||||
new ThemedTextEdit(this, {5, 160, 100, LINE_HEIGHT + 1}, EditText,
|
new ThemedTextEdit(this, {5, 160, 100, LINE_HEIGHT + 1}, EditText,
|
||||||
COLOR_THEME_EDIT_INDEX, COLOR_THEME_PRIMARY2_INDEX);
|
COLOR_THEME_EDIT_INDEX, COLOR_THEME_PRIMARY2_INDEX);
|
||||||
static char FocusText[128];
|
static char FocusText[] = "Focus";
|
||||||
strcpy(FocusText, "Focus");
|
|
||||||
new ThemedTextEdit(this, {110, 160, 100, LINE_HEIGHT + 1}, FocusText,
|
new ThemedTextEdit(this, {110, 160, 100, LINE_HEIGHT + 1}, FocusText,
|
||||||
COLOR_THEME_FOCUS_INDEX, COLOR_THEME_PRIMARY2_INDEX);
|
COLOR_THEME_FOCUS_INDEX, COLOR_THEME_PRIMARY2_INDEX);
|
||||||
ticks = getTicks();
|
ticks = 0;
|
||||||
|
|
||||||
lv_group_set_default(def_group);
|
lv_group_set_default(def_group);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ void RadioHardwarePage::build(FormWindow * window)
|
|||||||
auto box = new FormGroup(line, rect_t{});
|
auto box = new FormGroup(line, rect_t{});
|
||||||
box->setFlexLayout(LV_FLEX_FLOW_ROW, lv_dpx(4));
|
box->setFlexLayout(LV_FLEX_FLOW_ROW, lv_dpx(4));
|
||||||
lv_obj_set_style_grid_cell_x_align(box->getLvObj(), LV_GRID_ALIGN_STRETCH, 0);
|
lv_obj_set_style_grid_cell_x_align(box->getLvObj(), LV_GRID_ALIGN_STRETCH, 0);
|
||||||
|
lv_obj_set_flex_align(box->getLvObj(), LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_SPACE_AROUND);
|
||||||
|
|
||||||
auto batMin =
|
auto batMin =
|
||||||
new NumberEdit(box, rect_t{}, -60 + 90, g_eeGeneral.vBatMax + 29 + 90,
|
new NumberEdit(box, rect_t{}, -60 + 90, g_eeGeneral.vBatMax + 29 + 90,
|
||||||
|
|||||||
@@ -133,6 +133,10 @@ class ThemeDetailsDialog: public Dialog
|
|||||||
theme(theme),
|
theme(theme),
|
||||||
saveHandler(saveHandler)
|
saveHandler(saveHandler)
|
||||||
{
|
{
|
||||||
|
content->form.padAll(4);
|
||||||
|
content->form.padLeft(8);
|
||||||
|
content->form.padRight(8);
|
||||||
|
|
||||||
lv_obj_set_style_bg_color(content->getLvObj(), makeLvColor(COLOR_THEME_SECONDARY3), 0);
|
lv_obj_set_style_bg_color(content->getLvObj(), makeLvColor(COLOR_THEME_SECONDARY3), 0);
|
||||||
lv_obj_set_style_bg_opa(content->getLvObj(), LV_OPA_100, LV_PART_MAIN);
|
lv_obj_set_style_bg_opa(content->getLvObj(), LV_OPA_100, LV_PART_MAIN);
|
||||||
auto form = new FormWindow(&content->form, rect_t{});
|
auto form = new FormWindow(&content->form, rect_t{});
|
||||||
@@ -141,12 +145,15 @@ class ThemeDetailsDialog: public Dialog
|
|||||||
FlexGridLayout grid(d_col_dsc, row_dsc, 2);
|
FlexGridLayout grid(d_col_dsc, row_dsc, 2);
|
||||||
|
|
||||||
auto line = form->newLine(&grid);
|
auto line = form->newLine(&grid);
|
||||||
|
line->padAll(0);
|
||||||
|
|
||||||
new StaticText(line, rect_t{}, STR_NAME, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_NAME, 0, COLOR_THEME_PRIMARY1);
|
||||||
auto te = new TextEdit(line, rect_t{}, this->theme.getName(), SELECTED_THEME_NAME_LEN);
|
auto te = new TextEdit(line, rect_t{}, this->theme.getName(), SELECTED_THEME_NAME_LEN);
|
||||||
lv_obj_set_grid_cell(te->getLvObj(), LV_GRID_ALIGN_STRETCH, 1, 1, LV_GRID_ALIGN_CENTER, 0, 1);
|
lv_obj_set_grid_cell(te->getLvObj(), LV_GRID_ALIGN_STRETCH, 1, 1, LV_GRID_ALIGN_CENTER, 0, 1);
|
||||||
|
|
||||||
line = form->newLine(&grid);
|
line = form->newLine(&grid);
|
||||||
|
line->padAll(0);
|
||||||
|
line->padTop(2);
|
||||||
|
|
||||||
new StaticText(line, rect_t{}, STR_AUTHOR, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_AUTHOR, 0, COLOR_THEME_PRIMARY1);
|
||||||
te = new TextEdit(line, rect_t{}, this->theme.getAuthor(), AUTHOR_LENGTH);
|
te = new TextEdit(line, rect_t{}, this->theme.getAuthor(), AUTHOR_LENGTH);
|
||||||
@@ -155,14 +162,17 @@ class ThemeDetailsDialog: public Dialog
|
|||||||
FlexGridLayout grid2(b_col_dsc, row_dsc, 2);
|
FlexGridLayout grid2(b_col_dsc, row_dsc, 2);
|
||||||
|
|
||||||
line = form->newLine(&grid2);
|
line = form->newLine(&grid2);
|
||||||
|
line->padAll(0);
|
||||||
|
|
||||||
new StaticText(line, rect_t{}, STR_DESCRIPTION, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_DESCRIPTION, 0, COLOR_THEME_PRIMARY1);
|
||||||
line = form->newLine(&grid2);
|
line = form->newLine(&grid2);
|
||||||
|
line->padAll(0);
|
||||||
te = new TextEdit(line, rect_t{}, this->theme.getInfo(), INFO_LENGTH);
|
te = new TextEdit(line, rect_t{}, this->theme.getInfo(), INFO_LENGTH);
|
||||||
lv_obj_set_grid_cell(te->getLvObj(), LV_GRID_ALIGN_STRETCH, 0, 2, LV_GRID_ALIGN_CENTER, 0, 1);
|
lv_obj_set_grid_cell(te->getLvObj(), LV_GRID_ALIGN_STRETCH, 0, 2, LV_GRID_ALIGN_CENTER, 0, 1);
|
||||||
|
|
||||||
line = form->newLine(&grid2);
|
line = form->newLine(&grid2);
|
||||||
line->padTop(20);
|
line->padAll(0);
|
||||||
|
line->padTop(10);
|
||||||
|
|
||||||
auto button = new TextButton(line, rect_t{0, 0, lv_pct(30), 32}, STR_SAVE, [=] () {
|
auto button = new TextButton(line, rect_t{0, 0, lv_pct(30), 32}, STR_SAVE, [=] () {
|
||||||
if (saveHandler != nullptr)
|
if (saveHandler != nullptr)
|
||||||
@@ -389,6 +399,7 @@ class ThemeEditPage : public Page
|
|||||||
started = true;
|
started = true;
|
||||||
_themeName->setText(_theme.getName());
|
_themeName->setText(_theme.getName());
|
||||||
}
|
}
|
||||||
|
Window::checkEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
void editColorPage()
|
void editColorPage()
|
||||||
|
|||||||
Vendored
+1
-1
Submodule radio/src/thirdparty/libopenui updated: 9a6378fe8c...9ade7c39af
Reference in New Issue
Block a user