Review comments
This commit is contained in:
@@ -177,7 +177,7 @@ Only one of (2), (3a), or (3b) writes the cache file `<book-cache>/pagelist.bin`
|
||||
|
||||
Written once per book at index time; consumed once per section build. Format:
|
||||
|
||||
```
|
||||
```text
|
||||
[uint16_t entryCount]
|
||||
[String href][String anchor][String label] // repeated entryCount times
|
||||
```
|
||||
|
||||
@@ -264,7 +264,7 @@ if (parsedSize != fileSize) {
|
||||
|
||||
Per-book cache file produced at index time from one of the EPUB printed-page sources (NCX `<pageList>`, EPUB 3 nav `<nav epub:type="page-list">`, or EPUB 2.01 `page-map.xml`). Consumed once per section build by `Section::createSectionFile`. Absent for books that have no printed-page data.
|
||||
|
||||
```
|
||||
```text
|
||||
u16 entryCount
|
||||
struct PageListEntry {
|
||||
String href; // normalised spine href, e.g. "OEBPS/c9_split_000.xhtml"
|
||||
|
||||
+2
-1
@@ -25,10 +25,11 @@ namespace {
|
||||
// <nav epub:type="page-list"> share the same writer.
|
||||
template <typename Entry>
|
||||
void writePageListBin(const std::string& cachePath, const std::vector<Entry>& pageList) {
|
||||
const auto pageListPath = cachePath + "/pagelist.bin";
|
||||
if (pageList.empty()) {
|
||||
Storage.remove(pageListPath.c_str());
|
||||
return;
|
||||
}
|
||||
const auto pageListPath = cachePath + "/pagelist.bin";
|
||||
FsFile pageListFile;
|
||||
if (!Storage.openFileForWrite("EBP", pageListPath, pageListFile)) {
|
||||
LOG_ERR("EBP", "Could not write pagelist.bin");
|
||||
|
||||
@@ -507,6 +507,7 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
|
||||
self->recordPageBreakLabel(label);
|
||||
if (!idAttr.empty()) {
|
||||
self->anchorData.emplace_back(idAttr, static_cast<uint16_t>(self->completedPageCount));
|
||||
self->pendingAnchorId = idAttr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,13 @@ void XMLCALL PageMapParser::startElement(void* userData, const XML_Char* name, c
|
||||
|
||||
// We only care about <page name="..." href="..."/> elements. The wrapping <page-map>
|
||||
// root is ignored (no need for a state machine — every page element carries its data).
|
||||
if (strcmp(name, "page") != 0) {
|
||||
const char* localName = strrchr(name, ':');
|
||||
if (localName) {
|
||||
localName++;
|
||||
} else {
|
||||
localName = name;
|
||||
}
|
||||
if (strcmp(localName, "page") != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
Submodule open-x4-sdk updated: 5f4a46ea3a...4d4c66787f
@@ -737,7 +737,10 @@ void EpubReaderActivity::onReaderMenuConfirm(EpubReaderMenuActivity::MenuAction
|
||||
// Resolve the typed label back to a (href, anchor) by linear scan. Entries are
|
||||
// small (typically <500 even for long books) and this fires once per user action.
|
||||
for (const auto& entry : entries) {
|
||||
if (entry.label == pick.label) {
|
||||
const auto entryLabelValue = parsePrintedPageLabel(entry.label);
|
||||
const auto pickLabelValue = parsePrintedPageLabel(pick.label);
|
||||
if (entry.label == pick.label ||
|
||||
(entryLabelValue && pickLabelValue && *entryLabelValue == *pickLabelValue)) {
|
||||
const int spineIdx = epub->resolveHrefToSpineIndex(entry.href);
|
||||
if (spineIdx < 0) {
|
||||
LOG_DBG("ERS", "printed-page jump: could not resolve spine for href=%s", entry.href.c_str());
|
||||
|
||||
@@ -794,7 +794,7 @@ void BaseTheme::drawStatusBar(GfxRenderer& renderer, const float bookProgress, c
|
||||
const bool hasProgressText = SETTINGS.statusBarBookProgressPercentage || SETTINGS.statusBarChapterPageCount;
|
||||
const bool hasStatusItems = hasProgressText || SETTINGS.statusBarBattery || !title.empty() ||
|
||||
SETTINGS.statusBarTitle != CrossPointSettings::STATUS_BAR_TITLE::HIDE_TITLE ||
|
||||
(SETTINGS.useClock && SETTINGS.statusBarClock);
|
||||
(SETTINGS.useClock && SETTINGS.statusBarClock) || !printedPageLabel.empty();
|
||||
if (!hasStatusItems) {
|
||||
return;
|
||||
}
|
||||
@@ -812,6 +812,9 @@ void BaseTheme::drawStatusBar(GfxRenderer& renderer, const float bookProgress, c
|
||||
: screenHeight - orientedMarginBottom - paddingBottom - adjacentProgressHeight -
|
||||
statusItemsHeight + 4;
|
||||
int progressTextWidth = 0;
|
||||
const int printedLabelWidth =
|
||||
printedPageLabel.empty() ? 0 : renderer.getTextWidth(SMALL_FONT_ID, printedPageLabel.c_str());
|
||||
const int printedLabelGap = printedLabelWidth > 0 && hasProgressText ? 8 : 0;
|
||||
|
||||
if (hasProgressText) {
|
||||
// Right-aligned device page counter / progress percentage. The printed-page label, if any,
|
||||
@@ -828,16 +831,17 @@ void BaseTheme::drawStatusBar(GfxRenderer& renderer, const float bookProgress, c
|
||||
}
|
||||
|
||||
const int progressStrWidth = renderer.getTextWidth(SMALL_FONT_ID, progressStr);
|
||||
const int printedLabelWidth =
|
||||
printedPageLabel.empty() ? 0 : renderer.getTextWidth(SMALL_FONT_ID, printedPageLabel.c_str());
|
||||
const int printedLabelGap = printedLabelWidth > 0 ? 8 : 0;
|
||||
progressTextWidth = progressStrWidth + printedLabelGap + printedLabelWidth;
|
||||
|
||||
const int textX = screenWidth - metrics.statusBarHorizontalMargin - orientedMarginRight - progressStrWidth;
|
||||
renderer.drawText(SMALL_FONT_ID, textX, textY, progressStr);
|
||||
if (!printedPageLabel.empty()) {
|
||||
if (printedLabelWidth > 0) {
|
||||
renderer.drawText(SMALL_FONT_ID, textX - printedLabelGap - printedLabelWidth, textY, printedPageLabel.c_str());
|
||||
}
|
||||
} else if (printedLabelWidth > 0) {
|
||||
progressTextWidth = printedLabelWidth;
|
||||
const int textX = screenWidth - metrics.statusBarHorizontalMargin - orientedMarginRight - printedLabelWidth;
|
||||
renderer.drawText(SMALL_FONT_ID, textX, textY, printedPageLabel.c_str());
|
||||
}
|
||||
|
||||
// Draw Battery
|
||||
|
||||
Reference in New Issue
Block a user