mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-05 23:27:38 +03:00
fix: set default theme to original crosspoint ui + add small font + battery icon
This commit is contained in:
parent
29daf3f866
commit
bf353e7d83
@ -440,4 +440,73 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// --- BatteryIcon ---
|
||||||
|
class BatteryIcon : public UIElement {
|
||||||
|
Expression valueExpr;
|
||||||
|
Expression colorExpr;
|
||||||
|
|
||||||
|
public:
|
||||||
|
BatteryIcon(const std::string &id) : UIElement(id) {
|
||||||
|
valueExpr = Expression::parse("0");
|
||||||
|
colorExpr = Expression::parse("0x00"); // Black by default
|
||||||
|
}
|
||||||
|
|
||||||
|
ElementType getType() const override { return ElementType::BatteryIcon; }
|
||||||
|
|
||||||
|
void setValue(const std::string &expr) {
|
||||||
|
valueExpr = Expression::parse(expr);
|
||||||
|
markDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setColor(const std::string &expr) {
|
||||||
|
colorExpr = Expression::parse(expr);
|
||||||
|
markDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw(const GfxRenderer &renderer, const ThemeContext &context) override {
|
||||||
|
if (!isVisible(context))
|
||||||
|
return;
|
||||||
|
|
||||||
|
std::string valStr = context.evaluatestring(valueExpr);
|
||||||
|
int percentage = valStr.empty() ? 0 : std::stoi(valStr);
|
||||||
|
|
||||||
|
std::string colStr = context.evaluatestring(colorExpr);
|
||||||
|
uint8_t color = Color::parse(colStr).value;
|
||||||
|
bool black = (color == 0x00);
|
||||||
|
|
||||||
|
constexpr int batteryWidth = 15;
|
||||||
|
constexpr int batteryHeight = 12;
|
||||||
|
|
||||||
|
int x = absX;
|
||||||
|
int y = absY;
|
||||||
|
|
||||||
|
if (absW > batteryWidth)
|
||||||
|
x += (absW - batteryWidth) / 2;
|
||||||
|
if (absH > batteryHeight)
|
||||||
|
y += (absH - batteryHeight) / 2;
|
||||||
|
|
||||||
|
renderer.drawLine(x + 1, y, x + batteryWidth - 3, y, black);
|
||||||
|
renderer.drawLine(x + 1, y + batteryHeight - 1, x + batteryWidth - 3,
|
||||||
|
y + batteryHeight - 1, black);
|
||||||
|
renderer.drawLine(x, y + 1, x, y + batteryHeight - 2, black);
|
||||||
|
renderer.drawLine(x + batteryWidth - 2, y + 1, x + batteryWidth - 2,
|
||||||
|
y + batteryHeight - 2, black);
|
||||||
|
|
||||||
|
renderer.drawPixel(x + batteryWidth - 1, y + 3, black);
|
||||||
|
renderer.drawPixel(x + batteryWidth - 1, y + batteryHeight - 4, black);
|
||||||
|
renderer.drawLine(x + batteryWidth - 0, y + 4, x + batteryWidth - 0,
|
||||||
|
y + batteryHeight - 5, black);
|
||||||
|
|
||||||
|
if (percentage > 0) {
|
||||||
|
int filledWidth = percentage * (batteryWidth - 5) / 100 + 1;
|
||||||
|
if (filledWidth > batteryWidth - 5) {
|
||||||
|
filledWidth = batteryWidth - 5;
|
||||||
|
}
|
||||||
|
renderer.fillRect(x + 2, y + 2, filledWidth, batteryHeight - 4, black);
|
||||||
|
}
|
||||||
|
|
||||||
|
markClean();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace ThemeEngine
|
} // namespace ThemeEngine
|
||||||
|
|||||||
@ -1,13 +1,23 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
constexpr const char *DEFAULT_THEME_INI = R"(
|
// Default theme - matches the original CrossPoint Reader look
|
||||||
|
// This is embedded in the firmware as a fallback
|
||||||
|
|
||||||
|
namespace ThemeEngine {
|
||||||
|
|
||||||
|
// Use static function for C++14 ODR compatibility
|
||||||
|
static const char *getDefaultThemeIni() {
|
||||||
|
static const char *theme = R"INI(
|
||||||
; ============================================
|
; ============================================
|
||||||
; Default Theme for CrossPoint Reader
|
; DEFAULT THEME - Original CrossPoint Reader
|
||||||
; ============================================
|
; ============================================
|
||||||
|
; Screen: 480x800
|
||||||
|
; Layout: Centered book card + vertical menu list
|
||||||
|
|
||||||
[Global]
|
[Global]
|
||||||
FontUI12 = UI_12
|
FontUI12 = UI_12
|
||||||
FontUI10 = UI_10
|
FontUI10 = UI_10
|
||||||
|
NavBookCount = 1
|
||||||
|
|
||||||
; ============================================
|
; ============================================
|
||||||
; HOME SCREEN
|
; HOME SCREEN
|
||||||
@ -17,429 +27,252 @@ FontUI10 = UI_10
|
|||||||
Type = Container
|
Type = Container
|
||||||
X = 0
|
X = 0
|
||||||
Y = 0
|
Y = 0
|
||||||
Width = 100%
|
Width = 480
|
||||||
Height = 100%
|
Height = 800
|
||||||
Color = white
|
BgColor = white
|
||||||
|
|
||||||
; --- Status Bar ---
|
; --- Battery (top right) ---
|
||||||
[StatusBar]
|
[BatteryWrapper]
|
||||||
Parent = Home
|
Parent = Home
|
||||||
Type = Container
|
Type = Container
|
||||||
X = 0
|
|
||||||
Y = 10
|
|
||||||
Width = 100%
|
|
||||||
Height = 24
|
|
||||||
|
|
||||||
[BatteryContainer]
|
|
||||||
Parent = StatusBar
|
|
||||||
Type = Container
|
|
||||||
X = 400
|
X = 400
|
||||||
Y = 3
|
Y = 10
|
||||||
Width = 28
|
Width = 80
|
||||||
Height = 18
|
Height = 20
|
||||||
|
|
||||||
[BatteryIcon]
|
[BatteryIcon]
|
||||||
Parent = BatteryContainer
|
Parent = BatteryWrapper
|
||||||
Type = Icon
|
Type = BatteryIcon
|
||||||
Src = battery
|
|
||||||
X = 0
|
X = 0
|
||||||
Y = 0
|
Y = 5
|
||||||
Width = 28
|
Width = 15
|
||||||
Height = 18
|
Height = 20
|
||||||
|
Value = {BatteryPercent}
|
||||||
Color = black
|
Color = black
|
||||||
|
|
||||||
; Fill bar inside the battery (positioned inside the battery outline)
|
[BatteryText]
|
||||||
[BatteryFill]
|
Parent = BatteryWrapper
|
||||||
Parent = BatteryContainer
|
|
||||||
Type = ProgressBar
|
|
||||||
X = 2
|
|
||||||
Y = 4
|
|
||||||
Width = 20
|
|
||||||
Height = 10
|
|
||||||
Value = {BatteryPercent}
|
|
||||||
Max = 100
|
|
||||||
FgColor = black
|
|
||||||
BgColor = white
|
|
||||||
ShowBorder = false
|
|
||||||
|
|
||||||
[BatteryLabel]
|
|
||||||
Parent = StatusBar
|
|
||||||
Type = Label
|
Type = Label
|
||||||
Font = UI_10
|
Font = Small
|
||||||
Text = {BatteryPercent}%
|
Text = {BatteryPercent}%
|
||||||
X = 432
|
X = 22
|
||||||
Y = 3
|
Y = 0
|
||||||
Width = 48
|
Width = 50
|
||||||
Height = 18
|
Height = 20
|
||||||
|
Align = Left
|
||||||
|
Visible = {ShowBatteryPercent}
|
||||||
|
|
||||||
; --- Recent Books Section ---
|
; --- Book Card (centered) ---
|
||||||
[RecentBooksSection]
|
; Original: 240x400 at (120, 30)
|
||||||
|
[BookCard]
|
||||||
Parent = Home
|
Parent = Home
|
||||||
Type = Container
|
Type = Container
|
||||||
X = 0
|
X = 120
|
||||||
Y = 30
|
Y = 30
|
||||||
Width = 100%
|
Width = 240
|
||||||
Height = 280
|
Height = 400
|
||||||
Visible = {HasRecentBooks}
|
Border = true
|
||||||
|
BgColor = {IsBookSelected ? "black" : "white"}
|
||||||
|
Visible = {HasBook}
|
||||||
|
|
||||||
[RecentBooksList]
|
; Bookmark ribbon decoration (when no cover)
|
||||||
Parent = RecentBooksSection
|
[BookmarkRibbon]
|
||||||
Type = List
|
Parent = BookCard
|
||||||
Source = RecentBooks
|
|
||||||
ItemTemplate = RecentBookItem
|
|
||||||
X = 10
|
|
||||||
Y = 0
|
|
||||||
Width = 460
|
|
||||||
Height = 280
|
|
||||||
Direction = Horizontal
|
|
||||||
ItemWidth = 149
|
|
||||||
ItemHeight = 270
|
|
||||||
Spacing = 8
|
|
||||||
|
|
||||||
; --- Recent Book Item Template ---
|
|
||||||
; Based on mockup: 74.5px at 240px scale = 149px at 480px
|
|
||||||
[RecentBookItem]
|
|
||||||
Type = Container
|
Type = Container
|
||||||
Width = 149
|
X = 200
|
||||||
Height = 270
|
Y = 5
|
||||||
Padding = 8
|
Width = 30
|
||||||
BgColor = {Item.Selected ? "0xD9" : "white"}
|
Height = 60
|
||||||
BorderRadius = 12
|
BgColor = {IsBookSelected ? "white" : "black"}
|
||||||
|
Visible = {!HasCover}
|
||||||
|
|
||||||
[BookCoverImage]
|
[BookmarkNotch]
|
||||||
Parent = RecentBookItem
|
Parent = BookmarkRibbon
|
||||||
Type = Bitmap
|
Type = Container
|
||||||
X = 0
|
X = 10
|
||||||
Y = 0
|
Y = 45
|
||||||
Width = 133
|
Width = 10
|
||||||
Height = 190
|
Height = 15
|
||||||
Src = {Item.Image}
|
BgColor = {IsBookSelected ? "black" : "white"}
|
||||||
|
|
||||||
[BookProgressBadge]
|
; Title centered in card
|
||||||
Parent = RecentBookItem
|
[BookTitle]
|
||||||
Type = Badge
|
Parent = BookCard
|
||||||
X = 4
|
|
||||||
Y = 224
|
|
||||||
Text = {Item.Progress}%
|
|
||||||
Font = UI_10
|
|
||||||
BgColor = black
|
|
||||||
FgColor = white
|
|
||||||
PaddingH = 6
|
|
||||||
PaddingV = 3
|
|
||||||
|
|
||||||
[BookTitleLabel]
|
|
||||||
Parent = RecentBookItem
|
|
||||||
Type = Label
|
|
||||||
Font = UI_10
|
|
||||||
Text = {Item.Title}
|
|
||||||
X = 0
|
|
||||||
Y = 196
|
|
||||||
Width = 133
|
|
||||||
Height = 22
|
|
||||||
Ellipsis = true
|
|
||||||
|
|
||||||
; --- No Recent Books State ---
|
|
||||||
[EmptyBooksMessage]
|
|
||||||
Parent = Home
|
|
||||||
Type = Label
|
Type = Label
|
||||||
Font = UI_12
|
Font = UI_12
|
||||||
Text = No recent books
|
Text = {BookTitle}
|
||||||
Centered = true
|
X = 20
|
||||||
X = 0
|
Y = 150
|
||||||
Y = 100
|
Width = 200
|
||||||
Width = 480
|
Height = 60
|
||||||
Height = 30
|
Color = {IsBookSelected ? "white" : "black"}
|
||||||
Visible = {!HasRecentBooks}
|
Align = center
|
||||||
|
Ellipsis = true
|
||||||
|
|
||||||
[EmptyBooksSub]
|
[BookAuthor]
|
||||||
Parent = Home
|
Parent = BookCard
|
||||||
Type = Label
|
Type = Label
|
||||||
Font = UI_10
|
Font = UI_10
|
||||||
Text = Open a book to start reading
|
Text = {BookAuthor}
|
||||||
Centered = true
|
X = 20
|
||||||
X = 0
|
Y = 210
|
||||||
Y = 130
|
Width = 200
|
||||||
Width = 480
|
Height = 25
|
||||||
Height = 30
|
Color = {IsBookSelected ? "white" : "black"}
|
||||||
Visible = {!HasRecentBooks}
|
Align = center
|
||||||
|
Ellipsis = true
|
||||||
|
|
||||||
; --- Main Menu (2-column grid) ---
|
; "Continue Reading" at bottom of card
|
||||||
[MainMenuList]
|
[ContinueLabel]
|
||||||
|
Parent = BookCard
|
||||||
|
Type = Label
|
||||||
|
Font = UI_10
|
||||||
|
Text = Continue Reading
|
||||||
|
X = 20
|
||||||
|
Y = 365
|
||||||
|
Width = 200
|
||||||
|
Height = 25
|
||||||
|
Color = {IsBookSelected ? "white" : "black"}
|
||||||
|
Align = center
|
||||||
|
|
||||||
|
; --- No Book Message ---
|
||||||
|
[NoBookCard]
|
||||||
|
Parent = Home
|
||||||
|
Type = Container
|
||||||
|
X = 120
|
||||||
|
Y = 30
|
||||||
|
Width = 240
|
||||||
|
Height = 400
|
||||||
|
Border = true
|
||||||
|
Visible = {!HasBook}
|
||||||
|
|
||||||
|
[NoBookTitle]
|
||||||
|
Parent = NoBookCard
|
||||||
|
Type = Label
|
||||||
|
Font = UI_12
|
||||||
|
Text = No open book
|
||||||
|
X = 20
|
||||||
|
Y = 175
|
||||||
|
Width = 200
|
||||||
|
Height = 25
|
||||||
|
Align = center
|
||||||
|
|
||||||
|
[NoBookSubtitle]
|
||||||
|
Parent = NoBookCard
|
||||||
|
Type = Label
|
||||||
|
Font = UI_10
|
||||||
|
Text = Start reading below
|
||||||
|
X = 20
|
||||||
|
Y = 205
|
||||||
|
Width = 200
|
||||||
|
Height = 25
|
||||||
|
Align = center
|
||||||
|
|
||||||
|
; --- Menu List ---
|
||||||
|
; Original: margin=20, tileWidth=440, tileHeight=45, spacing=8
|
||||||
|
; menuStartY = 30 + 400 + 15 = 445
|
||||||
|
[MenuList]
|
||||||
Parent = Home
|
Parent = Home
|
||||||
Type = List
|
Type = List
|
||||||
Source = MainMenu
|
Source = MainMenu
|
||||||
ItemTemplate = MainMenuItem
|
ItemTemplate = MenuItem
|
||||||
X = 15
|
X = 20
|
||||||
Y = 330
|
Y = 445
|
||||||
Width = 450
|
Width = 440
|
||||||
Height = 350
|
Height = 280
|
||||||
Columns = 2
|
Direction = Vertical
|
||||||
ItemHeight = 70
|
ItemHeight = 45
|
||||||
Spacing = 20
|
Spacing = 8
|
||||||
|
|
||||||
; --- Menu Item Template ---
|
; --- Menu Item Template ---
|
||||||
[MainMenuItem]
|
[MenuItem]
|
||||||
Type = HStack
|
Type = Container
|
||||||
Width = 210
|
Width = 440
|
||||||
Height = 65
|
Height = 45
|
||||||
Spacing = 12
|
BgColor = {Item.Selected ? "black" : "white"}
|
||||||
CenterVertical = true
|
Border = true
|
||||||
Padding = 16
|
|
||||||
BgColor = {Item.Selected ? "0xD9" : "white"}
|
|
||||||
BorderRadius = 12
|
|
||||||
|
|
||||||
[MenuItemIcon]
|
|
||||||
Parent = MainMenuItem
|
|
||||||
Type = Icon
|
|
||||||
Src = {Item.Icon}
|
|
||||||
Width = 36
|
|
||||||
Height = 36
|
|
||||||
Color = black
|
|
||||||
|
|
||||||
[MenuItemLabel]
|
[MenuItemLabel]
|
||||||
Parent = MainMenuItem
|
Parent = MenuItem
|
||||||
Type = Label
|
Type = Label
|
||||||
Font = UI_12
|
Font = UI_10
|
||||||
Text = {Item.Title}
|
Text = {Item.Title}
|
||||||
Width = 150
|
X = 0
|
||||||
Height = 40
|
Y = 0
|
||||||
Color = black
|
Width = 440
|
||||||
|
Height = 45
|
||||||
|
Color = {Item.Selected ? "white" : "black"}
|
||||||
|
Align = center
|
||||||
|
|
||||||
; --- Bottom Navigation Bar ---
|
; --- Button Hints (bottom) ---
|
||||||
; Positioned at the very bottom of screen, buttons align with physical buttons
|
; Original: 4 buttons at [25, 130, 245, 350], width=106, height=40
|
||||||
[NavBar]
|
; Y = pageHeight - 40 = 760
|
||||||
|
|
||||||
|
[HintBtn2]
|
||||||
Parent = Home
|
Parent = Home
|
||||||
Type = Container
|
Type = Container
|
||||||
X = 0
|
X = 130
|
||||||
Y = 776
|
Y = 760
|
||||||
Width = 100%
|
Width = 106
|
||||||
Height = 24
|
|
||||||
|
|
||||||
; Left button group (OK and Back) - aligned with left physical buttons
|
|
||||||
[NavLeftGroup]
|
|
||||||
Parent = NavBar
|
|
||||||
Type = HStack
|
|
||||||
X = 120
|
|
||||||
Y = 0
|
|
||||||
Width = 168
|
|
||||||
Height = 24
|
|
||||||
Spacing = 8
|
|
||||||
|
|
||||||
[NavBtnBack]
|
|
||||||
Parent = NavLeftGroup
|
|
||||||
Type = Container
|
|
||||||
Width = 80
|
|
||||||
Height = 8
|
|
||||||
Border = true
|
|
||||||
BorderRadius = 8
|
|
||||||
|
|
||||||
[NavBtnOK]
|
|
||||||
Parent = NavLeftGroup
|
|
||||||
Type = Container
|
|
||||||
Width = 80
|
|
||||||
Height = 24
|
|
||||||
Border = true
|
|
||||||
BorderRadius = 8
|
|
||||||
|
|
||||||
[NavBtnOKIcon]
|
|
||||||
Parent = NavBtnOK
|
|
||||||
Type = Icon
|
|
||||||
Src = check
|
|
||||||
X = 30
|
|
||||||
Y = 6
|
|
||||||
Width = 20
|
|
||||||
Height = 12
|
|
||||||
|
|
||||||
; Right button group (Up and Down) - aligned with right physical buttons
|
|
||||||
[NavRightGroup]
|
|
||||||
Parent = NavBar
|
|
||||||
Type = HStack
|
|
||||||
X = 292
|
|
||||||
Y = 0
|
|
||||||
Width = 168
|
|
||||||
Height = 24
|
|
||||||
Spacing = 8
|
|
||||||
|
|
||||||
[NavBtnUp]
|
|
||||||
Parent = NavRightGroup
|
|
||||||
Type = Container
|
|
||||||
Width = 80
|
|
||||||
Height = 24
|
|
||||||
Border = true
|
|
||||||
BorderRadius = 8
|
|
||||||
|
|
||||||
[NavBtnUpIcon]
|
|
||||||
Parent = NavBtnUp
|
|
||||||
Type = Icon
|
|
||||||
Src = up
|
|
||||||
X = 30
|
|
||||||
Y = 6
|
|
||||||
Width = 20
|
|
||||||
Height = 12
|
|
||||||
|
|
||||||
[NavBtnDown]
|
|
||||||
Parent = NavRightGroup
|
|
||||||
Type = Container
|
|
||||||
Width = 80
|
|
||||||
Height = 24
|
|
||||||
Border = true
|
|
||||||
BorderRadius = 8
|
|
||||||
|
|
||||||
[NavBtnDownIcon]
|
|
||||||
Parent = NavBtnDown
|
|
||||||
Type = Icon
|
|
||||||
Src = down
|
|
||||||
X = 30
|
|
||||||
Y = 6
|
|
||||||
Width = 20
|
|
||||||
Height = 12
|
|
||||||
|
|
||||||
; ============================================
|
|
||||||
; SETTINGS SCREEN
|
|
||||||
; ============================================
|
|
||||||
|
|
||||||
[Settings]
|
|
||||||
Type = Container
|
|
||||||
X = 0
|
|
||||||
Y = 0
|
|
||||||
Width = 100%
|
|
||||||
Height = 100%
|
|
||||||
Color = white
|
|
||||||
|
|
||||||
[SettingsTitle]
|
|
||||||
Parent = Settings
|
|
||||||
Type = Label
|
|
||||||
Font = UI_12
|
|
||||||
Text = Settings
|
|
||||||
X = 15
|
|
||||||
Y = 15
|
|
||||||
Width = 200
|
|
||||||
Height = 30
|
|
||||||
|
|
||||||
[SettingsTabBar]
|
|
||||||
Parent = Settings
|
|
||||||
Type = TabBar
|
|
||||||
X = 0
|
|
||||||
Y = 50
|
|
||||||
Width = 100%
|
|
||||||
Height = 40
|
Height = 40
|
||||||
Selected = {SelectedTab}
|
BgColor = white
|
||||||
IndicatorHeight = 3
|
Border = true
|
||||||
ShowIndicator = true
|
|
||||||
|
|
||||||
[TabReading]
|
[HintBtn2Label]
|
||||||
Parent = SettingsTabBar
|
Parent = HintBtn2
|
||||||
Type = Label
|
Type = Label
|
||||||
Font = UI_10
|
Font = UI_10
|
||||||
Text = Reading
|
Text = Confirm
|
||||||
Centered = true
|
|
||||||
Height = 35
|
|
||||||
|
|
||||||
[TabControls]
|
|
||||||
Parent = SettingsTabBar
|
|
||||||
Type = Label
|
|
||||||
Font = UI_10
|
|
||||||
Text = Controls
|
|
||||||
Centered = true
|
|
||||||
Height = 35
|
|
||||||
|
|
||||||
[TabDisplay]
|
|
||||||
Parent = SettingsTabBar
|
|
||||||
Type = Label
|
|
||||||
Font = UI_10
|
|
||||||
Text = Display
|
|
||||||
Centered = true
|
|
||||||
Height = 35
|
|
||||||
|
|
||||||
[TabSystem]
|
|
||||||
Parent = SettingsTabBar
|
|
||||||
Type = Label
|
|
||||||
Font = UI_10
|
|
||||||
Text = System
|
|
||||||
Centered = true
|
|
||||||
Height = 35
|
|
||||||
|
|
||||||
[SettingsList]
|
|
||||||
Parent = Settings
|
|
||||||
Type = List
|
|
||||||
Source = SettingsItems
|
|
||||||
ItemTemplate = SettingsItem
|
|
||||||
X = 0
|
X = 0
|
||||||
Y = 95
|
Y = 0
|
||||||
Width = 450
|
Width = 106
|
||||||
Height = 650
|
Height = 40
|
||||||
ItemHeight = 50
|
Align = center
|
||||||
Spacing = 0
|
|
||||||
|
|
||||||
[SettingsScrollIndicator]
|
[HintBtn3]
|
||||||
Parent = Settings
|
Parent = Home
|
||||||
Type = ScrollIndicator
|
|
||||||
X = 460
|
|
||||||
Y = 100
|
|
||||||
Width = 15
|
|
||||||
Height = 640
|
|
||||||
Position = {ScrollPosition}
|
|
||||||
Total = {TotalItems}
|
|
||||||
VisibleCount = {VisibleItems}
|
|
||||||
TrackWidth = 4
|
|
||||||
|
|
||||||
; --- Settings Item Template ---
|
|
||||||
[SettingsItem]
|
|
||||||
Type = Container
|
Type = Container
|
||||||
Width = 450
|
X = 245
|
||||||
Height = 48
|
Y = 760
|
||||||
Border = false
|
Width = 106
|
||||||
|
Height = 40
|
||||||
|
BgColor = white
|
||||||
|
Border = true
|
||||||
|
|
||||||
[SettingsItemBg]
|
[HintBtn3Label]
|
||||||
Parent = SettingsItem
|
Parent = HintBtn3
|
||||||
Type = Rectangle
|
Type = Label
|
||||||
|
Font = UI_10
|
||||||
|
Text = Up
|
||||||
X = 0
|
X = 0
|
||||||
Y = 0
|
Y = 0
|
||||||
Width = 450
|
Width = 106
|
||||||
Height = 45
|
Height = 40
|
||||||
Fill = {Item.Selected}
|
Align = center
|
||||||
Color = black
|
|
||||||
|
|
||||||
[SettingsItemLabel]
|
[HintBtn4]
|
||||||
Parent = SettingsItem
|
Parent = Home
|
||||||
|
Type = Container
|
||||||
|
X = 350
|
||||||
|
Y = 760
|
||||||
|
Width = 106
|
||||||
|
Height = 40
|
||||||
|
BgColor = white
|
||||||
|
Border = true
|
||||||
|
|
||||||
|
[HintBtn4Label]
|
||||||
|
Parent = HintBtn4
|
||||||
Type = Label
|
Type = Label
|
||||||
Font = UI_10
|
Font = UI_10
|
||||||
Text = {Item.Title}
|
Text = Down
|
||||||
X = 15
|
X = 0
|
||||||
Y = 0
|
Y = 0
|
||||||
Width = 250
|
Width = 106
|
||||||
Height = 45
|
Height = 40
|
||||||
Color = {Item.Selected ? white : black}
|
Align = center
|
||||||
|
|
||||||
[SettingsItemValue]
|
)INI";
|
||||||
Parent = SettingsItem
|
return theme;
|
||||||
Type = Label
|
}
|
||||||
Font = UI_10
|
|
||||||
Text = {Item.Value}
|
|
||||||
X = 270
|
|
||||||
Y = 0
|
|
||||||
Width = 120
|
|
||||||
Height = 45
|
|
||||||
Align = Right
|
|
||||||
Color = {Item.Selected ? white : black}
|
|
||||||
|
|
||||||
[SettingsItemToggle]
|
} // namespace ThemeEngine
|
||||||
Parent = SettingsItem
|
|
||||||
Type = Toggle
|
|
||||||
X = 390
|
|
||||||
Y = 8
|
|
||||||
Width = 50
|
|
||||||
Height = 30
|
|
||||||
Value = {Item.ToggleValue}
|
|
||||||
Visible = {Item.HasToggle}
|
|
||||||
|
|
||||||
[SettingsItemDivider]
|
|
||||||
Parent = SettingsItem
|
|
||||||
Type = Divider
|
|
||||||
X = 15
|
|
||||||
Y = 46
|
|
||||||
Width = 420
|
|
||||||
Height = 1
|
|
||||||
Horizontal = true
|
|
||||||
Color = 0x80
|
|
||||||
)";
|
|
||||||
|
|||||||
@ -153,6 +153,7 @@ public:
|
|||||||
Toggle,
|
Toggle,
|
||||||
TabBar,
|
TabBar,
|
||||||
Icon,
|
Icon,
|
||||||
|
BatteryIcon,
|
||||||
ScrollIndicator
|
ScrollIndicator
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -63,6 +63,8 @@ UIElement *ThemeManager::createElement(const std::string &id,
|
|||||||
return new Icon(id);
|
return new Icon(id);
|
||||||
if (type == "ScrollIndicator")
|
if (type == "ScrollIndicator")
|
||||||
return new ScrollIndicator(id);
|
return new ScrollIndicator(id);
|
||||||
|
if (type == "BatteryIcon")
|
||||||
|
return new BatteryIcon(id);
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -115,6 +117,8 @@ void ThemeManager::applyProperties(
|
|||||||
static_cast<Divider *>(elem)->setColorExpr(val);
|
static_cast<Divider *>(elem)->setColorExpr(val);
|
||||||
} else if (elemType == UIElement::ElementType::Icon) {
|
} else if (elemType == UIElement::ElementType::Icon) {
|
||||||
static_cast<Icon *>(elem)->setColorExpr(val);
|
static_cast<Icon *>(elem)->setColorExpr(val);
|
||||||
|
} else if (elemType == UIElement::ElementType::BatteryIcon) {
|
||||||
|
static_cast<BatteryIcon *>(elem)->setColor(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,6 +277,8 @@ void ThemeManager::applyProperties(
|
|||||||
static_cast<ProgressBar *>(elem)->setValue(val);
|
static_cast<ProgressBar *>(elem)->setValue(val);
|
||||||
} else if (elemType == UIElement::ElementType::Toggle) {
|
} else if (elemType == UIElement::ElementType::Toggle) {
|
||||||
static_cast<Toggle *>(elem)->setValue(val);
|
static_cast<Toggle *>(elem)->setValue(val);
|
||||||
|
} else if (elemType == UIElement::ElementType::BatteryIcon) {
|
||||||
|
static_cast<BatteryIcon *>(elem)->setValue(val);
|
||||||
}
|
}
|
||||||
} else if (key == "Max") {
|
} else if (key == "Max") {
|
||||||
if (elemType == UIElement::ElementType::ProgressBar) {
|
if (elemType == UIElement::ElementType::ProgressBar) {
|
||||||
|
|||||||
@ -1,332 +0,0 @@
|
|||||||
; ============================================
|
|
||||||
; Default Theme for CrossPoint Reader
|
|
||||||
; ============================================
|
|
||||||
;
|
|
||||||
; ELEMENT TYPES:
|
|
||||||
; Container - Basic container for grouping elements
|
|
||||||
; HStack - Horizontal stack layout
|
|
||||||
; VStack - Vertical stack layout
|
|
||||||
; Grid - Grid layout with columns
|
|
||||||
; Rectangle - Rectangle (filled or outlined)
|
|
||||||
; Label - Text display
|
|
||||||
; Bitmap - Image display (BMP files)
|
|
||||||
; Icon - Built-in icons or small images
|
|
||||||
; List - Repeating items (vertical, horizontal, or grid)
|
|
||||||
; Badge - Small text overlay/tag
|
|
||||||
; Toggle - On/off switch
|
|
||||||
; TabBar - Tab selection bar
|
|
||||||
; ProgressBar - Progress indicator
|
|
||||||
; Divider - Horizontal/vertical line
|
|
||||||
; ScrollIndicator - Scroll position indicator
|
|
||||||
;
|
|
||||||
; BUILT-IN ICONS:
|
|
||||||
; heart, book, books, folder, files, settings, gear,
|
|
||||||
; transfer, send, library, device, battery, check,
|
|
||||||
; back, left, up, down
|
|
||||||
;
|
|
||||||
; EXPRESSIONS:
|
|
||||||
; {Variable} - Variable substitution
|
|
||||||
; {!Variable} - Boolean negation
|
|
||||||
; {A && B} - Boolean AND
|
|
||||||
; {A || B} - Boolean OR
|
|
||||||
; {A == B} - Equality
|
|
||||||
; {A != B} - Inequality
|
|
||||||
; {A < B}, {A > B} - Comparisons
|
|
||||||
; {Cond ? True : False} - Ternary
|
|
||||||
;
|
|
||||||
; DIMENSIONS:
|
|
||||||
; 100 - Absolute pixels
|
|
||||||
; 50% - Percentage of parent
|
|
||||||
;
|
|
||||||
; COLORS:
|
|
||||||
; 0x00, black - Black
|
|
||||||
; 0xFF, white - White
|
|
||||||
|
|
||||||
[Global]
|
|
||||||
FontUI12 = UI_12
|
|
||||||
FontUI10 = UI_10
|
|
||||||
|
|
||||||
; ============================================
|
|
||||||
; HOME SCREEN
|
|
||||||
; ============================================
|
|
||||||
|
|
||||||
[Home]
|
|
||||||
Type = Container
|
|
||||||
X = 0
|
|
||||||
Y = 0
|
|
||||||
Width = 100%
|
|
||||||
Height = 100%
|
|
||||||
Color = white
|
|
||||||
|
|
||||||
; --- Status Bar ---
|
|
||||||
[StatusBar]
|
|
||||||
Parent = Home
|
|
||||||
Type = Container
|
|
||||||
X = 0
|
|
||||||
Y = 10
|
|
||||||
Width = 100%
|
|
||||||
Height = 24
|
|
||||||
|
|
||||||
[BatteryContainer]
|
|
||||||
Parent = StatusBar
|
|
||||||
Type = Container
|
|
||||||
X = 400
|
|
||||||
Y = 3
|
|
||||||
Width = 28
|
|
||||||
Height = 18
|
|
||||||
|
|
||||||
[BatteryIcon]
|
|
||||||
Parent = BatteryContainer
|
|
||||||
Type = Icon
|
|
||||||
Src = battery
|
|
||||||
X = 0
|
|
||||||
Y = 0
|
|
||||||
Width = 28
|
|
||||||
Height = 18
|
|
||||||
Color = black
|
|
||||||
|
|
||||||
; Fill bar inside the battery (positioned inside the battery outline)
|
|
||||||
[BatteryFill]
|
|
||||||
Parent = BatteryContainer
|
|
||||||
Type = ProgressBar
|
|
||||||
X = 2
|
|
||||||
Y = 4
|
|
||||||
Width = 20
|
|
||||||
Height = 10
|
|
||||||
Value = {BatteryPercent}
|
|
||||||
Max = 100
|
|
||||||
FgColor = black
|
|
||||||
BgColor = white
|
|
||||||
ShowBorder = false
|
|
||||||
|
|
||||||
[BatteryLabel]
|
|
||||||
Parent = StatusBar
|
|
||||||
Type = Label
|
|
||||||
Font = UI_10
|
|
||||||
Text = {BatteryPercent}%
|
|
||||||
X = 432
|
|
||||||
Y = 3
|
|
||||||
Width = 48
|
|
||||||
Height = 18
|
|
||||||
|
|
||||||
; --- Recent Books Section ---
|
|
||||||
[RecentBooksSection]
|
|
||||||
Parent = Home
|
|
||||||
Type = Container
|
|
||||||
X = 0
|
|
||||||
Y = 30
|
|
||||||
Width = 100%
|
|
||||||
Height = 280
|
|
||||||
Visible = {HasRecentBooks}
|
|
||||||
|
|
||||||
[RecentBooksList]
|
|
||||||
Parent = RecentBooksSection
|
|
||||||
Type = List
|
|
||||||
Source = RecentBooks
|
|
||||||
ItemTemplate = RecentBookItem
|
|
||||||
X = 10
|
|
||||||
Y = 0
|
|
||||||
Width = 460
|
|
||||||
Height = 280
|
|
||||||
Direction = Horizontal
|
|
||||||
ItemWidth = 149
|
|
||||||
ItemHeight = 270
|
|
||||||
Spacing = 8
|
|
||||||
|
|
||||||
; --- Recent Book Item Template ---
|
|
||||||
; Based on mockup: 74.5px at 240px scale = 149px at 480px
|
|
||||||
[RecentBookItem]
|
|
||||||
Type = Container
|
|
||||||
Width = 149
|
|
||||||
Height = 270
|
|
||||||
Padding = 8
|
|
||||||
BgColor = {Item.Selected ? "0xD9" : "white"}
|
|
||||||
BorderRadius = 12
|
|
||||||
|
|
||||||
[BookCoverImage]
|
|
||||||
Parent = RecentBookItem
|
|
||||||
Type = Bitmap
|
|
||||||
X = 0
|
|
||||||
Y = 0
|
|
||||||
Width = 133
|
|
||||||
Height = 190
|
|
||||||
Src = {Item.Image}
|
|
||||||
|
|
||||||
[BookProgressBadge]
|
|
||||||
Parent = RecentBookItem
|
|
||||||
Type = Badge
|
|
||||||
X = 4
|
|
||||||
Y = 224
|
|
||||||
Text = {Item.Progress}%
|
|
||||||
Font = UI_10
|
|
||||||
BgColor = black
|
|
||||||
FgColor = white
|
|
||||||
PaddingH = 6
|
|
||||||
PaddingV = 3
|
|
||||||
|
|
||||||
[BookTitleLabel]
|
|
||||||
Parent = RecentBookItem
|
|
||||||
Type = Label
|
|
||||||
Font = UI_10
|
|
||||||
Text = {Item.Title}
|
|
||||||
X = 0
|
|
||||||
Y = 196
|
|
||||||
Width = 133
|
|
||||||
Height = 22
|
|
||||||
Ellipsis = true
|
|
||||||
|
|
||||||
; --- No Recent Books State ---
|
|
||||||
[EmptyBooksMessage]
|
|
||||||
Parent = Home
|
|
||||||
Type = Label
|
|
||||||
Font = UI_12
|
|
||||||
Text = No recent books
|
|
||||||
Centered = true
|
|
||||||
X = 0
|
|
||||||
Y = 100
|
|
||||||
Width = 480
|
|
||||||
Height = 30
|
|
||||||
Visible = {!HasRecentBooks}
|
|
||||||
|
|
||||||
[EmptyBooksSub]
|
|
||||||
Parent = Home
|
|
||||||
Type = Label
|
|
||||||
Font = UI_10
|
|
||||||
Text = Open a book to start reading
|
|
||||||
Centered = true
|
|
||||||
X = 0
|
|
||||||
Y = 130
|
|
||||||
Width = 480
|
|
||||||
Height = 30
|
|
||||||
Visible = {!HasRecentBooks}
|
|
||||||
|
|
||||||
; --- Main Menu (2-column grid) ---
|
|
||||||
[MainMenuList]
|
|
||||||
Parent = Home
|
|
||||||
Type = List
|
|
||||||
Source = MainMenu
|
|
||||||
ItemTemplate = MainMenuItem
|
|
||||||
X = 15
|
|
||||||
Y = 330
|
|
||||||
Width = 450
|
|
||||||
Height = 350
|
|
||||||
Columns = 2
|
|
||||||
ItemHeight = 70
|
|
||||||
Spacing = 20
|
|
||||||
|
|
||||||
; --- Menu Item Template ---
|
|
||||||
[MainMenuItem]
|
|
||||||
Type = HStack
|
|
||||||
Width = 210
|
|
||||||
Height = 65
|
|
||||||
Spacing = 12
|
|
||||||
CenterVertical = true
|
|
||||||
Padding = 16
|
|
||||||
BgColor = {Item.Selected ? "0xD9" : "white"}
|
|
||||||
BorderRadius = 12
|
|
||||||
|
|
||||||
[MenuItemIcon]
|
|
||||||
Parent = MainMenuItem
|
|
||||||
Type = Icon
|
|
||||||
Src = {Item.Icon}
|
|
||||||
Width = 36
|
|
||||||
Height = 36
|
|
||||||
Color = black
|
|
||||||
|
|
||||||
[MenuItemLabel]
|
|
||||||
Parent = MainMenuItem
|
|
||||||
Type = Label
|
|
||||||
Font = UI_12
|
|
||||||
Text = {Item.Title}
|
|
||||||
Width = 150
|
|
||||||
Height = 40
|
|
||||||
Color = black
|
|
||||||
|
|
||||||
; --- Bottom Navigation Bar ---
|
|
||||||
; Positioned at the very bottom of screen, buttons align with physical buttons
|
|
||||||
[NavBar]
|
|
||||||
Parent = Home
|
|
||||||
Type = Container
|
|
||||||
X = 0
|
|
||||||
Y = 776
|
|
||||||
Width = 100%
|
|
||||||
Height = 24
|
|
||||||
|
|
||||||
; Left button group (OK and Back) - aligned with left physical buttons
|
|
||||||
[NavLeftGroup]
|
|
||||||
Parent = NavBar
|
|
||||||
Type = HStack
|
|
||||||
X = 120
|
|
||||||
Y = 0
|
|
||||||
Width = 168
|
|
||||||
Height = 24
|
|
||||||
Spacing = 8
|
|
||||||
|
|
||||||
[NavBtnBack]
|
|
||||||
Parent = NavLeftGroup
|
|
||||||
Type = Container
|
|
||||||
Width = 80
|
|
||||||
Height = 8
|
|
||||||
Border = true
|
|
||||||
BorderRadius = 8
|
|
||||||
|
|
||||||
[NavBtnOK]
|
|
||||||
Parent = NavLeftGroup
|
|
||||||
Type = Container
|
|
||||||
Width = 80
|
|
||||||
Height = 24
|
|
||||||
Border = true
|
|
||||||
BorderRadius = 8
|
|
||||||
|
|
||||||
[NavBtnOKIcon]
|
|
||||||
Parent = NavBtnOK
|
|
||||||
Type = Icon
|
|
||||||
Src = check
|
|
||||||
X = 30
|
|
||||||
Y = 6
|
|
||||||
Width = 20
|
|
||||||
Height = 12
|
|
||||||
|
|
||||||
; Right button group (Up and Down) - aligned with right physical buttons
|
|
||||||
[NavRightGroup]
|
|
||||||
Parent = NavBar
|
|
||||||
Type = HStack
|
|
||||||
X = 292
|
|
||||||
Y = 0
|
|
||||||
Width = 168
|
|
||||||
Height = 24
|
|
||||||
Spacing = 8
|
|
||||||
|
|
||||||
[NavBtnUp]
|
|
||||||
Parent = NavRightGroup
|
|
||||||
Type = Container
|
|
||||||
Width = 80
|
|
||||||
Height = 24
|
|
||||||
Border = true
|
|
||||||
BorderRadius = 8
|
|
||||||
|
|
||||||
[NavBtnUpIcon]
|
|
||||||
Parent = NavBtnUp
|
|
||||||
Type = Icon
|
|
||||||
Src = up
|
|
||||||
X = 30
|
|
||||||
Y = 6
|
|
||||||
Width = 20
|
|
||||||
Height = 12
|
|
||||||
|
|
||||||
[NavBtnDown]
|
|
||||||
Parent = NavRightGroup
|
|
||||||
Type = Container
|
|
||||||
Width = 80
|
|
||||||
Height = 24
|
|
||||||
Border = true
|
|
||||||
BorderRadius = 8
|
|
||||||
|
|
||||||
[NavBtnDownIcon]
|
|
||||||
Parent = NavBtnDown
|
|
||||||
Type = Icon
|
|
||||||
Src = down
|
|
||||||
X = 30
|
|
||||||
Y = 6
|
|
||||||
Width = 20
|
|
||||||
Height = 12
|
|
||||||
@ -384,6 +384,7 @@ void setup() {
|
|||||||
ThemeEngine::ThemeManager::get().begin();
|
ThemeEngine::ThemeManager::get().begin();
|
||||||
ThemeEngine::ThemeManager::get().registerFont("UI_12", UI_12_FONT_ID);
|
ThemeEngine::ThemeManager::get().registerFont("UI_12", UI_12_FONT_ID);
|
||||||
ThemeEngine::ThemeManager::get().registerFont("UI_10", UI_10_FONT_ID);
|
ThemeEngine::ThemeManager::get().registerFont("UI_10", UI_10_FONT_ID);
|
||||||
|
ThemeEngine::ThemeManager::get().registerFont("Small", SMALL_FONT_ID);
|
||||||
ThemeEngine::ThemeManager::get().loadTheme(SETTINGS.themeName);
|
ThemeEngine::ThemeManager::get().loadTheme(SETTINGS.themeName);
|
||||||
|
|
||||||
exitActivity();
|
exitActivity();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user