Revision: 1751
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=1751&view=rev
Author:   rorthomas
Date:     2011-03-11 22:59:32 +0000 (Fri, 11 Mar 2011)

Log Message:
-----------
GUI/mouse rewrite WIP

Modified Paths:
--------------
    trunk/source/main/gameplay/PlayerColours.cpp
    trunk/source/main/gameplay/PlayerColours.h
    trunk/source/main/gameplay/RoRFrameListener.cpp
    trunk/source/main/gameplay/RoRFrameListener.h
    trunk/source/main/gui/SelectorWindow.cpp
    trunk/source/main/gui/gui_friction.cpp
    trunk/source/main/gui/gui_inputmanager.cpp
    trunk/source/main/gui/gui_inputmanager.h
    trunk/source/main/gui/gui_manager.cpp
    trunk/source/main/gui/gui_manager.h
    trunk/source/main/gui/gui_menu.cpp

Added Paths:
-----------
    trunk/source/main/gameplay/SceneMouse.cpp
    trunk/source/main/gameplay/SceneMouse.h

Modified: trunk/source/main/gameplay/PlayerColours.cpp
===================================================================
--- trunk/source/main/gameplay/PlayerColours.cpp        2011-03-11 18:02:20 UTC 
(rev 1750)
+++ trunk/source/main/gameplay/PlayerColours.cpp        2011-03-11 22:59:32 UTC 
(rev 1751)
@@ -18,7 +18,7 @@
 along with Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
 */
 #include "PlayerColours.h"
-#include "Ogre.h"
+#include <Ogre.h>
 
 using namespace Ogre;
 

Modified: trunk/source/main/gameplay/PlayerColours.h
===================================================================
--- trunk/source/main/gameplay/PlayerColours.h  2011-03-11 18:02:20 UTC (rev 
1750)
+++ trunk/source/main/gameplay/PlayerColours.h  2011-03-11 22:59:32 UTC (rev 
1751)
@@ -24,8 +24,8 @@
 #define PLAYERCOLOURS_H__
 
 #include "RoRPrerequisites.h"
-#include "OgrePrerequisites.h"
-#include "OgreSingleton.h"
+#include <OgrePrerequisites.h>
+#include <OgreSingleton.h>
 
 
 class PlayerColours : public Ogre::Singleton < PlayerColours >

Modified: trunk/source/main/gameplay/RoRFrameListener.cpp
===================================================================
--- trunk/source/main/gameplay/RoRFrameListener.cpp     2011-03-11 18:02:20 UTC 
(rev 1750)
+++ trunk/source/main/gameplay/RoRFrameListener.cpp     2011-03-11 22:59:32 UTC 
(rev 1751)
@@ -25,8 +25,6 @@
 #include "OgreTerrainMaterialGeneratorA.h"
 #include "OgreTerrainPaging.h"
 
-
-//#include "joystick.h"
 #include "ProceduralManager.h"
 #include "hdrlistener.h"
 #include "utils.h"
@@ -36,6 +34,7 @@
 #include "ChatSystem.h"
 #include "GlowMaterialListener.h"
 #include "MeshObject.h"
+#include "SceneMouse.h"
 
 #include "CharacterFactory.h"
 #include "BeamFactory.h"
@@ -768,7 +767,6 @@
        netPointToUID=-1;
        netcheckGUITimer=0;
        mDOF=0;
-       mouseGrabForce=100000.0f;
        eflsingleton=this;
        forcefeedback=0;
 #ifdef USE_OIS_G27
@@ -857,17 +855,7 @@
 
        // setup input
        inputGrabMode=GRAB_ALL;
-       switchMouseButtons=false;
-#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
-       // on apple, switch by default
-       switchMouseButtons=true;
-#endif
-       if(BSETTING("Switch Mouse Buttons"))
-               switchMouseButtons=true;
-       else if(BSETTING("Switch Mouse Buttons"))
-               switchMouseButtons=false;
 
-       mouseGrabState=0; // 0 = not grabbed
        if(SSETTING("Input Grab") == "All")
                inputGrabMode = GRAB_ALL;
        else if(SSETTING("Input Grab") == "Dynamically")
@@ -891,6 +879,7 @@
 
 #ifdef USE_MYGUI
        // init GUI
+       new SceneMouse(scm, this);
        new GUIManager(root, scm, win);
        LoadingWindow::getInstance();
        SelectorWindow::getInstance();
@@ -918,8 +907,6 @@
 
        screenWidth=win->getWidth();
        screenHeight=win->getHeight();
-       mouseX=screenWidth-20;
-       mouseY=screenHeight-20;
        isnodegrabbed=false;
 
        mRotateSpeed = 100;
@@ -1035,24 +1022,6 @@
 
        objcounter=0;
 
-       // load 3d line for mouse picking
-       pickLine =  mSceneMgr->createManualObject("PickLineObject");
-       pickLineNode = 
mSceneMgr->getRootSceneNode()->createChildSceneNode("PickLineNode");
-
-       MaterialPtr pickLineMaterial = 
MaterialManager::getSingleton().create("PickLineMaterial",ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
-       pickLineMaterial->setReceiveShadows(false);
-       pickLineMaterial->getTechnique(0)->setLightingEnabled(true);
-       pickLineMaterial->getTechnique(0)->getPass(0)->setDiffuse(0,0,1,0);
-       pickLineMaterial->getTechnique(0)->getPass(0)->setAmbient(0,0,1);
-       
pickLineMaterial->getTechnique(0)->getPass(0)->setSelfIllumination(0,0,1);
-
-       pickLine->begin("PickLineMaterial", 
Ogre::RenderOperation::OT_LINE_LIST);
-       pickLine->position(0, 0, 0);
-       pickLine->position(0, 0, 0);
-       pickLine->end();
-       pickLineNode->attachObject(pickLine);
-       pickLineNode->setVisible(false);
-
        //network
        netmode=(BSETTING("Network enable"));
 
@@ -1948,15 +1917,6 @@
        if(chatting)
                return true;
 
-#ifdef USE_MYGUI
-       if(INPUTENGINE.getEventBoolValueBounce(EV_COMMON_SHOW_MENU))
-       {
-               bool newvalue = !GUI_MainMenu::getSingleton().getVisible();
-               GUI_MainMenu::getSingleton().setVisible(newvalue);
-               GUI_Friction::getSingleton().setShaded(newvalue);
-       }
-#endif //MYGUI
-
        if(INPUTENGINE.getEventBoolValueBounce(EV_COMMON_QUIT_GAME))
        {
                if(!showcredits)
@@ -1964,30 +1924,7 @@
                else
                        shutdown_final();
        }
-#ifdef USE_MYGUI
-       if(GUI_MainMenu::getSingleton().getVisible()) return true; // disable 
input events in menu mode
-#endif // MYGUI
 
-
-       /*
-       if (INPUTENGINE.getEventBoolValueBounce(EV_TOGGLESHADERS, 0.5f))
-       {
-               if(shaderSchemeMode)
-               {
-                       shaderSchemeMode=0;
-                       
mCamera->getViewport()->setMaterialScheme(MaterialManager::DEFAULT_SCHEME_NAME);
-                       LOG("shaders disabled");
-                       if(ow) ow->flashMessage("shaders disabled");
-               } else
-               {
-                       shaderSchemeMode=1;
-                       
mCamera->getViewport()->setMaterialScheme(RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
-                       LOG("shaders enabled");
-                       if(ow) ow->flashMessage("shaders enabled");
-               }
-       }
-       */
-
        if (INPUTENGINE.getEventBoolValueBounce(EV_COMMON_SCREENSHOT_BIG, 0.5f))
        {
                // hide flash messages
@@ -2272,7 +2209,6 @@
                bool enablegrab = true;
                if (cameramode != CAMERA_FREE)
                {
-                       //GUIManager::getSingleton().setCursorPosition(mouseX, 
mouseY);
                        if (current_truck==-1)
                        {
                                if(person)
@@ -2302,85 +2238,6 @@
                        }
                        else //we are in a vehicle
                        {
-                               //the mouse stuff
-                               const OIS::MouseState mstate = 
INPUTENGINE.getMouseState();
-                               static bool buttonsPressed = false;
-                               int click=-1;
-                               // click = -1 = nothing clicked
-                               // click = 0 left click (windows)
-                               // click = 1 right click (linux)
-
-                               // do not move the mouse while rotating the view
-                               static int oldstate = 0;
-                               // oldstate = 0 : dragging view to rotate
-                               // oldstate = 1 : moving mouse
-                               // oldstate = 2 : picking node
-                               //LOG("oldstate="+TOSTRING(oldstate));
-
-                               // this is a workaround to bea able to release 
mouse buttons in the dynamic mode
-                               buttonsPressed = (mstate.buttons > 0);
-
-                               if(inputGrabMode == GRAB_DYNAMICALLY)
-                               {
-                                       // we do not use this anymore, as we 
can set the mouse's position instead of grabbing it
-                                       //INPUTENGINE.grabMouse(buttonsPressed);
-
-                                       // Hide the mouse if we press any mouse 
buttons of if we are in mouse mode
-                                       
INPUTENGINE.hideMouse((buttonsPressed||(oldstate==1)));
-
-                                       // if we are rotating, fix the mouse 
cursor
-                                       if(oldstate == 0)
-                                               
INPUTENGINE.setMousePosition(mouseX, mouseY);
-                               }
-
-                               //if(inputGrabMode == GRAB_ALL || 
(inputGrabMode == GRAB_DYNAMICALLY &&  (mstate.buttons != 0 || buttonsPressed)))
-
-                               
if(!mstate.buttonDown((switchMouseButtons?(OIS::MB_Left):(OIS::MB_Right))))
-                               {
-                                       if(oldstate != 1)
-                                       {
-                                               if(ow) 
ow->mouseOverlay->getChild("mouse/pointer")->setMaterialName("mouse");
-                                               oldstate = 1;
-                                       }
-
-                                       if(inputGrabMode == GRAB_DYNAMICALLY)
-                                       {
-                                               // using absolute positions!
-                                               mouseX=mstate.X.abs;
-                                               mouseY=mstate.Y.abs;
-                                       } else
-                                       {
-                                               mouseX+=mstate.X.rel;
-                                               mouseY+=mstate.Y.rel;
-                                       }
-                                       if (mouseX<0) mouseX=0;
-                                       if (mouseX>screenWidth-1) 
mouseX=screenWidth-1;
-                                       if (mouseY<0) mouseY=0;
-                                       if (mouseY>screenHeight-1) 
mouseY=screenHeight-1;
-
-                                       // set the final position of the ingame 
cursor
-                                       if(ow) 
ow->mouseElement->setPosition(mouseX, mouseY);
-
-                                       //action
-                                       if(switchMouseButtons)
-                                       {
-                                               if 
(mstate.buttonDown(OIS::MB_Right)) click=0;
-                                               if 
(mstate.buttonDown(OIS::MB_Left)) click=1;
-                                       } else
-                                       {
-                                               if 
(mstate.buttonDown(OIS::MB_Left)) click=0;
-                                               if 
(mstate.buttonDown(OIS::MB_Right)) click=1;
-                                       }
-
-                               }else {
-                                       if(oldstate != 0)
-                                       {
-                                               if(ow) 
ow->mouseOverlay->getChild("mouse/pointer")->setMaterialName("mouse-rotate");
-                                               oldstate = 0;
-                                       }
-                               }
-
-
                                // get commands
                                int i;
 // -- maxbe here we should define a maximum numbers per trucks. Some trucks 
does not have that much commands
@@ -2414,9 +2271,6 @@
                                                
trucks[current_truck]->replaypos-=10;
                                        }
 
-                                       if(INPUTENGINE.isKeyDown(OIS::KC_LMENU))
-                                               
trucks[current_truck]->replaypos += mstate.X.rel;
-
                                }
 
                                if (trucks[current_truck]->driveable==TRUCK)
@@ -2780,184 +2634,6 @@
                                        {
                                                
trucks[current_truck]->disconnectAutopilot();
                                        }
-                                       //left mouse click
-                                       if (ow && click==0)
-                                       {
-                                               OverlayElement 
*element=ow->airneedlesOverlay->findElementAt((float)mouseX/(float)screenWidth,(float)mouseY/(float)screenHeight);
-                                               if (element)
-                                               {
-                                                       char name[256];
-                                                       
strcpy(name,element->getName().c_str());
-                                                       if (!strncmp(name, 
"tracks/thrust1", 14)) 
trucks[current_truck]->aeroengines[0]->setThrotle(1.0f-((((float)mouseY/(float)screenHeight)-ow->thrtop-ow->throffset)/ow->thrheight));
-                                                       if (!strncmp(name, 
"tracks/thrust2", 14) && trucks[current_truck]->free_aeroengine>1) 
trucks[current_truck]->aeroengines[1]->setThrotle(1.0f-((((float)mouseY/(float)screenHeight)-ow->thrtop-ow->throffset)/ow->thrheight));
-                                                       if (!strncmp(name, 
"tracks/thrust3", 14) && trucks[current_truck]->free_aeroengine>2) 
trucks[current_truck]->aeroengines[2]->setThrotle(1.0f-((((float)mouseY/(float)screenHeight)-ow->thrtop-ow->throffset)/ow->thrheight));
-                                                       if (!strncmp(name, 
"tracks/thrust4", 14) && trucks[current_truck]->free_aeroengine>3) 
trucks[current_truck]->aeroengines[3]->setThrotle(1.0f-((((float)mouseY/(float)screenHeight)-ow->thrtop-ow->throffset)/ow->thrheight));
-                                                       enablegrab=false;
-                                               }
-                                               //also for main dashboard
-                                               OverlayElement 
*element2=ow->airdashboardOverlay->findElementAt((float)mouseX/(float)screenWidth,(float)mouseY/(float)screenHeight);
-                                               if (element2)
-                                               {
-                                                       enablegrab=false;
-                                                       char name[256];
-                                                       
strcpy(name,element2->getName().c_str());
-                                                       //LOG("element 
"+element2->getName());
-                                                       if (!strncmp(name, 
"tracks/engstart1", 16)) trucks[current_truck]->aeroengines[0]->flipStart();
-                                                       if (!strncmp(name, 
"tracks/engstart2", 16) && trucks[current_truck]->free_aeroengine>1) 
trucks[current_truck]->aeroengines[1]->flipStart();
-                                                       if (!strncmp(name, 
"tracks/engstart3", 16) && trucks[current_truck]->free_aeroengine>2) 
trucks[current_truck]->aeroengines[2]->flipStart();
-                                                       if (!strncmp(name, 
"tracks/engstart4", 16) && trucks[current_truck]->free_aeroengine>3) 
trucks[current_truck]->aeroengines[3]->flipStart();
-                                                       //heading group
-                                                       if (!strcmp(name, 
"tracks/ap_hdg_but") && trucks[current_truck]->autopilot && 
mTimeUntilNextToggle <= 0)
-                                                       {
-                                                               
mTimeUntilNextToggle = 0.2;
-                                                               
if(trucks[current_truck]->autopilot->toggleHeading(Autopilot::HEADING_FIXED)==Autopilot::HEADING_FIXED)
-                                                                       
OverlayManager::getSingleton().getOverlayElement("tracks/ap_hdg_but")->setMaterialName("tracks/hdg-on");
-                                                               else
-                                                                       
OverlayManager::getSingleton().getOverlayElement("tracks/ap_hdg_but")->setMaterialName("tracks/hdg-off");
-                                                               
OverlayManager::getSingleton().getOverlayElement("tracks/ap_wlv_but")->setMaterialName("tracks/wlv-off");
-                                                               
OverlayManager::getSingleton().getOverlayElement("tracks/ap_nav_but")->setMaterialName("tracks/nav-off");
-                                                       }
-                                                       if (!strcmp(name, 
"tracks/ap_wlv_but") && trucks[current_truck]->autopilot && 
mTimeUntilNextToggle <= 0)
-                                                       {
-                                                               
mTimeUntilNextToggle = 0.2;
-                                                               
if(trucks[current_truck]->autopilot->toggleHeading(Autopilot::HEADING_WLV)==Autopilot::HEADING_WLV)
-                                                                       
OverlayManager::getSingleton().getOverlayElement("tracks/ap_wlv_but")->setMaterialName("tracks/wlv-on");
-                                                               else
-                                                                       
OverlayManager::getSingleton().getOverlayElement("tracks/ap_wlv_but")->setMaterialName("tracks/wlv-off");
-                                                               
OverlayManager::getSingleton().getOverlayElement("tracks/ap_hdg_but")->setMaterialName("tracks/hdg-off");
-                                                               
OverlayManager::getSingleton().getOverlayElement("tracks/ap_nav_but")->setMaterialName("tracks/nav-off");
-                                                       }
-                                                       if (!strcmp(name, 
"tracks/ap_nav_but") && trucks[current_truck]->autopilot && 
mTimeUntilNextToggle <= 0)
-                                                       {
-                                                               
mTimeUntilNextToggle = 0.2;
-                                                               
if(trucks[current_truck]->autopilot->toggleHeading(Autopilot::HEADING_NAV)==Autopilot::HEADING_NAV)
-                                                                       
OverlayManager::getSingleton().getOverlayElement("tracks/ap_nav_but")->setMaterialName("tracks/nav-on");
-                                                               else
-                                                                       
OverlayManager::getSingleton().getOverlayElement("tracks/ap_nav_but")->setMaterialName("tracks/nav-off");
-                                                               
OverlayManager::getSingleton().getOverlayElement("tracks/ap_wlv_but")->setMaterialName("tracks/wlv-off");
-                                                               
OverlayManager::getSingleton().getOverlayElement("tracks/ap_hdg_but")->setMaterialName("tracks/hdg-off");
-                                                       }
-                                                       //altitude group
-                                                       if (!strcmp(name, 
"tracks/ap_alt_but") && trucks[current_truck]->autopilot && 
mTimeUntilNextToggle <= 0)
-                                                       {
-                                                               
mTimeUntilNextToggle = 0.2;
-                                                               
if(trucks[current_truck]->autopilot->toggleAlt(Autopilot::ALT_FIXED)==Autopilot::ALT_FIXED)
-                                                                       
OverlayManager::getSingleton().getOverlayElement("tracks/ap_alt_but")->setMaterialName("tracks/hold-on");
-                                                               else
-                                                                       
OverlayManager::getSingleton().getOverlayElement("tracks/ap_alt_but")->setMaterialName("tracks/hold-off");
-                                                               
OverlayManager::getSingleton().getOverlayElement("tracks/ap_vs_but")->setMaterialName("tracks/vs-off");
-                                                       }
-                                                       if (!strcmp(name, 
"tracks/ap_vs_but") && trucks[current_truck]->autopilot && mTimeUntilNextToggle 
<= 0)
-                                                       {
-                                                               
mTimeUntilNextToggle = 0.2;
-                                                               
if(trucks[current_truck]->autopilot->toggleAlt(Autopilot::ALT_VS)==Autopilot::ALT_VS)
-                                                                       
OverlayManager::getSingleton().getOverlayElement("tracks/ap_vs_but")->setMaterialName("tracks/vs-on");
-                                                               else
-                                                                       
OverlayManager::getSingleton().getOverlayElement("tracks/ap_vs_but")->setMaterialName("tracks/vs-off");
-                                                               
OverlayManager::getSingleton().getOverlayElement("tracks/ap_alt_but")->setMaterialName("tracks/hold-off");
-                                                       }
-                                                       //IAS
-                                                       if (!strcmp(name, 
"tracks/ap_ias_but") && trucks[current_truck]->autopilot && 
mTimeUntilNextToggle <= 0)
-                                                       {
-                                                               
mTimeUntilNextToggle = 0.2;
-                                                               
if(trucks[current_truck]->autopilot->toggleIAS())
-                                                                       
OverlayManager::getSingleton().getOverlayElement("tracks/ap_ias_but")->setMaterialName("tracks/athr-on");
-                                                               else
-                                                                       
OverlayManager::getSingleton().getOverlayElement("tracks/ap_ias_but")->setMaterialName("tracks/athr-off");
-                                                       }
-                                                       //GPWS
-                                                       if (!strcmp(name, 
"tracks/ap_gpws_but") && trucks[current_truck]->autopilot && 
mTimeUntilNextToggle <= 0)
-                                                       {
-                                                               
mTimeUntilNextToggle = 0.2;
-                                                               
if(trucks[current_truck]->autopilot->toggleGPWS())
-                                                                       
OverlayManager::getSingleton().getOverlayElement("tracks/ap_gpws_but")->setMaterialName("tracks/gpws-on");
-                                                               else
-                                                                       
OverlayManager::getSingleton().getOverlayElement("tracks/ap_gpws_but")->setMaterialName("tracks/gpws-off");
-                                                       }
-                                                       //BRKS
-                                                       if (!strcmp(name, 
"tracks/ap_brks_but") && trucks[current_truck]->autopilot && 
mTimeUntilNextToggle <= 0)
-                                                       {
-                                                               
trucks[current_truck]->parkingbrakeToggle();
-                                                               
if(trucks[current_truck]->parkingbrake)
-                                                                       
OverlayManager::getSingleton().getOverlayElement("tracks/ap_brks_but")->setMaterialName("tracks/brks-on");
-                                                               else
-                                                                       
OverlayManager::getSingleton().getOverlayElement("tracks/ap_brks_but")->setMaterialName("tracks/brks-off");
-                                                               
mTimeUntilNextToggle = 0.2;
-                                                       }
-                                                       //trims
-                                                       if (!strcmp(name, 
"tracks/ap_hdg_up") && trucks[current_truck]->autopilot && mTimeUntilNextToggle 
<= 0)
-                                                       {
-                                                               
mTimeUntilNextToggle = 0.1;
-                                                               int 
val=trucks[current_truck]->autopilot->adjHDG(1);
-                                                               char str[10];
-                                                               sprintf(str, 
"%.3u", val);
-                                                               
OverlayManager::getSingleton().getOverlayElement("tracks/ap_hdg_val")->setCaption(str);
-                                                       }
-                                                       if (!strcmp(name, 
"tracks/ap_hdg_dn") && trucks[current_truck]->autopilot && mTimeUntilNextToggle 
<= 0)
-                                                       {
-                                                               
mTimeUntilNextToggle = 0.1;
-                                                               int 
val=trucks[current_truck]->autopilot->adjHDG(-1);
-                                                               char str[10];
-                                                               sprintf(str, 
"%.3u", val);
-                                                               
OverlayManager::getSingleton().getOverlayElement("tracks/ap_hdg_val")->setCaption(str);
-                                                       }
-                                                       if (!strcmp(name, 
"tracks/ap_alt_up") && trucks[current_truck]->autopilot && mTimeUntilNextToggle 
<= 0)
-                                                       {
-                                                               
mTimeUntilNextToggle = 0.1;
-                                                               int 
val=trucks[current_truck]->autopilot->adjALT(100);
-                                                               char str[10];
-                                                               sprintf(str, 
"%i00", val/100);
-                                                               
OverlayManager::getSingleton().getOverlayElement("tracks/ap_alt_val")->setCaption(str);
-                                                       }
-                                                       if (!strcmp(name, 
"tracks/ap_alt_dn") && trucks[current_truck]->autopilot && mTimeUntilNextToggle 
<= 0)
-                                                       {
-                                                               
mTimeUntilNextToggle = 0.1;
-                                                               int 
val=trucks[current_truck]->autopilot->adjALT(-100);
-                                                               char str[10];
-                                                               sprintf(str, 
"%i00", val/100);
-                                                               
OverlayManager::getSingleton().getOverlayElement("tracks/ap_alt_val")->setCaption(str);
-                                                       }
-                                                       if (!strcmp(name, 
"tracks/ap_vs_up") && trucks[current_truck]->autopilot && mTimeUntilNextToggle 
<= 0)
-                                                       {
-                                                               
mTimeUntilNextToggle = 0.1;
-                                                               int 
val=trucks[current_truck]->autopilot->adjVS(100);
-                                                               char str[10];
-                                                               if (val<0)
-                                                                       
sprintf(str, "%i00", val/100);
-                                                               else if 
(val==0) strcpy(str, "000");
-                                                               else 
sprintf(str, "+%i00", val/100);
-                                                               
OverlayManager::getSingleton().getOverlayElement("tracks/ap_vs_val")->setCaption(str);
-                                                       }
-                                                       if (!strcmp(name, 
"tracks/ap_vs_dn") && trucks[current_truck]->autopilot && mTimeUntilNextToggle 
<= 0)
-                                                       {
-                                                               
mTimeUntilNextToggle = 0.1;
-                                                               int 
val=trucks[current_truck]->autopilot->adjVS(-100);
-                                                               char str[10];
-                                                               if (val<0)
-                                                                       
sprintf(str, "%i00", val/100);
-                                                               else if 
(val==0) strcpy(str, "000");
-                                                               else 
sprintf(str, "+%i00", val/100);
-                                                               
OverlayManager::getSingleton().getOverlayElement("tracks/ap_vs_val")->setCaption(str);
-                                                       }
-                                                       if (!strcmp(name, 
"tracks/ap_ias_up") && trucks[current_truck]->autopilot && mTimeUntilNextToggle 
<= 0)
-                                                       {
-                                                               
mTimeUntilNextToggle = 0.1;
-                                                               int 
val=trucks[current_truck]->autopilot->adjIAS(1);
-                                                               char str[10];
-                                                               sprintf(str, 
"%.3u", val);
-                                                               
OverlayManager::getSingleton().getOverlayElement("tracks/ap_ias_val")->setCaption(str);
-                                                       }
-                                                       if (!strcmp(name, 
"tracks/ap_ias_dn") && trucks[current_truck]->autopilot && mTimeUntilNextToggle 
<= 0)
-                                                       {
-                                                               
mTimeUntilNextToggle = 0.1;
-                                                               int 
val=trucks[current_truck]->autopilot->adjIAS(-1);
-                                                               char str[10];
-                                                               sprintf(str, 
"%.3u", val);
-                                                               
OverlayManager::getSingleton().getOverlayElement("tracks/ap_ias_val")->setCaption(str);
-                                                       }
-                                               }
-
-                                       }
                                        //AIRPLANE KEYS
                                        float commandrate=4.0;
                                        //float dt=evt.timeSinceLastFrame;
@@ -3333,178 +3009,14 @@
                                        if(ow) ow->showPressureOverlay(false);
                                }
 
-                               if(enablegrab && ow)
-                               {
-                                       //node grabbing
-                                       bool ctrldown = 
INPUTENGINE.isKeyDown(OIS::KC_LCONTROL) || 
INPUTENGINE.isKeyDown(OIS::KC_RCONTROL);
-                                       //node grabbing
-                                       if (isnodegrabbed)
-                                       {
-                                               if(oldstate != 2)
-                                               {
-                                                       if(ctrldown)
-                                                               
ow->mouseOverlay->getChild("mouse/pointer")->setMaterialName("mouse-locked-heavy");
-                                                       else
-                                                               
ow->mouseOverlay->getChild("mouse/pointer")->setMaterialName("mouse-locked");
-                                                       
pickLineNode->setVisible(true);
-                                                       oldstate = 2;
-                                               }
 
-                                               if (click==0)
-                                               {
-                                                       // allow the grab force 
to change
-                                                       
if(fabs((float)(mstate.Z.rel)) > 0.01)
-                                                       {
-                                                               
if(INPUTENGINE.isKeyDown(OIS::KC_LSHIFT) || 
INPUTENGINE.isKeyDown(OIS::KC_RSHIFT))
-                                                                       
mouseGrabForce += mstate.Z.rel * 100.0f;
-                                                               else
-                                                                       
mouseGrabForce += mstate.Z.rel * 10.0f;
-                                                               // do not allow 
negative forces, looks weird
-                                                               
if(mouseGrabForce < 0.0f)
-                                                                       
mouseGrabForce = 0.0f;
-
-                                                               //LOG("mouse 
force: " + TOSTRING(mouseGrabForce));
-                                                       }
-                                                       //exert forces
-                                                       //find pointed position
-                                                       Ray 
mouseRay=mCamera->getCameraToViewportRay((float)mouseX/(float)screenWidth, 
(float)mouseY/(float)screenHeight);
-                                                       Vector3 
pos=mouseRay.getPoint(distgrabbed);
-
-                                                       // update pickline
-                                                       
pickLine->beginUpdate(0);
-                                                       
pickLine->position(trucks[truckgrabbed]->nodes[nodegrabbed].AbsPosition);
-                                                       pickLine->position(pos);
-                                                       pickLine->end();
-
-                                                       // add forces
-
-                                                       
trucks[truckgrabbed]->mouseMove(nodegrabbed,pos, mouseGrabForce);
-                                               }
-                                               else
-                                               {
-                                                       
pickLineNode->setVisible(false);
-                                                       isnodegrabbed=false;
-                                                       
trucks[truckgrabbed]->mouseMove(-1,Vector3::ZERO, 0);
-                                               }
-                                       }
-                                       else
-                                       {
-                                               if (click==0)
-                                               {
-                                                       //try to grab something
-                                                       Ray 
mouseRay=mCamera->getCameraToViewportRay((float)mouseX/(float)screenWidth, 
(float)mouseY/(float)screenHeight);
-                                                       int t;
-                                                       int mindist=30000;
-                                                       int mintruck=-1;
-                                                       int minnode=-1;
-                                                       for (t=0; t<free_truck; 
t++)
-                                                       {
-                                                               if(!trucks[t]) 
continue;
-                                                               int i;
-                                                               for (i=0; 
i<trucks[t]->free_node; i++)
-                                                               {
-                                                                       
std::pair<bool,Real> 
pair=mouseRay.intersects(Sphere(trucks[t]->nodes[i].AbsPosition, 0.1));
-                                                                       if 
(pair.first)
-                                                                       {
-                                                                               
if (pair.second<mindist)
-                                                                               
{
-                                                                               
        mindist=(int)pair.second;
-                                                                               
        mintruck=t;
-                                                                               
        minnode=i;
-                                                                               
}
-                                                                       }
-                                                               }
-                                                       }
-                                                       //okay see if we got a 
match
-                                                       if (mintruck!=-1)
-                                                       {
-#ifdef USE_ANGELSCRIPT
-                                                               
ScriptEngine::getSingleton().triggerEvent(ScriptEngine::SE_GENERIC_MOUSE_BEAM_INTERACTION,
 current_truck);
-#endif //ANGELSCRIPT
-                                                               
truckgrabbed=mintruck;
-                                                               
nodegrabbed=minnode;
-                                                               
distgrabbed=mindist;
-                                                               
isnodegrabbed=true;
-                                                       }
-                                               }
-                                       }
-                               }
                        }//end of truck!=-1
                }
 
 
                static unsigned char brushNum=0;
 
-               const OIS::MouseState mstate = INPUTENGINE.getMouseState();
-               static bool buttonsPressed = false;
-               if(ow && inputGrabMode == GRAB_ALL || (inputGrabMode == 
GRAB_DYNAMICALLY &&  (mstate.buttons != 0 || buttonsPressed)))
-               {
-                       if ((cameramode==CAMERA_INT || cameramode==CAMERA_EXT 
|| cameramode==CAMERA_FIX || cameramode==CAMERA_FREE_FIXED) && current_truck == 
-1)
-                       {
-                               bool btnview = 
mstate.buttonDown((switchMouseButtons?OIS::MB_Left:OIS::MB_Right));
-                               if(inputGrabMode == GRAB_DYNAMICALLY)
-                               {
-                                       if(!buttonsPressed && btnview)
-                                       {
-                                               // set mouse position on the 
first click
-                                               mouseX = mstate.X.abs;
-                                               mouseY = mstate.Y.abs;
-                                               // display cursor
-                                               
ow->mouseElement->setPosition(mouseX, mouseY);
-                                               
ow->mouseOverlay->getChild("mouse/pointer")->setMaterialName("mouse-rotate");
-                                               ow->mouseOverlay->show();
-                                               INPUTENGINE.hideMouse(true);
-                                       } else if (buttonsPressed && !btnview)
-                                       {
-                                               // release event
-                                               
ow->mouseOverlay->getChild("mouse/pointer")->setMaterialName("mouse");
-                                               ow->mouseOverlay->hide();
-                                               INPUTENGINE.hideMouse(false);
-                                       }
-                                       if(btnview)
-                                               
INPUTENGINE.setMousePosition(mouseX, mouseY);
 
-                               }
-                               if(inputGrabMode == GRAB_ALL || (inputGrabMode 
== GRAB_DYNAMICALLY &&  btnview))
-                               {
-                                       // 'First person' mode :)
-                                       // x rotation = automatically by 
rotating the character
-                                       if (mstate.Y.rel != 0)
-                                               camRotY += Degree(-mstate.Y.rel 
/ 10.0);
-                                       if (mstate.Z.rel != 0)
-                                               
if(INPUTENGINE.isKeyDown(OIS::KC_LSHIFT) || 
INPUTENGINE.isKeyDown(OIS::KC_RSHIFT))
-                                                       camDist += 
-mstate.Z.rel / 12.0;
-                                               else
-                                                       camDist += 
-mstate.Z.rel / 120.0;
-
-                                       // rather hacked workaround :|
-                                       float angle = person->getAngle() + 
(float)(mstate.X.rel) / 120.0;
-                                       
person->getSceneNode()->resetOrientation();
-                                       
person->getSceneNode()->yaw(-Radian(angle));
-                                       person->setAngle(angle);
-                                       person->updateMapIcon();
-                               }
-                       } else
-                       {
-                               
if(mstate.buttonDown((switchMouseButtons?OIS::MB_Left:OIS::MB_Right)))
-                               {
-                                       // fix mouse at the current place :)
-                                       if(inputGrabMode == GRAB_DYNAMICALLY)
-                                               
INPUTENGINE.setMousePosition(mouseX, mouseY);
-                                       if (mstate.X.rel != 0)
-                                               camRotX += Degree(mstate.X.rel 
/ 10.0);
-                                       if (mstate.Y.rel != 0)
-                                               camRotY += Degree(-mstate.Y.rel 
/ 10.0);
-                                       if (mstate.Z.rel != 0)
-                                               
if(INPUTENGINE.isKeyDown(OIS::KC_LSHIFT) || 
INPUTENGINE.isKeyDown(OIS::KC_RSHIFT))
-                                                       camDist += 
-mstate.Z.rel / 12.0;
-                                               else
-                                                       camDist += 
-mstate.Z.rel / 120.0;
-                               }
-                       }
-                       buttonsPressed = (mstate.buttons > 0);
-               }
-
                if (INPUTENGINE.getEventBoolValueBounce(EV_CAMERA_LOOKBACK))
                {
                        if(camRotX > Degree(0))
@@ -3787,7 +3299,6 @@
                                mTimeUntilNextToggle = 0.0; //No delay in this 
case: the truck must brake like braking normally
                        }
                }
-
        } else
        {
                //no terrain or truck loaded
@@ -4145,11 +3656,6 @@
        if (current_truck!=-1) trucks[current_truck]->prepareShutdown();
        INPUTENGINE.prepareShutdown();
 
-       // destroy input things properly
-       //mInputManager->destroyInputObject(mMouse); mMouse = 0;
-       //mInputManager->destroyInputObject(mKeyboard); mKeyboard = 0;
-       //OIS::InputManager::destroyInputSystem(mInputManager); mInputManager = 
0;
-
        
        
        shutdownall=true;
@@ -6076,7 +5582,6 @@
 #endif //MYGUI
 
                //getting outside
-               if(ow) ow->mouseOverlay->hide();
                Vector3 position = Vector3::ZERO;
                if(trucks[previous_truck])
                {
@@ -6123,7 +5628,6 @@
        {
                //getting inside
                if(netmode && NETCHAT.getVisible()) NETCHAT.setMode(this, 
NETCHAT_LEFT_SMALL, true);
-               if(ow) ow->mouseOverlay->show();
                //person->setVisible(false);
                if(ow &&!hidegui)
                {
@@ -6231,10 +5735,6 @@
        if(!hfinder) return;
        if (loading_state!=ALL_LOADED && loading_state != EDITOR_PAUSE) return;
 
-#ifdef USE_MYGUI
-       if(GUI_MainMenu::getSingleton().getVisible()) return; // disable camera 
movement in menu mode
-#endif // MYGUI
-
        if (isnodegrabbed) return; //freeze camera
 
        bool changeCamMode = (lastcameramode != cameramode);
@@ -6267,17 +5767,6 @@
                        mMoveScale *= 0.05;
                }
 
-               const OIS::MouseState &ms = INPUTENGINE.getMouseState();
-               if( ms.buttonDown(OIS::MB_Right) )
-               {
-                       mTranslateVector.x += ms.X.rel * 0.13;
-                       mTranslateVector.y -= ms.Y.rel * 0.13;
-               }
-               else
-               {
-                       mRotX = Degree(-ms.X.rel * 0.13);
-                       mRotY = Degree(-ms.Y.rel * 0.13);
-               }
 
                if(INPUTENGINE.getEventBoolValue(EV_CHARACTER_SIDESTEP_LEFT))
                        mTranslateVector.x = -mMoveScale;       // Move camera 
left
@@ -7295,11 +6784,6 @@
        INPUTENGINE.resetKeys();
 }
 
-Ogre::Ray RoRFrameListener::getMouseRay()
-{
-       return 
mCamera->getCameraToViewportRay((float)mouseX/(float)screenWidth, 
(float)mouseY/(float)screenHeight);
-}
-
 void RoRFrameListener::pauseSim(bool value)
 {
        // TODO: implement this (how to do so?)
@@ -7336,7 +6820,6 @@
 {
        if(visible)
        {
-               if(ow) ow->mouseOverlay->hide();
                if (netmode && NETCHAT.getVisible())
                        NETCHAT.toggleVisible(this);
 
@@ -7356,7 +6839,6 @@
                        NETCHAT.toggleVisible(this);
                if(current_truck != -1 && cameramode!=CAMERA_INT)
                {
-                       if(ow) ow->mouseOverlay->show();
                        if(ow) ow->showDashboardOverlays(true, 
trucks[current_truck]->driveable);
                        //if(bigMap) bigMap->setVisibility(true);
                }

Modified: trunk/source/main/gameplay/RoRFrameListener.h
===================================================================
--- trunk/source/main/gameplay/RoRFrameListener.h       2011-03-11 18:02:20 UTC 
(rev 1750)
+++ trunk/source/main/gameplay/RoRFrameListener.h       2011-03-11 22:59:32 UTC 
(rev 1751)
@@ -25,13 +25,6 @@
 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
 #include <windows.h>
 #endif
-//#include "OgreKeyEvent.h"
-//#include "OgreEventListeners.h"
-//#include "OISEvents.h"
-//#include "OISInputManager.h"
-//#include "OISMouse.h"
-//#include "OISKeyboard.h"
-//#include "OISJoyStick.h"
 
 #ifdef USE_MPLATFORM
 #include "mplatform_base.h"
@@ -199,12 +192,9 @@
 
        std::map< std::string, Ogre::SceneNode *> loadedObjects;
        DOFManager *mDOF;
-       int mouseX;
-       int mouseY;
        int shaderSchemeMode;
        int inputGrabMode;
        int mouseGrabState;
-       bool switchMouseButtons;
        int screenWidth;
        int screenHeight;
        bool isnodegrabbed;
@@ -276,8 +266,6 @@
        MapTextureCreator *mtc;
        int fogmode;
        float fogdensity;
-       ManualObject *pickLine;
-       SceneNode *pickLineNode;
        bool updateTruckMirrors(float dt);
        void gridScreenshots(Ogre::RenderWindow* pRenderWindow, Ogre::Camera* 
pCamera, const int& pGridSize, const Ogre::String& path, const Ogre::String& 
pFileName, const Ogre::String& pFileExtention, const bool& pStitchGridImages);
        void initDust();
@@ -299,11 +287,11 @@
        bool benchmarkStep(float dt);
        void initTrucks(bool loadmanual, Ogre::String selected, Ogre::String 
selectedExtension = Ogre::String(), std::vector<Ogre::String> *truckconfig=0, 
bool enterTruck=false);
        void setCurrentTruck(int v);
-       //bool processUnbufferedMouseInput(const FrameEvent& evt);
+
        void moveCamera(float dt);
        void hideGUI(bool visible);
        Ogre::String saveTerrainMesh();
-       //void showBigMap(bool show);
+
        // Override frameStarted event to process that (don't care about 
frameEnded)
        bool frameStarted(const FrameEvent& evt);
        void recursiveActivation(int j);
@@ -321,7 +309,6 @@
 
        Character *person;
        ChatSystem *netChat;
-       bool getSwitchButtons() { return switchMouseButtons; };
        static HeightFinder *hfinder;
        double getTime() {return rtime;};
        SceneManager *getSceneMgr() { return mSceneMgr; };
@@ -334,8 +321,6 @@
        Beam *getCurrentTruck() { return 
(current_truck<0)?0:trucks[current_truck]; };
        Water *getWater() { return w; };
        Camera *getCamera() { return mCamera; };
-       //SceneNode *getPersonNode() { return personode; };
-       //OIS::Mouse *getMouse() { return  mMouse; };
        int getLoadingState() { return loading_state; };
        void setLoadingState(int value);
        void pauseSim(bool value);
@@ -363,7 +348,6 @@
        static float getGravity() { return gravity; };
        static void setGravity(float value);
 
-       Ogre::Ray getMouseRay();
        void shutdown_pre();
        void shutdown_final();
 
@@ -383,6 +367,7 @@
        int getNetQuality(bool ack=false);
        bool getNetQualityChanged();
        pthread_mutex_t mutex_data;
+       Radian camRotX, camRotY;
 private:
        int net_quality; 
        bool net_quality_changed; 
@@ -399,10 +384,6 @@
 
        DotSceneLoader* mLoader;
 
-
-
-       //OIS::InputManager* mInputManager;
-       //OIS::Mouse* mMouse;
        Camera* mCamera;
        Vector3 cdoppler;
        Vector3 reload_pos;
@@ -421,7 +402,6 @@
 
        //camera
        Vector3 camIdealPosition;
-       Radian camRotX, camRotY;
        bool camCollided;
        Vector3 camPosColl;
        Radian pushcamRotX, pushcamRotY;

Added: trunk/source/main/gameplay/SceneMouse.cpp
===================================================================
--- trunk/source/main/gameplay/SceneMouse.cpp                           (rev 0)
+++ trunk/source/main/gameplay/SceneMouse.cpp   2011-03-11 22:59:32 UTC (rev 
1751)
@@ -0,0 +1,89 @@
+/*
+This source file is part of Rigs of Rods
+Copyright 2005-2011 Pierre-Michel Ricordel
+Copyright 2007-2011 Thomas Fischer
+
+For more information, see http://www.rigsofrods.com/
+
+Rigs of Rods is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 3, as 
+published by the Free Software Foundation.
+
+Rigs of Rods is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#include "SceneMouse.h"
+#include "RoRFrameListener.h"
+#include <Ogre.h>
+#include <MyGUI.h>
+
+using namespace Ogre;
+
+template<> SceneMouse *Singleton < SceneMouse >::ms_Singleton = 0;
+
+SceneMouse::SceneMouse(Ogre::SceneManager *scm, RoRFrameListener *rfl) : 
scm(scm), rfl(rfl)
+{
+       mouseGrabForce = 100000.0f;
+       mouseGrabState = 0;
+       
+       // load 3d line for mouse picking
+       pickLine =  scm->createManualObject("PickLineObject");
+       pickLineNode = 
scm->getRootSceneNode()->createChildSceneNode("PickLineNode");
+
+       MaterialPtr pickLineMaterial = 
MaterialManager::getSingleton().create("PickLineMaterial",ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+       pickLineMaterial->setReceiveShadows(false);
+       pickLineMaterial->getTechnique(0)->setLightingEnabled(true);
+       pickLineMaterial->getTechnique(0)->getPass(0)->setDiffuse(0,0,1,0);
+       pickLineMaterial->getTechnique(0)->getPass(0)->setAmbient(0,0,1);
+       
pickLineMaterial->getTechnique(0)->getPass(0)->setSelfIllumination(0,0,1);
+
+       pickLine->begin("PickLineMaterial", 
Ogre::RenderOperation::OT_LINE_LIST);
+       pickLine->position(0, 0, 0);
+       pickLine->position(0, 0, 0);
+       pickLine->end();
+       pickLineNode->attachObject(pickLine);
+       pickLineNode->setVisible(false);
+}
+
+SceneMouse::~SceneMouse()
+{
+}
+
+bool SceneMouse::mouseMoved(const OIS::MouseEvent& _arg)
+{
+       const OIS::MouseState ms = _arg.state;
+
+       if(ms.buttonDown(OIS::MB_Right))
+       {
+               rfl->camRotX += Degree(-(float)ms.X.rel * 0.13f);
+               rfl->camRotY += Degree(-(float)ms.Y.rel * 0.13f);
+               MyGUI::PointerManager::getInstance().setPointer("hand");
+               return true;
+       }
+       return false;
+}
+
+bool SceneMouse::mousePressed(const OIS::MouseEvent& _arg, OIS::MouseButtonID 
_id)
+{
+       return true;
+}
+
+bool SceneMouse::mouseReleased(const OIS::MouseEvent& _arg, OIS::MouseButtonID 
_id)
+{
+       return true;
+}
+
+bool SceneMouse::keyPressed(const OIS::KeyEvent& _arg)
+{
+       return true;
+}
+
+bool SceneMouse::keyReleased(const OIS::KeyEvent& _arg)
+{
+       return true;
+}

Added: trunk/source/main/gameplay/SceneMouse.h
===================================================================
--- trunk/source/main/gameplay/SceneMouse.h                             (rev 0)
+++ trunk/source/main/gameplay/SceneMouse.h     2011-03-11 22:59:32 UTC (rev 
1751)
@@ -0,0 +1,56 @@
+/*
+This source file is part of Rigs of Rods
+Copyright 2005-2011 Pierre-Michel Ricordel
+Copyright 2007-2011 Thomas Fischer
+
+For more information, see http://www.rigsofrods.com/
+
+Rigs of Rods is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 3, as 
+published by the Free Software Foundation.
+
+Rigs of Rods is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+// created by Thomas Fischer thomas{AT}thomasfischer{DOT}biz, 11th of March 
2011
+
+#ifndef SCENEMOUSE_H__
+#define SCENEMOUSE_H__
+
+#include "RoRPrerequisites.h"
+#include <OgrePrerequisites.h>
+#include <OgreSingleton.h>
+#include <OIS.h>
+
+
+class SceneMouse : public Ogre::Singleton < SceneMouse >
+{
+public:
+       SceneMouse(Ogre::SceneManager *scm, RoRFrameListener *rfl);
+       ~SceneMouse();
+
+    bool mouseMoved(const OIS::MouseEvent& _arg);
+    bool mousePressed(const OIS::MouseEvent& _arg, OIS::MouseButtonID _id);
+    bool mouseReleased(const OIS::MouseEvent& _arg, OIS::MouseButtonID _id);
+    bool keyPressed(const OIS::KeyEvent& _arg);
+    bool keyReleased(const OIS::KeyEvent& _arg);
+
+protected:
+       Ogre::SceneManager *scm;
+       RoRFrameListener *rfl;
+       Ogre::ManualObject *pickLine;
+       Ogre::SceneNode *pickLineNode;
+       float mouseGrabForce;
+       int mouseGrabState;
+
+};
+
+
+
+#endif //SCENEMOUSE_H__

Modified: trunk/source/main/gui/SelectorWindow.cpp
===================================================================
--- trunk/source/main/gui/SelectorWindow.cpp    2011-03-11 18:02:20 UTC (rev 
1750)
+++ trunk/source/main/gui/SelectorWindow.cpp    2011-03-11 22:59:32 UTC (rev 
1751)
@@ -618,7 +618,7 @@
        mSelectionDone=false;
        LoadingWindow::get()->hide();
        // show mouse cursor
-       MyGUI::PointerManager::getInstance().setVisible(true);
+       //MyGUI::PointerManager::getInstance().setVisible(true);
        // focus main mMainWidget (for key input)
        mTruckConfigs.clear();
        MyGUI::InputManager::getInstance().setKeyFocusWidget(mMainWidget);
@@ -640,8 +640,6 @@
 {
        mMainWidget->setVisible(false);
        mMainWidget->setEnabledSilent(false);
-       // hide cursor
-       MyGUI::PointerManager::getInstance().setVisible(false);
 }
 
 void SelectorWindow::setEnableCancel(bool enabled)

Modified: trunk/source/main/gui/gui_friction.cpp
===================================================================
--- trunk/source/main/gui/gui_friction.cpp      2011-03-11 18:02:20 UTC (rev 
1750)
+++ trunk/source/main/gui/gui_friction.cpp      2011-03-11 22:59:32 UTC (rev 
1751)
@@ -409,7 +409,7 @@
        }
        win->setVisibleSmooth(value);
        //win->setVisible(value);
-       MyGUI::PointerManager::getInstance().setVisible(value);
+       //MyGUI::PointerManager::getInstance().setVisible(value);
 }
 
 bool GUI_Friction::getVisible()

Modified: trunk/source/main/gui/gui_inputmanager.cpp
===================================================================
--- trunk/source/main/gui/gui_inputmanager.cpp  2011-03-11 18:02:20 UTC (rev 
1750)
+++ trunk/source/main/gui/gui_inputmanager.cpp  2011-03-11 22:59:32 UTC (rev 
1751)
@@ -21,6 +21,8 @@
 
 #include "gui_inputmanager.h"
 
+#include "SceneMouse.h"
+
 #if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32
 #include <windows.h>
 #endif
@@ -85,9 +87,6 @@
 #endif
 
 GUIInputManager::GUIInputManager() :
-    //mInputManager(0),
-    //mKeyboard(0),
-    //mMouse(0),
     mCursorX(0),
     mCursorY(0),
     width(0),
@@ -102,23 +101,38 @@
 
 bool GUIInputManager::mouseMoved(const OIS::MouseEvent& _arg)
 {
+       MyGUI::PointerManager::getInstance().setPointer("arrow");
+
+       // fallback, handle by GUI, then by SceneMouse
+       if(!MyGUI::InputManager::getInstance().injectMouseMove(mCursorX, 
mCursorY, _arg.state.Z.abs))
+       {
+               bool fixed = SceneMouse::getSingleton().mouseMoved(_arg);
+               if(fixed)
+                       return true;
+       }
        mCursorX = _arg.state.X.abs;
        mCursorY = _arg.state.Y.abs;
     checkPosition();
-
-    injectMouseMove(mCursorX, mCursorY, _arg.state.Z.abs);
     return true;
 }
 
 bool GUIInputManager::mousePressed(const OIS::MouseEvent& _arg, 
OIS::MouseButtonID _id)
 {
-    injectMousePress(mCursorX, mCursorY, MyGUI::MouseButton::Enum(_id));
+       // fallback, handle by GUI, then by SceneMouse
+    if(!MyGUI::InputManager::getInstance().injectMousePress(mCursorX, 
mCursorY, MyGUI::MouseButton::Enum(_id)))
+       {
+               return SceneMouse::getSingleton().mousePressed(_arg, _id);
+       }
     return true;
 }
 
 bool GUIInputManager::mouseReleased(const OIS::MouseEvent& _arg, 
OIS::MouseButtonID _id)
 {
-    injectMouseRelease(mCursorX, mCursorY, MyGUI::MouseButton::Enum(_id));
+       // fallback, handle by GUI, then by SceneMouse
+       if(!MyGUI::InputManager::getInstance().injectMouseRelease(mCursorX, 
mCursorY, MyGUI::MouseButton::Enum(_id)))
+       {
+               return SceneMouse::getSingleton().mouseReleased(_arg, _id);
+       }
     return true;
 }
 
@@ -143,14 +157,22 @@
         text = translateWin32Text(key);
 #endif
     }
-
-    injectKeyPress(key, text);
+       
+       // fallback, handle by GUI, then by SceneMouse
+       if(!MyGUI::InputManager::getInstance().injectKeyPress(key, text))
+       {
+               return SceneMouse::getSingleton().keyPressed(_arg);
+       }
     return true;
 }
 
 bool GUIInputManager::keyReleased(const OIS::KeyEvent& _arg)
 {
-    injectKeyRelease(MyGUI::KeyCode::Enum(_arg.key));
+       // fallback, handle by GUI, then by SceneMouse
+    
if(!MyGUI::InputManager::getInstance().injectKeyRelease(MyGUI::KeyCode::Enum(_arg.key)))
+       {
+               return SceneMouse::getSingleton().keyReleased(_arg);
+       }
     return true;
 }
 
@@ -183,13 +205,6 @@
         mCursorY = this->height - 1;
 }
 
-void GUIInputManager::updateCursorPosition()
-{
-    //if(!mMouse) return;
-    //const OIS::MouseState &ms = mMouse->getMouseState();
-    //injectMouseMove(mCursorX, mCursorY, ms.Z.abs);
-}
-
 #endif //MYGUI
 
 

Modified: trunk/source/main/gui/gui_inputmanager.h
===================================================================
--- trunk/source/main/gui/gui_inputmanager.h    2011-03-11 18:02:20 UTC (rev 
1750)
+++ trunk/source/main/gui/gui_inputmanager.h    2011-03-11 22:59:32 UTC (rev 
1751)
@@ -28,9 +28,6 @@
 class InputEngine;
 
 class GUIInputManager
-// DO NOT use the listeners here, it will conflict with the real listeners in 
the inputmanager!
-// rather forward the events from the inputmanager
-//: public OIS::MouseListener, public OIS::KeyListener
 {
        friend class InputEngine;
 public:
@@ -39,14 +36,7 @@
 
     void setInputViewSize(int _width, int _height);
 
-    virtual void injectMouseMove(int _absx, int _absy, int _absz) { }
-    virtual void injectMousePress(int _absx, int _absy, MyGUI::MouseButton 
_id) { }
-    virtual void injectMouseRelease(int _absx, int _absy, MyGUI::MouseButton 
_id) { }
-    virtual void injectKeyPress(MyGUI::KeyCode _key, MyGUI::Char _text) { }
-    virtual void injectKeyRelease(MyGUI::KeyCode _key) { }
-
     void setMousePosition(int _x, int _y);
-    void updateCursorPosition();
 
 protected:
     virtual bool mouseMoved(const OIS::MouseEvent& _arg);

Modified: trunk/source/main/gui/gui_manager.cpp
===================================================================
--- trunk/source/main/gui/gui_manager.cpp       2011-03-11 18:02:20 UTC (rev 
1750)
+++ trunk/source/main/gui/gui_manager.cpp       2011-03-11 22:59:32 UTC (rev 
1751)
@@ -85,7 +85,7 @@
        mGUI = new MyGUI::Gui();
        mGUI->initialise(mResourceFileName);
        
//MyGUI::PluginManager::getInstance().loadPlugin("Plugin_BerkeliumWidget.dll");
-
+       MyGUI::PointerManager::getInstance().setVisible(true);
 }
 
 void GUIManager::destroyGui()
@@ -134,33 +134,4 @@
        _result = MyGUI::LanguageManager::getInstance().getTag(_tag);
 }
 
-void GUIManager::injectMouseMove(int _absx, int _absy, int _absz)
-{
-       if (!mGUI) return;
-       MyGUI::InputManager::getInstance().injectMouseMove(_absx, _absy, _absz);
-}
-
-void GUIManager::injectMousePress(int _absx, int _absy, MyGUI::MouseButton _id)
-{
-       if (!mGUI) return;
-       MyGUI::InputManager::getInstance().injectMousePress(_absx, _absy, _id);
-}
-
-void GUIManager::injectMouseRelease(int _absx, int _absy, MyGUI::MouseButton 
_id)
-{
-       if (!mGUI) return;
-       MyGUI::InputManager::getInstance().injectMouseRelease(_absx, _absy, 
_id);
-}
-
-void GUIManager::injectKeyPress(MyGUI::KeyCode _key, MyGUI::Char _text)
-{
-       if (!mGUI) return;
-       MyGUI::InputManager::getInstance().injectKeyPress(_key, _text);
-}
-
-void GUIManager::injectKeyRelease(MyGUI::KeyCode _key)
-{
-       if (!mGUI) return;
-       MyGUI::InputManager::getInstance().injectKeyRelease(_key);
-}
 #endif //MYGUI
\ No newline at end of file

Modified: trunk/source/main/gui/gui_manager.h
===================================================================
--- trunk/source/main/gui/gui_manager.h 2011-03-11 18:02:20 UTC (rev 1750)
+++ trunk/source/main/gui/gui_manager.h 2011-03-11 22:59:32 UTC (rev 1751)
@@ -46,12 +46,6 @@
        MyGUI::Gui* getGUI() { return mGUI; }
 
 protected:
-       virtual void injectMouseMove(int _absx, int _absy, int _absz);
-       virtual void injectMousePress(int _absx, int _absy, MyGUI::MouseButton 
_id);
-       virtual void injectMouseRelease(int _absx, int _absy, 
MyGUI::MouseButton _id);
-       virtual void injectKeyPress(MyGUI::KeyCode _key, MyGUI::Char _text);
-       virtual void injectKeyRelease(MyGUI::KeyCode _key);
-
 private:
        bool create();
        void createGui();

Modified: trunk/source/main/gui/gui_menu.cpp
===================================================================
--- trunk/source/main/gui/gui_menu.cpp  2011-03-11 18:02:20 UTC (rev 1750)
+++ trunk/source/main/gui/gui_menu.cpp  2011-03-11 22:59:32 UTC (rev 1751)
@@ -97,12 +97,6 @@
        pop->addItem("Friction Settings", MyGUI::MenuItemType::Normal, 
"frictiongui");
        
        mainmenu->eventMenuCtrlAccept += MyGUI::newDelegate(this, 
&GUI_MainMenu::onMenuBtn);
-
-
-
-       //MyGUI::PointerManager::getInstance().setVisible(true);
-       //UILOADER.setProgress(UI_PROGRESSBAR_HIDE);
-       setVisible(false);
 }
 
 GUI_MainMenu::~GUI_MainMenu()
@@ -129,7 +123,7 @@
 void GUI_MainMenu::setVisible(bool value)
 {
        mainmenu->setVisible(value);
-       MyGUI::PointerManager::getInstance().setVisible(value);
+       //MyGUI::PointerManager::getInstance().setVisible(value);
 }
 
 bool GUI_MainMenu::getVisible()


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

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Rigsofrods-devel mailing list
Rigsofrods-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to