lcdNextPos not needed anymore

This commit is contained in:
Bertrand Songis
2019-10-19 19:26:14 +02:00
parent 71bb4cfaa3
commit 9bf7563a02
2 changed files with 13 additions and 16 deletions
+12 -15
View File
@@ -29,10 +29,10 @@ class OptionsText : public StaticText {
StaticText(parent, rect) StaticText(parent, rect)
{ {
coord_t optionWidth = 0; coord_t optionWidth = 0;
for (uint8_t i=0; options[i]; i++) { for (uint8_t i = 0; options[i]; i++) {
const char * option = options[i]; const char * option = options[i];
optionWidth+= getTextWidth(option); optionWidth += getTextWidth(option);
if(optionWidth + 5 > width()) { if (optionWidth + 5 > width()) {
setHeight(getHeight() + 20); setHeight(getHeight() + 20);
optionWidth = 0; optionWidth = 0;
} }
@@ -42,23 +42,20 @@ class OptionsText : public StaticText {
void paint(BitmapBuffer * dc) override void paint(BitmapBuffer * dc) override
{ {
coord_t y = 0; coord_t y = 0;
lcdNextPos = 0; coord_t x = 0;
for (uint8_t i=0; options[i]; i++) { for (uint8_t i = 0; options[i]; i++) {
const char * option = options[i]; const char * option = options[i];
coord_t optionWidth = getTextWidth(option); coord_t optionWidth = getTextWidth(option);
if (x + 5 + optionWidth > width()) {
if (lcdNextPos + 5 + optionWidth > width()) { dc->drawText(x, y, ",");
dc->drawText(lcdNextPos, y, ","); x = 0;
lcdNextPos = 0;
y += FH; y += FH;
} }
if (i > 0 && lcdNextPos != 0) if (i > 0 && x != 0)
dc->drawText(lcdNextPos, y, ", "); x = dc->drawText(x, y, ", ");
dc->drawText(lcdNextPos, y, option); x = dc->drawText(x, y, option);
} }
} }
protected:
}; };
RadioVersionPage::RadioVersionPage(): RadioVersionPage::RadioVersionPage():