layouts: indentation

This commit is contained in:
Raphael Coeffic
2022-06-11 15:38:08 +02:00
committed by Raphael Coeffic
parent 80a5c9976f
commit 27de2e2449
13 changed files with 319 additions and 349 deletions
+9 -15
View File
@@ -26,23 +26,19 @@ const uint8_t LBM_LAYOUT_1P2[] = {
#include "mask_layout1+2.lbm" #include "mask_layout1+2.lbm"
}; };
const ZoneOption OPTIONS_LAYOUT_1P2[] = { const ZoneOption OPTIONS_LAYOUT_1P2[] = {LAYOUT_COMMON_OPTIONS,
LAYOUT_COMMON_OPTIONS, LAYOUT_OPTIONS_END};
LAYOUT_OPTIONS_END
};
class Layout1P2 : public Layout class Layout1P2 : public Layout
{ {
public: public:
Layout1P2(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): Layout1P2(Window* parent, const LayoutFactory* factory,
Layout::PersistentData* persistentData) :
Layout(parent, factory, persistentData) Layout(parent, factory, persistentData)
{ {
} }
unsigned int getZonesCount() const override unsigned int getZonesCount() const override { return 3; }
{
return 3;
}
rect_t getZone(unsigned int index) const override rect_t getZone(unsigned int index) const override
{ {
@@ -50,12 +46,9 @@ class Layout1P2: public Layout
if (index == 0) { if (index == 0) {
return {zone.x, zone.y, zone.w, zone.h / 2}; return {zone.x, zone.y, zone.w, zone.h / 2};
} } else if (index == 1) {
else if (index == 1) {
return {zone.x, zone.y + zone.h / 2, zone.w, zone.h / 4}; return {zone.x, zone.y + zone.h / 2, zone.w, zone.h / 4};
} } else {
else
{
return {zone.x, zone.y + zone.h * 3 / 4, zone.w, zone.h / 4}; return {zone.x, zone.y + zone.h * 3 / 4, zone.w, zone.h / 4};
} }
@@ -63,4 +56,5 @@ class Layout1P2: public Layout
} }
}; };
BaseLayoutFactory<Layout1P2> Layout1P2("Layout1P2", "1 + 2", LBM_LAYOUT_1P2, OPTIONS_LAYOUT_1P2); BaseLayoutFactory<Layout1P2> Layout1P2("Layout1P2", "1 + 2", LBM_LAYOUT_1P2,
OPTIONS_LAYOUT_1P2);
+5 -6
View File
@@ -34,15 +34,13 @@ const ZoneOption OPTIONS_LAYOUT_1P3[] = {
class Layout1P3 : public Layout class Layout1P3 : public Layout
{ {
public: public:
Layout1P3(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): Layout1P3(Window* parent, const LayoutFactory* factory,
Layout::PersistentData* persistentData) :
Layout(parent, factory, persistentData) Layout(parent, factory, persistentData)
{ {
} }
unsigned int getZonesCount() const override unsigned int getZonesCount() const override { return 4; }
{
return 4;
}
rect_t getZone(unsigned int index) const override rect_t getZone(unsigned int index) const override
{ {
@@ -67,4 +65,5 @@ class Layout1P3: public Layout
} }
}; };
BaseLayoutFactory<Layout1P3> Layout1P3("Layout1P3", "1 + 3", LBM_LAYOUT_1P3, OPTIONS_LAYOUT_1P3); BaseLayoutFactory<Layout1P3> Layout1P3("Layout1P3", "1 + 3", LBM_LAYOUT_1P3,
OPTIONS_LAYOUT_1P3);
+8 -14
View File
@@ -26,28 +26,22 @@ const uint8_t LBM_LAYOUT_1x1[] = {
#include "mask_layout1x1.lbm" #include "mask_layout1x1.lbm"
}; };
const ZoneOption OPTIONS_LAYOUT_1x1[] = { const ZoneOption OPTIONS_LAYOUT_1x1[] = {LAYOUT_COMMON_OPTIONS,
LAYOUT_COMMON_OPTIONS, LAYOUT_OPTIONS_END};
LAYOUT_OPTIONS_END
};
class Layout1x1 : public Layout class Layout1x1 : public Layout
{ {
public: public:
Layout1x1(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): Layout1x1(Window* parent, const LayoutFactory* factory,
Layout::PersistentData* persistentData) :
Layout(parent, factory, persistentData) Layout(parent, factory, persistentData)
{ {
} }
unsigned int getZonesCount() const override unsigned int getZonesCount() const override { return 1; }
{
return 1;
}
rect_t getZone(unsigned int index) const override rect_t getZone(unsigned int index) const override { return getMainZone(); }
{
return getMainZone();
}
}; };
BaseLayoutFactory<Layout1x1> layout1x1("Layout1x1", "Fullscreen", LBM_LAYOUT_1x1, OPTIONS_LAYOUT_1x1); BaseLayoutFactory<Layout1x1> layout1x1("Layout1x1", "Fullscreen",
LBM_LAYOUT_1x1, OPTIONS_LAYOUT_1x1);
+7 -10
View File
@@ -26,23 +26,19 @@ const uint8_t LBM_LAYOUT_1x2[] = {
#include "mask_layout1x2.lbm" #include "mask_layout1x2.lbm"
}; };
const ZoneOption OPTIONS_LAYOUT_1x2[] = { const ZoneOption OPTIONS_LAYOUT_1x2[] = {LAYOUT_COMMON_OPTIONS,
LAYOUT_COMMON_OPTIONS, LAYOUT_OPTIONS_END};
LAYOUT_OPTIONS_END
};
class Layout1x2 : public Layout class Layout1x2 : public Layout
{ {
public: public:
Layout1x2(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): Layout1x2(Window* parent, const LayoutFactory* factory,
Layout::PersistentData* persistentData) :
Layout(parent, factory, persistentData) Layout(parent, factory, persistentData)
{ {
} }
unsigned int getZonesCount() const override unsigned int getZonesCount() const override { return 2; }
{
return 2;
}
rect_t getZone(unsigned int index) const override rect_t getZone(unsigned int index) const override
{ {
@@ -55,4 +51,5 @@ class Layout1x2: public Layout
} }
}; };
BaseLayoutFactory<Layout1x2> Layout1x2("Layout1x2", "1 x 2", LBM_LAYOUT_1x2, OPTIONS_LAYOUT_1x2); BaseLayoutFactory<Layout1x2> Layout1x2("Layout1x2", "1 x 2", LBM_LAYOUT_1x2,
OPTIONS_LAYOUT_1x2);
+7 -10
View File
@@ -26,23 +26,19 @@ const uint8_t LBM_LAYOUT_1x3[] = {
#include "mask_layout1x3.lbm" #include "mask_layout1x3.lbm"
}; };
const ZoneOption OPTIONS_LAYOUT_1x3[] = { const ZoneOption OPTIONS_LAYOUT_1x3[] = {LAYOUT_COMMON_OPTIONS,
LAYOUT_COMMON_OPTIONS, LAYOUT_OPTIONS_END};
LAYOUT_OPTIONS_END
};
class Layout1x3 : public Layout class Layout1x3 : public Layout
{ {
public: public:
Layout1x3(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): Layout1x3(Window* parent, const LayoutFactory* factory,
Layout::PersistentData* persistentData) :
Layout(parent, factory, persistentData) Layout(parent, factory, persistentData)
{ {
} }
unsigned int getZonesCount() const override unsigned int getZonesCount() const override { return 3; }
{
return 3;
}
rect_t getZone(unsigned int index) const override rect_t getZone(unsigned int index) const override
{ {
@@ -55,4 +51,5 @@ class Layout1x3: public Layout
} }
}; };
BaseLayoutFactory<Layout1x3> Layout1x3("Layout1x3", "1 x 3", LBM_LAYOUT_1x3, OPTIONS_LAYOUT_1x3); BaseLayoutFactory<Layout1x3> Layout1x3("Layout1x3", "1 x 3", LBM_LAYOUT_1x3,
OPTIONS_LAYOUT_1x3);
+6 -8
View File
@@ -34,22 +34,19 @@ const ZoneOption OPTIONS_LAYOUT_1x4[] = {
class Layout1x4 : public Layout class Layout1x4 : public Layout
{ {
public: public:
Layout1x4(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): Layout1x4(Window* parent, const LayoutFactory* factory,
Layout::PersistentData* persistentData) :
Layout(parent, factory, persistentData) Layout(parent, factory, persistentData)
{ {
} }
unsigned int getZonesCount() const override unsigned int getZonesCount() const override { return 4; }
{
return 4;
}
rect_t getZone(unsigned int index) const override rect_t getZone(unsigned int index) const override
{ {
rect_t zone = getMainZone(); rect_t zone = getMainZone();
if (index > 3) if (index > 3) {
{
index = 3; index = 3;
} }
return {zone.x, zone.y + zone.h / 4 * (int)index, zone.w, zone.h / 4}; return {zone.x, zone.y + zone.h / 4 * (int)index, zone.w, zone.h / 4};
@@ -58,4 +55,5 @@ class Layout1x4: public Layout
} }
}; };
BaseLayoutFactory<Layout1x4> Layout1x4("Layout1x4", "1 x 4", LBM_LAYOUT_1x4, OPTIONS_LAYOUT_1x4); BaseLayoutFactory<Layout1x4> Layout1x4("Layout1x4", "1 x 4", LBM_LAYOUT_1x4,
OPTIONS_LAYOUT_1x4);
+13 -13
View File
@@ -34,33 +34,33 @@ const ZoneOption OPTIONS_LAYOUT_2P1[] = {
class Layout2P1 : public Layout class Layout2P1 : public Layout
{ {
public: public:
Layout2P1(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): Layout2P1(Window* parent, const LayoutFactory* factory,
Layout::PersistentData* persistentData) :
Layout(parent, factory, persistentData) Layout(parent, factory, persistentData)
{ {
} }
unsigned int getZonesCount() const override unsigned int getZonesCount() const override { return 3; }
{
return 3;
}
rect_t getZone(unsigned int index) const override rect_t getZone(unsigned int index) const override
{ {
rect_t zone = getMainZone(); rect_t zone = getMainZone();
if (index == 0) { if (index == 0) {
return {isMirrored() ? zone.x : zone.x + zone.w / 2, zone.y,zone.w / 2, zone.h}; return {isMirrored() ? zone.x : zone.x + zone.w / 2, zone.y, zone.w / 2,
} zone.h};
else if (index == 1) { } else if (index == 1) {
return {isMirrored() ? zone.x + zone.w / 2 : zone.x, zone.y,zone.w / 2, zone.h / 2}; return {isMirrored() ? zone.x + zone.w / 2 : zone.x, zone.y, zone.w / 2,
} zone.h / 2};
else { } else {
return {isMirrored() ? zone.x + zone.w / 2 : zone.x, zone.y + zone.h / 2,zone.w / 2, zone.h / 2}; 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("Layout2P1", "2 + 1", LBM_LAYOUT_2P1, OPTIONS_LAYOUT_2P1); BaseLayoutFactory<Layout2P1> layout2P1("Layout2P1", "2 + 1", LBM_LAYOUT_2P1,
OPTIONS_LAYOUT_2P1);
const LayoutFactory* defaultLayout = &layout2P1; const LayoutFactory* defaultLayout = &layout2P1;
+5 -6
View File
@@ -34,15 +34,13 @@ const ZoneOption OPTIONS_LAYOUT_2P3[] = {
class Layout2P3 : public Layout class Layout2P3 : public Layout
{ {
public: public:
Layout2P3(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): Layout2P3(Window* parent, const LayoutFactory* factory,
Layout::PersistentData* persistentData) :
Layout(parent, factory, persistentData) Layout(parent, factory, persistentData)
{ {
} }
unsigned int getZonesCount() const override unsigned int getZonesCount() const override { return 5; }
{
return 5;
}
rect_t getZone(unsigned int index) const override rect_t getZone(unsigned int index) const override
{ {
@@ -69,4 +67,5 @@ class Layout2P3: public Layout
} }
}; };
BaseLayoutFactory<Layout2P3> Layout2P3("Layout2P3", "2 + 3", LBM_LAYOUT_2P3, OPTIONS_LAYOUT_2P3); BaseLayoutFactory<Layout2P3> Layout2P3("Layout2P3", "2 + 3", LBM_LAYOUT_2P3,
OPTIONS_LAYOUT_2P3);
+10 -10
View File
@@ -34,29 +34,29 @@ const ZoneOption OPTIONS_LAYOUT_2x1[] = {
class Layout2x1 : public Layout class Layout2x1 : public Layout
{ {
public: public:
Layout2x1(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): Layout2x1(Window* parent, const LayoutFactory* factory,
Layout::PersistentData* persistentData) :
Layout(parent, factory, persistentData) Layout(parent, factory, persistentData)
{ {
} }
unsigned int getZonesCount() const override unsigned int getZonesCount() const override { return 2; }
{
return 2;
}
rect_t getZone(unsigned int index) const override rect_t getZone(unsigned int index) const override
{ {
rect_t zone = getMainZone(); rect_t zone = getMainZone();
if (index == 0) { if (index == 0) {
return {isMirrored() ? zone.x + zone.w / 2 : zone.x, zone.y, zone.w / 2, zone.h}; return {isMirrored() ? zone.x + zone.w / 2 : zone.x, zone.y, zone.w / 2,
} zone.h};
else { } else {
return {isMirrored() ? zone.x : zone.x + zone.w / 2, zone.y, zone.w / 2, zone.h}; return {isMirrored() ? zone.x : zone.x + zone.w / 2, zone.y, zone.w / 2,
zone.h};
} }
return zone; return zone;
} }
}; };
BaseLayoutFactory<Layout2x1> Layout2x1("Layout2x1", "2 x 1", LBM_LAYOUT_2x1, OPTIONS_LAYOUT_2x1); BaseLayoutFactory<Layout2x1> Layout2x1("Layout2x1", "2 x 1", LBM_LAYOUT_2x1,
OPTIONS_LAYOUT_2x1);
+6 -8
View File
@@ -34,15 +34,13 @@ const ZoneOption OPTIONS_LAYOUT_2x2[] = {
class Layout2x2 : public Layout class Layout2x2 : public Layout
{ {
public: public:
Layout2x2(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): Layout2x2(Window* parent, const LayoutFactory* factory,
Layout::PersistentData* persistentData) :
Layout(parent, factory, persistentData) Layout(parent, factory, persistentData)
{ {
} }
unsigned int getZonesCount() const override unsigned int getZonesCount() const override { return 4; }
{
return 4;
}
rect_t getZone(unsigned int index) const override rect_t getZone(unsigned int index) const override
{ {
@@ -51,8 +49,7 @@ class Layout2x2: public Layout
zone.w /= 2; zone.w /= 2;
zone.h /= 2; zone.h /= 2;
if (index == 1 || index == 3) if (index == 1 || index == 3) zone.y += zone.h;
zone.y += zone.h;
if ((!isMirrored() && index > 1) || (isMirrored() && index < 2)) if ((!isMirrored() && index > 1) || (isMirrored() && index < 2))
zone.x += zone.w; zone.x += zone.w;
@@ -61,4 +58,5 @@ class Layout2x2: public Layout
} }
}; };
BaseLayoutFactory<Layout2x2> layout2x2("Layout2x2", "2 x 2", LBM_LAYOUT_2x2, OPTIONS_LAYOUT_2x2); BaseLayoutFactory<Layout2x2> layout2x2("Layout2x2", "2 x 2", LBM_LAYOUT_2x2,
OPTIONS_LAYOUT_2x2);
+7 -10
View File
@@ -26,23 +26,19 @@ const uint8_t LBM_LAYOUT_2x3[] = {
#include "mask_layout2x3.lbm" #include "mask_layout2x3.lbm"
}; };
const ZoneOption OPTIONS_LAYOUT_2x3[] = { const ZoneOption OPTIONS_LAYOUT_2x3[] = {LAYOUT_COMMON_OPTIONS,
LAYOUT_COMMON_OPTIONS, LAYOUT_OPTIONS_END};
LAYOUT_OPTIONS_END
};
class Layout2x3 : public Layout class Layout2x3 : public Layout
{ {
public: public:
Layout2x3(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): Layout2x3(Window* parent, const LayoutFactory* factory,
Layout::PersistentData* persistentData) :
Layout(parent, factory, persistentData) Layout(parent, factory, persistentData)
{ {
} }
unsigned int getZonesCount() const override unsigned int getZonesCount() const override { return 6; }
{
return 6;
}
rect_t getZone(unsigned int index) const override rect_t getZone(unsigned int index) const override
{ {
@@ -63,4 +59,5 @@ class Layout2x3: public Layout
} }
}; };
BaseLayoutFactory<Layout2x3> layout2x3("Layout2x3", "2 x 3", LBM_LAYOUT_2x3, OPTIONS_LAYOUT_2x3); BaseLayoutFactory<Layout2x3> layout2x3("Layout2x3", "2 x 3", LBM_LAYOUT_2x3,
OPTIONS_LAYOUT_2x3);
+11 -11
View File
@@ -38,7 +38,6 @@ const ZoneOption OPTIONS_LAYOUT_2x4[] = {
class Layout2x4 : public Layout class Layout2x4 : public Layout
{ {
public: public:
enum { enum {
OPTION_PANEL1_BACKGROUND = LAYOUT_OPTION_LAST_DEFAULT + 1, OPTION_PANEL1_BACKGROUND = LAYOUT_OPTION_LAST_DEFAULT + 1,
OPTION_PANEL1_COLOR, OPTION_PANEL1_COLOR,
@@ -46,7 +45,8 @@ class Layout2x4: public Layout
OPTION_PANEL2_COLOR 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) Layout(parent, factory, persistentData)
{ {
} }
@@ -60,10 +60,7 @@ class Layout2x4: public Layout
getOptionValue(OPTION_PANEL2_COLOR)->unsignedValue = RGB(77, 112, 203); getOptionValue(OPTION_PANEL2_COLOR)->unsignedValue = RGB(77, 112, 203);
} }
unsigned int getZonesCount() const override unsigned int getZonesCount() const override { return 8; }
{
return 8;
}
rect_t getZone(unsigned int index) const override rect_t getZone(unsigned int index) const override
{ {
@@ -90,15 +87,18 @@ void Layout2x4::paint(BitmapBuffer* dc)
rect_t fullScreen = Layout::getMainZone(); rect_t fullScreen = Layout::getMainZone();
fullScreen.w /= 2; fullScreen.w /= 2;
if (getOptionValue(OPTION_PANEL1_BACKGROUND)->boolValue) { if (getOptionValue(OPTION_PANEL1_BACKGROUND)->boolValue) {
dc->drawSolidFilledRect(fullScreen.x, fullScreen.y, fullScreen.w, dc->drawSolidFilledRect(
fullScreen.h, COLOR2FLAGS(getOptionValue(OPTION_PANEL1_COLOR)->unsignedValue)); fullScreen.x, fullScreen.y, fullScreen.w, fullScreen.h,
COLOR2FLAGS(getOptionValue(OPTION_PANEL1_COLOR)->unsignedValue));
} }
if (getOptionValue(OPTION_PANEL2_BACKGROUND)->boolValue) { if (getOptionValue(OPTION_PANEL2_BACKGROUND)->boolValue) {
fullScreen.x += fullScreen.w; fullScreen.x += fullScreen.w;
dc->drawSolidFilledRect(fullScreen.x, fullScreen.y, fullScreen.w, dc->drawSolidFilledRect(
fullScreen.h, COLOR2FLAGS(getOptionValue(OPTION_PANEL2_COLOR)->unsignedValue)); fullScreen.x, fullScreen.y, fullScreen.w, fullScreen.h,
COLOR2FLAGS(getOptionValue(OPTION_PANEL2_COLOR)->unsignedValue));
} }
} }
BaseLayoutFactory<Layout2x4> layout2x4("Layout2x4", "2 x 4", LBM_LAYOUT_2x4, OPTIONS_LAYOUT_2x4); BaseLayoutFactory<Layout2x4> layout2x4("Layout2x4", "2 x 4", LBM_LAYOUT_2x4,
OPTIONS_LAYOUT_2x4);
+7 -10
View File
@@ -26,23 +26,19 @@ const uint8_t LBM_LAYOUT_4P2[] = {
#include "mask_layout4+2.lbm" #include "mask_layout4+2.lbm"
}; };
const ZoneOption OPTIONS_LAYOUT_4P2[] = { const ZoneOption OPTIONS_LAYOUT_4P2[] = {LAYOUT_COMMON_OPTIONS,
LAYOUT_COMMON_OPTIONS, LAYOUT_OPTIONS_END};
LAYOUT_OPTIONS_END
};
class Layout4P2 : public Layout class Layout4P2 : public Layout
{ {
public: public:
Layout4P2(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData): Layout4P2(Window* parent, const LayoutFactory* factory,
Layout::PersistentData* persistentData) :
Layout(parent, factory, persistentData) Layout(parent, factory, persistentData)
{ {
} }
unsigned int getZonesCount() const override unsigned int getZonesCount() const override { return 6; }
{
return 6;
}
rect_t getZone(unsigned int index) const override rect_t getZone(unsigned int index) const override
{ {
@@ -65,4 +61,5 @@ class Layout4P2: public Layout
} }
}; };
BaseLayoutFactory<Layout4P2> layout4P2("Layout4P2", "4 + 2", LBM_LAYOUT_4P2, OPTIONS_LAYOUT_4P2); BaseLayoutFactory<Layout4P2> layout4P2("Layout4P2", "4 + 2", LBM_LAYOUT_4P2,
OPTIONS_LAYOUT_4P2);