BitmapResource bmpTopFrameHalf { ":codeMarks/topFrameHalf.png", window = this };
BitmapResource bmpTopFrameHalfError { ":codeMarks/topFrameHalfError.png", window = this };
+ BuildOutputMode rightClickMenuBuildOutputMode;
+
Debugger debugger { };
ProjectView projectView;
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(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)
CallStackView callStackView
{
- parent = this, font = { panelFont.faceName, panelFont.size };
+ parent = this, font = { panelFont.faceName, panelFont.size, panelFont.bold, panelFont.italic };
void OnSelectFrame(int frameIndex)
{
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)
{
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;
}
{
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++;
};
bool noParsing;
+ bool debugStart;
#ifdef GDB_DEBUG_GUI
GDBDialog gdbDialog
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)
{
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;
}
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 unavailable = project && projectView.buildInProgress;
bool naForRun = unavailable || !project || project.GetTargetType(project.config) != executable;
+ BuildOutputMode mode = ide.rightClickMenuBuildOutputMode;
projectNewItem.disabled = unavailable;
toolBar.buttonNewProject.disabled = unavailable;
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;
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);
}
}
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;
const char *path = text;
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, normal, isCObject ? cObject : normal);
delete nodes;
}
}
{
int c;
bool passThrough = false;
- bool debugStart = false;
bool debugWorkDir = false;
char * passDebugWorkDir = null;
bool openAsText = false;
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], "-@"))
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)
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);
bool found = false;
char * v = new char[maxPathLen];
v[0] = '\0';
- if(found)
+ if(!found)
{
strncpy(path, settingsContainer.moduleLocation, MAX_LOCATION); path[MAX_LOCATION-1] = '\0';
StripLastDirectory(path, path);
#if defined(__WIN32__)
if(!found)
{
- GetEnvironment("ECERE_SDK_SRC", v, maxPathLen);
- if(v[0])
- {
- strncpy(path, v, MAX_LOCATION); path[MAX_LOCATION-1] = '\0';
- PathCat(path, subDir);
- if(name) PathCat(path, name);
- if(FileExists(path) & attribs) found = true;
- }
- }
- if(!found)
- {
- GetEnvironment("AppData", v, maxPathLen);
- if(v[0])
- {
- strncpy(path, v, MAX_LOCATION); path[MAX_LOCATION-1] = '\0';
- PathCat(path, sdkDirName);
- PathCat(path, subDir);
- if(name) PathCat(path, name);
- if(FileExists(path) & attribs) found = true;
- }
- }
- if(!found)
- {
- GetEnvironment("ProgramData", v, maxPathLen);
- if(v[0])
- {
- strncpy(path, v, MAX_LOCATION); path[MAX_LOCATION-1] = '\0';
- PathCat(path, sdkDirName);
- PathCat(path, subDir);
- if(name) PathCat(path, name);
- if(FileExists(path) & attribs) found = true;
- }
- }
- if(!found)
- {
- GetEnvironment("ProgramFiles", v, maxPathLen);
- if(v[0])
+ for(s : [ "ECERE_SDK_SRC", "AppData", "ALLUSERSPROFILE", "USERPROFILE", "HOMEPATH", "ProgramData", "ProgramFiles", "ProgramFiles(x86)", "SystemDrive" ])
{
- strncpy(path, v, MAX_LOCATION); path[MAX_LOCATION-1] = '\0';
- PathCat(path, sdkDirName);
- PathCat(path, subDir);
- if(name) PathCat(path, name);
- if(FileExists(path) & attribs) found = true;
- }
- }
- if(!found)
- {
- GetEnvironment("ProgramFiles(x86)", v, maxPathLen);
- if(v[0])
- {
- strncpy(path, v, MAX_LOCATION); path[MAX_LOCATION-1] = '\0';
- PathCat(path, sdkDirName);
- PathCat(path, subDir);
- if(name) PathCat(path, name);
- if(FileExists(path) & attribs) found = true;
- }
- }
- if(!found)
- {
- GetEnvironment("SystemDrive", v, maxPathLen);
- if(v[0])
- {
- strncpy(path, v, MAX_LOCATION); path[MAX_LOCATION-1] = '\0';
- PathCat(path, "Program Files");
- PathCat(path, sdkDirName);
- PathCat(path, subDir);
- if(name) PathCat(path, name);
- if(FileExists(path) & attribs) found = true;
+ 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
if(!found)
{
- byte * tokens[256];
+ char * p = null;
+ char * tokens[256];
int c, numTokens;
GetEnvironment("XDG_DATA_DIRS", v, maxPathLen);
numTokens = TokenizeWith(v, sizeof(tokens) / sizeof(byte *), tokens, ":", false);
+ if(!numTokens)
+ {
+ p = new char[MAX_LOCATION];
+ p[0] = '\0';
+ strcat(p, "/usr/share");
+ tokens[0] = p;
+ numTokens = 1;
+ }
for(c=0; c<numTokens; c++)
{
strncpy(path, tokens[c], MAX_LOCATION); path[MAX_LOCATION-1] = '\0';
PathCat(path, sdkDirName);
PathCat(path, subDir);
- if(name) PathCat(path, name);
- if(FileExists(path) & attribs) found = true;
+ if(name)
+ PathCat(path, name);
+ if(FileExists(path) & attribs)
+ {
+ found = true;
+ break;
+ }
}
+ delete p;
}
#endif
delete v;
char genericLocale[256];
i = 0;
strncpy(genericLocale, language, sizeof(genericLocale));
- genericLocale[sizeof(genericLocale)] = 0;
+ genericLocale[sizeof(genericLocale)-1] = 0;
under = strchr(genericLocale, '_');
if(under)