Fonts refactoring (no more font list in libopenui)

This commit is contained in:
Bertrand Songis
2019-10-22 10:25:18 +02:00
parent 1d8c5d38e4
commit 8bd4f0b7de
35 changed files with 175 additions and 166 deletions
+3 -3
View File
@@ -311,9 +311,9 @@ if(FLYSKY_HALL_STICKS_REVERSE)
add_definitions(-DFLYSKY_HALL_STICKS_REVERSE)
endif()
if(NOT FONT STREQUAL "")
add_definitions(-DFONT=${DEFAULT_MODE})
endif()
#if(NOT FONT STREQUAL "")
# add_definitions(-DFONT=${DEFAULT_MODE})
#endif()
if(EEPROM_VARIANT_NEEDED)
add_definitions(-DEEPROM_VARIANT=${EEPROM_VARIANT})
+2 -2
View File
@@ -98,8 +98,8 @@ void Curve::drawPosition(BitmapBuffer * dc)
char coords[16];
strAppendSigned(strAppend(strAppendSigned(coords, calcRESXto100(valueX)), ","), calcRESXto100(valueY));
dc->drawSolidFilledRect(10, 11, 1 + getTextWidth(coords, 0, SMLSIZE), 17, CURVE_CURSOR_COLOR);
dc->drawText(11, 10, coords, SMLSIZE|DEFAULT_BGCOLOR);
dc->drawSolidFilledRect(10, 11, 1 + getTextWidth(coords, 0, FONT(XS)), 17, CURVE_CURSOR_COLOR);
dc->drawText(11, 10, coords, FONT(XS)|DEFAULT_BGCOLOR);
}
void Curve::drawPoint(BitmapBuffer * dc, const CurvePoint & point)
+1 -1
View File
@@ -84,7 +84,7 @@ void drawCurveHorizontalScale(BitmapBuffer * dc)
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->drawText(x+3+(CURVE_COORD_WIDTH-1-getTextWidth(text, SMLSIZE))/2, y+1, text, LEFT|SMLSIZE|DEFAULT_BGCOLOR);
dc->drawText(x+3+(CURVE_COORD_WIDTH - 1 - getTextWidth(text, 0, FONT(XS))) / 2, y + 1, text, LEFT|FONT(XS)|DEFAULT_BGCOLOR);
if (active) {
dc->drawBitmapPattern(x, y, LBM_CURVE_COORD_SHADOW, DEFAULT_COLOR);
}
+10 -10
View File
@@ -108,7 +108,7 @@ void drawVerticalSlider(BitmapBuffer * dc, coord_t x, coord_t y, int len, int va
}
else if (options & OPTION_SLIDER_NUMBER_BUTTON) {
drawTrimSquare(dc, x, y - 2);
// TODO lcdDrawChar(x + 2, y - 1, '0' + val, SMLSIZE | FOCUS_COLOR);
// TODO lcdDrawChar(x + 2, y - 1, '0' + val, FONT(XS) | FOCUS_COLOR);
}
else {
drawTrimSquare(dc, x, y - 2);
@@ -159,7 +159,7 @@ void drawHorizontalSlider(BitmapBuffer * dc, coord_t x, coord_t y, int len, int
else if (options & OPTION_SLIDER_NUMBER_BUTTON) {
drawTrimSquare(dc, x+2, y - 1);
char text[] = { (char)('0' + val), '\0' };
dc->drawText(x + 7, y - 1, text, SMLSIZE | CENTERED | FOCUS_COLOR);
dc->drawText(x + 7, y - 1, text, FONT(XS) | CENTERED | FOCUS_COLOR);
}
else if (options & OPTION_SLIDER_SQUARE_BUTTON) {
drawTrimSquare(dc, x, y - 1);
@@ -256,12 +256,12 @@ void drawCurveRef(BitmapBuffer * dc, coord_t x, coord_t y, const CurveRef & curv
switch (curve.type) {
case CURVE_REF_DIFF:
x = dc->drawText(x, y, "D", flags);
drawValueOrGVar(dc, x, y + 2, curve.value, -100, 100, LEFT | SMLSIZE | flags);
drawValueOrGVar(dc, x, y + 2, curve.value, -100, 100, LEFT | FONT(XS) | flags);
break;
case CURVE_REF_EXPO:
x = dc->drawText(x, y, "E", flags);
drawValueOrGVar(dc, x, y + 2, curve.value, -100, 100, LEFT | SMLSIZE | flags);
drawValueOrGVar(dc, x, y + 2, curve.value, -100, 100, LEFT | FONT(XS) | flags);
break;
case CURVE_REF_FUNC:
@@ -332,9 +332,9 @@ void drawTrimMode(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t phase, uint8_
void drawDate(BitmapBuffer * dc, coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags att)
{
// TODO
if (att & DBLSIZE) {
if (att & FONT(XL)) {
x -= 42;
att &= ~FONTSIZE_MASK;
att &= ~FONT_MASK;
dc->drawNumber(x, y, telemetryItem.datetime.day, att|LEADING0|LEFT, 2);
dc->drawText(lcdNextPos-1, y, "-", att);
dc->drawNumber(lcdNextPos-1, y, telemetryItem.datetime.month, att|LEFT, 2);
@@ -438,7 +438,7 @@ void drawSensorCustomValue(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t sens
if (value & (1 << i)) {
char s[] = "CH__ KO";
strAppendUnsigned(&s[2], i+1, 2);
dc->drawText(x, flags & DBLSIZE ? y+1 : y, s, flags & ~DBLSIZE);
dc->drawText(x, flags & FONT(XL) ? y+1 : y, s, flags & ~FONT(XL));
break;
}
}
@@ -446,7 +446,7 @@ void drawSensorCustomValue(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t sens
}
else {
if (value == 0) {
dc->drawText(x, flags & DBLSIZE ? y+1 : y, "Rx OK", flags & ~DBLSIZE);
dc->drawText(x, flags & FONT(XL) ? y+1 : y, "Rx OK", flags & ~FONT(XL));
}
else {
static const char * const RXS_STATUS[] = {
@@ -464,7 +464,7 @@ void drawSensorCustomValue(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t sens
};
for (uint8_t i=0; i<DIM(RXS_STATUS); i++) {
if (value & (1<<i)) {
dc->drawText(x, flags & DBLSIZE ? y+1 : y, RXS_STATUS[i], flags & ~DBLSIZE);
dc->drawText(x, flags & FONT(XL) ? y+1 : y, RXS_STATUS[i], flags & ~FONT(XL));
break;
}
}
@@ -474,7 +474,7 @@ void drawSensorCustomValue(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t sens
}
}
else if (telemetrySensor.unit == UNIT_TEXT) {
dc->drawSizedText(x, flags & DBLSIZE ? y+1 : y, telemetryItem.text, sizeof(telemetryItem.text), flags & ~DBLSIZE);
dc->drawSizedText(x, flags & FONT(XL) ? y+1 : y, telemetryItem.text, sizeof(telemetryItem.text), flags & ~FONT(XL));
}
else {
if (telemetrySensor.prec > 0) {
+37 -48
View File
@@ -20,117 +20,110 @@
#include "opentx.h"
const uint16_t font_tinsize_specs[] = {
const uint16_t font_xxs_specs[] = {
#include "font_9.specs"
};
const unsigned char font_tinsize[] = {
const unsigned char font_xxs[] = {
#include "font_9.lbm"
};
#if defined(HARDWARE_TOUCH)
const uint16_t font_stdsize_en_specs[] = {
const uint16_t font_std_en_specs[] = {
#include "font_17en.specs"
};
const unsigned char font_stdsize_en[] = {
const unsigned char font_std_en[] = {
#include "font_17en.lbm"
};
const uint16_t font_smlsize_specs[] = {
const uint16_t font_xs_specs[] = {
#include "font_15.specs"
};
const unsigned char font_smlsize[] = {
const unsigned char font_xs[] = {
#include "font_15.lbm"
};
const uint16_t font_stdsize_specs[] = {
const uint16_t font_std_specs[] = {
#include "font_17.specs"
};
const unsigned char font_stdsize[] = {
const unsigned char font_std[] = {
#include "font_17.lbm"
};
const uint16_t font_stdsizebold_specs[] = {
const uint16_t font_bold_specs[] = {
#include "font_bold17.specs"
};
const unsigned char font_stdsizebold[] = {
const unsigned char font_bold[] = {
#include "font_bold17.lbm"
};
#else
const uint16_t font_stdsize_en_specs[] = {
const uint16_t font_std_en_specs[] = {
#include "font_16en.specs"
};
const unsigned char font_stdsize_en[] = {
const unsigned char font_std_en[] = {
#include "font_16en.lbm"
};
const uint16_t font_smlsize_specs[] = {
const uint16_t font_xs_specs[] = {
#include "font_13.specs"
};
const unsigned char font_smlsize[] = {
const unsigned char font_xs[] = {
#include "font_13.lbm"
};
const uint16_t font_stdsize_specs[] = {
const uint16_t font_std_specs[] = {
#include "font_16.specs"
};
const unsigned char font_stdsize[] = {
const unsigned char font_std[] = {
#include "font_16.lbm"
};
const uint16_t font_stdsizebold_specs[] = {
const uint16_t font_bold_specs[] = {
#include "font_bold16.specs"
};
const unsigned char font_stdsizebold[] = {
const unsigned char font_bold[] = {
#include "font_bold16.lbm"
};
#endif
const uint16_t font_midsize_specs[] = {
const uint16_t font_l_specs[] = {
#include "font_24.specs"
};
const unsigned char font_midsize[] = {
const unsigned char font_l[] = {
#include "font_24.lbm"
};
const uint16_t font_dblsize_specs[] = {
const uint16_t font_xl_specs[] = {
#include "font_32.specs"
};
const unsigned char font_dblsize[] = {
const unsigned char font_xl[] = {
#include "font_32.lbm"
};
const uint16_t font_xxlsize_specs[] = {
const uint16_t font_xxl_specs[] = {
#include "font_64.specs"
};
const unsigned char font_xxlsize[] = {
const unsigned char font_xxl[] = {
#include "font_64.lbm"
};
#if defined(BOOT)
const uint16_t * const fontspecsTable[1] = { font_stdsize_en_specs };
const uint8_t * fontsTable[1] = { font_stdsize_en };
const uint16_t * const fontspecsTable[FONTS_COUNT] = { font_std_en_specs };
const uint8_t * fontsTable[FONTS_COUNT] = { font_std_en };
#else
const uint16_t * const fontspecsTable[16] = {
font_stdsize_specs, font_tinsize_specs, font_smlsize_specs, font_midsize_specs, font_dblsize_specs, font_xxlsize_specs, font_stdsize_specs, font_stdsize_specs,
font_stdsizebold_specs, font_tinsize_specs, font_smlsize_specs, font_midsize_specs, font_dblsize_specs, font_xxlsize_specs, font_stdsize_specs, font_stdsize_specs
};
const uint8_t * fontsTable[16] = {
font_stdsize, font_tinsize, font_smlsize, font_midsize, font_dblsize, font_xxlsize, font_stdsize, font_stdsize,
font_stdsizebold, font_tinsize, font_smlsize, font_midsize, font_dblsize, font_xxlsize, font_stdsize, font_stdsize
};
const uint16_t * const fontspecsTable[FONTS_COUNT] = { font_std_specs, font_bold_specs, font_xxs_specs, font_xs_specs, font_l_specs, font_xl_specs, font_xxl_specs };
const uint8_t * fontsTable[FONTS_COUNT] = { font_std, font_bold, font_xxs, font_xs, font_l, font_xl, font_xxl };
#endif
uint8_t * decompressFont(const uint8_t * font)
@@ -139,7 +132,7 @@ uint8_t * decompressFont(const uint8_t * font)
uint16_t height = *(((uint16_t *)font)+1);
size_t font_size = width * height;
uint8_t* dec_buf = (uint8_t*)malloc(font_size + 4);
uint8_t * dec_buf = (uint8_t *)malloc(font_size + 4);
// copy width / height
memcpy(dec_buf, font,4);
@@ -150,21 +143,17 @@ uint8_t * decompressFont(const uint8_t * font)
void loadFonts()
{
static bool fonts_loaded = false;
if (fonts_loaded) return;
static bool fontsLoaded = false;
if (fontsLoaded)
return;
#if !defined(BOOT)
int i = 0;
for (; i < 9; i++) {
#if defined(BOOT)
fontsTable[0] = decompressFont(fontsTable[0]);
#else
for (int i = 0; i < FONTS_COUNT; i++) {
fontsTable[i] = decompressFont(fontsTable[i]);
}
for (; i < 16; i++) {
// the next fonts don't exist in BOLD today
fontsTable[i] = fontsTable[i - 9];
}
#else
fontsTable[0] = decompressFont(fontsTable[0]);
#endif
fonts_loaded = true;
fontsLoaded = true;
}
+7 -7
View File
@@ -58,23 +58,23 @@ void FullScreenDialog::paint(BitmapBuffer * dc)
if (type == WARNING_TYPE_ALERT) {
#if defined(TRANSLATIONS_FR) || defined(TRANSLATIONS_IT) || defined(TRANSLATIONS_CZ)
dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP, STR_WARNING, ALARM_COLOR|DBLSIZE);
dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP + ALERT_TITLE_LINE_HEIGHT, title, ALARM_COLOR|DBLSIZE);
dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP, STR_WARNING, ALARM_COLOR|FONT(XL));
dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP + ALERT_TITLE_LINE_HEIGHT, title, ALARM_COLOR|FONT(XL));
#else
dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP, title.c_str(), ALARM_COLOR|DBLSIZE);
dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP + ALERT_TITLE_LINE_HEIGHT, STR_WARNING, ALARM_COLOR|DBLSIZE);
dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP, title.c_str(), ALARM_COLOR|FONT(XL));
dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP + ALERT_TITLE_LINE_HEIGHT, STR_WARNING, ALARM_COLOR|FONT(XL));
#endif
}
else if (!title.empty()) {
dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP, title.c_str(), ALARM_COLOR|DBLSIZE);
dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP, title.c_str(), ALARM_COLOR|FONT(XL));
}
if (!message.empty()) {
dc->drawText(ALERT_MESSAGE_LEFT, ALERT_MESSAGE_TOP, message.c_str(), BOLD);
dc->drawText(ALERT_MESSAGE_LEFT, ALERT_MESSAGE_TOP, message.c_str(), FONT(BOLD));
}
if (!action.empty()) {
dc->drawText(LCD_W / 2, ALERT_ACTION_TOP, action.c_str(), CENTERED | BOLD);
dc->drawText(LCD_W / 2, ALERT_ACTION_TOP, action.c_str(), CENTERED | FONT(BOLD));
}
}
+2 -2
View File
@@ -78,10 +78,10 @@ class Layout1x1: public Layout
//
// if (persistentData->options[1].boolValue) {
// // Sliders + Trims + Flight mode
// lcdDrawSizedText(LCD_W / 2 - getTextWidth(g_model.flightModeData[mixerCurrentFlightMode].name, sizeof(g_model.flightModeData[mixerCurrentFlightMode].name), ZCHAR | SMLSIZE) / 2,
// lcdDrawSizedText(LCD_W / 2 - getTextWidth(g_model.flightModeData[mixerCurrentFlightMode].name, sizeof(g_model.flightModeData[mixerCurrentFlightMode].name), ZCHAR | FONT(XS)) / 2,
// 232,
// g_model.flightModeData[mixerCurrentFlightMode].name,
// sizeof(g_model.flightModeData[mixerCurrentFlightMode].name), ZCHAR | SMLSIZE);
// sizeof(g_model.flightModeData[mixerCurrentFlightMode].name), ZCHAR | FONT(XS));
// drawMainPots();
// drawTrims(mixerCurrentFlightMode);
// }
+2 -2
View File
@@ -80,10 +80,10 @@ class Layout2P1: public Layout
// // Flight mode
// lcdDrawSizedText(LCD_W / 2 - getTextWidth(g_model.flightModeData[mixerCurrentFlightMode].name,
// sizeof(g_model.flightModeData[mixerCurrentFlightMode].name),
// ZCHAR | SMLSIZE) / 2,
// ZCHAR | FONT(XS)) / 2,
// 232,
// g_model.flightModeData[mixerCurrentFlightMode].name,
// sizeof(g_model.flightModeData[mixerCurrentFlightMode].name), ZCHAR | SMLSIZE);
// sizeof(g_model.flightModeData[mixerCurrentFlightMode].name), ZCHAR | FONT(XS));
// }
//
// if (persistentData->options[2].boolValue) {
+2 -2
View File
@@ -87,10 +87,10 @@ class Layout2x4: public Layout
// // Flight mode
// lcdDrawSizedText(LCD_W / 2 - getTextWidth(g_model.flightModeData[mixerCurrentFlightMode].name,
// sizeof(g_model.flightModeData[mixerCurrentFlightMode].name),
// ZCHAR | SMLSIZE) / 2,
// ZCHAR | FONT(XS)) / 2,
// 232,
// g_model.flightModeData[mixerCurrentFlightMode].name,
// sizeof(g_model.flightModeData[mixerCurrentFlightMode].name), ZCHAR | SMLSIZE);
// sizeof(g_model.flightModeData[mixerCurrentFlightMode].name), ZCHAR | FONT(XS));
// }
//
// if (persistentData->options[2].boolValue) {
+3 -3
View File
@@ -93,13 +93,13 @@ int getCharWidth(uint8_t c, const uint16_t * spec)
uint8_t getFontHeight(LcdFlags flags)
{
uint32_t fontindex = FONTINDEX(flags);
uint32_t fontindex = FONT_INDEX(flags);
return fontspecsTable[fontindex][0];
}
int getTextWidth(const char * s, int len, LcdFlags flags)
{
const uint16_t * specs = fontspecsTable[FONTINDEX(flags)];
const uint16_t * specs = fontspecsTable[FONT_INDEX(flags)];
int result = 0;
for (int i=0; len == 0 || i < len; ++i) {
@@ -115,7 +115,7 @@ int getTextWidth(const char * s, int len, LcdFlags flags)
c = uint8_t(*s) + ((c & 0x01) << 8) - 1;
if (c >= 0x101)
c -= 1;
c += 187;
c += CJK_FIRST_LETTER_INDEX;
result += getFontPatternWidth(specs, c);
}
else if (c >= 0x20) {
+1 -1
View File
@@ -97,7 +97,7 @@ template <class W>
bool Subtitle(W * window, rect_t & rect, const char * label)
{
rect.h = 14;
drawText(window, rect.x, rect.y, label, BOLD);
drawText(window, rect.x, rect.y, label, FONT(BOLD));
}
template <class W>
+3 -3
View File
@@ -80,7 +80,7 @@ void GVarButton::paint(BitmapBuffer * dc)
LcdFlags attr = RIGHT;
if (flightMode == currentFlightMode)
attr |= BOLD;
attr |= FONT(BOLD);
x += GVAR_NAME_SIZE;
if (x > width()) {
@@ -100,8 +100,8 @@ void GVarButton::paint(BitmapBuffer * dc)
coord_t yval = y + PAGE_LINE_HEIGHT;
if (v <= GVAR_MAX && (gvar->prec > 0 || abs(v) >= 1000 || (abs(v) >= 100 && gvar->unit > 0))) {
attr |= SMLSIZE;
attr &= ~BOLD;
attr |= FONT(XS);
attr &= ~FONT(BOLD);
yval += 3;
}
+2 -2
View File
@@ -303,11 +303,11 @@ void CommonInputOrMixButton::drawFlightModes(BitmapBuffer *dc, FlightModesType v
char s[] = " ";
s[0] = '0' + i;
if (value & (1 << i)) {
dc->drawText(x, PAGE_LINE_HEIGHT + FIELD_PADDING_TOP + 2, s, SMLSIZE | TEXT_DISABLE_COLOR);
dc->drawText(x, PAGE_LINE_HEIGHT + FIELD_PADDING_TOP + 2, s, FONT(XS) | TEXT_DISABLE_COLOR);
}
else {
dc->drawSolidFilledRect(x, PAGE_LINE_HEIGHT + FIELD_PADDING_TOP + 2, 8, 3, CHECKBOX_COLOR);
dc->drawText(x, PAGE_LINE_HEIGHT + FIELD_PADDING_TOP + 2, s, SMLSIZE);
dc->drawText(x, PAGE_LINE_HEIGHT + FIELD_PADDING_TOP + 2, s, FONT(XS));
}
x += 8;
}
@@ -64,7 +64,7 @@ class LogicalSwitchEditPage: public Page {
{
Page::checkEvents();
if (active != isActive()) {
headerSwitchName->setTextFlags(isActive() ? BOLD|HIGHLIGHT_COLOR : MENU_COLOR);
headerSwitchName->setTextFlags(isActive() ? FONT(BOLD) | HIGHLIGHT_COLOR : MENU_COLOR);
active = !active;
}
}
+3 -3
View File
@@ -169,13 +169,13 @@ class ModelselectFooter: public Window {
dc->drawSolidFilledRect(0, 5, rect.w, 2, CURVE_AXIS_COLOR);
dc->drawBitmap(7, 12, modelselSdFreeBitmap);
uint32_t size = sdGetSize() / 100;
dc->drawNumber(24, 11, size, PREC1|SMLSIZE, 0, NULL, "GB");
dc->drawNumber(24, 11, size, PREC1|FONT(XS), 0, NULL, "GB");
dc->drawBitmap(77, 12, modelselModelQtyBitmap);
dc->drawNumber(99, 11, modelslist.getModelsCount(), SMLSIZE);
dc->drawNumber(99, 11, modelslist.getModelsCount(), FONT(XS));
ModelselectButton * selectedModel = dynamic_cast<ModelselectButton *>(focusWindow);
if (selectedModel) {
dc->drawBitmap(7, 37, modelselModelNameBitmap);
dc->drawText(24, 32, selectedModel->modelFilename(), SMLSIZE | DEFAULT_COLOR);
dc->drawText(24, 32, selectedModel->modelFilename(), FONT(XS) | DEFAULT_COLOR);
}
}
};
+3 -3
View File
@@ -484,7 +484,7 @@ bool menuModelSelect(event_t event)
}
if (selected) {
lcd->drawBitmap(5, LCD_H-FH, modelselModelNameBitmap);
lcdDrawText(22, LCD_H-FH-1, (*it)->modelFilename, SMLSIZE|DEFAULT_COLOR);
lcdDrawText(22, LCD_H-FH-1, (*it)->modelFilename, FONT(XS)|DEFAULT_COLOR);
}
}
}
@@ -511,9 +511,9 @@ bool menuModelSelect(event_t event)
// Footer
lcd->drawBitmap(5, LCD_H-FH-20, modelselSdFreeBitmap);
uint32_t size = sdGetSize() / 100;
lcdDrawNumber(22, LCD_H-FH-21, size, PREC1|SMLSIZE, 0, NULL, "GB");
lcdDrawNumber(22, LCD_H-FH-21, size, PREC1|FONT(XS), 0, NULL, "GB");
lcd->drawBitmap(70, LCD_H-FH-20, modelselModelQtyBitmap);
lcdDrawNumber(92, LCD_H-FH-21, modelslist.getModelsCount(),SMLSIZE);
lcdDrawNumber(92, LCD_H-FH-21, modelslist.getModelsCount(),FONT(XS));
return true;
}
+2 -2
View File
@@ -426,9 +426,9 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
// Sensors columns titles
uint8_t sensorsCount = getTelemetrySensorsCount();
if (sensorsCount > 0) {
new StaticText(window, {SENSOR_COL2, grid.getWindowHeight() + 3, SENSOR_COL3 - SENSOR_COL2, PAGE_LINE_HEIGHT}, STR_VALUE, 0, SMLSIZE | TEXT_DISABLE_COLOR);
new StaticText(window, {SENSOR_COL2, grid.getWindowHeight() + 3, SENSOR_COL3 - SENSOR_COL2, PAGE_LINE_HEIGHT}, STR_VALUE, 0, FONT(XS) | TEXT_DISABLE_COLOR);
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, SMLSIZE | TEXT_DISABLE_COLOR);
new StaticText(window, {SENSOR_COL3, grid.getWindowHeight() + 3, LCD_W - SENSOR_COL3, PAGE_LINE_HEIGHT}, STR_ID, 0, FONT(XS) | TEXT_DISABLE_COLOR);
}
}
+1 -1
View File
@@ -107,7 +107,7 @@ void ModelCell::loadBitmap()
}
else {
char timer[LEN_TIMER_STRING];
buffer->drawSizedText(5, 2, modelName, LEN_MODEL_NAME, SMLSIZE|DEFAULT_COLOR);
buffer->drawSizedText(5, 2, modelName, LEN_MODEL_NAME, FONT(XS)|DEFAULT_COLOR);
getTimerString(timer, 0);
for (uint8_t i = 0; i < MAX_TIMERS; i++) {
if (partialmodel.timers[i].mode > 0 && partialmodel.timers[i].persistent) {
+8 -8
View File
@@ -90,7 +90,7 @@ void RadioHardwarePage::build(FormWindow * window)
grid.spacer(6);
// Calibration
new StaticText(window, grid.getLabelSlot(), STR_INPUTS, BOLD);
new StaticText(window, grid.getLabelSlot(), STR_INPUTS, 0, FONT(BOLD));
auto calib = new TextButton(window, grid.getFieldSlot(), STR_CALIBRATION);
calib->setPressHandler([=]() -> uint8_t {
auto calibrationPage = new RadioCalibrationPage();
@@ -104,7 +104,7 @@ void RadioHardwarePage::build(FormWindow * window)
// Sticks
new Subtitle(window, grid.getLineSlot(), STR_STICKS);
grid.nextLine();
for(int i=0; i < NUM_STICKS; i++){
for (int i = 0; i < NUM_STICKS; i++) {
new StaticText(window, grid.getLabelSlot(true), TEXT_AT_INDEX(STR_VSRCRAW, (i + 1)));
new TextEdit(window, grid.getFieldSlot(2,0), g_eeGeneral.anaNames[i], LEN_ANA_NAME);
grid.nextLine();
@@ -113,7 +113,7 @@ void RadioHardwarePage::build(FormWindow * window)
// Pots
new Subtitle(window, grid.getLineSlot(), STR_POTS);
grid.nextLine();
for(int i=0; i < NUM_POTS; i++){
for (int i = 0; i < NUM_POTS; i++) {
new StaticText(window, grid.getLabelSlot(true), TEXT_AT_INDEX(STR_VSRCRAW, (i + NUM_STICKS + 1)));
new TextEdit(window, grid.getFieldSlot(2,0), g_eeGeneral.anaNames[i + NUM_STICKS], LEN_ANA_NAME);
new Choice(window, grid.getFieldSlot(2,1), STR_POTTYPES, POT_NONE, POT_WITHOUT_DETENT, GET_SET_BF(g_eeGeneral.potsConfig, 2 * i, 2));
@@ -123,17 +123,17 @@ void RadioHardwarePage::build(FormWindow * window)
// Switches
new Subtitle(window, grid.getLineSlot(), STR_SWITCHES);
grid.nextLine();
for(int i=0; i < NUM_SWITCHES; i++) {
for (int i = 0; i < NUM_SWITCHES; i++) {
new SwitchDynamicLabel(window, grid.getLabelSlot(true), i);
new TextEdit(window, grid.getFieldSlot(2, 0), g_eeGeneral.switchNames[i], LEN_SWITCH_NAME);
new Choice(window, grid.getFieldSlot(2, 1), STR_SWTYPES, SWITCH_NONE, SWITCH_TYPE_MAX(i),
[=]() -> int {
return SWITCH_CONFIG(i);
return SWITCH_CONFIG(i);
},
[=](int newValue) {
swconfig_t mask = (swconfig_t)0x03 << (2*i);
g_eeGeneral.switchConfig = (g_eeGeneral.switchConfig & ~mask) | ((swconfig_t(newValue) & 0x03) << (2*i));
SET_DIRTY();
swconfig_t mask = (swconfig_t) 0x03 << (2 * i);
g_eeGeneral.switchConfig = (g_eeGeneral.switchConfig & ~mask) | ((swconfig_t(newValue) & 0x03) << (2 * i));
SET_DIRTY();
});
grid.nextLine();
}
+1 -1
View File
@@ -313,7 +313,7 @@ bool menuWidgetChoice(event_t event)
lcdDrawBitmapPattern(zone.x+zone.w-9, zone.y+zone.h/2-10, LBM_SWIPE_RIGHT, FOCUS_COLOR);
}
if (currentWidget)
lcdDrawText(zone.x + zone.w, zone.y-1, currentWidget->getFactory()->getName(), RIGHT | DEFAULT_COLOR | SMLSIZE | INVERS);
lcdDrawText(zone.x + zone.w, zone.y-1, currentWidget->getFactory()->getName(), RIGHT | DEFAULT_COLOR | FONT(XS) | INVERS);
return true;
}
+1 -1
View File
@@ -51,7 +51,7 @@ class SpecialFunctionEditPage : public Page {
Page::checkEvents();
if (active != isActive()) {
invalidate();
headerSF->setTextFlags(isActive() ? BOLD|HIGHLIGHT_COLOR : MENU_COLOR);
headerSF->setTextFlags(isActive() ? FONT(BOLD) |HIGHLIGHT_COLOR : MENU_COLOR);
active = !active;
}
}
+5 -5
View File
@@ -120,15 +120,15 @@ void ThemeBase::drawMessageBox(const char * title, const char * text, const char
//
// if (type == WARNING_TYPE_ALERT) {
//#if defined(TRANSLATIONS_FR) || defined(TRANSLATIONS_IT) || defined(TRANSLATIONS_CZ)
// lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, STR_WARNING, ALARM_COLOR|DBLSIZE);
// lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+28, title, ALARM_COLOR|DBLSIZE);
// lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, STR_WARNING, ALARM_COLOR|FONT(XL));
// lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+28, title, ALARM_COLOR|FONT(XL));
//#else
// lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, title, ALARM_COLOR|DBLSIZE);
// lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+28, STR_WARNING, ALARM_COLOR|DBLSIZE);
// lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, title, ALARM_COLOR|FONT(XL));
// lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+28, STR_WARNING, ALARM_COLOR|FONT(XL));
//#endif
// }
// else if (title) {
// lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, title, ALARM_COLOR|DBLSIZE);
// lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, title, ALARM_COLOR|FONT(XL));
// }
//
// if (text) {
+2 -2
View File
@@ -403,10 +403,10 @@ class FlyskyTheme: public ThemeBase
const char * const STR_MONTHS[] = TR_MONTHS;
sprintf(str, "%d %s", t.tm_mday, STR_MONTHS[t.tm_mon]);
#endif
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE1, str, SMLSIZE|FOCUS_COLOR|CENTERED);
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE1, str, FONT(XS)|FOCUS_COLOR|CENTERED);
getTimerString(str, getValue(MIXSRC_TX_TIME));
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE2, str, SMLSIZE|FOCUS_COLOR|CENTERED);
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE2, str, FONT(XS)|FOCUS_COLOR|CENTERED);
}
void drawProgressBar(BitmapBuffer * dc, coord_t x, coord_t y, coord_t w, coord_t h, int value) const override
+4 -4
View File
@@ -188,10 +188,10 @@ class FrskyTheme: public ThemeBase
delete calibRadioPict;
#if defined(PCBX10)
if(STICKS_PWM_ENABLED()) {
calibRadioPict = BitmapBuffer::load(getFilePath("X10S.bmp"));
calibRadioPict = BitmapBuffer::loadBitmap(getFilePath("X10S.bmp"));
}
else {
calibRadioPict = BitmapBuffer::load(getFilePath("X10.bmp"));
calibRadioPict = BitmapBuffer::loadBitmap(getFilePath("X10.bmp"));
}
#else
calibRadioPict = BitmapBuffer::loadBitmap(getFilePath("horus.bmp"));
@@ -378,9 +378,9 @@ class FrskyTheme: public ThemeBase
const char * const STR_MONTHS[] = TR_MONTHS;
sprintf(str, "%d %s", t.tm_mday, STR_MONTHS[t.tm_mon]);
#endif
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE1, str, SMLSIZE|FOCUS_COLOR|CENTERED);
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE1, str, FONT(XS)|FOCUS_COLOR|CENTERED);
getTimerString(str, getValue(MIXSRC_TX_TIME));
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE2, str, SMLSIZE|FOCUS_COLOR|CENTERED);
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE2, str, FONT(XS)|FOCUS_COLOR|CENTERED);
}
void drawProgressBar(BitmapBuffer * dc, coord_t x, coord_t y, coord_t w, coord_t h, int value) const override
+3 -3
View File
@@ -85,7 +85,7 @@ void drawTopBar()
#if 0
// Radio battery - TODO
// drawValueWithUnit(370, 8, g_vbat100mV, UNIT_VOLTS, PREC1|SMLSIZE|MENU_COLOR);
// drawValueWithUnit(370, 8, g_vbat100mV, UNIT_VOLTS, PREC1|FONT(XS)|MENU_COLOR);
// lcdDrawSolidRect(300, 3, 20, 50, MENU_COLOR);
// lcdDrawRect(batt_icon_x+FW, BAR_Y+1, 13, 7);
// lcdDrawSolidVerticalLine(batt_icon_x+FW+13, BAR_Y+2, 5);
@@ -107,7 +107,7 @@ void drawTopBar()
att |= (item.isOld() ? ALARM_COLOR : DEFAULT_COLOR);
lcdDrawSolidFilledRect(ALTITUDE_X, VOLTS_Y, ALTITUDE_W, ALTITUDE_H, DEFAULT_BGCOLOR);
lcdDrawText(ALTITUDE_X+PADDING, VOLTS_Y+2, "Voltage", att);
drawValueWithUnit(ALTITUDE_X+PADDING, VOLTS_Y+12, value, UNIT_VOLTS, DBLSIZE|LEFT|att);
drawValueWithUnit(ALTITUDE_X+PADDING, VOLTS_Y+12, value, UNIT_VOLTS, FONT(XL)|LEFT|att);
}
}
@@ -121,7 +121,7 @@ void drawTopBar()
LcdFlags att = (item.isOld() ? ALARM_COLOR : DEFAULT_COLOR);
lcdDrawSolidFilledRect(ALTITUDE_X, ALTITUDE_Y, ALTITUDE_W, ALTITUDE_H, DEFAULT_BGCOLOR);
lcdDrawText(ALTITUDE_X+PADDING, ALTITUDE_Y+2, "Alt", att);
drawValueWithUnit(ALTITUDE_X+PADDING, ALTITUDE_Y+12, value, UNIT_METERS, DBLSIZE|LEFT|att);
drawValueWithUnit(ALTITUDE_X+PADDING, ALTITUDE_Y+12, value, UNIT_METERS, FONT(XL)|LEFT|att);
}
}
#endif
+9 -9
View File
@@ -79,13 +79,13 @@ void drawSingleMixerBar(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t chan
lcdDrawSolidFilledRect(x, y, w, h, BARGRAPH_BGCOLOR);
if (chanVal > 0) {
lcdDrawSolidFilledRect(x + w / 2, y, divRoundClosest(chanVal * w, VIEW_CHANNELS_LIMIT_PCT * 2), h, BARGRAPH2_COLOR);
lcdDrawNumber(x - 10 + w / 2, y - 2, displayVal, SMLSIZE | DEFAULT_COLOR | RIGHT, 0, NULL, "%");
lcdDrawNumber(x - 10 + w / 2, y - 2, displayVal, FONT(XS) | DEFAULT_COLOR | RIGHT, 0, NULL, "%");
}
else if (chanVal < 0) {
const uint16_t endpoint = x + w / 2;
const uint16_t size = divRoundClosest(-chanVal * w, VIEW_CHANNELS_LIMIT_PCT * 2);
lcdDrawSolidFilledRect(endpoint - size, y, size, h, BARGRAPH2_COLOR);
lcdDrawNumber(x + 10 + w / 2, y - 2, displayVal, SMLSIZE | DEFAULT_COLOR, 0, NULL, "%");
lcdDrawNumber(x + 10 + w / 2, y - 2, displayVal, FONT(XS) | DEFAULT_COLOR, 0, NULL, "%");
}
lcd->drawSolidVerticalLine(x + w / 2, y, h, DEFAULT_COLOR);
@@ -101,13 +101,13 @@ void drawSingleOutputBar(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t cha
lcdDrawSolidFilledRect(x, y, w, h, BARGRAPH_BGCOLOR);
if (chanVal > 0) {
lcdDrawSolidFilledRect(x + w / 2, y, divRoundClosest(chanVal * w, VIEW_CHANNELS_LIMIT_PCT * 2), h, BARGRAPH1_COLOR);
lcdDrawNumber(x - 10 + w / 2, y - 2, displayVal, SMLSIZE | DEFAULT_COLOR | RIGHT, 0, NULL, "%");
lcdDrawNumber(x - 10 + w / 2, y - 2, displayVal, FONT(XS) | DEFAULT_COLOR | RIGHT, 0, NULL, "%");
}
else if (chanVal < 0) {
uint16_t endpoint = x + w / 2;
uint16_t size = divRoundClosest(-chanVal * w, VIEW_CHANNELS_LIMIT_PCT * 2);
lcdDrawSolidFilledRect(endpoint - size, y, size, h, BARGRAPH1_COLOR);
lcdDrawNumber(x + 10 + w / 2, y - 2, displayVal, SMLSIZE | DEFAULT_COLOR, 0, NULL, "%");
lcdDrawNumber(x + 10 + w / 2, y - 2, displayVal, FONT(XS) | DEFAULT_COLOR, 0, NULL, "%");
}
lcd->drawSolidVerticalLine(x + w / 2, y, h, DEFAULT_COLOR);
@@ -123,10 +123,10 @@ void drawComboOutputBar(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t chan
uint16_t valPos;
strAppendSigned(&chanString[2], channel + 1, 2);
lcdDrawText(x, y, chanString, SMLSIZE | DEFAULT_COLOR | LEFT);
lcdDrawText(x, y, chanString, FONT(XS) | DEFAULT_COLOR | LEFT);
lcdDrawSizedText(x + 45, y, g_model.limitData[channel].name, sizeof(g_model.limitData[channel].name), SMLSIZE | DEFAULT_COLOR | LEFT | ZCHAR);
lcdDrawNumber(x + w, y, usValue, SMLSIZE | DEFAULT_COLOR | RIGHT, 0, NULL, STR_US);
lcdDrawSizedText(x + 45, y, g_model.limitData[channel].name, sizeof(g_model.limitData[channel].name), FONT(XS) | DEFAULT_COLOR | LEFT | ZCHAR);
lcdDrawNumber(x + w, y, usValue, FONT(XS) | DEFAULT_COLOR | RIGHT, 0, NULL, STR_US);
lcdDrawSolidFilledRect(x, y + Y_OUTBAR, w, h, BARGRAPH_BGCOLOR);
lcd->drawSolidVerticalLine(x + limPos, y + Y_OUTBAR, h, MAINVIEW_GRAPHICS_COLOR);
@@ -156,9 +156,9 @@ void drawComboOutputBar(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t chan
#endif
lcd->drawSolidVerticalLine(x + w / 2, y + Y_OUTBAR, h, DEFAULT_COLOR);
if (chanVal > calcRESXto100((ld && ld->revert) ? -ld->offset : ld->offset))
lcdDrawNumber(x + limPos, y + h, chanVal, SMLSIZE | DEFAULT_COLOR | RIGHT, 0, NULL, "%");
lcdDrawNumber(x + limPos, y + h, chanVal, FONT(XS) | DEFAULT_COLOR | RIGHT, 0, NULL, "%");
else
lcdDrawNumber(x + limPos, y + h, chanVal, SMLSIZE | DEFAULT_COLOR, 0, NULL, "%");
lcdDrawNumber(x + limPos, y + h, chanVal, FONT(XS) | DEFAULT_COLOR, 0, NULL, "%");
}
coord_t drawChannelsMonitorLegend(coord_t x, const char * s, int color)
+11 -11
View File
@@ -124,18 +124,18 @@ bool menuStatsDebug(event_t event)
#if defined(LUA)
lcdDrawText(MENUS_MARGIN_LEFT, y, "Lua scripts");
lcdDrawText(MENU_STATS_COLUMN1, y+1, "[Duration]", HEADER_COLOR|SMLSIZE);
lcdDrawText(MENU_STATS_COLUMN1, y+1, "[Duration]", HEADER_COLOR|FONT(XS));
lcdDrawNumber(lcdNextPos+5, y, 10*maxLuaDuration, LEFT, 0, NULL, "ms");
lcdDrawText(lcdNextPos+20, y+1, "[Interval]", HEADER_COLOR|SMLSIZE);
lcdDrawText(lcdNextPos+20, y+1, "[Interval]", HEADER_COLOR|FONT(XS));
lcdDrawNumber(lcdNextPos+5, y, 10*maxLuaDuration, LEFT, 0, NULL, "ms");
y += FH;
// lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP+line*FH, "Lua memory");
lcdDrawText(MENU_STATS_COLUMN1, y+1, "[S]", HEADER_COLOR|SMLSIZE);
lcdDrawText(MENU_STATS_COLUMN1, y+1, "[S]", HEADER_COLOR|FONT(XS));
lcdDrawNumber(lcdNextPos+5, y, luaGetMemUsed(lsScripts), LEFT);
lcdDrawText(lcdNextPos+20, y+1, "[W]", HEADER_COLOR|SMLSIZE);
lcdDrawText(lcdNextPos+20, y+1, "[W]", HEADER_COLOR|FONT(XS));
lcdDrawNumber(lcdNextPos+5, y, luaGetMemUsed(lsWidgets), LEFT);
lcdDrawText(lcdNextPos+20, y+1, "[B]", HEADER_COLOR|SMLSIZE);
lcdDrawText(lcdNextPos+20, y+1, "[B]", HEADER_COLOR|FONT(XS));
lcdDrawNumber(lcdNextPos+5, y, luaExtraMemoryUsage, LEFT);
y += FH;
#endif
@@ -145,11 +145,11 @@ bool menuStatsDebug(event_t event)
y += FH;
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_FREE_STACK);
lcdDrawText(MENU_STATS_COLUMN1, y+1, "[Menus]", HEADER_COLOR|SMLSIZE);
lcdDrawText(MENU_STATS_COLUMN1, y+1, "[Menus]", HEADER_COLOR|FONT(XS));
lcdDrawNumber(lcdNextPos+5, y, menusStack.available(), LEFT);
lcdDrawText(lcdNextPos+20, y+1, "[Mix]", HEADER_COLOR|SMLSIZE);
lcdDrawText(lcdNextPos+20, y+1, "[Mix]", HEADER_COLOR|FONT(XS));
lcdDrawNumber(lcdNextPos+5, y, mixerStack.available(), LEFT);
lcdDrawText(lcdNextPos+20, y+1, "[Audio]", HEADER_COLOR|SMLSIZE);
lcdDrawText(lcdNextPos+20, y+1, "[Audio]", HEADER_COLOR|FONT(XS));
lcdDrawNumber(lcdNextPos+5, y, audioStack.available(), LEFT);
y += FH;
@@ -176,11 +176,11 @@ bool menuStatsDebug(event_t event)
#if defined(INTERNAL_GPS)
lcdDrawText(MENUS_MARGIN_LEFT, y, "Internal GPS");
lcdDrawText(MENU_STATS_COLUMN1, y+1, "[Fix]", HEADER_COLOR|SMLSIZE);
lcdDrawText(MENU_STATS_COLUMN1, y+1, "[Fix]", HEADER_COLOR|FONT(XS));
lcdDrawText(lcdNextPos+2, y, (gpsData.fix ? "Yes" : "No"), LEFT);
lcdDrawText(lcdNextPos+20, y+1, "[Sats]", HEADER_COLOR|SMLSIZE);
lcdDrawText(lcdNextPos+20, y+1, "[Sats]", HEADER_COLOR|FONT(XS));
lcdDrawNumber(lcdNextPos+5, y, gpsData.numSat, LEFT);
lcdDrawText(lcdNextPos+20, y+1, "[Hdop]", HEADER_COLOR|SMLSIZE);
lcdDrawText(lcdNextPos+20, y+1, "[Hdop]", HEADER_COLOR|FONT(XS));
lcdDrawNumber(lcdNextPos+5, y, gpsData.hdop, PREC2|LEFT);
#endif
+2 -2
View File
@@ -59,12 +59,12 @@ void GaugeWidget::refresh()
int percent = divRoundClosest(100 * (value_in_range - min), (max - min));
// Gauge label
drawSource(zone.x, zone.y, index, SMLSIZE | FOCUS_COLOR);
drawSource(zone.x, zone.y, index, FONT(XS) | FOCUS_COLOR);
// Gauge
lcdSetColor(color);
lcdDrawSolidFilledRect(zone.x, zone.y + 16, zone.w, 16, FOCUS_COLOR);
lcdDrawNumber(zone.x+zone.w/2, zone.y + 17, percent, SMLSIZE | CUSTOM_COLOR | CENTERED, 0, NULL, "%");
lcdDrawNumber(zone.x+zone.w/2, zone.y + 17, percent, FONT(XS) | CUSTOM_COLOR | CENTERED, 0, NULL, "%");
lcd->invertRect(zone.x + w, zone.y + 16, zone.w - w, 16, CUSTOM_COLOR);
}
+1 -1
View File
@@ -48,7 +48,7 @@ class ModelBitmapWidget: public Widget
buffer->drawFilledRect(0, 0, zone.w, zone.h, SOLID, MAINVIEW_PANES_COLOR | OPACITY(5));
static BitmapBuffer * icon = BitmapBuffer::loadMask(getThemePath("mask_menu_model.png"));
buffer->drawMask(6, 4, icon, MAINVIEW_GRAPHICS_COLOR);
buffer->drawSizedText(45, 10, g_model.header.name, LEN_MODEL_NAME, ZCHAR | SMLSIZE);
buffer->drawSizedText(45, 10, g_model.header.name, LEN_MODEL_NAME, ZCHAR | FONT(XS));
buffer->drawSolidFilledRect(39, 27, zone.w - 48, 2, MAINVIEW_GRAPHICS_COLOR);
if (bitmap) {
buffer->drawScaledBitmap(bitmap, 0, 38, zone.w, zone.h - 38);
+4 -4
View File
@@ -59,13 +59,13 @@ class OutputsWidget: public Widget
lcdDrawSolidFilledRect((chanVal > 0 ? barMid : barMid - fillW), barTop, fillW, barH, MAINVIEW_GRAPHICS_COLOR);
lcd->drawSolidVerticalLine(barMid, barTop, barH, MAINVIEW_GRAPHICS_COLOR);
lcdDrawRect(x, rowTop, w, rowH + 1);
lcdDrawNumber(x + barW - 10, barTop, chanVal, SMLSIZE | DEFAULT_COLOR | RIGHT, 0, NULL, "%");
lcdDrawNumber(x + barW - 10, barTop, chanVal, FONT(XS) | DEFAULT_COLOR | RIGHT, 0, NULL, "%");
if (g_model.limitData[curChan - 1].name[0] != 0) {
lcdDrawNumber(barLft + 1, barTop, curChan, SMLSIZE | DEFAULT_COLOR | LEFT | LEADING0, 2);
lcdDrawSizedText(barLft + 23, barTop, g_model.limitData[curChan - 1].name, sizeof(g_model.limitData[curChan - 1].name), SMLSIZE | DEFAULT_COLOR | LEFT | ZCHAR);
lcdDrawNumber(barLft + 1, barTop, curChan, FONT(XS) | DEFAULT_COLOR | LEFT | LEADING0, 2);
lcdDrawSizedText(barLft + 23, barTop, g_model.limitData[curChan - 1].name, sizeof(g_model.limitData[curChan - 1].name), FONT(XS) | DEFAULT_COLOR | LEFT | ZCHAR);
}
else {
putsChn(barLft + 1, barTop, curChan, SMLSIZE | DEFAULT_COLOR | LEFT);
putsChn(barLft + 1, barTop, curChan, FONT(XS) | DEFAULT_COLOR | LEFT);
}
}
return lastChan - 1;
+5 -5
View File
@@ -64,20 +64,20 @@ void TimerWidget::refresh()
drawTimer(zone.x + 70, zone.y + 31, abs(timerState.val), DEFAULT_COLOR | MIDSIZE | LEFT | TIMEHOUR);
}
else {
drawTimer(zone.x + 76, zone.y + 31, abs(timerState.val), DEFAULT_COLOR | DBLSIZE | LEFT);
drawTimer(zone.x + 76, zone.y + 31, abs(timerState.val), DEFAULT_COLOR | FONT(XL) | LEFT);
}
if (ZLEN(timerData.name) > 0) {
lcdDrawSizedText(zone.x + 78, zone.y + 20, timerData.name, LEN_TIMER_NAME, ZCHAR | SMLSIZE | DEFAULT_COLOR);
lcdDrawSizedText(zone.x + 78, zone.y + 20, timerData.name, LEN_TIMER_NAME, ZCHAR | FONT(XS) | DEFAULT_COLOR);
}
else {
drawStringWithIndex(zone.x + 137, zone.y + 17, "TMR", index + 1, SMLSIZE | DEFAULT_COLOR);
drawStringWithIndex(zone.x + 137, zone.y + 17, "TMR", index + 1, FONT(XS) | DEFAULT_COLOR);
}
}
else {
if (timerState.val < 0 && timerState.val % 2) {
lcdDrawSolidFilledRect(zone.x, zone.y, zone.w, zone.h, HEADER_ICON_BGCOLOR);
}
drawStringWithIndex(zone.x + 2, zone.y, "TMR", index + 1, SMLSIZE | FOCUS_COLOR);
drawStringWithIndex(zone.x + 2, zone.y, "TMR", index + 1, FONT(XS) | FOCUS_COLOR);
if (zone.w > 100 && zone.h > 40) {
if (abs(timerState.val) >= 3600) {
drawTimer(zone.x + 3, zone.y + 16, abs(timerState.val), FOCUS_COLOR | LEFT | TIMEHOUR);
@@ -88,7 +88,7 @@ void TimerWidget::refresh()
}
else {
if (abs(timerState.val) >= 3600) {
drawTimer(zone.x + 3, zone.y + 14, abs(timerState.val), FOCUS_COLOR | LEFT | SMLSIZE | TIMEHOUR);
drawTimer(zone.x + 3, zone.y + 14, abs(timerState.val), FOCUS_COLOR | LEFT | FONT(XS) | TIMEHOUR);
}
else {
drawTimer(zone.x + 3, zone.y + 14, abs(timerState.val), FOCUS_COLOR | LEFT);
+5 -5
View File
@@ -62,14 +62,14 @@ void ValueWidget::refresh()
xLabel = x;
yLabel = y;
attrValue = LEFT | NO_UNIT | MIDSIZE;
attrLabel = SMLSIZE;
attrLabel = FONT(XS);
}
else if (zone.h < 50) {
xValue = x+zone.w-NUMBERS_PADDING;
yValue = y-2;
xLabel = x+NUMBERS_PADDING;
yLabel = y+2;
attrValue = RIGHT | NO_UNIT | DBLSIZE;
attrValue = RIGHT | NO_UNIT | FONT(XL);
}
else {
xValue = x+NUMBERS_PADDING;
@@ -81,7 +81,7 @@ void ValueWidget::refresh()
attrValue = LEFT | MIDSIZE | EXPANDED;
}
else {
attrValue = LEFT | DBLSIZE;
attrValue = LEFT | FONT(XL);
}
}
#if defined(INTERNAL_GPS)
@@ -90,7 +90,7 @@ void ValueWidget::refresh()
}
#endif
else {
attrValue = LEFT | DBLSIZE;
attrValue = LEFT | FONT(XL);
}
}
@@ -101,7 +101,7 @@ void ValueWidget::refresh()
}
drawSource(x+NUMBERS_PADDING, y+2, field, CUSTOM_COLOR);
drawSource(x+NUMBERS_PADDING + 1, y + 3, field, BLACK);
drawTimer(xValue, yValue, abs(timerState.val), attrValue|DBLSIZE|CUSTOM_COLOR);
drawTimer(xValue, yValue, abs(timerState.val), attrValue|FONT(XL)|CUSTOM_COLOR);
return;
}
+14 -4
View File
@@ -129,11 +129,21 @@ enum LcdColorIndex
LCD_COLOR_COUNT
};
#if !defined(BOOT)
#define FONT_TABLE_SIZE 16
#else
#define FONT_TABLE_SIZE 1
enum FontIndex
{
FONT_STD_INDEX,
#if !defined(BOLD)
FONT_BOLD_INDEX,
FONT_XXS_INDEX,
FONT_XS_INDEX,
FONT_L_INDEX,
FONT_XL_INDEX,
FONT_XXL_INDEX,
#endif
FONTS_COUNT
};
#define FONT(xx) (FONT_ ## xx ## _INDEX << 8)
constexpr uint32_t INPUT_EDIT_LABELS_WIDTH = 120;
constexpr coord_t INPUT_EDIT_CURVE_WIDTH = 158;
+14 -4
View File
@@ -127,11 +127,21 @@ enum LcdColorIndex
LCD_COLOR_COUNT
};
#if !defined(BOOT)
#define FONT_TABLE_SIZE 16
#else
#define FONT_TABLE_SIZE 1
enum FontIndex
{
FONT_STD_INDEX,
#if !defined(BOLD)
FONT_BOLD_INDEX,
FONT_XXS_INDEX,
FONT_XS_INDEX,
FONT_L_INDEX,
FONT_XL_INDEX,
FONT_XXL_INDEX,
#endif
FONTS_COUNT
};
#define FONT(xx) (FONT_ ## xx ## _INDEX << 8)
constexpr uint32_t INPUT_EDIT_LABELS_WIDTH = 80;
constexpr coord_t INPUT_EDIT_CURVE_WIDTH = LCD_W;