diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/labelwidget.c | 17 | ||||
-rw-r--r-- | src/ui/uploadwidget.c | 25 | ||||
-rw-r--r-- | src/ui/util.c | 14 |
3 files changed, 33 insertions, 23 deletions
diff --git a/src/ui/labelwidget.c b/src/ui/labelwidget.c index d00733e1..9e0d37e4 100644 --- a/src/ui/labelwidget.c +++ b/src/ui/labelwidget.c | |||
@@ -195,6 +195,7 @@ static void getColors_LabelWidget_(const iLabelWidget *d, int *bg, int *fg, int | |||
195 | int *icon, int *meta) { | 195 | int *icon, int *meta) { |
196 | const iWidget *w = constAs_Widget(d); | 196 | const iWidget *w = constAs_Widget(d); |
197 | const int64_t flags = flags_Widget(w); | 197 | const int64_t flags = flags_Widget(w); |
198 | const iBool isHover = isHover_LabelWidget_(d); | ||
198 | const iBool isFocus = (flags & focusable_WidgetFlag && isFocused_Widget(d)); | 199 | const iBool isFocus = (flags & focusable_WidgetFlag && isFocused_Widget(d)); |
199 | const iBool isPress = (flags & pressed_WidgetFlag) != 0; | 200 | const iBool isPress = (flags & pressed_WidgetFlag) != 0; |
200 | const iBool isSel = (flags & selected_WidgetFlag) != 0; | 201 | const iBool isSel = (flags & selected_WidgetFlag) != 0; |
@@ -222,9 +223,6 @@ static void getColors_LabelWidget_(const iLabelWidget *d, int *bg, int *fg, int | |||
222 | if (isSel) { | 223 | if (isSel) { |
223 | if (!d->flags.checkMark) { | 224 | if (!d->flags.checkMark) { |
224 | *bg = uiBackgroundSelected_ColorId; | 225 | *bg = uiBackgroundSelected_ColorId; |
225 | // if (!isKeyRoot) { | ||
226 | // *bg = uiEmbossSelected1_ColorId; //uiBackgroundUnfocusedSelection_ColorId; | ||
227 | // } | ||
228 | if (!isKeyRoot) { | 226 | if (!isKeyRoot) { |
229 | *bg = isDark_ColorTheme(colorTheme_App()) ? uiBackgroundUnfocusedSelection_ColorId | 227 | *bg = isDark_ColorTheme(colorTheme_App()) ? uiBackgroundUnfocusedSelection_ColorId |
230 | : uiMarked_ColorId; | 228 | : uiMarked_ColorId; |
@@ -249,7 +247,7 @@ static void getColors_LabelWidget_(const iLabelWidget *d, int *bg, int *fg, int | |||
249 | if (colorEscape == uiTextCaution_ColorId) { | 247 | if (colorEscape == uiTextCaution_ColorId) { |
250 | *icon = *meta = colorEscape; | 248 | *icon = *meta = colorEscape; |
251 | } | 249 | } |
252 | if (isHover_LabelWidget_(d)) { | 250 | if (isHover) { |
253 | if (isFrameless) { | 251 | if (isFrameless) { |
254 | *bg = uiBackgroundFramelessHover_ColorId; | 252 | *bg = uiBackgroundFramelessHover_ColorId; |
255 | *fg = uiTextFramelessHover_ColorId; | 253 | *fg = uiTextFramelessHover_ColorId; |
@@ -275,7 +273,7 @@ static void getColors_LabelWidget_(const iLabelWidget *d, int *bg, int *fg, int | |||
275 | } | 273 | } |
276 | } | 274 | } |
277 | if (d->forceFg >= 0) { | 275 | if (d->forceFg >= 0) { |
278 | *fg = /* *icon = */ *meta = d->forceFg; | 276 | *fg = *meta = d->forceFg; |
279 | } | 277 | } |
280 | if (isPress) { | 278 | if (isPress) { |
281 | if (colorEscape == uiTextAction_ColorId || colorEscape == uiTextCaution_ColorId) { | 279 | if (colorEscape == uiTextAction_ColorId || colorEscape == uiTextCaution_ColorId) { |
@@ -290,14 +288,13 @@ static void getColors_LabelWidget_(const iLabelWidget *d, int *bg, int *fg, int | |||
290 | *frame1 = uiEmbossPressed1_ColorId; | 288 | *frame1 = uiEmbossPressed1_ColorId; |
291 | *frame2 = colorEscape != none_ColorId ? colorEscape : uiEmbossPressed2_ColorId; | 289 | *frame2 = colorEscape != none_ColorId ? colorEscape : uiEmbossPressed2_ColorId; |
292 | } | 290 | } |
293 | //if (colorEscape == none_ColorId || colorEscape == uiTextAction_ColorId) { | ||
294 | *fg = *icon = *meta = uiTextPressed_ColorId | permanent_ColorId; | 291 | *fg = *icon = *meta = uiTextPressed_ColorId | permanent_ColorId; |
295 | // } | ||
296 | // else { | ||
297 | // *fg = (isDark_ColorTheme(colorTheme_App()) ? white_ColorId : black_ColorId) | permanent_ColorId; | ||
298 | // } | ||
299 | } | 292 | } |
300 | } | 293 | } |
294 | if (((isSel || isHover) && isFrameless) || isPress) { | ||
295 | /* Ensure that the full label text remains readable. */ | ||
296 | *fg |= permanent_ColorId; | ||
297 | } | ||
301 | } | 298 | } |
302 | 299 | ||
303 | iLocalDef int iconPadding_LabelWidget_(const iLabelWidget *d) { | 300 | iLocalDef int iconPadding_LabelWidget_(const iLabelWidget *d) { |
diff --git a/src/ui/uploadwidget.c b/src/ui/uploadwidget.c index ef407b6d..e0bc3755 100644 --- a/src/ui/uploadwidget.c +++ b/src/ui/uploadwidget.c | |||
@@ -58,6 +58,7 @@ struct Impl_UploadWidget { | |||
58 | iLabelWidget * info; | 58 | iLabelWidget * info; |
59 | iInputWidget * mime; | 59 | iInputWidget * mime; |
60 | iInputWidget * token; | 60 | iInputWidget * token; |
61 | iLabelWidget * ident; | ||
61 | iInputWidget * input; | 62 | iInputWidget * input; |
62 | iLabelWidget * filePathLabel; | 63 | iLabelWidget * filePathLabel; |
63 | iLabelWidget * fileSizeLabel; | 64 | iLabelWidget * fileSizeLabel; |
@@ -124,9 +125,10 @@ static const iArray *makeIdentityItems_UploadWidget_(const iUploadWidget *d) { | |||
124 | iConstForEach(PtrArray, i, listIdentities_GmCerts(certs_App(), NULL, NULL)) { | 125 | iConstForEach(PtrArray, i, listIdentities_GmCerts(certs_App(), NULL, NULL)) { |
125 | const iGmIdentity *id = i.ptr; | 126 | const iGmIdentity *id = i.ptr; |
126 | iString *str = collect_String(copy_String(name_GmIdentity(id))); | 127 | iString *str = collect_String(copy_String(name_GmIdentity(id))); |
128 | prependCStr_String(str, uiTextStrong_ColorEscape); | ||
127 | if (!isEmpty_String(&id->notes)) { | 129 | if (!isEmpty_String(&id->notes)) { |
128 | appendFormat_String( | 130 | appendFormat_String( |
129 | str, "\n%s%s", escape_Color(uiAnnotation_ColorId), cstr_String(&id->notes)); | 131 | str, "\n%s%s", escape_Color(uiTextDim_ColorId), cstr_String(&id->notes)); |
130 | } | 132 | } |
131 | pushBack_Array( | 133 | pushBack_Array( |
132 | items, | 134 | items, |
@@ -259,19 +261,20 @@ void init_UploadWidget(iUploadWidget *d) { | |||
259 | /* Identity and Token. */ { | 261 | /* Identity and Token. */ { |
260 | addChild_Widget(w, iClob(makePadding_Widget(gap_UI))); | 262 | addChild_Widget(w, iClob(makePadding_Widget(gap_UI))); |
261 | iWidget *page = makeTwoColumns_Widget(&headings, &values); | 263 | iWidget *page = makeTwoColumns_Widget(&headings, &values); |
262 | /* Token. */ | ||
263 | d->token = addTwoColumnDialogInputField_Widget( | ||
264 | headings, values, "${upload.token}", "upload.token", iClob(new_InputWidget(0))); | ||
265 | setHint_InputWidget(d->token, "${hint.upload.token}"); | ||
266 | setFixedSize_Widget(as_Widget(d->token), init_I2(50 * gap_UI, -1)); | ||
267 | /* Identity. */ | 264 | /* Identity. */ |
268 | const iArray * identItems = makeIdentityItems_UploadWidget_(d); | 265 | const iArray * identItems = makeIdentityItems_UploadWidget_(d); |
269 | const iMenuItem *items = constData_Array(identItems); | 266 | const iMenuItem *items = constData_Array(identItems); |
270 | const size_t numItems = size_Array(identItems); | 267 | const size_t numItems = size_Array(identItems); |
271 | iLabelWidget * ident = makeMenuButton_LabelWidget("${upload.id}", items, numItems); | 268 | d->ident = makeMenuButton_LabelWidget("${upload.id}", items, numItems); |
272 | setTextCStr_LabelWidget(ident, items[findWidestLabel_MenuItem(items, numItems)].label); | 269 | setTextCStr_LabelWidget(d->ident, items[findWidestLabel_MenuItem(items, numItems)].label); |
270 | //setFixedSize_Widget(as_Widget(d->ident), init_I2(50 * gap_UI, )); | ||
273 | addChild_Widget(headings, iClob(makeHeading_Widget("${upload.id}"))); | 271 | addChild_Widget(headings, iClob(makeHeading_Widget("${upload.id}"))); |
274 | setId_Widget(addChildFlags_Widget(values, iClob(ident), alignLeft_WidgetFlag), "upload.id"); | 272 | setId_Widget(addChildFlags_Widget(values, iClob(d->ident), alignLeft_WidgetFlag), "upload.id"); |
273 | /* Token. */ | ||
274 | d->token = addTwoColumnDialogInputField_Widget( | ||
275 | headings, values, "${upload.token}", "upload.token", iClob(new_InputWidget(0))); | ||
276 | setHint_InputWidget(d->token, "${hint.upload.token}"); | ||
277 | setFixedSize_Widget(as_Widget(d->token), init_I2(50 * gap_UI, -1)); | ||
275 | addChild_Widget(w, iClob(page)); | 278 | addChild_Widget(w, iClob(page)); |
276 | } | 279 | } |
277 | /* Buttons. */ { | 280 | /* Buttons. */ { |
@@ -287,6 +290,8 @@ void init_UploadWidget(iUploadWidget *d) { | |||
287 | resizeToLargestPage_Widget(tabs); | 290 | resizeToLargestPage_Widget(tabs); |
288 | arrange_Widget(w); | 291 | arrange_Widget(w); |
289 | setFixedSize_Widget(as_Widget(d->token), init_I2(width_Widget(tabs) - left_Rect(parent_Widget(d->token)->rect), -1)); | 292 | setFixedSize_Widget(as_Widget(d->token), init_I2(width_Widget(tabs) - left_Rect(parent_Widget(d->token)->rect), -1)); |
293 | setFixedSize_Widget(as_Widget(d->ident), init_I2(width_Widget(d->token), | ||
294 | lineHeight_Text(uiLabel_FontId) + 2 * gap_UI)); | ||
290 | setFlags_Widget(as_Widget(d->token), expand_WidgetFlag, iTrue); | 295 | setFlags_Widget(as_Widget(d->token), expand_WidgetFlag, iTrue); |
291 | setFocus_Widget(as_Widget(d->input)); | 296 | setFocus_Widget(as_Widget(d->input)); |
292 | } | 297 | } |
@@ -560,7 +565,7 @@ static iBool processEvent_UploadWidget_(iUploadWidget *d, const SDL_Event *ev) { | |||
560 | destroy_Widget(w); | 565 | destroy_Widget(w); |
561 | return iTrue; | 566 | return iTrue; |
562 | } | 567 | } |
563 | else if (isCommand_Widget(w, ev, "input.resized")) { | 568 | else if (!isUsingPanelLayout_Mobile() && isCommand_Widget(w, ev, "input.resized")) { |
564 | resizeToLargestPage_Widget(findChild_Widget(w, "upload.tabs")); | 569 | resizeToLargestPage_Widget(findChild_Widget(w, "upload.tabs")); |
565 | arrange_Widget(w); | 570 | arrange_Widget(w); |
566 | refresh_Widget(w); | 571 | refresh_Widget(w); |
diff --git a/src/ui/util.c b/src/ui/util.c index 21067bf4..73fafe84 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -1327,6 +1327,12 @@ const iString *removeMenuItemLabelPrefixes_String(const iString *d) { | |||
1327 | return collect_String(str); | 1327 | return collect_String(str); |
1328 | } | 1328 | } |
1329 | 1329 | ||
1330 | static const iString *replaceNewlinesWithDash_(const iString *str) { | ||
1331 | iString *mod = copy_String(str); | ||
1332 | replace_String(mod, "\n", " "); | ||
1333 | return collect_String(mod); | ||
1334 | } | ||
1335 | |||
1330 | void updateDropdownSelection_LabelWidget(iLabelWidget *dropButton, const char *selectedCommand) { | 1336 | void updateDropdownSelection_LabelWidget(iLabelWidget *dropButton, const char *selectedCommand) { |
1331 | if (!dropButton) { | 1337 | if (!dropButton) { |
1332 | return; | 1338 | return; |
@@ -1337,8 +1343,9 @@ void updateDropdownSelection_LabelWidget(iLabelWidget *dropButton, const char *s | |||
1337 | iMenuItem *item = findNativeMenuItem_Widget(menu, selectedCommand); | 1343 | iMenuItem *item = findNativeMenuItem_Widget(menu, selectedCommand); |
1338 | if (item) { | 1344 | if (item) { |
1339 | setSelected_NativeMenuItem(item, iTrue); | 1345 | setSelected_NativeMenuItem(item, iTrue); |
1340 | updateText_LabelWidget( | 1346 | updateText_LabelWidget(dropButton, |
1341 | dropButton, removeMenuItemLabelPrefixes_String(collectNewCStr_String(item->label))); | 1347 | replaceNewlinesWithDash_(removeMenuItemLabelPrefixes_String( |
1348 | collectNewCStr_String(item->label)))); | ||
1342 | checkIcon_LabelWidget(dropButton); | 1349 | checkIcon_LabelWidget(dropButton); |
1343 | } | 1350 | } |
1344 | return; | 1351 | return; |
@@ -1349,7 +1356,8 @@ void updateDropdownSelection_LabelWidget(iLabelWidget *dropButton, const char *s | |||
1349 | const iBool isSelected = endsWith_String(command_LabelWidget(item), selectedCommand); | 1356 | const iBool isSelected = endsWith_String(command_LabelWidget(item), selectedCommand); |
1350 | setFlags_Widget(as_Widget(item), selected_WidgetFlag, isSelected); | 1357 | setFlags_Widget(as_Widget(item), selected_WidgetFlag, isSelected); |
1351 | if (isSelected) { | 1358 | if (isSelected) { |
1352 | updateText_LabelWidget(dropButton, sourceText_LabelWidget(item)); | 1359 | updateText_LabelWidget(dropButton, |
1360 | replaceNewlinesWithDash_(text_LabelWidget(item))); | ||
1353 | checkIcon_LabelWidget(dropButton); | 1361 | checkIcon_LabelWidget(dropButton); |
1354 | } | 1362 | } |
1355 | } | 1363 | } |