diff options
Diffstat (limited to 'src/ui/sidebarwidget.c')
-rw-r--r-- | src/ui/sidebarwidget.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index 4cedd731..55538812 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -87,7 +87,6 @@ struct Impl_SidebarWidget { | |||
87 | int modeScroll[max_SidebarMode]; | 87 | int modeScroll[max_SidebarMode]; |
88 | int width; | 88 | int width; |
89 | iLabelWidget *modeButtons[max_SidebarMode]; | 89 | iLabelWidget *modeButtons[max_SidebarMode]; |
90 | int itemHeight; | ||
91 | int maxButtonLabelWidth; | 90 | int maxButtonLabelWidth; |
92 | iWidget *resizer; | 91 | iWidget *resizer; |
93 | SDL_Cursor *resizeCursor; | 92 | SDL_Cursor *resizeCursor; |
@@ -163,14 +162,18 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { | |||
163 | /* Date separator. */ | 162 | /* Date separator. */ |
164 | iSidebarItem *sep = new_SidebarItem(); | 163 | iSidebarItem *sep = new_SidebarItem(); |
165 | sep->listItem.isSeparator = iTrue; | 164 | sep->listItem.isSeparator = iTrue; |
166 | set_String(&sep->meta, | 165 | const iString *text = collect_String(format_Date( |
167 | collect_String(format_Date( | 166 | &date, date.year != thisYear ? "%b %d %Y" : "%b %d")); |
168 | &date, date.year != thisYear ? "%b %d %Y" : "%b %d"))); | 167 | set_String(&sep->meta, text); |
168 | const int yOffset = itemHeight_ListWidget(d->list) * 2 / 3; | ||
169 | sep->id = yOffset; | ||
169 | addItem_ListWidget(d->list, sep); | 170 | addItem_ListWidget(d->list, sep); |
170 | iRelease(sep); | 171 | iRelease(sep); |
171 | /* Date separators are two items tall. */ | 172 | /* Date separators are two items tall. */ |
172 | sep = new_SidebarItem(); | 173 | sep = new_SidebarItem(); |
173 | sep->listItem.isSeparator = iTrue; | 174 | sep->listItem.isSeparator = iTrue; |
175 | sep->id = -itemHeight_ListWidget(d->list) + yOffset; | ||
176 | set_String(&sep->meta, text); | ||
174 | addItem_ListWidget(d->list, sep); | 177 | addItem_ListWidget(d->list, sep); |
175 | iRelease(sep); | 178 | iRelease(sep); |
176 | } | 179 | } |
@@ -755,7 +758,7 @@ static void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect, | |||
755 | const int itemHeight = height_Rect(itemRect); | 758 | const int itemHeight = height_Rect(itemRect); |
756 | const int iconColor = | 759 | const int iconColor = |
757 | isHover ? (isPressing ? uiTextPressed_ColorId : uiIconHover_ColorId) : uiIcon_ColorId; | 760 | isHover ? (isPressing ? uiTextPressed_ColorId : uiIconHover_ColorId) : uiIcon_ColorId; |
758 | if (isHover && !d->listItem.isSeparator) { | 761 | if (isHover) /* && !d->listItem.isSeparator)*/ { |
759 | fillRect_Paint(p, | 762 | fillRect_Paint(p, |
760 | itemRect, | 763 | itemRect, |
761 | isPressing ? uiBackgroundPressed_ColorId | 764 | isPressing ? uiBackgroundPressed_ColorId |
@@ -789,8 +792,7 @@ static void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect, | |||
789 | : uiText_ColorId; | 792 | : uiText_ColorId; |
790 | if (d->listItem.isSeparator) { | 793 | if (d->listItem.isSeparator) { |
791 | if (!isEmpty_String(&d->meta)) { | 794 | if (!isEmpty_String(&d->meta)) { |
792 | unsetClip_Paint(p); | 795 | iInt2 drawPos = addY_I2(topLeft_Rect(itemRect), d->id); |
793 | iInt2 drawPos = addY_I2(topLeft_Rect(itemRect), itemHeight * 0.666f); | ||
794 | drawHLine_Paint(p, drawPos, width_Rect(itemRect), uiIcon_ColorId); | 796 | drawHLine_Paint(p, drawPos, width_Rect(itemRect), uiIcon_ColorId); |
795 | drawRange_Text( | 797 | drawRange_Text( |
796 | default_FontId, | 798 | default_FontId, |