define pathListSep = ":";
#endif
+IDEConfigHolder ideConfig { };
+
+FontResource panelFont { $"Courier New", 10 };
+FontResource codeFont { $"Courier New", 10 };
+
+IDESettings ideSettings;
+
+IDESettingsContainer settingsContainer
+{
+ dataOwner = &ideSettings;
+ dataClass = class(IDESettings);
+
+ void onLoadCompilerConfigs() { ide.UpdateCompilerConfigs(true); }
+ void onLoadRecentFiles() { ide.updateRecentFilesMenu(); }
+ void onLoadRecentProjects() { ide.updateRecentProjectsMenu(); }
+ void onLoad() { ide.ApplyColorScheme(colorScheme); ide.ApplyFont(ideSettings.codeEditorFont, ideSettings.codeEditorFontSize); }
+};
+
define maxPathLen = 65 * MAX_LOCATION;
class PathBackup : struct
GlobalSettingsDialog globalSettingsDialog
{
- ideSettings = ideSettings;
- settingsContainer = settingsContainer;
-
void OnGlobalSettingChange(GlobalSettingsChange globalSettingsChange)
{
switch(globalSettingsChange)
if(ide.workspace && ide.projectView && row && strcmp(row.string, ide.workspace.activeCompiler))
{
bool silent = ide.projectView.buildInProgress == none ? false : true;
- CompilerConfig compiler = ideSettings.GetCompilerConfig(row.string);
+ CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(row.string);
ide.workspace.activeCompiler = row.string;
ide.projectView.ShowOutputBuildLog(!silent);
if(!silent)
if(ide.workspace && ide.projectView && row)
{
bool silent = ide.projectView.buildInProgress == none ? false : true;
- CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+ CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
ide.workspace.bitDepth = (int)row.tag;
ide.projectView.ShowOutputBuildLog(!silent);
if(!silent)
Debugger debugger { };
+ void ApplyFont(const String faceName, float size)
+ {
+ panelFont.faceName = faceName;
+ panelFont.size = size;
+
+ codeFont.faceName = faceName;
+ codeFont.size = size;
+
+ {
+ CodeEditor ce;
+ for(ce = (CodeEditor)firstChild; ce; ce = (CodeEditor)ce.next)
+ if(ce._class == class(CodeEditor))
+ {
+ ce.font = { codeFont.faceName, codeFont.size, codeFont.bold, codeFont.italic };
+ ce.editBox.font = ce.font;
+ ce.OnPostCreate();
+ }
+ }
+
+ threadsView.font = { panelFont.faceName, panelFont.size, panelFont.bold, panelFont.italic };
+ callStackView.font = { panelFont.faceName, panelFont.size, panelFont.bold, panelFont.italic };
+ outputView.buildBox.font = { panelFont.faceName, panelFont.size, panelFont.bold, panelFont.italic };
+ outputView.debugBox.font = { panelFont.faceName, panelFont.size, panelFont.bold, panelFont.italic };
+ outputView.findBox.font = { panelFont.faceName, panelFont.size, panelFont.bold, panelFont.italic };
+ #ifdef GDB_DEBUG_OUTPUT
+ outputView.gdbBox.font = { panelFont.faceName, panelFont.size, panelFont.bold, panelFont.italic };
+ #endif
+#ifdef GDB_DEBUG_GUI
+ if(gdbDialog)
+ {
+ gdbDialog.tree.font = { panelFont.faceName, panelFont.size, panelFont.bold, panelFont.italic };
+ gdbDialog.output.font = { panelFont.faceName, panelFont.size, panelFont.bold, panelFont.italic };
+ }
+#endif
+ }
+
+ void ApplyColorScheme(IDEColorScheme cs)
+ {
+ CodeEditor ce;
+
+ colorScheme = cs;
+
+ for(ce = (CodeEditor)firstChild; ce; ce = (CodeEditor)ce.next)
+ if(ce._class == class(CodeEditor))
+ {
+ EditBox eb = ce.editBox;
+ ce.background = cs.marginColor;
+ eb.selectionColor = cs.selectionColor;
+ eb.selectionText = cs.selectionText;
+ eb.background = cs.codeEditorBG;
+ eb.foreground = cs.codeEditorFG;
+ eb.syntaxColorScheme = cs.syntaxColors;
+ }
+
+ if(projectView)
+ {
+ projectView.fileList.background = cs.projectViewBackground;
+ projectView.fileList.foreground = cs.projectViewText;
+ projectView.fileList.selectionColor = cs.selectionColor;
+ projectView.fileList.selectionText = cs.selectionText;
+ }
+
+ sheet.properties.background = cs.viewsBackground;
+ sheet.properties.foreground = cs.viewsText;
+ sheet.properties.selectionText = cs.sheetSelectionText;
+ sheet.properties.selectionColor = cs.sheetSelectionColor;
+ sheet.methods.background = cs.viewsBackground;
+ sheet.methods.foreground = cs.viewsText;
+
+ threadsView.editBox.background = cs.viewsBackground;
+ threadsView.editBox.foreground = cs.viewsText;
+ threadsView.editBox.selectionColor = cs.selectionColor;
+ threadsView.editBox.selectionText = cs.selectionText;
+
+ callStackView.editBox.background = cs.viewsBackground;
+ callStackView.editBox.foreground = cs.viewsText;
+ callStackView.editBox.selectionColor = cs.selectionColor;
+ callStackView.editBox.selectionText = cs.selectionText;
+
+ watchesView.listBox.background = cs.viewsBackground;
+ watchesView.listBox.foreground = cs.viewsText;
+ watchesView.listBox.selectionColor = cs.selectionColor;
+ watchesView.listBox.selectionText = cs.selectionText;
+
+ breakpointsView.listBox.background = cs.viewsBackground;
+ breakpointsView.listBox.foreground = cs.viewsText;
+ breakpointsView.listBox.selectionColor = cs.selectionColor;
+ breakpointsView.listBox.selectionText = cs.selectionText;
+
+ outputView.buildBox.background = cs.outputBackground;
+ outputView.buildBox.foreground = cs.outputText;
+ outputView.buildBox.selectionColor = cs.selectionColor;
+ outputView.buildBox.selectionText = cs.selectionText;
+
+ outputView.debugBox.background = cs.outputBackground;
+ outputView.debugBox.foreground = cs.outputText;
+ outputView.debugBox.selectionColor = cs.selectionColor;
+ outputView.debugBox.selectionText = cs.selectionText;
+
+ outputView.findBox.background = cs.outputBackground;
+ outputView.findBox.foreground = cs.outputText;
+ outputView.findBox.selectionColor = cs.selectionColor;
+ outputView.findBox.selectionText = cs.selectionText;
+ }
+
ProjectView projectView;
OutputView outputView
void OnGotoError(const char * line, bool noParsing)
{
- CompilerConfig compiler = ide.workspace ? ideSettings.GetCompilerConfig(ide.workspace.activeCompiler) : null;
+ CompilerConfig compiler = ide.workspace ? ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler) : null;
const char * objectFileExt = compiler ? compiler.objectFileExt : objectDefaultFileExt;
ide.GoToError(line, noParsing, objectFileExt);
+ delete compiler;
}
void OnCodeLocationParseAndGoTo(const char * line)
{
- CompilerConfig compiler = ide.workspace ? ideSettings.GetCompilerConfig(ide.workspace.activeCompiler) : null;
+ CompilerConfig compiler = ide.workspace ? ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler) : null;
const char * objectFileExt = compiler ? compiler.objectFileExt : objectDefaultFileExt;
ide.CodeLocationParseAndGoTo(line, ide.findInFilesDialog.findProject, ide.findInFilesDialog.findDir, objectFileExt);
+ delete compiler;
}
bool OnKeyDown(Key key, unichar ch)
fileMenu, $"Global Settings...", g;
bool NotifySelect(MenuItem selection, Modifiers mods)
{
+ // Reload configs here until we setup a configs directory monitor
+ ideConfig.compilers.read(settingsContainer);
+
globalSettingsDialog.master = this;
if(ide.workspace && ide.workspace.activeCompiler)
globalSettingsDialog.workspaceActiveCompiler = ide.workspace.activeCompiler;
}
};
MenuDivider { fileMenu };
- Menu recentFiles { fileMenu, $"Recent Files", r };
- Menu recentProjects { fileMenu, $"Recent Projects", p };
+ Menu recentFilesMenu { fileMenu, $"Recent Files", r };
+ Menu recentProjectsMenu { fileMenu, $"Recent Projects", p };
MenuDivider { fileMenu };
MenuItem exitItem
{
bool FileRecentFile(MenuItem selection, Modifiers mods)
{
int id = 0;
- for(file : ideSettings.recentFiles)
+ RecentPaths recentFiles = workspace ? workspace.recentFiles : ideConfig.recentFiles;
+ for(file : recentFiles)
{
if(id == selection.id)
{
bool FileRecentProject(MenuItem selection, Modifiers mods)
{
int id = 0;
- for(file : ideSettings.recentProjects)
+ for(file : ideConfig.recentWorkspaces)
{
if(id == selection.id)
{
newProjectDialog.CreateNewProject();
if(projectView)
{
- ideSettings.AddRecentProject(projectView.fileName);
- ide.UpdateRecentMenus();
- settingsContainer.Save();
+ ideConfig.recentWorkspaces.addRecent(projectView.fileName);
+ ideConfig.recentWorkspaces.write(settingsContainer);
+ ide.updateRecentProjectsMenu();
}
}
}
ideMainFrame.SetText("%s - %s", project.topNode.name, titleECEREIDE);
AdjustMenus();
+ updateRecentMenus();
ide.breakpointsView.LoadFromWorkspace();
ide.watchesView.LoadFromWorkspace();
outputView.visible = false;
ideMainFrame.text = titleECEREIDE;
ide.AdjustMenus();
+ ide.updateRecentMenus();
return true;
}
return false;
void DocumentSaved(Window document, const char * fileName)
{
- ideSettings.AddRecentFile(fileName);
- ide.UpdateRecentMenus();
+ ideConfig.recentFiles.addRecent(fileName);
+ ideConfig.recentFiles.write(settingsContainer);
+ ide.updateRecentFilesMenu();
ide.AdjustFileMenus();
- settingsContainer.Save();
}
bool Window::OnFileModified(FileChange fileChange, const char * param)
{
if(workspace)
{
- CompilerConfig compiler = ideSettings.GetCompilerConfig(workspace.activeCompiler);
+ CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(workspace.activeCompiler);
for(prj : workspace.projects)
projectView.ProjectUpdateMakefileForAllConfigs(prj);
delete compiler;
if(workspace)
{
bool silent = mute || (ide.projectView.buildInProgress == none ? false : true);
- CompilerConfig compiler = ideSettings.GetCompilerConfig(workspace.activeCompiler);
+ CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(workspace.activeCompiler);
if(!silent)
{
projectView.ShowOutputBuildLog(true);
void UpdateToolBarActiveCompilers()
{
toolBar.activeCompiler.Clear();
- for(compiler : ideSettings.compilerConfigs)
+ for(compiler : ideConfig.compilers)
{
DataRow row = toolBar.activeCompiler.AddString(compiler.name);
if(workspace && workspace.activeCompiler && !strcmp(compiler.name, workspace.activeCompiler))
ide.projectView.ShowOutputBuildLog(true);
{
- CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+ CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
ide.projectView.DisplayCompiler(compiler, false);
delete compiler;
}
if(prj)
{
const char * activeConfigName = null;
- CompilerConfig compiler = ideSettings.GetCompilerConfig(workspace.activeCompiler);
+ CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(workspace.activeCompiler);
prj.StartMonitoring();
workspace.AddProject(prj, null);
if(toolBar.activeConfig.currentRow && toolBar.activeConfig.currentRow != toolBar.activeConfig.firstRow &&
{
document.fileName = filePath;
if(workspace && !workspace.holdTracking)
- workspace.UpdateOpenedFileInfo(filePath, opened);
+ workspace.UpdateOpenedFileInfo(filePath, opened, true);
}
}
document.state = maximized;
if(isProject)
- ideSettings.AddRecentProject(document.fileName);
+ {
+ ideConfig.recentWorkspaces.addRecent(document.fileName);
+ ideConfig.recentWorkspaces.write(settingsContainer);
+ ide.updateRecentProjectsMenu();
+ }
+ else if(workspace)
+ workspace.recentFiles.addRecent(document.fileName);
else
- ideSettings.AddRecentFile(document.fileName);
- ide.UpdateRecentMenus();
+ {
+ ideConfig.recentFiles.addRecent(document.fileName);
+ ideConfig.recentFiles.write(settingsContainer);
+ }
+ ide.updateRecentFilesMenu();
ide.AdjustFileMenus();
- settingsContainer.Save();
-
return document;
}
else
/*bool Window::GenericDocumentOnClose(bool parentClosing)
{
if(!parentClosing && ide.workspace)
- ide.workspace.UpdateOpenedFileInfo(fileName, unknown);
+ ide.workspace.UpdateOpenedFileInfo(fileName, unknown, false);
return true;
}*/
bool ModelView::ModelViewOnClose(bool parentClosing)
{
if(!parentClosing && ide.workspace)
- ide.workspace.UpdateOpenedFileInfo(fileName, unknown);
+ ide.workspace.UpdateOpenedFileInfo(fileName, unknown, false);
return true;
}
bool PictureEdit::PictureEditOnClose(bool parentClosing)
{
if(!parentClosing && ide.workspace)
- ide.workspace.UpdateOpenedFileInfo(fileName, unknown);
+ ide.workspace.UpdateOpenedFileInfo(fileName, unknown, false);
return true;
}
//line = atoi(colon+1);
}
// support for "Found n match(es) in "file/path";
- else if(path[len-1] == '\"' && strstr(path, $"Found %d match%s in \"%s\"%s\n\n"."Found") && strstr(path, $"match") && strstr(path, $"in") && (s = strstr(path, "\"")) && s != path+len-1)
+ else if(len > 0 && path[len-1] == '\"' && strstr(path, $"Found %d match%s in \"%s\"%s\n\n"."Found") && strstr(path, $"match") && strstr(path, $"in") && (s = strstr(path, "\"")) && s != path+len-1)
{
path = s+1;
}
newProjectDialog.Modal();
if(projectView)
{
- ideSettings.AddRecentProject(projectView.fileName);
- ide.UpdateRecentMenus();
- settingsContainer.Save();
+ ideConfig.recentWorkspaces.addRecent(projectView.fileName);
+ ideConfig.recentWorkspaces.write(settingsContainer);
+ ide.updateRecentMenus();
}
delete newProjectDialog;
// Open only one project
return true;
}
- void UpdateRecentMenus()
+ void updateRecentMenus()
{
- int c;
- Menu fileMenu = menu.FindMenu($"File");
- Menu recentFiles = fileMenu.FindMenu($"Recent Files");
- Menu recentProjects = fileMenu.FindMenu($"Recent Projects");
+ updateRecentFilesMenu();
+ updateRecentProjectsMenu();
+ }
+
+ void updateRecentFilesMenu()
+ {
+ int c = 0;
char * itemPath = new char[MAX_LOCATION];
char * itemName = new char[MAX_LOCATION+4];
-
- recentFiles.Clear();
- c = 0;
-
- for(recent : ideSettings.recentFiles)
+ Workspace ws = workspace;
+ RecentPaths recentFiles = ws ? ws.recentFiles : ideConfig.recentFiles;
+ recentFilesMenu.Clear();
+ for(recent : recentFiles)
{
strncpy(itemPath, recent, MAX_LOCATION); itemPath[MAX_LOCATION-1] = '\0';
MakeSystemPath(itemPath);
snprintf(itemName, MAX_LOCATION+4, "%d %s", 1 + c, itemPath); itemName[MAX_LOCATION+4-1] = '\0';
- recentFiles.AddDynamic(MenuItem { copyText = true, text = itemName, (Key)k1 + c, id = c, NotifySelect = ide.FileRecentFile }, ide, true);
+ recentFilesMenu.AddDynamic(MenuItem { copyText = true, text = itemName, (Key)k1 + c, id = c, NotifySelect = ide.FileRecentFile }, ide, true);
c++;
}
+ delete itemPath;
+ delete itemName;
+ }
- recentProjects.Clear();
- c = 0;
- for(recent : ideSettings.recentProjects)
+ void updateRecentProjectsMenu()
+ {
+ int c = 0;
+ char * itemPath = new char[MAX_LOCATION];
+ char * itemName = new char[MAX_LOCATION+4];
+ recentProjectsMenu.Clear();
+ for(recent : ideConfig.recentWorkspaces)
{
strncpy(itemPath, recent, MAX_LOCATION); itemPath[MAX_LOCATION-1] = '\0';
MakeSystemPath(itemPath);
snprintf(itemName, MAX_LOCATION+4, "%d %s", 1 + c, itemPath); itemName[MAX_LOCATION+4-1] = '\0';
- recentProjects.AddDynamic(MenuItem { copyText = true, text = itemName, (Key)k1 + c, id = c, NotifySelect = ide.FileRecentProject }, ide, true);
+ recentProjectsMenu.AddDynamic(MenuItem { copyText = true, text = itemName, (Key)k1 + c, id = c, NotifySelect = ide.FileRecentProject }, ide, true);
c++;
}
-
delete itemPath;
delete itemName;
}
}
}
+ ide.ApplyFont(ideSettings.codeEditorFont, ideSettings.codeEditorFontSize);
+ ide.ApplyColorScheme(colorScheme);
+
+ ideConfig.compilers.read(settingsContainer);
+ ideConfig.recentFiles.read(settingsContainer);
+ ideConfig.recentWorkspaces.read(settingsContainer);
+
// First count files arg to decide whether to maximize
{
bool passThrough = false, debugWorkDir = false;