diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-05 15:03:38 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-05 15:03:38 +0200 |
commit | a3457b5d756f434e887288341559a9e5fa6f9f69 (patch) | |
tree | 5e627e6eba584b0be4c47256695f8c39efc6915a | |
parent | 71f3f34782aa6050ede4bf143fa6028653adae6d (diff) |
Defined a set of UI icons; use in menus
-rw-r--r-- | src/defs.h | 30 | ||||
-rw-r--r-- | src/ui/documentwidget.c | 30 | ||||
-rw-r--r-- | src/ui/labelwidget.c | 29 | ||||
-rw-r--r-- | src/ui/sidebarwidget.c | 68 | ||||
-rw-r--r-- | src/ui/window.c | 31 |
5 files changed, 111 insertions, 77 deletions
@@ -31,5 +31,31 @@ enum iFileVersion { | |||
31 | 31 | ||
32 | /* Icons */ | 32 | /* Icons */ |
33 | 33 | ||
34 | #define openLock_CStr "\U0001f513" | 34 | #define openLock_Icon "\U0001f513" |
35 | #define closedLock_CStr "\U0001f512" | 35 | #define closedLock_Icon "\U0001f512" |
36 | #define close_Icon "\u2a2f" | ||
37 | #define reload_Icon "\U0001f503" | ||
38 | #define backArrow_Icon "\U0001f870" | ||
39 | #define forwardArrow_Icon "\U0001f872" | ||
40 | #define upArrow_Icon "\u2191" | ||
41 | #define upArrowBar_Icon "\u2912" | ||
42 | #define downArrowBar_Icon "\u2913" | ||
43 | #define barLeftArrow_Icon "\u21a4" | ||
44 | #define barRightArrow_Icon "\u21a6" | ||
45 | #define clock_Icon "\U0001f553" | ||
46 | #define pin_Icon "\U0001f588" | ||
47 | #define star_Icon "\u2605" | ||
48 | #define person_Icon "\U0001f464" | ||
49 | #define download_Icon "\u2ba7" | ||
50 | #define hourglass_Icon "\u231b" | ||
51 | #define timer_Icon "\u23f2" | ||
52 | #define home_Icon "\U0001f3e0" | ||
53 | #define edit_Icon "\u270e" | ||
54 | #define delete_Icon "\u2bbf" | ||
55 | #define copy_Icon "\u2bba" | ||
56 | #define check_Icon "\u2714" | ||
57 | #define ballotCheck_Icon "\U0001f5f9" | ||
58 | #define inbox_Icon "\U0001f4e5" | ||
59 | #define book_Icon "\U0001f56e" | ||
60 | #define open_Icon "\u2bab" | ||
61 | #define add_Icon "\u2795" | ||
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 6972f32d..3a317890 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -981,7 +981,7 @@ static void updateTrust_DocumentWidget_(iDocumentWidget *d, const iGmResponse *r | |||
981 | iLabelWidget *lock = findWidget_App("navbar.lock"); | 981 | iLabelWidget *lock = findWidget_App("navbar.lock"); |
982 | if (~d->certFlags & available_GmCertFlag) { | 982 | if (~d->certFlags & available_GmCertFlag) { |
983 | setFlags_Widget(as_Widget(lock), disabled_WidgetFlag, iTrue); | 983 | setFlags_Widget(as_Widget(lock), disabled_WidgetFlag, iTrue); |
984 | updateTextCStr_LabelWidget(lock, gray50_ColorEscape openLock_CStr); | 984 | updateTextCStr_LabelWidget(lock, gray50_ColorEscape openLock_Icon); |
985 | return; | 985 | return; |
986 | } | 986 | } |
987 | setFlags_Widget(as_Widget(lock), disabled_WidgetFlag, iFalse); | 987 | setFlags_Widget(as_Widget(lock), disabled_WidgetFlag, iFalse); |
@@ -990,7 +990,7 @@ static void updateTrust_DocumentWidget_(iDocumentWidget *d, const iGmResponse *r | |||
990 | updateTextCStr_LabelWidget(lock, red_ColorEscape "\u26a0"); | 990 | updateTextCStr_LabelWidget(lock, red_ColorEscape "\u26a0"); |
991 | } | 991 | } |
992 | else if (d->certFlags & trusted_GmCertFlag) { | 992 | else if (d->certFlags & trusted_GmCertFlag) { |
993 | updateTextCStr_LabelWidget(lock, green_ColorEscape closedLock_CStr); | 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 "\u26a0" |
@@ -2427,7 +2427,7 @@ 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 Link in New Tab", | 2430 | { open_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)) }, |
@@ -2461,7 +2461,7 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
2461 | pushBackN_Array(&items, | 2461 | pushBackN_Array(&items, |
2462 | (iMenuItem[]){ { "---", 0, 0, NULL }, | 2462 | (iMenuItem[]){ { "---", 0, 0, NULL }, |
2463 | { "Copy Link", 0, 0, "document.copylink" }, | 2463 | { "Copy Link", 0, 0, "document.copylink" }, |
2464 | { "Bookmark Link...", | 2464 | { pin_Icon " Bookmark Link...", |
2465 | 0, | 2465 | 0, |
2466 | 0, | 2466 | 0, |
2467 | format_CStr("!bookmark.add title:%s url:%s", | 2467 | format_CStr("!bookmark.add title:%s url:%s", |
@@ -2472,7 +2472,7 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
2472 | if (isNative && d->contextLink->mediaType != download_GmRunMediaType) { | 2472 | if (isNative && d->contextLink->mediaType != download_GmRunMediaType) { |
2473 | pushBackN_Array(&items, (iMenuItem[]){ | 2473 | pushBackN_Array(&items, (iMenuItem[]){ |
2474 | { "---", 0, 0, NULL }, | 2474 | { "---", 0, 0, NULL }, |
2475 | { "Download Linked File", 0, 0, "document.downloadlink" }, | 2475 | { download_Icon " Download Linked File", 0, 0, "document.downloadlink" }, |
2476 | }, 2); | 2476 | }, 2); |
2477 | } | 2477 | } |
2478 | iMediaRequest *mediaReq; | 2478 | iMediaRequest *mediaReq; |
@@ -2480,7 +2480,7 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
2480 | d->contextLink->mediaType != download_GmRunMediaType) { | 2480 | d->contextLink->mediaType != download_GmRunMediaType) { |
2481 | if (isFinished_GmRequest(mediaReq->req)) { | 2481 | if (isFinished_GmRequest(mediaReq->req)) { |
2482 | pushBack_Array(&items, | 2482 | pushBack_Array(&items, |
2483 | &(iMenuItem){ "Save to Downloads", | 2483 | &(iMenuItem){ download_Icon " Save to Downloads", |
2484 | 0, | 2484 | 0, |
2485 | 0, | 2485 | 0, |
2486 | format_CStr("document.media.save link:%u", | 2486 | format_CStr("document.media.save link:%u", |
@@ -2500,16 +2500,16 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
2500 | (iMenuItem[]){ | 2500 | (iMenuItem[]){ |
2501 | { "Go Back", navigateBack_KeyShortcut, "navigate.back" }, | 2501 | { "Go Back", navigateBack_KeyShortcut, "navigate.back" }, |
2502 | { "Go Forward", navigateForward_KeyShortcut, "navigate.forward" }, | 2502 | { "Go Forward", navigateForward_KeyShortcut, "navigate.forward" }, |
2503 | { "Go to Parent", navigateParent_KeyShortcut, "navigate.parent" }, | 2503 | { upArrow_Icon " Go to Parent", navigateParent_KeyShortcut, "navigate.parent" }, |
2504 | { "Go to Root", navigateRoot_KeyShortcut, "navigate.root" }, | 2504 | { upArrowBar_Icon " Go to Root", navigateRoot_KeyShortcut, "navigate.root" }, |
2505 | { "---", 0, 0, NULL }, | 2505 | { "---", 0, 0, NULL }, |
2506 | { "Reload Page", reload_KeyShortcut, "navigate.reload" }, | 2506 | { reload_Icon " Reload Page", reload_KeyShortcut, "navigate.reload" }, |
2507 | { "Set Auto-Reload...", 0, 0, "document.autoreload.menu" }, | 2507 | { timer_Icon " Set Auto-Reload...", 0, 0, "document.autoreload.menu" }, |
2508 | { "---", 0, 0, NULL }, | 2508 | { "---", 0, 0, NULL }, |
2509 | { "Bookmark Page...", SDLK_d, KMOD_PRIMARY, "bookmark.add" }, | 2509 | { pin_Icon " Bookmark Page...", SDLK_d, KMOD_PRIMARY, "bookmark.add" }, |
2510 | { "Subscribe to Page...", subscribeToPage_KeyModifier, "feeds.subscribe" }, | 2510 | { star_Icon " Subscribe to Page...", subscribeToPage_KeyModifier, "feeds.subscribe" }, |
2511 | { "---", 0, 0, NULL }, | 2511 | { "---", 0, 0, NULL }, |
2512 | { "Import Links as Bookmarks...", 0, 0, "bookmark.links confirm:1" }, | 2512 | { book_Icon " Import Links as Bookmarks...", 0, 0, "bookmark.links confirm:1" }, |
2513 | { "---", 0, 0, NULL }, | 2513 | { "---", 0, 0, NULL }, |
2514 | { "Copy Page URL", 0, 0, "document.copylink" } }, | 2514 | { "Copy Page URL", 0, 0, "document.copylink" } }, |
2515 | 13); | 2515 | 13); |
@@ -2518,7 +2518,7 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
2518 | &items, | 2518 | &items, |
2519 | (iMenuItem[]){ | 2519 | (iMenuItem[]){ |
2520 | { "Copy Page Source", 'c', KMOD_PRIMARY, "copy" }, | 2520 | { "Copy Page Source", 'c', KMOD_PRIMARY, "copy" }, |
2521 | { "Save to Downloads", SDLK_s, KMOD_PRIMARY, "document.save" } }, | 2521 | { download_Icon " Save to Downloads", SDLK_s, KMOD_PRIMARY, "document.save" } }, |
2522 | 2); | 2522 | 2); |
2523 | } | 2523 | } |
2524 | } | 2524 | } |
@@ -2943,7 +2943,7 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { | |||
2943 | } | 2943 | } |
2944 | if (findMediaRequest_DocumentWidget_(d->widget, run->linkId)) { | 2944 | if (findMediaRequest_DocumentWidget_(d->widget, run->linkId)) { |
2945 | appendFormat_String( | 2945 | appendFormat_String( |
2946 | &text, " %s\u2a2f", isHover ? escape_Color(tmLinkText_ColorId) : ""); | 2946 | &text, " %s" close_Icon, isHover ? escape_Color(tmLinkText_ColorId) : ""); |
2947 | } | 2947 | } |
2948 | const iInt2 size = measureRange_Text(metaFont, range_String(&text)); | 2948 | const iInt2 size = measureRange_Text(metaFont, range_String(&text)); |
2949 | fillRect_Paint( | 2949 | fillRect_Paint( |
diff --git a/src/ui/labelwidget.c b/src/ui/labelwidget.c index 83deafe2..3ebec790 100644 --- a/src/ui/labelwidget.c +++ b/src/ui/labelwidget.c | |||
@@ -247,9 +247,11 @@ static void draw_LabelWidget_(const iLabelWidget *d) { | |||
247 | (iRect){ addX_I2(add_I2(bounds.pos, padding_(flags)), -2 * gap_UI), | 247 | (iRect){ addX_I2(add_I2(bounds.pos, padding_(flags)), -2 * gap_UI), |
248 | init_I2(iconPad, lineHeight_Text(d->font)) }, | 248 | init_I2(iconPad, lineHeight_Text(d->font)) }, |
249 | iTrue, | 249 | iTrue, |
250 | flags & pressed_WidgetFlag ? fg | 250 | startsWith_String(&d->label, uiTextCaution_ColorEscape) |
251 | : isHover ? uiIconHover_ColorId | 251 | ? uiTextCaution_ColorId |
252 | : uiIcon_ColorId, | 252 | : flags & (disabled_WidgetFlag | pressed_WidgetFlag) ? fg |
253 | : isHover ? uiIconHover_ColorId | ||
254 | : uiIcon_ColorId, | ||
253 | "%s", | 255 | "%s", |
254 | cstr_String(&str)); | 256 | cstr_String(&str)); |
255 | deinit_String(&str); | 257 | deinit_String(&str); |
@@ -410,16 +412,17 @@ void setIcon_LabelWidget(iLabelWidget *d, iChar icon) { | |||
410 | } | 412 | } |
411 | 413 | ||
412 | iBool checkIcon_LabelWidget(iLabelWidget *d) { | 414 | iBool checkIcon_LabelWidget(iLabelWidget *d) { |
413 | if (!d->icon) { | 415 | iStringConstIterator iter; |
414 | iStringConstIterator iter; | 416 | init_StringConstIterator(&iter, &d->label); |
415 | init_StringConstIterator(&iter, &d->label); | 417 | const iChar icon = iter.value; |
416 | const iChar icon = iter.value; | 418 | next_StringConstIterator(&iter); |
417 | next_StringConstIterator(&iter); | 419 | if (iter.value == ' ' && icon >= 0x100) { |
418 | if (iter.value == ' ' && icon >= 0x100) { | 420 | d->icon = icon; |
419 | d->icon = icon; | 421 | remove_Block(&d->label.chars, 0, iter.next - constBegin_String(&d->label)); |
420 | remove_Block(&d->label.chars, 0, iter.next - constBegin_String(&d->label)); | 422 | return iTrue; |
421 | return iTrue; | 423 | } |
422 | } | 424 | else { |
425 | d->icon = 0; | ||
423 | } | 426 | } |
424 | return iFalse; | 427 | return iFalse; |
425 | } | 428 | } |
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index 1f5a6d01..abeeb2b9 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -23,6 +23,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
23 | #include "sidebarwidget.h" | 23 | #include "sidebarwidget.h" |
24 | 24 | ||
25 | #include "app.h" | 25 | #include "app.h" |
26 | #include "defs.h" | ||
26 | #include "bookmarks.h" | 27 | #include "bookmarks.h" |
27 | #include "command.h" | 28 | #include "command.h" |
28 | #include "documentwidget.h" | 29 | #include "documentwidget.h" |
@@ -196,16 +197,16 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { | |||
196 | } | 197 | } |
197 | d->menu = makeMenu_Widget( | 198 | d->menu = makeMenu_Widget( |
198 | as_Widget(d), | 199 | as_Widget(d), |
199 | (iMenuItem[]){ { "Open Entry in New Tab", 0, 0, "feed.entry.opentab" }, | 200 | (iMenuItem[]){ { open_Icon " Open Entry in New Tab", 0, 0, "feed.entry.opentab" }, |
200 | { "Mark as Read", 0, 0, "feed.entry.toggleread" }, | 201 | { "Mark as Read", 0, 0, "feed.entry.toggleread" }, |
201 | { "Add Bookmark...", 0, 0, "feed.entry.bookmark" }, | 202 | { pin_Icon " Add Bookmark...", 0, 0, "feed.entry.bookmark" }, |
202 | { "---", 0, 0, NULL }, | 203 | { "---", 0, 0, NULL }, |
203 | { "Open Feed Page", 0, 0, "feed.entry.openfeed" }, | 204 | { "Open Feed Page", 0, 0, "feed.entry.openfeed" }, |
204 | { "Edit Feed...", 0, 0, "feed.entry.edit" }, | 205 | { edit_Icon " Edit Feed...", 0, 0, "feed.entry.edit" }, |
205 | { uiTextCaution_ColorEscape "Unsubscribe...", 0, 0, "feed.entry.unsubscribe" }, | 206 | { star_Icon " " uiTextCaution_ColorEscape "Unsubscribe...", 0, 0, "feed.entry.unsubscribe" }, |
206 | { "---", 0, 0, NULL }, | 207 | { "---", 0, 0, NULL }, |
207 | { "Mark All as Read", SDLK_a, KMOD_SHIFT, "feeds.markallread" }, | 208 | { check_Icon " Mark All as Read", SDLK_a, KMOD_SHIFT, "feeds.markallread" }, |
208 | { "Refresh Feeds", SDLK_r, KMOD_PRIMARY | KMOD_SHIFT, "feeds.refresh" } }, | 209 | { reload_Icon " Refresh Feeds", SDLK_r, KMOD_PRIMARY | KMOD_SHIFT, "feeds.refresh" } }, |
209 | 10); | 210 | 10); |
210 | break; | 211 | break; |
211 | } | 212 | } |
@@ -255,20 +256,20 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { | |||
255 | } | 256 | } |
256 | d->menu = makeMenu_Widget( | 257 | d->menu = makeMenu_Widget( |
257 | as_Widget(d), | 258 | as_Widget(d), |
258 | (iMenuItem[]){ { "Open in New Tab", 0, 0, "bookmark.open newtab:1" }, | 259 | (iMenuItem[]){ { open_Icon " Open in New Tab", 0, 0, "bookmark.open newtab:1" }, |
259 | { "Open in Background Tab", 0, 0, "bookmark.open newtab:2" }, | 260 | { "Open in Background Tab", 0, 0, "bookmark.open newtab:2" }, |
260 | { "---", 0, 0, NULL }, | 261 | { "---", 0, 0, NULL }, |
261 | { "Edit...", 0, 0, "bookmark.edit" }, | 262 | { edit_Icon " Edit...", 0, 0, "bookmark.edit" }, |
262 | { "Duplicate...", 0, 0, "bookmark.dup" }, | 263 | { copy_Icon " Duplicate...", 0, 0, "bookmark.dup" }, |
263 | { "Copy URL", 0, 0, "bookmark.copy" }, | 264 | { "Copy URL", 0, 0, "bookmark.copy" }, |
264 | { "---", 0, 0, NULL }, | 265 | { "---", 0, 0, NULL }, |
265 | { "?", 0, 0, "bookmark.tag tag:subscribed" }, | 266 | { "?", 0, 0, "bookmark.tag tag:subscribed" }, |
266 | { "?", 0, 0, "bookmark.tag tag:homepage" }, | 267 | { "?", 0, 0, "bookmark.tag tag:homepage" }, |
267 | { "?", 0, 0, "bookmark.tag tag:remotesource" }, | 268 | { "?", 0, 0, "bookmark.tag tag:remotesource" }, |
268 | { "---", 0, 0, NULL }, | 269 | { "---", 0, 0, NULL }, |
269 | { uiTextCaution_ColorEscape "Delete Bookmark", 0, 0, "bookmark.delete" }, | 270 | { delete_Icon " " uiTextCaution_ColorEscape "Delete Bookmark", 0, 0, "bookmark.delete" }, |
270 | { "---", 0, 0, NULL }, | 271 | { "---", 0, 0, NULL }, |
271 | { "Refresh Remote Sources", 0, 0, "bookmarks.reload.remote" } }, | 272 | { reload_Icon " Refresh Remote Sources", 0, 0, "bookmarks.reload.remote" } }, |
272 | 14); | 273 | 14); |
273 | break; | 274 | break; |
274 | } | 275 | } |
@@ -316,11 +317,11 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { | |||
316 | as_Widget(d), | 317 | as_Widget(d), |
317 | (iMenuItem[]){ | 318 | (iMenuItem[]){ |
318 | { "Copy URL", 0, 0, "history.copy" }, | 319 | { "Copy URL", 0, 0, "history.copy" }, |
319 | { "Add Bookmark...", 0, 0, "history.addbookmark" }, | 320 | { pin_Icon " Add Bookmark...", 0, 0, "history.addbookmark" }, |
320 | { "---", 0, 0, NULL }, | 321 | { "---", 0, 0, NULL }, |
321 | { "Forget URL", 0, 0, "history.delete" }, | 322 | { "Forget URL", 0, 0, "history.delete" }, |
322 | { "---", 0, 0, NULL }, | 323 | { "---", 0, 0, NULL }, |
323 | { uiTextCaution_ColorEscape "Clear History...", 0, 0, "history.clear confirm:1" }, | 324 | { delete_Icon " " uiTextCaution_ColorEscape "Clear History...", 0, 0, "history.clear confirm:1" }, |
324 | }, 6); | 325 | }, 6); |
325 | break; | 326 | break; |
326 | } | 327 | } |
@@ -361,17 +362,17 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { | |||
361 | iRelease(item); | 362 | iRelease(item); |
362 | } | 363 | } |
363 | const iMenuItem menuItems[] = { | 364 | const iMenuItem menuItems[] = { |
364 | { "Use on This Page", 0, 0, "ident.use arg:1" }, | 365 | { person_Icon " Use on This Page", 0, 0, "ident.use arg:1" }, |
365 | { "Stop Using on This Page", 0, 0, "ident.use arg:0" }, | 366 | { close_Icon " Stop Using on This Page", 0, 0, "ident.use arg:0" }, |
366 | { "Stop Using Everywhere", 0, 0, "ident.use arg:0 clear:1" }, | 367 | { close_Icon " Stop Using Everywhere", 0, 0, "ident.use arg:0 clear:1" }, |
367 | { "Show Usage", 0, 0, "ident.showuse" }, | 368 | { "Show Usage", 0, 0, "ident.showuse" }, |
368 | { "---", 0, 0, NULL }, | 369 | { "---", 0, 0, NULL }, |
369 | { "Edit Notes...", 0, 0, "ident.edit" }, | 370 | { edit_Icon " Edit Notes...", 0, 0, "ident.edit" }, |
370 | { "Copy Fingerprint", 0, 0, "ident.fingerprint" }, | 371 | { "Copy Fingerprint", 0, 0, "ident.fingerprint" }, |
371 | // { "Pick Icon...", 0, 0, "ident.pickicon" }, | 372 | // { "Pick Icon...", 0, 0, "ident.pickicon" }, |
372 | { "---", 0, 0, NULL }, | 373 | { "---", 0, 0, NULL }, |
373 | //{ "Reveal Files", 0, 0, "ident.reveal" }, | 374 | //{ "Reveal Files", 0, 0, "ident.reveal" }, |
374 | { uiTextCaution_ColorEscape "Delete Identity...", 0, 0, "ident.delete confirm:1" }, | 375 | { delete_Icon " " uiTextCaution_ColorEscape "Delete Identity...", 0, 0, "ident.delete confirm:1" }, |
375 | }; | 376 | }; |
376 | d->menu = makeMenu_Widget(as_Widget(d), menuItems, iElemCount(menuItems)); | 377 | d->menu = makeMenu_Widget(as_Widget(d), menuItems, iElemCount(menuItems)); |
377 | break; | 378 | break; |
@@ -449,18 +450,18 @@ int width_SidebarWidget(const iSidebarWidget *d) { | |||
449 | } | 450 | } |
450 | 451 | ||
451 | static const char *normalModeLabels_[max_SidebarMode] = { | 452 | static const char *normalModeLabels_[max_SidebarMode] = { |
452 | "\U0001f588 Bookmarks", | 453 | pin_Icon " Bookmarks", |
453 | "\U00002605 Feeds", | 454 | star_Icon " Feeds", |
454 | "\U0001f553 History", | 455 | clock_Icon " History", |
455 | "\U0001f464 Identities", | 456 | person_Icon " Identities", |
456 | "\U0001f5b9 Outline", | 457 | "\U0001f5b9 Outline", |
457 | }; | 458 | }; |
458 | 459 | ||
459 | static const char *tightModeLabels_[max_SidebarMode] = { | 460 | static const char *tightModeLabels_[max_SidebarMode] = { |
460 | "\U0001f588", | 461 | pin_Icon, |
461 | "\U00002605", | 462 | star_Icon, |
462 | "\U0001f553", | 463 | clock_Icon, |
463 | "\U0001f464", | 464 | person_Icon, |
464 | "\U0001f5b9", | 465 | "\U0001f5b9", |
465 | }; | 466 | }; |
466 | 467 | ||
@@ -1162,22 +1163,25 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev) | |||
1162 | if (menuItem) { | 1163 | if (menuItem) { |
1163 | setTextCStr_LabelWidget(menuItem, | 1164 | setTextCStr_LabelWidget(menuItem, |
1164 | hasTag_Bookmark(bm, "homepage") | 1165 | hasTag_Bookmark(bm, "homepage") |
1165 | ? "Remove Homepage" | 1166 | ? home_Icon " Remove Homepage" |
1166 | : "Use as Homepage"); | 1167 | : home_Icon " Use as Homepage"); |
1168 | checkIcon_LabelWidget(menuItem); | ||
1167 | } | 1169 | } |
1168 | menuItem = findMenuItem_Widget(d->menu, "bookmark.tag tag:subscribed"); | 1170 | menuItem = findMenuItem_Widget(d->menu, "bookmark.tag tag:subscribed"); |
1169 | if (menuItem) { | 1171 | if (menuItem) { |
1170 | setTextCStr_LabelWidget(menuItem, | 1172 | setTextCStr_LabelWidget(menuItem, |
1171 | hasTag_Bookmark(bm, "subscribed") | 1173 | hasTag_Bookmark(bm, "subscribed") |
1172 | ? "Unsubscribe from Feed" | 1174 | ? star_Icon " Unsubscribe from Feed" |
1173 | : "Subscribe to Feed"); | 1175 | : star_Icon " Subscribe to Feed"); |
1176 | checkIcon_LabelWidget(menuItem); | ||
1174 | } | 1177 | } |
1175 | menuItem = findMenuItem_Widget(d->menu, "bookmark.tag tag:remotesource"); | 1178 | menuItem = findMenuItem_Widget(d->menu, "bookmark.tag tag:remotesource"); |
1176 | if (menuItem) { | 1179 | if (menuItem) { |
1177 | setTextCStr_LabelWidget(menuItem, | 1180 | setTextCStr_LabelWidget(menuItem, |
1178 | hasTag_Bookmark(bm, "remotesource") | 1181 | hasTag_Bookmark(bm, "remotesource") |
1179 | ? "Remove Bookmark Source" | 1182 | ? downArrowBar_Icon " Remove Bookmark Source" |
1180 | : "Use as Bookmark Source"); | 1183 | : downArrowBar_Icon " Use as Bookmark Source"); |
1184 | checkIcon_LabelWidget(menuItem); | ||
1181 | } | 1185 | } |
1182 | } | 1186 | } |
1183 | } | 1187 | } |
diff --git a/src/ui/window.c b/src/ui/window.c index 008290b9..bf7214f4 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -22,6 +22,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
22 | 22 | ||
23 | #include "window.h" | 23 | #include "window.h" |
24 | 24 | ||
25 | #include "defs.h" | ||
25 | #include "labelwidget.h" | 26 | #include "labelwidget.h" |
26 | #include "inputwidget.h" | 27 | #include "inputwidget.h" |
27 | #include "documentwidget.h" | 28 | #include "documentwidget.h" |
@@ -162,7 +163,7 @@ static iBool handleRootCommands_(iWidget *root, const char *cmd) { | |||
162 | #if !defined (iPlatformAppleMobile) | 163 | #if !defined (iPlatformAppleMobile) |
163 | /* TODO: Submenus wouldn't hurt here. */ | 164 | /* TODO: Submenus wouldn't hurt here. */ |
164 | static const iMenuItem navMenuItems_[] = { | 165 | static const iMenuItem navMenuItems_[] = { |
165 | { "New Tab", 't', KMOD_PRIMARY, "tabs.new" }, | 166 | { add_Icon " New Tab", 't', KMOD_PRIMARY, "tabs.new" }, |
166 | { "Open Location...", SDLK_l, KMOD_PRIMARY, "navigate.focus" }, | 167 | { "Open Location...", SDLK_l, KMOD_PRIMARY, "navigate.focus" }, |
167 | { "---", 0, 0, NULL }, | 168 | { "---", 0, 0, NULL }, |
168 | { "Save to Downloads", SDLK_s, KMOD_PRIMARY, "document.save" }, | 169 | { "Save to Downloads", SDLK_s, KMOD_PRIMARY, "document.save" }, |
@@ -314,14 +315,14 @@ static const iMenuItem identityButtonMenuItems_[] = { | |||
314 | { "---", 0, 0, NULL }, | 315 | { "---", 0, 0, NULL }, |
315 | { "Show Identities", '4', KMOD_PRIMARY, "sidebar.mode arg:3 show:1" }, | 316 | { "Show Identities", '4', KMOD_PRIMARY, "sidebar.mode arg:3 show:1" }, |
316 | # else | 317 | # else |
317 | { "New Identity...", 0, 0, "ident.new" }, | 318 | { add_Icon " New Identity...", 0, 0, "ident.new" }, |
318 | { "---", 0, 0, NULL }, | 319 | { "---", 0, 0, NULL }, |
319 | { "Show Identities", 0, 0, "sidebar.mode arg:3 show:1" }, | 320 | { person_Icon " Show Identities", 0, 0, "sidebar.mode arg:3 show:1" }, |
320 | #endif | 321 | #endif |
321 | }; | 322 | }; |
322 | #endif | 323 | #endif |
323 | 324 | ||
324 | static const char *reloadCStr_ = "\U0001f503"; | 325 | static const char *reloadCStr_ = reload_Icon; |
325 | 326 | ||
326 | /* TODO: A preference for these, maybe? */ | 327 | /* TODO: A preference for these, maybe? */ |
327 | static const char *stopSeqCStr_[] = { | 328 | static const char *stopSeqCStr_[] = { |
@@ -894,7 +895,7 @@ static void setupUserInterface_Window(iWindow *d) { | |||
894 | frameless_WidgetFlag); | 895 | frameless_WidgetFlag); |
895 | setId_Widget(as_Widget(appMax), "winbar.max"); | 896 | setId_Widget(as_Widget(appMax), "winbar.max"); |
896 | addChildFlags_Widget(winBar, | 897 | addChildFlags_Widget(winBar, |
897 | iClob(appClose = newLargeIcon_LabelWidget("\u2a2f", "window.close")), | 898 | iClob(appClose = newLargeIcon_LabelWidget(close_Icon, "window.close")), |
898 | frameless_WidgetFlag); | 899 | frameless_WidgetFlag); |
899 | setId_Widget(as_Widget(appClose), "winbar.close"); | 900 | setId_Widget(as_Widget(appClose), "winbar.close"); |
900 | setFont_LabelWidget(appClose, uiContent_FontId); | 901 | setFont_LabelWidget(appClose, uiContent_FontId); |
@@ -916,8 +917,8 @@ static void setupUserInterface_Window(iWindow *d) { | |||
916 | addChild_Widget(div, iClob(navBar)); | 917 | addChild_Widget(div, iClob(navBar)); |
917 | setBackgroundColor_Widget(navBar, uiBackground_ColorId); | 918 | setBackgroundColor_Widget(navBar, uiBackground_ColorId); |
918 | setCommandHandler_Widget(navBar, handleNavBarCommands_); | 919 | setCommandHandler_Widget(navBar, handleNavBarCommands_); |
919 | setId_Widget(addChildFlags_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f870", 0, 0, "navigate.back")), collapse_WidgetFlag), "navbar.back"); | 920 | setId_Widget(addChildFlags_Widget(navBar, iClob(newIcon_LabelWidget(backArrow_Icon, 0, 0, "navigate.back")), collapse_WidgetFlag), "navbar.back"); |
920 | setId_Widget(addChildFlags_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f872", 0, 0, "navigate.forward")), collapse_WidgetFlag), "navbar.forward"); | 921 | setId_Widget(addChildFlags_Widget(navBar, iClob(newIcon_LabelWidget(forwardArrow_Icon, 0, 0, "navigate.forward")), collapse_WidgetFlag), "navbar.forward"); |
921 | addChildFlags_Widget(navBar, iClob(new_Widget()), expand_WidgetFlag); | 922 | addChildFlags_Widget(navBar, iClob(new_Widget()), expand_WidgetFlag); |
922 | iLabelWidget *idMenu = makeMenuButton_LabelWidget( | 923 | iLabelWidget *idMenu = makeMenuButton_LabelWidget( |
923 | "\U0001f464", identityButtonMenuItems_, iElemCount(identityButtonMenuItems_)); | 924 | "\U0001f464", identityButtonMenuItems_, iElemCount(identityButtonMenuItems_)); |
@@ -984,7 +985,7 @@ static void setupUserInterface_Window(iWindow *d) { | |||
984 | addChildFlags_Widget(navBar, iClob(new_Widget()), expand_WidgetFlag); | 985 | addChildFlags_Widget(navBar, iClob(new_Widget()), expand_WidgetFlag); |
985 | setId_Widget(addChildFlags_Widget(navBar, | 986 | setId_Widget(addChildFlags_Widget(navBar, |
986 | iClob(newIcon_LabelWidget( | 987 | iClob(newIcon_LabelWidget( |
987 | "\U0001f3e0", SDLK_h, KMOD_PRIMARY | KMOD_SHIFT, "navigate.home")), | 988 | home_Icon, SDLK_h, KMOD_PRIMARY | KMOD_SHIFT, "navigate.home")), |
988 | collapse_WidgetFlag), | 989 | collapse_WidgetFlag), |
989 | "navbar.home"); | 990 | "navbar.home"); |
990 | #if !defined (iHaveNativeMenus) | 991 | #if !defined (iHaveNativeMenus) |
@@ -1023,7 +1024,7 @@ static void setupUserInterface_Window(iWindow *d) { | |||
1023 | setBackgroundColor_Widget(buttons, uiBackground_ColorId); | 1024 | setBackgroundColor_Widget(buttons, uiBackground_ColorId); |
1024 | } | 1025 | } |
1025 | setId_Widget( | 1026 | setId_Widget( |
1026 | addChild_Widget(buttons, iClob(newIcon_LabelWidget("\u2795", 0, 0, "tabs.new"))), | 1027 | addChild_Widget(buttons, iClob(newIcon_LabelWidget(add_Icon, 0, 0, "tabs.new"))), |
1027 | "newtab"); | 1028 | "newtab"); |
1028 | } | 1029 | } |
1029 | /* Side bars. */ { | 1030 | /* Side bars. */ { |
@@ -1064,7 +1065,7 @@ static void setupUserInterface_Window(iWindow *d) { | |||
1064 | "find.input"); | 1065 | "find.input"); |
1065 | addChild_Widget(searchBar, iClob(newIcon_LabelWidget(" \u2b9f ", 'g', KMOD_PRIMARY, "find.next"))); | 1066 | addChild_Widget(searchBar, iClob(newIcon_LabelWidget(" \u2b9f ", 'g', KMOD_PRIMARY, "find.next"))); |
1066 | addChild_Widget(searchBar, iClob(newIcon_LabelWidget(" \u2b9d ", 'g', KMOD_PRIMARY | KMOD_SHIFT, "find.prev"))); | 1067 | addChild_Widget(searchBar, iClob(newIcon_LabelWidget(" \u2b9d ", 'g', KMOD_PRIMARY | KMOD_SHIFT, "find.prev"))); |
1067 | addChild_Widget(searchBar, iClob(newIcon_LabelWidget("\u2a2f", SDLK_ESCAPE, 0, "find.close"))); | 1068 | addChild_Widget(searchBar, iClob(newIcon_LabelWidget(close_Icon, SDLK_ESCAPE, 0, "find.close"))); |
1068 | } | 1069 | } |
1069 | #if defined (iPlatformAppleMobile) | 1070 | #if defined (iPlatformAppleMobile) |
1070 | /* Bottom toolbar. */ | 1071 | /* Bottom toolbar. */ |
@@ -1094,7 +1095,7 @@ static void setupUserInterface_Window(iWindow *d) { | |||
1094 | const iMenuItem items[] = { | 1095 | const iMenuItem items[] = { |
1095 | { "\U0001f588 Bookmarks", 0, 0, "toolbar.showview arg:0" }, | 1096 | { "\U0001f588 Bookmarks", 0, 0, "toolbar.showview arg:0" }, |
1096 | { "\U00002605 Feeds", 0, 0, "toolbar.showview arg:1" }, | 1097 | { "\U00002605 Feeds", 0, 0, "toolbar.showview arg:1" }, |
1097 | { "\U0001f553 History", 0, 0, "toolbar.showview arg:2" }, | 1098 | { clock_Icon " History", 0, 0, "toolbar.showview arg:2" }, |
1098 | { "\U0001f5b9 Page Outline", 0, 0, "toolbar.showview arg:4" }, | 1099 | { "\U0001f5b9 Page Outline", 0, 0, "toolbar.showview arg:4" }, |
1099 | }; | 1100 | }; |
1100 | iWidget *menu = makeMenu_Widget(findChild_Widget(toolBar, "toolbar.view"), | 1101 | iWidget *menu = makeMenu_Widget(findChild_Widget(toolBar, "toolbar.view"), |
@@ -1105,12 +1106,12 @@ static void setupUserInterface_Window(iWindow *d) { | |||
1105 | updatePadding_Window_(d); | 1106 | updatePadding_Window_(d); |
1106 | iWidget *tabsMenu = makeMenu_Widget(d->root, | 1107 | iWidget *tabsMenu = makeMenu_Widget(d->root, |
1107 | (iMenuItem[]){ | 1108 | (iMenuItem[]){ |
1108 | { "Close Tab", 0, 0, "tabs.close" }, | 1109 | { close_Icon " Close Tab", 0, 0, "tabs.close" }, |
1109 | { "Duplicate Tab", 0, 0, "tabs.new duplicate:1" }, | 1110 | { copy_Icon " Duplicate Tab", 0, 0, "tabs.new duplicate:1" }, |
1110 | { "---", 0, 0, NULL }, | 1111 | { "---", 0, 0, NULL }, |
1111 | { "Close Other Tabs", 0, 0, "tabs.close toleft:1 toright:1" }, | 1112 | { "Close Other Tabs", 0, 0, "tabs.close toleft:1 toright:1" }, |
1112 | { "Close Tabs To Left", 0, 0, "tabs.close toleft:1" }, | 1113 | { barLeftArrow_Icon " Close Tabs To Left", 0, 0, "tabs.close toleft:1" }, |
1113 | { "Close Tabs To Right", 0, 0, "tabs.close toright:1" }, | 1114 | { barRightArrow_Icon " Close Tabs To Right", 0, 0, "tabs.close toright:1" }, |
1114 | }, | 1115 | }, |
1115 | 6); | 1116 | 6); |
1116 | setId_Widget(tabsMenu, "doctabs.menu"); | 1117 | setId_Widget(tabsMenu, "doctabs.menu"); |