summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ui/mobile.c2
-rw-r--r--src/ui/mobile.h2
-rw-r--r--src/ui/util.c91
3 files changed, 41 insertions, 54 deletions
diff --git a/src/ui/mobile.c b/src/ui/mobile.c
index 48f17c9c..7e359a84 100644
--- a/src/ui/mobile.c
+++ b/src/ui/mobile.c
@@ -512,7 +512,7 @@ void makePanelItems_Mobile(iWidget *panel, const iMenuItem *itemsNullTerminated)
512 } 512 }
513} 513}
514 514
515iWidget *makeSplitMultiPanel_Mobile(const iMenuItem *itemsNullTerminated) { 515iWidget *makePanels_Mobile(const iMenuItem *itemsNullTerminated) {
516 /* A multipanel widget has a top panel and one or more detail panels. In a horizontal layout, 516 /* A multipanel widget has a top panel and one or more detail panels. In a horizontal layout,
517 the detail panels slide in from the right and cover the top panel. In a landscape layout, 517 the detail panels slide in from the right and cover the top panel. In a landscape layout,
518 the detail panels are always visible on the side. */ 518 the detail panels are always visible on the side. */
diff --git a/src/ui/mobile.h b/src/ui/mobile.h
index 50b89e32..5e2d8957 100644
--- a/src/ui/mobile.h
+++ b/src/ui/mobile.h
@@ -27,7 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
27iDeclareType(Widget) 27iDeclareType(Widget)
28iDeclareType(MenuItem) 28iDeclareType(MenuItem)
29 29
30iWidget * makeSplitMultiPanel_Mobile (const iMenuItem *itemsNullTerminated); 30iWidget * makePanels_Mobile (const iMenuItem *itemsNullTerminated);
31 31
32void setupMenuTransition_Mobile (iWidget *menu, iBool isIncoming); 32void setupMenuTransition_Mobile (iWidget *menu, iBool isIncoming);
33void setupSheetTransition_Mobile (iWidget *sheet, iBool isIncoming); 33void setupSheetTransition_Mobile (iWidget *sheet, iBool isIncoming);
diff --git a/src/ui/util.c b/src/ui/util.c
index 0d9338b5..22d8bce4 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -1617,11 +1617,23 @@ iInputWidget *addTwoColumnDialogInputField_Widget(iWidget *headings, iWidget *va
1617 return input; 1617 return input;
1618} 1618}
1619 1619
1620static void addDialogPadding_(iWidget *headings, iWidget *values) {
1621 const int bigGap = lineHeight_Text(uiLabel_FontId) * 3 / 4;
1622 addChild_Widget(headings, iClob(makePadding_Widget(bigGap)));
1623 addChild_Widget(values, iClob(makePadding_Widget(bigGap)));
1624}
1625
1620static void addPrefsInputWithHeading_(iWidget *headings, iWidget *values, 1626static void addPrefsInputWithHeading_(iWidget *headings, iWidget *values,
1621 const char *id, iInputWidget *input) { 1627 const char *id, iInputWidget *input) {
1622 addDialogInputWithHeading_(headings, values, format_CStr("${%s}", id), id, input); 1628 addDialogInputWithHeading_(headings, values, format_CStr("${%s}", id), id, input);
1623} 1629}
1624 1630
1631static void addDialogToggle_(iWidget *headings, iWidget *values,
1632 const char *heading, const char *toggleId) {
1633 addChild_Widget(headings, iClob(makeHeading_Widget(heading)));
1634 addChild_Widget(values, iClob(makeToggle_Widget(toggleId)));
1635}
1636
1625static size_t findWidestItemLabel_(const iMenuItem *items, size_t num) { 1637static size_t findWidestItemLabel_(const iMenuItem *items, size_t num) {
1626 int widest = 0; 1638 int widest = 0;
1627 size_t widestPos = iInvalidPos; 1639 size_t widestPos = iInvalidPos;
@@ -1830,9 +1842,9 @@ iWidget *makePreferences_Widget(void) {
1830 }; 1842 };
1831 iString *aboutText = collectNew_String(); { 1843 iString *aboutText = collectNew_String(); {
1832 setCStr_String(aboutText, "Lagrange " LAGRANGE_APP_VERSION); 1844 setCStr_String(aboutText, "Lagrange " LAGRANGE_APP_VERSION);
1833#if defined (iPlatformAppleMobile) 1845 #if defined (iPlatformAppleMobile)
1834 appendCStr_String(aboutText, " (" LAGRANGE_IOS_VERSION ")"); 1846 appendCStr_String(aboutText, " (" LAGRANGE_IOS_VERSION ")");
1835#endif 1847 #endif
1836 } 1848 }
1837 const iMenuItem aboutPanelItems[] = { 1849 const iMenuItem aboutPanelItems[] = {
1838 { format_CStr("heading text:%s", cstr_String(aboutText)) }, 1850 { format_CStr("heading text:%s", cstr_String(aboutText)) },
@@ -1842,8 +1854,8 @@ iWidget *makePreferences_Widget(void) {
1842 { "button text:" info_Icon " ${menu.aboutpages}", 0, 0, "!open url:about:about" }, 1854 { "button text:" info_Icon " ${menu.aboutpages}", 0, 0, "!open url:about:about" },
1843 { "button text:" bug_Icon " ${menu.debug}", 0, 0, "!open url:about:debug" }, 1855 { "button text:" bug_Icon " ${menu.debug}", 0, 0, "!open url:about:debug" },
1844 { NULL } 1856 { NULL }
1845 }; 1857 };
1846 const iMenuItem items[] = { 1858 iWidget *dlg = makePanels_Mobile((iMenuItem[]){
1847 { "panel icon:0x2699 id:heading.prefs.general", 0, 0, (const void *) generalPanelItems }, 1859 { "panel icon:0x2699 id:heading.prefs.general", 0, 0, (const void *) generalPanelItems },
1848 { "panel icon:0x1f5a7 id:heading.prefs.network", 0, 0, (const void *) networkPanelItems }, 1860 { "panel icon:0x1f5a7 id:heading.prefs.network", 0, 0, (const void *) networkPanelItems },
1849 { "panel text:" person_Icon " ${sidebar.identities}", 0, 0, (const void *) identityPanelItems }, 1861 { "panel text:" person_Icon " ${sidebar.identities}", 0, 0, (const void *) identityPanelItems },
@@ -1857,8 +1869,7 @@ iWidget *makePreferences_Widget(void) {
1857 { "padding" }, 1869 { "padding" },
1858 { "panel text:" planet_Icon " ${menu.about}", 0, 0, (const void *) aboutPanelItems }, 1870 { "panel text:" planet_Icon " ${menu.about}", 0, 0, (const void *) aboutPanelItems },
1859 { NULL } 1871 { NULL }
1860 }; 1872 });
1861 iWidget *dlg = makeSplitMultiPanel_Mobile(items);
1862 setupSheetTransition_Mobile(dlg, iTrue); 1873 setupSheetTransition_Mobile(dlg, iTrue);
1863 return dlg; 1874 return dlg;
1864 } 1875 }
@@ -1870,7 +1881,6 @@ iWidget *makePreferences_Widget(void) {
1870 setBackgroundColor_Widget(findChild_Widget(tabs, "tabs.buttons"), uiBackgroundSidebar_ColorId); 1881 setBackgroundColor_Widget(findChild_Widget(tabs, "tabs.buttons"), uiBackgroundSidebar_ColorId);
1871 setId_Widget(tabs, "prefs.tabs"); 1882 setId_Widget(tabs, "prefs.tabs");
1872 iWidget *headings, *values; 1883 iWidget *headings, *values;
1873 const int bigGap = lineHeight_Text(uiLabel_FontId) * 3 / 4;
1874 /* General preferences. */ { 1884 /* General preferences. */ {
1875 appendTwoColumnTabPage_Widget(tabs, "${heading.prefs.general}", '1', &headings, &values); 1885 appendTwoColumnTabPage_Widget(tabs, "${heading.prefs.general}", '1', &headings, &values);
1876#if defined (LAGRANGE_ENABLE_DOWNLOAD_EDIT) 1886#if defined (LAGRANGE_ENABLE_DOWNLOAD_EDIT)
@@ -1879,12 +1889,9 @@ iWidget *makePreferences_Widget(void) {
1879 iInputWidget *searchUrl; 1889 iInputWidget *searchUrl;
1880 addPrefsInputWithHeading_(headings, values, "prefs.searchurl", iClob(searchUrl = new_InputWidget(0))); 1890 addPrefsInputWithHeading_(headings, values, "prefs.searchurl", iClob(searchUrl = new_InputWidget(0)));
1881 setUrlContent_InputWidget(searchUrl, iTrue); 1891 setUrlContent_InputWidget(searchUrl, iTrue);
1882 addChild_Widget(headings, iClob(makePadding_Widget(bigGap))); 1892 addDialogPadding_(headings, values);
1883 addChild_Widget(values, iClob(makePadding_Widget(bigGap))); 1893 addDialogToggle_(headings, values, "${prefs.hoverlink}", "prefs.hoverlink");
1884 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.hoverlink}"))); 1894 addDialogToggle_(headings, values, "${prefs.archive.openindex}", "prefs.archive.openindex");
1885 addChild_Widget(values, iClob(makeToggle_Widget("prefs.hoverlink")));
1886 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.archive.openindex}")));
1887 addChild_Widget(values, iClob(makeToggle_Widget("prefs.archive.openindex")));
1888 if (deviceType_App() != phone_AppDeviceType) { 1895 if (deviceType_App() != phone_AppDeviceType) {
1889 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.pinsplit}"))); 1896 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.pinsplit}")));
1890 iWidget *pinSplit = new_Widget(); 1897 iWidget *pinSplit = new_Widget();
@@ -1895,8 +1902,7 @@ iWidget *makePreferences_Widget(void) {
1895 } 1902 }
1896 addChildFlags_Widget(values, iClob(pinSplit), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); 1903 addChildFlags_Widget(values, iClob(pinSplit), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag);
1897 } 1904 }
1898 addChild_Widget(headings, iClob(makePadding_Widget(bigGap))); 1905 addDialogPadding_(headings, values);
1899 addChild_Widget(values, iClob(makePadding_Widget(bigGap)));
1900 /* UI languages. */ { 1906 /* UI languages. */ {
1901 iArray *uiLangs = collectNew_Array(sizeof(iMenuItem)); 1907 iArray *uiLangs = collectNew_Array(sizeof(iMenuItem));
1902 pushBackN_Array(uiLangs, langItems, iElemCount(langItems) - 1); 1908 pushBackN_Array(uiLangs, langItems, iElemCount(langItems) - 1);
@@ -1915,8 +1921,7 @@ iWidget *makePreferences_Widget(void) {
1915 /* User Interface. */ { 1921 /* User Interface. */ {
1916 appendTwoColumnTabPage_Widget(tabs, "${heading.prefs.interface}", '2', &headings, &values); 1922 appendTwoColumnTabPage_Widget(tabs, "${heading.prefs.interface}", '2', &headings, &values);
1917#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME) 1923#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
1918 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.customframe}"))); 1924 addDialogToggle_(headings, values, "${prefs.customframe}", "prefs.customframe");
1919 addChild_Widget(values, iClob(makeToggle_Widget("prefs.customframe")));
1920#endif 1925#endif
1921 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.returnkey}"))); 1926 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.returnkey}")));
1922 /* Return key behaviors. */ { 1927 /* Return key behaviors. */ {
@@ -1931,11 +1936,9 @@ iWidget *makePreferences_Widget(void) {
1931 setId_Widget(addChildFlags_Widget(values, iClob(returnKey), alignLeft_WidgetFlag), 1936 setId_Widget(addChildFlags_Widget(values, iClob(returnKey), alignLeft_WidgetFlag),
1932 "prefs.returnkey"); 1937 "prefs.returnkey");
1933 } 1938 }
1934 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.animate}"))); 1939 addDialogToggle_(headings, values, "${prefs.animate}", "prefs.animate");
1935 addChild_Widget(values, iClob(makeToggle_Widget("prefs.animate")));
1936 makeTwoColumnHeading_("${heading.prefs.scrolling}", headings, values); 1940 makeTwoColumnHeading_("${heading.prefs.scrolling}", headings, values);
1937 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.smoothscroll}"))); 1941 addDialogToggle_(headings, values, "${prefs.smoothscroll}", "prefs.smoothscroll");
1938 addChild_Widget(values, iClob(makeToggle_Widget("prefs.smoothscroll")));
1939 /* Scroll speeds. */ { 1942 /* Scroll speeds. */ {
1940 for (int type = 0; type < max_ScrollType; type++) { 1943 for (int type = 0; type < max_ScrollType; type++) {
1941 const char *typeStr = (type == mouse_ScrollType ? "mouse" : "keyboard"); 1944 const char *typeStr = (type == mouse_ScrollType ? "mouse" : "keyboard");
@@ -1955,25 +1958,21 @@ iWidget *makePreferences_Widget(void) {
1955 values, iClob(scrollSpeed), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); 1958 values, iClob(scrollSpeed), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag);
1956 } 1959 }
1957 } 1960 }
1958 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.imageloadscroll}"))); 1961 addDialogToggle_(headings, values, "${prefs.imageloadscroll}", "prefs.imageloadscroll");
1959 addChild_Widget(values, iClob(makeToggle_Widget("prefs.imageloadscroll")));
1960 if (deviceType_App() == phone_AppDeviceType) { 1962 if (deviceType_App() == phone_AppDeviceType) {
1961 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.hidetoolbarscroll}"))); 1963 addDialogToggle_(headings, values, "${prefs.hidetoolbarscroll}", "prefs.hidetoolbarscroll");
1962 addChild_Widget(values, iClob(makeToggle_Widget("prefs.hidetoolbarscroll")));
1963 } 1964 }
1964 makeTwoColumnHeading_("${heading.prefs.sizing}", headings, values); 1965 makeTwoColumnHeading_("${heading.prefs.sizing}", headings, values);
1965 addPrefsInputWithHeading_(headings, values, "prefs.uiscale", iClob(new_InputWidget(8))); 1966 addPrefsInputWithHeading_(headings, values, "prefs.uiscale", iClob(new_InputWidget(8)));
1966 if (deviceType_App() == desktop_AppDeviceType) { 1967 if (deviceType_App() == desktop_AppDeviceType) {
1967 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.retainwindow}"))); 1968 addDialogToggle_(headings, values, "${prefs.retainwindow}", "prefs.retainwindow");
1968 addChild_Widget(values, iClob(makeToggle_Widget("prefs.retainwindow")));
1969 } 1969 }
1970 } 1970 }
1971 /* Colors. */ { 1971 /* Colors. */ {
1972 appendTwoColumnTabPage_Widget(tabs, "${heading.prefs.colors}", '3', &headings, &values); 1972 appendTwoColumnTabPage_Widget(tabs, "${heading.prefs.colors}", '3', &headings, &values);
1973 makeTwoColumnHeading_("${heading.prefs.uitheme}", headings, values); 1973 makeTwoColumnHeading_("${heading.prefs.uitheme}", headings, values);
1974#if defined (iPlatformApple) || defined (iPlatformMSys) 1974#if defined (iPlatformApple) || defined (iPlatformMSys)
1975 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.ostheme}"))); 1975 addDialogToggle_(headings, values, "${prefs.ostheme}", "prefs.ostheme");
1976 addChild_Widget(values, iClob(makeToggle_Widget("prefs.ostheme")));
1977#endif 1976#endif
1978 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.theme}"))); 1977 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.theme}")));
1979 iWidget *themes = new_Widget(); 1978 iWidget *themes = new_Widget();
@@ -2034,8 +2033,7 @@ iWidget *makePreferences_Widget(void) {
2034 addFontButtons_(values, "headingfont"); 2033 addFontButtons_(values, "headingfont");
2035 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.font}"))); 2034 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.font}")));
2036 addFontButtons_(values, "font"); 2035 addFontButtons_(values, "font");
2037 addChild_Widget(headings, iClob(makePadding_Widget(bigGap))); 2036 addDialogPadding_(headings, values);
2038 addChild_Widget(values, iClob(makePadding_Widget(bigGap)));
2039 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.mono}"))); 2037 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.mono}")));
2040 iWidget *mono = new_Widget(); { 2038 iWidget *mono = new_Widget(); {
2041 iWidget *tog; 2039 iWidget *tog;
@@ -2067,8 +2065,7 @@ iWidget *makePreferences_Widget(void) {
2067 updateSize_LabelWidget((iLabelWidget *) tog); 2065 updateSize_LabelWidget((iLabelWidget *) tog);
2068 } 2066 }
2069 addChildFlags_Widget(values, iClob(boldLink), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); 2067 addChildFlags_Widget(values, iClob(boldLink), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag);
2070 addChild_Widget(headings, iClob(makePadding_Widget(bigGap))); 2068 addDialogPadding_(headings, values);
2071 addChild_Widget(values, iClob(makePadding_Widget(bigGap)));
2072 /* Custom font. */ { 2069 /* Custom font. */ {
2073 iInputWidget *customFont = new_InputWidget(0); 2070 iInputWidget *customFont = new_InputWidget(0);
2074 setHint_InputWidget(customFont, "${hint.prefs.userfont}"); 2071 setHint_InputWidget(customFont, "${hint.prefs.userfont}");
@@ -2097,19 +2094,12 @@ iWidget *makePreferences_Widget(void) {
2097 addRadioButton_(quote, "prefs.quoteicon.0", "${prefs.quoteicon.line}", "quoteicon.set arg:0"); 2094 addRadioButton_(quote, "prefs.quoteicon.0", "${prefs.quoteicon.line}", "quoteicon.set arg:0");
2098 } 2095 }
2099 addChildFlags_Widget(values, iClob(quote), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); 2096 addChildFlags_Widget(values, iClob(quote), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag);
2100 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.biglede}"))); 2097 addDialogToggle_(headings, values, "${prefs.biglede}", "prefs.biglede");
2101 addChild_Widget(values, iClob(makeToggle_Widget("prefs.biglede"))); 2098 addDialogToggle_(headings, values, "${prefs.plaintext.wrap}", "prefs.plaintext.wrap");
2102 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.plaintext.wrap}"))); 2099 addDialogToggle_(headings, values, "${prefs.collapsepreonload}", "prefs.collapsepreonload");
2103 addChild_Widget(values, iClob(makeToggle_Widget("prefs.plaintext.wrap"))); 2100 addDialogPadding_(headings, values);
2104 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.collapsepreonload}"))); 2101 addDialogToggle_(headings, values, "${prefs.sideicon}", "prefs.sideicon");
2105 addChild_Widget(values, iClob(makeToggle_Widget("prefs.collapsepreonload"))); 2102 addDialogToggle_(headings, values, "${prefs.centershort}", "prefs.centershort");
2106// makeTwoColumnHeading_("${heading.prefs.widelayout}", headings, values);
2107 addChild_Widget(headings, iClob(makePadding_Widget(bigGap)));
2108 addChild_Widget(values, iClob(makePadding_Widget(bigGap)));
2109 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.sideicon}")));
2110 addChild_Widget(values, iClob(makeToggle_Widget("prefs.sideicon")));
2111 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.centershort}")));
2112 addChild_Widget(values, iClob(makeToggle_Widget("prefs.centershort")));
2113 } 2103 }
2114 /* Network. */ { 2104 /* Network. */ {
2115 appendTwoColumnTabPage_Widget(tabs, "${heading.prefs.network}", '6', &headings, &values); 2105 appendTwoColumnTabPage_Widget(tabs, "${heading.prefs.network}", '6', &headings, &values);
@@ -2181,12 +2171,9 @@ iWidget *makeBookmarkEditor_Widget(void) {
2181 addChild_Widget(dlg, iClob(makePadding_Widget(gap_UI))); 2171 addChild_Widget(dlg, iClob(makePadding_Widget(gap_UI)));
2182 addChild_Widget(dlg, iClob(makeTwoColumns_Widget(&headings, &values))); 2172 addChild_Widget(dlg, iClob(makeTwoColumns_Widget(&headings, &values)));
2183 makeTwoColumnHeading_("${heading.bookmark.tags}", headings, values); 2173 makeTwoColumnHeading_("${heading.bookmark.tags}", headings, values);
2184 addChild_Widget(headings, iClob(makeHeading_Widget("${bookmark.tag.home}"))); 2174 addDialogToggle_(headings, values, "${bookmark.tag.home}", "bmed.tag.home");
2185 addChild_Widget(values, iClob(makeToggle_Widget("bmed.tag.home"))); 2175 addDialogToggle_(headings, values, "${bookmark.tag.remote}", "bmed.tag.remote");
2186 addChild_Widget(headings, iClob(makeHeading_Widget("${bookmark.tag.remote}"))); 2176 addDialogToggle_(headings, values, "${bookmark.tag.linksplit}", "bmed.tag.linksplit");
2187 addChild_Widget(values, iClob(makeToggle_Widget("bmed.tag.remote")));
2188 addChild_Widget(headings, iClob(makeHeading_Widget("${bookmark.tag.linksplit}")));
2189 addChild_Widget(values, iClob(makeToggle_Widget("bmed.tag.linksplit")));
2190 arrange_Widget(dlg); 2177 arrange_Widget(dlg);
2191 for (int i = 0; i < 3; ++i) { 2178 for (int i = 0; i < 3; ++i) {
2192 as_Widget(inputs[i])->rect.size.x = 100 * gap_UI - headings->rect.size.x; 2179 as_Widget(inputs[i])->rect.size.x = 100 * gap_UI - headings->rect.size.x;