MG: fixed creating project from file

git-svn-id: trunk@2783 -
This commit is contained in:
lazarus 2002-08-18 08:54:03 +00:00
parent f1bd716cdf
commit 336984eb44

View File

@ -4169,7 +4169,8 @@ writeln('TMainIDE.DoNewProject A');
// close current project first // close current project first
If Project1<>nil then begin If Project1<>nil then begin
if SomethingOfProjectIsModified then begin if SomethingOfProjectIsModified then begin
if MessageDlg(lisProjectChanged, Format(lisSaveChangesToProject, [Project1.Title]), if MessageDlg(lisProjectChanged, Format(lisSaveChangesToProject,
[Project1.Title]),
mtconfirmation, [mbYes, mbNo, mbCancel], 0) = mrYes then begin mtconfirmation, [mbYes, mbNo, mbCancel], 0) = mrYes then begin
if DoSaveProject([])=mrAbort then begin if DoSaveProject([])=mrAbort then begin
Result:=mrAbort; Result:=mrAbort;
@ -4526,6 +4527,7 @@ function TMainIDE.DoCreateProjectForProgram(
ProgramBuf: TCodeBuffer): TModalResult; ProgramBuf: TCodeBuffer): TModalResult;
var NewProjectType:TProjectType; var NewProjectType:TProjectType;
MainUnitInfo: TUnitInfo; MainUnitInfo: TUnitInfo;
ds: char;
begin begin
{$IFDEF IDE_VERBOSE} {$IFDEF IDE_VERBOSE}
writeln('[TMainIDE.DoCreateProjectForProgram] A ',ProgramBuf.Filename); writeln('[TMainIDE.DoCreateProjectForProgram] A ',ProgramBuf.Filename);
@ -4533,7 +4535,8 @@ begin
Result:=mrCancel; Result:=mrCancel;
if SomethingOfProjectIsModified then begin if SomethingOfProjectIsModified then begin
if MessageDlg(lisProjectChanged, Format(lisSaveChangesToProject, [Project1.Title]), if MessageDlg(lisProjectChanged, Format(lisSaveChangesToProject,
[Project1.Title]),
mtconfirmation, [mbYes, mbNo, mbCancel], 0)=mrYes then mtconfirmation, [mbYes, mbNo, mbCancel], 0)=mrYes then
begin begin
if DoSaveProject([])=mrAbort then begin if DoSaveProject([])=mrAbort then begin
@ -4554,6 +4557,10 @@ begin
end; end;
end; end;
// switch codetools to new project directory
CodeToolBoss.GlobalValues.Variables[ExternalMacroStart+'ProjectDir']:=
ExpandFilename(ExtractFilePath(ProgramBuf.Filename));
// create a new project // create a new project
Project1:=TProject.Create(NewProjectType); Project1:=TProject.Create(NewProjectType);
Project1.OnFileBackup:=@DoBackupFile; Project1.OnFileBackup:=@DoBackupFile;
@ -4564,13 +4571,21 @@ begin
UpdateCaption; UpdateCaption;
// set project type specific things // set project type specific things
if NewProjectType=ptApplication then begin ds:=PathDelim;
case NewProjectType of
ptApplication:
begin
// add lcl ppu dirs to unit search path
Project1.CompilerOptions.OtherUnitFiles:= Project1.CompilerOptions.OtherUnitFiles:=
'$(LazarusDir)'+PathDelim+'lcl'+PathDelim+'units' '$(LazarusDir)'+ds+'lcl'+ds+'units'
+';'+ +';'+
'$(LazarusDir)'+PathDelim+'lcl'+PathDelim+'units' '$(LazarusDir)'+ds+'lcl'+ds+'units'+ds+'$(LCLWidgetType)';
+PathDelim // add lcl pp/pas dirs to source search path
+CodeToolBoss.GlobalValues.Variables[ExternalMacroStart+'LCLWidgetType']; Project1.SrcPath:=
'$(LazarusDir)'+ds+'lcl'
+';'+
'$(LazarusDir)'+ds+'lcl'+ds+'interfaces'+ds+'$(LCLWidgetType)';
end;
end; end;
// rebuild project specific codetools defines // rebuild project specific codetools defines
@ -7130,6 +7145,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.388 2002/09/17 22:19:32 lazarus
MG: fixed creating project from file
Revision 1.387 2002/09/17 21:33:14 lazarus Revision 1.387 2002/09/17 21:33:14 lazarus
MG: accelerated designer mouse move and added Delete Selection to designer popupmenu MG: accelerated designer mouse move and added Delete Selection to designer popupmenu