Ticket #13714: 0001-BCalendarView-use-bold-for-today.patch

File 0001-BCalendarView-use-bold-for-today.patch, 1.9 KB (added by humdinger, 7 years ago)

patch

  • src/kits/shared/CalendarView.cpp

    From 61a712823062ebd7625f3791c8fcf113934ba008 Mon Sep 17 00:00:00 2001
    From: Humdinger <humdingerb@gmail.com>
    Date: Sun, 17 Sep 2017 10:09:26 +0200
    Subject: [PATCH] BCalendarView: use bold for 'today'
    
    Only Using the keyboard navigation colour to indicate the current day isn't
    that nice in all situations. When using custom system colours, like white on
    blue for selected items, it can become barely readable.
    
    Let's use bold type face for the current day, and keyboard navigation colour
    only when 'today' isn't selected.
    
    Fixes #13714
    ---
     src/kits/shared/CalendarView.cpp | 14 ++++++++++----
     1 file changed, 10 insertions(+), 4 deletions(-)
    
    diff --git a/src/kits/shared/CalendarView.cpp b/src/kits/shared/CalendarView.cpp
    index 7bb0c86..c206f26 100644
    a b BCalendarView::_DrawItem(BView* owner, BRect frame, const char* text,  
    11151115    if (textColor.red + textColor.green + textColor.blue > 125 * 3)
    11161116        tintDisabled  = B_DARKEN_2_TINT;
    11171117
     1118    if (isHighlight)
     1119        textColor = keyboard_navigation_color();
     1120
    11181121    if (isSelected) {
    11191122        SetHighColor(ui_color(B_LIST_SELECTED_BACKGROUND_COLOR));
    11201123        textColor = ui_color(B_LIST_SELECTED_ITEM_TEXT_COLOR);
    11211124    } else
    11221125        SetHighColor(ui_color(B_LIST_BACKGROUND_COLOR));
    11231126
    1124     if (isHighlight) {
    1125         textColor = keyboard_navigation_color();
    1126     }
    1127 
    11281127    SetLowColor(HighColor());
    11291128
    11301129    FillRect(frame.InsetByCopy(1.0, 1.0));
    BCalendarView::_DrawItem(BView* owner, BRect frame, const char* text,  
    11411140    float offsetH = frame.Width() / 2.0;
    11421141    float offsetV = frame.Height() / 2.0 + FontHeight(owner) / 2.0 - 2.0;
    11431142
     1143    BFont font(be_plain_font);
     1144    if (isHighlight)
     1145        font.SetFace(B_BOLD_FACE);
     1146    else
     1147        font.SetFace(B_REGULAR_FACE);
     1148    SetFont(&font);
     1149
    11441150    DrawString(text, BPoint(frame.right - offsetH - StringWidth(text) / 2.0,
    11451151            frame.top + offsetV));
    11461152