mirror of
https://github.com/opentx/opentx.git
synced 2025-07-14 20:10:08 +03:00
further unified layout options
This commit is contained in:
parent
463216ebca
commit
28026f1a78
7 changed files with 30 additions and 60 deletions
|
@ -56,7 +56,9 @@ class Layout: public LayoutBase
|
||||||
OPTION_FM,
|
OPTION_FM,
|
||||||
OPTION_SLIDERS,
|
OPTION_SLIDERS,
|
||||||
OPTION_TRIMS,
|
OPTION_TRIMS,
|
||||||
OPTION_MIRRORED
|
OPTION_MIRRORED,
|
||||||
|
|
||||||
|
OPTION_LAST_DEFAULT=OPTION_MIRRORED
|
||||||
};
|
};
|
||||||
|
|
||||||
Layout(const LayoutFactory * factory, PersistentData * persistentData):
|
Layout(const LayoutFactory * factory, PersistentData * persistentData):
|
||||||
|
@ -66,6 +68,16 @@ class Layout: public LayoutBase
|
||||||
decorate();
|
decorate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void create() override
|
||||||
|
{
|
||||||
|
setOptionValue(OPTION_TOPBAR, OPTION_VALUE_BOOL(true));
|
||||||
|
setOptionValue(OPTION_FM, OPTION_VALUE_BOOL(true));
|
||||||
|
setOptionValue(OPTION_SLIDERS, OPTION_VALUE_BOOL(true));
|
||||||
|
setOptionValue(OPTION_TRIMS, OPTION_VALUE_BOOL(true));
|
||||||
|
setOptionValue(OPTION_MIRRORED, OPTION_VALUE_BOOL(false));
|
||||||
|
decorate();
|
||||||
|
}
|
||||||
|
|
||||||
inline const LayoutFactory * getFactory() const
|
inline const LayoutFactory * getFactory() const
|
||||||
{
|
{
|
||||||
return factory;
|
return factory;
|
||||||
|
|
|
@ -40,21 +40,6 @@ class Layout1x1: public Layout
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void create() override
|
|
||||||
{
|
|
||||||
Layout::create();
|
|
||||||
// TODO: make this common to all layouts as well
|
|
||||||
persistentData->options[0].value.boolValue = true;
|
|
||||||
persistentData->options[1].value.boolValue = true;
|
|
||||||
persistentData->options[2].value.boolValue = true;
|
|
||||||
persistentData->options[3].value.boolValue = true;
|
|
||||||
persistentData->options[4].value.boolValue = false;
|
|
||||||
persistentData->options[5].value.boolValue = false;
|
|
||||||
|
|
||||||
// TODO: really needed?
|
|
||||||
decorate();
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int getZonesCount() const override
|
unsigned int getZonesCount() const override
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -41,18 +41,6 @@ class Layout2P1: public Layout
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void create() override
|
|
||||||
{
|
|
||||||
Layout::create();
|
|
||||||
persistentData->options[0].value.boolValue = true;
|
|
||||||
persistentData->options[1].value.boolValue = true;
|
|
||||||
persistentData->options[2].value.boolValue = true;
|
|
||||||
persistentData->options[3].value.boolValue = true;
|
|
||||||
persistentData->options[4].value.boolValue = false;
|
|
||||||
persistentData->options[5].value.boolValue = false;
|
|
||||||
decorate();
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int getZonesCount() const override
|
unsigned int getZonesCount() const override
|
||||||
{
|
{
|
||||||
return 3;
|
return 3;
|
||||||
|
|
|
@ -41,18 +41,6 @@ class Layout2x1: public Layout
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void create() override
|
|
||||||
{
|
|
||||||
Layout::create();
|
|
||||||
persistentData->options[0].value.boolValue = true;
|
|
||||||
persistentData->options[1].value.boolValue = true;
|
|
||||||
persistentData->options[2].value.boolValue = true;
|
|
||||||
persistentData->options[3].value.boolValue = true;
|
|
||||||
persistentData->options[4].value.boolValue = false;
|
|
||||||
persistentData->options[5].value.boolValue = false;
|
|
||||||
decorate();
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int getZonesCount() const override
|
unsigned int getZonesCount() const override
|
||||||
{
|
{
|
||||||
return 2;
|
return 2;
|
||||||
|
|
|
@ -41,18 +41,6 @@ class Layout2x2: public Layout
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void create() override
|
|
||||||
{
|
|
||||||
Layout::create();
|
|
||||||
persistentData->options[0].value.boolValue = true;
|
|
||||||
persistentData->options[1].value.boolValue = true;
|
|
||||||
persistentData->options[2].value.boolValue = true;
|
|
||||||
persistentData->options[3].value.boolValue = true;
|
|
||||||
persistentData->options[4].value.boolValue = false;
|
|
||||||
persistentData->options[5].value.boolValue = false;
|
|
||||||
decorate();
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int getZonesCount() const override
|
unsigned int getZonesCount() const override
|
||||||
{
|
{
|
||||||
return 4;
|
return 4;
|
||||||
|
|
|
@ -38,6 +38,14 @@ const ZoneOption OPTIONS_LAYOUT_2x4[] = {
|
||||||
class Layout2x4: public Layout
|
class Layout2x4: public Layout
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
enum {
|
||||||
|
OPTION_PANEL1_BACKGROUND = OPTION_LAST_DEFAULT + 1,
|
||||||
|
OPTION_PANEL1_COLOR,
|
||||||
|
OPTION_PANEL2_BACKGROUND,
|
||||||
|
OPTION_PANEL2_COLOR
|
||||||
|
};
|
||||||
|
|
||||||
Layout2x4(const LayoutFactory * factory, Layout::PersistentData * persistentData):
|
Layout2x4(const LayoutFactory * factory, Layout::PersistentData * persistentData):
|
||||||
Layout(factory, persistentData)
|
Layout(factory, persistentData)
|
||||||
{
|
{
|
||||||
|
@ -46,14 +54,10 @@ class Layout2x4: public Layout
|
||||||
void create() override
|
void create() override
|
||||||
{
|
{
|
||||||
Layout::create();
|
Layout::create();
|
||||||
persistentData->options[0] = ZoneOptionValueTyped { ZOV_Bool, OPTION_VALUE_BOOL(true) };
|
setOptionValue(OPTION_PANEL1_BACKGROUND, OPTION_VALUE_BOOL(true));
|
||||||
persistentData->options[1] = ZoneOptionValueTyped { ZOV_Bool, OPTION_VALUE_BOOL(true) };
|
setOptionValue(OPTION_PANEL1_COLOR, OPTION_VALUE_UNSIGNED( RGB(77,112,203)));
|
||||||
persistentData->options[2] = ZoneOptionValueTyped { ZOV_Bool, OPTION_VALUE_BOOL(true) };
|
setOptionValue(OPTION_PANEL2_BACKGROUND, OPTION_VALUE_BOOL(true));
|
||||||
persistentData->options[3] = ZoneOptionValueTyped { ZOV_Bool, OPTION_VALUE_BOOL(true) };
|
setOptionValue(OPTION_PANEL2_COLOR, OPTION_VALUE_UNSIGNED( RGB(77,112,203)));
|
||||||
persistentData->options[4] = ZoneOptionValueTyped { ZOV_Bool, OPTION_VALUE_BOOL(true) };
|
|
||||||
persistentData->options[5] = ZoneOptionValueTyped { ZOV_Unsigned, OPTION_VALUE_UNSIGNED( RGB(77,112,203)) };
|
|
||||||
persistentData->options[6] = ZoneOptionValueTyped { ZOV_Bool, OPTION_VALUE_BOOL(true) };
|
|
||||||
persistentData->options[7] = ZoneOptionValueTyped { ZOV_Unsigned, OPTION_VALUE_UNSIGNED( RGB(77,112,203)) };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int getZonesCount() const override
|
unsigned int getZonesCount() const override
|
||||||
|
|
|
@ -104,6 +104,11 @@ class WidgetsContainer: public FormGroup, public WidgetsContainerInterface
|
||||||
return &persistentData->options[index].value;
|
return &persistentData->options[index].value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void setOptionValue(unsigned int index, const ZoneOptionValue& value)
|
||||||
|
{
|
||||||
|
persistentData->options[index].value = value;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int getZonesCount() const override = 0;
|
unsigned int getZonesCount() const override = 0;
|
||||||
|
|
||||||
rect_t getZone(unsigned int index) const override = 0;
|
rect_t getZone(unsigned int index) const override = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue