chore(color): minor fixes and cleanup of UI files (#6712)

This commit is contained in:
philmoz
2025-10-25 09:17:11 +10:00
committed by GitHub
parent aa646a1eae
commit 44f6d46fbb
373 changed files with 232631 additions and 302340 deletions
+1 -1
View File
@@ -51,7 +51,7 @@
#if LCD_W == 320
#define LAYOUT_SCALE(x) (((x) * 8 + 5) / 10)
#elif LCD_W == 800
#define LAYOUT_SCALE(x) (((x) * 3 + 1) / 2)
#define LAYOUT_SCALE(x) (((x) * 11 + 4) / 8)
#endif
#endif
@@ -28,7 +28,11 @@
#define MAX_WIDGET_OPTIONS 10
static LAYOUT_VAL_SCALED(MENU_HEADER_BUTTONS_LEFT, 47)
static LAYOUT_VAL_SCALED(TOPBAR_ZONE_WIDTH, 70);
#if LCD_W == 800 // TODO: handle this better
static constexpr int TOPBAR_ZONE_WIDTH = 102;
#else
static LAYOUT_VAL_SCALED(TOPBAR_ZONE_WIDTH, 70)
#endif
static constexpr int MAX_TOPBAR_ZONES = (LCD_W - MENU_HEADER_BUTTONS_LEFT - 1 + TOPBAR_ZONE_WIDTH / 2) / TOPBAR_ZONE_WIDTH;
#define MAX_TOPBAR_OPTIONS 1 // just because of VC++ which doesn't like 0-size arrays :(
+5 -3
View File
@@ -264,9 +264,11 @@ HWSwitches::HWSwitches(Window* parent) :
padAll(PAD_TINY);
auto max_switches = switchGetMaxAllSwitches();
for (int i = 0; i < max_switches; i++) {
if (!switchIsCustomSwitch(i))
new HWSwitch(this, i, i * HWSwitch::SW_CTRL_H + PAD_OUTLINE);
for (int i = 0, j = 0; i < max_switches; i++) {
if (!switchIsCustomSwitch(i)) {
new HWSwitch(this, i, j * HWSwitch::SW_CTRL_H + PAD_OUTLINE);
j++;
}
}
}
@@ -245,7 +245,8 @@ class DateTimeWidget : public TopBarWidget
const rect_t& rect, Widget::PersistentData* persistentData) :
TopBarWidget(factory, parent, rect, persistentData)
{
dateTime = new HeaderDateTime(this, DT_X, PAD_THREE);
coord_t x = rect.w - HeaderDateTime::HDR_DATE_WIDTH - DT_XO;
dateTime = new HeaderDateTime(this, x, PAD_THREE);
update();
}
@@ -255,6 +256,8 @@ class DateTimeWidget : public TopBarWidget
uint32_t color;
memcpy(&color, &persistentData->options[0].value.unsignedValue, sizeof(color));
dateTime->setColor(color);
coord_t x = width() - HeaderDateTime::HDR_DATE_WIDTH - DT_XO;
dateTime->setPos(x, PAD_THREE);
}
HeaderDateTime* dateTime = nullptr;
@@ -263,7 +266,7 @@ class DateTimeWidget : public TopBarWidget
static const ZoneOption options[];
// Adjustment to make main view date/time align with model/radio settings views
static LAYOUT_SIZE_SCALED(DT_X, 24, 8)
static LAYOUT_VAL_SCALED(DT_XO, 1)
};
const ZoneOption DateTimeWidget::options[] = {