Mercurial > projects > mde
comparison mde/content/AStringContent.d @ 124:a2ef6b549101
Dynamic minimal size changing is now fully supported.
Support for reducing minimal size in layouts.
Editing numbers as text now always converts new number back to string at end of edit.
Floating point number display format changed.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Mon, 05 Jan 2009 12:43:27 +0000 |
parents | d3b2cefd46c9 |
children | c9843fbaac88 |
comparison
equal
deleted
inserted
replaced
123:d3b2cefd46c9 | 124:a2ef6b549101 |
---|---|
169 } | 169 } |
170 alias opCall opCast; | 170 alias opCall opCast; |
171 | 171 |
172 override char[] endEdit () { | 172 override char[] endEdit () { |
173 v = sv && (sv[0] == 't' || sv[0] == 'T' || sv[0] == '1'); | 173 v = sv && (sv[0] == 't' || sv[0] == 'T' || sv[0] == '1'); |
174 endEvent; | 174 sv = v ? "true" : "false"; |
175 endEvent; | |
175 return sv; | 176 return sv; |
176 } | 177 } |
177 | 178 |
178 protected: | 179 protected: |
179 bool v; | 180 bool v; |
235 override char[] endEdit () { | 236 override char[] endEdit () { |
236 try { | 237 try { |
237 v = Int.toInt (sv); | 238 v = Int.toInt (sv); |
238 } catch (Exception e) { | 239 } catch (Exception e) { |
239 logger.warn (e.msg); | 240 logger.warn (e.msg); |
240 sv = Int.toString (v); | 241 } |
241 } | 242 sv = Int.toString (v); |
242 endEvent; | 243 endEvent; |
243 return sv; | 244 return sv; |
244 } | 245 } |
245 | 246 |
246 protected: | 247 protected: |
247 int v = 0; // must be a valid value for EnumContent (i.e. 0) | 248 int v = 0; // must be a valid value for EnumContent (i.e. 0) |
256 super (symbol); | 257 super (symbol); |
257 } | 258 } |
258 | 259 |
259 void assignNoCb (double val) { | 260 void assignNoCb (double val) { |
260 v = val; | 261 v = val; |
261 sv = Float.toString (v); | 262 sv = Float.toString (v, 8, 4); |
262 if (pos > sv.length) pos = sv.length; | 263 if (pos > sv.length) pos = sv.length; |
263 } | 264 } |
264 void opAssign (double val) { | 265 void opAssign (double val) { |
265 assignNoCb (val); | 266 assignNoCb (val); |
266 endEvent; | 267 endEvent; |
273 override char[] endEdit () { | 274 override char[] endEdit () { |
274 try { | 275 try { |
275 v = Float.toFloat (sv); | 276 v = Float.toFloat (sv); |
276 } catch (Exception e) { | 277 } catch (Exception e) { |
277 logger.warn (e.msg); | 278 logger.warn (e.msg); |
278 sv = Float.toString (v); | 279 } |
279 } | 280 sv = Float.toString (v, 8, 4); |
280 endEvent; | 281 endEvent; |
281 return sv; | 282 return sv; |
282 } | 283 } |
283 | 284 |
284 protected: | 285 protected: |
285 double v; | 286 double v; |