ide: remove OnImExportCompilerOptions event and use MainIDEInterface directly instead

git-svn-id: trunk@23358 -
This commit is contained in:
paul 2010-01-03 13:51:38 +00:00
parent 83786d3eec
commit 2826bd7bab
5 changed files with 33 additions and 39 deletions

View File

@ -43,7 +43,7 @@ uses
ComCtrls, Buttons, StdCtrls, ExtCtrls, Graphics, LResources, FileUtil,
Dialogs, Controls, GraphType, LCLType,
LinkScanner,
MacroIntf, ProjectIntf, IDEWindowIntf, IDEContextHelpEdit,
MacroIntf, ProjectIntf, IDEWindowIntf, IDEContextHelpEdit, MainIntf,
TransferMacros, PathEditorDlg, LazarusIDEStrConsts, IDEOptionDefs, LazConf,
IDEProcs, IDEImagesIntf, ShowCompilerOpts, Project, PackageDefs,
CompilerOptions, CheckCompilerOpts, CompOptsModes, BuildModesEditor,
@ -270,7 +270,6 @@ type
function CheckSearchPath(const Context, ExpandedPath: string;
Level: TCheckCompileOptionsMsgLvl): boolean;
private
FOnImExportCompilerOptions: TNotifyEvent;
FReadOnly: boolean;
ImageIndexPackage: integer;
ImageIndexRequired: integer;
@ -297,8 +296,6 @@ type
public
property ReadOnly: boolean read FReadOnly write SetReadOnly;
property UseAsDefault: boolean read GetUseAsDefault;
property OnImExportCompilerOptions: TNotifyEvent
read FOnImExportCompilerOptions write FOnImExportCompilerOptions;
end;
function SyntaxModeToCaption(const Mode: string): string;
@ -597,8 +594,7 @@ end;
procedure TfrmCompilerOptions.ButtonLoadSaveClick(Sender: TObject);
begin
if Assigned(OnImExportCompilerOptions) then
OnImExportCompilerOptions(Self);
MainIDEInterface.DoImExportCompilerOptions(Self);
end;
{------------------------------------------------------------------------------

View File

@ -8,7 +8,7 @@ uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
Buttons, StdCtrls, LCLType, InterfaceBase, IDEOptionsIntf, Project,
CompilerOptions, LazarusIDEStrConsts, PathEditorDlg, LazConf, IDEProcs,
CheckCompilerOpts, MacroIntf, ShowCompilerOpts;
CheckCompilerOpts, MacroIntf, ShowCompilerOpts, MainIntf;
type
@ -157,8 +157,16 @@ begin
end;
procedure TCompilerPathOptionsFrame.DoLoadSave(Sender: TObject);
var
Options: TBaseCompilerOptions;
begin
ShowMessage('TODO: unimplemented');
Options := TBaseCompilerOptionsClass(FCompilerOpts.ClassType).Create(FCompilerOpts.Owner);
try
DoSaveSettings(Options);
MainIDEInterface.DoImExportCompilerOptions(Options);
finally
Options.Free;
end;
end;
procedure TCompilerPathOptionsFrame.DoSaveSettings(AOptions: TAbstractIDEOptions);

View File

@ -501,7 +501,6 @@ type
// compiler options dialog events
procedure OnCompilerOptionsDialogTest(Sender: TObject);
procedure OnCompilerOptionsImExport(Sender: TObject);
// unit dependencies events
procedure UnitDependenciesViewAccessingSources(Sender: TObject);
@ -3873,7 +3872,6 @@ begin
]);
frmCompilerOptions.CompilerOpts:=Project1.CompilerOptions;
frmCompilerOptions.LoadOptionsToForm;
frmCompilerOptions.OnImExportCompilerOptions:=@OnCompilerOptionsImExport;
if frmCompilerOptions.ShowModal=mrOk then begin
MainBuildBoss.RescanCompilerDefines(true,true);
Project1.DefineTemplates.AllChanged;
@ -9605,22 +9603,31 @@ end;
function TMainIDE.DoImExportCompilerOptions(Sender: TObject): TModalResult;
var
CompOptsDialog: TfrmCompilerOptions;
Options: TCompilerOptions;
ImExportResult: TImExportCompOptsResult;
Filename: string;
begin
Result:=mrOk;
if not (Sender is TfrmCompilerOptions) then
Result := mrOk;
if Sender is TfrmCompilerOptions then
begin
CompOptsDialog := TfrmCompilerOptions(Sender);
Options := CompOptsDialog.CompilerOpts;
end
else
if Sender is TCompilerOptions then
begin
Options := TCompilerOptions(Sender);
CompOptsDialog := nil;
end
else
RaiseException('TMainIDE.OnCompilerOptionsImExport');
CompOptsDialog:=TfrmCompilerOptions(Sender);
ImExportResult:=ShowImExportCompilerOptionsDialog(
CompOptsDialog.CompilerOpts,Filename);
if (ImExportResult=iecorCancel) or (Filename='') then exit;
if ImExportResult=iecorImport then
Result:=DoImportCompilerOptions(CompOptsDialog,CompOptsDialog.CompilerOpts,
Filename)
else if ImExportResult=iecorExport then
Result:=DoExportCompilerOptions(CompOptsDialog,CompOptsDialog.CompilerOpts,
Filename);
ImExportResult := ShowImExportCompilerOptionsDialog(Options, Filename);
if (ImExportResult = iecorCancel) or (Filename='') then Exit;
if ImExportResult = iecorImport then
Result := DoImportCompilerOptions(CompOptsDialog, Options, Filename)
else
if ImExportResult = iecorExport then
Result := DoExportCompilerOptions(CompOptsDialog, Options, Filename);
end;
function TMainIDE.DoShowProjectInspector: TModalResult;
@ -15243,11 +15250,6 @@ begin
DoTestCompilerSettings(Sender as TCompilerOptions);
end;
procedure TMainIDE.OnCompilerOptionsImExport(Sender: TObject);
begin
DoImExportCompilerOptions(Sender);
end;
procedure TMainIDE.ProjInspectorOpen(Sender: TObject);
var
CurUnitInfo: TUnitInfo;

View File

@ -235,7 +235,6 @@ type
FOnFreeEditor: TOnFreePkgEditor;
FOnGetIDEFileInfo: TGetIDEFileStateEvent;
FOnGetUnitRegisterInfo: TOnGetUnitRegisterInfo;
FOnImExportCompilerOptions: TNotifyEvent;
FOnInstallPackage: TOnInstallPackage;
FOnOpenFile: TOnOpenFile;
FOnOpenPackage: TOnOpenPackage;
@ -315,8 +314,6 @@ type
write FOnViewPackageToDos;
property OnDeleteAmbiguousFiles: TOnDeleteAmbiguousFiles
read FOnDeleteAmbiguousFiles write FOnDeleteAmbiguousFiles;
property OnImExportCompilerOptions: TNotifyEvent
read FOnImExportCompilerOptions write FOnImExportCompilerOptions;
property OnAddToProject: TOnAddPkgToProject read FOnAddToProject
write FOnAddToProject;
property OnCreateMakefile: TOnCreatePkgMakefile read FOnCreatePkgMakefile
@ -1223,8 +1220,6 @@ var
begin
CompilerOptsDlg:=TfrmCompilerOptions.Create(Self);
CompilerOptsDlg.CompilerOpts:=LazPackage.CompilerOptions;
CompilerOptsDlg.OnImExportCompilerOptions:=
PackageEditors.OnImExportCompilerOptions;
with CompilerOptsDlg do begin
LoadOptionsToForm();
Caption:=Format(lisPckEditCompilerOptionsForPackage,[LazPackage.IDAsString]);

View File

@ -104,7 +104,6 @@ type
procedure OnPackageEditorGetUnitRegisterInfo(Sender: TObject;
const AFilename: string; var TheUnitName: string;
var HasRegisterProc: boolean);
procedure OnPackageEditorImExportCompilerOptions(Sender: TObject);
// package graph
function PackageGraphExplorerOpenPackage(Sender: TObject;
APackage: TLazPackage): TModalResult;
@ -862,11 +861,6 @@ begin
DoGetUnitRegisterInfo(AFilename,TheUnitName,HasRegisterProc,true);
end;
procedure TPkgManager.OnPackageEditorImExportCompilerOptions(Sender: TObject);
begin
MainIDE.DoImExportCompilerOptions(Sender);
end;
function TPkgManager.OnPackageEditorOpenPackage(Sender: TObject;
APackage: TLazPackage): TModalResult;
begin
@ -1790,7 +1784,6 @@ begin
PackageEditors.OnViewPackageSource:=@OnPackageEditorViewPkgSource;
PackageEditors.OnViewPackageToDos:=@OnPackageEditorViewPkgToDos;
PackageEditors.OnDeleteAmbiguousFiles:=@OnPackageEditorDeleteAmbiguousFiles;
PackageEditors.OnImExportCompilerOptions:=@OnPackageEditorImExportCompilerOptions;
PackageEditors.OnCreateMakefile:=@OnPackageEditorCreateMakefile;
// package macros