]> git.mxchange.org Git - flightgear.git/commitdiff
indentation, trailing spaces, ... (cosmetics only); doesn't make
authormfranz <mfranz>
Wed, 14 Jun 2006 10:30:10 +0000 (10:30 +0000)
committermfranz <mfranz>
Wed, 14 Jun 2006 10:30:10 +0000 (10:30 +0000)
the coding style fully consistent yet, but it's good enough for code changes
(mixed tab/space indents, 4 space tabs etc. are a royal pain)

16 files changed:
src/Cockpit/cockpit.cxx
src/Cockpit/hud.cxx
src/Cockpit/hud.hxx
src/Cockpit/hud_card.cxx
src/Cockpit/hud_dnst.cxx
src/Cockpit/hud_gaug.cxx
src/Cockpit/hud_inst.cxx
src/Cockpit/hud_labl.cxx
src/Cockpit/hud_lat.cxx
src/Cockpit/hud_lon.cxx
src/Cockpit/hud_rwy.cxx
src/Cockpit/hud_scal.cxx
src/Cockpit/hud_tbi.cxx
src/Cockpit/panel.cxx
src/Cockpit/panel.hxx
src/Cockpit/panel_io.cxx

index 4957e3a9b0b0182deab59508f073d469fb9e88ce..5aa7f82411e98539ad3b83f9ae315a6f84857a4d 100644 (file)
@@ -25,7 +25,7 @@
 #  include <config.h>
 #endif
 
-#ifdef HAVE_WINDOWS_H          
+#ifdef HAVE_WINDOWS_H
 #  include <windows.h>
 #endif
 
@@ -77,7 +77,7 @@ float get_lat_min( void )
 {
     double a, d;
 
-    a = current_aircraft.fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES;    
+    a = current_aircraft.fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES;
     if (a < 0.0) {
         a = -a;
     }
@@ -99,7 +99,7 @@ get_formated_gmt_time( void )
 {
     static char buf[32];
     const struct tm *p = globals->get_time_params()->getGmt();
-    sprintf( buf, "%d/%d/%4d %d:%02d:%02d", 
+    sprintf( buf, "%d/%d/%4d %d:%02d:%02d",
          p->tm_mon+1, p->tm_mday, 1900 + p->tm_year,
          p->tm_hour, p->tm_min, p->tm_sec);
 
@@ -110,12 +110,12 @@ get_formated_gmt_time( void )
 float get_long_min( void )
 {
     double  a, d;
-    a = current_aircraft.fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES;   
+    a = current_aircraft.fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES;
     if (a < 0.0) {
         a = -a;
     }
     d = (double) ( (int) a);
-    float lon_min = (a - d) * 60.0; 
+    float lon_min = (a - d) * 60.0;
 
     return lon_min;
 }
@@ -151,7 +151,7 @@ float get_speed( void )
     static const SGPropertyNode * speedup_node = fgGetNode("/sim/speed-up");
 
     float speed = current_aircraft.fdm_state->get_V_calibrated_kts()
-       * speedup_node->getIntValue();
+        * speedup_node->getIntValue();
 
     return speed;
 }
@@ -159,7 +159,7 @@ float get_speed( void )
 float get_mach(void)
 {
     return current_aircraft.fdm_state->get_Mach_number();
-}      
+}
 
 float get_aoa( void )
 {
@@ -228,7 +228,7 @@ float get_frame_rate( void )
 
 float get_fov( void )
 {
-    return globals->get_current_view()->get_fov(); 
+    return globals->get_current_view()->get_fov();
 }
 
 float get_vfc_ratio( void )
@@ -272,13 +272,13 @@ float get_view_direction( void )
 {
     double view_off = SGD_2PI - globals->get_current_view()->getHeadingOffset_deg() * SGD_DEGREES_TO_RADIANS;
     double view = ( current_aircraft.fdm_state->get_Psi() + view_off)
-       * SGD_RADIANS_TO_DEGREES;
-    
-    if(view > 360.)
+        * SGD_RADIANS_TO_DEGREES;
+
+    if (view > 360.)
         view -= 360.;
-    else if(view<0.)
+    else if (view<0.)
         view += 360.;
-    
+
     return view;
 }
 
@@ -531,11 +531,11 @@ float get_aux18 (void)
 /****************************************************************************/
 char *dmshh_format(double degrees)
 {
-    static char buf[16];    
+    static char buf[16];
     int deg_part;
     int min_part;
     double sec_part;
-    
+
     if (degrees < 0)
       degrees = -degrees;
 
@@ -573,9 +573,9 @@ static char *toDM(float dd)
     double sign = 1;
     int deg;
 
-    if (dd < 0) {
-       sign = -1;
-    }
+    if (dd < 0)
+        sign = -1;
+
     /* round for minutes expressed to three decimal places */
     tempdd = fabs(dd) + (5.0E-4 / 60.0);
     deg = (int)tempdd;
@@ -604,9 +604,9 @@ static char *toDMS(float dd)
     double sec;
     double sign = 1;
 
-    if(dd < 0) {
-       sign = -1;
-    }
+    if (dd < 0)
+        sign = -1;
+
     /* round up for seconds expressed to one decimal place */
     tempdd = fabs(dd) + (0.05 / 3600.0);
     deg = (int)tempdd;
@@ -631,7 +631,7 @@ char *coord_format_lat(float latitude)
 //      dmshh_format(latitude),
 //      toDMS(latitude),
 //      toDM(latitude),
-        fgLatLonFormat(latitude),           
+        fgLatLonFormat(latitude),
         latitude > 0 ? 'N' : 'S');
     return buf;
 }
@@ -653,11 +653,11 @@ void fgLatLonFormatToggle( puObject *)
 {
     static int toggle = 0;
 
-    if ( toggle ) 
+    if ( toggle )
         fgLatLonFormat = toDM;
     else
         fgLatLonFormat = toDMS;
-    
+
     toggle = ~toggle;
 }
 
@@ -685,30 +685,30 @@ bool fgCockpitInit( fgAIRCRAFT *cur_aircraft )
 
     // If aircraft has HUD specified we will get the specs from its def
     // file. For now we will depend upon hard coding in hud?
-    
+
     // We must insure that the existing instrument link is purged.
     // This is done by deleting the links in the list.
-    
+
     // HI_Head is now a null pointer so we can generate a new list from the
     // current aircraft.
 
     fgHUDInit( cur_aircraft );
     ac_cockpit = new fg_Cockpit();
-    
+
     // Have to set the LatLon display type
     fgLatLonFormat = toDM;
-    
+
     SG_LOG( SG_COCKPIT, SG_INFO,
-        "  Code " << ac_cockpit->code() << " Status " 
+        "  Code " << ac_cockpit->code() << " Status "
         << ac_cockpit->status() );
 
-       return true;
+    return true;
 }
 
 void fgCockpitUpdate( void ) {
 
     SG_LOG( SG_COCKPIT, SG_DEBUG,
-            "Cockpit: code " << ac_cockpit->code() << " status " 
+            "Cockpit: code " << ac_cockpit->code() << " status "
             << ac_cockpit->status() );
 
     static const SGPropertyNode * xsize_node = fgGetNode("/sim/startup/xsize");
@@ -719,7 +719,7 @@ void fgCockpitUpdate( void ) {
     int iwidth   = xsize_node->getIntValue();
     int iheight  = ysize_node->getIntValue();
 
-                               // FIXME: inefficient
+                                // FIXME: inefficient
     if ( hud_visibility_node->getBoolValue() ) {
         // This will check the global hud linked list pointer.
         // If there is anything to draw it will.
index 5962b075e6fb5d0030c90c9afaa202f5a2d62b23..fa795c535a5134d18fe2b75de7914fb30564b311 100644 (file)
@@ -41,8 +41,8 @@
 #include <math.h>
 
 #include <stdlib.h>
-#include <stdio.h>             // char related functions
-#include <string.h>            // strcmp()
+#include <stdio.h>              // char related functions
+#include <string.h>             // strcmp()
 
 #include SG_GLU_H
 
@@ -140,18 +140,18 @@ static bool    glide;
 static float   glide_slope_val;
 static bool    worm_energy;
 static bool    waypoint;
-static string  type_tick;//hud
-static string  length_tick;//hud
-static bool    label_box;//hud
-static int     digits; //suma
-static float   radius; //suma
-static int     divisions; //suma
-static int     zoom; //suma
-static int     zenith; //suma
-static int     nadir ; //suma
-static int     hat; //suma
-static bool    tsi; //suma
-static float   rad; //suma
+static string  type_tick;
+static string  length_tick;
+static bool    label_box;
+static int     digits;
+static float   radius;
+static int     divisions;
+static int     zoom;
+static int     zenith;
+static int     nadir ;
+static int     hat;
+static bool    tsi;
+static float   rad;
 
 
 static FLTFNPTR load_fn;
@@ -229,16 +229,14 @@ readLadder(const SGPropertyNode * node)
     worm_energy        = node->getBoolValue("enable_energy_marker",false);
     waypoint           = node->getBoolValue("enable_waypoint_marker",false);
     working            = node->getBoolValue("working");
-    zenith             = node->getIntValue("zenith");  //suma
-    nadir              = node->getIntValue("nadir");  //suma
+    zenith             = node->getIntValue("zenith");
+    nadir              = node->getIntValue("nadir");
     hat                = node->getIntValue("hat");
     // The factor assumes a base of 55 degrees per 640 pixels.
     // Invert to convert the "compression" factor to a
     // pixels-per-degree number.
-    if(fgGetBool("/sim/hud/enable3d", true))
-    {
-        if (HUD_style == 1)
-        {
+    if (fgGetBool("/sim/hud/enable3d", true)) {
+        if (HUD_style == 1) {
             factor = 1;
             factor = (640./55.) / factor;
         }
@@ -291,17 +289,17 @@ readCard(const SGPropertyNode * node)
     marker_off         = node->getFloatValue("marker_offset",0.0);
     enable_pointer     = node->getBoolValue("enable_pointer",true);
     type_pointer       = node->getStringValue("pointer_type");
-    type_tick          = node->getStringValue("tick_type");//hud Can be 'circle' or 'line'
-    length_tick        = node->getStringValue("tick_length");//hud For variable length
+    type_tick          = node->getStringValue("tick_type"); // 'circle' or 'line'
+    length_tick        = node->getStringValue("tick_length"); // for variable length
     working            = node->getBoolValue("working");
-    radius             = node->getFloatValue("radius"); //suma
-    divisions          = node->getIntValue("divisions"); //suma
-    zoom               = node->getIntValue("zoom"); //suma
+    radius             = node->getFloatValue("radius");
+    divisions          = node->getIntValue("divisions");
+    zoom               = node->getIntValue("zoom");
 
     SG_LOG(SG_INPUT, SG_INFO, "Done reading instrument " << name);
 
 
-    if(type=="gauge") {
+    if (type=="gauge") {
         span_units = maxValue - minValue;
     }
 
@@ -359,12 +357,12 @@ readCard(const SGPropertyNode * node)
                                          marker_off,
                                          enable_pointer,
                                          type_pointer,
-                                         type_tick,//hud
-                                         length_tick,//hud
+                                         type_tick,
+                                         length_tick,
                                          working,
-                                         radius, //suma
-                                         divisions, //suma
-                                         zoom  //suma
+                                         radius,
+                                         divisions,
+                                         zoom
                                          );
     } else {
         p = (instr_item *) new  gauge_instr( x,       // x
@@ -406,9 +404,9 @@ readLabel(const SGPropertyNode * node)
     blinking           = node->getIntValue("blinking");
     latitude           = node->getBoolValue("latitude",false);
     longitude          = node->getBoolValue("longitude",false);
-    label_box          = node->getBoolValue("label_box",false);//hud
+    label_box          = node->getBoolValue("label_box",false);
     working            = node->getBoolValue("working");
-    digits             = node->getIntValue("digits"); //suma
+    digits             = node->getIntValue("digits");
 
 
     SG_LOG(SG_INPUT, SG_INFO, "Done reading instrument " << name);
@@ -536,9 +534,9 @@ readLabel(const SGPropertyNode * node)
                                          blinking,
                                          latitude,
                                          longitude,
-                                         label_box, //hud
+                                         label_box,
                                          working,
-                                         digits); //suma
+                                         digits);
 
     return p;
 } // end readLabel
@@ -558,8 +556,8 @@ readTBI(const SGPropertyNode * node)
     maxSlipAngle   = node->getFloatValue("maxSlipAngle");
     gap_width      = node->getIntValue("gap_width");
     working        = node->getBoolValue("working");
-    tsi            = node->getBoolValue("tsi"); //suma
-    rad            = node->getFloatValue("rad"); //suma
+    tsi            = node->getBoolValue("tsi");
+    rad            = node->getFloatValue("rad");
 
     SG_LOG(SG_INPUT, SG_INFO, "Done reading instrument " << name);
 
@@ -574,8 +572,8 @@ readTBI(const SGPropertyNode * node)
                                         maxSlipAngle,
                                         gap_width,
                                         working,
-                                        tsi, //suma
-                                        rad); //suma
+                                        tsi,
+                                        rad);
 
     return p;
 } //end readTBI
@@ -838,7 +836,7 @@ void fgHUDReshape(void) {
 void fgUpdateHUD( void ) {
 
     static const SGPropertyNode *enable3d_node = fgGetNode("/sim/hud/enable3d");
-    if( HUD_style == 1 && enable3d_node->getBoolValue() ) {
+    if ( HUD_style == 1 && enable3d_node->getBoolValue() ) {
         fgUpdateHUDVirtual();
         return;
     }
@@ -846,7 +844,7 @@ void fgUpdateHUD( void ) {
     static const float normal_aspect = float(640) / float(480);
     // note: aspect_ratio is Y/X
     float current_aspect = 1.0f/globals->get_current_view()->get_aspect_ratio();
-    if( current_aspect > normal_aspect ) {
+    if ( current_aspect > normal_aspect ) {
         float aspect_adjust = current_aspect / normal_aspect;
         float adjust = 320.0f*aspect_adjust - 320.0f;
         fgUpdateHUD( -adjust, 0.0f, 640.0f+adjust, 480.0f );
@@ -877,7 +875,8 @@ void fgUpdateHUDVirtual()
     lookat[0] = -sin(SG_DEGREES_TO_RADIANS * view->getHeadingOffset_deg());
     lookat[1] = tan(SG_DEGREES_TO_RADIANS * view->getPitchOffset_deg());
     lookat[2] = -cos(SG_DEGREES_TO_RADIANS * view->getHeadingOffset_deg());
-    if(fabs(lookat[1]) > 9999) lookat[1] = 9999; // FPU sanity
+    if (fabs(lookat[1]) > 9999)
+        lookat[1] = 9999; // FPU sanity
     gluLookAt(0, 0, 0, lookat[0], lookat[1], lookat[2], 0, 1, 0);
 
     // Map the -1:1 square to a 55.0x41.25 degree wide patch at z=1.
@@ -929,7 +928,7 @@ void fgUpdateHUD( GLfloat x_start, GLfloat y_start,
 
 void drawHUD()
 {
-    if( !HUD_deque.size() ) // Trust everyone, but ALWAYS cut the cards!
+    if ( !HUD_deque.size() ) // Trust everyone, but ALWAYS cut the cards!
         return;
 
     HUD_TextList.erase();
index 27c505c52734bf998d946f860a1c550956955784..7765c4648734d2ec04ee530524f413555dfa8a33 100644 (file)
@@ -266,18 +266,18 @@ private:
     float x, y;
     char msg[64];
 public:
-    int digit; //suma
-    fgText(float x = 0, float y = 0, char *c = NULL,int digits=0): x(x), y(y) //suma
+    int digit;
+    fgText(float x = 0, float y = 0, char *c = NULL,int digits=0): x(x), y(y)
     {
         strcpy(msg,c);
-        digit=digits; //suma
+        digit=digits;
     }
 
     fgText( const fgText & image )
-        : x(image.x), y(image.y),digit(image.digit) { strcpy(msg,image.msg); } //suma
+        : 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; //suma
+        strcpy(msg,image.msg); x = image.x; y = image.y;digit=image.digit;
         return *this;
     }
 
@@ -305,26 +305,26 @@ public:
 
     // this code is changed to display Numbers with big/small digits
     // according to MIL Standards for example Altitude above 10000 ft
-    // is shown as 10ooo.  begin suma
+    // is shown as 10ooo.
 
     void Draw(fntRenderer *fnt,int digits) {
-        if(digits==1) {
+        if (digits==1) {
             int c=0,i=0;
             char *t=msg;
             int p=4;
 
-            if(t[0]=='-') {
+            if (t[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'))
+            while (tmp[i]!='\0') {
+                if ((tmp[i]>='0') && (tmp[i]<='9'))
                     c++;
                 i++;
             }
-            if(c>p) {
+            if (c>p) {
                 fnt->setPointSize(HUD_TextSize * 0.8);
                 int p1=c-3;
                 char *tmp1=msg+p1;
@@ -352,7 +352,6 @@ public:
             fnt->puts( msg ) ;
         }
     }
-    //end suma
 
     void Draw()
     {
@@ -426,7 +425,7 @@ private:
     bool               broken;
     UINT               scr_span;      // Working values for draw;
     POINT              mid_span;      //
-    int                digits;        //suma
+    int                digits;
 
 public:
     instr_item( int            x,
@@ -437,7 +436,7 @@ public:
                 float          data_scaling,
                 UINT           options,
                 bool           working  = true,
-                int            digit = 0); //suma
+                int            digit = 0);
 
     instr_item( const instr_item & image );
 
@@ -453,7 +452,7 @@ public:
     UINT    get_span        ( void ) { return scr_span;  }
     POINT   get_centroid    ( void ) { return mid_span;  }
     UINT    get_options     ( void ) { return opts;      }
-    int     get_digits      ( void ) { return digits;         } //suma
+    int     get_digits      ( void ) { return digits;         }
 
     UINT    huds_vert     (UINT options) { return( options  & HUDS_VERT ); }
     UINT    huds_left     (UINT options) { return( options  & HUDS_LEFT ); }
@@ -483,9 +482,9 @@ public:
     {
         HUD_StippleLineList.add(fgLineSeg2D(x1,y1,x2,y2));
     }
-    void TextString( char *msg, float x, float y,int digit ) //suma
+    void TextString( char *msg, float x, float y,int digit )
     {
-        HUD_TextList.add(fgText(x, y, msg,digit)); //suma
+        HUD_TextList.add(fgText(x, y, msg,digit));
     }
     int getStringWidth ( char *str )
     {
@@ -501,7 +500,7 @@ public:
     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++) {
+        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);
@@ -516,7 +515,7 @@ typedef instr_item *HIptr;
 class HUDdraw {
     public:
         void operator() (HIptr elem) const {
-            if( elem->enabled())
+            if ( elem->enabled())
                 elem->draw();
         }
 };
@@ -565,7 +564,7 @@ public:
                  bool         longitude,
                  bool         label_box,
                  bool         working,
-                 int          digit ); //suma);
+                 int          digit );
 
     ~instr_label();
 
@@ -601,7 +600,7 @@ public:
                int          font_size,
                int          blinking,
                bool         working,
-               int          digits =0 );//suma
+               int          digits =0 );
 
     ~lat_label();
 
@@ -636,7 +635,7 @@ public:
                int          font_size,
                int          blinking,
                bool         working,
-               int          digit=0); //suma
+               int          digit=0);
 
 
     ~lon_label();
@@ -761,13 +760,13 @@ private:
     string pointer_type;
     string tick_type;
     string tick_length;
-    float  radius; //suma
-    float  maxValue; //suma
-    float  minValue; //suma
-    int    divisions; //suma
-    int    zoom; //suma
-    UINT   Maj_div; //suma
-    UINT   Min_div; //suma
+    float  radius;
+    float  maxValue;
+    float  minValue;
+    int    divisions;
+    int    zoom;
+    UINT   Maj_div;
+    UINT   Min_div;
 
 
 public:
@@ -800,9 +799,9 @@ public:
               string  tick_type,
               string  tick_length,
               bool     working,
-              float    radius, //suma
-              int      divisions, //suma
-              int      zoom //suma
+              float    radius,
+              int      divisions,
+              int      zoom
             );
 
 
@@ -810,9 +809,9 @@ public:
     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); // suma
-    void fixed(float,float,float,float,float,float); //suma
-    void zoomed_scale(int,int); //suma
+    void circles(float,float,float);
+    void fixed(float,float,float,float,float,float);
+    void zoomed_scale(int,int);
 };
 
 typedef hud_card * pCardScale;
@@ -872,8 +871,8 @@ private:
     UINT BankLimit;
     UINT SlewLimit;
     UINT scr_hole;
-    bool tsi;  //suma
-    float rad; //suma
+    bool tsi;
+    float rad;
 
 public:
     fgTBI_instr( int       x,
@@ -886,8 +885,8 @@ public:
                  float     maxSlipAngle,
                  UINT      gap_width,
                  bool      working,
-                 bool      tsi, //suma
-                 float     rad); //suma
+                 bool      tsi,
+                 float     rad);
 
     fgTBI_instr( const fgTBI_instr & image);
 
@@ -923,9 +922,9 @@ private:
     float  glide_slope;
     bool   energy_worm;
     bool   waypoint_marker;
-    int    zenith; //suma
-    int    nadir; //suma
-    int    hat; //suma
+    int    zenith;
+    int    nadir;
+    int    hat;
 
 
     // The Ladder has it's own temporary display lists
@@ -959,18 +958,18 @@ public:
                bool      energy_worm,
                bool      waypoint_marker,
                bool      working,
-               int       zenith, //suma
-               int       nadir, //suma
+               int       zenith,
+               int       nadir,
                int       hat
-             ); //suma
+             );
 
 
     ~HudLadder();
 
     HudLadder( const HudLadder & image );
     virtual void draw( void );
-    void drawZenith(float,float,float); //suma
-    void drawNadir(float, float, float); //suma
+    void drawZenith(float,float,float);
+    void drawNadir(float, float, float);
 
     void Text( float x, float y, char *s)
     {
index 6bbe1d634384bbe16a41475b724870e4084e66dd..78dcbc5c73ac75f8ea0e2ce0d4c4d4bb62ddbe03 100644 (file)
@@ -45,8 +45,8 @@ hud_card::hud_card(
           float     mark_offset,
           bool      pointer_enable,
           string    type_pointer,
-          string    type_tick,//hud
-          string    length_tick,//hud
+          string    type_tick,
+          string    length_tick,
           bool      working,
           float     rad,
           int       divs,
@@ -70,8 +70,8 @@ hud_card::hud_card(
     marker_offset    (mark_offset),
     pointer          (pointer_enable),
     pointer_type     (type_pointer),
-    tick_type        (type_tick), //hud
-    tick_length      (length_tick), //hud
+    tick_type        (type_tick),
+    tick_length      (length_tick),
     Maj_div          (major_divs),
     Min_div          (minor_divs)
 
@@ -113,8 +113,8 @@ hud_card::hud_card(const hud_card & image) :
     marker_offset (image.marker_offset),
     pointer (image.pointer),
     pointer_type (image.pointer_type),
-    tick_type(image.tick_type), //hud
-    tick_length(image.tick_length), //hud
+    tick_type(image.tick_type),
+    tick_length(image.tick_length),
     Maj_div(image.Maj_div),
     Min_div(image.Min_div)
 
index 49f23e79b66e901080e35bb46cec30768c9126ae..b1adb4fb3cdcc9d37ff5e1fec17e43e549954f5a 100644 (file)
@@ -4,25 +4,25 @@
 
 //============ Top of dual_instr_item class member definitions ============
 
-dual_instr_item ::
-  dual_instr_item ( int          x,
-                    int          y,
-                    UINT         width,
-                    UINT         height,
-                    FLTFNPTR     chn1_source,
-                    FLTFNPTR     chn2_source,
-                    bool         working,
-                    UINT         options ):
-                  instr_item( x, y, width, height,
-                              chn1_source, options, working),
-                  alt_data_source( chn2_source )
+dual_instr_item::dual_instr_item(
+        int          x,
+        int          y,
+        UINT         width,
+        UINT         height,
+        FLTFNPTR     chn1_source,
+        FLTFNPTR     chn2_source,
+        bool         working,
+        UINT         options ) :
+    instr_item( x, y, width, height,
+                chn1_source, options, working),
+                alt_data_source( chn2_source )
 {
 }
 
-dual_instr_item ::
-  dual_instr_item( const dual_instr_item & image) :
-                 instr_item ((instr_item &) image ),
-                 alt_data_source( image.alt_data_source)
+
+dual_instr_item::dual_instr_item( const dual_instr_item & image) :
+    instr_item ((instr_item &) image ),
+    alt_data_source( image.alt_data_source)
 {
 }
 
index e064c18b94caca53f94ab0ebfb25d5a91b0f38e0..66b5628effc48be35794623f99e67a0b68fb250b 100644 (file)
@@ -3,28 +3,28 @@
 
 
 #ifdef USE_HUD_TextList
-#define textString( x , y, text, digit )  TextString( text, x , y,digit )
+#define textString(x, y, text, digit)  TextString(text, x , y ,digit)
 #else
-#define textString( x , y, text, digit )  puDrawString ( guiFnt, text, x, y )
+#define textString(x, y, text, digit)  puDrawString(guiFnt, text, x, y)
 #endif
 
 //============== Top of gauge_instr class member definitions ==============
 
 gauge_instr::gauge_instr(
-             int      x,
-             int      y,
-             UINT     width,
-             UINT     height,
-             FLTFNPTR load_fn,
-             UINT     options,
-             float    disp_scale,
-             float    maxValue,
-             float    minValue,
-             UINT     major_divs,
-             UINT     minor_divs,
-             int      dp_showing,
-             UINT     modulus,
-             bool     working) :
+        int      x,
+        int      y,
+        UINT     width,
+        UINT     height,
+        FLTFNPTR load_fn,
+        UINT     options,
+        float    disp_scale,
+        float    maxValue,
+        float    minValue,
+        UINT     major_divs,
+        UINT     minor_divs,
+        int      dp_showing,
+        UINT     modulus,
+        bool     working) :
     instr_scale( x, y, width, height,
                  load_fn, options,
                  (maxValue - minValue), // Always shows span?
@@ -320,7 +320,7 @@ void gauge_instr::draw (void)
                     if ( !(i%(int)div_max()) ) {
                         if (modulo()) {
                             if ( disp_val < 0) {
-                                while( disp_val < 0 ) {
+                                while ( disp_val < 0 ) {
                                     disp_val += modulo();
                                 }
                             }
index cee672247c4e70831f1557c2138f39899273ac85..ec056c5e3d5b73c916a964f1fc6ff71f8162d321 100644 (file)
@@ -8,79 +8,78 @@ int  instr_item :: brightness = 5;/*HUD_BRT_MEDIUM*/
 glRGBTRIPLE instr_item :: color = {0.0, 1.0, 0.0};
 
 // constructor    ( No default provided )
-instr_item  ::
-   instr_item( int              x,
-               int              y,
-               UINT             width,
-               UINT             height,
-               FLTFNPTR         data_source,
-               float           data_scaling,
-               UINT             options,
-               bool             working,
-                          int                          digit) : //suma
-                      handle         ( ++instances  ),
-                      load_value_fn  ( data_source  ),
-                      disp_factor    ( data_scaling ),
-                      opts           ( options      ),
-                      is_enabled     ( working      ),
-                      broken         ( FALSE        ),
-                      digits            ( digit                ) //suma
+instr_item::instr_item(
+        int       x,
+        int       y,
+        UINT      width,
+        UINT      height,
+        FLTFNPTR  data_source,
+        float     data_scaling,
+        UINT      options,
+        bool      working,
+        int       digit) :
+    handle         ( ++instances  ),
+    load_value_fn  ( data_source  ),
+    disp_factor    ( data_scaling ),
+    opts           ( options      ),
+    is_enabled     ( working      ),
+    broken         ( FALSE        ),
+    digits         ( digit        )
 {
-  scrn_pos.left   = x;
-  scrn_pos.top    = y;
-  scrn_pos.right  = width;
-  scrn_pos.bottom = height;
-
-         // Set up convenience values for centroid of the box and
-         // the span values according to orientation
-
-  if( opts & HUDS_VERT) { // Vertical style
-         // Insure that the midpoint marker will fall exactly at the
-         // middle of the bar.
-    if( !(scrn_pos.bottom % 2)) {
-      scrn_pos.bottom++;
-      }
-    scr_span = scrn_pos.bottom;
-    }
-  else {
-         // Insure that the midpoint marker will fall exactly at the
-         // middle of the bar.
-    if( !(scrn_pos.right % 2)) {
-      scrn_pos.right++;
-      }
-    scr_span = scrn_pos.right;
+    scrn_pos.left   = x;
+    scrn_pos.top    = y;
+    scrn_pos.right  = width;
+    scrn_pos.bottom = height;
+
+    // Set up convenience values for centroid of the box and
+    // the span values according to orientation
+
+    if (opts & HUDS_VERT) { // Vertical style
+        // Insure that the midpoint marker will fall exactly at the
+        // middle of the bar.
+        if (!(scrn_pos.bottom % 2))
+            scrn_pos.bottom++;
+
+        scr_span = scrn_pos.bottom;
+
+    } else {
+        // Insure that the midpoint marker will fall exactly at the
+        // middle of the bar.
+        if (!(scrn_pos.right % 2))
+            scrn_pos.right++;
+
+        scr_span = scrn_pos.right;
     }
-         // Here we work out the centroid for the corrected box.
-  mid_span.x = scrn_pos.left   + (scrn_pos.right  >> 1);
-  mid_span.y = scrn_pos.top + (scrn_pos.bottom >> 1);
+
+    // Here we work out the centroid for the corrected box.
+    mid_span.x = scrn_pos.left   + (scrn_pos.right  >> 1);
+    mid_span.y = scrn_pos.top + (scrn_pos.bottom >> 1);
 }
 
 
 // copy constructor
-instr_item  ::
-     instr_item ( const instr_item & image ):
-                         handle       ( ++instances        ),
-                         scrn_pos     ( image.scrn_pos     ),
-                         load_value_fn( image.load_value_fn),
-                         disp_factor  ( image.disp_factor  ),
-                         opts         ( image.opts         ),
-                         is_enabled   ( image.is_enabled   ),
-                         broken       ( image.broken       ),
-                         scr_span     ( image.scr_span     ),
-                         mid_span     ( image.mid_span     )
+instr_item::instr_item( const instr_item & image ) :
+    handle       ( ++instances        ),
+    scrn_pos     ( image.scrn_pos     ),
+    load_value_fn( image.load_value_fn),
+    disp_factor  ( image.disp_factor  ),
+    opts         ( image.opts         ),
+    is_enabled   ( image.is_enabled   ),
+    broken       ( image.broken       ),
+    scr_span     ( image.scr_span     ),
+    mid_span     ( image.mid_span     )
 {
 }
 
 
-instr_item :: ~instr_item ()
+instr_item::~instr_item ()
 {
-  if( instances ) {
-    instances--;
-    }
+    if (instances)
+        instances--;
 }
 
-void instr_item ::
-    update( void )
+
+void instr_item::update( void )
 {
 }
 
@@ -89,24 +88,25 @@ void instr_item ::
 // to simply not display, but more sophisticated behavior is available
 // by over riding the function which is virtual in this class.
 
-void instr_item ::
-    break_display ( bool bad )
+void instr_item::break_display ( bool bad )
 {
-  broken = !!bad;
-  is_enabled = FALSE;
+    broken = !!bad;
+    is_enabled = FALSE;
 }
 
-void instr_item ::
-    SetBrightness  ( int level  )
+
+void instr_item::SetBrightness ( int level  )
 {
-  brightness = level;   // This is all we will do for now. Later the
-                        // brightness levels will be sensitive both to
-                        // the control knob and the outside light levels
-                        // to emulated night vision effects.
+    brightness = level;   // This is all we will do for now. Later the
+                          // brightness levels will be sensitive both to
+                          // the control knob and the outside light levels
+                          // to emulated night vision effects.
 }
 
-UINT instr_item :: get_Handle( void )
+
+UINT instr_item::get_Handle( void )
 {
-  return handle;
+    return handle;
 }
 
+
index a20f024459164af3462f439d7c2b0243acac70d1..ecb693e5750de24cc1bed199517be9c22336b8b4 100644 (file)
@@ -3,92 +3,81 @@
 
 
 #ifdef USE_HUD_TextList
-#define textString( x , y, text, digit )  TextString( text, x , y,digit ) //suma
+#define textString(x, y, text, digit)  TextString(text, x , y ,digit)
 #else
-#define textString( x , y, text, digit )  puDrawString ( guiFnt, text, x, y ); //suma
+#define textString(x, y, text, digit)  puDrawString(guiFnt, text, x, y)
 #endif
 
 //======================= Top of instr_label class =========================
-instr_label ::
-         instr_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                      latitude,
-                                     bool                      longitude,
-                                         bool                  label_box,//hud
-                      bool          working,
-                                         int                   digit):  //suma
-                           instr_item( x, y, width, height,
-                                       data_source,scale_data,options, working, digit), //suma
-                           pformat  ( label_format      ),
-                           pre_str  ( pre_label_string  ),
-                           post_str ( post_label_string ),
-                           justify  ( justification     ),
-                           fontSize ( font_size         ),
-                           blink    ( blinking          ),
-                                                  lat          ( latitude                      ),
-                                                  lon          ( longitude                     ),
-                                                  lbox         ( label_box                     ) //hud
-
+instr_label::instr_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          latitude,
+        bool          longitude,
+        bool          label_box,
+        bool          working,
+        int           digit) :
+    instr_item( x, y, width, height,
+                data_source,scale_data,options, working, digit),
+    pformat  ( label_format      ),
+    pre_str  ( pre_label_string  ),
+    post_str ( post_label_string ),
+    justify  ( justification     ),
+    fontSize ( font_size         ),
+    blink    ( blinking          ),
+    lat      ( latitude          ),
+    lon      ( longitude         ),
+    lbox     ( label_box         )
 {
-  if( pre_str != NULL) {
-    if( post_str != NULL ) {
-      sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
-      }
-    else {
-      sprintf( format_buffer, "%s%s",   pre_str, pformat );
-      }
-    }
-  else {
-    if( post_str != NULL ) {
-      sprintf( format_buffer, "%s%s",   pformat, post_str );
-      }
+    if (pre_str != NULL) {
+        if (post_str != NULL )
+            sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
+        else
+            sprintf( format_buffer, "%s%s",   pre_str, pformat );
+
+    } else if (post_str != NULL) {
+            sprintf( format_buffer, "%s%s",   pformat, post_str );
     } // else do nothing if both pre and post strings are nulls. Interesting.
 
 }
 
-// I put this in to make it easy to construct a class member using the current
-// C code.
-
 
-instr_label :: ~instr_label()
+instr_label::~instr_label()
 {
 }
 
+
 // Copy constructor
-instr_label :: instr_label( const instr_label & image) :
-                              instr_item((const instr_item &)image),
-                              pformat    ( image.pformat    ),
-                              pre_str  ( image.pre_str  ),
-                              post_str ( image.post_str ),
-                              blink    ( image.blink    ),
-                                                         lat      ( image.lat          ),
-                                                         lon      ( image.lon          ),      
-                                                         lbox     (image.lbox          ) //hud
+instr_label::instr_label(const instr_label & image) :
+    instr_item((const instr_item &)image),
+    pformat    ( image.pformat  ),
+    pre_str    ( image.pre_str  ),
+    post_str   ( image.post_str ),
+    blink      ( image.blink    ),
+    lat        ( image.lat      ),
+    lon        ( image.lon      ),
+    lbox       ( image.lbox     )
 
 {
-  if( pre_str != NULL) {
-    if( post_str != NULL ) {
-      sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
-      }
-    else {
-      sprintf( format_buffer, "%s%s",   pre_str, pformat );
-      }
-    }
-  else {
-    if( post_str != NULL ) {
-      sprintf( format_buffer, "%s%s",   pformat, post_str );
-      }
+    if (pre_str != NULL) {
+        if (post_str != NULL)
+            sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
+        else
+            sprintf( format_buffer, "%s%s",   pre_str, pformat );
+
+    } else if (post_str != NULL) {
+            sprintf( format_buffer, "%s%s",   pformat, post_str );
     } // else do nothing if both pre and post strings are nulls. Interesting.
 
 }
@@ -98,85 +87,82 @@ instr_label :: instr_label( const instr_label & image) :
 // draw                    Draws a label anywhere in the HUD
 //
 //
-void instr_label ::
-draw( void )       // Required method in base class
+void instr_label::draw( void )
 {
-//  char format_buffer[80];
-  char label_buffer[80];
-  int posincr;
-  int lenstr;
-  RECT  scrn_rect = get_location();
-
-  if( data_available() ) {
-       if(lat)
-               sprintf( label_buffer, format_buffer, coord_format_lat(get_value()) );
-       else
-       if(lon)    
-               sprintf( label_buffer, format_buffer, coord_format_lon(get_value()) );
-       else
-       {       
-               if(lbox)//hud
-                       {// Box for label
-                               float x = scrn_rect.left;
-                               float y = scrn_rect.top;
-                               float w = scrn_rect.right;
-                       float h = HUD_TextSize;
-
-                               glPushMatrix();
-                               glLoadIdentity();
-                               glBegin(GL_LINES);
-                                       glVertex2f( x - 2.0,  y - 2.0);
-                                       glVertex2f( x + w + 2.0, y - 2.0);
-                                       glVertex2f( x + w + 2.0, y + h + 2.0);
-                                       glVertex2f( x - 2.0,  y + h + 2.0);
-                               glEnd();
-                       glEnable(GL_LINE_STIPPLE);
-                               glLineStipple( 1, 0xAAAA );
-                               glBegin(GL_LINES);
-                                       glVertex2f( x + w + 2.0, y - 2.0);
-                                       glVertex2f( x + w + 2.0, y + h + 2.0);
-                                       glVertex2f( x - 2.0,  y + h + 2.0);
-                                       glVertex2f( x - 2.0,  y - 2.0);
-                               glEnd();
-                       glDisable(GL_LINE_STIPPLE);
-                               glPopMatrix();
-                       }//hud
-               sprintf( label_buffer, format_buffer, get_value()*data_scaling() );
-       }
-  }
-  else {
+    char label_buffer[80];
+    int posincr;
+    int lenstr;
+    RECT  scrn_rect = get_location();
+
+    if (data_available()) {
+        if (lat)
+            sprintf( label_buffer, format_buffer, coord_format_lat(get_value()) );
+        else if (lon)
+            sprintf( label_buffer, format_buffer, coord_format_lon(get_value()) );
+        else {
+            if (lbox) {// Box for label
+                float x = scrn_rect.left;
+                float y = scrn_rect.top;
+                float w = scrn_rect.right;
+                float h = HUD_TextSize;
+
+                glPushMatrix();
+                glLoadIdentity();
+
+                glBegin(GL_LINES);
+                glVertex2f( x - 2.0,  y - 2.0);
+                glVertex2f( x + w + 2.0, y - 2.0);
+                glVertex2f( x + w + 2.0, y + h + 2.0);
+                glVertex2f( x - 2.0,  y + h + 2.0);
+                glEnd();
+
+                glEnable(GL_LINE_STIPPLE);
+                glLineStipple( 1, 0xAAAA );
+
+                glBegin(GL_LINES);
+                glVertex2f( x + w + 2.0, y - 2.0);
+                glVertex2f( x + w + 2.0, y + h + 2.0);
+                glVertex2f( x - 2.0,  y + h + 2.0);
+                glVertex2f( x - 2.0,  y - 2.0);
+                glEnd();
+
+                glDisable(GL_LINE_STIPPLE);
+                glPopMatrix();
+            }
+            sprintf( label_buffer, format_buffer, get_value()*data_scaling() );
+        }
+
+    } else {
 //    sprintf( label_buffer, format_buffer );
-  }
-  
-  lenstr = getStringWidth( label_buffer );
-                                               
-    
+    }
+
+    lenstr = getStringWidth( label_buffer );
+
+
 #ifdef DEBUGHUD
-  fgPrintf( SG_COCKPIT, SG_DEBUG,  format_buffer );
-  fgPrintf( SG_COCKPIT, SG_DEBUG,  "\n" );
-  fgPrintf( SG_COCKPIT, SG_DEBUG, label_buffer );
-  fgPrintf( SG_COCKPIT, SG_DEBUG, "\n" );
+    fgPrintf( SG_COCKPIT, SG_DEBUG,  format_buffer );
+    fgPrintf( SG_COCKPIT, SG_DEBUG,  "\n" );
+    fgPrintf( SG_COCKPIT, SG_DEBUG, label_buffer );
+    fgPrintf( SG_COCKPIT, SG_DEBUG, "\n" );
 #endif
-  lenstr = strlen( label_buffer );
-
-  if( justify == RIGHT_JUST ) {
-         posincr = scrn_rect.right - lenstr;
-  }else if( justify == CENTER_JUST ) {
-         posincr = get_span() - (lenstr/2); //  -lenstr*4;
-  }  else {
-      //  justify == LEFT_JUST
-      posincr = 0;  // 0;
-  }
-  
-  if( fontSize == HUD_FONT_SMALL ) {
-    textString( scrn_rect.left + posincr, scrn_rect.top,
-                label_buffer, get_digits()); //suma
+    lenstr = strlen( label_buffer );
+
+    if (justify == RIGHT_JUST) {
+        posincr = scrn_rect.right - lenstr;
+    } else if (justify == CENTER_JUST) {
+        posincr = get_span() - (lenstr/2); //  -lenstr*4;
+    } else {
+        //  justify == LEFT_JUST
+        posincr = 0;  // 0;
     }
-  else  {
-    if( fontSize == HUD_FONT_LARGE ) {
-      textString( scrn_rect.left + posincr, scrn_rect.top,
-                  label_buffer, get_digits()); //suma
-      }
+
+    if (fontSize == HUD_FONT_SMALL) {
+        textString( scrn_rect.left + posincr, scrn_rect.top,
+                    label_buffer, get_digits());
+
+    } else if (fontSize == HUD_FONT_LARGE) {
+        textString( scrn_rect.left + posincr, scrn_rect.top,
+                    label_buffer, get_digits());
     }
 }
 
index 9436e8bdf04263afd0a7def277c19b4dec9ae151..34da65b924fb81d8c79487009e4f1a3e4b2e2b6c 100644 (file)
@@ -3,9 +3,9 @@
 
 
 #ifdef USE_HUD_TextList
-#define textString( x , y, text, digit )  TextString( text, x , y,digit )
+#define textString(x, y, text, digit)  TextString(text, x , y ,digit)
 #else
-#define textString( x , y, text, digit )  puDrawString ( guiFnt, text, x, y )
+#define textString(x, y, text, digit)  puDrawString(guiFnt, text, x, y)
 #endif
 
 //======================= Top of instr_label class =========================
index 52aa7a60755b8aa063e1686128b0a77d4bbeef71..264806ad107d209f03a6d685a91dab6830e63551 100644 (file)
@@ -3,85 +3,72 @@
 
 
 #ifdef USE_HUD_TextList
-#define textString( x , y, text, digit )  TextString( text, x , y,digit ) //suma
+#define textString(x, y, text, digit)  TextString(text, x , y ,digit)
 #else
-#define textString( x , y, text, digit )  puDrawString ( guiFnt, text, x, y ); //suma
+#define textString(x, y, text, digit)  puDrawString(guiFnt, text, x, y)
 #endif
 
 //======================= Top of instr_label class =========================
-lon_label ::
-         lon_label( int           x,
-                      int           y,
-                      UINT          width,
-                      UINT          height,
-                      FLTFNPTR      data_source,
-//                      DBLFNPTR      data_source,                                     
-                      const char   *label_format,
-                      const char   *pre_label_string,
-                      const char   *post_label_string,
-                      float        scale_data,
-//                      double        scale_data,                                      
-                      UINT          options,
-                      fgLabelJust   justification,
-                      int           font_size,
-                      int           blinking,
-                      bool          working,
-                                         int                   digit): //suma
-                           instr_item( x, y, width, height,
-                                       data_source, scale_data,options, working,digit ), //suma
-                           pformat  ( label_format      ),
-                           pre_str  ( pre_label_string  ),
-                           post_str ( post_label_string ),
-                           justify  ( justification     ),
-                           fontSize ( font_size         ),
-                           blink    ( blinking          )
+lon_label::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) :
+    instr_item( x, y, width, height,
+                data_source, scale_data,options, working,digit ),
+    pformat  ( label_format      ),
+    pre_str  ( pre_label_string  ),
+    post_str ( post_label_string ),
+    justify  ( justification     ),
+    fontSize ( font_size         ),
+    blink    ( blinking          )
 {
-  if( pre_str != NULL) {
-    if( post_str != NULL ) {
-      sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
-      }
-    else {
-      sprintf( format_buffer, "%s%s",   pre_str, pformat );
-      }
-    }
-  else {
-    if( post_str != NULL ) {
-      sprintf( format_buffer, "%s%s",   pformat, post_str );
-      }
+    if (pre_str != NULL) {
+        if (post_str != NULL)
+            sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
+        else
+            sprintf( format_buffer, "%s%s",   pre_str, pformat );
+
+    } else if (post_str != NULL) {
+            sprintf( format_buffer, "%s%s",   pformat, post_str );
     } // else do nothing if both pre and post strings are nulls. Interesting.
 
 }
 
-// I put this in to make it easy to construct a class member using the current
-// C code.
 
-
-lon_label :: ~lon_label()
+lon_label::~lon_label()
 {
 }
 
+
 // Copy constructor
-lon_label :: lon_label( const lon_label & image) :
-                              instr_item((const instr_item &)image),
-                              pformat    ( image.pformat    ),
-                              pre_str  ( image.pre_str  ),
-                              post_str ( image.post_str ),
-                              blink    ( image.blink    )
+lon_label::lon_label( const lon_label & image) :
+    instr_item((const instr_item &)image),
+    pformat    ( image.pformat    ),
+    pre_str    ( image.pre_str  ),
+    post_str   ( image.post_str ),
+    blink      ( image.blink    )
 {
-  if( pre_str != NULL) {
-    if( post_str != NULL ) {
-      sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
-      }
-    else {
-      sprintf( format_buffer, "%s%s",   pre_str, pformat );
-      }
-    }
-  else {
-    if( post_str != NULL ) {
-      sprintf( format_buffer, "%s%s",   pformat, post_str );
-      }
-    } // else do nothing if both pre and post strings are nulls. Interesting.
+    if (pre_str != NULL) {
+        if (post_str != NULL)
+            sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
+        else
+            sprintf( format_buffer, "%s%s",   pre_str, pformat );
 
+    } else if (post_str != NULL) {
+            sprintf( format_buffer, "%s%s",   pformat, post_str );
+    } // else do nothing if both pre and post strings are nulls. Interesting.
 }
 
 
@@ -89,51 +76,44 @@ lon_label :: lon_label( const lon_label & image) :
 // draw                    Draws a label anywhere in the HUD
 //
 //
-void lon_label ::
-draw( void )       // Required method in base class
+void lon_label::draw( void )
 {
-//  char format_buffer[80];
-  char label_buffer[80];
-  int posincr;
-  int lenstr;
-  RECT  scrn_rect = get_location();
-  float lon = get_value();
-//  double lon = get_value();  
-  if( data_available() ) {
-//     char *lonstring = coord_format_lon(lon);
-    lenstr = sprintf( label_buffer, format_buffer, coord_format_lon(lon) );
-    }
-  else {
-    lenstr = sprintf( label_buffer, format_buffer );
+    char label_buffer[80];
+    int posincr;
+    int lenstr;
+    RECT  scrn_rect = get_location();
+    float lon = get_value();
+
+    if ( data_available() ) {
+        lenstr = sprintf( label_buffer, format_buffer, coord_format_lon(lon) );
+    } else {
+        lenstr = sprintf( label_buffer, format_buffer );
     }
-    
+
 #ifdef DEBUGHUD
-  fgPrintf( SG_COCKPIT, SG_DEBUG,  format_buffer );
-  fgPrintf( SG_COCKPIT, SG_DEBUG,  "\n" );
-  fgPrintf( SG_COCKPIT, SG_DEBUG, label_buffer );
-  fgPrintf( SG_COCKPIT, SG_DEBUG, "\n" );
+    fgPrintf( SG_COCKPIT, SG_DEBUG, format_buffer );
+    fgPrintf( SG_COCKPIT, SG_DEBUG, "\n" );
+    fgPrintf( SG_COCKPIT, SG_DEBUG, label_buffer );
+    fgPrintf( SG_COCKPIT, SG_DEBUG, "\n" );
 #endif
-       
-       lenstr = getStringWidth(label_buffer);
-                                               
-  if( justify == RIGHT_JUST ) {
-         posincr = scrn_rect.right - lenstr;
-  }else if( justify == CENTER_JUST ) {
-         posincr = get_span() - (lenstr/2);
-  }  else {
-      //  justify == LEFT_JUST
+
+    lenstr = getStringWidth(label_buffer);
+
+    if (justify == RIGHT_JUST)
+        posincr = scrn_rect.right - lenstr;
+    else if (justify == CENTER_JUST)
+      posincr = get_span() - (lenstr/2);
+    else //  justify == LEFT_JUST
       posincr = 0;
-  }
-  
-  if( fontSize == HUD_FONT_SMALL ) {
-    textString( scrn_rect.left + posincr, scrn_rect.top,
-                label_buffer, get_digits()); //suma
-    }
-  else  {
-    if( fontSize == HUD_FONT_LARGE ) {
-      textString( scrn_rect.left + posincr, scrn_rect.top,
-                  label_buffer, get_digits()); //suma
-      }
+
+    if (fontSize == HUD_FONT_SMALL) {
+        textString( scrn_rect.left + posincr, scrn_rect.top,
+                    label_buffer, get_digits());
+
+    } else if (fontSize == HUD_FONT_LARGE) {
+        textString( scrn_rect.left + posincr, scrn_rect.top,
+                    label_buffer, get_digits());
     }
 }
 
+
index dcd9d9bba6f299113c8b3ce48b40ea499b240803..1d20481b33d151eea4fc6ce5f8fdfae05dfe199f 100644 (file)
 #include <ATC/ATCutils.hxx>
 
 runway_instr::runway_instr(int x,
-                                                  int y,
-                                                  int width,
-                                                  int height,
-                                                  float scale_data,
-                                                  bool working):instr_item(x,y,width,height,NULL,scale_data,0,working)
+                           int y,
+                           int width,
+                           int height,
+                           float scale_data,
+                           bool working) :
+    instr_item(x, y, width, height, NULL, scale_data, 0, working)
 {
-       stippleOut=0xFFFF;
-       stippleCen=0xFFFF;
-       arrowScale = 1.0;
-       arrowRad = 0.0;
-       view[0] = 0;
-       view[1] = 0;
-       view[2] = 640;
-       view[3] = 480;  
-       center.x = view[2]>>1;
-       center.y = view[3]>>1;
-       location.left = center.x-(width>>1)+x;
-       location.right = center.x+(width>>1)+x;
-       location.bottom = center.y-(height>>1)+y;
-       location.top = center.y+(height>>1)+y;
-       cockpit_view = globals->get_viewmgr()->get_view(0);     
-       default_heading = fgGetDouble("/sim/view[0]/config/pitch-heading-deg",0.0);
-       default_pitch = fgGetDouble("/sim/view[0]/config/pitch-pitch-deg",0.0);
+    stippleOut=0xFFFF;
+    stippleCen=0xFFFF;
+    arrowScale = 1.0;
+    arrowRad = 0.0;
+    view[0] = 0;
+    view[1] = 0;
+    view[2] = 640;
+    view[3] = 480;
+    center.x = view[2]>>1;
+    center.y = view[3]>>1;
+    location.left = center.x-(width>>1)+x;
+    location.right = center.x+(width>>1)+x;
+    location.bottom = center.y-(height>>1)+y;
+    location.top = center.y+(height>>1)+y;
+    cockpit_view = globals->get_viewmgr()->get_view(0);
+    default_heading = fgGetDouble("/sim/view[0]/config/pitch-heading-deg",0.0);
+    default_pitch = fgGetDouble("/sim/view[0]/config/pitch-pitch-deg",0.0);
 }
 
+
 void runway_instr::draw() {
-       if (!is_broken() && get_active_runway(runway)) {        
-               glPushAttrib(GL_LINE_STIPPLE | GL_LINE_STIPPLE_PATTERN | GL_LINE_WIDTH);
-               float modelView[4][4],projMat[4][4];    
-               bool anyLines;
-               //Get the current view
-               FGViewer* curr_view = globals->get_viewmgr()->get_current_view();                
-               int curr_view_id = globals->get_viewmgr()->get_current();               
-               double gpo = curr_view->getGoalPitchOffset_deg();
-               double gho = curr_view->getGoalHeadingOffset_deg();
-               double po = curr_view->getPitchOffset_deg();
-               double ho = curr_view->getHeadingOffset_deg();
-               
-               double yaw = -(cockpit_view->getHeadingOffset_deg()-default_heading)*SG_DEGREES_TO_RADIANS;
-               double pitch = (cockpit_view->getPitchOffset_deg()-default_pitch)*SG_DEGREES_TO_RADIANS;                
-               //double roll = fgGetDouble("/sim/view[0]/config/roll-offset-deg",0.0) //TODO: adjust for default roll offset
-               double sPitch = sin(pitch), cPitch = cos(pitch),
-                          sYaw = sin(yaw), cYaw = cos(yaw);
-
-               //Assuming that the "Cockpit View" is always at position zero!!!
-               if (curr_view_id != 0) {
-                       globals->get_viewmgr()->set_view(0);
-                       globals->get_viewmgr()->copyToCurrent();                        
-               }               
-               //Set the camera to the cockpit view to get the view of the runway from the cockpit
-               ssgSetCamera((sgVec4 *)cockpit_view->get_VIEW());
-               get_rwy_points(points3d);        
-               //Get the current project matrix
-               ssgGetProjectionMatrix(projMat);
-//             const sgVec4 *viewMat = globals->get_current_view()->get_VIEW();
-               //Get the current model view matrix (cockpit view)
-               ssgGetModelviewMatrix(modelView);
-               //Create a rotation matrix to correct for any offsets (other than default offsets) to the model view matrix
-               sgMat4 xy; //rotation about the Rxy, negate the sin's on Ry
-               xy[0][0]=cYaw;                  xy[1][0]=0.0f;          xy[2][0]=-sYaw;                 xy[3][0]=0.0f;
-               xy[0][1]=sPitch*-sYaw;  xy[1][1]=cPitch;        xy[2][1]=-sPitch*cYaw;  xy[3][1]=0.0f;
-               xy[0][2]=cPitch*sYaw;   xy[1][2]=sPitch;        xy[2][2]=cPitch*cYaw;   xy[3][2]=0.0f;
-               xy[0][3]=0.0f;                  xy[1][3]=0.0f;          xy[2][3]=0.0f;                  xy[3][3]=1.0f;
-               //Re-center the model view
-               sgPostMultMat4(modelView,xy);
-               //copy float matrices to double         
-               for (int i=0; i<4; i++) {
-                       for (int j=0; j<4; j++) {
-                               int idx = (i*4)+j;
-                               mm[idx] = (double)modelView[i][j];
-                               pm[idx] = (double)projMat[i][j];                                                                
-                       }
-               }       
-               //Calculate the 2D points via gluProject
-               int result = GL_TRUE;
-               for (int i=0; i<6; i++) {
-                       result = gluProject(points3d[i][0],points3d[i][1],points3d[i][2],mm,pm,view,&points2d[i][0],&points2d[i][1],&points2d[i][2]);                                                                           
-               }
-               //set the line width based on our distance from the runway
-               setLineWidth();
-               //Draw the runway lines on the HUD
-               glEnable(GL_LINE_STIPPLE);
-               glLineStipple(1,stippleOut);    
-               anyLines = 
-               drawLine(points3d[0],points3d[1],points2d[0],points2d[1]) | //draw top
-               drawLine(points3d[2],points3d[1],points2d[2],points2d[1]) | //draw right
-               drawLine(points3d[2],points3d[3],points2d[2],points2d[3]) | //draw bottom
-               drawLine(points3d[3],points3d[0],points2d[3],points2d[0]);  //draw left
-               glLineStipple(1,stippleCen);
-               anyLines |=     drawLine(points3d[5],points3d[4],points2d[5],points2d[4]); //draw center                        
-               //Check to see if arrow needs drawn
-               if ((!anyLines && drawIA) || drawIAAlways) {
-                       drawArrow(); //draw indication arrow
-               }
-               //Restore the current view and any offsets
-               if (curr_view_id != 0) {
-                       globals->get_viewmgr()->set_view(curr_view_id);
-                       globals->get_viewmgr()->copyToCurrent();
-                       curr_view->setHeadingOffset_deg(ho);
-                       curr_view->setPitchOffset_deg(po);
-                       curr_view->setGoalHeadingOffset_deg(gho);
-                       curr_view->setGoalPitchOffset_deg(gpo);
-               }
-               //Set the camera back to the current view
-               ssgSetCamera((sgVec4 *)curr_view);
-               glPopAttrib();
-       }//if not broken
+    if (!is_broken() && get_active_runway(runway)) {
+        glPushAttrib(GL_LINE_STIPPLE | GL_LINE_STIPPLE_PATTERN | GL_LINE_WIDTH);
+        float modelView[4][4],projMat[4][4];
+        bool anyLines;
+        //Get the current view
+        FGViewer* curr_view = globals->get_viewmgr()->get_current_view();
+        int curr_view_id = globals->get_viewmgr()->get_current();
+        double gpo = curr_view->getGoalPitchOffset_deg();
+        double gho = curr_view->getGoalHeadingOffset_deg();
+        double po = curr_view->getPitchOffset_deg();
+        double ho = curr_view->getHeadingOffset_deg();
+
+        double yaw = -(cockpit_view->getHeadingOffset_deg()-default_heading)*SG_DEGREES_TO_RADIANS;
+        double pitch = (cockpit_view->getPitchOffset_deg()-default_pitch)*SG_DEGREES_TO_RADIANS;
+        //double roll = fgGetDouble("/sim/view[0]/config/roll-offset-deg",0.0) //TODO: adjust for default roll offset
+        double sPitch = sin(pitch), cPitch = cos(pitch),
+               sYaw = sin(yaw), cYaw = cos(yaw);
+
+        //Assuming that the "Cockpit View" is always at position zero!!!
+        if (curr_view_id != 0) {
+            globals->get_viewmgr()->set_view(0);
+            globals->get_viewmgr()->copyToCurrent();
+        }
+        //Set the camera to the cockpit view to get the view of the runway from the cockpit
+        ssgSetCamera((sgVec4 *)cockpit_view->get_VIEW());
+        get_rwy_points(points3d);
+        //Get the current project matrix
+        ssgGetProjectionMatrix(projMat);
+//        const sgVec4 *viewMat = globals->get_current_view()->get_VIEW();
+        //Get the current model view matrix (cockpit view)
+        ssgGetModelviewMatrix(modelView);
+        //Create a rotation matrix to correct for any offsets (other than default offsets) to the model view matrix
+        sgMat4 xy; //rotation about the Rxy, negate the sin's on Ry
+        xy[0][0]=cYaw;         xy[1][0]=0.0f;   xy[2][0]=-sYaw;        xy[3][0]=0.0f;
+        xy[0][1]=sPitch*-sYaw; xy[1][1]=cPitch; xy[2][1]=-sPitch*cYaw; xy[3][1]=0.0f;
+        xy[0][2]=cPitch*sYaw;  xy[1][2]=sPitch; xy[2][2]=cPitch*cYaw;  xy[3][2]=0.0f;
+        xy[0][3]=0.0f;         xy[1][3]=0.0f;   xy[2][3]=0.0f;         xy[3][3]=1.0f;
+        //Re-center the model view
+        sgPostMultMat4(modelView,xy);
+        //copy float matrices to double
+        for (int i=0; i<4; i++) {
+            for (int j=0; j<4; j++) {
+                int idx = (i*4)+j;
+                mm[idx] = (double)modelView[i][j];
+                pm[idx] = (double)projMat[i][j];
+            }
+        }
+        //Calculate the 2D points via gluProject
+        int result = GL_TRUE;
+        for (int i=0; i<6; i++) {
+            result = gluProject(points3d[i][0],points3d[i][1],points3d[i][2],mm,pm,view,&points2d[i][0],&points2d[i][1],&points2d[i][2]);
+        }
+        //set the line width based on our distance from the runway
+        setLineWidth();
+        //Draw the runway lines on the HUD
+        glEnable(GL_LINE_STIPPLE);
+        glLineStipple(1,stippleOut);
+        anyLines =
+        drawLine(points3d[0],points3d[1],points2d[0],points2d[1]) | //draw top
+        drawLine(points3d[2],points3d[1],points2d[2],points2d[1]) | //draw right
+        drawLine(points3d[2],points3d[3],points2d[2],points2d[3]) | //draw bottom
+        drawLine(points3d[3],points3d[0],points2d[3],points2d[0]);  //draw left
+        glLineStipple(1,stippleCen);
+        anyLines |= drawLine(points3d[5],points3d[4],points2d[5],points2d[4]); //draw center
+        //Check to see if arrow needs drawn
+        if ((!anyLines && drawIA) || drawIAAlways) {
+            drawArrow(); //draw indication arrow
+        }
+        //Restore the current view and any offsets
+        if (curr_view_id != 0) {
+            globals->get_viewmgr()->set_view(curr_view_id);
+            globals->get_viewmgr()->copyToCurrent();
+            curr_view->setHeadingOffset_deg(ho);
+            curr_view->setPitchOffset_deg(po);
+            curr_view->setGoalHeadingOffset_deg(gho);
+            curr_view->setGoalPitchOffset_deg(gpo);
+        }
+        //Set the camera back to the current view
+        ssgSetCamera((sgVec4 *)curr_view);
+        glPopAttrib();
+    }//if not broken
 }
 
+
 bool runway_instr::get_active_runway(FGRunway& runway) {
   FGEnvironment stationweather =
       ((FGEnvironmentMgr *)globals->get_subsystem("environment"))->getEnvironment();
-  double hdg = stationweather.get_wind_from_heading_deg();  
+  double hdg = stationweather.get_wind_from_heading_deg();
   return globals->get_runways()->search( fgGetString("/sim/presets/airport-id"), int(hdg), &runway);
 }
 
-void runway_instr::get_rwy_points(sgdVec3 *points3d) { 
-       static Point3D center = globals->get_scenery()->get_center();
-       
-       //Get the current tile center
-       Point3D currentCenter = globals->get_scenery()->get_center();
-       Point3D tileCenter = currentCenter;
-       if (center != currentCenter) //if changing tiles
-               tileCenter = center; //use last center
-       double alt = current_aircraft.fdm_state->get_Runway_altitude()*SG_FEET_TO_METER;
-       double length = (runway._length/2.0)*SG_FEET_TO_METER;
-       double width = (runway._width/2.0)*SG_FEET_TO_METER;
-       double frontLat,frontLon,backLat,backLon,az,tempLat,tempLon;
-       
-       geo_direct_wgs_84(alt,runway._lat,runway._lon,runway._heading,length,&backLat,&backLon,&az);
-       sgGeodToCart(backLat*SG_DEGREES_TO_RADIANS,backLon*SG_DEGREES_TO_RADIANS,alt,points3d[4]);
-
-       geo_direct_wgs_84(alt,runway._lat,runway._lon,runway._heading+180,length,&frontLat,&frontLon,&az);      
-       sgGeodToCart(frontLat*SG_DEGREES_TO_RADIANS,frontLon*SG_DEGREES_TO_RADIANS,alt,points3d[5]);
-
-       geo_direct_wgs_84(alt,backLat,backLon,runway._heading+90,width,&tempLat,&tempLon,&az);
-       sgGeodToCart(tempLat*SG_DEGREES_TO_RADIANS,tempLon*SG_DEGREES_TO_RADIANS,alt,points3d[0]);
-
-       geo_direct_wgs_84(alt,backLat,backLon,runway._heading-90,width,&tempLat,&tempLon,&az);
-       sgGeodToCart(tempLat*SG_DEGREES_TO_RADIANS,tempLon*SG_DEGREES_TO_RADIANS,alt,points3d[1]);
-
-       geo_direct_wgs_84(alt,frontLat,frontLon,runway._heading-90,width,&tempLat,&tempLon,&az);
-       sgGeodToCart(tempLat*SG_DEGREES_TO_RADIANS,tempLon*SG_DEGREES_TO_RADIANS,alt,points3d[2]);
-
-       geo_direct_wgs_84(alt,frontLat,frontLon,runway._heading+90,width,&tempLat,&tempLon,&az);
-       sgGeodToCart(tempLat*SG_DEGREES_TO_RADIANS,tempLon*SG_DEGREES_TO_RADIANS,alt,points3d[3]);
-       
-       for(int i = 0; i < 6; i++)
-       {
-               points3d[i][0] -= tileCenter.x();
-               points3d[i][1] -= tileCenter.y();
-               points3d[i][2] -= tileCenter.z();
-       }
-       center = currentCenter;
+
+void runway_instr::get_rwy_points(sgdVec3 *points3d) {
+    static Point3D center = globals->get_scenery()->get_center();
+
+    //Get the current tile center
+    Point3D currentCenter = globals->get_scenery()->get_center();
+    Point3D tileCenter = currentCenter;
+    if (center != currentCenter) //if changing tiles
+        tileCenter = center; //use last center
+    double alt = current_aircraft.fdm_state->get_Runway_altitude()*SG_FEET_TO_METER;
+    double length = (runway._length/2.0)*SG_FEET_TO_METER;
+    double width = (runway._width/2.0)*SG_FEET_TO_METER;
+    double frontLat,frontLon,backLat,backLon,az,tempLat,tempLon;
+
+    geo_direct_wgs_84(alt,runway._lat,runway._lon,runway._heading,length,&backLat,&backLon,&az);
+    sgGeodToCart(backLat*SG_DEGREES_TO_RADIANS,backLon*SG_DEGREES_TO_RADIANS,alt,points3d[4]);
+
+    geo_direct_wgs_84(alt,runway._lat,runway._lon,runway._heading+180,length,&frontLat,&frontLon,&az);
+    sgGeodToCart(frontLat*SG_DEGREES_TO_RADIANS,frontLon*SG_DEGREES_TO_RADIANS,alt,points3d[5]);
+
+    geo_direct_wgs_84(alt,backLat,backLon,runway._heading+90,width,&tempLat,&tempLon,&az);
+    sgGeodToCart(tempLat*SG_DEGREES_TO_RADIANS,tempLon*SG_DEGREES_TO_RADIANS,alt,points3d[0]);
+
+    geo_direct_wgs_84(alt,backLat,backLon,runway._heading-90,width,&tempLat,&tempLon,&az);
+    sgGeodToCart(tempLat*SG_DEGREES_TO_RADIANS,tempLon*SG_DEGREES_TO_RADIANS,alt,points3d[1]);
+
+    geo_direct_wgs_84(alt,frontLat,frontLon,runway._heading-90,width,&tempLat,&tempLon,&az);
+    sgGeodToCart(tempLat*SG_DEGREES_TO_RADIANS,tempLon*SG_DEGREES_TO_RADIANS,alt,points3d[2]);
+
+    geo_direct_wgs_84(alt,frontLat,frontLon,runway._heading+90,width,&tempLat,&tempLon,&az);
+    sgGeodToCart(tempLat*SG_DEGREES_TO_RADIANS,tempLon*SG_DEGREES_TO_RADIANS,alt,points3d[3]);
+
+    for (int i = 0; i < 6; i++) {
+        points3d[i][0] -= tileCenter.x();
+        points3d[i][1] -= tileCenter.y();
+        points3d[i][2] -= tileCenter.z();
+    }
+    center = currentCenter;
 }
 
+
 bool runway_instr::drawLine(const sgdVec3& a1, const sgdVec3& a2, const sgdVec3& point1, const sgdVec3& point2) {
-       sgdVec3 p1, p2;
-       sgdCopyVec3(p1, point1);
-       sgdCopyVec3(p2, point2);
-       bool p1Inside = (p1[0]>=location.left && p1[0]<=location.right && p1[1]>=location.bottom && p1[1]<=location.top); 
-       bool p1Insight = (p1[2] >= 0.0 && p1[2] < 1.0);
-       bool p1Valid = p1Insight && p1Inside;
-       bool p2Inside = (p2[0]>=location.left && p2[0]<=location.right && p2[1]>=location.bottom && p2[1]<=location.top);
-       bool p2Insight = (p2[2] >= 0.0 && p2[2] < 1.0);
-       bool p2Valid = p2Insight && p2Inside;
-       
-       if (p1Valid && p2Valid) { //Both project points are valid, draw the line
-               glBegin(GL_LINES);
-               glVertex2d(p1[0],p1[1]);
-               glVertex2d(p2[0],p2[1]);
-               glEnd();
-       }
-       else if (p1Valid) { //p1 is valid and p2 is not, calculate a new valid point
-               sgdVec3 vec = {a2[0]-a1[0], a2[1]-a1[1], a2[2]-a1[2]};
-               //create the unit vector
-               sgdScaleVec3(vec,1.0/sgdLengthVec3(vec));
-               sgdVec3 newPt;
-               sgdCopyVec3(newPt,a1);
-               sgdAddVec3(newPt,vec);
-               if (gluProject(newPt[0],newPt[1],newPt[2],mm,pm,view,&p2[0],&p2[1],&p2[2]) && (p2[2]>0&&p2[2]<1.0) ) {
-                       boundPoint(p1,p2);
-                       glBegin(GL_LINES);
-                       glVertex2d(p1[0],p1[1]);
-                       glVertex2d(p2[0],p2[1]);
-                       glEnd();
-               }
-       }
-       else if (p2Valid) { //p2 is valid and p1 is not, calculate a new valid point
-               sgdVec3 vec = {a1[0]-a2[0], a1[1]-a2[1], a1[2]-a2[2]};
-               //create the unit vector
-               sgdScaleVec3(vec,1.0/sgdLengthVec3(vec));
-               sgdVec3 newPt;
-               sgdCopyVec3(newPt,a2);
-               sgdAddVec3(newPt,vec);
-               if (gluProject(newPt[0],newPt[1],newPt[2],mm,pm,view,&p1[0],&p1[1],&p1[2]) && (p1[2]>0&&p1[2]<1.0)) {
-                       boundPoint(p2,p1);
-                       glBegin(GL_LINES);
-                       glVertex2d(p2[0],p2[1]);
-                       glVertex2d(p1[0],p1[1]);
-                       glEnd();
-               }
-       }
-       else if (p1Insight && p2Insight) { //both points are insight, but not inside
-               bool v = boundOutsidePoints(p1,p2);
-               if (v) {
-                       glBegin(GL_LINES);
-                               glVertex2d(p1[0],p1[1]);
-                               glVertex2d(p2[0],p2[1]);
-                       glEnd();
-               }
-               return v;
-       }
-       //else both points are not insight, don't draw anything
+    sgdVec3 p1, p2;
+    sgdCopyVec3(p1, point1);
+    sgdCopyVec3(p2, point2);
+    bool p1Inside = (p1[0]>=location.left && p1[0]<=location.right && p1[1]>=location.bottom && p1[1]<=location.top);
+    bool p1Insight = (p1[2] >= 0.0 && p1[2] < 1.0);
+    bool p1Valid = p1Insight && p1Inside;
+    bool p2Inside = (p2[0]>=location.left && p2[0]<=location.right && p2[1]>=location.bottom && p2[1]<=location.top);
+    bool p2Insight = (p2[2] >= 0.0 && p2[2] < 1.0);
+    bool p2Valid = p2Insight && p2Inside;
+
+    if (p1Valid && p2Valid) { //Both project points are valid, draw the line
+        glBegin(GL_LINES);
+        glVertex2d(p1[0],p1[1]);
+        glVertex2d(p2[0],p2[1]);
+        glEnd();
+
+    } else if (p1Valid) { //p1 is valid and p2 is not, calculate a new valid point
+        sgdVec3 vec = {a2[0]-a1[0], a2[1]-a1[1], a2[2]-a1[2]};
+        //create the unit vector
+        sgdScaleVec3(vec,1.0/sgdLengthVec3(vec));
+        sgdVec3 newPt;
+        sgdCopyVec3(newPt,a1);
+        sgdAddVec3(newPt,vec);
+        if (gluProject(newPt[0],newPt[1],newPt[2],mm,pm,view,&p2[0],&p2[1],&p2[2]) && (p2[2]>0&&p2[2]<1.0) ) {
+            boundPoint(p1,p2);
+            glBegin(GL_LINES);
+            glVertex2d(p1[0],p1[1]);
+            glVertex2d(p2[0],p2[1]);
+            glEnd();
+        }
+
+    } else if (p2Valid) { //p2 is valid and p1 is not, calculate a new valid point
+        sgdVec3 vec = {a1[0]-a2[0], a1[1]-a2[1], a1[2]-a2[2]};
+        //create the unit vector
+        sgdScaleVec3(vec,1.0/sgdLengthVec3(vec));
+        sgdVec3 newPt;
+        sgdCopyVec3(newPt,a2);
+        sgdAddVec3(newPt,vec);
+        if (gluProject(newPt[0],newPt[1],newPt[2],mm,pm,view,&p1[0],&p1[1],&p1[2]) && (p1[2]>0&&p1[2]<1.0)) {
+            boundPoint(p2,p1);
+            glBegin(GL_LINES);
+            glVertex2d(p2[0],p2[1]);
+            glVertex2d(p1[0],p1[1]);
+            glEnd();
+        }
+
+    } else if (p1Insight && p2Insight) { //both points are insight, but not inside
+        bool v = boundOutsidePoints(p1,p2);
+        if (v) {
+            glBegin(GL_LINES);
+                glVertex2d(p1[0],p1[1]);
+                glVertex2d(p2[0],p2[1]);
+            glEnd();
+        }
+        return v;
+    }
+    //else both points are not insight, don't draw anything
     return (p1Valid && p2Valid);
 }
 
+
 void runway_instr::boundPoint(const sgdVec3& v, sgdVec3& m) {
-       double y = v[1];
-       if(m[1] < v[1]) {
-               y = location.bottom;
-       }
-       else if(m[1] > v[1]) {
-               y = location.top;
-       }
-       if (m[0] == v[0]) {
-               m[1]=y;
-               return;  //prevent divide by zero
-       }
-       double slope = (m[1]-v[1])/(m[0]-v[0]);
-       m[0] = (y-v[1])/slope + v[0];
-       m[1] = y;
-       if (m[0] < location.left) {
-               m[0] = location.left;                   
-               m[1] = slope * (location.left-v[0])+v[1];
-       }
-       else if (m[0] > location.right) {
-               m[0] = location.right;
-               m[1] = slope * (location.right-v[0])+v[1];
-       }
+    double y = v[1];
+    if (m[1] < v[1])
+        y = location.bottom;
+    else if (m[1] > v[1])
+        y = location.top;
+
+    if (m[0] == v[0]) {
+        m[1]=y;
+        return;  //prevent divide by zero
+    }
+
+    double slope = (m[1]-v[1])/(m[0]-v[0]);
+    m[0] = (y-v[1])/slope + v[0];
+    m[1] = y;
+
+    if (m[0] < location.left) {
+        m[0] = location.left;
+        m[1] = slope * (location.left-v[0])+v[1];
+
+    } else if (m[0] > location.right) {
+        m[0] = location.right;
+        m[1] = slope * (location.right-v[0])+v[1];
+    }
 }
 
+
 bool runway_instr::boundOutsidePoints(sgdVec3& v, sgdVec3& m) {
-       bool pointsInvalid = (v[1]>location.top && m[1]>location.top) ||
-                              (v[1]<location.bottom && m[1]<location.bottom) ||
-                                          (v[0]>location.right && m[0]>location.right) ||
-                                          (v[0]<location.left && m[0]<location.left);
-       if (pointsInvalid)
-               return false;
-       if (m[0] == v[0]) {//x's are equal, vertical line       
-               if (m[1]>v[1]) {
-                       m[1]=location.top;
-                       v[1]=location.bottom;
-               }
-               else {
-                       v[1]=location.top;
-                       m[1]=location.bottom;
-               }
-               return true;
-       }
-       if (m[1] == v[1]) { //y's are equal, horizontal line
-               if (m[0] > v[0]) {
-                       m[0] = location.right;
-                       v[0] = location.left;
-               }
-               else {
-                       v[0] = location.right;
-                       m[0] = location.left;
-               }
-               return true;
-       }
-       double slope = (m[1]-v[1])/(m[0]-v[0]);
-       double b = v[1]-(slope*v[0]);
-       double y1 = slope * location.left + b;
-       double y2 = slope * location.right + b;
-       double x1 = (location.bottom - b) / slope;
-       double x2 = (location.top - b) / slope;
-       int counter = 0;
-       if  (y1 >= location.bottom && y1 <= location.top) {
-               v[0] = location.left;
-               v[1] = y1;
-               counter++;
-       }
-       if (y2 >= location.bottom && y2 <= location.top) {
-               if (counter > 0) {
-                       m[0] = location.right;
-                       m[1] = y2;
-               }
-               else {
-                       v[0] = location.right;
-                       v[1] = y2;
-               }
-               counter++;
-       }
-       if (x1 >= location.left && x1 <= location.right) {
-               if (counter > 0) {
-                       m[0] = x1;
-                       m[1] = location.bottom;
-               }
-               else {
-                       v[0] = x1;
-                       v[1] = location.bottom;
-               }
-               counter++;
-       }
-       if (x2 >= location.left && x2 <= location.right) {
-               m[0] = x1;
-               m[1] = location.bottom;
-               counter++;
-       }
-       return (counter == 2);
+    bool pointsInvalid = (v[1]>location.top && m[1]>location.top) ||
+                         (v[1]<location.bottom && m[1]<location.bottom) ||
+                         (v[0]>location.right && m[0]>location.right) ||
+                         (v[0]<location.left && m[0]<location.left);
+    if (pointsInvalid)
+        return false;
+
+    if (m[0] == v[0]) {//x's are equal, vertical line
+        if (m[1]>v[1]) {
+            m[1]=location.top;
+            v[1]=location.bottom;
+        } else {
+            v[1]=location.top;
+            m[1]=location.bottom;
+        }
+        return true;
+    }
+
+    if (m[1] == v[1]) { //y's are equal, horizontal line
+        if (m[0] > v[0]) {
+            m[0] = location.right;
+            v[0] = location.left;
+        } else {
+            v[0] = location.right;
+            m[0] = location.left;
+        }
+        return true;
+    }
+
+    double slope = (m[1]-v[1])/(m[0]-v[0]);
+    double b = v[1]-(slope*v[0]);
+    double y1 = slope * location.left + b;
+    double y2 = slope * location.right + b;
+    double x1 = (location.bottom - b) / slope;
+    double x2 = (location.top - b) / slope;
+    int counter = 0;
+
+    if  (y1 >= location.bottom && y1 <= location.top) {
+        v[0] = location.left;
+        v[1] = y1;
+        counter++;
+    }
+
+    if (y2 >= location.bottom && y2 <= location.top) {
+        if (counter > 0) {
+            m[0] = location.right;
+            m[1] = y2;
+        } else {
+            v[0] = location.right;
+            v[1] = y2;
+        }
+        counter++;
+    }
+
+    if (x1 >= location.left && x1 <= location.right) {
+        if (counter > 0) {
+            m[0] = x1;
+            m[1] = location.bottom;
+        } else {
+            v[0] = x1;
+            v[1] = location.bottom;
+        }
+        counter++;
+    }
+
+    if (x2 >= location.left && x2 <= location.right) {
+        m[0] = x1;
+        m[1] = location.bottom;
+        counter++;
+    }
+    return (counter == 2);
 }
 
 void runway_instr::drawArrow() {
-       Point3D ac(0.0), rwy(0.0);
-       ac.setlat(current_aircraft.fdm_state->get_Latitude_deg());
-       ac.setlon(current_aircraft.fdm_state->get_Longitude_deg());
-       rwy.setlat(runway._lat);
-       rwy.setlon(runway._lon);
-       float theta = GetHeadingFromTo(ac,rwy);
-       theta -= fgGetDouble("/orientation/heading-deg");
-       theta = -theta;
-       glMatrixMode(GL_MODELVIEW);
-       glPushMatrix();
-       glTranslated((location.right+location.left)/2.0,(location.top+location.bottom)/2.0,0.0);        
-       glRotated(theta,0.0,0.0,1.0);
-       glTranslated(0.0,arrowRad,0.0);
-       glScaled(arrowScale,arrowScale,0.0);
-       glBegin(GL_TRIANGLES);          
-               glVertex2d(-5.0,12.5);
-               glVertex2d(0.0,25.0);
-               glVertex2d(5.0,12.5);           
-       glEnd();
-       glBegin(GL_QUADS);
-               glVertex2d(-2.5,0.0);
-               glVertex2d(-2.5,12.5);
-               glVertex2d(2.5,12.5);
-               glVertex2d(2.5,0.0);
-       glEnd();
-       glPopMatrix();
+    Point3D ac(0.0), rwy(0.0);
+    ac.setlat(current_aircraft.fdm_state->get_Latitude_deg());
+    ac.setlon(current_aircraft.fdm_state->get_Longitude_deg());
+    rwy.setlat(runway._lat);
+    rwy.setlon(runway._lon);
+    float theta = GetHeadingFromTo(ac,rwy);
+    theta -= fgGetDouble("/orientation/heading-deg");
+    theta = -theta;
+    glMatrixMode(GL_MODELVIEW);
+    glPushMatrix();
+    glTranslated((location.right+location.left)/2.0,(location.top+location.bottom)/2.0,0.0);
+    glRotated(theta,0.0,0.0,1.0);
+    glTranslated(0.0,arrowRad,0.0);
+    glScaled(arrowScale,arrowScale,0.0);
+
+    glBegin(GL_TRIANGLES);
+    glVertex2d(-5.0,12.5);
+    glVertex2d(0.0,25.0);
+    glVertex2d(5.0,12.5);
+    glEnd();
+
+    glBegin(GL_QUADS);
+    glVertex2d(-2.5,0.0);
+    glVertex2d(-2.5,12.5);
+    glVertex2d(2.5,12.5);
+    glVertex2d(2.5,0.0);
+    glEnd();
+    glPopMatrix();
 }
 
 void runway_instr::setLineWidth() {
-       //Calculate the distance from the runway, A
-       double course, distance;
-       calc_gc_course_dist(Point3D(runway._lon*SGD_DEGREES_TO_RADIANS, runway._lat*SGD_DEGREES_TO_RADIANS, 0.0),
-               Point3D(current_aircraft.fdm_state->get_Longitude(),current_aircraft.fdm_state->get_Latitude(), 0.0 ),
-               &course, &distance);
-       distance *= SG_METER_TO_NM;
-       //Get altitude above runway, B
-       double alt_nm = get_agl();
-       static const SGPropertyNode *startup_units_node
+    //Calculate the distance from the runway, A
+    double course, distance;
+    calc_gc_course_dist(Point3D(runway._lon*SGD_DEGREES_TO_RADIANS, runway._lat*SGD_DEGREES_TO_RADIANS, 0.0),
+        Point3D(current_aircraft.fdm_state->get_Longitude(),current_aircraft.fdm_state->get_Latitude(), 0.0 ),
+        &course, &distance);
+    distance *= SG_METER_TO_NM;
+    //Get altitude above runway, B
+    double alt_nm = get_agl();
+    static const SGPropertyNode *startup_units_node
     = fgGetNode("/sim/startup/units");
-       if (!strcmp(startup_units_node->getStringValue(), "feet")) 
-               alt_nm *= SG_FEET_TO_METER*SG_METER_TO_NM;
-       else
-               alt_nm *= SG_METER_TO_NM;
-       //Calculate distance away from runway, C = v(A²+B²)     
-       distance = sqrt(alt_nm*alt_nm + distance*distance);
-       if (distance < scaleDist)
-               glLineWidth( 1.0+( (lnScale-1)*( (scaleDist-distance)/scaleDist)));
-       else 
-               glLineWidth( 1.0 );
-       
+
+    if (!strcmp(startup_units_node->getStringValue(), "feet"))
+        alt_nm *= SG_FEET_TO_METER*SG_METER_TO_NM;
+    else
+        alt_nm *= SG_METER_TO_NM;
+
+    //Calculate distance away from runway, C = v(A²+B²)
+    distance = sqrt(alt_nm*alt_nm + distance*distance);
+    if (distance < scaleDist)
+        glLineWidth( 1.0+( (lnScale-1)*( (scaleDist-distance)/scaleDist)));
+    else
+        glLineWidth( 1.0 );
+
 }
 
 void runway_instr::setArrowRotationRadius(double radius) { arrowRad = radius; }
index 2d99d26b1ab329af78fb44888971c040759e800b..d7fcd02ee2756a78b2e074cddbd583d3df343a11 100644 (file)
 // 2.  This class was not intended to be instanciated. See moving_scale
 //     and gauge_instr classes.
 //============================================================================
-instr_scale ::
-instr_scale ( int       x,
-              int       y,
-              UINT      width,
-              UINT      height,
-              FLTFNPTR  load_fn,
-              UINT      options,
-              float    show_range,
-              float    maxValue,
-              float    minValue,
-              float    disp_scale,
-              UINT      major_divs,
-              UINT      minor_divs,
-              UINT      rollover,
-              int       dp_showing,
-              bool      working ) :
-                instr_item( x, y, width, height,
-                            load_fn, disp_scale, options, working),
-                range_shown  ( show_range ),
-                Maximum_value( maxValue   ),
-                Minimum_value( minValue   ),
-                Maj_div      ( major_divs ),
-                Min_div      ( minor_divs ),
-                Modulo       ( rollover   ),
-                signif_digits( dp_showing )
+instr_scale::instr_scale(
+        int      x,
+        int      y,
+        UINT     width,
+        UINT     height,
+        FLTFNPTR load_fn,
+        UINT     options,
+        float    show_range,
+        float    maxValue,
+        float    minValue,
+        float    disp_scale,
+        UINT     major_divs,
+        UINT     minor_divs,
+        UINT     rollover,
+        int      dp_showing,
+        bool     working ) :
+    instr_item( x, y, width, height, load_fn, disp_scale, options, working),
+    range_shown  ( show_range ),
+    Maximum_value( maxValue   ),
+    Minimum_value( minValue   ),
+    Maj_div      ( major_divs ),
+    Min_div      ( minor_divs ),
+    Modulo       ( rollover   ),
+    signif_digits( dp_showing )
 {
-int temp;
+    int temp;
 
-  scale_factor   = (float)get_span() / range_shown;
-  if( show_range < 0 ) {
-    range_shown = -range_shown;
-    }
-  temp = FloatToInt(Maximum_value - Minimum_value) / 100;
-  if( range_shown < temp ) {
-    range_shown = temp;
-    }
+    scale_factor = (float)get_span() / range_shown;
+    if (show_range < 0)
+        range_shown = -range_shown;
+
+    temp = FloatToInt(Maximum_value - Minimum_value) / 100;
+    if (range_shown < temp)
+        range_shown = temp;
 }
 
-instr_scale ::
-  instr_scale( const instr_scale & image ) :
-            instr_item( (const instr_item &) image),
-            range_shown  ( image.range_shown   ),
-            Maximum_value( image.Maximum_value ),
-            Minimum_value( image.Minimum_value ),
-            scale_factor ( image.scale_factor  ),
-            Maj_div      ( image.Maj_div       ),
-            Min_div      ( image.Min_div       ),
-            Modulo       ( image.Modulo        ),
-            signif_digits( image.signif_digits )
+
+instr_scale::instr_scale( const instr_scale & image ) :
+    instr_item( (const instr_item &) image),
+    range_shown  ( image.range_shown   ),
+    Maximum_value( image.Maximum_value ),
+    Minimum_value( image.Minimum_value ),
+    scale_factor ( image.scale_factor  ),
+    Maj_div      ( image.Maj_div       ),
+    Min_div      ( image.Min_div       ),
+    Modulo       ( image.Modulo        ),
+    signif_digits( image.signif_digits )
 {
 }
 
 
-instr_scale :: ~ instr_scale () {}
+instr_scale::~instr_scale ()
+{
+}
+
 
index 5a8f9bf34dba83a1b66e0fb79a85e161451a0375..4dfdf8a97ae04c4afbcbf1a00f24f8d8f9341c8d 100644 (file)
@@ -5,39 +5,41 @@
 
 //============ Top of fgTBI_instr class member definitions ==============
 
-fgTBI_instr ::
-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      tsivalue, //suma
-                        float     radius) : //suma
-               dual_instr_item( x, y, width, height,
-                                chn1_source,
-                                chn2_source,
-                                working,
-                                HUDS_TOP),
-               BankLimit      ((int)(maxBankAngle)),
-               SlewLimit      ((int)(maxSlipAngle)),
-               scr_hole       (gap_width   )
+fgTBI_instr::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      tsivalue,
+        float     radius) :
+    dual_instr_item( x, y, width, height,
+                     chn1_source,
+                     chn2_source,
+                     working,
+                     HUDS_TOP),
+    BankLimit ((int)(maxBankAngle)),
+    SlewLimit ((int)(maxSlipAngle)),
+    scr_hole  (gap_width)
 {
-       tsi=tsivalue; //suma   
-       rad=radius; //suma
+    tsi=tsivalue;
+    rad=radius;
 }
 
-fgTBI_instr :: ~fgTBI_instr() {}
 
-fgTBI_instr :: fgTBI_instr( const fgTBI_instr & image):
-                 dual_instr_item( (const dual_instr_item &) image),
-                 BankLimit( image.BankLimit),
-                 SlewLimit( image.SlewLimit),
-                 scr_hole ( image.scr_hole )
+fgTBI_instr::~fgTBI_instr() {}
+
+
+fgTBI_instr::fgTBI_instr(const fgTBI_instr & image) :
+    dual_instr_item( (const dual_instr_item &) image),
+    BankLimit( image.BankLimit),
+    SlewLimit( image.SlewLimit),
+    scr_hole ( image.scr_hole )
 {
 }
 
@@ -46,243 +48,220 @@ fgTBI_instr :: fgTBI_instr( const fgTBI_instr & image):
 //  Draws a Turn Bank Indicator on the screen
 //
 
- void fgTBI_instr :: draw( void )
+void fgTBI_instr :: draw( void )
 {
-     float bank_angle, sideslip_angle;
-     float ss_const; // sideslip angle pixels per rad
-     float cen_x, cen_y, bank, fspan, tee, hole;
-
-     int span = get_span();
-     
-     float zero = 0.0;
-  
-     RECT My_box = get_location();
-     POINT centroid = get_centroid();
-     int tee_height = My_box.bottom;
-        
-     bank_angle     = current_ch2();  // Roll limit +/- 30 degrees
-     
-     if( bank_angle < -SGD_PI_2/3 ) 
-        {
-         bank_angle = -SGD_PI_2/3;
-     }
-        else if( bank_angle > SGD_PI_2/3 ) 
-        {
-             bank_angle = SGD_PI_2/3;
-     }
-     
-         
-        sideslip_angle = current_ch1(); // Sideslip limit +/- 20 degrees
-
-     if( sideslip_angle < -SGD_PI/9 ) 
-        {
-         sideslip_angle = -SGD_PI/9;
-     }
-        else if( sideslip_angle > SGD_PI/9 ) 
-        {
-             sideslip_angle = SGD_PI/9;
-     }
-
-     cen_x = centroid.x;
-     cen_y = centroid.y;
-     
-     bank  = bank_angle * SGD_RADIANS_TO_DEGREES;
-        tee   = -tee_height;
-     fspan = span;
-     hole  = scr_hole;
-     ss_const = 2 * sideslip_angle * fspan/(SGD_2PI/9);  // width represents 40 degrees
-     
-//   printf("side_slip: %f   fspan: %f\n", sideslip_angle, fspan);
-//   printf("ss_const: %f   hole: %f\n", ss_const, hole);
-     
-       
-     glPushMatrix();
-     glTranslatef(cen_x, cen_y, zero);
-     glRotatef(-bank, zero, zero, 1.0);
-    
-        if(!tsi)
-        {
-                
-               glBegin(GL_LINES);
-            
-               if( !scr_hole )  
-               {
-                       glVertex2f( -fspan, zero );
-                       glVertex2f(  fspan, zero );
-               } 
-               else
-               {
-                       glVertex2f( -fspan, zero );
-                       glVertex2f( -hole,  zero );
-                       glVertex2f(  hole,  zero );
-                       glVertex2f(  fspan, zero );
-               }
-               // draw teemarks
-               glVertex2f(  hole, zero );
-               glVertex2f(  hole, tee );
-               glVertex2f( -hole, zero );
-               glVertex2f( -hole, tee );
-            
-               glEnd();
-     
-               glBegin(GL_LINE_LOOP);
-                       glVertex2f( ss_const,        -hole);
-                       glVertex2f( ss_const + hole,  zero);
-                       glVertex2f( ss_const,         hole);
-                       glVertex2f( ss_const - hole,  zero);
-               glEnd();
-
-
-        }
-        
-
-        else //if tsi enabled
-        {
-                 // float factor = My_box.right / 6.0;
-
-                drawOneLine(cen_x-1.0, My_box.top,      cen_x+1.0, My_box.top);
-                drawOneLine(cen_x-1.0, My_box.top,      cen_x-1.0, My_box.top+10.0);
-                drawOneLine(cen_x+1.0, My_box.top,      cen_x+1.0, My_box.top+10.0);
-                drawOneLine(cen_x-1.0, My_box.top+10.0, cen_x+1.0, My_box.top+10.0);
-
-        float x1, y1, x2, y2, x3, y3, x4,y4, x5, y5;
-                float xc, yc, r=rad, r1= rad-10.0, r2=rad-5.0;
-                
-                xc = My_box.left + My_box.right/ 2.0 ;
-                yc = My_box.top + r;
+    float bank_angle, sideslip_angle;
+    float ss_const; // sideslip angle pixels per rad
+    float cen_x, cen_y, bank, fspan, tee, hole;
+
+    int span = get_span();
+    float zero = 0.0;
+
+    RECT My_box = get_location();
+    POINT centroid = get_centroid();
+    int tee_height = My_box.bottom;
+
+    bank_angle     = current_ch2();  // Roll limit +/- 30 degrees
+
+    if ( bank_angle < -SGD_PI_2/3 )
+        bank_angle = -SGD_PI_2/3;
+    else if ( bank_angle > SGD_PI_2/3 )
+        bank_angle = SGD_PI_2/3;
+
+
+    sideslip_angle = current_ch1(); // Sideslip limit +/- 20 degrees
+
+    if ( sideslip_angle < -SGD_PI/9 )
+        sideslip_angle = -SGD_PI/9;
+    else if ( sideslip_angle > SGD_PI/9 )
+            sideslip_angle = SGD_PI/9;
+
+    cen_x = centroid.x;
+    cen_y = centroid.y;
+
+    bank  = bank_angle * SGD_RADIANS_TO_DEGREES;
+    tee   = -tee_height;
+    fspan = span;
+    hole  = scr_hole;
+    ss_const = 2 * sideslip_angle * fspan/(SGD_2PI/9);  // width represents 40 degrees
+
+//  printf("side_slip: %f   fspan: %f\n", sideslip_angle, fspan);
+//  printf("ss_const: %f   hole: %f\n", ss_const, hole);
+
+
+    glPushMatrix();
+    glTranslatef(cen_x, cen_y, zero);
+    glRotatef(-bank, zero, zero, 1.0);
+
+    if (!tsi) {
+
+       glBegin(GL_LINES);
+
+       if ( !scr_hole ) {
+           glVertex2f( -fspan, zero );
+           glVertex2f(  fspan, zero );
+
+       } else {
+           glVertex2f( -fspan, zero );
+           glVertex2f( -hole,  zero );
+           glVertex2f(  hole,  zero );
+           glVertex2f(  fspan, zero );
+       }
+       // draw teemarks
+       glVertex2f(  hole, zero );
+       glVertex2f(  hole, tee );
+       glVertex2f( -hole, zero );
+       glVertex2f( -hole, tee );
+       glEnd();
+
+       glBegin(GL_LINE_LOOP);
+       glVertex2f( ss_const,        -hole);
+       glVertex2f( ss_const + hole,  zero);
+       glVertex2f( ss_const,         hole);
+       glVertex2f( ss_const - hole,  zero);
+       glEnd();
+
+    } else { //if tsi enabled
+        // float factor = My_box.right / 6.0;
+
+        drawOneLine(cen_x-1.0, My_box.top,      cen_x+1.0, My_box.top);
+        drawOneLine(cen_x-1.0, My_box.top,      cen_x-1.0, My_box.top+10.0);
+        drawOneLine(cen_x+1.0, My_box.top,      cen_x+1.0, My_box.top+10.0);
+        drawOneLine(cen_x-1.0, My_box.top+10.0, cen_x+1.0, My_box.top+10.0);
+
+        float x1, y1, x2, y2, x3, y3, x4,y4, x5, y5;
+        float xc, yc, r=rad, r1= rad-10.0, r2=rad-5.0;
+
+        xc = My_box.left + My_box.right/ 2.0 ;
+        yc = My_box.top + r;
 
 //first n last lines
-                 x1= xc + r * cos (255.0 * SGD_DEGREES_TO_RADIANS);
-                 y1= yc + r * sin (255.0 * SGD_DEGREES_TO_RADIANS);
+        x1= xc + r * cos (255.0 * SGD_DEGREES_TO_RADIANS);
+        y1= yc + r * sin (255.0 * SGD_DEGREES_TO_RADIANS);
+
+        x2= xc + r1 * cos (255.0 * SGD_DEGREES_TO_RADIANS);
+        y2= yc + r1 * sin (255.0 * SGD_DEGREES_TO_RADIANS);
 
-                 x2= xc + r1 * cos (255.0 * SGD_DEGREES_TO_RADIANS);
-                 y2= yc + r1 * sin (255.0 * SGD_DEGREES_TO_RADIANS);
-                 
-                 drawOneLine(x1,y1,x2,y2);
+        drawOneLine(x1,y1,x2,y2);
 
-                 x1= xc + r * cos (285.0 * SGD_DEGREES_TO_RADIANS);
-                 y1= yc + r * sin (285.0 * SGD_DEGREES_TO_RADIANS);
+          x1= xc + r * cos (285.0 * SGD_DEGREES_TO_RADIANS);
+        y1= yc + r * sin (285.0 * SGD_DEGREES_TO_RADIANS);
 
-                 x2= xc + r1 * cos (285.0 * SGD_DEGREES_TO_RADIANS);
-                 y2= yc + r1 * sin (285.0 * SGD_DEGREES_TO_RADIANS);
+        x2= xc + r1 * cos (285.0 * SGD_DEGREES_TO_RADIANS);
+        y2= yc + r1 * sin (285.0 * SGD_DEGREES_TO_RADIANS);
 
-          drawOneLine(x1,y1,x2,y2);
+        drawOneLine(x1,y1,x2,y2);
 
 //second n fifth  lines
 
-                 x1= xc + r * cos (260.0 * SGD_DEGREES_TO_RADIANS);
-                 y1= yc + r * sin (260.0 * SGD_DEGREES_TO_RADIANS);
-                 
-                 x2= xc + r2 * cos (260.0 * SGD_DEGREES_TO_RADIANS);
-                 y2= yc + r2 * sin (260.0 * SGD_DEGREES_TO_RADIANS);
-                 
-                 drawOneLine(x1,y1,x2,y2);
+        x1= xc + r * cos (260.0 * SGD_DEGREES_TO_RADIANS);
+        y1= yc + r * sin (260.0 * SGD_DEGREES_TO_RADIANS);
+
+        x2= xc + r2 * cos (260.0 * SGD_DEGREES_TO_RADIANS);
+        y2= yc + r2 * sin (260.0 * SGD_DEGREES_TO_RADIANS);
+
+        drawOneLine(x1,y1,x2,y2);
+
+        x1= xc + r * cos (280.0 * SGD_DEGREES_TO_RADIANS);
+        y1= yc + r * sin (280.0 * SGD_DEGREES_TO_RADIANS);
 
-                 x1= xc + r * cos (280.0 * SGD_DEGREES_TO_RADIANS);
-                 y1= yc + r * sin (280.0 * SGD_DEGREES_TO_RADIANS);
 
-                 
-                 x2= xc + r2 * cos (280.0 * SGD_DEGREES_TO_RADIANS);
-                 y2= yc + r2 * sin (280.0 * SGD_DEGREES_TO_RADIANS);
+        x2= xc + r2 * cos (280.0 * SGD_DEGREES_TO_RADIANS);
+        y2= yc + r2 * sin (280.0 * SGD_DEGREES_TO_RADIANS);
 
-          drawOneLine(x1,y1,x2,y2);
+        drawOneLine(x1,y1,x2,y2);
 
 //third n fourth lines
 
 
-                 x1= xc + r * cos (265.0 * SGD_DEGREES_TO_RADIANS);
-                 y1= yc + r * sin (265.0 * SGD_DEGREES_TO_RADIANS);
-
-                 
-                 x2= xc + r2 * cos (265.0 * SGD_DEGREES_TO_RADIANS);
-                 y2= yc + r2 * sin (265.0 * SGD_DEGREES_TO_RADIANS);
-                 
-                 drawOneLine(x1,y1,x2,y2);
-
-                 x1= xc + r * cos (275.0 * SGD_DEGREES_TO_RADIANS);
-                 y1= yc + r * sin (275.0 * SGD_DEGREES_TO_RADIANS);
-                 
-                 x2= xc + r2 * cos (275.0 * SGD_DEGREES_TO_RADIANS);
-                 y2= yc + r2 * sin (275.0 * SGD_DEGREES_TO_RADIANS);
-
-          drawOneLine(x1,y1,x2,y2);
-
-                 //to draw marker
-                 
-                 
-               
-                         float  valbank, valsideslip, sideslip;
-                        
-                         r = rad + 5.0;  //5 is added to get a gap 
-                        // upper polygon
-              bank_angle     = current_ch2();
-
-                         bank= bank_angle * SGD_RADIANS_TO_DEGREES;  // Roll limit +/- 30 degrees
-                         if(bank > BankLimit)
-                                       bank = BankLimit;
-                         if(bank < -1.0*BankLimit)
-                                       bank = -1.0*BankLimit;
-
-                         valbank = bank * 15.0 / BankLimit; // total span of TSI is 30 degrees
-                         
-                         sideslip_angle = current_ch1(); // Sideslip limit +/- 20 degrees
-                         sideslip= sideslip_angle * SGD_RADIANS_TO_DEGREES;  
-                         if(sideslip > SlewLimit)
-                                 sideslip = SlewLimit;
-                         if(sideslip < -1.0*SlewLimit)
-                                 sideslip = -1.0*SlewLimit;
-              valsideslip = sideslip * 15.0 / SlewLimit;
-                         
-                         //values 270, 225 and 315 are angles in degrees...
-
-                         x1= xc + r * cos ((valbank+270.0) * SGD_DEGREES_TO_RADIANS);
-                         y1= yc + r * sin ((valbank+270.0) * SGD_DEGREES_TO_RADIANS);
-
-                         x2= x1 + 6.0 * cos (225 * SGD_DEGREES_TO_RADIANS);
-                         y2= y1 + 6.0 * sin (225 * SGD_DEGREES_TO_RADIANS);
-                         
-                         x3= x1 + 6.0 * cos (315 * SGD_DEGREES_TO_RADIANS);
-                         y3= y1 + 6.0 * sin (315 * SGD_DEGREES_TO_RADIANS);
-
-                     drawOneLine(x1, y1, x2, y2);
-                         drawOneLine(x2, y2, x3, y3);
-                         drawOneLine(x3, y3, x1, y1);
-
-                         //lower polygon...
-                        
-                        
-                         
-                         x1= xc + r * cos ((valbank+270.0) * SGD_DEGREES_TO_RADIANS);
-                         y1= yc + r * sin ((valbank+270.0) * SGD_DEGREES_TO_RADIANS);
-
-                         x2= x1 + 6.0 * cos (225 * SGD_DEGREES_TO_RADIANS);
-                         y2= y1 + 6.0 * sin (225 * SGD_DEGREES_TO_RADIANS);
-                         
-                         x3= x1 + 6.0 * cos (315 * SGD_DEGREES_TO_RADIANS);
-                         y3= y1 + 6.0 * sin (315 * SGD_DEGREES_TO_RADIANS);
-
-                         x4= x1 + 10.0 * cos (225 * SGD_DEGREES_TO_RADIANS);
-                         y4= y1 + 10.0 * sin (225 * SGD_DEGREES_TO_RADIANS);
-                         
-                         x5= x1 + 10.0 * cos (315 * SGD_DEGREES_TO_RADIANS);
-                         y5= y1 + 10.0 * sin (315 * SGD_DEGREES_TO_RADIANS);
-
-                         x2 = x2 + cos (valsideslip * SGD_DEGREES_TO_RADIANS);
-                     y2 = y2 + sin (valsideslip * SGD_DEGREES_TO_RADIANS);
-                         x3 = x3 + cos (valsideslip * SGD_DEGREES_TO_RADIANS);
-                         y3 = y3 + sin (valsideslip * SGD_DEGREES_TO_RADIANS);
-                         x4 = x4 + cos (valsideslip * SGD_DEGREES_TO_RADIANS);
-                         y4 = y4 + sin (valsideslip * SGD_DEGREES_TO_RADIANS);
-                         x5 = x5 + cos (valsideslip * SGD_DEGREES_TO_RADIANS);
-                         y5 = y5 + sin (valsideslip * SGD_DEGREES_TO_RADIANS);
-
-                         drawOneLine(x2, y2, x3, y3); 
-                         drawOneLine(x3, y3, x5, y5);
-                         drawOneLine(x5, y5, x4, y4);
-                         drawOneLine(x4, y4, x2, y2);  
-                        
-        }
-
-               glPopMatrix();
+        x1= xc + r * cos (265.0 * SGD_DEGREES_TO_RADIANS);
+        y1= yc + r * sin (265.0 * SGD_DEGREES_TO_RADIANS);
+
+
+        x2= xc + r2 * cos (265.0 * SGD_DEGREES_TO_RADIANS);
+        y2= yc + r2 * sin (265.0 * SGD_DEGREES_TO_RADIANS);
+
+        drawOneLine(x1,y1,x2,y2);
+
+        x1= xc + r * cos (275.0 * SGD_DEGREES_TO_RADIANS);
+        y1= yc + r * sin (275.0 * SGD_DEGREES_TO_RADIANS);
+
+        x2= xc + r2 * cos (275.0 * SGD_DEGREES_TO_RADIANS);
+        y2= yc + r2 * sin (275.0 * SGD_DEGREES_TO_RADIANS);
+
+        drawOneLine(x1,y1,x2,y2);
+
+        //to draw marker
+
+
+
+        float  valbank, valsideslip, sideslip;
+
+        r = rad + 5.0;  //5 is added to get a gap
+        // upper polygon
+        bank_angle     = current_ch2();
+
+        bank= bank_angle * SGD_RADIANS_TO_DEGREES;  // Roll limit +/- 30 degrees
+        if (bank > BankLimit)
+            bank = BankLimit;
+        if (bank < -1.0*BankLimit)
+            bank = -1.0*BankLimit;
+
+        valbank = bank * 15.0 / BankLimit; // total span of TSI is 30 degrees
+
+        sideslip_angle = current_ch1(); // Sideslip limit +/- 20 degrees
+        sideslip= sideslip_angle * SGD_RADIANS_TO_DEGREES;
+        if (sideslip > SlewLimit)
+            sideslip = SlewLimit;
+        if (sideslip < -1.0*SlewLimit)
+            sideslip = -1.0*SlewLimit;
+        valsideslip = sideslip * 15.0 / SlewLimit;
+
+        //values 270, 225 and 315 are angles in degrees...
+        x1= xc + r * cos ((valbank+270.0) * SGD_DEGREES_TO_RADIANS);
+        y1= yc + r * sin ((valbank+270.0) * SGD_DEGREES_TO_RADIANS);
+
+        x2= x1 + 6.0 * cos (225 * SGD_DEGREES_TO_RADIANS);
+        y2= y1 + 6.0 * sin (225 * SGD_DEGREES_TO_RADIANS);
+
+        x3= x1 + 6.0 * cos (315 * SGD_DEGREES_TO_RADIANS);
+        y3= y1 + 6.0 * sin (315 * SGD_DEGREES_TO_RADIANS);
+
+        drawOneLine(x1, y1, x2, y2);
+        drawOneLine(x2, y2, x3, y3);
+        drawOneLine(x3, y3, x1, y1);
+
+        //lower polygon...
+        x1= xc + r * cos ((valbank+270.0) * SGD_DEGREES_TO_RADIANS);
+        y1= yc + r * sin ((valbank+270.0) * SGD_DEGREES_TO_RADIANS);
+
+        x2= x1 + 6.0 * cos (225 * SGD_DEGREES_TO_RADIANS);
+        y2= y1 + 6.0 * sin (225 * SGD_DEGREES_TO_RADIANS);
+
+        x3= x1 + 6.0 * cos (315 * SGD_DEGREES_TO_RADIANS);
+        y3= y1 + 6.0 * sin (315 * SGD_DEGREES_TO_RADIANS);
+
+        x4= x1 + 10.0 * cos (225 * SGD_DEGREES_TO_RADIANS);
+        y4= y1 + 10.0 * sin (225 * SGD_DEGREES_TO_RADIANS);
+
+        x5= x1 + 10.0 * cos (315 * SGD_DEGREES_TO_RADIANS);
+        y5= y1 + 10.0 * sin (315 * SGD_DEGREES_TO_RADIANS);
+
+        x2 = x2 + cos (valsideslip * SGD_DEGREES_TO_RADIANS);
+        y2 = y2 + sin (valsideslip * SGD_DEGREES_TO_RADIANS);
+        x3 = x3 + cos (valsideslip * SGD_DEGREES_TO_RADIANS);
+        y3 = y3 + sin (valsideslip * SGD_DEGREES_TO_RADIANS);
+        x4 = x4 + cos (valsideslip * SGD_DEGREES_TO_RADIANS);
+        y4 = y4 + sin (valsideslip * SGD_DEGREES_TO_RADIANS);
+         x5 = x5 + cos (valsideslip * SGD_DEGREES_TO_RADIANS);
+        y5 = y5 + sin (valsideslip * SGD_DEGREES_TO_RADIANS);
+
+        drawOneLine(x2, y2, x3, y3);
+        drawOneLine(x3, y3, x5, y5);
+        drawOneLine(x5, y5, x4, y4);
+        drawOneLine(x4, y4, x2, y2);
+    }
+    glPopMatrix();
 }
+
+
index 15170c786c0f7f96ea321972d2c29e37bc20c2ba..5f7580e3fde97d9fd9a1f5aa425c4fa57f2b2266 100644 (file)
@@ -92,13 +92,13 @@ get_aspect_adjust (int xsize, int ysize)
 bool
 fgPanelVisible ()
 {
-     if(globals->get_current_panel() == 0)
+     if (globals->get_current_panel() == 0)
        return false;
-     if(globals->get_current_panel()->getVisibility() == 0)
+     if (globals->get_current_panel()->getVisibility() == 0)
        return false;
-     if(globals->get_viewmgr()->get_current() != 0)
+     if (globals->get_viewmgr()->get_current() != 0)
        return false;
-     if(globals->get_current_view()->getHeadingOffset_deg() * SGD_DEGREES_TO_RADIANS != 0)
+     if (globals->get_current_view()->getHeadingOffset_deg() * SGD_DEGREES_TO_RADIANS != 0)
        return false;
      return true;
 }
@@ -371,7 +371,7 @@ FGPanel::draw()
   glEnable(GL_COLOR_MATERIAL);
   glEnable(GL_CULL_FACE);
   glCullFace(GL_BACK);
-  if( _enable_depth_test )
+  if ( _enable_depth_test )
       glDepthFunc(GL_ALWAYS);
   else
     glDisable(GL_DEPTH_TEST);
@@ -442,7 +442,7 @@ FGPanel::draw()
 
 
   // restore some original state
-  if( _enable_depth_test )
+  if ( _enable_depth_test )
     glDepthFunc(GL_LESS);
   glPopAttrib();
   glPolygonOffset(0, 0);
@@ -873,7 +873,7 @@ FGInstrumentLayer::transform () const
        val = t->max;
       }
 
-      if(t->table==0) {
+      if (t->table==0) {
        val = val * t->factor + t->offset;
       } else {
        val = t->table->interpolate(val) * t->factor + t->offset;
index 04f7352334a26a48dbe01337b8f5b2905dd42824..6be0dbfd792eff54c941420c3a3a76e18845f153 100644 (file)
@@ -21,9 +21,9 @@
 #ifndef __PANEL_HXX
 #define __PANEL_HXX
 
-#ifndef __cplusplus                                                          
+#ifndef __cplusplus
 # error This library requires C++
-#endif                                   
+#endif
 
 
 #ifdef HAVE_CONFIG_H
index 6fd0f23d60d0ef0d93ea1e3e7097d927af2be8f4..ac57ef8c8c6e4775eb5e9da0d168da45039344a3 100644 (file)
@@ -289,7 +289,7 @@ readTransformation (const SGPropertyNode * node, float w_scale, float h_scale)
     SG_LOG( SG_COCKPIT, SG_INFO, "Found interpolation table with "
             << trans_table->nChildren() << "children" );
     t->table = new SGInterpTable();
-    for(int i = 0; i < trans_table->nChildren(); i++) {
+    for (int i = 0; i < trans_table->nChildren(); i++) {
       const SGPropertyNode * node = trans_table->getChild(i);
       if (!strcmp(node->getName(), "entry")) {
        double ind = node->getDoubleValue("ind", 0.0);
@@ -769,10 +769,10 @@ readPanel (const SGPropertyNode * root)
         FGPanelInstrument * instrument = readInstrument(node);
         if (instrument != 0)
           panel->addInstrument(instrument);
-      } else if(!strcmp(node->getName(), "special-instrument")) {
+      } else if (!strcmp(node->getName(), "special-instrument")) {
         //cout << "Special instrument found in instruments section!\n";
         const string name = node->getStringValue("name");
-        if(name == "KLN89 GPS") {
+        if (name == "KLN89 GPS") {
           //cout << "Special instrument is KLN89\n";
           
           int x = node->getIntValue("x", -1);
@@ -804,7 +804,7 @@ readPanel (const SGPropertyNode * root)
           // Warning - hardwired size!!!
           RenderArea2D* instrument = new RenderArea2D(158, 40, 158, 40, x, y);
           KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
-                 if(gps == NULL) {
+                 if (gps == NULL) {
                          gps = new KLN89(instrument);
                          globals->add_subsystem("kln89", gps);
                  }