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 background = projectViewBackground;
222 foreground = projectViewText;
223 selectionColor = selectionColor, selectionText = selectionText;
224 stippleColor = skyBlue;
226 bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
228 if(!active) Update(null);
229 return ListBox::OnActivate(active, previous, goOnWithActivation, direct);
232 bool NotifyDoubleClick(ListBox listBox, int x, int y, Modifiers mods)
238 bool NotifyRightClick(ListBox listBox, int x, int y, Modifiers mods)
240 DataRow row = listBox.currentRow;
243 ProjectNode node = (ProjectNode)row.tag;
244 if(node.type == NodeTypes::project || node.type == resources || node.type == file || node.type == folder)
246 bool buildMenuUnavailable = buildInProgress;
248 Menu popupContent { };
250 if(node.type == NodeTypes::project)
252 //if(node == ((Project)workspace.projects.first).topNode)
254 MenuItem { popupContent, "Build", b, NotifySelect = ProjectBuild }.disabled = buildMenuUnavailable;
255 MenuItem { popupContent, "Relink", l, NotifySelect = ProjectLink }.disabled = buildMenuUnavailable;
256 MenuItem { popupContent, "Rebuild", r, NotifySelect = ProjectRebuild }.disabled = buildMenuUnavailable;
257 MenuItem { popupContent, "Clean", c, NotifySelect = ProjectClean }.disabled = buildMenuUnavailable;
258 MenuItem { popupContent, "Regenerate Makefile", m, NotifySelect = ProjectRegenerate }.disabled = buildMenuUnavailable;
259 MenuDivider { popupContent };
261 MenuItem { popupContent, "New File...", l, Key { l, ctrl = true }, NotifySelect = ProjectNewFile };
262 MenuItem { popupContent, "New Folder...", n, Key { f, ctrl = true }, NotifySelect = ProjectNewFolder };
263 MenuItem { popupContent, "Import Folder...", i, NotifySelect = ProjectImportFolder };
264 MenuItem { popupContent, "Add Files to Project...", f, NotifySelect = ProjectAddFiles };
265 MenuDivider { popupContent };
266 MenuItem { popupContent, "Add New Form...", o, NotifySelect = ProjectAddNewForm };
267 // MenuItem { popupContent, "Add New Behavior Graph...", g, NotifySelect = ProjectAddNewGraph };
268 MenuDivider { popupContent };
269 if(node != ((Project)workspace.projects.first).topNode)
271 MenuItem { popupContent, "Remove project from workspace", r, NotifySelect = ProjectRemove }.disabled = buildMenuUnavailable;
272 MenuDivider { popupContent };
274 MenuItem { popupContent, "Active Configuration...", s, Key { f5, alt = true } , NotifySelect = MenuConfig };
275 MenuItem { popupContent, "Settings...", s, Key { f7, alt = true } , NotifySelect = MenuSettings };
276 MenuDivider { popupContent };
277 MenuItem { popupContent, "Browse Folder", w, NotifySelect = MenuBrowseFolder };
278 MenuDivider { popupContent };
279 MenuItem { popupContent, "Save", v, Key { s, ctrl = true }, NotifySelect = ProjectSave }.disabled = !node.modified;
280 MenuDivider { popupContent };
281 MenuItem { popupContent, "Properties...", p, Key { enter, alt = true }, NotifySelect = FileProperties };
283 else if(node.type == resources)
285 MenuItem { popupContent, "New File...", l, Key { l, ctrl = true }, NotifySelect = ProjectNewFile };
286 MenuItem { popupContent, "New Folder...", n, Key { f, ctrl = true }, NotifySelect = ProjectNewFolder };
287 MenuItem { popupContent, "Add Resources to Project...", f, NotifySelect = ResourcesAddFiles };
288 MenuItem { popupContent, "Browse Folder", w, NotifySelect = MenuBrowseFolder };
289 MenuDivider { popupContent };
290 MenuItem { popupContent, "Settings...", s, Key { f7, alt = true } , NotifySelect = MenuSettings };
291 MenuItem { popupContent, "Properties...", p, Key { enter, alt = true }, NotifySelect = FileProperties };
293 else if(node.type == file)
295 MenuItem { popupContent, "Open", o, NotifySelect = FileOpenFile };
296 MenuItem { popupContent, "Compile", c, Key { f7, ctrl = true}, NotifySelect = FileCompile }.disabled = buildMenuUnavailable;
297 MenuDivider { popupContent };
298 MenuItem { popupContent, "Remove", r, NotifySelect = FileRemoveFile };
299 MenuDivider { popupContent };
300 MenuItem { popupContent, "Browse Folder", w, NotifySelect = MenuBrowseFolder };
301 MenuDivider { popupContent };
302 MenuItem { popupContent, "Settings...", s, Key { f7, alt = true } , NotifySelect = MenuSettings };
303 MenuItem { popupContent, "Properties..", p, Key { enter, alt = true }, NotifySelect = FileProperties };
305 else if(node.type == folder)
307 bool isInResources = node.isInResources;
309 MenuItem { popupContent, "New File...", l, Key { l, ctrl = true }, NotifySelect = ProjectNewFile };
310 MenuItem { popupContent, "New Folder...", n, Key { f, ctrl = true }, NotifySelect = ProjectNewFolder };
311 MenuItem { popupContent, "Import Folder...", i, NotifySelect = ProjectImportFolder };
314 MenuItem { popupContent, "Add Resources to Folder...", f, NotifySelect = ResourcesAddFiles };
318 MenuItem { popupContent, "Add Files to Folder...", f, NotifySelect = ProjectAddFiles };
322 MenuDivider { popupContent };
323 MenuItem { popupContent, "Add New Form...", o, NotifySelect = ProjectAddNewForm };
324 MenuItem { popupContent, "Add New Behavior Graph...", g, NotifySelect = ProjectAddNewGraph };
326 MenuDivider { popupContent };
327 MenuItem { popupContent, "Remove", r, NotifySelect = FileRemoveFile };
328 MenuDivider { popupContent };
329 MenuItem { popupContent, "Browse Folder", w, NotifySelect = MenuBrowseFolder };
330 MenuDivider { popupContent };
331 MenuItem { popupContent, "Settings...", s, Key { f7, alt = true } , NotifySelect = MenuSettings };
332 MenuItem { popupContent, "Properties...", p, Key { enter, alt = true }, NotifySelect = FileProperties };
337 master = this, menu = popupContent;
339 x + clientStart.x + absPosition.x - app.desktop.position.x,
340 y + clientStart.y + absPosition.y - app.desktop.position.y };
348 bool NotifyKeyDown(ListBox listBox, DataRow row, Key key, unichar ch)
352 ProjectNode node = (ProjectNode)row.tag;
355 case altEnter: case Key { keyPadEnter, alt = true }:
357 NodeProperties { parent = parent, master = this,
358 position = { position.x + 100, position.y + 100 }, node = node }.Create();
361 case enter: case keyPadEnter:
364 for(resNode = node.parent; resNode; resNode = resNode.parent)
365 if(resNode.type == resources)
367 if(node.type == project || (node.type == folder && !resNode))
372 else if(node.type == resources || node.type == folder)
381 if(node.type == project || node.type == folder || node.type == resources)
390 if(node.type == project || node.type == folder || node.type == resources)
392 NewFolder(node, null, true);
399 if(node.type == file)
401 FileCompile(null, (Modifiers)key);
406 case Key { space, shift = true }:
409 if(node.type == NodeTypes::project)
412 for(p : workspace.projects)
414 if(p.topNode == node)
420 prj.RotateActiveConfig(!key.shift);
431 case enter: case keyPadEnter: OpenSelectedNodes(); break;
432 case del: RemoveSelectedNodes(); break;
435 Window activeClient = ide.activeClient;
437 activeClient.Activate();
439 ide.RepositionWindows(true);
446 bool NotifyCollapse(ListBox listBox, DataRow row, bool collapsed)
448 ProjectNode node = (ProjectNode)row.tag;
449 if(node.type == folder)
450 node.icon = collapsed ? folder : openFolder;
455 FileDialog importFileDialog { autoCreate = false, type = selectDir, text = "Import Folder" };
456 FileDialog projectFileDialog
458 autoCreate = false, filters = projectFilters, sizeFilters = sizeof(projectFilters);
459 types = projectTypes, sizeTypes = sizeof(projectTypes);
461 FileDialog fileDialog
463 autoCreate = false, mayNotExist = true, filters = fileFilters, sizeFilters = sizeof(fileFilters);
464 types = fileTypes, sizeTypes = sizeof(fileTypes);
466 FileDialog resourceFileDialog
468 autoCreate = false, mayNotExist = true, filters = resourceFilters, sizeFilters = sizeof(resourceFilters);
469 types = fileTypes, sizeTypes = sizeof(fileTypes);
472 Menu fileMenu { menu, "File", f };
473 MenuItem { fileMenu, "Save", s, Key { s, ctrl = true }, NotifySelect = MenuFileSave };
474 // MenuItem { fileMenu, "Save As...", a, NotifySelect = MenuFileSaveAs };
476 bool OnClose(bool parentClosing)
478 if(!parentClosing && visible)
490 //if(ide.findInFilesDialog && ide.findInFilesDialog.created && ide.findInFilesDialog.mode != directory)
491 // ide.findInFilesDialog.SearchStop();
493 ide.outputView.buildBox.Clear();
494 ide.outputView.debugBox.Clear();
495 //ide.outputView.findBox.Clear();
496 ide.callStackView.Clear();
497 ide.watchesView.Clear();
498 ide.threadsView.Clear();
499 ide.breakpointsView.Clear();
500 ide.outputView.ShowClearSelectTab(find); // why this?
503 bool OnSaveFile(char * fileName)
505 for(prj : ide.workspace.projects)
507 if(prj.topNode.modified && prj.Save(prj.filePath))
509 // ProjectUpdateMakefileForAllConfigs(prj, true, true);
510 prj.topNode.modified = false;
513 modifiedDocument = false;
518 bool IsModuleInProject(char * filePath)
520 char moduleName[MAX_FILENAME]; //, modulePath[MAX_LOCATION];
521 GetLastDirectory(filePath, moduleName);
522 return project.topNode.Find(moduleName, false) != null;
525 bool GetRelativePath(char * filePath, char * relativePath)
528 char moduleName[MAX_FILENAME]; //, modulePath[MAX_LOCATION];
529 GetLastDirectory(filePath, moduleName);
531 // try with workspace dir first?
532 if((node = project.topNode.Find(moduleName, false)))
534 strcpy(relativePath, node.path);
535 PathCatSlash(relativePath, node.name);
538 // WARNING: On failure, relative path is uninitialized
540 return project.GetRelativePath(filePath, relativePath);
543 ProjectNode GetNodeFromWindow(Window document, Project project)
545 if(document.fileName)
547 char winFileName[MAX_LOCATION];
548 char * documentFileName = GetSlashPathBuffer(winFileName, document.fileName);
549 for(p : ide.workspace.projects)
551 Project prj = project ? project : p;
553 char moduleName[MAX_FILENAME], modulePath[MAX_LOCATION];
554 GetLastDirectory(document.fileName, moduleName);
556 if((node = prj.topNode.Find(moduleName, false)))
558 strcpy(modulePath, prj.topNode.path);
559 PathCatSlash(modulePath, node.path);
560 PathCatSlash(modulePath, node.name);
561 if(!fstrcmp(documentFileName, modulePath))
572 void Compile(ProjectNode node)
574 char fileName[MAX_LOCATION];
575 char extension[MAX_EXTENSION];
577 Project prj = node.project;
578 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
579 DirExpression objDir = prj.objDir;
581 strcpy(fileName, prj.topNode.path);
582 PathCatSlash(fileName, objDir.dir);
583 PathCatSlash(fileName, node.name);
584 StripExtension(fileName);
585 strcat(fileName, ".o");
586 if(FileExists(fileName))
587 DeleteFile(fileName);
589 GetExtension(node.name, extension);
590 if(!strcmp(extension, "ec"))
592 // Delete generated C file
593 strcpy(fileName, prj.topNode.path);
594 PathCat(fileName, objDir.dir);
595 PathCat(fileName, node.name);
596 StripExtension(fileName);
597 strcat(fileName, ".c");
598 if(FileExists(fileName))
599 DeleteFile(fileName);
601 // Delete symbol file
602 strcpy(fileName, prj.topNode.path);
603 PathCat(fileName, node.path);
604 PathCat(fileName, node.name);
605 StripExtension(fileName);
606 strcat(fileName, ".sym");
607 if(FileExists(fileName))
608 DeleteFile(fileName);
613 // Check if we have to save
614 strcpy(fileName, prj.topNode.path);
615 PathCatSlash(fileName, node.path);
616 PathCatSlash(fileName, node.name);
617 for(document = ide.firstChild; document; document = document.next)
619 if(document.modifiedDocument)
621 char documentFileName[MAX_LOCATION];
622 if(!fstrcmp(GetSlashPathBuffer(documentFileName, document.fileName), fileName))
623 if(!document.MenuFileSave(null, 0))
628 if(ProjectPrepareForToolchain(prj, normal, true, true))
632 buildInProgress = compilingFile;
633 ide.AdjustBuildMenus();
635 //ide.outputView.ShowClearSelectTab(build);
636 // this stuff doesn't even appear
637 //ide.outputView.buildBox.Logf("%s Compiler\n", compiler.name);
639 ide.outputView.buildBox.Logf("Compiling single file %s in project %s using the %s configuration...\n", node.name, prj.name, prj.config.name);
641 ide.outputView.buildBox.Logf("Compiling single file %s in project %s...\n", node.name, prj.name);
644 buildInProgress = none;
645 ide.AdjustBuildMenus();
648 ide.outputView.buildBox.Logf("File %s is excluded from current build configuration.\n", node.name);
654 void GoToError(const char * line)
658 while(isspace(*line)) line++;
659 colon = strstr(line, ":");
664 bool lookForLineNumber = true;
666 // deal with linking error
667 if(colon && colon[1] == ' ')
669 colon = strstr(colon + 1, ":");
670 if(colon && !colon[1])
672 colon = strstr(line, ":");
673 lookForLineNumber = false;
675 else if(colon && !isdigit(colon[1]))
678 colon = strstr(line, ":");
681 // Don't be mistaken by the drive letter colon
682 if(colon && (colon[1] == '/' || colon[1] == '\\'))
683 colon = strstr(colon + 1, ":");
684 if(colon && lookForLineNumber)
688 char * par = RSearchString(line, "(", colon - line, true, false);
689 if(par && strstr(par, ")"))
691 else if((colon+1)[0] == ' ')
693 // NOTE: This is the same thing as saying 'colon = line'
694 for( ; colon != line; colon--)
698 lineNumber = atoi(colon + 1);
700 comma = strchr(colon, ',');
704 comma = strchr(colon+1, ':');
710 char moduleName[MAX_LOCATION], filePath[MAX_LOCATION];
715 strncpy(moduleName, line, colon - line);
716 moduleName[colon - line] = '\0';
719 strcpy(moduleName, line);
721 // Remove stuff in brackets
723 bracket = strstr(moduleName, "(");
724 if(bracket) *bracket = '\0';
726 MakeSlashPath(moduleName);
730 // Check if it's one of our modules
731 ProjectNode node = project.topNode.Find(moduleName, false);
734 strcpy(moduleName, node.path);
735 PathCatSlash(moduleName, node.name);
738 moduleName[0] = '\0';
742 CodeEditor codeEditor;
743 strcpy(filePath, project.topNode.path);
744 PathCatSlash(filePath, moduleName);
746 codeEditor = (CodeEditor)ide.OpenFile(filePath, normal, true, null, no, normal);
749 char name[MAX_LOCATION];
750 // TOFIX: Improve on this, don't use only filename, make a function
751 if(ide && ide.workspace)
753 for(prj : ide.workspace.projects)
755 if(prj.topNode.FindWithPath(moduleName, false))
757 strcpy(filePath, prj.topNode.path);
758 PathCatSlash(filePath, moduleName);
759 codeEditor = (CodeEditor)ide.OpenFile(filePath, normal, true, null, no, normal);
766 if(codeEditor && lineNumber)
768 EditBox editBox = codeEditor.editBox;
769 editBox.GoToLineNum(lineNumber - 1);
770 editBox.GoToPosition(editBox.line, lineNumber - 1, col ? (col - 1) : 0);
777 bool OpenNode(ProjectNode node)
779 char filePath[MAX_LOCATION];
780 node.GetFullFilePath(filePath);
781 return ide.OpenFile(filePath, normal, true/*false Why was it opening hidden?*/, null, something, normal) ? true : false;
784 void AddNode(ProjectNode node, DataRow addTo)
786 DataRow row = addTo ? addTo.AddRow() : fileList.AddRow();
791 if(node.type == resources)
794 row.SetData(null, node);
796 if(node.files && node.files.first && node.parent &&
797 !(!node.parent.parent &&
798 (!strcmpi(node.name, "notes") || !strcmpi(node.name, "sources") ||
799 !strcmpi(node.name, "src") || !strcmpi(node.name, "tools"))))
800 row.collapsed = true;
801 else if(node.type == folder)
802 node.icon = openFolder;
806 for(child : node.files)
811 void DeleteNode(ProjectNode projectNode)
813 if(projectNode.files)
816 while(child = projectNode.files.first)
819 fileList.DeleteRow(projectNode.row);
820 projectNode.Delete();
826 for(c = 0; c < NodeIcons::enumSize; c++)
828 icons[c] = BitmapResource { iconNames[c], alphaBlend = true };
829 AddResource(icons[c]);
831 fileList.AddField(DataField { dataType = class(ProjectNode), freeData = false, userData = this });
837 ide.DestroyTemporaryProjectDir();
845 bool ProjectSave(MenuItem selection, Modifiers mods)
847 DataRow row = fileList.currentRow;
848 ProjectNode node = row ? (ProjectNode)row.tag : null;
849 Project prj = node ? node.project : null;
852 if(prj.Save(prj.filePath))
854 // ProjectUpdateMakefileForAllConfigs(prj, true, true);
855 prj.topNode.modified = false;
857 for(p : ide.workspace.projects)
859 if(p.topNode.modified)
866 modifiedDocument = false;
873 bool ShowOutputBuildLog(bool cleanLog)
875 OutputView output = ide.outputView;
877 output.ShowClearSelectTab(build);
880 output.SelectTab(build);
885 bool DisplayCompiler(bool cleanLog)
887 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
888 LogBox logBox = ide.outputView.buildBox;
889 ShowOutputBuildLog(cleanLog);
890 logBox.Logf("%s Compiler\n", compiler ? compiler.name : "{problem with compiler selection}");
894 bool ProjectUpdateMakefileForAllConfigs(Project project, bool cleanLog, bool displayCompiler)
896 ProjectConfig currentConfig = project.config;
897 ShowOutputBuildLog(cleanLog);
900 DisplayCompiler(false);
902 for(config : project.configurations)
904 project.config = config;
905 ProjectPrepareMakefile(project, forceExists, false, false);
908 project.config = currentConfig;
913 bool ProjectPrepareForToolchain(Project project, PrepareMakefileMethod method, bool cleanLog, bool displayCompiler)
916 char message[MAX_F_STRING];
917 LogBox logBox = ide.outputView.buildBox;
919 ShowOutputBuildLog(cleanLog);
922 DisplayCompiler(false);
924 ProjectPrepareMakefile(project, method, false, false);
928 bool ProjectPrepareMakefile(Project project, PrepareMakefileMethod method, bool cleanLog, bool displayCompiler)
930 char makefilePath[MAX_LOCATION];
931 char makefileName[MAX_LOCATION];
933 LogBox logBox = ide.outputView.buildBox;
935 ShowOutputBuildLog(cleanLog);
938 DisplayCompiler(false);
940 strcpy(makefilePath, project.topNode.path);
941 project.CatMakeFileName(makefileName);
942 PathCatSlash(makefilePath, makefileName);
944 exists = FileExists(makefilePath);
945 if((method == normal && (!exists || project.config.makingModified/*|| project.topNode.modified*/)) ||
946 (method == forceExists && exists) ||
947 method == force) // || project.config.makingModified || makefileDirty
951 ide.statusBar.text = "Generating Makefile & Dependencies..."; // Dependencies?
954 if((method == normal && !exists) || (method == force && !exists))
955 action = "Generating ";
956 else if(method == force)
957 action = "Regenerating ";
958 else if(method == normal || method == forceExists)
959 action = "Updating ";
963 reason = "Makefile doesn't exist. ";
964 else if(project.topNode.modified)
965 reason = "Project has been modified. ";
969 //logBox.Logf("%s\n", makefileName);
970 logBox.Logf("%s - %s%smakefile for %s config...\n", makefileName, reason, action, project.configName);
971 project.GenerateMakefile(null, false, null);
973 ide.statusBar.text = null;
980 bool ProjectBuild(MenuItem selection, Modifiers mods)
982 Project prj = project;
983 if(selection || !ide.activeClient || activeClient == this)
985 DataRow row = fileList.currentRow;
986 ProjectNode node = row ? (ProjectNode)row.tag : null;
987 if(node) prj = node.project;
989 // Added this code here until dependencies work:
990 else //if(ide.activeClient)
992 ProjectNode node = GetNodeFromWindow(ide.activeClient, null);
996 if(/*prj != project || */!prj.configIsInDebugSession || !ide.DontTerminateDebugSession("Project Build"))
997 BuildInterrim(prj, build);
1001 bool BuildInterrim(Project prj, BuildType buildType)
1003 if(ProjectPrepareForToolchain(prj, normal, true, true))
1005 ide.outputView.buildBox.Logf("Building project %s using the %s configuration...\n", prj.name, prj.configName);
1006 return Build(prj, buildType);
1011 bool ProjectLink(MenuItem selection, Modifiers mods)
1013 Project prj = project;
1014 if(selection || !ide.activeClient || activeClient == this)
1016 DataRow row = fileList.currentRow;
1017 ProjectNode node = row ? (ProjectNode)row.tag : null;
1018 if(node) prj = node.project;
1020 // Added this code here until dependencies work:
1021 else //if(ide.activeClient)
1023 ProjectNode node = GetNodeFromWindow(ide.activeClient, null);
1027 if(ProjectPrepareForToolchain(prj, normal, true, true))
1029 ide.outputView.buildBox.Logf("Relinking project %s using the %s configuration...\n", prj.name, prj.configName);
1031 prj.config.linkingModified = true;
1037 bool ProjectRebuild(MenuItem selection, Modifiers mods)
1039 Project prj = GetSelectedProject((bool)selection);
1040 if(ProjectPrepareForToolchain(prj, normal, true, true))
1042 ide.outputView.buildBox.Logf("Rebuilding project %s using the %s configuration...\n", prj.name, prj.configName);
1045 prj.config.compilingModified = true;
1046 prj.config.makingModified = true;
1047 }*/ // -- should this still be used depite the new solution of BuildType?
1048 Build(prj, rebuild);
1053 bool ProjectClean(MenuItem selection, Modifiers mods)
1055 Project prj = GetSelectedProject((bool)selection);
1056 if(ProjectPrepareForToolchain(prj, normal, true, true))
1058 ide.outputView.buildBox.Logf("Cleaning project %s using the %s configuration...\n", prj.name, prj.configName);
1060 buildInProgress = prj == project ? buildingMainProject : buildingSecondaryProject;
1061 ide.AdjustBuildMenus();
1064 buildInProgress = none;
1065 ide.AdjustBuildMenus();
1070 bool ProjectRegenerate(MenuItem selection, Modifiers mods)
1072 Project prj = project;
1073 if(selection || !ide.activeClient || activeClient == this)
1075 DataRow row = fileList.currentRow;
1076 ProjectNode node = row ? (ProjectNode)row.tag : null;
1080 // Added this code here until dependencies work:
1081 else //if(ide.activeClient)
1083 ProjectNode node = GetNodeFromWindow(ide.activeClient, null);
1088 ProjectPrepareMakefile(prj, force, true, true);
1092 bool ProjectNewFile(MenuItem selection, Modifiers mods)
1094 DataRow row = fileList.currentRow;
1097 char fileName[1024];
1098 char filePath[MAX_LOCATION];
1099 ProjectNode parentNode = (ProjectNode)row.tag;
1100 ProjectNode n, fileNode;
1101 parentNode.GetFileSysMatchingPath(filePath);
1102 MakePathRelative(filePath, parentNode.project.topNode.path, filePath);
1103 for(n = parentNode; n && n != parentNode.project.resNode; n = n.parent);
1104 sprintf(fileName, "Untitled %d", documentID);
1105 fileNode = AddFile(parentNode, fileName, (bool)n, true);
1106 fileNode.path = CopyUnixPath(filePath);
1109 NodeProperties nodeProperties
1112 position = { position.x + 100, position.y + 100 };
1116 nodeProperties.Create(); // not modal?
1122 bool ProjectNewFolder(MenuItem selection, Modifiers mods)
1124 DataRow row = fileList.currentRow;
1127 ProjectNode parentNode = (ProjectNode)row.tag;
1128 NewFolder(parentNode, null, true);
1133 bool ResourcesAddFiles(MenuItem selection, Modifiers mods)
1139 bool ProjectAddFiles(MenuItem selection, Modifiers mods)
1145 bool ProjectImportFolder(MenuItem selection, Modifiers mods)
1147 DataRow row = fileList.currentRow;
1150 ProjectNode toNode = (ProjectNode)row.tag;
1151 ImportFolder(toNode);
1156 bool ProjectAddNewForm(MenuItem selection, Modifiers mods)
1158 CodeEditor codeEditor = CreateNew("Form", "form", "Window", null);
1159 codeEditor.EnsureUpToDate();
1163 bool ProjectAddNewGraph(MenuItem selection, Modifiers mods)
1165 CodeEditor codeEditor = CreateNew("Graph", "graph", "Block", null);
1167 codeEditor.EnsureUpToDate();
1171 bool ProjectRemove(MenuItem selection, Modifiers mods)
1173 DataRow row = fileList.currentRow;
1176 ProjectNode node = (ProjectNode)row.tag;
1177 if(node.type == project)
1178 RemoveSelectedNodes();
1183 bool MenuConfig(MenuItem selection, Modifiers mods)
1185 if(ProjectActiveConfig { parent = parent.parent, master = parent, project = project }.Modal() == ok)
1190 bool MenuCompiler(MenuItem selection, Modifiers mods)
1192 ActiveCompilerDialog compilerDialog
1194 parent = parent.parent, master = parent;
1195 ideSettings = ideSettings, workspaceActiveCompiler = ide.workspace.compiler;
1197 incref compilerDialog;
1198 if(compilerDialog.Modal() == ok && strcmp(compilerDialog.workspaceActiveCompiler, ide.workspace.compiler))
1200 ide.workspace.compiler = compilerDialog.workspaceActiveCompiler;
1201 for(prj : ide.workspace.projects)
1202 ide.projectView.ProjectUpdateMakefileForAllConfigs(prj, true, true);
1204 delete compilerDialog;
1208 bool MenuSettings(MenuItem selection, Modifiers mods)
1210 ProjectNode node = GetSelectedNode(true);
1211 Project prj = node ? node.project : project;
1212 projectSettingsDialog = ProjectSettings { parent = parent.parent, master = parent, project = prj, projectNode = node };
1213 projectSettingsDialog.Modal();
1220 bool FileProperties(MenuItem selection, Modifiers mods)
1222 DataRow row = fileList.currentRow;
1225 ProjectNode node = (ProjectNode)row.tag;
1226 NodeProperties { parent = parent, master = this, node = node,
1227 position = { position.x + 100, position.y + 100 } }.Create();
1232 bool FileOpenFile(MenuItem selection, Modifiers mods)
1234 OpenSelectedNodes();
1238 bool FileRemoveFile(MenuItem selection, Modifiers mods)
1240 RemoveSelectedNodes();
1244 bool FileCompile(MenuItem selection, Modifiers mods)
1246 DataRow row = fileList.currentRow;
1249 ProjectNode node = (ProjectNode)row.tag;
1255 /*bool IsProjectModified()
1259 for(document = master.firstChild; document; document = document.next)
1261 if(document.modifiedDocument)
1262 if(GetNodeFromWindow(document), project)
1269 bool Build(Project prj, BuildType buildType)
1275 for(document = master.firstChild; document; document = document.next)
1277 if(document.modifiedDocument)
1279 ProjectNode node = GetNodeFromWindow(document, prj);
1280 if(node && !document.MenuFileSave(null, 0))
1289 DirExpression targetDir = prj.targetDir;
1291 // TOFIX: DebugStop is being abused and backfiring on us.
1292 // It's supposed to be the 'Debug/Stop' item, not unloading executable or anything else
1294 // configIsInDebugSession seems to be used for two OPPOSITE things:
1295 // If we're debugging another config, we need to unload the executable!
1296 // In building, we want to stop if we're debugging the 'same' executable
1297 if(buildType != run) ///* && prj == project*/ && prj.configIsInDebugSession)
1299 if(buildType == start || buildType == restart)
1301 if(ide.debugger && ide.debugger.isPrepared)
1308 if(ide.project == prj && ide.debugger && ide.debugger.prjConfig == prj.config && ide.debugger.isPrepared)
1315 // TODO: Disabled until problems fixed... is it fixed?
1316 if(buildType == rebuild || (prj.config && prj.config.compilingModified))
1320 if(buildType == relink || (prj.config && prj.config.linkingModified))
1322 char target[MAX_LOCATION];
1324 strcpy(target, prj.topNode.path);
1325 PathCat(target, targetDir.dir);
1326 prj.CatTargetFileName(target);
1327 if(FileExists(target))
1330 if(prj.config && prj.config.symbolGenModified)
1332 DirExpression objDir = prj.objDir;
1333 char fileName[MAX_LOCATION];
1334 char moduleName[MAX_FILENAME];
1335 strcpy(fileName, prj.topNode.path);
1336 PathCatSlash(fileName, objDir.dir);
1337 strcpy(moduleName, prj.moduleName);
1338 strcat(moduleName, ".main.ec");
1339 PathCatSlash(fileName, moduleName);
1340 if(FileExists(fileName))
1341 DeleteFile(fileName);
1342 ChangeExtension(fileName, "c", fileName);
1343 if(FileExists(fileName))
1344 DeleteFile(fileName);
1345 ChangeExtension(fileName, "o", fileName);
1346 if(FileExists(fileName))
1347 DeleteFile(fileName);
1352 buildInProgress = prj == project ? buildingMainProject : buildingSecondaryProject;
1353 ide.AdjustBuildMenus();
1354 ide.AdjustDebugMenus();
1356 result = prj.Build(buildType == run, null);
1360 prj.config.compilingModified = false;
1361 if(!ide.ShouldStopBuild())
1362 prj.config.linkingModified = false;
1364 prj.config.symbolGenModified = false;
1366 buildInProgress = none;
1367 ide.AdjustBuildMenus();
1368 ide.AdjustDebugMenus();
1370 ide.workspace.modified = true;
1377 Project GetSelectedProject(bool useSelection)
1379 Project prj = project;
1382 DataRow row = fileList.currentRow;
1383 ProjectNode node = row ? (ProjectNode)row.tag : null;
1390 ProjectNode GetSelectedNode(bool useSelection)
1392 ProjectNode node = null;
1395 DataRow row = fileList.currentRow;
1397 node = (ProjectNode)row.tag;
1402 bool MenuBrowseFolder(MenuItem selection, Modifiers mods)
1404 char folder[MAX_LOCATION];
1406 ProjectNode node = GetSelectedNode(true);
1408 node = project.topNode;
1411 strcpy(folder, prj.topNode.path);
1412 if(node != prj.topNode)
1413 PathCatSlash(folder, node.path);
1417 bool Run(MenuItem selection, Modifiers mods)
1419 char args[MAX_LOCATION * 64];
1421 if(ide.workspace.commandLineArgs)
1422 //ide.debugger.GetCommandLineArgs(args);
1423 strcpy(args, ide.workspace.commandLineArgs);
1424 if(ide.debugger.isActive)
1426 /*else if(project.config.targetType == sharedLibrary || project.config.targetType == staticLibrary)
1427 MessageBox { type = ok, text = "Run", contents = "Shared and static libraries cannot be run like executables." }.Modal();*/
1428 else if(BuildInterrim(project, run))
1435 bool result = false;
1436 if(project.targetType == sharedLibrary || project.targetType == staticLibrary)
1437 MessageBox { type = ok, text = "Run", contents = "Shared and static libraries cannot be run like executables." }.Modal();
1438 else if(project.compress)
1439 MessageBox { text = "Starting Debug", contents = "Debugging compressed applications is not supported\n" }.Modal();
1440 else if(project.debug ||
1441 MessageBox { type = okCancel, text = "Starting Debug", contents = "Attempting to debug non-debug configuration\nProceed anyways?" }.Modal() == ok)
1443 if(/*!IsProjectModified() ||*/ BuildInterrim(project, start))
1445 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
1446 if(compiler.type.isVC)
1448 //bool result = false;
1449 char oldwd[MAX_LOCATION];
1450 char oldPath[MAX_LOCATION * 65];
1451 char command[MAX_LOCATION];
1453 GetEnvironment("PATH", oldPath, sizeof(oldPath));
1454 ide.SetPath(false); //true
1456 GetWorkingDir(oldwd, sizeof(oldwd));
1457 ChangeWorkingDir(project.topNode.path);
1459 sprintf(command, "%s /useenv %s.sln /projectconfig \"%s|Win32\" /command \"%s\"" , "devenv", project.name, project.config.name, "Debug.Start");
1460 //ide.outputView.buildBox.Logf("command: %s\n", command);
1462 ChangeWorkingDir(oldwd);
1463 SetEnvironment("PATH", oldPath);
1467 ide.debugger.Start();
1479 if(/*!IsProjectModified() ||*/ BuildInterrim(project, restart))
1481 ide.debugger.Restart();
1489 ide.debugger.Resume();
1495 ide.debugger.Break();
1501 ide.debugger.Stop();
1505 bool DebugStepInto()
1507 if((ide.debugger.isActive) || (!buildInProgress && BuildInterrim(project, start)))
1508 ide.debugger.StepInto();
1512 bool DebugStepOver(bool skip)
1514 if((ide.debugger.isActive) || (!buildInProgress && BuildInterrim(project, start)))
1515 ide.debugger.StepOver(skip);
1519 bool DebugStepOut(bool skip)
1521 ide.debugger.StepOut(skip);
1525 void ImportFolder(ProjectNode toNode)
1529 //bool isFolder = toNode.type == folder;
1530 //bool isRes = toNode.isInResources;
1532 FileDialog fileDialog = importFileDialog;
1533 fileDialog.parent = parent;
1534 if(fileDialog.Modal() == ok)
1536 ImportFolderFSI fsi { projectView = this };
1537 fsi.stack.Add(toNode);
1538 fsi.Iterate(fileDialog.filePath);
1544 ProjectNode NewFolder(ProjectNode parentNode, char * name, bool showProperties)
1548 ProjectNode folderNode;
1549 Project prj = parentNode.project;
1551 ProjectNode after = null;
1552 for(node : parentNode.files)
1554 if(node.type != folder)
1560 folderNode = parentNode.Add(prj, name, after, folder, folder, true);
1563 for(c = 0; c < 100; c++)
1566 sprintf(string, c ? "New Folder (%d)" : "New Folder", c);
1567 if((folderNode = parentNode.Add(prj, string, after, folder, folder, true)))
1574 NodeProperties nodeProperties;
1577 modifiedDocument = true;
1578 prj.topNode.modified = true;
1581 folderNode.row = parentNode.row.AddRowAfter(after ? after.row : null);
1582 folderNode.row.tag = (int)folderNode;
1584 folderNode.row.SetData(null, folderNode);
1585 fileList.currentRow = folderNode.row;
1589 nodeProperties = NodeProperties
1591 parent, this, mode = newFolder, node = folderNode;
1592 position = { position.x + 100, position.y + 100 };
1594 nodeProperties.Create(); // Modal?
1602 void AddFiles(bool resources)
1604 FileDialog fileDialog = (!resources) ? this.fileDialog : resourceFileDialog;
1605 fileDialog.type = multiOpen;
1606 fileDialog.text = !resources ? "Add Files to Project" : "Add Resources to Project";
1607 fileDialog.parent = parent;
1608 if(fileDialog.Modal() == ok)
1611 DataRow row = fileList.currentRow;
1612 ProjectNode parentNode = (ProjectNode)row.tag;
1613 bool addFailed = false;
1614 int numSelections = fileDialog.numSelections;
1615 char ** multiFilePaths = fileDialog.multiFilePaths;
1617 Array<String> nameConflictFiles { };
1619 for(c = 0; c < numSelections; c++)
1621 char * filePath = multiFilePaths[c];
1622 FileAttribs exists = FileExists(filePath);
1623 bool addThisFile = true;
1625 if(exists.isDirectory)
1626 addThisFile = false;
1629 if(MessageBox { type = yesNo, parent = parent, master = this, text = filePath,
1630 contents = "File doesn't exist. Create?" }.Modal() == yes)
1632 File f = FileOpen(filePath, write);
1640 MessageBox { type = ok, parent = parent, master = this, text = filePath,
1641 contents = "Couldn't create file."}.Modal();
1642 addThisFile = false;
1649 /*addFailed = */if(!AddFile(parentNode, filePath, resources, false))//;
1651 nameConflictFiles.Add(CopyString(filePath));
1659 char * part1 = "The following file";
1660 char * opt1 = " was ";
1661 char * opt2 = "s were ";
1662 char * part2 = "not added because of identical file name conflict within the project.\n\n";
1664 len += strlen(part1);
1665 len += strlen(part2);
1666 len += nameConflictFiles.count > 1 ? strlen(opt2) : strlen(opt1);
1667 for(s : nameConflictFiles)
1668 len += strlen(s) + 1;
1669 message = new char[len + 1];
1670 strcpy(message, part1);
1671 strcat(message, nameConflictFiles.count > 1 ? opt2 : opt1);
1672 strcat(message, part2);
1673 for(s : nameConflictFiles)
1676 strcat(message, "\n");
1678 MessageBox { type = ok, parent = parent, master = this, text = "Name Conflict",
1679 contents = message }.Modal();
1682 nameConflictFiles.Free();
1683 delete nameConflictFiles;
1687 ProjectNode AddFile(ProjectNode parentNode, char * filePath, bool resources, bool isTemporary)
1689 ProjectNode result = null;
1690 ProjectNode after = null;
1691 for(node : parentNode.files)
1693 if(node.type != folder && node.type != file && node.type)
1698 result = parentNode.Add(parentNode.project, filePath, after, file, NodeIcons::SelectFileIcon(filePath), !resources);
1704 modifiedDocument = true;
1705 parentNode.project.topNode.modified = true;
1706 parentNode.project.ModifiedAllConfigs(true, false, true, true);
1709 result.row = parentNode.row.AddRowAfter(after ? after.row : null);
1710 result.row.tag = (int)result;
1711 result.row.SetData(null, result);
1716 CodeEditor CreateNew(char * upper, char * lower, char * base, char * className)
1718 CodeEditor codeEditor = null;
1719 ProjectNode projectNode;
1720 ProjectNode after = null;
1721 DataRow row = fileList.currentRow;
1722 ProjectNode parentNode;
1725 if(!row) row = project.topNode.row;
1727 parentNode = (ProjectNode)row.tag;
1729 for(node : parentNode.files)
1731 if(node.type != folder && node.type != file && node.type)
1735 for(c = 1; c < 100; c++)
1738 sprintf(string, c ? "%s%d.ec" : "%s.ec", lower, c);
1739 if((projectNode = parentNode.Add(project, string, after, file, genFile, true)))
1745 char filePath[MAX_LOCATION];
1747 modifiedDocument = true;
1748 project.topNode.modified = true;
1750 project.ModifiedAllConfigs(true, false, false, true);
1751 projectNode.row = parentNode.row.AddRowAfter(after ? after.row : null);
1752 projectNode.row.tag =(int)projectNode;
1754 projectNode.row.SetData(null, projectNode);
1755 fileList.currentRow = projectNode.row;
1757 strcpy(filePath, project.topNode.path);
1758 PathCat(filePath, projectNode.path);
1759 PathCat(filePath, projectNode.name);
1761 codeEditor = (CodeEditor)ide.FindWindow(filePath);
1764 Class baseClass = eSystem_FindClass(__thisModule, base);
1765 subclass(ClassDesignerBase) designerClass = eClass_GetDesigner(baseClass);
1768 codeEditor = (CodeEditor)ide.OpenFile(filePath, normal, false, null, whatever, normal);
1769 strcpy(name, projectNode.name);
1770 sprintf(name, "%s%d", upper, c);
1772 strcpy(className, name);
1774 designerClass.CreateNew(codeEditor.editBox, codeEditor.clientSize, name, base);
1776 //codeEditor.modifiedDocument = false;
1777 //codeEditor.designer.modifiedDocument = false;
1779 //Code_EnsureUpToDate(codeEditor);
1782 else // TODO: fix no symbols generated when ommiting {} for following else
1784 codeEditor = (CodeEditor)ide.OpenFile(filePath, normal, false, null, whatever, normal);
1788 codeEditor.ViewDesigner();
1789 codeEditor.codeModified = true;
1796 void OpenSelectedNodes()
1801 fileList.GetMultiSelection(selection);
1802 for(item = selection.first; item; item = item.next)
1804 DataRow row = item.data;
1805 ProjectNode node = (ProjectNode)row.tag;
1806 if(node.type == file)
1809 selection.Free(null);
1812 void RemoveSelectedNodes()
1817 fileList.GetMultiSelection(selection);
1819 // Remove children of parents we're deleting
1820 for(item = selection.first; item; item = next)
1823 DataRow row = item.data;
1824 ProjectNode n, node = (ProjectNode)row.tag;
1825 bool remove = false;
1828 for(i = selection.first; i && !remove; i = i.next)
1830 ProjectNode iNode = (ProjectNode)((DataRow)i.data).tag;
1831 for(n = node.parent; n; n = n.parent)
1841 selection.Delete(item);
1844 for(item = selection.first; item; item = item.next)
1846 DataRow row = item.data;
1847 ProjectNode node = (ProjectNode)row.tag;
1848 ProjectNode resNode;
1849 for(resNode = node.parent; resNode; resNode = resNode.parent)
1850 if(resNode.type == resources)
1852 if(node.type == file)
1854 Project prj = node.project;
1856 modifiedDocument = true;
1857 prj.topNode.modified = true;
1859 prj.ModifiedAllConfigs(true, false, true, true);
1861 else if(node.type == folder)
1864 sprintf(message, "Are you sure you want to remove the folder \"%s\"\n"
1865 "and all of its contents from the project?", node.name);
1866 if(MessageBox { type = yesNo, parent = parent, master = null,
1867 text = "Delete Folder", contents = message }.Modal() == yes)
1869 Project prj = node.project;
1870 if(node.containsFile)
1871 prj.ModifiedAllConfigs(true, false, true, true);
1873 modifiedDocument = true;
1874 prj.topNode.modified = true;
1877 else if(node.type == project && node != project.topNode && !buildInProgress)
1881 for(p : workspace.projects)
1883 if(p.topNode == node)
1889 sprintf(message, "Are you sure you want to remove the \"%s\" project\n" "from this workspace?", node.name);
1890 if(MessageBox { type = yesNo, parent = parent, master = null,
1891 text = "Remove Project", contents = message }.Modal() == yes)
1896 workspace.RemoveProject(prj);
1897 //modifiedDocument = true; // when project view is a workspace view
1901 selection.Free(null);