summaryrefslogtreecommitdiff
path: root/src/ui/sidebarwidget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-02-22 11:55:13 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-02-22 11:55:13 +0200
commit1174f2e9318a58602baccdfb3e2465645d263601 (patch)
treeef1a2388790e2ad416a1a71681954b2b595339a8 /src/ui/sidebarwidget.c
parentc95aab351dfcf1282925708b16ceb727895da66b (diff)
iOS: Font adjustments
Diffstat (limited to 'src/ui/sidebarwidget.c')
-rw-r--r--src/ui/sidebarwidget.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c
index 4857f025..5441381a 100644
--- a/src/ui/sidebarwidget.c
+++ b/src/ui/sidebarwidget.c
@@ -96,6 +96,7 @@ struct Impl_SidebarWidget {
96 iLabelWidget * modeButtons[max_SidebarMode]; 96 iLabelWidget * modeButtons[max_SidebarMode];
97 int maxButtonLabelWidth; 97 int maxButtonLabelWidth;
98 int width; 98 int width;
99 int itemFonts[2];
99 iWidget * resizer; 100 iWidget * resizer;
100 iWidget * menu; 101 iWidget * menu;
101 iSidebarItem * contextItem; /* list item accessed in the context menu */ 102 iSidebarItem * contextItem; /* list item accessed in the context menu */
@@ -408,7 +409,7 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) {
408 409
409static void updateItemHeight_SidebarWidget_(iSidebarWidget *d) { 410static void updateItemHeight_SidebarWidget_(iSidebarWidget *d) {
410 const float heights[max_SidebarMode] = { 1.333f, 2.333f, 1.333f, 3.5f, 1.2f }; 411 const float heights[max_SidebarMode] = { 1.333f, 2.333f, 1.333f, 3.5f, 1.2f };
411 setItemHeight_ListWidget(d->list, heights[d->mode] * lineHeight_Text(uiContent_FontId)); 412 setItemHeight_ListWidget(d->list, heights[d->mode] * lineHeight_Text(d->itemFonts[0]));
412} 413}
413 414
414iBool setMode_SidebarWidget(iSidebarWidget *d, enum iSidebarMode mode) { 415iBool setMode_SidebarWidget(iSidebarWidget *d, enum iSidebarMode mode) {
@@ -473,9 +474,14 @@ void init_SidebarWidget(iSidebarWidget *d, enum iSidebarSide side) {
473 iZap(d->modeScroll); 474 iZap(d->modeScroll);
474 d->side = side; 475 d->side = side;
475 d->mode = -1; 476 d->mode = -1;
476 d->width = 60 * gap_UI;
477#if defined (iPlatformAppleMobile) 477#if defined (iPlatformAppleMobile)
478 d->width = 73 * gap_UI; 478 d->width = 73 * gap_UI;
479 d->itemFonts[0] = defaultBig_FontId;
480 d->itemFonts[1] = defaultBigBold_FontId;
481#else
482 d->width = 60 * gap_UI;
483 d->itemFonts[0] = uiContent_FontId;
484 d->itemFonts[1] = uiContentBold_FontId;
479#endif 485#endif
480 setFlags_Widget(w, fixedWidth_WidgetFlag, iTrue); 486 setFlags_Widget(w, fixedWidth_WidgetFlag, iTrue);
481 iWidget *vdiv = makeVDiv_Widget(); 487 iWidget *vdiv = makeVDiv_Widget();
@@ -1219,7 +1225,7 @@ static void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect,
1219 const int itemHeight = height_Rect(itemRect); 1225 const int itemHeight = height_Rect(itemRect);
1220 const int iconColor = isHover ? (isPressing ? uiTextPressed_ColorId : uiIconHover_ColorId) 1226 const int iconColor = isHover ? (isPressing ? uiTextPressed_ColorId : uiIconHover_ColorId)
1221 : uiIcon_ColorId; 1227 : uiIcon_ColorId;
1222 const int font = d->isBold ? uiContentBold_FontId : uiContent_FontId; 1228 const int font = sidebar->itemFonts[d->isBold ? 1 : 0];
1223 int bg = uiBackground_ColorId; 1229 int bg = uiBackground_ColorId;
1224 if (isHover) { 1230 if (isHover) {
1225 bg = isPressing ? uiBackgroundPressed_ColorId 1231 bg = isPressing ? uiBackgroundPressed_ColorId
@@ -1250,7 +1256,7 @@ static void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect,
1250 else if (sidebar->mode == feeds_SidebarMode) { 1256 else if (sidebar->mode == feeds_SidebarMode) {
1251 const int fg = isHover ? (isPressing ? uiTextPressed_ColorId : uiTextFramelessHover_ColorId) 1257 const int fg = isHover ? (isPressing ? uiTextPressed_ColorId : uiTextFramelessHover_ColorId)
1252 : uiText_ColorId; 1258 : uiText_ColorId;
1253 const int iconPad = 11 * gap_UI; 1259 const int iconPad = 12 * gap_UI;
1254 if (d->listItem.isSeparator) { 1260 if (d->listItem.isSeparator) {
1255 if (d != constItem_ListWidget(list, 0)) { 1261 if (d != constItem_ListWidget(list, 0)) {
1256 drawHLine_Paint(p, 1262 drawHLine_Paint(p,
@@ -1268,7 +1274,7 @@ static void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect,
1268 } 1274 }
1269 else { 1275 else {
1270 const iBool isUnread = (d->indent != 0); 1276 const iBool isUnread = (d->indent != 0);
1271 const int titleFont = isUnread ? uiContentBold_FontId : uiContent_FontId; 1277 const int titleFont = sidebar->itemFonts[isUnread ? 1 : 0];
1272 const int h1 = lineHeight_Text(uiLabel_FontId); 1278 const int h1 = lineHeight_Text(uiLabel_FontId);
1273 const int h2 = lineHeight_Text(titleFont); 1279 const int h2 = lineHeight_Text(titleFont);
1274 iRect iconArea = { addY_I2(pos, 0), init_I2(iconPad, itemHeight) }; 1280 iRect iconArea = { addY_I2(pos, 0), init_I2(iconPad, itemHeight) };