diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-05 20:54:06 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-05 20:54:06 +0200 |
commit | 5d95e1d76d12f72bf6e6c1d6809a201ba141a100 (patch) | |
tree | e565db8b94dab5de89314224d9ecef83d19a16a6 /src/ui | |
parent | 9fe6abe90dcaacfc9479b1c53edf2b239c81c4e5 (diff) |
Menu item icons
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/documentwidget.c | 14 | ||||
-rw-r--r-- | src/ui/labelwidget.c | 6 | ||||
-rw-r--r-- | src/ui/sidebarwidget.c | 25 |
3 files changed, 25 insertions, 20 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 3a317890..9ae36b46 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -987,14 +987,14 @@ static void updateTrust_DocumentWidget_(iDocumentWidget *d, const iGmResponse *r | |||
987 | setFlags_Widget(as_Widget(lock), disabled_WidgetFlag, iFalse); | 987 | setFlags_Widget(as_Widget(lock), disabled_WidgetFlag, iFalse); |
988 | const iBool isDarkMode = isDark_ColorTheme(colorTheme_App()); | 988 | const iBool isDarkMode = isDark_ColorTheme(colorTheme_App()); |
989 | if (~d->certFlags & domainVerified_GmCertFlag) { | 989 | if (~d->certFlags & domainVerified_GmCertFlag) { |
990 | updateTextCStr_LabelWidget(lock, red_ColorEscape "\u26a0"); | 990 | updateTextCStr_LabelWidget(lock, red_ColorEscape warning_Icon); |
991 | } | 991 | } |
992 | else if (d->certFlags & trusted_GmCertFlag) { | 992 | else if (d->certFlags & trusted_GmCertFlag) { |
993 | updateTextCStr_LabelWidget(lock, green_ColorEscape closedLock_Icon); | 993 | updateTextCStr_LabelWidget(lock, green_ColorEscape closedLock_Icon); |
994 | } | 994 | } |
995 | else { | 995 | else { |
996 | updateTextCStr_LabelWidget(lock, isDarkMode ? orange_ColorEscape "\u26a0" | 996 | updateTextCStr_LabelWidget(lock, isDarkMode ? orange_ColorEscape warning_Icon |
997 | : black_ColorEscape "\u26a0"); | 997 | : black_ColorEscape warning_Icon); |
998 | } | 998 | } |
999 | setBanner_GmDocument(d->doc, bannerType_DocumentWidget_(d)); | 999 | setBanner_GmDocument(d->doc, bannerType_DocumentWidget_(d)); |
1000 | } | 1000 | } |
@@ -2427,11 +2427,11 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
2427 | pushBackN_Array( | 2427 | pushBackN_Array( |
2428 | &items, | 2428 | &items, |
2429 | (iMenuItem[]){ | 2429 | (iMenuItem[]){ |
2430 | { open_Icon " Open Link in New Tab", | 2430 | { openTab_Icon " Open Link in New Tab", |
2431 | 0, | 2431 | 0, |
2432 | 0, | 2432 | 0, |
2433 | format_CStr("!open newtab:1 url:%s", cstr_String(linkUrl)) }, | 2433 | format_CStr("!open newtab:1 url:%s", cstr_String(linkUrl)) }, |
2434 | { "Open Link in Background Tab", | 2434 | { openTabBg_Icon " Open Link in Background Tab", |
2435 | 0, | 2435 | 0, |
2436 | 0, | 2436 | 0, |
2437 | format_CStr("!open newtab:2 url:%s", cstr_String(linkUrl)) } }, | 2437 | format_CStr("!open newtab:2 url:%s", cstr_String(linkUrl)) } }, |
@@ -2440,7 +2440,7 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
2440 | else if (!willUseProxy_App(scheme)) { | 2440 | else if (!willUseProxy_App(scheme)) { |
2441 | pushBack_Array( | 2441 | pushBack_Array( |
2442 | &items, | 2442 | &items, |
2443 | &(iMenuItem){ "Open Link in Default Browser", | 2443 | &(iMenuItem){ openExt_Icon " Open Link in Default Browser", |
2444 | 0, | 2444 | 0, |
2445 | 0, | 2445 | 0, |
2446 | format_CStr("!open default:1 url:%s", cstr_String(linkUrl)) }); | 2446 | format_CStr("!open default:1 url:%s", cstr_String(linkUrl)) }); |
@@ -2450,7 +2450,7 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
2450 | &items, | 2450 | &items, |
2451 | (iMenuItem[]){ | 2451 | (iMenuItem[]){ |
2452 | { "---", 0, 0, NULL }, | 2452 | { "---", 0, 0, NULL }, |
2453 | { isGemini ? "Open without Proxy" : "Open Link in Default Browser", | 2453 | { isGemini ? "Open without Proxy" : openExt_Icon " Open Link in Default Browser", |
2454 | 0, | 2454 | 0, |
2455 | 0, | 2455 | 0, |
2456 | format_CStr("!open noproxy:1 url:%s", cstr_String(linkUrl)) } }, | 2456 | format_CStr("!open noproxy:1 url:%s", cstr_String(linkUrl)) } }, |
diff --git a/src/ui/labelwidget.c b/src/ui/labelwidget.c index 3ebec790..4de00ec1 100644 --- a/src/ui/labelwidget.c +++ b/src/ui/labelwidget.c | |||
@@ -204,7 +204,8 @@ static void getColors_LabelWidget_(const iLabelWidget *d, int *bg, int *fg, int | |||
204 | } | 204 | } |
205 | 205 | ||
206 | iLocalDef int iconPadding_LabelWidget_(const iLabelWidget *d) { | 206 | iLocalDef int iconPadding_LabelWidget_(const iLabelWidget *d) { |
207 | return d->icon ? iRound(lineHeight_Text(d->font) * 1.5f) : 0; | 207 | const float amount = flags_Widget(constAs_Widget(d)) & extraPadding_WidgetFlag ? 1.5f : 1.15f; |
208 | return d->icon ? iRound(lineHeight_Text(d->font) * amount) : 0; | ||
208 | } | 209 | } |
209 | 210 | ||
210 | static void draw_LabelWidget_(const iLabelWidget *d) { | 211 | static void draw_LabelWidget_(const iLabelWidget *d) { |
@@ -244,7 +245,8 @@ static void draw_LabelWidget_(const iLabelWidget *d) { | |||
244 | iString str; | 245 | iString str; |
245 | initUnicodeN_String(&str, &d->icon, 1); | 246 | initUnicodeN_String(&str, &d->icon, 1); |
246 | drawCentered_Text(d->font, | 247 | drawCentered_Text(d->font, |
247 | (iRect){ addX_I2(add_I2(bounds.pos, padding_(flags)), -2 * gap_UI), | 248 | (iRect){ addX_I2(add_I2(bounds.pos, padding_(flags)), |
249 | (flags & extraPadding_WidgetFlag ? -2 : -1) * gap_UI), | ||
248 | init_I2(iconPad, lineHeight_Text(d->font)) }, | 250 | init_I2(iconPad, lineHeight_Text(d->font)) }, |
249 | iTrue, | 251 | iTrue, |
250 | startsWith_String(&d->label, uiTextCaution_ColorEscape) | 252 | startsWith_String(&d->label, uiTextCaution_ColorEscape) |
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index abeeb2b9..2a6b68e2 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -197,13 +197,13 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { | |||
197 | } | 197 | } |
198 | d->menu = makeMenu_Widget( | 198 | d->menu = makeMenu_Widget( |
199 | as_Widget(d), | 199 | as_Widget(d), |
200 | (iMenuItem[]){ { open_Icon " Open Entry in New Tab", 0, 0, "feed.entry.opentab" }, | 200 | (iMenuItem[]){ { openTab_Icon " Open Entry in New Tab", 0, 0, "feed.entry.opentab" }, |
201 | { "Mark as Read", 0, 0, "feed.entry.toggleread" }, | 201 | { circle_Icon " Mark as Read", 0, 0, "feed.entry.toggleread" }, |
202 | { pin_Icon " Add Bookmark...", 0, 0, "feed.entry.bookmark" }, | 202 | { pin_Icon " Add Bookmark...", 0, 0, "feed.entry.bookmark" }, |
203 | { "---", 0, 0, NULL }, | 203 | { "---", 0, 0, NULL }, |
204 | { "Open Feed Page", 0, 0, "feed.entry.openfeed" }, | 204 | { page_Icon " Open Feed Page", 0, 0, "feed.entry.openfeed" }, |
205 | { edit_Icon " Edit Feed...", 0, 0, "feed.entry.edit" }, | 205 | { edit_Icon " Edit Feed...", 0, 0, "feed.entry.edit" }, |
206 | { star_Icon " " uiTextCaution_ColorEscape "Unsubscribe...", 0, 0, "feed.entry.unsubscribe" }, | 206 | { whiteStar_Icon " " uiTextCaution_ColorEscape "Unsubscribe...", 0, 0, "feed.entry.unsubscribe" }, |
207 | { "---", 0, 0, NULL }, | 207 | { "---", 0, 0, NULL }, |
208 | { check_Icon " Mark All as Read", SDLK_a, KMOD_SHIFT, "feeds.markallread" }, | 208 | { check_Icon " Mark All as Read", SDLK_a, KMOD_SHIFT, "feeds.markallread" }, |
209 | { reload_Icon " Refresh Feeds", SDLK_r, KMOD_PRIMARY | KMOD_SHIFT, "feeds.refresh" } }, | 209 | { reload_Icon " Refresh Feeds", SDLK_r, KMOD_PRIMARY | KMOD_SHIFT, "feeds.refresh" } }, |
@@ -256,8 +256,8 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { | |||
256 | } | 256 | } |
257 | d->menu = makeMenu_Widget( | 257 | d->menu = makeMenu_Widget( |
258 | as_Widget(d), | 258 | as_Widget(d), |
259 | (iMenuItem[]){ { open_Icon " Open in New Tab", 0, 0, "bookmark.open newtab:1" }, | 259 | (iMenuItem[]){ { openTab_Icon " Open in New Tab", 0, 0, "bookmark.open newtab:1" }, |
260 | { "Open in Background Tab", 0, 0, "bookmark.open newtab:2" }, | 260 | { openTabBg_Icon " Open in Background Tab", 0, 0, "bookmark.open newtab:2" }, |
261 | { "---", 0, 0, NULL }, | 261 | { "---", 0, 0, NULL }, |
262 | { edit_Icon " Edit...", 0, 0, "bookmark.edit" }, | 262 | { edit_Icon " Edit...", 0, 0, "bookmark.edit" }, |
263 | { copy_Icon " Duplicate...", 0, 0, "bookmark.dup" }, | 263 | { copy_Icon " Duplicate...", 0, 0, "bookmark.dup" }, |
@@ -319,7 +319,7 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { | |||
319 | { "Copy URL", 0, 0, "history.copy" }, | 319 | { "Copy URL", 0, 0, "history.copy" }, |
320 | { pin_Icon " Add Bookmark...", 0, 0, "history.addbookmark" }, | 320 | { pin_Icon " Add Bookmark...", 0, 0, "history.addbookmark" }, |
321 | { "---", 0, 0, NULL }, | 321 | { "---", 0, 0, NULL }, |
322 | { "Forget URL", 0, 0, "history.delete" }, | 322 | { close_Icon " Forget URL", 0, 0, "history.delete" }, |
323 | { "---", 0, 0, NULL }, | 323 | { "---", 0, 0, NULL }, |
324 | { delete_Icon " " uiTextCaution_ColorEscape "Clear History...", 0, 0, "history.clear confirm:1" }, | 324 | { delete_Icon " " uiTextCaution_ColorEscape "Clear History...", 0, 0, "history.clear confirm:1" }, |
325 | }, 6); | 325 | }, 6); |
@@ -454,7 +454,7 @@ static const char *normalModeLabels_[max_SidebarMode] = { | |||
454 | star_Icon " Feeds", | 454 | star_Icon " Feeds", |
455 | clock_Icon " History", | 455 | clock_Icon " History", |
456 | person_Icon " Identities", | 456 | person_Icon " Identities", |
457 | "\U0001f5b9 Outline", | 457 | page_Icon " Outline", |
458 | }; | 458 | }; |
459 | 459 | ||
460 | static const char *tightModeLabels_[max_SidebarMode] = { | 460 | static const char *tightModeLabels_[max_SidebarMode] = { |
@@ -462,7 +462,7 @@ static const char *tightModeLabels_[max_SidebarMode] = { | |||
462 | star_Icon, | 462 | star_Icon, |
463 | clock_Icon, | 463 | clock_Icon, |
464 | person_Icon, | 464 | person_Icon, |
465 | "\U0001f5b9", | 465 | page_Icon, |
466 | }; | 466 | }; |
467 | 467 | ||
468 | const char *icon_SidebarMode(enum iSidebarMode mode) { | 468 | const char *icon_SidebarMode(enum iSidebarMode mode) { |
@@ -1187,8 +1187,11 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev) | |||
1187 | } | 1187 | } |
1188 | else if (d->mode == feeds_SidebarMode && d->contextItem) { | 1188 | else if (d->mode == feeds_SidebarMode && d->contextItem) { |
1189 | iLabelWidget *menuItem = findMenuItem_Widget(d->menu, "feed.entry.toggleread"); | 1189 | iLabelWidget *menuItem = findMenuItem_Widget(d->menu, "feed.entry.toggleread"); |
1190 | const iBool isRead = d->contextItem->indent == 0; | 1190 | const iBool isRead = d->contextItem->indent == 0; |
1191 | setTextCStr_LabelWidget(menuItem, isRead ? "Mark as Unread" : "Mark as Read"); | 1191 | setTextCStr_LabelWidget(menuItem, |
1192 | isRead ? circle_Icon " Mark as Unread" | ||
1193 | : circleWhite_Icon " Mark as Read"); | ||
1194 | checkIcon_LabelWidget(menuItem); | ||
1192 | } | 1195 | } |
1193 | else if (d->mode == identities_SidebarMode) { | 1196 | else if (d->mode == identities_SidebarMode) { |
1194 | const iGmIdentity *ident = constHoverIdentity_SidebarWidget_(d); | 1197 | const iGmIdentity *ident = constHoverIdentity_SidebarWidget_(d); |