9 define makeCommandSetting = "Make Command";
10 define ecpCommandSetting = "ECP Command";
11 define eccCommandSetting = "ECC Command";
12 define ecsCommandSetting = "ECS Command";
13 define earCommandSetting = "EAR Command";
14 define cPreprocessorCommandSetting = "C Preprocessor Command";
15 define cCompilerCommandSetting = "C Compiler Command";
16 define cxxCompilerCommandSetting = "C++ Compiler Command";
18 define projectOptions = "Project Options";
19 define defaultTargetDir = "Default Target Directory";
20 define defaultIntermediateObjDir = "Default Intermediate Objects Directory";
22 define makeDefaultCommand = (__runtimePlatform == win32) ? "mingw32-make" :
29 class OldIDESettings : GlobalAppSettings
32 settingsName = "ecereIDESettingsTest";
34 settingsName = "ecereIDE";
37 List<CompilerConfig> compilerConfigs { };
38 Array<String> recentFiles { };
39 Array<String> recentProjects { };
41 char * ideFileDialogLocation;
42 char * ideProjectFileDialogLocation;
45 bool caretFollowsScrolling;
48 useFreeCaret = false; //true;
49 showLineNumbers = true;
50 caretFollowsScrolling = false; //true;
53 char * projectDefaultTargetDir;
54 property const char * projectDefaultTargetDir
56 set { delete projectDefaultTargetDir; if(value && value[0]) projectDefaultTargetDir = CopyString(value); }
57 get { return projectDefaultTargetDir ? projectDefaultTargetDir : ""; }
59 char * projectDefaultIntermediateObjDir;
60 property const char * projectDefaultIntermediateObjDir
62 set { delete projectDefaultIntermediateObjDir; if(value && value[0]) projectDefaultIntermediateObjDir = CopyString(value); }
63 get { return projectDefaultIntermediateObjDir ? projectDefaultIntermediateObjDir : ""; }
66 CompilerConfig GetCompilerConfig(const String compilerName)
68 const char * name = compilerName && compilerName[0] ? compilerName : defaultCompilerName;
69 CompilerConfig compilerConfig = null;
70 for(compiler : compilerConfigs)
72 if(!strcmp(compiler.name, name))
74 compilerConfig = compiler;
78 if(!compilerConfig && compilerConfigs.count)
79 compilerConfig = compilerConfigs.firstIterator.data;
81 incref compilerConfig;
82 return compilerConfig;
87 compilerConfigs.Free();
89 recentProjects.Free();
92 delete projectDefaultTargetDir;
93 delete projectDefaultIntermediateObjDir;
95 delete ideFileDialogLocation;
96 delete ideProjectFileDialogLocation;
100 void OnAskReloadSettings()
102 /*if(MessageBox { type = YesNo, master = this,
103 text = "Global Settings Modified Externally",
104 contents = "The global settings were modified by another instance.\n"
105 "Would you like to reload them?" }.Modal() == Yes)*/
111 SettingsIOResult Load()
113 SettingsIOResult result = GlobalAppSettings::Load();
114 if(result == success)
116 Array<String> configNames { };
117 CompilerConfig compiler;
119 CompilerConfig defaultCompiler = MakeDefaultCompiler(defaultCompilerName, true);
120 compilerConfigs.Free();
121 compilerConfigs.Add(defaultCompiler);
124 GetGlobalValue("Compilers", "Configs", stringList, configNames);
125 // todo manage the ability to modify the Default config, for now it will be hard coded
127 GetGlobalValue("Directories", settingsDirectoryNames[includes], stringList, defaultCompiler.includeDirs);
128 GetGlobalValue("Directories", settingsDirectoryNames[libraries], stringList, defaultCompiler.libraryDirs);
129 GetGlobalValue("Directories", settingsDirectoryNames[executables], stringList, defaultCompiler.executableDirs);
131 for(configName : configNames)
133 int len = strlen(configName);
137 char * section, * platformName = null;
138 section = new char[len + 17];
139 sprintf(section, "%s Compiler Config", configName);
140 GetGlobalValue(section, "Target Platform", singleString, &platformName);
141 compiler = CompilerConfig { name = configName, targetPlatform = platformName };
143 if(!compiler.targetPlatform)
144 compiler.targetPlatform = __runtimePlatform;
146 // TOCHECK these must call the property!
147 GetGlobalValue(section, makeCommandSetting, singleString, &v); compiler.makeCommand = v && v[0] ? v : makeDefaultCommand; delete v;
148 GetGlobalValue(section, ecpCommandSetting, singleString, &v); compiler.ecpCommand = v && v[0] ? v : ecpDefaultCommand; delete v;
149 GetGlobalValue(section, eccCommandSetting, singleString, &v); compiler.eccCommand = v && v[0] ? v : eccDefaultCommand; delete v;
150 GetGlobalValue(section, ecsCommandSetting, singleString, &v); compiler.ecsCommand = v && v[0] ? v : ecsDefaultCommand; delete v;
151 GetGlobalValue(section, earCommandSetting, singleString, &v); compiler.earCommand = v && v[0] ? v : earDefaultCommand; delete v;
152 GetGlobalValue(section, cPreprocessorCommandSetting, singleString, &v); compiler.cppCommand = v && v[0] ? v : cppDefaultCommand; delete v;
153 GetGlobalValue(section, cCompilerCommandSetting, singleString, &v); compiler.ccCommand = v && v[0] ? v : ccDefaultCommand; delete v;
154 GetGlobalValue(section, cCompilerCommandSetting, singleString, &v); compiler.cxxCommand = v && v[0] ? v : cxxDefaultCommand; delete v;
156 section = new char[len + 13];
157 sprintf(section, "%s Directories", configName);
158 GetGlobalValue(section, settingsDirectoryNames[includes], stringList, compiler.includeDirs);
159 GetGlobalValue(section, settingsDirectoryNames[libraries], stringList, compiler.libraryDirs);
160 GetGlobalValue(section, settingsDirectoryNames[executables], stringList, compiler.executableDirs);
163 compilerConfigs.Add(compiler);
169 GetGlobalValue("Recent", "Files", stringList, recentFiles);
171 GetGlobalValue("Recent", "Projects", stringList, recentProjects);
174 delete ideFileDialogLocation;
175 GetGlobalValue("FileOpenLocations", "Files", singleString, &ideFileDialogLocation);
177 delete ideProjectFileDialogLocation;
178 GetGlobalValue("FileOpenLocations", "Projects", singleString, &ideProjectFileDialogLocation);
181 GetGlobalValue("Editing", "UseFreeCaret", integer, &useFreeCaret);
182 GetGlobalValue("Editing", "CaretFollowsScrolling", integer, &caretFollowsScrolling);
183 GetGlobalValue("Editing", "ShowLineNumbers", integer, &showLineNumbers);
185 GetGlobalValue("Building", "NumParallelJobs", integer, &defaultCompiler.numJobs);
187 delete displayDriver;
188 GetGlobalValue("View", "DisplayDriver", singleString, &displayDriver);
192 GetGlobalValue("Documentor", "Files", singleString, &docDir); // get the path to the documentor files from ecereIDE.ini. Note that the path cannot include quotes or it will not work.
194 delete projectDefaultTargetDir;
195 GetGlobalValue(projectOptions, defaultTargetDir, singleString, &projectDefaultTargetDir);
196 if(!projectDefaultTargetDir || !projectDefaultTargetDir[0])
197 property::projectDefaultTargetDir = defaultObjDirExpression;
199 delete projectDefaultIntermediateObjDir;
200 GetGlobalValue(projectOptions, defaultIntermediateObjDir, singleString, &projectDefaultIntermediateObjDir);
201 if(!projectDefaultIntermediateObjDir || !projectDefaultIntermediateObjDir[0])
202 property::projectDefaultIntermediateObjDir = defaultObjDirExpression;
209 SettingsIOResult Save()
211 SettingsIOResult result = GlobalAppSettings::Save();
212 if(result == success)
214 Array<String> configNames { };
215 CompilerConfig compiler = compilerConfigs.firstIterator.data;
217 PutGlobalValue("Directories", settingsDirectoryNames[includes], stringList, compiler.includeDirs);
218 PutGlobalValue("Directories", settingsDirectoryNames[libraries], stringList, compiler.libraryDirs);
219 PutGlobalValue("Directories", settingsDirectoryNames[executables], stringList, compiler.executableDirs);
220 PutGlobalValue("Recent", "Files", stringList, recentFiles);
221 PutGlobalValue("Recent", "Projects", stringList, recentProjects);
223 PutGlobalValue("FileOpenLocations", "Files", singleString, ideFileDialogLocation);
224 PutGlobalValue("FileOpenLocations", "Projects", singleString, ideProjectFileDialogLocation);
226 PutGlobalValue("Editing", "UseFreeCaret", integer, (void *)(intptr)useFreeCaret);
227 PutGlobalValue("Editing", "CaretFollowsScrolling", integer, (void *)(intptr)caretFollowsScrolling);
228 PutGlobalValue("Editing", "ShowLineNumbers", integer, (void *)(intptr)showLineNumbers);
230 PutGlobalValue("Building", "NumParallelJobs", integer, (void *)(intptr)(compiler.numJobs));
231 PutGlobalValue("View", "DisplayDriver", singleString, displayDriver);
232 PutGlobalValue("Documentor", "Files", singleString, docDir);
234 PutGlobalValue(projectOptions, defaultTargetDir, singleString, projectDefaultTargetDir);
235 PutGlobalValue(projectOptions, defaultIntermediateObjDir, singleString, projectDefaultIntermediateObjDir);
237 for(compiler : compilerConfigs; compiler != compilerConfigs.firstIterator.data)
238 configNames.Add(CopyString(compiler.name));
240 PutGlobalValue("Compilers", "Configs", stringList, configNames);
242 for(compiler : compilerConfigs; compiler != compilerConfigs.firstIterator.data)
244 int len = strlen(compiler.name);
247 char * section = new char[len + 17];
248 const char * platform;
249 sprintf(section, "%s Compiler Config", compiler.name);
250 platform = compiler.targetPlatform.OnGetString(null, null, null);
251 PutGlobalValue(section, "Target Platform", singleString, platform);
252 PutGlobalValue(section, makeCommandSetting, singleString, compiler.makeCommand);
253 PutGlobalValue(section, ecpCommandSetting, singleString, compiler.ecpCommand);
254 PutGlobalValue(section, eccCommandSetting, singleString, compiler.eccCommand);
255 PutGlobalValue(section, ecsCommandSetting, singleString, compiler.ecsCommand);
256 PutGlobalValue(section, earCommandSetting, singleString, compiler.earCommand);
257 PutGlobalValue(section, cPreprocessorCommandSetting, singleString, compiler.cppCommand);
258 PutGlobalValue(section, cCompilerCommandSetting, singleString, compiler.ccCommand);
259 PutGlobalValue(section, cxxCompilerCommandSetting, singleString, compiler.cxxCommand);
261 section = new char[len + 13];
262 sprintf(section, "%s Directories", compiler.name);
263 PutGlobalValue(section, settingsDirectoryNames[includes], stringList, compiler.includeDirs);
264 PutGlobalValue(section, settingsDirectoryNames[libraries], stringList, compiler.libraryDirs);
265 PutGlobalValue(section, settingsDirectoryNames[executables], stringList, compiler.executableDirs);