tvplanit: Fix painting of thick edit frame in DayView if level > 0

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4841 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-06-26 14:19:55 +00:00
parent 564a84a7d6
commit a7ea8489dd

View File

@ -87,7 +87,7 @@ type
procedure DrawAllDays; procedure DrawAllDays;
procedure DrawCells(R: TRect; ColDate: TDateTime; Col: Integer); procedure DrawCells(R: TRect; ColDate: TDateTime; Col: Integer);
procedure DrawColHeader(R: TRect; ARenderDate: TDateTime; Col: Integer); procedure DrawColHeader(R: TRect; ARenderDate: TDateTime; Col: Integer);
procedure DrawEditFrame(R: TRect; AGutter: Integer; AColor: TColor); procedure DrawEditFrame(R: TRect; AGutter, ALevel: Integer; AColor: TColor);
procedure DrawEvent(AEvent: TVpEvent; AEventRec: TVpDvEventRec; procedure DrawEvent(AEvent: TVpEvent; AEventRec: TVpDvEventRec;
ARenderDate: TDateTime; Col: Integer); ARenderDate: TDateTime; Col: Integer);
procedure DrawEvents(ARenderDate: TDateTime; Col: Integer); procedure DrawEvents(ARenderDate: TDateTime; Col: Integer);
@ -725,16 +725,24 @@ begin
end; end;
{ paint extra borders around the editor } { paint extra borders around the editor }
procedure TVpDayViewPainter.DrawEditFrame(R: TRect; AGutter: Integer; procedure TVpDayViewPainter.DrawEditFrame(R: TRect; AGutter, ALevel: Integer;
AColor: TColor); AColor: TColor);
begin begin
RenderCanvas.Pen.Color := clWindowFrame; RenderCanvas.Pen.Color := clWindowFrame;
RenderCanvas.Brush.Color := AColor; RenderCanvas.Brush.Color := AColor;
if ALevel = 0 then
with R do begin with R do begin
TPSFillRect(RenderCanvas, Angle, RenderIn, Rect(Left, Top-AGutter, Right, Top)); TPSFillRect(RenderCanvas, Angle, RenderIn, Rect(Left, Top-AGutter, Right, Top));
TPSFillRect(RenderCanvas, Angle, RenderIn, Rect(Left-AGutter, Top, Left, Bottom)); TPSFillRect(RenderCanvas, Angle, RenderIn, Rect(Left-AGutter, Top, Left, Bottom));
TPSFillRect(RenderCanvas, Angle, RenderIn, Rect(Left, Bottom, Right, Bottom + AGutter)); TPSFillRect(RenderCanvas, Angle, RenderIn, Rect(Left, Bottom, Right, Bottom + AGutter));
TPSFillRect(RenderCanvas, Angle, RenderIn, Rect(Right, Top, Right+AGutter, Bottom)); TPSFillRect(RenderCanvas, Angle, RenderIn, Rect(Right, Top, Right+AGutter, Bottom));
end
else
with R do begin
TPSFillRect(RenderCanvas, Angle, RenderIn, Rect(Left+AGutter, Top-AGutter, Right, Top));
TPSFillRect(RenderCanvas, Angle, RenderIn, Rect(Left, Top, Left, Bottom));
TPSFillRect(RenderCanvas, Angle, RenderIn, Rect(Left+AGutter, Bottom, Right, Bottom + AGutter));
TPSFillRect(RenderCanvas, Angle, RenderIn, Rect(Right, Top, Right+AGutter, Bottom));
end; end;
end; end;
@ -958,6 +966,8 @@ var
SaveFont: TFont; SaveFont: TFont;
SaveColor: TColor; SaveColor: TColor;
OKToDrawEditFrame: Boolean; OKToDrawEditFrame: Boolean;
tmpRect: TRect;
level: Integer;
begin begin
if (FDayView.DataStore = nil) or (FDayView.DataStore.Resource = nil) or if (FDayView.DataStore = nil) or (FDayView.DataStore.Resource = nil) or
(not FDayView.DataStore.Connected) then (not FDayView.DataStore.Connected) then
@ -1011,6 +1021,7 @@ begin
PixelDuration := 0; PixelDuration := 0;
{ Iterate through events and paint them } { Iterate through events and paint them }
level := -1;
for I := 0 to pred(MaxVisibleEvents) do begin for I := 0 to pred(MaxVisibleEvents) do begin
{ get the next event } { get the next event }
Event := TVpEvent(EventArray[I].Event); Event := TVpEvent(EventArray[I].Event);
@ -1020,6 +1031,7 @@ begin
Break; Break;
DrawEvent(Event, EventArray[i], ARenderDate, Col); DrawEvent(Event, EventArray[i], ARenderDate, Col);
if Event = FDayView.ActiveEvent then level := i;
end; end;
{ paint extra borders around the editor } { paint extra borders around the editor }
@ -1027,12 +1039,13 @@ begin
if Assigned(FDayView.ActiveEvent) then if Assigned(FDayView.ActiveEvent) then
OKToDrawEditFrame := not (FDayView.ActiveEvent.AllDayEvent); OKToDrawEditFrame := not (FDayView.ActiveEvent.AllDayEvent);
if (TVpDayViewOpener(FDayView).dvInPlaceEditor <> nil) and
TVpDayViewOpener(FDayView).dvInplaceEditor.Visible and
OKToDrawEditFrame
then
with TVpDayViewOpener(FDayView) do with TVpDayViewOpener(FDayView) do
DrawEditFrame(dvActiveEventRec, GutterWidth, Datastore.CategoryColorMap.GetColor(ActiveEvent.Category)); if (dvInPlaceEditor <> nil) and dvInplaceEditor.Visible and OKToDrawEditFrame then
begin
tmpRect := dvActiveEventRec;
DrawEditFrame(tmpRect, GutterWidth, level,
Datastore.CategoryColorMap.GetColor(ActiveEvent.Category));
end;
finally finally
{ Clean Up } { Clean Up }