mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 19:56:03 +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
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||
Buttons, IDEProcs, FileUtil, Laz_XMLCfg, LCLType, MainIntf,
|
||||
LazarusIDEStrConsts, InputHistory, CompilerOptions, CompilerOptionsDlg;
|
||||
LazarusIDEStrConsts, InputHistory, CompilerOptions;
|
||||
|
||||
type
|
||||
{ TImExportCompOptsDlg }
|
||||
@ -75,10 +75,8 @@ type
|
||||
function ShowImExportCompilerOptionsDialog(
|
||||
CompOpts: TBaseCompilerOptions; var Filename: string): TImportExportOptionsResult;
|
||||
|
||||
function DoImportCompilerOptions(CompOptsDialog: TfrmCompilerOptions;
|
||||
CompilerOpts: TBaseCompilerOptions; const Filename: string): TModalResult;
|
||||
function DoExportCompilerOptions(CompOptsDialog: TfrmCompilerOptions;
|
||||
CompilerOpts: TBaseCompilerOptions; const Filename: string): TModalResult;
|
||||
function DoImportCompilerOptions(CompilerOpts: TBaseCompilerOptions; const Filename: string): TModalResult;
|
||||
function DoExportCompilerOptions(CompilerOpts: TBaseCompilerOptions; const Filename: string): TModalResult;
|
||||
function GetXMLPathForCompilerOptions(XMLConfig: TXMLConfig): string;
|
||||
function ReadIntFromXMLConfig(const Filename, Path: string;
|
||||
DefaultValue, ValueForReadError: integer): integer;
|
||||
@ -102,11 +100,9 @@ begin
|
||||
ImExportCompOptsDlg.Free;
|
||||
end;
|
||||
|
||||
function DoImportCompilerOptions(CompOptsDialog: TfrmCompilerOptions;
|
||||
CompilerOpts: TBaseCompilerOptions; const Filename: string): TModalResult;
|
||||
function DoImportCompilerOptions(CompilerOpts: TBaseCompilerOptions; const Filename: string): TModalResult;
|
||||
var
|
||||
XMLConfig: TXMLConfig;
|
||||
FreeCompilerOpts: Boolean;
|
||||
Path: String;
|
||||
begin
|
||||
Result := mrOk;
|
||||
@ -120,60 +116,37 @@ begin
|
||||
), mtError, [mbCancel], 0);
|
||||
end;
|
||||
end;
|
||||
FreeCompilerOpts:=false;
|
||||
try
|
||||
if (CompOptsDialog<>nil) then begin
|
||||
CompilerOpts:=TBaseCompilerOptions.Create(nil);
|
||||
FreeCompilerOpts:=true;
|
||||
end;
|
||||
Path:=GetXMLPathForCompilerOptions(XMLConfig);
|
||||
CompilerOpts.LoadFromXMLConfig(XMLConfig,Path);
|
||||
if CompOptsDialog<>nil then
|
||||
CompOptsDialog.LoadOptionsToForm(CompilerOpts);
|
||||
finally
|
||||
if FreeCompilerOpts then
|
||||
CompilerOpts.Free;
|
||||
XMLConfig.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function DoExportCompilerOptions(CompOptsDialog: TfrmCompilerOptions;
|
||||
CompilerOpts: TBaseCompilerOptions; const Filename: string): TModalResult;
|
||||
function DoExportCompilerOptions(CompilerOpts: TBaseCompilerOptions; const Filename: string): TModalResult;
|
||||
var
|
||||
XMLConfig: TXMLConfig;
|
||||
FreeCompilerOpts: Boolean;
|
||||
Path: String;
|
||||
begin
|
||||
FreeCompilerOpts:=false;
|
||||
if (CompOptsDialog<>nil) then
|
||||
begin
|
||||
CompilerOpts:=TBaseCompilerOptions.Create(nil);
|
||||
FreeCompilerOpts:=true;
|
||||
CompOptsDialog.SaveFormToOptions(ccomlNone,CompilerOpts);
|
||||
end;
|
||||
Result:=mrOk;
|
||||
try
|
||||
Result:=mrOk;
|
||||
InvalidateFileStateCache;
|
||||
XMLConfig:=TXMLConfig.Create(Filename);
|
||||
try
|
||||
InvalidateFileStateCache;
|
||||
XMLConfig:=TXMLConfig.Create(Filename);
|
||||
try
|
||||
Path:=GetXMLPathForCompilerOptions(XMLConfig);
|
||||
CompilerOpts.SaveToXMLConfig(XMLConfig,Path);
|
||||
XMLConfig.Flush;
|
||||
finally
|
||||
XMLConfig.Free;
|
||||
end;
|
||||
except
|
||||
on E: Exception do
|
||||
begin
|
||||
Result:=MessageDlg(lisIECOErrorAccessingXml,
|
||||
Format(lisIECOErrorAccessingXmlFile, ['"', Filename, '"', #13,
|
||||
E.Message]), mtError, [mbCancel], 0);
|
||||
end;
|
||||
Path:=GetXMLPathForCompilerOptions(XMLConfig);
|
||||
CompilerOpts.SaveToXMLConfig(XMLConfig,Path);
|
||||
XMLConfig.Flush;
|
||||
finally
|
||||
XMLConfig.Free;
|
||||
end;
|
||||
except
|
||||
on E: Exception do
|
||||
begin
|
||||
Result:=MessageDlg(lisIECOErrorAccessingXml,
|
||||
Format(lisIECOErrorAccessingXmlFile, ['"', Filename, '"', #13,
|
||||
E.Message]), mtError, [mbCancel], 0);
|
||||
end;
|
||||
finally
|
||||
if FreeCompilerOpts then
|
||||
CompilerOpts.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
46
ide/main.pp
46
ide/main.pp
@ -79,7 +79,7 @@ uses
|
||||
// protocol
|
||||
IDEProtocol,
|
||||
// compile
|
||||
Compiler, CompilerOptions, CompilerOptionsDlg, CheckCompilerOpts,
|
||||
Compiler, CompilerOptions, CheckCompilerOpts,
|
||||
ApplicationBundle, ImExportCompilerOpts, InfoBuild,
|
||||
// projects
|
||||
ProjectResources, Project, ProjectDefs, NewProjectDlg,
|
||||
@ -10445,29 +10445,19 @@ end;
|
||||
|
||||
function TMainIDE.DoImExportCompilerOptions(Sender: TObject; out ImportExportResult: TImportExportOptionsResult): TModalResult;
|
||||
var
|
||||
CompOptsDialog: TfrmCompilerOptions;
|
||||
Options: TCompilerOptions;
|
||||
Filename: string;
|
||||
begin
|
||||
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
|
||||
Options := TCompilerOptions(Sender)
|
||||
else
|
||||
RaiseException('TMainIDE.OnCompilerOptionsImExport');
|
||||
ImportExportResult := ShowImExportCompilerOptionsDialog(Options, Filename);
|
||||
if Filename='' then Exit(mrCancel);
|
||||
case ImportExportResult of
|
||||
ieorImport: Result := DoImportCompilerOptions(CompOptsDialog, Options, Filename);
|
||||
ieorExport: Result := DoExportCompilerOptions(CompOptsDialog, Options, Filename);
|
||||
ieorImport: Result := DoImportCompilerOptions(Options, Filename);
|
||||
ieorExport: Result := DoExportCompilerOptions(Options, Filename);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -11001,6 +10991,34 @@ begin
|
||||
{$ENDIF}
|
||||
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;
|
||||
Flags: TProjectBuildFlags): TModalResult;
|
||||
var
|
||||
|
@ -46,7 +46,7 @@ uses
|
||||
IDEHelpIntf,
|
||||
// IDE
|
||||
MainIntf, IDEProcs, LazConf, LazarusIDEStrConsts, IDEOptionDefs, IDEDefs,
|
||||
IDEContextHelpEdit, CompilerOptions, CompilerOptionsDlg, ComponentReg,
|
||||
IDEContextHelpEdit, CompilerOptions, ComponentReg,
|
||||
PackageDefs, PkgOptionsDlg, AddToPackageDlg, PkgVirtualUnitEditor,
|
||||
MissingPkgFilesDlg, PackageSystem;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user