chore(color): Cleanup and optimise EdgeTxTheme class (#4013)
This commit is contained in:
@@ -132,23 +132,6 @@ bool RadioLayout::CustomScreenData::isEmpty() const
|
||||
return strlen(layoutId) == 0;
|
||||
}
|
||||
|
||||
void RadioTheme::init(const char* themeName, ThemeData& themeData)
|
||||
{
|
||||
memset(&themeData, 0, sizeof(ThemeData));
|
||||
|
||||
memcpy(&themeData.themeName, themeName, THEME_NAME_LEN);
|
||||
|
||||
PersistentData& persistentData = themeData.themePersistentData;
|
||||
|
||||
persistentData.options[0].type =
|
||||
zoneValueEnumFromType(ZoneOption::Type::Color);
|
||||
setZoneOptionValue(persistentData.options[0].value, (unsigned int)WHITE);
|
||||
|
||||
persistentData.options[1].type =
|
||||
zoneValueEnumFromType(ZoneOption::Type::Color);
|
||||
setZoneOptionValue(persistentData.options[1].value, (unsigned int)RED);
|
||||
}
|
||||
|
||||
void RadioLayout::init(const char* layoutId, CustomScreens& customScreens)
|
||||
{
|
||||
memset(&customScreens, 0, sizeof(CustomScreens));
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
*/
|
||||
|
||||
constexpr int MAX_CUSTOM_SCREENS {10};
|
||||
constexpr int THEME_NAME_LEN {8};
|
||||
constexpr int MAX_THEME_OPTIONS {5};
|
||||
constexpr int LEN_ZONE_OPTION_STRING {8};
|
||||
constexpr int MAX_LAYOUT_ZONES {10};
|
||||
@@ -146,23 +145,6 @@ typedef WidgetsContainerPersistentData<MAX_LAYOUT_ZONES, MAX_LAYOUT_OPTIONS>
|
||||
typedef WidgetsContainerPersistentData<MAX_TOPBAR_ZONES, MAX_TOPBAR_OPTIONS>
|
||||
TopBarPersistentData;
|
||||
|
||||
class RadioTheme
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(RadioTheme)
|
||||
|
||||
public:
|
||||
struct PersistentData {
|
||||
ZoneOptionValueTyped options[MAX_THEME_OPTIONS];
|
||||
};
|
||||
|
||||
struct ThemeData {
|
||||
char themeName[THEME_NAME_LEN + 1];
|
||||
PersistentData themePersistentData;
|
||||
};
|
||||
|
||||
static void init(const char * themeName, ThemeData & themeData);
|
||||
};
|
||||
|
||||
class RadioLayout
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(RadioLayout)
|
||||
|
||||
@@ -299,9 +299,6 @@ Node convert<GeneralSettings>::encode(const GeneralSettings& rhs)
|
||||
node["potsConfig"] = potsConfig;
|
||||
}
|
||||
|
||||
// Color lcd theme settings are not used in EdgeTx
|
||||
// RadioTheme::ThemeData themeData;
|
||||
|
||||
node["ownerRegistrationID"] = rhs.registrationId;
|
||||
|
||||
// Gyro (for now only xlites)
|
||||
@@ -573,9 +570,6 @@ bool convert<GeneralSettings>::decode(const Node& node, GeneralSettings& rhs)
|
||||
}
|
||||
}
|
||||
|
||||
// Color lcd theme settings are not used in EdgeTx
|
||||
// RadioTheme::ThemeData themeData;
|
||||
|
||||
node["ownerRegistrationID"] >> rhs.registrationId;
|
||||
|
||||
// Gyro (for now only xlites)
|
||||
|
||||
@@ -277,8 +277,6 @@ class GeneralSettings {
|
||||
char sliderName[CPN_MAX_SLIDERS][HARDWARE_NAME_LEN + 1];
|
||||
unsigned int sliderConfig[CPN_MAX_SLIDERS];
|
||||
|
||||
RadioTheme::ThemeData themeData;
|
||||
|
||||
char registrationId[REGISTRATION_ID_LEN + 1];
|
||||
int gyroMax;
|
||||
int gyroOffset;
|
||||
|
||||
@@ -3304,15 +3304,6 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, Board::Type
|
||||
internalField.Append(new ZCharField<10>(this, generalData.bluetoothName, "Bluetooth name"));
|
||||
}
|
||||
|
||||
if (IS_FAMILY_HORUS_OR_T16(board)) {
|
||||
if (version >= 220) { // data from earlier versions cannot be converted so fields initialised in afterImport
|
||||
internalField.Append(new CharField<8>(this, generalData.themeData.themeName, true, "Theme name"));
|
||||
for (int i = 0; i < MAX_THEME_OPTIONS; i++) {
|
||||
internalField.Append(new ZoneOptionValueTypedField(this, generalData.themeData.themePersistentData.options[i], board, version));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (version >= 220) {
|
||||
internalField.Append(new CharField<8>(this, generalData.registrationId, "ACCESS Registration ID"));
|
||||
}
|
||||
@@ -3357,13 +3348,6 @@ void OpenTxGeneralData::beforeExport()
|
||||
|
||||
void OpenTxGeneralData::afterImport()
|
||||
{
|
||||
if (IS_FAMILY_HORUS_OR_T16(board)) {
|
||||
if (version < 220) { // re-initialise as no conversion possible
|
||||
const char * themeName = IS_FLYSKY_NV14(board) ? "FlySky" : "EdgeTX";
|
||||
RadioTheme::init(themeName, generalData.themeData);
|
||||
}
|
||||
}
|
||||
|
||||
if (Boards::getCapability((Board::Type)generalData.variant,
|
||||
Board::SportMaxBaudRate) >= 400000)
|
||||
generalData.internalModuleBaudrate =
|
||||
|
||||
@@ -39,8 +39,6 @@
|
||||
UserInterfacePanel::UserInterfacePanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
|
||||
ModelPanel(parent, model, generalSettings, firmware)
|
||||
{
|
||||
RadioTheme::ThemeData & td = generalSettings.themeData;
|
||||
|
||||
QString sdPath = QString(g.profile[g.id()].sdPath()).trimmed();
|
||||
|
||||
grid = new QGridLayout(this);
|
||||
@@ -191,11 +189,6 @@ UserInterfacePanel::UserInterfacePanel(QWidget * parent, ModelData & model, Gene
|
||||
|
||||
col = 0;
|
||||
|
||||
if (SHOW_RAW_INFO) {
|
||||
addGridLabel(grid, tr("Theme"), row, col++);
|
||||
grid->addLayout(addOptionsLayout<RadioTheme::PersistentData>(td.themePersistentData, MAX_THEME_OPTIONS), row, col);
|
||||
}
|
||||
|
||||
// the grid must be fully built for the rowspan to work as required
|
||||
foreach (QWidget * wgt, optswidgets) {
|
||||
grid->addWidget(wgt, widgetdetailsrow, widgetdetailscol, 3, Qt::AlignTop);
|
||||
|
||||
@@ -147,14 +147,14 @@ static inline void check_struct()
|
||||
CHKSIZE(ModelData, 6706);
|
||||
#elif defined(PCBHORUS)
|
||||
#if defined(PCBX10)
|
||||
CHKSIZE(RadioData, 916);
|
||||
CHKSIZE(RadioData, 848);
|
||||
CHKSIZE(ModelData, 15607);
|
||||
#else
|
||||
CHKSIZE(RadioData, 916);
|
||||
CHKSIZE(RadioData, 848);
|
||||
CHKSIZE(ModelData, 15607);
|
||||
#endif
|
||||
#elif defined(PCBNV14)
|
||||
CHKSIZE(RadioData, 916);
|
||||
CHKSIZE(RadioData, 848);
|
||||
CHKSIZE(ModelData, 15463);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -830,16 +830,6 @@ PACK(struct TrainerData {
|
||||
BLUETOOTH_FIELDS
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD) && !defined(BACKUP)
|
||||
#include "theme.h"
|
||||
#define THEME_NAME_LEN 8
|
||||
#define THEME_DATA \
|
||||
NOBACKUP(char themeName[THEME_NAME_LEN]); \
|
||||
NOBACKUP(EdgeTxTheme::PersistentData themeData);
|
||||
#else
|
||||
#define THEME_DATA
|
||||
#endif
|
||||
|
||||
#if defined(BUZZER)
|
||||
#define BUZZER_FIELD int8_t buzzerMode:2 // -2=quiet, -1=only alarms, 0=no keys, 1=all (only used on AVR radios without audio hardware)
|
||||
#else
|
||||
@@ -934,8 +924,6 @@ PACK(struct RadioData {
|
||||
|
||||
EXTRA_GENERAL_FIELDS
|
||||
|
||||
THEME_DATA
|
||||
|
||||
char ownerRegistrationID[PXX2_LEN_REGISTRATION_ID];
|
||||
|
||||
CUST_ATTR(rotEncDirection, r_rotEncDirection, nullptr);
|
||||
@@ -992,5 +980,4 @@ PACK(struct RadioData {
|
||||
#undef SCRIPTS_DATA
|
||||
#undef CUSTOM_SCREENS_DATA
|
||||
#undef EXTRA_GENERAL_FIELDS
|
||||
#undef THEME_DATA
|
||||
#undef NOBACKUP
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "bitmaps.h"
|
||||
#include "strhelpers.h"
|
||||
#include "font.h"
|
||||
#include "theme.h"
|
||||
|
||||
const uint8_t _LBM_CURVE_POINT[] = {
|
||||
#include "mask_cvpoint.lbm"
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "lcd.h"
|
||||
#include "theme_manager.h"
|
||||
#include "libopenui.h"
|
||||
#include "theme.h"
|
||||
|
||||
#include "watchdog_driver.h"
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ void FabButton::paint(BitmapBuffer * dc)
|
||||
dc->drawBitmap((width() - bitmap->width()) / 2,
|
||||
(FAB_BUTTON_SIZE - bitmap->height()) / 2, bitmap);
|
||||
|
||||
const BitmapBuffer* mask = theme->getIconMask(icon);
|
||||
const BitmapBuffer* mask = EdgeTxTheme::instance()->getIconMask(icon);
|
||||
if (mask) {
|
||||
dc->drawMask((width() - mask->width()) / 2,
|
||||
(FAB_BUTTON_SIZE - mask->height()) / 2, mask, COLOR2FLAGS(WHITE));
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "mainwindow.h"
|
||||
#include "opentx.h"
|
||||
#include "libopenui.h"
|
||||
#include "theme.h"
|
||||
|
||||
#include "watchdog_driver.h"
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "popups.h"
|
||||
#include "draw_functions.h"
|
||||
#include "bitmaps.h"
|
||||
#include "theme.h"
|
||||
|
||||
#define LOAD_MODEL_BITMAP()
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "opentx.h"
|
||||
#include "view_main.h"
|
||||
#include "topbar_impl.h"
|
||||
#include "theme.h"
|
||||
|
||||
WidgetsContainer * customScreens[MAX_CUSTOM_SCREENS] = {};
|
||||
|
||||
|
||||
@@ -52,9 +52,6 @@ class LayoutFactory
|
||||
|
||||
virtual const uint8_t* getBitmap() const = 0;
|
||||
|
||||
virtual void drawThumb(BitmapBuffer* dc, uint16_t x, uint16_t y,
|
||||
LcdFlags flags) const = 0;
|
||||
|
||||
virtual const ZoneOption* getOptions() const = 0;
|
||||
|
||||
virtual WidgetsContainer* create(Window* parent,
|
||||
|
||||
@@ -206,11 +206,6 @@ class BaseLayoutFactory: public LayoutFactory
|
||||
|
||||
const uint8_t* getBitmap() const override { return bitmap; }
|
||||
|
||||
void drawThumb(BitmapBuffer * dc, uint16_t x, uint16_t y, uint32_t flags) const override
|
||||
{
|
||||
dc->drawBitmapPattern(x, y, bitmap, flags);
|
||||
}
|
||||
|
||||
const ZoneOption * getOptions() const override
|
||||
{
|
||||
return options;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "topbar_impl.h"
|
||||
#include "opentx.h"
|
||||
#include "theme.h"
|
||||
|
||||
constexpr uint32_t TOPBAR_REFRESH = 1000 / 10; // 10 Hz
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "mainwindow.h"
|
||||
#include "keyboard_base.h"
|
||||
#include "opentx.h"
|
||||
#include "theme.h"
|
||||
|
||||
PageHeader::PageHeader(Page * parent, uint8_t icon):
|
||||
FormWindow(parent, { 0, 0, LCD_W, MENU_HEADER_HEIGHT }, OPAQUE),
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "mainwindow.h"
|
||||
#include "view_main.h"
|
||||
#include "static.h"
|
||||
#include "theme.h"
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
#include "keyboard_base.h"
|
||||
|
||||
+174
-129
@@ -21,14 +21,8 @@
|
||||
|
||||
#include "opentx.h"
|
||||
#include "libopenui.h"
|
||||
|
||||
extern EdgeTxTheme * defaultTheme;
|
||||
const BitmapBuffer * EdgeTxTheme::error = nullptr;
|
||||
const BitmapBuffer * EdgeTxTheme::busy = nullptr;
|
||||
const BitmapBuffer * EdgeTxTheme::shutdown = nullptr;
|
||||
|
||||
constexpr coord_t LBM_USB_PLUGGED_W = 211;
|
||||
constexpr coord_t LBM_USB_PLUGGED_H = 110;
|
||||
#include "theme.h"
|
||||
#include "theme_manager.h"
|
||||
|
||||
const uint8_t _LBM_USB_PLUGGED[] = {
|
||||
#include "mask_usb_symbol.lbm"
|
||||
@@ -47,166 +41,217 @@ const uint8_t shutdown_bitmap[] = {
|
||||
#include "mask_shutdown.lbm"
|
||||
};
|
||||
|
||||
std::list<EdgeTxTheme *> & getRegisteredThemes()
|
||||
const uint8_t mask_topleft[] = {
|
||||
#include "mask_topleft.lbm"
|
||||
};
|
||||
|
||||
const uint8_t mask_currentmenu_bg[] = {
|
||||
#include "mask_currentmenu_bg.lbm"
|
||||
};
|
||||
|
||||
const uint8_t mask_currentmenu_dot[] = {
|
||||
#include "mask_currentmenu_dot.lbm"
|
||||
};
|
||||
|
||||
const uint8_t mask_currentmenu_shadow[] = {
|
||||
#include "mask_currentmenu_shadow.lbm"
|
||||
};
|
||||
|
||||
uint16_t EdgeTxTheme::defaultColors[LCD_COLOR_COUNT] = {
|
||||
RGB(18, 94, 153), // DEFAULT
|
||||
RGB(0, 0, 0), // PRIMARY1
|
||||
RGB(255, 255, 255), // PRIMARY2
|
||||
RGB(12, 63, 102), // PRIMARY3
|
||||
RGB(18, 94, 153), // SECONDARY1
|
||||
RGB(182, 224, 242), // SECONDARY2
|
||||
RGB(228, 238, 242), // SECONDARY3
|
||||
RGB(20, 161, 229), // FOCUS
|
||||
RGB(0, 153, 9), // EDIT
|
||||
RGB(255, 222, 0), // ACTIVE
|
||||
RGB(224, 0, 0), // WARNING
|
||||
RGB(140, 140, 140), // DISABLED
|
||||
RGB(170, 85, 0) // CUSTOM
|
||||
};
|
||||
|
||||
EdgeTxTheme::EdgeTxTheme(): name("EdgeTX")
|
||||
{
|
||||
static std::list<EdgeTxTheme *> themes;
|
||||
return themes;
|
||||
loadColors();
|
||||
}
|
||||
|
||||
void registerTheme(EdgeTxTheme * theme)
|
||||
void EdgeTxTheme::load()
|
||||
{
|
||||
TRACE("register theme %s", theme->getName());
|
||||
getRegisteredThemes().push_back(theme);
|
||||
}
|
||||
loadColors();
|
||||
ThemePersistance::instance()->loadDefaultTheme();
|
||||
|
||||
void EdgeTxTheme::init() const
|
||||
{
|
||||
memset(&g_eeGeneral.themeData, 0, sizeof(EdgeTxTheme::PersistentData));
|
||||
if (options) {
|
||||
int i = 0;
|
||||
for (const ZoneOption * option = options; option->name; option++, i++) {
|
||||
// TODO compiler bug? The CPU freezes ... g_eeGeneral.themeData.options[i] = &option->deflt;
|
||||
memcpy(&g_eeGeneral.themeData.options[i].value, &option->deflt, sizeof(ZoneOptionValue));
|
||||
g_eeGeneral.themeData.options[i].type = zoneValueEnumFromType(option->type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EdgeTxTheme::load() const
|
||||
{
|
||||
if (!error)
|
||||
error = BitmapBuffer::load8bitMaskLZ4(error_bitmap);
|
||||
if (!busy)
|
||||
busy = BitmapBuffer::load8bitMaskLZ4(busy_bitmap);
|
||||
if (!shutdown)
|
||||
shutdown = BitmapBuffer::load8bitMaskLZ4(shutdown_bitmap);
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
ZoneOptionValue * EdgeTxTheme::getOptionValue(unsigned int index) const
|
||||
void EdgeTxTheme::update()
|
||||
{
|
||||
return &g_eeGeneral.themeData.options[index].value;
|
||||
createIcons();
|
||||
loadIcons();
|
||||
if (!backgroundBitmap) {
|
||||
backgroundBitmap = BitmapBuffer::loadBitmap(getFilePath("background.png"));
|
||||
}
|
||||
initLvglTheme();
|
||||
}
|
||||
|
||||
void EdgeTxTheme::loadColors() const
|
||||
{
|
||||
TRACE("Load EdgeTX theme colors");
|
||||
memcpy(lcdColorTable, defaultColors, sizeof(defaultColors));
|
||||
}
|
||||
|
||||
void EdgeTxTheme::createIcons()
|
||||
{
|
||||
if (!iconsLoaded) {
|
||||
iconsLoaded = true;
|
||||
|
||||
iconMask = new BitmapBuffer*[MENUS_ICONS_COUNT];
|
||||
for (int id = ICON_EDGETX; id != MENUS_ICONS_COUNT; id++) {
|
||||
iconMask[id] = BitmapBuffer::load8bitMaskLZ4(getBuiltinIcon((MenuIcons)id));
|
||||
}
|
||||
|
||||
// Get mask with max size. Extract size from shadow LBM file.
|
||||
uint16_t* shadow = (uint16_t*)mask_currentmenu_shadow;
|
||||
currentMenuBackground = new BitmapBuffer(BMP_RGB565, shadow[0], shadow[1]);
|
||||
|
||||
topleftBitmap = BitmapBuffer::load8bitMaskLZ4(mask_topleft);
|
||||
|
||||
loadBuiltinBitmaps();
|
||||
}
|
||||
}
|
||||
|
||||
void EdgeTxTheme::loadIcons() const
|
||||
{
|
||||
if (currentMenuBackground) {
|
||||
currentMenuBackground->drawSolidFilledRect(
|
||||
0, 0, currentMenuBackground->width(), currentMenuBackground->height(),
|
||||
COLOR_THEME_SECONDARY1);
|
||||
|
||||
currentMenuBackground->drawSolidFilledRect(
|
||||
0, MENU_HEADER_HEIGHT, currentMenuBackground->width(),
|
||||
MENU_TITLE_TOP - MENU_HEADER_HEIGHT, COLOR_THEME_SECONDARY3);
|
||||
|
||||
std::unique_ptr<BitmapBuffer> background(BitmapBuffer::load8bitMaskLZ4(mask_currentmenu_bg));
|
||||
currentMenuBackground->drawMask(0, 0, background.get(), COLOR_THEME_FOCUS);
|
||||
|
||||
std::unique_ptr<BitmapBuffer> shadow(BitmapBuffer::load8bitMaskLZ4(mask_currentmenu_shadow));
|
||||
currentMenuBackground->drawMask(0, 0, shadow.get(), COLOR_THEME_PRIMARY1);
|
||||
|
||||
std::unique_ptr<BitmapBuffer> dot(BitmapBuffer::load8bitMaskLZ4(mask_currentmenu_dot));
|
||||
currentMenuBackground->drawMask(10, 39, dot.get(), COLOR_THEME_PRIMARY2);
|
||||
}
|
||||
}
|
||||
|
||||
void EdgeTxTheme::setBackgroundImageFileName(const char *fileName)
|
||||
{
|
||||
// ensure you delete old bitmap
|
||||
if (backgroundBitmap != nullptr)
|
||||
delete backgroundBitmap;
|
||||
|
||||
strncpy(backgroundImageFileName, fileName, FF_MAX_LFN);
|
||||
backgroundImageFileName[FF_MAX_LFN] = '\0'; // ensure string termination
|
||||
|
||||
// Try to load bitmap. If this fails backgroundBitmap will be NULL and default will be loaded in update() method
|
||||
backgroundBitmap = BitmapBuffer::loadBitmap(backgroundImageFileName);
|
||||
}
|
||||
|
||||
const char * EdgeTxTheme::getFilePath(const char * filename) const
|
||||
{
|
||||
static char path[FF_MAX_LFN+1] = THEMES_PATH "/";
|
||||
strcpy(path + sizeof(THEMES_PATH), getName());
|
||||
strcpy(path + sizeof(THEMES_PATH), name);
|
||||
int len = sizeof(THEMES_PATH) + strlen(path + sizeof(THEMES_PATH));
|
||||
path[len] = '/';
|
||||
strcpy(path+len+1, filename);
|
||||
return path;
|
||||
}
|
||||
|
||||
void EdgeTxTheme::drawThumb(BitmapBuffer * dc, coord_t x, coord_t y, uint32_t flags)
|
||||
const BitmapBuffer * EdgeTxTheme::getIconMask(uint8_t index) const
|
||||
{
|
||||
#define THUMB_WIDTH 51
|
||||
#define THUMB_HEIGHT 31
|
||||
if (!thumb) {
|
||||
thumb = BitmapBuffer::loadBitmap(getFilePath("thumb.bmp"));
|
||||
}
|
||||
lcd->drawBitmap(x, y, thumb);
|
||||
if (flags == COLOR_THEME_PRIMARY3) {
|
||||
dc->drawFilledRect(x, y, THUMB_WIDTH, THUMB_HEIGHT, SOLID, COLOR_THEME_PRIMARY1);
|
||||
}
|
||||
}
|
||||
|
||||
void EdgeTxTheme::drawBackground(BitmapBuffer * dc) const
|
||||
{
|
||||
dc->drawSolidFilledRect(0, 0, LCD_W, LCD_H, COLOR_THEME_SECONDARY3);
|
||||
}
|
||||
|
||||
//void EdgeTxTheme::drawMessageBox(const char *title, const char *text,
|
||||
// const char *action, uint32_t type) const
|
||||
//{
|
||||
// //if (flags & MESSAGEBOX_TYPE_ALERT) {
|
||||
// drawBackground();
|
||||
// lcdDrawFilledRect(0, POPUP_Y, LCD_W, POPUP_H, SOLID, COLOR_THEME_PRIMARY2 |
|
||||
// OPACITY(8));
|
||||
// //}
|
||||
//
|
||||
// if (type == WARNING_TYPE_ALERT || type == WARNING_TYPE_ASTERISK)
|
||||
// lcd->drawBitmap(POPUP_X-80, POPUP_Y+12, asterisk);
|
||||
// else if (type == WARNING_TYPE_INFO)
|
||||
// lcd->drawBitmap(POPUP_X-80, POPUP_Y+12, busy);
|
||||
// else
|
||||
// lcd->drawBitmap(POPUP_X-80, POPUP_Y+12, question);
|
||||
//
|
||||
// if (type == WARNING_TYPE_ALERT) {
|
||||
//#if defined(TRANSLATIONS_FR) || defined(TRANSLATIONS_IT) ||
|
||||
//defined(TRANSLATIONS_CZ)
|
||||
// lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, STR_WARNING,
|
||||
// COLOR_THEME_WARNING|FONT(XL)); lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+28,
|
||||
// title, COLOR_THEME_WARNING|FONT(XL));
|
||||
//#else
|
||||
// lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, title, COLOR_THEME_WARNING|FONT(XL));
|
||||
// lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+28, STR_WARNING,
|
||||
// COLOR_THEME_WARNING|FONT(XL));
|
||||
//#endif
|
||||
// }
|
||||
// else if (title) {
|
||||
// lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, title, COLOR_THEME_WARNING|FONT(XL));
|
||||
// }
|
||||
//
|
||||
// if (text) {
|
||||
// lcdDrawText(WARNING_LINE_X, WARNING_INFOLINE_Y, text);
|
||||
// }
|
||||
//
|
||||
// if (action) {
|
||||
// lcdDrawText(WARNING_LINE_X, WARNING_INFOLINE_Y+24, action);
|
||||
// }
|
||||
//}
|
||||
|
||||
void EdgeTxTheme::drawCheckBox(BitmapBuffer *dc, bool checked, coord_t x,
|
||||
coord_t y, bool focus) const
|
||||
{
|
||||
dc->drawSolidFilledRect(x, y, 16, 16, COLOR_THEME_PRIMARY2);
|
||||
if (focus) {
|
||||
dc->drawSolidRect(x, y, 16, 16, 2, COLOR_THEME_FOCUS);
|
||||
}
|
||||
else {
|
||||
dc->drawSolidRect(x, y, 16, 16, 1, COLOR_THEME_SECONDARY2);
|
||||
}
|
||||
if (checked) {
|
||||
dc->drawSolidFilledRect(x + 3, y + 3, 10, 10, COLOR_THEME_FOCUS);
|
||||
}
|
||||
return iconMask[index];
|
||||
}
|
||||
|
||||
void EdgeTxTheme::drawUsbPluggedScreen(BitmapBuffer * dc) const
|
||||
{
|
||||
// draw USB icon
|
||||
dc->clear(COLOR_THEME_SECONDARY3);
|
||||
dc->drawBitmapPattern((LCD_W - LBM_USB_PLUGGED_W) / 2,
|
||||
(LCD_H - LBM_USB_PLUGGED_H) / 2,
|
||||
uint16_t* usb_icon_hdr = (uint16_t*)_LBM_USB_PLUGGED;
|
||||
dc->drawBitmapPattern((LCD_W - usb_icon_hdr[0]) / 2,
|
||||
(LCD_H - usb_icon_hdr[1]) / 2,
|
||||
LBM_USB_PLUGGED, COLOR_THEME_SECONDARY1);
|
||||
}
|
||||
|
||||
|
||||
EdgeTxTheme * getTheme(const char * name)
|
||||
void EdgeTxTheme::drawBackground(BitmapBuffer * dc) const
|
||||
{
|
||||
std::list<EdgeTxTheme *>::const_iterator it = getRegisteredThemes().cbegin();
|
||||
for (; it != getRegisteredThemes().cend(); ++it) {
|
||||
if (!strcmp(name, (*it)->getName())) {
|
||||
return (*it);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
dc->clear(COLOR_THEME_SECONDARY3);
|
||||
if (backgroundBitmap)
|
||||
dc->drawBitmap(0, 0, backgroundBitmap);
|
||||
}
|
||||
|
||||
void loadTheme(EdgeTxTheme * newTheme)
|
||||
void EdgeTxTheme::drawHeaderIcon(BitmapBuffer * dc, uint8_t icon) const
|
||||
{
|
||||
TRACE("load theme %s", newTheme->getName());
|
||||
theme = newTheme;
|
||||
newTheme->load();
|
||||
}
|
||||
dc->drawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, COLOR_THEME_SECONDARY1);
|
||||
|
||||
void loadTheme()
|
||||
{
|
||||
char name[THEME_NAME_LEN + 1];
|
||||
memset(name, 0, sizeof(name));
|
||||
strncpy(name, g_eeGeneral.themeName, THEME_NAME_LEN);
|
||||
EdgeTxTheme * newTheme = getTheme(name);
|
||||
if (newTheme)
|
||||
loadTheme(newTheme);
|
||||
if (topleftBitmap)
|
||||
dc->drawMask(0, 0, topleftBitmap, COLOR_THEME_FOCUS);
|
||||
|
||||
if (icon == ICON_EDGETX)
|
||||
dc->drawMask(4, 10, iconMask[icon], COLOR_THEME_PRIMARY2);
|
||||
else
|
||||
loadTheme(defaultTheme);
|
||||
dc->drawMask(5, 7, iconMask[icon], COLOR_THEME_PRIMARY2);
|
||||
}
|
||||
|
||||
void EdgeTxTheme::drawPageHeaderBackground(BitmapBuffer *dc, uint8_t icon, const char *title) const
|
||||
{
|
||||
drawHeaderIcon(dc, icon);
|
||||
|
||||
dc->drawSolidFilledRect(0, MENU_HEADER_HEIGHT, LCD_W,
|
||||
MENU_TITLE_TOP - MENU_HEADER_HEIGHT,
|
||||
COLOR_THEME_SECONDARY3); // the white separation line
|
||||
|
||||
dc->drawSolidFilledRect(0, MENU_TITLE_TOP, LCD_W, MENU_TITLE_HEIGHT,
|
||||
COLOR_THEME_SECONDARY1); // the title line background
|
||||
if (title) {
|
||||
dc->drawText(MENUS_MARGIN_LEFT, MENU_TITLE_TOP + 1, title, COLOR_THEME_PRIMARY2);
|
||||
}
|
||||
|
||||
drawMenuDatetime(dc, DATETIME_MIDDLE, DATETIME_LINE1, COLOR_THEME_PRIMARY2);
|
||||
}
|
||||
|
||||
void EdgeTxTheme::drawMenuDatetime(BitmapBuffer * dc, coord_t x, coord_t y, LcdFlags color) const
|
||||
{
|
||||
const TimerOptions timerOptions = {.options = SHOW_TIME};
|
||||
struct gtm t;
|
||||
gettime(&t);
|
||||
char str[10];
|
||||
#if defined(TRANSLATIONS_CN) || defined(TRANSLATIONS_TW)
|
||||
sprintf(str, "%02d-%02d", t.tm_mon + 1, t.tm_mday);
|
||||
#else
|
||||
sprintf(str, "%d %s", t.tm_mday, STR_MONTHS[t.tm_mon]);
|
||||
#endif
|
||||
dc->drawText(x, y, str, FONT(XS)|color|CENTERED);
|
||||
getTimerString(str, getValue(MIXSRC_TX_TIME), timerOptions);
|
||||
dc->drawText(x, y + 15, str, FONT(XS)|color|CENTERED);
|
||||
}
|
||||
|
||||
void EdgeTxTheme::drawMenuIcon(BitmapBuffer *dc, uint8_t icon, bool checked) const
|
||||
{
|
||||
if (checked)
|
||||
dc->drawBitmap(0, 0, currentMenuBackground);
|
||||
dc->drawMask(2, 7, iconMask[icon], COLOR_THEME_PRIMARY2);
|
||||
}
|
||||
|
||||
EdgeTxTheme defaultTheme;
|
||||
|
||||
EdgeTxTheme * EdgeTxTheme::instance()
|
||||
{
|
||||
return &defaultTheme;
|
||||
}
|
||||
|
||||
@@ -19,17 +19,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _COLORLCD_THEME_H_
|
||||
#define _COLORLCD_THEME_H_
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include "zone.h"
|
||||
|
||||
enum IconState {
|
||||
STATE_DEFAULT,
|
||||
STATE_PRESSED,
|
||||
};
|
||||
#pragma once
|
||||
|
||||
// TODO: hotfix, through FatFS out of libopenui instead
|
||||
#if !defined(YAML_GENERATOR)
|
||||
@@ -39,104 +29,54 @@ enum IconState {
|
||||
#endif
|
||||
|
||||
class BitmapBuffer;
|
||||
class PageTab;
|
||||
|
||||
#define MAX_THEME_OPTIONS 5
|
||||
|
||||
class EdgeTxTheme;
|
||||
void registerTheme(EdgeTxTheme * theme);
|
||||
|
||||
// YAML_GENERATOR defs
|
||||
#if !defined(USE_IDX)
|
||||
#define USE_IDX
|
||||
#endif
|
||||
|
||||
class EdgeTxTheme;
|
||||
extern EdgeTxTheme * theme;
|
||||
|
||||
class EdgeTxTheme
|
||||
{
|
||||
public:
|
||||
struct PersistentData {
|
||||
ZoneOptionValueTyped options[MAX_THEME_OPTIONS] USE_IDX;
|
||||
};
|
||||
EdgeTxTheme();
|
||||
|
||||
explicit EdgeTxTheme(const char * name, const ZoneOption * options = nullptr):
|
||||
name(name),
|
||||
options(options),
|
||||
thumb(nullptr)
|
||||
{
|
||||
registerTheme(this);
|
||||
}
|
||||
|
||||
static EdgeTxTheme * instance()
|
||||
{
|
||||
return theme;
|
||||
}
|
||||
|
||||
inline const char * getName() const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
static EdgeTxTheme * instance();
|
||||
|
||||
const char * getFilePath(const char * filename) const;
|
||||
|
||||
void drawThumb(BitmapBuffer * dc, coord_t x, coord_t y, uint32_t flags);
|
||||
void createIcons();
|
||||
void loadColors() const;
|
||||
void loadIcons() const;
|
||||
virtual void load();
|
||||
void update();
|
||||
|
||||
inline const ZoneOption * getOptions() const
|
||||
{
|
||||
return options;
|
||||
}
|
||||
void setBackgroundImageFileName(const char *fileName);
|
||||
|
||||
void init() const;
|
||||
void drawBackground(BitmapBuffer * dc) const;
|
||||
|
||||
virtual void update(bool reload = true) const
|
||||
{
|
||||
}
|
||||
void drawPageHeaderBackground(BitmapBuffer *dc, uint8_t icon, const char *title) const;
|
||||
|
||||
ZoneOptionValue * getOptionValue(unsigned int index) const;
|
||||
void drawMenuIcon(BitmapBuffer *dc, uint8_t icon, bool checked) const;
|
||||
|
||||
virtual void setBackgroundImageFileName(const char *fileName)
|
||||
{
|
||||
strncpy(backgroundImageFileName, fileName, FF_MAX_LFN);
|
||||
backgroundImageFileName[FF_MAX_LFN] = '\0'; // ensure string termination
|
||||
}
|
||||
void drawMenuDatetime(BitmapBuffer * dc, coord_t x, coord_t y, LcdFlags color) const;
|
||||
|
||||
virtual void load() const;
|
||||
void drawHeaderIcon(BitmapBuffer * dc, uint8_t icon) const;
|
||||
|
||||
virtual void drawBackground(BitmapBuffer * dc) const;
|
||||
void drawUsbPluggedScreen(BitmapBuffer * dc) const;
|
||||
|
||||
virtual void drawPageHeaderBackground(BitmapBuffer *dc, uint8_t icon,
|
||||
const char *title) const = 0;
|
||||
const BitmapBuffer * getIconMask(uint8_t index) const;
|
||||
|
||||
virtual void drawMenuIcon(BitmapBuffer *dc, uint8_t icon, bool checked) const = 0;
|
||||
|
||||
virtual void drawCheckBox(BitmapBuffer * dc, bool checked, coord_t x, coord_t y, bool focus) const;
|
||||
|
||||
virtual void drawHeaderIcon(BitmapBuffer * dc, uint8_t icon) const = 0;
|
||||
|
||||
virtual void drawUsbPluggedScreen(BitmapBuffer * dc) const;
|
||||
|
||||
virtual const BitmapBuffer * getIconMask(uint8_t index) const = 0;
|
||||
|
||||
virtual uint16_t* getDefaultColors() const = 0;
|
||||
uint16_t* getDefaultColors() const { return defaultColors; }
|
||||
|
||||
protected:
|
||||
bool iconsLoaded = false;
|
||||
const char * name;
|
||||
const ZoneOption * options;
|
||||
BitmapBuffer * thumb;
|
||||
char backgroundImageFileName[FF_MAX_LFN + 1];
|
||||
|
||||
const BitmapBuffer * backgroundBitmap = nullptr;
|
||||
const BitmapBuffer * topleftBitmap = nullptr;
|
||||
BitmapBuffer * currentMenuBackground = nullptr;
|
||||
BitmapBuffer ** iconMask = nullptr;
|
||||
|
||||
static uint16_t defaultColors[LCD_COLOR_COUNT];
|
||||
|
||||
public:
|
||||
static const BitmapBuffer * error;
|
||||
static const BitmapBuffer * busy;
|
||||
static const BitmapBuffer * shutdown;
|
||||
const BitmapBuffer * error = nullptr;
|
||||
const BitmapBuffer * busy = nullptr;
|
||||
const BitmapBuffer * shutdown = nullptr;
|
||||
};
|
||||
|
||||
EdgeTxTheme * getTheme(const char * name);
|
||||
void loadTheme(EdgeTxTheme * theme);
|
||||
void loadTheme();
|
||||
|
||||
std::list<EdgeTxTheme *> & getRegisteredThemes();
|
||||
|
||||
#endif // _COLORLCD_THEME_H_
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
#include "theme_manager.h"
|
||||
#include "view_main.h"
|
||||
#include "theme.h"
|
||||
|
||||
#include "../../storage/yaml/yaml_tree_walker.h"
|
||||
#include "../../storage/yaml/yaml_bits.h"
|
||||
@@ -245,26 +246,20 @@ void ThemeFile::applyBackground()
|
||||
|
||||
if (isFileAvailable(rootDir.c_str())) {
|
||||
instance->setBackgroundImageFileName((char *)rootDir.c_str());
|
||||
} else {
|
||||
// TODO: This needs to be made user configurable, not
|
||||
// require the file be deleted to remove global background
|
||||
std::string fileName = THEMES_PATH PATH_SEPARATOR "EdgeTX/background.png";
|
||||
if (isFileAvailable(fileName.c_str())) {
|
||||
instance->setBackgroundImageFileName(fileName.c_str());
|
||||
} else {
|
||||
instance->setBackgroundImageFileName("");
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
instance->setBackgroundImageFileName("");
|
||||
}
|
||||
|
||||
// Use EdgeTxTheme default background
|
||||
// TODO: This needs to be made user configurable
|
||||
instance->setBackgroundImageFileName("");
|
||||
}
|
||||
|
||||
void ThemeFile::applyTheme()
|
||||
{
|
||||
applyColors();
|
||||
applyBackground();
|
||||
EdgeTxTheme::instance()->update(false);
|
||||
EdgeTxTheme::instance()->update();
|
||||
|
||||
// Update views with new theme
|
||||
// Currently, on startup, active theme is loaded after ViewMain is created so ViewMain instance is defined
|
||||
@@ -467,8 +462,7 @@ class DefaultEdgeTxTheme : public ThemeFile
|
||||
setInfo("Default EdgeTX Color Scheme");
|
||||
|
||||
// initializze the default color table
|
||||
extern EdgeTxTheme * defaultTheme;
|
||||
uint16_t* defaultColors = defaultTheme->getDefaultColors();
|
||||
uint16_t* defaultColors = EdgeTxTheme::instance()->getDefaultColors();
|
||||
for (uint8_t i = COLOR_THEME_PRIMARY1_INDEX; i <= COLOR_THEME_DISABLED_INDEX; i += 1)
|
||||
colorList.emplace_back(ColorEntry { (LcdColorIndex)i, defaultColors[i] });
|
||||
}
|
||||
|
||||
@@ -1,239 +0,0 @@
|
||||
/*
|
||||
* 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 "opentx.h"
|
||||
#include "tabsgroup.h"
|
||||
#include "bitmaps.h"
|
||||
#include "theme_manager.h"
|
||||
|
||||
#include <memory>
|
||||
using std::unique_ptr;
|
||||
|
||||
const ZoneOption OPTIONS_THEME_DEFAULT[] = {
|
||||
{ STR_BACKGROUND_COLOR, ZoneOption::Color, OPTION_VALUE_UNSIGNED(COLOR_THEME_PRIMARY2 >> 16) },
|
||||
{ STR_MAIN_COLOR, ZoneOption::Color, OPTION_VALUE_UNSIGNED(COLOR_THEME_WARNING >> 16) },
|
||||
{ nullptr, ZoneOption::Bool }
|
||||
};
|
||||
|
||||
const uint8_t mask_topleft[] = {
|
||||
#include "mask_topleft.lbm"
|
||||
};
|
||||
const uint8_t mask_currentmenu_bg[] = {
|
||||
#include "mask_currentmenu_bg.lbm"
|
||||
};
|
||||
const uint8_t mask_currentmenu_dot[] = {
|
||||
#include "mask_currentmenu_dot.lbm"
|
||||
};
|
||||
const uint8_t mask_currentmenu_shadow[] = {
|
||||
#include "mask_currentmenu_shadow.lbm"
|
||||
};
|
||||
|
||||
class Theme480: public EdgeTxTheme
|
||||
{
|
||||
public:
|
||||
Theme480():
|
||||
EdgeTxTheme("EdgeTX", OPTIONS_THEME_DEFAULT)
|
||||
{
|
||||
loadColors();
|
||||
}
|
||||
|
||||
void loadColors() const
|
||||
{
|
||||
TRACE("Load EdgeTX theme colors");
|
||||
memcpy(lcdColorTable, defaultColors, sizeof(defaultColors));
|
||||
}
|
||||
|
||||
void createIcons() const
|
||||
{
|
||||
if (iconsLoaded)
|
||||
return;
|
||||
|
||||
iconsLoaded = true;
|
||||
|
||||
for (int id = ICON_EDGETX; id != MENUS_ICONS_COUNT; id++) {
|
||||
iconMask[id] = BitmapBuffer::load8bitMaskLZ4(getBuiltinIcon((MenuIcons)id));
|
||||
}
|
||||
|
||||
// Get mask with max size
|
||||
unique_ptr<BitmapBuffer> shadow(BitmapBuffer::load8bitMaskLZ4(mask_currentmenu_shadow));
|
||||
currentMenuBackground = new BitmapBuffer(BMP_RGB565, shadow->width(), shadow->height());
|
||||
|
||||
topleftBitmap = BitmapBuffer::load8bitMaskLZ4(mask_topleft);
|
||||
|
||||
loadBuiltinBitmaps();
|
||||
}
|
||||
|
||||
void loadIcons() const
|
||||
{
|
||||
if (currentMenuBackground) {
|
||||
currentMenuBackground->drawSolidFilledRect(
|
||||
0, 0, currentMenuBackground->width(), currentMenuBackground->height(),
|
||||
COLOR_THEME_SECONDARY1);
|
||||
|
||||
currentMenuBackground->drawSolidFilledRect(
|
||||
0, MENU_HEADER_HEIGHT, currentMenuBackground->width(),
|
||||
MENU_TITLE_TOP - MENU_HEADER_HEIGHT, COLOR_THEME_SECONDARY3);
|
||||
|
||||
unique_ptr<BitmapBuffer> background(BitmapBuffer::load8bitMaskLZ4(mask_currentmenu_bg));
|
||||
currentMenuBackground->drawMask(0, 0, background.get(), COLOR_THEME_FOCUS);
|
||||
|
||||
unique_ptr<BitmapBuffer> shadow(BitmapBuffer::load8bitMaskLZ4(mask_currentmenu_shadow));
|
||||
currentMenuBackground->drawMask(0, 0, shadow.get(), COLOR_THEME_PRIMARY1);
|
||||
|
||||
unique_ptr<BitmapBuffer> dot(BitmapBuffer::load8bitMaskLZ4(mask_currentmenu_dot));
|
||||
currentMenuBackground->drawMask(10, 39, dot.get(), COLOR_THEME_PRIMARY2);
|
||||
}
|
||||
}
|
||||
|
||||
void setBackgroundImageFileName(const char *fileName) override
|
||||
{
|
||||
// ensure you delete old bitmap
|
||||
if (backgroundBitmap != nullptr)
|
||||
delete backgroundBitmap;
|
||||
EdgeTxTheme::setBackgroundImageFileName(fileName); // set the filename
|
||||
backgroundBitmap = BitmapBuffer::loadBitmap(backgroundImageFileName);
|
||||
}
|
||||
|
||||
void load() const override
|
||||
{
|
||||
loadColors();
|
||||
ThemePersistance::instance()->loadDefaultTheme();
|
||||
EdgeTxTheme::load();
|
||||
if (!backgroundBitmap) {
|
||||
backgroundBitmap = BitmapBuffer::loadBitmap(getFilePath("background.png"));
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
void update(bool reload = true) const override
|
||||
{
|
||||
createIcons();
|
||||
loadIcons();
|
||||
initLvglTheme();
|
||||
}
|
||||
|
||||
void drawBackground(BitmapBuffer * dc) const override
|
||||
{
|
||||
dc->clear(COLOR_THEME_SECONDARY3);
|
||||
if (backgroundBitmap)
|
||||
dc->drawBitmap(0, 0, backgroundBitmap);
|
||||
}
|
||||
|
||||
void drawHeaderIcon(BitmapBuffer * dc, uint8_t icon) const override
|
||||
{
|
||||
dc->drawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, COLOR_THEME_SECONDARY1);
|
||||
|
||||
if (topleftBitmap)
|
||||
dc->drawMask(0, 0, topleftBitmap, COLOR_THEME_FOCUS);
|
||||
|
||||
if (icon == ICON_EDGETX)
|
||||
dc->drawMask(4, 10, iconMask[icon], COLOR_THEME_PRIMARY2);
|
||||
else
|
||||
dc->drawMask(5, 7, iconMask[icon], COLOR_THEME_PRIMARY2);
|
||||
}
|
||||
|
||||
void drawPageHeaderBackground(BitmapBuffer *dc, uint8_t icon,
|
||||
const char *title) const override
|
||||
{
|
||||
drawHeaderIcon(dc, icon);
|
||||
|
||||
dc->drawSolidFilledRect(0, MENU_HEADER_HEIGHT, LCD_W,
|
||||
MENU_TITLE_TOP - MENU_HEADER_HEIGHT,
|
||||
COLOR_THEME_SECONDARY3); // the white separation line
|
||||
|
||||
dc->drawSolidFilledRect(0, MENU_TITLE_TOP, LCD_W, MENU_TITLE_HEIGHT,
|
||||
COLOR_THEME_SECONDARY1); // the title line background
|
||||
if (title) {
|
||||
dc->drawText(MENUS_MARGIN_LEFT, MENU_TITLE_TOP + 1, title, COLOR_THEME_PRIMARY2);
|
||||
}
|
||||
|
||||
drawMenuDatetime(dc);
|
||||
}
|
||||
|
||||
const BitmapBuffer * getIconMask(uint8_t index) const override
|
||||
{
|
||||
return iconMask[index];
|
||||
}
|
||||
|
||||
void drawMenuIcon(BitmapBuffer *dc, uint8_t icon, bool checked) const override
|
||||
{
|
||||
if (checked)
|
||||
dc->drawBitmap(0, 0, currentMenuBackground);
|
||||
dc->drawMask(2, 7, iconMask[icon], COLOR_THEME_PRIMARY2);
|
||||
}
|
||||
|
||||
void drawMenuDatetime(BitmapBuffer * dc) const
|
||||
{
|
||||
//dc->drawSolidVerticalLine(DATETIME_SEPARATOR_X, 7, 31, COLOR_THEME_PRIMARY2);
|
||||
const TimerOptions timerOptions = {.options = SHOW_TIME};
|
||||
struct gtm t;
|
||||
gettime(&t);
|
||||
char str[10];
|
||||
#if defined(TRANSLATIONS_CN) || defined(TRANSLATIONS_TW)
|
||||
sprintf(str, "%02d-%02d", t.tm_mon + 1, t.tm_mday);
|
||||
#else
|
||||
sprintf(str, "%d %s", t.tm_mday, STR_MONTHS[t.tm_mon]);
|
||||
#endif
|
||||
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE1, str, FONT(XS)|COLOR_THEME_PRIMARY2|CENTERED);
|
||||
getTimerString(str, getValue(MIXSRC_TX_TIME), timerOptions);
|
||||
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE2, str, FONT(XS)|COLOR_THEME_PRIMARY2|CENTERED);
|
||||
}
|
||||
|
||||
uint16_t* getDefaultColors() const override { return defaultColors; }
|
||||
|
||||
protected:
|
||||
static bool iconsLoaded;
|
||||
static const BitmapBuffer * backgroundBitmap;
|
||||
static BitmapBuffer * topleftBitmap;
|
||||
static BitmapBuffer * iconMask[MENUS_ICONS_COUNT];
|
||||
static BitmapBuffer * currentMenuBackground;
|
||||
static uint16_t defaultColors[LCD_COLOR_COUNT];
|
||||
};
|
||||
|
||||
bool Theme480::iconsLoaded = false;
|
||||
|
||||
const BitmapBuffer * Theme480::backgroundBitmap = nullptr;
|
||||
BitmapBuffer * Theme480::topleftBitmap = nullptr;
|
||||
BitmapBuffer * Theme480::iconMask[MENUS_ICONS_COUNT] = { nullptr };
|
||||
BitmapBuffer * Theme480::currentMenuBackground = nullptr;
|
||||
|
||||
uint16_t Theme480::defaultColors[LCD_COLOR_COUNT] = {
|
||||
RGB(18, 94, 153), // DEFAULT
|
||||
RGB(0, 0, 0), // PRIMARY1
|
||||
RGB(255, 255, 255), // PRIMARY2
|
||||
RGB(12, 63, 102), // PRIMARY3
|
||||
RGB(18, 94, 153), // SECONDARY1
|
||||
RGB(182, 224, 242), // SECONDARY2
|
||||
RGB(228, 238, 242), // SECONDARY3
|
||||
RGB(20, 161, 229), // FOCUS
|
||||
RGB(0, 153, 9), // EDIT
|
||||
RGB(255, 222, 0), // ACTIVE
|
||||
RGB(224, 0, 0), // WARNING
|
||||
RGB(140, 140, 140), // DISABLED
|
||||
RGB(170, 85, 0) // CUSTOM
|
||||
};
|
||||
|
||||
Theme480 theme480;
|
||||
|
||||
#if LCD_W == 480 || LCD_H == 480
|
||||
EdgeTxTheme * defaultTheme = &theme480;
|
||||
EdgeTxTheme * theme = &theme480;
|
||||
#endif
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "menu_screen.h"
|
||||
#include "topbar_impl.h"
|
||||
#include "view_main_menu.h"
|
||||
#include "theme.h"
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "widget_settings.h"
|
||||
#include "view_main.h"
|
||||
#include "lcd.h"
|
||||
#include "theme.h"
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
#include "touch.h"
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "opentx.h"
|
||||
#include "widgets_container_impl.h"
|
||||
#include "theme.h"
|
||||
|
||||
#define W_AUDIO_X 0
|
||||
#define W_USB_X 32
|
||||
@@ -192,19 +193,7 @@ class DateTimeWidget: public Widget
|
||||
{
|
||||
// get color from options
|
||||
LcdFlags color = COLOR2FLAGS(persistentData->options[0].value.unsignedValue);
|
||||
|
||||
const TimerOptions timerOptions = {.options = SHOW_TIME};
|
||||
struct gtm t;
|
||||
gettime(&t);
|
||||
char str[10];
|
||||
#if defined(TRANSLATIONS_CN) || defined(TRANSLATIONS_TW)
|
||||
sprintf(str, "%02d-%02d", t.tm_mon + 1, t.tm_mday);
|
||||
#else
|
||||
sprintf(str, "%d %s", t.tm_mday, STR_MONTHS[t.tm_mon]);
|
||||
#endif
|
||||
dc->drawText(width()/2+DT_OFFSET, 3, str, FONT(XS) | CENTERED | color);
|
||||
getTimerString(str, getValue(MIXSRC_TX_TIME), timerOptions);
|
||||
dc->drawText(width()/2+DT_OFFSET, 18, str, FONT(XS) | CENTERED | color);
|
||||
EdgeTxTheme::instance()->drawMenuDatetime(dc, width()/2+DT_OFFSET, 3, color);
|
||||
}
|
||||
|
||||
void checkEvents() override
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "opentx.h"
|
||||
#include "libopenui.h"
|
||||
#include "widget.h"
|
||||
#include "theme.h"
|
||||
|
||||
#include "lua_api.h"
|
||||
#include "api_colorlcd.h"
|
||||
@@ -971,7 +972,7 @@ static int luaLcdSetColor(lua_State *L)
|
||||
if (index < LCD_COLOR_COUNT && lcdColorTable[index] != color) {
|
||||
lcdColorTable[index] = color;
|
||||
if (index != CUSTOM_COLOR_INDEX)
|
||||
EdgeTxTheme::instance()->update(false);
|
||||
EdgeTxTheme::instance()->update();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "libopenui.h"
|
||||
#include "gui/colorlcd/LvglWrapper.h"
|
||||
#include "gui/colorlcd/view_main.h"
|
||||
#include "theme.h"
|
||||
#endif
|
||||
|
||||
#if defined(CLI)
|
||||
|
||||
@@ -118,7 +118,6 @@
|
||||
|
||||
#if defined(COLORLCD) && !defined(BOOT)
|
||||
#include "layout.h"
|
||||
#include "theme.h"
|
||||
#include "topbar.h"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "radio_calibration.h"
|
||||
#include "view_main.h"
|
||||
#include "view_text.h"
|
||||
#include "theme.h"
|
||||
|
||||
#include "gui/colorlcd/LvglWrapper.h"
|
||||
#endif
|
||||
@@ -322,11 +323,6 @@ void generalDefault()
|
||||
strcpy(g_eeGeneral.currModelFilename, DEFAULT_MODEL_FILENAME);
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
strcpy(g_eeGeneral.themeName, static_cast<EdgeTxTheme *>(theme)->getName());
|
||||
static_cast<EdgeTxTheme *>(theme)->init();
|
||||
#endif
|
||||
|
||||
#if defined(PXX2)
|
||||
setDefaultOwnerId();
|
||||
#endif
|
||||
@@ -1171,7 +1167,7 @@ void opentxResume()
|
||||
#if defined(COLORLCD)
|
||||
//TODO: needs to go into storageReadAll()
|
||||
TRACE("reloading theme");
|
||||
loadTheme();
|
||||
EdgeTxTheme::instance()->load();
|
||||
|
||||
// Force redraw
|
||||
ViewMain::instance()->invalidate();
|
||||
@@ -1534,7 +1530,7 @@ void opentxInit()
|
||||
BACKLIGHT_ENABLE();
|
||||
|
||||
#if defined(COLORLCD)
|
||||
loadTheme();
|
||||
EdgeTxTheme::instance()->load();
|
||||
if (g_eeGeneral.backlightMode == e_backlight_mode_off) {
|
||||
// no backlight mode off on color lcd radios
|
||||
g_eeGeneral.backlightMode = e_backlight_mode_keys;
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
#include "modelslist.h"
|
||||
#include "model_init.h"
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#include "theme.h"
|
||||
#endif
|
||||
|
||||
void getModelPath(char * path, const char * filename, const char* pathName)
|
||||
{
|
||||
unsigned int len = strlen(pathName);
|
||||
@@ -39,7 +43,7 @@ void storageEraseAll(bool warn)
|
||||
|
||||
#if defined(COLORLCD)
|
||||
// the theme has not been loaded before
|
||||
static_cast<EdgeTxTheme*>(theme)->load();
|
||||
EdgeTxTheme::instance()->load();
|
||||
#endif
|
||||
|
||||
// Init backlight mode before entering alert screens
|
||||
|
||||
@@ -87,15 +87,6 @@ const struct YamlIdStr enum_Functions[] = {
|
||||
{ FUNC_DISABLE_AUDIO_AMP, "DISABLE_AUDIO_AMP" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
const struct YamlIdStr enum_ZoneOptionValueEnum[] = {
|
||||
{ ZOV_Unsigned, "Unsigned" },
|
||||
{ ZOV_Signed, "Signed" },
|
||||
{ ZOV_Bool, "Bool" },
|
||||
{ ZOV_String, "String" },
|
||||
{ ZOV_Source, "Source" },
|
||||
{ ZOV_Color, "Color" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
const struct YamlIdStr enum_TimerModes[] = {
|
||||
{ TMRMODE_OFF, "OFF" },
|
||||
{ TMRMODE_ON, "ON" },
|
||||
@@ -203,6 +194,15 @@ const struct YamlIdStr enum_TelemetrySensorType[] = {
|
||||
{ TELEM_TYPE_CALCULATED, "TYPE_CALCULATED" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
const struct YamlIdStr enum_ZoneOptionValueEnum[] = {
|
||||
{ ZOV_Unsigned, "Unsigned" },
|
||||
{ ZOV_Signed, "Signed" },
|
||||
{ ZOV_Bool, "Bool" },
|
||||
{ ZOV_String, "String" },
|
||||
{ ZOV_Source, "Source" },
|
||||
{ ZOV_Color, "Color" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
const struct YamlIdStr enum_USBJoystickIfMode[] = {
|
||||
{ USBJOYS_JOYSTICK, "JOYSTICK" },
|
||||
{ USBJOYS_GAMEPAD, "GAMEPAD" },
|
||||
@@ -276,25 +276,6 @@ static const struct YamlNode struct_CustomFunctionData[] = {
|
||||
YAML_PADDING( 8 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ZoneOptionValue_elmts[] = {
|
||||
YAML_UNSIGNED( "unsignedValue", 32 ),
|
||||
YAML_SIGNED( "signedValue", 32 ),
|
||||
YAML_UNSIGNED( "boolValue", 32 ),
|
||||
YAML_STRING("stringValue", 8),
|
||||
YAML_CUSTOM("source",r_zov_source,w_zov_source),
|
||||
YAML_CUSTOM("color",r_zov_color,w_zov_color),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_ZoneOptionValueTyped[] = {
|
||||
YAML_IDX,
|
||||
YAML_ENUM("type", 32, enum_ZoneOptionValueEnum),
|
||||
YAML_UNION("value", 64, union_ZoneOptionValue_elmts, select_zov),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_EdgeTxTheme__PersistentData[] = {
|
||||
YAML_ARRAY("options", 96, 5, struct_ZoneOptionValueTyped, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||
@@ -376,8 +357,6 @@ static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_UNSIGNED( "modelQuickSelect", 1 ),
|
||||
YAML_UNSIGNED( "blOffBright", 7 ),
|
||||
YAML_STRING("bluetoothName", 10),
|
||||
YAML_STRING("themeName", 8),
|
||||
YAML_STRUCT("themeData", 480, struct_EdgeTxTheme__PersistentData, NULL),
|
||||
YAML_STRING("ownerRegistrationID", 8),
|
||||
YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr),
|
||||
YAML_UNSIGNED( "rotEncMode", 2 ),
|
||||
@@ -767,6 +746,21 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
YAML_UNION("cfg", 32, union_anonymous_17_elmts, select_sensor_cfg),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ZoneOptionValue_elmts[] = {
|
||||
YAML_UNSIGNED( "unsignedValue", 32 ),
|
||||
YAML_SIGNED( "signedValue", 32 ),
|
||||
YAML_UNSIGNED( "boolValue", 32 ),
|
||||
YAML_STRING("stringValue", 8),
|
||||
YAML_CUSTOM("source",r_zov_source,w_zov_source),
|
||||
YAML_CUSTOM("color",r_zov_color,w_zov_color),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_ZoneOptionValueTyped[] = {
|
||||
YAML_IDX,
|
||||
YAML_ENUM("type", 32, enum_ZoneOptionValueEnum),
|
||||
YAML_UNION("value", 64, union_ZoneOptionValue_elmts, select_zov),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_WidgetPersistentData[] = {
|
||||
YAML_ARRAY("options", 96, 5, struct_ZoneOptionValueTyped, NULL),
|
||||
YAML_END
|
||||
|
||||
@@ -87,15 +87,6 @@ const struct YamlIdStr enum_Functions[] = {
|
||||
{ FUNC_SET_SCREEN, "SET_SCREEN" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
const struct YamlIdStr enum_ZoneOptionValueEnum[] = {
|
||||
{ ZOV_Unsigned, "Unsigned" },
|
||||
{ ZOV_Signed, "Signed" },
|
||||
{ ZOV_Bool, "Bool" },
|
||||
{ ZOV_String, "String" },
|
||||
{ ZOV_Source, "Source" },
|
||||
{ ZOV_Color, "Color" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
const struct YamlIdStr enum_TimerModes[] = {
|
||||
{ TMRMODE_OFF, "OFF" },
|
||||
{ TMRMODE_ON, "ON" },
|
||||
@@ -210,6 +201,15 @@ const struct YamlIdStr enum_TelemetrySensorType[] = {
|
||||
{ TELEM_TYPE_CALCULATED, "TYPE_CALCULATED" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
const struct YamlIdStr enum_ZoneOptionValueEnum[] = {
|
||||
{ ZOV_Unsigned, "Unsigned" },
|
||||
{ ZOV_Signed, "Signed" },
|
||||
{ ZOV_Bool, "Bool" },
|
||||
{ ZOV_String, "String" },
|
||||
{ ZOV_Source, "Source" },
|
||||
{ ZOV_Color, "Color" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
const struct YamlIdStr enum_USBJoystickIfMode[] = {
|
||||
{ USBJOYS_JOYSTICK, "JOYSTICK" },
|
||||
{ USBJOYS_GAMEPAD, "GAMEPAD" },
|
||||
@@ -283,25 +283,6 @@ static const struct YamlNode struct_CustomFunctionData[] = {
|
||||
YAML_PADDING( 8 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ZoneOptionValue_elmts[] = {
|
||||
YAML_UNSIGNED( "unsignedValue", 32 ),
|
||||
YAML_SIGNED( "signedValue", 32 ),
|
||||
YAML_UNSIGNED( "boolValue", 32 ),
|
||||
YAML_STRING("stringValue", 8),
|
||||
YAML_CUSTOM("source",r_zov_source,w_zov_source),
|
||||
YAML_CUSTOM("color",r_zov_color,w_zov_color),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_ZoneOptionValueTyped[] = {
|
||||
YAML_IDX,
|
||||
YAML_ENUM("type", 32, enum_ZoneOptionValueEnum),
|
||||
YAML_UNION("value", 64, union_ZoneOptionValue_elmts, select_zov),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_EdgeTxTheme__PersistentData[] = {
|
||||
YAML_ARRAY("options", 96, 5, struct_ZoneOptionValueTyped, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||
@@ -381,8 +362,6 @@ static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_UNSIGNED( "modelQuickSelect", 1 ),
|
||||
YAML_UNSIGNED( "blOffBright", 7 ),
|
||||
YAML_STRING("bluetoothName", 10),
|
||||
YAML_STRING("themeName", 8),
|
||||
YAML_STRUCT("themeData", 480, struct_EdgeTxTheme__PersistentData, NULL),
|
||||
YAML_STRING("ownerRegistrationID", 8),
|
||||
YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr),
|
||||
YAML_UNSIGNED( "rotEncMode", 2 ),
|
||||
@@ -774,6 +753,21 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
YAML_UNION("cfg", 32, union_anonymous_17_elmts, select_sensor_cfg),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ZoneOptionValue_elmts[] = {
|
||||
YAML_UNSIGNED( "unsignedValue", 32 ),
|
||||
YAML_SIGNED( "signedValue", 32 ),
|
||||
YAML_UNSIGNED( "boolValue", 32 ),
|
||||
YAML_STRING("stringValue", 8),
|
||||
YAML_CUSTOM("source",r_zov_source,w_zov_source),
|
||||
YAML_CUSTOM("color",r_zov_color,w_zov_color),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_ZoneOptionValueTyped[] = {
|
||||
YAML_IDX,
|
||||
YAML_ENUM("type", 32, enum_ZoneOptionValueEnum),
|
||||
YAML_UNION("value", 64, union_ZoneOptionValue_elmts, select_zov),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_WidgetPersistentData[] = {
|
||||
YAML_ARRAY("options", 96, 5, struct_ZoneOptionValueTyped, NULL),
|
||||
YAML_END
|
||||
|
||||
@@ -87,15 +87,6 @@ const struct YamlIdStr enum_Functions[] = {
|
||||
{ FUNC_SET_SCREEN, "SET_SCREEN" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
const struct YamlIdStr enum_ZoneOptionValueEnum[] = {
|
||||
{ ZOV_Unsigned, "Unsigned" },
|
||||
{ ZOV_Signed, "Signed" },
|
||||
{ ZOV_Bool, "Bool" },
|
||||
{ ZOV_String, "String" },
|
||||
{ ZOV_Source, "Source" },
|
||||
{ ZOV_Color, "Color" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
const struct YamlIdStr enum_TimerModes[] = {
|
||||
{ TMRMODE_OFF, "OFF" },
|
||||
{ TMRMODE_ON, "ON" },
|
||||
@@ -210,6 +201,15 @@ const struct YamlIdStr enum_TelemetrySensorType[] = {
|
||||
{ TELEM_TYPE_CALCULATED, "TYPE_CALCULATED" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
const struct YamlIdStr enum_ZoneOptionValueEnum[] = {
|
||||
{ ZOV_Unsigned, "Unsigned" },
|
||||
{ ZOV_Signed, "Signed" },
|
||||
{ ZOV_Bool, "Bool" },
|
||||
{ ZOV_String, "String" },
|
||||
{ ZOV_Source, "Source" },
|
||||
{ ZOV_Color, "Color" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
const struct YamlIdStr enum_USBJoystickIfMode[] = {
|
||||
{ USBJOYS_JOYSTICK, "JOYSTICK" },
|
||||
{ USBJOYS_GAMEPAD, "GAMEPAD" },
|
||||
@@ -283,25 +283,6 @@ static const struct YamlNode struct_CustomFunctionData[] = {
|
||||
YAML_PADDING( 8 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ZoneOptionValue_elmts[] = {
|
||||
YAML_UNSIGNED( "unsignedValue", 32 ),
|
||||
YAML_SIGNED( "signedValue", 32 ),
|
||||
YAML_UNSIGNED( "boolValue", 32 ),
|
||||
YAML_STRING("stringValue", 8),
|
||||
YAML_CUSTOM("source",r_zov_source,w_zov_source),
|
||||
YAML_CUSTOM("color",r_zov_color,w_zov_color),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_ZoneOptionValueTyped[] = {
|
||||
YAML_IDX,
|
||||
YAML_ENUM("type", 32, enum_ZoneOptionValueEnum),
|
||||
YAML_UNION("value", 64, union_ZoneOptionValue_elmts, select_zov),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_EdgeTxTheme__PersistentData[] = {
|
||||
YAML_ARRAY("options", 96, 5, struct_ZoneOptionValueTyped, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||
@@ -381,8 +362,6 @@ static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_UNSIGNED( "modelQuickSelect", 1 ),
|
||||
YAML_UNSIGNED( "blOffBright", 7 ),
|
||||
YAML_STRING("bluetoothName", 10),
|
||||
YAML_STRING("themeName", 8),
|
||||
YAML_STRUCT("themeData", 480, struct_EdgeTxTheme__PersistentData, NULL),
|
||||
YAML_STRING("ownerRegistrationID", 8),
|
||||
YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr),
|
||||
YAML_UNSIGNED( "rotEncMode", 2 ),
|
||||
@@ -774,6 +753,21 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
YAML_UNION("cfg", 32, union_anonymous_17_elmts, select_sensor_cfg),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ZoneOptionValue_elmts[] = {
|
||||
YAML_UNSIGNED( "unsignedValue", 32 ),
|
||||
YAML_SIGNED( "signedValue", 32 ),
|
||||
YAML_UNSIGNED( "boolValue", 32 ),
|
||||
YAML_STRING("stringValue", 8),
|
||||
YAML_CUSTOM("source",r_zov_source,w_zov_source),
|
||||
YAML_CUSTOM("color",r_zov_color,w_zov_color),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_ZoneOptionValueTyped[] = {
|
||||
YAML_IDX,
|
||||
YAML_ENUM("type", 32, enum_ZoneOptionValueEnum),
|
||||
YAML_UNION("value", 64, union_ZoneOptionValue_elmts, select_zov),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_WidgetPersistentData[] = {
|
||||
YAML_ARRAY("options", 96, 5, struct_ZoneOptionValueTyped, NULL),
|
||||
YAML_END
|
||||
|
||||
+1
-2
@@ -71,8 +71,7 @@ constexpr uint32_t CURVE_COORD_WIDTH = 36;
|
||||
constexpr uint32_t CURVE_COORD_HEIGHT = 17;
|
||||
|
||||
constexpr uint32_t DATETIME_SEPARATOR_X = LCD_W - 53;
|
||||
constexpr uint32_t DATETIME_LINE1 = 7;
|
||||
constexpr uint32_t DATETIME_LINE2 = 22;
|
||||
constexpr uint32_t DATETIME_LINE1 = 6;
|
||||
constexpr uint32_t DATETIME_MIDDLE = (LCD_W + DATETIME_SEPARATOR_X + 1) / 2;
|
||||
|
||||
constexpr uint32_t PAGE_TITLE_TOP = 2;
|
||||
|
||||
Reference in New Issue
Block a user