Changeset 74:cee261eba249
- Timestamp:
- 07/07/08 10:54:47 (6 months ago)
- Files:
-
- codeDoc/jobs.txt (modified) (3 diffs)
- codeDoc/todo.txt (modified) (2 diffs)
- mde/font/font.d (modified) (3 diffs)
- mde/gui/Gui.d (modified) (3 diffs)
- mde/gui/widget/Window.d (modified) (2 diffs)
- mde/input/Config.d (modified) (2 diffs)
- mde/lookup/Translation.d (modified) (5 diffs)
- mde/mergetag/DefaultData.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
codeDoc/jobs.txt
r72 r74 4 4 5 5 In progress: 6 Redesigning how widgets are created and receive their data. 6 7 7 8 … … 9 10 To do (importance 0-5: 0 pointless, 1 no obvious impact now, 2 todo sometime, 3 useful, 4 important, 5 urgent): 10 11 Also see todo.txt and FIXME/NOTE comment marks. 11 4 Fonts from Options. Get yMax for font not all glyphs on line?12 4 Try to correlate names of option sections more. (i.e. symbol name, class name, name of i18n translation file) 12 13 4 Not guaranteed to catch up-click ending callback! Appears not to be a problem... 13 14 4 OutOfMemoryException is not currently checked for â it should be at least in critical places (use high-level catching of all errors?). 15 3 Fonts from Options. Get yMax for font not all glyphs on line? 14 16 3 glBindTexture not working with non-0 index (??) 15 17 3 on-event draw support (mde.events and GUI need to tell mde.mde) … … 17 19 3 Update scheduler as outlined in FIXME. 18 20 3 Windows building/compatibility (currently partial) 21 2 Remove ability to scan, then load, mergetag sections. Not so necessary with section creator callback and allows "sliding window" type partial buffering. 19 22 2 Options need a "level": simple options, for advanced users, for debugging only, etc. 20 23 2 Command-line options for paths to by-pass normal path finding functionality. codeDoc/todo.txt
r66 r74 3 3 4 4 5 * means done 5 * means done: 6 6 7 7 GUI: … … 15 15 -> Content: 16 16 -> lists 17 18 19 + shows current preference: 20 21 Redesign: 22 -> requirements 23 -> widgets can receive int and string data types 24 -> possibilities 25 -> per-widget merging (i.e. separate tag(s) for each widget's data)? 26 -> if a widget with sub-widgets is defined in a base file, but redesigned in a derived file, any unused widgets with data resolting are not created 27 -> if design changes in a base file, while the old design was modified in a derived file, will the result be sane? 28 -> if a locally modified gui is updated upstream (so the base files change), should: 29 -> the local modifications persist? 30 -> the local modifications be lost? 31 -> the widgets be merged? 32 -> potentially gives the best of both worlds 33 -> should original widgets used as sub-widgets of modified widgets: 34 -> use original data (from base file), so they can be updated? 35 -> have data copied, also impacting unmodified portions of window using same widget? 36 -> have data copied under a new ID? 37 -> the user be asked? 38 -> requires copy of old data... 39 +> widget data per-gui instead of per-window? 40 -> identical sub-widget could be used in multiple windows more easily, when data file is hand edited 41 -> in-gui editor will probably copy data under a new ID anyway 42 +> Maybe change to: 43 -> One section per version, containing widget data 44 -> can inherit from other sections 45 -> Which section (version of gui design) to use saved in header 46 -> Either/or: 47 -> Windows defined in header by primary widget 48 +> Windows become ordinary sub-widgets or some parent widget, gui becomes a parent widget 49 +> widget data no longer has "construction" and "mutable" variations 50 +> widgets know their IDs and update their data whenever necessary, via the gui, into a new data set, which is saved upon exit mde/font/font.d
r70 r74 57 57 } 58 58 59 /** Load the freetype library. */ 59 /** Load the freetype library from the file fileName. */ 60 private const fileName = "fonts"; 60 61 void initialize () { 61 62 if (!confDir.exists (fileName)) … … 106 107 107 108 // get fallback name 108 char[]* p = "fallback" in reader.dataset.header.Arg!(char[]) .Arg;109 char[]* p = "fallback" in reader.dataset.header.Arg!(char[]); 109 110 if (p is null) 110 111 throw new fontException ("No fallback font style specified"); … … 124 125 fallback.load; 125 126 } 126 private const fileName = "fonts";127 127 128 128 //FIXME: don't use GC for FontStyle resources mde/gui/Gui.d
r65 r74 77 77 78 78 // Get the renderer 79 char[]* p = RENDERER in reader.dataset.header.Arg!(char[]).Arg;79 char[]* p = "Renderer" in reader.dataset.header.Arg!(char[]); 80 80 if (p is null || *p is null) { 81 81 logger.warn ("no renderer specified: defaulting to Simple"); … … 111 111 // Add header: 112 112 ds.header = new mt.DefaultData; 113 ds.header.Arg!(char[]) .Arg[RENDERER] = rendName;113 ds.header.Arg!(char[])["Renderer"] = rendName; 114 114 115 115 // Add windows to be saved: … … 127 127 return; 128 128 } 129 }130 private static const {131 auto RENDERER = "Renderer";132 129 } 133 130 //END Loading code mde/gui/widget/Window.d
r70 r74 101 101 void addTag (char[] tp, mt.ID id, char[] dt) { 102 102 // Priority is HIGH_LOW, so don't overwrite data which has already been loaded. 103 if (tp == INTAINT) {104 if (id == WDGD&& widgetData == null) {103 if (tp == "int[][int]") { 104 if (id == "widgetData" && widgetData == null) { 105 105 widgetData = cast(int[][widgetID]) parseTo!(int[][int]) (dt); 106 106 } 107 } else if (tp == CHARAINT) {108 if (id == WS&& widgetStrings == null) {107 } else if (tp == "char[][int]") { 108 if (id == "widgetStrings" && widgetStrings == null) { 109 109 widgetStrings = parseTo!(char[][int]) (dt); 110 110 } 111 } else if (tp == INTA) {112 if (id == MD&& mutableData == null) {111 } else if (tp == "int[]") { 112 if (id == "mutableData" && mutableData == null) { 113 113 mutableData = parseTo!(int[]) (dt); 114 114 } 115 } else if (tp == INT) {116 if (id == X&& x == -1) {115 } else if (tp == "int") { 116 if (id == "x" && x == -1) { 117 117 x = cast(wdim) parseTo!(int) (dt); 118 } else if (id == Y&& y == -1) {118 } else if (id == "y" && y == -1) { 119 119 y = cast(wdim) parseTo!(int) (dt); 120 120 } … … 128 128 if (edited) { // only save the widget creation data if it's been adjusted: 129 129 addCreationData (widget); // generate widget save data 130 dlg ( INTAINT, WDGD, parseFrom!(int[][int]) (widgetData));131 dlg ( CHARAINT, WS, parseFrom!(char[][int]) (widgetStrings));130 dlg ("int[][int]", "widgetData", parseFrom!(int[][int]) (widgetData)); 131 dlg ("char[][int]", "widgetStrings", parseFrom!(char[][int]) (widgetStrings)); 132 132 }+/ 133 133 // Save mutable data: 134 dlg ( INTA, MD, parseFrom!(int[]) (widget.getMutableData));134 dlg ("int[]", "mutableData", parseFrom!(int[]) (widget.getMutableData)); 135 135 // Save the window position: 136 dlg (INT, X, parseFrom!(int) (x)); 137 dlg (INT, Y, parseFrom!(int) (y)); 138 } 139 private static const { 140 auto CHARAINT = "char[][int]"; 141 auto INTAINT = "int[][int]"; 142 auto INTA = "int[]"; 143 auto INT = "int"; 144 auto WDGD = "widgetData"; 145 auto MD = "mutableData"; 146 auto WS = "widgetStrings"; 147 auto X = "x"; 148 auto Y = "y"; 136 dlg ("int", "x", parseFrom!(int) (x)); 137 dlg ("int", "y", parseFrom!(int) (y)); 149 138 } 150 139 //END Mergetag code mde/input/Config.d
r70 r74 142 142 delegate MT.IDataSection (MT.ID) { return new Config; }; 143 143 144 // D2.0: enum MT.ID CONFIGS = "Configs";145 const MT.ID CONFIGS = cast(MT.ID)"Configs";146 144 // Restrict config sections if this tag exists: 147 auto file_configs_p = CONFIGSin file.dataset.header._charAA;145 auto file_configs_p = cast(MT.ID)"Configs" in file.dataset.header._charAA; 148 146 MT.ID[] file_configs = null; 149 147 if (file_configs_p) { … … 179 177 } 180 178 181 // D2.0: private enum QUEUE : MT.ID { BUTTON = "B", AXIS = "A", MOUSE = "M" }182 private struct QUEUE {183 static const MT.ID BUTTON = cast(MT.ID)"B", AXIS = cast(MT.ID)"A", MOUSE = cast(MT.ID)"M";184 }185 179 private this() {} // Private since this class should only be created from here. 186 180 187 181 void addTag (char[] tp, MT.ID id, char[] dt) { 188 182 if (tp == "uint[][uint]") { 189 if (id == QUEUE.BUTTON) button= cast(outQueue[][uint]) parseTo!(uint[][][uint]) (dt);190 else if (id == QUEUE.AXIS) axis= cast(outQueue[][uint]) parseTo!(uint[][][uint]) (dt);191 else if (id == QUEUE.MOUSE) relMotion = cast(outQueue[][uint]) parseTo!(uint[][][uint]) (dt);183 if (id == "B") button = cast(outQueue[][uint]) parseTo!(uint[][][uint]) (dt); 184 else if (id == "A") axis = cast(outQueue[][uint]) parseTo!(uint[][][uint]) (dt); 185 else if (id == "M") relMotion = cast(outQueue[][uint]) parseTo!(uint[][][uint]) (dt); 192 186 else logger.warn ("Unexpected tag encountered with ID " ~ cast(char[])id); 193 187 } // FIXME: add support for name and inheritants. mde/lookup/Translation.d
r70 r74 38 38 module mde.lookup.Translation; 39 39 40 import mde. options;41 import mde. resource.paths;40 import mde.lookup.Options; 41 import mde.setup.paths; 42 42 import mde.exception; 43 43 … … 60 60 final char[] L10n; /// The localization loaded (e.g. en-GB) 61 61 62 /** Get the translation for the given identifier, and optionally the description. 63 * If no entry exists, the identifier will be returned. */ 64 char[] getEntry (char[] id, out char[] description) { 62 alias entry opCall; /// Convenience alias 63 64 /** Get the translation for the given identifier. 65 * If no entry exists, the identifier will be returned. 66 * 67 * Optionally, the description can be returned. */ 68 char[] entry (char[] id) { 65 69 Entry* p = id in entries; 66 if (p) { // FIXME: check: a SEGFAULT? 70 if (p) { 71 return p.str; 72 } else { 73 return id; 74 } 75 } 76 /** ditto */ 77 char[] entry (char[] id, out char[] description) { 78 Entry* p = id in entries; 79 if (p) { 67 80 description = p.desc; 68 81 return p.str; 69 } else 82 } else { 70 83 return id; 71 } 72 /** ditto */ 73 char[] getEntry (char[] id) { 84 } 85 } 86 87 /** Alternative usage: return a Translation.Entry struct. */ 88 Entry getStruct (char[] id) { 74 89 Entry* p = id in entries; 75 if (p !is null) { // FIXME: check: a SEGFAULT? 76 return p.str; 77 } else 78 return id; 90 if (p) { 91 return *p; 92 } else { 93 Entry ret; 94 ret.str = id; 95 return ret; 96 } 79 97 } 80 98 … … 175 193 void writeAll (ItemDelg) {} 176 194 195 /** This struct is used to store each translation entry. 196 * 197 * Note that although each entry also has a version field, this is not loaded for general use. 198 */ 199 struct Entry { 200 char[] str; // The translated string 201 char[] desc; // An optional description 202 } 203 177 204 private: 178 205 /* Sets name and L10n. … … 186 213 //BEGIN Data 187 214 static Logger logger; 188 189 /* This struct is used to store each translation entry.190 *191 * Note that although each entry also has a version field, this is not loaded for general use.192 */193 struct Entry {194 char[] str; // The translated string195 char[] desc; // An optional description196 }197 215 198 216 Entry[char[]] entries; // all entries … … 222 240 223 241 // Simple get-string, check dependancy's entry doesn't override 224 assert (transl. getEntry ("Str1") == "Test 1");242 assert (transl.entry ("Str1") == "Test 1"); 225 243 226 244 // Entry included from dependancy with description 227 245 char[] desc; 228 assert (transl. getEntry ("Str2", desc) == "Test 3");246 assert (transl.entry ("Str2", desc) == "Test 3"); 229 247 assert (desc == "Description"); 230 248 231 249 // No entry: fallback to identifier string 232 assert (transl. getEntry ("Str3") == "Str3");250 assert (transl.entry ("Str3") == "Str3"); 233 251 234 252 // No checks for version info since it's not functionality of this module. mde/mergetag/DefaultData.d
r70 r74 168 168 * Error: identifier '_boolAA' is not defined 169 169 */ 170 template Arg(T : T[]) { 171 const ArgString = Arg!(T).ArgString ~ `A`; 172 mixin(`alias `~ArgString~` Arg;`); 170 template ArgName (T : T[]) { 171 const char[] ArgName = ArgName!(T)~`A`; 172 } 173 template ArgName (T) { 174 const char[] ArgName = `_`~T.stringof; 173 175 } 174 176 template Arg(T) { 175 const ArgString = `_` ~ T.stringof; 176 mixin(`alias `~ArgString~` Arg;`); 177 mixin(`alias `~ArgName!(T)~` Arg;`); 177 178 } 178 179 }
