Merge pull request #540 from jfrickmann/CustomizableColorScheme

Added OS theme colors as suggested by JimB40 in #506 and improved color handling in Lua
This commit is contained in:
Raphael Coeffic
2021-08-23 08:34:09 +02:00
committed by GitHub
73 changed files with 1041 additions and 1157 deletions
+7 -7
View File
@@ -354,17 +354,17 @@ typedef void (*timedTestFunc_t)(void);
void testDrawSolidFilledRectangle() void testDrawSolidFilledRectangle()
{ {
lcdDrawFilledRect(0, 0, LCD_W, LCD_H, SOLID, DEFAULT_BGCOLOR); lcdDrawFilledRect(0, 0, LCD_W, LCD_H, SOLID, COLOR_THEME_SECONDARY3);
} }
void testDrawFilledRectangle() void testDrawFilledRectangle()
{ {
lcdDrawFilledRect(0, 0, LCD_W, LCD_H, DOTTED, DEFAULT_BGCOLOR); lcdDrawFilledRect(0, 0, LCD_W, LCD_H, DOTTED, COLOR_THEME_SECONDARY3);
} }
void testDrawSolidFilledRoundedRectangle() void testDrawSolidFilledRoundedRectangle()
{ {
lcdDrawFilledRect(0, 0, LCD_W/2, LCD_H/2, SOLID, ROUND|DEFAULT_BGCOLOR); lcdDrawFilledRect(0, 0, LCD_W/2, LCD_H/2, SOLID, ROUND|COLOR_THEME_SECONDARY3);
} }
void testDrawBlackOverlay() void testDrawBlackOverlay()
@@ -394,7 +394,7 @@ void testDrawSolidVerticalLine2()
void testDrawDiagonalLine() void testDrawDiagonalLine()
{ {
lcdDrawLine(0,0, LCD_W, LCD_H, SOLID, DEFAULT_COLOR); lcdDrawLine(0,0, LCD_W, LCD_H, SOLID, COLOR_THEME_SECONDARY1);
} }
void testEmpty() void testEmpty()
@@ -403,17 +403,17 @@ void testEmpty()
void testDrawRect() void testDrawRect()
{ {
lcdDrawRect(0, 0, LCD_W, LCD_H, 2, SOLID, DEFAULT_COLOR); lcdDrawRect(0, 0, LCD_W, LCD_H, 2, SOLID, COLOR_THEME_SECONDARY1);
} }
void testDrawText() void testDrawText()
{ {
lcdDrawText(0, LCD_H/2, "The quick brown fox jumps over the lazy dog", DEFAULT_COLOR); lcdDrawText(0, LCD_H/2, "The quick brown fox jumps over the lazy dog", COLOR_THEME_SECONDARY1);
} }
void testDrawTextVertical() void testDrawTextVertical()
{ {
lcdDrawText(30, LCD_H, "The quick brown fox ", DEFAULT_COLOR|VERTICAL); lcdDrawText(30, LCD_H, "The quick brown fox ", COLOR_THEME_SECONDARY1|VERTICAL);
} }
void testClear() void testClear()
+23 -23
View File
@@ -58,7 +58,7 @@ class MixerChannelBar : public ChannelBar
chanVal = limit<int>(-VIEW_CHANNELS_LIMIT_PCT, chanVal, VIEW_CHANNELS_LIMIT_PCT); chanVal = limit<int>(-VIEW_CHANNELS_LIMIT_PCT, chanVal, VIEW_CHANNELS_LIMIT_PCT);
// Draw Background // Draw Background
dc->drawSolidFilledRect(0, 0, width(), height(), FIELD_BGCOLOR); dc->drawSolidFilledRect(0, 0, width(), height(), COLOR_THEME_PRIMARY2);
// Draw mixer bar // Draw mixer bar
if (chanVal > 0) { if (chanVal > 0) {
@@ -66,10 +66,10 @@ class MixerChannelBar : public ChannelBar
dc->drawSolidFilledRect( dc->drawSolidFilledRect(
0 + width() / 2, 0, 0 + width() / 2, 0,
divRoundClosest(chanVal * width(), VIEW_CHANNELS_LIMIT_PCT * 2), divRoundClosest(chanVal * width(), VIEW_CHANNELS_LIMIT_PCT * 2),
height(), FOCUS_BGCOLOR); height(), COLOR_THEME_FOCUS);
dc->drawNumber(width() / 2 - 10, 0, displayVal, dc->drawNumber(width() / 2 - 10, 0, displayVal,
FONT(XS) | DEFAULT_COLOR | RIGHT, 0, nullptr, "%"); FONT(XS) | COLOR_THEME_SECONDARY1 | RIGHT, 0, nullptr, "%");
} else if (chanVal < 0) { } else if (chanVal < 0) {
@@ -78,14 +78,14 @@ class MixerChannelBar : public ChannelBar
divRoundClosest(-chanVal * width(), VIEW_CHANNELS_LIMIT_PCT * 2); divRoundClosest(-chanVal * width(), VIEW_CHANNELS_LIMIT_PCT * 2);
dc->drawSolidFilledRect(endpoint - size, 0, size, height(), dc->drawSolidFilledRect(endpoint - size, 0, size, height(),
FOCUS_BGCOLOR); COLOR_THEME_FOCUS);
dc->drawNumber(10 + width() / 2, 0, displayVal, dc->drawNumber(10 + width() / 2, 0, displayVal,
FONT(XS) | DEFAULT_COLOR, 0, nullptr, "%"); FONT(XS) | COLOR_THEME_SECONDARY1, 0, nullptr, "%");
} }
// Draw middle bar // Draw middle bar
dc->drawSolidVerticalLine(width() / 2, 0, height(), DEFAULT_COLOR); dc->drawSolidVerticalLine(width() / 2, 0, height(), COLOR_THEME_SECONDARY1);
} }
void checkEvents() override void checkEvents() override
@@ -116,7 +116,7 @@ class OutputChannelBar : public ChannelBar
VIEW_CHANNELS_LIMIT_PCT); VIEW_CHANNELS_LIMIT_PCT);
// Draw Background // Draw Background
dc->drawSolidFilledRect(0, 0, width(), height(), FIELD_BGCOLOR); dc->drawSolidFilledRect(0, 0, width(), height(), COLOR_THEME_PRIMARY2);
// Draw output bar // Draw output bar
if (chanVal > 0) { if (chanVal > 0) {
@@ -124,10 +124,10 @@ class OutputChannelBar : public ChannelBar
dc->drawSolidFilledRect( dc->drawSolidFilledRect(
width() / 2, 0, width() / 2, 0,
divRoundClosest(chanVal * width(), VIEW_CHANNELS_LIMIT_PCT * 2), divRoundClosest(chanVal * width(), VIEW_CHANNELS_LIMIT_PCT * 2),
height(), HIGHLIGHT_COLOR); height(), COLOR_THEME_ACTIVE);
dc->drawNumber(width() / 2 - 10, 0, displayVal, dc->drawNumber(width() / 2 - 10, 0, displayVal,
FONT(XS) | DEFAULT_COLOR | RIGHT, 0, nullptr, "%"); FONT(XS) | COLOR_THEME_SECONDARY1 | RIGHT, 0, nullptr, "%");
} else if (chanVal < 0) { } else if (chanVal < 0) {
unsigned endpoint = width() / 2; unsigned endpoint = width() / 2;
@@ -135,14 +135,14 @@ class OutputChannelBar : public ChannelBar
divRoundClosest(-chanVal * width(), VIEW_CHANNELS_LIMIT_PCT * 2); divRoundClosest(-chanVal * width(), VIEW_CHANNELS_LIMIT_PCT * 2);
dc->drawSolidFilledRect(endpoint - size, 0, size, height(), dc->drawSolidFilledRect(endpoint - size, 0, size, height(),
HIGHLIGHT_COLOR); COLOR_THEME_ACTIVE);
dc->drawNumber(width() / 2 + 10, 0, displayVal, dc->drawNumber(width() / 2 + 10, 0, displayVal,
FONT(XS) | DEFAULT_COLOR, 0, nullptr, "%"); FONT(XS) | COLOR_THEME_SECONDARY1, 0, nullptr, "%");
} }
// Draw middle bar // Draw middle bar
dc->drawSolidVerticalLine(width() / 2, 0, height(), DEFAULT_COLOR); dc->drawSolidVerticalLine(width() / 2, 0, height(), COLOR_THEME_SECONDARY1);
// Draw output limits bars // Draw output limits bars
LimitData* ld = limitAddress(channel); LimitData* ld = limitAddress(channel);
@@ -162,13 +162,13 @@ class OutputChannelBar : public ChannelBar
void drawOutputBarLimits(BitmapBuffer * dc, coord_t left, coord_t right) void drawOutputBarLimits(BitmapBuffer * dc, coord_t left, coord_t right)
{ {
dc->drawSolidVerticalLine(left, 0, BAR_HEIGHT, DEFAULT_COLOR); dc->drawSolidVerticalLine(left, 0, BAR_HEIGHT, COLOR_THEME_SECONDARY1);
dc->drawSolidHorizontalLine(left, 0, 3, DEFAULT_COLOR); dc->drawSolidHorizontalLine(left, 0, 3, COLOR_THEME_SECONDARY1);
dc->drawSolidHorizontalLine(left, BAR_HEIGHT - 1, 3, DEFAULT_COLOR); dc->drawSolidHorizontalLine(left, BAR_HEIGHT - 1, 3, COLOR_THEME_SECONDARY1);
dc->drawSolidVerticalLine(right, 0, BAR_HEIGHT, DEFAULT_COLOR); dc->drawSolidVerticalLine(right, 0, BAR_HEIGHT, COLOR_THEME_SECONDARY1);
dc->drawSolidHorizontalLine(right - 3, 0, 3, DEFAULT_COLOR); dc->drawSolidHorizontalLine(right - 3, 0, 3, COLOR_THEME_SECONDARY1);
dc->drawSolidHorizontalLine(right - 3, BAR_HEIGHT - 1, 3, DEFAULT_COLOR); dc->drawSolidHorizontalLine(right - 3, BAR_HEIGHT - 1, 3, COLOR_THEME_SECONDARY1);
} }
void checkEvents() override void checkEvents() override
@@ -205,24 +205,24 @@ class ComboChannelBar : public ChannelBar
// Channel number // Channel number
strAppendSigned(&chanString[2], channel + 1, 2); strAppendSigned(&chanString[2], channel + 1, 2);
dc->drawText(lmargin, 0, chanString, FONT(XS) | DEFAULT_COLOR | LEFT); dc->drawText(lmargin, 0, chanString, FONT(XS) | COLOR_THEME_SECONDARY1 | LEFT);
// Channel name // Channel name
dc->drawSizedText(lmargin + 45, 0, g_model.limitData[channel].name, sizeof(g_model.limitData[channel].name), FONT(XS) | DEFAULT_COLOR | LEFT); dc->drawSizedText(lmargin + 45, 0, g_model.limitData[channel].name, sizeof(g_model.limitData[channel].name), FONT(XS) | COLOR_THEME_SECONDARY1 | LEFT);
// Channel value in µS // Channel value in µS
dc->drawNumber(width(), 0, usValue, FONT(XS) | DEFAULT_COLOR | RIGHT, 0, nullptr, STR_US); dc->drawNumber(width(), 0, usValue, FONT(XS) | COLOR_THEME_SECONDARY1 | RIGHT, 0, nullptr, STR_US);
// Override icon // Override icon
#if defined(OVERRIDE_CHANNEL_FUNCTION) #if defined(OVERRIDE_CHANNEL_FUNCTION)
if (safetyCh[channel] != OVERRIDE_CHANNEL_UNDEFINED) if (safetyCh[channel] != OVERRIDE_CHANNEL_UNDEFINED)
dc->drawMask(0, 1, chanMonLockedBitmap, DEFAULT_COLOR); dc->drawMask(0, 1, chanMonLockedBitmap, COLOR_THEME_SECONDARY1);
#endif #endif
// Channel reverted icon // Channel reverted icon
LimitData * ld = limitAddress(channel); LimitData * ld = limitAddress(channel);
if (ld && ld->revert) { if (ld && ld->revert) {
lcd->drawMask(0, 20, chanMonInvertedBitmap, DEFAULT_COLOR); lcd->drawMask(0, 20, chanMonInvertedBitmap, COLOR_THEME_SECONDARY1);
} }
} }
+29 -87
View File
@@ -30,55 +30,26 @@ enum LcdColorIndex
// this one first for when colour is not set // this one first for when colour is not set
DEFAULT_COLOR_INDEX, DEFAULT_COLOR_INDEX,
ALARM_COLOR_INDEX, COLOR_THEME_PRIMARY1_INDEX,
BARGRAPH1_COLOR_INDEX, COLOR_THEME_PRIMARY2_INDEX,
BARGRAPH2_COLOR_INDEX, COLOR_THEME_PRIMARY3_INDEX,
BARGRAPH_BGCOLOR_INDEX, COLOR_THEME_SECONDARY1_INDEX,
BATTERY_CHARGE_COLOR_INDEX, COLOR_THEME_SECONDARY2_INDEX,
CHECKBOX_COLOR_INDEX, COLOR_THEME_SECONDARY3_INDEX,
CURVE_AXIS_COLOR_INDEX, COLOR_THEME_FOCUS_INDEX,
CURVE_COLOR_INDEX, COLOR_THEME_EDIT_INDEX,
CURVE_CURSOR_COLOR_INDEX, COLOR_THEME_ACTIVE_INDEX,
COLOR_THEME_WARNING_INDEX,
COLOR_THEME_DISABLED_INDEX,
CUSTOM_COLOR_INDEX, CUSTOM_COLOR_INDEX,
DEFAULT_BGCOLOR_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_HIGHLIGHT_COLOR_INDEX,
MENU_LINE_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 // this one MUST be last
LCD_COLOR_COUNT, LCD_COLOR_COUNT,
}; };
//#define MENU_HIGHLIGHT_COLOR_INDEX HIGHLIGHT_COLOR_INDEX //#define COLOR_THEME_PRIMARY2_INDEX COLOR_THEME_ACTIVE_INDEX
//#define MENU_LINE_COLOR_INDEX LINE_COLOR_INDEX //#define COLOR_THEME_SECONDARY2_INDEX COLOR_THEME_PRIMARY3_INDEX
// //
@@ -101,6 +72,8 @@ enum LcdColorIndex
#define BRIGHTGREEN RGB(0, 180, 60) #define BRIGHTGREEN RGB(0, 180, 60)
#define ORANGE RGB(229, 100, 30) #define ORANGE RGB(229, 100, 30)
#define RGB2FLAGS(r, g, b) (COLOR2FLAGS(RGB(r, g, b)) | RGB_FLAG)
// //
// Indexed colors // Indexed colors
// //
@@ -111,54 +84,23 @@ inline void lcdSetColor(uint16_t color)
lcdColorTable[CUSTOM_COLOR_INDEX] = color; lcdColorTable[CUSTOM_COLOR_INDEX] = color;
} }
#define COLOR(index) ((uint32_t)lcdColorTable[ unsigned(index) & 0xFF ] << 16u) #define COLOR(index) ((uint32_t)lcdColorTable[unsigned(index & 0xFF) >= LCD_COLOR_COUNT ? DEFAULT_COLOR_INDEX : unsigned(index & 0xFF)] << 16u)
#define ALARM_COLOR COLOR(ALARM_COLOR_INDEX) #define COLOR_THEME_PRIMARY1 COLOR(COLOR_THEME_PRIMARY1_INDEX)
#define BARGRAPH1_COLOR COLOR(BARGRAPH1_COLOR_INDEX) #define COLOR_THEME_PRIMARY2 COLOR(COLOR_THEME_PRIMARY2_INDEX)
#define BARGRAPH2_COLOR COLOR(BARGRAPH2_COLOR_INDEX) #define COLOR_THEME_PRIMARY3 COLOR(COLOR_THEME_PRIMARY3_INDEX)
#define BARGRAPH_BGCOLOR COLOR(BARGRAPH_BGCOLOR_INDEX) #define COLOR_THEME_SECONDARY1 COLOR(COLOR_THEME_SECONDARY1_INDEX)
#define BATTERY_CHARGE_COLOR COLOR(BATTERY_CHARGE_COLOR_INDEX) #define COLOR_THEME_SECONDARY2 COLOR(COLOR_THEME_SECONDARY2_INDEX)
#define CHECKBOX_COLOR COLOR(CHECKBOX_COLOR_INDEX) #define COLOR_THEME_SECONDARY3 COLOR(COLOR_THEME_SECONDARY3_INDEX)
#define CURVE_AXIS_COLOR COLOR(CURVE_AXIS_COLOR_INDEX) #define COLOR_THEME_FOCUS COLOR(COLOR_THEME_FOCUS_INDEX)
#define CURVE_COLOR COLOR(CURVE_COLOR_INDEX) #define COLOR_THEME_EDIT COLOR(COLOR_THEME_EDIT_INDEX)
#define CURVE_CURSOR_COLOR COLOR(CURVE_CURSOR_COLOR_INDEX) #define COLOR_THEME_ACTIVE COLOR(COLOR_THEME_ACTIVE_INDEX)
#define CUSTOM_COLOR COLOR(CUSTOM_COLOR_INDEX) #define COLOR_THEME_WARNING COLOR(COLOR_THEME_WARNING_INDEX)
#define DEFAULT_BGCOLOR COLOR(DEFAULT_BGCOLOR_INDEX) #define COLOR_THEME_DISABLED COLOR(COLOR_THEME_DISABLED_INDEX)
#define DEFAULT_COLOR COLOR(DEFAULT_COLOR_INDEX) #define CUSTOM_COLOR COLOR(CUSTOM_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)
#define HEADER_COLOR COLOR(HEADER_COLOR_INDEX)
#define HEADER_CURRENT_BGCOLOR COLOR(HEADER_CURRENT_BGCOLOR_INDEX)
#define HEADER_ICON_BGCOLOR COLOR(HEADER_ICON_BGCOLOR_INDEX)
//#define HEADER_SEPARATOR_COLOR COLOR(HEADER_SEPARATOR_COLOR_INDEX)
#define HIGHLIGHT_COLOR COLOR(HIGHLIGHT_COLOR_INDEX)
#define LINE_COLOR COLOR(LINE_COLOR_INDEX)
#define MAINVIEW_GRAPHICS_COLOR COLOR(MAINVIEW_GRAPHICS_COLOR_INDEX)
#define MAINVIEW_PANES_COLOR COLOR(MAINVIEW_PANES_COLOR_INDEX)
#define MENU_BGCOLOR COLOR(MENU_BGCOLOR_INDEX)
#define MENU_COLOR COLOR(MENU_COLOR_INDEX)
#define MENU_HIGHLIGHT_BGCOLOR COLOR(MENU_HIGHLIGHT_BGCOLOR_INDEX)
#define MENU_HIGHLIGHT_COLOR COLOR(MENU_HIGHLIGHT_COLOR_INDEX)
#define MENU_LINE_COLOR COLOR(MENU_LINE_COLOR_INDEX)
//#define MENU_TITLE_BGCOLOR COLOR(MENU_TITLE_BGCOLOR_INDEX)
#define MENU_TITLE_DISABLE_COLOR COLOR(MENU_TITLE_DISABLE_COLOR_INDEX)
#define OVERLAY_COLOR COLOR(OVERLAY_COLOR_INDEX)
#define SCROLLBAR_COLOR COLOR(SCROLLBAR_COLOR_INDEX)
#define TABLE_BGCOLOR COLOR(TABLE_BGCOLOR_INDEX)
#define TABLE_HEADER_BGCOLOR COLOR(TABLE_HEADER_BGCOLOR_INDEX)
#define TEXT_DISABLE_COLOR COLOR(TEXT_DISABLE_COLOR_INDEX)
#define TEXT_STATUSBAR_COLOR COLOR(TEXT_STATUSBAR_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)
#if defined(WINDOWS_INSPECT_BORDERS) #if defined(WINDOWS_INSPECT_BORDERS)
#define WINDOWS_INSPECT_BORDER_COLOR LINE_COLOR #define WINDOWS_INSPECT_BORDER_COLOR COLOR_THEME_PRIMARY3
#endif #endif
#endif // _COLORS_H_ #endif // _COLORS_H_
+17 -17
View File
@@ -27,20 +27,20 @@
void Curve::drawBackground(BitmapBuffer * dc) void Curve::drawBackground(BitmapBuffer * dc)
{ {
dc->clear(FIELD_BGCOLOR); dc->clear(COLOR_THEME_PRIMARY2);
// Axis // Axis
dc->drawSolidHorizontalLine(0, height()/2, width(), FIELD_FRAME_COLOR); dc->drawSolidHorizontalLine(0, height()/2, width(), COLOR_THEME_SECONDARY2);
dc->drawSolidVerticalLine(width()/2, 0, height(), FIELD_FRAME_COLOR); dc->drawSolidVerticalLine(width()/2, 0, height(), COLOR_THEME_SECONDARY2);
// Extra lines // Extra lines
dc->drawVerticalLine(width()/4, 0, height(), STASHED, FIELD_FRAME_COLOR); dc->drawVerticalLine(width()/4, 0, height(), STASHED, COLOR_THEME_SECONDARY2);
dc->drawVerticalLine(width()*3/4, 0, height(), STASHED, FIELD_FRAME_COLOR); dc->drawVerticalLine(width()*3/4, 0, height(), STASHED, COLOR_THEME_SECONDARY2);
dc->drawHorizontalLine(0, height()/4, width(), STASHED, FIELD_FRAME_COLOR); dc->drawHorizontalLine(0, height()/4, width(), STASHED, COLOR_THEME_SECONDARY2);
dc->drawHorizontalLine(0, height()*3/4, width(), STASHED, FIELD_FRAME_COLOR); dc->drawHorizontalLine(0, height()*3/4, width(), STASHED, COLOR_THEME_SECONDARY2);
// Outside border // Outside border
dc->drawSolidRect(0, 0, width(), height(), 1, FIELD_FRAME_COLOR); dc->drawSolidRect(0, 0, width(), height(), 1, COLOR_THEME_SECONDARY2);
} }
coord_t Curve::getPointX(int x) const coord_t Curve::getPointX(int x) const
@@ -66,12 +66,12 @@ void Curve::drawCurve(BitmapBuffer * dc)
if (prev >= 0) { if (prev >= 0) {
if (prev < y) { if (prev < y) {
for (int tmp = prev; tmp <= y; tmp++) { for (int tmp = prev; tmp <= y; tmp++) {
dc->drawBitmapPattern(x - 2, tmp - 2, LBM_POINT, DEFAULT_COLOR); dc->drawBitmapPattern(x - 2, tmp - 2, LBM_POINT, COLOR_THEME_SECONDARY1);
} }
} }
else { else {
for (int tmp = y; tmp <= prev; tmp++) { for (int tmp = y; tmp <= prev; tmp++) {
dc->drawBitmapPattern(x - 2, tmp - 2, LBM_POINT, DEFAULT_COLOR); dc->drawBitmapPattern(x - 2, tmp - 2, LBM_POINT, COLOR_THEME_SECONDARY1);
} }
} }
} }
@@ -88,17 +88,17 @@ void Curve::drawPosition(BitmapBuffer * dc)
coord_t y = getPointY(valueY); coord_t y = getPointY(valueY);
// the 2 lines // the 2 lines
dc->drawSolidHorizontalLine(0, y, width(), HIGHLIGHT_COLOR); dc->drawSolidHorizontalLine(0, y, width(), COLOR_THEME_ACTIVE);
dc->drawSolidVerticalLine(x, 0, height(), HIGHLIGHT_COLOR); dc->drawSolidVerticalLine(x, 0, height(), COLOR_THEME_ACTIVE);
// the point (white inside) // the point (white inside)
dc->drawBitmapPattern(x-4, y-4, LBM_CURVE_POINT, HIGHLIGHT_COLOR); dc->drawBitmapPattern(x-4, y-4, LBM_CURVE_POINT, COLOR_THEME_ACTIVE);
dc->drawBitmapPattern(x-4, y-4, LBM_CURVE_POINT_CENTER, FOCUS_COLOR); dc->drawBitmapPattern(x-4, y-4, LBM_CURVE_POINT_CENTER, COLOR_THEME_PRIMARY2);
char coords[16]; char coords[16];
strAppendSigned(strAppend(strAppendSigned(coords, calcRESXto100(valueX)), ","), calcRESXto100(valueY)); strAppendSigned(strAppend(strAppendSigned(coords, calcRESXto100(valueX)), ","), calcRESXto100(valueY));
dc->drawSolidFilledRect(10, 11, 1 + getTextWidth(coords, 0, FONT(XS)), 17, HIGHLIGHT_COLOR); dc->drawSolidFilledRect(10, 11, 1 + getTextWidth(coords, 0, FONT(XS)), 17, COLOR_THEME_ACTIVE);
dc->drawText(11, 10, coords, FONT(XS) | FOCUS_COLOR); dc->drawText(11, 10, coords, FONT(XS) | COLOR_THEME_PRIMARY2);
} }
void Curve::drawPoint(BitmapBuffer * dc, const CurvePoint & point) void Curve::drawPoint(BitmapBuffer * dc, const CurvePoint & point)
@@ -107,7 +107,7 @@ void Curve::drawPoint(BitmapBuffer * dc, const CurvePoint & point)
coord_t y = getPointY(point.coords.y); coord_t y = getPointY(point.coords.y);
dc->drawBitmapPattern(x-4, y-4, LBM_CURVE_POINT, point.flags); dc->drawBitmapPattern(x-4, y-4, LBM_CURVE_POINT, point.flags);
dc->drawBitmapPattern(x-4, y-4, LBM_CURVE_POINT_CENTER, DEFAULT_BGCOLOR); dc->drawBitmapPattern(x-4, y-4, LBM_CURVE_POINT_CENTER, COLOR_THEME_SECONDARY3);
} }
void Curve::paint(BitmapBuffer * dc) void Curve::paint(BitmapBuffer * dc)
+5 -5
View File
@@ -52,8 +52,8 @@ void CurveDataEdit::update()
auto txt = new StaticText( auto txt = new StaticText(
this, this,
{i * boxWidth + PAGE_PADDING, 10, boxWidth - PAGE_PADDING, boxHeight}, {i * boxWidth + PAGE_PADDING, 10, boxWidth - PAGE_PADDING, boxHeight},
std::to_string(i + 1) + " ", 0, RIGHT | DEFAULT_COLOR); std::to_string(i + 1) + " ", 0, RIGHT | COLOR_THEME_SECONDARY1);
txt->setBackgroundColor(FIELD_FRAME_COLOR); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
} }
grid.spacer(boxHeight + 10 + PAGE_PADDING); grid.spacer(boxHeight + 10 + PAGE_PADDING);
@@ -88,7 +88,7 @@ void CurveDataEdit::update()
for (uint8_t i = 0; i < curvePointsCount; i++) { for (uint8_t i = 0; i < curvePointsCount; i++) {
new StaticText(this, {i * boxWidth, grid.getWindowHeight(), boxWidth, boxHeight}, new StaticText(this, {i * boxWidth, grid.getWindowHeight(), boxWidth, boxHeight},
std::to_string(-100 + 200 * i / (5 + curve.points - 1)), 0, std::to_string(-100 + 200 * i / (5 + curve.points - 1)), 0,
RIGHT | DEFAULT_COLOR); RIGHT | COLOR_THEME_SECONDARY1);
} }
} }
grid.spacer(boxHeight + PAGE_PADDING); grid.spacer(boxHeight + PAGE_PADDING);
@@ -116,7 +116,7 @@ void CurveDataEdit::update()
void CurveDataEdit::paint(BitmapBuffer * dc) void CurveDataEdit::paint(BitmapBuffer * dc)
{ {
dc->clear(DEFAULT_BGCOLOR); dc->clear(COLOR_THEME_SECONDARY3);
// dc->drawSolidHorizontalLine(0, rect.h / 3, getInnerWidth(), 0); // dc->drawSolidHorizontalLine(0, rect.h / 3, getInnerWidth(), 0);
// dc->drawSolidHorizontalLine(0, 2 * rect.h / 3, getInnerWidth(), 0); // dc->drawSolidHorizontalLine(0, 2 * rect.h / 3, getInnerWidth(), 0);
drawHorizontalScrollbar(dc); drawHorizontalScrollbar(dc);
@@ -144,7 +144,7 @@ void CurveEdit::updatePreview()
}; };
} }
else { else {
preview.addPoint(getPoint(index, i), DEFAULT_COLOR); preview.addPoint(getPoint(index, i), COLOR_THEME_SECONDARY1);
} }
} }
invalidate(); invalidate();
+18 -18
View File
@@ -32,20 +32,20 @@ void drawFunction(BitmapBuffer * dc, FnFuncP fn, int x, int y, int width)
int right = x + width; int right = x + width;
// Axis // Axis
dc->drawSolidHorizontalLine(left, y, width*2+1, DISABLE_COLOR); dc->drawSolidHorizontalLine(left, y, width*2+1, COLOR_THEME_DISABLED);
dc->drawSolidVerticalLine(x, y-width, width*2, DISABLE_COLOR); dc->drawSolidVerticalLine(x, y-width, width*2, COLOR_THEME_DISABLED);
// Extra lines // Extra lines
dc->drawVerticalLine(left+width/2, y-width, width*2, STASHED, DISABLE_COLOR); dc->drawVerticalLine(left+width/2, y-width, width*2, STASHED, COLOR_THEME_DISABLED);
dc->drawVerticalLine(right-width/2, y-width, width*2, STASHED, DISABLE_COLOR); dc->drawVerticalLine(right-width/2, y-width, width*2, STASHED, COLOR_THEME_DISABLED);
dc->drawHorizontalLine(left, y-width/2, width*2+1, STASHED, DISABLE_COLOR); dc->drawHorizontalLine(left, y-width/2, width*2+1, STASHED, COLOR_THEME_DISABLED);
dc->drawHorizontalLine(left, y+width/2, width*2+1, STASHED, DISABLE_COLOR); dc->drawHorizontalLine(left, y+width/2, width*2+1, STASHED, COLOR_THEME_DISABLED);
// Outside border // Outside border
dc->drawSolidVerticalLine(left, y-width, width*2, DEFAULT_COLOR); dc->drawSolidVerticalLine(left, y-width, width*2, COLOR_THEME_SECONDARY1);
dc->drawSolidVerticalLine(right, y-width, width*2, DEFAULT_COLOR); dc->drawSolidVerticalLine(right, y-width, width*2, COLOR_THEME_SECONDARY1);
dc->drawSolidHorizontalLine(left, y-width, width*2+1, DEFAULT_COLOR); dc->drawSolidHorizontalLine(left, y-width, width*2+1, COLOR_THEME_SECONDARY1);
dc->drawSolidHorizontalLine(left, y+width, width*2+1, DEFAULT_COLOR); dc->drawSolidHorizontalLine(left, y+width, width*2+1, COLOR_THEME_SECONDARY1);
coord_t prev_yv = (coord_t)-1; coord_t prev_yv = (coord_t)-1;
@@ -54,12 +54,12 @@ void drawFunction(BitmapBuffer * dc, FnFuncP fn, int x, int y, int width)
if (prev_yv != (coord_t)-1) { if (prev_yv != (coord_t)-1) {
if (prev_yv < yv) { if (prev_yv < yv) {
for (int y=prev_yv; y<=yv; y+=1) { for (int y=prev_yv; y<=yv; y+=1) {
dc->drawBitmapPattern(x+xv-2, y-2, LBM_POINT, DEFAULT_COLOR); dc->drawBitmapPattern(x+xv-2, y-2, LBM_POINT, COLOR_THEME_SECONDARY1);
} }
} }
else { else {
for (int y=yv; y<=prev_yv; y+=1) { for (int y=yv; y<=prev_yv; y+=1) {
dc->drawBitmapPattern(x+xv-2, y-2, LBM_POINT, DEFAULT_COLOR); dc->drawBitmapPattern(x+xv-2, y-2, LBM_POINT, COLOR_THEME_SECONDARY1);
} }
} }
} }
@@ -70,28 +70,28 @@ void drawFunction(BitmapBuffer * dc, FnFuncP fn, int x, int y, int width)
void drawCurveVerticalScale(BitmapBuffer * dc, int x) void drawCurveVerticalScale(BitmapBuffer * dc, int x)
{ {
for (int i=0; i<=20; i++) { for (int i=0; i<=20; i++) {
dc->drawSolidHorizontalLine(x, CURVE_CENTER_Y-CURVE_SIDE_WIDTH+i*CURVE_SIDE_WIDTH/10, 10, DEFAULT_COLOR); dc->drawSolidHorizontalLine(x, CURVE_CENTER_Y-CURVE_SIDE_WIDTH+i*CURVE_SIDE_WIDTH/10, 10, COLOR_THEME_SECONDARY1);
} }
} }
void drawCurveHorizontalScale(BitmapBuffer * dc) void drawCurveHorizontalScale(BitmapBuffer * dc)
{ {
for (int i=0; i<=20; i++) { for (int i=0; i<=20; i++) {
dc->drawSolidVerticalLine(CURVE_CENTER_X-CURVE_SIDE_WIDTH+i*CURVE_SIDE_WIDTH/10, CURVE_CENTER_Y+CURVE_SIDE_WIDTH+5, 10, DEFAULT_COLOR); dc->drawSolidVerticalLine(CURVE_CENTER_X-CURVE_SIDE_WIDTH+i*CURVE_SIDE_WIDTH/10, CURVE_CENTER_Y+CURVE_SIDE_WIDTH+5, 10, COLOR_THEME_SECONDARY1);
} }
} }
void drawCurveCoord(BitmapBuffer * dc, int x, int y, const char * text, bool active) void drawCurveCoord(BitmapBuffer * dc, int x, int y, const char * text, bool active)
{ {
dc->drawSolidFilledRect(x, y, CURVE_COORD_WIDTH, CURVE_COORD_HEIGHT, CURVE_CURSOR_COLOR); dc->drawSolidFilledRect(x, y, CURVE_COORD_WIDTH, CURVE_COORD_HEIGHT, COLOR_THEME_WARNING);
dc->drawText(x+3+(CURVE_COORD_WIDTH - 1 - getTextWidth(text, 0, FONT(XS))) / 2, y + 1, text, LEFT|FONT(XS)|DEFAULT_BGCOLOR); dc->drawText(x+3+(CURVE_COORD_WIDTH - 1 - getTextWidth(text, 0, FONT(XS))) / 2, y + 1, text, LEFT|FONT(XS)|COLOR_THEME_SECONDARY3);
if (active) { if (active) {
dc->drawBitmapPattern(x, y, LBM_CURVE_COORD_SHADOW, DEFAULT_COLOR); dc->drawBitmapPattern(x, y, LBM_CURVE_COORD_SHADOW, COLOR_THEME_SECONDARY1);
} }
} }
void drawCurvePoint(BitmapBuffer * dc, int x, int y, LcdFlags color) void drawCurvePoint(BitmapBuffer * dc, int x, int y, LcdFlags color)
{ {
dc->drawBitmapPattern(x, y, LBM_CURVE_POINT, color); dc->drawBitmapPattern(x, y, LBM_CURVE_POINT, color);
dc->drawBitmapPattern(x, y, LBM_CURVE_POINT_CENTER, DEFAULT_BGCOLOR); dc->drawBitmapPattern(x, y, LBM_CURVE_POINT_CENTER, COLOR_THEME_SECONDARY3);
} }
+4 -4
View File
@@ -33,25 +33,25 @@ coord_t drawStringWithIndex(BitmapBuffer * dc, coord_t x, coord_t y, const char
void drawStatusText(BitmapBuffer * dc, const char * text) void drawStatusText(BitmapBuffer * dc, const char * text)
{ {
dc->drawText(MENUS_MARGIN_LEFT, MENU_FOOTER_TOP, text, TEXT_STATUSBAR_COLOR); dc->drawText(MENUS_MARGIN_LEFT, MENU_FOOTER_TOP, text, COLOR_THEME_PRIMARY2);
} }
void drawVerticalScrollbar(BitmapBuffer * dc, coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible) void drawVerticalScrollbar(BitmapBuffer * dc, coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible)
{ {
if (visible < count) { if (visible < count) {
dc->drawSolidVerticalLine(x, y, h, LINE_COLOR); dc->drawSolidVerticalLine(x, y, h, COLOR_THEME_PRIMARY3);
coord_t yofs = (h*offset + count/2) / count; coord_t yofs = (h*offset + count/2) / count;
coord_t yhgt = (h*visible + count/2) / count; coord_t yhgt = (h*visible + count/2) / count;
if (yhgt + yofs > h) if (yhgt + yofs > h)
yhgt = h - yofs; yhgt = h - yofs;
dc->drawSolidFilledRect(x-1, y + yofs, 3, yhgt, CHECKBOX_COLOR); dc->drawSolidFilledRect(x-1, y + yofs, 3, yhgt, COLOR_THEME_FOCUS);
} }
} }
void drawTrimSquare(BitmapBuffer * dc, coord_t x, coord_t y, LcdFlags color) void drawTrimSquare(BitmapBuffer * dc, coord_t x, coord_t y, LcdFlags color)
{ {
dc->drawSolidFilledRect(x, y, 15, 15, color); dc->drawSolidFilledRect(x, y, 15, 15, color);
dc->drawBitmapPattern(x, y, LBM_TRIM_SHADOW, TRIM_SHADOW_COLOR); dc->drawBitmapPattern(x, y, LBM_TRIM_SHADOW, COLOR_THEME_PRIMARY1);
} }
void drawGVarValue(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t gvar, gvar_t value, LcdFlags flags) void drawGVarValue(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t gvar, gvar_t value, LcdFlags flags)
+1 -1
View File
@@ -56,7 +56,7 @@ void drawFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att);
void drawStatusText(BitmapBuffer * dc, const char * text); void drawStatusText(BitmapBuffer * dc, const char * text);
void drawVerticalScrollbar(BitmapBuffer * dc, coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible); void drawVerticalScrollbar(BitmapBuffer * dc, coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
void drawProgressScreen(BitmapBuffer * dc, const char * title, const char * message, int num, int den); void drawProgressScreen(BitmapBuffer * dc, const char * title, const char * message, int num, int den);
void drawTrimSquare(BitmapBuffer * dc, coord_t x, coord_t y, LcdFlags color = TRIM_BGCOLOR); void drawTrimSquare(BitmapBuffer * dc, coord_t x, coord_t y, LcdFlags color = COLOR_THEME_FOCUS);
void drawHorizontalTrimPosition(BitmapBuffer * dc, coord_t x, coord_t y, int16_t dir); void drawHorizontalTrimPosition(BitmapBuffer * dc, coord_t x, coord_t y, int16_t dir);
void drawVerticalTrimPosition(BitmapBuffer * dc, coord_t x, coord_t y, int16_t dir); void drawVerticalTrimPosition(BitmapBuffer * dc, coord_t x, coord_t y, int16_t dir);
void drawVerticalSlider(BitmapBuffer * dc, coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options); void drawVerticalSlider(BitmapBuffer * dc, coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options);
+1 -1
View File
@@ -53,6 +53,6 @@ void FabButton::paint(BitmapBuffer * dc)
const BitmapBuffer* mask = theme->getIconMask(icon); const BitmapBuffer* mask = theme->getIconMask(icon);
if (mask) { if (mask) {
dc->drawMask((width() - mask->width()) / 2, dc->drawMask((width() - mask->width()) / 2,
(FAB_BUTTON_SIZE - mask->height()) / 2, mask, DEFAULT_BGCOLOR); (FAB_BUTTON_SIZE - mask->height()) / 2, mask, COLOR_THEME_SECONDARY3);
} }
} }
+9 -9
View File
@@ -51,35 +51,35 @@ void FullScreenDialog::paint(BitmapBuffer * dc)
OpenTxTheme::instance()->drawBackground(dc); OpenTxTheme::instance()->drawBackground(dc);
dc->drawFilledRect(0, ALERT_FRAME_TOP, LCD_W, ALERT_FRAME_HEIGHT, SOLID, dc->drawFilledRect(0, ALERT_FRAME_TOP, LCD_W, ALERT_FRAME_HEIGHT, SOLID,
FOCUS_COLOR, OPACITY(8)); COLOR_THEME_PRIMARY2, OPACITY(8));
if (type == WARNING_TYPE_ALERT || type == WARNING_TYPE_ASTERISK) { if (type == WARNING_TYPE_ALERT || type == WARNING_TYPE_ASTERISK) {
dc->drawMask(ALERT_BITMAP_LEFT, ALERT_BITMAP_TOP, dc->drawMask(ALERT_BITMAP_LEFT, ALERT_BITMAP_TOP,
OpenTxTheme::instance()->error, ALARM_COLOR); OpenTxTheme::instance()->error, COLOR_THEME_WARNING);
} else if (type == WARNING_TYPE_INFO) { } else if (type == WARNING_TYPE_INFO) {
dc->drawMask(ALERT_BITMAP_LEFT, ALERT_BITMAP_TOP, dc->drawMask(ALERT_BITMAP_LEFT, ALERT_BITMAP_TOP,
OpenTxTheme::instance()->busy, ALARM_COLOR); OpenTxTheme::instance()->busy, COLOR_THEME_WARNING);
} else { // confirmation } else { // confirmation
dc->drawMask(ALERT_BITMAP_LEFT, ALERT_BITMAP_TOP, dc->drawMask(ALERT_BITMAP_LEFT, ALERT_BITMAP_TOP,
OpenTxTheme::instance()->error, ALARM_COLOR); OpenTxTheme::instance()->error, COLOR_THEME_WARNING);
} }
if (type == WARNING_TYPE_ALERT) { if (type == WARNING_TYPE_ALERT) {
#if defined(TRANSLATIONS_FR) || defined(TRANSLATIONS_IT) || \ #if defined(TRANSLATIONS_FR) || defined(TRANSLATIONS_IT) || \
defined(TRANSLATIONS_CZ) defined(TRANSLATIONS_CZ)
dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP, STR_WARNING, dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP, STR_WARNING,
ALARM_COLOR | FONT(XL)); COLOR_THEME_WARNING | FONT(XL));
dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP + ALERT_TITLE_LINE_HEIGHT, dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP + ALERT_TITLE_LINE_HEIGHT,
title.c_str(), ALARM_COLOR | FONT(XL)); title.c_str(), COLOR_THEME_WARNING | FONT(XL));
#else #else
dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP, title.c_str(), dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP, title.c_str(),
ALARM_COLOR | FONT(XL)); COLOR_THEME_WARNING | FONT(XL));
dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP + ALERT_TITLE_LINE_HEIGHT, dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP + ALERT_TITLE_LINE_HEIGHT,
STR_WARNING, ALARM_COLOR | FONT(XL)); STR_WARNING, COLOR_THEME_WARNING | FONT(XL));
#endif #endif
} else if (!title.empty()) { } else if (!title.empty()) {
dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP, title.c_str(), dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP, title.c_str(),
ALARM_COLOR | FONT(XL)); COLOR_THEME_WARNING | FONT(XL));
} }
if (!message.empty()) { if (!message.empty()) {
+9 -9
View File
@@ -28,15 +28,15 @@ void MainViewHorizontalSlider::paint(BitmapBuffer * dc)
coord_t x = TRIM_SQUARE_SIZE / 2; coord_t x = TRIM_SQUARE_SIZE / 2;
for (uint8_t i = 0; i <= SLIDER_TICKS_COUNT; i++) { for (uint8_t i = 0; i <= SLIDER_TICKS_COUNT; i++) {
if (i == 0 || i == SLIDER_TICKS_COUNT / 2 || i == SLIDER_TICKS_COUNT) if (i == 0 || i == SLIDER_TICKS_COUNT / 2 || i == SLIDER_TICKS_COUNT)
dc->drawSolidVerticalLine(x, 2, 13, DEFAULT_COLOR); dc->drawSolidVerticalLine(x, 2, 13, COLOR_THEME_SECONDARY1);
else else
dc->drawSolidVerticalLine(x, 4, 9, DEFAULT_COLOR); dc->drawSolidVerticalLine(x, 4, 9, COLOR_THEME_SECONDARY1);
x += delta; x += delta;
} }
// The square // The square
x = divRoundClosest((width() - TRIM_SQUARE_SIZE) * (value + RESX), 2 * RESX); x = divRoundClosest((width() - TRIM_SQUARE_SIZE) * (value + RESX), 2 * RESX);
drawTrimSquare(dc, x, 0, TRIM_BGCOLOR); drawTrimSquare(dc, x, 0, COLOR_THEME_FOCUS);
} }
void MainView6POS::paint(BitmapBuffer * dc) void MainView6POS::paint(BitmapBuffer * dc)
@@ -45,15 +45,15 @@ void MainView6POS::paint(BitmapBuffer * dc)
int delta = (width() - TRIM_SQUARE_SIZE) / (XPOTS_MULTIPOS_COUNT - 1); int delta = (width() - TRIM_SQUARE_SIZE) / (XPOTS_MULTIPOS_COUNT - 1);
coord_t x = TRIM_SQUARE_SIZE / 2; coord_t x = TRIM_SQUARE_SIZE / 2;
for (uint8_t i = 0; i <= XPOTS_MULTIPOS_COUNT; i++) { for (uint8_t i = 0; i <= XPOTS_MULTIPOS_COUNT; i++) {
dc->drawSolidVerticalLine(x, 4, 9, DEFAULT_COLOR); dc->drawSolidVerticalLine(x, 4, 9, COLOR_THEME_SECONDARY1);
x += delta; x += delta;
} }
// The square // The square
auto value = 1 + (potsPos[idx] & 0x0f); auto value = 1 + (potsPos[idx] & 0x0f);
x = TRIM_SQUARE_SIZE / 2 + divRoundClosest((width() - TRIM_SQUARE_SIZE) * (value -1) , 6); x = TRIM_SQUARE_SIZE / 2 + divRoundClosest((width() - TRIM_SQUARE_SIZE) * (value -1) , 6);
drawTrimSquare(dc, x, 0, TRIM_BGCOLOR); drawTrimSquare(dc, x, 0, COLOR_THEME_FOCUS);
dc->drawNumber(x + 1, 0, value, FOCUS_COLOR); dc->drawNumber(x + 1, 0, value, COLOR_THEME_PRIMARY2);
} }
void MainViewVerticalSlider::paint(BitmapBuffer * dc) void MainViewVerticalSlider::paint(BitmapBuffer * dc)
@@ -64,13 +64,13 @@ void MainViewVerticalSlider::paint(BitmapBuffer * dc)
coord_t y = TRIM_SQUARE_SIZE / 2; coord_t y = TRIM_SQUARE_SIZE / 2;
for (uint8_t i = 0; i <= sliderTicksCount; i++) { for (uint8_t i = 0; i <= sliderTicksCount; i++) {
if (i == 0 || i == sliderTicksCount / 2 || i == sliderTicksCount) if (i == 0 || i == sliderTicksCount / 2 || i == sliderTicksCount)
dc->drawSolidHorizontalLine(2, y, 13, DEFAULT_COLOR); dc->drawSolidHorizontalLine(2, y, 13, COLOR_THEME_SECONDARY1);
else else
dc->drawSolidHorizontalLine(4, y, 9, DEFAULT_COLOR); dc->drawSolidHorizontalLine(4, y, 9, COLOR_THEME_SECONDARY1);
y += delta; y += delta;
} }
// The square // The square
y = divRoundClosest((height() - TRIM_SQUARE_SIZE) * (-value + RESX), 2 * RESX); y = divRoundClosest((height() - TRIM_SQUARE_SIZE) * (-value + RESX), 2 * RESX);
drawTrimSquare(dc, 0, y, TRIM_BGCOLOR); drawTrimSquare(dc, 0, y, COLOR_THEME_FOCUS);
} }
+29 -28
View File
@@ -77,7 +77,7 @@ coord_t TopbarImpl::getVisibleHeight(float visible) const // 0.0 -> 1.0
void TopbarImpl::paint(BitmapBuffer * dc) void TopbarImpl::paint(BitmapBuffer * dc)
{ {
dc->drawSolidFilledRect(0, 0, width(), height(), HEADER_COLOR); dc->drawSolidFilledRect(0, 0, width(), height(), COLOR_THEME_SECONDARY1);
OpenTxTheme::instance()->drawTopLeftBitmap(dc); OpenTxTheme::instance()->drawTopLeftBitmap(dc);
struct gtm t; struct gtm t;
@@ -89,33 +89,34 @@ void TopbarImpl::paint(BitmapBuffer * dc)
const char * const STR_MONTHS[] = TR_MONTHS; const char * const STR_MONTHS[] = TR_MONTHS;
sprintf(str, "%d %s", t.tm_mday, STR_MONTHS[t.tm_mon]); sprintf(str, "%d %s", t.tm_mday, STR_MONTHS[t.tm_mon]);
#endif #endif
//dc->drawSolidVerticalLine(DATETIME_SEPARATOR_X, 7, 31, MENU_COLOR); //dc->drawSolidVerticalLine(DATETIME_SEPARATOR_X, 7, 31, COLOR_THEME_SECONDARY1);
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE1, str, FONT(XS)|FOCUS_COLOR|CENTERED); dc->drawText(DATETIME_MIDDLE, DATETIME_LINE1, str, FONT(XS) | CENTERED | COLOR_THEME_PRIMARY2);
getTimerString(str, getValue(MIXSRC_TX_TIME)); getTimerString(str, getValue(MIXSRC_TX_TIME));
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE2, str, FONT(XS)|FOCUS_COLOR|CENTERED); dc->drawText(DATETIME_MIDDLE, DATETIME_LINE2, str, FONT(XS) | CENTERED | COLOR_THEME_PRIMARY2);
#if defined(INTERNAL_GPS) #if defined(INTERNAL_GPS)
if (gpsData.fix) { if (gpsData.fix) {
char s[10]; char s[10];
sprintf(s, "%d", gpsData.numSat); sprintf(s, "%d", gpsData.numSat);
dc->drawText(GPS_X, 4, s, FONT(XS) | CENTERED | FOCUS_COLOR); dc->drawText(GPS_X, 4, s, FONT(XS) | CENTERED | COLOR_THEME_PRIMARY2);
} }
dc->drawBitmapPattern(GPS_X - 10, 22, LBM_TOPMENU_GPS, dc->drawBitmapPattern(GPS_X - 10, 22, LBM_TOPMENU_GPS,
(gpsData.fix) ? FOCUS_COLOR : MENU_TITLE_DISABLE_COLOR); (gpsData.fix) ? COLOR_THEME_PRIMARY2 : COLOR_THEME_PRIMARY3);
#endif #endif
// USB icon // USB icon
if (usbPlugged()) { if (usbPlugged()) {
LcdFlags flags = FOCUS_COLOR;
LcdFlags flags = COLOR_THEME_PRIMARY2;
if (getSelectedUsbMode() == USB_UNSELECTED_MODE) { if (getSelectedUsbMode() == USB_UNSELECTED_MODE) {
flags = MENU_TITLE_DISABLE_COLOR; flags = COLOR_THEME_PRIMARY3;
} }
dc->drawBitmapPattern(USB_X, 8, LBM_TOPMENU_USB, flags); dc->drawBitmapPattern(USB_X, 8, LBM_TOPMENU_USB, flags);
} }
// Logs // Logs
else if (isFunctionActive(FUNCTION_LOGS) && BLINK_ON_PHASE) { else if (isFunctionActive(FUNCTION_LOGS) && BLINK_ON_PHASE) {
dc->drawBitmapPattern(LOG_X, 6, LBM_DOT, FOCUS_COLOR); dc->drawBitmapPattern(LOG_X, 6, LBM_DOT, COLOR_THEME_PRIMARY2);
} }
// RSSI // RSSI
@@ -125,49 +126,49 @@ void TopbarImpl::paint(BitmapBuffer * dc)
uint8_t height = rssiBarsHeight[i]; uint8_t height = rssiBarsHeight[i];
dc->drawSolidFilledRect(RSSI_X + i * 6, 38 - height, 4, height, dc->drawSolidFilledRect(RSSI_X + i * 6, 38 - height, 4, height,
TELEMETRY_RSSI() >= rssiBarsValue[i] TELEMETRY_RSSI() >= rssiBarsValue[i]
? FOCUS_COLOR ? COLOR_THEME_PRIMARY2
: MENU_TITLE_DISABLE_COLOR); : COLOR_THEME_PRIMARY3);
} }
#if defined(INTERNAL_MODULE_PXX1) && defined(EXTERNAL_ANTENNA) #if defined(INTERNAL_MODULE_PXX1) && defined(EXTERNAL_ANTENNA)
if (isModuleXJT(INTERNAL_MODULE) && isExternalAntennaEnabled()) { if (isModuleXJT(INTERNAL_MODULE) && isExternalAntennaEnabled()) {
dc->drawBitmapPattern(RSSI_X - 4, 4, LBM_TOPMENU_ANTENNA, FOCUS_COLOR); dc->drawBitmapPattern(RSSI_X - 4, 4, LBM_TOPMENU_ANTENNA, COLOR_THEME_PRIMARY2);
} }
#endif #endif
/* Audio volume */ /* Audio volume */
dc->drawBitmapPattern(AUDIO_X, 4, LBM_TOPMENU_VOLUME_SCALE, MENU_TITLE_DISABLE_COLOR); dc->drawBitmapPattern(AUDIO_X, 4, LBM_TOPMENU_VOLUME_SCALE, COLOR_THEME_PRIMARY3);
if (requiredSpeakerVolume == 0 || g_eeGeneral.beepMode == e_mode_quiet) if (requiredSpeakerVolume == 0 || g_eeGeneral.beepMode == e_mode_quiet)
dc->drawBitmapPattern(AUDIO_X, 4, LBM_TOPMENU_VOLUME_0, FOCUS_COLOR); dc->drawBitmapPattern(AUDIO_X, 4, LBM_TOPMENU_VOLUME_0, COLOR_THEME_PRIMARY2);
else if (requiredSpeakerVolume < 7) else if (requiredSpeakerVolume < 7)
dc->drawBitmapPattern(AUDIO_X, 4, LBM_TOPMENU_VOLUME_1, FOCUS_COLOR); dc->drawBitmapPattern(AUDIO_X, 4, LBM_TOPMENU_VOLUME_1, COLOR_THEME_PRIMARY2);
else if (requiredSpeakerVolume < 13) else if (requiredSpeakerVolume < 13)
dc->drawBitmapPattern(AUDIO_X, 4, LBM_TOPMENU_VOLUME_2, FOCUS_COLOR); dc->drawBitmapPattern(AUDIO_X, 4, LBM_TOPMENU_VOLUME_2, COLOR_THEME_PRIMARY2);
else if (requiredSpeakerVolume < 19) else if (requiredSpeakerVolume < 19)
dc->drawBitmapPattern(AUDIO_X, 4, LBM_TOPMENU_VOLUME_3, FOCUS_COLOR); dc->drawBitmapPattern(AUDIO_X, 4, LBM_TOPMENU_VOLUME_3, COLOR_THEME_PRIMARY2);
else else
dc->drawBitmapPattern(AUDIO_X, 4, LBM_TOPMENU_VOLUME_4, FOCUS_COLOR); dc->drawBitmapPattern(AUDIO_X, 4, LBM_TOPMENU_VOLUME_4, COLOR_THEME_PRIMARY2);
/* Tx battery */ /* Tx battery */
uint8_t bars = GET_TXBATT_BARS(5); uint8_t bars = GET_TXBATT_BARS(5);
#if defined(USB_CHARGER) #if defined(USB_CHARGER)
if (usbChargerLed()) { if (usbChargerLed()) {
dc->drawBitmapPattern(AUDIO_X, 25, LBM_TOPMENU_TXBATT_CHARGING, FOCUS_COLOR); dc->drawBitmapPattern(AUDIO_X, 25, LBM_TOPMENU_TXBATT_CHARGING, COLOR_THEME_PRIMARY2);
} }
else { else {
dc->drawBitmapPattern(AUDIO_X, 25, LBM_TOPMENU_TXBATT, FOCUS_COLOR); dc->drawBitmapPattern(AUDIO_X, 25, LBM_TOPMENU_TXBATT, COLOR_THEME_PRIMARY2);
} }
#else #else
dc->drawBitmapPattern(AUDIO_X, 25, LBM_TOPMENU_TXBATT, FOCUS_COLOR); dc->drawBitmapPattern(AUDIO_X, 25, LBM_TOPMENU_TXBATT, COLOR_THEME_PRIMARY2);
#endif #endif
for (unsigned int i = 0; i < 5; i++) { for (unsigned int i = 0; i < 5; i++) {
dc->drawSolidFilledRect(AUDIO_X - 2 + 4 * i, 30, 2, 8, i >= bars ? MENU_TITLE_DISABLE_COLOR : FOCUS_COLOR); dc->drawSolidFilledRect(AUDIO_X - 2 + 4 * i, 30, 2, 8, i >= bars ? COLOR_THEME_PRIMARY3 : COLOR_THEME_PRIMARY2);
} }
#if 0 #if 0
// Radio battery - TODO // Radio battery - TODO
// drawValueWithUnit(370, 8, g_vbat100mV, UNIT_VOLTS, PREC1|FONT(XS)|MENU_COLOR); // drawValueWithUnit(370, 8, g_vbat100mV, UNIT_VOLTS, PREC1|FONT(XS)|COLOR_THEME_SECONDARY1);
// lcdDrawSolidRect(300, 3, 20, 50, MENU_COLOR); // lcdDrawSolidRect(300, 3, 20, 50, COLOR_THEME_SECONDARY1);
// lcdDrawRect(batt_icon_x+FW, BAR_Y+1, 13, 7); // lcdDrawRect(batt_icon_x+FW, BAR_Y+1, 13, 7);
// lcdDrawSolidVerticalLine(batt_icon_x+FW+13, BAR_Y+2, 5); // lcdDrawSolidVerticalLine(batt_icon_x+FW+13, BAR_Y+2, 5);
@@ -185,8 +186,8 @@ void TopbarImpl::paint(BitmapBuffer * dc)
else if (sensor.prec == 1) { else if (sensor.prec == 1) {
att |= PREC1; att |= PREC1;
} }
att |= (item.isOld() ? ALARM_COLOR : DEFAULT_COLOR); att |= (item.isOld() ? COLOR_THEME_WARNING : COLOR_THEME_SECONDARY1);
lcdDrawSolidFilledRect(ALTITUDE_X, VOLTS_Y, ALTITUDE_W, ALTITUDE_H, DEFAULT_BGCOLOR); lcdDrawSolidFilledRect(ALTITUDE_X, VOLTS_Y, ALTITUDE_W, ALTITUDE_H, COLOR_THEME_SECONDARY3);
lcdDrawText(ALTITUDE_X+PADDING, VOLTS_Y+2, "Voltage", att); lcdDrawText(ALTITUDE_X+PADDING, VOLTS_Y+2, "Voltage", att);
drawValueWithUnit(ALTITUDE_X+PADDING, VOLTS_Y+12, value, UNIT_VOLTS, FONT(XL)|LEFT|att); drawValueWithUnit(ALTITUDE_X+PADDING, VOLTS_Y+12, value, UNIT_VOLTS, FONT(XL)|LEFT|att);
} }
@@ -199,8 +200,8 @@ void TopbarImpl::paint(BitmapBuffer * dc)
int32_t value = item.value; int32_t value = item.value;
TelemetrySensor & sensor = g_model.telemetrySensors[g_model.frsky.altitudeSource-1]; TelemetrySensor & sensor = g_model.telemetrySensors[g_model.frsky.altitudeSource-1];
if (sensor.prec) value /= sensor.prec == 2 ? 100 : 10; if (sensor.prec) value /= sensor.prec == 2 ? 100 : 10;
LcdFlags att = (item.isOld() ? ALARM_COLOR : DEFAULT_COLOR); LcdFlags att = (item.isOld() ? COLOR_THEME_WARNING : COLOR_THEME_SECONDARY1);
lcdDrawSolidFilledRect(ALTITUDE_X, ALTITUDE_Y, ALTITUDE_W, ALTITUDE_H, DEFAULT_BGCOLOR); lcdDrawSolidFilledRect(ALTITUDE_X, ALTITUDE_Y, ALTITUDE_W, ALTITUDE_H, COLOR_THEME_SECONDARY3);
lcdDrawText(ALTITUDE_X+PADDING, ALTITUDE_Y+2, "Alt", att); lcdDrawText(ALTITUDE_X+PADDING, ALTITUDE_Y+2, "Alt", att);
drawValueWithUnit(ALTITUDE_X+PADDING, ALTITUDE_Y+12, value, UNIT_METERS, FONT(XL)|LEFT|att); drawValueWithUnit(ALTITUDE_X+PADDING, ALTITUDE_Y+12, value, UNIT_METERS, FONT(XL)|LEFT|att);
} }
+12 -12
View File
@@ -51,28 +51,28 @@ void MainViewHorizontalTrim::paint(BitmapBuffer * dc)
// Trim line // Trim line
dc->drawSolidFilledRect( dc->drawSolidFilledRect(
TRIM_SQUARE_SIZE / 2, (height() - TRIM_LINE_WIDTH - 1) / 2, TRIM_SQUARE_SIZE / 2, (height() - TRIM_LINE_WIDTH - 1) / 2,
width() - TRIM_SQUARE_SIZE + 1, TRIM_LINE_WIDTH, DEFAULT_COLOR); width() - TRIM_SQUARE_SIZE + 1, TRIM_LINE_WIDTH, COLOR_THEME_SECONDARY1);
// Trim square // Trim square
coord_t x = divRoundClosest((width() - TRIM_SQUARE_SIZE) * (dispVal - trimMin), coord_t x = divRoundClosest((width() - TRIM_SQUARE_SIZE) * (dispVal - trimMin),
trimMax - trimMin); trimMax - trimMin);
drawTrimSquare(dc, x, 0, drawTrimSquare(dc, x, 0,
(value < TRIM_MIN || value > TRIM_MAX) (value < TRIM_MIN || value > TRIM_MAX)
? HIGHLIGHT_COLOR /* TODO add a color */ ? COLOR_THEME_ACTIVE /* TODO add a color */
: TRIM_BGCOLOR); : COLOR_THEME_FOCUS);
// Trim value / small lines on the square // Trim value / small lines on the square
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS) { if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS) {
// TODO DISPLAY_TRIMS_CHANGE // TODO DISPLAY_TRIMS_CHANGE
dc->drawNumber(x + (TRIM_SQUARE_SIZE + 1) / 2, 3, dc->drawNumber(x + (TRIM_SQUARE_SIZE + 1) / 2, 3,
divRoundClosest(value * 100, trimMax), divRoundClosest(value * 100, trimMax),
FONT(XXS) | FOCUS_COLOR | CENTERED); FONT(XXS) | COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
if (value >= 0) { if (value >= 0) {
dc->drawSolidVerticalLine(x + 4, 3, 9, FOCUS_COLOR); dc->drawSolidVerticalLine(x + 4, 3, 9, COLOR_THEME_PRIMARY2);
} }
if (value <= 0) { if (value <= 0) {
dc->drawSolidVerticalLine(x + 10, 3, 9, FOCUS_COLOR); dc->drawSolidVerticalLine(x + 10, 3, 9, COLOR_THEME_PRIMARY2);
} }
} }
} }
@@ -96,7 +96,7 @@ void MainViewVerticalTrim::paint(BitmapBuffer * dc)
// Trim line // Trim line
dc->drawSolidFilledRect((width() - TRIM_LINE_WIDTH) / 2, TRIM_SQUARE_SIZE / 2, dc->drawSolidFilledRect((width() - TRIM_LINE_WIDTH) / 2, TRIM_SQUARE_SIZE / 2,
TRIM_LINE_WIDTH, height() - TRIM_SQUARE_SIZE + 1, TRIM_LINE_WIDTH, height() - TRIM_SQUARE_SIZE + 1,
DEFAULT_COLOR); COLOR_THEME_SECONDARY1);
// Trim square // Trim square
coord_t y = coord_t y =
@@ -105,21 +105,21 @@ void MainViewVerticalTrim::paint(BitmapBuffer * dc)
trimMax - trimMin); trimMax - trimMin);
drawTrimSquare(dc, 0, y, drawTrimSquare(dc, 0, y,
(value < TRIM_MIN || value > TRIM_MAX) (value < TRIM_MIN || value > TRIM_MAX)
? HIGHLIGHT_COLOR /* TODO add a color */ ? COLOR_THEME_ACTIVE /* TODO add a color */
: TRIM_BGCOLOR); : COLOR_THEME_FOCUS);
// Trim value / small lines on the square // Trim value / small lines on the square
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS) { if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS) {
// TODO DISPLAY_TRIMS_CHANGE // TODO DISPLAY_TRIMS_CHANGE
dc->drawNumber((TRIM_SQUARE_SIZE + 1) / 2, y + 3, dc->drawNumber((TRIM_SQUARE_SIZE + 1) / 2, y + 3,
divRoundClosest(value * 100, trimMax), divRoundClosest(value * 100, trimMax),
FONT(XXS) | FOCUS_COLOR | CENTERED); FONT(XXS) | COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
if (value >= 0) { if (value >= 0) {
dc->drawSolidHorizontalLine(3, y + 4, 9, FOCUS_COLOR); dc->drawSolidHorizontalLine(3, y + 4, 9, COLOR_THEME_PRIMARY2);
} }
if (value <= 0) { if (value <= 0) {
dc->drawSolidHorizontalLine(3, y + 10, 9, FOCUS_COLOR); dc->drawSolidHorizontalLine(3, y + 10, 9, COLOR_THEME_PRIMARY2);
} }
} }
} }
+12 -12
View File
@@ -108,19 +108,19 @@ bool CheckBox(W * window, rect_t & rect, const char * label, uint8_t & value, Lc
drawText(window, rect.x, rect.y+4, label); drawText(window, rect.x, rect.y+4, label);
coord_t x = rect.x + rect.w - 20; coord_t x = rect.x + rect.w - 20;
if (hasFocus) { if (hasFocus) {
window->drawSolidFilledRect(x-1, rect.y+8, 14, 14, FOCUS_BGCOLOR); window->drawSolidFilledRect(x-1, rect.y+8, 14, 14, COLOR_THEME_FOCUS);
window->drawSolidFilledRect(x+1, rect.y+10, 10, 10, DEFAULT_BGCOLOR); window->drawSolidFilledRect(x+1, rect.y+10, 10, 10, COLOR_THEME_SECONDARY3);
if (value) { if (value) {
window->drawSolidFilledRect(x+2, rect.y+11, 8, 8, FOCUS_BGCOLOR); window->drawSolidFilledRect(x+2, rect.y+11, 8, 8, COLOR_THEME_FOCUS);
} }
} }
else { else {
if (value) { if (value) {
window->drawSolidFilledRect(x+2, rect.y+11, 8, 8, CHECKBOX_COLOR); window->drawSolidFilledRect(x+2, rect.y+11, 8, 8, COLOR_THEME_FOCUS);
drawSolidRect(window, x, rect.y+9, 12, 12, 1, LINE_COLOR); drawSolidRect(window, x, rect.y+9, 12, 12, 1, COLOR_THEME_PRIMARY3);
} }
else { else {
drawSolidRect(window, x, rect.y+9, 12, 12, 1, LINE_COLOR); drawSolidRect(window, x, rect.y+9, 12, 12, 1, COLOR_THEME_PRIMARY3);
} }
} }
if (window->touchPressed(rect.x, rect.y, rect.w, rect.h)) { if (window->touchPressed(rect.x, rect.y, rect.w, rect.h)) {
@@ -150,10 +150,10 @@ bool Choice(W * window, rect_t & rect, const char * label, const char * values,
rect.h = 30; rect.h = 30;
bool hasFocus = (flags & HAS_FOCUS) || window->hasFocus(rect.x, rect.y); bool hasFocus = (flags & HAS_FOCUS) || window->hasFocus(rect.x, rect.y);
LcdFlags textColor = 0; LcdFlags textColor = 0;
LcdFlags lineColor = DISABLE_COLOR; LcdFlags lineColor = COLOR_THEME_DISABLED;
if (hasFocus) { if (hasFocus) {
textColor = FOCUS_BGCOLOR; textColor = COLOR_THEME_FOCUS;
lineColor = FOCUS_BGCOLOR; lineColor = COLOR_THEME_FOCUS;
} }
drawTextAtIndex(window, rect.x, rect.y + 9, values, value, textColor); drawTextAtIndex(window, rect.x, rect.y + 9, values, value, textColor);
drawWidgetLine(window, rect, lineColor); drawWidgetLine(window, rect, lineColor);
@@ -175,10 +175,10 @@ bool TextEdit(W * window, rect_t & rect, const char * label, char * value, uint8
rect.h = 30; rect.h = 30;
bool hasFocus = (flags & HAS_FOCUS) || window->hasFocus(rect.x, rect.y); bool hasFocus = (flags & HAS_FOCUS) || window->hasFocus(rect.x, rect.y);
LcdFlags textColor = 0; LcdFlags textColor = 0;
LcdFlags lineColor = DISABLE_COLOR; LcdFlags lineColor = COLOR_THEME_DISABLED;
if (hasFocus) { if (hasFocus) {
textColor = FOCUS_BGCOLOR; textColor = COLOR_THEME_FOCUS;
lineColor = FOCUS_BGCOLOR; lineColor = COLOR_THEME_FOCUS;
} }
if (!hasFocus && zlen(value, length) == 0) if (!hasFocus && zlen(value, length) == 0)
menuBodyWindow.drawSizedText(rect.x, rect.y + 9, "---", length, textColor); menuBodyWindow.drawSizedText(rect.x, rect.y + 9, "---", length, textColor);
+10 -10
View File
@@ -45,13 +45,13 @@ class CurveEditWindow : public Page
new StaticText(window, new StaticText(window,
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
PAGE_LINE_HEIGHT}, PAGE_LINE_HEIGHT},
STR_MENUCURVE, 0, FOCUS_COLOR); STR_MENUCURVE, 0, COLOR_THEME_PRIMARY2);
char s[16]; char s[16];
strAppendStringWithIndex(s, STR_CV, index + 1); strAppendStringWithIndex(s, STR_CV, index + 1);
new StaticText(window, new StaticText(window,
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT},
s, 0, FOCUS_COLOR); s, 0, COLOR_THEME_PRIMARY2);
} }
#if LCD_W > LCD_H #if LCD_W > LCD_H
@@ -236,13 +236,13 @@ class CurveButton : public Button {
void paint(BitmapBuffer * dc) override void paint(BitmapBuffer * dc) override
{ {
dc->drawSolidFilledRect(0, 0, rect.w, rect.h, FIELD_BGCOLOR); dc->drawSolidFilledRect(0, 0, rect.w, rect.h, COLOR_THEME_PRIMARY2);
// bounding rect // bounding rect
if (hasFocus()) { if (hasFocus()) {
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, FOCUS_BGCOLOR); dc->drawSolidRect(0, 0, rect.w, rect.h, 2, COLOR_THEME_FOCUS);
} else { } else {
dc->drawSolidRect(0, 0, rect.w, rect.h, 1, FIELD_FRAME_COLOR); dc->drawSolidRect(0, 0, rect.w, rect.h, 1, COLOR_THEME_SECONDARY2);
} }
// curve characteristics // curve characteristics
@@ -339,10 +339,10 @@ void ModelCurvesPage::build(FormWindow * window, int8_t focusIndex)
}); });
button->setFocusHandler([=](bool focus) { button->setFocusHandler([=](bool focus) {
if (focus) { if (focus) {
txt->setBackgroundColor(FOCUS_BGCOLOR); txt->setBackgroundColor(COLOR_THEME_FOCUS);
txt->setTextFlags(FOCUS_COLOR | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
txt->setBackgroundColor(FIELD_FRAME_COLOR); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED); txt->setTextFlags(CENTERED);
} }
txt->invalidate(); txt->invalidate();
@@ -350,8 +350,8 @@ void ModelCurvesPage::build(FormWindow * window, int8_t focusIndex)
if (focusIndex == index) { if (focusIndex == index) {
button->setFocus(SET_FOCUS_DEFAULT); button->setFocus(SET_FOCUS_DEFAULT);
txt->setBackgroundColor(FOCUS_BGCOLOR); txt->setBackgroundColor(COLOR_THEME_FOCUS);
txt->setTextFlags(FOCUS_COLOR | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
txt->invalidate(); txt->invalidate();
} }
+2 -2
View File
@@ -56,10 +56,10 @@ class FlightModeGroup: public FormGroup
void paint(BitmapBuffer * dc) override void paint(BitmapBuffer * dc) override
{ {
if (index == getFlightMode()) { if (index == getFlightMode()) {
dc->drawSolidFilledRect(0, 0, width(), height(), HIGHLIGHT_COLOR); dc->drawSolidFilledRect(0, 0, width(), height(), COLOR_THEME_ACTIVE);
} }
else { else {
dc->drawSolidFilledRect(0, 0, width(), height(), FIELD_BGCOLOR); dc->drawSolidFilledRect(0, 0, width(), height(), COLOR_THEME_PRIMARY2);
} }
FormGroup::paint(dc); FormGroup::paint(dc);
} }
+11 -11
View File
@@ -64,15 +64,15 @@ void GVarButton::paint(BitmapBuffer * dc)
currentFlightMode = getFlightMode(); currentFlightMode = getFlightMode();
gvarSum = 0; gvarSum = 0;
LcdFlags bgColor = FIELD_BGCOLOR; LcdFlags bgColor = COLOR_THEME_PRIMARY2;
LcdFlags textColor = 0; LcdFlags textColor = 0;
if (hasFocus()) { if (hasFocus()) {
bgColor = FOCUS_BGCOLOR; bgColor = COLOR_THEME_FOCUS;
textColor = FOCUS_COLOR; textColor = COLOR_THEME_PRIMARY2;
} }
dc->drawSolidFilledRect(0, 0, nameRectW, rect.h, bgColor); dc->drawSolidFilledRect(0, 0, nameRectW, rect.h, bgColor);
dc->drawSolidFilledRect(nameRectW, 0, rect.w - nameRectW, rect.h, FIELD_BGCOLOR); dc->drawSolidFilledRect(nameRectW, 0, rect.w - nameRectW, rect.h, COLOR_THEME_PRIMARY2);
dc->drawText(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, getGVarString(gvarIdx), textColor); dc->drawText(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, getGVarString(gvarIdx), textColor);
dc->drawSizedText(x, y, gvar->name, LEN_GVAR_NAME, textColor); dc->drawSizedText(x, y, gvar->name, LEN_GVAR_NAME, textColor);
@@ -101,7 +101,7 @@ void GVarButton::paint(BitmapBuffer * dc)
if (!bgFilled) { if (!bgFilled) {
dc->drawSolidFilledRect(startX, y, width() - startX, PAGE_LINE_HEIGHT, dc->drawSolidFilledRect(startX, y, width() - startX, PAGE_LINE_HEIGHT,
FIELD_FRAME_COLOR); COLOR_THEME_SECONDARY2);
bgFilled = true; bgFilled = true;
} }
@@ -127,9 +127,9 @@ void GVarButton::paint(BitmapBuffer * dc)
} }
if (hasFocus()) if (hasFocus())
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, FOCUS_BGCOLOR); dc->drawSolidRect(0, 0, rect.w, rect.h, 2, COLOR_THEME_FOCUS);
else else
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, FIELD_FRAME_COLOR); dc->drawSolidRect(0, 0, rect.w, rect.h, 2, COLOR_THEME_SECONDARY2);
} }
void GVarButton::drawFlightMode(BitmapBuffer * dc, coord_t x, coord_t y, int fm, LcdFlags attr) void GVarButton::drawFlightMode(BitmapBuffer * dc, coord_t x, coord_t y, int fm, LcdFlags attr)
@@ -145,16 +145,16 @@ void GVarRenderer::paint(BitmapBuffer * dc)
FlightModeData * fmData = &g_model.flightModeData[lastFlightMode]; FlightModeData * fmData = &g_model.flightModeData[lastFlightMode];
lastGVar = fmData->gvars[index]; lastGVar = fmData->gvars[index];
coord_t x = drawStringWithIndex(dc, 0, FIELD_PADDING_TOP, STR_GV, index + 1, coord_t x = drawStringWithIndex(dc, 0, FIELD_PADDING_TOP, STR_GV, index + 1,
FOCUS_COLOR, nullptr, "="); COLOR_THEME_PRIMARY2, nullptr, "=");
if (lastGVar > GVAR_MAX) { if (lastGVar > GVAR_MAX) {
uint8_t fm = lastGVar - GVAR_MAX - 1; uint8_t fm = lastGVar - GVAR_MAX - 1;
if (fm >= lastFlightMode) if (fm >= lastFlightMode)
fm++; fm++;
char label[16]; char label[16];
getFlightModeString(label, fm + 1); getFlightModeString(label, fm + 1);
dc->drawSizedText(x, FIELD_PADDING_TOP, label, strlen(label), FOCUS_COLOR); dc->drawSizedText(x, FIELD_PADDING_TOP, label, strlen(label), COLOR_THEME_PRIMARY2);
} else { } else {
drawGVarValue(dc, x, FIELD_PADDING_TOP, index, lastGVar, FOCUS_COLOR); drawGVarValue(dc, x, FIELD_PADDING_TOP, index, lastGVar, COLOR_THEME_PRIMARY2);
} }
} }
@@ -183,7 +183,7 @@ void GVarEditWindow::buildHeader(Window * window)
new StaticText(window, new StaticText(window,
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
PAGE_LINE_HEIGHT}, PAGE_LINE_HEIGHT},
STR_GLOBAL_VAR, 0, FOCUS_COLOR); STR_GLOBAL_VAR, 0, COLOR_THEME_PRIMARY2);
gVarInHeader = gVarInHeader =
new GVarRenderer(window, new GVarRenderer(window,
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
+14 -14
View File
@@ -142,11 +142,11 @@ class InputEditWindow : public Page
new StaticText(window, new StaticText(window,
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
PAGE_LINE_HEIGHT}, PAGE_LINE_HEIGHT},
STR_MENUINPUTS, 0, FOCUS_COLOR); STR_MENUINPUTS, 0, COLOR_THEME_PRIMARY2);
new StaticText(window, new StaticText(window,
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT},
getSourceString(MIXSRC_FIRST_INPUT + input), 0, FOCUS_COLOR); getSourceString(MIXSRC_FIRST_INPUT + input), 0, COLOR_THEME_PRIMARY2);
} }
// TODO share this code with MIXER // TODO share this code with MIXER
@@ -323,10 +323,10 @@ void CommonInputOrMixButton::drawFlightModes(BitmapBuffer *dc,
s[0] = '0' + i; s[0] = '0' + i;
if (value & (1 << i)) { if (value & (1 << i)) {
dc->drawText(x, PAGE_LINE_HEIGHT + FIELD_PADDING_TOP + 2, s, dc->drawText(x, PAGE_LINE_HEIGHT + FIELD_PADDING_TOP + 2, s,
FONT(XS) | TEXT_DISABLE_COLOR); FONT(XS) | COLOR_THEME_DISABLED);
} else { } else {
dc->drawSolidFilledRect(x, PAGE_LINE_HEIGHT + FIELD_PADDING_TOP + 2, 8, 3, dc->drawSolidFilledRect(x, PAGE_LINE_HEIGHT + FIELD_PADDING_TOP + 2, 8, 3,
FOCUS_BGCOLOR); COLOR_THEME_FOCUS);
dc->drawText(x, PAGE_LINE_HEIGHT + FIELD_PADDING_TOP + 2, s, FONT(XS) | textColor); dc->drawText(x, PAGE_LINE_HEIGHT + FIELD_PADDING_TOP + 2, s, FONT(XS) | textColor);
} }
x += 8; x += 8;
@@ -336,13 +336,13 @@ void CommonInputOrMixButton::drawFlightModes(BitmapBuffer *dc,
void CommonInputOrMixButton::paint(BitmapBuffer * dc) void CommonInputOrMixButton::paint(BitmapBuffer * dc)
{ {
dc->drawSolidFilledRect(0, 0, width(), height(), dc->drawSolidFilledRect(0, 0, width(), height(),
isActive() ? HIGHLIGHT_COLOR : FIELD_BGCOLOR); isActive() ? COLOR_THEME_ACTIVE : COLOR_THEME_PRIMARY2);
paintBody(dc); paintBody(dc);
if (!hasFocus()) if (!hasFocus())
dc->drawSolidRect(0, 0, rect.w, rect.h, 1, FIELD_FRAME_COLOR); dc->drawSolidRect(0, 0, rect.w, rect.h, 1, COLOR_THEME_SECONDARY2);
else else
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, FOCUS_BGCOLOR); dc->drawSolidRect(0, 0, rect.w, rect.h, 2, COLOR_THEME_FOCUS);
} }
class InputLineButton : public CommonInputOrMixButton class InputLineButton : public CommonInputOrMixButton
@@ -363,9 +363,9 @@ class InputLineButton : public CommonInputOrMixButton
{ {
const ExpoData &line = g_model.expoData[index]; const ExpoData &line = g_model.expoData[index];
LcdFlags textColor = DEFAULT_COLOR; LcdFlags textColor = COLOR_THEME_SECONDARY1;
// if (hasFocus()) // if (hasFocus())
// textColor = FOCUS_COLOR; // textColor = COLOR_THEME_PRIMARY2;
// first line ... // first line ...
drawValueOrGVar(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, line.weight, drawValueOrGVar(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, line.weight,
@@ -495,10 +495,10 @@ void ModelInputsPage::build(FormWindow *window, int8_t focusIndex)
}); });
button->setFocusHandler([=](bool focus) { button->setFocusHandler([=](bool focus) {
if (focus) { if (focus) {
txt->setBackgroundColor(FOCUS_BGCOLOR); txt->setBackgroundColor(COLOR_THEME_FOCUS);
txt->setTextFlags(FOCUS_COLOR | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
txt->setBackgroundColor(FIELD_FRAME_COLOR); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED); txt->setTextFlags(CENTERED);
} }
txt->invalidate(); txt->invalidate();
@@ -507,8 +507,8 @@ void ModelInputsPage::build(FormWindow *window, int8_t focusIndex)
if (focusIndex == inputIndex) { if (focusIndex == inputIndex) {
button->setFocus(SET_FOCUS_DEFAULT); button->setFocus(SET_FOCUS_DEFAULT);
txt->setBackgroundColor(FOCUS_BGCOLOR); txt->setBackgroundColor(COLOR_THEME_FOCUS);
txt->setTextFlags(FOCUS_COLOR | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
txt->invalidate(); txt->invalidate();
} }
grid.spacer(button->height() - 1); grid.spacer(button->height() - 1);
@@ -67,7 +67,7 @@ class LogicalSwitchEditPage: public Page
Page::checkEvents(); Page::checkEvents();
if (active != isActive()) { if (active != isActive()) {
invalidate(); invalidate();
headerSwitchName->setTextFlags(isActive() ? FONT(BOLD) | HIGHLIGHT_COLOR : FOCUS_COLOR); headerSwitchName->setTextFlags(isActive() ? FONT(BOLD) | COLOR_THEME_ACTIVE : COLOR_THEME_PRIMARY2);
active = !active; active = !active;
} }
} }
@@ -77,12 +77,12 @@ class LogicalSwitchEditPage: public Page
new StaticText(window, new StaticText(window,
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
PAGE_LINE_HEIGHT}, PAGE_LINE_HEIGHT},
STR_MENULOGICALSWITCHES, 0, FOCUS_COLOR); STR_MENULOGICALSWITCHES, 0, COLOR_THEME_PRIMARY2);
headerSwitchName = new StaticText( headerSwitchName = new StaticText(
window, window,
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT},
getSwitchPositionName(SWSRC_SW1 + index), 0, FOCUS_COLOR); getSwitchPositionName(SWSRC_SW1 + index), 0, COLOR_THEME_PRIMARY2);
} }
void updateLogicalSwitchOneWindow() void updateLogicalSwitchOneWindow()
@@ -324,17 +324,17 @@ class LogicalSwitchButton : public Button
void paint(BitmapBuffer* dc) override void paint(BitmapBuffer* dc) override
{ {
if (active) if (active)
dc->drawSolidFilledRect(0, 0, rect.w, rect.h, HIGHLIGHT_COLOR); dc->drawSolidFilledRect(0, 0, rect.w, rect.h, COLOR_THEME_ACTIVE);
else else
dc->drawSolidFilledRect(0, 0, rect.w, rect.h, FIELD_BGCOLOR); dc->drawSolidFilledRect(0, 0, rect.w, rect.h, COLOR_THEME_PRIMARY2);
paintLogicalSwitchLine(dc); paintLogicalSwitchLine(dc);
// The bounding rect // The bounding rect
if (hasFocus()) if (hasFocus())
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, FOCUS_BGCOLOR); dc->drawSolidRect(0, 0, rect.w, rect.h, 2, COLOR_THEME_FOCUS);
else else
dc->drawSolidRect(0, 0, rect.w, rect.h, 1, FIELD_FRAME_COLOR); dc->drawSolidRect(0, 0, rect.w, rect.h, 1, COLOR_THEME_SECONDARY2);
} }
protected: protected:
@@ -421,10 +421,10 @@ void ModelLogicalSwitchesPage::build(FormWindow* window, int8_t focusIndex)
}); });
button->setFocusHandler([=](bool focus) { button->setFocusHandler([=](bool focus) {
if (focus) { if (focus) {
txt->setBackgroundColor(FOCUS_BGCOLOR); txt->setBackgroundColor(COLOR_THEME_FOCUS);
txt->setTextFlags(FOCUS_COLOR | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
txt->setBackgroundColor(FIELD_FRAME_COLOR); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED); txt->setTextFlags(CENTERED);
} }
txt->invalidate(); txt->invalidate();
@@ -432,8 +432,8 @@ void ModelLogicalSwitchesPage::build(FormWindow* window, int8_t focusIndex)
if (focusIndex == i) { if (focusIndex == i) {
button->setFocus(SET_FOCUS_DEFAULT); button->setFocus(SET_FOCUS_DEFAULT);
txt->setBackgroundColor(FOCUS_BGCOLOR); txt->setBackgroundColor(COLOR_THEME_FOCUS);
txt->setTextFlags(FOCUS_COLOR | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
txt->invalidate(); txt->invalidate();
} }
+11 -11
View File
@@ -63,11 +63,11 @@ class ScriptEditWindow : public Page {
new StaticText(window, new StaticText(window,
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
PAGE_LINE_HEIGHT}, PAGE_LINE_HEIGHT},
STR_MENUCUSTOMSCRIPTS, 0, FOCUS_COLOR); STR_MENUCUSTOMSCRIPTS, 0, COLOR_THEME_PRIMARY2);
new StaticText(window, new StaticText(window,
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT},
std::string("LUA") + std::to_string(idx + 1), 0, FOCUS_COLOR); std::string("LUA") + std::to_string(idx + 1), 0, COLOR_THEME_PRIMARY2);
} }
void buildBody(FormWindow * window, bool focusScript = false) void buildBody(FormWindow * window, bool focusScript = false)
@@ -180,8 +180,8 @@ class ScriptLineButton : public Button
void paint(BitmapBuffer* dc) override void paint(BitmapBuffer* dc) override
{ {
LcdFlags textColor = DEFAULT_COLOR; LcdFlags textColor = COLOR_THEME_SECONDARY1;
LcdFlags bgColor = FIELD_BGCOLOR; LcdFlags bgColor = COLOR_THEME_PRIMARY2;
dc->drawSolidFilledRect(0, 0, width(), height(), bgColor); dc->drawSolidFilledRect(0, 0, width(), height(), bgColor);
@@ -211,9 +211,9 @@ class ScriptLineButton : public Button
// bounding rect // bounding rect
if (hasFocus()) if (hasFocus())
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, FOCUS_BGCOLOR); dc->drawSolidRect(0, 0, rect.w, rect.h, 2, COLOR_THEME_FOCUS);
else else
dc->drawSolidRect(0, 0, rect.w, rect.h, 1, FIELD_FRAME_COLOR); dc->drawSolidRect(0, 0, rect.w, rect.h, 1, COLOR_THEME_SECONDARY2);
} }
protected: protected:
@@ -275,10 +275,10 @@ void ModelMixerScriptsPage::build(FormWindow * window, int8_t focusIdx)
button->setFocusHandler([=](bool focus) { button->setFocusHandler([=](bool focus) {
if (focus) { if (focus) {
txt->setBackgroundColor(FOCUS_BGCOLOR); txt->setBackgroundColor(COLOR_THEME_FOCUS);
txt->setTextFlags(FOCUS_COLOR | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
txt->setBackgroundColor(FIELD_FRAME_COLOR); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED); txt->setTextFlags(CENTERED);
} }
txt->invalidate(); txt->invalidate();
@@ -286,8 +286,8 @@ void ModelMixerScriptsPage::build(FormWindow * window, int8_t focusIdx)
if (focusIdx == idx) { if (focusIdx == idx) {
button->setFocus(SET_FOCUS_DEFAULT); button->setFocus(SET_FOCUS_DEFAULT);
txt->setBackgroundColor(FOCUS_BGCOLOR); txt->setBackgroundColor(COLOR_THEME_FOCUS);
txt->setTextFlags(FOCUS_COLOR | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
txt->invalidate(); txt->invalidate();
} }
+9 -9
View File
@@ -73,11 +73,11 @@ class MixEditWindow : public Page
new StaticText(window, new StaticText(window,
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
PAGE_LINE_HEIGHT}, PAGE_LINE_HEIGHT},
STR_MIXES, 0, FOCUS_COLOR); STR_MIXES, 0, COLOR_THEME_PRIMARY2);
new StaticText(window, new StaticText(window,
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT},
getSourceString(MIXSRC_CH1 + channel), 0, FOCUS_COLOR); getSourceString(MIXSRC_CH1 + channel), 0, COLOR_THEME_PRIMARY2);
} }
void buildBody(FormWindow *window) void buildBody(FormWindow *window)
@@ -255,7 +255,7 @@ class MixLineButton : public CommonInputOrMixButton
{ {
const MixData &line = g_model.mixData[index]; const MixData &line = g_model.mixData[index];
LcdFlags textColor = DEFAULT_COLOR; LcdFlags textColor = COLOR_THEME_SECONDARY1;
// first line ... // first line ...
drawValueOrGVar(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, line.weight, drawValueOrGVar(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, line.weight,
@@ -439,15 +439,15 @@ void ModelMixesPage::build(FormWindow * window, int8_t focusMixIndex)
{35 - txt->left(), {35 - txt->left(),
button->top() - txt->top() + (button->height() - 18) / 2, 25, button->top() - txt->top() + (button->height() - 18) / 2, 25,
17}, 17},
mixerMultiplexBitmap[mix->mltpx], DEFAULT_COLOR); mixerMultiplexBitmap[mix->mltpx], COLOR_THEME_SECONDARY1);
} }
button->setFocusHandler([=](bool focus) { button->setFocusHandler([=](bool focus) {
if (focus) { if (focus) {
txt->setBackgroundColor(FOCUS_BGCOLOR); txt->setBackgroundColor(COLOR_THEME_FOCUS);
txt->setTextFlags(FOCUS_COLOR | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
txt->setBackgroundColor(FIELD_FRAME_COLOR); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED); txt->setTextFlags(CENTERED);
} }
txt->invalidate(); txt->invalidate();
@@ -456,8 +456,8 @@ void ModelMixesPage::build(FormWindow * window, int8_t focusMixIndex)
if (focusMixIndex == mixIndex) { if (focusMixIndex == mixIndex) {
button->setFocus(SET_FOCUS_DEFAULT); button->setFocus(SET_FOCUS_DEFAULT);
txt->setBackgroundColor(FOCUS_BGCOLOR); txt->setBackgroundColor(COLOR_THEME_FOCUS);
txt->setTextFlags(FOCUS_COLOR | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
txt->invalidate(); txt->invalidate();
} }
+11 -11
View File
@@ -42,11 +42,11 @@ class OutputEditWindow : public Page {
new StaticText(window, new StaticText(window,
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
PAGE_LINE_HEIGHT}, PAGE_LINE_HEIGHT},
STR_MENULIMITS, 0, FOCUS_COLOR); STR_MENULIMITS, 0, COLOR_THEME_PRIMARY2);
new StaticText(window, new StaticText(window,
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT},
getSourceString(MIXSRC_CH1 + channel), 0, FOCUS_COLOR); getSourceString(MIXSRC_CH1 + channel), 0, COLOR_THEME_PRIMARY2);
} }
void buildBody(FormWindow * window) void buildBody(FormWindow * window)
@@ -126,8 +126,8 @@ class OutputLineButton : public Button {
void paint(BitmapBuffer * dc) override void paint(BitmapBuffer * dc) override
{ {
LcdFlags textColor = DEFAULT_COLOR; LcdFlags textColor = COLOR_THEME_SECONDARY1;
LcdFlags bgColor = FIELD_BGCOLOR; LcdFlags bgColor = COLOR_THEME_PRIMARY2;
dc->drawSolidFilledRect(0, 0, width(), height(), bgColor); dc->drawSolidFilledRect(0, 0, width(), height(), bgColor);
@@ -161,9 +161,9 @@ class OutputLineButton : public Button {
// bounding rect // bounding rect
if (hasFocus()) if (hasFocus())
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, FOCUS_BGCOLOR); dc->drawSolidRect(0, 0, rect.w, rect.h, 2, COLOR_THEME_FOCUS);
else else
dc->drawSolidRect(0, 0, rect.w, rect.h, 1, FIELD_FRAME_COLOR); dc->drawSolidRect(0, 0, rect.w, rect.h, 1, COLOR_THEME_SECONDARY2);
} }
protected: protected:
@@ -229,10 +229,10 @@ void ModelOutputsPage::build(FormWindow * window, int8_t focusChannel)
}); });
button->setFocusHandler([=](bool focus) { button->setFocusHandler([=](bool focus) {
if (focus) { if (focus) {
txt->setBackgroundColor(FOCUS_BGCOLOR); txt->setBackgroundColor(COLOR_THEME_FOCUS);
txt->setTextFlags(FOCUS_COLOR | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
txt->setBackgroundColor(FIELD_FRAME_COLOR); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED); txt->setTextFlags(CENTERED);
} }
txt->invalidate(); txt->invalidate();
@@ -240,8 +240,8 @@ void ModelOutputsPage::build(FormWindow * window, int8_t focusChannel)
if (focusChannel == ch) { if (focusChannel == ch) {
button->setFocus(SET_FOCUS_DEFAULT); button->setFocus(SET_FOCUS_DEFAULT);
txt->setBackgroundColor(FOCUS_BGCOLOR); txt->setBackgroundColor(COLOR_THEME_FOCUS);
txt->setTextFlags(FOCUS_COLOR | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
txt->invalidate(); txt->invalidate();
} }
+11 -11
View File
@@ -140,11 +140,11 @@ class ModelButton : public Button
if (buffer == nullptr) { if (buffer == nullptr) {
return; return;
} }
buffer->clear(FIELD_BGCOLOR); buffer->clear(COLOR_THEME_PRIMARY2);
if (error) { if (error) {
buffer->drawText(width() / 2, 2, "(Invalid Model)", buffer->drawText(width() / 2, 2, "(Invalid Model)",
DEFAULT_COLOR | CENTERED); COLOR_THEME_SECONDARY1 | CENTERED);
} else { } else {
GET_FILENAME(filename, BITMAPS_PATH, partialModel.header.bitmap, ""); GET_FILENAME(filename, BITMAPS_PATH, partialModel.header.bitmap, "");
const BitmapBuffer *bitmap = BitmapBuffer::loadBitmap(filename); const BitmapBuffer *bitmap = BitmapBuffer::loadBitmap(filename);
@@ -153,7 +153,7 @@ class ModelButton : public Button
delete bitmap; delete bitmap;
} else { } else {
buffer->drawText(width() / 2, 56, "(No Picture)", buffer->drawText(width() / 2, 56, "(No Picture)",
FONT(XXS) | DEFAULT_COLOR | CENTERED); FONT(XXS) | COLOR_THEME_SECONDARY1 | CENTERED);
} }
} }
} }
@@ -166,19 +166,19 @@ class ModelButton : public Button
dc->drawBitmap(0, 0, buffer); dc->drawBitmap(0, 0, buffer);
if (modelCell == modelslist.getCurrentModel()) { if (modelCell == modelslist.getCurrentModel()) {
dc->drawSolidFilledRect(0, 0, width(), 20, HIGHLIGHT_COLOR); dc->drawSolidFilledRect(0, 0, width(), 20, COLOR_THEME_ACTIVE);
dc->drawSizedText(width() / 2, 2, modelCell->modelName, dc->drawSizedText(width() / 2, 2, modelCell->modelName,
LEN_MODEL_NAME, LEN_MODEL_NAME,
DEFAULT_COLOR | CENTERED); COLOR_THEME_SECONDARY1 | CENTERED);
} else { } else {
LcdFlags textColor; LcdFlags textColor;
// if (hasFocus()) { // if (hasFocus()) {
// dc->drawFilledRect(0, 0, width(), 20, SOLID, FOCUS_BGCOLOR, 5); // dc->drawFilledRect(0, 0, width(), 20, SOLID, COLOR_THEME_FOCUS, 5);
// textColor = FOCUS_COLOR; // textColor = COLOR_THEME_PRIMARY2;
// } // }
// else { // else {
dc->drawFilledRect(0, 0, width(), 20, SOLID, FIELD_BGCOLOR, 5); dc->drawFilledRect(0, 0, width(), 20, SOLID, COLOR_THEME_PRIMARY2, 5);
textColor = DEFAULT_COLOR; textColor = COLOR_THEME_SECONDARY1;
// } // }
dc->drawSizedText(width() / 2, 2, modelCell->modelName, dc->drawSizedText(width() / 2, 2, modelCell->modelName,
@@ -187,9 +187,9 @@ class ModelButton : public Button
} }
if (!hasFocus()) { if (!hasFocus()) {
dc->drawSolidRect(0, 0, width(), height(), 1, FIELD_FRAME_COLOR); dc->drawSolidRect(0, 0, width(), height(), 1, COLOR_THEME_SECONDARY2);
} else { } else {
dc->drawSolidRect(0, 0, width(), height(), 2, FOCUS_BGCOLOR); dc->drawSolidRect(0, 0, width(), height(), 2, COLOR_THEME_FOCUS);
} }
} }
+4 -4
View File
@@ -73,8 +73,8 @@ class ChannelFailsafeBargraph: public Window {
x += width() / 2; x += width() / 2;
const coord_t xChannel = (channelValue > 0) ? x : x + 1 - lenChannel; const coord_t xChannel = (channelValue > 0) ? x : x + 1 - lenChannel;
const coord_t xFailsafe = (failsafeValue > 0) ? x : x + 1 - lenFailsafe; const coord_t xFailsafe = (failsafeValue > 0) ? x : x + 1 - lenFailsafe;
dc->drawSolidFilledRect(xChannel, + 2, lenChannel, (height() / 2) - 3, DEFAULT_COLOR); dc->drawSolidFilledRect(xChannel, + 2, lenChannel, (height() / 2) - 3, COLOR_THEME_SECONDARY1);
dc->drawSolidFilledRect(xFailsafe, (height() / 2) + 1, lenFailsafe, (height() / 2) - 3, ALARM_COLOR); dc->drawSolidFilledRect(xFailsafe, (height() / 2) + 1, lenFailsafe, (height() / 2) - 3, COLOR_THEME_WARNING);
} }
protected: protected:
@@ -147,7 +147,7 @@ class FailSafePage : public Page {
new StaticText(&header, new StaticText(&header,
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
PAGE_LINE_HEIGHT}, PAGE_LINE_HEIGHT},
STR_FAILSAFESET, 0, FOCUS_COLOR); STR_FAILSAFESET, 0, COLOR_THEME_PRIMARY2);
} }
protected: protected:
@@ -989,7 +989,7 @@ class ModuleWindow : public FormGroup {
return std::string(buf); return std::string(buf);
}, },
"RSSI:", 50, "RSSI:", 50,
DEFAULT_COLOR | CENTERED | FONT(BOLD) | FONT(XL)); COLOR_THEME_SECONDARY1 | CENTERED | FONT(BOLD) | FONT(XL));
rssiDialog->setCloseHandler([this]() { rssiDialog->setCloseHandler([this]() {
rangeButton->check(false); rangeButton->check(false);
moduleState[moduleIdx].mode = MODULE_MODE_NORMAL; moduleState[moduleIdx].mode = MODULE_MODE_NORMAL;
+11 -11
View File
@@ -80,23 +80,23 @@ class SensorButton : public Button {
TelemetryItem &telemetryItem = telemetryItems[index]; TelemetryItem &telemetryItem = telemetryItems[index];
if (telemetryItem.isAvailable()) if (telemetryItem.isAvailable())
dc->drawSolidFilledRect(2, 2, rect.w - 4, rect.h - 4, HIGHLIGHT_COLOR); dc->drawSolidFilledRect(2, 2, rect.w - 4, rect.h - 4, COLOR_THEME_ACTIVE);
else else
dc->drawSolidFilledRect(2, 2, rect.w - 4, rect.h - 4, FIELD_BGCOLOR); dc->drawSolidFilledRect(2, 2, rect.w - 4, rect.h - 4, COLOR_THEME_PRIMARY2);
if (telemetryItem.isFresh()) if (telemetryItem.isFresh())
dc->drawFilledCircle(24, (2 + rect.h - 4)/2, 4, DEFAULT_COLOR); dc->drawFilledCircle(24, (2 + rect.h - 4)/2, 4, COLOR_THEME_SECONDARY1);
dc->drawNumber(2, 1, number, LEFT, 0, nullptr, ":"); dc->drawNumber(2, 1, number, LEFT, 0, nullptr, ":");
dc->drawSizedText(SENSOR_COL1, line1, g_model.telemetrySensors[index].label, TELEM_LABEL_LEN); dc->drawSizedText(SENSOR_COL1, line1, g_model.telemetrySensors[index].label, TELEM_LABEL_LEN);
if (telemetryItem.isAvailable()) { if (telemetryItem.isAvailable()) {
LcdFlags color = telemetryItem.isOld() ? ALARM_COLOR : DEFAULT_COLOR; LcdFlags color = telemetryItem.isOld() ? COLOR_THEME_WARNING : COLOR_THEME_SECONDARY1;
drawSensorCustomValue(dc, SENSOR_COL2, line1, index, getValue(MIXSRC_FIRST_TELEM + 3 * index), LEFT | color); drawSensorCustomValue(dc, SENSOR_COL2, line1, index, getValue(MIXSRC_FIRST_TELEM + 3 * index), LEFT | color);
} }
else { else {
dc->drawText(SENSOR_COL2, line1, "---", DEFAULT_COLOR); dc->drawText(SENSOR_COL2, line1, "---", COLOR_THEME_SECONDARY1);
} }
TelemetrySensor * sensor = & g_model.telemetrySensors[index]; TelemetrySensor * sensor = & g_model.telemetrySensors[index];
@@ -108,9 +108,9 @@ class SensorButton : public Button {
} }
if (hasFocus()) if (hasFocus())
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, FOCUS_BGCOLOR); dc->drawSolidRect(0, 0, rect.w, rect.h, 2, COLOR_THEME_FOCUS);
else else
dc->drawSolidRect(0, 0, rect.w, rect.h, 1, FIELD_FRAME_COLOR); dc->drawSolidRect(0, 0, rect.w, rect.h, 1, COLOR_THEME_SECONDARY2);
} }
protected: protected:
@@ -139,9 +139,9 @@ class SensorEditWindow : public Page {
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
PAGE_LINE_HEIGHT}, PAGE_LINE_HEIGHT},
STR_SENSOR + std::to_string(index + 1), 0, STR_SENSOR + std::to_string(index + 1), 0,
MENU_HIGHLIGHT_COLOR); COLOR_THEME_PRIMARY2);
// dynamic display of sensor value ? // dynamic display of sensor value ?
//new StaticText(window, {70, 28, 100, 20}, "SF" + std::to_string(index), 0, MENU_COLOR); //new StaticText(window, {70, 28, 100, 20}, "SF" + std::to_string(index), 0, COLOR_THEME_SECONDARY1);
} }
void updateSensorParametersWindow() void updateSensorParametersWindow()
@@ -440,9 +440,9 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
// Sensors columns titles // Sensors columns titles
uint8_t sensorsCount = getTelemetrySensorsCount(); uint8_t sensorsCount = getTelemetrySensorsCount();
if (sensorsCount > 0) { if (sensorsCount > 0) {
new StaticText(window, {SENSOR_COL2, grid.getWindowHeight() + 3, SENSOR_COL3 - SENSOR_COL2, PAGE_LINE_HEIGHT}, STR_VALUE, 0, FONT(XS) | TEXT_DISABLE_COLOR); new StaticText(window, {SENSOR_COL2, grid.getWindowHeight() + 3, SENSOR_COL3 - SENSOR_COL2, PAGE_LINE_HEIGHT}, STR_VALUE, 0, FONT(XS) | COLOR_THEME_DISABLED);
if (!g_model.ignoreSensorIds && !IS_SPEKTRUM_PROTOCOL()) { if (!g_model.ignoreSensorIds && !IS_SPEKTRUM_PROTOCOL()) {
new StaticText(window, {SENSOR_COL3, grid.getWindowHeight() + 3, LCD_W - SENSOR_COL3, PAGE_LINE_HEIGHT}, STR_ID, 0, FONT(XS) | TEXT_DISABLE_COLOR); new StaticText(window, {SENSOR_COL3, grid.getWindowHeight() + 3, LCD_W - SENSOR_COL3, PAGE_LINE_HEIGHT}, STR_ID, 0, FONT(XS) | COLOR_THEME_DISABLED);
} }
} }
+2 -2
View File
@@ -39,7 +39,7 @@ void PageHeader::paint(BitmapBuffer * dc)
{ {
OpenTxTheme::instance()->drawPageHeaderBackground(dc, getIcon(), ""); OpenTxTheme::instance()->drawPageHeaderBackground(dc, getIcon(), "");
dc->drawSolidFilledRect(MENU_HEADER_HEIGHT, 0, LCD_W - MENU_HEADER_HEIGHT, dc->drawSolidFilledRect(MENU_HEADER_HEIGHT, 0, LCD_W - MENU_HEADER_HEIGHT,
MENU_HEADER_HEIGHT, HEADER_COLOR); MENU_HEADER_HEIGHT, COLOR_THEME_SECONDARY1);
} }
Page::Page(unsigned icon): Page::Page(unsigned icon):
@@ -67,7 +67,7 @@ void Page::deleteLater(bool detach, bool trash)
void Page::paint(BitmapBuffer * dc) void Page::paint(BitmapBuffer * dc)
{ {
dc->clear(DEFAULT_BGCOLOR); dc->clear(COLOR_THEME_SECONDARY3);
} }
#if defined(HARDWARE_KEYS) #if defined(HARDWARE_KEYS)
+2 -2
View File
@@ -70,12 +70,12 @@ void RadioCalibrationPage::buildHeader(Window * window)
new StaticText(window, new StaticText(window,
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
PAGE_LINE_HEIGHT}, PAGE_LINE_HEIGHT},
STR_MENUCALIBRATION, 0, FOCUS_COLOR); STR_MENUCALIBRATION, 0, COLOR_THEME_PRIMARY2);
text = new StaticText(window, text = new StaticText(window,
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT},
STR_MENUTOSTART, 0, FOCUS_COLOR); STR_MENUTOSTART, 0, COLOR_THEME_PRIMARY2);
} }
void RadioCalibrationPage::buildBody(FormWindow * window) void RadioCalibrationPage::buildBody(FormWindow * window)
+1 -1
View File
@@ -80,7 +80,7 @@ class RadioAnalogsDiagsWindow: public Window {
void RadioAnalogsDiagsPage::buildHeader(Window * window) void RadioAnalogsDiagsPage::buildHeader(Window * window)
{ {
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + 10, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_MENU_RADIO_ANALOGS, 0, MENU_HIGHLIGHT_COLOR); new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + 10, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_MENU_RADIO_ANALOGS, 0, COLOR_THEME_PRIMARY2);
} }
void RadioAnalogsDiagsPage::buildBody(Window * window) void RadioAnalogsDiagsPage::buildBody(Window * window)
+1 -1
View File
@@ -124,7 +124,7 @@ class RadioKeyDiagsWindow : public Window
void RadioKeyDiagsPage::buildHeader(Window * window) void RadioKeyDiagsPage::buildHeader(Window * window)
{ {
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + 10, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_MENU_RADIO_SWITCHES, 0, MENU_HIGHLIGHT_COLOR); new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + 10, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_MENU_RADIO_SWITCHES, 0, COLOR_THEME_PRIMARY2);
} }
void RadioKeyDiagsPage::buildBody(Window * window) void RadioKeyDiagsPage::buildBody(Window * window)
@@ -41,25 +41,25 @@ class GhostModuleConfigWindow: public Window
for (uint8_t line = 0; line < GHST_MENU_LINES; line++) { for (uint8_t line = 0; line < GHST_MENU_LINES; line++) {
if (reusableBuffer.ghostMenu.line[line].splitLine) { if (reusableBuffer.ghostMenu.line[line].splitLine) {
if (reusableBuffer.ghostMenu.line[line].lineFlags & GHST_LINE_FLAGS_LABEL_SELECT) { if (reusableBuffer.ghostMenu.line[line].lineFlags & GHST_LINE_FLAGS_LABEL_SELECT) {
dc->drawSolidFilledRect(xOffset, yOffset + line * lineSpacing, getTextWidth(reusableBuffer.ghostMenu.line[line].menuText, 0,FONT(L)), getFontHeight(FONT(L)), FONT(L) | FOCUS_BGCOLOR); dc->drawSolidFilledRect(xOffset, yOffset + line * lineSpacing, getTextWidth(reusableBuffer.ghostMenu.line[line].menuText, 0,FONT(L)), getFontHeight(FONT(L)), FONT(L) | COLOR_THEME_FOCUS);
dc->drawText(xOffset, yOffset + line * lineSpacing, reusableBuffer.ghostMenu.line[line].menuText, FONT(L) | DEFAULT_BGCOLOR); dc->drawText(xOffset, yOffset + line * lineSpacing, reusableBuffer.ghostMenu.line[line].menuText, FONT(L) | COLOR_THEME_SECONDARY3);
} }
else { else {
dc->drawText(xOffset, yOffset + line * lineSpacing, reusableBuffer.ghostMenu.line[line].menuText, FONT(L)); dc->drawText(xOffset, yOffset + line * lineSpacing, reusableBuffer.ghostMenu.line[line].menuText, FONT(L));
} }
if (reusableBuffer.ghostMenu.line[line].lineFlags & GHST_LINE_FLAGS_VALUE_SELECT) { if (reusableBuffer.ghostMenu.line[line].lineFlags & GHST_LINE_FLAGS_VALUE_SELECT) {
dc->drawSolidFilledRect(xOffset, yOffset + line * lineSpacing, getTextWidth( &reusableBuffer.ghostMenu.line[line].menuText[reusableBuffer.ghostMenu.line[line].splitLine], 0,FONT(L)), getFontHeight(0), FOCUS_BGCOLOR); dc->drawSolidFilledRect(xOffset, yOffset + line * lineSpacing, getTextWidth( &reusableBuffer.ghostMenu.line[line].menuText[reusableBuffer.ghostMenu.line[line].splitLine], 0,FONT(L)), getFontHeight(0), COLOR_THEME_FOCUS);
dc->drawText(xOffset, yOffset + line * lineSpacing, &reusableBuffer.ghostMenu.line[line].menuText[reusableBuffer.ghostMenu.line[line].splitLine], FONT(L) | DEFAULT_BGCOLOR); dc->drawText(xOffset, yOffset + line * lineSpacing, &reusableBuffer.ghostMenu.line[line].menuText[reusableBuffer.ghostMenu.line[line].splitLine], FONT(L) | COLOR_THEME_SECONDARY3);
} }
else { else {
dc->drawText(xOffset2, yOffset + line * lineSpacing, &reusableBuffer.ghostMenu.line[line].menuText[reusableBuffer.ghostMenu.line[line].splitLine], FONT(L) | DEFAULT_COLOR); dc->drawText(xOffset2, yOffset + line * lineSpacing, &reusableBuffer.ghostMenu.line[line].menuText[reusableBuffer.ghostMenu.line[line].splitLine], FONT(L) | COLOR_THEME_SECONDARY1);
} }
} }
else { else {
if (reusableBuffer.ghostMenu.line[line].lineFlags & GHST_LINE_FLAGS_LABEL_SELECT) { if (reusableBuffer.ghostMenu.line[line].lineFlags & GHST_LINE_FLAGS_LABEL_SELECT) {
dc->drawSolidFilledRect(xOffset, yOffset + line * lineSpacing, getTextWidth(reusableBuffer.ghostMenu.line[line].menuText, 0, FONT(L)), getFontHeight(FONT(L)), FOCUS_BGCOLOR); dc->drawSolidFilledRect(xOffset, yOffset + line * lineSpacing, getTextWidth(reusableBuffer.ghostMenu.line[line].menuText, 0, FONT(L)), getFontHeight(FONT(L)), COLOR_THEME_FOCUS);
dc->drawText(xOffset, yOffset + line * lineSpacing, reusableBuffer.ghostMenu.line[line].menuText, FONT(L) | DEFAULT_BGCOLOR); dc->drawText(xOffset, yOffset + line * lineSpacing, reusableBuffer.ghostMenu.line[line].menuText, FONT(L) | COLOR_THEME_SECONDARY3);
} }
else if (reusableBuffer.ghostMenu.line[line].lineFlags & GHST_LINE_FLAGS_VALUE_EDIT) { else if (reusableBuffer.ghostMenu.line[line].lineFlags & GHST_LINE_FLAGS_VALUE_EDIT) {
if (BLINK_ON_PHASE) { if (BLINK_ON_PHASE) {
@@ -67,7 +67,7 @@ class GhostModuleConfigWindow: public Window
} }
} }
else { else {
dc->drawText(xOffset, yOffset + line * lineSpacing, reusableBuffer.ghostMenu.line[line].menuText, FONT(L) | DEFAULT_COLOR); dc->drawText(xOffset, yOffset + line * lineSpacing, reusableBuffer.ghostMenu.line[line].menuText, FONT(L) | COLOR_THEME_SECONDARY1);
} }
} }
} }
@@ -87,7 +87,7 @@ RadioGhostModuleConfig::RadioGhostModuleConfig(uint8_t moduleIdx) :
void RadioGhostModuleConfig::buildHeader(Window * window) void RadioGhostModuleConfig::buildHeader(Window * window)
{ {
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + 10, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, "GHOST MODULE", 0, MENU_COLOR); new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + 10, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, "GHOST MODULE", 0, COLOR_THEME_SECONDARY1);
} }
void RadioGhostModuleConfig::buildBody(FormWindow * window) void RadioGhostModuleConfig::buildBody(FormWindow * window)
+1 -1
View File
@@ -306,7 +306,7 @@ void RadioHardwarePage::build(FormWindow * window)
#endif #endif
#if defined(AUX_SERIAL) || defined(AUX2_SERIAL) #if defined(AUX_SERIAL) || defined(AUX2_SERIAL)
new StaticText(window, grid.getFieldSlot(1,0), STR_TTL_WARNING, 0, ALARM_COLOR); new StaticText(window, grid.getFieldSlot(1,0), STR_TTL_WARNING, 0, COLOR_THEME_WARNING);
grid.nextLine(); grid.nextLine();
#endif #endif
+4 -4
View File
@@ -46,7 +46,7 @@ class FileNameEditWindow : public Page
void buildHeader(Window *window) void buildHeader(Window *window)
{ {
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + 10, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_RENAME_FILE, 0, MENU_HIGHLIGHT_COLOR); new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + 10, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_RENAME_FILE, 0, COLOR_THEME_PRIMARY2);
} }
void buildBody(Window *window) void buildBody(Window *window)
@@ -158,7 +158,7 @@ class FilePreview : public Window
{ {
coord_t y = parent->getScrollPositionY() + 2; coord_t y = parent->getScrollPositionY() + 2;
coord_t h = MENU_BODY_HEIGHT - 4; coord_t h = MENU_BODY_HEIGHT - 4;
lcd->drawSolidFilledRect(0, y, width(), h, DISABLE_COLOR); lcd->drawSolidFilledRect(0, y, width(), h, COLOR_THEME_DISABLED);
if (bitmap) { if (bitmap) {
coord_t bitmapHeight = min<coord_t>(h, bitmap->height()); coord_t bitmapHeight = min<coord_t>(h, bitmap->height());
coord_t bitmapWidth = min<coord_t>(width(), bitmap->width()); coord_t bitmapWidth = min<coord_t>(width(), bitmap->width());
@@ -279,7 +279,7 @@ void RadioSdManagerPage::build(FormWindow * window)
build(window); build(window);
return 0; return 0;
}, OPAQUE); }, OPAQUE);
b->setBgColorHandler([=]() -> LcdFlags { return FIELD_BGCOLOR; }); b->setBgColorHandler([=]() -> LcdFlags { return COLOR_THEME_PRIMARY2; });
grid.nextLine(); grid.nextLine();
} }
@@ -419,7 +419,7 @@ void RadioSdManagerPage::build(FormWindow * window)
} }
return 0; return 0;
}, OPAQUE); }, OPAQUE);
button->setBgColorHandler([=]() -> LcdFlags { return FIELD_BGCOLOR; }); button->setBgColorHandler([=]() -> LcdFlags { return COLOR_THEME_PRIMARY2; });
button->setFocusHandler([=](bool active) { button->setFocusHandler([=](bool active) {
if (active) { if (active) {
preview->setFile(getFullPath(name)); preview->setFile(getFullPath(name));
@@ -96,7 +96,7 @@ class SpectrumScaleWindow: public Window
void paint(BitmapBuffer * dc) override void paint(BitmapBuffer * dc) override
{ {
dc->drawSolidFilledRect(0, 0, width(), height(), CURVE_AXIS_COLOR); dc->drawSolidFilledRect(0, 0, width(), height(), COLOR_THEME_SECONDARY2);
// Draw tracker // Draw tracker
int offset = reusableBuffer.spectrumAnalyser.track - (reusableBuffer.spectrumAnalyser.freq - reusableBuffer.spectrumAnalyser.span / 2); int offset = reusableBuffer.spectrumAnalyser.track - (reusableBuffer.spectrumAnalyser.freq - reusableBuffer.spectrumAnalyser.span / 2);
@@ -153,14 +153,14 @@ class SpectrumWindow: public Window
int x = offset / reusableBuffer.spectrumAnalyser.step; int x = offset / reusableBuffer.spectrumAnalyser.step;
if (x >= LCD_W - 1) if (x >= LCD_W - 1)
break; break;
dc->drawVerticalLine(x, 0, height(), STASHED, CURVE_AXIS_COLOR); dc->drawVerticalLine(x, 0, height(), STASHED, COLOR_THEME_SECONDARY2);
} }
for (uint8_t power = 20;; power += 20) { for (uint8_t power = 20;; power += 20) {
int y = SCALE_TOP - 1 - limit<int>(0, power << 1, SCALE_TOP); int y = SCALE_TOP - 1 - limit<int>(0, power << 1, SCALE_TOP);
if (y <= 0) if (y <= 0)
break; break;
dc->drawHorizontalLine(0, y, width(), STASHED, CURVE_AXIS_COLOR); dc->drawHorizontalLine(0, y, width(), STASHED, COLOR_THEME_SECONDARY2);
} }
// Draw spectrum data // Draw spectrum data
@@ -208,7 +208,7 @@ RadioSpectrumAnalyser::RadioSpectrumAnalyser(uint8_t moduleIdx) :
void RadioSpectrumAnalyser::buildHeader(Window * window) void RadioSpectrumAnalyser::buildHeader(Window * window)
{ {
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + 10, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_MENU_SPECTRUM_ANALYSER, 0, MENU_COLOR); new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + 10, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_MENU_SPECTRUM_ANALYSER, 0, COLOR_THEME_SECONDARY1);
} }
void RadioSpectrumAnalyser::buildBody(FormWindow * window) void RadioSpectrumAnalyser::buildBody(FormWindow * window)
+28 -28
View File
@@ -130,13 +130,13 @@ void RadioToolsPage::rebuild(FormWindow * window)
return 0; return 0;
}, },
OPAQUE); OPAQUE);
b->setBgColorHandler([=]() -> LcdFlags { return FIELD_BGCOLOR; }); b->setBgColorHandler([=]() -> LcdFlags { return COLOR_THEME_PRIMARY2; });
b->setFocusHandler([=](bool focus) { b->setFocusHandler([=](bool focus) {
if (focus) { if (focus) {
txt->setBackgroundColor(FOCUS_BGCOLOR); txt->setBackgroundColor(COLOR_THEME_FOCUS);
txt->setTextFlags(FOCUS_COLOR | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
txt->setBackgroundColor(FIELD_FRAME_COLOR); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED); txt->setTextFlags(CENTERED);
} }
txt->invalidate(); txt->invalidate();
@@ -162,13 +162,13 @@ void RadioToolsPage::rebuild(FormWindow * window)
return 0; return 0;
}, },
OPAQUE); OPAQUE);
b->setBgColorHandler([=]() -> LcdFlags { return FIELD_BGCOLOR; }); b->setBgColorHandler([=]() -> LcdFlags { return COLOR_THEME_PRIMARY2; });
b->setFocusHandler([=](bool focus) { b->setFocusHandler([=](bool focus) {
if (focus) { if (focus) {
txt->setBackgroundColor(FOCUS_BGCOLOR); txt->setBackgroundColor(COLOR_THEME_FOCUS);
txt->setTextFlags(FOCUS_COLOR | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
txt->setBackgroundColor(FIELD_FRAME_COLOR); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED); txt->setTextFlags(CENTERED);
} }
txt->invalidate(); txt->invalidate();
@@ -189,13 +189,13 @@ void RadioToolsPage::rebuild(FormWindow * window)
return 0; return 0;
}, },
OPAQUE); OPAQUE);
b->setBgColorHandler([=]() -> LcdFlags { return FIELD_BGCOLOR; }); b->setBgColorHandler([=]() -> LcdFlags { return COLOR_THEME_PRIMARY2; });
b->setFocusHandler([=](bool focus) { b->setFocusHandler([=](bool focus) {
if (focus) { if (focus) {
txt->setBackgroundColor(FOCUS_BGCOLOR); txt->setBackgroundColor(COLOR_THEME_FOCUS);
txt->setTextFlags(FOCUS_COLOR | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
txt->setBackgroundColor(FIELD_FRAME_COLOR); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED); txt->setTextFlags(CENTERED);
} }
txt->invalidate(); txt->invalidate();
@@ -214,13 +214,13 @@ void RadioToolsPage::rebuild(FormWindow * window)
return 0; return 0;
}, },
OPAQUE); OPAQUE);
b->setBgColorHandler([=]() -> LcdFlags { return FIELD_BGCOLOR; }); b->setBgColorHandler([=]() -> LcdFlags { return COLOR_THEME_PRIMARY2; });
b->setFocusHandler([=](bool focus) { b->setFocusHandler([=](bool focus) {
if (focus) { if (focus) {
txt->setBackgroundColor(FOCUS_BGCOLOR); txt->setBackgroundColor(COLOR_THEME_FOCUS);
txt->setTextFlags(FOCUS_COLOR | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
txt->setBackgroundColor(FIELD_FRAME_COLOR); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED); txt->setTextFlags(CENTERED);
} }
txt->invalidate(); txt->invalidate();
@@ -244,13 +244,13 @@ void RadioToolsPage::rebuild(FormWindow * window)
return 0; return 0;
}, },
OPAQUE); OPAQUE);
b->setBgColorHandler([=]() -> LcdFlags { return FIELD_BGCOLOR; }); b->setBgColorHandler([=]() -> LcdFlags { return COLOR_THEME_PRIMARY2; });
b->setFocusHandler([=](bool focus) { b->setFocusHandler([=](bool focus) {
if (focus) { if (focus) {
txt->setBackgroundColor(FOCUS_BGCOLOR); txt->setBackgroundColor(COLOR_THEME_FOCUS);
txt->setTextFlags(FOCUS_COLOR | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
txt->setBackgroundColor(FIELD_FRAME_COLOR); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED); txt->setTextFlags(CENTERED);
} }
txt->invalidate(); txt->invalidate();
@@ -273,13 +273,13 @@ void RadioToolsPage::rebuild(FormWindow * window)
return 0; return 0;
}, },
OPAQUE); OPAQUE);
b->setBgColorHandler([=]() -> LcdFlags { return FIELD_BGCOLOR; }); b->setBgColorHandler([=]() -> LcdFlags { return COLOR_THEME_PRIMARY2; });
b->setFocusHandler([=](bool focus) { b->setFocusHandler([=](bool focus) {
if (focus) { if (focus) {
txt->setBackgroundColor(FOCUS_BGCOLOR); txt->setBackgroundColor(COLOR_THEME_FOCUS);
txt->setTextFlags(FOCUS_COLOR | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
txt->setBackgroundColor(FIELD_FRAME_COLOR); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED); txt->setTextFlags(CENTERED);
} }
txt->invalidate(); txt->invalidate();
@@ -301,13 +301,13 @@ void RadioToolsPage::rebuild(FormWindow * window)
return 0; return 0;
}, },
OPAQUE); OPAQUE);
b->setBgColorHandler([=]() -> LcdFlags { return FIELD_BGCOLOR; }); b->setBgColorHandler([=]() -> LcdFlags { return COLOR_THEME_PRIMARY2; });
b->setFocusHandler([=](bool focus) { b->setFocusHandler([=](bool focus) {
if (focus) { if (focus) {
txt->setBackgroundColor(FOCUS_BGCOLOR); txt->setBackgroundColor(COLOR_THEME_FOCUS);
txt->setTextFlags(FOCUS_COLOR | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
txt->setBackgroundColor(FIELD_FRAME_COLOR); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED); txt->setTextFlags(CENTERED);
} }
txt->invalidate(); txt->invalidate();
+4 -4
View File
@@ -48,7 +48,7 @@ class LayoutChoice: public FormField
FormField::paint(dc); FormField::paint(dc);
auto layout = getValue(); auto layout = getValue();
if (layout) { if (layout) {
layout->drawThumb(dc, 4, 4, editMode ? FOCUS_COLOR : LINE_COLOR); layout->drawThumb(dc, 4, 4, editMode ? COLOR_THEME_PRIMARY2 : COLOR_THEME_PRIMARY3);
} }
} }
@@ -141,10 +141,10 @@ SetupWidgetsPageSlot::SetupWidgetsPageSlot(FormGroup * parent, const rect_t & re
void SetupWidgetsPageSlot::paint(BitmapBuffer * dc) void SetupWidgetsPageSlot::paint(BitmapBuffer * dc)
{ {
if (hasFocus()) { if (hasFocus()) {
dc->drawRect(0, 0, width()-1, height()-1, 2, STASHED, CHECKBOX_COLOR); dc->drawRect(0, 0, width()-1, height()-1, 2, STASHED, COLOR_THEME_FOCUS);
} }
else { else {
dc->drawSolidRect(0, 0, width()-1, height()-1, 2, LINE_COLOR); dc->drawSolidRect(0, 0, width()-1, height()-1, 2, COLOR_THEME_PRIMARY3);
} }
} }
@@ -250,7 +250,7 @@ class SetupWidgetsPage: public FormWindow
// void paint(BitmapBuffer * dc) override // void paint(BitmapBuffer * dc) override
// { // {
// //ViewMain::instance()->fullPaint(dc); // //ViewMain::instance()->fullPaint(dc);
// //dc->clear(DEFAULT_BGCOLOR); // //dc->clear(COLOR_THEME_SECONDARY3);
// } // }
}; };
+3 -3
View File
@@ -44,16 +44,16 @@ void SelectFabButton::paint(BitmapBuffer* dc)
auto y_pos = FAB_BUTTON_SIZE; auto y_pos = FAB_BUTTON_SIZE;
dc->drawSizedText(width() / 2, y_pos, dc->drawSizedText(width() / 2, y_pos,
title.c_str(), pos, title.c_str(), pos,
FOCUS_COLOR | CENTERED | VCENTERED); COLOR_THEME_PRIMARY2 | CENTERED | VCENTERED);
if (pos != std::string::npos) { if (pos != std::string::npos) {
y_pos += PAGE_LINE_HEIGHT; y_pos += PAGE_LINE_HEIGHT;
dc->drawSizedText(width() / 2, y_pos, title.substr(pos+1).c_str(), dc->drawSizedText(width() / 2, y_pos, title.substr(pos+1).c_str(),
255, FOCUS_COLOR | CENTERED | VCENTERED); 255, COLOR_THEME_PRIMARY2 | CENTERED | VCENTERED);
} }
if (hasFocus()) { if (hasFocus()) {
dc->drawSolidRect(0, 0, width(), height(), 2, CHECKBOX_COLOR); dc->drawSolidRect(0, 0, width(), height(), 2, COLOR_THEME_FOCUS);
} }
} }
+3 -3
View File
@@ -62,11 +62,11 @@ void SourceChoice::paint(BitmapBuffer * dc)
unsigned value = getValue(); unsigned value = getValue();
LcdFlags textColor; LcdFlags textColor;
if (editMode) if (editMode)
textColor = FOCUS_COLOR; textColor = COLOR_THEME_PRIMARY2;
else if (hasFocus()) else if (hasFocus())
textColor = FOCUS_COLOR; textColor = COLOR_THEME_PRIMARY2;
// else if (value == 0) // else if (value == 0)
// textColor = DISABLE_COLOR; // textColor = COLOR_THEME_DISABLED;
else else
textColor = 0; textColor = 0;
+13 -13
View File
@@ -59,8 +59,8 @@ class SpecialFunctionEditPage : public Page
Page::checkEvents(); Page::checkEvents();
if (active != isActive()) { if (active != isActive()) {
invalidate(); invalidate();
headerSF->setTextFlags(isActive() ? FONT(BOLD) | HIGHLIGHT_COLOR headerSF->setTextFlags(isActive() ? FONT(BOLD) | COLOR_THEME_ACTIVE
: FOCUS_COLOR); : COLOR_THEME_PRIMARY2);
active = !active; active = !active;
} }
} }
@@ -71,13 +71,13 @@ class SpecialFunctionEditPage : public Page
window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, 20}, window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, 20},
functions == g_model.customFn ? STR_MENUCUSTOMFUNC functions == g_model.customFn ? STR_MENUCUSTOMFUNC
: STR_MENUSPECIALFUNCS, : STR_MENUSPECIALFUNCS,
0, FOCUS_COLOR); 0, COLOR_THEME_PRIMARY2);
headerSF = new StaticText( headerSF = new StaticText(
window, window,
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
LCD_W - PAGE_TITLE_LEFT, 20}, LCD_W - PAGE_TITLE_LEFT, 20},
(functions == g_model.customFn ? "SF" : "GF") + std::to_string(index+1), (functions == g_model.customFn ? "SF" : "GF") + std::to_string(index+1),
0, FOCUS_COLOR); 0, COLOR_THEME_PRIMARY2);
} }
void updateSpecialFunctionOneWindow() void updateSpecialFunctionOneWindow()
@@ -596,17 +596,17 @@ class SpecialFunctionButton : public Button
void paint(BitmapBuffer *dc) override void paint(BitmapBuffer *dc) override
{ {
if (active) if (active)
dc->drawSolidFilledRect(0, 0, rect.w, rect.h, HIGHLIGHT_COLOR); dc->drawSolidFilledRect(0, 0, rect.w, rect.h, COLOR_THEME_ACTIVE);
else else
dc->drawSolidFilledRect(0, 0, rect.w, rect.h, FIELD_BGCOLOR); dc->drawSolidFilledRect(0, 0, rect.w, rect.h, COLOR_THEME_PRIMARY2);
paintSpecialFunctionLine(dc); paintSpecialFunctionLine(dc);
// The bounding rect // The bounding rect
if (hasFocus()) if (hasFocus())
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, FOCUS_BGCOLOR); dc->drawSolidRect(0, 0, rect.w, rect.h, 2, COLOR_THEME_FOCUS);
else else
dc->drawSolidRect(0, 0, rect.w, rect.h, 1, FIELD_FRAME_COLOR); dc->drawSolidRect(0, 0, rect.w, rect.h, 1, COLOR_THEME_SECONDARY2);
} }
protected: protected:
@@ -725,10 +725,10 @@ void SpecialFunctionsPage::build(FormWindow *window, int8_t focusIndex)
}); });
button->setFocusHandler([=](bool focus) { button->setFocusHandler([=](bool focus) {
if (focus) { if (focus) {
txt->setBackgroundColor(FOCUS_BGCOLOR); txt->setBackgroundColor(COLOR_THEME_FOCUS);
txt->setTextFlags(FOCUS_COLOR | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
txt->setBackgroundColor(FIELD_FRAME_COLOR); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED); txt->setTextFlags(CENTERED);
} }
txt->invalidate(); txt->invalidate();
@@ -736,8 +736,8 @@ void SpecialFunctionsPage::build(FormWindow *window, int8_t focusIndex)
if (focusIndex == i) { if (focusIndex == i) {
button->setFocus(SET_FOCUS_DEFAULT); button->setFocus(SET_FOCUS_DEFAULT);
txt->setBackgroundColor(FOCUS_BGCOLOR); txt->setBackgroundColor(COLOR_THEME_FOCUS);
txt->setTextFlags(FOCUS_COLOR | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
txt->invalidate(); txt->invalidate();
} }
+6 -6
View File
@@ -30,22 +30,22 @@ void LuaPopup::paint(BitmapBuffer* dc, uint8_t type, const char* text, const cha
{ {
// popup background // popup background
dc->drawSolidFilledRect(0, 0, rect.w, POPUP_HEADER_HEIGHT, dc->drawSolidFilledRect(0, 0, rect.w, POPUP_HEADER_HEIGHT,
FOCUS_BGCOLOR); COLOR_THEME_FOCUS);
const char* title = text;//TODO: based on 'type' const char* title = text;//TODO: based on 'type'
// title bar // title bar
dc->drawText(FIELD_PADDING_LEFT, dc->drawText(FIELD_PADDING_LEFT,
(POPUP_HEADER_HEIGHT - getFontHeight(FONT(STD))) / 2, (POPUP_HEADER_HEIGHT - getFontHeight(FONT(STD))) / 2,
title, FOCUS_COLOR); title, COLOR_THEME_PRIMARY2);
dc->drawSolidFilledRect(0, POPUP_HEADER_HEIGHT, rect.w, dc->drawSolidFilledRect(0, POPUP_HEADER_HEIGHT, rect.w,
rect.h - POPUP_HEADER_HEIGHT, rect.h - POPUP_HEADER_HEIGHT,
DEFAULT_BGCOLOR); COLOR_THEME_SECONDARY3);
dc->drawText(FIELD_PADDING_LEFT, dc->drawText(FIELD_PADDING_LEFT,
POPUP_HEADER_HEIGHT + PAGE_LINE_HEIGHT, POPUP_HEADER_HEIGHT + PAGE_LINE_HEIGHT,
info, DEFAULT_COLOR); info, COLOR_THEME_SECONDARY1);
} }
// singleton instance // singleton instance
@@ -97,7 +97,7 @@ void StandaloneLuaWindow::deleteLater(bool detach, bool /*trash*/)
void StandaloneLuaWindow::paint(BitmapBuffer* dc) void StandaloneLuaWindow::paint(BitmapBuffer* dc)
{ {
dc->drawSolidFilledRect(0, 0, width(), height(), DEFAULT_BGCOLOR); dc->drawSolidFilledRect(0, 0, width(), height(), COLOR_THEME_SECONDARY3);
dc->drawBitmap(0 - dc->getOffsetX(), 0 - dc->getOffsetY(), &lcdBuffer); dc->drawBitmap(0 - dc->getOffsetX(), 0 - dc->getOffsetY(), &lcdBuffer);
} }
@@ -127,7 +127,7 @@ bool StandaloneLuaWindow::displayPopup(event_t event, uint8_t type, const char*
{ {
// transparent background // transparent background
lcdBuffer.drawFilledRect(0, 0, LCD_W, LCD_H, SOLID, lcdBuffer.drawFilledRect(0, 0, LCD_W, LCD_H, SOLID,
OVERLAY_COLOR, OPACITY(5)); COLOR_THEME_PRIMARY1, OPACITY(5));
// center pop-up // center pop-up
lcdBuffer.setOffset(LCD_W/2 - popup.rect.w/2, LCD_H/2 - popup.rect.h/2); lcdBuffer.setOffset(LCD_W/2 - popup.rect.w/2, LCD_H/2 - popup.rect.h/2);
@@ -103,11 +103,11 @@ void SwitchWarnDialog::paint(BitmapBuffer * dc)
// TODO add an helper // TODO add an helper
strncpy(s, &STR_VSRCRAW[1 + (NUM_STICKS + 1 + i) * STR_VSRCRAW[0]], STR_VSRCRAW[0]); strncpy(s, &STR_VSRCRAW[1 + (NUM_STICKS + 1 + i) * STR_VSRCRAW[0]], STR_VSRCRAW[0]);
s[int(STR_VSRCRAW[0])] = '\0'; s[int(STR_VSRCRAW[0])] = '\0';
dc->drawText(x, y, s, ALARM_COLOR | FONT(XL)); dc->drawText(x, y, s, COLOR_THEME_WARNING | FONT(XL));
y += 35; y += 35;
} }
else { else {
dc->drawText(x, y, "...", ALARM_COLOR | FONT(XL)); dc->drawText(x, y, "...", COLOR_THEME_WARNING | FONT(XL));
} }
} }
} }
+4 -4
View File
@@ -46,13 +46,13 @@ void SwitchChoice::paint(BitmapBuffer * dc)
unsigned value = getValue(); unsigned value = getValue();
LcdFlags textColor; LcdFlags textColor;
if (editMode) if (editMode)
textColor = FOCUS_COLOR; textColor = COLOR_THEME_PRIMARY2;
else if (hasFocus()) else if (hasFocus())
textColor = FOCUS_COLOR; textColor = COLOR_THEME_PRIMARY2;
// else if (value == 0) // else if (value == 0)
// textColor = DISABLE_COLOR; // textColor = COLOR_THEME_DISABLED;
else else
textColor = DEFAULT_COLOR; textColor = COLOR_THEME_SECONDARY1;
drawSwitch(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, textColor); drawSwitch(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, textColor);
dc->drawBitmapPattern(rect.w - 20, (rect.h - 11) / 2, LBM_DROPDOWN, dc->drawBitmapPattern(rect.w - 20, (rect.h - 11) / 2, LBM_DROPDOWN,
+1 -1
View File
@@ -204,7 +204,7 @@ void TabsGroup::onEvent(event_t event)
void TabsGroup::paint(BitmapBuffer * dc) void TabsGroup::paint(BitmapBuffer * dc)
{ {
dc->clear(DEFAULT_BGCOLOR); dc->clear(COLOR_THEME_SECONDARY3);
} }
#if defined(HARDWARE_TOUCH) #if defined(HARDWARE_TOUCH)
+24 -24
View File
@@ -115,14 +115,14 @@ void OpenTxTheme::drawThumb(BitmapBuffer * dc, coord_t x, coord_t y, uint32_t fl
thumb = BitmapBuffer::loadBitmap(getFilePath("thumb.bmp")); thumb = BitmapBuffer::loadBitmap(getFilePath("thumb.bmp"));
} }
lcd->drawBitmap(x, y, thumb); lcd->drawBitmap(x, y, thumb);
if (flags == LINE_COLOR) { if (flags == COLOR_THEME_PRIMARY3) {
dc->drawFilledRect(x, y, THUMB_WIDTH, THUMB_HEIGHT, SOLID, OVERLAY_COLOR); dc->drawFilledRect(x, y, THUMB_WIDTH, THUMB_HEIGHT, SOLID, COLOR_THEME_PRIMARY1);
} }
} }
void OpenTxTheme::drawBackground(BitmapBuffer * dc) const void OpenTxTheme::drawBackground(BitmapBuffer * dc) const
{ {
dc->drawSolidFilledRect(0, 0, LCD_W, LCD_H, DEFAULT_BGCOLOR); dc->drawSolidFilledRect(0, 0, LCD_W, LCD_H, COLOR_THEME_SECONDARY3);
} }
//void OpenTxTheme::drawMessageBox(const char *title, const char *text, //void OpenTxTheme::drawMessageBox(const char *title, const char *text,
@@ -130,7 +130,7 @@ void OpenTxTheme::drawBackground(BitmapBuffer * dc) const
//{ //{
// //if (flags & MESSAGEBOX_TYPE_ALERT) { // //if (flags & MESSAGEBOX_TYPE_ALERT) {
// drawBackground(); // drawBackground();
// lcdDrawFilledRect(0, POPUP_Y, LCD_W, POPUP_H, SOLID, FOCUS_COLOR | // lcdDrawFilledRect(0, POPUP_Y, LCD_W, POPUP_H, SOLID, COLOR_THEME_PRIMARY2 |
// OPACITY(8)); // OPACITY(8));
// //} // //}
// //
@@ -145,16 +145,16 @@ void OpenTxTheme::drawBackground(BitmapBuffer * dc) const
//#if defined(TRANSLATIONS_FR) || defined(TRANSLATIONS_IT) || //#if defined(TRANSLATIONS_FR) || defined(TRANSLATIONS_IT) ||
//defined(TRANSLATIONS_CZ) //defined(TRANSLATIONS_CZ)
// lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, STR_WARNING, // lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, STR_WARNING,
// ALARM_COLOR|FONT(XL)); lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+28, // COLOR_THEME_WARNING|FONT(XL)); lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+28,
// title, ALARM_COLOR|FONT(XL)); // title, COLOR_THEME_WARNING|FONT(XL));
//#else //#else
// lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, title, ALARM_COLOR|FONT(XL)); // lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, title, COLOR_THEME_WARNING|FONT(XL));
// lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+28, STR_WARNING, // lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+28, STR_WARNING,
// ALARM_COLOR|FONT(XL)); // COLOR_THEME_WARNING|FONT(XL));
//#endif //#endif
// } // }
// else if (title) { // else if (title) {
// lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, title, ALARM_COLOR|FONT(XL)); // lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, title, COLOR_THEME_WARNING|FONT(XL));
// } // }
// //
// if (text) { // if (text) {
@@ -169,15 +169,15 @@ void OpenTxTheme::drawBackground(BitmapBuffer * dc) const
void OpenTxTheme::drawCheckBox(BitmapBuffer *dc, bool checked, coord_t x, void OpenTxTheme::drawCheckBox(BitmapBuffer *dc, bool checked, coord_t x,
coord_t y, bool focus) const coord_t y, bool focus) const
{ {
dc->drawSolidFilledRect(x, y, 16, 16, FIELD_BGCOLOR); dc->drawSolidFilledRect(x, y, 16, 16, COLOR_THEME_PRIMARY2);
if (focus) { if (focus) {
dc->drawSolidRect(x, y, 16, 16, 2, FOCUS_BGCOLOR); dc->drawSolidRect(x, y, 16, 16, 2, COLOR_THEME_FOCUS);
} }
else { else {
dc->drawSolidRect(x, y, 16, 16, 1, FIELD_FRAME_COLOR); dc->drawSolidRect(x, y, 16, 16, 1, COLOR_THEME_SECONDARY2);
} }
if (checked) { if (checked) {
dc->drawSolidFilledRect(x + 3, y + 3, 10, 10, CHECKBOX_COLOR); dc->drawSolidFilledRect(x + 3, y + 3, 10, 10, COLOR_THEME_FOCUS);
} }
} }
@@ -185,13 +185,13 @@ void OpenTxTheme::drawChoice(BitmapBuffer * dc, ChoiceBase * choice, const char
{ {
LcdFlags textColor; LcdFlags textColor;
if (choice->isEditMode()) if (choice->isEditMode())
textColor = FOCUS_COLOR; textColor = COLOR_THEME_PRIMARY2;
else if (choice->hasFocus()) else if (choice->hasFocus())
textColor = FOCUS_COLOR; textColor = COLOR_THEME_PRIMARY2;
// else if (!str || str[0] == '\0') // else if (!str || str[0] == '\0')
// textColor = FOCUS_COLOR; // textColor = COLOR_THEME_PRIMARY2;
else else
textColor = DEFAULT_COLOR; textColor = COLOR_THEME_SECONDARY1;
dc->drawText(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, dc->drawText(FIELD_PADDING_LEFT, FIELD_PADDING_TOP,
str[0] == '\0' ? "---" : str, textColor); str[0] == '\0' ? "---" : str, textColor);
@@ -208,9 +208,9 @@ void OpenTxTheme::drawSlider(BitmapBuffer *dc, int vmin, int vmax, int value,
int val = limit(vmin, value, vmax); int val = limit(vmin, value, vmax);
int w = divRoundClosest((rect.w - 16) * (val - vmin), vmax - vmin); int w = divRoundClosest((rect.w - 16) * (val - vmin), vmax - vmin);
LcdFlags color = DEFAULT_COLOR; LcdFlags color = COLOR_THEME_SECONDARY1;
if (focus) { if (focus) {
color = FOCUS_BGCOLOR; color = COLOR_THEME_FOCUS;
} }
dc->drawBitmapPattern(0, 11, LBM_SLIDER_BAR_LEFT, color); dc->drawBitmapPattern(0, 11, LBM_SLIDER_BAR_LEFT, color);
@@ -218,22 +218,22 @@ void OpenTxTheme::drawSlider(BitmapBuffer *dc, int vmin, int vmax, int value,
dc->drawBitmapPattern(rect.w - 4, 11, LBM_SLIDER_BAR_RIGHT, 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_OUT, color);
dc->drawBitmapPattern(w, 5, LBM_SLIDER_POINT_MID, FIELD_BGCOLOR); dc->drawBitmapPattern(w, 5, LBM_SLIDER_POINT_MID, COLOR_THEME_PRIMARY2);
if (edit) { if (edit) {
dc->drawBitmapPattern(w, 5, LBM_SLIDER_POINT_IN, EDIT_MARKER_COLOR); dc->drawBitmapPattern(w, 5, LBM_SLIDER_POINT_IN, COLOR_THEME_EDIT);
} else { } else {
dc->drawBitmapPattern(w, 5, LBM_SLIDER_POINT_IN, FIELD_BGCOLOR); dc->drawBitmapPattern(w, 5, LBM_SLIDER_POINT_IN, COLOR_THEME_PRIMARY2);
} }
} }
void OpenTxTheme::drawUsbPluggedScreen(BitmapBuffer * dc) const void OpenTxTheme::drawUsbPluggedScreen(BitmapBuffer * dc) const
{ {
// draw USB icon // draw USB icon
dc->clear(DEFAULT_BGCOLOR); dc->clear(COLOR_THEME_SECONDARY3);
dc->drawBitmapPattern((LCD_W - LBM_USB_PLUGGED_W) / 2, dc->drawBitmapPattern((LCD_W - LBM_USB_PLUGGED_W) / 2,
(LCD_H - LBM_USB_PLUGGED_H) / 2, (LCD_H - LBM_USB_PLUGGED_H) / 2,
LBM_USB_PLUGGED, DEFAULT_COLOR); LBM_USB_PLUGGED, COLOR_THEME_SECONDARY1);
} }
+49 -85
View File
@@ -28,16 +28,6 @@ const ZoneOption OPTIONS_THEME_DEFAULT[] = {
{ nullptr, ZoneOption::Bool } { 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, 0xDE, 0x00);
class Theme480: public OpenTxTheme class Theme480: public OpenTxTheme
{ {
public: public:
@@ -50,47 +40,21 @@ class Theme480: public OpenTxTheme
void loadColors() const void loadColors() const
{ {
TRACE("Load EdgeTX theme colors"); TRACE("Load EdgeTX theme colors");
lcdColorTable[ALARM_COLOR_INDEX] = RED;
lcdColorTable[BARGRAPH1_COLOR_INDEX] = RED;
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] = __FOCUS_COLOR;
lcdColorTable[CURVE_COLOR_INDEX] = RED;
lcdColorTable[CURVE_CURSOR_COLOR_INDEX] = RED;
lcdColorTable[DEFAULT_BGCOLOR_INDEX] = __TAB_BACKGROUND_COLOR;
lcdColorTable[DEFAULT_COLOR_INDEX] = __TEXT_COLOR;
lcdColorTable[DISABLE_COLOR_INDEX] = LIGHTGREY;
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] = __BACKGROUND_COLOR;
lcdColorTable[HEADER_CURRENT_BGCOLOR_INDEX] = __FOCUS_COLOR;
lcdColorTable[HEADER_ICON_BGCOLOR_INDEX] = __BACKGROUND_COLOR;
lcdColorTable[HIGHLIGHT_COLOR_INDEX] = __ACTIVE_MARKER_COLOR;
lcdColorTable[LINE_COLOR_INDEX] = GREY;
lcdColorTable[MAINVIEW_GRAPHICS_COLOR_INDEX] = RED;
lcdColorTable[MAINVIEW_PANES_COLOR_INDEX] = WHITE;
lcdColorTable[MENU_BGCOLOR_INDEX] = WHITE; lcdColorTable[DEFAULT_COLOR_INDEX] = RGB(18, 94, 153);
lcdColorTable[MENU_COLOR_INDEX] = __BACKGROUND_COLOR; // Menu font color
// Selected item in menu lcdColorTable[COLOR_THEME_PRIMARY1_INDEX] = RGB(0, 0, 0);
lcdColorTable[MENU_HIGHLIGHT_BGCOLOR_INDEX] = __FOCUS_COLOR; lcdColorTable[COLOR_THEME_PRIMARY2_INDEX] = RGB(255, 255, 255);
lcdColorTable[MENU_HIGHLIGHT_COLOR_INDEX] = WHITE; lcdColorTable[COLOR_THEME_PRIMARY3_INDEX] = RGB(12, 63, 102);
lcdColorTable[MENU_LINE_COLOR_INDEX] = __DATAFIELD_FRAME_COLOR; lcdColorTable[COLOR_THEME_SECONDARY1_INDEX] = RGB(18, 94, 153);
lcdColorTable[COLOR_THEME_SECONDARY2_INDEX] = RGB(182, 224, 242);
lcdColorTable[MENU_TITLE_DISABLE_COLOR_INDEX] = __TEXT_COLOR; lcdColorTable[COLOR_THEME_SECONDARY3_INDEX] = RGB(228, 238, 242);
lcdColorTable[OVERLAY_COLOR_INDEX] = BLACK; lcdColorTable[COLOR_THEME_FOCUS_INDEX] = RGB(20, 161, 229);
lcdColorTable[SCROLLBAR_COLOR_INDEX] = __TEXT_COLOR; lcdColorTable[COLOR_THEME_EDIT_INDEX] = RGB(0, 153, 9);
lcdColorTable[TEXT_DISABLE_COLOR_INDEX] = GREY; lcdColorTable[COLOR_THEME_ACTIVE_INDEX] = RGB(255, 222, 0);
lcdColorTable[TEXT_STATUSBAR_COLOR_INDEX] = WHITE; lcdColorTable[COLOR_THEME_WARNING_INDEX] = RGB(224, 0, 0);
lcdColorTable[TITLE_BGCOLOR_INDEX] = __BACKGROUND_COLOR; lcdColorTable[COLOR_THEME_DISABLED_INDEX] = RGB(140, 140, 140);
lcdColorTable[CUSTOM_COLOR_INDEX] = RGB(170, 85, 0);
lcdColorTable[TRIM_BGCOLOR_INDEX] = __FOCUS_COLOR;
lcdColorTable[TRIM_SHADOW_COLOR_INDEX] = BLACK;
} }
void loadMenuIcon(uint8_t index, const uint8_t * lbm) const void loadMenuIcon(uint8_t index, const uint8_t * lbm) const
@@ -103,15 +67,15 @@ class Theme480: public OpenTxTheme
delete menuIconNormal[index]; delete menuIconNormal[index];
menuIconNormal[index] = new BitmapBuffer(BMP_RGB565, mask->width(), mask->height()); menuIconNormal[index] = new BitmapBuffer(BMP_RGB565, mask->width(), mask->height());
if (menuIconNormal[index]) { if (menuIconNormal[index]) {
menuIconNormal[index]->clear(HEADER_ICON_BGCOLOR); menuIconNormal[index]->clear(COLOR_THEME_SECONDARY1);
menuIconNormal[index]->drawMask(0, 0, mask, FOCUS_COLOR); menuIconNormal[index]->drawMask(0, 0, mask, COLOR_THEME_PRIMARY2);
} }
delete menuIconSelected[index]; delete menuIconSelected[index];
menuIconSelected[index] = new BitmapBuffer(BMP_RGB565, mask->width(), mask->height()); menuIconSelected[index] = new BitmapBuffer(BMP_RGB565, mask->width(), mask->height());
if (menuIconSelected[index]) { if (menuIconSelected[index]) {
menuIconSelected[index]->clear(HEADER_CURRENT_BGCOLOR); menuIconSelected[index]->clear(COLOR_THEME_FOCUS);
menuIconSelected[index]->drawMask(0, 0, mask, FOCUS_COLOR); menuIconSelected[index]->drawMask(0, 0, mask, COLOR_THEME_PRIMARY2);
} }
} }
} }
@@ -185,27 +149,27 @@ class Theme480: public OpenTxTheme
currentMenuBackground->drawSolidFilledRect( currentMenuBackground->drawSolidFilledRect(
0, 0, currentMenuBackground->width(), MENU_HEADER_HEIGHT, 0, 0, currentMenuBackground->width(), MENU_HEADER_HEIGHT,
HEADER_COLOR); COLOR_THEME_SECONDARY1);
currentMenuBackground->drawSolidFilledRect( currentMenuBackground->drawSolidFilledRect(
0, MENU_HEADER_HEIGHT, currentMenuBackground->width(), 0, MENU_HEADER_HEIGHT, currentMenuBackground->width(),
MENU_TITLE_TOP - MENU_HEADER_HEIGHT, DEFAULT_BGCOLOR); MENU_TITLE_TOP - MENU_HEADER_HEIGHT, COLOR_THEME_SECONDARY3);
currentMenuBackground->drawSolidFilledRect( currentMenuBackground->drawSolidFilledRect(
0, MENU_TITLE_TOP, currentMenuBackground->width(), 0, MENU_TITLE_TOP, currentMenuBackground->width(),
currentMenuBackground->height() - MENU_TITLE_TOP, TITLE_BGCOLOR); currentMenuBackground->height() - MENU_TITLE_TOP, COLOR_THEME_SECONDARY1);
currentMenuBackground->drawMask(0, 0, background, currentMenuBackground->drawMask(0, 0, background,
HEADER_CURRENT_BGCOLOR); COLOR_THEME_FOCUS);
currentMenuBackground->drawMask(0, 0, shadow, TRIM_SHADOW_COLOR); currentMenuBackground->drawMask(0, 0, shadow, COLOR_THEME_PRIMARY1);
currentMenuBackground->drawMask(10, 39, dot, FOCUS_COLOR); currentMenuBackground->drawMask(10, 39, dot, COLOR_THEME_PRIMARY2);
} }
delete topleftBitmap; delete topleftBitmap;
topleftBitmap = BitmapBuffer::load8bitMaskOnBackground( topleftBitmap = BitmapBuffer::load8bitMaskOnBackground(
mask_topleft, HEADER_CURRENT_BGCOLOR, HEADER_COLOR); mask_topleft, COLOR_THEME_FOCUS, COLOR_THEME_SECONDARY1);
delete background; delete background;
delete shadow; delete shadow;
@@ -232,7 +196,7 @@ class Theme480: public OpenTxTheme
// Unused: // Unused:
// //
// delete modelselIconBitmap; // delete modelselIconBitmap;
// modelselIconBitmap = BitmapBuffer::loadMaskOnBackground("modelsel/mask_iconback.png", TITLE_BGCOLOR, DEFAULT_BGCOLOR); // modelselIconBitmap = BitmapBuffer::loadMaskOnBackground("modelsel/mask_iconback.png", COLOR_THEME_SECONDARY1, COLOR_THEME_SECONDARY3);
// if (modelselIconBitmap) { // if (modelselIconBitmap) {
// BitmapBuffer * bitmap = BitmapBuffer::loadBitmap(getFilePath("modelsel/icon_default.png")); // BitmapBuffer * bitmap = BitmapBuffer::loadBitmap(getFilePath("modelsel/icon_default.png"));
// modelselIconBitmap->drawBitmap(20, 8, bitmap); // modelselIconBitmap->drawBitmap(20, 8, bitmap);
@@ -323,21 +287,21 @@ class Theme480: public OpenTxTheme
uint32_t color = g_eeGeneral.themeData.options[1].value.unsignedValue; uint32_t color = g_eeGeneral.themeData.options[1].value.unsignedValue;
uint32_t bg_color = UNEXPECTED_SHUTDOWN() ? WHITE : g_eeGeneral.themeData.options[0].value.unsignedValue; uint32_t bg_color = UNEXPECTED_SHUTDOWN() ? WHITE : g_eeGeneral.themeData.options[0].value.unsignedValue;
lcdColorTable[DEFAULT_BGCOLOR_INDEX] = bg_color; lcdColorTable[COLOR_THEME_SECONDARY3_INDEX] = bg_color;
lcdColorTable[FOCUS_BGCOLOR_INDEX] = color; lcdColorTable[COLOR_THEME_FOCUS_INDEX] = color;
lcdColorTable[CHECKBOX_COLOR_INDEX] = color; lcdColorTable[COLOR_THEME_FOCUS_INDEX] = color;
lcdColorTable[SCROLLBAR_COLOR_INDEX] = color; lcdColorTable[COLOR_THEME_PRIMARY3_INDEX] = color;
lcdColorTable[CURVE_COLOR_INDEX] = color; lcdColorTable[COLOR_THEME_SECONDARY1_INDEX] = color;
lcdColorTable[CURVE_CURSOR_COLOR_INDEX] = color; lcdColorTable[COLOR_THEME_WARNING_INDEX] = color;
lcdColorTable[TITLE_BGCOLOR_INDEX] = color; lcdColorTable[COLOR_THEME_SECONDARY1_INDEX] = color;
lcdColorTable[MENU_TITLE_DISABLE_COLOR_INDEX] = lcdColorTable[COLOR_THEME_PRIMARY3_INDEX] =
RGB(GET_RED(color)>>1, GET_GREEN(color)>>1, GET_BLUE(color)>>1); RGB(GET_RED(color)>>1, GET_GREEN(color)>>1, GET_BLUE(color)>>1);
lcdColorTable[TRIM_BGCOLOR_INDEX] = color; lcdColorTable[COLOR_THEME_FOCUS_INDEX] = color;
lcdColorTable[MAINVIEW_GRAPHICS_COLOR_INDEX] = color; lcdColorTable[COLOR_THEME_SECONDARY1_INDEX] = color;
#define DARKER(x) ((x * 70) / 100) #define DARKER(x) ((x * 70) / 100)
lcdColorTable[MENU_BGCOLOR_INDEX] = RGB(DARKER(GET_RED(color)), DARKER(GET_GREEN(color)), DARKER(GET_BLUE(color))); lcdColorTable[COLOR_THEME_PRIMARY2_INDEX] = RGB(DARKER(GET_RED(color)), DARKER(GET_GREEN(color)), DARKER(GET_BLUE(color)));
lcdColorTable[HEADER_ICON_BGCOLOR_INDEX] = color; lcdColorTable[COLOR_THEME_SECONDARY1_INDEX] = color;
lcdColorTable[HEADER_CURRENT_BGCOLOR_INDEX] = color; lcdColorTable[COLOR_THEME_FOCUS_INDEX] = color;
#endif #endif
loadIcons(); loadIcons();
loadThemeBitmaps(); loadThemeBitmaps();
@@ -350,7 +314,7 @@ class Theme480: public OpenTxTheme
} }
else { else {
dc->drawSolidFilledRect(0 - dc->getOffsetX(), 0 - dc->getOffsetY(), dc->drawSolidFilledRect(0 - dc->getOffsetX(), 0 - dc->getOffsetY(),
LCD_W, LCD_H, DEFAULT_BGCOLOR); LCD_W, LCD_H, COLOR_THEME_SECONDARY3);
} }
} }
@@ -368,10 +332,10 @@ class Theme480: public OpenTxTheme
if (topleftBitmap) { if (topleftBitmap) {
dc->drawBitmap(0, 0, topleftBitmap); dc->drawBitmap(0, 0, topleftBitmap);
uint16_t width = topleftBitmap->width(); uint16_t width = topleftBitmap->width();
dc->drawSolidFilledRect(width, 0, LCD_W - width, MENU_HEADER_HEIGHT, HEADER_COLOR); dc->drawSolidFilledRect(width, 0, LCD_W - width, MENU_HEADER_HEIGHT, COLOR_THEME_SECONDARY1);
} }
else { else {
dc->drawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_COLOR); dc->drawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, COLOR_THEME_SECONDARY1);
} }
if (icon == ICON_OPENTX) if (icon == ICON_OPENTX)
@@ -381,12 +345,12 @@ class Theme480: public OpenTxTheme
dc->drawSolidFilledRect(0, MENU_HEADER_HEIGHT, LCD_W, dc->drawSolidFilledRect(0, MENU_HEADER_HEIGHT, LCD_W,
MENU_TITLE_TOP - MENU_HEADER_HEIGHT, MENU_TITLE_TOP - MENU_HEADER_HEIGHT,
DEFAULT_BGCOLOR); // the white separation line COLOR_THEME_SECONDARY3); // the white separation line
dc->drawSolidFilledRect(0, MENU_TITLE_TOP, LCD_W, MENU_TITLE_HEIGHT, dc->drawSolidFilledRect(0, MENU_TITLE_TOP, LCD_W, MENU_TITLE_HEIGHT,
TITLE_BGCOLOR); // the title line background COLOR_THEME_SECONDARY1); // the title line background
if (title) { if (title) {
dc->drawText(MENUS_MARGIN_LEFT, MENU_TITLE_TOP + 3, title, FOCUS_COLOR); dc->drawText(MENUS_MARGIN_LEFT, MENU_TITLE_TOP + 3, title, COLOR_THEME_PRIMARY2);
} }
drawMenuDatetime(dc); drawMenuDatetime(dc);
@@ -419,7 +383,7 @@ class Theme480: public OpenTxTheme
void drawMenuDatetime(BitmapBuffer * dc) const void drawMenuDatetime(BitmapBuffer * dc) const
{ {
//dc->drawSolidVerticalLine(DATETIME_SEPARATOR_X, 7, 31, FOCUS_COLOR); //dc->drawSolidVerticalLine(DATETIME_SEPARATOR_X, 7, 31, COLOR_THEME_PRIMARY2);
struct gtm t; struct gtm t;
gettime(&t); gettime(&t);
@@ -430,18 +394,18 @@ class Theme480: public OpenTxTheme
const char * const STR_MONTHS[] = TR_MONTHS; const char * const STR_MONTHS[] = TR_MONTHS;
sprintf(str, "%d %s", t.tm_mday, STR_MONTHS[t.tm_mon]); sprintf(str, "%d %s", t.tm_mday, STR_MONTHS[t.tm_mon]);
#endif #endif
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE1, str, FONT(XS)|FOCUS_COLOR|CENTERED); dc->drawText(DATETIME_MIDDLE, DATETIME_LINE1, str, FONT(XS)|COLOR_THEME_PRIMARY2|CENTERED);
getTimerString(str, getValue(MIXSRC_TX_TIME)); getTimerString(str, getValue(MIXSRC_TX_TIME));
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE2, str, FONT(XS)|FOCUS_COLOR|CENTERED); dc->drawText(DATETIME_MIDDLE, DATETIME_LINE2, str, FONT(XS)|COLOR_THEME_PRIMARY2|CENTERED);
} }
void drawProgressBar(BitmapBuffer *dc, coord_t x, coord_t y, coord_t w, void drawProgressBar(BitmapBuffer *dc, coord_t x, coord_t y, coord_t w,
coord_t h, int value, int total) const override coord_t h, int value, int total) const override
{ {
dc->drawSolidRect(x, y, w, h, 1, DEFAULT_COLOR); dc->drawSolidRect(x, y, w, h, 1, COLOR_THEME_SECONDARY1);
if (value > 0) { if (value > 0) {
int width = (w * value) / total; int width = (w * value) / total;
dc->drawSolidFilledRect(x + 2, y + 2, width - 4, h - 4, CHECKBOX_COLOR); dc->drawSolidFilledRect(x + 2, y + 2, width - 4, h - 4, COLOR_THEME_FOCUS);
} }
} }
+62 -84
View File
@@ -40,45 +40,23 @@ class FlyskyTheme: public OpenTxTheme
{ {
TRACE("Load FlySky theme colors"); TRACE("Load FlySky theme colors");
lcdColorTable[DEFAULT_COLOR_INDEX] = BLACK; lcdColorTable[DEFAULT_COLOR_INDEX] = RGB(18, 94, 153);
lcdColorTable[DEFAULT_BGCOLOR_INDEX] = WHITE;
lcdColorTable[FOCUS_COLOR_INDEX] = WHITE;
lcdColorTable[FOCUS_BGCOLOR_INDEX] = RED;
lcdColorTable[TEXT_STATUSBAR_COLOR_INDEX] = WHITE;
lcdColorTable[LINE_COLOR_INDEX] = GREY;
lcdColorTable[CHECKBOX_COLOR_INDEX] = RGB(0, 71, 157);
lcdColorTable[SCROLLBAR_COLOR_INDEX] = RGB(0, 71, 157);
lcdColorTable[MENU_BGCOLOR_INDEX] = DARKBLUE;
lcdColorTable[MENU_COLOR_INDEX] = WHITE;
lcdColorTable[MENU_TITLE_DISABLE_COLOR_INDEX] = RGB(GET_RED(RED)>>1, GET_GREEN(RED)>>1, GET_BLUE(RED)>>1);
lcdColorTable[HEADER_COLOR_INDEX] = DARKGREY;
lcdColorTable[ALARM_COLOR_INDEX] = RED;
lcdColorTable[HIGHLIGHT_COLOR_INDEX] = YELLOW;
lcdColorTable[TEXT_DISABLE_COLOR_INDEX] = GREY;
lcdColorTable[DISABLE_COLOR_INDEX] = LIGHTGREY;
lcdColorTable[CURVE_COLOR_INDEX] = RED;
lcdColorTable[CURVE_AXIS_COLOR_INDEX] = LIGHTGREY;
lcdColorTable[CURVE_CURSOR_COLOR_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;
// The menu header (top bar) lcdColorTable[COLOR_THEME_PRIMARY1_INDEX] = RGB(0, 0, 0);
lcdColorTable[HEADER_BGCOLOR_INDEX] = DARKBLUE; lcdColorTable[COLOR_THEME_PRIMARY2_INDEX] = RGB(255, 255, 255);
lcdColorTable[HEADER_ICON_BGCOLOR_INDEX] = RGB(0, 71, 157); lcdColorTable[COLOR_THEME_PRIMARY3_INDEX] = RGB(12, 63, 102);
lcdColorTable[HEADER_CURRENT_BGCOLOR_INDEX] = RGB(2, 114, 250); lcdColorTable[COLOR_THEME_SECONDARY1_INDEX] = RGB(18, 94, 153);
lcdColorTable[COLOR_THEME_SECONDARY2_INDEX] = RGB(182, 224, 242);
// The menu title lcdColorTable[COLOR_THEME_SECONDARY3_INDEX] = RGB(228, 238, 242);
lcdColorTable[TITLE_BGCOLOR_INDEX] = RGB(0, 71, 157); lcdColorTable[COLOR_THEME_FOCUS_INDEX] = RGB(20, 161, 229);
lcdColorTable[COLOR_THEME_EDIT_INDEX] = RGB(0, 153, 9);
lcdColorTable[OVERLAY_COLOR_INDEX] = BLACK; lcdColorTable[COLOR_THEME_ACTIVE_INDEX] = RGB(255, 222, 0);
lcdColorTable[BARGRAPH1_COLOR_INDEX] = RED; lcdColorTable[COLOR_THEME_WARNING_INDEX] = RGB(224, 0, 0);
lcdColorTable[BARGRAPH2_COLOR_INDEX] = RGB(167, 167, 167); lcdColorTable[COLOR_THEME_DISABLED_INDEX] = RGB(140, 140, 140);
lcdColorTable[BARGRAPH_BGCOLOR_INDEX] = RGB(222, 222, 222); lcdColorTable[CUSTOM_COLOR_INDEX] = RGB(170, 85, 0);
} }
void loadMenuIcon(uint8_t index, const char * filename, uint32_t color=MENU_COLOR) const void loadMenuIcon(uint8_t index, const char * filename, uint32_t color=COLOR_THEME_SECONDARY1) const
{ {
TRACE("loadMenuIcon %s", getFilePath(filename)); TRACE("loadMenuIcon %s", getFilePath(filename));
@@ -94,14 +72,14 @@ class FlyskyTheme: public OpenTxTheme
delete menuIconNormal[index]; delete menuIconNormal[index];
menuIconNormal[index] = new BitmapBuffer(BMP_RGB565, width, height); menuIconNormal[index] = new BitmapBuffer(BMP_RGB565, width, height);
if (menuIconNormal[index]) { if (menuIconNormal[index]) {
menuIconNormal[index]->clear(HEADER_BGCOLOR); menuIconNormal[index]->clear(COLOR_THEME_FOCUS);
menuIconNormal[index]->drawMask(0, 0, mask, color); menuIconNormal[index]->drawMask(0, 0, mask, color);
} }
delete menuIconSelected[index]; delete menuIconSelected[index];
menuIconSelected[index] = new BitmapBuffer(BMP_RGB565, width, height); menuIconSelected[index] = new BitmapBuffer(BMP_RGB565, width, height);
if (menuIconSelected[index]) { if (menuIconSelected[index]) {
menuIconSelected[index]->clear(HEADER_CURRENT_BGCOLOR); menuIconSelected[index]->clear(COLOR_THEME_FOCUS);
menuIconSelected[index]->drawMask(0, 0, mask, color); menuIconSelected[index]->drawMask(0, 0, mask, color);
} }
} }
@@ -109,7 +87,7 @@ class FlyskyTheme: public OpenTxTheme
delete menuIconNormal[index]; delete menuIconNormal[index];
menuIconNormal[index] = new BitmapBuffer(BMP_RGB565, MENU_HEADER_BUTTON_WIDTH, MENU_HEADER_BUTTON_WIDTH); menuIconNormal[index] = new BitmapBuffer(BMP_RGB565, MENU_HEADER_BUTTON_WIDTH, MENU_HEADER_BUTTON_WIDTH);
if (menuIconNormal[index]) { if (menuIconNormal[index]) {
menuIconNormal[index]->clear(HEADER_BGCOLOR); menuIconNormal[index]->clear(COLOR_THEME_FOCUS);
menuIconNormal[index]->drawMask((MENU_HEADER_BUTTON_WIDTH-width)/2, (MENU_HEADER_BUTTON_WIDTH-width)/2, mask, color); menuIconNormal[index]->drawMask((MENU_HEADER_BUTTON_WIDTH-width)/2, (MENU_HEADER_BUTTON_WIDTH-width)/2, mask, color);
} }
@@ -117,9 +95,9 @@ class FlyskyTheme: public OpenTxTheme
menuIconSelected[index] = new BitmapBuffer(BMP_RGB565, MENU_HEADER_BUTTON_WIDTH, MENU_HEADER_BUTTON_WIDTH); menuIconSelected[index] = new BitmapBuffer(BMP_RGB565, MENU_HEADER_BUTTON_WIDTH, MENU_HEADER_BUTTON_WIDTH);
if (menuIconSelected[index]) { if (menuIconSelected[index]) {
if (index < ICON_RADIO) if (index < ICON_RADIO)
menuIconSelected[index]->clear(HEADER_CURRENT_BGCOLOR /*HEADER_LOGO_BGCOLOR*/); menuIconSelected[index]->clear(COLOR_THEME_FOCUS /*HEADER_LOGO_BGCOLOR*/);
else else
menuIconSelected[index]->clear(HEADER_CURRENT_BGCOLOR); menuIconSelected[index]->clear(COLOR_THEME_FOCUS);
menuIconSelected[index]->drawMask((MENU_HEADER_BUTTON_WIDTH-width)/2, (MENU_HEADER_BUTTON_WIDTH-height)/2, mask, color); menuIconSelected[index]->drawMask((MENU_HEADER_BUTTON_WIDTH-width)/2, (MENU_HEADER_BUTTON_WIDTH-height)/2, mask, color);
} }
} }
@@ -129,7 +107,7 @@ class FlyskyTheme: public OpenTxTheme
void loadIcons() const void loadIcons() const
{ {
#if defined(LOG_TELEMETRY) || defined(WATCHDOG_DISABLED) #if defined(LOG_TELEMETRY) || defined(WATCHDOG_DISABLED)
loadMenuIcon(ICON_OPENTX, "mask_opentx_testmode.png", DEFAULT_COLOR); loadMenuIcon(ICON_OPENTX, "mask_opentx_testmode.png", COLOR_THEME_SECONDARY1);
#else #else
loadMenuIcon(ICON_OPENTX, "mask_edgetx.png"); loadMenuIcon(ICON_OPENTX, "mask_edgetx.png");
#endif #endif
@@ -187,16 +165,16 @@ class FlyskyTheme: public OpenTxTheme
currentMenuBackground = new BitmapBuffer(BMP_RGB565, 36, 53); currentMenuBackground = new BitmapBuffer(BMP_RGB565, 36, 53);
} }
if (currentMenuBackground) { if (currentMenuBackground) {
currentMenuBackground->drawSolidFilledRect(0, 0, currentMenuBackground->width(), MENU_HEADER_HEIGHT, HEADER_BGCOLOR); currentMenuBackground->drawSolidFilledRect(0, 0, currentMenuBackground->width(), MENU_HEADER_HEIGHT, COLOR_THEME_FOCUS);
currentMenuBackground->drawSolidFilledRect(0, MENU_HEADER_HEIGHT, currentMenuBackground->width(), MENU_TITLE_TOP - MENU_HEADER_HEIGHT, DEFAULT_BGCOLOR); currentMenuBackground->drawSolidFilledRect(0, MENU_HEADER_HEIGHT, currentMenuBackground->width(), MENU_TITLE_TOP - MENU_HEADER_HEIGHT, COLOR_THEME_SECONDARY3);
currentMenuBackground->drawSolidFilledRect(0, MENU_TITLE_TOP, currentMenuBackground->width(), currentMenuBackground->height() - MENU_TITLE_TOP, TITLE_BGCOLOR); currentMenuBackground->drawSolidFilledRect(0, MENU_TITLE_TOP, currentMenuBackground->width(), currentMenuBackground->height() - MENU_TITLE_TOP, COLOR_THEME_SECONDARY1);
currentMenuBackground->drawMask(0, 0, background, HEADER_CURRENT_BGCOLOR); currentMenuBackground->drawMask(0, 0, background, COLOR_THEME_FOCUS);
currentMenuBackground->drawMask(0, 0, shadow, TRIM_SHADOW_COLOR); currentMenuBackground->drawMask(0, 0, shadow, COLOR_THEME_PRIMARY1);
currentMenuBackground->drawMask(10, 39, dot, MENU_COLOR); currentMenuBackground->drawMask(10, 39, dot, COLOR_THEME_SECONDARY1);
} }
delete topleftBitmap; delete topleftBitmap;
topleftBitmap = BitmapBuffer::loadMaskOnBackground("topleft.png", TITLE_BGCOLOR, HEADER_BGCOLOR); topleftBitmap = BitmapBuffer::loadMaskOnBackground("topleft.png", COLOR_THEME_SECONDARY1, COLOR_THEME_FOCUS);
delete background; delete background;
delete shadow; delete shadow;
@@ -217,7 +195,7 @@ class FlyskyTheme: public OpenTxTheme
// Model Selection screen // Model Selection screen
// delete modelselIconBitmap; // delete modelselIconBitmap;
// modelselIconBitmap = BitmapBuffer::loadMaskOnBackground("modelsel/mask_iconback.png", TITLE_BGCOLOR, DEFAULT_BGCOLOR); // modelselIconBitmap = BitmapBuffer::loadMaskOnBackground("modelsel/mask_iconback.png", COLOR_THEME_SECONDARY1, COLOR_THEME_SECONDARY3);
// if (modelselIconBitmap) { // if (modelselIconBitmap) {
// BitmapBuffer * bitmap = BitmapBuffer::loadBitmap(getFilePath("modelsel/icon_default.png")); // BitmapBuffer * bitmap = BitmapBuffer::loadBitmap(getFilePath("modelsel/icon_default.png"));
// modelselIconBitmap->drawBitmap(20, 8, bitmap); // modelselIconBitmap->drawBitmap(20, 8, bitmap);
@@ -244,29 +222,29 @@ class FlyskyTheme: public OpenTxTheme
// Channels monitor screen // Channels monitor screen
delete chanMonLockedBitmap; delete chanMonLockedBitmap;
chanMonLockedBitmap = BitmapBuffer::loadMaskOnBackground("mask_monitor_lockch.png", DEFAULT_COLOR, DEFAULT_BGCOLOR); chanMonLockedBitmap = BitmapBuffer::loadMaskOnBackground("mask_monitor_lockch.png", COLOR_THEME_SECONDARY1, COLOR_THEME_SECONDARY3);
delete chanMonInvertedBitmap; delete chanMonInvertedBitmap;
chanMonInvertedBitmap = BitmapBuffer::loadMaskOnBackground("mask_monitor_inver.png", DEFAULT_COLOR, DEFAULT_BGCOLOR); chanMonInvertedBitmap = BitmapBuffer::loadMaskOnBackground("mask_monitor_inver.png", COLOR_THEME_SECONDARY1, COLOR_THEME_SECONDARY3);
// Mixer setup screen // Mixer setup screen
delete mixerSetupMixerBitmap; delete mixerSetupMixerBitmap;
mixerSetupMixerBitmap = BitmapBuffer::loadMaskOnBackground("mask_sbar_mixer.png", MENU_COLOR, HEADER_BGCOLOR); mixerSetupMixerBitmap = BitmapBuffer::loadMaskOnBackground("mask_sbar_mixer.png", COLOR_THEME_SECONDARY1, COLOR_THEME_FOCUS);
delete mixerSetupToBitmap; delete mixerSetupToBitmap;
mixerSetupToBitmap = BitmapBuffer::loadMaskOnBackground("mask_sbar_to.png", MENU_COLOR, HEADER_BGCOLOR); mixerSetupToBitmap = BitmapBuffer::loadMaskOnBackground("mask_sbar_to.png", COLOR_THEME_SECONDARY1, COLOR_THEME_FOCUS);
delete mixerSetupOutputBitmap; delete mixerSetupOutputBitmap;
mixerSetupOutputBitmap = BitmapBuffer::loadMaskOnBackground("mask_sbar_output.png", MENU_COLOR, HEADER_BGCOLOR); mixerSetupOutputBitmap = BitmapBuffer::loadMaskOnBackground("mask_sbar_output.png", COLOR_THEME_SECONDARY1, COLOR_THEME_FOCUS);
delete mixerSetupAddBitmap; delete mixerSetupAddBitmap;
mixerSetupAddBitmap = BitmapBuffer::loadMaskOnBackground(getFilePath("mask_mplex_add.png"), DEFAULT_COLOR, DEFAULT_BGCOLOR); mixerSetupAddBitmap = BitmapBuffer::loadMaskOnBackground(getFilePath("mask_mplex_add.png"), COLOR_THEME_SECONDARY1, COLOR_THEME_SECONDARY3);
delete mixerSetupMultiBitmap; delete mixerSetupMultiBitmap;
mixerSetupMultiBitmap = BitmapBuffer::loadMaskOnBackground(getFilePath("mask_mplex_multi.png"), DEFAULT_COLOR, DEFAULT_BGCOLOR); mixerSetupMultiBitmap = BitmapBuffer::loadMaskOnBackground(getFilePath("mask_mplex_multi.png"), COLOR_THEME_SECONDARY1, COLOR_THEME_SECONDARY3);
delete mixerSetupReplaceBitmap; delete mixerSetupReplaceBitmap;
mixerSetupReplaceBitmap = BitmapBuffer::loadMaskOnBackground(getFilePath("mask_mplex_replace.png"), DEFAULT_COLOR, DEFAULT_BGCOLOR); mixerSetupReplaceBitmap = BitmapBuffer::loadMaskOnBackground(getFilePath("mask_mplex_replace.png"), COLOR_THEME_SECONDARY1, COLOR_THEME_SECONDARY3);
delete mixerSetupLabelIcon; delete mixerSetupLabelIcon;
mixerSetupLabelIcon = BitmapBuffer::loadMask(getFilePath("mask_textline_label.png")); mixerSetupLabelIcon = BitmapBuffer::loadMask(getFilePath("mask_textline_label.png"));
@@ -308,21 +286,21 @@ class FlyskyTheme: public OpenTxTheme
uint32_t color = g_eeGeneral.themeData.options[1].unsignedValue; uint32_t color = g_eeGeneral.themeData.options[1].unsignedValue;
uint32_t bg_color = UNEXPECTED_SHUTDOWN() ? WHITE : g_eeGeneral.themeData.options[0].unsignedValue; uint32_t bg_color = UNEXPECTED_SHUTDOWN() ? WHITE : g_eeGeneral.themeData.options[0].unsignedValue;
lcdColorTable[DEFAULT_BGCOLOR_INDEX] = bg_color; lcdColorTable[COLOR_THEME_SECONDARY3_INDEX] = bg_color;
lcdColorTable[FOCUS_BGCOLOR_INDEX] = color; lcdColorTable[COLOR_THEME_FOCUS_INDEX] = color;
lcdColorTable[CHECKBOX_COLOR_INDEX] = color; lcdColorTable[COLOR_THEME_FOCUS_INDEX] = color;
lcdColorTable[SCROLLBAR_COLOR_INDEX] = color; lcdColorTable[COLOR_THEME_PRIMARY3_INDEX] = color;
lcdColorTable[CURVE_COLOR_INDEX] = color; lcdColorTable[COLOR_THEME_SECONDARY1_INDEX] = color;
lcdColorTable[CURVE_CURSOR_COLOR_INDEX] = color; lcdColorTable[COLOR_THEME_WARNING_INDEX] = color;
lcdColorTable[TITLE_BGCOLOR_INDEX] = color; lcdColorTable[COLOR_THEME_SECONDARY1_INDEX] = color;
lcdColorTable[MENU_TITLE_DISABLE_COLOR_INDEX] = lcdColorTable[COLOR_THEME_PRIMARY3_INDEX] =
RGB(GET_RED(color)>>1, GET_GREEN(color)>>1, GET_BLUE(color)>>1); RGB(GET_RED(color)>>1, GET_GREEN(color)>>1, GET_BLUE(color)>>1);
lcdColorTable[TRIM_BGCOLOR_INDEX] = color; lcdColorTable[COLOR_THEME_FOCUS_INDEX] = color;
lcdColorTable[MAINVIEW_GRAPHICS_COLOR_INDEX] = color; lcdColorTable[COLOR_THEME_SECONDARY1_INDEX] = color;
#define DARKER(x) ((x * 70) / 100) #define DARKER(x) ((x * 70) / 100)
lcdColorTable[HEADER_BGCOLOR_INDEX] = RGB(DARKER(GET_RED(color)), DARKER(GET_GREEN(color)), DARKER(GET_BLUE(color))); lcdColorTable[COLOR_THEME_FOCUS_INDEX] = RGB(DARKER(GET_RED(color)), DARKER(GET_GREEN(color)), DARKER(GET_BLUE(color)));
lcdColorTable[HEADER_ICON_BGCOLOR_INDEX] = color; lcdColorTable[COLOR_THEME_SECONDARY1_INDEX] = color;
lcdColorTable[HEADER_CURRENT_BGCOLOR_INDEX] = color; lcdColorTable[COLOR_THEME_FOCUS_INDEX] = color;
#endif #endif
loadIcons(); loadIcons();
loadThemeBitmaps(); loadThemeBitmaps();
@@ -344,7 +322,7 @@ class FlyskyTheme: public OpenTxTheme
if (topleftBitmap) { if (topleftBitmap) {
dc->drawBitmap(0, 0, topleftBitmap); dc->drawBitmap(0, 0, topleftBitmap);
uint16_t width = topleftBitmap->width(); uint16_t width = topleftBitmap->width();
dc->drawSolidFilledRect(width, 0, LCD_W - width, MENU_HEADER_HEIGHT, MENU_BGCOLOR); dc->drawSolidFilledRect(width, 0, LCD_W - width, MENU_HEADER_HEIGHT, COLOR_THEME_PRIMARY2);
} }
} }
@@ -355,10 +333,10 @@ class FlyskyTheme: public OpenTxTheme
// dc->drawBitmap(0, 0, topleftBitmap); // dc->drawBitmap(0, 0, topleftBitmap);
// uint16_t width = topleftBitmap->width(); // uint16_t width = topleftBitmap->width();
// dc->drawSolidFilledRect(width, 0, LCD_W-width, // dc->drawSolidFilledRect(width, 0, LCD_W-width,
// MENU_HEADER_HEIGHT, HEADER_BGCOLOR); // MENU_HEADER_HEIGHT, COLOR_THEME_FOCUS);
// } // }
// else { // else {
dc->drawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR); dc->drawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, COLOR_THEME_FOCUS);
// } // }
// //
// if (icon == ICON_OPENTX) // if (icon == ICON_OPENTX)
@@ -368,12 +346,12 @@ class FlyskyTheme: public OpenTxTheme
// //
dc->drawSolidFilledRect(0, MENU_HEADER_HEIGHT, LCD_W, dc->drawSolidFilledRect(0, MENU_HEADER_HEIGHT, LCD_W,
MENU_TITLE_TOP - MENU_HEADER_HEIGHT, MENU_TITLE_TOP - MENU_HEADER_HEIGHT,
DEFAULT_BGCOLOR); // the white separation line COLOR_THEME_SECONDARY3); // the white separation line
dc->drawSolidFilledRect(0, MENU_TITLE_TOP, LCD_W, MENU_TITLE_HEIGHT, dc->drawSolidFilledRect(0, MENU_TITLE_TOP, LCD_W, MENU_TITLE_HEIGHT,
TITLE_BGCOLOR); // the title line background COLOR_THEME_SECONDARY1); // the title line background
// //
if (title) { if (title) {
dc->drawText(MENUS_MARGIN_LEFT, MENU_TITLE_TOP + 2, title, MENU_COLOR); dc->drawText(MENUS_MARGIN_LEFT, MENU_TITLE_TOP + 2, title, COLOR_THEME_SECONDARY1);
} }
} }
@@ -393,7 +371,7 @@ class FlyskyTheme: public OpenTxTheme
uint8_t padding_left = 4; uint8_t padding_left = 4;
dc->drawSolidFilledRect(0, 0, 4, MENU_HEADER_BUTTON_WIDTH, dc->drawSolidFilledRect(0, 0, 4, MENU_HEADER_BUTTON_WIDTH,
HEADER_BGCOLOR); COLOR_THEME_FOCUS);
for (unsigned i = 0; i < tabs.size(); i++) { for (unsigned i = 0; i < tabs.size(); i++) {
dc->drawBitmap( dc->drawBitmap(
padding_left + i * MENU_HEADER_BUTTON_WIDTH, 0, padding_left + i * MENU_HEADER_BUTTON_WIDTH, 0,
@@ -404,13 +382,13 @@ class FlyskyTheme: public OpenTxTheme
// coord_t w = width() - x; // coord_t w = width() - x;
// if (w > 0) { // if (w > 0) {
// dc->drawSolidFilledRect(x, 0, w, MENU_HEADER_BUTTON_WIDTH, // dc->drawSolidFilledRect(x, 0, w, MENU_HEADER_BUTTON_WIDTH,
// HEADER_BGCOLOR); // COLOR_THEME_FOCUS);
// } // }
} }
void drawMenuDatetime(BitmapBuffer * dc) const void drawMenuDatetime(BitmapBuffer * dc) const
{ {
dc->drawSolidVerticalLine(DATETIME_SEPARATOR_X, 7, 31, FOCUS_COLOR); dc->drawSolidVerticalLine(DATETIME_SEPARATOR_X, 7, 31, COLOR_THEME_PRIMARY2);
struct gtm t; struct gtm t;
gettime(&t); gettime(&t);
@@ -422,19 +400,19 @@ class FlyskyTheme: public OpenTxTheme
const char * const STR_MONTHS[] = TR_MONTHS; const char * const STR_MONTHS[] = TR_MONTHS;
sprintf(str, "%d %s", t.tm_mday, STR_MONTHS[t.tm_mon]); sprintf(str, "%d %s", t.tm_mday, STR_MONTHS[t.tm_mon]);
#endif #endif
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE1, str, FONT(XS)|FOCUS_COLOR|CENTERED); dc->drawText(DATETIME_MIDDLE, DATETIME_LINE1, str, FONT(XS)|COLOR_THEME_PRIMARY2|CENTERED);
getTimerString(str, getValue(MIXSRC_TX_TIME)); getTimerString(str, getValue(MIXSRC_TX_TIME));
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE2, str, FONT(XS)|FOCUS_COLOR|CENTERED); dc->drawText(DATETIME_MIDDLE, DATETIME_LINE2, str, FONT(XS)|COLOR_THEME_PRIMARY2|CENTERED);
} }
void drawProgressBar(BitmapBuffer *dc, coord_t x, coord_t y, coord_t w, void drawProgressBar(BitmapBuffer *dc, coord_t x, coord_t y, coord_t w,
coord_t h, int value, int total) const override coord_t h, int value, int total) const override
{ {
dc->drawSolidRect(x, y, w, h, 1, DEFAULT_COLOR); dc->drawSolidRect(x, y, w, h, 1, COLOR_THEME_SECONDARY1);
if (value > 0) { if (value > 0) {
int width = (w * value) / total; int width = (w * value) / total;
dc->drawSolidFilledRect(x + 2, y + 2, width - 4, h - 4, CHECKBOX_COLOR); dc->drawSolidFilledRect(x + 2, y + 2, width - 4, h - 4, COLOR_THEME_FOCUS);
} }
} }
+3 -3
View File
@@ -34,11 +34,11 @@ void TimeEdit::paint(BitmapBuffer * dc)
LcdFlags textColor; LcdFlags textColor;
if (editMode) if (editMode)
textColor = FOCUS_COLOR; textColor = COLOR_THEME_PRIMARY2;
else if (hasFocus()) else if (hasFocus())
textColor = FOCUS_COLOR; textColor = COLOR_THEME_PRIMARY2;
else else
textColor = DEFAULT_COLOR; textColor = COLOR_THEME_SECONDARY1;
dc->drawText(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, dc->drawText(FIELD_PADDING_LEFT, FIELD_PADDING_TOP,
getTimerString(getValue(), (textFlags & TIMEHOUR) != 0), getTimerString(getValue(), (textFlags & TIMEHOUR) != 0),
+3 -3
View File
@@ -33,15 +33,15 @@ AboutUs::AboutUs() :
{ {
content->setRect({(LCD_W - ABOUT_WIDTH) / 2, 20, ABOUT_WIDTH, LCD_H - 40}); content->setRect({(LCD_W - ABOUT_WIDTH) / 2, 20, ABOUT_WIDTH, LCD_H - 40});
messageWidget->setTextFlags(CENTERED | FONT(BOLD) | DEFAULT_COLOR); messageWidget->setTextFlags(CENTERED | FONT(BOLD) | COLOR_THEME_SECONDARY1);
messageWidget->setTop(content->top() + 40); messageWidget->setTop(content->top() + 40);
messageWidget->setHeight(2*PAGE_LINE_HEIGHT); messageWidget->setHeight(2*PAGE_LINE_HEIGHT);
messageWidget->setText("EdgeTX Endeavour (2.4.0)\n" messageWidget->setText("EdgeTX Endeavour (2.4.0)\n"
"Copyright (C) 2021 EdgeTX"); "Copyright (C) 2021 EdgeTX");
qrcode = BitmapBuffer::load8bitMaskOnBackground(mask_qrcode, DEFAULT_COLOR, qrcode = BitmapBuffer::load8bitMaskOnBackground(mask_qrcode, COLOR_THEME_SECONDARY1,
DEFAULT_BGCOLOR); COLOR_THEME_SECONDARY3);
new StaticBitmap(content, new StaticBitmap(content,
rect_t{ content->width() / 2 - qrcode->width() / 2, 80, rect_t{ content->width() / 2 - qrcode->width() / 2, 80,
qrcode->width(), qrcode->height()}, qrcode->width(), qrcode->height()},
+5 -5
View File
@@ -46,9 +46,9 @@ class ChannelsViewFooter: public Window {
// Draw single legend // Draw single legend
coord_t drawChannelsMonitorLegend(BitmapBuffer * dc, coord_t x, const char * s, int color) coord_t drawChannelsMonitorLegend(BitmapBuffer * dc, coord_t x, const char * s, int color)
{ {
dc->drawSolidFilledRect(x, 4, LEG_COLORBOX + 2, LEG_COLORBOX + 2, BARGRAPH_BGCOLOR); dc->drawSolidFilledRect(x, 4, LEG_COLORBOX + 2, LEG_COLORBOX + 2, COLOR_THEME_SECONDARY3);
dc->drawSolidFilledRect(x + 1, 5, LEG_COLORBOX, LEG_COLORBOX, color); dc->drawSolidFilledRect(x + 1, 5, LEG_COLORBOX, LEG_COLORBOX, color);
dc->drawText(x + 20, 4, s, TEXT_STATUSBAR_COLOR); dc->drawText(x + 20, 4, s, COLOR_THEME_PRIMARY2);
return x + 25 + getTextWidth(s); return x + 25 + getTextWidth(s);
} }
@@ -56,9 +56,9 @@ class ChannelsViewFooter: public Window {
{ {
// Draw legend bar // Draw legend bar
coord_t x = 10; coord_t x = 10;
dc->drawSolidFilledRect(0, 0, width(), height(), TITLE_BGCOLOR); dc->drawSolidFilledRect(0, 0, width(), height(), COLOR_THEME_SECONDARY1);
x = drawChannelsMonitorLegend(dc, MENUS_MARGIN_LEFT, STR_MONITOR_OUTPUT_DESC, HIGHLIGHT_COLOR); x = drawChannelsMonitorLegend(dc, MENUS_MARGIN_LEFT, STR_MONITOR_OUTPUT_DESC, COLOR_THEME_ACTIVE);
drawChannelsMonitorLegend(dc, x, STR_MONITOR_MIXER_DESC, FOCUS_BGCOLOR); drawChannelsMonitorLegend(dc, x, STR_MONITOR_MIXER_DESC, COLOR_THEME_FOCUS);
} }
}; };
@@ -32,8 +32,8 @@ class LogicalSwitchDisplayButton : public TextButton
TextButton(parent, rect, std::move(text), nullptr, OPAQUE), index(index) TextButton(parent, rect, std::move(text), nullptr, OPAQUE), index(index)
{ {
setBgColorHandler([=]() -> LcdFlags { setBgColorHandler([=]() -> LcdFlags {
if (getSwitch(SWSRC_SW1 + index)) return HIGHLIGHT_COLOR; if (getSwitch(SWSRC_SW1 + index)) return COLOR_THEME_ACTIVE;
return FIELD_BGCOLOR; return COLOR_THEME_PRIMARY2;
}); });
} }
@@ -42,9 +42,9 @@ class LogicalSwitchDisplayButton : public TextButton
bool newvalue = getSwitch(SWSRC_SW1 + index); bool newvalue = getSwitch(SWSRC_SW1 + index);
if (value != newvalue) { if (value != newvalue) {
if (newvalue) { if (newvalue) {
setTextFlags(FONT(BOLD) | DEFAULT_COLOR); setTextFlags(FONT(BOLD) | COLOR_THEME_SECONDARY1);
} else { } else {
setTextFlags(FONT(STD) | DEFAULT_COLOR); setTextFlags(FONT(STD) | COLOR_THEME_SECONDARY1);
} }
value = newvalue; value = newvalue;
invalidate(); invalidate();
@@ -45,10 +45,10 @@ class LogicalSwitchDisplayFooter : public Window
void paint(BitmapBuffer* dc) override void paint(BitmapBuffer* dc) override
{ {
dc->clear(TITLE_BGCOLOR); dc->clear(COLOR_THEME_SECONDARY1);
LogicalSwitchData* cs = lswAddress(index); LogicalSwitchData* cs = lswAddress(index);
LcdFlags textColor = FOCUS_COLOR; LcdFlags textColor = COLOR_THEME_PRIMARY2;
dc->drawTextAtIndex(10, 1, STR_VCSWFUNC, cs->func, textColor); dc->drawTextAtIndex(10, 1, STR_VCSWFUNC, cs->func, textColor);
// CSW params // CSW params
unsigned int cstate = lswFamily(cs->func); unsigned int cstate = lswFamily(cs->func);
+2 -2
View File
@@ -50,7 +50,7 @@ ViewMainMenu::ViewMainMenu(Window* parent) :
// //
// auto title = new StaticText(this, // auto title = new StaticText(this,
// {0, pos, width(), getFontHeight(FONT(XL))}, // {0, pos, width(), getFontHeight(FONT(XL))},
// "Tasks", 0, FOCUS_COLOR | FONT(XL) | CENTERED); // "Tasks", 0, COLOR_THEME_PRIMARY2 | FONT(XL) | CENTERED);
// pos += title->height() + PAGE_LINE_SPACING; // pos += title->height() + PAGE_LINE_SPACING;
carousel->addButton(ICON_MODEL_SELECT, "Select\nModel", [=]() -> uint8_t { carousel->addButton(ICON_MODEL_SELECT, "Select\nModel", [=]() -> uint8_t {
@@ -129,7 +129,7 @@ void ViewMainMenu::paint(BitmapBuffer* dc)
rect_t zone = carouselRect; rect_t zone = carouselRect;
zone.x -= 8; zone.y -= 8; zone.x -= 8; zone.y -= 8;
zone.w += 16; zone.h += 16; zone.w += 16; zone.h += 16;
dc->drawFilledRect(zone.x, zone.y, zone.w, zone.h, SOLID, OVERLAY_COLOR, OPACITY(5)); dc->drawFilledRect(zone.x, zone.y, zone.w, zone.h, SOLID, COLOR_THEME_PRIMARY1, OPACITY(5));
} }
void ViewMainMenu::deleteLater(bool detach, bool trash) void ViewMainMenu::deleteLater(bool detach, bool trash)
+6 -6
View File
@@ -49,10 +49,10 @@ class ThrottleCurveWindow : public Window
void paint(BitmapBuffer * dc) override void paint(BitmapBuffer * dc) override
{ {
// Axis // Axis
dc->drawHorizontalLine(0, height() - 2, width(), SOLID | DEFAULT_COLOR); dc->drawHorizontalLine(0, height() - 2, width(), SOLID | COLOR_THEME_SECONDARY1);
dc->drawVerticalLine(0, 0, height(), SOLID, DEFAULT_COLOR); dc->drawVerticalLine(0, 0, height(), SOLID, COLOR_THEME_SECONDARY1);
for (coord_t i=0; i < width(); i+=6) { for (coord_t i=0; i < width(); i+=6) {
dc->drawVerticalLine(i,height() - 4, 3, SOLID | DEFAULT_COLOR); dc->drawVerticalLine(i,height() - 4, 3, SOLID | COLOR_THEME_SECONDARY1);
} }
// Curve // Curve
@@ -64,17 +64,17 @@ class ThrottleCurveWindow : public Window
if (prev_yv != (coord_t)-1) { if (prev_yv != (coord_t)-1) {
if (prev_yv < yv) { if (prev_yv < yv) {
for (int y=prev_yv; y<=yv; y++) { for (int y=prev_yv; y<=yv; y++) {
dc->drawBitmapPattern(i, y, LBM_POINT, DEFAULT_COLOR); dc->drawBitmapPattern(i, y, LBM_POINT, COLOR_THEME_SECONDARY1);
} }
} }
else { else {
for (int y=yv; y<=prev_yv; y++) { for (int y=yv; y<=prev_yv; y++) {
dc->drawBitmapPattern(i, y, LBM_POINT, DEFAULT_COLOR); dc->drawBitmapPattern(i, y, LBM_POINT, COLOR_THEME_SECONDARY1);
} }
} }
} }
else { else {
dc->drawBitmapPattern(i, yv, LBM_POINT, DEFAULT_COLOR); dc->drawBitmapPattern(i, yv, LBM_POINT, COLOR_THEME_SECONDARY1);
} }
prev_yv = yv; prev_yv = yv;
} }
+2 -2
View File
@@ -37,8 +37,8 @@ class DebugInfoNumber : public Window
{ {
coord_t prefixSize = 0; coord_t prefixSize = 0;
if (prefix != nullptr) { if (prefix != nullptr) {
prefixSize = getTextWidth(prefix, 0, HEADER_COLOR | FONT(XS)); prefixSize = getTextWidth(prefix, 0, COLOR_THEME_SECONDARY1 | FONT(XS));
new StaticText(this, {0, 0, prefixSize, rect.h}, prefix, 0, HEADER_COLOR | FONT(XS)); new StaticText(this, {0, 0, prefixSize, rect.h}, prefix, 0, COLOR_THEME_SECONDARY1 | FONT(XS));
} }
new DynamicNumber<uint32_t>(this, {prefixSize, 0, rect.w - prefixSize, rect.h}, new DynamicNumber<uint32_t>(this, {prefixSize, 0, rect.w - prefixSize, rect.h},
numberHandler); numberHandler);
+1 -1
View File
@@ -421,7 +421,7 @@ void ViewTextWindow::drawVerticalScrollbar(BitmapBuffer *dc)
if (yhgt < 15) yhgt = 15; if (yhgt < 15) yhgt = 15;
if (yhgt + yofs > maxPos) yhgt = maxPos - yofs; if (yhgt + yofs > maxPos) yhgt = maxPos - yofs;
dc->drawSolidFilledRect(body.getRect().w - SCROLLBAR_WIDTH, yofs, dc->drawSolidFilledRect(body.getRect().w - SCROLLBAR_WIDTH, yofs,
SCROLLBAR_WIDTH, yhgt, SCROLLBAR_COLOR); SCROLLBAR_WIDTH, yhgt, COLOR_THEME_PRIMARY3);
} }
#endif #endif
+1 -1
View File
@@ -119,7 +119,7 @@ bool isInSetup;
new StaticText(window, new StaticText(window,
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + 10, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + 10,
LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT},
name, 0, MENU_HIGHLIGHT_COLOR); name, 0, COLOR_THEME_PRIMARY2);
}; };
}; };
+2 -2
View File
@@ -116,12 +116,12 @@ void Widget::paint(BitmapBuffer * dc)
&& !FAST_BLINK_ON_PHASE) { && !FAST_BLINK_ON_PHASE) {
return; return;
} }
dc->drawRect(0, 0, width(), height(), 2, STASHED, CHECKBOX_COLOR); dc->drawRect(0, 0, width(), height(), 2, STASHED, COLOR_THEME_FOCUS);
} }
if (fullscreen && (RTOS_GET_MS() - fsStartedTS < FULLSCREEN_HINT_DELAY)) { if (fullscreen && (RTOS_GET_MS() - fsStartedTS < FULLSCREEN_HINT_DELAY)) {
dc->drawText(width() / 2, height() / 2, "Press [RTN] long to exit", dc->drawText(width() / 2, height() / 2, "Press [RTN] long to exit",
FONT(XL) | CENTERED | VCENTERED | LINE_COLOR); FONT(XL) | CENTERED | VCENTERED | COLOR_THEME_PRIMARY3);
} }
} }
+2 -2
View File
@@ -49,11 +49,11 @@ class GaugeWidget: public Widget
int percent = divRoundClosest(100 * (value - min), (max - min)); int percent = divRoundClosest(100 * (value - min), (max - min));
// Gauge label // Gauge label
drawSource(dc, 0, 0, index, FONT(XS) | FOCUS_COLOR); drawSource(dc, 0, 0, index, FONT(XS) | COLOR_THEME_PRIMARY2);
// Gauge // Gauge
lcdSetColor(color); lcdSetColor(color);
dc->drawSolidFilledRect(0, 16, width(), 16, FOCUS_COLOR); dc->drawSolidFilledRect(0, 16, width(), 16, COLOR_THEME_PRIMARY2);
dc->drawNumber(0+width()/2, 17, percent, FONT(XS) | CUSTOM_COLOR | CENTERED, 0, nullptr, "%"); dc->drawNumber(0+width()/2, 17, percent, FONT(XS) | CUSTOM_COLOR | CENTERED, 0, nullptr, "%");
dc->invertRect(w, 16, width() - w, 16, CUSTOM_COLOR); dc->invertRect(w, 16, width() - w, 16, CUSTOM_COLOR);
} }
+4 -4
View File
@@ -51,12 +51,12 @@ class ModelBitmapWidget: public Widget
auto iconMask = theme->getIconMask(ICON_MODEL); auto iconMask = theme->getIconMask(ICON_MODEL);
if (iconMask) { if (iconMask) {
dc->drawMask(6, 4, iconMask, HEADER_COLOR); dc->drawMask(6, 4, iconMask, COLOR_THEME_SECONDARY1);
} }
dc->drawSizedText(45, 10, g_model.header.name, LEN_MODEL_NAME, dc->drawSizedText(45, 10, g_model.header.name, LEN_MODEL_NAME,
FONT(XS) | DEFAULT_COLOR); FONT(XS) | COLOR_THEME_SECONDARY1);
dc->drawSolidFilledRect(39, 27, rect.w - 48, 2, HEADER_COLOR); dc->drawSolidFilledRect(39, 27, rect.w - 48, 2, COLOR_THEME_SECONDARY1);
} }
// smaller space to draw // smaller space to draw
else if (buffer) { else if (buffer) {
@@ -90,7 +90,7 @@ class ModelBitmapWidget: public Widget
buffer.reset(new BitmapBuffer(BMP_RGB565, width(), height())); buffer.reset(new BitmapBuffer(BMP_RGB565, width(), height()));
} }
buffer->clear(DEFAULT_BGCOLOR); buffer->clear(COLOR_THEME_SECONDARY3);
if (!filename.empty()) { if (!filename.empty()) {
std::unique_ptr<BitmapBuffer> bitmap(BitmapBuffer::loadBitmap(fullpath.c_str())); std::unique_ptr<BitmapBuffer> bitmap(BitmapBuffer::loadBitmap(fullpath.c_str()));
if (!bitmap) { if (!bitmap) {
+6 -6
View File
@@ -66,16 +66,16 @@ class OutputsWidget: public Widget
dc->drawSolidFilledRect(barLft, barTop, barW , barH, CUSTOM_COLOR); dc->drawSolidFilledRect(barLft, barTop, barW , barH, CUSTOM_COLOR);
} }
if (fillW) if (fillW)
dc->drawSolidFilledRect((chanVal > 0 ? barMid : barMid - fillW), barTop, fillW, barH, BARGRAPH1_COLOR); dc->drawSolidFilledRect((chanVal > 0 ? barMid : barMid - fillW), barTop, fillW, barH, COLOR_THEME_SECONDARY1);
lcd->drawSolidVerticalLine(barMid, barTop, barH, MAINVIEW_GRAPHICS_COLOR); lcd->drawSolidVerticalLine(barMid, barTop, barH, COLOR_THEME_SECONDARY1);
dc->drawRect(x, rowTop, w, rowH + 1); dc->drawRect(x, rowTop, w, rowH + 1);
dc->drawNumber(x + barW - 10, barTop, chanVal, FONT(XS) | DEFAULT_COLOR | RIGHT, 0, nullptr, "%"); dc->drawNumber(x + barW - 10, barTop, chanVal, FONT(XS) | COLOR_THEME_SECONDARY1 | RIGHT, 0, nullptr, "%");
if (g_model.limitData[curChan - 1].name[0] != 0) { if (g_model.limitData[curChan - 1].name[0] != 0) {
dc->drawNumber(barLft + 1, barTop, curChan, FONT(XS) | DEFAULT_COLOR | LEFT | LEADING0, 2); dc->drawNumber(barLft + 1, barTop, curChan, FONT(XS) | COLOR_THEME_SECONDARY1 | LEFT | LEADING0, 2);
dc->drawSizedText(barLft + 23, barTop, g_model.limitData[curChan - 1].name, sizeof(g_model.limitData[curChan - 1].name), FONT(XS) | DEFAULT_COLOR | LEFT); dc->drawSizedText(barLft + 23, barTop, g_model.limitData[curChan - 1].name, sizeof(g_model.limitData[curChan - 1].name), FONT(XS) | COLOR_THEME_SECONDARY1 | LEFT);
} }
else { else {
drawSource(dc, barLft + 1, barTop, MIXSRC_FIRST_CH+curChan-1, FONT(XS) | DEFAULT_COLOR | LEFT); drawSource(dc, barLft + 1, barTop, MIXSRC_FIRST_CH+curChan-1, FONT(XS) | COLOR_THEME_SECONDARY1 | LEFT);
} }
} }
return lastChan - 1; return lastChan - 1;
+1 -1
View File
@@ -53,7 +53,7 @@ class TextWidget: public Widget
const ZoneOption TextWidget::options[] = { const ZoneOption TextWidget::options[] = {
{ STR_TEXT, ZoneOption::String, OPTION_VALUE_STRING(TEXT_WIDGET_DEFAULT_LABEL) }, { STR_TEXT, ZoneOption::String, OPTION_VALUE_STRING(TEXT_WIDGET_DEFAULT_LABEL) },
{ STR_COLOR, ZoneOption::Color, OPTION_VALUE_UNSIGNED(DEFAULT_COLOR>>16) }, { STR_COLOR, ZoneOption::Color, OPTION_VALUE_UNSIGNED(COLOR_THEME_SECONDARY1>>16) },
{ STR_SIZE, ZoneOption::TextSize, OPTION_VALUE_UNSIGNED(0) }, { STR_SIZE, ZoneOption::TextSize, OPTION_VALUE_UNSIGNED(0) },
{ STR_SHADOW, ZoneOption::Bool, OPTION_VALUE_BOOL(false) }, { STR_SHADOW, ZoneOption::Bool, OPTION_VALUE_BOOL(false) },
{ nullptr, ZoneOption::Bool } { nullptr, ZoneOption::Bool }
+14 -14
View File
@@ -43,51 +43,51 @@ class TimerWidget: public Widget
if (width() >= 180 && height() >= 70) { if (width() >= 180 && height() >= 70) {
if (timerState.val >= 0 || !(timerState.val % 2)) { if (timerState.val >= 0 || !(timerState.val % 2)) {
dc->drawBitmapPattern(0, 0, LBM_TIMER_BACKGROUND, MAINVIEW_PANES_COLOR); dc->drawBitmapPattern(0, 0, LBM_TIMER_BACKGROUND, COLOR_THEME_PRIMARY2);
} }
else { else {
dc->drawBitmapPattern(0, 0, LBM_TIMER_BACKGROUND, MENU_BGCOLOR); dc->drawBitmapPattern(0, 0, LBM_TIMER_BACKGROUND, COLOR_THEME_PRIMARY2);
} }
if (timerData.start && timerState.val >= 0) { if (timerData.start && timerState.val >= 0) {
dc->drawBitmapPatternPie( dc->drawBitmapPatternPie(
2, 3, LBM_RSCALE, MAINVIEW_GRAPHICS_COLOR, 0, 2, 3, LBM_RSCALE, COLOR_THEME_SECONDARY1, 0,
timerState.val <= 0 ? 360 : 360 * (timerData.start - timerState.val) / timerData.start); timerState.val <= 0 ? 360 : 360 * (timerData.start - timerState.val) / timerData.start);
} }
else { else {
dc->drawBitmapPattern(3, 4, LBM_TIMER, MAINVIEW_GRAPHICS_COLOR); dc->drawBitmapPattern(3, 4, LBM_TIMER, COLOR_THEME_SECONDARY1);
} }
if (abs(timerState.val) >= 3600) { if (abs(timerState.val) >= 3600) {
drawTimer(dc, 70, 31, abs(timerState.val), DEFAULT_COLOR | FONT(STD) | LEFT | TIMEHOUR); drawTimer(dc, 70, 31, abs(timerState.val), COLOR_THEME_SECONDARY1 | FONT(STD) | LEFT | TIMEHOUR);
} }
else { else {
drawTimer(dc,76, 31, abs(timerState.val), DEFAULT_COLOR | FONT(XL) | LEFT); drawTimer(dc,76, 31, abs(timerState.val), COLOR_THEME_SECONDARY1 | FONT(XL) | LEFT);
} }
if (ZLEN(timerData.name) > 0) { if (ZLEN(timerData.name) > 0) {
dc->drawSizedText(78, 20, timerData.name, LEN_TIMER_NAME, FONT(XS) | DEFAULT_COLOR); dc->drawSizedText(78, 20, timerData.name, LEN_TIMER_NAME, FONT(XS) | COLOR_THEME_SECONDARY1);
} }
else { else {
drawStringWithIndex(dc, 137, 17, "TMR", index + 1, FONT(XS) | DEFAULT_COLOR); drawStringWithIndex(dc, 137, 17, "TMR", index + 1, FONT(XS) | COLOR_THEME_SECONDARY1);
} }
} }
else { else {
if (timerState.val < 0 && timerState.val % 2) { if (timerState.val < 0 && timerState.val % 2) {
dc->drawSolidFilledRect(0, 0, width(), height(), HEADER_ICON_BGCOLOR); dc->drawSolidFilledRect(0, 0, width(), height(), COLOR_THEME_SECONDARY1);
} }
drawStringWithIndex(dc, 2, 0, "TMR", index + 1, FONT(XS) | FOCUS_COLOR); drawStringWithIndex(dc, 2, 0, "TMR", index + 1, FONT(XS) | COLOR_THEME_PRIMARY2);
if (width() > 100 && height() > 40) { if (width() > 100 && height() > 40) {
if (abs(timerState.val) >= 3600) { if (abs(timerState.val) >= 3600) {
drawTimer(dc,3, 16, abs(timerState.val), FOCUS_COLOR | LEFT | TIMEHOUR); drawTimer(dc,3, 16, abs(timerState.val), COLOR_THEME_PRIMARY2 | LEFT | TIMEHOUR);
} }
else { else {
drawTimer(dc, 3, 16, abs(timerState.val), FOCUS_COLOR | LEFT | FONT(STD)); drawTimer(dc, 3, 16, abs(timerState.val), COLOR_THEME_PRIMARY2 | LEFT | FONT(STD));
} }
} }
else { else {
if (abs(timerState.val) >= 3600) { if (abs(timerState.val) >= 3600) {
drawTimer(dc,3, 14, abs(timerState.val), FOCUS_COLOR | LEFT | FONT(XS) | TIMEHOUR); drawTimer(dc,3, 14, abs(timerState.val), COLOR_THEME_PRIMARY2 | LEFT | FONT(XS) | TIMEHOUR);
} }
else { else {
drawTimer(dc, 3, 14, abs(timerState.val), FOCUS_COLOR | LEFT); drawTimer(dc, 3, 14, abs(timerState.val), COLOR_THEME_PRIMARY2 | LEFT);
} }
} }
} }
+2 -2
View File
@@ -84,7 +84,7 @@ class ValueWidget: public Widget
if (field >= MIXSRC_FIRST_TIMER && field <= MIXSRC_LAST_TIMER) { if (field >= MIXSRC_FIRST_TIMER && field <= MIXSRC_LAST_TIMER) {
TimerState & timerState = timersStates[field - MIXSRC_FIRST_TIMER]; TimerState & timerState = timersStates[field - MIXSRC_FIRST_TIMER];
if (timerState.val < 0) { if (timerState.val < 0) {
color = ALARM_COLOR; color = COLOR_THEME_WARNING;
} }
if (persistentData->options[2].value.boolValue) { if (persistentData->options[2].value.boolValue) {
drawSource(dc, xLabel + 1, yLabel + 1, field, attrLabel | COLOR2FLAGS(BLACK)); drawSource(dc, xLabel + 1, yLabel + 1, field, attrLabel | COLOR2FLAGS(BLACK));
@@ -111,7 +111,7 @@ class ValueWidget: public Widget
TelemetryItem& telemetryItem = TelemetryItem& telemetryItem =
telemetryItems[(field - MIXSRC_FIRST_TELEM) / 3]; telemetryItems[(field - MIXSRC_FIRST_TELEM) / 3];
if (!telemetryItem.isAvailable() || telemetryItem.isOld()) { if (!telemetryItem.isAvailable() || telemetryItem.isOld()) {
color = TEXT_DISABLE_COLOR; color = COLOR_THEME_DISABLED;
} }
} }
+300 -265
View File
@@ -53,6 +53,16 @@ static int8_t getTextVerticalOffset(LcdFlags flags)
return text_vertical_offset[font_index] - vcenter; return text_vertical_offset[font_index] - vcenter;
} }
// Return flags with RGB color value instead of indexed theme color
static LcdFlags flagsRGB(LcdFlags flags)
{
// RGB or indexed color?
if (flags & RGB_FLAG)
return flags;
else
return (flags & 0xFFFF) | COLOR(COLOR_VAL(flags)) | RGB_FLAG;
}
/*luadoc /*luadoc
@function lcd.refresh() @function lcd.refresh()
@@ -79,14 +89,13 @@ Clear the LCD screen
@param color (optional, only on color screens) @param color (optional, only on color screens)
@status current Introduced in 2.0.0, `color` parameter introduced in 2.2.0 RC12 @status current Introduced in 2.0.0, `color` parameter introduced in 2.2.0 RC12
@notice This function only works in stand-alone and telemetry scripts.
*/ */
static int luaLcdClear(lua_State * L) static int luaLcdClear(lua_State * L)
{ {
if (luaLcdAllowed && luaLcdBuffer) { if (luaLcdAllowed && luaLcdBuffer) {
LcdFlags color = luaL_optunsigned(L, 1, DEFAULT_BGCOLOR_INDEX << 16u); LcdFlags flags = luaL_optunsigned(L, 1, COLOR2FLAGS(COLOR_THEME_SECONDARY3_INDEX));
luaLcdBuffer->clear(COLOR(COLOR_VAL(color))); flags = flagsRGB(flags);
luaLcdBuffer->clear(flags);
} }
return 0; return 0;
} }
@@ -108,7 +117,7 @@ static int luaLcdResetBacklightTimeout(lua_State * L)
} }
/*luadoc /*luadoc
@function lcd.drawPoint(x, y) @function lcd.drawPoint(x, y, [flags])
Draw a single pixel at (x,y) position Draw a single pixel at (x,y) position
@@ -116,7 +125,7 @@ Draw a single pixel at (x,y) position
@param y (positive number) y position @param y (positive number) y position
@param flags (optional) lcdflags @param flags (optional) please see [Lcd functions overview](../lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.html)
@notice Taranis has an LCD display width of 212 pixels and height of 64 pixels. @notice Taranis has an LCD display width of 212 pixels and height of 64 pixels.
Position (0,0) is at top left. Y axis is negative, top line is 0, Position (0,0) is at top left. Y axis is negative, top line is 0,
@@ -131,16 +140,17 @@ static int luaLcdDrawPoint(lua_State *L)
int x = luaL_checkinteger(L, 1); int x = luaL_checkinteger(L, 1);
int y = luaL_checkinteger(L, 2); int y = luaL_checkinteger(L, 2);
LcdFlags att = luaL_optunsigned(L, 3, 0); LcdFlags flags = luaL_optunsigned(L, 3, 0);
flags = flagsRGB(flags);
// here another definition should be used // drawPixel uses color value directly; hence COLOR_VAL again
luaLcdBuffer->drawPixel(x, y, COLOR_VAL(att)); luaLcdBuffer->drawPixel(x, y, COLOR_VAL(flags));
return 0; return 0;
} }
/*luadoc /*luadoc
@function lcd.drawLine(x1, y1, x2, y2, pattern, flags) @function lcd.drawLine(x1, y1, x2, y2, pattern, [flags])
Draw a straight line on LCD Draw a straight line on LCD
@@ -150,7 +160,7 @@ Draw a straight line on LCD
@param pattern SOLID or DOTTED @param pattern SOLID or DOTTED
@param flags lcdflags @param flags (optional) lcdflags
@notice If the start or the end of the line is outside the LCD dimensions, then the @notice If the start or the end of the line is outside the LCD dimensions, then the
whole line will not be drawn (starting from OpenTX 2.1.5) whole line will not be drawn (starting from OpenTX 2.1.5)
@@ -167,24 +177,18 @@ static int luaLcdDrawLine(lua_State *L)
coord_t x2 = luaL_checkunsigned(L, 3); coord_t x2 = luaL_checkunsigned(L, 3);
coord_t y2 = luaL_checkunsigned(L, 4); coord_t y2 = luaL_checkunsigned(L, 4);
uint8_t pat = luaL_checkunsigned(L, 5); uint8_t pat = luaL_checkunsigned(L, 5);
LcdFlags flags = luaL_checkunsigned(L, 6); LcdFlags flags = luaL_optunsigned(L, 6, 0);
flags = flagsRGB(flags);
if (x1 > LCD_W || y1 > LCD_H || x2 > LCD_W || y2 > LCD_H) if (x1 > LCD_W || y1 > LCD_H || x2 > LCD_W || y2 > LCD_H)
return 0; return 0;
uint16_t color_idx = COLOR_VAL(flags) & 0xFF;
flags = COLOR(color_idx);
if (pat == SOLID) { if (pat == SOLID) {
if (x1 == x2) { if (x1 == x2) {
luaLcdBuffer->drawSolidVerticalLine( luaLcdBuffer->drawSolidVerticalLine(x1, y1 < y2 ? y1 : y2, y1 < y2 ? (y2 - y1) + 1 : (y1 - y2) + 1, flags);
x1, y1 < y2 ? y1 : y2, y1 < y2 ? (y2 - y1) + 1 : (y1 - y2) + 1,
flags);
return 0; return 0;
} else if (y1 == y2) { } else if (y1 == y2) {
luaLcdBuffer->drawSolidHorizontalLine( luaLcdBuffer->drawSolidHorizontalLine(x1 < x2 ? x1 : x2, y1, x1 < x2 ? (x2 - x1) + 1 : (x1 - x2) + 1, flags);
x1 < x2 ? x1 : x2, y1, x1 < x2 ? (x2 - x1) + 1 : (x1 - x2) + 1,
flags);
return 0; return 0;
} }
} }
@@ -194,8 +198,55 @@ static int luaLcdDrawLine(lua_State *L)
return 0; return 0;
} }
// Used to draw text, numbers and timers
static void drawString(lua_State *L, const char * s, LcdFlags flags)
{
if (!luaLcdAllowed || !luaLcdBuffer)
return;
int x = luaL_checkinteger(L, 1);
int y = luaL_checkinteger(L, 2);
// apply text offsets, needed to align 2.4.x to 2.3.x font baselines
x += getTextHorizontalOffset(flags);
y += getTextVerticalOffset(flags) - INVERT_BOX_MARGIN;
bool invers = flags & INVERS;
if (flags & BLINK)
invers = invers && !BLINK_ON_PHASE;
if (invers) {
// Find inverse color or read from optional Lua argument
LcdFlags color = flagsRGB(flags);
LcdFlags invColor = luaL_optunsigned(L, 5, ~0u); // ~0 is impossible for color flag!
if (invColor == ~0u) {
RGB_SPLIT(COLOR_VAL(color), r, g, b);
invColor = COLOR2FLAGS(RGB_JOIN(31 - r, 63 - g, 31 - b));
} else
invColor = flagsRGB(invColor);
flags = (flags & 0xFFFF) | invColor;
// Draw color box
int height = getFontHeight(flags & 0xFFFF) + 2 * INVERT_BOX_MARGIN;
int width = getTextWidth(s, 255, flags);
int ix = x - INVERT_BOX_MARGIN;
if (flags & RIGHT)
ix -= width;
width += 2 * INVERT_BOX_MARGIN;
luaLcdBuffer->drawSolidFilledRect(ix, y, width, height, color);
} else {
if ((flags & BLINK) && !BLINK_ON_PHASE)
return;
if (flags & SHADOWED)
luaLcdBuffer->drawText(x+1, y+1, s, flags & 0xFFFF); // force black
flags = (flags & 0xFFFF) | flagsRGB(flags);
}
luaLcdBuffer->drawText(x, y, s, flags);
}
/*luadoc /*luadoc
@function lcd.drawText(x, y, text [, flags]) @function lcd.drawText(x, y, text [, flags [, inversColor]])
Draw a text beginning at (x,y) Draw a text beginning at (x,y)
@@ -203,65 +254,17 @@ Draw a text beginning at (x,y)
@param text (string) text to display @param text (string) text to display
@param flags (unsigned number) drawing flags. All values can be @param flags (optional) please see [Lcd functions overview](../lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.html) for drawing flags and colors, and [Appendix](../../part_vii_-_appendix/fonts.md) for available characters in each font set.
combined together using the + character. ie BLINK + DBLSIZE.
See the [Appendix](../appendix/fonts.md) for available characters in each font set. @param inversColor (optional with the INVERS flag) overrides the inverse text color for INVERS
* `0 or not specified` normal font
* `XXLSIZE` jumbo sized font
* `DBLSIZE` double size font
* `MIDSIZE` mid sized font
* `SMLSIZE` small font
* `INVERS` inverted display
* `BLINK` blinking text
* `RIGHT` right align text
* `CENTER` color only, center align text
* `VCENTER` color only, center text vertically
* `SHADOWED` color only, apply a shadow effect
@status current Introduced in 2.0.0, `SHADOWED` introduced in 2.2.1 @status current Introduced in 2.0.0, `SHADOWED` introduced in 2.2.1
*/ */
static int luaLcdDrawText(lua_State *L) static int luaLcdDrawText(lua_State *L)
{ {
if (!luaLcdAllowed || !luaLcdBuffer)
return 0;
int x = luaL_checkinteger(L, 1);
int y = luaL_checkinteger(L, 2);
const char * s = luaL_checkstring(L, 3); const char * s = luaL_checkstring(L, 3);
unsigned int att = luaL_optunsigned(L, 4, 0); LcdFlags flags = luaL_optunsigned(L, 4, 0);
drawString(L, s, flags);
// apply text offsets, needed to align 2.4.x to 2.3.x font baselines
x += getTextHorizontalOffset(att);
y += getTextVerticalOffset(att);
bool shadowed = att & SHADOWED;
bool invers = (att & INVERS);
if (att & BLINK) invers = invers && !(BLINK_ON_PHASE);
// from here on, we need only the color
att = (att & 0xFFFF) | COLOR(COLOR_VAL(att));
if (shadowed && !invers) {
// force black
luaLcdBuffer->drawText(x+1, y+1, s, att & 0xFFFF);
}
if (invers) {
int height = getFontHeight(att & 0xFFFF);
int width = getTextWidth(s, 255, att);
int ix = x - INVERT_BOX_MARGIN;
if (att & RIGHT) {
ix = x - width - INVERT_BOX_MARGIN;
}
luaLcdBuffer->drawSolidFilledRect(
ix, y - INVERT_BOX_MARGIN,
width + 2 * INVERT_BOX_MARGIN, height + 2 * INVERT_BOX_MARGIN,
FOCUS_BGCOLOR);
att = (att & 0xFFFF) | FOCUS_COLOR;
}
luaLcdBuffer->drawText(x, y, s, att);
return 0; return 0;
} }
@@ -272,21 +275,23 @@ Get the width and height of a text string drawn with flags
@param text (string) @param text (string)
@param flags (unsigned number) drawing flags. See lcd.drawText. @param flags (optional) please see [Lcd functions overview](../lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.html)
@retval w,h (integers) width and height of the text
@status current Introduced in 2.5.0 @status current Introduced in 2.5.0
*/ */
static int luaLcdSizeText(lua_State *L) static int luaLcdSizeText(lua_State *L)
{ {
const char * s = luaL_checkstring(L, 1); const char * s = luaL_checkstring(L, 1);
unsigned int att = luaL_optunsigned(L, 2, 0); LcdFlags flags = luaL_optunsigned(L, 2, 0);
lua_pushinteger(L, getTextWidth(s, 255, att)); lua_pushinteger(L, getTextWidth(s, 255, flags));
lua_pushinteger(L, getFontHeight(att & 0xFFFF) + getTextVerticalOffset(att & ~VCENTERED)); lua_pushinteger(L, getFontHeight(flags & 0xFFFF) + getTextVerticalOffset(flags & ~VCENTERED));
return 2; return 2;
} }
/*luadoc /*luadoc
@function lcd.drawTimer(x, y, value [, flags]) @function lcd.drawTimer(x, y, value [, flags [, inversColor]])
Display a value formatted as time at (x,y) Display a value formatted as time at (x,y)
@@ -294,41 +299,24 @@ Display a value formatted as time at (x,y)
@param value (number) time in seconds @param value (number) time in seconds
@param flags (unsigned number) drawing flags: @param flags (optional) please see [Lcd functions overview](../lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.html)
* `0 or not specified` normal representation (minutes and seconds)
* `TIMEHOUR` display hours
* other general LCD flag also apply
* `SHADOWED` Horus only, apply a shadow effect
@status current Introduced in 2.0.0, `SHADOWED` introduced in 2.2.1 @param inversColor (optional with INVERS flag) overrides the inverse text color for INVERS
@status current Introduced in 2.0.0
*/ */
static int luaLcdDrawTimer(lua_State *L) static int luaLcdDrawTimer(lua_State *L)
{ {
if (!luaLcdAllowed || !luaLcdBuffer) char s[LEN_TIMER_STRING];
return 0; int tme = luaL_checkinteger(L, 3);
LcdFlags flags = luaL_optunsigned(L, 4, 0);
int x = luaL_checkinteger(L, 1); getTimerString(s, tme, (flags & TIMEHOUR) != 0);
int y = luaL_checkinteger(L, 2); drawString(L, s, flags);
int seconds = luaL_checkinteger(L, 3);
unsigned int att = luaL_optunsigned(L, 4, 0);
// apply text offsets, needed to align 2.4.x to 2.3.x font baselines
x += getTextHorizontalOffset(att);
y += getTextVerticalOffset(att);
bool shadowed = att & SHADOWED;
att = (att & 0xFFFF) | COLOR(COLOR_VAL(att));
if (shadowed) {
drawTimer(luaLcdBuffer, x+1, y+1, seconds, (att & 0xFFFF) | LEFT);
}
drawTimer(luaLcdBuffer, x, y, seconds, att | LEFT);
return 0; return 0;
} }
/*luadoc /*luadoc
@function lcd.drawNumber(x, y, value [, flags]) @function lcd.drawNumber(x, y, value [, flags [, inversColor]])
Display a number at (x,y) Display a number at (x,y)
@@ -336,54 +324,19 @@ Display a number at (x,y)
@param value (number) value to display @param value (number) value to display
@param flags (unsigned number) drawing flags: @param flags (optional) please see [Lcd functions overview](../lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.html)
* `0 or not specified` display with no decimal (like abs())
* `PREC1` display with one decimal place (number 386 is displayed as 38.6)
* `PREC2` display with tow decimal places (number 386 is displayed as 3.86)
* other general LCD flag also apply
* `SHADOWED` Horus only, apply a shadow effect
@status current Introduced in 2.0.0, `SHADOWED` introduced in 2.2.1 @param inversColor (optional with INVERS flag) overrides the inverse text color for INVERS
@status current Introduced in 2.0.0
*/ */
static int luaLcdDrawNumber(lua_State *L) static int luaLcdDrawNumber(lua_State *L)
{ {
if (!luaLcdAllowed || !luaLcdBuffer)
return 0;
int x = luaL_checkinteger(L, 1);
int y = luaL_checkinteger(L, 2);
int val = luaL_checkinteger(L, 3);
unsigned int att = luaL_optunsigned(L, 4, 0);
bool invers = (att & INVERS);
att = (att & 0xFFFF) | COLOR(COLOR_VAL(att));
// apply text offsets, needed to align 2.4.x to 2.3.x font baselines
x += getTextHorizontalOffset(att);
y += getTextVerticalOffset(att);
char s[49]; char s[49];
BitmapBuffer::formatNumberAsString(s, 49, val, att & 0xFFFF); int val = luaL_checkinteger(L, 3);
LcdFlags flags = luaL_optunsigned(L, 4, 0);
if (invers) { BitmapBuffer::formatNumberAsString(s, 49, val, flags & 0xFFFF);
int height = getFontHeight(att & 0xFFFF); drawString(L, s, flags);
int width = getTextWidth(s, 255, att);
int ix = x - INVERT_BOX_MARGIN;
if (att & RIGHT) {
ix = x - width - INVERT_BOX_MARGIN;
}
luaLcdBuffer->drawSolidFilledRect(
ix, y - INVERT_BOX_MARGIN,
width + 2 * INVERT_BOX_MARGIN, height + 2 * INVERT_BOX_MARGIN,
FOCUS_BGCOLOR);
att = (att & 0xFFFF) | FOCUS_COLOR;
}
if ((att & SHADOWED) && !(att & INVERS)) {
luaLcdBuffer->drawNumber(x, y, val, att & 0xFFFF);
}
luaLcdBuffer->drawNumber(x, y, val, att);
return 0; return 0;
} }
@@ -397,7 +350,7 @@ Display a telemetry value at (x,y)
@param source can be a source identifier (number) or a source name (string). @param source can be a source identifier (number) or a source name (string).
See getValue() See getValue()
@param flags (unsigned number) drawing flags @param flags (optional) please see [Lcd functions overview](../lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.html)
@status current Introduced in 2.0.6, changed in 2.1.0 (only telemetry sources are valid) @status current Introduced in 2.0.6, changed in 2.1.0 (only telemetry sources are valid)
*/ */
@@ -420,9 +373,10 @@ static int luaLcdDrawChannel(lua_State *L)
channel = field.id; channel = field.id;
} }
} }
unsigned int att = luaL_optunsigned(L, 4, 0); LcdFlags flags = luaL_optunsigned(L, 4, 0);
flags = flagsRGB(flags);
getvalue_t value = getValue(channel); getvalue_t value = getValue(channel);
drawSensorCustomValue(luaLcdBuffer, x, y, (channel-MIXSRC_FIRST_TELEM)/3, value, att); drawSensorCustomValue(luaLcdBuffer, x, y, (channel-MIXSRC_FIRST_TELEM)/3, value, flags);
return 0; return 0;
} }
@@ -437,7 +391,7 @@ Draw a text representation of switch at (x,y)
@param switch (number) number of switch to display, negative number @param switch (number) number of switch to display, negative number
displays negated switch displays negated switch
@param flags (unsigned number) drawing flags, only SMLSIZE, BLINK and INVERS. @param flags (optional) please see [Lcd functions overview](../lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.html), only SMLSIZE, BLINK and INVERS.
@status current Introduced in 2.0.0 @status current Introduced in 2.0.0
*/ */
@@ -449,8 +403,9 @@ static int luaLcdDrawSwitch(lua_State *L)
int x = luaL_checkinteger(L, 1); int x = luaL_checkinteger(L, 1);
int y = luaL_checkinteger(L, 2); int y = luaL_checkinteger(L, 2);
int s = luaL_checkinteger(L, 3); int s = luaL_checkinteger(L, 3);
unsigned int att = luaL_optunsigned(L, 4, 0); LcdFlags flags = luaL_optunsigned(L, 4, 0);
drawSwitch(luaLcdBuffer, x, y, s, att); flags = flagsRGB(flags);
drawSwitch(luaLcdBuffer, x, y, s, flags);
return 0; return 0;
} }
@@ -464,7 +419,7 @@ Displays the name of the corresponding input as defined by the source at (x,y)
@param source (number) source index @param source (number) source index
@param flags (unsigned number) drawing flags @param flags (optional) please see [Lcd functions overview](../lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.html)
@status current Introduced in 2.0.0 @status current Introduced in 2.0.0
*/ */
@@ -476,8 +431,9 @@ static int luaLcdDrawSource(lua_State *L)
int x = luaL_checkinteger(L, 1); int x = luaL_checkinteger(L, 1);
int y = luaL_checkinteger(L, 2); int y = luaL_checkinteger(L, 2);
int s = luaL_checkinteger(L, 3); int s = luaL_checkinteger(L, 3);
unsigned int att = luaL_optunsigned(L, 4, 0); LcdFlags flags = luaL_optunsigned(L, 4, 0);
drawSource(luaLcdBuffer, x, y, s, att); flags = flagsRGB(flags);
drawSource(luaLcdBuffer, x, y, s, flags);
return 0; return 0;
} }
@@ -643,7 +599,7 @@ static int luaLcdDrawBitmap(lua_State *L)
} }
/*luadoc /*luadoc
@function lcd.drawRectangle(x, y, w, h [, flags [, t]]) @function lcd.drawRectangle(x, y, w, h [, flags [, t [, opacity]]])
Draw a rectangle from top left corner (x,y) of specified width and height Draw a rectangle from top left corner (x,y) of specified width and height
@@ -653,10 +609,12 @@ Draw a rectangle from top left corner (x,y) of specified width and height
@param h (number) height in pixels @param h (number) height in pixels
@param flags (unsigned number) drawing flags @param flags (optional) please see [Lcd functions overview](../lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.html)
@param t (number) thickness in pixels, defaults to 1 (only on Horus) @param t (number) thickness in pixels, defaults to 1 (only on Horus)
@param opacity (number) opacity defaults to 0 (only on Horus)
@status current Introduced in 2.0.0, changed in 2.2.0 @status current Introduced in 2.0.0, changed in 2.2.0
*/ */
static int luaLcdDrawRectangle(lua_State *L) static int luaLcdDrawRectangle(lua_State *L)
@@ -668,19 +626,18 @@ static int luaLcdDrawRectangle(lua_State *L)
int w = luaL_checkinteger(L, 3); int w = luaL_checkinteger(L, 3);
int h = luaL_checkinteger(L, 4); int h = luaL_checkinteger(L, 4);
unsigned int flags = luaL_optunsigned(L, 5, 0); LcdFlags flags = luaL_optunsigned(L, 5, 0);
flags = flagsRGB(flags);
uint8_t opacity = (flags >> 24) & 0x0F;
flags = (flags & 0xFFFF) | COLOR(COLOR_VAL(flags));
unsigned int t = luaL_optunsigned(L, 6, 1); unsigned int t = luaL_optunsigned(L, 6, 1);
uint8_t opacity = luaL_optunsigned(L, 7, 0) & 0x0F;
luaLcdBuffer->drawRect(x, y, w, h, t, SOLID, flags, opacity); luaLcdBuffer->drawRect(x, y, w, h, t, SOLID, flags, opacity);
return 0; return 0;
} }
/*luadoc /*luadoc
@function lcd.drawFilledRectangle(x, y, w, h [, flags]) @function lcd.drawFilledRectangle(x, y, w, h [, flags [, opacity]])
Draw a solid rectangle from top left corner (x,y) of specified width and height Draw a solid rectangle from top left corner (x,y) of specified width and height
@@ -690,7 +647,9 @@ Draw a solid rectangle from top left corner (x,y) of specified width and height
@param h (number) height in pixels @param h (number) height in pixels
@param flags (unsigned number) drawing flags @param flags (optional) please see [Lcd functions overview](../lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.html)
@param opacity (number) opacity defaults to 0 (only on Horus)
@status current Introduced in 2.0.0 @status current Introduced in 2.0.0
*/ */
@@ -704,10 +663,9 @@ static int luaLcdDrawFilledRectangle(lua_State *L)
int w = luaL_checkinteger(L, 3); int w = luaL_checkinteger(L, 3);
int h = luaL_checkinteger(L, 4); int h = luaL_checkinteger(L, 4);
unsigned int flags = luaL_optunsigned(L, 5, 0); LcdFlags flags = luaL_optunsigned(L, 5, 0);
flags = flagsRGB(flags);
uint8_t opacity = (flags >> 24) & 0x0F; uint8_t opacity = luaL_optunsigned(L, 6, 0) & 0x0F;
flags = (flags & 0xFFFF) | COLOR(COLOR_VAL(flags));
luaLcdBuffer->drawFilledRect(x, y, w, h, SOLID, flags, opacity); luaLcdBuffer->drawFilledRect(x, y, w, h, SOLID, flags, opacity);
@@ -730,7 +688,7 @@ Draw a simple gauge that is filled based upon fill value
@param maxfill (number) total value of fill @param maxfill (number) total value of fill
@param flags (unsigned number) drawing flags @param flags (optional) please see [Lcd functions overview](../lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.html)
@status current Introduced in 2.0.0, changed in 2.2.0 @status current Introduced in 2.0.0, changed in 2.2.0
*/ */
@@ -745,9 +703,8 @@ static int luaLcdDrawGauge(lua_State *L)
int h = luaL_checkinteger(L, 4); int h = luaL_checkinteger(L, 4);
int num = luaL_checkinteger(L, 5); int num = luaL_checkinteger(L, 5);
int den = luaL_checkinteger(L, 6); int den = luaL_checkinteger(L, 6);
unsigned int flags = luaL_optunsigned(L, 7, 0); LcdFlags flags = luaL_optunsigned(L, 7, 0);
flags = flagsRGB(flags);
flags = (flags & 0xFFFF) | COLOR(COLOR_VAL(flags));
luaLcdBuffer->drawRect(x, y, w, h, 1, 0xff, flags); luaLcdBuffer->drawRect(x, y, w, h, 1, 0xff, flags);
uint8_t len = limit((uint8_t)1, uint8_t(w*num/den), uint8_t(w)); uint8_t len = limit((uint8_t)1, uint8_t(w*num/den), uint8_t(w));
@@ -757,98 +714,65 @@ static int luaLcdDrawGauge(lua_State *L)
} }
/*luadoc /*luadoc
@function lcd.setColor(area, color) @function lcd.setColor(colorIndex, color)
Set a color for specific area Change an indexed color (theme colors and CUSTOM_COLOR). Please see [Lcd functions overview](../lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.html#color-constants)
@param area (unsigned number) specific screen area in the list bellow Please notice that changing theme colors affects not only other Lua widgets, but the entire radio interface.
* `TEXT_COLOR`
* `TEXT_BGCOLOR`
* `TEXT_INVERTED_COLOR`
* `TEXT_INVERTED_BGCOLOR`
* `LINE_COLOR`
* `SCROLLBOX_COLOR`
* `MENU_TITLE_BGCOLOR`
* `MENU_TITLE_COLOR`
* `MENU_TITLE_DISABLE_COLOR`
* `HEADER_COLOR`
* `ALARM_COLOR`
* `WARNING_COLOR`
* `TEXT_DISABLE_COLOR`
* `CURVE_AXIS_COLOR`
* `CURVE_COLOR`
* `CURVE_CURSOR_COLOR`
* `TITLE_BGCOLOR`
* `TRIM_BGCOLOR`
* `TRIM_SHADOW_COLOR`
* `HEADER_BGCOLOR`
* `HEADER_ICON_BGCOLOR`
* `HEADER_CURRENT_BGCOLOR`
* `MAINVIEW_PANES_COLOR`
* `MAINVIEW_GRAPHICS_COLOR`
* `OVERLAY_COLOR`
* `BARGRAPH1_COLOR`
* `BARGRAPH2_COLOR`
* `BARGRAPH_BGCOLOR`
* `CUSTOM_COLOR`
@param color (number) color in 5/6/5 rgb format. The following prefined colors are available @notice Only available on radios with color display
* `WHITE`
* `GREY`
* `LIGHTGREY`
* `DARKGREY`
* `BLACK`
* `YELLOW`
* `BLUE`
* `RED`
* `DARKRED`
@notice Only available on Colorlcd radios
@status current Introduced in 2.2.0 @status current Introduced in 2.2.0
*/ */
static int luaLcdSetColor(lua_State *L) static int luaLcdSetColor(lua_State *L)
{ {
unsigned int index = luaL_checkunsigned(L, 1) >> 16; unsigned int index = COLOR_VAL(luaL_checkunsigned(L, 1));
unsigned int color = luaL_checkunsigned(L, 2); LcdFlags flags = luaL_checkunsigned(L, 2);
lcdColorTable[index] = color; if (index < LCD_COLOR_COUNT)
lcdColorTable[index] = COLOR_VAL(flagsRGB(flags));
return 0; return 0;
} }
/*luadoc /*luadoc
@function lcd.getColor(area) @function lcd.getColor(flags)
Get the color for specific area : see lcd.setColor for area list Get the color value from flags
@notice Only available on Colorlcd radios @param flags (flags) please see [Lcd functions overview](../lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.html)
@retval color (flag) only the RGB565 color value of the input
@notice Only available on radios with color display
@status current Introduced in 2.3.11 @status current Introduced in 2.3.11
*/ */
static int luaLcdGetColor(lua_State *L) static int luaLcdGetColor(lua_State *L)
{ {
unsigned int index = luaL_checkunsigned(L, 1) >> 16; LcdFlags flags = luaL_checkunsigned(L, 1);
lua_pushunsigned(L, lcdColorTable[index]); if ((flags & RGB_FLAG) || (COLOR_VAL(flags) & 0xFF) < LCD_COLOR_COUNT)
lua_pushunsigned(L, flagsRGB(flags) & (COLOR_MASK(~0u) | RGB_FLAG));
else
lua_pushnil(L);
return 1; return 1;
} }
/*luadoc /*luadoc
@function lcd.RGB(r, g, b) @function lcd.RGB(r, g, b)
Returns a 5/6/5 rgb color code, that can be used with lcd.setColor Returns a drawing flag with RGB color code
@param r (integer) a number between 0x00 and 0xff that expresses te amount of red in the color @param r (integer) a number between 0 and 255 that expresses te amount of red in the color
@param g (integer) a number between 0x00 and 0xff that expresses te amount of green in the color @param g (integer) a number between 0 and 255 that expresses te amount of green in the color
@param b (integer) a number between 0x00 and 0xff that expresses te amount of blue in the color @param b (integer) a number between 0 and 255 that expresses te amount of blue in the color
@retval number (integer) rgb color expressed in 5/6/5 format @retval flag with RGB565 color
@notice Only available on Colorlcd radios @notice Only available on radios with color display
@status current Introduced in 2.2.0 @status current Introduced in 2.2.0
*/ */
@@ -857,11 +781,23 @@ static int luaRGB(lua_State *L)
int r = luaL_checkinteger(L, 1); int r = luaL_checkinteger(L, 1);
int g = luaL_checkinteger(L, 2); int g = luaL_checkinteger(L, 2);
int b = luaL_checkinteger(L, 3); int b = luaL_checkinteger(L, 3);
lua_pushinteger(L, RGB(r, g, b)); lua_pushinteger(L, COLOR2FLAGS(RGB(r, g, b)) | RGB_FLAG);
return 1; return 1;
} }
/*luadoc
@function lcd.drawCircle(x, y, r [, flags])
Draw a circle at (x, y) of specified radius
@param x,y (positive numbers) center position
@param r (number) radius in pixels
@param flags (optional) please see [Lcd functions overview](../lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.html)
@status current Introduced in 2.4.0
*/
static int luaLcdDrawCircle(lua_State *L) static int luaLcdDrawCircle(lua_State *L)
{ {
if (!luaLcdAllowed || !luaLcdBuffer) if (!luaLcdAllowed || !luaLcdBuffer)
@@ -870,15 +806,27 @@ static int luaLcdDrawCircle(lua_State *L)
coord_t x = luaL_checkunsigned(L, 1); coord_t x = luaL_checkunsigned(L, 1);
coord_t y = luaL_checkunsigned(L, 2); coord_t y = luaL_checkunsigned(L, 2);
coord_t r = luaL_checkunsigned(L, 3); coord_t r = luaL_checkunsigned(L, 3);
LcdFlags flags = luaL_checkunsigned(L, 4); LcdFlags flags = luaL_optunsigned(L, 4, 0);
flags = flagsRGB(flags);
flags = (flags & 0xFFFF) | COLOR(COLOR_VAL(flags));
luaLcdBuffer->drawCircle(x, y, r, flags); luaLcdBuffer->drawCircle(x, y, r, flags);
return 0; return 0;
} }
/*luadoc
@function lcd.drawFilledCircle(x, y, r [, flags])
Draw a filled circle at (x, y) of specified radius
@param x,y (positive numbers) center position
@param r (number) radius in pixels
@param flags (optional) please see [Lcd functions overview](../lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.html)
@status current Introduced in 2.4.0
*/
static int luaLcdDrawFilledCircle(lua_State *L) static int luaLcdDrawFilledCircle(lua_State *L)
{ {
if (!luaLcdAllowed || !luaLcdBuffer) if (!luaLcdAllowed || !luaLcdBuffer)
@@ -887,15 +835,25 @@ static int luaLcdDrawFilledCircle(lua_State *L)
coord_t x = luaL_checkunsigned(L, 1); coord_t x = luaL_checkunsigned(L, 1);
coord_t y = luaL_checkunsigned(L, 2); coord_t y = luaL_checkunsigned(L, 2);
coord_t r = luaL_checkunsigned(L, 3); coord_t r = luaL_checkunsigned(L, 3);
LcdFlags flags = luaL_checkunsigned(L, 4); LcdFlags flags = luaL_optunsigned(L, 4, 0);
flags = flagsRGB(flags);
flags = (flags & 0xFFFF) | COLOR(COLOR_VAL(flags));
luaLcdBuffer->drawFilledCircle(x, y, r, flags); luaLcdBuffer->drawFilledCircle(x, y, r, flags);
return 0; return 0;
} }
/*luadoc
@function lcd.drawTriangle(x1, y1, x2, y2, x3, y3 [, flags])
Draw a triangle
@param x1,y1,x2,y2,x3,y3 (positive numbers) coordinates of the three vertices
@param flags (optional) please see [Lcd functions overview](../lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.html)
@status current Introduced in 2.4.0
*/
static int luaLcdDrawTriangle(lua_State *L) static int luaLcdDrawTriangle(lua_State *L)
{ {
if (!luaLcdAllowed || !luaLcdBuffer) if (!luaLcdAllowed || !luaLcdBuffer)
@@ -907,9 +865,8 @@ static int luaLcdDrawTriangle(lua_State *L)
coord_t y2 = luaL_checkunsigned(L, 4); coord_t y2 = luaL_checkunsigned(L, 4);
coord_t x3 = luaL_checkunsigned(L, 5); coord_t x3 = luaL_checkunsigned(L, 5);
coord_t y3 = luaL_checkunsigned(L, 6); coord_t y3 = luaL_checkunsigned(L, 6);
LcdFlags flags = luaL_checkunsigned(L, 7); LcdFlags flags = luaL_optunsigned(L, 7, 0);
flags = flagsRGB(flags);
flags = (flags & 0xFFFF) | COLOR(COLOR_VAL(flags));
luaLcdBuffer->drawLine(x1, y1, x2, y2, SOLID, flags); luaLcdBuffer->drawLine(x1, y1, x2, y2, SOLID, flags);
luaLcdBuffer->drawLine(x2, y2, x3, y3, SOLID, flags); luaLcdBuffer->drawLine(x2, y2, x3, y3, SOLID, flags);
@@ -918,6 +875,17 @@ static int luaLcdDrawTriangle(lua_State *L)
return 0; return 0;
} }
/*luadoc
@function lcd.drawFilledTriangle(x1, y1, x2, y2, x3, y3 [, flags])
Draw a filled triangle
@param x1,y1,x2,y2,x3,y3 (positive numbers) coordinates of the three vertices
@param flags (optional) please see [Lcd functions overview](../lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.html)
@status current Introduced in 2.4.0
*/
static int luaLcdDrawFilledTriangle(lua_State *L) static int luaLcdDrawFilledTriangle(lua_State *L)
{ {
if (!luaLcdAllowed || !luaLcdBuffer) if (!luaLcdAllowed || !luaLcdBuffer)
@@ -929,15 +897,29 @@ static int luaLcdDrawFilledTriangle(lua_State *L)
coord_t y2 = luaL_checkunsigned(L, 4); coord_t y2 = luaL_checkunsigned(L, 4);
coord_t x3 = luaL_checkunsigned(L, 5); coord_t x3 = luaL_checkunsigned(L, 5);
coord_t y3 = luaL_checkunsigned(L, 6); coord_t y3 = luaL_checkunsigned(L, 6);
LcdFlags flags = luaL_checkunsigned(L, 7); LcdFlags flags = luaL_optunsigned(L, 7, 0);
flags = flagsRGB(flags);
flags = (flags & 0xFFFF) | COLOR(COLOR_VAL(flags));
luaLcdBuffer->drawFilledTriangle(x1, y1, x2, y2, x3, y3, flags); luaLcdBuffer->drawFilledTriangle(x1, y1, x2, y2, x3, y3, flags);
return 0; return 0;
} }
/*luadoc
@function lcd.drawArc(x, y, r, start, end [, flags])
Draw an arc
@param x,y (positive numbers) coordinates of the center
@param r (positive number) radius
@param start,end (positive numbers) start and end of the arc
@param flags (optional) please see [Lcd functions overview](../lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.html)
@status current Introduced in 2.4.0
*/
static int luaLcdDrawArc(lua_State *L) static int luaLcdDrawArc(lua_State *L)
{ {
if (!luaLcdAllowed || !luaLcdBuffer) if (!luaLcdAllowed || !luaLcdBuffer)
@@ -948,9 +930,8 @@ static int luaLcdDrawArc(lua_State *L)
coord_t r = luaL_checkunsigned(L, 3); coord_t r = luaL_checkunsigned(L, 3);
int start = luaL_checkunsigned(L, 4); int start = luaL_checkunsigned(L, 4);
int end = luaL_checkunsigned(L, 5); int end = luaL_checkunsigned(L, 5);
LcdFlags flags = luaL_checkunsigned(L, 6); LcdFlags flags = luaL_optunsigned(L, 6, 0);
flags = flagsRGB(flags);
flags = (flags & 0xFFFF) | COLOR(COLOR_VAL(flags));
if (r > 0) if (r > 0)
luaLcdBuffer->drawAnnulusSector(x, y, r - 1, r, start, end, flags); luaLcdBuffer->drawAnnulusSector(x, y, r - 1, r, start, end, flags);
@@ -958,6 +939,21 @@ static int luaLcdDrawArc(lua_State *L)
return 0; return 0;
} }
/*luadoc
@function lcd.drawPie(x, y, r, start, end [, flags])
Draw a pie slice
@param x,y (positive numbers) coordinates of the center
@param r (positive number) radius
@param start,end (positive numbers) start and end of the pie slice
@param flags (optional) please see [Lcd functions overview](../lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.html)
@status current Introduced in 2.4.0
*/
static int luaLcdDrawPie(lua_State *L) static int luaLcdDrawPie(lua_State *L)
{ {
if (!luaLcdAllowed || !luaLcdBuffer) if (!luaLcdAllowed || !luaLcdBuffer)
@@ -968,9 +964,8 @@ static int luaLcdDrawPie(lua_State *L)
coord_t r = luaL_checkunsigned(L, 3); coord_t r = luaL_checkunsigned(L, 3);
int start = luaL_checkunsigned(L, 4); int start = luaL_checkunsigned(L, 4);
int end = luaL_checkunsigned(L, 5); int end = luaL_checkunsigned(L, 5);
LcdFlags flags = luaL_checkunsigned(L, 6); LcdFlags flags = luaL_optunsigned(L, 6, 0);
flags = flagsRGB(flags);
flags = (flags & 0xFFFF) | COLOR(COLOR_VAL(flags));
if (r > 0) if (r > 0)
luaLcdBuffer->drawAnnulusSector(x, y, 0, r, start, end, flags); luaLcdBuffer->drawAnnulusSector(x, y, 0, r, start, end, flags);
@@ -978,6 +973,21 @@ static int luaLcdDrawPie(lua_State *L)
return 0; return 0;
} }
/*luadoc
@function lcd.drawAnnulus(x, y, r1, r2, start, end [, flags])
Draw an arc
@param x,y (positive numbers) coordinates of the center
@param r1,r2 (positive numbers) radii of the inside and outside of the annulus
@param start,end (positive numbers) start and end of the annulus
@param flags (optional) please see [Lcd functions overview](../lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.html)
@status current Introduced in 2.4.0
*/
static int luaLcdDrawAnnulus(lua_State *L) static int luaLcdDrawAnnulus(lua_State *L)
{ {
if (!luaLcdAllowed || !luaLcdBuffer) if (!luaLcdAllowed || !luaLcdBuffer)
@@ -989,15 +999,29 @@ static int luaLcdDrawAnnulus(lua_State *L)
coord_t r2 = luaL_checkunsigned(L, 4); coord_t r2 = luaL_checkunsigned(L, 4);
int start = luaL_checkunsigned(L, 5); int start = luaL_checkunsigned(L, 5);
int end = luaL_checkunsigned(L, 6); int end = luaL_checkunsigned(L, 6);
LcdFlags flags = luaL_checkunsigned(L, 7); LcdFlags flags = luaL_optunsigned(L, 7, 0);
flags = flagsRGB(flags);
flags = (flags & 0xFFFF) | COLOR(COLOR_VAL(flags));
luaLcdBuffer->drawAnnulusSector(x, y, r1, r2, start, end, flags); luaLcdBuffer->drawAnnulusSector(x, y, r1, r2, start, end, flags);
return 0; return 0;
} }
/*luadoc
@function lcd.drawLineWithClipping(x1, y1, x2, y2, xmin, xmax, ymin, ymax, pattern [, flags])
Draw a line only inside a rectangle
@param x1,y1,x2,y1 (positive numbers) coordinates of the start and end of the unclipped line
@param xmin,xmax,ymin,ymax (positive numbers) the limits of the rectangle inside which the line is drawn
@param pattern (FORCE, ERASE, DOTTED) please see [Lcd functions overview](../lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.html)
@param flags (optional) please see [Lcd functions overview](../lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.html)
@status current Introduced in 2.4.0
*/
static int luaLcdDrawLineWithClipping(lua_State *L) static int luaLcdDrawLineWithClipping(lua_State *L)
{ {
if (!luaLcdAllowed || !luaLcdBuffer) if (!luaLcdAllowed || !luaLcdBuffer)
@@ -1012,15 +1036,14 @@ static int luaLcdDrawLineWithClipping(lua_State *L)
coord_t ymin = luaL_checkunsigned(L, 7); coord_t ymin = luaL_checkunsigned(L, 7);
coord_t ymax = luaL_checkunsigned(L, 8); coord_t ymax = luaL_checkunsigned(L, 8);
uint8_t pat = luaL_checkunsigned(L, 9); uint8_t pat = luaL_checkunsigned(L, 9);
LcdFlags flags = luaL_checkunsigned(L, 10); LcdFlags flags = luaL_optunsigned(L, 10, 0);
flags = flagsRGB(flags);
flags = (flags & 0xFFFF) | COLOR(COLOR_VAL(flags));
// backup clipping rect // backup clipping rect
coord_t dc_xmin; coord_t dc_xmax; coord_t dc_ymin; coord_t dc_ymax; coord_t dc_xmin; coord_t dc_xmax; coord_t dc_ymin; coord_t dc_ymax;
luaLcdBuffer->getClippingRect(dc_xmin, dc_xmax, dc_ymin, dc_ymax); luaLcdBuffer->getClippingRect(dc_xmin, dc_xmax, dc_ymin, dc_ymax);
// resticts given clipping rect by drawing clipping rect // restricts given clipping rect by drawing clipping rect
if (dc_xmin > xmin) xmin = dc_xmin; if (dc_xmin > xmin) xmin = dc_xmin;
if (dc_xmax < xmax) xmax = dc_xmax; if (dc_xmax < xmax) xmax = dc_xmax;
if (dc_ymin > ymin) ymin = dc_ymin; if (dc_ymin > ymin) ymin = dc_ymin;
@@ -1094,6 +1117,19 @@ static void drawHudRectangle(BitmapBuffer * dc, float pitch, float roll, coord_t
} }
} }
/*luadoc
@function lcd.drawHudRectangle(pitch, roll, xmin, xmax, ymin, ymax [, flags])
Draw a rectangle in perspective
@param pitch,roll (positive numbers) pitch and roll to define the orientation of the rectangle
@param xmin,xmax,ymin,ymax (positive numbers) the limits of the rectangle
@param flags (optional) please see [Lcd functions overview](../lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.html)
@status current Introduced in 2.4.0
*/
static int luaLcdDrawHudRectangle(lua_State *L) static int luaLcdDrawHudRectangle(lua_State *L)
{ {
if (!luaLcdAllowed || !luaLcdBuffer) if (!luaLcdAllowed || !luaLcdBuffer)
@@ -1105,9 +1141,8 @@ static int luaLcdDrawHudRectangle(lua_State *L)
coord_t xmax = luaL_checkunsigned(L, 4); coord_t xmax = luaL_checkunsigned(L, 4);
coord_t ymin = luaL_checkunsigned(L, 5); coord_t ymin = luaL_checkunsigned(L, 5);
coord_t ymax = luaL_checkunsigned(L, 6); coord_t ymax = luaL_checkunsigned(L, 6);
LcdFlags flags = luaL_checkunsigned(L, 7); LcdFlags flags = luaL_optunsigned(L, 7, 0);
flags = flagsRGB(flags);
flags = (flags & 0xFFFF) | COLOR(COLOR_VAL(flags));
drawHudRectangle(luaLcdBuffer, pitch, roll, xmin, xmax, ymin, ymax, flags); drawHudRectangle(luaLcdBuffer, pitch, roll, xmin, xmax, ymin, ymax, flags);
+3 -2
View File
@@ -28,8 +28,9 @@
#undef INVERS #undef INVERS
#undef BLINK #undef BLINK
#define INVERS 0x10000000u #define INVERS 0x01u
#define BLINK 0x20000000u #define BLINK 0x1000u
#define RGB_FLAG 0x8000u
constexpr coord_t INVERT_BOX_MARGIN = 2; constexpr coord_t INVERT_BOX_MARGIN = 2;
+60 -50
View File
@@ -1903,61 +1903,71 @@ const luaR_value_entry opentxConstants[] = {
{ "COLOR", ZoneOption::Color }, { "COLOR", ZoneOption::Color },
{ "BOOL", ZoneOption::Bool }, { "BOOL", ZoneOption::Bool },
{ "STRING", ZoneOption::String }, { "STRING", ZoneOption::String },
{ "MENU_HEADER_HEIGHT", COLOR2FLAGS(MENU_HEADER_HEIGHT) },
// Colors gui/colorlcd/colors.h // Colors gui/colorlcd/colors.h
{ "ALARM_COLOR", COLOR2FLAGS(ALARM_COLOR_INDEX) }, { "COLOR_THEME_PRIMARY1", COLOR2FLAGS(COLOR_THEME_PRIMARY1_INDEX) },
{ "BARGRAPH1_COLOR", COLOR2FLAGS(BARGRAPH1_COLOR_INDEX) }, { "COLOR_THEME_PRIMARY2", COLOR2FLAGS(COLOR_THEME_PRIMARY2_INDEX) },
{ "BARGRAPH2_COLOR", COLOR2FLAGS(BARGRAPH2_COLOR_INDEX) }, { "COLOR_THEME_PRIMARY3", COLOR2FLAGS(COLOR_THEME_PRIMARY3_INDEX) },
{ "BARGRAPH_BGCOLOR", COLOR2FLAGS(BARGRAPH_BGCOLOR_INDEX) }, { "COLOR_THEME_SECONDARY1", COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) },
{ "BATTERY_CHARGE_COLOR", COLOR2FLAGS(BATTERY_CHARGE_COLOR_INDEX) }, { "COLOR_THEME_SECONDARY2", COLOR2FLAGS(COLOR_THEME_SECONDARY2_INDEX) },
{ "CHECKBOX_COLOR", COLOR2FLAGS(CHECKBOX_COLOR_INDEX) }, { "COLOR_THEME_SECONDARY3", COLOR2FLAGS(COLOR_THEME_SECONDARY3_INDEX) },
{ "CURVE_AXIS_COLOR", COLOR2FLAGS(CURVE_AXIS_COLOR_INDEX) }, { "COLOR_THEME_FOCUS", COLOR2FLAGS(COLOR_THEME_FOCUS_INDEX) },
{ "CURVE_COLOR", COLOR2FLAGS(CURVE_COLOR_INDEX) }, { "COLOR_THEME_EDIT", COLOR2FLAGS(COLOR_THEME_EDIT_INDEX) },
{ "CURVE_CURSOR_COLOR", COLOR2FLAGS(CURVE_CURSOR_COLOR_INDEX) }, { "COLOR_THEME_ACTIVE", COLOR2FLAGS(COLOR_THEME_ACTIVE_INDEX) },
{ "COLOR_THEME_WARNING", COLOR2FLAGS(COLOR_THEME_WARNING_INDEX) },
{ "COLOR_THEME_DISABLED", COLOR2FLAGS(COLOR_THEME_DISABLED_INDEX) },
{ "CUSTOM_COLOR", COLOR2FLAGS(CUSTOM_COLOR_INDEX) }, { "CUSTOM_COLOR", COLOR2FLAGS(CUSTOM_COLOR_INDEX) },
{ "DEFAULT_BGCOLOR", COLOR2FLAGS(DEFAULT_BGCOLOR_INDEX) },
{ "DEFAULT_COLOR", COLOR2FLAGS(DEFAULT_COLOR_INDEX) },
{ "DISABLE_COLOR", COLOR2FLAGS(DISABLE_COLOR_INDEX) },
{ "FOCUS_BGCOLOR", COLOR2FLAGS(FOCUS_BGCOLOR_INDEX) },
{ "FOCUS_COLOR", COLOR2FLAGS(FOCUS_COLOR_INDEX) },
{ "HEADER_BGCOLOR", COLOR2FLAGS(HEADER_BGCOLOR_INDEX) },
{ "HEADER_COLOR", COLOR2FLAGS(HEADER_COLOR_INDEX) },
{ "HEADER_CURRENT_BGCOLOR", COLOR2FLAGS(HEADER_CURRENT_BGCOLOR_INDEX) },
{ "HEADER_ICON_BGCOLOR", COLOR2FLAGS(HEADER_ICON_BGCOLOR_INDEX) },
//{ "HEADER_SEPARATOR_COLOR", COLOR2FLAGS(HEADER_SEPARATOR_COLOR_INDEX) },
{ "HIGHLIGHT_COLOR", COLOR2FLAGS(HIGHLIGHT_COLOR_INDEX) },
{ "LINE_COLOR", COLOR2FLAGS(LINE_COLOR_INDEX) },
{ "MAINVIEW_GRAPHICS_COLOR", COLOR2FLAGS(MAINVIEW_GRAPHICS_COLOR_INDEX) },
{ "MAINVIEW_PANES_COLOR", COLOR2FLAGS(MAINVIEW_PANES_COLOR_INDEX) },
{ "MENU_BGCOLOR", COLOR2FLAGS(MENU_BGCOLOR_INDEX) },
{ "MENU_COLOR", COLOR2FLAGS(MENU_COLOR_INDEX) },
{ "MENU_HEADER_HEIGHT", COLOR2FLAGS(MENU_HEADER_HEIGHT) },
{ "MENU_HIGHLIGHT_BGCOLOR", COLOR2FLAGS(MENU_HIGHLIGHT_BGCOLOR_INDEX) },
{ "MENU_HIGHLIGHT_COLOR", COLOR2FLAGS(MENU_HIGHLIGHT_COLOR_INDEX) },
{ "MENU_LINE_COLOR", COLOR2FLAGS(MENU_LINE_COLOR_INDEX) },
//{ "MENU_TITLE_BGCOLOR", COLOR2FLAGS(MENU_TITLE_BGCOLOR) },
{ "OVERLAY_COLOR", COLOR2FLAGS(OVERLAY_COLOR_INDEX) },
{ "SCROLLBAR_COLOR", COLOR2FLAGS(SCROLLBAR_COLOR_INDEX) },
{ "TABLE_BGCOLOR", COLOR2FLAGS(TABLE_BGCOLOR_INDEX) },
{ "TABLE_HEADER_BGCOLOR", COLOR2FLAGS(TABLE_HEADER_BGCOLOR_INDEX) },
{ "TEXT_DISABLE_COLOR", COLOR2FLAGS(TEXT_DISABLE_COLOR_INDEX) },
{ "TEXT_STATUSBAR_COLOR", COLOR2FLAGS(TEXT_STATUSBAR_COLOR_INDEX) },
{ "TITLE_BGCOLOR", COLOR2FLAGS(TITLE_BGCOLOR_INDEX) },
// Synonyms of the above colors // Old style theme color constants
{ "TEXT_COLOR", COLOR2FLAGS(DEFAULT_COLOR_INDEX) }, { "ALARM_COLOR", COLOR2FLAGS(COLOR_THEME_WARNING_INDEX) },
{ "TEXT_BGCOLOR", COLOR2FLAGS(DEFAULT_BGCOLOR_INDEX) }, { "BARGRAPH_BGCOLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY3_INDEX) },
{ "WARNING_COLOR", COLOR2FLAGS(HIGHLIGHT_COLOR_INDEX) }, { "BARGRAPH1_COLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) },
{ "BARGRAPH2_COLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY2_INDEX) },
{ "CURVE_AXIS_COLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY2_INDEX) },
{ "CURVE_COLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) },
{ "CURVE_CURSOR_COLOR", COLOR2FLAGS(COLOR_THEME_WARNING_INDEX) },
{ "HEADER_BGCOLOR", COLOR2FLAGS(COLOR_THEME_FOCUS_INDEX) },
{ "HEADER_COLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) },
{ "HEADER_CURRENT_BGCOLOR", COLOR2FLAGS(COLOR_THEME_FOCUS_INDEX) },
{ "HEADER_ICON_BGCOLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) },
{ "LINE_COLOR", COLOR2FLAGS(COLOR_THEME_PRIMARY3_INDEX) },
{ "MAINVIEW_GRAPHICS_COLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) },
{ "MAINVIEW_PANES_COLOR", COLOR2FLAGS(COLOR_THEME_PRIMARY2_INDEX) },
{ "MENU_TITLE_BGCOLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) },
{ "MENU_TITLE_COLOR", COLOR2FLAGS(COLOR_THEME_PRIMARY2_INDEX) },
{ "MENU_TITLE_DISABLE_COLOR", COLOR2FLAGS(COLOR_THEME_PRIMARY3_INDEX) },
{ "OVERLAY_COLOR", COLOR2FLAGS(COLOR_THEME_PRIMARY1_INDEX) },
{ "SCROLLBOX_COLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY3_INDEX) },
{ "TEXT_BGCOLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY3_INDEX) },
{ "TEXT_COLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) },
{ "TEXT_DISABLE_COLOR", COLOR2FLAGS(COLOR_THEME_DISABLED_INDEX) },
{ "TEXT_INVERTED_BGCOLOR", COLOR2FLAGS(COLOR_THEME_FOCUS_INDEX) },
{ "TEXT_INVERTED_COLOR", COLOR2FLAGS(COLOR_THEME_PRIMARY2_INDEX) },
{ "TITLE_BGCOLOR", COLOR2FLAGS(COLOR_THEME_SECONDARY1_INDEX) },
{ "TRIM_BGCOLOR", COLOR2FLAGS(COLOR_THEME_FOCUS_INDEX) },
{ "TRIM_SHADOW_COLOR", COLOR2FLAGS(COLOR_THEME_PRIMARY1_INDEX) },
{ "WARNING_COLOR", COLOR2FLAGS(COLOR_THEME_WARNING_INDEX) },
// Literal colors
{ "BLACK", RGB2FLAGS(0x00, 0x00, 0x00) },
{ "WHITE", RGB2FLAGS(0xFF, 0xFF, 0xFF) },
{ "LIGHTWHITE", RGB2FLAGS(0xEA, 0xEA, 0xEA) },
{ "YELLOW", RGB2FLAGS(0xFF, 0xFF, 0x00) },
{ "BLUE", RGB2FLAGS(0xFF, 0xFF, 0xFF) },
{ "DARKBLUE", RGB2FLAGS(0x00, 0x00, 0xA0) },
{ "GREY", RGB2FLAGS(0x60, 0x60, 0x60) },
{ "DARKGREY", RGB2FLAGS(0x40, 0x40, 0x40) },
{ "LIGHTGREY", RGB2FLAGS(0xC0, 0xC0, 0xC0) },
{ "RED", RGB2FLAGS(0xFF, 0x00, 0x00) },
{ "DARKRED", RGB2FLAGS(0xA0, 0x00, 0x00) },
{ "GREEN", RGB2FLAGS(0x00, 0xFF, 0x00) },
{ "DARKGREEN", RGB2FLAGS(0x00, 0xA0, 0x00) },
{ "LIGHTBROWN", RGB2FLAGS(0x9C, 0x6D, 0x20) },
{ "DARKBROWN", RGB2FLAGS(0x6A, 0x48, 0x10) },
{ "BRIGHTGREEN", RGB2FLAGS(0x00, 0xB4, 0x3C) },
{ "ORANGE", RGB2FLAGS(0xE5, 0x64, 0x1E) },
{ "WHITE", (double)WHITE },
{ "GREY", (double)GREY },
{ "DARKGREY", (double)DARKGREY },
{ "BLACK", (double)BLACK },
{ "YELLOW", (double)YELLOW },
{ "BLUE", (double)BLUE },
{ "LIGHTGREY", (double)LIGHTGREY },
{ "RED", (double)RED },
{ "DARKRED", (double)DARKRED },
#else #else
{ "FIXEDWIDTH", FIXEDWIDTH }, { "FIXEDWIDTH", FIXEDWIDTH },
#endif #endif
+31 -31
View File
@@ -53,7 +53,7 @@ static int luaLcdClear(lua_State *L)
{ {
if (luaLcdAllowed) { if (luaLcdAllowed) {
#if defined(COLORLCD) #if defined(COLORLCD)
LcdFlags color = luaL_optunsigned(L, 1, DEFAULT_BGCOLOR); LcdFlags color = luaL_optunsigned(L, 1, COLOR_THEME_SECONDARY3);
lcd->clear(color); lcd->clear(color);
#else #else
lcdClear(); lcdClear();
@@ -810,36 +810,36 @@ Set a color for specific area
@param area (unsigned number) specific screen area in the list bellow @param area (unsigned number) specific screen area in the list bellow
* `CUSTOM_COLOR` * `CUSTOM_COLOR`
* `DEFAULT_COLOR` * `COLOR_THEME_SECONDARY1`
* `DEFAULT_BGCOLOR` * `COLOR_THEME_SECONDARY3`
* `FOCUS_COLOR` * `COLOR_THEME_PRIMARY2`
* `FOCUS_BGCOLOR` * `COLOR_THEME_FOCUS`
* `LINE_COLOR` * `COLOR_THEME_PRIMARY3`
* `CHECKBOX_COLOR` * `COLOR_THEME_FOCUS`
* `MENU_BGCOLOR` * `COLOR_THEME_PRIMARY2`
* `MENU_COLOR` * `COLOR_THEME_SECONDARY1`
* `MENU_TITLE_DISABLE_COLOR` * `COLOR_THEME_PRIMARY3`
* `HEADER_COLOR` * `COLOR_THEME_SECONDARY1`
* `ALARM_COLOR` * `COLOR_THEME_WARNING`
* `HIGHLIGHT_COLOR` * `COLOR_THEME_ACTIVE`
* `TEXT_DISABLE_COLOR` * `COLOR_THEME_DISABLED`
* `HEADER_COLOR` * `COLOR_THEME_SECONDARY1`
* `DISABLE_COLOR` * `COLOR_THEME_DISABLED`
* `CURVE_CURSOR_COLOR` * `COLOR_THEME_WARNING`
* `TITLE_BGCOLOR` * `COLOR_THEME_SECONDARY1`
* `TRIM_BGCOLOR` * `COLOR_THEME_FOCUS`
* `TRIM_SHADOW_COLOR` * `COLOR_THEME_PRIMARY1`
* `MAINVIEW_PANES_COLOR` * `COLOR_THEME_PRIMARY2`
* `MAINVIEW_GRAPHICS_COLOR` * `COLOR_THEME_SECONDARY1`
* `MENU_BGCOLOR` * `COLOR_THEME_PRIMARY2`
* `HEADER_ICON_BGCOLOR` * `COLOR_THEME_SECONDARY1`
* `HEADER_CURRENT_BGCOLOR` * `COLOR_THEME_FOCUS`
* `MAINVIEW_PANES_COLOR` * `COLOR_THEME_PRIMARY2`
* `MAINVIEW_GRAPHICS_COLOR` * `COLOR_THEME_SECONDARY1`
* `OVERLAY_COLOR` * `COLOR_THEME_PRIMARY1`
* `BARGRAPH1_COLOR` * `COLOR_THEME_SECONDARY1`
* `BARGRAPH2_COLOR` * `COLOR_THEME_SECONDARY2`
* `BARGRAPH_BGCOLOR` * `COLOR_THEME_SECONDARY3`
* `CUSTOM_COLOR` * `CUSTOM_COLOR`
@param color (number) color in 5/6/5 rgb format. The following prefined colors are available @param color (number) color in 5/6/5 rgb format. The following prefined colors are available
@@ -31,8 +31,8 @@ static void drawProgressScreen(const char* filename, int progress, int total)
lcd->reset(); lcd->reset();
l_theme->drawBackground(lcd); l_theme->drawBackground(lcd);
lcd->drawText(LCD_W/2, LCD_H/2 - 30, STR_CONVERTING, FONT(XL) | CENTERED | ALARM_COLOR); lcd->drawText(LCD_W/2, LCD_H/2 - 30, STR_CONVERTING, FONT(XL) | CENTERED | COLOR_THEME_WARNING);
lcd->drawText(LCD_W/2, LCD_H/2, filename, FONT(STD) | CENTERED | DEFAULT_COLOR); lcd->drawText(LCD_W/2, LCD_H/2, filename, FONT(STD) | CENTERED | COLOR_THEME_SECONDARY1);
l_theme->drawProgressBar(lcd, l_theme->drawProgressBar(lcd,
LCD_W / 4, LCD_W / 4,
+7 -7
View File
@@ -108,29 +108,29 @@ void drawChargingInfo(uint16_t chargeState){
} }
text = STR_BATTERYCHARGING; text = STR_BATTERYCHARGING;
h = ((BATTERY_H_INNER * progress) / 100); h = ((BATTERY_H_INNER * progress) / 100);
color = BATTERY_CHARGE_COLOR; color = COLOR_THEME_EDIT;
} }
else if(CHARGE_FINISHED == chargeState) else if(CHARGE_FINISHED == chargeState)
{ {
text = STR_BATTERYFULL; text = STR_BATTERYFULL;
h = BATTERY_H_INNER; h = BATTERY_H_INNER;
color = BATTERY_CHARGE_COLOR; color = COLOR_THEME_EDIT;
} }
else else
{ {
text = STR_BATTERYNONE; text = STR_BATTERYNONE;
h = BATTERY_H_INNER; h = BATTERY_H_INNER;
color = TRIM_SHADOW_COLOR; color = COLOR_THEME_PRIMARY1;
} }
BACKLIGHT_ENABLE(); BACKLIGHT_ENABLE();
lcd->drawSizedText(LCD_W/2, LCD_H-50, text, strlen(text), CENTERED|MAINVIEW_PANES_COLOR); lcd->drawSizedText(LCD_W/2, LCD_H-50, text, strlen(text), CENTERED|COLOR_THEME_PRIMARY2);
lcd->drawFilledRect((LCD_W - BATTERY_W)/2, BATTERY_TOP, BATTERY_W, BATTERY_H, SOLID, MAINVIEW_PANES_COLOR); lcd->drawFilledRect((LCD_W - BATTERY_W)/2, BATTERY_TOP, BATTERY_W, BATTERY_H, SOLID, COLOR_THEME_PRIMARY2);
lcd->drawFilledRect((LCD_W - BATTERY_W_INNER)/2, BATTERY_TOP_INNER, BATTERY_W_INNER, BATTERY_H_INNER, SOLID, TRIM_SHADOW_COLOR); lcd->drawFilledRect((LCD_W - BATTERY_W_INNER)/2, BATTERY_TOP_INNER, BATTERY_W_INNER, BATTERY_H_INNER, SOLID, COLOR_THEME_PRIMARY1);
lcd->drawFilledRect((LCD_W - BATTERY_W_INNER)/2, BATTERY_TOP_INNER + BATTERY_H_INNER - h , BATTERY_W_INNER, h, SOLID, color); lcd->drawFilledRect((LCD_W - BATTERY_W_INNER)/2, BATTERY_TOP_INNER + BATTERY_H_INNER - h , BATTERY_W_INNER, h, SOLID, color);
lcd->drawFilledRect((LCD_W - BATTERY_CONNECTOR_W)/2, BATTERY_TOP-BATTERY_CONNECTOR_H , BATTERY_CONNECTOR_W, BATTERY_CONNECTOR_H, SOLID, MAINVIEW_PANES_COLOR); lcd->drawFilledRect((LCD_W - BATTERY_CONNECTOR_W)/2, BATTERY_TOP-BATTERY_CONNECTOR_H , BATTERY_CONNECTOR_W, BATTERY_CONNECTOR_H, SOLID, COLOR_THEME_PRIMARY2);
} }
#define CHARGE_INFO_DURATION 500 #define CHARGE_INFO_DURATION 500
//this method should be called by timer interrupt or by GPIO interrupt //this method should be called by timer interrupt or by GPIO interrupt
+1 -1
View File
@@ -195,7 +195,7 @@ void boardInit()
} }
void boardOff() void boardOff()
{ {
lcd->drawFilledRect(0, 0, LCD_WIDTH, LCD_HEIGHT, SOLID, HEADER_BGCOLOR); lcd->drawFilledRect(0, 0, LCD_WIDTH, LCD_HEIGHT, SOLID, COLOR_THEME_FOCUS);
lcdOff(); lcdOff();
while (pwrPressed()) { while (pwrPressed()) {
@@ -2,7 +2,7 @@
#include "../../common/arm/stm32/bootloader/boot.h" #include "../../common/arm/stm32/bootloader/boot.h"
#include "../../common/arm/stm32/bootloader/bin_files.h" #include "../../common/arm/stm32/bootloader/bin_files.h"
#define SELECTED_COLOR (INVERS | DEFAULT_COLOR) #define SELECTED_COLOR (INVERS | COLOR_THEME_SECONDARY1)
#define DEFAULT_PADDING 28 #define DEFAULT_PADDING 28
#define DOUBLE_PADDING 56 #define DOUBLE_PADDING 56
#define MESSAGE_TOP (LCD_H - (2*DOUBLE_PADDING)) #define MESSAGE_TOP (LCD_H - (2*DOUBLE_PADDING))
@@ -54,11 +54,11 @@ const uint8_t LBM_OK[] = {
void bootloaderInitScreen() void bootloaderInitScreen()
{ {
// lcdColorTable[DEFAULT_COLOR_INDEX] = WHITE; // lcdColorTable[COLOR_THEME_SECONDARY1_INDEX] = WHITE;
// lcdColorTable[DEFAULT_BGCOLOR_INDEX] = BLACK; // lcdColorTable[COLOR_THEME_SECONDARY3_INDEX] = BLACK;
// lcdColorTable[LINE_COLOR_INDEX] = RED; // lcdColorTable[COLOR_THEME_PRIMARY3_INDEX] = RED;
// lcdColorTable[BARGRAPH1_COLOR_INDEX] = RED; // lcdColorTable[COLOR_THEME_SECONDARY1_INDEX] = RED;
// lcdColorTable[BARGRAPH2_COLOR_INDEX] = RGB(73, 219, 62); // green // lcdColorTable[COLOR_THEME_SECONDARY2_INDEX] = RGB(73, 219, 62); // green
backlightEnable(BACKLIGHT_LEVEL_MAX); backlightEnable(BACKLIGHT_LEVEL_MAX);
-47
View File
@@ -108,53 +108,6 @@ constexpr uint32_t ALERT_BUTTON_TOP = 300;
constexpr uint32_t PAGE_TITLE_TOP = 2; constexpr uint32_t PAGE_TITLE_TOP = 2;
constexpr uint32_t PAGE_TITLE_LEFT = 50; constexpr uint32_t PAGE_TITLE_LEFT = 50;
/*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,
BATTERY_CHARGE_COLOR_INDEX,
LCD_COLOR_COUNT,
TABLE_HEADER_BGCOLOR_INDEX,
TABLE_BGCOLOR_INDEX,
};*/
constexpr uint32_t INPUT_EDIT_LABELS_WIDTH = 80; constexpr uint32_t INPUT_EDIT_LABELS_WIDTH = 80;
constexpr coord_t INPUT_EDIT_CURVE_WIDTH = LCD_W; constexpr coord_t INPUT_EDIT_CURVE_WIDTH = LCD_W;
constexpr coord_t INPUT_EDIT_CURVE_HEIGHT = 158; constexpr coord_t INPUT_EDIT_CURVE_HEIGHT = 158;
+64 -64
View File
@@ -31,7 +31,7 @@
#define STB_IMAGE_WRITE_IMPLEMENTATION #define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h" #include "stb_image_write.h"
/*
void convert_RGB565_to_RGB888(uint8_t * dst, const BitmapBuffer * src, coord_t w, coord_t h) void convert_RGB565_to_RGB888(uint8_t * dst, const BitmapBuffer * src, coord_t w, coord_t h)
{ {
for(int y = 0; y < src->height(); y++) { for(int y = 0; y < src->height(); y++) {
@@ -93,15 +93,15 @@ bool checkScreenshot_colorlcd(const BitmapBuffer* dc, const char* test)
TEST(Lcd_colorlcd, lines) TEST(Lcd_colorlcd, lines)
{ {
BitmapBuffer dc(BMP_RGB565, LCD_W, LCD_H); BitmapBuffer dc(BMP_RGB565, LCD_W, LCD_H);
dc.clear(DEFAULT_BGCOLOR); dc.clear(COLOR_THEME_SECONDARY3);
dc.setClippingRect(50, 400, 50, 230); dc.setClippingRect(50, 400, 50, 230);
for (int x = 10; x <= 100; x += 10) { for (int x = 10; x <= 100; x += 10) {
dc.drawLine(x, x, x + 200, x + 50, 0xF0, DEFAULT_COLOR); dc.drawLine(x, x, x + 200, x + 50, 0xF0, COLOR_THEME_SECONDARY1);
} }
for (int x = 200; x >= 100; x -= 10) { for (int x = 200; x >= 100; x -= 10) {
dc.drawLine(x, x, x - 50, x + 100, 0xF0, DEFAULT_COLOR); dc.drawLine(x, x, x - 50, x + 100, 0xF0, COLOR_THEME_SECONDARY1);
} }
dc.clearClippingRect(); dc.clearClippingRect();
@@ -113,10 +113,10 @@ TEST(Lcd_colorlcd, vline)
loadFonts(); loadFonts();
BitmapBuffer dc(BMP_RGB565, LCD_W, LCD_H); BitmapBuffer dc(BMP_RGB565, LCD_W, LCD_H);
dc.clear(DEFAULT_BGCOLOR); dc.clear(COLOR_THEME_SECONDARY3);
for (int x=0; x<100; x+=2) { for (int x=0; x<100; x+=2) {
dc.drawSolidVerticalLine(x, x/2, 12, DEFAULT_COLOR); dc.drawSolidVerticalLine(x, x/2, 12, COLOR_THEME_SECONDARY1);
} }
EXPECT_TRUE(checkScreenshot_colorlcd(&dc, "vline")); EXPECT_TRUE(checkScreenshot_colorlcd(&dc, "vline"));
} }
@@ -126,27 +126,27 @@ TEST(Lcd_colorlcd, primitives)
loadFonts(); loadFonts();
BitmapBuffer dc(BMP_RGB565, LCD_W, LCD_H); BitmapBuffer dc(BMP_RGB565, LCD_W, LCD_H);
dc.clear(DEFAULT_BGCOLOR); dc.clear(COLOR_THEME_SECONDARY3);
dc.drawText(8, 8, "The quick brown fox jumps over the lazy dog", DISABLE_COLOR); dc.drawText(8, 8, "The quick brown fox jumps over the lazy dog", COLOR_THEME_DISABLED);
dc.drawText(5, 5, "The quick brown fox jumps over the lazy dog", DEFAULT_COLOR); dc.drawText(5, 5, "The quick brown fox jumps over the lazy dog", COLOR_THEME_SECONDARY1);
dc.drawFilledRect(10, 30, 30, 30, SOLID, TITLE_BGCOLOR); dc.drawFilledRect(10, 30, 30, 30, SOLID, COLOR_THEME_SECONDARY1);
dc.drawFilledRect(50, 30, 30, 30, DOTTED, DEFAULT_COLOR); dc.drawFilledRect(50, 30, 30, 30, DOTTED, COLOR_THEME_SECONDARY1);
dc.drawRect(90, 30, 30, 30, 1, SOLID, TITLE_BGCOLOR); dc.drawRect(90, 30, 30, 30, 1, SOLID, COLOR_THEME_SECONDARY1);
dc.drawRect(130, 30, 30, 30, 2, SOLID, TITLE_BGCOLOR); dc.drawRect(130, 30, 30, 30, 2, SOLID, COLOR_THEME_SECONDARY1);
dc.drawRect(170, 30, 30, 30, 5, SOLID, TITLE_BGCOLOR); dc.drawRect(170, 30, 30, 30, 5, SOLID, COLOR_THEME_SECONDARY1);
dc.drawVerticalLine(10, 70, 100, SOLID, TITLE_BGCOLOR); dc.drawVerticalLine(10, 70, 100, SOLID, COLOR_THEME_SECONDARY1);
dc.drawVerticalLine(15, 70, 90, SOLID, TITLE_BGCOLOR); dc.drawVerticalLine(15, 70, 90, SOLID, COLOR_THEME_SECONDARY1);
dc.drawVerticalLine(20, 70, 80, SOLID, TITLE_BGCOLOR); dc.drawVerticalLine(20, 70, 80, SOLID, COLOR_THEME_SECONDARY1);
dc.drawVerticalLine(25, 70, 70, SOLID, TITLE_BGCOLOR); dc.drawVerticalLine(25, 70, 70, SOLID, COLOR_THEME_SECONDARY1);
dc.drawHorizontalLine(30, 70, 100, SOLID, DEFAULT_COLOR); dc.drawHorizontalLine(30, 70, 100, SOLID, COLOR_THEME_SECONDARY1);
dc.drawHorizontalLine(30, 75, 90, SOLID, DEFAULT_COLOR); dc.drawHorizontalLine(30, 75, 90, SOLID, COLOR_THEME_SECONDARY1);
dc.drawHorizontalLine(30, 80, 80, SOLID, DEFAULT_COLOR); dc.drawHorizontalLine(30, 80, 80, SOLID, COLOR_THEME_SECONDARY1);
dc.drawHorizontalLine(30, 85, 70, SOLID, DEFAULT_COLOR); dc.drawHorizontalLine(30, 85, 70, SOLID, COLOR_THEME_SECONDARY1);
EXPECT_TRUE(checkScreenshot_colorlcd(&dc, "primitives_" TRANSLATIONS)); EXPECT_TRUE(checkScreenshot_colorlcd(&dc, "primitives_" TRANSLATIONS));
@@ -157,29 +157,29 @@ TEST(Lcd_colorlcd, transparency)
loadFonts(); loadFonts();
BitmapBuffer dc(BMP_RGB565, LCD_W, LCD_H); BitmapBuffer dc(BMP_RGB565, LCD_W, LCD_H);
dc.clear(DEFAULT_BGCOLOR); dc.clear(COLOR_THEME_SECONDARY3);
// , OPACITY(4) // , OPACITY(4)
dc.drawText(8, 8, "The quick brown fox jumps over the lazy dog", DEFAULT_COLOR); dc.drawText(8, 8, "The quick brown fox jumps over the lazy dog", COLOR_THEME_SECONDARY1);
// , OPACITY(12) // , OPACITY(12)
dc.drawText(5, 5, "The quick brown fox jumps over the lazy dog", DEFAULT_COLOR); dc.drawText(5, 5, "The quick brown fox jumps over the lazy dog", COLOR_THEME_SECONDARY1);
dc.drawFilledRect(10, 30, 30, 30, SOLID, TITLE_BGCOLOR, OPACITY(8)); dc.drawFilledRect(10, 30, 30, 30, SOLID, COLOR_THEME_SECONDARY1, OPACITY(8));
dc.drawFilledRect(50, 30, 30, 30, DOTTED, DEFAULT_COLOR, OPACITY(10)); dc.drawFilledRect(50, 30, 30, 30, DOTTED, COLOR_THEME_SECONDARY1, OPACITY(10));
dc.drawRect(90, 30, 30, 30, 1, SOLID, TITLE_BGCOLOR, OPACITY(8)); dc.drawRect(90, 30, 30, 30, 1, SOLID, COLOR_THEME_SECONDARY1, OPACITY(8));
dc.drawRect(130, 30, 30, 30, 2, SOLID, TITLE_BGCOLOR, OPACITY(8)); dc.drawRect(130, 30, 30, 30, 2, SOLID, COLOR_THEME_SECONDARY1, OPACITY(8));
dc.drawRect(170, 30, 30, 30, 5, SOLID, TITLE_BGCOLOR, OPACITY(8)); dc.drawRect(170, 30, 30, 30, 5, SOLID, COLOR_THEME_SECONDARY1, OPACITY(8));
dc.drawVerticalLine(10, 70, 100, SOLID, TITLE_BGCOLOR, OPACITY(2)); dc.drawVerticalLine(10, 70, 100, SOLID, COLOR_THEME_SECONDARY1, OPACITY(2));
dc.drawVerticalLine(15, 70, 90, SOLID, TITLE_BGCOLOR, OPACITY(6)); dc.drawVerticalLine(15, 70, 90, SOLID, COLOR_THEME_SECONDARY1, OPACITY(6));
dc.drawVerticalLine(20, 70, 80, SOLID, TITLE_BGCOLOR, OPACITY(10)); dc.drawVerticalLine(20, 70, 80, SOLID, COLOR_THEME_SECONDARY1, OPACITY(10));
dc.drawVerticalLine(25, 70, 70, SOLID, TITLE_BGCOLOR, OPACITY(OPACITY_MAX)); dc.drawVerticalLine(25, 70, 70, SOLID, COLOR_THEME_SECONDARY1, OPACITY(OPACITY_MAX));
dc.drawHorizontalLine(30, 70, 100, SOLID, DEFAULT_COLOR, OPACITY(2)); dc.drawHorizontalLine(30, 70, 100, SOLID, COLOR_THEME_SECONDARY1, OPACITY(2));
dc.drawHorizontalLine(30, 75, 90, SOLID, DEFAULT_COLOR, OPACITY(6)); dc.drawHorizontalLine(30, 75, 90, SOLID, COLOR_THEME_SECONDARY1, OPACITY(6));
dc.drawHorizontalLine(30, 80, 80, SOLID, DEFAULT_COLOR, OPACITY(10)); dc.drawHorizontalLine(30, 80, 80, SOLID, COLOR_THEME_SECONDARY1, OPACITY(10));
dc.drawHorizontalLine(30, 85, 70, SOLID, DEFAULT_COLOR, OPACITY(OPACITY_MAX)); dc.drawHorizontalLine(30, 85, 70, SOLID, COLOR_THEME_SECONDARY1, OPACITY(OPACITY_MAX));
for(int n=0; n<10; n++) { for(int n=0; n<10; n++) {
@@ -206,22 +206,22 @@ TEST(Lcd_colorlcd, fonts)
loadFonts(); loadFonts();
BitmapBuffer dc(BMP_RGB565, LCD_W, LCD_H); BitmapBuffer dc(BMP_RGB565, LCD_W, LCD_H);
dc.clear(DEFAULT_BGCOLOR); dc.clear(COLOR_THEME_SECONDARY3);
dc.drawText(8, 8, "The quick brown fox jumps over the lazy dog", DEFAULT_COLOR|OPACITY(4)); dc.drawText(8, 8, "The quick brown fox jumps over the lazy dog", COLOR_THEME_SECONDARY1|OPACITY(4));
dc.drawText(5, 5, "The quick brown fox jumps over the lazy dog", DEFAULT_COLOR|OPACITY(12)); dc.drawText(5, 5, "The quick brown fox jumps over the lazy dog", COLOR_THEME_SECONDARY1|OPACITY(12));
dc.drawText(10, 200, "The quick", DEFAULT_COLOR|VERTICAL); dc.drawText(10, 200, "The quick", COLOR_THEME_SECONDARY1|VERTICAL);
dc.drawText(30, 200, "The quick brown fox", DEFAULT_COLOR|VERTICAL); dc.drawText(30, 200, "The quick brown fox", COLOR_THEME_SECONDARY1|VERTICAL);
dc.drawText(50, 25, "The quick", DEFAULT_COLOR | FONT(XXS)); dc.drawText(50, 25, "The quick", COLOR_THEME_SECONDARY1 | FONT(XXS));
dc.drawText(50, 40, "The quick", DEFAULT_COLOR | FONT(XS)); dc.drawText(50, 40, "The quick", COLOR_THEME_SECONDARY1 | FONT(XS));
dc.drawText(50, 55, "The quick", DEFAULT_COLOR | FONT(L)); dc.drawText(50, 55, "The quick", COLOR_THEME_SECONDARY1 | FONT(L));
dc.drawText(50, 80, "The quick", DEFAULT_COLOR | FONT(XL)); dc.drawText(50, 80, "The quick", COLOR_THEME_SECONDARY1 | FONT(XL));
dc.drawText(50, 120, "The quick", DEFAULT_COLOR | FONT(XXL)); dc.drawText(50, 120, "The quick", COLOR_THEME_SECONDARY1 | FONT(XXL));
dc.drawText(8, 208, "The quick brown fox jumps over the lazy dog", TITLE_BGCOLOR|OPACITY(4)); dc.drawText(8, 208, "The quick brown fox jumps over the lazy dog", COLOR_THEME_SECONDARY1|OPACITY(4));
dc.drawText(5, 205, "The quick brown fox jumps over the lazy dog", TITLE_BGCOLOR|OPACITY(12)); dc.drawText(5, 205, "The quick brown fox jumps over the lazy dog", COLOR_THEME_SECONDARY1|OPACITY(12));
EXPECT_TRUE(checkScreenshot_colorlcd(&dc, "fonts_" TRANSLATIONS)); EXPECT_TRUE(checkScreenshot_colorlcd(&dc, "fonts_" TRANSLATIONS));
} }
@@ -232,24 +232,24 @@ TEST(Lcd_colorlcd, clipping)
loadFonts(); loadFonts();
BitmapBuffer dc(BMP_RGB565, LCD_W, LCD_H); BitmapBuffer dc(BMP_RGB565, LCD_W, LCD_H);
dc.clear(DEFAULT_BGCOLOR); dc.clear(COLOR_THEME_SECONDARY3);
dc.drawSolidVerticalLine(100, 0, LCD_H, DEFAULT_COLOR); dc.drawSolidVerticalLine(100, 0, LCD_H, COLOR_THEME_SECONDARY1);
dc.drawSolidVerticalLine(400, 0, LCD_H, DEFAULT_COLOR); dc.drawSolidVerticalLine(400, 0, LCD_H, COLOR_THEME_SECONDARY1);
dc.drawSolidHorizontalLine(0, 50, LCD_W, DEFAULT_COLOR); dc.drawSolidHorizontalLine(0, 50, LCD_W, COLOR_THEME_SECONDARY1);
dc.drawSolidHorizontalLine(0, 200, LCD_W, DEFAULT_COLOR); dc.drawSolidHorizontalLine(0, 200, LCD_W, COLOR_THEME_SECONDARY1);
dc.setClippingRect(100, 400, 50, 200); dc.setClippingRect(100, 400, 50, 200);
dc.drawSolidHorizontalLine(0, 80, LCD_W, TITLE_BGCOLOR); dc.drawSolidHorizontalLine(0, 80, LCD_W, COLOR_THEME_SECONDARY1);
dc.drawHorizontalLine( 0, 81, LCD_W, SOLID, TITLE_BGCOLOR); dc.drawHorizontalLine( 0, 81, LCD_W, SOLID, COLOR_THEME_SECONDARY1);
dc.drawSolidVerticalLine(150, 0, LCD_H, TITLE_BGCOLOR); dc.drawSolidVerticalLine(150, 0, LCD_H, COLOR_THEME_SECONDARY1);
dc.drawVerticalLine( 151, 0, LCD_H, SOLID, TITLE_BGCOLOR); dc.drawVerticalLine( 151, 0, LCD_H, SOLID, COLOR_THEME_SECONDARY1);
dc.drawSolidRect(70, 20, 50, 50, 2, TITLE_BGCOLOR); dc.drawSolidRect(70, 20, 50, 50, 2, COLOR_THEME_SECONDARY1);
dc.drawRect( 380, 20, 50, 50, 2, SOLID, TITLE_BGCOLOR); dc.drawRect( 380, 20, 50, 50, 2, SOLID, COLOR_THEME_SECONDARY1);
dc.clearClippingRect(); dc.clearClippingRect();
EXPECT_TRUE(checkScreenshot_colorlcd(&dc, "clipping")); EXPECT_TRUE(checkScreenshot_colorlcd(&dc, "clipping"));
@@ -258,7 +258,7 @@ TEST(Lcd_colorlcd, clipping)
TEST(Lcd_colorlcd, bitmap) TEST(Lcd_colorlcd, bitmap)
{ {
BitmapBuffer dc(BMP_RGB565, LCD_W, LCD_H); BitmapBuffer dc(BMP_RGB565, LCD_W, LCD_H);
dc.clear(DEFAULT_BGCOLOR); dc.clear(COLOR_THEME_SECONDARY3);
dc.setClippingRect(100, 400, 50, 200); dc.setClippingRect(100, 400, 50, 200);
std::unique_ptr<BitmapBuffer> bmp(BitmapBuffer::loadBitmap(TESTS_PATH "/opentx.png")); std::unique_ptr<BitmapBuffer> bmp(BitmapBuffer::loadBitmap(TESTS_PATH "/opentx.png"));
@@ -273,7 +273,7 @@ TEST(Lcd_colorlcd, bitmap)
TEST(Lcd_colorlcd, masks) TEST(Lcd_colorlcd, masks)
{ {
BitmapBuffer dc(BMP_RGB565, LCD_W, LCD_H); BitmapBuffer dc(BMP_RGB565, LCD_W, LCD_H);
dc.clear(DEFAULT_BGCOLOR); dc.clear(COLOR_THEME_SECONDARY3);
BitmapBuffer* mask = BitmapBuffer::loadMask(TESTS_PATH "/mask_menu_radio.png"); BitmapBuffer* mask = BitmapBuffer::loadMask(TESTS_PATH "/mask_menu_radio.png");
for (int i=0; i<LCD_W; i += mask->width()) { for (int i=0; i<LCD_W; i += mask->width()) {
@@ -306,5 +306,5 @@ TEST(Lcd_colorlcd, darkmode)
EXPECT_TRUE(checkScreenshot_colorlcd(&dc, "darkmode_" TRANSLATIONS)); EXPECT_TRUE(checkScreenshot_colorlcd(&dc, "darkmode_" TRANSLATIONS));
} }
*/
#endif #endif