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 Array<FileFilter> fileFilters
38 { $"eC/C/C++ Files (*.ec, *.eh, *.c, *.cpp, *.cc, *.cxx, *.h, *.hpp, *.hh, *.hxx)", "ec, eh, c, cpp, cc, cxx, h, hpp, hh, hxx" },
39 { $"eC/C/C++ Source Files (*.ec, *.c, *.cpp, *.cc, *.cxx)", "ec, eh, c, cpp, cc, cxx" },
40 { $"Header Files for eC/C/C++ (*.eh, *.h, *.hpp, *.hh, *.hxx)", "eh, h, hpp, hh, hxx" },
41 { $"All files", null }
44 static Array<FileFilter> resourceFilters
46 { $"Image Files (*.jpg, *.jpeg, *.bmp, *.pcx, *.png,*.gif)", "jpg, jpeg, bmp, pcx, png, gif" },
47 { $"3D Studio Model Files (*.3ds)", "3ds" },
48 { $"All files", null }
51 static Array<FileType> fileTypes
53 { $"Based on extension", null },
56 { $"3D Studio Model", "3ds" }
59 static Array<FileFilter> projectFilters
61 { $"Project Files (*.epj)", ProjectExtension },
62 { $"Workspace Files (*.ews)", WorkspaceExtension }
65 static Array<FileType> projectTypes
67 { $"Ecere IDE Project", ProjectExtension },
68 { $"Ecere IDE Workspace", WorkspaceExtension }
71 static char * iconNames[] =
73 "<:ecere>mimeTypes/file.png", /*genFile*/
74 "<:ecere>mimeTypes/textEcereWorkspace.png", /*ewsFile*/
75 "<:ecere>mimeTypes/textEcereProject.png", /*epjFile*/
76 "<:ecere>places/folder.png", /*folder*/
77 "<:ecere>status/folderOpen.png", /*openFolder*/
78 "<:ecere>mimeTypes/textEcereSource.png", /*ecFile*/
79 "<:ecere>mimeTypes/textEcereHeader.png", /*ehFile*/
80 "<:ecere>mimeTypes/textCSource.png", /*cFile*/
81 "<:ecere>mimeTypes/textCHeader.png", /*hFile*/
82 "<:ecere>mimeTypes/textC++Source.png", /*cppFile*/
83 "<:ecere>mimeTypes/textC++Header.png", /*hppFile*/
84 "<:ecere>mimeTypes/text.png", /*textFile*/
85 "<:ecere>mimeTypes/textHyperTextMarkup.png", /*webFile*/
86 "<:ecere>mimeTypes/image.png", /*pictureFile*/
87 "<:ecere>status/audioVolumeHigh.png", /*soundFile*/
88 "<:ecere>mimeTypes/package.png", /*archiveFile*/
89 "<:ecere>mimeTypes/packageSoftware.png", /*packageFile*/
90 "<:ecere>mimeTypes/packageOpticalDisc.png", /*opticalMediaImageFile*/
91 "<:ecere>mimeTypes/file.png" /*mFile*/ //TODO: create icon for mfile
94 enum PrepareMakefileMethod { normal, force, forceExists };
96 enum BuildType { build, rebuild, relink, run, start, restart };
99 none, buildingMainProject, buildingSecondaryProject, compilingFile;
101 property bool { get { return this != none; } }
102 //property bool actualBuild { get { return this == buildingMainProject || this == buildingSecondaryProject; } }
105 class ProjectView : Window
108 //hasMinimize = true;
110 borderStyle = sizable;
111 hasHorzScroll = true;
112 hasVertScroll = true;
115 anchor = Anchor { left = 0, top = 0, bottom = 0 };
118 //hasMinimize = true;
119 saveDialog = projectFileDialog;
122 BuildState buildInProgress;
123 BitmapResource icons[NodeIcons];
126 property Workspace workspace
132 for(prj : workspace.projects)
134 DeleteNode(prj.topNode);
136 workspace.projects.Free();
137 ide.debugger.CleanUp();
142 fileDialog.currentDirectory = workspace.workspaceDir;
143 resourceFileDialog.currentDirectory = workspace.workspaceDir;
144 for(prj : workspace.projects)
145 AddNode(prj.topNode, null);
146 ide.statusBar.text = $"Generating Makefile & Dependencies...";
148 for(prj : workspace.projects)
149 prj.ModifiedAllConfigs(true, false, false, false);
150 ide.statusBar.text = $"Initializing Debugger"; app.UpdateDisplay();
151 ide.statusBar.text = null;
155 get { return workspace; }
158 /*property Project project
164 DeleteNode(project.topNode);
170 AddNode(project.topNode, null);
171 fileDialog.currentDirectory = project.topNode.path;
172 resourceFileDialog.currentDirectory = project.topNode.path;
174 // Make sure this is done already...
176 char filePath[MAX_LOCATION];
177 strcpy(filePath, project.topNode.path);
178 PathCat(filePath, project.topNode.name);
179 strcat(filePath, ".epj");
183 ide.statusBar.text = "Generating Makefile & Dependencies...";
185 // REDJ set makefile generation flag so generation occurs only when compiling instead of generating on the spot
186 project.config.makingModified = true;
187 ide.statusBar.text = "Initializing Debugger";
188 ide.statusBar.text = null;
192 get { return project; }
195 bool drawingInProjectSettingsDialog;
196 bool drawingInProjectSettingsDialogHeader;
197 ProjectSettings projectSettingsDialog;
203 multiSelect = true, fullRowSelect = false, hasVertScroll = true, hasHorzScroll = true;
204 borderStyle = deep, parent = this, collapseControl = true, treeBranches = true;
205 anchor = Anchor { left = 0, right = 0, top = 0 , bottom = 0 };
207 background = projectViewBackground;
208 foreground = projectViewText;
209 selectionColor = selectionColor, selectionText = selectionText;
210 stippleColor = skyBlue;
212 bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
214 if(!active) Update(null);
215 return ListBox::OnActivate(active, previous, goOnWithActivation, direct);
218 bool NotifyDoubleClick(ListBox listBox, int x, int y, Modifiers mods)
220 // Prevent the double click from reactivating the project view (returns false if we opened something)
221 return !OpenSelectedNodes();
224 bool NotifyRightClick(ListBox listBox, int x, int y, Modifiers mods)
226 DataRow row = listBox.currentRow;
229 ProjectNode node = (ProjectNode)row.tag;
230 if(node.type == NodeTypes::project || node.type == resources || node.type == file || node.type == folder)
232 bool buildMenuUnavailable = buildInProgress;
234 Menu popupContent { };
236 if(node.type == NodeTypes::project)
238 //if(node == ((Project)workspace.projects.first).topNode)
240 MenuItem { popupContent, $"Build", b, NotifySelect = ProjectBuild }.disabled = buildMenuUnavailable;
241 MenuItem { popupContent, $"Relink", l, NotifySelect = ProjectLink }.disabled = buildMenuUnavailable;
242 MenuItem { popupContent, $"Rebuild", r, NotifySelect = ProjectRebuild }.disabled = buildMenuUnavailable;
243 MenuItem { popupContent, $"Clean", c, NotifySelect = ProjectClean }.disabled = buildMenuUnavailable;
244 MenuItem { popupContent, $"Regenerate Makefile", m, NotifySelect = ProjectRegenerate }.disabled = buildMenuUnavailable;
245 MenuDivider { popupContent };
247 MenuItem { popupContent, $"New File...", l, Key { l, ctrl = true }, NotifySelect = ProjectNewFile };
248 MenuItem { popupContent, $"New Folder...", n, Key { f, ctrl = true }, NotifySelect = ProjectNewFolder };
249 MenuItem { popupContent, $"Import Folder...", i, NotifySelect = ProjectImportFolder };
250 MenuItem { popupContent, $"Add Files to Project...", f, NotifySelect = ProjectAddFiles };
251 MenuDivider { popupContent };
252 MenuItem { popupContent, $"Add New Form...", o, NotifySelect = ProjectAddNewForm };
253 // MenuItem { popupContent, "Add New Behavior Graph...", g, NotifySelect = ProjectAddNewGraph };
254 MenuDivider { popupContent };
255 if(node != ((Project)workspace.projects.first).topNode)
257 MenuItem { popupContent, $"Remove project from workspace", r, NotifySelect = ProjectRemove }.disabled = buildMenuUnavailable;
258 MenuDivider { popupContent };
260 MenuItem { popupContent, $"Active Configuration...", s, Key { f5, alt = true } , NotifySelect = MenuConfig };
261 MenuItem { popupContent, $"Settings...", s, Key { f7, alt = true } , NotifySelect = MenuSettings };
262 MenuDivider { popupContent };
263 MenuItem { popupContent, $"Browse Folder", w, NotifySelect = MenuBrowseFolder };
264 MenuDivider { popupContent };
265 MenuItem { popupContent, $"Save", v, Key { s, ctrl = true }, NotifySelect = ProjectSave }.disabled = !node.modified;
266 MenuDivider { popupContent };
267 MenuItem { popupContent, $"Properties...", p, Key { enter, alt = true }, NotifySelect = FileProperties };
269 else if(node.type == resources)
271 MenuItem { popupContent, $"New File...", l, Key { l, ctrl = true }, NotifySelect = ProjectNewFile };
272 MenuItem { popupContent, $"New Folder...", n, Key { f, ctrl = true }, NotifySelect = ProjectNewFolder };
273 MenuItem { popupContent, $"Add Resources to Project...", f, NotifySelect = ResourcesAddFiles };
274 MenuItem { popupContent, $"Browse Folder", w, NotifySelect = MenuBrowseFolder };
275 MenuDivider { popupContent };
276 MenuItem { popupContent, $"Settings...", s, Key { f7, alt = true } , NotifySelect = MenuSettings };
277 MenuItem { popupContent, $"Properties...", p, Key { enter, alt = true }, NotifySelect = FileProperties };
279 else if(node.type == file)
281 MenuItem { popupContent, $"Open", o, NotifySelect = FileOpenFile };
282 MenuItem { popupContent, $"Compile", c, Key { f7, ctrl = true}, NotifySelect = FileCompile }.disabled = buildMenuUnavailable;
283 MenuDivider { popupContent };
284 MenuItem { popupContent, $"Remove", r, NotifySelect = FileRemoveFile };
285 MenuDivider { popupContent };
286 MenuItem { popupContent, $"Browse Folder", w, NotifySelect = MenuBrowseFolder };
287 MenuDivider { popupContent };
288 MenuItem { popupContent, $"Settings...", s, Key { f7, alt = true } , NotifySelect = MenuSettings };
289 MenuItem { popupContent, $"Properties..", p, Key { enter, alt = true }, NotifySelect = FileProperties };
291 else if(node.type == folder)
293 bool isInResources = node.isInResources;
295 MenuItem { popupContent, $"New File...", l, Key { l, ctrl = true }, NotifySelect = ProjectNewFile };
296 MenuItem { popupContent, $"New Folder...", n, Key { f, ctrl = true }, NotifySelect = ProjectNewFolder };
297 MenuItem { popupContent, $"Import Folder...", i, NotifySelect = ProjectImportFolder };
300 MenuItem { popupContent, $"Add Resources to Folder...", f, NotifySelect = ResourcesAddFiles };
304 MenuItem { popupContent, $"Add Files to Folder...", f, NotifySelect = ProjectAddFiles };
308 MenuDivider { popupContent };
309 MenuItem { popupContent, $"Add New Form...", o, NotifySelect = ProjectAddNewForm };
310 MenuItem { popupContent, $"Add New Behavior Graph...", g, NotifySelect = ProjectAddNewGraph };
312 MenuDivider { popupContent };
313 MenuItem { popupContent, $"Remove", r, NotifySelect = FileRemoveFile };
314 MenuDivider { popupContent };
315 MenuItem { popupContent, $"Browse Folder", w, NotifySelect = MenuBrowseFolder };
316 MenuDivider { popupContent };
317 MenuItem { popupContent, $"Settings...", s, Key { f7, alt = true } , NotifySelect = MenuSettings };
318 MenuItem { popupContent, $"Properties...", p, Key { enter, alt = true }, NotifySelect = FileProperties };
323 master = this, menu = popupContent;
325 x + clientStart.x + absPosition.x - app.desktop.position.x,
326 y + clientStart.y + absPosition.y - app.desktop.position.y };
334 bool NotifyKeyDown(ListBox listBox, DataRow row, Key key, unichar ch)
338 ProjectNode node = (ProjectNode)row.tag;
341 case altEnter: case Key { keyPadEnter, alt = true }:
343 NodeProperties { parent = parent, master = this,
344 position = { position.x + 100, position.y + 100 }, node = node }.Create();
347 case enter: case keyPadEnter:
350 for(resNode = node.parent; resNode; resNode = resNode.parent)
351 if(resNode.type == resources)
353 if(node.type == project || (node.type == folder && !resNode))
358 else if(node.type == resources || node.type == folder)
367 if(node.type == project || node.type == folder || node.type == resources)
376 if(node.type == project || node.type == folder || node.type == resources)
378 NewFolder(node, null, true);
385 if(node.type == file)
387 FileCompile(null, (Modifiers)key);
392 case Key { space, shift = true }:
395 if(node.type == NodeTypes::project)
398 for(p : workspace.projects)
400 if(p.topNode == node)
406 prj.RotateActiveConfig(!key.shift);
417 case enter: case keyPadEnter: OpenSelectedNodes(); break;
418 case del: RemoveSelectedNodes(); break;
421 Window activeClient = ide.activeClient;
423 activeClient.Activate();
425 ide.RepositionWindows(true);
432 bool NotifyCollapse(ListBox listBox, DataRow row, bool collapsed)
434 ProjectNode node = (ProjectNode)row.tag;
435 if(node.type == folder)
436 node.icon = collapsed ? folder : openFolder;
441 FileDialog importFileDialog { autoCreate = false, type = selectDir, text = $"Import Folder" };
442 FileDialog projectFileDialog
444 autoCreate = false, filters = projectFilters.array, sizeFilters = projectFilters.count * sizeof(FileFilter);
445 types = projectTypes.array, sizeTypes = projectTypes.count * sizeof(FileType);
447 FileDialog fileDialog
449 autoCreate = false, mayNotExist = true, filters = fileFilters.array, sizeFilters = fileFilters.count * sizeof(FileFilter);
450 types = fileTypes.array, sizeTypes = fileTypes.count * sizeof(FileType);
452 FileDialog resourceFileDialog
454 autoCreate = false, mayNotExist = true, filters = resourceFilters.array, sizeFilters = resourceFilters.count * sizeof(FileFilter);
455 types = fileTypes.array, sizeTypes = fileTypes.count * sizeof(FileType);
458 Menu fileMenu { menu, $"File", f };
459 MenuItem { fileMenu, $"Save", s, Key { s, ctrl = true }, NotifySelect = MenuFileSave };
460 // MenuItem { fileMenu, "Save As...", a, NotifySelect = MenuFileSaveAs };
462 bool OnClose(bool parentClosing)
464 if(!parentClosing && visible)
476 //if(ide.findInFilesDialog && ide.findInFilesDialog.created && ide.findInFilesDialog.mode != directory)
477 // ide.findInFilesDialog.SearchStop();
479 ide.outputView.buildBox.Clear();
480 ide.outputView.debugBox.Clear();
481 //ide.outputView.findBox.Clear();
482 ide.callStackView.Clear();
483 ide.watchesView.Clear();
484 ide.threadsView.Clear();
485 ide.breakpointsView.Clear();
486 ide.outputView.ShowClearSelectTab(find); // why this?
489 bool OnSaveFile(char * fileName)
491 for(prj : ide.workspace.projects)
493 if(prj.topNode.modified && prj.Save(prj.filePath))
495 // ProjectUpdateMakefileForAllConfigs(prj, true, true);
496 prj.topNode.modified = false;
499 modifiedDocument = false;
504 bool IsModuleInProject(char * filePath)
506 char moduleName[MAX_FILENAME]; //, modulePath[MAX_LOCATION];
507 GetLastDirectory(filePath, moduleName);
508 return project.topNode.Find(moduleName, false) != null;
511 bool GetRelativePath(char * filePath, char * relativePath)
514 char moduleName[MAX_FILENAME]; //, modulePath[MAX_LOCATION];
515 GetLastDirectory(filePath, moduleName);
517 // try with workspace dir first?
518 if((node = project.topNode.Find(moduleName, false)))
520 strcpy(relativePath, node.path);
521 PathCatSlash(relativePath, node.name);
524 // WARNING: On failure, relative path is uninitialized
526 return project.GetRelativePath(filePath, relativePath);
529 ProjectNode GetNodeFromWindow(Window document, Project project)
531 if(document.fileName)
533 char winFileName[MAX_LOCATION];
534 char * documentFileName = GetSlashPathBuffer(winFileName, document.fileName);
535 for(p : ide.workspace.projects)
537 Project prj = project ? project : p;
539 char moduleName[MAX_FILENAME], modulePath[MAX_LOCATION];
540 GetLastDirectory(document.fileName, moduleName);
542 if((node = prj.topNode.Find(moduleName, false)))
544 strcpy(modulePath, prj.topNode.path);
545 PathCatSlash(modulePath, node.path);
546 PathCatSlash(modulePath, node.name);
547 if(!fstrcmp(documentFileName, modulePath))
558 void Compile(ProjectNode node)
560 char fileName[MAX_LOCATION];
561 char extension[MAX_EXTENSION];
563 Project prj = node.project;
564 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
565 DirExpression objDir = prj.objDir;
567 strcpy(fileName, prj.topNode.path);
568 PathCatSlash(fileName, objDir.dir);
569 PathCatSlash(fileName, node.name);
570 StripExtension(fileName);
571 strcat(fileName, ".o");
572 if(FileExists(fileName))
573 DeleteFile(fileName);
575 GetExtension(node.name, extension);
576 if(!strcmp(extension, "ec"))
578 // Delete generated C file
579 strcpy(fileName, prj.topNode.path);
580 PathCat(fileName, objDir.dir);
581 PathCat(fileName, node.name);
582 StripExtension(fileName);
583 strcat(fileName, ".c");
584 if(FileExists(fileName))
585 DeleteFile(fileName);
587 // Delete symbol file
588 strcpy(fileName, prj.topNode.path);
589 PathCat(fileName, node.path);
590 PathCat(fileName, node.name);
591 StripExtension(fileName);
592 strcat(fileName, ".sym");
593 if(FileExists(fileName))
594 DeleteFile(fileName);
599 // Check if we have to save
600 strcpy(fileName, prj.topNode.path);
601 PathCatSlash(fileName, node.path);
602 PathCatSlash(fileName, node.name);
603 for(document = ide.firstChild; document; document = document.next)
605 if(document.modifiedDocument)
607 char documentFileName[MAX_LOCATION];
608 if(!fstrcmp(GetSlashPathBuffer(documentFileName, document.fileName), fileName))
609 if(!document.MenuFileSave(null, 0))
614 if(ProjectPrepareForToolchain(prj, normal, true, true))
618 buildInProgress = compilingFile;
619 ide.AdjustBuildMenus();
621 //ide.outputView.ShowClearSelectTab(build);
622 // this stuff doesn't even appear
623 //ide.outputView.buildBox.Logf("%s Compiler\n", compiler.name);
625 ide.outputView.buildBox.Logf($"Compiling single file %s in project %s using the %s configuration...\n", node.name, prj.name, prj.config.name);
627 ide.outputView.buildBox.Logf($"Compiling single file %s in project %s...\n", node.name, prj.name);
630 buildInProgress = none;
631 ide.AdjustBuildMenus();
634 ide.outputView.buildBox.Logf($"File %s is excluded from current build configuration.\n", node.name);
640 void GoToError(const char * line)
644 while(isspace(*line)) line++;
645 colon = strstr(line, ":");
650 bool lookForLineNumber = true;
652 // deal with linking error
653 if(colon && colon[1] == ' ')
655 colon = strstr(colon + 1, ":");
656 if(colon && !colon[1])
658 colon = strstr(line, ":");
659 lookForLineNumber = false;
661 else if(colon && !isdigit(colon[1]))
664 colon = strstr(line, ":");
667 // Don't be mistaken by the drive letter colon
668 if(colon && (colon[1] == '/' || colon[1] == '\\'))
669 colon = strstr(colon + 1, ":");
670 if(colon && lookForLineNumber)
674 char * par = RSearchString(line, "(", colon - line, true, false);
675 if(par && strstr(par, ")"))
677 else if((colon+1)[0] == ' ')
679 // NOTE: This is the same thing as saying 'colon = line'
680 for( ; colon != line; colon--)
684 lineNumber = atoi(colon + 1);
686 comma = strchr(colon, ',');
690 comma = strchr(colon+1, ':');
696 char moduleName[MAX_LOCATION], filePath[MAX_LOCATION];
701 strncpy(moduleName, line, colon - line);
702 moduleName[colon - line] = '\0';
705 strcpy(moduleName, line);
707 // Remove stuff in brackets
709 bracket = strstr(moduleName, "(");
710 if(bracket) *bracket = '\0';
712 MakeSlashPath(moduleName);
716 // Check if it's one of our modules
717 ProjectNode node = project.topNode.Find(moduleName, false);
720 strcpy(moduleName, node.path);
721 PathCatSlash(moduleName, node.name);
724 moduleName[0] = '\0';
728 CodeEditor codeEditor;
729 strcpy(filePath, project.topNode.path);
730 PathCatSlash(filePath, moduleName);
732 codeEditor = (CodeEditor)ide.OpenFile(filePath, normal, true, null, no, normal);
735 char name[MAX_LOCATION];
736 // TOFIX: Improve on this, don't use only filename, make a function
737 if(ide && ide.workspace)
739 for(prj : ide.workspace.projects)
741 if(prj.topNode.FindWithPath(moduleName, false))
743 strcpy(filePath, prj.topNode.path);
744 PathCatSlash(filePath, moduleName);
745 codeEditor = (CodeEditor)ide.OpenFile(filePath, normal, true, null, no, normal);
752 if(codeEditor && lineNumber)
754 EditBox editBox = codeEditor.editBox;
755 editBox.GoToLineNum(lineNumber - 1);
756 editBox.GoToPosition(editBox.line, lineNumber - 1, col ? (col - 1) : 0);
763 bool OpenNode(ProjectNode node)
765 char filePath[MAX_LOCATION];
766 node.GetFullFilePath(filePath);
767 return ide.OpenFile(filePath, normal, true/*false Why was it opening hidden?*/, null, something, normal) ? true : false;
770 void AddNode(ProjectNode node, DataRow addTo)
772 DataRow row = addTo ? addTo.AddRow() : fileList.AddRow();
777 if(node.type == resources)
780 row.SetData(null, node);
782 if(node.files && node.files.first && node.parent &&
783 !(!node.parent.parent &&
784 (!strcmpi(node.name, "notes") || !strcmpi(node.name, "sources") ||
785 !strcmpi(node.name, "src") || !strcmpi(node.name, "tools"))))
786 row.collapsed = true;
787 else if(node.type == folder)
788 node.icon = openFolder;
792 for(child : node.files)
797 void DeleteNode(ProjectNode projectNode)
799 if(projectNode.files)
802 while(child = projectNode.files.first)
805 fileList.DeleteRow(projectNode.row);
806 projectNode.Delete();
812 for(c = 0; c < NodeIcons::enumSize; c++)
814 icons[c] = BitmapResource { iconNames[c], alphaBlend = true };
815 AddResource(icons[c]);
817 fileList.AddField(DataField { dataType = class(ProjectNode), freeData = false, userData = this });
823 ide.DestroyTemporaryProjectDir();
831 bool ProjectSave(MenuItem selection, Modifiers mods)
833 DataRow row = fileList.currentRow;
834 ProjectNode node = row ? (ProjectNode)row.tag : null;
835 Project prj = node ? node.project : null;
838 if(prj.Save(prj.filePath))
840 // ProjectUpdateMakefileForAllConfigs(prj, true, true);
841 prj.topNode.modified = false;
843 for(p : ide.workspace.projects)
845 if(p.topNode.modified)
852 modifiedDocument = false;
859 bool ShowOutputBuildLog(bool cleanLog)
861 OutputView output = ide.outputView;
863 output.ShowClearSelectTab(build);
866 output.SelectTab(build);
871 bool DisplayCompiler(bool cleanLog)
873 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
874 ShowOutputBuildLog(cleanLog);
875 ide.outputView.buildBox.Logf($"%s Compiler\n", compiler ? compiler.name : $"{problem with compiler selection}");
879 bool ProjectUpdateMakefileForAllConfigs(Project project, bool cleanLog, bool displayCompiler)
881 ProjectConfig currentConfig = project.config;
882 ShowOutputBuildLog(cleanLog);
885 DisplayCompiler(false);
887 for(config : project.configurations)
889 project.config = config;
890 ProjectPrepareMakefile(project, forceExists, false, false);
893 project.config = currentConfig;
898 bool ProjectPrepareForToolchain(Project project, PrepareMakefileMethod method, bool cleanLog, bool displayCompiler)
901 char message[MAX_F_STRING];
902 LogBox logBox = ide.outputView.buildBox;
904 ShowOutputBuildLog(cleanLog);
907 DisplayCompiler(false);
909 ProjectPrepareMakefile(project, method, false, false);
913 bool ProjectPrepareMakefile(Project project, PrepareMakefileMethod method, bool cleanLog, bool displayCompiler)
915 char makefilePath[MAX_LOCATION];
916 char makefileName[MAX_LOCATION];
918 LogBox logBox = ide.outputView.buildBox;
920 ShowOutputBuildLog(cleanLog);
923 DisplayCompiler(false);
925 strcpy(makefilePath, project.topNode.path);
926 project.CatMakeFileName(makefileName);
927 PathCatSlash(makefilePath, makefileName);
929 exists = FileExists(makefilePath);
930 if((method == normal && (!exists || project.config.makingModified/*|| project.topNode.modified*/)) ||
931 (method == forceExists && exists) ||
932 method == force) // || project.config.makingModified || makefileDirty
936 ide.statusBar.text = $"Generating Makefile & Dependencies..."; // Dependencies?
939 if((method == normal && !exists) || (method == force && !exists))
940 action = $"Generating ";
941 else if(method == force)
942 action = $"Regenerating ";
943 else if(method == normal || method == forceExists)
944 action = $"Updating ";
948 reason = $"Makefile doesn't exist. ";
949 else if(project.topNode.modified)
950 reason = $"Project has been modified. ";
954 //logBox.Logf("%s\n", makefileName);
955 logBox.Logf($"%s - %s%smakefile for %s config...\n", makefileName, reason, action, project.configName);
956 project.GenerateMakefile(null, false, null);
958 ide.statusBar.text = null;
965 bool ProjectBuild(MenuItem selection, Modifiers mods)
967 Project prj = project;
968 if(selection || !ide.activeClient || activeClient == this)
970 DataRow row = fileList.currentRow;
971 ProjectNode node = row ? (ProjectNode)row.tag : null;
972 if(node) prj = node.project;
974 // Added this code here until dependencies work:
975 else //if(ide.activeClient)
977 ProjectNode node = GetNodeFromWindow(ide.activeClient, null);
981 if(/*prj != project || */!prj.configIsInDebugSession || !ide.DontTerminateDebugSession($"Project Build"))
982 BuildInterrim(prj, build);
986 bool BuildInterrim(Project prj, BuildType buildType)
988 if(ProjectPrepareForToolchain(prj, normal, true, true))
990 ide.outputView.buildBox.Logf($"Building project %s using the %s configuration...\n", prj.name, prj.configName);
991 return Build(prj, buildType);
996 bool ProjectLink(MenuItem selection, Modifiers mods)
998 Project prj = project;
999 if(selection || !ide.activeClient || activeClient == this)
1001 DataRow row = fileList.currentRow;
1002 ProjectNode node = row ? (ProjectNode)row.tag : null;
1003 if(node) prj = node.project;
1005 // Added this code here until dependencies work:
1006 else //if(ide.activeClient)
1008 ProjectNode node = GetNodeFromWindow(ide.activeClient, null);
1012 if(ProjectPrepareForToolchain(prj, normal, true, true))
1014 ide.outputView.buildBox.Logf("Relinking project %s using the %s configuration...\n", prj.name, prj.configName);
1016 prj.config.linkingModified = true;
1022 bool ProjectRebuild(MenuItem selection, Modifiers mods)
1024 Project prj = GetSelectedProject((bool)selection);
1025 if(ProjectPrepareForToolchain(prj, normal, true, true))
1027 ide.outputView.buildBox.Logf($"Rebuilding project %s using the %s configuration...\n", prj.name, prj.configName);
1030 prj.config.compilingModified = true;
1031 prj.config.makingModified = true;
1032 }*/ // -- should this still be used depite the new solution of BuildType?
1033 Build(prj, rebuild);
1038 bool ProjectClean(MenuItem selection, Modifiers mods)
1040 Project prj = GetSelectedProject((bool)selection);
1041 if(ProjectPrepareForToolchain(prj, normal, true, true))
1043 ide.outputView.buildBox.Logf($"Cleaning project %s using the %s configuration...\n", prj.name, prj.configName);
1045 buildInProgress = prj == project ? buildingMainProject : buildingSecondaryProject;
1046 ide.AdjustBuildMenus();
1049 buildInProgress = none;
1050 ide.AdjustBuildMenus();
1055 bool ProjectRegenerate(MenuItem selection, Modifiers mods)
1057 Project prj = project;
1058 if(selection || !ide.activeClient || activeClient == this)
1060 DataRow row = fileList.currentRow;
1061 ProjectNode node = row ? (ProjectNode)row.tag : null;
1065 // Added this code here until dependencies work:
1066 else //if(ide.activeClient)
1068 ProjectNode node = GetNodeFromWindow(ide.activeClient, null);
1073 ProjectPrepareMakefile(prj, force, true, true);
1077 bool ProjectNewFile(MenuItem selection, Modifiers mods)
1079 DataRow row = fileList.currentRow;
1082 char fileName[1024];
1083 char filePath[MAX_LOCATION];
1084 ProjectNode parentNode = (ProjectNode)row.tag;
1085 ProjectNode n, fileNode;
1086 parentNode.GetFileSysMatchingPath(filePath);
1087 MakePathRelative(filePath, parentNode.project.topNode.path, filePath);
1088 for(n = parentNode; n && n != parentNode.project.resNode; n = n.parent);
1089 sprintf(fileName, $"Untitled %d", documentID);
1090 fileNode = AddFile(parentNode, fileName, (bool)n, true);
1091 fileNode.path = CopyUnixPath(filePath);
1094 NodeProperties nodeProperties
1097 position = { position.x + 100, position.y + 100 };
1101 nodeProperties.Create(); // not modal?
1107 bool ProjectNewFolder(MenuItem selection, Modifiers mods)
1109 DataRow row = fileList.currentRow;
1112 ProjectNode parentNode = (ProjectNode)row.tag;
1113 NewFolder(parentNode, null, true);
1118 bool ResourcesAddFiles(MenuItem selection, Modifiers mods)
1124 bool ProjectAddFiles(MenuItem selection, Modifiers mods)
1130 bool ProjectImportFolder(MenuItem selection, Modifiers mods)
1132 DataRow row = fileList.currentRow;
1135 ProjectNode toNode = (ProjectNode)row.tag;
1136 ImportFolder(toNode);
1141 bool ProjectAddNewForm(MenuItem selection, Modifiers mods)
1143 CodeEditor codeEditor = CreateNew("Form", "form", "Window", null);
1144 codeEditor.EnsureUpToDate();
1148 bool ProjectAddNewGraph(MenuItem selection, Modifiers mods)
1150 CodeEditor codeEditor = CreateNew("Graph", "graph", "Block", null);
1152 codeEditor.EnsureUpToDate();
1156 bool ProjectRemove(MenuItem selection, Modifiers mods)
1158 DataRow row = fileList.currentRow;
1161 ProjectNode node = (ProjectNode)row.tag;
1162 if(node.type == project)
1163 RemoveSelectedNodes();
1168 bool MenuConfig(MenuItem selection, Modifiers mods)
1170 if(ProjectActiveConfig { parent = parent.parent, master = parent, project = project }.Modal() == ok)
1175 bool MenuCompiler(MenuItem selection, Modifiers mods)
1177 ActiveCompilerDialog compilerDialog
1179 parent = parent.parent, master = parent;
1180 ideSettings = ideSettings, workspaceActiveCompiler = ide.workspace.compiler;
1182 incref compilerDialog;
1183 if(compilerDialog.Modal() == ok && strcmp(compilerDialog.workspaceActiveCompiler, ide.workspace.compiler))
1185 ide.workspace.compiler = compilerDialog.workspaceActiveCompiler;
1186 for(prj : ide.workspace.projects)
1187 ide.projectView.ProjectUpdateMakefileForAllConfigs(prj, true, true);
1189 delete compilerDialog;
1193 bool MenuSettings(MenuItem selection, Modifiers mods)
1195 ProjectNode node = GetSelectedNode(true);
1196 Project prj = node ? node.project : project;
1197 projectSettingsDialog = ProjectSettings { parent = parent.parent, master = parent, project = prj, projectNode = node };
1198 projectSettingsDialog.Modal();
1205 bool FileProperties(MenuItem selection, Modifiers mods)
1207 DataRow row = fileList.currentRow;
1210 ProjectNode node = (ProjectNode)row.tag;
1211 NodeProperties { parent = parent, master = this, node = node,
1212 position = { position.x + 100, position.y + 100 } }.Create();
1217 bool FileOpenFile(MenuItem selection, Modifiers mods)
1219 OpenSelectedNodes();
1223 bool FileRemoveFile(MenuItem selection, Modifiers mods)
1225 RemoveSelectedNodes();
1229 bool FileCompile(MenuItem selection, Modifiers mods)
1231 DataRow row = fileList.currentRow;
1234 ProjectNode node = (ProjectNode)row.tag;
1240 /*bool IsProjectModified()
1244 for(document = master.firstChild; document; document = document.next)
1246 if(document.modifiedDocument)
1247 if(GetNodeFromWindow(document), project)
1254 bool Build(Project prj, BuildType buildType)
1260 for(document = master.firstChild; document; document = document.next)
1262 if(document.modifiedDocument)
1264 ProjectNode node = GetNodeFromWindow(document, prj);
1265 if(node && !document.MenuFileSave(null, 0))
1274 DirExpression targetDir = prj.targetDir;
1276 // TOFIX: DebugStop is being abused and backfiring on us.
1277 // It's supposed to be the 'Debug/Stop' item, not unloading executable or anything else
1279 // configIsInDebugSession seems to be used for two OPPOSITE things:
1280 // If we're debugging another config, we need to unload the executable!
1281 // In building, we want to stop if we're debugging the 'same' executable
1282 if(buildType != run) ///* && prj == project*/ && prj.configIsInDebugSession)
1284 if(buildType == start || buildType == restart)
1286 if(ide.debugger && ide.debugger.isPrepared)
1293 if(ide.project == prj && ide.debugger && ide.debugger.prjConfig == prj.config && ide.debugger.isPrepared)
1300 // TODO: Disabled until problems fixed... is it fixed?
1301 if(buildType == rebuild || (prj.config && prj.config.compilingModified))
1305 if(buildType == relink || (prj.config && prj.config.linkingModified))
1307 char target[MAX_LOCATION];
1309 strcpy(target, prj.topNode.path);
1310 PathCat(target, targetDir.dir);
1311 prj.CatTargetFileName(target);
1312 if(FileExists(target))
1315 if(prj.config && prj.config.symbolGenModified)
1317 DirExpression objDir = prj.objDir;
1318 char fileName[MAX_LOCATION];
1319 char moduleName[MAX_FILENAME];
1320 strcpy(fileName, prj.topNode.path);
1321 PathCatSlash(fileName, objDir.dir);
1322 strcpy(moduleName, prj.moduleName);
1323 strcat(moduleName, ".main.ec");
1324 PathCatSlash(fileName, moduleName);
1325 if(FileExists(fileName))
1326 DeleteFile(fileName);
1327 ChangeExtension(fileName, "c", fileName);
1328 if(FileExists(fileName))
1329 DeleteFile(fileName);
1330 ChangeExtension(fileName, "o", fileName);
1331 if(FileExists(fileName))
1332 DeleteFile(fileName);
1337 buildInProgress = prj == project ? buildingMainProject : buildingSecondaryProject;
1338 ide.AdjustBuildMenus();
1339 ide.AdjustDebugMenus();
1341 result = prj.Build(buildType == run, null);
1345 prj.config.compilingModified = false;
1346 if(!ide.ShouldStopBuild())
1347 prj.config.linkingModified = false;
1349 prj.config.symbolGenModified = false;
1351 buildInProgress = none;
1352 ide.AdjustBuildMenus();
1353 ide.AdjustDebugMenus();
1355 ide.workspace.modified = true;
1362 Project GetSelectedProject(bool useSelection)
1364 Project prj = project;
1367 DataRow row = fileList.currentRow;
1368 ProjectNode node = row ? (ProjectNode)row.tag : null;
1375 ProjectNode GetSelectedNode(bool useSelection)
1377 ProjectNode node = null;
1380 DataRow row = fileList.currentRow;
1382 node = (ProjectNode)row.tag;
1387 bool MenuBrowseFolder(MenuItem selection, Modifiers mods)
1389 char folder[MAX_LOCATION];
1391 ProjectNode node = GetSelectedNode(true);
1393 node = project.topNode;
1396 strcpy(folder, prj.topNode.path);
1397 if(node != prj.topNode)
1398 PathCatSlash(folder, node.path);
1402 bool Run(MenuItem selection, Modifiers mods)
1404 char args[MAX_LOCATION * 64];
1406 if(ide.workspace.commandLineArgs)
1407 //ide.debugger.GetCommandLineArgs(args);
1408 strcpy(args, ide.workspace.commandLineArgs);
1409 if(ide.debugger.isActive)
1411 /*else if(project.config.targetType == sharedLibrary || project.config.targetType == staticLibrary)
1412 MessageBox { master = ide, type = ok, text = "Run", contents = "Shared and static libraries cannot be run like executables." }.Modal();*/
1413 else if(BuildInterrim(project, run))
1420 bool result = false;
1421 if(project.targetType == sharedLibrary || project.targetType == staticLibrary)
1422 MessageBox { master = ide, type = ok, text = $"Run", contents = $"Shared and static libraries cannot be run like executables." }.Modal();
1423 else if(project.compress)
1424 MessageBox { master = ide, text = $"Starting Debug", contents = $"Debugging compressed applications is not supported\n" }.Modal();
1425 else if(project.debug ||
1426 MessageBox { master = ide, type = okCancel, text = $"Starting Debug", contents = $"Attempting to debug non-debug configuration\nProceed anyways?" }.Modal() == ok)
1428 if(/*!IsProjectModified() ||*/ BuildInterrim(project, start))
1430 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
1431 if(compiler.type.isVC)
1433 //bool result = false;
1434 char oldwd[MAX_LOCATION];
1435 char oldPath[MAX_LOCATION * 65];
1436 char command[MAX_LOCATION];
1438 GetEnvironment("PATH", oldPath, sizeof(oldPath));
1439 ide.SetPath(false); //true
1441 GetWorkingDir(oldwd, sizeof(oldwd));
1442 ChangeWorkingDir(project.topNode.path);
1444 sprintf(command, "%s /useenv %s.sln /projectconfig \"%s|Win32\" /command \"%s\"" , "devenv", project.name, project.config.name, "Debug.Start");
1445 //ide.outputView.buildBox.Logf("command: %s\n", command);
1447 ChangeWorkingDir(oldwd);
1448 SetEnvironment("PATH", oldPath);
1452 ide.debugger.Start();
1464 if(/*!IsProjectModified() ||*/ BuildInterrim(project, restart))
1466 ide.debugger.Restart();
1474 ide.debugger.Resume();
1480 ide.debugger.Break();
1486 ide.debugger.Stop();
1490 bool DebugStepInto()
1492 if((ide.debugger.isActive) || (!buildInProgress && BuildInterrim(project, start)))
1493 ide.debugger.StepInto();
1497 bool DebugStepOver(bool skip)
1499 if((ide.debugger.isActive) || (!buildInProgress && BuildInterrim(project, start)))
1500 ide.debugger.StepOver(skip);
1504 bool DebugStepOut(bool skip)
1506 ide.debugger.StepOut(skip);
1510 void ImportFolder(ProjectNode toNode)
1514 //bool isFolder = toNode.type == folder;
1515 //bool isRes = toNode.isInResources;
1517 FileDialog fileDialog = importFileDialog;
1518 fileDialog.master = parent;
1519 if(fileDialog.Modal() == ok)
1521 ImportFolderFSI fsi { projectView = this };
1522 fsi.stack.Add(toNode);
1523 fsi.Iterate(fileDialog.filePath);
1529 ProjectNode NewFolder(ProjectNode parentNode, char * name, bool showProperties)
1533 ProjectNode folderNode;
1534 Project prj = parentNode.project;
1536 ProjectNode after = null;
1537 for(node : parentNode.files)
1539 if(node.type != folder)
1545 folderNode = parentNode.Add(prj, name, after, folder, folder, true);
1548 for(c = 0; c < 100; c++)
1551 sprintf(string, c ? "New Folder (%d)" : "New Folder", c);
1552 if((folderNode = parentNode.Add(prj, string, after, folder, folder, true)))
1559 NodeProperties nodeProperties;
1562 modifiedDocument = true;
1563 prj.topNode.modified = true;
1566 folderNode.row = parentNode.row.AddRowAfter(after ? after.row : null);
1567 folderNode.row.tag = (int)folderNode;
1569 folderNode.row.SetData(null, folderNode);
1570 fileList.currentRow = folderNode.row;
1574 nodeProperties = NodeProperties
1576 parent, this, mode = newFolder, node = folderNode;
1577 position = { position.x + 100, position.y + 100 };
1579 nodeProperties.Create(); // Modal?
1587 void AddFiles(bool resources)
1589 FileDialog fileDialog = (!resources) ? this.fileDialog : resourceFileDialog;
1590 fileDialog.type = multiOpen;
1591 fileDialog.text = !resources ? $"Add Files to Project" : $"Add Resources to Project";
1592 fileDialog.master = parent;
1594 if(fileDialog.Modal() == ok)
1597 DataRow row = fileList.currentRow;
1598 ProjectNode parentNode = (ProjectNode)row.tag;
1599 bool addFailed = false;
1600 int numSelections = fileDialog.numSelections;
1601 char ** multiFilePaths = fileDialog.multiFilePaths;
1603 Array<String> nameConflictFiles { };
1605 for(c = 0; c < numSelections; c++)
1607 char * filePath = multiFilePaths[c];
1608 FileAttribs exists = FileExists(filePath);
1609 bool addThisFile = true;
1611 if(exists.isDirectory)
1612 addThisFile = false;
1615 if(MessageBox { master = ide, type = yesNo, text = filePath,
1616 contents = $"File doesn't exist. Create?" }.Modal() == yes)
1618 File f = FileOpen(filePath, write);
1626 MessageBox { master = ide, type = ok, text = filePath,
1627 contents = $"Couldn't create file."}.Modal();
1628 addThisFile = false;
1635 /*addFailed = */if(!AddFile(parentNode, filePath, resources, false))//;
1637 nameConflictFiles.Add(CopyString(filePath));
1645 char * part1 = $"The following file";
1646 char * opt1 = $" was ";
1647 char * opt2 = $"s were ";
1648 char * part2 = $"not added because of identical file name conflict within the project.\n\n";
1650 len += strlen(part1);
1651 len += strlen(part2);
1652 len += nameConflictFiles.count > 1 ? strlen(opt2) : strlen(opt1);
1653 for(s : nameConflictFiles)
1654 len += strlen(s) + 1;
1655 message = new char[len + 1];
1656 strcpy(message, part1);
1657 strcat(message, nameConflictFiles.count > 1 ? opt2 : opt1);
1658 strcat(message, part2);
1659 for(s : nameConflictFiles)
1662 strcat(message, "\n");
1664 MessageBox { master = ide, type = ok, text = $"Name Conflict",
1665 contents = message }.Modal();
1668 nameConflictFiles.Free();
1669 delete nameConflictFiles;
1673 ProjectNode AddFile(ProjectNode parentNode, char * filePath, bool resources, bool isTemporary)
1675 ProjectNode result = null;
1676 ProjectNode after = null;
1677 for(node : parentNode.files)
1679 if(node.type != folder && node.type != file && node.type)
1684 result = parentNode.Add(parentNode.project, filePath, after, file, NodeIcons::SelectFileIcon(filePath), !resources);
1690 modifiedDocument = true;
1691 parentNode.project.topNode.modified = true;
1692 parentNode.project.ModifiedAllConfigs(true, false, true, true);
1695 result.row = parentNode.row.AddRowAfter(after ? after.row : null);
1696 result.row.tag = (int)result;
1697 result.row.SetData(null, result);
1702 CodeEditor CreateNew(char * upper, char * lower, char * base, char * className)
1704 CodeEditor codeEditor = null;
1705 ProjectNode projectNode;
1706 ProjectNode after = null;
1707 DataRow row = fileList.currentRow;
1708 ProjectNode parentNode;
1711 if(!row) row = project.topNode.row;
1713 parentNode = (ProjectNode)row.tag;
1715 for(node : parentNode.files)
1717 if(node.type != folder && node.type != file && node.type)
1721 for(c = 1; c < 100; c++)
1724 sprintf(string, c ? "%s%d.ec" : "%s.ec", lower, c);
1725 if((projectNode = parentNode.Add(project, string, after, file, genFile, true)))
1731 char filePath[MAX_LOCATION];
1733 modifiedDocument = true;
1734 project.topNode.modified = true;
1736 project.ModifiedAllConfigs(true, false, false, true);
1737 projectNode.row = parentNode.row.AddRowAfter(after ? after.row : null);
1738 projectNode.row.tag =(int)projectNode;
1740 projectNode.row.SetData(null, projectNode);
1741 fileList.currentRow = projectNode.row;
1743 strcpy(filePath, project.topNode.path);
1744 PathCat(filePath, projectNode.path);
1745 PathCat(filePath, projectNode.name);
1747 codeEditor = (CodeEditor)ide.FindWindow(filePath);
1750 Class baseClass = eSystem_FindClass(__thisModule, base);
1751 subclass(ClassDesignerBase) designerClass = eClass_GetDesigner(baseClass);
1754 codeEditor = (CodeEditor)ide.OpenFile(filePath, normal, false, null, whatever, normal);
1755 strcpy(name, projectNode.name);
1756 sprintf(name, "%s%d", upper, c);
1758 strcpy(className, name);
1760 designerClass.CreateNew(codeEditor.editBox, codeEditor.clientSize, name, base);
1762 //codeEditor.modifiedDocument = false;
1763 //codeEditor.designer.modifiedDocument = false;
1765 //Code_EnsureUpToDate(codeEditor);
1768 else // TODO: fix no symbols generated when ommiting {} for following else
1770 codeEditor = (CodeEditor)ide.OpenFile(filePath, normal, false, null, whatever, normal);
1774 codeEditor.ViewDesigner();
1775 codeEditor.codeModified = true;
1782 // Returns true if we opened something
1783 bool OpenSelectedNodes()
1788 fileList.GetMultiSelection(selection);
1789 for(item = selection.first; item; item = item.next)
1791 DataRow row = item.data;
1792 ProjectNode node = (ProjectNode)row.tag;
1793 if(node.type == file)
1799 selection.Free(null);
1803 void RemoveSelectedNodes()
1808 fileList.GetMultiSelection(selection);
1810 // Remove children of parents we're deleting
1811 for(item = selection.first; item; item = next)
1814 DataRow row = item.data;
1815 ProjectNode n, node = (ProjectNode)row.tag;
1816 bool remove = false;
1819 for(i = selection.first; i && !remove; i = i.next)
1821 ProjectNode iNode = (ProjectNode)((DataRow)i.data).tag;
1822 for(n = node.parent; n; n = n.parent)
1832 selection.Delete(item);
1835 for(item = selection.first; item; item = item.next)
1837 DataRow row = item.data;
1838 ProjectNode node = (ProjectNode)row.tag;
1839 ProjectNode resNode;
1840 for(resNode = node.parent; resNode; resNode = resNode.parent)
1841 if(resNode.type == resources)
1843 if(node.type == file)
1845 Project prj = node.project;
1847 modifiedDocument = true;
1848 prj.topNode.modified = true;
1850 prj.ModifiedAllConfigs(true, false, true, true);
1852 else if(node.type == folder)
1855 sprintf(message, $"Are you sure you want to remove the folder \"%s\"\n"
1856 "and all of its contents from the project?", node.name);
1857 if(MessageBox { master = ide, type = yesNo, text = $"Delete Folder", contents = message }.Modal() == yes)
1859 Project prj = node.project;
1860 if(node.containsFile)
1861 prj.ModifiedAllConfigs(true, false, true, true);
1863 modifiedDocument = true;
1864 prj.topNode.modified = true;
1867 else if(node.type == project && node != project.topNode && !buildInProgress)
1871 for(p : workspace.projects)
1873 if(p.topNode == node)
1879 sprintf(message, $"Are you sure you want to remove the \"%s\" project\n" "from this workspace?", node.name);
1880 if(MessageBox { master = ide, type = yesNo, text = $"Remove Project", contents = message }.Modal() == yes)
1885 workspace.RemoveProject(prj);
1886 //modifiedDocument = true; // when project view is a workspace view
1890 selection.Free(null);