Add UI scaling support for touch vs button devices

Introduces uiScale() method to apply per-board UI scaling based on device type (1.0 for button devices, >1 for touch devices to make UI elements finger-sized). Adds scaledMetrics member to store scaled theme metrics that are returned by getMetrics().
This commit is contained in:
Justin Mitchell
2026-06-15 22:42:33 -04:00
parent cef0d267b7
commit e103cdfd11
17 changed files with 506 additions and 182 deletions
+6
View File
@@ -231,6 +231,12 @@ class BaseTheme {
bool inactiveSelection = false) const;
virtual bool showsFileIcons() const { return false; }
// Horizontal scroll offset (px to subtract from tab X positions) that keeps the
// selected tab visible when the tab row is wider than availWidth — used by every
// theme's drawTabBar so scaled-up tabs slide instead of running off-screen.
// Returns 0 when the whole row fits.
static int tabBarScrollOffset(int contentWidth, int selStart, int selWidth, int availWidth);
// Shared constants and helpers for battery drawing (used by all themes)
static constexpr int batteryPercentSpacing = 4;
static void drawBatteryOutline(const GfxRenderer& renderer, int x, int y, int battWidth, int rectHeight);