mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-05 07:07:38 +03:00
clang-format-fix
This commit is contained in:
parent
4f227ec277
commit
e97bcb717e
@ -53,7 +53,6 @@ bool Page::serialize(FsFile& file) const {
|
|||||||
file.write(&isInlineFlag, 1);
|
file.write(&isInlineFlag, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#include <SdFat.h>
|
#include <SdFat.h>
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "FootnoteEntry.h"
|
#include "FootnoteEntry.h"
|
||||||
#include "blocks/TextBlock.h"
|
#include "blocks/TextBlock.h"
|
||||||
|
|||||||
@ -163,8 +163,6 @@ bool Section::loadSectionFile(const int fontId, const float lineCompression, con
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool Section::clearCache() const {
|
bool Section::clearCache() const {
|
||||||
if (!SdMan.exists(filePath.c_str())) {
|
if (!SdMan.exists(filePath.c_str())) {
|
||||||
Serial.printf("[%lu] [SCT] Cache does not exist, no action needed\n", millis());
|
Serial.printf("[%lu] [SCT] Cache does not exist, no action needed\n", millis());
|
||||||
|
|||||||
@ -273,7 +273,6 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
|
|||||||
// PASS 2: Normal parsing
|
// PASS 2: Normal parsing
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
|
|
||||||
// Middle of skip
|
// Middle of skip
|
||||||
if (self->skipUntilDepth < self->depth) {
|
if (self->skipUntilDepth < self->depth) {
|
||||||
self->depth += 1;
|
self->depth += 1;
|
||||||
@ -293,9 +292,12 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
|
|||||||
if (self->partWordBufferIndex > 0) {
|
if (self->partWordBufferIndex > 0) {
|
||||||
// Copy of the existing flush logic
|
// Copy of the existing flush logic
|
||||||
EpdFontFamily::Style fontStyle = EpdFontFamily::REGULAR;
|
EpdFontFamily::Style fontStyle = EpdFontFamily::REGULAR;
|
||||||
if (self->boldUntilDepth < self->depth && self->italicUntilDepth < self->depth) fontStyle = EpdFontFamily::BOLD_ITALIC;
|
if (self->boldUntilDepth < self->depth && self->italicUntilDepth < self->depth)
|
||||||
else if (self->boldUntilDepth < self->depth) fontStyle = EpdFontFamily::BOLD;
|
fontStyle = EpdFontFamily::BOLD_ITALIC;
|
||||||
else if (self->italicUntilDepth < self->depth) fontStyle = EpdFontFamily::ITALIC;
|
else if (self->boldUntilDepth < self->depth)
|
||||||
|
fontStyle = EpdFontFamily::BOLD;
|
||||||
|
else if (self->italicUntilDepth < self->depth)
|
||||||
|
fontStyle = EpdFontFamily::ITALIC;
|
||||||
|
|
||||||
self->partWordBuffer[self->partWordBufferIndex] = '\0';
|
self->partWordBuffer[self->partWordBufferIndex] = '\0';
|
||||||
self->currentTextBlock->addWord(std::move(replaceHtmlEntities(self->partWordBuffer)), fontStyle);
|
self->currentTextBlock->addWord(std::move(replaceHtmlEntities(self->partWordBuffer)), fontStyle);
|
||||||
@ -611,7 +613,6 @@ void XMLCALL ChapterHtmlSlimParser::characterData(void* userData, const XML_Char
|
|||||||
void XMLCALL ChapterHtmlSlimParser::endElement(void* userData, const XML_Char* name) {
|
void XMLCALL ChapterHtmlSlimParser::endElement(void* userData, const XML_Char* name) {
|
||||||
auto* self = static_cast<ChapterHtmlSlimParser*>(userData);
|
auto* self = static_cast<ChapterHtmlSlimParser*>(userData);
|
||||||
|
|
||||||
|
|
||||||
// Closing paragraph note in Pass 1
|
// Closing paragraph note in Pass 1
|
||||||
if (strcmp(name, "p") == 0 && self->insideParagraphNote && self->depth - 1 == self->paragraphNoteDepth) {
|
if (strcmp(name, "p") == 0 && self->insideParagraphNote && self->depth - 1 == self->paragraphNoteDepth) {
|
||||||
if (self->isPass1CollectingAsides && self->currentParagraphNoteTextLen > 0 && self->paragraphNoteCount < 32 &&
|
if (self->isPass1CollectingAsides && self->currentParagraphNoteTextLen > 0 && self->paragraphNoteCount < 32 &&
|
||||||
@ -691,7 +692,6 @@ void XMLCALL ChapterHtmlSlimParser::endElement(void* userData, const XML_Char* n
|
|||||||
// [MODIFIED] 2. Handle 'a' tags (Anchors/Footnotes)
|
// [MODIFIED] 2. Handle 'a' tags (Anchors/Footnotes)
|
||||||
// We check "a" generally now, to handle both Noterefs AND resetting regular links
|
// We check "a" generally now, to handle both Noterefs AND resetting regular links
|
||||||
if (strcmp(name, "a") == 0) {
|
if (strcmp(name, "a") == 0) {
|
||||||
|
|
||||||
// Track if this was a noteref so we can return early later
|
// Track if this was a noteref so we can return early later
|
||||||
bool wasNoteref = self->insideNoteref;
|
bool wasNoteref = self->insideNoteref;
|
||||||
|
|
||||||
@ -758,7 +758,6 @@ void XMLCALL ChapterHtmlSlimParser::endElement(void* userData, const XML_Char* n
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (self->partWordBufferIndex > 0) {
|
if (self->partWordBufferIndex > 0) {
|
||||||
const bool shouldBreakText =
|
const bool shouldBreakText =
|
||||||
matches(name, BLOCK_TAGS, NUM_BLOCK_TAGS) || matches(name, HEADER_TAGS, NUM_HEADER_TAGS) ||
|
matches(name, BLOCK_TAGS, NUM_BLOCK_TAGS) || matches(name, HEADER_TAGS, NUM_HEADER_TAGS) ||
|
||||||
|
|||||||
@ -8,10 +8,8 @@
|
|||||||
#include "CrossPointSettings.h"
|
#include "CrossPointSettings.h"
|
||||||
#include "CrossPointState.h"
|
#include "CrossPointState.h"
|
||||||
#include "EpubReaderChapterSelectionActivity.h"
|
#include "EpubReaderChapterSelectionActivity.h"
|
||||||
|
|
||||||
#include "EpubReaderFootnotesActivity.h"
|
#include "EpubReaderFootnotesActivity.h"
|
||||||
#include "EpubReaderMenuActivity.h"
|
#include "EpubReaderMenuActivity.h"
|
||||||
|
|
||||||
#include "MappedInputManager.h"
|
#include "MappedInputManager.h"
|
||||||
#include "RecentBooksStore.h"
|
#include "RecentBooksStore.h"
|
||||||
#include "ScreenComponents.h"
|
#include "ScreenComponents.h"
|
||||||
@ -205,7 +203,6 @@ void EpubReaderActivity::loop() {
|
|||||||
onGoBack();
|
onGoBack();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool prevReleased = mappedInput.wasReleased(MappedInputManager::Button::PageBack) ||
|
const bool prevReleased = mappedInput.wasReleased(MappedInputManager::Button::PageBack) ||
|
||||||
@ -414,7 +411,8 @@ void EpubReaderActivity::renderScreen() {
|
|||||||
return renderScreen();
|
return renderScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
Serial.printf("[%lu] [ERS] Page loaded: %d elements, %d footnotes\n", millis(), p->elements.size(), p->footnotes.size());
|
Serial.printf("[%lu] [ERS] Page loaded: %d elements, %d footnotes\n", millis(), p->elements.size(),
|
||||||
|
p->footnotes.size());
|
||||||
|
|
||||||
// Copy footnotes from page to currentPageFootnotes
|
// Copy footnotes from page to currentPageFootnotes
|
||||||
currentPageFootnotes.clear();
|
currentPageFootnotes.clear();
|
||||||
@ -499,7 +497,6 @@ void EpubReaderActivity::renderStatusBar(const int orientedMarginRight, const in
|
|||||||
const auto screenHeight = renderer.getScreenHeight();
|
const auto screenHeight = renderer.getScreenHeight();
|
||||||
const auto textY = screenHeight - orientedMarginBottom - 4;
|
const auto textY = screenHeight - orientedMarginBottom - 4;
|
||||||
|
|
||||||
|
|
||||||
if (showProgress) {
|
if (showProgress) {
|
||||||
// Calculate progress in book
|
// Calculate progress in book
|
||||||
// TODO: use progress values for UI
|
// TODO: use progress values for UI
|
||||||
|
|||||||
@ -5,8 +5,8 @@
|
|||||||
#include <freertos/semphr.h>
|
#include <freertos/semphr.h>
|
||||||
#include <freertos/task.h>
|
#include <freertos/task.h>
|
||||||
|
|
||||||
#include "activities/ActivityWithSubactivity.h"
|
|
||||||
#include "EpubReaderFootnotesActivity.h"
|
#include "EpubReaderFootnotesActivity.h"
|
||||||
|
#include "activities/ActivityWithSubactivity.h"
|
||||||
|
|
||||||
class EpubReaderActivity final : public ActivityWithSubactivity {
|
class EpubReaderActivity final : public ActivityWithSubactivity {
|
||||||
std::shared_ptr<Epub> epub;
|
std::shared_ptr<Epub> epub;
|
||||||
|
|||||||
@ -14,8 +14,6 @@ constexpr int SKIP_PAGE_MS = 700;
|
|||||||
|
|
||||||
bool EpubReaderChapterSelectionActivity::hasSyncOption() const { return KOREADER_STORE.hasCredentials(); }
|
bool EpubReaderChapterSelectionActivity::hasSyncOption() const { return KOREADER_STORE.hasCredentials(); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int EpubReaderChapterSelectionActivity::getPageItems() const {
|
int EpubReaderChapterSelectionActivity::getPageItems() const {
|
||||||
// Layout constants used in renderScreen
|
// Layout constants used in renderScreen
|
||||||
constexpr int startY = 60;
|
constexpr int startY = 60;
|
||||||
|
|||||||
@ -27,7 +27,6 @@ class EpubReaderChapterSelectionActivity final : public ActivityWithSubactivity
|
|||||||
// This adapts automatically when switching between portrait and landscape.
|
// This adapts automatically when switching between portrait and landscape.
|
||||||
int getPageItems() const;
|
int getPageItems() const;
|
||||||
|
|
||||||
|
|
||||||
// Check if sync option is available (credentials configured)
|
// Check if sync option is available (credentials configured)
|
||||||
bool hasSyncOption() const;
|
bool hasSyncOption() const;
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
#include "EpubReaderFootnotesActivity.h"
|
#include "EpubReaderFootnotesActivity.h"
|
||||||
|
|
||||||
#include <GfxRenderer.h>
|
|
||||||
#include <EpdFontFamily.h>
|
#include <EpdFontFamily.h>
|
||||||
|
#include <GfxRenderer.h>
|
||||||
|
|
||||||
#include "fontIds.h"
|
|
||||||
#include "MappedInputManager.h"
|
#include "MappedInputManager.h"
|
||||||
|
#include "fontIds.h"
|
||||||
|
|
||||||
void EpubReaderFootnotesActivity::onEnter() {
|
void EpubReaderFootnotesActivity::onEnter() {
|
||||||
selectedIndex = 0;
|
selectedIndex = 0;
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
#include "EpubReaderMenuActivity.h"
|
#include "EpubReaderMenuActivity.h"
|
||||||
|
|
||||||
#include <GfxRenderer.h>
|
|
||||||
#include <EpdFontFamily.h>
|
#include <EpdFontFamily.h>
|
||||||
|
#include <GfxRenderer.h>
|
||||||
|
|
||||||
#include "fontIds.h"
|
|
||||||
#include "MappedInputManager.h"
|
#include "MappedInputManager.h"
|
||||||
|
#include "fontIds.h"
|
||||||
|
|
||||||
constexpr int MENU_ITEMS_COUNT = 2;
|
constexpr int MENU_ITEMS_COUNT = 2;
|
||||||
|
|
||||||
@ -39,10 +39,10 @@ void EpubReaderMenuActivity::onExit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EpubReaderMenuActivity::loop() {
|
void EpubReaderMenuActivity::loop() {
|
||||||
const bool prevReleased =
|
const bool prevReleased = mappedInput.wasReleased(MappedInputManager::Button::Up) ||
|
||||||
mappedInput.wasReleased(MappedInputManager::Button::Up) || mappedInput.wasReleased(MappedInputManager::Button::Left);
|
mappedInput.wasReleased(MappedInputManager::Button::Left);
|
||||||
const bool nextReleased =
|
const bool nextReleased = mappedInput.wasReleased(MappedInputManager::Button::Down) ||
|
||||||
mappedInput.wasReleased(MappedInputManager::Button::Down) || mappedInput.wasReleased(MappedInputManager::Button::Right);
|
mappedInput.wasReleased(MappedInputManager::Button::Right);
|
||||||
|
|
||||||
if (mappedInput.wasReleased(MappedInputManager::Button::Confirm)) {
|
if (mappedInput.wasReleased(MappedInputManager::Button::Confirm)) {
|
||||||
onSelectOption(static_cast<MenuOption>(selectorIndex));
|
onSelectOption(static_cast<MenuOption>(selectorIndex));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user