chore(color): Libopenui refactor (#3614)

* Refactor object creation logic.
Remove unused LVGL features.

* Remove unused files.
Fix height for widgets.

* Rename 'OpenTxTheme' class to 'EdgeTxTheme'.
Cleanup commented out code.
Cleanup unused code from 'etx_lv_theme.cpp'.

* More cleanup.

* Move more style code to etx_lv_theme.cpp

* Update license

* Make default button height match other controls.

* Fix curve edit layout.

* Fix layouts.

* FormWindow and FormGroup provided identical functionality - rename FormGroup to FormWindow and remove duplicate.

* Simplify menu icon handling.
Remove unused 'flysky.cpp' file.

* Fix window size change.

* Simplify page header code.
Fix statistics view page.

* Remove unused file.
Replace redundant 'Subtitle' class with a macro.
Fix compiler warnings.

* Fix compiler warning in LvglWrapper.cpp.
Remove unused code in static.h.
Simplify about page.

* Rename ICON_OPENTX to ICON_EDGETX.

* Fix github build error.

* Fix github build error (attempt 2).

* Move ButtonMatrix styling to etx_lv_theme.cpp.

* Scroll bar consistency.

* Use styles for ButtonMatrix text color.

* Use 'active' color for selected USB advanced setup buttons. Move error message to bottom of page.

* Create style for popup window title bar.
Simplify advanced USB setup code.
Remove unused libopenui/carousel.* files.

* Add style for modal popup content.

* Remove unused BUTTON_BACKGROUND flag.

* Replace GridLayout with FormWindow. Remove unused gridlayout.h file.

* Fix rebase.

* Merge ChoiceEx class into Choice class code.
Remove unused CurveKeyboard.

* Use LVGL bar for progress indicator.
Update only style colors when theme changes (don't recreate all style settings).

* Move ProgressDialog class to dlalog.h/dialog.cpp files.

* Simplify trim and slider code in main view.
Simplify the hardware inputs code.
Fix dialog size.
Remove unused code in layout factory.

* Cleanup unused code.

* Add style for FormWindow class.
Merge BaseNumberEdit class into NumberEdit class and remove BaseNumberEdit.
Remove more unused files.
Cleanup libopenui_config.h files.

* Re-organise libopenui include files to fix build error.

* Fix build error.

* Add missed styles to etx_lv_theme.cpp.
Delete commented out #includes.
More cleaning up of libopenui_xxx.h files and dependencies.
Re-enable LVGL CHECKBOX feature.

* Merge libopenui_helpers.h into opentx_helpers.h file.

* Fix firmware build.

* Use object constructors for LVGL object creation as suggested by gagarinlg.
Add style for number edit text alignment.
Fix background color for focussed control.

* Move color related stuff from libopenui_defines.h to colors.h.
Remove need for libopenui_depends.h file.

* Merge libopenui_types.h content into opentx_types.h file.

* Rename CheckBox class to ToggleSwitch.

* Restore code to update flight mode text color when theme changes.

* Cleanup some more unused code.

* Remove redundant theme.h file.

* Fix rebase.

* Fix button matrix style.

* Fix rebase

* Fix rebase

* Ensure correct initialisation of Choice object.

* Fix rebase.

* Make the slider control bigger to make touch activation easier.

* Fix build error.

* Fix slider logic and cleanup code.

* Use ACTIVE theme color for inputs, mixes, LS, GV and SF.

* Improved border width consistency and focussed state consistency.

* Remove duplicate copy of the default theme colors.
This commit is contained in:
philmoz
2023-08-04 11:04:54 +10:00
committed by GitHub
parent c0df9e9c44
commit 69338ab0ab
231 changed files with 2178 additions and 5921 deletions
+5
View File
@@ -238,13 +238,18 @@ void ledBlue();
#define LCD_PHYS_H LCD_H
#define LCD_PHYS_W LCD_W
#define LCD_DEPTH 16
void lcdInit();
void lcdCopy(void * dest, void * src);
void DMAFillRect(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t color);
void DMACopyBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, const uint16_t * src, uint16_t srcw, uint16_t srch, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h);
void DMACopyAlphaBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, const uint16_t * src, uint16_t srcw, uint16_t srch, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h);
void DMACopyAlphaMask(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, const uint8_t * src, uint16_t srcw, uint16_t srch, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h, uint16_t bg_color);
void DMABitmapConvert(uint16_t * dest, const uint8_t * src, uint16_t w, uint16_t h, uint32_t format);
#define lcdOff() backlightEnable(0) /* just disable the backlight */
#define lcdRefreshWait(...)
// Backlight driver
-1
View File
@@ -20,7 +20,6 @@
*/
#include "opentx_types.h"
#include "libopenui_config.h"
#include "lcd.h"
#include <lvgl/lvgl.h>
+2 -96
View File
@@ -21,121 +21,27 @@
#pragma once
#include "debug.h"
#include "libopenui_defines.h"
#include "colors.h"
#include "board.h"
#include "keys.h"
enum FontIndex
{
FONT_STD_INDEX,
FONT_BOLD_INDEX,
FONT_XXS_INDEX,
FONT_XS_INDEX,
FONT_L_INDEX,
FONT_XL_INDEX,
FONT_XXL_INDEX,
// this one MUST be last
FONTS_COUNT
};
typedef uint16_t pixel_t;
constexpr bool WRAP_FORM_FIELDS_WITHIN_PAGE = true;
constexpr short SLIDE_SPEED_REDUCTION = 5;
constexpr uint32_t MENU_HEADER_BUTTON_WIDTH = 33;
constexpr uint32_t MENU_HEADER_BUTTONS_LEFT = 47;
constexpr uint32_t MENU_HEADER_HEIGHT = 45;
constexpr uint32_t MENU_TITLE_TOP = 48;
constexpr uint32_t MENU_TITLE_HEIGHT = 21;
constexpr uint32_t MENU_BODY_TOP = MENU_TITLE_TOP + MENU_TITLE_HEIGHT;
constexpr uint32_t MENU_CONTENT_TOP = MENU_BODY_TOP + 1;
constexpr uint32_t MENU_FOOTER_HEIGHT = 0;
constexpr uint32_t MENU_FOOTER_TOP = LCD_H - MENU_FOOTER_HEIGHT;
constexpr uint32_t MENU_BODY_HEIGHT = MENU_FOOTER_TOP - MENU_BODY_TOP;
constexpr uint32_t MENUS_MARGIN_LEFT = 6;
constexpr coord_t MENUS_SEPARATOR_HEIGHT = 15;
constexpr uint32_t MENU_HEADER_BACK_BUTTON_WIDTH = MENU_HEADER_HEIGHT;
constexpr uint32_t MENU_HEADER_BACK_BUTTON_HEIGHT = MENU_HEADER_HEIGHT;
constexpr coord_t PAGE_PADDING = 6;
constexpr uint32_t LABELS_LINE_HEIGHT = 30;
constexpr uint32_t PAGE_LINE_HEIGHT = 20;
constexpr coord_t LINE_HEIGHT = PAGE_LINE_HEIGHT;
constexpr uint32_t PAGE_LINE_SPACING = 2;
constexpr uint32_t PAGE_INDENT_WIDTH = 10;
constexpr uint32_t PAGE_LABEL_WIDTH = 240;
constexpr uint32_t FH = PAGE_LINE_HEIGHT;
constexpr uint32_t NUM_BODY_LINES = MENU_BODY_HEIGHT / PAGE_LINE_HEIGHT;
constexpr uint32_t TEXT_VIEWER_LINES = (MENU_FOOTER_TOP - MENU_HEADER_HEIGHT) / FH;
constexpr uint32_t FIELD_PADDING_LEFT = 3;
constexpr uint32_t FIELD_PADDING_TOP = 2;
constexpr uint32_t CURVE_SIDE_WIDTH = 100;
constexpr uint32_t CURVE_CENTER_X = LCD_W - CURVE_SIDE_WIDTH - 7;
constexpr uint32_t CURVE_CENTER_Y = 151;
constexpr uint32_t CURVE_COORD_WIDTH = 36;
constexpr uint32_t CURVE_COORD_HEIGHT = 17;
constexpr uint32_t DATETIME_SEPARATOR_X = LCD_W - 53;
constexpr uint32_t DATETIME_LINE1 = 7;
constexpr uint32_t DATETIME_LINE2 = 22;
constexpr uint32_t DATETIME_MIDDLE = (LCD_W + DATETIME_SEPARATOR_X + 1) / 2;
constexpr uint32_t RSSI_X = LCD_W - 90;
constexpr uint32_t AUDIO_X = LCD_W - 130;
constexpr uint32_t USB_X = LCD_W - 98;
constexpr uint32_t LOG_X = LCD_W - 98;
constexpr uint32_t GPS_X = LCD_W - 148;
constexpr uint32_t MENUS_TOOLBAR_BUTTON_WIDTH = 30;
constexpr uint32_t MENUS_TOOLBAR_BUTTON_PADDING = 3;
constexpr rect_t MENUS_TOOLBAR_RECT = { 100, 51, 30, 209 };
constexpr uint32_t ALERT_FRAME_TOP = 70;
constexpr uint32_t ALERT_FRAME_HEIGHT = (LCD_H - 2 * ALERT_FRAME_TOP);
constexpr uint32_t ALERT_BITMAP_TOP = ALERT_FRAME_TOP + 15;
constexpr uint32_t ALERT_BITMAP_LEFT = 40;
constexpr uint32_t ALERT_TITLE_TOP = ALERT_FRAME_TOP + 10;
constexpr uint32_t ALERT_TITLE_LEFT = 186;
constexpr uint32_t ALERT_TITLE_LINE_HEIGHT = 30;
constexpr uint32_t ALERT_MESSAGE_TOP = ALERT_TITLE_TOP + 90;
constexpr uint32_t ALERT_MESSAGE_LEFT = ALERT_TITLE_LEFT;
constexpr uint32_t ALERT_ACTION_TOP = 240;
constexpr uint32_t ALERT_BUTTON_TOP = 300;
constexpr uint32_t PAGE_TITLE_TOP = 2;
constexpr uint32_t PAGE_TITLE_LEFT = 50;
constexpr uint32_t INPUT_EDIT_LABELS_WIDTH = 120;
constexpr coord_t INPUT_EDIT_CURVE_WIDTH = 132;
constexpr coord_t INPUT_EDIT_CURVE_HEIGHT = INPUT_EDIT_CURVE_WIDTH;
constexpr coord_t INPUT_EDIT_CURVE_LEFT = PAGE_PADDING;
constexpr coord_t INPUT_EDIT_CURVE_TOP = MENU_HEADER_HEIGHT + PAGE_PADDING;
constexpr coord_t MENUS_LINE_HEIGHT = 30;
constexpr coord_t MENUS_WIDTH = 200;
constexpr coord_t POPUP_HEADER_HEIGHT = 30;
constexpr coord_t MENUS_MAX_HEIGHT = LCD_H * 0.9;
constexpr coord_t MODEL_SELECT_FOOTER_HEIGHT = 24;
constexpr coord_t SCROLLBAR_WIDTH = 3;
constexpr coord_t TABLE_LINE_HEIGHT = 50;
constexpr coord_t TABLE_HEADER_HEIGHT = 48;
constexpr coord_t ROLLER_LINE_HEIGHT = 40;
constexpr rect_t MENUS_TOOLBAR_RECT = { 100, 51, 30, 209 };
constexpr LcdFlags MENU_HEADER_FONT = FONT(BOLD);
constexpr LcdFlags MENU_FONT = FONT(STD);
constexpr LcdFlags TABLE_HEADER_FONT = FONT(STD);
constexpr LcdFlags TABLE_BODY_FONT = FONT(STD);
constexpr int CJK_FIRST_LETTER_INDEX = 128 - 32 + 21;
constexpr coord_t CHAR_SPACING = 0;
#define ROTARY_ENCODER_SPEED() rotencSpeed
+4
View File
@@ -206,12 +206,16 @@ const etx_serial_port_t* auxSerialGetPort(int port_nr);
void lcdInit();
void lcdCopy(void * dest, void * src);
void DMAFillRect(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t color);
void DMACopyBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, const uint16_t * src, uint16_t srcw, uint16_t srch, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h);
void DMACopyAlphaBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, const uint16_t * src, uint16_t srcw, uint16_t srch, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h);
void DMACopyAlphaMask(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, const uint8_t * src, uint16_t srcw, uint16_t srch, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h, uint16_t bg_color);
void DMABitmapConvert(uint16_t * dest, const uint8_t * src, uint16_t w, uint16_t h, uint32_t format);
void lcdOff();
void lcdOn();
#define lcdRefreshWait(...)
// Backlight driver
-2
View File
@@ -20,8 +20,6 @@
*/
#include "opentx_types.h"
#include "libopenui_config.h"
#include "lcd.h"
#include "lcd_driver.h"
+2 -94
View File
@@ -21,120 +21,28 @@
#pragma once
#include "debug.h"
#include "libopenui_defines.h"
#include "colors.h"
#include "board.h"
#include "keys.h"
enum FontIndex
{
FONT_STD_INDEX,
FONT_BOLD_INDEX,
FONT_XXS_INDEX,
FONT_XS_INDEX,
FONT_L_INDEX,
FONT_XL_INDEX,
FONT_XXL_INDEX,
// this one MUST be last
FONTS_COUNT
};
typedef uint16_t pixel_t;
constexpr bool WRAP_FORM_FIELDS_WITHIN_PAGE = true;
constexpr short SLIDE_SPEED_REDUCTION = 5;
constexpr uint32_t MENU_HEADER_BUTTON_WIDTH = 33;
constexpr uint32_t MENU_HEADER_BUTTONS_LEFT = 47;
constexpr uint32_t MENU_HEADER_HEIGHT = 45;
constexpr uint32_t MENU_TITLE_TOP = 48;
constexpr uint32_t MENU_TITLE_HEIGHT = 21;
constexpr uint32_t MENU_BODY_TOP = MENU_TITLE_TOP + MENU_TITLE_HEIGHT;
constexpr uint32_t MENU_CONTENT_TOP = MENU_BODY_TOP + 1;
constexpr uint32_t MENU_FOOTER_HEIGHT = 0;
constexpr uint32_t MENU_FOOTER_TOP = LCD_H - MENU_FOOTER_HEIGHT;
constexpr uint32_t MENU_BODY_HEIGHT = MENU_FOOTER_TOP - MENU_BODY_TOP;
constexpr uint32_t MENUS_MARGIN_LEFT = 6;
constexpr coord_t MENUS_SEPARATOR_HEIGHT = 15;
constexpr uint32_t MENU_HEADER_BACK_BUTTON_WIDTH = MENU_HEADER_HEIGHT;
constexpr uint32_t MENU_HEADER_BACK_BUTTON_HEIGHT = MENU_HEADER_HEIGHT;
constexpr coord_t PAGE_PADDING = 6;
constexpr uint32_t PAGE_LINE_HEIGHT = 20;
constexpr uint32_t PAGE_LINE_SPACING = 2;
constexpr uint32_t PAGE_INDENT_WIDTH = 10;
constexpr uint32_t PAGE_LABEL_WIDTH = 140;
constexpr uint32_t FH = PAGE_LINE_HEIGHT;
constexpr uint32_t NUM_BODY_LINES = MENU_BODY_HEIGHT / PAGE_LINE_HEIGHT;
constexpr uint32_t TEXT_VIEWER_LINES = (MENU_FOOTER_TOP - MENU_HEADER_HEIGHT) / FH;
constexpr uint32_t FIELD_PADDING_LEFT = 3;
constexpr uint32_t FIELD_PADDING_TOP = 2;
constexpr uint32_t CURVE_SIDE_WIDTH = 100;
constexpr uint32_t CURVE_CENTER_X = LCD_W - CURVE_SIDE_WIDTH - 7;
constexpr uint32_t CURVE_CENTER_Y = 151;
constexpr uint32_t CURVE_COORD_WIDTH = 36;
constexpr uint32_t CURVE_COORD_HEIGHT = 17;
constexpr uint32_t DATETIME_SEPARATOR_X = LCD_W - 53;
constexpr uint32_t DATETIME_LINE1 = 7;
constexpr uint32_t DATETIME_LINE2 = 22;
constexpr uint32_t DATETIME_MIDDLE = (LCD_W + DATETIME_SEPARATOR_X + 1) / 2;
constexpr coord_t LINE_HEIGHT = PAGE_LINE_HEIGHT;
constexpr uint32_t RSSI_X = LCD_W - 80;
constexpr uint32_t AUDIO_X = LCD_W - 115;
constexpr uint32_t USB_X = LCD_W - 82;
constexpr uint32_t LOG_X = LCD_W - 82;
constexpr uint32_t GPS_X = LCD_W - 130;
constexpr uint32_t MENUS_TOOLBAR_BUTTON_WIDTH = 30;
constexpr uint32_t MENUS_TOOLBAR_BUTTON_PADDING = 3;
constexpr uint32_t ALERT_FRAME_TOP = 70;
constexpr uint32_t ALERT_FRAME_HEIGHT = (LCD_H - 2 * ALERT_FRAME_TOP);
constexpr uint32_t ALERT_BITMAP_TOP = ALERT_FRAME_TOP + 15;
constexpr uint32_t ALERT_BITMAP_LEFT = 15;
constexpr uint32_t ALERT_TITLE_TOP = ALERT_FRAME_TOP + 10;
constexpr uint32_t ALERT_TITLE_LEFT = 140;
constexpr uint32_t ALERT_TITLE_LINE_HEIGHT = 30;
constexpr uint32_t ALERT_MESSAGE_TOP = ALERT_TITLE_TOP + 130;
constexpr uint32_t ALERT_MESSAGE_LEFT = 15;
constexpr uint32_t ALERT_ACTION_TOP = 240;
constexpr uint32_t ALERT_BUTTON_TOP = 300;
constexpr uint32_t PAGE_TITLE_TOP = 2;
constexpr uint32_t PAGE_TITLE_LEFT = 50;
constexpr uint32_t INPUT_EDIT_LABELS_WIDTH = 80;
constexpr coord_t INPUT_EDIT_CURVE_WIDTH = 176;
constexpr coord_t INPUT_EDIT_CURVE_HEIGHT = 132;
constexpr coord_t INPUT_EDIT_CURVE_LEFT = PAGE_PADDING;
constexpr coord_t INPUT_EDIT_CURVE_TOP = MENU_HEADER_HEIGHT + PAGE_PADDING;
constexpr coord_t MENUS_LINE_HEIGHT = 40;
constexpr coord_t MENUS_WIDTH = 200;
constexpr coord_t POPUP_HEADER_HEIGHT = 30;
constexpr coord_t MENUS_MAX_HEIGHT = 7 * MENUS_LINE_HEIGHT - 1;
constexpr rect_t MENUS_TOOLBAR_RECT = { 35, (LCD_H - MENUS_MAX_HEIGHT) / 2, 50, MENUS_MAX_HEIGHT };
constexpr coord_t MODEL_SELECT_FOOTER_HEIGHT = 24;
constexpr coord_t SCROLLBAR_WIDTH = 3;
constexpr coord_t TABLE_LINE_HEIGHT = 50;
constexpr coord_t TABLE_HEADER_HEIGHT = 48;
constexpr coord_t ROLLER_LINE_HEIGHT = 40;
constexpr LcdFlags MENU_HEADER_FONT = FONT(BOLD);
constexpr LcdFlags MENU_FONT = FONT(STD);
constexpr LcdFlags TABLE_HEADER_FONT = FONT(STD);
constexpr LcdFlags TABLE_BODY_FONT = FONT(STD);
constexpr int CJK_FIRST_LETTER_INDEX = 128 - 32 + 21;
constexpr coord_t CHAR_SPACING = 0;
// Disable rotary encoder, as the NV14 does not have one
#define ROTARY_ENCODER_SPEED() 0