Lagrange [work/v1.12]

Preferences: Toggles for bottom URL/tab bar

=> bedc25f4768de383dbf7499f37fe507a12bf2d2b

diff --git a/po/en.po b/po/en.po
index ed71969f..98f0c66f 100644
--- a/po/en.po
+++ b/po/en.po
@@ -1488,6 +1488,12 @@ msgstr "Mouse speed:"
 msgid "prefs.imageloadscroll"
 msgstr "Load image on scroll:"
 
+msgid "prefs.bottomnavbar"
+msgstr "Bottom URL bar:"
+
+msgid "prefs.bottomtabbar"
+msgstr "Bottom tab bar:"
+
 msgid "prefs.hidetoolbarscroll"
 msgstr "Hide toolbar on scroll:"
 
diff --git a/res/lang/cs.bin b/res/lang/cs.bin
index 1de4317f..79cb1322 100644
Binary files a/res/lang/cs.bin and b/res/lang/cs.bin differ
diff --git a/res/lang/de.bin b/res/lang/de.bin
index 17c255e3..ec16891d 100644
Binary files a/res/lang/de.bin and b/res/lang/de.bin differ
diff --git a/res/lang/en.bin b/res/lang/en.bin
index 2bb19132..61ef9a97 100644
Binary files a/res/lang/en.bin and b/res/lang/en.bin differ
diff --git a/res/lang/eo.bin b/res/lang/eo.bin
index 082e1cc7..db43e1ea 100644
Binary files a/res/lang/eo.bin and b/res/lang/eo.bin differ
diff --git a/res/lang/es.bin b/res/lang/es.bin
index 2448c4b3..263bcab3 100644
Binary files a/res/lang/es.bin and b/res/lang/es.bin differ
diff --git a/res/lang/es_MX.bin b/res/lang/es_MX.bin
index d3599643..159ada15 100644
Binary files a/res/lang/es_MX.bin and b/res/lang/es_MX.bin differ
diff --git a/res/lang/fi.bin b/res/lang/fi.bin
index 5ba3036c..fc880124 100644
Binary files a/res/lang/fi.bin and b/res/lang/fi.bin differ
diff --git a/res/lang/fr.bin b/res/lang/fr.bin
index 748df012..8821dc3e 100644
Binary files a/res/lang/fr.bin and b/res/lang/fr.bin differ
diff --git a/res/lang/gl.bin b/res/lang/gl.bin
index 5ca367b8..bc17a630 100644
Binary files a/res/lang/gl.bin and b/res/lang/gl.bin differ
diff --git a/res/lang/hu.bin b/res/lang/hu.bin
index e3a66fa7..44396a6a 100644
Binary files a/res/lang/hu.bin and b/res/lang/hu.bin differ
diff --git a/res/lang/ia.bin b/res/lang/ia.bin
index b5729329..d331f43c 100644
Binary files a/res/lang/ia.bin and b/res/lang/ia.bin differ
diff --git a/res/lang/ie.bin b/res/lang/ie.bin
index c77edf4e..736f0bb6 100644
Binary files a/res/lang/ie.bin and b/res/lang/ie.bin differ
diff --git a/res/lang/isv.bin b/res/lang/isv.bin
index cfa8ae56..9eda4753 100644
Binary files a/res/lang/isv.bin and b/res/lang/isv.bin differ
diff --git a/res/lang/it.bin b/res/lang/it.bin
index e4bebdcc..41ed0d17 100644
Binary files a/res/lang/it.bin and b/res/lang/it.bin differ
diff --git a/res/lang/nl.bin b/res/lang/nl.bin
index f321e65c..65558aa8 100644
Binary files a/res/lang/nl.bin and b/res/lang/nl.bin differ
diff --git a/res/lang/pl.bin b/res/lang/pl.bin
index 2608c0c1..9ac988c3 100644
Binary files a/res/lang/pl.bin and b/res/lang/pl.bin differ
diff --git a/res/lang/ru.bin b/res/lang/ru.bin
index 5a4660a1..4131bdc9 100644
Binary files a/res/lang/ru.bin and b/res/lang/ru.bin differ
diff --git a/res/lang/sk.bin b/res/lang/sk.bin
index e57ce550..8618c751 100644
Binary files a/res/lang/sk.bin and b/res/lang/sk.bin differ
diff --git a/res/lang/sr.bin b/res/lang/sr.bin
index 12002130..a833e10b 100644
Binary files a/res/lang/sr.bin and b/res/lang/sr.bin differ
diff --git a/res/lang/tok.bin b/res/lang/tok.bin
index e004ae0a..67a94f4e 100644
Binary files a/res/lang/tok.bin and b/res/lang/tok.bin differ
diff --git a/res/lang/tr.bin b/res/lang/tr.bin
index 8bb8ed73..0cd65722 100644
Binary files a/res/lang/tr.bin and b/res/lang/tr.bin differ
diff --git a/res/lang/uk.bin b/res/lang/uk.bin
index 82b409e8..e9cb06d4 100644
Binary files a/res/lang/uk.bin and b/res/lang/uk.bin differ
diff --git a/res/lang/zh_Hans.bin b/res/lang/zh_Hans.bin
index f922555f..f6a128e4 100644
Binary files a/res/lang/zh_Hans.bin and b/res/lang/zh_Hans.bin differ
diff --git a/res/lang/zh_Hant.bin b/res/lang/zh_Hant.bin
index 61626ffa..00a8a869 100644
Binary files a/res/lang/zh_Hant.bin and b/res/lang/zh_Hant.bin differ
diff --git a/src/app.c b/src/app.c
index fbd92a06..d33f31e1 100644
--- a/src/app.c
+++ b/src/app.c
@@ -1087,6 +1087,7 @@ static void init_App_(iApp *d, int argc, char **argv) {
     }
     postCommand_App("~navbar.actions.changed");
     postCommand_App("~toolbar.actions.changed");
+    postCommand_App("~root.movable");
     postCommand_App("~window.unfreeze");
     postCommand_App("font.reset");
     d->autoReloadTimer = SDL_AddTimer(60 * 1000, postAutoReloadCommand_App_, NULL);
@@ -2562,6 +2563,20 @@ iBool handleCommand_App(const char *cmd) {
         }
         return iTrue;        
     }
+    else if (equal_Command(cmd, "prefs.bottomnavbar.changed")) {
+        d->prefs.bottomNavBar = arg_Command(cmd) != 0;
+        if (!isFrozen) {
+            postCommand_App("~root.movable");
+        }
+        return iTrue;
+    }
+    else if (equal_Command(cmd, "prefs.bottomtabbar.changed")) {
+        d->prefs.bottomTabBar = arg_Command(cmd) != 0;
+        if (!isFrozen) {
+            postCommand_App("~root.movable");
+        }
+        return iTrue;
+    }
     else if (equal_Command(cmd, "translation.languages")) {
         d->prefs.langFrom = argLabel_Command(cmd, "from");
         d->prefs.langTo   = argLabel_Command(cmd, "to");
@@ -3365,6 +3380,8 @@ iBool handleCommand_App(const char *cmd) {
         setToggle_Widget(findChild_Widget(dlg, "prefs.ostheme"), d->prefs.useSystemTheme);
         setToggle_Widget(findChild_Widget(dlg, "prefs.customframe"), d->prefs.customFrame);
         setToggle_Widget(findChild_Widget(dlg, "prefs.animate"), d->prefs.uiAnimations);
+        setToggle_Widget(findChild_Widget(dlg, "prefs.bottomnavbar"), d->prefs.bottomNavBar);
+        setToggle_Widget(findChild_Widget(dlg, "prefs.bottomtabbar"), d->prefs.bottomTabBar);
         setToggle_Widget(findChild_Widget(dlg, "prefs.blink"), d->prefs.blinkingCursor);
         updatePrefsPinSplitButtons_(dlg, d->prefs.pinSplit);
         updateScrollSpeedButtons_(dlg, mouse_ScrollType, d->prefs.smoothScrollSpeed[mouse_ScrollType]);
diff --git a/src/prefs.c b/src/prefs.c
index 3ec7448a..f24c7a13 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 Jaakko Keränen 
+/* Copyright 2020-2022 Jaakko Keränen 
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
@@ -21,6 +21,7 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
 
 #include "prefs.h"
+#include "app.h"
 
 #include 
 #include 
@@ -58,8 +59,14 @@ void init_Prefs(iPrefs *d) {
     d->sideIcon          = iTrue;
     d->hideToolbarOnScroll = iTrue;
     d->blinkingCursor    = iTrue;
-    d->bottomNavBar      = iTrue;
-    d->bottomTabBar      = iTrue;
+    if (deviceType_App() == phone_AppDeviceType) {
+        d->bottomNavBar  = iTrue;
+        d->bottomTabBar  = iTrue;
+    }
+    else {
+        d->bottomNavBar  = iFalse;
+        d->bottomTabBar  = iFalse;        
+    }
     d->pinSplit          = 1;
     d->time24h           = iTrue;
     d->returnKey         = default_ReturnKeyBehavior;
diff --git a/src/ui/root.c b/src/ui/root.c
index 46d7f79d..7f96cc9f 100644
--- a/src/ui/root.c
+++ b/src/ui/root.c
@@ -547,6 +547,10 @@ static iBool handleRootCommands_(iWidget *root, const char *cmd) {
         root->root->pendingArrange = iFalse;
         return iTrue;
     }
+    else if (equal_Command(cmd, "root.movable")) {
+        setupMovableElements_Root_(root->root);
+        return iFalse; /* all roots must handle this */
+    }
     else if (equal_Command(cmd, "theme.changed")) {
         /* The phone toolbar is draw-buffered so it needs refreshing. */
         refresh_Widget(findWidget_App("toolbar"));
@@ -789,12 +793,8 @@ iBool isNarrow_Root(const iRoot *d) {
     return width_Rect(safeRect_Root(d)) / gap_UI < 140;
 }
 
-static void updateNavBarParent_(iWidget *navBar) {
-    /* The navbar can be */
-}
-
 static void updateNavBarSize_(iWidget *navBar) {
-    const iBool isPhone = deviceType_App() == phone_AppDeviceType;
+    const iBool isPhone  = deviceType_App() == phone_AppDeviceType;
     const iBool isNarrow = !isPhone && isNarrow_Root(navBar->root);
     /* Adjust navbar padding. */ {
         int hPad   = isPortraitPhone_App() ? 0 : isPhone || isNarrow ? gap_UI / 2 : (gap_UI * 3 / 2);
@@ -805,6 +805,9 @@ static void updateNavBarSize_(iWidget *navBar) {
             botPad += bottomSafeInset_Mobile();
             hPad += leftSafeInset_Mobile();
         }
+        if (!isPhone && prefs_App()->bottomNavBar) {
+            topPad = vPad / 2 - vPad / 3;
+        }
         setPadding_Widget(navBar, hPad, vPad / 3 + topPad, hPad, botPad);
     }
     /* Button sizing. */
diff --git a/src/ui/util.c b/src/ui/util.c
index 176d24c0..a6567016 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -2528,6 +2528,8 @@ iWidget *makePreferences_Widget(void) {
             { "title id:heading.prefs.interface" },
             { "dropdown device:0 id:prefs.returnkey", 0, 0, (const void *) returnKeyBehaviors },
             { "padding device:1" },
+            { "toggle id:prefs.bottomnavbar" },
+            { "toggle id:prefs.bottomtabbar" },
             { "toggle device:2 id:prefs.hidetoolbarscroll" },
             { "heading device:2 id:heading.prefs.toolbaractions" },
             { "dropdown device:2 id:prefs.toolbaraction1", 0, 0, (const void *) toolbarActionItems[0] },
@@ -2701,6 +2703,8 @@ iWidget *makePreferences_Widget(void) {
         setId_Widget(appendTwoColumnTabPage_Widget(tabs, "${heading.prefs.interface}", '2', &headings, &values),
                      "prefs.page.ui");
         addDialogToggle_(headings, values, "${prefs.animate}", "prefs.animate");
+        addDialogToggle_(headings, values, "${prefs.bottomnavbar}", "prefs.bottomnavbar");
+        addDialogToggle_(headings, values, "${prefs.bottomtabbar}", "prefs.bottomtabbar");
         addDialogToggle_(headings, values, "${prefs.blink}", "prefs.blink");
         addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.returnkey}")));
         /* Return key behaviors. */ {
@@ -2897,6 +2901,9 @@ iWidget *makePreferences_Widget(void) {
         addChildFlags_Widget(values, iClob(widths), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag);
         addPrefsInputWithHeading_(headings, values, "prefs.linespacing", iClob(new_InputWidget(5)));
         addDialogToggle_(headings, values, "${prefs.justify}", "prefs.justify");
+        addDialogToggle_(headings, values, "${prefs.plaintext.wrap}", "prefs.plaintext.wrap");
+        addDialogToggle_(headings, values, "${prefs.biglede}", "prefs.biglede");
+        addDialogPadding_(headings, values);
         addPrefsInputWithHeading_(headings, values, "prefs.tabwidth", iClob(new_InputWidget(5)));
         addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.quoteicon}")));
         iWidget *quote = new_Widget(); {
@@ -2904,7 +2911,6 @@ iWidget *makePreferences_Widget(void) {
             addRadioButton_(quote, "prefs.quoteicon.0", "${prefs.quoteicon.line}", "quoteicon.set arg:0");
         }
         addChildFlags_Widget(values, iClob(quote), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag);
-        addDialogToggle_(headings, values, "${prefs.biglede}", "prefs.biglede");
         addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.boldlink}")));
         iWidget *boldLink = new_Widget(); {
             /* TODO: Add a utility function for this type of toggles? (also for above) */
@@ -2926,11 +2932,10 @@ iWidget *makePreferences_Widget(void) {
             updateSize_LabelWidget((iLabelWidget *) tog);
         }
         addChildFlags_Widget(values, iClob(boldLink), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag);
-        addDialogToggle_(headings, values, "${prefs.plaintext.wrap}", "prefs.plaintext.wrap");
-        addDialogToggle_(headings, values, "${prefs.collapsepreonload}", "prefs.collapsepreonload");
         addDialogPadding_(headings, values);
         addDialogToggle_(headings, values, "${prefs.sideicon}", "prefs.sideicon");
         addDialogToggle_(headings, values, "${prefs.centershort}", "prefs.centershort");
+        addDialogToggle_(headings, values, "${prefs.collapsepreonload}", "prefs.collapsepreonload");
     }
     /* Network. */ {
         setId_Widget(appendTwoColumnTabPage_Widget(tabs, "${heading.prefs.network}", '6', &headings, &values), "prefs.page.network");
Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.12/cdiff/bedc25f4768de383dbf7499f37fe507a12bf2d2b
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
86.60334 milliseconds
Gemini-to-HTML Time
0.527875 milliseconds

This content has been proxied by September (ba2dc).