1
0
Fork 0

Break viewmgr.hxx dependency on on viewer.hxx.

This commit is contained in:
jmt 2009-09-19 18:41:55 +00:00 committed by Tim Moore
parent 3c84e07a25
commit 0c8c8380b1
12 changed files with 79 additions and 41 deletions

View file

@ -44,6 +44,7 @@
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Main/fg_props.hxx> #include <Main/fg_props.hxx>
#include <Main/viewmgr.hxx> #include <Main/viewmgr.hxx>
#include <Main/viewer.hxx>
#include <Scenery/scenery.hxx> #include <Scenery/scenery.hxx>
#include <GUI/gui.h> #include <GUI/gui.h>

View file

@ -48,6 +48,7 @@
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Scenery/scenery.hxx> #include <Scenery/scenery.hxx>
#include <Airports/runways.hxx> #include <Airports/runways.hxx>
#include <Main/viewer.hxx>
#include "hud.hxx" #include "hud.hxx"

View file

@ -6,7 +6,7 @@
#include "hud.hxx" #include "hud.hxx"
#include "panel.hxx" #include "panel.hxx"
#include <Main/viewer.hxx>
// FIXME // FIXME
extern float get_roll(void); extern float get_roll(void);

View file

@ -31,6 +31,7 @@
#include <Environment/environment.hxx> #include <Environment/environment.hxx>
#include <Environment/environment_mgr.hxx> #include <Environment/environment_mgr.hxx>
#include <ATCDCL/ATCutils.hxx> #include <ATCDCL/ATCutils.hxx>
#include <Main/viewer.hxx>
#include <osg/GLU> #include <osg/GLU>

View file

@ -55,6 +55,7 @@
#include <Main/viewmgr.hxx> #include <Main/viewmgr.hxx>
#include <Time/light.hxx> #include <Time/light.hxx>
#include <GUI/new_gui.hxx> // FGFontCache #include <GUI/new_gui.hxx> // FGFontCache
#include <Main/viewer.hxx>
#include "hud.hxx" #include "hud.hxx"
#include "panel.hxx" #include "panel.hxx"

View file

@ -35,6 +35,7 @@
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Main/viewmgr.hxx> #include <Main/viewmgr.hxx>
#include <Main/viewer.hxx>
#include "HUD.hxx" #include "HUD.hxx"

View file

@ -47,6 +47,7 @@
#include "util.hxx" #include "util.hxx"
#include "viewmgr.hxx" #include "viewmgr.hxx"
#include "main.hxx" #include "main.hxx"
#include <Main/viewer.hxx>
using std::string; using std::string;
using std::ifstream; using std::ifstream;

View file

@ -81,7 +81,7 @@
#include "fg_init.hxx" #include "fg_init.hxx"
#include "fg_os.hxx" #include "fg_os.hxx"
#include "WindowSystemAdapter.hxx" #include "WindowSystemAdapter.hxx"
#include <Main/viewer.hxx>
static double real_delta_time_sec = 0.0; static double real_delta_time_sec = 0.0;
double delta_time_sec = 0.0; double delta_time_sec = 0.0;

View file

@ -60,7 +60,7 @@
#include "options.hxx" #include "options.hxx"
#include "util.hxx" #include "util.hxx"
#include "viewmgr.hxx" #include "viewmgr.hxx"
#include <Main/viewer.hxx>
using std::string; using std::string;
using std::sort; using std::sort;

View file

@ -99,6 +99,7 @@
#include "main.hxx" #include "main.hxx"
#include "CameraGroup.hxx" #include "CameraGroup.hxx"
#include "FGEventHandler.hxx" #include "FGEventHandler.hxx"
#include <Main/viewer.hxx>
using namespace osg; using namespace osg;
using namespace simgear; using namespace simgear;

View file

@ -341,6 +341,64 @@ FGViewMgr::copyToCurrent()
get_current_view()->getInternal()); get_current_view()->getInternal());
} }
void FGViewMgr::clear()
{
views.clear();
}
FGViewer*
FGViewMgr::get_current_view()
{
if ( current < (int)views.size() ) {
return views[current];
} else {
return NULL;
}
}
const FGViewer*
FGViewMgr::get_current_view() const
{
if ( current < (int)views.size() ) {
return views[current];
} else {
return NULL;
}
}
FGViewer*
FGViewMgr::get_view( int i )
{
if ( i < 0 ) { i = 0; }
if ( i >= (int)views.size() ) { i = views.size() - 1; }
return views[i];
}
const FGViewer*
FGViewMgr::get_view( int i ) const
{
if ( i < 0 ) { i = 0; }
if ( i >= (int)views.size() ) { i = views.size() - 1; }
return views[i];
}
FGViewer*
FGViewMgr::next_view()
{
setView((current+1 < (int)views.size()) ? (current + 1) : 0);
view_number->fireValueChanged();
return views[current];
}
FGViewer*
FGViewMgr::prev_view()
{
setView((0 < current) ? (current - 1) : (views.size() - 1));
view_number->fireValueChanged();
return views[current];
}
void void
FGViewMgr::add_view( FGViewer * v ) FGViewMgr::add_view( FGViewer * v )
{ {

View file

@ -30,8 +30,6 @@
#include <simgear/structure/subsystem_mgr.hxx> #include <simgear/structure/subsystem_mgr.hxx>
#include <simgear/math/SGMath.hxx> #include <simgear/math/SGMath.hxx>
#include <Main/viewer.hxx> // FIXME - remove inlines here.
// forward decls // forward decls
class FGViewer; class FGViewer;
typedef SGSharedPtr<FGViewer> FGViewerPtr; typedef SGSharedPtr<FGViewer> FGViewerPtr;
@ -57,43 +55,18 @@ public:
// getters // getters
inline int size() const { return views.size(); } inline int size() const { return views.size(); }
inline int get_current() const { return current; } inline int get_current() const { return current; }
inline FGViewer *get_current_view() {
if ( current < (int)views.size() ) { FGViewer *get_current_view();
return views[current]; const FGViewer *get_current_view() const;
} else {
return NULL; FGViewer *get_view( int i );
} const FGViewer *get_view( int i ) const;
}
inline const FGViewer *get_current_view() const { FGViewer *next_view();
if ( current < (int)views.size() ) { FGViewer *prev_view();
return views[current];
} else {
return NULL;
}
}
inline FGViewer *get_view( int i ) {
if ( i < 0 ) { i = 0; }
if ( i >= (int)views.size() ) { i = views.size() - 1; }
return views[i];
}
inline const FGViewer *get_view( int i ) const {
if ( i < 0 ) { i = 0; }
if ( i >= (int)views.size() ) { i = views.size() - 1; }
return views[i];
}
inline FGViewer *next_view() {
setView((current+1 < (int)views.size()) ? (current + 1) : 0);
view_number->fireValueChanged();
return views[current];
}
inline FGViewer *prev_view() {
setView((0 < current) ? (current - 1) : (views.size() - 1));
view_number->fireValueChanged();
return views[current];
}
// setters // setters
inline void clear() { views.clear(); } void clear();
inline void set_view( const int v ) { current = v; } inline void set_view( const int v ) { current = v; }
void add_view( FGViewer * v ); void add_view( FGViewer * v );