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:
+32
-13
@@ -19,32 +19,53 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _OPENTX_HELPERS_H_
|
||||
#define _OPENTX_HELPERS_H_
|
||||
#pragma once
|
||||
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#include "thirdparty/libopenui/src/libopenui_helpers.h"
|
||||
#else
|
||||
template<class T>
|
||||
inline T sgn(T a)
|
||||
{
|
||||
return a > 0 ? 1 : (a < 0 ? -1 : 0);
|
||||
}
|
||||
|
||||
template<class t> inline t min(t a, t b) { return a<b?a:b; }
|
||||
template<class t> inline t max(t a, t b) { return a>b?a:b; }
|
||||
template<class t> inline t limit(t mi, t x, t ma) { return min(max(mi,x),ma); }
|
||||
template<class T>
|
||||
inline T min(T a, T b)
|
||||
{
|
||||
return a < b ? a : b;
|
||||
}
|
||||
|
||||
inline int divRoundClosest(const int n, const int d)
|
||||
template<class T>
|
||||
inline T max(T a, T b)
|
||||
{
|
||||
return a > b ? a : b;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline T limit(T vmin, T x, T vmax)
|
||||
{
|
||||
return min(max(vmin, x), vmax);
|
||||
}
|
||||
|
||||
inline int divRoundClosest(int n, int d)
|
||||
{
|
||||
if (d == 0)
|
||||
return 0;
|
||||
else
|
||||
return ((n < 0) ^ (d < 0)) ? ((n - d/2)/d) : ((n + d/2)/d);
|
||||
}
|
||||
#endif
|
||||
|
||||
inline unsigned align32(unsigned n)
|
||||
{
|
||||
unsigned rest = (n & 3u);
|
||||
return rest ? n + 4u - rest : n;
|
||||
}
|
||||
|
||||
inline std::string TEXT_AT_INDEX(const char *const *val, uint8_t idx)
|
||||
{
|
||||
return std::string(val[idx]);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline void SWAP(T & a, T & b)
|
||||
@@ -100,5 +121,3 @@ class CircularBuffer {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user