refactor(ui): shared drawList + header + key-decode helpers

- drawList(): scrollable list skeleton (visible window, keep-sel-in-view,
  scroll-column reserve, per-row callback, indicator). Migrate Tools, Bot,
  Nearby, Waypoints list and the three QuickMsg lists onto it; centralises the
  scroll-clamp/reserve/indicator that each had open-coded (and inconsistently).
- drawCenteredHeader(): centred title + separator, replacing the duplicated
  two-liner across ~10 screens (incl. QuickMsg, which used width()/2 spacing and
  was missed before); unifies the separator at headerH()-sepH().
- keyIsPrev()/keyIsNext() in UIScreen.h for the LEFT||PREV / RIGHT||NEXT idiom;
  applied to 6 screens, behaviour-preserving. Cancel/context-menu stay
  per-screen (they mean different things on different screens).
- rotLabel() dedups the 0/90/180/270 array in Settings.
- Unify selection-row height to lineStep()-1 (Tools/Bot matched the rest).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-06-15 21:23:00 +02:00
co-authored by Claude Opus 4.8
parent 98af868e68
commit 9da730e3b6
13 changed files with 89 additions and 123 deletions
@@ -46,8 +46,7 @@ public:
int start_y = display.listStart();
int val_x = display.valCol();
display.drawTextCentered(display.width() / 2, 0, "CLOCK FIELDS");
display.fillRect(0, display.headerH() - 1, display.width(), display.sepH());
display.drawCenteredHeader("CLOCK FIELDS");
static const char* labels[] = { "Field 1", "Field 2", "Field 3" };
for (int i = 0; i < FIELD_SLOTS; i++) {
@@ -72,8 +71,8 @@ public:
}
if (c == KEY_UP && _sel > 0) { _sel--; return true; }
if (c == KEY_DOWN && _sel < FIELD_SLOTS - 1){ _sel++; return true; }
if (c == KEY_LEFT || c == KEY_PREV) { cycle(_sel, -1); return true; }
if (c == KEY_RIGHT || c == KEY_NEXT) { cycle(_sel, 1); return true; }
if (keyIsPrev(c)) { cycle(_sel, -1); return true; }
if (keyIsNext(c)) { cycle(_sel, 1); return true; }
if (c == KEY_ENTER) { cycle(_sel, 1); return true; }
return false;
}