TAChart: Fix compilation with FPC 3.0.4, issue #38623. Undo part of r64450 #47499875e6 which does not compile with 3.0.4 either.

git-svn-id: trunk@64811 -
This commit is contained in:
wp 2021-03-14 21:30:50 +00:00
parent fe03edd4aa
commit 2c5911c6d3
2 changed files with 5 additions and 6 deletions

View File

@ -19,9 +19,6 @@
</Debugging> </Debugging>
</Linking> </Linking>
<Other> <Other>
<CompilerMessages>
<IgnoredMessages idx6058="True"/>
</CompilerMessages>
<CustomOptions Value="-dCHECK_VALID_SCALING"/> <CustomOptions Value="-dCHECK_VALID_SCALING"/>
<OtherDefines Count="1"> <OtherDefines Count="1">
<Define0 Value="CHECK_VALID_SCALING"/> <Define0 Value="CHECK_VALID_SCALING"/>

View File

@ -808,7 +808,7 @@ function WordWrap(const AText: String; ADrawer: IChartDrawer;
AMaxWidth: Integer; ATextFormat: TChartTextFormat): string; AMaxWidth: Integer; ATextFormat: TChartTextFormat): string;
var var
L: TStrings; L: TStrings;
sa: TStringArray; words: TStrings;
line, testline: String; line, testline: String;
s: String; s: String;
w, ws, wspace: Integer; w, ws, wspace: Integer;
@ -820,14 +820,15 @@ begin
begin begin
wspace := ADrawer.TextExtent(' ').X; wspace := ADrawer.TextExtent(' ').X;
L := TStringList.Create; L := TStringList.Create;
words := TStringList.Create;
try try
L.Text := AText; L.Text := AText;
for i := 0 to L.Count-1 do for i := 0 to L.Count-1 do
begin begin
sa := SplitString(L[i], ' '); Split(L[i], words, ' ');
line := ''; line := '';
w := 0; w := 0;
for s in sa do for s in words do
begin begin
ws := ADrawer.TextExtent(s).X; ws := ADrawer.TextExtent(s).X;
if w + wspace + ws <= AMaxWidth then if w + wspace + ws <= AMaxWidth then
@ -855,6 +856,7 @@ begin
Result := Result + LineEnding; Result := Result + LineEnding;
end; end;
finally finally
words.Free;
L.Free; L.Free;
end; end;
end else end else