diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-17 18:35:22 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-17 18:36:38 +0200 |
commit | f4ced2f3da68b3e5cc4cbe25c26496646313fb63 (patch) | |
tree | aedfe234edb109adab57a3f75b36c1c8ed217df5 /src | |
parent | 6c3f8cc9345b506c44313d5266db9da5b1c454f4 (diff) |
Cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/util.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/ui/util.c b/src/ui/util.c index 400e65d4..e07e036a 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -1091,6 +1091,9 @@ void finalizeSheet_Widget(iWidget *sheet) { | |||
1091 | postRefresh_App(); | 1091 | postRefresh_App(); |
1092 | return; | 1092 | return; |
1093 | } | 1093 | } |
1094 | /* Modify the top sheet to act as a fullscreen background. */ | ||
1095 | setPadding1_Widget(sheet, 0); | ||
1096 | setBackgroundColor_Widget(sheet, uiBackground_ColorId); | ||
1094 | setFlags_Widget(sheet, | 1097 | setFlags_Widget(sheet, |
1095 | keepOnTop_WidgetFlag | | 1098 | keepOnTop_WidgetFlag | |
1096 | parentCannotResize_WidgetFlag | | 1099 | parentCannotResize_WidgetFlag | |
@@ -1105,27 +1108,25 @@ void finalizeSheet_Widget(iWidget *sheet) { | |||
1105 | frameless_WidgetFlag | | 1108 | frameless_WidgetFlag | |
1106 | resizeWidthOfChildren_WidgetFlag, | 1109 | resizeWidthOfChildren_WidgetFlag, |
1107 | iTrue); | 1110 | iTrue); |
1108 | setBackgroundColor_Widget(sheet, uiBackground_ColorId); | 1111 | iPtrArray * contents = collect_PtrArray(new_PtrArray()); /* two-column pages */ |
1109 | setPadding1_Widget(sheet, 0); | 1112 | iPtrArray * panelButtons = collect_PtrArray(new_PtrArray()); |
1110 | iPtrArray *contents = collect_PtrArray(new_PtrArray()); /* two-column pages */ | 1113 | iWidget * prefsTabs = findChild_Widget(sheet, "prefs.tabs"); |
1111 | iPtrArray *panelButtons = collect_PtrArray(new_PtrArray()); | 1114 | iWidget * dialogHeading = (prefsTabs ? NULL : child_Widget(sheet, 0)); |
1112 | iWidget *tabs = findChild_Widget(sheet, "prefs.tabs"); | 1115 | const iBool isPrefs = (prefsTabs != NULL); |
1113 | iWidget *dialogHeading = (tabs ? NULL : child_Widget(sheet, 0)); | ||
1114 | const iBool isPrefs = (tabs != NULL); | ||
1115 | const int64_t panelButtonFlags = borderBottom_WidgetFlag | alignLeft_WidgetFlag | | 1116 | const int64_t panelButtonFlags = borderBottom_WidgetFlag | alignLeft_WidgetFlag | |
1116 | frameless_WidgetFlag | extraPadding_WidgetFlag; | 1117 | frameless_WidgetFlag | extraPadding_WidgetFlag; |
1117 | iWidget *topPanel = new_Widget(); | 1118 | iWidget *topPanel = new_Widget(); |
1118 | setId_Widget(topPanel, "panel.top"); | 1119 | setId_Widget(topPanel, "panel.top"); |
1119 | addChild_Widget(topPanel, iClob(makePadding_Widget(lineHeight_Text(defaultBig_FontId)))); | 1120 | addChild_Widget(topPanel, iClob(makePadding_Widget(lineHeight_Text(defaultBig_FontId)))); |
1120 | if (tabs) { | 1121 | if (prefsTabs) { |
1121 | iRelease(removeChild_Widget(sheet, child_Widget(sheet, 0))); /* heading */ | 1122 | iRelease(removeChild_Widget(sheet, child_Widget(sheet, 0))); /* heading */ |
1122 | iRelease(removeChild_Widget(sheet, findChild_Widget(sheet, "dialogbuttons"))); | 1123 | iRelease(removeChild_Widget(sheet, findChild_Widget(sheet, "dialogbuttons"))); |
1123 | /* Pull out the pages and make them panels. */ | 1124 | /* Pull out the pages and make them panels. */ |
1124 | iWidget *pages = findChild_Widget(tabs, "tabs.pages"); | 1125 | iWidget *pages = findChild_Widget(prefsTabs, "tabs.pages"); |
1125 | size_t pageCount = tabCount_Widget(tabs); | 1126 | size_t pageCount = tabCount_Widget(prefsTabs); |
1126 | for (size_t i = 0; i < pageCount; i++) { | 1127 | for (size_t i = 0; i < pageCount; i++) { |
1127 | iString *text = copy_String(text_LabelWidget(tabPageButton_Widget(tabs, tabPage_Widget(tabs, 0)))); | 1128 | iString *text = copy_String(text_LabelWidget(tabPageButton_Widget(prefsTabs, tabPage_Widget(prefsTabs, 0)))); |
1128 | iWidget *page = removeTabPage_Widget(tabs, 0); | 1129 | iWidget *page = removeTabPage_Widget(prefsTabs, 0); |
1129 | iWidget *pageContent = child_Widget(page, 1); /* surrounded by padding widgets */ | 1130 | iWidget *pageContent = child_Widget(page, 1); /* surrounded by padding widgets */ |
1130 | pushBack_PtrArray(contents, ref_Object(pageContent)); | 1131 | pushBack_PtrArray(contents, ref_Object(pageContent)); |
1131 | iLabelWidget *panelButton; | 1132 | iLabelWidget *panelButton; |
@@ -1149,7 +1150,7 @@ void finalizeSheet_Widget(iWidget *sheet) { | |||
1149 | iRelease(page); | 1150 | iRelease(page); |
1150 | delete_String(text); | 1151 | delete_String(text); |
1151 | } | 1152 | } |
1152 | destroy_Widget(tabs); | 1153 | destroy_Widget(prefsTabs); |
1153 | } | 1154 | } |
1154 | iForEach(ObjectList, i, children_Widget(sheet)) { | 1155 | iForEach(ObjectList, i, children_Widget(sheet)) { |
1155 | iWidget *child = i.object; | 1156 | iWidget *child = i.object; |
@@ -1710,7 +1711,7 @@ static void appendFramelessTabPage_(iWidget *tabs, iWidget *page, const char *ti | |||
1710 | appendTabPage_Widget(tabs, page, title, shortcut, kmods); | 1711 | appendTabPage_Widget(tabs, page, title, shortcut, kmods); |
1711 | setFlags_Widget( | 1712 | setFlags_Widget( |
1712 | (iWidget *) back_ObjectList(children_Widget(findChild_Widget(tabs, "tabs.buttons"))), | 1713 | (iWidget *) back_ObjectList(children_Widget(findChild_Widget(tabs, "tabs.buttons"))), |
1713 | frameless_WidgetFlag, | 1714 | frameless_WidgetFlag | noBackground_WidgetFlag, |
1714 | iTrue); | 1715 | iTrue); |
1715 | } | 1716 | } |
1716 | 1717 | ||
@@ -1729,7 +1730,7 @@ static iWidget *appendTwoColumnPage_(iWidget *tabs, const char *title, int short | |||
1729 | /* TODO: Use `makeTwoColumnWidget_()`, see above. */ | 1730 | /* TODO: Use `makeTwoColumnWidget_()`, see above. */ |
1730 | iWidget *page = new_Widget(); | 1731 | iWidget *page = new_Widget(); |
1731 | setFlags_Widget(page, arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag | | 1732 | setFlags_Widget(page, arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag | |
1732 | resizeHeightOfChildren_WidgetFlag | borderTop_WidgetFlag, iTrue); | 1733 | resizeHeightOfChildren_WidgetFlag, iTrue); |
1733 | addChildFlags_Widget(page, iClob(new_Widget()), expand_WidgetFlag); | 1734 | addChildFlags_Widget(page, iClob(new_Widget()), expand_WidgetFlag); |
1734 | setPadding_Widget(page, 0, gap_UI, 0, gap_UI); | 1735 | setPadding_Widget(page, 0, gap_UI, 0, gap_UI); |
1735 | iWidget *columns = new_Widget(); | 1736 | iWidget *columns = new_Widget(); |
@@ -1784,6 +1785,7 @@ iWidget *makePreferences_Widget(void) { | |||
1784 | iClob(new_LabelWidget(uiHeading_ColorEscape "PREFERENCES", NULL)), | 1785 | iClob(new_LabelWidget(uiHeading_ColorEscape "PREFERENCES", NULL)), |
1785 | frameless_WidgetFlag); | 1786 | frameless_WidgetFlag); |
1786 | iWidget *tabs = makeTabs_Widget(dlg); | 1787 | iWidget *tabs = makeTabs_Widget(dlg); |
1788 | setBackgroundColor_Widget(findChild_Widget(tabs, "tabs.buttons"), uiBackgroundSidebar_ColorId); | ||
1787 | setId_Widget(tabs, "prefs.tabs"); | 1789 | setId_Widget(tabs, "prefs.tabs"); |
1788 | iWidget *headings, *values; | 1790 | iWidget *headings, *values; |
1789 | /* General preferences. */ { | 1791 | /* General preferences. */ { |
@@ -1942,7 +1944,6 @@ iWidget *makePreferences_Widget(void) { | |||
1942 | /* Keybindings. */ | 1944 | /* Keybindings. */ |
1943 | if (deviceType_App() == desktop_AppDeviceType) { | 1945 | if (deviceType_App() == desktop_AppDeviceType) { |
1944 | iBindingsWidget *bind = new_BindingsWidget(); | 1946 | iBindingsWidget *bind = new_BindingsWidget(); |
1945 | setFlags_Widget(as_Widget(bind), borderTop_WidgetFlag, iTrue); | ||
1946 | appendFramelessTabPage_(tabs, iClob(bind), "Keys", '6', KMOD_PRIMARY); | 1947 | appendFramelessTabPage_(tabs, iClob(bind), "Keys", '6', KMOD_PRIMARY); |
1947 | } | 1948 | } |
1948 | addChild_Widget(dlg, iClob(makePadding_Widget(gap_UI))); | 1949 | addChild_Widget(dlg, iClob(makePadding_Widget(gap_UI))); |