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)
285 ide.workspace.SelectActiveConfig(row.string);
290 Window spacer6 { this, size = { 4 } };
292 DropBox activeCompiler
294 this, toolTip = $"Active Compiler", size = { 160 }, disabled = true;
295 bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
297 if(ide.workspace && ide.projectView && row && strcmp(row.string, ide.workspace.compiler))
299 bool silent = ide.projectView.buildInProgress == none ? false : true;
300 CompilerConfig compiler = ideSettings.GetCompilerConfig(row.string);
301 ide.workspace.compiler = row.string;
302 ide.projectView.ShowOutputBuildLog(!silent);
304 ide.projectView.DisplayCompiler(compiler, false);
305 for(prj : ide.workspace.projects)
306 ide.projectView.ProjectPrepareCompiler(prj, compiler, silent);
308 ide.workspace.Save();
314 DropBox activeBitDepth
316 this, toolTip = $"Active Bit Depth", size = { 60 }, disabled = true;
317 bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
319 if(ide.workspace && ide.projectView && row)
321 bool silent = ide.projectView.buildInProgress == none ? false : true;
322 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
323 ide.workspace.bitDepth = (int)row.tag;
324 ide.projectView.ShowOutputBuildLog(!silent);
326 ide.projectView.DisplayCompiler(compiler, false);
327 for(prj : ide.workspace.projects)
328 ide.projectView.ProjectPrepareCompiler(prj, compiler, silent);
330 ide.workspace.Save();
336 Window spacer7 { this, size = { 4 } };
341 row = activeBitDepth.AddString("Auto");
343 activeBitDepth.AddString("32 bit").tag = 32;
344 activeBitDepth.AddString("64 bit").tag = 64;
345 activeBitDepth.currentRow = row;
350 class IDEMainFrame : Window
352 background = formColor;
353 borderStyle = sizable;
357 minClientSize = { 600, 300 };
359 icon = { ":icon.png" };
360 text = titleECEREIDE;
364 anchor = { top = 0, right = 0, bottom = 0 };
367 anchor = { left = 0, top = 0, right = 0, bottom = 0 };
374 isActiveClient = true;
376 direction = vertical;
377 background = formColor;
378 anchor = { left = 0, top = 0, right = 0, bottom = 0 };
386 ((IDEWorkSpace)master).toolBar = null;
389 IDEWorkSpace ideWorkSpace { stack, this, toolBar = toolBar };
392 define ide = ideMainFrame.ideWorkSpace;
394 class IDEWorkSpace : Window
396 background = Color { 85, 85, 85 };
399 hasVertScroll = true;
400 hasHorzScroll = true;
402 isActiveClient = true;
403 anchor = { left = 0, top = 0, right = 0, bottom = 0 };
407 MenuItem * driverItems, * skinItems;
408 StatusField pos { width = 150 };
409 StatusField ovr, caps, num;
411 BitmapResource back { ":ecereBack.jpg", window = this };
412 BitmapResource bmpBp { ":codeMarks/breakpoint.png", window = this };
413 BitmapResource bmpBpDisabled { ":codeMarks/breakpointDisabled.png", window = this };
414 BitmapResource bmpBpHalf { ":codeMarks/breakpointHalf.png", window = this };
415 BitmapResource bmpBpHalfDisabled { ":codeMarks/breakpointHalfDisabled.png", window = this };
416 BitmapResource bmpCursor { ":codeMarks/cursor.png", window = this };
417 BitmapResource bmpCursorError { ":codeMarks/cursorError.png", window = this };
418 BitmapResource bmpTopFrame { ":codeMarks/topFrame.png", window = this };
419 BitmapResource bmpTopFrameError { ":codeMarks/topFrameError.png", window = this };
420 BitmapResource bmpTopFrameHalf { ":codeMarks/topFrameHalf.png", window = this };
421 BitmapResource bmpTopFrameHalfError { ":codeMarks/topFrameHalfError.png", window = this };
423 Debugger debugger { };
425 ProjectView projectView;
427 OutputView outputView
431 void OnGotoError(char * line, bool noParsing)
433 ide.GoToError(line, noParsing);
436 void OnCodeLocationParseAndGoTo(char * line)
438 ide.CodeLocationParseAndGoTo(line, ide.findInFilesDialog.findProject, ide.findInFilesDialog.findDir);
441 bool OnKeyDown(Key key, unichar ch)
446 if(activeBox != findBox || !ide.findInFilesDialog || !ide.findInFilesDialog.SearchAbort())
447 ide.ShowCodeEditor();
451 OutputView::OnKeyDown(key, ch);
458 bool OnClose(bool parentClosing)
462 ide.RepositionWindows(false);
463 return parentClosing;
467 CallStackView callStackView
469 parent = this, font = { panelFont.faceName, panelFont.size };
471 void OnSelectFrame(int frameIndex)
473 ide.debugger.GoToStackFrameLine(frameIndex, true);
475 ide.debugger.SelectFrame(frameIndex);
478 void OnToggleBreakpoint()
480 Debugger debugger = ide.debugger;
481 if(debugger.activeFrame && debugger.activeFrame.absoluteFile)
483 int line = debugger.activeFrame.line;
484 char name[MAX_LOCATION];
486 // TOFIX: Improve on this, don't use only filename, make a function
487 GetLastDirectory(debugger.activeFrame.absoluteFile, name);
488 if(ide && ide.workspace)
490 for(p : ide.workspace.projects)
492 if(p.topNode.Find(name, false))
500 for(p : ide.workspace.projects)
502 if(IsPathInsideOf(debugger.activeFrame.absoluteFile, p.topNode.path))
510 debugger.ToggleBreakpoint(debugger.activeFrame.absoluteFile, line, prj);
513 CodeEditor codeEditor = (CodeEditor)ide.FindWindow(debugger.activeFrame.absoluteFile);
514 if(codeEditor) { codeEditor.Update(null); Activate(); }
519 bool OnKeyDown(Key key, unichar ch)
523 case escape: ide.ShowCodeEditor(); break;
528 bool OnClose(bool parentClosing)
532 ide.RepositionWindows(false);
533 return parentClosing;
536 void OnRedraw(Surface surface)
538 Debugger debugger = ide.debugger;
539 Frame activeFrame = debugger.activeFrame;
543 int lineCursor, lineTopFrame, activeThread, hitThread;
544 int lineH, scrollY, boxH;
546 Breakpoint bp = null;
549 scrollY = editBox.scroll.y;
550 displaySystem.FontExtent(editBox.font.font, " ", 1, null, &lineH);
551 activeThread = debugger.activeThread;
552 hitThread = debugger.hitThread;
553 debugger.GetCallStackCursorLine(&error, &lineCursor, &lineTopFrame);
555 // TODO: improve bp drawing... it should be visible even if it's not on the activeFrame
556 if(activeFrame.absoluteFile)
558 for(i : ide.workspace.breakpoints; i.type == user)
560 if(i.absoluteFilePath && i.absoluteFilePath[0] &&
561 !fstrcmp(i.absoluteFilePath, activeFrame.absoluteFile) &&
562 activeFrame.line == i.line)
570 DrawLineMarginIcon(surface,
571 /*(lineCursor == 1 || lineTopFrame == 1) ? */ide.bmpBpHalf/* : ide.bmpBp*/,
572 lineCursor /*1*/, lineH, scrollY, boxH);
574 if(activeThread && activeThread == hitThread && debugger.bpHit && debugger.bpHit.type == user)
575 DrawLineMarginIcon(surface,
576 (lineCursor == 1 || lineTopFrame == 1) ? ide.bmpBpHalf : ide.bmpBp,
577 1, lineH, scrollY, boxH);
579 DrawLineMarginIcon(surface, error ? ide.bmpCursorError : ide.bmpCursor, lineCursor, lineH, scrollY, boxH);
580 if(bp && lineCursor == 1) //activeThread && activeThread == hitThread && debugger.bpHit && debugger.bpHit.type == user)
581 bmp = error ? ide.bmpTopFrameHalfError : ide.bmpTopFrameHalf;
583 bmp = error ? ide.bmpTopFrameError : ide.bmpTopFrame;
584 DrawLineMarginIcon(surface, bmp, lineTopFrame, lineH, scrollY, boxH);
586 if(editBox.horzScroll && editBox.horzScroll.visible)
588 surface.SetBackground(control);
589 surface.Area(0, editBox.clientSize.h, 20 - 1, clientSize.h - 1);
594 WatchesView watchesView { parent = this };
595 ThreadsView threadsView
597 parent = this, font = { panelFont.faceName, panelFont.size };
599 bool OnKeyDown(Key key, unichar ch)
603 case escape: ide.ShowCodeEditor(); break;
608 bool OnClose(bool parentClosing)
612 ide.RepositionWindows(false);
613 return parentClosing;
616 void OnSelectThread(int threadId)
619 ide.debugger.SelectThread(threadId);
622 bool OnGetThreadsInfo(int * activeThread, int * hitThread, int * signalThread)
625 Debugger debugger = ide.debugger;
626 *activeThread = debugger.activeThread;
627 *hitThread = debugger.hitThread;
628 *signalThread = debugger.signalThread;
633 BreakpointsView breakpointsView { parent = this };
635 ToolBox toolBox { parent = this };
636 Sheet sheet { parent = this };
639 property char * tmpPrjDir { set { delete tmpPrjDir; if(value) tmpPrjDir = CopyString(value); } get { return tmpPrjDir; } };
641 Menu fileMenu { menu, $"File", f, hasMargin = true };
644 fileMenu, $"New", n, ctrlN;
645 bitmap = { ":actions/docNew.png" };
646 bool NotifySelect(MenuItem selection, Modifiers mods)
648 Window document = (Window)NewCodeEditor(this, normal, false);
649 document.NotifySaved = DocumentSaved;
653 MenuItem fileOpenItem
655 fileMenu, $"Open...", o, ctrlO;
656 bitmap = { ":actions/docOpen.png" };
657 bool NotifySelect(MenuItem selection, Modifiers mods)
659 if(!projectView && ideSettings.ideFileDialogLocation)
660 ideFileDialog.currentDirectory = ideSettings.ideFileDialogLocation;
663 if(ideFileDialog.Modal() == ok)
665 bool gotWhatWeWant = false;
667 int numSelections = ideFileDialog.numSelections;
668 char ** multiFilePaths = ideFileDialog.multiFilePaths;
670 for(c = 0; c < numSelections; c++)
672 if(OpenFile(multiFilePaths[c], normal, true, fileTypes[ideFileDialog.fileType].typeExtension, no, normal, mods.ctrl && mods.shift))
673 gotWhatWeWant = true;
676 MessageBox { type = yesNo, master = this, text = $"Error opening file",
677 contents = $"Open a different file?" }.Modal() == no)
679 if(!projectView && gotWhatWeWant)
680 ChangeFileDialogsDirectory(ideFileDialog.currentDirectory, true);
681 ide.RepositionWindows(false);
691 MenuItem fileCloseItem { fileMenu, $"Close", c, ctrlF4, NotifySelect = MenuFileClose };
692 MenuDivider { fileMenu };
693 MenuItem fileSaveItem
695 fileMenu, $"Save", s, ctrlS, bitmap = { ":actions/docSave.png" };
697 // For the toolbar button; clients can still override that for the menu item
698 bool Window::NotifySelect(MenuItem selection, Modifiers mods)
700 Window w = activeClient;
702 w.MenuFileSave(null, 0);
706 MenuItem fileSaveAsItem { fileMenu, $"Save As...", a };
707 MenuItem fileSaveAllItem { fileMenu, $"Save All", l, NotifySelect = MenuFileSaveAll, bitmap = { ":actions/docSaveAll.png" } };
708 MenuDivider { fileMenu };
711 fileMenu, $"Find In Files...", f, Key { f, ctrl = true , shift = true };
712 bool NotifySelect(MenuItem selection, Modifiers mods)
714 findInFilesDialog.replaceMode = false;
715 findInFilesDialog.Show();
719 MenuItem replaceInFiles
721 fileMenu, $"Replace In Files...", e, Key { r, ctrl = true , shift = true };
722 bool NotifySelect(MenuItem selection, Modifiers mods)
724 findInFilesDialog.replaceMode = true;
725 findInFilesDialog.Show();
729 MenuDivider { fileMenu };
730 MenuItem globalSettingsItem
732 fileMenu, $"Global Settings...", g;
733 bool NotifySelect(MenuItem selection, Modifiers mods)
735 globalSettingsDialog.master = this;
736 if(ide.workspace && ide.workspace.compiler)
737 globalSettingsDialog.workspaceActiveCompiler = ide.workspace.compiler;
738 else if(ideSettings.defaultCompiler)
739 globalSettingsDialog.workspaceActiveCompiler = ideSettings.defaultCompiler;
740 globalSettingsDialog.Modal();
744 MenuDivider { fileMenu };
745 Menu recentFiles { fileMenu, $"Recent Files", r };
746 Menu recentProjects { fileMenu, $"Recent Projects", p };
747 MenuDivider { fileMenu };
750 fileMenu, $"Exit", x, altF4;
752 bool NotifySelect(MenuItem selection, Modifiers mods)
754 ideMainFrame.Destroy(0);
759 bool FileRecentFile(MenuItem selection, Modifiers mods)
762 for(file : ideSettings.recentFiles)
764 if(id == selection.id)
767 char extension[MAX_EXTENSION] = "";
768 GetExtension(file, extension);
769 isProjectFile = (!strcmpi(extension, "epj") || !strcmpi(extension, "ews"));
772 char * command = PrintString("ide ", isProjectFile ? "-t " : "", file);
778 OpenFile(file, normal, true, isProjectFile ? "txt" : null, no, normal, mods.ctrl && mods.shift);
779 ide.RepositionWindows(false);
788 bool FileRecentProject(MenuItem selection, Modifiers mods)
791 for(file : ideSettings.recentProjects)
793 if(id == selection.id)
797 char * command = PrintString("ide ", file);
802 OpenFile(file, normal, true, null, no, normal, mods.ctrl && mods.shift);
810 MenuPlacement editMenu { menu, $"Edit", e };
812 Menu projectMenu { menu, $"Menu"."Project", p, hasMargin = true };
813 MenuItem projectNewItem
815 projectMenu, $"New...", n, Key { n, true, true };
816 bitmap = { ":actions/projNew.png" };
817 bool NotifySelect(MenuItem selection, Modifiers mods)
819 if(!DontTerminateDebugSession($"New Project"))
822 NewProjectDialog newProjectDialog { master = this };
823 incref newProjectDialog;
824 result = newProjectDialog.Modal();
829 newProjectDialog.CreateNewProject();
832 ideSettings.AddRecentProject(projectView.fileName);
833 ide.UpdateRecentMenus();
834 settingsContainer.Save();
838 delete newProjectDialog;
843 MenuItem projectOpenItem
845 projectMenu, $"Open...", o, Key { o, true, true };
846 bitmap = { ":actions/projOpen.png" };
847 bool NotifySelect(MenuItem selection, Modifiers mods)
849 if(ideSettings.ideProjectFileDialogLocation)
850 ideProjectFileDialog.currentDirectory = ideSettings.ideProjectFileDialogLocation;
852 ideProjectFileDialog.text = openProjectFileDialogTitle;
853 if(ideProjectFileDialog.Modal() == ok)
855 OpenFile(ideProjectFileDialog.filePath, normal, true, projectTypes[ideProjectFileDialog.fileType].typeExtension, no, normal, mods.ctrl && mods.shift);
856 //ChangeProjectFileDialogDirectory(ideProjectFileDialog.currentDirectory);
861 MenuItem projectQuickItem
863 projectMenu, $"Quick...", q, f7, disabled = true;
864 bool NotifySelect(MenuItem selection, Modifiers mods)
867 QuickProjectDialog { this }.Modal();
871 MenuItem projectAddItem
873 projectMenu, $"Add project to workspace...", a, Key { a, true, true };
874 bitmap = { ":actions/projAdd.png" };
876 bool NotifySelect(MenuItem selection, Modifiers mods)
878 if(ideSettings.ideProjectFileDialogLocation)
879 ideProjectFileDialog.currentDirectory = ideSettings.ideProjectFileDialogLocation;
881 ideProjectFileDialog.text = addProjectFileDialogTitle;
884 if(ideProjectFileDialog.Modal() == ok)
886 if(OpenFile(ideProjectFileDialog.filePath, normal, true, projectTypes[ideProjectFileDialog.fileType].typeExtension, no, add, mods.ctrl && mods.shift))
888 if(MessageBox { type = yesNo, master = this, text = $"Error opening project file",
889 contents = $"Add a different project?" }.Modal() == no)
900 MenuItem projectCloseItem
902 projectMenu, $"Close", c, disabled = true;
903 bool NotifySelect(MenuItem selection, Modifiers mods)
907 if(!ide.DontTerminateDebugSession($"Project Close"))
913 MenuDivider { projectMenu };
914 MenuItem projectSettingsItem
916 projectMenu, $"Settings...", s, altF7, disabled = true;
917 bool NotifySelect(MenuItem selection, Modifiers mods)
919 projectView.MenuSettings(projectView.active ? selection : null, mods);
923 MenuDivider { projectMenu };
924 MenuItem projectBrowseFolderItem
926 projectMenu, $"Browse Project Folder", p, disabled = true;
927 bool NotifySelect(MenuItem selection, Modifiers mods)
930 projectView.MenuBrowseFolder(null, mods);
934 MenuDivider { projectMenu };
935 MenuItem projectRunItem
937 projectMenu, $"Run", r, ctrlF5, disabled = true;
938 bitmap = { ":actions/run.png" };
939 bool NotifySelect(MenuItem selection, Modifiers mods)
942 projectView.Run(null, mods);
946 MenuItem projectBuildItem
948 projectMenu, $"Build", b, f7, disabled = true;
949 bitmap = { ":actions/build.png" };
950 bool NotifySelect(MenuItem selection, Modifiers mods)
954 if(projectView.buildInProgress == none)
955 projectView.ProjectBuild(projectView.active ? selection : null, mods);
957 projectView.stopBuild = true;
962 MenuItem projectLinkItem
964 projectMenu, $"Relink", l, disabled = true;
965 bitmap = { ":actions/relink.png" };
966 bool NotifySelect(MenuItem selection, Modifiers mods)
969 projectView.ProjectLink(projectView.active ? selection : null, mods);
973 MenuItem projectRebuildItem
975 projectMenu, $"Rebuild", d, shiftF7, disabled = true;
976 bitmap = { ":actions/rebuild.png" };
977 bool NotifySelect(MenuItem selection, Modifiers mods)
980 projectView.ProjectRebuild(projectView.active ? selection : null, mods);
984 MenuItem projectCleanTargetItem
986 projectMenu, $"Clean Target", g, disabled = true;
987 bitmap = { ":actions/clean.png" };
988 bool NotifySelect(MenuItem selection, Modifiers mods)
993 projectView.ProjectCleanTarget(projectView.active ? selection : null, mods);
998 MenuItem projectCleanItem
1000 projectMenu, $"Clean", e, disabled = true;
1001 bitmap = { ":actions/clean.png" };
1002 bool NotifySelect(MenuItem selection, Modifiers mods)
1007 projectView.ProjectClean(projectView.active ? selection : null, mods);
1012 MenuItem projectRealCleanItem
1014 projectMenu, $"Real Clean", disabled = true;
1015 bitmap = { ":actions/clean.png" };
1016 bool NotifySelect(MenuItem selection, Modifiers mods)
1021 projectView.ProjectRealClean(projectView.active ? selection : null, mods);
1026 MenuItem projectRegenerateItem
1028 projectMenu, $"Regenerate Makefile", m, disabled = true;
1029 bitmap = { ":actions/regMakefile.png" };
1030 bool NotifySelect(MenuItem selection, Modifiers mods)
1033 projectView.ProjectRegenerate(projectView.active ? selection : null, mods);
1037 MenuItem projectInstallItem
1039 #ifdef IDE_SHOW_INSTALL_MENU_BUTTON
1040 projectMenu, $"Install", t, disabled = true;
1042 bitmap = { ":status/software-update-available.png" };
1043 bool NotifySelect(MenuItem selection, Modifiers mods)
1046 projectView.ProjectInstall(projectView.active ? selection : null, mods);
1050 MenuItem projectCompileItem;
1051 Menu debugMenu { menu, $"Debug", d, hasMargin = true };
1052 MenuItem debugStartResumeItem
1054 debugMenu, $"Start", s, f5, disabled = true;
1055 bitmap = { ":actions/debug.png" };
1056 NotifySelect = MenuDebugStart;
1058 bool MenuDebugStart(MenuItem selection, Modifiers mods)
1062 debugStartResumeItem.disabled = true; // a very rare exception to calling AdjustDebugMenus
1063 if(!projectView.DebugStart())
1064 debugStartResumeItem.disabled = false; // same exception
1068 bool MenuDebugResume(MenuItem selection, Modifiers mods)
1071 projectView.DebugResume();
1074 MenuItem debugRestartItem
1076 debugMenu, $"Restart", r, Key { f5, ctrl = true, shift = true }, disabled = true;
1077 bitmap = { ":actions/restart.png" };
1078 bool NotifySelect(MenuItem selection, Modifiers mods)
1081 projectView.DebugRestart();
1085 MenuItem debugBreakItem
1087 debugMenu, $"Break", b, Key { pauseBreak, ctrl = true }, disabled = true;
1088 bitmap = { ":actions/pause.png" };
1089 bool NotifySelect(MenuItem selection, Modifiers mods)
1091 if(projectView && projectView.buildInProgress != none)
1094 projectView.DebugBreak();
1098 MenuItem debugStopItem
1100 debugMenu, $"Stop", p, shiftF5, disabled = true;
1101 bitmap = { ":actions/stopDebug.png" };
1102 bool NotifySelect(MenuItem selection, Modifiers mods)
1105 projectView.DebugStop();
1109 MenuDivider { debugMenu };
1110 MenuItem debugUseValgrindItem
1112 debugMenu, $"Use Valgrind", d, disabled = true, checkable = true;
1113 bool NotifySelect(MenuItem selection, Modifiers mods)
1117 ide.workspace.useValgrind = selection.checked;
1118 ide.workspace.Save();
1120 ide.AdjustValgrindChecks();
1124 MenuItem debugValgrindFullLeakCheckItem
1126 debugMenu, $"Valgrind: Full Leak Check", d, disabled = true, checkable = true;
1127 bool NotifySelect(MenuItem selection, Modifiers mods)
1131 ide.workspace.vgFullLeakCheck = selection.checked;
1132 ide.workspace.Save();
1137 MenuDivider { debugMenu };
1138 MenuItem debugStepIntoItem
1140 debugMenu, $"Step Into", i, f11, disabled = true;
1141 bitmap = { ":actions/stepInto.png" };
1142 bool NotifySelect(MenuItem selection, Modifiers mods)
1145 projectView.DebugStepInto();
1149 MenuItem debugStepOverItem
1151 debugMenu, $"Step Over", v, f10, disabled = true;
1152 bitmap = { ":actions/stepOver.png" };
1153 bool NotifySelect(MenuItem selection, Modifiers mods)
1156 projectView.DebugStepOver(false);
1160 MenuItem debugStepOutItem
1162 debugMenu, $"Step Out", o, shiftF11, disabled = true;
1163 bitmap = { ":actions/stepOut.png" };
1164 bool NotifySelect(MenuItem selection, Modifiers mods)
1167 projectView.DebugStepOut(false);
1171 MenuPlacement debugRunToCursorItem { debugMenu, $"Run To Cursor", c };
1172 MenuItem debugSkipStepOverItem
1174 debugMenu, $"Step Over Skipping Breakpoints", e, shiftF10, disabled = true;
1175 bool NotifySelect(MenuItem selection, Modifiers mods)
1178 projectView.DebugStepOver(true);
1182 MenuItem debugSkipStepOutItem
1184 debugMenu, $"Step Out Skipping Breakpoints", t, Key { f11, ctrl = true, shift = true }, disabled = true;
1185 bitmap = { ":actions/skipBreaks.png" };
1186 bool NotifySelect(MenuItem selection, Modifiers mods)
1189 projectView.DebugStepOut(true);
1193 MenuPlacement debugSkipRunToCursorItem { debugMenu, $"Run To Cursor Skipping Breakpoints", u };
1194 MenuPlacement debugSkipRunToCursorAtSameLevelItem { debugMenu, $"Run To Cursor At Same Level Skipping Breakpoints", l };
1195 //MenuDivider { debugMenu };
1196 //MenuPlacement debugToggleBreakpoint { debugMenu, "Toggle Breakpoint", t };
1197 MenuPlacement imageMenu { menu, $"Image", i };
1198 Menu viewMenu { menu, $"View", v };
1199 MenuItem viewProjectItem
1201 viewMenu, $"Project View", j, alt0, disabled = true;
1202 bool NotifySelect(MenuItem selection, Modifiers mods)
1206 projectView.visible = true;
1207 projectView.Activate();
1212 MenuPlacement { viewMenu, $"View Designer" };
1213 MenuPlacement { viewMenu, $"View Code" };
1214 MenuPlacement { viewMenu, $"View Properties" };
1215 MenuPlacement { viewMenu, $"View Methods" };
1216 MenuItem viewDesignerItem
1218 viewMenu, $"View Designer", d, f8;
1219 bool NotifySelect(MenuItem selection, Modifiers mods)
1221 Window client = activeClient;
1222 Class dataType = client._class;
1223 if(!strcmp(dataType.name, "Designer"))
1225 client.visible = true;
1229 ((CodeEditor)client).ViewDesigner();
1233 MenuItem viewCodeItem
1235 viewMenu, $"View Code", c, f8;
1236 bool NotifySelect(MenuItem selection, Modifiers mods)
1238 Window client = activeClient;
1239 Class dataType = client._class;
1240 if(!strcmp(dataType.name, "Designer"))
1241 client = ((Designer)client).codeEditor;
1244 // Do this after so the caret isn't moved yet...
1245 client.visible = true;
1249 MenuItem viewPropertiesItem
1251 viewMenu, $"View Properties", p, f4;
1252 bool NotifySelect(MenuItem selection, Modifiers mods)
1254 sheet.visible = true;
1255 sheet.sheetSelected = properties;
1260 MenuItem viewMethodsItem
1262 viewMenu, $"View Methods", m, f4;
1263 bool NotifySelect(MenuItem selection, Modifiers mods)
1265 sheet.visible = true;
1266 sheet.sheetSelected = methods;
1271 MenuItem viewToolBoxItem
1273 viewMenu, $"View Toolbox", x, f12;
1274 bool NotifySelect(MenuItem selection, Modifiers mods)
1276 toolBox.visible = true;
1281 MenuItem viewOutputItem
1283 viewMenu, $"Output", o, alt2;
1284 bool NotifySelect(MenuItem selection, Modifiers mods)
1290 MenuItem viewWatchesItem
1292 viewMenu, $"Watches", w, alt3;
1293 bool NotifySelect(MenuItem selection, Modifiers mods)
1299 MenuItem viewThreadsItem
1301 viewMenu, $"Threads", t, alt4;
1302 bool NotifySelect(MenuItem selection, Modifiers mods)
1308 MenuItem viewBreakpointsItem
1310 viewMenu, $"Breakpoints", b, alt5;
1311 bool NotifySelect(MenuItem selection, Modifiers mods)
1313 breakpointsView.Show();
1317 MenuItem viewCallStackItem
1319 viewMenu, $"Call Stack", s, alt7;
1320 bool NotifySelect(MenuItem selection, Modifiers mods)
1322 callStackView.Show();
1326 MenuItem viewAllDebugViews
1328 viewMenu, $"All Debug Views", a, alt9;
1329 bool NotifySelect(MenuItem selection, Modifiers mods)
1334 callStackView.Show();
1335 breakpointsView.Show();
1339 #ifdef GDB_DEBUG_GUI
1340 MenuDivider { viewMenu };
1341 MenuItem viewGDBItem
1343 viewMenu, $"GDB Dialog", g, Key { f9, shift = true, ctrl = true };
1344 bool NotifySelect(MenuItem selection, Modifiers mods)
1351 MenuDivider { viewMenu };
1352 MenuItem viewColorPicker
1354 viewMenu, $"Color Picker...", c, Key { c, ctrl = true , shift = true };
1355 bool NotifySelect(MenuItem selection, Modifiers mods)
1357 ColorPicker colorPicker { master = this };
1358 colorPicker.Modal();
1362 MenuDivider { viewMenu };
1366 viewMenu, "Full Screen", f, checkable = true;
1368 bool NotifySelect(MenuItem selection, Modifiers mods)
1370 app.fullScreen ^= true;
1372 anchor = { 0, 0, 0, 0 };
1377 Menu driversMenu { viewMenu, $"Graphics Driver", v };
1378 //Menu skinsMenu { viewMenu, "GUI Skins", k };
1379 Menu windowMenu { menu, $"Window", w };
1380 MenuItem { windowMenu, $"Close All", l, NotifySelect = MenuWindowCloseAll };
1381 MenuDivider { windowMenu };
1382 MenuItem { windowMenu, $"Next", n, f6, NotifySelect = MenuWindowNext };
1383 MenuItem { windowMenu, $"Previous", p, shiftF6, NotifySelect = MenuWindowPrevious };
1384 MenuDivider { windowMenu };
1385 MenuItem { windowMenu, $"Cascade", c, NotifySelect = MenuWindowCascade };
1386 MenuItem { windowMenu, $"Tile Horizontally", h, NotifySelect = MenuWindowTileHorz };
1387 MenuItem { windowMenu, $"Tile Vertically", v, NotifySelect = MenuWindowTileVert };
1388 MenuItem { windowMenu, $"Arrange Icons", a, NotifySelect = MenuWindowArrangeIcons };
1389 MenuDivider { windowMenu };
1390 MenuItem { windowMenu, $"Windows...", w, NotifySelect = MenuWindowWindows };
1391 Menu helpMenu { menu, $"Help", h };
1394 helpMenu, $"API Reference", r, f1;
1395 bool NotifySelect(MenuItem selection, Modifiers mods)
1397 char * p = new char[MAX_LOCATION];
1399 strncpy(p, settingsContainer.moduleLocation, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
1400 PathCat(p, "documentor");
1401 #if defined(__WIN32__)
1402 ChangeExtension(p, "exe", p);
1404 if(FileExists(p).isFile)
1407 Execute("documentor");
1412 MenuDivider { helpMenu };
1415 helpMenu, $"Ecere Tao of Programming [work in progress]", t;
1416 bool NotifySelect(MenuItem selection, Modifiers mods)
1418 FindAndShellOpenInstalledFile("doc", "Ecere Tao of Programming [work in progress].pdf");
1422 MenuDivider { helpMenu };
1425 helpMenu, $"Documentation Folder", d;
1426 bool NotifySelect(MenuItem selection, Modifiers mods)
1428 FindAndShellOpenInstalledFolder("doc");
1434 helpMenu, $"Samples Folder", s;
1435 bool NotifySelect(MenuItem selection, Modifiers mods)
1437 FindAndShellOpenInstalledFolder("samples");
1443 helpMenu, $"Extras Folder", x;
1444 bool NotifySelect(MenuItem selection, Modifiers mods)
1446 FindAndShellOpenInstalledFolder("extras");
1450 MenuDivider { helpMenu };
1453 helpMenu, $"Community Forums", f;
1454 bool NotifySelect(MenuItem selection, Modifiers mods)
1456 ShellOpen("http://ecere.com/forums");
1460 MenuDivider { helpMenu };
1463 helpMenu, $"About...", a;
1464 bool NotifySelect(MenuItem selection, Modifiers mods)
1466 AboutIDE { master = this }.Modal();
1471 property ToolBox toolBox
1473 get { return toolBox; }
1476 property Sheet sheet
1478 get { return sheet; }
1481 property Project project
1483 get { return projectView ? projectView.project : null; }
1486 property Workspace workspace
1488 get { return projectView ? projectView.workspace : null; }
1491 FindInFilesDialog findInFilesDialog
1494 filters = findInFilesFileFilters.array, sizeFilters = findInFilesFileFilters.count * sizeof(FileFilter);
1500 #ifdef GDB_DEBUG_GUI
1503 master = this, parent = this;
1504 //anchor = { left = 100, top = 100, right = 100, bottom = 100 };
1506 void OnCommand(char * string)
1509 ide.debugger.SendGDBCommand(string);
1514 bool NotifySelectDisplayDriver(MenuItem selection, Modifiers mods)
1516 //app.driver = app.drivers[selection.id];
1517 #if defined(__unix__) || defined(__APPLE__)
1518 app.driver = selection.id ? "OpenGL" : "X";
1520 app.driver = selection.id ? "OpenGL" : "GDI";
1522 delete ideSettings.displayDriver;
1523 ideSettings.displayDriver = CopyString(selection.id ? "OpenGL" : "Default");
1525 settingsContainer.Save();
1526 //SetDriverAndSkin();
1530 bool NotifySelectDisplaySkin(MenuItem selection, Modifiers mods)
1532 app.skin = app.skins[selection.id];
1537 void SetDriverAndSkin()
1540 for(c = 0; c < app.numSkins; c++)
1541 if(!strcmp(app.skins[c], app.skin))
1543 skinItems[c].checked = true;
1546 for(c = 0; c < app.numDrivers; c++)
1547 if(!strcmp(app.drivers[c], app.driver))
1549 driverItems[c].checked = true;
1554 ProjectView CreateProjectView(Workspace workspace, char * fileName)
1556 Project project = workspace.projects.firstIterator.data;
1557 projectView = ProjectView
1560 fileName = fileName;
1562 void NotifyDestroyed(Window window, DialogResult result)
1565 text = titleECEREIDE;
1570 projectView.Create();
1571 RepositionWindows(false);
1573 // Leave it after Create to avoid flicker due to seeing IDE without a project view
1574 projectView.workspace = workspace;
1575 projectView.project = project;
1576 ideMainFrame.SetText("%s - %s", project.topNode.name, titleECEREIDE);
1580 ide.breakpointsView.LoadFromWorkspace();
1581 ide.watchesView.LoadFromWorkspace();
1583 findInFilesDialog.projectNodeField.userData = projectView;
1586 char fileName[MAX_LOCATION];
1587 strcpy(fileName, project.topNode.path);
1588 PathCat(fileName, project.topNode.name);
1595 projectView.visible = false;
1596 if((!projectView || projectView.created == false || projectView.Destroy(0)) && MenuWindowCloseAll(null, 0))
1598 if(findInFilesDialog)
1600 char workingDir[MAX_LOCATION];
1601 GetWorkingDir(workingDir, MAX_LOCATION);
1602 findInFilesDialog.SearchStop();
1603 findInFilesDialog.currentDirectory = workingDir;
1605 ideMainFrame.text = titleECEREIDE;
1612 void RepositionWindows(bool expand)
1617 bool inDebugMode = debugger.isActive;
1618 bool callStackVisible = expand ? false : callStackView.visible;
1619 bool threadsVisible = expand ? false : threadsView.visible;
1620 bool watchesVisible = expand ? false : watchesView.visible;
1621 bool breakpointsVisible = expand ? false : breakpointsView.visible;
1622 bool toolBoxVisible = toolBox.visible;
1623 bool outputVisible = expand ? false : outputView.visible;
1624 int topDistance = (callStackVisible || threadsVisible) ? 200 : 0;
1625 int bottomDistance = (outputVisible || watchesVisible || breakpointsVisible) ? 240 : 0;
1627 for(child = firstChild; child; child = child.next)
1629 if(child._class == class(CodeEditor) || child._class == class(Designer) ||
1630 child._class == class(Sheet) || child._class == class(ProjectView))
1632 Anchor anchor = child.anchor;
1633 anchor.top = topDistance;
1634 anchor.bottom = bottomDistance;
1635 if(child._class == class(CodeEditor) || child._class == class(Designer))
1638 anchor.right = toolBoxVisible ? 150 : 0;
1640 child.anchor = anchor;
1644 if(child._class == class(OutputView) || child._class == class(CallStackView) || child._class == class(ThreadsView) || child._class == class(WatchesView) ||
1645 child._class == class(BreakpointsView))
1646 child.visible = false;
1649 // If this is not here, the IDE is not updated when doing Debug/Break then Alt-4 to show call stack (IDE not updated)
1654 bool ShowCodeEditor()
1657 activeClient.Activate();
1658 else if(projectView)
1660 projectView.visible = true;
1661 projectView.Activate();
1665 sheet.visible = true;
1671 void DocumentSaved(Window document, char * fileName)
1673 ideSettings.AddRecentFile(fileName);
1674 ide.UpdateRecentMenus();
1675 ide.AdjustFileMenus();
1676 settingsContainer.Save();
1679 bool Window::OnFileModified(FileChange fileChange, char * param)
1682 sprintf(temp, $"The document %s was modified by another application.\n"
1683 "Would you like to reload it and lose your changes?", this.fileName);
1684 if(MessageBox { type = yesNo, master = this/*.parent*/,
1685 text = $"Document has been modified", contents = temp }.Modal() == yes)
1687 bool noParsing = (this._class == class(CodeEditor) && ((CodeEditor)this).noParsing) ? true : false;
1688 char * fileName = CopyString(this.fileName);
1689 WindowState state = this.state;
1690 Anchor anchor = this.anchor;
1691 Size size = this.size;
1693 this.modifiedDocument = false;
1695 this = ide.OpenFile(fileName, normal, true, null, no, normal, noParsing);
1698 this.anchor = anchor;
1700 this.SetState(state, true, 0);
1708 void UpdateMakefiles()
1712 CompilerConfig compiler = ideSettings.GetCompilerConfig(workspace.compiler);
1713 for(prj : workspace.projects)
1714 projectView.ProjectUpdateMakefileForAllConfigs(prj);
1719 void UpdateCompilerConfigs(bool mute)
1721 UpdateToolBarActiveCompilers();
1724 bool silent = mute || (ide.projectView.buildInProgress == none ? false : true);
1725 CompilerConfig compiler = ideSettings.GetCompilerConfig(workspace.compiler);
1728 projectView.ShowOutputBuildLog(true);
1729 projectView.DisplayCompiler(compiler, false);
1731 for(prj : workspace.projects)
1732 projectView.ProjectPrepareCompiler(prj, compiler, silent);
1737 void UpdateToolBarActiveCompilers()
1739 toolBar.activeCompiler.Clear();
1740 for(compiler : ideSettings.compilerConfigs)
1742 DataRow row = toolBar.activeCompiler.AddString(compiler.name);
1743 if(workspace && workspace.compiler && !strcmp(compiler.name, workspace.compiler))
1744 toolBar.activeCompiler.currentRow = row;
1746 if(!toolBar.activeCompiler.currentRow && toolBar.activeCompiler.firstRow)
1747 toolBar.activeCompiler.SelectRow(toolBar.activeCompiler.firstRow);
1750 void UpdateToolBarActiveConfigs(bool selectionOnly)
1752 bool commonSelected = false;
1753 DataRow row = toolBar.activeConfig.currentRow;
1755 row = toolBar.activeConfig.FindRow(1);
1758 toolBar.activeConfig.Clear();
1759 row = toolBar.activeConfig.AddString($"(Mixed)");
1764 char * configName = null;
1767 Map<String, int> configs { }; // TOIMP: just need sort but using map until containers have sort
1768 for(prj : workspace.projects)
1770 for(cfg : prj.configurations)
1773 configs[cfg.name] = 1;
1778 toolBar.activeConfig.AddString(&name);
1782 if(projectView && projectView.project)
1784 for(prj : workspace.projects)
1786 if(prj.config && prj.config.name)
1788 configName = prj.config.name;
1794 commonSelected = true;
1795 for(prj : workspace.projects)
1797 if(prj.config && (!prj.config.name || strcmp(prj.config.name, configName)))
1799 commonSelected = false;
1807 commonSelected = false;
1808 for(row = toolBar.activeConfig.firstRow; row; row = row.next)
1810 if(!strcmp(row.string, configName))
1812 toolBar.activeConfig.currentRow = row;
1813 commonSelected = true;
1820 toolBar.activeConfig.Sort(null, 0);
1822 toolBar.activeConfig.currentRow = row;
1827 bool unavailable = !project;
1829 projectAddItem.disabled = unavailable;
1830 toolBar.buttonAddProject.disabled = unavailable;
1832 projectSettingsItem.disabled = unavailable;
1834 projectBrowseFolderItem.disabled = unavailable;
1836 viewProjectItem.disabled = unavailable;
1838 toolBar.activeConfig.disabled = unavailable;
1839 toolBar.activeCompiler.disabled = unavailable;
1840 toolBar.activeBitDepth.disabled = unavailable;
1841 debugUseValgrindItem.disabled = unavailable;
1843 AdjustValgrindChecks();
1849 void AdjustValgrindChecks()
1851 bool unavailable = !project || !debugUseValgrindItem.checked;
1852 debugValgrindFullLeakCheckItem.disabled = unavailable;
1855 property bool hasOpenedCodeEditors
1860 for(w = firstChild; w; w = w.next)
1861 if(w._class == class(CodeEditor) &&
1862 w.isDocument && !w.closing && w.visible && w.created &&
1863 w.fileName && w.fileName[0])
1869 void AdjustFileMenus()
1871 bool unavailable = project != null || !hasOpenedCodeEditors; // are they supported source code (ec, c, cpp, etc) ?
1873 projectQuickItem.disabled = unavailable;
1876 void AdjustBuildMenus()
1878 bool unavailable = project && projectView.buildInProgress;
1879 bool naForRun = unavailable || !project || project.GetTargetType(project.config) != executable;
1881 projectNewItem.disabled = unavailable;
1882 toolBar.buttonNewProject.disabled = unavailable;
1883 projectOpenItem.disabled = unavailable;
1884 toolBar.buttonOpenProject.disabled = unavailable;
1886 unavailable = !project || projectView.buildInProgress;
1888 projectCloseItem.disabled = unavailable;
1889 // toolBar.buttonCloseProject.disabled = unavailable;
1891 projectRunItem.disabled = naForRun;
1892 toolBar.buttonRun.disabled = naForRun;
1894 projectBuildItem.disabled = false;
1895 projectBuildItem.text = unavailable ? $"Stop Build" : $"Build";
1896 projectBuildItem.accelerator = unavailable ? Key { pauseBreak, ctrl = true } : f7;
1898 projectLinkItem.disabled = unavailable;
1899 toolBar.buttonReLink.disabled = unavailable;
1900 projectRebuildItem.disabled = unavailable;
1901 toolBar.buttonRebuild.disabled = unavailable;
1902 projectCleanItem.disabled = unavailable;
1903 toolBar.buttonClean.disabled = unavailable;
1904 projectCleanTargetItem.disabled = unavailable;
1905 projectRealCleanItem.disabled = unavailable;
1906 // toolBar.buttonRealClean.disabled = unavailable;
1907 projectRegenerateItem.disabled = unavailable;
1908 toolBar.buttonRegenerateMakefile.disabled = unavailable;
1909 #ifdef IDE_SHOW_INSTALL_MENU_BUTTON
1910 projectInstallItem.disabled = unavailable;
1911 toolBar.buttonInstall.disabled = unavailable;
1913 projectCompileItem.disabled = unavailable;
1915 AdjustPopupBuildMenus();
1918 void AdjustPopupBuildMenus()
1920 bool unavailable = !project || projectView.buildInProgress;
1922 if(projectView && projectView.popupMenu && projectView.popupMenu.menu && projectView.popupMenu.created)
1925 menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectBuild, 0);
1928 menu.disabled = false;
1929 menu.text = unavailable ? $"Stop Build" : $"Build";
1930 menu.accelerator = unavailable ? Key { pauseBreak, ctrl = true } : f7;
1933 menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectLink, 0); if(menu) menu.disabled = unavailable;
1934 menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectRebuild, 0); if(menu) menu.disabled = unavailable;
1935 menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectCleanTarget, 0); if(menu) menu.disabled = unavailable;
1936 menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectClean, 0); if(menu) menu.disabled = unavailable;
1937 menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectRealClean, 0); if(menu) menu.disabled = unavailable;
1938 menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectRegenerate, 0); if(menu) menu.disabled = unavailable;
1939 menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectInstall, 0); if(menu) menu.disabled = unavailable;
1940 menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectRemove, 0); if(menu) menu.disabled = unavailable;
1941 menu = projectView.popupMenu.menu.FindItem(ProjectView::FileClean, 0); if(menu) menu.disabled = unavailable;
1942 menu = projectView.popupMenu.menu.FindItem(ProjectView::FileCompile, 0); if(menu) menu.disabled = unavailable;
1943 menu = projectView.popupMenu.menu.FindItem(ProjectView::FileDebugPrecompile, 0); if(menu) menu.disabled = unavailable;
1944 menu = projectView.popupMenu.menu.FindItem(ProjectView::FileDebugCompile, 0); if(menu) menu.disabled = unavailable;
1945 menu = projectView.popupMenu.menu.FindItem(ProjectView::FileDebugGenerateSymbols, 0); if(menu) menu.disabled = unavailable;
1946 projectView.popupMenu.Update(null);
1950 property bool areDebugMenusUnavailable { get {
1952 project.GetTargetType(project.config) != executable ||
1953 projectView.buildInProgress == buildingMainProject;
1956 property bool isBreakpointTogglingUnavailable { get {
1960 property bool isDebuggerExecuting { get {
1964 return ide.debugger.state == running;
1967 void AdjustDebugMenus()
1969 bool unavailable = areDebugMenusUnavailable;
1970 bool active = debugger.isActive;
1971 bool bpNoToggle = isBreakpointTogglingUnavailable;
1972 bool executing = isDebuggerExecuting;
1973 //bool holding = debugger.state == stopped;
1975 debugStartResumeItem.disabled = unavailable || executing;
1976 debugStartResumeItem.text = active ? $"Resume" : $"Start";
1977 debugStartResumeItem.NotifySelect = active ? MenuDebugResume : MenuDebugStart;
1980 toolBar.buttonDebugStartResume.disabled = unavailable || executing;
1981 toolBar.buttonDebugStartResume.toolTip = active ? $"Resume" : $"Start";
1984 debugBreakItem.disabled = unavailable || !executing;
1985 debugStopItem.disabled = unavailable || !active;
1986 debugRestartItem.disabled = unavailable || !active;
1989 toolBar.buttonDebugPause.disabled = unavailable || !executing;
1990 toolBar.buttonDebugStop.disabled = unavailable || !active;
1991 toolBar.buttonDebugRestart.disabled = unavailable || !active;
1994 debugStepIntoItem.disabled = unavailable || executing;
1995 debugStepOverItem.disabled = unavailable || executing;
1996 debugStepOutItem.disabled = unavailable || executing || !active;
1997 debugSkipStepOverItem.disabled = unavailable || executing;
1998 debugSkipStepOutItem.disabled = unavailable || executing || !active;
2001 toolBar.buttonDebugStepInto.disabled = unavailable || executing;
2002 toolBar.buttonDebugStepOver.disabled = unavailable || executing;
2003 toolBar.buttonDebugStepOut.disabled = unavailable || executing || !active;
2004 toolBar.buttonDebugSkipStepOver.disabled = unavailable || executing;
2005 // toolBar.buttonDebugSkipStepOutItem.disabled = unavailable || executing;
2007 if((Designer)GetActiveDesigner())
2009 CodeEditor codeEditor = ((Designer)GetActiveDesigner()).codeEditor;
2011 codeEditor.AdjustDebugMenus(unavailable, bpNoToggle, executing);
2015 void ChangeFileDialogsDirectory(char * directory, bool saveSettings)
2017 char tempString[MAX_LOCATION];
2018 strcpy(tempString, directory);
2019 if(saveSettings && !projectView)
2021 ideSettings.ideFileDialogLocation = directory;
2022 settingsContainer.Save();
2025 ideFileDialog.currentDirectory = tempString;
2026 codeEditorFileDialog.currentDirectory = tempString;
2027 codeEditorFormFileDialog.currentDirectory = tempString;
2030 void ChangeProjectFileDialogDirectory(char * directory)
2032 ideSettings.ideProjectFileDialogLocation = directory;
2033 settingsContainer.Save();
2036 Window FindWindow(char * filePath)
2038 Window document = null;
2040 // TOCHECK: Do we need to change slashes here?
2041 for(document = firstChild; document; document = document.next)
2043 char * fileName = document.fileName;
2044 if(document.isDocument && fileName && !fstrcmp(fileName, filePath))
2046 document.visible = true;
2047 document.Activate();
2054 bool DontTerminateDebugSession(char * title)
2056 if(debugger.isActive)
2058 if(MessageBox { type = yesNo, master = ide,
2059 contents = $"Do you want to terminate the debugging session in progress?",
2060 text = title }.Modal() == no)
2063 MessageBox msg { type = yesNo, master = ide,
2064 contents = "Do you want to terminate the debugging session in progress?",
2066 if(msg.Modal() == no)
2078 Window OpenFile(char * origFilePath, WindowState state, bool visible, char * type, OpenCreateIfFails createIfFails, OpenMethod openMethod, bool noParsing)
2080 char extension[MAX_EXTENSION] = "";
2081 Window document = null;
2082 bool isProject = false;
2083 bool needFileModified = true;
2084 char winFilePath[MAX_LOCATION];
2085 char * filePath = strstr(origFilePath, "http://") == origFilePath ? strcpy(winFilePath, origFilePath) : GetSystemPathBuffer(winFilePath, origFilePath);
2089 GetExtension(filePath, extension);
2093 strcpy(extension, type);
2095 if(strcmp(extension, ProjectExtension))
2097 for(document = firstChild; document; document = document.next)
2099 char * fileName = document.fileName;
2100 if(document.isDocument && fileName && !fstrcmp(fileName, filePath) && document.created)
2102 document.visible = true;
2104 document.Activate();
2110 if(createIfFails == whatever)
2112 else if(!strcmp(extension, ProjectExtension) || !strcmp(extension, WorkspaceExtension))
2114 needFileModified = false;
2115 if(openMethod == normal)
2117 if(DontTerminateDebugSession($"Open Project"))
2127 Workspace workspace = null;
2129 if(FileExists(filePath))
2131 if(!strcmp(extension, ProjectExtension))
2133 char workspaceFile[MAX_LOCATION];
2134 strcpy(workspaceFile, filePath);
2135 ChangeExtension(workspaceFile, WorkspaceExtension, workspaceFile);
2136 workspace = LoadWorkspace(workspaceFile, filePath);
2138 else if(!strcmp(extension, WorkspaceExtension))
2139 workspace = LoadWorkspace(filePath, null);
2142 //project = LoadProject(filePath, null);
2147 char absolutePath[MAX_LOCATION];
2148 CreateProjectView(workspace, filePath);
2149 document = projectView;
2151 workspace.DropInvalidBreakpoints();
2154 ide.projectView.ShowOutputBuildLog(true);
2156 CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
2157 ide.projectView.DisplayCompiler(compiler, false);
2160 UpdateCompilerConfigs(false);
2163 char newWorkingDir[MAX_LOCATION];
2164 StripLastDirectory(filePath, newWorkingDir);
2165 ChangeFileDialogsDirectory(newWorkingDir, false);
2168 document.fileName = filePath;
2170 ideMainFrame.SetText("%s - %s", filePath, titleECEREIDE);
2172 // this crashes on starting ide with epj file, solution please?
2173 // app.UpdateDisplay();
2175 workspace.holdTracking = true;
2176 for(ofi : workspace.openedFiles)
2178 if(ofi.state != closed)
2180 Window file = OpenFile(ofi.path, normal, true, null, no, normal, noParsing);
2183 char fileName[MAX_LOCATION];
2185 GetLastDirectory(ofi.path, fileName);
2186 node = projectView.project.topNode.Find(fileName, true);
2188 node.EnsureVisible();
2192 ide.RepositionWindows(false);
2193 workspace.holdTracking = false;
2195 workspace.timer.Start();
2197 findInFilesDialog.mode = FindInFilesMode::project;
2198 findInFilesDialog.currentDirectory = ide.project.topNode.path;
2201 char location[MAX_LOCATION];
2202 StripLastDirectory(ide.project.topNode.path, location);
2203 ChangeProjectFileDialogDirectory(location);
2207 if(projectView.debugger)
2208 projectView.debugger.EvaluateWatches();
2215 if(MessageBox { type = yesNo, master = this, text = $"Error opening project", contents = $"Open a different project?" }.Modal() == yes)
2217 ideProjectFileDialog.text = openProjectFileDialogTitle;
2218 if(ideProjectFileDialog.Modal() == cancel)
2220 filePath = ideProjectFileDialog.filePath;
2221 GetExtension(filePath, extension);
2232 else if(openMethod == add)
2237 char slashFilePath[MAX_LOCATION];
2238 GetSlashPathBuffer(slashFilePath, filePath);
2239 for(p : workspace.projects)
2241 if(!fstrcmp(p.filePath, slashFilePath))
2249 MessageBox { type = ok, parent = parent, master = this, text = $"Same Project",
2250 contents = $"This project is already present in workspace." }.Modal();
2254 prj = LoadProject(filePath, null);
2257 char * activeConfigName = null;
2258 CompilerConfig compiler = ideSettings.GetCompilerConfig(workspace.compiler);
2259 prj.StartMonitoring();
2260 workspace.projects.Add(prj);
2261 if(toolBar.activeConfig.currentRow && toolBar.activeConfig.currentRow != toolBar.activeConfig.firstRow &&
2262 toolBar.activeConfig.currentRow.string && toolBar.activeConfig.currentRow.string[0])
2263 activeConfigName = toolBar.activeConfig.currentRow.string;
2264 if(activeConfigName)
2266 for(cfg : prj.configurations)
2268 if(cfg.name && !strcmp(cfg.name, activeConfigName))
2276 projectView.AddNode(prj.topNode, null);
2277 workspace.modified = true;
2279 findInFilesDialog.AddProjectItem(prj);
2280 projectView.ShowOutputBuildLog(true);
2281 projectView.DisplayCompiler(compiler, false);
2282 projectView.ProjectUpdateMakefileForAllConfigs(prj);
2286 char location[MAX_LOCATION];
2287 StripLastDirectory(prj.topNode.path, location);
2288 ChangeProjectFileDialogDirectory(location);
2291 // projectView is associated with the main project and not with the one just added but
2292 return projectView; // just to let the caller know something was opened
2300 else if(!strcmp(extension, "bmp") || !strcmp(extension, "pcx") ||
2301 !strcmp(extension, "jpg") || !strcmp(extension, "gif") ||
2302 !strcmp(extension, "jpeg") || !strcmp(extension, "png"))
2304 if(FileExists(filePath))
2305 document = PictureEdit { hasMaximize = true, hasMinimize = true, hasClose = true, borderStyle = sizable,
2306 hasVertScroll = true, hasHorzScroll = true, parent = this, state = state,
2307 visible = visible, bitmapFile = filePath, OnClose = PictureEditOnClose/*why?--GenericDocumentOnClose*/;
2310 MessageBox { type = ok, master = this, text = filePath, contents = $"File doesn't exist." }.Modal();
2313 else if(!strcmp(extension, "3ds"))
2315 if(FileExists(filePath))
2316 document = ModelView { hasMaximize = true, hasMinimize = true, hasClose = true, borderStyle = sizable,
2317 hasVertScroll = true, hasHorzScroll = true, parent = this, state = state,
2318 visible = visible, modelFile = filePath, OnClose = ModelViewOnClose/*why?--GenericDocumentOnClose*/
2322 MessageBox { type = ok, master = this, text = filePath, contents = $"File doesn't exist." }.Modal();
2325 else if(!strcmp(extension, "txt") || !strcmp(extension, "text") ||
2326 !strcmp(extension, "nfo") || !strcmp(extension, "info") ||
2327 !strcmp(extension, "htm") || !strcmp(extension, "html") ||
2328 !strcmp(extension, "css") || !strcmp(extension, "php") ||
2329 !strcmp(extension, "js"))
2331 CodeEditor editor { parent = this, state = state, visible = false, noParsing = noParsing };
2332 editor.updatingCode = true;
2333 if(editor.LoadFile(filePath))
2336 editor.visible = true;
2340 needFileModified = false;
2344 CodeEditor editor { parent = this, state = state, visible = false, noParsing = noParsing };
2345 if(editor.LoadFile(filePath))
2348 editor.visible = true;
2352 needFileModified = false;
2355 if(document && (document._class == class(PictureEdit) ||
2356 document._class == class(ModelView)))
2361 document.fileName = filePath;
2362 if(workspace && !workspace.holdTracking)
2363 workspace.UpdateOpenedFileInfo(filePath, opened);
2367 if(!document && createIfFails != no)
2369 if(createIfFails != yes && !needFileModified &&
2370 MessageBox { type = yesNo, master = this, text = filePath, contents = $"File doesn't exist. Create?" }.Modal() == yes)
2371 createIfFails = yes;
2372 if(createIfFails == yes || createIfFails == whatever)
2374 document = (Window)NewCodeEditor(this, state, true);
2376 document.fileName = filePath;
2382 if(projectView && document._class == class(CodeEditor) && workspace)
2384 int lineNumber, position;
2386 CodeEditor editor = (CodeEditor)document;
2387 editor.openedFileInfo = workspace.UpdateOpenedFileInfo(filePath, opened);
2388 editor.openedFileInfo.holdTracking = true;
2389 lineNumber = Max(editor.openedFileInfo.lineNumber - 1, 0);
2390 position = Max(editor.openedFileInfo.position - 1, 0);
2391 editor.editBox.GoToLineNum(lineNumber);
2392 editor.editBox.GoToPosition(editor.editBox.line, lineNumber, position);
2393 scroll.x = Max(editor.openedFileInfo.scroll.x, 0);
2394 scroll.y = Max(editor.openedFileInfo.scroll.y, 0);
2395 editor.editBox.scroll = scroll;
2396 editor.openedFileInfo.holdTracking = false;
2399 if(needFileModified)
2400 document.OnFileModified = OnFileModified;
2401 document.NotifySaved = DocumentSaved;
2404 ideSettings.AddRecentProject(document.fileName);
2406 ideSettings.AddRecentFile(document.fileName);
2407 ide.UpdateRecentMenus();
2408 ide.AdjustFileMenus();
2409 settingsContainer.Save();
2417 // TOCHECK: I can't use a generic one for both ModelView and PictureEdit both derived from Window
2418 /*bool Window::GenericDocumentOnClose(bool parentClosing)
2420 if(!parentClosing && ide.workspace)
2421 ide.workspace.UpdateOpenedFileInfo(fileName, unknown);
2424 bool ModelView::ModelViewOnClose(bool parentClosing)
2426 if(!parentClosing && ide.workspace)
2427 ide.workspace.UpdateOpenedFileInfo(fileName, unknown);
2430 bool PictureEdit::PictureEditOnClose(bool parentClosing)
2432 if(!parentClosing && ide.workspace)
2433 ide.workspace.UpdateOpenedFileInfo(fileName, unknown);
2438 void OnUnloadGraphics(Window window)
2440 display.ClearMaterials();
2441 display.ClearTextures();
2442 display.ClearMeshes();
2446 bool OnActivate(bool active, Window swap, bool * goOnWithActivation, bool direct)
2448 caps.color = app.GetKeyState(capsState) ? black : Color { 128,128,128 };
2449 num.color = app.GetKeyState(numState) ? black : Color { 128,128,128 };
2453 bool OnKeyDown(Key key, unichar ch)
2458 projectView.Update(null);
2461 caps.color = app.GetKeyState(capsState) ? black : Color { 128,128,128 };
2464 num.color = app.GetKeyState(numState) ? black : Color { 128,128,128 };
2470 void GoToError(const char * line, bool noParsing)
2473 projectView.GoToError(line, noParsing);
2476 void CodeLocationParseAndGoTo(const char * text, Project project, const char * dir)
2480 char *colon = strchr(text, ':');
2481 char filePath[MAX_LOCATION] = "";
2482 char completePath[MAX_LOCATION];
2483 int line = 0, col = 0;
2484 int len = strlen(text);
2486 FileAttribs fileAttribs;
2488 // support for valgrind output
2489 if((s = strstr(text, "==")) && (s = strstr(s+2, "==")) && (s = strstr(s+2, ":")) && (s = strstr(s+1, ":")))
2500 /*for(s=colon; *s; s++)
2509 //line = atoi(colon+1);
2511 // support for "Found n match(es) in "file/path";
2512 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)
2518 if(colon && (colon[1] == '/' || colon[1] == '\\'))
2520 path = (colon - 1 > path) ? colon - 1 : path;
2521 colon = strstr(colon + 1, ":");
2523 if(*path == '*' && (s = strchr(path+1, '*')))
2525 while(isspace(*path)) path++;
2529 char * close = strchr(path, ')');
2533 strncpy(name, path+1, close - path - 1);
2534 name[close - path - 1] = '\0';
2535 for(p : ide.workspace.projects)
2537 if(!strcmp(p.name, name))
2547 prj = project ? project : (dir ? null : ide.project);
2550 strncpy(filePath, path, colon - path);
2551 filePath[colon - path] = '\0';
2552 line = atoi(colon + 1);
2553 colon = strstr(colon + 1, ":");
2555 col = atoi(colon + 1);
2557 else if(path - 1 >= text && *(path - 1) == '\"')
2559 colon = strchr(path, '\"');
2562 strncpy(filePath, path, colon - path);
2563 filePath[colon - path] = '\0';
2566 else if(path && !colon)
2568 strcpy(filePath, path);
2574 strcpy(completePath, prj.topNode.path);
2575 else if(dir && dir[0])
2576 strcpy(completePath, dir);
2578 completePath[0] = '\0';
2579 PathCat(completePath, filePath);
2581 if((fileAttribs = FileExists(completePath)))
2582 CodeLocationGoTo(completePath, fileAttribs, line, col);
2583 else if(ide.workspace)
2586 for(p : ide.workspace.projects)
2588 strcpy(completePath, p.topNode.path);
2589 PathCat(completePath, filePath);
2590 if((fileAttribs = FileExists(completePath)).isFile)
2592 CodeLocationGoTo(completePath, fileAttribs, line, col);
2599 for(p : ide.workspace.projects)
2601 ProjectNode node = p.topNode.Find(filePath, false);
2604 node.GetFullFilePath(completePath);
2605 if((fileAttribs = FileExists(completePath)).isFile)
2607 CodeLocationGoTo(completePath, fileAttribs, line, col);
2617 void CodeLocationGoTo(const char * path, const FileAttribs fileAttribs, int line, int col)
2619 if(fileAttribs.isFile)
2621 char ext[MAX_EXTENSION];
2622 GetExtension(path, ext);
2623 if(!strcmp(ext, "mp3") || !strcmp(ext, "flac") || !strcmp(ext, "ogg") || !strcmp(ext, "avi") || !strcmp(ext, "mkv"))
2625 else if(!strcmp(ext, "a") || !strcmp(ext, "o") || !strcmp(ext, "lib") || !strcmp(ext, "dll") || !strcmp(ext, "exe"))
2627 char dirPath[MAX_LOCATION];
2628 StripLastDirectory(path, dirPath);
2633 CodeEditor codeEditor = (CodeEditor)OpenFile(path, normal, true, ext, no, normal, false);
2634 if(codeEditor && line)
2636 EditBox editBox = codeEditor.editBox;
2637 editBox.GoToLineNum(line - 1);
2638 editBox.GoToPosition(editBox.line, line - 1, col ? (col - 1) : 0);
2642 else if(fileAttribs.isDirectory)
2646 void OnRedraw(Surface surface)
2648 Bitmap bitmap = back.bitmap;
2650 surface.Blit(bitmap, (clientSize.w - bitmap.width) / 2, (clientSize.h - bitmap.height) / 2, 0, 0, bitmap.width, bitmap.height);
2653 void SheetSelected(SheetType sheetSelected)
2655 if(activeChild == sheet)
2657 if(sheetSelected == methods)
2659 viewPropertiesItem.accelerator = f4;
2660 viewPropertiesItem.parent = viewMenu;
2661 viewMethodsItem.parent = null;
2665 viewMethodsItem.accelerator = f4;
2666 viewMethodsItem.parent = viewMenu;
2667 viewPropertiesItem.parent = null;
2672 viewMethodsItem.parent = viewMenu;
2673 viewPropertiesItem.parent = viewMenu;
2674 if(sheetSelected == methods)
2676 viewMethodsItem.accelerator = f4;
2677 viewPropertiesItem.accelerator = 0;
2681 viewMethodsItem.accelerator = 0;
2682 viewPropertiesItem.accelerator = f4;
2687 void OnActivateClient(Window client, Window previous)
2689 //if(!client || client != previous)
2692 if(!client || client != previous)
2695 dataType = previous._class;
2696 if(previous && !strcmp(dataType.name, "CodeEditor"))
2698 ((CodeEditor)previous).UpdateFormCode();
2700 else if(previous && !strcmp(dataType.name, "Designer"))
2702 ((Designer)previous).codeEditor.UpdateFormCode();
2707 dataType = client._class;
2708 if(client && !strcmp(dataType.name, "CodeEditor"))
2710 CodeEditor codeEditor = (CodeEditor)client;
2711 SetPrivateModule(codeEditor.privateModule);
2712 SetCurrentContext(codeEditor.globalContext);
2713 SetTopContext(codeEditor.globalContext);
2714 SetGlobalContext(codeEditor.globalContext);
2716 SetDefines(&codeEditor.defines);
2717 SetImports(&codeEditor.imports);
2719 SetActiveDesigner(codeEditor.designer);
2721 sheet.codeEditor = codeEditor;
2722 toolBox.codeEditor = codeEditor;
2724 viewDesignerItem.parent = viewMenu;
2725 if(activeChild != codeEditor)
2727 viewCodeItem.parent = viewMenu;
2728 viewDesignerItem.accelerator = 0;
2729 viewCodeItem.accelerator = f8;
2733 viewCodeItem.parent = null;
2734 viewDesignerItem.accelerator = f8;
2737 else if(client && !strcmp(dataType.name, "Designer"))
2739 CodeEditor codeEditor = ((Designer)client).codeEditor;
2742 SetPrivateModule(codeEditor.privateModule);
2743 SetCurrentContext(codeEditor.globalContext);
2744 SetTopContext(codeEditor.globalContext);
2745 SetGlobalContext(codeEditor.globalContext);
2746 SetDefines(&codeEditor.defines);
2747 SetImports(&codeEditor.imports);
2751 SetPrivateModule(null);
2752 SetCurrentContext(null);
2753 SetTopContext(null);
2754 SetGlobalContext(null);
2759 SetActiveDesigner((Designer)client);
2761 sheet.codeEditor = codeEditor;
2762 toolBox.codeEditor = codeEditor;
2764 viewCodeItem.parent = viewMenu;
2765 if(activeChild != client)
2767 viewDesignerItem.parent = viewMenu;
2768 viewDesignerItem.accelerator = f8;
2769 viewCodeItem.accelerator = 0;
2773 viewDesignerItem.parent = null;
2774 viewCodeItem.accelerator = f8;
2780 sheet.codeEditor = null;
2781 toolBox.codeEditor = null;
2782 SetActiveDesigner(null);
2784 viewDesignerItem.parent = null;
2785 viewCodeItem.parent = null;
2788 SheetSelected(sheet.sheetSelected);
2791 projectCompileItem = null;
2796 if(client && client._class == eSystem_FindClass(__thisModule, "CodeEditor")) // !strcmp(client._class.name, "CodeEditor")
2798 CodeEditor codeEditor = (CodeEditor)client;
2799 EditBox editBox = codeEditor.editBox;
2801 statusBar.AddField(pos);
2803 caps = { width = 40, text = $"CAPS", color = app.GetKeyState(capsState) ? black : Color { 128, 128, 128 } };
2804 statusBar.AddField(caps);
2806 ovr = { width = 30, text = $"OVR", color = (editBox && editBox.overwrite) ? black : Color { 128, 128, 128 } };
2807 statusBar.AddField(ovr);
2809 num = { width = 30, text = $"NUM", color = app.GetKeyState(numState) ? black : Color { 128, 128, 128 } };
2810 statusBar.AddField(num);
2812 //statusBar.text = "Ready";
2814 if(projectView && projectView.project)
2816 bool isCObject = false;
2817 ProjectNode node = projectView.GetNodeFromWindow(client, null, false);
2818 if(!node && (node = projectView.GetNodeFromWindow(client, null, true)))
2822 char nodeName[MAX_FILENAME];
2823 char name[MAX_FILENAME+96];
2825 ChangeExtension(node.name, "c", nodeName);
2826 sprintf(name, $"Compile %s", isCObject ? nodeName : node.name);
2827 projectCompileItem =
2829 copyText = true, text = name, c, ctrlF7, disabled = projectView.buildInProgress;
2831 bool NotifySelect(MenuItem selection, Modifiers mods)
2835 bool result = false;
2836 bool isCObject = false;
2837 ProjectNode node = null;
2838 for(p : ide.workspace.projects)
2840 node = projectView.GetNodeFromWindow(activeClient, p, false);
2843 if(!node && (node = projectView.GetNodeFromWindow(activeClient, null, true)))
2847 List<ProjectNode> nodes { };
2849 projectView.Compile(node.project, nodes, mods.ctrl && mods.shift, isCObject ? cObject : normal);
2854 ide.outputView.buildBox.Logf($"File %s is excluded from current build configuration.\n", node.name);
2859 projectMenu.AddDynamic(projectCompileItem, ide, false);
2865 caps = ovr = num = null;
2870 bool OnClose(bool parentClosing)
2872 //return !projectView.buildInProgress;
2873 if(projectView && projectView.buildInProgress)
2875 if(DontTerminateDebugSession($"Close IDE"))
2877 if(findInFilesDialog)
2878 findInFilesDialog.SearchStop();
2881 workspace.timer.Stop();
2884 ideMainFrame.Destroy(0);
2891 bool passThrough = false;
2892 bool debugStart = false;
2893 bool debugWorkDir = false;
2894 char * passDebugWorkDir = null;
2895 bool openAsText = false;
2896 DynamicString passArgs { };
2899 for(c = 1; c<app.argc; c++)
2903 char * arg = app.argv[c];
2904 char * buf = new char[strlen(arg)*2+1];
2906 passArgs.concat(" ");
2908 passArgs.concat(buf);
2911 else if(debugWorkDir)
2913 passDebugWorkDir = CopyString(app.argv[c]);
2914 StripQuotes(passDebugWorkDir, passDebugWorkDir);
2915 debugWorkDir = false;
2917 else if(!strcmp(app.argv[c], "-t"))
2919 else if(!strcmp(app.argv[c], "-no-parsing"))
2920 ide.noParsing = true;
2921 else if(!strcmp(app.argv[c], "-debug-start"))
2923 else if(!strcmp(app.argv[c], "-debug-work-dir"))
2924 debugWorkDir = true;
2925 else if(!strcmp(app.argv[c], "-@"))
2929 char fullPath[MAX_LOCATION];
2930 char parentPath[MAX_LOCATION];
2931 char ext[MAX_EXTENSION];
2933 FileAttribs dirAttribs;
2934 GetWorkingDir(fullPath, MAX_LOCATION);
2935 PathCat(fullPath, app.argv[c]);
2936 StripLastDirectory(fullPath, parentPath);
2937 GetExtension(app.argv[c], ext);
2938 isProject = !openAsText && !strcmpi(ext, "epj");
2940 if(isProject && c > (debugStart ? 2 : 1)) continue;
2942 // Create directory for projects (only)
2943 if(((dirAttribs = FileExists(parentPath)) && dirAttribs.isDirectory) || isProject)
2945 if(isProject && !FileExists(fullPath))
2947 char name[MAX_LOCATION];
2948 NewProjectDialog newProjectDialog;
2952 projectView.visible = false;
2953 if(!projectView.Destroy(0))
2957 newProjectDialog = { master = this };
2959 strcpy(name, app.argv[c]);
2960 StripExtension(name);
2961 GetLastDirectory(name, name);
2962 newProjectDialog.projectName.contents = name;
2963 newProjectDialog.projectName.NotifyModified(newProjectDialog, newProjectDialog.projectName);
2964 newProjectDialog.locationEditBox.path = parentPath;
2965 newProjectDialog.NotifyModifiedLocation(newProjectDialog.locationEditBox);
2967 incref newProjectDialog;
2968 newProjectDialog.Modal();
2971 ideSettings.AddRecentProject(projectView.fileName);
2972 ide.UpdateRecentMenus();
2973 settingsContainer.Save();
2975 delete newProjectDialog;
2976 // Open only one project
2980 ide.OpenFile(fullPath, (app.argc == 2) * maximized, true, openAsText ? "txt" : null, yes, normal, false);
2982 else if(strstr(fullPath, "http://") == fullPath)
2983 ide.OpenFile(fullPath, (app.argc == 2) * maximized, true, openAsText ? "txt" : null, yes, normal, false);
2986 if(passThrough && projectView && projectView.project && workspace)
2987 workspace.commandLineArgs = passArgs;
2988 if(passDebugWorkDir && projectView && projectView.project && workspace)
2990 workspace.debugDir = passDebugWorkDir;
2991 delete passDebugWorkDir;
2994 ;//MenuDebugStart(debugStartResumeItem, 0); // <-- how TODO this without getting into the app.Wait lock
2996 UpdateToolBarActiveConfigs(false);
2997 UpdateToolBarActiveCompilers();
3004 // IS THIS NEEDED? WASN'T HERE BEFORE... Crashes on getting node's projectView otherwise
3007 projectView.visible = false;
3008 projectView.Destroy(0);
3011 #ifdef GDB_DEBUG_GUI
3012 gdbDialog.Destroy(0);
3017 void SetPath(bool projectsDirs, CompilerConfig compiler, ProjectConfig config, int bitDepth)
3021 char * oldPaths[128];
3022 String oldList = new char[maxPathLen];
3023 Array<String> newExePaths { };
3024 //Map<String, bool> exePathExists { };
3026 #if defined(__unix__) || defined(__APPLE__)
3027 Array<String> newLibPaths { };
3028 Map<String, bool> libPathExists { };
3033 for(prj : workspace.projects)
3035 DirExpression targetDirExp;
3037 // SKIP FIRST PROJECT...
3038 if(prj == workspace.projects.firstIterator.data) continue;
3040 // NOTE: Right now the additional project config dir will be
3041 // obtained when the debugger is started, so toggling it
3042 // while building will change which library gets used.
3043 // To go with the initial state, e.g. when F5 was pressed,
3044 // we nould need to keep a list of all project's active
3045 // config upon startup.
3046 targetDirExp = prj.GetTargetDir(compiler, prj.config, bitDepth);
3048 /*if(prj.config.targetType == sharedLibrary && prj.config.debug)
3052 for(cfg = prj.configurations.first; cfg; cfg = cfg.next)
3053 if(cfg.targetType == sharedLibrary && cfg.debug && !strcmpi(cfg.name, "Debug"))
3057 for(cfg = prj.configurations.first; cfg; cfg = cfg.next)
3058 if(cfg.targetType == sharedLibrary && cfg.debug)
3062 if(targetDirExp.dir)
3064 char buffer[MAX_LOCATION];
3065 #if defined(__WIN32__)
3066 Array<String> paths = newExePaths;
3068 Array<String> paths = newLibPaths;
3070 GetSystemPathBuffer(buffer, prj.topNode.path);
3071 PathCat(buffer, targetDirExp.dir);
3074 if(!fstrcmp(p, buffer))
3081 paths.Add(CopyString(buffer));
3083 delete targetDirExp;
3087 for(item : compiler.executableDirs)
3090 for(p : newExePaths)
3092 if(!fstrcmp(p, item))
3099 newExePaths.Add(CopySystemPath(item));
3102 GetEnvironment("PATH", oldList, maxPathLen);
3104 printf("Old value of PATH: %s\n", oldList);
3106 count = TokenizeWith(oldList, sizeof(oldPaths) / sizeof(char *), oldPaths, pathListSep, false);
3107 for(c = 0; c < count; c++)
3110 for(p : newExePaths)
3112 if(!fstrcmp(p, oldPaths[c]))
3119 newExePaths.Add(CopySystemPath(oldPaths[c]));
3123 for(path : newExePaths)
3124 len += strlen(path) + 1;
3125 newList = new char[len + 1];
3127 for(path : newExePaths)
3129 strcat(newList, path);
3130 strcat(newList, pathListSep);
3132 newList[len - 1] = '\0';
3133 SetEnvironment("PATH", newList);
3135 printf("New value of PATH: %s\n", newList);
3142 #if defined(__unix__) || defined(__APPLE__)
3144 for(item : compiler.libraryDirs)
3146 if(!libPathExists[item]) // fstrcmp should be used
3148 String s = CopyString(item);
3150 libPathExists[s] = true;
3154 #if defined(__APPLE__)
3155 GetEnvironment("DYLD_LIBRARY_PATH", oldList, maxPathLen);
3157 GetEnvironment("LD_LIBRARY_PATH", oldList, maxPathLen);
3160 printf("Old value of [DY]LD_LIBRARY_PATH: %s\n", oldList);
3162 count = TokenizeWith(oldList, sizeof(oldPaths) / sizeof(char *), oldPaths, pathListSep, false);
3163 for(c = 0; c < count; c++)
3165 if(!libPathExists[oldPaths[c]]) // fstrcmp should be used
3167 String s = CopyString(oldPaths[c]);
3169 libPathExists[s] = true;
3174 for(path : newLibPaths)
3175 len += strlen(path) + 1;
3176 newList = new char[len + 1];
3178 for(path : newLibPaths)
3180 strcat(newList, path);
3181 strcat(newList, pathListSep);
3183 newList[len - 1] = '\0';
3184 #if defined(__APPLE__)
3185 SetEnvironment("DYLD_LIBRARY_PATH", newList);
3187 SetEnvironment("LD_LIBRARY_PATH", newList);
3190 printf("New value of [DY]LD_LIBRARY_PATH: %s\n", newList);
3196 delete libPathExists;
3199 if(compiler.distccEnabled && compiler.distccHosts)
3200 SetEnvironment("DISTCC_HOSTS", compiler.distccHosts);
3205 void DestroyTemporaryProjectDir()
3207 if(tmpPrjDir && tmpPrjDir[0])
3209 if(FileExists(tmpPrjDir).isDirectory)
3210 DestroyDir(tmpPrjDir);
3211 property::tmpPrjDir = null;
3217 // Graphics Driver Menu
3221 app.currentSkin.selectionColor = selectionColor;
3222 app.currentSkin.selectionText = selectionText;
3226 driverItems = new MenuItem[app.numDrivers];
3227 for(c = 0; c < app.numDrivers; c++)
3229 driverItems[c] = MenuItem { driversMenu, app.drivers[c], NotifySelect = NotifySelectDisplayDriver };
3230 driverItems[c].id = c;
3231 driverItems[c].isRadio = true;
3234 driverItems = new MenuItem[2];
3235 #if defined(__unix__)
3236 driverItems[0] = MenuItem { driversMenu, "X", NotifySelect = NotifySelectDisplayDriver };
3237 driverItems[0].id = 0;
3238 driverItems[0].isRadio = true;
3240 driverItems[0] = MenuItem { driversMenu, "GDI", NotifySelect = NotifySelectDisplayDriver };
3241 driverItems[0].id = 0;
3242 driverItems[0].isRadio = true;
3244 driverItems[1] = MenuItem { driversMenu, "OpenGL", NotifySelect = NotifySelectDisplayDriver };
3245 driverItems[1].id = 1;
3246 driverItems[1].isRadio = true;
3248 /* skinItems = new MenuItem[app.numSkins];
3249 for(c = 0; c < app.numSkins; c++)
3251 skinItems[c] = MenuItem {skinsMenu, app.skins[c], NotifySelect = NotifySelectDisplaySkin };
3252 skinItems[c].id = c;
3253 skinItems[c].isRadio = true;
3256 ideFileDialog.master = this;
3257 ideProjectFileDialog.master = this;
3259 //SetDriverAndSkin();
3263 void UpdateRecentMenus()
3266 Menu fileMenu = menu.FindMenu($"File");
3267 Menu recentFiles = fileMenu.FindMenu($"Recent Files");
3268 Menu recentProjects = fileMenu.FindMenu($"Recent Projects");
3269 char * itemPath = new char[MAX_LOCATION];
3270 char * itemName = new char[MAX_LOCATION+4];
3273 recentFiles.Clear();
3276 for(recent : ideSettings.recentFiles)
3278 strncpy(itemPath, recent, MAX_LOCATION); itemPath[MAX_LOCATION-1] = '\0';
3279 MakeSystemPath(itemPath);
3280 snprintf(itemName, MAX_LOCATION+4, "%d %s", 1 + c, itemPath); itemName[MAX_LOCATION+4-1] = '\0';
3281 recentFiles.AddDynamic(MenuItem { copyText = true, text = itemName, (Key)k1 + c, id = c, NotifySelect = ide.FileRecentFile }, ide, true);
3285 recentProjects.Clear();
3287 for(recent : ideSettings.recentProjects)
3289 strncpy(itemPath, recent, MAX_LOCATION); itemPath[MAX_LOCATION-1] = '\0';
3290 MakeSystemPath(itemPath);
3291 snprintf(itemName, MAX_LOCATION+4, "%d %s", 1 + c, itemPath); itemName[MAX_LOCATION+4-1] = '\0';
3292 recentProjects.AddDynamic(MenuItem { copyText = true, text = itemName, (Key)k1 + c, id = c, NotifySelect = ide.FileRecentProject }, ide, true);
3308 void DestroyDir(char * path)
3310 RecursiveDeleteFolderFSI fsi { };
3315 #if defined(__WIN32__)
3316 define sdkDirName = "Ecere SDK";
3318 define sdkDirName = "ecere";
3321 void FindAndShellOpenInstalledFolder(char * name)
3323 char * p = new char[MAX_LOCATION];
3324 char * v = new char[maxPathLen];
3327 Array<String> paths { };
3329 strncpy(p, settingsContainer.moduleLocation, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3330 StripLastDirectory(p, p);
3332 paths.Add(CopyString(p));
3333 #if defined(__WIN32__)
3334 GetEnvironment("ECERE_SDK_SRC", v, maxPathLen);
3337 strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3338 PathCat(p, name); paths.Add(CopyString(p));
3340 GetEnvironment("AppData", v, maxPathLen);
3343 strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3344 PathCat(p, sdkDirName); PathCat(p, name); paths.Add(CopyString(p));
3346 GetEnvironment("ProgramFiles", v, maxPathLen);
3349 strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3350 PathCat(p, sdkDirName); PathCat(p, name); paths.Add(CopyString(p));
3352 GetEnvironment("ProgramFiles(x86)", 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("SystemDrive", v, maxPathLen);
3361 strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3362 PathCat(p, "Program Files"); PathCat(p, sdkDirName); PathCat(p, name); paths.Add(CopyString(p));
3365 GetEnvironment("XDG_DATA_DIRS", v, maxPathLen);
3366 numTokens = TokenizeWith(v, sizeof(tokens) / sizeof(byte *), tokens, ":", false);
3367 for(c=0; c<numTokens; c++)
3369 strncpy(p, tokens[c], MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3370 PathCat(p, sdkDirName); PathCat(p, name); paths.Add(CopyString(p));
3375 strncpy(p, path, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3376 if(FileExists(p).isDirectory)
3388 void FindAndShellOpenInstalledFile(char * subdir, char * name)
3390 char * p = new char[MAX_LOCATION];
3391 char * v = new char[maxPathLen];
3394 Array<String> paths { };
3396 strncpy(p, settingsContainer.moduleLocation, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3397 paths.Add(CopyString(p));
3398 StripLastDirectory(p, p);
3400 paths.Add(CopyString(p));
3401 #if defined(__WIN32__)
3402 GetEnvironment("ECERE_SDK_SRC", v, maxPathLen);
3405 strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3406 PathCat(p, sdkDirName); PathCat(p, subdir); paths.Add(CopyString(p));
3408 GetEnvironment("AppData", v, maxPathLen);
3411 strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3412 PathCat(p, sdkDirName); PathCat(p, subdir); paths.Add(CopyString(p));
3414 GetEnvironment("ProgramFiles", 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("ProgramFiles(x86)", 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("SystemDrive", v, maxPathLen);
3429 strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3430 PathCat(p, "Program Files"); PathCat(p, sdkDirName); PathCat(p, subdir); paths.Add(CopyString(p));
3433 GetEnvironment("XDG_DATA_DIRS", v, maxPathLen);
3434 numTokens = TokenizeWith(v, sizeof(tokens) / sizeof(byte *), tokens, ":", false);
3435 for(c=0; c<numTokens; c++)
3437 strncpy(p, tokens[c], MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3438 PathCat(p, sdkDirName); PathCat(p, subdir); paths.Add(CopyString(p));
3443 strncpy(p, path, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
3445 if(FileExists(p).isFile)
3457 class RecursiveDeleteFolderFSI : NormalFileSystemIterator
3459 bool preserveRootFolder;
3461 void OutFolder(char * folderPath, bool isRoot)
3463 if(!(preserveRootFolder && isRoot))
3464 RemoveDir(folderPath);
3467 bool OnFile(char * filePath)
3469 DeleteFile(filePath);
3474 class IDEApp : GuiApplication
3476 //driver = "Win32Console";
3477 // driver = "OpenGL";
3481 TempFile includeFile { };
3485 char ext[MAX_EXTENSION];
3486 SetLoggingMode(stdOut, null);
3487 //SetLoggingMode(debug, null);
3489 settingsContainer.Load();
3490 if(argc > 1 && !strcmpi(GetExtension(argv[1], ext), "3ds"))
3492 app.driver = "OpenGL";
3493 ide.driverItems[1].checked = true;
3497 #if defined(__unix__) || defined(__APPLE__)
3498 app.driver = (ideSettings.displayDriver && !strcmp(ideSettings.displayDriver, "OpenGL")) ? ideSettings.displayDriver : "X";
3500 app.driver = (ideSettings.displayDriver && !strcmp(ideSettings.displayDriver, "OpenGL")) ? ideSettings.displayDriver : "GDI";
3502 ide.driverItems[ideSettings.displayDriver && !strcmp(ideSettings.displayDriver,"OpenGL")].checked = true;
3507 desktop.text = titleECEREIDE;
3510 for(c = 1; c<app.argc; c++)
3512 char fullPath[MAX_LOCATION];
3513 GetWorkingDir(fullPath, MAX_LOCATION);
3514 PathCat(fullPath, app.argv[c]);
3515 ide.OpenFile(fullPath, (app.argc == 2) * maximized, true, null, yes, normal, false);
3519 if(!LoadIncludeFile())
3520 PrintLn("error: unable to load :crossplatform.mk file inside ide binary.");
3525 bool LoadIncludeFile()
3527 bool result = false;
3528 File include = FileOpen(":crossplatform.mk", read);
3531 File f = includeFile;
3534 for(; !include.Eof(); )
3537 int count = include.Read(buffer, 1, 4096);
3538 f.Write(buffer, 1, count);
3548 IDEMainFrame ideMainFrame { };
3550 define app = ((IDEApp)__thisModule);
3552 define titleECEREIDE = $"ECERE IDE (Debug)";
3554 define titleECEREIDE = $"ECERE IDE";