Revision: 4383
          http://vexi.svn.sourceforge.net/vexi/?rev=4383&view=rev
Author:   clrg
Date:     2012-05-19 08:35:22 +0000 (Sat, 19 May 2012)
Log Message:
-----------
Fix initialisation of pad/margin

Modified Paths:
--------------
    trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/layout/margin.t
    trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/layout/pad.t

Modified: trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/layout/margin.t
===================================================================
--- trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/layout/margin.t   
2012-05-04 02:24:21 UTC (rev 4382)
+++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/layout/margin.t   
2012-05-19 08:35:22 UTC (rev 4383)
@@ -28,26 +28,37 @@
         thisbox.v_lmar = $left;
         
         // apply static trap functions
-        thisbox.margin       ++= static.marginRead;
-        thisbox.margin       ++= static.marginWrite;
-        thisbox.margintop    ++= static.topWrite;
-        thisbox.margintop    ++= static.topRead;
-        thisbox.marginright  ++= static.rightWrite;
-        thisbox.marginright  ++= static.rightRead;
+        thisbox.margin ++= static.marginWrite;
+        thisbox.margintop ++= static.topWrite;
+        thisbox.marginleft ++= static.leftWrite;
+        thisbox.marginright ++= static.rightWrite;
         thisbox.marginbottom ++= static.bottomWrite;
+        
+        // margin already set (post-applied) activate
+        // the just-assigned-above margin write trap
+        if (margin) margin = margin;
+        else if (margintop) $top.height = margintop;
+        else if (marginleft) $left.width = marginleft;
+        else if (marginright) $right.width = marginright;
+        else if (marginbottom) $bottom.height = marginbottom;
+        
+        // read trap must be assigned after the put to
+        // margin, otherwise read trap interrupts it
+        thisbox.margin ++= static.marginRead;
+        thisbox.margintop ++= static.topRead;
+        thisbox.marginleft ++= static.leftRead;
+        thisbox.marginright ++= static.rightRead;
         thisbox.marginbottom ++= static.bottomRead;
-        thisbox.marginleft   ++= static.leftWrite;
-        thisbox.marginleft   ++= static.leftRead;
         
     </ui:box>
     
-    // direct write redirect functions for padding* properties
+    // direct write redirect functions for margin* properties
     static.topWrite    = function(v) { trapee.v_tmar.height = v; return; }
     static.rightWrite  = function(v) { trapee.v_rmar.width = v; return; }
     static.bottomWrite = function(v) { trapee.v_bmar.height = v; return; }
     static.leftWrite   = function(v) { trapee.v_lmar.width = v; return; }
     
-    // direct read redirect functions for padding* properties
+    // direct read redirect functions for margin* properties
     static.topRead    = function() { return trapee.v_tmar.height; }
     static.rightRead  = function() { return trapee.v_rmar.width; }
     static.bottomRead = function() { return trapee.v_bmar.height; }
@@ -62,7 +73,7 @@
         return t==r and t==b and t==l ? t : (t==b and r==l ? t+" "+r : t+" 
"+r+" "+b+" "+l);
     }
     
-    /** padding trap function - accepts arg v in form "TRBL", "TB RL", "T R B 
L" */
+    /** margin trap function - accepts arg v in form "TRBL", "TB RL", "T R B 
L" */
     static.marginWrite = function(v) {
         cascade = v;
         v = v ? v : 0;

Modified: trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/layout/pad.t
===================================================================
--- trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/layout/pad.t      
2012-05-04 02:24:21 UTC (rev 4382)
+++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/layout/pad.t      
2012-05-19 08:35:22 UTC (rev 4383)
@@ -33,23 +33,27 @@
         thisbox.v_lpad = $left;
         
         // apply static write trap functions
-        thisbox.padding       ++= static.paddingWrite;
-        thisbox.paddingtop    ++= static.topWrite;
-        thisbox.paddingtop    ++= static.topRead;
-        thisbox.paddingright  ++= static.rightWrite;
-        thisbox.paddingright  ++= static.rightRead;
+        thisbox.padding ++= static.paddingWrite;
+        thisbox.paddingtop ++= static.topWrite;
+        thisbox.paddingleft ++= static.leftWrite;
+        thisbox.paddingright ++= static.rightWrite;
         thisbox.paddingbottom ++= static.bottomWrite;
-        thisbox.paddingbottom ++= static.bottomRead;
-        thisbox.paddingleft   ++= static.leftWrite;
-        thisbox.paddingleft   ++= static.leftRead;
         
         // padding already set (post-applied) activate
         // the just-assigned-above padding write trap
         if (padding) padding = padding;
+        else if (paddingtop) $top.height = paddingtop;
+        else if (paddingleft) $left.width = paddingleft;
+        else if (paddingright) $right.width = paddingright;
+        else if (paddingbottom) $bottom.height = paddingbottom;
         
-        // read trap must be assigned after the put to
+        // read traps must be assigned after the put to
         // padding, otherwise read trap interrupts it
         thisbox.padding ++= static.paddingRead;
+        thisbox.paddingtop ++= static.topRead;
+        thisbox.paddingleft ++= static.leftRead;
+        thisbox.paddingright ++= static.rightRead;
+        thisbox.paddingbottom ++= static.bottomRead;
         
     </ui:box>
     

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to