comparison mde/gui/widget/Window.d @ 74:cee261eba249

Minor tweaks.
author Diggory Hardy <diggory.hardy@gmail.com>
date Mon, 07 Jul 2008 15:54:47 +0100
parents 7fc0a8295c83
children 25cb7420dc91
comparison
equal deleted inserted replaced
73:08d3b6bcf891 74:cee261eba249
98 yh = y+h; 98 yh = y+h;
99 } 99 }
100 //BEGIN Mergetag code 100 //BEGIN Mergetag code
101 void addTag (char[] tp, mt.ID id, char[] dt) { 101 void addTag (char[] tp, mt.ID id, char[] dt) {
102 // Priority is HIGH_LOW, so don't overwrite data which has already been loaded. 102 // Priority is HIGH_LOW, so don't overwrite data which has already been loaded.
103 if (tp == INTAINT) { 103 if (tp == "int[][int]") {
104 if (id == WDGD && widgetData == null) { 104 if (id == "widgetData" && widgetData == null) {
105 widgetData = cast(int[][widgetID]) parseTo!(int[][int]) (dt); 105 widgetData = cast(int[][widgetID]) parseTo!(int[][int]) (dt);
106 } 106 }
107 } else if (tp == CHARAINT) { 107 } else if (tp == "char[][int]") {
108 if (id == WS && widgetStrings == null) { 108 if (id == "widgetStrings" && widgetStrings == null) {
109 widgetStrings = parseTo!(char[][int]) (dt); 109 widgetStrings = parseTo!(char[][int]) (dt);
110 } 110 }
111 } else if (tp == INTA) { 111 } else if (tp == "int[]") {
112 if (id == MD && mutableData == null) { 112 if (id == "mutableData" && mutableData == null) {
113 mutableData = parseTo!(int[]) (dt); 113 mutableData = parseTo!(int[]) (dt);
114 } 114 }
115 } else if (tp == INT) { 115 } else if (tp == "int") {
116 if (id == X && x == -1) { 116 if (id == "x" && x == -1) {
117 x = cast(wdim) parseTo!(int) (dt); 117 x = cast(wdim) parseTo!(int) (dt);
118 } else if (id == Y && y == -1) { 118 } else if (id == "y" && y == -1) {
119 y = cast(wdim) parseTo!(int) (dt); 119 y = cast(wdim) parseTo!(int) (dt);
120 } 120 }
121 } 121 }
122 } 122 }
123 void writeAll (ItemDelg dlg) 123 void writeAll (ItemDelg dlg)
125 assert (widgetData is null, "Window.writeAll: widgetData !is null"); 125 assert (widgetData is null, "Window.writeAll: widgetData !is null");
126 } body { 126 } body {
127 /+ NOTE: currently editing is impossible... 127 /+ NOTE: currently editing is impossible...
128 if (edited) { // only save the widget creation data if it's been adjusted: 128 if (edited) { // only save the widget creation data if it's been adjusted:
129 addCreationData (widget); // generate widget save data 129 addCreationData (widget); // generate widget save data
130 dlg (INTAINT, WDGD, parseFrom!(int[][int]) (widgetData)); 130 dlg ("int[][int]", "widgetData", parseFrom!(int[][int]) (widgetData));
131 dlg (CHARAINT, WS, parseFrom!(char[][int]) (widgetStrings)); 131 dlg ("char[][int]", "widgetStrings", parseFrom!(char[][int]) (widgetStrings));
132 }+/ 132 }+/
133 // Save mutable data: 133 // Save mutable data:
134 dlg (INTA, MD, parseFrom!(int[]) (widget.getMutableData)); 134 dlg ("int[]", "mutableData", parseFrom!(int[]) (widget.getMutableData));
135 // Save the window position: 135 // Save the window position:
136 dlg (INT, X, parseFrom!(int) (x)); 136 dlg ("int", "x", parseFrom!(int) (x));
137 dlg (INT, Y, parseFrom!(int) (y)); 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";
149 } 138 }
150 //END Mergetag code 139 //END Mergetag code
151 //END Methods for GUI 140 //END Methods for GUI
152 141
153 //BEGIN IWindow methods 142 //BEGIN IWindow methods