import "FileSystemIterator"
-AVLTree<String> binaryDocExt
+AVLTree<const String> binaryDocExt
{ [
"wav", "mp3", "flac", "ogg",
"mid",
{
parent = this;
- void OnGotoError(char * line, bool noParsing)
+ void OnGotoError(const char * line, bool noParsing)
{
- ide.GoToError(line, noParsing);
+ CompilerConfig compiler = ide.workspace ? ideSettings.GetCompilerConfig(ide.workspace.compiler) : null;
+ const char * objectFileExt = compiler ? compiler.objectFileExt : objectDefaultFileExt;
+ ide.GoToError(line, noParsing, objectFileExt);
}
- void OnCodeLocationParseAndGoTo(char * line)
+ void OnCodeLocationParseAndGoTo(const char * line)
{
- ide.CodeLocationParseAndGoTo(line, ide.findInFilesDialog.findProject, ide.findInFilesDialog.findDir);
+ CompilerConfig compiler = ide.workspace ? ideSettings.GetCompilerConfig(ide.workspace.compiler) : null;
+ const char * objectFileExt = compiler ? compiler.objectFileExt : objectDefaultFileExt;
+ ide.CodeLocationParseAndGoTo(line, ide.findInFilesDialog.findProject, ide.findInFilesDialog.findDir, objectFileExt);
}
bool OnKeyDown(Key key, unichar ch)
if(activeFrame)
{
bool error;
- int lineCursor, lineTopFrame, activeThread, hitThread;
+ int lineCursor, lineTopFrame;
int lineH, scrollY, boxH;
BitmapResource bmp;
Breakpoint bp = null;
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
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++)
{
};
bool noParsing;
+ bool debugStart;
+ bool debugHideIDE;
#ifdef GDB_DEBUG_GUI
GDBDialog gdbDialog
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);
}
}
- ProjectView CreateProjectView(Workspace workspace, char * fileName)
+ ProjectView CreateProjectView(Workspace workspace, const char * fileName)
{
Project project = workspace.projects.firstIterator.data;
projectView = ProjectView
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;
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)
{
return false;
}
- void DocumentSaved(Window document, char * fileName)
+ void DocumentSaved(Window document, const char * fileName)
{
ideSettings.AddRecentFile(fileName);
ide.UpdateRecentMenus();
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"
}
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)
bool running = isDebuggerRunning;
bool stopped = isDebuggerStopped;
bool active = debugger.isActive;
- bool noBreakpointToggle = !project;
bool isNotRunning = unavailable || !running;
bool isNotNotRunning = unavailable || running;
}
}
- void ChangeFileDialogsDirectory(char * directory, bool saveSettings)
+ void ChangeFileDialogsDirectory(const char * directory, bool saveSettings)
{
char tempString[MAX_LOCATION];
strcpy(tempString, directory);
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;
return null;
}
- bool DontTerminateDebugSession(char * title)
+ bool DontTerminateDebugSession(const char * title)
{
if(debugger.isActive)
{
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)
{
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;
{
for(;;)
{
- Project project;
Workspace workspace = null;
if(FileExists(filePath))
workspace = LoadWorkspace(filePath, null);
else
return null;
- //project = LoadProject(filePath, null);
}
if(workspace)
{
- char absolutePath[MAX_LOCATION];
CreateProjectView(workspace, filePath);
document = projectView;
prj = LoadProject(filePath, null);
if(prj)
{
- char * activeConfigName = null;
+ const char * activeConfigName = null;
CompilerConfig compiler = ideSettings.GetCompilerConfig(workspace.compiler);
prj.StartMonitoring();
workspace.projects.Add(prj);
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);
}
- void CodeLocationParseAndGoTo(const char * text, Project project, const char * dir)
+ 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);
+ 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, 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];
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--)
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)
strlwr(ext);
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);
}
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);
{
List<ProjectNode> nodes { };
nodes.Add(node);
- projectView.Compile(node.project, nodes, mods.ctrl && mods.shift, isCObject ? cObject : normal);
+ projectView.Compile(node.project, nodes, false, false, isCObject ? cObject : normal);
delete nodes;
}
}
{
int c;
bool passThrough = false;
- bool debugStart = false;
bool debugWorkDir = false;
char * passDebugWorkDir = null;
bool openAsText = false;
{
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(" ");
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-hide-ide"))
+ ide.debugHideIDE = true;
else if(!strcmp(app.argv[c], "-debug-work-dir"))
debugWorkDir = true;
else if(!strcmp(app.argv[c], "-@"))
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) + (ide.debugHideIDE ? 1 : 0)) continue;
// Create directory for projects (only)
if(((dirAttribs = FileExists(parentPath)) && dirAttribs.isDirectory) || isProject)
workspace.debugDir = passDebugWorkDir;
delete passDebugWorkDir;
}
- if(debugStart)
- ;//MenuDebugStart(debugStartResumeItem, 0); // <-- how TODO this without getting into the app.Wait lock
UpdateToolBarActiveConfigs(false);
UpdateToolBarActiveCompilers();
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);
IDEWorkSpace()
{
// Graphics Driver Menu
- int c;
/*
app.currentSkin.selectionColor = selectionColor;
Menu recentProjects = fileMenu.FindMenu($"Recent Projects");
char * itemPath = new char[MAX_LOCATION];
char * itemName = new char[MAX_LOCATION+4];
- MenuItem item;
recentFiles.Clear();
c = 0;
define sdkDirName = "ecere";
#endif
-bool GetInstalledFileOrFolder(char * subDir, char * name, char * path, FileAttribs attribs)
+bool GetInstalledFileOrFolder(const char * subDir, const char * name, char * path, FileAttribs attribs)
{
bool found = false;
char * v = new char[maxPathLen];
#else
if(!found)
{
- byte * tokens[256];
+ char * tokens[256];
int c, numTokens;
GetEnvironment("XDG_DATA_DIRS", v, maxPathLen);
return found;
}
-void FindAndShellOpenInstalledFolder(char * name)
+void FindAndShellOpenInstalledFolder(const char * name)
{
char path[MAX_LOCATION];
if(GetInstalledFileOrFolder(name, null, path, { isDirectory = true }))
ShellOpen(path);
}
-void FindAndShellOpenInstalledFile(char * subdir, char * name)
+void FindAndShellOpenInstalledFile(const char * subdir, const char * name)
{
char path[MAX_LOCATION];
if(GetInstalledFileOrFolder(subdir, name, path, { isFile = true }))
{
bool preserveRootFolder;
- void OutFolder(char * folderPath, bool isRoot)
+ void OutFolder(const char * folderPath, bool isRoot)
{
if(!(preserveRootFolder && isRoot))
RemoveDir(folderPath);
}
- bool OnFile(char * filePath)
+ bool OnFile(const char * filePath)
{
DeleteFile(filePath);
return true;
if(ideSettings.language)
{
- String language = GetLanguageString();
+ const String language = GetLanguageString();
if(ideSettings.language.OnCompare(language))
{
LanguageRestart(ideSettings.language, app, null, null, null, null, true);
else if(!strcmp(app.argv[c], "-t"));
else if(!strcmp(app.argv[c], "-no-parsing"));
else if(!strcmp(app.argv[c], "-debug-start"));
+ else if(!strcmp(app.argv[c], "-debug-hide-ide"));
else if(!strcmp(app.argv[c], "-debug-work-dir"))
debugWorkDir = true;
else if(!strcmp(app.argv[c], "-@"))
}
if(!LoadIncludeFile())
- PrintLn("error: unable to load :crossplatform.mk file inside ide binary.");
+ PrintLn($"error: unable to load :crossplatform.mk file inside ide binary.");
// Create language menu
{
char genericLocale[256];
i = 0;
strncpy(genericLocale, language, sizeof(genericLocale));
- genericLocale[sizeof(genericLocale)] = 0;
+ genericLocale[sizeof(genericLocale)-1] = 0;
under = strchr(genericLocale, '_');
if(under)