1
0
Fork 0

Changes to toggle panel on and off.

This commit is contained in:
curt 1999-05-06 22:16:12 +00:00
parent e03741be5f
commit 40db8d0c1f
8 changed files with 645 additions and 541 deletions

View file

@ -35,6 +35,8 @@
#include <Include/fg_constants.h>
#include <Debug/logstream.hxx>
#include <Main/options.hxx>
#include <Cockpit/panel.hxx>
#include <Main/views.hxx>
#include <plib/pu.h>
@ -328,10 +330,18 @@ static void rolloutsmooth_adj( puObject *hs )
static void goAwayAPAdjust (puObject *)
{
FGView *v = &current_view;
puPopLiveInterface ( ) ;
// puPopInterface ( ) ;
puPopGroup ( ) ;
APAdjustDialog -> hide();
if ( current_options.get_panel_status() ) {
// this seems to be the only way to do this :-(
// problem is the viewport has been mucked with
// current_options.toggle_panel();
// current_options.toggle_panel();
xglViewport(0, 0, (GLint)(v->winWidth), (GLint)(v->winHeight) );
FGPanel::OurPanel->ReInit(0, 0, 1024, 768);
}
}
void cancelAPAdjust(puObject *)

File diff suppressed because it is too large Load diff

View file

@ -48,9 +48,11 @@
#include <Debug/logstream.hxx>
#include <Aircraft/aircraft.hxx>
#include <Airports/simple.hxx>
#include <Cockpit/panel.hxx>
#include <FDM/flight.hxx>
#include <Main/options.hxx>
#include <Main/fg_init.hxx>
#include <Main/views.hxx>
#include <Time/fg_time.hxx>
#include "gui.h"
@ -114,7 +116,17 @@ void guiGetMouse(int *x, int *y)
void reInit(puObject *cb)
{
FGView *v = &current_view;
fgReInitSubsystems();
if ( current_options.get_panel_status() ) {
// this seems to be the only way to do this :-(
// problem is the viewport has been mucked with
// current_options.toggle_panel();
// current_options.toggle_panel();
xglViewport(0, 0 ,
(GLint)(v->winWidth), (GLint)(v->winHeight) );
FGPanel::OurPanel->ReInit(0, 0, 1024, 768);
}
}
void guiToggleMenu(void)
@ -124,7 +136,11 @@ void guiToggleMenu(void)
hideMenuButton -> invokeCallback();
}
void guiTogglePanel(puObject *cb)
{
current_options.toggle_panel();
}
void MenuHideMenuCb(puObject *cb)
{
mainMenuBar -> hide ();
@ -133,34 +149,37 @@ void MenuHideMenuCb(puObject *cb)
#if defined ( WIN32 ) || defined(__CYGWIN32__)
glutSetCursor(GLUT_CURSOR_NONE);
#else // I guess this is what we want to do ??
// puHideCursor(); // does not work with VooDoo
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
glutWarpPointer( glutGet(GLUT_SCREEN_WIDTH), glutGet(GLUT_SCREEN_HEIGHT));
#endif
#endif
}
void hideMenuCb (puObject *cb)
{
if (cb -> getValue () )
{
mainMenuBar -> reveal();
// printf("Showing Menu\n");
hideMenuButton -> setLegend ("Hide Menu");
if (cb -> getValue () ) {
mainMenuBar -> reveal();
// printf("Showing Menu\n");
hideMenuButton -> setLegend ("Hide Menu");
#if defined ( WIN32 ) || defined(__CYGWIN32__)
glutSetCursor(GLUT_CURSOR_INHERIT);
glutSetCursor(GLUT_CURSOR_INHERIT);
#else // I guess this is what we want to do ??
// puShowCursor(); // does not work with VooDoo
glutWarpPointer( glutGet(GLUT_SCREEN_WIDTH)/2,
glutGet(GLUT_SCREEN_HEIGHT)/2 );
#endif
}
else
{
mainMenuBar -> hide ();
// printf("Hiding Menu\n");
hideMenuButton -> setLegend ("Show Menu");
} else{
mainMenuBar -> hide ();
// printf("Hiding Menu\n");
hideMenuButton -> setLegend ("Show Menu");
#if defined ( WIN32 ) || defined(__CYGWIN32__)
glutSetCursor(GLUT_CURSOR_NONE);
glutSetCursor(GLUT_CURSOR_NONE);
#else // I guess this is what we want to do ??
// puHideCursor(); // does not work with VooDoo
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
glutWarpPointer( glutGet(GLUT_SCREEN_WIDTH),
glutGet(GLUT_SCREEN_HEIGHT));
#endif
}
#endif
}
}
void goodBye(puObject *)
@ -191,7 +210,7 @@ void goAwayCb (puObject *me)
dialogBox = NULL;
}
void mkDialog (char *txt)
void mkDialog (const char *txt)
{
dialogBox = new puDialogBox (150, 50);
{
@ -301,7 +320,18 @@ static void validateApt (puObject *inpApt)
void AptDialog_Cancel(puObject *)
{
FGTime *t = FGTime::cur_time_params;
FGView *v = &current_view;
if ( current_options.get_panel_status() ) {
// this seems to be the only way to do this :-(
// problem is the viewport has been mucked with
// current_options.toggle_panel();
// current_options.toggle_panel();
xglViewport(0, 0 ,
(GLint)(v->winWidth), (GLint)(v->winHeight) );
FGPanel::OurPanel->ReInit(0, 0, 1024, 768);
}
delete AptDialogResetButton;
AptDialogResetButton = NULL;
@ -391,30 +421,41 @@ void NewAirportInit(puObject *cb)
/* -----------------------------------------------------------------------
The menu stuff
---------------------------------------------------------------------*/
char *fileSubmenu [] = {
char *fileSubmenu [] = {
"Exit", "Close", "---------", "Print", "---------", "Save", "Reset", NULL };
char *editSubmenu [] = {
puCallback fileSubmenuCb [] = {
goodBye, MenuHideMenuCb, NULL, notCb, NULL, notCb, reInit, NULL};
char *editSubmenu [] = {
"Edit text", NULL };
char *viewSubmenu [] = {
"Cockpit View > ", "View >","------------", "View options...", NULL };
char *aircraftSubmenu [] = {
puCallback editSubmenuCb [] = {
notCb, NULL };
char *viewSubmenu [] = {
"Cockpit View > ", "View >","------------", "Toggle Panel...", NULL };
puCallback viewSubmenuCb [] = {
notCb, notCb, NULL, guiTogglePanel, NULL };
char *aircraftSubmenu [] = {
"Autopilot ...", "Engine ...", "Navigation", "Communication", NULL};
char *environmentSubmenu [] = {
puCallback aircraftSubmenuCb [] = {
fgAPAdjust, notCb, notCb, notCb, NULL };
char *environmentSubmenu [] = {
"Airport", "Terrain", "Weather", NULL};
char *optionsSubmenu [] = {
puCallback environmentSubmenuCb [] = {
NewAirportInit, notCb, notCb, NULL };
char *optionsSubmenu [] = {
"Preferences", "Realism & Reliablity...", NULL};
char *helpSubmenu [] = {
puCallback optionsSubmenuCb [] = {
notCb, notCb, NULL};
char *helpSubmenu [] = {
"About...", "Help", NULL };
puCallback helpSubmenuCb [] = {
notCb, helpCb, NULL };
puCallback fileSubmenuCb [] = { goodBye, MenuHideMenuCb, NULL, notCb, NULL, notCb, reInit, NULL};
puCallback editSubmenuCb [] = { notCb, NULL };
puCallback viewSubmenuCb [] = { notCb, notCb, NULL, notCb, NULL };
puCallback aircraftSubmenuCb [] = { fgAPAdjust, notCb, notCb, notCb, NULL };
puCallback environmentSubmenuCb [] = { NewAirportInit, notCb, notCb, NULL };
puCallback optionsSubmenuCb [] = { notCb, notCb, NULL};
puCallback helpSubmenuCb [] = { notCb, helpCb, NULL };
/* -------------------------------------------------------------------------
init the gui

View file

@ -31,8 +31,6 @@ extern void guiMotionFunc ( int x, int y );
extern void guiMouseFunc(int button, int updown, int x, int y);
extern void guiInit();
extern void guiToggleMenu(void);
extern void mkDialog (char *txt);
extern void mkDialog (char *txt);
void mkDialog (const char *txt);
#endif // _GUI_H_

View file

@ -144,6 +144,9 @@ void GLUTkey(unsigned char k, int x, int y) {
t->adjust_warp(-60);
local_update_sky_and_lighting_params();
return;
case 80: // P key
current_options.toggle_panel();
break;
case 84: // T key
t->adjust_warp_delta(-30);
local_update_sky_and_lighting_params();

View file

@ -803,9 +803,9 @@ static void fgIdleFunction ( void ) {
}
}
// options.cxx needs to see this for toggle_panel()
// Handle new window size or exposure
static void fgReshape( int width, int height ) {
void fgReshape( int width, int height ) {
// Do this so we can call fgReshape(0,0) ourselves without having
// to know what the values of width & height are.
if ( (height > 0) && (width > 0) ) {
@ -859,7 +859,7 @@ int fgGlutInit( int *argc, char **argv ) {
} else {
// Open the cool new 'game mode' window
char game_mode_str[256];
sprintf( game_mode_str, "width=%d height=%d bpp=16",
sprintf( game_mode_str, "width=%d height=%d bpp=32",
current_options.get_xsize(),
current_options.get_ysize() );

View file

@ -38,18 +38,22 @@ bool global_fullscreen = true;
#include STL_STRING
#include <Debug/logstream.hxx>
#include <Misc/fgstream.hxx>
#include <FDM/flight.hxx>
#include <Include/fg_constants.h>
#include <Include/general.hxx>
#include <Cockpit/cockpit.hxx>
#include <Debug/logstream.hxx>
#include <FDM/flight.hxx>
#include <Misc/fgstream.hxx>
#include <Time/fg_time.hxx>
#include <Main/options.hxx>
#include "options.hxx"
#include "fg_serial.hxx"
FG_USING_STD(string);
FG_USING_NAMESPACE(std);
// from GLUTmain.cxx
extern void fgReshape( int width, int height );
inline double
atof( const string& str )
@ -203,6 +207,23 @@ fgOPTIONS::fgOPTIONS() :
port_options_list.end() );
}
void
fgOPTIONS::toggle_panel() {
if( panel_status ) {
panel_status = false;
} else {
panel_status = true;
}
if ( panel_status ) {
if( FGPanel::OurPanel == 0)
new FGPanel;
fov *= 0.4232;
} else {
fov *= (1.0 /0.4232);
}
fgReshape( xsize, ysize);
}
double
fgOPTIONS::parse_time(const string& time_in) {

View file

@ -227,6 +227,7 @@ public:
xglHint ( GL_FOG_HINT, GL_FASTEST );
}
}
void toggle_panel();
inline void set_xsize( int x ) { xsize= x; }
inline void set_ysize( int y ) { xsize= y; }