Files
Crosspoint/src/activities/reader/ReaderActivity.h
T
Justin Mitchell 3421171670 Add character-offset bookmarks for FreeInkBook
Implements layout-independent bookmarks using character offsets within chapters instead of percentage-based positions. This allows bookmarks to restore to the exact position regardless of font size or orientation changes. Adds TOC navigation helpers, book progress calculation based on spine item sizes, and a NONE BidiBaseDir option for pre-reordered text. Legacy bookmarks without character offsets fall back to percentage-based positioning.
2026-07-08 00:56:53 -04:00

31 lines
1.1 KiB
C++

#pragma once
#include <memory>
#include "activities/Activity.h"
#include "activities/home/FileBrowserActivity.h"
class Xtc;
class ReaderActivity final : public Activity {
std::string initialBookPath;
std::string currentBookPath; // Track current book path for navigation
static std::unique_ptr<Xtc> loadXtc(const std::string& path);
static bool isXtcFile(const std::string& path);
static bool isTxtFile(const std::string& path);
static bool isBmpFile(const std::string& path);
void goToLibrary(const std::string& fromBookPath = "");
void onGoToEpubReader(const std::string& path);
void onGoToXtcReader(std::unique_ptr<Xtc> xtc);
void onGoToTxtReader(const std::string& path);
void onGoToBmpViewer(const std::string& path);
void onGoBack();
public:
explicit ReaderActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, std::string initialBookPath)
: Activity("Reader", renderer, mappedInput), initialBookPath(std::move(initialBookPath)) {}
void onEnter() override;
bool isReaderActivity() const override { return true; }
};