diff options
Diffstat (limited to 'src/ui/root.c')
-rw-r--r-- | src/ui/root.c | 141 |
1 files changed, 101 insertions, 40 deletions
diff --git a/src/ui/root.c b/src/ui/root.c index 15548e74..5266978b 100644 --- a/src/ui/root.c +++ b/src/ui/root.c | |||
@@ -52,10 +52,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
52 | 52 | ||
53 | #include <SDL_timer.h> | 53 | #include <SDL_timer.h> |
54 | 54 | ||
55 | #if defined (iPlatformAppleDesktop) | ||
56 | # define iHaveNativeMenus | ||
57 | #endif | ||
58 | |||
59 | #if defined (iPlatformPcDesktop) | 55 | #if defined (iPlatformPcDesktop) |
60 | /* TODO: Submenus wouldn't hurt here. */ | 56 | /* TODO: Submenus wouldn't hurt here. */ |
61 | static const iMenuItem navMenuItems_[] = { | 57 | static const iMenuItem navMenuItems_[] = { |
@@ -90,6 +86,7 @@ static const iMenuItem navMenuItems_[] = { | |||
90 | #if defined (iPlatformAppleMobile) | 86 | #if defined (iPlatformAppleMobile) |
91 | /* Tablet menu. */ | 87 | /* Tablet menu. */ |
92 | static const iMenuItem tabletNavMenuItems_[] = { | 88 | static const iMenuItem tabletNavMenuItems_[] = { |
89 | { folder_Icon " ${menu.openfile}", SDLK_o, KMOD_PRIMARY, "file.open" }, | ||
93 | { add_Icon " ${menu.newtab}", 't', KMOD_PRIMARY, "tabs.new" }, | 90 | { add_Icon " ${menu.newtab}", 't', KMOD_PRIMARY, "tabs.new" }, |
94 | { close_Icon " ${menu.closetab}", 'w', KMOD_PRIMARY, "tabs.close" }, | 91 | { close_Icon " ${menu.closetab}", 'w', KMOD_PRIMARY, "tabs.close" }, |
95 | { "---", 0, 0, NULL }, | 92 | { "---", 0, 0, NULL }, |
@@ -110,6 +107,7 @@ static const iMenuItem tabletNavMenuItems_[] = { | |||
110 | 107 | ||
111 | /* Phone menu. */ | 108 | /* Phone menu. */ |
112 | static const iMenuItem phoneNavMenuItems_[] = { | 109 | static const iMenuItem phoneNavMenuItems_[] = { |
110 | { folder_Icon " ${menu.openfile}", SDLK_o, KMOD_PRIMARY, "file.open" }, | ||
113 | { add_Icon " ${menu.newtab}", 't', KMOD_PRIMARY, "tabs.new" }, | 111 | { add_Icon " ${menu.newtab}", 't', KMOD_PRIMARY, "tabs.new" }, |
114 | { close_Icon " ${menu.closetab}", 'w', KMOD_PRIMARY, "tabs.close" }, | 112 | { close_Icon " ${menu.closetab}", 'w', KMOD_PRIMARY, "tabs.close" }, |
115 | { "---", 0, 0, NULL }, | 113 | { "---", 0, 0, NULL }, |
@@ -273,7 +271,8 @@ void destroyPending_Root(iRoot *d) { | |||
273 | setCurrent_Root(d); | 271 | setCurrent_Root(d); |
274 | iForEach(PtrSet, i, d->pendingDestruction) { | 272 | iForEach(PtrSet, i, d->pendingDestruction) { |
275 | iWidget *widget = *i.value; | 273 | iWidget *widget = *i.value; |
276 | if (!isFinished_Anim(&widget->visualOffset)) { | 274 | if (!isFinished_Anim(&widget->visualOffset) || |
275 | isBeingVisuallyOffsetByReference_Widget(widget)) { | ||
277 | continue; | 276 | continue; |
278 | } | 277 | } |
279 | if (widget->flags & keepOnTop_WidgetFlag) { | 278 | if (widget->flags & keepOnTop_WidgetFlag) { |
@@ -282,7 +281,7 @@ void destroyPending_Root(iRoot *d) { | |||
282 | if (widget->parent) { | 281 | if (widget->parent) { |
283 | removeChild_Widget(widget->parent, widget); | 282 | removeChild_Widget(widget->parent, widget); |
284 | } | 283 | } |
285 | iAssert(widget->parent == NULL); | 284 | iAssert(widget->parent == NULL); |
286 | iRelease(widget); | 285 | iRelease(widget); |
287 | remove_PtrSetIterator(&i); | 286 | remove_PtrSetIterator(&i); |
288 | } | 287 | } |
@@ -433,9 +432,9 @@ static void updateNavBarIdentity_(iWidget *navBar) { | |||
433 | const iGmIdentity *ident = | 432 | const iGmIdentity *ident = |
434 | identityForUrl_GmCerts(certs_App(), url_DocumentWidget(document_App())); | 433 | identityForUrl_GmCerts(certs_App(), url_DocumentWidget(document_App())); |
435 | iWidget *button = findChild_Widget(navBar, "navbar.ident"); | 434 | iWidget *button = findChild_Widget(navBar, "navbar.ident"); |
436 | iWidget *tool = findWidget_App("toolbar.ident"); | 435 | iLabelWidget *toolButton = findWidget_App("toolbar.ident"); |
437 | setFlags_Widget(button, selected_WidgetFlag, ident != NULL); | 436 | setFlags_Widget(button, selected_WidgetFlag, ident != NULL); |
438 | setFlags_Widget(tool, selected_WidgetFlag, ident != NULL); | 437 | setOutline_LabelWidget(toolButton, ident == NULL); |
439 | /* Update menu. */ | 438 | /* Update menu. */ |
440 | iLabelWidget *idItem = child_Widget(findChild_Widget(button, "menu"), 0); | 439 | iLabelWidget *idItem = child_Widget(findChild_Widget(button, "menu"), 0); |
441 | const iString *subjectName = ident ? name_GmIdentity(ident) : NULL; | 440 | const iString *subjectName = ident ? name_GmIdentity(ident) : NULL; |
@@ -444,6 +443,12 @@ static void updateNavBarIdentity_(iWidget *navBar) { | |||
444 | subjectName ? format_CStr(uiTextAction_ColorEscape "%s", cstr_String(subjectName)) | 443 | subjectName ? format_CStr(uiTextAction_ColorEscape "%s", cstr_String(subjectName)) |
445 | : "${menu.identity.notactive}"); | 444 | : "${menu.identity.notactive}"); |
446 | setFlags_Widget(as_Widget(idItem), disabled_WidgetFlag, !ident); | 445 | setFlags_Widget(as_Widget(idItem), disabled_WidgetFlag, !ident); |
446 | iLabelWidget *toolName = findWidget_App("toolbar.name"); | ||
447 | if (toolName) { | ||
448 | updateTextCStr_LabelWidget(toolName, subjectName ? cstr_String(subjectName) : ""); | ||
449 | setFont_LabelWidget(toolButton, subjectName ? defaultMedium_FontId : uiLabelLarge_FontId); | ||
450 | arrange_Widget(parent_Widget(toolButton)); | ||
451 | } | ||
447 | } | 452 | } |
448 | 453 | ||
449 | static void updateNavDirButtons_(iWidget *navBar) { | 454 | static void updateNavDirButtons_(iWidget *navBar) { |
@@ -515,6 +520,26 @@ void updatePadding_Root(iRoot *d) { | |||
515 | #endif | 520 | #endif |
516 | } | 521 | } |
517 | 522 | ||
523 | void updateToolbarColors_Root(iRoot *d) { | ||
524 | #if defined (iPlatformMobile) | ||
525 | iWidget *toolBar = findChild_Widget(d->widget, "toolbar"); | ||
526 | if (toolBar) { | ||
527 | const iBool isSidebarVisible = isVisible_Widget(findChild_Widget(d->widget, "sidebar")); | ||
528 | const int bg = isSidebarVisible ? uiBackgroundSidebar_ColorId : | ||
529 | tmBannerBackground_ColorId; | ||
530 | setBackgroundColor_Widget(toolBar, bg); | ||
531 | iForEach(ObjectList, i, children_Widget(toolBar)) { | ||
532 | iLabelWidget *btn = i.object; | ||
533 | setTextColor_LabelWidget(i.object, isSidebarVisible ? uiTextDim_ColorId : | ||
534 | tmBannerIcon_ColorId); | ||
535 | setBackgroundColor_Widget(i.object, bg); /* using noBackground, but ident has outline */ | ||
536 | } | ||
537 | } | ||
538 | #else | ||
539 | iUnused(d); | ||
540 | #endif | ||
541 | } | ||
542 | |||
518 | void dismissPortraitPhoneSidebars_Root(iRoot *d) { | 543 | void dismissPortraitPhoneSidebars_Root(iRoot *d) { |
519 | if (deviceType_App() == phone_AppDeviceType && isPortrait_App()) { | 544 | if (deviceType_App() == phone_AppDeviceType && isPortrait_App()) { |
520 | iWidget *sidebar = findChild_Widget(d->widget, "sidebar"); | 545 | iWidget *sidebar = findChild_Widget(d->widget, "sidebar"); |
@@ -551,9 +576,16 @@ static void updateUrlInputContentPadding_(iWidget *navBar) { | |||
551 | } | 576 | } |
552 | 577 | ||
553 | static void showSearchQueryIndicator_(iBool show) { | 578 | static void showSearchQueryIndicator_(iBool show) { |
579 | iWidget *navBar = findWidget_Root("navbar"); | ||
554 | iWidget *indicator = findWidget_App("input.indicator.search"); | 580 | iWidget *indicator = findWidget_App("input.indicator.search"); |
581 | updateTextCStr_LabelWidget((iLabelWidget *) indicator, | ||
582 | (deviceType_App() == phone_AppDeviceType || | ||
583 | flags_Widget(navBar) & tight_WidgetFlag) | ||
584 | ? "${status.query.tight} " return_Icon | ||
585 | : "${status.query} " return_Icon); | ||
586 | indicator->rect.size.x = defaultSize_LabelWidget((iLabelWidget *) indicator).x; /* don't touch height */ | ||
555 | showCollapsed_Widget(indicator, show); | 587 | showCollapsed_Widget(indicator, show); |
556 | updateUrlInputContentPadding_(findWidget_Root("navbar")); | 588 | updateUrlInputContentPadding_(navBar); |
557 | } | 589 | } |
558 | 590 | ||
559 | static int navBarAvailableSpace_(iWidget *navBar) { | 591 | static int navBarAvailableSpace_(iWidget *navBar) { |
@@ -692,6 +724,7 @@ static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) { | |||
692 | iInputWidget *url = findWidget_Root("url"); | 724 | iInputWidget *url = findWidget_Root("url"); |
693 | const iString *urlStr = collect_String(suffix_Command(cmd, "url")); | 725 | const iString *urlStr = collect_String(suffix_Command(cmd, "url")); |
694 | trimCache_App(); | 726 | trimCache_App(); |
727 | trimMemory_App(); | ||
695 | visitUrl_Visited(visited_App(), withSpacesEncoded_String(urlStr), 0); /* TODO: internal URI normalization */ | 728 | visitUrl_Visited(visited_App(), withSpacesEncoded_String(urlStr), 0); /* TODO: internal URI normalization */ |
696 | postCommand_App("visited.changed"); /* sidebar will update */ | 729 | postCommand_App("visited.changed"); /* sidebar will update */ |
697 | setText_InputWidget(url, urlStr); | 730 | setText_InputWidget(url, urlStr); |
@@ -827,20 +860,20 @@ static iBool handleToolBarCommands_(iWidget *toolBar, const char *cmd) { | |||
827 | const int viewHeight = size_Root(get_Root()).y; | 860 | const int viewHeight = size_Root(get_Root()).y; |
828 | if (arg_Command(cmd) >= 0) { | 861 | if (arg_Command(cmd) >= 0) { |
829 | postCommandf_App("sidebar.mode arg:%d show:1", arg_Command(cmd)); | 862 | postCommandf_App("sidebar.mode arg:%d show:1", arg_Command(cmd)); |
830 | if (!isVisible) { | 863 | // if (!isVisible) { |
831 | setVisualOffset_Widget(sidebar, viewHeight, 0, 0); | 864 | // setVisualOffset_Widget(sidebar, viewHeight, 0, 0); |
832 | setVisualOffset_Widget(sidebar, 0, 400, easeOut_AnimFlag | softer_AnimFlag); | 865 | // setVisualOffset_Widget(sidebar, 0, 400, easeOut_AnimFlag | softer_AnimFlag); |
833 | } | 866 | // } |
834 | } | 867 | } |
835 | else { | 868 | else { |
836 | postCommandf_App("sidebar.toggle"); | 869 | postCommandf_App("sidebar.toggle"); |
837 | if (isVisible) { | 870 | // if (isVisible) { |
838 | setVisualOffset_Widget(sidebar, height_Widget(sidebar), 250, easeIn_AnimFlag); | 871 | // setVisualOffset_Widget(sidebar, height_Widget(sidebar), 250, easeIn_AnimFlag); |
839 | } | 872 | // } |
840 | else { | 873 | // else { |
841 | setVisualOffset_Widget(sidebar, viewHeight, 0, 0); | 874 | // setVisualOffset_Widget(sidebar, viewHeight, 0, 0); |
842 | setVisualOffset_Widget(sidebar, 0, 400, easeOut_AnimFlag | softer_AnimFlag); | 875 | // setVisualOffset_Widget(sidebar, 0, 400, easeOut_AnimFlag | softer_AnimFlag); |
843 | } | 876 | // } |
844 | } | 877 | } |
845 | return iTrue; | 878 | return iTrue; |
846 | } | 879 | } |
@@ -848,7 +881,10 @@ static iBool handleToolBarCommands_(iWidget *toolBar, const char *cmd) { | |||
848 | /* TODO: Clean this up. */ | 881 | /* TODO: Clean this up. */ |
849 | iWidget *sidebar = findWidget_App("sidebar"); | 882 | iWidget *sidebar = findWidget_App("sidebar"); |
850 | iWidget *sidebar2 = findWidget_App("sidebar2"); | 883 | iWidget *sidebar2 = findWidget_App("sidebar2"); |
851 | dismissSidebar_(sidebar, "toolbar.view"); | 884 | //dismissSidebar_(sidebar, "toolbar.view"); |
885 | if (isVisible_Widget(sidebar)) { | ||
886 | postCommandf_App("sidebar.toggle"); | ||
887 | } | ||
852 | const iBool isVisible = isVisible_Widget(sidebar2); | 888 | const iBool isVisible = isVisible_Widget(sidebar2); |
853 | // setFlags_Widget(findChild_Widget(toolBar, "toolbar.ident"), noBackground_WidgetFlag, | 889 | // setFlags_Widget(findChild_Widget(toolBar, "toolbar.ident"), noBackground_WidgetFlag, |
854 | // isVisible); | 890 | // isVisible); |
@@ -921,6 +957,23 @@ void updateMetrics_Root(iRoot *d) { | |||
921 | updatePadding_Root(d); | 957 | updatePadding_Root(d); |
922 | arrange_Widget(d->widget); | 958 | arrange_Widget(d->widget); |
923 | updateUrlInputContentPadding_(navBar); | 959 | updateUrlInputContentPadding_(navBar); |
960 | /* Position the toolbar identity name label manually. */ { | ||
961 | iLabelWidget *idName = findChild_Widget(d->widget, "toolbar.name"); | ||
962 | if (idName) { | ||
963 | const iWidget *toolBar = findChild_Widget(d->widget, "toolbar"); | ||
964 | const iWidget *viewButton = findChild_Widget(d->widget, "toolbar.view"); | ||
965 | const iWidget *idButton = findChild_Widget(toolBar, "toolbar.ident"); | ||
966 | const int font = defaultSmall_FontId; | ||
967 | setFont_LabelWidget(idName, font); | ||
968 | setPos_Widget(as_Widget(idName), | ||
969 | windowToLocal_Widget(as_Widget(idName), | ||
970 | init_I2(left_Rect(bounds_Widget(idButton)), | ||
971 | bottom_Rect(bounds_Widget(viewButton)) - | ||
972 | lineHeight_Text(font) - gap_UI / 2))); | ||
973 | setFixedSize_Widget(as_Widget(idName), init_I2(width_Widget(idButton), | ||
974 | lineHeight_Text(font))); | ||
975 | } | ||
976 | } | ||
924 | postRefresh_App(); | 977 | postRefresh_App(); |
925 | } | 978 | } |
926 | 979 | ||
@@ -1048,9 +1101,9 @@ void createUserInterface_Root(iRoot *d) { | |||
1048 | resizeHeightOfChildren_WidgetFlag | | 1101 | resizeHeightOfChildren_WidgetFlag | |
1049 | moveToParentRightEdge_WidgetFlag); | 1102 | moveToParentRightEdge_WidgetFlag); |
1050 | /* Feeds refresh indicator is inside the input field. */ { | 1103 | /* Feeds refresh indicator is inside the input field. */ { |
1051 | iLabelWidget *queryInd = | 1104 | iLabelWidget *queryInd = new_LabelWidget("${status.query} " return_Icon, NULL); |
1052 | new_LabelWidget(uiTextAction_ColorEscape "${status.query} " return_Icon, NULL); | ||
1053 | setId_Widget(as_Widget(queryInd), "input.indicator.search"); | 1105 | setId_Widget(as_Widget(queryInd), "input.indicator.search"); |
1106 | setTextColor_LabelWidget(queryInd, uiTextAction_ColorId); | ||
1054 | setBackgroundColor_Widget(as_Widget(queryInd), uiBackground_ColorId); | 1107 | setBackgroundColor_Widget(as_Widget(queryInd), uiBackground_ColorId); |
1055 | setFrameColor_Widget(as_Widget(queryInd), uiTextAction_ColorId); | 1108 | setFrameColor_Widget(as_Widget(queryInd), uiTextAction_ColorId); |
1056 | setAlignVisually_LabelWidget(queryInd, iTrue); | 1109 | setAlignVisually_LabelWidget(queryInd, iTrue); |
@@ -1060,9 +1113,9 @@ void createUserInterface_Root(iRoot *d) { | |||
1060 | collapse_WidgetFlag | hidden_WidgetFlag); | 1113 | collapse_WidgetFlag | hidden_WidgetFlag); |
1061 | } | 1114 | } |
1062 | /* Feeds refresh indicator is inside the input field. */ { | 1115 | /* Feeds refresh indicator is inside the input field. */ { |
1063 | iLabelWidget *fprog = new_LabelWidget(uiTextCaution_ColorEscape | 1116 | iLabelWidget *fprog = new_LabelWidget("", NULL); |
1064 | "\u2605 ${status.feeds}", NULL); | ||
1065 | setId_Widget(as_Widget(fprog), "feeds.progress"); | 1117 | setId_Widget(as_Widget(fprog), "feeds.progress"); |
1118 | setTextColor_LabelWidget(fprog, uiTextCaution_ColorId); | ||
1066 | setBackgroundColor_Widget(as_Widget(fprog), uiBackground_ColorId); | 1119 | setBackgroundColor_Widget(as_Widget(fprog), uiBackground_ColorId); |
1067 | setAlignVisually_LabelWidget(fprog, iTrue); | 1120 | setAlignVisually_LabelWidget(fprog, iTrue); |
1068 | setNoAutoMinHeight_LabelWidget(fprog, iTrue); | 1121 | setNoAutoMinHeight_LabelWidget(fprog, iTrue); |
@@ -1116,7 +1169,7 @@ void createUserInterface_Root(iRoot *d) { | |||
1116 | setId_Widget(as_Widget(pageMenuButton), "pagemenubutton"); | 1169 | setId_Widget(as_Widget(pageMenuButton), "pagemenubutton"); |
1117 | setFont_LabelWidget(pageMenuButton, uiContentBold_FontId); | 1170 | setFont_LabelWidget(pageMenuButton, uiContentBold_FontId); |
1118 | setAlignVisually_LabelWidget(pageMenuButton, iTrue); | 1171 | setAlignVisually_LabelWidget(pageMenuButton, iTrue); |
1119 | addChildFlags_Widget(urlButtons, iClob(pageMenuButton), embedFlags); | 1172 | addChildFlags_Widget(urlButtons, iClob(pageMenuButton), embedFlags | tight_WidgetFlag); |
1120 | updateSize_LabelWidget(pageMenuButton); | 1173 | updateSize_LabelWidget(pageMenuButton); |
1121 | } | 1174 | } |
1122 | /* Reload button. */ { | 1175 | /* Reload button. */ { |
@@ -1146,11 +1199,11 @@ void createUserInterface_Root(iRoot *d) { | |||
1146 | #if !defined (iHaveNativeMenus) | 1199 | #if !defined (iHaveNativeMenus) |
1147 | # if defined (iPlatformAppleMobile) | 1200 | # if defined (iPlatformAppleMobile) |
1148 | iLabelWidget *navMenu = | 1201 | iLabelWidget *navMenu = |
1149 | makeMenuButton_LabelWidget("\U0001d362", isPhone ? phoneNavMenuItems_ : tabletNavMenuItems_, | 1202 | makeMenuButton_LabelWidget(menu_Icon, isPhone ? phoneNavMenuItems_ : tabletNavMenuItems_, |
1150 | isPhone ? iElemCount(phoneNavMenuItems_) : iElemCount(tabletNavMenuItems_)); | 1203 | isPhone ? iElemCount(phoneNavMenuItems_) : iElemCount(tabletNavMenuItems_)); |
1151 | # else | 1204 | # else |
1152 | iLabelWidget *navMenu = | 1205 | iLabelWidget *navMenu = |
1153 | makeMenuButton_LabelWidget("\U0001d362", navMenuItems_, iElemCount(navMenuItems_)); | 1206 | makeMenuButton_LabelWidget(menu_Icon, navMenuItems_, iElemCount(navMenuItems_)); |
1154 | # endif | 1207 | # endif |
1155 | setAlignVisually_LabelWidget(navMenu, iTrue); | 1208 | setAlignVisually_LabelWidget(navMenu, iTrue); |
1156 | setId_Widget(addChildFlags_Widget(navBar, iClob(navMenu), collapse_WidgetFlag), "navbar.menu"); | 1209 | setId_Widget(addChildFlags_Widget(navBar, iClob(navMenu), collapse_WidgetFlag), "navbar.menu"); |
@@ -1161,11 +1214,11 @@ void createUserInterface_Root(iRoot *d) { | |||
1161 | setId_Widget(mainStack, "stack"); | 1214 | setId_Widget(mainStack, "stack"); |
1162 | addChildFlags_Widget(div, iClob(mainStack), resizeChildren_WidgetFlag | expand_WidgetFlag | | 1215 | addChildFlags_Widget(div, iClob(mainStack), resizeChildren_WidgetFlag | expand_WidgetFlag | |
1163 | unhittable_WidgetFlag); | 1216 | unhittable_WidgetFlag); |
1164 | iWidget *tabBar = makeTabs_Widget(mainStack); | 1217 | iWidget *docTabs = makeTabs_Widget(mainStack); |
1165 | setId_Widget(tabBar, "doctabs"); | 1218 | setId_Widget(docTabs, "doctabs"); |
1166 | setBackgroundColor_Widget(tabBar, uiBackground_ColorId); | 1219 | setBackgroundColor_Widget(docTabs, uiBackground_ColorId); |
1167 | appendTabPage_Widget(tabBar, iClob(new_DocumentWidget()), "Document", 0, 0); | 1220 | appendTabPage_Widget(docTabs, iClob(new_DocumentWidget()), "Document", 0, 0); |
1168 | iWidget *buttons = findChild_Widget(tabBar, "tabs.buttons"); | 1221 | iWidget *buttons = findChild_Widget(docTabs, "tabs.buttons"); |
1169 | setFlags_Widget(buttons, collapse_WidgetFlag | hidden_WidgetFlag | | 1222 | setFlags_Widget(buttons, collapse_WidgetFlag | hidden_WidgetFlag | |
1170 | drawBackgroundToHorizontalSafeArea_WidgetFlag, iTrue); | 1223 | drawBackgroundToHorizontalSafeArea_WidgetFlag, iTrue); |
1171 | if (deviceType_App() == phone_AppDeviceType) { | 1224 | if (deviceType_App() == phone_AppDeviceType) { |
@@ -1177,9 +1230,9 @@ void createUserInterface_Root(iRoot *d) { | |||
1177 | } | 1230 | } |
1178 | /* Sidebars. */ { | 1231 | /* Sidebars. */ { |
1179 | iWidget *content = findChild_Widget(root, "tabs.content"); | 1232 | iWidget *content = findChild_Widget(root, "tabs.content"); |
1180 | iSidebarWidget *sidebar1 = new_SidebarWidget(left_SideBarSide); | 1233 | iSidebarWidget *sidebar1 = new_SidebarWidget(left_SidebarSide); |
1181 | addChildPos_Widget(content, iClob(sidebar1), front_WidgetAddPos); | 1234 | addChildPos_Widget(content, iClob(sidebar1), front_WidgetAddPos); |
1182 | iSidebarWidget *sidebar2 = new_SidebarWidget(right_SideBarSide); | 1235 | iSidebarWidget *sidebar2 = new_SidebarWidget(right_SidebarSide); |
1183 | if (deviceType_App() != phone_AppDeviceType) { | 1236 | if (deviceType_App() != phone_AppDeviceType) { |
1184 | addChildPos_Widget(content, iClob(sidebar2), back_WidgetAddPos); | 1237 | addChildPos_Widget(content, iClob(sidebar2), back_WidgetAddPos); |
1185 | } | 1238 | } |
@@ -1218,6 +1271,7 @@ void createUserInterface_Root(iRoot *d) { | |||
1218 | setHint_InputWidget(input, "${hint.findtext}"); | 1271 | setHint_InputWidget(input, "${hint.findtext}"); |
1219 | setSelectAllOnFocus_InputWidget(input, iTrue); | 1272 | setSelectAllOnFocus_InputWidget(input, iTrue); |
1220 | setEatEscape_InputWidget(input, iFalse); /* unfocus and close with one keypress */ | 1273 | setEatEscape_InputWidget(input, iFalse); /* unfocus and close with one keypress */ |
1274 | setEnterInsertsLF_InputWidget(input, iFalse); | ||
1221 | setId_Widget(addChildFlags_Widget(searchBar, iClob(input), expand_WidgetFlag), | 1275 | setId_Widget(addChildFlags_Widget(searchBar, iClob(input), expand_WidgetFlag), |
1222 | "find.input"); | 1276 | "find.input"); |
1223 | addChild_Widget(searchBar, iClob(newIcon_LabelWidget(" \u2b9f ", 'g', KMOD_PRIMARY, "find.next"))); | 1277 | addChild_Widget(searchBar, iClob(newIcon_LabelWidget(" \u2b9f ", 'g', KMOD_PRIMARY, "find.next"))); |
@@ -1237,7 +1291,6 @@ void createUserInterface_Root(iRoot *d) { | |||
1237 | arrangeHeight_WidgetFlag | arrangeHorizontal_WidgetFlag | | 1291 | arrangeHeight_WidgetFlag | arrangeHorizontal_WidgetFlag | |
1238 | commandOnClick_WidgetFlag | | 1292 | commandOnClick_WidgetFlag | |
1239 | drawBackgroundToBottom_WidgetFlag, iTrue); | 1293 | drawBackgroundToBottom_WidgetFlag, iTrue); |
1240 | setBackgroundColor_Widget(toolBar, tmBannerBackground_ColorId); | ||
1241 | setId_Widget(addChildFlags_Widget(toolBar, | 1294 | setId_Widget(addChildFlags_Widget(toolBar, |
1242 | iClob(newLargeIcon_LabelWidget("\U0001f870", "navigate.back")), | 1295 | iClob(newLargeIcon_LabelWidget("\U0001f870", "navigate.back")), |
1243 | frameless_WidgetFlag), | 1296 | frameless_WidgetFlag), |
@@ -1254,7 +1307,16 @@ void createUserInterface_Root(iRoot *d) { | |||
1254 | iClob(newLargeIcon_LabelWidget(book_Icon, "toolbar.showview arg:-1")), | 1307 | iClob(newLargeIcon_LabelWidget(book_Icon, "toolbar.showview arg:-1")), |
1255 | frameless_WidgetFlag | commandOnClick_WidgetFlag), | 1308 | frameless_WidgetFlag | commandOnClick_WidgetFlag), |
1256 | "toolbar.view"); | 1309 | "toolbar.view"); |
1257 | iLabelWidget *menuButton = makeMenuButton_LabelWidget("\U0001d362", phoneNavMenuItems_, | 1310 | setId_Widget(addChildFlags_Widget(toolBar, |
1311 | iClob(new_LabelWidget("", "toolbar.showident")), | ||
1312 | frameless_WidgetFlag | | ||
1313 | noBackground_WidgetFlag | | ||
1314 | fixedPosition_WidgetFlag | | ||
1315 | fixedSize_WidgetFlag | | ||
1316 | ignoreForParentWidth_WidgetFlag | | ||
1317 | ignoreForParentHeight_WidgetFlag), | ||
1318 | "toolbar.name"); | ||
1319 | iLabelWidget *menuButton = makeMenuButton_LabelWidget(menu_Icon, phoneNavMenuItems_, | ||
1258 | iElemCount(phoneNavMenuItems_)); | 1320 | iElemCount(phoneNavMenuItems_)); |
1259 | setFont_LabelWidget(menuButton, uiLabelLarge_FontId); | 1321 | setFont_LabelWidget(menuButton, uiLabelLarge_FontId); |
1260 | setId_Widget(as_Widget(menuButton), "toolbar.navmenu"); | 1322 | setId_Widget(as_Widget(menuButton), "toolbar.navmenu"); |
@@ -1262,9 +1324,8 @@ void createUserInterface_Root(iRoot *d) { | |||
1262 | iForEach(ObjectList, i, children_Widget(toolBar)) { | 1324 | iForEach(ObjectList, i, children_Widget(toolBar)) { |
1263 | iLabelWidget *btn = i.object; | 1325 | iLabelWidget *btn = i.object; |
1264 | setFlags_Widget(i.object, noBackground_WidgetFlag, iTrue); | 1326 | setFlags_Widget(i.object, noBackground_WidgetFlag, iTrue); |
1265 | setTextColor_LabelWidget(i.object, tmBannerIcon_ColorId); | ||
1266 | // setBackgroundColor_Widget(i.object, tmBannerSideTitle_ColorId); | ||
1267 | } | 1327 | } |
1328 | updateToolbarColors_Root(d); | ||
1268 | const iMenuItem items[] = { | 1329 | const iMenuItem items[] = { |
1269 | { book_Icon " ${sidebar.bookmarks}", 0, 0, "toolbar.showview arg:0" }, | 1330 | { book_Icon " ${sidebar.bookmarks}", 0, 0, "toolbar.showview arg:0" }, |
1270 | { star_Icon " ${sidebar.feeds}", 0, 0, "toolbar.showview arg:1" }, | 1331 | { star_Icon " ${sidebar.feeds}", 0, 0, "toolbar.showview arg:1" }, |
@@ -1346,7 +1407,7 @@ void createUserInterface_Root(iRoot *d) { | |||
1346 | } | 1407 | } |
1347 | } | 1408 | } |
1348 | 1409 | ||
1349 | void showToolbars_Root(iRoot *d, iBool show) { | 1410 | void showToolbar_Root(iRoot *d, iBool show) { |
1350 | /* The toolbar is only used on phone portrait layout. */ | 1411 | /* The toolbar is only used on phone portrait layout. */ |
1351 | if (isLandscape_App()) return; | 1412 | if (isLandscape_App()) return; |
1352 | iWidget *toolBar = findChild_Widget(d->widget, "toolbar"); | 1413 | iWidget *toolBar = findChild_Widget(d->widget, "toolbar"); |