Changes to toggle panel on and off.
This commit is contained in:
parent
e03741be5f
commit
40db8d0c1f
8 changed files with 645 additions and 541 deletions
|
@ -35,6 +35,8 @@
|
||||||
#include <Include/fg_constants.h>
|
#include <Include/fg_constants.h>
|
||||||
#include <Debug/logstream.hxx>
|
#include <Debug/logstream.hxx>
|
||||||
#include <Main/options.hxx>
|
#include <Main/options.hxx>
|
||||||
|
#include <Cockpit/panel.hxx>
|
||||||
|
#include <Main/views.hxx>
|
||||||
|
|
||||||
#include <plib/pu.h>
|
#include <plib/pu.h>
|
||||||
|
|
||||||
|
@ -328,10 +330,18 @@ static void rolloutsmooth_adj( puObject *hs )
|
||||||
|
|
||||||
static void goAwayAPAdjust (puObject *)
|
static void goAwayAPAdjust (puObject *)
|
||||||
{
|
{
|
||||||
|
FGView *v = ¤t_view;
|
||||||
puPopLiveInterface ( ) ;
|
puPopLiveInterface ( ) ;
|
||||||
// puPopInterface ( ) ;
|
|
||||||
puPopGroup ( ) ;
|
puPopGroup ( ) ;
|
||||||
APAdjustDialog -> hide();
|
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 *)
|
void cancelAPAdjust(puObject *)
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -48,9 +48,11 @@
|
||||||
#include <Debug/logstream.hxx>
|
#include <Debug/logstream.hxx>
|
||||||
#include <Aircraft/aircraft.hxx>
|
#include <Aircraft/aircraft.hxx>
|
||||||
#include <Airports/simple.hxx>
|
#include <Airports/simple.hxx>
|
||||||
|
#include <Cockpit/panel.hxx>
|
||||||
#include <FDM/flight.hxx>
|
#include <FDM/flight.hxx>
|
||||||
#include <Main/options.hxx>
|
#include <Main/options.hxx>
|
||||||
#include <Main/fg_init.hxx>
|
#include <Main/fg_init.hxx>
|
||||||
|
#include <Main/views.hxx>
|
||||||
#include <Time/fg_time.hxx>
|
#include <Time/fg_time.hxx>
|
||||||
|
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
|
@ -114,7 +116,17 @@ void guiGetMouse(int *x, int *y)
|
||||||
|
|
||||||
void reInit(puObject *cb)
|
void reInit(puObject *cb)
|
||||||
{
|
{
|
||||||
|
FGView *v = ¤t_view;
|
||||||
fgReInitSubsystems();
|
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)
|
void guiToggleMenu(void)
|
||||||
|
@ -124,6 +136,10 @@ void guiToggleMenu(void)
|
||||||
hideMenuButton -> invokeCallback();
|
hideMenuButton -> invokeCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void guiTogglePanel(puObject *cb)
|
||||||
|
{
|
||||||
|
current_options.toggle_panel();
|
||||||
|
}
|
||||||
|
|
||||||
void MenuHideMenuCb(puObject *cb)
|
void MenuHideMenuCb(puObject *cb)
|
||||||
{
|
{
|
||||||
|
@ -133,34 +149,37 @@ void MenuHideMenuCb(puObject *cb)
|
||||||
#if defined ( WIN32 ) || defined(__CYGWIN32__)
|
#if defined ( WIN32 ) || defined(__CYGWIN32__)
|
||||||
glutSetCursor(GLUT_CURSOR_NONE);
|
glutSetCursor(GLUT_CURSOR_NONE);
|
||||||
#else // I guess this is what we want to do ??
|
#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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void hideMenuCb (puObject *cb)
|
void hideMenuCb (puObject *cb)
|
||||||
{
|
{
|
||||||
if (cb -> getValue () )
|
if (cb -> getValue () ) {
|
||||||
{
|
mainMenuBar -> reveal();
|
||||||
mainMenuBar -> reveal();
|
// printf("Showing Menu\n");
|
||||||
// printf("Showing Menu\n");
|
hideMenuButton -> setLegend ("Hide Menu");
|
||||||
hideMenuButton -> setLegend ("Hide Menu");
|
|
||||||
#if defined ( WIN32 ) || defined(__CYGWIN32__)
|
#if defined ( WIN32 ) || defined(__CYGWIN32__)
|
||||||
glutSetCursor(GLUT_CURSOR_INHERIT);
|
glutSetCursor(GLUT_CURSOR_INHERIT);
|
||||||
#else // I guess this is what we want to do ??
|
#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
|
#endif
|
||||||
}
|
} else{
|
||||||
else
|
mainMenuBar -> hide ();
|
||||||
{
|
// printf("Hiding Menu\n");
|
||||||
mainMenuBar -> hide ();
|
hideMenuButton -> setLegend ("Show Menu");
|
||||||
// printf("Hiding Menu\n");
|
|
||||||
hideMenuButton -> setLegend ("Show Menu");
|
|
||||||
#if defined ( WIN32 ) || defined(__CYGWIN32__)
|
#if defined ( WIN32 ) || defined(__CYGWIN32__)
|
||||||
glutSetCursor(GLUT_CURSOR_NONE);
|
glutSetCursor(GLUT_CURSOR_NONE);
|
||||||
#else // I guess this is what we want to do ??
|
#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
|
||||||
}
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void goodBye(puObject *)
|
void goodBye(puObject *)
|
||||||
|
@ -191,7 +210,7 @@ void goAwayCb (puObject *me)
|
||||||
dialogBox = NULL;
|
dialogBox = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mkDialog (char *txt)
|
void mkDialog (const char *txt)
|
||||||
{
|
{
|
||||||
dialogBox = new puDialogBox (150, 50);
|
dialogBox = new puDialogBox (150, 50);
|
||||||
{
|
{
|
||||||
|
@ -301,6 +320,17 @@ static void validateApt (puObject *inpApt)
|
||||||
void AptDialog_Cancel(puObject *)
|
void AptDialog_Cancel(puObject *)
|
||||||
{
|
{
|
||||||
FGTime *t = FGTime::cur_time_params;
|
FGTime *t = FGTime::cur_time_params;
|
||||||
|
FGView *v = ¤t_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;
|
delete AptDialogResetButton;
|
||||||
AptDialogResetButton = NULL;
|
AptDialogResetButton = NULL;
|
||||||
|
@ -391,29 +421,40 @@ void NewAirportInit(puObject *cb)
|
||||||
/* -----------------------------------------------------------------------
|
/* -----------------------------------------------------------------------
|
||||||
The menu stuff
|
The menu stuff
|
||||||
---------------------------------------------------------------------*/
|
---------------------------------------------------------------------*/
|
||||||
char *fileSubmenu [] = {
|
char *fileSubmenu [] = {
|
||||||
"Exit", "Close", "---------", "Print", "---------", "Save", "Reset", NULL };
|
"Exit", "Close", "---------", "Print", "---------", "Save", "Reset", NULL };
|
||||||
char *editSubmenu [] = {
|
puCallback fileSubmenuCb [] = {
|
||||||
|
goodBye, MenuHideMenuCb, NULL, notCb, NULL, notCb, reInit, NULL};
|
||||||
|
|
||||||
|
char *editSubmenu [] = {
|
||||||
"Edit text", NULL };
|
"Edit text", NULL };
|
||||||
char *viewSubmenu [] = {
|
puCallback editSubmenuCb [] = {
|
||||||
"Cockpit View > ", "View >","------------", "View options...", NULL };
|
notCb, NULL };
|
||||||
char *aircraftSubmenu [] = {
|
|
||||||
|
char *viewSubmenu [] = {
|
||||||
|
"Cockpit View > ", "View >","------------", "Toggle Panel...", NULL };
|
||||||
|
puCallback viewSubmenuCb [] = {
|
||||||
|
notCb, notCb, NULL, guiTogglePanel, NULL };
|
||||||
|
|
||||||
|
char *aircraftSubmenu [] = {
|
||||||
"Autopilot ...", "Engine ...", "Navigation", "Communication", NULL};
|
"Autopilot ...", "Engine ...", "Navigation", "Communication", NULL};
|
||||||
char *environmentSubmenu [] = {
|
puCallback aircraftSubmenuCb [] = {
|
||||||
|
fgAPAdjust, notCb, notCb, notCb, NULL };
|
||||||
|
|
||||||
|
char *environmentSubmenu [] = {
|
||||||
"Airport", "Terrain", "Weather", NULL};
|
"Airport", "Terrain", "Weather", NULL};
|
||||||
char *optionsSubmenu [] = {
|
puCallback environmentSubmenuCb [] = {
|
||||||
|
NewAirportInit, notCb, notCb, NULL };
|
||||||
|
|
||||||
|
char *optionsSubmenu [] = {
|
||||||
"Preferences", "Realism & Reliablity...", NULL};
|
"Preferences", "Realism & Reliablity...", NULL};
|
||||||
char *helpSubmenu [] = {
|
puCallback optionsSubmenuCb [] = {
|
||||||
|
notCb, notCb, NULL};
|
||||||
|
|
||||||
|
char *helpSubmenu [] = {
|
||||||
"About...", "Help", NULL };
|
"About...", "Help", NULL };
|
||||||
|
puCallback helpSubmenuCb [] = {
|
||||||
puCallback fileSubmenuCb [] = { goodBye, MenuHideMenuCb, NULL, notCb, NULL, notCb, reInit, NULL};
|
notCb, helpCb, 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 };
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------
|
/* -------------------------------------------------------------------------
|
||||||
|
|
|
@ -31,8 +31,6 @@ extern void guiMotionFunc ( int x, int y );
|
||||||
extern void guiMouseFunc(int button, int updown, int x, int y);
|
extern void guiMouseFunc(int button, int updown, int x, int y);
|
||||||
extern void guiInit();
|
extern void guiInit();
|
||||||
extern void guiToggleMenu(void);
|
extern void guiToggleMenu(void);
|
||||||
extern void mkDialog (char *txt);
|
void mkDialog (const char *txt);
|
||||||
|
|
||||||
extern void mkDialog (char *txt);
|
|
||||||
|
|
||||||
#endif // _GUI_H_
|
#endif // _GUI_H_
|
||||||
|
|
|
@ -144,6 +144,9 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
t->adjust_warp(-60);
|
t->adjust_warp(-60);
|
||||||
local_update_sky_and_lighting_params();
|
local_update_sky_and_lighting_params();
|
||||||
return;
|
return;
|
||||||
|
case 80: // P key
|
||||||
|
current_options.toggle_panel();
|
||||||
|
break;
|
||||||
case 84: // T key
|
case 84: // T key
|
||||||
t->adjust_warp_delta(-30);
|
t->adjust_warp_delta(-30);
|
||||||
local_update_sky_and_lighting_params();
|
local_update_sky_and_lighting_params();
|
||||||
|
|
|
@ -803,9 +803,9 @@ static void fgIdleFunction ( void ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// options.cxx needs to see this for toggle_panel()
|
||||||
// Handle new window size or exposure
|
// 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
|
// Do this so we can call fgReshape(0,0) ourselves without having
|
||||||
// to know what the values of width & height are.
|
// to know what the values of width & height are.
|
||||||
if ( (height > 0) && (width > 0) ) {
|
if ( (height > 0) && (width > 0) ) {
|
||||||
|
@ -859,7 +859,7 @@ int fgGlutInit( int *argc, char **argv ) {
|
||||||
} else {
|
} else {
|
||||||
// Open the cool new 'game mode' window
|
// Open the cool new 'game mode' window
|
||||||
char game_mode_str[256];
|
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_xsize(),
|
||||||
current_options.get_ysize() );
|
current_options.get_ysize() );
|
||||||
|
|
||||||
|
|
|
@ -38,18 +38,22 @@ bool global_fullscreen = true;
|
||||||
|
|
||||||
#include STL_STRING
|
#include STL_STRING
|
||||||
|
|
||||||
#include <Debug/logstream.hxx>
|
|
||||||
#include <Misc/fgstream.hxx>
|
|
||||||
#include <FDM/flight.hxx>
|
|
||||||
#include <Include/fg_constants.h>
|
#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 <Time/fg_time.hxx>
|
||||||
#include <Main/options.hxx>
|
|
||||||
|
|
||||||
|
#include "options.hxx"
|
||||||
#include "fg_serial.hxx"
|
#include "fg_serial.hxx"
|
||||||
|
|
||||||
FG_USING_STD(string);
|
FG_USING_STD(string);
|
||||||
FG_USING_NAMESPACE(std);
|
FG_USING_NAMESPACE(std);
|
||||||
|
|
||||||
|
// from GLUTmain.cxx
|
||||||
|
extern void fgReshape( int width, int height );
|
||||||
|
|
||||||
inline double
|
inline double
|
||||||
atof( const string& str )
|
atof( const string& str )
|
||||||
|
@ -203,6 +207,23 @@ fgOPTIONS::fgOPTIONS() :
|
||||||
port_options_list.end() );
|
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
|
double
|
||||||
fgOPTIONS::parse_time(const string& time_in) {
|
fgOPTIONS::parse_time(const string& time_in) {
|
||||||
|
|
|
@ -227,6 +227,7 @@ public:
|
||||||
xglHint ( GL_FOG_HINT, GL_FASTEST );
|
xglHint ( GL_FOG_HINT, GL_FASTEST );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void toggle_panel();
|
||||||
inline void set_xsize( int x ) { xsize= x; }
|
inline void set_xsize( int x ) { xsize= x; }
|
||||||
inline void set_ysize( int y ) { xsize= y; }
|
inline void set_ysize( int y ) { xsize= y; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue