1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-13 19:40:20 +03:00

Layouts added

This commit is contained in:
Hobby4Life 2020-10-19 19:34:44 +02:00
parent 5aec5c8cd8
commit d17def7487
5 changed files with 74 additions and 209 deletions

View file

@ -1,104 +0,0 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* 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 "opentx.h"
const uint8_t LBM_LAYOUT_1P2[] = {
#include "mask_layout1+2.lbm"
};
const ZoneOption OPTIONS_LAYOUT_1P2[] = {
{ STR_TOP_BAR, ZoneOption::Bool },
{ STR_FLIGHT_MODE, ZoneOption::Bool },
{ STR_SLIDERS, ZoneOption::Bool },
{ STR_TRIMS, ZoneOption::Bool },
{ NULL, ZoneOption::Bool }
};
const Zone ZONES_LAYOUT_1P2[3] = {
{ 48, 60, 384, 70 },
{ 48, 142, 186, 70},
{ 246, 142, 186, 70}
};
class Layout1P2: public Layout
{
public:
Layout1P2(const LayoutFactory * factory, Layout::PersistentData * persistentData):
Layout(factory, persistentData)
{
}
virtual void create()
{
Layout::create();
persistentData->options[0].boolValue = true;
persistentData->options[1].boolValue = true;
persistentData->options[2].boolValue = true;
persistentData->options[3].boolValue = true;
}
virtual unsigned int getZonesCount() const
{
return DIM(ZONES_LAYOUT_1P2);
}
virtual Zone getZone(unsigned int index) const
{
return ZONES_LAYOUT_1P2[index];
}
virtual void refresh();
};
void Layout1P2::refresh()
{
theme->drawBackground();
if (persistentData->options[0].boolValue) {
drawTopBar();
}
if (persistentData->options[1].boolValue) {
// Flight mode
lcdDrawSizedText(LCD_W / 2 - getTextWidth(g_model.flightModeData[mixerCurrentFlightMode].name,
sizeof(g_model.flightModeData[mixerCurrentFlightMode].name),
ZCHAR | SMLSIZE) / 2,
232,
g_model.flightModeData[mixerCurrentFlightMode].name,
sizeof(g_model.flightModeData[mixerCurrentFlightMode].name), ZCHAR | SMLSIZE);
}
if (persistentData->options[2].boolValue) {
// Pots and rear sliders positions
drawMainPots();
}
if (persistentData->options[3].boolValue) {
// Trims
drawTrims(mixerCurrentFlightMode);
}
Layout::refresh();
}
BaseLayoutFactory<Layout1P2> layout1P2("Layout1P2", LBM_LAYOUT_1P2, OPTIONS_LAYOUT_1P2);

View file

@ -1,105 +0,0 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* 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 "opentx.h"
const uint8_t LBM_LAYOUT_1P2i[] = {
#include "mask_layout1+2i.lbm"
};
const ZoneOption OPTIONS_LAYOUT_1P2i[] = {
{ STR_TOP_BAR, ZoneOption::Bool },
{ STR_FLIGHT_MODE, ZoneOption::Bool },
{ STR_SLIDERS, ZoneOption::Bool },
{ STR_TRIMS, ZoneOption::Bool },
{ NULL, ZoneOption::Bool }
};
const Zone ZONES_LAYOUT_1P2i[3] = {
{ 48, 60, 186, 70},
{ 246, 60, 186, 70},
{ 48, 142, 384, 70 }
};
class Layout1P2i: public Layout
{
public:
Layout1P2i(const LayoutFactory * factory, Layout::PersistentData * persistentData):
Layout(factory, persistentData)
{
}
virtual void create()
{
Layout::create();
persistentData->options[0].boolValue = true;
persistentData->options[1].boolValue = true;
persistentData->options[2].boolValue = true;
persistentData->options[3].boolValue = true;
}
virtual unsigned int getZonesCount() const
{
return DIM(ZONES_LAYOUT_1P2i);
}
virtual Zone getZone(unsigned int index) const
{
return ZONES_LAYOUT_1P2i[index];
}
virtual void refresh();
};
void Layout1P2i::refresh()
{
theme->drawBackground();
if (persistentData->options[0].boolValue) {
drawTopBar();
}
if (persistentData->options[1].boolValue) {
// Flight mode
lcdDrawSizedText(LCD_W / 2 - getTextWidth(g_model.flightModeData[mixerCurrentFlightMode].name,
sizeof(g_model.flightModeData[mixerCurrentFlightMode].name),
ZCHAR | SMLSIZE) / 2,
232,
g_model.flightModeData[mixerCurrentFlightMode].name,
sizeof(g_model.flightModeData[mixerCurrentFlightMode].name), ZCHAR | SMLSIZE);
}
if (persistentData->options[2].boolValue) {
// Pots and rear sliders positions
drawMainPots();
}
if (persistentData->options[3].boolValue) {
// Trims
drawTrims(mixerCurrentFlightMode);
}
Layout::refresh();
}
BaseLayoutFactory<Layout1P2i> layout1P2i("Layout1P2i", LBM_LAYOUT_1P2i, OPTIONS_LAYOUT_1P2i);

View file

@ -0,0 +1,74 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* 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 "opentx.h"
const uint8_t LBM_LAYOUT_5x0[] = {
#include "mask_layout5x0.lbm"
};
const ZoneOption OPTIONS_LAYOUT_5x0[] = {
{ NULL, ZoneOption::Bool }
};
const Zone ZONES_LAYOUT_5x0[5] = {
/* X,Y,W,H */
{ 10, 10, 84, 252 },
{ 104, 10, 272, 55 },
{ 104, 75, 272, 121 },
{ 104, 206, 272, 55},
{ 386, 10, 84, 252 }
};
class Layout5x0: public Layout
{
public:
Layout5x0(const LayoutFactory * factory, Layout::PersistentData * persistentData):
Layout(factory, persistentData)
{
}
virtual void create()
{
Layout::create();
}
virtual unsigned int getZonesCount() const
{
return DIM(ZONES_LAYOUT_5x0);
}
virtual Zone getZone(unsigned int index) const
{
return ZONES_LAYOUT_5x0[index];
}
virtual void refresh();
};
void Layout5x0::refresh()
{
theme->drawBackground();
Layout::refresh();
}
BaseLayoutFactory<Layout5x0> layout5x0("Layout5x0", LBM_LAYOUT_5x0, OPTIONS_LAYOUT_5x0);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 966 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 966 B

After

Width:  |  Height:  |  Size: 1,001 B

Before After
Before After