summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ui/mobile.c26
-rw-r--r--src/ui/util.c52
2 files changed, 58 insertions, 20 deletions
diff --git a/src/ui/mobile.c b/src/ui/mobile.c
index ecfb83ed..48f17c9c 100644
--- a/src/ui/mobile.c
+++ b/src/ui/mobile.c
@@ -280,8 +280,8 @@ static void stripTrailingColon_(iLabelWidget *label) {
280static iLabelWidget *makePanelButton_(const char *text, const char *command) { 280static iLabelWidget *makePanelButton_(const char *text, const char *command) {
281 iLabelWidget *btn = new_LabelWidget(text, command); 281 iLabelWidget *btn = new_LabelWidget(text, command);
282 setFlags_Widget(as_Widget(btn), 282 setFlags_Widget(as_Widget(btn),
283 borderBottom_WidgetFlag | alignLeft_WidgetFlag | 283 borderTop_WidgetFlag | borderBottom_WidgetFlag | alignLeft_WidgetFlag |
284 frameless_WidgetFlag | extraPadding_WidgetFlag, 284 frameless_WidgetFlag | extraPadding_WidgetFlag,
285 iTrue); 285 iTrue);
286 checkIcon_LabelWidget(btn); 286 checkIcon_LabelWidget(btn);
287 setFont_LabelWidget(btn, labelFont_()); 287 setFont_LabelWidget(btn, labelFont_());
@@ -379,11 +379,13 @@ static size_t countItems_(const iMenuItem *itemsNullTerminated) {
379} 379}
380 380
381void makePanelItem_Mobile(iWidget *panel, const iMenuItem *item) { 381void makePanelItem_Mobile(iWidget *panel, const iMenuItem *item) {
382 const char * spec = item->label;
383 const char * id = cstr_Rangecc(range_Command(spec, "id"));
384 const char * label = format_CStr("${%s}", id);
385 iWidget * widget = NULL; 382 iWidget * widget = NULL;
386 iLabelWidget *heading = NULL; 383 iLabelWidget *heading = NULL;
384 const char * spec = item->label;
385 const char * id = cstr_Rangecc(range_Command(spec, "id"));
386 const char * label = hasLabel_Command(spec, "text")
387 ? suffixPtr_Command(spec, "text")
388 : format_CStr("${%s}", id);
387 if (hasLabel_Command(spec, "device") && deviceType_App() != argLabel_Command(spec, "device")) { 389 if (hasLabel_Command(spec, "device") && deviceType_App() != argLabel_Command(spec, "device")) {
388 return; 390 return;
389 } 391 }
@@ -486,6 +488,9 @@ void makePanelItem_Mobile(iWidget *panel, const iMenuItem *item) {
486 as_Widget(input)); 488 as_Widget(input));
487 } 489 }
488 } 490 }
491 else if (equal_Command(spec, "button")) {
492 widget = as_Widget(heading = makePanelButton_(label, item->command));
493 }
489 else if (equal_Command(spec, "padding")) { 494 else if (equal_Command(spec, "padding")) {
490 widget = makePadding_Widget(lineHeight_Text(labelFont_()) * 1.5f); 495 widget = makePadding_Widget(lineHeight_Text(labelFont_()) * 1.5f);
491 } 496 }
@@ -514,9 +519,8 @@ iWidget *makeSplitMultiPanel_Mobile(const iMenuItem *itemsNullTerminated) {
514 iWidget *sheet = new_Widget(); 519 iWidget *sheet = new_Widget();
515 setBackgroundColor_Widget(sheet, uiBackground_ColorId); 520 setBackgroundColor_Widget(sheet, uiBackground_ColorId);
516 setFlags_Widget(sheet, 521 setFlags_Widget(sheet,
517 resizeToParentWidth_WidgetFlag | 522 resizeToParentWidth_WidgetFlag | resizeToParentHeight_WidgetFlag |
518 resizeToParentHeight_WidgetFlag | 523 frameless_WidgetFlag | focusRoot_WidgetFlag | commandOnClick_WidgetFlag |
519 frameless_WidgetFlag | focusRoot_WidgetFlag | commandOnClick_WidgetFlag |
520 overflowScrollable_WidgetFlag | leftEdgeDraggable_WidgetFlag, 524 overflowScrollable_WidgetFlag | leftEdgeDraggable_WidgetFlag,
521 iTrue); 525 iTrue);
522 /* The top-level split between main and detail panels. */ 526 /* The top-level split between main and detail panels. */
@@ -571,8 +575,10 @@ iWidget *makeSplitMultiPanel_Mobile(const iMenuItem *itemsNullTerminated) {
571 const iMenuItem *item = &itemsNullTerminated[i]; 575 const iMenuItem *item = &itemsNullTerminated[i];
572 if (equal_Command(item->label, "panel")) { 576 if (equal_Command(item->label, "panel")) {
573 const char *id = cstr_Rangecc(range_Command(item->label, "id")); 577 const char *id = cstr_Rangecc(range_Command(item->label, "id"));
574 const iString *label = collectNewFormat_String("${%s}", id); 578 const iString *label = hasLabel_Command(item->label, "text")
575 iLabelWidget *button = 579 ? collect_String(suffix_Command(item->label, "text"))
580 : collectNewFormat_String("${%s}", id);
581 iLabelWidget * button =
576 addChildFlags_Widget(topPanel, 582 addChildFlags_Widget(topPanel,
577 iClob(makePanelButton_(cstr_String(label), "panel.open")), 583 iClob(makePanelButton_(cstr_String(label), "panel.open")),
578 chevron_WidgetFlag | borderTop_WidgetFlag); 584 chevron_WidgetFlag | borderTop_WidgetFlag);
diff --git a/src/ui/util.c b/src/ui/util.c
index 64d7ea2b..a53041c2 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -1734,7 +1734,7 @@ iWidget *makePreferences_Widget(void) {
1734 { "button id:prefs.mono.gopher" }, 1734 { "button id:prefs.mono.gopher" },
1735 { NULL } 1735 { NULL }
1736 }; 1736 };
1737 const iMenuItem boldLinkItems[] = { 1737 const iMenuItem boldLinkItems[] = {
1738 { "button id:prefs.boldlink.dark" }, 1738 { "button id:prefs.boldlink.dark" },
1739 { "button id:prefs.boldlink.light" }, 1739 { "button id:prefs.boldlink.light" },
1740 { NULL } 1740 { NULL }
@@ -1758,7 +1758,6 @@ iWidget *makePreferences_Widget(void) {
1758 { "heading id:prefs.searchurl" }, 1758 { "heading id:prefs.searchurl" },
1759 { "input id:prefs.searchurl url:1 noheading:1" }, 1759 { "input id:prefs.searchurl url:1 noheading:1" },
1760 { "padding" }, 1760 { "padding" },
1761 { "toggle id:prefs.hoverlink" },
1762 { "toggle id:prefs.archive.openindex" }, 1761 { "toggle id:prefs.archive.openindex" },
1763 { "radio device:1 id:prefs.pinsplit", 0, 0, (const void *) pinSplitItems }, 1762 { "radio device:1 id:prefs.pinsplit", 0, 0, (const void *) pinSplitItems },
1764 { "padding" }, 1763 { "padding" },
@@ -1769,6 +1768,7 @@ iWidget *makePreferences_Widget(void) {
1769 { "title id:heading.prefs.interface" }, 1768 { "title id:heading.prefs.interface" },
1770 { "dropdown device:1 id:prefs.returnkey", 0, 0, (const void *) returnKeyBehaviors }, 1769 { "dropdown device:1 id:prefs.returnkey", 0, 0, (const void *) returnKeyBehaviors },
1771 { "padding device:1" }, 1770 { "padding device:1" },
1771 { "toggle id:prefs.hoverlink" },
1772 { "toggle device:2 id:prefs.hidetoolbarscroll" }, 1772 { "toggle device:2 id:prefs.hidetoolbarscroll" },
1773 { "heading id:heading.prefs.sizing" }, 1773 { "heading id:heading.prefs.sizing" },
1774 { "input id:prefs.uiscale maxlen:8" }, 1774 { "input id:prefs.uiscale maxlen:8" },
@@ -1824,19 +1824,51 @@ iWidget *makePreferences_Widget(void) {
1824 { "input id:prefs.proxy.http noheading:1" }, 1824 { "input id:prefs.proxy.http noheading:1" },
1825 { NULL } 1825 { NULL }
1826 }; 1826 };
1827 const iMenuItem identityPanelItems[] = {
1828 { "title id:sidebar.identities" },
1829 { NULL }
1830 };
1831 iString *aboutText = collectNew_String(); {
1832 setCStr_String(aboutText, "Lagrange " LAGRANGE_APP_VERSION);
1833#if defined (iPlatformAppleMobile)
1834 appendCStr_String(aboutText, " (" LAGRANGE_IOS_VERSION ")");
1835#endif
1836 }
1837 const iMenuItem aboutPanelItems[] = {
1838 { format_CStr("heading text:%s", cstr_String(aboutText)) },
1839 { "button text:" globe_Icon " By @jk@skyjake.fi", 0, 0,
1840 "!open url:https://skyjake.fi/@jk" },
1841 { "button text:" clock_Icon " ${menu.releasenotes}", 0, 0,
1842 "!open url:about:version" },
1843 { "padding" },
1844 { "button text:" info_Icon " ${menu.aboutpages}", 0, 0,
1845 "!open url:about:about" },
1846 { "button text:" bug_Icon " ${menu.debug}", 0, 0,
1847 "!open url:about:debug" },
1848 { NULL }
1849 };
1827 const iMenuItem items[] = { { "panel icon:0x2699 id:heading.prefs.general", 1850 const iMenuItem items[] = { { "panel icon:0x2699 id:heading.prefs.general",
1828 '1', 0, (const void *) generalPanelItems }, 1851 '1', 0, (const void *) generalPanelItems },
1852 { "panel icon:0x1f5a7 id:heading.prefs.network",
1853 '2', 0, (const void *) networkPanelItems },
1854 { "panel text:" person_Icon " ${sidebar.identities}",
1855 '3', 0, (const void *) identityPanelItems },
1856 { "padding" },
1829 { "panel icon:0x1f4f1 id:heading.prefs.interface", 1857 { "panel icon:0x1f4f1 id:heading.prefs.interface",
1830 '2', 0, (const void *) uiPanelItems }, 1858 '4', 0, (const void *) uiPanelItems },
1831 { "panel icon:0x1f3a8 id:heading.prefs.colors", 1859 { "panel icon:0x1f3a8 id:heading.prefs.colors",
1832 '3', 0, (const void *) colorPanelItems }, 1860 '5', 0, (const void *) colorPanelItems },
1833 { "panel icon:0x1f5da id:heading.prefs.fonts", 1861 { "panel icon:0x1f5da id:heading.prefs.fonts",
1834 '4', 0, (const void *) fontPanelItems }, 1862 '6', 0, (const void *) fontPanelItems },
1835 { "panel icon:0x1f660 id:heading.prefs.style", 1863 { "panel icon:0x1f660 id:heading.prefs.style",
1836 '5', 0, (const void *) stylePanelItems }, 1864 '7', 0, (const void *) stylePanelItems },
1837 { "panel icon:0x1f5a7 id:heading.prefs.network", 1865 { "padding" },
1838 '6', 0, (const void *) networkPanelItems }, 1866 { "button text:" info_Icon " ${menu.help}",
1839 { NULL } }; 1867 0, 0, "!open url:about:help" },
1868 { "padding" },
1869 { "panel text:" planet_Icon " ${menu.about}",
1870 0, 0, (const void *) aboutPanelItems },
1871 { NULL } };
1840 iWidget *dlg = makeSplitMultiPanel_Mobile(items); 1872 iWidget *dlg = makeSplitMultiPanel_Mobile(items);
1841 setupSheetTransition_Mobile(dlg, iTrue); 1873 setupSheetTransition_Mobile(dlg, iTrue);
1842 return dlg; 1874 return dlg;
@@ -2159,7 +2191,7 @@ iWidget *makeBookmarkEditor_Widget(void) {
2159 /* Buttons for special tags. */ 2191 /* Buttons for special tags. */
2160 addChild_Widget(dlg, iClob(makePadding_Widget(gap_UI))); 2192 addChild_Widget(dlg, iClob(makePadding_Widget(gap_UI)));
2161 addChild_Widget(dlg, iClob(makeTwoColumns_Widget(&headings, &values))); 2193 addChild_Widget(dlg, iClob(makeTwoColumns_Widget(&headings, &values)));
2162 makeTwoColumnHeading_("SPECIAL TAGS", headings, values); 2194 makeTwoColumnHeading_("${heading.bookmark.tags}", headings, values);
2163 addChild_Widget(headings, iClob(makeHeading_Widget("${bookmark.tag.home}"))); 2195 addChild_Widget(headings, iClob(makeHeading_Widget("${bookmark.tag.home}")));
2164 addChild_Widget(values, iClob(makeToggle_Widget("bmed.tag.home"))); 2196 addChild_Widget(values, iClob(makeToggle_Widget("bmed.tag.home")));
2165 addChild_Widget(headings, iClob(makeHeading_Widget("${bookmark.tag.remote}"))); 2197 addChild_Widget(headings, iClob(makeHeading_Widget("${bookmark.tag.remote}")));