Mercurial > projects > mde
annotate mde/content/Items.d @ 112:fe061009029d
EnumContent; log level can be selected from a popup list.
New EnumContent, with code to load translations in Items. Editable as an AStringContent.
Hacked OptionsMisc to use an EnumContent.
Implemented a EnumContentWidget providing a pop-up list to select from (still needs improving).
Moved IContent to its own module.
ContentExceptions thrown via WDCCheck now.
Fixed a small bug with reloading translations.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Sat, 13 Dec 2008 12:54:43 +0000 |
parents | 6acd96f8685f |
children | 9824bee909fd |
rev | line source |
---|---|
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:
diff
changeset
|
1 /* LICENSE BLOCK |
960206198cbd
Documentation changes only. (Idea for new gui.content.Items module; unused gl.texture module commented out.)
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
2 Part of mde: a Modular D game-oriented Engine |
960206198cbd
Documentation changes only. (Idea for new gui.content.Items module; unused gl.texture module commented out.)
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
3 Copyright © 2007-2008 Diggory Hardy |
960206198cbd
Documentation changes only. (Idea for new gui.content.Items module; unused gl.texture module commented out.)
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
4 |
960206198cbd
Documentation changes only. (Idea for new gui.content.Items module; unused gl.texture module commented out.)
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 |
960206198cbd
Documentation changes only. (Idea for new gui.content.Items module; unused gl.texture module commented out.)
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
6 of the GNU General Public License as published by the Free Software Foundation, either |
960206198cbd
Documentation changes only. (Idea for new gui.content.Items module; unused gl.texture module commented out.)
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
7 version 2 of the License, or (at your option) any later version. |
960206198cbd
Documentation changes only. (Idea for new gui.content.Items module; unused gl.texture module commented out.)
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
8 |
960206198cbd
Documentation changes only. (Idea for new gui.content.Items module; unused gl.texture module commented out.)
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; |
960206198cbd
Documentation changes only. (Idea for new gui.content.Items module; unused gl.texture module commented out.)
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
10 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
960206198cbd
Documentation changes only. (Idea for new gui.content.Items module; unused gl.texture module commented out.)
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
11 See the GNU General Public License for more details. |
960206198cbd
Documentation changes only. (Idea for new gui.content.Items module; unused gl.texture module commented out.)
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
12 |
960206198cbd
Documentation changes only. (Idea for new gui.content.Items module; unused gl.texture module commented out.)
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
13 You should have received a copy of the GNU General Public License |
960206198cbd
Documentation changes only. (Idea for new gui.content.Items module; unused gl.texture module commented out.)
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
14 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
960206198cbd
Documentation changes only. (Idea for new gui.content.Items module; unused gl.texture module commented out.)
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
15 |
103
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
16 /************************************************************************************************** |
108
c9fc2d303178
Added capability for border-less pop-up widgets. Simple pop-up menu.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
107
diff
changeset
|
17 * A generic way to access content items. Also loads translations on-demand. |
103
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
18 *************************************************************************************************/ |
105
08651e8a8c51
Quit button, big changes to content system.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
104
diff
changeset
|
19 module mde.content.Items; |
103
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
20 |
105
08651e8a8c51
Quit button, big changes to content system.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
104
diff
changeset
|
21 import mde.content.Content; |
103
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
22 import mde.gui.exception; |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
23 |
105
08651e8a8c51
Quit button, big changes to content system.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
104
diff
changeset
|
24 import mde.imde; |
103
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
25 import mde.lookup.Options; |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
26 import mde.lookup.Translation; |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
27 |
104
ee209602770d
Cleaned up Options.d removing old storage method. It's now possible to get a ContentList of the whole of Options.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
103
diff
changeset
|
28 debug { |
ee209602770d
Cleaned up Options.d removing old storage method. It's now possible to get a ContentList of the whole of Options.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
103
diff
changeset
|
29 import tango.util.log.Log : Log, Logger; |
ee209602770d
Cleaned up Options.d removing old storage method. It's now possible to get a ContentList of the whole of Options.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
103
diff
changeset
|
30 private Logger logger; |
ee209602770d
Cleaned up Options.d removing old storage method. It's now possible to get a ContentList of the whole of Options.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
103
diff
changeset
|
31 static this () { |
ee209602770d
Cleaned up Options.d removing old storage method. It's now possible to get a ContentList of the whole of Options.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
103
diff
changeset
|
32 logger = Log.getLogger ("mde.gui.content.Items"); |
ee209602770d
Cleaned up Options.d removing old storage method. It's now possible to get a ContentList of the whole of Options.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
103
diff
changeset
|
33 } |
ee209602770d
Cleaned up Options.d removing old storage method. It's now possible to get a ContentList of the whole of Options.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
103
diff
changeset
|
34 } |
ee209602770d
Cleaned up Options.d removing old storage method. It's now possible to get a ContentList of the whole of Options.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
103
diff
changeset
|
35 |
103
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
36 /** Get a specific content item. |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
37 * |
110
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
38 * loadTranslation() $(B must) be called before this function. |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
39 * |
103
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
40 * E.g. get ("Options.MiscOptions.L10n") returns miscOpts.L10n, |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
41 * Items.get ("Options.MiscOptions") returns a ContentList of all misc options. */ |
105
08651e8a8c51
Quit button, big changes to content system.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
104
diff
changeset
|
42 AContent get (char[] item) { |
110
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
43 assert (currentL10n is miscOpts.L10n(), "must call loadTranslation (code error)"); |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
44 |
103
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
45 char[] h = head (item); |
105
08651e8a8c51
Quit button, big changes to content system.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
104
diff
changeset
|
46 if (h == "Options") { |
110
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
47 if (item is null) |
105
08651e8a8c51
Quit button, big changes to content system.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
104
diff
changeset
|
48 return Options.allContentList; |
110
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
49 |
105
08651e8a8c51
Quit button, big changes to content system.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
104
diff
changeset
|
50 h = head (item); |
08651e8a8c51
Quit button, big changes to content system.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
104
diff
changeset
|
51 auto p = h in Options.optionsClasses; |
08651e8a8c51
Quit button, big changes to content system.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
104
diff
changeset
|
52 if (p) { |
08651e8a8c51
Quit button, big changes to content system.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
104
diff
changeset
|
53 if (item == null) |
08651e8a8c51
Quit button, big changes to content system.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
104
diff
changeset
|
54 return p.contentList; |
08651e8a8c51
Quit button, big changes to content system.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
104
diff
changeset
|
55 |
08651e8a8c51
Quit button, big changes to content system.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
104
diff
changeset
|
56 auto q = (h = head (item)) in p.content; |
08651e8a8c51
Quit button, big changes to content system.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
104
diff
changeset
|
57 if (q && item is null) // enforce item is an exact match |
08651e8a8c51
Quit button, big changes to content system.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
104
diff
changeset
|
58 return *q; |
08651e8a8c51
Quit button, big changes to content system.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
104
diff
changeset
|
59 } |
107
20f7d813bb0f
Translation: now has a file for each locale, instead of a file for each section. Items updated; all strings translated.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
105
diff
changeset
|
60 } else if (h == "imde") { |
110
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
61 h = head (item); |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
62 if (h == "quit" && item is null) |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
63 return quit; |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
64 } |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
65 throw new ContentItemException (h); |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
66 } |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
67 |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
68 /** Creates some content on first run (required by get()). |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
69 * |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
70 * If the correct translation strings are not loaded, this loads them. */ |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
71 void loadTranslation () { |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
72 if (currentL10n is miscOpts.L10n()) return; |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
73 |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
74 // Create Option classes' ContentLists if necessary: |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
75 if (Options.allContentList is null) { |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
76 AContent[] list; |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
77 list.length = Options.optionsClasses.length; |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
78 size_t i; |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
79 foreach (n,opts; Options.optionsClasses) { |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
80 opts.contentList = new ContentList (n, opts.content); |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
81 list[i++] = opts.contentList; |
107
20f7d813bb0f
Translation: now has a file for each locale, instead of a file for each section. Items updated; all strings translated.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
105
diff
changeset
|
82 } |
110
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
83 Options.allContentList = new ContentList ("Options", list); |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
84 } |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
85 |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
86 // Translate Options: |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
87 Translation.Entry trle; |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
88 with (Options.allContentList) { |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
89 trle = Translation.get (symbol).getStruct (symbol); |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
90 name (trle.name, trle.desc); |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
91 } |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
92 foreach (n,opts; Options.optionsClasses) { |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
93 Translation trl; |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
94 trl = Translation.get (n); |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
95 trle = trl.getStruct (n); |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
96 opts.contentList.name (trle.name, trle.desc); |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
97 foreach (s, v; opts.content) { |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
98 trle = trl.getStruct (s); |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
99 v.name (trle.name, trle.desc); |
112
fe061009029d
EnumContent; log level can be selected from a popup list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
110
diff
changeset
|
100 EnumContent ec = cast(EnumContent) v; |
fe061009029d
EnumContent; log level can be selected from a popup list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
110
diff
changeset
|
101 if (ec) { |
fe061009029d
EnumContent; log level can be selected from a popup list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
110
diff
changeset
|
102 char[] tp = s ~ "."; |
fe061009029d
EnumContent; log level can be selected from a popup list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
110
diff
changeset
|
103 foreach (i,sym; ec.enumSymbols) { |
fe061009029d
EnumContent; log level can be selected from a popup list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
110
diff
changeset
|
104 trle = trl.getStruct (tp~sym); |
fe061009029d
EnumContent; log level can be selected from a popup list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
110
diff
changeset
|
105 ec.nameEnum (i, trle.name, trle.desc); |
fe061009029d
EnumContent; log level can be selected from a popup list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
110
diff
changeset
|
106 } |
fe061009029d
EnumContent; log level can be selected from a popup list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
110
diff
changeset
|
107 } |
107
20f7d813bb0f
Translation: now has a file for each locale, instead of a file for each section. Items updated; all strings translated.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
105
diff
changeset
|
108 } |
103
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
109 } |
110
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
110 |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
111 // Translate imde: |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
112 trle = Translation.get ("imde").getStruct ("quit"); |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
113 quit.name (trle.name, trle.desc); |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
114 |
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
115 currentL10n = miscOpts.L10n(); |
103
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
116 } |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
117 |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
118 private: |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
119 /** Takes the string "head.tail" where tail may contain '.' but head does not, returns "head", |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
120 * with str set to "tail". */ |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
121 char[] head (ref char[] str) { |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
122 size_t i = 0; |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
123 while (i < str.length && str[i] != '.') |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
124 ++i; |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
125 char[] ret = str[0..i]; |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
126 if (i == str.length) |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
127 str = null; |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
128 else |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
129 str = str[i+1..$]; |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
130 return ret; |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
62
diff
changeset
|
131 } |
104
ee209602770d
Cleaned up Options.d removing old storage method. It's now possible to get a ContentList of the whole of Options.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
103
diff
changeset
|
132 |
110
6acd96f8685f
Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
133 char[] currentL10n; // Strings will be reloaded if this is not miscOpts.L10n(). |