Revision: 4202
          http://vexi.svn.sourceforge.net/vexi/?rev=4202&view=rev
Author:   clrg
Date:     2011-08-16 23:11:23 +0000 (Tue, 16 Aug 2011)

Log Message:
-----------
Use anonymous function in clickable instead of storing it

Modified Paths:
--------------
    trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/clickable.t

Modified: trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/clickable.t
===================================================================
--- trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/clickable.t  
2011-08-06 01:53:11 UTC (rev 4201)
+++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/clickable.t  
2011-08-16 23:11:23 UTC (rev 4202)
@@ -1,4 +1,4 @@
-<!-- Copyright 2009 - see COPYING for details [LGPL] -->
+<!-- Copyright 2011 - see COPYING for details [LGPL] -->
 
 <vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta">
     <meta:doc>
@@ -66,44 +66,20 @@
         KeyPressed  ++= static.keypressEvent;
         KeyReleased ++= static.keyreleaseEvent;
         Press1      ++= static.pressEvent;
+        surface     ++= static.initNormal;
         
-        /** used to reset widget after surface.Release1 */
-        thisbox.surfaceReleaseEvent = function(v) {
-            // deal with widget
-            try {
-                if (enabled) {
-                    if (primed) {
-                        // fire action or stop repeat
-                        if (mouse and mouse.inside) {
-                            if (repeats) {
-                                repeat = false;
-                            } else {
-                                action = true;
-                            }
-                        }
-                    }
-                }
-            } finally {
-                // deprime widget
-                primed = false;
-                // clean up trap
-                trapee._Release1 --= callee;
-            }
-            cascade = v;
-        }
-        
-        /** initialise as normal state */
-        surface ++= function(v) {
-            cascade = v;
-            normal = true;
-            surface --= callee;
-        }
-        
     </ui:box>
     
     static.defaultinterval = 100;
     static.initialinterval = 500;
     
+    /** initialise as normal state */
+    static.initNormal = function(v) {
+        cascade = v;
+        trapee.normal = true;
+        trapee.surface --= callee;
+    }
+    
     /** enabled write trap */
     static.enabledWrite = function(v) {
         var e = trapee.enabled;
@@ -218,10 +194,31 @@
             trapee.primed = true;
             // apply surface trap
             var s = trapee.surface;
-            if (s and s.event) {
-                s.event._Release1 ++= trapee.surfaceReleaseEvent;
-            } else {
-                trapee._Release1 ++= trapee.surfaceReleaseEvent;
+            var targ = s and s.event ? s.event : trapee;
+            var tbox = trapee;
+            targ._Release1 ++= function(v) {
+                // deal with widget
+                try {
+                    if (tbox.enabled) {
+                        if (tbox.primed) {
+                            // fire action or stop repeat
+                            if (tbox.mouse?.inside) {
+                                if (tbox.repeats) {
+                                    tbox.repeat = false;
+                                } else {
+                                    //vexi.trace(tbox+": action=true");
+                                    tbox.action = true;
+                                }
+                            }
+                        }
+                    }
+                } finally {
+                    // clean up trap
+                    targ._Release1 --= callee;
+                    // deprime widget
+                    tbox.primed = false;
+                }
+                cascade = v;
             }
         }
         cascade = v;


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

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to