mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-05 23:27:38 +03:00
use enum of font size
This commit is contained in:
parent
6029e24740
commit
f8969d24bb
@ -214,3 +214,18 @@ int CrossPointSettings::getReaderFontId() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CrossPointSettings::getReaderScreenMargin() const {
|
||||||
|
switch (screenMargin) {
|
||||||
|
case SMALL:
|
||||||
|
return 5;
|
||||||
|
case MEDIUM:
|
||||||
|
return 10;
|
||||||
|
case LARGE:
|
||||||
|
return 20;
|
||||||
|
case EXTRA_LARGE:
|
||||||
|
return 40;
|
||||||
|
default:
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -51,9 +51,6 @@ class CrossPointSettings {
|
|||||||
// E-ink refresh frequency (pages between full refreshes)
|
// E-ink refresh frequency (pages between full refreshes)
|
||||||
enum REFRESH_FREQUENCY { REFRESH_1 = 0, REFRESH_5 = 1, REFRESH_10 = 2, REFRESH_15 = 3, REFRESH_30 = 4 };
|
enum REFRESH_FREQUENCY { REFRESH_1 = 0, REFRESH_5 = 1, REFRESH_10 = 2, REFRESH_15 = 3, REFRESH_30 = 4 };
|
||||||
|
|
||||||
// Reader screen margin options
|
|
||||||
enum SCREEN_MARGIN { S = 5, M = 10, L = 20, XL = 30 };
|
|
||||||
|
|
||||||
|
|
||||||
// Sleep screen settings
|
// Sleep screen settings
|
||||||
uint8_t sleepScreen = DARK;
|
uint8_t sleepScreen = DARK;
|
||||||
@ -80,7 +77,7 @@ class CrossPointSettings {
|
|||||||
uint8_t refreshFrequency = REFRESH_15;
|
uint8_t refreshFrequency = REFRESH_15;
|
||||||
|
|
||||||
// Reader screen margin settings
|
// Reader screen margin settings
|
||||||
uint8_t screenMargin = M;
|
uint8_t screenMargin = SMALL;
|
||||||
|
|
||||||
~CrossPointSettings() = default;
|
~CrossPointSettings() = default;
|
||||||
|
|
||||||
@ -96,6 +93,8 @@ class CrossPointSettings {
|
|||||||
float getReaderLineCompression() const;
|
float getReaderLineCompression() const;
|
||||||
unsigned long getSleepTimeoutMs() const;
|
unsigned long getSleepTimeoutMs() const;
|
||||||
int getRefreshFrequency() const;
|
int getRefreshFrequency() const;
|
||||||
|
int getReaderScreenMargin() const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Helper macro to access settings
|
// Helper macro to access settings
|
||||||
|
|||||||
@ -16,8 +16,6 @@ namespace {
|
|||||||
// pagesPerRefresh now comes from SETTINGS.getRefreshFrequency()
|
// pagesPerRefresh now comes from SETTINGS.getRefreshFrequency()
|
||||||
constexpr unsigned long skipChapterMs = 700;
|
constexpr unsigned long skipChapterMs = 700;
|
||||||
constexpr unsigned long goHomeMs = 1000;
|
constexpr unsigned long goHomeMs = 1000;
|
||||||
constexpr int topPadding = 5;
|
|
||||||
constexpr int horizontalPadding = 5;
|
|
||||||
constexpr int statusBarMargin = 19;
|
constexpr int statusBarMargin = 19;
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
@ -253,9 +251,9 @@ void EpubReaderActivity::renderScreen() {
|
|||||||
int orientedMarginTop, orientedMarginRight, orientedMarginBottom, orientedMarginLeft;
|
int orientedMarginTop, orientedMarginRight, orientedMarginBottom, orientedMarginLeft;
|
||||||
renderer.getOrientedViewableTRBL(&orientedMarginTop, &orientedMarginRight, &orientedMarginBottom,
|
renderer.getOrientedViewableTRBL(&orientedMarginTop, &orientedMarginRight, &orientedMarginBottom,
|
||||||
&orientedMarginLeft);
|
&orientedMarginLeft);
|
||||||
orientedMarginTop += SETTINGS.screenMargin;
|
orientedMarginTop += SETTINGS.getReaderScreenMargin();
|
||||||
orientedMarginLeft += SETTINGS.screenMargin;
|
orientedMarginLeft += SETTINGS.getReaderScreenMargin();
|
||||||
orientedMarginRight += SETTINGS.screenMargin;
|
orientedMarginRight += SETTINGS.getReaderScreenMargin();
|
||||||
orientedMarginBottom += statusBarMargin;
|
orientedMarginBottom += statusBarMargin;
|
||||||
|
|
||||||
if (!section) {
|
if (!section) {
|
||||||
|
|||||||
@ -34,7 +34,7 @@ const SettingInfo settingsList[settingsCount] = {
|
|||||||
{"Bookerly", "Noto Sans", "Open Dyslexic"}},
|
{"Bookerly", "Noto Sans", "Open Dyslexic"}},
|
||||||
{"Reader Font Size", SettingType::ENUM, &CrossPointSettings::fontSize, {"Small", "Medium", "Large", "X Large"}},
|
{"Reader Font Size", SettingType::ENUM, &CrossPointSettings::fontSize, {"Small", "Medium", "Large", "X Large"}},
|
||||||
{"Reader Line Spacing", SettingType::ENUM, &CrossPointSettings::lineSpacing, {"Tight", "Normal", "Wide"}},
|
{"Reader Line Spacing", SettingType::ENUM, &CrossPointSettings::lineSpacing, {"Tight", "Normal", "Wide"}},
|
||||||
{"Reader Screen Margin", SettingType::ENUM, &CrossPointSettings::screenMargin, {"S", "M", "L", "XL"}},
|
{"Reader Screen Margin", SettingType::ENUM, &CrossPointSettings::screenMargin, {"5", "10", "20", "40"}},
|
||||||
{"Reader Paragraph Alignment",
|
{"Reader Paragraph Alignment",
|
||||||
SettingType::ENUM,
|
SettingType::ENUM,
|
||||||
&CrossPointSettings::paragraphAlignment,
|
&CrossPointSettings::paragraphAlignment,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user