Revision: 3333
http://vexi.svn.sourceforge.net/vexi/?rev=3333&view=rev
Author: clrg
Date: 2009-01-03 18:11:09 +0000 (Sat, 03 Jan 2009)
Log Message:
-----------
Add read traps for padding/margin, remove unecessary cascades
Modified Paths:
--------------
trunk/widgets/org.vexi.widgets/src/org/vexi/lib/layout/margin.t
trunk/widgets/org.vexi.widgets/src/org/vexi/lib/layout/pad.t
Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/layout/margin.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/layout/margin.t
2009-01-03 17:53:22 UTC (rev 3332)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/layout/margin.t
2009-01-03 18:11:09 UTC (rev 3333)
@@ -28,6 +28,7 @@
thisbox.v_lmar = $left;
// apply static trap functions
+ thisbox.margin ++= static.marginRead;
thisbox.margin ++= static.marginWrite;
thisbox.margintop ++= static.topWrite;
thisbox.margintop ++= static.topRead;
@@ -41,10 +42,10 @@
</ui:box>
// direct write redirect functions for padding* properties
- static.topWrite = function(v) { cascade = null; trapee.v_tmar.height =
v; }
- static.rightWrite = function(v) { cascade = null; trapee.v_rmar.width =
v; }
- static.bottomWrite = function(v) { cascade = null; trapee.v_bmar.height =
v; }
- static.leftWrite = function(v) { cascade = null; trapee.v_lmar.width =
v; }
+ 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
static.topRead = function() { return trapee.v_tmar.height; }
@@ -52,6 +53,15 @@
static.bottomRead = function() { return trapee.v_bmar.height; }
static.leftRead = function() { return trapee.v_lmar.width; }
+ /** return accurate margin in appropriate format */
+ static.marginRead = function() {
+ var t = trapee.v_tmar.height;
+ var r = trapee.v_rmar.width;
+ var b = trapee.v_bmar.height;
+ var l = trapee.v_lmar.width;
+ 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" */
static.marginWrite = function(v) {
cascade = v;
@@ -81,6 +91,7 @@
// invalid args
} else vexi.log.warn("Invalid number of values for margin:
"+p.length+" from '"+v+"'");
+ return;
}
</vexi>
Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/layout/pad.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/layout/pad.t
2009-01-03 17:53:22 UTC (rev 3332)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/layout/pad.t
2009-01-03 18:11:09 UTC (rev 3333)
@@ -32,6 +32,7 @@
thisbox.v_lpad = $left;
// apply static trap functions
+ thisbox.padding ++= static.paddingRead;
thisbox.padding ++= static.paddingWrite;
thisbox.paddingtop ++= static.topWrite;
thisbox.paddingtop ++= static.topRead;
@@ -45,10 +46,10 @@
</ui:box>
// direct write redirect functions for padding* properties
- static.topWrite = function(v) { cascade = null; trapee.v_tpad.height =
v; }
- static.rightWrite = function(v) { cascade = null; trapee.v_rpad.width =
v; }
- static.bottomWrite = function(v) { cascade = null; trapee.v_bpad.height =
v; }
- static.leftWrite = function(v) { cascade = null; trapee.v_lpad.width =
v; }
+ static.topWrite = function(v) { trapee.v_tpad.height = v; return; }
+ static.rightWrite = function(v) { trapee.v_rpad.width = v; return; }
+ static.bottomWrite = function(v) { trapee.v_bpad.height = v; return; }
+ static.leftWrite = function(v) { trapee.v_lpad.width = v; return; }
// direct read redirect functions for padding* properties
static.topRead = function() { return trapee.v_tpad.height; }
@@ -56,6 +57,15 @@
static.bottomRead = function() { return trapee.v_bpad.height; }
static.leftRead = function() { return trapee.v_lpad.width; }
+ /** return accurate padding in appropriate format */
+ static.paddingRead = function() {
+ var t = trapee.v_tpad.height;
+ var r = trapee.v_rpad.width;
+ var b = trapee.v_bpad.height;
+ var l = trapee.v_lpad.width;
+ 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" */
static.paddingWrite = function(v) {
cascade = v;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
_______________________________________________
Vexi-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vexi-svn