]> git.mxchange.org Git - flightgear.git/blobdiff - src/GUI/mouse.cxx
- added support for conditions in FGBinding
[flightgear.git] / src / GUI / mouse.cxx
index 1c28a46aa62b419dff48a58c88cd78bbc3d7f2c8..fd7311f76c768a6991a79815bc671daed42b33d3 100644 (file)
@@ -39,7 +39,7 @@
 #endif
 
 #include <GL/glut.h>
-#include <simgear/xgl/xgl.h>
+#include <GL/gl.h>
 
 #if defined(FX) && defined(XMESA)
 #  include <GL/xmesa.h>
@@ -52,7 +52,7 @@
 
 #include <simgear/constants.h>
 #include <simgear/debug/logstream.hxx>
-#include <simgear/misc/fgpath.hxx>
+#include <simgear/misc/sg_path.hxx>
 #include <simgear/screen/screen-dump.hxx>
 
 #include <Include/general.hxx>
@@ -66,9 +66,7 @@
 #include <FDM/flight.hxx>
 #include <Main/fg_init.hxx>
 #include <Main/fg_props.hxx>
-//#include <Main/views.hxx>
-//#include <Network/network.h>
-//#include <Time/fg_time.hxx>
+#include <Main/viewmgr.hxx>
 
 #if defined( WIN32 ) && !defined( __CYGWIN__ )
 #  include <simgear/screen/win32-printer.h>
@@ -293,26 +291,26 @@ void guiMotionFunc ( int x, int y )
                 } else {
                     if ( left_button() ) {
                         offset = (_mX - x) * brake_sensitivity;
-                        controls.move_brake(FGControls::ALL_WHEELS, offset);
+                        globals->get_controls()->move_brake(FGControls::ALL_WHEELS, offset);
                         offset = (_mY - y) * throttle_sensitivity;
-                        controls.move_throttle(FGControls::ALL_ENGINES, offset);
+                        globals->get_controls()->move_throttle(FGControls::ALL_ENGINES, offset);
                     } else if ( right_button() ) {
                         if( ! current_autopilot->get_HeadingEnabled() ) {
                             offset = (x - _mX) * rudder_sensitivity;
-                            controls.move_rudder(offset);
+                            globals->get_controls()->move_rudder(offset);
                         }
                         if( ! current_autopilot->get_AltitudeEnabled() ) {
                             offset = (_mY - y) * trim_sensitivity;
-                            controls.move_elevator_trim(offset);
+                            globals->get_controls()->move_elevator_trim(offset);
                         }
                     } else {
                         if( ! current_autopilot->get_HeadingEnabled() ) {
                             offset = (x - _mX) * aileron_sensitivity;
-                            controls.move_aileron(offset);
+                            globals->get_controls()->move_aileron(offset);
                         }
                         if( ! current_autopilot->get_AltitudeEnabled() ) {
                             offset = (_mY - y) * elevator_sensitivity;
-                            controls.move_elevator(offset);
+                            globals->get_controls()->move_elevator(offset);
                         }
                     }
                 }
@@ -349,7 +347,7 @@ void guiMotionFunc ( int x, int y )
                     need_warp = 1;
                     x = 1;
                 }
-                // try to get SG_PI movement in each half of screen
+                // try to get SGD_PI movement in each half of screen
                 // do spherical pan
                 W = ww;
                 H = wh;
@@ -378,12 +376,12 @@ void guiMotionFunc ( int x, int y )
                 // this could be done in above quat
                 // but requires redoing view pipeline
                 offset = globals->get_current_view()->get_goal_view_offset();
-                offset += ((_mX - x) * SG_2PI / W );
+                offset += ((_mX - x) * SGD_2PI / W );
                 while (offset < 0.0) {
-                    offset += SG_2PI;
+                    offset += SGD_2PI;
                 }
-                while (offset > SG_2PI) {
-                    offset -= SG_2PI;
+                while (offset > SGD_2PI) {
+                    offset -= SGD_2PI;
                 }
                 globals->get_current_view()->set_goal_view_offset(offset);
 #ifdef NO_SMOOTH_MOUSE_VIEW
@@ -486,13 +484,13 @@ void guiMouseFunc(int button, int updown, int x, int y)
                     
                     // try to have the MOUSE_YOKE position
                     // reflect the current stick position
-                    offset = controls.get_aileron();
+                    offset = globals->get_controls()->get_aileron();
                     x = _mX - (int)(offset * aileron_sensitivity);
-                    offset = controls.get_elevator();
+                    offset = globals->get_controls()->get_elevator();
                     y = _mY - (int)(offset * elevator_sensitivity);
                     
                     glutSetCursor(GLUT_CURSOR_CROSSHAIR);
-                    FG_LOG( FG_INPUT, FG_INFO, "Mouse in yoke mode" );
+                    SG_LOG( SG_INPUT, SG_INFO, "Mouse in yoke mode" );
                     break;
                     
                 case MOUSE_YOKE:
@@ -504,7 +502,7 @@ void guiMouseFunc(int button, int updown, int x, int y)
                     Quat0();
                     build_rotmatrix(GuiQuat_mat, curGuiQuat);
                     glutSetCursor(GLUT_CURSOR_LEFT_RIGHT);
-                    FG_LOG( FG_INPUT, FG_INFO, "Mouse in view mode" );
+                    SG_LOG( SG_INPUT, SG_INFO, "Mouse in view mode" );
                     break;
                     
                 case MOUSE_VIEW:
@@ -524,7 +522,7 @@ void guiMouseFunc(int button, int updown, int x, int y)
                     if(!gui_menu_on)
                         TurnCursorOff();
                     
-                    FG_LOG( FG_INPUT, FG_INFO, "Mouse in pointer mode" );
+                    SG_LOG( SG_INPUT, SG_INFO, "Mouse in pointer mode" );
                     break;
             }     
             glutWarpPointer( x, y );
@@ -542,7 +540,9 @@ void guiMouseFunc(int button, int updown, int x, int y)
     // know what's going on.
     if (mouse_mode == MOUSE_POINTER) {
       if (!puMouse (button, updown, x,y)) {
-       current_panel->doMouseAction(button, updown, x, y);
+        if ( current_panel != NULL ) {
+          current_panel->doMouseAction(button, updown, x, y);
+        }
       }
     }