diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-11 08:34:14 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-11 08:34:14 +0300 |
commit | e08bf8f56c078ba0e5c2aa363c43ea5db3561aa2 (patch) | |
tree | 6fbe657e55d531988e184b289275e5599ba2d4e4 /src/ui/window.c | |
parent | 44b1f58bb25817d2bc4578e727ce637752d00299 (diff) |
Mobile: Long press to select; navbar page menu
DocumentWidget now supports a long-press drag selection mode. The context menu was moved to the URL bar, replacing the reload button.
Diffstat (limited to 'src/ui/window.c')
-rw-r--r-- | src/ui/window.c | 45 |
1 files changed, 38 insertions, 7 deletions
diff --git a/src/ui/window.c b/src/ui/window.c index d00d19a7..0a5bab6f 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -362,7 +362,8 @@ static const iMenuItem identityButtonMenuItems_[] = { | |||
362 | }; | 362 | }; |
363 | #endif | 363 | #endif |
364 | 364 | ||
365 | static const char *reloadCStr_ = reload_Icon; | 365 | static const char *reloadCStr_ = reload_Icon; |
366 | static const char *pageMenuCStr_ = midEllipsis_Icon; | ||
366 | 367 | ||
367 | /* TODO: A preference for these, maybe? */ | 368 | /* TODO: A preference for these, maybe? */ |
368 | static const char *stopSeqCStr_[] = { | 369 | static const char *stopSeqCStr_[] = { |
@@ -476,8 +477,14 @@ static uint32_t updateReloadAnimation_Window_(uint32_t interval, void *window) { | |||
476 | } | 477 | } |
477 | 478 | ||
478 | static void setReloadLabel_Window_(iWindow *d, iBool animating) { | 479 | static void setReloadLabel_Window_(iWindow *d, iBool animating) { |
480 | const iBool isMobile = deviceType_App() != desktop_AppDeviceType; | ||
479 | iLabelWidget *label = findChild_Widget(d->root, "reload"); | 481 | iLabelWidget *label = findChild_Widget(d->root, "reload"); |
480 | updateTextCStr_LabelWidget(label, animating ? loadAnimationCStr_() : reloadCStr_); | 482 | updateTextCStr_LabelWidget(label, animating ? loadAnimationCStr_() : |
483 | (isMobile ? pageMenuCStr_ : reloadCStr_)); | ||
484 | if (isMobile) { | ||
485 | setCommand_LabelWidget(label, | ||
486 | collectNewCStr_String(animating ? "navigate.reload" : "menu.open")); | ||
487 | } | ||
481 | } | 488 | } |
482 | 489 | ||
483 | static void checkLoadAnimation_Window_(iWindow *d) { | 490 | static void checkLoadAnimation_Window_(iWindow *d) { |
@@ -1047,11 +1054,35 @@ static void setupUserInterface_Window(iWindow *d) { | |||
1047 | addChildFlags_Widget( | 1054 | addChildFlags_Widget( |
1048 | rightEmbed, iClob(progress), collapse_WidgetFlag); | 1055 | rightEmbed, iClob(progress), collapse_WidgetFlag); |
1049 | } | 1056 | } |
1050 | /* Reload button. */ | 1057 | /* Reload button. */ { |
1051 | iLabelWidget *reload = newIcon_LabelWidget(reloadCStr_, 0, 0, "navigate.reload"); | 1058 | iLabelWidget *reload; |
1052 | setId_Widget(as_Widget(reload), "reload"); | 1059 | if (deviceType_App() == desktop_AppDeviceType) { |
1053 | addChildFlags_Widget(as_Widget(url), iClob(reload), embedFlags | moveToParentRightEdge_WidgetFlag); | 1060 | reload = newIcon_LabelWidget(reloadCStr_, 0, 0, "navigate.reload"); |
1054 | updateSize_LabelWidget(reload); | 1061 | } |
1062 | else { | ||
1063 | /* In a mobile layout, the reload button is replaced with the Page/Ellipsis menu. */ | ||
1064 | reload = makeMenuButton_LabelWidget(pageMenuCStr_, | ||
1065 | (iMenuItem[]){ | ||
1066 | { reload_Icon " ${menu.reload}", reload_KeyShortcut, "navigate.reload" }, | ||
1067 | { timer_Icon " ${menu.autoreload}", 0, 0, "document.autoreload.menu" }, | ||
1068 | { "---", 0, 0, NULL }, | ||
1069 | { upArrow_Icon " ${menu.parent}", navigateParent_KeyShortcut, "navigate.parent" }, | ||
1070 | { upArrowBar_Icon " ${menu.root}", navigateRoot_KeyShortcut, "navigate.root" }, | ||
1071 | { "---", 0, 0, NULL }, | ||
1072 | { pin_Icon " ${menu.page.bookmark}", SDLK_d, KMOD_PRIMARY, "bookmark.add" }, | ||
1073 | { star_Icon " ${menu.page.subscribe}", subscribeToPage_KeyModifier, "feeds.subscribe" }, | ||
1074 | { book_Icon " ${menu.page.import}", 0, 0, "bookmark.links confirm:1" }, | ||
1075 | { globe_Icon " ${menu.page.translate}", 0, 0, "document.translate" }, | ||
1076 | { "---", 0, 0, NULL }, | ||
1077 | { "${menu.page.copyurl}", 0, 0, "document.copylink" }, | ||
1078 | { "${menu.page.copysource}", 'c', KMOD_PRIMARY, "copy" }, | ||
1079 | { download_Icon " " saveToDownloads_Label, SDLK_s, KMOD_PRIMARY, "document.save" } }, | ||
1080 | 14); | ||
1081 | } | ||
1082 | setId_Widget(as_Widget(reload), "reload"); | ||
1083 | addChildFlags_Widget(as_Widget(url), iClob(reload), embedFlags | moveToParentRightEdge_WidgetFlag); | ||
1084 | updateSize_LabelWidget(reload); | ||
1085 | } | ||
1055 | setId_Widget(addChild_Widget(rightEmbed, iClob(makePadding_Widget(0))), "url.embedpad"); | 1086 | setId_Widget(addChild_Widget(rightEmbed, iClob(makePadding_Widget(0))), "url.embedpad"); |
1056 | } | 1087 | } |
1057 | if (deviceType_App() != desktop_AppDeviceType) { | 1088 | if (deviceType_App() != desktop_AppDeviceType) { |