Revision: 4463
          http://vexi.svn.sourceforge.net/vexi/?rev=4463&view=rev
Author:   clrg
Date:     2012-12-10 06:22:34 +0000 (Mon, 10 Dec 2012)
Log Message:
-----------
Fix mousewheel support with dynamic tables
- distinguish between viewport and uiport (the ui aspect of viewport)
- by default set uiport to viewport (but when viewport changes, uiport does not)

Modified Paths:
--------------
    trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/scrollbar.t
    trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/scrollpane.t
    trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/table.t

Modified: trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/scrollbar.t
===================================================================
--- trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/scrollbar.t        
2012-12-10 06:20:37 UTC (rev 4462)
+++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/scrollbar.t        
2012-12-10 06:22:34 UTC (rev 4463)
@@ -21,6 +21,7 @@
         thisbox.hide;
         thisbox.minthumbsize;
         thisbox.shift;
+        thisbox.uiport;
         thisbox.viewport;
         
         // theme box variables
@@ -184,9 +185,6 @@
             // reassign viewport traps
             if (vport) {
                 if (!varea) throw "viewport must have a child";
-                // mouse wheel scrolling
-                vport[flip(mousewheel)] --= mwheelWrite;
-                vport[mousewheel] ++= mwheelWrite;
                 // react to viewport resize
                 vport[flip(dim)] --= viewportResize;
                 vport[dim] ++= viewportResize;
@@ -197,6 +195,11 @@
                 varea[flip(pos)] --= viewportMove;
                 varea[pos] ++= viewportMove;
             }
+            // reassign uiport traps
+            if (uiport) {
+                uiport[flip(mousewheel)] --= mwheelWrite;
+                uiport[mousewheel] ++= mwheelWrite;
+            }
             // reassign listener traps
             const olddim = flip(dim);
             const oldpos = flip(pos);
@@ -229,15 +232,13 @@
                 vport[dim] --= viewportResize;
                 varea[dim] --= viewportResize;
                 varea[pos] --= viewportMove;
-                vport[mousewheel] --= mwheelWrite;
             }
-            // set up new viewprot
+            // set up new viewport
             if (v) {
                 if (!v[0]) throw "viewport must have a child";
                 v[dim] ++= viewportResize;
                 v[0][dim] ++= viewportResize;
                 v[0][pos] ++= viewportMove;
-                v[mousewheel] ++= mwheelWrite;
             }
             cascade = v;
             vport = v;
@@ -245,6 +246,17 @@
             syncThumb();
         }
         
+        /** set up ui port (see scrollpane uiport) in case viewport is virtual 
*/
+        uiport ++= function(v) {
+            if (uiport) {
+                uiport[mousewheel] --= mwheelWrite;
+            }
+            if (v) {
+                v[mousewheel] ++= mwheelWrite;
+            }
+            cascade = v;
+        }
+        
         ////////
         // theme trap assignments
         

Modified: trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/scrollpane.t
===================================================================
--- trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/scrollpane.t       
2012-12-10 06:20:37 UTC (rev 4462)
+++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/scrollpane.t       
2012-12-10 06:22:34 UTC (rev 4463)
@@ -24,6 +24,7 @@
         thisbox.th_hscroll;
         thisbox.th_vscroll;
         thisbox.th_viewport;
+        thisbox.th_uiport;
         
         /** reusable function for write traps that constrain the viewport to 
the contents */
         var constrainPaneH = function(v) { cascade = v; th_viewport.minwidth = 
th_viewport[0].contentwidth; }
@@ -134,8 +135,22 @@
             } else {
                 v[0].height ++= constrainPaneV;
             }
+            // usually these are the same
+            if (th_uiport==null) {
+                th_uiport = v;
+            }
         }
         
+        /** th_uiport is used in case the viewport is virtual
+         *  in which case uiport represents the ui area that
+         *  would otherwise be the viewport
+         */
+        thisbox.th_uiport ++= function(v) {
+            cascade = v;
+            th_hscroll.uiport = v;
+            th_vscroll.uiport = v;
+        }
+        
         // assign static traps
         
         thisbox.autohide ++= static.autohideWrite;

Modified: trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/table.t
===================================================================
--- trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/table.t    
2012-12-10 06:20:37 UTC (rev 4462)
+++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/table.t    
2012-12-10 06:22:34 UTC (rev 4463)
@@ -308,7 +308,7 @@
             realviewport = th_bodyport;
             realviewport.shrink = false;
             
-            fakeviewport[0].x  ++= function(v){
+            fakeviewport[0].x ++= function(v) {
                 cascade = v;
                 realviewport[0].x = v;
             };
@@ -319,6 +319,7 @@
             th_body.align = "topleft";
             th_body.initAsDynamic();
             th_vscroll.lineheight = rowheight;
+            
             // [un]assign relevant traps
             rowheight ++= static.rowheightWrite;
             selectedindex ++= selectByIndex;

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


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to