feat: use icons in PDF viewer toolbar; default Music app to user's Music folder

This commit is contained in:
2026-05-18 20:21:32 +02:00
parent dac186f251
commit 77a536bcc3
4 changed files with 42 additions and 11 deletions
+18 -2
View File
@@ -162,6 +162,7 @@ void render(uint32_t* pixels) {
px_fill(pixels, g_win_w, g_win_h, 0, 0, g_win_w, TOOLBAR_H, TOOLBAR_BG);
px_hline(pixels, g_win_w, g_win_h, 0, TOOLBAR_H - 1, g_win_w, GRID_COLOR);
Canvas tb_canvas(pixels, g_win_w, g_win_h);
int bx = 4;
auto tb_btn = [&](int w, bool active, const char* label) {
Color bg = active ? TB_BTN_ACTIVE : TB_BTN_BG;
@@ -175,14 +176,29 @@ void render(uint32_t* pixels) {
}
bx += w + 4;
};
auto tb_icon_btn = [&](const SvgIcon& icon, const char* fallback) {
px_fill_rounded(pixels, g_win_w, g_win_h, bx, TB_BTN_Y, TB_BTN_SIZE, TB_BTN_SIZE,
TB_BTN_RAD, TB_BTN_BG);
if (icon.pixels) {
tb_canvas.icon(bx + (TB_BTN_SIZE - icon.width) / 2,
TB_BTN_Y + (TB_BTN_SIZE - icon.height) / 2, icon);
} else if (g_font && fallback && fallback[0]) {
int tw = g_font->measure_text(fallback, HEADER_FONT);
g_font->draw_to_buffer(pixels, g_win_w, g_win_h,
bx + (TB_BTN_SIZE - tw) / 2,
TB_BTN_Y + (TB_BTN_SIZE - HEADER_FONT) / 2,
fallback, HEADER_TEXT, HEADER_FONT);
}
bx += TB_BTN_SIZE + 4;
};
auto tb_sep = [&]() {
px_vline(pixels, g_win_w, g_win_h, bx, 6, TOOLBAR_H - 12, TB_SEP_COLOR);
bx += 8;
};
// Open / Print
tb_btn(36, false, "Open");
tb_btn(36, false, "Print");
tb_icon_btn(g_icon_folder, "O");
tb_icon_btn(g_icon_print, "P");
tb_sep();
// Navigation