Files
crosspoint-reader-mod/chat-summaries/2026-02-13_per-book-letterbox-fill.md
cottongin dfbc931c14 mod: Phase 1 - bring forward mod-exclusive files with ActivityManager migration
Brings ~55 mod-exclusive files to the upstream-based mod/master-resync branch:

Activities (migrated to new ActivityManager pattern):
- Clock/Time: SetTimeActivity, SetTimezoneOffsetActivity, NtpSyncActivity
- Dictionary: DictionaryDefinitionActivity, DictionarySuggestionsActivity,
  DictionaryWordSelectActivity, LookedUpWordsActivity
- Bookmark: EpubReaderBookmarkSelectionActivity
- Book management: BookManageMenuActivity, EndOfBookMenuActivity
- OPDS: OpdsServerListActivity, OpdsSettingsActivity
- Utility: DirectoryPickerActivity, NumericStepperActivity

Utilities (unchanged):
- BookManager, BookSettings, BookmarkStore, BootNtpSync
- Dictionary, LookupHistory, TimeSync, OpdsServerStore

Libraries: PlaceholderCover, TableData, ChapterXPathIndexer
Scripts: inject_mod_version, generate_book_icon, preview_placeholder_cover
Docs: KOReader sync XPath mapping

Migration changes:
- ActivityWithSubactivity -> Activity base class
- Callback constructors -> finish()/setResult() pattern
- enterNewActivity() -> startActivityForResult()
- Activity::RenderLock&& -> RenderLock&&

These files won't compile yet - they reference mod settings and I18n
strings that will be added in subsequent phases.

Made-with: Cursor
2026-03-07 15:10:00 -05:00

2.8 KiB

Per-book Letterbox Fill Override

Date: 2026-02-13 Branch: mod/fix-edge-fills

Task

Add the ability to override the sleep cover "letterbox fill mode" on a per-book basis (EPUB only for the menu UI; all book types respected at sleep time).

Changes Made

New files

  • src/util/BookSettings.h / src/util/BookSettings.cpp — Lightweight per-book settings utility. Stores a letterboxFillOverride field (0xFF = use global default) in {cachePath}/book_settings.bin. Versioned binary format with field count for forward compatibility, matching the pattern used by BookmarkStore and CrossPointSettings.

Modified files

  • src/activities/reader/EpubReaderMenuActivity.h — Added LETTERBOX_FILL to the MenuAction enum. Added bookCachePath, pendingLetterboxFill, letterbox fill labels, and helper methods (letterboxFillToIndex, indexToLetterboxFill, saveLetterboxFill). Constructor now accepts a bookCachePath parameter and loads the current per-book settings.
  • src/activities/reader/EpubReaderMenuActivity.cpp — Handle LETTERBOX_FILL action: cycles through Default/Dithered/Solid/None on Confirm (handled locally like ROTATE_SCREEN), saves immediately. Renders the current value on the right side of the menu item.
  • src/activities/reader/EpubReaderActivity.cpp — Passes epub->getCachePath() to the menu activity constructor. Added ROTATE_SCREEN and LETTERBOX_FILL to the onReaderMenuConfirm switch as no-ops to prevent compiler warnings.
  • src/activities/boot_sleep/SleepActivity.h — Added fillModeOverride parameter to renderBitmapSleepScreen().
  • src/activities/boot_sleep/SleepActivity.cpprenderCoverSleepScreen() now loads BookSettings from the book's cache path after determining the book type. Passes the per-book override to renderBitmapSleepScreen(). renderBitmapSleepScreen() uses the override if valid, otherwise falls back to the global SETTINGS.sleepScreenLetterboxFill.

How It Works

  1. User opens the EPUB reader menu (Confirm button while reading).
  2. "Letterbox Fill" appears between "Reading Orientation" and "Table of Contents".
  3. Pressing Confirm cycles: Default → Dithered → Solid → None → Default...
  4. The selection is persisted immediately to book_settings.bin in the book's cache directory.
  5. When the device enters sleep with the cover screen, the per-book override is loaded and used instead of the global setting (if set).
  6. XTC and TXT books also have their per-book override checked at sleep time, but can only be configured for EPUB via the reader menu (XTC/TXT lack general menus).

Follow-up Items

  • Consider adding the letterbox fill override to XTC/TXT reader menus if those get general menus in the future.
  • The BookSettings struct is extensible — other per-book overrides can be added by appending fields and incrementing BOOK_SETTINGS_COUNT.