From 1cf957386fdd146760994e77f6d850fc87aad3c7 Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Mon, 23 Aug 2021 22:15:13 +1000 Subject: [PATCH] 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