diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-07 08:16:11 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-07 08:16:11 +0200 |
commit | cc957625c6b718ce6c934665b5944880b933827f (patch) | |
tree | 6be4f1449ef1d3c4b98b28a3374731f75d091328 /src/ui/sidebarwidget.c | |
parent | 4562609999fb880f66ee0eccef409d69a64a4ce0 (diff) |
SidebarWidget: Mobile fonts
Diffstat (limited to 'src/ui/sidebarwidget.c')
-rw-r--r-- | src/ui/sidebarwidget.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index 16895a15..c2cfe998 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -499,14 +499,16 @@ void init_SidebarWidget(iSidebarWidget *d, enum iSidebarSide side) { | |||
499 | iZap(d->modeScroll); | 499 | iZap(d->modeScroll); |
500 | d->side = side; | 500 | d->side = side; |
501 | d->mode = -1; | 501 | d->mode = -1; |
502 | d->itemFonts[0] = uiContent_FontId; | ||
503 | d->itemFonts[1] = uiContentBold_FontId; | ||
502 | #if defined (iPlatformAppleMobile) | 504 | #if defined (iPlatformAppleMobile) |
503 | d->width = 73 * gap_UI; | 505 | d->width = 73 * gap_UI; |
504 | d->itemFonts[0] = defaultBig_FontId; | 506 | if (deviceType_App() == phone_AppDeviceType) { |
505 | d->itemFonts[1] = defaultBigBold_FontId; | 507 | d->itemFonts[0] = defaultBig_FontId; |
508 | d->itemFonts[1] = defaultBigBold_FontId; | ||
509 | } | ||
506 | #else | 510 | #else |
507 | d->width = 60 * gap_UI; | 511 | d->width = 60 * gap_UI; |
508 | d->itemFonts[0] = uiContent_FontId; | ||
509 | d->itemFonts[1] = uiContentBold_FontId; | ||
510 | #endif | 512 | #endif |
511 | setFlags_Widget(w, fixedWidth_WidgetFlag, iTrue); | 513 | setFlags_Widget(w, fixedWidth_WidgetFlag, iTrue); |
512 | iWidget *vdiv = makeVDiv_Widget(); | 514 | iWidget *vdiv = makeVDiv_Widget(); |
@@ -658,6 +660,18 @@ static void itemClicked_SidebarWidget_(iSidebarWidget *d, const iSidebarItem *it | |||
658 | 660 | ||
659 | static void checkModeButtonLayout_SidebarWidget_(iSidebarWidget *d) { | 661 | static void checkModeButtonLayout_SidebarWidget_(iSidebarWidget *d) { |
660 | if (!d->modeButtons[0]) return; | 662 | if (!d->modeButtons[0]) return; |
663 | if (deviceType_App() == phone_AppDeviceType) { | ||
664 | /* Change font size depending on orientation. */ | ||
665 | const int fonts[2] = { | ||
666 | isPortrait_App() ? defaultBig_FontId : uiContent_FontId, | ||
667 | isPortrait_App() ? defaultBigBold_FontId : uiContentBold_FontId | ||
668 | }; | ||
669 | if (d->itemFonts[0] != fonts[0]) { | ||
670 | d->itemFonts[0] = fonts[0]; | ||
671 | d->itemFonts[1] = fonts[1]; | ||
672 | updateMetrics_SidebarWidget_(d); | ||
673 | } | ||
674 | } | ||
661 | const iBool isTight = | 675 | const iBool isTight = |
662 | (width_Rect(bounds_Widget(as_Widget(d->modeButtons[0]))) < d->maxButtonLabelWidth); | 676 | (width_Rect(bounds_Widget(as_Widget(d->modeButtons[0]))) < d->maxButtonLabelWidth); |
663 | for (int i = 0; i < max_SidebarMode; i++) { | 677 | for (int i = 0; i < max_SidebarMode; i++) { |