remove depreciated gui_local.[ch]xx:
- drop unused parts (MouseQuat/GuiQuat) - move "old-reinit-dialog" fgcommand to fg_command.cxx under new name "reset" for now. (May later get merged with fgcommand "reinit".) - move reInit() to fg_init.cxx: This was used by Shift-Esc and Menu->File-Reset (via fgcommand "old-reinit-dialog"). We have already a similar function fgReInitSubsystems() in fg_init.cxx, so these two functions will probably get merged later.)
This commit is contained in:
parent
de527e3891
commit
9f571a0f00
10 changed files with 69 additions and 142 deletions
|
@ -6,7 +6,6 @@ libGUI_a_SOURCES = \
|
|||
dialog.cxx dialog.hxx \
|
||||
menubar.cxx menubar.hxx \
|
||||
gui.cxx gui.h gui_funcs.cxx \
|
||||
gui_local.cxx gui_local.hxx \
|
||||
mouse.cxx fonts.cxx \
|
||||
trackball.c trackball.h \
|
||||
AirportList.cxx AirportList.hxx \
|
||||
|
|
|
@ -9,7 +9,6 @@ Files:
|
|||
dialog.[ch]xx XML-configurable dialog box.
|
||||
gui.cxx, gui.h Top-level GUI functions (deprecated).
|
||||
gui_funcs.cxx Implementation of internal GUI functions (deprecated).
|
||||
gui_local.[ch]xx More 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.
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
#include <GUI/new_gui.hxx>
|
||||
|
||||
#include "gui.h"
|
||||
#include "gui_local.hxx"
|
||||
#include "layout.hxx"
|
||||
|
||||
using namespace osg;
|
||||
|
@ -133,7 +132,6 @@ bool guiFinishInit()
|
|||
return false;
|
||||
if (!initOp->isFinished())
|
||||
return false;
|
||||
initMouseQuat();
|
||||
initOp = 0;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -88,7 +88,6 @@
|
|||
#endif
|
||||
|
||||
#include "gui.h"
|
||||
#include "gui_local.hxx"
|
||||
|
||||
SG_USING_STD(string);
|
||||
SG_USING_STD(cout);
|
||||
|
|
|
@ -1,95 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <plib/pu.h> // plib include
|
||||
|
||||
#include <FDM/flight.hxx>
|
||||
|
||||
#include <Main/globals.hxx>
|
||||
#include <Main/fg_init.hxx>
|
||||
#include <Main/fg_props.hxx>
|
||||
#include <Main/renderer.hxx>
|
||||
#include <Scenery/tilemgr.hxx>
|
||||
#include <Time/light.hxx>
|
||||
|
||||
#include "gui.h"
|
||||
#include "trackball.h"
|
||||
|
||||
// FOR MOUSE VIEW MODE
|
||||
// stashed trackball(_quat0, 0.0, 0.0, 0.0, 0.0);
|
||||
static float _quat0[4];
|
||||
|
||||
float curGuiQuat[4];
|
||||
|
||||
// To apply our mouse rotation quat to VIEW
|
||||
// sgPreMultMat4( VIEW, GuiQuat_mat);
|
||||
// This is here temporarily should be in views.hxx
|
||||
float GuiQuat_mat[4][4];
|
||||
|
||||
void Quat0( void ) {
|
||||
curGuiQuat[0] = _quat0[0];
|
||||
curGuiQuat[1] = _quat0[1];
|
||||
curGuiQuat[2] = _quat0[2];
|
||||
curGuiQuat[3] = _quat0[3];
|
||||
}
|
||||
|
||||
void initMouseQuat(void) {
|
||||
trackball(_quat0, 0.0, 0.0, 0.0, 0.0);
|
||||
Quat0();
|
||||
build_rotmatrix(GuiQuat_mat, curGuiQuat);
|
||||
}
|
||||
|
||||
|
||||
void reInit(void)
|
||||
{
|
||||
Quat0();
|
||||
|
||||
static const SGPropertyNode *master_freeze
|
||||
= fgGetNode("/sim/freeze/master");
|
||||
|
||||
bool freeze = master_freeze->getBoolValue();
|
||||
if ( !freeze ) {
|
||||
fgSetBool("/sim/freeze/master", true);
|
||||
}
|
||||
|
||||
fgSetBool("/sim/signals/reinit", true);
|
||||
cur_fdm_state->unbind();
|
||||
|
||||
// in case user has changed window size as
|
||||
// restoreInitialState() overwrites these
|
||||
int xsize = fgGetInt("/sim/startup/xsize");
|
||||
int ysize = fgGetInt("/sim/startup/ysize");
|
||||
|
||||
build_rotmatrix(GuiQuat_mat, curGuiQuat);
|
||||
|
||||
globals->restoreInitialState();
|
||||
|
||||
// update our position based on current presets
|
||||
fgInitPosition();
|
||||
|
||||
// We don't know how to resize the window, so keep the last values
|
||||
// for xsize and ysize, and don't use the one set initially
|
||||
fgSetInt("/sim/startup/xsize",xsize);
|
||||
fgSetInt("/sim/startup/ysize",ysize);
|
||||
|
||||
SGTime *t = globals->get_time_params();
|
||||
delete t;
|
||||
t = fgInitTime();
|
||||
globals->set_time_params( t );
|
||||
|
||||
fgReInitSubsystems();
|
||||
|
||||
globals->get_tile_mgr()->update( fgGetDouble("/environment/visibility-m") );
|
||||
globals->get_renderer()->resize( xsize, ysize );
|
||||
fgSetBool("/sim/signals/reinit", false);
|
||||
|
||||
if ( !freeze ) {
|
||||
fgSetBool("/sim/freeze/master", false);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
#include "trackball.h"
|
||||
|
||||
#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
|
||||
|
||||
typedef enum {
|
||||
MOUSE_POINTER,
|
||||
MOUSE_YOKE,
|
||||
MOUSE_VIEW
|
||||
} MouseMode;
|
||||
|
||||
extern MouseMode mouse_mode;
|
||||
extern int gui_menu_on;
|
||||
|
||||
extern float curGuiQuat[4];
|
||||
extern float GuiQuat_mat[4][4];
|
||||
|
||||
extern void initMouseQuat( void );
|
||||
extern void Quat0( void );
|
||||
|
||||
extern void reInit(void);
|
|
@ -26,14 +26,6 @@
|
|||
// user-configured dialogs and new commands where necessary.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
extern void reInit (void);
|
||||
static bool
|
||||
do_reinit_dialog (const SGPropertyNode * arg)
|
||||
{
|
||||
reInit();
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(TR_HIRES_SNAP)
|
||||
extern void dumpHiResSnapShot ();
|
||||
static bool
|
||||
|
@ -66,7 +58,6 @@ static struct {
|
|||
const char * name;
|
||||
SGCommandMgr::command_t command;
|
||||
} deprecated_dialogs [] = {
|
||||
{ "old-reinit-dialog", do_reinit_dialog },
|
||||
#if defined(TR_HIRES_SNAP)
|
||||
{ "old-hires-snapshot-dialog", do_hires_snapshot_dialog },
|
||||
#endif
|
||||
|
|
|
@ -64,7 +64,6 @@
|
|||
#include <Main/viewmgr.hxx>
|
||||
|
||||
#include "gui.h"
|
||||
#include "gui_local.hxx"
|
||||
|
||||
SG_USING_STD(string);
|
||||
SG_USING_STD(cout);
|
||||
|
@ -73,11 +72,25 @@ 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)
|
||||
|
||||
|
|
|
@ -211,6 +211,17 @@ do_exit (const SGPropertyNode * arg)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reset FlightGear (Shift-Escape or Menu->File->Reset)
|
||||
*/
|
||||
static bool
|
||||
do_reset (const SGPropertyNode * arg)
|
||||
{
|
||||
reInit();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Built-in command: reinitialize one or more subsystems.
|
||||
*
|
||||
|
@ -1445,6 +1456,7 @@ static struct {
|
|||
{ "null", do_null },
|
||||
{ "nasal", do_nasal },
|
||||
{ "exit", do_exit },
|
||||
{ "reset", do_reset },
|
||||
{ "reinit", do_reinit },
|
||||
{ "suspend", do_reinit },
|
||||
{ "resume", do_reinit },
|
||||
|
|
|
@ -124,6 +124,7 @@
|
|||
#include "options.hxx"
|
||||
#include "globals.hxx"
|
||||
#include "logger.hxx"
|
||||
#include "renderer.hxx"
|
||||
#include "viewmgr.hxx"
|
||||
#include "main.hxx"
|
||||
|
||||
|
@ -1986,3 +1987,45 @@ void fgReInitSubsystems()
|
|||
fgSetBool("/sim/sceneryloaded",false);
|
||||
}
|
||||
|
||||
|
||||
void reInit(void) // from gui_local.cxx -- TODO merge with fgReInitSubsystems()
|
||||
{
|
||||
static SGPropertyNode_ptr master_freeze = fgGetNode("/sim/freeze/master", true);
|
||||
|
||||
bool freeze = master_freeze->getBoolValue();
|
||||
if (!freeze)
|
||||
master_freeze->setBoolValue(true);
|
||||
|
||||
fgSetBool("/sim/signals/reinit", true);
|
||||
cur_fdm_state->unbind();
|
||||
|
||||
// in case user has changed window size as
|
||||
// restoreInitialState() overwrites these
|
||||
int xsize = fgGetInt("/sim/startup/xsize");
|
||||
int ysize = fgGetInt("/sim/startup/ysize");
|
||||
|
||||
globals->restoreInitialState();
|
||||
|
||||
// update our position based on current presets
|
||||
fgInitPosition();
|
||||
|
||||
// We don't know how to resize the window, so keep the last values
|
||||
// for xsize and ysize, and don't use the one set initially
|
||||
fgSetInt("/sim/startup/xsize", xsize);
|
||||
fgSetInt("/sim/startup/ysize", ysize);
|
||||
|
||||
SGTime *t = globals->get_time_params();
|
||||
delete t;
|
||||
t = fgInitTime();
|
||||
globals->set_time_params(t);
|
||||
|
||||
fgReInitSubsystems();
|
||||
|
||||
globals->get_tile_mgr()->update(fgGetDouble("/environment/visibility-m"));
|
||||
globals->get_renderer()->resize(xsize, ysize);
|
||||
fgSetBool("/sim/signals/reinit", false);
|
||||
|
||||
if (!freeze)
|
||||
master_freeze->setBoolValue(false);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue