diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-13 14:22:58 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-13 14:22:58 +0300 |
commit | 1e179aaa9b97fcf4564ca3a3e71c301c8b2ebc47 (patch) | |
tree | caef5143055a864ff3d9956d77a6fc47ffeed613 /src/ui | |
parent | 9ecd573a049f5f699d6913c14d14cea2fa53ad06 (diff) |
Preferences: Reorganized fonts dropdown
Fonts are grouped by type.
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/util.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/ui/util.c b/src/ui/util.c index e410ded1..cc17a0d3 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -1901,13 +1901,26 @@ static void addRadioButton_(iWidget *parent, const char *id, const char *label, | |||
1901 | } | 1901 | } |
1902 | 1902 | ||
1903 | static void addFontButtons_(iWidget *parent, const char *id) { | 1903 | static void addFontButtons_(iWidget *parent, const char *id) { |
1904 | const char *fontNames[] = { | 1904 | const struct { |
1905 | "Nunito", "Fira Sans", "Literata", "Tinos", "Source Sans 3", "Iosevka" | 1905 | const char * name; |
1906 | }; | 1906 | enum iTextFont cfgId; |
1907 | } fonts[] = { { "Nunito", nunito_TextFont }, | ||
1908 | { "Source Sans 3", sourceSans3_TextFont }, | ||
1909 | { "Fira Sans", firaSans_TextFont }, | ||
1910 | { "---", -1 }, | ||
1911 | { "Literata", literata_TextFont }, | ||
1912 | { "Tinos", tinos_TextFont }, | ||
1913 | { "---", -1 }, | ||
1914 | { "Iosevka", iosevka_TextFont } }; | ||
1907 | iArray *items = new_Array(sizeof(iMenuItem)); | 1915 | iArray *items = new_Array(sizeof(iMenuItem)); |
1908 | iForIndices(i, fontNames) { | 1916 | iForIndices(i, fonts) { |
1909 | pushBack_Array(items, | 1917 | pushBack_Array(items, |
1910 | &(iMenuItem){ fontNames[i], 0, 0, format_CStr("!%s.set arg:%d", id, i) }); | 1918 | &(iMenuItem){ fonts[i].name, |
1919 | 0, | ||
1920 | 0, | ||
1921 | fonts[i].cfgId >= 0 | ||
1922 | ? format_CStr("!%s.set arg:%d", id, fonts[i].cfgId) | ||
1923 | : NULL }); | ||
1911 | } | 1924 | } |
1912 | iLabelWidget *button = makeMenuButton_LabelWidget("Source Sans 3", data_Array(items), size_Array(items)); | 1925 | iLabelWidget *button = makeMenuButton_LabelWidget("Source Sans 3", data_Array(items), size_Array(items)); |
1913 | setBackgroundColor_Widget(findChild_Widget(as_Widget(button), "menu"), uiBackgroundMenu_ColorId); | 1926 | setBackgroundColor_Widget(findChild_Widget(as_Widget(button), "menu"), uiBackgroundMenu_ColorId); |