From 1cf957386fdd146760994e77f6d850fc87aad3c7 Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Mon, 23 Aug 2021 22:15:13 +1000 Subject: [PATCH 1/5] Implement 1+3 layout --- radio/src/gui/colorlcd/layouts/layout1+3.cpp | 70 ++++++++++++++++++ .../gui/colorlcd/layouts/mask_layout1+3.png | Bin 0 -> 201 bytes 2 files changed, 70 insertions(+) create mode 100644 radio/src/gui/colorlcd/layouts/layout1+3.cpp create mode 100644 radio/src/gui/colorlcd/layouts/mask_layout1+3.png diff --git a/radio/src/gui/colorlcd/layouts/layout1+3.cpp b/radio/src/gui/colorlcd/layouts/layout1+3.cpp new file mode 100644 index 000000000..6793deba0 --- /dev/null +++ b/radio/src/gui/colorlcd/layouts/layout1+3.cpp @@ -0,0 +1,70 @@ +/* + * 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 "layout_factory_impl.h" + +const uint8_t LBM_LAYOUT_1P3[] = { +#include "mask_layout1+3.lbm" +}; + +const ZoneOption OPTIONS_LAYOUT_1P3[] = { + LAYOUT_COMMON_OPTIONS, + LAYOUT_OPTIONS_END +}; + +class Layout1P3: public Layout +{ + public: + Layout1P3(const LayoutFactory * factory, Layout::PersistentData * persistentData): + Layout(factory, persistentData) + { + } + + unsigned int getZonesCount() const override + { + return 4; + } + + rect_t getZone(unsigned int index) const override + { + rect_t zone = getMainZone(); + + 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; + } + } + + return zone; + } +}; + +BaseLayoutFactory Layout1P3("Layout1P3", "1 + 3", LBM_LAYOUT_1P3, OPTIONS_LAYOUT_1P3); diff --git a/radio/src/gui/colorlcd/layouts/mask_layout1+3.png b/radio/src/gui/colorlcd/layouts/mask_layout1+3.png new file mode 100644 index 0000000000000000000000000000000000000000..e3af8b62898ded987f366c07d58b8888a7639078 GIT binary patch literal 201 zcmeAS@N?(olHy`uVBq!ia0vp^#y~8|!3HGfOcSdDQjEnx?oJHr&dIz4a#+$GeH|GX zHuiJ>Nn{1`ISV`@i-DT2fiUBQ{K`2%!8lJB$B+p3w^zNn4k!q)T%333|GCcn+$sx7 zW>qOzXs_%Ip7gFvsb@x-pL9rQeS+`rFXih>`yG0;lVV(t%KV(=pLl+U(lJrPb&Ha2 m80T+Dw}WzyUAI|ZuWq~CQC@YrWXw#UO$?r{elF{r5}E*rdP86U literal 0 HcmV?d00001 From 88b3c14c02aa60e944a9b4a5a7fca4cdb59c10ef Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Mon, 23 Aug 2021 22:38:45 +1000 Subject: [PATCH 2/5] Implement 2+3 layout --- radio/src/gui/colorlcd/layouts/layout2+3.cpp | 72 ++++++++++++++++++ .../gui/colorlcd/layouts/mask_layout2+3.png | Bin 0 -> 207 bytes 2 files changed, 72 insertions(+) create mode 100644 radio/src/gui/colorlcd/layouts/layout2+3.cpp create mode 100644 radio/src/gui/colorlcd/layouts/mask_layout2+3.png diff --git a/radio/src/gui/colorlcd/layouts/layout2+3.cpp b/radio/src/gui/colorlcd/layouts/layout2+3.cpp new file mode 100644 index 000000000..606a227b2 --- /dev/null +++ b/radio/src/gui/colorlcd/layouts/layout2+3.cpp @@ -0,0 +1,72 @@ +/* + * 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 "layout_factory_impl.h" + +const uint8_t LBM_LAYOUT_2P3[] = { +#include "mask_layout2+3.lbm" +}; + +const ZoneOption OPTIONS_LAYOUT_2P3[] = { + LAYOUT_COMMON_OPTIONS, + LAYOUT_OPTIONS_END +}; + +class Layout2P3: public Layout +{ + public: + Layout2P3(const LayoutFactory * factory, Layout::PersistentData * persistentData): + Layout(factory, persistentData) + { + } + + unsigned int getZonesCount() const override + { + return 5; + } + + rect_t getZone(unsigned int index) const override + { + rect_t zone = getMainZone(); + + 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; + } + } + + return zone; + } +}; + +BaseLayoutFactory Layout2P3("Layout2P3", "2 + 3", LBM_LAYOUT_2P3, OPTIONS_LAYOUT_2P3); diff --git a/radio/src/gui/colorlcd/layouts/mask_layout2+3.png b/radio/src/gui/colorlcd/layouts/mask_layout2+3.png new file mode 100644 index 0000000000000000000000000000000000000000..76e8d886cfda5cfc7acbdf09a4c10ed0c3d9f05f GIT binary patch literal 207 zcmeAS@N?(olHy`uVBq!ia0vp^#y~8|!3HGfOcSdDQjEnx?oJHr&dIz4a#+$GeH|GX zHuiJ>Nn{1`ISV`@i-DT2f-s})wTO>E!4yvy$B+p3x7Px>4k++2Unu#$|8v?^?l+4S zTWkd0OlMge#cOex;+XdsXdi>8tDnm{r-UW|$ZJTX literal 0 HcmV?d00001 From a191effcf6e5af45fcd6c57df77398c6bd6a13b5 Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Mon, 23 Aug 2021 22:47:09 +1000 Subject: [PATCH 3/5] Implement 2x3 layout --- radio/src/gui/colorlcd/layouts/layout2x3.cpp | 66 ++++++++++++++++++ .../gui/colorlcd/layouts/mask_layout2x3.png | Bin 0 -> 196 bytes 2 files changed, 66 insertions(+) create mode 100644 radio/src/gui/colorlcd/layouts/layout2x3.cpp create mode 100644 radio/src/gui/colorlcd/layouts/mask_layout2x3.png diff --git a/radio/src/gui/colorlcd/layouts/layout2x3.cpp b/radio/src/gui/colorlcd/layouts/layout2x3.cpp new file mode 100644 index 000000000..d31f65cd6 --- /dev/null +++ b/radio/src/gui/colorlcd/layouts/layout2x3.cpp @@ -0,0 +1,66 @@ +/* + * 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 "layout_factory_impl.h" + +const uint8_t LBM_LAYOUT_2x3[] = { +#include "mask_layout2x3.lbm" +}; + +const ZoneOption OPTIONS_LAYOUT_2x3[] = { + LAYOUT_COMMON_OPTIONS, + LAYOUT_OPTIONS_END +}; + +class Layout2x3: public Layout +{ + public: + Layout2x3(const LayoutFactory * factory, Layout::PersistentData * persistentData): + Layout(factory, persistentData) + { + } + + unsigned int getZonesCount() const override + { + return 6; + } + + rect_t getZone(unsigned int index) const override + { + rect_t zone = getMainZone(); + + 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 ((!isMirrored() && index > 2) || (isMirrored() && index < 3)) + zone.x += zone.w; + + return zone; + } +}; + +BaseLayoutFactory layout2x3("Layout2x3", "2 x 3", LBM_LAYOUT_2x3, OPTIONS_LAYOUT_2x3); diff --git a/radio/src/gui/colorlcd/layouts/mask_layout2x3.png b/radio/src/gui/colorlcd/layouts/mask_layout2x3.png new file mode 100644 index 0000000000000000000000000000000000000000..add3081c0230641c46a867e59a45814994d81d21 GIT binary patch literal 196 zcmeAS@N?(olHy`uVBq!ia0vp^#y~8|!3HGfOcSdDQjEnx?oJHr&dIz4a#+$GeH|GX zHuiJ>Nn{1`ISV`@i-DT2fH33xiMvFBf{~ssjv*25Z?AfCF(`^KU#xjw|GX?ie}O_v z06$Bt=h~o2`wErT%y?LD8xZ=r`EOPFzsuijnGDx;6pD%-J~t;JT~F|Fmqd7=;hQs@ iWzU2l62e=IgV=+QOR7pg;&KOC!rAwDDk literal 0 HcmV?d00001 From 52f4714e4c08e50c04ae2c865a0945d21d2f87da Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Tue, 24 Aug 2021 15:47:39 +1000 Subject: [PATCH 4/5] Implement 1x3 layout --- radio/src/gui/colorlcd/layouts/layout1x3.cpp | 58 ++++++++++++++++++ .../gui/colorlcd/layouts/mask_layout1x3.png | Bin 0 -> 182 bytes 2 files changed, 58 insertions(+) create mode 100644 radio/src/gui/colorlcd/layouts/layout1x3.cpp create mode 100644 radio/src/gui/colorlcd/layouts/mask_layout1x3.png diff --git a/radio/src/gui/colorlcd/layouts/layout1x3.cpp b/radio/src/gui/colorlcd/layouts/layout1x3.cpp new file mode 100644 index 000000000..140dcb4b4 --- /dev/null +++ b/radio/src/gui/colorlcd/layouts/layout1x3.cpp @@ -0,0 +1,58 @@ +/* + * 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 "layout_factory_impl.h" + +const uint8_t LBM_LAYOUT_1x3[] = { +#include "mask_layout1x3.lbm" +}; + +const ZoneOption OPTIONS_LAYOUT_1x3[] = { + LAYOUT_COMMON_OPTIONS, + LAYOUT_OPTIONS_END +}; + +class Layout1x3: public Layout +{ + public: + Layout1x3(const LayoutFactory * factory, Layout::PersistentData * persistentData): + Layout(factory, persistentData) + { + } + + unsigned int getZonesCount() const override + { + return 3; + } + + rect_t getZone(unsigned int index) const override + { + rect_t zone = getMainZone(); + + zone.h /= 3; + zone.y += zone.h * index; + + return zone; + } +}; + +BaseLayoutFactory Layout1x3("Layout1x3", "1 x 3", LBM_LAYOUT_1x3, OPTIONS_LAYOUT_1x3); diff --git a/radio/src/gui/colorlcd/layouts/mask_layout1x3.png b/radio/src/gui/colorlcd/layouts/mask_layout1x3.png new file mode 100644 index 0000000000000000000000000000000000000000..2405442038bb2f541c8af5dca99a907111e177ff GIT binary patch literal 182 zcmeAS@N?(olHy`uVBq!ia0vp^#y~8|!3HGfOcSdDQjEnx?oJHr&dIz4a#+$GeH|GX zHuiJ>Nn{1`ISV`@i-DT2f-s})wTO>EL2pkN$B+p3w^t8xGAQt{9PIx4ea#}Vjcu|5 zXNu#)J)hO-&YAHxPJZ>Op6~ewCA5-PL>=8>?DCFhreVmjfSqub>8+V5jFW{0R1I%| Q9LT`n>FVdQ&MBb@0Gqfux&QzG literal 0 HcmV?d00001 From 66a1caa150acf17fae1b17f77c752403eedf7139 Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Tue, 24 Aug 2021 19:10:57 +1000 Subject: [PATCH 5/5] Simply 1x2 layout code --- radio/src/gui/colorlcd/layouts/layout1x2.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/radio/src/gui/colorlcd/layouts/layout1x2.cpp b/radio/src/gui/colorlcd/layouts/layout1x2.cpp index 6c3c728a6..9c90bf05c 100644 --- a/radio/src/gui/colorlcd/layouts/layout1x2.cpp +++ b/radio/src/gui/colorlcd/layouts/layout1x2.cpp @@ -48,12 +48,8 @@ class Layout1x2: public Layout { rect_t zone = getMainZone(); - if (index == 0) { - return {zone.x, zone.y, zone.w, zone.h / 2}; - } - else { - return {zone.x, zone.y + zone.h / 2, zone.w, zone.h / 2}; - } + zone.h /= 2; + zone.y += zone.h * index; return zone; }