From 21622f66e740841458dbebddac1f83c7f55a1985 Mon Sep 17 00:00:00 2001 From: ask Date: Sat, 16 Jun 2012 10:06:57 +0000 Subject: [PATCH] TAChart: Introduce ZeroRect constant git-svn-id: trunk@37664 - --- components/tachart/tachartlistbox.pas | 4 ++-- components/tachart/tachartutils.pas | 1 + components/tachart/tagraph.pas | 4 ++-- components/tachart/tanavigation.pas | 2 +- components/tachart/test/UtilsTest.pas | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/components/tachart/tachartlistbox.pas b/components/tachart/tachartlistbox.pas index 9d12f5b3d2..ac7272cf96 100644 --- a/components/tachart/tachartlistbox.pas +++ b/components/tachart/tachartlistbox.pas @@ -218,8 +218,8 @@ procedure TChartListbox.CalcRects( var w, x: Integer; begin - ACheckBoxRect := Rect(-1, -1, -1, -1); - ASeriesIconRect := Rect(-1, -1, -1, -1); + ACheckBoxRect := ZeroRect; + ASeriesIconRect := ZeroRect; w := GetSystemMetrics(SM_CYMENUCHECK); x := 2; if cloShowCheckboxes in Options then begin diff --git a/components/tachart/tachartutils.pas b/components/tachart/tachartutils.pas index 5f598c6a5d..372f3418de 100644 --- a/components/tachart/tachartutils.pas +++ b/components/tachart/tachartutils.pas @@ -250,6 +250,7 @@ const '%4:.9g' // smsXValue ); ZeroDoublePoint: TDoublePoint = (X: 0; Y: 0); + ZeroRect: TRect = (Left: 0; Top: 0; Right: 0; Bottom: 0); EmptyDoubleRect: TDoubleRect = (coords: (0, 0, 0, 0)); EmptyExtent: TDoubleRect = (coords: (Infinity, Infinity, NegInfinity, NegInfinity)); diff --git a/components/tachart/tagraph.pas b/components/tachart/tagraph.pas index c126b9da44..4c389298e8 100644 --- a/components/tachart/tagraph.pas +++ b/components/tachart/tagraph.pas @@ -1001,7 +1001,7 @@ var a: TRectArray absolute Result; s: TBasicChartSeries; begin - Result := Rect(0, 0, 0, 0); + Result := ZeroRect; for s in Series do if s.Active then s.UpdateMargins(ADrawer, Result); @@ -1171,7 +1171,7 @@ begin // There is a cyclic dependency: extent -> visible marks -> margins. // We recalculate them iteratively hoping that the process converges. - CalculateTransformationCoeffs(Rect(0, 0, 0, 0)); + CalculateTransformationCoeffs(ZeroRect); cr := FClipRect; for tries := 1 to 10 do begin axisMargin := AxisList.Measure(CurrentExtent); diff --git a/components/tachart/tanavigation.pas b/components/tachart/tanavigation.pas index 9c71d3b576..3acd7fb27f 100644 --- a/components/tachart/tanavigation.pas +++ b/components/tachart/tanavigation.pas @@ -265,7 +265,7 @@ begin FFullExtentPen.OnChange := @ChartExtentChanged; FLogicalExtentPen := TPen.Create; FLogicalExtentPen.OnChange := @ChartExtentChanged; - FLogicalExtentRect := Rect(0, 0, 0, 0); + FLogicalExtentRect := ZeroRect; Width := DEF_WIDTH; Height := DEF_HEIGHT; FAllowDragNavigation := true; diff --git a/components/tachart/test/UtilsTest.pas b/components/tachart/test/UtilsTest.pas index 199ce88902..2e361b778b 100644 --- a/components/tachart/test/UtilsTest.pas +++ b/components/tachart/test/UtilsTest.pas @@ -190,7 +190,7 @@ procedure TGeometryTest.TestExpandRect; var r: TRect; begin - r := Rect(0, 0, 0, 0); + r := ZeroRect; ExpandRect(r, Point(1, 2)); AssertEquals(Rect(0, 0, 1, 2), r); ExpandRect(r, Point(-5, -6));