mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-09-10 08:39:29 +00:00
Add Security+ 2.0 TX App (#3217)
* Add U64 BoundSetting * Add secplus-tx * Add secplus license * Update icon * UI update * Add filesystem::path BoundSetting * Add file UI * Rename file * Add save button * Fix warnings, add integer conversions to UI macros * UI update * Copilot suggestions, name edit UI * Fix buffer length * Style update * Avoid recursion in Widget::style() * Apply suggestions from code review * Move secplustx.cpp to external * Shorten title * Space optimizations, remove FilePath setting * Remove assertions * Change namespace * Change title to match
This commit is contained in:
+16
-16
@@ -26,6 +26,9 @@
|
||||
|
||||
namespace ui {
|
||||
|
||||
using Coord = int16_t;
|
||||
using Dim = int16_t;
|
||||
|
||||
// Positioning helpers PER CHARACTERS (8*16)
|
||||
// EACH parameters must be used az CHAR position, not PX coordinates. So If you wanna use the 8,16 coordinates (that is the second character in X and second character in Y you must use UI_POS_X(1) UI_POS_Y(1) (since we count from 0)
|
||||
|
||||
@@ -36,31 +39,31 @@ namespace ui {
|
||||
// default font width
|
||||
#define UI_POS_DEFAULT_WIDTH 8
|
||||
// px position of the linenum-th character (Y)
|
||||
#define UI_POS_Y(linenum) ((int)((linenum) * UI_POS_DEFAULT_HEIGHT))
|
||||
#define UI_POS_Y(linenum) ((Coord)((linenum) * UI_POS_DEFAULT_HEIGHT))
|
||||
// px position of the linenum-th character from the bottom of the screen (Y) (please calculate the +1 line top-bar to it too if that is visible!)
|
||||
#define UI_POS_Y_BOTTOM(linenum) ((int)(screen_height - (linenum) * UI_POS_DEFAULT_HEIGHT))
|
||||
#define UI_POS_Y_BOTTOM(linenum) ((Coord)(screen_height - (int)((linenum) * UI_POS_DEFAULT_HEIGHT)))
|
||||
// px position of the linenum-th character from the left of the screen (X)
|
||||
#define UI_POS_X(charnum) ((int)((charnum) * UI_POS_DEFAULT_WIDTH))
|
||||
#define UI_POS_X(charnum) ((Coord)((charnum) * UI_POS_DEFAULT_WIDTH))
|
||||
// px position of the linenum-th character from the right of the screen (X)
|
||||
#define UI_POS_X_RIGHT(charnum) ((int)(screen_width - ((charnum) * UI_POS_DEFAULT_WIDTH)))
|
||||
#define UI_POS_X_RIGHT(charnum) ((Coord)(screen_width - (int)((charnum) * UI_POS_DEFAULT_WIDTH)))
|
||||
// px position of the left character from the center of the screen (X) (for N character wide string)
|
||||
#define UI_POS_X_CENTER(charnum) ((int)((screen_width / 2) - ((charnum) * UI_POS_DEFAULT_WIDTH / 2)))
|
||||
// px position of the currcol in a table with colnum number of columns, where one coloumn is charnum characters wide maximum
|
||||
#define UI_POS_X_TABLE(colnum, currcol) ((currcol) * (screen_width / (colnum)))
|
||||
#define UI_POS_X_CENTER(charnum) ((Coord)((screen_width / 2) - (int)((charnum) * UI_POS_DEFAULT_WIDTH / 2)))
|
||||
// px position of the currcol in a table with colnum number of columns, where one column is charnum characters wide maximum
|
||||
#define UI_POS_X_TABLE(colnum, currcol) ((Coord)((currcol) * (screen_width / (colnum))))
|
||||
// px width of N characters
|
||||
#define UI_POS_WIDTH(charnum) ((int)((charnum) * UI_POS_DEFAULT_WIDTH))
|
||||
#define UI_POS_WIDTH(charnum) ((Dim)((charnum) * UI_POS_DEFAULT_WIDTH))
|
||||
// px width of the screen
|
||||
#define UI_POS_MAXWIDTH (screen_width)
|
||||
// px height of N line
|
||||
#define UI_POS_HEIGHT(linecount) ((int)((linecount) * UI_POS_DEFAULT_HEIGHT))
|
||||
#define UI_POS_HEIGHT(linecount) ((Dim)((linecount) * UI_POS_DEFAULT_HEIGHT))
|
||||
// px height of the screen's percent
|
||||
#define UI_POS_HEIGHT_PERCENT(percent) ((int)(screen_height * (percent) / 100))
|
||||
#define UI_POS_HEIGHT_PERCENT(percent) ((Dim)(screen_height * (percent) / 100))
|
||||
// remaining px from the linenum-th line to the bottom of the screen. (please calculate the +1 line top-bar to it too if that is visible!)
|
||||
#define UI_POS_HEIGHT_REMAINING(linenum) ((int)(screen_height - ((linenum) * UI_POS_DEFAULT_HEIGHT)))
|
||||
#define UI_POS_HEIGHT_REMAINING(linenum) ((Dim)(screen_height - (int)((linenum) * UI_POS_DEFAULT_HEIGHT)))
|
||||
// remaining px from the charnum-th character to the right of the screen
|
||||
#define UI_POS_WIDTH_REMAINING(charnum) ((int)(screen_width - ((charnum) * UI_POS_DEFAULT_WIDTH)))
|
||||
#define UI_POS_WIDTH_REMAINING(charnum) ((Dim)(screen_width - (int)((charnum) * UI_POS_DEFAULT_WIDTH)))
|
||||
// px width of the screen's percent
|
||||
#define UI_POS_WIDTH_PERCENT(percent) ((int)(screen_width * (percent) / 100))
|
||||
#define UI_POS_WIDTH_PERCENT(percent) ((Dim)(screen_width * (percent) / 100))
|
||||
// px width of the screen
|
||||
#define UI_POS_MAXHEIGHT (screen_height)
|
||||
|
||||
@@ -85,9 +88,6 @@ namespace ui {
|
||||
|
||||
#define DEG_TO_RAD(d) (d * (2 * pi) / 360.0)
|
||||
|
||||
using Coord = int16_t;
|
||||
using Dim = int16_t;
|
||||
|
||||
extern uint16_t screen_width;
|
||||
extern uint16_t screen_height;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user