[Horus] Themes introduction

This commit is contained in:
Bertrand Songis
2016-02-11 22:58:43 +01:00
parent 1da4df143c
commit 02f06706c2
34 changed files with 555 additions and 161 deletions
+4 -1
View File
@@ -65,6 +65,7 @@ if(PCB STREQUAL HORUS)
add_definitions(-DEEPROM_VARIANT=0 -DAUDIO -DVOICE -DRTCLOCK)
add_definitions(-DLUAINPUTS -DXCURVES -DVARIO)
include_directories(${RADIO_SRC_DIRECTORY}/fonts/horus gui/${GUI_DIR} gui/${GUI_DIR}/layouts)
file(GLOB THEMES_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/horus ${RADIO_SRC_DIRECTORY}/gui/horus/themes/*.cpp)
file(GLOB LAYOUTS_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/horus ${RADIO_SRC_DIRECTORY}/gui/horus/layouts/*.cpp)
file(GLOB WIDGETS_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/horus ${RADIO_SRC_DIRECTORY}/gui/horus/widgets/*.cpp)
set(GUI_SRC
@@ -78,8 +79,10 @@ if(PCB STREQUAL HORUS)
view_about.cpp
view_text.cpp
screens_setup.cpp
widget.cpp
theme.cpp
layout.cpp
widget.cpp
${THEMES_SRC}
${LAYOUTS_SRC}
${WIDGETS_SRC}
)
+2 -1
View File
@@ -14,5 +14,6 @@ add_bitmaps_target(horus_alpha_calibration_bitmaps "${RADIO_SRC_DIRECTORY}/bitma
add_bitmaps_target(horus_masks ${RADIO_SRC_DIRECTORY}/bitmaps/horus/mask_*.png 480 8bits)
add_bitmaps_target(horus_slider_masks "${RADIO_SRC_DIRECTORY}/bitmaps/horus/slider/*.png" 480 8bits)
add_bitmaps_target(horus_layouts_masks "${RADIO_SRC_DIRECTORY}/gui/horus/layouts/*.png" 480 8bits)
add_bitmaps_target(horus_themes_bitmaps "${RADIO_SRC_DIRECTORY}/gui/horus/themes/*.png" 480 5/6/5)
add_bitmaps_target(horus_fonts ${RADIO_SRC_DIRECTORY}/fonts/horus/*.png 480 8bits)
add_dependencies(horus_bitmaps horus_calibration_bitmaps horus_alpha_bitmaps horus_alpha_calibration_bitmaps horus_masks horus_slider_masks horus_layouts_masks horus_fonts)
add_dependencies(horus_bitmaps horus_calibration_bitmaps horus_alpha_bitmaps horus_alpha_calibration_bitmaps horus_masks horus_slider_masks horus_themes_bitmaps horus_layouts_masks horus_fonts)
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

+30 -13
View File
@@ -48,14 +48,6 @@ const uint8_t LBM_CURRENT_DOT[] = {
* Main view bitmaps
*/
const uint8_t LBM_MAINVIEW_BACKGROUND[] = {
#include "bmp_background.lbm"
};
const uint8_t LBM_TOPMENU_OPENTX[] = {
#include "mask_topmenu_opentx.lbm"
};
const uint8_t LBM_TOPMENU_USB[] = {
#include "mask_topmenu_usb.lbm"
};
@@ -182,10 +174,6 @@ const uint8_t LBM_TELEMETRY_ICON[] = {
#include "mask_telemetry.lbm"
};
const uint8_t LBM_MAINVIEWS_ICON[] = {
#include "mask_mainviews.lbm"
};
const uint8_t * const LBM_MODEL_ICONS[] = {
LBM_MODEL_ICON,
LBM_MODEL_SETUP_ICON,
@@ -204,6 +192,36 @@ const uint8_t * const LBM_MODEL_ICONS[] = {
LBM_TELEMETRY_ICON
};
/*
* UI (theme / layout / widgets bitmaps
*/
const uint8_t LBM_MAINVIEWS_ICON[] = {
#include "mask_mainviews.lbm"
};
const uint8_t LBM_MAINVIEWS_TOPBAR_ICON[] = {
#include "mask_mainviews_topbar.lbm"
};
const uint8_t LBM_MAINVIEWS_ITEM_OUT_ICON[] = {
#include "mask_mainviews_item_out.lbm"
};
const uint8_t LBM_MAINVIEWS_ADD_ICON[] = {
#include "mask_mainviews_add.lbm"
};
const uint8_t * LBM_MAINVIEWS_ICONS[] = {
LBM_MAINVIEWS_ICON,
LBM_MAINVIEWS_TOPBAR_ICON,
LBM_MAINVIEWS_ITEM_OUT_ICON,
LBM_MAINVIEWS_ITEM_OUT_ICON,
LBM_MAINVIEWS_ITEM_OUT_ICON,
LBM_MAINVIEWS_ITEM_OUT_ICON,
LBM_MAINVIEWS_ITEM_OUT_ICON
};
/*
* Model selection screen bitmaps
*/
@@ -324,4 +342,3 @@ const uint8_t LBM_BUTTON_OFF[] __DMA = {
#include "alpha_button_off.lbm"
};
+6 -2
View File
@@ -29,8 +29,6 @@ extern const uint8_t LBM_CURRENT_SHADOW[];
extern const uint8_t LBM_CURRENT_DOT[];
// Main view icons
extern const uint8_t LBM_MAINVIEW_BACKGROUND[];
extern const uint8_t LBM_TOPMENU_OPENTX[];
extern const uint8_t LBM_TOPMENU_USB[];
extern const uint8_t LBM_HTRIM_FRAME[];
extern const uint8_t LBM_VTRIM_FRAME[];
@@ -51,7 +49,13 @@ extern const uint8_t LBM_INPUTS_ICON[];
extern const uint8_t LBM_MIXER_ICON[];
extern const uint8_t LBM_CURVES_ICON[];
extern const uint8_t LBM_TELEMETRY_ICON[];
// UI (theme / layout / widgets bitmaps
extern const uint8_t LBM_MAINVIEWS_ICON[];
extern const uint8_t LBM_MAINVIEWS_TOPBAR_ICON[];
extern const uint8_t LBM_MAINVIEWS_ITEM_OUT_ICON[];
extern const uint8_t LBM_MAINVIEWS_ADD_ICON[];
extern const uint8_t * LBM_MAINVIEWS_ICONS[];
// Model selection icons
extern const uint8_t LBM_LIBRARY_ICON[];
+1
View File
@@ -22,6 +22,7 @@
#include "menus.h"
#include "widgets.h"
#include "bitmaps.h"
#include "theme.h"
#define MENU_HEADER_HEIGHT 45
#define MENU_TITLE_TOP 48
+1
View File
@@ -124,6 +124,7 @@ class BaseLayoutFactory: public LayoutFactory
extern void lcdDrawBitmapPattern(int x, int y, const uint8_t * bitmap, uint32_t flags, int width=0, int offset=0);
lcdDrawBitmapPattern(x, y, bitmap, flags);
}
virtual const ZoneOption * getOptions() const
{
return options;
+1 -1
View File
@@ -68,7 +68,7 @@ const ZoneOption Layout1x1::options[] = {
void Layout1x1::refresh(bool setup)
{
lcdDrawBitmap(0, 0, LBM_MAINVIEW_BACKGROUND);
theme->drawBackground();
if (persistentData->options[0].boolValue) {
// Top Bar
+1 -1
View File
@@ -70,7 +70,7 @@ const ZoneOption Layout2P1::options[] = {
void Layout2P1::refresh(bool setup)
{
lcdDrawBitmap(0, 0, LBM_MAINVIEW_BACKGROUND);
theme->drawBackground();
if (persistentData->options[0].boolValue) {
// Top Bar
+1 -1
View File
@@ -70,7 +70,7 @@ const ZoneOption Layout2x2::options[] = {
void Layout2x2::refresh(bool setup)
{
lcdDrawBitmap(0, 0, LBM_MAINVIEW_BACKGROUND);
theme->drawBackground();
if (persistentData->options[0].boolValue) {
// Top Bar
+1 -1
View File
@@ -75,7 +75,7 @@ const ZoneOption Layout2x4::options[] = {
void Layout2x4::refresh(bool setup)
{
lcdDrawBitmap(0, 0, LBM_MAINVIEW_BACKGROUND);
theme->drawBackground();
if (persistentData->options[0].boolValue) {
// Top Bar
+1 -23
View File
@@ -28,28 +28,6 @@ display_t displayBuf[DISPLAY_BUFFER_SIZE];
uint16_t lcdColorTable[LCD_COLOR_COUNT];
void lcdColorsInit()
{
lcdColorTable[TEXT_COLOR_INDEX] = BLACK;
lcdColorTable[TEXT_BGCOLOR_INDEX] = WHITE;
lcdColorTable[TEXT_INVERTED_COLOR_INDEX] = WHITE;
lcdColorTable[TEXT_INVERTED_BGCOLOR_INDEX] = RED;
lcdColorTable[LINE_COLOR_INDEX] = GREY;
lcdColorTable[SCROLLBOX_COLOR_INDEX] = RED;
lcdColorTable[MENU_TITLE_BGCOLOR_INDEX] = DARKGREY;
lcdColorTable[MENU_TITLE_COLOR_INDEX] = WHITE;
lcdColorTable[MENU_TITLE_DISABLE_COLOR_INDEX] = RGB(130, 1, 5);
lcdColorTable[HEADER_COLOR_INDEX] = DARKGREY;
lcdColorTable[ALARM_COLOR_INDEX] = RED;
lcdColorTable[WARNING_COLOR_INDEX] = YELLOW;
lcdColorTable[TEXT_DISABLE_COLOR_INDEX] = GREY;
lcdColorTable[CURVE_AXIS_COLOR_INDEX] = LIGHTGREY;
lcdColorTable[CURVE_COLOR_INDEX] = RED;
lcdColorTable[CURVE_CURSOR_COLOR_INDEX] = RED;
lcdColorTable[TITLE_BGCOLOR_INDEX] = RED;
lcdColorTable[HEADER_BGCOLOR_INDEX] = DARKRED;
}
coord_t lcdNextPos;
#define FONT_CHARS_COUNT 103
@@ -973,7 +951,7 @@ void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * bmp, coord_t offset, co
void lcdDrawBlackOverlay()
{
lcdDrawFilledRect(0, 0, LCD_W, LCD_H, SOLID, TEXT_COLOR | (8<<24));
lcdDrawFilledRect(0, 0, LCD_W, LCD_H, SOLID, OVERLAY_COLOR | (8<<24));
}
void lcdDrawCircle(int x0, int y0, int radius)
+23 -12
View File
@@ -36,7 +36,6 @@
#define LCD_COLS 30
#define BSS 0x00
#define FIXEDWIDTH 0x00
#define BOLD 0x00
/* lcd common flags */
@@ -65,7 +64,6 @@
#define MIDSIZE 0x0300
#define DBLSIZE 0x0400
#define XXLSIZE 0x0500
#define ERASEBG 0x8000
#define VERTICAL 0x0800
#define TIMEBLINK 0x1000
@@ -91,6 +89,9 @@
#define LcdFlags uint32_t
#define OPACITY_MAX 0x0F
#define OPACITY(x) ((x)<<24)
enum LcdColorIndex
{
TEXT_COLOR_INDEX,
@@ -110,18 +111,23 @@ enum LcdColorIndex
CURVE_COLOR_INDEX,
CURVE_CURSOR_COLOR_INDEX,
HEADER_BGCOLOR_INDEX,
HEADER_ICON_BGCOLOR_INDEX,
HEADER_CURRENT_BGCOLOR_INDEX,
TITLE_BGCOLOR_INDEX,
TRIM_BGCOLOR_INDEX,
TRIM_SHADOW_COLOR_INDEX,
MAINVIEW_PANES_COLOR_INDEX,
MAINVIEW_GRAPHICS_COLOR_INDEX,
OVERLAY_COLOR_INDEX,
CUSTOM_COLOR_INDEX,
LCD_COLOR_COUNT
};
extern uint16_t lcdColorTable[LCD_COLOR_COUNT];
void lcdColorsInit();
#define OPACITY_MAX 0x0F
#define OPACITY(x) ((x)<<24)
#define COLOR(index) ((index) << 16)
#define COLOR_IDX(att) uint8_t((att) >> 16)
#define TEXT_COLOR COLOR(TEXT_COLOR_INDEX)
#define TEXT_BGCOLOR COLOR(TEXT_BGCOLOR_INDEX)
#define TEXT_INVERTED_COLOR COLOR(TEXT_INVERTED_COLOR_INDEX)
@@ -140,11 +146,16 @@ void lcdColorsInit();
#define CURVE_COLOR COLOR(CURVE_COLOR_INDEX)
#define CURVE_CURSOR_COLOR COLOR(CURVE_CURSOR_COLOR_INDEX)
#define TITLE_BGCOLOR COLOR(TITLE_BGCOLOR_INDEX)
#define TRIM_BGCOLOR COLOR(TRIM_BGCOLOR_INDEX)
#define TRIM_SHADOW_COLOR COLOR(TRIM_SHADOW_COLOR_INDEX)
#define HEADER_BGCOLOR COLOR(HEADER_BGCOLOR_INDEX)
#define HEADER_ICON_BGCOLOR COLOR(HEADER_ICON_BGCOLOR_INDEX)
#define HEADER_CURRENT_BGCOLOR COLOR(HEADER_CURRENT_BGCOLOR_INDEX)
#define MAINVIEW_PANES_COLOR COLOR(MAINVIEW_PANES_COLOR_INDEX)
#define MAINVIEW_GRAPHICS_COLOR COLOR(MAINVIEW_GRAPHICS_COLOR_INDEX)
#define OVERLAY_COLOR COLOR(OVERLAY_COLOR_INDEX)
#define CUSTOM_COLOR COLOR(CUSTOM_COLOR_INDEX)
#define COLOR_IDX(att) uint8_t((att) >> 16)
#define COLOR_SPLIT(color, r, g, b) \
uint16_t r = ((color) & 0xF800) >> 11; \
uint16_t g = ((color) & 0x07E0) >> 5; \
@@ -171,10 +182,10 @@ extern uint32_t CurrentFrameBuffer;
extern coord_t lcdNextPos;
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags attr=TEXT_COLOR);
void lcdDrawText(coord_t x, coord_t y, const pm_char * s, LcdFlags attr=TEXT_COLOR);
void lcdDrawTextAtIndex(coord_t x, coord_t y, const pm_char * s, uint8_t idx, LcdFlags attr=TEXT_COLOR);
void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, uint8_t len, LcdFlags attr=TEXT_COLOR);
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags attr=0);
void lcdDrawText(coord_t x, coord_t y, const pm_char * s, LcdFlags attr=0);
void lcdDrawTextAtIndex(coord_t x, coord_t y, const pm_char * s, uint8_t idx, LcdFlags attr=0);
void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, uint8_t len, LcdFlags attr=0);
void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, unsigned char len);
void lcd_putsCenter(coord_t y, const pm_char * s, LcdFlags attr=0);
void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags mode=0);
+1 -1
View File
@@ -22,7 +22,7 @@
bool menuGeneralVersion(evt_t event)
{
SIMPLE_MENU(STR_MENUVERSION, LBM_RADIO_ICONS, menuTabGeneral, e_Vers, 1);
SIMPLE_MENU(STR_MENUVERSION, LBM_RADIO_ICONS, menuTabGeneral, e_Vers, 0);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + FH, vers_stamp);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 2*FH, date_stamp);
+1 -4
View File
@@ -200,10 +200,7 @@ bool menuModelSelect(evt_t event)
}
// Header
lcdDrawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
lcdDrawBitmapPattern(0, 0, LBM_TOPMENU_POLYGON, TITLE_BGCOLOR);
lcdDrawBitmapPattern(5, 7, LBM_LIBRARY_ICON, MENU_TITLE_COLOR);
drawTopmenuDatetime();
theme->drawTopbarBackground(LBM_LIBRARY_ICON);
// Body
lcdDrawSolidFilledRect(0, MENU_HEADER_HEIGHT, CATEGORIES_WIDTH, LCD_H-MENU_HEADER_HEIGHT-MENU_FOOTER_HEIGHT, TITLE_BGCOLOR);
+10 -9
View File
@@ -34,17 +34,15 @@
#define MIXES_2ND_COLUMN 100
#define COLUMN_HEADER_X 150
typedef int16_t vertpos_t;
typedef evt_t & check_event_t;
#define horzpos_t int8_t
extern uint8_t menuPageIndex;
extern uint8_t menuPageCount;
extern uint16_t linesCount;
extern vertpos_t menuVerticalPosition;
extern int menuVerticalPosition;
extern horzpos_t menuHorizontalPosition;
extern vertpos_t menuVerticalOffset;
extern int menuVerticalOffset;
extern uint8_t calibrationState;
// Temporary no highlight
@@ -158,7 +156,7 @@ bool menuMainViewChannelsMonitor(evt_t event);
bool menuChannelsView(evt_t event);
bool menuChannelsView(evt_t event);
bool menuTextView(evt_t event);
bool menuSetupScreensView(evt_t event);
bool menuScreensTheme(evt_t event);
#if defined(DEBUG_TRACE_BUFFER)
void menuTraceBuffer(evt_t event);
@@ -260,18 +258,21 @@ swsrc_t checkIncDecMovedSwitch(swsrc_t val);
checkIncDec(event, var, min, max, incdecFlag, isValueAvailable)
bool navigate(evt_t event, int count, int rows, int columns=1);
bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow, uint8_t flags=0);
bool check_simple(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, vertpos_t maxrow);
bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, int maxrow, uint8_t flags=0);
bool check_simple(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, int maxrow);
bool check_submenu_simple(check_event_t event, uint8_t maxrow);
#define MENU_TAB(...) const uint8_t mstate_tab[] = __VA_ARGS__
#define MENU(title, icons, tab, menu, lines_count, ...) \
#define MENU_WITH_OPTIONS(title, icons, tab, tabCount, menu, lines_count, ...) \
MENU_TAB(__VA_ARGS__); \
if (event == EVT_ENTRY || event == EVT_ENTRY_UP) TRACE("Menu %s displayed ...", title); \
if (!check(event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, lines_count)) return false; \
if (!check(event, menu, tab, tabCount, mstate_tab, DIM(mstate_tab)-1, lines_count)) return false; \
drawMenuTemplate(title, icons); \
#define MENU(title, icons, tab, menu, lines_count, ...) \
MENU_WITH_OPTIONS(title, icons, tab, DIM(tab), menu, lines_count, __VA_ARGS__)
#define SIMPLE_MENU(title, icons, tab, menu, lines_count) \
if (event == EVT_ENTRY || event == EVT_ENTRY_UP) TRACE("Menu %s displayed ...", title); \
if (!check_simple(event, menu, tab, DIM(tab), lines_count)) return false; \
+9 -8
View File
@@ -20,8 +20,8 @@
#include "../../opentx.h"
vertpos_t menuVerticalOffset;
vertpos_t menuVerticalPosition;
int menuVerticalOffset;
int menuVerticalPosition;
horzpos_t menuHorizontalPosition;
int8_t s_editMode;
uint8_t noHighlightCounter;
@@ -325,10 +325,10 @@ int checkIncDec(evt_t event, int val, int i_min, int i_max, unsigned int i_flags
}
#define CURSOR_NOT_ALLOWED_IN_ROW(row) ((int8_t)MAXCOL(row) < 0)
#define MAXCOL_RAW(row) ((row) >= 0 && horTab ? pgm_read_byte(horTab+min<int>(row, (vertpos_t)horTabMax)) : (const uint8_t)0)
#define MAXCOL_RAW(row) ((row) >= 0 && horTab ? pgm_read_byte(horTab+min<int>(row, (int)horTabMax)) : (const uint8_t)0)
#define MAXCOL(row) (MAXCOL_RAW(row) >= HIDDEN_ROW ? MAXCOL_RAW(row) : (const uint8_t)(MAXCOL_RAW(row) & (~NAVIGATION_LINE_BY_LINE)))
#define COLATTR(row) (MAXCOL_RAW(row) == (uint8_t)-1 ? (const uint8_t)0 : (const uint8_t)(MAXCOL_RAW(row) & NAVIGATION_LINE_BY_LINE))
#define INC(val, min, max) if (val<max) {val++;} else {val=min;}
#define INC(val, min, max) if (val<max) {val++;} else if (max>=0) {val=min;}
#define DEC(val, min, max) if (val>min) {val--;} else {val=max;}
uint8_t menuPageIndex;
@@ -407,7 +407,7 @@ bool navigate(evt_t event, int count, int rows, int columns)
return (prevPosHorz != menuHorizontalPosition || prevPosVert != menuVerticalPosition);
}
bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const pm_uint8_t * horTab, uint8_t horTabMax, vertpos_t rowcount, uint8_t flags)
bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const pm_uint8_t * horTab, uint8_t horTabMax, int rowcount, uint8_t flags)
{
uint8_t maxcol = MAXCOL(menuVerticalPosition);
@@ -543,6 +543,7 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
do {
INC(menuVerticalPosition, MENU_FIRST_LINE_EDIT, rowcount-1);
} while (CURSOR_NOT_ALLOWED_IN_ROW(menuVerticalPosition));
s_editMode = 0; // if we go down, we must be in this mode
uint8_t newmaxcol = MAXCOL(menuVerticalPosition);
if (COLATTR(menuVerticalPosition) & NAVIGATION_LINE_BY_LINE) {
@@ -612,7 +613,7 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
else if (horTab) {
if (rowcount > linesDisplayed) {
while (1) {
vertpos_t firstLine = 0;
int firstLine = 0;
for (int numLines=0; firstLine<rowcount && numLines<menuVerticalOffset; firstLine++) {
if (firstLine>=horTabMax || horTab[firstLine] != HIDDEN_ROW) {
numLines++;
@@ -622,7 +623,7 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
menuVerticalOffset--;
}
else {
vertpos_t lastLine = firstLine;
int lastLine = firstLine;
for (int numLines=0; lastLine<rowcount && numLines<linesDisplayed; lastLine++) {
if (lastLine >= horTabMax || horTab[lastLine] != HIDDEN_ROW) {
numLines++;
@@ -656,7 +657,7 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
return true;
}
bool check_simple(check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, vertpos_t rowcount)
bool check_simple(check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, int rowcount)
{
return check(event, curr, menuTab, menuTabSize, NULL, 0, rowcount);
}
+145 -49
View File
@@ -28,6 +28,7 @@ Widget * currentWidget;
void onWidgetChoiceMenu(const char * result)
{
customScreens[0]->setWidget(menuVerticalPosition, result);
storageDirty(EE_MODEL);
}
ZoneOptionValue editZoneOption(coord_t y, const ZoneOption * option, ZoneOptionValue value, LcdFlags attr, evt_t event)
@@ -117,6 +118,7 @@ void onZoneMenu(const char * result)
}
else if (result == STR_REMOVE_WIDGET) {
currentScreen->setWidget(menuVerticalPosition, NULL);
storageDirty(EE_MODEL);
}
}
@@ -160,20 +162,112 @@ bool menuSetupWidgets(evt_t event)
return true;
}
bool menuSetupScreensView(evt_t event)
extern MenuHandlerFunc menuTabMainviews[1+MAX_CUSTOM_SCREENS];
extern int updateMainviewsMenu();
template <class T>
T * editThemeChoice(coord_t x, coord_t y, T * array[], uint8_t count, T * current, bool needsOffsetCheck, LcdFlags attr, evt_t event)
{
static uint8_t menuHorizontalOffset;
currentScreen = customScreens[0];
int layoutIndex = 0;
for (unsigned int i=0; i<countRegisteredLayouts; i++) {
if (registeredLayouts[i] == currentScreen->getFactory()) {
layoutIndex = i;
int currentIndex = 0;
for (unsigned int i=0; i<count; i++) {
if (array[i] == current) {
currentIndex = i;
break;
}
}
if (event == EVT_ENTRY) {
menuHorizontalOffset = 0;
needsOffsetCheck = true;
}
if (needsOffsetCheck) {
if (currentIndex < menuHorizontalOffset) {
menuHorizontalOffset = currentIndex;
}
else if (currentIndex > menuHorizontalOffset + 3) {
menuHorizontalOffset = currentIndex - 3;
}
}
if (attr) {
if (menuHorizontalPosition < 0) {
lcdDrawSolidFilledRect(x-3, y-2, min<uint8_t>(4, count)*56+1, 2*FH-5, TEXT_INVERTED_BGCOLOR);
}
else {
if (needsOffsetCheck) {
menuHorizontalPosition = currentIndex;
}
else if (menuHorizontalPosition < menuHorizontalOffset) {
menuHorizontalOffset = menuHorizontalPosition;
}
else if (menuHorizontalPosition > menuHorizontalOffset + 3) {
menuHorizontalOffset = menuHorizontalPosition - 3;
}
}
}
unsigned int last = min<int>(menuHorizontalOffset + 4, count);
for (unsigned int i=menuHorizontalOffset, pos=x; i<last; i++, pos += 56) {
T * element = array[i];
element->drawThumb(pos, y, current == element ? ((attr && menuHorizontalPosition < 0) ? TEXT_INVERTED_COLOR : TEXT_INVERTED_BGCOLOR) : LINE_COLOR);
}
if (count > 4) {
lcdDrawBitmapPattern(x - 12, y, LBM_CARROUSSEL_LEFT, menuHorizontalOffset > 0 ? LINE_COLOR : CURVE_AXIS_COLOR);
lcdDrawBitmapPattern(x + 4 * 56, y, LBM_CARROUSSEL_RIGHT, last < countRegisteredLayouts ? LINE_COLOR : CURVE_AXIS_COLOR);
}
if (attr && menuHorizontalPosition >= 0) {
lcdDrawSolidRect(x + (menuHorizontalPosition - menuHorizontalOffset) * 56 - 3, y - 2, 57, 35, TEXT_INVERTED_BGCOLOR);
if (menuHorizontalPosition != currentIndex && event == EVT_KEY_BREAK(KEY_ENTER)) {
s_editMode = 0;
return array[menuHorizontalPosition];
}
}
return NULL;
}
bool menuScreensTheme(evt_t event)
{
bool needsOffsetCheck = (menuVerticalPosition != 0 || menuHorizontalPosition < 0);
int menuItemsCount = updateMainviewsMenu();
MENU_WITH_OPTIONS("User interface", LBM_MAINVIEWS_ICONS, menuTabMainviews, menuItemsCount, 0, 1, { uint8_t(NAVIGATION_LINE_BY_LINE|uint8_t(countRegisteredLayouts-1)), ORPHAN_ROW, 0, 0, 0, 0 });
for (int i=0; i<NUM_BODY_LINES; i++) {
coord_t y = MENU_CONTENT_TOP + i * FH;
int k = i + menuVerticalOffset;
LcdFlags blink = ((s_editMode > 0) ? BLINK | INVERS : INVERS);
LcdFlags attr = (menuVerticalPosition == k ? blink : 0);
switch (k) {
case 0: {
lcdDrawText(MENUS_MARGIN_LEFT, y + FH / 2, "Theme");
const Theme * new_theme = editThemeChoice<const Theme>(SCREENS_SETUP_2ND_COLUMN, y, registeredThemes, countRegisteredThemes, theme, needsOffsetCheck, attr, event);
if (new_theme) {
theme = new_theme;
theme->load();
// strncpy(g_model.screenData[T].layoutName, factory->getName(), sizeof(g_model.screenData[T].layoutName));
storageDirty(EE_MODEL);
}
break;
}
case 1:
break;
}
}
}
bool menuScreenAdd(evt_t event)
{
int menuItemsCount = updateMainviewsMenu();
MENU_WITH_OPTIONS("Add main view", LBM_MAINVIEWS_ICONS, menuTabMainviews, menuItemsCount, menuItemsCount-1, 0, { uint8_t(NAVIGATION_LINE_BY_LINE|uint8_t(countRegisteredLayouts-1)), ORPHAN_ROW, 0, 0, 0, 0 });
}
template <int T>
bool menuScreenSetup(evt_t event)
{
currentScreen = customScreens[T];
bool needsOffsetCheck = (menuVerticalPosition != 0 || menuHorizontalPosition < 0);
linesCount = 3;
@@ -182,7 +276,10 @@ bool menuSetupScreensView(evt_t event)
linesCount++;
}
SUBMENU_WITH_OPTIONS("Main views setup", LBM_MAINVIEWS_ICON, linesCount, OPTION_MENU_TITLE_BAR, { uint8_t(NAVIGATION_LINE_BY_LINE|uint8_t(countRegisteredLayouts-1)), ORPHAN_ROW, 0, 0, 0, 0 });
char title[] = "Main view X";
title[sizeof(title)-2] = '1' + T;
int menuItemsCount = updateMainviewsMenu();
MENU_WITH_OPTIONS(title, LBM_MAINVIEWS_ICONS, menuTabMainviews, menuItemsCount, T+1, linesCount, { uint8_t(NAVIGATION_LINE_BY_LINE|uint8_t(countRegisteredLayouts-1)), ORPHAN_ROW, 0, 0, 0, 0 });
for (int i=0; i<NUM_BODY_LINES; i++) {
coord_t y = MENU_CONTENT_TOP + i * FH;
@@ -190,48 +287,14 @@ bool menuSetupScreensView(evt_t event)
LcdFlags blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
LcdFlags attr = (menuVerticalPosition == k ? blink : 0);
switch(k) {
case 0: {
case 0:
{
lcdDrawText(MENUS_MARGIN_LEFT, y + FH / 2, "Layout");
if (needsOffsetCheck) {
if (layoutIndex < menuHorizontalOffset) {
menuHorizontalOffset = layoutIndex;
}
else if (layoutIndex > menuHorizontalOffset + 3) {
menuHorizontalOffset = layoutIndex - 3;
}
}
if (attr) {
if (menuHorizontalPosition < 0) {
lcdDrawSolidFilledRect(SCREENS_SETUP_2ND_COLUMN-3, y-2, 4*56+1, 2*FH-5, TEXT_INVERTED_BGCOLOR);
}
else {
if (needsOffsetCheck) {
menuHorizontalPosition = layoutIndex;
}
else if (menuHorizontalPosition < menuHorizontalOffset) {
menuHorizontalOffset = menuHorizontalPosition;
}
else if (menuHorizontalPosition > menuHorizontalOffset + 3) {
menuHorizontalOffset = menuHorizontalPosition - 3;
}
}
}
unsigned int lastDisplayedLayout = min<int>(menuHorizontalOffset + 4, countRegisteredLayouts);
for (unsigned int i=menuHorizontalOffset, x=SCREENS_SETUP_2ND_COLUMN; i<lastDisplayedLayout; i++, x += 56) {
const LayoutFactory * factory = registeredLayouts[i];
factory->drawThumb(x, y, currentScreen->getFactory() == factory ? (menuHorizontalPosition < 0 ? TEXT_INVERTED_COLOR : TEXT_INVERTED_BGCOLOR) : LINE_COLOR);
}
lcdDrawBitmapPattern(SCREENS_SETUP_2ND_COLUMN - 12, y, LBM_CARROUSSEL_LEFT, menuHorizontalOffset > 0 ? LINE_COLOR : CURVE_AXIS_COLOR);
lcdDrawBitmapPattern(SCREENS_SETUP_2ND_COLUMN + 4 * 56, y, LBM_CARROUSSEL_RIGHT, lastDisplayedLayout < countRegisteredLayouts ? LINE_COLOR : CURVE_AXIS_COLOR);
if (attr && menuHorizontalPosition >= 0) {
lcdDrawSolidRect(SCREENS_SETUP_2ND_COLUMN + (menuHorizontalPosition - menuHorizontalOffset) * 56 - 3, y - 2, 57, 35, TEXT_INVERTED_BGCOLOR);
if (menuHorizontalPosition != layoutIndex && event == EVT_KEY_BREAK(KEY_ENTER)) {
s_editMode = 0;
customScreens[0] = registeredLayouts[menuHorizontalPosition]->create(&g_model.screenData[0].layoutData);
strncpy(g_model.screenData[0].layoutName, customScreens[0]->getFactory()->getName(), sizeof(g_model.screenData[0].layoutName));
storageDirty(EE_MODEL);
return false;
}
const LayoutFactory * factory = editThemeChoice<const LayoutFactory>(SCREENS_SETUP_2ND_COLUMN, y, registeredLayouts, countRegisteredLayouts, currentScreen->getFactory(), needsOffsetCheck, attr, event);
if (factory) {
customScreens[T] = factory->create(&g_model.screenData[T].layoutData);
strncpy(g_model.screenData[T].layoutName, factory->getName(), sizeof(g_model.screenData[T].layoutName));
storageDirty(EE_MODEL);
}
break;
}
@@ -262,3 +325,36 @@ bool menuSetupScreensView(evt_t event)
return true;
}
MenuHandlerFunc menuTabMainviews[1+MAX_CUSTOM_SCREENS] = {
menuScreensTheme,
menuScreenSetup<0>,
menuScreenSetup<1>,
menuScreenSetup<2>,
menuScreenSetup<3>,
menuScreenSetup<4>
};
const MenuHandlerFunc menuMainviews[MAX_CUSTOM_SCREENS] = {
menuScreenSetup<0>,
menuScreenSetup<1>,
menuScreenSetup<2>,
menuScreenSetup<3>,
menuScreenSetup<4>
};
int updateMainviewsMenu()
{
for (int index=1; index<MAX_CUSTOM_SCREENS; index++) {
if (customScreens[index]) {
menuTabMainviews[1+index] = menuMainviews[index];
LBM_MAINVIEWS_ICONS[2+index] = LBM_MAINVIEWS_ITEM_OUT_ICON;
}
else {
menuTabMainviews[1+index] = menuScreenAdd;
LBM_MAINVIEWS_ICONS[2+index] = LBM_MAINVIEWS_ADD_ICON;
return 2+index;
}
}
return 1+MAX_CUSTOM_SCREENS;
}
+1 -1
View File
@@ -33,7 +33,7 @@ void drawSplash()
#if MENUS_LOCK == 1
if (readonly == false) {
lcdDrawSolidFilledRect((LCD_W-(sizeof(TR_UNLOCKED)-1)*FW)/2 - 9, 50, (sizeof(TR_UNLOCKED)-1)*FW+16, 11, SOLID, ERASE|ROUND);
lcdDrawSolidFilledRect((LCD_W-(sizeof(TR_UNLOCKED)-1)*FW)/2 - 9, 50, (sizeof(TR_UNLOCKED)-1)*FW+16, 11, SOLID, ROUND);
lcdDrawText((LCD_W-(sizeof(TR_UNLOCKED)-1)*FW)/2 , 53, STR_UNLOCKED);
}
#endif
+42
View File
@@ -0,0 +1,42 @@
/*
* 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 Theme * registeredThemes[MAX_REGISTERED_THEMES]; // TODO dynamic
unsigned int countRegisteredThemes = 0;
void registerTheme(const Theme * theme)
{
if (countRegisteredThemes < MAX_REGISTERED_THEMES) {
registeredThemes[countRegisteredThemes++] = theme;
}
}
const Theme * getTheme(const char * name)
{
for (unsigned int i=0; i<countRegisteredThemes; i++) {
const Theme * theme = registeredThemes[i];
if (!strcmp(name, theme->getName())) {
return theme;
}
}
return NULL;
}
+66
View File
@@ -0,0 +1,66 @@
/*
* 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.
*/
#ifndef _THEME_H_
#define _THEME_H_
class Theme;
void registerTheme(const Theme * theme);
class Theme
{
public:
Theme(const char * name, const uint8_t * bitmap):
name(name),
bitmap(bitmap)
{
registerTheme(this);
}
const char * getName() const
{
return name;
}
virtual void drawThumb(uint16_t x, uint16_t y, uint32_t flags) const
{
extern void lcdDrawBitmap(int x, int y, const uint8_t * bitmap, int offset=0, int height=0, int scale=0);
lcdDrawBitmap(x, y, bitmap);
}
virtual void load() const = 0;
virtual void drawBackground() const = 0;
virtual void drawTopbarBackground(const uint8_t * icon) const = 0;
protected:
const char * name;
const uint8_t * bitmap;
};
extern const Theme * theme;
#define MAX_REGISTERED_THEMES 10
extern unsigned int countRegisteredThemes;
extern const Theme * registeredThemes[MAX_REGISTERED_THEMES]; // TODO dynamic
#endif // _THEME_H_
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

+89
View File
@@ -0,0 +1,89 @@
/*
* 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_TOPMENU_BMP_OPENTX[] = {
#include "bmp_topmenu_opentx.lbm"
};
class DarkblueTheme: public Theme
{
public:
DarkblueTheme(const char * name, const uint8_t * bitmap):
Theme(name, bitmap)
{
}
virtual void load() const
{
lcdColorTable[TEXT_COLOR_INDEX] = WHITE;
lcdColorTable[TEXT_BGCOLOR_INDEX] = RGB(10, 78, 121);
lcdColorTable[TEXT_INVERTED_COLOR_INDEX] = WHITE;
lcdColorTable[TEXT_INVERTED_BGCOLOR_INDEX] = RGB(32, 34, 42);
lcdColorTable[LINE_COLOR_INDEX] = GREY;
lcdColorTable[SCROLLBOX_COLOR_INDEX] = WHITE;
lcdColorTable[MENU_TITLE_BGCOLOR_INDEX] = DARKGREY;
lcdColorTable[MENU_TITLE_COLOR_INDEX] = WHITE;
lcdColorTable[MENU_TITLE_DISABLE_COLOR_INDEX] = BLACK;
lcdColorTable[HEADER_COLOR_INDEX] = RGB(32, 34, 42);
lcdColorTable[ALARM_COLOR_INDEX] = RGB(32, 34, 42);
lcdColorTable[WARNING_COLOR_INDEX] = YELLOW;
lcdColorTable[TEXT_DISABLE_COLOR_INDEX] = GREY;
lcdColorTable[CURVE_AXIS_COLOR_INDEX] = LIGHTGREY;
lcdColorTable[CURVE_COLOR_INDEX] = RGB(32, 34, 42);
lcdColorTable[CURVE_CURSOR_COLOR_INDEX] = RGB(32, 34, 42);
lcdColorTable[TITLE_BGCOLOR_INDEX] = RGB(32, 34, 42);
lcdColorTable[TRIM_BGCOLOR_INDEX] = RGB(32, 34, 42);
lcdColorTable[TRIM_SHADOW_COLOR_INDEX] = RGB(100, 100, 100);
lcdColorTable[MAINVIEW_PANES_COLOR_INDEX] = GREY;
lcdColorTable[MAINVIEW_GRAPHICS_COLOR_INDEX] = WHITE;
lcdColorTable[HEADER_BGCOLOR_INDEX] = RGB(32, 34, 42);
lcdColorTable[HEADER_ICON_BGCOLOR_INDEX] = BLACK;
lcdColorTable[HEADER_CURRENT_BGCOLOR_INDEX] = RGB(10, 78, 121);
lcdColorTable[OVERLAY_COLOR_INDEX] = BLACK;
}
virtual void drawBackground() const
{
lcdDrawSolidFilledRect(0, 0, LCD_W, LCD_H, TEXT_BGCOLOR);
}
void drawTopbarBackground(const uint8_t * icon) const
{
lcdDrawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
lcdDrawSolidFilledRect(0, 0, 41, MENU_HEADER_HEIGHT, HEADER_ICON_BGCOLOR);
if (icon) {
lcdDrawBitmapPattern(5, 7, icon, MENU_TITLE_COLOR);
}
else {
lcdDrawBitmap(5, 7, LBM_TOPMENU_BMP_OPENTX);
}
drawTopbarDatetime();
}
};
const uint8_t LBM_THEME_DARKBLUE[] __DMA = {
#include "bmp_darkblue.lbm"
};
DarkblueTheme darkblueTheme("Darkblue", LBM_THEME_DARKBLUE);
+94
View File
@@ -0,0 +1,94 @@
/*
* 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_TOPMENU_MASK_OPENTX[] = {
#include "mask_topmenu_opentx.lbm"
};
const uint8_t LBM_MAINVIEW_BACKGROUND[] = {
#include "bmp_background.lbm"
};
class DefaultTheme: public Theme
{
public:
DefaultTheme(const char * name, const uint8_t * bitmap):
Theme(name, bitmap)
{
}
virtual void load() const
{
lcdColorTable[TEXT_COLOR_INDEX] = BLACK;
lcdColorTable[TEXT_BGCOLOR_INDEX] = WHITE;
lcdColorTable[TEXT_INVERTED_COLOR_INDEX] = WHITE;
lcdColorTable[TEXT_INVERTED_BGCOLOR_INDEX] = RED;
lcdColorTable[LINE_COLOR_INDEX] = GREY;
lcdColorTable[SCROLLBOX_COLOR_INDEX] = RED;
lcdColorTable[MENU_TITLE_BGCOLOR_INDEX] = DARKGREY;
lcdColorTable[MENU_TITLE_COLOR_INDEX] = WHITE;
lcdColorTable[MENU_TITLE_DISABLE_COLOR_INDEX] = RGB(130, 1, 5);
lcdColorTable[HEADER_COLOR_INDEX] = DARKGREY;
lcdColorTable[ALARM_COLOR_INDEX] = RED;
lcdColorTable[WARNING_COLOR_INDEX] = YELLOW;
lcdColorTable[TEXT_DISABLE_COLOR_INDEX] = GREY;
lcdColorTable[CURVE_AXIS_COLOR_INDEX] = LIGHTGREY;
lcdColorTable[CURVE_COLOR_INDEX] = RED;
lcdColorTable[CURVE_CURSOR_COLOR_INDEX] = RED;
lcdColorTable[TITLE_BGCOLOR_INDEX] = RED;
lcdColorTable[TRIM_BGCOLOR_INDEX] = RED;
lcdColorTable[TRIM_SHADOW_COLOR_INDEX] = BLACK;
lcdColorTable[MAINVIEW_PANES_COLOR_INDEX] = WHITE;
lcdColorTable[MAINVIEW_GRAPHICS_COLOR_INDEX] = RED;
lcdColorTable[HEADER_BGCOLOR_INDEX] = DARKRED;
lcdColorTable[HEADER_ICON_BGCOLOR_INDEX] = RED;
lcdColorTable[HEADER_CURRENT_BGCOLOR_INDEX] = RED;
lcdColorTable[OVERLAY_COLOR_INDEX] = BLACK;
}
virtual void drawBackground() const
{
lcdDrawBitmap(0, 0, LBM_MAINVIEW_BACKGROUND);
}
virtual void drawTopbarBackground(const uint8_t * icon) const
{
lcdDrawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
lcdDrawBitmapPattern(0, 0, LBM_TOPMENU_POLYGON, TITLE_BGCOLOR);
if (icon) {
lcdDrawBitmapPattern(5, 7, icon, MENU_TITLE_COLOR);
}
else {
lcdDrawBitmapPattern(4, 10, LBM_TOPMENU_MASK_OPENTX, MENU_TITLE_COLOR);
}
drawTopbarDatetime();
}
};
const uint8_t LBM_THEME_DEFAULT[] __DMA = {
#include "bmp_default.lbm"
};
const DefaultTheme defaultTheme("Default", LBM_THEME_DEFAULT);
const Theme * theme = &defaultTheme;
+1 -1
View File
@@ -62,7 +62,7 @@ bool menuAboutView(evt_t event)
break;
}
drawScreenTemplate("About", LBM_TOPMENU_OPENTX);
drawScreenTemplate("About", NULL);
uint8_t screenDuration = 150;
+2 -8
View File
@@ -88,13 +88,7 @@ void drawMainViewTopBar()
const int ALTITUDE_H = 30;
const int PADDING = 4;
// Background
lcdDrawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
lcdDrawBitmapPattern(0, 0, LBM_TOPMENU_POLYGON, TITLE_BGCOLOR);
lcdDrawBitmapPattern(4, 10, LBM_TOPMENU_OPENTX, MENU_TITLE_COLOR);
// Date & Time
drawTopmenuDatetime();
theme->drawTopbarBackground(NULL);
// USB icon
if (usbPlugged()) {
@@ -193,7 +187,7 @@ void onMainViewMenu(const char *result)
chainMenu(menuStatisticsView);
}
else if (result == STR_SETUP_SCREENS) {
pushMenu(menuSetupScreensView);
pushMenu(menuScreensTheme);
}
else if (result == STR_ABOUT_US) {
chainMenu(menuAboutView);
+1 -1
View File
@@ -91,7 +91,7 @@ bool menuTextView(evt_t event)
{
static int lines_count;
drawScreenTemplate("TEXT VIEWER", LBM_TOPMENU_OPENTX);
drawScreenTemplate("TEXT VIEWER", NULL);
switch (event) {
case EVT_ENTRY:
+10 -12
View File
@@ -33,7 +33,7 @@ const char * STR_MONTHS[] = { "Jan", "Fev", "Mar", "Apr", "May", "Jun", "Jul", "
#define DATETIME_LINE2 23
#define DATETIME_LEFT(s) (LCD_W+DATETIME_SEPARATOR_X+8-getTextWidth(s, SMLSIZE))/2
void drawTopmenuDatetime()
void drawTopbarDatetime()
{
lcdDrawSolidVerticalLine(DATETIME_SEPARATOR_X, 7, 31, TEXT_INVERTED_COLOR);
@@ -149,11 +149,7 @@ void drawScreenTemplate(const char * title, const uint8_t * icon, uint32_t optio
{
coord_t bodyTop, bodyBottom;
// Header
lcdDrawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
lcdDrawBitmapPattern(0, 0, LBM_TOPMENU_POLYGON, TITLE_BGCOLOR);
lcdDrawBitmapPattern(5, 7, icon, MENU_TITLE_COLOR);
drawTopmenuDatetime();
theme->drawTopbarBackground(icon);
// Menu title bar
if (options & OPTION_MENU_TITLE_BAR) {
@@ -196,10 +192,13 @@ void drawMenuTemplate(const char * title, const uint8_t * const * icons, uint32_
drawScreenTemplate(title, icons[0], OPTION_MENU_TITLE_BAR);
if (menuVerticalPosition < 0) {
lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING-10, 0, LBM_CURRENT_BG, TITLE_BGCOLOR);
lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING-10, 0, LBM_CURRENT_BG, HEADER_CURRENT_BGCOLOR);
lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING-10, 0, LBM_CURRENT_SHADOW, TRIM_SHADOW_COLOR);
lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING, MENU_TITLE_TOP-9, LBM_CURRENT_DOT, MENU_TITLE_COLOR);
}
else {
lcdDrawSolidFilledRect(58+menuPageIndex*MENU_ICONS_SPACING-9, 0, 32, MENU_HEADER_HEIGHT, TITLE_BGCOLOR);
lcdDrawSolidFilledRect(58+menuPageIndex*MENU_ICONS_SPACING-9, 0, 32, MENU_HEADER_HEIGHT, HEADER_CURRENT_BGCOLOR);
lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING, MENU_TITLE_TOP-9, LBM_DOT, MENU_TITLE_COLOR);
}
@@ -208,8 +207,7 @@ void drawMenuTemplate(const char * title, const uint8_t * const * icons, uint32_
}
if (menuVerticalPosition < 0) {
lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING-10, 0, LBM_CURRENT_SHADOW, TEXT_COLOR);
lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING, MENU_TITLE_TOP-9, LBM_CURRENT_DOT, MENU_TITLE_COLOR);
}
}
@@ -235,8 +233,8 @@ int8_t switchMenuItem(coord_t x, coord_t y, int8_t value, LcdFlags attr, evt_t e
void drawTrimSquare(coord_t x, coord_t y)
{
lcdDrawSolidFilledRect(x-2, y, 15, 15, TITLE_BGCOLOR);
lcdDrawBitmapPattern(x-2, y, LBM_TRIM_SHADOW, TEXT_COLOR);
lcdDrawSolidFilledRect(x-2, y, 15, 15, TRIM_BGCOLOR);
lcdDrawBitmapPattern(x-2, y, LBM_TRIM_SHADOW, TRIM_SHADOW_COLOR);
}
void drawHorizontalTrimPosition(coord_t x, coord_t y, int16_t dir)
+1 -1
View File
@@ -41,7 +41,7 @@
void drawColumnHeader(const char * const * headers, uint8_t index);
void drawTopmenuDatetime();
void drawTopbarDatetime();
void drawStick(coord_t x, coord_t y, int16_t xval, int16_t yval);
#define BUTTON_ON 0x10
+4 -4
View File
@@ -34,10 +34,10 @@ class ModelPanelWidget: public Widget
void ModelPanelWidget::refresh()
{
if (zone.h >= MODEL_BITMAP_HEIGHT) {
lcdDrawFilledRect(zone.x, zone.y, zone.w, zone.h, SOLID, TEXT_BGCOLOR | OPACITY(5));
lcdDrawBitmapPattern(zone.x + 6, zone.y + 4, LBM_MODEL_ICON, TITLE_BGCOLOR);
lcdDrawFilledRect(zone.x, zone.y, zone.w, zone.h, SOLID, MAINVIEW_PANES_COLOR | OPACITY(5));
lcdDrawBitmapPattern(zone.x + 6, zone.y + 4, LBM_MODEL_ICON, MAINVIEW_GRAPHICS_COLOR);
lcdDrawSizedText(zone.x + 45, zone.y + 10, g_model.header.name, LEN_MODEL_NAME, ZCHAR | SMLSIZE);
lcdDrawSolidHorizontalLine(zone.x + 39, zone.y + 27, zone.w - 48, TITLE_BGCOLOR);
lcdDrawSolidHorizontalLine(zone.x + 39, zone.y + 27, zone.w - 48, MAINVIEW_GRAPHICS_COLOR);
int scale = getBitmapScale(modelBitmap, zone.w, zone.h - 25);
int width = getBitmapScaledSize(getBitmapWidth(modelBitmap), scale);
int height = getBitmapScaledSize(getBitmapHeight(modelBitmap), scale);
@@ -47,7 +47,7 @@ void ModelPanelWidget::refresh()
int scale = getBitmapScale(modelBitmap, zone.w, zone.h);
int width = getBitmapScaledSize(getBitmapWidth(modelBitmap), scale);
int height = getBitmapScaledSize(getBitmapHeight(modelBitmap), scale);
lcdDrawFilledRect(zone.x, zone.y, zone.w, height, SOLID, TEXT_BGCOLOR | OPACITY(5));
lcdDrawFilledRect(zone.x, zone.y, zone.w, height, SOLID, MAINVIEW_PANES_COLOR | OPACITY(5));
lcdDrawSizedText(zone.x + 5, zone.y + 10, g_model.header.name, LEN_MODEL_NAME, ZCHAR | SMLSIZE);
lcdDrawBitmap(zone.x + zone.w - width, zone.y, modelBitmap, 0, 0, scale);
}
+3 -3
View File
@@ -44,12 +44,12 @@ void TimerWidget::refresh()
TimerData & timerData = g_model.timers[index];
TimerState & timerState = timersStates[index];
lcdDrawBitmapPattern(zone.x, zone.y, LBM_TIMER_BACKGROUND, TEXT_BGCOLOR);
lcdDrawBitmapPattern(zone.x, zone.y, LBM_TIMER_BACKGROUND, MAINVIEW_PANES_COLOR);
if (timerData.start) {
lcdDrawBitmapPatternPie(zone.x+2, zone.y+3, LBM_RSCALE, TITLE_BGCOLOR, 0, timerState.val <= 0 ? 360 : 360*(timerData.start-timerState.val)/timerData.start);
lcdDrawBitmapPatternPie(zone.x+2, zone.y+3, LBM_RSCALE, MAINVIEW_GRAPHICS_COLOR, 0, timerState.val <= 0 ? 360 : 360*(timerData.start-timerState.val)/timerData.start);
}
else {
lcdDrawBitmapPattern(zone.x+3, zone.y+4, LBM_TIMER, TITLE_BGCOLOR);
lcdDrawBitmapPattern(zone.x+3, zone.y+4, LBM_TIMER, MAINVIEW_GRAPHICS_COLOR);
}
putsTimer(zone.x+76, zone.y+31, abs(timerState.val), TEXT_COLOR|DBLSIZE|LEFT);
if (ZLEN(timerData.name) > 0) {
+1 -1
View File
@@ -2602,7 +2602,7 @@ int main(void)
#endif
#if defined(COLORLCD)
lcdColorsInit();
theme->load();
#endif
stackPaint();
+2 -2
View File
@@ -317,7 +317,7 @@ void *eeprom_write_function(void *)
uint8_t main_thread_running = 0;
char * main_thread_error = NULL;
extern void opentxStart();
void *main_thread(void *)
void * main_thread(void *)
{
#ifdef SIMU_EXCEPTIONS
signal(SIGFPE, sig);
@@ -327,7 +327,7 @@ void *main_thread(void *)
#endif
#if defined(PCBHORUS)
lcdColorsInit();
theme->load();
#endif
#if defined(CPUARM)