mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 13:50:06 +02:00
ide: remove compileroptionsdlg dependencies
git-svn-id: trunk@29483 -
This commit is contained in:
parent
dbc8aa6616
commit
2ee90538f9
@ -34,7 +34,7 @@ interface
|
|||||||
uses
|
uses
|
||||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||||
Buttons, IDEProcs, FileUtil, Laz_XMLCfg, LCLType, MainIntf,
|
Buttons, IDEProcs, FileUtil, Laz_XMLCfg, LCLType, MainIntf,
|
||||||
LazarusIDEStrConsts, InputHistory, CompilerOptions, CompilerOptionsDlg;
|
LazarusIDEStrConsts, InputHistory, CompilerOptions;
|
||||||
|
|
||||||
type
|
type
|
||||||
{ TImExportCompOptsDlg }
|
{ TImExportCompOptsDlg }
|
||||||
@ -75,10 +75,8 @@ type
|
|||||||
function ShowImExportCompilerOptionsDialog(
|
function ShowImExportCompilerOptionsDialog(
|
||||||
CompOpts: TBaseCompilerOptions; var Filename: string): TImportExportOptionsResult;
|
CompOpts: TBaseCompilerOptions; var Filename: string): TImportExportOptionsResult;
|
||||||
|
|
||||||
function DoImportCompilerOptions(CompOptsDialog: TfrmCompilerOptions;
|
function DoImportCompilerOptions(CompilerOpts: TBaseCompilerOptions; const Filename: string): TModalResult;
|
||||||
CompilerOpts: TBaseCompilerOptions; const Filename: string): TModalResult;
|
function DoExportCompilerOptions(CompilerOpts: TBaseCompilerOptions; const Filename: string): TModalResult;
|
||||||
function DoExportCompilerOptions(CompOptsDialog: TfrmCompilerOptions;
|
|
||||||
CompilerOpts: TBaseCompilerOptions; const Filename: string): TModalResult;
|
|
||||||
function GetXMLPathForCompilerOptions(XMLConfig: TXMLConfig): string;
|
function GetXMLPathForCompilerOptions(XMLConfig: TXMLConfig): string;
|
||||||
function ReadIntFromXMLConfig(const Filename, Path: string;
|
function ReadIntFromXMLConfig(const Filename, Path: string;
|
||||||
DefaultValue, ValueForReadError: integer): integer;
|
DefaultValue, ValueForReadError: integer): integer;
|
||||||
@ -102,11 +100,9 @@ begin
|
|||||||
ImExportCompOptsDlg.Free;
|
ImExportCompOptsDlg.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function DoImportCompilerOptions(CompOptsDialog: TfrmCompilerOptions;
|
function DoImportCompilerOptions(CompilerOpts: TBaseCompilerOptions; const Filename: string): TModalResult;
|
||||||
CompilerOpts: TBaseCompilerOptions; const Filename: string): TModalResult;
|
|
||||||
var
|
var
|
||||||
XMLConfig: TXMLConfig;
|
XMLConfig: TXMLConfig;
|
||||||
FreeCompilerOpts: Boolean;
|
|
||||||
Path: String;
|
Path: String;
|
||||||
begin
|
begin
|
||||||
Result := mrOk;
|
Result := mrOk;
|
||||||
@ -120,60 +116,37 @@ begin
|
|||||||
), mtError, [mbCancel], 0);
|
), mtError, [mbCancel], 0);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
FreeCompilerOpts:=false;
|
|
||||||
try
|
try
|
||||||
if (CompOptsDialog<>nil) then begin
|
|
||||||
CompilerOpts:=TBaseCompilerOptions.Create(nil);
|
|
||||||
FreeCompilerOpts:=true;
|
|
||||||
end;
|
|
||||||
Path:=GetXMLPathForCompilerOptions(XMLConfig);
|
Path:=GetXMLPathForCompilerOptions(XMLConfig);
|
||||||
CompilerOpts.LoadFromXMLConfig(XMLConfig,Path);
|
CompilerOpts.LoadFromXMLConfig(XMLConfig,Path);
|
||||||
if CompOptsDialog<>nil then
|
|
||||||
CompOptsDialog.LoadOptionsToForm(CompilerOpts);
|
|
||||||
finally
|
finally
|
||||||
if FreeCompilerOpts then
|
|
||||||
CompilerOpts.Free;
|
|
||||||
XMLConfig.Free;
|
XMLConfig.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function DoExportCompilerOptions(CompOptsDialog: TfrmCompilerOptions;
|
function DoExportCompilerOptions(CompilerOpts: TBaseCompilerOptions; const Filename: string): TModalResult;
|
||||||
CompilerOpts: TBaseCompilerOptions; const Filename: string): TModalResult;
|
|
||||||
var
|
var
|
||||||
XMLConfig: TXMLConfig;
|
XMLConfig: TXMLConfig;
|
||||||
FreeCompilerOpts: Boolean;
|
|
||||||
Path: String;
|
Path: String;
|
||||||
begin
|
begin
|
||||||
FreeCompilerOpts:=false;
|
Result:=mrOk;
|
||||||
if (CompOptsDialog<>nil) then
|
|
||||||
begin
|
|
||||||
CompilerOpts:=TBaseCompilerOptions.Create(nil);
|
|
||||||
FreeCompilerOpts:=true;
|
|
||||||
CompOptsDialog.SaveFormToOptions(ccomlNone,CompilerOpts);
|
|
||||||
end;
|
|
||||||
try
|
try
|
||||||
Result:=mrOk;
|
InvalidateFileStateCache;
|
||||||
|
XMLConfig:=TXMLConfig.Create(Filename);
|
||||||
try
|
try
|
||||||
InvalidateFileStateCache;
|
Path:=GetXMLPathForCompilerOptions(XMLConfig);
|
||||||
XMLConfig:=TXMLConfig.Create(Filename);
|
CompilerOpts.SaveToXMLConfig(XMLConfig,Path);
|
||||||
try
|
XMLConfig.Flush;
|
||||||
Path:=GetXMLPathForCompilerOptions(XMLConfig);
|
finally
|
||||||
CompilerOpts.SaveToXMLConfig(XMLConfig,Path);
|
XMLConfig.Free;
|
||||||
XMLConfig.Flush;
|
end;
|
||||||
finally
|
except
|
||||||
XMLConfig.Free;
|
on E: Exception do
|
||||||
end;
|
begin
|
||||||
except
|
Result:=MessageDlg(lisIECOErrorAccessingXml,
|
||||||
on E: Exception do
|
Format(lisIECOErrorAccessingXmlFile, ['"', Filename, '"', #13,
|
||||||
begin
|
E.Message]), mtError, [mbCancel], 0);
|
||||||
Result:=MessageDlg(lisIECOErrorAccessingXml,
|
|
||||||
Format(lisIECOErrorAccessingXmlFile, ['"', Filename, '"', #13,
|
|
||||||
E.Message]), mtError, [mbCancel], 0);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
finally
|
|
||||||
if FreeCompilerOpts then
|
|
||||||
CompilerOpts.Free;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
46
ide/main.pp
46
ide/main.pp
@ -79,7 +79,7 @@ uses
|
|||||||
// protocol
|
// protocol
|
||||||
IDEProtocol,
|
IDEProtocol,
|
||||||
// compile
|
// compile
|
||||||
Compiler, CompilerOptions, CompilerOptionsDlg, CheckCompilerOpts,
|
Compiler, CompilerOptions, CheckCompilerOpts,
|
||||||
ApplicationBundle, ImExportCompilerOpts, InfoBuild,
|
ApplicationBundle, ImExportCompilerOpts, InfoBuild,
|
||||||
// projects
|
// projects
|
||||||
ProjectResources, Project, ProjectDefs, NewProjectDlg,
|
ProjectResources, Project, ProjectDefs, NewProjectDlg,
|
||||||
@ -10445,29 +10445,19 @@ end;
|
|||||||
|
|
||||||
function TMainIDE.DoImExportCompilerOptions(Sender: TObject; out ImportExportResult: TImportExportOptionsResult): TModalResult;
|
function TMainIDE.DoImExportCompilerOptions(Sender: TObject; out ImportExportResult: TImportExportOptionsResult): TModalResult;
|
||||||
var
|
var
|
||||||
CompOptsDialog: TfrmCompilerOptions;
|
|
||||||
Options: TCompilerOptions;
|
Options: TCompilerOptions;
|
||||||
Filename: string;
|
Filename: string;
|
||||||
begin
|
begin
|
||||||
Result := mrOk;
|
Result := mrOk;
|
||||||
if Sender is TfrmCompilerOptions then
|
|
||||||
begin
|
|
||||||
CompOptsDialog := TfrmCompilerOptions(Sender);
|
|
||||||
Options := CompOptsDialog.CompilerOpts;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if Sender is TCompilerOptions then
|
if Sender is TCompilerOptions then
|
||||||
begin
|
Options := TCompilerOptions(Sender)
|
||||||
Options := TCompilerOptions(Sender);
|
|
||||||
CompOptsDialog := nil;
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
RaiseException('TMainIDE.OnCompilerOptionsImExport');
|
RaiseException('TMainIDE.OnCompilerOptionsImExport');
|
||||||
ImportExportResult := ShowImExportCompilerOptionsDialog(Options, Filename);
|
ImportExportResult := ShowImExportCompilerOptionsDialog(Options, Filename);
|
||||||
if Filename='' then Exit(mrCancel);
|
if Filename='' then Exit(mrCancel);
|
||||||
case ImportExportResult of
|
case ImportExportResult of
|
||||||
ieorImport: Result := DoImportCompilerOptions(CompOptsDialog, Options, Filename);
|
ieorImport: Result := DoImportCompilerOptions(Options, Filename);
|
||||||
ieorExport: Result := DoExportCompilerOptions(CompOptsDialog, Options, Filename);
|
ieorExport: Result := DoExportCompilerOptions(Options, Filename);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -11001,6 +10991,34 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function CheckCompileReasons(Reason: TCompileReason;
|
||||||
|
Options: TProjectCompilerOptions; Quiet: boolean): TModalResult;
|
||||||
|
var
|
||||||
|
ProjToolOpts: TProjectCompilationToolOptions;
|
||||||
|
begin
|
||||||
|
if (Reason in Options.CompileReasons)
|
||||||
|
and (Options.CompilerPath<>'') then
|
||||||
|
exit(mrOk);
|
||||||
|
if Options.ExecuteBefore is TProjectCompilationToolOptions then begin
|
||||||
|
ProjToolOpts:=TProjectCompilationToolOptions(Options.ExecuteBefore);
|
||||||
|
if (Reason in ProjToolOpts.CompileReasons) and (ProjToolOpts.Command<>'') then
|
||||||
|
exit(mrOk);
|
||||||
|
end;
|
||||||
|
if Options.ExecuteAfter is TProjectCompilationToolOptions then begin
|
||||||
|
ProjToolOpts:=TProjectCompilationToolOptions(Options.ExecuteAfter);
|
||||||
|
if (Reason in ProjToolOpts.CompileReasons) and (ProjToolOpts.Command<>'') then
|
||||||
|
exit(mrOk);
|
||||||
|
end;
|
||||||
|
// reason is not handled
|
||||||
|
if Quiet then exit(mrCancel);
|
||||||
|
Result:=MessageDlg('Nothing to do',
|
||||||
|
'The project''s compiler options has no compile command.'#13
|
||||||
|
+'See Project / Compiler Options ... / Compilation',mtInformation,
|
||||||
|
[mbCancel,mbIgnore],0);
|
||||||
|
if Result=mrIgnore then
|
||||||
|
Result:=mrOk;
|
||||||
|
end;
|
||||||
|
|
||||||
function TMainIDE.DoBuildProject(const AReason: TCompileReason;
|
function TMainIDE.DoBuildProject(const AReason: TCompileReason;
|
||||||
Flags: TProjectBuildFlags): TModalResult;
|
Flags: TProjectBuildFlags): TModalResult;
|
||||||
var
|
var
|
||||||
|
@ -46,7 +46,7 @@ uses
|
|||||||
IDEHelpIntf,
|
IDEHelpIntf,
|
||||||
// IDE
|
// IDE
|
||||||
MainIntf, IDEProcs, LazConf, LazarusIDEStrConsts, IDEOptionDefs, IDEDefs,
|
MainIntf, IDEProcs, LazConf, LazarusIDEStrConsts, IDEOptionDefs, IDEDefs,
|
||||||
IDEContextHelpEdit, CompilerOptions, CompilerOptionsDlg, ComponentReg,
|
IDEContextHelpEdit, CompilerOptions, ComponentReg,
|
||||||
PackageDefs, PkgOptionsDlg, AddToPackageDlg, PkgVirtualUnitEditor,
|
PackageDefs, PkgOptionsDlg, AddToPackageDlg, PkgVirtualUnitEditor,
|
||||||
MissingPkgFilesDlg, PackageSystem;
|
MissingPkgFilesDlg, PackageSystem;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user