TvPlanit: Fix clipping of too-large event images.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8896 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-07-22 15:47:53 +00:00
parent ad1cd546a6
commit 45d2ee6485

View File

@ -223,14 +223,16 @@ var
w: Integer;
begin
w := 0;
if AlarmW <> 0 then inc(w, AlarmW + FScaledIconMargin);
if RecurringW <> 0 then inc(w, RecurringW + FScaledIconMargin);
if CategoryW <> 0 then inc(w, CategoryW + FScaledIconMargin);
if CustomW <> 0 then inc(w, CustomW + FScaledIconMargin);
if w <> 0 then inc(w, FScaledIconMargin);
Result := AEventRect;
Result.Right := Result.Left + w;
if AlarmW <> 0 then
inc(w, AlarmW + FScaledIconMargin);
if RecurringW <> 0 then
inc(w, RecurringW + FScaledIconMargin);
if CategoryW <> 0 then
inc(w, CategoryW + FScaledIconMargin);
if CustomW <> 0 then
inc(w, CustomW + FScaledIconMargin);
if w <> 0 then
inc(w, FScaledIconMargin);
MaxHeight := AlarmH + FScaledIconMargin;
if RecurringH + FScaledIconMargin > MaxHeight then
@ -239,12 +241,12 @@ begin
MaxHeight := dvBmpCategory.Height;
if CustomH + FScaledIconMargin > MaxHeight then
MaxHeight := dvBmpCustom.Height;
if MaxHeight > AEventRect.Bottom - AEventRect.Top then
MaxHeight := AEventRect.Bottom - AEventRect.Top;
if MaxHeight > AEventRect.Bottom - AEventRect.Top - 1 then
MaxHeight := AEventRect.Bottom - AEventRect.Top - 1;
Result.Bottom := AEventRect.Top + MaxHeight;
if Result.Right > AEventRect.Right then
Result.Right := AEventRect.Right;
Result := AEventRect;
Result.Bottom := Min(AEventRect.Top + MaxHeight, AEventRect.Bottom);
Result.Right := Min(Result.Left + w, AEventRect.Right);
end;
{ Returns the imagelist attached to the datastore of the dayview. }
@ -748,6 +750,8 @@ var
tmpRect: TRect;
maxW: Integer;
grp: TVpResourceGroup;
clipR: TRect;
didClip: Boolean;
begin
{ Initialize, collect useful information needed later }
if Assigned(FDayView.Datastore) then
@ -887,7 +891,15 @@ begin
FDayView.OnPrepareEventFont(FDayView, AEvent, RenderCanvas.Font);
if FDayView.IconAttributes.ShowInPrint then
begin
clipR := RenderCanvas.ClipRect;
didClip := RenderCanvas.Clipping;
RenderCanvas.ClipRect := EventRect;
RenderCanvas.Clipping := true;
DrawIcons(IconRect);
RenderCanvas.ClipRect := clipR;
RenderCanvas.Clipping := didClip;
end;
{ Build the event string }
EventString := FDayView.BuildEventString(AEvent, false);