Index: code/branches/input/src/core/InputHandler.cc
===================================================================
--- code/branches/input/src/core/InputHandler.cc	(revision 1226)
+++ code/branches/input/src/core/InputHandler.cc	(revision 1236)
@@ -33,9 +33,9 @@
 
 #include "InputHandler.h"
+#include "util/Convert.h"
 #include "Debug.h"
 #include "ConfigValueIncludes.h"
 #include "CoreIncludes.h"
-#include "util/Convert.h"
-#include "core/CommandExecutor.h"
+#include "CommandExecutor.h"
 
 namespace orxonox
@@ -267,14 +267,12 @@
         switch (j)
         {
-          // note: the first element in the struct is the string, so the following pointer
-          //       arithmetic works.
           case 0:
             cont->getValue(&bindingsKeyPress_[i].commandStr);
             break;
           case 1:
-            cont->getValue(bindingsKeyRelease_ + i);
+            cont->getValue(&bindingsKeyRelease_[i].commandStr);
             break;
           case 2:
-            cont->getValue(bindingsKeyHold_ + i);
+            cont->getValue(&bindingsKeyHold_[i].commandStr);
         }
       }
@@ -295,11 +293,11 @@
         {
           case 0:
-            cont->getValue(bindingsMouseButtonPress_ + i);
+            cont->getValue(&bindingsMouseButtonPress_[i].commandStr);
             break;
           case 1:
-            cont->getValue(bindingsMouseButtonRelease_ + i);
+            cont->getValue(&bindingsMouseButtonRelease_[i].commandStr);
             break;
           case 2:
-            cont->getValue(bindingsMouseButtonHold_ + i);
+            cont->getValue(&bindingsMouseButtonHold_[i].commandStr);
         }
       }
@@ -320,11 +318,11 @@
         {
           case 0:
-            cont->getValue(bindingsJoyStickButtonPress_ + i);
+            cont->getValue(&bindingsJoyStickButtonPress_[i].commandStr);
             break;
           case 1:
-            cont->getValue(bindingsJoyStickButtonRelease_ + i);
+            cont->getValue(&bindingsJoyStickButtonRelease_[i].commandStr);
             break;
           case 2:
-            cont->getValue(bindingsJoyStickButtonHold_ + i);
+            cont->getValue(&bindingsJoyStickButtonHold_[i].commandStr);
         }
       }
@@ -345,13 +343,13 @@
     for (int i = 0; i < numberOfMouseButtons_s; i++)
     {
-      bindingsMouseButtonPress_  [i] = "";
-      bindingsMouseButtonRelease_[i] = "";
-      bindingsMouseButtonHold_   [i] = "";
+      bindingsMouseButtonPress_  [i].commandStr = "";
+      bindingsMouseButtonRelease_[i].commandStr = "";
+      bindingsMouseButtonHold_   [i].commandStr = "";
     }
     for (int i = 0; i < numberOfJoyStickButtons_s; i++)
     {
-      bindingsJoyStickButtonPress_  [i] = "";
-      bindingsJoyStickButtonRelease_[i] = "";
-      bindingsJoyStickButtonHold_   [i] = "";
+      bindingsJoyStickButtonPress_  [i].commandStr = "";
+      bindingsJoyStickButtonRelease_[i].commandStr = "";
+      bindingsJoyStickButtonHold_   [i].commandStr = "";
     }
   }
@@ -370,12 +368,12 @@
     // evaluate the key bindings
     // TODO: what if binding is invalid?
-    //for (int i = 0; i < numberOfKeys_s; i++)
-    //{
-    //  if (bindingsKeyPress_[i].commandStr != "")
-    //  {
-    //    bindingsKeyPress_[i].evaluation = CommandExecutor::evaluate(bindingsKeyPress_[i].commandStr);
-    //    bindingsKeyPress_[i].commandStr = bindingsKeyPress_[i].evaluation.getCommandString();
-    //  }
-    //}
+    for (int i = 0; i < numberOfKeys_s; i++)
+    {
+      if (bindingsKeyPress_[i].commandStr != "")
+      {
+        bindingsKeyPress_[i].evaluation = CommandExecutor::evaluate(bindingsKeyPress_[i].commandStr);
+        bindingsKeyPress_[i].commandStr = bindingsKeyPress_[i].evaluation.getCommandString();
+      }
+    }
 
     COUT(ORX_DEBUG) << "KeyBinder: Loading key bindings done." << std::endl;
@@ -387,10 +385,10 @@
     if (binding.commandStr != "")
     {
-      //if (binding.commandStr != binding.evaluation.getCommandString())
-      //{
-      //  // key binding has changed, reevaluate the command string.
-      //  binding.evaluation = CommandExecutor::evaluate(binding.commandStr);
-      //  binding.commandStr = binding.evaluation.getCommandString();
-      //}
+      if (binding.commandStr != binding.evaluation.getCommandString())
+      {
+        // key binding has changed, reevaluate the command string.
+        binding.evaluation = CommandExecutor::evaluate(binding.commandStr);
+        binding.commandStr = binding.evaluation.getCommandString();
+      }
       COUT(3) << "Executing command: " << binding.commandStr << std::endl;
       CommandExecutor::execute(binding.commandStr);
@@ -405,10 +403,9 @@
     @param e Event information
   */
-  bool KeyBinder::keyPressed(const OIS::KeyEvent &e)
-  {
-    COUT(3) << "Key: " << e.key << std::endl;
-    // find the appropriate key binding
-    executeBinding(bindingsKeyPress_[int(e.key)]);
-     
+  bool KeyBinder::keyPressed(const KeyEvent& evt)
+  {
+    // find the appropriate key binding
+    executeBinding(bindingsKeyPress_[int(evt.key)]);
+
     return true;
   }
@@ -418,8 +415,8 @@
     @param e Event information
   */
-  bool KeyBinder::keyReleased(const OIS::KeyEvent &e)
-  {
-    // find the appropriate key binding
-    executeBinding(bindingsKeyRelease_[int(e.key)]);
+  bool KeyBinder::keyReleased(const KeyEvent& evt)
+  {
+    // find the appropriate key binding
+    executeBinding(bindingsKeyRelease_[int(evt.key)]);
 
     return true;
@@ -428,10 +425,10 @@
   /**
     @brief Event handler for the keyHeld Event.
-    @param e Event information
-  */
-  bool KeyBinder::keyHeld(const OIS::KeyEvent &e)
-  {
-    // find the appropriate key binding
-    executeBinding(bindingsKeyHold_[int(e.key)]);
+    @param e Mouse state information
+  */
+  bool KeyBinder::keyHeld(const KeyEvent& evt)
+  {
+    // find the appropriate key binding
+    executeBinding(bindingsKeyHold_[int(evt.key)]);
 
     return true;
@@ -440,7 +437,16 @@
   /**
     @brief Event handler for the mouseMoved Event.
-    @param e Event information
-  */
-  bool KeyBinder::mouseMoved(const OIS::MouseEvent &e)
+    @param e Mouse state information
+  */
+  bool KeyBinder::mouseMoved(const MouseState &evt)
+  {
+    return true;
+  }
+
+  /**
+    @brief Event handler for the mouseWheelTurned Event.
+    @param e Mouse state information
+  */
+  bool KeyBinder::mouseWheelTurned(const MouseState &evt)
   {
     return true;
@@ -452,13 +458,8 @@
     @param id The ID of the mouse button
   */
-  bool KeyBinder::mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id)
-  {
-    // find the appropriate key binding
-    std::string cmdStr = bindingsMouseButtonPress_[int(id)];
-    if (cmdStr != "")
-    {
-      CommandExecutor::execute(cmdStr);
-      COUT(3) << "Executing command: " << cmdStr << std::endl;
-    }
+  bool KeyBinder::mouseButtonPressed(const MouseState& state, MouseButton::Enum id)
+  {
+    // find the appropriate key binding
+    executeBinding(bindingsMouseButtonPress_[int(id)]);
 
     return true;
@@ -470,13 +471,8 @@
     @param id The ID of the mouse button
   */
-  bool KeyBinder::mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id)
-  {
-    // find the appropriate key binding
-    std::string cmdStr = bindingsMouseButtonRelease_[int(id)];
-    if (cmdStr != "")
-    {
-      CommandExecutor::execute(cmdStr);
-      COUT(3) << "Executing command: " << cmdStr << std::endl;
-    }
+  bool KeyBinder::mouseButtonReleased(const MouseState& state, MouseButton::Enum id)
+  {
+    // find the appropriate key binding
+    executeBinding(bindingsMouseButtonRelease_[int(id)]);
 
     return true;
@@ -488,72 +484,52 @@
     @param id The ID of the mouse button
   */
-  bool KeyBinder::mouseHeld(const OIS::MouseEvent &e, OIS::MouseButtonID id)
-  {
-    // find the appropriate key binding
-    std::string cmdStr = bindingsMouseButtonHold_[int(id)];
-    if (cmdStr != "")
-    {
-      CommandExecutor::execute(cmdStr);
-      COUT(3) << "Executing command: " << cmdStr << std::endl;
-    }
-
-    return true;
-  }
-
-  bool KeyBinder::buttonPressed(int joyStickID, const OIS::JoyStickEvent &arg, int button)
-  {
-    // find the appropriate key binding
-    std::string cmdStr = bindingsJoyStickButtonPress_[button];
-    if (cmdStr != "")
-    {
-      CommandExecutor::execute(cmdStr);
-      COUT(3) << "Executing command: " << cmdStr << std::endl;
-    }
-
-    return true;
-  }
-
-  bool KeyBinder::buttonReleased(int joyStickID, const OIS::JoyStickEvent &arg, int button)
-  {
-    // find the appropriate key binding
-    std::string cmdStr = bindingsJoyStickButtonRelease_[button];
-    if (cmdStr != "")
-    {
-      CommandExecutor::execute(cmdStr);
-      COUT(3) << "Executing command: " << cmdStr << std::endl;
-    }
-
-    return true;
-  }
-
-  bool KeyBinder::buttonHeld(int joyStickID, const OIS::JoyStickEvent &arg, int button)
-  {
-    // find the appropriate key binding
-    std::string cmdStr = bindingsJoyStickButtonHold_[button];
-    if (cmdStr != "")
-    {
-      CommandExecutor::execute(cmdStr);
-      COUT(3) << "Executing command: " << cmdStr << std::endl;
-    }
-
-    return true;
-  }
-
-  bool KeyBinder::axisMoved(int joyStickID, const OIS::JoyStickEvent &arg, int axis)
-  {
-    return true;
-  }
-
-  bool KeyBinder::sliderMoved(int joyStickID, const OIS::JoyStickEvent &arg, int id)
-  {
-    return true;
-  }
-
-  bool KeyBinder::povMoved(int joyStickID, const OIS::JoyStickEvent &arg, int id)
-  {
-    return true;
-  }
-
-  bool KeyBinder::vector3Moved(int joyStickID, const OIS::JoyStickEvent &arg, int id)
+  bool KeyBinder::mouseButtonHeld(const MouseState& state, MouseButton::Enum id)
+  {
+    // find the appropriate key binding
+    executeBinding(bindingsMouseButtonHold_[int(id)]);
+
+    return true;
+  }
+
+  bool KeyBinder::joyStickButtonPressed(const JoyStickState& state, int button)
+  {
+    // find the appropriate key binding
+    executeBinding(bindingsJoyStickButtonPress_[button]);
+
+    return true;
+  }
+
+  bool KeyBinder::joyStickButtonReleased(const JoyStickState& state, int button)
+  {
+    // find the appropriate key binding
+    executeBinding(bindingsJoyStickButtonRelease_[button]);
+
+    return true;
+  }
+
+  bool KeyBinder::joyStickButtonHeld(const JoyStickState& state, int button)
+  {
+    // find the appropriate key binding
+    executeBinding(bindingsJoyStickButtonHold_[button]);
+
+    return true;
+  }
+
+  bool KeyBinder::joyStickAxisMoved(const JoyStickState& state, int axis)
+  {
+    return true;
+  }
+
+  bool KeyBinder::joyStickSliderMoved(const JoyStickState& state, int index)
+  {
+    return true;
+  }
+
+  bool KeyBinder::joyStickPovMoved(const JoyStickState& state, int index)
+  {
+    return true;
+  }
+
+  bool KeyBinder::joyStickVector3Moved(const JoyStickState& state, int index)
   {
     return true;
@@ -616,5 +592,5 @@
   //  @param id The ID of the mouse button
   //*/
-  //bool GUIInputHandler::mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id)
+  //bool GUIInputHandler::mousePressed(const OIS::MouseEvent &e, OIS::MouseButton id)
   //{
 		////CEGUI::System::getSingleton().injectMouseButtonDown(convertOISMouseButtonToCegui(id));
@@ -627,5 +603,5 @@
   //  @param id The ID of the mouse button
   //*/
-  //bool GUIInputHandler::mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id)
+  //bool GUIInputHandler::mouseReleased(const OIS::MouseEvent &e, OIS::MouseButton id)
   //{
 		////CEGUI::System::getSingleton().injectMouseButtonUp(convertOISMouseButtonToCegui(id));
