FPC: Extend System.UITypes

This commit is contained in:
Ondrej Pokorny 2022-12-18 09:47:42 +01:00
parent c45dfb7a56
commit 829f320095
3 changed files with 24 additions and 1 deletions

View File

@ -126,7 +126,7 @@ end;
function DelphiIntToFpcFontStyle(aStyle: Integer): TFontStyles;
begin
result := TFontStyles(aStyle);
result := TFontStyles(Byte(aStyle));
end;
function DelphiIntToFPCFrameBorders(aFrameTyp: Integer): TfrFrameBorders;

View File

@ -26,6 +26,9 @@ unit TAChartUtils;
interface
uses
{$IF FPC_FULLVERSION>30300}
System.UITypes,
{$ENDIF}
Classes, Math, Types, SysUtils;
const
@ -47,12 +50,24 @@ type
EListenerError = class(EChartError);
EDrawDataError = class(EChartError);
{$IF FPC_FULLVERSION>30300}
TChartColor = TColor;
TChartFontStyle = TFontStyle;
TChartFontStyles = TFontStyles;
const
cfsBold = fsBold;
cfsItalic = fsItalic;
cfsUnderline = fsUnderline;
cfsStrikeout = fsStrikeout;
type
{$ELSE}
// Like TColor, but avoiding dependency on Graphics.
TChartColor = -$7FFFFFFF-1..$7FFFFFFF;
// dto with TFontStyle
TChartFontStyle = (cfsBold, cfsItalic, cfsUnderline, cfsStrikeout);
TChartFontStyles = set of TChartFontStyle;
{$ENDIF}
TChartTextFormat = (tfNormal, tfHTML);

View File

@ -11754,7 +11754,11 @@ begin
ReadBuffer(Dummy, SizeOf(Dummy));
Pitch := TFontPitch(Dummy);
ReadBuffer(Dummy, SizeOf(Dummy));
{$IF FPC_FULLVERSION>30300}
Style := TFontStyles(Byte(Dummy));
{$ELSE}
Style := TFontStyles(LongWord(Dummy));
{$ENDIF}
end;
// LCL port started with header stream version 6 so no need to do the check here
// Read data introduced by stream version 1+.
@ -12027,7 +12031,11 @@ begin
WriteBuffer(PAnsiChar(Tmp)^, Dummy);
Dummy := Ord(Pitch);
WriteBuffer(Dummy, SizeOf(Dummy));
{$IF FPC_FULLVERSION>30300}
Dummy := Byte(Style);
{$ELSE}
Dummy := Integer(Style);
{$ENDIF}
WriteBuffer(Dummy, SizeOf(Dummy));
end;