From 9766005317352a6ca2db25a226425169131c10f4 Mon Sep 17 00:00:00 2001 From: Sven Barth Date: Mon, 8 Nov 2021 23:05:35 +0100 Subject: [PATCH] * for FPC 3.2.3 and newer alias GraphType.TGraphicsColor to System.UITypes.TColor, Graphics.PColor to System.UITypes.PColor and LCLType.COLORREF to System.UITypes.TColorRef to avoid type conflicts when both System.UITypes and the LCL units are used Merge request freepascal.org/lazarus/lazarus!46 with minor change (enabled aliasing for FPC 3.2.3 too). (cherry picked from commit 53fe133e4349f61b6014401439d7d446d9d3a15f) --- components/lazutils/graphtype.pp | 9 ++++++++- lcl/graphics.pp | 9 ++++++++- lcl/lcltype.pp | 9 ++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/components/lazutils/graphtype.pp b/components/lazutils/graphtype.pp index 98a091515c..f44d513a06 100644 --- a/components/lazutils/graphtype.pp +++ b/components/lazutils/graphtype.pp @@ -22,8 +22,15 @@ unit GraphType; interface +{$if FPC_FULLVERSION>=30203} +{$define UseSystemUITypes} +{$endif} + uses Classes, SysUtils, Types, Math, + {$ifdef UseSystemUITypes} + System.UITypes, + {$endif} // LazUtils FPCAdds, LazLoggerBase; @@ -32,7 +39,7 @@ uses {$endif} type - TGraphicsColor = -$7FFFFFFF-1..$7FFFFFFF; + TGraphicsColor = {$ifdef UseSystemUITypes}System.UITypes.TColor{$else}-$7FFFFFFF-1..$7FFFFFFF{$endif}; TGraphicsFillStyle = ( fsSurface, // fill till the color (it fills all except this color) diff --git a/lcl/graphics.pp b/lcl/graphics.pp index d9c1f26513..fcc09464ad 100644 --- a/lcl/graphics.pp +++ b/lcl/graphics.pp @@ -37,6 +37,10 @@ interface {$DEFINE HasFPJoinStyle} {$ENDIF} +{$IF FPC_FULLVERSION>=30203} +{$DEFINE UseSystemUITypes} +{$ENDIF} + uses // RTL + FCL SysUtils, Math, Types, Classes, Contnrs, Laz_AVL_Tree, @@ -55,6 +59,9 @@ uses {$IFNDEF DisableLCLGIF} FPReadGif, {$ENDIF} + {$IFDEF UseSystemUITypes} + System.UITypes, + {$ENDIF} // LCL LCLVersion, LCLStrConsts, LCLType, LCLProc, LMessages, LResources, LCLResCache, IntfGraphics, IcnsTypes, WSReferences, @@ -62,7 +69,7 @@ uses GraphType, GraphMath, FPCAdds, LazLoggerBase, LazTracer, LazUtilities; type - PColor = ^TColor; + PColor = {$IFDEF UseSystemUITypes}System.UITypes.PColor{$ELSE}^TColor{$ENDIF}; TColor = TGraphicsColor; TFontPitch = (fpDefault, fpVariable, fpFixed); diff --git a/lcl/lcltype.pp b/lcl/lcltype.pp index 1103b4b86b..2d2ce4155c 100644 --- a/lcl/lcltype.pp +++ b/lcl/lcltype.pp @@ -39,6 +39,10 @@ interface {$ASSERTIONS ON} {$endif} +{$if FPC_FULLVERSION >= 30203} +{$define UseSystemUITypes} +{$endif} + uses {$IFDEF USE_UTF8BIDI_LCL} UTF8BIDI, @@ -46,6 +50,9 @@ uses {$ifdef WINDOWS} windows, {$endif WINDOWS} +{$ifdef UseSystemUITypes} + System.UITypes, +{$endif} Classes, SysUtils; {$ifdef WinCE} @@ -1657,7 +1664,7 @@ const //============================================== type - COLORREF = Cardinal; + COLORREF = {$ifdef UseSystemUITypes}System.UITypes.TColorRef{$else}Cardinal{$endif}; TColorRef = COLORREF; const