IDE: delphi converter: silently adding interfaces unit, bug #15641

git-svn-id: trunk@23685 -
This commit is contained in:
mattias 2010-02-11 09:08:57 +00:00
parent 72ddc78ce6
commit e01fe377a6
4 changed files with 20 additions and 14 deletions

View File

@ -321,7 +321,8 @@ begin
// save project // save project
debugln('FindAllDelphiProjectUnits Saving project ...'); debugln('FindAllDelphiProjectUnits Saving project ...');
Result:=LazarusIDE.DoSaveProject([]); // Add interfaces unit silently, no question dialogs.
Result:=LazarusIDE.DoSaveProject([sfQuietUnitCheck]);
if Result<>mrOk then begin if Result<>mrOk then begin
DebugLn('FindAllDelphiProjectUnits failed saving project'); DebugLn('FindAllDelphiProjectUnits failed saving project');
exit; exit;

View File

@ -813,7 +813,7 @@ type
function DoShowToDoList: TModalResult; function DoShowToDoList: TModalResult;
function DoTestCompilerSettings( function DoTestCompilerSettings(
TheCompilerOptions: TCompilerOptions): TModalResult; TheCompilerOptions: TCompilerOptions): TModalResult;
function CheckMainSrcLCLInterfaces: TModalResult; function CheckMainSrcLCLInterfaces(Silent: boolean): TModalResult;
function QuitIDE: boolean; function QuitIDE: boolean;
// edit menu // edit menu
@ -9229,7 +9229,7 @@ begin
if DoCheckFilesOnDisk(true) in [mrCancel,mrAbort] then exit; if DoCheckFilesOnDisk(true) in [mrCancel,mrAbort] then exit;
if CheckMainSrcLCLInterfaces<>mrOk then exit; if CheckMainSrcLCLInterfaces(sfQuietUnitCheck in Flags)<>mrOk then exit;
// if this is a virtual project then save first the project info file // if this is a virtual project then save first the project info file
// to get a project directory // to get a project directory
@ -10063,7 +10063,7 @@ begin
end; end;
end; end;
function TMainIDE.CheckMainSrcLCLInterfaces: TModalResult; function TMainIDE.CheckMainSrcLCLInterfaces(Silent: boolean): TModalResult;
var var
MainUnitInfo: TUnitInfo; MainUnitInfo: TUnitInfo;
MainUsesSection,ImplementationUsesSection: TStrings; MainUsesSection,ImplementationUsesSection: TStrings;
@ -10093,6 +10093,8 @@ begin
exit; exit;
// project uses lcl unit Forms, but not unit interfaces // project uses lcl unit Forms, but not unit interfaces
// this will result in strange linker error // this will result in strange linker error
if not Silent then
begin
MsgResult:=IDEQuestionDialog(lisCCOWarningCaption, MsgResult:=IDEQuestionDialog(lisCCOWarningCaption,
Format(lisTheProjectDoesNotUseTheLCLUnitInterfacesButItSeems, [#13]) Format(lisTheProjectDoesNotUseTheLCLUnitInterfacesButItSeems, [#13])
, mtWarning, [mrYes, lisAddUnitInterfaces, mrNo, dlgIgnoreVerb, , mtWarning, [mrYes, lisAddUnitInterfaces, mrNo, dlgIgnoreVerb,
@ -10102,6 +10104,7 @@ begin
mrNoToAll: begin Project1.SkipCheckLCLInterfaces:=true; exit; end; mrNoToAll: begin Project1.SkipCheckLCLInterfaces:=true; exit; end;
mrCancel: exit(mrCancel); mrCancel: exit(mrCancel);
end; end;
end;
CodeToolBoss.AddUnitToMainUsesSection(MainUnitInfo.Source,'Interfaces',''); CodeToolBoss.AddUnitToMainUsesSection(MainUnitInfo.Source,'Interfaces','');
finally finally
MainUsesSection.Free; MainUsesSection.Free;

View File

@ -231,7 +231,8 @@ const
'sfSaveNonProjectFiles', 'sfSaveNonProjectFiles',
'sfDoNotSaveVirtualFiles', 'sfDoNotSaveVirtualFiles',
'sfCanAbort', 'sfCanAbort',
'sfSaveMainSourceAs' 'sfSaveMainSourceAs',
'sfQuietUnitCheck'
); );
function OpenFlagsToString(Flags: TOpenFlags): string; function OpenFlagsToString(Flags: TOpenFlags): string;

View File

@ -73,7 +73,8 @@ type
sfSaveNonProjectFiles, sfSaveNonProjectFiles,
sfDoNotSaveVirtualFiles, sfDoNotSaveVirtualFiles,
sfCanAbort, // show 'Cancel all' button in error messages sfCanAbort, // show 'Cancel all' button in error messages
sfSaveMainSourceAs // on sfSaveAs use .lpr file instead of .lpi file sfSaveMainSourceAs, // on sfSaveAs use .lpr file instead of .lpi file
sfQuietUnitCheck // don't ask questions when adding unit dependency.
); );
TSaveFlags = set of TSaveFlag; TSaveFlags = set of TSaveFlag;