X-Git-Url: http://ecere.com/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ide%2Fsrc%2Fide.ec;h=51eda16c24851b1e8e01dc9ff9a56fdeb2ee6801;hb=0e83a12f7aece981cf49a45847e0821e325e3069;hp=4af4920ad1dc058f42b83a6a5ca8681326aa0cd1;hpb=95f8897e955b0324ce25c7fdb13b8da98279631b;p=sdk diff --git a/ide/src/ide.ec b/ide/src/ide.ec index 4af4920..51eda16 100644 --- a/ide/src/ide.ec +++ b/ide/src/ide.ec @@ -44,6 +44,15 @@ import "about" import "FileSystemIterator" +AVLTree binaryDocExt +{ [ + "wav", "mp3", "flac", "ogg", + "mid", + "avi", "mkv", "mpg", "mpeg", + "7z", "zip", "gz", "bz2", "xz", "rar", "z", "tar", "ear", + "pdf", "odp", "ods", "odt", "ppt", "doc", "xls", "pptx", "docx", "xlsx" +] }; + #if defined(__WIN32__) define pathListSep = ";"; #else @@ -195,7 +204,7 @@ void DrawLineMarginIcon(Surface surface, BitmapResource resource, int line, int class IDEToolbar : ToolBar { - /* File options */ + // File options // New ToolButton buttonNewFile { this, toolTip = $"New file", menuItemPtr = IDEItem(fileNewItem) }; // Open @@ -209,7 +218,7 @@ class IDEToolbar : ToolBar ToolSeparator separator1 { this }; - /* Edit options */ + // Edit options // Cut // Copy // Paste @@ -218,7 +227,7 @@ class IDEToolbar : ToolBar // ToolSeparator separator2 { this }; - /* Project options */ + // Project options // New project ToolButton buttonNewProject { this, toolTip = $"New project", menuItemPtr = IDEItem(projectNewItem) }; // Open project @@ -230,7 +239,7 @@ class IDEToolbar : ToolBar ToolSeparator separator3 { this }; - /* Build/Execution options */ + // Build/Execution options // Build ToolButton buttonBuild { this, toolTip = $"Build project", menuItemPtr = IDEItem(projectBuildItem), disabled = true; }; // Re-link @@ -252,7 +261,7 @@ class IDEToolbar : ToolBar ToolSeparator separator4 { this }; - /* Debug options */ + // Debug options // Start/Resume ToolButton buttonDebugStartResume { this, toolTip = $"Start", menuItemPtr = IDEItem(debugStartResumeItem), disabled = true; }; // Restart @@ -294,11 +303,11 @@ class IDEToolbar : ToolBar this, toolTip = $"Active Compiler", size = { 160 }, disabled = true; bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods) { - if(ide.workspace && ide.projectView && row && strcmp(row.string, ide.workspace.compiler)) + if(ide.workspace && ide.projectView && row && strcmp(row.string, ide.workspace.activeCompiler)) { bool silent = ide.projectView.buildInProgress == none ? false : true; - CompilerConfig compiler = ideSettings.GetCompilerConfig(row.string); - ide.workspace.compiler = row.string; + CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(row.string); + ide.workspace.activeCompiler = row.string; ide.projectView.ShowOutputBuildLog(!silent); if(!silent) ide.projectView.DisplayCompiler(compiler, false); @@ -319,7 +328,7 @@ class IDEToolbar : ToolBar if(ide.workspace && ide.projectView && row) { bool silent = ide.projectView.buildInProgress == none ? false : true; - CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler); + CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler); ide.workspace.bitDepth = (int)row.tag; ide.projectView.ShowOutputBuildLog(!silent); if(!silent) @@ -344,7 +353,6 @@ class IDEToolbar : ToolBar activeBitDepth.AddString("64 bit").tag = 64; activeBitDepth.currentRow = row; } - } class IDEMainFrame : Window @@ -421,6 +429,8 @@ class IDEWorkSpace : Window BitmapResource bmpTopFrameHalf { ":codeMarks/topFrameHalf.png", window = this }; BitmapResource bmpTopFrameHalfError { ":codeMarks/topFrameHalfError.png", window = this }; + BuildOutputMode rightClickMenuBuildOutputMode; + Debugger debugger { }; ProjectView projectView; @@ -429,14 +439,20 @@ class IDEWorkSpace : Window { parent = this; - void OnGotoError(char * line, bool noParsing) + void OnGotoError(const char * line, bool noParsing) { - ide.GoToError(line, noParsing); + CompilerConfig compiler = ide.workspace ? ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler) : null; + const char * objectFileExt = compiler ? compiler.objectFileExt : objectDefaultFileExt; + ide.GoToError(line, noParsing, objectFileExt); + delete compiler; } - void OnCodeLocationParseAndGoTo(char * line) + void OnCodeLocationParseAndGoTo(const char * line) { - ide.CodeLocationParseAndGoTo(line, ide.findInFilesDialog.findProject, ide.findInFilesDialog.findDir); + CompilerConfig compiler = ide.workspace ? ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler) : null; + const char * objectFileExt = compiler ? compiler.objectFileExt : objectDefaultFileExt; + ide.CodeLocationParseAndGoTo(line, ide.findInFilesDialog.findProject, ide.findInFilesDialog.findDir, objectFileExt); + delete compiler; } bool OnKeyDown(Key key, unichar ch) @@ -467,7 +483,7 @@ class IDEWorkSpace : Window CallStackView callStackView { - parent = this, font = { panelFont.faceName, panelFont.size }; + parent = this, font = { panelFont.faceName, panelFont.size, panelFont.bold, panelFont.italic }; void OnSelectFrame(int frameIndex) { @@ -515,7 +531,7 @@ class IDEWorkSpace : Window if(activeFrame) { bool error; - int lineCursor, lineTopFrame, activeThread, hitThread; + int lineCursor, lineTopFrame; int lineH, scrollY, boxH; BitmapResource bmp; Breakpoint bp = null; @@ -523,8 +539,8 @@ class IDEWorkSpace : Window boxH = clientSize.h; scrollY = editBox.scroll.y; displaySystem.FontExtent(editBox.font.font, " ", 1, null, &lineH); - activeThread = debugger.activeThread; - hitThread = debugger.hitThread; + //activeThread = debugger.activeThread; + //hitThread = debugger.hitThread; debugger.GetCallStackCursorLine(&error, &lineCursor, &lineTopFrame); // TODO: improve bp drawing... it should be visible even if it's not on the activeFrame @@ -569,7 +585,7 @@ class IDEWorkSpace : Window WatchesView watchesView { parent = this }; ThreadsView threadsView { - parent = this, font = { panelFont.faceName, panelFont.size }; + parent = this, font = { panelFont.faceName, panelFont.size, panelFont.bold, panelFont.italic }; bool OnKeyDown(Key key, unichar ch) { @@ -627,7 +643,7 @@ class IDEWorkSpace : Window document.NotifySaved = DocumentSaved; return true; } - } + }; MenuItem fileOpenItem { fileMenu, $"Open...", o, ctrlO; @@ -643,7 +659,7 @@ class IDEWorkSpace : Window bool gotWhatWeWant = false; int c; int numSelections = ideFileDialog.numSelections; - char ** multiFilePaths = ideFileDialog.multiFilePaths; + const char * const * multiFilePaths = ideFileDialog.multiFilePaths; for(c = 0; c < numSelections; c++) { @@ -665,7 +681,7 @@ class IDEWorkSpace : Window } return true; } - } + }; MenuItem fileCloseItem { fileMenu, $"Close", c, ctrlF4, NotifySelect = MenuFileClose }; MenuDivider { fileMenu }; MenuItem fileSaveItem @@ -693,7 +709,7 @@ class IDEWorkSpace : Window findInFilesDialog.Show(); return true; } - } + }; MenuItem replaceInFiles { fileMenu, $"Replace In Files...", e, Key { r, ctrl = true , shift = true }; @@ -703,25 +719,29 @@ class IDEWorkSpace : Window findInFilesDialog.Show(); return true; } - } + }; MenuDivider { fileMenu }; MenuItem globalSettingsItem { fileMenu, $"Global Settings...", g; bool NotifySelect(MenuItem selection, Modifiers mods) { + // Reload configs here until we setup a configs directory monitor + ideConfig.compilers.Free(); + ideConfig.compilers.read(); + globalSettingsDialog.master = this; - if(ide.workspace && ide.workspace.compiler) - globalSettingsDialog.workspaceActiveCompiler = ide.workspace.compiler; + if(ide.workspace && ide.workspace.activeCompiler) + globalSettingsDialog.workspaceActiveCompiler = ide.workspace.activeCompiler; else if(ideSettings.defaultCompiler) globalSettingsDialog.workspaceActiveCompiler = ideSettings.defaultCompiler; globalSettingsDialog.Modal(); return true; } - } + }; MenuDivider { fileMenu }; - Menu recentFiles { fileMenu, $"Recent Files", r }; - Menu recentProjects { fileMenu, $"Recent Projects", p }; + Menu recentFilesMenu { fileMenu, $"Recent Files", r }; + Menu recentProjectsMenu { fileMenu, $"Recent Projects", p }; MenuDivider { fileMenu }; MenuItem exitItem { @@ -737,7 +757,8 @@ class IDEWorkSpace : Window bool FileRecentFile(MenuItem selection, Modifiers mods) { int id = 0; - for(file : ideSettings.recentFiles) + RecentPaths recentFiles = workspace ? workspace.recentFiles : ideConfig.recentFiles; + for(file : recentFiles) { if(id == selection.id) { @@ -745,9 +766,9 @@ class IDEWorkSpace : Window char extension[MAX_EXTENSION] = ""; GetExtension(file, extension); isProjectFile = (!strcmpi(extension, "epj") || !strcmpi(extension, "ews")); - if(mods.ctrl) + if(mods.ctrl && !mods.shift) { - char * command = PrintString("ide ", isProjectFile ? "-t " : "", file); + char * command = PrintString("ecere-ide ", isProjectFile ? "-t " : "", file); Execute(command); delete command; } @@ -766,18 +787,18 @@ class IDEWorkSpace : Window bool FileRecentProject(MenuItem selection, Modifiers mods) { int id = 0; - for(file : ideSettings.recentProjects) + for(file : ideConfig.recentWorkspaces) { if(id == selection.id) { - if(mods.ctrl) + if(mods.ctrl && !mods.shift) { - char * command = PrintString("ide ", file); + char * command = PrintString("ecere-ide ", file); Execute(command); delete command; } else - OpenFile(file, false, true, null, no, normal, mods.ctrl && mods.shift); + OpenFile(file, false, true, (mods.ctrl && mods.shift) ? "txt" : null, no, normal, mods.ctrl && mods.shift); break; } id++; @@ -807,9 +828,8 @@ class IDEWorkSpace : Window newProjectDialog.CreateNewProject(); if(projectView) { - ideSettings.AddRecentProject(projectView.fileName); - ide.UpdateRecentMenus(); - settingsContainer.Save(); + ideConfig.recentWorkspaces.addRecent(projectView.fileName); + ide.updateRecentProjectsMenu(); } } } @@ -817,7 +837,7 @@ class IDEWorkSpace : Window } return true; } - } + }; MenuItem projectOpenItem { projectMenu, $"Open...", o, Key { o, true, true }; @@ -835,7 +855,7 @@ class IDEWorkSpace : Window } return true; } - } + }; MenuItem projectQuickItem { projectMenu, $"Quick...", q, f7, disabled = true; @@ -845,7 +865,7 @@ class IDEWorkSpace : Window QuickProjectDialog { this }.Modal(); return true; } - } + }; MenuItem projectAddItem { projectMenu, $"Add project to workspace...", a, Key { a, true, true }; @@ -874,7 +894,7 @@ class IDEWorkSpace : Window } return true; } - } + }; MenuItem projectCloseItem { projectMenu, $"Close", c, disabled = true; @@ -887,7 +907,7 @@ class IDEWorkSpace : Window } return true; } - } + }; MenuDivider { projectMenu }; MenuItem projectSettingsItem { @@ -897,7 +917,7 @@ class IDEWorkSpace : Window projectView.MenuSettings(projectView.active ? selection : null, mods); return true; } - } + }; MenuDivider { projectMenu }; MenuItem projectBrowseFolderItem { @@ -908,7 +928,7 @@ class IDEWorkSpace : Window projectView.MenuBrowseFolder(null, mods); return true; } - } + }; MenuDivider { projectMenu }; MenuItem projectRunItem { @@ -920,7 +940,7 @@ class IDEWorkSpace : Window projectView.Run(null, mods); return true; } - } + }; MenuItem projectBuildItem { projectMenu, $"Build", b, f7, disabled = true; @@ -936,7 +956,7 @@ class IDEWorkSpace : Window } return true; } - } + }; MenuItem projectLinkItem { projectMenu, $"Relink", l, disabled = true; @@ -947,7 +967,7 @@ class IDEWorkSpace : Window projectView.ProjectLink(projectView.active ? selection : null, mods); return true; } - } + }; MenuItem projectRebuildItem { projectMenu, $"Rebuild", d, shiftF7, disabled = true; @@ -958,7 +978,7 @@ class IDEWorkSpace : Window projectView.ProjectRebuild(projectView.active ? selection : null, mods); return true; } - } + }; MenuItem projectCleanTargetItem { projectMenu, $"Clean Target", g, disabled = true; @@ -972,7 +992,7 @@ class IDEWorkSpace : Window } return true; } - } + }; MenuItem projectCleanItem { projectMenu, $"Clean", e, disabled = true; @@ -986,7 +1006,7 @@ class IDEWorkSpace : Window } return true; } - } + }; MenuItem projectRealCleanItem { projectMenu, $"Real Clean", disabled = true; @@ -1000,7 +1020,7 @@ class IDEWorkSpace : Window } return true; } - } + }; MenuItem projectRegenerateItem { projectMenu, $"Regenerate Makefile", m, disabled = true; @@ -1011,7 +1031,7 @@ class IDEWorkSpace : Window projectView.ProjectRegenerate(projectView.active ? selection : null, mods); return true; } - } + }; MenuItem projectInstallItem { #ifdef IDE_SHOW_INSTALL_MENU_BUTTON @@ -1024,7 +1044,7 @@ class IDEWorkSpace : Window projectView.ProjectInstall(projectView.active ? selection : null, mods); return true; } - } + }; MenuItem projectCompileItem; Menu debugMenu { menu, $"Debug", d, hasMargin = true }; MenuItem debugStartResumeItem @@ -1032,7 +1052,7 @@ class IDEWorkSpace : Window debugMenu, $"Start", s, f5, disabled = true; bitmap = { ":actions/debug.png" }; NotifySelect = MenuDebugStart; - } + }; bool MenuDebugStart(MenuItem selection, Modifiers mods) { if(projectView) @@ -1059,7 +1079,7 @@ class IDEWorkSpace : Window projectView.DebugRestart(); return true; } - } + }; MenuItem debugBreakItem { debugMenu, $"Break", b, Key { pauseBreak, ctrl = true }, disabled = true; @@ -1072,7 +1092,7 @@ class IDEWorkSpace : Window projectView.DebugBreak(); return true; } - } + }; MenuItem debugStopItem { debugMenu, $"Stop", p, shiftF5, disabled = true; @@ -1083,7 +1103,61 @@ class IDEWorkSpace : Window projectView.DebugStop(); return true; } - } + }; + MenuDivider { debugMenu }; + ModelView duck + { + this, + // nonClient = true, + autoCreate = false, + alphaBlend = true, + opacity = 0, + isRemote = true, + borderStyle = 0, + moveable = true, + anchor = { right = 0, bottom = 0 }, + inactive = true, + isActiveClient = false, + stayOnTop = true, + clickThrough = true, + size = { 500, 500 }; + + bool OnLoadGraphics() + { + ModelView::OnLoadGraphics(); + camera.position.z /= 1.3; + camera.orientation = Euler { yaw = 280, pitch = 20 }; + camera.Update(); + Update(null); + return true; + } + + bool OnRightButtonDown(int x, int y, Modifiers mods) + { + if(!displaySystem.flags.flipping) return true; + MenuWindowMove(null, 0); + return false; + } + + bool OnRightButtonUp(int x, int y, Modifiers mods) + { + position = position; + state = normal; + return true; + } + }; + MenuItem debugRubberDuck + { + debugMenu, $"Rubber Duck", checkable = true, disabled = true; + bool NotifySelect(MenuItem selection, Modifiers mods) + { + if(selection.checked) + duck.Create(); + else + duck.Destroy(0); + return true; + } + }; #ifndef __WIN32__ MenuDivider { debugMenu }; MenuItem debugUseValgrindItem @@ -1099,12 +1173,12 @@ class IDEWorkSpace : Window ide.AdjustValgrindMenus(); return true; } - } + }; Menu debugValgrindLeakCheckItem { debugMenu, $"Valgrind Leak Check", h }; - MenuItem debugValgrindNoLeakCheckItem { debugValgrindLeakCheckItem, $"No" , f, id = ValgrindLeakCheck::no , checkable = true, disabled = true; NotifySelect = ValgrindLCSelect; } - MenuItem debugValgrindSummaryLeakCheckItem { debugValgrindLeakCheckItem, $"Summary", f, id = ValgrindLeakCheck::summary, checkable = true, disabled = true; NotifySelect = ValgrindLCSelect, checked = true; } - MenuItem debugValgrindYesLeakCheckItem { debugValgrindLeakCheckItem, $"Yes" , f, id = ValgrindLeakCheck::yes , checkable = true, disabled = true; NotifySelect = ValgrindLCSelect; } - MenuItem debugValgrindFullLeakCheckItem { debugValgrindLeakCheckItem, $"Full" , f, id = ValgrindLeakCheck::full , checkable = true, disabled = true; NotifySelect = ValgrindLCSelect; } + MenuItem debugValgrindNoLeakCheckItem { debugValgrindLeakCheckItem, $"No" , f, id = ValgrindLeakCheck::no , checkable = true, disabled = true; NotifySelect = ValgrindLCSelect; }; + MenuItem debugValgrindSummaryLeakCheckItem { debugValgrindLeakCheckItem, $"Summary", f, id = ValgrindLeakCheck::summary, checkable = true, disabled = true; NotifySelect = ValgrindLCSelect, checked = true; }; + MenuItem debugValgrindYesLeakCheckItem { debugValgrindLeakCheckItem, $"Yes" , f, id = ValgrindLeakCheck::yes , checkable = true, disabled = true; NotifySelect = ValgrindLCSelect; }; + MenuItem debugValgrindFullLeakCheckItem { debugValgrindLeakCheckItem, $"Full" , f, id = ValgrindLeakCheck::full , checkable = true, disabled = true; NotifySelect = ValgrindLCSelect; }; bool ValgrindLCSelect(MenuItem selection, Modifiers mods) { if(ide.workspace) @@ -1127,14 +1201,14 @@ class IDEWorkSpace : Window return true; } Menu debugValgrindRedzoneSizeItem { debugMenu, $"Valgrind Redzone Size", z }; - MenuItem debugValgrindRSDefaultItem { debugValgrindRedzoneSizeItem, $"Default", f, id = -1, checkable = true, disabled = true; NotifySelect = ValgrindRSSelect, checked = true; } - MenuItem debugValgrindRS0Item { debugValgrindRedzoneSizeItem, "0" , f, id = 0, checkable = true, disabled = true; NotifySelect = ValgrindRSSelect; } - MenuItem debugValgrindRS16Item { debugValgrindRedzoneSizeItem, "16" , f, id = 16, checkable = true, disabled = true; NotifySelect = ValgrindRSSelect; } - MenuItem debugValgrindRS32Item { debugValgrindRedzoneSizeItem, "32" , f, id = 32, checkable = true, disabled = true; NotifySelect = ValgrindRSSelect; } - MenuItem debugValgrindRS64Item { debugValgrindRedzoneSizeItem, "64" , f, id = 64, checkable = true, disabled = true; NotifySelect = ValgrindRSSelect; } - MenuItem debugValgrindRS128Item { debugValgrindRedzoneSizeItem, "128" , f, id = 128, checkable = true, disabled = true; NotifySelect = ValgrindRSSelect; } - MenuItem debugValgrindRS256Item { debugValgrindRedzoneSizeItem, "256" , f, id = 256, checkable = true, disabled = true; NotifySelect = ValgrindRSSelect; } - MenuItem debugValgrindRS512Item { debugValgrindRedzoneSizeItem, "512" , f, id = 512, checkable = true, disabled = true; NotifySelect = ValgrindRSSelect; } + MenuItem debugValgrindRSDefaultItem { debugValgrindRedzoneSizeItem, $"Default", f, id = -1, checkable = true, disabled = true; NotifySelect = ValgrindRSSelect, checked = true; }; + MenuItem debugValgrindRS0Item { debugValgrindRedzoneSizeItem, "0" , f, id = 0, checkable = true, disabled = true; NotifySelect = ValgrindRSSelect; }; + MenuItem debugValgrindRS16Item { debugValgrindRedzoneSizeItem, "16" , f, id = 16, checkable = true, disabled = true; NotifySelect = ValgrindRSSelect; }; + MenuItem debugValgrindRS32Item { debugValgrindRedzoneSizeItem, "32" , f, id = 32, checkable = true, disabled = true; NotifySelect = ValgrindRSSelect; }; + MenuItem debugValgrindRS64Item { debugValgrindRedzoneSizeItem, "64" , f, id = 64, checkable = true, disabled = true; NotifySelect = ValgrindRSSelect; }; + MenuItem debugValgrindRS128Item { debugValgrindRedzoneSizeItem, "128" , f, id = 128, checkable = true, disabled = true; NotifySelect = ValgrindRSSelect; }; + MenuItem debugValgrindRS256Item { debugValgrindRedzoneSizeItem, "256" , f, id = 256, checkable = true, disabled = true; NotifySelect = ValgrindRSSelect; }; + MenuItem debugValgrindRS512Item { debugValgrindRedzoneSizeItem, "512" , f, id = 512, checkable = true, disabled = true; NotifySelect = ValgrindRSSelect; }; bool ValgrindRSSelect(MenuItem selection, Modifiers mods) { if(ide.workspace) @@ -1184,7 +1258,7 @@ class IDEWorkSpace : Window if(projectView) projectView.DebugStepInto(); return true; } - } + }; MenuItem debugStepOverItem { debugMenu, $"Step Over", v, f10, disabled = true; @@ -1194,7 +1268,7 @@ class IDEWorkSpace : Window if(projectView) projectView.DebugStepOver(false); return true; } - } + }; MenuItem debugSkipStepOverItem { debugMenu, $"Step Over Skipping Breakpoints", e, shiftF10, disabled = true; @@ -1204,7 +1278,7 @@ class IDEWorkSpace : Window if(projectView) projectView.DebugStepOver(true); return true; } - } + }; MenuItem debugStepOutItem { debugMenu, $"Step Out", o, shiftF11, disabled = true; @@ -1214,7 +1288,7 @@ class IDEWorkSpace : Window if(projectView) projectView.DebugStepOut(false); return true; } - } + }; MenuItem debugSkipStepOutItem { debugMenu, $"Step Out Skipping Breakpoints", n, Key { f11, ctrl = true, shift = true }, disabled = true; @@ -1224,7 +1298,7 @@ class IDEWorkSpace : Window if(projectView) projectView.DebugStepOut(true); return true; } - } + }; #if 0 MenuItem debugStepUntilItem { @@ -1234,7 +1308,7 @@ class IDEWorkSpace : Window if(projectView) projectView.DebugStepUntil(false); return true; } - } + }; MenuItem debugSkipStepUntilItem { debugMenu, $"Step Over Until Next Line Skipping Breakpoints", e, Key { f10, shift = true, alt = true }, disabled = true; @@ -1243,7 +1317,7 @@ class IDEWorkSpace : Window if(projectView) projectView.DebugStepUntil(true); return true; } - } + }; #endif MenuPlacement debugRunToCursorItem { debugMenu, $"Run To Cursor", c }; MenuPlacement debugSkipRunToCursorItem { debugMenu, $"Run To Cursor Skipping Breakpoints", u }; @@ -1271,7 +1345,7 @@ class IDEWorkSpace : Window } return true; } - } + }; MenuPlacement { viewMenu, $"View Designer" }; MenuPlacement { viewMenu, $"View Code" }; MenuPlacement { viewMenu, $"View Properties" }; @@ -1292,7 +1366,7 @@ class IDEWorkSpace : Window ((CodeEditor)client).ViewDesigner(); return true; } - } + }; MenuItem viewCodeItem { viewMenu, $"View Code", c, f8; @@ -1308,7 +1382,7 @@ class IDEWorkSpace : Window client.visible = true; return true; } - } + }; MenuItem viewPropertiesItem { viewMenu, $"View Properties", p, f4; @@ -1319,7 +1393,7 @@ class IDEWorkSpace : Window sheet.Activate(); return true; } - } + }; MenuItem viewMethodsItem { viewMenu, $"View Methods", m, f4; @@ -1330,7 +1404,7 @@ class IDEWorkSpace : Window sheet.Activate(); return true; } - } + }; MenuItem viewToolBoxItem { viewMenu, $"View Toolbox", x, f12; @@ -1340,7 +1414,7 @@ class IDEWorkSpace : Window toolBox.Activate(); return true; } - } + }; MenuItem viewOutputItem { viewMenu, $"Output", o, alt2; @@ -1349,7 +1423,7 @@ class IDEWorkSpace : Window outputView.Show(); return true; } - } + }; MenuItem viewWatchesItem { viewMenu, $"Watches", w, alt3; @@ -1358,7 +1432,7 @@ class IDEWorkSpace : Window watchesView.Show(); return true; } - } + }; MenuItem viewThreadsItem { viewMenu, $"Threads", t, alt4; @@ -1367,7 +1441,7 @@ class IDEWorkSpace : Window threadsView.Show(); return true; } - } + }; MenuItem viewBreakpointsItem { viewMenu, $"Breakpoints", b, alt5; @@ -1376,7 +1450,7 @@ class IDEWorkSpace : Window breakpointsView.Show(); return true; } - } + }; MenuItem viewCallStackItem { viewMenu, $"Call Stack", s, alt7; @@ -1385,7 +1459,7 @@ class IDEWorkSpace : Window callStackView.Show(); return true; } - } + }; MenuItem viewAllDebugViews { viewMenu, $"All Debug Views", a, alt9; @@ -1398,7 +1472,7 @@ class IDEWorkSpace : Window breakpointsView.Show(); return true; } - } + }; #ifdef GDB_DEBUG_GUI MenuDivider { viewMenu }; MenuItem viewGDBItem @@ -1409,7 +1483,7 @@ class IDEWorkSpace : Window gdbDialog.Show(); return true; } - } + }; #endif MenuDivider { viewMenu }; MenuItem viewColorPicker @@ -1421,7 +1495,7 @@ class IDEWorkSpace : Window colorPicker.Modal(); return true; } - } + }; MenuDivider { viewMenu }; /* MenuItem @@ -1484,7 +1558,7 @@ class IDEWorkSpace : Window } return true; } - } + }; MenuDivider { helpMenu }; MenuItem { @@ -1494,7 +1568,7 @@ class IDEWorkSpace : Window FindAndShellOpenInstalledFile("doc", "Ecere Tao of Programming [work in progress].pdf"); return true; } - } + }; MenuDivider { helpMenu }; MenuItem { @@ -1504,7 +1578,7 @@ class IDEWorkSpace : Window FindAndShellOpenInstalledFolder("doc"); return true; } - } + }; MenuItem { helpMenu, $"Samples Folder", s; @@ -1513,7 +1587,7 @@ class IDEWorkSpace : Window FindAndShellOpenInstalledFolder("samples"); return true; } - } + }; MenuItem { helpMenu, $"Extras Folder", x; @@ -1522,7 +1596,7 @@ class IDEWorkSpace : Window FindAndShellOpenInstalledFolder("extras"); return true; } - } + }; MenuDivider { helpMenu }; MenuItem { @@ -1532,7 +1606,7 @@ class IDEWorkSpace : Window ShellOpen("http://ecere.com/forums"); return true; } - } + }; MenuDivider { helpMenu }; MenuItem { @@ -1542,7 +1616,7 @@ class IDEWorkSpace : Window AboutIDE { master = this }.Modal(); return true; } - } + }; property ToolBox toolBox { @@ -1572,6 +1646,7 @@ class IDEWorkSpace : Window }; bool noParsing; + bool debugStart; #ifdef GDB_DEBUG_GUI GDBDialog gdbDialog @@ -1579,7 +1654,7 @@ class IDEWorkSpace : Window master = this, parent = this; //anchor = { left = 100, top = 100, right = 100, bottom = 100 }; - void OnCommand(char * string) + void OnCommand(const char * string) { if(ide) ide.debugger.SendGDBCommand(string); @@ -1598,6 +1673,8 @@ class IDEWorkSpace : Window delete ideSettings.displayDriver; ideSettings.displayDriver = CopyString(selection.id ? "OpenGL" : "Default"); + ide.debugRubberDuck.disabled = !ide.duck.modelFile || strcmpi(app.driver, "OpenGL"); + settingsContainer.Save(); //SetDriverAndSkin(); return true; @@ -1627,7 +1704,7 @@ class IDEWorkSpace : Window } } - ProjectView CreateProjectView(Workspace workspace, char * fileName) + ProjectView CreateProjectView(Workspace workspace, const char * fileName) { Project project = workspace.projects.firstIterator.data; projectView = ProjectView @@ -1652,6 +1729,7 @@ class IDEWorkSpace : Window ideMainFrame.SetText("%s - %s", project.topNode.name, titleECEREIDE); AdjustMenus(); + updateRecentMenus(); ide.breakpointsView.LoadFromWorkspace(); ide.watchesView.LoadFromWorkspace(); @@ -1683,6 +1761,7 @@ class IDEWorkSpace : Window outputView.visible = false; ideMainFrame.text = titleECEREIDE; ide.AdjustMenus(); + ide.updateRecentMenus(); return true; } return false; @@ -1693,7 +1772,6 @@ class IDEWorkSpace : Window if(this) { Window child; - bool inDebugMode = debugger.isActive; bool callStackVisible = expand ? false : callStackView.visible; bool threadsVisible = expand ? false : threadsView.visible; bool watchesVisible = expand ? false : watchesView.visible; @@ -1716,7 +1794,8 @@ class IDEWorkSpace : Window anchor.left = (sheet.visible || (projectView && projectView.visible)) ? 300 : 0; anchor.right = toolBoxVisible ? 150 : 0; } - child.anchor = anchor; + if(ide.projectView) + child.anchor = anchor; } else if(expand) { @@ -1727,6 +1806,7 @@ class IDEWorkSpace : Window } // If this is not here, the IDE is not updated when doing Debug/Break then Alt-4 to show call stack (IDE not updated) Update(null); + if(duck.visible) duck.Update(null); // TOFIX: If this is not here, the duck disappears -- Why? } } @@ -1739,28 +1819,26 @@ class IDEWorkSpace : Window projectView.visible = true; projectView.Activate(); } - else - { - sheet.visible = true; + else if(sheet.visible) sheet.Activate(); - } + else + outputView.visible = false; return false; } - void DocumentSaved(Window document, char * fileName) + void DocumentSaved(Window document, const char * fileName) { - ideSettings.AddRecentFile(fileName); - ide.UpdateRecentMenus(); + ideConfig.recentFiles.addRecent(fileName); + ide.updateRecentFilesMenu(); ide.AdjustFileMenus(); - settingsContainer.Save(); } - bool Window::OnFileModified(FileChange fileChange, char * param) + bool Window::OnFileModified(FileChange fileChange, const char * param) { char temp[4096]; sprintf(temp, $"The document %s was modified by another application.\n" "Would you like to reload it and lose your changes?", this.fileName); - if(MessageBox { type = yesNo, master = this/*.parent*/, + if(MessageBox { creationActivation = flash, type = yesNo, master = this/*.parent*/, text = $"Document has been modified", contents = temp }.Modal() == yes) { bool noParsing = (this._class == class(CodeEditor) && ((CodeEditor)this).noParsing) ? true : false; @@ -1788,7 +1866,7 @@ class IDEWorkSpace : Window { if(workspace) { - CompilerConfig compiler = ideSettings.GetCompilerConfig(workspace.compiler); + CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(workspace.activeCompiler); for(prj : workspace.projects) projectView.ProjectUpdateMakefileForAllConfigs(prj); delete compiler; @@ -1801,7 +1879,7 @@ class IDEWorkSpace : Window if(workspace) { bool silent = mute || (ide.projectView.buildInProgress == none ? false : true); - CompilerConfig compiler = ideSettings.GetCompilerConfig(workspace.compiler); + CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(workspace.activeCompiler); if(!silent) { projectView.ShowOutputBuildLog(true); @@ -1816,14 +1894,15 @@ class IDEWorkSpace : Window void UpdateToolBarActiveCompilers() { toolBar.activeCompiler.Clear(); - for(compiler : ideSettings.compilerConfigs) + for(compiler : ideConfig.compilers) { DataRow row = toolBar.activeCompiler.AddString(compiler.name); - if(workspace && workspace.compiler && !strcmp(compiler.name, workspace.compiler)) + if(workspace && workspace.activeCompiler && !strcmp(compiler.name, workspace.activeCompiler)) toolBar.activeCompiler.currentRow = row; } if(!toolBar.activeCompiler.currentRow && toolBar.activeCompiler.firstRow) toolBar.activeCompiler.SelectRow(toolBar.activeCompiler.firstRow); + toolBar.activeBitDepth.SelectRow(toolBar.activeBitDepth.FindRow(workspace ? workspace.bitDepth : 0)); } void UpdateToolBarActiveConfigs(bool selectionOnly) @@ -1975,6 +2054,7 @@ class IDEWorkSpace : Window { bool unavailable = project && projectView.buildInProgress; bool naForRun = unavailable || !project || project.GetTargetType(project.config) != executable; + BuildOutputMode mode = ide.rightClickMenuBuildOutputMode; projectNewItem.disabled = unavailable; toolBar.buttonNewProject.disabled = unavailable; @@ -1990,7 +2070,7 @@ class IDEWorkSpace : Window toolBar.buttonRun.disabled = naForRun; projectBuildItem.disabled = false; - projectBuildItem.text = unavailable ? $"Stop Build" : $"Build"; + projectBuildItem.text = unavailable ? $"Stop Build" : bldMnuStrBuild[mode]; projectBuildItem.accelerator = unavailable ? Key { pauseBreak, ctrl = true } : f7; projectLinkItem.disabled = unavailable; @@ -2020,27 +2100,28 @@ class IDEWorkSpace : Window if(projectView && projectView.popupMenu && projectView.popupMenu.menu && projectView.popupMenu.created) { MenuItem menu; - menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectBuild, 0); + BuildOutputMode mode = ide.rightClickMenuBuildOutputMode; + menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectBuild, mode); if(menu) { menu.disabled = false; - menu.text = unavailable ? $"Stop Build" : $"Build"; + menu.text = unavailable ? $"Stop Build" : bldMnuStrBuild[mode]; menu.accelerator = unavailable ? Key { pauseBreak, ctrl = true } : f7; } - menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectLink, 0); if(menu) menu.disabled = unavailable; - menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectRebuild, 0); if(menu) menu.disabled = unavailable; - menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectCleanTarget, 0); if(menu) menu.disabled = unavailable; - menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectClean, 0); if(menu) menu.disabled = unavailable; - menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectRealClean, 0); if(menu) menu.disabled = unavailable; - menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectRegenerate, 0); if(menu) menu.disabled = unavailable; - menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectInstall, 0); if(menu) menu.disabled = unavailable; - menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectRemove, 0); if(menu) menu.disabled = unavailable; - menu = projectView.popupMenu.menu.FindItem(ProjectView::FileClean, 0); if(menu) menu.disabled = unavailable; - menu = projectView.popupMenu.menu.FindItem(ProjectView::FileCompile, 0); if(menu) menu.disabled = unavailable; - menu = projectView.popupMenu.menu.FindItem(ProjectView::FileDebugPrecompile, 0); if(menu) menu.disabled = unavailable; - menu = projectView.popupMenu.menu.FindItem(ProjectView::FileDebugCompile, 0); if(menu) menu.disabled = unavailable; - menu = projectView.popupMenu.menu.FindItem(ProjectView::FileDebugGenerateSymbols, 0); if(menu) menu.disabled = unavailable; + menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectLink, mode); if(menu) menu.disabled = unavailable; + menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectRebuild, mode); if(menu) menu.disabled = unavailable; + menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectCleanTarget, mode); if(menu) menu.disabled = unavailable; + menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectClean, mode); if(menu) menu.disabled = unavailable; + menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectRealClean, mode); if(menu) menu.disabled = unavailable; + menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectRegenerate, mode); if(menu) menu.disabled = unavailable; + menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectInstall, mode); if(menu) menu.disabled = unavailable; + menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectRemove, mode); if(menu) menu.disabled = unavailable; + menu = projectView.popupMenu.menu.FindItem(ProjectView::FileClean, mode); if(menu) menu.disabled = unavailable; + menu = projectView.popupMenu.menu.FindItem(ProjectView::FileCompile, mode); if(menu) menu.disabled = unavailable; + menu = projectView.popupMenu.menu.FindItem(ProjectView::FileDebugPrecompile, mode); if(menu) menu.disabled = unavailable; + menu = projectView.popupMenu.menu.FindItem(ProjectView::FileDebugCompile, mode); if(menu) menu.disabled = unavailable; + menu = projectView.popupMenu.menu.FindItem(ProjectView::FileDebugGenerateSymbols, mode); if(menu) menu.disabled = unavailable; projectView.popupMenu.Update(null); } } @@ -2061,7 +2142,6 @@ class IDEWorkSpace : Window bool running = isDebuggerRunning; bool stopped = isDebuggerStopped; bool active = debugger.isActive; - bool noBreakpointToggle = !project; bool isNotRunning = unavailable || !running; bool isNotNotRunning = unavailable || running; @@ -2112,7 +2192,7 @@ class IDEWorkSpace : Window } } - void ChangeFileDialogsDirectory(char * directory, bool saveSettings) + void ChangeFileDialogsDirectory(const char * directory, bool saveSettings) { char tempString[MAX_LOCATION]; strcpy(tempString, directory); @@ -2133,14 +2213,14 @@ class IDEWorkSpace : Window settingsContainer.Save(); } - Window FindWindow(char * filePath) + Window FindWindow(const char * filePath) { Window document = null; // TOCHECK: Do we need to change slashes here? for(document = firstChild; document; document = document.next) { - char * fileName = document.fileName; + const char * fileName = document.fileName; if(document.isDocument && fileName && !fstrcmp(fileName, filePath)) { document.visible = true; @@ -2151,7 +2231,7 @@ class IDEWorkSpace : Window return null; } - bool DontTerminateDebugSession(char * title) + bool DontTerminateDebugSession(const char * title) { if(debugger.isActive) { @@ -2175,14 +2255,14 @@ class IDEWorkSpace : Window return false; } - Window OpenFile(char * origFilePath, bool dontMaximize, bool visible, char * type, OpenCreateIfFails createIfFails, OpenMethod openMethod, bool noParsing) + Window OpenFile(const char * origFilePath, bool dontMaximize, bool visible, const char * type, OpenCreateIfFails createIfFails, OpenMethod openMethod, bool noParsing) { char extension[MAX_EXTENSION] = ""; Window document = null; bool isProject = false; bool needFileModified = true; char winFilePath[MAX_LOCATION]; - char * filePath = strstr(origFilePath, "http://") == origFilePath ? strcpy(winFilePath, origFilePath) : GetSystemPathBuffer(winFilePath, origFilePath); + const char * filePath = strstr(origFilePath, "http://") == origFilePath ? strcpy(winFilePath, origFilePath) : GetSystemPathBuffer(winFilePath, origFilePath); Window currentDoc = activeClient; bool maximizeDoc = !dontMaximize && ((currentDoc && currentDoc.state == maximized) || (!currentDoc && !projectView)); if(!type) @@ -2197,7 +2277,7 @@ class IDEWorkSpace : Window { for(document = firstChild; document; document = document.next) { - char * fileName = document.fileName; + const char * fileName = document.fileName; if(document.isDocument && fileName && !fstrcmp(fileName, filePath) && document.created) { document.visible = true; @@ -2224,7 +2304,6 @@ class IDEWorkSpace : Window { for(;;) { - Project project; Workspace workspace = null; if(FileExists(filePath)) @@ -2240,12 +2319,10 @@ class IDEWorkSpace : Window workspace = LoadWorkspace(filePath, null); else return null; - //project = LoadProject(filePath, null); } if(workspace) { - char absolutePath[MAX_LOCATION]; CreateProjectView(workspace, filePath); document = projectView; @@ -2259,7 +2336,7 @@ class IDEWorkSpace : Window ide.projectView.ShowOutputBuildLog(true); { - CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler); + CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler); ide.projectView.DisplayCompiler(compiler, false); delete compiler; } @@ -2278,23 +2355,8 @@ class IDEWorkSpace : Window // this crashes on starting ide with epj file, solution please? // app.UpdateDisplay(); + workspace.OpenPreviouslyOpenedFiles(noParsing); workspace.holdTracking = true; - for(ofi : workspace.openedFiles) - { - if(ofi.state != closed) - { - Window file = OpenFile(ofi.path, false, true, null, no, normal, noParsing); - if(file) - { - char fileName[MAX_LOCATION]; - ProjectNode node; - GetLastDirectory(ofi.path, fileName); - node = projectView.project.topNode.Find(fileName, true); - if(node) - node.EnsureVisible(); - } - } - } ide.RepositionWindows(false); workspace.holdTracking = false; @@ -2376,10 +2438,10 @@ class IDEWorkSpace : Window prj = LoadProject(filePath, null); if(prj) { - char * activeConfigName = null; - CompilerConfig compiler = ideSettings.GetCompilerConfig(workspace.compiler); + const char * activeConfigName = null; + CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(workspace.activeCompiler); prj.StartMonitoring(); - workspace.projects.Add(prj); + workspace.AddProject(prj, null); if(toolBar.activeConfig.currentRow && toolBar.activeConfig.currentRow != toolBar.activeConfig.firstRow && toolBar.activeConfig.currentRow.string && toolBar.activeConfig.currentRow.string[0]) activeConfigName = toolBar.activeConfig.currentRow.string; @@ -2482,7 +2544,7 @@ class IDEWorkSpace : Window { document.fileName = filePath; if(workspace && !workspace.holdTracking) - workspace.UpdateOpenedFileInfo(filePath, opened); + workspace.UpdateOpenedFileInfo(filePath, opened, true); } } @@ -2502,21 +2564,7 @@ class IDEWorkSpace : Window if(document) { if(projectView && document._class == class(CodeEditor) && workspace) - { - int lineNumber, position; - Point scroll; - CodeEditor editor = (CodeEditor)document; - editor.openedFileInfo = workspace.UpdateOpenedFileInfo(filePath, opened); - editor.openedFileInfo.holdTracking = true; - lineNumber = Max(editor.openedFileInfo.lineNumber - 1, 0); - position = Max(editor.openedFileInfo.position - 1, 0); - editor.editBox.GoToLineNum(lineNumber); - editor.editBox.GoToPosition(editor.editBox.line, lineNumber, position); - scroll.x = Max(editor.openedFileInfo.scroll.x, 0); - scroll.y = Max(editor.openedFileInfo.scroll.y, 0); - editor.editBox.scroll = scroll; - editor.openedFileInfo.holdTracking = false; - } + workspace.RestorePreviouslyOpenedFileState((CodeEditor)document); if(needFileModified) document.OnFileModified = OnFileModified; @@ -2525,13 +2573,16 @@ class IDEWorkSpace : Window document.state = maximized; if(isProject) - ideSettings.AddRecentProject(document.fileName); + { + ideConfig.recentWorkspaces.addRecent(document.fileName); + ide.updateRecentProjectsMenu(); + } + else if(workspace) + workspace.recentFiles.addRecent(document.fileName); else - ideSettings.AddRecentFile(document.fileName); - ide.UpdateRecentMenus(); + ideConfig.recentFiles.addRecent(document.fileName); + ide.updateRecentFilesMenu(); ide.AdjustFileMenus(); - settingsContainer.Save(); - return document; } else @@ -2542,19 +2593,19 @@ class IDEWorkSpace : Window /*bool Window::GenericDocumentOnClose(bool parentClosing) { if(!parentClosing && ide.workspace) - ide.workspace.UpdateOpenedFileInfo(fileName, unknown); + ide.workspace.UpdateOpenedFileInfo(fileName, unknown, false); return true; }*/ bool ModelView::ModelViewOnClose(bool parentClosing) { if(!parentClosing && ide.workspace) - ide.workspace.UpdateOpenedFileInfo(fileName, unknown); + ide.workspace.UpdateOpenedFileInfo(fileName, unknown, false); return true; } bool PictureEdit::PictureEditOnClose(bool parentClosing) { if(!parentClosing && ide.workspace) - ide.workspace.UpdateOpenedFileInfo(fileName, unknown); + ide.workspace.UpdateOpenedFileInfo(fileName, unknown, false); return true; } @@ -2602,16 +2653,75 @@ class IDEWorkSpace : Window return true; } - void GoToError(const char * line, bool noParsing) + void GoToError(const char * line, bool noParsing, const char * objectFileExt) { if(projectView) - projectView.GoToError(line, noParsing); + projectView.GoToError(line, noParsing, objectFileExt); + } + + FileAttribs GoToCodeSelectFile(const char * filePath, const char * dir, Project prj, ProjectNode * node, char * selectedPath, const char * objectFileExt) + { + FileAttribs result { }; + FileAttribs fileAttribs; + if(filePath[0]) + { + if(prj) + strcpy(selectedPath, prj.topNode.path); + else if(dir && dir[0]) + strcpy(selectedPath, dir); + else + selectedPath[0] = '\0'; + PathCat(selectedPath, filePath); + + if((fileAttribs = FileExists(selectedPath)).isFile) + result = fileAttribs; + else if(workspace) + { + bool done = false; + for(p : workspace.projects) + { + strcpy(selectedPath, p.topNode.path); + PathCat(selectedPath, filePath); + if((fileAttribs = FileExists(selectedPath)).isFile) + { + done = true; + result = fileAttribs; + break; + } + } + if(!done) + { + Project project; + ProjectNode n = null; + for(p : workspace.projects) + { + if((n = p.topNode.Find(filePath, false))) + { + n.GetFullFilePath(selectedPath, true); + if((fileAttribs = FileExists(selectedPath)).isFile) + { + if(node) *node = n; + result = fileAttribs; + break; + } + } + } + if(!n && (n = workspace.GetObjectFileNode(filePath, &project, selectedPath, objectFileExt)) && project && + (fileAttribs = FileExists(selectedPath)).isFile) + { + if(node) *node = n; + result = fileAttribs; + } + } + } + } + return result; } - void CodeLocationParseAndGoTo(const char * text, Project project, const char * dir) + void CodeLocationParseAndGoTo(const char * text, Project project, const char * dir, const char * objectFileExt) { char *s = null; - char *path = text; + const char *path = text; char *colon = strchr(text, ':'); char filePath[MAX_LOCATION] = ""; char completePath[MAX_LOCATION]; @@ -2621,7 +2731,7 @@ class IDEWorkSpace : Window FileAttribs fileAttribs; // support for valgrind output - if((s = strstr(text, "==")) && (s = strstr(s+2, "==")) && (s = strstr(s+2, ":")) && (s = strstr(s+1, ":"))) + if((s = strstr(text, "==")) && s == text && (s = strstr(s+2, "==")) && (s = strstr(s+2, ":")) && (s = strstr(s+1, ":"))) { colon = s; for(; s>text; s--) @@ -2644,7 +2754,7 @@ class IDEWorkSpace : Window //line = atoi(colon+1); } // support for "Found n match(es) in "file/path"; - 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) + else if(len > 0 && 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) { path = s+1; } @@ -2703,50 +2813,8 @@ class IDEWorkSpace : Window strcpy(filePath, path); } - if(filePath[0]) - { - if(prj) - strcpy(completePath, prj.topNode.path); - else if(dir && dir[0]) - strcpy(completePath, dir); - else - completePath[0] = '\0'; - PathCat(completePath, filePath); - - if((fileAttribs = FileExists(completePath))) - CodeLocationGoTo(completePath, fileAttribs, line, col); - else if(ide.workspace) - { - bool done = false; - for(p : ide.workspace.projects) - { - strcpy(completePath, p.topNode.path); - PathCat(completePath, filePath); - if((fileAttribs = FileExists(completePath)).isFile) - { - CodeLocationGoTo(completePath, fileAttribs, line, col); - done = true; - break; - } - } - if(!done) - { - for(p : ide.workspace.projects) - { - ProjectNode node = p.topNode.Find(filePath, false); - if(node) - { - node.GetFullFilePath(completePath); - if((fileAttribs = FileExists(completePath)).isFile) - { - CodeLocationGoTo(completePath, fileAttribs, line, col); - break; - } - } - } - } - } - } + if((fileAttribs = GoToCodeSelectFile(filePath, dir, prj, null, completePath, objectFileExt))) + CodeLocationGoTo(completePath, fileAttribs, line, col); } void CodeLocationGoTo(const char * path, const FileAttribs fileAttribs, int line, int col) @@ -2756,9 +2824,10 @@ class IDEWorkSpace : Window char ext[MAX_EXTENSION]; GetExtension(path, ext); strlwr(ext); - if(!strcmp(ext, "mp3") || !strcmp(ext, "flac") || !strcmp(ext, "ogg") || !strcmp(ext, "avi") || !strcmp(ext, "mkv")) + if(binaryDocExt.Find(ext)) ShellOpen(path); - else if(!strcmp(ext, "a") || !strcmp(ext, "o") || !strcmp(ext, "lib") || !strcmp(ext, "dll") || !strcmp(ext, "exe")) + else if(!strcmp(ext, "a") || !strcmp(ext, "o") || !strcmp(ext, "bc") || + !strcmp(ext, "lib") || !strcmp(ext, "dll") || !strcmp(ext, "exe")) { char dirPath[MAX_LOCATION]; StripLastDirectory(path, dirPath); @@ -2766,8 +2835,8 @@ class IDEWorkSpace : Window } else { - CodeEditor codeEditor = (CodeEditor)OpenFile(path, false, true, ext, no, normal, false); - if(codeEditor && line) + CodeEditor codeEditor = (CodeEditor)OpenFile(path, false, true, !strcmpi(ext, "epj") ? "txt" : ext, no, normal, false); + if(codeEditor && codeEditor._class == class(CodeEditor) && line) { EditBox editBox = codeEditor.editBox; editBox.GoToLineNum(line - 1); @@ -2988,7 +3057,7 @@ class IDEWorkSpace : Window { List nodes { }; nodes.Add(node); - projectView.Compile(node.project, nodes, mods.ctrl && mods.shift, isCObject ? cObject : normal); + projectView.Compile(node.project, nodes, normal, isCObject ? cObject : normal); delete nodes; } } @@ -3029,7 +3098,6 @@ class IDEWorkSpace : Window { int c; bool passThrough = false; - bool debugStart = false; bool debugWorkDir = false; char * passDebugWorkDir = null; bool openAsText = false; @@ -3040,7 +3108,7 @@ class IDEWorkSpace : Window { if(passThrough) { - char * arg = app.argv[c]; + const char * arg = app.argv[c]; char * buf = new char[strlen(arg)*2+1]; if(ptArg++ > 0) passArgs.concat(" "); @@ -3059,7 +3127,7 @@ class IDEWorkSpace : Window else if(!strcmp(app.argv[c], "-no-parsing")) ide.noParsing = true; else if(!strcmp(app.argv[c], "-debug-start")) - debugStart = true; + ide.debugStart = true; else if(!strcmp(app.argv[c], "-debug-work-dir")) debugWorkDir = true; else if(!strcmp(app.argv[c], "-@")) @@ -3077,7 +3145,7 @@ class IDEWorkSpace : Window GetExtension(app.argv[c], ext); isProject = !openAsText && !strcmpi(ext, "epj"); - if(isProject && c > (debugStart ? 2 : 1)) continue; + if(isProject && c > 1 + (ide.debugStart ? 1 : 0)) continue; // Create directory for projects (only) if(((dirAttribs = FileExists(parentPath)) && dirAttribs.isDirectory) || isProject) @@ -3108,9 +3176,8 @@ class IDEWorkSpace : Window newProjectDialog.Modal(); if(projectView) { - ideSettings.AddRecentProject(projectView.fileName); - ide.UpdateRecentMenus(); - settingsContainer.Save(); + ideConfig.recentWorkspaces.addRecent(projectView.fileName); + ide.updateRecentMenus(); } delete newProjectDialog; // Open only one project @@ -3130,8 +3197,6 @@ class IDEWorkSpace : Window workspace.debugDir = passDebugWorkDir; delete passDebugWorkDir; } - if(debugStart) - ;//MenuDebugStart(debugStartResumeItem, 0); // <-- how TODO this without getting into the app.Wait lock UpdateToolBarActiveConfigs(false); UpdateToolBarActiveCompilers(); @@ -3226,17 +3291,21 @@ class IDEWorkSpace : Window for(item : compiler.executableDirs) { + DirExpression dirExpr { }; + dirExpr.Evaluate(item, null, compiler, null, 0); found = false; + for(p : newExePaths) { - if(!fstrcmp(p, item)) + if(!fstrcmp(p, dirExpr.dir)) { found = true; break; } } if(!found) - newExePaths.Add(CopySystemPath(item)); + newExePaths.Add(CopySystemPath(dirExpr.dir)); + delete dirExpr; } GetEnvironment("PATH", oldList, maxPathLen); @@ -3355,7 +3424,6 @@ class IDEWorkSpace : Window IDEWorkSpace() { // Graphics Driver Menu - int c; /* app.currentSkin.selectionColor = selectionColor; @@ -3400,39 +3468,46 @@ class IDEWorkSpace : Window return true; } - void UpdateRecentMenus() + void updateRecentMenus() { - int c; - Menu fileMenu = menu.FindMenu($"File"); - Menu recentFiles = fileMenu.FindMenu($"Recent Files"); - Menu recentProjects = fileMenu.FindMenu($"Recent Projects"); + updateRecentFilesMenu(); + updateRecentProjectsMenu(); + } + + void updateRecentFilesMenu() + { + int c = 0; char * itemPath = new char[MAX_LOCATION]; char * itemName = new char[MAX_LOCATION+4]; - MenuItem item; - - recentFiles.Clear(); - c = 0; - - for(recent : ideSettings.recentFiles) + Workspace ws = workspace; + RecentPaths recentFiles = ws ? ws.recentFiles : ideConfig.recentFiles; + recentFilesMenu.Clear(); + for(recent : recentFiles) { strncpy(itemPath, recent, MAX_LOCATION); itemPath[MAX_LOCATION-1] = '\0'; MakeSystemPath(itemPath); snprintf(itemName, MAX_LOCATION+4, "%d %s", 1 + c, itemPath); itemName[MAX_LOCATION+4-1] = '\0'; - recentFiles.AddDynamic(MenuItem { copyText = true, text = itemName, (Key)k1 + c, id = c, NotifySelect = ide.FileRecentFile }, ide, true); + recentFilesMenu.AddDynamic(MenuItem { copyText = true, text = itemName, (Key)k1 + c, id = c, NotifySelect = ide.FileRecentFile }, ide, true); c++; } + delete itemPath; + delete itemName; + } - recentProjects.Clear(); - c = 0; - for(recent : ideSettings.recentProjects) + void updateRecentProjectsMenu() + { + int c = 0; + char * itemPath = new char[MAX_LOCATION]; + char * itemName = new char[MAX_LOCATION+4]; + recentProjectsMenu.Clear(); + for(recent : ideConfig.recentWorkspaces) { strncpy(itemPath, recent, MAX_LOCATION); itemPath[MAX_LOCATION-1] = '\0'; MakeSystemPath(itemPath); snprintf(itemName, MAX_LOCATION+4, "%d %s", 1 + c, itemPath); itemName[MAX_LOCATION+4-1] = '\0'; - recentProjects.AddDynamic(MenuItem { copyText = true, text = itemName, (Key)k1 + c, id = c, NotifySelect = ide.FileRecentProject }, ide, true); + recentProjectsMenu.AddDynamic(MenuItem { copyText = true, text = itemName, (Key)k1 + c, id = c, NotifySelect = ide.FileRecentProject }, ide, true); c++; } - delete itemPath; delete itemName; } @@ -3441,6 +3516,7 @@ class IDEWorkSpace : Window { delete driverItems; delete skinItems; + delete languageItems; delete ideSettings; if(documentor) { @@ -3464,153 +3540,104 @@ define sdkDirName = "Ecere SDK"; define sdkDirName = "ecere"; #endif -void FindAndShellOpenInstalledFolder(char * name) +bool GetInstalledFileOrFolder(const char * subDir, const char * name, char * path, FileAttribs attribs) { - char * p = new char[MAX_LOCATION]; + bool found = false; char * v = new char[maxPathLen]; - byte * tokens[256]; - int c, numTokens; - Array paths { }; - p[0] = v[0] = '\0'; - strncpy(p, settingsContainer.moduleLocation, MAX_LOCATION); p[MAX_LOCATION-1] = '\0'; - StripLastDirectory(p, p); - PathCat(p, name); - paths.Add(CopyString(p)); -#if defined(__WIN32__) - GetEnvironment("ECERE_SDK_SRC", v, maxPathLen); - if(v[0]) - { - strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0'; - PathCat(p, name); paths.Add(CopyString(p)); - } - GetEnvironment("AppData", v, maxPathLen); - if(v[0]) + v[0] = '\0'; + if(!found) { - strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0'; - PathCat(p, sdkDirName); PathCat(p, name); paths.Add(CopyString(p)); + strncpy(path, settingsContainer.moduleLocation, MAX_LOCATION); path[MAX_LOCATION-1] = '\0'; + StripLastDirectory(path, path); + PathCat(path, subDir); + if(name) PathCat(path, name); + if(FileExists(path) & attribs) found = true; } - GetEnvironment("ProgramFiles", v, maxPathLen); - if(v[0]) - { - strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0'; - PathCat(p, sdkDirName); PathCat(p, name); paths.Add(CopyString(p)); - } - GetEnvironment("ProgramFiles(x86)", v, maxPathLen); - if(v[0]) - { - strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0'; - PathCat(p, sdkDirName); PathCat(p, name); paths.Add(CopyString(p)); - } - GetEnvironment("SystemDrive", v, maxPathLen); - if(v[0]) +#if defined(__WIN32__) + if(!found) { - strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0'; - PathCat(p, "Program Files"); PathCat(p, sdkDirName); PathCat(p, name); paths.Add(CopyString(p)); + for(s : [ "ECERE_SDK_SRC", "AppData", "ALLUSERSPROFILE", "USERPROFILE", "HOMEPATH", "ProgramData", "ProgramFiles", "ProgramFiles(x86)", "SystemDrive" ]) + { + GetEnvironment(s, v, maxPathLen); + if(v[0]) + { + strncpy(path, v, MAX_LOCATION); path[MAX_LOCATION-1] = '\0'; + if(!strcmp(s, "SystemDrive")) + PathCat(path, "Program Files"); + if(strcmp(s, "ECERE_SDK_SRC")) + PathCat(path, sdkDirName); + PathCat(path, subDir); + if(name) PathCat(path, name); + if(FileExists(path) & attribs) + { + found = true; + break; + } + } + } } #else - GetEnvironment("XDG_DATA_DIRS", v, maxPathLen); - numTokens = TokenizeWith(v, sizeof(tokens) / sizeof(byte *), tokens, ":", false); - for(c=0; c paths { }; - p[0] = v[0] = '\0'; - strncpy(p, settingsContainer.moduleLocation, MAX_LOCATION); p[MAX_LOCATION-1] = '\0'; - paths.Add(CopyString(p)); - StripLastDirectory(p, p); - PathCat(p, subdir); - paths.Add(CopyString(p)); -#if defined(__WIN32__) - GetEnvironment("ECERE_SDK_SRC", v, maxPathLen); - if(v[0]) - { - strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0'; - PathCat(p, sdkDirName); PathCat(p, subdir); paths.Add(CopyString(p)); - } - GetEnvironment("AppData", v, maxPathLen); - if(v[0]) - { - strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0'; - PathCat(p, sdkDirName); PathCat(p, subdir); paths.Add(CopyString(p)); - } - GetEnvironment("ProgramFiles", v, maxPathLen); - if(v[0]) - { - strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0'; - PathCat(p, sdkDirName); PathCat(p, subdir); paths.Add(CopyString(p)); - } - GetEnvironment("ProgramFiles(x86)", v, maxPathLen); - if(v[0]) - { - strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0'; - PathCat(p, sdkDirName); PathCat(p, subdir); paths.Add(CopyString(p)); - } - GetEnvironment("SystemDrive", v, maxPathLen); - if(v[0]) - { - strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0'; - PathCat(p, "Program Files"); PathCat(p, sdkDirName); PathCat(p, subdir); paths.Add(CopyString(p)); - } -#else - GetEnvironment("XDG_DATA_DIRS", v, maxPathLen); - numTokens = TokenizeWith(v, sizeof(tokens) / sizeof(byte *), tokens, ":", false); - for(c=0; c 1 && !strcmpi(GetExtension(argv[1], ext), "3ds")) + if(app.argFilesCount > 0 && !strcmpi(GetExtension(argv[1], ext), "3ds")) { app.driver = "OpenGL"; ide.driverItems[1].checked = true; @@ -3680,9 +3713,20 @@ class IDEApp : GuiApplication ide.driverItems[ideSettings.displayDriver && !strcmp(ideSettings.displayDriver,"OpenGL")].checked = true; } + { + char model[MAX_LOCATION]; + if(GetInstalledFileOrFolder("samples", "3D/ModelViewer/models/duck/duck.3DS", model, { isFile = true })) + { + ide.duck.modelFile = model; + ide.duck.parent = ideMainFrame; + } + } + if(ide.duck.modelFile && !strcmpi(app.driver, "OpenGL")) + ide.debugRubberDuck.disabled = false; + SetInIDE(true); - desktop.text = titleECEREIDE; + desktop.caption = titleECEREIDE; /* int c; for(c = 1; c