[color] Batch conversions

This commit is contained in:
Raphael Coeffic
2021-06-10 13:17:49 +02:00
parent f7d36cd695
commit 0d344bedd8
28 changed files with 162 additions and 127 deletions
+1
View File
@@ -44,6 +44,7 @@ class LayoutFactory
virtual const ZoneOption * getOptions() const = 0;
virtual WidgetsContainer * create(LayoutPersistentData * persistentData) const = 0;
virtual WidgetsContainer * load(LayoutPersistentData * persistentData) const = 0;
virtual void initPersistentData(LayoutPersistentData * persistentData) const = 0;
protected:
const char * id;
@@ -150,7 +150,7 @@ class BaseLayoutFactory: public LayoutFactory
return layout;
}
void initPersistentData(Layout::PersistentData * persistentData) const
void initPersistentData(Layout::PersistentData * persistentData) const override
{
memset(persistentData, 0, sizeof(Layout::PersistentData));
if (options) {
+5 -7
View File
@@ -128,16 +128,14 @@ class ModelButton: public Button {
}
else {
error = readModel(modelCell->modelFilename, (uint8_t *)&partialModel.header, sizeof(partialModel), &version);
// LEN_BITMAP_NAME has now 4 bytes more
if (version <= 218) {
memmove(partialModel.timers, &(partialModel.header.bitmap[10]), sizeof(TimerData)*MAX_TIMERS);
memclear(&(partialModel.header.bitmap[10]), 4);
if (!error) {
if (modelCell->modelName[0] == '\0'
&& partialModel.header.name[0] != '\0') {
modelCell->setModelName(partialModel.header.name);
}
}
}
// if (modelCell->modelName[0] == '\0' && !error)
// setModelName(partialModel.header.name); // resets buffer!!!
buffer = new BitmapBuffer(BMP_RGB565, MODELCELL_WIDTH, MODELCELL_HEIGHT);
if (buffer == nullptr) {
return;
@@ -402,11 +402,12 @@ class Theme480: public OpenTxTheme
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
void drawProgressBar(BitmapBuffer *dc, coord_t x, coord_t y, coord_t w,
coord_t h, int value, int total) const override
{
dc->drawSolidRect(x, y, w, h, 1, DEFAULT_COLOR);
if (value > 0) {
int width = (w * value) / 100;
int width = (w * value) / total;
dc->drawSolidFilledRect(x + 2, y + 2, width - 4, h - 4, CHECKBOX_COLOR);
}
}
+3 -2
View File
@@ -420,11 +420,12 @@ class FlyskyTheme: public OpenTxTheme
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
void drawProgressBar(BitmapBuffer *dc, coord_t x, coord_t y, coord_t w,
coord_t h, int value, int total) const override
{
dc->drawSolidRect(x, y, w, h, 1, DEFAULT_COLOR);
if (value > 0) {
int width = (w * value) / 100;
int width = (w * value) / total;
dc->drawSolidFilledRect(x + 2, y + 2, width - 4, h - 4, CHECKBOX_COLOR);
}
}