diff options
Diffstat (limited to 'src/ui/util.c')
-rw-r--r-- | src/ui/util.c | 97 |
1 files changed, 50 insertions, 47 deletions
diff --git a/src/ui/util.c b/src/ui/util.c index 39cfce13..ab7e9ebf 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -2951,6 +2951,7 @@ iWidget *makeBookmarkEditor_Widget(void) { | |||
2951 | { "${cancel}", 0, 0, "bmed.cancel" }, | 2951 | { "${cancel}", 0, 0, "bmed.cancel" }, |
2952 | { uiTextCaution_ColorEscape "${dlg.bookmark.save}", SDLK_RETURN, KMOD_PRIMARY, "bmed.accept" } | 2952 | { uiTextCaution_ColorEscape "${dlg.bookmark.save}", SDLK_RETURN, KMOD_PRIMARY, "bmed.accept" } |
2953 | }; | 2953 | }; |
2954 | iWidget *dlg = NULL; | ||
2954 | if (isUsingPanelLayout_Mobile()) { | 2955 | if (isUsingPanelLayout_Mobile()) { |
2955 | const iArray *folderItems = makeBookmarkFolderItems_(iTrue); | 2956 | const iArray *folderItems = makeBookmarkFolderItems_(iTrue); |
2956 | const iMenuItem items[] = { | 2957 | const iMenuItem items[] = { |
@@ -2969,56 +2970,58 @@ iWidget *makeBookmarkEditor_Widget(void) { | |||
2969 | { "toggle id:bmed.tag.linksplit text:${bookmark.tag.linksplit}" }, | 2970 | { "toggle id:bmed.tag.linksplit text:${bookmark.tag.linksplit}" }, |
2970 | { NULL } | 2971 | { NULL } |
2971 | }; | 2972 | }; |
2972 | iWidget *dlg = makePanels_Mobile("bmed", items, actions, iElemCount(actions)); | 2973 | dlg = makePanels_Mobile("bmed", items, actions, iElemCount(actions)); |
2973 | setupSheetTransition_Mobile(dlg, iTrue); | 2974 | setupSheetTransition_Mobile(dlg, iTrue); |
2974 | return dlg; | ||
2975 | } | 2975 | } |
2976 | iWidget *dlg = makeSheet_Widget("bmed"); | 2976 | else { |
2977 | setId_Widget(addChildFlags_Widget( | 2977 | dlg = makeSheet_Widget("bmed"); |
2978 | dlg, | 2978 | setId_Widget(addChildFlags_Widget( |
2979 | iClob(new_LabelWidget(uiHeading_ColorEscape "${heading.bookmark.edit}", NULL)), | 2979 | dlg, |
2980 | frameless_WidgetFlag), | 2980 | iClob(new_LabelWidget(uiHeading_ColorEscape "${heading.bookmark.edit}", NULL)), |
2981 | "bmed.heading"); | 2981 | frameless_WidgetFlag), |
2982 | iWidget *headings, *values; | 2982 | "bmed.heading"); |
2983 | addChild_Widget(dlg, iClob(makeTwoColumns_Widget(&headings, &values))); | 2983 | iWidget *headings, *values; |
2984 | iInputWidget *inputs[4]; | 2984 | addChild_Widget(dlg, iClob(makeTwoColumns_Widget(&headings, &values))); |
2985 | /* Folder to add to. */ { | 2985 | iInputWidget *inputs[4]; |
2986 | addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.bookmark.folder}"))); | 2986 | /* Folder to add to. */ { |
2987 | const iArray *folderItems = makeBookmarkFolderItems_(iFalse); | 2987 | addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.bookmark.folder}"))); |
2988 | iLabelWidget *folderButton; | 2988 | const iArray *folderItems = makeBookmarkFolderItems_(iFalse); |
2989 | setId_Widget(addChildFlags_Widget(values, | 2989 | iLabelWidget *folderButton; |
2990 | iClob(folderButton = makeMenuButton_LabelWidget( | 2990 | setId_Widget(addChildFlags_Widget(values, |
2991 | widestLabel_MenuItemArray(folderItems), | 2991 | iClob(folderButton = makeMenuButton_LabelWidget( |
2992 | constData_Array(folderItems), | 2992 | widestLabel_MenuItemArray(folderItems), |
2993 | size_Array(folderItems))), alignLeft_WidgetFlag), | 2993 | constData_Array(folderItems), |
2994 | "bmed.folder"); | 2994 | size_Array(folderItems))), alignLeft_WidgetFlag), |
2995 | const uint32_t recentFolderId = recentFolder_Bookmarks(bookmarks_App()); | 2995 | "bmed.folder"); |
2996 | updateDropdownSelection_LabelWidget( | 2996 | } |
2997 | folderButton, format_CStr(" arg:%u", recentFolderId)); | 2997 | addDialogInputWithHeading_(headings, values, "${dlg.bookmark.title}", "bmed.title", iClob(inputs[0] = new_InputWidget(0))); |
2998 | setUserData_Object(folderButton, get_Bookmarks(bookmarks_App(), recentFolderId)); | 2998 | addDialogInputWithHeading_(headings, values, "${dlg.bookmark.url}", "bmed.url", iClob(inputs[1] = new_InputWidget(0))); |
2999 | } | 2999 | setUrlContent_InputWidget(inputs[1], iTrue); |
3000 | addDialogInputWithHeading_(headings, values, "${dlg.bookmark.title}", "bmed.title", iClob(inputs[0] = new_InputWidget(0))); | 3000 | addDialogInputWithHeading_(headings, values, "${dlg.bookmark.tags}", "bmed.tags", iClob(inputs[2] = new_InputWidget(0))); |
3001 | addDialogInputWithHeading_(headings, values, "${dlg.bookmark.url}", "bmed.url", iClob(inputs[1] = new_InputWidget(0))); | 3001 | addDialogInputWithHeading_(headings, values, "${dlg.bookmark.icon}", "bmed.icon", iClob(inputs[3] = new_InputWidget(1))); |
3002 | setUrlContent_InputWidget(inputs[1], iTrue); | 3002 | /* Buttons for special tags. */ |
3003 | addDialogInputWithHeading_(headings, values, "${dlg.bookmark.tags}", "bmed.tags", iClob(inputs[2] = new_InputWidget(0))); | 3003 | addChild_Widget(dlg, iClob(makePadding_Widget(gap_UI))); |
3004 | addDialogInputWithHeading_(headings, values, "${dlg.bookmark.icon}", "bmed.icon", iClob(inputs[3] = new_InputWidget(1))); | 3004 | iWidget *special = addChild_Widget(dlg, iClob(makeTwoColumns_Widget(&headings, &values))); |
3005 | /* Buttons for special tags. */ | 3005 | setFlags_Widget(special, collapse_WidgetFlag, iTrue); |
3006 | addChild_Widget(dlg, iClob(makePadding_Widget(gap_UI))); | 3006 | setId_Widget(special, "bmed.special"); |
3007 | iWidget *special = addChild_Widget(dlg, iClob(makeTwoColumns_Widget(&headings, &values))); | 3007 | makeTwoColumnHeading_("${heading.bookmark.tags}", headings, values); |
3008 | setFlags_Widget(special, collapse_WidgetFlag, iTrue); | 3008 | addDialogToggle_(headings, values, "${bookmark.tag.home}", "bmed.tag.home"); |
3009 | setId_Widget(special, "bmed.special"); | 3009 | addDialogToggle_(headings, values, "${bookmark.tag.remote}", "bmed.tag.remote"); |
3010 | makeTwoColumnHeading_("${heading.bookmark.tags}", headings, values); | 3010 | addDialogToggle_(headings, values, "${bookmark.tag.linksplit}", "bmed.tag.linksplit"); |
3011 | addDialogToggle_(headings, values, "${bookmark.tag.home}", "bmed.tag.home"); | 3011 | arrange_Widget(dlg); |
3012 | addDialogToggle_(headings, values, "${bookmark.tag.remote}", "bmed.tag.remote"); | 3012 | for (int i = 0; i < 3; ++i) { |
3013 | addDialogToggle_(headings, values, "${bookmark.tag.linksplit}", "bmed.tag.linksplit"); | 3013 | as_Widget(inputs[i])->rect.size.x = 100 * gap_UI - headings->rect.size.x; |
3014 | arrange_Widget(dlg); | 3014 | } |
3015 | for (int i = 0; i < 3; ++i) { | 3015 | addChild_Widget(dlg, iClob(makePadding_Widget(gap_UI))); |
3016 | as_Widget(inputs[i])->rect.size.x = 100 * gap_UI - headings->rect.size.x; | 3016 | addChild_Widget(dlg, iClob(makeDialogButtons_Widget(actions, iElemCount(actions)))); |
3017 | addChild_Widget(get_Root()->widget, iClob(dlg)); | ||
3018 | setupSheetTransition_Mobile(dlg, iTrue); | ||
3017 | } | 3019 | } |
3018 | addChild_Widget(dlg, iClob(makePadding_Widget(gap_UI))); | 3020 | /* Use a recently accessed folder as the default. */ |
3019 | addChild_Widget(dlg, iClob(makeDialogButtons_Widget(actions, iElemCount(actions)))); | 3021 | const uint32_t recentFolderId = recentFolder_Bookmarks(bookmarks_App()); |
3020 | addChild_Widget(get_Root()->widget, iClob(dlg)); | 3022 | iLabelWidget *folderDrop = findChild_Widget(dlg, "bmed.folder"); |
3021 | setupSheetTransition_Mobile(dlg, iTrue); | 3023 | updateDropdownSelection_LabelWidget(folderDrop, format_CStr(" arg:%u", recentFolderId)); |
3024 | setUserData_Object(folderDrop, get_Bookmarks(bookmarks_App(), recentFolderId)); | ||
3022 | return dlg; | 3025 | return dlg; |
3023 | } | 3026 | } |
3024 | 3027 | ||