2 public import static "ecere"
3 public import static "ec"
9 import "GlobalSettingsDialog"
10 import "NewProjectDialog"
11 import "FindInFilesDialog"
18 import "ProjectConfig"
20 import "NodeProperties"
21 import "ProjectSettings"
33 import "BreakpointsView"
34 import "CallStackView"
45 import "FileSystemIterator"
47 #if defined(__WIN32__)
48 define pathListSep = ";";
50 define pathListSep = ":";
53 define maxPathLen = 65 * MAX_LOCATION;
55 class PathBackup : struct
62 oldPath = new char[maxPathLen];
63 oldLDPath = new char[maxPathLen];
65 GetEnvironment("PATH", oldPath, maxPathLen);
66 #if defined(__APPLE__)
67 GetEnvironment("DYLD_LIBRARY_PATH", oldLDPath, maxPathLen);
69 GetEnvironment("LD_LIBRARY_PATH", oldLDPath, maxPathLen);
75 SetEnvironment("PATH", oldPath);
76 #if defined(__APPLE__)
77 SetEnvironment("DYLD_LIBRARY_PATH", oldLDPath);
79 SetEnvironment("LD_LIBRARY_PATH", oldLDPath);
86 enum OpenCreateIfFails { no, yes, something, whatever };
87 enum OpenMethod { normal, add };
89 static Array<FileFilter> fileFilters
91 { $"C/C++/eC Files (*.ec, *.eh, *.c, *.cpp, *.cc, *.cxx, *.h, *.hpp, *.hh, *.hxx)", "ec, eh, c, cpp, cc, cxx, h, hpp, hh, hxx" },
92 { $"Header Files for eC/C/C++ (*.eh, *.h, *.hpp, *.hh, *.hxx)", "eh, h, hpp, hh, hxx" },
93 { $"C/C++/eC Source Files (*.ec, *.c, *.cpp, *.cc, *.cxx)", "ec, c, cpp, cc, cxx" },
94 { $"Text files (*.txt, *.text, *.nfo, *.info)", "txt, text, nfo, info" },
95 { $"Web files (*.html, *.htm, *.xhtml, *.css, *.php, *.js, *.jsi, *.rb, *.xml)", "html, htm, xhtml, css, php, js, jsi, rb, xml" },
96 { $"Image Files (*.jpg, *.jpeg, *.bmp, *.pcx, *.png, *.gif)", "jpg, jpeg, bmp, pcx, png, gif" },
97 { $"3D Studio Model Files (*.3ds)", "3ds" },
98 { $"All files", null }
101 static Array<FileType> fileTypes
103 { $"Based on extension", null },
106 { $"3D Studio Model", "3ds" }
109 static Array<FileFilter> projectFilters
111 { $"Project Files (*.epj)", ProjectExtension }
114 static Array<FileType> projectTypes
116 { $"Project File", ProjectExtension }
119 static Array<FileFilter> findInFilesFileFilters
121 { $"eC Files (*.ec, *.eh)", "ec, eh" },
122 { $"C/C++/eC Files (*.ec, *.eh, *.c, *.cpp, *.cc, *.cxx, *.h, *.hpp, *.hh, *.hxx)", "ec, eh, c, cpp, cc, cxx, h, hpp, hh, hxx" },
123 { $"Header Files for eC/C/C++ (*.eh, *.h, *.hpp, *.hh, *.hxx)", "eh, h, hpp, hh, hxx" },
124 { $"C/C++/eC Source Files (*.ec, *.c, *.cpp, *.cc, *.cxx)", "ec, c, cpp, cc, cxx" },
125 { $"Text files (*.txt)", "txt" },
126 { $"All files", null }
129 FileDialog ideFileDialog
131 type = multiOpen, text = $"Open";
132 types = fileTypes.array, sizeTypes = fileTypes.count * sizeof(FileType), filters = fileFilters.array, sizeFilters = fileFilters.count * sizeof(FileFilter);
135 define openProjectFileDialogTitle = $"Open Project";
136 define addProjectFileDialogTitle = $"Open Additional Project";
137 FileDialog ideProjectFileDialog
140 types = projectTypes.array, sizeTypes = projectTypes.count * sizeof(FileType), filters = projectFilters.array, sizeFilters = projectFilters.count * sizeof(FileFilter);
143 GlobalSettingsDialog globalSettingsDialog
145 ideSettings = ideSettings;
146 settingsContainer = settingsContainer;
148 void OnGlobalSettingChange(GlobalSettingsChange globalSettingsChange)
150 switch(globalSettingsChange)
155 for(child = ide.firstChild; child; child = child.next)
157 if(child._class == class(CodeEditor))
159 CodeEditor codeEditor = (CodeEditor) child;
160 codeEditor.editBox.freeCaret = ideSettings.useFreeCaret;
161 // codeEditor.editBox.lineNumbers = ideSettings.showLineNumbers;
162 codeEditor.editBox.caretFollowsScrolling = ideSettings.caretFollowsScrolling;
163 codeEditor.OnPostCreate(); // Update editBox margin size
170 case compilerSettings:
172 ide.UpdateCompilerConfigs(true);
179 void DrawLineMarginIcon(Surface surface, BitmapResource resource, int line, int lineH, int scrollY, int boxH)
184 lineY = (line - 1) * lineH;
185 if(lineY + lineH > scrollY && lineY + lineH < scrollY + boxH)
187 Bitmap bitmap = resource.bitmap;
189 surface.Blit(bitmap, 0, lineY - scrollY + (lineH - bitmap.height) / 2 + 1, 0, 0, bitmap.width, bitmap.height);
194 #define IDEItem(x) (&((IDEWorkSpace)0).x)
196 class IDEToolbar : ToolBar
200 ToolButton buttonNewFile { this, toolTip = $"New file", menuItemPtr = IDEItem(fileNewItem) };
202 ToolButton buttonOpenFile { this, toolTip = $"Open file", menuItemPtr = IDEItem(fileOpenItem) };
204 // ToolButton buttonCloseFile { this, toolTip = $"Close file", menuItemPtr = IDEItem(fileCloseItem) };
206 ToolButton buttonSaveFile { this, toolTip = $"Save file", menuItemPtr = IDEItem(fileSaveItem) };
208 ToolButton buttonSaveAllFile { this, toolTip = $"Save all", menuItemPtr = IDEItem(fileSaveAllItem) };
210 ToolSeparator separator1 { this };
219 // ToolSeparator separator2 { this };
221 /* Project options */
223 ToolButton buttonNewProject { this, toolTip = $"New project", menuItemPtr = IDEItem(projectNewItem) };
225 ToolButton buttonOpenProject { this, toolTip = $"Open project", menuItemPtr = IDEItem(projectOpenItem) };
226 // Add project to workspace
227 ToolButton buttonAddProject { this, toolTip = $"Add project to workspace", menuItemPtr = IDEItem(projectAddItem), disabled = true; };
229 // ToolButton buttonCloseProject { this, toolTip = $"Close project", menuItemPtr = IDEItem(projectCloseItem), disabled = true; };
231 ToolSeparator separator3 { this };
233 /* Build/Execution options */
235 ToolButton buttonBuild { this, toolTip = $"Build project", menuItemPtr = IDEItem(projectBuildItem), disabled = true; };
237 ToolButton buttonReLink { this, toolTip = $"Relink project", menuItemPtr = IDEItem(projectLinkItem), disabled = true; };
239 ToolButton buttonRebuild { this, toolTip = $"Rebuild project", menuItemPtr = IDEItem(projectRebuildItem), disabled = true; };
241 ToolButton buttonClean { this, toolTip = $"Clean project", menuItemPtr = IDEItem(projectCleanItem), disabled = true; };
243 // ToolButton buttonRealClean { this, toolTip = $"Real clean project", menuItemPtr = IDEItem(projectRealCleanItem), disabled = true; };
244 // Regenerate Makefile
245 ToolButton buttonRegenerateMakefile { this, toolTip = $"Regenerate Makefile", menuItemPtr = IDEItem(projectRegenerateItem), disabled = true; };
246 // Compile actual file
248 ToolButton buttonRun { this, toolTip = $"Run", menuItemPtr = IDEItem(projectRunItem), disabled = true; };
249 #ifdef IDE_SHOW_INSTALL_MENU_BUTTON
250 ToolButton buttonInstall { this, toolTip = $"Install", menuItemPtr = IDEItem(projectInstallItem), disabled = true; };
253 ToolSeparator separator4 { this };
257 ToolButton buttonDebugStartResume { this, toolTip = $"Start", menuItemPtr = IDEItem(debugStartResumeItem), disabled = true; };
259 ToolButton buttonDebugRestart { this, toolTip = $"Restart", menuItemPtr = IDEItem(debugRestartItem), disabled = true; };
261 ToolButton buttonDebugPause { this, toolTip = $"Break", menuItemPtr = IDEItem(debugBreakItem), disabled = true; };
263 ToolButton buttonDebugStop { this, toolTip = $"Stop", menuItemPtr = IDEItem(debugStopItem), disabled = true; };
265 //ToolButton buttonRun { this, toolTip = $"Run", menuItemPtr = IDEItem(projectRunItem) };
267 ToolButton buttonDebugStepInto { this, toolTip = $"Step Into", menuItemPtr = IDEItem(debugStepIntoItem), disabled = true; };
269 ToolButton buttonDebugStepOver { this, toolTip = $"Step Over", menuItemPtr = IDEItem(debugStepOverItem), disabled = true; };
271 ToolButton buttonDebugStepOut { this, toolTip = $"Step Out", menuItemPtr = IDEItem(debugStepOutItem), disabled = true; };
273 ToolButton buttonDebugSkipStepOver { this, toolTip = $"Step Over Skipping Breakpoints", menuItemPtr = IDEItem(debugSkipStepOverItem), disabled = true; };
275 ToolSeparator separator5 { this };
277 Window spacer5 { this, size = { 4 } };
281 this, toolTip = $"Active Configuration(s)", size = { 160 }, disabled = true;
282 bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
286 for(prj : ide.workspace.projects)
288 for(cfg : prj.configurations)
290 if(cfg.name && !strcmp(cfg.name, row.string))
297 ide.UpdateToolBarActiveConfigs(true);
298 ide.projectView.Update(null);
304 Window spacer6 { this, size = { 4 } };
306 DropBox activeCompiler
308 this, toolTip = $"Active Compiler", size = { 160 }, disabled = true;
309 bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
311 if(ide.workspace && ide.projectView && row && strcmp(row.string, ide.workspace.compiler))
313 bool silent = ide.projectView.buildInProgress == none ? false : true;
314 CompilerConfig compiler = ideSettings.GetCompilerConfig(row.string);
315 ide.workspace.compiler = row.string;
316 ide.projectView.ShowOutputBuildLog(!silent);
318 ide.projectView.DisplayCompiler(compiler, false);
319 for(prj : ide.workspace.projects)
320 ide.projectView.ProjectPrepareCompiler(prj, compiler, silent);
322 ide.workspace.Save();
328 DropBox activeBitDepth
330 this, toolTip = $"Active Bit Depth", size = { 60 }, disabled = true;
331 bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
333 if(ide.workspace && ide.projectView && row)
335 bool silent = ide.projectView.buildInProgress == none ? false : true;
336 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
337 ide.workspace.bitDepth = (int)row.tag;
338 ide.projectView.ShowOutputBuildLog(!silent);
340 ide.projectView.DisplayCompiler(compiler, false);
341 for(prj : ide.workspace.projects)
342 ide.projectView.ProjectPrepareCompiler(prj, compiler, silent);
344 ide.workspace.Save();
350 Window spacer7 { this, size = { 4 } };
355 row = activeBitDepth.AddString("Auto");
357 activeBitDepth.AddString("32 bit").tag = 32;
358 activeBitDepth.AddString("64 bit").tag = 64;
359 activeBitDepth.currentRow = row;
364 class IDEMainFrame : Window
366 background = formColor;
367 borderStyle = sizable;
371 minClientSize = { 600, 300 };
373 icon = { ":icon.png" };
374 text = titleECEREIDE;
378 anchor = { top = 0, right = 0, bottom = 0 };
381 anchor = { left = 0, top = 0, right = 0, bottom = 0 };
388 isActiveClient = true;
390 direction = vertical;
391 background = formColor;
392 anchor = { left = 0, top = 0, right = 0, bottom = 0 };
400 ((IDEWorkSpace)master).toolBar = null;
403 IDEWorkSpace ideWorkSpace { stack, this, toolBar = toolBar };
406 define ide = ideMainFrame.ideWorkSpace;
408 class IDEWorkSpace : Window
410 background = Color { 85, 85, 85 };
413 hasVertScroll = true;
414 hasHorzScroll = true;
416 isActiveClient = true;
417 anchor = { left = 0, top = 0, right = 0, bottom = 0 };
421 MenuItem * driverItems, * skinItems;
422 StatusField pos { width = 150 };
423 StatusField ovr, caps, num;
425 BitmapResource back { ":ecereBack.jpg", window = this };
426 BitmapResource bmpBp { ":codeMarks/breakpoint.png", window = this };
427 BitmapResource bmpBpDisabled { ":codeMarks/breakpointDisabled.png", window = this };
428 BitmapResource bmpBpHalf { ":codeMarks/breakpointHalf.png", window = this };
429 BitmapResource bmpBpHalfDisabled { ":codeMarks/breakpointHalfDisabled.png", window = this };
430 BitmapResource bmpCursor { ":codeMarks/cursor.png", window = this };
431 BitmapResource bmpCursorError { ":codeMarks/cursorError.png", window = this };
432 BitmapResource bmpTopFrame { ":codeMarks/topFrame.png", window = this };
433 BitmapResource bmpTopFrameError { ":codeMarks/topFrameError.png", window = this };
434 BitmapResource bmpTopFrameHalf { ":codeMarks/topFrameHalf.png", window = this };
435 BitmapResource bmpTopFrameHalfError { ":codeMarks/topFrameHalfError.png", window = this };
437 Debugger debugger { };
439 ProjectView projectView;
441 OutputView outputView
445 void OnGotoError(char * line, bool noParsing)
447 ide.GoToError(line, noParsing);
450 void OnCodeLocationParseAndGoTo(char * line)
452 ide.CodeLocationParseAndGoTo(line, ide.findInFilesDialog.findProject, ide.findInFilesDialog.findDir);
455 bool OnKeyDown(Key key, unichar ch)
460 if(activeBox != findBox || !ide.findInFilesDialog || !ide.findInFilesDialog.SearchAbort())
461 ide.ShowCodeEditor();
465 OutputView::OnKeyDown(key, ch);
472 bool OnClose(bool parentClosing)
476 ide.RepositionWindows(false);
477 return parentClosing;
481 CallStackView callStackView
483 parent = this, font = { panelFont.faceName, panelFont.size };
485 void OnSelectFrame(int frameIndex)
487 ide.debugger.GoToStackFrameLine(frameIndex, true);
489 ide.debugger.SelectFrame(frameIndex);
492 void OnToggleBreakpoint()
494 Debugger debugger = ide.debugger;
495 if(debugger.activeFrame && debugger.activeFrame.absoluteFile)
497 int line = debugger.activeFrame.line;
498 char name[MAX_LOCATION];
500 // TOFIX: Improve on this, don't use only filename, make a function
501 GetLastDirectory(debugger.activeFrame.absoluteFile, name);
502 if(ide && ide.workspace)
504 for(p : ide.workspace.projects)
506 if(p.topNode.Find(name, false))
514 for(p : ide.workspace.projects)
516 if(IsPathInsideOf(debugger.activeFrame.absoluteFile, p.topNode.path))
524 debugger.ToggleBreakpoint(debugger.activeFrame.absoluteFile, line, prj);
527 CodeEditor codeEditor = (CodeEditor)ide.FindWindow(debugger.activeFrame.absoluteFile);
528 if(codeEditor) { codeEditor.Update(null); Activate(); }
533 bool OnKeyDown(Key key, unichar ch)
537 case escape: ide.ShowCodeEditor(); break;
542 bool OnClose(bool parentClosing)
546 ide.RepositionWindows(false);
547 return parentClosing;
550 void OnRedraw(Surface surface)
552 Debugger debugger = ide.debugger;
553 Frame activeFrame = debugger.activeFrame;
557 int lineCursor, lineTopFrame, activeThread, hitThread;
558 int lineH, scrollY, boxH;
560 Breakpoint bp = null;
563 scrollY = editBox.scroll.y;
564 displaySystem.FontExtent(editBox.font.font, " ", 1, null, &lineH);
565 activeThread = debugger.activeThread;
566 hitThread = debugger.hitThread;
567 debugger.GetCallStackCursorLine(&error, &lineCursor, &lineTopFrame);
569 // TODO: improve bp drawing... it should be visible even if it's not on the activeFrame
570 if(activeFrame.absoluteFile)
572 for(i : ide.workspace.breakpoints; i.type == user)
574 if(i.absoluteFilePath && i.absoluteFilePath[0] &&
575 !fstrcmp(i.absoluteFilePath, activeFrame.absoluteFile) &&
576 activeFrame.line == i.line)
584 DrawLineMarginIcon(surface,
585 /*(lineCursor == 1 || lineTopFrame == 1) ? */ide.bmpBpHalf/* : ide.bmpBp*/,
586 lineCursor /*1*/, lineH, scrollY, boxH);
588 if(activeThread && activeThread == hitThread && debugger.bpHit && debugger.bpHit.type == user)
589 DrawLineMarginIcon(surface,
590 (lineCursor == 1 || lineTopFrame == 1) ? ide.bmpBpHalf : ide.bmpBp,
591 1, lineH, scrollY, boxH);
593 DrawLineMarginIcon(surface, error ? ide.bmpCursorError : ide.bmpCursor, lineCursor, lineH, scrollY, boxH);
594 if(bp && lineCursor == 1) //activeThread && activeThread == hitThread && debugger.bpHit && debugger.bpHit.type == user)
595 bmp = error ? ide.bmpTopFrameHalfError : ide.bmpTopFrameHalf;
597 bmp = error ? ide.bmpTopFrameError : ide.bmpTopFrame;
598 DrawLineMarginIcon(surface, bmp, lineTopFrame, lineH, scrollY, boxH);
600 if(editBox.horzScroll && editBox.horzScroll.visible)
602 surface.SetBackground(control);
603 surface.Area(0, editBox.clientSize.h, 20 - 1, clientSize.h - 1);
608 WatchesView watchesView { parent = this };
609 ThreadsView threadsView
611 parent = this, font = { panelFont.faceName, panelFont.size };
613 bool OnKeyDown(Key key, unichar ch)
617 case escape: ide.ShowCodeEditor(); break;
622 bool OnClose(bool parentClosing)
626 ide.RepositionWindows(false);
627 return parentClosing;
630 void OnSelectThread(int threadId)
633 ide.debugger.SelectThread(threadId);
636 bool OnGetThreadsInfo(int * activeThread, int * hitThread, int * signalThread)
639 Debugger debugger = ide.debugger;
640 *activeThread = debugger.activeThread;
641 *hitThread = debugger.hitThread;
642 *signalThread = debugger.signalThread;
647 BreakpointsView breakpointsView { parent = this };
649 ToolBox toolBox { parent = this };
650 Sheet sheet { parent = this };
653 property char * tmpPrjDir { set { delete tmpPrjDir; if(value) tmpPrjDir = CopyString(value); } get { return tmpPrjDir; } };
655 Menu fileMenu { menu, $"File", f, hasMargin = true };
658 fileMenu, $"New", n, ctrlN;
659 bitmap = { ":actions/docNew.png" };
660 bool NotifySelect(MenuItem selection, Modifiers mods)
662 Window document = (Window)NewCodeEditor(this, normal, false);
663 document.NotifySaved = DocumentSaved;
667 MenuItem fileOpenItem
669 fileMenu, $"Open...", o, ctrlO;
670 bitmap = { ":actions/docOpen.png" };
671 bool NotifySelect(MenuItem selection, Modifiers mods)
673 if(!projectView && ideSettings.ideFileDialogLocation)
674 ideFileDialog.currentDirectory = ideSettings.ideFileDialogLocation;
677 if(ideFileDialog.Modal() == ok)
679 bool gotWhatWeWant = false;
681 int numSelections = ideFileDialog.numSelections;
682 char ** multiFilePaths = ideFileDialog.multiFilePaths;
684 for(c = 0; c < numSelections; c++)
686 if(OpenFile(multiFilePaths[c], normal, true, fileTypes[ideFileDialog.fileType].typeExtension, no, normal, mods.ctrl && mods.shift))
687 gotWhatWeWant = true;
690 MessageBox { type = yesNo, master = this, text = $"Error opening file",
691 contents = $"Open a different file?" }.Modal() == no)
693 if(!projectView && gotWhatWeWant)
694 ChangeFileDialogsDirectory(ideFileDialog.currentDirectory, true);
695 ide.RepositionWindows(false);
705 MenuItem fileCloseItem { fileMenu, $"Close", c, ctrlF4, NotifySelect = MenuFileClose };
706 MenuDivider { fileMenu };
707 MenuItem fileSaveItem
709 fileMenu, $"Save", s, ctrlS, bitmap = { ":actions/docSave.png" };
711 // For the toolbar button; clients can still override that for the menu item
712 bool Window::NotifySelect(MenuItem selection, Modifiers mods)
714 Window w = activeClient;
716 w.MenuFileSave(null, 0);
720 MenuItem fileSaveAsItem { fileMenu, $"Save As...", a };
721 MenuItem fileSaveAllItem { fileMenu, $"Save All", l, NotifySelect = MenuFileSaveAll, bitmap = { ":actions/docSaveAll.png" } };
722 MenuDivider { fileMenu };
725 fileMenu, $"Find In Files...", f, Key { f, ctrl = true , shift = true };
726 bool NotifySelect(MenuItem selection, Modifiers mods)
728 findInFilesDialog.replaceMode = false;
729 findInFilesDialog.Show();
733 MenuItem replaceInFiles
735 fileMenu, $"Replace In Files...", e, Key { r, ctrl = true , shift = true };
736 bool NotifySelect(MenuItem selection, Modifiers mods)
738 findInFilesDialog.replaceMode = true;
739 findInFilesDialog.Show();
743 MenuDivider { fileMenu };
744 MenuItem globalSettingsItem
746 fileMenu, $"Global Settings...", g;
747 bool NotifySelect(MenuItem selection, Modifiers mods)
749 globalSettingsDialog.master = this;
750 if(ide.workspace && ide.workspace.compiler)
751 globalSettingsDialog.workspaceActiveCompiler = ide.workspace.compiler;
752 else if(ideSettings.defaultCompiler)
753 globalSettingsDialog.workspaceActiveCompiler = ideSettings.defaultCompiler;
754 globalSettingsDialog.Modal();
758 MenuDivider { fileMenu };
759 Menu recentFiles { fileMenu, $"Recent Files", r };
760 Menu recentProjects { fileMenu, $"Recent Projects", p };
761 MenuDivider { fileMenu };
764 fileMenu, $"Exit", x, altF4;
766 bool NotifySelect(MenuItem selection, Modifiers mods)
768 ideMainFrame.Destroy(0);
773 bool FileRecentFile(MenuItem selection, Modifiers mods)
776 for(file : ideSettings.recentFiles)
778 if(id == selection.id)
781 char extension[MAX_EXTENSION] = "";
782 GetExtension(file, extension);
783 isProjectFile = (!strcmpi(extension, "epj") || !strcmpi(extension, "ews"));
786 char * command = PrintString("ide ", isProjectFile ? "-t " : "", file);
792 OpenFile(file, normal, true, isProjectFile ? "txt" : null, no, normal, mods.ctrl && mods.shift);
793 ide.RepositionWindows(false);
802 bool FileRecentProject(MenuItem selection, Modifiers mods)
805 for(file : ideSettings.recentProjects)
807 if(id == selection.id)
811 char * command = PrintString("ide ", file);
816 OpenFile(file, normal, true, null, no, normal, mods.ctrl && mods.shift);
824 MenuPlacement editMenu { menu, $"Edit", e };
826 Menu projectMenu { menu, $"Menu"."Project", p, hasMargin = true };
827 MenuItem projectNewItem
829 projectMenu, $"New...", n, Key { n, true, true };
830 bitmap = { ":actions/projNew.png" };
831 bool NotifySelect(MenuItem selection, Modifiers mods)
833 if(!DontTerminateDebugSession($"New Project"))
836 NewProjectDialog newProjectDialog { master = this };
837 result = newProjectDialog.Modal();
842 newProjectDialog.CreateNewProject();
845 ideSettings.AddRecentProject(projectView.fileName);
846 ide.UpdateRecentMenus();
847 settingsContainer.Save();
855 MenuItem projectOpenItem
857 projectMenu, $"Open...", o, Key { o, true, true };
858 bitmap = { ":actions/projOpen.png" };
859 bool NotifySelect(MenuItem selection, Modifiers mods)
861 if(ideSettings.ideProjectFileDialogLocation)
862 ideProjectFileDialog.currentDirectory = ideSettings.ideProjectFileDialogLocation;
864 ideProjectFileDialog.text = openProjectFileDialogTitle;
865 if(ideProjectFileDialog.Modal() == ok)
867 OpenFile(ideProjectFileDialog.filePath, normal, true, projectTypes[ideProjectFileDialog.fileType].typeExtension, no, normal, mods.ctrl && mods.shift);
868 //ChangeProjectFileDialogDirectory(ideProjectFileDialog.currentDirectory);
873 MenuItem projectQuickItem
875 projectMenu, $"Quick...", q, f7, disabled = true;
876 bool NotifySelect(MenuItem selection, Modifiers mods)
879 QuickProjectDialog { this }.Modal();
883 MenuItem projectAddItem
885 projectMenu, $"Add project to workspace...", a, Key { a, true, true };
886 bitmap = { ":actions/projAdd.png" };
888 bool NotifySelect(MenuItem selection, Modifiers mods)
890 if(ideSettings.ideProjectFileDialogLocation)
891 ideProjectFileDialog.currentDirectory = ideSettings.ideProjectFileDialogLocation;
893 ideProjectFileDialog.text = addProjectFileDialogTitle;
896 if(ideProjectFileDialog.Modal() == ok)
898 if(OpenFile(ideProjectFileDialog.filePath, normal, true, projectTypes[ideProjectFileDialog.fileType].typeExtension, no, add, mods.ctrl && mods.shift))
900 if(MessageBox { type = yesNo, master = this, text = $"Error opening project file",
901 contents = $"Add a different project?" }.Modal() == no)
912 MenuItem projectCloseItem
914 projectMenu, $"Close", c, disabled = true;
915 bool NotifySelect(MenuItem selection, Modifiers mods)
919 if(!ide.DontTerminateDebugSession($"Project Close"))
925 MenuDivider { projectMenu };
926 MenuItem projectSettingsItem
928 projectMenu, $"Settings...", s, altF7, disabled = true;
929 bool NotifySelect(MenuItem selection, Modifiers mods)
931 projectView.MenuSettings(projectView.active ? selection : null, mods);
935 MenuDivider { projectMenu };
936 MenuItem projectBrowseFolderItem
938 projectMenu, $"Browse Project Folder", p, disabled = true;
939 bool NotifySelect(MenuItem selection, Modifiers mods)
942 projectView.MenuBrowseFolder(null, mods);
946 MenuDivider { projectMenu };
947 MenuItem projectRunItem
949 projectMenu, $"Run", r, ctrlF5, disabled = true;
950 bitmap = { ":actions/run.png" };
951 bool NotifySelect(MenuItem selection, Modifiers mods)
954 projectView.Run(null, mods);
958 MenuItem projectBuildItem
960 projectMenu, $"Build", b, f7, disabled = true;
961 bitmap = { ":actions/build.png" };
962 bool NotifySelect(MenuItem selection, Modifiers mods)
966 if(projectView.buildInProgress == none)
967 projectView.ProjectBuild(projectView.active ? selection : null, mods);
969 projectView.stopBuild = true;
974 MenuItem projectLinkItem
976 projectMenu, $"Relink", l, disabled = true;
977 bitmap = { ":actions/relink.png" };
978 bool NotifySelect(MenuItem selection, Modifiers mods)
981 projectView.ProjectLink(projectView.active ? selection : null, mods);
985 MenuItem projectRebuildItem
987 projectMenu, $"Rebuild", d, shiftF7, disabled = true;
988 bitmap = { ":actions/rebuild.png" };
989 bool NotifySelect(MenuItem selection, Modifiers mods)
992 projectView.ProjectRebuild(projectView.active ? selection : null, mods);
996 MenuItem projectCleanTargetItem
998 projectMenu, $"Clean Target", g, disabled = true;
999 bitmap = { ":actions/clean.png" };
1000 bool NotifySelect(MenuItem selection, Modifiers mods)
1005 projectView.ProjectCleanTarget(projectView.active ? selection : null, mods);
1010 MenuItem projectCleanItem
1012 projectMenu, $"Clean", e, disabled = true;
1013 bitmap = { ":actions/clean.png" };
1014 bool NotifySelect(MenuItem selection, Modifiers mods)
1019 projectView.ProjectClean(projectView.active ? selection : null, mods);
1024 MenuItem projectRealCleanItem
1026 projectMenu, $"Real Clean", disabled = true;
1027 bitmap = { ":actions/clean.png" };
1028 bool NotifySelect(MenuItem selection, Modifiers mods)
1033 projectView.ProjectRealClean(projectView.active ? selection : null, mods);
1038 MenuItem projectRegenerateItem
1040 projectMenu, $"Regenerate Makefile", m, disabled = true;
1041 bitmap = { ":actions/regMakefile.png" };
1042 bool NotifySelect(MenuItem selection, Modifiers mods)
1045 projectView.ProjectRegenerate(projectView.active ? selection : null, mods);
1049 MenuItem projectInstallItem
1051 #ifdef IDE_SHOW_INSTALL_MENU_BUTTON
1052 projectMenu, $"Install", t, disabled = true;
1054 bitmap = { ":status/software-update-available.png" };
1055 bool NotifySelect(MenuItem selection, Modifiers mods)
1058 projectView.ProjectInstall(projectView.active ? selection : null, mods);
1062 MenuItem projectCompileItem;
1063 Menu debugMenu { menu, $"Debug", d, hasMargin = true };
1064 MenuItem debugStartResumeItem
1066 debugMenu, $"Start", s, f5, disabled = true;
1067 bitmap = { ":actions/debug.png" };
1068 NotifySelect = MenuDebugStart;
1070 bool MenuDebugStart(MenuItem selection, Modifiers mods)
1074 debugStartResumeItem.disabled = true; // a very rare exception to calling AdjustDebugMenus
1075 if(!projectView.DebugStart())
1076 debugStartResumeItem.disabled = false; // same exception
1080 bool MenuDebugResume(MenuItem selection, Modifiers mods)
1083 projectView.DebugResume();
1086 MenuItem debugRestartItem
1088 debugMenu, $"Restart", r, Key { f5, ctrl = true, shift = true }, disabled = true;
1089 bitmap = { ":actions/restart.png" };
1090 bool NotifySelect(MenuItem selection, Modifiers mods)
1093 projectView.DebugRestart();
1097 MenuItem debugBreakItem
1099 debugMenu, $"Break", b, Key { pauseBreak, ctrl = true }, disabled = true;
1100 bitmap = { ":actions/pause.png" };
1101 bool NotifySelect(MenuItem selection, Modifiers mods)
1103 if(projectView && projectView.buildInProgress != none)
1106 projectView.DebugBreak();
1110 MenuItem debugStopItem
1112 debugMenu, $"Stop", p, shiftF5, disabled = true;
1113 bitmap = { ":actions/stopDebug.png" };
1114 bool NotifySelect(MenuItem selection, Modifiers mods)
1117 projectView.DebugStop();
1121 MenuDivider { debugMenu };
1122 MenuItem debugUseValgrindItem
1124 debugMenu, $"Use Valgrind", d, disabled = true, checkable = true;
1125 bool NotifySelect(MenuItem selection, Modifiers mods)
1129 ide.workspace.useValgrind = selection.checked;
1130 ide.workspace.Save();
1132 ide.AdjustValgrindChecks();
1136 MenuItem debugValgrindFullLeakCheckItem
1138 debugMenu, $"Valgrind: Full Leak Check", d, disabled = true, checkable = true;
1139 bool NotifySelect(MenuItem selection, Modifiers mods)
1143 ide.workspace.vgFullLeakCheck = selection.checked;
1144 ide.workspace.Save();
1149 MenuDivider { debugMenu };
1150 MenuItem debugStepIntoItem
1152 debugMenu, $"Step Into", i, f11, disabled = true;
1153 bitmap = { ":actions/stepInto.png" };
1154 bool NotifySelect(MenuItem selection, Modifiers mods)
1157 projectView.DebugStepInto();
1161 MenuItem debugStepOverItem
1163 debugMenu, $"Step Over", v, f10, disabled = true;
1164 bitmap = { ":actions/stepOver.png" };
1165 bool NotifySelect(MenuItem selection, Modifiers mods)
1168 projectView.DebugStepOver(false);
1172 MenuItem debugStepOutItem
1174 debugMenu, $"Step Out", o, shiftF11, disabled = true;
1175 bitmap = { ":actions/stepOut.png" };
1176 bool NotifySelect(MenuItem selection, Modifiers mods)
1179 projectView.DebugStepOut(false);
1183 MenuPlacement debugRunToCursorItem { debugMenu, $"Run To Cursor", c };
1184 MenuItem debugSkipStepOverItem
1186 debugMenu, $"Step Over Skipping Breakpoints", e, shiftF10, disabled = true;
1187 bool NotifySelect(MenuItem selection, Modifiers mods)
1190 projectView.DebugStepOver(true);
1194 MenuItem debugSkipStepOutItem
1196 debugMenu, $"Step Out Skipping Breakpoints", t, Key { f11, ctrl = true, shift = true }, disabled = true;
1197 bitmap = { ":actions/skipBreaks.png" };
1198 bool NotifySelect(MenuItem selection, Modifiers mods)
1201 projectView.DebugStepOut(true);
1205 MenuPlacement debugSkipRunToCursorItem { debugMenu, $"Run To Cursor Skipping Breakpoints", u };
1206 MenuPlacement debugSkipRunToCursorAtSameLevelItem { debugMenu, $"Run To Cursor At Same Level Skipping Breakpoints", l };
1207 //MenuDivider { debugMenu };
1208 //MenuPlacement debugToggleBreakpoint { debugMenu, "Toggle Breakpoint", t };
1209 MenuPlacement imageMenu { menu, $"Image", i };
1210 Menu viewMenu { menu, $"View", v };
1211 MenuItem viewProjectItem
1213 viewMenu, $"Project View", j, alt0, disabled = true;
1214 bool NotifySelect(MenuItem selection, Modifiers mods)
1218 projectView.visible = true;
1219 projectView.Activate();
1224 MenuPlacement { viewMenu, $"View Designer" };
1225 MenuPlacement { viewMenu, $"View Code" };
1226 MenuPlacement { viewMenu, $"View Properties" };
1227 MenuPlacement { viewMenu, $"View Methods" };
1228 MenuItem viewDesignerItem
1230 viewMenu, $"View Designer", d, f8;
1231 bool NotifySelect(MenuItem selection, Modifiers mods)
1233 Window client = activeClient;
1234 Class dataType = client._class;
1235 if(!strcmp(dataType.name, "Designer"))
1237 client.visible = true;
1241 ((CodeEditor)client).ViewDesigner();
1245 MenuItem viewCodeItem
1247 viewMenu, $"View Code", c, f8;
1248 bool NotifySelect(MenuItem selection, Modifiers mods)
1250 Window client = activeClient;
1251 Class dataType = client._class;
1252 if(!strcmp(dataType.name, "Designer"))
1253 client = ((Designer)client).codeEditor;
1256 // Do this after so the caret isn't moved yet...
1257 client.visible = true;
1261 MenuItem viewPropertiesItem
1263 viewMenu, $"View Properties", p, f4;
1264 bool NotifySelect(MenuItem selection, Modifiers mods)
1266 sheet.visible = true;
1267 sheet.sheetSelected = properties;
1272 MenuItem viewMethodsItem
1274 viewMenu, $"View Methods", m, f4;
1275 bool NotifySelect(MenuItem selection, Modifiers mods)
1277 sheet.visible = true;
1278 sheet.sheetSelected = methods;
1283 MenuItem viewToolBoxItem
1285 viewMenu, $"View Toolbox", x, f12;
1286 bool NotifySelect(MenuItem selection, Modifiers mods)
1288 toolBox.visible = true;
1293 MenuItem viewOutputItem
1295 viewMenu, $"Output", o, alt2;
1296 bool NotifySelect(MenuItem selection, Modifiers mods)
1302 MenuItem viewWatchesItem
1304 viewMenu, $"Watches", w, alt3;
1305 bool NotifySelect(MenuItem selection, Modifiers mods)
1311 MenuItem viewThreadsItem
1313 viewMenu, $"Threads", t, alt4;
1314 bool NotifySelect(MenuItem selection, Modifiers mods)
1320 MenuItem viewBreakpointsItem
1322 viewMenu, $"Breakpoints", b, alt5;
1323 bool NotifySelect(MenuItem selection, Modifiers mods)
1325 breakpointsView.Show();
1329 MenuItem viewCallStackItem
1331 viewMenu, $"Call Stack", s, alt7;
1332 bool NotifySelect(MenuItem selection, Modifiers mods)
1334 callStackView.Show();
1338 MenuItem viewAllDebugViews
1340 viewMenu, $"All Debug Views", a, alt9;
1341 bool NotifySelect(MenuItem selection, Modifiers mods)
1346 callStackView.Show();
1347 breakpointsView.Show();
1351 #ifdef GDB_DEBUG_GUI
1352 MenuDivider { viewMenu };
1353 MenuItem viewGDBItem
1355 viewMenu, $"GDB Dialog", g, Key { f9, shift = true, ctrl = true };
1356 bool NotifySelect(MenuItem selection, Modifiers mods)
1363 MenuDivider { viewMenu };
1364 MenuItem viewColorPicker
1366 viewMenu, $"Color Picker...", c, Key { c, ctrl = true , shift = true };
1367 bool NotifySelect(MenuItem selection, Modifiers mods)
1369 ColorPicker colorPicker { master = this };
1370 colorPicker.Modal();
1374 MenuDivider { viewMenu };
1378 viewMenu, "Full Screen", f, checkable = true;
1380 bool NotifySelect(MenuItem selection, Modifiers mods)
1382 app.fullScreen ^= true;
1384 anchor = { 0, 0, 0, 0 };
1389 Menu driversMenu { viewMenu, $"Graphics Driver", v };
1390 //Menu skinsMenu { viewMenu, "GUI Skins", k };
1391 Menu windowMenu { menu, $"Window", w };
1392 MenuItem { windowMenu, $"Close All", l, NotifySelect = MenuWindowCloseAll };
1393 MenuDivider { windowMenu };
1394 MenuItem { windowMenu, $"Next", n, f6, NotifySelect = MenuWindowNext };
1395 MenuItem { windowMenu, $"Previous", p, shiftF6, NotifySelect = MenuWindowPrevious };
1396 MenuDivider { windowMenu };
1397 MenuItem { windowMenu, $"Cascade", c, NotifySelect = MenuWindowCascade };
1398 MenuItem { windowMenu, $"Tile Horizontally", h, NotifySelect = MenuWindowTileHorz };
1399 MenuItem { windowMenu, $"Tile Vertically", v, NotifySelect = MenuWindowTileVert };
1400 MenuItem { windowMenu, $"Arrange Icons", a, NotifySelect = MenuWindowArrangeIcons };
1401 MenuDivider { windowMenu };
1402 MenuItem { windowMenu, $"Windows...", w, NotifySelect = MenuWindowWindows };
1403 Menu helpMenu { menu, $"Help", h };
1406 helpMenu, $"API Reference", r, f1;
1407 bool NotifySelect(MenuItem selection, Modifiers mods)
1409 char * p = new char[MAX_LOCATION];
1411 strncpy(p, settingsContainer.moduleLocation, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
1412 PathCat(p, "documentor");
1413 #if defined(__WIN32__)
1414 ChangeExtension(p, "exe", p);
1416 if(FileExists(p).isFile)
1419 Execute("documentor");
1424 MenuDivider { helpMenu };
1427 helpMenu, $"Ecere Tao of Programming [work in progress]", t;
1428 bool NotifySelect(MenuItem selection, Modifiers mods)
1430 FindAndShellOpenInstalledFile("doc", "Ecere Tao of Programming [work in progress].pdf");
1434 MenuDivider { helpMenu };
1437 helpMenu, $"Documentation Folder", d;
1438 bool NotifySelect(MenuItem selection, Modifiers mods)
1440 FindAndShellOpenInstalledFolder("doc");
1446 helpMenu, $"Samples Folder", s;
1447 bool NotifySelect(MenuItem selection, Modifiers mods)
1449 FindAndShellOpenInstalledFolder("samples");
1455 helpMenu, $"Extras Folder", x;
1456 bool NotifySelect(MenuItem selection, Modifiers mods)
1458 FindAndShellOpenInstalledFolder("extras");
1462 MenuDivider { helpMenu };
1465 helpMenu, $"Community Forums", f;
1466 bool NotifySelect(MenuItem selection, Modifiers mods)
1468 ShellOpen("http://ecere.com/forums");
1472 MenuDivider { helpMenu };
1475 helpMenu, $"About...", a;
1476 bool NotifySelect(MenuItem selection, Modifiers mods)
1478 AboutIDE { master = this }.Modal();
1483 property ToolBox toolBox
1485 get { return toolBox; }
1488 property Sheet sheet
1490 get { return sheet; }
1493 property Project project
1495 get { return projectView ? projectView.project : null; }
1498 property Workspace workspace
1500 get { return projectView ? projectView.workspace : null; }
1503 FindInFilesDialog findInFilesDialog
1506 filters = findInFilesFileFilters.array, sizeFilters = findInFilesFileFilters.count * sizeof(FileFilter);
1512 #ifdef GDB_DEBUG_GUI
1515 master = this, parent = this;
1516 //anchor = { left = 100, top = 100, right = 100, bottom = 100 };
1518 void OnCommand(char * string)
1521 ide.debugger.SendGDBCommand(string);
1526 bool NotifySelectDisplayDriver(MenuItem selection, Modifiers mods)
1528 //app.driver = app.drivers[selection.id];
1529 #if defined(__unix__) || defined(__APPLE__)
1530 app.driver = selection.id ? "OpenGL" : "X";
1532 app.driver = selection.id ? "OpenGL" : "GDI";
1534 delete ideSettings.displayDriver;
1535 ideSettings.displayDriver = CopyString(selection.id ? "OpenGL" : "Default");
1537 settingsContainer.Save();
1538 //SetDriverAndSkin();
1542 bool NotifySelectDisplaySkin(MenuItem selection, Modifiers mods)
1544 app.skin = app.skins[selection.id];
1549 void SetDriverAndSkin()
1552 for(c = 0; c < app.numSkins; c++)
1553 if(!strcmp(app.skins[c], app.skin))
1555 skinItems[c].checked = true;
1558 for(c = 0; c < app.numDrivers; c++)
1559 if(!strcmp(app.drivers[c], app.driver))
1561 driverItems[c].checked = true;
1566 ProjectView CreateProjectView(Workspace workspace, char * fileName)
1568 Project project = workspace.projects.firstIterator.data;
1569 projectView = ProjectView
1572 fileName = fileName;
1574 void NotifyDestroyed(Window window, DialogResult result)
1577 text = titleECEREIDE;
1582 projectView.Create();
1583 RepositionWindows(false);
1585 // Leave it after Create to avoid flicker due to seeing IDE without a project view
1586 projectView.workspace = workspace;
1587 projectView.project = project;
1588 ideMainFrame.SetText("%s - %s", project.topNode.name, titleECEREIDE);
1592 ide.breakpointsView.LoadFromWorkspace();
1593 ide.watchesView.LoadFromWorkspace();
1595 findInFilesDialog.projectNodeField.userData = projectView;
1598 char fileName[MAX_LOCATION];
1599 strcpy(fileName, project.topNode.path);
1600 PathCat(fileName, project.topNode.name);
1607 projectView.visible = false;
1608 if((!projectView || projectView.created == false || projectView.Destroy(0)) && MenuWindowCloseAll(null, 0))
1610 if(findInFilesDialog)
1612 char workingDir[MAX_LOCATION];
1613 GetWorkingDir(workingDir, MAX_LOCATION);
1614 findInFilesDialog.SearchStop();
1615 findInFilesDialog.currentDirectory = workingDir;
1617 ideMainFrame.text = titleECEREIDE;
1624 void RepositionWindows(bool expand)
1629 bool inDebugMode = debugger.isActive;
1630 bool callStackVisible = expand ? false : callStackView.visible;
1631 bool threadsVisible = expand ? false : threadsView.visible;
1632 bool watchesVisible = expand ? false : watchesView.visible;
1633 bool breakpointsVisible = expand ? false : breakpointsView.visible;
1634 bool toolBoxVisible = toolBox.visible;
1635 bool outputVisible = expand ? false : outputView.visible;
1636 int topDistance = (callStackVisible || threadsVisible) ? 200 : 0;
1637 int bottomDistance = (outputVisible || watchesVisible || breakpointsVisible) ? 240 : 0;
1639 for(child = firstChild; child; child = child.next)
1641 if(child._class == class(CodeEditor) || child._class == class(Designer) ||
1642 child._class == class(Sheet) || child._class == class(ProjectView))
1644 Anchor anchor = child.anchor;
1645 anchor.top = topDistance;
1646 anchor.bottom = bottomDistance;
1647 if(child._class == class(CodeEditor) || child._class == class(Designer))
1650 anchor.right = toolBoxVisible ? 150 : 0;
1652 child.anchor = anchor;
1656 if(child._class == class(OutputView) || child._class == class(CallStackView) || child._class == class(ThreadsView) || child._class == class(WatchesView) ||
1657 child._class == class(BreakpointsView))
1658 child.visible = false;
1661 // If this is not here, the IDE is not updated when doing Debug/Break then Alt-4 to show call stack (IDE not updated)
1666 bool ShowCodeEditor()
1669 activeClient.Activate();
1670 else if(projectView)
1672 projectView.visible = true;
1673 projectView.Activate();
1677 sheet.visible = true;
1683 void DocumentSaved(Window document, char * fileName)
1685 ideSettings.AddRecentFile(fileName);
1686 ide.UpdateRecentMenus();
1687 ide.AdjustFileMenus();
1688 settingsContainer.Save();
1691 bool Window::OnFileModified(FileChange fileChange, char * param)
1694 sprintf(temp, $"The document %s was modified by another application.\n"
1695 "Would you like to reload it and lose your changes?", this.fileName);
1696 if(MessageBox { type = yesNo, master = this/*.parent*/,
1697 text = $"Document has been modified", contents = temp }.Modal() == yes)
1699 bool noParsing = (this._class == class(CodeEditor) && ((CodeEditor)this).noParsing) ? true : false;
1700 char * fileName = CopyString(this.fileName);
1701 WindowState state = this.state;
1702 Anchor anchor = this.anchor;
1703 Size size = this.size;
1705 this.modifiedDocument = false;
1707 this = ide.OpenFile(fileName, normal, true, null, no, normal, noParsing);
1710 this.anchor = anchor;
1712 this.SetState(state, true, 0);
1720 void UpdateMakefiles()
1724 CompilerConfig compiler = ideSettings.GetCompilerConfig(workspace.compiler);
1725 for(prj : workspace.projects)
1726 projectView.ProjectUpdateMakefileForAllConfigs(prj);
1731 void UpdateCompilerConfigs(bool mute)
1733 UpdateToolBarActiveCompilers();
1736 bool silent = mute || (ide.projectView.buildInProgress == none ? false : true);
1737 CompilerConfig compiler = ideSettings.GetCompilerConfig(workspace.compiler);
1740 projectView.ShowOutputBuildLog(true);
1741 projectView.DisplayCompiler(compiler, false);
1743 for(prj : workspace.projects)
1744 projectView.ProjectPrepareCompiler(prj, compiler, silent);
1749 void UpdateToolBarActiveCompilers()
1751 toolBar.activeCompiler.Clear();
1752 for(compiler : ideSettings.compilerConfigs)
1754 DataRow row = toolBar.activeCompiler.AddString(compiler.name);
1755 if(workspace && workspace.compiler && !strcmp(compiler.name, workspace.compiler))
1756 toolBar.activeCompiler.currentRow = row;
1758 if(!toolBar.activeCompiler.currentRow && toolBar.activeCompiler.firstRow)
1759 toolBar.activeCompiler.SelectRow(toolBar.activeCompiler.firstRow);
1762 void UpdateToolBarActiveConfigs(bool selectionOnly)
1764 bool commonSelected = false;
1765 DataRow row = toolBar.activeConfig.currentRow;
1767 row = toolBar.activeConfig.FindRow(1);
1770 toolBar.activeConfig.Clear();
1771 row = toolBar.activeConfig.AddString($"(Mixed)");
1776 char * configName = null;
1779 Map<String, int> configs { }; // TOIMP: just need sort but using map until containers have sort
1780 for(prj : workspace.projects)
1782 for(cfg : prj.configurations)
1785 configs[cfg.name] = 1;
1790 toolBar.activeConfig.AddString(&name);
1794 if(projectView && projectView.project)
1796 for(prj : workspace.projects)
1798 if(prj.config && prj.config.name)
1800 configName = prj.config.name;
1806 commonSelected = true;
1807 for(prj : workspace.projects)
1809 if(prj.config && (!prj.config.name || strcmp(prj.config.name, configName)))
1811 commonSelected = false;
1819 commonSelected = false;
1820 for(row = toolBar.activeConfig.firstRow; row; row = row.next)
1822 if(!strcmp(row.string, configName))
1824 toolBar.activeConfig.currentRow = row;
1825 commonSelected = true;
1832 toolBar.activeConfig.Sort(null, 0);
1834 toolBar.activeConfig.currentRow = row;
1839 bool unavailable = !project;
1841 projectAddItem.disabled = unavailable;
1842 toolBar.buttonAddProject.disabled = unavailable;
1844 projectSettingsItem.disabled = unavailable;
1846 projectBrowseFolderItem.disabled = unavailable;
1848 viewProjectItem.disabled = unavailable;
1850 toolBar.activeConfig.disabled = unavailable;
1851 toolBar.activeCompiler.disabled = unavailable;
1852 toolBar.activeBitDepth.disabled = unavailable;
1853 debugUseValgrindItem.disabled = unavailable;
1855 AdjustValgrindChecks();
1861 void AdjustValgrindChecks()
1863 bool unavailable = !project || !debugUseValgrindItem.checked;
1864 debugValgrindFullLeakCheckItem.disabled = unavailable;
1867 property bool hasOpenedCodeEditors
1872 for(w = firstChild; w; w = w.next)
1873 if(w._class == class(CodeEditor) &&
1874 w.isDocument && !w.closing && w.visible && w.created &&
1875 w.fileName && w.fileName[0])
1881 void AdjustFileMenus()
1883 bool unavailable = project != null || !hasOpenedCodeEditors; // are they supported source code (ec, c, cpp, etc) ?
1885 projectQuickItem.disabled = unavailable;
1888 void AdjustBuildMenus()
1890 bool unavailable = project && projectView.buildInProgress;
1891 bool naForRun = unavailable || !project || project.GetTargetType(project.config) != executable;
1893 projectNewItem.disabled = unavailable;
1894 toolBar.buttonNewProject.disabled = unavailable;
1895 projectOpenItem.disabled = unavailable;
1896 toolBar.buttonOpenProject.disabled = unavailable;
1898 unavailable = !project || projectView.buildInProgress;
1900 projectCloseItem.disabled = unavailable;
1901 // toolBar.buttonCloseProject.disabled = unavailable;
1903 projectRunItem.disabled = naForRun;
1904 toolBar.buttonRun.disabled = naForRun;
1906 projectBuildItem.disabled = false;
1907 projectBuildItem.text = unavailable ? $"Stop Build" : $"Build";
1908 projectBuildItem.accelerator = unavailable ? Key { pauseBreak, ctrl = true } : f7;
1910 projectLinkItem.disabled = unavailable;
1911 toolBar.buttonReLink.disabled = unavailable;
1912 projectRebuildItem.disabled = unavailable;
1913 toolBar.buttonRebuild.disabled = unavailable;
1914 projectCleanItem.disabled = unavailable;
1915 toolBar.buttonClean.disabled = unavailable;
1916 projectCleanTargetItem.disabled = unavailable;
1917 projectRealCleanItem.disabled = unavailable;
1918 // toolBar.buttonRealClean.disabled = unavailable;
1919 projectRegenerateItem.disabled = unavailable;
1920 toolBar.buttonRegenerateMakefile.disabled = unavailable;
1921 #ifdef IDE_SHOW_INSTALL_MENU_BUTTON
1922 projectInstallItem.disabled = unavailable;
1923 toolBar.buttonInstall.disabled = unavailable;
1925 projectCompileItem.disabled = unavailable;
1927 AdjustPopupBuildMenus();
1930 void AdjustPopupBuildMenus()
1932 bool unavailable = !project || projectView.buildInProgress;
1934 if(projectView && projectView.popupMenu && projectView.popupMenu.menu && projectView.popupMenu.created)
1937 menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectBuild, 0);
1940 menu.disabled = false;
1941 menu.text = unavailable ? $"Stop Build" : $"Build";
1942 menu.accelerator = unavailable ? Key { pauseBreak, ctrl = true } : f7;
1945 menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectLink, 0); if(menu) menu.disabled = unavailable;
1946 menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectRebuild, 0); if(menu) menu.disabled = unavailable;
1947 menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectCleanTarget, 0); if(menu) menu.disabled = unavailable;
1948 menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectClean, 0); if(menu) menu.disabled = unavailable;
1949 menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectRealClean, 0); if(menu) menu.disabled = unavailable;
1950 menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectRegenerate, 0); if(menu) menu.disabled = unavailable;
1951 menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectInstall, 0); if(menu) menu.disabled = unavailable;
1952 menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectRemove, 0); if(menu) menu.disabled = unavailable;
1953 menu = projectView.popupMenu.menu.FindItem(ProjectView::FileClean, 0); if(menu) menu.disabled = unavailable;
1954 menu = projectView.popupMenu.menu.FindItem(ProjectView::FileCompile, 0); if(menu) menu.disabled = unavailable;
1955 menu = projectView.popupMenu.menu.FindItem(ProjectView::FileDebugPrecompile, 0); if(menu) menu.disabled = unavailable;
1956 menu = projectView.popupMenu.menu.FindItem(ProjectView::FileDebugCompile, 0); if(menu) menu.disabled = unavailable;
1957 menu = projectView.popupMenu.menu.FindItem(ProjectView::FileDebugGenerateSymbols, 0); if(menu) menu.disabled = unavailable;
1958 projectView.popupMenu.Update(null);
1962 property bool areDebugMenusUnavailable { get {
1964 project.GetTargetType(project.config) != executable ||
1965 projectView.buildInProgress == buildingMainProject;
1968 property bool isBreakpointTogglingUnavailable { get {
1972 property bool isDebuggerExecuting { get {
1976 return ide.debugger.state == running;
1979 void AdjustDebugMenus()
1981 bool unavailable = areDebugMenusUnavailable;
1982 bool active = debugger.isActive;
1983 bool bpNoToggle = isBreakpointTogglingUnavailable;
1984 bool executing = isDebuggerExecuting;
1985 //bool holding = debugger.state == stopped;
1987 debugStartResumeItem.disabled = unavailable || executing;
1988 debugStartResumeItem.text = active ? $"Resume" : $"Start";
1989 debugStartResumeItem.NotifySelect = active ? MenuDebugResume : MenuDebugStart;
1992 toolBar.buttonDebugStartResume.disabled = unavailable || executing;
1993 toolBar.buttonDebugStartResume.toolTip = active ? $"Resume" : $"Start";
1996 debugBreakItem.disabled = unavailable || !executing;
1997 debugStopItem.disabled = unavailable || !active;
1998 debugRestartItem.disabled = unavailable || !active;
2001 toolBar.buttonDebugPause.disabled = unavailable || !executing;
2002 toolBar.buttonDebugStop.disabled = unavailable || !active;
2003 toolBar.buttonDebugRestart.disabled = unavailable || !active;
2006 debugStepIntoItem.disabled = unavailable || executing;
2007 debugStepOverItem.disabled = unavailable || executing;
2008 debugStepOutItem.disabled = unavailable || executing || !active;
2009 debugSkipStepOverItem.disabled = unavailable || executing;
2010 debugSkipStepOutItem.disabled = unavailable || executing || !active;
2013 toolBar.buttonDebugStepInto.disabled = unavailable || executing;
2014 toolBar.buttonDebugStepOver.disabled = unavailable || executing;
2015 toolBar.buttonDebugStepOut.disabled = unavailable || executing || !active;
2016 toolBar.buttonDebugSkipStepOver.disabled = unavailable || executing;
2017 // toolBar.buttonDebugSkipStepOutItem.disabled = unavailable || executing;
2019 if((Designer)GetActiveDesigner())
2021 CodeEditor codeEditor = ((Designer)GetActiveDesigner()).codeEditor;
2023 codeEditor.AdjustDebugMenus(unavailable, bpNoToggle, executing);
2027 void ChangeFileDialogsDirectory(char * directory, bool saveSettings)
2029 char tempString[MAX_LOCATION];
2030 strcpy(tempString, directory);
2031 if(saveSettings && !projectView)
2033 ideSettings.ideFileDialogLocation = directory;
2034 settingsContainer.Save();
2037 ideFileDialog.currentDirectory = tempString;
2038 codeEditorFileDialog.currentDirectory = tempString;
2039 codeEditorFormFileDialog.currentDirectory = tempString;
2042 void ChangeProjectFileDialogDirectory(char * directory)
2044 ideSettings.ideProjectFileDialogLocation = directory;
2045 settingsContainer.Save();
2048 Window FindWindow(char * filePath)
2050 Window document = null;
2052 // TOCHECK: Do we need to change slashes here?
2053 for(document = firstChild; document; document = document.next)
2055 char * fileName = document.fileName;
2056 if(document.isDocument && fileName && !fstrcmp(fileName, filePath))
2058 document.visible = true;
2059 document.Activate();
2066 bool DontTerminateDebugSession(char * title)
2068 if(debugger.isActive)
2070 if(MessageBox { type = yesNo, master = ide,
2071 contents = $"Do you want to terminate the debugging session in progress?",
2072 text = title }.Modal() == no)
2075 MessageBox msg { type = yesNo, master = ide,
2076 contents = "Do you want to terminate the debugging session in progress?",
2078 if(msg.Modal() == no)
2090 Window OpenFile(char * origFilePath, WindowState state, bool visible, char * type, OpenCreateIfFails createIfFails, OpenMethod openMethod, bool noParsing)
2092 char extension[MAX_EXTENSION] = "";
2093 Window document = null;
2094 bool isProject = false;
2095 bool needFileModified = true;
2096 char winFilePath[MAX_LOCATION];
2097 char * filePath = strstr(origFilePath, "http://") == origFilePath ? strcpy(winFilePath, origFilePath) : GetSystemPathBuffer(winFilePath, origFilePath);
2101 GetExtension(filePath, extension);
2105 strcpy(extension, type);
2107 if(strcmp(extension, ProjectExtension))
2109 for(document = firstChild; document; document = document.next)
2111 char * fileName = document.fileName;
2112 if(document.isDocument && fileName && !fstrcmp(fileName, filePath) && document.created)
2114 document.visible = true;
2116 document.Activate();
2122 if(createIfFails == whatever)
2124 else if(!strcmp(extension, ProjectExtension) || !strcmp(extension, WorkspaceExtension))
2126 needFileModified = false;
2127 if(openMethod == normal)
2129 if(DontTerminateDebugSession($"Open Project"))
2139 Workspace workspace = null;
2141 if(FileExists(filePath))
2143 if(!strcmp(extension, ProjectExtension))
2145 char workspaceFile[MAX_LOCATION];
2146 strcpy(workspaceFile, filePath);
2147 ChangeExtension(workspaceFile, WorkspaceExtension, workspaceFile);
2148 workspace = LoadWorkspace(workspaceFile, filePath);
2150 else if(!strcmp(extension, WorkspaceExtension))
2151 workspace = LoadWorkspace(filePath, null);
2154 //project = LoadProject(filePath, null);
2159 char absolutePath[MAX_LOCATION];
2160 CreateProjectView(workspace, filePath);
2161 document = projectView;
2163 workspace.DropInvalidBreakpoints();
2166 ide.projectView.ShowOutputBuildLog(true);
2168 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
2169 ide.projectView.DisplayCompiler(compiler, false);
2172 UpdateCompilerConfigs(false);
2175 char newWorkingDir[MAX_LOCATION];
2176 StripLastDirectory(filePath, newWorkingDir);
2177 ChangeFileDialogsDirectory(newWorkingDir, false);
2180 document.fileName = filePath;
2182 ideMainFrame.SetText("%s - %s", filePath, titleECEREIDE);
2184 // this crashes on starting ide with epj file, solution please?
2185 // app.UpdateDisplay();
2187 workspace.holdTracking = true;
2188 for(ofi : workspace.openedFiles)
2190 if(ofi.state != closed)
2192 Window file = OpenFile(ofi.path, normal, true, null, no, normal, noParsing);
2195 char fileName[MAX_LOCATION];
2197 GetLastDirectory(ofi.path, fileName);
2198 node = projectView.project.topNode.Find(fileName, true);
2200 node.EnsureVisible();
2204 ide.RepositionWindows(false);
2205 workspace.holdTracking = false;
2207 workspace.timer.Start();
2209 findInFilesDialog.mode = FindInFilesMode::project;
2210 findInFilesDialog.currentDirectory = ide.project.topNode.path;
2213 char location[MAX_LOCATION];
2214 StripLastDirectory(ide.project.topNode.path, location);
2215 ChangeProjectFileDialogDirectory(location);
2219 if(projectView.debugger)
2220 projectView.debugger.EvaluateWatches();
2227 if(MessageBox { type = yesNo, master = this, text = $"Error opening project", contents = $"Open a different project?" }.Modal() == yes)
2229 ideProjectFileDialog.text = openProjectFileDialogTitle;
2230 if(ideProjectFileDialog.Modal() == cancel)
2232 filePath = ideProjectFileDialog.filePath;
2233 GetExtension(filePath, extension);
2244 else if(openMethod == add)
2249 char slashFilePath[MAX_LOCATION];
2250 GetSlashPathBuffer(slashFilePath, filePath);
2251 for(p : workspace.projects)
2253 if(!fstrcmp(p.filePath, slashFilePath))
2261 MessageBox { type = ok, parent = parent, master = this, text = $"Same Project",
2262 contents = $"This project is already present in workspace." }.Modal();
2266 prj = LoadProject(filePath, null);
2269 char * activeConfigName = null;
2270 CompilerConfig compiler = ideSettings.GetCompilerConfig(workspace.compiler);
2271 prj.StartMonitoring();
2272 workspace.projects.Add(prj);
2273 if(toolBar.activeConfig.currentRow && toolBar.activeConfig.currentRow != toolBar.activeConfig.firstRow &&
2274 toolBar.activeConfig.currentRow.string && toolBar.activeConfig.currentRow.string[0])
2275 activeConfigName = toolBar.activeConfig.currentRow.string;
2276 if(activeConfigName)
2278 for(cfg : prj.configurations)
2280 if(cfg.name && !strcmp(cfg.name, activeConfigName))
2288 projectView.AddNode(prj.topNode, null);
2289 workspace.modified = true;
2291 findInFilesDialog.AddProjectItem(prj);
2292 projectView.ShowOutputBuildLog(true);
2293 projectView.DisplayCompiler(compiler, false);
2294 projectView.ProjectUpdateMakefileForAllConfigs(prj);
2298 char location[MAX_LOCATION];
2299 StripLastDirectory(prj.topNode.path, location);
2300 ChangeProjectFileDialogDirectory(location);
2303 // projectView is associated with the main project and not with the one just added but
2304 return projectView; // just to let the caller know something was opened
2312 else if(!strcmp(extension, "bmp") || !strcmp(extension, "pcx") ||
2313 !strcmp(extension, "jpg") || !strcmp(extension, "gif") ||
2314 !strcmp(extension, "jpeg") || !strcmp(extension, "png"))
2316 if(FileExists(filePath))
2317 document = PictureEdit { hasMaximize = true, hasMinimize = true, hasClose = true, borderStyle = sizable,
2318 hasVertScroll = true, hasHorzScroll = true, parent = this, state = state,
2319 visible = visible, bitmapFile = filePath, OnClose = PictureEditOnClose/*why?--GenericDocumentOnClose*/;
2322 MessageBox { type = ok, master = this, text = filePath, contents = $"File doesn't exist." }.Modal();
2325 else if(!strcmp(extension, "3ds"))
2327 if(FileExists(filePath))
2328 document = ModelView { hasMaximize = true, hasMinimize = true, hasClose = true, borderStyle = sizable,
2329 hasVertScroll = true, hasHorzScroll = true, parent = this, state = state,
2330 visible = visible, modelFile = filePath, OnClose = ModelViewOnClose/*why?--GenericDocumentOnClose*/
2334 MessageBox { type = ok, master = this, text = filePath, contents = $"File doesn't exist." }.Modal();
2337 else if(!strcmp(extension, "txt") || !strcmp(extension, "text") ||
2338 !strcmp(extension, "nfo") || !strcmp(extension, "info") ||
2339 !strcmp(extension, "htm") || !strcmp(extension, "html") ||
2340 !strcmp(extension, "css") || !strcmp(extension, "php") ||
2341 !strcmp(extension, "js"))
2343 CodeEditor editor { parent = this, state = state, visible = false, noParsing = noParsing };
2344 editor.updatingCode = true;
2345 if(editor.LoadFile(filePath))
2348 editor.visible = true;
2352 needFileModified = false;
2356 CodeEditor editor { parent = this, state = state, visible = false, noParsing = noParsing };
2357 if(editor.LoadFile(filePath))
2360 editor.visible = true;
2364 needFileModified = false;
2367 if(document && (document._class == class(PictureEdit) ||
2368 document._class == class(ModelView)))
2373 document.fileName = filePath;
2374 if(workspace && !workspace.holdTracking)
2375 workspace.UpdateOpenedFileInfo(filePath, opened);
2379 if(!document && createIfFails != no)
2381 if(createIfFails != yes && !needFileModified &&
2382 MessageBox { type = yesNo, master = this, text = filePath, contents = $"File doesn't exist. Create?" }.Modal() == yes)
2383 createIfFails = yes;
2384 if(createIfFails == yes || createIfFails == whatever)
2386 document = (Window)NewCodeEditor(this, state, true);
2388 document.fileName = filePath;
2394 if(projectView && document._class == class(CodeEditor) && workspace)
2396 int lineNumber, position;
2398 CodeEditor editor = (CodeEditor)document;
2399 editor.openedFileInfo = workspace.UpdateOpenedFileInfo(filePath, opened);
2400 editor.openedFileInfo.holdTracking = true;
2401 lineNumber = Max(editor.openedFileInfo.lineNumber - 1, 0);
2402 position = Max(editor.openedFileInfo.position - 1, 0);
2403 editor.editBox.GoToLineNum(lineNumber);
2404 editor.editBox.GoToPosition(editor.editBox.line, lineNumber, position);
2405 scroll.x = Max(editor.openedFileInfo.scroll.x, 0);
2406 scroll.y = Max(editor.openedFileInfo.scroll.y, 0);
2407 editor.editBox.scroll = scroll;
2408 editor.openedFileInfo.holdTracking = false;
2411 if(needFileModified)
2412 document.OnFileModified = OnFileModified;
2413 document.NotifySaved = DocumentSaved;
2416 ideSettings.AddRecentProject(document.fileName);
2418 ideSettings.AddRecentFile(document.fileName);
2419 ide.UpdateRecentMenus();
2420 ide.AdjustFileMenus();
2421 settingsContainer.Save();
2429 // TOCHECK: I can't use a generic one for both ModelView and PictureEdit both derived from Window
2430 /*bool Window::GenericDocumentOnClose(bool parentClosing)
2432 if(!parentClosing && ide.workspace)
2433 ide.workspace.UpdateOpenedFileInfo(fileName, unknown);
2436 bool ModelView::ModelViewOnClose(bool parentClosing)
2438 if(!parentClosing && ide.workspace)
2439 ide.workspace.UpdateOpenedFileInfo(fileName, unknown);
2442 bool PictureEdit::PictureEditOnClose(bool parentClosing)
2444 if(!parentClosing && ide.workspace)
2445 ide.workspace.UpdateOpenedFileInfo(fileName, unknown);
2450 void OnUnloadGraphics(Window window)
2452 display.ClearMaterials();
2453 display.ClearTextures();
2454 display.ClearMeshes();
2458 bool OnActivate(bool active, Window swap, bool * goOnWithActivation, bool direct)
2460 caps.color = app.GetKeyState(capsState) ? black : Color { 128,128,128 };
2461 num.color = app.GetKeyState(numState) ? black : Color { 128,128,128 };
2465 bool OnKeyDown(Key key, unichar ch)
2470 projectView.Update(null);
2473 caps.color = app.GetKeyState(capsState) ? black : Color { 128,128,128 };
2476 num.color = app.GetKeyState(numState) ? black : Color { 128,128,128 };
2482 void GoToError(const char * line, bool noParsing)
2485 projectView.GoToError(line, noParsing);
2488 void CodeLocationParseAndGoTo(const char * text, Project project, const char * dir)
2492 char *colon = strchr(text, ':');
2493 char filePath[MAX_LOCATION] = "";
2494 char completePath[MAX_LOCATION];
2495 int line = 0, col = 0;
2496 int len = strlen(text);
2498 FileAttribs fileAttribs;
2500 // support for valgrind output
2501 if((s = strstr(text, "==")) && (s = strstr(s+2, "==")) && (s = strstr(s+2, ":")) && (s = strstr(s+1, ":")))
2512 /*for(s=colon; *s; s++)
2521 //line = atoi(colon+1);
2523 // support for "Found n match(es) in "file/path";
2524 else if(path[len-1] == '\"' && strstr(path, $"Found %d match%s in \"%s\"%s\n\n"."Found") && strstr(path, $"match") && strstr(path, $"in") && (s = strstr(path, "\"")) && s != path+len-1)
2530 if(colon && (colon[1] == '/' || colon[1] == '\\'))
2532 path = (colon - 1 > path) ? colon - 1 : path;
2533 colon = strstr(colon + 1, ":");
2535 if(*path == '*' && (s = strchr(path+1, '*')))
2537 while(isspace(*path)) path++;
2541 char * close = strchr(path, ')');
2545 strncpy(name, path+1, close - path - 1);
2546 name[close - path - 1] = '\0';
2547 for(p : ide.workspace.projects)
2549 if(!strcmp(p.name, name))
2559 prj = project ? project : (dir ? null : ide.project);
2562 strncpy(filePath, path, colon - path);
2563 filePath[colon - path] = '\0';
2564 line = atoi(colon + 1);
2565 colon = strstr(colon + 1, ":");
2567 col = atoi(colon + 1);
2569 else if(path - 1 >= text && *(path - 1) == '\"')
2571 colon = strchr(path, '\"');
2574 strncpy(filePath, path, colon - path);
2575 filePath[colon - path] = '\0';
2578 else if(path && !colon)
2580 strcpy(filePath, path);
2586 strcpy(completePath, prj.topNode.path);
2587 else if(dir && dir[0])
2588 strcpy(completePath, dir);
2590 completePath[0] = '\0';
2591 PathCat(completePath, filePath);
2593 if((fileAttribs = FileExists(completePath)))
2594 CodeLocationGoTo(completePath, fileAttribs, line, col);
2595 else if(ide.workspace)
2598 for(p : ide.workspace.projects)
2600 strcpy(completePath, p.topNode.path);
2601 PathCat(completePath, filePath);
2602 if((fileAttribs = FileExists(completePath)).isFile)
2604 CodeLocationGoTo(completePath, fileAttribs, line, col);
2611 for(p : ide.workspace.projects)
2613 ProjectNode node = p.topNode.Find(filePath, false);
2616 node.GetFullFilePath(completePath);
2617 if((fileAttribs = FileExists(completePath)).isFile)
2619 CodeLocationGoTo(completePath, fileAttribs, line, col);
2629 void CodeLocationGoTo(const char * path, const FileAttribs fileAttribs, int line, int col)
2631 if(fileAttribs.isFile)
2633 char ext[MAX_EXTENSION];
2634 GetExtension(path, ext);
2635 if(!strcmp(ext, "mp3") || !strcmp(ext, "flac") || !strcmp(ext, "ogg") || !strcmp(ext, "avi") || !strcmp(ext, "mkv"))
2637 else if(!strcmp(ext, "a") || !strcmp(ext, "o") || !strcmp(ext, "lib") || !strcmp(ext, "dll") || !strcmp(ext, "exe"))
2639 char dirPath[MAX_LOCATION];
2640 StripLastDirectory(path, dirPath);
2645 CodeEditor codeEditor = (CodeEditor)OpenFile(path, normal, true, ext, no, normal, false);
2646 if(codeEditor && line)
2648 EditBox editBox = codeEditor.editBox;
2649 editBox.GoToLineNum(line - 1);
2650 editBox.GoToPosition(editBox.line, line - 1, col ? (col - 1) : 0);
2654 else if(fileAttribs.isDirectory)
2658 void OnRedraw(Surface surface)
2660 Bitmap bitmap = back.bitmap;
2662 surface.Blit(bitmap, (clientSize.w - bitmap.width) / 2, (clientSize.h - bitmap.height) / 2, 0, 0, bitmap.width, bitmap.height);
2665 void SheetSelected(SheetType sheetSelected)
2667 if(activeChild == sheet)
2669 if(sheetSelected == methods)
2671 viewPropertiesItem.accelerator = f4;
2672 viewPropertiesItem.parent = viewMenu;
2673 viewMethodsItem.parent = null;
2677 viewMethodsItem.accelerator = f4;
2678 viewMethodsItem.parent = viewMenu;
2679 viewPropertiesItem.parent = null;
2684 viewMethodsItem.parent = viewMenu;
2685 viewPropertiesItem.parent = viewMenu;
2686 if(sheetSelected == methods)
2688 viewMethodsItem.accelerator = f4;
2689 viewPropertiesItem.accelerator = 0;
2693 viewMethodsItem.accelerator = 0;
2694 viewPropertiesItem.accelerator = f4;
2699 void OnActivateClient(Window client, Window previous)
2701 //if(!client || client != previous)
2704 if(!client || client != previous)
2707 dataType = previous._class;
2708 if(previous && !strcmp(dataType.name, "CodeEditor"))
2710 ((CodeEditor)previous).UpdateFormCode();
2712 else if(previous && !strcmp(dataType.name, "Designer"))
2714 ((Designer)previous).codeEditor.UpdateFormCode();
2719 dataType = client._class;
2720 if(client && !strcmp(dataType.name, "CodeEditor"))
2722 CodeEditor codeEditor = (CodeEditor)client;
2723 SetPrivateModule(codeEditor.privateModule);
2724 SetCurrentContext(codeEditor.globalContext);
2725 SetTopContext(codeEditor.globalContext);
2726 SetGlobalContext(codeEditor.globalContext);
2728 SetDefines(&codeEditor.defines);
2729 SetImports(&codeEditor.imports);
2731 SetActiveDesigner(codeEditor.designer);
2733 sheet.codeEditor = codeEditor;
2734 toolBox.codeEditor = codeEditor;
2736 viewDesignerItem.parent = viewMenu;
2737 if(activeChild != codeEditor)
2739 viewCodeItem.parent = viewMenu;
2740 viewDesignerItem.accelerator = 0;
2741 viewCodeItem.accelerator = f8;
2745 viewCodeItem.parent = null;
2746 viewDesignerItem.accelerator = f8;
2749 else if(client && !strcmp(dataType.name, "Designer"))
2751 CodeEditor codeEditor = ((Designer)client).codeEditor;
2754 SetPrivateModule(codeEditor.privateModule);
2755 SetCurrentContext(codeEditor.globalContext);
2756 SetTopContext(codeEditor.globalContext);
2757 SetGlobalContext(codeEditor.globalContext);
2758 SetDefines(&codeEditor.defines);
2759 SetImports(&codeEditor.imports);
2763 SetPrivateModule(null);
2764 SetCurrentContext(null);
2765 SetTopContext(null);
2766 SetGlobalContext(null);
2771 SetActiveDesigner((Designer)client);
2773 sheet.codeEditor = codeEditor;
2774 toolBox.codeEditor = codeEditor;
2776 viewCodeItem.parent = viewMenu;
2777 if(activeChild != client)
2779 viewDesignerItem.parent = viewMenu;
2780 viewDesignerItem.accelerator = f8;
2781 viewCodeItem.accelerator = 0;
2785 viewDesignerItem.parent = null;
2786 viewCodeItem.accelerator = f8;
2792 sheet.codeEditor = null;
2793 toolBox.codeEditor = null;
2794 SetActiveDesigner(null);
2796 viewDesignerItem.parent = null;
2797 viewCodeItem.parent = null;
2800 SheetSelected(sheet.sheetSelected);
2803 projectCompileItem = null;
2808 if(client && client._class == eSystem_FindClass(__thisModule, "CodeEditor")) // !strcmp(client._class.name, "CodeEditor")
2810 CodeEditor codeEditor = (CodeEditor)client;
2811 EditBox editBox = codeEditor.editBox;
2813 statusBar.AddField(pos);
2815 caps = { width = 40, text = $"CAPS", color = app.GetKeyState(capsState) ? black : Color { 128, 128, 128 } };
2816 statusBar.AddField(caps);
2818 ovr = { width = 30, text = $"OVR", color = (editBox && editBox.overwrite) ? black : Color { 128, 128, 128 } };
2819 statusBar.AddField(ovr);
2821 num = { width = 30, text = $"NUM", color = app.GetKeyState(numState) ? black : Color { 128, 128, 128 } };
2822 statusBar.AddField(num);
2824 //statusBar.text = "Ready";
2826 if(projectView && projectView.project)
2828 bool isCObject = false;
2829 ProjectNode node = projectView.GetNodeFromWindow(client, null, false);
2830 if(!node && (node = projectView.GetNodeFromWindow(client, null, true)))
2834 char nodeName[MAX_FILENAME];
2835 char name[MAX_FILENAME+96];
2837 ChangeExtension(node.name, "c", nodeName);
2838 sprintf(name, $"Compile %s", isCObject ? nodeName : node.name);
2839 projectCompileItem =
2841 copyText = true, text = name, c, ctrlF7, disabled = projectView.buildInProgress;
2843 bool NotifySelect(MenuItem selection, Modifiers mods)
2847 bool result = false;
2848 bool isCObject = false;
2849 ProjectNode node = null;
2850 for(p : ide.workspace.projects)
2852 node = projectView.GetNodeFromWindow(activeClient, p, false);
2855 if(!node && (node = projectView.GetNodeFromWindow(activeClient, null, true)))
2859 List<ProjectNode> nodes { };
2861 projectView.Compile(node.project, nodes, mods.ctrl && mods.shift, isCObject ? cObject : normal);
2866 ide.outputView.buildBox.Logf($"File %s is excluded from current build configuration.\n", node.name);
2871 projectMenu.AddDynamic(projectCompileItem, ide, false);
2877 caps = ovr = num = null;
2882 bool OnClose(bool parentClosing)
2884 //return !projectView.buildInProgress;
2885 if(projectView && projectView.buildInProgress)
2887 if(DontTerminateDebugSession($"Close IDE"))
2889 if(findInFilesDialog)
2890 findInFilesDialog.SearchStop();
2893 workspace.timer.Stop();
2896 ideMainFrame.Destroy(0);
2903 bool passThrough = false;
2904 bool debugStart = false;
2905 bool debugWorkDir = false;
2906 char * passDebugWorkDir = null;
2907 bool openAsText = false;
2908 DynamicString passArgs { };
2911 for(c = 1; c<app.argc; c++)
2915 char * arg = app.argv[c];
2916 char * buf = new char[strlen(arg)*2+1];
2918 passArgs.concat(" ");
2920 passArgs.concat(buf);
2923 else if(debugWorkDir)
2925 passDebugWorkDir = CopyString(app.argv[c]);
2926 StripQuotes(passDebugWorkDir, passDebugWorkDir);
2927 debugWorkDir = false;
2929 else if(!strcmp(app.argv[c], "-t"))
2931 else if(!strcmp(app.argv[c], "-no-parsing"))
2932 ide.noParsing = true;
2933 else if(!strcmp(app.argv[c], "-debug-start"))
2935 else if(!strcmp(app.argv[c], "-debug-work-dir"))
2936 debugWorkDir = true;
2937 else if(!strcmp(app.argv[c], "-@"))
2941 char fullPath[MAX_LOCATION];
2942 char parentPath[MAX_LOCATION];
2943 char ext[MAX_EXTENSION];
2945 FileAttribs dirAttribs;
2946 GetWorkingDir(fullPath, MAX_LOCATION);
2947 PathCat(fullPath, app.argv[c]);
2948 StripLastDirectory(fullPath, parentPath);
2949 GetExtension(app.argv[c], ext);
2950 isProject = !openAsText && !strcmpi(ext, "epj");
2952 if(isProject && c > (debugStart ? 2 : 1)) continue;
2954 // Create directory for projects (only)
2955 if(((dirAttribs = FileExists(parentPath)) && dirAttribs.isDirectory) || isProject)
2957 if(isProject && !FileExists(fullPath))
2959 char name[MAX_LOCATION];
2960 NewProjectDialog newProjectDialog;
2964 projectView.visible = false;
2965 if(!projectView.Destroy(0))
2969 newProjectDialog = { master = this };
2971 strcpy(name, app.argv[c]);
2972 StripExtension(name);
2973 GetLastDirectory(name, name);
2974 newProjectDialog.projectName.contents = name;
2975 newProjectDialog.projectName.NotifyModified(newProjectDialog, newProjectDialog.projectName);
2976 newProjectDialog.locationEditBox.path = parentPath;
2977 newProjectDialog.NotifyModifiedLocation(newProjectDialog.locationEditBox);
2979 incref newProjectDialog;
2980 newProjectDialog.Modal();
2983 ideSettings.AddRecentProject(projectView.fileName);
2984 ide.UpdateRecentMenus();
2985 settingsContainer.Save();
2987 delete newProjectDialog;
2988 // Open only one project
2992 ide.OpenFile(fullPath, (app.argc == 2) * maximized, true, openAsText ? "txt" : null, yes, normal, false);
2994 else if(strstr(fullPath, "http://") == fullPath)
2995 ide.OpenFile(fullPath, (app.argc == 2) * maximized, true, openAsText ? "txt" : null, yes, normal, false);
2998 if(passThrough && projectView && projectView.project && workspace)
2999 workspace.commandLineArgs = passArgs;
3000 if(passDebugWorkDir && projectView && projectView.project && workspace)
3002 workspace.debugDir = passDebugWorkDir;
3003 delete passDebugWorkDir;
3006 ;//MenuDebugStart(debugStartResumeItem, 0); // <-- how TODO this without getting into the app.Wait lock
3008 UpdateToolBarActiveConfigs(false);
3009 UpdateToolBarActiveCompilers();
3016 // IS THIS NEEDED? WASN'T HERE BEFORE... Crashes on getting node's projectView otherwise
3019 projectView.visible = false;
3020 projectView.Destroy(0);
3023 #ifdef GDB_DEBUG_GUI
3024 gdbDialog.Destroy(0);
3029 void SetPath(bool projectsDirs, CompilerConfig compiler, ProjectConfig config, int bitDepth)
3033 char * oldPaths[128];
3034 String oldList = new char[maxPathLen];
3035 Array<String> newExePaths { };
3036 //Map<String, bool> exePathExists { };
3038 #if defined(__unix__) || defined(__APPLE__)
3039 Array<String> newLibPaths { };
3040 Map<String, bool> libPathExists { };
3045 for(prj : workspace.projects)
3047 DirExpression targetDirExp;
3049 // SKIP FIRST PROJECT...
3050 if(prj == workspace.projects.firstIterator.data) continue;
3052 // NOTE: Right now the additional project config dir will be
3053 // obtained when the debugger is started, so toggling it
3054 // while building will change which library gets used.
3055 // To go with the initial state, e.g. when F5 was pressed,
3056 // we nould need to keep a list of all project's active
3057 // config upon startup.
3058 targetDirExp = prj.GetTargetDir(compiler, prj.config, bitDepth);
3060 /*if(prj.config.targetType == sharedLibrary && prj.config.debug)
3064 for(cfg = prj.configurations.first; cfg; cfg = cfg.next)
3065 if(cfg.targetType == sharedLibrary && cfg.debug && !strcmpi(cfg.name, "Debug"))
3069 for(cfg = prj.configurations.first; cfg; cfg = cfg.next)
3070 if(cfg.targetType == sharedLibrary && cfg.debug)
3074 if(targetDirExp.dir)
3076 char buffer[MAX_LOCATION];
3077 #if defined(__WIN32__)
3078 Array<String> paths = newExePaths;
3080 Array<String> paths = newLibPaths;
3082 GetSystemPathBuffer(buffer, prj.topNode.path);
3083 PathCat(buffer, targetDirExp.dir);
3086 if(!fstrcmp(p, buffer))
3093 paths.Add(CopyString(buffer));
3095 delete targetDirExp;
3099 for(item : compiler.executableDirs)
3102 for(p : newExePaths)
3104 if(!fstrcmp(p, item))
3111 newExePaths.Add(CopySystemPath(item));
3114 GetEnvironment("PATH", oldList, maxPathLen);
3116 printf("Old value of PATH: %s\n", oldList);
3118 count = TokenizeWith(oldList, sizeof(oldPaths) / sizeof(char *), oldPaths, pathListSep, false);
3119 for(c = 0; c < count; c++)
3122 for(p : newExePaths)
3124 if(!fstrcmp(p, oldPaths[c]))
3131 newExePaths.Add(CopySystemPath(oldPaths[c]));
3135 for(path : newExePaths)
3136 len += strlen(path) + 1;
3137 newList = new char[len + 1];
3139 for(path : newExePaths)
3141 strcat(newList, path);
3142 strcat(newList, pathListSep);
3144 newList[len - 1] = '\0';
3145 SetEnvironment("PATH", newList);
3147 printf("New value of PATH: %s\n", newList);
3154 #if defined(__unix__) || defined(__APPLE__)
3156 for(item : compiler.libraryDirs)
3158 if(!libPathExists[item]) // fstrcmp should be used
3160 String s = CopyString(item);
3162 libPathExists[s] = true;
3166 #if defined(__APPLE__)
3167 GetEnvironment("DYLD_LIBRARY_PATH", oldList, maxPathLen);
3169 GetEnvironment("LD_LIBRARY_PATH", oldList, maxPathLen);
3172 printf("Old value of [DY]LD_LIBRARY_PATH: %s\n", oldList);
3174 count = TokenizeWith(oldList, sizeof(oldPaths) / sizeof(char *), oldPaths, pathListSep, false);
3175 for(c = 0; c < count; c++)
3177 if(!libPathExists[oldPaths[c]]) // fstrcmp should be used
3179 String s = CopyString(oldPaths[c]);
3181 libPathExists[s] = true;
3186 for(path : newLibPaths)
3187 len += strlen(path) + 1;
3188 newList = new char[len + 1];
3190 for(path : newLibPaths)
3192 strcat(newList, path);
3193 strcat(newList, pathListSep);
3195 newList[len - 1] = '\0';
3196 #if defined(__APPLE__)
3197 SetEnvironment("DYLD_LIBRARY_PATH", newList);
3199 SetEnvironment("LD_LIBRARY_PATH", newList);
3202 printf("New value of [DY]LD_LIBRARY_PATH: %s\n", newList);
3208 delete libPathExists;
3211 if(compiler.distccEnabled && compiler.distccHosts)
3212 SetEnvironment("DISTCC_HOSTS", compiler.distccHosts);
3217 void DestroyTemporaryProjectDir()
3219 if(tmpPrjDir && tmpPrjDir[0])
3221 if(FileExists(tmpPrjDir).isDirectory)
3222 DestroyDir(tmpPrjDir);
3223 property::tmpPrjDir = null;
3229 // Graphics Driver Menu
3233 app.currentSkin.selectionColor = selectionColor;
3234 app.currentSkin.selectionText = selectionText;
3238 driverItems = new MenuItem[app.numDrivers];
3239 for(c = 0; c < app.numDrivers; c++)
3241 driverItems[c] = MenuItem { driversMenu, app.drivers[c], NotifySelect = NotifySelectDisplayDriver };
3242 driverItems[c].id = c;
3243 driverItems[c].isRadio = true;
3246 driverItems = new MenuItem[2];
3247 #if defined(__unix__)
3248 driverItems[0] = MenuItem { driversMenu, "X", NotifySelect = NotifySelectDisplayDriver };
3249 driverItems[0].id = 0;
3250 driverItems[0].isRadio = true;
3252 driverItems[0] = MenuItem { driversMenu, "GDI", NotifySelect = NotifySelectDisplayDriver };
3253 driverItems[0].id = 0;
3254 driverItems[0].isRadio = true;
3256 driverItems[1] = MenuItem { driversMenu, "OpenGL", NotifySelect = NotifySelectDisplayDriver };
3257 driverItems[1].id = 1;
3258 driverItems[1].isRadio = true;
3260 /* skinItems = new MenuItem[app.numSkins];
3261 for(c = 0; c < app.numSkins; c++)
3263 skinItems[c] = MenuItem {skinsMenu, app.skins[c], NotifySelect = NotifySelectDisplaySkin };
3264 skinItems[c].id = c;
3265 skinItems[c].isRadio = true;
3268 ideFileDialog.master = this;
3269 ideProjectFileDialog.master = this;
3271 //SetDriverAndSkin();
3275 void UpdateRecentMenus()
3278 Menu fileMenu = menu.FindMenu($"File");
3279 Menu recentFiles = fileMenu.FindMenu($"Recent Files");
3280 Menu recentProjects = fileMenu.FindMenu($"Recent Projects");
3281 char * itemPath = new char[MAX_LOCATION];
3282 char * itemName = new char[MAX_LOCATION+4];
3285 recentFiles.Clear();
3288 for(recent : ideSettings.recentFiles)
3290 strncpy(itemPath, recent, MAX_LOCATION); itemPath[MAX_LOCATION-1] = '\0';
3291 MakeSystemPath(itemPath);
3292 snprintf(itemName, MAX_LOCATION+4, "%d %s", 1 + c, itemPath); itemName[MAX_LOCATION+4-1] = '\0';
3293 recentFiles.AddDynamic(MenuItem { copyText = true, text = itemName, (Key)k1 + c, id = c, NotifySelect = ide.FileRecentFile }, ide, true);
3297 recentProjects.Clear();
3299 for(recent : ideSettings.recentProjects)
3301 strncpy(itemPath, recent, MAX_LOCATION); itemPath[MAX_LOCATION-1] = '\0';
3302 MakeSystemPath(itemPath);
3303 snprintf(itemName, MAX_LOCATION+4, "%d %s", 1 + c, itemPath); itemName[MAX_LOCATION+4-1] = '\0';
3304 recentProjects.AddDynamic(MenuItem { copyText = true, text = itemName, (Key)k1 + c, id = c, NotifySelect = ide.FileRecentProject }, ide, true);
3320 void DestroyDir(char * path)
3322 RecursiveDeleteFolderFSI fsi { };
3327 #if defined(__WIN32__)
3328 define sdkDirName = "Ecere SDK";
3330 define sdkDirName = "ecere";
3333 void FindAndShellOpenInstalledFolder(char * name)
3335 char * p = new char[MAX_LOCATION];
3336 char * v = new char[maxPathLen];
3339 Array<String> paths { };
3341 strncpy(p, settingsContainer.moduleLocation, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3342 StripLastDirectory(p, p);
3344 paths.Add(CopyString(p));
3345 #if defined(__WIN32__)
3346 GetEnvironment("ECERE_SDK_SRC", v, maxPathLen);
3349 strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3350 PathCat(p, name); paths.Add(CopyString(p));
3352 GetEnvironment("AppData", v, maxPathLen);
3355 strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3356 PathCat(p, sdkDirName); PathCat(p, name); paths.Add(CopyString(p));
3358 GetEnvironment("ProgramFiles", v, maxPathLen);
3361 strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3362 PathCat(p, sdkDirName); PathCat(p, name); paths.Add(CopyString(p));
3364 GetEnvironment("ProgramFiles(x86)", v, maxPathLen);
3367 strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3368 PathCat(p, sdkDirName); PathCat(p, name); paths.Add(CopyString(p));
3370 GetEnvironment("SystemDrive", v, maxPathLen);
3373 strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3374 PathCat(p, "Program Files"); PathCat(p, sdkDirName); PathCat(p, name); paths.Add(CopyString(p));
3377 GetEnvironment("XDG_DATA_DIRS", v, maxPathLen);
3378 numTokens = TokenizeWith(v, sizeof(tokens) / sizeof(byte *), tokens, ":", false);
3379 for(c=0; c<numTokens; c++)
3381 strncpy(p, tokens[c], MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3382 PathCat(p, sdkDirName); PathCat(p, name); paths.Add(CopyString(p));
3387 strncpy(p, path, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3388 if(FileExists(p).isDirectory)
3400 void FindAndShellOpenInstalledFile(char * subdir, char * name)
3402 char * p = new char[MAX_LOCATION];
3403 char * v = new char[maxPathLen];
3406 Array<String> paths { };
3408 strncpy(p, settingsContainer.moduleLocation, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3409 paths.Add(CopyString(p));
3410 StripLastDirectory(p, p);
3412 paths.Add(CopyString(p));
3413 #if defined(__WIN32__)
3414 GetEnvironment("ECERE_SDK_SRC", v, maxPathLen);
3417 strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3418 PathCat(p, sdkDirName); PathCat(p, subdir); paths.Add(CopyString(p));
3420 GetEnvironment("AppData", v, maxPathLen);
3423 strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3424 PathCat(p, sdkDirName); PathCat(p, subdir); paths.Add(CopyString(p));
3426 GetEnvironment("ProgramFiles", v, maxPathLen);
3429 strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3430 PathCat(p, sdkDirName); PathCat(p, subdir); paths.Add(CopyString(p));
3432 GetEnvironment("ProgramFiles(x86)", v, maxPathLen);
3435 strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3436 PathCat(p, sdkDirName); PathCat(p, subdir); paths.Add(CopyString(p));
3438 GetEnvironment("SystemDrive", v, maxPathLen);
3441 strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3442 PathCat(p, "Program Files"); PathCat(p, sdkDirName); PathCat(p, subdir); paths.Add(CopyString(p));
3445 GetEnvironment("XDG_DATA_DIRS", v, maxPathLen);
3446 numTokens = TokenizeWith(v, sizeof(tokens) / sizeof(byte *), tokens, ":", false);
3447 for(c=0; c<numTokens; c++)
3449 strncpy(p, tokens[c], MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3450 PathCat(p, sdkDirName); PathCat(p, subdir); paths.Add(CopyString(p));
3455 strncpy(p, path, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3457 if(FileExists(p).isFile)
3469 class RecursiveDeleteFolderFSI : NormalFileSystemIterator
3471 bool preserveRootFolder;
3473 void OutFolder(char * folderPath, bool isRoot)
3475 if(!(preserveRootFolder && isRoot))
3476 RemoveDir(folderPath);
3479 bool OnFile(char * filePath)
3481 DeleteFile(filePath);
3486 class IDEApp : GuiApplication
3488 //driver = "Win32Console";
3489 // driver = "OpenGL";
3493 TempFile includeFile { };
3497 char ext[MAX_EXTENSION];
3498 SetLoggingMode(stdOut, null);
3499 //SetLoggingMode(debug, null);
3501 settingsContainer.Load();
3502 if(argc > 1 && !strcmpi(GetExtension(argv[1], ext), "3ds"))
3504 app.driver = "OpenGL";
3505 ide.driverItems[1].checked = true;
3509 #if defined(__unix__) || defined(__APPLE__)
3510 app.driver = (ideSettings.displayDriver && !strcmp(ideSettings.displayDriver, "OpenGL")) ? ideSettings.displayDriver : "X";
3512 app.driver = (ideSettings.displayDriver && !strcmp(ideSettings.displayDriver, "OpenGL")) ? ideSettings.displayDriver : "GDI";
3514 ide.driverItems[ideSettings.displayDriver && !strcmp(ideSettings.displayDriver,"OpenGL")].checked = true;
3519 desktop.text = titleECEREIDE;
3522 for(c = 1; c<app.argc; c++)
3524 char fullPath[MAX_LOCATION];
3525 GetWorkingDir(fullPath, MAX_LOCATION);
3526 PathCat(fullPath, app.argv[c]);
3527 ide.OpenFile(fullPath, (app.argc == 2) * maximized, true, null, yes, normal, false);
3531 if(!LoadIncludeFile())
3532 PrintLn("error: unable to load :crossplatform.mk file inside ide binary.");
3537 bool LoadIncludeFile()
3539 bool result = false;
3540 File include = FileOpen(":crossplatform.mk", read);
3543 File f = includeFile;
3546 for(; !include.Eof(); )
3549 int count = include.Read(buffer, 1, 4096);
3550 f.Write(buffer, 1, count);
3560 IDEMainFrame ideMainFrame { };
3562 define app = ((IDEApp)__thisModule);
3564 define titleECEREIDE = $"ECERE IDE (Debug)";
3566 define titleECEREIDE = $"ECERE IDE";