From 826866b327521eb95a05fadbc4e3ea9cd4eb6870 Mon Sep 17 00:00:00 2001 From: frohlich Date: Sun, 7 Jan 2007 15:51:29 +0000 Subject: [PATCH] Modified Files: src/GUI/gui.h src/GUI/gui_funcs.cxx src/GUI/gui_local.cxx src/GUI/mouse.cxx src/GUI/sgVec3Slider.cxx src/GUI/sgVec3Slider.hxx src/Main/fg_commands.cxx: Remove some dead code. --- src/GUI/gui.h | 6 - src/GUI/gui_funcs.cxx | 2 - src/GUI/gui_local.cxx | 3 - src/GUI/mouse.cxx | 338 --------------------------------------- src/GUI/sgVec3Slider.cxx | 11 -- src/GUI/sgVec3Slider.hxx | 1 - src/Main/fg_commands.cxx | 4 - 7 files changed, 365 deletions(-) diff --git a/src/GUI/gui.h b/src/GUI/gui.h index 0dba7b6bc..6f3dcb875 100644 --- a/src/GUI/gui.h +++ b/src/GUI/gui.h @@ -62,9 +62,7 @@ extern void fgHiResDump(); #if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__) extern void printScreen(puObject *); #endif -extern void PilotOffsetAdjust(puObject *); extern void helpCb(puObject *); -extern void fgReshape(int, int); typedef struct { char *name; @@ -81,11 +79,7 @@ extern char *gui_msg_RESET; // "RESET" // mouse.cxx extern void guiInitMouse(int width, int height); -extern void guiMotionFunc ( int x, int y ); -extern void guiMouseFunc(int button, int updown, int x, int y); extern void maybeToggleMouse( void ); -extern void BusyCursor( int restore ); -extern void CenterView( void ); extern void TurnCursorOn( void ); extern void TurnCursorOff( void ); diff --git a/src/GUI/gui_funcs.cxx b/src/GUI/gui_funcs.cxx index 862c190ed..b87c5c0fe 100644 --- a/src/GUI/gui_funcs.cxx +++ b/src/GUI/gui_funcs.cxx @@ -477,7 +477,6 @@ void printScreen ( puObject *obj ) { show_pu_cursor = true; puHideCursor(); } - // BusyCursor( 0 ); CGlPrinter p( CGlPrinter::PRINT_BITMAP ); int cur_width = fgGetInt("/sim/startup/xsize"); @@ -485,7 +484,6 @@ void printScreen ( puObject *obj ) { p.Begin( "FlightGear", cur_width*3, cur_height*3 ); p.End( hiResScreenCapture(3) ); - // BusyCursor(1); if ( show_pu_cursor ) { puShowCursor(); } diff --git a/src/GUI/gui_local.cxx b/src/GUI/gui_local.cxx index 64318b62e..8e54b722b 100644 --- a/src/GUI/gui_local.cxx +++ b/src/GUI/gui_local.cxx @@ -48,7 +48,6 @@ void initMouseQuat(void) { void reInit(puObject *cb) { - // BusyCursor(0); Quat0(); static const SGPropertyNode *master_freeze @@ -90,8 +89,6 @@ void reInit(puObject *cb) fgSetBool("/sim/signals/reinit", true); - // BusyCursor(1); - if ( !freeze ) { fgSetBool("/sim/freeze/master", false); } diff --git a/src/GUI/mouse.cxx b/src/GUI/mouse.cxx index 749df1ff4..d60786623 100644 --- a/src/GUI/mouse.cxx +++ b/src/GUI/mouse.cxx @@ -288,45 +288,6 @@ void maybeToggleMouse( void ) #endif // #ifdef WIN32 } -// Call with FALSE to init and TRUE to restore -void BusyCursor( int restore ) -{ - static int cursor = MOUSE_CURSOR_POINTER; - if( restore ) { - fgSetMouseCursor(cursor); - } else { - cursor = fgGetMouseCursor(); -#if defined(WIN32_CURSOR_TWEAKS) - TurnCursorOn(); -#endif - fgSetMouseCursor( MOUSE_CURSOR_WAIT ); - } -} - - -// Center the view offsets -void CenterView( void ) { - if( mouse_mode == MOUSE_VIEW ) { - mouse_mode = MOUSE_POINTER; - _savedX = MOUSE_XSIZE/2; - _savedY = MOUSE_YSIZE/2; - _mVtoggle = 0; - Quat0(); - build_rotmatrix(GuiQuat_mat, curGuiQuat); - fgSetMouseCursor(MOUSE_CURSOR_POINTER); - - // Is this necessary ?? -#if defined(FG_OLD_MENU) - if( !gui_menu_on ) TurnCursorOff(); -#endif - - fgWarpMouse( _savedX, _savedY ); - } - set_goal_view_offset(0.0); - set_view_offset(0.0); -} - - //#define TRANSLATE_HUD // temporary hack until pitch_offset is added to view pipeline void fgTranslateHud( void ) { @@ -353,302 +314,3 @@ void fgTranslateHud( void ) { #endif // TRANSLATE_HUD } -void guiMotionFunc ( int x, int y ) -{ - int ww, wh, need_warp = 0; - float W, H; - double offset; - - ww = MOUSE_XSIZE; - wh = MOUSE_YSIZE; - - if (mouse_mode == MOUSE_POINTER) { -#if defined(FG_OLD_MENU) - // TURN MENU ON IF MOUSE AT TOP - if( y < 1 ) { - if( !gui_menu_on ) - guiToggleMenu(); - } - // TURN MENU OFF IF MOUSE AT BOTTOM - else if( y > wh-2 ) { - if( gui_menu_on ) - guiToggleMenu(); - } -#endif - puMouse ( x, y ) ; - fgRequestRedraw () ; - } else { - if( x == _mX && y == _mY) - return; - - // reset left click MOUSE_VIEW toggle feature - _mVtoggle = 0; - - switch (mouse_mode) { - case MOUSE_YOKE: - if( !mouse_joystick_control ) { - mouse_joystick_control = 1; - fgSetString("/sim/control-mode", "mouse"); - } else { - if ( left_button() ) { - move_brake( (_mX - x) * brake_sensitivity); - move_throttle((_mY - y) * throttle_sensitivity); - } else if ( right_button() ) { - if( ! AP_HeadingEnabled() ) { - move_rudder((x - _mX) * rudder_sensitivity); - } - if( ! AP_AltitudeEnabled() ) { - move_elevator_trim((_mY - y) * trim_sensitivity); - } - } else { - if( ! AP_HeadingEnabled() ) { - move_aileron((x - _mX) * aileron_sensitivity); - } - if( ! AP_AltitudeEnabled() ) { - move_elevator((_mY - y) * elevator_sensitivity); - } - } - } - // Keep the mouse in the window. - if (x < 5 || x > ww-5 || y < 5 || y > wh-5) { - x = ww / 2; - y = wh / 2; - need_warp = 1; - } - break; - - case MOUSE_VIEW: - if( y <= 0 ) { -#define CONTRAINED_MOUSE_VIEW_Y -#ifdef CONTRAINED_MOUSE_VIEW_Y - y = 1; -#else - y = wh-2; -#endif // CONTRAINED_MOUSE_VIEW_Y - need_warp = 1; - } else if( y >= wh-1) { -#ifdef CONTRAINED_MOUSE_VIEW_Y - y = wh-2; -#else - y = 1; -#endif // CONTRAINED_MOUSE_VIEW_Y - need_warp = 1; - } - // wrap MOUSE_VIEW mode cursor x position - if ( x <= 0 ) { - need_warp = 1; - x = ww-2; - } else if ( x >= ww-1 ) { - need_warp = 1; - x = 1; - } - // try to get SGD_PI movement in each half of screen - // do spherical pan - W = ww; - H = wh; - if( middle_button() ) { - trackball(lastGuiQuat, - (2.0f * _mX - W) / W, - 0, //(H - 2.0f * y) / H, // 3 - (2.0f * x - W) / W, - 0 //(H - 2.0f * _mY) / H // 1 - ); - x = _mX; - y = _mY; - need_warp = 1; - } else { - trackball(lastGuiQuat, - 0, //(2.0f * _mX - W) / W, // 0 - (H - 2.0f * y) / H, // 3 - 0, //(2.0f * x - W) / W, // 2 - (H - 2.0f * _mY) / H // 1 - ); - } - add_quats(lastGuiQuat, curGuiQuat, curGuiQuat); - build_rotmatrix(GuiQuat_mat, curGuiQuat); - - // do horizontal pan - // this could be done in above quat - // but requires redoing view pipeline - offset = get_goal_view_offset(); - offset += ((_mX - x) * SGD_2PI / W ); - while (offset < 0.0) { - offset += SGD_2PI; - } - while (offset > SGD_2PI) { - offset -= SGD_2PI; - } - set_goal_view_offset(offset); - set_goal_view_tilt(asin( GuiQuat_mat[1][2]) * SGD_RADIANS_TO_DEGREES ); -#ifdef NO_SMOOTH_MOUSE_VIEW - set_view_offset(offset); - set_view_tilt(asin( GuiQuat_mat[1][2]) * SGD_RADIANS_TO_DEGREES ); -#endif - break; - - default: - break; - } - } - if( need_warp) - fgWarpMouse(x, y); - - // Record the new mouse position. - _mX = x; - _mY = y; -} - - -void guiMouseFunc(int button, int updown, int x, int y) -{ - - // private MOUSE_VIEW state variables - // to allow alternate left clicks in MOUSE_VIEW mode - // to toggle between current offsets and straight ahead - // uses _mVtoggle - static int _mVx, _mVy, _Vx, _Vy; - static float _quat[4]; - static double _view_offset; - - // Was the left button pressed? - if ( updown == MOUSE_BUTTON_DOWN ) { - if( button == MOUSE_BUTTON_LEFT) - { - switch (mouse_mode) { - case MOUSE_POINTER: - break; - case MOUSE_YOKE: - break; - case MOUSE_VIEW: - if(_mVtoggle) { - // resume previous view offsets - _mX = _mVx; - _mY = _mVy; - x = _Vx; - y = _Vy; - sgCopyVec4(curGuiQuat, _quat); - set_goal_view_offset(_view_offset); - set_goal_view_tilt(0.0); -#ifdef NO_SMOOTH_MOUSE_VIEW - set_view_offset(_view_offset); -#endif - } else { - // center view - _mVx = _mX; - _mVy = _mY; - _Vx = x; - _Vy = y; - sgCopyVec4(_quat,curGuiQuat); - x = MOUSE_XSIZE/2; - y = MOUSE_YSIZE/2; - Quat0(); - _view_offset = get_goal_view_offset(); - set_goal_view_offset(0.0); - set_goal_view_tilt(0.0); -#ifdef NO_SMOOTH_MOUSE_VIEW - set_view_offset(0.0); - set_view_tilt(0.0); -#endif - } - fgWarpMouse( x , y); - build_rotmatrix(GuiQuat_mat, curGuiQuat); - _mVtoggle = ~_mVtoggle; - break; - } - } else if ( button == MOUSE_BUTTON_RIGHT) { - switch (mouse_mode) { - - case MOUSE_POINTER: - SG_LOG( SG_INPUT, SG_INFO, "Mouse in yoke mode" ); - - mouse_mode = MOUSE_YOKE; - mouse_joystick_control = 0; - _savedX = x; - _savedY = y; - // start with zero point in center of screen - _mX = MOUSE_XSIZE/2; - _mY = MOUSE_YSIZE/2; - - // try to have the MOUSE_YOKE position - // reflect the current stick position - x = _mX - (int)(get_aileron() * aileron_sensitivity); - y = _mY - (int)(get_elevator() * elevator_sensitivity); - - fgSetMouseCursor(MOUSE_CURSOR_CROSSHAIR); - break; - - case MOUSE_YOKE: - SG_LOG( SG_INPUT, SG_INFO, "Mouse in view mode" ); - - mouse_mode = MOUSE_VIEW; - fgSetString("/sim/control-mode", "joystick"); - - // recenter cursor and reset - x = MOUSE_XSIZE/2; - y = MOUSE_YSIZE/2; - _mVtoggle = 0; -// #ifndef RESET_VIEW_ON_LEAVING_MOUSE_VIEW - Quat0(); - build_rotmatrix(GuiQuat_mat, curGuiQuat); -// #endif - fgSetMouseCursor(MOUSE_CURSOR_LEFTRIGHT); - break; - - case MOUSE_VIEW: - SG_LOG( SG_INPUT, SG_INFO, "Mouse in pointer mode" ); - - mouse_mode = MOUSE_POINTER; - x = _savedX; - y = _savedY; -#ifdef RESET_VIEW_ON_LEAVING_MOUSE_VIEW - Quat0(); - build_rotmatrix(GuiQuat_mat, curGuiQuat); - set_goal_view_offset(0.0); - set_goal_view_tilt(0.0); -#ifdef NO_SMOOTH_MOUSE_VIEW - set_view_offset(0.0); - set_view_tilt(0.0); -#endif // NO_SMOOTH_MOUSE_VIEW -#endif // RESET_VIEW_ON_LEAVING_MOUSE_VIEW - fgSetMouseCursor(MOUSE_CURSOR_POINTER); - -#if defined(FG_OLD_MENU) -#if defined(WIN32_CURSOR_TWEAKS_OFF) - if(!gui_menu_on) - TurnCursorOff(); -#endif // WIN32_CURSOR_TWEAKS_OFF -#endif // FG_OLD_MENU - break; - } // end switch (mouse_mode) - fgWarpMouse( x, y ); - } // END RIGHT BUTTON - } // END MOUSE DOWN - - // Update the button state - if ( updown == MOUSE_BUTTON_DOWN ) { - last_buttons |= ( 1 << button ) ; - } else { - last_buttons &= ~( 1 << button ) ; - } - - // If we're in pointer mode, let PUI - // know what's going on. - if (mouse_mode == MOUSE_POINTER) { - if (!puMouse (button, updown , x,y)) { - if ( globals->get_current_panel() != NULL ) { - globals->get_current_panel()->doMouseAction(button, updown, x, y); - } - } - } - - // Register the new position (if it - // hasn't been registered already). - _mX = x; - _mY = y; - - fgRequestRedraw (); -} - - - - diff --git a/src/GUI/sgVec3Slider.cxx b/src/GUI/sgVec3Slider.cxx index 454c7082e..a2c133eb3 100644 --- a/src/GUI/sgVec3Slider.cxx +++ b/src/GUI/sgVec3Slider.cxx @@ -499,17 +499,6 @@ void PilotOffsetInit( sgVec3 cart ) } } -void PilotOffsetAdjust( puObject * ) -{ - if( PO_vec == 0 ) { - PilotOffsetInit(); - } - sgVec3Slider *me = (sgVec3Slider *)PO_vec -> getUserData(); - me -> adjust( me ); - me -> stashVec(); - FG_PUSH_PUI_DIALOG( me ); -} - // external to get pilot offset vector for viewer sgVec3 *PilotOffsetGet() { diff --git a/src/GUI/sgVec3Slider.hxx b/src/GUI/sgVec3Slider.hxx index 58186d687..70eb5fe4e 100644 --- a/src/GUI/sgVec3Slider.hxx +++ b/src/GUI/sgVec3Slider.hxx @@ -16,7 +16,6 @@ void PilotOffsetInit(); void PilotOffsetInit( sgVec3 vec ); -void PilotOffsetAdjust( puObject * ); void Vec3FromHeadingPitchRadius( sgVec3 vec3, float heading, float pitch, float radius ); void HeadingPitchRadiusFromVec3( sgVec3 hpr, sgVec3 vec3 ); //void PilotOffsetGet( float *po ); diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx index 9259a18ac..5c6af0b2b 100644 --- a/src/Main/fg_commands.cxx +++ b/src/Main/fg_commands.cxx @@ -472,7 +472,6 @@ do_view_cycle (const SGPropertyNode * arg) globals->get_viewmgr()->next_view(); fix_hud_visibility(); globals->get_tile_mgr()->refresh_view_timestamps(); -// fgReshape(fgGetInt("/sim/startup/xsize"), fgGetInt("/sim/startup/ysize")); return true; } @@ -511,7 +510,6 @@ do_tile_cache_reload (const SGPropertyNode * arg) if ( !freeze ) { fgSetBool("/sim/freeze/master", true); } - // BusyCursor(0); if ( globals->get_tile_mgr()->init() ) { // Load the local scenery data double visibility_meters = fgGetDouble("/environment/visibility-m"); @@ -521,7 +519,6 @@ do_tile_cache_reload (const SGPropertyNode * arg) "Error in Tile Manager initialization!" ); exit(-1); } - // BusyCursor(1); if ( !freeze ) { fgSetBool("/sim/freeze/master", false); } @@ -1180,7 +1177,6 @@ do_presets_commit (const SGPropertyNode * arg) // set position from presets fgInitPosition(); - // BusyCursor(0); fgReInitSubsystems(); globals->get_tile_mgr()->update( fgGetDouble("/environment/visibility-m") ); -- 2.39.5