mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 14:49:29 +02:00
IDE: save state project closed
git-svn-id: trunk@38755 -
This commit is contained in:
parent
7c5fdea730
commit
1cafbef514
@ -60,6 +60,8 @@ const
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
|
||||
RestoreProjectClosed = '-';
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
{ Backup }
|
||||
@ -562,7 +564,8 @@ type
|
||||
property MaxRecentPackageFiles: integer read FMaxRecentPackageFiles
|
||||
write FMaxRecentPackageFiles;
|
||||
property LastSavedProjectFile: string read FLastSavedProjectFile
|
||||
write FLastSavedProjectFile;
|
||||
write FLastSavedProjectFile; // if empty then create new project,
|
||||
// if '-'=RestoreProjectClosed then do not load/create any project
|
||||
property OpenLastProjectAtStart: boolean read FOpenLastProjectAtStart
|
||||
write FOpenLastProjectAtStart;
|
||||
property FileDialogFilter: string read FFileDialogFilter write FFileDialogFilter;
|
||||
|
28
ide/main.pp
28
ide/main.pp
@ -2193,7 +2193,10 @@ begin
|
||||
if (not ProjectLoaded)
|
||||
and (not SkipAutoLoadingLastProject)
|
||||
and (EnvironmentOptions.OpenLastProjectAtStart)
|
||||
and (FileExistsUTF8(EnvironmentOptions.LastSavedProjectFile)) then begin
|
||||
and (EnvironmentOptions.LastSavedProjectFile<>'')
|
||||
and (EnvironmentOptions.LastSavedProjectFile<>RestoreProjectClosed)
|
||||
and (FileExistsCached(EnvironmentOptions.LastSavedProjectFile))
|
||||
then begin
|
||||
if (not IDEProtocolOpts.LastProjectLoadingCrashed)
|
||||
or AskIfLoadLastFailingProject then begin
|
||||
// protocol that the IDE is trying to load the last project and did not
|
||||
@ -2213,10 +2216,16 @@ begin
|
||||
end;
|
||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.SetupStartProject B');{$ENDIF}
|
||||
|
||||
if not ProjectLoaded then
|
||||
// create new project
|
||||
DoNewProject(ProjectDescriptorApplication);
|
||||
|
||||
if (not ProjectLoaded) then
|
||||
begin
|
||||
if EnvironmentOptions.OpenLastProjectAtStart
|
||||
and (EnvironmentOptions.LastSavedProjectFile=RestoreProjectClosed) then begin
|
||||
// IDE was closed without a project => restore that state
|
||||
end else begin
|
||||
// create new project
|
||||
DoNewProject(ProjectDescriptorApplication);
|
||||
end;
|
||||
end;
|
||||
UpdateWindowMenu(true);
|
||||
|
||||
// load the cmd line files
|
||||
@ -2224,6 +2233,15 @@ begin
|
||||
for i:=0 to CmdLineFiles.Count-1 do
|
||||
Begin
|
||||
AFilename:=CleanAndExpandFilename(CmdLineFiles.Strings[i]);
|
||||
if not FileExistsCached(AFilename) then begin
|
||||
debugln(['WARNING: command line file not found: "',AFilename,'"']);
|
||||
continue;
|
||||
end;
|
||||
if Project1=nil then begin
|
||||
// to open a file a project is needed
|
||||
// => create a project
|
||||
DoNewProject(ProjectDescriptorEmptyProject);
|
||||
end;
|
||||
if CompareFileExt(AFilename,'.lpk',false)=0 then begin
|
||||
if PkgBoss.DoOpenPackageFile(AFilename,[pofAddToRecent,pofMultiOpen],true)
|
||||
=mrAbort
|
||||
|
@ -1906,6 +1906,8 @@ begin
|
||||
FreeThenNil(Project1);
|
||||
if IDEMessagesWindow<>nil then IDEMessagesWindow.Clear;
|
||||
|
||||
EnvironmentOptions.LastSavedProjectFile:=RestoreProjectClosed;
|
||||
|
||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TLazSourceFileManager.CloseProject C');{$ENDIF}
|
||||
Result:=mrOk;
|
||||
//writeln('TLazSourceFileManager.CloseProject end ',CodeToolBoss.ConsistencyCheck);
|
||||
|
Loading…
Reference in New Issue
Block a user