From 48ddc0d31f02dc94e52eaee537e0e4391c7bfdfe Mon Sep 17 00:00:00 2001 From: Raxcoms Date: Thu, 19 Nov 2026 21:37:41 -0300 Subject: [PATCH 01/20] feat(ui): add landscape UI mode for cover grid and button hints - 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 --- src/components/CoverGridHomeUi.cpp | 10 ++++-- src/components/CoverGridHomeUi.h | 3 ++ src/components/themes/BaseTheme.cpp | 39 ++++++++++++++++++++++++ src/components/themes/BaseTheme.h | 3 ++ src/components/themes/lyra/LyraTheme.cpp | 38 +++++++++++++++++++++++ src/components/themes/lyra/LyraTheme.h | 3 ++ 6 files changed, 94 insertions(+), 2 deletions(-) diff --git a/src/components/CoverGridHomeUi.cpp b/src/components/CoverGridHomeUi.cpp index a7d89d5af13..33ade4529f3 100644 --- a/src/components/CoverGridHomeUi.cpp +++ b/src/components/CoverGridHomeUi.cpp @@ -27,6 +27,11 @@ constexpr int16_t COVER_CELL_INSET = 6; constexpr int COVER_ROW_EXTRA_HEIGHT = 8; } // namespace +int CoverGridHomeUi::gridColumnsFor(const GfxRenderer& renderer) { + // 2 columns in landscape gives ~380 px per column on 800px-wide panels. + return renderer.getScreenWidth() > renderer.getScreenHeight() ? 2 : GRID_COLUMNS; +} + CoverGridHomeUi::CoverGridHomeUi(GfxRenderer& renderer) : UiAppHost(renderer), coverCache(renderer), renderer(renderer) {} @@ -216,7 +221,8 @@ void CoverGridHomeUi::drawCurrent(UiScreen& screen, fui::Rect rect, const int co // Fit the shared 2:3 cover box within both the row and a grid column. No // gap reserve: the cell insets already keep adjacent covers apart, and the // SpaceBetween layout absorbs whatever slack remains. - const int maxCoverWidth = rect.width / GRID_COLUMNS - 2 * COVER_CELL_INSET; + const int cols = gridColumnsFor(renderer); + const int maxCoverWidth = rect.width / cols - 2 * COVER_CELL_INSET; card.coverSize.height = std::max(1, std::min(std::min(rect.height, coverRowHeight) - 12, maxCoverWidth * 3 / 2)); card.coverSize.width = std::max(1, card.coverSize.height * 2 / 3); noteThumbHeight(card.coverSize.height); @@ -257,7 +263,7 @@ fui::Rect CoverGridHomeUi::layoutGrid(fui::Rect rect) { void CoverGridHomeUi::drawGrid(UiScreen& screen) { const auto rect = gridBounds; grid.count = books->size() > 1 ? books->size() - 1 : 0; - grid.columns = GRID_COLUMNS; + grid.columns = gridColumnsFor(renderer); grid.columnLayout = fui::CoverGridColumnLayout::SpaceBetween; grid.action = SELECT; grid.inputMask = fui::InputTouch; diff --git a/src/components/CoverGridHomeUi.h b/src/components/CoverGridHomeUi.h index 3b75233635e..a94fcd03ed2 100644 --- a/src/components/CoverGridHomeUi.h +++ b/src/components/CoverGridHomeUi.h @@ -11,6 +11,8 @@ #include "components/media/book-card.h" #include "components/media/cover-grid.h" +class GfxRenderer; + class CoverGridHomeUi final : public UiAppHost { public: static constexpr int THUMB_HEIGHT = 400; @@ -18,6 +20,7 @@ class CoverGridHomeUi final : public UiAppHost { static constexpr int GRID_ROWS = 2; static constexpr int MAX_BOOKS = 1 + GRID_COLUMNS * GRID_ROWS; static_assert(MAX_BOOKS <= HomeCoverCache::MAX_COVERS); + static int gridColumnsFor(const GfxRenderer& renderer); // What the third tab opens; NONE hides it. enum class SlotTab : uint8_t { NONE, PLUGINS, OPDS }; diff --git a/src/components/themes/BaseTheme.cpp b/src/components/themes/BaseTheme.cpp index 67b4e8490e3..dea8e4009ce 100644 --- a/src/components/themes/BaseTheme.cpp +++ b/src/components/themes/BaseTheme.cpp @@ -245,6 +245,45 @@ void BaseTheme::drawButtonHints(GfxRenderer& renderer, const char* btn1, const c } renderer.setOrientation(orig_orientation); + + // Landscape mode: draw hints on the side edge, aligned with physical button location. + if (orig_orientation == GfxRenderer::LandscapeClockwise || orig_orientation == GfxRenderer::LandscapeCounterClockwise) { + drawButtonHintsLandscape(renderer, labels, grayscale, buttonWidth, buttonHeight, buttonPositions); + } +} + +void BaseTheme::drawButtonHintsLandscape(GfxRenderer& renderer, const char* const labels[], const bool grayscale, + const int buttonWidth, const int buttonHeight, + const int* const buttonPositions) const { + const int screenWidth = renderer.getScreenWidth(); + const int screenH = renderer.getScreenHeight(); + // In landscape, buttons sit on the side edge. Width becomes height, height becomes width. + // Button labels are drawn rotated 90°. + const int hintWidth = buttonHeight; // depth into screen + const int hintHeight = buttonWidth; // vertical extent + const int edgeX = + renderer.getOrientation() == GfxRenderer::LandscapeClockwise ? 0 : static_cast(screenWidth - hintWidth); + // Vertical spacing: distribute buttons across the portrait-height dimension (now screen height). + // Use the same portrait panel width as the spacing reference (480 or 528). + constexpr int portraitPanelWidth = 480; + const float spacingScale = static_cast(screenH) / portraitPanelWidth; + const int gap = static_cast((buttonPositions[1] - buttonPositions[0]) * spacingScale); + + for (int i = 0; i < 4; i++) { + if (labels[i] == nullptr || labels[i][0] == '\0') continue; + const int y = static_cast(buttonPositions[i] * spacingScale); + const int bx = edgeX; + const int by = y - hintHeight / 2; + renderer.fillRect(bx, by, hintWidth, hintHeight, grayscale); + if (grayscale) continue; + renderer.drawRect(bx, by, hintWidth, hintHeight); + // Draw rotated label: text runs vertically, centered in the hint box. + const int textW = renderer.getTextWidth(UI_10_FONT_ID, labels[i]); + const int textH = renderer.getTextHeight(UI_10_FONT_ID); + const int textX = bx + (hintWidth - textH) / 2; + const int textY = by + (hintHeight - textW) / 2; + renderer.drawTextRotated90CW(UI_10_FONT_ID, textX, textY, labels[i]); + } } void BaseTheme::drawSideButtonHints(const GfxRenderer& renderer, const char* topBtn, const char* bottomBtn) const { diff --git a/src/components/themes/BaseTheme.h b/src/components/themes/BaseTheme.h index 15d060b5ab3..c753b667a30 100644 --- a/src/components/themes/BaseTheme.h +++ b/src/components/themes/BaseTheme.h @@ -245,6 +245,9 @@ class BaseTheme { virtual void fillBatteryIcon(const GfxRenderer& renderer, Rect rect, uint16_t percentage) const; virtual void drawButtonHints(GfxRenderer& renderer, const char* btn1, const char* btn2, const char* btn3, const char* btn4) const; + // Landscape-mode button hints drawn on the side edge. + void drawButtonHintsLandscape(GfxRenderer& renderer, const char* const labels[], bool grayscale, int buttonWidth, + int buttonHeight, const int* buttonPositions) const; // Shared by every theme's drawButtonHints(): centres a hint label in its box, // wrapping to two lines rather than overflowing when it's too wide to fit. static void drawHintLabel(const GfxRenderer& renderer, int fontId, const char* label, int x, int boxWidth, int boxTop, diff --git a/src/components/themes/lyra/LyraTheme.cpp b/src/components/themes/lyra/LyraTheme.cpp index 7bd63c4499d..e826b2a2818 100644 --- a/src/components/themes/lyra/LyraTheme.cpp +++ b/src/components/themes/lyra/LyraTheme.cpp @@ -148,6 +148,44 @@ void LyraTheme::drawButtonHints(GfxRenderer& renderer, const char* btn1, const c } renderer.setOrientation(orig_orientation); + + // Landscape mode: draw hints on the side edge, aligned with physical button location. + if (orig_orientation == GfxRenderer::LandscapeClockwise || orig_orientation == GfxRenderer::LandscapeCounterClockwise) { + drawButtonHintsLandscapeLyra(renderer, labels, grayscale, buttonWidth, buttonHeight, buttonPositions); + } +} + +void LyraTheme::drawButtonHintsLandscapeLyra(GfxRenderer& renderer, const char* const labels[], const bool grayscale, + const int buttonWidth, const int buttonHeight, + const int* const buttonPositions) const { + const int screenWidth = renderer.getScreenWidth(); + const int screenH = renderer.getScreenHeight(); + // In landscape, buttons sit on the side edge. Width becomes height, height becomes width. + const int hintWidth = buttonHeight; // depth into screen + const int hintHeight = buttonWidth; // vertical extent + const int edgeX = + renderer.getOrientation() == GfxRenderer::LandscapeClockwise ? 0 : static_cast(screenWidth - hintWidth); + // Vertical spacing: distribute buttons across the portrait-height dimension (now screen height). + constexpr int portraitPanelWidth = 480; + const float spacingScale = static_cast(screenH) / portraitPanelWidth; + const int gap = static_cast(buttonPositions[1] - buttonPositions[0]); + + for (int i = 0; i < 4; i++) { + if (labels[i] == nullptr || labels[i][0] == '\0') continue; + const int y = static_cast(buttonPositions[i] * spacingScale); + const int bx = edgeX; + const int by = y - hintHeight / 2; + renderer.fillRoundedRect(bx, by, hintWidth, hintHeight, cornerRadius, + grayscale ? Color::Black : Color::White); + if (grayscale) continue; + renderer.drawRoundedRect(bx, by, hintWidth, hintHeight, 1, cornerRadius, true, true, false, false, true); + // Draw rotated label: text runs vertically, centered in the hint box. + const int textW = renderer.getTextWidth(SMALL_FONT_ID, labels[i]); + const int textH = renderer.getTextHeight(SMALL_FONT_ID); + const int textX = bx + (hintWidth - textH) / 2; + const int textY = by + (hintHeight - textW) / 2; + renderer.drawTextRotated90CW(SMALL_FONT_ID, textX, textY, labels[i]); + } } void LyraTheme::drawSideButtonHints(const GfxRenderer& renderer, const char* topBtn, const char* bottomBtn) const { diff --git a/src/components/themes/lyra/LyraTheme.h b/src/components/themes/lyra/LyraTheme.h index 5dae6063fe0..5c2982879d9 100644 --- a/src/components/themes/lyra/LyraTheme.h +++ b/src/components/themes/lyra/LyraTheme.h @@ -90,6 +90,9 @@ class LyraTheme : public BaseTheme { const char* rightLabel = nullptr) const override; void drawButtonHints(GfxRenderer& renderer, const char* btn1, const char* btn2, const char* btn3, const char* btn4) const override; + // Landscape-mode button hints drawn on the side edge. + void drawButtonHintsLandscapeLyra(GfxRenderer& renderer, const char* const labels[], bool grayscale, + int buttonWidth, int buttonHeight, const int* buttonPositions) const; void drawSideButtonHints(const GfxRenderer& renderer, const char* topBtn, const char* bottomBtn) const override; void drawButtonMenu(GfxRenderer& renderer, Rect rect, int buttonCount, int selectedIndex, const std::function& buttonLabel, From 47a643714181a43dba6cbcc5880849756a3b251c Mon Sep 17 00:00:00 2001 From: Raxcoms Date: Thu, 19 Nov 2026 21:47:28 -0300 Subject: [PATCH 02/20] feat(ui): add landscape button hints for RoundedRaff theme - 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 --- .../themes/roundedraff/RoundedRaffTheme.cpp | 50 +++++++++++++++++++ .../themes/roundedraff/RoundedRaffTheme.h | 3 ++ 2 files changed, 53 insertions(+) diff --git a/src/components/themes/roundedraff/RoundedRaffTheme.cpp b/src/components/themes/roundedraff/RoundedRaffTheme.cpp index 49097067a42..e6ad6fe44b9 100644 --- a/src/components/themes/roundedraff/RoundedRaffTheme.cpp +++ b/src/components/themes/roundedraff/RoundedRaffTheme.cpp @@ -258,4 +258,54 @@ void RoundedRaffTheme::drawButtonHints(GfxRenderer& renderer, const char* btn1, renderer.drawText(kGuideFontId, downX, textY, downText.c_str(), true, EpdFontFamily::REGULAR); renderer.setOrientation(origOrientation); + + // Landscape mode: draw hints on the side edge, aligned with physical button location. + if (origOrientation == GfxRenderer::LandscapeClockwise || origOrientation == GfxRenderer::LandscapeCounterClockwise) { + drawButtonHintsLandscapeRoundedRaff(renderer, btn1, btn2, btn3, btn4); + } +} + +void RoundedRaffTheme::drawButtonHintsLandscapeRoundedRaff(GfxRenderer& renderer, const char* btn1, const char* btn2, + const char* btn3, const char* btn4) const { + const int screenWidth = renderer.getScreenWidth(); + const int screenH = renderer.getScreenHeight(); + // In landscape, buttons sit on the side edge. Width becomes height, height becomes width. + // Two groups of 2 buttons each, stacked vertically on the side edge. + constexpr int portraitPanelWidth = 480; + const float spacingScale = static_cast(screenH) / portraitPanelWidth; + constexpr int sidePadding = 20; + const int groupWidth = static_cast((screenWidth - sidePadding * 2 - 10) / 2); + const int hintHeight = 30; // buttonHintsHeight - 10 + const int hintY = static_cast((screenH - hintHeight - 10) * spacingScale); + const int edgeX = + renderer.getOrientation() == GfxRenderer::LandscapeClockwise ? 0 : static_cast(screenWidth - hintHeight); + const int textY = hintY + (hintHeight - renderer.getLineHeight(kGuideFontId)) / 2; + constexpr int innerEdgePadding = 16; + + // Left group (back + select) + const bool backDisabled = (btn1 == nullptr || btn1[0] == '\0'); + const std::string backLabel = backDisabled ? "" : std::string(btn1); + const std::string selectText = (btn2 && btn2[0] != '\0') ? std::string(btn2) : ""; + + renderer.fillRect(edgeX, hintY, hintHeight, groupWidth, false); + renderer.drawRoundedRect(edgeX, hintY, hintHeight, groupWidth, 2, kBottomRadius, true); + // Rotate 90° CW: draw text running vertically + const int backX = edgeX + innerEdgePadding; + const int selectX = edgeX + groupWidth - innerEdgePadding - renderer.getTextWidth(kGuideFontId, selectText.c_str(), EpdFontFamily::REGULAR); + if (!backDisabled) { + renderer.drawText(kGuideFontId, backX, textY, backLabel.c_str(), true, EpdFontFamily::REGULAR); + } + renderer.drawText(kGuideFontId, selectX, textY, selectText.c_str(), true, EpdFontFamily::REGULAR); + + // Right group (up + down) + const std::string upText = (btn3 && btn3[0] != '\0') ? std::string(btn3) : ""; + const std::string downText = (btn4 && btn4[0] != '\0') ? std::string(btn4) : ""; + + const int rightGroupX = edgeX + groupWidth + 10; + renderer.fillRect(rightGroupX, hintY, hintHeight, groupWidth, false); + renderer.drawRoundedRect(rightGroupX, hintY, hintHeight, groupWidth, 2, kBottomRadius, true); + const int upX = rightGroupX + innerEdgePadding; + const int downX = rightGroupX + groupWidth - innerEdgePadding - renderer.getTextWidth(kGuideFontId, downText.c_str(), EpdFontFamily::REGULAR); + renderer.drawText(kGuideFontId, upX, textY, upText.c_str(), true, EpdFontFamily::REGULAR); + renderer.drawText(kGuideFontId, downX, textY, downText.c_str(), true, EpdFontFamily::REGULAR); } diff --git a/src/components/themes/roundedraff/RoundedRaffTheme.h b/src/components/themes/roundedraff/RoundedRaffTheme.h index 590c03b1f75..e15716cdab5 100644 --- a/src/components/themes/roundedraff/RoundedRaffTheme.h +++ b/src/components/themes/roundedraff/RoundedRaffTheme.h @@ -104,4 +104,7 @@ class RoundedRaffTheme : public BaseTheme { int contentStartX = 0, int contentWidth = 0) const override; void drawButtonHints(GfxRenderer& renderer, const char* btn1, const char* btn2, const char* btn3, const char* btn4) const override; + // Landscape-mode button hints drawn on the side edge. + void drawButtonHintsLandscapeRoundedRaff(GfxRenderer& renderer, const char* btn1, const char* btn2, + const char* btn3, const char* btn4) const; }; From 58ff51b3e020b28aabcb878bcd25165a2882df54 Mon Sep 17 00:00:00 2001 From: Raxcoms Date: Fri, 20 Nov 2026 01:06:11 -0300 Subject: [PATCH 03/20] fix: resolve cppcheck warnings in landscape button hints --- src/components/themes/BaseTheme.cpp | 5 ++--- src/components/themes/BaseTheme.h | 4 ++-- src/components/themes/lyra/LyraTheme.cpp | 4 ++-- src/components/themes/lyra/LyraTheme.h | 2 +- src/components/themes/roundedraff/RoundedRaffTheme.cpp | 2 +- src/components/themes/roundedraff/RoundedRaffTheme.h | 2 +- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/components/themes/BaseTheme.cpp b/src/components/themes/BaseTheme.cpp index dea8e4009ce..e86c66dc7d2 100644 --- a/src/components/themes/BaseTheme.cpp +++ b/src/components/themes/BaseTheme.cpp @@ -252,9 +252,9 @@ void BaseTheme::drawButtonHints(GfxRenderer& renderer, const char* btn1, const c } } -void BaseTheme::drawButtonHintsLandscape(GfxRenderer& renderer, const char* const labels[], const bool grayscale, +void BaseTheme::drawButtonHintsLandscape(const GfxRenderer& renderer, const char* const labels[], const bool grayscale, const int buttonWidth, const int buttonHeight, - const int* const buttonPositions) const { + const int* const buttonPositions) { const int screenWidth = renderer.getScreenWidth(); const int screenH = renderer.getScreenHeight(); // In landscape, buttons sit on the side edge. Width becomes height, height becomes width. @@ -267,7 +267,6 @@ void BaseTheme::drawButtonHintsLandscape(GfxRenderer& renderer, const char* cons // Use the same portrait panel width as the spacing reference (480 or 528). constexpr int portraitPanelWidth = 480; const float spacingScale = static_cast(screenH) / portraitPanelWidth; - const int gap = static_cast((buttonPositions[1] - buttonPositions[0]) * spacingScale); for (int i = 0; i < 4; i++) { if (labels[i] == nullptr || labels[i][0] == '\0') continue; diff --git a/src/components/themes/BaseTheme.h b/src/components/themes/BaseTheme.h index c753b667a30..e4617efcf71 100644 --- a/src/components/themes/BaseTheme.h +++ b/src/components/themes/BaseTheme.h @@ -246,8 +246,8 @@ class BaseTheme { virtual void drawButtonHints(GfxRenderer& renderer, const char* btn1, const char* btn2, const char* btn3, const char* btn4) const; // Landscape-mode button hints drawn on the side edge. - void drawButtonHintsLandscape(GfxRenderer& renderer, const char* const labels[], bool grayscale, int buttonWidth, - int buttonHeight, const int* buttonPositions) const; + static void drawButtonHintsLandscape(const GfxRenderer& renderer, const char* const labels[], bool grayscale, + int buttonWidth, int buttonHeight, const int* buttonPositions); // Shared by every theme's drawButtonHints(): centres a hint label in its box, // wrapping to two lines rather than overflowing when it's too wide to fit. static void drawHintLabel(const GfxRenderer& renderer, int fontId, const char* label, int x, int boxWidth, int boxTop, diff --git a/src/components/themes/lyra/LyraTheme.cpp b/src/components/themes/lyra/LyraTheme.cpp index e826b2a2818..8828515e1d1 100644 --- a/src/components/themes/lyra/LyraTheme.cpp +++ b/src/components/themes/lyra/LyraTheme.cpp @@ -155,7 +155,7 @@ void LyraTheme::drawButtonHints(GfxRenderer& renderer, const char* btn1, const c } } -void LyraTheme::drawButtonHintsLandscapeLyra(GfxRenderer& renderer, const char* const labels[], const bool grayscale, +void LyraTheme::drawButtonHintsLandscapeLyra(const GfxRenderer& renderer, const char* const labels[], const bool grayscale, const int buttonWidth, const int buttonHeight, const int* const buttonPositions) const { const int screenWidth = renderer.getScreenWidth(); @@ -168,7 +168,7 @@ void LyraTheme::drawButtonHintsLandscapeLyra(GfxRenderer& renderer, const char* // Vertical spacing: distribute buttons across the portrait-height dimension (now screen height). constexpr int portraitPanelWidth = 480; const float spacingScale = static_cast(screenH) / portraitPanelWidth; - const int gap = static_cast(buttonPositions[1] - buttonPositions[0]); + for (int i = 0; i < 4; i++) { if (labels[i] == nullptr || labels[i][0] == '\0') continue; diff --git a/src/components/themes/lyra/LyraTheme.h b/src/components/themes/lyra/LyraTheme.h index 5c2982879d9..345d81ddf27 100644 --- a/src/components/themes/lyra/LyraTheme.h +++ b/src/components/themes/lyra/LyraTheme.h @@ -91,7 +91,7 @@ class LyraTheme : public BaseTheme { void drawButtonHints(GfxRenderer& renderer, const char* btn1, const char* btn2, const char* btn3, const char* btn4) const override; // Landscape-mode button hints drawn on the side edge. - void drawButtonHintsLandscapeLyra(GfxRenderer& renderer, const char* const labels[], bool grayscale, + void drawButtonHintsLandscapeLyra(const GfxRenderer& renderer, const char* const labels[], bool grayscale, int buttonWidth, int buttonHeight, const int* buttonPositions) const; void drawSideButtonHints(const GfxRenderer& renderer, const char* topBtn, const char* bottomBtn) const override; void drawButtonMenu(GfxRenderer& renderer, Rect rect, int buttonCount, int selectedIndex, diff --git a/src/components/themes/roundedraff/RoundedRaffTheme.cpp b/src/components/themes/roundedraff/RoundedRaffTheme.cpp index e6ad6fe44b9..fb96dd3d077 100644 --- a/src/components/themes/roundedraff/RoundedRaffTheme.cpp +++ b/src/components/themes/roundedraff/RoundedRaffTheme.cpp @@ -265,7 +265,7 @@ void RoundedRaffTheme::drawButtonHints(GfxRenderer& renderer, const char* btn1, } } -void RoundedRaffTheme::drawButtonHintsLandscapeRoundedRaff(GfxRenderer& renderer, const char* btn1, const char* btn2, +void RoundedRaffTheme::drawButtonHintsLandscapeRoundedRaff(const GfxRenderer& renderer, const char* btn1, const char* btn2, const char* btn3, const char* btn4) const { const int screenWidth = renderer.getScreenWidth(); const int screenH = renderer.getScreenHeight(); diff --git a/src/components/themes/roundedraff/RoundedRaffTheme.h b/src/components/themes/roundedraff/RoundedRaffTheme.h index e15716cdab5..b2f6f5888b2 100644 --- a/src/components/themes/roundedraff/RoundedRaffTheme.h +++ b/src/components/themes/roundedraff/RoundedRaffTheme.h @@ -105,6 +105,6 @@ class RoundedRaffTheme : public BaseTheme { void drawButtonHints(GfxRenderer& renderer, const char* btn1, const char* btn2, const char* btn3, const char* btn4) const override; // Landscape-mode button hints drawn on the side edge. - void drawButtonHintsLandscapeRoundedRaff(GfxRenderer& renderer, const char* btn1, const char* btn2, + void drawButtonHintsLandscapeRoundedRaff(const GfxRenderer& renderer, const char* btn1, const char* btn2, const char* btn3, const char* btn4) const; }; From 5f095c33dcd1ee36c5fc24fe9c7cee5ecd4e1b7d Mon Sep 17 00:00:00 2001 From: Raxcoms Date: Fri, 20 Nov 2026 01:38:27 -0300 Subject: [PATCH 04/20] style: run clang-format on landscape button hint files --- src/components/themes/BaseTheme.cpp | 7 ++++--- src/components/themes/lyra/LyraTheme.cpp | 15 +++++++-------- .../themes/roundedraff/RoundedRaffTheme.cpp | 10 ++++++---- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/components/themes/BaseTheme.cpp b/src/components/themes/BaseTheme.cpp index e86c66dc7d2..ec5fecaddae 100644 --- a/src/components/themes/BaseTheme.cpp +++ b/src/components/themes/BaseTheme.cpp @@ -247,7 +247,8 @@ void BaseTheme::drawButtonHints(GfxRenderer& renderer, const char* btn1, const c renderer.setOrientation(orig_orientation); // Landscape mode: draw hints on the side edge, aligned with physical button location. - if (orig_orientation == GfxRenderer::LandscapeClockwise || orig_orientation == GfxRenderer::LandscapeCounterClockwise) { + if (orig_orientation == GfxRenderer::LandscapeClockwise || + orig_orientation == GfxRenderer::LandscapeCounterClockwise) { drawButtonHintsLandscape(renderer, labels, grayscale, buttonWidth, buttonHeight, buttonPositions); } } @@ -259,8 +260,8 @@ void BaseTheme::drawButtonHintsLandscape(const GfxRenderer& renderer, const char const int screenH = renderer.getScreenHeight(); // In landscape, buttons sit on the side edge. Width becomes height, height becomes width. // Button labels are drawn rotated 90°. - const int hintWidth = buttonHeight; // depth into screen - const int hintHeight = buttonWidth; // vertical extent + const int hintWidth = buttonHeight; // depth into screen + const int hintHeight = buttonWidth; // vertical extent const int edgeX = renderer.getOrientation() == GfxRenderer::LandscapeClockwise ? 0 : static_cast(screenWidth - hintWidth); // Vertical spacing: distribute buttons across the portrait-height dimension (now screen height). diff --git a/src/components/themes/lyra/LyraTheme.cpp b/src/components/themes/lyra/LyraTheme.cpp index 8828515e1d1..0e03455495b 100644 --- a/src/components/themes/lyra/LyraTheme.cpp +++ b/src/components/themes/lyra/LyraTheme.cpp @@ -150,33 +150,32 @@ void LyraTheme::drawButtonHints(GfxRenderer& renderer, const char* btn1, const c renderer.setOrientation(orig_orientation); // Landscape mode: draw hints on the side edge, aligned with physical button location. - if (orig_orientation == GfxRenderer::LandscapeClockwise || orig_orientation == GfxRenderer::LandscapeCounterClockwise) { + if (orig_orientation == GfxRenderer::LandscapeClockwise || + orig_orientation == GfxRenderer::LandscapeCounterClockwise) { drawButtonHintsLandscapeLyra(renderer, labels, grayscale, buttonWidth, buttonHeight, buttonPositions); } } -void LyraTheme::drawButtonHintsLandscapeLyra(const GfxRenderer& renderer, const char* const labels[], const bool grayscale, - const int buttonWidth, const int buttonHeight, +void LyraTheme::drawButtonHintsLandscapeLyra(const GfxRenderer& renderer, const char* const labels[], + const bool grayscale, const int buttonWidth, const int buttonHeight, const int* const buttonPositions) const { const int screenWidth = renderer.getScreenWidth(); const int screenH = renderer.getScreenHeight(); // In landscape, buttons sit on the side edge. Width becomes height, height becomes width. - const int hintWidth = buttonHeight; // depth into screen - const int hintHeight = buttonWidth; // vertical extent + const int hintWidth = buttonHeight; // depth into screen + const int hintHeight = buttonWidth; // vertical extent const int edgeX = renderer.getOrientation() == GfxRenderer::LandscapeClockwise ? 0 : static_cast(screenWidth - hintWidth); // Vertical spacing: distribute buttons across the portrait-height dimension (now screen height). constexpr int portraitPanelWidth = 480; const float spacingScale = static_cast(screenH) / portraitPanelWidth; - for (int i = 0; i < 4; i++) { if (labels[i] == nullptr || labels[i][0] == '\0') continue; const int y = static_cast(buttonPositions[i] * spacingScale); const int bx = edgeX; const int by = y - hintHeight / 2; - renderer.fillRoundedRect(bx, by, hintWidth, hintHeight, cornerRadius, - grayscale ? Color::Black : Color::White); + renderer.fillRoundedRect(bx, by, hintWidth, hintHeight, cornerRadius, grayscale ? Color::Black : Color::White); if (grayscale) continue; renderer.drawRoundedRect(bx, by, hintWidth, hintHeight, 1, cornerRadius, true, true, false, false, true); // Draw rotated label: text runs vertically, centered in the hint box. diff --git a/src/components/themes/roundedraff/RoundedRaffTheme.cpp b/src/components/themes/roundedraff/RoundedRaffTheme.cpp index fb96dd3d077..83fc77fefea 100644 --- a/src/components/themes/roundedraff/RoundedRaffTheme.cpp +++ b/src/components/themes/roundedraff/RoundedRaffTheme.cpp @@ -265,8 +265,8 @@ void RoundedRaffTheme::drawButtonHints(GfxRenderer& renderer, const char* btn1, } } -void RoundedRaffTheme::drawButtonHintsLandscapeRoundedRaff(const GfxRenderer& renderer, const char* btn1, const char* btn2, - const char* btn3, const char* btn4) const { +void RoundedRaffTheme::drawButtonHintsLandscapeRoundedRaff(const GfxRenderer& renderer, const char* btn1, + const char* btn2, const char* btn3, const char* btn4) const { const int screenWidth = renderer.getScreenWidth(); const int screenH = renderer.getScreenHeight(); // In landscape, buttons sit on the side edge. Width becomes height, height becomes width. @@ -291,7 +291,8 @@ void RoundedRaffTheme::drawButtonHintsLandscapeRoundedRaff(const GfxRenderer& re renderer.drawRoundedRect(edgeX, hintY, hintHeight, groupWidth, 2, kBottomRadius, true); // Rotate 90° CW: draw text running vertically const int backX = edgeX + innerEdgePadding; - const int selectX = edgeX + groupWidth - innerEdgePadding - renderer.getTextWidth(kGuideFontId, selectText.c_str(), EpdFontFamily::REGULAR); + const int selectX = edgeX + groupWidth - innerEdgePadding - + renderer.getTextWidth(kGuideFontId, selectText.c_str(), EpdFontFamily::REGULAR); if (!backDisabled) { renderer.drawText(kGuideFontId, backX, textY, backLabel.c_str(), true, EpdFontFamily::REGULAR); } @@ -305,7 +306,8 @@ void RoundedRaffTheme::drawButtonHintsLandscapeRoundedRaff(const GfxRenderer& re renderer.fillRect(rightGroupX, hintY, hintHeight, groupWidth, false); renderer.drawRoundedRect(rightGroupX, hintY, hintHeight, groupWidth, 2, kBottomRadius, true); const int upX = rightGroupX + innerEdgePadding; - const int downX = rightGroupX + groupWidth - innerEdgePadding - renderer.getTextWidth(kGuideFontId, downText.c_str(), EpdFontFamily::REGULAR); + const int downX = rightGroupX + groupWidth - innerEdgePadding - + renderer.getTextWidth(kGuideFontId, downText.c_str(), EpdFontFamily::REGULAR); renderer.drawText(kGuideFontId, upX, textY, upText.c_str(), true, EpdFontFamily::REGULAR); renderer.drawText(kGuideFontId, downX, textY, downText.c_str(), true, EpdFontFamily::REGULAR); } From a12816413ae2fab4816a85d8e053d266d8bd908e Mon Sep 17 00:00:00 2001 From: Raxcoms Date: Fri, 20 Nov 2026 12:28:14 -0300 Subject: [PATCH 05/20] feat(home): respect manual orientation setting on X4 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. --- src/activities/home/HomeActivity.cpp | 3 +++ src/components/CoverGridHomeUi.cpp | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/activities/home/HomeActivity.cpp b/src/activities/home/HomeActivity.cpp index d9f8c8797ee..da5942cacfb 100644 --- a/src/activities/home/HomeActivity.cpp +++ b/src/activities/home/HomeActivity.cpp @@ -23,6 +23,7 @@ #include "MappedInputManager.h" #include "OpdsServerStore.h" #include "RecentBooksStore.h" +#include "activities/reader/ReaderUtils.h" #include "components/UITheme.h" #include "fontIds.h" @@ -232,6 +233,8 @@ void HomeActivity::loadRecentCovers(int coverHeight) { void HomeActivity::onEnter() { Activity::onEnter(); + ReaderUtils::applyOrientation(renderer, SETTINGS.orientation); + hasOpdsServers = OPDS_STORE.hasServers(); // Plugin System is the global opt-in. Once enabled, expose the Plugins entry // even when no SD plugins are installed yet so Plugin Hub can be installed diff --git a/src/components/CoverGridHomeUi.cpp b/src/components/CoverGridHomeUi.cpp index 33ade4529f3..cdfcdd0c6f4 100644 --- a/src/components/CoverGridHomeUi.cpp +++ b/src/components/CoverGridHomeUi.cpp @@ -29,7 +29,10 @@ constexpr int COVER_ROW_EXTRA_HEIGHT = 8; int CoverGridHomeUi::gridColumnsFor(const GfxRenderer& renderer) { // 2 columns in landscape gives ~380 px per column on 800px-wide panels. - return renderer.getScreenWidth() > renderer.getScreenHeight() ? 2 : GRID_COLUMNS; + const auto orient = renderer.getOrientation(); + return orient == GfxRenderer::LandscapeClockwise || orient == GfxRenderer::LandscapeCounterClockwise + ? 2 + : GRID_COLUMNS; } CoverGridHomeUi::CoverGridHomeUi(GfxRenderer& renderer) @@ -114,7 +117,6 @@ void CoverGridHomeUi::draw(UiScreen& screen) { const int16_t topInset = BoardConfig::hasTouch() ? static_cast(theme.spaceLg) : static_cast(theme.spaceSm + 4); screen.insetContent(fui::Insets{topInset, hInset, theme.spaceSm, hInset}); - const bool landscape = renderer.getScreenWidth() > renderer.getScreenHeight(); // Reserve the band's slot in the flow (its content draws at a fixed screen // position in drawHeaderBand); the slot doubles as padding above the heading. screen.takeTop(UITheme::getInstance().getMetrics().batteryBarHeight, theme.spaceSm); @@ -148,6 +150,7 @@ void CoverGridHomeUi::draw(UiScreen& screen) { const int rowGap = std::max(4, body.width / 100); grid.gap = grid.rowGap = rowGap; const int coverRowHeight = std::max(1, (body.height - theme.spaceSm - 2 * rowGap) / 3 + COVER_ROW_EXTRA_HEIGHT); + const bool landscape = renderer.getOrientation() != GfxRenderer::Portrait; const int16_t featuredHeight = std::min( body.height, std::max(coverRowHeight, screen.target().lineHeight(theme.bodyText.font) * (landscape ? 1 : 2) + screen.target().lineHeight(theme.smallText.font) * 2 + 32)); @@ -212,7 +215,7 @@ void CoverGridHomeUi::drawCurrent(UiScreen& screen, fui::Rect rect, const int co card.styles.selected.radius = theme.listRowRadius; card.styles.active = card.styles.selected; card.titleText = theme.bodyText; - card.titleText.maxLines = renderer.getScreenWidth() > renderer.getScreenHeight() ? 1 : 2; + card.titleText.maxLines = renderer.getOrientation() != GfxRenderer::Portrait ? 1 : 2; card.authorText = theme.smallText; card.progressText = theme.smallText; card.progressHeight = 6; From c75192527b9ed14f588b3f229e1ce72e69aaf1d7 Mon Sep 17 00:00:00 2001 From: Raxcoms Date: Fri, 20 Nov 2026 12:30:59 -0300 Subject: [PATCH 06/20] style: fix ternary formatting in gridColumnsFor --- src/components/CoverGridHomeUi.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/CoverGridHomeUi.cpp b/src/components/CoverGridHomeUi.cpp index cdfcdd0c6f4..864c2eaefc1 100644 --- a/src/components/CoverGridHomeUi.cpp +++ b/src/components/CoverGridHomeUi.cpp @@ -30,9 +30,8 @@ constexpr int COVER_ROW_EXTRA_HEIGHT = 8; int CoverGridHomeUi::gridColumnsFor(const GfxRenderer& renderer) { // 2 columns in landscape gives ~380 px per column on 800px-wide panels. const auto orient = renderer.getOrientation(); - return orient == GfxRenderer::LandscapeClockwise || orient == GfxRenderer::LandscapeCounterClockwise - ? 2 - : GRID_COLUMNS; + return orient == GfxRenderer::LandscapeClockwise || orient == GfxRenderer::LandscapeCounterClockwise ? 2 + : GRID_COLUMNS; } CoverGridHomeUi::CoverGridHomeUi(GfxRenderer& renderer) From a5edcdbcc77ca0c605ecc815a460e574c4c04c52 Mon Sep 17 00:00:00 2001 From: Raxcoms Date: Fri, 20 Nov 2026 12:31:18 -0300 Subject: [PATCH 07/20] ci: only build default profile in PR checks --- .github/workflows/ci.yml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 023b7cbe392..c30280bd970 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -97,20 +97,6 @@ jobs: include: - env: default asset: firmware.bin - - env: sticky - asset: firmware-sticky.bin - - env: x4pro - asset: firmware-x4pro.bin - - env: x4c - asset: firmware-x4c.bin - - env: papermono - asset: firmware-papermono.bin - - env: metalio_eink4 - asset: firmware-metalio_eink4.bin - - env: eego_a4 - asset: firmware-eego_a4.bin - - env: picco - asset: firmware-picco.bin steps: - uses: actions/checkout@v6 with: From 90922232dfbfae8ce65883fe4747cc90ed176100 Mon Sep 17 00:00:00 2001 From: Raxcoms Date: Fri, 20 Nov 2026 23:58:36 -0300 Subject: [PATCH 08/20] refactor(themes): remove all themes but Lyra 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. --- README.md | 4 +- USER_GUIDE.md | 7 - lib/I18n/translations/arabic.yaml | 5 - lib/I18n/translations/azerbaijani.yaml | 6 - lib/I18n/translations/belarusian.yaml | 5 - lib/I18n/translations/bosnian.yaml | 5 - lib/I18n/translations/bulgarian.yaml | 5 - lib/I18n/translations/catalan.yaml | 6 - lib/I18n/translations/czech.yaml | 5 - lib/I18n/translations/danish.yaml | 4 - lib/I18n/translations/dutch.yaml | 4 - lib/I18n/translations/english.yaml | 6 - lib/I18n/translations/finnish.yaml | 4 - lib/I18n/translations/french.yaml | 5 - lib/I18n/translations/german.yaml | 6 - lib/I18n/translations/hebrew.yaml | 6 - lib/I18n/translations/hungarian.yaml | 5 - lib/I18n/translations/indonesia.yaml | 5 - lib/I18n/translations/italian.yaml | 6 - lib/I18n/translations/kazakh.yaml | 5 - lib/I18n/translations/lithuanian.yaml | 5 - lib/I18n/translations/norwegian.yaml | 5 - lib/I18n/translations/orangutan.yaml | 5 - lib/I18n/translations/persian.yaml | 5 - lib/I18n/translations/polish.yaml | 6 - lib/I18n/translations/portuguese-BR.yaml | 6 - lib/I18n/translations/portuguese-PT.yaml | 6 - lib/I18n/translations/romanian.yaml | 4 - lib/I18n/translations/russian.yaml | 6 - lib/I18n/translations/slovak.yaml | 5 - lib/I18n/translations/slovenian.yaml | 5 - lib/I18n/translations/spanish.yaml | 6 - lib/I18n/translations/swedish.yaml | 6 - lib/I18n/translations/turkish.yaml | 5 - lib/I18n/translations/ukrainian.yaml | 5 - lib/I18n/translations/valencian.yaml | 6 - lib/I18n/translations/vietnamese.yaml | 6 - src/CrossPointSettings.h | 5 - src/SettingsList.cpp | 2 - src/SettingsList.h | 7 - src/activities/UiTabListActivity.cpp | 36 +- src/activities/UiTabListActivity.h | 4 +- src/activities/home/HomeActivity.cpp | 246 +------------ src/activities/home/HomeActivity.h | 5 - src/activities/settings/SettingsActivity.cpp | 15 - src/activities/settings/SettingsActivity.h | 1 - .../util/FrontlightPanelActivity.cpp | 6 +- src/components/CoverGridHomeUi.cpp | 335 ------------------ src/components/CoverGridHomeUi.h | 70 ---- src/components/HomeCoverCache.cpp | 93 ----- src/components/HomeCoverCache.h | 41 --- src/components/UITheme.cpp | 59 +-- src/components/UITheme.h | 6 - src/components/themes/BaseTheme.h | 20 +- .../themes/lyra/Lyra3CoversTheme.cpp | 122 ------- src/components/themes/lyra/Lyra3CoversTheme.h | 24 -- .../themes/roundedraff/RoundedRaffTheme.cpp | 313 ---------------- .../themes/roundedraff/RoundedRaffTheme.h | 110 ------ test/test_text_settings_layout.py | 5 +- 59 files changed, 50 insertions(+), 1671 deletions(-) delete mode 100644 src/components/CoverGridHomeUi.cpp delete mode 100644 src/components/CoverGridHomeUi.h delete mode 100644 src/components/HomeCoverCache.cpp delete mode 100644 src/components/HomeCoverCache.h delete mode 100644 src/components/themes/lyra/Lyra3CoversTheme.cpp delete mode 100644 src/components/themes/lyra/Lyra3CoversTheme.h delete mode 100644 src/components/themes/roundedraff/RoundedRaffTheme.cpp delete mode 100644 src/components/themes/roundedraff/RoundedRaffTheme.h diff --git a/README.md b/README.md index 5479b689b38..ea3dc6a9ec5 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Check [our Devices page](https://crosspointreader.com/devices) for the full list - OPDS browser with saved servers (up to 8), search, pagination, and direct download; hold Back for one second and release in a catalog to return to the main menu - OTA update checks and installs from GitHub releases -- **Customization**: night mode, multiple themes (Classic, Lyra, Lyra Extended, RoundedRaff), sleep screen modes including transparent overlays, front/side button remapping, status bar controls, power-button behavior, refresh cadence, and more. +- **Customization**: night mode, sleep screen modes including transparent overlays, front/side button remapping, status bar controls, power-button behavior, refresh cadence, and more. - **Localization**: 34 UI languages and counting, including CJK font fallback and RTL support. @@ -57,8 +57,6 @@ Check [our Devices page](https://crosspointreader.com/devices) for the full list ### Coming soon: -- More themes. - - Much more! stay tuned. --- diff --git a/USER_GUIDE.md b/USER_GUIDE.md index 4a06bb8d473..ded4a89fe35 100644 --- a/USER_GUIDE.md +++ b/USER_GUIDE.md @@ -253,13 +253,6 @@ Settings are grouped into **System**, **Display**, **Reader**, **Controls**, **L - **Refresh Frequency**: Set how often the screen does a full refresh while reading to reduce ghosting; options are every 1, 5, 10, 15, or 30 pages. -- **UI Theme**: Set which UI theme to use: - - - "Classic" - The original Crosspoint theme - - "Lyra" - The new theme for Crosspoint featuring rounded elements and menu icons - - "Lyra Extended" - Lyra, but displays 3 books instead of 1 on the **[Home Screen](#31-home-screen)** - - "RoundedRaff" - A rounded theme with additional visual styling - - **Sunlight Fading Fix**: Configure whether to enable a software-fix for the issue where white X4 models may fade when used in direct sunlight: - "OFF" (default) - Disable the fix diff --git a/lib/I18n/translations/arabic.yaml b/lib/I18n/translations/arabic.yaml index 1ff6860a141..3867dfd7a44 100644 --- a/lib/I18n/translations/arabic.yaml +++ b/lib/I18n/translations/arabic.yaml @@ -305,11 +305,6 @@ STR_CLOCK_SYNC_FAIL: "فشلت المزامنة" STR_CLOCK_SYNC_NO_WIFI: "لا يوجد اتصال Wi-Fi" STR_CLOCK_SYNC_NO_WIFI_HINT: "اتصل بشبكة Wi-Fi أولا، ثم حاول مرة أخرى." STR_CLOCK_SYNCED: "تمت مزامنة الساعة" -STR_UI_THEME: "مظهر الواجهة" -STR_THEME_CLASSIC: "كلاسيكي" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_LYRA_EXTENDED: "Lyra موسع" STR_SUNLIGHT_FADING_FIX: "إصلاح بهتان الشاشة في الشمس" STR_REMAP_FRONT_BUTTONS: "تغيير وظائف الأزرار الأمامية" STR_BOOKMARKS: "الإشارات المرجعية" diff --git a/lib/I18n/translations/azerbaijani.yaml b/lib/I18n/translations/azerbaijani.yaml index 13f879cda50..9af37824ceb 100644 --- a/lib/I18n/translations/azerbaijani.yaml +++ b/lib/I18n/translations/azerbaijani.yaml @@ -430,11 +430,6 @@ STR_CLOCK_SYNC_FAIL: "Eyniləşmə baş tutmadı" STR_CLOCK_SYNC_NO_WIFI: "Wi-Fi qoşulmayıb" STR_CLOCK_SYNC_NO_WIFI_HINT: "Wi-Fi-a qoşul, yenidən yoxla." STR_CLOCK_SYNCED: "Saat eyniləşdirildi" -STR_UI_THEME: "İstifadəçi interfeysi mövzusu" -STR_THEME_CLASSIC: "Klassik" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_LYRA_EXTENDED: "Lyra Extended" STR_SUNLIGHT_FADING_FIX: "Gün işığında solmanı düzəltmək" STR_REMAP_FRONT_BUTTONS: "Ön düymələri yenidən təyin etmək" STR_BOOKMARKS: "Əlfəcinlər" @@ -598,7 +593,6 @@ STR_HOME_BUTTON_DOUBLE_TAP: "İki dəfə toxun" STR_HOME_BUTTON_LONG_PRESS: "Uzun bas" STR_TOGGLE_FRONTLIGHT: "Ön işığı dəyiş" -STR_THEME_COVER_GRID: "Üzlük toru" STR_WORD_SPACING: "Sözlərarası məsafə" STR_CHARACTER_SPACING: "Simvollararası məsafə" STR_SPACING_MINUS_2: "-2 px" diff --git a/lib/I18n/translations/belarusian.yaml b/lib/I18n/translations/belarusian.yaml index 295f6528f76..d9f9025c42c 100644 --- a/lib/I18n/translations/belarusian.yaml +++ b/lib/I18n/translations/belarusian.yaml @@ -253,11 +253,6 @@ STR_KEY_MODE_SYMBOLS: "?123" STR_KEY_MODE_ABC: "abc" STR_SLEEP_COVER_FILTER: "Фільтр экрана сну" STR_FILTER_CONTRAST: "Кантраст" -STR_UI_THEME: "Тэма інтэрфейсу" -STR_THEME_CLASSIC: "Класічная" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_LYRA_EXTENDED: "Lyra Extended" STR_SUNLIGHT_FADING_FIX: "Кампенсацыя выцвітання" STR_QUICK_RESUME_TIMEOUT: "Хуткае узнаўленне пасля таймаўту" STR_REMAP_FRONT_BUTTONS: "Пераназначыць пярэднія кнопкі" diff --git a/lib/I18n/translations/bosnian.yaml b/lib/I18n/translations/bosnian.yaml index 2eb706857d7..2450435c885 100644 --- a/lib/I18n/translations/bosnian.yaml +++ b/lib/I18n/translations/bosnian.yaml @@ -297,11 +297,6 @@ STR_CLOCK_SYNC_FAIL: "Sinhronizacija nije uspjela" STR_CLOCK_SYNC_NO_WIFI: "Wi-Fi nije povezan" STR_CLOCK_SYNC_NO_WIFI_HINT: "Prvo se poveži na Wi-Fi, pa pokušaj ponovo." STR_CLOCK_SYNCED: "Sat sinhronizovan" -STR_UI_THEME: "Tema korisničkog interfejsa" -STR_THEME_CLASSIC: "Klasična" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_LYRA_EXTENDED: "Lyra proširena" STR_SUNLIGHT_FADING_FIX: "Ispravka blijeđenja na suncu" STR_REMAP_FRONT_BUTTONS: "Premapiraj prednja dugmad" STR_BOOKMARKS: "Obilježivači" diff --git a/lib/I18n/translations/bulgarian.yaml b/lib/I18n/translations/bulgarian.yaml index ed80329a3ae..35677e35dfc 100644 --- a/lib/I18n/translations/bulgarian.yaml +++ b/lib/I18n/translations/bulgarian.yaml @@ -289,11 +289,6 @@ STR_CLOCK_SYNC_FAIL: "Неуспешна синхронизация" STR_CLOCK_SYNC_NO_WIFI: "Wi-Fi не е свързан" STR_CLOCK_SYNC_NO_WIFI_HINT: "Свържи се с Wi-Fi и опитай отново." STR_CLOCK_SYNCED: "Часовникът е синхронизиран" -STR_UI_THEME: "Тема на интерфейса" -STR_THEME_CLASSIC: "Класическа" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_LYRA_EXTENDED: "Lyra Extended" STR_SUNLIGHT_FADING_FIX: "Защита от избледняване при слънце" STR_REMAP_FRONT_BUTTONS: "Преназначаване на предните бутони" STR_BOOKMARKS: "Отметки" diff --git a/lib/I18n/translations/catalan.yaml b/lib/I18n/translations/catalan.yaml index 1c119e374e9..b2a62954689 100644 --- a/lib/I18n/translations/catalan.yaml +++ b/lib/I18n/translations/catalan.yaml @@ -370,10 +370,6 @@ STR_EXAMPLE_BOOK: "Títol del llibre" STR_PREVIEW: "Vista prèvia" STR_TITLE: "Títol" STR_BATTERY: "Bateria" -STR_UI_THEME: "Tema de la interfície" -STR_THEME_CLASSIC: "Clàssic" -STR_THEME_LYRA: "Lyra" -STR_THEME_LYRA_EXTENDED: "Lyra Ampliat" STR_SUNLIGHT_FADING_FIX: "Correcció de l'esvaïment pel sol" STR_QUICK_RESUME_TIMEOUT: "Represa ràpida per inactivitat" STR_REMAP_FRONT_BUTTONS: "Reassigna els botons frontals" @@ -485,8 +481,6 @@ STR_CLOCK_SYNC_FAIL: "Ha fallat la sincronització" STR_CLOCK_SYNC_NO_WIFI: "Wi-Fi no connectat" STR_CLOCK_SYNC_NO_WIFI_HINT: "Connecta't al Wi-Fi primer i torna-ho a provar." STR_CLOCK_SYNCED: "Rellotge sincronitzat" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_COVER_GRID: "Graella de portades" STR_SEARCH: "Cerca" STR_SET_SLEEP_COVER: "Fixa fons" STR_ADD_SERVER: "Afegeix servidor" diff --git a/lib/I18n/translations/czech.yaml b/lib/I18n/translations/czech.yaml index 76a9710b58b..9d522cb0793 100644 --- a/lib/I18n/translations/czech.yaml +++ b/lib/I18n/translations/czech.yaml @@ -220,11 +220,6 @@ STR_DIR_DOWN: "Dolů" STR_OK_BUTTON: "OK" STR_SLEEP_COVER_FILTER: "Filtr obrazovky spánku" STR_FILTER_CONTRAST: "Kontrast" -STR_UI_THEME: "Šablona rozhraní" -STR_THEME_CLASSIC: "Klasická" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_LYRA_EXTENDED: "Lyra Extended" STR_SUNLIGHT_FADING_FIX: "Oprava blednutí na slunci" STR_QUICK_RESUME_TIMEOUT: "Rychlé navázání po vypršení" STR_REMAP_FRONT_BUTTONS: "Přemapovat přední tlačítka" diff --git a/lib/I18n/translations/danish.yaml b/lib/I18n/translations/danish.yaml index 4f7a42ed963..159649dba45 100644 --- a/lib/I18n/translations/danish.yaml +++ b/lib/I18n/translations/danish.yaml @@ -241,10 +241,6 @@ STR_EXAMPLE_BOOK: "Bogtitel" STR_PREVIEW: "Forhåndsvisning" STR_TITLE: "Titel" STR_BATTERY: "Batteri" -STR_UI_THEME: "Brugergrænseflade tema" -STR_THEME_CLASSIC: "Klassisk" -STR_THEME_LYRA: "Lyra" -STR_THEME_LYRA_EXTENDED: "Lyra Extended" STR_SUNLIGHT_FADING_FIX: "Sollysfading-rettelse" STR_QUICK_RESUME_TIMEOUT: "Hurtig genoptagelse ved timeout" STR_REMAP_FRONT_BUTTONS: "Omtildel frontknapper" diff --git a/lib/I18n/translations/dutch.yaml b/lib/I18n/translations/dutch.yaml index d7830efb0ed..34f15cb2f05 100644 --- a/lib/I18n/translations/dutch.yaml +++ b/lib/I18n/translations/dutch.yaml @@ -241,10 +241,6 @@ STR_EXAMPLE_BOOK: "Boektitel" STR_PREVIEW: "Voorbeeld" STR_TITLE: "Titel" STR_BATTERY: "Batterij" -STR_UI_THEME: "UI Thema" -STR_THEME_CLASSIC: "Klassiek" -STR_THEME_LYRA: "Lyra" -STR_THEME_LYRA_EXTENDED: "Lyra Uitgebreid" STR_SUNLIGHT_FADING_FIX: "Zonlicht vervaging fix" STR_QUICK_RESUME_TIMEOUT: "Snel hervatten bij timeout" STR_REMAP_FRONT_BUTTONS: "Knoppen voorzijde wijzigen" diff --git a/lib/I18n/translations/english.yaml b/lib/I18n/translations/english.yaml index 1e1ba0a5f1f..3a4a3c3a4eb 100644 --- a/lib/I18n/translations/english.yaml +++ b/lib/I18n/translations/english.yaml @@ -443,11 +443,6 @@ STR_CLOCK_SYNC_FAIL: "Sync failed" STR_CLOCK_SYNC_NO_WIFI: "Wi-Fi not connected" STR_CLOCK_SYNC_NO_WIFI_HINT: "Connect to Wi-Fi first, then try again." STR_CLOCK_SYNCED: "Clock Synced" -STR_UI_THEME: "UI Theme" -STR_THEME_CLASSIC: "Classic" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_LYRA_EXTENDED: "Lyra Extended" STR_SUNLIGHT_FADING_FIX: "Sunlight Fading Fix" STR_REMAP_FRONT_BUTTONS: "Remap Front Buttons" STR_BOOKMARKS: "Bookmarks" @@ -613,7 +608,6 @@ STR_HOME_BUTTON_DOUBLE_TAP: "Double Tap" STR_HOME_BUTTON_LONG_PRESS: "Long Press" STR_TOGGLE_FRONTLIGHT: "Toggle Frontlight" -STR_THEME_COVER_GRID: "Cover Grid" STR_WORD_SPACING: "Word Spacing" STR_CHARACTER_SPACING: "Character Spacing" STR_SPACING_MINUS_2: "-2 px" diff --git a/lib/I18n/translations/finnish.yaml b/lib/I18n/translations/finnish.yaml index 97e35c65f4d..14003f7661e 100644 --- a/lib/I18n/translations/finnish.yaml +++ b/lib/I18n/translations/finnish.yaml @@ -218,10 +218,6 @@ STR_DIR_DOWN: "Alas" STR_OK_BUTTON: "OK" STR_SLEEP_COVER_FILTER: "Lepotilanäytön kansisuodatin" STR_FILTER_CONTRAST: "Kontrasti" -STR_UI_THEME: "Käyttöliittymäteema" -STR_THEME_CLASSIC: "Klassinen" -STR_THEME_LYRA: "Lyra" -STR_THEME_LYRA_EXTENDED: "Lyra Extended" STR_SUNLIGHT_FADING_FIX: "Auringonvalon haalistumiskorjaus" STR_QUICK_RESUME_TIMEOUT: "Pikajatko aikakatkaisulla" STR_REMAP_FRONT_BUTTONS: "Uudelleenmääritä etupainikkeet" diff --git a/lib/I18n/translations/french.yaml b/lib/I18n/translations/french.yaml index 983d218f849..32fafc8374d 100644 --- a/lib/I18n/translations/french.yaml +++ b/lib/I18n/translations/french.yaml @@ -344,11 +344,6 @@ STR_CLOCK_SYNC_FAIL: "Échec synchro" STR_CLOCK_SYNC_NO_WIFI: "Wi-Fi non connecté" STR_CLOCK_SYNC_NO_WIFI_HINT: "Connectez le Wi-Fi avant de réessayer." STR_CLOCK_SYNCED: "Horloge synchronisée" -STR_UI_THEME: "Thème interface" -STR_THEME_CLASSIC: "Classique" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_LYRA_EXTENDED: "Lyra Extended" STR_SUNLIGHT_FADING_FIX: "Correction lisibilité au soleil" STR_REMAP_FRONT_BUTTONS: "Configurer boutons façade" STR_BOOKMARKS: "Marque-pages" diff --git a/lib/I18n/translations/german.yaml b/lib/I18n/translations/german.yaml index 1524d248612..22c05d63ad4 100644 --- a/lib/I18n/translations/german.yaml +++ b/lib/I18n/translations/german.yaml @@ -470,11 +470,6 @@ STR_TAP_ONLY: "Nur Tippen" STR_TAP_TO_RETRY: "Tippen zum Wiederholen" STR_TEXT_AA: "Schriftglättung" STR_TEXT_SETTINGS: "Texteinstellungen" -STR_THEME_CLASSIC: "Klassisch" -STR_THEME_COVER_GRID: "Cover Raster" -STR_THEME_LYRA_EXTENDED: "Lyra Extended" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" STR_TILT_PAGE_TURN: "Neigen zum Blättern" STR_TIME_TO_SLEEP: "Standby-Modus nach" STR_TIMEZONE: "Zeitzone" @@ -488,7 +483,6 @@ STR_TOP: "Oben" STR_TOUCH_READER_CONTROLS: "Touch-Steuerung beim Lesen" STR_TOUCH_TOGGLE: "Touch" STR_TRANSPARENT: "Transparent" -STR_UI_THEME: "System-Design" STR_UNASSIGNED: "Leer" STR_UPDATE_ALL: "Alle updaten" STR_UPDATE_AVAILABLE: "Update" diff --git a/lib/I18n/translations/hebrew.yaml b/lib/I18n/translations/hebrew.yaml index bc62cf7ea14..04f9b162523 100644 --- a/lib/I18n/translations/hebrew.yaml +++ b/lib/I18n/translations/hebrew.yaml @@ -411,11 +411,6 @@ STR_BATTERY: "סוללה" STR_XTC_STATUS_BAR: "שורת מצב XTC" STR_BOTTOM: "למטה" STR_TOP: "למעלה" -STR_UI_THEME: "ערכת נושא" -STR_THEME_CLASSIC: "קלאסי" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_LYRA_EXTENDED: "Lyra מורחב" STR_SUNLIGHT_FADING_FIX: "תיקון דהיית מסך בשמש" STR_REMAP_FRONT_BUTTONS: "שנה תפקיד ללחצנים קדמיים" STR_OPDS_BROWSER: "דפדפן OPDS" @@ -618,7 +613,6 @@ STR_HOME_BUTTON_DOUBLE_TAP: "הקשה כפולה" STR_HOME_BUTTON_LONG_PRESS: "לחיצה ארוכה" STR_TOGGLE_FRONTLIGHT: "הדלק/כבה תאורה קדמית" -STR_THEME_COVER_GRID: "רשת כריכות" STR_WORD_SPACING: "מרווח בין מילים" STR_CHARACTER_SPACING: "מרווח בין תווים" STR_SPACING_MINUS_2: "-2 px" diff --git a/lib/I18n/translations/hungarian.yaml b/lib/I18n/translations/hungarian.yaml index 400fc7ab44f..3a2ab14863a 100644 --- a/lib/I18n/translations/hungarian.yaml +++ b/lib/I18n/translations/hungarian.yaml @@ -298,11 +298,6 @@ STR_CLOCK_SYNC_FAIL: "Szinkronizálás sikertelen" STR_CLOCK_SYNC_NO_WIFI: "Wi-Fi nincs csatlakoztatva" STR_CLOCK_SYNC_NO_WIFI_HINT: "Először csatlakozz Wi-Fi-hez, majd próbáld újra." STR_CLOCK_SYNCED: "Óra szinkronizálva" -STR_UI_THEME: "Felhasználói felület téma" -STR_THEME_CLASSIC: "Klasszikus" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_LYRA_EXTENDED: "Lyra Extended" STR_SUNLIGHT_FADING_FIX: "Napfény halványulás javítás" STR_REMAP_FRONT_BUTTONS: "Elülső gombok átállítása" STR_BOOKMARKS: "Könyvjelzők" diff --git a/lib/I18n/translations/indonesia.yaml b/lib/I18n/translations/indonesia.yaml index e6983dde59c..e0380dd87fe 100644 --- a/lib/I18n/translations/indonesia.yaml +++ b/lib/I18n/translations/indonesia.yaml @@ -298,11 +298,6 @@ STR_CLOCK_SYNC_FAIL: "Sinkronisasi gagal" STR_CLOCK_SYNC_NO_WIFI: "Wi-Fi tidak terhubung" STR_CLOCK_SYNC_NO_WIFI_HINT: "Hubungkan ke Wi-Fi terlebih dahulu, lalu coba lagi." STR_CLOCK_SYNCED: "Jam Tersinkronisasi" -STR_UI_THEME: "Tema UI" -STR_THEME_CLASSIC: "Klasik" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_LYRA_EXTENDED: "Lyra Extended" STR_SUNLIGHT_FADING_FIX: "Koreksi Pemudaran Matahari" STR_REMAP_FRONT_BUTTONS: "Pemetaan Ulang Tombol Depan" STR_BOOKMARKS: "Pembatas Buku" diff --git a/lib/I18n/translations/italian.yaml b/lib/I18n/translations/italian.yaml index 3b400bee483..a52ef969e46 100644 --- a/lib/I18n/translations/italian.yaml +++ b/lib/I18n/translations/italian.yaml @@ -603,11 +603,6 @@ STR_TAP_TO_RETRY: "Tocca per riprovare" STR_TEXT_AA: "Anti-aliasing testo" STR_TEXT_AA_NO_PREVIEW: "Anti-aliasing testo (senza anteprima)" STR_TEXT_SETTINGS: "Impostazioni testo" -STR_THEME_CLASSIC: "Classico" -STR_THEME_COVER_GRID: "Griglia copertine" -STR_THEME_LYRA: "Lyra" -STR_THEME_LYRA_EXTENDED: "Lyra esteso" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" STR_TILT_PAGE_TURN: "Inclina per cambio pagina" STR_TIME_TO_SLEEP: "Timeout sospensione" STR_TIMEZONE: "Fuso orario" @@ -623,7 +618,6 @@ STR_TOP: "Alto" STR_TOUCH_READER_CONTROLS: "Controlli touch durante la lettura" STR_TOUCH_TOGGLE: "Touch" STR_TRANSPARENT: "Trasparente" -STR_UI_THEME: "Tema interfaccia" STR_UNASSIGNED: "Non assegnato" STR_UNNAMED: "Senza nome" STR_UPDATE: "Aggiorna" diff --git a/lib/I18n/translations/kazakh.yaml b/lib/I18n/translations/kazakh.yaml index c6066b3c678..29fe5e8c256 100644 --- a/lib/I18n/translations/kazakh.yaml +++ b/lib/I18n/translations/kazakh.yaml @@ -214,10 +214,6 @@ STR_DIR_DOWN: "Төмен" STR_OK_BUTTON: "ОК" STR_SLEEP_COVER_FILTER: "Ұйқы экраны мұқаба сүзгісі" STR_FILTER_CONTRAST: "Контраст" -STR_UI_THEME: "Интерфейс тақырыбы" -STR_THEME_CLASSIC: "Классикалық" -STR_THEME_LYRA: "Lyra" -STR_THEME_LYRA_EXTENDED: "Lyra кеңейтілген" STR_SUNLIGHT_FADING_FIX: "Күн сәулесінен солу түзету" STR_QUICK_RESUME_TIMEOUT: "Таймауттан кейін жылдам жалғастыру" STR_REMAP_FRONT_BUTTONS: "Алдыңғы түймелерді қайта баптау" @@ -388,7 +384,6 @@ STR_CLOCK_SYNC_FAIL: "Синхрондау сәтсіз" STR_CLOCK_SYNC_NO_WIFI: "Wi-Fi қосылмаған" STR_CLOCK_SYNC_NO_WIFI_HINT: "Алдымен Wi-Fi желісіне қосылып, қайта көріңіз." STR_CLOCK_SYNCED: "Сағат синхрондалды" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" STR_BOOKMARKS: "Бетбелгілер" STR_BOOKMARK_ADDED: "Бетбелгі қосылды." STR_SEARCH: "Іздеу" diff --git a/lib/I18n/translations/lithuanian.yaml b/lib/I18n/translations/lithuanian.yaml index 93ed76a9eb8..72b90a797bd 100644 --- a/lib/I18n/translations/lithuanian.yaml +++ b/lib/I18n/translations/lithuanian.yaml @@ -298,11 +298,6 @@ STR_CLOCK_SYNC_FAIL: "Sinchr. nepavyko" STR_CLOCK_SYNC_NO_WIFI: "Nėra Wi-Fi" STR_CLOCK_SYNC_NO_WIFI_HINT: "Pirma prisijunkite prie Wi-Fi." STR_CLOCK_SYNCED: "Laikas sinchronizuotas" -STR_UI_THEME: "UI tema" -STR_THEME_CLASSIC: "Klasikinė" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_LYRA_EXTENDED: "Lyra Ext." STR_SUNLIGHT_FADING_FIX: "Blyškumo pataisa" STR_REMAP_FRONT_BUTTONS: "Keisti mygtukus" STR_BOOKMARKS: "Žymės" diff --git a/lib/I18n/translations/norwegian.yaml b/lib/I18n/translations/norwegian.yaml index 1b3da76296f..84b9f285e32 100644 --- a/lib/I18n/translations/norwegian.yaml +++ b/lib/I18n/translations/norwegian.yaml @@ -298,11 +298,6 @@ STR_CLOCK_SYNC_FAIL: "Synkronisering mislyktes" STR_CLOCK_SYNC_NO_WIFI: "WiFi ikke tilkoblet" STR_CLOCK_SYNC_NO_WIFI_HINT: "Koble til WiFi først, og prøv igjen." STR_CLOCK_SYNCED: "Klokke synkronisert" -STR_UI_THEME: "Grensesnittstema" -STR_THEME_CLASSIC: "Klassisk" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_LYRA_EXTENDED: "Lyra Extended" STR_SUNLIGHT_FADING_FIX: "Retting for soluttoning" STR_REMAP_FRONT_BUTTONS: "Tilordne frontknapper på nytt" STR_BOOKMARKS: "Bokmerker" diff --git a/lib/I18n/translations/orangutan.yaml b/lib/I18n/translations/orangutan.yaml index f15e471cb32..e8f048a493b 100644 --- a/lib/I18n/translations/orangutan.yaml +++ b/lib/I18n/translations/orangutan.yaml @@ -240,11 +240,6 @@ STR_CLOCK_SYNC_OK: "Oook!" STR_CLOCK_SYNC_FAIL: "OOk?" STR_CLOCK_SYNC_NO_WIFI: "Wi-Fi OOK" STR_CLOCK_SYNCED: "Oooook" -STR_UI_THEME: "OOk OOK" -STR_THEME_CLASSIC: "Oook!" -STR_THEME_LYRA: "OOk!" -STR_THEME_ROUNDEDRAFF: "Oook" -STR_THEME_LYRA_EXTENDED: "Oook OOK" STR_SUNLIGHT_FADING_FIX: "Oook OOK" STR_REMAP_FRONT_BUTTONS: "Oook OOK" diff --git a/lib/I18n/translations/persian.yaml b/lib/I18n/translations/persian.yaml index 11075442c39..6522932022c 100644 --- a/lib/I18n/translations/persian.yaml +++ b/lib/I18n/translations/persian.yaml @@ -315,11 +315,6 @@ STR_CLOCK_SYNC_FAIL: "همگام‌سازی ناموفق بود" STR_CLOCK_SYNC_NO_WIFI: "وای‌فای متصل نیست" STR_CLOCK_SYNC_NO_WIFI_HINT: "اول به وای‌فای وصل شوید و دوباره تلاش کنید." STR_CLOCK_SYNCED: "ساعت با موفقیت همگام شد" -STR_UI_THEME: "ظاهر رابط کاربری" -STR_THEME_CLASSIC: "کلاسیک" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_LYRA_EXTENDED: "Lyra Extended" STR_SUNLIGHT_FADING_FIX: "رفع محوشدن صفحه زیر نور خورشید" STR_REMAP_FRONT_BUTTONS: "تغییر کارکرد دکمه‌های جلو" STR_BOOKMARKS: "نشانک‌ها" diff --git a/lib/I18n/translations/polish.yaml b/lib/I18n/translations/polish.yaml index 005c77092d6..3875ec9a4a4 100644 --- a/lib/I18n/translations/polish.yaml +++ b/lib/I18n/translations/polish.yaml @@ -380,11 +380,6 @@ STR_CLOCK_SYNC_FAIL: "Błąd synchronizacji" STR_CLOCK_SYNC_NO_WIFI: "Brak połączenia z Wi-Fi" STR_CLOCK_SYNC_NO_WIFI_HINT: "Najpierw połącz się z Wi-Fi, potem spróbuj ponownie." STR_CLOCK_SYNCED: "Zegar zsynchronizowany" -STR_UI_THEME: "Motyw interfejsu" -STR_THEME_CLASSIC: "Classic" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_LYRA_EXTENDED: "Lyra Extended" STR_SUNLIGHT_FADING_FIX: "Przeciwdziałanie blaknięciu od słońca" STR_REMAP_FRONT_BUTTONS: "Przypisz przednie przyciski" STR_BOOKMARKS: "Zakładki" @@ -541,7 +536,6 @@ STR_HOME_BUTTON_DOUBLE_TAP: "Podwójne naciśnięcie" STR_HOME_BUTTON_LONG_PRESS: "Długie naciśnięcie" STR_TOGGLE_FRONTLIGHT: "Włącz/wyłącz podświetlenie" -STR_THEME_COVER_GRID: "Siatka okładek" STR_WORD_SPACING: "Odstępy między wyrazami" STR_CHARACTER_SPACING: "Odstępy między znakami" STR_SPACING_MINUS_2: "-2 px" diff --git a/lib/I18n/translations/portuguese-BR.yaml b/lib/I18n/translations/portuguese-BR.yaml index 4aac2111f36..9485a7d84a8 100644 --- a/lib/I18n/translations/portuguese-BR.yaml +++ b/lib/I18n/translations/portuguese-BR.yaml @@ -351,11 +351,6 @@ STR_CLOCK_SYNC_FAIL: "Falha na sincronização" STR_CLOCK_SYNC_NO_WIFI: "Wi-Fi não conectado" STR_CLOCK_SYNC_NO_WIFI_HINT: "Conecte ao Wi-Fi primeiro, depois tente novamente." STR_CLOCK_SYNCED: "Relógio sincronizado" -STR_UI_THEME: "Tema" -STR_THEME_CLASSIC: "Clássico" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_LYRA_EXTENDED: "Lyra Estendido" STR_SUNLIGHT_FADING_FIX: "Ajuste desbotamento ao sol" STR_REMAP_FRONT_BUTTONS: "Remapear botões frontais" STR_BOOKMARKS: "Marcadores" @@ -512,7 +507,6 @@ STR_HOME_BUTTON_DOUBLE_TAP: "Toque duplo" STR_HOME_BUTTON_LONG_PRESS: "Pressionar e segurar" STR_TOGGLE_FRONTLIGHT: "Alternar luz frontal" -STR_THEME_COVER_GRID: "Grade de capas" STR_WORD_SPACING: "Espaçamento entre palavras" STR_CHARACTER_SPACING: "Espaçamento entre caracteres" STR_SPACING_MINUS_2: "-2 px" diff --git a/lib/I18n/translations/portuguese-PT.yaml b/lib/I18n/translations/portuguese-PT.yaml index d177cf7299f..4102aecc4cb 100644 --- a/lib/I18n/translations/portuguese-PT.yaml +++ b/lib/I18n/translations/portuguese-PT.yaml @@ -351,11 +351,6 @@ STR_CLOCK_SYNC_FAIL: "Falha na sincronização" STR_CLOCK_SYNC_NO_WIFI: "Wi-Fi não ligado" STR_CLOCK_SYNC_NO_WIFI_HINT: "Ligue-se primeiro ao Wi-Fi e, em seguida, tente novamente." STR_CLOCK_SYNCED: "Relógio sincronizado" -STR_UI_THEME: "Tema da interface" -STR_THEME_CLASSIC: "Clássico" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_LYRA_EXTENDED: "Lyra Extended" STR_SUNLIGHT_FADING_FIX: "Ajuste de desbotamento ao sol" STR_REMAP_FRONT_BUTTONS: "Remapear botões frontais" STR_BOOKMARKS: "Marcadores" @@ -512,7 +507,6 @@ STR_HOME_BUTTON_DOUBLE_TAP: "Toque duplo" STR_HOME_BUTTON_LONG_PRESS: "Toque longo" STR_TOGGLE_FRONTLIGHT: "Alternar luz frontal" -STR_THEME_COVER_GRID: "Grade de capas" STR_WORD_SPACING: "Espaçamento entre palavras" STR_CHARACTER_SPACING: "Espaçamento entre caracteres" STR_SPACING_MINUS_2: "-2 px" diff --git a/lib/I18n/translations/romanian.yaml b/lib/I18n/translations/romanian.yaml index 0fcc22e0575..f5929d34ce1 100644 --- a/lib/I18n/translations/romanian.yaml +++ b/lib/I18n/translations/romanian.yaml @@ -241,10 +241,6 @@ STR_EXAMPLE_BOOK: "Titlul cărţii" STR_PREVIEW: "Previzualizare" STR_TITLE: "Titlu" STR_BATTERY: "Baterie" -STR_UI_THEME: "Tema UI" -STR_THEME_CLASSIC: "Clasic" -STR_THEME_LYRA: "Lyra" -STR_THEME_LYRA_EXTENDED: "Lyra Extended" STR_SUNLIGHT_FADING_FIX: "Corecţie estompare lumină" STR_QUICK_RESUME_TIMEOUT: "Reluare rapidă la timeout" STR_REMAP_FRONT_BUTTONS: "Remapare butoane frontale" diff --git a/lib/I18n/translations/russian.yaml b/lib/I18n/translations/russian.yaml index 0ba6776023c..0d7e2d81155 100644 --- a/lib/I18n/translations/russian.yaml +++ b/lib/I18n/translations/russian.yaml @@ -427,11 +427,6 @@ STR_CLOCK_SYNC_FAIL: "Ошибка синхронизации" STR_CLOCK_SYNC_NO_WIFI: "Wi-Fi не подключён" STR_CLOCK_SYNC_NO_WIFI_HINT: "Подключите Wi-Fi и попробуйте снова." STR_CLOCK_SYNCED: "Выполнено" -STR_UI_THEME: "Тема интерфейса" -STR_THEME_CLASSIC: "Классическая" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_LYRA_EXTENDED: "Lyra Extended" STR_SUNLIGHT_FADING_FIX: "Компенсация выцветания" STR_REMAP_FRONT_BUTTONS: "Переназначить передние кнопки" STR_BOOKMARKS: "Закладки" @@ -593,7 +588,6 @@ STR_HOME_BUTTON_TAP: "Нажатие" STR_HOME_BUTTON_DOUBLE_TAP: "Двойное нажатие" STR_HOME_BUTTON_LONG_PRESS: "Долгое нажатие" STR_TOGGLE_FRONTLIGHT: "Вкл./выкл. подсветку" -STR_THEME_COVER_GRID: "Сетка обложек" STR_WORD_SPACING: "Межсловный интервал" STR_CHARACTER_SPACING: "Межбуквенный интервал" STR_SPACING_MINUS_2: "-2 px" diff --git a/lib/I18n/translations/slovak.yaml b/lib/I18n/translations/slovak.yaml index 17ea2062439..07830ad329d 100644 --- a/lib/I18n/translations/slovak.yaml +++ b/lib/I18n/translations/slovak.yaml @@ -298,11 +298,6 @@ STR_CLOCK_SYNC_FAIL: "Synchronizácia zlyhala" STR_CLOCK_SYNC_NO_WIFI: "Wi-Fi nie je pripojená" STR_CLOCK_SYNC_NO_WIFI_HINT: "Najprv sa pripojte k Wi-Fi a potom skúste znova." STR_CLOCK_SYNCED: "Hodiny synchronizované" -STR_UI_THEME: "Téma rozhrania" -STR_THEME_CLASSIC: "Klasická" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_LYRA_EXTENDED: "Lyra Extended" STR_SUNLIGHT_FADING_FIX: "Oprava blednutia na slnku" STR_REMAP_FRONT_BUTTONS: "Premapovať predné tlačidlá" STR_BOOKMARKS: "Záložky" diff --git a/lib/I18n/translations/slovenian.yaml b/lib/I18n/translations/slovenian.yaml index 1a64e696a4c..0c35d2a3341 100644 --- a/lib/I18n/translations/slovenian.yaml +++ b/lib/I18n/translations/slovenian.yaml @@ -298,11 +298,6 @@ STR_CLOCK_SYNC_FAIL: "Sinhronizacija ni uspela" STR_CLOCK_SYNC_NO_WIFI: "Wi-Fi ni povezan" STR_CLOCK_SYNC_NO_WIFI_HINT: "Najprej se poveži z Wi-Fi, nato poskusi znova." STR_CLOCK_SYNCED: "Ura sinhronizirana" -STR_UI_THEME: "Tema vmesnika" -STR_THEME_CLASSIC: "Klasična" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_LYRA_EXTENDED: "Lyra razširjena" STR_SUNLIGHT_FADING_FIX: "Popravek bledenja na soncu" STR_REMAP_FRONT_BUTTONS: "Prerazporedi sprednje gumbe" STR_BOOKMARKS: "Zaznamki" diff --git a/lib/I18n/translations/spanish.yaml b/lib/I18n/translations/spanish.yaml index 6d2c28f4301..dc86d29c3e0 100644 --- a/lib/I18n/translations/spanish.yaml +++ b/lib/I18n/translations/spanish.yaml @@ -391,12 +391,6 @@ STR_CLOCK_SYNC_FAIL: "Falló la sincronización" STR_CLOCK_SYNC_NO_WIFI: "Wi-Fi no conectado" STR_CLOCK_SYNC_NO_WIFI_HINT: "Conéctese primero al Wi-Fi y vuelva a intentarlo." STR_CLOCK_SYNCED: "Reloj sincronizado" -STR_UI_THEME: "Interfaz" -STR_THEME_CLASSIC: "Clásico" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_COVER_GRID: "Cuadrícula de portadas" -STR_THEME_LYRA_EXTENDED: "Lyra Extendido" STR_SUNLIGHT_FADING_FIX: "Corrección de desvanecimiento" STR_QUICK_RESUME_TIMEOUT: "Reanudación rápida tras tiempo" STR_REMAP_FRONT_BUTTONS: "Reconfigurar botones frontales" diff --git a/lib/I18n/translations/swedish.yaml b/lib/I18n/translations/swedish.yaml index 1ceca85bd54..58a419bdace 100644 --- a/lib/I18n/translations/swedish.yaml +++ b/lib/I18n/translations/swedish.yaml @@ -427,11 +427,6 @@ STR_CLOCK_SYNC_FAIL: "Synkronisering misslyckades" STR_CLOCK_SYNC_NO_WIFI: "WiFi inte ansluten" STR_CLOCK_SYNC_NO_WIFI_HINT: "Anslut till WiFi först, försök sedan igen." STR_CLOCK_SYNCED: "Klocka synkroniserad" -STR_UI_THEME: "Användargränssnittstema" -STR_THEME_CLASSIC: "Klassisk" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_LYRA_EXTENDED: "Lyra utökad" STR_SUNLIGHT_FADING_FIX: "Fix för solskensmattning" STR_REMAP_FRONT_BUTTONS: "Ändra frontknappar" STR_BOOKMARKS: "Bokmärken" @@ -594,7 +589,6 @@ STR_HOME_BUTTON_DOUBLE_TAP: "Dubbeltryck" STR_HOME_BUTTON_LONG_PRESS: "Långtryck" STR_TOGGLE_FRONTLIGHT: "Slå på/av frontbelysning" -STR_THEME_COVER_GRID: "Omslagsrutnät" STR_WORD_SPACING: "Ordavstånd" STR_CHARACTER_SPACING: "Teckenavstånd" STR_SPACING_MINUS_2: "-2 px" diff --git a/lib/I18n/translations/turkish.yaml b/lib/I18n/translations/turkish.yaml index b9ff55f1be2..34da28e512b 100644 --- a/lib/I18n/translations/turkish.yaml +++ b/lib/I18n/translations/turkish.yaml @@ -243,10 +243,6 @@ STR_KEY_MODE_SYMBOLS: "?123" STR_KEY_MODE_ABC: "abc" STR_SLEEP_COVER_FILTER: "Uyku Ekranı Kapak Filtresi" STR_FILTER_CONTRAST: "Kontrast" -STR_UI_THEME: "Arayüz Teması" -STR_THEME_CLASSIC: "Klasik" -STR_THEME_LYRA: "Lyra" -STR_THEME_LYRA_EXTENDED: "Lyra Genişletilmiş" STR_SUNLIGHT_FADING_FIX: "Güneş Işığı Solma Düzeltmesi" STR_QUICK_RESUME_TIMEOUT: "Zaman aşımında Hızlı Devam" STR_REMAP_FRONT_BUTTONS: "Ön Tuşları Yeniden Ata" @@ -440,7 +436,6 @@ STR_SELECT_FIRMWARE_FILE: "Firmware dosyası seçin (.bin)" STR_SERVER_NAME: "Sunucu Adı" STR_SET_SLEEP_COVER: "Kapak Ayarla" STR_SHOW_NETWORKS: "Göster" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" STR_TOP: "Üst" STR_UPDATE_ALL: "Tümünü Güncelle" STR_UPDATE_AVAILABLE: "Güncelle" diff --git a/lib/I18n/translations/ukrainian.yaml b/lib/I18n/translations/ukrainian.yaml index 67625e228da..7ad090dff9e 100644 --- a/lib/I18n/translations/ukrainian.yaml +++ b/lib/I18n/translations/ukrainian.yaml @@ -296,11 +296,6 @@ STR_CLOCK_SYNC_FAIL: "Невдала синхр. " STR_CLOCK_SYNC_NO_WIFI: "Wi-Fi не під'єднано" STR_CLOCK_SYNC_NO_WIFI_HINT: "Під'єднайтесь спершу до Wi-Fi, тоді спробуйте знову." STR_CLOCK_SYNCED: "Годинник синхр." -STR_UI_THEME: "Тема інтерфейсу" -STR_THEME_CLASSIC: "Класична" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_LYRA_EXTENDED: "Lyra Extended" STR_SUNLIGHT_FADING_FIX: "Виправлення вицвітання на сонці" STR_REMAP_FRONT_BUTTONS: "Налаштувати передні кнопки" STR_BOOKMARKS: "Закладки" diff --git a/lib/I18n/translations/valencian.yaml b/lib/I18n/translations/valencian.yaml index 771b448efa1..9684e5ac490 100644 --- a/lib/I18n/translations/valencian.yaml +++ b/lib/I18n/translations/valencian.yaml @@ -376,10 +376,6 @@ STR_EXAMPLE_BOOK: "Títol del llibre" STR_PREVIEW: "Vista prèvia" STR_TITLE: "Títol" STR_BATTERY: "Bateria" -STR_UI_THEME: "Tema de la interfície" -STR_THEME_CLASSIC: "Clàssic" -STR_THEME_LYRA: "Lyra" -STR_THEME_LYRA_EXTENDED: "Lyra Ampliat" STR_SUNLIGHT_FADING_FIX: "Correcció de l'esvaïment pel sol" STR_REMAP_FRONT_BUTTONS: "Reassigna els botons frontals" STR_BOOKMARKS: "Punts de llibre" @@ -486,8 +482,6 @@ STR_CLOCK_SYNC_FAIL: "Ha fallat la sincronització" STR_CLOCK_SYNC_NO_WIFI: "Wi-Fi no connectat" STR_CLOCK_SYNC_NO_WIFI_HINT: "Connecta't al Wi-Fi primer i torna-ho a provar." STR_CLOCK_SYNCED: "Rellotge sincronitzat" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_COVER_GRID: "Graella de portades" STR_SEARCH: "Busca" STR_SET_SLEEP_COVER: "Fixa fons" STR_ADD_SERVER: "Afig servidor" diff --git a/lib/I18n/translations/vietnamese.yaml b/lib/I18n/translations/vietnamese.yaml index 98fd80371cb..3cccb990e2e 100644 --- a/lib/I18n/translations/vietnamese.yaml +++ b/lib/I18n/translations/vietnamese.yaml @@ -438,11 +438,6 @@ STR_CLOCK_SYNC_FAIL: "Đồng bộ thất bại" STR_CLOCK_SYNC_NO_WIFI: "Chưa kết nối Wi-Fi" STR_CLOCK_SYNC_NO_WIFI_HINT: "Hãy kết nối Wi-Fi trước, rồi thử lại." STR_CLOCK_SYNCED: "Đã đồng bộ đồng hồ" -STR_UI_THEME: "Giao diện" -STR_THEME_CLASSIC: "Cổ điển" -STR_THEME_LYRA: "Lyra" -STR_THEME_ROUNDEDRAFF: "RoundedRaff" -STR_THEME_LYRA_EXTENDED: "Lyra mở rộng" STR_SUNLIGHT_FADING_FIX: "Khắc phục mờ dưới nắng" STR_REMAP_FRONT_BUTTONS: "Gán lại nút mặt trước" STR_BOOKMARKS: "Dấu trang" @@ -607,7 +602,6 @@ STR_HOME_BUTTON_DOUBLE_TAP: "Chạm đúp" STR_HOME_BUTTON_LONG_PRESS: "Nhấn giữ" STR_TOGGLE_FRONTLIGHT: "Bật/Tắt đèn nền" -STR_THEME_COVER_GRID: "Lưới bìa sách" STR_WORD_SPACING: "Khoảng cách từ" STR_CHARACTER_SPACING: "Khoảng cách chữ" STR_SPACING_MINUS_2: "-2 px" diff --git a/src/CrossPointSettings.h b/src/CrossPointSettings.h index 763fa7492f4..ef6b2bec693 100644 --- a/src/CrossPointSettings.h +++ b/src/CrossPointSettings.h @@ -204,9 +204,6 @@ class CrossPointSettings : public PersistableStore { LONG_PRESS_BUTTON_BEHAVIOR_COUNT }; - // UI Theme - enum UI_THEME { CLASSIC = 0, LYRA = 1, LYRA_3_COVERS = 2, ROUNDEDRAFF = 3, COVER_GRID = 4 }; - // Image rendering in EPUB reader. IMAGES_DISPLAY_BW lays images out like // IMAGES_DISPLAY but draws them as a B/W dither, so image pages skip the // extra grayscale refresh. @@ -355,8 +352,6 @@ class CrossPointSettings : public PersistableStore { // Long-press Confirm function in EPUB reader (cycles through LONG_PRESS_MENU_FUNCTION values). // Defaults to Disabled so shortcut-based bookmark toggling remains opt-in. uint8_t longPressMenuFunction = LP_MENU_DISABLED; - // UI Theme - uint8_t uiTheme = LYRA; // Sunlight fading compensation uint8_t fadingFix = 0; // The fading fix compensates the X4/X3 grayscale waveforms; other boards never get it. diff --git a/src/SettingsList.cpp b/src/SettingsList.cpp index 0c01f586037..f7ac566348c 100644 --- a/src/SettingsList.cpp +++ b/src/SettingsList.cpp @@ -49,8 +49,6 @@ void forEachBaseSetting(SettingVisitor visit, void* context) { {StrId::STR_PAGES_1, StrId::STR_PAGES_5, StrId::STR_PAGES_10, StrId::STR_PAGES_15, StrId::STR_PAGES_30, StrId::STR_NEVER}, "refreshFrequency", StrId::STR_CAT_DISPLAY)); - emit(SettingInfo::Enum(StrId::STR_UI_THEME, &CrossPointSettings::uiTheme, homeThemeValues(), "uiTheme", - StrId::STR_CAT_DISPLAY)); if (!BoardConfig::hasTouch()) { auto fadingFix = SettingInfo::Toggle(StrId::STR_SUNLIGHT_FADING_FIX, &CrossPointSettings::fadingFix, "fadingFix", StrId::STR_CAT_DISPLAY); diff --git a/src/SettingsList.h b/src/SettingsList.h index d64f0604954..b54bc1e1d49 100644 --- a/src/SettingsList.h +++ b/src/SettingsList.h @@ -276,13 +276,6 @@ inline SettingInfo buildDoublePowerButtonSetting() { "doublePwrBtn", StrId::STR_CAT_CONTROLS); } -inline std::vector homeThemeValues() { - static constexpr StrId VALUES[] = {StrId::STR_THEME_CLASSIC, StrId::STR_THEME_LYRA, StrId::STR_THEME_LYRA_EXTENDED, - StrId::STR_THEME_ROUNDEDRAFF, StrId::STR_THEME_COVER_GRID}; - const size_t count = UITheme::supportsCoverGrid() ? std::size(VALUES) : std::size(VALUES) - 1; - return {VALUES, VALUES + count}; -} - using SettingVisitor = void (*)(void* context, SettingInfo& info); // Visits synchronously in list order. Borrowed references are valid only during diff --git a/src/activities/UiTabListActivity.cpp b/src/activities/UiTabListActivity.cpp index 17c0d241957..b03bb1f2629 100644 --- a/src/activities/UiTabListActivity.cpp +++ b/src/activities/UiTabListActivity.cpp @@ -118,24 +118,14 @@ void UiTabListActivity::buildTabBar(UiScreen& screen) { tabProps.inputMask = fui::InputTouch; // Pill shape and label size are theme-driven. Lyra uses equal-width slots // with small labels so wide text (e.g. "Controls") still fits at large UI scales. - // Full-slot (RoundedRaff): the pill fills its slot like the legacy layout - // (slot minus a 4px frame, 8px clearance above the divider) with - // body-size labels; zero horizontal contentInset disables the tabBar's - // label-width shrink. const bool tabsFocused = ringPos() == 0; - if (metrics.tabPillFullSlot) { - tabProps.text = screen.theme().bodyText; - tabProps.tabInset = fui::Insets{4, 4, 7, 4}; - tabProps.contentInset = fui::Insets{2, 0, 2, 0}; - } else { - tabProps.text = screen.theme().smallText; - tabProps.gap = static_cast(metrics.tabSpacing); - // Unfocused state: no bottom inset, so the pill (and the 2px selected - // underline drawn along its bottom edge) reaches the band's 1px divider — - // legacy Lyra drew the underline sitting on that rule, not floating above. - tabProps.tabInset = tabsFocused ? fui::Insets{2, 4, 4, 4} : fui::Insets{2, 4, 0, 4}; - tabProps.contentInset = fui::Insets{2, 0, 2, 0}; - } + tabProps.text = screen.theme().smallText; + tabProps.gap = static_cast(metrics.tabSpacing); + // Unfocused state: no bottom inset, so the pill (and the 2px selected + // underline drawn along its bottom edge) reaches the band's 1px divider - + // legacy Lyra drew the underline sitting on that rule, not floating above. + tabProps.tabInset = tabsFocused ? fui::Insets{2, 4, 4, 4} : fui::Insets{2, 4, 0, 4}; + tabProps.contentInset = fui::Insets{2, 0, 2, 0}; const int16_t tabLineHeight = screen.target().lineHeight(tabProps.text.font); const int16_t preferredTabHeight = mappedInput.hasTouch() ? TOUCH_TAB_BAR_HEIGHT : static_cast(metrics.tabBarHeight); @@ -163,12 +153,6 @@ void UiTabListActivity::buildTabBar(UiScreen& screen) { tabStyles.selected.background = fui::Paint::solid(fui::Color::Black); tabStyles.selected.foreground = fui::Paint::solid(fui::Color::White); tabStyles.selected.radius = screen.theme().listRowRadius; - } else if (metrics.tabPillFullSlot) { - // Legacy RoundedRaff unfocused treatment: same pill, dimmed to dark gray, - // text stays inverted; no underline. - tabStyles.selected.background = fui::Paint::dither(fui::Color::DarkGray); - tabStyles.selected.foreground = fui::Paint::solid(fui::Color::White); - tabStyles.selected.radius = screen.theme().listRowRadius; } else { tabStyles.selected.background = fui::Paint::dither(fui::Color::LightGray); tabStyles.selected.foreground = fui::Paint::solid(fui::Color::Black); @@ -186,9 +170,9 @@ void UiTabListActivity::buildTabBar(UiScreen& screen) { const fui::Rect tabRect{static_cast(contentTabRect.x - safeRect.x), contentTabRect.y, static_cast(contentTabRect.width + frameRect.width - safeRect.width), contentTabRect.height}; - // Focused band wash is the Lyra treatment; legacy RoundedRaff keeps the - // band plain in both states. - if (tabsFocused && !metrics.tabPillFullSlot) { + // Focused band wash is the Lyra treatment: band plain when the list owns the + // selection. + if (tabsFocused) { screen.target().fill(tabRect, fui::Paint::dither(fui::Color::LightGray)); } // Leave space on both sides of the tab labels and selection highlights. diff --git a/src/activities/UiTabListActivity.h b/src/activities/UiTabListActivity.h index 09dcd9d526a..b5fb9662ec4 100644 --- a/src/activities/UiTabListActivity.h +++ b/src/activities/UiTabListActivity.h @@ -56,8 +56,8 @@ class UiTabListActivity : public UiListActivity { void moveRingTo(int ringIndex); // --- screen helpers -------------------------------------------------------- - // The shared tab band: theme-driven pill treatment (label-hugging Lyra vs - // full-slot RoundedRaff), Lyra focused band wash, always-on divider. + // The shared tab band: Lyra label-hugging pills, focused band wash, + // always-on divider. void buildTabBar(UiScreen& screen); // Ring-aware counterpart of syncListViewport: measures rows, applies the // one-shot follow to the remembered row, clamps, and writes diff --git a/src/activities/home/HomeActivity.cpp b/src/activities/home/HomeActivity.cpp index da5942cacfb..775bbc578b9 100644 --- a/src/activities/home/HomeActivity.cpp +++ b/src/activities/home/HomeActivity.cpp @@ -7,8 +7,6 @@ #include #include #include -#include -#include #include #include #include @@ -41,7 +39,7 @@ int HomeActivity::getMenuItemCount() const { void HomeActivity::loadRecentBooks(int maxBooks) { recentBooks.clear(); const auto& books = RECENT_BOOKS.getBooks(); - recentBooks.reserve(coverGridUi ? maxBooks : std::min(static_cast(books.size()), maxBooks)); + recentBooks.reserve(std::min(static_cast(books.size()), maxBooks)); for (const RecentBook& book : books) { // Limit to maximum number of recent books @@ -58,109 +56,6 @@ void HomeActivity::loadRecentBooks(int maxBooks) { } } -void HomeActivity::fillCoverGridFromLibrary() { - if (recentBooks.size() >= CoverGridHomeUi::MAX_BOOKS) return; - // Keep the index and record together off the task stack; reuse for every row. - struct LibraryReader { - library::LibraryIndexFile index; - library::ClixRecord record; - }; - auto reader = makeUniqueNoThrow(); - if (!reader) { - LOG_ERR("HOME", "OOM: library index"); - return; - } - auto& index = reader->index; - auto& record = reader->record; - if (!index.open(library::libraryIndexPath())) { - index.close(); - GUI.drawPopup(renderer, tr(STR_LIBRARY_REBUILDING)); - library::BuildStats stats; - if (!library::buildLibraryIndex("/", stats, SETTINGS.libraryUseMetadata != 0) || - !index.open(library::libraryIndexPath())) { - LOG_ERR("HOME", "Cannot populate cover grid from library"); - return; - } - } - for (uint16_t row = 0; row < index.bookCount() && recentBooks.size() < CoverGridHomeUi::MAX_BOOKS; ++row) { - RecentBook book; - if (!index.readRecord(index.ordinalForRow(library::SortOrder::RecentDesc, row), record) || - !index.readPath(record, book.path)) - continue; - if (std::any_of(recentBooks.begin(), recentBooks.end(), - [&](const RecentBook& existing) { return existing.path == book.path; }) || - RecentBooksStore::isMissing(book)) - continue; - if (!index.readTitle(record, book.title) && !index.readName(record, book.title)) continue; - index.readAuthor(record, book.author); - if (index.ioFailed()) break; - recentBooks.push_back(std::move(book)); - } -} - -void HomeActivity::resolveGridCoverPaths() { - for (auto& book : recentBooks) { - if (!book.coverBmpPath.empty()) continue; - // Constructors only derive cache paths; no metadata parsing or image generation. - // Keep these large objects off the task stack and release each before the next book. - if (FsHelpers::hasReflowableBookExtension(book.path)) { - auto epub = makeUniqueNoThrow(book.path, "/.crosspoint"); - if (!epub) { - LOG_ERR("HOME", "OOM: EPUB thumbnail path"); - continue; - } - book.coverBmpPath = epub->getThumbBmpPath(); - } else if (FsHelpers::hasXtcExtension(book.path)) { - auto xtc = makeUniqueNoThrow(book.path, "/.crosspoint"); - if (!xtc) { - LOG_ERR("HOME", "OOM: XTC thumbnail path"); - continue; - } - book.coverBmpPath = xtc->getThumbBmpPath(); - } - } -} - -void HomeActivity::loadGridCover(RecentBook& book, int height, bool& showingLoading, Rect& popupRect) { - if (!book.coverBmpPath.empty() && Storage.exists(UITheme::getCoverThumbPath(book.coverBmpPath, height).c_str())) - return; - // Only one parser lives at a time; EPUB/XTC objects exceed the stack budget. - if (FsHelpers::hasReflowableBookExtension(book.path)) { - auto epub = makeUniqueNoThrow(book.path, "/.crosspoint"); - if (!epub) { - LOG_ERR("HOME", "OOM: cover EPUB"); - return; - } - book.coverBmpPath = epub->getThumbBmpPath(); - if (Storage.exists(epub->getThumbBmpPath(height).c_str())) return; - if (!showingLoading) { - showingLoading = true; - popupRect = GUI.drawPopup(renderer, tr(STR_LOADING_POPUP)); - GUI.fillPopupProgress(renderer, popupRect, 0); - } - if (epub->generateThumbBmpFromSource(height)) { - return; - } - } else if (FsHelpers::hasXtcExtension(book.path)) { - auto xtc = makeUniqueNoThrow(book.path, "/.crosspoint"); - if (!xtc) { - LOG_ERR("HOME", "OOM: cover XTC"); - return; - } - book.coverBmpPath = xtc->getThumbBmpPath(); - if (Storage.exists(xtc->getThumbBmpPath(height).c_str())) return; - if (!showingLoading) { - showingLoading = true; - popupRect = GUI.drawPopup(renderer, tr(STR_LOADING_POPUP)); - GUI.fillPopupProgress(renderer, popupRect, 0); - } - if (xtc->load() && xtc->generateThumbBmp(height)) { - return; - } - } - book.coverBmpPath.clear(); -} - void HomeActivity::loadRecentCovers(int coverHeight) { recentsLoading = true; bool showingLoading = false; @@ -168,15 +63,7 @@ void HomeActivity::loadRecentCovers(int coverHeight) { int progress = 0; for (RecentBook& book : recentBooks) { - // The cover grid shares one slot size; generating at any other height - // would rescale the dithered thumb at draw time and alias badly. - const int thumbHeight = coverGridUi ? coverGridUi->thumbHeightFor() : coverHeight; - if (coverGridUi) { - loadGridCover(book, thumbHeight, showingLoading, popupRect); - ++progress; - if (showingLoading) GUI.fillPopupProgress(renderer, popupRect, progress * 100 / recentBooks.size()); - continue; - } + const int thumbHeight = coverHeight; if (!book.coverBmpPath.empty()) { std::string coverPath = UITheme::getCoverThumbPath(book.coverBmpPath, thumbHeight); if (!Storage.exists(coverPath.c_str())) { @@ -242,23 +129,8 @@ void HomeActivity::onEnter() { hasPlugins = SETTINGS.pluginsEnabled != 0; const auto& metrics = UITheme::getInstance().getMetrics(); - if (UITheme::getInstance().hasCoverGridHome()) { - // Screen-lifetime interaction tables and component properties exceed the stack budget. - coverGridUi = makeUniqueNoThrow(renderer); - if (!coverGridUi) LOG_ERR("HOME", "OOM: cover grid UI; using standard home"); - } - loadRecentBooks(coverGridUi ? CoverGridHomeUi::MAX_BOOKS : metrics.homeRecentBooksCount); + loadRecentBooks(metrics.homeRecentBooksCount); hasContinueReading = !recentBooks.empty(); - if (coverGridUi) { - fillCoverGridFromLibrary(); - resolveGridCoverPaths(); - const HomeMenuItem slot = slotItem(); - coverGridUi->begin(recentBooks, - slot == HomeMenuItem::PLUGINS ? CoverGridHomeUi::SlotTab::PLUGINS - : slot == HomeMenuItem::OPDS_BROWSER ? CoverGridHomeUi::SlotTab::OPDS - : CoverGridHomeUi::SlotTab::NONE, - hasContinueReading); - } const auto base = static_cast(recentBooks.size()); selectorIndex = initialMenuItem == HomeMenuItem::NONE ? 0 : base + menuItemToIndex(initialMenuItem, slotItem()); @@ -270,8 +142,6 @@ void HomeActivity::onEnter() { void HomeActivity::onExit() { Activity::onExit(); - coverGridUi.reset(); - // Free the stored cover buffer if any freeCoverBuffer(); } @@ -347,19 +217,15 @@ void HomeActivity::loop() { } }; - // Cover grid home splits navigation by button group (see below); the flat - // next/previous cycle is for the classic list home only. - if (!coverGridUi) { - buttonNavigator.onNext([this, menuCount] { - selectorIndex = ButtonNavigator::nextIndex(selectorIndex, menuCount); - requestUpdate(); - }); - - buttonNavigator.onPrevious([this, menuCount] { - selectorIndex = ButtonNavigator::previousIndex(selectorIndex, menuCount); - requestUpdate(); - }); - } + buttonNavigator.onNext([this, menuCount] { + selectorIndex = ButtonNavigator::nextIndex(selectorIndex, menuCount); + requestUpdate(); + }); + + buttonNavigator.onPrevious([this, menuCount] { + selectorIndex = ButtonNavigator::previousIndex(selectorIndex, menuCount); + requestUpdate(); + }); const auto swipe = mappedInput.wasSwipe(); if (swipe == MappedInputManager::SwipeDir::Up) { @@ -381,47 +247,6 @@ void HomeActivity::loop() { return; } - if (coverGridUi) { - const int touched = coverGridUi->selectedAction(mappedInput); - if (touched >= 0 && touched < menuCount) { - selectorIndex = touched; - activateSelection(); - return; - } - if (mappedInput.wasReleased(MappedInputManager::Button::Confirm)) { - activateSelection(); - return; - } - // Side page buttons walk the covers, front Left/Right walk the tabs - // (selectorIndex is flat: books first, then the tab items). A press while - // selection sits in the other band jumps into this band first. - const int bookCount = static_cast(recentBooks.size()); - const auto cycleBand = [this](const int base, const int count, const int dir) { - if (count <= 0) return; - int idx = selectorIndex - base; - if (idx < 0 || idx >= count) { - idx = dir > 0 ? 0 : count - 1; - } else { - idx = (idx + count + dir) % count; - } - selectorIndex = base + idx; - requestUpdate(); - }; - buttonNavigator.onPressAndContinuous({MappedInputManager::Button::Up}, - [&cycleBand, bookCount] { cycleBand(0, bookCount, -1); }); - buttonNavigator.onPressAndContinuous({MappedInputManager::Button::Down}, - [&cycleBand, bookCount] { cycleBand(0, bookCount, +1); }); - buttonNavigator.onPressAndContinuous({MappedInputManager::Button::Left}, [this, &cycleBand] { - const int bookCount = static_cast(recentBooks.size()); - cycleBand(bookCount, getMenuItemCount() - bookCount, -1); - }); - buttonNavigator.onPressAndContinuous({MappedInputManager::Button::Right}, [this, &cycleBand] { - const int bookCount = static_cast(recentBooks.size()); - cycleBand(bookCount, getMenuItemCount() - bookCount, +1); - }); - return; - } - // Match the rendered cover grid, which lays tiles inside getContentArea() // (origin content.x + contentSidePadding, span content.width). Using // screen-relative getScreenWidth()/contentSidePadding here offset the touch @@ -452,8 +277,8 @@ void HomeActivity::loop() { const int renderedMenuCount = menuCount - (metrics.homeContinueReadingInMenu ? 0 : static_cast(recentBooks.size())); int menuRow = -1; - // Row height from the theme, not the metrics table: RoundedRaff draws - // font-derived rows and the touch grid must match the visuals exactly. + // Row height from the theme, not the metrics table: the touch grid must + // match the drawn rows exactly. const int menuRowHeight = GUI.getMenuRowHeight(renderer); const auto menuTouch = mappedInput.rowTouch(menuRow, menuTop, menuRowHeight + metrics.menuSpacing, renderedMenuCount, 0, INT32_MAX, menuRowHeight); @@ -487,42 +312,6 @@ void HomeActivity::render(RenderLock&&) { const Rect content = UITheme::getInstance().getContentArea(renderer); renderer.clearScreen(); - if (coverGridUi) { - const auto drawGrid = [&] { - renderer.clearScreen(); - coverGridUi->setSelection(selectorIndex); - UITheme::getInstance().drawCoverGridHome(*coverGridUi); - // Front Left/Right walk the tabs, so their hints read Left/Right; the - // side page buttons (unhinted) walk the covers. - const auto labels = mappedInput.mapLabels(hasContinueReading ? tr(STR_RESUME) : "", tr(STR_SELECT), - tr(STR_DIR_LEFT), tr(STR_DIR_RIGHT)); - GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4); - }; - drawGrid(); - // Slot heights are recorded during the draw above; a change (first layout - // pass, orientation switch) means the paths must point at those sizes and - // any missing thumbs must be generated. Resolve the covers before the - // panel is touched and redraw into the framebuffer, so Home paints once - // instead of three e-ink refreshes (placeholder, placeholder, covers). - if (coverGridUi->takeThumbHeightChanged()) { - coverGridUi->refreshCoverPaths(); - recentsLoaded = false; - } - if (!recentsLoaded && !recentsLoading) { - loadRecentCovers(CoverGridHomeUi::THUMB_HEIGHT); - coverGridUi->refreshCoverPaths(); - drawGrid(); - if (coverGridUi->takeThumbHeightChanged()) { - coverGridUi->refreshCoverPaths(); - recentsLoaded = false; - requestUpdate(); - } - } - renderer.displayBuffer(cleanInitialRefresh && !firstRenderDone ? HalDisplay::HALF_REFRESH - : HalDisplay::FAST_REFRESH); - firstRenderDone = true; - return; - } // A cover snapshot from the other output polarity holds the other byte form (night mode keeps images pre-inverted so // they stay positive): pasting it back after a theme switch showed the cover as a negative. Redraw it instead. if (coverBufferStored && coverBufferInverted != display.isInverted()) { @@ -532,8 +321,8 @@ void HomeActivity::render(RenderLock&&) { bool bufferRestored = coverRendered && coverBufferStored && restoreCoverBuffer(); // Band spans topPadding..homeTopPadding: the cover tile starts at the fixed - // homeTopPadding, so the height must shrink by topPadding or the band (and a - // centered title, e.g. RoundedRaff's book title) sinks into the tile. + // homeTopPadding, so the height must shrink by topPadding or the band (and + // any centered title in it) sinks into the tile. // Home is the stack root: no back button in its header. GUI.drawHeader(renderer, Rect{0, metrics.topPadding, pageWidth, metrics.homeTopPadding - metrics.topPadding}, metrics.homeContinueReadingInMenu && !recentBooks.empty() ? recentBooks[0].title.c_str() : nullptr, @@ -586,8 +375,7 @@ void HomeActivity::render(RenderLock&&) { firstRenderDone = true; if (!recentsLoaded && !recentsLoading) { recentsLoading = true; - const int themeThumbHeight = GUI.homeCoverThumbHeight(renderer); - loadRecentCovers(themeThumbHeight > 0 ? themeThumbHeight : metrics.homeCoverHeight); + loadRecentCovers(metrics.homeCoverHeight); } } diff --git a/src/activities/home/HomeActivity.h b/src/activities/home/HomeActivity.h index d346334fed5..11bd224d1e0 100644 --- a/src/activities/home/HomeActivity.h +++ b/src/activities/home/HomeActivity.h @@ -5,13 +5,11 @@ #include "./FileBrowserActivity.h" #include "RecentBooksStore.h" #include "activities/Activity.h" -#include "components/CoverGridHomeUi.h" #include "util/ButtonNavigator.h" struct Rect; class HomeActivity final : public Activity { - std::unique_ptr coverGridUi; ButtonNavigator buttonNavigator; int selectorIndex = 0; bool recentsLoading = false; @@ -85,9 +83,6 @@ class HomeActivity final : public Activity { void freeCoverBuffer(); // Free the stored cover buffer void loadRecentBooks(int maxBooks); void loadRecentCovers(int coverHeight); - void fillCoverGridFromLibrary(); - void resolveGridCoverPaths(); - void loadGridCover(RecentBook& book, int height, bool& showingLoading, Rect& popupRect); public: explicit HomeActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, diff --git a/src/activities/settings/SettingsActivity.cpp b/src/activities/settings/SettingsActivity.cpp index 622e003991a..10fb1256105 100644 --- a/src/activities/settings/SettingsActivity.cpp +++ b/src/activities/settings/SettingsActivity.cpp @@ -269,18 +269,6 @@ void SettingsActivity::activateIndex(const int index) { requestUpdate(); } -void SettingsActivity::applyUiSettingChange(uint8_t CrossPointSettings::* valuePtr) { - // Theme changes take effect immediately, on this screen — reload the theme - // and re-derive the app's tokens so the very next repaint is in the new look. - if (valuePtr != &CrossPointSettings::uiTheme) { - return; - } - UITheme::getInstance().reload(); - // Re-derive the shared tokens for the new look; the gate stays closed until - // the repaint that rebuilds the interaction table in the new layout. - resetUi(); -} - bool SettingsActivity::handleCustomInput() { return optionPopup.handleInput(mappedInput, [this] { requestUpdate(); }); } @@ -316,7 +304,6 @@ void SettingsActivity::toggleSelectedSetting() { syncQuickResumeTimeoutForSleepScreen(sleepScreenChanged, quickResumeTimeoutChanged); SETTINGS.saveToFile(); rebuildSettings(); - applyUiSettingChange(valuePtr); }); requestUpdate(); return; @@ -534,9 +521,7 @@ void SettingsActivity::toggleSelectedSetting() { syncQuickResumeTimeoutForSleepScreen(sleepScreenChanged, quickResumeTimeoutChanged); SETTINGS.saveToFile(); - const auto valuePtr = setting.valuePtr; // rebuildSettings() replaces `setting` rebuildSettings(); - applyUiSettingChange(valuePtr); // Rows can appear/disappear with a change (e.g. the footnote-back toggle). nav.selected = std::min(selectedSetting, static_cast(settings.size()) - 1); } diff --git a/src/activities/settings/SettingsActivity.h b/src/activities/settings/SettingsActivity.h index b57d01adfe1..029db7850e4 100644 --- a/src/activities/settings/SettingsActivity.h +++ b/src/activities/settings/SettingsActivity.h @@ -210,7 +210,6 @@ class SettingsActivity final : public UiListActivity { void rebuildRowItems(); void toggleSelectedSetting(); void openSleepTimeoutPicker(); - void applyUiSettingChange(uint8_t CrossPointSettings::* valuePtr); void syncQuickResumeTimeoutForSleepScreen(bool sleepScreenChanged, bool quickResumeTimeoutChanged); static std::string settingValueText(const SettingInfo& setting); diff --git a/src/activities/util/FrontlightPanelActivity.cpp b/src/activities/util/FrontlightPanelActivity.cpp index b4ca2b36f3f..a9db69c9212 100644 --- a/src/activities/util/FrontlightPanelActivity.cpp +++ b/src/activities/util/FrontlightPanelActivity.cpp @@ -362,9 +362,9 @@ void FrontlightPanelActivity::buildPanelScreen(UiScreen& screen) { screen.sheet(sheetProps, static_cast(panelBottom)); screen.insetContent(fui::Insets{0, kPanelSideMargin, 0, kPanelSideMargin}); - // Reuse the exact battery renderer and header rectangle used by Home. Call - // the base implementation directly because RoundedRaff suppresses its - // untitled Home header. + // Reuse the exact battery renderer and header rectangle used by Home, drawn + // through the base implementation so a future theme override cannot change + // this band. { const auto& metrics = UITheme::getInstance().getMetrics(); screen.spacer(theme.spaceMd); diff --git a/src/components/CoverGridHomeUi.cpp b/src/components/CoverGridHomeUi.cpp deleted file mode 100644 index 864c2eaefc1..00000000000 --- a/src/components/CoverGridHomeUi.cpp +++ /dev/null @@ -1,335 +0,0 @@ -#include "CoverGridHomeUi.h" - -#include -#include -#include - -#include -#include -#include - -#include "MappedInputManager.h" -#include "UITheme.h" -#include "icons/blocks.h" -#include "icons/book.h" -#include "icons/folder.h" -#include "icons/library.h" -#include "icons/settings2.h" -#include "icons/transfer.h" -#include "util/BookProgress.h" - -namespace fui = freeink::ui; -namespace { -constexpr fui::ActionId SELECT = 1; -// Grid cell padding around each cover; also feeds the screen's horizontal -// inset so the cover columns land on the header chrome's inset line. -constexpr int16_t COVER_CELL_INSET = 6; -constexpr int COVER_ROW_EXTRA_HEIGHT = 8; -} // namespace - -int CoverGridHomeUi::gridColumnsFor(const GfxRenderer& renderer) { - // 2 columns in landscape gives ~380 px per column on 800px-wide panels. - const auto orient = renderer.getOrientation(); - return orient == GfxRenderer::LandscapeClockwise || orient == GfxRenderer::LandscapeCounterClockwise ? 2 - : GRID_COLUMNS; -} - -CoverGridHomeUi::CoverGridHomeUi(GfxRenderer& renderer) - : UiAppHost(renderer), coverCache(renderer), renderer(renderer) {} - -void CoverGridHomeUi::begin(const std::vector& recent, const SlotTab slot, bool continuing) { - books = &recent; - slotTab = slot; - hasContinueReading = continuing; - if (!recent.empty()) coverCache.begin(); - resetUi(); - app.on(SELECT, &CoverGridHomeUi::onAction, this); - app.setScreen(&CoverGridHomeUi::screenFn, this); - refreshCoverPaths(); - progress = hasContinueReading && !books->empty() ? loadBookProgress(books->front().path) : -1; - if (progress >= 0) snprintf(progressText, sizeof(progressText), "%d%%", progress); -} - -void CoverGridHomeUi::refreshCoverPaths() { - coverCache.invalidate(); - for (size_t i = 0; i < books->size() && i < coverPaths.size(); ++i) refreshCoverPath(i); -} - -void CoverGridHomeUi::refreshCoverPath(size_t index) { - if (index >= books->size() || index >= coverPaths.size()) return; - coverCache.invalidate(index); - coverPaths[index] = - thumbHeight > 0 ? UITheme::getCoverThumbPath((*books)[index].coverBmpPath, thumbHeight) : std::string(); -} - -int CoverGridHomeUi::thumbHeightFor() const { return thumbHeight > 0 ? thumbHeight : THUMB_HEIGHT; } - -bool CoverGridHomeUi::takeThumbHeightChanged() { return std::exchange(thumbHeightChanged, false); } - -void CoverGridHomeUi::noteThumbHeight(int slotHeight) { - // One shared height for every slot (hero and grid covers are the same - // size). The +8 surplus gives the paint clip a little bleed so the art's - // rightward nudge never exposes the left edge; covers narrower than the - // 2:3 slot may show a thin sliver at the sides rather than being cropped. - const int height = std::max(1, slotHeight + 8); - if (thumbHeight != height) { - thumbHeight = height; - thumbHeightChanged = true; - refreshCoverPaths(); - } -} - -void CoverGridHomeUi::onAction(const fui::ActionEvent& event, void* user) { - auto& self = *static_cast(user); - self.pending = event.value; - self.app.clearTapFlash(); -} - -int CoverGridHomeUi::selectedAction(const MappedInputManager& input) { - pending = -1; - const auto touch = routeTouch(input); - return touch.snap.touchReleased ? pending : -1; -} - -void CoverGridHomeUi::screenFn(UiScreen& screen, void* user) { static_cast(user)->draw(screen); } - -void CoverGridHomeUi::draw(UiScreen& screen) { - coverCache.prepare(); - const auto& theme = screen.theme(); - const auto safe = UITheme::getInstance().getScreenSafeArea(renderer, true); - // Sides clear the rounded corners like the header, so the grid lines up under it. - const int corner = BoardConfig::ACTIVE.cornerRadius; - const auto left = static_cast(std::max(safe.x, corner)); - const auto right = static_cast(std::max(renderer.getScreenWidth() - safe.x - safe.width, corner)); - screen.setContentMarginFromScreen(fui::Insets{static_cast(safe.y), right, - static_cast(renderer.getScreenHeight() - safe.y - safe.height), - left}); - // Horizontal inset sized so the outer cover columns (content x plus the - // grid's cell inset) sit on the theme's side-padding line: the heading and - // tabs then align with the clock and battery, which tuck a few px further - // in (headerStatusInset's optical bias). - const int16_t hInset = std::max( - 0, static_cast(UITheme::getInstance().getMetrics().headerSidePadding - COVER_CELL_INSET - left)); - // Drop the status band, hero, and grid down: touch boards get a full step - // (no button-hint band to fit), button boards a modest nudge. The tabs stay - // put (bottom-anchored below). - const int16_t topInset = - BoardConfig::hasTouch() ? static_cast(theme.spaceLg) : static_cast(theme.spaceSm + 4); - screen.insetContent(fui::Insets{topInset, hInset, theme.spaceSm, hInset}); - // Reserve the band's slot in the flow (its content draws at a fixed screen - // position in drawHeaderBand); the slot doubles as padding above the heading. - screen.takeTop(UITheme::getInstance().getMetrics().batteryBarHeight, theme.spaceSm); - // Button boards run tighter above the tabs to make room for the top step. - const int16_t tabGap = BoardConfig::hasTouch() ? theme.spaceSm : static_cast(4); - const auto& board = BoardConfig::ACTIVE; - auto tabRect = screen.takeBottom(UITheme::getInstance().getMetrics().coverGridTabBarHeight, tabGap); - // The board's tab height sits at the bottom of the theme's slot, then its - // offset lower; the slot itself is unchanged, so the grid keeps its size. - const auto tabHeight = static_cast(tabRect.height * board.tabBarHeightPct / 100); - tabRect.y = static_cast(tabRect.y + tabRect.height - tabHeight + board.tabBarOffsetY); - tabRect.height = tabHeight; - // The board's share of the row the tabs spread across, centered. - const auto fitTabWidth = [&board](fui::Rect rect) { - const auto width = static_cast(rect.width * board.tabBarWidthPct / 100); - rect.x = static_cast(rect.x + (rect.width - width) / 2); - rect.width = width; - return rect; - }; - if (books->empty()) { - drawTabs(screen, fitTabWidth(tabRect.inset(fui::Insets{0, COVER_CELL_INSET, 0, COVER_CELL_INSET}))); - drawEmpty(screen); - drawHeaderBand(); - return; - } - // Hero cover matches the grid covers: the body splits into three equal - // cover rows (hero + two grid rows), so the featured section is one row - // tall and every cover on screen shares one size. The metadata floor still - // applies when the rows would be too short for the hero's text lines. - const fui::Rect body = screen.body(); - const int rowGap = std::max(4, body.width / 100); - grid.gap = grid.rowGap = rowGap; - const int coverRowHeight = std::max(1, (body.height - theme.spaceSm - 2 * rowGap) / 3 + COVER_ROW_EXTRA_HEIGHT); - const bool landscape = renderer.getOrientation() != GfxRenderer::Portrait; - const int16_t featuredHeight = std::min( - body.height, std::max(coverRowHeight, screen.target().lineHeight(theme.bodyText.font) * (landscape ? 1 : 2) + - screen.target().lineHeight(theme.smallText.font) * 2 + 32)); - drawCurrent(screen, screen.takeTop(featuredHeight, theme.spaceSm), coverRowHeight); - drawGrid(screen); - tabRect.x = gridBounds.x + grid.cellInset.left; - tabRect.width = gridBounds.width - grid.cellInset.left - grid.cellInset.right; - drawTabs(screen, fitTabWidth(tabRect)); - drawHeaderBand(); -} - -void CoverGridHomeUi::drawHeaderBand() { - // The stock full-width band at the theme's topPadding, exactly like every - // pushed screen's header: the battery/clock hold one position across the - // whole UI, and the grid is widened to meet them (see the hInset above). - const ThemeMetrics& metrics = UITheme::getInstance().getMetrics(); - GUI.drawHeader(renderer, Rect{0, metrics.topPadding, renderer.getScreenWidth(), metrics.batteryBarHeight}, nullptr); -} - -void CoverGridHomeUi::drawEmpty(UiScreen& screen) { - const auto& theme = screen.theme(); - const auto body = screen.body(); - auto title = theme.titleText; - title.bold = true; - title.align = fui::TextAlign::Center; - auto message = theme.bodyText; - message.align = fui::TextAlign::Center; - constexpr int16_t ICON_SIZE = 32; - const int16_t titleHeight = screen.target().lineHeight(title.font); - const int16_t messageHeight = screen.target().lineHeight(message.font); - const int16_t contentHeight = ICON_SIZE + theme.spaceLg + titleHeight + theme.spaceSm + messageHeight; - int16_t y = body.y + std::max(0, (body.height - contentHeight) / 2); - renderer.drawIcon(BookIcon, body.x + (body.width - ICON_SIZE) / 2, y, ICON_SIZE); - y += ICON_SIZE + theme.spaceLg; - screen.target().text(fui::Rect{body.x, y, body.width, titleHeight}, tr(STR_NO_OPEN_BOOK), title); - y += titleHeight + theme.spaceSm; - screen.target().text(fui::Rect{body.x, y, body.width, messageHeight}, tr(STR_START_READING), message); -} - -void CoverGridHomeUi::drawCurrent(UiScreen& screen, fui::Rect rect, const int coverRowHeight) { - const auto& theme = screen.theme(); - const auto& book = books->front(); - card.title = book.title.c_str(); - card.author = book.author.empty() ? nullptr : book.author.c_str(); - card.meta = nullptr; - card.progressLabel = progress >= 0 ? progressText : nullptr; - card.centerTextOnCover = true; - card.progress = std::max(0, progress); - card.progressMax = progress >= 0 ? 100 : 0; - card.action = SELECT; - // The featured card's selected state is a slim accent bar drawn after the - // card (see below), not a bookCard indicator: every ring/outline treatment - // tried here either overwhelmed the large cover or made the heading above - // read as misaligned. - card.state = fui::StateNormal; - card.styles = theme.listRow; - card.styles.selected.background = fui::Paint::dither(fui::Color::LightGray); - // The grid thumbs' selection ring draws with this border: gray like Lyra's - // selection box, not solid black. - card.styles.selected.border = fui::Paint::dither(fui::Color::LightGray); - card.styles.selected.foreground = fui::Paint::solid(fui::Color::Black); - card.styles.selected.radius = theme.listRowRadius; - card.styles.active = card.styles.selected; - card.titleText = theme.bodyText; - card.titleText.maxLines = renderer.getOrientation() != GfxRenderer::Portrait ? 1 : 2; - card.authorText = theme.smallText; - card.progressText = theme.smallText; - card.progressHeight = 6; - card.padding = fui::Insets{6, 6, 6, 6}; - card.gap = theme.spaceLg + theme.spaceSm; - // Fit the shared 2:3 cover box within both the row and a grid column. No - // gap reserve: the cell insets already keep adjacent covers apart, and the - // SpaceBetween layout absorbs whatever slack remains. - const int cols = gridColumnsFor(renderer); - const int maxCoverWidth = rect.width / cols - 2 * COVER_CELL_INSET; - card.coverSize.height = std::max(1, std::min(std::min(rect.height, coverRowHeight) - 12, maxCoverWidth * 3 / 2)); - card.coverSize.width = std::max(1, card.coverSize.height * 2 / 3); - noteThumbHeight(card.coverSize.height); - gridBounds = layoutGrid(screen.body()); - rect.x = gridBounds.x; - rect.width = gridBounds.width; - card.coverPainterUserData = this; - card.coverPainter = [](fui::DrawTarget& target, fui::Rect cover, const fui::BookCardProps&, void* user) { - return static_cast(user)->paintFramedCover(target, cover, 0); - }; - fui::bookCard(screen.frame(), rect, card); - - if (selected == 0 && !BoardConfig::hasTouch()) { - // Button boards only: a vertical accent bar left of the card, cover-height - // and vertically centered on it, marks the featured card as the button - // cursor without framing the cover. Touch boards tap directly and need no - // cursor on the hero card. - const int16_t barH = card.coverSize.height; - screen.target().fill( - fui::Rect{static_cast(rect.x - 5), static_cast(rect.y + (rect.height - barH) / 2), 3, barH}, - fui::Paint::dither(fui::Color::LightGray)); - } -} - -fui::Rect CoverGridHomeUi::layoutGrid(fui::Rect rect) { - // Exactly the hero's box: the three-equal-rows split in draw() already - // guarantees it fits, and sharing the size keeps one cached thumb per book. - grid.cellInset = fui::Insets{COVER_CELL_INSET, COVER_CELL_INSET, COVER_CELL_INSET, COVER_CELL_INSET}; - grid.coverSize = card.coverSize; - grid.rowHeight = grid.coverSize.height + 12; - // Full content width: the SpaceBetween column layout pins the outer covers - // to the rect edges, so the grid reaches the chrome's inset line instead of - // centering at its natural width. - rect.height = GRID_ROWS * grid.rowHeight + (GRID_ROWS - 1) * grid.rowGap; - return rect; -} - -void CoverGridHomeUi::drawGrid(UiScreen& screen) { - const auto rect = gridBounds; - grid.count = books->size() > 1 ? books->size() - 1 : 0; - grid.columns = gridColumnsFor(renderer); - grid.columnLayout = fui::CoverGridColumnLayout::SpaceBetween; - grid.action = SELECT; - grid.inputMask = fui::InputTouch; - grid.selectedIndex = selected > 0 && selected < static_cast(books->size()) ? selected - 1 : -1; - // Same thick cover ring as the featured card; the dithered Cell background - // was easy to miss behind a dark cover. - grid.selectionIndicator = fui::CoverGridSelectionIndicator::CoverFrame; - // Thick dithered ring sized for the small thumbs: 6px outside the cover, - // 2px over its edge. - grid.selectedCoverFrameGap = 6; - grid.selectedCoverFrameWidth = 8; - grid.cellStyles = card.styles; - grid.labelHeight = 0; - grid.labelGap = 0; - grid.scrollIndicator = false; - grid.itemProvider = [](uint16_t index, void*) { return fui::coverGridItem(nullptr, index + 1); }; - grid.coverPainterUserData = this; - grid.coverPainter = [](fui::DrawTarget& target, fui::Rect cover, const fui::CoverGridItem&, uint16_t index, - void* user) { - return static_cast(user)->paintFramedCover(target, cover, index + 1); - }; - fui::coverGrid(screen.frame(), rect, grid); -} - -void CoverGridHomeUi::drawTabs(UiScreen& screen, fui::Rect rect) { - static constexpr const uint8_t* ICONS[] = {FolderIcon, LibraryIcon, BlocksIcon, TransferIcon, Settings2Icon}; - int count = 0; - for (int i = 0; i < 5; ++i) { - if (i == 2 && slotTab == SlotTab::NONE) continue; - auto& tab = tabItems[count]; - tab.value = books->size() + count; - tab.selected = selected == tab.value; - tab.label = nullptr; - ++count; - } - tabs.tabs = tabItems.data(); - tabs.count = count; - tabs.layout = fui::TabBarLayout::SpaceBetween; - tabs.action = SELECT; - tabs.inputMask = fui::InputTouch; - tabs.iconSize = 32; - tabs.iconPainterUserData = this; - tabs.iconPainter = [](fui::DrawTarget&, fui::Rect iconRect, const fui::TabItem& tab, uint8_t, void* user) { - const auto& self = *static_cast(user); - const int index = tab.value - static_cast(self.books->size()); - const int icon = self.slotTab == SlotTab::NONE && index >= 2 ? index + 1 : index; - const uint8_t* bitmap = icon == 2 && self.slotTab == SlotTab::OPDS ? BookIcon : ICONS[icon]; - self.renderer.drawIcon(bitmap, iconRect.x, iconRect.y, iconRect.width); - return true; - }; - // No pill fill; the underline marks the selected tab. - tabs.tabStyles.explicitlySet = true; - tabs.selectedUnderline = 2; - tabs.distributedSlotWidth = 0; - fui::tabBar(screen.frame(), rect, tabs); -} - -bool CoverGridHomeUi::paintFramedCover(fui::DrawTarget& target, fui::Rect rect, size_t index) { - constexpr int16_t SHADOW_OFFSET = 2; - const auto ink = fui::Paint::solid(fui::Color::Black); - target.fill(fui::Rect{rect.right(), static_cast(rect.y + SHADOW_OFFSET), SHADOW_OFFSET, rect.height}, ink); - target.fill(fui::Rect{static_cast(rect.x + SHADOW_OFFSET), rect.bottom(), rect.width, SHADOW_OFFSET}, ink); - // The false spine draws inside the cover paint (HomeCoverCache), glued to - // the art's left edge, so it stays aligned whatever each cover's margin is. - const bool drawn = index < coverPaths.size() && coverCache.paint(rect, index, coverPaths[index]); - return drawn; -} diff --git a/src/components/CoverGridHomeUi.h b/src/components/CoverGridHomeUi.h deleted file mode 100644 index a94fcd03ed2..00000000000 --- a/src/components/CoverGridHomeUi.h +++ /dev/null @@ -1,70 +0,0 @@ -#pragma once - -#include -#include -#include - -#include "HomeCoverCache.h" -#include "RecentBooksStore.h" -#include "UiAppHost.h" -#include "components/bars/tab-bar.h" -#include "components/media/book-card.h" -#include "components/media/cover-grid.h" - -class GfxRenderer; - -class CoverGridHomeUi final : public UiAppHost { - public: - static constexpr int THUMB_HEIGHT = 400; - static constexpr int GRID_COLUMNS = 3; - static constexpr int GRID_ROWS = 2; - static constexpr int MAX_BOOKS = 1 + GRID_COLUMNS * GRID_ROWS; - static_assert(MAX_BOOKS <= HomeCoverCache::MAX_COVERS); - static int gridColumnsFor(const GfxRenderer& renderer); - // What the third tab opens; NONE hides it. - enum class SlotTab : uint8_t { NONE, PLUGINS, OPDS }; - - explicit CoverGridHomeUi(GfxRenderer& renderer); - void begin(const std::vector& books, SlotTab slotTab, bool hasContinueReading); - void refreshCoverPaths(); - void setSelection(int selection) { selected = selection; } - int selectedAction(const MappedInputManager& input); - // Exact generation height, shared by every slot and recorded during draw. - // Thumbs must be generated at the drawn size: rescaling a dithered 1-bit - // image aliases badly. - int thumbHeightFor() const; - bool takeThumbHeightChanged(); - - private: - static void screenFn(UiScreen& screen, void* user); - static void onAction(const freeink::ui::ActionEvent& event, void* user); - void draw(UiScreen& screen); - void drawHeaderBand(); - void drawEmpty(UiScreen& screen); - void drawCurrent(UiScreen& screen, freeink::ui::Rect rect, int coverRowHeight); - void drawGrid(UiScreen& screen); - freeink::ui::Rect layoutGrid(freeink::ui::Rect rect); - void drawTabs(UiScreen& screen, freeink::ui::Rect rect); - bool paintFramedCover(freeink::ui::DrawTarget& target, freeink::ui::Rect rect, size_t index); - void refreshCoverPath(size_t index); - void noteThumbHeight(int slotHeight); - - HomeCoverCache coverCache; - GfxRenderer& renderer; - const std::vector* books = nullptr; - std::array coverPaths; - int thumbHeight = 0; - bool thumbHeightChanged = false; - int selected = 0; - int pending = -1; - int progress = -1; - SlotTab slotTab = SlotTab::NONE; - bool hasContinueReading = false; - char progressText[12]{}; - // Component styles and interaction tables stay off the render task's stack. - freeink::ui::BookCardProps card; - freeink::ui::CoverGridProps grid; - freeink::ui::Rect gridBounds{}; - freeink::ui::TabBarProps tabs; - std::array tabItems; -}; diff --git a/src/components/HomeCoverCache.cpp b/src/components/HomeCoverCache.cpp deleted file mode 100644 index f181685a136..00000000000 --- a/src/components/HomeCoverCache.cpp +++ /dev/null @@ -1,93 +0,0 @@ -#include "HomeCoverCache.h" - -#include -#include -#include - -#include - -#include "UITheme.h" - -namespace fui = freeink::ui; - -void HomeCoverCache::begin() { - // Cover regions do not overlap. Each may widen by one physical byte per row. - coverCacheCapacity = renderer.getRegionByteSize(0, 0, renderer.getScreenWidth(), renderer.getScreenHeight()) + - MAX_COVERS * std::max(renderer.getScreenWidth(), renderer.getScreenHeight()); - coverCache = HalMemory::allocatePsram(coverCacheCapacity); - if (!coverCache) { - LOG_ERR("HOME", "PSRAM cover cache unavailable (%u bytes); rendering uncached", unsigned(coverCacheCapacity)); - coverCacheCapacity = 0; - } -} - -void HomeCoverCache::invalidate() { - coverCacheUsed = 0; - cachedCovers.fill(CachedCover{}); -} - -void HomeCoverCache::invalidate(size_t index) { - if (index < cachedCovers.size()) cachedCovers[index].valid = false; -} - -void HomeCoverCache::prepare() { - const int orientation = static_cast(renderer.getOrientation()); - // Night mode stores images pre-inverted, so a snapshot from the other - // polarity would paste back as a negative. - const bool inverted = display.isInverted(); - if (coverCacheOrientation != orientation || coverCacheInverted != inverted) { - invalidate(); - coverCacheOrientation = orientation; - coverCacheInverted = inverted; - } -} - -bool HomeCoverCache::paint(fui::Rect rect, size_t index, const std::string& path) { - if (index >= cachedCovers.size()) return false; - auto& cached = cachedCovers[index]; - uint8_t* const cacheData = coverCache.get(); - if (coverCache && cached.valid && cached.rect.x == rect.x && cached.rect.y == rect.y && - cached.rect.width == rect.width && cached.rect.height == rect.height && - renderer.copyBufferToRegion(rect.x, rect.y, rect.width, rect.height, cacheData + cached.offset, cached.bytes)) { - return true; - } - cached.valid = false; - bool drawn = false; - if (!path.empty() && Storage.openFileForRead("HOME", path, coverFile)) { - if (coverBitmap.parseHeaders() == BmpReaderError::Ok && coverBitmap.getWidth() > 0 && coverBitmap.getHeight() > 0) { - // The art nudges a few px right of center; the spine below hugs its - // left edge either way. - constexpr int ART_SHIFT = 3; - drawn = GUI.drawCoverThumbFill(renderer, coverBitmap, Rect{rect.x, rect.y, rect.width, rect.height}, ART_SHIFT); - if (drawn) { - renderer.drawRect(rect.x, rect.y, rect.width, rect.height); - // False spine glued to the art's left edge (centered art means that - // edge moves with each cover's fit margin): a dark band with a - // dithered crease makes every cover read as a bound book. Drawn here - // so the PSRAM snapshot below captures it. - const int artLeft = std::max(rect.x, rect.x + (rect.width - coverBitmap.getWidth()) / 2 + ART_SHIFT); - renderer.fillRect(artLeft, rect.y, 3, rect.height); - renderer.fillRectDither(artLeft + 3, rect.y, 2, rect.height, Color::LightGray); - } - } - coverFile.close(); - } - if (!drawn) { - GUI.drawCoverPlaceholder(renderer, Rect{rect.x, rect.y, rect.width, rect.height}); - renderer.drawRect(rect.x, rect.y, rect.width, rect.height); - } - if (coverCache) { - const size_t needed = renderer.getRegionByteSize(rect.x, rect.y, rect.width, rect.height); - if (needed > cached.bytes && needed <= coverCacheCapacity - coverCacheUsed) { - cached.offset = coverCacheUsed; - cached.bytes = needed; - coverCacheUsed += needed; - } - if (needed > 0 && needed <= cached.bytes) { - cached.rect = rect; - cached.valid = - renderer.copyRegionToBuffer(rect.x, rect.y, rect.width, rect.height, cacheData + cached.offset, cached.bytes); - } - } - return true; // The cover slot is painted, including fallback art. -} diff --git a/src/components/HomeCoverCache.h b/src/components/HomeCoverCache.h deleted file mode 100644 index 52a5d779c7a..00000000000 --- a/src/components/HomeCoverCache.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include -#include - -class GfxRenderer; - -// Screen-lifetime thumbnail decoding and PSRAM region snapshots. -class HomeCoverCache { - public: - static constexpr size_t MAX_COVERS = 7; - explicit HomeCoverCache(GfxRenderer& renderer) : renderer(renderer) {} - void begin(); - void prepare(); - void invalidate(); - void invalidate(size_t index); - bool paint(freeink::ui::Rect rect, size_t index, const std::string& path); - - private: - struct CachedCover { - freeink::ui::Rect rect{}; - size_t offset = 0; - size_t bytes = 0; - bool valid = false; - }; - HalMemory::PsramBuffer coverCache; - std::array cachedCovers{}; - size_t coverCacheCapacity = 0; - size_t coverCacheUsed = 0; - int coverCacheOrientation = -1; - bool coverCacheInverted = false; - - HalFile coverFile; - Bitmap coverBitmap{coverFile}; - GfxRenderer& renderer; -}; diff --git a/src/components/UITheme.cpp b/src/components/UITheme.cpp index 53d4d4f9267..e69dfa69c12 100644 --- a/src/components/UITheme.cpp +++ b/src/components/UITheme.cpp @@ -4,7 +4,6 @@ #include #include #include -#include #include #include @@ -13,63 +12,23 @@ #include "MappedInputManager.h" #include "RecentBooksStore.h" -#include "components/CoverGridHomeUi.h" #include "components/themes/BaseTheme.h" -#include "components/themes/lyra/Lyra3CoversTheme.h" #include "components/themes/lyra/LyraTheme.h" -#include "components/themes/roundedraff/RoundedRaffTheme.h" UITheme UITheme::instance; -UITheme::UITheme() { - auto themeType = static_cast(SETTINGS.uiTheme); - setTheme(themeType); -} +UITheme::UITheme() { reload(); } void UITheme::reload() { - auto themeType = static_cast(SETTINGS.uiTheme); - setTheme(themeType); -} - -bool UITheme::supportsCoverGrid() { return HalMemory::getPsramHeap().totalBytes > 0; } - -bool UITheme::hasCoverGridHome() { return SETTINGS.uiTheme == CrossPointSettings::COVER_GRID && supportsCoverGrid(); } - -void UITheme::drawCoverGridHome(CoverGridHomeUi& home) { home.renderUi(); } - -void UITheme::setTheme(CrossPointSettings::UI_THEME type) { - if (type == CrossPointSettings::COVER_GRID && !supportsCoverGrid()) type = CrossPointSettings::LYRA; - - switch (type) { - case CrossPointSettings::UI_THEME::CLASSIC: - LOG_DBG("UI", "Using Classic theme"); - currentTheme = std::make_unique(); - currentMetrics = &BaseMetrics::values; - break; - case CrossPointSettings::UI_THEME::COVER_GRID: - case CrossPointSettings::UI_THEME::LYRA: { - // The cover home owns its screen-lifetime UI state; other screens retain Lyra styling. - auto theme = makeUniqueNoThrow(); - if (!theme) { - LOG_ERR("UI", "OOM: Lyra theme"); - return; - } - currentTheme = std::move(theme); - currentMetrics = &LyraMetrics::values; - LOG_DBG("UI", "Using Lyra theme"); - break; - } - case CrossPointSettings::UI_THEME::ROUNDEDRAFF: - LOG_DBG("UI", "Using RoundedRaff theme"); - currentTheme = std::make_unique(); - currentMetrics = &RoundedRaffMetrics::values; - break; - case CrossPointSettings::UI_THEME::LYRA_3_COVERS: - LOG_DBG("UI", "Using Lyra 3 Covers theme"); - currentTheme = std::make_unique(); - currentMetrics = &Lyra3CoversMetrics::values; - break; + // Lyra is the only theme. No-throw allocation so a heap-tight boot keeps + // running on the BaseTheme fallback instead of aborting. + auto theme = makeUniqueNoThrow(); + if (!theme) { + LOG_ERR("UI", "OOM: Lyra theme"); + return; } + currentTheme = std::move(theme); + currentMetrics = &LyraMetrics::values; metricsValid = false; } diff --git a/src/components/UITheme.h b/src/components/UITheme.h index d35042e056a..a433f8bf6d3 100644 --- a/src/components/UITheme.h +++ b/src/components/UITheme.h @@ -8,8 +8,6 @@ #include "CrossPointSettings.h" #include "components/themes/BaseTheme.h" -class CoverGridHomeUi; - class UITheme { // Static instance static UITheme instance; @@ -41,11 +39,7 @@ class UITheme { int maxLines, bool black = true, EpdFontFamily::Style style = EpdFontFamily::REGULAR, TextVerticalAlignment verticalAlignment = TextVerticalAlignment::CENTER); - static bool supportsCoverGrid(); - static bool hasCoverGridHome(); - static void drawCoverGridHome(CoverGridHomeUi& home); void reload(); - void setTheme(CrossPointSettings::UI_THEME type); static std::string getCoverThumbPath(std::string coverBmpPath, int coverHeight); static UIIcon getFileIcon(const std::string& filename); static int getStatusBarHeight(); diff --git a/src/components/themes/BaseTheme.h b/src/components/themes/BaseTheme.h index e4617efcf71..196e1512d42 100644 --- a/src/components/themes/BaseTheme.h +++ b/src/components/themes/BaseTheme.h @@ -47,20 +47,20 @@ struct ThemeMetrics { // uiScale fonts supply the sizes. Plain data by design — the eventual // SD-card theme files will provide exactly these values. int listRowGap; // vertical gap between rows - int listRowRadius; // row corner radius (RoundedRaff cards, Lyra pill) + int listRowRadius; // row corner radius (Lyra pill) int listInset; // horizontal inset of the whole list band int listSidePadding; // text inset within a row int listSelectionStyle; // 0=invert fill, 1=light pill, 2=underline, 3=triangle (fui::SelectionStyle order) int listScrollWidth; // scroll indicator thickness int listScrollSide; // 0 = right edge, 1 = left edge - bool listTitleBold; // bold row titles (RoundedRaff) + bool listTitleBold; // bold row titles // FreeInkUI header shape, same contract as the list fields above. int headerSidePadding; // title text inset int headerUnderlineSize; // bottom rule thickness (Lyra), 0 = none int headerTitleAlign; // 0 = left, 1 = center, 2 = right (fui::TextAlign order) int headerBatterySide; // 0 = right edge, 1 = left edge // Header clock opt-out for themes whose title layout can't spare the left - // reserve (RoundedRaff); the user setting still governs the themes that can. + // reserve; the user setting still governs the themes that can. bool headerShowsClock = true; // Clock slot: centered on the band, or on the left after the back arrow. bool headerClockCentered = true; @@ -69,10 +69,6 @@ struct ThemeMetrics { int tabSpacing; int tabBarHeight; - int coverGridTabBarHeight = 72; - // Selected-tab pill fills its equal-width slot (legacy RoundedRaff tabs) - // instead of shrinking to hug the label (legacy Lyra tabs). - bool tabPillFullSlot = false; int scrollBarWidth; int scrollBarRightOffset; @@ -150,8 +146,8 @@ enum UIIcon { Blocks }; -// Default theme implementation (Classic Theme) -// Additional themes can inherit from this and override methods as needed +// Base theme implementation. Lyra derives from it; it is also the fallback +// used when the Lyra theme cannot be allocated. namespace BaseMetrics { constexpr ThemeMetrics values = {.batteryWidth = 15, @@ -254,8 +250,7 @@ class BaseTheme { int boxHeight); virtual void drawSideButtonHints(const GfxRenderer& renderer, const char* topBtn, const char* bottomBtn) const; // Menu row height as DRAWN by drawButtonMenu. HomeActivity builds its touch - // grid from this, so hit bands always match the visuals (RoundedRaff derives - // its row height from the font, not the metrics table). + // grid from this, so hit bands always match the visuals. virtual int getMenuRowHeight(const GfxRenderer& renderer) const; // Also draws the wall clock opposite the battery when the user enabled // SETTINGS.clockShowInHeader and an RTC is present. On touch boards a @@ -301,9 +296,6 @@ class BaseTheme { virtual void drawTextField(const GfxRenderer& renderer, Rect rect, const int textWidth, bool cursorMode = false, int contentStartX = 0, int contentWidth = 0) const; virtual bool showsFileIcons() const { return false; } - // Thumb generation height for home covers; 0 means use metrics.homeCoverHeight. - // Themes with slots wider than 0.6 aspect override this so covers still fill. - virtual int homeCoverThumbHeight(const GfxRenderer&) const { return 0; } // Shared constants and helpers for battery drawing (used by all themes) static constexpr int batteryPercentSpacing = 4; diff --git a/src/components/themes/lyra/Lyra3CoversTheme.cpp b/src/components/themes/lyra/Lyra3CoversTheme.cpp deleted file mode 100644 index 793bf3b6149..00000000000 --- a/src/components/themes/lyra/Lyra3CoversTheme.cpp +++ /dev/null @@ -1,122 +0,0 @@ -#include "Lyra3CoversTheme.h" - -#include -#include - -#include -#include -#include -#include - -#include "RecentBooksStore.h" -#include "components/UITheme.h" -#include "components/icons/cover.h" -#include "fontIds.h" - -// Internal constants -namespace { -constexpr int hPaddingInSelection = 8; -constexpr int cornerRadius = 6; -} // namespace - -int Lyra3CoversTheme::homeCoverThumbHeight(const GfxRenderer& renderer) const { - const int tileWidth = (renderer.getScreenWidth() - 2 * Lyra3CoversMetrics::values.contentSidePadding) / 3; - // Thumbs cover a (0.6*h, h) target box; in landscape the tile is wider than - // 0.6 aspect, so request a taller thumb and let the draw crop vertically. - return std::max(Lyra3CoversMetrics::values.homeCoverHeight, (tileWidth - 2 * hPaddingInSelection) * 5 / 3 + 2); -} - -void Lyra3CoversTheme::drawRecentBookCover(GfxRenderer& renderer, Rect rect, const std::vector& recentBooks, - const int selectorIndex, bool& coverRendered, bool& coverBufferStored, - bool& bufferRestored, std::function storeCoverBuffer) const { - const int tileWidth = (rect.width - 2 * Lyra3CoversMetrics::values.contentSidePadding) / 3; - const int tileY = rect.y; - const bool hasContinueReading = !recentBooks.empty(); - - // Draw book card regardless, fill with message based on `hasContinueReading` - // Draw cover image as background if available (inside the box) - // Only load from SD on first render, then use stored buffer - if (hasContinueReading) { - if (!coverRendered) { - for (int i = 0; - i < std::min(static_cast(recentBooks.size()), Lyra3CoversMetrics::values.homeRecentBooksCount); i++) { - std::string coverPath = recentBooks[i].coverBmpPath; - bool hasCover = true; - int tileX = rect.x + Lyra3CoversMetrics::values.contentSidePadding + tileWidth * i; - if (coverPath.empty()) { - hasCover = false; - } else { - const std::string coverBmpPath = UITheme::getCoverThumbPath(coverPath, homeCoverThumbHeight(renderer)); - - // First time: load cover from SD and render - HalFile file; - if (Storage.openFileForRead("HOME", coverBmpPath, file)) { - Bitmap bitmap(file); - if (bitmap.parseHeaders() == BmpReaderError::Ok) { - // Fill the fixed tile 1:1 and crop the overflow; the old crop - // factor went negative for covers narrower than the tile. - drawCoverThumbFill(renderer, bitmap, - Rect{tileX + hPaddingInSelection, tileY + hPaddingInSelection, - tileWidth - 2 * hPaddingInSelection, Lyra3CoversMetrics::values.homeCoverHeight}); - } else { - hasCover = false; - } - file.close(); - } - } - // Draw either way - renderer.drawRect(tileX + hPaddingInSelection, tileY + hPaddingInSelection, tileWidth - 2 * hPaddingInSelection, - Lyra3CoversMetrics::values.homeCoverHeight, true); - - if (!hasCover) { - // Render empty cover - renderer.fillRect(tileX + hPaddingInSelection, - tileY + hPaddingInSelection + (Lyra3CoversMetrics::values.homeCoverHeight / 3), - tileWidth - 2 * hPaddingInSelection, 2 * Lyra3CoversMetrics::values.homeCoverHeight / 3, - true); - renderer.drawIcon(CoverIcon, tileX + hPaddingInSelection + 24, tileY + hPaddingInSelection + 24, 32); - } - } - - coverBufferStored = storeCoverBuffer(); - coverRendered = coverBufferStored; // Only consider it rendered if we successfully stored the buffer - } - - for (int i = 0; i < std::min(static_cast(recentBooks.size()), Lyra3CoversMetrics::values.homeRecentBooksCount); - i++) { - bool bookSelected = (selectorIndex == i); - - int tileX = rect.x + Lyra3CoversMetrics::values.contentSidePadding + tileWidth * i; - - const int maxLineWidth = tileWidth - 2 * hPaddingInSelection; - - auto titleLines = renderer.wrappedText(SMALL_FONT_ID, recentBooks[i].title.c_str(), maxLineWidth, 3); - - const int titleLineHeight = renderer.getLineHeight(SMALL_FONT_ID); - const int dynamicBlockHeight = static_cast(titleLines.size()) * titleLineHeight; - // Add a little padding below the text inside the selection box just like the top padding (5 + hPaddingSelection) - const int dynamicTitleBoxHeight = dynamicBlockHeight + hPaddingInSelection + 5; - - if (bookSelected) { - // Draw selection box - renderer.fillRoundedRect(tileX, tileY, tileWidth, hPaddingInSelection, cornerRadius, true, true, false, false, - Color::LightGray); - renderer.fillRectDither(tileX, tileY + hPaddingInSelection, hPaddingInSelection, - Lyra3CoversMetrics::values.homeCoverHeight, Color::LightGray); - renderer.fillRectDither(tileX + tileWidth - hPaddingInSelection, tileY + hPaddingInSelection, - hPaddingInSelection, Lyra3CoversMetrics::values.homeCoverHeight, Color::LightGray); - renderer.fillRoundedRect(tileX, tileY + Lyra3CoversMetrics::values.homeCoverHeight + hPaddingInSelection, - tileWidth, dynamicTitleBoxHeight, cornerRadius, false, false, true, true, - Color::LightGray); - } - - int currentY = tileY + Lyra3CoversMetrics::values.homeCoverHeight + hPaddingInSelection + 5; - for (const auto& line : titleLines) { - renderer.drawText(SMALL_FONT_ID, tileX + hPaddingInSelection, currentY, line.c_str(), true); - currentY += titleLineHeight; - } - } - } else { - drawEmptyRecents(renderer, rect); - } -} diff --git a/src/components/themes/lyra/Lyra3CoversTheme.h b/src/components/themes/lyra/Lyra3CoversTheme.h deleted file mode 100644 index b825ee85f89..00000000000 --- a/src/components/themes/lyra/Lyra3CoversTheme.h +++ /dev/null @@ -1,24 +0,0 @@ - - -#pragma once - -#include "components/themes/lyra/LyraTheme.h" - -class GfxRenderer; - -namespace Lyra3CoversMetrics { -constexpr ThemeMetrics values = [] { - ThemeMetrics v = LyraMetrics::values; - v.homeCoverTileHeight = 300; - v.homeRecentBooksCount = 3; - return v; -}(); -} // namespace Lyra3CoversMetrics - -class Lyra3CoversTheme : public LyraTheme { - public: - void drawRecentBookCover(GfxRenderer& renderer, Rect rect, const std::vector& recentBooks, - const int selectorIndex, bool& coverRendered, bool& coverBufferStored, bool& bufferRestored, - std::function storeCoverBuffer) const override; - int homeCoverThumbHeight(const GfxRenderer& renderer) const override; -}; diff --git a/src/components/themes/roundedraff/RoundedRaffTheme.cpp b/src/components/themes/roundedraff/RoundedRaffTheme.cpp deleted file mode 100644 index 83fc77fefea..00000000000 --- a/src/components/themes/roundedraff/RoundedRaffTheme.cpp +++ /dev/null @@ -1,313 +0,0 @@ -#include "RoundedRaffTheme.h" - -#include -#include -#include -#include - -#include -#include -#include - -#include "RecentBooksStore.h" -#include "components/UITheme.h" -#include "components/icons/cover.h" -#include "fontIds.h" - -namespace { -constexpr int kCoverRadius = 18; -constexpr int kMenuRadius = 30; -constexpr int kBottomRadius = 15; -constexpr int kRowRadius = 20; -constexpr int kInteractiveInsetX = 20; -constexpr int kSelectableRowGap = 6; -constexpr int kTitleFontId = UI_12_FONT_ID; // Requested main title size: 12px -constexpr int kGuideFontId = SMALL_FONT_ID; // Closest available to requested 6px - -void drawScrollBar(const GfxRenderer& renderer, Rect rect, int itemCount, int pageStartIndex, int pageItems) { - if (itemCount <= 0 || pageItems <= 0 || itemCount <= pageItems) { - return; - } - - const int barW = RoundedRaffMetrics::values.scrollBarWidth; - const int barX = rect.x + rect.width - RoundedRaffMetrics::values.scrollBarRightOffset - barW; - const int barY = rect.y; - const int barH = rect.height; - - const int thumbH = std::max(10, (barH * pageItems) / itemCount); - const int maxStart = std::max(1, itemCount - pageItems); - const int maxTravel = std::max(1, barH - thumbH); - const int clampedStart = std::clamp(pageStartIndex, 0, maxStart); - const int thumbY = barY + (clampedStart * maxTravel) / maxStart; - - renderer.fillRect(barX, thumbY, barW, thumbH); -} - -} // namespace -int coverWidth = 0; - -void RoundedRaffTheme::drawHeader(const GfxRenderer& renderer, Rect rect, const char* title, const char* subtitle, - const bool backButton) const { - // Home screen header is custom-rendered in drawRecentBookCover. - if (title == nullptr) { - return; - } - BaseTheme::drawHeader(renderer, rect, title, subtitle, backButton); -} - -void RoundedRaffTheme::drawRecentBookCover(GfxRenderer& renderer, Rect rect, const std::vector& recentBooks, - const int selectorIndex, bool& coverRendered, bool& coverBufferStored, - bool& bufferRestored, std::function storeCoverBuffer) const { - const int tileWidth = rect.width - 2 * RoundedRaffMetrics::values.contentSidePadding; - const int tileHeight = rect.height; - const int tileY = rect.y; - const bool hasContinueReading = !recentBooks.empty(); - if (coverWidth == 0) { - coverWidth = RoundedRaffMetrics::values.homeCoverHeight * 0.6; - } - const int imgY = tileY + (tileHeight - RoundedRaffMetrics::values.homeCoverHeight) / 2; - const int tileX = rect.x + RoundedRaffMetrics::values.contentSidePadding; - - // Draw book card regardless, fill with message based on `hasContinueReading` - // Draw cover image as background if available (inside the box) - // Only load from SD on first render, then use stored buffer - if (hasContinueReading) { - RecentBook book = recentBooks[0]; - if (!coverRendered) { - std::string coverPath = book.coverBmpPath; - bool hasCover = true; - if (coverPath.empty()) { - hasCover = false; - } else { - const std::string coverBmpPath = - UITheme::getCoverThumbPath(coverPath, RoundedRaffMetrics::values.homeCoverHeight); - - // First time: load cover from SD and render - HalFile file; - if (Storage.openFileForRead("HOME", coverBmpPath, file)) { - Bitmap bitmap(file); - if (bitmap.parseHeaders() == BmpReaderError::Ok) { - coverWidth = bitmap.getWidth(); - // Narrow covers come out taller than the slot; fill 1:1 and crop - // vertically instead of rescaling the dither. - drawCoverThumbFill(renderer, bitmap, - Rect{tileX + (tileWidth - coverWidth) / 2, imgY, coverWidth, - RoundedRaffMetrics::values.homeCoverHeight}); - renderer.maskRoundedRectOutsideCorners(tileX + (tileWidth - coverWidth) / 2, imgY, coverWidth, - RoundedRaffMetrics::values.homeCoverHeight, kCoverRadius, - Color::LightGray); - } else { - hasCover = false; - } - file.close(); - } - } - - // Draw either way - renderer.drawRoundedRect(tileX + (tileWidth - coverWidth) / 2, imgY, coverWidth, - RoundedRaffMetrics::values.homeCoverHeight, 1, kCoverRadius, true); - - if (!hasCover) { - // Render empty cover - renderer.fillRect(tileX + (tileWidth - coverWidth) / 2, imgY + (RoundedRaffMetrics::values.homeCoverHeight / 3), - coverWidth, 2 * RoundedRaffMetrics::values.homeCoverHeight / 3, true); - renderer.drawIcon(CoverIcon, tileX + (tileWidth - coverWidth) / 2 + 24, imgY + 24, 32); - renderer.maskRoundedRectOutsideCorners(tileX + (tileWidth - coverWidth) / 2, imgY, coverWidth, - RoundedRaffMetrics::values.homeCoverHeight, kCoverRadius, - Color::LightGray); - } - - coverBufferStored = storeCoverBuffer(); - coverRendered = coverBufferStored; // Only consider it rendered if we successfully stored the buffer - } - - renderer.fillRoundedRect(tileX, tileY, tileWidth, imgY - tileY, kRowRadius, true, true, false, false, - Color::LightGray); - renderer.fillRectDither(tileX, imgY, (tileWidth - coverWidth) / 2, RoundedRaffMetrics::values.homeCoverHeight, - Color::LightGray); - renderer.fillRectDither(tileX + (tileWidth + coverWidth) / 2, imgY, (tileWidth - coverWidth) / 2, - RoundedRaffMetrics::values.homeCoverHeight, Color::LightGray); - renderer.fillRoundedRect(tileX, imgY + RoundedRaffMetrics::values.homeCoverHeight, tileWidth, - tileHeight - (imgY - tileY + RoundedRaffMetrics::values.homeCoverHeight), kRowRadius, - false, false, true, true, Color::LightGray); - } else { - renderer.fillRoundedRect(tileX, tileY, tileWidth, tileHeight, kRowRadius, Color::LightGray); - renderer.drawCenteredText(kTitleFontId, rect.y + rect.height / 2 - renderer.getLineHeight(kTitleFontId) / 2, - tr(STR_NO_OPEN_BOOK)); - } -} - -int RoundedRaffTheme::getMenuRowHeight(const GfxRenderer& renderer) const { - return renderer.getLineHeight(kTitleFontId) + 20; // 10px top + 10px bottom -} - -void RoundedRaffTheme::drawButtonMenu(GfxRenderer& renderer, Rect rect, int buttonCount, int selectedIndex, - const std::function& buttonLabel, - const std::function& rowIcon) const { - (void)rowIcon; - const int sidePadding = RoundedRaffMetrics::values.contentSidePadding; - const int rowX = rect.x + sidePadding; - const int rowHeight = getMenuRowHeight(renderer); // shared with HomeActivity's touch grid - const int rowGap = kSelectableRowGap; - const int rowStep = rowHeight + rowGap; - const int pageItems = std::max(1, rect.height / rowStep); - const int safeSelectedIndex = std::max(0, selectedIndex); - const int pageStartIndex = (safeSelectedIndex / pageItems) * pageItems; - const int menuTop = rect.y; - const int textLineHeight = renderer.getLineHeight(kTitleFontId); - const int menuMaxWidth = std::max(0, rect.width - sidePadding * 2); - - for (int i = pageStartIndex; i < buttonCount && i < pageStartIndex + pageItems; ++i) { - const std::string label = buttonLabel(i); - const int rowY = menuTop + (i - pageStartIndex) * rowStep; - constexpr int kRowPaddingX = 40; // 20px L/R - const int maxLabelWidth = std::max(0, menuMaxWidth - kRowPaddingX); - const std::string truncatedLabel = - renderer.truncatedText(kTitleFontId, label.c_str(), maxLabelWidth, EpdFontFamily::BOLD); - const int rowWidth = std::min( - menuMaxWidth, renderer.getTextWidth(kTitleFontId, truncatedLabel.c_str(), EpdFontFamily::BOLD) + kRowPaddingX); - const bool isSelected = selectedIndex == i; - renderer.fillRoundedRect(rowX, rowY, rowWidth, rowHeight, kMenuRadius, isSelected ? Color::Black : Color::White); - const int textY = rowY + (rowHeight - textLineHeight) / 2; - const int textX = rowX + kInteractiveInsetX; - if (selectedIndex == i) { - renderer.drawText(kTitleFontId, textX, textY, truncatedLabel.c_str(), false, EpdFontFamily::BOLD); - } else { - renderer.drawText(kTitleFontId, textX, textY, truncatedLabel.c_str(), true, EpdFontFamily::BOLD); - } - } - - drawScrollBar(renderer, rect, buttonCount, pageStartIndex, pageItems); -} - -void RoundedRaffTheme::drawTextField(const GfxRenderer& renderer, Rect rect, const int textWidth, bool cursorMode, - int contentStartX, int contentWidth) const { - const auto& metrics = UITheme::getInstance().getMetrics(); - const int lineHeight = renderer.getLineHeight(UI_12_FONT_ID); - const int lineY = rect.y + rect.height + lineHeight + metrics.verticalSpacing; - const int thickness = cursorMode ? 3 : 2; - - if (contentWidth > 0) { - renderer.drawLine(rect.x + contentStartX, lineY, rect.x + contentStartX + contentWidth - 1, lineY, thickness, true); - return; - } - - constexpr int hPadding = 8; - const int lineW = textWidth + hPadding * 2; - const int lineStart = rect.x + (rect.width - lineW) / 2; - renderer.drawLine(lineStart, lineY, lineStart + lineW - 1, lineY, thickness, true); -} - -void RoundedRaffTheme::drawButtonHints(GfxRenderer& renderer, const char* btn1, const char* btn2, const char* btn3, - const char* btn4) const { - if (gpio.hasTouch()) { - return; - } - - const GfxRenderer::Orientation origOrientation = renderer.getOrientation(); - renderer.setOrientation(GfxRenderer::Orientation::Portrait); - - const int pageWidth = renderer.getScreenWidth(); - const int pageHeight = renderer.getScreenHeight(); - const int sidePadding = 20; - const int groupGap = 10; - const int bottomMargin = 10; - const int hintHeight = RoundedRaffMetrics::values.buttonHintsHeight - 10; // 30px total guide height - const int groupWidth = (pageWidth - sidePadding * 2 - groupGap) / 2; - const int hintY = pageHeight - hintHeight - bottomMargin; - const int textY = hintY + (hintHeight - renderer.getLineHeight(kGuideFontId)) / 2; - - if (renderer.getRenderMode() != GfxRenderer::BW && !renderer.grayPlanesAreAbsolute()) { - renderer.fillRect(sidePadding, hintY, groupWidth, hintHeight, true); - renderer.fillRect(sidePadding + groupWidth + groupGap, hintY, groupWidth, hintHeight, true); - renderer.setOrientation(origOrientation); - return; - } - - const bool backDisabled = (btn1 == nullptr || btn1[0] == '\0'); - const int leftGroupX = sidePadding; - const int rightGroupX = leftGroupX + groupWidth + groupGap; - const std::string backLabel = backDisabled ? "" : std::string(btn1); - // Callers should provide the button labels. If a label is not specified, it should render empty. - const std::string selectText = (btn2 && btn2[0] != '\0') ? std::string(btn2) : ""; - const std::string upText = (btn3 && btn3[0] != '\0') ? std::string(btn3) : ""; - const std::string downText = (btn4 && btn4[0] != '\0') ? std::string(btn4) : ""; - - // Ensure button hints always "win" visually even if other elements accidentally render into this area. - renderer.fillRect(leftGroupX, hintY, groupWidth, hintHeight, false); - renderer.fillRect(rightGroupX, hintY, groupWidth, hintHeight, false); - - renderer.drawRoundedRect(leftGroupX, hintY, groupWidth, hintHeight, 2, kBottomRadius, true); - const int selectWidth = renderer.getTextWidth(kGuideFontId, selectText.c_str(), EpdFontFamily::REGULAR); - const int downWidth = renderer.getTextWidth(kGuideFontId, downText.c_str(), EpdFontFamily::REGULAR); - constexpr int innerEdgePadding = 16; - - const int backX = leftGroupX + innerEdgePadding; - const int selectX = leftGroupX + groupWidth - innerEdgePadding - selectWidth; - const int upX = rightGroupX + innerEdgePadding; - const int downX = rightGroupX + groupWidth - innerEdgePadding - downWidth; - - if (!backDisabled) { - renderer.drawText(kGuideFontId, backX, textY, backLabel.c_str(), true, EpdFontFamily::REGULAR); - } - renderer.drawText(kGuideFontId, selectX, textY, selectText.c_str(), true, EpdFontFamily::REGULAR); - - renderer.drawRoundedRect(rightGroupX, hintY, groupWidth, hintHeight, 2, kBottomRadius, true); - - renderer.drawText(kGuideFontId, upX, textY, upText.c_str(), true, EpdFontFamily::REGULAR); - renderer.drawText(kGuideFontId, downX, textY, downText.c_str(), true, EpdFontFamily::REGULAR); - - renderer.setOrientation(origOrientation); - - // Landscape mode: draw hints on the side edge, aligned with physical button location. - if (origOrientation == GfxRenderer::LandscapeClockwise || origOrientation == GfxRenderer::LandscapeCounterClockwise) { - drawButtonHintsLandscapeRoundedRaff(renderer, btn1, btn2, btn3, btn4); - } -} - -void RoundedRaffTheme::drawButtonHintsLandscapeRoundedRaff(const GfxRenderer& renderer, const char* btn1, - const char* btn2, const char* btn3, const char* btn4) const { - const int screenWidth = renderer.getScreenWidth(); - const int screenH = renderer.getScreenHeight(); - // In landscape, buttons sit on the side edge. Width becomes height, height becomes width. - // Two groups of 2 buttons each, stacked vertically on the side edge. - constexpr int portraitPanelWidth = 480; - const float spacingScale = static_cast(screenH) / portraitPanelWidth; - constexpr int sidePadding = 20; - const int groupWidth = static_cast((screenWidth - sidePadding * 2 - 10) / 2); - const int hintHeight = 30; // buttonHintsHeight - 10 - const int hintY = static_cast((screenH - hintHeight - 10) * spacingScale); - const int edgeX = - renderer.getOrientation() == GfxRenderer::LandscapeClockwise ? 0 : static_cast(screenWidth - hintHeight); - const int textY = hintY + (hintHeight - renderer.getLineHeight(kGuideFontId)) / 2; - constexpr int innerEdgePadding = 16; - - // Left group (back + select) - const bool backDisabled = (btn1 == nullptr || btn1[0] == '\0'); - const std::string backLabel = backDisabled ? "" : std::string(btn1); - const std::string selectText = (btn2 && btn2[0] != '\0') ? std::string(btn2) : ""; - - renderer.fillRect(edgeX, hintY, hintHeight, groupWidth, false); - renderer.drawRoundedRect(edgeX, hintY, hintHeight, groupWidth, 2, kBottomRadius, true); - // Rotate 90° CW: draw text running vertically - const int backX = edgeX + innerEdgePadding; - const int selectX = edgeX + groupWidth - innerEdgePadding - - renderer.getTextWidth(kGuideFontId, selectText.c_str(), EpdFontFamily::REGULAR); - if (!backDisabled) { - renderer.drawText(kGuideFontId, backX, textY, backLabel.c_str(), true, EpdFontFamily::REGULAR); - } - renderer.drawText(kGuideFontId, selectX, textY, selectText.c_str(), true, EpdFontFamily::REGULAR); - - // Right group (up + down) - const std::string upText = (btn3 && btn3[0] != '\0') ? std::string(btn3) : ""; - const std::string downText = (btn4 && btn4[0] != '\0') ? std::string(btn4) : ""; - - const int rightGroupX = edgeX + groupWidth + 10; - renderer.fillRect(rightGroupX, hintY, hintHeight, groupWidth, false); - renderer.drawRoundedRect(rightGroupX, hintY, hintHeight, groupWidth, 2, kBottomRadius, true); - const int upX = rightGroupX + innerEdgePadding; - const int downX = rightGroupX + groupWidth - innerEdgePadding - - renderer.getTextWidth(kGuideFontId, downText.c_str(), EpdFontFamily::REGULAR); - renderer.drawText(kGuideFontId, upX, textY, upText.c_str(), true, EpdFontFamily::REGULAR); - renderer.drawText(kGuideFontId, downX, textY, downText.c_str(), true, EpdFontFamily::REGULAR); -} diff --git a/src/components/themes/roundedraff/RoundedRaffTheme.h b/src/components/themes/roundedraff/RoundedRaffTheme.h deleted file mode 100644 index b2f6f5888b2..00000000000 --- a/src/components/themes/roundedraff/RoundedRaffTheme.h +++ /dev/null @@ -1,110 +0,0 @@ -#pragma once - -#include "components/themes/BaseTheme.h" - -class GfxRenderer; - -namespace RoundedRaffMetrics { -constexpr ThemeMetrics values = {.batteryWidth = 15, - .batteryHeight = 12, - // Fit the 23px SMALL_FONT_ID line box and lift it one pixel while - // keeping the 12px battery glyph at y=19, aligned with Lyra. - .topPadding = 13, - .batteryBarHeight = 24, - .headerHeight = 84, - .verticalSpacing = 10, - .previewPadding = 12, - .previewHeightPercent = 30, - .contentSidePadding = 20, - .listRowHeight = 42, - .listWithSubtitleRowHeight = 69, - .listRowGap = 6, - .listRowRadius = 20, - .listInset = 20, - .listSidePadding = 20, - .listSelectionStyle = 0, // invert fill (black card) - .listScrollWidth = 4, - .listScrollSide = 0, - .listTitleBold = true, - .headerSidePadding = 18, - .headerUnderlineSize = 0, - .headerTitleAlign = 0, // left - .headerBatterySide = 0, - // A centered clock needs no left title reserve, so RoundedRaff - // can show one after all. - .headerShowsClock = true, - .menuRowHeight = 42, // not authoritative: getMenuRowHeight() derives the drawn height - .menuSpacing = 6, - .tabSpacing = 10, - .tabBarHeight = 50, - .tabPillFullSlot = true, - .scrollBarWidth = 4, - .scrollBarRightOffset = 5, - // Tall enough that the home band's centered book title clears the - // battery strip above and keeps padding below. - .homeTopPadding = 64, - // Smaller cover tile so the home menu sits higher (fits 5 items - // without overlap); shrunk by the homeTopPadding growth above so - // the menu keeps its position. - .homeCoverHeight = 300, - .homeCoverTileHeight = 341, - .homeRecentBooksCount = 1, - .homeContinueReadingInMenu = true, - .homeMenuTopOffset = 20, - .buttonHintsHeight = 40, - .sideButtonHintsWidth = 30, - .progressBarHeight = 16, - .progressBarMarginTop = 1, - .statusBarHorizontalMargin = 5, - .statusBarVerticalMargin = 19, - .keyboardKeyHeight = 56, - .keyboardKeySpacing = 10, - .keyboardCenteredText = false, - .keyboardVerticalOffset = 0, - .keyboardTextFieldWidthPercent = 85, - .keyboardWidthPercent = 94, - .popupTopOffsetRatio = 0.12f, - .popupMarginX = 20, - .popupMarginY = 14, - .popupFrameThickness = 2, - .popupCornerRadius = 18, - .popupTextBold = true, - .popupTextInverted = false, - .popupTextBaselineOffsetY = -2, - .popupProgressBarHeight = 4, - .popupProgressDrawOutline = true, - .popupProgressClampPercent = true, - .popupProgressFillInverted = false, - .popupProgressOutlineInverted = false, - .optionPopupItemSpacing = 6, - .optionPopupInnerPadding = 24, - .optionPopupSelectionVPadding = 10, - .optionPopupDialogSideMargin = 20, - .textFieldHorizontalPadding = 8, - .textFieldNormalThickness = 2, - .textFieldCursorThickness = 3, - .textFieldLineEndOffset = -1, - .controlRadius = 18, - .sheetRadius = 18, - .capsuleRadius = 255}; -} - -class RoundedRaffTheme : public BaseTheme { - public: - void drawHeader(const GfxRenderer& renderer, Rect rect, const char* title, const char* subtitle = nullptr, - bool backButton = true) const override; - void drawRecentBookCover(GfxRenderer& renderer, Rect rect, const std::vector& recentBooks, - int selectorIndex, bool& coverRendered, bool& coverBufferStored, bool& bufferRestored, - std::function storeCoverBuffer) const override; - int getMenuRowHeight(const GfxRenderer& renderer) const override; - void drawButtonMenu(GfxRenderer& renderer, Rect rect, int buttonCount, int selectedIndex, - const std::function& buttonLabel, - const std::function& rowIcon) const override; - void drawTextField(const GfxRenderer& renderer, Rect rect, int textWidth, bool cursorMode = false, - int contentStartX = 0, int contentWidth = 0) const override; - void drawButtonHints(GfxRenderer& renderer, const char* btn1, const char* btn2, const char* btn3, - const char* btn4) const override; - // Landscape-mode button hints drawn on the side edge. - void drawButtonHintsLandscapeRoundedRaff(const GfxRenderer& renderer, const char* btn1, const char* btn2, - const char* btn3, const char* btn4) const; -}; diff --git a/test/test_text_settings_layout.py b/test/test_text_settings_layout.py index 9aff5ef1c9a..93807f74634 100644 --- a/test/test_text_settings_layout.py +++ b/test/test_text_settings_layout.py @@ -58,7 +58,6 @@ def method(source, signature): #include #include #include -#include #include #include #include @@ -392,7 +391,7 @@ def method(source, signature): BoardConfig::XTEINK_X4, BoardConfig::XTEINK_X4_CLASSIC}) for (auto orientation : {GfxRenderer::Portrait, GfxRenderer::PortraitInverted, GfxRenderer::LandscapeClockwise, GfxRenderer::LandscapeCounterClockwise}) - for (const auto& metrics : {LyraMetrics::values, RoundedRaffMetrics::values}) + for (const auto& metrics : {LyraMetrics::values}) checkStyleRowsFit(profile, orientation, metrics); for (const auto& profile : {BoardConfig::XTEINK_X3, BoardConfig::XTEINK_X3_UC8279, BoardConfig::XTEINK_X4, BoardConfig::XTEINK_X4_PRO, BoardConfig::XTEINK_X4_CLASSIC, BoardConfig::STICKY, @@ -400,7 +399,7 @@ def method(source, signature): BoardConfig::PICCO}) for (auto orientation : {GfxRenderer::Portrait, GfxRenderer::PortraitInverted, GfxRenderer::LandscapeClockwise, GfxRenderer::LandscapeCounterClockwise}) - for (const auto& metrics : {LyraMetrics::values, RoundedRaffMetrics::values}) + for (const auto& metrics : {LyraMetrics::values}) for (Tab tab : {Tab::Family, Tab::Size, Tab::Layout, Tab::Style}) checkLayout(profile, orientation, metrics, tab); checkSharedPartialRows(); From 52d00ef90e871b1ca7a2749f33ded30c360556bc Mon Sep 17 00:00:00 2001 From: Raxcoms Date: Sat, 21 Nov 2026 00:13:11 -0300 Subject: [PATCH 09/20] fix(ui): align landscape hint rail to physical buttons 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. --- src/components/themes/BaseTheme.cpp | 62 ++++++++++++------------ src/components/themes/lyra/LyraTheme.cpp | 56 ++++++++++----------- 2 files changed, 60 insertions(+), 58 deletions(-) diff --git a/src/components/themes/BaseTheme.cpp b/src/components/themes/BaseTheme.cpp index ec5fecaddae..f48ab18120d 100644 --- a/src/components/themes/BaseTheme.cpp +++ b/src/components/themes/BaseTheme.cpp @@ -218,20 +218,30 @@ void BaseTheme::drawButtonHints(GfxRenderer& renderer, const char* btn1, const c } const GfxRenderer::Orientation orig_orientation = renderer.getOrientation(); - renderer.setOrientation(GfxRenderer::Orientation::Portrait); + const bool landscape = + orig_orientation == GfxRenderer::LandscapeClockwise || orig_orientation == GfxRenderer::LandscapeCounterClockwise; - const int pageHeight = renderer.getScreenHeight(); constexpr int buttonWidth = 106; constexpr int buttonHeight = BaseMetrics::values.buttonHintsHeight; - constexpr int buttonY = BaseMetrics::values.buttonHintsHeight; // Distance from bottom - // Keyed to the portrait panel width: the 528-wide X3 gets more spacing than - // the 480-wide boards (X4, X4 Pro, and the other 800x480 panels). constexpr int narrowButtonPositions[] = {25, 130, 245, 350}; constexpr int wideButtonPositions[] = {38, 154, 268, 384}; - const int* buttonPositions = renderer.getScreenWidth() >= 528 ? wideButtonPositions : narrowButtonPositions; + // Keyed to the portrait panel width: the 528-wide X3 gets more spacing than + // the 480-wide boards (X4, X4 Pro, and the other 800x480 panels). In + // landscape the portrait width is the logical screen height. + const int portraitWidth = landscape ? renderer.getScreenHeight() : renderer.getScreenWidth(); + const int* buttonPositions = portraitWidth >= 528 ? wideButtonPositions : narrowButtonPositions; const char* labels[] = {btn1, btn2, btn3, btn4}; const bool grayscale = renderer.getRenderMode() != GfxRenderer::BW && !renderer.grayPlanesAreAbsolute(); + if (landscape) { + drawButtonHintsLandscape(renderer, labels, grayscale, buttonWidth, buttonHeight, buttonPositions); + return; + } + + renderer.setOrientation(GfxRenderer::Orientation::Portrait); + const int pageHeight = renderer.getScreenHeight(); + const int buttonY = buttonHeight; // Distance from bottom + for (int i = 0; i < 4; i++) { // Only draw if the label is non-empty if (labels[i] != nullptr && labels[i][0] != '\0') { @@ -245,43 +255,33 @@ void BaseTheme::drawButtonHints(GfxRenderer& renderer, const char* btn1, const c } renderer.setOrientation(orig_orientation); - - // Landscape mode: draw hints on the side edge, aligned with physical button location. - if (orig_orientation == GfxRenderer::LandscapeClockwise || - orig_orientation == GfxRenderer::LandscapeCounterClockwise) { - drawButtonHintsLandscape(renderer, labels, grayscale, buttonWidth, buttonHeight, buttonPositions); - } } void BaseTheme::drawButtonHintsLandscape(const GfxRenderer& renderer, const char* const labels[], const bool grayscale, const int buttonWidth, const int buttonHeight, const int* const buttonPositions) { const int screenWidth = renderer.getScreenWidth(); - const int screenH = renderer.getScreenHeight(); - // In landscape, buttons sit on the side edge. Width becomes height, height becomes width. - // Button labels are drawn rotated 90°. - const int hintWidth = buttonHeight; // depth into screen - const int hintHeight = buttonWidth; // vertical extent - const int edgeX = - renderer.getOrientation() == GfxRenderer::LandscapeClockwise ? 0 : static_cast(screenWidth - hintWidth); - // Vertical spacing: distribute buttons across the portrait-height dimension (now screen height). - // Use the same portrait panel width as the spacing reference (480 or 528). - constexpr int portraitPanelWidth = 480; - const float spacingScale = static_cast(screenH) / portraitPanelWidth; + const int screenHeight = renderer.getScreenHeight(); + const bool clockwise = renderer.getOrientation() == GfxRenderer::LandscapeClockwise; + // In landscape the buttons sit on a side edge. The rail boxes mirror the + // portrait band's panel footprint, which is placed to match the physical + // button positions, so every box lands over its button in both rotations. + const int hintWidth = buttonHeight; // depth into the screen + const int boxSpan = buttonWidth; // extent along the screen edge + const int edgeX = clockwise ? 0 : screenWidth - hintWidth; for (int i = 0; i < 4; i++) { if (labels[i] == nullptr || labels[i][0] == '\0') continue; - const int y = static_cast(buttonPositions[i] * spacingScale); - const int bx = edgeX; - const int by = y - hintHeight / 2; - renderer.fillRect(bx, by, hintWidth, hintHeight, grayscale); + const int by = clockwise ? buttonPositions[i] : screenHeight - boxSpan - buttonPositions[i]; + renderer.fillRect(edgeX, by, hintWidth, boxSpan, grayscale); if (grayscale) continue; - renderer.drawRect(bx, by, hintWidth, hintHeight); - // Draw rotated label: text runs vertically, centered in the hint box. + renderer.drawRect(edgeX, by, hintWidth, boxSpan); + // Rotated text starts at the anchor and runs toward smaller y, so the + // start lands at the box bottom plus half the slack. const int textW = renderer.getTextWidth(UI_10_FONT_ID, labels[i]); const int textH = renderer.getTextHeight(UI_10_FONT_ID); - const int textX = bx + (hintWidth - textH) / 2; - const int textY = by + (hintHeight - textW) / 2; + const int textX = edgeX + (hintWidth - textH) / 2; + const int textY = by + (boxSpan + textW) / 2; renderer.drawTextRotated90CW(UI_10_FONT_ID, textX, textY, labels[i]); } } diff --git a/src/components/themes/lyra/LyraTheme.cpp b/src/components/themes/lyra/LyraTheme.cpp index 0e03455495b..59024fadbe8 100644 --- a/src/components/themes/lyra/LyraTheme.cpp +++ b/src/components/themes/lyra/LyraTheme.cpp @@ -112,21 +112,32 @@ void LyraTheme::drawButtonHints(GfxRenderer& renderer, const char* btn1, const c } const GfxRenderer::Orientation orig_orientation = renderer.getOrientation(); - renderer.setOrientation(GfxRenderer::Orientation::Portrait); + const bool landscape = + orig_orientation == GfxRenderer::LandscapeClockwise || orig_orientation == GfxRenderer::LandscapeCounterClockwise; - const int pageHeight = renderer.getScreenHeight(); constexpr int buttonWidth = 80; constexpr int smallButtonHeight = 15; constexpr int buttonHeight = LyraMetrics::values.buttonHintsHeight; - constexpr int buttonY = LyraMetrics::values.buttonHintsHeight; // Distance from bottom // Keyed to the portrait panel width: the 528-wide X3 gets more spacing than // the 480-wide boards (X4, X4 Pro, and the other 800x480 panels). constexpr int narrowButtonPositions[] = {58, 146, 254, 342}; constexpr int wideButtonPositions[] = {65, 157, 291, 383}; - const int* buttonPositions = renderer.getScreenWidth() >= 528 ? wideButtonPositions : narrowButtonPositions; + // In landscape the portrait width is the logical screen height. + const int portraitWidth = landscape ? renderer.getScreenHeight() : renderer.getScreenWidth(); + const int* buttonPositions = portraitWidth >= 528 ? wideButtonPositions : narrowButtonPositions; const char* labels[] = {btn1, btn2, btn3, btn4}; const bool grayscale = renderer.getRenderMode() != GfxRenderer::BW && !renderer.grayPlanesAreAbsolute(); + if (landscape) { + drawButtonHintsLandscapeLyra(renderer, labels, grayscale, buttonWidth, buttonHeight, buttonPositions); + return; + } + + renderer.setOrientation(GfxRenderer::Orientation::Portrait); + + const int pageHeight = renderer.getScreenHeight(); + const int buttonY = buttonHeight; // Distance from bottom + for (int i = 0; i < 4; i++) { const int x = buttonPositions[i]; if (labels[i] != nullptr && labels[i][0] != '\0') { @@ -148,41 +159,32 @@ void LyraTheme::drawButtonHints(GfxRenderer& renderer, const char* btn1, const c } renderer.setOrientation(orig_orientation); - - // Landscape mode: draw hints on the side edge, aligned with physical button location. - if (orig_orientation == GfxRenderer::LandscapeClockwise || - orig_orientation == GfxRenderer::LandscapeCounterClockwise) { - drawButtonHintsLandscapeLyra(renderer, labels, grayscale, buttonWidth, buttonHeight, buttonPositions); - } } void LyraTheme::drawButtonHintsLandscapeLyra(const GfxRenderer& renderer, const char* const labels[], const bool grayscale, const int buttonWidth, const int buttonHeight, const int* const buttonPositions) const { const int screenWidth = renderer.getScreenWidth(); - const int screenH = renderer.getScreenHeight(); - // In landscape, buttons sit on the side edge. Width becomes height, height becomes width. - const int hintWidth = buttonHeight; // depth into screen - const int hintHeight = buttonWidth; // vertical extent - const int edgeX = - renderer.getOrientation() == GfxRenderer::LandscapeClockwise ? 0 : static_cast(screenWidth - hintWidth); - // Vertical spacing: distribute buttons across the portrait-height dimension (now screen height). - constexpr int portraitPanelWidth = 480; - const float spacingScale = static_cast(screenH) / portraitPanelWidth; + const int screenHeight = renderer.getScreenHeight(); + const bool clockwise = renderer.getOrientation() == GfxRenderer::LandscapeClockwise; + // Mirror the portrait band's panel footprint so each rail box sits over its + // physical button, same as BaseTheme::drawButtonHintsLandscape. + const int hintWidth = buttonHeight; // depth into the screen + const int boxSpan = buttonWidth; // extent along the screen edge + const int edgeX = clockwise ? 0 : screenWidth - hintWidth; for (int i = 0; i < 4; i++) { if (labels[i] == nullptr || labels[i][0] == '\0') continue; - const int y = static_cast(buttonPositions[i] * spacingScale); - const int bx = edgeX; - const int by = y - hintHeight / 2; - renderer.fillRoundedRect(bx, by, hintWidth, hintHeight, cornerRadius, grayscale ? Color::Black : Color::White); + const int by = clockwise ? buttonPositions[i] : screenHeight - boxSpan - buttonPositions[i]; + renderer.fillRoundedRect(edgeX, by, hintWidth, boxSpan, cornerRadius, grayscale ? Color::Black : Color::White); if (grayscale) continue; - renderer.drawRoundedRect(bx, by, hintWidth, hintHeight, 1, cornerRadius, true, true, false, false, true); - // Draw rotated label: text runs vertically, centered in the hint box. + renderer.drawRoundedRect(edgeX, by, hintWidth, boxSpan, 1, cornerRadius, true, true, false, false, true); + // Rotated text starts at the anchor and runs toward smaller y, so the + // start lands at the box bottom plus half the slack. const int textW = renderer.getTextWidth(SMALL_FONT_ID, labels[i]); const int textH = renderer.getTextHeight(SMALL_FONT_ID); - const int textX = bx + (hintWidth - textH) / 2; - const int textY = by + (hintHeight - textW) / 2; + const int textX = edgeX + (hintWidth - textH) / 2; + const int textY = by + (boxSpan + textW) / 2; renderer.drawTextRotated90CW(SMALL_FONT_ID, textX, textY, labels[i]); } } From 80fff59faf13d21deac69bdf48b47cc0d91cdaae Mon Sep 17 00:00:00 2001 From: Raxcoms Date: Sat, 21 Nov 2026 00:53:28 -0300 Subject: [PATCH 10/20] fix(ui): reserve the landscape hint rail in FUI screens 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. --- src/activities/home/FileBrowserActivity.cpp | 2 +- .../library/LibraryListActivity.cpp | 12 ++++++---- .../network/NetworkModeSelectionActivity.cpp | 2 +- src/activities/network/UsbDriveActivity.cpp | 2 +- .../reader/DictionaryDefinitionActivity.cpp | 22 +++++++---------- .../reader/EpubReaderBookmarksActivity.cpp | 12 ++++------ src/activities/settings/AboutActivity.cpp | 2 +- .../settings/BleSettingsActivity.cpp | 2 +- .../settings/ButtonRemapActivity.cpp | 8 ++++--- .../settings/ClockSettingsActivity.cpp | 2 +- .../settings/FontDownloadActivity.cpp | 2 +- .../settings/HomeButtonSettingsActivity.cpp | 2 +- .../settings/KOReaderSettingsActivity.cpp | 2 +- .../settings/KeyboardLayoutsActivity.cpp | 2 +- .../settings/OpdsServerListActivity.cpp | 3 ++- .../settings/OpdsSettingsActivity.cpp | 3 ++- src/activities/settings/SettingsActivity.cpp | 2 +- .../settings/SettingsListActivity.cpp | 2 +- .../settings/StatusBarSettingsActivity.cpp | 5 ++-- .../settings/TimezonePickerActivity.cpp | 2 +- src/activities/util/KeyboardEntryActivity.cpp | 24 ++++++++++++------- src/components/CatalogScreens.cpp | 2 +- src/components/UITheme.cpp | 21 ++++++++++++++++ src/components/UITheme.h | 9 +++++++ src/components/UiAppHost.cpp | 16 +++++++++++-- src/components/UiAppHost.h | 6 ++++- 26 files changed, 112 insertions(+), 57 deletions(-) diff --git a/src/activities/home/FileBrowserActivity.cpp b/src/activities/home/FileBrowserActivity.cpp index 3ea42432b2e..5129ea1287e 100644 --- a/src/activities/home/FileBrowserActivity.cpp +++ b/src/activities/home/FileBrowserActivity.cpp @@ -611,7 +611,7 @@ void FileBrowserActivity::buildScreen(UiScreen& screen) { const auto& metrics = UITheme::getInstance().getMetrics(); // Content below the GUI.drawHeader band, above the button hints. screen.setContentMarginFromScreen(fui::Insets{static_cast(metrics.topPadding + metrics.headerHeight), 0, - static_cast(metrics.buttonHintsHeight), 0}); + UITheme::getHintBandBottomInset(renderer), 0}); screen.spacer(static_cast(metrics.verticalSpacing)); // Full path band at the bottom: separator on top, left-truncated so the diff --git a/src/activities/library/LibraryListActivity.cpp b/src/activities/library/LibraryListActivity.cpp index 0f16eb0b7de..9acf1d20796 100644 --- a/src/activities/library/LibraryListActivity.cpp +++ b/src/activities/library/LibraryListActivity.cpp @@ -1011,7 +1011,7 @@ void LibraryListActivity::buildScreen(UiScreen& screen) { buildHeader(screen); screen.setContentMarginFromScreen( fui::Insets{static_cast(metrics.topPadding + metrics.headerHeight), 0, - static_cast(bottomInset + metrics.buttonHintsHeight + readoutReserved), 0}); + static_cast(bottomInset + UITheme::getHintBandBottomInset(renderer) + readoutReserved), 0}); if (!degraded) buildTabBar(screen); if (bookRowCount() == 0) { @@ -1046,9 +1046,11 @@ void LibraryListActivity::drawPositionReadout() const { const int width = renderer.getTextWidth(SMALL_FONT_ID, buf); // Bottom-right of the viewable area, clear of the bezel and rounded corner. const Rect area = UITheme::getContentArea(renderer); - const int right = std::max(renderer.getScreenWidth() - area.x - area.width, bottomCornerClearance()); + const int right = std::max(renderer.getScreenWidth() - area.x - area.width, bottomCornerClearance()) + + UITheme::getHintRailRightGutter(renderer); const int x = renderer.getScreenWidth() - right - width - SIDE_PADDING; - const int y = area.y + area.height - metrics.buttonHintsHeight - renderer.getLineHeight(SMALL_FONT_ID); + const int y = + area.y + area.height - UITheme::getHintBandBottomInset(renderer) - renderer.getLineHeight(SMALL_FONT_ID); renderer.drawText(SMALL_FONT_ID, x, y, buf, true); } @@ -1073,8 +1075,8 @@ void LibraryListActivity::drawHoldHelp() const { const auto& metrics = UITheme::getInstance().getMetrics(); const int lineHeight = renderer.getLineHeight(SMALL_FONT_ID); const Rect area = UITheme::getContentArea(renderer); - const int left = std::max(area.x, bottomCornerClearance()); - const int y = area.y + area.height - metrics.buttonHintsHeight - lineHeight; + const int left = std::max(area.x, bottomCornerClearance()) + UITheme::getHintRailLeftGutter(renderer); + const int y = area.y + area.height - UITheme::getHintBandBottomInset(renderer) - lineHeight; GUI.drawHelpText(renderer, Rect{left + SIDE_PADDING, y, renderer.getScreenWidth() / 2 - left - SIDE_PADDING, lineHeight}, help); } diff --git a/src/activities/network/NetworkModeSelectionActivity.cpp b/src/activities/network/NetworkModeSelectionActivity.cpp index fbb075d6ab5..1d92b24607c 100644 --- a/src/activities/network/NetworkModeSelectionActivity.cpp +++ b/src/activities/network/NetworkModeSelectionActivity.cpp @@ -67,7 +67,7 @@ void NetworkModeSelectionActivity::buildScreen(UiScreen& screen) { const auto& metrics = UITheme::getInstance().getMetrics(); // Content below the GUI.drawHeader band, above the button hints. screen.setContentMarginFromScreen(fui::Insets{static_cast(metrics.topPadding + metrics.headerHeight), 0, - static_cast(metrics.buttonHintsHeight), 0}); + UITheme::getHintBandBottomInset(renderer), 0}); screen.spacer(static_cast(metrics.verticalSpacing)); // rowItems_ was built once in the constructor and is reused here on every diff --git a/src/activities/network/UsbDriveActivity.cpp b/src/activities/network/UsbDriveActivity.cpp index 2cbb7da4e43..d910ca83ad0 100644 --- a/src/activities/network/UsbDriveActivity.cpp +++ b/src/activities/network/UsbDriveActivity.cpp @@ -153,7 +153,7 @@ void UsbDriveActivity::buildDriveScreen(UiScreen& screen) const { const auto& metrics = UITheme::getInstance().getMetrics(); screen.setContentMarginFromScreen(fui::Insets{ static_cast(metrics.topPadding + metrics.headerHeight), static_cast(metrics.contentSidePadding), - static_cast(metrics.buttonHintsHeight), static_cast(metrics.contentSidePadding)}); + UITheme::getHintBandBottomInset(renderer), static_cast(metrics.contentSidePadding)}); auto messageStyle = screen.theme().smallText; messageStyle.align = fui::TextAlign::Center; diff --git a/src/activities/reader/DictionaryDefinitionActivity.cpp b/src/activities/reader/DictionaryDefinitionActivity.cpp index c857edcf77d..022752877ab 100644 --- a/src/activities/reader/DictionaryDefinitionActivity.cpp +++ b/src/activities/reader/DictionaryDefinitionActivity.cpp @@ -161,20 +161,16 @@ void DictionaryDefinitionActivity::onExit() { DictionaryDefinitionActivity::BodyArea DictionaryDefinitionActivity::bodyArea() const { const auto& metrics = UITheme::getInstance().getMetrics(); const auto orientation = renderer.getOrientation(); - const bool isLandscape = orientation == GfxRenderer::Orientation::LandscapeClockwise || - orientation == GfxRenderer::Orientation::LandscapeCounterClockwise; const bool isInverted = orientation == GfxRenderer::Orientation::PortraitInverted; - const int hintGutterWidth = isLandscape ? metrics.sideButtonHintsWidth : 0; int top, right, bottom, left; renderer.getOrientedViewableTRBL(&top, &right, &bottom, &left); - const int contentLeft = - std::max(left, orientation == GfxRenderer::Orientation::LandscapeClockwise ? hintGutterWidth : 0); - const int contentRight = - std::max(right, orientation == GfxRenderer::Orientation::LandscapeCounterClockwise ? hintGutterWidth : 0); + const int contentLeft = std::max(left, static_cast(UITheme::getHintRailLeftGutter(renderer))); + const int contentRight = std::max(right, static_cast(UITheme::getHintRailRightGutter(renderer))); const int x = contentLeft + metrics.contentSidePadding; const int y = std::max(top, isInverted ? metrics.buttonHintsHeight : 0) + metrics.topPadding + metrics.headerHeight + metrics.verticalSpacing; - const int bottomArea = std::max(bottom, metrics.buttonHintsHeight) + metrics.verticalSpacing; + const int bottomArea = + std::max(bottom, static_cast(UITheme::getHintBandBottomInset(renderer))) + metrics.verticalSpacing; return {x, y, renderer.getScreenWidth() - contentLeft - contentRight - 2 * metrics.contentSidePadding, renderer.getScreenHeight() - y - bottomArea}; } @@ -707,12 +703,12 @@ void DictionaryDefinitionActivity::render(RenderLock&&) { const auto& metrics = UITheme::getInstance().getMetrics(); const auto orientation = renderer.getOrientation(); - const bool isLandscapeCw = orientation == GfxRenderer::Orientation::LandscapeClockwise; - const bool isLandscapeCcw = orientation == GfxRenderer::Orientation::LandscapeCounterClockwise; const bool isInverted = orientation == GfxRenderer::Orientation::PortraitInverted; - const int hintGutterWidth = (isLandscapeCw || isLandscapeCcw) ? metrics.sideButtonHintsWidth : 0; - const int contentX = isLandscapeCw ? hintGutterWidth : 0; - const int contentWidth = renderer.getScreenWidth() - hintGutterWidth; + // The header band stops short of the landscape hint rail on its edge. + const int railLeft = static_cast(UITheme::getHintRailLeftGutter(renderer)); + const int railRight = static_cast(UITheme::getHintRailRightGutter(renderer)); + const int contentX = railLeft; + const int contentWidth = renderer.getScreenWidth() - railLeft - railRight; const int contentY = isInverted ? metrics.buttonHintsHeight : 0; char counter[16] = {}; diff --git a/src/activities/reader/EpubReaderBookmarksActivity.cpp b/src/activities/reader/EpubReaderBookmarksActivity.cpp index 22d8b188731..4aaec95ee8f 100644 --- a/src/activities/reader/EpubReaderBookmarksActivity.cpp +++ b/src/activities/reader/EpubReaderBookmarksActivity.cpp @@ -287,15 +287,13 @@ void EpubReaderBookmarksActivity::render(RenderLock&&) { const auto pageWidth = renderer.getScreenWidth(); const auto orientation = renderer.getOrientation(); - // Landscape orientation: reserve a horizontal gutter for button hints. - const bool isLandscapeCw = orientation == GfxRenderer::Orientation::LandscapeClockwise; - const bool isLandscapeCcw = orientation == GfxRenderer::Orientation::LandscapeCounterClockwise; // Inverted portrait: reserve vertical space for hints at the top. const bool isPortraitInverted = orientation == GfxRenderer::Orientation::PortraitInverted; - const int hintGutterWidth = (isLandscapeCw || isLandscapeCcw) ? 40 : 0; - // Landscape CW places hints on the left edge; CCW keeps them on the right. - const int contentX = isLandscapeCw ? hintGutterWidth : 0; - const int contentWidth = pageWidth - hintGutterWidth; + // Landscape: the hint rail occupies one edge, left for CW and right for CCW. + const int railLeft = static_cast(UITheme::getHintRailLeftGutter(renderer)); + const int railRight = static_cast(UITheme::getHintRailRightGutter(renderer)); + const int contentX = railLeft; + const int contentWidth = pageWidth - railLeft - railRight; const int contentY = isPortraitInverted ? 50 : 0; // Manual centering to honor content gutters. diff --git a/src/activities/settings/AboutActivity.cpp b/src/activities/settings/AboutActivity.cpp index b03c40ee1ba..eab8cce27a1 100644 --- a/src/activities/settings/AboutActivity.cpp +++ b/src/activities/settings/AboutActivity.cpp @@ -205,7 +205,7 @@ void AboutActivity::onEnter() { void AboutActivity::buildScreen(UiScreen& screen) { const auto& metrics = UITheme::getInstance().getMetrics(); screen.setContentMarginFromScreen(fui::Insets{static_cast(metrics.topPadding + metrics.headerHeight), 0, - static_cast(metrics.buttonHintsHeight), 0}); + UITheme::getHintBandBottomInset(renderer), 0}); screen.spacer(static_cast(metrics.verticalSpacing)); for (int i = 0; i < ITEM_COUNT; i++) { diff --git a/src/activities/settings/BleSettingsActivity.cpp b/src/activities/settings/BleSettingsActivity.cpp index c1e56bffd7b..8bd42a2215b 100644 --- a/src/activities/settings/BleSettingsActivity.cpp +++ b/src/activities/settings/BleSettingsActivity.cpp @@ -359,7 +359,7 @@ void BleSettingsActivity::clearMapping(const int index) { void BleSettingsActivity::buildScreen(UiScreen& screen) { const auto& metrics = UITheme::getInstance().getMetrics(); screen.setContentMarginFromScreen(fui::Insets{static_cast(metrics.topPadding + metrics.headerHeight), 0, - static_cast(metrics.buttonHintsHeight), 0}); + UITheme::getHintBandBottomInset(renderer), 0}); screen.spacer(static_cast(metrics.verticalSpacing)); fui::ListProps props; diff --git a/src/activities/settings/ButtonRemapActivity.cpp b/src/activities/settings/ButtonRemapActivity.cpp index 85a6142fa41..f3c25c179d3 100644 --- a/src/activities/settings/ButtonRemapActivity.cpp +++ b/src/activities/settings/ButtonRemapActivity.cpp @@ -140,9 +140,11 @@ void ButtonRemapActivity::render(RenderLock&&) { // Temporary warning banner for duplicates. if (!errorMessage.empty()) { - GUI.drawHelpText(renderer, - Rect{0, pageHeight - metrics.buttonHintsHeight - metrics.contentSidePadding - 15, pageWidth, 20}, - errorMessage.c_str()); + GUI.drawHelpText( + renderer, + Rect{static_cast(UITheme::getHintRailLeftGutter(renderer)), + pageHeight - UITheme::getHintBandBottomInset(renderer) - metrics.contentSidePadding - 15, pageWidth, 20}, + errorMessage.c_str()); } // Provide side button actions at the bottom of the screen (split across two lines). diff --git a/src/activities/settings/ClockSettingsActivity.cpp b/src/activities/settings/ClockSettingsActivity.cpp index 150b2d3e5ff..54f6a93e7fe 100644 --- a/src/activities/settings/ClockSettingsActivity.cpp +++ b/src/activities/settings/ClockSettingsActivity.cpp @@ -86,7 +86,7 @@ void ClockSettingsActivity::activateIndex(const int index) { void ClockSettingsActivity::buildScreen(UiScreen& screen) { const auto& metrics = UITheme::getInstance().getMetrics(); screen.setContentMarginFromScreen(fui::Insets{static_cast(metrics.topPadding + metrics.headerHeight), 0, - static_cast(metrics.buttonHintsHeight), 0}); + UITheme::getHintBandBottomInset(renderer), 0}); screen.spacer(static_cast(metrics.verticalSpacing)); // Every value is a flash/translation string or the member time buffer, so diff --git a/src/activities/settings/FontDownloadActivity.cpp b/src/activities/settings/FontDownloadActivity.cpp index 633f4df0207..d9c3c1c26a1 100644 --- a/src/activities/settings/FontDownloadActivity.cpp +++ b/src/activities/settings/FontDownloadActivity.cpp @@ -766,7 +766,7 @@ void FontDownloadActivity::buildScreen(UiScreen& screen) { const auto& metrics = UITheme::getInstance().getMetrics(); // Content below the GUI.drawHeader band, above the button hints. screen.setContentMarginFromScreen(fui::Insets{static_cast(metrics.topPadding + metrics.headerHeight), 0, - static_cast(metrics.buttonHintsHeight), 0}); + UITheme::getHintBandBottomInset(renderer), 0}); screen.spacer(static_cast(metrics.verticalSpacing)); if (state_ == FAMILY_LIST && filteredIndices_.empty()) { diff --git a/src/activities/settings/HomeButtonSettingsActivity.cpp b/src/activities/settings/HomeButtonSettingsActivity.cpp index 2ba5b47f6ec..68f00aebfa3 100644 --- a/src/activities/settings/HomeButtonSettingsActivity.cpp +++ b/src/activities/settings/HomeButtonSettingsActivity.cpp @@ -34,7 +34,7 @@ void HomeButtonSettingsActivity::render(RenderLock&& lock) { void HomeButtonSettingsActivity::buildScreen(UiScreen& screen) { const auto& metrics = UITheme::getInstance().getMetrics(); screen.setContentMarginFromScreen(fui::Insets{static_cast(metrics.topPadding + metrics.headerHeight), 0, - static_cast(metrics.buttonHintsHeight), 0}); + UITheme::getHintBandBottomInset(renderer), 0}); screen.spacer(static_cast(metrics.verticalSpacing)); for (int i = 0; i < listCount(); ++i) { rows[i].label = I18N.get(home_button::GESTURE_LABELS[i]); diff --git a/src/activities/settings/KOReaderSettingsActivity.cpp b/src/activities/settings/KOReaderSettingsActivity.cpp index d1b3a2cde81..8dbe3e520a4 100644 --- a/src/activities/settings/KOReaderSettingsActivity.cpp +++ b/src/activities/settings/KOReaderSettingsActivity.cpp @@ -160,7 +160,7 @@ void KOReaderSettingsActivity::buildScreen(UiScreen& screen) { const auto& metrics = UITheme::getInstance().getMetrics(); // Content below the GUI.drawHeader band, above the button hints. screen.setContentMarginFromScreen(fui::Insets{static_cast(metrics.topPadding + metrics.headerHeight), 0, - static_cast(metrics.buttonHintsHeight), 0}); + UITheme::getHintBandBottomInset(renderer), 0}); screen.spacer(static_cast(metrics.verticalSpacing)); // rowItems_'s labels/actionValue were set once in the constructor; only the diff --git a/src/activities/settings/KeyboardLayoutsActivity.cpp b/src/activities/settings/KeyboardLayoutsActivity.cpp index aa42ee35804..72f4bffaee6 100644 --- a/src/activities/settings/KeyboardLayoutsActivity.cpp +++ b/src/activities/settings/KeyboardLayoutsActivity.cpp @@ -58,7 +58,7 @@ void KeyboardLayoutsActivity::activateIndex(const int index) { void KeyboardLayoutsActivity::buildScreen(UiScreen& screen) { const auto& metrics = UITheme::getInstance().getMetrics(); screen.setContentMarginFromScreen(fui::Insets{static_cast(metrics.topPadding + metrics.headerHeight), 0, - static_cast(metrics.buttonHintsHeight), 0}); + UITheme::getHintBandBottomInset(renderer), 0}); screen.spacer(static_cast(metrics.verticalSpacing)); for (int i = 0; i < keyboard_layouts::COUNT; ++i) { diff --git a/src/activities/settings/OpdsServerListActivity.cpp b/src/activities/settings/OpdsServerListActivity.cpp index 15f47bd6866..afb9f756536 100644 --- a/src/activities/settings/OpdsServerListActivity.cpp +++ b/src/activities/settings/OpdsServerListActivity.cpp @@ -205,7 +205,8 @@ void OpdsServerListActivity::buildScreen(UiScreen& screen) { screen.setContentMarginFromScreen( fui::Insets{static_cast(safe.y + metrics.topPadding + metrics.headerHeight), static_cast(renderer.getScreenWidth() - (safe.x + safe.width)), - static_cast(renderer.getScreenHeight() - (safe.y + safe.height) + metrics.buttonHintsHeight), + static_cast(renderer.getScreenHeight() - (safe.y + safe.height) + + UITheme::getHintBandBottomInset(renderer)), static_cast(safe.x)}); screen.spacer(static_cast(metrics.verticalSpacing)); diff --git a/src/activities/settings/OpdsSettingsActivity.cpp b/src/activities/settings/OpdsSettingsActivity.cpp index 9dbbd41a9d4..45e4c1fb586 100644 --- a/src/activities/settings/OpdsSettingsActivity.cpp +++ b/src/activities/settings/OpdsSettingsActivity.cpp @@ -190,7 +190,8 @@ void OpdsSettingsActivity::buildScreen(UiScreen& screen) { screen.setContentMarginFromScreen( fui::Insets{static_cast(safe.y + metrics.topPadding + metrics.headerHeight), static_cast(renderer.getScreenWidth() - (safe.x + safe.width)), - static_cast(renderer.getScreenHeight() - (safe.y + safe.height) + metrics.buttonHintsHeight), + static_cast(renderer.getScreenHeight() - (safe.y + safe.height) + + UITheme::getHintBandBottomInset(renderer)), static_cast(safe.x)}); // URL hint where the old sub-header band sat. diff --git a/src/activities/settings/SettingsActivity.cpp b/src/activities/settings/SettingsActivity.cpp index 10fb1256105..39ae81be378 100644 --- a/src/activities/settings/SettingsActivity.cpp +++ b/src/activities/settings/SettingsActivity.cpp @@ -604,7 +604,7 @@ void SettingsActivity::buildScreen(UiScreen& screen) { const auto& metrics = UITheme::getInstance().getMetrics(); // Content below the GUI.drawHeader band, above the button hints. screen.setContentMarginFromScreen(fui::Insets{static_cast(metrics.topPadding + metrics.headerHeight), 0, - static_cast(metrics.buttonHintsHeight), 0}); + UITheme::getHintBandBottomInset(renderer), 0}); screen.spacer(static_cast(metrics.verticalSpacing)); // rowItems_ (label/actionValue) was built by rebuildRowItems(); only the diff --git a/src/activities/settings/SettingsListActivity.cpp b/src/activities/settings/SettingsListActivity.cpp index c74d866ee7d..26968b32575 100644 --- a/src/activities/settings/SettingsListActivity.cpp +++ b/src/activities/settings/SettingsListActivity.cpp @@ -63,7 +63,7 @@ void SettingsListActivity::buildScreen(UiScreen& screen) { const auto& metrics = UITheme::getInstance().getMetrics(); // Content below the GUI.drawHeader band, above the button hints. screen.setContentMarginFromScreen(fui::Insets{static_cast(metrics.topPadding + metrics.headerHeight), 0, - static_cast(metrics.buttonHintsHeight), 0}); + UITheme::getHintBandBottomInset(renderer), 0}); screen.spacer(static_cast(metrics.verticalSpacing)); fui::ListProps props; diff --git a/src/activities/settings/StatusBarSettingsActivity.cpp b/src/activities/settings/StatusBarSettingsActivity.cpp index f9f3b83f6dc..7d5eeb25daf 100644 --- a/src/activities/settings/StatusBarSettingsActivity.cpp +++ b/src/activities/settings/StatusBarSettingsActivity.cpp @@ -189,8 +189,9 @@ void StatusBarSettingsActivity::buildScreen(UiScreen& screen) { const int statusBarHeight = UITheme::getInstance().getStatusBarHeight(); const auto previewFooter = static_cast(statusBarHeight + verticalPreviewTextPadding + metrics.verticalSpacing); - screen.setContentMarginFromScreen(fui::Insets{static_cast(metrics.topPadding + metrics.headerHeight), 0, - static_cast(metrics.buttonHintsHeight + previewFooter), 0}); + screen.setContentMarginFromScreen( + fui::Insets{static_cast(metrics.topPadding + metrics.headerHeight), 0, + static_cast(UITheme::getHintBandBottomInset(renderer) + previewFooter), 0}); screen.spacer(static_cast(metrics.verticalSpacing)); // rowItems_'s labels/actionValue were set once in onEnter(); only the live diff --git a/src/activities/settings/TimezonePickerActivity.cpp b/src/activities/settings/TimezonePickerActivity.cpp index e2390bc4fd9..d5be993f886 100644 --- a/src/activities/settings/TimezonePickerActivity.cpp +++ b/src/activities/settings/TimezonePickerActivity.cpp @@ -45,7 +45,7 @@ void TimezonePickerActivity::activateIndex(const int index) { void TimezonePickerActivity::buildScreen(UiScreen& screen) { const auto& metrics = UITheme::getInstance().getMetrics(); screen.setContentMarginFromScreen(fui::Insets{static_cast(metrics.topPadding + metrics.headerHeight), 0, - static_cast(metrics.buttonHintsHeight), 0}); + UITheme::getHintBandBottomInset(renderer), 0}); screen.spacer(static_cast(metrics.verticalSpacing)); fui::ListProps props; diff --git a/src/activities/util/KeyboardEntryActivity.cpp b/src/activities/util/KeyboardEntryActivity.cpp index 0fa7f5e1564..1a5d8fc4f7d 100644 --- a/src/activities/util/KeyboardEntryActivity.cpp +++ b/src/activities/util/KeyboardEntryActivity.cpp @@ -446,17 +446,19 @@ bool KeyboardEntryActivity::cursorPositionFromPoint(const int x, const int y, si metrics.verticalSpacing * 4 + metrics.keyboardVerticalOffset; int availableWidth = content.width; + const int railLeft = static_cast(UITheme::getHintRailLeftGutter(renderer)); + const int railRight = static_cast(UITheme::getHintRailRightGutter(renderer)); if (gpio.deviceIsX3()) { availableWidth -= 2 * metrics.sideButtonHintsWidth; } const int effectiveMargin = (content.width - availableWidth * metrics.keyboardTextFieldWidthPercent / 100) / 2; - const int textLeft = content.x + effectiveMargin; + const int textLeft = content.x + railLeft + effectiveMargin; const int toggleGap = inputType == InputType::Password ? 4 : 0; const int toggleReserve = inputType == InputType::Password ? std::max(renderer.getTextWidth(UI_12_FONT_ID, "[abc]"), renderer.getTextWidth(UI_12_FONT_ID, "[***]")) + toggleGap : 0; - const int textAreaWidth = content.width - 2 * effectiveMargin - toggleReserve; + const int textAreaWidth = content.width - railLeft - railRight - 2 * effectiveMargin - toggleReserve; const int maxLineWidth = textAreaWidth; const bool centerText = metrics.keyboardCenteredText; std::string displayText = displayTextForCurrentState(); @@ -517,13 +519,16 @@ bool KeyboardEntryActivity::cursorPositionFromPoint(const int x, const int y, si fui::Rect KeyboardEntryActivity::keyboardRect() const { const auto& metrics = UITheme::getInstance().getMetrics(); const Rect content = UITheme::getContentArea(renderer); // clear the bezel on rounded panels + const int16_t railLeft = UITheme::getHintRailLeftGutter(renderer); + const int16_t railRight = UITheme::getHintRailRightGutter(renderer); const int pageHeight = renderer.getScreenHeight(); const int rows = currentLayout().rowCount; const bool hasTouch = mappedInput.hasTouch(); const int height = keyboardKeysHeight(metrics, rows, hasTouch); const int hintGap = hasTouch ? metrics.verticalSpacing - metrics.keyboardVerticalOffset : BUTTON_KEYBOARD_HINT_GAP; - const int y = pageHeight - metrics.buttonHintsHeight - height - hintGap; - return fui::Rect{static_cast(content.x), static_cast(y), static_cast(content.width), + const int y = pageHeight - UITheme::getHintBandBottomInset(renderer) - height - hintGap; + return fui::Rect{static_cast(content.x + railLeft), static_cast(y), + static_cast(content.width - railLeft - railRight), static_cast(hasTouch ? pageHeight - y : height)}; } @@ -746,17 +751,19 @@ void KeyboardEntryActivity::render(RenderLock&&) { // keyboard use (matches cursorPositionFromPoint); content.x offsets them past // the bezel on inset panels (EEGO A4). int availableWidth = content.width; + const int railLeft = static_cast(UITheme::getHintRailLeftGutter(renderer)); + const int railRight = static_cast(UITheme::getHintRailRightGutter(renderer)); if (gpio.deviceIsX3()) { availableWidth -= 2 * metrics.sideButtonHintsWidth; } const int effectiveMargin = (content.width - availableWidth * metrics.keyboardTextFieldWidthPercent / 100) / 2; - const int textLeft = content.x + effectiveMargin; + const int textLeft = content.x + railLeft + effectiveMargin; const int toggleGap = isPassword ? 4 : 0; const int toggleReserve = isPassword ? std::max(renderer.getTextWidth(UI_12_FONT_ID, "[abc]"), renderer.getTextWidth(UI_12_FONT_ID, "[***]")) + toggleGap : 0; - const int textAreaWidth = content.width - 2 * effectiveMargin - toggleReserve; + const int textAreaWidth = content.width - railLeft - railRight - 2 * effectiveMargin - toggleReserve; const int maxLineWidth = textAreaWidth; const bool centerText = metrics.keyboardCenteredText; @@ -994,8 +1001,9 @@ void KeyboardEntryActivity::render(RenderLock&&) { if (urlPanel) props.uniformKeyWidth = false; // Shortcut rows stretch independently. if (!mappedInput.hasTouch()) props.background = fui::Paint::none(); frame.target().fill(kbRect, props.background); - const int bottomEdge = - mappedInput.hasTouch() ? renderer.getScreenHeight() : renderer.getScreenHeight() - metrics.buttonHintsHeight; + const int bottomEdge = mappedInput.hasTouch() + ? renderer.getScreenHeight() + : renderer.getScreenHeight() - UITheme::getHintBandBottomInset(renderer); props.bottomHitOverflow = static_cast(std::max(0, bottomEdge - keysRect.bottom())); fui::keyboard(frame, keysRect, props); interactions.publish(); diff --git a/src/components/CatalogScreens.cpp b/src/components/CatalogScreens.cpp index 1504746e31e..44319458ff2 100644 --- a/src/components/CatalogScreens.cpp +++ b/src/components/CatalogScreens.cpp @@ -61,7 +61,7 @@ void catalogScreenHeader(UiAppHost::UiScreen& screen, const GfxRenderer& rendere fui::header(screen.frame(), band, header); screen.setContentMarginFromScreen( fui::Insets{static_cast(metrics.topPadding + metrics.headerHeight + metrics.verticalSpacing), 0, - static_cast(metrics.buttonHintsHeight), 0}); + UITheme::getHintBandBottomInset(renderer), 0}); } void catalogCenteredBlock(UiAppHost::UiScreen& screen, const std::initializer_list lines) { diff --git a/src/components/UITheme.cpp b/src/components/UITheme.cpp index e69dfa69c12..8bc1fc7792f 100644 --- a/src/components/UITheme.cpp +++ b/src/components/UITheme.cpp @@ -144,6 +144,27 @@ int UITheme::getReaderStatusBarHeight() { return getStatusBarHeight() - (BoardConfig::isEegoA4() ? getProgressBarHeight() : 0); } +int16_t UITheme::getHintBandBottomInset(const GfxRenderer& renderer) { + const auto orientation = renderer.getOrientation(); + if (orientation == GfxRenderer::Orientation::LandscapeClockwise || + orientation == GfxRenderer::Orientation::LandscapeCounterClockwise) { + return 0; // The rail is a side gutter in landscape, not a bottom band. + } + return static_cast(getMetrics().buttonHintsHeight); +} + +int16_t UITheme::getHintRailLeftGutter(const GfxRenderer& renderer) { + return renderer.getOrientation() == GfxRenderer::Orientation::LandscapeClockwise + ? static_cast(getMetrics().buttonHintsHeight) + : 0; +} + +int16_t UITheme::getHintRailRightGutter(const GfxRenderer& renderer) { + return renderer.getOrientation() == GfxRenderer::Orientation::LandscapeCounterClockwise + ? static_cast(getMetrics().buttonHintsHeight) + : 0; +} + // Centered text implementation that takes the safe area into account void UITheme::drawCenteredText(const GfxRenderer& renderer, Rect screen, int fontId, int y, const char* text, bool black, EpdFontFamily::Style style) { diff --git a/src/components/UITheme.h b/src/components/UITheme.h index a433f8bf6d3..52e14cea670 100644 --- a/src/components/UITheme.h +++ b/src/components/UITheme.h @@ -45,6 +45,15 @@ class UITheme { static int getStatusBarHeight(); static int getProgressBarHeight(); static int getReaderStatusBarHeight(); + // Portrait button-hint band depth at the bottom edge. In landscape the hints + // form a side rail that is already part of the fui safe area (see + // UiAppHost::railSafeDeviceContext), so landscape screens must not reserve a + // bottom band for it too. + static int16_t getHintBandBottomInset(const GfxRenderer& renderer); + // Rail depth on the edge the hint rail occupies in landscape (left in + // clockwise, right in counter-clockwise); 0 in portrait and on touch boards. + static int16_t getHintRailLeftGutter(const GfxRenderer& renderer); + static int16_t getHintRailRightGutter(const GfxRenderer& renderer); private: BaseTheme fallbackTheme; diff --git a/src/components/UiAppHost.cpp b/src/components/UiAppHost.cpp index ce13711ed6c..aa444623323 100644 --- a/src/components/UiAppHost.cpp +++ b/src/components/UiAppHost.cpp @@ -1,11 +1,13 @@ #include "UiAppHost.h" +#include + #include "UiAppHelpers.h" namespace fui = freeink::ui; UiAppHost::UiAppHost(const GfxRenderer& renderer) - : uiTarget(makeUiTarget(renderer)), app(uiTarget, uiTarget.deviceContext()) {} + : uiTarget(makeUiTarget(renderer)), app(uiTarget, uiTarget.deviceContext()), gfxRenderer(renderer) {} void UiAppHost::resetUi() { uiReady = false; @@ -13,11 +15,21 @@ void UiAppHost::resetUi() { } void UiAppHost::renderUi() { - app.setDevice(uiTarget.deviceContext()); + app.setDevice(railSafeDeviceContext()); app.render(); uiReady = true; } +freeink::ui::DeviceContext UiAppHost::railSafeDeviceContext() const { + auto device = uiTarget.deviceContext(); + // In landscape the four button-hint boxes form a rail on the button edge; + // fold that gutter into the safe area so fui bodies, lists and popups stop + // short of it instead of drawing under it. + device.safeArea.left += UITheme::getHintRailLeftGutter(gfxRenderer); + device.safeArea.right += UITheme::getHintRailRightGutter(gfxRenderer); + return device; +} + UiAppHost::TouchRoute UiAppHost::routeTouch(const MappedInputManager& input, const bool withLongPress, const bool routeHeld) { TouchRoute result; // named apart from route() — cppcheck flags the shadow diff --git a/src/components/UiAppHost.h b/src/components/UiAppHost.h index 5d5507894d3..5ffe2dca2bf 100644 --- a/src/components/UiAppHost.h +++ b/src/components/UiAppHost.h @@ -42,7 +42,6 @@ class UiAppHost { // complete published generation. Call from the render task wherever the app // should paint; chrome before, hints after. void renderUi(); - // What loop-task routing saw this pass. `routed` is true when the gate was // open and the snapshot carried relevant touch input — the invalidated() // repaint check belongs behind it, so a pending render requested elsewhere @@ -72,6 +71,11 @@ class UiAppHost { UiApp app; private: + // fui device context with the landscape hint-rail gutter folded into the + // safe area, so every FUI screen lays out clear of the side button boxes. + freeink::ui::DeviceContext railSafeDeviceContext() const; + + const GfxRenderer& gfxRenderer; // Opened by the render task after publication and closed on lifecycle/state // resets; read by the loop task (route*). std::atomic uiReady{false}; From b8756cad515be2d004816461ea6e9ac8a1561d16 Mon Sep 17 00:00:00 2001 From: Raxcoms Date: Sat, 21 Nov 2026 11:09:19 -0300 Subject: [PATCH 11/20] fix(ui): use getInstance for static hint helpers and drop stale locals UITheme::getHint* helpers are static members, so they must go through getInstance().getMetrics(); drop the now-unused metrics locals in LibraryListActivity that cppcheck flagged. --- platformio.ini | 1361 ++++++++--------- .../library/LibraryListActivity.cpp | 2 - src/components/UITheme.cpp | 6 +- 3 files changed, 603 insertions(+), 766 deletions(-) diff --git a/platformio.ini b/platformio.ini index f4eeda76411..4338e778806 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1,761 +1,600 @@ -[platformio] -default_envs = default -build_cache_dir = .cache -extra_configs = platformio.local.ini - -[crosspoint] -version = 2.0.0 - -[base] -platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.311/platform-espressif32.zip -board = esp32-c3-devkitm-1 -framework = arduino -monitor_speed = 115200 -upload_speed = 921600 -check_tool = cppcheck -; missingInclude (project headers) is suppressed alongside missingIncludeSystem: on a -; fresh CI checkout cppcheck has no resolved include paths, so it reports every -; project header as missing (~400 information-level lines) and fails the job. -check_flags = - --enable=all - --check-level=exhaustive - --suppress=missingIncludeSystem - --suppress=missingInclude - --suppress=unusedFunction - --suppress=unmatchedSuppression - --suppress=*:*/.pio/* - ; The SDK is maintained separately; keep this check scoped to reader-owned code. - --suppress=*:*/freeink-sdk/* - ; Analyzer status output is not a source-code defect. - --suppress=checkersReport - --inline-suppr -check_skip_packages = yes - -board_upload.flash_size = 16MB -board_upload.maximum_size = 16777216 -board_upload.offset_address = 0x10000 - -build_flags = - ${ble_page_turner.build_flags} - -DARDUINO_USB_MODE=1 - -DARDUINO_USB_CDC_ON_BOOT=1 - -DEINK_DISPLAY_SINGLE_BUFFER_MODE=1 - -DDISABLE_FS_H_WARNING=1 - -DDESTRUCTOR_CLOSES_FILE=1 -# https://libexpat.github.io/doc/api/latest/#XML_GE - -DXML_GE=0 -# 0 keeps Expat's input buffer at 2 KB; it disables XML_GetInputContext, which nothing calls - -DXML_CONTEXT_BYTES=0 -# WebSocket upload server: the web UI runs one upload at a time; the second slot -# lets the next upload connect while the last one closes. Each slot is 240 B. - -DWEBSOCKETS_SERVER_CLIENT_MAX=2 - -std=gnu++2a -# Enable UTF-8 long file names in SdFat - -DUSE_UTF8_LONG_NAMES=1 -# Allow AnimatedGIF to size its scanline buffer for ebook images wider than 480px - -DMAX_WIDTH=3072 -# Keep FAT table sectors separate from file/directory data on ESP32. -# Requires scripts/patch_sdfat.py; reserves one additional inline sector cache. - -DUSE_SEPARATE_FAT_CACHE=1 -# SdFat transfers SPI a byte at a time on ESP32: SdFatConfig.h defaults -# USE_SPI_ARRAY_TRANSFER to 0 for every target but RP2040 and the UNO R4, and each -# Arduino transfer(uint8_t) writes the data register, starts the transfer and spins. -# 1 routes through transfer(buf, count) -> transferBytes() -> spiTransferBytesNL(), -# which batches into the SPI FIFO: ~3x on SD reads, at the cost of a 512-byte stack -# buffer on the send path. Inert on SDMMC boards, which bypass SdFat's SPI driver. - -DUSE_SPI_ARRAY_TRANSFER=1 -# Increase PNG scanline buffer to support up to 2048px wide images -# Default is (320*4+1)*2=2562, we need more for larger images - -DPNG_MAX_BUFFERED_PIXELS=16416 -# FreeInkFont optional FreeType modules. The auto-hinter (~50KB text, PSRAM -# boards only via the vector-font gate) is REQUIRED by the BW-aware 2-bit -# quantizer in TtfEpdFont: with the ink threshold at 50% coverage, unhinted -# thin strokes that straddle pixel columns drop below threshold and break up; -# Light hinting snaps stems to full-coverage pixels so they survive. (An -# earlier "no improvement" A/B was confounded by the old always-ink quantizer -# flooding the differences.) Still OFF: the B/W raster (_MONOCHROME, ~5KB) is -# dead while every TtfEpdFont::load() is 2-bit; psnames (_PSNAMES, ~64KB) -# only serves glyph-NAME lookups a codepoint-driven renderer never makes; -# gzip (_GZIP, ~13KB) only decompresses .gz/WOFF, and the registry accepts -# .ttf/.otf/.ttc. - -DFREEINK_FONT_ENABLE_AUTOHINT=1 - -DFREEINK_NET_WOLFSSL=1 - ; Content protection. Decrypt-on-read + the crypto primitives the browser - ; account plugin drives (activation runs in the browser; the device does the - ; crypto). KEY_GEN = RSA keypair generation; WC_RC2 = the legacy PBE-SHA1-RC2 - ; cipher the PKCS#12 signing bundle uses. Inflate binds to CrossPoint's miniz. - -DFREEINK_CONTENT_WOLFSSL=1 - -DCONTENT_EXTERNAL_MINIZ=1 - -DWOLFSSL_KEY_GEN - -DWC_RC2 - ; Force software RSA. The Espressif wolfSSL port hardcodes ESP_HW_RSAMAX_BIT - ; at 4096, but the ESP32-C3 MPI peripheral only handles operands up to - ; 3072-bit — so encrypting to a 4096-bit account/auth certificate on the HW - ; path returns MP_EXPTMOD_E (-112) instead of falling back. Software - ; fp_exptmod handles up to FP_MAX_BITS/2; RSA is only used at activation and - ; for the 1024-bit content-key unwrap, so the speed cost is irrelevant. - -DNO_WOLFSSL_ESP32_CRYPT_RSA_PRI - -DWOLFSSL_USER_SETTINGS - -DWOLFSSL_OPTIONS_H - -DWOLFSSL_CLIENT_EXAMPLE - -DWOLFSSL_TLS13 -# MEMFIX-PORT: single-precision ECC (sp_c32.c). Without it every P-256 operation -# (TLS 1.3 key_share keygen, ECDHE, ECDSA cert verify) runs on fast-math bignums -# that WOLFSSL_SMALL_STACK heap-allocates at FP_MAX_BITS size -- tens of KB of -# temporaries, which OOMs (MP_MEM) at the ~50KB free heap a reading session -# leaves. SP uses fixed 256-bit arrays: a few KB, and several times faster. -# SP_SMALL trades the large precomputed point tables for smaller flash. - -DWOLFSSL_HAVE_SP_ECC - -DWOLFSSL_SP_SMALL -# Arduino-wolfSSL's user_settings.h enables TLS extensions, supported curves, -# HKDF, and RSA-PSS when WOLFSSL_TLS13 is set. Do not repeat those defines here: -# GCC reports every library translation unit as a macro redefinition. - -DHAVE_FFDHE_2048 - -DHAVE_CURVE25519 - -DHAVE_SNI -# RFC 6066 max_fragment_length: SecureClient asks servers for 2KB TLS records, -# so wolfSSL's receive buffer stays near 2KB instead of ~17KB when the server -# agrees. Servers that ignore the request keep 16KB records, as before. - -DHAVE_MAX_FRAGMENT - -Wno-bidi-chars - -Wl,--wrap=panic_print_backtrace,--wrap=panic_abort,--wrap=bootloader_common_check_efuse_blk_validity - -fno-exceptions - -build_unflags = - -std=gnu++11 - -fexceptions - -; Board configuration -board_build.flash_mode = dio -board_build.flash_size = 16MB -board_build.partitions = partitions.csv - -; UI languages compiled into the firmware, as comma-separated codes from lib/I18n/translations -; (e.g. "en,de,fr"). English is always included. Languages left out are not offered in the -; language picker; a device whose saved language is not built in falls back to English. -custom_i18n_builtin_langs = all - -extra_scripts = - pre:scripts/patch_pioarduino_cache.py - pre:scripts/patch_wolfssl.py - pre:scripts/build_html.py - pre:scripts/gen_i18n.py - pre:scripts/git_branch.py - pre:scripts/patch_jpegdec.py - pre:scripts/patch_animatedgif.py - post:scripts/patch_sdfat.py - post:scripts/register_unit_tests_target.py - post:scripts/patch_arduino_rom_libc.py - post:scripts/patch_arduino_ble_controller.py - -; Libraries -lib_deps = - ${ble_page_turner.lib_deps} - BatteryMonitor=symlink://freeink-sdk/libs/hardware/BatteryMonitor - InputManager=symlink://freeink-sdk/libs/hardware/InputManager - HapticManager=symlink://freeink-sdk/libs/hardware/HapticManager - EInkDisplay=symlink://freeink-sdk/libs/display/FreeInkDisplay - SDCardManager=symlink://freeink-sdk/libs/hardware/SDCardManager - UsbMassStorage=symlink://freeink-sdk/libs/hardware/UsbMassStorage - BoardConfig=symlink://freeink-sdk/libs/hardware/BoardConfig - XteinkDetect=symlink://freeink-sdk/libs/hardware/XteinkDetect - PowerManager=symlink://freeink-sdk/libs/hardware/PowerManager - MemoryManager=symlink://freeink-sdk/libs/hardware/MemoryManager - FrontlightManager=symlink://freeink-sdk/libs/hardware/FrontlightManager - Rtc=symlink://freeink-sdk/libs/hardware/Rtc - Imu=symlink://freeink-sdk/libs/hardware/Imu - SecureNet=symlink://freeink-sdk/libs/network/SecureNet - JsonSax=symlink://freeink-sdk/libs/network/JsonSax - Opds=symlink://freeink-sdk/libs/network/Opds - CatalogList=symlink://freeink-sdk/libs/network/CatalogList - ContentProtection=symlink://freeink-sdk/libs/book/ContentProtection - FreeInkUI=symlink://freeink-sdk/libs/ui/FreeInkUI - Icons=symlink://freeink-sdk/libs/assets/Icons - ; Standalone FreeType/stb TTF engine backing lib/EpdFont/TtfEpdFont (runtime - ; .ttf/.otf rendering). Vendors only stb_truetype + FreeType (no expat), so it - ; does not hit the FreeInkBook duplicate-XML_* symbol problem. - FreeInkFont=symlink://freeink-sdk/libs/font/FreeInkFont - bblanchon/ArduinoJson @ 7.4.2 - ; Pinned for the reviewed cache patches in scripts/sdfat_patches/. - greiman/SdFat @ 2.3.1 - ricmoo/QRCode @ 0.0.1 - bitbank2/PNGdec @ 1.1.6 - https://github.com/bitbank2/JPEGDEC.git#86282979224c8a32fd51e091ed5a35b0c699a52b - https://github.com/bitbank2/AnimatedGIF.git#67cfacafe12ef4926c7713342c57d2a4af040e5e - links2004/WebSockets @ 2.7.3 - wolfssl/Arduino-wolfSSL @ 5.7.2 - -lib_ignore = - BLE - -; The standard firmware profiles reclaim heap by rebuilding the Arduino core. -; USB-OTG (FREEINK_CAP_USB_MSC) profiles like the X4 Pro and Paper Mono -; intentionally do not inherit this section: they need PioArduino's complete -; prebuilt TinyUSB component graph, which the custom core rebuild omits. -[firmware_tuned] -; MEMFIX-PORT: custom_sdkconfig heap reclamation (~32-37 KB). Rebuilds the -; Arduino core libs on first build (slower once, cached after; needs the CMake -; pin in platformio.local.ini on macOS). -; -; If an interrupted rebuild fails with "multiple definition of 'app_main'" -; (stale generated scaffold), clean it up with: -; rm -rf .dummy CMakeLists.txt sdkconfig.default sdkconfig.defaults .pio/build/default -; Do NOT use `git clean -fdX` — it deletes platformio.local.ini. -custom_sdkconfig = - ; Task stack right-sizing from measured high-water marks (heap block map + - ; per-task stack audit, July 2026): esp_timer used ~0.8 KB of 8 KB across - ; every capture; the FreeRTOS timer service used ~0.5 KB - ; of 4 KB. Neither runs TLS or app code. ~7 KB back to the heap. - CONFIG_ESP_TIMER_TASK_STACK_SIZE=4096 - CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2560 - ; Move the WiFi stack's non-critical hot paths out of IRAM into flash. - ; On the C3, IRAM and DRAM share one SRAM pool, so the ~25-30 KB this - ; frees lands directly in the heap — paid for with lower WiFi throughput - ; during transfers (occasional sync/OTA use, not streaming: acceptable). - ; IRAM cost is static, so the heap gain applies even with WiFi off. - CONFIG_ESP_WIFI_IRAM_OPT=n - CONFIG_ESP_WIFI_RX_IRAM_OPT=n - ${ble_page_turner.custom_sdkconfig} - ; Omit unused Arduino wrappers from the hybrid framework build. - CONFIG_ARDUINO_SELECTIVE_COMPILATION=y - CONFIG_ARDUINO_SELECTIVE_ArduinoOTA=n - CONFIG_ARDUINO_SELECTIVE_BLE=n - CONFIG_ARDUINO_SELECTIVE_BluetoothSerial=n - CONFIG_ARDUINO_SELECTIVE_EEPROM=n - CONFIG_ARDUINO_SELECTIVE_ESP_Video=n - CONFIG_ARDUINO_SELECTIVE_Ethernet=n - CONFIG_ARDUINO_SELECTIVE_FFat=n - CONFIG_ARDUINO_SELECTIVE_HTTPUpdate=n - CONFIG_ARDUINO_SELECTIVE_LittleFS=n - CONFIG_ARDUINO_SELECTIVE_Matter=n - CONFIG_ARDUINO_SELECTIVE_NetBIOS=n - CONFIG_ARDUINO_SELECTIVE_OpenThread=n - CONFIG_ARDUINO_SELECTIVE_PPP=n - CONFIG_ARDUINO_SELECTIVE_SD=n - CONFIG_ARDUINO_SELECTIVE_SD_MMC=n - CONFIG_ARDUINO_SELECTIVE_SimpleBLE=n - CONFIG_ARDUINO_SELECTIVE_SPIFFS=n - CONFIG_ARDUINO_SELECTIVE_Ticker=n - CONFIG_ARDUINO_SELECTIVE_WiFiProv=n - CONFIG_ARDUINO_SELECTIVE_Zigbee=n - CONFIG_ARDUINO_SELECTIVE_RainMaker=n - CONFIG_ARDUINO_SELECTIVE_Insights=n - ; ESP_SR (speech recognition) only exists in the S3 core; its wrapper includes - ; ESP_I2S.h, which the isolated core rebuild can't resolve. Unused here anyway, - ; so drop it or the sticky env fails to build. - CONFIG_ARDUINO_SELECTIVE_ESP_SR=n - ; esp-modbus requires its API blocking limit to cover the response timeout. - CONFIG_FMB_MASTER_MAX_API_BLOCKING_TIME_MS=10000 - -; Drop unused cloud and Zigbee components. esp_insights/rainmaker -; require embedded server certs the lib builder can't generate -; ("https_server.crt.S not found"); this firmware uses none of them. -custom_component_remove = - espressif/esp_insights - espressif/esp_rainmaker - espressif/esp_diagnostics - espressif/esp_diag_data_store - espressif/esp_schedule - espressif/esp_rcp_update - espressif/esp_secure_cert_mgr - espressif/cbor - espressif/esp-zboss-lib - espressif/esp-zigbee-lib - -; Bluetooth page turner (lib/BlePageTurner): the NimBLE central under the SDK's BleKeyboardHost, -; sized for one HID remote. Rebuilt cores use the settings below; USB-MSC -; profiles retain their prebuilt core and its Bluetooth defaults. -[ble_page_turner] -custom_sdkconfig = - CONFIG_BT_ENABLED=y - CONFIG_BT_NIMBLE_ROLE_PERIPHERAL=n - CONFIG_BT_NIMBLE_ROLE_BROADCASTER=n - CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 - CONFIG_BT_NIMBLE_MAX_BONDS=4 - CONFIG_BT_NIMBLE_ATT_PREFERRED_MTU=23 - CONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE=4096 - ; One connection and one scan need two activities at most; four is headroom. - CONFIG_BT_CTRL_BLE_MAX_ACT=4 - ; Room for GATT discovery of a full keyboard (many services). - CONFIG_BT_NIMBLE_MSYS_1_BLOCK_COUNT=12 - CONFIG_BT_NIMBLE_MSYS_2_BLOCK_COUNT=12 - CONFIG_BT_NIMBLE_TRANSPORT_ACL_FROM_LL_COUNT=8 -lib_deps = - BleKeyboardHost=symlink://freeink-sdk/libs/network/BleKeyboardHost - h2zero/NimBLE-Arduino@2.5.1 -build_flags = - -DFREEINK_CAP_BLE_HID_HOST=1 - -DCONFIG_BT_NIMBLE_ROLE_PERIPHERAL_DISABLED=1 - -DCONFIG_BT_NIMBLE_ROLE_BROADCASTER_DISABLED=1 - ; NimBLE's host in PSRAM on boards that have it (BOARD_HAS_PSRAM). - -include scripts/s3_nimble_psram.h - -; Keep C3-specific defaults separate from the S3 firmware profiles. -[firmware_tuned_c3] -extends = firmware_tuned -build_flags = - ${base.build_flags} -custom_sdkconfig = - ${firmware_tuned.custom_sdkconfig} - ; The C3 controller archive is selected by patch_arduino_ble_controller.py. - CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY=y - ; Use ROM libc routines to preserve the C3's shared instruction/data RAM. - CONFIG_LIBC_OPTIMIZED_MISALIGNED_ACCESS=n - ; Match the configurable defaults from the Arduino 3.3.7 build. - CONFIG_ESP_IPC_TASK_STACK_SIZE=1024 - CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK=4096 - CONFIG_ESP_WIFI_GCMP_SUPPORT=n - CONFIG_FMB_MASTER_TIMEOUT_MS_RESPOND=3000 - CONFIG_FMB_QUEUE_LENGTH=20 - CONFIG_FMB_TCP_CONNECTION_TOUT_SEC=20 - - -[env:default] -extends = base, firmware_tuned_c3 -build_flags = - ${firmware_tuned_c3.build_flags} - ; CROSSPOINT_VERSION is set by scripts/git_branch.py (includes branch + short SHA) - -DFREEINK_DEVICE_X4=1 - -DFREEINK_DEVICE_X3=1 - -DENABLE_SERIAL_LOG - -DCROSSPOINT_WAIT_FOR_USB_SERIAL - -DLOG_LEVEL=2 ; Set log level to debug for development builds - - -[env:gh_release] -extends = base, firmware_tuned_c3 -build_flags = - ${firmware_tuned_c3.build_flags} - -DFREEINK_DEVICE_X4=1 - -DFREEINK_DEVICE_X3=1 - -DCROSSPOINT_VERSION=\"${crosspoint.version}\" - -DENABLE_SERIAL_LOG - -DLOG_LEVEL=1 ; Set log level to info for release builds - -[env:gh_release_rc] -extends = base, firmware_tuned_c3 -build_flags = - ${firmware_tuned_c3.build_flags} - -DFREEINK_DEVICE_X4=1 - -DFREEINK_DEVICE_X3=1 - -DCROSSPOINT_VERSION=\"${crosspoint.version}-rc+${sysenv.CROSSPOINT_RC_HASH}\" - -DENABLE_SERIAL_LOG - -DLOG_LEVEL=1 ; Set log level to info for release candidate builds - -[env:slim] -extends = base, firmware_tuned_c3 -build_flags = - ${firmware_tuned_c3.build_flags} - -DFREEINK_DEVICE_X4=1 - -DFREEINK_DEVICE_X3=1 - -DCROSSPOINT_VERSION=\"${crosspoint.version}-slim\" - ; serial output is disabled in slim builds to save space - -UENABLE_SERIAL_LOG - -; --- Seeed Sticky — ESP32-S3R8, 3.97" 800x480 SSD1677 + GT911 touch ----------- -; Different MCU family than the C3 envs (one binary per family). The SDK -; auto-enables CAP_TOUCH (GT911) and the BQ27220 gauge for this device. The -; N16R8 board definition enables octal PSRAM. -; pio run -e sticky -t upload -[env:sticky] -extends = base, firmware_tuned -board = esp32-s3-devkitc1-n16r8 -board_build.mcu = esp32s3 -build_flags = - ${base.build_flags} - -DFREEINK_DEVICE_STICKY=1 - -DENABLE_SERIAL_LOG - -DCROSSPOINT_WAIT_FOR_USB_SERIAL - -DLOG_LEVEL=2 - -[env:sticky-gh_release] -extends = base, firmware_tuned -board = esp32-s3-devkitc1-n16r8 -board_build.mcu = esp32s3 -build_flags = - ${base.build_flags} - -DFREEINK_DEVICE_STICKY=1 - -DCROSSPOINT_VERSION=\"${crosspoint.version}\" - -DENABLE_SERIAL_LOG - -DLOG_LEVEL=1 ; Set log level to info for release builds - -[env:sticky-gh_release_rc] -extends = base, firmware_tuned -board = esp32-s3-devkitc1-n16r8 -board_build.mcu = esp32s3 -build_flags = - ${base.build_flags} - -DFREEINK_DEVICE_STICKY=1 - -DCROSSPOINT_VERSION=\"${crosspoint.version}-rc+${sysenv.CROSSPOINT_RC_HASH}\" - -DENABLE_SERIAL_LOG - -DLOG_LEVEL=1 ; Set log level to info for release candidate builds - -; --- Xteink X4 Pro — ESP32-S3, 16MB flash / 8MB PSRAM, SSD1677 + GT911 -------- -; The SDK profile supplies the X4 Pro pinout, display, touch controller, and -; capacitive Home key. USB Serial/JTAG is the normal USB personality so -; PlatformIO can monitor and flash the reader. USB Drive starts MSC only for -; that File Transfer activity, then reboots back to this default on exit. -; pio run -e x4pro -t upload -[env:x4pro] -extends = base -board = esp32-s3-devkitc1-n16r8 -board_build.mcu = esp32s3 -board_build.arduino.memory_type = dio_opi -; Use the prebuilt dio_opi Arduino variant: its TinyUSB component is enabled -; for CDC and MSC. This profile deliberately extends base rather than -; firmware_tuned, whose custom SDK rebuild omits that component. -build_flags = - ${base.build_flags} - -DFREEINK_DEVICE_X4PRO=1 - -DFREEINK_CAP_USB_MSC=1 - -DBOARD_HAS_PSRAM - -DUSB_PRODUCT=\"CrossPoint_X4_Pro\" - -DUSB_MANUFACTURER=\"CrossPoint\" - -DENABLE_SERIAL_LOG - -DCROSSPOINT_WAIT_FOR_USB_SERIAL - -DLOG_LEVEL=2 - ; X4 Pro SD is native SDMMC (1-bit), mounted through SdFat's block-device API. - -DUSE_BLOCK_DEVICE_INTERFACE=1 - -; --- Metalio E-Ink 4 — ESP32-S3, 16MB flash / 8MB octal PSRAM ------------------- -; Native USB Serial/JTAG normally; File Transfer -> USB Drive exports the SD. -; Uses the existing base SDK dependencies, including local checkout overrides. -; pio run -e metalio_eink4 -t upload -[env:metalio_eink4] -extends = base -board = esp32-s3-devkitc1-n16r8 -board_build.mcu = esp32s3 -board_build.arduino.memory_type = dio_opi -build_flags = - ${base.build_flags} - -DFREEINK_DEVICE_METALIO_EINK4=1 - -DFREEINK_CAP_USB_MSC=1 - -DUSB_PRODUCT=\"CrossPoint_Metalio_EInk4\" - -DUSB_MANUFACTURER=\"CrossPoint\" - -DBOARD_HAS_PSRAM - -DUSE_BLOCK_DEVICE_INTERFACE=1 - -DENABLE_SERIAL_LOG - -DCROSSPOINT_WAIT_FOR_USB_SERIAL - -DLOG_LEVEL=2 - -[env:metalio_eink4-gh_release] -extends = base -board = esp32-s3-devkitc1-n16r8 -board_build.mcu = esp32s3 -board_build.arduino.memory_type = dio_opi -build_flags = - ${base.build_flags} - -DFREEINK_DEVICE_METALIO_EINK4=1 - -DFREEINK_CAP_USB_MSC=1 - -DUSB_PRODUCT=\"CrossPoint_Metalio_EInk4\" - -DUSB_MANUFACTURER=\"CrossPoint\" - -DBOARD_HAS_PSRAM - -DUSE_BLOCK_DEVICE_INTERFACE=1 - -DCROSSPOINT_VERSION=\"${crosspoint.version}\" - -DENABLE_SERIAL_LOG - -DLOG_LEVEL=1 ; Set log level to info for release builds - -[env:metalio_eink4-gh_release_rc] -extends = base -board = esp32-s3-devkitc1-n16r8 -board_build.mcu = esp32s3 -board_build.arduino.memory_type = dio_opi -build_flags = - ${base.build_flags} - -DFREEINK_DEVICE_METALIO_EINK4=1 - -DFREEINK_CAP_USB_MSC=1 - -DUSB_PRODUCT=\"CrossPoint_Metalio_EInk4\" - -DUSB_MANUFACTURER=\"CrossPoint\" - -DBOARD_HAS_PSRAM - -DUSE_BLOCK_DEVICE_INTERFACE=1 - -DCROSSPOINT_VERSION=\"${crosspoint.version}-rc+${sysenv.CROSSPOINT_RC_HASH}\" - -DENABLE_SERIAL_LOG - -DLOG_LEVEL=1 ; Set log level to info for release candidate builds - -; --- Xteink X4 Classic (X4C) --------------------------------------------------- -; Same ESP32-S3 board and display stack as the X4 Pro (SSD1677/UC8179/UC8279 auto- -; detected at boot) but buttons-only: no touchscreen and no frontlight, so the -; freed pins become four extra front buttons (two side page-turn keys + four bottom -; keys). Native 1-bit SDMMC + USB-MSC file transfer as on the X4 Pro; drops the -; frontlight flag. See freeink-sdk/docs/xteink-x4c-support.md. -; pio run -e x4c -t upload -[env:x4c] -extends = base -board = esp32-s3-devkitc1-n16r8 -board_build.mcu = esp32s3 -board_build.arduino.memory_type = dio_opi -build_flags = - ${base.build_flags} - -DFREEINK_DEVICE_X4CLASSIC=1 - -DFREEINK_CAP_USB_MSC=1 - -DBOARD_HAS_PSRAM - -DUSB_PRODUCT=\"CrossPoint_X4_Classic\" - -DUSB_MANUFACTURER=\"CrossPoint\" - -DENABLE_SERIAL_LOG - -DCROSSPOINT_WAIT_FOR_USB_SERIAL - -DLOG_LEVEL=2 - ; X4C SD is native SDMMC (1-bit), mounted through SdFat's block-device API. - -DUSE_BLOCK_DEVICE_INTERFACE=1 - -[env:x4c-gh_release] -extends = base -board = esp32-s3-devkitc1-n16r8 -board_build.mcu = esp32s3 -board_build.arduino.memory_type = dio_opi -build_flags = - ${base.build_flags} - -DFREEINK_DEVICE_X4CLASSIC=1 - -DFREEINK_CAP_USB_MSC=1 - -DBOARD_HAS_PSRAM - -DUSB_PRODUCT=\"CrossPoint_X4_Classic\" - -DUSB_MANUFACTURER=\"CrossPoint\" - -DCROSSPOINT_VERSION=\"${crosspoint.version}\" - -DENABLE_SERIAL_LOG - -DLOG_LEVEL=1 ; Set log level to info for release builds - -DUSE_BLOCK_DEVICE_INTERFACE=1 - -[env:x4c-gh_release_rc] -extends = base -board = esp32-s3-devkitc1-n16r8 -board_build.mcu = esp32s3 -board_build.arduino.memory_type = dio_opi -build_flags = - ${base.build_flags} - -DFREEINK_DEVICE_X4CLASSIC=1 - -DFREEINK_CAP_USB_MSC=1 - -DBOARD_HAS_PSRAM - -DUSB_PRODUCT=\"CrossPoint_X4_Classic\" - -DUSB_MANUFACTURER=\"CrossPoint\" - -DCROSSPOINT_VERSION=\"${crosspoint.version}-rc+${sysenv.CROSSPOINT_RC_HASH}\" - -DENABLE_SERIAL_LOG - -DLOG_LEVEL=1 ; Set log level to info for release candidate builds - -DUSE_BLOCK_DEVICE_INTERFACE=1 - -[env:x4pro-gh_release] -extends = base -board = esp32-s3-devkitc1-n16r8 -board_build.mcu = esp32s3 -board_build.arduino.memory_type = dio_opi -build_flags = - ${base.build_flags} - -DFREEINK_DEVICE_X4PRO=1 - -DFREEINK_CAP_USB_MSC=1 - -DBOARD_HAS_PSRAM - -DUSB_PRODUCT=\"CrossPoint_X4_Pro\" - -DUSB_MANUFACTURER=\"CrossPoint\" - -DCROSSPOINT_VERSION=\"${crosspoint.version}\" - -DENABLE_SERIAL_LOG - -DLOG_LEVEL=1 ; Set log level to info for release builds - -DUSE_BLOCK_DEVICE_INTERFACE=1 - -[env:x4pro-gh_release_rc] -extends = base -board = esp32-s3-devkitc1-n16r8 -board_build.mcu = esp32s3 -board_build.arduino.memory_type = dio_opi -build_flags = - ${base.build_flags} - -DFREEINK_DEVICE_X4PRO=1 - -DFREEINK_CAP_USB_MSC=1 - -DBOARD_HAS_PSRAM - -DUSB_PRODUCT=\"CrossPoint_X4_Pro\" - -DUSB_MANUFACTURER=\"CrossPoint\" - -DCROSSPOINT_VERSION=\"${crosspoint.version}-rc+${sysenv.CROSSPOINT_RC_HASH}\" - -DENABLE_SERIAL_LOG - -DLOG_LEVEL=1 ; Set log level to info for release candidate builds - -DUSE_BLOCK_DEVICE_INTERFACE=1 - -; --- M5Stack Paper Mono — ESP32-S3, SSD1683 800x480 + FT6336 touch + frontlight -; Power/reset plumbing runs through the M5PM1 PMIC and M5IOE1 expander; the SDK -; sequences them itself. Touch, frontlight, RTC, and other capabilities are -; selected by the Paper Mono BoardConfig profile. -; Extends base (not firmware_tuned): USB Drive needs the prebuilt dio_opi -; Arduino variant, whose TinyUSB component is enabled for CDC and MSC. -; pio run -e papermono -t upload -[env:papermono] -extends = base -board = esp32-s3-devkitc1-n16r8 -board_build.mcu = esp32s3 -board_build.arduino.memory_type = dio_opi -build_flags = - ${base.build_flags} - -DFREEINK_DEVICE_PAPERMONO=1 - -DFREEINK_CAP_USB_MSC=1 - ; The SSD1683 grayscale target planes are batched in PSRAM. - -DBOARD_HAS_PSRAM - -DUSB_PRODUCT=\"CrossPoint_Paper_Mono\" - -DUSB_MANUFACTURER=\"CrossPoint\" - -DENABLE_SERIAL_LOG - -DCROSSPOINT_WAIT_FOR_USB_SERIAL - -DLOG_LEVEL=2 - ; Native 1-bit SDMMC is mounted through SdFat's block-device interface. - -DUSE_BLOCK_DEVICE_INTERFACE=1 - -[env:papermono-gh_release] -extends = base -board = esp32-s3-devkitc1-n16r8 -board_build.mcu = esp32s3 -board_build.arduino.memory_type = dio_opi -build_flags = - ${base.build_flags} - -DFREEINK_DEVICE_PAPERMONO=1 - -DFREEINK_CAP_USB_MSC=1 - -DBOARD_HAS_PSRAM - -DUSB_PRODUCT=\"CrossPoint_Paper_Mono\" - -DUSB_MANUFACTURER=\"CrossPoint\" - -DCROSSPOINT_VERSION=\"${crosspoint.version}\" - -DENABLE_SERIAL_LOG - -DLOG_LEVEL=1 ; Set log level to info for release builds - -DUSE_BLOCK_DEVICE_INTERFACE=1 - -[env:papermono-gh_release_rc] -extends = base -board = esp32-s3-devkitc1-n16r8 -board_build.mcu = esp32s3 -board_build.arduino.memory_type = dio_opi -build_flags = - ${base.build_flags} - -DFREEINK_DEVICE_PAPERMONO=1 - -DFREEINK_CAP_USB_MSC=1 - -DBOARD_HAS_PSRAM - -DUSB_PRODUCT=\"CrossPoint_Paper_Mono\" - -DUSB_MANUFACTURER=\"CrossPoint\" - -DCROSSPOINT_VERSION=\"${crosspoint.version}-rc+${sysenv.CROSSPOINT_RC_HASH}\" - -DENABLE_SERIAL_LOG - -DLOG_LEVEL=1 ; Set log level to info for release candidate builds - -DUSE_BLOCK_DEVICE_INTERFACE=1 - -; --- EEGO Reader A4 — ESP32-S3 N16R8, UC8279C 768x552 + GSLX680 touch --------- -; UC8279C SPI panel, GSLX680 touch, PCF8563 RTC, dedicated HSPI MicroSD (SPI, -; not SDMMC). 16MB DIO flash + 8MB OPI PSRAM. One binary serves the frontlit -; and lightless variants: FrontlightManager probes the I2C LED driver (0x36) -; at begin() and the firmware hides the light UI when it does not ACK. -; Native USB Serial/JTAG normally; USB Drive exports the SPI SD card through -; the SDK's block-device handoff using the prebuilt dio_opi TinyUSB core. -; pio run -e eego_a4 -t upload -[env:eego_a4] -extends = base -board = esp32-s3-devkitc1-n16r8 -board_build.mcu = esp32s3 -board_build.flash_mode = dio -board_build.arduino.memory_type = dio_opi -build_flags = - ${base.build_flags} - -DFREEINK_DEVICE_EEGO_A4=1 - -DFREEINK_CAP_USB_MSC=1 - -DBOARD_HAS_PSRAM - -DUSB_PRODUCT=\"CrossPoint_EEGO_A4\" - -DUSB_MANUFACTURER=\"CrossPoint\" - -DENABLE_SERIAL_LOG - -DCROSSPOINT_WAIT_FOR_USB_SERIAL - -DLOG_LEVEL=2 - -[env:eego_a4-gh_release] -extends = base -board = esp32-s3-devkitc1-n16r8 -board_build.mcu = esp32s3 -board_build.flash_mode = dio -board_build.arduino.memory_type = dio_opi -build_flags = - ${base.build_flags} - -DFREEINK_DEVICE_EEGO_A4=1 - -DFREEINK_CAP_USB_MSC=1 - -DBOARD_HAS_PSRAM - -DUSB_PRODUCT=\"CrossPoint_EEGO_A4\" - -DUSB_MANUFACTURER=\"CrossPoint\" - -DCROSSPOINT_VERSION=\"${crosspoint.version}\" - -DENABLE_SERIAL_LOG - -DLOG_LEVEL=1 ; Set log level to info for release builds - -[env:eego_a4-gh_release_rc] -extends = base -board = esp32-s3-devkitc1-n16r8 -board_build.mcu = esp32s3 -board_build.flash_mode = dio -board_build.arduino.memory_type = dio_opi -build_flags = - ${base.build_flags} - -DFREEINK_DEVICE_EEGO_A4=1 - -DFREEINK_CAP_USB_MSC=1 - -DBOARD_HAS_PSRAM - -DUSB_PRODUCT=\"CrossPoint_EEGO_A4\" - -DUSB_MANUFACTURER=\"CrossPoint\" - -DCROSSPOINT_VERSION=\"${crosspoint.version}-rc+${sysenv.CROSSPOINT_RC_HASH}\" - -DENABLE_SERIAL_LOG - -DLOG_LEVEL=1 ; Set log level to info for release candidate builds - -; --- Onyx Picco / BOOX Tiles — ESP32-S3, 16MB flash / 8MB octal PSRAM ---------- -; 3.97" 800x480 SSD1677/SSD2677 (auto-detected), capacitive touch, warm/cool I2C -; frontlight, SGM41562 charger, slide switch. The stock image declares 16MB flash -; and its app alone is ~9MB. Builds target the STOCK partition table -; (partitions_picco.csv) and `pio run -t upload` writes only the app into the -; stock `app` slot at 0xE0000, so the vendor bootloader, NVS and the safeboot -; recovery partition survive. The same firmware.bin works with the stock web -; flasher's "OTA update" mode. Native 4-bit SDMMC + USB-MSC file transfer as on -; the X4 Pro. -; pio run -e picco -t upload -[env:picco] -extends = base -board = esp32-s3-devkitc1-n16r8 -board_build.mcu = esp32s3 -board_build.arduino.memory_type = dio_opi -board_build.partitions = partitions_picco.csv -extra_scripts = - ${base.extra_scripts} - post:scripts/app_only_upload.py -build_flags = - ${base.build_flags} - -DFREEINK_DEVICE_PICCO=1 - -DFREEINK_CAP_USB_MSC=1 - -DBOARD_HAS_PSRAM - -DUSB_PRODUCT=\"CrossPoint_Picco\" - -DUSB_MANUFACTURER=\"CrossPoint\" - -DENABLE_SERIAL_LOG - -DCROSSPOINT_WAIT_FOR_USB_SERIAL - -DLOG_LEVEL=2 - ; Picco SD is native SDMMC (4-bit), mounted through SdFat's block-device API. - -DUSE_BLOCK_DEVICE_INTERFACE=1 - -[env:picco-gh_release] -extends = base -board = esp32-s3-devkitc1-n16r8 -board_build.mcu = esp32s3 -board_build.arduino.memory_type = dio_opi -board_build.partitions = partitions_picco.csv -extra_scripts = - ${base.extra_scripts} - post:scripts/app_only_upload.py -build_flags = - ${base.build_flags} - -DFREEINK_DEVICE_PICCO=1 - -DFREEINK_CAP_USB_MSC=1 - -DBOARD_HAS_PSRAM - -DUSB_PRODUCT=\"CrossPoint_Picco\" - -DUSB_MANUFACTURER=\"CrossPoint\" - -DCROSSPOINT_VERSION=\"${crosspoint.version}\" - -DENABLE_SERIAL_LOG - -DLOG_LEVEL=1 ; Set log level to info for release builds - ; Picco SD is native SDMMC (4-bit), mounted through SdFat's block-device API. - -DUSE_BLOCK_DEVICE_INTERFACE=1 - -[env:picco-gh_release_rc] -extends = base -board = esp32-s3-devkitc1-n16r8 -board_build.mcu = esp32s3 -board_build.arduino.memory_type = dio_opi -board_build.partitions = partitions_picco.csv -extra_scripts = - ${base.extra_scripts} - post:scripts/app_only_upload.py -build_flags = - ${base.build_flags} - -DFREEINK_DEVICE_PICCO=1 - -DFREEINK_CAP_USB_MSC=1 - -DBOARD_HAS_PSRAM - -DUSB_PRODUCT=\"CrossPoint_Picco\" - -DUSB_MANUFACTURER=\"CrossPoint\" - -DCROSSPOINT_VERSION=\"${crosspoint.version}-rc+${sysenv.CROSSPOINT_RC_HASH}\" - -DENABLE_SERIAL_LOG - -DLOG_LEVEL=1 ; Set log level to info for release candidate builds - ; Picco SD is native SDMMC (4-bit), mounted through SdFat's block-device API. - -DUSE_BLOCK_DEVICE_INTERFACE=1 +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + +[platformio] +default_envs = default +build_cache_dir = .cache +extra_configs = platformio.local.ini + +[crosspoint] +version = 2.0.0 + +[base] +platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.311/platform-espressif32.zip +board = esp32-c3-devkitm-1 +framework = arduino +monitor_speed = 115200 +upload_speed = 921600 +check_tool = cppcheck +check_flags = + --enable=all + --check-level=exhaustive + --suppress=missingIncludeSystem + --suppress=missingInclude + --suppress=unusedFunction + --suppress=unmatchedSuppression + --suppress=*:*/.pio/* + --suppress=*:*/freeink-sdk/* + --suppress=checkersReport + --inline-suppr +check_skip_packages = yes +board_upload.flash_size = 16MB +board_upload.maximum_size = 16777216 +board_upload.offset_address = 0x10000 +build_flags = + ${ble_page_turner.build_flags} + -DARDUINO_USB_MODE=1 + -DARDUINO_USB_CDC_ON_BOOT=1 + -DEINK_DISPLAY_SINGLE_BUFFER_MODE=1 + -DDISABLE_FS_H_WARNING=1 + -DDESTRUCTOR_CLOSES_FILE=1 + -DXML_GE=0 + -DXML_CONTEXT_BYTES=0 + -DWEBSOCKETS_SERVER_CLIENT_MAX=2 + -std=gnu++2a + -DUSE_UTF8_LONG_NAMES=1 + -DMAX_WIDTH=3072 + -DUSE_SEPARATE_FAT_CACHE=1 + -DUSE_SPI_ARRAY_TRANSFER=1 + -DPNG_MAX_BUFFERED_PIXELS=16416 + -DFREEINK_FONT_ENABLE_AUTOHINT=1 + -DFREEINK_NET_WOLFSSL=1 + -DFREEINK_CONTENT_WOLFSSL=1 + -DCONTENT_EXTERNAL_MINIZ=1 + -DWOLFSSL_KEY_GEN + -DWC_RC2 + -DNO_WOLFSSL_ESP32_CRYPT_RSA_PRI + -DWOLFSSL_USER_SETTINGS + -DWOLFSSL_OPTIONS_H + -DWOLFSSL_CLIENT_EXAMPLE + -DWOLFSSL_TLS13 + -DWOLFSSL_HAVE_SP_ECC + -DWOLFSSL_SP_SMALL + -DHAVE_FFDHE_2048 + -DHAVE_CURVE25519 + -DHAVE_SNI + -DHAVE_MAX_FRAGMENT + -Wno-bidi-chars + -Wl,--wrap=panic_print_backtrace,--wrap=panic_abort,--wrap=bootloader_common_check_efuse_blk_validity + -fno-exceptions +build_unflags = + -std=gnu++11 + -fexceptions +board_build.flash_mode = dio +board_build.flash_size = 16MB +board_build.partitions = partitions.csv +custom_i18n_builtin_langs = all +extra_scripts = + pre:scripts/patch_pioarduino_cache.py + pre:scripts/patch_wolfssl.py + pre:scripts/build_html.py + pre:scripts/gen_i18n.py + pre:scripts/git_branch.py + pre:scripts/patch_jpegdec.py + pre:scripts/patch_animatedgif.py + post:scripts/patch_sdfat.py + post:scripts/register_unit_tests_target.py + post:scripts/patch_arduino_rom_libc.py + post:scripts/patch_arduino_ble_controller.py +lib_deps = + ${ble_page_turner.lib_deps} + BatteryMonitor=symlink://freeink-sdk/libs/hardware/BatteryMonitor + InputManager=symlink://freeink-sdk/libs/hardware/InputManager + HapticManager=symlink://freeink-sdk/libs/hardware/HapticManager + EInkDisplay=symlink://freeink-sdk/libs/display/FreeInkDisplay + SDCardManager=symlink://freeink-sdk/libs/hardware/SDCardManager + UsbMassStorage=symlink://freeink-sdk/libs/hardware/UsbMassStorage + BoardConfig=symlink://freeink-sdk/libs/hardware/BoardConfig + XteinkDetect=symlink://freeink-sdk/libs/hardware/XteinkDetect + PowerManager=symlink://freeink-sdk/libs/hardware/PowerManager + MemoryManager=symlink://freeink-sdk/libs/hardware/MemoryManager + FrontlightManager=symlink://freeink-sdk/libs/hardware/FrontlightManager + Rtc=symlink://freeink-sdk/libs/hardware/Rtc + Imu=symlink://freeink-sdk/libs/hardware/Imu + SecureNet=symlink://freeink-sdk/libs/network/SecureNet + JsonSax=symlink://freeink-sdk/libs/network/JsonSax + Opds=symlink://freeink-sdk/libs/network/Opds + CatalogList=symlink://freeink-sdk/libs/network/CatalogList + ContentProtection=symlink://freeink-sdk/libs/book/ContentProtection + FreeInkUI=symlink://freeink-sdk/libs/ui/FreeInkUI + Icons=symlink://freeink-sdk/libs/assets/Icons + FreeInkFont=symlink://freeink-sdk/libs/font/FreeInkFont + bblanchon/ArduinoJson @ 7.4.2 + greiman/SdFat @ 2.3.1 + ricmoo/QRCode @ 0.0.1 + bitbank2/PNGdec @ 1.1.6 + https://github.com/bitbank2/JPEGDEC.git#86282979224c8a32fd51e091ed5a35b0c699a52b + https://github.com/bitbank2/AnimatedGIF.git#67cfacafe12ef4926c7713342c57d2a4af040e5e + links2004/WebSockets @ 2.7.3 + wolfssl/Arduino-wolfSSL @ 5.7.2 +lib_ignore = + BLE + +[firmware_tuned] +custom_sdkconfig = + CONFIG_ESP_TIMER_TASK_STACK_SIZE=4096 + CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2560 + CONFIG_ESP_WIFI_IRAM_OPT=n + CONFIG_ESP_WIFI_RX_IRAM_OPT=n + ${ble_page_turner.custom_sdkconfig} + CONFIG_ARDUINO_SELECTIVE_COMPILATION=y + CONFIG_ARDUINO_SELECTIVE_ArduinoOTA=n + CONFIG_ARDUINO_SELECTIVE_BLE=n + CONFIG_ARDUINO_SELECTIVE_BluetoothSerial=n + CONFIG_ARDUINO_SELECTIVE_EEPROM=n + CONFIG_ARDUINO_SELECTIVE_ESP_Video=n + CONFIG_ARDUINO_SELECTIVE_Ethernet=n + CONFIG_ARDUINO_SELECTIVE_FFat=n + CONFIG_ARDUINO_SELECTIVE_HTTPUpdate=n + CONFIG_ARDUINO_SELECTIVE_LittleFS=n + CONFIG_ARDUINO_SELECTIVE_Matter=n + CONFIG_ARDUINO_SELECTIVE_NetBIOS=n + CONFIG_ARDUINO_SELECTIVE_OpenThread=n + CONFIG_ARDUINO_SELECTIVE_PPP=n + CONFIG_ARDUINO_SELECTIVE_SD=n + CONFIG_ARDUINO_SELECTIVE_SD_MMC=n + CONFIG_ARDUINO_SELECTIVE_SimpleBLE=n + CONFIG_ARDUINO_SELECTIVE_SPIFFS=n + CONFIG_ARDUINO_SELECTIVE_Ticker=n + CONFIG_ARDUINO_SELECTIVE_WiFiProv=n + CONFIG_ARDUINO_SELECTIVE_Zigbee=n + CONFIG_ARDUINO_SELECTIVE_RainMaker=n + CONFIG_ARDUINO_SELECTIVE_Insights=n + CONFIG_ARDUINO_SELECTIVE_ESP_SR=n + CONFIG_FMB_MASTER_MAX_API_BLOCKING_TIME_MS=10000 +custom_component_remove = + espressif/esp_insights + espressif/esp_rainmaker + espressif/esp_diagnostics + espressif/esp_diag_data_store + espressif/esp_schedule + espressif/esp_rcp_update + espressif/esp_secure_cert_mgr + espressif/cbor + espressif/esp-zboss-lib + espressif/esp-zigbee-lib + +[ble_page_turner] +custom_sdkconfig = + CONFIG_BT_ENABLED=y + CONFIG_BT_NIMBLE_ROLE_PERIPHERAL=n + CONFIG_BT_NIMBLE_ROLE_BROADCASTER=n + CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 + CONFIG_BT_NIMBLE_MAX_BONDS=4 + CONFIG_BT_NIMBLE_ATT_PREFERRED_MTU=23 + CONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE=4096 + CONFIG_BT_CTRL_BLE_MAX_ACT=4 + CONFIG_BT_NIMBLE_MSYS_1_BLOCK_COUNT=12 + CONFIG_BT_NIMBLE_MSYS_2_BLOCK_COUNT=12 + CONFIG_BT_NIMBLE_TRANSPORT_ACL_FROM_LL_COUNT=8 +lib_deps = + BleKeyboardHost=symlink://freeink-sdk/libs/network/BleKeyboardHost + h2zero/NimBLE-Arduino@2.5.1 +build_flags = + -DFREEINK_CAP_BLE_HID_HOST=1 + -DCONFIG_BT_NIMBLE_ROLE_PERIPHERAL_DISABLED=1 + -DCONFIG_BT_NIMBLE_ROLE_BROADCASTER_DISABLED=1 + -include scripts/s3_nimble_psram.h + +[firmware_tuned_c3] +extends = firmware_tuned +build_flags = + ${base.build_flags} +custom_sdkconfig = + ${firmware_tuned.custom_sdkconfig} + CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY=y + CONFIG_LIBC_OPTIMIZED_MISALIGNED_ACCESS=n + CONFIG_ESP_IPC_TASK_STACK_SIZE=1024 + CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK=4096 + CONFIG_ESP_WIFI_GCMP_SUPPORT=n + CONFIG_FMB_MASTER_TIMEOUT_MS_RESPOND=3000 + CONFIG_FMB_QUEUE_LENGTH=20 + CONFIG_FMB_TCP_CONNECTION_TOUT_SEC=20 + +[env:default] +extends = base, firmware_tuned_c3 +build_flags = + ${firmware_tuned_c3.build_flags} + -DFREEINK_DEVICE_X4=1 + -DFREEINK_DEVICE_X3=1 + -DENABLE_SERIAL_LOG + -DCROSSPOINT_WAIT_FOR_USB_SERIAL + -DLOG_LEVEL=2 +platform_packages = https://github.com/pioarduino/registry/releases/download/0.0.1/scons-4.8.1.zip + +[env:gh_release] +extends = base, firmware_tuned_c3 +build_flags = + ${firmware_tuned_c3.build_flags} + -DFREEINK_DEVICE_X4=1 + -DFREEINK_DEVICE_X3=1 + -DCROSSPOINT_VERSION=\"${crosspoint.version}\" + -DENABLE_SERIAL_LOG + -DLOG_LEVEL=1 + +[env:gh_release_rc] +extends = base, firmware_tuned_c3 +build_flags = + ${firmware_tuned_c3.build_flags} + -DFREEINK_DEVICE_X4=1 + -DFREEINK_DEVICE_X3=1 + -DCROSSPOINT_VERSION=\"${crosspoint.version}-rc+${sysenv.CROSSPOINT_RC_HASH}\" + -DENABLE_SERIAL_LOG + -DLOG_LEVEL=1 + +[env:slim] +extends = base, firmware_tuned_c3 +build_flags = + ${firmware_tuned_c3.build_flags} + -DFREEINK_DEVICE_X4=1 + -DFREEINK_DEVICE_X3=1 + -DCROSSPOINT_VERSION=\"${crosspoint.version}-slim\" + -UENABLE_SERIAL_LOG + +[env:sticky] +extends = base, firmware_tuned +board = esp32-s3-devkitc1-n16r8 +board_build.mcu = esp32s3 +build_flags = + ${base.build_flags} + -DFREEINK_DEVICE_STICKY=1 + -DENABLE_SERIAL_LOG + -DCROSSPOINT_WAIT_FOR_USB_SERIAL + -DLOG_LEVEL=2 + +[env:sticky-gh_release] +extends = base, firmware_tuned +board = esp32-s3-devkitc1-n16r8 +board_build.mcu = esp32s3 +build_flags = + ${base.build_flags} + -DFREEINK_DEVICE_STICKY=1 + -DCROSSPOINT_VERSION=\"${crosspoint.version}\" + -DENABLE_SERIAL_LOG + -DLOG_LEVEL=1 + +[env:sticky-gh_release_rc] +extends = base, firmware_tuned +board = esp32-s3-devkitc1-n16r8 +board_build.mcu = esp32s3 +build_flags = + ${base.build_flags} + -DFREEINK_DEVICE_STICKY=1 + -DCROSSPOINT_VERSION=\"${crosspoint.version}-rc+${sysenv.CROSSPOINT_RC_HASH}\" + -DENABLE_SERIAL_LOG + -DLOG_LEVEL=1 + +[env:x4pro] +extends = base +board = esp32-s3-devkitc1-n16r8 +board_build.mcu = esp32s3 +board_build.arduino.memory_type = dio_opi +build_flags = + ${base.build_flags} + -DFREEINK_DEVICE_X4PRO=1 + -DFREEINK_CAP_USB_MSC=1 + -DBOARD_HAS_PSRAM + -DUSB_PRODUCT=\"CrossPoint_X4_Pro\" + -DUSB_MANUFACTURER=\"CrossPoint\" + -DENABLE_SERIAL_LOG + -DCROSSPOINT_WAIT_FOR_USB_SERIAL + -DLOG_LEVEL=2 + -DUSE_BLOCK_DEVICE_INTERFACE=1 + +[env:metalio_eink4] +extends = base +board = esp32-s3-devkitc1-n16r8 +board_build.mcu = esp32s3 +board_build.arduino.memory_type = dio_opi +build_flags = + ${base.build_flags} + -DFREEINK_DEVICE_METALIO_EINK4=1 + -DFREEINK_CAP_USB_MSC=1 + -DUSB_PRODUCT=\"CrossPoint_Metalio_EInk4\" + -DUSB_MANUFACTURER=\"CrossPoint\" + -DBOARD_HAS_PSRAM + -DUSE_BLOCK_DEVICE_INTERFACE=1 + -DENABLE_SERIAL_LOG + -DCROSSPOINT_WAIT_FOR_USB_SERIAL + -DLOG_LEVEL=2 + +[env:metalio_eink4-gh_release] +extends = base +board = esp32-s3-devkitc1-n16r8 +board_build.mcu = esp32s3 +board_build.arduino.memory_type = dio_opi +build_flags = + ${base.build_flags} + -DFREEINK_DEVICE_METALIO_EINK4=1 + -DFREEINK_CAP_USB_MSC=1 + -DUSB_PRODUCT=\"CrossPoint_Metalio_EInk4\" + -DUSB_MANUFACTURER=\"CrossPoint\" + -DBOARD_HAS_PSRAM + -DUSE_BLOCK_DEVICE_INTERFACE=1 + -DCROSSPOINT_VERSION=\"${crosspoint.version}\" + -DENABLE_SERIAL_LOG + -DLOG_LEVEL=1 + +[env:metalio_eink4-gh_release_rc] +extends = base +board = esp32-s3-devkitc1-n16r8 +board_build.mcu = esp32s3 +board_build.arduino.memory_type = dio_opi +build_flags = + ${base.build_flags} + -DFREEINK_DEVICE_METALIO_EINK4=1 + -DFREEINK_CAP_USB_MSC=1 + -DUSB_PRODUCT=\"CrossPoint_Metalio_EInk4\" + -DUSB_MANUFACTURER=\"CrossPoint\" + -DBOARD_HAS_PSRAM + -DUSE_BLOCK_DEVICE_INTERFACE=1 + -DCROSSPOINT_VERSION=\"${crosspoint.version}-rc+${sysenv.CROSSPOINT_RC_HASH}\" + -DENABLE_SERIAL_LOG + -DLOG_LEVEL=1 + +[env:x4c] +extends = base +board = esp32-s3-devkitc1-n16r8 +board_build.mcu = esp32s3 +board_build.arduino.memory_type = dio_opi +build_flags = + ${base.build_flags} + -DFREEINK_DEVICE_X4CLASSIC=1 + -DFREEINK_CAP_USB_MSC=1 + -DBOARD_HAS_PSRAM + -DUSB_PRODUCT=\"CrossPoint_X4_Classic\" + -DUSB_MANUFACTURER=\"CrossPoint\" + -DENABLE_SERIAL_LOG + -DCROSSPOINT_WAIT_FOR_USB_SERIAL + -DLOG_LEVEL=2 + -DUSE_BLOCK_DEVICE_INTERFACE=1 + +[env:x4c-gh_release] +extends = base +board = esp32-s3-devkitc1-n16r8 +board_build.mcu = esp32s3 +board_build.arduino.memory_type = dio_opi +build_flags = + ${base.build_flags} + -DFREEINK_DEVICE_X4CLASSIC=1 + -DFREEINK_CAP_USB_MSC=1 + -DBOARD_HAS_PSRAM + -DUSB_PRODUCT=\"CrossPoint_X4_Classic\" + -DUSB_MANUFACTURER=\"CrossPoint\" + -DCROSSPOINT_VERSION=\"${crosspoint.version}\" + -DENABLE_SERIAL_LOG + -DLOG_LEVEL=1 + -DUSE_BLOCK_DEVICE_INTERFACE=1 + +[env:x4c-gh_release_rc] +extends = base +board = esp32-s3-devkitc1-n16r8 +board_build.mcu = esp32s3 +board_build.arduino.memory_type = dio_opi +build_flags = + ${base.build_flags} + -DFREEINK_DEVICE_X4CLASSIC=1 + -DFREEINK_CAP_USB_MSC=1 + -DBOARD_HAS_PSRAM + -DUSB_PRODUCT=\"CrossPoint_X4_Classic\" + -DUSB_MANUFACTURER=\"CrossPoint\" + -DCROSSPOINT_VERSION=\"${crosspoint.version}-rc+${sysenv.CROSSPOINT_RC_HASH}\" + -DENABLE_SERIAL_LOG + -DLOG_LEVEL=1 + -DUSE_BLOCK_DEVICE_INTERFACE=1 + +[env:x4pro-gh_release] +extends = base +board = esp32-s3-devkitc1-n16r8 +board_build.mcu = esp32s3 +board_build.arduino.memory_type = dio_opi +build_flags = + ${base.build_flags} + -DFREEINK_DEVICE_X4PRO=1 + -DFREEINK_CAP_USB_MSC=1 + -DBOARD_HAS_PSRAM + -DUSB_PRODUCT=\"CrossPoint_X4_Pro\" + -DUSB_MANUFACTURER=\"CrossPoint\" + -DCROSSPOINT_VERSION=\"${crosspoint.version}\" + -DENABLE_SERIAL_LOG + -DLOG_LEVEL=1 + -DUSE_BLOCK_DEVICE_INTERFACE=1 + +[env:x4pro-gh_release_rc] +extends = base +board = esp32-s3-devkitc1-n16r8 +board_build.mcu = esp32s3 +board_build.arduino.memory_type = dio_opi +build_flags = + ${base.build_flags} + -DFREEINK_DEVICE_X4PRO=1 + -DFREEINK_CAP_USB_MSC=1 + -DBOARD_HAS_PSRAM + -DUSB_PRODUCT=\"CrossPoint_X4_Pro\" + -DUSB_MANUFACTURER=\"CrossPoint\" + -DCROSSPOINT_VERSION=\"${crosspoint.version}-rc+${sysenv.CROSSPOINT_RC_HASH}\" + -DENABLE_SERIAL_LOG + -DLOG_LEVEL=1 + -DUSE_BLOCK_DEVICE_INTERFACE=1 + +[env:papermono] +extends = base +board = esp32-s3-devkitc1-n16r8 +board_build.mcu = esp32s3 +board_build.arduino.memory_type = dio_opi +build_flags = + ${base.build_flags} + -DFREEINK_DEVICE_PAPERMONO=1 + -DFREEINK_CAP_USB_MSC=1 + -DBOARD_HAS_PSRAM + -DUSB_PRODUCT=\"CrossPoint_Paper_Mono\" + -DUSB_MANUFACTURER=\"CrossPoint\" + -DENABLE_SERIAL_LOG + -DCROSSPOINT_WAIT_FOR_USB_SERIAL + -DLOG_LEVEL=2 + -DUSE_BLOCK_DEVICE_INTERFACE=1 + +[env:papermono-gh_release] +extends = base +board = esp32-s3-devkitc1-n16r8 +board_build.mcu = esp32s3 +board_build.arduino.memory_type = dio_opi +build_flags = + ${base.build_flags} + -DFREEINK_DEVICE_PAPERMONO=1 + -DFREEINK_CAP_USB_MSC=1 + -DBOARD_HAS_PSRAM + -DUSB_PRODUCT=\"CrossPoint_Paper_Mono\" + -DUSB_MANUFACTURER=\"CrossPoint\" + -DCROSSPOINT_VERSION=\"${crosspoint.version}\" + -DENABLE_SERIAL_LOG + -DLOG_LEVEL=1 + -DUSE_BLOCK_DEVICE_INTERFACE=1 + +[env:papermono-gh_release_rc] +extends = base +board = esp32-s3-devkitc1-n16r8 +board_build.mcu = esp32s3 +board_build.arduino.memory_type = dio_opi +build_flags = + ${base.build_flags} + -DFREEINK_DEVICE_PAPERMONO=1 + -DFREEINK_CAP_USB_MSC=1 + -DBOARD_HAS_PSRAM + -DUSB_PRODUCT=\"CrossPoint_Paper_Mono\" + -DUSB_MANUFACTURER=\"CrossPoint\" + -DCROSSPOINT_VERSION=\"${crosspoint.version}-rc+${sysenv.CROSSPOINT_RC_HASH}\" + -DENABLE_SERIAL_LOG + -DLOG_LEVEL=1 + -DUSE_BLOCK_DEVICE_INTERFACE=1 + +[env:eego_a4] +extends = base +board = esp32-s3-devkitc1-n16r8 +board_build.mcu = esp32s3 +board_build.flash_mode = dio +board_build.arduino.memory_type = dio_opi +build_flags = + ${base.build_flags} + -DFREEINK_DEVICE_EEGO_A4=1 + -DFREEINK_CAP_USB_MSC=1 + -DBOARD_HAS_PSRAM + -DUSB_PRODUCT=\"CrossPoint_EEGO_A4\" + -DUSB_MANUFACTURER=\"CrossPoint\" + -DENABLE_SERIAL_LOG + -DCROSSPOINT_WAIT_FOR_USB_SERIAL + -DLOG_LEVEL=2 + +[env:eego_a4-gh_release] +extends = base +board = esp32-s3-devkitc1-n16r8 +board_build.mcu = esp32s3 +board_build.flash_mode = dio +board_build.arduino.memory_type = dio_opi +build_flags = + ${base.build_flags} + -DFREEINK_DEVICE_EEGO_A4=1 + -DFREEINK_CAP_USB_MSC=1 + -DBOARD_HAS_PSRAM + -DUSB_PRODUCT=\"CrossPoint_EEGO_A4\" + -DUSB_MANUFACTURER=\"CrossPoint\" + -DCROSSPOINT_VERSION=\"${crosspoint.version}\" + -DENABLE_SERIAL_LOG + -DLOG_LEVEL=1 + +[env:eego_a4-gh_release_rc] +extends = base +board = esp32-s3-devkitc1-n16r8 +board_build.mcu = esp32s3 +board_build.flash_mode = dio +board_build.arduino.memory_type = dio_opi +build_flags = + ${base.build_flags} + -DFREEINK_DEVICE_EEGO_A4=1 + -DFREEINK_CAP_USB_MSC=1 + -DBOARD_HAS_PSRAM + -DUSB_PRODUCT=\"CrossPoint_EEGO_A4\" + -DUSB_MANUFACTURER=\"CrossPoint\" + -DCROSSPOINT_VERSION=\"${crosspoint.version}-rc+${sysenv.CROSSPOINT_RC_HASH}\" + -DENABLE_SERIAL_LOG + -DLOG_LEVEL=1 + +[env:picco] +extends = base +board = esp32-s3-devkitc1-n16r8 +board_build.mcu = esp32s3 +board_build.arduino.memory_type = dio_opi +board_build.partitions = partitions_picco.csv +extra_scripts = + ${base.extra_scripts} + post:scripts/app_only_upload.py +build_flags = + ${base.build_flags} + -DFREEINK_DEVICE_PICCO=1 + -DFREEINK_CAP_USB_MSC=1 + -DBOARD_HAS_PSRAM + -DUSB_PRODUCT=\"CrossPoint_Picco\" + -DUSB_MANUFACTURER=\"CrossPoint\" + -DENABLE_SERIAL_LOG + -DCROSSPOINT_WAIT_FOR_USB_SERIAL + -DLOG_LEVEL=2 + -DUSE_BLOCK_DEVICE_INTERFACE=1 + +[env:picco-gh_release] +extends = base +board = esp32-s3-devkitc1-n16r8 +board_build.mcu = esp32s3 +board_build.arduino.memory_type = dio_opi +board_build.partitions = partitions_picco.csv +extra_scripts = + ${base.extra_scripts} + post:scripts/app_only_upload.py +build_flags = + ${base.build_flags} + -DFREEINK_DEVICE_PICCO=1 + -DFREEINK_CAP_USB_MSC=1 + -DBOARD_HAS_PSRAM + -DUSB_PRODUCT=\"CrossPoint_Picco\" + -DUSB_MANUFACTURER=\"CrossPoint\" + -DCROSSPOINT_VERSION=\"${crosspoint.version}\" + -DENABLE_SERIAL_LOG + -DLOG_LEVEL=1 + -DUSE_BLOCK_DEVICE_INTERFACE=1 + +[env:picco-gh_release_rc] +extends = base +board = esp32-s3-devkitc1-n16r8 +board_build.mcu = esp32s3 +board_build.arduino.memory_type = dio_opi +board_build.partitions = partitions_picco.csv +extra_scripts = + ${base.extra_scripts} + post:scripts/app_only_upload.py +build_flags = + ${base.build_flags} + -DFREEINK_DEVICE_PICCO=1 + -DFREEINK_CAP_USB_MSC=1 + -DBOARD_HAS_PSRAM + -DUSB_PRODUCT=\"CrossPoint_Picco\" + -DUSB_MANUFACTURER=\"CrossPoint\" + -DCROSSPOINT_VERSION=\"${crosspoint.version}-rc+${sysenv.CROSSPOINT_RC_HASH}\" + -DENABLE_SERIAL_LOG + -DLOG_LEVEL=1 + -DUSE_BLOCK_DEVICE_INTERFACE=1 diff --git a/src/activities/library/LibraryListActivity.cpp b/src/activities/library/LibraryListActivity.cpp index 9acf1d20796..3272447d397 100644 --- a/src/activities/library/LibraryListActivity.cpp +++ b/src/activities/library/LibraryListActivity.cpp @@ -1042,7 +1042,6 @@ void LibraryListActivity::drawPositionReadout() const { char buf[32]; const char* positionFormat = groupsCollapsed ? tr(STR_LIBRARY_GROUP_POSITION) : tr(STR_LIBRARY_POSITION); snprintf(buf, sizeof(buf), positionFormat, selectedEntry() + 1, count); - const auto& metrics = UITheme::getInstance().getMetrics(); const int width = renderer.getTextWidth(SMALL_FONT_ID, buf); // Bottom-right of the viewable area, clear of the bezel and rounded corner. const Rect area = UITheme::getContentArea(renderer); @@ -1072,7 +1071,6 @@ void LibraryListActivity::drawHoldHelp() const { help = tr(STR_LIBRARY_HOLD_GROUPS); if (!help) return; - const auto& metrics = UITheme::getInstance().getMetrics(); const int lineHeight = renderer.getLineHeight(SMALL_FONT_ID); const Rect area = UITheme::getContentArea(renderer); const int left = std::max(area.x, bottomCornerClearance()) + UITheme::getHintRailLeftGutter(renderer); diff --git a/src/components/UITheme.cpp b/src/components/UITheme.cpp index 8bc1fc7792f..6e75e83f634 100644 --- a/src/components/UITheme.cpp +++ b/src/components/UITheme.cpp @@ -150,18 +150,18 @@ int16_t UITheme::getHintBandBottomInset(const GfxRenderer& renderer) { orientation == GfxRenderer::Orientation::LandscapeCounterClockwise) { return 0; // The rail is a side gutter in landscape, not a bottom band. } - return static_cast(getMetrics().buttonHintsHeight); + return static_cast(getInstance().getMetrics().buttonHintsHeight); } int16_t UITheme::getHintRailLeftGutter(const GfxRenderer& renderer) { return renderer.getOrientation() == GfxRenderer::Orientation::LandscapeClockwise - ? static_cast(getMetrics().buttonHintsHeight) + ? static_cast(getInstance().getMetrics().buttonHintsHeight) : 0; } int16_t UITheme::getHintRailRightGutter(const GfxRenderer& renderer) { return renderer.getOrientation() == GfxRenderer::Orientation::LandscapeCounterClockwise - ? static_cast(getMetrics().buttonHintsHeight) + ? static_cast(getInstance().getMetrics().buttonHintsHeight) : 0; } From 62004c1d67bba41608a3c584a21a64b257f42596 Mon Sep 17 00:00:00 2001 From: Raxcoms Date: Sat, 21 Nov 2026 11:30:32 -0300 Subject: [PATCH 12/20] ci: pin tool-scons via the official package registry 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. --- .github/workflows/ci.yml | 8 ++++---- platformio.ini | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c30280bd970..49c5a5fe5f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,8 +65,8 @@ jobs: uses: actions/cache@v4 with: path: ~/.platformio - key: pio-v2-${{ runner.os }}-${{ hashFiles('platformio.ini', 'scripts/patch_pioarduino_cache.py') }} - restore-keys: pio-v2-${{ runner.os }}- + key: pio-v3-${{ runner.os }}-${{ hashFiles('platformio.ini', 'scripts/patch_pioarduino_cache.py') }} + restore-keys: pio-v3-${{ runner.os }}- - name: Install cppcheck runtime dependency run: | @@ -127,8 +127,8 @@ jobs: uses: actions/cache@v4 with: path: ~/.platformio - key: pio-v3-${{ runner.os }}-${{ matrix.env }}-${{ hashFiles('platformio.ini', 'scripts/patch_pioarduino_cache.py') }} - restore-keys: pio-v3-${{ runner.os }}-${{ matrix.env }}- + key: pio-v4-${{ runner.os }}-${{ matrix.env }}-${{ hashFiles('platformio.ini', 'scripts/patch_pioarduino_cache.py') }} + restore-keys: pio-v4-${{ runner.os }}-${{ matrix.env }}- - name: Pin pioarduino core inside the platform penv run: | diff --git a/platformio.ini b/platformio.ini index 4338e778806..3ba97ac3ecc 100644 --- a/platformio.ini +++ b/platformio.ini @@ -217,7 +217,10 @@ build_flags = -DENABLE_SERIAL_LOG -DCROSSPOINT_WAIT_FOR_USB_SERIAL -DLOG_LEVEL=2 -platform_packages = https://github.com/pioarduino/registry/releases/download/0.0.1/scons-4.8.1.zip +; Pin SCons via the official package (not the pioarduino release URL: the bare +; URL entry makes fresh dependency resolution look for a package named +; "registry" and fail; see pioarduino issues #529/#572). +platform_packages = platformio/tool-scons@4.40801.0 [env:gh_release] extends = base, firmware_tuned_c3 From b681d7dc99cbb906a632d98049f3d564eef13b94 Mon Sep 17 00:00:00 2001 From: Raxcoms Date: Sat, 21 Nov 2026 12:14:46 -0300 Subject: [PATCH 13/20] fix(ui): center header status chrome in landscape 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. --- src/components/CatalogScreens.cpp | 11 +++++++ src/components/themes/BaseTheme.cpp | 16 ++++++++++ src/components/themes/HeaderChrome.h | 46 ++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 src/components/themes/HeaderChrome.h diff --git a/src/components/CatalogScreens.cpp b/src/components/CatalogScreens.cpp index 44319458ff2..9263b844984 100644 --- a/src/components/CatalogScreens.cpp +++ b/src/components/CatalogScreens.cpp @@ -24,6 +24,17 @@ void catalogScreenHeader(UiAppHost::UiScreen& screen, const GfxRenderer& rendere // Same battery/clock band as every GUI.drawHeader screen; the header // heights are unified across themes, so the buttons derive from the band. GUI.applyHeaderStatus(renderer, header); + // Landscape: the hint rail covers the corners the header pins its status to, + // so withhold that chrome and draw it centered after the band. + const auto orientation = renderer.getOrientation(); + const bool centerStatus = orientation == GfxRenderer::Orientation::LandscapeClockwise || + orientation == GfxRenderer::Orientation::LandscapeCounterClockwise; + fui::HeaderStatusProps centeredChrome; + if (centerStatus) { + centeredChrome = header.status; + header.status.showBattery = false; + header.status.clockText = nullptr; + } const auto frameRect = screen.frame().screen(); const fui::Rect band = BaseTheme::headerBand(renderer, fui::Rect{frameRect.x, static_cast(metrics.topPadding), diff --git a/src/components/themes/BaseTheme.cpp b/src/components/themes/BaseTheme.cpp index f48ab18120d..7b25884bfe6 100644 --- a/src/components/themes/BaseTheme.cpp +++ b/src/components/themes/BaseTheme.cpp @@ -14,6 +14,7 @@ #include #include +#include "HeaderChrome.h" #include "I18n.h" #include "RecentBooksStore.h" #include "clippings/SelectionGeometry.h" @@ -466,6 +467,18 @@ void BaseTheme::drawHeader(const GfxRenderer& renderer, Rect rect, const char* t // Battery + clock chrome and their title reserves live in the FreeInkUI // header component; this only fills the values from settings and metrics. applyHeaderStatus(renderer, props); + // In landscape the hint rail covers the edge corners where the header pins + // the battery and clock, so withhold that chrome and draw the group + // centered after the band is painted. + const auto orientation = renderer.getOrientation(); + const bool centerStatus = orientation == GfxRenderer::Orientation::LandscapeClockwise || + orientation == GfxRenderer::Orientation::LandscapeCounterClockwise; + freeink::ui::HeaderStatusProps centeredChrome; + if (centerStatus) { + centeredChrome = props.status; + props.status.showBattery = false; + props.status.clockText = nullptr; + } // Callers pass a full-width header rect; headerBand fits it to the board's bezel. const fui::Rect band = headerBand(renderer, fui::Rect{static_cast(rect.x), static_cast(rect.y), @@ -504,6 +517,9 @@ void BaseTheme::drawHeader(const GfxRenderer& renderer, Rect rect, const char* t props.styles.normal.borderWidth = tokens.headerUnderline; } fui::header(ui.frame, band, props); + if (centerStatus) { + fui::drawCenteredHeaderStatus(ui.frame, band, centeredChrome); + } } void BaseTheme::drawSubHeader(const GfxRenderer& renderer, Rect rect, const char* label, const char* rightLabel) const { diff --git a/src/components/themes/HeaderChrome.h b/src/components/themes/HeaderChrome.h new file mode 100644 index 00000000000..ed113eff80e --- /dev/null +++ b/src/components/themes/HeaderChrome.h @@ -0,0 +1,46 @@ +#pragma once +// Helpers for header status chrome that the fui header cannot place itself. +#include +#include +#include + +namespace freeink { +namespace ui { + +// In landscape the button-hint rail sits over the edge corners where the fui +// header pins the battery and clock. BaseTheme draws those as one group +// centered on the status strip instead; pass the filled status props that were +// withheld from the header. Placement mirrors the header component's own +// measurements so chrome placement stays consistent across screens. +template +void drawCenteredHeaderStatus(Frame& frame, const Rect& band, const HeaderStatusProps& status) { + if (!status.showBattery && !status.clockText) return; + DrawTarget& target = frame.target(); + int16_t batteryW = 0; + if (status.showBattery) { + batteryW = static_cast(status.battery.glyphWidth + 2); + if (status.battery.label) { + batteryW = static_cast( + batteryW + status.battery.gap + + target.measureText(status.battery.text.font, status.battery.label, status.battery.text).width); + } + } + const int16_t clockW = status.clockText + ? target.measureText(status.battery.text.font, status.clockText, status.battery.text).width + : 0; + const int16_t groupGap = batteryW > 0 && clockW > 0 ? status.battery.gap : 0; + const int16_t groupX = static_cast(band.x + (band.width - (batteryW + clockW + groupGap)) / 2); + if (batteryW > 0) { + batteryIndicator(frame, Rect{groupX, band.y, batteryW, status.stripHeight}, status.battery); + } + if (clockW > 0) { + const int16_t clockX = static_cast(groupX + batteryW + groupGap); + const int16_t lineH = target.lineHeight(status.battery.text.font); + const Rect ink = target.inkBounds(status.battery.text.font, status.clockText, status.battery.text); + const int16_t clockY = static_cast(band.y + (status.stripHeight - ink.height) / 2 - ink.y); + target.text(Rect{clockX, clockY, clockW, lineH}, status.clockText, status.battery.text); + } +} + +} // namespace ui +} // namespace freeink From e1c11490241880ce8929d8d489b552eb41df0c11 Mon Sep 17 00:00:00 2001 From: Raxcoms Date: Sat, 21 Nov 2026 12:28:24 -0300 Subject: [PATCH 14/20] fix(ui): address format and cppcheck findings in header chrome 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. --- src/components/CatalogScreens.cpp | 6 ++++-- src/components/themes/BaseTheme.cpp | 3 +-- src/components/themes/HeaderChrome.h | 5 ++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/CatalogScreens.cpp b/src/components/CatalogScreens.cpp index 9263b844984..491334033ca 100644 --- a/src/components/CatalogScreens.cpp +++ b/src/components/CatalogScreens.cpp @@ -29,9 +29,8 @@ void catalogScreenHeader(UiAppHost::UiScreen& screen, const GfxRenderer& rendere const auto orientation = renderer.getOrientation(); const bool centerStatus = orientation == GfxRenderer::Orientation::LandscapeClockwise || orientation == GfxRenderer::Orientation::LandscapeCounterClockwise; - fui::HeaderStatusProps centeredChrome; + fui::HeaderStatusProps centeredChrome = header.status; if (centerStatus) { - centeredChrome = header.status; header.status.showBattery = false; header.status.clockText = nullptr; } @@ -70,6 +69,9 @@ void catalogScreenHeader(UiAppHost::UiScreen& screen, const GfxRenderer& rendere header.sidePadding = theme.headerSidePadding; header.minTouchSize = theme.minTouchSize; fui::header(screen.frame(), band, header); + if (centerStatus) { + fui::drawCenteredHeaderStatus(screen.frame(), band, centeredChrome); + } screen.setContentMarginFromScreen( fui::Insets{static_cast(metrics.topPadding + metrics.headerHeight + metrics.verticalSpacing), 0, UITheme::getHintBandBottomInset(renderer), 0}); diff --git a/src/components/themes/BaseTheme.cpp b/src/components/themes/BaseTheme.cpp index 7b25884bfe6..42f73661409 100644 --- a/src/components/themes/BaseTheme.cpp +++ b/src/components/themes/BaseTheme.cpp @@ -473,9 +473,8 @@ void BaseTheme::drawHeader(const GfxRenderer& renderer, Rect rect, const char* t const auto orientation = renderer.getOrientation(); const bool centerStatus = orientation == GfxRenderer::Orientation::LandscapeClockwise || orientation == GfxRenderer::Orientation::LandscapeCounterClockwise; - freeink::ui::HeaderStatusProps centeredChrome; + freeink::ui::HeaderStatusProps centeredChrome = props.status; if (centerStatus) { - centeredChrome = props.status; props.status.showBattery = false; props.status.clockText = nullptr; } diff --git a/src/components/themes/HeaderChrome.h b/src/components/themes/HeaderChrome.h index ed113eff80e..f40e59d38e0 100644 --- a/src/components/themes/HeaderChrome.h +++ b/src/components/themes/HeaderChrome.h @@ -25,9 +25,8 @@ void drawCenteredHeaderStatus(Frame& frame, const Rect& band, c target.measureText(status.battery.text.font, status.battery.label, status.battery.text).width); } } - const int16_t clockW = status.clockText - ? target.measureText(status.battery.text.font, status.clockText, status.battery.text).width - : 0; + const int16_t clockW = + status.clockText ? target.measureText(status.battery.text.font, status.clockText, status.battery.text).width : 0; const int16_t groupGap = batteryW > 0 && clockW > 0 ? status.battery.gap : 0; const int16_t groupX = static_cast(band.x + (band.width - (batteryW + clockW + groupGap)) / 2); if (batteryW > 0) { From 41085a324dd07975d0779aeb97bcef60bcf13d4d Mon Sep 17 00:00:00 2001 From: Raxcoms Date: Sat, 21 Nov 2026 12:40:30 -0300 Subject: [PATCH 15/20] fix(ui): include header chrome helper in catalog screens --- src/components/CatalogScreens.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/CatalogScreens.cpp b/src/components/CatalogScreens.cpp index 491334033ca..e114a22f79d 100644 --- a/src/components/CatalogScreens.cpp +++ b/src/components/CatalogScreens.cpp @@ -11,6 +11,7 @@ #include "HeaderBackTapTarget.h" #include "UITheme.h" #include "icons/headerIcons.h" +#include "themes/HeaderChrome.h" namespace fui = freeink::ui; From 96e9b3f04da5af2c17d07277f81306f771867d02 Mon Sep 17 00:00:00 2001 From: Raxcoms Date: Sat, 21 Nov 2026 12:58:41 -0300 Subject: [PATCH 16/20] feat(ui): add position readout to shared list screens 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). --- src/activities/UiListActivity.cpp | 32 +++++++++++++++++++ src/activities/UiListActivity.h | 16 ++++++++++ src/activities/UiTabListActivity.cpp | 2 ++ src/activities/UiTabListActivity.h | 3 ++ .../browser/OpdsBookBrowserActivity.cpp | 5 ++- src/activities/home/FileBrowserActivity.cpp | 1 + .../library/LibraryListActivity.cpp | 2 ++ .../plugins/PluginCatalogActivity.cpp | 6 +++- .../settings/FontDownloadActivity.cpp | 1 + src/activities/settings/SettingsActivity.cpp | 1 + .../settings/StatusBarSettingsActivity.cpp | 5 ++- .../settings/TextSettingsActivity.cpp | 6 +++- test/test_text_settings_layout.py | 7 +++- 13 files changed, 82 insertions(+), 5 deletions(-) diff --git a/src/activities/UiListActivity.cpp b/src/activities/UiListActivity.cpp index 39e15838954..3e7cf34957f 100644 --- a/src/activities/UiListActivity.cpp +++ b/src/activities/UiListActivity.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include "MappedInputManager.h" @@ -167,6 +168,20 @@ void UiListActivity::moveSelectionTo(const int index) { requestUpdate(); } +// "12/69" at the bottom-right of the folded content. Anchored by +// syncListViewport; skipped when this build did not place it. +void UiListActivity::drawPositionReadout() { + if (!positionReadout || readoutY_ < 0) return; + const int count = listCount(); + if (count <= 0) return; + const int position = std::max(0, readoutPosition()); + char buf[24]; + snprintf(buf, sizeof(buf), "%d/%d", position + 1, count); + const int width = renderer.getTextWidth(SMALL_FONT_ID, buf); + const int x = readoutRight_ - width - 8; + renderer.drawText(SMALL_FONT_ID, x, readoutY_, buf, true); +} + void UiListActivity::loop() { if (handleCustomInput()) return; #if FREEINK_CAP_TOUCH @@ -220,6 +235,22 @@ void UiListActivity::syncListViewport(UiScreen& screen, fui::ListProps& props, c const bool trusted = n.trusts(listCount()); const int drawn = n.drawnRows; + // Claim the line the position readout paints on so rows never run under it, + // then anchor the readout to the folded edge. Anchoring inside the sync (not + // in absolute screen coords) keeps it clear of takeBottom reservations like + // the bookmarks help line, and the fui safe area already folds in the bezel + // and landscape rail gutters. + if (positionReadout && listCount() > 0) { + constexpr int16_t READOUT_GAP = 4; // the list's fold sits just above the readout's line box + const int16_t reserved = static_cast(renderer.getLineHeight(SMALL_FONT_ID) + READOUT_GAP); + screen.insetContent(fui::Insets{0, 0, reserved, 0}); + const fui::Rect content = screen.contentRect(); + readoutRight_ = content.right(); + readoutY_ = static_cast(content.bottom() + READOUT_GAP); + } else { + readoutY_ = -1; + } + screen.syncListViewport(n, props, listCount(), selectionOffset); // When the selection is already visible in the current viewport (based on @@ -245,6 +276,7 @@ void UiListActivity::drawChrome() { void UiListActivity::drawFooter() { const auto labels = mappedInput.mapLabels(tr(STR_BACK), tr(STR_SELECT), tr(STR_DIR_UP), tr(STR_DIR_DOWN)); GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4); + drawPositionReadout(); } void UiListActivity::render(RenderLock&&) { diff --git a/src/activities/UiListActivity.h b/src/activities/UiListActivity.h index ab6e42f419e..d72df9ca115 100644 --- a/src/activities/UiListActivity.h +++ b/src/activities/UiListActivity.h @@ -86,6 +86,18 @@ class UiListActivity : public Activity, protected UiAppHost { // Move the selection to index and pull the viewport to it. void moveSelectionTo(int index); + // "position/count" readout at the bottom-right of the content area, just + // above the portrait hint band or at the rail's inner edge in landscape. + // syncListViewport reserves its line so rows never run under it. Disabled + // by screens with their own pager or readout (library, OPDS browser, ...). + bool positionReadout = true; + // 0-based row the readout reports. UiTabListActivity subtracts the ring's + // leading tab-band slot. + virtual int readoutPosition() { return activeNav().selected; } + // Draws the readout. Called from the default drawFooter; screens with + // custom button hints call it explicitly. + void drawPositionReadout(); + // --- shared state ---------------------------------------------------------- // Selection + viewport (selected/top/visibleRows/followOnBuild). Access via // activeNav() in shared code; `nav` is the single-list default storage. @@ -95,6 +107,10 @@ class UiListActivity : public Activity, protected UiAppHost { bool cleanNextRefresh = false; private: + // Readout anchor set by the last syncListViewport (readoutY_ < 0 = none). + int16_t readoutRight_ = 0; + int16_t readoutY_ = -1; + static void screenTrampoline(UiScreen& screen, void* user); static void rowActionTrampoline(const freeink::ui::ActionEvent& event, void* user); // Named apart from UiAppHost::routeTouch so the host overload stays visible diff --git a/src/activities/UiTabListActivity.cpp b/src/activities/UiTabListActivity.cpp index b03bb1f2629..29b814a2f0d 100644 --- a/src/activities/UiTabListActivity.cpp +++ b/src/activities/UiTabListActivity.cpp @@ -95,6 +95,8 @@ void UiTabListActivity::syncTabListViewport(UiScreen& screen, fui::ListProps& pr syncListViewport(screen, props, 1); } +int UiTabListActivity::readoutPosition() { return std::max(0, activeNav().selected - 1); } + void UiTabListActivity::buildTabBar(UiScreen& screen) { const auto& metrics = UITheme::getInstance().getMetrics(); diff --git a/src/activities/UiTabListActivity.h b/src/activities/UiTabListActivity.h index b5fb9662ec4..a166f624b9c 100644 --- a/src/activities/UiTabListActivity.h +++ b/src/activities/UiTabListActivity.h @@ -64,6 +64,9 @@ class UiTabListActivity : public UiListActivity { // props.selectedIndex = ring - 1. void syncTabListViewport(UiScreen& screen, freeink::ui::ListProps& props); + // Ring position 0 is the tab band; the readout reports the row index. + int readoutPosition() override; + // Per-tab selection/viewport state, sized in onEnter. Protected so subclass // tab-switch code can seed the target tab's ring/viewport. std::vector tabNavs; diff --git a/src/activities/browser/OpdsBookBrowserActivity.cpp b/src/activities/browser/OpdsBookBrowserActivity.cpp index 213cf2bea89..e57a0aabdb4 100644 --- a/src/activities/browser/OpdsBookBrowserActivity.cpp +++ b/src/activities/browser/OpdsBookBrowserActivity.cpp @@ -80,7 +80,10 @@ StrId feedFailureMessage() { OpdsBookBrowserActivity::OpdsBookBrowserActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, OpdsServer server) - : CatalogActivity("OpdsBookBrowser", renderer, mappedInput), server(std::move(server)) {} + : CatalogActivity("OpdsBookBrowser", renderer, mappedInput), server(std::move(server)) { + // Server-side paging: the arrows already show their own "N/M" page counter. + positionReadout = false; +} void OpdsBookBrowserActivity::onEnter() { CatalogActivity::onEnter(); diff --git a/src/activities/home/FileBrowserActivity.cpp b/src/activities/home/FileBrowserActivity.cpp index 5129ea1287e..8d6a9a4d3d1 100644 --- a/src/activities/home/FileBrowserActivity.cpp +++ b/src/activities/home/FileBrowserActivity.cpp @@ -699,6 +699,7 @@ void FileBrowserActivity::drawFooter() { const auto labels = mappedInput.mapLabels(backLabel, confirmLabel, files.empty() ? "" : tr(STR_DIR_UP), files.empty() ? "" : tr(STR_DIR_DOWN)); GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4); + drawPositionReadout(); } size_t FileBrowserActivity::findEntry(const std::string& name) const { diff --git a/src/activities/library/LibraryListActivity.cpp b/src/activities/library/LibraryListActivity.cpp index 3272447d397..8a943802d7a 100644 --- a/src/activities/library/LibraryListActivity.cpp +++ b/src/activities/library/LibraryListActivity.cpp @@ -78,6 +78,8 @@ LibraryListActivity::LibraryListActivity(GfxRenderer& renderer, MappedInputManag // Three short tab labels: a full-slot pill would stretch across a third of // the screen, so cap it at the label plus padding (slots stay put). tabPillMaxPad = 16; + // This screen draws its own "n/m books" readout with its reserved line. + positionReadout = false; } void LibraryListActivity::onEnter() { diff --git a/src/activities/plugins/PluginCatalogActivity.cpp b/src/activities/plugins/PluginCatalogActivity.cpp index 855f2c10da3..0c54a6d2b14 100644 --- a/src/activities/plugins/PluginCatalogActivity.cpp +++ b/src/activities/plugins/PluginCatalogActivity.cpp @@ -540,7 +540,11 @@ std::string PluginCatalogActivity::downloadDir() const { PluginCatalogActivity::PluginCatalogActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, const bool rootMode) - : CatalogActivity("PluginCatalog", renderer, mappedInput, /*wantsTouchLongPress=*/true), rootMode(rootMode) {} + : CatalogActivity("PluginCatalog", renderer, mappedInput, /*wantsTouchLongPress=*/true), rootMode(rootMode) { + // Own page-window paging with prev/next arrows; a row count over the + // current page window would misread as a list total. + positionReadout = false; +} PluginCatalogActivity::~PluginCatalogActivity() = default; diff --git a/src/activities/settings/FontDownloadActivity.cpp b/src/activities/settings/FontDownloadActivity.cpp index d9c3c1c26a1..fd6553fe6fe 100644 --- a/src/activities/settings/FontDownloadActivity.cpp +++ b/src/activities/settings/FontDownloadActivity.cpp @@ -942,6 +942,7 @@ void FontDownloadActivity::drawFooter() { hasVisibleFamilies ? tr(STR_DIR_DOWN) : ""); GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4); } + drawPositionReadout(); } void FontDownloadActivity::render(RenderLock&& lock) { diff --git a/src/activities/settings/SettingsActivity.cpp b/src/activities/settings/SettingsActivity.cpp index 39ae81be378..7321e949b45 100644 --- a/src/activities/settings/SettingsActivity.cpp +++ b/src/activities/settings/SettingsActivity.cpp @@ -648,6 +648,7 @@ void SettingsActivity::drawFooter() { const auto labels = mappedInput.mapLabels(tr(STR_BACK), picker ? tr(STR_SELECT) : tr(STR_TOGGLE), tr(STR_DIR_UP), tr(STR_DIR_DOWN)); GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4); + drawPositionReadout(); } void SettingsActivity::render(RenderLock&& lock) { diff --git a/src/activities/settings/StatusBarSettingsActivity.cpp b/src/activities/settings/StatusBarSettingsActivity.cpp index 7d5eeb25daf..0ea7804aab1 100644 --- a/src/activities/settings/StatusBarSettingsActivity.cpp +++ b/src/activities/settings/StatusBarSettingsActivity.cpp @@ -66,7 +66,10 @@ const int verticalPreviewTextPadding = 40; } // namespace StatusBarSettingsActivity::StatusBarSettingsActivity(GfxRenderer& renderer, MappedInputManager& mappedInput) - : UiListActivity("StatusBarSettings", renderer, mappedInput) {} + : UiListActivity("StatusBarSettings", renderer, mappedInput) { + // Style picker with a live preview; the handful of rows never overflow. + positionReadout = false; +} void StatusBarSettingsActivity::onEnter() { UiListActivity::onEnter(); diff --git a/src/activities/settings/TextSettingsActivity.cpp b/src/activities/settings/TextSettingsActivity.cpp index fe1759f807f..1a7fd2cf387 100644 --- a/src/activities/settings/TextSettingsActivity.cpp +++ b/src/activities/settings/TextSettingsActivity.cpp @@ -65,7 +65,11 @@ static_assert(std::size(WORD_SPACING_IDS) == (WORD_SPACING_MAX - WORD_SPACING_MI TextSettingsActivity::TextSettingsActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, const SdCardFontRegistry* registry, Tab initialTab) - : UiTabListActivity("TextSettings", renderer, mappedInput), registry_(registry), tab_(initialTab) {} + : UiTabListActivity("TextSettings", renderer, mappedInput), registry_(registry), tab_(initialTab) { + // Fixed short tab lists under a live preview; a reserved readout line would + // cost preview height for no pagination benefit. + positionReadout = false; +} const char* TextSettingsActivity::tabLabel(const int index) const { return I18N.get(TAB_NAME_IDS[index]); } diff --git a/test/test_text_settings_layout.py b/test/test_text_settings_layout.py index 93807f74634..29e1d03845e 100644 --- a/test/test_text_settings_layout.py +++ b/test/test_text_settings_layout.py @@ -79,6 +79,7 @@ def method(source, signature): Orientation getOrientation() const { return orientation; } void getOrientedViewableTRBL(int*, int*, int*, int*) const; int getTextHeight(int) const { return ubuntu_10_regular.ascender; } + int getLineHeight(int) const { return ubuntu_10_regular.advanceY; } void drawText(int, int x, int y, const char* text) const { EpdFont font(&ubuntu_10_regular); int width, height; @@ -102,7 +103,7 @@ def method(source, signature): #define tr(id) id constexpr const char* STR_TEXT_SETTINGS = "Text Settings"; constexpr const char* STR_PREVIEW = """ + english.split("STR_PREVIEW: ", 1)[1].splitlines()[0] + r"""; -constexpr int UI_10_FONT_ID = 0, TOUCH_TAB_BAR_HEIGHT = 50, ACTION_TAB = 1, ACTION_ROW = 2; +constexpr int UI_10_FONT_ID = 0, SMALL_FONT_ID = 0, TOUCH_TAB_BAR_HEIGHT = 50, ACTION_TAB = 1, ACTION_ROW = 2; namespace textsettings { struct PreviewLayout {}; """ + preview_caption + r""" @@ -133,6 +134,10 @@ def method(source, signature): textsettings::PreviewLayout previewLayout_; std::vector rowItems_; fui::ListNav nav; + // Mirrors the real TextSettingsActivity opt-out: its short fixed tab lists + // never overflow, so no readout line is reserved. + bool positionReadout = false; + int16_t readoutRight_ = 0, readoutY_ = -1; fui::ListNav& activeNav() { return nav; } int listCount() const { return rowItems_.size(); } void syncListViewport(UiScreen&, fui::ListProps&, int); From 16f4d835fa400bce565c1c8ad3f0aa95adbcf407 Mon Sep 17 00:00:00 2001 From: Raxcoms Date: Sat, 21 Nov 2026 13:10:00 -0300 Subject: [PATCH 17/20] test: stub position readout hooks in viewport harness --- test/test_list_viewport.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/test_list_viewport.py b/test/test_list_viewport.py index a6c59db967d..afe02822507 100644 --- a/test/test_list_viewport.py +++ b/test/test_list_viewport.py @@ -15,8 +15,14 @@ #include #include namespace fui = freeink::ui; +constexpr int SMALL_FONT_ID = 0; struct UiScreen { int16_t height = 80; + // The viewport test checks ListNav clamping only; the position-readout line + // reservation is exercised by the real fui Screen in + // test_text_settings_layout.py and on device. + void insetContent(fui::Insets) {} + fui::Rect contentRect() const { return fui::Rect{0, 0, 200, height}; } void syncListViewport(fui::ListNav& nav, fui::ListProps& props, int count, int offset) { nav.syncToProps({0, 0, 200, height}, 20, 0, count, props, offset); } @@ -24,6 +30,9 @@ struct UiListActivity { fui::ListNav nav; int count = 16; + bool positionReadout = true; + int16_t readoutRight_ = 0, readoutY_ = -1; + struct { int getLineHeight(int) const { return 20; } } renderer; fui::ListNav& activeNav() { return nav; } int listCount() const { return count; } void syncListViewport(UiScreen&, fui::ListProps&, int = 0); From 788318b6aa7065385c377bb360aaa7d2a1653fc8 Mon Sep 17 00:00:00 2001 From: Raxcoms Date: Sat, 21 Nov 2026 13:10:00 -0300 Subject: [PATCH 18/20] fix(network): reflow transfer and hotspot screens for landscape 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. --- .../network/CrossPointWebServerActivity.cpp | 84 ++++++++++++------- 1 file changed, 55 insertions(+), 29 deletions(-) diff --git a/src/activities/network/CrossPointWebServerActivity.cpp b/src/activities/network/CrossPointWebServerActivity.cpp index f187efb5942..7833fdcc008 100644 --- a/src/activities/network/CrossPointWebServerActivity.cpp +++ b/src/activities/network/CrossPointWebServerActivity.cpp @@ -486,66 +486,89 @@ void CrossPointWebServerActivity::renderServerRunning() const { renderWifiIndicator(metrics.topPadding + metrics.headerHeight); } + // These screens paint with raw renderer calls, so the landscape rail gutter + // that FUI screens get from the device context has to be applied by hand. + const int railLeft = UITheme::getHintRailLeftGutter(renderer); + const int railRight = UITheme::getHintRailRightGutter(renderer); + const Rect content{static_cast(railLeft + metrics.contentSidePadding), 0, + static_cast(pageWidth - railLeft - railRight - 2 * metrics.contentSidePadding), 0}; + // Landscape is too short to stack two QR codes; put them side by side when + // the band is wide enough for both plus air. + const bool sideBySide = content.width >= 2 * QR_CODE_WIDTH + metrics.verticalSpacing * 2; + int startY = metrics.topPadding + metrics.headerHeight + metrics.tabBarHeight + metrics.verticalSpacing * 2; int height10 = renderer.getLineHeight(UI_10_FONT_ID); if (isApMode) { // AP mode display - renderer.drawText(UI_10_FONT_ID, metrics.contentSidePadding, startY, tr(STR_CONNECT_WIFI_HINT), true, - EpdFontFamily::BOLD); + renderer.drawText(UI_10_FONT_ID, content.x, startY, tr(STR_CONNECT_WIFI_HINT), true, EpdFontFamily::BOLD); startY += height10 + metrics.verticalSpacing * 2; // Show QR code for Wifi // follows spec at https://github.com/zxing/zxing/wiki/Barcode-Contents#wi-fi-network-config-android-ios-11 const std::string wifiConfig = std::string("WIFI:T:nopass;S:") + connectedSSID + ";;"; - const Rect qrBoundsWifi(metrics.contentSidePadding, startY, QR_CODE_WIDTH, QR_CODE_HEIGHT); - QrUtils::drawQrCode(renderer, qrBoundsWifi, wifiConfig); + std::string hostnameUrl = std::string("http://") + AP_HOSTNAME + ".local/"; + std::string ipUrl = tr(STR_OR_HTTP_PREFIX) + connectedIP + "/"; - // Show network name - renderer.drawText(UI_10_FONT_ID, metrics.contentSidePadding + QR_CODE_WIDTH + metrics.verticalSpacing, startY + 80, - connectedSSID.c_str()); + if (sideBySide) { + const int colW = content.width / 2; + const int qrWifiX = content.x + (colW - QR_CODE_WIDTH) / 2; + const int qrUrlX = content.x + colW + (colW - QR_CODE_WIDTH) / 2; + QrUtils::drawQrCode(renderer, Rect{qrWifiX, startY, QR_CODE_WIDTH, QR_CODE_HEIGHT}, wifiConfig); + QrUtils::drawQrCode(renderer, Rect{qrUrlX, startY, QR_CODE_WIDTH, QR_CODE_HEIGHT}, hostnameUrl); + const int labelY = startY + QR_CODE_HEIGHT + metrics.verticalSpacing; + const int ssidW = renderer.getTextWidth(UI_10_FONT_ID, connectedSSID.c_str()); + renderer.drawText(UI_10_FONT_ID, qrWifiX + (QR_CODE_WIDTH - ssidW) / 2, labelY, connectedSSID.c_str()); + const int hostW = renderer.getTextWidth(UI_10_FONT_ID, hostnameUrl.c_str()); + renderer.drawText(UI_10_FONT_ID, qrUrlX + (QR_CODE_WIDTH - hostW) / 2, labelY, hostnameUrl.c_str()); + const int ipW = renderer.getTextWidth(SMALL_FONT_ID, ipUrl.c_str()); + renderer.drawText(SMALL_FONT_ID, qrUrlX + (QR_CODE_WIDTH - ipW) / 2, labelY + height10 + 2, ipUrl.c_str()); + } else { + const Rect qrBoundsWifi(content.x, startY, QR_CODE_WIDTH, QR_CODE_HEIGHT); + QrUtils::drawQrCode(renderer, qrBoundsWifi, wifiConfig); - startY += QR_CODE_HEIGHT + 2 * metrics.verticalSpacing; + // Show network name + renderer.drawText(UI_10_FONT_ID, content.x + QR_CODE_WIDTH + metrics.verticalSpacing, startY + 80, + connectedSSID.c_str()); - // Show primary URL (hostname) - renderer.drawText(UI_10_FONT_ID, metrics.contentSidePadding, startY, tr(STR_OPEN_URL_HINT), true, - EpdFontFamily::BOLD); - startY += height10 + metrics.verticalSpacing * 2; + startY += QR_CODE_HEIGHT + 2 * metrics.verticalSpacing; - std::string hostnameUrl = std::string("http://") + AP_HOSTNAME + ".local/"; - std::string ipUrl = tr(STR_OR_HTTP_PREFIX) + connectedIP + "/"; + // Show primary URL (hostname) + renderer.drawText(UI_10_FONT_ID, content.x, startY, tr(STR_OPEN_URL_HINT), true, EpdFontFamily::BOLD); + startY += height10 + metrics.verticalSpacing * 2; - // Show QR code for URL - const Rect qrBoundsUrl(metrics.contentSidePadding, startY, QR_CODE_WIDTH, QR_CODE_HEIGHT); - QrUtils::drawQrCode(renderer, qrBoundsUrl, hostnameUrl); - - // Show IP address as fallback - renderer.drawText(UI_10_FONT_ID, metrics.contentSidePadding + QR_CODE_WIDTH + metrics.verticalSpacing, startY + 80, - hostnameUrl.c_str()); - renderer.drawText(SMALL_FONT_ID, metrics.contentSidePadding + QR_CODE_WIDTH + metrics.verticalSpacing, startY + 100, - ipUrl.c_str()); + // Show QR code for URL + const Rect qrBoundsUrl(content.x, startY, QR_CODE_WIDTH, QR_CODE_HEIGHT); + QrUtils::drawQrCode(renderer, qrBoundsUrl, hostnameUrl); + + // Show IP address as fallback + renderer.drawText(UI_10_FONT_ID, content.x + QR_CODE_WIDTH + metrics.verticalSpacing, startY + 80, + hostnameUrl.c_str()); + renderer.drawText(SMALL_FONT_ID, content.x + QR_CODE_WIDTH + metrics.verticalSpacing, startY + 100, + ipUrl.c_str()); + } } else { startY += metrics.verticalSpacing * 2; // STA mode display (original behavior) // std::string ipInfo = "IP Address: " + connectedIP; - renderer.drawCenteredText(UI_10_FONT_ID, startY, tr(STR_OPEN_URL_HINT), true, EpdFontFamily::BOLD); + GUI.drawCenteredText(renderer, content, UI_10_FONT_ID, startY, tr(STR_OPEN_URL_HINT), true, EpdFontFamily::BOLD); startY += height10; - renderer.drawCenteredText(UI_10_FONT_ID, startY, tr(STR_SCAN_QR_HINT), true, EpdFontFamily::BOLD); + GUI.drawCenteredText(renderer, content, UI_10_FONT_ID, startY, tr(STR_SCAN_QR_HINT), true, EpdFontFamily::BOLD); startY += height10 + metrics.verticalSpacing * 2; // Show QR code for URL std::string webInfo = "http://" + connectedIP + "/"; - const Rect qrBounds((pageWidth - QR_CODE_WIDTH) / 2, startY, QR_CODE_WIDTH, QR_CODE_HEIGHT); + const Rect qrBounds(content.x + (content.width - QR_CODE_WIDTH) / 2, startY, QR_CODE_WIDTH, QR_CODE_HEIGHT); QrUtils::drawQrCode(renderer, qrBounds, webInfo); startY += QR_CODE_HEIGHT + metrics.verticalSpacing * 2; // Show web server URL prominently - renderer.drawCenteredText(UI_10_FONT_ID, startY, webInfo.c_str(), true); + GUI.drawCenteredText(renderer, content, UI_10_FONT_ID, startY, webInfo.c_str(), true); startY += height10 + 5; // Also show hostname URL std::string hostnameUrl = std::string(tr(STR_OR_HTTP_PREFIX)) + AP_HOSTNAME + ".local/"; - renderer.drawCenteredText(SMALL_FONT_ID, startY, hostnameUrl.c_str(), true); + GUI.drawCenteredText(renderer, content, SMALL_FONT_ID, startY, hostnameUrl.c_str(), true); } const auto labels = mappedInput.mapLabels(tr(STR_EXIT), "", "", ""); @@ -559,7 +582,10 @@ void CrossPointWebServerActivity::renderWifiIndicator(int subHeaderTop) const { constexpr int ICON_HEIGHT = 14; const auto& metrics = UITheme::getInstance().getMetrics(); const int iconWidth = BAR_COUNT * BAR_WIDTH + (BAR_COUNT - 1) * BAR_GAP; - const int iconRight = renderer.getScreenWidth() - metrics.contentSidePadding; + // Landscape: keep clear of the hint rail boxes, which run along the right + // edge and reach this high. + const int iconRight = + renderer.getScreenWidth() - UITheme::getHintRailRightGutter(renderer) - metrics.contentSidePadding; const int iconLeft = iconRight - iconWidth; const int iconBottom = subHeaderTop + metrics.tabBarHeight - metrics.verticalSpacing; From 7c8fa15643fed5632885aa9344e23dd3dce61f17 Mon Sep 17 00:00:00 2001 From: Raxcoms Date: Sat, 21 Nov 2026 13:17:01 -0300 Subject: [PATCH 19/20] fix(network): call band-centered text through UITheme static GUI is the theme object; UITheme::drawCenteredText is a singleton static, so GUI.drawCenteredText does not compile. --- src/activities/network/CrossPointWebServerActivity.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/activities/network/CrossPointWebServerActivity.cpp b/src/activities/network/CrossPointWebServerActivity.cpp index 7833fdcc008..5cb65359e08 100644 --- a/src/activities/network/CrossPointWebServerActivity.cpp +++ b/src/activities/network/CrossPointWebServerActivity.cpp @@ -551,9 +551,11 @@ void CrossPointWebServerActivity::renderServerRunning() const { // STA mode display (original behavior) // std::string ipInfo = "IP Address: " + connectedIP; - GUI.drawCenteredText(renderer, content, UI_10_FONT_ID, startY, tr(STR_OPEN_URL_HINT), true, EpdFontFamily::BOLD); + UITheme::drawCenteredText(renderer, content, UI_10_FONT_ID, startY, tr(STR_OPEN_URL_HINT), true, + EpdFontFamily::BOLD); startY += height10; - GUI.drawCenteredText(renderer, content, UI_10_FONT_ID, startY, tr(STR_SCAN_QR_HINT), true, EpdFontFamily::BOLD); + UITheme::drawCenteredText(renderer, content, UI_10_FONT_ID, startY, tr(STR_SCAN_QR_HINT), true, + EpdFontFamily::BOLD); startY += height10 + metrics.verticalSpacing * 2; // Show QR code for URL @@ -563,12 +565,12 @@ void CrossPointWebServerActivity::renderServerRunning() const { startY += QR_CODE_HEIGHT + metrics.verticalSpacing * 2; // Show web server URL prominently - GUI.drawCenteredText(renderer, content, UI_10_FONT_ID, startY, webInfo.c_str(), true); + UITheme::drawCenteredText(renderer, content, UI_10_FONT_ID, startY, webInfo.c_str(), true); startY += height10 + 5; // Also show hostname URL std::string hostnameUrl = std::string(tr(STR_OR_HTTP_PREFIX)) + AP_HOSTNAME + ".local/"; - GUI.drawCenteredText(renderer, content, SMALL_FONT_ID, startY, hostnameUrl.c_str(), true); + UITheme::drawCenteredText(renderer, content, SMALL_FONT_ID, startY, hostnameUrl.c_str(), true); } const auto labels = mappedInput.mapLabels(tr(STR_EXIT), "", "", ""); From 7a0cef99d0904c66b84985ce54a82d72ccc5ca4d Mon Sep 17 00:00:00 2001 From: Raxcoms Date: Sat, 21 Nov 2026 13:26:21 -0300 Subject: [PATCH 20/20] feat(ui): split landscape home into cover and menu columns 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. --- src/activities/home/HomeActivity.cpp | 75 ++++++++++++++++++---------- src/activities/home/HomeActivity.h | 10 ++++ 2 files changed, 59 insertions(+), 26 deletions(-) diff --git a/src/activities/home/HomeActivity.cpp b/src/activities/home/HomeActivity.cpp index 775bbc578b9..9db4febc259 100644 --- a/src/activities/home/HomeActivity.cpp +++ b/src/activities/home/HomeActivity.cpp @@ -247,18 +247,16 @@ void HomeActivity::loop() { return; } - // Match the rendered cover grid, which lays tiles inside getContentArea() - // (origin content.x + contentSidePadding, span content.width). Using - // screen-relative getScreenWidth()/contentSidePadding here offset the touch - // targets from the drawn covers by content.x on bezel-inset panels (EEGO A4). - const Rect content = UITheme::getInstance().getContentArea(renderer); + // Route touches through the same rects render() draws through, so the hit + // bands stay on the visuals (see homeContentLayout). + const auto layout = homeContentLayout(); const int coverColumnCount = std::max(1, metrics.homeRecentBooksCount); const int recentCount = std::min(static_cast(recentBooks.size()), coverColumnCount); - const int coverColumnWidth = (content.width - 2 * metrics.contentSidePadding) / coverColumnCount; + const int coverColumnWidth = (layout.cover.width - 2 * metrics.contentSidePadding) / coverColumnCount; int touchedBook = -1; - const auto coverTouch = mappedInput.colTouch(touchedBook, content.x + metrics.contentSidePadding, coverColumnWidth, - recentCount, metrics.homeTopPadding, - metrics.homeTopPadding + metrics.homeCoverTileHeight, coverColumnWidth); + const auto coverTouch = + mappedInput.colTouch(touchedBook, layout.cover.x + metrics.contentSidePadding, coverColumnWidth, recentCount, + layout.cover.y, static_cast(layout.cover.y + layout.cover.height), coverColumnWidth); if (coverTouch != MappedInputManager::RowTouch::None) { if (coverTouch == MappedInputManager::RowTouch::Down) { if (selectorIndex != touchedBook) { @@ -273,7 +271,7 @@ void HomeActivity::loop() { return; } - const int menuTop = metrics.homeTopPadding + metrics.homeCoverTileHeight + metrics.homeMenuTopOffset; + const int menuTop = layout.menu.y; const int renderedMenuCount = menuCount - (metrics.homeContinueReadingInMenu ? 0 : static_cast(recentBooks.size())); int menuRow = -1; @@ -303,14 +301,44 @@ void HomeActivity::loop() { } } -void HomeActivity::render(RenderLock&&) { +HomeActivity::HomeContentLayout HomeActivity::homeContentLayout() const { const auto& metrics = UITheme::getInstance().getMetrics(); - const auto pageWidth = renderer.getScreenWidth(); - const auto pageHeight = renderer.getScreenHeight(); - // Content columns clear the bezel insets on rounded panels. The header + const int pageHeight = renderer.getScreenHeight(); + // Content columns clear the bezel insets on rounded panels; the header // self-insets in drawHeader, so only the cover/menu need it here. const Rect content = UITheme::getInstance().getContentArea(renderer); + const auto orientation = renderer.getOrientation(); + const bool landscape = orientation == GfxRenderer::Orientation::LandscapeClockwise || + orientation == GfxRenderer::Orientation::LandscapeCounterClockwise; + if (!landscape) { + // The menu height comes from the original portrait layout; the cover tile + // takes everything above it. + return { + Rect{content.x, metrics.homeTopPadding, content.width, metrics.homeCoverTileHeight}, + Rect{content.x, metrics.homeTopPadding + metrics.homeCoverTileHeight + metrics.homeMenuTopOffset, content.width, + pageHeight - (metrics.headerHeight + metrics.homeTopPadding + metrics.verticalSpacing + + metrics.homeMenuTopOffset + metrics.buttonHintsHeight)}}; + } + + // Landscape is too short to stack cover over menu: split the band (bezel + // insets plus the rail gutter) left/right. The cover card and its title + // text, and the icon+label menu rows, both fit a half band (X4: ~375px). + const int railLeft = UITheme::getHintRailLeftGutter(renderer); + const int railRight = UITheme::getHintRailRightGutter(renderer); + const int bandX = content.x + railLeft; + const int bandW = content.width - railLeft - railRight; + const int colW = bandW / 2; + const int menuTop = metrics.homeTopPadding + metrics.homeMenuTopOffset; + return {Rect{bandX, metrics.homeTopPadding, colW, metrics.homeCoverTileHeight}, + Rect{bandX + colW, menuTop, bandW - colW, pageHeight - menuTop}}; +} + +void HomeActivity::render(RenderLock&&) { + const auto& metrics = UITheme::getInstance().getMetrics(); + const auto pageWidth = renderer.getScreenWidth(); + const auto layout = homeContentLayout(); + renderer.clearScreen(); // A cover snapshot from the other output polarity holds the other byte form (night mode keeps images pre-inverted so // they stay positive): pasting it back after a theme switch showed the cover as a negative. Redraw it instead. @@ -331,14 +359,13 @@ void HomeActivity::render(RenderLock&&) { // Record the tile rect so storeCoverBuffer (called from the theme) knows // which sub-region of the framebuffer to snapshot. ~16 KB in Portrait // instead of the 48 KB full framebuffer the previous bind captured. - coverRectX = content.x; - coverRectY = metrics.homeTopPadding; - coverRectW = content.width; - coverRectH = metrics.homeCoverTileHeight; + coverRectX = layout.cover.x; + coverRectY = layout.cover.y; + coverRectW = layout.cover.width; + coverRectH = layout.cover.height; - GUI.drawRecentBookCover(renderer, Rect{content.x, metrics.homeTopPadding, content.width, metrics.homeCoverTileHeight}, - recentBooks, selectorIndex, coverRendered, coverBufferStored, bufferRestored, - std::bind(&HomeActivity::storeCoverBuffer, this)); + GUI.drawRecentBookCover(renderer, layout.cover, recentBooks, selectorIndex, coverRendered, coverBufferStored, + bufferRestored, std::bind(&HomeActivity::storeCoverBuffer, this)); // Build menu items dynamically std::vector menuItems = {tr(STR_BROWSE_FILES), tr(STR_LIBRARY), tr(STR_FILE_TRANSFER), @@ -357,11 +384,7 @@ void HomeActivity::render(RenderLock&&) { } GUI.drawButtonMenu( - renderer, - Rect{content.x, metrics.homeTopPadding + metrics.homeCoverTileHeight + metrics.homeMenuTopOffset, content.width, - pageHeight - (metrics.headerHeight + metrics.homeTopPadding + metrics.verticalSpacing + - metrics.homeMenuTopOffset + metrics.buttonHintsHeight)}, - static_cast(menuItems.size()), + renderer, layout.menu, static_cast(menuItems.size()), metrics.homeContinueReadingInMenu ? selectorIndex : selectorIndex - recentBooks.size(), [&menuItems](int index) { return std::string(menuItems[index]); }, [&menuIcons](int index) { return menuIcons[index]; }); diff --git a/src/activities/home/HomeActivity.h b/src/activities/home/HomeActivity.h index 11bd224d1e0..0d682659799 100644 --- a/src/activities/home/HomeActivity.h +++ b/src/activities/home/HomeActivity.h @@ -69,6 +69,16 @@ class HomeActivity final : public Activity { if (idx == i) return HomeMenuItem::SETTINGS_MENU; return HomeMenuItem::NONE; } + // Rects for the cover and the menu, shared by render and input routing so + // the touch bands always match what is drawn: portrait stacks the menu + // below the cover, landscape splits them left/right inside the rail-safe + // band. + struct HomeContentLayout { + Rect cover; + Rect menu; + }; + HomeContentLayout homeContentLayout() const; + void onRecentBookSelected(const std::string& path); void onFileBrowserOpen(); void onLibraryOpen();