IdeIntf: Move MessageDialog pointers from IDEDialogs to a new LazMsgDialogs. Break LCL dependency there.

git-svn-id: trunk@58614 -
This commit is contained in:
juha 2018-07-24 12:50:39 +00:00
parent 96131c07cf
commit e6b449750a
7 changed files with 94 additions and 36 deletions

1
.gitattributes vendored
View File

@ -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

View File

@ -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

View File

@ -20,7 +20,7 @@
<Description Value="IDEIntf - the interface units for the Lazarus IDE"/>
<License Value="Modified LGPL2"/>
<Version Major="1"/>
<Files Count="84">
<Files Count="85">
<Item1>
<Filename Value="actionseditor.pas"/>
<UnitName Value="ActionsEditor"/>
@ -103,7 +103,7 @@
</Item20>
<Item21>
<Filename Value="fieldslist.pas"/>
<UnitName Value="fieldslist"/>
<UnitName Value="FieldsList"/>
</Item21>
<Item22>
<Filename Value="fieldslist.lfm"/>
@ -356,8 +356,12 @@
</Item83>
<Item84>
<Filename Value="fppkgintf.pas"/>
<UnitName Value="fppkgintf"/>
<UnitName Value="FppkgIntf"/>
</Item84>
<Item85>
<Filename Value="lazmsgdialogs.pas"/>
<UnitName Value="LazMsgDialogs"/>
</Item85>
</Files>
<LazDoc Paths="docs"/>
<i18n>

View File

@ -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

View File

@ -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.

View File

@ -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;

View File

@ -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;