Revision: 2128
http://vexi.svn.sourceforge.net/vexi/?rev=2128&view=rev
Author: clrg
Date: 2007-09-05 17:37:16 -0700 (Wed, 05 Sep 2007)
Log Message:
-----------
Major refactoring of splitpane
Modified Paths:
--------------
trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/splitpane.t
trunk/widgets/org.vexi.widgets/src/org/vexi/theme/win2k/divider.t
trunk/widgets/org.vexi.widgets/src/org/vexi/theme/win2k/splitpane.t
trunk/widgets/org.vexi.widgets/src/vexi/widget/splitpane.t
Added Paths:
-----------
trunk/widgets/org.vexi.widgets/src/org/vexi/theme/win2k/image/rivets.png
Removed Paths:
-------------
trunk/widgets/org.vexi.widgets/src/vexi/widget/divider.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-09-06 00:27:23 UTC (rev 2127)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/splitpane.t
2007-09-06 00:37:16 UTC (rev 2128)
@@ -1,6 +1,6 @@
<!-- Copyright 2006 - see COPYING for details [LGPL] -->
-<vexi xmlns="org.vexi.lib.widget" xmlns:ui="vexi://ui"
xmlns:meta="vexi://meta" xmlns:role="org.vexi.lib.role">
+<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta"
xmlns:role="org.vexi.lib.role">
<meta:doc>
<author>Charles Goodwin</author>
</meta:doc>
@@ -11,8 +11,8 @@
thisbox.liveresize = false; // whether to update pane sizes instantly
thisbox.markeroffset = 0; // offset for centering marker
thisbox.master = null; // gets the slack
- thisbox.numvalid = 0; // number of non-dividers
- thisbox.th_content = null; // contains children of this splitpane
+ thisbox.th_content = null; // conceptually contains children
+ thisbox.th_holding = null; // where children are actually contained
thisbox.th_marker = null; // marker used when liveresize is false
var cur_d;
@@ -24,6 +24,7 @@
var tmp_r;
var mx;
var my;
+ var newdiv = vexi..vexi.theme.divider;
/** reusable surface.Move dragging function */
var xMoveFunc = function(v)
@@ -106,13 +107,13 @@
/** initiate x dragging on Press */
var xPressFunc = function(v)
{
- var cur = th_content.indexof(trapee);
+ var cur = th_holding.indexof(trapee);
cur_d = trapee;
cur_d.active = true;
- cur_l = th_content[cur-1];
- cur_r = th_content[cur+1];
- dim_l = th_content[cur-1].width;
- dim_r = th_content[cur+1].width;
+ cur_l = th_holding[cur-1];
+ cur_r = th_holding[cur+1];
+ dim_l = cur_l.width;
+ dim_r = cur_r.width;
mx = surface.mouse.x;
th_marker.display = !liveresize;
th_marker.x = cur_l.x + cur_l.width - markeroffset;
@@ -124,14 +125,13 @@
/** initiate y dragging on Press */
var yPressFunc = function(v)
{
- var cur = th_content.indexof(trapee);
+ var cur = th_holding.indexof(trapee);
cur_d = trapee;
cur_d.active = true;
- cur_l = th_content[cur-1];
- cur_r = th_content[cur+1];
- if (!cur_l or !cur_r) return;
- dim_l = th_content[cur-1].height;
- dim_r = th_content[cur+1].height;
+ cur_l = th_holding[cur-1];
+ cur_r = th_holding[cur+1];
+ dim_l = cur_l[cur-1].height;
+ dim_r = cur_r[cur+1].height;
my = surface.mouse.y;
th_marker.display = !liveresize;
th_marker.y = cur_l.y + cur_l.height - markeroffset;
@@ -158,89 +158,80 @@
{
if (v == "h" or v == "horizontal")
{
- th_content.orient = "horizontal";
- for (var i=0; th_content.numchildren > i; i++)
+ th_holding.orient = "horizontal";
+ for (var i=1; th_holding.numchildren > i; i+2)
{
- if (th_content[i].type == "divider")
- {
- th_content[i].orient = "vertical";
- th_content[i].Press1 ++= xPressFunc;
- th_content[i].Press1 --= yPressFunc;
- }
+ th_holding[i].orient = "vertical";
+ th_holding[i].Press1 ++= xPressFunc;
+ th_holding[i].Press1 --= yPressFunc;
}
}
else
{
- th_content.orient = "vertical";
- for (var i=0; th_content.numchildren > i; i++)
+ th_holding.orient = "vertical";
+ for (var i=1; th_holding.numchildren > i; i+2)
{
- if (th_content[i].type == "divider")
- {
- th_content[i].orient = "horizontal";
- th_content[i].Press1 --= xPressFunc;
- th_content[i].Press1 ++= yPressFunc;
- }
+ th_holding[i].orient = "horizontal";
+ th_holding[i].Press1 --= xPressFunc;
+ th_holding[i].Press1 ++= yPressFunc;
}
}
+
cascade = v;
}
/** set up Children trap */
th_content ++= function(v)
{
+ v.numchildren ++= function() { return th_holding.numchildren+1 /
2; }
+ /** children are really stored in th_holding and separated by
dividers */
+ v.Children ++= function() { return
th_holding[arguments.trapname*2]; }
+
/** set up introduced dividers */
v.Children ++= function(c)
{
+ // useful through this trap
+ var i = arguments.trapname;
+
if (c != null)
{
- if (c.type == "divider")
+ // set up divider
+ if (th_content.numchildren>0)
{
+ var d = newdiv(vexi.box);
if (orient == "h" or orient == "horizontal")
{
- c.orient = "vertical";
- c.Press1 ++= xPressFunc;
+ d.orient = "vertical";
+ d.Press1 ++= xPressFunc;
}
else
{
- c.orient = "horizontal";
- c.Press1 ++= yPressFunc;
+ d.orient = "horizontal";
+ d.Press1 ++= yPressFunc;
}
}
- else
- {
- if (!master) master = c;
- numvalid ++;
- }
-
- cascade = c;
+ // assign new child and divider to holding
+ if (d and i != 0) th_holding[i*2-1] = d;
+ th_holding[i*2] = c;
+ if (d and i == 0) th_holding[1] = d;
+ if (!master) master = c;
return;
}
- c = trapee[arguments.trapname];
-
- if (c.type == "divider")
+ // deal with losing master
+ c = th_holding[i];
+ if (c == master)
{
- c.Press1 --= xPressFunc;
- c.Press1 --= yPressFunc;
- }
- else
- {
- numvalid --;
- // deal with losing master
- if (c == master and numvalid > 0)
+ for (var i=0; th_holding.numchildren>i; i+=2)
{
- for (var i=0; v.numchildren>i; i++)
- {
- if (v[i].type != "divider")
- {
- master = v[i];
- break;
- }
- }
+ if (v[i].display) master = v[i];
+ break;
}
}
-
- cascade = null;
+ if (i == 0) th_holding[1] = null;
+ th_holding[i*2] = null;
+ if (i != 0) th_holding[i*2-1] = null;
+ return;
}
cascade = v;
Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/theme/win2k/divider.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/theme/win2k/divider.t
2007-09-06 00:27:23 UTC (rev 2127)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/theme/win2k/divider.t
2007-09-06 00:37:16 UTC (rev 2128)
@@ -6,7 +6,9 @@
</meta:doc>
<divider vshrink="true">
- <ui:box minwidth="6" minheight="6" />
+ <ui:box align="center" width="6" height="6">
+ <ui:box fill="rivets" />
+ </ui:box>
orient ++= function(v)
{
@@ -20,11 +22,12 @@
hshrink = false;
vshrink = true;
}
+ cascade = v;
}
- active ++= function(v) { fill = v ? "#e4e0d8" : "#d4d0c8"; }
- Enter ++= function(v) { fill = "#e4e0d8"; }
- Leave ++= function(v) { if (!active) fill = "#d4d0c8"; }
+ active ++= function(v) { cascade = v; fill = v ? "#e4e0d8" :
"#d4d0c8"; }
+ Enter ++= function(v) { cascade = v; fill = "#e4e0d8"; }
+ Leave ++= function(v) { cascade = v; if (!active) fill = "#d4d0c8"; }
</divider>
</vexi>
Added: trunk/widgets/org.vexi.widgets/src/org/vexi/theme/win2k/image/rivets.png
===================================================================
(Binary files differ)
Property changes on:
trunk/widgets/org.vexi.widgets/src/org/vexi/theme/win2k/image/rivets.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/theme/win2k/splitpane.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/theme/win2k/splitpane.t
2007-09-06 00:27:23 UTC (rev 2127)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/theme/win2k/splitpane.t
2007-09-06 00:37:16 UTC (rev 2128)
@@ -6,10 +6,12 @@
</meta:doc>
<splitpane redirect="$content" layout="place">
- <ui:box id="content" />
- <ui:box id="marker" align="topleft" display="false" fill="black"
minwidth="2" minheight="2" />
+ <ui:box id="content" display="false" />
+ <ui:box id="holding" />
+ <ui:box id="marker" display="false" fill="black" minwidth="2"
minheight="2" />
thisbox.th_content = $content;
+ thisbox.th_holding = $holding;
thisbox.th_marker = $marker;
thisbox.markeroffset = 1;
Deleted: trunk/widgets/org.vexi.widgets/src/vexi/widget/divider.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/vexi/widget/divider.t 2007-09-06
00:27:23 UTC (rev 2127)
+++ trunk/widgets/org.vexi.widgets/src/vexi/widget/divider.t 2007-09-06
00:37:16 UTC (rev 2128)
@@ -1,26 +0,0 @@
-<!-- Copyright 2006 - see COPYING for details [LGPL] -->
-
-<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" xmlns="vexi.theme"
- xmlns:lay="vexi.layout" xmlns:rdrt="vexi.util.redirect">
- <meta:doc>
- <name>Divider</name>
- <desc>Use in conjunction with splitpane</desc>
- <usage>
- </usage>
- </meta:doc>
-
- <ui:box redirect="null" orient="horizontal" type="divider">
- <lay:margin id="margin">
- <divider id="widget" />
- </lay:margin>
-
- // glue code
-
- rdrt..addRedirect($widget, thisbox, "hshrink", "vshrink");
- rdrt..addRedirect(thisbox, $widget, "active", "orient", "xshift",
"yshift");
- rdrt..addRedirect(thisbox, $margin, "margin", "marginleft",
"marginright", "margintop", "marginbottom");
-
- if ($widget.margin) $margin.margin = $widget.margin;
-
- </ui:box>
-</vexi>
Modified: trunk/widgets/org.vexi.widgets/src/vexi/widget/splitpane.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/vexi/widget/splitpane.t 2007-09-06
00:27:23 UTC (rev 2127)
+++ trunk/widgets/org.vexi.widgets/src/vexi/widget/splitpane.t 2007-09-06
00:37:16 UTC (rev 2128)
@@ -11,7 +11,7 @@
</usage>
</meta:doc>
- <ui:box redirect="$content" orient="horizontal" type="splitpane">
+ <ui:box redirect="$widget" orient="horizontal" type="splitpane">
<lay:margin id="margin">
<splitpane id="widget" />
</lay:margin>
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: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Vexi-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vexi-svn