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

View File

@ -813,7 +813,7 @@ type
function DoShowToDoList: TModalResult;
function DoTestCompilerSettings(
TheCompilerOptions: TCompilerOptions): TModalResult;
function CheckMainSrcLCLInterfaces: TModalResult;
function CheckMainSrcLCLInterfaces(Silent: boolean): TModalResult;
function QuitIDE: boolean;
// edit menu
@ -9229,7 +9229,7 @@ begin
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
// to get a project directory
@ -10063,7 +10063,7 @@ begin
end;
end;
function TMainIDE.CheckMainSrcLCLInterfaces: TModalResult;
function TMainIDE.CheckMainSrcLCLInterfaces(Silent: boolean): TModalResult;
var
MainUnitInfo: TUnitInfo;
MainUsesSection,ImplementationUsesSection: TStrings;
@ -10093,14 +10093,17 @@ begin
exit;
// project uses lcl unit Forms, but not unit interfaces
// this will result in strange linker error
MsgResult:=IDEQuestionDialog(lisCCOWarningCaption,
Format(lisTheProjectDoesNotUseTheLCLUnitInterfacesButItSeems, [#13])
, mtWarning, [mrYes, lisAddUnitInterfaces, mrNo, dlgIgnoreVerb,
mrNoToAll, lisAlwaysIgnore, mrCancel]);
case MsgResult of
mrNo: exit;
mrNoToAll: begin Project1.SkipCheckLCLInterfaces:=true; exit; end;
mrCancel: exit(mrCancel);
if not Silent then
begin
MsgResult:=IDEQuestionDialog(lisCCOWarningCaption,
Format(lisTheProjectDoesNotUseTheLCLUnitInterfacesButItSeems, [#13])
, mtWarning, [mrYes, lisAddUnitInterfaces, mrNo, dlgIgnoreVerb,
mrNoToAll, lisAlwaysIgnore, mrCancel]);
case MsgResult of
mrNo: exit;
mrNoToAll: begin Project1.SkipCheckLCLInterfaces:=true; exit; end;
mrCancel: exit(mrCancel);
end;
end;
CodeToolBoss.AddUnitToMainUsesSection(MainUnitInfo.Source,'Interfaces','');
finally

View File

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

View File

@ -73,7 +73,8 @@ type
sfSaveNonProjectFiles,
sfDoNotSaveVirtualFiles,
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;