You've already forked lazarus-ccr
tvplanit: Fix scrolling issue in DayView.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4896 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1204,9 +1204,9 @@ begin
|
|||||||
|
|
||||||
{ take into account the number lines that are allowed! }
|
{ take into account the number lines that are allowed! }
|
||||||
vertical := Round(RenderHeight - ColHeadHeight * Scale - 2);
|
vertical := Round(RenderHeight - ColHeadHeight * Scale - 2);
|
||||||
Result := trunc (Vertical div RowHeight) + 2;
|
Result := trunc(Vertical div RowHeight) + 1; // - 4; //+2;
|
||||||
if Result > FLineCount then
|
if Result > FLineCount then
|
||||||
Result := FLineCOunt;
|
Result := FLineCount;
|
||||||
|
|
||||||
if (StopLine > 0) and (StopLine > StartLine) then
|
if (StopLine > 0) and (StopLine > StartLine) then
|
||||||
if Result > StopLine - StartLine then
|
if Result > StopLine - StartLine then
|
||||||
@ -1378,12 +1378,6 @@ begin
|
|||||||
Result := FNumDays;
|
Result := FNumDays;
|
||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
(*
|
|
||||||
function TVpDayView.HourToLine(const Value: TVpHours;
|
|
||||||
const UseGran: TVpGranularity): Integer;
|
|
||||||
begin
|
|
||||||
Result := Ord(Value) * 60 div GranularityMinutes[UseGran];
|
|
||||||
end; *)
|
|
||||||
|
|
||||||
procedure TVpDayView.SetDrawingStyle(Value: TVpDrawingStyle);
|
procedure TVpDayView.SetDrawingStyle(Value: TVpDrawingStyle);
|
||||||
begin
|
begin
|
||||||
@ -1473,7 +1467,8 @@ begin
|
|||||||
|
|
||||||
SetLength(dvLineMatrix, NumDays);
|
SetLength(dvLineMatrix, NumDays);
|
||||||
for I := 0 to pred(NumDays) do begin
|
for I := 0 to pred(NumDays) do begin
|
||||||
SetLength(dvLineMatrix[I], LineCount); // was +1. Why? Without it, the IDE crashes! - there is an upper loop index of LineCount in DrawCells. After correcting that, the crash is gone.
|
SetLength(dvLineMatrix[I], LineCount + 1); // was +1. Why? Without it, the IDE crashes! - there is an upper loop index of LineCount in DrawCells. After correcting that, the crash is gone.
|
||||||
|
// wp: the additional line is needed to fully display the last line of the day.
|
||||||
for J := 0 to pred(LineCount) do begin
|
for J := 0 to pred(LineCount) do begin
|
||||||
dvLineMatrix[I,J].Hour := TVpHours(J div grPerHour);
|
dvLineMatrix[I,J].Hour := TVpHours(J div grPerHour);
|
||||||
dvLineMatrix[I,J].Minute := (J mod grPerHour) * GranularityMinutes[UseGran];
|
dvLineMatrix[I,J].Minute := (J mod grPerHour) * GranularityMinutes[UseGran];
|
||||||
@ -2045,7 +2040,7 @@ begin
|
|||||||
cbSize := SizeOf(SI);
|
cbSize := SizeOf(SI);
|
||||||
fMask := SIF_RANGE or SIF_PAGE or SIF_POS;
|
fMask := SIF_RANGE or SIF_PAGE or SIF_POS;
|
||||||
nMin := 0;
|
nMin := 0;
|
||||||
nMax := FLineCount + 1;
|
nMax := FLineCount;
|
||||||
if FVisibleLines >= FLineCount then
|
if FVisibleLines >= FLineCount then
|
||||||
nPage := nMax
|
nPage := nMax
|
||||||
else
|
else
|
||||||
|
@ -447,7 +447,8 @@ begin
|
|||||||
TPSMoveTo(RenderCanvas, Angle, RenderIn, GutterRect.Right, GutterRect.Top);
|
TPSMoveTo(RenderCanvas, Angle, RenderIn, GutterRect.Right, GutterRect.Top);
|
||||||
TPSLineTo(RenderCanvas, Angle, RenderIn, GutterRect.Right, GutterRect.Bottom);
|
TPSLineTo(RenderCanvas, Angle, RenderIn, GutterRect.Right, GutterRect.Bottom);
|
||||||
|
|
||||||
for I := 0 to FDayView.LineCount - 1 do begin // wp: was without -1
|
// for I := 0 to FDayView.LineCount - 1 do begin // wp: was without -1
|
||||||
|
for I := 0 to FDayView.LineCount do begin
|
||||||
with TVpDayViewOpener(FDayView) do begin
|
with TVpDayViewOpener(FDayView) do begin
|
||||||
dvLineMatrix[Col, I].Rec.Left := -1;
|
dvLineMatrix[Col, I].Rec.Left := -1;
|
||||||
dvLineMatrix[Col, I].Rec.Top := -1;
|
dvLineMatrix[Col, I].Rec.Top := -1;
|
||||||
@ -468,7 +469,7 @@ begin
|
|||||||
RenderCanvas.Pen.Color := FDayView.LineColor;
|
RenderCanvas.Pen.Color := FDayView.LineColor;
|
||||||
|
|
||||||
{ Paint the client area }
|
{ Paint the client area }
|
||||||
for I := 0 to RealVisibleLines do begin
|
for I := 0 to RealVisibleLines + 1 do begin // +1 to show the partial line at the bottom
|
||||||
|
|
||||||
if (I > pred(FDayView.LineCount)) then
|
if (I > pred(FDayView.LineCount)) then
|
||||||
Break;
|
Break;
|
||||||
@ -723,7 +724,7 @@ begin
|
|||||||
EventELine := GetEndLine(EventETime, FDayView.Granularity);
|
EventELine := GetEndLine(EventETime, FDayView.Granularity);
|
||||||
|
|
||||||
{ If the event doesn't occupy area that is currently visible, then skip it. }
|
{ If the event doesn't occupy area that is currently visible, then skip it. }
|
||||||
if (EventELine < StartLine) or (EventSLine > StartLine + RealVisibleLines) then
|
if (EventELine < StartLine) or (EventSLine > StartLine + RealVisibleLines + 1) then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
{ Calculate the number of lines this event will cover }
|
{ Calculate the number of lines this event will cover }
|
||||||
@ -769,7 +770,7 @@ begin
|
|||||||
(EventETime < TVpDayViewOpener(FDayView).dvLineMatrix[0, EventELine + 1].Time)
|
(EventETime < TVpDayViewOpener(FDayView).dvLineMatrix[0, EventELine + 1].Time)
|
||||||
then begin
|
then begin
|
||||||
{ Get the end offset in TDateTime format }
|
{ Get the end offset in TDateTime format }
|
||||||
EndOffset := TVpDayViewOpener(FDayView).dvLineMatrix[0, EventELine + 1].Time - EventETime;
|
EndOffset := TVpDayViewOpener(FDayView).dvLineMatrix[0, EventELine + 1].Time - EventETime;
|
||||||
{ determine how many pixels to scooch down before painting the event's color code. }
|
{ determine how many pixels to scooch down before painting the event's color code. }
|
||||||
EndPixelOffset := trunc(EndOffset / PixelDuration);
|
EndPixelOffset := trunc(EndOffset / PixelDuration);
|
||||||
end;
|
end;
|
||||||
@ -1261,9 +1262,11 @@ begin
|
|||||||
LineRect := Rect(R.Left, R.Top, R.Right, R.Top + RealRowHeight);
|
LineRect := Rect(R.Left, R.Top, R.Right, R.Top + RealRowHeight);
|
||||||
Hour := Ord(TVpDayViewOpener(FDayView).dvLineMatrix[0, StartLine].Hour);
|
Hour := Ord(TVpDayViewOpener(FDayView).dvLineMatrix[0, StartLine].Hour);
|
||||||
|
|
||||||
for I := 0 to RealVisibleLines do begin
|
i := High(TVpDayviewOpener(FDayview).dvLinematrix[0]);
|
||||||
|
|
||||||
|
for I := 0 to RealVisibleLines + 1 do begin // ok: + 1 needed to see the partial line at the bottom
|
||||||
{ prevent any extraneous drawing below the last hour }
|
{ prevent any extraneous drawing below the last hour }
|
||||||
if (I + FDayView.TopLine >= FDayView.LineCount) or (Hour > 23) then
|
if (I + FDayView.TopLine > FDayView.LineCount) or (Hour > 23) then
|
||||||
Break;
|
Break;
|
||||||
|
|
||||||
case FDayView.TimeFormat of
|
case FDayView.TimeFormat of
|
||||||
@ -1311,8 +1314,13 @@ begin
|
|||||||
HourStr
|
HourStr
|
||||||
);
|
);
|
||||||
end;
|
end;
|
||||||
LastHour := Hour;
|
if StartLine + i + 1 >= High(TVpDayViewOpener(FDayView).dvLineMatrix[0]) then
|
||||||
Hour := Ord(TVpDayViewOpener(FDayView).dvLineMatrix[0, StartLine + i + 1].Hour);
|
// ">=" avoids seeing a parasitic hour in the last line
|
||||||
|
Hour := 24
|
||||||
|
else begin
|
||||||
|
LastHour := Hour;
|
||||||
|
Hour := Ord(TVpDayViewOpener(FDayView).dvLineMatrix[0, StartLine + i + 1].Hour);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TPSMoveTo(RenderCanvas, Angle, RenderIn, LineRect.Right-6, LineRect.Bottom);
|
TPSMoveTo(RenderCanvas, Angle, RenderIn, LineRect.Right-6, LineRect.Bottom);
|
||||||
@ -1354,10 +1362,10 @@ end;
|
|||||||
procedure TVpDayViewPainter.CalcRowHeadRect(out ARect: TRect);
|
procedure TVpDayViewPainter.CalcRowHeadRect(out ARect: TRect);
|
||||||
begin
|
begin
|
||||||
ARect := Rect(
|
ARect := Rect(
|
||||||
RealLeft, // + 1,
|
RealLeft,
|
||||||
ADEventsRect.Bottom, // + 1,
|
ADEventsRect.Bottom,
|
||||||
RealLeft + 2 + RealRowHeadWidth,
|
RealLeft + 2 + RealRowHeadWidth,
|
||||||
RealBottom //- 1
|
RealBottom
|
||||||
);
|
);
|
||||||
if FDayView.DrawingStyle = dsFlat then
|
if FDayView.DrawingStyle = dsFlat then
|
||||||
inc(ARect.Left);
|
inc(ARect.Left);
|
||||||
@ -1380,6 +1388,7 @@ var
|
|||||||
Icons: TVpDVIcons;
|
Icons: TVpDVIcons;
|
||||||
cat: TVpCategoryInfo;
|
cat: TVpCategoryInfo;
|
||||||
w, h: Integer;
|
w, h: Integer;
|
||||||
|
R: TRect;
|
||||||
begin
|
begin
|
||||||
ShowAlarm := False;
|
ShowAlarm := False;
|
||||||
ShowRecurring := False;
|
ShowRecurring := False;
|
||||||
@ -1406,11 +1415,8 @@ begin
|
|||||||
h := cat.Bitmap.Height;
|
h := cat.Bitmap.Height;
|
||||||
dvBmpCategory.Width := w;
|
dvBmpCategory.Width := w;
|
||||||
dvBmpCategory.Height := h;
|
dvBmpCategory.Height := h;
|
||||||
dvBmpCategory.Canvas.CopyRect(
|
R := Rect(0, 0, w, h);
|
||||||
Rect(0, 0, w, h),
|
dvBmpCategory.Canvas.CopyRect(R, cat.Bitmap.canvas, R);
|
||||||
cat.Bitmap.Canvas,
|
|
||||||
Rect(0, 0, w, h)
|
|
||||||
);
|
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
dvBmpCategory.Width := 0;
|
dvBmpCategory.Width := 0;
|
||||||
@ -1579,7 +1585,7 @@ begin
|
|||||||
|
|
||||||
InitializeEventRectangles;
|
InitializeEventRectangles;
|
||||||
|
|
||||||
{ Draw the All Day Events }
|
{ Draw the all-day events }
|
||||||
DrawAllDayEvents;
|
DrawAllDayEvents;
|
||||||
|
|
||||||
{ Draw the area in the top left corner, where the nav buttons go. }
|
{ Draw the area in the top left corner, where the nav buttons go. }
|
||||||
@ -1701,8 +1707,12 @@ begin
|
|||||||
if AEventRect.Top < VisibleRect.Top then
|
if AEventRect.Top < VisibleRect.Top then
|
||||||
AEventRect.Top := VisibleRect.Top;
|
AEventRect.Top := VisibleRect.Top;
|
||||||
|
|
||||||
if AEventRect.Bottom < VisibleRect.Top then
|
if AEventRect.Bottom = -1 then
|
||||||
|
AEventRect.Bottom := AEventRect.Top + RealRowHeight
|
||||||
|
else
|
||||||
|
if (AEventRect.Bottom < VisibleRect.Top) then
|
||||||
AEventRect.Bottom := VisibleRect.Bottom;
|
AEventRect.Bottom := VisibleRect.Bottom;
|
||||||
|
|
||||||
eventWidth := WidthOf(VisibleRect) div AWidthDivisor;
|
eventWidth := WidthOf(VisibleRect) div AWidthDivisor;
|
||||||
|
|
||||||
{ Slide the rect over to correspond with the level }
|
{ Slide the rect over to correspond with the level }
|
||||||
@ -1711,7 +1721,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 + 1; //- FDayView.GutterWidth + 1;
|
AEventRect.Right := AEventRect.Left + eventWidth + 1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ remove the date portion from the start and end times }
|
{ remove the date portion from the start and end times }
|
||||||
|
Reference in New Issue
Block a user