summaryrefslogtreecommitdiff
path: root/src/ui/sidebarwidget.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/sidebarwidget.c')
-rw-r--r--src/ui/sidebarwidget.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c
index d3be3710..6bd51731 100644
--- a/src/ui/sidebarwidget.c
+++ b/src/ui/sidebarwidget.c
@@ -1174,8 +1174,9 @@ static void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect,
1174 } 1174 }
1175 else { 1175 else {
1176 const iBool isUnread = (d->indent != 0); 1176 const iBool isUnread = (d->indent != 0);
1177 const int titleFont = isUnread ? uiContentBold_FontId : uiContent_FontId;
1177 const int h1 = lineHeight_Text(uiLabel_FontId); 1178 const int h1 = lineHeight_Text(uiLabel_FontId);
1178 const int h2 = lineHeight_Text(uiContent_FontId); 1179 const int h2 = lineHeight_Text(titleFont);
1179 const int iconPad = 9 * gap_UI; 1180 const int iconPad = 9 * gap_UI;
1180 iRect iconArea = { addY_I2(pos, 0), init_I2(iconPad, itemHeight) }; 1181 iRect iconArea = { addY_I2(pos, 0), init_I2(iconPad, itemHeight) };
1181 if (isUnread) { 1182 if (isUnread) {
@@ -1199,7 +1200,7 @@ static void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect,
1199 deinit_String(&str); 1200 deinit_String(&str);
1200 } 1201 }
1201 /* Select the layout based on how the title fits. */ 1202 /* Select the layout based on how the title fits. */
1202 iInt2 titleSize = advanceRange_Text(uiContent_FontId, range_String(&d->label)); 1203 iInt2 titleSize = advanceRange_Text(titleFont, range_String(&d->label));
1203 const iInt2 metaSize = advanceRange_Text(uiLabel_FontId, range_String(&d->meta)); 1204 const iInt2 metaSize = advanceRange_Text(uiLabel_FontId, range_String(&d->meta));
1204 pos.x += iconPad; 1205 pos.x += iconPad;
1205 const int avail = width_Rect(itemRect) - iconPad - 3 * gap_UI; 1206 const int avail = width_Rect(itemRect) - iconPad - 3 * gap_UI;
@@ -1214,12 +1215,12 @@ static void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect,
1214 const char *endPos; 1215 const char *endPos;
1215 tryAdvance_Text( 1216 tryAdvance_Text(
1216 uiContent_FontId, range_String(&d->label), avail - skip, &endPos); 1217 uiContent_FontId, range_String(&d->label), avail - skip, &endPos);
1217 drawRange_Text(uiContent_FontId, 1218 drawRange_Text(titleFont,
1218 cur, 1219 cur,
1219 labelFg, 1220 labelFg,
1220 (iRangecc){ constBegin_String(&d->label), endPos }); 1221 (iRangecc){ constBegin_String(&d->label), endPos });
1221 if (endPos < constEnd_String(&d->label)) { 1222 if (endPos < constEnd_String(&d->label)) {
1222 drawRange_Text(uiContent_FontId, 1223 drawRange_Text(titleFont,
1223 addY_I2(pos, h2), labelFg, 1224 addY_I2(pos, h2), labelFg,
1224 (iRangecc){ endPos, constEnd_String(&d->label) }); 1225 (iRangecc){ endPos, constEnd_String(&d->label) });
1225 } 1226 }
@@ -1227,7 +1228,7 @@ static void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect,
1227 else { 1228 else {
1228 pos.y += (itemHeight - h1 - h2) / 2; 1229 pos.y += (itemHeight - h1 - h2) / 2;
1229 drawRange_Text(uiLabel_FontId, pos, fg, range_String(&d->meta)); 1230 drawRange_Text(uiLabel_FontId, pos, fg, range_String(&d->meta));
1230 drawRange_Text(uiContent_FontId, addY_I2(pos, h1), labelFg, range_String(&d->label)); 1231 drawRange_Text(titleFont, addY_I2(pos, h1), labelFg, range_String(&d->label));
1231 } 1232 }
1232 } 1233 }
1233 } 1234 }
@@ -1266,8 +1267,6 @@ static void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect,
1266 } 1267 }
1267 else if (sidebar->mode == history_SidebarMode) { 1268 else if (sidebar->mode == history_SidebarMode) {
1268 iBeginCollect(); 1269 iBeginCollect();
1269 const int fg = isHover ? (isPressing ? uiTextPressed_ColorId : uiTextFramelessHover_ColorId)
1270 : uiText_ColorId;
1271 if (d->listItem.isSeparator) { 1270 if (d->listItem.isSeparator) {
1272 if (!isEmpty_String(&d->meta)) { 1271 if (!isEmpty_String(&d->meta)) {
1273 iInt2 drawPos = addY_I2(topLeft_Rect(itemRect), d->id); 1272 iInt2 drawPos = addY_I2(topLeft_Rect(itemRect), d->id);
@@ -1284,6 +1283,8 @@ static void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect,
1284 } 1283 }
1285 } 1284 }
1286 else { 1285 else {
1286 const int fg = isHover ? (isPressing ? uiTextPressed_ColorId : uiTextFramelessHover_ColorId)
1287 : uiHeading_ColorId;
1287 iUrl parts; 1288 iUrl parts;
1288 init_Url(&parts, &d->label); 1289 init_Url(&parts, &d->label);
1289 const iBool isAbout = equalCase_Rangecc(parts.scheme, "about"); 1290 const iBool isAbout = equalCase_Rangecc(parts.scheme, "about");
@@ -1320,7 +1321,10 @@ static void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect,
1320 drawRange_Text( 1321 drawRange_Text(
1321 font, cPos, d->listItem.isSelected ? iconColor : metaFg, range_String(&icon)); 1322 font, cPos, d->listItem.isSelected ? iconColor : metaFg, range_String(&icon));
1322 deinit_String(&icon); 1323 deinit_String(&icon);
1323 drawRange_Text(font, add_I2(cPos, init_I2(6 * gap_UI, 0)), fg, range_String(&d->label)); 1324 drawRange_Text(d->listItem.isSelected ? uiContentBold_FontId : font,
1325 add_I2(cPos, init_I2(6 * gap_UI, 0)),
1326 fg,
1327 range_String(&d->label));
1324 drawRange_Text(default_FontId, 1328 drawRange_Text(default_FontId,
1325 add_I2(cPos, init_I2(6 * gap_UI, lineHeight_Text(font))), 1329 add_I2(cPos, init_I2(6 * gap_UI, lineHeight_Text(font))),
1326 metaFg, 1330 metaFg,