3 import "FileSystemIterator"
5 class ImportFolderFSI : NormalFileSystemIterator
7 ProjectView projectView;
8 Array<ProjectNode> stack { };
10 bool OnFolder(char * folderPath)
12 char name[MAX_LOCATION];
13 ProjectNode parentNode = stack.lastIterator.data;
15 GetLastDirectory(folderPath, name);
16 folder = parentNode.FindSpecial(name, false, true, true);
18 folder = projectView.NewFolder(parentNode, name, false);
23 void OutFolder(char * folderPath, bool isRoot)
25 stack.lastIterator.Remove(); //stack.Remove();
28 bool OnFile(char * filePath)
30 ProjectNode parentNode = stack.lastIterator.data;
31 projectView.AddFile(parentNode, filePath, parentNode.isInResources, false);
36 static FileFilter fileFilters[] =
39 "EC/C/C++ Files (*.ec, *.eh, *.c, *.cpp, *.cc, *.cxx, *.h, *.hpp, *.hh, *.hxx)",
40 "ec, eh, c, cpp, cc, cxx, h, hpp, hh, hxx"
43 "EC/C/C++ Source Files (*.ec, *.c, *.cpp, *.cc, *.cxx)",
44 "ec, eh, c, cpp, cc, cxx"
47 "Header Files for eC/C/C++ (*.eh, *.h, *.hpp, *.hh, *.hxx)",
53 static FileFilter resourceFilters[] =
56 "Image Files (*.jpg, *.jpeg, *.bmp, *.pcx, *.png,*.gif)",
57 "jpg, jpeg, bmp, pcx, png, gif"
60 "3D Studio Model Files (*.3ds)",
66 static FileType fileTypes[] =
68 { "Based on extension", null },
71 { "3D Studio Model", "3ds" }
74 static FileFilter projectFilters[] =
76 { "Project Files (*.epj)", ProjectExtension },
77 { "Workspace Files (*.ews)", WorkspaceExtension }
80 static FileType projectTypes[] =
82 { "ECERE Project", ProjectExtension },
83 { "ECERE Workspace", WorkspaceExtension }
86 static char * iconNames[] =
88 "<:ecere>mimeTypes/file.png", /*genFile*/
89 "<:ecere>mimeTypes/textEcereWorkspace.png", /*ewsFile*/
90 "<:ecere>mimeTypes/textEcereProject.png", /*epjFile*/
91 "<:ecere>places/folder.png", /*folder*/
92 "<:ecere>status/folderOpen.png", /*openFolder*/
93 "<:ecere>mimeTypes/textEcereSource.png", /*ecFile*/
94 "<:ecere>mimeTypes/textEcereHeader.png", /*ehFile*/
95 "<:ecere>mimeTypes/textCSource.png", /*cFile*/
96 "<:ecere>mimeTypes/textCHeader.png", /*hFile*/
97 "<:ecere>mimeTypes/textC++Source.png", /*cppFile*/
98 "<:ecere>mimeTypes/textC++Header.png", /*hppFile*/
99 "<:ecere>mimeTypes/text.png", /*textFile*/
100 "<:ecere>mimeTypes/textHyperTextMarkup.png", /*webFile*/
101 "<:ecere>mimeTypes/image.png", /*pictureFile*/
102 "<:ecere>status/audioVolumeHigh.png", /*soundFile*/
103 "<:ecere>mimeTypes/package.png", /*archiveFile*/
104 "<:ecere>mimeTypes/packageSoftware.png", /*packageFile*/
105 "<:ecere>mimeTypes/packageOpticalDisc.png" /*opticalMediaImageFile*/
108 enum PrepareMakefileMethod { normal, force, forceExists };
110 enum BuildType { build, rebuild, relink, run, start, restart };
113 none, buildingMainProject, buildingSecondaryProject, compilingFile;
115 property bool { get { return this != none; } }
116 property bool actualBuild { get { return this == buildingMainProject || this == buildingSecondaryProject; } }
119 class ProjectView : Window
122 //hasMinimize = true;
124 borderStyle = sizable;
125 hasHorzScroll = true;
126 hasVertScroll = true;
129 anchor = Anchor { left = 0, top = 0, bottom = 0 };
132 //hasMinimize = true;
133 saveDialog = projectFileDialog;
136 BuildState buildInProgress;
137 BitmapResource icons[NodeIcons];
140 property Workspace workspace
146 for(prj : workspace.projects)
148 DeleteNode(prj.topNode);
150 workspace.projects.Free();
151 ide.debugger.CleanUp();
156 fileDialog.currentDirectory = workspace.workspaceDir;
157 resourceFileDialog.currentDirectory = workspace.workspaceDir;
158 for(prj : workspace.projects)
159 AddNode(prj.topNode, null);
160 ide.statusBar.text = "Generating Makefile & Dependencies...";
162 for(prj : workspace.projects)
163 prj.ModifiedAllConfigs(true, false, false, false);
164 ide.statusBar.text = "Initializing Debugger"; app.UpdateDisplay();
165 ide.statusBar.text = null;
169 get { return workspace; }
172 /*property Project project
178 DeleteNode(project.topNode);
184 AddNode(project.topNode, null);
185 fileDialog.currentDirectory = project.topNode.path;
186 resourceFileDialog.currentDirectory = project.topNode.path;
188 // Make sure this is done already...
190 char filePath[MAX_LOCATION];
191 strcpy(filePath, project.topNode.path);
192 PathCat(filePath, project.topNode.name);
193 strcat(filePath, ".epj");
197 ide.statusBar.text = "Generating Makefile & Dependencies...";
199 // REDJ set makefile generation flag so generation occurs only when compiling instead of generating on the spot
200 project.config.makingModified = true;
201 ide.statusBar.text = "Initializing Debugger";
202 ide.statusBar.text = null;
206 get { return project; }
209 bool drawingInProjectSettingsDialog;
210 bool drawingInProjectSettingsDialogHeader;
211 ProjectSettings projectSettingsDialog;
217 multiSelect = true, fullRowSelect = false, hasVertScroll = true, hasHorzScroll = true;
218 borderStyle = deep, parent = this, collapseControl = true, treeBranches = true;
219 anchor = Anchor { left = 0, right = 0, top = 0 , bottom = 0 };
221 bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
223 if(!active) Update(null);
224 return ListBox::OnActivate(active, previous, goOnWithActivation, direct);
227 bool NotifyDoubleClick(ListBox listBox, int x, int y, Modifiers mods)
233 bool NotifyRightClick(ListBox listBox, int x, int y, Modifiers mods)
235 DataRow row = listBox.currentRow;
238 ProjectNode node = (ProjectNode)row.tag;
239 if(node.type == NodeTypes::project || node.type == resources || node.type == file || node.type == folder)
241 bool buildMenuUnavailable = buildInProgress;
243 Menu popupContent { };
245 if(node.type == NodeTypes::project)
247 //if(node == ((Project)workspace.projects.first).topNode)
249 MenuItem { popupContent, "Build", b, NotifySelect = ProjectBuild }.disabled = buildMenuUnavailable;
250 MenuItem { popupContent, "Relink", l, NotifySelect = ProjectLink }.disabled = buildMenuUnavailable;
251 MenuItem { popupContent, "Rebuild", r, NotifySelect = ProjectRebuild }.disabled = buildMenuUnavailable;
252 MenuItem { popupContent, "Clean", c, NotifySelect = ProjectClean }.disabled = buildMenuUnavailable;
253 MenuItem { popupContent, "Regenerate Makefile", m, NotifySelect = ProjectRegenerate }.disabled = buildMenuUnavailable;
254 MenuDivider { popupContent };
256 MenuItem { popupContent, "New File...", l, Key { l, ctrl = true }, NotifySelect = ProjectNewFile };
257 MenuItem { popupContent, "New Folder...", n, Key { f, ctrl = true }, NotifySelect = ProjectNewFolder };
258 MenuItem { popupContent, "Import Folder...", i, NotifySelect = ProjectImportFolder };
259 MenuItem { popupContent, "Add Files to Project...", f, NotifySelect = ProjectAddFiles };
260 MenuDivider { popupContent };
261 MenuItem { popupContent, "Add New Form...", o, NotifySelect = ProjectAddNewForm };
262 // MenuItem { popupContent, "Add New Behavior Graph...", g, NotifySelect = ProjectAddNewGraph };
263 MenuDivider { popupContent };
264 if(node != ((Project)workspace.projects.first).topNode)
266 MenuItem { popupContent, "Remove project from workspace", r, NotifySelect = ProjectRemove }.disabled = buildMenuUnavailable;
267 MenuDivider { popupContent };
269 MenuItem { popupContent, "Active Configuration...", s, Key { f5, alt = true } , NotifySelect = MenuConfig };
270 MenuItem { popupContent, "Settings...", s, Key { f7, alt = true } , NotifySelect = MenuSettings };
271 MenuDivider { popupContent };
272 MenuItem { popupContent, "Browse Folder", w, NotifySelect = MenuBrowseFolder };
273 MenuDivider { popupContent };
274 MenuItem { popupContent, "Save", v, Key { s, ctrl = true }, NotifySelect = ProjectSave }.disabled = !node.modified;
275 MenuDivider { popupContent };
276 MenuItem { popupContent, "Properties...", p, Key { enter, alt = true }, NotifySelect = FileProperties };
278 else if(node.type == resources)
280 MenuItem { popupContent, "New File...", l, Key { l, ctrl = true }, NotifySelect = ProjectNewFile };
281 MenuItem { popupContent, "New Folder...", n, Key { f, ctrl = true }, NotifySelect = ProjectNewFolder };
282 MenuItem { popupContent, "Add Resources to Project...", f, NotifySelect = ResourcesAddFiles };
283 MenuItem { popupContent, "Browse Folder", w, NotifySelect = MenuBrowseFolder };
284 MenuDivider { popupContent };
285 MenuItem { popupContent, "Settings...", s, Key { f7, alt = true } , NotifySelect = MenuSettings };
286 MenuItem { popupContent, "Properties...", p, Key { enter, alt = true }, NotifySelect = FileProperties };
288 else if(node.type == file)
290 MenuItem { popupContent, "Open", o, NotifySelect = FileOpenFile };
291 MenuItem { popupContent, "Compile", c, Key { f7, ctrl = true}, NotifySelect = FileCompile }.disabled = buildMenuUnavailable;
292 MenuDivider { popupContent };
293 MenuItem { popupContent, "Remove", r, NotifySelect = FileRemoveFile };
294 MenuDivider { popupContent };
295 MenuItem { popupContent, "Browse Folder", w, NotifySelect = MenuBrowseFolder };
296 MenuDivider { popupContent };
297 MenuItem { popupContent, "Settings...", s, Key { f7, alt = true } , NotifySelect = MenuSettings };
298 MenuItem { popupContent, "Properties..", p, Key { enter, alt = true }, NotifySelect = FileProperties };
300 else if(node.type == folder)
302 bool isInResources = node.isInResources;
304 MenuItem { popupContent, "New File...", l, Key { l, ctrl = true }, NotifySelect = ProjectNewFile };
305 MenuItem { popupContent, "New Folder...", n, Key { f, ctrl = true }, NotifySelect = ProjectNewFolder };
306 MenuItem { popupContent, "Import Folder...", i, NotifySelect = ProjectImportFolder };
309 MenuItem { popupContent, "Add Resources to Folder...", f, NotifySelect = ResourcesAddFiles };
313 MenuItem { popupContent, "Add Files to Folder...", f, NotifySelect = ProjectAddFiles };
317 MenuDivider { popupContent };
318 MenuItem { popupContent, "Add New Form...", o, NotifySelect = ProjectAddNewForm };
319 MenuItem { popupContent, "Add New Behavior Graph...", g, NotifySelect = ProjectAddNewGraph };
321 MenuDivider { popupContent };
322 MenuItem { popupContent, "Remove", r, NotifySelect = FileRemoveFile };
323 MenuDivider { popupContent };
324 MenuItem { popupContent, "Browse Folder", w, NotifySelect = MenuBrowseFolder };
325 MenuDivider { popupContent };
326 MenuItem { popupContent, "Settings...", s, Key { f7, alt = true } , NotifySelect = MenuSettings };
327 MenuItem { popupContent, "Properties...", p, Key { enter, alt = true }, NotifySelect = FileProperties };
332 master = this, menu = popupContent;
334 x + clientStart.x + absPosition.x - app.desktop.position.x,
335 y + clientStart.y + absPosition.y - app.desktop.position.y };
343 bool NotifyKeyDown(ListBox listBox, DataRow row, Key key, unichar ch)
347 ProjectNode node = (ProjectNode)row.tag;
350 case altEnter: case Key { keyPadEnter, alt = true }:
352 NodeProperties { parent = parent, master = this,
353 position = { position.x + 100, position.y + 100 }, node = node }.Create();
356 case enter: case keyPadEnter:
359 for(resNode = node.parent; resNode; resNode = resNode.parent)
360 if(resNode.type == resources)
362 if(node.type == project || (node.type == folder && !resNode))
367 else if(node.type == resources || node.type == folder)
376 if(node.type == project || node.type == folder || node.type == resources)
385 if(node.type == project || node.type == folder || node.type == resources)
387 NewFolder(node, null, true);
394 if(node.type == file)
396 FileCompile(null, (Modifiers)key);
401 case Key { space, shift = true }:
404 if(node.type == NodeTypes::project)
407 for(p : workspace.projects)
409 if(p.topNode == node)
415 prj.RotateActiveConfig(!key.shift);
426 case enter: case keyPadEnter: OpenSelectedNodes(); break;
427 case del: RemoveSelectedNodes(); break;
430 Window activeClient = ide.activeClient;
432 activeClient.Activate();
434 ide.RepositionWindows(true);
441 bool NotifyCollapse(ListBox listBox, DataRow row, bool collapsed)
443 ProjectNode node = (ProjectNode)row.tag;
444 if(node.type == folder)
445 node.icon = collapsed ? folder : openFolder;
450 FileDialog importFileDialog { autoCreate = false, type = selectDir, text = "Import Folder" };
451 FileDialog projectFileDialog
453 autoCreate = false, filters = projectFilters, sizeFilters = sizeof(projectFilters);
454 types = projectTypes, sizeTypes = sizeof(projectTypes);
456 FileDialog fileDialog
458 autoCreate = false, mayNotExist = true, filters = fileFilters, sizeFilters = sizeof(fileFilters);
459 types = fileTypes, sizeTypes = sizeof(fileTypes);
461 FileDialog resourceFileDialog
463 autoCreate = false, mayNotExist = true, filters = resourceFilters, sizeFilters = sizeof(resourceFilters);
464 types = fileTypes, sizeTypes = sizeof(fileTypes);
467 Menu fileMenu { menu, "File", f };
468 MenuItem { fileMenu, "Save", s, Key { s, ctrl = true }, NotifySelect = MenuFileSave };
469 // MenuItem { fileMenu, "Save As...", a, NotifySelect = MenuFileSaveAs };
471 bool OnClose(bool parentClosing)
473 if(!parentClosing && visible)
485 //if(ide.findInFilesDialog && ide.findInFilesDialog.created && ide.findInFilesDialog.mode != directory)
486 // ide.findInFilesDialog.SearchStop();
488 ide.outputView.buildBox.Clear();
489 ide.outputView.debugBox.Clear();
490 //ide.outputView.findBox.Clear();
491 ide.callStackView.Clear();
492 ide.watchesView.Clear();
493 ide.threadsView.Clear();
494 ide.breakpointsView.Clear();
495 ide.outputView.ShowClearSelectTab(find); // why this?
498 bool OnSaveFile(char * fileName)
500 for(prj : ide.workspace.projects)
502 if(prj.topNode.modified && prj.Save(prj.filePath))
504 // ProjectUpdateMakefileForAllConfigs(prj, true, true);
505 prj.topNode.modified = false;
508 modifiedDocument = false;
513 bool IsModuleInProject(char * filePath)
515 char moduleName[MAX_FILENAME]; //, modulePath[MAX_LOCATION];
516 GetLastDirectory(filePath, moduleName);
517 return project.topNode.Find(moduleName, false) != null;
520 bool GetRelativePath(char * filePath, char * relativePath)
523 char moduleName[MAX_FILENAME]; //, modulePath[MAX_LOCATION];
524 GetLastDirectory(filePath, moduleName);
526 // try with workspace dir first?
527 if((node = project.topNode.Find(moduleName, false)))
529 strcpy(relativePath, node.path);
530 PathCatSlash(relativePath, node.name);
533 // WARNING: On failure, relative path is uninitialized
535 return project.GetRelativePath(filePath, relativePath);
538 ProjectNode GetNodeFromWindow(Window document, Project project)
540 if(document.fileName)
542 char winFileName[MAX_LOCATION];
543 char * documentFileName = GetSlashPathBuffer(winFileName, document.fileName);
544 for(p : ide.workspace.projects)
546 Project prj = project ? project : p;
548 char moduleName[MAX_FILENAME], modulePath[MAX_LOCATION];
549 GetLastDirectory(document.fileName, moduleName);
551 if((node = prj.topNode.Find(moduleName, false)))
553 strcpy(modulePath, prj.topNode.path);
554 PathCatSlash(modulePath, node.path);
555 PathCatSlash(modulePath, node.name);
556 if(!fstrcmp(documentFileName, modulePath))
567 void Compile(ProjectNode node)
569 char fileName[MAX_LOCATION];
570 char extension[MAX_EXTENSION];
572 Project prj = node.project;
573 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
574 DirExpression objDir = prj.objDir;
576 strcpy(fileName, prj.topNode.path);
577 PathCatSlash(fileName, objDir.dir);
578 PathCatSlash(fileName, node.name);
579 StripExtension(fileName);
580 strcat(fileName, ".o");
581 if(FileExists(fileName))
582 DeleteFile(fileName);
584 GetExtension(node.name, extension);
585 if(!strcmp(extension, "ec"))
587 // Delete generated C file
588 strcpy(fileName, prj.topNode.path);
589 PathCat(fileName, objDir.dir);
590 PathCat(fileName, node.name);
591 StripExtension(fileName);
592 strcat(fileName, ".c");
593 if(FileExists(fileName))
594 DeleteFile(fileName);
596 // Delete symbol file
597 strcpy(fileName, prj.topNode.path);
598 PathCat(fileName, node.path);
599 PathCat(fileName, node.name);
600 StripExtension(fileName);
601 strcat(fileName, ".sym");
602 if(FileExists(fileName))
603 DeleteFile(fileName);
608 // Check if we have to save
609 strcpy(fileName, prj.topNode.path);
610 PathCatSlash(fileName, node.path);
611 PathCatSlash(fileName, node.name);
612 for(document = ide.firstChild; document; document = document.next)
614 if(document.modifiedDocument)
616 char documentFileName[MAX_LOCATION];
617 if(!fstrcmp(GetSlashPathBuffer(documentFileName, document.fileName), fileName))
618 if(!document.MenuFileSave(null, 0))
623 if(ProjectPrepareForToolchain(prj, normal, true, true))
627 buildInProgress = compilingFile;
628 ide.AdjustBuildMenus();
630 //ide.outputView.ShowClearSelectTab(build);
631 // this stuff doesn't even appear
632 //ide.outputView.buildBox.Logf("%s Compiler\n", compiler.name);
634 ide.outputView.buildBox.Logf("Compiling single file %s in project %s using the %s configuration...\n", node.name, prj.name, prj.config.name);
636 ide.outputView.buildBox.Logf("Compiling single file %s in project %s...\n", node.name, prj.name);
639 buildInProgress = none;
640 ide.AdjustBuildMenus();
643 ide.outputView.buildBox.Logf("File %s is excluded from current build configuration.\n", node.name);
649 void GoToError(const char * line)
653 while(isspace(*line)) line++;
654 colon = strstr(line, ":");
659 bool lookForLineNumber = true;
661 // deal with linking error
662 if(colon && colon[1] == ' ')
664 colon = strstr(colon + 1, ":");
665 if(colon && !colon[1])
667 colon = strstr(line, ":");
668 lookForLineNumber = false;
670 else if(colon && !isdigit(colon[1]))
673 colon = strstr(line, ":");
676 // Don't be mistaken by the drive letter colon
677 if(colon && (colon[1] == '/' || colon[1] == '\\'))
678 colon = strstr(colon + 1, ":");
679 if(colon && lookForLineNumber)
683 char * par = RSearchString(line, "(", colon - line, true, false);
684 if(par && strstr(par, ")"))
686 else if((colon+1)[0] == ' ')
688 // NOTE: This is the same thing as saying 'colon = line'
689 for( ; colon != line; colon--)
693 lineNumber = atoi(colon + 1);
695 comma = strchr(colon, ',');
699 comma = strchr(colon+1, ':');
705 char moduleName[MAX_LOCATION], filePath[MAX_LOCATION];
710 strncpy(moduleName, line, colon - line);
711 moduleName[colon - line] = '\0';
714 strcpy(moduleName, line);
716 // Remove stuff in brackets
718 bracket = strstr(moduleName, "(");
719 if(bracket) *bracket = '\0';
721 MakeSlashPath(moduleName);
725 // Check if it's one of our modules
726 ProjectNode node = project.topNode.Find(moduleName, false);
729 strcpy(moduleName, node.path);
730 PathCatSlash(moduleName, node.name);
733 moduleName[0] = '\0';
737 CodeEditor codeEditor;
738 strcpy(filePath, project.topNode.path);
739 PathCatSlash(filePath, moduleName);
741 codeEditor = (CodeEditor)ide.OpenFile(filePath, normal, true, null, no, normal);
744 char name[MAX_LOCATION];
745 // TOFIX: Improve on this, don't use only filename, make a function
746 if(ide && ide.workspace)
748 for(prj : ide.workspace.projects)
750 if(prj.topNode.FindWithPath(moduleName, false))
752 strcpy(filePath, prj.topNode.path);
753 PathCatSlash(filePath, moduleName);
754 codeEditor = (CodeEditor)ide.OpenFile(filePath, normal, true, null, no, normal);
761 if(codeEditor && lineNumber)
763 EditBox editBox = codeEditor.editBox;
764 editBox.GoToLineNum(lineNumber - 1);
765 editBox.GoToPosition(editBox.line, lineNumber - 1, col ? (col - 1) : 0);
772 bool OpenNode(ProjectNode node)
774 char filePath[MAX_LOCATION];
775 node.GetFullFilePath(filePath);
776 return ide.OpenFile(filePath, normal, true/*false Why was it opening hidden?*/, null, something, normal) ? true : false;
779 void AddNode(ProjectNode node, DataRow addTo)
781 DataRow row = addTo ? addTo.AddRow() : fileList.AddRow();
786 if(node.type == resources)
789 row.SetData(null, node);
791 if(node.files && node.files.first && node.parent &&
792 !(!node.parent.parent &&
793 (!strcmpi(node.name, "notes") || !strcmpi(node.name, "sources") ||
794 !strcmpi(node.name, "src") || !strcmpi(node.name, "tools"))))
795 row.collapsed = true;
796 else if(node.type == folder)
797 node.icon = openFolder;
801 for(child : node.files)
806 void DeleteNode(ProjectNode projectNode)
808 if(projectNode.files)
811 while(child = projectNode.files.first)
814 fileList.DeleteRow(projectNode.row);
815 projectNode.Delete();
821 for(c = 0; c < NodeIcons::enumSize; c++)
823 icons[c] = BitmapResource { iconNames[c], alphaBlend = true };
824 AddResource(icons[c]);
826 fileList.AddField(DataField { dataType = class(ProjectNode), freeData = false, userData = this });
832 ide.DestroyTemporaryProjectDir();
840 bool ProjectSave(MenuItem selection, Modifiers mods)
842 DataRow row = fileList.currentRow;
843 ProjectNode node = row ? (ProjectNode)row.tag : null;
844 Project prj = node ? node.project : null;
847 if(prj.Save(prj.filePath))
849 // ProjectUpdateMakefileForAllConfigs(prj, true, true);
850 prj.topNode.modified = false;
852 for(p : ide.workspace.projects)
854 if(p.topNode.modified)
861 modifiedDocument = false;
868 bool ShowOutputBuildLog(bool cleanLog)
870 OutputView output = ide.outputView;
872 output.ShowClearSelectTab(build);
875 output.SelectTab(build);
880 bool DisplayCompiler(bool cleanLog)
882 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
883 LogBox logBox = ide.outputView.buildBox;
884 ShowOutputBuildLog(cleanLog);
885 logBox.Logf("%s Compiler\n", compiler ? compiler.name : "{problem with compiler selection}");
889 bool ProjectUpdateMakefileForAllConfigs(Project project, bool cleanLog, bool displayCompiler)
891 ProjectConfig currentConfig = project.config;
892 ShowOutputBuildLog(cleanLog);
895 DisplayCompiler(false);
897 for(config : project.configurations)
899 project.config = config;
900 ProjectPrepareMakefile(project, forceExists, false, false);
903 project.config = currentConfig;
908 bool ProjectPrepareForToolchain(Project project, PrepareMakefileMethod method, bool cleanLog, bool displayCompiler)
911 char message[MAX_F_STRING];
912 LogBox logBox = ide.outputView.buildBox;
914 ShowOutputBuildLog(cleanLog);
917 DisplayCompiler(false);
919 ProjectPrepareMakefile(project, method, false, false);
923 bool ProjectPrepareMakefile(Project project, PrepareMakefileMethod method, bool cleanLog, bool displayCompiler)
925 char makefilePath[MAX_LOCATION];
926 char makefileName[MAX_LOCATION];
928 LogBox logBox = ide.outputView.buildBox;
930 ShowOutputBuildLog(cleanLog);
933 DisplayCompiler(false);
935 strcpy(makefilePath, project.topNode.path);
936 project.CatMakeFileName(makefileName);
937 PathCatSlash(makefilePath, makefileName);
939 exists = FileExists(makefilePath);
940 if((method == normal && (!exists || project.config.makingModified/*|| project.topNode.modified*/)) ||
941 (method == forceExists && exists) ||
942 method == force) // || project.config.makingModified || makefileDirty
946 ide.statusBar.text = "Generating Makefile & Dependencies..."; // Dependencies?
949 if((method == normal && !exists) || (method == force && !exists))
950 action = "Generating ";
951 else if(method == force)
952 action = "Regenerating ";
953 else if(method == normal || method == forceExists)
954 action = "Updating ";
958 reason = "Makefile doesn't exist. ";
959 else if(project.topNode.modified)
960 reason = "Project has been modified. ";
964 //logBox.Logf("%s\n", makefileName);
965 logBox.Logf("%s - %s%smakefile for %s config...\n", makefileName, reason, action, project.configName);
966 project.GenerateMakefile(null, false, null);
968 ide.statusBar.text = null;
975 bool ProjectBuild(MenuItem selection, Modifiers mods)
977 Project prj = project;
978 if(selection || !ide.activeClient || activeClient == this)
980 DataRow row = fileList.currentRow;
981 ProjectNode node = row ? (ProjectNode)row.tag : null;
982 if(node) prj = node.project;
984 // Added this code here until dependencies work:
985 else //if(ide.activeClient)
987 ProjectNode node = GetNodeFromWindow(ide.activeClient, null);
991 if(/*prj != project || */!prj.configIsInDebugSession || !ide.DontTerminateDebugSession("Project Build"))
992 BuildInterrim(prj, build);
996 bool BuildInterrim(Project prj, BuildType buildType)
998 if(ProjectPrepareForToolchain(prj, normal, true, true))
1000 ide.outputView.buildBox.Logf("Building project %s using the %s configuration...\n", prj.name, prj.configName);
1001 return Build(prj, buildType);
1006 bool ProjectLink(MenuItem selection, Modifiers mods)
1008 Project prj = project;
1009 if(selection || !ide.activeClient || activeClient == this)
1011 DataRow row = fileList.currentRow;
1012 ProjectNode node = row ? (ProjectNode)row.tag : null;
1013 if(node) prj = node.project;
1015 // Added this code here until dependencies work:
1016 else //if(ide.activeClient)
1018 ProjectNode node = GetNodeFromWindow(ide.activeClient, null);
1022 if(ProjectPrepareForToolchain(prj, normal, true, true))
1024 ide.outputView.buildBox.Logf("Relinking project %s using the %s configuration...\n", prj.name, prj.configName);
1026 prj.config.linkingModified = true;
1032 bool ProjectRebuild(MenuItem selection, Modifiers mods)
1034 Project prj = GetSelectedProject((bool)selection);
1035 if(ProjectPrepareForToolchain(prj, normal, true, true))
1037 ide.outputView.buildBox.Logf("Rebuilding project %s using the %s configuration...\n", prj.name, prj.configName);
1040 prj.config.compilingModified = true;
1041 prj.config.makingModified = true;
1042 }*/ // -- should this still be used depite the new solution of BuildType?
1043 Build(prj, rebuild);
1048 bool ProjectClean(MenuItem selection, Modifiers mods)
1050 Project prj = GetSelectedProject((bool)selection);
1051 if(ProjectPrepareForToolchain(prj, normal, true, true))
1053 ide.outputView.buildBox.Logf("Cleaning project %s using the %s configuration...\n", prj.name, prj.configName);
1055 buildInProgress = prj == project ? buildingMainProject : buildingSecondaryProject;
1056 ide.AdjustBuildMenus();
1059 buildInProgress = none;
1060 ide.AdjustBuildMenus();
1065 bool ProjectRegenerate(MenuItem selection, Modifiers mods)
1067 Project prj = project;
1068 if(selection || !ide.activeClient || activeClient == this)
1070 DataRow row = fileList.currentRow;
1071 ProjectNode node = row ? (ProjectNode)row.tag : null;
1075 // Added this code here until dependencies work:
1076 else //if(ide.activeClient)
1078 ProjectNode node = GetNodeFromWindow(ide.activeClient, null);
1083 ProjectPrepareMakefile(prj, force, true, true);
1087 bool ProjectNewFile(MenuItem selection, Modifiers mods)
1089 DataRow row = fileList.currentRow;
1092 char fileName[1024];
1093 char filePath[MAX_LOCATION];
1094 ProjectNode parentNode = (ProjectNode)row.tag;
1095 ProjectNode n, fileNode;
1096 parentNode.GetFileSysMatchingPath(filePath);
1097 MakePathRelative(filePath, parentNode.project.topNode.path, filePath);
1098 for(n = parentNode; n && n != parentNode.project.resNode; n = n.parent);
1099 sprintf(fileName, "Untitled %d", documentID);
1100 fileNode = AddFile(parentNode, fileName, (bool)n, true);
1101 fileNode.path = CopyUnixPath(filePath);
1104 NodeProperties nodeProperties
1107 position = { position.x + 100, position.y + 100 };
1111 nodeProperties.Create(); // not modal?
1117 bool ProjectNewFolder(MenuItem selection, Modifiers mods)
1119 DataRow row = fileList.currentRow;
1122 ProjectNode parentNode = (ProjectNode)row.tag;
1123 NewFolder(parentNode, null, true);
1128 bool ResourcesAddFiles(MenuItem selection, Modifiers mods)
1134 bool ProjectAddFiles(MenuItem selection, Modifiers mods)
1140 bool ProjectImportFolder(MenuItem selection, Modifiers mods)
1142 DataRow row = fileList.currentRow;
1145 ProjectNode toNode = (ProjectNode)row.tag;
1146 ImportFolder(toNode);
1151 bool ProjectAddNewForm(MenuItem selection, Modifiers mods)
1153 CodeEditor codeEditor = CreateNew("Form", "form", "Window", null);
1154 codeEditor.EnsureUpToDate();
1158 bool ProjectAddNewGraph(MenuItem selection, Modifiers mods)
1160 CodeEditor codeEditor = CreateNew("Graph", "graph", "Block", null);
1162 codeEditor.EnsureUpToDate();
1166 bool ProjectRemove(MenuItem selection, Modifiers mods)
1168 DataRow row = fileList.currentRow;
1171 ProjectNode node = (ProjectNode)row.tag;
1172 if(node.type == project)
1173 RemoveSelectedNodes();
1178 bool MenuConfig(MenuItem selection, Modifiers mods)
1180 if(ProjectActiveConfig { parent = parent.parent, master = parent, project = project }.Modal() == ok)
1185 bool MenuCompiler(MenuItem selection, Modifiers mods)
1187 ActiveCompilerDialog compilerDialog
1189 parent = parent.parent, master = parent;
1190 ideSettings = ideSettings, workspaceActiveCompiler = ide.workspace.compiler;
1192 incref compilerDialog;
1193 if(compilerDialog.Modal() == ok && strcmp(compilerDialog.workspaceActiveCompiler, ide.workspace.compiler))
1195 ide.workspace.compiler = compilerDialog.workspaceActiveCompiler;
1196 for(prj : ide.workspace.projects)
1197 ide.projectView.ProjectUpdateMakefileForAllConfigs(prj, true, true);
1199 delete compilerDialog;
1203 bool MenuSettings(MenuItem selection, Modifiers mods)
1205 ProjectNode node = GetSelectedNode(true);
1206 Project prj = node ? node.project : project;
1207 projectSettingsDialog = ProjectSettings { parent = parent.parent, master = parent, project = prj, projectNode = node };
1208 projectSettingsDialog.Modal();
1215 bool FileProperties(MenuItem selection, Modifiers mods)
1217 DataRow row = fileList.currentRow;
1220 ProjectNode node = (ProjectNode)row.tag;
1221 NodeProperties { parent = parent, master = this, node = node,
1222 position = { position.x + 100, position.y + 100 } }.Create();
1227 bool FileOpenFile(MenuItem selection, Modifiers mods)
1229 OpenSelectedNodes();
1233 bool FileRemoveFile(MenuItem selection, Modifiers mods)
1235 RemoveSelectedNodes();
1239 bool FileCompile(MenuItem selection, Modifiers mods)
1241 DataRow row = fileList.currentRow;
1244 ProjectNode node = (ProjectNode)row.tag;
1250 /*bool IsProjectModified()
1254 for(document = master.firstChild; document; document = document.next)
1256 if(document.modifiedDocument)
1257 if(GetNodeFromWindow(document), project)
1264 bool Build(Project prj, BuildType buildType)
1270 for(document = master.firstChild; document; document = document.next)
1272 if(document.modifiedDocument)
1274 ProjectNode node = GetNodeFromWindow(document, prj);
1275 if(node && !document.MenuFileSave(null, 0))
1284 DirExpression targetDir = prj.targetDir;
1286 // TOFIX: DebugStop is being abused and backfiring on us.
1287 // It's supposed to be the 'Debug/Stop' item, not unloading executable or anything else
1289 // configIsInDebugSession seems to be used for two OPPOSITE things:
1290 // If we're debugging another config, we need to unload the executable!
1291 // In building, we want to stop if we're debugging the 'same' executable
1292 if(buildType != run) ///* && prj == project*/ && prj.configIsInDebugSession)
1294 if(buildType == start || buildType == restart)
1296 if(ide.debugger && ide.debugger.isPrepared)
1303 if(ide.project == prj && ide.debugger && ide.debugger.prjConfig == prj.config && ide.debugger.isPrepared)
1310 // TODO: Disabled until problems fixed... is it fixed?
1311 if(buildType == rebuild || (prj.config && prj.config.compilingModified))
1315 if(buildType == relink || (prj.config && prj.config.linkingModified))
1317 char target[MAX_LOCATION];
1319 strcpy(target, prj.topNode.path);
1320 PathCat(target, targetDir.dir);
1321 prj.CatTargetFileName(target);
1322 if(FileExists(target))
1325 if(prj.config && prj.config.symbolGenModified)
1327 DirExpression objDir = prj.objDir;
1328 char fileName[MAX_LOCATION];
1329 char moduleName[MAX_FILENAME];
1330 strcpy(fileName, prj.topNode.path);
1331 PathCatSlash(fileName, objDir.dir);
1332 strcpy(moduleName, prj.moduleName);
1333 strcat(moduleName, ".main.ec");
1334 PathCatSlash(fileName, moduleName);
1335 if(FileExists(fileName))
1336 DeleteFile(fileName);
1337 ChangeExtension(fileName, "c", fileName);
1338 if(FileExists(fileName))
1339 DeleteFile(fileName);
1340 ChangeExtension(fileName, "o", fileName);
1341 if(FileExists(fileName))
1342 DeleteFile(fileName);
1347 buildInProgress = prj == project ? buildingMainProject : buildingSecondaryProject;
1348 ide.AdjustBuildMenus();
1349 if(buildType == start || buildType == restart) ide.AdjustDebugMenus();
1351 result = prj.Build(buildType == run, null);
1355 prj.config.compilingModified = false;
1356 if(!ide.ShouldStopBuild())
1357 prj.config.linkingModified = false;
1359 prj.config.symbolGenModified = false;
1361 buildInProgress = none;
1362 ide.AdjustBuildMenus();
1363 if(buildType == start || buildType == restart) ide.AdjustDebugMenus();
1365 ide.workspace.modified = true;
1372 Project GetSelectedProject(bool useSelection)
1374 Project prj = project;
1377 DataRow row = fileList.currentRow;
1378 ProjectNode node = row ? (ProjectNode)row.tag : null;
1385 ProjectNode GetSelectedNode(bool useSelection)
1387 ProjectNode node = null;
1390 DataRow row = fileList.currentRow;
1392 node = (ProjectNode)row.tag;
1397 bool MenuBrowseFolder(MenuItem selection, Modifiers mods)
1399 char folder[MAX_LOCATION];
1401 ProjectNode node = GetSelectedNode(true);
1403 node = project.topNode;
1406 strcpy(folder, prj.topNode.path);
1407 if(node != prj.topNode)
1408 PathCatSlash(folder, node.path);
1412 bool Run(MenuItem selection, Modifiers mods)
1414 char args[MAX_LOCATION * 64];
1416 if(ide.workspace.commandLineArgs)
1417 //ide.debugger.GetCommandLineArgs(args);
1418 strcpy(args, ide.workspace.commandLineArgs);
1419 if(ide.debugger.isActive)
1421 /*else if(project.config.targetType == sharedLibrary || project.config.targetType == staticLibrary)
1422 MessageBox { type = ok, text = "Run", contents = "Shared and static libraries cannot be run like executables." }.Modal();*/
1423 else if(BuildInterrim(project, run))
1430 bool result = false;
1431 if(project.targetType == sharedLibrary || project.targetType == staticLibrary)
1432 MessageBox { type = ok, text = "Run", contents = "Shared and static libraries cannot be run like executables." }.Modal();
1433 else if(project.compress)
1434 MessageBox { text = "Starting Debug", contents = "Debugging compressed applications is not supported\n" }.Modal();
1435 else if(project.debug ||
1436 MessageBox { type = okCancel, text = "Starting Debug", contents = "Attempting to debug non-debug configuration\nProceed anyways?" }.Modal() == ok)
1438 if(/*!IsProjectModified() ||*/ BuildInterrim(project, start))
1440 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
1441 if(compiler.type.isVC)
1443 //bool result = false;
1444 char oldwd[MAX_LOCATION];
1445 char oldPath[MAX_LOCATION * 65];
1446 char command[MAX_LOCATION];
1448 GetEnvironment("PATH", oldPath, sizeof(oldPath));
1449 ide.SetPath(false); //true
1451 GetWorkingDir(oldwd, sizeof(oldwd));
1452 ChangeWorkingDir(project.topNode.path);
1454 sprintf(command, "%s /useenv %s.sln /projectconfig \"%s|Win32\" /command \"%s\"" , "devenv", project.name, project.config.name, "Debug.Start");
1455 //ide.outputView.buildBox.Logf("command: %s\n", command);
1457 ChangeWorkingDir(oldwd);
1458 SetEnvironment("PATH", oldPath);
1462 ide.debugger.Start();
1474 if(/*!IsProjectModified() ||*/ BuildInterrim(project, restart))
1476 ide.debugger.Restart();
1484 ide.debugger.Resume();
1490 ide.debugger.Break();
1496 ide.debugger.Stop();
1500 bool DebugStepInto()
1502 if((ide.debugger.isActive) || (!buildInProgress && BuildInterrim(project, start)))
1503 ide.debugger.StepInto();
1507 bool DebugStepOver(bool skip)
1509 if((ide.debugger.isActive) || (!buildInProgress && BuildInterrim(project, start)))
1510 ide.debugger.StepOver(skip);
1514 bool DebugStepOut(bool skip)
1516 ide.debugger.StepOut(skip);
1520 void ImportFolder(ProjectNode toNode)
1524 //bool isFolder = toNode.type == folder;
1525 //bool isRes = toNode.isInResources;
1527 FileDialog fileDialog = importFileDialog;
1528 fileDialog.parent = parent;
1529 if(fileDialog.Modal() == ok)
1531 ImportFolderFSI fsi { projectView = this };
1532 fsi.stack.Add(toNode);
1533 fsi.Iterate(fileDialog.filePath);
1539 ProjectNode NewFolder(ProjectNode parentNode, char * name, bool showProperties)
1543 ProjectNode folderNode;
1544 Project prj = parentNode.project;
1546 ProjectNode after = null;
1547 for(node : parentNode.files)
1549 if(node.type != folder)
1555 folderNode = parentNode.Add(prj, name, after, folder, folder, true);
1558 for(c = 0; c < 100; c++)
1561 sprintf(string, c ? "New Folder (%d)" : "New Folder", c);
1562 if((folderNode = parentNode.Add(prj, string, after, folder, folder, true)))
1569 NodeProperties nodeProperties;
1572 modifiedDocument = true;
1573 prj.topNode.modified = true;
1576 folderNode.row = parentNode.row.AddRowAfter(after ? after.row : null);
1577 folderNode.row.tag = (int)folderNode;
1579 folderNode.row.SetData(null, folderNode);
1580 fileList.currentRow = folderNode.row;
1584 nodeProperties = NodeProperties
1586 parent, this, mode = newFolder, node = folderNode;
1587 position = { position.x + 100, position.y + 100 };
1589 nodeProperties.Create(); // Modal?
1597 void AddFiles(bool resources)
1599 FileDialog fileDialog = (!resources) ? this.fileDialog : resourceFileDialog;
1600 fileDialog.type = multiOpen;
1601 fileDialog.text = !resources ? "Add Files to Project" : "Add Resources to Project";
1602 fileDialog.parent = parent;
1603 if(fileDialog.Modal() == ok)
1606 DataRow row = fileList.currentRow;
1607 ProjectNode parentNode = (ProjectNode)row.tag;
1608 bool addFailed = false;
1609 int numSelections = fileDialog.numSelections;
1610 char ** multiFilePaths = fileDialog.multiFilePaths;
1612 Array<String> nameConflictFiles { };
1614 for(c = 0; c < numSelections; c++)
1616 char * filePath = multiFilePaths[c];
1617 FileAttribs exists = FileExists(filePath);
1618 bool addThisFile = true;
1620 if(exists.isDirectory)
1621 addThisFile = false;
1624 if(MessageBox { type = yesNo, parent = parent, master = this, text = filePath,
1625 contents = "File doesn't exist. Create?" }.Modal() == yes)
1627 File f = FileOpen(filePath, write);
1635 MessageBox { type = ok, parent = parent, master = this, text = filePath,
1636 contents = "Couldn't create file."}.Modal();
1637 addThisFile = false;
1644 /*addFailed = */if(!AddFile(parentNode, filePath, resources, false))//;
1646 nameConflictFiles.Add(CopyString(filePath));
1654 char * part1 = "The following file";
1655 char * opt1 = " was ";
1656 char * opt2 = "s were ";
1657 char * part2 = "not added because of identical file name conflict within the project.\n\n";
1659 len += strlen(part1);
1660 len += strlen(part2);
1661 len += nameConflictFiles.count > 1 ? strlen(opt2) : strlen(opt1);
1662 for(s : nameConflictFiles)
1663 len += strlen(s) + 1;
1664 message = new char[len + 1];
1665 strcpy(message, part1);
1666 strcat(message, nameConflictFiles.count > 1 ? opt2 : opt1);
1667 strcat(message, part2);
1668 for(s : nameConflictFiles)
1671 strcat(message, "\n");
1673 MessageBox { type = ok, parent = parent, master = this, text = "Name Conflict",
1674 contents = message }.Modal();
1677 nameConflictFiles.Free();
1678 delete nameConflictFiles;
1682 ProjectNode AddFile(ProjectNode parentNode, char * filePath, bool resources, bool isTemporary)
1684 ProjectNode result = null;
1685 ProjectNode after = null;
1686 for(node : parentNode.files)
1688 if(node.type != folder && node.type != file && node.type)
1693 result = parentNode.Add(parentNode.project, filePath, after, file, NodeIcons::SelectFileIcon(filePath), !resources);
1699 modifiedDocument = true;
1700 parentNode.project.topNode.modified = true;
1701 parentNode.project.ModifiedAllConfigs(true, false, true, true);
1704 result.row = parentNode.row.AddRowAfter(after ? after.row : null);
1705 result.row.tag = (int)result;
1706 result.row.SetData(null, result);
1711 CodeEditor CreateNew(char * upper, char * lower, char * base, char * className)
1713 CodeEditor codeEditor = null;
1714 ProjectNode projectNode;
1715 ProjectNode after = null;
1716 DataRow row = fileList.currentRow;
1717 ProjectNode parentNode;
1720 if(!row) row = project.topNode.row;
1722 parentNode = (ProjectNode)row.tag;
1724 for(node : parentNode.files)
1726 if(node.type != folder && node.type != file && node.type)
1730 for(c = 1; c < 100; c++)
1733 sprintf(string, c ? "%s%d.ec" : "%s.ec", lower, c);
1734 if((projectNode = parentNode.Add(project, string, after, file, genFile, true)))
1740 char filePath[MAX_LOCATION];
1742 modifiedDocument = true;
1743 project.topNode.modified = true;
1745 project.ModifiedAllConfigs(true, false, false, true);
1746 projectNode.row = parentNode.row.AddRowAfter(after ? after.row : null);
1747 projectNode.row.tag =(int)projectNode;
1749 projectNode.row.SetData(null, projectNode);
1750 fileList.currentRow = projectNode.row;
1752 strcpy(filePath, project.topNode.path);
1753 PathCat(filePath, projectNode.path);
1754 PathCat(filePath, projectNode.name);
1756 codeEditor = (CodeEditor)ide.FindWindow(filePath);
1759 Class baseClass = eSystem_FindClass(__thisModule, base);
1760 subclass(ClassDesignerBase) designerClass = eClass_GetDesigner(baseClass);
1763 codeEditor = (CodeEditor)ide.OpenFile(filePath, normal, false, null, whatever, normal);
1764 strcpy(name, projectNode.name);
1765 sprintf(name, "%s%d", upper, c);
1767 strcpy(className, name);
1769 designerClass.CreateNew(codeEditor.editBox, codeEditor.clientSize, name, base);
1771 //codeEditor.modifiedDocument = false;
1772 //codeEditor.designer.modifiedDocument = false;
1774 //Code_EnsureUpToDate(codeEditor);
1777 else // TODO: fix no symbols generated when ommiting {} for following else
1779 codeEditor = (CodeEditor)ide.OpenFile(filePath, normal, false, null, whatever, normal);
1783 codeEditor.ViewDesigner();
1784 codeEditor.codeModified = true;
1791 void OpenSelectedNodes()
1796 fileList.GetMultiSelection(selection);
1797 for(item = selection.first; item; item = item.next)
1799 DataRow row = item.data;
1800 ProjectNode node = (ProjectNode)row.tag;
1801 if(node.type == file)
1804 selection.Free(null);
1807 void RemoveSelectedNodes()
1812 fileList.GetMultiSelection(selection);
1814 // Remove children of parents we're deleting
1815 for(item = selection.first; item; item = next)
1818 DataRow row = item.data;
1819 ProjectNode n, node = (ProjectNode)row.tag;
1820 bool remove = false;
1823 for(i = selection.first; i && !remove; i = i.next)
1825 ProjectNode iNode = (ProjectNode)((DataRow)i.data).tag;
1826 for(n = node.parent; n; n = n.parent)
1836 selection.Delete(item);
1839 for(item = selection.first; item; item = item.next)
1841 DataRow row = item.data;
1842 ProjectNode node = (ProjectNode)row.tag;
1843 ProjectNode resNode;
1844 for(resNode = node.parent; resNode; resNode = resNode.parent)
1845 if(resNode.type == resources)
1847 if(node.type == file)
1849 Project prj = node.project;
1851 modifiedDocument = true;
1852 prj.topNode.modified = true;
1854 prj.ModifiedAllConfigs(true, false, true, true);
1856 else if(node.type == folder)
1859 sprintf(message, "Are you sure you want to remove the folder \"%s\"\n"
1860 "and all of its contents from the project?", node.name);
1861 if(MessageBox { type = yesNo, parent = parent, master = null,
1862 text = "Delete Folder", contents = message }.Modal() == yes)
1864 Project prj = node.project;
1865 if(node.containsFile)
1866 prj.ModifiedAllConfigs(true, false, true, true);
1868 modifiedDocument = true;
1869 prj.topNode.modified = true;
1872 else if(node.type == project && node != project.topNode && !buildInProgress)
1876 for(p : workspace.projects)
1878 if(p.topNode == node)
1884 sprintf(message, "Are you sure you want to remove the \"%s\" project\n" "from this workspace?", node.name);
1885 if(MessageBox { type = yesNo, parent = parent, master = null,
1886 text = "Remove Project", contents = message }.Modal() == yes)
1891 workspace.RemoveProject(prj);
1892 //modifiedDocument = true; // when project view is a workspace view
1896 selection.Free(null);