# 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
<File
RelativePath="..\..\src\GUI\menubar.hxx">
</File>
- <File
- RelativePath="..\..\src\GUI\mouse.cxx">
- </File>
<File
RelativePath="..\..\src\GUI\new_gui.cxx">
</File>
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
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 \
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.
} __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_
#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>
#include "gui.h"
-SG_USING_STD(string);
-SG_USING_STD(cout);
+using std::string;
#if defined( TR_HIRES_SNAP)
{
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;
}
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();
delete [] filename;
- if ( show_pu_cursor ) {
- puShowCursor();
- }
-
- TurnCursorOn();
+ fgSetMouseCursor(mouse);
fgSetBool("/sim/menubar/visibility", menu_status);
if ( !freeze ) {
#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");
p.Begin( "FlightGear", cur_width*3, cur_height*3 );
p.End( hiResScreenCapture(3) );
- if ( show_pu_cursor ) {
- puShowCursor();
- }
- TurnCursorOn();
+ fgSetMouseCursor(mouse);
}
#endif // #ifdef WIN32
// 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();
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();
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);
+++ /dev/null
-/**************************************************************************
- * 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
-}
-
if (height != lastheight)
fgSetInt("/sim/startup/ysize", lastheight = height);
- guiInitMouse(width, height);
-
// for all views
FGViewMgr *viewmgr = globals->get_viewmgr();
if (viewmgr) {