Mercurial > projects > mde
comparison codeDoc/options.txt @ 16:9cb7b9310168
Improvements to Options and Init.
Revamped Options with sections and auto saving/loading.
Moved some of init's functions outside the module.
committer: Diggory Hardy <diggory.hardy@gmail.com>
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Sat, 15 Mar 2008 11:56:13 +0000 |
parents | |
children | 5f90774ea1ef |
comparison
equal
deleted
inserted
replaced
15:4608be19ebe2 | 16:9cb7b9310168 |
---|---|
1 Ideas for extending options to track user-changed options separately from system options so as not to override unchanged system options. | |
2 | |
3 I was inteding on implementing this, until I realised the extra complexity necessary. Also the gains in functionality seem tiny and not always desireable. | |
4 | |
5 Extract of doc. plus example: | |
6 | |
7 /** Base class for handling options. This class itself will handle no options and should not be | |
8 * instantiated, but sub-classes handle options. | |
9 * | |
10 * Each sub-class provides named variables for maximal-speed reading; however these cannot be used | |
11 * for changing options due to only changed options being written to the user file. | |
12 * | |
13 * The static class keeps track of all Options class instances for global loading and saving. | |
14 * | |
15 * Details: Options sub-classes hold associative arrays of pointers to all options, with char[] id. | |
16 * When options are changed, they also load all options from the user file to save back there. | |
17 * When an options GUI window is opened, option names and descriptions are loaded using the id and | |
18 * i18n.I18nTranslation (possibly not by the Options class), and possibly also system-level options | |
19 * are loaded to allow users to revert to these. | |
20 */ | |
21 class Options : IDataSection | |
22 { | |
23 bool example; | |
24 | |
25 bool*[char[]] optsBool; | |
26 bool[char[]] cgdOptsBool; | |
27 bool[char[]] sysOptsBool; | |
28 bool changed; sysLoaded; | |
29 | |
30 this () { | |
31 optsBool = ["example":&example]; | |
32 } | |
33 | |
34 ... | |
35 } | |
36 | |
37 From todo.txt: | |
38 Options: | |
39 -> types: | |
40 -> bool | |
41 -> int | |
42 -> char[] | |
43 -> float/double/real? | |
44 -> automated saving/loading | |
45 -> track whether any options have been changed | |
46 -> track all changed options (minus ones reverted to system confif) plus all options loaded from file to save to | |
47 -> symbols (static or associative arrays?) | |
48 -> read-only outside of class | |
49 -> a merge of "changed" and "system" | |
50 -> only part which needs to be loaded when not changing options | |
51 -> "Changed" symbols | |
52 -> constists of entries as above (changes above system config) | |
53 -> only loaded when an option is first changed? | |
54 -> use setter functions | |
55 -> change/add/remove from "changed" | |
56 -> change base symbols | |
57 -> "System" symbols | |
58 -> symbols only loaded from system-level config | |
59 -> only to show what the default setting to revert to is (since otherwise when removing a user change its system value wouldn't be known until config is reloaded) | |
60 -> only load when required | |
61 -> sections | |
62 -> one class per section | |
63 -> classes may be derived to provide their own handling | |
64 -> use separate files? Otherwise cannot efficiently load options on a per-section status with mtt files. | |
65 -> root or static class | |
66 -> parent of all sections | |
67 -> handles saving and loading |