Revision: 18408
          http://sourceforge.net/p/jmol/code/18408
Author:   hansonr
Date:     2013-07-02 15:25:58 +0000 (Tue, 02 Jul 2013)
Log Message:
-----------


Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/viewer/ActionManager.java
    trunk/Jmol/src/org/jmol/viewer/binding/Binding.java

Modified: trunk/Jmol/src/org/jmol/viewer/ActionManager.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/ActionManager.java   2013-07-02 14:24:19 UTC 
(rev 18407)
+++ trunk/Jmol/src/org/jmol/viewer/ActionManager.java   2013-07-02 15:25:58 UTC 
(rev 18408)
@@ -893,11 +893,19 @@
 
   private boolean checkUserAction(int action, int x, int y, int deltaX,
                                   int deltaY, long time, int mode) {
+    if(mode == Binding.PRESSED) {
+      if (Binding.getClickCount(action) == 1)
+        action = (action & ~Binding.CLICK_MASK) + Binding.DOWN;
+    }else
+    if(mode == Binding.DRAGGED || mode == Binding.DRAGGED2) {
+      if (Binding.getClickCount(action) == 1)
+        action = (action & ~Binding.CLICK_MASK);
+    }
     if (!binding.isUserAction(action))
       return false;
     Map<String, Object> ht = binding.getBindings();
     Iterator<String> e = ht.keySet().iterator();
-    boolean ret = false;
+    boolean passThrough = false;
     Object obj;
     while (e.hasNext()) {
       String key = e.next();
@@ -940,10 +948,13 @@
       script = TextFormat.simpleReplace(script, "_DELTAY", "" + deltaY);
       script = TextFormat.simpleReplace(script, "_TIME", "" + time);
       script = TextFormat.simpleReplace(script, "_MODE", "" + mode);
+      if (script.startsWith("+:")) {
+        passThrough = true;
+        script = script.substring(2);
+      }
       viewer.evalStringQuiet(script);
-      ret = true;
     }
-    return ret;
+    return !passThrough;
   }
 
   /**
@@ -1370,7 +1381,6 @@
         exitMeasurementMode();
       action = Binding.getMouseAction(pressedCount, modifiers);
       dragGesture.add(action, x, y, time);
-      action = Binding.getMouseAction(Integer.MIN_VALUE, modifiers);
       checkAction(action, x, y, deltaX, deltaY, time, Binding.DRAGGED);
       return;
     case Binding.PRESSED:
@@ -1386,7 +1396,6 @@
           Integer.MIN_VALUE, modifiers), ACTION_selectAndDrag);
       action = Binding.getMouseAction(pressedCount, modifiers);
       dragGesture.setAction(action, time);
-      action = Binding.getMouseAction(Integer.MIN_VALUE, modifiers);
       if (Binding.getModifiers(action) != 0) {
         action = viewer.notifyMouseClicked(x, y, action, Binding.PRESSED);
         if (action == 0)

Modified: trunk/Jmol/src/org/jmol/viewer/binding/Binding.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/binding/Binding.java 2013-07-02 14:24:19 UTC 
(rev 18407)
+++ trunk/Jmol/src/org/jmol/viewer/binding/Binding.java 2013-07-02 15:25:58 UTC 
(rev 18408)
@@ -31,7 +31,7 @@
   public final static int DOUBLE_CLICK = 2 << 8;
   public final static int SINGLE_CLICK = 1 << 8;
   public final static int DOWN = 4 << 8;
-  
+  public final static int CLICK_MASK = 7 << 8; 
   // for status messages:
   public final static int MOVED = 0;
   public final static int DRAGGED = 1;
@@ -128,6 +128,8 @@
   }
   
   public final boolean isBound(int mouseAction, int action) {
+    if (mouseAction == 1040 && action == 2)
+      System.out.println("left-down-2" + bindings.containsKey(mouseAction + 
"\t" + action));
     return bindings.containsKey(mouseAction + "\t" + action);
   }
   
@@ -163,11 +165,12 @@
 
     boolean isDefaultButton = (action == 0);
     
+    boolean isDown = (desc.indexOf("DOWN") >= 0);
     if (desc.indexOf("DOUBLE") >= 0)
       action |= DOUBLE_CLICK;
-    else if (action > 0 && (action & WHEEL) == 0 || desc.indexOf("SINGLE") >= 
0)
+    else if (action > 0 && (action & WHEEL) == 0 && !isDown || 
desc.indexOf("SINGLE") >= 0)
       action |= SINGLE_CLICK;
-    else if (desc.indexOf("DOWN") >= 0)
+    else if (isDown)
       action |= DOWN;
     
     if (desc.indexOf("CTRL") >= 0)

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 Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to