diff --git a/.gitattributes b/.gitattributes index 39a8daddda..3aac720428 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3287,7 +3287,6 @@ components/lazutils/lcsvutils.pas svneol=native#text/pascal components/lazutils/lookupstringlist.pas svneol=native#text/pascal components/lazutils/maps.pp svneol=native#text/pascal components/lazutils/masks.pas svneol=native#text/pascal -components/lazutils/modalresultdef.pas svneol=native#text/pascal components/lazutils/paswstring.pas svneol=native#text/pascal components/lazutils/stringhashlist.pas svneol=native#text/pascal components/lazutils/test/TestLazStorageMem.lpi svneol=native#text/plain @@ -3316,6 +3315,7 @@ components/lazutils/ttraster.pas svneol=native#text/pascal components/lazutils/ttraster_sweep.inc svneol=native#text/pascal components/lazutils/tttables.pas svneol=native#text/pascal components/lazutils/tttypes.pas svneol=native#text/pascal +components/lazutils/uitypes.pas svneol=native#text/pascal components/lazutils/unixfileutil.inc svneol=native#text/pascal components/lazutils/unixlazfileutils.inc svneol=native#text/plain components/lazutils/unixlazutf8.inc svneol=native#text/plain diff --git a/components/ideintf/propedits.pp b/components/ideintf/propedits.pp index c7b813139a..701ef7330a 100644 --- a/components/ideintf/propedits.pp +++ b/components/ideintf/propedits.pp @@ -31,7 +31,7 @@ uses // LazControls {$IFnDEF UseOINormalCheckBox} CheckBoxThemed, {$ENDIF} // LazUtils - FileUtil, StringHashList, LazMethodList, ModalResultDef, + FileUtil, StringHashList, LazMethodList, UITypes, FPCAdds, // for StrToQWord in older fpc versions // IdeIntf ObjInspStrConsts, PropEditUtils, PackageDependencyIntf, diff --git a/components/lazutils/lazutils.lpk b/components/lazutils/lazutils.lpk index 7800c69f9c..57bb69cde8 100644 --- a/components/lazutils/lazutils.lpk +++ b/components/lazutils/lazutils.lpk @@ -406,8 +406,8 @@ - - + + diff --git a/components/lazutils/lazutils.pas b/components/lazutils/lazutils.pas index 8a67fa4e69..4dc135eb7d 100644 --- a/components/lazutils/lazutils.pas +++ b/components/lazutils/lazutils.pas @@ -21,7 +21,7 @@ uses StringHashList, TextStrings, Translations, TTCache, TTCalc, TTCMap, TTDebug, TTError, TTFile, TTGLoad, TTInterp, TTLoad, TTMemory, TTObjs, TTProfile, TTRASTER, TTTables, TTTypes, UTF8Process, HTML2TextRender, Laz_AVL_Tree, - CompWriterPas, LazPasReadUtil, IntegerList, LazVersion, ModalResultDef, + CompWriterPas, LazPasReadUtil, IntegerList, LazVersion, UITypes, LazarusPackageIntf; implementation diff --git a/components/lazutils/modalresultdef.pas b/components/lazutils/uitypes.pas similarity index 70% rename from components/lazutils/modalresultdef.pas rename to components/lazutils/uitypes.pas index 87e65d0734..92ef65e2e6 100644 --- a/components/lazutils/modalresultdef.pas +++ b/components/lazutils/uitypes.pas @@ -1,4 +1,4 @@ -unit ModalResultDef; +unit UITypes; {$mode objfpc}{$H+} @@ -8,6 +8,13 @@ uses Classes, SysUtils; 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; diff --git a/components/messagecomposer/messagecomposer.pas b/components/messagecomposer/messagecomposer.pas index 3d3c3b7da7..131a36d4bb 100644 --- a/components/messagecomposer/messagecomposer.pas +++ b/components/messagecomposer/messagecomposer.pas @@ -31,7 +31,7 @@ uses LResources, LCLType, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, Spin, Grids, ActnList, Buttons, EditBtn, // LazUtils - ModalResultDef, + UITypes, // IdeIntf IDECommands, MenuIntf, LazIDEIntf, SrcEditorIntf; diff --git a/lcl/controls.pp b/lcl/controls.pp index e232dab5cb..d8c6163244 100644 --- a/lcl/controls.pp +++ b/lcl/controls.pp @@ -41,26 +41,31 @@ uses InterfaceBase, ImgList, PropertyStorage, Menus, ActnList, LCLClasses, LResources, LCLPlatformDef, // LazUtils - LazMethodList, ModalResultDef; + LazMethodList, UITypes; {$I controlconsts.inc} const // Used for ModalResult - mrNone = ModalResultDef.mrNone; - mrOK = ModalResultDef.mrOK; - mrCancel = ModalResultDef.mrCancel; - mrAbort = ModalResultDef.mrAbort; - mrRetry = ModalResultDef.mrRetry; - mrIgnore = ModalResultDef.mrIgnore; - mrYes = ModalResultDef.mrYes; - mrNo = ModalResultDef.mrNo; - mrAll = ModalResultDef.mrAll; - mrNoToAll = ModalResultDef.mrNoToAll; - mrYesToAll= ModalResultDef.mrYesToAll; - mrClose = ModalResultDef.mrClose; - mrLast = ModalResultDef.mrLast; + mrNone = UITypes.mrNone; + mrOK = UITypes.mrOK; + mrCancel = UITypes.mrCancel; + mrAbort = UITypes.mrAbort; + mrRetry = UITypes.mrRetry; + mrIgnore = UITypes.mrIgnore; + mrYes = UITypes.mrYes; + mrNo = UITypes.mrNo; + mrAll = UITypes.mrAll; + mrNoToAll = UITypes.mrNoToAll; + mrYesToAll= UITypes.mrYesToAll; + mrClose = UITypes.mrClose; + mrLast = UITypes.mrLast; +function GetModalResultStr(ModalResult: TModalResult): ShortString; + deprecated 'Use the ModalResultStr array from unit UITypes directly.'; +property ModalResultStr[ModalResult: TModalResult]: shortstring read GetModalResultStr; + +const // define aliases for Delphi compatibility fsSurface = GraphType.fsSurface; fsBorder = GraphType.fsBorder; @@ -3004,6 +3009,11 @@ begin Result:='['+Result+']'; end; +function GetModalResultStr(ModalResult: TModalResult): ShortString; +begin + Result := UITypes.ModalResultStr[ModalResult]; +end; + {------------------------------------------------------------------------------ RecreateWnd This function was originally member of TWincontrol. From a VCL point of view diff --git a/lcl/dialogs.pp b/lcl/dialogs.pp index 6f67dbb64c..4794756286 100644 --- a/lcl/dialogs.pp +++ b/lcl/dialogs.pp @@ -28,21 +28,36 @@ uses Forms, Controls, Themes, GraphType, Graphics, Buttons, ButtonPanel, StdCtrls, ExtCtrls, LCLClasses, ClipBrd, Menus, LCLTaskDialog, // LazUtils - {$ifdef DebugCommonDialogEvents} - ModalResultDef, - {$endif} - FileUtil, LazFileUtils; - + UITypes, FileUtil, LazFileUtils; type - TMsgDlgType = (mtWarning, mtError, mtInformation, mtConfirmation, - mtCustom); - TMsgDlgBtn = (mbYes, mbNo, mbOK, mbCancel, mbAbort, mbRetry, mbIgnore, - mbAll, mbNoToAll, mbYesToAll, mbHelp, mbClose); - TMsgDlgButtons = set of TMsgDlgBtn; + // Aliases for types in UITypes. + TMsgDlgType = UITypes.TMsgDlgType; + TMsgDlgBtn = UITypes.TMsgDlgBtn; + TMsgDlgButtons = UITypes.TMsgDlgButtons; - const + // Aliases for enum values in UITypes. + mtWarning = UITypes.TMsgDlgType.mtWarning; + mtError = UITypes.TMsgDlgType.mtError; + mtInformation = UITypes.TMsgDlgType.mtInformation; + mtConfirmation = UITypes.TMsgDlgType.mtConfirmation; + mtCustom = UITypes.TMsgDlgType.mtCustom; + + 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]; mbYesNo = [mbYes, mbNo]; mbOKCancel = [mbOK, mbCancel]; diff --git a/lcl/forms.pp b/lcl/forms.pp index e7b9e47dfd..0b7ebfe2e3 100644 --- a/lcl/forms.pp +++ b/lcl/forms.pp @@ -39,7 +39,7 @@ uses LResources, GraphType, Graphics, Menus, LMessages, CustomTimer, ActnList, ClipBrd, HelpIntfs, Controls, ImgList, Themes, // LazUtils - LazFileUtils, LazUTF8, Maps, IntegerList, LazMethodList, ModalResultDef + LazFileUtils, LazUTF8, Maps, IntegerList, LazMethodList, UITypes {$ifndef wince},gettext{$endif}// remove ifdefs when gettext is fixed and a new fpc is released ; @@ -413,8 +413,8 @@ type ); TFormState = set of TFormStateType; - TModalResult = ModalResultDef.TModalResult; - PModalResult = ^ModalResultDef.TModalResult; + TModalResult = UITypes.TModalResult; + PModalResult = ^UITypes.TModalResult; TFormHandlerType = ( fhtFirstShow, diff --git a/lcl/interfaces/win32/win32wsdialogs.pp b/lcl/interfaces/win32/win32wsdialogs.pp index 5e303fe4d2..5b244364db 100644 --- a/lcl/interfaces/win32/win32wsdialogs.pp +++ b/lcl/interfaces/win32/win32wsdialogs.pp @@ -34,7 +34,7 @@ uses LCLProc, LCLType, Dialogs, Controls, Graphics, Forms, Masks, // LazUtils {$ifdef DebugCommonDialogEvents} - ModalResultDef, + UITypes, {$endif} LazFileUtils, LazUTF8, // ws