diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2022-01-01 10:04:06 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2022-01-01 10:04:06 +0200 |
commit | 5d247c7fafddcb46d83572af788a04f835d48d42 (patch) | |
tree | 54205ac18a8c47cb50ef2d3ed7a42077512abfca /src | |
parent | 6b3d31a3043d99890355c42dd3248411fd571347 (diff) |
Mobile: User-configurable phone toolbar buttons
Actions for the first two mobile portrait phone toolbar buttons can be chosen in Settings.
Diffstat (limited to 'src')
-rw-r--r-- | src/app.c | 22 | ||||
-rw-r--r-- | src/defs.h | 17 | ||||
-rw-r--r-- | src/prefs.c | 2 | ||||
-rw-r--r-- | src/prefs.h | 1 | ||||
-rw-r--r-- | src/ui/mobile.c | 16 | ||||
-rw-r--r-- | src/ui/mobile.h | 11 | ||||
-rw-r--r-- | src/ui/root.c | 83 | ||||
-rw-r--r-- | src/ui/util.c | 13 |
8 files changed, 118 insertions, 47 deletions
@@ -248,6 +248,10 @@ static iString *serializePrefs_App_(const iApp *d) { | |||
248 | appendFormat_String(str, "linewidth.set arg:%d\n", d->prefs.lineWidth); | 248 | appendFormat_String(str, "linewidth.set arg:%d\n", d->prefs.lineWidth); |
249 | appendFormat_String(str, "linespacing.set arg:%f\n", d->prefs.lineSpacing); | 249 | appendFormat_String(str, "linespacing.set arg:%f\n", d->prefs.lineSpacing); |
250 | appendFormat_String(str, "returnkey.set arg:%d\n", d->prefs.returnKey); | 250 | appendFormat_String(str, "returnkey.set arg:%d\n", d->prefs.returnKey); |
251 | #if defined (iPlatformMobile) | ||
252 | appendFormat_String(str, "toolbar.action.set arg:%d button:0\n", d->prefs.toolbarActions[0]); | ||
253 | appendFormat_String(str, "toolbar.action.set arg:%d button:1\n", d->prefs.toolbarActions[1]); | ||
254 | #endif | ||
251 | iConstForEach(StringSet, fp, d->prefs.disabledFontPacks) { | 255 | iConstForEach(StringSet, fp, d->prefs.disabledFontPacks) { |
252 | appendFormat_String(str, "fontpack.disable id:%s\n", cstr_String(fp.value)); | 256 | appendFormat_String(str, "fontpack.disable id:%s\n", cstr_String(fp.value)); |
253 | } | 257 | } |
@@ -1870,6 +1874,12 @@ static void updatePrefsPinSplitButtons_(iWidget *d, int value) { | |||
1870 | } | 1874 | } |
1871 | } | 1875 | } |
1872 | 1876 | ||
1877 | static void updatePrefsToolBarActionButton_(iWidget *prefs, int buttonIndex, int action) { | ||
1878 | updateDropdownSelection_LabelWidget( | ||
1879 | findChild_Widget(prefs, format_CStr("prefs.toolbaraction%d", buttonIndex + 1)), | ||
1880 | format_CStr(" arg:%d button:%d", action, buttonIndex)); | ||
1881 | } | ||
1882 | |||
1873 | static void updateScrollSpeedButtons_(iWidget *d, enum iScrollType type, const int value) { | 1883 | static void updateScrollSpeedButtons_(iWidget *d, enum iScrollType type, const int value) { |
1874 | const char *typeStr = (type == mouse_ScrollType ? "mouse" : "keyboard"); | 1884 | const char *typeStr = (type == mouse_ScrollType ? "mouse" : "keyboard"); |
1875 | for (int i = 0; i <= 40; i++) { | 1885 | for (int i = 0; i <= 40; i++) { |
@@ -1960,6 +1970,10 @@ static iBool handlePrefsCommands_(iWidget *d, const char *cmd) { | |||
1960 | format_CStr("returnkey.set arg:%d", arg_Command(cmd))); | 1970 | format_CStr("returnkey.set arg:%d", arg_Command(cmd))); |
1961 | return iFalse; | 1971 | return iFalse; |
1962 | } | 1972 | } |
1973 | else if (equal_Command(cmd, "toolbar.action.set")) { | ||
1974 | updatePrefsToolBarActionButton_(d, argLabel_Command(cmd, "button"), arg_Command(cmd)); | ||
1975 | return iFalse; | ||
1976 | } | ||
1963 | else if (equal_Command(cmd, "pinsplit.set")) { | 1977 | else if (equal_Command(cmd, "pinsplit.set")) { |
1964 | updatePrefsPinSplitButtons_(d, arg_Command(cmd)); | 1978 | updatePrefsPinSplitButtons_(d, arg_Command(cmd)); |
1965 | return iFalse; | 1979 | return iFalse; |
@@ -2268,6 +2282,12 @@ iBool handleCommand_App(const char *cmd) { | |||
2268 | } | 2282 | } |
2269 | return iTrue; | 2283 | return iTrue; |
2270 | } | 2284 | } |
2285 | else if (equal_Command(cmd, "toolbar.action.set")) { | ||
2286 | d->prefs.toolbarActions[iClamp(argLabel_Command(cmd, "button"), 0, 1)] = | ||
2287 | iClamp(arg_Command(cmd), 0, max_ToolbarAction - 1); | ||
2288 | postCommand_App("~toolbar.actions.changed"); | ||
2289 | return iTrue; | ||
2290 | } | ||
2271 | else if (equal_Command(cmd, "translation.languages")) { | 2291 | else if (equal_Command(cmd, "translation.languages")) { |
2272 | d->prefs.langFrom = argLabel_Command(cmd, "from"); | 2292 | d->prefs.langFrom = argLabel_Command(cmd, "from"); |
2273 | d->prefs.langTo = argLabel_Command(cmd, "to"); | 2293 | d->prefs.langTo = argLabel_Command(cmd, "to"); |
@@ -3006,6 +3026,8 @@ iBool handleCommand_App(const char *cmd) { | |||
3006 | updateDropdownSelection_LabelWidget( | 3026 | updateDropdownSelection_LabelWidget( |
3007 | findChild_Widget(dlg, "prefs.returnkey"), | 3027 | findChild_Widget(dlg, "prefs.returnkey"), |
3008 | format_CStr("returnkey.set arg:%d", d->prefs.returnKey)); | 3028 | format_CStr("returnkey.set arg:%d", d->prefs.returnKey)); |
3029 | updatePrefsToolBarActionButton_(dlg, 0, d->prefs.toolbarActions[0]); | ||
3030 | updatePrefsToolBarActionButton_(dlg, 1, d->prefs.toolbarActions[1]); | ||
3009 | setToggle_Widget(findChild_Widget(dlg, "prefs.retainwindow"), d->prefs.retainWindowSize); | 3031 | setToggle_Widget(findChild_Widget(dlg, "prefs.retainwindow"), d->prefs.retainWindowSize); |
3010 | setText_InputWidget(findChild_Widget(dlg, "prefs.uiscale"), | 3032 | setText_InputWidget(findChild_Widget(dlg, "prefs.uiscale"), |
3011 | collectNewFormat_String("%g", uiScale_Window(as_Window(d->window)))); | 3033 | collectNewFormat_String("%g", uiScale_Window(as_Window(d->window)))); |
@@ -66,6 +66,23 @@ enum iReturnKeyFlag { | |||
66 | accept_ReturnKeyFlag = 4, /* shift */ | 66 | accept_ReturnKeyFlag = 4, /* shift */ |
67 | }; | 67 | }; |
68 | 68 | ||
69 | enum iToolbarAction { | ||
70 | back_ToolbarAction = 0, | ||
71 | forward_ToolbarAction = 1, | ||
72 | home_ToolbarAction = 2, | ||
73 | parent_ToolbarAction = 3, | ||
74 | reload_ToolbarAction = 4, | ||
75 | newTab_ToolbarAction = 5, | ||
76 | closeTab_ToolbarAction = 6, | ||
77 | addBookmark_ToolbarAction = 7, | ||
78 | translate_ToolbarAction = 8, | ||
79 | upload_ToolbarAction = 9, | ||
80 | editPage_ToolbarAction = 10, | ||
81 | findText_ToolbarAction = 11, | ||
82 | settings_ToolbarAction = 12, | ||
83 | max_ToolbarAction | ||
84 | }; | ||
85 | |||
69 | /* Return key behavior is not handled via normal bindings because only certain combinations | 86 | /* Return key behavior is not handled via normal bindings because only certain combinations |
70 | are valid. */ | 87 | are valid. */ |
71 | enum iReturnKeyBehavior { | 88 | enum iReturnKeyBehavior { |
diff --git a/src/prefs.c b/src/prefs.c index 6b0164b6..426b7212 100644 --- a/src/prefs.c +++ b/src/prefs.c | |||
@@ -44,6 +44,8 @@ void init_Prefs(iPrefs *d) { | |||
44 | d->uiAnimations = iTrue; | 44 | d->uiAnimations = iTrue; |
45 | d->uiScale = 1.0f; /* default set elsewhere */ | 45 | d->uiScale = 1.0f; /* default set elsewhere */ |
46 | d->zoomPercent = 100; | 46 | d->zoomPercent = 100; |
47 | d->toolbarActions[0] = back_ToolbarAction; | ||
48 | d->toolbarActions[1] = forward_ToolbarAction; | ||
47 | d->sideIcon = iTrue; | 49 | d->sideIcon = iTrue; |
48 | d->hideToolbarOnScroll = iTrue; | 50 | d->hideToolbarOnScroll = iTrue; |
49 | d->blinkingCursor = iTrue; | 51 | d->blinkingCursor = iTrue; |
diff --git a/src/prefs.h b/src/prefs.h index 6c79a3e1..43f7fc0e 100644 --- a/src/prefs.h +++ b/src/prefs.h | |||
@@ -159,6 +159,7 @@ struct Impl_Prefs { | |||
159 | enum iColorAccent accent; | 159 | enum iColorAccent accent; |
160 | /* Window and User Interface */ | 160 | /* Window and User Interface */ |
161 | float uiScale; | 161 | float uiScale; |
162 | enum iToolbarAction toolbarActions[2]; | ||
162 | /* Document presentation */ | 163 | /* Document presentation */ |
163 | int zoomPercent; | 164 | int zoomPercent; |
164 | /* Behavior */ | 165 | /* Behavior */ |
diff --git a/src/ui/mobile.c b/src/ui/mobile.c index 08d8dba2..e34cad3a 100644 --- a/src/ui/mobile.c +++ b/src/ui/mobile.c | |||
@@ -37,6 +37,22 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
37 | # include "ios.h" | 37 | # include "ios.h" |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | const iToolbarActionSpec toolbarActions_Mobile[max_ToolbarAction] = { | ||
41 | { backArrow_Icon, "${menu.back}", "navigate.back" }, | ||
42 | { forwardArrow_Icon, "${menu.forward}", "navigate.forward" }, | ||
43 | { home_Icon, "${menu.home}", "navigate.home" }, | ||
44 | { upArrow_Icon, "${menu.parent}", "navigate.parent" }, | ||
45 | { reload_Icon, "${menu.reload}", "navigate.reload" }, | ||
46 | { openTab_Icon, "${menu.newtab}", "tabs.new" }, | ||
47 | { close_Icon, "${menu.closetab}", "tabs.close" }, | ||
48 | { bookmark_Icon, "${menu.page.bookmark}", "bookmark.add" }, | ||
49 | { globe_Icon, "${menu.page.translate}", "document.translate" }, | ||
50 | { upload_Icon, "${menu.page.upload}", "document.upload" }, | ||
51 | { edit_Icon, "${menu.page.upload.edit}", "document.upload copy:1" }, | ||
52 | { magnifyingGlass_Icon, "${menu.find}", "focus.set id:find.input" }, | ||
53 | { gear_Icon, "${menu.settings}", "preferences" }, | ||
54 | }; | ||
55 | |||
40 | iBool isUsingPanelLayout_Mobile(void) { | 56 | iBool isUsingPanelLayout_Mobile(void) { |
41 | return deviceType_App() != desktop_AppDeviceType; | 57 | return deviceType_App() != desktop_AppDeviceType; |
42 | } | 58 | } |
diff --git a/src/ui/mobile.h b/src/ui/mobile.h index 54f55fd2..c19623f9 100644 --- a/src/ui/mobile.h +++ b/src/ui/mobile.h | |||
@@ -22,8 +22,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
22 | 22 | ||
23 | #pragma once | 23 | #pragma once |
24 | 24 | ||
25 | #include "defs.h" | ||
25 | #include <the_Foundation/rect.h> | 26 | #include <the_Foundation/rect.h> |
26 | 27 | ||
28 | iDeclareType(ToolbarActionSpec) | ||
29 | |||
30 | struct Impl_ToolbarActionSpec { | ||
31 | const char *icon; | ||
32 | const char *label; | ||
33 | const char *command; | ||
34 | }; | ||
35 | |||
36 | const iToolbarActionSpec toolbarActions_Mobile[max_ToolbarAction]; | ||
37 | |||
27 | iDeclareType(Widget) | 38 | iDeclareType(Widget) |
28 | iDeclareType(MenuItem) | 39 | iDeclareType(MenuItem) |
29 | 40 | ||
diff --git a/src/ui/root.c b/src/ui/root.c index bc2bc0fb..31176115 100644 --- a/src/ui/root.c +++ b/src/ui/root.c | |||
@@ -592,14 +592,21 @@ static void updateNavBarIdentity_(iWidget *navBar) { | |||
592 | 592 | ||
593 | static void updateNavDirButtons_(iWidget *navBar) { | 593 | static void updateNavDirButtons_(iWidget *navBar) { |
594 | const iHistory *history = history_DocumentWidget(document_App()); | 594 | const iHistory *history = history_DocumentWidget(document_App()); |
595 | const iBool atOldest = atOldest_History(history); | 595 | iBool atOldest = atOldest_History(history); |
596 | const iBool atNewest = atNewest_History(history); | 596 | iBool atNewest = atNewest_History(history); |
597 | setFlags_Widget(findChild_Widget(navBar, "navbar.back"), disabled_WidgetFlag, atOldest); | 597 | setFlags_Widget(findChild_Widget(navBar, "navbar.back"), disabled_WidgetFlag, atOldest); |
598 | setFlags_Widget(findChild_Widget(navBar, "navbar.forward"), disabled_WidgetFlag, atNewest); | 598 | setFlags_Widget(findChild_Widget(navBar, "navbar.forward"), disabled_WidgetFlag, atNewest); |
599 | iWidget *toolBar = findWidget_App("toolbar"); | 599 | iWidget *toolBar = findWidget_App("toolbar"); |
600 | if (toolBar) { | 600 | if (toolBar) { |
601 | iLabelWidget *back = findChild_Widget(toolBar, "toolbar.back"); | 601 | /* Reset the state. */ |
602 | iLabelWidget *fwd = findChild_Widget(toolBar, "toolbar.forward"); | 602 | for (int i = 0; i < 2; i++) { |
603 | const char *id = (i == 0 ? "toolbar.action1" : "toolbar.action2"); | ||
604 | setFlags_Widget(findChild_Widget(toolBar, id), disabled_WidgetFlag, iFalse); | ||
605 | setOutline_LabelWidget(findChild_Widget(toolBar, id), iFalse); | ||
606 | } | ||
607 | /* Disable certain actions. */ | ||
608 | iLabelWidget *back = findMenuItem_Widget(toolBar, "navigate.back"); | ||
609 | iLabelWidget *fwd = findMenuItem_Widget(toolBar, "navigate.forward"); | ||
603 | setFlags_Widget(as_Widget(back), disabled_WidgetFlag, atOldest); | 610 | setFlags_Widget(as_Widget(back), disabled_WidgetFlag, atOldest); |
604 | setOutline_LabelWidget(back, atOldest); | 611 | setOutline_LabelWidget(back, atOldest); |
605 | setFlags_Widget(as_Widget(fwd), disabled_WidgetFlag, atNewest); | 612 | setFlags_Widget(as_Widget(fwd), disabled_WidgetFlag, atNewest); |
@@ -1062,14 +1069,23 @@ static iBool handleSearchBarCommands_(iWidget *searchBar, const char *cmd) { | |||
1062 | } | 1069 | } |
1063 | 1070 | ||
1064 | #if defined (iPlatformMobile) | 1071 | #if defined (iPlatformMobile) |
1065 | static void dismissSidebar_(iWidget *sidebar, const char *toolButtonId) { | 1072 | |
1066 | if (isVisible_Widget(sidebar)) { | 1073 | static void updateToolBarActions_(iWidget *toolBar) { |
1067 | postCommandf_App("%s.toggle", cstr_String(id_Widget(sidebar))); | 1074 | const iPrefs *prefs = prefs_App(); |
1068 | // if (toolButtonId) { | 1075 | for (int i = 0; i < 2; i++) { |
1069 | // setFlags_Widget(findWidget_App(toolButtonId), noBackground_WidgetFlag, iTrue); | 1076 | int action = prefs->toolbarActions[i] |
1070 | // } | 1077 | ? prefs->toolbarActions[i] |
1071 | setVisualOffset_Widget(sidebar, height_Widget(sidebar), 250, easeIn_AnimFlag); | 1078 | : (i == 0 ? back_ToolbarAction : forward_ToolbarAction); |
1079 | iLabelWidget *button = | ||
1080 | findChild_Widget(toolBar, i == 0 ? "toolbar.action1" : "toolbar.action2"); | ||
1081 | if (button) { | ||
1082 | setFlags_Widget(as_Widget(button), disabled_WidgetFlag, iFalse); | ||
1083 | setOutline_LabelWidget(button, iFalse); | ||
1084 | updateTextCStr_LabelWidget(button, toolbarActions_Mobile[action].icon); | ||
1085 | setCommand_LabelWidget(button, collectNewCStr_String(toolbarActions_Mobile[action].command)); | ||
1086 | } | ||
1072 | } | 1087 | } |
1088 | refresh_Widget(toolBar); | ||
1073 | } | 1089 | } |
1074 | 1090 | ||
1075 | static iBool handleToolBarCommands_(iWidget *toolBar, const char *cmd) { | 1091 | static iBool handleToolBarCommands_(iWidget *toolBar, const char *cmd) { |
@@ -1081,13 +1097,6 @@ static iBool handleToolBarCommands_(iWidget *toolBar, const char *cmd) { | |||
1081 | return iTrue; | 1097 | return iTrue; |
1082 | } | 1098 | } |
1083 | else if (equal_Command(cmd, "toolbar.showview")) { | 1099 | else if (equal_Command(cmd, "toolbar.showview")) { |
1084 | /* TODO: Clean this up. */ | ||
1085 | // iWidget *sidebar = findWidget_App("sidebar"); | ||
1086 | // iWidget *sidebar2 = findWidget_App("sidebar2"); | ||
1087 | // dismissSidebar_(sidebar2, "toolbar.ident"); | ||
1088 | // const iBool isVisible = isVisible_Widget(sidebar); | ||
1089 | /* If a sidebar hasn't been shown yet, it's height is zero. */ | ||
1090 | // const int viewHeight = size_Root(get_Root()).y; | ||
1091 | if (arg_Command(cmd) >= 0) { | 1100 | if (arg_Command(cmd) >= 0) { |
1092 | postCommandf_App("sidebar.mode arg:%d show:1", arg_Command(cmd)); | 1101 | postCommandf_App("sidebar.mode arg:%d show:1", arg_Command(cmd)); |
1093 | } | 1102 | } |
@@ -1102,29 +1111,6 @@ static iBool handleToolBarCommands_(iWidget *toolBar, const char *cmd) { | |||
1102 | postCommandf_App("sidebar.toggle"); | 1111 | postCommandf_App("sidebar.toggle"); |
1103 | } | 1112 | } |
1104 | postCommand_App("preferences idents:1"); | 1113 | postCommand_App("preferences idents:1"); |
1105 | #if 0 | ||
1106 | /* TODO: Clean this up. */ | ||
1107 | iWidget *sidebar2 = findWidget_App("sidebar2"); | ||
1108 | //dismissSidebar_(sidebar, "toolbar.view"); | ||
1109 | if (isVisible_Widget(sidebar)) { | ||
1110 | postCommandf_App("sidebar.toggle"); | ||
1111 | } | ||
1112 | const iBool isVisible = isVisible_Widget(sidebar2); | ||
1113 | // setFlags_Widget(findChild_Widget(toolBar, "toolbar.ident"), noBackground_WidgetFlag, | ||
1114 | // isVisible); | ||
1115 | /* If a sidebar hasn't been shown yet, it's height is zero. */ | ||
1116 | const int viewHeight = size_Root(get_Root()).y; | ||
1117 | if (isVisible) { | ||
1118 | dismissSidebar_(sidebar2, NULL); | ||
1119 | } | ||
1120 | else { | ||
1121 | postCommand_App("sidebar2.mode arg:3 show:1"); | ||
1122 | int offset = height_Widget(sidebar2); | ||
1123 | if (offset == 0) offset = size_Root(get_Root()).y; | ||
1124 | setVisualOffset_Widget(sidebar2, offset, 0, 0); | ||
1125 | setVisualOffset_Widget(sidebar2, 0, 400, easeOut_AnimFlag | softer_AnimFlag); | ||
1126 | } | ||
1127 | #endif | ||
1128 | return iTrue; | 1114 | return iTrue; |
1129 | } | 1115 | } |
1130 | else if (equal_Command(cmd, "sidebar.mode.changed")) { | 1116 | else if (equal_Command(cmd, "sidebar.mode.changed")) { |
@@ -1132,8 +1118,13 @@ static iBool handleToolBarCommands_(iWidget *toolBar, const char *cmd) { | |||
1132 | updateTextCStr_LabelWidget(viewTool, icon_SidebarMode(arg_Command(cmd))); | 1118 | updateTextCStr_LabelWidget(viewTool, icon_SidebarMode(arg_Command(cmd))); |
1133 | return iFalse; | 1119 | return iFalse; |
1134 | } | 1120 | } |
1121 | else if (equal_Command(cmd, "toolbar.actions.changed")) { | ||
1122 | updateToolBarActions_(toolBar); | ||
1123 | return iFalse; | ||
1124 | } | ||
1135 | return iFalse; | 1125 | return iFalse; |
1136 | } | 1126 | } |
1127 | |||
1137 | #endif /* defined (iPlatformMobile) */ | 1128 | #endif /* defined (iPlatformMobile) */ |
1138 | 1129 | ||
1139 | static iLabelWidget *newLargeIcon_LabelWidget(const char *text, const char *cmd) { | 1130 | static iLabelWidget *newLargeIcon_LabelWidget(const char *text, const char *cmd) { |
@@ -1552,14 +1543,14 @@ void createUserInterface_Root(iRoot *d) { | |||
1552 | "toolbar.close"); | 1543 | "toolbar.close"); |
1553 | #else | 1544 | #else |
1554 | setId_Widget(addChildFlags_Widget(toolBar, | 1545 | setId_Widget(addChildFlags_Widget(toolBar, |
1555 | iClob(newLargeIcon_LabelWidget(backArrow_Icon, "navigate.back")), | 1546 | iClob(newLargeIcon_LabelWidget("", "...")), |
1556 | frameless_WidgetFlag), | 1547 | frameless_WidgetFlag), |
1557 | "toolbar.back"); | 1548 | "toolbar.action1"); |
1558 | #endif | 1549 | #endif |
1559 | setId_Widget(addChildFlags_Widget(toolBar, | 1550 | setId_Widget(addChildFlags_Widget(toolBar, |
1560 | iClob(newLargeIcon_LabelWidget(forwardArrow_Icon, "navigate.forward")), | 1551 | iClob(newLargeIcon_LabelWidget("", "...")), |
1561 | frameless_WidgetFlag), | 1552 | frameless_WidgetFlag), |
1562 | "toolbar.forward"); | 1553 | "toolbar.action2"); |
1563 | iWidget *identButton; | 1554 | iWidget *identButton; |
1564 | setId_Widget(identButton = addChildFlags_Widget( | 1555 | setId_Widget(identButton = addChildFlags_Widget( |
1565 | toolBar, | 1556 | toolBar, |
@@ -1589,10 +1580,10 @@ void createUserInterface_Root(iRoot *d) { | |||
1589 | setId_Widget(as_Widget(menuButton), "toolbar.navmenu"); | 1580 | setId_Widget(as_Widget(menuButton), "toolbar.navmenu"); |
1590 | addChildFlags_Widget(toolBar, iClob(menuButton), frameless_WidgetFlag); | 1581 | addChildFlags_Widget(toolBar, iClob(menuButton), frameless_WidgetFlag); |
1591 | iForEach(ObjectList, i, children_Widget(toolBar)) { | 1582 | iForEach(ObjectList, i, children_Widget(toolBar)) { |
1592 | iLabelWidget *btn = i.object; | ||
1593 | setFlags_Widget(i.object, noBackground_WidgetFlag, iTrue); | 1583 | setFlags_Widget(i.object, noBackground_WidgetFlag, iTrue); |
1594 | } | 1584 | } |
1595 | updateToolbarColors_Root(d); | 1585 | updateToolbarColors_Root(d); |
1586 | updateToolBarActions_(toolBar); | ||
1596 | const iMenuItem items[] = { | 1587 | const iMenuItem items[] = { |
1597 | { book_Icon " ${sidebar.bookmarks}", 0, 0, "toolbar.showview arg:0" }, | 1588 | { book_Icon " ${sidebar.bookmarks}", 0, 0, "toolbar.showview arg:0" }, |
1598 | { star_Icon " ${sidebar.feeds}", 0, 0, "toolbar.showview arg:1" }, | 1589 | { star_Icon " ${sidebar.feeds}", 0, 0, "toolbar.showview arg:1" }, |
diff --git a/src/ui/util.c b/src/ui/util.c index ab7e9ebf..6add5c89 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -2383,6 +2383,15 @@ iWidget *makePreferences_Widget(void) { | |||
2383 | format_CStr("returnkey.set arg:%d", acceptWithPrimaryMod_ReturnKeyBehavior) }, | 2383 | format_CStr("returnkey.set arg:%d", acceptWithPrimaryMod_ReturnKeyBehavior) }, |
2384 | { NULL } | 2384 | { NULL } |
2385 | }; | 2385 | }; |
2386 | iMenuItem toolbarActionItems[2][max_ToolbarAction + 1]; | ||
2387 | iZap(toolbarActionItems); | ||
2388 | for (int j = 0; j < 2; j++) { | ||
2389 | for (int i = 0; i < max_ToolbarAction; i++) { | ||
2390 | toolbarActionItems[j][i].label = toolbarActions_Mobile[i].label; | ||
2391 | toolbarActionItems[j][i].command = | ||
2392 | format_CStr("toolbar.action.set arg:%d button:%d", i, j); | ||
2393 | } | ||
2394 | } | ||
2386 | iMenuItem docThemes[2][max_GmDocumentTheme + 1]; | 2395 | iMenuItem docThemes[2][max_GmDocumentTheme + 1]; |
2387 | for (int i = 0; i < 2; ++i) { | 2396 | for (int i = 0; i < 2; ++i) { |
2388 | const iBool isDark = (i == 0); | 2397 | const iBool isDark = (i == 0); |
@@ -2476,8 +2485,10 @@ iWidget *makePreferences_Widget(void) { | |||
2476 | { "title id:heading.prefs.interface" }, | 2485 | { "title id:heading.prefs.interface" }, |
2477 | { "dropdown device:0 id:prefs.returnkey", 0, 0, (const void *) returnKeyBehaviors }, | 2486 | { "dropdown device:0 id:prefs.returnkey", 0, 0, (const void *) returnKeyBehaviors }, |
2478 | { "padding device:1" }, | 2487 | { "padding device:1" }, |
2479 | //{ "toggle id:prefs.hoverlink" }, | ||
2480 | { "toggle device:2 id:prefs.hidetoolbarscroll" }, | 2488 | { "toggle device:2 id:prefs.hidetoolbarscroll" }, |
2489 | { "heading device:2 id:heading.prefs.toolbaractions" }, | ||
2490 | { "dropdown device:2 id:prefs.toolbaraction1", 0, 0, (const void *) toolbarActionItems[0] }, | ||
2491 | { "dropdown device:2 id:prefs.toolbaraction2", 0, 0, (const void *) toolbarActionItems[1] }, | ||
2481 | { "heading id:heading.prefs.sizing" }, | 2492 | { "heading id:heading.prefs.sizing" }, |
2482 | { "input id:prefs.uiscale maxlen:8" }, | 2493 | { "input id:prefs.uiscale maxlen:8" }, |
2483 | { NULL } | 2494 | { NULL } |