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" : "make";
23 define ecpDefaultCommand = "ecp";
24 define eccDefaultCommand = "ecc";
25 define ecsDefaultCommand = "ecs";
26 define earDefaultCommand = "ear";
27 define cppDefaultCommand = "cpp";
28 define ccDefaultCommand = "gcc";
29 define cxxDefaultCommand = "g++";
31 class OldIDESettings : GlobalAppSettings
34 settingsName = "ecereIDESettingsTest";
36 settingsName = "ecereIDE";
39 List<CompilerConfig> compilerConfigs { };
40 Array<String> recentFiles { };
41 Array<String> recentProjects { };
43 char * ideFileDialogLocation;
44 char * ideProjectFileDialogLocation;
47 bool caretFollowsScrolling;
51 showLineNumbers = true;
52 caretFollowsScrolling = true;
55 char * projectDefaultTargetDir;
56 property char * projectDefaultTargetDir
58 set { delete projectDefaultTargetDir; if(value && value[0]) projectDefaultTargetDir = CopyString(value); }
59 get { return projectDefaultTargetDir ? projectDefaultTargetDir : ""; }
61 char * projectDefaultIntermediateObjDir;
62 property char * projectDefaultIntermediateObjDir
64 set { delete projectDefaultIntermediateObjDir; if(value && value[0]) projectDefaultIntermediateObjDir = CopyString(value); }
65 get { return projectDefaultIntermediateObjDir ? projectDefaultIntermediateObjDir : ""; }
68 CompilerConfig GetCompilerConfig(String compilerName)
70 char * name = compilerName && compilerName[0] ? compilerName : defaultCompilerName;
71 CompilerConfig compilerConfig = null;
72 for(compiler : compilerConfigs)
74 if(!strcmp(compiler.name, name))
76 compilerConfig = compiler;
80 if(!compilerConfig && compilerConfigs.count)
81 compilerConfig = compilerConfigs.firstIterator.data;
83 incref compilerConfig;
84 return compilerConfig;
89 compilerConfigs.Free();
91 recentProjects.Free();
94 delete projectDefaultTargetDir;
95 delete projectDefaultIntermediateObjDir;
97 delete ideFileDialogLocation;
98 delete ideProjectFileDialogLocation;
102 void OnAskReloadSettings()
104 /*if(MessageBox { type = YesNo, master = this,
105 text = "Global Settings Modified Externally",
106 contents = "The global settings were modified by another instance.\n"
107 "Would you like to reload them?" }.Modal() == Yes)*/
115 bool result = GlobalAppSettings::Load() == success;
118 Array<String> configNames { };
119 CompilerConfig compiler;
121 CompilerConfig defaultCompiler = MakeDefaultCompiler(defaultCompilerName, true);
122 compilerConfigs.Free();
123 compilerConfigs.Add(defaultCompiler);
126 GetGlobalValue("Compilers", "Configs", stringList, configNames);
127 // todo manage the ability to modify the Default config, for now it will be hard coded
129 GetGlobalValue("Directories", settingsDirectoryNames[includes], stringList, defaultCompiler.includeDirs);
130 GetGlobalValue("Directories", settingsDirectoryNames[libraries], stringList, defaultCompiler.libraryDirs);
131 GetGlobalValue("Directories", settingsDirectoryNames[executables], stringList, defaultCompiler.executableDirs);
133 for(configName : configNames)
135 int len = strlen(configName);
139 char * section, * platformName = null;
140 section = new char[len + 17];
141 sprintf(section, "%s Compiler Config", configName);
142 GetGlobalValue(section, "Target Platform", singleString, &platformName);
143 compiler = CompilerConfig { name = configName, targetPlatform = platformName };
145 if(!compiler.targetPlatform)
146 compiler.targetPlatform = GetRuntimePlatform();
148 // TOCHECK these must call the property!
149 GetGlobalValue(section, makeCommandSetting, singleString, &v); compiler.makeCommand = v && v[0] ? v : makeDefaultCommand; delete v;
150 GetGlobalValue(section, ecpCommandSetting, singleString, &v); compiler.ecpCommand = v && v[0] ? v : ecpDefaultCommand; delete v;
151 GetGlobalValue(section, eccCommandSetting, singleString, &v); compiler.eccCommand = v && v[0] ? v : eccDefaultCommand; delete v;
152 GetGlobalValue(section, ecsCommandSetting, singleString, &v); compiler.ecsCommand = v && v[0] ? v : ecsDefaultCommand; delete v;
153 GetGlobalValue(section, earCommandSetting, singleString, &v); compiler.earCommand = v && v[0] ? v : earDefaultCommand; delete v;
154 GetGlobalValue(section, cPreprocessorCommandSetting, singleString, &v); compiler.cppCommand = v && v[0] ? v : cppDefaultCommand; delete v;
155 GetGlobalValue(section, cCompilerCommandSetting, singleString, &v); compiler.ccCommand = v && v[0] ? v : ccDefaultCommand; delete v;
156 GetGlobalValue(section, cCompilerCommandSetting, singleString, &v); compiler.cxxCommand = v && v[0] ? v : cxxDefaultCommand; delete v;
158 section = new char[len + 13];
159 sprintf(section, "%s Directories", configName);
160 GetGlobalValue(section, settingsDirectoryNames[includes], stringList, compiler.includeDirs);
161 GetGlobalValue(section, settingsDirectoryNames[libraries], stringList, compiler.libraryDirs);
162 GetGlobalValue(section, settingsDirectoryNames[executables], stringList, compiler.executableDirs);
165 compilerConfigs.Add(compiler);
171 GetGlobalValue("Recent", "Files", stringList, recentFiles);
173 GetGlobalValue("Recent", "Projects", stringList, recentProjects);
176 delete ideFileDialogLocation;
177 GetGlobalValue("FileOpenLocations", "Files", singleString, &ideFileDialogLocation);
179 delete ideProjectFileDialogLocation;
180 GetGlobalValue("FileOpenLocations", "Projects", singleString, &ideProjectFileDialogLocation);
183 GetGlobalValue("Editing", "UseFreeCaret", integer, &useFreeCaret);
184 GetGlobalValue("Editing", "CaretFollowsScrolling", integer, &caretFollowsScrolling);
185 GetGlobalValue("Editing", "ShowLineNumbers", integer, &showLineNumbers);
187 GetGlobalValue("Building", "NumParallelJobs", integer, &defaultCompiler.numJobs);
189 delete displayDriver;
190 GetGlobalValue("View", "DisplayDriver", singleString, &displayDriver);
194 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.
196 delete projectDefaultTargetDir;
197 GetGlobalValue(projectOptions, defaultTargetDir, singleString, &projectDefaultTargetDir);
198 if(!projectDefaultTargetDir || !projectDefaultTargetDir[0])
199 property::projectDefaultTargetDir = defaultObjDirExpression;
201 delete projectDefaultIntermediateObjDir;
202 GetGlobalValue(projectOptions, defaultIntermediateObjDir, singleString, &projectDefaultIntermediateObjDir);
203 if(!projectDefaultIntermediateObjDir || !projectDefaultIntermediateObjDir[0])
204 property::projectDefaultIntermediateObjDir = defaultObjDirExpression;
213 if(GlobalAppSettings::Save())
215 Array<String> configNames { };
216 CompilerConfig compiler = compilerConfigs.firstIterator.data;
218 PutGlobalValue("Directories", settingsDirectoryNames[includes], stringList, compiler.includeDirs);
219 PutGlobalValue("Directories", settingsDirectoryNames[libraries], stringList, compiler.libraryDirs);
220 PutGlobalValue("Directories", settingsDirectoryNames[executables], stringList, compiler.executableDirs);
221 PutGlobalValue("Recent", "Files", stringList, recentFiles);
222 PutGlobalValue("Recent", "Projects", stringList, recentProjects);
224 PutGlobalValue("FileOpenLocations", "Files", singleString, ideFileDialogLocation);
225 PutGlobalValue("FileOpenLocations", "Projects", singleString, ideProjectFileDialogLocation);
227 PutGlobalValue("Editing", "UseFreeCaret", integer, (void *)useFreeCaret);
228 PutGlobalValue("Editing", "CaretFollowsScrolling", integer, (void *)caretFollowsScrolling);
229 PutGlobalValue("Editing", "ShowLineNumbers", integer, (void *)showLineNumbers);
231 PutGlobalValue("Building", "NumParallelJobs", integer, (void *)(compiler.numJobs));
232 PutGlobalValue("View", "DisplayDriver", singleString, displayDriver);
233 PutGlobalValue("Documentor", "Files", singleString, docDir);
235 PutGlobalValue(projectOptions, defaultTargetDir, singleString, projectDefaultTargetDir);
236 PutGlobalValue(projectOptions, defaultIntermediateObjDir, singleString, projectDefaultIntermediateObjDir);
238 for(compiler : compilerConfigs; compiler != compilerConfigs.firstIterator.data)
239 configNames.Add(CopyString(compiler.name));
241 PutGlobalValue("Compilers", "Configs", stringList, configNames);
243 for(compiler : compilerConfigs; compiler != compilerConfigs.firstIterator.data)
245 int len = strlen(compiler.name);
248 char * section, * platform;
249 section = new char[len + 17];
250 sprintf(section, "%s Compiler Config", compiler.name);
251 platform = compiler.targetPlatform.OnGetString(null, null, null);
252 PutGlobalValue(section, "Target Platform", singleString, platform);
253 PutGlobalValue(section, makeCommandSetting, singleString, compiler.makeCommand);
254 PutGlobalValue(section, ecpCommandSetting, singleString, compiler.ecpCommand);
255 PutGlobalValue(section, eccCommandSetting, singleString, compiler.eccCommand);
256 PutGlobalValue(section, ecsCommandSetting, singleString, compiler.ecsCommand);
257 PutGlobalValue(section, earCommandSetting, singleString, compiler.earCommand);
258 PutGlobalValue(section, cPreprocessorCommandSetting, singleString, compiler.cppCommand);
259 PutGlobalValue(section, cCompilerCommandSetting, singleString, compiler.ccCommand);
260 PutGlobalValue(section, cxxCompilerCommandSetting, singleString, compiler.cxxCommand);
262 section = new char[len + 13];
263 sprintf(section, "%s Directories", compiler.name);
264 PutGlobalValue(section, settingsDirectoryNames[includes], stringList, compiler.includeDirs);
265 PutGlobalValue(section, settingsDirectoryNames[libraries], stringList, compiler.libraryDirs);
266 PutGlobalValue(section, settingsDirectoryNames[executables], stringList, compiler.executableDirs);