diff --git a/radio/src/gui/colorlcd/layouts/layout1+2.cpp b/radio/src/gui/colorlcd/layouts/layout1+2.cpp index 6691f701b..fa27fa660 100644 --- a/radio/src/gui/colorlcd/layouts/layout1+2.cpp +++ b/radio/src/gui/colorlcd/layouts/layout1+2.cpp @@ -26,41 +26,35 @@ const uint8_t LBM_LAYOUT_1P2[] = { #include "mask_layout1+2.lbm" }; -const ZoneOption OPTIONS_LAYOUT_1P2[] = { - LAYOUT_COMMON_OPTIONS, - LAYOUT_OPTIONS_END -}; +const ZoneOption OPTIONS_LAYOUT_1P2[] = {LAYOUT_COMMON_OPTIONS, + LAYOUT_OPTIONS_END}; -class Layout1P2: public Layout +class Layout1P2 : public Layout { - public: - Layout1P2(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): + public: + Layout1P2(Window* parent, const LayoutFactory* factory, + Layout::PersistentData* persistentData) : Layout(parent, factory, persistentData) - { + { + } + + unsigned int getZonesCount() const override { return 3; } + + rect_t getZone(unsigned int index) const override + { + rect_t zone = getMainZone(); + + if (index == 0) { + return {zone.x, zone.y, zone.w, zone.h / 2}; + } else if (index == 1) { + return {zone.x, zone.y + zone.h / 2, zone.w, zone.h / 4}; + } else { + return {zone.x, zone.y + zone.h * 3 / 4, zone.w, zone.h / 4}; } - unsigned int getZonesCount() const override - { - return 3; - } - - rect_t getZone(unsigned int index) const override - { - rect_t zone = getMainZone(); - - if (index == 0) { - return {zone.x, zone.y, zone.w, zone.h / 2}; - } - else if (index == 1) { - return {zone.x, zone.y + zone.h / 2, zone.w, zone.h / 4}; - } - else - { - return {zone.x, zone.y + zone.h * 3 / 4, zone.w, zone.h / 4}; - } - - return zone; - } + return zone; + } }; -BaseLayoutFactory Layout1P2("Layout1P2", "1 + 2", LBM_LAYOUT_1P2, OPTIONS_LAYOUT_1P2); +BaseLayoutFactory Layout1P2("Layout1P2", "1 + 2", LBM_LAYOUT_1P2, + OPTIONS_LAYOUT_1P2); diff --git a/radio/src/gui/colorlcd/layouts/layout1+3.cpp b/radio/src/gui/colorlcd/layouts/layout1+3.cpp index 668765e6a..0d4008ae3 100644 --- a/radio/src/gui/colorlcd/layouts/layout1+3.cpp +++ b/radio/src/gui/colorlcd/layouts/layout1+3.cpp @@ -31,40 +31,39 @@ const ZoneOption OPTIONS_LAYOUT_1P3[] = { LAYOUT_OPTIONS_END }; -class Layout1P3: public Layout +class Layout1P3 : public Layout { - public: - Layout1P3(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): + public: + Layout1P3(Window* parent, const LayoutFactory* factory, + Layout::PersistentData* persistentData) : Layout(parent, factory, persistentData) - { - } + { + } - unsigned int getZonesCount() const override - { - return 4; - } + unsigned int getZonesCount() const override { return 4; } - rect_t getZone(unsigned int index) const override - { - rect_t zone = getMainZone(); + rect_t getZone(unsigned int index) const override + { + rect_t zone = getMainZone(); - zone.w /= 2; + zone.w /= 2; - if (index == 0) { - if (isMirrored()) { - zone.x += zone.w; - } - } else { - index--; - zone.h /= 3; - zone.y += zone.h * (int)index; - if (!isMirrored()) { - zone.x += zone.w; - } + if (index == 0) { + if (isMirrored()) { + zone.x += zone.w; + } + } else { + index--; + zone.h /= 3; + zone.y += zone.h * (int)index; + if (!isMirrored()) { + zone.x += zone.w; } - - return zone; } + + return zone; + } }; -BaseLayoutFactory Layout1P3("Layout1P3", "1 + 3", LBM_LAYOUT_1P3, OPTIONS_LAYOUT_1P3); +BaseLayoutFactory Layout1P3("Layout1P3", "1 + 3", LBM_LAYOUT_1P3, + OPTIONS_LAYOUT_1P3); diff --git a/radio/src/gui/colorlcd/layouts/layout1x1.cpp b/radio/src/gui/colorlcd/layouts/layout1x1.cpp index 8e2da48d4..4dcf79cbe 100644 --- a/radio/src/gui/colorlcd/layouts/layout1x1.cpp +++ b/radio/src/gui/colorlcd/layouts/layout1x1.cpp @@ -26,28 +26,22 @@ const uint8_t LBM_LAYOUT_1x1[] = { #include "mask_layout1x1.lbm" }; -const ZoneOption OPTIONS_LAYOUT_1x1[] = { - LAYOUT_COMMON_OPTIONS, - LAYOUT_OPTIONS_END -}; +const ZoneOption OPTIONS_LAYOUT_1x1[] = {LAYOUT_COMMON_OPTIONS, + LAYOUT_OPTIONS_END}; -class Layout1x1: public Layout +class Layout1x1 : public Layout { - public: - Layout1x1(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): + public: + Layout1x1(Window* parent, const LayoutFactory* factory, + Layout::PersistentData* persistentData) : Layout(parent, factory, persistentData) - { - } + { + } - unsigned int getZonesCount() const override - { - return 1; - } + unsigned int getZonesCount() const override { return 1; } - rect_t getZone(unsigned int index) const override - { - return getMainZone(); - } + rect_t getZone(unsigned int index) const override { return getMainZone(); } }; -BaseLayoutFactory layout1x1("Layout1x1", "Fullscreen", LBM_LAYOUT_1x1, OPTIONS_LAYOUT_1x1); +BaseLayoutFactory layout1x1("Layout1x1", "Fullscreen", + LBM_LAYOUT_1x1, OPTIONS_LAYOUT_1x1); diff --git a/radio/src/gui/colorlcd/layouts/layout1x2.cpp b/radio/src/gui/colorlcd/layouts/layout1x2.cpp index 88e1dfccf..c853c52c2 100644 --- a/radio/src/gui/colorlcd/layouts/layout1x2.cpp +++ b/radio/src/gui/colorlcd/layouts/layout1x2.cpp @@ -26,33 +26,30 @@ const uint8_t LBM_LAYOUT_1x2[] = { #include "mask_layout1x2.lbm" }; -const ZoneOption OPTIONS_LAYOUT_1x2[] = { - LAYOUT_COMMON_OPTIONS, - LAYOUT_OPTIONS_END -}; +const ZoneOption OPTIONS_LAYOUT_1x2[] = {LAYOUT_COMMON_OPTIONS, + LAYOUT_OPTIONS_END}; -class Layout1x2: public Layout +class Layout1x2 : public Layout { - public: - Layout1x2(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): + public: + Layout1x2(Window* parent, const LayoutFactory* factory, + Layout::PersistentData* persistentData) : Layout(parent, factory, persistentData) - { - } + { + } - unsigned int getZonesCount() const override - { - return 2; - } + unsigned int getZonesCount() const override { return 2; } - rect_t getZone(unsigned int index) const override - { - rect_t zone = getMainZone(); + rect_t getZone(unsigned int index) const override + { + rect_t zone = getMainZone(); - zone.h /= 2; - zone.y += zone.h * index; + zone.h /= 2; + zone.y += zone.h * index; - return zone; - } + return zone; + } }; -BaseLayoutFactory Layout1x2("Layout1x2", "1 x 2", LBM_LAYOUT_1x2, OPTIONS_LAYOUT_1x2); +BaseLayoutFactory Layout1x2("Layout1x2", "1 x 2", LBM_LAYOUT_1x2, + OPTIONS_LAYOUT_1x2); diff --git a/radio/src/gui/colorlcd/layouts/layout1x3.cpp b/radio/src/gui/colorlcd/layouts/layout1x3.cpp index 12fd83406..db90bc692 100644 --- a/radio/src/gui/colorlcd/layouts/layout1x3.cpp +++ b/radio/src/gui/colorlcd/layouts/layout1x3.cpp @@ -26,33 +26,30 @@ const uint8_t LBM_LAYOUT_1x3[] = { #include "mask_layout1x3.lbm" }; -const ZoneOption OPTIONS_LAYOUT_1x3[] = { - LAYOUT_COMMON_OPTIONS, - LAYOUT_OPTIONS_END -}; +const ZoneOption OPTIONS_LAYOUT_1x3[] = {LAYOUT_COMMON_OPTIONS, + LAYOUT_OPTIONS_END}; -class Layout1x3: public Layout +class Layout1x3 : public Layout { - public: - Layout1x3(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): + public: + Layout1x3(Window* parent, const LayoutFactory* factory, + Layout::PersistentData* persistentData) : Layout(parent, factory, persistentData) - { - } + { + } - unsigned int getZonesCount() const override - { - return 3; - } + unsigned int getZonesCount() const override { return 3; } - rect_t getZone(unsigned int index) const override - { - rect_t zone = getMainZone(); + rect_t getZone(unsigned int index) const override + { + rect_t zone = getMainZone(); - zone.h /= 3; - zone.y += zone.h * index; + zone.h /= 3; + zone.y += zone.h * index; - return zone; - } + return zone; + } }; -BaseLayoutFactory Layout1x3("Layout1x3", "1 x 3", LBM_LAYOUT_1x3, OPTIONS_LAYOUT_1x3); +BaseLayoutFactory Layout1x3("Layout1x3", "1 x 3", LBM_LAYOUT_1x3, + OPTIONS_LAYOUT_1x3); diff --git a/radio/src/gui/colorlcd/layouts/layout1x4.cpp b/radio/src/gui/colorlcd/layouts/layout1x4.cpp index 69793e7a9..ed770b833 100644 --- a/radio/src/gui/colorlcd/layouts/layout1x4.cpp +++ b/radio/src/gui/colorlcd/layouts/layout1x4.cpp @@ -31,31 +31,29 @@ const ZoneOption OPTIONS_LAYOUT_1x4[] = { LAYOUT_OPTIONS_END }; -class Layout1x4: public Layout +class Layout1x4 : public Layout { - public: - Layout1x4(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): + public: + Layout1x4(Window* parent, const LayoutFactory* factory, + Layout::PersistentData* persistentData) : Layout(parent, factory, persistentData) - { + { + } + + unsigned int getZonesCount() const override { return 4; } + + rect_t getZone(unsigned int index) const override + { + rect_t zone = getMainZone(); + + if (index > 3) { + index = 3; } + return {zone.x, zone.y + zone.h / 4 * (int)index, zone.w, zone.h / 4}; - unsigned int getZonesCount() const override - { - return 4; - } - - rect_t getZone(unsigned int index) const override - { - rect_t zone = getMainZone(); - - if (index > 3) - { - index = 3; - } - return {zone.x, zone.y + zone.h / 4 * (int)index, zone.w, zone.h / 4}; - - return zone; - } + return zone; + } }; -BaseLayoutFactory Layout1x4("Layout1x4", "1 x 4", LBM_LAYOUT_1x4, OPTIONS_LAYOUT_1x4); +BaseLayoutFactory Layout1x4("Layout1x4", "1 x 4", LBM_LAYOUT_1x4, + OPTIONS_LAYOUT_1x4); diff --git a/radio/src/gui/colorlcd/layouts/layout2+1.cpp b/radio/src/gui/colorlcd/layouts/layout2+1.cpp index cf0ada650..5e02af5ad 100644 --- a/radio/src/gui/colorlcd/layouts/layout2+1.cpp +++ b/radio/src/gui/colorlcd/layouts/layout2+1.cpp @@ -31,36 +31,36 @@ const ZoneOption OPTIONS_LAYOUT_2P1[] = { LAYOUT_OPTIONS_END }; -class Layout2P1: public Layout +class Layout2P1 : public Layout { - public: - Layout2P1(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): + public: + Layout2P1(Window* parent, const LayoutFactory* factory, + Layout::PersistentData* persistentData) : Layout(parent, factory, persistentData) - { + { + } + + unsigned int getZonesCount() const override { return 3; } + + rect_t getZone(unsigned int index) const override + { + rect_t zone = getMainZone(); + + if (index == 0) { + return {isMirrored() ? zone.x : zone.x + zone.w / 2, zone.y, zone.w / 2, + zone.h}; + } else if (index == 1) { + return {isMirrored() ? zone.x + zone.w / 2 : zone.x, zone.y, zone.w / 2, + zone.h / 2}; + } else { + return {isMirrored() ? zone.x + zone.w / 2 : zone.x, zone.y + zone.h / 2, + zone.w / 2, zone.h / 2}; } - unsigned int getZonesCount() const override - { - return 3; - } - - rect_t getZone(unsigned int index) const override - { - rect_t zone = getMainZone(); - - if (index == 0) { - return {isMirrored() ? zone.x : zone.x + zone.w / 2, zone.y,zone.w / 2, zone.h}; - } - else if (index == 1) { - return {isMirrored() ? zone.x + zone.w / 2 : zone.x, zone.y,zone.w / 2, zone.h / 2}; - } - else { - return {isMirrored() ? zone.x + zone.w / 2 : zone.x, zone.y + zone.h / 2,zone.w / 2, zone.h / 2}; - } - - return zone; - } + return zone; + } }; -BaseLayoutFactory layout2P1("Layout2P1", "2 + 1", LBM_LAYOUT_2P1, OPTIONS_LAYOUT_2P1); -const LayoutFactory * defaultLayout = &layout2P1; +BaseLayoutFactory layout2P1("Layout2P1", "2 + 1", LBM_LAYOUT_2P1, + OPTIONS_LAYOUT_2P1); +const LayoutFactory* defaultLayout = &layout2P1; diff --git a/radio/src/gui/colorlcd/layouts/layout2+3.cpp b/radio/src/gui/colorlcd/layouts/layout2+3.cpp index 516aeafce..6c95bea51 100644 --- a/radio/src/gui/colorlcd/layouts/layout2+3.cpp +++ b/radio/src/gui/colorlcd/layouts/layout2+3.cpp @@ -31,42 +31,41 @@ const ZoneOption OPTIONS_LAYOUT_2P3[] = { LAYOUT_OPTIONS_END }; -class Layout2P3: public Layout +class Layout2P3 : public Layout { - public: - Layout2P3(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): + public: + Layout2P3(Window* parent, const LayoutFactory* factory, + Layout::PersistentData* persistentData) : Layout(parent, factory, persistentData) - { - } + { + } - unsigned int getZonesCount() const override - { - return 5; - } + unsigned int getZonesCount() const override { return 5; } - rect_t getZone(unsigned int index) const override - { - rect_t zone = getMainZone(); + rect_t getZone(unsigned int index) const override + { + rect_t zone = getMainZone(); - zone.w /= 2; + zone.w /= 2; - if (index == 0 || index == 1) { - zone.h /= 2; - if (index == 1) zone.y += zone.h; - if (isMirrored()) { - zone.x += zone.w; - } - } else { - index -= 2; - zone.h /= 3; - zone.y += zone.h * (int)index; - if (!isMirrored()) { - zone.x += zone.w; - } + if (index == 0 || index == 1) { + zone.h /= 2; + if (index == 1) zone.y += zone.h; + if (isMirrored()) { + zone.x += zone.w; + } + } else { + index -= 2; + zone.h /= 3; + zone.y += zone.h * (int)index; + if (!isMirrored()) { + zone.x += zone.w; } - - return zone; } + + return zone; + } }; -BaseLayoutFactory Layout2P3("Layout2P3", "2 + 3", LBM_LAYOUT_2P3, OPTIONS_LAYOUT_2P3); +BaseLayoutFactory Layout2P3("Layout2P3", "2 + 3", LBM_LAYOUT_2P3, + OPTIONS_LAYOUT_2P3); diff --git a/radio/src/gui/colorlcd/layouts/layout2x1.cpp b/radio/src/gui/colorlcd/layouts/layout2x1.cpp index c7d8984cf..049618028 100644 --- a/radio/src/gui/colorlcd/layouts/layout2x1.cpp +++ b/radio/src/gui/colorlcd/layouts/layout2x1.cpp @@ -31,32 +31,32 @@ const ZoneOption OPTIONS_LAYOUT_2x1[] = { LAYOUT_OPTIONS_END }; -class Layout2x1: public Layout +class Layout2x1 : public Layout { - public: - Layout2x1(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): + public: + Layout2x1(Window* parent, const LayoutFactory* factory, + Layout::PersistentData* persistentData) : Layout(parent, factory, persistentData) - { + { + } + + unsigned int getZonesCount() const override { return 2; } + + rect_t getZone(unsigned int index) const override + { + rect_t zone = getMainZone(); + + if (index == 0) { + return {isMirrored() ? zone.x + zone.w / 2 : zone.x, zone.y, zone.w / 2, + zone.h}; + } else { + return {isMirrored() ? zone.x : zone.x + zone.w / 2, zone.y, zone.w / 2, + zone.h}; } - unsigned int getZonesCount() const override - { - return 2; - } - - rect_t getZone(unsigned int index) const override - { - rect_t zone = getMainZone(); - - if (index == 0) { - return {isMirrored() ? zone.x + zone.w / 2 : zone.x, zone.y, zone.w / 2, zone.h}; - } - else { - return {isMirrored() ? zone.x : zone.x + zone.w / 2, zone.y, zone.w / 2, zone.h}; - } - - return zone; - } + return zone; + } }; -BaseLayoutFactory Layout2x1("Layout2x1", "2 x 1", LBM_LAYOUT_2x1, OPTIONS_LAYOUT_2x1); +BaseLayoutFactory Layout2x1("Layout2x1", "2 x 1", LBM_LAYOUT_2x1, + OPTIONS_LAYOUT_2x1); diff --git a/radio/src/gui/colorlcd/layouts/layout2x2.cpp b/radio/src/gui/colorlcd/layouts/layout2x2.cpp index bb421c05f..5733debf8 100644 --- a/radio/src/gui/colorlcd/layouts/layout2x2.cpp +++ b/radio/src/gui/colorlcd/layouts/layout2x2.cpp @@ -31,34 +31,32 @@ const ZoneOption OPTIONS_LAYOUT_2x2[] = { LAYOUT_OPTIONS_END }; -class Layout2x2: public Layout +class Layout2x2 : public Layout { - public: - Layout2x2(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): + public: + Layout2x2(Window* parent, const LayoutFactory* factory, + Layout::PersistentData* persistentData) : Layout(parent, factory, persistentData) - { - } + { + } - unsigned int getZonesCount() const override - { - return 4; - } + unsigned int getZonesCount() const override { return 4; } - rect_t getZone(unsigned int index) const override - { - rect_t zone = getMainZone(); + rect_t getZone(unsigned int index) const override + { + rect_t zone = getMainZone(); - zone.w /= 2; - zone.h /= 2; + zone.w /= 2; + zone.h /= 2; - if (index == 1 || index == 3) - zone.y += zone.h; + if (index == 1 || index == 3) zone.y += zone.h; - if ((!isMirrored() && index > 1) || (isMirrored() && index < 2)) - zone.x += zone.w; + if ((!isMirrored() && index > 1) || (isMirrored() && index < 2)) + zone.x += zone.w; - return zone; - } + return zone; + } }; -BaseLayoutFactory layout2x2("Layout2x2", "2 x 2", LBM_LAYOUT_2x2, OPTIONS_LAYOUT_2x2); +BaseLayoutFactory layout2x2("Layout2x2", "2 x 2", LBM_LAYOUT_2x2, + OPTIONS_LAYOUT_2x2); diff --git a/radio/src/gui/colorlcd/layouts/layout2x3.cpp b/radio/src/gui/colorlcd/layouts/layout2x3.cpp index b5cf88d9d..d46fda3b6 100644 --- a/radio/src/gui/colorlcd/layouts/layout2x3.cpp +++ b/radio/src/gui/colorlcd/layouts/layout2x3.cpp @@ -26,41 +26,38 @@ const uint8_t LBM_LAYOUT_2x3[] = { #include "mask_layout2x3.lbm" }; -const ZoneOption OPTIONS_LAYOUT_2x3[] = { - LAYOUT_COMMON_OPTIONS, - LAYOUT_OPTIONS_END -}; +const ZoneOption OPTIONS_LAYOUT_2x3[] = {LAYOUT_COMMON_OPTIONS, + LAYOUT_OPTIONS_END}; -class Layout2x3: public Layout +class Layout2x3 : public Layout { - public: - Layout2x3(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): + public: + Layout2x3(Window* parent, const LayoutFactory* factory, + Layout::PersistentData* persistentData) : Layout(parent, factory, persistentData) - { - } + { + } - unsigned int getZonesCount() const override - { - return 6; - } + unsigned int getZonesCount() const override { return 6; } - rect_t getZone(unsigned int index) const override - { - rect_t zone = getMainZone(); + rect_t getZone(unsigned int index) const override + { + rect_t zone = getMainZone(); - zone.w /= 2; - zone.h /= 3; + zone.w /= 2; + zone.h /= 3; - if (index == 1 || index == 3) - zone.y += zone.h; - else if (index == 2 || index == 4) - zone.y += zone.h * 2; + if (index == 1 || index == 3) + zone.y += zone.h; + else if (index == 2 || index == 4) + zone.y += zone.h * 2; - if ((!isMirrored() && index > 2) || (isMirrored() && index < 3)) - zone.x += zone.w; + if ((!isMirrored() && index > 2) || (isMirrored() && index < 3)) + zone.x += zone.w; - return zone; - } + return zone; + } }; -BaseLayoutFactory layout2x3("Layout2x3", "2 x 3", LBM_LAYOUT_2x3, OPTIONS_LAYOUT_2x3); +BaseLayoutFactory layout2x3("Layout2x3", "2 x 3", LBM_LAYOUT_2x3, + OPTIONS_LAYOUT_2x3); diff --git a/radio/src/gui/colorlcd/layouts/layout2x4.cpp b/radio/src/gui/colorlcd/layouts/layout2x4.cpp index 420fe8016..657661ad6 100644 --- a/radio/src/gui/colorlcd/layouts/layout2x4.cpp +++ b/radio/src/gui/colorlcd/layouts/layout2x4.cpp @@ -27,61 +27,58 @@ const uint8_t LBM_LAYOUT_2x4[] = { }; const ZoneOption OPTIONS_LAYOUT_2x4[] = { - LAYOUT_COMMON_OPTIONS, - { "Panel1 background", ZoneOption::Bool }, - { " Color", ZoneOption::Color }, - { "Panel2 background", ZoneOption::Bool }, - { " Color", ZoneOption::Color }, - LAYOUT_OPTIONS_END + LAYOUT_COMMON_OPTIONS, + {"Panel1 background", ZoneOption::Bool}, + {" Color", ZoneOption::Color}, + {"Panel2 background", ZoneOption::Bool}, + {" Color", ZoneOption::Color}, + LAYOUT_OPTIONS_END }; -class Layout2x4: public Layout +class Layout2x4 : public Layout { - public: + public: + enum { + OPTION_PANEL1_BACKGROUND = LAYOUT_OPTION_LAST_DEFAULT + 1, + OPTION_PANEL1_COLOR, + OPTION_PANEL2_BACKGROUND, + OPTION_PANEL2_COLOR + }; - enum { - OPTION_PANEL1_BACKGROUND = LAYOUT_OPTION_LAST_DEFAULT + 1, - OPTION_PANEL1_COLOR, - OPTION_PANEL2_BACKGROUND, - OPTION_PANEL2_COLOR - }; - - Layout2x4(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): + Layout2x4(Window* parent, const LayoutFactory* factory, + Layout::PersistentData* persistentData) : Layout(parent, factory, persistentData) - { + { + } + + void create() override + { + Layout::create(); + getOptionValue(OPTION_PANEL1_BACKGROUND)->boolValue = true; + getOptionValue(OPTION_PANEL1_COLOR)->unsignedValue = RGB(77, 112, 203); + getOptionValue(OPTION_PANEL2_BACKGROUND)->boolValue = true; + getOptionValue(OPTION_PANEL2_COLOR)->unsignedValue = RGB(77, 112, 203); + } + + unsigned int getZonesCount() const override { return 8; } + + rect_t getZone(unsigned int index) const override + { + rect_t zone = getMainZone(); + + zone.w /= 2; + zone.h /= 4; + + if ((!isMirrored() && index > 3) || (isMirrored() && index < 4)) { + zone.x += zone.w; } - void create() override - { - Layout::create(); - getOptionValue(OPTION_PANEL1_BACKGROUND)->boolValue = true; - getOptionValue(OPTION_PANEL1_COLOR)->unsignedValue = RGB(77,112,203); - getOptionValue(OPTION_PANEL2_BACKGROUND)->boolValue = true; - getOptionValue(OPTION_PANEL2_COLOR)->unsignedValue = RGB(77,112,203); - } + zone.y += (index % 4) * zone.h; - unsigned int getZonesCount() const override - { - return 8; - } + return zone; + } - rect_t getZone(unsigned int index) const override - { - rect_t zone = getMainZone(); - - zone.w /= 2; - zone.h /= 4; - - if ((!isMirrored() && index > 3) || (isMirrored() && index < 4)) { - zone.x += zone.w; - } - - zone.y += (index % 4) * zone.h; - - return zone; - } - - void paint(BitmapBuffer * dc) override; + void paint(BitmapBuffer* dc) override; }; void Layout2x4::paint(BitmapBuffer* dc) @@ -90,15 +87,18 @@ void Layout2x4::paint(BitmapBuffer* dc) rect_t fullScreen = Layout::getMainZone(); fullScreen.w /= 2; if (getOptionValue(OPTION_PANEL1_BACKGROUND)->boolValue) { - dc->drawSolidFilledRect(fullScreen.x, fullScreen.y, fullScreen.w, - fullScreen.h, COLOR2FLAGS(getOptionValue(OPTION_PANEL1_COLOR)->unsignedValue)); + dc->drawSolidFilledRect( + fullScreen.x, fullScreen.y, fullScreen.w, fullScreen.h, + COLOR2FLAGS(getOptionValue(OPTION_PANEL1_COLOR)->unsignedValue)); } if (getOptionValue(OPTION_PANEL2_BACKGROUND)->boolValue) { fullScreen.x += fullScreen.w; - dc->drawSolidFilledRect(fullScreen.x, fullScreen.y, fullScreen.w, - fullScreen.h, COLOR2FLAGS(getOptionValue(OPTION_PANEL2_COLOR)->unsignedValue)); + dc->drawSolidFilledRect( + fullScreen.x, fullScreen.y, fullScreen.w, fullScreen.h, + COLOR2FLAGS(getOptionValue(OPTION_PANEL2_COLOR)->unsignedValue)); } } -BaseLayoutFactory layout2x4("Layout2x4", "2 x 4", LBM_LAYOUT_2x4, OPTIONS_LAYOUT_2x4); +BaseLayoutFactory layout2x4("Layout2x4", "2 x 4", LBM_LAYOUT_2x4, + OPTIONS_LAYOUT_2x4); diff --git a/radio/src/gui/colorlcd/layouts/layout4+2.cpp b/radio/src/gui/colorlcd/layouts/layout4+2.cpp index cc7599204..7e71826a9 100644 --- a/radio/src/gui/colorlcd/layouts/layout4+2.cpp +++ b/radio/src/gui/colorlcd/layouts/layout4+2.cpp @@ -26,43 +26,40 @@ const uint8_t LBM_LAYOUT_4P2[] = { #include "mask_layout4+2.lbm" }; -const ZoneOption OPTIONS_LAYOUT_4P2[] = { - LAYOUT_COMMON_OPTIONS, - LAYOUT_OPTIONS_END -}; +const ZoneOption OPTIONS_LAYOUT_4P2[] = {LAYOUT_COMMON_OPTIONS, + LAYOUT_OPTIONS_END}; -class Layout4P2: public Layout +class Layout4P2 : public Layout { - public: - Layout4P2(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): + public: + Layout4P2(Window* parent, const LayoutFactory* factory, + Layout::PersistentData* persistentData) : Layout(parent, factory, persistentData) - { + { + } + + unsigned int getZonesCount() const override { return 6; } + + rect_t getZone(unsigned int index) const override + { + rect_t zone = getMainZone(); + zone.w /= 2; + + if (index < 4) { + zone.h /= 4; + zone.y += (index % 4) * zone.h; + } else { + zone.h /= 2; + zone.y += (index % 2) * zone.h; } - unsigned int getZonesCount() const override - { - return 6; + if ((!isMirrored() && index > 3) || (isMirrored() && index < 4)) { + zone.x += zone.w; } - rect_t getZone(unsigned int index) const override - { - rect_t zone = getMainZone(); - zone.w /= 2; - - if (index < 4) { - zone.h /= 4; - zone.y += (index % 4) * zone.h; - } else { - zone.h /= 2; - zone.y += (index % 2) * zone.h; - } - - if ((!isMirrored() && index > 3) || (isMirrored() && index < 4)) { - zone.x += zone.w; - } - - return zone; - } + return zone; + } }; -BaseLayoutFactory layout4P2("Layout4P2", "4 + 2", LBM_LAYOUT_4P2, OPTIONS_LAYOUT_4P2); +BaseLayoutFactory layout4P2("Layout4P2", "4 + 2", LBM_LAYOUT_4P2, + OPTIONS_LAYOUT_4P2);