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 = (GetRuntimePlatform() == win32) ? "mingw32-make" :
28 define ecpDefaultCommand = "ecp";
29 define eccDefaultCommand = "ecc";
30 define ecsDefaultCommand = "ecs";
31 define earDefaultCommand = "ear";
32 define cppDefaultCommand = "gcc"; // As per #624 we decided to default to "gcc"...
33 define ccDefaultCommand = "gcc";
34 define cxxDefaultCommand = "g++";
36 class OldIDESettings : GlobalAppSettings
39 settingsName = "ecereIDESettingsTest";
41 settingsName = "ecereIDE";
44 List<CompilerConfig> compilerConfigs { };
45 Array<String> recentFiles { };
46 Array<String> recentProjects { };
48 char * ideFileDialogLocation;
49 char * ideProjectFileDialogLocation;
52 bool caretFollowsScrolling;
56 showLineNumbers = true;
57 caretFollowsScrolling = true;
60 char * projectDefaultTargetDir;
61 property char * projectDefaultTargetDir
63 set { delete projectDefaultTargetDir; if(value && value[0]) projectDefaultTargetDir = CopyString(value); }
64 get { return projectDefaultTargetDir ? projectDefaultTargetDir : ""; }
66 char * projectDefaultIntermediateObjDir;
67 property char * projectDefaultIntermediateObjDir
69 set { delete projectDefaultIntermediateObjDir; if(value && value[0]) projectDefaultIntermediateObjDir = CopyString(value); }
70 get { return projectDefaultIntermediateObjDir ? projectDefaultIntermediateObjDir : ""; }
73 CompilerConfig GetCompilerConfig(String compilerName)
75 char * name = compilerName && compilerName[0] ? compilerName : defaultCompilerName;
76 CompilerConfig compilerConfig = null;
77 for(compiler : compilerConfigs)
79 if(!strcmp(compiler.name, name))
81 compilerConfig = compiler;
85 if(!compilerConfig && compilerConfigs.count)
86 compilerConfig = compilerConfigs.firstIterator.data;
88 incref compilerConfig;
89 return compilerConfig;
94 compilerConfigs.Free();
96 recentProjects.Free();
99 delete projectDefaultTargetDir;
100 delete projectDefaultIntermediateObjDir;
102 delete ideFileDialogLocation;
103 delete ideProjectFileDialogLocation;
104 delete displayDriver;
107 void OnAskReloadSettings()
109 /*if(MessageBox { type = YesNo, master = this,
110 text = "Global Settings Modified Externally",
111 contents = "The global settings were modified by another instance.\n"
112 "Would you like to reload them?" }.Modal() == Yes)*/
118 SettingsIOResult Load()
120 SettingsIOResult result = GlobalAppSettings::Load();
121 if(result == success)
123 Array<String> configNames { };
124 CompilerConfig compiler;
126 CompilerConfig defaultCompiler = MakeDefaultCompiler(defaultCompilerName, true);
127 compilerConfigs.Free();
128 compilerConfigs.Add(defaultCompiler);
131 GetGlobalValue("Compilers", "Configs", stringList, configNames);
132 // todo manage the ability to modify the Default config, for now it will be hard coded
134 GetGlobalValue("Directories", settingsDirectoryNames[includes], stringList, defaultCompiler.includeDirs);
135 GetGlobalValue("Directories", settingsDirectoryNames[libraries], stringList, defaultCompiler.libraryDirs);
136 GetGlobalValue("Directories", settingsDirectoryNames[executables], stringList, defaultCompiler.executableDirs);
138 for(configName : configNames)
140 int len = strlen(configName);
144 char * section, * platformName = null;
145 section = new char[len + 17];
146 sprintf(section, "%s Compiler Config", configName);
147 GetGlobalValue(section, "Target Platform", singleString, &platformName);
148 compiler = CompilerConfig { name = configName, targetPlatform = platformName };
150 if(!compiler.targetPlatform)
151 compiler.targetPlatform = GetRuntimePlatform();
153 // TOCHECK these must call the property!
154 GetGlobalValue(section, makeCommandSetting, singleString, &v); compiler.makeCommand = v && v[0] ? v : makeDefaultCommand; delete v;
155 GetGlobalValue(section, ecpCommandSetting, singleString, &v); compiler.ecpCommand = v && v[0] ? v : ecpDefaultCommand; delete v;
156 GetGlobalValue(section, eccCommandSetting, singleString, &v); compiler.eccCommand = v && v[0] ? v : eccDefaultCommand; delete v;
157 GetGlobalValue(section, ecsCommandSetting, singleString, &v); compiler.ecsCommand = v && v[0] ? v : ecsDefaultCommand; delete v;
158 GetGlobalValue(section, earCommandSetting, singleString, &v); compiler.earCommand = v && v[0] ? v : earDefaultCommand; delete v;
159 GetGlobalValue(section, cPreprocessorCommandSetting, singleString, &v); compiler.cppCommand = v && v[0] ? v : cppDefaultCommand; delete v;
160 GetGlobalValue(section, cCompilerCommandSetting, singleString, &v); compiler.ccCommand = v && v[0] ? v : ccDefaultCommand; delete v;
161 GetGlobalValue(section, cCompilerCommandSetting, singleString, &v); compiler.cxxCommand = v && v[0] ? v : cxxDefaultCommand; delete v;
163 section = new char[len + 13];
164 sprintf(section, "%s Directories", configName);
165 GetGlobalValue(section, settingsDirectoryNames[includes], stringList, compiler.includeDirs);
166 GetGlobalValue(section, settingsDirectoryNames[libraries], stringList, compiler.libraryDirs);
167 GetGlobalValue(section, settingsDirectoryNames[executables], stringList, compiler.executableDirs);
170 compilerConfigs.Add(compiler);
176 GetGlobalValue("Recent", "Files", stringList, recentFiles);
178 GetGlobalValue("Recent", "Projects", stringList, recentProjects);
181 delete ideFileDialogLocation;
182 GetGlobalValue("FileOpenLocations", "Files", singleString, &ideFileDialogLocation);
184 delete ideProjectFileDialogLocation;
185 GetGlobalValue("FileOpenLocations", "Projects", singleString, &ideProjectFileDialogLocation);
188 GetGlobalValue("Editing", "UseFreeCaret", integer, &useFreeCaret);
189 GetGlobalValue("Editing", "CaretFollowsScrolling", integer, &caretFollowsScrolling);
190 GetGlobalValue("Editing", "ShowLineNumbers", integer, &showLineNumbers);
192 GetGlobalValue("Building", "NumParallelJobs", integer, &defaultCompiler.numJobs);
194 delete displayDriver;
195 GetGlobalValue("View", "DisplayDriver", singleString, &displayDriver);
199 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.
201 delete projectDefaultTargetDir;
202 GetGlobalValue(projectOptions, defaultTargetDir, singleString, &projectDefaultTargetDir);
203 if(!projectDefaultTargetDir || !projectDefaultTargetDir[0])
204 property::projectDefaultTargetDir = defaultObjDirExpression;
206 delete projectDefaultIntermediateObjDir;
207 GetGlobalValue(projectOptions, defaultIntermediateObjDir, singleString, &projectDefaultIntermediateObjDir);
208 if(!projectDefaultIntermediateObjDir || !projectDefaultIntermediateObjDir[0])
209 property::projectDefaultIntermediateObjDir = defaultObjDirExpression;
216 SettingsIOResult Save()
218 SettingsIOResult result = GlobalAppSettings::Save();
219 if(result == success)
221 Array<String> configNames { };
222 CompilerConfig compiler = compilerConfigs.firstIterator.data;
224 PutGlobalValue("Directories", settingsDirectoryNames[includes], stringList, compiler.includeDirs);
225 PutGlobalValue("Directories", settingsDirectoryNames[libraries], stringList, compiler.libraryDirs);
226 PutGlobalValue("Directories", settingsDirectoryNames[executables], stringList, compiler.executableDirs);
227 PutGlobalValue("Recent", "Files", stringList, recentFiles);
228 PutGlobalValue("Recent", "Projects", stringList, recentProjects);
230 PutGlobalValue("FileOpenLocations", "Files", singleString, ideFileDialogLocation);
231 PutGlobalValue("FileOpenLocations", "Projects", singleString, ideProjectFileDialogLocation);
233 PutGlobalValue("Editing", "UseFreeCaret", integer, (void *)useFreeCaret);
234 PutGlobalValue("Editing", "CaretFollowsScrolling", integer, (void *)caretFollowsScrolling);
235 PutGlobalValue("Editing", "ShowLineNumbers", integer, (void *)showLineNumbers);
237 PutGlobalValue("Building", "NumParallelJobs", integer, (void *)(compiler.numJobs));
238 PutGlobalValue("View", "DisplayDriver", singleString, displayDriver);
239 PutGlobalValue("Documentor", "Files", singleString, docDir);
241 PutGlobalValue(projectOptions, defaultTargetDir, singleString, projectDefaultTargetDir);
242 PutGlobalValue(projectOptions, defaultIntermediateObjDir, singleString, projectDefaultIntermediateObjDir);
244 for(compiler : compilerConfigs; compiler != compilerConfigs.firstIterator.data)
245 configNames.Add(CopyString(compiler.name));
247 PutGlobalValue("Compilers", "Configs", stringList, configNames);
249 for(compiler : compilerConfigs; compiler != compilerConfigs.firstIterator.data)
251 int len = strlen(compiler.name);
254 char * section, * platform;
255 section = new char[len + 17];
256 sprintf(section, "%s Compiler Config", compiler.name);
257 platform = compiler.targetPlatform.OnGetString(null, null, null);
258 PutGlobalValue(section, "Target Platform", singleString, platform);
259 PutGlobalValue(section, makeCommandSetting, singleString, compiler.makeCommand);
260 PutGlobalValue(section, ecpCommandSetting, singleString, compiler.ecpCommand);
261 PutGlobalValue(section, eccCommandSetting, singleString, compiler.eccCommand);
262 PutGlobalValue(section, ecsCommandSetting, singleString, compiler.ecsCommand);
263 PutGlobalValue(section, earCommandSetting, singleString, compiler.earCommand);
264 PutGlobalValue(section, cPreprocessorCommandSetting, singleString, compiler.cppCommand);
265 PutGlobalValue(section, cCompilerCommandSetting, singleString, compiler.ccCommand);
266 PutGlobalValue(section, cxxCompilerCommandSetting, singleString, compiler.cxxCommand);
268 section = new char[len + 13];
269 sprintf(section, "%s Directories", compiler.name);
270 PutGlobalValue(section, settingsDirectoryNames[includes], stringList, compiler.includeDirs);
271 PutGlobalValue(section, settingsDirectoryNames[libraries], stringList, compiler.libraryDirs);
272 PutGlobalValue(section, settingsDirectoryNames[executables], stringList, compiler.executableDirs);