Consolidate dictionary items: remove "Lookup Word History" and "Delete Dictionary Cache" from the menu. Long-press on "Lookup Word" opens history; delete-dict-cache is now a sentinel entry at the bottom of the history list. Replace "Reading Orientation" with "Toggle Portrait/Landscape" that toggles between two configurable preferred orientations (new settings: Preferred Portrait, Preferred Landscape). Long-press opens a manual 4-option orientation sub-menu. Add "Toggle Font Size" menu item that cycles through font sizes and applies on menu exit (with section re-layout). Rename "Letterbox Fill" to "Override Letterbox Fill" and "Sync Progress" to "Sync Reading Progress" in reader menu. All long-press flows use ignoreNextConfirmRelease to prevent the button release from triggering actions on the subsequent screen. Co-authored-by: Cursor <cursoragent@cursor.com>
51 lines
1.6 KiB
C++
51 lines
1.6 KiB
C++
#pragma once
|
|
#include <functional>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "../ActivityWithSubactivity.h"
|
|
#include "util/ButtonNavigator.h"
|
|
|
|
class LookedUpWordsActivity final : public ActivityWithSubactivity {
|
|
public:
|
|
explicit LookedUpWordsActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, const std::string& cachePath,
|
|
int readerFontId, uint8_t orientation, const std::function<void()>& onBack,
|
|
const std::function<void()>& onDone, bool initialSkipRelease = false)
|
|
: ActivityWithSubactivity("LookedUpWords", renderer, mappedInput),
|
|
cachePath(cachePath),
|
|
readerFontId(readerFontId),
|
|
orientation(orientation),
|
|
onBack(onBack),
|
|
onDone(onDone),
|
|
ignoreNextConfirmRelease(initialSkipRelease) {}
|
|
|
|
void onEnter() override;
|
|
void onExit() override;
|
|
void loop() override;
|
|
void render(Activity::RenderLock&&) override;
|
|
|
|
private:
|
|
std::string cachePath;
|
|
int readerFontId;
|
|
uint8_t orientation;
|
|
const std::function<void()> onBack;
|
|
const std::function<void()> onDone;
|
|
|
|
std::vector<std::string> words;
|
|
int selectedIndex = 0;
|
|
bool pendingBackFromDef = false;
|
|
bool pendingExitToReader = false;
|
|
ButtonNavigator buttonNavigator;
|
|
|
|
// Delete confirmation state
|
|
bool deleteConfirmMode = false;
|
|
bool ignoreNextConfirmRelease = false;
|
|
int pendingDeleteIndex = 0;
|
|
|
|
// Sentinel index: the "Delete Dictionary Cache" entry at the end of the list.
|
|
// -1 if not present (shouldn't happen when dictionary exists).
|
|
int deleteDictCacheIndex = -1;
|
|
|
|
int getPageItems() const;
|
|
};
|