diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-22 11:55:13 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-22 11:55:13 +0200 |
commit | 1174f2e9318a58602baccdfb3e2465645d263601 (patch) | |
tree | ef1a2388790e2ad416a1a71681954b2b595339a8 | |
parent | c95aab351dfcf1282925708b16ceb727895da66b (diff) |
iOS: Font adjustments
-rw-r--r-- | src/app.c | 4 | ||||
-rw-r--r-- | src/ui/sidebarwidget.c | 16 | ||||
-rw-r--r-- | src/ui/text.c | 1 | ||||
-rw-r--r-- | src/ui/text.h | 1 | ||||
-rw-r--r-- | src/ui/util.c | 57 | ||||
-rw-r--r-- | src/ui/window.c | 32 |
6 files changed, 73 insertions, 38 deletions
@@ -195,11 +195,11 @@ static iString *serializePrefs_App_(const iApp *d) { | |||
195 | #endif | 195 | #endif |
196 | } | 196 | } |
197 | /* Sidebars. */ { | 197 | /* Sidebars. */ { |
198 | if (isVisible_Widget(sidebar)) { | 198 | if (isVisible_Widget(sidebar) && deviceType_App() != phone_AppDeviceType) { |
199 | appendCStr_String(str, "sidebar.toggle\n"); | 199 | appendCStr_String(str, "sidebar.toggle\n"); |
200 | } | 200 | } |
201 | appendFormat_String(str, "sidebar.mode arg:%d\n", mode_SidebarWidget(sidebar)); | 201 | appendFormat_String(str, "sidebar.mode arg:%d\n", mode_SidebarWidget(sidebar)); |
202 | if (isVisible_Widget(sidebar2)) { | 202 | if (isVisible_Widget(sidebar2) && deviceType_App() != phone_AppDeviceType) { |
203 | appendCStr_String(str, "sidebar2.toggle\n"); | 203 | appendCStr_String(str, "sidebar2.toggle\n"); |
204 | } | 204 | } |
205 | appendFormat_String(str, "sidebar2.mode arg:%d\n", mode_SidebarWidget(sidebar2)); | 205 | appendFormat_String(str, "sidebar2.mode arg:%d\n", mode_SidebarWidget(sidebar2)); |
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index 4857f025..5441381a 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -96,6 +96,7 @@ struct Impl_SidebarWidget { | |||
96 | iLabelWidget * modeButtons[max_SidebarMode]; | 96 | iLabelWidget * modeButtons[max_SidebarMode]; |
97 | int maxButtonLabelWidth; | 97 | int maxButtonLabelWidth; |
98 | int width; | 98 | int width; |
99 | int itemFonts[2]; | ||
99 | iWidget * resizer; | 100 | iWidget * resizer; |
100 | iWidget * menu; | 101 | iWidget * menu; |
101 | iSidebarItem * contextItem; /* list item accessed in the context menu */ | 102 | iSidebarItem * contextItem; /* list item accessed in the context menu */ |
@@ -408,7 +409,7 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { | |||
408 | 409 | ||
409 | static void updateItemHeight_SidebarWidget_(iSidebarWidget *d) { | 410 | static void updateItemHeight_SidebarWidget_(iSidebarWidget *d) { |
410 | const float heights[max_SidebarMode] = { 1.333f, 2.333f, 1.333f, 3.5f, 1.2f }; | 411 | const float heights[max_SidebarMode] = { 1.333f, 2.333f, 1.333f, 3.5f, 1.2f }; |
411 | setItemHeight_ListWidget(d->list, heights[d->mode] * lineHeight_Text(uiContent_FontId)); | 412 | setItemHeight_ListWidget(d->list, heights[d->mode] * lineHeight_Text(d->itemFonts[0])); |
412 | } | 413 | } |
413 | 414 | ||
414 | iBool setMode_SidebarWidget(iSidebarWidget *d, enum iSidebarMode mode) { | 415 | iBool setMode_SidebarWidget(iSidebarWidget *d, enum iSidebarMode mode) { |
@@ -473,9 +474,14 @@ void init_SidebarWidget(iSidebarWidget *d, enum iSidebarSide side) { | |||
473 | iZap(d->modeScroll); | 474 | iZap(d->modeScroll); |
474 | d->side = side; | 475 | d->side = side; |
475 | d->mode = -1; | 476 | d->mode = -1; |
476 | d->width = 60 * gap_UI; | ||
477 | #if defined (iPlatformAppleMobile) | 477 | #if defined (iPlatformAppleMobile) |
478 | d->width = 73 * gap_UI; | 478 | d->width = 73 * gap_UI; |
479 | d->itemFonts[0] = defaultBig_FontId; | ||
480 | d->itemFonts[1] = defaultBigBold_FontId; | ||
481 | #else | ||
482 | d->width = 60 * gap_UI; | ||
483 | d->itemFonts[0] = uiContent_FontId; | ||
484 | d->itemFonts[1] = uiContentBold_FontId; | ||
479 | #endif | 485 | #endif |
480 | setFlags_Widget(w, fixedWidth_WidgetFlag, iTrue); | 486 | setFlags_Widget(w, fixedWidth_WidgetFlag, iTrue); |
481 | iWidget *vdiv = makeVDiv_Widget(); | 487 | iWidget *vdiv = makeVDiv_Widget(); |
@@ -1219,7 +1225,7 @@ static void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect, | |||
1219 | const int itemHeight = height_Rect(itemRect); | 1225 | const int itemHeight = height_Rect(itemRect); |
1220 | const int iconColor = isHover ? (isPressing ? uiTextPressed_ColorId : uiIconHover_ColorId) | 1226 | const int iconColor = isHover ? (isPressing ? uiTextPressed_ColorId : uiIconHover_ColorId) |
1221 | : uiIcon_ColorId; | 1227 | : uiIcon_ColorId; |
1222 | const int font = d->isBold ? uiContentBold_FontId : uiContent_FontId; | 1228 | const int font = sidebar->itemFonts[d->isBold ? 1 : 0]; |
1223 | int bg = uiBackground_ColorId; | 1229 | int bg = uiBackground_ColorId; |
1224 | if (isHover) { | 1230 | if (isHover) { |
1225 | bg = isPressing ? uiBackgroundPressed_ColorId | 1231 | bg = isPressing ? uiBackgroundPressed_ColorId |
@@ -1250,7 +1256,7 @@ static void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect, | |||
1250 | else if (sidebar->mode == feeds_SidebarMode) { | 1256 | else if (sidebar->mode == feeds_SidebarMode) { |
1251 | const int fg = isHover ? (isPressing ? uiTextPressed_ColorId : uiTextFramelessHover_ColorId) | 1257 | const int fg = isHover ? (isPressing ? uiTextPressed_ColorId : uiTextFramelessHover_ColorId) |
1252 | : uiText_ColorId; | 1258 | : uiText_ColorId; |
1253 | const int iconPad = 11 * gap_UI; | 1259 | const int iconPad = 12 * gap_UI; |
1254 | if (d->listItem.isSeparator) { | 1260 | if (d->listItem.isSeparator) { |
1255 | if (d != constItem_ListWidget(list, 0)) { | 1261 | if (d != constItem_ListWidget(list, 0)) { |
1256 | drawHLine_Paint(p, | 1262 | drawHLine_Paint(p, |
@@ -1268,7 +1274,7 @@ static void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect, | |||
1268 | } | 1274 | } |
1269 | else { | 1275 | else { |
1270 | const iBool isUnread = (d->indent != 0); | 1276 | const iBool isUnread = (d->indent != 0); |
1271 | const int titleFont = isUnread ? uiContentBold_FontId : uiContent_FontId; | 1277 | const int titleFont = sidebar->itemFonts[isUnread ? 1 : 0]; |
1272 | const int h1 = lineHeight_Text(uiLabel_FontId); | 1278 | const int h1 = lineHeight_Text(uiLabel_FontId); |
1273 | const int h2 = lineHeight_Text(titleFont); | 1279 | const int h2 = lineHeight_Text(titleFont); |
1274 | iRect iconArea = { addY_I2(pos, 0), init_I2(iconPad, itemHeight) }; | 1280 | iRect iconArea = { addY_I2(pos, 0), init_I2(iconPad, itemHeight) }; |
diff --git a/src/ui/text.c b/src/ui/text.c index 9f9d4396..8736ed18 100644 --- a/src/ui/text.c +++ b/src/ui/text.c | |||
@@ -262,6 +262,7 @@ static void initFonts_Text_(iText *d) { | |||
262 | { &fontSourceSansProRegular_Embedded, uiSize * 1.125f, 1.0f, defaultMediumSymbols_FontId }, | 262 | { &fontSourceSansProRegular_Embedded, uiSize * 1.125f, 1.0f, defaultMediumSymbols_FontId }, |
263 | { &fontSourceSansProBold_Embedded, uiSize * 1.125f, 1.0f, defaultMediumSymbols_FontId }, | 263 | { &fontSourceSansProBold_Embedded, uiSize * 1.125f, 1.0f, defaultMediumSymbols_FontId }, |
264 | { &fontSourceSansProRegular_Embedded, uiSize * 1.333f, 1.0f, defaultBigSymbols_FontId }, | 264 | { &fontSourceSansProRegular_Embedded, uiSize * 1.333f, 1.0f, defaultBigSymbols_FontId }, |
265 | { &fontSourceSansProBold_Embedded, uiSize * 1.333f, 1.0f, defaultBigSymbols_FontId }, | ||
265 | { &fontSourceSansProRegular_Embedded, uiSize * 1.666f, 1.0f, defaultLargeSymbols_FontId }, | 266 | { &fontSourceSansProRegular_Embedded, uiSize * 1.666f, 1.0f, defaultLargeSymbols_FontId }, |
266 | { &fontIosevkaTermExtended_Embedded, uiSize * 0.866f, 1.0f, defaultSymbols_FontId }, | 267 | { &fontIosevkaTermExtended_Embedded, uiSize * 0.866f, 1.0f, defaultSymbols_FontId }, |
267 | { &fontSourceSansProRegular_Embedded, textSize, scaling, symbols_FontId }, | 268 | { &fontSourceSansProRegular_Embedded, textSize, scaling, symbols_FontId }, |
diff --git a/src/ui/text.h b/src/ui/text.h index fd8f8da2..92da3e5d 100644 --- a/src/ui/text.h +++ b/src/ui/text.h | |||
@@ -35,6 +35,7 @@ enum iFontId { | |||
35 | defaultMedium_FontId, | 35 | defaultMedium_FontId, |
36 | defaultMediumBold_FontId, | 36 | defaultMediumBold_FontId, |
37 | defaultBig_FontId, | 37 | defaultBig_FontId, |
38 | defaultBigBold_FontId, | ||
38 | defaultLarge_FontId, | 39 | defaultLarge_FontId, |
39 | defaultMonospace_FontId, | 40 | defaultMonospace_FontId, |
40 | defaultContentSized_FontId, | 41 | defaultContentSized_FontId, |
diff --git a/src/ui/util.c b/src/ui/util.c index 4f059dc7..7da68fa5 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -428,6 +428,17 @@ static iBool menuHandler_(iWidget *menu, const char *cmd) { | |||
428 | return iFalse; | 428 | return iFalse; |
429 | } | 429 | } |
430 | 430 | ||
431 | static iWidget *makeMenuSeparator_(void) { | ||
432 | iWidget *sep = new_Widget(); | ||
433 | setBackgroundColor_Widget(sep, uiSeparator_ColorId); | ||
434 | sep->rect.size.y = gap_UI / 3; | ||
435 | if (deviceType_App() != desktop_AppDeviceType) { | ||
436 | sep->rect.size.y = gap_UI / 2; | ||
437 | } | ||
438 | setFlags_Widget(sep, hover_WidgetFlag | fixedHeight_WidgetFlag, iTrue); | ||
439 | return sep; | ||
440 | } | ||
441 | |||
431 | iWidget *makeMenu_Widget(iWidget *parent, const iMenuItem *items, size_t n) { | 442 | iWidget *makeMenu_Widget(iWidget *parent, const iMenuItem *items, size_t n) { |
432 | iWidget *menu = new_Widget(); | 443 | iWidget *menu = new_Widget(); |
433 | setFrameColor_Widget(menu, uiSeparator_ColorId); | 444 | setFrameColor_Widget(menu, uiSeparator_ColorId); |
@@ -443,13 +454,7 @@ iWidget *makeMenu_Widget(iWidget *parent, const iMenuItem *items, size_t n) { | |||
443 | for (size_t i = 0; i < n; ++i) { | 454 | for (size_t i = 0; i < n; ++i) { |
444 | const iMenuItem *item = &items[i]; | 455 | const iMenuItem *item = &items[i]; |
445 | if (equal_CStr(item->label, "---")) { | 456 | if (equal_CStr(item->label, "---")) { |
446 | iWidget *sep = addChild_Widget(menu, iClob(new_Widget())); | 457 | addChild_Widget(menu, iClob(makeMenuSeparator_())); |
447 | setBackgroundColor_Widget(sep, uiSeparator_ColorId); | ||
448 | sep->rect.size.y = gap_UI / 3; | ||
449 | if (deviceType_App() != desktop_AppDeviceType) { | ||
450 | sep->rect.size.y = gap_UI / 2; | ||
451 | } | ||
452 | setFlags_Widget(sep, hover_WidgetFlag | fixedHeight_WidgetFlag, iTrue); | ||
453 | } | 458 | } |
454 | else { | 459 | else { |
455 | iLabelWidget *label = addChildFlags_Widget( | 460 | iLabelWidget *label = addChildFlags_Widget( |
@@ -462,6 +467,12 @@ iWidget *makeMenu_Widget(iWidget *parent, const iMenuItem *items, size_t n) { | |||
462 | } | 467 | } |
463 | } | 468 | } |
464 | } | 469 | } |
470 | if (deviceType_App() == phone_AppDeviceType) { | ||
471 | addChild_Widget(menu, iClob(makeMenuSeparator_())); | ||
472 | setFont_LabelWidget(addChildFlags_Widget(menu, iClob(new_LabelWidget("Cancel", "cancel")), | ||
473 | frameless_WidgetFlag | alignLeft_WidgetFlag), | ||
474 | defaultBig_FontId); | ||
475 | } | ||
465 | addChild_Widget(parent, iClob(menu)); | 476 | addChild_Widget(parent, iClob(menu)); |
466 | setCommandHandler_Widget(menu, menuHandler_); | 477 | setCommandHandler_Widget(menu, menuHandler_); |
467 | iWidget *cancel = addAction_Widget(menu, SDLK_ESCAPE, 0, "cancel"); | 478 | iWidget *cancel = addAction_Widget(menu, SDLK_ESCAPE, 0, "cancel"); |
@@ -471,29 +482,33 @@ iWidget *makeMenu_Widget(iWidget *parent, const iMenuItem *items, size_t n) { | |||
471 | } | 482 | } |
472 | 483 | ||
473 | void openMenu_Widget(iWidget *d, iInt2 coord) { | 484 | void openMenu_Widget(iWidget *d, iInt2 coord) { |
485 | const iInt2 rootSize = rootSize_Window(get_Window()); | ||
486 | const iBool isPortraitPhone = (deviceType_App() == phone_AppDeviceType && isPortrait_App()); | ||
474 | /* Menu closes when commands are emitted, so handle any pending ones beforehand. */ | 487 | /* Menu closes when commands are emitted, so handle any pending ones beforehand. */ |
475 | postCommand_App("cancel"); /* dismiss any other menus */ | 488 | postCommand_App("cancel"); /* dismiss any other menus */ |
476 | processEvents_App(postedEventsOnly_AppEventMode); | 489 | processEvents_App(postedEventsOnly_AppEventMode); |
477 | setFlags_Widget(d, hidden_WidgetFlag, iFalse); | 490 | setFlags_Widget(d, hidden_WidgetFlag, iFalse); |
478 | setFlags_Widget(d, commandOnMouseMiss_WidgetFlag, iTrue); | 491 | setFlags_Widget(d, commandOnMouseMiss_WidgetFlag, iTrue); |
479 | setFlags_Widget(findChild_Widget(d, "menu.cancel"), disabled_WidgetFlag, iFalse); | 492 | setFlags_Widget(findChild_Widget(d, "menu.cancel"), disabled_WidgetFlag, iFalse); |
480 | if (deviceType_App() == phone_AppDeviceType) { | 493 | if (isPortraitPhone) { |
481 | if (isPortrait_App()) { | 494 | setFlags_Widget(d, arrangeWidth_WidgetFlag | resizeChildrenToWidestChild_WidgetFlag, iFalse); |
482 | setFlags_Widget(d, arrangeWidth_WidgetFlag | resizeChildrenToWidestChild_WidgetFlag, iFalse); | 495 | setFlags_Widget(d, resizeWidthOfChildren_WidgetFlag, iTrue); |
483 | setFlags_Widget(d, resizeWidthOfChildren_WidgetFlag, iTrue); | 496 | d->rect.size.x = rootSize_Window(get_Window()).x; |
484 | d->rect.size.x = rootSize_Window(get_Window()).x; | 497 | iForEach(ObjectList, i, children_Widget(d)) { |
485 | iForEach(ObjectList, i, children_Widget(d)) { | 498 | if (isInstance_Object(i.object, &Class_LabelWidget)) { |
486 | if (isInstance_Object(i.object, &Class_LabelWidget)) { | 499 | iLabelWidget *label = i.object; |
487 | iLabelWidget *label = i.object; | 500 | setFont_LabelWidget(label, defaultBig_FontId); |
488 | setFont_LabelWidget(label, defaultBig_FontId); | ||
489 | } | ||
490 | } | 501 | } |
491 | } | 502 | } |
492 | } | 503 | } |
493 | arrange_Widget(d); | 504 | arrange_Widget(d); |
494 | d->rect.pos = coord; | 505 | if (isPortraitPhone) { |
506 | d->rect.pos = init_I2(0, rootSize.y); | ||
507 | } | ||
508 | else { | ||
509 | d->rect.pos = coord; | ||
510 | } | ||
495 | /* Ensure the full menu is visible. */ | 511 | /* Ensure the full menu is visible. */ |
496 | const iInt2 rootSize = rootSize_Window(get_Window()); | ||
497 | const iRect bounds = bounds_Widget(d); | 512 | const iRect bounds = bounds_Widget(d); |
498 | int leftExcess = -left_Rect(bounds); | 513 | int leftExcess = -left_Rect(bounds); |
499 | int rightExcess = right_Rect(bounds) - rootSize.x; | 514 | int rightExcess = right_Rect(bounds) - rootSize.x; |
@@ -523,6 +538,10 @@ void openMenu_Widget(iWidget *d, iInt2 coord) { | |||
523 | } | 538 | } |
524 | postRefresh_App(); | 539 | postRefresh_App(); |
525 | postCommand_Widget(d, "menu.opened"); | 540 | postCommand_Widget(d, "menu.opened"); |
541 | if (isPortraitPhone) { | ||
542 | setVisualOffset_Widget(d, height_Widget(d), 0, 0); | ||
543 | setVisualOffset_Widget(d, 0, 330, easeOut_AnimFlag | softer_AnimFlag); | ||
544 | } | ||
526 | } | 545 | } |
527 | 546 | ||
528 | void closeMenu_Widget(iWidget *d) { | 547 | void closeMenu_Widget(iWidget *d) { |
diff --git a/src/ui/window.c b/src/ui/window.c index c2e33c89..510fe2fe 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -475,8 +475,8 @@ static void dismissPortraitPhoneSidebars_(void) { | |||
475 | postCommand_App("sidebar2.toggle"); | 475 | postCommand_App("sidebar2.toggle"); |
476 | setVisualOffset_Widget(sidebar2, height_Widget(sidebar2), 250, easeIn_AnimFlag); | 476 | setVisualOffset_Widget(sidebar2, height_Widget(sidebar2), 250, easeIn_AnimFlag); |
477 | } | 477 | } |
478 | setFlags_Widget(findWidget_App("toolbar.ident"), noBackground_WidgetFlag, iTrue); | 478 | // setFlags_Widget(findWidget_App("toolbar.ident"), noBackground_WidgetFlag, iTrue); |
479 | setFlags_Widget(findWidget_App("toolbar.view"), noBackground_WidgetFlag, iTrue); | 479 | // setFlags_Widget(findWidget_App("toolbar.view"), noBackground_WidgetFlag, iTrue); |
480 | } | 480 | } |
481 | } | 481 | } |
482 | 482 | ||
@@ -679,7 +679,7 @@ static void dismissSidebar_(iWidget *sidebar, const char *toolButtonId) { | |||
679 | if (isVisible_Widget(sidebar)) { | 679 | if (isVisible_Widget(sidebar)) { |
680 | postCommandf_App("%s.toggle", cstr_String(id_Widget(sidebar))); | 680 | postCommandf_App("%s.toggle", cstr_String(id_Widget(sidebar))); |
681 | if (toolButtonId) { | 681 | if (toolButtonId) { |
682 | setFlags_Widget(findWidget_App(toolButtonId), noBackground_WidgetFlag, iTrue); | 682 | // setFlags_Widget(findWidget_App(toolButtonId), noBackground_WidgetFlag, iTrue); |
683 | } | 683 | } |
684 | setVisualOffset_Widget(sidebar, height_Widget(sidebar), 250, easeIn_AnimFlag); | 684 | setVisualOffset_Widget(sidebar, height_Widget(sidebar), 250, easeIn_AnimFlag); |
685 | } | 685 | } |
@@ -694,16 +694,19 @@ static iBool handleToolBarCommands_(iWidget *toolBar, const char *cmd) { | |||
694 | return iTrue; | 694 | return iTrue; |
695 | } | 695 | } |
696 | else if (equal_Command(cmd, "toolbar.showview")) { | 696 | else if (equal_Command(cmd, "toolbar.showview")) { |
697 | /* TODO: Clean this up. */ | ||
697 | iWidget *sidebar = findWidget_App("sidebar"); | 698 | iWidget *sidebar = findWidget_App("sidebar"); |
698 | iWidget *sidebar2 = findWidget_App("sidebar2"); | 699 | iWidget *sidebar2 = findWidget_App("sidebar2"); |
699 | dismissSidebar_(sidebar2, "toolbar.ident"); | 700 | dismissSidebar_(sidebar2, "toolbar.ident"); |
700 | const iBool isVisible = isVisible_Widget(sidebar); | 701 | const iBool isVisible = isVisible_Widget(sidebar); |
701 | setFlags_Widget(findChild_Widget(toolBar, "toolbar.view"), noBackground_WidgetFlag, | 702 | // setFlags_Widget(findChild_Widget(toolBar, "toolbar.view"), noBackground_WidgetFlag, |
702 | isVisible); | 703 | // isVisible); |
704 | /* If a sidebar hasn't been shown yet, it's height is zero. */ | ||
705 | const int viewHeight = rootSize_Window(get_Window()).y; | ||
703 | if (arg_Command(cmd) >= 0) { | 706 | if (arg_Command(cmd) >= 0) { |
704 | postCommandf_App("sidebar.mode arg:%d show:1", arg_Command(cmd)); | 707 | postCommandf_App("sidebar.mode arg:%d show:1", arg_Command(cmd)); |
705 | if (!isVisible) { | 708 | if (!isVisible) { |
706 | setVisualOffset_Widget(sidebar, height_Widget(sidebar), 0, 0); | 709 | setVisualOffset_Widget(sidebar, viewHeight, 0, 0); |
707 | setVisualOffset_Widget(sidebar, 0, 400, easeOut_AnimFlag | softer_AnimFlag); | 710 | setVisualOffset_Widget(sidebar, 0, 400, easeOut_AnimFlag | softer_AnimFlag); |
708 | } | 711 | } |
709 | } | 712 | } |
@@ -713,25 +716,30 @@ static iBool handleToolBarCommands_(iWidget *toolBar, const char *cmd) { | |||
713 | setVisualOffset_Widget(sidebar, height_Widget(sidebar), 250, easeIn_AnimFlag); | 716 | setVisualOffset_Widget(sidebar, height_Widget(sidebar), 250, easeIn_AnimFlag); |
714 | } | 717 | } |
715 | else { | 718 | else { |
716 | setVisualOffset_Widget(sidebar, height_Widget(sidebar), 0, 0); | 719 | setVisualOffset_Widget(sidebar, viewHeight, 0, 0); |
717 | setVisualOffset_Widget(sidebar, 0, 400, easeOut_AnimFlag | softer_AnimFlag); | 720 | setVisualOffset_Widget(sidebar, 0, 400, easeOut_AnimFlag | softer_AnimFlag); |
718 | } | 721 | } |
719 | } | 722 | } |
720 | return iTrue; | 723 | return iTrue; |
721 | } | 724 | } |
722 | else if (equal_Command(cmd, "toolbar.showident")) { | 725 | else if (equal_Command(cmd, "toolbar.showident")) { |
726 | /* TODO: Clean this up. */ | ||
723 | iWidget *sidebar = findWidget_App("sidebar"); | 727 | iWidget *sidebar = findWidget_App("sidebar"); |
724 | iWidget *sidebar2 = findWidget_App("sidebar2"); | 728 | iWidget *sidebar2 = findWidget_App("sidebar2"); |
725 | dismissSidebar_(sidebar, "toolbar.view"); | 729 | dismissSidebar_(sidebar, "toolbar.view"); |
726 | const iBool isVisible = isVisible_Widget(sidebar2); | 730 | const iBool isVisible = isVisible_Widget(sidebar2); |
727 | setFlags_Widget(findChild_Widget(toolBar, "toolbar.ident"), noBackground_WidgetFlag, | 731 | // setFlags_Widget(findChild_Widget(toolBar, "toolbar.ident"), noBackground_WidgetFlag, |
728 | isVisible); | 732 | // isVisible); |
729 | if (isVisible) { | 733 | /* If a sidebar hasn't been shown yet, it's height is zero. */ |
734 | const int viewHeight = rootSize_Window(get_Window()).y; | ||
735 | if (isVisible) { | ||
730 | dismissSidebar_(sidebar2, NULL); | 736 | dismissSidebar_(sidebar2, NULL); |
731 | } | 737 | } |
732 | else { | 738 | else { |
733 | postCommand_App("sidebar2.mode arg:3 show:1"); | 739 | postCommand_App("sidebar2.mode arg:3 show:1"); |
734 | setVisualOffset_Widget(sidebar2, height_Widget(sidebar2), 0, 0); | 740 | int offset = height_Widget(sidebar2); |
741 | if (offset == 0) offset = rootSize_Window(get_Window()).y; | ||
742 | setVisualOffset_Widget(sidebar2, offset, 0, 0); | ||
735 | setVisualOffset_Widget(sidebar2, 0, 400, easeOut_AnimFlag | softer_AnimFlag); | 743 | setVisualOffset_Widget(sidebar2, 0, 400, easeOut_AnimFlag | softer_AnimFlag); |
736 | } | 744 | } |
737 | return iTrue; | 745 | return iTrue; |
@@ -990,7 +998,7 @@ static void setupUserInterface_Window(iWindow *d) { | |||
990 | iLabelWidget *btn = i.object; | 998 | iLabelWidget *btn = i.object; |
991 | setFlags_Widget(i.object, noBackground_WidgetFlag, iTrue); | 999 | setFlags_Widget(i.object, noBackground_WidgetFlag, iTrue); |
992 | setTextColor_LabelWidget(i.object, tmBannerIcon_ColorId); | 1000 | setTextColor_LabelWidget(i.object, tmBannerIcon_ColorId); |
993 | setBackgroundColor_Widget(i.object, tmBannerSideTitle_ColorId); | 1001 | // setBackgroundColor_Widget(i.object, tmBannerSideTitle_ColorId); |
994 | } | 1002 | } |
995 | const iMenuItem items[] = { | 1003 | const iMenuItem items[] = { |
996 | { "Bookmarks", 0, 0, "toolbar.showview arg:0" }, | 1004 | { "Bookmarks", 0, 0, "toolbar.showview arg:0" }, |