From 829f3200955fc8a3c480d75b12c88b56976ec1f6 Mon Sep 17 00:00:00 2001 From: Ondrej Pokorny Date: Sun, 18 Dec 2022 09:47:42 +0100 Subject: [PATCH] FPC: Extend System.UITypes --- components/lazreport/source/fr3tolrf.pas | 2 +- components/tachart/tachartutils.pas | 15 +++++++++++++++ components/virtualtreeview/laz.virtualtrees.pas | 8 ++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/components/lazreport/source/fr3tolrf.pas b/components/lazreport/source/fr3tolrf.pas index 12ce82ce13..2fc38da27e 100644 --- a/components/lazreport/source/fr3tolrf.pas +++ b/components/lazreport/source/fr3tolrf.pas @@ -126,7 +126,7 @@ end; function DelphiIntToFpcFontStyle(aStyle: Integer): TFontStyles; begin - result := TFontStyles(aStyle); + result := TFontStyles(Byte(aStyle)); end; function DelphiIntToFPCFrameBorders(aFrameTyp: Integer): TfrFrameBorders; diff --git a/components/tachart/tachartutils.pas b/components/tachart/tachartutils.pas index f1f03ea5df..92f0a0a68c 100644 --- a/components/tachart/tachartutils.pas +++ b/components/tachart/tachartutils.pas @@ -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); diff --git a/components/virtualtreeview/laz.virtualtrees.pas b/components/virtualtreeview/laz.virtualtrees.pas index 8e27508e7f..d40732e180 100644 --- a/components/virtualtreeview/laz.virtualtrees.pas +++ b/components/virtualtreeview/laz.virtualtrees.pas @@ -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;