summaryrefslogtreecommitdiff
path: root/src/ui/util.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-02-26 10:26:31 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-02-26 10:26:31 +0200
commitce377bd4b703b3fb6ac8ae40b9bbd1ede2e4ca26 (patch)
treee1a5d7d506a06ba26764b0892e26b0de1875365e /src/ui/util.c
parent91a6225d8508db01574d7da2c013cb30d6a87ec8 (diff)
Visual design improvements
URL input field has a maximum width. Adjusted navbar appearance and margins. Tuned UI palette and added UI accent color preference.
Diffstat (limited to 'src/ui/util.c')
-rw-r--r--src/ui/util.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/ui/util.c b/src/ui/util.c
index 5cdac391..3e57c2b5 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -472,8 +472,12 @@ iWidget *makeMenu_Widget(iWidget *parent, const iMenuItem *items, size_t n) {
472 iClob(newKeyMods_LabelWidget(item->label, item->key, item->kmods, item->command)), 472 iClob(newKeyMods_LabelWidget(item->label, item->key, item->kmods, item->command)),
473 frameless_WidgetFlag | alignLeft_WidgetFlag | drawKey_WidgetFlag); 473 frameless_WidgetFlag | alignLeft_WidgetFlag | drawKey_WidgetFlag);
474 updateSize_LabelWidget(label); /* drawKey was set */ 474 updateSize_LabelWidget(label); /* drawKey was set */
475 if (deviceType_App() != desktop_AppDeviceType) { 475 const iBool isCaution = startsWith_CStr(item->label, uiTextCaution_ColorEscape);
476 setFont_LabelWidget(label, uiContent_FontId); 476 if (deviceType_App() == tablet_AppDeviceType) {
477 setFont_LabelWidget(label, isCaution ? uiContentBold_FontId : uiContent_FontId);
478 }
479 else if (deviceType_App() == desktop_AppDeviceType) {
480 setFont_LabelWidget(label, isCaution ? uiLabelBold_FontId : uiLabel_FontId);
477 } 481 }
478 } 482 }
479 } 483 }
@@ -669,7 +673,8 @@ static void addTabPage_Widget_(iWidget *tabs, enum iWidgetAddPos addPos, iWidget
669 addPos); 673 addPos);
670 setFlags_Widget(buttons, hidden_WidgetFlag, iFalse); 674 setFlags_Widget(buttons, hidden_WidgetFlag, iFalse);
671 setFlags_Widget(button, selected_WidgetFlag, isSel); 675 setFlags_Widget(button, selected_WidgetFlag, isSel);
672 setFlags_Widget(button, commandOnClick_WidgetFlag | expand_WidgetFlag, iTrue); 676 setFlags_Widget(
677 button, noTopFrame_WidgetFlag | commandOnClick_WidgetFlag | expand_WidgetFlag, iTrue);
673 addChildPos_Widget(pages, page, addPos); 678 addChildPos_Widget(pages, page, addPos);
674 setFlags_Widget(page, hidden_WidgetFlag | disabled_WidgetFlag, !isSel); 679 setFlags_Widget(page, hidden_WidgetFlag | disabled_WidgetFlag, !isSel);
675} 680}
@@ -1025,7 +1030,7 @@ void updateValueInput_Widget(iWidget *d, const char *title, const char *prompt)
1025 1030
1026static iBool messageHandler_(iWidget *msg, const char *cmd) { 1031static iBool messageHandler_(iWidget *msg, const char *cmd) {
1027 /* Almost any command dismisses the sheet. */ 1032 /* Almost any command dismisses the sheet. */
1028 if (!(equal_Command(cmd, "media.updated") || 1033 if (!(equal_Command(cmd, "media.updated") ||
1029 equal_Command(cmd, "media.player.update") || 1034 equal_Command(cmd, "media.player.update") ||
1030 equal_Command(cmd, "bookmarks.request.finished") || 1035 equal_Command(cmd, "bookmarks.request.finished") ||
1031 equal_Command(cmd, "document.autoreload") || 1036 equal_Command(cmd, "document.autoreload") ||
@@ -1197,6 +1202,13 @@ iWidget *makePreferences_Widget(void) {
1197 setId_Widget(addChild_Widget(themes, iClob(new_LabelWidget("Pure White", "theme.set arg:3"))), "prefs.theme.3"); 1202 setId_Widget(addChild_Widget(themes, iClob(new_LabelWidget("Pure White", "theme.set arg:3"))), "prefs.theme.3");
1198 } 1203 }
1199 addChildFlags_Widget(values, iClob(themes), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); 1204 addChildFlags_Widget(values, iClob(themes), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag);
1205 /* Accents. */
1206 iWidget *accent = new_Widget(); {
1207 setId_Widget(addChild_Widget(accent, iClob(new_LabelWidget("Teal", "accent.set arg:0"))), "prefs.accent.0");
1208 setId_Widget(addChild_Widget(accent, iClob(new_LabelWidget("Orange", "accent.set arg:1"))), "prefs.accent.1");
1209 }
1210 addChild_Widget(headings, iClob(makeHeading_Widget("Accent color:")));
1211 addChildFlags_Widget(values, iClob(accent), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag);
1200#if defined (LAGRANGE_CUSTOM_FRAME) 1212#if defined (LAGRANGE_CUSTOM_FRAME)
1201 addChild_Widget(headings, iClob(makeHeading_Widget("Custom window frame:"))); 1213 addChild_Widget(headings, iClob(makeHeading_Widget("Custom window frame:")));
1202 addChild_Widget(values, iClob(makeToggle_Widget("prefs.customframe"))); 1214 addChild_Widget(values, iClob(makeToggle_Widget("prefs.customframe")));
@@ -1327,7 +1339,7 @@ iWidget *makePreferences_Widget(void) {
1327 iClob(makeDialogButtons_( 1339 iClob(makeDialogButtons_(
1328 (iMenuItem[]){ { "Dismiss", SDLK_ESCAPE, 0, "prefs.dismiss" } }, 1))); 1340 (iMenuItem[]){ { "Dismiss", SDLK_ESCAPE, 0, "prefs.dismiss" } }, 1)));
1329 addChild_Widget(get_Window()->root, iClob(dlg)); 1341 addChild_Widget(get_Window()->root, iClob(dlg));
1330 centerSheet_Widget(dlg); 1342 centerSheet_Widget(dlg);
1331 return dlg; 1343 return dlg;
1332} 1344}
1333 1345