summaryrefslogtreecommitdiff
path: root/src/app.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/app.c')
-rw-r--r--src/app.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/app.c b/src/app.c
index 58eecf51..1e66c6cf 100644
--- a/src/app.c
+++ b/src/app.c
@@ -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
1877static 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
1873static void updateScrollSpeedButtons_(iWidget *d, enum iScrollType type, const int value) { 1883static 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))));