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
+25 -31
View File
@@ -26,41 +26,35 @@ 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 { 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 zone;
{ }
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;
}
}; };
BaseLayoutFactory<Layout1P2> Layout1P2("Layout1P2", "1 + 2", LBM_LAYOUT_1P2, OPTIONS_LAYOUT_1P2); BaseLayoutFactory<Layout1P2> Layout1P2("Layout1P2", "1 + 2", LBM_LAYOUT_1P2,
OPTIONS_LAYOUT_1P2);
+26 -27
View File
@@ -31,40 +31,39 @@ const ZoneOption OPTIONS_LAYOUT_1P3[] = {
LAYOUT_OPTIONS_END LAYOUT_OPTIONS_END
}; };
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
{ {
rect_t zone = getMainZone(); rect_t zone = getMainZone();
zone.w /= 2; zone.w /= 2;
if (index == 0) { if (index == 0) {
if (isMirrored()) { if (isMirrored()) {
zone.x += zone.w; zone.x += zone.w;
} }
} else { } else {
index--; index--;
zone.h /= 3; zone.h /= 3;
zone.y += zone.h * (int)index; zone.y += zone.h * (int)index;
if (!isMirrored()) { if (!isMirrored()) {
zone.x += zone.w; zone.x += zone.w;
}
} }
return zone;
} }
return zone;
}
}; };
BaseLayoutFactory<Layout1P3> Layout1P3("Layout1P3", "1 + 3", LBM_LAYOUT_1P3, OPTIONS_LAYOUT_1P3); BaseLayoutFactory<Layout1P3> Layout1P3("Layout1P3", "1 + 3", LBM_LAYOUT_1P3,
OPTIONS_LAYOUT_1P3);
+12 -18
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);
+18 -21
View File
@@ -26,33 +26,30 @@ 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
{ {
rect_t zone = getMainZone(); rect_t zone = getMainZone();
zone.h /= 2; zone.h /= 2;
zone.y += zone.h * index; zone.y += zone.h * index;
return zone; return zone;
} }
}; };
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);
+18 -21
View File
@@ -26,33 +26,30 @@ 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
{ {
rect_t zone = getMainZone(); rect_t zone = getMainZone();
zone.h /= 3; zone.h /= 3;
zone.y += zone.h * index; zone.y += zone.h * index;
return zone; return zone;
} }
}; };
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);
+20 -22
View File
@@ -31,31 +31,29 @@ const ZoneOption OPTIONS_LAYOUT_1x4[] = {
LAYOUT_OPTIONS_END LAYOUT_OPTIONS_END
}; };
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 { 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 zone;
{ }
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;
}
}; };
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);
+27 -27
View File
@@ -31,36 +31,36 @@ const ZoneOption OPTIONS_LAYOUT_2P1[] = {
LAYOUT_OPTIONS_END LAYOUT_OPTIONS_END
}; };
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 { 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 zone;
{ }
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;
}
}; };
BaseLayoutFactory<Layout2P1> layout2P1("Layout2P1", "2 + 1", LBM_LAYOUT_2P1, OPTIONS_LAYOUT_2P1); BaseLayoutFactory<Layout2P1> layout2P1("Layout2P1", "2 + 1", LBM_LAYOUT_2P1,
const LayoutFactory * defaultLayout = &layout2P1; OPTIONS_LAYOUT_2P1);
const LayoutFactory* defaultLayout = &layout2P1;
+28 -29
View File
@@ -31,42 +31,41 @@ const ZoneOption OPTIONS_LAYOUT_2P3[] = {
LAYOUT_OPTIONS_END LAYOUT_OPTIONS_END
}; };
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
{ {
rect_t zone = getMainZone(); rect_t zone = getMainZone();
zone.w /= 2; zone.w /= 2;
if (index == 0 || index == 1) { if (index == 0 || index == 1) {
zone.h /= 2; zone.h /= 2;
if (index == 1) zone.y += zone.h; if (index == 1) zone.y += zone.h;
if (isMirrored()) { if (isMirrored()) {
zone.x += zone.w; zone.x += zone.w;
} }
} else { } else {
index -= 2; index -= 2;
zone.h /= 3; zone.h /= 3;
zone.y += zone.h * (int)index; zone.y += zone.h * (int)index;
if (!isMirrored()) { if (!isMirrored()) {
zone.x += zone.w; zone.x += zone.w;
}
} }
return zone;
} }
return zone;
}
}; };
BaseLayoutFactory<Layout2P3> Layout2P3("Layout2P3", "2 + 3", LBM_LAYOUT_2P3, OPTIONS_LAYOUT_2P3); BaseLayoutFactory<Layout2P3> Layout2P3("Layout2P3", "2 + 3", LBM_LAYOUT_2P3,
OPTIONS_LAYOUT_2P3);
+23 -23
View File
@@ -31,32 +31,32 @@ const ZoneOption OPTIONS_LAYOUT_2x1[] = {
LAYOUT_OPTIONS_END LAYOUT_OPTIONS_END
}; };
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 { 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 zone;
{ }
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;
}
}; };
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);
+19 -21
View File
@@ -31,34 +31,32 @@ const ZoneOption OPTIONS_LAYOUT_2x2[] = {
LAYOUT_OPTIONS_END LAYOUT_OPTIONS_END
}; };
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
{ {
rect_t zone = getMainZone(); rect_t zone = getMainZone();
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;
return zone; return zone;
} }
}; };
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);
+24 -27
View File
@@ -26,41 +26,38 @@ 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
{ {
rect_t zone = getMainZone(); rect_t zone = getMainZone();
zone.w /= 2; zone.w /= 2;
zone.h /= 3; zone.h /= 3;
if (index == 1 || index == 3) if (index == 1 || index == 3)
zone.y += zone.h; zone.y += zone.h;
else if (index == 2 || index == 4) else if (index == 2 || index == 4)
zone.y += zone.h * 2; zone.y += zone.h * 2;
if ((!isMirrored() && index > 2) || (isMirrored() && index < 3)) if ((!isMirrored() && index > 2) || (isMirrored() && index < 3))
zone.x += zone.w; zone.x += zone.w;
return zone; return zone;
} }
}; };
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);
+51 -51
View File
@@ -27,61 +27,58 @@ const uint8_t LBM_LAYOUT_2x4[] = {
}; };
const ZoneOption OPTIONS_LAYOUT_2x4[] = { const ZoneOption OPTIONS_LAYOUT_2x4[] = {
LAYOUT_COMMON_OPTIONS, LAYOUT_COMMON_OPTIONS,
{ "Panel1 background", ZoneOption::Bool }, {"Panel1 background", ZoneOption::Bool},
{ " Color", ZoneOption::Color }, {" Color", ZoneOption::Color},
{ "Panel2 background", ZoneOption::Bool }, {"Panel2 background", ZoneOption::Bool},
{ " Color", ZoneOption::Color }, {" Color", ZoneOption::Color},
LAYOUT_OPTIONS_END 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 { Layout2x4(Window* parent, const LayoutFactory* factory,
OPTION_PANEL1_BACKGROUND = LAYOUT_OPTION_LAST_DEFAULT + 1, Layout::PersistentData* persistentData) :
OPTION_PANEL1_COLOR,
OPTION_PANEL2_BACKGROUND,
OPTION_PANEL2_COLOR
};
Layout2x4(Window* parent, const LayoutFactory * factory, Layout::PersistentData * persistentData):
Layout(parent, factory, 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 zone.y += (index % 4) * zone.h;
{
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 zone;
{ }
return 8;
}
rect_t getZone(unsigned int index) const override void paint(BitmapBuffer* dc) 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 Layout2x4::paint(BitmapBuffer* dc) void Layout2x4::paint(BitmapBuffer* dc)
@@ -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);
+28 -31
View File
@@ -26,43 +26,40 @@ 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 { 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 if ((!isMirrored() && index > 3) || (isMirrored() && index < 4)) {
{ zone.x += zone.w;
return 6;
} }
rect_t getZone(unsigned int index) const override return zone;
{ }
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;
}
}; };
BaseLayoutFactory<Layout4P2> layout4P2("Layout4P2", "4 + 2", LBM_LAYOUT_4P2, OPTIONS_LAYOUT_4P2); BaseLayoutFactory<Layout4P2> layout4P2("Layout4P2", "4 + 2", LBM_LAYOUT_4P2,
OPTIONS_LAYOUT_4P2);