Show
Ignore:
Timestamp:
07/09/07 22:13:35 (2 years ago)
Author:
daboo
Message:

More v4.1 code. Includes experiment, though non-functioning WebKit? message
display option.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Mulberry/branches/v4.1d1/MacOS/Sources/Application/Calendar/Calendar_View/Calendar_Window/CCalendarEventBase.cp

    r74 r97  
    3131#include "CCalendarStoreManager.h" 
    3232#include "CICalendarUtils.h" 
     33#include "CICalendarVFreeBusy.h" 
    3334#include "CITIPProcessor.h" 
    3435 
     
    4344        LPane(inPaneInfo) 
    4445{ 
     46        mVFreeBusy = NULL; 
    4547        mTable = NULL; 
    4648        mAllDay = true; 
     
    132134} 
    133135 
     136void CCalendarEventBase::SetDetails(iCal::CICalendarVFreeBusy* freebusy, const iCal::CICalendarPeriod& period, CCalendarTableBase* table, const char* title, bool all_day, bool start_col, bool end_col, bool horiz) 
     137{ 
     138        mVFreeBusy = freebusy; 
     139        mPeriod = period; 
     140        mTable = table; 
     141 
     142        mTitle = MyCFString(title, kCFStringEncodingUTF8); 
     143        mAllDay = all_day; 
     144        mStartsInCol = start_col; 
     145        mEndsInCol = end_col; 
     146        mHoriz = horiz; 
     147        mIsCancelled = false; 
     148        mHasAlarm = false; 
     149        mAttendeeState = iCal::CITIPProcessor::GetAttendeeState(*mVFreeBusy); 
     150 
     151        // Setup a help tag 
     152        SetupTagText(); 
     153         
     154        // Determine colour 
     155        iCal::CICalendar* cal = iCal::CICalendar::GetICalendar(mVFreeBusy->GetCalendar()); 
     156        if (cal) 
     157        { 
     158                mColour = calstore::CCalendarStoreManager::sCalendarStoreManager->GetCalendarColour(cal); 
     159        } 
     160} 
     161 
    134162// Click 
    135163void CCalendarEventBase::ClickSelf(const SMouseDownEvent &inMouseDown) 
     
    175203        // Draw title 
    176204        rect.origin.x += 3.0; 
    177         rect.size.width -= 3.0; 
     205        rect.size.width -= (mHoriz && mAllDay || IsFreeBusy()) ? 6.0 : 3.0; 
    178206        Rect box; 
    179207        CGUtils::HIToQDRect(rect, box); 
     
    184212                box.bottom = box.top + 16; 
    185213        } 
    186         ::CGContextSetGrayFillColor(inContext, mIsSelected ? 1.0 : 0.0, 1.0); 
     214        ::CGContextSetGrayFillColor(inContext, mIsSelected && !IsFreeBusy() ? 1.0 : 0.0, 1.0); 
    187215        MyCFString trunc(mTitle, kCFStringEncodingUTF8); 
    188216        if (mHoriz) 
    189217                ::TruncateThemeText(trunc, kThemeSmallSystemFont, kThemeStateActive, rect.size.width, truncEnd, NULL); 
    190         ::DrawThemeTextBox(trunc, kThemeSmallSystemFont, kThemeStateActive, !mHoriz, &box, mHoriz && mAllDay ? teJustCenter : teJustLeft, inContext); 
     218        ::DrawThemeTextBox(trunc, kThemeSmallSystemFont, kThemeStateActive, !mHoriz, &box, (mHoriz && mAllDay || IsFreeBusy()) ? teJustCenter : teJustLeft, inContext); 
    191219         
    192220        // Strike out text if status is cancelled 
     
    300328        float green = CGUtils::GetCGGreen(mColour); 
    301329        float blue = CGUtils::GetCGBlue(mColour); 
     330        float line_factor = IsFreeBusy() ? 1.0 : 0.6; 
    302331        if (mIsSelected) 
    303332        { 
    304333                CGUtils::UnflattenColours(red, green, blue); 
    305                 ::CGContextSetRGBFillColor(inContext, red, green, blue, 1.0); 
    306                 ::CGContextSetRGBStrokeColor(inContext, red * 0.6, green * 0.6, blue * 0.6, 1.0); 
    307         } 
    308         else 
    309         { 
    310                 ::CGContextSetRGBFillColor(inContext, red, green, blue, 1.0); 
    311                 ::CGContextSetRGBStrokeColor(inContext, red * 0.6, green * 0.6, blue * 0.6, 1.0); 
     334                if (IsFreeBusy()) 
     335                        ::CGContextSetGrayFillColor(inContext, 1.0, 1.0); 
     336                else 
     337                        ::CGContextSetRGBFillColor(inContext, red, green, blue, 1.0); 
     338                ::CGContextSetRGBStrokeColor(inContext, red * line_factor, green * line_factor, blue * line_factor, 1.0); 
     339        } 
     340        else 
     341        { 
     342                if (IsFreeBusy()) 
     343                        ::CGContextSetGrayFillColor(inContext, 1.0, 1.0); 
     344                else 
     345                        ::CGContextSetRGBFillColor(inContext, red, green, blue, 1.0); 
     346                ::CGContextSetRGBStrokeColor(inContext, red * line_factor, green * line_factor, blue * line_factor, 1.0); 
    312347        } 
    313348         
     
    397432        rect = ::CGRectInset(rect, 1.0, 1.0); 
    398433 
     434        if (IsFreeBusy()) 
     435                rect = ::CGRectInset(rect, 3.0, 3.0); 
     436         
    399437        float h_radius = rect.size.height >= 16 ? cRoundRadius : rect.size.height / 2.0; 
    400438        float w_radius = rect.size.width >= 16 ? cRoundRadius : rect.size.width / 2.0; 
     
    462500        float green = CGUtils::GetCGGreen(mColour); 
    463501        float blue = CGUtils::GetCGBlue(mColour); 
     502        float line_factor = IsFreeBusy() ? 1.0 : 0.6; 
    464503        if (mIsSelected) 
    465504        { 
    466505                CGUtils::UnflattenColours(red, green, blue); 
    467                 ::CGContextSetRGBFillColor(inContext, red, green, blue, 1.0); 
    468                 ::CGContextSetRGBStrokeColor(inContext, red * 0.6, green * 0.6, blue * 0.6, 1.0); 
    469         } 
    470         else 
    471         { 
    472                 ::CGContextSetRGBFillColor(inContext, red, green, blue, 1.0); 
    473                 ::CGContextSetRGBStrokeColor(inContext, red * 0.6, green * 0.6, blue * 0.6, 1.0); 
    474         } 
     506                if (IsFreeBusy()) 
     507                        ::CGContextSetGrayFillColor(inContext, 1.0, 1.0); 
     508                else 
     509                        ::CGContextSetRGBFillColor(inContext, red, green, blue, 1.0); 
     510                ::CGContextSetRGBStrokeColor(inContext, red * line_factor, green * line_factor, blue * line_factor, 1.0); 
     511        } 
     512        else 
     513        { 
     514                if (IsFreeBusy()) 
     515                        ::CGContextSetGrayFillColor(inContext, 1.0, 1.0); 
     516                else 
     517                        ::CGContextSetRGBFillColor(inContext, red, green, blue, 1.0); 
     518                ::CGContextSetRGBStrokeColor(inContext, red * line_factor, green * line_factor, blue * line_factor, 1.0); 
     519        } 
     520         
     521        if (IsFreeBusy()) 
     522                ::CGContextSetLineWidth(inContext, 5.0); 
    475523         
    476524        ::CGContextAddPath(inContext, path); 
    477525        ::CGContextDrawPath(inContext, kCGPathFillStroke); 
     526 
     527        if (IsFreeBusy()) 
     528                ::CGContextSetLineWidth(inContext, 1.0); 
    478529 
    479530        // Check for now marker