property List<Breakpoint> breakpoints { set { breakpoints = value; } get { return breakpoints; } isset { return breakpoints && breakpoints.count; } }
property List<Watch> watches { set { watches = value; } get { return watches; } isset { return watches && watches.count; } }
property List<OpenedFileInfo> openedFiles { set { openedFiles = value; } get { return openedFiles; } isset { return openedFiles && openedFiles.count; } }
+ property RecentPaths recentFiles { set { recentFiles = value; } get { return recentFiles; } isset { return recentFiles && recentFiles.count; } }
bool useValgrind;
ValgrindLeakCheck vgLeakCheck;
List<Breakpoint> breakpoints;
List<Watch> watches;
List<OpenedFileInfo> openedFiles;
+ RecentPaths recentFiles;
char * workspaceFile;
char * workspaceDir;
return node;
}
- OpenedFileInfo UpdateOpenedFileInfo(const char * fileName, OpenedFileState state)
+ OpenedFileInfo UpdateOpenedFileInfo(const char * fileName, OpenedFileState state, bool fileOpen)
{
+ bool insert = false;
char absolutePath[MAX_LOCATION];
char relativePath[MAX_LOCATION];
OpenedFileInfo ofi;
GetSlashPathBuffer(absolutePath, fileName);
MakeRelativePath(relativePath, fileName);
ofi = FindOpenedFileInfo(relativePath, absolutePath);
+ if(fileOpen && ofi)
+ {
+ openedFiles.Remove(openedFiles.Find(ofi));
+ insert = true;
+ }
if(state)
{
if(!ofi)
{
ofi = OpenedFileInfo { path = CopyString(relativePath) };
- openedFiles.Add(ofi);
+ insert = true;
}
ofi.state = state;
ofi.modified = GetLocalTimeStamp();
if(!holdTracking)
modified = true;
}
+ if(insert)
+ openedFiles.Insert(null, ofi);
return ofi;
}
void OpenPreviouslyOpenedFiles(bool noParsing)
{
+ Array<String> filePaths {};
holdTracking = true;
- for(ofi : openedFiles)
+ for(ofi : openedFiles; ofi.state != closed)
+ filePaths.Add(CopyString(ofi.path));
+ for(path : filePaths)
{
- if(ofi.state != closed)
+ Window file;
+ char absolutePath[MAX_LOCATION];
+ strcpy(absolutePath, workspaceDir);
+ PathCatSlash(absolutePath, path);
+ file = ide.OpenFile(absolutePath, false, true, null, no, normal, noParsing);
+ if(file)
{
- Window file;
- char absolutePath[MAX_LOCATION];
- strcpy(absolutePath, workspaceDir);
- PathCatSlash(absolutePath, ofi.path);
- file = ide.OpenFile(absolutePath, false, true, null, no, normal, noParsing);
- if(file)
+ for(prj : projects)
{
- for(prj : projects)
- {
- ProjectNode node = prj.topNode.FindByFullPath(absolutePath, true);
- if(node)
- node.EnsureVisible();
- }
+ ProjectNode node = prj.topNode.FindByFullPath(absolutePath, true);
+ if(node)
+ node.EnsureVisible();
}
}
}
holdTracking = false;
+ filePaths.Free();
+ delete filePaths;
}
OpenedFileInfo FindOpenedFileInfo(const char * relativePath, const char * absolutePath)
void RestorePreviouslyOpenedFileState(CodeEditor editor)
{
- if((editor.openedFileInfo = UpdateOpenedFileInfo(editor.fileName, opened)))
+ if((editor.openedFileInfo = UpdateOpenedFileInfo(editor.fileName, opened, true)))
editor.openedFileInfo.SetCodeEditorState(editor);
}
if(!breakpoints) breakpoints = { };
if(!watches) watches = { };
if(!openedFiles) openedFiles = { };
+ if(!recentFiles) recentFiles = { };
}
void Free()
if(breakpoints) { breakpoints.Free(); delete breakpoints; }
if(watches) { watches.Free(); delete watches; }
if(openedFiles) { openedFiles.Free(); delete openedFiles; }
+ if(recentFiles) { recentFiles.Free(); delete recentFiles; }
projects.Free();
}
SetSourceDirs(null);
Free();
}
-
}
Workspace LoadWorkspace(const char * filePath, const char * fromProjectFile)
if(workspace)
{
+ if(!workspace.recentFiles || !workspace.recentFiles.count)
+ {
+ int c;
+ if(!workspace.recentFiles) workspace.recentFiles = { };
+ if(workspace.openedFiles && workspace.openedFiles.count)
+ {
+ for(c = workspace.openedFiles.count - 1; c >= 0; c--)
+ {
+ char path[MAX_LOCATION];
+ strcpy(path, workspace.workspaceDir);
+ PathCatSlash(path, workspace.openedFiles[c].path);
+ workspace.recentFiles.addRecent(CopyString(path));
+ }
+ }
+ }
workspace.Init();
if(!workspace.projects.first)
{