Cosmetics

This commit is contained in:
Bertrand Songis
2019-10-04 19:32:10 +02:00
parent 8ad093ea86
commit 9e152b8fba
18 changed files with 24 additions and 61 deletions
-7
View File
@@ -35,13 +35,8 @@
#define DARKRED RGB(160, 0, 6)
#define GREEN RGB(25, 150, 50)
#define DEFAULT_COLOR COLOR(DEFAULT_COLOR_INDEX)
#define DEFAULT_BGCOLOR COLOR(DEFAULT_BGCOLOR_INDEX)
#define FOCUS_COLOR COLOR(FOCUS_COLOR_INDEX)
#define FOCUS_BGCOLOR COLOR(FOCUS_BGCOLOR_INDEX)
#define TEXT_STATUSBAR_COLOR COLOR(TEXT_STATUSBAR_COLOR_INDEX)
#define LINE_COLOR COLOR(LINE_COLOR_INDEX)
#define SCROLLBOX_COLOR COLOR(SCROLLBOX_COLOR_INDEX)
#define HEADER_SEPARATOR_COLOR COLOR(HEADER_SEPARATOR_COLOR_INDEX)
#define MENU_TITLE_BGCOLOR COLOR(MENU_TITLE_BGCOLOR_INDEX)
#define MENU_TITLE_COLOR COLOR(MENU_TITLE_COLOR_INDEX)
@@ -50,7 +45,6 @@
#define ALARM_COLOR COLOR(ALARM_COLOR_INDEX)
#define WARNING_COLOR COLOR(WARNING_COLOR_INDEX)
#define TEXT_DISABLE_COLOR COLOR(TEXT_DISABLE_COLOR_INDEX)
#define DISABLE_COLOR COLOR(DISABLE_COLOR_INDEX)
#define CURVE_COLOR COLOR(CURVE_COLOR_INDEX)
#define CURVE_CURSOR_COLOR COLOR(CURVE_CURSOR_COLOR_INDEX)
#define TITLE_BGCOLOR COLOR(TITLE_BGCOLOR_INDEX)
@@ -65,6 +59,5 @@
#define BARGRAPH1_COLOR COLOR(BARGRAPH1_COLOR_INDEX)
#define BARGRAPH2_COLOR COLOR(BARGRAPH2_COLOR_INDEX)
#define BARGRAPH_BGCOLOR COLOR(BARGRAPH_BGCOLOR_INDEX)
#define CUSTOM_COLOR COLOR(CUSTOM_COLOR_INDEX)
#endif // _COLORS_H_
+1 -1
View File
@@ -41,7 +41,7 @@ void drawVerticalScrollbar(BitmapBuffer * dc, coord_t x, coord_t y, coord_t h, u
coord_t yhgt = (h*visible + count/2) / count;
if (yhgt + yofs > h)
yhgt = h - yofs;
dc->drawSolidFilledRect(x-1, y + yofs, 3, yhgt, SCROLLBOX_COLOR);
dc->drawSolidFilledRect(x-1, y + yofs, 3, yhgt, CHECKBOX_COLOR);
}
}
+1 -1
View File
@@ -116,7 +116,7 @@ bool CheckBox(W * window, rect_t & rect, const char * label, uint8_t & value, Lc
}
else {
if (value) {
window->drawSolidFilledRect(x+2, rect.y+11, 8, 8, SCROLLBOX_COLOR);
window->drawSolidFilledRect(x+2, rect.y+11, 8, 8, CHECKBOX_COLOR);
drawSolidRect(window, x, rect.y+9, 12, 12, 1, LINE_COLOR);
}
else {
+1 -1
View File
@@ -153,7 +153,7 @@ class CurveButton : public Button {
void paint(BitmapBuffer * dc) override
{
// bounding rect
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, hasFocus() ? SCROLLBOX_COLOR : DISABLE_COLOR);
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, hasFocus() ? CHECKBOX_COLOR : DISABLE_COLOR);
// curve characteristics
if (isCurveFilled(index)) {
+2 -2
View File
@@ -302,7 +302,7 @@ void CommonInputOrMixButton::drawFlightModes(BitmapBuffer *dc, FlightModesType v
dc->drawText(x, PAGE_LINE_HEIGHT + FIELD_PADDING_TOP, s, SMLSIZE | TEXT_DISABLE_COLOR);
}
else {
dc->drawSolidFilledRect(x, PAGE_LINE_HEIGHT + FIELD_PADDING_TOP, 8, 3, SCROLLBOX_COLOR);
dc->drawSolidFilledRect(x, PAGE_LINE_HEIGHT + FIELD_PADDING_TOP, 8, 3, CHECKBOX_COLOR);
dc->drawText(x, PAGE_LINE_HEIGHT + FIELD_PADDING_TOP, s, SMLSIZE);
}
x += 8;
@@ -314,7 +314,7 @@ void CommonInputOrMixButton::paint(BitmapBuffer * dc)
if (active)
dc->drawSolidFilledRect(2, 2, rect.w - 4, rect.h - 4, WARNING_COLOR);
paintBody(dc);
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, hasFocus() ? SCROLLBOX_COLOR : DISABLE_COLOR);
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, hasFocus() ? CHECKBOX_COLOR : DISABLE_COLOR);
}
class InputLineButton : public CommonInputOrMixButton {
@@ -265,7 +265,7 @@ class LogicalSwitchButton : public Button {
dc->drawSolidFilledRect(2, 2, rect.w-4, rect.h-4, WARNING_COLOR);
// The bounding rect
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, hasFocus() ? SCROLLBOX_COLOR : DISABLE_COLOR);
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, hasFocus() ? CHECKBOX_COLOR : DISABLE_COLOR);
// CSW func
dc->drawTextAtIndex(col1, line1, STR_VCSWFUNC, ls->func);
+1 -1
View File
@@ -141,7 +141,7 @@ class OutputLineButton : public Button {
}
// bounding rect
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, hasFocus() ? SCROLLBOX_COLOR : DISABLE_COLOR);
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, hasFocus() ? CHECKBOX_COLOR : DISABLE_COLOR);
}
protected:
+1 -1
View File
@@ -96,7 +96,7 @@ class SensorButton : public Button {
else if (sensor->type == TELEM_TYPE_CUSTOM && !g_model.ignoreSensorIds) {
dc->drawNumber(SENSOR_COL3, line1, sensor->instance, LEFT);
}
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, hasFocus() ? SCROLLBOX_COLOR : DISABLE_COLOR);
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, hasFocus() ? CHECKBOX_COLOR : DISABLE_COLOR);
}
protected:
+1 -1
View File
@@ -380,7 +380,7 @@ class SpecialFunctionButton : public Button {
if (active)
dc->drawSolidFilledRect(2, 2, rect.w - 4, rect.h - 4, WARNING_COLOR);
paintSpecialFunctionLine(dc);
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, hasFocus() ? SCROLLBOX_COLOR : DISABLE_COLOR);
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, hasFocus() ? CHECKBOX_COLOR : DISABLE_COLOR);
}
protected:
+2 -2
View File
@@ -146,7 +146,7 @@ void ThemeBase::drawCheckBox(BitmapBuffer * dc, bool checked, coord_t x, coord_t
dc->drawSolidFilledRect(x + 0, y + 2, 16, 16, FOCUS_BGCOLOR);
if (checked) {
dc->drawSolidFilledRect(x + 2, y + 4, 12, 12, DEFAULT_BGCOLOR);
dc->drawSolidFilledRect(x + 3, y + 5, 10, 10, SCROLLBOX_COLOR);
dc->drawSolidFilledRect(x + 3, y + 5, 10, 10, CHECKBOX_COLOR);
}
else {
dc->drawSolidFilledRect(x + 2, y + 4, 12, 12, DEFAULT_BGCOLOR);
@@ -155,7 +155,7 @@ void ThemeBase::drawCheckBox(BitmapBuffer * dc, bool checked, coord_t x, coord_t
else {
dc->drawSolidRect(x + 0, y + 2, 16, 16, 1, DISABLE_COLOR);
if (checked) {
dc->drawSolidFilledRect(x + 2, y + 4, 12, 12, SCROLLBOX_COLOR);
dc->drawSolidFilledRect(x + 2, y + 4, 12, 12, CHECKBOX_COLOR);
}
}
}
+3 -3
View File
@@ -46,7 +46,7 @@ class FlyskyTheme: public ThemeBase
lcdColorTable[FOCUS_BGCOLOR_INDEX] = RED;
lcdColorTable[TEXT_STATUSBAR_COLOR_INDEX] = WHITE;
lcdColorTable[LINE_COLOR_INDEX] = GREY;
lcdColorTable[SCROLLBOX_COLOR_INDEX] = RED;
lcdColorTable[CHECKBOX_COLOR_INDEX] = RED;
lcdColorTable[MENU_TITLE_BGCOLOR_INDEX] = DARKGREY;
lcdColorTable[MENU_TITLE_COLOR_INDEX] = WHITE;
lcdColorTable[MENU_TITLE_DISABLE_COLOR_INDEX] = RGB(GET_RED(RED)>>1, GET_GREEN(RED)>>1, GET_BLUE(RED)>>1);
@@ -311,7 +311,7 @@ class FlyskyTheme: public ThemeBase
lcdColorTable[DEFAULT_BGCOLOR_INDEX] = bg_color;
lcdColorTable[FOCUS_BGCOLOR_INDEX] = color;
lcdColorTable[SCROLLBOX_COLOR_INDEX] = color;
lcdColorTable[CHECKBOX_COLOR_INDEX] = color;
lcdColorTable[CURVE_COLOR_INDEX] = color;
lcdColorTable[CURVE_CURSOR_COLOR_INDEX] = color;
lcdColorTable[TITLE_BGCOLOR_INDEX] = color;
@@ -413,7 +413,7 @@ class FlyskyTheme: public ThemeBase
dc->drawSolidRect(x, y, w, h, 1, DEFAULT_COLOR);
if (value > 0) {
int width = (w * value) / 100;
dc->drawSolidFilledRect(x + 2, y + 2, width - 4, h - 4, SCROLLBOX_COLOR);
dc->drawSolidFilledRect(x + 2, y + 2, width - 4, h - 4, CHECKBOX_COLOR);
}
}
+3 -3
View File
@@ -45,7 +45,7 @@ class FrskyTheme: public ThemeBase
lcdColorTable[FOCUS_BGCOLOR_INDEX] = RED;
lcdColorTable[TEXT_STATUSBAR_COLOR_INDEX] = WHITE;
lcdColorTable[LINE_COLOR_INDEX] = GREY;
lcdColorTable[SCROLLBOX_COLOR_INDEX] = RED;
lcdColorTable[CHECKBOX_COLOR_INDEX] = RED;
lcdColorTable[MENU_TITLE_BGCOLOR_INDEX] = DARKGREY;
lcdColorTable[MENU_TITLE_COLOR_INDEX] = WHITE;
lcdColorTable[MENU_TITLE_DISABLE_COLOR_INDEX] = RGB(GET_RED(RED)>>1, GET_GREEN(RED)>>1, GET_BLUE(RED)>>1);
@@ -291,7 +291,7 @@ class FrskyTheme: public ThemeBase
lcdColorTable[DEFAULT_BGCOLOR_INDEX] = bg_color;
lcdColorTable[FOCUS_BGCOLOR_INDEX] = color;
lcdColorTable[SCROLLBOX_COLOR_INDEX] = color;
lcdColorTable[CHECKBOX_COLOR_INDEX] = color;
lcdColorTable[CURVE_COLOR_INDEX] = color;
lcdColorTable[CURVE_CURSOR_COLOR_INDEX] = color;
lcdColorTable[TITLE_BGCOLOR_INDEX] = color;
@@ -388,7 +388,7 @@ class FrskyTheme: public ThemeBase
dc->drawSolidRect(x, y, w, h, 1, DEFAULT_COLOR);
if (value > 0) {
int width = (w * value) / 100;
dc->drawSolidFilledRect(x + 2, y + 2, width - 4, h - 4, SCROLLBOX_COLOR);
dc->drawSolidFilledRect(x + 2, y + 2, width - 4, h - 4, CHECKBOX_COLOR);
}
}
+1 -1
View File
@@ -1641,7 +1641,7 @@ const luaR_value_entry opentxConstants[] = {
{ "FOCUS_COLOR", FOCUS_COLOR },
{ "FOCUS_BGCOLOR", FOCUS_BGCOLOR },
{ "LINE_COLOR", LINE_COLOR },
{ "SCROLLBOX_COLOR", SCROLLBOX_COLOR },
{ "CHECKBOX_COLOR", CHECKBOX_COLOR },
{ "MENU_TITLE_BGCOLOR", MENU_TITLE_BGCOLOR },
{ "MENU_TITLE_COLOR", MENU_TITLE_COLOR },
{ "MENU_TITLE_DISABLE_COLOR", MENU_TITLE_DISABLE_COLOR },
+1 -1
View File
@@ -782,7 +782,7 @@ Set a color for specific area
* `FOCUS_COLOR`
* `FOCUS_BGCOLOR`
* `LINE_COLOR`
* `SCROLLBOX_COLOR`
* `CHECKBOX_COLOR`
* `MENU_TITLE_BGCOLOR`
* `MENU_TITLE_COLOR`
* `MENU_TITLE_DISABLE_COLOR`
+2 -32
View File
@@ -205,36 +205,6 @@ const char * getBasename(const char * path)
return path;
}
/**
Check if given extension exists in a list of extensions.
@param extension The extension to search for, including leading period.
@param pattern One or more file extensions concatenated together, including the periods.
The list is searched backwards and the first match, if any, is returned.
eg: ".gif.jpg.jpeg.png"
@param match Optional container to hold the matched file extension (wide enough to hold LEN_FILE_EXTENSION_MAX + 1).
@retval true if a extension was found in the lost, false otherwise.
*/
bool isExtensionMatching(const char * extension, const char * pattern, char * match)
{
const char *ext;
uint8_t extlen, fnlen;
int plen;
ext = getFileExtension(pattern, 0, 0, &fnlen, &extlen);
plen = (int)fnlen;
while (plen > 0 && ext) {
if (!strncasecmp(extension, ext, extlen)) {
if (match != nullptr) strncat(&(match[0]='\0'), ext, extlen);
return true;
}
plen -= extlen;
if (plen > 0) {
ext = getFileExtension(pattern, plen, 0, nullptr, &extlen);
}
}
return false;
}
bool sdListFiles(const char * path, const char * extension, const uint8_t maxlen, const char * selection, uint8_t flags)
{
static uint16_t lastpopupMenuOffset = 0;
@@ -402,13 +372,13 @@ void sdReadTextFile(const char * filename, char lines[NUM_BODY_LINES][LCD_COLS +
result = f_open(&file, filename, FA_OPEN_EXISTING | FA_READ);
if (result == FR_OK) {
for (unsigned i = 0; i < TEXT_FILE_MAXSIZE && f_read(&file, &c, 1, &sz) == FR_OK && sz == 1 && (lines_count == 0 || current_line - menuVerticalOffset < NUM_BODY_LINES); i++) {
for (uint32_t i = 0; i < TEXT_FILE_MAXSIZE && f_read(&file, &c, 1, &sz) == FR_OK && sz == 1 && (lines_count == 0 || current_line - menuVerticalOffset < int(NUM_BODY_LINES)); i++) {
if (c == '\n') {
++current_line;
line_length = 0;
escape = 0;
}
else if (c!='\r' && current_line>=menuVerticalOffset && current_line-menuVerticalOffset<NUM_BODY_LINES && line_length<LCD_COLS) {
else if (c != '\r' && current_line >= menuVerticalOffset && current_line - menuVerticalOffset < int(NUM_BODY_LINES) && line_length < LCD_COLS) {
if (c == '\\' && escape == 0) {
escape = 1;
continue;
+1 -1
View File
@@ -97,7 +97,7 @@ enum LcdColorIndex
FOCUS_BGCOLOR_INDEX,
TEXT_STATUSBAR_COLOR_INDEX,
LINE_COLOR_INDEX,
SCROLLBOX_COLOR_INDEX,
CHECKBOX_COLOR_INDEX,
MENU_TITLE_BGCOLOR_INDEX,
MENU_TITLE_COLOR_INDEX,
MENU_TITLE_DISABLE_COLOR_INDEX,
+1 -1
View File
@@ -95,7 +95,7 @@ enum LcdColorIndex
FOCUS_BGCOLOR_INDEX,
TEXT_STATUSBAR_COLOR_INDEX,
LINE_COLOR_INDEX,
SCROLLBOX_COLOR_INDEX,
CHECKBOX_COLOR_INDEX,
MENU_TITLE_BGCOLOR_INDEX,
MENU_TITLE_COLOR_INDEX,
MENU_TITLE_DISABLE_COLOR_INDEX,