changeset 165:bb2f1a76346d

Fixed a few bugs; most notably changing the translation reloads the text on PopupMenuWidgets now.
author Diggory Hardy <diggory.hardy@gmail.com>
date Sun, 07 Jun 2009 16:20:16 +0200
parents c13bded1bed3
children 55667d048c31
files mde/content/AStringContent.d mde/content/Content.d mde/gui/WidgetManager.d mde/gui/widget/ParentContent.d mde/gui/widget/contentFunctions.d
diffstat 5 files changed, 15 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/mde/content/AStringContent.d	Sat May 23 17:23:21 2009 +0200
+++ b/mde/content/AStringContent.d	Sun Jun 07 16:20:16 2009 +0200
@@ -76,7 +76,6 @@
     
     /** Set the content via conversion to/from string. */
     override bool set (IContent c) {
-	//AStringContent asc = cast (AStringContent) c;
 	if (c !is null) {
 	    sv = c.toString (0).dup;
 	    return endEdit;
@@ -590,9 +589,10 @@
 	bc.set = sc;
 	assert (!bc());
 	
+	sc = "2.5";
+	ic.set = sc;	// parses as float and rounds
+	assert (ic() == 2);	// rounds to even
 	sc = "31.5";
-	ic.set = sc;	// parses as int which fails
-	assert (ic() == 16);
 	dc.set = sc;
 	ic.set = dc;	// rounds to even
 	assert (ic() == 32);
--- a/mde/content/Content.d	Sat May 23 17:23:21 2009 +0200
+++ b/mde/content/Content.d	Sun Jun 07 16:20:16 2009 +0200
@@ -124,7 +124,7 @@
      * Content.changed.boolData[symbol] = val;
      * super();
      * --- */
-    void endEvent () {
+    final void endEvent () {
 	foreach (dg; cb)
 	    dg (this);
     }
--- a/mde/gui/WidgetManager.d	Sat May 23 17:23:21 2009 +0200
+++ b/mde/gui/WidgetManager.d	Sun Jun 07 16:20:16 2009 +0200
@@ -251,7 +251,7 @@
 	    }
         } else {
 	    wdim pw = parent.width;
-	    if (w < pw && popup.minWidth <= pw)
+	    if (popup.minWidth <= pw)
 		popup.setWidth (pw, -1);		// neatness
 	    x = parent.xPos;				// align on left edge
             if (x+w > this.w) x += pw - w;		// align on right edge
--- a/mde/gui/widget/ParentContent.d	Sat May 23 17:23:21 2009 +0200
+++ b/mde/gui/widget/ParentContent.d	Sun Jun 07 16:20:16 2009 +0200
@@ -48,7 +48,6 @@
 	WDCMinCheck (data, 3,1, content_);
         super (mgr, parent, id);
         
-        //popup = mgr.makeWidget (this, data.strings[0], content_);
         popup = new ContentListWidget (mgr, this, id, data, c);
         subWidgets = [popup];
 	
@@ -61,19 +60,22 @@
 	w = mw;
 	h = mh;
     }
-    /+
+    
     override bool setup (uint n, uint flags) {
-	if (!(flags & 3)) return false;	// string or renderer (and possibly font) changed
-        wdim omw = mw, omh = mh;
+	bool ret = super.setup (n, flags);
+	if (!(flags & 3)) return ret;
+	// else string or renderer (and possibly font) changed
+	adapter.text = content_.toString (cIndex);
+	wdim omw = mw, omh = mh;
         adapter.getDimensions (mw, mh);
         if (omw != mw || omh != mh) {
 	    w = mw;
 	    h = mh;
 	    return true;
 	}
-	return false;
+	return ret;
     }
-    +/
+    
     override IContent content () {
         return content_;
     }
--- a/mde/gui/widget/contentFunctions.d	Sat May 23 17:23:21 2009 +0200
+++ b/mde/gui/widget/contentFunctions.d	Sun Jun 07 16:20:16 2009 +0200
@@ -51,8 +51,8 @@
     if (cast(AStringContent) c) {
         if (cast(EnumContent) c)	// can be PopupMenuWidget or ContentListWidget
             return new PopupMenuWidget(mgr,parent,id,data,c);
-//         if (cast(BoolContent) c)
-//             return new BoolContentWidget(mgr,parent,id,data,c);
+        if (cast(BoolContent) c)
+            return new BoolContentWidget(mgr,parent,id,data,c);
         return new AStringContentWidget(mgr,parent,id,data,c);
     }
     if (cast(IContentList) c)