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 bool drawingInProjectSettingsDialog;
159 bool drawingInProjectSettingsDialogHeader;
160 ProjectSettings projectSettingsDialog;
167 for(c = 0; c < NodeIcons::enumSize; c++)
169 icons[c] = BitmapResource { iconNames[c], alphaBlend = true };
170 AddResource(icons[c]);
172 fileList.AddField(DataField { dataType = class(ProjectNode), freeData = false, userData = this });
178 ide.DestroyTemporaryProjectDir();
188 multiSelect = true, fullRowSelect = false, hasVertScroll = true, hasHorzScroll = true;
189 borderStyle = deep, parent = this, collapseControl = true, treeBranches = true;
190 anchor = Anchor { left = 0, right = 0, top = 0 , bottom = 0 };
192 background = projectViewBackground;
193 foreground = projectViewText;
194 selectionColor = selectionColor, selectionText = selectionText;
195 stippleColor = skyBlue;
197 bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
199 if(!active) Update(null);
200 return ListBox::OnActivate(active, previous, goOnWithActivation, direct);
203 bool NotifyDoubleClick(ListBox listBox, int x, int y, Modifiers mods)
205 // Prevent the double click from reactivating the project view (returns false if we opened something)
206 return !OpenSelectedNodes();
209 bool NotifyRightClick(ListBox listBox, int x, int y, Modifiers mods)
211 DataRow row = listBox.currentRow;
214 ProjectNode node = (ProjectNode)row.tag;
215 if(node.type == NodeTypes::project || node.type == resources || node.type == file || node.type == folder)
217 bool buildMenuUnavailable = buildInProgress;
219 Menu popupContent { };
221 if(node.type == NodeTypes::project)
223 //if(node == ((Project)workspace.projects.first).topNode)
225 MenuItem { popupContent, $"Build", b, NotifySelect = ProjectBuild }.disabled = buildMenuUnavailable;
226 MenuItem { popupContent, $"Relink", l, NotifySelect = ProjectLink }.disabled = buildMenuUnavailable;
227 MenuItem { popupContent, $"Rebuild", r, NotifySelect = ProjectRebuild }.disabled = buildMenuUnavailable;
228 MenuItem { popupContent, $"Clean", c, NotifySelect = ProjectClean }.disabled = buildMenuUnavailable;
229 MenuItem { popupContent, $"Regenerate Makefile", m, NotifySelect = ProjectRegenerate }.disabled = buildMenuUnavailable;
230 MenuDivider { popupContent };
232 MenuItem { popupContent, $"New File...", l, Key { l, ctrl = true }, NotifySelect = ProjectNewFile };
233 MenuItem { popupContent, $"New Folder...", n, Key { f, ctrl = true }, NotifySelect = ProjectNewFolder };
234 MenuItem { popupContent, $"Import Folder...", i, NotifySelect = ProjectImportFolder };
235 MenuItem { popupContent, $"Add Files to Project...", f, NotifySelect = ProjectAddFiles };
236 MenuDivider { popupContent };
237 MenuItem { popupContent, $"Add New Form...", o, NotifySelect = ProjectAddNewForm };
238 // MenuItem { popupContent, "Add New Behavior Graph...", g, NotifySelect = ProjectAddNewGraph };
239 MenuDivider { popupContent };
240 if(node != ((Project)workspace.projects.first).topNode)
242 MenuItem { popupContent, $"Remove project from workspace", r, NotifySelect = ProjectRemove }.disabled = buildMenuUnavailable;
243 MenuDivider { popupContent };
245 MenuItem { popupContent, $"Active Configuration...", s, Key { f5, alt = true } , NotifySelect = MenuConfig };
246 MenuItem { popupContent, $"Settings...", s, Key { f7, alt = true } , NotifySelect = MenuSettings };
247 MenuDivider { popupContent };
248 MenuItem { popupContent, $"Browse Folder", w, NotifySelect = MenuBrowseFolder };
249 MenuDivider { popupContent };
250 MenuItem { popupContent, $"Save", v, Key { s, ctrl = true }, NotifySelect = ProjectSave }.disabled = !node.modified;
251 MenuDivider { popupContent };
252 MenuItem { popupContent, $"Properties...", p, Key { enter, alt = true }, NotifySelect = FileProperties };
254 else if(node.type == resources)
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, $"Add Resources to Project...", f, NotifySelect = ResourcesAddFiles };
259 MenuItem { popupContent, $"Browse Folder", w, NotifySelect = MenuBrowseFolder };
260 MenuDivider { popupContent };
261 MenuItem { popupContent, $"Settings...", s, Key { f7, alt = true } , NotifySelect = MenuSettings };
262 MenuItem { popupContent, $"Properties...", p, Key { enter, alt = true }, NotifySelect = FileProperties };
264 else if(node.type == file)
266 MenuItem { popupContent, $"Open", o, NotifySelect = FileOpenFile };
267 MenuItem { popupContent, $"Compile", c, Key { f7, ctrl = true}, NotifySelect = FileCompile }.disabled = buildMenuUnavailable;
268 MenuDivider { popupContent };
269 MenuItem { popupContent, $"Remove", r, NotifySelect = FileRemoveFile };
270 MenuDivider { popupContent };
271 MenuItem { popupContent, $"Browse Folder", w, NotifySelect = MenuBrowseFolder };
272 MenuDivider { popupContent };
273 MenuItem { popupContent, $"Settings...", s, Key { f7, alt = true } , NotifySelect = MenuSettings };
274 MenuItem { popupContent, $"Properties..", p, Key { enter, alt = true }, NotifySelect = FileProperties };
276 else if(node.type == folder)
278 bool isInResources = node.isInResources;
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, $"Import Folder...", i, NotifySelect = ProjectImportFolder };
285 MenuItem { popupContent, $"Add Resources to Folder...", f, NotifySelect = ResourcesAddFiles };
289 MenuItem { popupContent, $"Add Files to Folder...", f, NotifySelect = ProjectAddFiles };
293 MenuDivider { popupContent };
294 MenuItem { popupContent, $"Add New Form...", o, NotifySelect = ProjectAddNewForm };
295 MenuItem { popupContent, $"Add New Behavior Graph...", g, NotifySelect = ProjectAddNewGraph };
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 };
308 master = this, menu = popupContent;
310 x + clientStart.x + absPosition.x - app.desktop.position.x,
311 y + clientStart.y + absPosition.y - app.desktop.position.y };
319 bool NotifyKeyDown(ListBox listBox, DataRow row, Key key, unichar ch)
323 ProjectNode node = (ProjectNode)row.tag;
326 case altEnter: case Key { keyPadEnter, alt = true }:
328 NodeProperties { parent = parent, master = this,
329 position = { position.x + 100, position.y + 100 }, node = node }.Create();
332 case enter: case keyPadEnter:
335 for(resNode = node.parent; resNode; resNode = resNode.parent)
336 if(resNode.type == resources)
338 if(node.type == project || (node.type == folder && !resNode))
343 else if(node.type == resources || node.type == folder)
352 if(node.type == project || node.type == folder || node.type == resources)
361 if(node.type == project || node.type == folder || node.type == resources)
363 NewFolder(node, null, true);
370 if(node.type == file)
372 FileCompile(null, (Modifiers)key);
377 case Key { space, shift = true }:
380 if(node.type == NodeTypes::project)
383 for(p : workspace.projects)
385 if(p.topNode == node)
391 prj.RotateActiveConfig(!key.shift);
402 case enter: case keyPadEnter: OpenSelectedNodes(); break;
403 case del: RemoveSelectedNodes(); break;
406 Window activeClient = ide.activeClient;
408 activeClient.Activate();
410 ide.RepositionWindows(true);
417 bool NotifyCollapse(ListBox listBox, DataRow row, bool collapsed)
419 ProjectNode node = (ProjectNode)row.tag;
420 if(node.type == folder)
421 node.icon = collapsed ? folder : openFolder;
426 FileDialog importFileDialog { autoCreate = false, type = selectDir, text = $"Import Folder" };
427 FileDialog projectFileDialog
429 autoCreate = false, filters = projectFilters.array, sizeFilters = projectFilters.count * sizeof(FileFilter);
430 types = projectTypes.array, sizeTypes = projectTypes.count * sizeof(FileType);
432 FileDialog fileDialog
434 autoCreate = false, mayNotExist = true, filters = fileFilters.array, sizeFilters = fileFilters.count * sizeof(FileFilter);
435 types = fileTypes.array, sizeTypes = fileTypes.count * sizeof(FileType);
437 FileDialog resourceFileDialog
439 autoCreate = false, mayNotExist = true, filters = resourceFilters.array, sizeFilters = resourceFilters.count * sizeof(FileFilter);
440 types = fileTypes.array, sizeTypes = fileTypes.count * sizeof(FileType);
443 Menu fileMenu { menu, $"File", f };
444 MenuItem { fileMenu, $"Save", s, Key { s, ctrl = true }, NotifySelect = MenuFileSave };
445 // MenuItem { fileMenu, "Save As...", a, NotifySelect = MenuFileSaveAs };
447 bool OnClose(bool parentClosing)
449 if(!parentClosing && visible)
461 //if(ide.findInFilesDialog && ide.findInFilesDialog.created && ide.findInFilesDialog.mode != directory)
462 // ide.findInFilesDialog.SearchStop();
464 ide.outputView.buildBox.Clear();
465 ide.outputView.debugBox.Clear();
466 //ide.outputView.findBox.Clear();
467 ide.callStackView.Clear();
468 ide.watchesView.Clear();
469 ide.threadsView.Clear();
470 ide.breakpointsView.Clear();
471 ide.outputView.ShowClearSelectTab(find); // why this?
474 bool OnSaveFile(char * fileName)
476 for(prj : ide.workspace.projects)
478 if(prj.topNode.modified && prj.Save(prj.filePath))
480 // ProjectUpdateMakefileForAllConfigs(prj, true, true);
481 prj.topNode.modified = false;
484 modifiedDocument = false;
489 bool IsModuleInProject(char * filePath)
491 char moduleName[MAX_FILENAME]; //, modulePath[MAX_LOCATION];
492 GetLastDirectory(filePath, moduleName);
493 return project.topNode.Find(moduleName, false) != null;
496 bool GetRelativePath(char * filePath, char * relativePath)
498 return project.GetRelativePath(filePath, relativePath);
501 ProjectNode GetNodeFromWindow(Window document, Project project)
503 if(document.fileName)
505 char winFileName[MAX_LOCATION];
506 char * documentFileName = GetSlashPathBuffer(winFileName, document.fileName);
507 for(p : ide.workspace.projects)
509 Project prj = project ? project : p;
511 char moduleName[MAX_FILENAME], modulePath[MAX_LOCATION];
512 GetLastDirectory(document.fileName, moduleName);
514 if((node = prj.topNode.Find(moduleName, false)))
516 strcpy(modulePath, prj.topNode.path);
517 PathCatSlash(modulePath, node.path);
518 PathCatSlash(modulePath, node.name);
519 if(!fstrcmp(documentFileName, modulePath))
530 // ((( UTILITY FUNCTIONS )))
532 // ************************************************************************
533 // *** These methods below are part of a sequence of events, and as ***
534 // *** such they must be passed the current compiler and project config ***
535 // ************************************************************************
536 bool DisplayCompiler(CompilerConfig compiler, bool cleanLog)
538 ShowOutputBuildLog(cleanLog);
539 ide.outputView.buildBox.Logf($"%s Compiler\n", compiler ? compiler.name : $"{problem with compiler selection}");
542 bool ProjectPrepareForToolchain(Project project, PrepareMakefileMethod method, bool cleanLog, bool displayCompiler,
543 CompilerConfig compiler, ProjectConfig config)
546 char message[MAX_F_STRING];
547 LogBox logBox = ide.outputView.buildBox;
549 ShowOutputBuildLog(cleanLog);
552 DisplayCompiler(compiler, false);
554 ProjectPrepareMakefile(project, method, false, false, compiler, config);
558 bool ProjectPrepareMakefile(Project project, PrepareMakefileMethod method, bool cleanLog, bool displayCompiler,
559 CompilerConfig compiler, ProjectConfig config)
561 char makefilePath[MAX_LOCATION];
562 char makefileName[MAX_LOCATION];
564 LogBox logBox = ide.outputView.buildBox;
566 ShowOutputBuildLog(cleanLog);
569 DisplayCompiler(compiler, false);
571 strcpy(makefilePath, project.topNode.path);
572 project.CatMakeFileName(makefileName, compiler, config);
573 PathCatSlash(makefilePath, makefileName);
575 exists = FileExists(makefilePath);
576 if((method == normal && (!exists || config.makingModified/*|| project.topNode.modified*/)) ||
577 (method == forceExists && exists) ||
578 method == force) // || config.makingModified || makefileDirty
582 ide.statusBar.text = $"Generating Makefile & Dependencies..."; // Dependencies?
585 if((method == normal && !exists) || (method == force && !exists))
586 action = $"Generating ";
587 else if(method == force)
588 action = $"Regenerating ";
589 else if(method == normal || method == forceExists)
590 action = $"Updating ";
594 reason = $"Makefile doesn't exist. ";
595 else if(project.topNode.modified)
596 reason = $"Project has been modified. ";
600 //logBox.Logf("%s\n", makefileName);
601 logBox.Logf($"%s - %s%smakefile for %s config...\n", makefileName, reason, action, GetConfigName(config));
602 project.GenerateMakefile(null, false, null, compiler, config);
604 ide.statusBar.text = null;
611 bool BuildInterrim(Project prj, BuildType buildType, CompilerConfig compiler, ProjectConfig config)
613 if(ProjectPrepareForToolchain(prj, normal, true, true, compiler, config))
615 ide.outputView.buildBox.Logf($"Building project %s using the %s configuration...\n", prj.name, GetConfigName(config));
616 return Build(prj, buildType, compiler, config);
621 bool Build(Project prj, BuildType buildType, CompilerConfig compiler, ProjectConfig config)
627 for(document = master.firstChild; document; document = document.next)
629 if(document.modifiedDocument)
631 ProjectNode node = GetNodeFromWindow(document, prj);
632 if(node && !document.MenuFileSave(null, 0))
641 DirExpression targetDir = prj.GetTargetDir(compiler, config);
643 // TOFIX: DebugStop is being abused and backfiring on us.
644 // It's supposed to be the 'Debug/Stop' item, not unloading executable or anything else
646 // configIsInDebugSession seems to be used for two OPPOSITE things:
647 // If we're debugging another config, we need to unload the executable!
648 // In building, we want to stop if we're debugging the 'same' executable
649 if(buildType != run) ///* && prj == project*/ && prj.configIsInDebugSession)
651 if(buildType == start || buildType == restart)
653 if(ide.debugger && ide.debugger.isPrepared)
660 if(ide.project == prj && ide.debugger && ide.debugger.prjConfig == config && ide.debugger.isPrepared)
667 // TODO: Disabled until problems fixed... is it fixed?
668 if(buildType == rebuild || (config && config.compilingModified))
669 prj.Clean(compiler, config);
672 if(buildType == relink || (config && config.linkingModified))
674 char target[MAX_LOCATION];
676 strcpy(target, prj.topNode.path);
677 PathCat(target, targetDir.dir);
678 prj.CatTargetFileName(target, compiler, config);
679 if(FileExists(target))
682 if(config && config.symbolGenModified)
684 DirExpression objDir = prj.GetObjDir(compiler, config);
685 char fileName[MAX_LOCATION];
686 char moduleName[MAX_FILENAME];
687 strcpy(fileName, prj.topNode.path);
688 PathCatSlash(fileName, objDir.dir);
689 strcpy(moduleName, prj.moduleName);
690 strcat(moduleName, ".main.ec");
691 PathCatSlash(fileName, moduleName);
692 if(FileExists(fileName))
693 DeleteFile(fileName);
694 ChangeExtension(fileName, "c", fileName);
695 if(FileExists(fileName))
696 DeleteFile(fileName);
697 ChangeExtension(fileName, "o", fileName);
698 if(FileExists(fileName))
699 DeleteFile(fileName);
704 buildInProgress = prj == project ? buildingMainProject : buildingSecondaryProject;
705 ide.AdjustBuildMenus();
706 ide.AdjustDebugMenus();
708 result = prj.Build(buildType == run, null, compiler, config);
712 config.compilingModified = false;
713 if(!ide.ShouldStopBuild())
714 config.linkingModified = false;
716 config.symbolGenModified = false;
718 buildInProgress = none;
719 ide.AdjustBuildMenus();
720 ide.AdjustDebugMenus();
722 ide.workspace.modified = true;
729 // ((( USER ACTIONS )))
731 // ************************************************************************
732 // *** Methods below should atomically start a process, and as such ***
733 // *** they can query compiler and config directly from ide and project ***
734 // *** but ONLY ONCE!!! ***
735 // ************************************************************************
737 bool ProjectBuild(MenuItem selection, Modifiers mods)
739 Project prj = project;
740 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
741 ProjectConfig config;
742 if(selection || !ide.activeClient || activeClient == this)
744 DataRow row = fileList.currentRow;
745 ProjectNode node = row ? (ProjectNode)row.tag : null;
746 if(node) prj = node.project;
748 // Added this code here until dependencies work:
749 else //if(ide.activeClient)
751 ProjectNode node = GetNodeFromWindow(ide.activeClient, null);
756 if(/*prj != project || */!prj.GetConfigIsInDebugSession(config) || !ide.DontTerminateDebugSession($"Project Build"))
758 BuildInterrim(prj, build, compiler, config);
764 bool ProjectLink(MenuItem selection, Modifiers mods)
766 Project prj = project;
767 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
768 ProjectConfig config;
769 if(selection || !ide.activeClient || activeClient == this)
771 DataRow row = fileList.currentRow;
772 ProjectNode node = row ? (ProjectNode)row.tag : null;
773 if(node) prj = node.project;
775 // Added this code here until dependencies work:
776 else //if(ide.activeClient)
778 ProjectNode node = GetNodeFromWindow(ide.activeClient, null);
783 if(ProjectPrepareForToolchain(prj, normal, true, true, compiler, config))
785 ide.outputView.buildBox.Logf($"Relinking project %s using the %s configuration...\n", prj.name, GetConfigName(config));
787 config.linkingModified = true;
788 Build(prj, relink, compiler, config);
794 bool ProjectRebuild(MenuItem selection, Modifiers mods)
796 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
797 Project prj = GetSelectedProject((bool)selection);
798 ProjectConfig config = prj.config;
799 if(ProjectPrepareForToolchain(prj, normal, true, true, compiler, config))
801 ide.outputView.buildBox.Logf($"Rebuilding project %s using the %s configuration...\n", prj.name, GetConfigName(config));
804 config.compilingModified = true;
805 config.makingModified = true;
806 }*/ // -- should this still be used depite the new solution of BuildType?
807 Build(prj, rebuild, compiler, config);
813 bool ProjectClean(MenuItem selection, Modifiers mods)
815 Project prj = GetSelectedProject((bool)selection);
816 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
817 ProjectConfig config = prj.config;
818 if(ProjectPrepareForToolchain(prj, normal, true, true, compiler, config))
820 ide.outputView.buildBox.Logf($"Cleaning project %s using the %s configuration...\n", prj.name, GetConfigName(config));
822 buildInProgress = prj == project ? buildingMainProject : buildingSecondaryProject;
823 ide.AdjustBuildMenus();
825 prj.Clean(compiler, config);
826 buildInProgress = none;
827 ide.AdjustBuildMenus();
833 bool ProjectRegenerate(MenuItem selection, Modifiers mods)
835 Project prj = project;
836 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
837 if(selection || !ide.activeClient || activeClient == this)
839 DataRow row = fileList.currentRow;
840 ProjectNode node = row ? (ProjectNode)row.tag : null;
844 // Added this code here until dependencies work:
845 else //if(ide.activeClient)
847 ProjectNode node = GetNodeFromWindow(ide.activeClient, null);
852 ProjectPrepareMakefile(prj, force, true, true, compiler, prj.config);
857 void Compile(ProjectNode node)
859 char fileName[MAX_LOCATION];
860 char extension[MAX_EXTENSION];
862 Project prj = node.project;
863 ProjectConfig config = prj.config;
864 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
865 DirExpression objDir = prj.GetObjDir(compiler, config);
867 strcpy(fileName, prj.topNode.path);
868 PathCatSlash(fileName, objDir.dir);
869 PathCatSlash(fileName, node.name);
870 StripExtension(fileName);
871 strcat(fileName, ".o");
872 if(FileExists(fileName))
873 DeleteFile(fileName);
875 GetExtension(node.name, extension);
876 if(!strcmp(extension, "ec"))
878 // Delete generated C file
879 strcpy(fileName, prj.topNode.path);
880 PathCat(fileName, objDir.dir);
881 PathCat(fileName, node.name);
882 StripExtension(fileName);
883 strcat(fileName, ".c");
884 if(FileExists(fileName))
885 DeleteFile(fileName);
887 // Delete symbol file
888 strcpy(fileName, prj.topNode.path);
889 PathCat(fileName, node.path);
890 PathCat(fileName, node.name);
891 StripExtension(fileName);
892 strcat(fileName, ".sym");
893 if(FileExists(fileName))
894 DeleteFile(fileName);
899 // Check if we have to save
900 strcpy(fileName, prj.topNode.path);
901 PathCatSlash(fileName, node.path);
902 PathCatSlash(fileName, node.name);
903 for(document = ide.firstChild; document; document = document.next)
905 if(document.modifiedDocument)
907 char documentFileName[MAX_LOCATION];
908 if(!fstrcmp(GetSlashPathBuffer(documentFileName, document.fileName), fileName))
909 if(!document.MenuFileSave(null, 0))
914 if(ProjectPrepareForToolchain(prj, normal, true, true, compiler, config))
916 if(!node.GetIsExcluded(config))
918 buildInProgress = compilingFile;
919 ide.AdjustBuildMenus();
921 //ide.outputView.ShowClearSelectTab(build);
922 // this stuff doesn't even appear
923 //ide.outputView.buildBox.Logf($"%s Compiler\n", compiler.name);
925 ide.outputView.buildBox.Logf($"Compiling single file %s in project %s using the %s configuration...\n", node.name, prj.name, config.name);
927 ide.outputView.buildBox.Logf($"Compiling single file %s in project %s...\n", node.name, prj.name);
929 prj.Compile(node, compiler, config);
930 buildInProgress = none;
931 ide.AdjustBuildMenus();
934 ide.outputView.buildBox.Logf($"File %s is excluded from current build configuration.\n", node.name);
940 bool ProjectNewFile(MenuItem selection, Modifiers mods)
942 DataRow row = fileList.currentRow;
946 char filePath[MAX_LOCATION];
947 ProjectNode parentNode = (ProjectNode)row.tag;
948 ProjectNode n, fileNode;
949 parentNode.GetFileSysMatchingPath(filePath);
950 MakePathRelative(filePath, parentNode.project.topNode.path, filePath);
951 for(n = parentNode; n && n != parentNode.project.resNode; n = n.parent);
952 sprintf(fileName, $"Untitled %d", documentID);
953 fileNode = AddFile(parentNode, fileName, (bool)n, true);
954 fileNode.path = CopyUnixPath(filePath);
957 NodeProperties nodeProperties
960 position = { position.x + 100, position.y + 100 };
964 nodeProperties.Create(); // not modal?
970 bool ProjectNewFolder(MenuItem selection, Modifiers mods)
972 DataRow row = fileList.currentRow;
975 ProjectNode parentNode = (ProjectNode)row.tag;
976 NewFolder(parentNode, null, true);
981 bool ResourcesAddFiles(MenuItem selection, Modifiers mods)
987 bool ProjectAddFiles(MenuItem selection, Modifiers mods)
993 bool ProjectImportFolder(MenuItem selection, Modifiers mods)
995 DataRow row = fileList.currentRow;
998 ProjectNode toNode = (ProjectNode)row.tag;
999 ImportFolder(toNode);
1004 bool ProjectAddNewForm(MenuItem selection, Modifiers mods)
1006 CodeEditor codeEditor = CreateNew("Form", "form", "Window", null);
1007 codeEditor.EnsureUpToDate();
1011 bool ProjectAddNewGraph(MenuItem selection, Modifiers mods)
1013 CodeEditor codeEditor = CreateNew("Graph", "graph", "Block", null);
1015 codeEditor.EnsureUpToDate();
1019 bool ProjectRemove(MenuItem selection, Modifiers mods)
1021 DataRow row = fileList.currentRow;
1024 ProjectNode node = (ProjectNode)row.tag;
1025 if(node.type == project)
1026 RemoveSelectedNodes();
1031 bool ProjectUpdateMakefileForAllConfigs(Project project, bool cleanLog, bool displayCompiler)
1033 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
1034 ShowOutputBuildLog(cleanLog);
1037 DisplayCompiler(compiler, false);
1039 for(config : project.configurations)
1041 ProjectPrepareMakefile(project, forceExists, false, false,
1049 bool MenuConfig(MenuItem selection, Modifiers mods)
1051 if(ProjectActiveConfig { parent = parent.parent, master = parent, project = project }.Modal() == ok)
1056 bool MenuCompiler(MenuItem selection, Modifiers mods)
1058 ActiveCompilerDialog compilerDialog
1060 parent = parent.parent, master = parent;
1061 ideSettings = ideSettings, workspaceActiveCompiler = ide.workspace.compiler;
1063 incref compilerDialog;
1064 if(compilerDialog.Modal() == ok && strcmp(compilerDialog.workspaceActiveCompiler, ide.workspace.compiler))
1066 ide.workspace.compiler = compilerDialog.workspaceActiveCompiler;
1067 for(prj : ide.workspace.projects)
1068 ide.projectView.ProjectUpdateMakefileForAllConfigs(prj, true, true);
1070 delete compilerDialog;
1074 bool MenuSettings(MenuItem selection, Modifiers mods)
1076 ProjectNode node = GetSelectedNode(true);
1077 Project prj = node ? node.project : project;
1078 projectSettingsDialog = ProjectSettings { parent = parent.parent, master = parent, project = prj, projectNode = node };
1079 projectSettingsDialog.Modal();
1086 bool FileProperties(MenuItem selection, Modifiers mods)
1088 DataRow row = fileList.currentRow;
1091 ProjectNode node = (ProjectNode)row.tag;
1092 NodeProperties { parent = parent, master = this, node = node,
1093 position = { position.x + 100, position.y + 100 } }.Create();
1098 bool FileOpenFile(MenuItem selection, Modifiers mods)
1100 OpenSelectedNodes();
1104 bool FileRemoveFile(MenuItem selection, Modifiers mods)
1106 RemoveSelectedNodes();
1110 bool FileCompile(MenuItem selection, Modifiers mods)
1112 DataRow row = fileList.currentRow;
1115 ProjectNode node = (ProjectNode)row.tag;
1121 Project GetSelectedProject(bool useSelection)
1123 Project prj = project;
1126 DataRow row = fileList.currentRow;
1127 ProjectNode node = row ? (ProjectNode)row.tag : null;
1134 ProjectNode GetSelectedNode(bool useSelection)
1136 ProjectNode node = null;
1139 DataRow row = fileList.currentRow;
1141 node = (ProjectNode)row.tag;
1146 bool MenuBrowseFolder(MenuItem selection, Modifiers mods)
1148 char folder[MAX_LOCATION];
1150 ProjectNode node = GetSelectedNode(true);
1152 node = project.topNode;
1155 strcpy(folder, prj.topNode.path);
1156 if(node != prj.topNode)
1157 PathCatSlash(folder, node.path);
1161 bool Run(MenuItem selection, Modifiers mods)
1163 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
1164 ProjectConfig config = project.config;
1165 String args = new char[maxPathLen];
1167 if(ide.workspace.commandLineArgs)
1168 //ide.debugger.GetCommandLineArgs(args);
1169 strcpy(args, ide.workspace.commandLineArgs);
1170 if(ide.debugger.isActive)
1171 project.Run(args, compiler, config);
1172 /*else if(config.targetType == sharedLibrary || config.targetType == staticLibrary)
1173 MessageBox { master = ide, type = ok, text = "Run", contents = "Shared and static libraries cannot be run like executables." }.Modal();*/
1174 else if(BuildInterrim(project, run, compiler, config))
1175 project.Run(args, compiler, config);
1183 bool result = false;
1184 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
1185 ProjectConfig config = project.config;
1186 TargetTypes targetType = project.GetTargetType(config);
1187 if(targetType == sharedLibrary || targetType == staticLibrary)
1188 MessageBox { master = ide, type = ok, text = $"Run", contents = $"Shared and static libraries cannot be run like executables." }.Modal();
1189 else if(project.GetCompress(config))
1190 MessageBox { master = ide, text = $"Starting Debug", contents = $"Debugging compressed applications is not supported\n" }.Modal();
1191 else if(project.GetDebug(config) ||
1192 MessageBox { master = ide, type = okCancel, text = $"Starting Debug", contents = $"Attempting to debug non-debug configuration\nProceed anyways?" }.Modal() == ok)
1194 if(/*!IsProjectModified() ||*/ BuildInterrim(project, start, compiler, config))
1196 if(compiler.type.isVC)
1198 //bool result = false;
1199 char oldwd[MAX_LOCATION];
1200 PathBackup pathBackup { };
1201 char command[MAX_LOCATION];
1203 ide.SetPath(false, compiler, config);
1205 GetWorkingDir(oldwd, sizeof(oldwd));
1206 ChangeWorkingDir(project.topNode.path);
1208 sprintf(command, "%s /useenv %s.sln /projectconfig \"%s|Win32\" /command \"%s\"" , "devenv", project.name, config.name, "Debug.Start");
1209 //ide.outputView.buildBox.Logf("command: %s\n", command);
1211 ChangeWorkingDir(oldwd);
1217 ide.debugger.Start(compiler, config);
1226 void GoToError(const char * line)
1230 while(isspace(*line)) line++;
1231 colon = strstr(line, ":");
1236 bool lookForLineNumber = true;
1238 // deal with linking error
1239 if(colon && colon[1] == ' ')
1241 colon = strstr(colon + 1, ":");
1242 if(colon && !colon[1])
1244 colon = strstr(line, ":");
1245 lookForLineNumber = false;
1247 else if(colon && !isdigit(colon[1]))
1250 colon = strstr(line, ":");
1253 // Don't be mistaken by the drive letter colon
1254 if(colon && (colon[1] == '/' || colon[1] == '\\'))
1255 colon = strstr(colon + 1, ":");
1256 if(colon && lookForLineNumber)
1260 char * par = RSearchString(line, "(", colon - line, true, false);
1261 if(par && strstr(par, ")"))
1263 else if((colon+1)[0] == ' ')
1265 // NOTE: This is the same thing as saying 'colon = line'
1266 for( ; colon != line; colon--)
1270 lineNumber = atoi(colon + 1);
1272 comma = strchr(colon, ',');
1274 col = atoi(comma+1);
1276 comma = strchr(colon+1, ':');
1278 col = atoi(comma+1);
1282 char moduleName[MAX_LOCATION], filePath[MAX_LOCATION];
1287 strncpy(moduleName, line, colon - line);
1288 moduleName[colon - line] = '\0';
1291 strcpy(moduleName, line);
1293 // Remove stuff in brackets
1295 bracket = strstr(moduleName, "(");
1296 if(bracket) *bracket = '\0';
1298 MakeSlashPath(moduleName);
1302 // Check if it's one of our modules
1303 ProjectNode node = project.topNode.Find(moduleName, false);
1306 strcpy(moduleName, node.path);
1307 PathCatSlash(moduleName, node.name);
1310 moduleName[0] = '\0';
1314 CodeEditor codeEditor;
1315 strcpy(filePath, project.topNode.path);
1316 PathCatSlash(filePath, moduleName);
1318 codeEditor = (CodeEditor)ide.OpenFile(filePath, normal, true, null, no, normal);
1321 char name[MAX_LOCATION];
1322 // TOFIX: Improve on this, don't use only filename, make a function
1323 if(ide && ide.workspace)
1325 for(prj : ide.workspace.projects)
1327 if(prj.topNode.FindWithPath(moduleName, false))
1329 strcpy(filePath, prj.topNode.path);
1330 PathCatSlash(filePath, moduleName);
1331 codeEditor = (CodeEditor)ide.OpenFile(filePath, normal, true, null, no, normal);
1338 if(codeEditor && lineNumber)
1340 EditBox editBox = codeEditor.editBox;
1341 editBox.GoToLineNum(lineNumber - 1);
1342 editBox.GoToPosition(editBox.line, lineNumber - 1, col ? (col - 1) : 0);
1349 bool OpenNode(ProjectNode node)
1351 char filePath[MAX_LOCATION];
1352 node.GetFullFilePath(filePath);
1353 return ide.OpenFile(filePath, normal, true/*false Why was it opening hidden?*/, null, something, normal) ? true : false;
1356 void AddNode(ProjectNode node, DataRow addTo)
1358 DataRow row = addTo ? addTo.AddRow() : fileList.AddRow();
1360 row.tag = (int)node;
1363 if(node.type == resources)
1366 row.SetData(null, node);
1368 if(node.files && node.files.first && node.parent &&
1369 !(!node.parent.parent &&
1370 (!strcmpi(node.name, "notes") || !strcmpi(node.name, "sources") ||
1371 !strcmpi(node.name, "src") || !strcmpi(node.name, "tools"))))
1372 row.collapsed = true;
1373 else if(node.type == folder)
1374 node.icon = openFolder;
1378 for(child : node.files)
1379 AddNode(child, row);
1383 void DeleteNode(ProjectNode projectNode)
1385 if(projectNode.files)
1388 while(child = projectNode.files.first)
1391 fileList.DeleteRow(projectNode.row);
1392 projectNode.Delete();
1395 bool ProjectSave(MenuItem selection, Modifiers mods)
1397 DataRow row = fileList.currentRow;
1398 ProjectNode node = row ? (ProjectNode)row.tag : null;
1399 Project prj = node ? node.project : null;
1402 if(prj.Save(prj.filePath))
1404 // ProjectUpdateMakefileForAllConfigs(prj, true, true);
1405 prj.topNode.modified = false;
1407 for(p : ide.workspace.projects)
1409 if(p.topNode.modified)
1416 modifiedDocument = false;
1423 bool ShowOutputBuildLog(bool cleanLog)
1425 OutputView output = ide.outputView;
1427 output.ShowClearSelectTab(build);
1430 output.SelectTab(build);
1437 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
1438 ProjectConfig config = project.config;
1440 bool result = false;
1441 if(/*!IsProjectModified() ||*/ BuildInterrim(project, restart, compiler, config))
1443 // For Restart, compiler and config will only be used if for
1444 // whatever reason (if at all possible) the Debugger is in a
1445 // 'terminated' or 'none' state
1446 ide.debugger.Restart(compiler, config);
1456 ide.debugger.Resume();
1462 ide.debugger.Break();
1468 ide.debugger.Stop();
1472 bool DebugStepInto()
1474 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
1475 ProjectConfig config = project.config;
1477 if((ide.debugger.isActive) || (!buildInProgress && BuildInterrim(project, start, compiler, config)))
1478 ide.debugger.StepInto(compiler, config);
1483 bool DebugStepOver(bool skip)
1485 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
1486 ProjectConfig config = project.config;
1488 if((ide.debugger.isActive) || (!buildInProgress && BuildInterrim(project, start, compiler, config)))
1489 ide.debugger.StepOver(compiler, config, skip);
1495 bool DebugStepOut(bool skip)
1497 ide.debugger.StepOut(skip);
1501 void ImportFolder(ProjectNode toNode)
1505 //bool isFolder = toNode.type == folder;
1506 //bool isRes = toNode.isInResources;
1508 FileDialog fileDialog = importFileDialog;
1509 fileDialog.master = parent;
1510 if(fileDialog.Modal() == ok)
1512 ImportFolderFSI fsi { projectView = this };
1513 fsi.stack.Add(toNode);
1514 fsi.Iterate(fileDialog.filePath);
1520 ProjectNode NewFolder(ProjectNode parentNode, char * name, bool showProperties)
1524 ProjectNode folderNode;
1525 Project prj = parentNode.project;
1527 ProjectNode after = null;
1528 for(node : parentNode.files)
1530 if(node.type != folder)
1536 folderNode = parentNode.Add(prj, name, after, folder, folder, true);
1539 for(c = 0; c < 100; c++)
1542 sprintf(string, c ? "New Folder (%d)" : "New Folder", c);
1543 if((folderNode = parentNode.Add(prj, string, after, folder, folder, true)))
1550 NodeProperties nodeProperties;
1553 modifiedDocument = true;
1554 prj.topNode.modified = true;
1557 folderNode.row = parentNode.row.AddRowAfter(after ? after.row : null);
1558 folderNode.row.tag = (int)folderNode;
1560 folderNode.row.SetData(null, folderNode);
1561 fileList.currentRow = folderNode.row;
1565 nodeProperties = NodeProperties
1567 parent, this, mode = newFolder, node = folderNode;
1568 position = { position.x + 100, position.y + 100 };
1570 nodeProperties.Create(); // Modal?
1578 void AddFiles(bool resources)
1580 FileDialog fileDialog = (!resources) ? this.fileDialog : resourceFileDialog;
1581 fileDialog.type = multiOpen;
1582 fileDialog.text = !resources ? $"Add Files to Project" : $"Add Resources to Project";
1583 fileDialog.master = parent;
1585 if(fileDialog.Modal() == ok)
1588 DataRow row = fileList.currentRow;
1589 ProjectNode parentNode = (ProjectNode)row.tag;
1590 bool addFailed = false;
1591 int numSelections = fileDialog.numSelections;
1592 char ** multiFilePaths = fileDialog.multiFilePaths;
1594 Array<String> nameConflictFiles { };
1596 for(c = 0; c < numSelections; c++)
1598 char * filePath = multiFilePaths[c];
1599 FileAttribs exists = FileExists(filePath);
1600 bool addThisFile = true;
1602 if(exists.isDirectory)
1603 addThisFile = false;
1606 if(MessageBox { master = ide, type = yesNo, text = filePath,
1607 contents = $"File doesn't exist. Create?" }.Modal() == yes)
1609 File f = FileOpen(filePath, write);
1617 MessageBox { master = ide, type = ok, text = filePath,
1618 contents = $"Couldn't create file."}.Modal();
1619 addThisFile = false;
1626 /*addFailed = */if(!AddFile(parentNode, filePath, resources, false))//;
1628 nameConflictFiles.Add(CopyString(filePath));
1636 char * part1 = $"The following file";
1637 char * opt1 = $" was ";
1638 char * opt2 = $"s were ";
1639 char * part2 = $"not added because of identical file name conflict within the project.\n\n";
1641 len += strlen(part1);
1642 len += strlen(part2);
1643 len += nameConflictFiles.count > 1 ? strlen(opt2) : strlen(opt1);
1644 for(s : nameConflictFiles)
1645 len += strlen(s) + 1;
1646 message = new char[len + 1];
1647 strcpy(message, part1);
1648 strcat(message, nameConflictFiles.count > 1 ? opt2 : opt1);
1649 strcat(message, part2);
1650 for(s : nameConflictFiles)
1653 strcat(message, "\n");
1655 MessageBox { master = ide, type = ok, text = $"Name Conflict",
1656 contents = message }.Modal();
1659 nameConflictFiles.Free();
1660 delete nameConflictFiles;
1664 ProjectNode AddFile(ProjectNode parentNode, char * filePath, bool resources, bool isTemporary)
1666 ProjectNode result = null;
1667 ProjectNode after = null;
1668 for(node : parentNode.files)
1670 if(node.type != folder && node.type != file && node.type)
1675 result = parentNode.Add(parentNode.project, filePath, after, file, NodeIcons::SelectFileIcon(filePath), !resources);
1681 modifiedDocument = true;
1682 parentNode.project.topNode.modified = true;
1683 parentNode.project.ModifiedAllConfigs(true, false, true, true);
1686 result.row = parentNode.row.AddRowAfter(after ? after.row : null);
1687 result.row.tag = (int)result;
1688 result.row.SetData(null, result);
1693 CodeEditor CreateNew(char * upper, char * lower, char * base, char * className)
1695 CodeEditor codeEditor = null;
1696 ProjectNode projectNode;
1697 ProjectNode after = null;
1698 DataRow row = fileList.currentRow;
1699 ProjectNode parentNode;
1702 if(!row) row = project.topNode.row;
1704 parentNode = (ProjectNode)row.tag;
1706 for(node : parentNode.files)
1708 if(node.type != folder && node.type != file && node.type)
1712 for(c = 1; c < 100; c++)
1715 sprintf(string, c ? "%s%d.ec" : "%s.ec", lower, c);
1716 if((projectNode = parentNode.Add(project, string, after, file, genFile, true)))
1722 char filePath[MAX_LOCATION];
1724 modifiedDocument = true;
1725 project.topNode.modified = true;
1727 project.ModifiedAllConfigs(true, false, false, true);
1728 projectNode.row = parentNode.row.AddRowAfter(after ? after.row : null);
1729 projectNode.row.tag =(int)projectNode;
1731 projectNode.row.SetData(null, projectNode);
1732 fileList.currentRow = projectNode.row;
1734 strcpy(filePath, project.topNode.path);
1735 PathCat(filePath, projectNode.path);
1736 PathCat(filePath, projectNode.name);
1738 codeEditor = (CodeEditor)ide.FindWindow(filePath);
1741 Class baseClass = eSystem_FindClass(__thisModule, base);
1742 subclass(ClassDesignerBase) designerClass = eClass_GetDesigner(baseClass);
1745 codeEditor = (CodeEditor)ide.OpenFile(filePath, normal, false, null, whatever, normal);
1746 strcpy(name, projectNode.name);
1747 sprintf(name, "%s%d", upper, c);
1749 strcpy(className, name);
1751 designerClass.CreateNew(codeEditor.editBox, codeEditor.clientSize, name, base);
1753 //codeEditor.modifiedDocument = false;
1754 //codeEditor.designer.modifiedDocument = false;
1756 //Code_EnsureUpToDate(codeEditor);
1759 else // TODO: fix no symbols generated when ommiting {} for following else
1761 codeEditor = (CodeEditor)ide.OpenFile(filePath, normal, false, null, whatever, normal);
1765 codeEditor.ViewDesigner();
1766 codeEditor.codeModified = true;
1773 // Returns true if we opened something
1774 bool OpenSelectedNodes()
1776 bool result = false;
1780 fileList.GetMultiSelection(selection);
1781 for(item = selection.first; item; item = item.next)
1783 DataRow row = item.data;
1784 ProjectNode node = (ProjectNode)row.tag;
1785 if(node.type == file)
1792 selection.Free(null);
1796 void RemoveSelectedNodes()
1801 fileList.GetMultiSelection(selection);
1803 // Remove children of parents we're deleting
1804 for(item = selection.first; item; item = next)
1807 DataRow row = item.data;
1808 ProjectNode n, node = (ProjectNode)row.tag;
1809 bool remove = false;
1812 for(i = selection.first; i && !remove; i = i.next)
1814 ProjectNode iNode = (ProjectNode)((DataRow)i.data).tag;
1815 for(n = node.parent; n; n = n.parent)
1825 selection.Delete(item);
1828 for(item = selection.first; item; item = item.next)
1830 DataRow row = item.data;
1831 ProjectNode node = (ProjectNode)row.tag;
1832 ProjectNode resNode;
1833 for(resNode = node.parent; resNode; resNode = resNode.parent)
1834 if(resNode.type == resources)
1836 if(node.type == file)
1838 Project prj = node.project;
1840 modifiedDocument = true;
1841 prj.topNode.modified = true;
1843 prj.ModifiedAllConfigs(true, false, true, true);
1845 else if(node.type == folder)
1848 sprintf(message, $"Are you sure you want to remove the folder \"%s\"\n"
1849 "and all of its contents from the project?", node.name);
1850 if(MessageBox { master = ide, type = yesNo, text = $"Delete Folder", contents = message }.Modal() == yes)
1852 Project prj = node.project;
1853 if(node.containsFile)
1854 prj.ModifiedAllConfigs(true, false, true, true);
1856 modifiedDocument = true;
1857 prj.topNode.modified = true;
1860 else if(node.type == project && node != project.topNode && !buildInProgress)
1864 for(p : workspace.projects)
1866 if(p.topNode == node)
1872 sprintf(message, $"Are you sure you want to remove the \"%s\" project\n" "from this workspace?", node.name);
1873 if(MessageBox { master = ide, type = yesNo, text = $"Remove Project", contents = message }.Modal() == yes)
1878 workspace.RemoveProject(prj);
1879 //modifiedDocument = true; // when project view is a workspace view
1883 selection.Free(null);