diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/root.c | 2 | ||||
-rw-r--r-- | src/ui/sidebarwidget.c | 41 | ||||
-rw-r--r-- | src/ui/sidebarwidget.h | 2 |
3 files changed, 25 insertions, 20 deletions
diff --git a/src/ui/root.c b/src/ui/root.c index 89f71697..71f53af4 100644 --- a/src/ui/root.c +++ b/src/ui/root.c | |||
@@ -400,8 +400,6 @@ static iBool handleRootCommands_(iWidget *root, const char *cmd) { | |||
400 | iSidebarWidget *sidebar = findChild_Widget(root, "sidebar"); | 400 | iSidebarWidget *sidebar = findChild_Widget(root, "sidebar"); |
401 | iSidebarWidget *sidebar2 = findChild_Widget(root, "sidebar2"); | 401 | iSidebarWidget *sidebar2 = findChild_Widget(root, "sidebar2"); |
402 | removeChild_Widget(parent_Widget(sidebar), sidebar); | 402 | removeChild_Widget(parent_Widget(sidebar), sidebar); |
403 | setButtonFont_SidebarWidget(sidebar, isLandscape_App() ? uiLabel_FontId : defaultBig_FontId); | ||
404 | setButtonFont_SidebarWidget(sidebar2, isLandscape_App() ? uiLabel_FontId : defaultBig_FontId); | ||
405 | // setBackgroundColor_Widget(findChild_Widget(as_Widget(sidebar), "buttons"), | 403 | // setBackgroundColor_Widget(findChild_Widget(as_Widget(sidebar), "buttons"), |
406 | // isPortrait_App() ? uiBackgroundUnfocusedSelection_ColorId | 404 | // isPortrait_App() ? uiBackgroundUnfocusedSelection_ColorId |
407 | // : uiBackgroundSidebar_ColorId); | 405 | // : uiBackgroundSidebar_ColorId); |
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index eb129424..fe33c540 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -100,7 +100,7 @@ struct Impl_SidebarWidget { | |||
100 | int modeScroll[max_SidebarMode]; | 100 | int modeScroll[max_SidebarMode]; |
101 | iLabelWidget * modeButtons[max_SidebarMode]; | 101 | iLabelWidget * modeButtons[max_SidebarMode]; |
102 | int maxButtonLabelWidth; | 102 | int maxButtonLabelWidth; |
103 | int widthAsGaps; | 103 | float widthAsGaps; |
104 | int buttonFont; | 104 | int buttonFont; |
105 | int itemFonts[2]; | 105 | int itemFonts[2]; |
106 | size_t numUnreadEntries; | 106 | size_t numUnreadEntries; |
@@ -143,7 +143,9 @@ static iLabelWidget *addActionButton_SidebarWidget_(iSidebarWidget *d, const cha | |||
143 | //(deviceType_App() != desktop_AppDeviceType ? | 143 | //(deviceType_App() != desktop_AppDeviceType ? |
144 | // extraPadding_WidgetFlag : 0) | | 144 | // extraPadding_WidgetFlag : 0) | |
145 | flags); | 145 | flags); |
146 | setFont_LabelWidget(btn, d->buttonFont); | 146 | setFont_LabelWidget(btn, deviceType_App() == phone_AppDeviceType && d->side == right_SidebarSide |
147 | ? defaultBig_FontId | ||
148 | : d->buttonFont); | ||
147 | checkIcon_LabelWidget(btn); | 149 | checkIcon_LabelWidget(btn); |
148 | return btn; | 150 | return btn; |
149 | } | 151 | } |
@@ -641,7 +643,7 @@ void init_SidebarWidget(iSidebarWidget *d, enum iSidebarSide side) { | |||
641 | d->mode = -1; | 643 | d->mode = -1; |
642 | d->feedsMode = all_FeedsMode; | 644 | d->feedsMode = all_FeedsMode; |
643 | d->numUnreadEntries = 0; | 645 | d->numUnreadEntries = 0; |
644 | d->buttonFont = uiLabel_FontId; | 646 | d->buttonFont = uiLabel_FontId; /* wiil be changed later */ |
645 | d->itemFonts[0] = uiContent_FontId; | 647 | d->itemFonts[0] = uiContent_FontId; |
646 | d->itemFonts[1] = uiContentBold_FontId; | 648 | d->itemFonts[1] = uiContentBold_FontId; |
647 | #if defined (iPlatformMobile) | 649 | #if defined (iPlatformMobile) |
@@ -649,9 +651,9 @@ void init_SidebarWidget(iSidebarWidget *d, enum iSidebarSide side) { | |||
649 | d->itemFonts[0] = defaultBig_FontId; | 651 | d->itemFonts[0] = defaultBig_FontId; |
650 | d->itemFonts[1] = defaultBigBold_FontId; | 652 | d->itemFonts[1] = defaultBigBold_FontId; |
651 | } | 653 | } |
652 | d->widthAsGaps = 73; | 654 | d->widthAsGaps = 73.0f; |
653 | #else | 655 | #else |
654 | d->widthAsGaps = 60; | 656 | d->widthAsGaps = 60.0f; |
655 | #endif | 657 | #endif |
656 | setFlags_Widget(w, fixedWidth_WidgetFlag, iTrue); | 658 | setFlags_Widget(w, fixedWidth_WidgetFlag, iTrue); |
657 | iWidget *vdiv = makeVDiv_Widget(); | 659 | iWidget *vdiv = makeVDiv_Widget(); |
@@ -745,14 +747,18 @@ void deinit_SidebarWidget(iSidebarWidget *d) { | |||
745 | deinit_String(&d->cmdPrefix); | 747 | deinit_String(&d->cmdPrefix); |
746 | } | 748 | } |
747 | 749 | ||
748 | void setButtonFont_SidebarWidget(iSidebarWidget *d, int font) { | 750 | iBool setButtonFont_SidebarWidget(iSidebarWidget *d, int font) { |
749 | d->buttonFont = font; | 751 | if (d->buttonFont != font) { |
750 | for (int i = 0; i < max_SidebarMode; i++) { | 752 | d->buttonFont = font; |
751 | if (d->modeButtons[i]) { | 753 | for (int i = 0; i < max_SidebarMode; i++) { |
752 | setFont_LabelWidget(d->modeButtons[i], font); | 754 | if (d->modeButtons[i]) { |
755 | setFont_LabelWidget(d->modeButtons[i], font); | ||
756 | } | ||
753 | } | 757 | } |
758 | updateMetrics_SidebarWidget_(d); | ||
759 | return iTrue; | ||
754 | } | 760 | } |
755 | updateMetrics_SidebarWidget_(d); | 761 | return iFalse; |
756 | } | 762 | } |
757 | 763 | ||
758 | static const iGmIdentity *constHoverIdentity_SidebarWidget_(const iSidebarWidget *d) { | 764 | static const iGmIdentity *constHoverIdentity_SidebarWidget_(const iSidebarWidget *d) { |
@@ -827,8 +833,10 @@ static void checkModeButtonLayout_SidebarWidget_(iSidebarWidget *d) { | |||
827 | if (d->itemFonts[0] != fonts[0]) { | 833 | if (d->itemFonts[0] != fonts[0]) { |
828 | d->itemFonts[0] = fonts[0]; | 834 | d->itemFonts[0] = fonts[0]; |
829 | d->itemFonts[1] = fonts[1]; | 835 | d->itemFonts[1] = fonts[1]; |
830 | updateMetrics_SidebarWidget_(d); | 836 | // updateMetrics_SidebarWidget_(d); |
837 | updateItemHeight_SidebarWidget_(d); | ||
831 | } | 838 | } |
839 | setButtonFont_SidebarWidget(d, isPortrait_App() ? defaultBig_FontId : uiLabel_FontId); | ||
832 | } | 840 | } |
833 | const iBool isTight = | 841 | const iBool isTight = |
834 | (width_Rect(bounds_Widget(as_Widget(d->modeButtons[0]))) < d->maxButtonLabelWidth); | 842 | (width_Rect(bounds_Widget(as_Widget(d->modeButtons[0]))) < d->maxButtonLabelWidth); |
@@ -858,7 +866,7 @@ static void checkModeButtonLayout_SidebarWidget_(iSidebarWidget *d) { | |||
858 | void setWidth_SidebarWidget(iSidebarWidget *d, float widthAsGaps) { | 866 | void setWidth_SidebarWidget(iSidebarWidget *d, float widthAsGaps) { |
859 | iWidget *w = as_Widget(d); | 867 | iWidget *w = as_Widget(d); |
860 | const iBool isFixedWidth = deviceType_App() == phone_AppDeviceType; | 868 | const iBool isFixedWidth = deviceType_App() == phone_AppDeviceType; |
861 | int width = widthAsGaps * gap_UI; | 869 | int width = widthAsGaps * gap_UI; /* in pixels */ |
862 | if (!isFixedWidth) { | 870 | if (!isFixedWidth) { |
863 | /* Even less space if the other sidebar is visible, too. */ | 871 | /* Even less space if the other sidebar is visible, too. */ |
864 | const int otherWidth = | 872 | const int otherWidth = |
@@ -866,9 +874,7 @@ void setWidth_SidebarWidget(iSidebarWidget *d, float widthAsGaps) { | |||
866 | width = iClamp(width, 30 * gap_UI, size_Root(w->root).x - 50 * gap_UI - otherWidth); | 874 | width = iClamp(width, 30 * gap_UI, size_Root(w->root).x - 50 * gap_UI - otherWidth); |
867 | } | 875 | } |
868 | d->widthAsGaps = (float) width / (float) gap_UI; | 876 | d->widthAsGaps = (float) width / (float) gap_UI; |
869 | if (isVisible_Widget(w)) { | 877 | w->rect.size.x = width; |
870 | w->rect.size.x = width; | ||
871 | } | ||
872 | arrange_Widget(findWidget_Root("stack")); | 878 | arrange_Widget(findWidget_Root("stack")); |
873 | checkModeButtonLayout_SidebarWidget_(d); | 879 | checkModeButtonLayout_SidebarWidget_(d); |
874 | updateItemHeight_SidebarWidget_(d); | 880 | updateItemHeight_SidebarWidget_(d); |
@@ -935,6 +941,7 @@ static iBool handleSidebarCommand_SidebarWidget_(iSidebarWidget *d, const char * | |||
935 | if (wasChanged) { | 941 | if (wasChanged) { |
936 | postCommandf_App("%s.mode.changed arg:%d", cstr_String(id_Widget(w)), d->mode); | 942 | postCommandf_App("%s.mode.changed arg:%d", cstr_String(id_Widget(w)), d->mode); |
937 | } | 943 | } |
944 | refresh_Widget(findChild_Widget(w, "buttons")); | ||
938 | return iTrue; | 945 | return iTrue; |
939 | } | 946 | } |
940 | else if (equal_Command(cmd, "toggle")) { | 947 | else if (equal_Command(cmd, "toggle")) { |
@@ -1556,7 +1563,7 @@ static void draw_SidebarWidget_(const iSidebarWidget *d) { | |||
1556 | const iRect bounds = bounds_Widget(w); | 1563 | const iRect bounds = bounds_Widget(w); |
1557 | iPaint p; | 1564 | iPaint p; |
1558 | init_Paint(&p); | 1565 | init_Paint(&p); |
1559 | if (deviceType_App() != phone_AppDeviceType) { | 1566 | if (!isPortraitPhone_App()) { /* this would erase page contents during transition on the phone */ |
1560 | if (flags_Widget(w) & visualOffset_WidgetFlag && | 1567 | if (flags_Widget(w) & visualOffset_WidgetFlag && |
1561 | flags_Widget(w) & horizontalOffset_WidgetFlag && isVisible_Widget(w)) { | 1568 | flags_Widget(w) & horizontalOffset_WidgetFlag && isVisible_Widget(w)) { |
1562 | fillRect_Paint(&p, boundsWithoutVisualOffset_Widget(w), tmBackground_ColorId); | 1569 | fillRect_Paint(&p, boundsWithoutVisualOffset_Widget(w), tmBackground_ColorId); |
diff --git a/src/ui/sidebarwidget.h b/src/ui/sidebarwidget.h index 130242ab..2894a951 100644 --- a/src/ui/sidebarwidget.h +++ b/src/ui/sidebarwidget.h | |||
@@ -49,7 +49,7 @@ iDeclareWidgetClass(SidebarWidget) | |||
49 | iDeclareObjectConstructionArgs(SidebarWidget, enum iSidebarSide side) | 49 | iDeclareObjectConstructionArgs(SidebarWidget, enum iSidebarSide side) |
50 | 50 | ||
51 | iBool setMode_SidebarWidget (iSidebarWidget *, enum iSidebarMode mode); | 51 | iBool setMode_SidebarWidget (iSidebarWidget *, enum iSidebarMode mode); |
52 | void setButtonFont_SidebarWidget (iSidebarWidget *, int font); | 52 | iBool setButtonFont_SidebarWidget (iSidebarWidget *, int font); |
53 | 53 | ||
54 | enum iSidebarMode mode_SidebarWidget (const iSidebarWidget *); | 54 | enum iSidebarMode mode_SidebarWidget (const iSidebarWidget *); |
55 | float width_SidebarWidget (const iSidebarWidget *); | 55 | float width_SidebarWidget (const iSidebarWidget *); |