Revert "Remove unit UITypes from LazUtils. Use System.UITypes."

This reverts commit f55ce5c939.
This commit is contained in:
Juha 2023-07-08 16:16:56 +03:00
parent da8a33d43f
commit 5a19e7b529
15 changed files with 162 additions and 41 deletions

View File

@ -21,7 +21,7 @@ procedure RIRegister_Graphics(Cl: TPSRuntimeClassImporter; Streams: Boolean);
implementation
{$IFNDEF FPC}
uses
Classes{$IFDEF CLX}, QGraphics{$ELSE}, Windows, Graphics{$ENDIF} {$IFDEF DELPHI_TOKYO_UP}, System.UITypes {$ENDIF};
Classes{$IFDEF CLX}, QGraphics{$ELSE}, Windows, Graphics{$ENDIF} {$IFDEF DELPHI_TOKYO_UP}, UITypes {$ENDIF};
{$ELSE}
uses
Classes, Graphics,LCLType;

View File

@ -6,7 +6,7 @@ interface
uses
// LazUtils
System.UITypes;
UITypes;
type
TLazMessageWorker = function(const aCaption, aMsg: string;

View File

@ -16,7 +16,8 @@ unit PackageIntf;
interface
uses
Classes, SysUtils, Contnrs, System.UITypes,
Classes, SysUtils, Contnrs,
{$IF FPC_FULLVERSION >= 30200}System.{$ENDIF}UITypes,
// LazUtils
LazConfigStorage, LazMethodList, LazLoggerBase,
// BuildIntf

View File

@ -5,7 +5,8 @@ unit PackageLinkIntf;
interface
uses
SysUtils, Classes, System.UITypes,
SysUtils, Classes,
{$IF FPC_FULLVERSION >= 30200}System.{$ENDIF}UITypes,
// LazUtils
LazFileUtils,
// BuildIntf

View File

@ -16,7 +16,8 @@ unit ProjectIntf;
interface
uses
Classes, SysUtils, Contnrs, System.UITypes,
Classes, SysUtils, Contnrs,
{$IF FPC_FULLVERSION >= 30200}System.{$ENDIF}UITypes,
// LazUtils
FileUtil, LazFileUtils, LazFileCache, LazMethodList, AvgLvlTree,
// BuildIntf

View File

@ -24,7 +24,7 @@ interface
uses
// RTL / FCL
Classes, TypInfo, SysUtils, types, RtlConsts, variants, Contnrs, strutils, FGL,
Math, System.UITypes,
Math,
// LCL
LCLType, LCLIntf, LCLProc, Forms, Controls, ButtonPanel, Graphics,
StdCtrls, Buttons, Menus, ExtCtrls, ComCtrls, Dialogs, EditBtn, Grids, ValEdit,
@ -33,7 +33,7 @@ uses
CheckBoxThemed,
// LazUtils
FileUtil, StringHashList, LazMethodList, LazLoggerBase, LazUtilities, LazStringUtils,
GraphType, FPCAdds, // for StrToQWord in older fpc versions
GraphType, UITypes, FPCAdds, // for StrToQWord in older fpc versions
// IdeIntf
ObjInspStrConsts, PropEditUtils, TextTools,
// Forms with .lfm files

View File

@ -113,6 +113,7 @@ begin
D := T.Dependencies.AddUnit('StringHashList');
D := T.Dependencies.AddUnit('TextStrings');
D := T.Dependencies.AddUnit('Translations');
D := T.Dependencies.AddUnit('UITypes');
D := T.Dependencies.AddInclude('unixfileutil.inc');
D := T.Dependencies.AddInclude('unixlazfileutils.inc');
D := T.Dependencies.AddInclude('unixlazutf8.inc');
@ -179,6 +180,7 @@ begin
T := P.Targets.AddImplicitUnit('stringhashlist.pas');
T := P.Targets.AddImplicitUnit('textstrings.pas');
T := P.Targets.AddImplicitUnit('translations.pas');
T := P.Targets.AddImplicitUnit('uitypes.pas');
T := P.Targets.AddImplicitUnit('utf8process.pp');
// copy the compiled file, so the IDE knows how the package was compiled

View File

@ -294,6 +294,10 @@
<Filename Value="translations.pas"/>
<UnitName Value="Translations"/>
</Item>
<Item>
<Filename Value="uitypes.pas"/>
<UnitName Value="UITypes"/>
</Item>
<Item>
<Filename Value="unixfileutil.inc"/>
<Type Value="Include"/>

View File

@ -19,7 +19,8 @@ uses
LazPasReadUtil, LazStringUtils, LazSysUtils, LazTracer, LazUnicode,
LazUTF16, LazUTF8, LazUtilities, LazUtilsStrConsts, LazVersion,
LConvEncoding, LCSVUtils, LookupStringList, Maps, Masks, ObjectLists,
StringHashList, TextStrings, Translations, UTF8Process, LazarusPackageIntf;
StringHashList, TextStrings, Translations, UITypes, UTF8Process,
LazarusPackageIntf;
implementation

View File

@ -0,0 +1,111 @@
unit UITypes
{$IF FPC_FULLVERSION >= 30200}
deprecated 'Use System.UITypes instead (available since FPC 3.2.0)';
{$mode objfpc}{$H+}
interface
uses
System.UITypes;
const
mtWarning = System.UITypes.TMsgDlgType.mtWarning;
mtError = System.UITypes.TMsgDlgType.mtError;
mtInformation = System.UITypes.TMsgDlgType.mtInformation;
mtConfirmation = System.UITypes.TMsgDlgType.mtConfirmation;
mtCustom = System.UITypes.TMsgDlgType.mtCustom;
mbYes = System.UITypes.TMsgDlgBtn.mbYes;
mbNo = System.UITypes.TMsgDlgBtn.mbNo;
mbOK = System.UITypes.TMsgDlgBtn.mbOK;
mbCancel = System.UITypes.TMsgDlgBtn.mbCancel;
mbAbort = System.UITypes.TMsgDlgBtn.mbAbort;
mbRetry = System.UITypes.TMsgDlgBtn.mbRetry;
mbIgnore = System.UITypes.TMsgDlgBtn.mbIgnore;
mbAll = System.UITypes.TMsgDlgBtn.mbAll;
mbNoToAll = System.UITypes.TMsgDlgBtn.mbNoToAll;
mbYesToAll = System.UITypes.TMsgDlgBtn.mbYesToAll;
mbHelp = System.UITypes.TMsgDlgBtn.mbHelp;
mbClose = System.UITypes.TMsgDlgBtn.mbClose;
type
// Message dialog related
TMsgDlgType = System.UITypes.TMsgDlgType;
TMsgDlgBtn = System.UITypes.TMsgDlgBtn;
TMsgDlgButtons = set of System.UITypes.TMsgDlgBtn;
// ModalResult
TModalResult = System.UITypes.TModalResult;
PModalResult = System.UITypes.PModalResult;
const
// Used for ModalResult
mrNone = System.UITypes.mrNone;
mrOK = System.UITypes.mrOK;
mrCancel = System.UITypes.mrCancel;
mrAbort = System.UITypes.mrAbort;
mrRetry = System.UITypes.mrRetry;
mrIgnore = System.UITypes.mrIgnore;
mrYes = System.UITypes.mrYes;
mrNo = System.UITypes.mrNo;
mrAll = System.UITypes.mrAll;
mrNoToAll = System.UITypes.mrNoToAll;
mrYesToAll = System.UITypes.mrYesToAll;
mrClose = System.UITypes.mrClose;
mrLast = System.UITypes.mrLast;
{$ELSE}
;
{$mode objfpc}{$H+}
interface
type
// Message dialog related
TMsgDlgType = (mtWarning, mtError, mtInformation, mtConfirmation, mtCustom);
TMsgDlgBtn = (mbYes, mbNo, mbOK, mbCancel, mbAbort, mbRetry, mbIgnore,
mbAll, mbNoToAll, mbYesToAll, mbHelp, mbClose);
TMsgDlgButtons = set of TMsgDlgBtn;
// ModalResult
TModalResult = low(Integer)..high(Integer);
PModalResult = ^TModalResult;
const
// Used for ModalResult
mrNone = 0;
mrOK = mrNone + 1;
mrCancel = mrNone + 2;
mrAbort = mrNone + 3;
mrRetry = mrNone + 4;
mrIgnore = mrNone + 5;
mrYes = mrNone + 6;
mrNo = mrNone + 7;
mrAll = mrNone + 8;
mrNoToAll = mrNone + 9;
mrYesToAll = mrNone + 10;
mrClose = mrNone + 11;
mrLast = mrClose;
{$ENDIF}
// String representation of ModalResult values
ModalResultStr: array[mrNone..mrLast] of shortstring = (
'mrNone',
'mrOk',
'mrCancel',
'mrAbort',
'mrRetry',
'mrIgnore',
'mrYes',
'mrNo',
'mrAll',
'mrNoToAll',
'mrYesToAll',
'mrClose');
implementation
end.

View File

@ -449,14 +449,14 @@ begin
CheckMinParamCount(5, 'MessageDlg');
Stack.SetInt(-1,
MessageDlg(Stack.GetAnsiString(-2), TMsgDlgType(Stack.GetUInt(-3)),
TMsgDlgButtons(Word(GetSetFromStack(Stack, -4))), Stack.GetInt(-5))
TMsgDlgButtons(GetSetFromStack(Stack, -4)), Stack.GetInt(-5))
);
end;
FunctionId_MessageDlgPos: begin // MessageDlgPos(Msg: string; DlgType :TMsgDlgType; Buttons :TMsgDlgButtons; HelpCtx: Longint; X, Y: Integer): Integer
CheckMinParamCount(7, 'MessageDlgPos');
Stack.SetInt(-1,
MessageDlgPos(Stack.GetAnsiString(-2), TMsgDlgType(Stack.GetUInt(-3)),
TMsgDlgButtons(Word(GetSetFromStack(Stack, -4))), Stack.GetInt(-5),
TMsgDlgButtons(GetSetFromStack(Stack, -4)), Stack.GetInt(-5),
Stack.GetInt(-6), Stack.GetInt(-7) )
);
end;
@ -464,7 +464,7 @@ begin
CheckMinParamCount(8, 'MessageDlgPosHelp');
Stack.SetInt(-1,
MessageDlgPosHelp(Stack.GetAnsiString(-2), TMsgDlgType(Stack.GetUInt(-3)),
TMsgDlgButtons(Word(GetSetFromStack(Stack, -4))), Stack.GetInt(-5),
TMsgDlgButtons(GetSetFromStack(Stack, -4)), Stack.GetInt(-5),
Stack.GetInt(-6), Stack.GetInt(-7), Stack.GetAnsiString(-8))
);
end;

View File

@ -28,11 +28,11 @@ uses
{$IFDEF unix}
cthreads,
{$ENDIF}
Classes, SysUtils, Math, CustApp, System.UITypes,
Classes, SysUtils, math, CustApp,
Interfaces, // this includes the NoGUI widgetset
// LazUtils
Masks, LConvEncoding, FileUtil, LazFileUtils, LazLoggerBase, LazUtilities,
LazUTF8, Laz2_XMLCfg, LazStringUtils,
LazUTF8, Laz2_XMLCfg, UITypes, LazStringUtils,
// LCL
LCLPlatformDef, Forms,
// Codetools

View File

@ -62,9 +62,9 @@ const
mrClose = System.UITypes.mrClose;
mrLast = System.UITypes.mrLast;
//function GetModalResultStr(ModalResult: TModalResult): ShortString;
// deprecated 'Use the ModalResultStr array from unit System.UITypes directly.';
//property ModalResultStr[ModalResult: TModalResult]: shortstring read GetModalResultStr;
function GetModalResultStr(ModalResult: TModalResult): ShortString;
deprecated 'Use the ModalResultStr array from unit System.UITypes directly.';
property ModalResultStr[ModalResult: TModalResult]: shortstring read GetModalResultStr;
const
// define aliases for Delphi compatibility

View File

@ -22,40 +22,40 @@ interface
uses
// RTL + FCL
Types, TypInfo, Classes, SysUtils, System.UITypes,
Types, typinfo, Classes, SysUtils,
// LCL
LMessages, LResources, LCLIntf, InterfaceBase, LCLStrConsts, LCLType,
Forms, Controls, Themes, Graphics, Buttons, ButtonPanel, StdCtrls,
ExtCtrls, LCLClasses, ClipBrd, Menus, LCLTaskDialog, DialogRes,
// LazUtils
GraphType, FileUtil, LazFileUtils, LazStringUtils, LazLoggerBase;
GraphType, UITypes, FileUtil, LazFileUtils, LazStringUtils, LazLoggerBase;
type
// Aliases for types in UITypes.
TMsgDlgType = System.UITypes.TMsgDlgType;
TMsgDlgBtn = System.UITypes.TMsgDlgBtn;
TMsgDlgButtons = System.UITypes.TMsgDlgButtons;
TMsgDlgType = UITypes.TMsgDlgType;
TMsgDlgBtn = UITypes.TMsgDlgBtn;
TMsgDlgButtons = UITypes.TMsgDlgButtons;
const
// Aliases for enum values in UITypes.
mtWarning = System.UITypes.TMsgDlgType.mtWarning;
mtError = System.UITypes.TMsgDlgType.mtError;
mtInformation = System.UITypes.TMsgDlgType.mtInformation;
mtConfirmation = System.UITypes.TMsgDlgType.mtConfirmation;
mtCustom = System.UITypes.TMsgDlgType.mtCustom;
mtWarning = UITypes.TMsgDlgType.mtWarning;
mtError = UITypes.TMsgDlgType.mtError;
mtInformation = UITypes.TMsgDlgType.mtInformation;
mtConfirmation = UITypes.TMsgDlgType.mtConfirmation;
mtCustom = UITypes.TMsgDlgType.mtCustom;
mbYes = System.UITypes.TMsgDlgBtn.mbYes;
mbNo = System.UITypes.TMsgDlgBtn.mbNo;
mbOK = System.UITypes.TMsgDlgBtn.mbOK;
mbCancel = System.UITypes.TMsgDlgBtn.mbCancel;
mbAbort = System.UITypes.TMsgDlgBtn.mbAbort;
mbRetry = System.UITypes.TMsgDlgBtn.mbRetry;
mbIgnore = System.UITypes.TMsgDlgBtn.mbIgnore;
mbAll = System.UITypes.TMsgDlgBtn.mbAll;
mbNoToAll = System.UITypes.TMsgDlgBtn.mbNoToAll;
mbYesToAll = System.UITypes.TMsgDlgBtn.mbYesToAll;
mbHelp = System.UITypes.TMsgDlgBtn.mbHelp;
mbClose = System.UITypes.TMsgDlgBtn.mbClose;
mbYes = UITypes.TMsgDlgBtn.mbYes;
mbNo = UITypes.TMsgDlgBtn.mbNo;
mbOK = UITypes.TMsgDlgBtn.mbOK;
mbCancel = UITypes.TMsgDlgBtn.mbCancel;
mbAbort = UITypes.TMsgDlgBtn.mbAbort;
mbRetry = UITypes.TMsgDlgBtn.mbRetry;
mbIgnore = UITypes.TMsgDlgBtn.mbIgnore;
mbAll = UITypes.TMsgDlgBtn.mbAll;
mbNoToAll = UITypes.TMsgDlgBtn.mbNoToAll;
mbYesToAll = UITypes.TMsgDlgBtn.mbYesToAll;
mbHelp = UITypes.TMsgDlgBtn.mbHelp;
mbClose = UITypes.TMsgDlgBtn.mbClose;
// Combinations of buttons.
mbYesNoCancel = [mbYes, mbNo, mbCancel];

View File

@ -30,12 +30,12 @@ uses
////////////////////////////////////////////////////
// rtl
Windows, shlobj, ShellApi, ActiveX, SysUtils, Classes, CommDlg,
{$ifdef DebugCommonDialogEvents}
System.UITypes,
{$endif}
// lcl
LCLProc, LCLType, Dialogs, Controls, Graphics, Forms, Masks,
// LazUtils
{$ifdef DebugCommonDialogEvents}
UITypes,
{$endif}
LazFileUtils, LazUTF8,
// ws
WSDialogs, WSLCLClasses, Win32Extra, Win32Int, InterfaceBase,