}
+\f
+////////////////////////////////////////////////////////////////////////
+// Implementation of FGSpecialInstrument.
+////////////////////////////////////////////////////////////////////////
+
+FGSpecialInstrument::FGSpecialInstrument (DCLGPS* sb)
+ : FGPanelInstrument()
+{
+ complex = sb;
+}
+
+FGSpecialInstrument::~FGSpecialInstrument ()
+{
+}
+
+void
+FGSpecialInstrument::draw ()
+{
+ complex->draw();
+}
+
+
\f
////////////////////////////////////////////////////////////////////////
// Implementation of FGInstrumentLayer.
#include <Main/fg_props.hxx>
#include <Input/input.hxx>
+#include <Instrumentation/dclgps.hxx>
SG_USING_STD(vector);
SG_USING_STD(map);
};
+/**
+ * An empty-shell instrument that exists soley in
+ * order to redirect commands from the panel to a
+ * complex instrument inherited from SGSubsystem.
+ *
+ * Currently the only complex instrument is the KLN89,
+ * which we've hardwired this to for now.
+ */
+class FGSpecialInstrument : public FGPanelInstrument
+{
+public:
+ FGSpecialInstrument(DCLGPS* sb);
+ //FGSpecialInstrument (int x, int y, int w, int h);
+ virtual ~FGSpecialInstrument ();
+
+ virtual void draw ();
+
+protected:
+ DCLGPS* complex;
+};
+
+
/**
* An instrument layer containing a group of sublayers.
*
// Warning - hardwired size!!!
RenderArea2D* instrument = new RenderArea2D(158, 40, 158, 40, x, y);
- // FIXME: shift-F3 (panel reload) kill's us here due to duplicate subsystem!
- KLN89* gps = new KLN89(instrument);
- panel->addInstrument(gps);
- globals->add_subsystem("kln89", gps);
- //gps->init(); // init seems to get called automagically.
+ KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
+ if(gps == NULL) {
+ gps = new KLN89(instrument);
+ globals->add_subsystem("kln89", gps);
+ }
+ //gps->init(); // init seems to get called automagically.
+ FGSpecialInstrument* gpsinst = new FGSpecialInstrument(gps);
+ panel->addInstrument(gpsinst);
} else {
SG_LOG( SG_COCKPIT, SG_WARN, "Unknown special instrument found" );
}
#include <iostream>
#include <ATC/ATCProjection.hxx>
+#include <Main/fg_props.hxx>
#include <simgear/math/point3d.hxx>
SG_USING_STD(cout);
#include "kln89_page_apt.hxx"
#include <ATC/commlist.hxx>
+#include <Main/globals.hxx>
// This function is copied from Airports/runways.cxx
// TODO - Make the original properly available and remove this instance!!!!
// $Id$
#include "kln89_page_nav.hxx"
+#include <Main/fg_props.hxx>
KLN89NavPage::KLN89NavPage(KLN89* parent)
: KLN89Page(parent) {
#include "dclgps.hxx"
#include <simgear/sg_inlines.h>
+#include <simgear/structure/commands.hxx>
+#include <Main/fg_props.hxx>
#include <iostream>
SG_USING_STD(cout);
#include <vector>
#include <map>
-#include <Cockpit/panel.hxx>
-
#include <Navaids/navrecord.hxx>
#include <Navaids/navlist.hxx>
#include <Navaids/fixlist.hxx>
typedef gps_page_list_type::iterator gps_page_list_itr;
// TODO - merge generic GPS functions instead and split out KLN specific stuff.
-class DCLGPS : public SGSubsystem, public FGPanelInstrument {
+class DCLGPS : public SGSubsystem {
friend class GPSPage;