You've already forked lazarus-ccr
tvplanit: Fix calculation of last month rectangle. Undo changes in vpganttviewpainter by r8455.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8457 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1280,7 +1280,7 @@ begin
|
|||||||
else
|
else
|
||||||
nDays := DaysInMonth(dm);
|
nDays := DaysInMonth(dm);
|
||||||
if dm + nDays > FEndDate then
|
if dm + nDays > FEndDate then
|
||||||
nDays := trunc(FEndDate) - trunc(dm);
|
nDays := trunc(FEndDate) - trunc(dm) + 1;
|
||||||
x2 := x1 + nDays * ColWidth;
|
x2 := x1 + nDays * ColWidth;
|
||||||
FMonthRecords[i].Rect := Rect(x1, y1, x2, y2);
|
FMonthRecords[i].Rect := Rect(x1, y1, x2, y2);
|
||||||
FMonthRecords[i].Date := dm;
|
FMonthRecords[i].Date := dm;
|
||||||
|
@ -26,9 +26,6 @@ type
|
|||||||
RealLineColor: TColor;
|
RealLineColor: TColor;
|
||||||
RealRowHeadAttrColor: TColor;
|
RealRowHeadAttrColor: TColor;
|
||||||
|
|
||||||
RealColWidth: Integer;
|
|
||||||
RealFixedColWidth: Integer;
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
procedure Clear;
|
procedure Clear;
|
||||||
procedure DrawActiveDate;
|
procedure DrawActiveDate;
|
||||||
@ -89,7 +86,7 @@ begin
|
|||||||
dayRec := DayRecords[ActiveCol];
|
dayRec := DayRecords[ActiveCol];
|
||||||
eventRec := EventRecords[ActiveRow];
|
eventRec := EventRecords[ActiveRow];
|
||||||
|
|
||||||
dx := LeftCol * RealColWidth; //ColWidth;
|
dx := LeftCol * ColWidth;
|
||||||
dy := TopRow * RowHeight;
|
dy := TopRow * RowHeight;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -151,14 +148,14 @@ begin
|
|||||||
begin
|
begin
|
||||||
R1 := R;
|
R1 := R;
|
||||||
InflateRect(R1, -1, -1);
|
InflateRect(R1, -1, -1);
|
||||||
R1.Right := RealFixedColWidth - 1; //FGanttView.FixedColWidth-1;
|
R1.Right := FGanttView.FixedColWidth-1;
|
||||||
DrawBevelRect(
|
DrawBevelRect(
|
||||||
RenderCanvas,
|
RenderCanvas,
|
||||||
TPSRotateRectangle(Angle, RenderIn, R1),
|
TPSRotateRectangle(Angle, RenderIn, R1),
|
||||||
BevelHighlight,
|
BevelHighlight,
|
||||||
BevelShadow
|
BevelShadow
|
||||||
);
|
);
|
||||||
R1.Left := RealFixedColWidth; //FGanttView.FixedColWidth;
|
R1.Left := FGanttView.FixedColWidth;
|
||||||
R1.Right := RealRight-2;
|
R1.Right := RealRight-2;
|
||||||
DrawBevelRect(
|
DrawBevelRect(
|
||||||
RenderCanvas,
|
RenderCanvas,
|
||||||
@ -168,16 +165,14 @@ begin
|
|||||||
);
|
);
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
// TPSMoveTo(RenderCanvas, Angle, RenderIn, FGanttView.FixedColWidth, R.Top);
|
TPSMoveTo(RenderCanvas, Angle, RenderIn, FGanttView.FixedColWidth, R.Top);
|
||||||
// TPSLineTo(RenderCanvas, Angle, RenderIn, FGanttView.FixedColWidth, R.Bottom);
|
TPSLineTo(RenderCanvas, Angle, RenderIn, FGanttView.FixedColWidth, R.Bottom);
|
||||||
TPSMoveTo(RenderCanvas, Angle, RenderIn, RealFixedColWidth, R.Top);
|
|
||||||
TPSLineTo(RenderCanvas, Angle, RenderIn, RealFixedColWidth, R.Bottom);
|
|
||||||
TPSMoveTo(RenderCanvas, Angle, RenderIn, RealLeft, R.Bottom);
|
TPSMoveTo(RenderCanvas, Angle, RenderIn, RealLeft, R.Bottom);
|
||||||
TPSLineTo(RenderCanvas, Angle, RenderIn, RealRight, R.Bottom);
|
TPSLineTo(RenderCanvas, Angle, RenderIn, RealRight, R.Bottom);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Offset due to scrolling
|
// Offset due to scrolling
|
||||||
dx := FGanttView.LeftCol * RealColWidth; //FGanttView.ColWidth;
|
dx := FGanttView.LeftCol * FGanttView.ColWidth;
|
||||||
|
|
||||||
// Draw month rectangles and month captions
|
// Draw month rectangles and month captions
|
||||||
RenderCanvas.Font.Assign(FMonthFont);
|
RenderCanvas.Font.Assign(FMonthFont);
|
||||||
@ -189,12 +184,8 @@ begin
|
|||||||
OffsetRect(R, -dx , 0);
|
OffsetRect(R, -dx , 0);
|
||||||
|
|
||||||
// Clip at fixed col edge
|
// Clip at fixed col edge
|
||||||
{
|
|
||||||
if R.Left < FGanttView.FixedColWidth then
|
if R.Left < FGanttView.FixedColWidth then
|
||||||
R.Left := FGanttView.FixedColWidth;
|
R.Left := FGanttView.FixedColWidth;
|
||||||
}
|
|
||||||
if R.Left < RealFixedColWidth then
|
|
||||||
R.Left := RealFixedColWidth;
|
|
||||||
|
|
||||||
// Draw month box
|
// Draw month box
|
||||||
if FGanttView.DrawingStyle = ds3D then
|
if FGanttView.DrawingStyle = ds3D then
|
||||||
@ -241,8 +232,7 @@ begin
|
|||||||
dayRec := FGanttView.DayRecords[i];
|
dayRec := FGanttView.DayRecords[i];
|
||||||
R := dayRec.Rect;
|
R := dayRec.Rect;
|
||||||
OffsetRect(R, -dx, 0);
|
OffsetRect(R, -dx, 0);
|
||||||
if R.Left < RealFixedColWidth then
|
if R.Left < FGanttView.FixedColWidth then
|
||||||
// if R.Left < FGanttView.FixedColWidth then
|
|
||||||
Continue;
|
Continue;
|
||||||
|
|
||||||
// In sdmHeader SpecialDayMode we must repaint the background of the
|
// In sdmHeader SpecialDayMode we must repaint the background of the
|
||||||
@ -311,7 +301,7 @@ var
|
|||||||
dx, dy: Integer;
|
dx, dy: Integer;
|
||||||
top_margin, bottom_margin: Integer;
|
top_margin, bottom_margin: Integer;
|
||||||
begin
|
begin
|
||||||
dx := FGanttView.LeftCol * RealColWidth; //FGanttView.ColWidth;
|
dx := FGanttView.LeftCol * FGanttView.ColWidth;
|
||||||
dy := FGanttView.TopRow * FGanttView.RowHeight;
|
dy := FGanttView.TopRow * FGanttView.RowHeight;
|
||||||
|
|
||||||
if FGanttView.DrawingStyle = ds3D then
|
if FGanttView.DrawingStyle = ds3D then
|
||||||
@ -334,16 +324,10 @@ begin
|
|||||||
dec(R.Bottom, bottom_margin);
|
dec(R.Bottom, bottom_margin);
|
||||||
if R.Top < FGanttView.TotalColHeaderHeight then
|
if R.Top < FGanttView.TotalColHeaderHeight then
|
||||||
Continue;
|
Continue;
|
||||||
if R.Right < RealFixedColWidth then
|
|
||||||
Continue;
|
|
||||||
if R.Left < RealFixedColWidth then
|
|
||||||
R.Left := RealFixedColWidth;
|
|
||||||
{
|
|
||||||
if R.Right < FGanttView.FixedColWidth then
|
if R.Right < FGanttView.FixedColWidth then
|
||||||
Continue;
|
Continue;
|
||||||
if R.Left < FGanttView.FixedColWidth then
|
if R.Left < FGanttView.FixedColWidth then
|
||||||
R.Left := FGanttView.FixedColWidth;
|
R.Left := FGanttView.FixedColWidth;
|
||||||
}
|
|
||||||
cat := FGanttView.DataStore.CategoryColorMap.GetCategory(event.Category);
|
cat := FGanttView.DataStore.CategoryColorMap.GetCategory(event.Category);
|
||||||
RenderCanvas.Pen.Color := cat.Color;
|
RenderCanvas.Pen.Color := cat.Color;
|
||||||
RenderCanvas.Brush.Color := cat.BackgroundColor;
|
RenderCanvas.Brush.Color := cat.BackgroundColor;
|
||||||
@ -362,12 +346,11 @@ var
|
|||||||
begin
|
begin
|
||||||
RenderCanvas.Pen.Color := RealLineColor;
|
RenderCanvas.Pen.Color := RealLineColor;
|
||||||
|
|
||||||
dx := FGanttView.LeftCol * RealColWidth; //FGanttView.ColWidth;
|
dx := FGanttView.LeftCol * FGanttView.ColWidth;
|
||||||
dy := FGanttView.TopRow * FGanttView.RowHeight;
|
dy := FGanttView.TopRow * FGanttView.RowHeight;
|
||||||
|
|
||||||
// Horizontal line terminating the col header block
|
// Horizontal line terminating the col header block
|
||||||
// x1 := RealLeft + FGanttView.FixedColWidth;
|
x1 := RealLeft + FGanttView.FixedColWidth;
|
||||||
x1 := RealLeft + RealFixedColWidth;
|
|
||||||
n := FGanttView.NumMonths;
|
n := FGanttView.NumMonths;
|
||||||
if n > 0 then
|
if n > 0 then
|
||||||
begin
|
begin
|
||||||
@ -377,9 +360,7 @@ begin
|
|||||||
x2 := RealRight;
|
x2 := RealRight;
|
||||||
y0 := FGanttView.TotalColHeaderHeight;
|
y0 := FGanttView.TotalColHeaderHeight;
|
||||||
if FGanttView.DrawingStyle = ds3D then dec(y0);
|
if FGanttView.DrawingStyle = ds3D then dec(y0);
|
||||||
TPSMoveTo(RenderCanvas, Angle, RenderIn, x1, y0);
|
RenderCanvas.Line(x1, y0, x2, y0);
|
||||||
TPSLineTo(RenderCanvas, Angle, RenderIn, x2, y0);
|
|
||||||
// RenderCanvas.Line(x1, y0, x2, y0);
|
|
||||||
|
|
||||||
// Horizontal lines
|
// Horizontal lines
|
||||||
if (gvoHorizGrid in FGanttView.Options) then
|
if (gvoHorizGrid in FGanttView.Options) then
|
||||||
@ -392,11 +373,7 @@ begin
|
|||||||
eventRec := FGanttView.EventRecords[i];
|
eventRec := FGanttView.EventRecords[i];
|
||||||
y1 := y0 + eventRec.EventRect.Bottom;
|
y1 := y0 + eventRec.EventRect.Bottom;
|
||||||
if y1 >= FGanttView.TotalColHeaderHeight then
|
if y1 >= FGanttView.TotalColHeaderHeight then
|
||||||
begin
|
RenderCanvas.Line(x1, y1, x2, y1);
|
||||||
TPSMoveTo(RenderCanvas, Angle, RenderIn, x1, y1);
|
|
||||||
TPSLineTo(RenderCanvas, Angle, RenderIn, x2, y1);
|
|
||||||
// RenderCanvas.Line(x1, y1, x2, y1);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -416,13 +393,8 @@ begin
|
|||||||
dayRec := FGanttView.DayRecords[i];
|
dayRec := FGanttView.DayRecords[i];
|
||||||
x1 := dayRec.Rect.Right - dx;
|
x1 := dayRec.Rect.Right - dx;
|
||||||
x2 := x1;
|
x2 := x1;
|
||||||
// if x1 >= FGanttView.FixedColWidth then
|
if x1 >= FGanttView.FixedColWidth then
|
||||||
if x1 >= RealFixedColWidth then
|
RenderCanvas.Line(x1, y1, x2, y2);
|
||||||
begin
|
|
||||||
TPSMoveTo(RenderCanvas, Angle, RenderIn, x1, y1);
|
|
||||||
TPSLineTo(RenderCanvas, Angle, RenderIn, x2, y1);
|
|
||||||
// RenderCanvas.Line(x1, y1, x2, y2);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -442,8 +414,7 @@ begin
|
|||||||
if FGanttView.DrawingStyle = ds3d then begin
|
if FGanttView.DrawingStyle = ds3d then begin
|
||||||
R.Left := RealLeft + 1;
|
R.Left := RealLeft + 1;
|
||||||
R.Top := RealTop;
|
R.Top := RealTop;
|
||||||
// R.Right := RealLeft + FGanttView.FixedColWidth - 1;
|
R.Right := RealLeft + FGanttView.FixedColWidth - 1;
|
||||||
R.Right := RealLeft + RealFixedColWidth - 1;
|
|
||||||
R.Bottom := RealBottom - 1;
|
R.Bottom := RealBottom - 1;
|
||||||
TPSFillRect(RenderCanvas, Angle, RenderIn, R);
|
TPSFillRect(RenderCanvas, Angle, RenderIn, R);
|
||||||
DrawBevelRect(
|
DrawBevelRect(
|
||||||
@ -453,13 +424,10 @@ begin
|
|||||||
BevelShadow
|
BevelShadow
|
||||||
);
|
);
|
||||||
end else begin
|
end else begin
|
||||||
// R := Rect(RealLeft, RealTop + 1, RealLeft + FGanttView.FixedColWidth, RealBottom);
|
R := Rect(RealLeft, RealTop + 1, RealLeft + FGanttView.FixedColWidth, RealBottom);
|
||||||
R := Rect(RealLeft, RealTop + 1, RealLeft + RealFixedColWidth, RealBottom);
|
|
||||||
TPSFillRect(RenderCanvas, Angle, RenderIn, R);
|
TPSFillRect(RenderCanvas, Angle, RenderIn, R);
|
||||||
RenderCanvas.Pen.Color := RealLineColor;
|
RenderCanvas.Pen.Color := RealLineColor;
|
||||||
TPSMoveTo(RenderCanvas, Angle, RenderIn, R.Right, R.Top);
|
RenderCanvas.Line(R.Right, R.Top, R.Right, R.Bottom);
|
||||||
TPSLineTo(RenderCanvas, Angle, RenderIn, R.Right, R.Bottom);
|
|
||||||
// RenderCanvas.Line(R.Right, R.Top, R.Right, R.Bottom);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
RenderCanvas.Font.Assign(FEventFont);
|
RenderCanvas.Font.Assign(FEventFont);
|
||||||
@ -488,9 +456,7 @@ begin
|
|||||||
);
|
);
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
TPSMoveTo(RenderCanvas, Angle, RenderIn, R.Left, R.Bottom);
|
RenderCanvas.Line(R.Left, R.Bottom, R.Right, R.Bottom);
|
||||||
TPSLineTo(RenderCanvas, Angle, RenderIn, R.Right, R.Bottom);
|
|
||||||
// RenderCanvas.Line(R.Left, R.Bottom, R.Right, R.Bottom);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Paint event description as header
|
// Paint event description as header
|
||||||
@ -516,7 +482,7 @@ begin
|
|||||||
|
|
||||||
nEvents := NumEvents;
|
nEvents := NumEvents;
|
||||||
nDays := NumDays;
|
nDays := NumDays;
|
||||||
dx := LeftCol * RealColWidth; //ColWidth;
|
dx := LeftCol * ColWidth;
|
||||||
dy := TopRow * RowHeight;
|
dy := TopRow * RowHeight;
|
||||||
|
|
||||||
y1 := TotalColHeaderHeight;
|
y1 := TotalColHeaderHeight;
|
||||||
@ -537,8 +503,7 @@ begin
|
|||||||
RenderCanvas.Brush.Color := clr;
|
RenderCanvas.Brush.Color := clr;
|
||||||
x1 := dayRec.Rect.Left - dx;
|
x1 := dayRec.Rect.Left - dx;
|
||||||
x2 := dayRec.Rect.Right - dx;
|
x2 := dayRec.Rect.Right - dx;
|
||||||
TPSFillRect(RenderCanvas, Angle, RenderIn, Rect(x1, y1, x2, y2));
|
RenderCanvas.FillRect(x1, y1, x2, y2);
|
||||||
// RenderCanvas.FillRect(x1, y1, x2, y2);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -641,9 +606,6 @@ begin
|
|||||||
FGanttView.Init;
|
FGanttView.Init;
|
||||||
FGanttView.VisibleCols := FGanttView.CalcVisibleCols(RealRight - RealLeft);
|
FGanttView.VisibleCols := FGanttView.CalcVisibleCols(RealRight - RealLeft);
|
||||||
FGanttView.VisibleRows := FGanttView.CalcVisibleRows(RealBottom - RealTop);
|
FGanttView.VisibleRows := FGanttView.CalcVisibleRows(RealBottom - RealTop);
|
||||||
|
|
||||||
RealColWidth := round(FGanttView.ColWidth * Scale);
|
|
||||||
RealFixedColWidth := round(FGanttView.FixedColWidth * Scale);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Reference in New Issue
Block a user