chore(color): remove redundant layout, correct layout formatting, add comments for layout construction (#6968)
This commit is contained in:
@@ -21,12 +21,16 @@
|
||||
|
||||
#include "layout.h"
|
||||
|
||||
// Zone map: 1+2 (1 large zone + 2 small zones)
|
||||
// Top: 1 zone (full width, 1/2 height), Bottom: 2 zones (full width, 1/4 height
|
||||
// each)
|
||||
// clang-format off
|
||||
static const uint8_t zmap[] = {
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_FULL, LAYOUT_MAP_HALF,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_FULL, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_3QTR, LAYOUT_MAP_FULL, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_FULL, LAYOUT_MAP_HALF, // Top zone (1/2 height)
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_FULL, LAYOUT_MAP_1QTR, // Bottom upper (1/4 height)
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_3QTR, LAYOUT_MAP_FULL, LAYOUT_MAP_1QTR, // Bottom lower (1/4 height)
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
BaseLayoutFactory<Layout> Layout1P2("Layout1P2", "1 + 2",
|
||||
defaultLayoutOptions,
|
||||
BaseLayoutFactory<Layout> Layout1P2("Layout1P2", "1 + 2", defaultLayoutOptions,
|
||||
3, (uint8_t*)zmap);
|
||||
|
||||
@@ -21,13 +21,17 @@
|
||||
|
||||
#include "layout.h"
|
||||
|
||||
// Zone map: 1+3 (1 large zone + 3 small zones)
|
||||
// Left: 1 full-height zone (1/2 width), Right: 3 zones stacked (1/2 width, 1/3
|
||||
// height each)
|
||||
// clang-format off
|
||||
static const uint8_t zmap[] = {
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_FULL,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD, LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_2THIRD, LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_FULL, // Left zone (full height)
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD, // Right top
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD, LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD, // Right middle
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_2THIRD, LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD, // Right bottom
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
BaseLayoutFactory<Layout> Layout1P3("Layout1P3", "1 + 3",
|
||||
defaultLayoutOptions,
|
||||
BaseLayoutFactory<Layout> Layout1P3("Layout1P3", "1 + 3", defaultLayoutOptions,
|
||||
4, (uint8_t*)zmap);
|
||||
|
||||
@@ -21,13 +21,18 @@
|
||||
|
||||
#include "layout.h"
|
||||
|
||||
// Zone map: 1+4 (1 large zone + 4 small zones)
|
||||
// Left: 1 full-height zone (1/2 width), Right: 4 zones stacked (1/2 width, 1/4
|
||||
// height each)
|
||||
// clang-format off
|
||||
static const uint8_t zmap[] = {
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_FULL,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_3QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_FULL, // Left zone (full height)
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Right top
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Right 2nd
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Right 3rd
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_3QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Right bottom
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
BaseLayoutFactory<Layout> Layout1P4("Layout1P4", "1 + 4", defaultLayoutOptions, 5,
|
||||
(uint8_t*)zmap);
|
||||
BaseLayoutFactory<Layout> Layout1P4("Layout1P4", "1 + 4", defaultLayoutOptions,
|
||||
5, (uint8_t*)zmap);
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
#include "layout.h"
|
||||
#include "translations/translations.h"
|
||||
|
||||
// Zone map: 1x1 (single full-screen zone)
|
||||
// clang-format off
|
||||
static const uint8_t zmap[] = {
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_FULL, LAYOUT_MAP_FULL,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_FULL, LAYOUT_MAP_FULL, // Full screen
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
BaseLayoutFactory<Layout> layout1x1("Layout1x1", STR_WIDGET_FULLSCREEN,
|
||||
defaultLayoutOptions,
|
||||
1, (uint8_t*)zmap);
|
||||
defaultLayoutOptions, 1, (uint8_t*)zmap);
|
||||
|
||||
@@ -26,9 +26,8 @@ const LayoutOption OPTIONS_LAYOUT_APPMODE[] = {LAYOUT_OPTIONS_END};
|
||||
class LayoutAppMode : public Layout
|
||||
{
|
||||
public:
|
||||
LayoutAppMode(Window* parent, const LayoutFactory* factory,
|
||||
int screenNum, uint8_t zoneCount,
|
||||
uint8_t* zoneMap) :
|
||||
LayoutAppMode(Window* parent, const LayoutFactory* factory, int screenNum,
|
||||
uint8_t zoneCount, uint8_t* zoneMap) :
|
||||
Layout(parent, factory, screenNum, zoneCount, zoneMap)
|
||||
{
|
||||
}
|
||||
@@ -43,9 +42,14 @@ class LayoutAppMode : public Layout
|
||||
protected:
|
||||
};
|
||||
|
||||
// Zone map: 1x1 App Mode (single full-screen zone for app mode - disables all
|
||||
// other UI elements)
|
||||
// clang-format off
|
||||
static const uint8_t zmap[] = {
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_FULL, LAYOUT_MAP_FULL,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_FULL, LAYOUT_MAP_FULL, // Full screen
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
BaseLayoutFactory<LayoutAppMode> layoutAppMode("Layout1x1AM", "App mode", OPTIONS_LAYOUT_APPMODE,
|
||||
1, (uint8_t*)zmap);
|
||||
BaseLayoutFactory<LayoutAppMode> layoutAppMode("Layout1x1AM", "App mode",
|
||||
OPTIONS_LAYOUT_APPMODE, 1,
|
||||
(uint8_t*)zmap);
|
||||
|
||||
@@ -21,11 +21,14 @@
|
||||
|
||||
#include "layout.h"
|
||||
|
||||
// Zone map: 1x2 (1 column, 2 rows)
|
||||
// Each zone is full width, 1/2 height
|
||||
// clang-format off
|
||||
static const uint8_t zmap[] = {
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_FULL, LAYOUT_MAP_HALF,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_FULL, LAYOUT_MAP_HALF,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_FULL, LAYOUT_MAP_HALF, // Top
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_FULL, LAYOUT_MAP_HALF, // Bottom
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
BaseLayoutFactory<Layout> Layout1x2("Layout1x2", "1 x 2",
|
||||
defaultLayoutOptions,
|
||||
BaseLayoutFactory<Layout> Layout1x2("Layout1x2", "1 x 2", defaultLayoutOptions,
|
||||
2, (uint8_t*)zmap);
|
||||
|
||||
@@ -21,12 +21,15 @@
|
||||
|
||||
#include "layout.h"
|
||||
|
||||
// Zone map: 1x3 (1 column, 3 rows)
|
||||
// Each zone is full width, 1/3 height
|
||||
// clang-format off
|
||||
static const uint8_t zmap[] = {
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_FULL, LAYOUT_MAP_1THIRD,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_1THIRD, LAYOUT_MAP_FULL, LAYOUT_MAP_1THIRD,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_2THIRD, LAYOUT_MAP_FULL, LAYOUT_MAP_1THIRD,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_FULL, LAYOUT_MAP_1THIRD, // Top
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_1THIRD, LAYOUT_MAP_FULL, LAYOUT_MAP_1THIRD, // Middle
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_2THIRD, LAYOUT_MAP_FULL, LAYOUT_MAP_1THIRD, // Bottom
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
BaseLayoutFactory<Layout> Layout1x3("Layout1x3", "1 x 3",
|
||||
defaultLayoutOptions,
|
||||
BaseLayoutFactory<Layout> Layout1x3("Layout1x3", "1 x 3", defaultLayoutOptions,
|
||||
3, (uint8_t*)zmap);
|
||||
|
||||
@@ -21,13 +21,16 @@
|
||||
|
||||
#include "layout.h"
|
||||
|
||||
// Zone map: 1x4 (1 column, 4 rows)
|
||||
// Each zone is full width, 1/4 height
|
||||
// clang-format off
|
||||
static const uint8_t zmap[] = {
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_FULL, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_1QTR, LAYOUT_MAP_FULL, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_FULL, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_3QTR, LAYOUT_MAP_FULL, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_FULL, LAYOUT_MAP_1QTR, // Top
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_1QTR, LAYOUT_MAP_FULL, LAYOUT_MAP_1QTR, // 2nd
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_FULL, LAYOUT_MAP_1QTR, // 3rd
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_3QTR, LAYOUT_MAP_FULL, LAYOUT_MAP_1QTR, // Bottom
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
BaseLayoutFactory<Layout> Layout1x4("Layout1x4", "1 x 4",
|
||||
defaultLayoutOptions,
|
||||
BaseLayoutFactory<Layout> Layout1x4("Layout1x4", "1 x 4", defaultLayoutOptions,
|
||||
4, (uint8_t*)zmap);
|
||||
|
||||
@@ -21,14 +21,18 @@
|
||||
|
||||
#include "layout.h"
|
||||
|
||||
// Zone map: 2+1 (2 small zones + 1 large zone)
|
||||
// Left: 2 zones stacked (1/2 width, 1/2 height each), Right: 1 full-height zone
|
||||
// (1/2 width)
|
||||
// clang-format off
|
||||
static const uint8_t zmap[] = {
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_FULL, // ordered to match previous implementation
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_FULL, // Right zone (full height) - ordered to match previous implementation
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, // Left top
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, // Left bottom
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
BaseLayoutFactory<Layout> layout2P1("Layout2P1", "2 + 1",
|
||||
defaultLayoutOptions,
|
||||
BaseLayoutFactory<Layout> layout2P1("Layout2P1", "2 + 1", defaultLayoutOptions,
|
||||
3, (uint8_t*)zmap);
|
||||
|
||||
const LayoutFactory* defaultLayout = &layout2P1;
|
||||
|
||||
@@ -21,14 +21,18 @@
|
||||
|
||||
#include "layout.h"
|
||||
|
||||
// Zone map: 2+3 (2 large zones + 3 small zones)
|
||||
// Left: 2 zones stacked (1/2 width, 1/2 height each), Right: 3 zones stacked
|
||||
// (1/2 width, 1/3 height each)
|
||||
// clang-format off
|
||||
static const uint8_t zmap[] = {
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD, LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_2THIRD, LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, // Left top
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, // Left bottom
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD, // Right top
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD, LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD, // Right middle
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_2THIRD, LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD, // Right bottom
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
BaseLayoutFactory<Layout> Layout2P3("Layout2P3", "2 + 3",
|
||||
defaultLayoutOptions,
|
||||
BaseLayoutFactory<Layout> Layout2P3("Layout2P3", "2 + 3", defaultLayoutOptions,
|
||||
5, (uint8_t*)zmap);
|
||||
|
||||
@@ -21,11 +21,14 @@
|
||||
|
||||
#include "layout.h"
|
||||
|
||||
// Zone map: 2x1 (2 columns, 1 row)
|
||||
// Each zone is 1/2 width, full height
|
||||
// clang-format off
|
||||
static const uint8_t zmap[] = {
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_FULL,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_FULL,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_FULL, // Left
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_FULL, // Right
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
BaseLayoutFactory<Layout> Layout2x1("Layout2x1", "2 x 1",
|
||||
defaultLayoutOptions,
|
||||
BaseLayoutFactory<Layout> Layout2x1("Layout2x1", "2 x 1", defaultLayoutOptions,
|
||||
2, (uint8_t*)zmap);
|
||||
|
||||
@@ -21,13 +21,16 @@
|
||||
|
||||
#include "layout.h"
|
||||
|
||||
// Zone map: 2x2 (2 columns, 2 rows)
|
||||
// Each zone is 1/2 width, 1/2 height
|
||||
// clang-format off
|
||||
static const uint8_t zmap[] = {
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, // Top-left
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, // Bottom-left
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, // Top-right
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, // Bottom-right
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
BaseLayoutFactory<Layout> layout2x2("Layout2x2", "2 x 2",
|
||||
defaultLayoutOptions,
|
||||
BaseLayoutFactory<Layout> layout2x2("Layout2x2", "2 x 2", defaultLayoutOptions,
|
||||
4, (uint8_t*)zmap);
|
||||
|
||||
@@ -21,15 +21,19 @@
|
||||
|
||||
#include "layout.h"
|
||||
|
||||
// Zone map: 2x3 (2 columns, 3 rows)
|
||||
// Each zone is 1/2 width, 1/3 height
|
||||
// Zones ordered to match previous implementation
|
||||
// clang-format off
|
||||
static const uint8_t zmap[] = {
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_1THIRD, LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_2THIRD, LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD, LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_2THIRD, LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD, // ordered to match previous implementation
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD, // Left top
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_1THIRD, LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD, // Left middle
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_2THIRD, LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD, // Left bottom
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD, LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD, // Right middle - ordered to match previous implementation
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_2THIRD, LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD, // Right bottom
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_1THIRD, // Right top
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
BaseLayoutFactory<Layout> layout2x3("Layout2x3", "2 x 3",
|
||||
defaultLayoutOptions,
|
||||
BaseLayoutFactory<Layout> layout2x3("Layout2x3", "2 x 3", defaultLayoutOptions,
|
||||
6, (uint8_t*)zmap);
|
||||
|
||||
@@ -40,9 +40,8 @@ class Layout2x4 : public Layout
|
||||
OPTION_PANEL2_COLOR
|
||||
};
|
||||
|
||||
Layout2x4(Window* parent, const LayoutFactory* factory,
|
||||
int screenNum, uint8_t zoneCount,
|
||||
uint8_t* zoneMap) :
|
||||
Layout2x4(Window* parent, const LayoutFactory* factory, int screenNum,
|
||||
uint8_t zoneCount, uint8_t* zoneMap) :
|
||||
Layout(parent, factory, screenNum, zoneCount, zoneMap)
|
||||
{
|
||||
panel1 = lv_obj_create(lvobj);
|
||||
@@ -56,8 +55,6 @@ class Layout2x4 : public Layout
|
||||
rect_t mainZone = {0, 0, 0, 0};
|
||||
lv_obj_t* panel1 = nullptr;
|
||||
lv_obj_t* panel2 = nullptr;
|
||||
LcdFlags panel1Color = -1;
|
||||
LcdFlags panel2Color = -1;
|
||||
|
||||
void checkEvents() override
|
||||
{
|
||||
@@ -92,21 +89,28 @@ class Layout2x4 : public Layout
|
||||
lv_obj_add_flag(panel2, LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
|
||||
etx_bg_color_from_flags(panel1, getOptionValue(OPTION_PANEL1_COLOR)->unsignedValue);
|
||||
etx_bg_color_from_flags(panel2, getOptionValue(OPTION_PANEL2_COLOR)->unsignedValue);
|
||||
etx_bg_color_from_flags(panel1,
|
||||
getOptionValue(OPTION_PANEL1_COLOR)->unsignedValue);
|
||||
etx_bg_color_from_flags(panel2,
|
||||
getOptionValue(OPTION_PANEL2_COLOR)->unsignedValue);
|
||||
}
|
||||
};
|
||||
|
||||
// Zone map: 2x4 (2 columns, 4 rows)
|
||||
// Each zone is 1/2 width, 1/4 height
|
||||
// Zones ordered column-by-column (left column first, then right column)
|
||||
// clang-format off
|
||||
static const uint8_t zmap[] = {
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_1QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_3QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_3QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
|
||||
// Zone positions: x, y, w, h (using LAYOUT_MAP constants)
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Left column, top
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_1QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Left column, 2nd row
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Left column, 3rd row
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_3QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Left column, bottom
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Right column, top
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Right column, 2nd row
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Right column, 3rd row
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_3QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Right column, bottom
|
||||
};
|
||||
|
||||
// clang-format on
|
||||
BaseLayoutFactory<Layout2x4> layout2x4("Layout2x4", "2 x 4", OPTIONS_LAYOUT_2x4,
|
||||
8, (uint8_t*)zmap);
|
||||
|
||||
@@ -21,15 +21,19 @@
|
||||
|
||||
#include "layout.h"
|
||||
|
||||
// Zone map: 4+2 (4 small zones + 2 large zones)
|
||||
// Left: 4 zones stacked (1/2 width, 1/4 height each), Right: 2 zones stacked
|
||||
// (1/2 width, 1/2 height each)
|
||||
// clang-format off
|
||||
static const uint8_t zmap[] = {
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_1QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_3QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Left top
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_1QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Left 2nd
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Left 3rd
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_3QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Left bottom
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, // Right top
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, // Right bottom
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
BaseLayoutFactory<Layout> layout4P2("Layout4P2", "4 + 2",
|
||||
defaultLayoutOptions,
|
||||
BaseLayoutFactory<Layout> layout4P2("Layout4P2", "4 + 2", defaultLayoutOptions,
|
||||
6, (uint8_t*)zmap);
|
||||
|
||||
@@ -21,15 +21,19 @@
|
||||
|
||||
#include "layout.h"
|
||||
|
||||
// Zone map: 4+2B (4 small zones + 2 zones, bottom-biased)
|
||||
// Left: 4 zones stacked (1/2 width, 1/4 height each), Right: 1 large zone (3/4
|
||||
// height) + 1 small zone (1/4 height)
|
||||
// clang-format off
|
||||
static const uint8_t zmap[] = {
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_1QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_3QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_3QTR,
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_3QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Left top
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_1QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Left 2nd
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Left 3rd
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_3QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Left bottom
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_3QTR, // Right large (3/4 height)
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_3QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Right small (1/4 height)
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
BaseLayoutFactory<Layout> layout4P2B("Layout4P2B", "4 + 2B",
|
||||
defaultLayoutOptions,
|
||||
6, (uint8_t*)zmap);
|
||||
defaultLayoutOptions, 6, (uint8_t*)zmap);
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "layout.h"
|
||||
#include "translations/translations.h"
|
||||
|
||||
// 4x2 layout: 4 rows, 2 columns
|
||||
// Suitable for portrait screens and vertical screen usage
|
||||
|
||||
const LayoutOption OPTIONS_LAYOUT_4x2[] = {
|
||||
LAYOUT_COMMON_OPTIONS,
|
||||
{STR_DEF(STR_PANEL1_BACKGROUND), LayoutOption::Bool, true},
|
||||
{STR_DEF(STR_PANEL_COLOR), LayoutOption::Color, RGB2FLAGS(77, 112, 203)},
|
||||
{STR_DEF(STR_PANEL2_BACKGROUND), LayoutOption::Bool, true},
|
||||
{STR_DEF(STR_PANEL_COLOR), LayoutOption::Color, RGB2FLAGS(77, 112, 203)},
|
||||
LAYOUT_OPTIONS_END};
|
||||
|
||||
class Layout4x2 : public Layout
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
OPTION_PANEL1_BACKGROUND = LAYOUT_OPTION_LAST_DEFAULT + 1,
|
||||
OPTION_PANEL1_COLOR,
|
||||
OPTION_PANEL2_BACKGROUND,
|
||||
OPTION_PANEL2_COLOR
|
||||
};
|
||||
|
||||
Layout4x2(Window* parent, const LayoutFactory* factory,
|
||||
int screenNum, uint8_t zoneCount,
|
||||
uint8_t* zoneMap) :
|
||||
Layout(parent, factory, screenNum, zoneCount, zoneMap)
|
||||
{
|
||||
panel1 = lv_obj_create(lvobj);
|
||||
lv_obj_set_style_bg_opa(panel1, LV_OPA_COVER, LV_PART_MAIN);
|
||||
panel2 = lv_obj_create(lvobj);
|
||||
lv_obj_set_style_bg_opa(panel2, LV_OPA_COVER, LV_PART_MAIN);
|
||||
setPanels();
|
||||
}
|
||||
|
||||
protected:
|
||||
rect_t mainZone = {0, 0, 0, 0};
|
||||
lv_obj_t* panel1 = nullptr;
|
||||
lv_obj_t* panel2 = nullptr;
|
||||
|
||||
void checkEvents() override
|
||||
{
|
||||
setPanels();
|
||||
Layout::checkEvents();
|
||||
}
|
||||
|
||||
void setPanels()
|
||||
{
|
||||
rect_t zone = Layout::getMainZone();
|
||||
if (mainZone.x != zone.x || mainZone.y != zone.y || mainZone.w != zone.w ||
|
||||
mainZone.h != zone.h) {
|
||||
mainZone = zone;
|
||||
// Left column panel
|
||||
lv_obj_set_pos(panel1, mainZone.x, mainZone.y);
|
||||
lv_obj_set_size(panel1, mainZone.w / 2, mainZone.h);
|
||||
// Right column panel
|
||||
lv_obj_set_pos(panel2, mainZone.x + mainZone.w / 2, mainZone.y);
|
||||
lv_obj_set_size(panel2, mainZone.w / 2, mainZone.h);
|
||||
}
|
||||
|
||||
bool vis = getOptionValue(OPTION_PANEL1_BACKGROUND)->boolValue;
|
||||
if (vis == lv_obj_has_flag(panel1, LV_OBJ_FLAG_HIDDEN)) {
|
||||
if (vis)
|
||||
lv_obj_clear_flag(panel1, LV_OBJ_FLAG_HIDDEN);
|
||||
else
|
||||
lv_obj_add_flag(panel1, LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
vis = getOptionValue(OPTION_PANEL2_BACKGROUND)->boolValue;
|
||||
if (vis == lv_obj_has_flag(panel2, LV_OBJ_FLAG_HIDDEN)) {
|
||||
if (vis)
|
||||
lv_obj_clear_flag(panel2, LV_OBJ_FLAG_HIDDEN);
|
||||
else
|
||||
lv_obj_add_flag(panel2, LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
|
||||
etx_bg_color_from_flags(panel1, getOptionValue(OPTION_PANEL1_COLOR)->unsignedValue);
|
||||
etx_bg_color_from_flags(panel2, getOptionValue(OPTION_PANEL2_COLOR)->unsignedValue);
|
||||
}
|
||||
};
|
||||
|
||||
// Zone map: 4x2 (4 rows, 2 columns)
|
||||
// Each zone is 1/4 height, 1/2 width
|
||||
static const uint8_t zmap[] = {
|
||||
// Zone positions: x, y, w, h (using LAYOUT_MAP constants)
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Top-left
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Top-right
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_1QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // 2nd row left
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // 2nd row right
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // 3rd row left
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // 3rd row right
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_3QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Bottom-left
|
||||
LAYOUT_MAP_HALF, LAYOUT_MAP_3QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR, // Bottom-right
|
||||
};
|
||||
|
||||
BaseLayoutFactory<Layout4x2> layout4x2("Layout4x2", "4 x 2",
|
||||
OPTIONS_LAYOUT_4x2,
|
||||
8, (uint8_t*)zmap);
|
||||
@@ -34,14 +34,10 @@ const LayoutOption OPTIONS_LAYOUT_6x1[] = {
|
||||
class Layout6x1 : public Layout
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
OPTION_BACKGROUND = LAYOUT_OPTION_LAST_DEFAULT + 1,
|
||||
OPTION_COLOR
|
||||
};
|
||||
enum { OPTION_BACKGROUND = LAYOUT_OPTION_LAST_DEFAULT + 1, OPTION_COLOR };
|
||||
|
||||
Layout6x1(Window* parent, const LayoutFactory* factory,
|
||||
int screenNum, uint8_t zoneCount,
|
||||
uint8_t* zoneMap) :
|
||||
Layout6x1(Window* parent, const LayoutFactory* factory, int screenNum,
|
||||
uint8_t zoneCount, uint8_t* zoneMap) :
|
||||
Layout(parent, factory, screenNum, zoneCount, zoneMap)
|
||||
{
|
||||
panel = lv_obj_create(lvobj);
|
||||
@@ -83,8 +79,9 @@ class Layout6x1 : public Layout
|
||||
|
||||
// Zone map: 6x1 (6 rows, 1 column)
|
||||
// Each zone is 1/6 height, full width
|
||||
#define LAYOUT_MAP_1_6TH 10 // 1/6 of full dimension (60/6 = 10)
|
||||
#define LAYOUT_MAP_1_6TH 10 // 1/6 of full dimension (60/6 = 10)
|
||||
|
||||
// clang-format off
|
||||
static const uint8_t zmap[] = {
|
||||
// Zone positions: x, y, w, h
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_FULL, LAYOUT_MAP_1_6TH, // Zone 1
|
||||
@@ -94,7 +91,7 @@ static const uint8_t zmap[] = {
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_1_6TH*4,LAYOUT_MAP_FULL, LAYOUT_MAP_1_6TH, // Zone 5
|
||||
LAYOUT_MAP_0, LAYOUT_MAP_1_6TH*5,LAYOUT_MAP_FULL, LAYOUT_MAP_1_6TH, // Zone 6
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
BaseLayoutFactory<Layout6x1> layout6x1("Layout6x1", "6 x 1",
|
||||
OPTIONS_LAYOUT_6x1,
|
||||
6, (uint8_t*)zmap);
|
||||
BaseLayoutFactory<Layout6x1> layout6x1("Layout6x1", "6 x 1", OPTIONS_LAYOUT_6x1,
|
||||
6, (uint8_t*)zmap);
|
||||
|
||||
Reference in New Issue
Block a user