You've already forked lazarus-ccr
tvplanit: Fix events being painted over the "today" border in TVpMonthView.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8470 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -34,6 +34,8 @@ type
|
||||
FCurrHoliday: String;
|
||||
FDayHeadHeight: Integer;
|
||||
FMonthHeadHeight: Integer;
|
||||
FTodayRect: TRect;
|
||||
FTodayStr: String;
|
||||
|
||||
// These variables were protected in the original monthview, but are needed only for painting
|
||||
mvEventTextHeight: Integer;
|
||||
@ -52,6 +54,7 @@ type
|
||||
procedure DrawEvents;
|
||||
procedure DrawFocusRect(ARect: TRect; FixRight: Boolean = false);
|
||||
procedure DrawHeader;
|
||||
procedure DrawTodayRect;
|
||||
procedure FixFontHeights;
|
||||
procedure InitColors;
|
||||
procedure SetMeasurements; override;
|
||||
@ -134,11 +137,11 @@ begin
|
||||
RenderCanvas.Brush.Color := RealColor;
|
||||
|
||||
if ACol = 6 then begin
|
||||
{ draw bottom line }
|
||||
// Draw bottom line
|
||||
TPSMoveTo(RenderCanvas, Angle, RenderIn, ATextRect.Left, ATextRect.Bottom);
|
||||
TPSLineTo(RenderCanvas, Angle, RenderIn, RealRight - 2, ATextRect.Bottom);
|
||||
end else begin
|
||||
{ draw right side and bottom lines }
|
||||
// Draw right side and bottom lines
|
||||
TPSMoveTo(RenderCanvas, Angle, RenderIn, ATextRect.Right, ATextRect.top);
|
||||
if ATextRect.Bottom > RealBottom then begin
|
||||
TPSLineTo(RenderCanvas, Angle, RenderIn, ATextRect.Right, RealBottom);
|
||||
@ -149,10 +152,10 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{ Prepare the day number as string}
|
||||
// Prepare the day number as string
|
||||
str := FormatDateTime('d', ADate);
|
||||
|
||||
{ Set the proper font and style }
|
||||
// Set the proper font and style
|
||||
if ADate = todayDate then
|
||||
RenderCanvas.Font.Assign(FMonthView.TodayAttributes.Font)
|
||||
else
|
||||
@ -179,7 +182,7 @@ begin
|
||||
then
|
||||
RenderCanvas.Font.Style := RenderCanvas.Font.Style + FMonthView.EventDayStyle;
|
||||
end else begin
|
||||
{ Set the font style for days which have events. }
|
||||
// Set the font style for days which have events.
|
||||
if (FMonthView.EventDayStyle <> []) and (FMonthview.Datastore <> nil) and
|
||||
(FMonthView.DataStore.Resource <> nil) and
|
||||
(FMonthView.DataStore.Resource.Schedule.EventCountByDay(ADate) > 0)
|
||||
@ -201,7 +204,7 @@ begin
|
||||
textHeight := RenderCanvas.TextHeight(str);
|
||||
RenderCanvas.Font.Style := FontStyle;
|
||||
|
||||
{ Calculate size of rect for the day number at the top of the TextRect. }
|
||||
// Calculate size of rect for the day number at the top of the TextRect.
|
||||
if ACol = 6 then
|
||||
tmpRect.Left := ATextRect.Left + mvColWidth - TextAdjust - FMonthView.DaysMargin
|
||||
else
|
||||
@ -212,22 +215,19 @@ begin
|
||||
tmpRect.Right := tmpRect.Left + textAdjust;
|
||||
tmpRect.Bottom := tmpRect.Top + textHeight;
|
||||
|
||||
{ Highlight today by a border }
|
||||
// Highlight today by a border
|
||||
if ADate = todayDate then begin
|
||||
OffsetRect(tmpRect, 2, 0);
|
||||
InflateRect(tmpRect, 3, 3);
|
||||
RenderCanvas.Pen.Assign(FMonthView.TodayAttributes.BorderPen);
|
||||
RenderCanvas.Brush.Color := FMonthView.TodayAttributes.Color;
|
||||
RenderCanvas.Brush.Style := bsSolid;
|
||||
RenderCanvas.Rectangle(tmpRect);
|
||||
InflateRect(tmpRect, -3, -3);
|
||||
RenderCanvas.Font.Color := FMonthView.TodayAttributes.Font.Color;
|
||||
end;
|
||||
FTodayRect := tmpRect;
|
||||
OffsetRect(FTodayRect, 2, 0);
|
||||
InflateRect(FTodayRect, 3, 3);
|
||||
FTodayStr := Str;
|
||||
// Will be painted after the events to avoid drawing events over the
|
||||
// "today" rectangle
|
||||
end else
|
||||
// Write the day number at the top of the TextRect
|
||||
TPSTextOut(RenderCanvas, Angle, RenderIn, tmpRect.Left, tmpRect.Top, Str);
|
||||
|
||||
{ Write the day number at the top of the TextRect. }
|
||||
TPSTextOut(RenderCanvas, Angle, RenderIn, tmpRect.Left, tmpRect.Top, Str);
|
||||
|
||||
{ Update MonthDayArray }
|
||||
// Update MonthDayArray
|
||||
with TVpMonthViewOpener(FMonthView) do begin
|
||||
mvMonthDayArray[AIndex].Rec := ATextRect;
|
||||
mvMonthDayArray[AIndex].Date := ADate;
|
||||
@ -238,11 +238,12 @@ begin
|
||||
Inc(AIndex);
|
||||
|
||||
if ACol = 6 then begin
|
||||
{ drop rect down one row and all the way to the left }
|
||||
// We just painted the last day in the row --> Drop rect down one row and
|
||||
// then all the way to the left
|
||||
ATextRect.TopLeft := Point(RealLeft + 1, ATextRect.Bottom + 1);
|
||||
ATextRect.BottomRight := Point(ATextRect.Left + mvColWidth, ATextRect.Top + mvRowHeight);
|
||||
end else begin
|
||||
{ slide rect one column to the right }
|
||||
// Slide rect one column to the right
|
||||
ATextRect.Left := ATextRect.Right + 1;
|
||||
ATextRect.Right := ATextRect.Right + mvColWidth;
|
||||
end;
|
||||
@ -466,6 +467,7 @@ begin
|
||||
end;
|
||||
|
||||
DrawEvents;
|
||||
DrawTodayRect;
|
||||
end;
|
||||
|
||||
procedure TVpMonthViewPainter.DrawEvents;
|
||||
@ -709,6 +711,20 @@ begin
|
||||
);
|
||||
end;
|
||||
|
||||
procedure TVpMonthViewPainter.DrawTodayRect;
|
||||
begin
|
||||
// Highlight toay by a border defined by FTodayRect (it was measured in
|
||||
// the DrawDayCell method).
|
||||
RenderCanvas.Pen.Assign(FMonthView.TodayAttributes.BorderPen);
|
||||
RenderCanvas.Brush.Color := FMonthView.TodayAttributes.Color;
|
||||
RenderCanvas.Brush.Style := bsSolid;
|
||||
RenderCanvas.Rectangle(FTodayRect);
|
||||
|
||||
// Write the day number into the TodayRect.
|
||||
RenderCanvas.Font.Color := FMonthView.TodayAttributes.Font.Color;
|
||||
TPSTextOut(RenderCanvas, Angle, RenderIn, FTodayRect.Left+3, FTodayRect.Top+3, FTodayStr);
|
||||
end;
|
||||
|
||||
procedure TVpMonthViewPainter.FixFontHeights;
|
||||
begin
|
||||
with FMonthView do begin
|
||||
|
Reference in New Issue
Block a user