Revision: 2605
http://vexi.svn.sourceforge.net/vexi/?rev=2605&view=rev
Author: clrg
Date: 2007-11-21 13:54:01 -0800 (Wed, 21 Nov 2007)
Log Message:
-----------
Make splitpane work beautifully :D
Modified Paths:
--------------
trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/splitpane.t
Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/splitpane.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/splitpane.t
2007-11-21 19:52:28 UTC (rev 2604)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/splitpane.t
2007-11-21 21:54:01 UTC (rev 2605)
@@ -1,6 +1,7 @@
<!-- Copyright 2007 - see COPYING for details [LGPL] -->
-<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" xmlns="org.vexi.lib.role">
+<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" xmlns="org.vexi.lib.role"
+ xmlns:rdt="vexi.util.redirect">
<meta:doc>
<author>Charles Goodwin</author>
</meta:doc>
@@ -23,11 +24,14 @@
var tmp_a;
var tmp_b;
+ var max = function(a, b) { return a>b ? a : b; }
+ var min = function(a, b) { return b>a ? a : b; }
+
/** integration with draggable */
var dragUpdate = function(d) {
var shift = d[pos];
- if (0 > dim_a + shift) shift = - dim_a;
- if (0 > dim_b - shift) shift = dim_b;
+ shift = max(cur_a[0][contentdim] - dim_a, shift);
+ shift = min(dim_b - cur_d[dim] - cur_b[0][contentdim], shift);
if (liveresize) {
if (cur_a!=master) cur_a[dim] = dim_a + shift;
if (cur_b!=master) cur_b[dim] = dim_b - shift;
@@ -54,6 +58,8 @@
var dragStart = function(v) {
cascade = v;
// make sure we always have a master
+ for (var i=0; th_holding.numchildren>i; i+=2)
+ if (!th_holding[i][shr]) master = th_holding[i];
if (!master) master = th_holding[0];
// the current divider being moved
var cur = th_holding.indexof(trapee);
@@ -73,6 +79,15 @@
th_marker[pos] = cur_a[pos] + cur_a[dim] + markeroffset;
}
+ master ++= function(v) {
+ cascade = v;
+ if (master) {
+ master[mindim] = 0;
+ master[maxdim] = vexi.ui.maxdim;
+ master[shr] = false;
+ }
+ }
+
/** update dividers when orient changes */
orient ++= function(v) {
cascade = v;
@@ -86,10 +101,21 @@
}
}
+ /** returns the relative index of v */
+ var getIndexOf = function(v) {
+ var i = th_holding.indexof(v);
+ return 0>i ? i/2 : i;
+ }
+
/** set up Children trap */
th_content ++= function(v) {
+ v.indexof ++= function() { return getIndexOf; }
+ //v.numchildren ++= function() { return
(th_holding.numchildren+1)/2; }
+ v.display = false;
+ cascade = v;
+
/** children are really stored in th_holding and separated by
dividers */
- v.Children ++= function() { return
th_holding[arguments.trapname*2]; }
+ v.Children ++= function() { return
th_holding[arguments.trapname*2][0]; }
/** set up introduced dividers */
v.Children ++= function(c) {
@@ -110,7 +136,16 @@
}
// assign new child and divider to holding
if (div and i!=0) th_holding[i*2-1] = div;
- th_holding[i*2] = c;
+ var shell = vexi.box;
+ shell[0] = c;
+ shell[mindim] = c[mindim];
+ shell[maxdim] = c[maxdim];
+ shell[shr] = c[shr];
+ c[mindim] = 0;
+ c[maxdim] = vexi.ui.maxdim;
+ c[shr] = false;
+ rdt..addRedirect(c, shell, mindim, maxdim, shr);
+ th_holding[i*2] = shell;
if (div and i==0) th_holding[1] = div;
// insert placeholder box
cascade = vexi.box;
@@ -124,9 +159,6 @@
// remove placeholder box
cascade = null;
}
-
- v.display = false;
- cascade = v;
}
</ui:box>
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Vexi-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vexi-svn