Mercurial > projects > mde
annotate mde/lookup/Options.d @ 70:7fc0a8295c83
Moved my parseTo and parseFrom modules from tango.scrapple to mde in order to reduce dependencies.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Fri, 04 Jul 2008 19:04:16 +0100 |
parents | 108d123238c0 |
children | 159775502bb4 |
rev | line source |
---|---|
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
1 /* LICENSE BLOCK |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
2 Part of mde: a Modular D game-oriented Engine |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
3 Copyright © 2007-2008 Diggory Hardy |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
4 |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
5 This program is free software: you can redistribute it and/or modify it under the terms |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
6 of the GNU General Public License as published by the Free Software Foundation, either |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
7 version 2 of the License, or (at your option) any later version. |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
8 |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
9 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
10 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
11 See the GNU General Public License for more details. |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
12 |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
13 You should have received a copy of the GNU General Public License |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
14 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
15 |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
16 /** This module handles stored options, currently all except input maps. |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
17 * |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
18 * The purpose of having all options centrally controlled is to allow generic handling by the GUI |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
19 * and ease saving and loading of values. The Options class is only really designed around handling |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
20 * small numbers of variables for now. |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
21 */ |
63
66d555da083e
Moved many modules/packages to better reflect usage.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
22 module mde.lookup.Options; |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
23 |
70
7fc0a8295c83
Moved my parseTo and parseFrom modules from tango.scrapple to mde in order to reduce dependencies.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
67
diff
changeset
|
24 import mde.setup.paths; |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
25 import mde.exception; |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
26 |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
27 import mde.mergetag.Reader; |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
28 import mde.mergetag.Writer; |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
29 import mde.mergetag.DataSet; |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
30 import mde.mergetag.exception; |
70
7fc0a8295c83
Moved my parseTo and parseFrom modules from tango.scrapple to mde in order to reduce dependencies.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
67
diff
changeset
|
31 import mde.mergetag.parse.parseTo : parseTo; |
7fc0a8295c83
Moved my parseTo and parseFrom modules from tango.scrapple to mde in order to reduce dependencies.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
67
diff
changeset
|
32 import mde.mergetag.parse.parseFrom : parseFrom; |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
33 |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
34 import tango.core.Exception : ArrayBoundsException; |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
35 import tango.util.log.Log : Log, Logger; |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
36 |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
37 /** Base class for handling options. |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
38 * |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
39 * This class itself handles no options and should not be instantiated, but provides a sub-classable |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
40 * base for generic options handling. Also, the static portion of this class tracks sub-class |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
41 * instances and provides loading and saving methods. |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
42 * |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
43 * Each sub-class provides named variables for maximal-speed reading. Local sub-class references |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
44 * should be used for reading variables, and via the addOptionsClass() hook will be loaded from |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
45 * files during pre-init (init0 stage). Do not write changes directly to the subclasses or they will |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
46 * not be saved; instead use set(), for example, miscOpts.set!(char[])("L10n","en-GB"). Use an |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
47 * example like OptionsMisc as a template for creating a new Options sub-class. |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
48 * |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
49 * Details: Options sub-classes hold associative arrays of pointers to all option variables, with a |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
50 * char[] id. This list is used for saving, loading and to provide generic GUI options screens. The |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
51 * built-in support in Options is only for bool, int and char[] types (a float type may get added). |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
52 * Further to this, a generic class is used to store all options which have been changed, and if any |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
53 * have been changed, is merged with options from the user conf dir and saved on exit. |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
54 */ |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
55 class Options : IDataSection |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
56 { |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
57 // All supported types, for generic handling via templates. It should be possible to change |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
58 // the supported types simply by changing this list now (untested). |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
59 template store(A...) { alias A store; } |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
60 alias store!(bool, int, double, char[]) TYPES; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
61 //BEGIN Templates: internal |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
62 private { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
63 // Get name of a type. Basically just stringof, but special handling for arrays. |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
64 // Use TName!(T) for a valid symbol name, and T.stringof for a type. |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
65 template TName(T : T[]) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
66 const char[] TName = TName!(T) ~ "A"; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
67 } |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
68 template TName(T) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
69 const char[] TName = T.stringof; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
70 } |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
71 |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
72 // Pointer lists |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
73 template PLists(T, A...) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
74 static if (A.length) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
75 const char[] PLists = T.stringof~"*[ID] opts"~TName!(T)~";\n" ~ PLists!(A); |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
76 } else |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
77 const char[] PLists = T.stringof~"*[ID] opts"~TName!(T)~";\n"; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
78 } |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
79 |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
80 // True if type is one of A |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
81 template TIsIn(T, A...) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
82 static if (A.length) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
83 static if (is(T == A[0])) |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
84 const bool TIsIn = true; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
85 else |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
86 const bool TIsIn = TIsIn!(T,A[1..$]); |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
87 } else |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
88 const bool TIsIn = false; // no more possibilities |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
89 } |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
90 |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
91 // For addTag |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
92 template addTagMixin(T, A...) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
93 const char[] ifBlock = `if (tp == "`~T.stringof~`") { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
94 `~T.stringof~`** p = id in opts`~TName!(T)~`; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
95 if (p !is null) **p = parseTo!(`~T.stringof~`) (dt); |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
96 }`; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
97 static if (A.length) |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
98 const char[] addTagMixin = ifBlock~` else `~addTagMixin!(A).addTagMixin; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
99 else |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
100 const char[] addTagMixin = ifBlock; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
101 } |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
102 |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
103 // For writeAll |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
104 template writeAllMixin(A...) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
105 static if (A.length) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
106 const char[] writeAllMixin = |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
107 `foreach (ID id, `~A[0].stringof~`* val; opts`~TName!(A[0])~`) dlg ("`~A[0].stringof~`", id, parseFrom!(`~A[0].stringof~`) (*val));` ~ writeAllMixin!(A[1..$]); |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
108 } else |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
109 const char[] writeAllMixin = ``; |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
110 } |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
111 } |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
112 //END Templates: internal |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
113 |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
114 |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
115 //BEGIN Static |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
116 static { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
117 /** Add an options sub-class to the list for loading and saving. |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
118 * |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
119 * Call from static this() (before Init calls load()). */ |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
120 void addOptionsClass (Options c, char[] i) |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
121 in { // Trap a couple of potential coding errors: |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
122 assert (c !is null); // Instance must be created before calling addOptionsClass |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
123 assert (((cast(ID) i) in subClasses) is null); // Don't allow a silent replacement |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
124 } body { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
125 subClasses[cast(ID) i] = c; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
126 } |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
127 |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
128 // Track all sections for saving/loading/other generic handling. |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
129 Options[ID] subClasses; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
130 bool changed = false; // any changes at all, i.e. do we need to save? |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
131 |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
132 /* Load/save options from file. |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
133 * |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
134 * If the file doesn't exist, no reading is attempted (options are left at default values). |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
135 */ |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
136 private const fileName = "options"; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
137 void load () { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
138 // Check it exists (if not it should still be created on exit). |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
139 // Don't bother checking it's not a folder, because it could still be a block or something. |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
140 if (!confDir.exists (fileName)) return; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
141 |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
142 try { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
143 IReader reader; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
144 reader = confDir.makeMTReader (fileName, PRIORITY.LOW_HIGH); |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
145 reader.dataSecCreator = delegate IDataSection(ID id) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
146 /* Recognise each defined section, and return null for unrecognised sections. */ |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
147 Options* p = id in subClasses; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
148 if (p !is null) return *p; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
149 else return null; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
150 }; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
151 reader.read; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
152 } catch (MTException e) { |
67
108d123238c0
Changes to work with tango r3700 (post 0.99.6).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
64
diff
changeset
|
153 logger.fatal ("Loading options aborted:"); |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
154 logger.fatal (e.msg); |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
155 throw new optionsLoadException ("Mergetag exception (see above message)"); |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
156 } |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
157 } |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
158 void save () { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
159 if (!changed) return; // no changes to save |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
160 |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
161 DataSet ds = new DataSet(); |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
162 foreach (id, subOpts; subClasses) ds.sec[id] = subOpts.optionChanges; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
163 |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
164 // Read locally-stored options |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
165 try { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
166 IReader reader; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
167 reader = confDir.makeMTReader (fileName, PRIORITY.HIGH_ONLY, ds); |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
168 reader.dataSecCreator = delegate IDataSection(ID id) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
169 return null; // All recognised sections are already in the dataset. |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
170 }; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
171 reader.read; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
172 } catch (MTFileIOException) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
173 // File either didn't exist or couldn't be opened. |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
174 // Presuming the former, this is not a problem. |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
175 } catch (MTException e) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
176 // Log a message and continue, overwriting the file: |
67
108d123238c0
Changes to work with tango r3700 (post 0.99.6).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
64
diff
changeset
|
177 logger.error ("Loading options aborted:"); |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
178 logger.error (e.msg); |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
179 } |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
180 |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
181 try { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
182 IWriter writer; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
183 writer = confDir.makeMTWriter (fileName, ds); |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
184 writer.write(); |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
185 } catch (MTException e) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
186 logger.error ("Saving options aborted! Reason:"); |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
187 logger.error (e.msg); |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
188 } |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
189 } |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
190 |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
191 private Logger logger; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
192 static this() { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
193 logger = Log.getLogger ("mde.options"); |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
194 } |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
195 } |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
196 //END Static |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
197 |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
198 |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
199 //BEGIN Non-static |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
200 /** Set option symbol of an Options sub-class to val. |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
201 * |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
202 * Due to the way options are handled generically, string IDs must be used to access the options |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
203 * via hash-maps, which is a little slower than direct access but necessary since the option |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
204 * must be changed in two separate places. */ |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
205 void set(T) (char[] symbol, T val) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
206 static if (!TIsIn!(T,TYPES)) |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
207 static assert (false, "Options.set does not currently support type "~T.stringof); |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
208 |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
209 mixin (`alias opts`~T.stringof~` optsVars;`); |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
210 |
36
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
32
diff
changeset
|
211 changed = true; // something got set (don't bother checking this isn't what it already was) |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
32
diff
changeset
|
212 |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
32
diff
changeset
|
213 try { |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
214 *(optsVars[cast(ID) symbol]) = val; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
215 optionChanges.set!(T) (cast(ID) symbol, val); |
36
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
32
diff
changeset
|
216 } catch (ArrayBoundsException) { |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
32
diff
changeset
|
217 // log and ignore: |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
218 logger.error ("Options.set: unkw!"); |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
219 } |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
220 } |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
221 |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
222 protected { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
223 OptionChanges optionChanges; // all changes to options (for saving) |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
224 |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
225 // The "pointer lists": |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
226 mixin (PLists!(TYPES)); |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
227 } |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
228 |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
229 //BEGIN Mergetag loading/saving code |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
230 void addTag (char[] tp, ID id, char[] dt) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
231 mixin(addTagMixin!(TYPES).addTagMixin); |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
232 } |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
233 |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
234 void writeAll (ItemDelg dlg) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
235 mixin(writeAllMixin!(TYPES)); |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
236 } |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
237 //END Mergetag loading/saving code |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
238 //END Non-static |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
239 |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
240 |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
241 //BEGIN Templates: impl & optionsThis |
50
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
242 private { |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
243 // Return index of first comma, or halts if not found. |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
244 template cIndex(char[] A) { |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
245 static if (A.length == 0) |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
246 static assert (false, "Error in implementation"); |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
247 else static if (A[0] == ',') |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
248 const size_t cIndex = 0; |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
249 else |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
250 const size_t cIndex = 1 + cIndex!(A[1..$]); |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
251 } |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
252 // Return index of first semi-colon, or halts if not found. |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
253 template scIndex(char[] A) { |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
254 static if (A.length == 0) |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
255 static assert (false, "Error: no trailing semi-colon"); |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
256 else static if (A[0] == ';') |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
257 const size_t scIndex = 0; |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
258 else |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
259 const size_t scIndex = 1 + scIndex!(A[1..$]); |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
260 } |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
261 // Look for "type symbols;" in A and return symbols as a comma separated list of names |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
262 // (even if type is encountered more than once). Output may contain spaces and, if |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
263 // non-empty, will contain a trailing comma. Assumes scIndex always returns less than A.$. |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
264 template parseT(char[] type, char[] A) { |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
265 static if (A.length < type.length + 1) // end of input, no match |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
266 const char[] parseT = ""; |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
267 else static if (A[0] == ' ') // leading whitespace: skip |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
268 const char[] parseT = parseT!(type, A[1..$]); |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
269 else static if (A[0..type.length] == type && A[type.length] == ' ') // match |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
270 const char[] parseT = A[type.length+1 .. scIndex!(A)] ~ "," ~ |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
271 parseT!(type, A[scIndex!(A)+1 .. $]); |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
272 else // no match |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
273 const char[] parseT = parseT!(type, A[scIndex!(A)+1 .. $]); |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
274 } |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
275 // May have a trailing comma. Assumes cIndex always returns less than A.$. |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
276 template aaVars(char[] A) { |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
277 static if (A.length == 0) |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
278 const char[] aaVars = ""; |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
279 else static if (A[0] == ' ') |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
280 const char[] aaVars = aaVars!(A[1..$]); |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
281 else |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
282 const char[] aaVars = "\""~A[0..cIndex!(A)]~"\"[]:&"~A[0..cIndex!(A)] ~ "," ~ |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
283 aaVars!(A[cIndex!(A)+1..$]); |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
284 } |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
285 // strip Trailing Comma |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
286 template sTC(char[] A) { |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
287 static if (A.length && A[$-1] == ',') |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
288 const char[] sTC = A[0..$-1]; |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
289 else |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
290 const char[] sTC = A; |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
291 } |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
292 // if string is empty (other than space) return null, otherwise enclose: [A] |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
293 template listOrNull(char[] A) { |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
294 static if (A.length == 0) |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
295 const char[] listOrNull = "null"; |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
296 else static if (A[0] == ' ') |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
297 const char[] listOrNull = listOrNull!(A[1..$]); |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
298 else |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
299 const char[] listOrNull = "["~A~"]"; |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
300 } |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
301 // for recursing on TYPES |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
302 template optionsThisInternal(char[] A, B...) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
303 static if (B.length) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
304 const char[] optionsThisInternal = `opts`~TName!(B[0])~` = `~listOrNull!(sTC!(aaVars!(parseT!(B[0].stringof,A))))~";\n" ~ optionsThisInternal!(A,B[1..$]); |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
305 } else |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
306 const char[] optionsThisInternal = ``; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
307 } |
50
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
308 } protected { |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
309 /** Produces the implementation code to go in the constuctor. */ |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
310 template optionsThis(char[] A) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
311 const char[] optionsThis = |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
312 "optionChanges = new OptionChanges;\n" ~ |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
313 optionsThisInternal!(A,TYPES); |
50
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
314 } |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
315 /+ Needs too many custom parameters to be worth it? Plus makes class less readable. |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
316 /** Produces the implementation code to go in the static constuctor. */ |
50
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
317 template optClassAdd(char[] symb) { |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
318 const char[] optClassAdd = symb ~ "=new "~classinfo(this).name~";\n";//Options.addOptionsClass("~symb~", );\n"; |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
319 }+/ |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
320 /** mixin impl("type symbol[, symbol[...]];[type symbol[...];][...]") |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
321 * |
62
960206198cbd
Documentation changes only. (Idea for new gui.content.Items module; unused gl.texture module commented out.)
Diggory Hardy <diggory.hardy@gmail.com>
parents:
53
diff
changeset
|
322 * Where type is one of bool, int, double, char[]. E.g. |
50
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
323 * --- |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
324 * mixin (impl ("bool a, b; int i;")); |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
325 * --- |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
326 * |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
327 * In case this() needs to be customized, mixin(impl!(A)) is equivalent to: |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
328 * --- |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
329 * mixin (A~` |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
330 this () { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
331 `~optionsThis!(A)~` |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
332 }`); |
50
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
333 * --- |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
334 * |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
335 * Notes: Only use space as whitespace (no new-lines or tabs). Make sure to add a trailing |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
336 * semi-colon (;) or you'll get told off! :D |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
337 * In general errors aren't reported well. Trial with pragma (msg, impl!(...)); if |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
338 * necessary. |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
339 * |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
340 * Extending: mixins could also be used for the static this() {...} or even the whole |
62
960206198cbd
Documentation changes only. (Idea for new gui.content.Items module; unused gl.texture module commented out.)
Diggory Hardy <diggory.hardy@gmail.com>
parents:
53
diff
changeset
|
341 * class, but doing so would rather decrease readability of any implementation. */ |
50
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
342 template impl(char[] A /+, char[] symb+/) { |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
343 const char[] impl = A~"\nthis(){\n"~optionsThis!(A)~"}"; |
50
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
344 // ~"\nstatic this(){\n"~optClassAdd!(symb)~"}" |
f68ae1d667f9
Options: impl template & new OptionsFont class.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
345 } |
36
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
32
diff
changeset
|
346 } |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
347 //END Templates: impl & optionsThis |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
348 } |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
349 |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
350 /* Special class to store all locally changed options, whatever the section. */ |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
351 class OptionChanges : Options { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
352 //BEGIN Templates |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
353 private { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
354 template Vars(A...) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
355 static if (A.length) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
356 const char[] Vars = A[0].stringof~`[] `~TName!(A[0])~`s;` ~ Vars!(A[1..$]); |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
357 } else |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
358 const char[] Vars = ``; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
359 } |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
360 |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
361 // For addTag; different to Options.addTag(). |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
362 // Reverse priority: only load symbols not currently existing |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
363 template addTagMixin(T, A...) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
364 const char[] ifBlock = `if (tp == "`~T.stringof~`") { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
365 if ((id in opts`~TName!(T)~`) is null) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
366 `~TName!(T)~`s ~= parseTo!(`~T.stringof~`) (dt); |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
367 opts`~TName!(T)~`[id] = &`~TName!(T)~`s[$-1]; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
368 } |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
369 }`; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
370 static if (A.length) |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
371 const char[] addTagMixin = ifBlock~` else `~addTagMixin!(A).addTagMixin; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
372 else |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
373 const char[] addTagMixin = ifBlock; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
374 } |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
375 |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
376 } |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
377 //END Templates |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
378 // These store the actual values, but are never accessed directly except when initially added. |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
379 // optsX store pointers to each item added along with the ID and are used for access. |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
380 mixin(Vars!(TYPES)); |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
381 |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
382 this () {} |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
383 |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
384 void set(T) (ID id, T x) { |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
385 static if (!TIsIn!(T,TYPES)) |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
386 static assert (false, "OptionChanges.set does not currently support type "~T.stringof); |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
387 |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
388 mixin (`alias opts`~T.stringof~` optsVars;`); |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
389 mixin (`alias `~T.stringof~`s vars;`); |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
390 |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
391 T** p = id in optsVars; |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
392 if (p !is null) **p = x; |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
393 else { |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
394 vars ~= x; |
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
395 optsVars[id] = &vars[$-1]; |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
396 } |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
397 } |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
398 |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
399 //BEGIN Mergetag loading/saving code |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
400 // Reverse priority: only load symbols not currently existing |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
401 void addTag (char[] tp, ID id, char[] dt) { |
64
cc3763817b8a
Overhauled Options so that it now uses templates and mixins for type-specific internals, and supported types can be adjusted via just one list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
63
diff
changeset
|
402 mixin (addTagMixin!(TYPES).addTagMixin); |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
403 } |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
404 //END Mergetag loading/saving code |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
405 } |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
406 |
63
66d555da083e
Moved many modules/packages to better reflect usage.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
407 /* NOTE: Options sub-classes are expected to use a template to ease inserting contents and |
66d555da083e
Moved many modules/packages to better reflect usage.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
408 * hide some of the "backend" functionality. Use impl as below, or read the documentation for impl. |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
409 * |
63
66d555da083e
Moved many modules/packages to better reflect usage.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
410 * Each entry should have a Translation entry with humanized names and descriptions in |
66d555da083e
Moved many modules/packages to better reflect usage.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
411 * data/L10n/ClassName.mtt |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
412 * |
63
66d555da083e
Moved many modules/packages to better reflect usage.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
413 * To create a new Options sub-class, just copy, paste and adjust. |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
414 */ |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
415 |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
416 /** A home for all miscellaneous options, at least for now. */ |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
417 OptionsMisc miscOpts; |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
418 class OptionsMisc : Options { |
53
f000d6cd0f74
Changes to paths, command line arguments and font LCD rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
50
diff
changeset
|
419 mixin (impl!("bool useThreads, exitImmediately; int logOptions; double pollInterval; char[] L10n;")); |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
420 |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
421 static this() { |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
422 miscOpts = new OptionsMisc; |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
423 Options.addOptionsClass (miscOpts, "misc"); |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
424 } |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
425 } |