]> git.mxchange.org Git - flightgear.git/commitdiff
get rid of mouse.cxx and pu{Show|Hide}Cursor()
authormfranz <mfranz>
Sun, 27 Jul 2008 09:39:10 +0000 (09:39 +0000)
committermfranz <mfranz>
Sun, 27 Jul 2008 09:39:10 +0000 (09:39 +0000)
FlightGear.dsp
projects/VC7.1/FlightGear.vcproj
projects/VC8/FlightGearLib.vcproj
src/GUI/Makefile.am
src/GUI/README
src/GUI/gui.h
src/GUI/gui_funcs.cxx
src/GUI/mouse.cxx [deleted file]
src/Main/renderer.cxx

index 86e3033fc3b9d9d3bc41d3b82537b36cc3bd1a11..593c9766dbc065cf410053e6f409afa779c806a6 100644 (file)
@@ -6956,21 +6956,6 @@ SOURCE=.\src\GUI\gui_local.hxx
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=.\src\GUI\mouse.cxx\r
-\r
-!IF  "$(CFG)" == "FlightGear - Win32 Release"\r
-\r
-# PROP Intermediate_Dir "Release\Lib_GUI"\r
-\r
-!ELSEIF  "$(CFG)" == "FlightGear - Win32 Debug"\r
-\r
-# PROP Intermediate_Dir "Debug\Lib_GUI"\r
-\r
-!ENDIF \r
-\r
-# End Source File\r
-# Begin Source File\r
-\r
 SOURCE=.\src\GUI\fonts.cxx\r
 \r
 !IF  "$(CFG)" == "FlightGear - Win32 Release"\r
index c5ea2cc575d17e1cb278ae3c577eb4c767193548..76c4f40cdaed96ae7c928d5af50657257dfdb467 100755 (executable)
                        <File
                                RelativePath="..\..\src\GUI\menubar.hxx">
                        </File>
-                       <File
-                               RelativePath="..\..\src\GUI\mouse.cxx">
-                       </File>
                        <File
                                RelativePath="..\..\src\GUI\new_gui.cxx">
                        </File>
index 8b5729bb0201a813b452e4cdc57060f262141704..58e0ba0868f36b44c0c39f2bfb496f14bfb96c18 100755 (executable)
                                RelativePath="..\..\src\sound\morse.cxx"\r
                                >\r
                        </File>\r
-                       <File\r
-                               RelativePath="..\..\src\gui\mouse.cxx"\r
-                               >\r
-                       </File>\r
                        <File\r
                                RelativePath="..\..\src\Instrumentation\mrg.cxx"\r
                                >\r
index f858803ab1321cd8dc1382acc4b16fb42902cc38..512e5d192c4deb21cdb06bb4af965ecdc5b08070 100644 (file)
@@ -6,7 +6,7 @@ libGUI_a_SOURCES = \
         dialog.cxx dialog.hxx \
        menubar.cxx menubar.hxx \
        gui.cxx gui.h gui_funcs.cxx \
-       mouse.cxx fonts.cxx \
+       fonts.cxx \
        AirportList.cxx AirportList.hxx \
         property_list.cxx property_list.hxx \
         layout.cxx layout-props.cxx layout.hxx \
index 2c3b8a34a12b28c566f47843d79f362e8fa93aaf..9ad2d5f446ae9d4e51331ec0b52887e443343480 100644 (file)
@@ -10,7 +10,6 @@ dialog.[ch]xx           XML-configurable dialog box.
 gui.cxx, gui.h          Top-level GUI functions (deprecated).
 gui_funcs.cxx           Implementation of internal GUI functions (deprecated).
 menubar.[ch]xx          XML-configurable menu bar.
-mouse.cxx               Old GUI mouse support (deprecated).
 new_gui.[ch]xx          Top-level for the GUI subsystem.
 
 
index 7548ed5a96deea6b95e98795b685b2b9f87b2235..f778349dd11024a951bfcc8cb790a565731cff1a 100644 (file)
@@ -73,10 +73,4 @@ typedef struct {
 } __fg_gui_fn_t;
 extern const __fg_gui_fn_t __fg_gui_fn[];
 
-// mouse.cxx
-extern void guiInitMouse(int width, int height);
-extern void maybeToggleMouse( void );
-extern void TurnCursorOn( void );
-extern void TurnCursorOff( void );
-
 #endif // _GUI_H_
index 3d089161c1b38a774dc2e993740e0675a6681153..833649411840f6335cd997a6b7e0c6da7132d6d8 100644 (file)
 
 #include <fstream>
 #include <string>
+#include <cstring>
+#include <sstream>
 
 #include <stdlib.h>
-#include <string.h>
 
 // for help call back
 #ifdef WIN32
 # endif
 #endif
 
-#include <sstream>
-
-#include <simgear/constants.h>
 #include <simgear/debug/logstream.hxx>
 #include <simgear/misc/sg_path.hxx>
 #include <simgear/screen/screen-dump.hxx>
 
-#include <Include/general.hxx>
-#include <Aircraft/aircraft.hxx>
-#include <Aircraft/controls.hxx>
-#include <Airports/simple.hxx>
 #include <Cockpit/panel.hxx>
-#include <FDM/flight.hxx>
-#include <Main/main.hxx>
-#include <Main/fg_init.hxx>
-#include <Main/fg_io.hxx>
 #include <Main/globals.hxx>
 #include <Main/fg_props.hxx>
 #include <Main/renderer.hxx>
@@ -81,8 +71,7 @@
 
 #include "gui.h"
 
-SG_USING_STD(string);
-SG_USING_STD(cout);
+using std::string;
 
 
 #if defined( TR_HIRES_SNAP)
@@ -230,7 +219,6 @@ void fgHiResDump()
 {
     FILE *f;
     string message;
-    bool show_pu_cursor = false;
     bool menu_status = fgGetBool("/sim/menubar/visibility");
     char *filename = new char [24];
     static int count = 1;
@@ -244,11 +232,8 @@ void fgHiResDump()
     }
 
     fgSetBool("/sim/menubar/visibility", false);
-    TurnCursorOff();
-    if ( !puCursorIsHidden() ) {
-       show_pu_cursor = true;
-       puHideCursor();
-    }
+    int mouse = fgGetMouseCursor();
+    fgSetMouseCursor(MOUSE_CURSOR_NONE);
 
     FGRenderer *renderer = globals->get_renderer();
 //     renderer->init();
@@ -415,11 +400,7 @@ void fgHiResDump()
 
     delete [] filename;
 
-    if ( show_pu_cursor ) {
-        puShowCursor();
-    }
-
-    TurnCursorOn();
+    fgSetMouseCursor(mouse);
     fgSetBool("/sim/menubar/visibility", menu_status);
 
     if ( !freeze ) {
@@ -469,12 +450,8 @@ GLubyte *hiResScreenCapture( int multiplier )
 #if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
 // win32 print screen function
 void printScreen () {
-    bool show_pu_cursor = false;
-    TurnCursorOff();
-    if ( !puCursorIsHidden() ) {
-       show_pu_cursor = true;
-       puHideCursor();
-    }
+    int mouse = fgGetMouseCursor();
+    fgSetMouseCursor(MOUSE_CURSOR_NONE);
 
     CGlPrinter p( CGlPrinter::PRINT_BITMAP );
     int cur_width = fgGetInt("/sim/startup/xsize");
@@ -482,10 +459,7 @@ void printScreen () {
     p.Begin( "FlightGear", cur_width*3, cur_height*3 );
     p.End( hiResScreenCapture(3) );
 
-    if ( show_pu_cursor ) {
-       puShowCursor();
-    }
-    TurnCursorOn();
+    fgSetMouseCursor(mouse);
 }
 #endif // #ifdef WIN32
 
@@ -502,7 +476,6 @@ void fgHiResDumpWrapper () {
 
 // do a screen snap shot
 bool fgDumpSnapShot () {
-    bool show_pu_cursor = false;
     static SGConstPropertyNode_ptr master_freeze = fgGetNode("/sim/freeze/master");
 
     bool freeze = master_freeze->getBoolValue();
@@ -510,11 +483,9 @@ bool fgDumpSnapShot () {
         fgSetBool("/sim/freeze/master", true);
     }
 
-    TurnCursorOff();
-    if ( !puCursorIsHidden() ) {
-        show_pu_cursor = true;
-        puHideCursor();
-    }
+    int mouse = fgGetMouseCursor();
+    fgSetMouseCursor(MOUSE_CURSOR_NONE);
+
     fgSetBool("/sim/signals/screenshot", true);
 
     FGRenderer *renderer = globals->get_renderer();
@@ -555,11 +526,7 @@ bool fgDumpSnapShot () {
     fgSetString("/sim/paths/screenshot-last", path.c_str());
     fgSetBool("/sim/signals/screenshot", false);
 
-    if ( show_pu_cursor ) {
-        puShowCursor();
-    }
-
-    TurnCursorOn();
+    fgSetMouseCursor(mouse);
 
     if ( !freeze ) {
         fgSetBool("/sim/freeze/master", false);
diff --git a/src/GUI/mouse.cxx b/src/GUI/mouse.cxx
deleted file mode 100644 (file)
index d39599c..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-/**************************************************************************
- * gui.cxx
- *
- * Written 1998 by Durk Talsma, started Juni, 1998.  For the flight gear
- * project.
- *
- * Additional mouse supported added by David Megginson, 1999.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program 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 this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- * $Id$
- **************************************************************************/
-
-
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
-#include <simgear/compiler.h>
-
-#ifdef HAVE_WINDOWS_H
-#  include <windows.h>
-#endif
-
-#include <Main/fg_os.hxx>
-
-#include <string>
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <simgear/constants.h>
-#include <simgear/debug/logstream.hxx>
-#include <simgear/misc/sg_path.hxx>
-
-#include <Include/general.hxx>
-#include <Aircraft/aircraft.hxx>
-#include <Aircraft/controls.hxx>
-#include <Airports/simple.hxx>
-#include <Cockpit/panel.hxx>
-#include <FDM/flight.hxx>
-#include <Main/fg_init.hxx>
-#include <Main/fg_props.hxx>
-#include <Main/viewmgr.hxx>
-
-#include "gui.h"
-
-SG_USING_STD(string);
-SG_USING_STD(cout);
-
-/* --------------------------------------------------------------------
-Mouse stuff
----------------------------------------------------------------------*/
-
-#if defined(WIN32) || defined(__CYGWIN32__)
-#define WIN32_CURSOR_TWEAKS
-// uncomment this for cursor to turn off when menu is disabled
-// #define WIN32_CURSOR_TWEAKS_OFF
-#elif (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
-#define X_CURSOR_TWEAKS
-#endif
-
-static int mouse_active = 0;
-
-static int MOUSE_XSIZE = 0;
-static int MOUSE_YSIZE = 0;
-
-typedef enum {
-       MOUSE_POINTER,
-       MOUSE_YOKE,
-       MOUSE_VIEW
-} MouseMode;
-
-/* --------------------------------------------------------------------
-Support for mouse as control yoke (david@megginson.com)
-
-- right button toggles between pointer and yoke
-- horizontal drag with no buttons moves ailerons
-- vertical drag with no buttons moves elevators
-- horizontal drag with left button moves brakes (left=on)
-- vertical drag with left button moves throttle (up=more)
-- horizontal drag with middle button moves rudder
-- vertical drag with middle button moves trim
-
-For the *_sensitivity variables, a lower number means more sensitive.
-
-TODO: figure out how to keep pointer from leaving window in yoke mode.
-TODO: add thresholds and null zones
-TODO: sensitivity should be configurable at user option.
-TODO: allow differential braking (this will be useful if FlightGear
-      ever supports tail-draggers like the DC-3)
----------------------------------------------------------------------*/
-
-MouseMode mouse_mode = MOUSE_POINTER;
-
-void guiInitMouse(int width, int height)
-{
-       MOUSE_XSIZE = width;
-       MOUSE_YSIZE = height;
-}
-
-void TurnCursorOn( void )
-{
-    mouse_active = ~0;
-#if defined(WIN32)
-    switch (mouse_mode) {
-        case MOUSE_POINTER:
-            fgSetMouseCursor(MOUSE_CURSOR_POINTER);
-            break;
-        case MOUSE_YOKE:
-            fgSetMouseCursor(MOUSE_CURSOR_CROSSHAIR);
-            break;
-        case MOUSE_VIEW:
-            fgSetMouseCursor(MOUSE_CURSOR_LEFTRIGHT);
-            break;
-    }
-#endif
-#if defined(X_CURSOR_TWEAKS)
-    fgWarpMouse( MOUSE_XSIZE/2, MOUSE_YSIZE/2 );
-#endif
-}
-
-void TurnCursorOff( void )
-{
-    mouse_active = 0;
-#if defined(WIN32_CURSOR_TWEAKS)
-    fgSetMouseCursor(MOUSE_CURSOR_NONE);
-#elif defined(X_CURSOR_TWEAKS)
-    fgWarpMouse( MOUSE_XSIZE, MOUSE_YSIZE );
-#endif
-}
-
-void maybeToggleMouse( void )
-{
-#if defined(WIN32_CURSOR_TWEAKS_OFF)
-    static int first_time = ~0;
-    static int mouse_changed = 0;
-
-    if ( first_time ) {
-        if(!mouse_active) {
-            mouse_changed = ~mouse_changed;
-            TurnCursorOn();
-        }
-    } else {
-        if( mouse_mode != MOUSE_POINTER )
-            return;
-        if( mouse_changed ) {
-            mouse_changed = ~mouse_changed;
-            if(mouse_active) {
-                TurnCursorOff();
-            }
-        }
-    }
-    first_time = ~first_time;
-#endif // #ifdef WIN32
-}
-
index 6eafe627fbce5305fa867133d0f5d2fdc9caf4c3..f40a5045235bfead324b9292e93f57c20edf2886 100644 (file)
@@ -833,8 +833,6 @@ FGRenderer::resize( int width, int height ) {
     if (height != lastheight)
         fgSetInt("/sim/startup/ysize", lastheight = height);
 
-    guiInitMouse(width, height);
-
     // for all views
     FGViewMgr *viewmgr = globals->get_viewmgr();
     if (viewmgr) {