From 5d95e1d76d12f72bf6e6c1d6809a201ba141a100 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Fri, 5 Mar 2021 20:54:06 +0200 Subject: Menu item icons --- src/defs.h | 13 +++++++++++-- src/ui/documentwidget.c | 14 +++++++------- src/ui/labelwidget.c | 6 ++++-- src/ui/sidebarwidget.c | 25 ++++++++++++++----------- 4 files changed, 36 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/defs.h b/src/defs.h index b346b93c..c1514c73 100644 --- a/src/defs.h +++ b/src/defs.h @@ -31,6 +31,7 @@ enum iFileVersion { /* Icons */ +#define warning_Icon "\u26a0" #define openLock_Icon "\U0001f513" #define closedLock_Icon "\U0001f512" #define close_Icon "\u2a2f" @@ -40,22 +41,30 @@ enum iFileVersion { #define upArrow_Icon "\u2191" #define upArrowBar_Icon "\u2912" #define downArrowBar_Icon "\u2913" +#define rightArrowWhite_Icon "\u21e8" +#define rightArrow_Icon "\u279e" #define barLeftArrow_Icon "\u21a4" #define barRightArrow_Icon "\u21a6" #define clock_Icon "\U0001f553" #define pin_Icon "\U0001f588" #define star_Icon "\u2605" +#define whiteStar_Icon "\u2606" #define person_Icon "\U0001f464" #define download_Icon "\u2ba7" #define hourglass_Icon "\u231b" #define timer_Icon "\u23f2" #define home_Icon "\U0001f3e0" #define edit_Icon "\u270e" -#define delete_Icon "\u2bbf" +#define delete_Icon "\u232b" //"\u2bbf" #define copy_Icon "\u2bba" #define check_Icon "\u2714" #define ballotCheck_Icon "\U0001f5f9" #define inbox_Icon "\U0001f4e5" #define book_Icon "\U0001f56e" -#define open_Icon "\u2bab" +#define openTab_Icon "\u2750" +#define openTabBg_Icon "\u2b1a" +#define openExt_Icon "\u27a0" #define add_Icon "\u2795" +#define page_Icon "\U0001d363" // "\U0001f5b9" +#define circle_Icon "\u25cf" +#define circleWhite_Icon "\u25cb" 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 setFlags_Widget(as_Widget(lock), disabled_WidgetFlag, iFalse); const iBool isDarkMode = isDark_ColorTheme(colorTheme_App()); if (~d->certFlags & domainVerified_GmCertFlag) { - updateTextCStr_LabelWidget(lock, red_ColorEscape "\u26a0"); + updateTextCStr_LabelWidget(lock, red_ColorEscape warning_Icon); } else if (d->certFlags & trusted_GmCertFlag) { updateTextCStr_LabelWidget(lock, green_ColorEscape closedLock_Icon); } else { - updateTextCStr_LabelWidget(lock, isDarkMode ? orange_ColorEscape "\u26a0" - : black_ColorEscape "\u26a0"); + updateTextCStr_LabelWidget(lock, isDarkMode ? orange_ColorEscape warning_Icon + : black_ColorEscape warning_Icon); } setBanner_GmDocument(d->doc, bannerType_DocumentWidget_(d)); } @@ -2427,11 +2427,11 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e pushBackN_Array( &items, (iMenuItem[]){ - { open_Icon " Open Link in New Tab", + { openTab_Icon " Open Link in New Tab", 0, 0, format_CStr("!open newtab:1 url:%s", cstr_String(linkUrl)) }, - { "Open Link in Background Tab", + { openTabBg_Icon " Open Link in Background Tab", 0, 0, format_CStr("!open newtab:2 url:%s", cstr_String(linkUrl)) } }, @@ -2440,7 +2440,7 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e else if (!willUseProxy_App(scheme)) { pushBack_Array( &items, - &(iMenuItem){ "Open Link in Default Browser", + &(iMenuItem){ openExt_Icon " Open Link in Default Browser", 0, 0, format_CStr("!open default:1 url:%s", cstr_String(linkUrl)) }); @@ -2450,7 +2450,7 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e &items, (iMenuItem[]){ { "---", 0, 0, NULL }, - { isGemini ? "Open without Proxy" : "Open Link in Default Browser", + { isGemini ? "Open without Proxy" : openExt_Icon " Open Link in Default Browser", 0, 0, 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 } iLocalDef int iconPadding_LabelWidget_(const iLabelWidget *d) { - return d->icon ? iRound(lineHeight_Text(d->font) * 1.5f) : 0; + const float amount = flags_Widget(constAs_Widget(d)) & extraPadding_WidgetFlag ? 1.5f : 1.15f; + return d->icon ? iRound(lineHeight_Text(d->font) * amount) : 0; } static void draw_LabelWidget_(const iLabelWidget *d) { @@ -244,7 +245,8 @@ static void draw_LabelWidget_(const iLabelWidget *d) { iString str; initUnicodeN_String(&str, &d->icon, 1); drawCentered_Text(d->font, - (iRect){ addX_I2(add_I2(bounds.pos, padding_(flags)), -2 * gap_UI), + (iRect){ addX_I2(add_I2(bounds.pos, padding_(flags)), + (flags & extraPadding_WidgetFlag ? -2 : -1) * gap_UI), init_I2(iconPad, lineHeight_Text(d->font)) }, iTrue, 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) { } d->menu = makeMenu_Widget( as_Widget(d), - (iMenuItem[]){ { open_Icon " Open Entry in New Tab", 0, 0, "feed.entry.opentab" }, - { "Mark as Read", 0, 0, "feed.entry.toggleread" }, + (iMenuItem[]){ { openTab_Icon " Open Entry in New Tab", 0, 0, "feed.entry.opentab" }, + { circle_Icon " Mark as Read", 0, 0, "feed.entry.toggleread" }, { pin_Icon " Add Bookmark...", 0, 0, "feed.entry.bookmark" }, { "---", 0, 0, NULL }, - { "Open Feed Page", 0, 0, "feed.entry.openfeed" }, + { page_Icon " Open Feed Page", 0, 0, "feed.entry.openfeed" }, { edit_Icon " Edit Feed...", 0, 0, "feed.entry.edit" }, - { star_Icon " " uiTextCaution_ColorEscape "Unsubscribe...", 0, 0, "feed.entry.unsubscribe" }, + { whiteStar_Icon " " uiTextCaution_ColorEscape "Unsubscribe...", 0, 0, "feed.entry.unsubscribe" }, { "---", 0, 0, NULL }, { check_Icon " Mark All as Read", SDLK_a, KMOD_SHIFT, "feeds.markallread" }, { reload_Icon " Refresh Feeds", SDLK_r, KMOD_PRIMARY | KMOD_SHIFT, "feeds.refresh" } }, @@ -256,8 +256,8 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { } d->menu = makeMenu_Widget( as_Widget(d), - (iMenuItem[]){ { open_Icon " Open in New Tab", 0, 0, "bookmark.open newtab:1" }, - { "Open in Background Tab", 0, 0, "bookmark.open newtab:2" }, + (iMenuItem[]){ { openTab_Icon " Open in New Tab", 0, 0, "bookmark.open newtab:1" }, + { openTabBg_Icon " Open in Background Tab", 0, 0, "bookmark.open newtab:2" }, { "---", 0, 0, NULL }, { edit_Icon " Edit...", 0, 0, "bookmark.edit" }, { copy_Icon " Duplicate...", 0, 0, "bookmark.dup" }, @@ -319,7 +319,7 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { { "Copy URL", 0, 0, "history.copy" }, { pin_Icon " Add Bookmark...", 0, 0, "history.addbookmark" }, { "---", 0, 0, NULL }, - { "Forget URL", 0, 0, "history.delete" }, + { close_Icon " Forget URL", 0, 0, "history.delete" }, { "---", 0, 0, NULL }, { delete_Icon " " uiTextCaution_ColorEscape "Clear History...", 0, 0, "history.clear confirm:1" }, }, 6); @@ -454,7 +454,7 @@ static const char *normalModeLabels_[max_SidebarMode] = { star_Icon " Feeds", clock_Icon " History", person_Icon " Identities", - "\U0001f5b9 Outline", + page_Icon " Outline", }; static const char *tightModeLabels_[max_SidebarMode] = { @@ -462,7 +462,7 @@ static const char *tightModeLabels_[max_SidebarMode] = { star_Icon, clock_Icon, person_Icon, - "\U0001f5b9", + page_Icon, }; const char *icon_SidebarMode(enum iSidebarMode mode) { @@ -1187,8 +1187,11 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev) } else if (d->mode == feeds_SidebarMode && d->contextItem) { iLabelWidget *menuItem = findMenuItem_Widget(d->menu, "feed.entry.toggleread"); - const iBool isRead = d->contextItem->indent == 0; - setTextCStr_LabelWidget(menuItem, isRead ? "Mark as Unread" : "Mark as Read"); + const iBool isRead = d->contextItem->indent == 0; + setTextCStr_LabelWidget(menuItem, + isRead ? circle_Icon " Mark as Unread" + : circleWhite_Icon " Mark as Read"); + checkIcon_LabelWidget(menuItem); } else if (d->mode == identities_SidebarMode) { const iGmIdentity *ident = constHoverIdentity_SidebarWidget_(d); -- cgit v1.2.3