Revision: 8263
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8263&view=rev
Author:   hsujohnhsu
Date:     2009-09-23 01:47:01 +0000 (Wed, 23 Sep 2009)

Log Message:
-----------
add modifier key (control-key) for model select and body select.  this prevents 
accidental selection of model/body while trying to pan/tilt view camera.

Modified Paths:
--------------
    code/gazebo/trunk/server/gui/GLWindow.cc
    code/gazebo/trunk/server/gui/GLWindow.hh

Modified: code/gazebo/trunk/server/gui/GLWindow.cc
===================================================================
--- code/gazebo/trunk/server/gui/GLWindow.cc    2009-09-22 19:55:37 UTC (rev 
8262)
+++ code/gazebo/trunk/server/gui/GLWindow.cc    2009-09-23 01:47:01 UTC (rev 
8263)
@@ -75,6 +75,8 @@
   this->leftMousePressed = false;
   this->rightMousePressed = false;
   this->middleMousePressed = false;
+  this->controlKeyPressed = false;
+  this->altKeyPressed = false;
 
 
   this->keys.clear();
@@ -229,7 +231,7 @@
       break;
   }
 
-  if (!this->mouseDrag)
+  if (!this->mouseDrag && this->controlKeyPressed)
   {
     Entity *entity = OgreAdaptor::Instance()->GetEntityAt(this->activeCamera, 
                                                           this->mousePos);
@@ -544,7 +546,15 @@
         case FL_Control_L:
         case FL_Control_R:
           moveAmount = this->moveAmount * 10;
+          this->controlKeyPressed = true;
+          //std::cout << "press control" << std::endl;
           break;
+
+        case FL_Alt_L:
+        case FL_Alt_R:
+          this->altKeyPressed = true;
+          //std::cout << "press alt" << std::endl;
+          break;
       }
     }
   }
@@ -614,6 +624,16 @@
           this->directionVec.z -= this->moveAmount;
           break;
 
+        case XK_Control_L:
+        case XK_Control_R:
+          this->controlKeyPressed = true;
+          break;
+
+        case XK_Alt_L:
+        case XK_Alt_R:
+          this->altKeyPressed = true;
+          break;
+
         default:
           break;
       }
@@ -641,7 +661,20 @@
     case ']':
       CameraManager::Instance()->DecActiveCamera();
       break;
+
+    case FL_Control_L:
+    case FL_Control_R:
+      this->controlKeyPressed = false;
+      //std::cout << "releasing control" << std::endl;
+      break;
+
+    case FL_Alt_L:
+    case FL_Alt_R:
+      this->altKeyPressed = false;
+      //std::cout << "releasing alt" << std::endl;
+      break;
   }
+
 }
 
 
////////////////////////////////////////////////////////////////////////////////

Modified: code/gazebo/trunk/server/gui/GLWindow.hh
===================================================================
--- code/gazebo/trunk/server/gui/GLWindow.hh    2009-09-22 19:55:37 UTC (rev 
8262)
+++ code/gazebo/trunk/server/gui/GLWindow.hh    2009-09-23 01:47:01 UTC (rev 
8263)
@@ -157,6 +157,12 @@
     private: OgreCamera *activeCamera;
 
     private: static GLWindow *activeWin;
+
+    /// gui interface, prerequisite to selecting Model / Body
+    ///   press control+left click Model to toggle select.  Left mouse button 
drag updates model rotation about camera view axis, right mouse button drag 
udpates model position in camera view plane.
+    ///   press control+right click Body to toggle select body select.  Left 
mouse button drag applies torque, right mouse button drag applies linear force.
+    private: bool controlKeyPressed;
+    private: bool altKeyPressed;
   };
 
 }


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

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Playerstage-commit mailing list
Playerstage-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to