Revision: 2325 http://vexi.svn.sourceforge.net/vexi/?rev=2325&view=rev Author: clrg Date: 2007-09-24 15:37:07 -0700 (Mon, 24 Sep 2007)
Log Message: ----------- Added Paths: ----------- branches/tree_nexttree.t Removed Paths: ------------- branches/tree_nexttree Deleted: branches/tree_nexttree =================================================================== --- branches/tree_nexttree 2007-09-24 22:36:15 UTC (rev 2324) +++ branches/tree_nexttree 2007-09-24 22:37:07 UTC (rev 2325) @@ -1,196 +0,0 @@ -<!-- Copyright 2007 - see COPYING for details [LGPL] --> - -<vexi xmlns="org.vexi.lib.role" xmlns:ui="vexi://ui" xmlns:meta="vexi://meta"> - <meta:doc> - <author>Charles Goodwin</author> - </meta:doc> - - <selectable /> - <ui:box> - - thisbox.th_content = null; - thisbox.th_expand = null; - thisbox.th_handle = null; - thisbox.th_node = null; - thisbox.th_title = null; - - thisbox.v_isroot = true; - thisbox.v_self ++= function() { return thisbox; } - - thisbox.expanded = true; - - var icontemplate = null; - - /** used for closing / expanding the tree */ - thisbox.flipDisplay = function(v) { expanded = !th_expand.display; cascade = v; } - - /** select when we mouse press on the node */ - thisbox.nodePress = function(v) { selected = true; cascade = v; } - - /** used for fancier icon implementations */ - thisbox.setIconTemplate = function(i) { icontemplate = i; } - - thisbox.childrenWrite = function(c) { - if (c and c.v_istree) { - var cself = c.v_self; - cself.v_node = c; - cself.nexttree ++= nexttreeChildRead; - cself.prevtree ++= prevtreeChildRead; - // we have no group - if (!groupref) { - // add to child group - if (cself.groupref) { - groupref = cself.groupref; - groupref.members.unshift(thisbox); - // start a new group - } else c.group = group; - // we have a group - insert or merge into this - } else { - var insafter = null; - // no children, insert after thisbox - if (!th_content.numchildren) insafter = thisbox; - // try the box under the current placement - if (!insafter) insafter = th_content[trapname]; - // double-check before attempting insertion - if (insafter) insafter = groupref.members.before(insafter); - // need to find last node (nodes may be trees) - else { - var node = thisbox; - insafter = thisbox; - for (var i=thisbox.numchildren-1; i>=0; i--) { - if (node[i].v_istree) { - insafter = node[i].v_self; - if (node[i].numchildren) { - node = node[i]; - // reset i, no -1 due to for loop i-- - i = node.numchildren; - } else break; - } - } - } - // now position [insafter] is known - - // merge groups - if (c.v_self.groupref) - groupref.merge(c.v_self.groupref, insafter); - // c has no group - insert it - else { - c.v_self.groupref = groupref; - groupref.members.insert(c.v_self, insafter); - } - } - } - var _c = trapee[trapname]; - if (c == null and _c != null) { - // remove from this tree - if (_c.v_istree) { - // FIXME: split groups - _c.v_self.groupref = null; - _c.v_self.nexttree --= nexttreeChildRead; - _c.v_self.prevtree --= prevtreeChildRead; - } - } - cascade = c; - th_handle.display = (th_content.numchildren > 0); - } - - thisbox.nexttree ++= function() { - vexi.log.info("???"); - if (expanded) { - var n = th_content.numchildren; - for (var i=0; n>i; i++) - if (th_content[i].v_istree and th_content[i].visible) - return th_content[i]; - } - return thisbox; - } - - thisbox.nexttreeChildRead = function() { - vexi.log.info("!!!"); - var t = trapee; - var c = cascade; - if (!c.selected) return c; - var n = th_content.numchildren; - for (var i = th_content.indexof(t.v_node)+1; n>i; i++) - if (th_content[i].v_istree and th_content[i].visible) - return th_content[i]; - return nexttree; - } - - //thisbox.prevtree ++= function() { return thisbox; } - thisbox.prevtreeChildRead = function() { - var t = trapee; - for (var i = th_content.indexof(t.v_node)-1; i>=0; i--) - if (th_content[i].v_istree and th_content[i].visible) - return th_content[i]; - return thisbox; - } - - thisbox.expanded ++= static.expandRead; - thisbox.expanded ++= static.expandWrite; - thisbox.nextselect ++= static.nextselectRead; - thisbox.th_content ++= static.contentWrite; - thisbox.th_handle ++= static.handleWrite; - thisbox.th_node ++= static.nodeWrite; - thisbox.th_title ++= static.titleWrite; - thisbox.KeyPressed ++= static.keypressWrite; - - </ui:box> - - static.expandRead = function() { return trapee.th_expand.display; } - static.expandWrite = function(v) { - var t = trapee; - t.th_expand.display = v; - if (!v) { - var g = t.groupref; - if (g and g.selected and !g.selected.visible) - t.selected = true; - } - return; - } - - static.nextselectRead = function() { - var c = cascade; - if (c and c.visible) return c; - return null; - return trapee.nexttree; - } - - static.contentWrite = function(v) { - cascade = v; - v.Children ++= trapee.childrenWrite; - } - - static.handleWrite = function(v) { - cascade = v; - v.Press1 ++= trapee.flipDisplay; - } - - /** override action write trap in selectable */ - static.nodeWrite = function(n) { - cascade = n; - n.Press1 ++= trapee.nodePress; - } - - static.titleWrite = function(v) { - cascade = v; - v.DoubleClick1 ++= trapee.flipDisplay; - } - - static.keypressWrite = function(v) { - vexi.log.info("? "+v); - var t = trapee; - if (v == "left") t.th_expand.display = false; - else if (v == "right") { - if (t.th_content.numchildren) - t.th_expand.display = true; - } else if (v == "up") { - var pt = t.prevtree; - if (pt) pt.selected = true; - } else if (v == "down") { - var nt = t.nexttree; - if (nt) nt.selected = true; - } else cascade = v; - } - -</vexi> Copied: branches/tree_nexttree.t (from rev 2324, branches/tree_nexttree) =================================================================== --- branches/tree_nexttree.t (rev 0) +++ branches/tree_nexttree.t 2007-09-24 22:37:07 UTC (rev 2325) @@ -0,0 +1,196 @@ +<!-- Copyright 2007 - see COPYING for details [LGPL] --> + +<vexi xmlns="org.vexi.lib.role" xmlns:ui="vexi://ui" xmlns:meta="vexi://meta"> + <meta:doc> + <author>Charles Goodwin</author> + </meta:doc> + + <selectable /> + <ui:box> + + thisbox.th_content = null; + thisbox.th_expand = null; + thisbox.th_handle = null; + thisbox.th_node = null; + thisbox.th_title = null; + + thisbox.v_isroot = true; + thisbox.v_self ++= function() { return thisbox; } + + thisbox.expanded = true; + + var icontemplate = null; + + /** used for closing / expanding the tree */ + thisbox.flipDisplay = function(v) { expanded = !th_expand.display; cascade = v; } + + /** select when we mouse press on the node */ + thisbox.nodePress = function(v) { selected = true; cascade = v; } + + /** used for fancier icon implementations */ + thisbox.setIconTemplate = function(i) { icontemplate = i; } + + thisbox.childrenWrite = function(c) { + if (c and c.v_istree) { + var cself = c.v_self; + cself.v_node = c; + cself.nexttree ++= nexttreeChildRead; + cself.prevtree ++= prevtreeChildRead; + // we have no group + if (!groupref) { + // add to child group + if (cself.groupref) { + groupref = cself.groupref; + groupref.members.unshift(thisbox); + // start a new group + } else c.group = group; + // we have a group - insert or merge into this + } else { + var insafter = null; + // no children, insert after thisbox + if (!th_content.numchildren) insafter = thisbox; + // try the box under the current placement + if (!insafter) insafter = th_content[trapname]; + // double-check before attempting insertion + if (insafter) insafter = groupref.members.before(insafter); + // need to find last node (nodes may be trees) + else { + var node = thisbox; + insafter = thisbox; + for (var i=thisbox.numchildren-1; i>=0; i--) { + if (node[i].v_istree) { + insafter = node[i].v_self; + if (node[i].numchildren) { + node = node[i]; + // reset i, no -1 due to for loop i-- + i = node.numchildren; + } else break; + } + } + } + // now position [insafter] is known + + // merge groups + if (c.v_self.groupref) + groupref.merge(c.v_self.groupref, insafter); + // c has no group - insert it + else { + c.v_self.groupref = groupref; + groupref.members.insert(c.v_self, insafter); + } + } + } + var _c = trapee[trapname]; + if (c == null and _c != null) { + // remove from this tree + if (_c.v_istree) { + // FIXME: split groups + _c.v_self.groupref = null; + _c.v_self.nexttree --= nexttreeChildRead; + _c.v_self.prevtree --= prevtreeChildRead; + } + } + cascade = c; + th_handle.display = (th_content.numchildren > 0); + } + + thisbox.nexttree ++= function() { + vexi.log.info("???"); + if (expanded) { + var n = th_content.numchildren; + for (var i=0; n>i; i++) + if (th_content[i].v_istree and th_content[i].visible) + return th_content[i]; + } + return thisbox; + } + + thisbox.nexttreeChildRead = function() { + vexi.log.info("!!!"); + var t = trapee; + var c = cascade; + if (!c.selected) return c; + var n = th_content.numchildren; + for (var i = th_content.indexof(t.v_node)+1; n>i; i++) + if (th_content[i].v_istree and th_content[i].visible) + return th_content[i]; + return nexttree; + } + + //thisbox.prevtree ++= function() { return thisbox; } + thisbox.prevtreeChildRead = function() { + var t = trapee; + for (var i = th_content.indexof(t.v_node)-1; i>=0; i--) + if (th_content[i].v_istree and th_content[i].visible) + return th_content[i]; + return thisbox; + } + + thisbox.expanded ++= static.expandRead; + thisbox.expanded ++= static.expandWrite; + thisbox.nextselect ++= static.nextselectRead; + thisbox.th_content ++= static.contentWrite; + thisbox.th_handle ++= static.handleWrite; + thisbox.th_node ++= static.nodeWrite; + thisbox.th_title ++= static.titleWrite; + thisbox.KeyPressed ++= static.keypressWrite; + + </ui:box> + + static.expandRead = function() { return trapee.th_expand.display; } + static.expandWrite = function(v) { + var t = trapee; + t.th_expand.display = v; + if (!v) { + var g = t.groupref; + if (g and g.selected and !g.selected.visible) + t.selected = true; + } + return; + } + + static.nextselectRead = function() { + var c = cascade; + if (c and c.visible) return c; + return null; + return trapee.nexttree; + } + + static.contentWrite = function(v) { + cascade = v; + v.Children ++= trapee.childrenWrite; + } + + static.handleWrite = function(v) { + cascade = v; + v.Press1 ++= trapee.flipDisplay; + } + + /** override action write trap in selectable */ + static.nodeWrite = function(n) { + cascade = n; + n.Press1 ++= trapee.nodePress; + } + + static.titleWrite = function(v) { + cascade = v; + v.DoubleClick1 ++= trapee.flipDisplay; + } + + static.keypressWrite = function(v) { + vexi.log.info("? "+v); + var t = trapee; + if (v == "left") t.th_expand.display = false; + else if (v == "right") { + if (t.th_content.numchildren) + t.th_expand.display = true; + } else if (v == "up") { + var pt = t.prevtree; + if (pt) pt.selected = true; + } else if (v == "down") { + var nt = t.nexttree; + if (nt) nt.selected = true; + } else cascade = v; + } + +</vexi> 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 Vexi-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vexi-svn