Skip to content

Commit 2c3beb1

Browse files
author
philmoz
committed
Fix layout consistency.
1 parent 975d31f commit 2c3beb1

File tree

6 files changed

+13
-36
lines changed

6 files changed

+13
-36
lines changed

radio/src/gui/colorlcd/libui/etx_lv_theme.cpp

+1-19
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,6 @@ const lv_style_const_prop_t pad_tiny_props[] = {
107107
};
108108
LV_STYLE_CONST_MULTI_INIT(EdgeTxStyles::pad_tiny, pad_tiny_props);
109109

110-
#if LANDSCAPE_LCD_SMALL
111-
const lv_style_const_prop_t pad_tiny_gap_props[] = {
112-
LV_STYLE_CONST_PAD_TOP(PAD_TINY_GAP), LV_STYLE_CONST_PAD_BOTTOM(PAD_TINY_GAP),
113-
LV_STYLE_CONST_PAD_LEFT(PAD_TINY_GAP), LV_STYLE_CONST_PAD_RIGHT(PAD_TINY_GAP),
114-
LV_STYLE_CONST_PAD_ROW(PAD_TINY_GAP), LV_STYLE_CONST_PAD_COLUMN(PAD_TINY_GAP),
115-
LV_STYLE_PROP_INV,
116-
};
117-
LV_STYLE_CONST_MULTI_INIT(EdgeTxStyles::pad_tiny_gap, pad_tiny_gap_props);
118-
#endif
119-
120110
const lv_style_const_prop_t pad_small_props[] = {
121111
LV_STYLE_CONST_PAD_TOP(PAD_SMALL),
122112
LV_STYLE_CONST_PAD_BOTTOM(PAD_SMALL),
@@ -195,7 +185,7 @@ const lv_style_const_prop_t border_thin_props[] = {
195185
LV_STYLE_CONST_MULTI_INIT(EdgeTxStyles::border_thin, border_thin_props);
196186

197187
static const lv_style_const_prop_t outline_props[] = {
198-
LV_STYLE_CONST_OUTLINE_WIDTH(2),
188+
LV_STYLE_CONST_OUTLINE_WIDTH(PAD_TINY),
199189
LV_STYLE_CONST_OUTLINE_OPA(LV_OPA_COVER),
200190
LV_STYLE_CONST_OUTLINE_PAD(1),
201191
LV_STYLE_PROP_INV,
@@ -557,20 +547,12 @@ void etx_padding(lv_obj_t* obj, PaddingSize padding,
557547
lv_style_selector_t selector)
558548
{
559549
lv_obj_remove_style(obj, (lv_style_t*)&styles->pad_tiny, selector);
560-
#if LANDSCAPE_LCD_SMALL
561-
lv_obj_remove_style(obj, (lv_style_t*)&styles->pad_tiny_gap, selector);
562-
#endif
563550
lv_obj_remove_style(obj, (lv_style_t*)&styles->pad_small, selector);
564551
lv_obj_remove_style(obj, (lv_style_t*)&styles->pad_medium, selector);
565552
lv_obj_remove_style(obj, (lv_style_t*)&styles->pad_large, selector);
566553
lv_obj_remove_style(obj, (lv_style_t*)&styles->pad_zero, selector);
567554
lv_obj_remove_style(obj, (lv_style_t*)&styles->pad_button, selector);
568555
switch (padding) {
569-
#if LANDSCAPE_LCD_SMALL
570-
case PAD_TINY_GAP:
571-
etx_obj_add_style(obj, styles->pad_tiny_gap, selector);
572-
break;
573-
#endif
574556
case PAD_TINY:
575557
etx_obj_add_style(obj, styles->pad_tiny, selector);
576558
break;

radio/src/gui/colorlcd/libui/etx_lv_theme.h

-5
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
enum PaddingSize {
3838
PAD_ZERO = 0,
3939
PAD_TINY = 1,
40-
PAD_TINY_GAP = 2,
4140
PAD_SMALL = 3,
4241
PAD_MEDIUM = 4,
4342
PAD_LARGE = 6
@@ -46,7 +45,6 @@ enum PaddingSize {
4645
enum PaddingSize {
4746
PAD_ZERO = 0,
4847
PAD_TINY = 2,
49-
PAD_TINY_GAP = 2,
5048
PAD_SMALL = 4,
5149
PAD_MEDIUM = 6,
5250
PAD_LARGE = 8
@@ -187,9 +185,6 @@ class EdgeTxStyles
187185
// Static styles
188186
static const lv_style_t pad_zero;
189187
static const lv_style_t pad_tiny;
190-
#if LANDSCAPE_LCD_SMALL
191-
static const lv_style_t pad_tiny_gap;
192-
#endif
193188
static const lv_style_t pad_small;
194189
static const lv_style_t pad_medium;
195190
static const lv_style_t pad_large;

radio/src/gui/colorlcd/libui/window.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -511,9 +511,9 @@ SetupLine::SetupLine(Window* parent, coord_t y, coord_t col2, PaddingSize paddin
511511
padAll(PAD_ZERO);
512512
coord_t titleY = PAD_LARGE + lblYOffset;
513513
coord_t titleH = EdgeTxStyles::PAGE_LINE_HEIGHT;
514-
coord_t h = EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_TINY_GAP * 2 + lblYOffset * 2;
514+
coord_t h = EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_TINY * 2 + lblYOffset * 2;
515515
if (createEdit) {
516-
coord_t editY = PAD_TINY_GAP;
516+
coord_t editY = PAD_TINY;
517517
coord_t lblWidth = col2 - PAD_SMALL - PAD_TINY;
518518
if (title) {
519519
if (getTextWidth(title) >= lblWidth) {

radio/src/gui/colorlcd/model/function_switches.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ class FunctionSwitch : public Window
5656
{
5757
public:
5858
FunctionSwitch(Window* parent, uint8_t sw) :
59-
Window(parent, {0, 0, LCD_W - PAD_SMALL * 2, EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_TINY_GAP * 2}), switchIndex(sw)
59+
Window(parent, {0, 0, LCD_W - PAD_SMALL * 2, EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_TINY * 2}), switchIndex(sw)
6060
{
61-
padAll(PAD_TINY_GAP);
61+
padAll(PAD_TINY);
6262

6363
std::string s(STR_CHAR_SWITCH);
6464
s += switchGetName(switchIndex + switchGetMaxSwitches());
@@ -195,9 +195,9 @@ class SwitchGroup : public Window
195195
{
196196
public:
197197
SwitchGroup(Window* parent, uint8_t group) :
198-
Window(parent, {0, 0, LCD_W - PAD_SMALL * 2, EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_TINY_GAP * 2}), groupIndex(group)
198+
Window(parent, {0, 0, LCD_W - PAD_SMALL * 2, EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_TINY * 2}), groupIndex(group)
199199
{
200-
padAll(PAD_TINY_GAP);
200+
padAll(PAD_TINY);
201201

202202
new StaticText(this, {0, PAD_MEDIUM, NM_W, EdgeTxStyles::PAGE_LINE_HEIGHT},
203203
STR_FUNCTION_SWITCH_GROUPS[groupIndex]);

radio/src/gui/colorlcd/model/special_functions.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class FunctionLineButton : public ListLineButton
6767
static constexpr coord_t RP_Y = NM_Y;
6868
static constexpr coord_t RP_H = NM_H;
6969
static constexpr coord_t EN_X = RP_X + RP_W + PAD_TINY;
70-
static constexpr coord_t EN_Y = NM_Y + PAD_TINY_GAP;
70+
static constexpr coord_t EN_Y = NM_Y + PAD_TINY;
7171
static LAYOUT_VAL(EN_SZ, 16, 16, LS(16))
7272

7373
protected:

radio/src/gui/colorlcd/radio/radio_setup.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class DateTimeWindow : public Window
7575
// Absolute layout for date/time setion due to slow performance
7676
// of lv_textarea in a flex layout.
7777
static LAYOUT_VAL(DT_EDT_W, 80, 52, LS(80))
78-
static LAYOUT_VAL(DT_Y1, PAD_TINY_GAP, PAD_TINY_GAP, PAD_TINY_GAP)
78+
static LAYOUT_VAL(DT_Y1, PAD_TINY, PAD_TINY, PAD_TINY)
7979
static LAYOUT_VAL(DT_Y2, DT_Y1 + EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_MEDIUM, DT_Y1 + EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_MEDIUM, DT_Y1 + EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_MEDIUM)
8080

8181
protected:
@@ -121,7 +121,7 @@ class DateTimeWindow : public Window
121121
m_last_tm = m_tm;
122122

123123
// Date
124-
new StaticText(this, rect_t{PAD_TINY_GAP, DT_Y1 + PAD_MEDIUM, SubPage::EDT_X - PAD_TINY_GAP - PAD_SMALL, EdgeTxStyles::PAGE_LINE_HEIGHT}, STR_DATE);
124+
new StaticText(this, rect_t{PAD_TINY, DT_Y1 + PAD_MEDIUM, SubPage::EDT_X - PAD_TINY - PAD_SMALL, EdgeTxStyles::PAGE_LINE_HEIGHT}, STR_DATE);
125125
year = new NumberEdit(
126126
this, rect_t{SubPage::EDT_X, DT_Y1, DT_EDT_W, 0}, 2023, 2037,
127127
[=]() -> int32_t { return TM_YEAR_BASE + m_tm.tm_year; },
@@ -132,7 +132,7 @@ class DateTimeWindow : public Window
132132
});
133133

134134
month = new NumberEdit(
135-
this, rect_t{SubPage::EDT_X + DT_EDT_W + PAD_TINY_GAP, DT_Y1, DT_EDT_W, 0}, 1, 12,
135+
this, rect_t{SubPage::EDT_X + DT_EDT_W + PAD_TINY, DT_Y1, DT_EDT_W, 0}, 1, 12,
136136
[=]() -> int32_t { return 1 + m_tm.tm_mon; },
137137
[=](int32_t newValue) {
138138
m_last_tm.tm_mon = m_tm.tm_mon = newValue - 1;
@@ -153,7 +153,7 @@ class DateTimeWindow : public Window
153153
[](int32_t value) { return formatNumberAsString(value, LEADING0, 2); });
154154

155155
// Time
156-
new StaticText(this, rect_t{PAD_TINY_GAP, DT_Y2 + PAD_MEDIUM, SubPage::EDT_X - PAD_TINY_GAP - PAD_SMALL, EdgeTxStyles::PAGE_LINE_HEIGHT}, STR_TIME);
156+
new StaticText(this, rect_t{PAD_TINY, DT_Y2 + PAD_MEDIUM, SubPage::EDT_X - PAD_TINY - PAD_SMALL, EdgeTxStyles::PAGE_LINE_HEIGHT}, STR_TIME);
157157
hour = new NumberEdit(
158158
this, rect_t{SubPage::EDT_X, DT_Y2, DT_EDT_W, 0}, 0, 23,
159159
[=]() -> int32_t { return m_tm.tm_hour; },
@@ -165,7 +165,7 @@ class DateTimeWindow : public Window
165165
[](int32_t value) { return formatNumberAsString(value, LEADING0, 2); });
166166

167167
minutes = new NumberEdit(
168-
this, rect_t{SubPage::EDT_X + DT_EDT_W + PAD_TINY_GAP, DT_Y2, DT_EDT_W, 0}, 0, 59,
168+
this, rect_t{SubPage::EDT_X + DT_EDT_W + PAD_TINY, DT_Y2, DT_EDT_W, 0}, 0, 59,
169169
[=]() -> int32_t { return m_tm.tm_min; },
170170
[=](int32_t newValue) {
171171
m_last_tm.tm_min = m_tm.tm_min = newValue;

0 commit comments

Comments
 (0)