]> git.mxchange.org Git - flightgear.git/commitdiff
a) HUD - Here is the updated hud code with moving pointers, dials, turn/slip gauge...
authorcurt <curt>
Wed, 19 Sep 2001 22:23:25 +0000 (22:23 +0000)
committercurt <curt>
Wed, 19 Sep 2001 22:23:25 +0000 (22:23 +0000)
13 files changed:
src/Cockpit/Makefile.am
src/Cockpit/cockpit.cxx
src/Cockpit/hud.cxx
src/Cockpit/hud.hxx
src/Cockpit/hud_card.cxx
src/Cockpit/hud_gaug.cxx [new file with mode: 0644]
src/Cockpit/hud_inst.cxx
src/Cockpit/hud_labl.cxx
src/Cockpit/hud_ladr.cxx
src/Cockpit/hud_lat.cxx
src/Cockpit/hud_lon.cxx
src/Cockpit/hud_scal.cxx
src/Cockpit/hud_tbi.cxx

index 332a10d886625ca95887ec86d97447fb949026b1..fb57ac7db2441bcc0cc456cfa73d818e1c919d1a 100644 (file)
@@ -3,7 +3,7 @@ noinst_LIBRARIES = libCockpit.a
 libCockpit_a_SOURCES = \
        cockpit.cxx cockpit.hxx \
        hud.cxx hud.hxx hud_opts.hxx \
-       hud_card.cxx hud_dnst.cxx hud_guag.cxx hud_inst.cxx \
+       hud_card.cxx hud_dnst.cxx hud_gaug.cxx hud_inst.cxx \
        hud_labl.cxx hud_ladr.cxx \
        hud_lat.cxx hud_lon.cxx \
        hud_scal.cxx hud_tbi.cxx \
index f8e822b3f0303188fa3a9482af211b0a80663159..2c84e573decbf7f4d90992c104cbe041de232a42 100644 (file)
@@ -64,18 +64,12 @@ static pCockpit ac_cockpit;
 
 float get_latitude( void )
 {
-    double lat;
-
-    lat = current_aircraft.fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES;
-
-    float flat = lat;
-    return(flat);
-
+    return current_aircraft.fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES;
 }
 
 float get_lat_min( void )
 {
-    double      a, d;
+    double a, d;
 
     a = current_aircraft.fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES;    
     if (a < 0.0) {
@@ -83,18 +77,14 @@ float get_lat_min( void )
     }
     d = (double) ( (int) a);
     float lat_min = (a - d) * 60.0;
-    return(lat_min );
+
+    return lat_min;
 }
 
 
 float get_longitude( void )
 {
-    double lon;
-
-    lon = current_aircraft.fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES;
-
-    float flon = lon;
-    return(flon);
+    return current_aircraft.fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES;
 }
 
 
@@ -106,6 +96,7 @@ get_formated_gmt_time( void )
     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);
+
     return buf;
 }
 
@@ -119,37 +110,34 @@ float get_long_min( void )
     }
     d = (double) ( (int) a);
     float lon_min = (a - d) * 60.0; 
-    return(lon_min);
+
+    return lon_min;
 }
 
 float get_throttleval( void )
 {
-    float throttle = globals->get_controls()->get_throttle( 0 );
-    return (throttle);     // Hack limiting to one engine
+    // Hack limiting to one engine
+    return globals->get_controls()->get_throttle( 0 );
 }
 
 float get_aileronval( void )
 {
-    float aileronval = globals->get_controls()->get_aileron();
-    return (aileronval);
+    return globals->get_controls()->get_aileron();
 }
 
 float get_elevatorval( void )
 {
-    float elevator_val = (float)globals->get_controls()->get_elevator();
-    return elevator_val;
+    return globals->get_controls()->get_elevator();
 }
 
 float get_elev_trimval( void )
 {
-    float elevatorval = globals->get_controls()->get_elevator_trim();
-    return (elevatorval);
+    return globals->get_controls()->get_elevator_trim();
 }
 
 float get_rudderval( void )
 {
-    float rudderval = globals->get_controls()->get_rudder();
-    return (rudderval);
+    return globals->get_controls()->get_rudder();
 }
 
 float get_speed( void )
@@ -164,32 +152,27 @@ float get_speed( void )
 
 float get_mach(void)
 {
-       float mach=current_aircraft.fdm_state->get_Mach_number();
-       return mach;
+    return current_aircraft.fdm_state->get_Mach_number();
 }      
 
 float get_aoa( void )
 {
-    float aoa = current_aircraft.fdm_state->get_Alpha() * SGD_RADIANS_TO_DEGREES;
-    return( aoa );
+    return current_aircraft.fdm_state->get_Alpha() * SGD_RADIANS_TO_DEGREES;
 }
 
 float get_roll( void )
 {
-    float roll = current_aircraft.fdm_state->get_Phi();
-    return( roll );
+    return current_aircraft.fdm_state->get_Phi();
 }
 
 float get_pitch( void )
 {
-    float pitch = current_aircraft.fdm_state->get_Theta();
-    return( pitch );
+    return current_aircraft.fdm_state->get_Theta();
 }
 
 float get_heading( void )
 {
-    float heading = (current_aircraft.fdm_state->get_Psi() * SGD_RADIANS_TO_DEGREES);
-    return( heading );
+    return current_aircraft.fdm_state->get_Psi() * SGD_RADIANS_TO_DEGREES;
 }
 
 float get_altitude( void )
@@ -220,25 +203,23 @@ float get_agl( void )
         agl = (current_aircraft.fdm_state->get_Altitude() * SG_FEET_TO_METER
                - scenery.cur_elev);
     }
+
     return agl;
 }
 
 float get_sideslip( void )
 {
-    float sideslip = current_aircraft.fdm_state->get_Beta();
-    return( sideslip );
+    return current_aircraft.fdm_state->get_Beta();
 }
 
 float get_frame_rate( void )
 {
-    float frame_rate = general.get_frame_rate();
-    return (frame_rate); 
+    return general.get_frame_rate();
 }
 
 float get_fov( void )
 {
-    float fov = globals->get_current_view()->get_fov(); 
-    return (fov);
+    return globals->get_current_view()->get_fov(); 
 }
 
 float get_vfc_ratio( void )
@@ -270,7 +251,8 @@ float get_climb_rate( void )
     } else {
         climb_rate = current_aircraft.fdm_state->get_Climb_Rate() * SG_FEET_TO_METER * 60.0;
     }
-    return (climb_rate);
+
+    return climb_rate;
 }
 
 
@@ -292,230 +274,230 @@ float get_view_direction( void )
 // #ifdef FIGHTER_HUD
 float get_Vx   ( void )
 {
-    // CLO - 5 Jan 2000 - something needs to get addressed here
-    // float Vxx = current_aircraft.fdm_state->get_V_north_rel_ground();
-    float Vxx = 0;
-    return (Vxx);
+    // Curt dont comment this and return zero. - Ranga
+    // Please remove comments from get_V_..() function in flight.hxx
+    float Vxx = current_aircraft.fdm_state->get_V_north_rel_ground();
+    return Vxx;
 }
 
 float get_Vy   ( void )
 {
-    // CLO - 5 Jan 2000 - something needs to get addressed here
-    // float Vyy = current_aircraft.fdm_state->get_V_east_rel_ground();
-    float Vyy = 0;
-    return (Vyy);
+    // Curt dont comment this and return zero. - Ranga
+    // Please remove comments from get_V_..() function in flight.hxx
+    float Vyy = current_aircraft.fdm_state->get_V_east_rel_ground();
+    return Vyy;
 }
 
 float get_Vz   ( void )
 {
-    // CLO - 5 Jan 2000 - something needs to get addressed here
-    // float Vzz = current_aircraft.fdm_state->get_V_down_rel_ground();
-    float Vzz = 0;
-    return (Vzz);
+    // Curt dont comment this and return zero. - Ranga
+    // Please remove comments from get_V_..() function in flight.hxx
+    float Vzz = current_aircraft.fdm_state->get_V_down_rel_ground();
+    return Vzz;
 }
 
 float get_Ax   ( void )
 {
     float Ax = current_aircraft.fdm_state->get_V_dot_north();
-    return (Ax);
+    return Ax;
 }
 
 float get_Ay   ( void )
 {
     float Ay = current_aircraft.fdm_state->get_V_dot_east();
-    return (Ay);
+    return Ay;
 }
 
 float get_Az   ( void )
 {
     float Az = current_aircraft.fdm_state->get_V_dot_down();
-    return (Az);
+    return Az;
 }
 
 float get_anzg   ( void )
 {
     float anzg = current_aircraft.fdm_state->get_N_Z_cg();
-    return (anzg);
+    return anzg;
 }
 
 int get_iaux1 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_iaux1();
+    return fdm->get_iaux(1);
 }
 
 int get_iaux2 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_iaux2();
+    return fdm->get_iaux(2);
 }
 
 int get_iaux3 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_iaux3();
+    return fdm->get_iaux(3);
 }
 
 int get_iaux4 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_iaux4();
+    return fdm->get_iaux(4);
 }
 
 int get_iaux5 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_iaux5();
+    return fdm->get_iaux(5);
 }
 
 int get_iaux6 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_iaux6();
+    return fdm->get_iaux(6);
 }
 
 int get_iaux7 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_iaux7();
+    return fdm->get_iaux(7);
 }
 
 int get_iaux8 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_iaux8();
+    return fdm->get_iaux(8);
 }
 
 int get_iaux9 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_iaux9();
+    return fdm->get_iaux(9);
 }
 
 int get_iaux10 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_iaux10();
+    return fdm->get_iaux(10);
 }
 
 int get_iaux11 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_iaux11();
+    return fdm->get_iaux(11);
 }
 
 int get_iaux12 (void)
 {
      FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-     return fdm->get_iaux12();
+     return fdm->get_iaux(12);
 }
 
 float get_aux1 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_aux1();
+    return fdm->get_daux(1);
 }
 
 float get_aux2 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_aux2();
+    return fdm->get_daux(2);
 }
 
 float get_aux3 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_aux3();
+    return fdm->get_daux(3);
 }
 
 float get_aux4 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_aux4();
+    return fdm->get_daux(4);
 }
 
 float get_aux5 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_aux5();
+    return fdm->get_daux(5);
 }
 
 float get_aux6 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_aux6();
+    return fdm->get_daux(6);
 }
 
 float get_aux7 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_aux7();
+    return fdm->get_daux(7);
 }
 
 float get_aux8 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_aux8();
+    return fdm->get_daux(8);
 }
 
 float get_aux9 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_aux9();
+    return fdm->get_faux(1);
 }
 
 float get_aux10 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_aux10();
+    return fdm->get_faux(2);
 }
 
 float get_aux11 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_aux11();
+    return fdm->get_faux(3);
 }
 
 float get_aux12 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_aux12();
+    return fdm->get_faux(4);
 }
 
 float get_aux13 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_aux13();
+    return fdm->get_faux(5);
 }
 
 float get_aux14 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_aux14();
+    return fdm->get_faux(6);
 }
 
 float get_aux15 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_aux15();
+    return fdm->get_faux(7);
 }
 
 float get_aux16 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_aux16();
+    return fdm->get_faux(8);
 }
 
 float get_aux17 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_aux17();
+    return fdm->get_faux(9);
 }
 
 float get_aux18 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    return fdm->get_aux18();
+    return fdm->get_faux(10);
 }
 // #endif
 // $$$ end - added, VS Renganathan 13 Oct 2K
index c4f8d2c50ec60a34c58ee16b4f62bcfb71b28150..b8d607ed8150b5d88ed80392bcece07db5ec5ea8 100644 (file)
@@ -52,7 +52,6 @@
 #include <GUI/gui.h>
 #include <Main/globals.hxx>
 #include <Main/fg_props.hxx>
-#include <Main/viewmgr.hxx>
 #ifdef FG_NETWORK_OLK
 #include <NetworkOLK/network.h>
 #endif
@@ -144,6 +143,19 @@ 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 FLTFNPTR load_fn;    
 static fgLabelJust justification;
@@ -200,7 +212,8 @@ void drawOneLine( RECT &rect)
 //
    /* textString - Bitmap font string */
 
-void textString( int x, int y, char *msg, void *font ){
+void textString( int x, int y, char *msg, void *font,int digit) //suma
+{
 
     if(*msg)
     {
@@ -293,6 +306,10 @@ 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
+                               hat                             = node->getIntValue("hat");
+
 
                                SG_LOG(SG_INPUT, SG_INFO, "Done reading instrument " << name);
        
@@ -304,7 +321,7 @@ readLadder(const SGPropertyNode * node)
                                                                                screen_hole, lbl_pos, frl_spot, target, vel_vector, 
                                                                                drift, alpha, energy, climb_dive, 
                                                                                glide, glide_slope_val, worm_energy, 
-                                                                               waypoint, working);
+                                                                               waypoint, working, zenith, nadir, hat);
                                
                                return p;
                
@@ -342,13 +359,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
                                working                 = node->getBoolValue("working");
-
+                radius                 = node->getFloatValue("radius"); //suma
+                               divisions               = node->getIntValue("divisions"); //suma
+                               zoom                    = node->getIntValue("zoom"); //suma
 
                                SG_LOG(SG_INPUT, SG_INFO, "Done reading instrument " << name);
 
 
-                               if(type=="guage")
+                               if(type=="gauge")
                                        span_units = maxValue - minValue;
 
                                if(loadfn=="anzg")
@@ -412,7 +433,13 @@ readCard(const SGPropertyNode * node)
                                                                                                                marker_off,
                                                                                                                enable_pointer,
                                                                                                                type_pointer,
-                                                                                                               working);
+                                                                                                               type_tick,//hud
+                                                                                                               length_tick,//hud
+                                                                                                               working,
+                                                                                                               radius, //suma
+                                                                                                               divisions, //suma
+                                                                                                               zoom  //suma
+                                                                                                               );
                                        return p;
 }// end readCard
 
@@ -438,7 +465,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
         working             = node->getBoolValue("working");
+               digits                          = node->getIntValue("digits"); //suma
 
 
         SG_LOG(SG_INPUT, SG_INFO, "Done reading instrument " << name);
@@ -480,26 +509,42 @@ readLabel(const SGPropertyNode * node)
             }
         }
 
-        if ( loadfn == "aux16" ) {
-            load_fn = get_aux16;
-        } else if ( loadfn == "aux17" ) {
-            load_fn = get_aux17;
+               if ( loadfn== "aux1" ) {
+                        load_fn = get_aux1;
+        } else if ( loadfn == "aux2" ) {
+            load_fn = get_aux2;
+        } else if ( loadfn == "aux3" ) {
+            load_fn = get_aux3;
+        } else if ( loadfn == "aux4" ) {
+            load_fn = get_aux4;
+        } else if ( loadfn == "aux5" ) {
+            load_fn = get_aux5;
+        } else if ( loadfn == "aux6" ) {
+            load_fn = get_aux6;
+        } else if ( loadfn == "aux7" ) {
+            load_fn = get_aux7;
+        } else if ( loadfn == "aux8" ) {
+            load_fn = get_aux8;
         } else if ( loadfn == "aux9" ) {
             load_fn = get_aux9;
+        } else if ( loadfn == "aux10" ) {
+            load_fn = get_aux10;
         } else if ( loadfn == "aux11" ) {
             load_fn = get_aux11;
         } else if ( loadfn == "aux12" ) {
             load_fn = get_aux12;
-        } else if ( loadfn == "aux10" ) {
-            load_fn = get_aux10;
         } else if ( loadfn == "aux13" ) {
             load_fn = get_aux13;
         } else if ( loadfn == "aux14" ) {
             load_fn = get_aux14;
         } else if ( loadfn == "aux15" ) {
             load_fn = get_aux15;
-        } else if ( loadfn == "aux8" ) {
-            load_fn = get_aux8;
+               } else if ( loadfn == "aux16" ) {
+            load_fn = get_aux16;
+        } else if ( loadfn == "aux17" ) {
+            load_fn = get_aux17;
+        } else if ( loadfn == "aux18" ) {
+            load_fn = get_aux18;
         } else if ( loadfn == "ax" ) {
             load_fn = get_Ax;
         } else if ( loadfn == "speed" ) {
@@ -524,9 +569,13 @@ readLabel(const SGPropertyNode * node)
             load_fn = get_aoa;
         } else if ( loadfn == "latitude" ) {
             load_fn  = get_latitude;
+               } else if ( loadfn == "anzg" ) {
+                       load_fn = get_anzg;
         } else if ( loadfn == "longitude" ) {
             load_fn   = get_longitude;
-        }
+        } else if (loadfn=="throttleval") {
+                       load_fn = get_throttleval;
+               }
 
         p = (instr_item *) new instr_label ( x,
                                              y,
@@ -543,7 +592,9 @@ readLabel(const SGPropertyNode * node)
                                              blinking,
                                              latitude,
                                              longitude,
-                                             working);
+                                                                                        label_box, //hud
+                                             working,
+                                                                                        digits); //suma
 
         return p;
 } // end readLabel
@@ -563,6 +614,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
 
         SG_LOG(SG_INPUT, SG_INFO, "Done reading instrument " << name);
 
@@ -576,7 +629,9 @@ readTBI(const SGPropertyNode * node)
                                                 maxBankAngle, 
                                                 maxSlipAngle,
                                                 gap_width,
-                                                working);
+                                                working,
+                                                                                               tsi, //suma
+                                                                                               rad); //suma
 
         return p;
 } //end readTBI
@@ -680,13 +735,13 @@ int readHud( istream &input )
 
 
         SGPropertyNode root2;
-       try {
-         readProperties(path.str(), &root2);
-       } catch (const sg_exception &e) {
-         guiErrorMessage("Error reading HUD instrument: ", e);
-         continue;
-       }
-       readInstrument(&root2);
+        try {
+            readProperties(path.str(), &root2);
+        } catch (const sg_exception &e) {
+            guiErrorMessage("Error reading HUD instrument: ", e);
+            continue;
+        } 
+        readInstrument(&root2);
     }//for loop(i)
 
     return 0;
@@ -1033,7 +1088,6 @@ void fgUpdateHUD( GLfloat x_start, GLfloat y_start,
 //       glEnable(GL_BLEND);
          glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
          glHint(GL_LINE_SMOOTH_HINT,GL_DONT_CARE);
-//       glHint(GL_LINE_SMOOTH_HINT,GL_NICEST);
          glLineWidth(1.5);
   } else {
          glLineWidth(1.0);
@@ -1104,7 +1158,7 @@ void fgUpdateHUD( GLfloat x_start, GLfloat y_start,
   }
 
   char *gmt_str = get_formated_gmt_time();
-  HUD_TextList.add( fgText(40, 10, gmt_str) );
+  HUD_TextList.add( fgText(40, 10, gmt_str, 0) );
 
 #ifdef FG_NETWORK_OLK
   if ( net_hud_display ) {
index aa8dc81d49136ded1aba6a4f37d61181ef6b2ba9..8d6871a9f9283ecd63733a4cce8f0417804fd69d 100644 (file)
@@ -48,6 +48,7 @@
 
 #include <vector>       // STL vector
 #include <deque>        // STL double ended queue
+#include STL_FSTREAM
 
 #include <simgear/constants.h>
 
@@ -56,6 +57,8 @@
 #include <FDM/flight.hxx>
 #include <Controls/controls.hxx>
 #include <GUI/gui.h>
+#include <Main/globals.hxx>
+#include <Main/viewmgr.hxx>
 
 #include "hud_opts.hxx"
 
@@ -218,6 +221,7 @@ extern float get_aux3(void);
 extern float get_aux4(void);
 extern float get_aux5 (void);
 extern float get_aux6 (void);
+extern float get_aux7 (void);
 extern float get_aux8(void);
 extern float get_aux9(void);
 extern float get_aux10(void);
@@ -240,7 +244,7 @@ enum  hudinstype{ HUDno_instr,
               HUDladder,
               HUDcirc_ladder,
               HUDhorizon,
-              HUDguage,
+              HUDgauge,
               HUDdual_inst,
               HUDmoving_scale,
               HUDtbi
@@ -286,15 +290,19 @@ private:
     float x, y;
     char msg[64];
 public:
-    fgText( float x = 0, float y = 0, char *c = NULL )
-        : x(x), y(y) {strncpy(msg,c,64-1);}
-
+    int digit; //suma
+    fgText(float x = 0, float y = 0, char *c = NULL,int digits=0): x(x), y(y) //suma
+    { 
+        strcpy(msg,c);
+        digit=digits; //suma
+    }
+                  
     fgText( const fgText & image )
-        : x(image.x), y(image.y) {strcpy(msg,image.msg);}
+        : x(image.x), y(image.y),digit(image.digit) {strcpy(msg,image.msg);} //suma
 
     fgText& operator = ( const fgText & image ) {
-        strcpy(msg,image.msg); x = image.x; y = image.y;
-        return *this;
+        strcpy(msg,image.msg); x = image.x; y = image.y;digit=image.digit; //suma
+        return *this;   
     }
 
     ~fgText() {msg[0]='\0';}
@@ -320,12 +328,57 @@ public:
         }
         return 0 ;
     }
-    
-    void Draw(fntRenderer *fnt)
-    {
-        fnt->start2f( x, y );
-        fnt->puts   ( msg ) ;
+   
+    // 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
+
+    void Draw(fntRenderer *fnt,int digits) {
+        if(digits==1) {
+            int c=0,i=0;
+            char *t=msg;
+            int p=4;
+
+            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'))  
+                    c++;
+                i++;
+            }
+            if(c>p) {
+                fnt->setPointSize(8);
+                int p1=c-3;
+                char *tmp1=msg+p1;
+                int p2=p1*8;
+                         
+                fnt->start2f(x+p2,y);
+                fnt->puts(tmp1);
+
+                fnt->setPointSize(12);
+                char tmp2[p1+1];
+                strncpy(tmp2,msg,p1);
+                tmp2[p1]='\0';
+                        
+                fnt->start2f(x,y);
+                fnt->puts(tmp2);
+            } else {
+                fnt->setPointSize(12);                                 
+                fnt->start2f( x, y );
+                fnt->puts(tmp);
+            }
+        } else {
+            //if digits not equal to 1
+            fnt->setPointSize(8);         
+            fnt->start2f( x, y );
+            fnt->puts( msg ) ;
+        }
     }
+    //end suma
 
     void Draw()
     {
@@ -389,7 +442,7 @@ public:
 
         Font->begin();
         for( ; curString != lastString; curString++ ) {
-            curString->Draw(Font);
+            curString->Draw(Font,curString->digit); //suma
         }
         Font->end();
 
@@ -437,7 +490,8 @@ class instr_item {  // An Abstract Base Class (ABC)
     bool               broken;
     UINT               scr_span;      // Working values for draw;
     POINT              mid_span;      //
-
+    int                       digits;        //suma
+  
   public:
     instr_item( int            x,
                 int            y,
@@ -446,7 +500,9 @@ class instr_item {  // An Abstract Base Class (ABC)
                 FLTFNPTR       data_source,
                 float          data_scaling,
                 UINT           options,
-                bool           working  = true);
+                bool           working  = true,
+                int           digit = 0); //suma
+
 
     instr_item( const instr_item & image );
 
@@ -463,6 +519,7 @@ class instr_item {  // An Abstract Base Class (ABC)
     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
 
     UINT    huds_vert     (UINT options) { return( options  & HUDS_VERT ); }
     UINT    huds_left     (UINT options) { return( options  & HUDS_LEFT ); }
@@ -490,9 +547,9 @@ class instr_item {  // An Abstract Base Class (ABC)
     {
         HUD_StippleLineList.add(fgLineSeg2D(x1,y1,x2,y2));
     }
-    void TextString( char *msg, float x, float y )
+    void TextString( char *msg, float x, float y,int digit ) //suma
     {
-        HUD_TextList.add(fgText(x, y, msg));        
+        HUD_TextList.add(fgText(x, y, msg,digit)); //suma  
     }
     int getStringWidth ( char *str )
     {
@@ -504,6 +561,18 @@ class instr_item {  // An Abstract Base Class (ABC)
         }
         return 0 ;
     }
+
+    //code to draw ticks as small circles
+    void drawOneCircle(float x1, float y1, float r)
+    {
+        glBegin(GL_LINE_LOOP);  // Use polygon to approximate a circle 
+        for(int count=0; count<25; count++) {             
+            float cosine = r * cos(count * 2 * M_PI/10.0); 
+            float sine =   r * sin(count * 2 * M_PI/10.0); 
+            glVertex2f(cosine+x1, sine+y1);
+        }     
+        glEnd(); 
+    }
     
 };
 
@@ -532,6 +601,7 @@ class instr_label : public instr_item {
     char format_buffer[80];
     bool               lat;
     bool               lon;
+    bool               lbox;
 
   public:
     instr_label( int          x,
@@ -547,9 +617,11 @@ class instr_label : public instr_item {
                  fgLabelJust  justification,
                  int          font_size,
                  int          blinking,
-                bool             latitude,
-                bool             longitude,
-                 bool         working);
+                 bool            latitude,
+                 bool            longitude,
+                 bool            label_box,
+                 bool         working,
+                 int          digit ); //suma);
 
     ~instr_label();
 
@@ -573,19 +645,20 @@ class lat_label : public instr_item {
 
   public:
     lat_label( int          x,
-                 int          y,
-                 UINT         width,
-                 UINT         height,
-                 FLTFNPTR     data_source,
-                 const char  *label_format,
-                 const char  *pre_label_string,
-                 const char  *post_label_string,
-                 float       scale_data,
-                 UINT         options,
-                 fgLabelJust  justification,
-                 int          font_size,
-                 int          blinking,
-                 bool         working);
+               int          y,
+               UINT         width,
+               UINT         height,
+               FLTFNPTR     data_source,
+               const char  *label_format,
+               const char  *pre_label_string,
+               const char  *post_label_string,
+               float       scale_data,
+               UINT         options,
+               fgLabelJust  justification,
+               int          font_size,
+               int          blinking,
+               bool         working,
+               int         digits =0 );//suma
 
     ~lat_label();
 
@@ -608,19 +681,21 @@ class lon_label : public instr_item {
 
   public:
     lon_label( int          x,
-                 int          y,
-                 UINT         width,
-                 UINT         height,
-                 FLTFNPTR     data_source,
-                 const char  *label_format,
-                 const char  *pre_label_string,
-                 const char  *post_label_string,
-                 float       scale_data,
-                 UINT         options,
-                 fgLabelJust  justification,
-                 int          font_size,
-                 int          blinking,
-                 bool         working);
+               int          y,
+               UINT         width,
+               UINT         height,
+               FLTFNPTR     data_source,
+               const char  *label_format,
+               const char  *pre_label_string,
+               const char  *post_label_string,
+               float       scale_data,
+               UINT         options,
+               fgLabelJust  justification,
+               int          font_size,
+               int          blinking,
+               bool         working,
+               int         digit=0); //suma
+
 
     ~lon_label();
 
@@ -700,7 +775,16 @@ class hud_card : public instr_scale {
     float marker_offset;
     bool  pointer;
     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
+       
     
   public:
     hud_card( int      x,
@@ -729,20 +813,29 @@ class hud_card : public instr_scale {
              float    marker_offset,
              bool     pointer,
              string   pointer_type,
-              bool     working);
+              string  tick_type,
+              string  tick_length,
+              bool     working,
+              float    radius, //suma
+              int      divisions, //suma
+              int         zoom); //suma
+
 
     ~hud_card();
     hud_card( const hud_card & image);
     hud_card & operator = (const hud_card & rhs );
 //    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
 };
 
 typedef hud_card * pCardScale;
 
-class guage_instr : public instr_scale {
+class gauge_instr : public instr_scale {
   public:
-    guage_instr( int       x,
+    gauge_instr( int       x,
                  int       y,
                  UINT      width,
                  UINT      height,
@@ -757,13 +850,13 @@ class guage_instr : public instr_scale {
                  UINT      modulus,
                  bool      working);
 
-    ~guage_instr();
-    guage_instr( const guage_instr & image);
-    guage_instr & operator = (const guage_instr & rhs );
+    ~gauge_instr();
+    gauge_instr( const gauge_instr & image);
+    gauge_instr & operator = (const gauge_instr & rhs );
     virtual void draw( void );       // Required method in base class
 };
 
-typedef guage_instr * pGuageInst;
+typedef gauge_instr * pGaugeInst;
 //
 // dual_instr_item         This class was created to form the base class
 //                         for both panel and HUD Turn Bank Indicators.
@@ -791,11 +884,14 @@ class dual_instr_item : public instr_item {
     virtual void draw ( void ) { }
 };
 
-class fgTBI_instr : public dual_instr_item {
+class fgTBI_instr : public dual_instr_item 
+{
   private:
     UINT BankLimit;
     UINT SlewLimit;
     UINT scr_hole;
+    bool tsi;  //suma
+    float rad; //suma
 
   public:
     fgTBI_instr( int       x,
@@ -807,7 +903,9 @@ class fgTBI_instr : public dual_instr_item {
                  float    maxBankAngle,
                  float    maxSlipAngle,
                  UINT      gap_width,
-                 bool      working);
+                 bool      working,
+                 bool     tsi, //suma
+                 float     rad); //suma
 
     fgTBI_instr( const fgTBI_instr & image);
     fgTBI_instr & operator = (const fgTBI_instr & rhs );
@@ -844,6 +942,10 @@ class HudLadder : public dual_instr_item {
     float      glide_slope;
     bool       energy_worm;
     bool       waypoint_marker;
+    int     zenith; //suma
+    int     nadir; //suma
+    int                hat; //suma
+    
 
     fgTextList         TextList;
     fgLineList         LineList;
@@ -874,14 +976,20 @@ class HudLadder : public dual_instr_item {
               float     glide_slope,
               bool      energy_worm,
               bool      waypoint_marker,
-               bool      working);
+               bool  working,
+               int   zenith, //suma
+               int   nadir, //suma
+               int   hat); //suma
+
 
     ~HudLadder();
 
     HudLadder( const HudLadder & image );
     HudLadder & operator = ( const HudLadder & rhs );
     virtual void draw( void );
-    
+    void drawZenith(float,float,float); //suma
+    void drawNadir(float, float, float); //suma
+
     void Text( float x, float y, char *s)
     {
         TextList.add( fgText( x, y, s) );
@@ -915,7 +1023,7 @@ extern void drawOneLine ( RECT &rect);
 extern void textString  ( int x,
                           int y,
                           char *msg,
-                          void *font = GLUT_BITMAP_8_BY_13);
+                          void *font = GLUT_BITMAP_9_BY_15,int digit=0); //suma
 extern void strokeString( int x,
                           int y,
                           char *msg,
index 79fd0433f15c3873452f9c91b70e32eb804ec809..62d606a4efd6f71c5cf8dafdc07a8b518a242a36 100644 (file)
@@ -1,13 +1,20 @@
-
+#include <plib/sg.h>
 #include "hud.hxx"
 
 #ifdef USE_HUD_TextList
-#define textString( x , y, text, font )  TextString( text, x , y )
+#define textString( x , y, text, font,digit)  TextString( text, x , y ,digit ) //suma
 #else
-#define textString( x , y, text, font )  puDrawString ( guiFnt, text, x, y );
+#define textString( x , y, text, font,digit )  puDrawString ( guiFnt, text, x, y ); //suma
 #endif
 
 //========== Top of hud_card class member definitions =============
+//begin suma
+#include<GL/glut.h> 
+#include<math.h>
+#include <stdlib.h>
+#include <stdio.h>
+//end suma
+
 
 hud_card ::
 hud_card( int       x,
@@ -36,7 +43,13 @@ hud_card( int       x,
          float     mark_offset,
          bool      pointer_enable,
          string    type_pointer,
-          bool      working) :
+         string    type_tick,//hud
+         string    length_tick,//hud
+      bool      working,
+         float     rad,//suma
+         int           divs, //suma
+         int           zooms //suma
+            ) :  //suma
                 instr_scale( x,y,width,height,
                              data_source, options,
                              value_span,
@@ -55,10 +68,20 @@ hud_card( int       x,
                                draw_cap_left    (cap_left),
                                marker_offset    (mark_offset),
                                pointer          (pointer_enable),
-                               pointer_type     (type_pointer)
+                               pointer_type     (type_pointer),
+                               tick_type                (type_tick), //hud
+                               tick_length              (length_tick), //hud
+                               Maj_div                  (major_divs), //suma
+                               Min_div                  (minor_divs) //suma
 
 {
   half_width_units = range_to_show() / 2.0;
+  radius=rad; //suma
+  maxValue=max_value; //suma
+  minValue=min_value; //suma
+  divisions=divs; //suma
+  zoom = zooms; //suma
+
 //  UINT options     = get_options();
 //  huds_both = (options & HUDS_BOTH) == HUDS_BOTH;
 //  huds_right = options & HUDS_RIGHT;
@@ -88,7 +111,11 @@ hud_card( const hud_card & image):
     draw_cap_left (image.draw_cap_left),
     marker_offset (image.marker_offset),
     pointer (image.pointer),
-    pointer_type (image.pointer_type)
+    pointer_type (image.pointer_type),
+    tick_type(image.tick_type), //hud
+    tick_length(image.tick_length), //hud
+       Maj_div(image.Maj_div), //suma
+       Min_div(image.Min_div)//suma
 
 {
 //  UINT options     = get_options();
@@ -120,6 +147,11 @@ operator = (const hud_card & rhs )
        type             = rhs.type;
        pointer                  = rhs.pointer;
        pointer_type     = rhs.pointer_type;
+       tick_type                = rhs.tick_type;
+       tick_length              = rhs.tick_length;
+       Maj_div                  = rhs.Maj_div; //suma
+       Min_div                  = rhs.Min_div; //suma
+
     }
 
     return *this;
@@ -141,457 +173,1189 @@ draw( void ) //  (HUD_scale * pscale )
     char TextScale[80];
     bool condition;
     int disp_val = 0;
+    int oddtype, k; //odd or even values for ticks
 
     POINT mid_scr    = get_centroid();
     float cur_value  = get_value();
+    
+       if (!((int)maxValue%2) )
+               oddtype =0; //draw ticks at even values
+       else
+               oddtype = 1;//draw ticks at odd values
+
     RECT   scrn_rect = get_location();
     UINT options     = get_options();
 
     height = scrn_rect.top  + scrn_rect.bottom;
     width = scrn_rect.left + scrn_rect.right;
-    marker_xs = scrn_rect.left;  // x start
 
-    if(type=="gauge") {
+   //begin suma
+       // if type=gauge then display dial
+    if(type=="gauge") 
+       {
+        float x,y;
+               float i;
+               int  decimal, sign;
+               y=(float)(scrn_rect.top);
+        x=(float)(scrn_rect.left);
+               glEnable(GL_POINT_SMOOTH);
+               glPointSize(3.0);
 
-        vmin   = min_val();
-        vmax   = max_val();
-        text_y = scrn_rect.top + FloatToInt((cur_value - vmin) * factor() /*+.5f*/);
-        text_x = marker_xs;
-    } else {
-        if(type=="tape") {
+           float incr= 360.0/divisions;  
+               for(i=0.0;i<360.0;i+=incr)
+               {   float i1=i*SGD_DEGREES_TO_RADIANS;
+                       float x1=x+radius*cos(i1);
+                       float y1=y+radius*sin(i1);
                
+                       glBegin(GL_POINTS);
+                          glVertex2f(x1,y1);
+                       glEnd();
+               }
+               glPointSize(1.0);
+               glDisable(GL_POINT_SMOOTH);
+        
+        
+               if(data_available())
+               {  
+                  float offset = 90.0*SGD_DEGREES_TO_RADIANS;
+                  float r1=10.0; //size of carrot
+           float theta= get_value();
+
+                  float theta1= -theta*SGD_DEGREES_TO_RADIANS+offset;
+                  float x1=x+radius*cos(theta1);
+                  float y1=y+radius*sin(theta1);
+           float x2=x1-r1*cos(theta1-30.0*SGD_DEGREES_TO_RADIANS);
+           float y2=y1-r1*sin(theta1-30.0*SGD_DEGREES_TO_RADIANS);
+           float x3=x1-r1*cos(theta1+30.0*SGD_DEGREES_TO_RADIANS);
+           float y3=y1-r1*sin(theta1+30.0*SGD_DEGREES_TO_RADIANS);
+                      
+                  // draw carrot  
+                  drawOneLine(x1,y1,x2,y2);
+                  drawOneLine(x1,y1,x3,y3);
+                  sprintf(TextScale,"%3.1f\n",theta);
+                
+                  // draw value
+                  int l= abs((int)theta);
+                  if((l>=0) && (l<=9))
+                                textString (x,y,TextScale,GLUT_BITMAP_8_BY_13,0 );
+                  if((l>=10) && (l<=99))
+                                textString (x-1.0,y,TextScale,GLUT_BITMAP_8_BY_13,0 );
+           if((l>=100) && (l<=359))
+                                textString (x-2.0,y,TextScale,GLUT_BITMAP_8_BY_13,0 ); 
+                        
+               }
+      
+    }  //end type=gauge
+    else // if its not explicitly a gauge default to tape
+       {
+          if(pointer)  
+          { 
+                 if(pointer_type=="moving")    
+                 { 
+                                vmin = minValue;
+                                vmax = maxValue;
+                 }
+                 else // default to fixed
+                 {
+              
+                vmin   = cur_value - half_width_units; // width units == needle travel
+                vmax   = cur_value + half_width_units; // or picture unit span.
+                text_x = mid_scr.x;
+                text_y = mid_scr.y;
+                 }
+          } else {
             vmin   = cur_value - half_width_units; // width units == needle travel
             vmax   = cur_value + half_width_units; // or picture unit span.
             text_x = mid_scr.x;
             text_y = mid_scr.y;
-        }
-    }
+          }
+    
   
     // Draw the basic markings for the scale...
   
-    if( huds_vert(options) ) { // Vertical scale
-        if (draw_tick_bottom) {
-            drawOneLine( scrn_rect.left,     // Bottom tick bar
+               if( huds_vert(options) ) { // Vertical scale
+                       if (draw_tick_bottom) {
+                               drawOneLine( scrn_rect.left,     // Bottom tick bar
                          scrn_rect.top,
                          width,
                          scrn_rect.top);
-        } // endif draw_tick_bottom
-        if (draw_tick_top) {
-            drawOneLine( scrn_rect.left,    // Top tick bar
+                       } // endif draw_tick_bottom
+                       if (draw_tick_top) {
+                               drawOneLine( scrn_rect.left,    // Top tick bar
                          height,
                          width,
                          height );
-        } // endif draw_tick_top
+                       } // endif draw_tick_top
       
-        marker_xs = scrn_rect.left;  // x start
-        marker_xe = width;  // x extent
-        marker_ye = height;
+                       marker_xs = scrn_rect.left;  // x start
+                       marker_xe = width;  // x extent
+                       marker_ye = height;
 
-       //    glBegin(GL_LINES);
+                       //    glBegin(GL_LINES);
       
-        // Bottom tick bar
-       //    glVertex2f( marker_xs, scrn_rect.top);
-       //    glVertex2f( marker_xe, scrn_rect.top);
+                       // Bottom tick bar
+                       //    glVertex2f( marker_xs, scrn_rect.top);
+                       //    glVertex2f( marker_xe, scrn_rect.top);
 
-                 // Top tick bar
-       //    glVertex2f( marker_xs, marker_ye);
-       //    glVertex2f( marker_xe, marker_ye );
-       //    glEnd();
+                       // Top tick bar
+                       //    glVertex2f( marker_xs, marker_ye);
+                       //    glVertex2f( marker_xe, marker_ye );
+                       //    glEnd();
 
 
-        // We do not use else in the following so that combining the
-        // two options produces a "caged" display with double
-        // carrots. The same is done for horizontal card indicators.
-
-        if( huds_left(options) ) {    // Calculate x marker offset
+                       // We do not use else in the following so that combining the
+                       // two options produces a "caged" display with double
+                       // carrots. The same is done for horizontal card indicators.
+        
+                       // begin vertical/left
+                       //First draw capping lines and pointers
+                       if( huds_left(options) ) {    // Calculate x marker offset
                        
-            if (draw_cap_right) {
+                               if (draw_cap_right) {
                          
-                drawOneLine( marker_xe, scrn_rect.top,
+                                       drawOneLine( marker_xe, scrn_rect.top,
                              marker_xe, marker_ye); // Cap right side
-            } //endif cap_right
-
-            marker_xs  = marker_xe - scrn_rect.right / 3;   // Adjust tick xs
-
-            // drawOneLine( marker_xs, mid_scr.y,
-            //              marker_xe, mid_scr.y + scrn_rect.right / 6);
-            // drawOneLine( marker_xs, mid_scr.y,
-            //              marker_xe, mid_scr.y - scrn_rect.right / 6);
-
-            // draw pointer
-            if(pointer)        {
-                if(pointer_type=="fixed")      {
-                    glBegin(GL_LINE_STRIP);
-                    glVertex2f( marker_offset+marker_xe, text_y + scrn_rect.right / 6);
-                    glVertex2f( marker_offset+marker_xs, text_y);
-                    glVertex2f( marker_offset+marker_xe, text_y - scrn_rect.right / 6);
-                    glEnd();
-                } else {
-                    if(pointer_type=="moving") {
-                        //Code for Moving Type Pointer to be included.
-                    }
-                }
-            }
-        }
+                               } //endif cap_right
+
+                               marker_xs  = marker_xe - scrn_rect.right / 3;   // Adjust tick xs
+
+                               // drawOneLine( marker_xs, mid_scr.y,
+                               //              marker_xe, mid_scr.y + scrn_rect.right / 6);
+                               // drawOneLine( marker_xs, mid_scr.y,
+                               //              marker_xe, mid_scr.y - scrn_rect.right / 6);
+
+                               // draw pointer
+                               if(pointer)     
+                               {
+                                       if(pointer_type=="moving")
+                                       {
+                                               if(zoom == 0)
+                                               {
+                                                       //Code for Moving Type Pointer included by suma.
+                                                       static float ycentre, ypoint,xpoint;
+                                                       static int range,wth;
+                                                       if(cur_value > maxValue) cur_value = maxValue;
+                                                       if(cur_value < minValue) cur_value = minValue;
+                                                       if (minValue >= 0.0) 
+                                                               ycentre = scrn_rect.top;
+                                                       else if (maxValue + minValue == 0.0)
+                                                               ycentre = mid_scr.y;
+                                                       else
+                                                               if (oddtype == 1) 
+                                                                       ycentre = scrn_rect.top + (1.0-minValue)*scrn_rect.bottom/(maxValue-minValue);
+                                                               else
+                                                                       ycentre = scrn_rect.top + minValue*scrn_rect.bottom/(maxValue-minValue);
+                                                       range = scrn_rect.bottom;
+                                                       wth   = scrn_rect.left + scrn_rect.right;
+                                                       if (oddtype == 1)
+                                                               ypoint = ycentre + ((cur_value-1.0) * range / val_span);
+                                                       else
+                                                               ypoint = ycentre + (cur_value * range / val_span);
+                                                       xpoint = wth + marker_offset;
+                                                       drawOneLine(xpoint,ycentre,xpoint,ypoint);
+                                                       drawOneLine(xpoint,ypoint,xpoint-marker_offset,ypoint);
+                                                       drawOneLine(xpoint-marker_offset,ypoint,xpoint-5.0,ypoint+5.0);
+                                                       drawOneLine(xpoint-marker_offset,ypoint,xpoint-5.0,ypoint-5.0);
+                                               }//zoom=0
+                                       } else  // default to fixed
+                                       {
+                                               fixed(marker_offset+marker_xe, text_y + scrn_rect.right / 6, 
+                                           marker_offset+marker_xs, text_y,marker_offset+marker_xe, 
+                                               text_y - scrn_rect.right / 6);
+                                       }//end pointer type
+                               } //if pointer 
+                       }  //end vertical/left
                
-        if( huds_right(options) ) {  // We'll default this for now.
-            if (draw_cap_left) {
-                drawOneLine( scrn_rect.left, scrn_rect.top,
+                       // begin vertical/right
+                       //First draw capping lines and pointers
+                       if( huds_right(options) ) {  // We'll default this for now.
+                               if (draw_cap_left) {
+                                       drawOneLine( scrn_rect.left, scrn_rect.top,
                              scrn_rect.left, marker_ye );  // Cap left side
-            } //endif cap_left
-
-            marker_xe = scrn_rect.left + scrn_rect.right / 3;     // Adjust tick xe
-            // Indicator carrot
-            // drawOneLine( scrn_rect.left, mid_scr.y +  scrn_rect.right / 6,
-            //              marker_xe, mid_scr.y );
-            // drawOneLine( scrn_rect.left, mid_scr.y -  scrn_rect.right / 6,
-            //              marker_xe, mid_scr.y);
+                               } //endif cap_left
+
+                               marker_xe = scrn_rect.left + scrn_rect.right / 3;     // Adjust tick xe
+                               // Indicator carrot
+                               // drawOneLine( scrn_rect.left, mid_scr.y +  scrn_rect.right / 6,
+                               //              marker_xe, mid_scr.y );
+                               // drawOneLine( scrn_rect.left, mid_scr.y -  scrn_rect.right / 6,
+                               //              marker_xe, mid_scr.y);
                        
-            // draw pointer
-            if(pointer) {
-                if(pointer_type=="fixed")      {
-                    glBegin(GL_LINE_STRIP);
-                    glVertex2f( -marker_offset+scrn_rect.left, text_y +  scrn_rect.right / 6);
-                    glVertex2f( -marker_offset+marker_xe, text_y );
-                    glVertex2f( -marker_offset+scrn_rect.left, text_y -  scrn_rect.right / 6);
-                    glEnd();
-                }
-                else {
-                    if(pointer_type=="moving") {
-                        // Code for Moving Type Pointer to be included.
-                    }
-                }
-            }
-        }
-
-        // At this point marker x_start and x_end values are transposed.
-        // To keep this from confusing things they are now interchanged.
-        if(huds_both(options)) {
-            marker_ye = marker_xs;
-            marker_xs = marker_xe;
-            marker_xe = marker_ye;
-        }
-
-        // Work through from bottom to top of scale. Calculating where to put
-        // minor and major ticks.
-
-        // draw scale or tape
-       //  last = FloatToInt(vmax)+1;
-       //  i = FloatToInt(vmin);
-        last = (int)vmax + 1;
-        i = (int)vmin;
-        for( ; i <last ; i++ ) {
-            condition = true;
-            if( !modulo()) {
-                if( i < min_val()) {
-                    condition = false;
-                }
-            }
-
-            if( condition ) {  // Show a tick if necessary
-                // Calculate the location of this tick
-                marker_ys = scrn_rect.top + FloatToInt(((i - vmin) * factor()/*+.5f*/));
-                // marker_ys = scrn_rect.top + (int)((i - vmin) * factor() + .5);
-                // Block calculation artifact from drawing ticks below min coordinate.
-                // Calculation here accounts for text height.
-
-                if(( marker_ys < (scrn_rect.top + 4)) |
-                   ( marker_ys > (height - 4)))
-                {
-                    // Magic numbers!!!
-                    continue;
-                }
-                if( div_min()) {
-                    // if( (i%div_min()) == 0) {
-                    if( !(i%(int)div_min())) {            
-                        if((( marker_ys - 5) > scrn_rect.top ) &&
-                           (( marker_ys + 5) < (height))){
-                            if( huds_both(options) ) {
-                                drawOneLine( scrn_rect.left, marker_ys,
-                                             marker_xs,      marker_ys );
-                                drawOneLine( marker_xe,      marker_ys,
-                                             width,  marker_ys );
-                                // glBegin(GL_LINES);
-                                // glVertex2f( scrn_rect.left, marker_ys );
-                                // glVertex2f( marker_xs,      marker_ys );
-                                // glVertex2f( marker_xe,      marker_ys);
-                                // glVertex2f( scrn_rect.left + scrn_rect.right,  marker_ys );
-                                // glEnd();
-                            } else {
-                                if( huds_left(options) ) {
-                                    drawOneLine( marker_xs + 4, marker_ys,
-                                                 marker_xe,     marker_ys );
-                                } else {
-                                    drawOneLine( marker_xs,     marker_ys,
-                                                 marker_xe - 4, marker_ys );
-                                }
-                            }
-                        }
-                    }
-                }
-
-                if( div_max() ) {
-                    if( !(i%(int)div_max()) ) {
-                        if(modulo()) {
-                            if( disp_val < 0) {
-                                while(disp_val < 0)
-                                    disp_val += modulo();
-                            // } else {
-                            //   disp_val = i % (int)modulo();
-                            }
-                            disp_val = i % (int) modulo(); // ?????????
-                        } else {
-                            disp_val = i;
-                        }
-
-                        lenstr = sprintf( TextScale, "%d",
-                                          FloatToInt(disp_val * data_scaling()/*+.5*/));
-                        // (int)(disp_val  * data_scaling() +.5));
-                        if(( (marker_ys - 8 ) > scrn_rect.top ) &&
-                           ( (marker_ys + 8) < (height))){
-                            if( huds_both(options) ) {
-                                // drawOneLine( scrn_rect.left, marker_ys,
-                                //              marker_xs,      marker_ys);
-                                // drawOneLine( marker_xs, marker_ys,
-                                //              scrn_rect.left + scrn_rect.right,
-                                //              marker_ys);
-                                glBegin(GL_LINE_STRIP);
-                                glVertex2f( scrn_rect.left, marker_ys );
-                                glVertex2f( marker_xs, marker_ys);
-                                glVertex2f( width, marker_ys);
-                                glEnd();
-                                if( !huds_notext(options)) {
-                                    textString ( marker_xs + 2,  marker_ys,
-                                                 TextScale,  GLUT_BITMAP_8_BY_13 );
-                                }
-                            } else {
-                                drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
-                                if( !huds_notext(options) ) {
-                                    if( huds_left(options) )              {
-                                        textString( marker_xs -  8 * lenstr - 2,
+                               // draw pointer
+                               if(pointer) 
+                               {
+                                       if(pointer_type=="moving")      
+                                       {   
+                                               if(zoom == 0) //type-fixed & zoom=1, behaviour to be defined
+                                               {
+                                                       // Code for Moving Type Pointer included by suma.
+                                                       static float ycentre, ypoint,xpoint;
+                                                       static int range,wth;
+                                                       if(cur_value > maxValue) cur_value = maxValue;
+                                                       if(cur_value < minValue) cur_value = minValue;
+                                                       if (minValue >= 0.0) 
+                                                               ycentre = scrn_rect.top;
+                                                       else if (maxValue + minValue == 0.0)
+                                                               ycentre = mid_scr.y;
+                                                       else
+                                                               if (oddtype == 1) 
+                                                                       ycentre = scrn_rect.top + (1.0-minValue)*scrn_rect.bottom/(maxValue-minValue);
+                                                               else
+                                                                       ycentre = scrn_rect.top + minValue*scrn_rect.bottom/(maxValue-minValue);
+                                                       range = scrn_rect.bottom;
+                                                       if (oddtype == 1)
+                                                               ypoint = ycentre + ((cur_value-1.0) * range / val_span);
+                                                       else
+                                                               ypoint = ycentre + (cur_value * range / val_span);
+                                                       xpoint = scrn_rect.left - marker_offset;
+                                                       drawOneLine(xpoint,ycentre,xpoint,ypoint);
+                                                       drawOneLine(xpoint,ypoint,xpoint+marker_offset,ypoint);
+                                                       drawOneLine(xpoint+marker_offset,ypoint,xpoint+5.0,ypoint+5.0);
+                                                       drawOneLine(xpoint+marker_offset,ypoint,xpoint+5.0,ypoint-5.0);
+                                               }
+                                       }
+                                       else  // default to fixed
+                                       {
+                                               fixed( -marker_offset+scrn_rect.left, text_y +  scrn_rect.right / 6,
+                                                       -marker_offset+marker_xe, text_y,-marker_offset+scrn_rect.left, 
+                                                       text_y -  scrn_rect.right / 6);                    
+                                       }
+                               }//if pointer
+                       }  //end vertical/right
+
+                       // At this point marker x_start and x_end values are transposed.
+                       // To keep this from confusing things they are now interchanged.
+                       if(huds_both(options)) {
+                               marker_ye = marker_xs;
+                               marker_xs = marker_xe;
+                               marker_xe = marker_ye;
+                       }
+
+                       // Work through from bottom to top of scale. Calculating where to put
+                       // minor and major ticks.
+
+                       // draw scale or tape
+               
+                       last = FloatToInt(vmax)+1;
+                       i = FloatToInt(vmin);
+
+                       if(zoom ==1)
+                       { 
+                               zoomed_scale(vmin,vmax); //suma
+                       }
+                       else
+                       {
+
+                               for( ; i <last ; i++ ) 
+                               {
+                                       condition = true;
+                                       if( !modulo()) {
+                                               if( i < min_val()) {
+                                                       condition = false;
+                                               }
+                                       }
+
+                                       if( condition ) {  // Show a tick if necessary
+                                               // Calculate the location of this tick
+                                               marker_ys = scrn_rect.top + FloatToInt(((i - vmin) * factor()/*+.5f*/));
+                                               // marker_ys = scrn_rect.top + (int)((i - vmin) * factor() + .5);
+                                               // Block calculation artifact from drawing ticks below min coordinate.
+                                               // Calculation here accounts for text height.
+
+                                               /* if(( marker_ys < (scrn_rect.top + 4)) |
+                                               ( marker_ys > (height - 4)))
+                                               {
+                                               // Magic numbers!!!
+                                               continue;
+                                               } */
+
+                                               if (oddtype == 1) 
+                                                       k = i+1; //enable ticks at odd values
+                                               else
+                                                       k = i;
+
+                                               // Minor ticks
+                                               if( div_min()) 
+                                               { 
+                                                       // if( (i%div_min()) == 0) {
+                                                       if( !(k%(int)div_min())) 
+                                                       {             
+                                                               /*    if((( marker_ys - 5) > scrn_rect.top ) &&
+                                                               (( marker_ys + 5) < (height))){    */
+                            
+                                                               //vertical/left OR vertical/right
+                                                               if( huds_both(options) ) 
+                                                               {
+                                                                       if(tick_type=="line")
+                                                                       {
+                                                                               if(tick_length=="variable")
+                                                                               {
+                                                                                       drawOneLine( scrn_rect.left, marker_ys,
+                                                                                                               marker_xs,      marker_ys );
+                                                                                       drawOneLine( marker_xe,      marker_ys,
+                                                                                                               width,  marker_ys );
+                                                                               } 
+                                                                               else 
+                                                                               {
+                                                                                       drawOneLine( scrn_rect.left, marker_ys,
+                                                                                                               marker_xs,      marker_ys );
+                                                                                       drawOneLine( marker_xe,      marker_ys,
+                                                                                                               width,  marker_ys );
+                                                                               }
+                                                                       }
+                                                                       else if(tick_type=="circle") // begin suma  this func. is written below
+                                                                                    circles(scrn_rect.left,(float)marker_ys,3.0); //end suma
+
+                                                                       else // if neither line nor circle draw default as line
+                                                                       {
+                                                                               drawOneLine( scrn_rect.left, marker_ys,
+                                                                                                       marker_xs,      marker_ys );
+                                                                               drawOneLine( marker_xe,      marker_ys,
+                                                                                                       width,  marker_ys );
+                                                                       }
+                                                                               // glBegin(GL_LINES);
+                                                                               // glVertex2f( scrn_rect.left, marker_ys );
+                                                                               // glVertex2f( marker_xs,      marker_ys );
+                                                                               // glVertex2f( marker_xe,      marker_ys);
+                                                                               // glVertex2f( scrn_rect.left + scrn_rect.right,  marker_ys );
+                                                                               // glEnd();
+                                                                               // anything other than huds_both
+                                                               } else {
+                                                                       if( huds_left(options) ) {
+                                                                               if(tick_type=="line")
+                                                                               {
+                                                                                       if(tick_length=="variable")
+                                                                                       {
+                                                                                               drawOneLine( marker_xs + 4, marker_ys,
+                                                                                                                       marker_xe,     marker_ys );
+                                                                                       } 
+                                                                                       else
+                                                                                       {
+                                                                                               drawOneLine( marker_xs , marker_ys,
+                                                                                                                       marker_xe,     marker_ys );
+                                                                                       } 
+                                                                               } 
+                                                                               else if(tick_type=="circle") // begin suma
+                                                                                         circles((float)marker_xs + 4, (float)marker_ys,3.0); //end suma
+                                                                          
+                                                                               else
+                                                                               { 
+                                                                                       drawOneLine( marker_xs + 4, marker_ys,
+                                                                                                        marker_xe,     marker_ys );
+                                                                               } 
+                                                                       }  else {
+                                                                               if(tick_type=="line")
+                                                                               {
+                                                                                       if(tick_length=="variable")
+                                                                                       {
+                                                                                               drawOneLine( marker_xs,     marker_ys,
+                                                                                                                       marker_xe - 4, marker_ys );
+                                                                                       } 
+                                                                                       else
+                                                                                       { 
+                                                                                               drawOneLine( marker_xs,     marker_ys,
+                                                                                                                       marker_xe , marker_ys );
+                                                                                       } 
+                                                                               } 
+                                                                               else if(tick_type=="circle") //begin suma
+                                                                                        circles((float)marker_xe - 4, (float)marker_ys,3.0);  //end suma
+                                                                               else
+                                                                               { 
+                                                                                       drawOneLine( marker_xs,     marker_ys,
+                                                                                                               marker_xe - 4, marker_ys );
+                                                                               } 
+                                                                       } 
+                                                               } //end huds both 
+                                                       } //end draw minor ticks
+                                               }  //end minor ticks
+
+                                               // Major ticks
+                                               if( div_max() )
+                                               {
+                                       
+                                                       if( !(k%(int)div_max()) ) {
+                                                               if(modulo()) {
+                                                                       disp_val = i % (int) modulo(); // ?????????
+                                                                       if( disp_val < 0) {
+                                                                               while(disp_val < 0)
+                                                                                       disp_val += modulo();
+                                                                       }
+                                                               }  else {
+                                                                       disp_val = i;
+                                                               } 
+
+                                                               lenstr = sprintf( TextScale, "%d",
+                                                                                 FloatToInt(disp_val * data_scaling()/*+.5*/));
+                                                               // (int)(disp_val  * data_scaling() +.5));
+                                                               /* if(( (marker_ys - 8 ) > scrn_rect.top ) &&
+                                                               ( (marker_ys + 8) < (height))){ */ //suma
+                                                               // huds_both
+                                                               if( huds_both(options) ) 
+                                                               {
+                                                                       // drawOneLine( scrn_rect.left, marker_ys,
+                                                                       //              marker_xs,      marker_ys);
+                                                                       // drawOneLine( marker_xs, marker_ys,
+                                                                       //              scrn_rect.left + scrn_rect.right,
+                                                                       //              marker_ys);
+                                                                       if(tick_type=="line")
+                                                                       {
+                                                                               glBegin(GL_LINE_STRIP);
+                                                                               glVertex2f( scrn_rect.left, marker_ys );
+                                                                               glVertex2f( marker_xs, marker_ys);
+                                                                               glVertex2f( width, marker_ys);
+                                                                               glEnd();
+                                                                       } 
+                                                                       else if(tick_type=="circle") //begin suma
+                                                                               circles(scrn_rect.left, (float)marker_ys,5.0); //end suma
+                                                                       else
+                                                                       { 
+                                                                               glBegin(GL_LINE_STRIP);
+                                                                               glVertex2f( scrn_rect.left, marker_ys );
+                                                                               glVertex2f( marker_xs, marker_ys);
+                                                                               glVertex2f( width, marker_ys);
+                                                                               glEnd();
+                                                                       } 
+                                                               
+                                                                       if( !huds_notext(options)) {
+                                                                               textString ( marker_xs + 2,  marker_ys,
+                                                 TextScale,  GLUT_BITMAP_8_BY_13,0 );
+                                                                       } 
+                                                               } 
+                                                               //begin suma 
+                                                               /* Changes are made to draw a circle when tick_type="circle" */                                                 
+                                                               // anything other than huds_both
+                                                               else 
+                                                               { 
+                                                                       if(tick_type=="line")
+                                                                       {
+                                                                               drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
+                                                                       } 
+                                                                       else if(tick_type=="circle")
+                                                                           circles((float)marker_xs + 4, (float)marker_ys,5.0);//end suma
+                                                                   else
+                                                                       {
+                                                                               drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
+                                                                       } 
+                                                                       if( !huds_notext(options) ) 
+                                                                       {
+                                                                               if( huds_left(options) )  
+                                                                               { 
+                                                                                       textString( marker_xs -  8 * lenstr - 2,
                                                     marker_ys - 4,
-                                                    TextScale, GLUT_BITMAP_8_BY_13 );
-                                    } else  {
-                                        textString( marker_xe + 3 * lenstr,
+                                                    TextScale, GLUT_BITMAP_8_BY_13,0 );                                                                                 
+                                                                               }  
+                                                                           else  
+                                                                               { 
+                                                                                       textString( marker_xe + 3 * lenstr,
                                                     marker_ys - 4,
-                                                    TextScale, GLUT_BITMAP_8_BY_13 );
-                                    }
-                                }
-                            }
-                        } // Else read oriented right
-                    } // End if modulo division by major interval is zero
-                }  // End if major interval divisor non-zero
-            } // End if condition
-        } // End for range of i from vmin to vmax
-    }  // End if VERTICAL SCALE TYPE
-    else {                                // Horizontal scale by default
-        // left tick bar
-       if (draw_tick_left) {
-            drawOneLine( scrn_rect.left, scrn_rect.top,
+                                                    TextScale, GLUT_BITMAP_8_BY_13,0 );
+                                                                               } //End if huds_left
+                                                                       } //End if !huds_notext
+                                                               }  //End if huds-both
+                                                       }  // End if draw major ticks
+                                               }   // End if major ticks
+                                       }  // End condition
+                               }  // End for 
+                       }  //end of zoom
+               } // End if VERTICAL SCALE TYPE (tape loop yet to be closed)
+               else {                                // Horizontal scale by default
+                       // left tick bar
+                       if (draw_tick_left) {
+                               drawOneLine( scrn_rect.left, scrn_rect.top,
                          scrn_rect.left, height);
-       } // endif draw_tick_left
-        // right tick bar
-       if (draw_tick_right) {
-            drawOneLine( width, scrn_rect.top,
+                       }  // endif draw_tick_left
+                       // right tick bar
+                       if (draw_tick_right) {
+                               drawOneLine( width, scrn_rect.top,
                          width,
                          height );
-       } // endif draw_tick_right
+                       }  // endif draw_tick_right
       
-        marker_ys = scrn_rect.top;           // Starting point for
-        marker_ye = height;                  // tick y location calcs
-        marker_xe = width;
-        marker_xs = scrn_rect.left + FloatToInt((cur_value - vmin) * factor() /*+ .5f*/);
+                       marker_ys = scrn_rect.top;           // Starting point for
+                       marker_ye = height;                  // tick y location calcs
+                       marker_xe = width;
+                       marker_xs = scrn_rect.left + FloatToInt((cur_value - vmin) * factor() /*+ .5f*/);
                  
 
-       //    glBegin(GL_LINES);
-                 // left tick bar
-       //    glVertex2f( scrn_rect.left, scrn_rect.top);
-       //    glVertex2f( scrn_rect.left, marker_ye);
+                       //    glBegin(GL_LINES);
+                       // left tick bar
+                       //    glVertex2f( scrn_rect.left, scrn_rect.top);
+                       //    glVertex2f( scrn_rect.left, marker_ye);
 
-                 // right tick bar
-       //    glVertex2f( marker_xe, scrn_rect.top);
-       //    glVertex2f( marker_xe, marker_ye );
-       //    glEnd();
+                       // right tick bar
+                       //    glVertex2f( marker_xe, scrn_rect.top);
+                       //    glVertex2f( marker_xe, marker_ye );
+                       //    glEnd();
 
-       if( huds_top(options) ) {
-            if (draw_cap_bottom) {
-                // Bottom box line
-                drawOneLine( scrn_rect.left,
+                       if( huds_top(options) ) {
+                               if (draw_cap_bottom) {
+                                       // Bottom box line
+                                       drawOneLine( scrn_rect.left,
                              scrn_rect.top,
                              width,
                              scrn_rect.top);
-            } //endif cap_bottom
-
-            // Tick point adjust
-            marker_ye  = scrn_rect.top + scrn_rect.bottom / 2;
-            // Bottom arrow
-            // drawOneLine( mid_scr.x, marker_ye,
-            //              mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
-            // drawOneLine( mid_scr.x, marker_ye,
-            //              mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
-            // draw pointer
-            if(pointer) {
-                if(pointer_type=="fixed")      {
-                    glBegin(GL_LINE_STRIP);
-                    glVertex2f( marker_xs - scrn_rect.bottom / 4, scrn_rect.top);
-                    glVertex2f( marker_xs, marker_ye);
-                    glVertex2f( marker_xs + scrn_rect.bottom / 4, scrn_rect.top);
-                    glEnd();
-                } else {
-                    if(pointer_type=="moving") {
-                        // Code for Moving type Pointer to be included.
-                    }
-                }
-            }
-       }
+                               }  //endif cap_bottom
 
-       if( huds_bottom(options) ) {
-            // Top box line
-            if (draw_cap_top) {
-                drawOneLine( scrn_rect.left, height,
+                               // Tick point adjust
+                               marker_ye  = scrn_rect.top + scrn_rect.bottom / 2;
+                               // Bottom arrow
+                               // drawOneLine( mid_scr.x, marker_ye,
+                               //              mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
+                               // drawOneLine( mid_scr.x, marker_ye,
+                               //              mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
+                               // draw pointer
+                               if(pointer)
+                               {
+                                       if(pointer_type=="moving")
+                                       { 
+                                               if (zoom ==0)
+                                               {
+                                                       //Code for Moving Type Pointer included by suma.
+                                                       static float xcentre,xpoint,ypoint;
+                                                       static int range;
+                                                       if(cur_value > maxValue) cur_value = maxValue;
+                                                       if(cur_value < minValue) cur_value = minValue;
+                                                       xcentre = mid_scr.x;
+                                                       range = scrn_rect.right;
+                                                       xpoint = xcentre + (cur_value * range / val_span);
+                                                       ypoint = scrn_rect.top - marker_offset;
+                                                       drawOneLine(xcentre, ypoint,xpoint,ypoint);
+                                                       drawOneLine(xpoint,ypoint,xpoint,ypoint+marker_offset);
+                                                       drawOneLine(xpoint,ypoint+marker_offset,xpoint+5.0,ypoint+5.0);
+                                                       drawOneLine(xpoint,ypoint+marker_offset,xpoint-5.0,ypoint+5.0);
+                                               } 
+                                       } 
+                                       else //default to fixed
+                                       { 
+                                               fixed( marker_xs - scrn_rect.bottom / 4, scrn_rect.top,
+                                          marker_xs, marker_ye, marker_xs + scrn_rect.bottom / 4,scrn_rect.top);
+                                       } 
+                               }  //if pointer
+                       } //End Horizontal scale/top
+
+                       if( huds_bottom(options) ) {
+                               // Top box line
+                               if (draw_cap_top) {
+                                       drawOneLine( scrn_rect.left, height,
                              width, height);
-            } //endif cap_top
-
-            // Tick point adjust
-            marker_ys = height - scrn_rect.bottom  / 2;
-            // Top arrow
-            //      drawOneLine( mid_scr.x + scrn_rect.bottom / 4,
-            //                   scrn_rect.top + scrn_rect.bottom,
-            //                   mid_scr.x, marker_ys );
-            //      drawOneLine( mid_scr.x - scrn_rect.bottom / 4,
-            //                   scrn_rect.top + scrn_rect.bottom,
-            //                   mid_scr.x , marker_ys );
+                               }  //endif cap_top
+
+                               // Tick point adjust
+                               marker_ys = height - scrn_rect.bottom  / 2;
+                               // Top arrow
+                               //      drawOneLine( mid_scr.x + scrn_rect.bottom / 4,
+                               //                   scrn_rect.top + scrn_rect.bottom,
+                               //                   mid_scr.x, marker_ys );
+                               //      drawOneLine( mid_scr.x - scrn_rect.bottom / 4,
+                               //                   scrn_rect.top + scrn_rect.bottom,
+                               //                   mid_scr.x , marker_ys );
             
-            // draw pointer
-            if(pointer) {
-                if(pointer_type=="fixed")      {
-                    glBegin(GL_LINE_STRIP);
-                    glVertex2f( marker_xs + scrn_rect.bottom / 4, height);
-                    glVertex2f( marker_xs, marker_ys );
-                    glVertex2f( marker_xs - scrn_rect.bottom / 4, height);
-                    glEnd();
-                } else {
-                    if(pointer_type=="moving") {
-                        // Code for Moving Type Pointer to be included.
-                    }
-                }
-            }//if pointer
+                               // draw pointer
+                               if(pointer) 
+                               {
+                                       if(pointer_type=="moving")      
+                                       { 
+                                               if(zoom == 0)
+                                               { 
+                                                       //Code for Moving Type Pointer included by suma.
+                                                       static float xcentre,xpoint,ypoint;
+                                                       static int range,hgt;
+                                                       if(cur_value > maxValue) cur_value = maxValue;
+                                                       if(cur_value < minValue) cur_value = minValue;
+                                                       xcentre = mid_scr.x ;
+                                                       range = scrn_rect.right;
+                                                       hgt   = scrn_rect.top + scrn_rect.bottom;
+                                                       xpoint = xcentre + (cur_value * range / val_span);
+                                                       ypoint = hgt + marker_offset;
+                                                       drawOneLine(xcentre, ypoint,xpoint,ypoint);
+                                                       drawOneLine(xpoint,ypoint,xpoint,ypoint-marker_offset);
+                                                       drawOneLine(xpoint,ypoint-marker_offset,xpoint+5.0,ypoint-5.0);
+                                                       drawOneLine(xpoint,ypoint-marker_offset,xpoint-5.0,ypoint-5.0);
+                                               } 
+                                       }   
+                                       else 
+                                       { 
+                                               fixed( marker_xs + scrn_rect.bottom / 4, height, marker_xs, marker_ys,
+                              marker_xs - scrn_rect.bottom / 4, height);
+                                       }  
+                               } //if pointer
+                       }  //end horizontal scale bottom
 
-       }
+                       //    if(( options & HUDS_BOTTOM) == HUDS_BOTTOM ) {
+                       //      marker_xe = marker_ys;
+                       //      marker_ys = marker_ye;
+                       //      marker_ye = marker_xe;
+                       //      }
+
+                       // printf("vmin = %d  vmax = %d\n", (int)vmin, (int)vmax);
+
+                       //  last = FloatToInt(vmax)+1;
+                       //  i    = FloatToInt(vmin);
+
+                       if(zoom ==1)
+                       {  
+                               zoomed_scale(vmin,vmax); //suma
+                       } 
+                       else //default to zoom=0
+                       { 
+
+                               last = (int)vmax + 1;
+                               i = (int)vmin;
+                               for(; i <last ; i++ ) {
+                                       // for( i = (int)vmin; i <= (int)vmax; i++ )     {
+                                       // printf("<*> i = %d\n", i);
+                                       condition = true;
+                                       if( !modulo()) {
+                                               if( i < min_val()) {
+                                               condition = false;
+                                               }
+                                       } 
+                                       // printf("<**> i = %d\n", i);
+                                       if( condition )        {
+                                               // marker_xs = scrn_rect.left + (int)((i - vmin) * factor() + .5);
+                                               marker_xs = scrn_rect.left + FloatToInt(((i - vmin) * factor()/*+ .5f*/));
+
+                                               if (oddtype == 1) 
+                                                       k = i+1; //enable ticks at odd values
+                                               else
+                                                       k = i;
 
-       //    if(( options & HUDS_BOTTOM) == HUDS_BOTTOM ) {
-       //      marker_xe = marker_ys;
-       //      marker_ys = marker_ye;
-       //      marker_ye = marker_xe;
-       //      }
-
-               // printf("vmin = %d  vmax = %d\n", (int)vmin, (int)vmax);
-
-       //  last = FloatToInt(vmax)+1;
-       //  i    = FloatToInt(vmin);
-        last = (int)vmax + 1;
-        i = (int)vmin;
-        for(; i <last ; i++ ) {
-            // for( i = (int)vmin; i <= (int)vmax; i++ )     {
-            // printf("<*> i = %d\n", i);
-            condition = true;
-            if( !modulo()) {
-                if( i < min_val()) {
-                    condition = false;
-                }
-            }
-            // printf("<**> i = %d\n", i);
-            if( condition )        {
-                // marker_xs = scrn_rect.left + (int)((i - vmin) * factor() + .5);
-                marker_xs = scrn_rect.left + FloatToInt(((i - vmin) * factor()/*+ .5f*/));
-                if( div_min()){
-                    //          if( (i%(int)div_min()) == 0 ) {
-                    if( !(i%(int)div_min() )) {           
-                        // draw in ticks only if they aren't too close to the edge.
-                        if((( marker_xs - 5) > scrn_rect.left ) &&
-                           (( marker_xs + 5 )< (scrn_rect.left + scrn_rect.right))){
+                                               if( div_min()){
+                                                       //          if( (i%(int)div_min()) == 0 ) {
+                                                       //draw minor ticks
+                                                       if( !(k%(int)div_min() )) {           
+                                                               // draw in ticks only if they aren't too close to the edge.
+                                                               /*if((( marker_xs - 5) > scrn_rect.left ) &&
+                                                               (( marker_xs + 5 )< (scrn_rect.left + scrn_rect.right))){ */ //suma
                             
-                            if( huds_both(options) ) {
-                                drawOneLine( marker_xs, scrn_rect.top,
-                                             marker_xs, marker_ys - 4);
-                                drawOneLine( marker_xs, marker_ye + 4,
-                                             marker_xs, height);
-                                // glBegin(GL_LINES);
-                                // glVertex2f( marker_xs, scrn_rect.top);
-                                // glVertex2f( marker_xs, marker_ys - 4);
-                                // glVertex2f( marker_xs, marker_ye + 4);
-                                // glVertex2f( marker_xs, scrn_rect.top + scrn_rect.bottom);
-                                // glEnd();
-                            } else {
-                                if( huds_top(options)) {
-                                    // draw minor ticks
-                                    drawOneLine( marker_xs, marker_ys,
-                                                 marker_xs, marker_ye - 4);
-                                } else {
-                                    drawOneLine( marker_xs, marker_ys + 4,
-                                                 marker_xs, marker_ye);
-                                }
-                            }
-                        }
-                    }
-                }
-               // printf("<***> i = %d\n", i);
-                if( div_max()) {
-                    // printf("i = %d\n", i);
-                    //          if( (i%(int)div_max())==0 ) {
-                    if( !(i%(int)div_max()) ) {           
-                        if(modulo()) {
-                            if( disp_val < 0) {
-                                while(disp_val<0)
-                                    disp_val += modulo();
-                            }
-                            disp_val = i % (int) modulo(); // ?????????
-                        } else {
-                            disp_val = i;
-                        }
-                       // printf("disp_val = %d\n", disp_val);
-                       // printf("%d\n", (int)(disp_val  * (double)data_scaling() + 0.5));
-                        lenstr = sprintf( TextScale, "%d",
+                                                               if( huds_both(options) ) 
+                                                               { 
+                                                                       if(tick_length=="variable")
+                                                                       { 
+                                                                               drawOneLine( marker_xs, scrn_rect.top,
+                                                                                                       marker_xs, marker_ys - 4);
+                                                                               drawOneLine( marker_xs, marker_ye + 4,
+                                                                                                       marker_xs, height);
+                                                                       } 
+                                                                       else
+                                                                       { 
+                                                                               drawOneLine( marker_xs, scrn_rect.top,
+                                                                                                       marker_xs, marker_ys);
+                                                                               drawOneLine( marker_xs, marker_ye,
+                                                                                                       marker_xs, height);
+                                                                       } 
+                                                                       // glBegin(GL_LINES);
+                                                                       // glVertex2f( marker_xs, scrn_rect.top);
+                                                                       // glVertex2f( marker_xs, marker_ys - 4);
+                                                                       // glVertex2f( marker_xs, marker_ye + 4);
+                                                                       // glVertex2f( marker_xs, scrn_rect.top + scrn_rect.bottom);
+                                                                       // glEnd();
+                                                               }  else {
+                                                                       if( huds_top(options)) 
+                                                                       {         //draw minor ticks
+                                                                       if(tick_length=="variable")
+                                                                                       drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye-4);
+                                                                       else
+                                                                                       drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye);
+                                                                       } else  
+                                                                               if(tick_length=="variable")
+                                                                                       drawOneLine(marker_xs,marker_ys+4,marker_xs,marker_ye);
+                                                                               else
+                                                                                       drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye);
+                                                               } 
+                                                       } //end draw minor ticks
+                                               } //end minor ticks
+                                               //major ticks
+                                               if( div_max()) {
+                                                       // printf("i = %d\n", i);
+                                                       //          if( (i%(int)div_max())==0 ) {
+                                                       //draw major ticks
+                                                       if( !(k%(int)div_max()) ) {           
+                                                               if(modulo()) {
+                                                                       disp_val = i % (int) modulo(); // ?????????
+                                                                       if( disp_val < 0) {
+                                                                               while(disp_val<0)
+                                                                                       disp_val += modulo();
+                                                                       } 
+                                                               } else {
+                                                                       disp_val = i;
+                                                               } 
+                                                               // printf("disp_val = %d\n", disp_val);
+                                                               // printf("%d\n", (int)(disp_val  * (double)data_scaling() + 0.5));
+                                                               lenstr = sprintf( TextScale, "%d",
                                           // (int)(disp_val  * data_scaling() +.5));
                                           FloatToInt(disp_val * data_scaling()/*+.5*/));
-                        // Draw major ticks and text only if far enough from the edge.
-                        if(( (marker_xs - 10)> scrn_rect.left ) &&
-                           ( (marker_xs + 10) < (scrn_rect.left + scrn_rect.right))){
-                            if( huds_both(options) ) {
-                                // drawOneLine( marker_xs, scrn_rect.top,
-                                //              marker_xs, marker_ys);
-                                // drawOneLine( marker_xs, marker_ye,
-                                //              marker_xs, scrn_rect.top + scrn_rect.bottom);
-                                glBegin(GL_LINE_STRIP);
-                                glVertex2f( marker_xs, scrn_rect.top);
-                                glVertex2f( marker_xs, marker_ye);
-                                glVertex2f( marker_xs, height);
-                                glEnd();
-                                if( !huds_notext(options) ) {
-                                    textString ( marker_xs - 4 * lenstr,
+                                                               // Draw major ticks and text only if far enough from the edge.
+                                                               /*if(( (marker_xs - 10)> scrn_rect.left ) &&
+                                                               ( (marker_xs + 10) < (scrn_rect.left + scrn_rect.right))){*/ //suma
+                                                               if( huds_both(options) ) {
+                                                                       // drawOneLine( marker_xs, scrn_rect.top,
+                                                                       //              marker_xs, marker_ys);
+                                                                       // drawOneLine( marker_xs, marker_ye,
+                                                                       //              marker_xs, scrn_rect.top + scrn_rect.bottom);
+                                                                       glBegin(GL_LINE_STRIP);
+                                                                       glVertex2f( marker_xs, scrn_rect.top);
+                                                                       glVertex2f( marker_xs, marker_ye);
+                                                                       glVertex2f( marker_xs, height);
+                                                                       glEnd();
+                                                                       if( !huds_notext(options) ) {
+                                                                               textString ( marker_xs - 4 * lenstr,
                                                  marker_ys + 4,
-                                                 TextScale,  GLUT_BITMAP_8_BY_13 );
-                                }
-                            } else {
-                                drawOneLine( marker_xs, marker_ys,
+                                                 TextScale,  GLUT_BITMAP_8_BY_13,0 ); //suma
+                                                                       } 
+                                                               }  else {
+                                                                       drawOneLine( marker_xs, marker_ys,
                                              marker_xs, marker_ye );
-                                if( !huds_notext(options)) {
-                                    if( huds_top(options) )              {
-                                        textString ( marker_xs - 4 * lenstr,
+                                                                       if( !huds_notext(options)) {
+                                                                               if( huds_top(options) )              {
+                                                                                       textString ( marker_xs - 4 * lenstr,
                                                      height - 10,
-                                                     TextScale, GLUT_BITMAP_8_BY_13 );
-                                    } else  {
-                                        textString( marker_xs - 4 * lenstr,
+                                                     TextScale, GLUT_BITMAP_8_BY_13,0 ); //suma
+                                                                               }  else  {
+                                                                                       textString( marker_xs - 4 * lenstr,
                                                     scrn_rect.top,
-                                                    TextScale, GLUT_BITMAP_8_BY_13 );
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-               // printf("<****> i = %d\n", i);
-            }
-        }
-    }
+                                                    TextScale, GLUT_BITMAP_8_BY_13,0 ); //suma
+                                                                               } 
+                                                                       } 
+                                                               } 
+                                                       }  //end draw major ticks
+                                               } //endif major ticks
+                                       }   //end condition
+                               } //end for
+                       }  //end zoom
+               } //end horizontal/vertical scale
+       } // end of type tape
 } //draw
+
+
+//begin suma
+
+void hud_card :: 
+circles(float x,float y,float size)
+{
+    glEnable(GL_POINT_SMOOTH);
+    glPointSize(size); 
+
+    glBegin(GL_POINTS);
+         glVertex2f(x,y);
+       glEnd();
+                                                                                 
+    glPointSize(1.0);
+       glDisable(GL_POINT_SMOOTH); 
+}
+//end suma
+
+void hud_card ::
+fixed(float x1, float y1, float x2, float y2, float x3, float y3)
+{
+       glBegin(GL_LINE_STRIP);
+        glVertex2f(x1, y1);
+        glVertex2f(x2, y2);
+        glVertex2f(x3, y3);   
+    glEnd();
+}
+
+
+void hud_card ::
+zoomed_scale(int first, int last)
+{
+       
+    POINT mid_scr    = get_centroid();
+    RECT   scrn_rect = get_location();
+    UINT options     = get_options();
+       char TextScale[80];
+    int disp_val = 0;
+       int data[80];
+       float x,y,w,h,bottom;
+    float cur_value=get_value();
+       if(cur_value > maxValue) cur_value = maxValue;
+       if(cur_value < minValue) cur_value = minValue;
+       
+       int a=0;
+       
+    while(first <= last)
+       {
+           if((first % (int)Maj_div) == 0) 
+               {   
+                       data[a] = first;
+                       a++ ;
+               }
+        first++;
+       }
+    int centre =a/2;
+
+       
+       if( huds_vert(options) )
+       {
+
+               x=scrn_rect.left;
+               y=scrn_rect.top;
+               w=scrn_rect.left+scrn_rect.right;
+               h=scrn_rect.top+scrn_rect.bottom;
+               bottom=scrn_rect.bottom;
+           
+               float xstart, yfirst, ycentre, ysecond; 
+
+               float hgt = bottom * 20.0 /100.0;  // 60% of height should be zoomed
+               yfirst = mid_scr.y - hgt;
+               ycentre = mid_scr.y;
+               ysecond = mid_scr.y + hgt;
+               float range = hgt * 2;
+               
+               int i;
+               float factor = range /10.0;
+       
+           float hgt1 = bottom * 30.0 /100.0;
+           int  incrs = ((int)val_span - (Maj_div * 2)) / Maj_div ;
+           int  incr = incrs / 2;
+           float factors = hgt1 / incr;
+
+
+
+           // begin
+               //this is for moving type pointer 
+               static float ycent, ypoint,xpoint;
+               static int wth;
+                
+               ycent = mid_scr.y;
+               wth=scrn_rect.left+scrn_rect.right;
+                
+               if(cur_value <= data[centre+1])
+                       if(cur_value > data[centre])
+                       {  
+                               ypoint = ycent + ((cur_value - data[centre]) * hgt/Maj_div);
+                       }                                                          
+
+                       if(cur_value >= data[centre-1])
+                               if(cur_value <= data[centre])
+                               { 
+                                       ypoint = ycent - ((data[centre]-cur_value) * hgt/Maj_div);
+                               } 
+
+                       if(cur_value < data[centre-1])
+                               if(cur_value >= minValue)
+                               {   
+                                       float diff  = minValue  - data[centre-1];
+                                       float diff1 = cur_value - data[centre-1];
+                                       float val = (diff1 * hgt1) / diff;
+                         
+                                       ypoint = ycent - hgt -  val;
+                               }                                                          
+               
+
+                       if(cur_value > data[centre+1])
+                               if(cur_value <= maxValue)
+                               {    
+                                       float diff  = maxValue  - data[centre+1];
+                                       float diff1 = cur_value - data[centre+1];
+                                       float val = (diff1 * hgt1) / diff;
+                         
+                                       ypoint = ycent + hgt +  val;
+                               }                
+                                  
+                       if(huds_left(options))
+                       { 
+                               xstart = w;
+                               
+                               drawOneLine( xstart, ycentre, xstart - 5.0, ycentre); //centre tick
+          
+                               sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
+
+                               if( !huds_notext(options)) 
+                               { 
+                                       textString (x, ycentre, TextScale, GLUT_BITMAP_8_BY_13,0 );
+                               } 
+       
+                       for(i=1;i<5;i++)
+                               {  
+                                       yfirst  += factor;
+                                       ycentre += factor;
+                                       circles(xstart-2.5,yfirst, 3.0);
+                                       circles(xstart-2.5,ycentre,3.0);
+                               } 
+                                               
+                               yfirst = mid_scr.y - hgt;
+
+                       for(i=0;i<=incr;i++)
+                               { 
+                                       drawOneLine( xstart, yfirst, xstart - 5.0, yfirst);
+                                       drawOneLine( xstart,ysecond, xstart - 5.0,ysecond);
+                 
+                                       sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
+
+                                       if( !huds_notext(options)) 
+                                               textString (x, yfirst, TextScale, GLUT_BITMAP_8_BY_13,0 );
+                  
+                                       sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
+
+                                       if( !huds_notext(options)) 
+                                               textString (x, ysecond, TextScale, GLUT_BITMAP_8_BY_13,0 );
+                  
+
+                                       yfirst    -= factors;
+                                       ysecond   += factors;
+
+                               } 
+                               //to draw moving type pointer for left option
+                               //begin         
+                               xpoint = wth + 10.0;
+       
+                               if(pointer_type == "moving")
+                               { 
+                                       drawOneLine(xpoint,ycent,xpoint,ypoint);
+                                       drawOneLine(xpoint,ypoint,xpoint-10.0,ypoint);
+                                       drawOneLine(xpoint-10.0,ypoint,xpoint-5.0,ypoint+5.0);
+                                       drawOneLine(xpoint-10.0,ypoint,xpoint-5.0,ypoint-5.0);
+                               } 
+                               //end
+       
+                       } 
+                       else //huds_right
+                       { 
+
+                               xstart = (x+w)/2;
+          
+                               drawOneLine( xstart, ycentre, xstart + 5.0, ycentre); //centre tick
+          
+                               sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
+
+                               if( !huds_notext(options)) 
+                               { 
+                                       textString (w, ycentre, TextScale, GLUT_BITMAP_8_BY_13,0 );
+                               } 
+       
+                       for(i=1;i<5;i++)
+                               {  
+                                       yfirst  += factor;
+                                       ycentre += factor;
+                                       circles(xstart+2.5,yfirst, 3.0);
+                                       circles(xstart+2.5,ycentre,3.0);
+                               } 
+                                               
+                               yfirst = mid_scr.y - hgt;
+
+                       for(i=0;i<=incr;i++)
+                               { 
+                                       drawOneLine( xstart, yfirst, xstart + 5.0, yfirst);
+                                       drawOneLine( xstart,ysecond, xstart + 5.0,ysecond);
+                 
+                                       sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
+
+                                       if( !huds_notext(options)) 
+                                       textString (w, yfirst, TextScale, GLUT_BITMAP_8_BY_13,0 );
+                  
+                                       sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
+
+                                       if( !huds_notext(options)) 
+                                               textString (w, ysecond, TextScale, GLUT_BITMAP_8_BY_13,0 );
+                  
+                                       yfirst -= factors;
+                                       ysecond   += factors;
+
+                               } 
+
+                               // to draw moving type pointer for right option
+                               //begin                   
+                               xpoint = scrn_rect.left;
+               
+                               if(pointer_type == "moving")
+                               { 
+                                       drawOneLine(xpoint,ycent,xpoint,ypoint);
+                                       drawOneLine(xpoint,ypoint,xpoint+10.0,ypoint);
+                                       drawOneLine(xpoint+10.0,ypoint,xpoint+5.0,ypoint+5.0);
+                                       drawOneLine(xpoint+10.0,ypoint,xpoint+5.0,ypoint-5.0);
+                               } 
+                               //end                                    
+                       }//end huds_right /left
+               }       //end of vertical scale
+               else //horizontal scale
+               { 
+               x=scrn_rect.left;
+                       y=scrn_rect.top;
+                       w=scrn_rect.left+scrn_rect.right;
+                       h=scrn_rect.top+scrn_rect.bottom;
+                       bottom=scrn_rect.right;
+           
+                       float ystart, xfirst, xcentre, xsecond; 
+
+                       float hgt = bottom * 20.0 /100.0;  // 60% of height should be zoomed
+                       xfirst = mid_scr.x - hgt;
+                       xcentre = mid_scr.x;
+                       xsecond = mid_scr.x + hgt;
+                       float range = hgt * 2;
+               
+                       int i;
+                       float factor = range /10.0;
+
+                       float hgt1 = bottom * 30.0 /100.0;
+                       int  incrs = ((int)val_span - (Maj_div * 2)) / Maj_div ;
+                       int  incr = incrs / 2;
+                       float factors = hgt1 / incr;
+
+               
+                       //Code for Moving Type Pointer
+                       //begin
+                       static float xcent,xpoint,ypoint;
+               
+                       xcent = mid_scr.x;
+                
+                       if(cur_value <= data[centre+1])
+                               if(cur_value > data[centre])
+                               {   
+                                       xpoint = xcent + ((cur_value - data[centre]) * hgt/Maj_div);
+                               }                                                          
+
+                       if(cur_value >= data[centre-1])
+                               if(cur_value <= data[centre])
+                               {   
+                                       xpoint = xcent - ((data[centre]-cur_value) * hgt/Maj_div);
+                               }         
+                  
+                       if(cur_value < data[centre-1])
+                               if(cur_value >= minValue)
+                               {   
+                                       float diff  = minValue  - data[centre-1];
+                                       float diff1 = cur_value - data[centre-1];
+                                       float val = (diff1 * hgt1) / diff;
+                         
+                                       xpoint = xcent - hgt -  val;
+                               }                                                          
+               
+           
+                       if(cur_value > data[centre+1])
+                               if(cur_value <= maxValue)
+                               {   
+                                       float diff  = maxValue  - data[centre+1];
+                                       float diff1 = cur_value - data[centre+1];
+                                       float val = (diff1 * hgt1) / diff;
+                         
+                                       xpoint = xcent + hgt +  val;
+                               }                                                          
+               
+                       //end
+                       if(huds_top(options))
+                       { 
+
+                               ystart =h;
+          
+                               drawOneLine( xcentre, ystart, xcentre, ystart - 5.0); //centre tick
+          
+                               sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
+
+                               if( !huds_notext(options)) 
+                               { 
+                                       textString (xcentre-10.0, y, TextScale, GLUT_BITMAP_8_BY_13,0 );
+                               } 
+       
+                       for(i=1;i<5;i++)
+                               {  
+                                       xfirst  += factor;
+                                       xcentre += factor;
+                                       circles(xfirst,  ystart-2.5, 3.0);
+                                       circles(xcentre, ystart-2.5, 3.0);
+                               } 
+                                               
+                               xfirst = mid_scr.x - hgt;                               
+          
+                       for(i=0;i<=incr;i++)
+                               { 
+                                       drawOneLine( xfirst,  ystart, xfirst,  ystart - 5.0);
+                                       drawOneLine( xsecond, ystart, xsecond, ystart - 5.0);
+                 
+                                       sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
+
+                                       if( !huds_notext(options)) 
+                                               textString (xfirst-10.0, y, TextScale, GLUT_BITMAP_8_BY_13,0 );
+                  
+                                       sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
+
+                                       if( !huds_notext(options)) 
+                                               textString (xsecond-10.0, y, TextScale, GLUT_BITMAP_8_BY_13,0 );
+                  
+
+                                       xfirst -= factors;
+                                       xsecond   += factors;
+
+                               } 
+                               //this is for moving pointer for top option
+                               //begin
+               
+                               ypoint = scrn_rect.top + scrn_rect.bottom + 10.0;
+
+                               if(pointer_type == "moving")
+                               { 
+                                       drawOneLine(xcent, ypoint,xpoint,ypoint);
+                                       drawOneLine(xpoint,ypoint,xpoint,ypoint-10.0);
+                                       drawOneLine(xpoint,ypoint-10.0,xpoint+5.0,ypoint-5.0);
+                                       drawOneLine(xpoint,ypoint-10.0,xpoint-5.0,ypoint-5.0);
+                               } 
+                               //end           
+
+                       }  //end of top option
+                       else //else huds_bottom
+                       { 
+
+                               ystart = (y+h)/2;
+                       
+                               //drawOneLine( xstart, yfirst,  xstart - 5.0, yfirst );
+                               drawOneLine( xcentre, ystart, xcentre, ystart + 5.0); //centre tick
+          
+                               sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
+
+                               if( !huds_notext(options)) 
+                               { 
+                                       textString (xcentre-10.0, h, TextScale, GLUT_BITMAP_8_BY_13,0 );
+                               } 
+       
+                       for(i=1;i<5;i++)
+                               {  
+                                       xfirst  += factor;
+                                       xcentre += factor;
+                                       circles(xfirst,  ystart+2.5, 3.0);
+                                       circles(xcentre, ystart+2.5,3.0);
+                               } 
+                                               
+                               xfirst = mid_scr.x - hgt;
+               
+                               for(i=0;i<=incr;i++)
+                               { 
+                                       drawOneLine( xfirst, ystart, xfirst, ystart + 5.0);
+                                       drawOneLine( xsecond,ystart, xsecond,ystart + 5.0);
+                 
+                                       sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
+
+                                       if( !huds_notext(options)) 
+                                               textString (xfirst-10.0,h, TextScale, GLUT_BITMAP_8_BY_13,0 );
+                  
+                                       sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
+
+                                       if( !huds_notext(options)) 
+                                               textString (xsecond-10.0,h, TextScale, GLUT_BITMAP_8_BY_13,0 );
+                  
+
+                                       xfirst -= factors;
+                                       xsecond   += factors;
+
+                               } 
+                               //this is for movimg pointer for bottom option
+                               //begin
+       
+                               ypoint = scrn_rect.top - 10.0;
+                               if(pointer_type == "moving")            
+                               { 
+                                       drawOneLine(xcent, ypoint,xpoint,ypoint);
+                                       drawOneLine(xpoint,ypoint,xpoint,ypoint+10.0);
+                                       drawOneLine(xpoint,ypoint+10.0,xpoint+5.0,ypoint+5.0);
+                                       drawOneLine(xpoint,ypoint+10.0,xpoint-5.0,ypoint+5.0);
+                               } 
+
+               
+                               //end                   
+                       }//end hud_top or hud_bottom 
+
+       }  //end of horizontal/vertical scales
+
+}//end draw
diff --git a/src/Cockpit/hud_gaug.cxx b/src/Cockpit/hud_gaug.cxx
new file mode 100644 (file)
index 0000000..eb6a95a
--- /dev/null
@@ -0,0 +1,380 @@
+
+#include "hud.hxx"
+
+
+#ifdef USE_HUD_TextList
+#define textString( x , y, text, font,digit )  TextString( text, x , y,digit )  //suma
+#else
+#define textString( x , y, text, font,digit )  puDrawString ( guiFnt, text, x, y ); //suma
+#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) :
+    instr_scale( x, y, width, height,
+                load_fn, options,
+                (maxValue - minValue), // Always shows span?
+                maxValue, minValue,
+                disp_scale,
+                major_divs, minor_divs,
+                modulus, dp_showing,
+                working)
+{
+    //  UINT options = get_options();
+    //  huds_vert    = options & HUDS_VERT;
+    //  huds_left    = options & HUDS_LEFT;
+    //  huds_right   = options & HUDS_RIGHT;
+    //  huds_both    = (options & HUDS_BOTH) == HUDS_BOTH;
+    // huds_noticks = options & HUDS_NOTICKS;
+    //  huds_notext  = options & HUDS_NOTEXT;
+    //  huds_top     = options & HUDS_TOP;
+    //  huds_bottom  = options & HUDS_BOTTOM;
+}
+
+gauge_instr ::
+~gauge_instr()
+{
+}
+
+gauge_instr ::
+gauge_instr( const gauge_instr & image):
+    instr_scale( (instr_scale &) image)
+{
+    //  UINT options = get_options();
+    //  huds_vert = options & HUDS_VERT;
+    //  huds_left = options & HUDS_LEFT;
+    //  huds_right = options & HUDS_RIGHT;
+    //  huds_both = (options & HUDS_BOTH) == HUDS_BOTH;
+    //  huds_noticks = options & HUDS_NOTICKS;
+    //  huds_notext = options & HUDS_NOTEXT;
+    //  huds_top = options & HUDS_TOP;
+    //  huds_bottom =  options & HUDS_BOTTOM;
+}
+
+gauge_instr & gauge_instr ::
+operator = (const gauge_instr & rhs )
+{
+    if( !(this == &rhs)) {
+       instr_scale::operator = (rhs);
+    }
+    return *this;
+}
+
+// As implemented, draw only correctly draws a horizontal or vertical
+// scale. It should contain a variation that permits clock type displays.
+// Now is supports "tickless" displays such as control surface indicators.
+// This routine should be worked over before using. Current value would be
+// fetched and not used if not commented out. Clearly that is intollerable.
+
+void gauge_instr :: draw (void)
+{
+    int marker_xs, marker_xe;
+    int marker_ys, marker_ye;
+    int text_x, text_y;
+    int width, height, bottom_4;
+    int lenstr;
+    int i;
+    char TextScale[80];
+    bool condition;
+    int disp_val = 0;
+    float vmin       = min_val();
+    float vmax       = max_val();
+    POINT mid_scr    = get_centroid();
+    float cur_value  = get_value();
+    RECT  scrn_rect  = get_location();
+    UINT options     = get_options();
+
+    width = scrn_rect.left + scrn_rect.right;
+    height = scrn_rect.top  + scrn_rect.bottom,
+       bottom_4 = scrn_rect.bottom / 4;
+    // Draw the basic markings for the scale...
+
+    if( huds_vert(options) ) { // Vertical scale
+       drawOneLine( scrn_rect.left,     // Bottom tick bar
+                    scrn_rect.top,
+                    width,
+                    scrn_rect.top);
+
+       drawOneLine( scrn_rect.left,    // Top tick bar
+                    height,
+                    width,
+                    height );
+
+       marker_xs = scrn_rect.left;
+       marker_xe = width;
+
+       if( huds_left(options) ) {     // Read left, so line down right side
+           drawOneLine( width,
+                        scrn_rect.top,
+                        width,
+                        height);
+         
+           marker_xs  = marker_xe - scrn_rect.right / 3;   // Adjust tick xs
+       }
+       
+       if( huds_right(options) ) {     // Read  right, so down left sides
+           drawOneLine( scrn_rect.left,
+                        scrn_rect.top,
+                        scrn_rect.left,
+                        height);
+         
+           marker_xe = scrn_rect.left + scrn_rect.right / 3;     // Adjust tick xe
+       }
+
+       // At this point marker x_start and x_end values are transposed.
+       // To keep this from confusing things they are now interchanged.
+       if( huds_both(options) ) {
+           marker_ye = marker_xs;
+           marker_xs = marker_xe;
+           marker_xe = marker_ye;
+       }
+
+       // Work through from bottom to top of scale. Calculating where to put
+       // minor and major ticks.
+
+       if( !huds_noticks(options)) {    // If not no ticks...:)
+           // Calculate x marker offsets
+           int last = (int)vmax + 1; //FloatToInt(vmax)+1;
+           i = (int)vmin; //FloatToInt(vmin);
+           for(; i <last ; i++ )      {
+               //      for( i = (int)vmin; i <= (int)vmax; i++ ) {
+
+               // Calculate the location of this tick
+               marker_ys = scrn_rect.top + FloatToInt((i - vmin) * factor()/* +.5f*/);
+
+               // We compute marker_ys even though we don't know if we will use
+               // either major or minor divisions. Simpler.
+
+               if( div_min()) {                  // Minor tick marks
+                   if( !(i%(int)div_min()) ) {
+                       if( huds_left(options) && huds_right(options) ) {
+                           drawOneLine( scrn_rect.left, marker_ys,
+                                        marker_xs - 3, marker_ys );
+                           drawOneLine( marker_xe + 3, marker_ys,
+                                        width, marker_ys );
+                       }
+                       else {
+                           if( huds_left(options) ) {
+                               drawOneLine( marker_xs + 3, marker_ys, marker_xe, marker_ys );
+                           }
+                           else {
+                               drawOneLine( marker_xs, marker_ys, marker_xe - 3, marker_ys );
+                           }
+                       }
+                   }
+               }
+
+               // Now we work on the major divisions. Since these are also labeled
+               // and no labels are drawn otherwise, we label inside this if
+               // statement.
+
+               if( div_max()) {                  // Major tick mark
+                   if( !(i%(int)div_max()) )            {
+                       if( huds_left(options) && huds_right(options) ) {
+                           drawOneLine( scrn_rect.left, marker_ys,
+                                        marker_xs, marker_ys );
+                           drawOneLine( marker_xe, marker_ys,
+                                        width, marker_ys );
+                       }
+                       else {
+                           drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
+                       }
+
+                       if( !huds_notext(options) ) {
+                           disp_val = i;
+                           sprintf( TextScale, "%d",
+                                    FloatToInt(disp_val * data_scaling()/*+.5*/ ));
+
+                           lenstr = getStringWidth( TextScale );
+                                               
+                           if( huds_left(options) && huds_right(options) ) {
+                               text_x = mid_scr.x -  lenstr/2 ;
+                           }
+                           else {
+                               if( huds_left(options) )              {
+                                   text_x = marker_xs - lenstr;
+                               }
+                               else {
+                                   text_x = marker_xe - lenstr;
+                               }
+                           }
+                           // Now we know where to put the text.
+                           text_y = marker_ys;
+                           textString( text_x, text_y, TextScale, GLUT_BITMAP_8_BY_13,0 ); //suma
+                       }
+                   }
+               }  //
+           }  //
+       }  //
+       // Now that the scale is drawn, we draw in the pointer(s). Since labels
+       // have been drawn, text_x and text_y may be recycled. This is used
+       // with the marker start stops to produce a pointer for each side reading
+
+       text_y = scrn_rect.top + FloatToInt((cur_value - vmin) * factor() /*+.5f*/);
+       //    text_x = marker_xs - scrn_rect.left;
+
+       if( huds_right(options) ) {
+           glBegin(GL_LINE_STRIP);
+           glVertex2f( scrn_rect.left, text_y + 5);
+           glVertex2f( marker_xe,      text_y);
+           glVertex2f( scrn_rect.left, text_y - 5);
+           glEnd();
+       }
+       if( huds_left(options) ) {
+           glBegin(GL_LINE_STRIP);
+           glVertex2f( width,      text_y + 5);
+           glVertex2f( marker_xs,  text_y);
+           glVertex2f( width,      text_y - 5);
+           glEnd();
+       }
+    }  // End if VERTICAL SCALE TYPE
+    else {                                // Horizontal scale by default
+       drawOneLine( scrn_rect.left,     // left tick bar
+                    scrn_rect.top,
+                    scrn_rect.left,
+                    height);
+
+       drawOneLine( width,    // right tick bar
+                    scrn_rect.top,
+                    width,
+                    height );
+
+       marker_ys = scrn_rect.top;                       // Starting point for
+       marker_ye = height;                              // tick y location calcs
+       marker_xs = scrn_rect.left + FloatToInt((cur_value - vmin) * factor() /*+ .5f*/);
+
+       if( huds_top(options) ) {
+           drawOneLine( scrn_rect.left,
+                        scrn_rect.top,
+                        width,
+                        scrn_rect.top);                    // Bottom box line
+         
+           marker_ye  = scrn_rect.top + scrn_rect.bottom / 2;   // Tick point adjust
+           // Bottom arrow
+           glBegin(GL_LINE_STRIP);
+           glVertex2f( marker_xs - bottom_4, scrn_rect.top);
+           glVertex2f( marker_xs, marker_ye);
+           glVertex2f( marker_xs + bottom_4, scrn_rect.top);
+           glEnd();
+       }
+       if( huds_bottom(options) ) {
+           // Top box line
+           drawOneLine( scrn_rect.left, height, width, height);
+           // Tick point adjust
+           marker_ys = height - scrn_rect.bottom  / 2;
+
+           // Top arrow
+           glBegin(GL_LINE_STRIP);
+           glVertex2f( marker_xs + bottom_4, height);
+           glVertex2f( marker_xs, marker_ys );
+           glVertex2f( marker_xs - bottom_4, height);
+           glEnd();
+       }
+
+       
+       int last = (int)vmax + 1; //FloatToInt(vmax)+1;
+       i = (int)vmin; //FloatToInt(vmin);
+       for( ; i <last ; i++ )      {
+           condition = true;
+           if( !modulo()) {
+               if( i < min_val()) {
+                   condition = false;
+               }
+           }
+           if( condition )        {
+               marker_xs = scrn_rect.left + FloatToInt((i - vmin) * factor()/* +.5f*/);
+               //        marker_xs = scrn_rect.left + (int)((i - vmin) * factor() + .5f);
+               if( div_min()){
+                   if( !(i%(int)div_min()) ) {                 
+                       // draw in ticks only if they aren't too close to the edge.
+                       if((( marker_xs + 5) > scrn_rect.left ) ||
+                          (( marker_xs - 5 )< (width))){
+
+                           if( huds_both(options) ) {
+                               drawOneLine( marker_xs, scrn_rect.top,
+                                            marker_xs, marker_ys - 4);
+                               drawOneLine( marker_xs, marker_ye + 4,
+                                            marker_xs, height);
+                           }
+                           else {
+                               if( huds_top(options) ) {
+                                   drawOneLine( marker_xs, marker_ys,
+                                                marker_xs, marker_ye - 4);
+                               }
+                               else {
+                                   drawOneLine( marker_xs, marker_ys + 4,
+                                                marker_xs, marker_ye);
+                               }
+                           }
+                       }
+                   }
+               }
+               if( div_max()) {
+                   if( !(i%(int)div_max()) ) {                 
+                       if(modulo()) {
+                           if( disp_val < 0) {
+                               while( disp_val < 0 ) {
+                                   disp_val += modulo();
+                               }       
+                           }
+                           disp_val = i % (int)modulo();
+                       } else {
+                           disp_val = i;
+                       }
+                       sprintf( TextScale, "%d",
+                                FloatToInt(disp_val  * data_scaling()/* +.5*/ ));
+                       lenstr = getStringWidth( TextScale);
+                                               
+                       // Draw major ticks and text only if far enough from the edge.
+                       if(( (marker_xs - 10)> scrn_rect.left ) &&
+                          ( (marker_xs + 10) < width )){
+                           if( huds_both(options) ) {
+                               drawOneLine( marker_xs, scrn_rect.top,
+                                            marker_xs, marker_ys);
+                               drawOneLine( marker_xs, marker_ye,
+                                            marker_xs, height);
+
+                               if( !huds_notext(options) ) {
+                                   textString ( marker_xs - lenstr, marker_ys + 4,
+                                                TextScale,  GLUT_BITMAP_8_BY_13 ,0); //suma
+                               }
+                           }
+                           else {
+                               drawOneLine( marker_xs, marker_ys,
+                                            marker_xs, marker_ye );
+                               
+                               if( !huds_notext(options) ) {
+                                   if( huds_top(options) )              {
+                                       textString ( marker_xs - lenstr,
+                                                    height - 10,
+                                                    TextScale, GLUT_BITMAP_8_BY_13,0 ); //suma
+                                   }
+                                   else  {
+                                       textString( marker_xs - lenstr, scrn_rect.top,
+                                                   TextScale, GLUT_BITMAP_8_BY_13,0 );  //suma
+                                   }            
+                               }
+                           }
+                       }
+                   }
+               }
+           }
+       }
+    }
+}
+
+
index ed4a50b207aaf5f83713e1ecc1123e81ae087fc9..2eefe1e3344da6b2aa7cfc7b27a8467db3c207e6 100644 (file)
@@ -4,7 +4,8 @@
 
 UINT instr_item :: instances = 0;  // Initial value of zero
 int  instr_item :: brightness = BRT_MEDIUM;
-glRGBTRIPLE instr_item :: color = {0.1, 0.7, 0.0};
+//glRGBTRIPLE instr_item :: color = {0.1, 0.7, 0.0};
+glRGBTRIPLE instr_item :: color = {0.0, 1.0, 0.0};
 
 // constructor    ( No default provided )
 instr_item  ::
@@ -15,13 +16,15 @@ instr_item  ::
                FLTFNPTR         data_source,
                float           data_scaling,
                UINT             options,
-               bool             working) :
+               bool             working,
+                          int                          digit) : //suma
                       handle         ( ++instances  ),
                       load_value_fn  ( data_source  ),
                       disp_factor    ( data_scaling ),
                       opts           ( options      ),
                       is_enabled     ( working      ),
-                      broken         ( FALSE        )
+                      broken         ( FALSE        ),
+                      digits            ( digit                ) //suma
 {
   scrn_pos.left   = x;
   scrn_pos.top    = y;
index cf1d97779df4b36bed496302de3b8bc46f998790..305d6a052d5867ccbe7f84c33a9eb5b855b8791e 100644 (file)
@@ -3,9 +3,9 @@
 
 
 #ifdef USE_HUD_TextList
-#define textString( x , y, text, font )  TextString( text, x , y )
+#define textString( x , y, text, font,digit )  TextString( text, x , y,digit ) //suma
 #else
-#define textString( x , y, text, font )  puDrawString ( guiFnt, text, x, y );
+#define textString( x , y, text, font,digit )  puDrawString ( guiFnt, text, x, y ); //suma
 #endif
 
 //======================= Top of instr_label class =========================
@@ -23,11 +23,13 @@ instr_label ::
                       fgLabelJust   justification,
                       int           font_size,
                       int           blinking,
-                     bool                      latitude,
-                     bool                      longitude,
-                      bool          working):
+                                     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 ),
+                                       data_source,scale_data,options, working, digit), //suma
                            pformat  ( label_format      ),
                            pre_str  ( pre_label_string  ),
                            post_str ( post_label_string ),
@@ -35,7 +37,8 @@ instr_label ::
                            fontSize ( font_size         ),
                            blink    ( blinking          ),
                                                   lat          ( latitude                      ),
-                                                  lon          ( longitude                     )
+                                                  lon          ( longitude                     ),
+                                                  lbox         ( label_box                     ) //hud
 
 {
   if( pre_str != NULL) {
@@ -70,7 +73,8 @@ instr_label :: instr_label( const instr_label & image) :
                               post_str ( image.post_str ),
                               blink    ( image.blink    ),
                                                          lat      ( image.lat          ),
-                                                         lon      ( image.lon          )       
+                                                         lon      ( image.lon          ),      
+                                                         lbox     (image.lbox          ) //hud
 
 {
   if( pre_str != NULL) {
@@ -101,6 +105,7 @@ instr_label & instr_label ::operator = (const instr_label & rhs )
     post_str   = rhs.post_str;
     lat                   = rhs.lat;
     lon                   = rhs.lon;
+       lbox       = rhs.lbox; //hud
 
 
     strcpy(format_buffer,rhs.format_buffer);   
@@ -128,10 +133,38 @@ draw( void )       // Required method in base class
        if(lon)    
                sprintf( label_buffer, format_buffer, coord_format_lon(get_value()) );
        else
-               sprintf( label_buffer, format_buffer, get_value() );
-    }
+       {       
+               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 {
-    sprintf( label_buffer, format_buffer );
+//    sprintf( label_buffer, format_buffer );
   }
   
   lenstr = getStringWidth( label_buffer );
@@ -143,7 +176,7 @@ draw( void )       // Required method in base class
   fgPrintf( SG_COCKPIT, SG_DEBUG, label_buffer );
   fgPrintf( SG_COCKPIT, SG_DEBUG, "\n" );
 #endif
-//  lenstr = strlen( label_buffer );
+  lenstr = strlen( label_buffer );
 
   if( justify == RIGHT_JUST ) {
          posincr = scrn_rect.right - lenstr;
@@ -156,12 +189,12 @@ draw( void )       // Required method in base class
   
   if( fontSize == SMALL ) {
     textString( scrn_rect.left + posincr, scrn_rect.top,
-                label_buffer, GLUT_BITMAP_8_BY_13);
+                label_buffer, GLUT_BITMAP_8_BY_13 ,get_digits()); //suma
     }
   else  {
     if( fontSize == LARGE ) {
       textString( scrn_rect.left + posincr, scrn_rect.top,
-                  label_buffer, GLUT_BITMAP_9_BY_15);
+                  label_buffer, GLUT_BITMAP_9_BY_15 ,get_digits()); //suma
       }
     }
 }
index 621f7b2bf24faf237548284507baf0be579d48e5..09c0ee871054bc1117b2aaba19261b319bcd88b9 100644 (file)
@@ -29,7 +29,11 @@ HudLadder ::   HudLadder(  string name,
                           float     glide_slope_val,
                           bool      worm_energy,
                           bool      waypoint,
-                          bool      working) :
+                          bool      working,
+                          int           zenithsymbol, //suma
+                          int       nadirsymbol, //suma
+                          int           hat_marker): //suma
+
     dual_instr_item( x, y, width, height,
                     ptch_source,
                     roll_source,
@@ -58,8 +62,14 @@ HudLadder ::   HudLadder(  string name,
 
 
 {
-    if( !width_units ) {
-       width_units = 45;
+               
+    zenith= zenithsymbol; //suma
+       nadir=nadirsymbol; //suma
+       hat= hat_marker; //suma
+       if( !width_units ) 
+       {
+          width_units = 45;
     }
 }
    
@@ -152,11 +162,11 @@ void HudLadder :: draw( void )
     pla = get_throttleval();
 
     int lgear,wown,wowm,ilcanclaw,ihook;
-    ilcanclaw = get_iaux1();
-    lgear = get_iaux2();
-    wown = get_iaux3();
-    wowm = get_iaux4();
-    ihook = get_iaux5();
+    ilcanclaw = get_iaux2();
+    lgear = get_iaux3();
+    wown = get_iaux4();
+    wowm = get_iaux5();
+    ihook = get_iaux6();
     
     float pitch_value = current_ch1() * SGD_RADIANS_TO_DEGREES;
        
@@ -166,7 +176,8 @@ void HudLadder :: draw( void )
        clip_plane = true;
     }
     else
-       if(hudladder_type=="Pitch Ladder") {
+       // hudladder_type=="Pitch Ladder" 
+       {
            pitch_ladder = true;
            climb_dive_ladder = false;
            clip_plane = false;
@@ -239,11 +250,13 @@ void HudLadder :: draw( void )
            actslope = atan(up_vel/ground_vel)*SGD_RADIANS_TO_DEGREES;
        }
 
-       xvvr = (((atan2(Vyy,Vxx)*SGD_RADIANS_TO_DEGREES)-psi)*(640.0/45.0));
+       xvvr = (((atan2(Vyy,Vxx)*SGD_RADIANS_TO_DEGREES)-psi)*
+               (factor/globals->get_current_view()->get_win_ratio()));
        drift = ((atan2(Vyy,Vxx)*SGD_RADIANS_TO_DEGREES)-psi);
        yvvr = ((actslope - pitch_value)*factor);
        vel_y = ((actslope -pitch_value) * cos(roll_value) + drift*sin(roll_value))*factor;
-       vel_x = (-(actslope -pitch_value)*sin(roll_value) + drift*cos(roll_value))*(640/45.0);
+       vel_x = (-(actslope -pitch_value)*sin(roll_value) + drift*cos(roll_value))*
+               (factor/globals->get_current_view()->get_win_ratio());
        //  printf("%f %f %f %f\n",vel_x,vel_y,drift,psi);
        //****************************************************************    
        // OBJECT MOVING RETICLE
@@ -446,7 +459,8 @@ void HudLadder :: draw( void )
 
     //****************************************************************    
 
-    if(climb_dive_ladder) {// CONFORMAL_HUD
+    if(climb_dive_ladder)
+       {                     // CONFORMAL_HUD
 
        vmin              = pitch_value - (float)width_units;
        vmax              = pitch_value + (float)width_units; 
@@ -455,7 +469,8 @@ void HudLadder :: draw( void )
 
     }
     else 
-       if (pitch_ladder) {//Default Hud
+       // pitch_ladder - Default Hud
+       {
 
            vmin              = pitch_value - (float)width_units * 0.5f;
            vmax              = pitch_value + (float)width_units * 0.5f;
@@ -465,8 +480,8 @@ void HudLadder :: draw( void )
     glRotatef(roll_value * SGD_RADIANS_TO_DEGREES, 0.0, 0.0, 1.0);
     // FRL marker not rotated - this line shifted below
 
-    if( div_units ) {
-  
+    if( div_units ) 
+       {
         char     TextLadder[8] ;
         float    label_length ;
         float    label_height ;
@@ -475,34 +490,34 @@ void HudLadder :: draw( void )
         float    bot ;
         float    top ;
         float    text_offset = 4.0f ;
-       float    zero_offset = 0.0;
+       float    zero_offset = 0.0;
                
        if ( climb_dive_ladder ) {
-           zero_offset = 50.0f ;
+           zero_offset = 50.0f ; // horizon line is wider by this much (hard coded ??)
        } else {
-           if ( pitch_ladder ) {
                zero_offset = 10.0f ;
-            }
-        }
+    }
                
        fntFont *font      = HUDtext->getFont();
        float    pointsize = HUDtext->getPointSize();
        float    italic    = HUDtext->getSlant();
 
-        TextList.setFont( HUDtext );
-        TextList.erase();
-        LineList.erase();
-        StippleLineList.erase();
+    TextList.setFont( HUDtext );
+    TextList.erase();
+    LineList.erase();
+    StippleLineList.erase();
 
-        int last = FloatToInt(vmax)+1;
-        int i    = FloatToInt(vmin);
+    int last = FloatToInt(vmax)+1;
+    int i    = FloatToInt(vmin);
 
         if( !scr_hole ) {
            x_end =  half_span;
-            for( ; i<last ; i++ ) {
+            for( ; i<last ; i++ ) 
+                       {
                 
                 y =  (((float)(i - pitch_value) * factor) + .5f);
-                if( !(i % div_units ))    {        //  At integral multiple of div
+                if( !(i % div_units ))            //  At integral multiple of div
+                               {
                 
                     sprintf( TextLadder, "%d", i );
                     font->getBBox ( TextLadder, pointsize, italic,
@@ -513,15 +528,30 @@ void HudLadder :: draw( void )
                 
                     x_ini = -half_span;
                     
-                    if( i >= 0 ) {
+                    if( i >= 0 ) 
+                                       {
                         // Make zero point wider on left
                         if( i == 0 )
                             x_ini -= zero_offset;
-                        // Zero or above draw solid lines
-                        Line(x_ini, y, x_end, y);
+                            
+                                               // Zero or above draw solid lines
+                                               Line(x_ini, y, x_end, y);
+                                               
+                                               if(i == 90)
+                                               if(zenith == 1)
+                                               {
+                                                 drawZenith(x_ini, x_end,y);
+                                               }
                     } else {
                         // Below zero draw dashed lines.
                         StippleLine(x_ini, y, x_end, y);
+
+                                               
+                                               if(i == -90)
+                                               if(nadir ==1)
+                                               { 
+                                                       drawNadir(x_ini, x_end,y);
+                                               }
                     }
                     
                     // Calculate the position of the left text and write it.
@@ -536,7 +566,8 @@ void HudLadder :: draw( void )
 
                x_end = -half_span + hole;
                x_ini2= half_span  - hole;
-               for( ; i<last ; i++ )      {
+               for( ; i<last ; i++ )      
+               {
 
                    if(hudladder_type=="Pitch Ladder")
                        y = (((float)(i - pitch_value) * factor) + .5);
@@ -559,30 +590,48 @@ void HudLadder :: draw( void )
                        x_ini = -half_span;
                        x_end2= half_span;
                     
-                       if( i >= 0 ) { 
+                       if( i >= 0 ) 
+                       { 
                            // Make zero point wider on left
-                           if( i == 0 ) {
-                               x_ini -= zero_offset;
-                               x_end2 +=zero_offset;
-                           } else {
-                               if(climb_dive_ladder){
-                                   // Zero or above draw solid lines
-                                   Line(x_end, y-5.0, x_end, y);
-                                   Line(x_ini2, y-5.0, x_ini2, y);
-                               }
+                           if( i == 0 ) 
+                               {
+                                   x_ini -= zero_offset;
+                                       x_end2 +=zero_offset;
+                           } 
+                           //draw climb bar vertical lines
+                               if(climb_dive_ladder)
+                               {
+                                  // Zero or above draw solid lines
+                                  Line(x_end, y-5.0, x_end, y);
+                                  Line(x_ini2, y-5.0, x_ini2, y);
                            }
-
+                               // draw pitch / climb bar
                            Line(x_ini, y, x_end, y);
                            Line(x_ini2, y, x_end2, y);
 
-                       } else {
-                           // Below zero draw dashed lines.
-                           if(climb_dive_ladder) {
-                               Line(x_end, y+5.0, x_end, y);
-                               Line(x_ini2, y+5.0, x_ini2, y);
+                               if(i == 90)
+                               if(zenith == 1)
+                               {  
+                                 drawZenith(x_ini2, x_end,y);
+                               }
+                       }
+                       else  // i < 0
+                       {
+                           // draw dive bar vertical lines
+                           if(climb_dive_ladder) 
+                               {
+                                       Line(x_end, y+5.0, x_end, y);
+                                       Line(x_ini2, y+5.0, x_ini2, y);
                            }
-                           StippleLine(x_ini, y, x_end, y);
+                           // draw pitch / dive bars
+                               StippleLine(x_ini, y, x_end, y);
                            StippleLine(x_ini2, y, x_end2, y);
+               
+                           if(i == -90)
+                           if(nadir == 1)
+                               {
+                                   drawNadir(x_ini2, x_end,y);
+                               }
                        }
                     
                        // Now calculate the location of the left side label using
@@ -627,8 +676,8 @@ void HudLadder :: draw( void )
 
        fromwp_lon = get_longitude()*SGD_DEGREES_TO_RADIANS;
        fromwp_lat = get_latitude()*SGD_DEGREES_TO_RADIANS;
-       towp_lon = get_aux5()*SGD_DEGREES_TO_RADIANS;
-       towp_lat = get_aux6()*SGD_DEGREES_TO_RADIANS;
+       towp_lon = get_aux2()*SGD_DEGREES_TO_RADIANS;
+       towp_lat = get_aux1()*SGD_DEGREES_TO_RADIANS;
 
        dist = acos(sin(fromwp_lat)*sin(towp_lat)+cos(fromwp_lat)*cos(towp_lat)*cos(fabs(fromwp_lon-towp_lon)));
        delx= towp_lat - fromwp_lat;
@@ -651,7 +700,9 @@ void HudLadder :: draw( void )
        // OBJECT MOVING RETICLE
        // TYPE ARROW
        // waypoint marker
-       if (fabs(brg-psi) > 10.0) {
+
+         if (fabs(brg-psi) > 10.0) 
+         {
            glPushMatrix();
            glTranslatef( centroid.x, centroid.y, 0);
            glTranslatef( vel_x, vel_y, 0);
@@ -666,9 +717,13 @@ void HudLadder :: draw( void )
            glVertex2f(2.5,20.0);
            glEnd();
            glPopMatrix();
-       }
-       // waypoint marker on heading scale
-       if (fabs(brg-psi) < 12.0) {
+         }
+
+         // waypoint marker on heading scale
+         if (fabs(brg-psi) < 12.0) 
+         {
+         if(hat ==0)
+         {
            glBegin(GL_LINE_LOOP);
            glVertex2f(((brg-psi)*60/25)+320,240.0);
            glVertex2f(((brg-psi)*60/25)+326,240.0-4);
@@ -678,7 +733,155 @@ void HudLadder :: draw( void )
            glVertex2f(((brg-psi)*60/25)+317,240.0-4);
            glVertex2f(((brg-psi)*60/25)+314,240.0-4);
            glEnd();
-       }
-       //*************************************************************
-    }// if waypoint_marker
+         } else {//if hat=0
+
+                 float x= (brg-psi)*60/25 + 320,  y=240.0, r=5.0;
+                 float x1,y1;
+                                                               
+                 glEnable(GL_POINT_SMOOTH);
+                                                                                 
+         glBegin(GL_POINTS);
+                       
+                 for(int count=0; count<=200; count++)
+                 {
+                       float temp = count * 3.142 * 3 / (200.0*2.0);
+                       float temp1 = temp-(45.0*SGD_DEGREES_TO_RADIANS);
+                   x1 = x + r * cos(temp1); 
+                   y1 = y + r * sin(temp1);
+                                        
+                       glVertex2f(x1, y1);
+                 }
+                                       
+                 glEnd();
+                 glDisable(GL_POINT_SMOOTH); 
+         } //hat=0
+
+         } //brg<12
+    } // if waypoint_marker
 }//draw
+
+/******************************************************************/
+
+//begin suma
+       //  draws the zenith symbol  for highest possible climb angle (i,e 90 degree climb angle)
+
+void HudLadder :: 
+drawZenith(float xfirst,float xlast,float yvalue )
+{
+
+            float xcentre = (xfirst + xlast)/2.0;
+                float ycentre = yvalue;
+
+         Line(xcentre-9.0, ycentre, xcentre-3.0, ycentre+1.3);
+            Line(xcentre-9.0, ycentre, xcentre-3.0, ycentre-1.3);
+  
+            Line(xcentre+9.0, ycentre, xcentre+3.0, ycentre+1.3);
+            Line(xcentre+9.0, ycentre, xcentre+3.0, ycentre-1.3);
+
+            Line(xcentre, ycentre+9.0, xcentre-1.3, ycentre+3.0);
+            Line(xcentre, ycentre+9.0, xcentre+1.3, ycentre+3.0);
+
+                Line(xcentre-3.9, ycentre+3.9, xcentre-3.0, ycentre+1.3);
+            Line(xcentre-3.9, ycentre+3.9, xcentre-1.3, ycentre+3.0);
+
+            Line(xcentre+3.9, ycentre+3.9, xcentre+1.3, ycentre+3.0);
+            Line(xcentre+3.9, ycentre+3.9, xcentre+3.0, ycentre+1.3);
+
+            Line(xcentre-3.9, ycentre-3.9, xcentre-3.0, ycentre-1.3);
+            Line(xcentre-3.9, ycentre-3.9, xcentre-1.3, ycentre-2.6);
+
+            Line(xcentre+3.9, ycentre-3.9, xcentre+3.0, ycentre-1.3);
+            Line(xcentre+3.9, ycentre-3.9, xcentre+1.3, ycentre-2.6);
+
+            Line(xcentre-1.3, ycentre-2.6, xcentre, ycentre-27.0);
+         Line(xcentre+1.3, ycentre-2.6, xcentre, ycentre-27.0);
+
+  
+} 
+       //end suma
+
+//begin suma
+       //  draws the nadir symbol  for lowest possible dive angle (i,e 90 degree dive angle)
+
+
+void HudLadder ::
+drawNadir(float xfirst, float xlast, float yvalue)
+{
+
+            float xcentre = (xfirst + xlast)/2.0;
+                float ycentre = yvalue;    
+
+
+               float r = 7.5;
+               float ang,temp;
+               float x1,y1,x2,y2,xcent,ycent;
+
+       
+        // to draw a circle
+
+               float xcent1, xcent2, ycent1, ycent2;
+               xcent1 = xcentre + r * cos(0.0);
+               ycent1 = ycentre + r * sin(0.0);
+       for(int count=1; count<=400; count++) 
+               {  
+                       float temp = count * 2 * 3.142 / 400.0;
+                   xcent2 = xcentre + r * cos(temp); 
+                       ycent2 = ycentre + r * sin(temp);                           
+                       
+                       Line(xcent1, ycent1, xcent2, ycent2);
+
+                       xcent1 = xcent2;
+                       ycent1 = ycent2;
+               }     
+               
+               xcent2 = xcentre + r * cos(0.0);
+               ycent2 = ycentre + r * sin(0.0);
+
+        drawOneLine(xcent1, ycent1, xcent2, ycent2); //to connect last point to first point
+               //end circle
+
+
+               Line(xcentre, ycentre+7.5, xcentre, ycentre+22.5); //to draw a line above the circle
+
+               Line(xcentre-7.5, ycentre, xcentre+7.5,ycentre); //line in the middle of circle
+
+               float theta = asin (2.5/7.5);
+               float theta1 = asin(5.0/7.5);
+
+                x1 = xcentre + r * cos(theta);
+                y1 = ycentre + 2.5;
+
+                x2 = xcentre + r * cos((180.0 * SGD_DEGREES_TO_RADIANS) - theta);
+                y2 = ycentre + 2.5;
+
+                Line(x1,y1,x2,y2);
+
+               
+                x1 = xcentre + r * cos(theta1);
+                y1 = ycentre + 5.0;
+
+                x2 = xcentre + r * cos((180.0 * SGD_DEGREES_TO_RADIANS)-theta1);
+                y2 = ycentre + 5.0;
+
+                Line(x1,y1,x2,y2);
+
+
+                x1 = xcentre + r * cos((180.0 * SGD_DEGREES_TO_RADIANS) +theta);
+                y1 = ycentre - 2.5;
+
+                x2 = xcentre + r * cos((360.0* SGD_DEGREES_TO_RADIANS)-theta);
+                y2 = ycentre - 2.5;
+
+                Line(x1,y1,x2,y2);
+
+               
+                x1 = xcentre + r * cos((180.0* SGD_DEGREES_TO_RADIANS) +theta1);
+                y1 = ycentre - 5.0;
+
+                x2 = xcentre + r * cos((360.0* SGD_DEGREES_TO_RADIANS)-theta1);
+                y2 = ycentre - 5.0;
+
+                Line(x1,y1,x2,y2);
+
+
+}
index 4d57a6deb3cd5884c91cce404c8318270c8477e0..e9e6a45203e7d6e8388c8623bbcea2d0c7082d97 100644 (file)
@@ -3,9 +3,9 @@
 
 
 #ifdef USE_HUD_TextList
-#define textString( x , y, text, font )  TextString( text, x , y )
+#define textString( x , y, text, font,digit )  TextString( text, x , y,digit ) //suma
 #else
-#define textString( x , y, text, font )  puDrawString ( guiFnt, text, x, y );
+#define textString( x , y, text, font,digit )  puDrawString ( guiFnt, text, x, y ); //suma
 #endif
 
 //======================= Top of instr_label class =========================
@@ -23,9 +23,10 @@ lat_label ::
                       fgLabelJust   justification,
                       int           font_size,
                       int           blinking,
-                      bool          working ):
+                      bool          working ,
+                                         int                   digit): //suma
                            instr_item( x, y, width, height,
-                                       data_source, scale_data,options, working ),
+                                       data_source, scale_data,options, working,digit), //suma
                            pformat  ( label_format      ),
                            pre_str  ( pre_label_string  ),
                            post_str ( post_label_string ),
@@ -137,12 +138,12 @@ draw( void )       // Required method in base class
   
   if( fontSize == SMALL ) {
     textString( scrn_rect.left + posincr, scrn_rect.top,
-                label_buffer, GLUT_BITMAP_8_BY_13);
+                label_buffer, GLUT_BITMAP_8_BY_13, get_digits()); //suma
     }
   else  {
     if( fontSize == LARGE ) {
       textString( scrn_rect.left + posincr, scrn_rect.top,
-                  label_buffer, GLUT_BITMAP_9_BY_15);
+                  label_buffer, GLUT_BITMAP_9_BY_15,get_digits()); //suma
       }
     }
 }
index 869d91819ce97f2857b3edf9306f6e11dc1f66d5..74cae204afe04d73a3059101f709d65c41784572 100644 (file)
@@ -3,9 +3,9 @@
 
 
 #ifdef USE_HUD_TextList
-#define textString( x , y, text, font )  TextString( text, x , y )
+#define textString( x , y, text, font,digit )  TextString( text, x , y,digit ) //suma
 #else
-#define textString( x , y, text, font )  puDrawString ( guiFnt, text, x, y );
+#define textString( x , y, text, font,digit )  puDrawString ( guiFnt, text, x, y ); //suma
 #endif
 
 //======================= Top of instr_label class =========================
@@ -25,9 +25,10 @@ lon_label ::
                       fgLabelJust   justification,
                       int           font_size,
                       int           blinking,
-                      bool          working ):
+                      bool          working,
+                                         int                   digit): //suma
                            instr_item( x, y, width, height,
-                                       data_source, scale_data,options, working ),
+                                       data_source, scale_data,options, working,digit ), //suma
                            pformat  ( label_format      ),
                            pre_str  ( pre_label_string  ),
                            post_str ( post_label_string ),
@@ -140,12 +141,12 @@ draw( void )       // Required method in base class
   
   if( fontSize == SMALL ) {
     textString( scrn_rect.left + posincr, scrn_rect.top,
-                label_buffer, GLUT_BITMAP_8_BY_13);
+                label_buffer, GLUT_BITMAP_8_BY_13, get_digits()); //suma
     }
   else  {
     if( fontSize == LARGE ) {
       textString( scrn_rect.left + posincr, scrn_rect.top,
-                  label_buffer, GLUT_BITMAP_9_BY_15);
+                  label_buffer, GLUT_BITMAP_9_BY_15, get_digits()); //suma
       }
     }
 }
index e35eb434600e53075cbd52c18821456d63b12a0a..d4cc564e4bfdee136b231fc3a6b8d7a747fac091 100644 (file)
@@ -12,7 +12,7 @@
 //    markers) or just over the middle line.
 //
 // 2.  This class was not intended to be instanciated. See moving_scale
-//     and guage_instr classes.
+//     and gauge_instr classes.
 //============================================================================
 instr_scale ::
 instr_scale ( int       x,
index 31085aba568123f263615709201df2bc86495194..c6130c867b4f5b445c7b38f692898720a627a3ff 100644 (file)
@@ -1,5 +1,6 @@
 
 #include "hud.hxx"
+#include<math.h>
 
 
 //============ Top of fgTBI_instr class member definitions ==============
@@ -14,7 +15,9 @@ fgTBI_instr( int              x,
              float    maxBankAngle,
              float    maxSlipAngle,
              UINT      gap_width,
-             bool      working ) :
+             bool      working,
+                        bool      tsivalue, //suma
+                        float     radius) : //suma
                dual_instr_item( x, y, width, height,
                                 chn1_source,
                                 chn2_source,
@@ -24,6 +27,8 @@ fgTBI_instr( int              x,
                SlewLimit      ((int)(maxSlipAngle)),
                scr_hole       (gap_width   )
 {
+       tsi=tsivalue; //suma   
+       rad=radius; //suma
 }
 
 fgTBI_instr :: ~fgTBI_instr() {}
@@ -65,27 +70,35 @@ operator = (const fgTBI_instr & rhs )
      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 ) {
+     if( bank_angle < -SGD_PI_2/3 ) 
+        {
          bank_angle = -SGD_PI_2/3;
-     } else if( 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 = current_ch1(); // Sideslip limit +/- 20 degrees
+
+     if( sideslip_angle < -SGD_PI/9 ) 
+        {
          sideslip_angle = -SGD_PI/9;
-     } else if( 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;
+        tee   = -tee_height;
      fspan = span;
      hole  = scr_hole;
      ss_const = 2 * sideslip_angle * fspan/(SGD_2PI/9);  // width represents 40 degrees
@@ -93,36 +106,194 @@ operator = (const fgTBI_instr & rhs )
 //   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);
     
-     glBegin(GL_LINES);
+        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();
      
-     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();
-
-     glPopMatrix();
+               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);
+
+                 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);
+
+                 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);
+
+          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 (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);
+
+          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();
 }