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
31 settingsName = ideSettingsName;
33 List<CompilerConfig> compilerConfigs { };
34 Array<String> recentFiles { };
35 Array<String> recentProjects { };
37 char * ideFileDialogLocation;
38 char * ideProjectFileDialogLocation;
41 bool caretFollowsScrolling;
44 useFreeCaret = false; //true;
45 showLineNumbers = true;
46 caretFollowsScrolling = false; //true;
49 char * projectDefaultTargetDir;
50 property const char * projectDefaultTargetDir
52 set { delete projectDefaultTargetDir; if(value && value[0]) projectDefaultTargetDir = CopyString(value); }
53 get { return projectDefaultTargetDir ? projectDefaultTargetDir : ""; }
55 char * projectDefaultIntermediateObjDir;
56 property const char * projectDefaultIntermediateObjDir
58 set { delete projectDefaultIntermediateObjDir; if(value && value[0]) projectDefaultIntermediateObjDir = CopyString(value); }
59 get { return projectDefaultIntermediateObjDir ? projectDefaultIntermediateObjDir : ""; }
62 CompilerConfig GetCompilerConfig(const String compilerName)
64 const char * name = compilerName && compilerName[0] ? compilerName : defaultCompilerName;
65 CompilerConfig compilerConfig = null;
66 for(compiler : compilerConfigs)
68 if(!strcmp(compiler.name, name))
70 compilerConfig = compiler;
74 if(!compilerConfig && compilerConfigs.count)
75 compilerConfig = compilerConfigs.firstIterator.data;
77 incref compilerConfig;
78 return compilerConfig;
83 compilerConfigs.Free();
85 recentProjects.Free();
88 delete projectDefaultTargetDir;
89 delete projectDefaultIntermediateObjDir;
91 delete ideFileDialogLocation;
92 delete ideProjectFileDialogLocation;
96 void OnAskReloadSettings()
98 /*if(MessageBox { type = YesNo, master = this,
99 text = "Global Settings Modified Externally",
100 contents = "The global settings were modified by another instance.\n"
101 "Would you like to reload them?" }.Modal() == Yes)*/
107 SettingsIOResult Load()
109 SettingsIOResult result = GlobalAppSettings::Load();
110 if(result == success)
112 Array<String> configNames { };
113 CompilerConfig compiler;
115 CompilerConfig defaultCompiler = MakeDefaultCompiler(defaultCompilerName, true);
116 compilerConfigs.Free();
117 compilerConfigs.Add(defaultCompiler);
120 GetGlobalValue("Compilers", "Configs", stringList, configNames);
121 // todo manage the ability to modify the Default config, for now it will be hard coded
123 GetGlobalValue("Directories", settingsDirectoryNames[includes], stringList, defaultCompiler.includeDirs);
124 GetGlobalValue("Directories", settingsDirectoryNames[libraries], stringList, defaultCompiler.libraryDirs);
125 GetGlobalValue("Directories", settingsDirectoryNames[executables], stringList, defaultCompiler.executableDirs);
127 for(configName : configNames)
129 int len = strlen(configName);
133 char * section, * platformName = null;
134 section = new char[len + 17];
135 sprintf(section, "%s Compiler Config", configName);
136 GetGlobalValue(section, "Target Platform", singleString, &platformName);
137 compiler = CompilerConfig { name = configName, targetPlatform = platformName };
139 if(!compiler.targetPlatform)
140 compiler.targetPlatform = __runtimePlatform;
142 // TOCHECK these must call the property!
143 GetGlobalValue(section, makeCommandSetting, singleString, &v); compiler.makeCommand = v && v[0] ? v : makeDefaultCommand; delete v;
144 GetGlobalValue(section, ecpCommandSetting, singleString, &v); compiler.ecpCommand = v && v[0] ? v : ecpDefaultCommand; delete v;
145 GetGlobalValue(section, eccCommandSetting, singleString, &v); compiler.eccCommand = v && v[0] ? v : eccDefaultCommand; delete v;
146 GetGlobalValue(section, ecsCommandSetting, singleString, &v); compiler.ecsCommand = v && v[0] ? v : ecsDefaultCommand; delete v;
147 GetGlobalValue(section, earCommandSetting, singleString, &v); compiler.earCommand = v && v[0] ? v : earDefaultCommand; delete v;
148 GetGlobalValue(section, cPreprocessorCommandSetting, singleString, &v); compiler.cppCommand = v && v[0] ? v : cppDefaultCommand; delete v;
149 GetGlobalValue(section, cCompilerCommandSetting, singleString, &v); compiler.ccCommand = v && v[0] ? v : ccDefaultCommand; delete v;
150 GetGlobalValue(section, cCompilerCommandSetting, singleString, &v); compiler.cxxCommand = v && v[0] ? v : cxxDefaultCommand; delete v;
152 section = new char[len + 13];
153 sprintf(section, "%s Directories", configName);
154 GetGlobalValue(section, settingsDirectoryNames[includes], stringList, compiler.includeDirs);
155 GetGlobalValue(section, settingsDirectoryNames[libraries], stringList, compiler.libraryDirs);
156 GetGlobalValue(section, settingsDirectoryNames[executables], stringList, compiler.executableDirs);
159 compilerConfigs.Add(compiler);
165 GetGlobalValue("Recent", "Files", stringList, recentFiles);
167 GetGlobalValue("Recent", "Projects", stringList, recentProjects);
170 delete ideFileDialogLocation;
171 GetGlobalValue("FileOpenLocations", "Files", singleString, &ideFileDialogLocation);
173 delete ideProjectFileDialogLocation;
174 GetGlobalValue("FileOpenLocations", "Projects", singleString, &ideProjectFileDialogLocation);
177 GetGlobalValue("Editing", "UseFreeCaret", integer, &useFreeCaret);
178 GetGlobalValue("Editing", "CaretFollowsScrolling", integer, &caretFollowsScrolling);
179 GetGlobalValue("Editing", "ShowLineNumbers", integer, &showLineNumbers);
181 GetGlobalValue("Building", "NumParallelJobs", integer, &defaultCompiler.numJobs);
183 delete displayDriver;
184 GetGlobalValue("View", "DisplayDriver", singleString, &displayDriver);
188 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.
190 delete projectDefaultTargetDir;
191 GetGlobalValue(projectOptions, defaultTargetDir, singleString, &projectDefaultTargetDir);
192 if(!projectDefaultTargetDir || !projectDefaultTargetDir[0])
193 property::projectDefaultTargetDir = defaultObjDirExpression;
195 delete projectDefaultIntermediateObjDir;
196 GetGlobalValue(projectOptions, defaultIntermediateObjDir, singleString, &projectDefaultIntermediateObjDir);
197 if(!projectDefaultIntermediateObjDir || !projectDefaultIntermediateObjDir[0])
198 property::projectDefaultIntermediateObjDir = defaultObjDirExpression;
205 SettingsIOResult Save()
207 SettingsIOResult result = GlobalAppSettings::Save();
208 if(result == success)
210 Array<String> configNames { };
211 CompilerConfig compiler = compilerConfigs.firstIterator.data;
213 PutGlobalValue("Directories", settingsDirectoryNames[includes], stringList, compiler.includeDirs);
214 PutGlobalValue("Directories", settingsDirectoryNames[libraries], stringList, compiler.libraryDirs);
215 PutGlobalValue("Directories", settingsDirectoryNames[executables], stringList, compiler.executableDirs);
216 PutGlobalValue("Recent", "Files", stringList, recentFiles);
217 PutGlobalValue("Recent", "Projects", stringList, recentProjects);
219 PutGlobalValue("FileOpenLocations", "Files", singleString, ideFileDialogLocation);
220 PutGlobalValue("FileOpenLocations", "Projects", singleString, ideProjectFileDialogLocation);
222 PutGlobalValue("Editing", "UseFreeCaret", integer, (void *)(intptr)useFreeCaret);
223 PutGlobalValue("Editing", "CaretFollowsScrolling", integer, (void *)(intptr)caretFollowsScrolling);
224 PutGlobalValue("Editing", "ShowLineNumbers", integer, (void *)(intptr)showLineNumbers);
226 PutGlobalValue("Building", "NumParallelJobs", integer, (void *)(intptr)(compiler.numJobs));
227 PutGlobalValue("View", "DisplayDriver", singleString, displayDriver);
228 PutGlobalValue("Documentor", "Files", singleString, docDir);
230 PutGlobalValue(projectOptions, defaultTargetDir, singleString, projectDefaultTargetDir);
231 PutGlobalValue(projectOptions, defaultIntermediateObjDir, singleString, projectDefaultIntermediateObjDir);
233 for(compiler : compilerConfigs; compiler != compilerConfigs.firstIterator.data)
234 configNames.Add(CopyString(compiler.name));
236 PutGlobalValue("Compilers", "Configs", stringList, configNames);
238 for(compiler : compilerConfigs; compiler != compilerConfigs.firstIterator.data)
240 int len = strlen(compiler.name);
243 char * section = new char[len + 17];
244 const char * platform;
245 sprintf(section, "%s Compiler Config", compiler.name);
246 platform = compiler.targetPlatform.OnGetString(null, null, null);
247 PutGlobalValue(section, "Target Platform", singleString, platform);
248 PutGlobalValue(section, makeCommandSetting, singleString, compiler.makeCommand);
249 PutGlobalValue(section, ecpCommandSetting, singleString, compiler.ecpCommand);
250 PutGlobalValue(section, eccCommandSetting, singleString, compiler.eccCommand);
251 PutGlobalValue(section, ecsCommandSetting, singleString, compiler.ecsCommand);
252 PutGlobalValue(section, earCommandSetting, singleString, compiler.earCommand);
253 PutGlobalValue(section, cPreprocessorCommandSetting, singleString, compiler.cppCommand);
254 PutGlobalValue(section, cCompilerCommandSetting, singleString, compiler.ccCommand);
255 PutGlobalValue(section, cxxCompilerCommandSetting, singleString, compiler.cxxCommand);
257 section = new char[len + 13];
258 sprintf(section, "%s Directories", compiler.name);
259 PutGlobalValue(section, settingsDirectoryNames[includes], stringList, compiler.includeDirs);
260 PutGlobalValue(section, settingsDirectoryNames[libraries], stringList, compiler.libraryDirs);
261 PutGlobalValue(section, settingsDirectoryNames[executables], stringList, compiler.executableDirs);