mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2025-12-16 22:27:42 +03:00
* Move to smart pointers and split out ParsedText class * Cleanup ParsedText * Fix clearCache functions and clear section cache if page load fails * Bump Page and Section file versions * Combine removeDir implementations in Epub * Adjust screen margins
35 lines
1.1 KiB
C++
35 lines
1.1 KiB
C++
#pragma once
|
|
#include <Epub.h>
|
|
#include <Epub/Section.h>
|
|
#include <freertos/FreeRTOS.h>
|
|
#include <freertos/semphr.h>
|
|
#include <freertos/task.h>
|
|
|
|
#include "Screen.h"
|
|
|
|
class EpubReaderScreen final : public Screen {
|
|
std::shared_ptr<Epub> epub;
|
|
std::unique_ptr<Section> section = nullptr;
|
|
TaskHandle_t displayTaskHandle = nullptr;
|
|
SemaphoreHandle_t renderingMutex = nullptr;
|
|
int currentSpineIndex = 0;
|
|
int nextPageNumber = 0;
|
|
int pagesUntilFullRefresh = 0;
|
|
bool updateRequired = false;
|
|
const std::function<void()> onGoHome;
|
|
|
|
static void taskTrampoline(void* param);
|
|
[[noreturn]] void displayTaskLoop();
|
|
void renderScreen();
|
|
void renderContents(std::unique_ptr<Page> p);
|
|
void renderStatusBar() const;
|
|
|
|
public:
|
|
explicit EpubReaderScreen(GfxRenderer& renderer, InputManager& inputManager, std::unique_ptr<Epub> epub,
|
|
const std::function<void()>& onGoHome)
|
|
: Screen(renderer, inputManager), epub(std::move(epub)), onGoHome(onGoHome) {}
|
|
void onEnter() override;
|
|
void onExit() override;
|
|
void handleInput() override;
|
|
};
|