]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/hud.hxx
Merge commit 'refs/merge-requests/1552' of git@gitorious.org:fg/flightgear into next
[flightgear.git] / src / Cockpit / hud.hxx
index 8591bb9b2927583921ebeb344f00319286bc666f..bec30f5539a6c570ca185b1c4efc3906bc3e3eb1 100644 (file)
@@ -21,8 +21,8 @@
 // $Id$
 
 
-#ifndef _HUD_HXX
-#define _HUD_HXX
+#ifndef _OLDHUD_HXX
+#define _OLDHUD_HXX
 
 #ifndef __cplusplus
 # error This library requires C++
 #  include <config.h>
 #endif
 
-#ifdef HAVE_WINDOWS_H
-#  include <windows.h>
+#ifdef __CYGWIN__
+#include <ieeefp.h>
 #endif
 
 #include <stdlib.h>
 #include <string.h>
 
-//#ifdef HAVE_VALUES_H
-//#  include <values.h>  // for MAXINT
-//#endif
-
 #include <algorithm>    // for_each()
 #include <vector>       // STL vector
 #include <deque>        // STL double ended queue
-#include STL_FSTREAM
+#include <fstream>
+
+namespace osg {
+    class State;
+}
 
+#include <simgear/math/SGMath.hxx>
 #include <simgear/constants.h>
-//#include <simgear/props/props.hxx>
 
 #include <Include/fg_typedefs.h>
-#include <Aircraft/aircraft.hxx>
 #include <Aircraft/controls.hxx>
 #include <FDM/flight.hxx>
 #include <GUI/gui.h>
+#include <Main/fg_props.hxx>
 #include <Main/globals.hxx>
 #include <Main/viewmgr.hxx>
-#include <Airports/runways.hxx>
 
-#include "hud_opts.hxx"
-#include <plib/sg.h>
+class FGRunway;
 
-SG_USING_STD(deque);
-SG_USING_STD(vector);
-SG_USING_NAMESPACE(std);
+using std::deque;
+using std::vector;
 
+#define float_to_int(v) SGMiscf::roundToInt(v)
 
 // some of Norman's crazy optimizations. :-)
 
@@ -105,32 +103,6 @@ enum fgLabelJust{ LEFT_JUST, CENTER_JUST, RIGHT_JUST } ;
 #define HUDS_DECITICS            0x0040
 #define HUDS_NOTEXT              0x0080
 
-// Ladder orientaion
-// #define HUD_VERTICAL        1
-// #define HUD_HORIZONTAL       2
-// #define HUD_FREEFLOAT        3
-
-// Ladder orientation modes
-// #define HUD_LEFT         1
-// #define HUD_RIGHT            2
-// #define HUD_TOP              1
-// #define HUD_BOTTOM           2
-// #define HUD_V_LEFT           1
-// #define HUD_V_RIGHT          2
-// #define HUD_H_TOP            1
-// #define HUD_H_BOTTOM         2
-
-
-// Ladder sub-types
-// #define HUD_LIM              1
-// #define HUD_NOLIM            2
-// #define HUD_CIRC         3
-
-// #define HUD_INSTR_LADDER 1
-// #define HUD_INSTR_CLADDER    2
-// #define HUD_INSTR_HORIZON    3
-// #define HUD_INSTR_LABEL      4
-
 // in cockpit.cxx
 extern float get_throttleval ( void );
 extern float get_aileronval  ( void );
@@ -160,51 +132,8 @@ extern float get_climb_rate  ( void );
 extern float get_mach( void );
 extern char *coord_format_lat(float);
 extern char *coord_format_lon(float);
-//extern char *coord_format_latlon(float latitude, float longitude);  // cockpit.cxx
-
-// $$$ begin - added, VS Renganathan, 13 Oct 2K
-// #define FIGHTER_HUD
-extern float get_anzg (void);
-extern float get_Vx (void);
-extern float get_Vy (void);
-extern float get_Vz (void);
-extern float get_Ax (void);
-extern float get_Ay (void);
-extern float get_Az (void);
-extern int get_iaux1 (void);
-extern int get_iaux2 (void);
-extern int get_iaux3 (void);
-extern int get_iaux4 (void);
-extern int get_iaux5 (void);
-extern int get_iaux6 (void);
-extern int get_iaux7 (void);
-extern int get_iaux8 (void);
-extern int get_iaux9 (void);
-extern int get_iaux10 (void);
-extern int get_iaux11 (void);
-extern int get_iaux12 (void);
-extern float get_aux1(void);
-extern float get_aux2(void);
-extern float get_aux3(void);
-extern float get_aux4(void);
-extern float get_aux5 (void);
-extern float get_aux6 (void);
-extern float get_aux7 (void);
-extern float get_aux8(void);
-extern float get_aux9(void);
-extern float get_aux10(void);
-extern float get_aux11(void);
-extern float get_aux12(void);
-extern float get_aux13(void);
-extern float get_aux14(void);
-extern float get_aux15(void);
-extern float get_aux16(void);
-extern float get_aux17(void);
-extern float get_aux18(void);
-// $$$ end - added, VS Renganathan, 13 Oct 2K
 
 extern char *get_formated_gmt_time( void );
-extern void fgHUDReshape(void);
 
 enum  hudinstype{ HUDno_instr,
                   HUDscale,
@@ -235,12 +164,10 @@ public:
     fgLineSeg2D( const fgLineSeg2D & image )
         : x0(image.x0), y0(image.y0), x1(image.x1), y1(image.y1) {}
 
-    fgLineSeg2D& operator= ( const fgLineSeg2D & image ) {
+    fgLineSeg2D& operator= ( const fgLineSeg2D & image ) { // seems unused
         x0 = image.x0; y0 = image.y0; x1 = image.x1; y1 = image.y1; return *this;
     }
 
-    ~fgLineSeg2D() {}
-
     void draw() const
     {
         glVertex2f(x0, y0);
@@ -265,41 +192,37 @@ extern float HUD_matrix[16];
 class fgText {
 private:
     float x, y;
-    char msg[64];
+    string msg;
+       bool digit;
+    // seems unused   
+       
 public:
-    int digit;
-    fgText(float x = 0, float y = 0, char *c = NULL,int digits=0): x(x), y(y)
-    {
-        strcpy(msg,c);
-        digit=digits;
-    }
+       fgText(float x, float y, const string& c, bool digits=false): x(x), y(y), msg( c), digit( digits) {};   
 
     fgText( const fgText & image )
-        : x(image.x), y(image.y),digit(image.digit) { strcpy(msg,image.msg); }
-
-    fgText& operator = ( const fgText & image ) {
-        strcpy(msg,image.msg); x = image.x; y = image.y;digit=image.digit;
-        return *this;
-    }
-
-    ~fgText() { msg[0]='\0'; }
-
-    int getStringWidth ( char *str )
+               : x(image.x), y(image.y), msg(image.msg), digit(image.digit) { }
+
+       fgText& operator = ( const fgText & image ) {
+               x = image.x; y = image.y; msg= image.msg; digit = image.digit;
+               return *this;
+       }
+       
+    static int getStringWidth ( const char *str )
     {
         if ( HUDtext && str ) {
             float r, l ;
             HUD_Font->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
-            return FloatToInt( r - l );
+            return float_to_int( r - l );
         }
         return 0 ;
     }
 
-    int StringWidth (void )
+    int StringWidth ()
     {
-        if ( HUDtext && strlen( msg )) {
+        if ( HUDtext && msg != "") {
             float r, l ;
-            HUD_Font->getBBox ( msg, HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
-            return FloatToInt( r - l );
+            HUD_Font->getBBox ( msg.c_str(), HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
+            return float_to_int( r - l );
         }
         return 0 ;
     }
@@ -308,55 +231,50 @@ public:
     // according to MIL Standards for example Altitude above 10000 ft
     // is shown as 10ooo.
 
-    void Draw(fntRenderer *fnt,int digits) {
-        if (digits==1) {
-            int c=0,i=0;
-            char *t=msg;
+    void Draw(fntRenderer *fnt) {
+        if (digit) {
+            int c=0;
+            
             int p=4;
 
-            if (t[0]=='-') {
+            if (msg[0]=='-') {
                 //if negative value then increase the c and p values
                 //for '-' sign.  c++;
                 p++;
             }
-            char *tmp=msg;
-            while (tmp[i]!='\0') {
-                if ((tmp[i]>='0') && (tmp[i]<='9'))
+                       
+                       for (string::size_type i = 0; i < msg.size(); i++) {
+                if ((msg[i]>='0') && (msg[i]<='9'))
                     c++;
-                i++;
             }
+            float orig_size = fnt->getPointSize();
             if (c>p) {
                 fnt->setPointSize(HUD_TextSize * 0.8);
-                int p1=c-3;
-                char *tmp1=msg+p1;
-                int p2=p1*8;
+                int p2=(c-3)*8;  //advance to the last 3 digits
 
                 fnt->start2f(x+p2,y);
-                fnt->puts(tmp1);
+                fnt->puts(msg.c_str() + c - 3); // display last 3 digits
 
                 fnt->setPointSize(HUD_TextSize * 1.2);
-                char tmp2[64];
-                strncpy(tmp2,msg,p1);
-                tmp2[p1]='\0';
-
+              
                 fnt->start2f(x,y);
-                fnt->puts(tmp2);
+                               fnt->puts(msg.substr(0,c-3).c_str());
             } else {
                 fnt->setPointSize(HUD_TextSize * 1.2);
                 fnt->start2f( x, y );
-                fnt->puts(tmp);
+                fnt->puts(msg.c_str());
             }
+            fnt->setPointSize(orig_size);
         } else {
-            //if digits not equal to 1
-            fnt->setPointSize(HUD_TextSize * 0.8);
+            //if digits not true
             fnt->start2f( x, y );
-            fnt->puts( msg ) ;
+            fnt->puts( msg.c_str()) ;
         }
     }
 
     void Draw()
     {
-        guiFnt.drawString( msg, FloatToInt(x), FloatToInt(y) );
+               guiFnt.drawString( msg.c_str(), float_to_int(x), float_to_int(y) );
     }
 };
 
@@ -364,9 +282,8 @@ class fgLineList {
     vector < fgLineSeg2D > List;
 public:
     fgLineList( void ) {}
-    ~fgLineList( void ) {}
     void add( const fgLineSeg2D& seg ) { List.push_back(seg); }
-    void erase( void ) { List.erase( List.begin(), List.end() ); }
+       void erase( void ) { List.clear();}
     void draw( void ) {
         glBegin(GL_LINES);
         for_each( List.begin(), List.end(), DrawLineSeg2D());
@@ -379,11 +296,10 @@ class fgTextList {
     vector< fgText > List;
 public:
     fgTextList ( void ) { Font = 0; }
-    ~fgTextList( void ) {}
 
     void setFont( fntRenderer *Renderer ) { Font = Renderer; }
     void add( const fgText& String ) { List.push_back(String); }
-    void erase( void ) { List.erase( List.begin(), List.end() ); }
+    void erase( void ) { List.clear(); }
     void draw( void );
 };
 
@@ -410,7 +326,7 @@ extern fgLineList         HUD_LineList;
 extern fgLineList         HUD_StippleLineList;
 
 
-class instr_item {  // An Abstract Base Class (ABC)
+class instr_item : public SGReferenced {  // An Abstract Base Class (ABC)
 private:
     static UINT        instances;     // More than 64K instruments? Nah!
     static int         brightness;
@@ -436,11 +352,9 @@ public:
                 FLTFNPTR       data_source,
                 float          data_scaling,
                 UINT           options,
-                bool           working  = true,
+                bool           working = true,
                 int            digit = 0);
 
-    instr_item( const instr_item & image );
-
     virtual ~instr_item ();
 
     void    set_data_source ( FLTFNPTR fn ) { load_value_fn = fn; }
@@ -455,21 +369,24 @@ public:
     POINT   get_centroid    ( void ) { return mid_span;  }
     UINT    get_options     ( void ) { return opts;      }
     int     get_digits      ( void ) { return digits;         }
-
-    UINT    huds_vert     (UINT options) { return( options  & HUDS_VERT ); }
-    UINT    huds_left     (UINT options) { return( options  & HUDS_LEFT ); }
-    UINT    huds_right    (UINT options) { return( options  & HUDS_RIGHT ); }
+    inline int get_x() const { return scrn_pos.left; }
+    inline int get_y() const { return scrn_pos.top; }
+    inline int get_width() const { return scrn_pos.right; }
+    inline int get_height() const { return scrn_pos.bottom; }
+
+    UINT    huds_vert     (UINT options) { return (options & HUDS_VERT); }
+    UINT    huds_left     (UINT options) { return (options & HUDS_LEFT); }
+    UINT    huds_right    (UINT options) { return (options & HUDS_RIGHT); }
     UINT    huds_both     (UINT options) {
-        return( (options & HUDS_BOTH) == HUDS_BOTH );
+        return ((options & HUDS_BOTH) == HUDS_BOTH);
     }
-    UINT    huds_noticks  (UINT options) { return( options  & HUDS_NOTICKS ); }
-    UINT    huds_notext   (UINT options) { return( options  & HUDS_NOTEXT ); }
-    UINT    huds_top      (UINT options) { return( options  & HUDS_TOP ); }
-    UINT    huds_bottom   (UINT options) { return( options  & HUDS_BOTTOM ); }
+    UINT    huds_noticks  (UINT options) { return (options & HUDS_NOTICKS); }
+    UINT    huds_notext   (UINT options) { return (options & HUDS_NOTEXT); }
+    UINT    huds_top      (UINT options) { return (options & HUDS_TOP); }
+    UINT    huds_bottom   (UINT options) { return (options & HUDS_BOTTOM); }
 
-    virtual void display_enable( bool working ) { is_enabled = !! working;}
+    virtual void display_enable( bool working ) { is_enabled = working;}
 
-    virtual void update( void );
     virtual void break_display ( bool bad );
     virtual void SetBrightness( int illumination_level ); // fgHUDSetBright...
     void         SetPosition  ( int x, int y, UINT width, UINT height );
@@ -484,7 +401,7 @@ public:
     {
         HUD_StippleLineList.add(fgLineSeg2D(x1,y1,x2,y2));
     }
-    void TextString( char *msg, float x, float y,int digit )
+    void TextString( char *msg, float x, float y, bool digit )
     {
         HUD_TextList.add(fgText(x, y, msg,digit));
     }
@@ -493,22 +410,12 @@ public:
         if ( HUDtext && str ) {
             float r, l ;
             HUD_Font->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
-            return FloatToInt( r - l );
+            return float_to_int( r - l );
         }
         return 0 ;
     }
 
-    //code to draw ticks as small circles
-    void drawOneCircle(float x1, float y1, float r)
-    {
-        glBegin(GL_LINE_LOOP);  // Use polygon to approximate a circle
-        for (int count=0; count<25; count++) {
-            float cosine = r * cos(count * 2 * SG_PI/10.0);
-            float sine =   r * sin(count * 2 * SG_PI/10.0);
-            glVertex2f(cosine+x1, sine+y1);
-        }
-        glEnd();
-    }
+
 
 };
 
@@ -523,9 +430,7 @@ class HUDdraw {
 };
 
 
-extern deque< instr_item *> HUD_deque;
 extern int HUD_style;
-//extern hud_deque_type HUD_deque;
 
 // instr_item           This class has no other purpose than to maintain
 //                      a linked list of instrument and derived class
@@ -535,135 +440,67 @@ extern int HUD_style;
 class instr_label : public instr_item {
 private:
     const char  *pformat;
-    const char  *pre_str;
-    const char  *post_str;
+    
     fgLabelJust justify;
     int         fontSize;
     int         blink;
-    char        format_buffer[80];
+    string      format_buffer;
     bool        lat;
     bool        lon;
     bool        lbox;
+    SGPropertyNode_ptr lon_node;
+    SGPropertyNode_ptr lat_node;
 
 public:
     instr_label(const SGPropertyNode *);
-    ~instr_label();
-
-    instr_label(const instr_label& image);
     virtual void draw(void);
 };
 
 
-class lat_label : public instr_item {
-private:
-    const char *pformat;
-    const char *pre_str;
-    const char *post_str;
-    fgLabelJust justify;
-    int         fontSize;
-    int         blink;
-    char format_buffer[80];
-
-public:
-    lat_label( int          x,
-               int          y,
-               UINT         width,
-               UINT         height,
-               FLTFNPTR     data_source,
-               const char  *label_format,
-               const char  *pre_label_string,
-               const char  *post_label_string,
-               float        scale_data,
-               UINT         options,
-               fgLabelJust  justification,
-               int          font_size,
-               int          blinking,
-               bool         working,
-               int          digits =0 );
-
-    ~lat_label();
-
-    lat_label( const lat_label & image);
-    virtual void draw( void );       // Required method in base class
-};
-
-
-class lon_label : public instr_item {
-private:
-    const char *pformat;
-    const char *pre_str;
-    const char *post_str;
-    fgLabelJust justify;
-    int         fontSize;
-    int         blink;
-    char format_buffer[80];
-
-public:
-    lon_label( int          x,
-               int          y,
-               UINT         width,
-               UINT         height,
-               FLTFNPTR     data_source,
-               const char  *label_format,
-               const char  *pre_label_string,
-               const char  *post_label_string,
-               float        scale_data,
-               UINT         options,
-               fgLabelJust  justification,
-               int          font_size,
-               int          blinking,
-               bool         working,
-               int          digit=0);
-
-
-    ~lon_label();
-
-    lon_label( const lon_label & image);
-    virtual void draw( void );       // Required method in base class
-};
-
-
 //
-// fgRunway_instr        This class is responsible for rendering the active runway
-//                        in the hud (if visible).
-class runway_instr : public instr_item
-{
+// fgRunway_instr   This class is responsible for rendering the active runway
+//                  in the hud (if visible).
+class runway_instr : public instr_item {
 private:
         void boundPoint(const sgdVec3& v, sgdVec3& m);
         bool boundOutsidePoints(sgdVec3& v, sgdVec3& m);
-        bool drawLine(const sgdVec3& a1, const sgdVec3& a2, const sgdVec3& p1, const sgdVec3& p2);
+        bool drawLine(const sgdVec3& a1, const sgdVec3& a2,
+                const sgdVec3& p1, const sgdVec3& p2);
         void drawArrow();
-        bool get_active_runway(FGRunway& rwy);
+        FGRunway* get_active_runway();
         void get_rwy_points(sgdVec3 *points);
         void setLineWidth(void);
 
-        sgdVec3 points3d[6],points2d[6];
-        double mm[16],pm[16], arrowScale, arrowRad, lnScale, scaleDist, default_pitch, default_heading;
+        sgdVec3 points3d[6], points2d[6];
+        double mm[16],pm[16], arrowScale, arrowRad, lnScale;
+        double scaleDist, default_pitch, default_heading;
         GLint view[4];
-        FGRunway runway;
+        FGRunway* runway;
         FGViewer* cockpit_view;
-        unsigned short stippleOut,stippleCen;
-        bool drawIA,drawIAAlways;
+        unsigned short stippleOut, stippleCen;
+        bool drawIA, drawIAAlways;
         RECT location;
         POINT center;
 
 public:
-    runway_instr( int    x,
-                  int    y,
-                  int    width,
-                  int    height,
-                  float  scale_data,
-                  bool   working = true);
-
-    virtual void draw( void );       // Required method in base class
-        void setArrowRotationRadius(double radius);
-        void setArrowScale(double scale); // Scales the runway indication arrow
-        void setDrawArrow(bool draw);         // Draws arrow when runway is not visible in HUD if draw=true
-        void setDrawArrowAlways(bool draw); //Always draws arrow if draw=true;
-        void setLineScale(double scale); //Sets the maximum line scale
-        void setScaleDist(double dist_nm); //Sets the distance where to start scaling the lines
-        void setStippleOutline(unsigned short stipple); //Sets the stipple pattern of the outline of the runway
-        void setStippleCenterline(unsigned short stipple); //Sets the stipple patter of the center line of the runway
+    runway_instr(const SGPropertyNode *);
+
+    virtual void draw( void );
+    void setArrowRotationRadius(double radius);
+    // Scales the runway indication arrow
+    void setArrowScale(double scale);
+    // Draws arrow when runway is not visible in HUD if draw=true
+    void setDrawArrow(bool draw);
+    // Always draws arrow if draw=true;
+    void setDrawArrowAlways(bool draw);
+    // Sets the maximum line scale
+    void setLineScale(double scale);
+    // Sets the distance where to start scaling the lines
+    void setScaleDist(double dist_nm);
+    // Sets the stipple pattern of the outline of the runway
+    void setStippleOutline(unsigned short stipple);
+    // Sets the stipple patter of the center line of the runway
+    void setStippleCenterline(unsigned short stipple);
 };
 
 
@@ -701,20 +538,17 @@ public:
                  int          dp_showing,
                  bool         working = true);
 
-    virtual ~instr_scale();
-    instr_scale( const instr_scale & image);
-
-    virtual void draw   ( void ) {}; // No-op here. Defined in derived classes.
-    UINT   div_min      ( void ) { return Min_div;}
-    UINT   div_max      ( void ) { return Maj_div;}
-    float min_val       ( void ) { return Minimum_value;}
-    float max_val       ( void ) { return Maximum_value;}
-    UINT   modulo       ( void ) { return Modulo; }
-    float factor        ( void ) { return scale_factor;}
-    float range_to_show ( void ) { return range_shown;}
+    virtual void draw    ( void ) {}; // No-op here. Defined in derived classes.
+    UINT   div_min       ( void ) { return Min_div;}
+    UINT   div_max       ( void ) { return Maj_div;}
+    float  min_val       ( void ) { return Minimum_value;}
+    float  max_val       ( void ) { return Maximum_value;}
+    UINT   modulo        ( void ) { return Modulo; }
+    float  factor        ( void ) { return scale_factor;}
+    float  range_to_show ( void ) { return range_shown;}
 };
 
-// hud_card_               This class displays the indicated quantity on
+// hud_card                This class displays the indicated quantity on
 //                         a scale that moves past the pointer. It may be
 // horizontal or vertical, read above(left) or below(right) of the base
 // line.
@@ -745,72 +579,19 @@ private:
     UINT   Maj_div;
     UINT   Min_div;
 
-
 public:
-    hud_card( int      x,
-              int      y,
-              UINT     width,
-              UINT     height,
-              FLTFNPTR load_fn,
-              UINT     options,
-              float    maxValue,
-              float    minValue,
-              float    disp_scaling,
-              UINT     major_divs,
-              UINT     minor_divs,
-              UINT     modulator,
-              int      dp_showing,
-              float    value_span,
-              string   type,
-              bool     draw_tick_bottom,
-              bool     draw_tick_top,
-              bool     draw_tick_right,
-              bool     draw_tick_left,
-              bool     draw_cap_bottom,
-              bool     draw_cap_top,
-              bool     draw_cap_right,
-              bool     draw_cap_left,
-              float    marker_offset,
-              bool     pointer,
-              string   pointer_type,
-              string  tick_type,
-              string  tick_length,
-              bool     working,
-              float    radius,
-              int      divisions,
-              int      zoom
-            );
-
-
-    ~hud_card();
-    hud_card( const hud_card & image);
-    //    virtual void display_enable( bool setting );
-    virtual void draw( void );       // Required method in base class
-    void circles(float,float,float);
-    void fixed(float,float,float,float,float,float);
-    void zoomed_scale(int,int);
+    hud_card(const SGPropertyNode *);
+    //    virtual void display_enable( bool setting );                 // FIXME
+    virtual void draw(void);
+    void circles(float, float, float);
+    void fixed(float, float, float, float, float, float);
+    void zoomed_scale(int, int);
 };
 
 
 class gauge_instr : public instr_scale {
 public:
-    gauge_instr( int       x,
-                 int       y,
-                 UINT      width,
-                 UINT      height,
-                 FLTFNPTR  load_fn,
-                 UINT      options,
-                 float     disp_scaling,
-                 float     maxValue,
-                 float     minValue,
-                 UINT      major_divs,
-                 UINT      minor_divs,
-                 int       dp_showing,
-                 UINT      modulus,
-                 bool      working);
-
-    ~gauge_instr();
-    gauge_instr( const gauge_instr & image);
+    gauge_instr(const SGPropertyNode *);
     virtual void draw( void );       // Required method in base class
 };
 
@@ -833,16 +614,13 @@ public:
                       bool      working,
                       UINT      options );
 
-    virtual ~dual_instr_item() {};
-    dual_instr_item( const dual_instr_item & image);
-
-    float current_ch1( void ) { return (float)alt_data_source();}
-    float current_ch2( void ) { return (float)get_value();}
-    virtual void draw( void ) { }
+    float current_ch1( void ) { return (float)alt_data_source(); }
+    float current_ch2( void ) { return (float)get_value(); }
+    virtual void draw( void ) {}
 };
 
-class fgTBI_instr : public dual_instr_item
-{
+
+class fgTBI_instr : public dual_instr_item {
 private:
     UINT BankLimit;
     UINT SlewLimit;
@@ -851,27 +629,12 @@ private:
     float rad;
 
 public:
-    fgTBI_instr( int       x,
-                 int       y,
-                 UINT      width,
-                 UINT      height,
-                 FLTFNPTR  chn1_source,
-                 FLTFNPTR  chn2_source,
-                 float     maxBankAngle,
-                 float     maxSlipAngle,
-                 UINT      gap_width,
-                 bool      working,
-                 bool      tsi,
-                 float     rad);
-
-    fgTBI_instr( const fgTBI_instr & image);
-
-    ~fgTBI_instr();
-
-    UINT bank_limit( void ) { return BankLimit;}
-    UINT slew_limit( void ) { return SlewLimit;}
+    fgTBI_instr(const SGPropertyNode *);
 
-    virtual void draw( void );       // Required method in base class
+    UINT bank_limit(void) { return BankLimit; }
+    UINT slew_limit(void) { return SlewLimit; }
+
+    virtual void draw(void);
 };
 
 
@@ -908,7 +671,6 @@ private:
 
 public:
     HudLadder(const SGPropertyNode *);
-    ~HudLadder();
 
     virtual void draw(void);
     void drawZenith(float, float, float);
@@ -931,27 +693,12 @@ public:
 };
 
 
-//using namespace std;
-//deque <instr_item>  * Hdeque_ptr;
-
-extern int  fgHUDInit( fgAIRCRAFT * /* current_aircraft */ );
-extern int  fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ );
-extern void fgUpdateHUD( void );
-extern void fgUpdateHUD( GLfloat x_start, GLfloat y_start,
+extern int  fgHUDInit();
+extern int  fgHUDInit2();
+extern void fgUpdateHUD( osg::State* );
+extern void fgUpdateHUD( osg::State*, GLfloat x_start, GLfloat y_start,
                          GLfloat x_end, GLfloat y_end );
 
-/*
-bool AddHUDInstrument( instr_item *pBlackBox );
-void DrawHUD ( void );
-bool DamageInstrument( INSTR_HANDLE unit );
-bool RepairInstrument( INSTR_HANDLE unit );
-
-
-void fgUpdateHUD ( Hptr hud );
-void fgUpdateHUD2( Hptr hud ); // Future use?
-void fgHUDSetTimeMode( Hptr hud, int time_of_day );
-*/
-
 
 
 
@@ -980,4 +727,4 @@ private:
     float _r, _g, _b, _a, _cl;
 };
 
-#endif // _HUD_H
+#endif // _OLDHUD_H