diff --git a/components/tvplanit/source/vpganttview.pas b/components/tvplanit/source/vpganttview.pas index 4292f72d2..b5734dcce 100644 --- a/components/tvplanit/source/vpganttview.pas +++ b/components/tvplanit/source/vpganttview.pas @@ -1280,7 +1280,7 @@ begin else nDays := DaysInMonth(dm); if dm + nDays > FEndDate then - nDays := trunc(FEndDate) - trunc(dm); + nDays := trunc(FEndDate) - trunc(dm) + 1; x2 := x1 + nDays * ColWidth; FMonthRecords[i].Rect := Rect(x1, y1, x2, y2); FMonthRecords[i].Date := dm; diff --git a/components/tvplanit/source/vpganttviewpainter.pas b/components/tvplanit/source/vpganttviewpainter.pas index 63a1b41aa..ab6ea3172 100644 --- a/components/tvplanit/source/vpganttviewpainter.pas +++ b/components/tvplanit/source/vpganttviewpainter.pas @@ -26,9 +26,6 @@ type RealLineColor: TColor; RealRowHeadAttrColor: TColor; - RealColWidth: Integer; - RealFixedColWidth: Integer; - protected procedure Clear; procedure DrawActiveDate; @@ -89,7 +86,7 @@ begin dayRec := DayRecords[ActiveCol]; eventRec := EventRecords[ActiveRow]; - dx := LeftCol * RealColWidth; //ColWidth; + dx := LeftCol * ColWidth; dy := TopRow * RowHeight; end; @@ -151,14 +148,14 @@ begin begin R1 := R; InflateRect(R1, -1, -1); - R1.Right := RealFixedColWidth - 1; //FGanttView.FixedColWidth-1; + R1.Right := FGanttView.FixedColWidth-1; DrawBevelRect( RenderCanvas, TPSRotateRectangle(Angle, RenderIn, R1), BevelHighlight, BevelShadow ); - R1.Left := RealFixedColWidth; //FGanttView.FixedColWidth; + R1.Left := FGanttView.FixedColWidth; R1.Right := RealRight-2; DrawBevelRect( RenderCanvas, @@ -168,16 +165,14 @@ begin ); end else begin -// TPSMoveTo(RenderCanvas, Angle, RenderIn, FGanttView.FixedColWidth, R.Top); -// 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, FGanttView.FixedColWidth, R.Top); + TPSLineTo(RenderCanvas, Angle, RenderIn, FGanttView.FixedColWidth, R.Bottom); TPSMoveTo(RenderCanvas, Angle, RenderIn, RealLeft, R.Bottom); TPSLineTo(RenderCanvas, Angle, RenderIn, RealRight, R.Bottom); end; // Offset due to scrolling - dx := FGanttView.LeftCol * RealColWidth; //FGanttView.ColWidth; + dx := FGanttView.LeftCol * FGanttView.ColWidth; // Draw month rectangles and month captions RenderCanvas.Font.Assign(FMonthFont); @@ -189,12 +184,8 @@ begin OffsetRect(R, -dx , 0); // Clip at fixed col edge - { if R.Left < FGanttView.FixedColWidth then R.Left := FGanttView.FixedColWidth; - } - if R.Left < RealFixedColWidth then - R.Left := RealFixedColWidth; // Draw month box if FGanttView.DrawingStyle = ds3D then @@ -241,8 +232,7 @@ begin dayRec := FGanttView.DayRecords[i]; R := dayRec.Rect; OffsetRect(R, -dx, 0); - if R.Left < RealFixedColWidth then -// if R.Left < FGanttView.FixedColWidth then + if R.Left < FGanttView.FixedColWidth then Continue; // In sdmHeader SpecialDayMode we must repaint the background of the @@ -311,7 +301,7 @@ var dx, dy: Integer; top_margin, bottom_margin: Integer; begin - dx := FGanttView.LeftCol * RealColWidth; //FGanttView.ColWidth; + dx := FGanttView.LeftCol * FGanttView.ColWidth; dy := FGanttView.TopRow * FGanttView.RowHeight; if FGanttView.DrawingStyle = ds3D then @@ -334,16 +324,10 @@ begin dec(R.Bottom, bottom_margin); if R.Top < FGanttView.TotalColHeaderHeight then Continue; - if R.Right < RealFixedColWidth then - Continue; - if R.Left < RealFixedColWidth then - R.Left := RealFixedColWidth; - { if R.Right < FGanttView.FixedColWidth then Continue; if R.Left < FGanttView.FixedColWidth then R.Left := FGanttView.FixedColWidth; - } cat := FGanttView.DataStore.CategoryColorMap.GetCategory(event.Category); RenderCanvas.Pen.Color := cat.Color; RenderCanvas.Brush.Color := cat.BackgroundColor; @@ -362,12 +346,11 @@ var begin RenderCanvas.Pen.Color := RealLineColor; - dx := FGanttView.LeftCol * RealColWidth; //FGanttView.ColWidth; + dx := FGanttView.LeftCol * FGanttView.ColWidth; dy := FGanttView.TopRow * FGanttView.RowHeight; // Horizontal line terminating the col header block -// x1 := RealLeft + FGanttView.FixedColWidth; - x1 := RealLeft + RealFixedColWidth; + x1 := RealLeft + FGanttView.FixedColWidth; n := FGanttView.NumMonths; if n > 0 then begin @@ -377,9 +360,7 @@ begin x2 := RealRight; y0 := FGanttView.TotalColHeaderHeight; if FGanttView.DrawingStyle = ds3D then dec(y0); - TPSMoveTo(RenderCanvas, Angle, RenderIn, x1, y0); - TPSLineTo(RenderCanvas, Angle, RenderIn, x2, y0); -// RenderCanvas.Line(x1, y0, x2, y0); + RenderCanvas.Line(x1, y0, x2, y0); // Horizontal lines if (gvoHorizGrid in FGanttView.Options) then @@ -392,11 +373,7 @@ begin eventRec := FGanttView.EventRecords[i]; y1 := y0 + eventRec.EventRect.Bottom; if y1 >= FGanttView.TotalColHeaderHeight then - begin - TPSMoveTo(RenderCanvas, Angle, RenderIn, x1, y1); - TPSLineTo(RenderCanvas, Angle, RenderIn, x2, y1); -// RenderCanvas.Line(x1, y1, x2, y1); - end; + RenderCanvas.Line(x1, y1, x2, y1); end; end; @@ -416,13 +393,8 @@ begin dayRec := FGanttView.DayRecords[i]; x1 := dayRec.Rect.Right - dx; x2 := x1; -// if x1 >= FGanttView.FixedColWidth then - if x1 >= RealFixedColWidth then - begin - TPSMoveTo(RenderCanvas, Angle, RenderIn, x1, y1); - TPSLineTo(RenderCanvas, Angle, RenderIn, x2, y1); -// RenderCanvas.Line(x1, y1, x2, y2); - end; + if x1 >= FGanttView.FixedColWidth then + RenderCanvas.Line(x1, y1, x2, y2); end; end; end; @@ -442,8 +414,7 @@ begin if FGanttView.DrawingStyle = ds3d then begin R.Left := RealLeft + 1; R.Top := RealTop; -// R.Right := RealLeft + FGanttView.FixedColWidth - 1; - R.Right := RealLeft + RealFixedColWidth - 1; + R.Right := RealLeft + FGanttView.FixedColWidth - 1; R.Bottom := RealBottom - 1; TPSFillRect(RenderCanvas, Angle, RenderIn, R); DrawBevelRect( @@ -453,13 +424,10 @@ begin BevelShadow ); end else begin -// R := Rect(RealLeft, RealTop + 1, RealLeft + FGanttView.FixedColWidth, RealBottom); - R := Rect(RealLeft, RealTop + 1, RealLeft + RealFixedColWidth, RealBottom); + R := Rect(RealLeft, RealTop + 1, RealLeft + FGanttView.FixedColWidth, RealBottom); TPSFillRect(RenderCanvas, Angle, RenderIn, R); RenderCanvas.Pen.Color := RealLineColor; - TPSMoveTo(RenderCanvas, Angle, RenderIn, R.Right, R.Top); - TPSLineTo(RenderCanvas, Angle, RenderIn, R.Right, R.Bottom); -// RenderCanvas.Line(R.Right, R.Top, R.Right, R.Bottom); + RenderCanvas.Line(R.Right, R.Top, R.Right, R.Bottom); end; RenderCanvas.Font.Assign(FEventFont); @@ -488,9 +456,7 @@ begin ); end else begin - TPSMoveTo(RenderCanvas, Angle, RenderIn, R.Left, R.Bottom); - TPSLineTo(RenderCanvas, Angle, RenderIn, R.Right, R.Bottom); -// RenderCanvas.Line(R.Left, R.Bottom, R.Right, R.Bottom); + RenderCanvas.Line(R.Left, R.Bottom, R.Right, R.Bottom); end; // Paint event description as header @@ -516,7 +482,7 @@ begin nEvents := NumEvents; nDays := NumDays; - dx := LeftCol * RealColWidth; //ColWidth; + dx := LeftCol * ColWidth; dy := TopRow * RowHeight; y1 := TotalColHeaderHeight; @@ -537,8 +503,7 @@ begin RenderCanvas.Brush.Color := clr; x1 := dayRec.Rect.Left - 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; @@ -641,9 +606,6 @@ begin FGanttView.Init; FGanttView.VisibleCols := FGanttView.CalcVisibleCols(RealRight - RealLeft); FGanttView.VisibleRows := FGanttView.CalcVisibleRows(RealBottom - RealTop); - - RealColWidth := round(FGanttView.ColWidth * Scale); - RealFixedColWidth := round(FGanttView.FixedColWidth * Scale); end; end.