Default Theme facelift

This commit is contained in:
Raphael Coeffic
2021-06-14 06:34:57 +02:00
parent 26b15d4d43
commit 57aa76c424
15 changed files with 245 additions and 176 deletions
+43 -34
View File
@@ -27,50 +27,56 @@
// TODO common code, not in target
enum LcdColorIndex
{
DEFAULT_COLOR_INDEX,
DEFAULT_BGCOLOR_INDEX,
FOCUS_COLOR_INDEX,
FOCUS_BGCOLOR_INDEX,
TEXT_STATUSBAR_COLOR_INDEX,
LINE_COLOR_INDEX,
MENU_LINE_COLOR_INDEX = LINE_COLOR_INDEX,
CHECKBOX_COLOR_INDEX,
SCROLLBAR_COLOR_INDEX,
MENU_BGCOLOR_INDEX,
MENU_HIGHLIGHT_BGCOLOR_INDEX /*= MENU_BGCOLOR_INDEX*/,
MENU_COLOR_INDEX,
MENU_TITLE_DISABLE_COLOR_INDEX,
HEADER_COLOR_INDEX,
ALARM_COLOR_INDEX,
HIGHLIGHT_COLOR_INDEX,
MENU_HIGHLIGHT_COLOR_INDEX = HIGHLIGHT_COLOR_INDEX,
TEXT_DISABLE_COLOR_INDEX,
DISABLE_COLOR_INDEX,
CURVE_COLOR_INDEX,
CURVE_AXIS_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,
BARGRAPH1_COLOR_INDEX,
BARGRAPH2_COLOR_INDEX,
BARGRAPH_BGCOLOR_INDEX,
SCROLLBOX_COLOR_INDEX,
TABLE_HEADER_BGCOLOR_INDEX,
TABLE_BGCOLOR_INDEX,
BATTERY_CHARGE_COLOR_INDEX,
CHECKBOX_COLOR_INDEX,
CURVE_AXIS_COLOR_INDEX,
CURVE_COLOR_INDEX,
CURVE_CURSOR_COLOR_INDEX,
CUSTOM_COLOR_INDEX,
DEFAULT_BGCOLOR_INDEX,
DEFAULT_COLOR_INDEX,
DISABLE_COLOR_INDEX,
EDIT_MARKER_COLOR_INDEX,
FIELD_BGCOLOR_INDEX,
FIELD_FRAME_COLOR_INDEX,
FOCUS_BGCOLOR_INDEX,
FOCUS_COLOR_INDEX,
HEADER_BGCOLOR_INDEX,
HEADER_COLOR_INDEX,
HEADER_CURRENT_BGCOLOR_INDEX,
HEADER_ICON_BGCOLOR_INDEX,
HIGHLIGHT_COLOR_INDEX,
LINE_COLOR_INDEX,
MENU_HIGHLIGHT_BGCOLOR_INDEX,
MAINVIEW_GRAPHICS_COLOR_INDEX,
MAINVIEW_PANES_COLOR_INDEX,
MENU_BGCOLOR_INDEX,
MENU_COLOR_INDEX,
MENU_TITLE_DISABLE_COLOR_INDEX,
OVERLAY_COLOR_INDEX,
SCROLLBAR_COLOR_INDEX,
SCROLLBOX_COLOR_INDEX,
TABLE_BGCOLOR_INDEX,
TABLE_HEADER_BGCOLOR_INDEX,
TEXT_DISABLE_COLOR_INDEX,
TEXT_STATUSBAR_COLOR_INDEX,
TITLE_BGCOLOR_INDEX,
TRIM_BGCOLOR_INDEX,
TRIM_SHADOW_COLOR_INDEX,
// this one MUST be last
LCD_COLOR_COUNT,
};
#define MENU_HIGHLIGHT_COLOR_INDEX HIGHLIGHT_COLOR_INDEX
#define MENU_LINE_COLOR_INDEX LINE_COLOR_INDEX
//
// Basic color definitions
//
@@ -116,6 +122,9 @@ inline void lcdSetColor(uint16_t color)
#define DEFAULT_BGCOLOR COLOR(DEFAULT_BGCOLOR_INDEX)
#define DEFAULT_COLOR COLOR(DEFAULT_COLOR_INDEX)
#define DISABLE_COLOR COLOR(DISABLE_COLOR_INDEX)
#define EDIT_MARKER_COLOR COLOR(EDIT_MARKER_COLOR_INDEX)
#define FIELD_BGCOLOR COLOR(FIELD_BGCOLOR_INDEX)
#define FIELD_FRAME_COLOR COLOR(FIELD_FRAME_COLOR_INDEX)
#define FOCUS_BGCOLOR COLOR(FOCUS_BGCOLOR_INDEX)
#define FOCUS_COLOR COLOR(FOCUS_COLOR_INDEX)
#define HEADER_BGCOLOR COLOR(HEADER_BGCOLOR_INDEX)
+22 -18
View File
@@ -85,25 +85,26 @@ void TopbarImpl::paint(BitmapBuffer * dc)
char str[10];
sprintf(str, "%d %s", t.tm_mday, STR_MONTHS[t.tm_mon]);
dc->drawSolidVerticalLine(DATETIME_SEPARATOR_X, 7, 31, MENU_COLOR);
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE1, str, FONT(XS) | CENTERED| MENU_COLOR);
//dc->drawSolidVerticalLine(DATETIME_SEPARATOR_X, 7, 31, MENU_COLOR);
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE1, str, FONT(XS) | CENTERED| FOCUS_COLOR);
getTimerString(str, getValue(MIXSRC_TX_TIME));
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE2, str, FONT(XS) | CENTERED | MENU_COLOR);
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE2, str, FONT(XS) | CENTERED | FOCUS_COLOR);
#if defined(INTERNAL_GPS)
if (gpsData.fix) {
char s[10];
sprintf(s, "%d", gpsData.numSat);
dc->drawText(LCD_W-148, 4, s, FONT(XS) | CENTERED | MENU_COLOR);
dc->drawText(LCD_W-148, 4, s, FONT(XS) | CENTERED | FOCUS_COLOR);
}
dc->drawBitmapPattern(LCD_W-158, 22, LBM_TOPMENU_GPS, (gpsData.fix) ? MENU_COLOR : MENU_TITLE_DISABLE_COLOR);
dc->drawBitmapPattern(LCD_W - 158, 22, LBM_TOPMENU_GPS,
(gpsData.fix) ? FOCUS_COLOR : MENU_TITLE_DISABLE_COLOR);
#endif
// USB icon
if (usbPlugged()) {
LcdFlags flags = MENU_COLOR;
LcdFlags flags = FOCUS_COLOR;
if (getSelectedUsbMode() == USB_UNSELECTED_MODE) {
flags = MENU_TITLE_DISABLE_COLOR;
}
@@ -112,7 +113,7 @@ void TopbarImpl::paint(BitmapBuffer * dc)
}
// Logs
else if (isFunctionActive(FUNCTION_LOGS) && BLINK_ON_PHASE) {
dc->drawBitmapPattern(LCD_W - 98, 6, LBM_DOT, MENU_COLOR);
dc->drawBitmapPattern(LCD_W - 98, 6, LBM_DOT, FOCUS_COLOR);
}
// RSSI
@@ -120,42 +121,45 @@ void TopbarImpl::paint(BitmapBuffer * dc)
const uint8_t rssiBarsHeight[] = {5, 10, 15, 21, 31};
for (unsigned int i = 0; i < DIM(rssiBarsHeight); i++) {
uint8_t height = rssiBarsHeight[i];
dc->drawSolidFilledRect(LCD_W - 90 + i * 6, 38 - height, 4, height, TELEMETRY_RSSI() >= rssiBarsValue[i] ? MENU_COLOR : MENU_TITLE_DISABLE_COLOR);
dc->drawSolidFilledRect(LCD_W - 90 + i * 6, 38 - height, 4, height,
TELEMETRY_RSSI() >= rssiBarsValue[i]
? FOCUS_COLOR
: MENU_TITLE_DISABLE_COLOR);
}
#if defined(INTERNAL_MODULE_PXX1) && defined(EXTERNAL_ANTENNA)
if (isModuleXJT(INTERNAL_MODULE) && isExternalAntennaEnabled()) {
dc->drawBitmapPattern(LCD_W-94, 4, LBM_TOPMENU_ANTENNA, MENU_COLOR);
dc->drawBitmapPattern(LCD_W-94, 4, LBM_TOPMENU_ANTENNA, FOCUS_COLOR);
}
#endif
/* Audio volume */
dc->drawBitmapPattern(LCD_W - 130, 4, LBM_TOPMENU_VOLUME_SCALE, MENU_TITLE_DISABLE_COLOR);
if (requiredSpeakerVolume == 0 || g_eeGeneral.beepMode == e_mode_quiet)
dc->drawBitmapPattern(LCD_W - 130, 4, LBM_TOPMENU_VOLUME_0, MENU_COLOR);
dc->drawBitmapPattern(LCD_W - 130, 4, LBM_TOPMENU_VOLUME_0, FOCUS_COLOR);
else if (requiredSpeakerVolume < 7)
dc->drawBitmapPattern(LCD_W - 130, 4, LBM_TOPMENU_VOLUME_1, MENU_COLOR);
dc->drawBitmapPattern(LCD_W - 130, 4, LBM_TOPMENU_VOLUME_1, FOCUS_COLOR);
else if (requiredSpeakerVolume < 13)
dc->drawBitmapPattern(LCD_W - 130, 4, LBM_TOPMENU_VOLUME_2, MENU_COLOR);
dc->drawBitmapPattern(LCD_W - 130, 4, LBM_TOPMENU_VOLUME_2, FOCUS_COLOR);
else if (requiredSpeakerVolume < 19)
dc->drawBitmapPattern(LCD_W - 130, 4, LBM_TOPMENU_VOLUME_3, MENU_COLOR);
dc->drawBitmapPattern(LCD_W - 130, 4, LBM_TOPMENU_VOLUME_3, FOCUS_COLOR);
else
dc->drawBitmapPattern(LCD_W - 130, 4, LBM_TOPMENU_VOLUME_4, MENU_COLOR);
dc->drawBitmapPattern(LCD_W - 130, 4, LBM_TOPMENU_VOLUME_4, FOCUS_COLOR);
/* Tx battery */
uint8_t bars = GET_TXBATT_BARS(5);
#if defined(USB_CHARGER)
if (usbChargerLed()) {
dc->drawBitmapPattern(LCD_W - 130, 25, LBM_TOPMENU_TXBATT_CHARGING, MENU_COLOR);
dc->drawBitmapPattern(LCD_W - 130, 25, LBM_TOPMENU_TXBATT_CHARGING, FOCUS_COLOR);
}
else {
dc->drawBitmapPattern(LCD_W - 130, 25, LBM_TOPMENU_TXBATT, MENU_COLOR);
dc->drawBitmapPattern(LCD_W - 130, 25, LBM_TOPMENU_TXBATT, FOCUS_COLOR);
}
#else
dc->drawBitmapPattern(LCD_W - 130, 25, LBM_TOPMENU_TXBATT, MENU_COLOR);
dc->drawBitmapPattern(LCD_W - 130, 25, LBM_TOPMENU_TXBATT, FOCUS_COLOR);
#endif
for (unsigned int i = 0; i < 5; i++) {
dc->drawSolidFilledRect(LCD_W - 128 + 4 * i, 30, 2, 8, i >= bars ? MENU_TITLE_DISABLE_COLOR : MENU_COLOR);
dc->drawSolidFilledRect(LCD_W - 128 + 4 * i, 30, 2, 8, i >= bars ? MENU_TITLE_DISABLE_COLOR : FOCUS_COLOR);
}
#if 0
+27 -14
View File
@@ -44,19 +44,25 @@ void MainViewHorizontalTrim::paint(BitmapBuffer * dc)
}
// Trim line
lcdSetColor(GREY); // TODO add a color
dc->drawSolidFilledRect(TRIM_SQUARE_SIZE / 2, (height() - TRIM_LINE_WIDTH - 1) / 2, width() - TRIM_SQUARE_SIZE + 1, TRIM_LINE_WIDTH, CUSTOM_COLOR);
dc->drawSolidFilledRect(
TRIM_SQUARE_SIZE / 2, (height() - TRIM_LINE_WIDTH - 1) / 2,
width() - TRIM_SQUARE_SIZE + 1, TRIM_LINE_WIDTH, DEFAULT_COLOR);
// Trim square
coord_t x = divRoundClosest((width() - TRIM_SQUARE_SIZE) * (value - trimMin), trimMax - trimMin);
drawTrimSquare(dc, x, 0, (value < TRIM_MIN || value > TRIM_MAX) ? HIGHLIGHT_COLOR /* TODO add a color */ : TRIM_BGCOLOR);
coord_t x = divRoundClosest((width() - TRIM_SQUARE_SIZE) * (value - trimMin),
trimMax - trimMin);
drawTrimSquare(dc, x, 0,
(value < TRIM_MIN || value > TRIM_MAX)
? HIGHLIGHT_COLOR /* TODO add a color */
: TRIM_BGCOLOR);
// Trim value / small lines on the square
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS) {
// TODO DISPLAY_TRIMS_CHANGE
dc->drawNumber(x + (TRIM_SQUARE_SIZE + 1) / 2, 3, divRoundClosest(value * 100, trimMax), FONT(XXS) | FOCUS_COLOR | CENTERED);
}
else {
dc->drawNumber(x + (TRIM_SQUARE_SIZE + 1) / 2, 3,
divRoundClosest(value * 100, trimMax),
FONT(XXS) | FOCUS_COLOR | CENTERED);
} else {
if (value >= 0) {
dc->drawSolidVerticalLine(x + 4, 3, 9, FOCUS_COLOR);
}
@@ -79,19 +85,26 @@ void MainViewVerticalTrim::paint(BitmapBuffer * dc)
}
// Trim line
lcdSetColor(GREY); // TODO add a color
dc->drawSolidFilledRect((width() - TRIM_LINE_WIDTH) / 2, TRIM_SQUARE_SIZE / 2, TRIM_LINE_WIDTH, height() - TRIM_SQUARE_SIZE + 1, CUSTOM_COLOR);
dc->drawSolidFilledRect((width() - TRIM_LINE_WIDTH) / 2, TRIM_SQUARE_SIZE / 2,
TRIM_LINE_WIDTH, height() - TRIM_SQUARE_SIZE + 1,
DEFAULT_COLOR);
// Trim square
coord_t y = height() - TRIM_SQUARE_SIZE - divRoundClosest((height() - TRIM_SQUARE_SIZE) * (value - trimMin), trimMax - trimMin);
drawTrimSquare(dc, 0, y, (value < TRIM_MIN || value > TRIM_MAX) ? HIGHLIGHT_COLOR /* TODO add a color */ : TRIM_BGCOLOR);
coord_t y = height() - TRIM_SQUARE_SIZE -
divRoundClosest((height() - TRIM_SQUARE_SIZE) * (value - trimMin),
trimMax - trimMin);
drawTrimSquare(dc, 0, y,
(value < TRIM_MIN || value > TRIM_MAX)
? HIGHLIGHT_COLOR /* TODO add a color */
: TRIM_BGCOLOR);
// Trim value / small lines on the square
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS) {
// TODO DISPLAY_TRIMS_CHANGE
dc->drawNumber((TRIM_SQUARE_SIZE + 1) / 2, y + 3, divRoundClosest(value * 100, trimMax), FONT(XXS) | FOCUS_COLOR | CENTERED);
}
else {
dc->drawNumber((TRIM_SQUARE_SIZE + 1) / 2, y + 3,
divRoundClosest(value * 100, trimMax),
FONT(XXS) | FOCUS_COLOR | CENTERED);
} else {
if (value >= 0) {
dc->drawSolidHorizontalLine(3, y + 4, 9, FOCUS_COLOR);
}
+3 -2
View File
@@ -37,8 +37,9 @@ PageHeader::PageHeader(Page * parent, uint8_t icon):
void PageHeader::paint(BitmapBuffer * dc)
{
OpenTxTheme::instance()->drawMenuBackground(dc, getIcon(), "");
dc->drawSolidFilledRect(MENU_HEADER_HEIGHT, 0, LCD_W - MENU_HEADER_HEIGHT, MENU_HEADER_HEIGHT, MENU_BGCOLOR);
OpenTxTheme::instance()->drawPageHeaderBackground(dc, getIcon(), "");
dc->drawSolidFilledRect(MENU_HEADER_HEIGHT, 0, LCD_W - MENU_HEADER_HEIGHT,
MENU_HEADER_HEIGHT, HEADER_COLOR);
}
Page::Page(unsigned icon):
+4 -3
View File
@@ -64,11 +64,12 @@ void SourceChoice::paint(BitmapBuffer * dc)
if (editMode)
textColor = FOCUS_COLOR;
else if (hasFocus())
textColor = FOCUS_BGCOLOR;
else if (value == 0)
textColor = DISABLE_COLOR;
textColor = FOCUS_COLOR;
// else if (value == 0)
// textColor = DISABLE_COLOR;
else
textColor = 0;
drawSource(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, textColor);
}
+5 -4
View File
@@ -48,11 +48,12 @@ void SwitchChoice::paint(BitmapBuffer * dc)
if (editMode)
textColor = FOCUS_COLOR;
else if (hasFocus())
textColor = FOCUS_BGCOLOR;
else if (value == 0)
textColor = DISABLE_COLOR;
textColor = FOCUS_COLOR;
// else if (value == 0)
// textColor = DISABLE_COLOR;
else
textColor = 0;
textColor = DEFAULT_COLOR;
drawSwitch(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, textColor);
}
+8 -5
View File
@@ -46,12 +46,15 @@ TabsGroupHeader::TabsGroupHeader(TabsGroup * parent, uint8_t icon):
void TabsGroupHeader::paint(BitmapBuffer * dc)
{
OpenTxTheme::instance()->drawMenuBackground(dc, icon, title);
OpenTxTheme::instance()->drawPageHeaderBackground(dc, icon, title);
}
TabsCarousel::TabsCarousel(Window * parent, TabsGroup * menu):
Window(parent, { MENU_HEADER_BUTTONS_LEFT, 0, LCD_W - MENU_HEADER_BUTTONS_LEFT, MENU_HEADER_HEIGHT + 10 }, TRANSPARENT),
menu(menu)
TabsCarousel::TabsCarousel(Window* parent, TabsGroup* menu) :
Window(parent,
{MENU_HEADER_BUTTONS_LEFT, 0, LCD_W - MENU_HEADER_BUTTONS_LEFT,
MENU_HEADER_HEIGHT + 10},
TRANSPARENT),
menu(menu)
{
}
@@ -62,7 +65,7 @@ void TabsCarousel::updateInnerWidth()
void TabsCarousel::paint(BitmapBuffer * dc)
{
OpenTxTheme::instance()->drawMenuHeader(dc, menu->tabs, currentIndex);
OpenTxTheme::instance()->drawPageHeader(dc, menu->tabs, currentIndex);
}
#if defined(HARDWARE_TOUCH)
+34 -33
View File
@@ -166,23 +166,18 @@ void OpenTxTheme::drawBackground(BitmapBuffer * dc) const
// }
//}
void OpenTxTheme::drawCheckBox(BitmapBuffer * dc, bool checked, coord_t x, coord_t y, bool focus) const
void OpenTxTheme::drawCheckBox(BitmapBuffer *dc, bool checked, coord_t x,
coord_t y, bool focus) const
{
dc->drawSolidFilledRect(x, y, 16, 16, FIELD_BGCOLOR);
if (focus) {
dc->drawSolidFilledRect(x + 0, y + 2, 16, 16, FOCUS_BGCOLOR);
if (checked) {
dc->drawSolidFilledRect(x + 2, y + 4, 12, 12, DEFAULT_BGCOLOR);
dc->drawSolidFilledRect(x + 3, y + 5, 10, 10, CHECKBOX_COLOR);
}
else {
dc->drawSolidFilledRect(x + 2, y + 4, 12, 12, DEFAULT_BGCOLOR);
}
dc->drawSolidRect(x, y, 16, 16, 2, FOCUS_BGCOLOR);
}
else {
dc->drawSolidRect(x + 0, y + 2, 16, 16, 1, DISABLE_COLOR);
if (checked) {
dc->drawSolidFilledRect(x + 2, y + 4, 12, 12, CHECKBOX_COLOR);
}
dc->drawSolidRect(x, y, 16, 16, 1, FIELD_FRAME_COLOR);
}
if (checked) {
dc->drawSolidFilledRect(x + 3, y + 3, 10, 10, CHECKBOX_COLOR);
}
}
@@ -192,37 +187,43 @@ void OpenTxTheme::drawChoice(BitmapBuffer * dc, ChoiceBase * choice, const char
if (choice->isEditMode())
textColor = FOCUS_COLOR;
else if (choice->hasFocus())
textColor = FOCUS_BGCOLOR;
else if (!str || str[0] == '\0')
textColor = DISABLE_COLOR;
textColor = FOCUS_COLOR;
// else if (!str || str[0] == '\0')
// textColor = FOCUS_COLOR;
else
textColor = DEFAULT_COLOR;
dc->drawText(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, str[0] == '\0' ? "---" : str, textColor);
dc->drawBitmapPattern(choice->getRect().w - 20, (choice->getRect().h - 11) / 2, choice->getType() == CHOICE_TYPE_FOLDER ? LBM_FOLDER : LBM_DROPDOWN, textColor);
dc->drawText(FIELD_PADDING_LEFT, FIELD_PADDING_TOP,
str[0] == '\0' ? "---" : str, textColor);
dc->drawBitmapPattern(
choice->getRect().w - 20, (choice->getRect().h - 11) / 2,
choice->getType() == CHOICE_TYPE_FOLDER ? LBM_FOLDER : LBM_DROPDOWN,
textColor);
}
void OpenTxTheme::drawSlider(BitmapBuffer * dc, int vmin, int vmax, int value, const rect_t & rect, bool edit, bool focus) const
void OpenTxTheme::drawSlider(BitmapBuffer *dc, int vmin, int vmax, int value,
const rect_t &rect, bool edit, bool focus) const
{
int val = limit(vmin, value, vmax);
int w = divRoundClosest((rect.w - 16) * (val - vmin), vmax - vmin);
if (edit) {
dc->drawBitmapPattern(0, 11, LBM_SLIDER_BAR_LEFT, FOCUS_BGCOLOR);
dc->drawSolidFilledRect(4, 11, rect.w - 8, 4, FOCUS_BGCOLOR);
dc->drawBitmapPattern(rect.w - 4, 11, LBM_SLIDER_BAR_RIGHT, FOCUS_BGCOLOR);
}
else {
dc->drawBitmapPattern(0, 11, LBM_SLIDER_BAR_LEFT, LINE_COLOR);
dc->drawSolidFilledRect(4, 11, rect.w - 8, 4, LINE_COLOR);
dc->drawBitmapPattern(rect.w - 4, 11, LBM_SLIDER_BAR_RIGHT, LINE_COLOR);
LcdFlags color = DEFAULT_COLOR;
if (focus) {
color = FOCUS_BGCOLOR;
}
dc->drawBitmapPattern(w, 5, LBM_SLIDER_POINT_OUT, DEFAULT_COLOR);
dc->drawBitmapPattern(w, 5, LBM_SLIDER_POINT_MID, DEFAULT_BGCOLOR);
// if ((options & INVERS) && (!(options & BLINK) || !BLINK_ON_PHASE))
if (focus) {
dc->drawBitmapPattern(w, 5, LBM_SLIDER_POINT_IN, FOCUS_BGCOLOR);
dc->drawBitmapPattern(0, 11, LBM_SLIDER_BAR_LEFT, color);
dc->drawSolidFilledRect(4, 11, rect.w - 8, 4, color);
dc->drawBitmapPattern(rect.w - 4, 11, LBM_SLIDER_BAR_RIGHT, color);
dc->drawBitmapPattern(w, 5, LBM_SLIDER_POINT_OUT, color);
dc->drawBitmapPattern(w, 5, LBM_SLIDER_POINT_MID, FIELD_BGCOLOR);
if (edit) {
dc->drawBitmapPattern(w, 5, LBM_SLIDER_POINT_IN, EDIT_MARKER_COLOR);
} else {
dc->drawBitmapPattern(w, 5, LBM_SLIDER_POINT_IN, FIELD_BGCOLOR);
}
}
+4 -2
View File
@@ -85,9 +85,11 @@ class OpenTxTheme: public Theme
virtual void drawBackground(BitmapBuffer * dc) const;
virtual void drawMenuBackground(BitmapBuffer * dc, uint8_t icon, const char *title) const = 0;
virtual void drawPageHeaderBackground(BitmapBuffer *dc, uint8_t icon,
const char *title) const = 0;
virtual void drawMenuHeader(BitmapBuffer * dc, std::vector<PageTab *> & tabs, uint8_t currentIndex) const = 0;
virtual void drawPageHeader(BitmapBuffer *dc, std::vector<PageTab *> &tabs,
uint8_t currentIndex) const = 0;
// virtual void drawMessageBox(const char * title, const char * text, const
// char * action, uint32_t flags) const override;
+53 -32
View File
@@ -28,6 +28,16 @@ const ZoneOption OPTIONS_THEME_DEFAULT[] = {
{ nullptr, ZoneOption::Bool }
};
constexpr uint16_t __TEXT_COLOR = RGB(0x0C, 0x3F, 0x66);
constexpr uint16_t __BACKGROUND_COLOR = RGB(0x12, 0x5E, 0x99);
constexpr uint16_t __FOCUS_COLOR = RGB(0x14, 0xA1, 0xE5);
constexpr uint16_t __DATAFIELD_FRAME_COLOR = RGB(0xB6, 0xE0, 0xF2);
constexpr uint16_t __TAB_BACKGROUND_COLOR = RGB(0xE4, 0xEE, 0xF2);
constexpr uint16_t __PARAM_BACKGROUND_COLOR = WHITE;
constexpr uint16_t __EDIT_MARKER_COLOR = RGB(0x00, 0x99, 0x09);
constexpr uint16_t __ACTIVE_MARKER_COLOR = RGB(0xFF, 0x99, 0x00);
class Theme480: public OpenTxTheme
{
public:
@@ -45,43 +55,45 @@ class Theme480: public OpenTxTheme
lcdColorTable[BARGRAPH2_COLOR_INDEX] = RGB(167, 167, 167);
lcdColorTable[BARGRAPH_BGCOLOR_INDEX] = RGB(222, 222, 222);
lcdColorTable[BATTERY_CHARGE_COLOR_INDEX] = GREEN;
lcdColorTable[CHECKBOX_COLOR_INDEX] = RED;
lcdColorTable[CHECKBOX_COLOR_INDEX] = __FOCUS_COLOR;
lcdColorTable[CURVE_COLOR_INDEX] = RED;
lcdColorTable[CURVE_CURSOR_COLOR_INDEX] = RED;
lcdColorTable[DEFAULT_BGCOLOR_INDEX] = WHITE;
lcdColorTable[DEFAULT_COLOR_INDEX] = BLACK;
lcdColorTable[DEFAULT_BGCOLOR_INDEX] = __TAB_BACKGROUND_COLOR;
lcdColorTable[DEFAULT_COLOR_INDEX] = __TEXT_COLOR;
lcdColorTable[DISABLE_COLOR_INDEX] = LIGHTGREY;
lcdColorTable[FOCUS_BGCOLOR_INDEX] = RED;
lcdColorTable[EDIT_MARKER_COLOR_INDEX] = __EDIT_MARKER_COLOR;
lcdColorTable[FIELD_BGCOLOR_INDEX] = WHITE;
lcdColorTable[FIELD_FRAME_COLOR_INDEX] = __DATAFIELD_FRAME_COLOR;
lcdColorTable[FOCUS_BGCOLOR_INDEX] = __FOCUS_COLOR;
lcdColorTable[FOCUS_COLOR_INDEX] = WHITE;
lcdColorTable[HEADER_COLOR_INDEX] = DARKRED;
lcdColorTable[HEADER_CURRENT_BGCOLOR_INDEX] = RED;
lcdColorTable[HEADER_ICON_BGCOLOR_INDEX] = RED;
lcdColorTable[HEADER_COLOR_INDEX] = __BACKGROUND_COLOR;
lcdColorTable[HEADER_CURRENT_BGCOLOR_INDEX] = __FOCUS_COLOR;
lcdColorTable[HEADER_ICON_BGCOLOR_INDEX] = __BACKGROUND_COLOR;
lcdColorTable[HIGHLIGHT_COLOR_INDEX] = YELLOW;
lcdColorTable[LINE_COLOR_INDEX] = GREY;
lcdColorTable[MAINVIEW_GRAPHICS_COLOR_INDEX] = RED;
lcdColorTable[MAINVIEW_PANES_COLOR_INDEX] = WHITE;
// this is what the status bar uses...
//lcdColorTable[MENU_BGCOLOR_INDEX] = DARKRED;
lcdColorTable[MENU_BGCOLOR_INDEX] = WHITE;
lcdColorTable[MENU_COLOR_INDEX] = __BACKGROUND_COLOR; // Menu font color
// Menu font color
lcdColorTable[MENU_BGCOLOR_INDEX] = DARKRED;//DARKGREY;
lcdColorTable[MENU_COLOR_INDEX] = WHITE;
// Selected item in menu
lcdColorTable[MENU_HIGHLIGHT_BGCOLOR_INDEX] = BLACK;
lcdColorTable[MENU_HIGHLIGHT_BGCOLOR_INDEX] = __FOCUS_COLOR;
lcdColorTable[MENU_HIGHLIGHT_COLOR_INDEX] = WHITE;
lcdColorTable[MENU_LINE_COLOR_INDEX] = __DATAFIELD_FRAME_COLOR;
lcdColorTable[MENU_TITLE_DISABLE_COLOR_INDEX] = RGB(GET_RED(RED)>>1, GET_GREEN(RED)>>1, GET_BLUE(RED)>>1);
lcdColorTable[MENU_TITLE_DISABLE_COLOR_INDEX] = __TEXT_COLOR;
lcdColorTable[OVERLAY_COLOR_INDEX] = BLACK;
lcdColorTable[SCROLLBAR_COLOR_INDEX] = RED;
lcdColorTable[SCROLLBAR_COLOR_INDEX] = __TEXT_COLOR;
lcdColorTable[TEXT_DISABLE_COLOR_INDEX] = GREY;
lcdColorTable[TEXT_STATUSBAR_COLOR_INDEX] = WHITE;
lcdColorTable[TITLE_BGCOLOR_INDEX] = RED;
lcdColorTable[TRIM_BGCOLOR_INDEX] = RED;
lcdColorTable[TITLE_BGCOLOR_INDEX] = __BACKGROUND_COLOR;
lcdColorTable[TRIM_BGCOLOR_INDEX] = __FOCUS_COLOR;
lcdColorTable[TRIM_SHADOW_COLOR_INDEX] = BLACK;
}
void loadMenuIcon(uint8_t index, const uint8_t * lbm, uint32_t color=MENU_COLOR) const
void loadMenuIcon(uint8_t index, const uint8_t * lbm) const
{
BitmapBuffer * mask = BitmapBuffer::load8bitMask(lbm);
if (mask) {
@@ -91,15 +103,15 @@ class Theme480: public OpenTxTheme
delete menuIconNormal[index];
menuIconNormal[index] = new BitmapBuffer(BMP_RGB565, mask->width(), mask->height());
if (menuIconNormal[index]) {
menuIconNormal[index]->clear(MENU_BGCOLOR);
menuIconNormal[index]->drawMask(0, 0, mask, color);
menuIconNormal[index]->clear(HEADER_ICON_BGCOLOR);
menuIconNormal[index]->drawMask(0, 0, mask, FOCUS_COLOR);
}
delete menuIconSelected[index];
menuIconSelected[index] = new BitmapBuffer(BMP_RGB565, mask->width(), mask->height());
if (menuIconSelected[index]) {
menuIconSelected[index]->clear(HEADER_CURRENT_BGCOLOR);
menuIconSelected[index]->drawMask(0, 0, mask, color);
menuIconSelected[index]->drawMask(0, 0, mask, FOCUS_COLOR);
}
}
}
@@ -107,7 +119,7 @@ class Theme480: public OpenTxTheme
void loadIcons() const
{
#if defined(LOG_TELEMETRY) || !defined(WATCHDOG)
loadMenuIcon(ICON_OPENTX, mask_opentx_testmode, DEFAULT_COLOR);
loadMenuIcon(ICON_OPENTX, mask_opentx_testmode);
#else
loadMenuIcon(ICON_OPENTX, mask_edgetx);
#endif
@@ -185,12 +197,12 @@ class Theme480: public OpenTxTheme
currentMenuBackground->drawMask(0, 0, shadow, TRIM_SHADOW_COLOR);
currentMenuBackground->drawMask(10, 39, dot, MENU_COLOR);
currentMenuBackground->drawMask(10, 39, dot, FOCUS_COLOR);
}
delete topleftBitmap;
topleftBitmap = BitmapBuffer::load8bitMaskOnBackground(
mask_topleft, TITLE_BGCOLOR, HEADER_COLOR);
mask_topleft, HEADER_CURRENT_BGCOLOR, HEADER_COLOR);
delete background;
delete shadow;
@@ -347,7 +359,8 @@ class Theme480: public OpenTxTheme
}
}
void drawMenuBackground(BitmapBuffer * dc, uint8_t icon, const char * title) const override
void drawPageHeaderBackground(BitmapBuffer *dc, uint8_t icon,
const char *title) const override
{
if (topleftBitmap) {
dc->drawBitmap(0, 0, topleftBitmap);
@@ -363,8 +376,12 @@ class Theme480: public OpenTxTheme
else
dc->drawBitmap(5, 7, menuIconSelected[icon]);
dc->drawSolidFilledRect(0, MENU_HEADER_HEIGHT, LCD_W, MENU_TITLE_TOP - MENU_HEADER_HEIGHT, DEFAULT_BGCOLOR); // the white separation line
dc->drawSolidFilledRect(0, MENU_TITLE_TOP, LCD_W, MENU_TITLE_HEIGHT, TITLE_BGCOLOR); // the title line background
dc->drawSolidFilledRect(0, MENU_HEADER_HEIGHT, LCD_W,
MENU_TITLE_TOP - MENU_HEADER_HEIGHT,
DEFAULT_BGCOLOR); // the white separation line
dc->drawSolidFilledRect(0, MENU_TITLE_TOP, LCD_W, MENU_TITLE_HEIGHT,
TITLE_BGCOLOR); // the title line background
if (title) {
dc->drawText(MENUS_MARGIN_LEFT, MENU_TITLE_TOP + 3, title, MENU_COLOR);
}
@@ -382,20 +399,24 @@ class Theme480: public OpenTxTheme
return state == STATE_DEFAULT ? menuIconNormal[index] : menuIconSelected[index];
}
void drawMenuHeader(BitmapBuffer * dc, std::vector<PageTab *> & tabs, uint8_t currentIndex) const override
void drawPageHeader(BitmapBuffer *dc, std::vector<PageTab *> &tabs,
uint8_t currentIndex) const override
{
for (unsigned index = 0; index < tabs.size(); index++) {
if (index != currentIndex) {
dc->drawBitmap(index*MENU_HEADER_BUTTON_WIDTH + 2, 7, menuIconNormal[tabs[index]->getIcon()]);
dc->drawBitmap(index * MENU_HEADER_BUTTON_WIDTH + 2, 7,
menuIconNormal[tabs[index]->getIcon()]);
}
}
dc->drawBitmap(currentIndex*MENU_HEADER_BUTTON_WIDTH, 0, currentMenuBackground);
dc->drawBitmap(currentIndex*MENU_HEADER_BUTTON_WIDTH + 2, 7, menuIconSelected[tabs[currentIndex]->getIcon()]);
dc->drawBitmap(currentIndex * MENU_HEADER_BUTTON_WIDTH, 0,
currentMenuBackground);
dc->drawBitmap(currentIndex * MENU_HEADER_BUTTON_WIDTH + 2, 7,
menuIconSelected[tabs[currentIndex]->getIcon()]);
}
void drawMenuDatetime(BitmapBuffer * dc) const
{
dc->drawSolidVerticalLine(DATETIME_SEPARATOR_X, 7, 31, FOCUS_COLOR);
//dc->drawSolidVerticalLine(DATETIME_SEPARATOR_X, 7, 31, FOCUS_COLOR);
struct gtm t;
gettime(&t);
+37 -26
View File
@@ -348,25 +348,30 @@ class FlyskyTheme: public OpenTxTheme
}
}
void drawMenuBackground(BitmapBuffer * dc, uint8_t icon, const char * title) const override
void drawPageHeaderBackground(BitmapBuffer *dc, uint8_t icon,
const char *title) const override
{
// if (topleftBitmap) {
// dc->drawBitmap(0, 0, topleftBitmap);
// uint16_t width = topleftBitmap->width();
// dc->drawSolidFilledRect(width, 0, LCD_W-width, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
// }
// else {
dc->drawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
// }
//
// if (icon == ICON_OPENTX)
// dc->drawBitmap(4, 10, menuIconSelected[ICON_OPENTX]);
// else
// dc->drawBitmap(5, 7, menuIconSelected[icon]);
//
dc->drawSolidFilledRect(0, MENU_HEADER_HEIGHT, LCD_W, MENU_TITLE_TOP - MENU_HEADER_HEIGHT, DEFAULT_BGCOLOR); // the white separation line
dc->drawSolidFilledRect(0, MENU_TITLE_TOP, LCD_W, MENU_TITLE_HEIGHT, TITLE_BGCOLOR); // the title line background
//
// if (topleftBitmap) {
// dc->drawBitmap(0, 0, topleftBitmap);
// uint16_t width = topleftBitmap->width();
// dc->drawSolidFilledRect(width, 0, LCD_W-width,
// MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
// }
// else {
dc->drawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
// }
//
// if (icon == ICON_OPENTX)
// dc->drawBitmap(4, 10, menuIconSelected[ICON_OPENTX]);
// else
// dc->drawBitmap(5, 7, menuIconSelected[icon]);
//
dc->drawSolidFilledRect(0, MENU_HEADER_HEIGHT, LCD_W,
MENU_TITLE_TOP - MENU_HEADER_HEIGHT,
DEFAULT_BGCOLOR); // the white separation line
dc->drawSolidFilledRect(0, MENU_TITLE_TOP, LCD_W, MENU_TITLE_HEIGHT,
TITLE_BGCOLOR); // the title line background
//
if (title) {
dc->drawText(MENUS_MARGIN_LEFT, MENU_TITLE_TOP + 2, title, MENU_COLOR);
}
@@ -382,19 +387,25 @@ class FlyskyTheme: public OpenTxTheme
return state == STATE_DEFAULT ? menuIconNormal[index] : menuIconSelected[index];
}
void drawMenuHeader(BitmapBuffer * dc, std::vector<PageTab *> & tabs, uint8_t currentIndex) const override
void drawPageHeader(BitmapBuffer *dc, std::vector<PageTab *> &tabs,
uint8_t currentIndex) const override
{
uint8_t padding_left = 4;
dc->drawSolidFilledRect(0, 0, 4, MENU_HEADER_BUTTON_WIDTH, HEADER_BGCOLOR);
dc->drawSolidFilledRect(0, 0, 4, MENU_HEADER_BUTTON_WIDTH,
HEADER_BGCOLOR);
for (unsigned i = 0; i < tabs.size(); i++) {
dc->drawBitmap(padding_left + i*MENU_HEADER_BUTTON_WIDTH, 0, theme->getIcon(tabs[i]->getIcon(), currentIndex == i ? STATE_PRESSED : STATE_DEFAULT));
dc->drawBitmap(
padding_left + i * MENU_HEADER_BUTTON_WIDTH, 0,
theme->getIcon(tabs[i]->getIcon(),
currentIndex == i ? STATE_PRESSED : STATE_DEFAULT));
}
// coord_t x = padding_left + MENU_HEADER_BUTTON_WIDTH * tabs.size();
// coord_t w = width() - x;
// if (w > 0) {
// dc->drawSolidFilledRect(x, 0, w, MENU_HEADER_BUTTON_WIDTH, HEADER_BGCOLOR);
// }
// coord_t x = padding_left + MENU_HEADER_BUTTON_WIDTH * tabs.size();
// coord_t w = width() - x;
// if (w > 0) {
// dc->drawSolidFilledRect(x, 0, w, MENU_HEADER_BUTTON_WIDTH,
// HEADER_BGCOLOR);
// }
}
void drawMenuDatetime(BitmapBuffer * dc) const
+4 -2
View File
@@ -36,11 +36,13 @@ void TimeEdit::paint(BitmapBuffer * dc)
if (editMode)
textColor = FOCUS_COLOR;
else if (hasFocus())
textColor = FOCUS_BGCOLOR;
textColor = FOCUS_COLOR;
else
textColor = DEFAULT_COLOR;
dc->drawText(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, getTimerString(getValue(), (textFlags & TIMEHOUR) != 0), textColor);
dc->drawText(FIELD_PADDING_LEFT, FIELD_PADDING_TOP,
getTimerString(getValue(), (textFlags & TIMEHOUR) != 0),
textColor);
}
#if defined(HARDWARE_KEYS)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB