feat(color): Add LVGL scroll bar where needed (#3268)

* Add scroll bar to radio settings/config pages.

* Add scroll bar to mode settings/config pages and screen settings pages.

* For pages display via TabsGroup class. move the scroll bar setting to the 'body' window.

* Fix position of new line on Inputs and Mixes pages.

* chore: Bump `libopenui`
This commit is contained in:
philmoz
2023-03-24 11:37:21 +10:00
committed by GitHub
parent 1aa28a6295
commit 8fc5a1c58e
26 changed files with 104 additions and 149 deletions
+2 -5
View File
@@ -33,6 +33,8 @@ CurveDataEdit::CurveDataEdit(Window * parent, const rect_t & rect, uint8_t index
Window(parent, rect, FORM_FORWARD_FOCUS),
index(index)
{
lv_obj_set_style_bg_color(lvobj, makeLvColor(COLOR_THEME_SECONDARY3), 0);
lv_obj_set_scrollbar_mode(lvobj, LV_SCROLLBAR_MODE_AUTO);
}
#if LCD_W > LCD_H
@@ -169,11 +171,6 @@ void CurveDataEdit::update()
}
}
void CurveDataEdit::paint(BitmapBuffer* dc)
{
dc->clear(COLOR_THEME_SECONDARY3);
}
void CurveEdit::SetCurrentSource(uint32_t source)
{
CurveEdit::currentSource = source;
-2
View File
@@ -79,8 +79,6 @@ class CurveDataEdit : public Window
update();
}
void paint(BitmapBuffer * dc) override;
void update();
protected:
+1
View File
@@ -57,6 +57,7 @@ InputEditWindow::InputEditWindow(int8_t input, uint8_t index) :
auto box = new Window(&body, rect_t{});
auto box_obj = box->getLvObj();
lv_obj_set_flex_grow(box_obj, 2);
lv_obj_set_scrollbar_mode(box->getLvObj(), LV_SCROLLBAR_MODE_AUTO);
#if LCD_H > LCD_W // portrait
box->setWidth(body.width() - 2*lv_dpx(8));
+4 -4
View File
@@ -202,8 +202,8 @@ void ModelCurvesPage::build(FormWindow * window)
#endif
static const lv_coord_t row_dsc[] = {LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
auto form = new FormWindow(window, rect_t{});
form->setFlexLayout();
window->padAll(6);
window->setFlexLayout();
FlexGridLayout grid(col_dsc, row_dsc);
@@ -218,7 +218,7 @@ void ModelCurvesPage::build(FormWindow * window)
for (uint8_t index = 0; index < MAX_CURVES; index++) {
if (isCurveUsed(index)) {
if ((curveIndex % PER_ROW) == 0) {
line = form->newLine(&grid);
line = window->newLine(&grid);
lv_obj_set_grid_align(line->getLvObj(), LV_GRID_ALIGN_SPACE_BETWEEN, LV_GRID_ALIGN_SPACE_BETWEEN);
}
@@ -281,7 +281,7 @@ void ModelCurvesPage::build(FormWindow * window)
if (curveIndex < MAX_CURVES) {
if ((curveIndex % PER_ROW) == 0) {
line = form->newLine(&grid);
line = window->newLine(&grid);
lv_obj_set_grid_align(line->getLvObj(), LV_GRID_ALIGN_SPACE_BETWEEN,
LV_GRID_ALIGN_SPACE_BETWEEN);
}
+4 -9
View File
@@ -215,7 +215,7 @@ void ModelInputsPage::removeLine(InputMixButton* l)
}
}
InputMixGroup* ModelInputsPage::createGroup(FormGroup* form, mixsrc_t src)
InputMixGroup* ModelInputsPage::createGroup(FormWindow* form, mixsrc_t src)
{
return new InputMixGroup(form, src);
}
@@ -442,15 +442,10 @@ void ModelInputsPage::pasteInputAfter(uint8_t dst_idx)
void ModelInputsPage::build(FormWindow *window)
{
window->setFlexLayout();
window->padRow(lv_dpx(8));
window->setFlexLayout(LV_FLEX_FLOW_COLUMN, 3);
form = new FormGroup(window, rect_t{});
form->setFlexLayout();
form->padRow(lv_dpx(4));
auto form_obj = form->getLvObj();
lv_obj_set_width(form_obj, lv_pct(100));
form = new FormWindow(window, rect_t{});
form->setFlexLayout(LV_FLEX_FLOW_COLUMN, 3);
groups.clear();
lines.clear();
+2 -2
View File
@@ -34,7 +34,7 @@ class ModelInputsPage : public PageTab
void build(FormWindow *window) override;
protected:
FormGroup* form = nullptr;
FormWindow* form = nullptr;
std::list<InputMixGroup*> groups;
std::list<InputMixButton*> lines;
InputMixButton* _copySrc = nullptr;
@@ -49,7 +49,7 @@ class ModelInputsPage : public PageTab
virtual void addLineButton(uint8_t index);
virtual void addLineButton(mixsrc_t src, uint8_t index);
virtual InputMixGroup* createGroup(FormGroup* form, mixsrc_t src);
virtual InputMixGroup* createGroup(FormWindow* form, mixsrc_t src);
virtual InputMixButton* createLineButton(InputMixGroup *group, uint8_t index);
void newInput();
@@ -564,10 +564,7 @@ void ModelLogicalSwitchesPage::build(FormWindow* window)
static const lv_coord_t l_col_dsc[] = {LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
window->padAll(4);
auto form = new FormWindow(window, rect_t{});
form->setFlexLayout();
form->padAll(0);
window->setFlexLayout(LV_FLEX_FLOW_COLUMN, 0);
FlexGridLayout grid(l_col_dsc, row_dsc, 2);
@@ -584,7 +581,7 @@ void ModelLogicalSwitchesPage::build(FormWindow* window)
bool isActive = (ls->func != LS_FUNC_NONE);
if (isActive) {
line = form->newLine(&grid);
line = window->newLine(&grid);
button = new LogicalSwitchButton(line, rect_t{0, 0, window->width() - 12, LS_BUTTON_H}, i);
@@ -647,7 +644,7 @@ void ModelLogicalSwitchesPage::build(FormWindow* window)
}
if (hasEmptySwitch) {
line = form->newLine(&grid);
line = window->newLine(&grid);
addButton =
new TextButton(line, rect_t{0, 0, window->width() - 12, LS_BUTTON_H},
LV_SYMBOL_PLUS, [=]() {
@@ -289,11 +289,8 @@ void ModelMixerScriptsPage::rebuild(FormWindow * window, int8_t focusIdx)
void ModelMixerScriptsPage::build(FormWindow * window, int8_t focusIdx)
{
window->padAll(0);
auto form = new FormWindow(window, rect_t{});
form->setFlexLayout();
form->padAll(4);
window->padAll(4);
window->setFlexLayout(LV_FLEX_FLOW_COLUMN, 0);
FlexGridLayout grid(col_dsc, row_dsc, 2);
@@ -301,7 +298,7 @@ void ModelMixerScriptsPage::build(FormWindow * window, int8_t focusIdx)
int8_t scriptIdx = 0;
for (int8_t idx = 0; idx < MAX_SCRIPTS; idx++) {
auto line = form->newLine(&grid);
auto line = window->newLine(&grid);
ScriptInternalData* runtimeData = nullptr;
ScriptData* const sd = &(g_model.scriptsData[idx]);
+4 -8
View File
@@ -323,7 +323,7 @@ InputMixGroup* ModelMixesPage::getGroupByIndex(uint8_t index)
return getGroupBySrc(MIXSRC_CH1 + ch);
}
InputMixGroup* ModelMixesPage::createGroup(FormGroup* form, mixsrc_t src)
InputMixGroup* ModelMixesPage::createGroup(FormWindow* form, mixsrc_t src)
{
auto group = new InputMixGroup(form, src);
if (showMonitors) group->enableMixerMonitor(src - MIXSRC_CH1);
@@ -512,15 +512,11 @@ void ModelMixesPage::pasteMixAfter(uint8_t dst_idx)
void ModelMixesPage::build(FormWindow * window)
{
scroll_win = window->getParent();
window->setFlexLayout();
window->padRow(lv_dpx(8));
form = new FormGroup(window, rect_t{});
form->setFlexLayout();
form->padRow(lv_dpx(4));
window->setFlexLayout(LV_FLEX_FLOW_COLUMN, 3);
auto form_obj = form->getLvObj();
lv_obj_set_width(form_obj, lv_pct(100));
form = new FormWindow(window, rect_t{});
form->setFlexLayout(LV_FLEX_FLOW_COLUMN, 3);
groups.clear();
lines.clear();
+1 -1
View File
@@ -39,7 +39,7 @@ class ModelMixesPage : public ModelInputsPage
void addLineButton(uint8_t index) override;
void addLineButton(mixsrc_t src, uint8_t index) override;
InputMixGroup* createGroup(FormGroup* form, mixsrc_t src) override;
InputMixGroup* createGroup(FormWindow* form, mixsrc_t src) override;
InputMixButton* createLineButton(InputMixGroup* group,
uint8_t index) override;
+13 -17
View File
@@ -293,32 +293,28 @@ ModelOutputsPage::ModelOutputsPage() :
void ModelOutputsPage::build(FormWindow *window)
{
window->setFlexLayout();
window->padRow(lv_dpx(4));
window->setFlexLayout(LV_FLEX_FLOW_COLUMN, 3);
auto form = new FormGroup(window, rect_t{});
form->setFlexLayout(LV_FLEX_FLOW_ROW_WRAP, lv_dpx(16));
form->padRow(lv_dpx(8));
form->padBottom(lv_dpx(4));
lv_obj_set_style_flex_cross_place(window->getLvObj(), LV_FLEX_ALIGN_START, 0);
auto form_obj = form->getLvObj();
lv_obj_set_style_flex_cross_place(form_obj, LV_FLEX_ALIGN_CENTER, 0);
auto box = new FormWindow(window, rect_t{});
box->setFlexLayout(LV_FLEX_FLOW_ROW_WRAP, lv_dpx(8));
box->padRow(4);
lv_obj_set_style_flex_cross_place(box->getLvObj(), LV_FLEX_ALIGN_CENTER, 0);
new TextButton(form, rect_t{}, STR_ADD_ALL_TRIMS_TO_SUBTRIMS, [=]() {
new TextButton(box, rect_t{}, STR_ADD_ALL_TRIMS_TO_SUBTRIMS, [=]() {
moveTrimsToOffsets();
window->invalidate();
return 0;
});
auto box = new FormGroup(form, rect_t{});
box->setFlexLayout(LV_FLEX_FLOW_ROW, lv_dpx(8));
auto box2 = new FormWindow(box, rect_t{});
box2->setFlexLayout(LV_FLEX_FLOW_ROW, lv_dpx(8));
box2->setWidth(LV_SIZE_CONTENT);
lv_obj_set_style_flex_cross_place(box2->getLvObj(), LV_FLEX_ALIGN_CENTER, 0);
auto box_obj = box->getLvObj();
lv_obj_set_width(box_obj, LV_SIZE_CONTENT);
lv_obj_set_style_flex_cross_place(box_obj, LV_FLEX_ALIGN_CENTER, 0);
new StaticText(box, rect_t{}, STR_ELIMITS, 0, COLOR_THEME_PRIMARY1);
new CheckBox(box, rect_t{}, GET_SET_DEFAULT(g_model.extendedLimits));
new StaticText(box2, rect_t{}, STR_ELIMITS, 0, COLOR_THEME_PRIMARY1);
auto cb = new CheckBox(box2, rect_t{}, GET_SET_DEFAULT(g_model.extendedLimits));
for (uint8_t ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++) {
+1 -40
View File
@@ -92,12 +92,6 @@ struct ModelBitmapEdit : public FileChoice {
}
};
struct TimerBtnMatrix : public ButtonMatrix {
TimerBtnMatrix(Window* parent, const rect_t& rect);
void onPress(uint8_t btn_id) override;
bool isActive(uint8_t btn_id) override;
};
class SubScreenButton : public Button
{
std::string text;
@@ -233,7 +227,7 @@ static const lv_coord_t line_row_dsc[] = {LV_GRID_CONTENT,
void ModelSetupPage::build(FormWindow * window)
{
window->setFlexLayout();
window->setFlexLayout(LV_FLEX_FLOW_COLUMN, 0);
FlexGridLayout grid(line_col_dsc, line_row_dsc, 2);
@@ -343,36 +337,3 @@ void ModelSetupPage::build(FormWindow * window)
lv_obj_set_grid_cell(btn->getLvObj(), LV_GRID_ALIGN_STRETCH, 0, 1, LV_GRID_ALIGN_CENTER, 0, 1);
#endif
}
#define MAX_SUBSCREEN_BTNS 9
TimerBtnMatrix::TimerBtnMatrix(Window* parent, const rect_t& r) :
ButtonMatrix(parent, r)
{
initBtnMap(3, MAX_TIMERS);
setText(0, TR_TIMER "1");
setText(1, TR_TIMER "2");
setText(2, TR_TIMER "3");
update();
lv_btnmatrix_set_btn_width(lvobj, 3, 2);
lv_obj_set_width(lvobj, lv_pct(100));
lv_obj_set_height(lvobj, LV_DPI_DEF / 2);
lv_obj_set_style_bg_opa(lvobj, LV_OPA_0, 0);
lv_obj_set_style_pad_all(lvobj, lv_dpx(8), 0);
lv_obj_set_style_pad_row(lvobj, lv_dpx(8), 0);
lv_obj_set_style_pad_column(lvobj, lv_dpx(8), 0);
}
void TimerBtnMatrix::onPress(uint8_t btn_id)
{
if (btn_id >= MAX_TIMERS) return;
new TimerWindow((uint8_t)(btn_id));
}
bool TimerBtnMatrix::isActive(uint8_t btn_id)
{
return false;
}
+18 -18
View File
@@ -488,6 +488,9 @@ class SensorEditWindow : public Page {
void buildBody(FormWindow * window)
{
window->padAll(0);
lv_obj_set_scrollbar_mode(window->getLvObj(), LV_SCROLLBAR_MODE_AUTO);
// Sensor one
auto form = new FormWindow(window, rect_t{});
form->setFlexLayout();
@@ -568,25 +571,22 @@ void ModelTelemetryPage::editSensor(FormWindow * window, uint8_t index)
void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
{
window->padAll(4);
window->setFlexLayout(LV_FLEX_FLOW_COLUMN, 0);
this->window = window;
auto form = new FormWindow(window, rect_t{});
form->setFlexLayout();
form->padAll(0);
FlexGridLayout grid(col_dsc, row_dsc, 2);
FlexGridLayout grid2(col_dsc2, row_dsc, 2);
// Sensors
auto line = form->newLine(&grid2);
auto line = window->newLine(&grid2);
lv_obj_set_style_pad_row(line->getLvObj(), 0, 0);
lv_obj_set_style_pad_column(line->getLvObj(), 4, 0);
auto subttl = new Subtitle(line, rect_t{}, STR_TELEMETRY_SENSORS, 0, COLOR_THEME_PRIMARY1);
#if LCD_H > LCD_W
lv_obj_set_grid_cell(subttl->getLvObj(), LV_GRID_ALIGN_START, 0, 3, LV_GRID_ALIGN_CENTER, 0, 1);
line = form->newLine(&grid2);
line = window->newLine(&grid2);
lv_obj_set_style_pad_row(line->getLvObj(), 0, 0);
lv_obj_set_style_pad_column(line->getLvObj(), 4, 0);
grid2.nextCell();
@@ -607,7 +607,7 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
for (uint8_t idx = 0; idx < MAX_TELEMETRY_SENSORS; idx++) {
if (g_model.telemetrySensors[idx].isAvailable()) {
line = form->newLine(&grid3);
line = window->newLine(&grid3);
auto button = new SensorButton(line, rect_t{0, 0, LCD_W-12, 25}, idx);
button->setPressHandler([=]() -> uint8_t {
@@ -646,7 +646,7 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
FlexGridLayout grid4(col_dsc4, row_dsc, 4);
// Autodiscover button
line = form->newLine(&grid4);
line = window->newLine(&grid4);
auto discover = new TextButton(line, rect_t{}, (allowNewSensors) ? STR_STOP_DISCOVER_SENSORS : STR_DISCOVER_SENSORS);
discover->setPressHandler([=]() {
allowNewSensors = !allowNewSensors;
@@ -675,7 +675,7 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
if (sensorsCount > 0) {
#if TWOCOLBUTTONS
line = form->newLine(&grid4);
line = window->newLine(&grid4);
#endif
// Delete all sensors button
b = new TextButton(line, rect_t{}, STR_DELETE_ALL_SENSORS,
@@ -696,37 +696,37 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
}
// Ignore instance button
line = form->newLine(&grid);
line = window->newLine(&grid);
line->padLeft(10);
new StaticText(line, rect_t{}, STR_IGNORE_INSTANCE, 0, COLOR_THEME_PRIMARY1);
new CheckBox(line, rect_t{}, GET_SET_DEFAULT(g_model.ignoreSensorIds));
// RSSI
line = form->newLine(&grid);
line = window->newLine(&grid);
new Subtitle(line, rect_t{}, getRssiLabel(), 0, COLOR_THEME_PRIMARY1);
line = form->newLine(&grid);
line = window->newLine(&grid);
line->padLeft(10);
new StaticText(line, rect_t{}, STR_LOWALARM, 0, COLOR_THEME_PRIMARY1);
new NumberEdit(line, rect_t{}, 0, 100, GET_SET_DEFAULT(g_model.rfAlarms.warning));
line = form->newLine(&grid);
line = window->newLine(&grid);
line->padLeft(10);
new StaticText(line, rect_t{}, STR_CRITICALALARM, 0, COLOR_THEME_PRIMARY1);
new NumberEdit(line, rect_t{}, 0, 100, GET_SET_DEFAULT(g_model.rfAlarms.critical));
line = form->newLine(&grid);
line = window->newLine(&grid);
line->padLeft(10);
new StaticText(line, rect_t{}, STR_DISABLE_ALARM, 0, COLOR_THEME_PRIMARY1);
new CheckBox(line, rect_t{}, GET_SET_DEFAULT(g_model.disableTelemetryWarning));
// Vario
line = form->newLine(&grid);
line = window->newLine(&grid);
new Subtitle(line, rect_t{}, STR_VARIO, 0, COLOR_THEME_PRIMARY1);
FlexGridLayout grid5(col_dsc5, row_dsc, 4);
line = form->newLine(&grid5);
line = window->newLine(&grid5);
line->padLeft(10);
new StaticText(line, rect_t{}, STR_SOURCE, 0, COLOR_THEME_PRIMARY1);
auto choice = new SourceChoice(line, rect_t{}, MIXSRC_NONE, MIXSRC_LAST_TELEM,
@@ -741,7 +741,7 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
return qr.rem == 0 && isSensorAvailable(qr.quot + 1);
});
line = form->newLine(&grid5);
line = window->newLine(&grid5);
line->padLeft(10);
new StaticText(line, rect_t{}, STR_RANGE, 0, COLOR_THEME_PRIMARY1);
@@ -751,7 +751,7 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
auto vMax = new NumberEdit(line, rect_t{}, -17, 17, GET_SET_WITH_OFFSET(g_model.varioData.max, 10));
vMax->setAvailableHandler([](int val) { return g_model.varioData.min - 10 < val; });
line = form->newLine(&grid5);
line = window->newLine(&grid5);
line->padLeft(10);
new StaticText(line, rect_t{}, STR_CENTER, 0, COLOR_THEME_PRIMARY1);
+3
View File
@@ -737,6 +737,9 @@ ModulePage::ModulePage(uint8_t moduleIdx) : Page(ICON_MODEL_SETUP)
header.setTitle(STR_MENU_MODEL_SETUP);
header.setTitle2(title2);
body.padAll(0);
lv_obj_set_scrollbar_mode(body.getLvObj(), LV_SCROLLBAR_MODE_AUTO);
auto form = new FormGroup(&body, rect_t{});
form->setFlexLayout();
form->padAll(lv_dpx(8));
+2 -1
View File
@@ -109,7 +109,8 @@ PreflightChecks::PreflightChecks() : Page(ICON_MODEL_SETUP)
auto form = new FormWindow(&body, rect_t{});
form->setFlexLayout();
FlexGridLayout grid(line_col_dsc, line_row_dsc, 4);
form->padAll(4);
FlexGridLayout grid(line_col_dsc, line_row_dsc, 2);
// Display checklist
auto line = form->newLine(&grid);
+2 -2
View File
@@ -50,9 +50,9 @@ RadioHardwarePage::RadioHardwarePage():
void RadioHardwarePage::build(FormWindow * window)
{
window->setFlexLayout();
window->setFlexLayout(LV_FLEX_FLOW_COLUMN, 0);
FlexGridLayout grid(col_dsc, row_dsc, 2);
lv_obj_set_style_pad_all(window->getLvObj(), lv_dpx(8), 0);
// TODO: sub-title?
@@ -164,6 +164,7 @@ void RadioSdManagerPage::build(FormWindow * window)
browser = new FileBrowser(form, rect_t{}, ROOT_PATH);
grid.add(browser);
grid.nextCell();
lv_obj_set_scrollbar_mode(browser->getLvObj(), LV_SCROLLBAR_MODE_AUTO);
auto obj = browser->getLvObj();
lv_obj_set_style_grid_cell_x_align(obj, LV_GRID_ALIGN_STRETCH, 0);
+1 -1
View File
@@ -700,7 +700,7 @@ void RadioSetupPage::build(FormWindow * window)
GET_SET_DEFAULT(g_eeGeneral.rotEncMode));
#endif
// Default channel order
// RX channel order
line = window->newLine(&grid);
new StaticText(line, rect_t{}, STR_DEF_CHAN_ORD, 0,
COLOR_THEME_PRIMARY1); // RAET->AETR
+1
View File
@@ -619,6 +619,7 @@ void ThemeSetupPage::setSelected(ThemePersistance *tp)
void ThemeSetupPage::setupListbox(Window *window, rect_t r, ThemePersistance *tp)
{
listBox = new ListBox(window, r, tp->getNames());
lv_obj_set_scrollbar_mode(listBox->getLvObj(), LV_SCROLLBAR_MODE_AUTO);
listBox->setAutoEdit(true);
listBox->setSelected(currentTheme);
listBox->setActiveItem(tp->getThemeIndex());
+2 -1
View File
@@ -243,9 +243,10 @@ void RadioToolsPage::rebuild(FormWindow * window)
tools.sort(tool_compare_nocase);
window->padAll(lv_dpx(8));
window->setFlexLayout(LV_FLEX_FLOW_ROW_WRAP, lv_dpx(8));
window->padRow(lv_dpx(8));
for (const auto& tool : tools) {
new ToolButton(window, tool);
}
+8 -6
View File
@@ -216,13 +216,15 @@ ScreenSetupPage::ScreenSetupPage(ScreenMenu* menu, unsigned pageIndex,
{
}
void ScreenSetupPage::build(FormWindow * form)
void ScreenSetupPage::build(FormWindow * window)
{
window->padAll(4);
window->setFlexLayout(LV_FLEX_FLOW_COLUMN, 0);
FlexGridLayout grid(line_col_dsc, line_row_dsc);
form->setFlexLayout();
// Layout choice...
auto line = form->newLine(&grid);
auto line = window->newLine(&grid);
auto label = new StaticText(line, rect_t{}, STR_LAYOUT, 0, COLOR_THEME_PRIMARY1);
auto obj = label->getLvObj();
@@ -252,13 +254,13 @@ void ScreenSetupPage::build(FormWindow * form)
obj = layoutForm->getLvObj();
lv_obj_set_style_grid_cell_x_align(obj, LV_GRID_ALIGN_STRETCH, 0);
line = form->newLine();
line = window->newLine();
layoutOptions = new FormGroup(line, rect_t{}, FORWARD_SCROLL | FORM_FORWARD_FOCUS);
buildLayoutOptions();
// Prevent removing the last page
if (customScreens[1] != nullptr) {
line = form->newLine();
line = window->newLine();
Window* btn = new TextButton(line, rect_t{}, STR_REMOVE_SCREEN, removeScreen(menu, idx));
obj = btn->getLvObj();
lv_obj_set_style_min_width(obj, LV_DPI_DEF / 2, LV_PART_MAIN);
@@ -287,7 +289,7 @@ void ScreenSetupPage::build(FormWindow * form)
lv_obj_set_style_radius(obj, 8, LV_PART_MAIN);
lv_group_focus_obj(obj);
form->updateSize();
window->updateSize();
}
void ScreenSetupPage::clearLayoutOptions()
@@ -91,13 +91,15 @@ ScreenUserInterfacePage::ScreenUserInterfacePage(ScreenMenu* menu):
{
}
void ScreenUserInterfacePage::build(FormWindow* form)
void ScreenUserInterfacePage::build(FormWindow* window)
{
window->padAll(4);
window->setFlexLayout(LV_FLEX_FLOW_COLUMN, 0);
FlexGridLayout grid(line_col_dsc, line_row_dsc);
form->setFlexLayout();
// Top Bar
auto line = form->newLine(&grid);
auto line = window->newLine(&grid);
new StaticText(line, rect_t{}, STR_TOP_BAR, 0, COLOR_THEME_PRIMARY1);
auto menu = this->menu;
@@ -109,7 +111,7 @@ void ScreenUserInterfacePage::build(FormWindow* form)
});
// Theme choice
line = form->newLine(&grid);
line = window->newLine(&grid);
new StaticText(line, rect_t{}, STR_THEME, 0, COLOR_THEME_PRIMARY1);
auto tp = ThemePersistance::instance();
@@ -126,8 +128,8 @@ void ScreenUserInterfacePage::build(FormWindow* form)
tp->setDefaultTheme(value);
// TODO: shouldn't be necessary, would be better to send LV_EVENT_CHANGED
form->clear();
build(form);
window->clear();
build(window);
});
auto theme = tp->getCurrentTheme();
@@ -135,7 +137,7 @@ void ScreenUserInterfacePage::build(FormWindow* form)
if (theme) {
FlexGridLayout theme_grid(theme_col_dsc, theme_row_dsc);
line = form->newLine(&theme_grid);
line = window->newLine(&theme_grid);
new ThemeDetails(line, theme);
@@ -154,6 +156,6 @@ void ScreenUserInterfacePage::build(FormWindow* form)
}
}
form->updateSize();
window->updateSize();
}
+13 -11
View File
@@ -350,14 +350,19 @@ class SpecialFunctionEditPage : public Page
void buildBody(FormWindow *window)
{
window->setFlexLayout();
window->padAll(0);
lv_obj_set_scrollbar_mode(window->getLvObj(), LV_SCROLLBAR_MODE_AUTO);
auto form = new FormWindow(window, rect_t{});
form->setFlexLayout();
form->padAll(8);
FlexGridLayout grid(col_dsc, row_dsc, 2);
lv_obj_set_style_pad_all(window->getLvObj(), lv_dpx(8), 0);
CustomFunctionData *cfn = &functions[index];
// Switch
auto line = window->newLine(&grid);
auto line = form->newLine(&grid);
new StaticText(line, rect_t{}, STR_SF_SWITCH, 0, COLOR_THEME_PRIMARY1);
auto switchChoice =
new SwitchChoice(line, rect_t{}, SWSRC_FIRST, SWSRC_LAST,
@@ -381,7 +386,7 @@ class SpecialFunctionEditPage : public Page
}
// Function
line = window->newLine(&grid);
line = form->newLine(&grid);
new StaticText(line, rect_t{}, STR_FUNC, 0, COLOR_THEME_PRIMARY1);
auto functionChoice =
new Choice(line, rect_t{}, STR_VFSWFUNC,
@@ -397,7 +402,7 @@ class SpecialFunctionEditPage : public Page
return isAssignableFunctionAvailable(value, functions);
});
specialFunctionOneWindow = new FormWindow(window, rect_t{});
specialFunctionOneWindow = new FormWindow(form, rect_t{});
updateSpecialFunctionOneWindow();
}
};
@@ -779,10 +784,7 @@ void SpecialFunctionsPage::build(FormWindow *window)
#endif
window->padAll(4);
auto form = new FormWindow(window, rect_t{});
form->setFlexLayout();
form->padAll(0);
window->setFlexLayout(LV_FLEX_FLOW_COLUMN, 0);
FlexGridLayout grid(l_col_dsc, row_dsc, 2);
@@ -804,7 +806,7 @@ void SpecialFunctionsPage::build(FormWindow *window)
bool isActive = (cfn->swtch != 0);
if (isActive) {
line = form->newLine(&grid);
line = window->newLine(&grid);
button = new SpecialFunctionButton(line, rect_t{0, 0, window->width() - 12, SF_BUTTON_H}, functions, i);
@@ -893,7 +895,7 @@ void SpecialFunctionsPage::build(FormWindow *window)
if (hasEmptyFunction)
{
line = form->newLine(&grid);
line = window->newLine(&grid);
addButton = new TextButton(line, rect_t{0, 0, window->width() - 12, SF_BUTTON_H}, LV_SYMBOL_PLUS, [=]() {
plusPopup(window);
return 0;
+1
View File
@@ -149,6 +149,7 @@ TabsGroup::TabsGroup(uint8_t icon):
Layer::push(this);
lv_obj_set_style_bg_color(lvobj, makeLvColor(COLOR_THEME_SECONDARY3), 0);
lv_obj_set_scrollbar_mode(body.getLvObj(), LV_SCROLLBAR_MODE_AUTO);
activeTabsGroup = this;
}
+3
View File
@@ -60,6 +60,9 @@ TimerWindow::TimerWindow(uint8_t timer) : Page(ICON_STATS_TIMERS)
header.setTitle(STR_MENU_MODEL_SETUP);
header.setTitle2(title2);
body.padAll(0);
lv_obj_set_scrollbar_mode(body.getLvObj(), LV_SCROLLBAR_MODE_AUTO);
auto form = new FormGroup(&body, rect_t{});
form->setFlexLayout();
form->padAll(lv_dpx(8));