Files
crosspoint-reader-mod/chat-summaries/2026-02-12_21-30-summary.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.1 KiB

Implement Dictionary Word Lookup Feature (PR #857)

Task

Ported upstream PR #857 (dictionary word lookup feature) into the local codebase on mod/add-dictionary branch. Two adaptations were made:

  1. Vector compatibility: PR #857 was written against upstream master which used std::list for word storage. Our codebase already has PR #802 applied (list-to-vector). The TextBlock.h getters added by PR #857 were changed to return const std::vector<...>& instead of const std::list<...>&.

  2. Dictionary path tweak: Changed dictionary file lookup from SD card root (/dictionary.idx, /dictionary.dict) to a /.dictionary/ subfolder (/.dictionary/dictionary.idx, /.dictionary/dictionary.dict).

Changes Made

New files (10)

  • src/util/Dictionary.h / .cpp -- StarDict 3 format dictionary lookup (sparse index + binary search)
  • src/util/LookupHistory.h / .cpp -- Per-book lookup history stored in book cache dir
  • src/activities/reader/DictionaryDefinitionActivity.h / .cpp -- Definition display with pagination
  • src/activities/reader/DictionaryWordSelectActivity.h / .cpp -- Word selection from current page with orientation-aware navigation
  • src/activities/reader/LookedUpWordsActivity.h / .cpp -- Lookup history browser with long-press delete

Modified files (5)

  • lib/Epub/Epub/blocks/TextBlock.h -- Added getWords(), getWordXpos(), getWordStyles() accessors (returning std::vector)
  • lib/Epub/Epub/Page.h -- Added getBlock() accessor to PageLine
  • src/activities/reader/EpubReaderMenuActivity.h -- Added LOOKUP/LOOKED_UP_WORDS enum values, hasDictionary constructor param, dynamic buildMenuItems()
  • src/activities/reader/EpubReaderActivity.h -- Added includes for new activity headers
  • src/activities/reader/EpubReaderActivity.cpp -- Added includes, Dictionary::exists() check, LOOKUP and LOOKED_UP_WORDS case handling

Follow-up Items

  • Dictionary files (dictionary.idx, dictionary.dict, dictionary.ifo) must be placed in /.dictionary/ folder on the SD card root
  • Menu items "Lookup" and "Lookup History" only appear when dictionary files are detected