diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-04 22:34:31 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-04 22:34:31 +0300 |
commit | 7a4d9cc39337f93cb3b9e5bca982b04f0a7c7da5 (patch) | |
tree | 1e55a93e0e69b91d4b50c75ce581e03d6b54e229 /src/app.c | |
parent | d827dab6cdbc376b6d33cbe5924588e92cffcf54 (diff) |
Split view pinning, "linksplit" special tag
A navigation aid: when in split mode, option to keep one of the tabs pinned to the current page so all links open to the side.
Added "linksplit" bookmark tag to activate view splitting when opening a link on the page.
Diffstat (limited to 'src/app.c')
-rw-r--r-- | src/app.c | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -1446,6 +1446,14 @@ static void updatePrefsThemeButtons_(iWidget *d) { | |||
1446 | } | 1446 | } |
1447 | } | 1447 | } |
1448 | 1448 | ||
1449 | static void updatePrefsPinSplitButtons_(iWidget *d, int value) { | ||
1450 | for (size_t i = 0; i < 3; i++) { | ||
1451 | setFlags_Widget(findChild_Widget(d, format_CStr("prefs.pinsplit.%u", i)), | ||
1452 | selected_WidgetFlag, | ||
1453 | i == value); | ||
1454 | } | ||
1455 | } | ||
1456 | |||
1449 | static void updateDropdownSelection_(iLabelWidget *dropButton, const char *selectedCommand) { | 1457 | static void updateDropdownSelection_(iLabelWidget *dropButton, const char *selectedCommand) { |
1450 | iWidget *menu = findChild_Widget(as_Widget(dropButton), "menu"); | 1458 | iWidget *menu = findChild_Widget(as_Widget(dropButton), "menu"); |
1451 | iForEach(ObjectList, i, children_Widget(menu)) { | 1459 | iForEach(ObjectList, i, children_Widget(menu)) { |
@@ -1526,6 +1534,10 @@ static iBool handlePrefsCommands_(iWidget *d, const char *cmd) { | |||
1526 | setFlags_Widget(findChild_Widget(d, "prefs.quoteicon.1"), selected_WidgetFlag, arg == 1); | 1534 | setFlags_Widget(findChild_Widget(d, "prefs.quoteicon.1"), selected_WidgetFlag, arg == 1); |
1527 | return iFalse; | 1535 | return iFalse; |
1528 | } | 1536 | } |
1537 | else if (equal_Command(cmd, "pinsplit.set")) { | ||
1538 | updatePrefsPinSplitButtons_(d, arg_Command(cmd)); | ||
1539 | return iFalse; | ||
1540 | } | ||
1529 | else if (equal_Command(cmd, "doctheme.dark.set")) { | 1541 | else if (equal_Command(cmd, "doctheme.dark.set")) { |
1530 | updateColorThemeButton_(findChild_Widget(d, "prefs.doctheme.dark"), arg_Command(cmd)); | 1542 | updateColorThemeButton_(findChild_Widget(d, "prefs.doctheme.dark"), arg_Command(cmd)); |
1531 | return iFalse; | 1543 | return iFalse; |
@@ -1824,6 +1836,10 @@ iBool handleCommand_App(const char *cmd) { | |||
1824 | } | 1836 | } |
1825 | return iTrue; | 1837 | return iTrue; |
1826 | } | 1838 | } |
1839 | else if (equal_Command(cmd, "pinsplit.set")) { | ||
1840 | d->prefs.pinSplit = arg_Command(cmd); | ||
1841 | return iTrue; | ||
1842 | } | ||
1827 | else if (equal_Command(cmd, "theme.set")) { | 1843 | else if (equal_Command(cmd, "theme.set")) { |
1828 | const int isAuto = argLabel_Command(cmd, "auto"); | 1844 | const int isAuto = argLabel_Command(cmd, "auto"); |
1829 | d->prefs.theme = arg_Command(cmd); | 1845 | d->prefs.theme = arg_Command(cmd); |
@@ -2030,6 +2046,7 @@ iBool handleCommand_App(const char *cmd) { | |||
2030 | iRoot *oldRoot = root; | 2046 | iRoot *oldRoot = root; |
2031 | if (newTab & otherRoot_OpenTabFlag) { | 2047 | if (newTab & otherRoot_OpenTabFlag) { |
2032 | root = otherRoot_Window(d->window, root); | 2048 | root = otherRoot_Window(d->window, root); |
2049 | setKeyRoot_Window(d->window, root); | ||
2033 | setCurrent_Root(root); /* need to change for widget creation */ | 2050 | setCurrent_Root(root); /* need to change for widget creation */ |
2034 | } | 2051 | } |
2035 | iDocumentWidget *doc = document_Command(cmd); | 2052 | iDocumentWidget *doc = document_Command(cmd); |
@@ -2172,6 +2189,7 @@ iBool handleCommand_App(const char *cmd) { | |||
2172 | setToggle_Widget(findChild_Widget(dlg, "prefs.archive.openindex"), d->prefs.openArchiveIndexPages); | 2189 | setToggle_Widget(findChild_Widget(dlg, "prefs.archive.openindex"), d->prefs.openArchiveIndexPages); |
2173 | setToggle_Widget(findChild_Widget(dlg, "prefs.ostheme"), d->prefs.useSystemTheme); | 2190 | setToggle_Widget(findChild_Widget(dlg, "prefs.ostheme"), d->prefs.useSystemTheme); |
2174 | setToggle_Widget(findChild_Widget(dlg, "prefs.customframe"), d->prefs.customFrame); | 2191 | setToggle_Widget(findChild_Widget(dlg, "prefs.customframe"), d->prefs.customFrame); |
2192 | updatePrefsPinSplitButtons_(dlg, d->prefs.pinSplit); | ||
2175 | updateDropdownSelection_(findChild_Widget(dlg, "prefs.uilang"), cstr_String(&d->prefs.uiLanguage)); | 2193 | updateDropdownSelection_(findChild_Widget(dlg, "prefs.uilang"), cstr_String(&d->prefs.uiLanguage)); |
2176 | setToggle_Widget(findChild_Widget(dlg, "prefs.retainwindow"), d->prefs.retainWindowSize); | 2194 | setToggle_Widget(findChild_Widget(dlg, "prefs.retainwindow"), d->prefs.retainWindowSize); |
2177 | setText_InputWidget(findChild_Widget(dlg, "prefs.uiscale"), | 2195 | setText_InputWidget(findChild_Widget(dlg, "prefs.uiscale"), |
@@ -2234,7 +2252,8 @@ iBool handleCommand_App(const char *cmd) { | |||
2234 | } | 2252 | } |
2235 | else if (equal_Command(cmd, "navigate.home")) { | 2253 | else if (equal_Command(cmd, "navigate.home")) { |
2236 | /* Look for bookmarks tagged "homepage". */ | 2254 | /* Look for bookmarks tagged "homepage". */ |
2237 | iRegExp *pattern = iClob(new_RegExp("\\bhomepage\\b", caseInsensitive_RegExpOption)); | 2255 | iRegExp *pattern = iClob(new_RegExp("\\b" homepage_BookmarkTag "\\b", |
2256 | caseInsensitive_RegExpOption)); | ||
2238 | const iPtrArray *homepages = | 2257 | const iPtrArray *homepages = |
2239 | list_Bookmarks(d->bookmarks, NULL, filterTagsRegExp_Bookmarks, pattern); | 2258 | list_Bookmarks(d->bookmarks, NULL, filterTagsRegExp_Bookmarks, pattern); |
2240 | if (isEmpty_PtrArray(homepages)) { | 2259 | if (isEmpty_PtrArray(homepages)) { |