mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-04 06:37:38 +03:00
clang format fix
This commit is contained in:
parent
fd53c14a31
commit
3d92bac3ec
@ -1,8 +1,9 @@
|
||||
#include "EpubReaderChapterSelectionActivity.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <GfxRenderer.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "KOReaderCredentialStore.h"
|
||||
#include "KOReaderSyncActivity.h"
|
||||
#include "MappedInputManager.h"
|
||||
@ -193,8 +194,8 @@ void EpubReaderChapterSelectionActivity::renderScreen() {
|
||||
const int totalItems = getTotalItems();
|
||||
|
||||
// Manual centering to honor content gutters.
|
||||
const int titleX = contentX +
|
||||
(contentWidth - renderer.getTextWidth(UI_12_FONT_ID, "Go to Chapter", EpdFontFamily::BOLD)) / 2;
|
||||
const int titleX =
|
||||
contentX + (contentWidth - renderer.getTextWidth(UI_12_FONT_ID, "Go to Chapter", EpdFontFamily::BOLD)) / 2;
|
||||
renderer.drawText(UI_12_FONT_ID, titleX, 15 + contentY, "Go to Chapter", true, EpdFontFamily::BOLD);
|
||||
|
||||
const auto pageStartIndex = selectorIndex / pageItems * pageItems;
|
||||
|
||||
@ -101,8 +101,8 @@ void EpubReaderMenuActivity::renderScreen() {
|
||||
const std::string truncTitle =
|
||||
renderer.truncatedText(UI_12_FONT_ID, title.c_str(), contentWidth - 40, EpdFontFamily::BOLD);
|
||||
// Manual centering so we can respect the content gutter.
|
||||
const int titleX = contentX +
|
||||
(contentWidth - renderer.getTextWidth(UI_12_FONT_ID, truncTitle.c_str(), EpdFontFamily::BOLD)) / 2;
|
||||
const int titleX =
|
||||
contentX + (contentWidth - renderer.getTextWidth(UI_12_FONT_ID, truncTitle.c_str(), EpdFontFamily::BOLD)) / 2;
|
||||
renderer.drawText(UI_12_FONT_ID, titleX, 15 + contentY, truncTitle.c_str(), true, EpdFontFamily::BOLD);
|
||||
|
||||
// Menu Items
|
||||
|
||||
@ -16,8 +16,7 @@ class EpubReaderMenuActivity final : public ActivityWithSubactivity {
|
||||
enum class MenuAction { SELECT_CHAPTER, ROTATE_SCREEN, GO_HOME, DELETE_CACHE };
|
||||
|
||||
explicit EpubReaderMenuActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, const std::string& title,
|
||||
const uint8_t currentOrientation,
|
||||
const std::function<void(uint8_t)>& onBack,
|
||||
const uint8_t currentOrientation, const std::function<void(uint8_t)>& onBack,
|
||||
const std::function<void(MenuAction)>& onAction)
|
||||
: ActivityWithSubactivity("EpubReaderMenu", renderer, mappedInput),
|
||||
title(title),
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
#include "XtcReaderChapterSelectionActivity.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <GfxRenderer.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "MappedInputManager.h"
|
||||
#include "fontIds.h"
|
||||
|
||||
@ -146,15 +147,14 @@ void XtcReaderChapterSelectionActivity::renderScreen() {
|
||||
const int contentY = hintGutterHeight;
|
||||
const int pageItems = getPageItems();
|
||||
// Manual centering to honor content gutters.
|
||||
const int titleX = contentX +
|
||||
(contentWidth - renderer.getTextWidth(UI_12_FONT_ID, "Select Chapter", EpdFontFamily::BOLD)) / 2;
|
||||
const int titleX =
|
||||
contentX + (contentWidth - renderer.getTextWidth(UI_12_FONT_ID, "Select Chapter", EpdFontFamily::BOLD)) / 2;
|
||||
renderer.drawText(UI_12_FONT_ID, titleX, 15 + contentY, "Select Chapter", true, EpdFontFamily::BOLD);
|
||||
|
||||
const auto& chapters = xtc->getChapters();
|
||||
if (chapters.empty()) {
|
||||
// Center the empty state within the gutter-safe content region.
|
||||
const int emptyX =
|
||||
contentX + (contentWidth - renderer.getTextWidth(UI_10_FONT_ID, "No chapters")) / 2;
|
||||
const int emptyX = contentX + (contentWidth - renderer.getTextWidth(UI_10_FONT_ID, "No chapters")) / 2;
|
||||
renderer.drawText(UI_10_FONT_ID, emptyX, 120 + contentY, "No chapters");
|
||||
renderer.displayBuffer();
|
||||
return;
|
||||
@ -166,8 +166,7 @@ void XtcReaderChapterSelectionActivity::renderScreen() {
|
||||
for (int i = pageStartIndex; i < static_cast<int>(chapters.size()) && i < pageStartIndex + pageItems; i++) {
|
||||
const auto& chapter = chapters[i];
|
||||
const char* title = chapter.name.empty() ? "Unnamed" : chapter.name.c_str();
|
||||
renderer.drawText(UI_10_FONT_ID, contentX + 20, 60 + contentY + (i % pageItems) * 30, title,
|
||||
i != selectorIndex);
|
||||
renderer.drawText(UI_10_FONT_ID, contentX + 20, 60 + contentY + (i % pageItems) * 30, title, i != selectorIndex);
|
||||
}
|
||||
|
||||
const auto labels = mappedInput.mapLabels("« Back", "Select", "Up", "Down");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user