Integrate and extend pr 1372 by andreaturchet
This commit is contained in:
@@ -748,8 +748,8 @@ void BaseTheme::fillPopupProgress(const GfxRenderer& renderer, const Rect& layou
|
||||
}
|
||||
|
||||
void BaseTheme::drawStatusBar(GfxRenderer& renderer, const float bookProgress, const int currentPage,
|
||||
const int pageCount, std::string title, const int paddingBottom,
|
||||
const int textYOffset) const {
|
||||
const int pageCount, std::string title, const int paddingBottom, const int textYOffset,
|
||||
const bool isStarred) const {
|
||||
auto metrics = UITheme::getInstance().getMetrics();
|
||||
int orientedMarginTop, orientedMarginRight, orientedMarginBottom, orientedMarginLeft;
|
||||
renderer.getOrientedViewableTRBL(&orientedMarginTop, &orientedMarginRight, &orientedMarginBottom,
|
||||
@@ -826,9 +826,10 @@ void BaseTheme::drawStatusBar(GfxRenderer& renderer, const float bookProgress, c
|
||||
renderer.getScreenWidth() - (metrics.statusBarHorizontalMargin * 2) - orientedMarginLeft - orientedMarginRight;
|
||||
|
||||
const int batterySize = SETTINGS.statusBarBattery ? (showBatteryPercentage ? 50 : 20) : 0;
|
||||
const int starReserve = isStarred ? (renderer.getTextWidth(SMALL_FONT_ID, "*") + 6) : 0;
|
||||
const int clockSize = clockTextWidth > 0 ? clockTextWidth + 8 : 0;
|
||||
const int titleMarginLeft = batterySize + clockSize + 30;
|
||||
const int titleMarginRight = progressTextWidth + 30;
|
||||
const int titleMarginRight = progressTextWidth + starReserve + 30;
|
||||
|
||||
// Attempt to center title on the screen, but if title is too wide then later we will center it within the
|
||||
// available space.
|
||||
@@ -852,6 +853,21 @@ void BaseTheme::drawStatusBar(GfxRenderer& renderer, const float bookProgress, c
|
||||
(availableTitleSpace - titleWidth) / 2,
|
||||
textY, title.c_str());
|
||||
}
|
||||
|
||||
// Draw star indicator between title and progress text
|
||||
if (isStarred) {
|
||||
const int starWidth = renderer.getTextWidth(SMALL_FONT_ID, "*");
|
||||
int starX;
|
||||
if (progressTextWidth > 0) {
|
||||
// Place star just left of the progress text with a small gap
|
||||
starX = renderer.getScreenWidth() - metrics.statusBarHorizontalMargin - orientedMarginRight - progressTextWidth -
|
||||
starWidth - 6;
|
||||
} else {
|
||||
// No progress text, place star at right edge
|
||||
starX = renderer.getScreenWidth() - metrics.statusBarHorizontalMargin - orientedMarginRight - starWidth;
|
||||
}
|
||||
renderer.drawText(SMALL_FONT_ID, starX, textY + textYOffset, "*");
|
||||
}
|
||||
}
|
||||
|
||||
void BaseTheme::drawHelpText(const GfxRenderer& renderer, Rect rect, const char* label) const {
|
||||
|
||||
@@ -145,7 +145,7 @@ class BaseTheme {
|
||||
virtual void fillPopupProgress(const GfxRenderer& renderer, const Rect& layout, const int progress) const;
|
||||
virtual void drawStatusBar(GfxRenderer& renderer, const float bookProgress, const int currentPage,
|
||||
const int pageCount, std::string title, const int paddingBottom = 0,
|
||||
const int textYOffset = 0) const;
|
||||
const int textYOffset = 0, const bool isStarred = false) const;
|
||||
virtual void drawHelpText(const GfxRenderer& renderer, Rect rect, const char* label) const;
|
||||
virtual void drawTextField(const GfxRenderer& renderer, Rect rect, const int textWidth) const;
|
||||
virtual void drawKeyboardKey(const GfxRenderer& renderer, Rect rect, const char* label, const bool isSelected,
|
||||
|
||||
Reference in New Issue
Block a user