From d227398525756a935c3c90d96c1b083026aae53b Mon Sep 17 00:00:00 2001 From: curt Date: Mon, 12 Nov 2001 19:37:23 +0000 Subject: [PATCH] Norman Vine's mouse cursor tweaks fixes. --- src/GUI/gui.cxx | 14 ++++++++------ src/GUI/gui_local.hxx | 2 ++ src/GUI/mouse.cxx | 12 +++++++----- src/GUI/net_dlg.cxx | 7 +++---- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/GUI/gui.cxx b/src/GUI/gui.cxx index 74078a6e2..8bd6f6c16 100644 --- a/src/GUI/gui.cxx +++ b/src/GUI/gui.cxx @@ -183,16 +183,16 @@ void guiToggleMenu(void) if( gui_menu_on ) { // printf("Hiding Menu\n"); mainMenuBar->hide (); -#if defined(WIN32_CURSOR_TWEAKS) +#if defined(WIN32_CURSOR_TWEAKS_OFF) if( mouse_mode == MOUSE_POINTER ) TurnCursorOff(); -#endif // #ifdef WIN32_CURSOR_TWEAKS +#endif // WIN32_CURSOR_TWEAKS_OFF } else { // printf("Showing Menu\n"); mainMenuBar->reveal(); #ifdef WIN32 TurnCursorOn(); -#endif // #ifdef WIN32 +#endif // WIN32 } gui_menu_on = ~gui_menu_on; } @@ -303,7 +303,7 @@ void LoadDialogOk(puObject *) { } } -// Do this is the person presses cancel +// Do this if the person presses cancel void LoadDialogCancel(puObject *) { FG_POP_PUI_DIALOG( LoadDialog ); } @@ -418,7 +418,6 @@ void ConfirmExitDialogInit(void) int y = (fgGetInt("/sim/startup/ysize")/2 - 100/2); YNdialogBox = new puDialogBox (x, y); // 150, 50 - // YNdialogBox = new puDialogBox (150, 50); { YNdialogFrame = new puFrame (0,0,400, 100); @@ -460,6 +459,7 @@ void helpCb (puObject *) SGPath path( globals->get_fg_root() ); path.append( "Docs/index.html" ); +#if !defined(WIN32) string help_app = fgGetString("/sim/startup/browser-app"); if ( system("xwininfo -name Netscape > /dev/null 2>&1") == 0 ) { @@ -467,8 +467,10 @@ void helpCb (puObject *) } else { command = help_app + " " + path.str(); } -#if !defined(WIN32) command += " &"; +#else // WIN32 + command = "start "; + command += path.str(); #endif system( command.c_str() ); diff --git a/src/GUI/gui_local.hxx b/src/GUI/gui_local.hxx index 6958f7118..7c386851d 100644 --- a/src/GUI/gui_local.hxx +++ b/src/GUI/gui_local.hxx @@ -8,6 +8,8 @@ #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 diff --git a/src/GUI/mouse.cxx b/src/GUI/mouse.cxx index 8ecb10733..8fdb598c7 100644 --- a/src/GUI/mouse.cxx +++ b/src/GUI/mouse.cxx @@ -167,7 +167,7 @@ static inline int right_button( void ) { void TurnCursorOn( void ) { mouse_active = ~0; -#if defined(WIN32_CURSOR_TWEAKS) +#if defined(WIN32) switch (mouse_mode) { case MOUSE_POINTER: glutSetCursor(GLUT_CURSOR_INHERIT); @@ -510,16 +510,18 @@ void guiMouseFunc(int button, int updown, int x, int y) globals->get_current_view()->set_goal_view_offset(0.0); #ifdef NO_SMOOTH_MOUSE_VIEW globals->get_current_view()->set_view_offset(0.0); -#endif -#endif // RESET_VIEW_ON_LEAVING_MOUSE_VIEW +#endif // NO_SMOOTH_MOUSE_VIEW +#endif // RESET_VIEW_ON_LEAVING_MOUSE_VIEW glutSetCursor(GLUT_CURSOR_INHERIT); +#if defined(WIN32_CURSOR_TWEAKS_OFF) if(!gui_menu_on) TurnCursorOff(); - +#endif // WIN32_CURSOR_TWEAKS_OFF + SG_LOG( SG_INPUT, SG_INFO, "Mouse in pointer mode" ); break; - } + } // end switch (mouse_mode) glutWarpPointer( x, y ); } // END RIGHT BUTTON } // END UPDOWN == GLUT_DOWN diff --git a/src/GUI/net_dlg.cxx b/src/GUI/net_dlg.cxx index 0aea38dcd..ebbb1e1c1 100644 --- a/src/GUI/net_dlg.cxx +++ b/src/GUI/net_dlg.cxx @@ -103,8 +103,7 @@ void NewNetIdInit(void) { sprintf( NewNetId, "%s", fgGetString("/sim/networking/call-sign").c_str() ); // sprintf( NewNetId, "%s", fgd_callsign ); - int len = 150 - puGetStringWidth( puGetDefaultLabelFont(), - NewNetIdLabel ) / 2; + int len = 150 - puGetDefaultLabelFont().getStringWidth( NewNetIdLabel ) / 2; NetIdDialog = new puDialogBox (150, 50); { @@ -236,8 +235,8 @@ void NewNetFGDInit(void) { // sprintf( NewNetId, "%s", fgGetString("/sim/networking/call-sign").c_str() ); // sprintf( NewNetId, "%s", fgd_callsign ); - int len = 170 - puGetStringWidth( puGetDefaultLabelFont(), - NewNetFGDLabel ) / 2; + int len = 170 + - puGetDefaultLabelFont().getStringWidth( NewNetFGDLabel ) / 2; NetFGDDialog = new puDialogBox (310, 30); { -- 2.39.5