TAChart: Fix compilation due to recent changes in FPC 3.3.1. Issue #38301.

git-svn-id: trunk@64324 -
This commit is contained in:
wp 2021-01-03 17:25:04 +00:00
parent 4002a31014
commit 519788b865
10 changed files with 45 additions and 45 deletions

View File

@ -417,13 +417,13 @@ var
p1, p2: TPoint;
begin
if FAxis.IsFlipped then begin
p1 := Point(IfThen(FAtDataOnly, GraphToImage(FMaxForMarks), FClipRect^.Left), AFixedCoord);
p2 := Point(IfThen(FAtDataOnly, GraphToImage(FMinForMarks), FClipRect^.Right), AFixedCoord);
p1 := Point(Math.IfThen(FAtDataOnly, GraphToImage(FMaxForMarks), FClipRect^.Left), AFixedCoord);
p2 := Point(Math.IfThen(FAtDataOnly, GraphToImage(FMinForMarks), FClipRect^.Right), AFixedCoord);
if FAxis.Arrow.Visible then
p1.X -= FDrawer.Scale(FAxis.Arrow.Length);
end else begin
p1 := Point(IfThen(FAtDataOnly, GraphToImage(FMinForMarks), FClipRect^.Left), AFixedCoord);
p2 := Point(IfThen(FAtDataOnly, GraphToImage(FMaxForMarks), FClipRect^.Right), AFixedCoord);
p1 := Point(Math.IfThen(FAtDataOnly, GraphToImage(FMinForMarks), FClipRect^.Left), AFixedCoord);
p2 := Point(Math.IfThen(FAtDataOnly, GraphToImage(FMaxForMarks), FClipRect^.Right), AFixedCoord);
if FAxis.Arrow.Visible then
p2.X += FDrawer.Scale(FAxis.Arrow.Length);
end;
@ -486,13 +486,13 @@ var
p1, p2: TPoint;
begin
if FAxis.IsFlipped then begin
p1 := Point(AFixedCoord, IfThen(FAtDataOnly, GraphToImage(FMaxForMarks), FClipRect^.Bottom));
p2 := Point(AFixedCoord, IfThen(FAtDataOnly, GraphToImage(FMinForMarks), FClipRect^.Top));
p1 := Point(AFixedCoord, Math.IfThen(FAtDataOnly, GraphToImage(FMaxForMarks), FClipRect^.Bottom));
p2 := Point(AFixedCoord, Math.IfThen(FAtDataOnly, GraphToImage(FMinForMarks), FClipRect^.Top));
if FAxis.Arrow.Visible then
p1.Y += FDrawer.Scale(FAxis.Arrow.Length);
end else begin
p1 := Point(AFixedCoord, IfThen(FAtDataOnly, GraphToImage(FMinForMarks), FClipRect^.Bottom));
p2 := Point(AFixedCoord, IfThen(FAtDataOnly, GraphToImage(FMaxForMarks), FClipRect^.Top));
p1 := Point(AFixedCoord, Math.IfThen(FAtDataOnly, GraphToImage(FMinForMarks), FClipRect^.Bottom));
p2 := Point(AFixedCoord, Math.IfThen(FAtDataOnly, GraphToImage(FMaxForMarks), FClipRect^.Top));
if FAxis.Arrow.Visible then
p2.Y -= FDrawer.Scale(FAxis.Arrow.Length);
end;
@ -623,7 +623,7 @@ begin
for t in AValues do
// Workaround for issue #19780, fix after upgrade to FPC 2.6.
with MeasureLabel(ADrawer, t.FText) do
Result := Max(IfThen(AIsVertical, cy, cx), Result);
Result := Max(Math.IfThen(AIsVertical, cy, cx), Result);
if Result = 0 then exit;
if DistanceToCenter then
Result := Result div 2;

View File

@ -548,7 +548,7 @@ end;
function NumberOr(ANum: Double; ADefault: Double): Double;
begin
Result := IfThen(IsNan(ANum), ADefault, ANum);
Result := Math.IfThen(IsNan(ANum), ADefault, ANum);
end;
function OrientToRad(AOrient: Integer): Double;

View File

@ -478,7 +478,7 @@ var
parts: TStrings;
i: Integer;
begin
parts := Split(IfThen(NiceSteps = '', DEF_INTERVAL_STEPS, NiceSteps));
parts := Split(StrUtils.IfThen(NiceSteps = '', DEF_INTERVAL_STEPS, NiceSteps));
try
SetLength(FStepValues, parts.Count);
for i := 0 to parts.Count - 1 do
@ -1192,7 +1192,7 @@ function TCustomChartSource.FormatItem(
const AFormat: String; AIndex, AYIndex: Integer): String;
begin
with Item[AIndex]^ do
Result := FormatItemXYText(AFormat, IfThen(XCount > 0, X, Double(AIndex)), GetY(AYIndex), Text);
Result := FormatItemXYText(AFormat, Math.IfThen(XCount > 0, X, Double(AIndex)), GetY(AYIndex), Text);
end;
function TCustomChartSource.FormatItemXYText(
@ -1234,7 +1234,7 @@ begin
ALowerDelta := 0;
if Which = 0 then
v := IfThen(XCount > 0, Item[APointIndex]^.X, APointIndex)
v := Math.IfThen(XCount > 0, Item[APointIndex]^.X, APointIndex)
else
v := Item[APointIndex]^.Y;
@ -1296,7 +1296,7 @@ var
v, dxp, dxn: Double;
begin
Result := GetErrorBarValues(APointIndex, 0, dxp, dxn);
v := IfThen(XCount > 0, Item[APointIndex]^.X, APointIndex);
v := Math.IfThen(XCount > 0, Item[APointIndex]^.X, APointIndex);
if Result and not IsNaN(v) then begin
AUpperLimit := v + dxp;
ALowerLimit := v - dxn;
@ -1491,7 +1491,7 @@ procedure TCustomChartSource.ValuesInRange(
ADest.FValue := AValue;
with Item[AIndex]^ do begin
if AParams.FUseY then begin
nx := IfThen(XCount > 0, X, AIndex);
nx := Math.IfThen(XCount > 0, X, AIndex);
ny := AValue;
end
else begin
@ -1548,7 +1548,7 @@ begin
AValues[start].FValue := SafeNan;
for i := 0 to Count - 1 do begin
with Item[I]^ do
v := IfThen(AParams.FUseY, Y, IfThen(XCount > 0, X, I));
v := Math.IfThen(AParams.FUseY, Y, Math.IfThen(XCount > 0, X, I));
if IsNan(v) then continue;
if v < AParams.FMin then begin
if v > lo.FValue then

View File

@ -254,9 +254,9 @@ begin
if Marks.Visible then begin
flip := (dpdoFlipLabel in Options) and ((a > Pi /2) or (a < -Pi / 2));
Marks.SetAdditionalAngle(
IfThen(dpdoRotateLabel in Options, IfThen(flip, Pi - a, -a), 0));
Math.IfThen(dpdoRotateLabel in Options, Math.IfThen(flip, Pi - a, -a), 0));
p1 := (p1 + p2) div 2;
a += IfThen((dpdoLabelAbove in Options) xor flip, -Pi / 2, Pi / 2);
a += Math.IfThen((dpdoLabelAbove in Options) xor flip, -Pi / 2, Pi / 2);
p2 := p1 + RotatePointX(Marks.Distance, a);
Marks.DrawLabel(ADrawer, p1, p2, GetDistanceText, dummy);
end;

View File

@ -486,7 +486,7 @@ begin
end;
// Set the requested font attributes
FFont.SizeInPoints := IfThen(AFont.Size = 0, DEFAULT_FONT_SIZE, AFont.Size);
FFont.SizeInPoints := Math.IfThen(AFont.Size = 0, DEFAULT_FONT_SIZE, AFont.Size);
FFont.UnderlineDecoration := AFont.Underline;
FFont.StrikeoutDecoration := AFont.StrikeThrough;
FFont.Hinted := true;

View File

@ -569,7 +569,7 @@ var
begin
inherited Draw(ADrawer, ARect);
with FFramePen do
pw := IfThen(EffVisible, (Width + 1) div 2, 0);
pw := Math.IfThen(EffVisible, (Width + 1) div 2, 0);
w := ARect.Right - ARect.Left - 2 * pw;
if w <= 0 then exit;
for x := ARect.Left + pw to ARect.Right - pw do begin
@ -847,7 +847,7 @@ begin
t := ParamMin;
pp := PointAt(ParamMin);
ADrawer.MoveTo(pp);
ms := IfThen(ParamMaxStep > 0, ParamMaxStep, (ParamMax - ParamMin) / 4);
ms := Math.IfThen(ParamMaxStep > 0, ParamMaxStep, (ParamMax - ParamMin) / 4);
ts := ms;
while t < ParamMax do begin
p := PointAt(t + ts);
@ -1183,8 +1183,8 @@ begin
if Assigned(p) then lBrush := p.Brush else lBrush := nil;
for s in Styles.Styles do
AItems.Add(TLegendItemLinePointer.CreateWithBrush(
IfThen((lPen <> nil) and s.UsePen, s.Pen, lPen) as TPen,
IfThen(s.UseBrush, s.Brush, lBrush) as TBrush,
TAChartUtils.IfThen((lPen <> nil) and s.UsePen, s.Pen, lPen) as TPen,
TAChartUtils.IfThen(s.UseBrush, s.Brush, lBrush) as TBrush,
p,
LegendTextStyle(s)
));
@ -1864,7 +1864,7 @@ var
SetLength(xv, n);
SetLength(yv, n);
hasErrorBars := Source.HasYErrorBars;
SetLength(dy, IfThen(hasErrorBars, n, 0));
SetLength(dy, Math.IfThen(hasErrorBars, n, 0));
j := 0;
for i := 0 to ns - 1 do
with Source.Item[i]^ do
@ -1998,7 +1998,7 @@ begin
exit;
end;
offs := IfThen(IsPrediction, 1, 0);
offs := Math.IfThen(IsPrediction, 1, 0);
with FitStatistics do begin
x := TransformX(AX);
if IsNaN(x) then exit;
@ -2610,8 +2610,8 @@ begin
ADrawer.SetPenParams(psClear, clTAColor);
end;
scaled_stepX := IfThen(StepX > 1, Max(1, ADrawer.Scale(StepX)), 1);
scaled_stepY := IfThen(StepY > 1, Max(1, ADrawer.Scale(StepY)), 1);
scaled_stepX := Math.IfThen(StepX > 1, Max(1, ADrawer.Scale(StepX)), 1);
scaled_stepY := Math.IfThen(StepY > 1, Max(1, ADrawer.Scale(StepY)), 1);
GetZRange(r, scaled_stepX, scaled_stepY);
@ -2684,7 +2684,7 @@ procedure TCustomColorMapSeries.GetLegendItems(AItems: TChartLegendItems);
function PrepareFormats: TStrings;
begin
Result := Split(IfThen(Legend.Format = '', DEF_COLORMAP_LEGENDFORMAT, Legend.Format));
Result := Split(StrUtils.IfThen(Legend.Format = '', DEF_COLORMAP_LEGENDFORMAT, Legend.Format));
with Result do
try
while Count < 3 do

View File

@ -418,7 +418,7 @@ begin
symbol[4] := Rect(
(r.Left * 2 + r.Right) div 3, center.y - bw,
(r.Left + r.Right * 2) div 3, center.y + bw);
bw -= IfThen(FBoxPen.Style = psClear, 0, (FBoxPen.Width + 1) div 2);
bw -= Math.IfThen(FBoxPen.Style = psClear, 0, (FBoxPen.Width + 1) div 2);
symbol[5] := Rect(center.x, center.y - bw, center.x, center.y + bw);
if FIsVertical then
@ -893,7 +893,7 @@ begin
UpdateLabelDirectionReferenceLevel(i, j, center);
dir := GetLabelDirection(TDoublePointBoolArr(gp)[not IsRotated], center);
with Marks.MeasureLabel(ADrawer, labelText) do
dist := IfThen(dir in [ldLeft, ldRight], cx, cy);
dist := Math.IfThen(dir in [ldLeft, ldRight], cx, cy);
if Marks.DistanceToCenter then
dist := dist div 2;
m[dir] := Max(m[dir], dist + scMarksDistance);
@ -1886,7 +1886,7 @@ end;
function TFieldSeries.GetColor(AIndex: Integer): TColor;
begin
with Source.Item[AIndex]^ do
Result := TColor(IfThen(Color = clTAColor, FPen.Color, Color));
Result := TColor(Math.IfThen(Color = clTAColor, FPen.Color, Color));
end;
procedure TFieldSeries.GetLegendItems(AItems: TChartLegendItems);

View File

@ -767,8 +767,8 @@ begin
if Assigned(p) then lb := p.Brush else lb := nil;
for s in Styles.Styles do
AItems.Add(TLegendItemLinePointer.CreateWithBrush(
IfThen((lp <> nil) and s.UsePen, s.Pen, lp) as TPen,
IfThen(s.UseBrush, s.Brush, lb) as TBrush,
TAChartUtils.IfThen((lp <> nil) and s.UsePen, s.Pen, lp) as TPen,
TAChartUtils.IfThen(s.UseBrush, s.Brush, lb) as TBrush,
p,
LegendTextStyle(s)
));
@ -1311,7 +1311,7 @@ begin
if UseZeroLevel then
zero := ZeroLevel
else
zero := IfThen(IsRotated, ext2.a.X, ext2.a.Y);
zero := Math.IfThen(IsRotated, ext2.a.X, ext2.a.Y);
PrepareGraphPoints(ext2, true);
SetLength(heights, Source.YCount + 1);
@ -1478,7 +1478,7 @@ begin
cy := ARect.Top;
end;
a := w div 2;
b := IfThen(ADepth = 0, 0, ADepth div 2);
b := Math.IfThen(ADepth = 0, 0, ADepth div 2);
if IsRotated then b := -b;
c := ADrawer.BrushColor;
@ -1733,7 +1733,7 @@ end;
function TBarSeries.GetZeroLevel: Double;
begin
Result := IfThen(UseZeroLevel, ZeroLevel, 0.0);
Result := Math.IfThen(UseZeroLevel, ZeroLevel, 0.0);
end;
function TBarSeries.IsZeroLevelStored: boolean;
@ -1998,9 +1998,9 @@ var
begin
p := ParentChart.GraphToImage(AP);
if IsRotated then
p.X := basePts[IfThen(FBanded, AIndex, 1)].X
p.X := basePts[Math.IfThen(FBanded, AIndex, 1)].X
else
p.Y := basePts[IfThen(FBanded, AIndex, 1)].Y;
p.Y := basePts[Math.IfThen(FBanded, AIndex, 1)].Y;
PushPoint(p);
end;
@ -2160,7 +2160,7 @@ var
CopyPoints(basePts, pts, numBasePts);
// Iterate through y values
j0 := IfThen(FBanded and (Source.YCount > 1), 0, -1);
j0 := Math.IfThen(FBanded and (Source.YCount > 1), 0, -1);
for j := Source.YCount - 2 downto j0 do begin
// Stack level points
numPts := 0;
@ -2233,7 +2233,7 @@ begin
if UseZeroLevel then
zero := AxisToGraphY(ZeroLevel)
else
zero := IfThen(IsRotated, ext2.a.X, ext2.a.Y);
zero := Math.IfThen(IsRotated, ext2.a.X, ext2.a.Y);
scaled_depth := ADrawer.Scale(Depth);
SetLength(pts, Length(FGraphPoints) * 4 + 4);
@ -2283,7 +2283,7 @@ end;
function TAreaSeries.GetZeroLevel: Double;
begin
Result := IfThen(UseZeroLevel, ZeroLevel, 0.0);
Result := Math.IfThen(UseZeroLevel, ZeroLevel, 0.0);
end;
function TAreaSeries.IsZeroLevelStored: boolean;

View File

@ -1755,9 +1755,9 @@ var
ar: Integer;
begin
ar := EffectiveAccumulationRange;
ar := IfThen(ar = 0, MaxInt div 2, ar - 1);
ALeft := AIndex - IfThen(AccumulationDirection = cadForward, 0, ar);
ARight := AIndex + IfThen(AccumulationDirection = cadBackward, 0, ar);
ar := Math.IfThen(ar = 0, MaxInt div 2, ar - 1);
ALeft := AIndex - Math.IfThen(AccumulationDirection = cadForward, 0, ar);
ARight := AIndex + Math.IfThen(AccumulationDirection = cadBackward, 0, ar);
ALeft := EnsureRange(ALeft, 0, Count - 1);
ARight := EnsureRange(ARight, 0, Count - 1);
end;

View File

@ -746,7 +746,7 @@ begin
if not Visible then exit;
da := ArcTan2(Width, Length);
sgn := IfThen(FInverted, -1, +1);
sgn := Math.IfThen(FInverted, -1, +1);
diag := -ADrawer.Scale(Round(Sqrt(Sqr(Length) + Sqr(Width))));
pt1 := AEndPos + RotatePointX(diag, AAngle - da)*sgn;
pt2 := AEndPos + RotatePointX(diag, AAngle + da)*sgn;