import "process"
#endif
+IDEConfigHolder ideConfig { };
+
IDESettings ideSettings;
IDESettingsContainer settingsContainer
define ideSettingsName = "ecereIDE";
#endif
+class IDEConfigHolder
+{
+ CompilerConfigs compilers { };
+ RecentFiles recentFiles { };
+ RecentWorkspaces recentWorkspaces { };
+
+ void forcePathSeparatorStyle(bool unixStyle)
+ {
+ char from, to;
+ if(unixStyle)
+ from = '\\', to = '/';
+ else
+ from = '/', to = '\\';
+ recentFiles.changeChar(from, to);
+ recentWorkspaces.changeChar(from, to);
+ }
+}
+
class IDESettingsContainer : GlobalSettings
{
property bool useNewConfigurationFiles
}
}
+ if(oldConfig)
+ {
+ if(data.compilerConfigs && data.compilerConfigs.count)
+ {
+ for(c : data.compilerConfigs)
+ ideConfig.compilers.Add(c);
+ data.compilerConfigs.RemoveAll();
+ }
+ if(data.recentFiles && data.recentFiles.count)
+ {
+ for(s : data.recentFiles)
+ ideConfig.recentFiles.Add(s);
+ data.recentFiles.RemoveAll();
+ }
+ if(data.recentProjects && data.recentProjects.count)
+ {
+ for(s : data.recentProjects)
+ ideConfig.recentWorkspaces.Add(s);
+ data.recentProjects.RemoveAll();
+ }
+ ideConfig.forcePathSeparatorStyle(true);
+ }
+
CloseAndMonitor();
FileGetSize(settingsFilePath, &settingsFileSize);
- CompilerConfigs::fix();
+ if(oldConfig)
+ CompilerConfigs::fix();
if(portable && moduleLocation[0] && FileExists(moduleLocation).isDirectory)
data.ManagePortablePaths(moduleLocation, true);
data.ForcePathSeparatorStyle(true);
public:
property CompilerConfigs compilerConfigs
{
- set { if(compilerConfigs) compilerConfigs.Free(); delete compilerConfigs; if(value) compilerConfigs = value; }
+ set { if(settingsContainer.oldConfig) { if(compilerConfigs) compilerConfigs.Free(); delete compilerConfigs; if(value) compilerConfigs = value; } }
get { return compilerConfigs; }
isset { return false; }
}
{
if(strcmp(compilersTab.compilerConfigsDir.path, ideSettings.compilerConfigsDir))
ideSettings.compilerConfigsDir = compilersTab.compilerConfigsDir.path;
- if(compilersTab.compilerConfigs.OnCompare(ideSettings.compilerConfigs))
+ if(compilersTab.compilerConfigs.OnCompare(ideConfig.compilers))
{
- cfgsToWrite = compilersTab.compilerConfigs.getWriteRequiredList(ideSettings.compilerConfigs);
- ideSettings.compilerConfigs.Free();
+ cfgsToWrite = compilersTab.compilerConfigs.getWriteRequiredList(ideConfig.compilers);
+ ideConfig.compilers.Free();
for(compiler : compilersTab.compilerConfigs)
{
- ideSettings.compilerConfigs.Add(compiler.Copy());
+ ideConfig.compilers.Add(compiler.Copy());
}
compilerSettingsChanged = true;
}
if(compilerSettingsChanged)
{
- ideSettings.compilerConfigs.write(cfgsToWrite);
+ ideConfig.compilers.write(cfgsToWrite);
OnGlobalSettingChange(GlobalSettingsChange::compilerSettings);
cfgsToWrite.Free();
delete cfgsToWrite;
// CompilersTab
if(workspaceActiveCompiler)
{
- for(compiler : ideSettings.compilerConfigs)
+ for(compiler : ideConfig.compilers)
{
if(!activateCompiler && !strcmp(workspaceActiveCompiler, compiler.name))
activateCompiler = compiler;
}
if(!activateCompiler && readonlyCompiler)
activateCompiler = readonlyCompiler;
- if(!activateCompiler && ideSettings.compilerConfigs.count)
- activateCompiler = ideSettings.compilerConfigs[0];
+ if(!activateCompiler && ideConfig.compilers.count)
+ activateCompiler = ideConfig.compilers[0];
- for(compiler : ideSettings.compilerConfigs)
+ for(compiler : ideConfig.compilers)
compilersTab.AddCompiler(compiler.Copy(), compiler == activateCompiler);
compilersTab.compilerConfigsDir.path = ideSettings.compilerConfigsDir;
if(dialog && dialog.compilersTab.compilerConfigs && dialog.ideSettings)
{
DataRow row;
- for(compiler : dialog.ideSettings.compilerConfigs)
+ for(compiler : ideConfig.compilers)
{
row = defaultCompilerDropBox.AddString(compiler.name);
if(dialog.ideSettings.defaultCompiler && dialog.ideSettings.defaultCompiler[0] &&
bool FileRecentFile(MenuItem selection, Modifiers mods)
{
int id = 0;
- RecentPaths recentFiles = workspace ? workspace.recentFiles : 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.recentProjects.addRecent(CopyString(projectView.fileName));
+ ideConfig.recentWorkspaces.addRecent(CopyString(projectView.fileName));
ide.updateRecentProjectsMenu();
}
}
void DocumentSaved(Window document, const char * fileName)
{
- ideSettings.recentFiles.addRecent(CopyString(fileName));
+ ideConfig.recentFiles.addRecent(CopyString(fileName));
ide.updateRecentFilesMenu();
ide.AdjustFileMenus();
}
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))
document.state = maximized;
if(isProject)
- ideSettings.recentProjects.addRecent(CopyString(document.fileName));
+ ideConfig.recentWorkspaces.addRecent(CopyString(document.fileName));
else if(!workspace)
- ideSettings.recentFiles.addRecent(CopyString(document.fileName));
+ ideConfig.recentFiles.addRecent(CopyString(document.fileName));
ide.AdjustFileMenus();
ide.updateRecentFilesMenu();
newProjectDialog.Modal();
if(projectView)
{
- ideSettings.recentProjects.addRecent(CopyString(projectView.fileName));
+ ideConfig.recentWorkspaces.addRecent(CopyString(projectView.fileName));
ide.updateRecentMenus();
}
delete newProjectDialog;
char * itemPath = new char[MAX_LOCATION];
char * itemName = new char[MAX_LOCATION+4];
Workspace ws = workspace;
- RecentPaths recentFiles = ws ? ws.recentFiles : ideSettings.recentFiles;
+ RecentPaths recentFiles = ws ? ws.recentFiles : ideConfig.recentFiles;
recentFilesMenu.Clear();
for(recent : recentFiles)
{
char * itemPath = new char[MAX_LOCATION];
char * itemName = new char[MAX_LOCATION+4];
recentProjectsMenu.Clear();
- for(recent : ideSettings.recentProjects)
+ for(recent : ideConfig.recentWorkspaces)
{
strncpy(itemPath, recent, MAX_LOCATION); itemPath[MAX_LOCATION-1] = '\0';
MakeSystemPath(itemPath);
}
}
- ideSettings.compilerConfigs.read();
- ideSettings.recentFiles.read();
- ideSettings.recentProjects.read();
+ ideConfig.compilers.read();
+ ideConfig.recentFiles.read();
+ ideConfig.recentWorkspaces.read();
// First count files arg to decide whether to maximize
{