diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-23 10:29:14 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-23 10:29:14 +0200 |
commit | 6c6f7a0303405536f634d0f694288c79f076edda (patch) | |
tree | a75d795ea4d09099ec8adc418ddc20ef83fd720a /src/ui/util.c | |
parent | 244599398b8fa457a160077513456b4b274d386d (diff) |
Lang: Applied string IDs everywhere
More or less everywhere?
IssueID #192
Diffstat (limited to 'src/ui/util.c')
-rw-r--r-- | src/ui/util.c | 254 |
1 files changed, 128 insertions, 126 deletions
diff --git a/src/ui/util.c b/src/ui/util.c index 5a08ec20..94690bc6 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -1137,7 +1137,7 @@ void finalizeSheet_Widget(iWidget *sheet) { | |||
1137 | pushBack_PtrArray(panelButtons, | 1137 | pushBack_PtrArray(panelButtons, |
1138 | addChildFlags_Widget(topPanel, | 1138 | addChildFlags_Widget(topPanel, |
1139 | iClob(panelButton = makePanelButton_( | 1139 | iClob(panelButton = makePanelButton_( |
1140 | i == 1 ? "User Interface" : cstr_String(text), | 1140 | i == 1 ? "${heading.prefs.userinterface}" : cstr_String(text), |
1141 | "panel.open")), | 1141 | "panel.open")), |
1142 | (i == 0 ? borderTop_WidgetFlag : 0) | | 1142 | (i == 0 ? borderTop_WidgetFlag : 0) | |
1143 | chevron_WidgetFlag)); | 1143 | chevron_WidgetFlag)); |
@@ -1332,10 +1332,10 @@ void finalizeSheet_Widget(iWidget *sheet) { | |||
1332 | if (isPrefs) { | 1332 | if (isPrefs) { |
1333 | addChild_Widget(topPanel, iClob(makePadding_Widget(lineHeight_Text(defaultBig_FontId)))); | 1333 | addChild_Widget(topPanel, iClob(makePadding_Widget(lineHeight_Text(defaultBig_FontId)))); |
1334 | addChildFlags_Widget(topPanel, | 1334 | addChildFlags_Widget(topPanel, |
1335 | iClob(makePanelButton_(info_Icon " Help", "panel.showhelp")), | 1335 | iClob(makePanelButton_(info_Icon " ${menu.help}", "panel.showhelp")), |
1336 | borderTop_WidgetFlag); | 1336 | borderTop_WidgetFlag); |
1337 | addChildFlags_Widget(topPanel, | 1337 | addChildFlags_Widget(topPanel, |
1338 | iClob(makePanelButton_(planet_Icon " About", "panel.about")), | 1338 | iClob(makePanelButton_(planet_Icon " ${menu.about}", "panel.about")), |
1339 | chevron_WidgetFlag); | 1339 | chevron_WidgetFlag); |
1340 | } | 1340 | } |
1341 | else { | 1341 | else { |
@@ -1362,7 +1362,7 @@ void finalizeSheet_Widget(iWidget *sheet) { | |||
1362 | setBackgroundColor_Widget(navi, uiBackground_ColorId); | 1362 | setBackgroundColor_Widget(navi, uiBackground_ColorId); |
1363 | addChild_Widget(navi, iClob(makePadding_Widget(0))); | 1363 | addChild_Widget(navi, iClob(makePadding_Widget(0))); |
1364 | iLabelWidget *back = addChildFlags_Widget(navi, | 1364 | iLabelWidget *back = addChildFlags_Widget(navi, |
1365 | iClob(new_LabelWidget(leftAngle_Icon " Back", "panel.close")), | 1365 | iClob(new_LabelWidget(leftAngle_Icon " ${panel.back}", "panel.close")), |
1366 | noBackground_WidgetFlag | frameless_WidgetFlag | | 1366 | noBackground_WidgetFlag | frameless_WidgetFlag | |
1367 | alignLeft_WidgetFlag | extraPadding_WidgetFlag); | 1367 | alignLeft_WidgetFlag | extraPadding_WidgetFlag); |
1368 | checkIcon_LabelWidget(back); | 1368 | checkIcon_LabelWidget(back); |
@@ -1577,11 +1577,11 @@ iWidget *makeDialogButtons_Widget(const iMenuItem *actions, size_t numActions) { | |||
1577 | kmods = 0; | 1577 | kmods = 0; |
1578 | } | 1578 | } |
1579 | if (label == NULL) { | 1579 | if (label == NULL) { |
1580 | label = uiTextAction_ColorEscape " OK "; | 1580 | label = format_CStr(uiTextAction_ColorEscape "%s", cstr_Lang("dlg.default")); |
1581 | } | 1581 | } |
1582 | } | 1582 | } |
1583 | iLabelWidget *button = | 1583 | iLabelWidget *button = |
1584 | addChild_Widget(div, iClob(newKeyMods_LabelWidget(actions[i].label, key, kmods, cmd))); | 1584 | addChild_Widget(div, iClob(newKeyMods_LabelWidget(label, key, kmods, cmd))); |
1585 | setFont_LabelWidget(button, isDefault ? fonts[1] : fonts[0]); | 1585 | setFont_LabelWidget(button, isDefault ? fonts[1] : fonts[0]); |
1586 | } | 1586 | } |
1587 | return div; | 1587 | return div; |
@@ -1655,7 +1655,7 @@ static iBool messageHandler_(iWidget *msg, const char *cmd) { | |||
1655 | 1655 | ||
1656 | iWidget *makeMessage_Widget(const char *title, const char *msg) { | 1656 | iWidget *makeMessage_Widget(const char *title, const char *msg) { |
1657 | iWidget *dlg = | 1657 | iWidget *dlg = |
1658 | makeQuestion_Widget(title, msg, (iMenuItem[]){ { "Continue", 0, 0, "message.ok" } }, 1); | 1658 | makeQuestion_Widget(title, msg, (iMenuItem[]){ { "${dlg.message.ok}", 0, 0, "message.ok" } }, 1); |
1659 | addAction_Widget(dlg, SDLK_ESCAPE, 0, "message.ok"); | 1659 | addAction_Widget(dlg, SDLK_ESCAPE, 0, "message.ok"); |
1660 | addAction_Widget(dlg, SDLK_SPACE, 0, "message.ok"); | 1660 | addAction_Widget(dlg, SDLK_SPACE, 0, "message.ok"); |
1661 | return dlg; | 1661 | return dlg; |
@@ -1679,12 +1679,14 @@ iWidget *makeQuestion_Widget(const char *title, const char *msg, | |||
1679 | 1679 | ||
1680 | void setToggle_Widget(iWidget *d, iBool active) { | 1680 | void setToggle_Widget(iWidget *d, iBool active) { |
1681 | if (d) { | 1681 | if (d) { |
1682 | const char *YES = cstr_Lang("toggle.yes"); | ||
1683 | const char *NO = cstr_Lang("toggle.no"); | ||
1682 | setFlags_Widget(d, selected_WidgetFlag, active); | 1684 | setFlags_Widget(d, selected_WidgetFlag, active); |
1683 | iLabelWidget *label = (iLabelWidget *) d; | 1685 | iLabelWidget *label = (iLabelWidget *) d; |
1684 | if (!cmp_String(text_LabelWidget(label), "YES") || | 1686 | if (!cmp_String(text_LabelWidget(label), YES) || |
1685 | !cmp_String(text_LabelWidget(label), "NO")) { | 1687 | !cmp_String(text_LabelWidget(label), NO)) { |
1686 | updateText_LabelWidget((iLabelWidget *) d, | 1688 | updateText_LabelWidget((iLabelWidget *) d, |
1687 | collectNewFormat_String("%s", isSelected_Widget(d) ? "YES" : "NO")); | 1689 | collectNewCStr_String(isSelected_Widget(d) ? YES : NO)); |
1688 | } | 1690 | } |
1689 | else { | 1691 | else { |
1690 | refresh_Widget(d); | 1692 | refresh_Widget(d); |
@@ -1788,85 +1790,85 @@ static void addFontButtons_(iWidget *parent, const char *id) { | |||
1788 | iWidget *makePreferences_Widget(void) { | 1790 | iWidget *makePreferences_Widget(void) { |
1789 | iWidget *dlg = makeSheet_Widget("prefs"); | 1791 | iWidget *dlg = makeSheet_Widget("prefs"); |
1790 | addChildFlags_Widget(dlg, | 1792 | addChildFlags_Widget(dlg, |
1791 | iClob(new_LabelWidget(uiHeading_ColorEscape "PREFERENCES", NULL)), | 1793 | iClob(new_LabelWidget(uiHeading_ColorEscape "${heading.prefs}", NULL)), |
1792 | frameless_WidgetFlag); | 1794 | frameless_WidgetFlag); |
1793 | iWidget *tabs = makeTabs_Widget(dlg); | 1795 | iWidget *tabs = makeTabs_Widget(dlg); |
1794 | setBackgroundColor_Widget(findChild_Widget(tabs, "tabs.buttons"), uiBackgroundSidebar_ColorId); | 1796 | setBackgroundColor_Widget(findChild_Widget(tabs, "tabs.buttons"), uiBackgroundSidebar_ColorId); |
1795 | setId_Widget(tabs, "prefs.tabs"); | 1797 | setId_Widget(tabs, "prefs.tabs"); |
1796 | iWidget *headings, *values; | 1798 | iWidget *headings, *values; |
1797 | /* General preferences. */ { | 1799 | /* General preferences. */ { |
1798 | appendTwoColumnPage_(tabs, "General", '1', &headings, &values); | 1800 | appendTwoColumnPage_(tabs, "${heading.prefs.general}", '1', &headings, &values); |
1799 | #if defined (LAGRANGE_DOWNLOAD_EDIT) | 1801 | #if defined (LAGRANGE_DOWNLOAD_EDIT) |
1800 | addChild_Widget(headings, iClob(makeHeading_Widget("Downloads folder:"))); | 1802 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.downloads}"))); |
1801 | setId_Widget(addChild_Widget(values, iClob(new_InputWidget(0))), "prefs.downloads"); | 1803 | setId_Widget(addChild_Widget(values, iClob(new_InputWidget(0))), "prefs.downloads"); |
1802 | #endif | 1804 | #endif |
1803 | addChild_Widget(headings, iClob(makeHeading_Widget("Search URL:"))); | 1805 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.searchurl}"))); |
1804 | setId_Widget(addChild_Widget(values, iClob(new_InputWidget(0))), "prefs.searchurl"); | 1806 | setId_Widget(addChild_Widget(values, iClob(new_InputWidget(0))), "prefs.searchurl"); |
1805 | addChild_Widget(headings, iClob(makeHeading_Widget("Show URL on hover:"))); | 1807 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.hoverlink}"))); |
1806 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.hoverlink"))); | 1808 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.hoverlink"))); |
1807 | addChild_Widget(headings, iClob(makeHeading_Widget("Vertical centering:"))); | 1809 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.centershort}"))); |
1808 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.centershort"))); | 1810 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.centershort"))); |
1809 | makeTwoColumnHeading_("SCROLLING", headings, values); | 1811 | makeTwoColumnHeading_("${heading.prefs.scrolling}", headings, values); |
1810 | addChild_Widget(headings, iClob(makeHeading_Widget("Smooth scrolling:"))); | 1812 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.smoothscroll}"))); |
1811 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.smoothscroll"))); | 1813 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.smoothscroll"))); |
1812 | addChild_Widget(headings, iClob(makeHeading_Widget("Load image on scroll:"))); | 1814 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.imageloadscroll}"))); |
1813 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.imageloadscroll"))); | 1815 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.imageloadscroll"))); |
1814 | if (deviceType_App() == phone_AppDeviceType) { | 1816 | if (deviceType_App() == phone_AppDeviceType) { |
1815 | addChild_Widget(headings, iClob(makeHeading_Widget("Hide toolbar on scroll:"))); | 1817 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.hidetoolbarscroll}"))); |
1816 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.hidetoolbarscroll"))); | 1818 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.hidetoolbarscroll"))); |
1817 | } | 1819 | } |
1818 | } | 1820 | } |
1819 | /* Window. */ { | 1821 | /* Window. */ { |
1820 | appendTwoColumnPage_(tabs, "Interface", '2', &headings, &values); | 1822 | appendTwoColumnPage_(tabs, "${heading.prefs.interface}", '2', &headings, &values); |
1821 | #if defined (iPlatformApple) || defined (iPlatformMSys) | 1823 | #if defined (iPlatformApple) || defined (iPlatformMSys) |
1822 | addChild_Widget(headings, iClob(makeHeading_Widget("Use system theme:"))); | 1824 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.ostheme}"))); |
1823 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.ostheme"))); | 1825 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.ostheme"))); |
1824 | #endif | 1826 | #endif |
1825 | addChild_Widget(headings, iClob(makeHeading_Widget("Theme:"))); | 1827 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.theme}"))); |
1826 | iWidget *themes = new_Widget(); | 1828 | iWidget *themes = new_Widget(); |
1827 | /* Themes. */ { | 1829 | /* Themes. */ { |
1828 | setId_Widget(addChild_Widget(themes, iClob(new_LabelWidget("Pure Black", "theme.set arg:0"))), "prefs.theme.0"); | 1830 | setId_Widget(addChild_Widget(themes, iClob(new_LabelWidget("${prefs.theme.black}", "theme.set arg:0"))), "prefs.theme.0"); |
1829 | setId_Widget(addChild_Widget(themes, iClob(new_LabelWidget("Dark", "theme.set arg:1"))), "prefs.theme.1"); | 1831 | setId_Widget(addChild_Widget(themes, iClob(new_LabelWidget("${prefs.theme.dark}", "theme.set arg:1"))), "prefs.theme.1"); |
1830 | setId_Widget(addChild_Widget(themes, iClob(new_LabelWidget("Light", "theme.set arg:2"))), "prefs.theme.2"); | 1832 | setId_Widget(addChild_Widget(themes, iClob(new_LabelWidget("${prefs.theme.light}", "theme.set arg:2"))), "prefs.theme.2"); |
1831 | setId_Widget(addChild_Widget(themes, iClob(new_LabelWidget("Pure White", "theme.set arg:3"))), "prefs.theme.3"); | 1833 | setId_Widget(addChild_Widget(themes, iClob(new_LabelWidget("${prefs.theme.white}", "theme.set arg:3"))), "prefs.theme.3"); |
1832 | } | 1834 | } |
1833 | addChildFlags_Widget(values, iClob(themes), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); | 1835 | addChildFlags_Widget(values, iClob(themes), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); |
1834 | /* Accents. */ | 1836 | /* Accents. */ |
1835 | iWidget *accent = new_Widget(); { | 1837 | iWidget *accent = new_Widget(); { |
1836 | setId_Widget(addChild_Widget(accent, iClob(new_LabelWidget("Teal", "accent.set arg:0"))), "prefs.accent.0"); | 1838 | setId_Widget(addChild_Widget(accent, iClob(new_LabelWidget("${prefs.accent.teal}", "accent.set arg:0"))), "prefs.accent.0"); |
1837 | setId_Widget(addChild_Widget(accent, iClob(new_LabelWidget("Orange", "accent.set arg:1"))), "prefs.accent.1"); | 1839 | setId_Widget(addChild_Widget(accent, iClob(new_LabelWidget("${prefs.accent.orange}", "accent.set arg:1"))), "prefs.accent.1"); |
1838 | } | 1840 | } |
1839 | addChild_Widget(headings, iClob(makeHeading_Widget("Accent color:"))); | 1841 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.accent}"))); |
1840 | addChildFlags_Widget(values, iClob(accent), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); | 1842 | addChildFlags_Widget(values, iClob(accent), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); |
1841 | #if defined (LAGRANGE_CUSTOM_FRAME) | 1843 | #if defined (LAGRANGE_CUSTOM_FRAME) |
1842 | addChild_Widget(headings, iClob(makeHeading_Widget("Custom window frame:"))); | 1844 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.customframe}"))); |
1843 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.customframe"))); | 1845 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.customframe"))); |
1844 | #endif | 1846 | #endif |
1845 | makeTwoColumnHeading_("SIZING", headings, values); | 1847 | makeTwoColumnHeading_("${heading.prefs.sizing}", headings, values); |
1846 | addChild_Widget(headings, iClob(makeHeading_Widget("UI scale factor:"))); | 1848 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.uiscale}"))); |
1847 | setId_Widget(addChild_Widget(values, iClob(new_InputWidget(8))), "prefs.uiscale"); | 1849 | setId_Widget(addChild_Widget(values, iClob(new_InputWidget(8))), "prefs.uiscale"); |
1848 | addChild_Widget(headings, iClob(makeHeading_Widget("Retain placement:"))); | 1850 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.retainwindow}"))); |
1849 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.retainwindow"))); | 1851 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.retainwindow"))); |
1850 | makeTwoColumnHeading_("WIDE LAYOUT", headings, values); | 1852 | makeTwoColumnHeading_("${heading.prefs.widelayout}", headings, values); |
1851 | addChild_Widget(headings, iClob(makeHeading_Widget("Site icon:"))); | 1853 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.sideicon}"))); |
1852 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.sideicon"))); | 1854 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.sideicon"))); |
1853 | } | 1855 | } |
1854 | /* Colors. */ { | 1856 | /* Colors. */ { |
1855 | appendTwoColumnPage_(tabs, "Colors", '3', &headings, &values); | 1857 | appendTwoColumnPage_(tabs, "${heading.prefs.colors}", '3', &headings, &values); |
1856 | makeTwoColumnHeading_("PAGE CONTENT", headings, values); | 1858 | makeTwoColumnHeading_("${heading.prefs.pagecontent}", headings, values); |
1857 | for (int i = 0; i < 2; ++i) { | 1859 | for (int i = 0; i < 2; ++i) { |
1858 | const iBool isDark = (i == 0); | 1860 | const iBool isDark = (i == 0); |
1859 | const char *mode = isDark ? "dark" : "light"; | 1861 | const char *mode = isDark ? "dark" : "light"; |
1860 | const iMenuItem themes[] = { | 1862 | const iMenuItem themes[] = { |
1861 | { "Colorful Dark", 0, 0, format_CStr("doctheme.%s.set arg:%d", mode, colorfulDark_GmDocumentTheme) }, | 1863 | { "${prefs.doctheme.name.colorfuldark}", 0, 0, format_CStr("doctheme.%s.set arg:%d", mode, colorfulDark_GmDocumentTheme) }, |
1862 | { "Colorful Light", 0, 0, format_CStr("doctheme.%s.set arg:%d", mode, colorfulLight_GmDocumentTheme) }, | 1864 | { "${prefs.doctheme.name.colorfullight}", 0, 0, format_CStr("doctheme.%s.set arg:%d", mode, colorfulLight_GmDocumentTheme) }, |
1863 | { "Black", 0, 0, format_CStr("doctheme.%s.set arg:%d", mode, black_GmDocumentTheme) }, | 1865 | { "${prefs.doctheme.name.black}", 0, 0, format_CStr("doctheme.%s.set arg:%d", mode, black_GmDocumentTheme) }, |
1864 | { "Gray", 0, 0, format_CStr("doctheme.%s.set arg:%d", mode, gray_GmDocumentTheme) }, | 1866 | { "${prefs.doctheme.name.gray}", 0, 0, format_CStr("doctheme.%s.set arg:%d", mode, gray_GmDocumentTheme) }, |
1865 | { "White", 0, 0, format_CStr("doctheme.%s.set arg:%d", mode, white_GmDocumentTheme) }, | 1867 | { "${prefs.doctheme.name.white}", 0, 0, format_CStr("doctheme.%s.set arg:%d", mode, white_GmDocumentTheme) }, |
1866 | { "Sepia", 0, 0, format_CStr("doctheme.%s.set arg:%d", mode, sepia_GmDocumentTheme) }, | 1868 | { "${prefs.doctheme.name.sepia}", 0, 0, format_CStr("doctheme.%s.set arg:%d", mode, sepia_GmDocumentTheme) }, |
1867 | { "High Contrast", 0, 0, format_CStr("doctheme.%s.set arg:%d", mode, highContrast_GmDocumentTheme) }, | 1869 | { "${prefs.doctheme.name.highcontrast}", 0, 0, format_CStr("doctheme.%s.set arg:%d", mode, highContrast_GmDocumentTheme) }, |
1868 | }; | 1870 | }; |
1869 | addChild_Widget(headings, iClob(makeHeading_Widget(isDark ? "Dark theme:" : "Light theme:"))); | 1871 | addChild_Widget(headings, iClob(makeHeading_Widget(isDark ? "${prefs.doctheme.dark}" : "${prefs.doctheme.light}"))); |
1870 | iLabelWidget *button = | 1872 | iLabelWidget *button = |
1871 | makeMenuButton_LabelWidget(themes[1].label, themes, iElemCount(themes)); | 1873 | makeMenuButton_LabelWidget(themes[1].label, themes, iElemCount(themes)); |
1872 | // setFrameColor_Widget(findChild_Widget(as_Widget(button), "menu"), | 1874 | // setFrameColor_Widget(findChild_Widget(as_Widget(button), "menu"), |
@@ -1875,7 +1877,7 @@ iWidget *makePreferences_Widget(void) { | |||
1875 | setId_Widget(addChildFlags_Widget(values, iClob(button), alignLeft_WidgetFlag), | 1877 | setId_Widget(addChildFlags_Widget(values, iClob(button), alignLeft_WidgetFlag), |
1876 | format_CStr("prefs.doctheme.%s", mode)); | 1878 | format_CStr("prefs.doctheme.%s", mode)); |
1877 | } | 1879 | } |
1878 | addChild_Widget(headings, iClob(makeHeading_Widget("Saturation:"))); | 1880 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.saturation}"))); |
1879 | iWidget *sats = new_Widget(); | 1881 | iWidget *sats = new_Widget(); |
1880 | /* Saturation levels. */ { | 1882 | /* Saturation levels. */ { |
1881 | addRadioButton_(sats, "prefs.saturation.3", "100 %%", "saturation.set arg:100"); | 1883 | addRadioButton_(sats, "prefs.saturation.3", "100 %%", "saturation.set arg:100"); |
@@ -1886,75 +1888,75 @@ iWidget *makePreferences_Widget(void) { | |||
1886 | addChildFlags_Widget(values, iClob(sats), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); | 1888 | addChildFlags_Widget(values, iClob(sats), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); |
1887 | } | 1889 | } |
1888 | /* Layout. */ { | 1890 | /* Layout. */ { |
1889 | appendTwoColumnPage_(tabs, "Style", '4', &headings, &values); | 1891 | appendTwoColumnPage_(tabs, "${heading.prefs.style}", '4', &headings, &values); |
1890 | makeTwoColumnHeading_("FONTS", headings, values); | 1892 | makeTwoColumnHeading_("${heading.prefs.fonts}", headings, values); |
1891 | /* Fonts. */ { | 1893 | /* Fonts. */ { |
1892 | iWidget *fonts; | 1894 | iWidget *fonts; |
1893 | addChild_Widget(headings, iClob(makeHeading_Widget("Heading font:"))); | 1895 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.headingfont}"))); |
1894 | addFontButtons_(values, "headingfont"); | 1896 | addFontButtons_(values, "headingfont"); |
1895 | addChild_Widget(headings, iClob(makeHeading_Widget("Body font:"))); | 1897 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.font}"))); |
1896 | addFontButtons_(values, "font"); | 1898 | addFontButtons_(values, "font"); |
1897 | addChild_Widget(headings, iClob(makeHeading_Widget("Monospace body:"))); | 1899 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.mono}"))); |
1898 | iWidget *mono = new_Widget(); | 1900 | iWidget *mono = new_Widget(); |
1899 | /* TODO: Needs labels! */ | 1901 | /* TODO: Needs labels! */ |
1900 | setTextCStr_LabelWidget( | 1902 | setTextCStr_LabelWidget( |
1901 | addChild_Widget(mono, iClob(makeToggle_Widget("prefs.mono.gemini"))), "Gemini"); | 1903 | addChild_Widget(mono, iClob(makeToggle_Widget("prefs.mono.gemini"))), "${prefs.mono.gemini}"); |
1902 | setTextCStr_LabelWidget( | 1904 | setTextCStr_LabelWidget( |
1903 | addChild_Widget(mono, iClob(makeToggle_Widget("prefs.mono.gopher"))), "Gopher"); | 1905 | addChild_Widget(mono, iClob(makeToggle_Widget("prefs.mono.gopher"))), "${prefs.mono.gopher}"); |
1904 | addChildFlags_Widget(values, iClob(mono), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); | 1906 | addChildFlags_Widget(values, iClob(mono), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); |
1905 | } | 1907 | } |
1906 | makeTwoColumnHeading_("PARAGRAPH", headings, values); | 1908 | makeTwoColumnHeading_("${heading.prefs.paragraph}", headings, values); |
1907 | addChild_Widget(headings, iClob(makeHeading_Widget("Line width:"))); | 1909 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.linewidth}"))); |
1908 | iWidget *widths = new_Widget(); | 1910 | iWidget *widths = new_Widget(); |
1909 | /* Line widths. */ { | 1911 | /* Line widths. */ { |
1910 | addRadioButton_(widths, "prefs.linewidth.30", "\u20132", "linewidth.set arg:30"); | 1912 | addRadioButton_(widths, "prefs.linewidth.30", "\u20132", "linewidth.set arg:30"); |
1911 | addRadioButton_(widths, "prefs.linewidth.34", "\u20131", "linewidth.set arg:34"); | 1913 | addRadioButton_(widths, "prefs.linewidth.34", "\u20131", "linewidth.set arg:34"); |
1912 | addRadioButton_(widths, "prefs.linewidth.38", "Normal", "linewidth.set arg:38"); | 1914 | addRadioButton_(widths, "prefs.linewidth.38", "${prefs.linewidth.normal}", "linewidth.set arg:38"); |
1913 | addRadioButton_(widths, "prefs.linewidth.43", "+1", "linewidth.set arg:43"); | 1915 | addRadioButton_(widths, "prefs.linewidth.43", "+1", "linewidth.set arg:43"); |
1914 | addRadioButton_(widths, "prefs.linewidth.48", "+2", "linewidth.set arg:48"); | 1916 | addRadioButton_(widths, "prefs.linewidth.48", "+2", "linewidth.set arg:48"); |
1915 | addRadioButton_(widths, "prefs.linewidth.1000", "Window", "linewidth.set arg:1000"); | 1917 | addRadioButton_(widths, "prefs.linewidth.1000", "${prefs.linewidth.fill}", "linewidth.set arg:1000"); |
1916 | } | 1918 | } |
1917 | addChildFlags_Widget(values, iClob(widths), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); | 1919 | addChildFlags_Widget(values, iClob(widths), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); |
1918 | addChild_Widget(headings, iClob(makeHeading_Widget("Quote indicator:"))); | 1920 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.quoteicon}"))); |
1919 | iWidget *quote = new_Widget(); { | 1921 | iWidget *quote = new_Widget(); { |
1920 | addRadioButton_(quote, "prefs.quoteicon.1", "Icon", "quoteicon.set arg:1"); | 1922 | addRadioButton_(quote, "prefs.quoteicon.1", "${prefs.quoteicon.icon}", "quoteicon.set arg:1"); |
1921 | addRadioButton_(quote, "prefs.quoteicon.0", "Line", "quoteicon.set arg:0"); | 1923 | addRadioButton_(quote, "prefs.quoteicon.0", "${prefs.quoteicon.line}", "quoteicon.set arg:0"); |
1922 | } | 1924 | } |
1923 | addChildFlags_Widget(values, iClob(quote), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); | 1925 | addChildFlags_Widget(values, iClob(quote), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); |
1924 | addChild_Widget(headings, iClob(makeHeading_Widget("Big 1st paragaph:"))); | 1926 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.biglede}"))); |
1925 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.biglede"))); | 1927 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.biglede"))); |
1926 | addChild_Widget(headings, iClob(makeHeading_Widget("Wrap plain text:"))); | 1928 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.plaintext.wrap}"))); |
1927 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.plaintext.wrap"))); | 1929 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.plaintext.wrap"))); |
1928 | } | 1930 | } |
1929 | /* Network. */ { | 1931 | /* Network. */ { |
1930 | appendTwoColumnPage_(tabs, "Network", '5', &headings, &values); | 1932 | appendTwoColumnPage_(tabs, "${heading.prefs.network}", '5', &headings, &values); |
1931 | addChild_Widget(headings, iClob(makeHeading_Widget("Decode URLs:"))); | 1933 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.decodeurls}"))); |
1932 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.decodeurls"))); | 1934 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.decodeurls"))); |
1933 | addChild_Widget(headings, iClob(makeHeading_Widget("Cache size:"))); | 1935 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.cachesize}"))); |
1934 | iWidget *cacheGroup = new_Widget(); { | 1936 | iWidget *cacheGroup = new_Widget(); { |
1935 | iInputWidget *cache = new_InputWidget(4); | 1937 | iInputWidget *cache = new_InputWidget(4); |
1936 | setSelectAllOnFocus_InputWidget(cache, iTrue); | 1938 | setSelectAllOnFocus_InputWidget(cache, iTrue); |
1937 | setId_Widget(addChild_Widget(cacheGroup, iClob(cache)), "prefs.cachesize"); | 1939 | setId_Widget(addChild_Widget(cacheGroup, iClob(cache)), "prefs.cachesize"); |
1938 | addChildFlags_Widget(cacheGroup, iClob(new_LabelWidget("MB", NULL)), frameless_WidgetFlag); | 1940 | addChildFlags_Widget(cacheGroup, iClob(new_LabelWidget("${mb}", NULL)), frameless_WidgetFlag); |
1939 | } | 1941 | } |
1940 | addChildFlags_Widget(values, iClob(cacheGroup), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); | 1942 | addChildFlags_Widget(values, iClob(cacheGroup), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); |
1941 | makeTwoColumnHeading_("CERTIFICATES", headings, values); | 1943 | makeTwoColumnHeading_("${heading.prefs.certs}", headings, values); |
1942 | addChild_Widget(headings, iClob(makeHeading_Widget("CA file:"))); | 1944 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.ca.file}"))); |
1943 | setId_Widget(addChild_Widget(values, iClob(new_InputWidget(0))), "prefs.ca.file"); | 1945 | setId_Widget(addChild_Widget(values, iClob(new_InputWidget(0))), "prefs.ca.file"); |
1944 | addChild_Widget(headings, iClob(makeHeading_Widget("CA path:"))); | 1946 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.ca.path}"))); |
1945 | setId_Widget(addChild_Widget(values, iClob(new_InputWidget(0))), "prefs.ca.path"); | 1947 | setId_Widget(addChild_Widget(values, iClob(new_InputWidget(0))), "prefs.ca.path"); |
1946 | makeTwoColumnHeading_("PROXIES", headings, values); | 1948 | makeTwoColumnHeading_("${heading.prefs.proxies}", headings, values); |
1947 | addChild_Widget(headings, iClob(makeHeading_Widget("Gemini proxy:"))); | 1949 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.proxy.gemini}"))); |
1948 | setId_Widget(addChild_Widget(values, iClob(new_InputWidget(0))), "prefs.proxy.gemini"); | 1950 | setId_Widget(addChild_Widget(values, iClob(new_InputWidget(0))), "prefs.proxy.gemini"); |
1949 | addChild_Widget(headings, iClob(makeHeading_Widget("Gopher proxy:"))); | 1951 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.proxy.gopher}"))); |
1950 | setId_Widget(addChild_Widget(values, iClob(new_InputWidget(0))), "prefs.proxy.gopher"); | 1952 | setId_Widget(addChild_Widget(values, iClob(new_InputWidget(0))), "prefs.proxy.gopher"); |
1951 | addChild_Widget(headings, iClob(makeHeading_Widget("HTTP proxy:"))); | 1953 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.proxy.http}"))); |
1952 | setId_Widget(addChild_Widget(values, iClob(new_InputWidget(0))), "prefs.proxy.http"); | 1954 | setId_Widget(addChild_Widget(values, iClob(new_InputWidget(0))), "prefs.proxy.http"); |
1953 | } | 1955 | } |
1954 | /* Keybindings. */ | 1956 | /* Keybindings. */ |
1955 | if (deviceType_App() == desktop_AppDeviceType) { | 1957 | if (deviceType_App() == desktop_AppDeviceType) { |
1956 | iBindingsWidget *bind = new_BindingsWidget(); | 1958 | iBindingsWidget *bind = new_BindingsWidget(); |
1957 | appendFramelessTabPage_(tabs, iClob(bind), "Keys", '6', KMOD_PRIMARY); | 1959 | appendFramelessTabPage_(tabs, iClob(bind), "${heading.prefs.keys}", '6', KMOD_PRIMARY); |
1958 | } | 1960 | } |
1959 | addChild_Widget(dlg, iClob(makePadding_Widget(gap_UI))); | 1961 | addChild_Widget(dlg, iClob(makePadding_Widget(gap_UI))); |
1960 | resizeToLargestPage_Widget(tabs); | 1962 | resizeToLargestPage_Widget(tabs); |
@@ -1980,20 +1982,20 @@ iWidget *makeBookmarkEditor_Widget(void) { | |||
1980 | iWidget *dlg = makeSheet_Widget("bmed"); | 1982 | iWidget *dlg = makeSheet_Widget("bmed"); |
1981 | setId_Widget(addChildFlags_Widget( | 1983 | setId_Widget(addChildFlags_Widget( |
1982 | dlg, | 1984 | dlg, |
1983 | iClob(new_LabelWidget(uiHeading_ColorEscape "EDIT BOOKMARK", NULL)), | 1985 | iClob(new_LabelWidget(uiHeading_ColorEscape "${heading.bookmark.edit}", NULL)), |
1984 | frameless_WidgetFlag), | 1986 | frameless_WidgetFlag), |
1985 | "bmed.heading"); | 1987 | "bmed.heading"); |
1986 | iWidget *headings, *values; | 1988 | iWidget *headings, *values; |
1987 | addChild_Widget(dlg, iClob(makeTwoColumnWidget_(&headings, &values))); | 1989 | addChild_Widget(dlg, iClob(makeTwoColumnWidget_(&headings, &values))); |
1988 | iInputWidget *inputs[4]; | 1990 | iInputWidget *inputs[4]; |
1989 | addChild_Widget(headings, iClob(makeHeading_Widget("Title:"))); | 1991 | addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.bookmark.title}"))); |
1990 | setId_Widget(addChild_Widget(values, iClob(inputs[0] = new_InputWidget(0))), "bmed.title"); | 1992 | setId_Widget(addChild_Widget(values, iClob(inputs[0] = new_InputWidget(0))), "bmed.title"); |
1991 | addChild_Widget(headings, iClob(makeHeading_Widget("URL:"))); | 1993 | addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.bookmark.url}"))); |
1992 | setId_Widget(addChild_Widget(values, iClob(inputs[1] = new_InputWidget(0))), "bmed.url"); | 1994 | setId_Widget(addChild_Widget(values, iClob(inputs[1] = new_InputWidget(0))), "bmed.url"); |
1993 | setUrlContent_InputWidget(inputs[1], iTrue); | 1995 | setUrlContent_InputWidget(inputs[1], iTrue); |
1994 | addChild_Widget(headings, iClob(makeHeading_Widget("Tags:"))); | 1996 | addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.bookmark.tags}"))); |
1995 | setId_Widget(addChild_Widget(values, iClob(inputs[2] = new_InputWidget(0))), "bmed.tags"); | 1997 | setId_Widget(addChild_Widget(values, iClob(inputs[2] = new_InputWidget(0))), "bmed.tags"); |
1996 | addChild_Widget(headings, iClob(makeHeading_Widget("Icon:"))); | 1998 | addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.bookmark.icon}"))); |
1997 | setId_Widget(addChild_Widget(values, iClob(inputs[3] = new_InputWidget(1))), "bmed.icon"); | 1999 | setId_Widget(addChild_Widget(values, iClob(inputs[3] = new_InputWidget(1))), "bmed.icon"); |
1998 | arrange_Widget(dlg); | 2000 | arrange_Widget(dlg); |
1999 | for (int i = 0; i < 3; ++i) { | 2001 | for (int i = 0; i < 3; ++i) { |
@@ -2002,7 +2004,7 @@ iWidget *makeBookmarkEditor_Widget(void) { | |||
2002 | addChild_Widget( | 2004 | addChild_Widget( |
2003 | dlg, | 2005 | dlg, |
2004 | iClob(makeDialogButtons_Widget((iMenuItem[]){ { "${cancel}", 0, 0, NULL }, | 2006 | iClob(makeDialogButtons_Widget((iMenuItem[]){ { "${cancel}", 0, 0, NULL }, |
2005 | { uiTextCaution_ColorEscape "Save Bookmark", | 2007 | { uiTextCaution_ColorEscape "${dlg.bookmark.save}", |
2006 | SDLK_RETURN, | 2008 | SDLK_RETURN, |
2007 | KMOD_PRIMARY, | 2009 | KMOD_PRIMARY, |
2008 | "bmed.accept" } }, | 2010 | "bmed.accept" } }, |
@@ -2045,7 +2047,7 @@ iWidget *makeBookmarkCreation_Widget(const iString *url, const iString *title, i | |||
2045 | iWidget *dlg = makeBookmarkEditor_Widget(); | 2047 | iWidget *dlg = makeBookmarkEditor_Widget(); |
2046 | setId_Widget(dlg, "bmed.create"); | 2048 | setId_Widget(dlg, "bmed.create"); |
2047 | setTextCStr_LabelWidget(findChild_Widget(dlg, "bmed.heading"), | 2049 | setTextCStr_LabelWidget(findChild_Widget(dlg, "bmed.heading"), |
2048 | uiHeading_ColorEscape "ADD BOOKMARK"); | 2050 | uiHeading_ColorEscape "${heading.bookmark.add}"); |
2049 | iUrl parts; | 2051 | iUrl parts; |
2050 | init_Url(&parts, url); | 2052 | init_Url(&parts, url); |
2051 | setTextCStr_InputWidget(findChild_Widget(dlg, "bmed.title"), | 2053 | setTextCStr_InputWidget(findChild_Widget(dlg, "bmed.title"), |
@@ -2112,28 +2114,28 @@ iWidget *makeFeedSettings_Widget(uint32_t bookmarkId) { | |||
2112 | iWidget *dlg = makeSheet_Widget("feedcfg"); | 2114 | iWidget *dlg = makeSheet_Widget("feedcfg"); |
2113 | setId_Widget(addChildFlags_Widget( | 2115 | setId_Widget(addChildFlags_Widget( |
2114 | dlg, | 2116 | dlg, |
2115 | iClob(new_LabelWidget(bookmarkId ? uiHeading_ColorEscape "FEED SETTINGS" | 2117 | iClob(new_LabelWidget(bookmarkId ? uiHeading_ColorEscape "${heading.feedcfg}" |
2116 | : uiHeading_ColorEscape "SUBSCRIBE TO PAGE", | 2118 | : uiHeading_ColorEscape "${heading.subscribe}", |
2117 | NULL)), | 2119 | NULL)), |
2118 | frameless_WidgetFlag), | 2120 | frameless_WidgetFlag), |
2119 | "feedcfg.heading"); | 2121 | "feedcfg.heading"); |
2120 | iWidget *headings, *values; | 2122 | iWidget *headings, *values; |
2121 | addChild_Widget(dlg, iClob(makeTwoColumnWidget_(&headings, &values))); | 2123 | addChild_Widget(dlg, iClob(makeTwoColumnWidget_(&headings, &values))); |
2122 | addChild_Widget(headings, iClob(makeHeading_Widget("Title:"))); | 2124 | addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.feed.title}"))); |
2123 | iInputWidget *input = new_InputWidget(0); | 2125 | iInputWidget *input = new_InputWidget(0); |
2124 | setId_Widget(addChild_Widget(values, iClob(input)), "feedcfg.title"); | 2126 | setId_Widget(addChild_Widget(values, iClob(input)), "feedcfg.title"); |
2125 | addChild_Widget(headings, iClob(makeHeading_Widget("Entry type:"))); | 2127 | addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.feed.entrytype}"))); |
2126 | iWidget *types = new_Widget(); { | 2128 | iWidget *types = new_Widget(); { |
2127 | addRadioButton_(types, "feedcfg.type.gemini", "YYYY-MM-DD Links", "feedcfg.type arg:0"); | 2129 | addRadioButton_(types, "feedcfg.type.gemini", "${dlg.feed.type.gemini}", "feedcfg.type arg:0"); |
2128 | addRadioButton_(types, "feedcfg.type.headings", "New Headings", "feedcfg.type arg:1"); | 2130 | addRadioButton_(types, "feedcfg.type.headings", "${dlg.feed.type.headings}", "feedcfg.type arg:1"); |
2129 | } | 2131 | } |
2130 | addChildFlags_Widget(values, iClob(types), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); | 2132 | addChildFlags_Widget(values, iClob(types), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); |
2131 | iWidget *buttons = | 2133 | iWidget *buttons = |
2132 | addChild_Widget(dlg, | 2134 | addChild_Widget(dlg, |
2133 | iClob(makeDialogButtons_Widget( | 2135 | iClob(makeDialogButtons_Widget( |
2134 | (iMenuItem[]){ { "${cancel}", 0, 0, NULL }, | 2136 | (iMenuItem[]){ { "${cancel}", 0, 0, NULL }, |
2135 | { bookmarkId ? uiTextCaution_ColorEscape "Save Settings" | 2137 | { bookmarkId ? uiTextCaution_ColorEscape "${dlg.feed.save}" |
2136 | : uiTextCaution_ColorEscape "Subscribe", | 2138 | : uiTextCaution_ColorEscape "${dlg.feed.sub}", |
2137 | SDLK_RETURN, | 2139 | SDLK_RETURN, |
2138 | KMOD_PRIMARY, | 2140 | KMOD_PRIMARY, |
2139 | format_CStr("feedcfg.accept bmid:%d", bookmarkId) } }, | 2141 | format_CStr("feedcfg.accept bmid:%d", bookmarkId) } }, |
@@ -2161,14 +2163,14 @@ iWidget *makeIdentityCreation_Widget(void) { | |||
2161 | iWidget *dlg = makeSheet_Widget("ident"); | 2163 | iWidget *dlg = makeSheet_Widget("ident"); |
2162 | setId_Widget(addChildFlags_Widget( | 2164 | setId_Widget(addChildFlags_Widget( |
2163 | dlg, | 2165 | dlg, |
2164 | iClob(new_LabelWidget(uiHeading_ColorEscape "NEW IDENTITY", NULL)), | 2166 | iClob(new_LabelWidget(uiHeading_ColorEscape "${heading.newident}", NULL)), |
2165 | frameless_WidgetFlag), | 2167 | frameless_WidgetFlag), |
2166 | "ident.heading"); | 2168 | "ident.heading"); |
2167 | iWidget *page = new_Widget(); | 2169 | iWidget *page = new_Widget(); |
2168 | addChildFlags_Widget( | 2170 | addChildFlags_Widget( |
2169 | dlg, | 2171 | dlg, |
2170 | iClob( | 2172 | iClob( |
2171 | new_LabelWidget("Creating a self-signed 2048-bit RSA certificate.", NULL)), | 2173 | new_LabelWidget("${dlg.newident.rsa.selfsign}", NULL)), |
2172 | frameless_WidgetFlag); | 2174 | frameless_WidgetFlag); |
2173 | addChild_Widget(dlg, iClob(page)); | 2175 | addChild_Widget(dlg, iClob(page)); |
2174 | setFlags_Widget(page, arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag, iTrue); | 2176 | setFlags_Widget(page, arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag, iTrue); |
@@ -2177,35 +2179,35 @@ iWidget *makeIdentityCreation_Widget(void) { | |||
2177 | iWidget *values = addChildFlags_Widget( | 2179 | iWidget *values = addChildFlags_Widget( |
2178 | page, iClob(new_Widget()), arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag); | 2180 | page, iClob(new_Widget()), arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag); |
2179 | iInputWidget *inputs[6]; | 2181 | iInputWidget *inputs[6]; |
2180 | addChild_Widget(headings, iClob(makeHeading_Widget("Valid until:"))); | 2182 | addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.newident.until}"))); |
2181 | setId_Widget(addChild_Widget(values, iClob(newHint_InputWidget(19, "YYYY-MM-DD HH:MM:SS"))), "ident.until"); | 2183 | setId_Widget(addChild_Widget(values, iClob(newHint_InputWidget(19, "${hint.newident.date}"))), "ident.until"); |
2182 | addChild_Widget(headings, iClob(makeHeading_Widget("Common name:"))); | 2184 | addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.newident.commonname}"))); |
2183 | setId_Widget(addChild_Widget(values, iClob(inputs[0] = new_InputWidget(0))), "ident.common"); | 2185 | setId_Widget(addChild_Widget(values, iClob(inputs[0] = new_InputWidget(0))), "ident.common"); |
2184 | /* Temporary? */ { | 2186 | /* Temporary? */ { |
2185 | addChild_Widget(headings, iClob(makeHeading_Widget("Temporary:"))); | 2187 | addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.newident.temp}"))); |
2186 | iWidget *tmpGroup = new_Widget(); | 2188 | iWidget *tmpGroup = new_Widget(); |
2187 | setFlags_Widget(tmpGroup, arrangeSize_WidgetFlag | arrangeHorizontal_WidgetFlag, iTrue); | 2189 | setFlags_Widget(tmpGroup, arrangeSize_WidgetFlag | arrangeHorizontal_WidgetFlag, iTrue); |
2188 | addChild_Widget(tmpGroup, iClob(makeToggle_Widget("ident.temp"))); | 2190 | addChild_Widget(tmpGroup, iClob(makeToggle_Widget("ident.temp"))); |
2189 | setId_Widget( | 2191 | setId_Widget( |
2190 | addChildFlags_Widget( | 2192 | addChildFlags_Widget( |
2191 | tmpGroup, | 2193 | tmpGroup, |
2192 | iClob(new_LabelWidget(uiTextCaution_ColorEscape "\u26a0 not saved to disk", NULL)), | 2194 | iClob(new_LabelWidget(uiTextCaution_ColorEscape "\u26a0 ${dlg.newident.notsaved}", NULL)), |
2193 | hidden_WidgetFlag | frameless_WidgetFlag), | 2195 | hidden_WidgetFlag | frameless_WidgetFlag), |
2194 | "ident.temp.note"); | 2196 | "ident.temp.note"); |
2195 | addChild_Widget(values, iClob(tmpGroup)); | 2197 | addChild_Widget(values, iClob(tmpGroup)); |
2196 | } | 2198 | } |
2197 | addChild_Widget(headings, iClob(makePadding_Widget(gap_UI))); | 2199 | addChild_Widget(headings, iClob(makePadding_Widget(gap_UI))); |
2198 | addChild_Widget(values, iClob(makePadding_Widget(gap_UI))); | 2200 | addChild_Widget(values, iClob(makePadding_Widget(gap_UI))); |
2199 | addChild_Widget(headings, iClob(makeHeading_Widget("Email:"))); | 2201 | addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.newident.email}"))); |
2200 | setId_Widget(addChild_Widget(values, iClob(inputs[1] = newHint_InputWidget(0, "optional"))), "ident.email"); | 2202 | setId_Widget(addChild_Widget(values, iClob(inputs[1] = newHint_InputWidget(0, "${hint.newident.optional}"))), "ident.email"); |
2201 | addChild_Widget(headings, iClob(makeHeading_Widget("User ID:"))); | 2203 | addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.newident.userid}"))); |
2202 | setId_Widget(addChild_Widget(values, iClob(inputs[2] = newHint_InputWidget(0, "optional"))), "ident.userid"); | 2204 | setId_Widget(addChild_Widget(values, iClob(inputs[2] = newHint_InputWidget(0, "${hint.newident.optional}"))), "ident.userid"); |
2203 | addChild_Widget(headings, iClob(makeHeading_Widget("Domain:"))); | 2205 | addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.newident.domain}"))); |
2204 | setId_Widget(addChild_Widget(values, iClob(inputs[3] = newHint_InputWidget(0, "optional"))), "ident.domain"); | 2206 | setId_Widget(addChild_Widget(values, iClob(inputs[3] = newHint_InputWidget(0, "${hint.newident.optional}"))), "ident.domain"); |
2205 | addChild_Widget(headings, iClob(makeHeading_Widget("Organization:"))); | 2207 | addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.newident.org}"))); |
2206 | setId_Widget(addChild_Widget(values, iClob(inputs[4] = newHint_InputWidget(0, "optional"))), "ident.org"); | 2208 | setId_Widget(addChild_Widget(values, iClob(inputs[4] = newHint_InputWidget(0, "${hint.newident.optional}"))), "ident.org"); |
2207 | addChild_Widget(headings, iClob(makeHeading_Widget("Country:"))); | 2209 | addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.newident.country}"))); |
2208 | setId_Widget(addChild_Widget(values, iClob(inputs[5] = newHint_InputWidget(0, "optional"))), "ident.country"); | 2210 | setId_Widget(addChild_Widget(values, iClob(inputs[5] = newHint_InputWidget(0, "${hint.newident.optional}"))), "ident.country"); |
2209 | arrange_Widget(dlg); | 2211 | arrange_Widget(dlg); |
2210 | for (size_t i = 0; i < iElemCount(inputs); ++i) { | 2212 | for (size_t i = 0; i < iElemCount(inputs); ++i) { |
2211 | as_Widget(inputs[i])->rect.size.x = 100 * gap_UI - headings->rect.size.x; | 2213 | as_Widget(inputs[i])->rect.size.x = 100 * gap_UI - headings->rect.size.x; |
@@ -2213,7 +2215,7 @@ iWidget *makeIdentityCreation_Widget(void) { | |||
2213 | addChild_Widget( | 2215 | addChild_Widget( |
2214 | dlg, | 2216 | dlg, |
2215 | iClob(makeDialogButtons_Widget((iMenuItem[]){ { "${cancel}", 0, 0, NULL }, | 2217 | iClob(makeDialogButtons_Widget((iMenuItem[]){ { "${cancel}", 0, 0, NULL }, |
2216 | { uiTextAction_ColorEscape "Create Identity", | 2218 | { uiTextAction_ColorEscape "${dlg.newident.create}", |
2217 | SDLK_RETURN, | 2219 | SDLK_RETURN, |
2218 | KMOD_PRIMARY, | 2220 | KMOD_PRIMARY, |
2219 | "ident.accept" } }, | 2221 | "ident.accept" } }, |
@@ -2224,17 +2226,17 @@ iWidget *makeIdentityCreation_Widget(void) { | |||
2224 | } | 2226 | } |
2225 | 2227 | ||
2226 | static const iMenuItem languages[] = { | 2228 | static const iMenuItem languages[] = { |
2227 | { "Arabic", 0, 0, "xlt.lang id:ar" }, | 2229 | { "${lang.ar}", 0, 0, "xlt.lang id:ar" }, |
2228 | { "Chinese", 0, 0, "xlt.lang id:zh" }, | 2230 | { "${lang.zh}", 0, 0, "xlt.lang id:zh" }, |
2229 | { "English", 0, 0, "xlt.lang id:en" }, | 2231 | { "${lang.en}", 0, 0, "xlt.lang id:en" }, |
2230 | { "French", 0, 0, "xlt.lang id:fr" }, | 2232 | { "${lang.fr}", 0, 0, "xlt.lang id:fr" }, |
2231 | { "German", 0, 0, "xlt.lang id:de" }, | 2233 | { "${lang.de}", 0, 0, "xlt.lang id:de" }, |
2232 | { "Hindi", 0, 0, "xlt.lang id:hi" }, | 2234 | { "${lang.hi}", 0, 0, "xlt.lang id:hi" }, |
2233 | { "Italian", 0, 0, "xlt.lang id:it" }, | 2235 | { "${lang.it}", 0, 0, "xlt.lang id:it" }, |
2234 | { "Japanese", 0, 0, "xlt.lang id:ja" }, | 2236 | { "${lang.ja}", 0, 0, "xlt.lang id:ja" }, |
2235 | { "Portuguese", 0, 0, "xlt.lang id:pt" }, | 2237 | { "${lang.pt}", 0, 0, "xlt.lang id:pt" }, |
2236 | { "Russian", 0, 0, "xlt.lang id:ru" }, | 2238 | { "${lang.ru}", 0, 0, "xlt.lang id:ru" }, |
2237 | { "Spanish", 0, 0, "xlt.lang id:es" }, | 2239 | { "${lang.es}", 0, 0, "xlt.lang id:es" }, |
2238 | }; | 2240 | }; |
2239 | 2241 | ||
2240 | static iBool translationHandler_(iWidget *dlg, const char *cmd) { | 2242 | static iBool translationHandler_(iWidget *dlg, const char *cmd) { |
@@ -2251,7 +2253,7 @@ static iBool translationHandler_(iWidget *dlg, const char *cmd) { | |||
2251 | 2253 | ||
2252 | const char *languageId_String(const iString *menuItemLabel) { | 2254 | const char *languageId_String(const iString *menuItemLabel) { |
2253 | iForIndices(i, languages) { | 2255 | iForIndices(i, languages) { |
2254 | if (!cmp_String(menuItemLabel, languages[i].label)) { | 2256 | if (!cmp_String(menuItemLabel, translateCStr_Lang(languages[i].label))) { |
2255 | return cstr_Rangecc(range_Command(languages[i].command, "id")); | 2257 | return cstr_Rangecc(range_Command(languages[i].command, "id")); |
2256 | } | 2258 | } |
2257 | } | 2259 | } |
@@ -2272,7 +2274,7 @@ iWidget *makeTranslation_Widget(iWidget *parent) { | |||
2272 | setFlags_Widget(dlg, keepOnTop_WidgetFlag, iFalse); | 2274 | setFlags_Widget(dlg, keepOnTop_WidgetFlag, iFalse); |
2273 | setCommandHandler_Widget(dlg, translationHandler_); | 2275 | setCommandHandler_Widget(dlg, translationHandler_); |
2274 | addChildFlags_Widget(dlg, | 2276 | addChildFlags_Widget(dlg, |
2275 | iClob(new_LabelWidget(uiHeading_ColorEscape "TRANSLATE PAGE", NULL)), | 2277 | iClob(new_LabelWidget(uiHeading_ColorEscape "${heading.translate}", NULL)), |
2276 | frameless_WidgetFlag); | 2278 | frameless_WidgetFlag); |
2277 | addChild_Widget(dlg, iClob(makePadding_Widget(lineHeight_Text(uiLabel_FontId)))); | 2279 | addChild_Widget(dlg, iClob(makePadding_Widget(lineHeight_Text(uiLabel_FontId)))); |
2278 | iWidget *headings, *values; | 2280 | iWidget *headings, *values; |
@@ -2281,11 +2283,11 @@ iWidget *makeTranslation_Widget(iWidget *parent) { | |||
2281 | setId_Widget(page, "xlt.langs"); | 2283 | setId_Widget(page, "xlt.langs"); |
2282 | iLabelWidget *fromLang, *toLang; | 2284 | iLabelWidget *fromLang, *toLang; |
2283 | /* Source language. */ { | 2285 | /* Source language. */ { |
2284 | addChild_Widget(headings, iClob(makeHeading_Widget("From:"))); | 2286 | addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.translate.from}"))); |
2285 | setId_Widget( | 2287 | setId_Widget( |
2286 | addChildFlags_Widget(values, | 2288 | addChildFlags_Widget(values, |
2287 | iClob(fromLang = makeMenuButton_LabelWidget( | 2289 | iClob(fromLang = makeMenuButton_LabelWidget( |
2288 | "Portuguese", languages, iElemCount(languages))), | 2290 | "${lang.pt}", languages, iElemCount(languages))), |
2289 | alignLeft_WidgetFlag), | 2291 | alignLeft_WidgetFlag), |
2290 | "xlt.from"); | 2292 | "xlt.from"); |
2291 | iWidget *langMenu = findChild_Widget(as_Widget(fromLang), "menu"); | 2293 | iWidget *langMenu = findChild_Widget(as_Widget(fromLang), "menu"); |
@@ -2294,10 +2296,10 @@ iWidget *makeTranslation_Widget(iWidget *parent) { | |||
2294 | setBackgroundColor_Widget(langMenu, uiBackgroundMenu_ColorId); | 2296 | setBackgroundColor_Widget(langMenu, uiBackgroundMenu_ColorId); |
2295 | } | 2297 | } |
2296 | /* Target language. */ { | 2298 | /* Target language. */ { |
2297 | addChild_Widget(headings, iClob(makeHeading_Widget("To:"))); | 2299 | addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.translate.to}"))); |
2298 | setId_Widget(addChildFlags_Widget(values, | 2300 | setId_Widget(addChildFlags_Widget(values, |
2299 | iClob(toLang = makeMenuButton_LabelWidget( | 2301 | iClob(toLang = makeMenuButton_LabelWidget( |
2300 | "Portuguese", languages, iElemCount(languages))), | 2302 | "${lang.pt}", languages, iElemCount(languages))), |
2301 | alignLeft_WidgetFlag), | 2303 | alignLeft_WidgetFlag), |
2302 | "xlt.to"); | 2304 | "xlt.to"); |
2303 | iWidget *langMenu = findChild_Widget(as_Widget(toLang), "menu"); | 2305 | iWidget *langMenu = findChild_Widget(as_Widget(toLang), "menu"); |
@@ -2311,7 +2313,7 @@ iWidget *makeTranslation_Widget(iWidget *parent) { | |||
2311 | iClob(makeDialogButtons_Widget( | 2313 | iClob(makeDialogButtons_Widget( |
2312 | (iMenuItem[]){ | 2314 | (iMenuItem[]){ |
2313 | { "${cancel}", SDLK_ESCAPE, 0, "translation.cancel" }, | 2315 | { "${cancel}", SDLK_ESCAPE, 0, "translation.cancel" }, |
2314 | { uiTextAction_ColorEscape "Translate", SDLK_RETURN, 0, "translation.submit" } }, | 2316 | { uiTextAction_ColorEscape "${dlg.translate}", SDLK_RETURN, 0, "translation.submit" } }, |
2315 | 2))); | 2317 | 2))); |
2316 | addChild_Widget(parent, iClob(dlg)); | 2318 | addChild_Widget(parent, iClob(dlg)); |
2317 | arrange_Widget(dlg); | 2319 | arrange_Widget(dlg); |