ProjectView projectView;
Array<ProjectNode> stack { };
- bool OnFolder(char * folderPath)
+ bool OnFolder(const char * folderPath)
{
char name[MAX_LOCATION];
ProjectNode parentNode = stack.lastIterator.data;
return true;
}
- void OutFolder(char * folderPath, bool isRoot)
+ void OutFolder(const char * folderPath, bool isRoot)
{
stack.lastIterator.Remove(); //stack.Remove();
}
- bool OnFile(char * filePath)
+ bool OnFile(const char * filePath)
{
ProjectNode parentNode = stack.lastIterator.data;
if(!projectView.AddFile(parentNode, filePath, parentNode.isInResources, false))
{ $"Ecere IDE Workspace", WorkspaceExtension }
] };
-static char * iconNames[] =
+static const char * iconNames[] =
{
"<:ecere>mimeTypes/file.png", /*genFile*/
"<:ecere>mimeTypes/textEcereWorkspace.png", /*ewsFile*/
{
bool showDebuggingMenuItems = mods.ctrl && mods.shift;
bool showInstallMenuItem = mods.ctrl && mods.shift;
- ProjectNode node = (ProjectNode)row.tag;
+ ProjectNode node = (ProjectNode)(intptr)row.tag;
#ifdef IDE_SHOW_INSTALL_MENU_BUTTON
showInstallMenuItem = true;
#endif
{
if(row)
{
- ProjectNode node = (ProjectNode)row.tag;
+ ProjectNode node = (ProjectNode)(intptr)row.tag;
switch(key)
{
case altEnter: case Key { keyPadEnter, alt = true }:
bool NotifyCollapse(ListBox listBox, DataRow row, bool collapsed)
{
- ProjectNode node = (ProjectNode)row.tag;
+ ProjectNode node = (ProjectNode)(intptr)row.tag;
if(node.type == folder)
node.icon = collapsed ? folder : openFolder;
return true;
ide.outputView.ShowClearSelectTab(find); // why this?
}
- bool OnSaveFile(char * fileName)
+ bool OnSaveFile(const char * fileName)
{
for(prj : ide.workspace.projects)
{
return true;
}
- bool IsModuleInProject(char * filePath)
+ bool IsModuleInProject(const char * filePath)
{
char moduleName[MAX_FILENAME]; //, modulePath[MAX_LOCATION];
GetLastDirectory(filePath, moduleName);
ProjectNode node = null;
if(document.fileName)
{
- bool excluded;
+ bool excluded = false;
char winFileName[MAX_LOCATION];
char * documentFileName = GetSlashPathBuffer(winFileName, document.fileName);
Project prj;
{
for(p : ide.workspace.projects)
{
- Project pr = p;
prj = project ? project : p;
if((n = prj.topNode.FindByFullPath(documentFileName, false)))
{
bool ProjectPrepareForToolchain(Project project, PrepareMakefileMethod method, bool cleanLog, bool displayCompiler,
CompilerConfig compiler, ProjectConfig config)
{
- bool isReady = true;
- char message[MAX_F_STRING];
- LogBox logBox = ide.outputView.buildBox;
-
ShowOutputBuildLog(cleanLog);
if(displayCompiler)
(method == forceExists && exists) ||
(method == normal && (!exists || (config && config.makingModified))))
{
- char * reason;
- char * action;
+ const char * reason;
+ const char * action;
ide.statusBar.text = $"Generating Makefile & Dependencies..."; // Dependencies?
app.UpdateDisplay();
//logBox.Logf("%s\n", makefileName);
logBox.Logf($"%s - %s%smakefile for %s config...\n", makefileName, reason, action, GetConfigName(config));
- if(!project.GenerateMakefile(null, false, null, config))
+ if(!project.GenerateMakefile(null, false, null, config, compiler.ldCommand))
ide.outputView.buildBox.Logf($"Error generating makefile (Is the project directory writable?)\n");
ide.statusBar.text = null;
if(selection || !ide.activeClient)
{
DataRow row = fileList.currentRow;
- ProjectNode node = row ? (ProjectNode)row.tag : null;
+ ProjectNode node = row ? (ProjectNode)(intptr)row.tag : null;
if(node) prj = node.project;
}
else
if(selection || !ide.activeClient)
{
DataRow row = fileList.currentRow;
- ProjectNode node = row ? (ProjectNode)row.tag : null;
+ ProjectNode node = row ? (ProjectNode)(intptr)row.tag : null;
if(node) prj = node.project;
}
else
if(selection || !ide.activeClient)
{
DataRow row = fileList.currentRow;
- ProjectNode node = row ? (ProjectNode)row.tag : null;
+ ProjectNode node = row ? (ProjectNode)(intptr)row.tag : null;
if(node) prj = node.project;
}
else
if(selection || !ide.activeClient)
{
DataRow row = fileList.currentRow;
- ProjectNode node = row ? (ProjectNode)row.tag : null;
+ ProjectNode node = row ? (ProjectNode)(intptr)row.tag : null;
if(node) prj = node.project;
}
else
return true;
}
- void CleanProject(char * terminateDebugSessionMessage, char * cleaningMessageLogFormat, MenuItem selection, CleanType cleanType, bool justPrint)
+ void CleanProject(const char * terminateDebugSessionMessage, const char * cleaningMessageLogFormat, MenuItem selection, CleanType cleanType, bool justPrint)
{
Project prj = project;
Array<Project> projects { };
{
OldLink item;
OldList selectedRows;
- List<ProjectNode> nodes { };
fileList.GetMultiSelection(selectedRows);
for(item = selectedRows.first; item; item = item.next)
{
- OldLink i;
DataRow row = item.data;
- ProjectNode node = (ProjectNode)row.tag;
+ ProjectNode node = (ProjectNode)(intptr)row.tag;
if(node.type == project)
projects.Add(node.project);
}
if(selection || !ide.activeClient)
{
DataRow row = fileList.currentRow;
- ProjectNode node = row ? (ProjectNode)row.tag : null;
+ ProjectNode node = row ? (ProjectNode)(intptr)row.tag : null;
if(node) prj = node.project;
if(projects.count == 0)
projects.Add(prj);
if(selection || !ide.activeClient)
{
DataRow row = fileList.currentRow;
- ProjectNode node = row ? (ProjectNode)row.tag : null;
+ ProjectNode node = row ? (ProjectNode)(intptr)row.tag : null;
if(node)
prj = node.project;
}
bool Compile(Project project, List<ProjectNode> nodes, bool justPrint, SingleFileCompileMode mode)
{
bool result = true;
- char fileName[MAX_LOCATION];
Window document;
ProjectConfig config = project.config;
bool Clean(Project project, List<ProjectNode> nodes, bool justPrint)
{
bool result = true;
- char fileName[MAX_LOCATION];
Window document;
ProjectConfig config = project.config;
{
char fileName[1024];
char filePath[MAX_LOCATION];
- ProjectNode parentNode = (ProjectNode)row.tag;
+ ProjectNode parentNode = (ProjectNode)(intptr)row.tag;
ProjectNode n, fileNode;
parentNode.GetFileSysMatchingPath(filePath);
MakePathRelative(filePath, parentNode.project.topNode.path, filePath);
for(n = parentNode; n && n != parentNode.project.resNode; n = n.parent);
sprintf(fileName, $"Untitled %d", documentID);
- fileNode = AddFile(parentNode, fileName, (bool)n, true);
+ fileNode = AddFile(parentNode, fileName, n != null, true);
fileNode.path = CopyUnixPath(filePath);
if(fileNode)
{
DataRow row = fileList.currentRow;
if(row)
{
- ProjectNode parentNode = (ProjectNode)row.tag;
+ ProjectNode parentNode = (ProjectNode)(intptr)row.tag;
NewFolder(parentNode, null, true);
}
return true;
DataRow row = fileList.currentRow;
if(row)
{
- ProjectNode toNode = (ProjectNode)row.tag;
+ ProjectNode toNode = (ProjectNode)(intptr)row.tag;
ImportFolder(toNode);
}
return true;
DataRow row = fileList.currentRow;
if(row)
{
- ProjectNode node = (ProjectNode)row.tag;
+ ProjectNode node = (ProjectNode)(intptr)row.tag;
if(node.type == project)
RemoveSelectedNodes();
}
DataRow row = fileList.currentRow;
if(row)
{
- ProjectNode node = (ProjectNode)row.tag;
+ ProjectNode node = (ProjectNode)(intptr)row.tag;
NodeProperties { parent = parent, master = this, node = node,
position = { position.x + 100, position.y + 100 } }.Create();
}
fileList.GetMultiSelection(selectedRows);
for(item = selectedRows.first; item; item = item.next)
{
- OldLink i;
DataRow row = item.data;
- ProjectNode node = (ProjectNode)row.tag;
+ ProjectNode node = (ProjectNode)(intptr)row.tag;
if(!project)
project = node.project;
else if(node.project != project)
fileList.GetMultiSelection(selectedRows);
for(item = selectedRows.first; item; item = item.next)
{
- OldLink i;
DataRow row = item.data;
- ProjectNode node = (ProjectNode)row.tag;
+ ProjectNode node = (ProjectNode)(intptr)row.tag;
if(!project)
project = node.project;
else if(node.project != project)
bool FileDebugPrecompile(MenuItem selection, Modifiers mods)
{
DataRow row = fileList.currentRow;
- ProjectNode node = row ? (ProjectNode)row.tag : null;
+ ProjectNode node = row ? (ProjectNode)(intptr)row.tag : null;
if(node)
{
List<ProjectNode> nodes { };
bool FileDebugCompile(MenuItem selection, Modifiers mods)
{
DataRow row = fileList.currentRow;
- ProjectNode node = row ? (ProjectNode)row.tag : null;
+ ProjectNode node = row ? (ProjectNode)(intptr)row.tag : null;
if(node)
{
List<ProjectNode> nodes { };
bool FileDebugGenerateSymbols(MenuItem selection, Modifiers mods)
{
DataRow row = fileList.currentRow;
- ProjectNode node = row ? (ProjectNode)row.tag : null;
+ ProjectNode node = row ? (ProjectNode)(intptr)row.tag : null;
if(node)
{
List<ProjectNode> nodes { };
if(useSelection)
{
DataRow row = fileList.currentRow;
- ProjectNode node = row ? (ProjectNode)row.tag : null;
+ ProjectNode node = row ? (ProjectNode)(intptr)row.tag : null;
if(node)
prj = node.project;
}
void SelectNextProject(bool backwards)
{
DataRow row = fileList.currentRow;
- DataRow currentRow = row;
- ProjectNode node = (ProjectNode)row.tag;
- if(node.type != project)
- row = node.project.topNode.row;
- else if(backwards)
- row = row.previous ? row.previous : fileList.lastRow;
- if(!backwards)
- row = row.next ? row.next : fileList.firstRow;
- if(row && row != currentRow)
+ if(!row)
+ row = backwards ? fileList.lastRow : fileList.firstRow;
+
+ if(row)
{
- fileList.SelectRow(row);
- fileList.currentRow = row;
+ DataRow currentRow = row;
+ ProjectNode node = (ProjectNode)(intptr)row.tag;
+ if(node.type != project)
+ row = node.project.topNode.row;
+ else if(backwards)
+ row = row.previous ? row.previous : fileList.lastRow;
+ if(!backwards)
+ row = row.next ? row.next : fileList.firstRow;
+ if(row && row != currentRow)
+ {
+ fileList.SelectRow(row);
+ fileList.currentRow = row;
+ }
}
}
{
DataRow row = fileList.currentRow;
if(row)
- node = (ProjectNode)row.tag;
+ node = (ProjectNode)(intptr)row.tag;
}
return node;
}
return result;
}
- void GoToError(const char * line, const bool noParsing)
+ void GoToError(const char * line, const bool noParsing, const char * objectFileExt)
{
char * colon;
{
char moduleName[MAX_LOCATION], filePath[MAX_LOCATION] = "";
char ext[MAX_EXTENSION] = "";
- char * bracket;
ProjectNode node = null;
if(colon)
{
- char * inFileIncludedFrom = strstr(line, stringInFileIncludedFrom);
- char * from = strstr(line, "from ");
- char * start = inFileIncludedFrom ? inFileIncludedFrom + strlen(stringInFileIncludedFrom) : from ? from + strlen("from ") : line;
+ const char * inFileIncludedFrom = strstr(line, stringInFileIncludedFrom);
+ const char * from = strstr(line, "from ");
+ const char * start = inFileIncludedFrom ? inFileIncludedFrom + strlen(stringInFileIncludedFrom) : from ? from + strlen("from ") : line;
int len;
if(colon < start)
start = line;
for(prj : ide.workspace.projects; prj.lastBuildConfigName)
{
if((config = prj.GetConfig(prj.lastBuildConfigName)))
- node = prj.FindNodeByObjectFileName(moduleName, type, dotMain, config);
+ node = prj.FindNodeByObjectFileName(moduleName, type, dotMain, config, objectFileExt);
if(node)
break;
}
if(compiler)
{
int bitDepth = ide.workspace.bitDepth;
+ const char * objectFileExt = compiler ? compiler.objectFileExt : objectDefaultFileExt;
DirExpression objDir = project.GetObjDir(compiler, config, bitDepth);
strcpy(filePath, project.topNode.path);
PathCatSlash(filePath, objDir.dir);
- node.GetObjectFileName(name, project.configsNameCollisions[config ? config.name : ""], type, dotMain);
+ node.GetObjectFileName(name, project.configsNameCollisions[config ? config.name : ""], type, dotMain, objectFileExt);
PathCatSlash(filePath, name);
delete objDir;
}
moduleName[0] = 0; // Avoid opening binary files
if(moduleName[0])
{
- CodeEditor codeEditor;
- if(!filePath[0])
- {
- strcpy(filePath, project.topNode.path);
- PathCatSlash(filePath, moduleName);
- }
+ CodeEditor codeEditor = null;
- codeEditor = (CodeEditor)ide.OpenFile(filePath, false, true, null, no, normal, noParsing);
- if(!codeEditor && !strcmp(ext, "c"))
+ if(ide.GoToCodeSelectFile(moduleName, null, project, null, filePath, objectFileExt))
{
- char ecName[MAX_LOCATION];
- ChangeExtension(filePath, "ec", ecName);
- codeEditor = (CodeEditor)ide.OpenFile(ecName, false, true, null, no, normal, noParsing);
+ codeEditor = (CodeEditor)ide.OpenFile(filePath, false, true, null, no, normal, noParsing);
}
+
if(!codeEditor)
{
- char path[MAX_LOCATION];
- // TOFIX: Improve on this, don't use only filename, make a function
- if(ide && ide.workspace)
+ if(!filePath[0])
{
- for(prj : ide.workspace.projects)
- {
- ProjectNode node;
- MakePathRelative(filePath, prj.topNode.path, path);
+ strcpy(filePath, project.topNode.path);
+ PathCatSlash(filePath, moduleName);
+ }
- if((node = prj.topNode.FindWithPath(path, false)))
- {
- strcpy(filePath, prj.topNode.path);
- PathCatSlash(filePath, node.path);
- PathCatSlash(filePath, node.name);
- codeEditor = (CodeEditor)ide.OpenFile(filePath, false, true, null, no, normal, noParsing);
- if(codeEditor)
- break;
- }
- }
- if(!codeEditor && (strchr(moduleName, '/') || strchr(moduleName, '\\')))
+ codeEditor = (CodeEditor)ide.OpenFile(filePath, false, true, null, no, normal, noParsing);
+ if(!codeEditor && !strcmp(ext, "c"))
+ {
+ char ecName[MAX_LOCATION];
+ ChangeExtension(filePath, "ec", ecName);
+ codeEditor = (CodeEditor)ide.OpenFile(ecName, false, true, null, no, normal, noParsing);
+ }
+ if(!codeEditor)
+ {
+ char path[MAX_LOCATION];
+ // TOFIX: Improve on this, don't use only filename, make a function
+ if(ide && ide.workspace)
{
for(prj : ide.workspace.projects)
{
ProjectNode node;
- if((node = prj.topNode.FindWithPath(moduleName, false)))
+ MakePathRelative(filePath, prj.topNode.path, path);
+
+ if((node = prj.topNode.FindWithPath(path, false)))
{
strcpy(filePath, prj.topNode.path);
PathCatSlash(filePath, node.path);
break;
}
}
- }
- if(!codeEditor)
- {
- GetLastDirectory(moduleName, moduleName);
- for(prj : ide.workspace.projects)
+ if(!codeEditor && (strchr(moduleName, '/') || strchr(moduleName, '\\')))
{
- ProjectNode node;
- if((node = prj.topNode.Find(moduleName, false)))
+ for(prj : ide.workspace.projects)
{
- strcpy(filePath, prj.topNode.path);
- PathCatSlash(filePath, node.path);
- PathCatSlash(filePath, node.name);
- codeEditor = (CodeEditor)ide.OpenFile(filePath, false, true, null, no, normal, noParsing);
- if(codeEditor)
- break;
+ ProjectNode node;
+ if((node = prj.topNode.FindWithPath(moduleName, false)))
+ {
+ strcpy(filePath, prj.topNode.path);
+ PathCatSlash(filePath, node.path);
+ PathCatSlash(filePath, node.name);
+ codeEditor = (CodeEditor)ide.OpenFile(filePath, false, true, null, no, normal, noParsing);
+ if(codeEditor)
+ break;
+ }
+ }
+ }
+ if(!codeEditor)
+ {
+ GetLastDirectory(moduleName, moduleName);
+ for(prj : ide.workspace.projects)
+ {
+ ProjectNode node;
+ if((node = prj.topNode.Find(moduleName, false)))
+ {
+ strcpy(filePath, prj.topNode.path);
+ PathCatSlash(filePath, node.path);
+ PathCatSlash(filePath, node.name);
+ codeEditor = (CodeEditor)ide.OpenFile(filePath, false, true, null, no, normal, noParsing);
+ if(codeEditor)
+ break;
+ }
}
}
}
bool OpenNode(ProjectNode node, bool noParsing)
{
char filePath[MAX_LOCATION];
+ char ext[MAX_EXTENSION];
node.GetFullFilePath(filePath);
- return ide.OpenFile(filePath, false, true/*false Why was it opening hidden?*/, null, something, normal, noParsing) ? true : false;
+ GetExtension(filePath, ext);
+ if(binaryDocExt.Find(ext))
+ {
+ ShellOpen(filePath);
+ return true;
+ }
+ else
+ return ide.OpenFile(filePath, false, true/*false Why was it opening hidden?*/, null, something, normal, noParsing) ? true : false;
}
void AddNode(ProjectNode node, DataRow addTo)
{
DataRow row = addTo ? addTo.AddRow() : fileList.AddRow();
- row.tag = (int64)node;
+ row.tag = (int64)(intptr)node;
node.row = row;
if(node.type == resources)
if(projectNode.files)
{
ProjectNode child;
- while(child = projectNode.files.first)
+ while((child = projectNode.files.first))
DeleteNode(child);
}
fileList.DeleteRow(projectNode.row);
bool ProjectSave(MenuItem selection, Modifiers mods)
{
DataRow row = fileList.currentRow;
- ProjectNode node = row ? (ProjectNode)row.tag : null;
+ ProjectNode node = row ? (ProjectNode)(intptr)row.tag : null;
Project prj = node ? node.project : null;
if(prj)
{
}
Update(null);
folderNode.row = parentNode.row.AddRowAfter(after ? after.row : null);
- folderNode.row.tag = (int64)folderNode;
+ folderNode.row.tag = (int64)(intptr)folderNode;
folderNode.row.SetData(null, folderNode);
fileList.currentRow = folderNode.row;
{
int c;
DataRow row = fileList.currentRow;
- ProjectNode parentNode = (ProjectNode)row.tag;
+ ProjectNode parentNode = (ProjectNode)(intptr)row.tag;
bool addFailed = false;
int numSelections = fileDialog.numSelections;
- char ** multiFilePaths = fileDialog.multiFilePaths;
+ const char * const * multiFilePaths = fileDialog.multiFilePaths;
Array<String> nameConflictFiles { };
for(c = 0; c < numSelections; c++)
{
- char * filePath = multiFilePaths[c];
+ const char * filePath = multiFilePaths[c];
FileAttribs exists = FileExists(filePath);
bool addThisFile = true;
if(addFailed)
{
int len = 0;
- char * part1 = $"The following file";
- char * opt1 = $" was ";
- char * opt2 = $"s were ";
- char * part2 = $"not added because of identical file name conflict within the project.\n\n";
+ const char * part1 = $"The following file";
+ const char * opt1 = $" was ";
+ const char * opt2 = $"s were ";
+ const char * part2 = $"not added because of identical file name conflict within the project.\n\n";
char * message;
len += strlen(part1);
len += strlen(part2);
}
}
- ProjectNode AddFile(ProjectNode parentNode, char * filePath, bool resources, bool isTemporary)
+ ProjectNode AddFile(ProjectNode parentNode, const char * filePath, bool resources, bool isTemporary)
{
ProjectNode result = null;
ProjectNode after = null;
}
Update(null);
result.row = parentNode.row.AddRowAfter(after ? after.row : null);
- result.row.tag = (int64)result;
+ result.row.tag = (int64)(intptr)result;
result.row.SetData(null, result);
}
return result;
}
- CodeEditor CreateNew(char * upper, char * lower, char * base, char * className)
+ CodeEditor CreateNew(const char * upper, const char * lower, const char * base, char * className)
{
CodeEditor codeEditor = null;
ProjectNode projectNode;
if(!row) row = project.topNode.row;
- parentNode = (ProjectNode)row.tag;
+ parentNode = (ProjectNode)(intptr)row.tag;
for(node : parentNode.files)
{
for(c = 1; c < 100; c++)
{
char string[16];
- sprintf(string, c ? "%s%d.ec" : "%s.ec", lower, c);
+ sprintf(string, "%s%d.ec", lower, c);
if((projectNode = parentNode.Add(project, string, after, file, genFile, true)))
break;
}
Update(null);
project.ModifiedAllConfigs(true, false, false, true);
projectNode.row = parentNode.row.AddRowAfter(after ? after.row : null);
- projectNode.row.tag =(int64)projectNode;
+ projectNode.row.tag = (int64)(intptr)projectNode;
projectNode.row.SetData(null, projectNode);
fileList.currentRow = projectNode.row;
for(item = selection.first; item; item = item.next)
{
DataRow row = item.data;
- ProjectNode node = (ProjectNode)row.tag;
+ ProjectNode node = (ProjectNode)(intptr)row.tag;
if(node.type == file)
{
OpenNode(node, noParsing);
{
OldLink i;
DataRow row = item.data;
- ProjectNode n, node = (ProjectNode)row.tag;
+ ProjectNode n, node = (ProjectNode)(intptr)row.tag;
bool remove = false;
next = item.next;
for(i = selection.first; i && !remove; i = i.next)
{
- ProjectNode iNode = (ProjectNode)((DataRow)i.data).tag;
+ ProjectNode iNode = (ProjectNode)(intptr)((DataRow)i.data).tag;
for(n = node.parent; n; n = n.parent)
{
if(iNode == n)
for(item = selection.first; item; item = item.next)
{
DataRow row = item.data;
- ProjectNode node = (ProjectNode)row.tag;
+ ProjectNode node = (ProjectNode)(intptr)row.tag;
ProjectNode resNode;
for(resNode = node.parent; resNode; resNode = resNode.parent)
if(resNode.type == resources)