LazUtils: Rename unit ModalResultDef to a Delphi compatible UITypes. Add Message dialog related stuff.

git-svn-id: trunk@58227 -
This commit is contained in:
juha 2018-06-11 10:51:11 +00:00
parent ded01f7963
commit ce916d287c
10 changed files with 68 additions and 36 deletions

2
.gitattributes vendored
View File

@ -3287,7 +3287,6 @@ components/lazutils/lcsvutils.pas svneol=native#text/pascal
components/lazutils/lookupstringlist.pas svneol=native#text/pascal components/lazutils/lookupstringlist.pas svneol=native#text/pascal
components/lazutils/maps.pp svneol=native#text/pascal components/lazutils/maps.pp svneol=native#text/pascal
components/lazutils/masks.pas 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/paswstring.pas svneol=native#text/pascal
components/lazutils/stringhashlist.pas svneol=native#text/pascal components/lazutils/stringhashlist.pas svneol=native#text/pascal
components/lazutils/test/TestLazStorageMem.lpi svneol=native#text/plain 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/ttraster_sweep.inc svneol=native#text/pascal
components/lazutils/tttables.pas svneol=native#text/pascal components/lazutils/tttables.pas svneol=native#text/pascal
components/lazutils/tttypes.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/unixfileutil.inc svneol=native#text/pascal
components/lazutils/unixlazfileutils.inc svneol=native#text/plain components/lazutils/unixlazfileutils.inc svneol=native#text/plain
components/lazutils/unixlazutf8.inc svneol=native#text/plain components/lazutils/unixlazutf8.inc svneol=native#text/plain

View File

@ -31,7 +31,7 @@ uses
// LazControls // LazControls
{$IFnDEF UseOINormalCheckBox} CheckBoxThemed, {$ENDIF} {$IFnDEF UseOINormalCheckBox} CheckBoxThemed, {$ENDIF}
// LazUtils // LazUtils
FileUtil, StringHashList, LazMethodList, ModalResultDef, FileUtil, StringHashList, LazMethodList, UITypes,
FPCAdds, // for StrToQWord in older fpc versions FPCAdds, // for StrToQWord in older fpc versions
// IdeIntf // IdeIntf
ObjInspStrConsts, PropEditUtils, PackageDependencyIntf, ObjInspStrConsts, PropEditUtils, PackageDependencyIntf,

View File

@ -406,8 +406,8 @@
<UnitName Value="LazVersion"/> <UnitName Value="LazVersion"/>
</Item97> </Item97>
<Item98> <Item98>
<Filename Value="modalresultdef.pas"/> <Filename Value="uitypes.pas"/>
<UnitName Value="ModalResultDef"/> <UnitName Value="UITypes"/>
</Item98> </Item98>
</Files> </Files>
<LazDoc Paths="../../docs/xml/lazutils"/> <LazDoc Paths="../../docs/xml/lazutils"/>

View File

@ -21,7 +21,7 @@ uses
StringHashList, TextStrings, Translations, TTCache, TTCalc, TTCMap, TTDebug, StringHashList, TextStrings, Translations, TTCache, TTCalc, TTCMap, TTDebug,
TTError, TTFile, TTGLoad, TTInterp, TTLoad, TTMemory, TTObjs, TTProfile, TTError, TTFile, TTGLoad, TTInterp, TTLoad, TTMemory, TTObjs, TTProfile,
TTRASTER, TTTables, TTTypes, UTF8Process, HTML2TextRender, Laz_AVL_Tree, TTRASTER, TTTables, TTTypes, UTF8Process, HTML2TextRender, Laz_AVL_Tree,
CompWriterPas, LazPasReadUtil, IntegerList, LazVersion, ModalResultDef, CompWriterPas, LazPasReadUtil, IntegerList, LazVersion, UITypes,
LazarusPackageIntf; LazarusPackageIntf;
implementation implementation

View File

@ -1,4 +1,4 @@
unit ModalResultDef; unit UITypes;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
@ -8,6 +8,13 @@ uses
Classes, SysUtils; Classes, SysUtils;
type 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); TModalResult = low(Integer)..high(Integer);
PModalResult = ^TModalResult; PModalResult = ^TModalResult;

View File

@ -31,7 +31,7 @@ uses
LResources, LCLType, Forms, Controls, Graphics, Dialogs, LResources, LCLType, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls, Spin, Grids, ActnList, Buttons, EditBtn, StdCtrls, ExtCtrls, Spin, Grids, ActnList, Buttons, EditBtn,
// LazUtils // LazUtils
ModalResultDef, UITypes,
// IdeIntf // IdeIntf
IDECommands, MenuIntf, LazIDEIntf, SrcEditorIntf; IDECommands, MenuIntf, LazIDEIntf, SrcEditorIntf;

View File

@ -41,26 +41,31 @@ uses
InterfaceBase, ImgList, PropertyStorage, Menus, ActnList, LCLClasses, InterfaceBase, ImgList, PropertyStorage, Menus, ActnList, LCLClasses,
LResources, LCLPlatformDef, LResources, LCLPlatformDef,
// LazUtils // LazUtils
LazMethodList, ModalResultDef; LazMethodList, UITypes;
{$I controlconsts.inc} {$I controlconsts.inc}
const const
// Used for ModalResult // Used for ModalResult
mrNone = ModalResultDef.mrNone; mrNone = UITypes.mrNone;
mrOK = ModalResultDef.mrOK; mrOK = UITypes.mrOK;
mrCancel = ModalResultDef.mrCancel; mrCancel = UITypes.mrCancel;
mrAbort = ModalResultDef.mrAbort; mrAbort = UITypes.mrAbort;
mrRetry = ModalResultDef.mrRetry; mrRetry = UITypes.mrRetry;
mrIgnore = ModalResultDef.mrIgnore; mrIgnore = UITypes.mrIgnore;
mrYes = ModalResultDef.mrYes; mrYes = UITypes.mrYes;
mrNo = ModalResultDef.mrNo; mrNo = UITypes.mrNo;
mrAll = ModalResultDef.mrAll; mrAll = UITypes.mrAll;
mrNoToAll = ModalResultDef.mrNoToAll; mrNoToAll = UITypes.mrNoToAll;
mrYesToAll= ModalResultDef.mrYesToAll; mrYesToAll= UITypes.mrYesToAll;
mrClose = ModalResultDef.mrClose; mrClose = UITypes.mrClose;
mrLast = ModalResultDef.mrLast; 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 // define aliases for Delphi compatibility
fsSurface = GraphType.fsSurface; fsSurface = GraphType.fsSurface;
fsBorder = GraphType.fsBorder; fsBorder = GraphType.fsBorder;
@ -3004,6 +3009,11 @@ begin
Result:='['+Result+']'; Result:='['+Result+']';
end; end;
function GetModalResultStr(ModalResult: TModalResult): ShortString;
begin
Result := UITypes.ModalResultStr[ModalResult];
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
RecreateWnd RecreateWnd
This function was originally member of TWincontrol. From a VCL point of view This function was originally member of TWincontrol. From a VCL point of view

View File

@ -28,21 +28,36 @@ uses
Forms, Controls, Themes, GraphType, Graphics, Buttons, ButtonPanel, StdCtrls, Forms, Controls, Themes, GraphType, Graphics, Buttons, ButtonPanel, StdCtrls,
ExtCtrls, LCLClasses, ClipBrd, Menus, LCLTaskDialog, ExtCtrls, LCLClasses, ClipBrd, Menus, LCLTaskDialog,
// LazUtils // LazUtils
{$ifdef DebugCommonDialogEvents} UITypes, FileUtil, LazFileUtils;
ModalResultDef,
{$endif}
FileUtil, LazFileUtils;
type type
TMsgDlgType = (mtWarning, mtError, mtInformation, mtConfirmation, // Aliases for types in UITypes.
mtCustom); TMsgDlgType = UITypes.TMsgDlgType;
TMsgDlgBtn = (mbYes, mbNo, mbOK, mbCancel, mbAbort, mbRetry, mbIgnore, TMsgDlgBtn = UITypes.TMsgDlgBtn;
mbAll, mbNoToAll, mbYesToAll, mbHelp, mbClose); TMsgDlgButtons = UITypes.TMsgDlgButtons;
TMsgDlgButtons = set of TMsgDlgBtn;
const 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]; mbYesNoCancel = [mbYes, mbNo, mbCancel];
mbYesNo = [mbYes, mbNo]; mbYesNo = [mbYes, mbNo];
mbOKCancel = [mbOK, mbCancel]; mbOKCancel = [mbOK, mbCancel];

View File

@ -39,7 +39,7 @@ uses
LResources, GraphType, Graphics, Menus, LMessages, CustomTimer, ActnList, LResources, GraphType, Graphics, Menus, LMessages, CustomTimer, ActnList,
ClipBrd, HelpIntfs, Controls, ImgList, Themes, ClipBrd, HelpIntfs, Controls, ImgList, Themes,
// LazUtils // 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 {$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; TFormState = set of TFormStateType;
TModalResult = ModalResultDef.TModalResult; TModalResult = UITypes.TModalResult;
PModalResult = ^ModalResultDef.TModalResult; PModalResult = ^UITypes.TModalResult;
TFormHandlerType = ( TFormHandlerType = (
fhtFirstShow, fhtFirstShow,

View File

@ -34,7 +34,7 @@ uses
LCLProc, LCLType, Dialogs, Controls, Graphics, Forms, Masks, LCLProc, LCLType, Dialogs, Controls, Graphics, Forms, Masks,
// LazUtils // LazUtils
{$ifdef DebugCommonDialogEvents} {$ifdef DebugCommonDialogEvents}
ModalResultDef, UITypes,
{$endif} {$endif}
LazFileUtils, LazUTF8, LazFileUtils, LazUTF8,
// ws // ws