summaryrefslogtreecommitdiff
path: root/src/ui/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/util.c')
-rw-r--r--src/ui/util.c62
1 files changed, 56 insertions, 6 deletions
diff --git a/src/ui/util.c b/src/ui/util.c
index 5dd8a0bd..41f8eaa9 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -903,6 +903,7 @@ iWidget *makeMenu_Widget(iWidget *parent, const iMenuItem *items, size_t n) {
903#else 903#else
904 /* Non-native custom popup menu. This may still be displayed inside a separate window. */ 904 /* Non-native custom popup menu. This may still be displayed inside a separate window. */
905 setDrawBufferEnabled_Widget(menu, iTrue); 905 setDrawBufferEnabled_Widget(menu, iTrue);
906 setFrameColor_Widget(menu, uiSeparator_ColorId);
906 setBackgroundColor_Widget(menu, uiBackgroundMenu_ColorId); 907 setBackgroundColor_Widget(menu, uiBackgroundMenu_ColorId);
907 if (deviceType_App() != desktop_AppDeviceType) { 908 if (deviceType_App() != desktop_AppDeviceType) {
908 setPadding1_Widget(menu, 2 * gap_UI); 909 setPadding1_Widget(menu, 2 * gap_UI);
@@ -1084,12 +1085,12 @@ void openMenuFlags_Widget(iWidget *d, iInt2 windowCoord, int menuOpenFlags) {
1084 setFlags_Widget(d, hidden_WidgetFlag, iFalse); 1085 setFlags_Widget(d, hidden_WidgetFlag, iFalse);
1085 setFlags_Widget(d, commandOnMouseMiss_WidgetFlag, iTrue); 1086 setFlags_Widget(d, commandOnMouseMiss_WidgetFlag, iTrue);
1086 setFlags_Widget(findChild_Widget(d, "menu.cancel"), disabled_WidgetFlag, iFalse); 1087 setFlags_Widget(findChild_Widget(d, "menu.cancel"), disabled_WidgetFlag, iFalse);
1087 if (!isPortraitPhone) { 1088// if (!isPortraitPhone) {
1088 setFrameColor_Widget(d, uiBackgroundSelected_ColorId); 1089// setFrameColor_Widget(d, uiSeparator_ColorId);
1089 } 1090// }
1090 else { 1091// else {
1091 setFrameColor_Widget(d, none_ColorId); 1092// setFrameColor_Widget(d, none_ColorId);
1092 } 1093// }
1093 arrange_Widget(d); /* need to know the height */ 1094 arrange_Widget(d); /* need to know the height */
1094 iBool allowOverflow = iFalse; 1095 iBool allowOverflow = iFalse;
1095 /* A vertical offset determined by a possible selected label in the menu. */ 1096 /* A vertical offset determined by a possible selected label in the menu. */
@@ -1327,6 +1328,7 @@ int checkContextMenu_Widget(iWidget *menu, const SDL_Event *ev) {
1327iLabelWidget *makeMenuButton_LabelWidget(const char *label, const iMenuItem *items, size_t n) { 1328iLabelWidget *makeMenuButton_LabelWidget(const char *label, const iMenuItem *items, size_t n) {
1328 iLabelWidget *button = new_LabelWidget(label, "menu.open"); 1329 iLabelWidget *button = new_LabelWidget(label, "menu.open");
1329 iWidget *menu = makeMenu_Widget(as_Widget(button), items, n); 1330 iWidget *menu = makeMenu_Widget(as_Widget(button), items, n);
1331 setFrameColor_Widget(menu, uiBackgroundSelected_ColorId);
1330 setId_Widget(menu, "menu"); 1332 setId_Widget(menu, "menu");
1331 return button; 1333 return button;
1332} 1334}
@@ -3451,6 +3453,54 @@ iWidget *makeTranslation_Widget(iWidget *parent) {
3451 return dlg; 3453 return dlg;
3452} 3454}
3453 3455
3456iWidget *makeGlyphFinder_Widget(void) {
3457 iString msg;
3458 iString command;
3459 init_String(&msg);
3460 initCStr_String(&command, "!font.find chars:");
3461 for (size_t i = 0; ; i++) {
3462 iChar ch = missing_Text(i);
3463 if (!ch) break;
3464 appendFormat_String(&msg, " U+%04X", ch);
3465 appendChar_String(&command, ch);
3466 }
3467 iArray items;
3468 init_Array(&items, sizeof(iMenuItem));
3469 if (!isEmpty_String(&msg)) {
3470 prependCStr_String(&msg, "${dlg.glyphfinder.missing} ");
3471 appendCStr_String(&msg, "\n\n${dlg.glyphfinder.help}");
3472 pushBackN_Array(
3473 &items,
3474 (iMenuItem[]){
3475 { "${menu.fonts}", 0, 0, "!open newtab:1 url:about:fonts" },
3476 { "${dlg.glyphfinder.disable}", 0, 0, "prefs.font.warnmissing.changed arg:0" },
3477 { "---" },
3478 { uiTextCaution_ColorEscape magnifyingGlass_Icon " ${dlg.glyphfinder.search}",
3479 0,
3480 0,
3481 cstr_String(&command) },
3482 { "${close}", 0, 0, "cancel" } },
3483 5);
3484 }
3485 else {
3486 setCStr_String(&msg, "${dlg.glyphfinder.help.empty}");
3487 pushBackN_Array(&items,
3488 (iMenuItem[]){ { "${menu.reload}", 0, 0, "navigate.reload" },
3489 { "${close}", 0, 0, "cancel" } },
3490 2);
3491 }
3492 iWidget *dlg = makeQuestion_Widget("${heading.glyphfinder}", cstr_String(&msg),
3493 constData_Array(&items),
3494 size_Array(&items));
3495 arrange_Widget(dlg);
3496 deinit_Array(&items);
3497 deinit_String(&command);
3498 deinit_String(&msg);
3499 return dlg;
3500}
3501
3502/*----------------------------------------------------------------------------------------------*/
3503
3454void init_PerfTimer(iPerfTimer *d) { 3504void init_PerfTimer(iPerfTimer *d) {
3455 d->ticks = SDL_GetPerformanceCounter(); 3505 d->ticks = SDL_GetPerformanceCounter();
3456} 3506}