break;
case compilerSettings:
{
- ide.UpdateCompilerConfigs();
+ ide.UpdateCompilerConfigs(true);
break;
}
}
// Compile actual file
// Execute
ToolButton buttonRun { this, toolTip = $"Run", menuItemPtr = IDEItem(projectRunItem), disabled = true; };
+#ifdef IDE_SHOW_INSTALL_MENU_BUTTON
+ ToolButton buttonInstall { this, toolTip = $"Install", menuItemPtr = IDEItem(projectInstallItem), disabled = true; };
+#endif
ToolSeparator separator4 { this };
DropBox activeConfig
{
- this, toolTip = $"Active Configuration(s)", size = { 160 };
+ this, toolTip = $"Active Configuration(s)", size = { 160 }, disabled = true;
bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
{
if(row)
- {
- for(prj : ide.workspace.projects)
- {
- for(cfg : prj.configurations)
- {
- if(cfg.name && !strcmp(cfg.name, row.string))
- {
- prj.config = cfg;
- break;
- }
- }
- }
- ide.UpdateToolBarActiveConfigs(true);
- ide.projectView.Update(null);
- }
+ ide.workspace.SelectActiveConfig(row.string);
return true;
}
};
DropBox activeCompiler
{
- this, toolTip = $"Active Compiler", size = { 160 };
+ this, toolTip = $"Active Compiler", size = { 160 }, disabled = true;
bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
{
- if(row && strcmp(row.string, ide.workspace.compiler))
+ if(ide.workspace && ide.projectView && row && strcmp(row.string, ide.workspace.compiler))
{
+ bool silent = ide.projectView.buildInProgress == none ? false : true;
CompilerConfig compiler = ideSettings.GetCompilerConfig(row.string);
ide.workspace.compiler = row.string;
- ide.projectView.ShowOutputBuildLog(true);
- ide.projectView.DisplayCompiler(compiler, false);
+ ide.projectView.ShowOutputBuildLog(!silent);
+ if(!silent)
+ ide.projectView.DisplayCompiler(compiler, false);
for(prj : ide.workspace.projects)
- ide.projectView.ProjectPrepareCompiler(prj, compiler);
+ ide.projectView.ProjectPrepareCompiler(prj, compiler, silent);
+ delete compiler;
+ ide.workspace.Save();
+ }
+ return true;
+ }
+ };
+
+ DropBox activeBitDepth
+ {
+ this, toolTip = $"Active Bit Depth", size = { 60 }, disabled = true;
+ bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
+ {
+ if(ide.workspace && ide.projectView && row)
+ {
+ bool silent = ide.projectView.buildInProgress == none ? false : true;
+ CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
+ ide.workspace.bitDepth = (int)row.tag;
+ ide.projectView.ShowOutputBuildLog(!silent);
+ if(!silent)
+ ide.projectView.DisplayCompiler(compiler, false);
+ for(prj : ide.workspace.projects)
+ ide.projectView.ProjectPrepareCompiler(prj, compiler, silent);
delete compiler;
ide.workspace.Save();
}
Window spacer7 { this, size = { 4 } };
+ void IDEToolbar()
+ {
+ DataRow row;
+ row = activeBitDepth.AddString("Auto");
+ row.tag = 0;
+ activeBitDepth.AddString("32 bit").tag = 32;
+ activeBitDepth.AddString("64 bit").tag = 64;
+ activeBitDepth.currentRow = row;
+ }
+
}
class IDEMainFrame : Window
MenuItem * driverItems, * skinItems;
StatusField pos { width = 150 };
StatusField ovr, caps, num;
+ DualPipe documentor;
BitmapResource back { ":ecereBack.jpg", window = this };
BitmapResource bmpBp { ":codeMarks/breakpoint.png", window = this };
{
parent = this;
- void OnGotoError(char * line)
+ void OnGotoError(char * line, bool noParsing)
{
- ide.GoToError(line);
+ ide.GoToError(line, noParsing);
}
void OnCodeLocationParseAndGoTo(char * line)
switch(key)
{
case escape:
- if(!ide.findInFilesDialog || !ide.findInFilesDialog.SearchAbort())
+ if(activeBox != findBox || !ide.findInFilesDialog || !ide.findInFilesDialog.SearchAbort())
ide.ShowCodeEditor();
break;
- case ctrlS:
- ide.projectView.stopBuild = true;
- break;
default:
{
OutputView::OnKeyDown(key, ch);
return true;
}
- bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
- {
- if(active)
- ide.RepositionWindows(false);
- return true;
- }
-
bool OnClose(bool parentClosing)
{
visible = false;
{
parent = this, font = { panelFont.faceName, panelFont.size };
- void OnGotoLine(char * line)
- {
- int stackLvl;
- stackLvl = atoi(line);
- ide.debugger.GoToStackFrameLine(stackLvl, true);
- }
-
- void OnSelectFrame(int lineNumber)
+ void OnSelectFrame(int frameIndex)
{
- ide.debugger.SelectFrame(lineNumber);
+ ide.debugger.GoToStackFrameLine(frameIndex, true);
+ if(frameIndex >= 0)
+ ide.debugger.SelectFrame(frameIndex);
}
void OnToggleBreakpoint()
return true;
}
- bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
- {
- if(active)
- ide.RepositionWindows(false);
- return true;
- }
-
bool OnClose(bool parentClosing)
{
visible = false;
return true;
}
- bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
- {
- if(active)
- ide.RepositionWindows(false);
- return true;
- }
-
bool OnClose(bool parentClosing)
{
visible = false;
for(c = 0; c < numSelections; c++)
{
- if(OpenFile(multiFilePaths[c], normal, true, fileTypes[ideFileDialog.fileType].typeExtension, no, normal))
+ if(OpenFile(multiFilePaths[c], normal, true, fileTypes[ideFileDialog.fileType].typeExtension, no, normal, mods.ctrl && mods.shift))
gotWhatWeWant = true;
}
if(gotWhatWeWant ||
{
if(!projectView && gotWhatWeWant)
ChangeFileDialogsDirectory(ideFileDialog.currentDirectory, true);
+ ide.RepositionWindows(false);
break;
}
}
MenuDivider { fileMenu };
MenuItem exitItem
{
- fileMenu, $"Exit", x, altF4, NotifySelect = MenuFileExit;
+ fileMenu, $"Exit", x, altF4;
bool NotifySelect(MenuItem selection, Modifiers mods)
{
{
if(id == selection.id)
{
- if(mods.ctrl) // Menu::OnLeftButtonUp -> modifiers.ctrl == true, modifiers == 18
- // Menu::MenuItemSelection -> key.ctrl == false, key.modifiers.ctrl == false, key == 18
- // removing the (Key) cast from Modifiers when calling MenuItemSelection in OnLeftButtonUp didn't help
+ bool isProjectFile;
+ char extension[MAX_EXTENSION] = "";
+ GetExtension(file, extension);
+ isProjectFile = (!strcmpi(extension, "epj") || !strcmpi(extension, "ews"));
+ if(mods.ctrl)
{
- // it never gets in here!!!
- char * command = PrintString("ide ", file);
+ char * command = PrintString("ide ", isProjectFile ? "-t " : "", file);
Execute(command);
delete command;
}
else
- OpenFile(file, normal, true, null, no, normal);
+ {
+ OpenFile(file, normal, true, isProjectFile ? "txt" : null, no, normal, mods.ctrl && mods.shift);
+ ide.RepositionWindows(false);
+ }
break;
}
id++;
{
if(id == selection.id)
{
- if(mods.ctrl) // Menu::OnLeftButtonUp -> modifiers.ctrl == true, modifiers == 18
- // Menu::MenuItemSelection -> key.ctrl == false, key.modifiers.ctrl == false, key == 18
- // removing the (Key) cast from Modifiers when calling MenuItemSelection in OnLeftButtonUp didn't help
+ if(mods.ctrl)
{
- // it never gets in here!!!
char * command = PrintString("ide ", file);
Execute(command);
delete command;
}
else
- OpenFile(file, normal, true, null, no, normal);
+ OpenFile(file, normal, true, null, no, normal, mods.ctrl && mods.shift);
break;
}
id++;
bool NotifySelect(MenuItem selection, Modifiers mods)
{
if(!DontTerminateDebugSession($"New Project"))
- if(MenuWindowCloseAll(null, 0))
+ {
+ DialogResult result;
+ NewProjectDialog newProjectDialog { master = this };
+ incref newProjectDialog;
+ result = newProjectDialog.Modal();
+ if(result == ok)
{
- NewProjectDialog newProjectDialog;
-
- if(projectView)
+ if(ProjectClose())
{
- projectView.visible = false;
- if(!projectView.Destroy(0))
- return true;
- }
-
- newProjectDialog = { master = this };
- newProjectDialog.Modal();
- if(projectView)
- {
- ideSettings.AddRecentProject(projectView.fileName);
- ide.UpdateRecentMenus();
- settingsContainer.Save();
+ newProjectDialog.CreateNewProject();
+ if(projectView)
+ {
+ ideSettings.AddRecentProject(projectView.fileName);
+ ide.UpdateRecentMenus();
+ settingsContainer.Save();
+ }
}
}
+ delete newProjectDialog;
+ }
return true;
}
}
ideProjectFileDialog.text = openProjectFileDialogTitle;
if(ideProjectFileDialog.Modal() == ok)
{
- OpenFile(ideProjectFileDialog.filePath, normal, true, projectTypes[ideProjectFileDialog.fileType].typeExtension, no, normal);
+ OpenFile(ideProjectFileDialog.filePath, normal, true, projectTypes[ideProjectFileDialog.fileType].typeExtension, no, normal, mods.ctrl && mods.shift);
//ChangeProjectFileDialogDirectory(ideProjectFileDialog.currentDirectory);
}
return true;
{
if(ideProjectFileDialog.Modal() == ok)
{
- if(OpenFile(ideProjectFileDialog.filePath, normal, true, projectTypes[ideProjectFileDialog.fileType].typeExtension, no, add))
+ if(OpenFile(ideProjectFileDialog.filePath, normal, true, projectTypes[ideProjectFileDialog.fileType].typeExtension, no, add, mods.ctrl && mods.shift))
break;
if(MessageBox { type = yesNo, master = this, text = $"Error opening project file",
contents = $"Add a different project?" }.Modal() == no)
if(projectView)
{
if(!ide.DontTerminateDebugSession($"Project Close"))
- {
- if(findInFilesDialog)
- findInFilesDialog.SearchStop();
- projectView.visible = false;
- if(projectView.Destroy(0))
- MenuWindowCloseAll(null, 0);
- {
- char workingDir[MAX_LOCATION];
- GetWorkingDir(workingDir, MAX_LOCATION);
- findInFilesDialog.currentDirectory = workingDir;
- ideMainFrame.text = titleECEREIDE;
- }
- }
+ ProjectClose();
}
return true;
}
bool NotifySelect(MenuItem selection, Modifiers mods)
{
if(projectView)
- projectView.ProjectBuild(projectView.active ? selection : null, mods);
+ {
+ if(projectView.buildInProgress == none)
+ projectView.ProjectBuild(projectView.active ? selection : null, mods);
+ else
+ projectView.stopBuild = true;
+ }
return true;
}
}
return true;
}
}
+ MenuItem projectCleanTargetItem
+ {
+ projectMenu, $"Clean Target", g, disabled = true;
+ bitmap = { ":actions/clean.png" };
+ bool NotifySelect(MenuItem selection, Modifiers mods)
+ {
+ if(projectView)
+ {
+ debugger.Stop();
+ projectView.ProjectCleanTarget(projectView.active ? selection : null, mods);
+ }
+ return true;
+ }
+ }
MenuItem projectCleanItem
{
projectMenu, $"Clean", e, disabled = true;
return true;
}
}
+ MenuItem projectInstallItem
+ {
+#ifdef IDE_SHOW_INSTALL_MENU_BUTTON
+ projectMenu, $"Install", t, disabled = true;
+#endif
+ bitmap = { ":status/software-update-available.png" };
+ bool NotifySelect(MenuItem selection, Modifiers mods)
+ {
+ if(projectView)
+ projectView.ProjectInstall(projectView.active ? selection : null, mods);
+ return true;
+ }
+ }
MenuItem projectCompileItem;
Menu debugMenu { menu, $"Debug", d, hasMargin = true };
MenuItem debugStartResumeItem
bitmap = { ":actions/pause.png" };
bool NotifySelect(MenuItem selection, Modifiers mods)
{
+ if(projectView && projectView.buildInProgress != none)
+ return true;
if(projectView)
projectView.DebugBreak();
return true;
return true;
}
}
+#ifndef __WIN32__
+ MenuDivider { debugMenu };
+ MenuItem debugUseValgrindItem
+ {
+ debugMenu, $"Use Valgrind", d, disabled = true, checkable = true;
+ bool NotifySelect(MenuItem selection, Modifiers mods)
+ {
+ if(ide.workspace)
+ {
+ ide.workspace.useValgrind = selection.checked;
+ ide.workspace.Save();
+ }
+ 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; }
+ bool ValgrindLCSelect(MenuItem selection, Modifiers mods)
+ {
+ if(ide.workspace)
+ {
+ if(selection.checked)
+ {
+ ValgrindLeakCheck vgLeakCheck = (ValgrindLeakCheck)selection.id;
+
+ debugValgrindNoLeakCheckItem.checked = debugValgrindNoLeakCheckItem.id == vgLeakCheck;
+ debugValgrindSummaryLeakCheckItem.checked = debugValgrindSummaryLeakCheckItem.id == vgLeakCheck;
+ debugValgrindYesLeakCheckItem.checked = debugValgrindYesLeakCheckItem.id == vgLeakCheck;
+ debugValgrindFullLeakCheckItem.checked = debugValgrindFullLeakCheckItem.id == vgLeakCheck;
+
+ ide.workspace.vgLeakCheck = vgLeakCheck;
+ ide.workspace.Save();
+ }
+ else
+ selection.checked = true;
+ }
+ return true;
+ }
+ Menu debugValgrindRedzoneSizeItem { debugMenu, $"Valgrind Redzone Size", z };
+ MenuItem debugValgrindRS0Item { debugValgrindRedzoneSizeItem, $"0" , f, id = 0, checkable = true, disabled = true; NotifySelect = ValgrindRSSelect, checked = true; }
+ 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)
+ {
+ if(selection.checked)
+ {
+ int vgRedzoneSize = (int)selection.id;
+
+ debugValgrindRS0Item.checked = debugValgrindRS0Item.id == vgRedzoneSize;
+ debugValgrindRS16Item.checked = debugValgrindRS16Item.id == vgRedzoneSize;
+ debugValgrindRS32Item.checked = debugValgrindRS32Item.id == vgRedzoneSize;
+ debugValgrindRS64Item.checked = debugValgrindRS64Item.id == vgRedzoneSize;
+ debugValgrindRS128Item.checked = debugValgrindRS128Item.id == vgRedzoneSize;
+ debugValgrindRS256Item.checked = debugValgrindRS256Item.id == vgRedzoneSize;
+ debugValgrindRS512Item.checked = debugValgrindRS512Item.id == vgRedzoneSize;
+
+ ide.workspace.vgRedzoneSize = vgRedzoneSize;
+ ide.workspace.Save();
+ }
+ else
+ selection.checked = true;
+ }
+ return true;
+ }
+ MenuItem debugValgrindTrackOriginsItem
+ {
+ debugMenu, $"Valgrind Track Origins", k, checkable = true, disabled = true;
+ bool NotifySelect(MenuItem selection, Modifiers mods)
+ {
+ if(ide.workspace)
+ {
+ ide.workspace.vgTrackOrigins = selection.checked;
+ ide.workspace.Save();
+ }
+ return true;
+ }
+ };
+#endif
MenuDivider { debugMenu };
MenuItem debugStepIntoItem
{
}
}
MenuPlacement debugSkipRunToCursorItem { debugMenu, $"Run To Cursor Skipping Breakpoints", u };
+ MenuPlacement debugSkipRunToCursorAtSameLevelItem { debugMenu, $"Run To Cursor At Same Level Skipping Breakpoints", l };
//MenuDivider { debugMenu };
//MenuPlacement debugToggleBreakpoint { debugMenu, "Toggle Breakpoint", t };
MenuPlacement imageMenu { menu, $"Image", i };
viewMenu, $"Color Picker...", c, Key { c, ctrl = true , shift = true };
bool NotifySelect(MenuItem selection, Modifiers mods)
{
- ColorPicker colorPicker { master = this, parent = this, stayOnTop = true };
- colorPicker.Create();
+ ColorPicker colorPicker { master = this };
+ colorPicker.Modal();
return true;
}
}
helpMenu, $"API Reference", r, f1;
bool NotifySelect(MenuItem selection, Modifiers mods)
{
- Execute("documentor");
+ if(!documentor)
+ {
+ char * p = new char[MAX_LOCATION];
+ p[0] = '\0';
+ strncpy(p, settingsContainer.moduleLocation, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
+ PathCat(p, "documentor");
+ #if defined(__WIN32__)
+ ChangeExtension(p, "exe", p);
+ #endif
+ if(!FileExists(p).isFile)
+ strcpy(p, "documentor");
+
+ documentor = DualPipeOpen({ input = true, output = true, showWindow = true }, p);
+ delete p;
+ }
+ else
+ {
+ Process_ShowWindows(documentor.GetProcessID());
+ // documentor.Puts("Activate\n");
+ }
+ return true;
+ }
+ }
+ MenuDivider { helpMenu };
+ MenuItem
+ {
+ helpMenu, $"Ecere Tao of Programming [work in progress]", t;
+ bool NotifySelect(MenuItem selection, Modifiers mods)
+ {
+ FindAndShellOpenInstalledFile("doc", "Ecere Tao of Programming [work in progress].pdf");
+ return true;
+ }
+ }
+ MenuDivider { helpMenu };
+ MenuItem
+ {
+ helpMenu, $"Documentation Folder", d;
+ bool NotifySelect(MenuItem selection, Modifiers mods)
+ {
+ FindAndShellOpenInstalledFolder("doc");
+ return true;
+ }
+ }
+ MenuItem
+ {
+ helpMenu, $"Samples Folder", s;
+ bool NotifySelect(MenuItem selection, Modifiers mods)
+ {
+ FindAndShellOpenInstalledFolder("samples");
+ return true;
+ }
+ }
+ MenuItem
+ {
+ helpMenu, $"Extras Folder", x;
+ bool NotifySelect(MenuItem selection, Modifiers mods)
+ {
+ FindAndShellOpenInstalledFolder("extras");
+ return true;
+ }
+ }
+ MenuDivider { helpMenu };
+ MenuItem
+ {
+ helpMenu, $"Community Forums", f;
+ bool NotifySelect(MenuItem selection, Modifiers mods)
+ {
+ ShellOpen("http://ecere.com/forums");
return true;
}
}
FindInFilesDialog findInFilesDialog
{
- master = this, parent = this;
+ master = this,
filters = findInFilesFileFilters.array, sizeFilters = findInFilesFileFilters.count * sizeof(FileFilter);
filter = 1;
};
+ bool noParsing;
+
#ifdef GDB_DEBUG_GUI
GDBDialog gdbDialog
{
master = this, parent = this;
- anchor = { left = 100, top = 100, right = 100, bottom = 100 };
+ //anchor = { left = 100, top = 100, right = 100, bottom = 100 };
void OnCommand(char * string)
{
return projectView;
}
- bool GetDebugMenusDisabled()
+ bool ProjectClose()
{
- if(projectView)
+ projectView.visible = false;
+ if((!projectView || projectView.created == false || projectView.Destroy(0)) && MenuWindowCloseAll(null, 0))
{
- Project project = projectView.project;
- if(project)
- if(project.GetTargetType(project.config) == executable)
- return false;
-
+ if(findInFilesDialog)
+ {
+ char workingDir[MAX_LOCATION];
+ GetWorkingDir(workingDir, MAX_LOCATION);
+ findInFilesDialog.SearchStop();
+ findInFilesDialog.currentDirectory = workingDir;
+ }
+ ideMainFrame.text = titleECEREIDE;
+ ide.AdjustMenus();
+ return true;
}
- return true;
+ return false;
}
void RepositionWindows(bool expand)
anchor.bottom = bottomDistance;
if(child._class == class(CodeEditor) || child._class == class(Designer))
{
+ anchor.left = 300;
anchor.right = toolBoxVisible ? 150 : 0;
}
child.anchor = anchor;
return false;
}
- bool ShouldStopBuild()
- {
- return projectView.stopBuild;
- }
-
void DocumentSaved(Window document, char * fileName)
{
ideSettings.AddRecentFile(fileName);
if(MessageBox { 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;
char * fileName = CopyString(this.fileName);
WindowState state = this.state;
Anchor anchor = this.anchor;
this.modifiedDocument = false;
this.Destroy(0);
- this = ide.OpenFile(fileName, normal, true, null, no, normal);
+ this = ide.OpenFile(fileName, normal, true, null, no, normal, noParsing);
if(this)
{
this.anchor = anchor;
}
}
- void UpdateCompilerConfigs()
+ void UpdateCompilerConfigs(bool mute)
{
UpdateToolBarActiveCompilers();
if(workspace)
{
+ bool silent = mute || (ide.projectView.buildInProgress == none ? false : true);
CompilerConfig compiler = ideSettings.GetCompilerConfig(workspace.compiler);
- projectView.ShowOutputBuildLog(true);
- projectView.DisplayCompiler(compiler, false);
+ if(!silent)
+ {
+ projectView.ShowOutputBuildLog(true);
+ projectView.DisplayCompiler(compiler, false);
+ }
for(prj : workspace.projects)
- projectView.ProjectPrepareCompiler(prj, compiler);
+ projectView.ProjectPrepareCompiler(prj, compiler, silent);
delete compiler;
}
}
if(workspace && workspace.compiler && !strcmp(compiler.name, workspace.compiler))
toolBar.activeCompiler.currentRow = row;
}
- if(!toolBar.activeCompiler.currentRow)
- toolBar.activeCompiler.currentRow = toolBar.activeCompiler.firstRow;
- toolBar.activeCompiler.disabled = workspace == null;
+ if(!toolBar.activeCompiler.currentRow && toolBar.activeCompiler.firstRow)
+ toolBar.activeCompiler.SelectRow(toolBar.activeCompiler.firstRow);
}
void UpdateToolBarActiveConfigs(bool selectionOnly)
else
{
toolBar.activeConfig.Clear();
- row = toolBar.activeConfig.AddString("(Mixed)");
+ row = toolBar.activeConfig.AddString($"(Mixed)");
row.tag = 1;
}
if(workspace)
toolBar.activeConfig.Sort(null, 0);
if(!commonSelected)
toolBar.activeConfig.currentRow = row;
- toolBar.activeConfig.disabled = workspace == null;
}
void AdjustMenus()
viewProjectItem.disabled = unavailable;
+ toolBar.activeConfig.disabled = unavailable;
+ toolBar.activeCompiler.disabled = unavailable;
+ toolBar.activeBitDepth.disabled = unavailable;
+
+#ifndef __WIN32__
+ debugUseValgrindItem.disabled = unavailable;
+ AdjustValgrindMenus();
+#endif
+
AdjustFileMenus();
AdjustBuildMenus();
AdjustDebugMenus();
}
+#ifndef __WIN32__
+ void AdjustValgrindMenus()
+ {
+ bool unavailable = !project || !debugUseValgrindItem.checked;
+ debugValgrindNoLeakCheckItem.disabled = unavailable;
+ debugValgrindSummaryLeakCheckItem.disabled = unavailable;
+ debugValgrindYesLeakCheckItem.disabled = unavailable;
+ debugValgrindFullLeakCheckItem.disabled = unavailable;
+
+ debugValgrindTrackOriginsItem.disabled = unavailable;
+
+ debugValgrindRS0Item.disabled = unavailable;
+ debugValgrindRS16Item.disabled = unavailable;
+ debugValgrindRS32Item.disabled = unavailable;
+ debugValgrindRS64Item.disabled = unavailable;
+ debugValgrindRS128Item.disabled = unavailable;
+ debugValgrindRS256Item.disabled = unavailable;
+ debugValgrindRS512Item.disabled = unavailable;
+ }
+#endif
+
property bool hasOpenedCodeEditors
{
get
void AdjustBuildMenus()
{
bool unavailable = project && projectView.buildInProgress;
+ bool naForRun = unavailable || !project || project.GetTargetType(project.config) != executable;
projectNewItem.disabled = unavailable;
toolBar.buttonNewProject.disabled = unavailable;
projectCloseItem.disabled = unavailable;
// toolBar.buttonCloseProject.disabled = unavailable;
- projectRunItem.disabled = unavailable || project.GetTargetType(project.config) != executable;
- toolBar.buttonRun.disabled = unavailable || project.GetTargetType(project.config) != executable;
- projectBuildItem.disabled = unavailable;
- toolBar.buttonBuild.disabled = unavailable;
+ projectRunItem.disabled = naForRun;
+ toolBar.buttonRun.disabled = naForRun;
+
+ projectBuildItem.disabled = false;
+ projectBuildItem.text = unavailable ? $"Stop Build" : $"Build";
+ projectBuildItem.accelerator = unavailable ? Key { pauseBreak, ctrl = true } : f7;
+
projectLinkItem.disabled = unavailable;
toolBar.buttonReLink.disabled = unavailable;
projectRebuildItem.disabled = unavailable;
toolBar.buttonRebuild.disabled = unavailable;
projectCleanItem.disabled = unavailable;
toolBar.buttonClean.disabled = unavailable;
+ projectCleanTargetItem.disabled = unavailable;
projectRealCleanItem.disabled = unavailable;
// toolBar.buttonRealClean.disabled = unavailable;
projectRegenerateItem.disabled = unavailable;
toolBar.buttonRegenerateMakefile.disabled = unavailable;
+#ifdef IDE_SHOW_INSTALL_MENU_BUTTON
+ projectInstallItem.disabled = unavailable;
+ toolBar.buttonInstall.disabled = unavailable;
+#endif
projectCompileItem.disabled = unavailable;
+ AdjustPopupBuildMenus();
+ }
+
+ void AdjustPopupBuildMenus()
+ {
+ bool unavailable = !project || projectView.buildInProgress;
+
if(projectView && projectView.popupMenu && projectView.popupMenu.menu && projectView.popupMenu.created)
{
MenuItem menu;
- menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectBuild, 0); if(menu) menu.disabled = unavailable;
+ menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectBuild, 0);
+ if(menu)
+ {
+ menu.disabled = false;
+ menu.text = unavailable ? $"Stop Build" : $"Build";
+ 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;
}
}
+ property bool areDebugMenusUnavailable { get {
+ return !project ||
+ project.GetTargetType(project.config) != executable ||
+ projectView.buildInProgress == buildingMainProject;
+ } }
+
+ property bool isBreakpointTogglingUnavailable { get {
+ return !project;
+ } }
+
+ property bool isDebuggerExecuting { get {
+ if(!ide.debugger)
+ return false;
+ else
+ return ide.debugger.state == running;
+ } }
+
void AdjustDebugMenus()
{
- bool unavailable = !project || project.GetTargetType(project.config) != executable ||
- projectView.buildInProgress == buildingMainProject;
- bool active = ide.debugger.isActive;
- bool executing = ide.debugger.state == running;
- //bool holding = ide.debugger.state == stopped;
+ bool unavailable = areDebugMenusUnavailable;
+ bool active = debugger.isActive;
+ bool bpNoToggle = isBreakpointTogglingUnavailable;
+ bool executing = isDebuggerExecuting;
+ //bool holding = debugger.state == stopped;
debugStartResumeItem.disabled = unavailable || executing;
debugStartResumeItem.text = active ? $"Resume" : $"Start";
{
CodeEditor codeEditor = ((Designer)GetActiveDesigner()).codeEditor;
if(codeEditor)
- {
- codeEditor.debugRunToCursor.disabled = unavailable || executing;
- codeEditor.debugSkipRunToCursor.disabled = unavailable || executing;
- }
+ codeEditor.AdjustDebugMenus(unavailable, bpNoToggle, executing);
}
}
return false;
}
- Window OpenFile(char * origFilePath, WindowState state, bool visible, char * type, OpenCreateIfFails createIfFails, OpenMethod openMethod)
+ Window OpenFile(char * origFilePath, WindowState state, bool visible, char * type, OpenCreateIfFails createIfFails, OpenMethod openMethod, bool noParsing)
{
char extension[MAX_EXTENSION] = "";
Window document = null;
if(DontTerminateDebugSession($"Open Project"))
return null;
isProject = true;
- if(MenuWindowCloseAll(null, 0))
+ if(ProjectClose())
{
- if(projectView)
- {
- projectView.visible = false;
- projectView.Destroy(0);
- // Where did this come from? projectView = null;
- }
if(!projectView)
{
for(;;)
return null;
//project = LoadProject(filePath, null);
}
-
+
if(workspace)
{
char absolutePath[MAX_LOCATION];
ide.projectView.DisplayCompiler(compiler, false);
delete compiler;
}
- UpdateCompilerConfigs();
+ UpdateCompilerConfigs(false);
UpdateMakefiles();
{
char newWorkingDir[MAX_LOCATION];
{
if(ofi.state != closed)
{
- Window file = OpenFile(ofi.path, normal, true, null, no, normal);
+ Window file = OpenFile(ofi.path, normal, true, null, no, normal, noParsing);
if(file)
{
char fileName[MAX_LOCATION];
}
}
}
+ ide.RepositionWindows(false);
workspace.holdTracking = false;
workspace.timer.Start();
prj = LoadProject(filePath, null);
if(prj)
{
+ char * activeConfigName = null;
CompilerConfig compiler = ideSettings.GetCompilerConfig(workspace.compiler);
prj.StartMonitoring();
workspace.projects.Add(prj);
+ if(toolBar.activeConfig.currentRow && toolBar.activeConfig.currentRow != toolBar.activeConfig.firstRow &&
+ toolBar.activeConfig.currentRow.string && toolBar.activeConfig.currentRow.string[0])
+ activeConfigName = toolBar.activeConfig.currentRow.string;
+ if(activeConfigName)
+ {
+ for(cfg : prj.configurations)
+ {
+ if(cfg.name && !strcmp(cfg.name, activeConfigName))
+ {
+ prj.config = cfg;
+ break;
+ }
+ }
+ }
if(projectView)
projectView.AddNode(prj.topNode, null);
workspace.modified = true;
!strcmp(extension, "css") || !strcmp(extension, "php") ||
!strcmp(extension, "js"))
{
- CodeEditor editor { parent = this, state = state, visible = false };
+ CodeEditor editor { parent = this, state = state, visible = false, noParsing = noParsing };
editor.updatingCode = true;
if(editor.LoadFile(filePath))
{
}
else
{
- CodeEditor editor { parent = this, state = state, visible = false };
+ CodeEditor editor { parent = this, state = state, visible = false, noParsing = noParsing };
if(editor.LoadFile(filePath))
{
document = editor;
return true;
}
- void GoToError(const char * line)
+ void GoToError(const char * line, bool noParsing)
{
if(projectView)
- projectView.GoToError(line);
+ projectView.GoToError(line, noParsing);
}
void CodeLocationParseAndGoTo(const char * text, Project project, const char * dir)
{
+ char *s = null;
char *path = text;
char *colon = strchr(text, ':');
- char filePath[MAX_LOCATION];
+ char filePath[MAX_LOCATION] = "";
char completePath[MAX_LOCATION];
int line = 0, col = 0;
+ int len = strlen(text);
Project prj = null;
FileAttribs fileAttribs;
- if(colon && (colon[1] == '/' || colon[1] == '\\'))
+ // support for valgrind output
+ if((s = strstr(text, "==")) && (s = strstr(s+2, "==")) && (s = strstr(s+2, ":")) && (s = strstr(s+1, ":")))
{
- path = (colon - 1 > path) ? colon - 1 : path;
- colon = strstr(colon + 1, ":");
+ colon = s;
+ for(; s>text; s--)
+ {
+ if(*s == '(')
+ {
+ path = s+1;
+ break;
+ }
+ }
+ /*for(s=colon; *s; s++)
+ {
+ if(*s == ')')
+ {
+ *s = '\0';;
+ break;
+ }
+ }*/
+ //*colon = '\0';
+ //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)
+ {
+ path = s+1;
+ }
+ else
+ {
+ if(colon && (colon[1] == '/' || colon[1] == '\\'))
+ {
+ path = (colon - 1 > path) ? colon - 1 : path;
+ colon = strstr(colon + 1, ":");
+ }
+ if(*path == '*' && (s = strchr(path+1, '*')))
+ path = s+1;
+ while(isspace(*path)) path++;
}
- while(isspace(*path)) path++;
if(*path == '(')
{
char * close = strchr(path, ')');
strcpy(filePath, path);
}
- if(prj)
- strcpy(completePath, prj.topNode.path);
- else if(dir && dir[0])
- strcpy(completePath, dir);
- else
- completePath[0] = '\0';
- PathCat(completePath, filePath);
+ 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;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
- fileAttribs = FileExists(completePath);
+ void CodeLocationGoTo(const char * path, const FileAttribs fileAttribs, int line, int col)
+ {
if(fileAttribs.isFile)
{
- CodeEditor codeEditor = (CodeEditor)OpenFile(completePath, normal, true, "", no, normal);
- if(codeEditor && line)
+ char ext[MAX_EXTENSION];
+ GetExtension(path, ext);
+ if(!strcmp(ext, "mp3") || !strcmp(ext, "flac") || !strcmp(ext, "ogg") || !strcmp(ext, "avi") || !strcmp(ext, "mkv"))
+ ShellOpen(path);
+ else if(!strcmp(ext, "a") || !strcmp(ext, "o") || !strcmp(ext, "lib") || !strcmp(ext, "dll") || !strcmp(ext, "exe"))
{
- EditBox editBox = codeEditor.editBox;
- editBox.GoToLineNum(line - 1);
- editBox.GoToPosition(editBox.line, line - 1, col ? (col - 1) : 0);
+ char dirPath[MAX_LOCATION];
+ StripLastDirectory(path, dirPath);
+ ShellOpen(dirPath);
+ }
+ else
+ {
+ CodeEditor codeEditor = (CodeEditor)OpenFile(path, normal, true, ext, no, normal, false);
+ if(codeEditor && line)
+ {
+ EditBox editBox = codeEditor.editBox;
+ editBox.GoToLineNum(line - 1);
+ editBox.GoToPosition(editBox.line, line - 1, col ? (col - 1) : 0);
+ }
}
}
else if(fileAttribs.isDirectory)
- ShellOpen(completePath);
+ ShellOpen(path);
}
void OnRedraw(Surface surface)
caps = { width = 40, text = $"CAPS", color = app.GetKeyState(capsState) ? black : Color { 128, 128, 128 } };
statusBar.AddField(caps);
- ovr = { width = 30, text = $"OVR", color = editBox.overwrite ? black : Color { 128, 128, 128 } };
+ ovr = { width = 30, text = $"OVR", color = (editBox && editBox.overwrite) ? black : Color { 128, 128, 128 } };
statusBar.AddField(ovr);
num = { width = 30, text = $"NUM", color = app.GetKeyState(numState) ? black : Color { 128, 128, 128 } };
if(projectView && projectView.project)
{
- ProjectNode node = projectView.GetNodeFromWindow(client, null);
+ bool isCObject = false;
+ ProjectNode node = projectView.GetNodeFromWindow(client, null, false);
+ if(!node && (node = projectView.GetNodeFromWindow(client, null, true)))
+ isCObject = true;
if(node)
{
- char name[1024];
- sprintf(name, $"Compile %s", node.name);
+ char nodeName[MAX_FILENAME];
+ char name[MAX_FILENAME+96];
+ if(isCObject)
+ ChangeExtension(node.name, "c", nodeName);
+ sprintf(name, $"Compile %s", isCObject ? nodeName : node.name);
projectCompileItem =
{
copyText = true, text = name, c, ctrlF7, disabled = projectView.buildInProgress;
if(projectView)
{
bool result = false;
+ bool isCObject = false;
ProjectNode node = null;
for(p : ide.workspace.projects)
{
- node = projectView.GetNodeFromWindow(activeClient, p);
- //if(node && projectView.Compile(node.project, node, mods.ctrl && mods.shift))
- if(node)
- {
- List<ProjectNode> nodes { };
- nodes.Add(node);
- projectView.Compile(node.project, nodes, mods.ctrl && mods.shift, normal);
- delete nodes;
-
- result = true;
- break;
- }
+ node = projectView.GetNodeFromWindow(activeClient, p, false);
+ if(node) break;
+ }
+ if(!node && (node = projectView.GetNodeFromWindow(activeClient, null, true)))
+ isCObject = true;
+ if(node)
+ {
+ List<ProjectNode> nodes { };
+ nodes.Add(node);
+ projectView.Compile(node.project, nodes, mods.ctrl && mods.shift, isCObject ? cObject : normal);
+ delete nodes;
+ result = true;
}
if(!result && node)
ide.outputView.buildBox.Logf($"File %s is excluded from current build configuration.\n", node.name);
int c;
bool passThrough = false;
bool debugStart = false;
+ bool debugWorkDir = false;
+ char * passDebugWorkDir = null;
+ bool openAsText = false;
DynamicString passArgs { };
+ int ptArg = 0;
+
for(c = 1; c<app.argc; c++)
{
- if(!strcmp(app.argv[c], "-debug-start"))
- debugStart = true;
- else if(!passThrough && !strcmp(app.argv[c], "-@"))
- passThrough = true;
- else if(passThrough)
+ if(passThrough)
{
- passArgs.concat(" ");
- passArgs.concat(app.argv[c]);
+ char * arg = app.argv[c];
+ char * buf = new char[strlen(arg)*2+1];
+ if(ptArg++ > 0)
+ passArgs.concat(" ");
+ PassArg(buf, arg);
+ passArgs.concat(buf);
+ delete buf;
}
+ else if(debugWorkDir)
+ {
+ passDebugWorkDir = CopyString(app.argv[c]);
+ StripQuotes(passDebugWorkDir, passDebugWorkDir);
+ debugWorkDir = false;
+ }
+ else if(!strcmp(app.argv[c], "-t"))
+ openAsText = true;
+ else if(!strcmp(app.argv[c], "-no-parsing"))
+ ide.noParsing = true;
+ else if(!strcmp(app.argv[c], "-debug-start"))
+ debugStart = true;
+ else if(!strcmp(app.argv[c], "-debug-work-dir"))
+ debugWorkDir = true;
+ else if(!strcmp(app.argv[c], "-@"))
+ passThrough = true;
else
{
char fullPath[MAX_LOCATION];
PathCat(fullPath, app.argv[c]);
StripLastDirectory(fullPath, parentPath);
GetExtension(app.argv[c], ext);
- isProject = !strcmpi(ext, "epj");
+ isProject = !openAsText && !strcmpi(ext, "epj");
if(isProject && c > (debugStart ? 2 : 1)) continue;
{
if(isProject && !FileExists(fullPath))
{
- // The NewProject will handle directory creation
- /*if(!dirAttribs.isDirectory)
+ char name[MAX_LOCATION];
+ NewProjectDialog newProjectDialog;
+
+ if(projectView)
{
- MakeDir(parentPath);
- dirAttribs = FileExists(parentPath);
+ projectView.visible = false;
+ if(!projectView.Destroy(0))
+ return true;
}
- if(dirAttribs.isDirectory)*/
- {
- char name[MAX_LOCATION];
- NewProjectDialog newProjectDialog;
-
- if(projectView)
- {
- projectView.visible = false;
- if(!projectView.Destroy(0))
- return true;
- }
- newProjectDialog = { master = this };
+ newProjectDialog = { master = this };
- strcpy(name, app.argv[c]);
- StripExtension(name);
- GetLastDirectory(name, name);
- newProjectDialog.projectName.contents = name;
- newProjectDialog.projectName.NotifyModified(newProjectDialog, newProjectDialog.projectName);
- newProjectDialog.locationEditBox.path = parentPath;
- newProjectDialog.NotifyModifiedLocation(newProjectDialog.locationEditBox);
+ strcpy(name, app.argv[c]);
+ StripExtension(name);
+ GetLastDirectory(name, name);
+ newProjectDialog.projectName.contents = name;
+ newProjectDialog.projectName.NotifyModified(newProjectDialog, newProjectDialog.projectName);
+ newProjectDialog.locationEditBox.path = parentPath;
+ newProjectDialog.NotifyModifiedLocation(newProjectDialog.locationEditBox);
- newProjectDialog.Modal();
- if(projectView)
- {
- ideSettings.AddRecentProject(projectView.fileName);
- ide.UpdateRecentMenus();
- settingsContainer.Save();
- }
+ incref newProjectDialog;
+ newProjectDialog.Modal();
+ if(projectView)
+ {
+ ideSettings.AddRecentProject(projectView.fileName);
+ ide.UpdateRecentMenus();
+ settingsContainer.Save();
}
+ delete newProjectDialog;
// Open only one project
break;
}
else
- ide.OpenFile(fullPath, (app.argc == 2) * maximized, true, null, yes, normal);
+ ide.OpenFile(fullPath, (app.argc == 2) * maximized, true, openAsText ? "txt" : null, yes, normal, false);
}
else if(strstr(fullPath, "http://") == fullPath)
- ide.OpenFile(fullPath, (app.argc == 2) * maximized, true, null, yes, normal);
+ ide.OpenFile(fullPath, (app.argc == 2) * maximized, true, openAsText ? "txt" : null, yes, normal, false);
}
}
if(passThrough && projectView && projectView.project && workspace)
workspace.commandLineArgs = passArgs;
- delete passArgs;
+ if(passDebugWorkDir && projectView && projectView.project && workspace)
+ {
+ workspace.debugDir = passDebugWorkDir;
+ delete passDebugWorkDir;
+ }
if(debugStart)
;//MenuDebugStart(debugStartResumeItem, 0); // <-- how TODO this without getting into the app.Wait lock
UpdateToolBarActiveConfigs(false);
UpdateToolBarActiveCompilers();
+ delete passArgs;
return true;
}
#endif
}
- void SetPath(bool projectsDirs, CompilerConfig compiler, ProjectConfig config)
+ void SetPath(bool projectsDirs, CompilerConfig compiler, ProjectConfig config, int bitDepth)
{
int c, len, count;
char * newList;
// To go with the initial state, e.g. when F5 was pressed,
// we nould need to keep a list of all project's active
// config upon startup.
- targetDirExp = prj.GetTargetDir(compiler, prj.config);
+ targetDirExp = prj.GetTargetDir(compiler, prj.config, bitDepth);
/*if(prj.config.targetType == sharedLibrary && prj.config.debug)
cfg = prj.config;
{
if(!libPathExists[item]) // fstrcmp should be used
{
- newLibPaths.Add(item);
- libPathExists[item] = true;
+ String s = CopyString(item);
+ newLibPaths.Add(s);
+ libPathExists[s] = true;
}
}
{
if(!libPathExists[oldPaths[c]]) // fstrcmp should be used
{
- newLibPaths.Add(oldPaths[c]);
- libPathExists[oldPaths[c]] = true;
+ String s = CopyString(oldPaths[c]);
+ newLibPaths.Add(s);
+ libPathExists[s] = true;
}
}
#endif*/
delete newList;
+ newLibPaths.Free();
delete newLibPaths;
delete libPathExists;
#endif
Menu fileMenu = menu.FindMenu($"File");
Menu recentFiles = fileMenu.FindMenu($"Recent Files");
Menu recentProjects = fileMenu.FindMenu($"Recent Projects");
- char itemName[MAX_LOCATION + 4];
+ char * itemPath = new char[MAX_LOCATION];
+ char * itemName = new char[MAX_LOCATION+4];
MenuItem item;
recentFiles.Clear();
for(recent : ideSettings.recentFiles)
{
- sprintf(itemName, "%d %s", 1 + c, recent);
- MakeSystemPath(itemName);
+ 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);
c++;
}
c = 0;
for(recent : ideSettings.recentProjects)
{
- sprintf(itemName, "%d %s", 1 + c, recent);
- MakeSystemPath(itemName);
+ 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);
c++;
}
+
+ delete itemPath;
+ delete itemName;
}
~IDEWorkSpace()
delete driverItems;
delete skinItems;
delete ideSettings;
+ if(documentor)
+ {
+ documentor.Puts("Quit\n");
+ documentor.Wait();
+ delete documentor;
+ }
}
}
delete fsi;
}
+#if defined(__WIN32__)
+define sdkDirName = "Ecere SDK";
+#else
+define sdkDirName = "ecere";
+#endif
+
+void FindAndShellOpenInstalledFolder(char * name)
+{
+ char * p = new char[MAX_LOCATION];
+ char * v = new char[maxPathLen];
+ byte * tokens[256];
+ int c, numTokens;
+ Array<String> 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])
+ {
+ strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
+ PathCat(p, sdkDirName); PathCat(p, name); 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, 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])
+ {
+ strncpy(p, v, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
+ PathCat(p, "Program Files"); PathCat(p, sdkDirName); PathCat(p, name); paths.Add(CopyString(p));
+ }
+#else
+ GetEnvironment("XDG_DATA_DIRS", v, maxPathLen);
+ numTokens = TokenizeWith(v, sizeof(tokens) / sizeof(byte *), tokens, ":", false);
+ for(c=0; c<numTokens; c++)
+ {
+ strncpy(p, tokens[c], MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
+ PathCat(p, sdkDirName); PathCat(p, name); paths.Add(CopyString(p));
+ }
+#endif
+ for(path : paths)
+ {
+ strncpy(p, path, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
+ if(FileExists(p).isDirectory)
+ {
+ ShellOpen(p);
+ break;
+ }
+ }
+ delete p;
+ delete v;
+ paths.Free();
+ delete paths;
+}
+
+void FindAndShellOpenInstalledFile(char * subdir, char * name)
+{
+ char * p = new char[MAX_LOCATION];
+ char * v = new char[maxPathLen];
+ byte * tokens[256];
+ int c, numTokens;
+ Array<String> 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<numTokens; c++)
+ {
+ strncpy(p, tokens[c], MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
+ PathCat(p, sdkDirName); PathCat(p, subdir); paths.Add(CopyString(p));
+ }
+#endif
+ for(path : paths)
+ {
+ strncpy(p, path, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
+ PathCat(p, name);
+ if(FileExists(p).isFile)
+ {
+ ShellOpen(p);
+ break;
+ }
+ }
+ delete p;
+ delete v;
+ paths.Free();
+ delete paths;
+}
+
class RecursiveDeleteFolderFSI : NormalFileSystemIterator
{
bool preserveRootFolder;
// driver = "OpenGL";
// skin = "Aqua";
//skin = "TVision";
+
+ TempFile includeFile { };
+
bool Init()
{
+ char ext[MAX_EXTENSION];
SetLoggingMode(stdOut, null);
//SetLoggingMode(debug, null);
settingsContainer.Load();
+ if(argc > 1 && !strcmpi(GetExtension(argv[1], ext), "3ds"))
+ {
+ app.driver = "OpenGL";
+ ide.driverItems[1].checked = true;
+ }
+ else
+ {
#if defined(__unix__) || defined(__APPLE__)
- app.driver = (ideSettings.displayDriver && !strcmp(ideSettings.displayDriver, "OpenGL")) ? ideSettings.displayDriver : "X";
+ app.driver = (ideSettings.displayDriver && !strcmp(ideSettings.displayDriver, "OpenGL")) ? ideSettings.displayDriver : "X";
#else
- app.driver = (ideSettings.displayDriver && !strcmp(ideSettings.displayDriver, "OpenGL")) ? ideSettings.displayDriver : "GDI";
+ app.driver = (ideSettings.displayDriver && !strcmp(ideSettings.displayDriver, "OpenGL")) ? ideSettings.displayDriver : "GDI";
#endif
- ide.driverItems[ideSettings.displayDriver && !strcmp(ideSettings.displayDriver,"OpenGL")].checked = true;
+ ide.driverItems[ideSettings.displayDriver && !strcmp(ideSettings.displayDriver,"OpenGL")].checked = true;
+ }
SetInIDE(true);
char fullPath[MAX_LOCATION];
GetWorkingDir(fullPath, MAX_LOCATION);
PathCat(fullPath, app.argv[c]);
- ide.OpenFile(fullPath, (app.argc == 2) * maximized, true, null, yes, normal);
+ ide.OpenFile(fullPath, (app.argc == 2) * maximized, true, null, yes, normal, false);
}
*/
+
+ if(!LoadIncludeFile())
+ PrintLn("error: unable to load :crossplatform.mk file inside ide binary.");
+
+ return true;
+ }
+
+ bool Cycle(bool idle)
+ {
+ if(ide.documentor)
+ {
+ if(ide.documentor.Peek())
+ {
+ char line[1024];
+ ide.documentor.GetLine(line, sizeof(line));
+ if(!strcmpi(line, "Exited"))
+ {
+ ide.documentor.CloseInput();
+ ide.documentor.CloseOutput();
+ ide.documentor.Wait();
+ delete ide.documentor;
+ }
+ }
+ if(ide.documentor && ide.documentor.eof)
+ {
+ ide.documentor.CloseInput();
+ ide.documentor.CloseOutput();
+ ide.documentor.Wait();
+ delete ide.documentor;
+ }
+ }
return true;
}
+
+ bool LoadIncludeFile()
+ {
+ bool result = false;
+ File include = FileOpen(":crossplatform.mk", read);
+ if(include)
+ {
+ File f = includeFile;
+ if(f)
+ {
+ for(; !include.Eof(); )
+ {
+ char buffer[4096];
+ int count = include.Read(buffer, 1, 4096);
+ f.Write(buffer, 1, count);
+ }
+ result = true;
+ }
+ delete include;
+ }
+ return result;
+ }
}
IDEMainFrame ideMainFrame { };