From 53d73a7952c1da6977dc52114b0f51be75d07c9a Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Tue, 27 Apr 2021 09:10:49 +0200 Subject: [PATCH] Cosmetics --- radio/src/thirdparty/libopenui/src/table.cpp | 2 +- radio/src/thirdparty/libopenui/src/table.h | 30 ++++++++++++-------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/radio/src/thirdparty/libopenui/src/table.cpp b/radio/src/thirdparty/libopenui/src/table.cpp index 257eda06b..7ea4fd9a5 100644 --- a/radio/src/thirdparty/libopenui/src/table.cpp +++ b/radio/src/thirdparty/libopenui/src/table.cpp @@ -69,7 +69,7 @@ void Table::Body::paint(BitmapBuffer * dc) for (unsigned i = 0; i < line->cells.size(); i++) { auto cell = line->cells[i]; if (cell) { - cell->paint(dc, x, y, line->flags | (highlight ? MENU_HIGHLIGHT_COLOR : DEFAULT_COLOR)); + cell->paint(dc, x, y, line->flags + (highlight ? MENU_HIGHLIGHT_COLOR - COLOR_MASK(line->flags) : DEFAULT_COLOR)); } x += static_cast(parent)->columnsWidth[i]; } diff --git a/radio/src/thirdparty/libopenui/src/table.h b/radio/src/thirdparty/libopenui/src/table.h index db392f906..ecbcaca7e 100644 --- a/radio/src/thirdparty/libopenui/src/table.h +++ b/radio/src/thirdparty/libopenui/src/table.h @@ -28,7 +28,8 @@ class Table: public FormField { public: - class Cell { + class Cell + { public: virtual ~Cell() = default; @@ -37,7 +38,8 @@ class Table: public FormField virtual bool needsInvalidate() = 0; }; - class StringCell : public Cell { + class StringCell : public Cell + { public: StringCell() = default; @@ -60,7 +62,8 @@ class Table: public FormField std::string value; }; - class DynamicStringCell : public Cell { + class DynamicStringCell : public Cell + { public: explicit DynamicStringCell(std::function getText): getText(std::move(getText)) @@ -82,9 +85,10 @@ class Table: public FormField std::function getText; }; - class CustomCell : public Cell { + class CustomCell : public Cell + { public: - explicit CustomCell(std::function paintFunction): + explicit CustomCell(std::function paintFunction): paintFunction(std::move(paintFunction)) { } @@ -103,7 +107,8 @@ class Table: public FormField std::function paintFunction; }; - class Line { + class Line + { public: explicit Line(uint8_t columnsCount): cells(columnsCount, nullptr) @@ -122,7 +127,8 @@ class Table: public FormField LcdFlags flags = TABLE_BODY_FONT; }; - class Header: public Window, public Line { + class Header: public Window, public Line + { public: Header(Table * parent, const rect_t & rect, uint8_t columnsCount): Window(parent, rect, OPAQUE), @@ -165,7 +171,7 @@ class Table: public FormField void addLine(Line * line) { lines.push_back(line); - setInnerHeight(lines.size() * TABLE_LINE_HEIGHT - 2); + setInnerHeight((int)lines.size() * TABLE_LINE_HEIGHT - 2); if (hasFocus() && selection < 0) { select(0, true); } @@ -248,7 +254,7 @@ class Table: public FormField } #endif - void deleteLater(bool detach = true, bool trash = true) override + void deleteLater(bool detach = true, bool trash = true) override // NOLINT(google-default-arguments) { if (_deleted) return; @@ -261,7 +267,7 @@ class Table: public FormField void setColumnsWidth(const coord_t values[]) { - int8_t restColumn = -1; + int restColumn = -1; coord_t restWidth = width(); for (uint8_t i = 0; i < columnsCount; i++) { auto columnWidth = values[i]; @@ -289,7 +295,7 @@ class Table: public FormField body.invalidate(); } - void setFocus(uint8_t flag = SET_FOCUS_DEFAULT, Window * from = nullptr) override + void setFocus(uint8_t flag = SET_FOCUS_DEFAULT, Window * from = nullptr) override // NOLINT(google-default-arguments) { if (body.lines.empty()) { if (flag == SET_FOCUS_BACKWARD) { @@ -306,7 +312,7 @@ class Table: public FormField else { body.setFocus(flag, from); if (body.selection < 0) { - select(flag == SET_FOCUS_BACKWARD ? body.lines.size() - 1 : 0); + select(flag == SET_FOCUS_BACKWARD ? (int)body.lines.size() - 1 : 0); } } }