tvplanit: Some more fine-tuning of pixels when painting day and week views.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4895 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-07-02 13:07:46 +00:00
parent dd215650bc
commit b25bcf4516
2 changed files with 11 additions and 23 deletions

View File

@ -657,6 +657,8 @@ begin
else else
if FDayView.DrawingStyle = ds3d then begin if FDayView.DrawingStyle = ds3d then begin
dec(R.Bottom); dec(R.Bottom);
if Col = FDayView.NumDays - 1 then
dec(R.Right, 4);
R := TPSRotateRectangle(Angle, RenderIn, R); R := TPSRotateRectangle(Angle, RenderIn, R);
DrawBevelRect(RenderCanvas, R, BevelHighlight, BevelDarkShadow); DrawBevelRect(RenderCanvas, R, BevelHighlight, BevelDarkShadow);
end; end;
@ -1352,7 +1354,7 @@ end;
procedure TVpDayViewPainter.CalcRowHeadRect(out ARect: TRect); procedure TVpDayViewPainter.CalcRowHeadRect(out ARect: TRect);
begin begin
ARect := Rect( ARect := Rect(
RealLeft + 1, RealLeft, // + 1,
ADEventsRect.Bottom, // + 1, ADEventsRect.Bottom, // + 1,
RealLeft + 2 + RealRowHeadWidth, RealLeft + 2 + RealRowHeadWidth,
RealBottom //- 1 RealBottom //- 1
@ -1709,7 +1711,7 @@ begin
{ added because level 0 events were one pixel too far to the right } { added because level 0 events were one pixel too far to the right }
else else
AEventRect.Left := AEventRect.Left - 1; AEventRect.Left := AEventRect.Left - 1;
AEventRect.Right := AEventRect.Left + eventWidth - FDayView.GutterWidth; AEventRect.Right := AEventRect.Left + eventWidth + 1; //- FDayView.GutterWidth + 1;
end; end;
{ remove the date portion from the start and end times } { remove the date portion from the start and end times }

View File

@ -13,7 +13,7 @@ type
private private
FWeekView: TVpWeekView; FWeekView: TVpWeekView;
// local parameters of the old TVpWeekView method // local parameters of the old TVpWeekView method
HeadRect: TRect; // HeadRect: TRect;
DayRectHeight: Integer; DayRectHeight: Integer;
// StrLn: Integer; // StrLn: Integer;
StartDate: TDateTime; StartDate: TDateTime;
@ -518,6 +518,7 @@ end;
procedure TVpWeekViewPainter.DrawHeader; procedure TVpWeekViewPainter.DrawHeader;
var var
HeadRect: TRect;
HeadTextRect: TRect; HeadTextRect: TRect;
HeadStr: string; HeadStr: string;
HeadStrLen : Integer; HeadStrLen : Integer;
@ -527,26 +528,16 @@ begin
RenderCanvas.Font.Assign(TFont(FWeekView.HeadAttributes.Font)); RenderCanvas.Font.Assign(TFont(FWeekView.HeadAttributes.Font));
{ draw the header cell and borders } { draw the header cell and borders }
if FWeekView.DrawingStyle = dsFlat then begin if FWeekView.DrawingStyle = dsFlat then begin
{ draw an outer and inner bevel } { draw simple border rectangle }
HeadRect := Rect(RealLeft, RealTop, RealRight, RealTop + TVpWeekViewOpener(FWeekView).wvHeaderHeight + 2); HeadRect := Rect(RealLeft, RealTop, RealRight, RealTop + TVpWeekViewOpener(FWeekView).wvHeaderHeight + 2);
TPSFillRect(RenderCanvas, Angle, RenderIn, HeadRect); TPSFillRect(RenderCanvas, Angle, RenderIn, HeadRect);
{ wp: above lines replace the next ones - no bevel in flat style!
HeadRect.Left := RealLeft + 1;
HeadRect.Top := RealTop + 1;
HeadRect.Right := RealRight - 1;
HeadRect.Bottom := HeadRect.Top + wvHeaderHeight;
TPSFillRect (RenderCanvas, Angle, RenderIn, HeadRect);
DrawBevelRect (RenderCanvas,
TPSRotateRectangle (Angle, RenderIn, HeadRect),
BevelHighlightColor, BevelShadowColor);
}
end else end else
if FWeekView.DrawingStyle = ds3d then begin if FWeekView.DrawingStyle = ds3d then begin
{ draw a 3d bevel } { draw a 3d bevel }
HeadRect.Left := RealLeft + 2; HeadRect.Left := RealLeft + 2;
HeadRect.Top := RealTop + 2; HeadRect.Top := RealTop + 2;
HeadRect.Right := RealRight - 3; HeadRect.Right := RealRight - 3;
HeadRect.Bottom := RealTop + TVpWeekViewOpener(FWeekView).wvHeaderHeight; HeadRect.Bottom := RealTop + TVpWeekViewOpener(FWeekView).wvHeaderHeight + 2;
TPSFillRect(RenderCanvas, Angle, RenderIn, HeadRect); TPSFillRect(RenderCanvas, Angle, RenderIn, HeadRect);
DrawBevelRect( DrawBevelRect(
RenderCanvas, RenderCanvas,
@ -554,12 +545,8 @@ begin
BevelHighlightColor, BevelHighlightColor,
BevelDarkShadow BevelDarkShadow
); );
end else begin end else
HeadRect.Left := RealLeft + 1; raise Exception.Create('DrawingStyle not supported.');
HeadRect.Top := RealTop + 1;
HeadRect.Right := RealRight - 1;
HeadRect.Bottom := HeadRect.Top + TVpWeekViewOpener(FWeekView).wvHeaderHeight;
end;
{ build header caption } { build header caption }
weekNo := GetWeekOfYear(StartDate); weekNo := GetWeekOfYear(StartDate);
@ -568,8 +555,7 @@ begin
]); ]);
{ draw the text } { draw the text }
if DisplayOnly and (RenderCanvas.TextWidth(HeadStr) >= WidthOf(RenderIn)) if DisplayOnly and (RenderCanvas.TextWidth(HeadStr) >= WidthOf(RenderIn)) then
then
HeadTextRect.TopLeft:= Point(RealLeft + TextMargin * 2, HeadRect.Top) HeadTextRect.TopLeft:= Point(RealLeft + TextMargin * 2, HeadRect.Top)
else else
if DisplayOnly then if DisplayOnly then