Skip to content

feat(ui): add landscape UI mode - #1

Open
Raxcoms wants to merge 30 commits into
developfrom
landscape-ui
Open

Raxcoms wants to merge 30 commits into
developfrom
landscape-ui

Conversation

@Raxcoms

@Raxcoms Raxcoms commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Summary

Full horizontal (landscape) UI support across the CrossPoint Reader firmware.

Changes

Cover Grid (2 columns in landscape)

  • CoverGridHomeUi::gridColumnsFor() returns 2 columns in landscape, 3 in portrait
  • Hero cover card layout uses the dynamic column count for proper sizing

Button Hints (landscape-aware)

All three themes draw button hints on the side edge in landscape mode:

  • BaseTheme (Classic): rectangular hints with rotated labels
  • LyraTheme (Lyra): rounded rectangle hints with rotated labels
  • RoundedRaffTheme (RoundedRaff): two groups of 2 buttons each on the side edge

Labels drawn with drawTextRotated90CW(). CW orientation draws on the left edge, CCW on the right.

Status Bar & Header

Already orientation-aware via getOrientedViewableTRBL() — no changes needed, full-width centered in landscape automatically.

Cover Cache

Already tracks orientation and invalidates on rotation — no changes needed.

- Cover grid now uses 2 columns in landscape instead of 3
- Button hints drawn on side edge in landscape mode with rotated labels
- BaseTheme and LyraTheme both get landscape-aware button hints
- X4 physical buttons map to side edge when rotated to landscape
- Landscape mode draws button hints on the side edge
- Two groups of 2 buttons each positioned vertically on the side
- Text drawn with rotation to match landscape orientation
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Firmware builds

Automatically generated from the merge build for the latest commit of this PR (ebe5730).

Download and extract the .bin for your device, then flash it with CrossPoint Reader Flash Tools. Make sure you use the correct firmware file for your device.

Firmware unavailable: Sticky, X4 Pro, X4 Classic, Paper Mono, MetalIO EInk4, EEGO A4, BOOX Picco.

Flash and static RAM usage (bytes)

Merge build for PR ebe5730 compared with its develop parent 3331d18.

Device Baseline (Total image / linker Flash / RAM) PR (Total image / linker Flash / RAM) Difference (Total image / linker Flash / RAM)
X3 / X4 unavailable / unavailable / unavailable 5,644,528 / 5,630,007 / 66,872 B unavailable / unavailable / unavailable
Sticky unavailable / unavailable / unavailable unavailable / unavailable / unavailable unavailable / unavailable / unavailable
X4 Pro unavailable / unavailable / unavailable unavailable / unavailable / unavailable unavailable / unavailable / unavailable
X4 Classic unavailable / unavailable / unavailable unavailable / unavailable / unavailable unavailable / unavailable / unavailable
Paper Mono unavailable / unavailable / unavailable unavailable / unavailable / unavailable unavailable / unavailable / unavailable
MetalIO EInk4 unavailable / unavailable / unavailable unavailable / unavailable / unavailable unavailable / unavailable / unavailable
EEGO A4 unavailable / unavailable / unavailable unavailable / unavailable / unavailable unavailable / unavailable / unavailable
BOOX Picco unavailable / unavailable / unavailable unavailable / unavailable / unavailable unavailable / unavailable / unavailable

X3 / X4: baseline unavailable — no saved develop build.

Sticky: baseline unavailable — no saved develop build.

Sticky: PR usage unavailable — measurement missing (build may have failed).

X4 Pro: baseline unavailable — no saved develop build.

X4 Pro: PR usage unavailable — measurement missing (build may have failed).

X4 Classic: baseline unavailable — no saved develop build.

X4 Classic: PR usage unavailable — measurement missing (build may have failed).

Paper Mono: baseline unavailable — no saved develop build.

Paper Mono: PR usage unavailable — measurement missing (build may have failed).

MetalIO EInk4: baseline unavailable — no saved develop build.

MetalIO EInk4: PR usage unavailable — measurement missing (build may have failed).

EEGO A4: baseline unavailable — no saved develop build.

EEGO A4: PR usage unavailable — measurement missing (build may have failed).

BOOX Picco: baseline unavailable — no saved develop build.

BOOX Picco: PR usage unavailable — measurement missing (build may have failed).

The X4 reports 480x800 physical dimensions regardless of how it is held,
so the home screen always assumed portrait. Apply SETTINGS.orientation
on home screen enter (like the reader does) and use renderer orientation
instead of physical dimensions to detect landscape mode.
Remove Classic, RoundedRaff, Lyra 3 Covers and the Cover Grid home
variant so the firmware carries only the Lyra theme. UITheme now always
builds LyraTheme (BaseTheme remains the OOM fallback), the UI Theme
setting and its translations are gone, and saved settings files keep
loading (the legacy uiTheme key is simply ignored). HomeActivity loses
the cover-grid path; the text-settings host test runs Lyra metrics only.
The landscape hint rail drew the portrait band and the side rail on top
of each other, and reused portrait x spacing for boxes that are tall
there, so the boxes overlapped. Draw only the rail in landscape, mirror
the portrait band's panel footprint so each box sits over its physical
button in both rotations, key the position table to the portrait panel
width, and center rotated labels accounting for their text running
toward smaller y.
Fold the hint-rail gutter into the fui device safe area (UiAppHost now
derives the device context through railSafeDeviceContext), so lists,
tabs, popups and sheets stop short of the rail in landscape instead of
drawing under it. Replace the hardcoded portrait bottom hint margins
with UITheme::getHintBandBottomInset, and add getHintRailLeftGutter /
getHintRailRightGutter for chrome pinned to a screen edge (library
readout and hold help, keyboard entry, dictionary, bookmarks, remap
warning banner). Portrait values are unchanged.
UITheme::getHint* helpers are static members, so they must go through
getInstance().getMetrics(); drop the now-unused metrics locals in
LibraryListActivity that cppcheck flagged.
The bare pioarduino release URL in platform_packages makes fresh
dependency resolution look for a package named 'registry' and fail
(UnknownPackageError); the same scons 4.8.1 package (4.40801.0) is
published on the official PlatformIO registry, so reference it by
package name. Bump both PlatformIO cache keys so stale resolutions do
not mask the fix.
The battery and clock hug the header corners, which land behind the
button-hint rail in landscape. DrawHeader and the catalog header now
withhold that chrome from the fui header and draw the battery, percent
label and clock as one centered group on the status strip instead.
HeaderChrome.h needed clang-format-21 (the -g wrapper only formats
tracked-modified files, and the header was already committed). In the
catalog header, initialize centeredChrome from header.status so it is
used and not flagged as a dead assignment.
List screens scrolled without any progress indication. UiListActivity
now draws a small "position/count" (like 12/69) at the bottom-right of
the folded content on every list screen: position over pages, since
rows-per-page varies with label wrapping and a page total would change
while scrolling (same rationale as the library's existing readout).
syncListViewport reserves the line, anchored to the content fold so
takeBottom chrome like the bookmarks help line stacks cleanly, and the
fui safe area keeps it clear of the bezel and the landscape hint rail.

Opt-outs: library (own readout), OPDS browser and plugin catalog (their
own page pagers), status-bar settings and text settings (short fixed
lists, the latter under a live preview and layout test).
AP mode stacked two 198px QR codes plus labels, taller than the
480px landscape view. They now sit side by side with their labels
under each code when the content band fits both. Raw-drawn chrome
(QR band, centered text, wifi bars) respects the landscape rail
gutter, matching the FUI screens. Portrait layout unchanged.
GUI is the theme object; UITheme::drawCenteredText is a singleton
static, so GUI.drawCenteredText does not compile.
The home screen stacked the cover tile over the menu, which runs off
the 480px landscape view. Cover card and menu now share the rail-safe
band side by side in landscape; portrait keeps the original rects and
formulas untouched.

Cover/menu rects come from one homeContentLayout() used by both render
and the touch routing in loop(), so hit bands stay on the visuals on
touch boards (X4 has none, but the grid is kept correct). The cover
snapshot rect follows the layout automatically.
…tus path

UITheme::isLandscape() and UITheme::getHintRails() collapse the
orientation checks and double gutter-reads that were scattered across
six call sites. UiAppHost documents the asymmetric safeArea contract:
the rail is folded into safeArea in landscape, but the portrait hint
band is still reserved per-screen via getHintBandBottomInset.

BaseTheme::drawButtonHintsLandscape was dead code - only Lyra ships and
draws its own rail - so the static fallback and its call site are gone.
HeaderChrome owns the withhold/redraw helper; the call sites apply the
rail fold to the header band, which centers the status group on the
rail-safe band instead of the full-bleed band.

OOM boot comment now says what the fallback does, not just that one
exists.
…landscape-only

The landscape home split started the cover at homeTopPadding but the
menu at homeTopPadding + homeMenuTopOffset, and left the cover column
short of the screen bottom. Both columns now start at the same top, so
the worst case (six menu rows with a plugin or continue-reading slot)
exactly fills the band instead of clipping.

Side-by-side QR triggering was keyed off band width alone, so portrait
AP mode silently switched to the side-by-side layout. The trigger is
now landscape-only, restoring the stacked layout for portrait. Long
SSIDs and hostnames are clamped to the QR's left edge for the same
reason - the centering math could go negative.
The effective margin was computed from the full content width while
the field was drawn inside the rail-safe width, so the field drifted
off center by half the rail gutter in landscape. The margin is now
computed against the rail-safe width and the password toggle is pinned
to its right edge. Same math for the hit-test block.
UiTabListActivity reported "1/N" while the selection sat on the tab band -
a position of nothing. The readout now reports -1 there and the footer
skips it. The viewport harness now reserves the readout line and asserts
the anchored position, so the reservation is covered by the host test.
The four separate portrait-style boxes became one full-height strip
painted from edge to edge, in grayscale or the current polarity. Labels
keep their physical button slots (rotated 90 clockwise) instead of
sitting inside a per-button box.

Only the Lyra theme ships the side rail; the BaseTheme fallback stays
unchanged for its portrait-only behaviour.
Every landscape header now always draws the band underline (it was
title-gated before, so the untitled home band had no rule). The underline
spans the rail-safe band width.

A 3px vertical divider runs from that rule to the screen bottom along the
rail content edge, so the two dividers only meet at a corner and never
cross. It is drawn on the content side of the edge so the rail fill,
painted after the header, never covers it.
The cover column now spans the full height of the band, and the cover
box is centered horizontally at the top. Title and author use the full
column width and anchor to the bottom, leaving the gap between cover
and text as blank space.

The selection frame wraps the centered box only (not the whole tile).
The menu block is vertically centered in its column: its height is the
drawn row count times the pitch, so the touch grid keeps matching the
rendered rows. A 3px divider separates the two columns, running from
the header rule to the bottom.

The cover snapshot region follows the full column and stays within its
size budget (about 20 KB on the X4).
drawRecentBookCover declared the title/author textX once near the top of
the function (recomputed for landscape) and again in the title block, so
the compiler saw a conflicting second declaration. Remove the stale one.
The landscape cover column is the full band height, but the title/author block stayed centered in it, so it rendered over the lower part of the cover. Anchor the block to the column bottom with the theme spacing gap instead; portrait keeps its centered layout.
catalogScreenHeader builds its own header band with its own underline but no rail divider, so catalog screens lost the corner rule every other landscape header draws. Extract the divider into a shared HeaderChrome helper and call it from both header builders so the rule stays consistent.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant