mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2025-12-19 07:37:41 +03:00
fix number of notes per page
This commit is contained in:
parent
d34122177c
commit
c591c2e033
@ -48,7 +48,7 @@ class Page {
|
|||||||
elementCapacity = 24;
|
elementCapacity = 24;
|
||||||
elements = new std::shared_ptr<PageElement>[elementCapacity];
|
elements = new std::shared_ptr<PageElement>[elementCapacity];
|
||||||
|
|
||||||
footnoteCapacity = 8;
|
footnoteCapacity = 16;
|
||||||
footnotes = new FootnoteEntry[footnoteCapacity];
|
footnotes = new FootnoteEntry[footnoteCapacity];
|
||||||
for (int i = 0; i < footnoteCapacity; i++) {
|
for (int i = 0; i < footnoteCapacity; i++) {
|
||||||
footnotes[i].number[0] = '\0';
|
footnotes[i].number[0] = '\0';
|
||||||
|
|||||||
@ -60,7 +60,7 @@ void ChapterHtmlSlimParser::startNewTextBlock(const TextBlock::BLOCK_STYLE style
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ChapterHtmlSlimParser::addFootnoteToCurrentPage(const char* number, const char* href) {
|
void ChapterHtmlSlimParser::addFootnoteToCurrentPage(const char* number, const char* href) {
|
||||||
if (currentPageFootnoteCount >= 32) return;
|
if (currentPageFootnoteCount >= 16) return;
|
||||||
|
|
||||||
Serial.printf("[%lu] [ADDFT] Adding footnote: num=%s, href=%s\n", millis(), number, href);
|
Serial.printf("[%lu] [ADDFT] Adding footnote: num=%s, href=%s\n", millis(), number, href);
|
||||||
|
|
||||||
|
|||||||
@ -77,7 +77,7 @@ class ChapterHtmlSlimParser {
|
|||||||
std::function<void(Noteref&)> noterefCallback = nullptr;
|
std::function<void(Noteref&)> noterefCallback = nullptr;
|
||||||
|
|
||||||
// Footnote tracking for current page
|
// Footnote tracking for current page
|
||||||
FootnoteEntry currentPageFootnotes[32];
|
FootnoteEntry currentPageFootnotes[16];
|
||||||
int currentPageFootnoteCount = 0;
|
int currentPageFootnoteCount = 0;
|
||||||
|
|
||||||
// Inline footnotes (aside) tracking
|
// Inline footnotes (aside) tracking
|
||||||
|
|||||||
@ -326,14 +326,13 @@ void EpubReaderActivity::renderScreen() {
|
|||||||
|
|
||||||
// Check footnote before copy
|
// Check footnote before copy
|
||||||
bool hasCorruptedFootnotes = false;
|
bool hasCorruptedFootnotes = false;
|
||||||
for (int i = 0; i < p->footnoteCount && i < 16; i++) {
|
for (int i = 0; i < p->footnoteCount && i < 8; i++) { // Changé de 16 à 8
|
||||||
FootnoteEntry* fn = p->getFootnote(i);
|
FootnoteEntry* fn = p->getFootnote(i);
|
||||||
if (fn) {
|
if (fn) {
|
||||||
// Vérifier que number et href sont null-terminés
|
|
||||||
bool numberValid = false;
|
bool numberValid = false;
|
||||||
bool hrefValid = false;
|
bool hrefValid = false;
|
||||||
|
|
||||||
// Chercher le null terminator dans number (3 bytes)
|
// Search null terminator in number (3 bytes)
|
||||||
for (int j = 0; j < 3; j++) {
|
for (int j = 0; j < 3; j++) {
|
||||||
if (fn->number[j] == '\0') {
|
if (fn->number[j] == '\0') {
|
||||||
numberValid = true;
|
numberValid = true;
|
||||||
@ -341,7 +340,7 @@ void EpubReaderActivity::renderScreen() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Chercher le null terminator dans href (64 bytes)
|
// Search null terminator in href (64 bytes)
|
||||||
for (int j = 0; j < 64; j++) {
|
for (int j = 0; j < 64; j++) {
|
||||||
if (fn->href[j] == '\0') {
|
if (fn->href[j] == '\0') {
|
||||||
hrefValid = true;
|
hrefValid = true;
|
||||||
@ -367,7 +366,7 @@ void EpubReaderActivity::renderScreen() {
|
|||||||
|
|
||||||
// Copy footnotes from page to currentPageFootnotes
|
// Copy footnotes from page to currentPageFootnotes
|
||||||
currentPageFootnotes.clear();
|
currentPageFootnotes.clear();
|
||||||
int maxFootnotes = (p->footnoteCount < 16) ? p->footnoteCount : 16;
|
int maxFootnotes = (p->footnoteCount < 8) ? p->footnoteCount : 8;
|
||||||
|
|
||||||
for (int i = 0; i < maxFootnotes; i++) {
|
for (int i = 0; i < maxFootnotes; i++) {
|
||||||
FootnoteEntry* footnote = p->getFootnote(i);
|
FootnoteEntry* footnote = p->getFootnote(i);
|
||||||
@ -375,7 +374,7 @@ void EpubReaderActivity::renderScreen() {
|
|||||||
currentPageFootnotes.addFootnote(footnote->number, footnote->href);
|
currentPageFootnotes.addFootnote(footnote->number, footnote->href);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Serial.printf("[%lu] [ERS] Loaded %d footnotes for current page\n", millis(), p->footnoteCount);
|
Serial.printf("[%lu] [ERS] Loaded %d footnotes for current page\n", millis(), maxFootnotes);
|
||||||
|
|
||||||
const auto start = millis();
|
const auto start = millis();
|
||||||
renderContents(std::move(p));
|
renderContents(std::move(p));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user