diff --git a/.gitattributes b/.gitattributes index a4334391ab..540a0c3ccc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2057,6 +2057,7 @@ components/ideintf/languages/objinspstrconsts.sk.po svneol=native#text/plain components/ideintf/languages/objinspstrconsts.uk.po svneol=native#text/plain components/ideintf/languages/objinspstrconsts.zh_CN.po svneol=native#text/plain components/ideintf/lazideintf.pas svneol=native#text/pascal +components/ideintf/lazmsgdialogs.pas svneol=native#text/pascal components/ideintf/lazstringgridedit.lfm svneol=native#text/plain components/ideintf/lazstringgridedit.pas svneol=native#text/plain components/ideintf/listviewpropedit.lfm svneol=native#text/plain diff --git a/components/ideintf/idedialogs.pas b/components/ideintf/idedialogs.pas index 815b360f69..9b959af4a9 100644 --- a/components/ideintf/idedialogs.pas +++ b/components/ideintf/idedialogs.pas @@ -17,26 +17,35 @@ unit IDEDialogs; interface uses - Classes, SysUtils, Controls, Dialogs; + Classes, SysUtils, + // LCL + Dialogs, + // LazUtils + UITypes, + // IdeIntf + LazMsgDialogs; type TIDESelectDirectory = function(const Title, InitialDir: string): string of object; TInitIDEFileDialog = procedure(AFileDialog: TFileDialog) of object; TStoreIDEFileDialog = procedure(AFileDialog: TFileDialog) of object; - TIDEMessageDialog = function(const aCaption, aMsg: string; - DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; - const HelpKeyword: string = ''): Integer of object; - TIDEQuestionDialog = function(const aCaption, aMsg: string; - DlgType: TMsgDlgType; Buttons: array of const; - const HelpKeyword: string = ''): Integer of object; + +var // set by the IDE + LazIDESelectDirectory: TIDESelectDirectory = nil; + InitIDEFileDialog: TInitIDEFileDialog = nil; + StoreIDEFileDialog: TStoreIDEFileDialog = nil; + +// Wrapper function for LazIDESelectDirectory with a default parameter. function LazSelectDirectory(const Title: string; const InitialDir: string = ''): string; -var - LazIDESelectDirectory: TIDESelectDirectory = nil;// set by the IDE - InitIDEFileDialog: TInitIDEFileDialog = nil; - StoreIDEFileDialog: TStoreIDEFileDialog = nil ; - IDEMessageDialog: TIDEMessageDialog = nil; - IDEQuestionDialog: TIDEQuestionDialog = nil; +// Wrapper function for LazMessageDialog in LazMsgDialogs. +function IDEMessageDialog(const aCaption, aMsg: string; + DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; + const HelpKeyword: string = ''): Integer; +// Wrapper function for LazQuestionDialog in LazMsgDialogs. +function IDEQuestionDialog(const aCaption, aMsg: string; + DlgType: TMsgDlgType; Buttons: array of const; + const HelpKeyword: string = ''): Integer; function IDEMessageDialogAb(const aCaption, aMsg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; @@ -87,6 +96,20 @@ begin Result:=LazIDESelectDirectory(Title,InitialDir); end; +function IDEMessageDialog(const aCaption, aMsg: string; + DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; + const HelpKeyword: string = ''): Integer; +begin + Result := LazMessageDialog(aCaption, aMsg, DlgType, Buttons, HelpKeyword); +end; + +function IDEQuestionDialog(const aCaption, aMsg: string; + DlgType: TMsgDlgType; Buttons: array of const; + const HelpKeyword: string = ''): Integer; +begin + Result := LazQuestionDialog(aCaption, aMsg, DlgType, Buttons, HelpKeyword); +end; + function IDEMessageDialogAb(const aCaption, aMsg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; ShowAbort: boolean; const HelpKeyword: string): Integer; begin diff --git a/components/ideintf/ideintf.lpk b/components/ideintf/ideintf.lpk index 9211d21e95..b5bf64336c 100644 --- a/components/ideintf/ideintf.lpk +++ b/components/ideintf/ideintf.lpk @@ -20,7 +20,7 @@ - + @@ -103,7 +103,7 @@ - + @@ -356,8 +356,12 @@ - + + + + + diff --git a/components/ideintf/ideintf.pas b/components/ideintf/ideintf.pas index 459d8d6537..a85d9fc377 100644 --- a/components/ideintf/ideintf.pas +++ b/components/ideintf/ideintf.pas @@ -8,18 +8,22 @@ unit IDEIntf; interface uses - ActionsEditor, ActionsEditorStd, BaseIDEIntf, CheckGroupEditorDlg, CheckListboxEditorDlg, - CollectionPropEditForm, ColumnDlg, ComponentEditors, ComponentReg, ComponentTreeView, - CompOptsIntf, DBPropEdits, EditorSyntaxHighlighterDef, fieldseditor, FieldsList, - FileFilterPropEditor, FormEditingIntf, frmSelectProps, GraphicPropEdit, GraphPropEdits, - HeaderControlPropEdit, HelpFPDoc, IDECommands, IDEDialogs, IDEExternToolIntf, IDEHelpIntf, - IDEImagesIntf, IDEMsgIntf, IDEOptionsIntf, IDETextConverter, IDEUtils, IDEWindowIntf, - ImageListEditor, KeyValPropEditDlg, LazIDEIntf, LazStringGridEdit, ListViewPropEdit, MacroDefIntf, - MacroIntf, MaskPropEdit, MenuIntf, NewField, NewItemIntf, ObjectInspector, ObjInspStrConsts, - OIFavoriteProperties, PackageIntf, ProjectIntf, ProjectResourcesIntf, PropEdits, PropEditUtils, - SrcEditorIntf, StatusBarPropEdit, StringsPropEditDlg, TextTools, TreeViewPropEdit, UnitResources, - ProjPackIntf, DBGridColumnsPropEditForm, ToolBarIntf, ChangeParentDlg, PackageDependencyIntf, - PackageLinkIntf, FppkgIntf, LazarusPackageIntf; + ActionsEditor, ActionsEditorStd, BaseIDEIntf, CheckGroupEditorDlg, + CheckListboxEditorDlg, CollectionPropEditForm, ColumnDlg, ComponentEditors, + ComponentReg, ComponentTreeView, CompOptsIntf, DBPropEdits, + EditorSyntaxHighlighterDef, fieldseditor, FieldsList, FileFilterPropEditor, + FormEditingIntf, frmSelectProps, GraphicPropEdit, GraphPropEdits, + HeaderControlPropEdit, HelpFPDoc, IDECommands, IDEDialogs, + IDEExternToolIntf, IDEHelpIntf, IDEImagesIntf, IDEMsgIntf, IDEOptionsIntf, + IDETextConverter, IDEUtils, IDEWindowIntf, ImageListEditor, + KeyValPropEditDlg, LazIDEIntf, LazStringGridEdit, ListViewPropEdit, + MacroDefIntf, MacroIntf, MaskPropEdit, MenuIntf, NewField, NewItemIntf, + ObjectInspector, ObjInspStrConsts, OIFavoriteProperties, PackageIntf, + ProjectIntf, ProjectResourcesIntf, PropEdits, PropEditUtils, SrcEditorIntf, + StatusBarPropEdit, StringsPropEditDlg, TextTools, TreeViewPropEdit, + UnitResources, ProjPackIntf, DBGridColumnsPropEditForm, ToolBarIntf, + ChangeParentDlg, PackageDependencyIntf, PackageLinkIntf, FppkgIntf, + LazMsgDialogs, LazarusPackageIntf; implementation diff --git a/components/ideintf/lazmsgdialogs.pas b/components/ideintf/lazmsgdialogs.pas new file mode 100644 index 0000000000..a756912c28 --- /dev/null +++ b/components/ideintf/lazmsgdialogs.pas @@ -0,0 +1,26 @@ +unit LazMsgDialogs; + +{$mode objfpc}{$H+} + +interface + +uses + // LazUtils + UITypes; + +type + TLazMessageDialog = function(const aCaption, aMsg: string; + DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; + const HelpKeyword: string = ''): Integer of object; + TLazQuestionDialog = function(const aCaption, aMsg: string; + DlgType: TMsgDlgType; Buttons: array of const; + const HelpKeyword: string = ''): Integer of object; + +var // set by the IDE + LazMessageDialog: TLazMessageDialog = nil; + LazQuestionDialog: TLazQuestionDialog = nil; + +implementation + +end. + diff --git a/ide/lazbuild.lpr b/ide/lazbuild.lpr index 64fde8c7d3..0a2cab077a 100644 --- a/ide/lazbuild.lpr +++ b/ide/lazbuild.lpr @@ -32,13 +32,13 @@ uses Interfaces, // this includes the NoGUI widgetset // LazUtils Masks, LConvEncoding, FileUtil, LazFileUtils, LazLoggerBase, LazUtilities, - LazUTF8, Laz2_XMLCfg, + LazUTF8, Laz2_XMLCfg, UITypes, // LCL - LCLPlatformDef, Controls, Dialogs, Forms, + LCLPlatformDef, Forms, // Codetools CodeCache, CodeToolManager, DefineTemplates, FileProcs, // IDEIntf - MacroIntf, PackageIntf, IDEDialogs, ProjectIntf, IDEExternToolIntf, + MacroIntf, PackageIntf, LazMsgDialogs, ProjectIntf, IDEExternToolIntf, CompOptsIntf, IDEOptionsIntf, LazIDEIntf, PackageDependencyIntf, // IDE IDEProcs, InitialSetupProc, ExtTools, CompilerOptions, @@ -1251,8 +1251,8 @@ end; procedure TLazBuildApplication.SetupDialogs; begin - IDEMessageDialog:=@OnIDEMessageDialog; - IDEQuestionDialog:=@OnIDEQuestionDialog; + LazMessageDialog:=@OnIDEMessageDialog; + LazQuestionDialog:=@OnIDEQuestionDialog; end; procedure TLazBuildApplication.StoreBaseSettings; diff --git a/ide/main.pp b/ide/main.pp index 26145703e3..b3b6194355 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -78,7 +78,7 @@ uses // IDE interface IDEIntf, ObjectInspector, PropEdits, PropEditUtils, EditorSyntaxHighlighterDef, MacroIntf, IDECommands, IDEWindowIntf, ComponentReg, - SrcEditorIntf, NewItemIntf, IDEExternToolIntf, IDEMsgIntf, + SrcEditorIntf, NewItemIntf, IDEExternToolIntf, IDEMsgIntf, LazMsgDialogs, PackageIntf, ProjectIntf, CompOptsIntf, MenuIntf, LazIDEIntf, IDEDialogs, IDEOptionsIntf, IDEOptEditorIntf, IDEImagesIntf, ComponentEditors, ToolBarIntf, // protocol @@ -2103,8 +2103,8 @@ begin LazIDESelectDirectory:=@SelectDirectoryHandler; InitIDEFileDialog:=@InitIDEFileDialogHandler; StoreIDEFileDialog:=@StoreIDEFileDialogHandler; - IDEMessageDialog:=@IDEMessageDialogHandler; - IDEQuestionDialog:=@IDEQuestionDialogHandler; + LazMessageDialog:=@IDEMessageDialogHandler; + LazQuestionDialog:=@IDEQuestionDialogHandler; TestCompilerOptions:=@CompilerOptionsDialogTest; CheckCompOptsAndMainSrcForNewUnitEvent:=@CheckForNewUnit; end;