]> git.mxchange.org Git - flightgear.git/blob - src/Cockpit/hud_card.cxx
Moved src/Model/loader.[ch]xx and src/Model/model.[ch]xx to
[flightgear.git] / src / Cockpit / hud_card.cxx
1 #include <plib/sg.h>
2 #include "hud.hxx"
3
4 #ifdef USE_HUD_TextList
5 #define textString( x , y, text, font,digit)  TextString( text, x , y ,digit ) //suma
6 #else
7 #define textString( x , y, text, font,digit )  puDrawString ( guiFnt, text, x, y ); //suma
8 #endif
9
10 //========== Top of hud_card class member definitions =============
11 //begin suma
12 #include<math.h>
13 #include <stdlib.h>
14 #include <stdio.h>
15 //end suma
16
17
18 hud_card ::
19 hud_card( int       x,
20           int       y,
21           UINT      width,
22           UINT      height,
23           FLTFNPTR  data_source,
24           UINT      options,
25           float     max_value, // 360
26           float     min_value, // 0
27           float     disp_scaling,
28           UINT      major_divs,
29           UINT      minor_divs,
30           UINT      modulus,  // 360
31           int       dp_showing,
32           float     value_span,
33           string    card_type,
34           bool      tick_bottom,
35           bool      tick_top,
36           bool      tick_right,
37           bool      tick_left,
38           bool      cap_bottom,
39           bool      cap_top,
40           bool      cap_right,
41           bool      cap_left,
42           float     mark_offset,
43           bool      pointer_enable,
44           string    type_pointer,
45           string    type_tick,//hud
46           string    length_tick,//hud
47           bool      working,
48           float     rad,//suma
49           int           divs, //suma
50           int           zooms //suma
51           ) :  //suma
52     instr_scale( x,y,width,height,
53                  data_source, options,
54                  value_span,
55                  max_value, min_value, disp_scaling,
56                  major_divs, minor_divs, modulus,
57                  working),
58     val_span             ( value_span),
59     type             ( card_type),
60     draw_tick_bottom (tick_bottom),
61     draw_tick_top    (tick_top),
62     draw_tick_right  (tick_right),
63     draw_tick_left   (tick_left),
64     draw_cap_bottom  (cap_bottom),
65     draw_cap_top     (cap_top),
66     draw_cap_right   (cap_right),
67     draw_cap_left    (cap_left),
68     marker_offset    (mark_offset),
69     pointer          (pointer_enable),
70     pointer_type     (type_pointer),
71     tick_type        (type_tick), //hud
72     tick_length      (length_tick), //hud
73     Maj_div          (major_divs), //suma
74     Min_div          (minor_divs) //suma
75
76 {
77     half_width_units = range_to_show() / 2.0;
78     radius=rad; //suma
79     maxValue=max_value; //suma
80     minValue=min_value; //suma
81     divisions=divs; //suma
82     zoom = zooms; //suma
83
84     //  UINT options     = get_options();
85     //  huds_both = (options & HUDS_BOTH) == HUDS_BOTH;
86     //  huds_right = options & HUDS_RIGHT;
87     //  huds_left = options & HUDS_LEFT;
88     //  huds_vert = options & HUDS_VERT;
89     //  huds_notext = options & HUDS_NOTEXT;
90     //  huds_top = options & HUDS_TOP;
91     //  huds_bottom = options & HUDS_BOTTOM;
92 }
93
94 hud_card ::
95 ~hud_card() { }
96
97 hud_card ::
98 hud_card( const hud_card & image):
99     instr_scale( (const instr_scale & ) image),
100     val_span( image.val_span),
101     type(image.type),
102     half_width_units (image.half_width_units),
103     draw_tick_bottom (image.draw_tick_bottom),
104     draw_tick_top (image.draw_tick_top),
105     draw_tick_right (image.draw_tick_right),
106     draw_tick_left (image.draw_tick_left),
107     draw_cap_bottom (image.draw_cap_bottom),
108     draw_cap_top (image.draw_cap_top),
109     draw_cap_right (image.draw_cap_right),
110     draw_cap_left (image.draw_cap_left),
111     marker_offset (image.marker_offset),
112     pointer (image.pointer),
113     pointer_type (image.pointer_type),
114     tick_type(image.tick_type), //hud
115     tick_length(image.tick_length), //hud
116     Maj_div(image.Maj_div), //suma
117     Min_div(image.Min_div)//suma
118
119 {
120     //  UINT options     = get_options();
121     //  huds_both = (options & HUDS_BOTH) == HUDS_BOTH;
122     //  huds_right = options & HUDS_RIGHT;
123     //  huds_left = options & HUDS_LEFT;
124     //  huds_vert = options & HUDS_VERT;
125     //  huds_notext = options & HUDS_NOTEXT;
126     //  huds_top = options & HUDS_TOP;
127     //  huds_bottom = options & HUDS_BOTTOM;
128 }
129
130 hud_card & hud_card ::
131 operator = (const hud_card & rhs )
132 {
133     if( !( this == &rhs)){
134         instr_scale::operator = (rhs);
135         val_span = rhs.val_span;
136         half_width_units = rhs.half_width_units;
137         draw_tick_bottom = rhs.draw_tick_bottom;
138         draw_tick_top    = rhs.draw_tick_top;
139         draw_tick_right  = rhs.draw_tick_right;
140         draw_tick_left   = rhs.draw_tick_left;
141         draw_cap_bottom  = rhs.draw_cap_bottom;
142         draw_cap_top     = rhs.draw_cap_top;
143         draw_cap_right   = rhs.draw_cap_right;
144         draw_cap_left    = rhs.draw_cap_left;
145         marker_offset    = rhs.marker_offset;
146         type             = rhs.type;
147         pointer                  = rhs.pointer;
148         pointer_type     = rhs.pointer_type;
149         tick_type                = rhs.tick_type;
150         tick_length              = rhs.tick_length;
151         Maj_div                  = rhs.Maj_div; //suma
152         Min_div                  = rhs.Min_div; //suma
153
154     }
155
156     return *this;
157 }
158
159 void hud_card ::
160 draw( void ) //  (HUD_scale * pscale )
161 {
162
163     float vmin = 0.0, vmax = 0.0;
164     int marker_xs;
165     int marker_xe;
166     int marker_ys;
167     int marker_ye;
168     int text_x = 0, text_y = 0;
169     int lenstr;
170     int height, width;
171     int i, last;
172     char TextScale[80];
173     bool condition;
174     int disp_val = 0;
175     int oddtype, k; //odd or even values for ticks
176
177     POINT mid_scr    = get_centroid();
178     float cur_value  = get_value();
179     
180     if (!((int)maxValue%2) )
181         oddtype =0; //draw ticks at even values
182     else
183         oddtype = 1;//draw ticks at odd values
184
185     RECT   scrn_rect = get_location();
186     UINT options     = get_options();
187
188     height = scrn_rect.top  + scrn_rect.bottom;
189     width = scrn_rect.left + scrn_rect.right;
190
191     //begin suma
192     // if type=gauge then display dial
193     if(type=="gauge") {
194         float x,y;
195         float i;
196         y=(float)(scrn_rect.top);
197         x=(float)(scrn_rect.left);
198         glEnable(GL_POINT_SMOOTH);
199         glPointSize(3.0);
200
201         float incr= 360.0/divisions;  
202         for(i=0.0;i<360.0;i+=incr) {
203             float i1=i*SGD_DEGREES_TO_RADIANS;
204             float x1=x+radius*cos(i1);
205             float y1=y+radius*sin(i1);
206                 
207             glBegin(GL_POINTS);
208             glVertex2f(x1,y1);
209             glEnd();
210         }
211         glPointSize(1.0);
212         glDisable(GL_POINT_SMOOTH);
213         
214          
215         if(data_available()) {  
216             float offset = 90.0*SGD_DEGREES_TO_RADIANS;
217             float r1=10.0; //size of carrot
218             float theta= get_value();
219
220             float theta1= -theta*SGD_DEGREES_TO_RADIANS+offset;
221             float x1=x+radius*cos(theta1);
222             float y1=y+radius*sin(theta1);
223             float x2=x1-r1*cos(theta1-30.0*SGD_DEGREES_TO_RADIANS);
224             float y2=y1-r1*sin(theta1-30.0*SGD_DEGREES_TO_RADIANS);
225             float x3=x1-r1*cos(theta1+30.0*SGD_DEGREES_TO_RADIANS);
226             float y3=y1-r1*sin(theta1+30.0*SGD_DEGREES_TO_RADIANS);
227                        
228             // draw carrot  
229             drawOneLine(x1,y1,x2,y2);
230             drawOneLine(x1,y1,x3,y3);
231             sprintf(TextScale,"%3.1f\n",theta);
232                  
233             // draw value
234             int l = abs((int)theta);
235             if (l) {
236                 if( l<10)
237                     textString (x,y,TextScale,GLUT_BITMAP_8_BY_13,0 );
238                 else if(l<100)
239                     textString (x-1.0,y,TextScale,GLUT_BITMAP_8_BY_13,0 );
240                 else if( l<360 )
241                     textString (x-2.0,y,TextScale,GLUT_BITMAP_8_BY_13,0 );
242             }
243                          
244         }
245       
246         //end type=gauge
247     } else {
248         // if its not explicitly a gauge default to tape
249         if(pointer) { 
250             if(pointer_type=="moving") { 
251                 vmin = minValue;
252                 vmax = maxValue;
253             } else {
254                 // default to fixed
255                 vmin   = cur_value - half_width_units; // width units == needle travel
256                 vmax   = cur_value + half_width_units; // or picture unit span.
257                 text_x = mid_scr.x;
258                 text_y = mid_scr.y;
259             }
260         } else {
261             vmin   = cur_value - half_width_units; // width units == needle travel
262             vmax   = cur_value + half_width_units; // or picture unit span.
263             text_x = mid_scr.x;
264             text_y = mid_scr.y;
265         }
266     
267         // Draw the basic markings for the scale...
268   
269         if( huds_vert(options) ) { // Vertical scale
270             if (draw_tick_bottom) {
271                 drawOneLine( scrn_rect.left,     // Bottom tick bar
272                              scrn_rect.top,
273                              width,
274                              scrn_rect.top);
275             } // endif draw_tick_bottom
276             if (draw_tick_top) {
277                 drawOneLine( scrn_rect.left,    // Top tick bar
278                              height,
279                              width,
280                              height );
281             } // endif draw_tick_top
282       
283             marker_xs = scrn_rect.left;  // x start
284             marker_xe = width;  // x extent
285             marker_ye = height;
286
287             //    glBegin(GL_LINES);
288       
289             // Bottom tick bar
290             //    glVertex2f( marker_xs, scrn_rect.top);
291             //    glVertex2f( marker_xe, scrn_rect.top);
292
293             // Top tick bar
294             //    glVertex2f( marker_xs, marker_ye);
295             //    glVertex2f( marker_xe, marker_ye );
296             //    glEnd();
297
298
299             // We do not use else in the following so that combining the
300             // two options produces a "caged" display with double
301             // carrots. The same is done for horizontal card indicators.
302         
303             // begin vertical/left
304             //First draw capping lines and pointers
305             if( huds_left(options) ) {    // Calculate x marker offset
306                         
307                 if (draw_cap_right) {
308                           
309                     drawOneLine( marker_xe, scrn_rect.top,
310                                  marker_xe, marker_ye); // Cap right side
311                 } //endif cap_right
312
313                 marker_xs  = marker_xe - scrn_rect.right / 3;   // Adjust tick xs
314
315                 // drawOneLine( marker_xs, mid_scr.y,
316                 //              marker_xe, mid_scr.y + scrn_rect.right / 6);
317                 // drawOneLine( marker_xs, mid_scr.y,
318                 //              marker_xe, mid_scr.y - scrn_rect.right / 6);
319
320                 // draw pointer
321                 if(pointer) {
322                     if(pointer_type=="moving") {
323                         if(zoom == 0) {
324                             //Code for Moving Type Pointer included by suma.
325                             float ycentre, ypoint,xpoint;
326                             int range,wth;
327                             if(cur_value > maxValue) cur_value = maxValue;
328                             if(cur_value < minValue) cur_value = minValue;
329                             if (minValue >= 0.0) 
330                                 ycentre = scrn_rect.top;
331                             else if (maxValue + minValue == 0.0)
332                                 ycentre = mid_scr.y;
333                             else
334                                 if (oddtype == 1) 
335                                     ycentre = scrn_rect.top + (1.0-minValue)*scrn_rect.bottom/(maxValue-minValue);
336                                 else
337                                     ycentre = scrn_rect.top + minValue*scrn_rect.bottom/(maxValue-minValue);
338                             range = scrn_rect.bottom;
339                             wth   = scrn_rect.left + scrn_rect.right;
340                             if (oddtype == 1)
341                                 ypoint = ycentre + ((cur_value-1.0) * range / val_span);
342                             else
343                                 ypoint = ycentre + (cur_value * range / val_span);
344                             xpoint = wth + marker_offset;
345                             drawOneLine(xpoint,ycentre,xpoint,ypoint);
346                             drawOneLine(xpoint,ypoint,xpoint-marker_offset,ypoint);
347                             drawOneLine(xpoint-marker_offset,ypoint,xpoint-5.0,ypoint+5.0);
348                             drawOneLine(xpoint-marker_offset,ypoint,xpoint-5.0,ypoint-5.0);
349                         }//zoom=0
350                     } else {
351                         // default to fixed
352                         fixed(marker_offset+marker_xe, text_y + scrn_rect.right / 6, 
353                               marker_offset+marker_xs, text_y,marker_offset+marker_xe, 
354                               text_y - scrn_rect.right / 6);
355                     }//end pointer type
356
357                 } //if pointer 
358             }  //end vertical/left
359                 
360             // begin vertical/right
361             //First draw capping lines and pointers
362             if( huds_right(options) ) {  // We'll default this for now.
363                 if (draw_cap_left) {
364                     drawOneLine( scrn_rect.left, scrn_rect.top,
365                                  scrn_rect.left, marker_ye );  // Cap left side
366                 } //endif cap_left
367
368                 marker_xe = scrn_rect.left + scrn_rect.right / 3;     // Adjust tick xe
369                 // Indicator carrot
370                 // drawOneLine( scrn_rect.left, mid_scr.y +  scrn_rect.right / 6,
371                 //              marker_xe, mid_scr.y );
372                 // drawOneLine( scrn_rect.left, mid_scr.y -  scrn_rect.right / 6,
373                 //              marker_xe, mid_scr.y);
374
375                 // draw pointer
376                 if(pointer) {
377                     if(pointer_type=="moving") {   
378                         if(zoom == 0) {
379                             //type-fixed & zoom=1, behaviour to be defined
380                             // Code for Moving Type Pointer included by suma.
381                             float ycentre, ypoint,xpoint;
382                             int range;
383                                                         
384                             if(cur_value > maxValue)
385                                 cur_value = maxValue;
386                             if(cur_value < minValue)
387                                 cur_value = minValue;
388                                                         
389                             if (minValue >= 0.0) 
390                                 ycentre = scrn_rect.top;
391                             else if (maxValue + minValue == 0.0)
392                                 ycentre = mid_scr.y;
393                             else
394                                 if (oddtype == 1) 
395                                     ycentre = scrn_rect.top + (1.0-minValue)*scrn_rect.bottom/(maxValue-minValue);
396                                 else
397                                     ycentre = scrn_rect.top + minValue*scrn_rect.bottom/(maxValue-minValue);
398                             range = scrn_rect.bottom;
399                                                         
400                             if (oddtype == 1)
401                                 ypoint = ycentre + ((cur_value-1.0) * range / val_span);
402                             else
403                                 ypoint = ycentre + (cur_value * range / val_span);
404                             xpoint = scrn_rect.left - marker_offset;
405                             drawOneLine(xpoint,ycentre,xpoint,ypoint);
406                             drawOneLine(xpoint,ypoint,xpoint+marker_offset,ypoint);
407                             drawOneLine(xpoint+marker_offset,ypoint,xpoint+5.0,ypoint+5.0);
408                             drawOneLine(xpoint+marker_offset,ypoint,xpoint+5.0,ypoint-5.0);
409                         }
410                     } else {
411                         // default to fixed
412                         fixed( -marker_offset+scrn_rect.left, text_y +  scrn_rect.right / 6,
413                                -marker_offset+marker_xe, text_y,-marker_offset+scrn_rect.left, 
414                                text_y -  scrn_rect.right / 6);                    
415                     }
416                 } //if pointer
417             }  //end vertical/right
418
419             // At this point marker x_start and x_end values are transposed.
420             // To keep this from confusing things they are now interchanged.
421             if(huds_both(options)) {
422                 marker_ye = marker_xs;
423                 marker_xs = marker_xe;
424                 marker_xe = marker_ye;
425             }
426
427             // Work through from bottom to top of scale. Calculating where to put
428             // minor and major ticks.
429             
430             // draw scale or tape
431                 
432 //            last = FloatToInt(vmax)+1;
433 //            i = FloatToInt(vmin);
434             last = (int)vmax + 1; // N
435             i = (int)vmin; // N
436
437             if(zoom ==1) { 
438                 zoomed_scale((int)vmin,(int)vmax); //suma
439             } else {
440                 for( ; i <last ; i++ ) {
441                     condition = true;
442                     if( !modulo()) {
443                         if( i < min_val()) {
444                             condition = false;
445                         }
446                     }
447
448                     if( condition ) {  // Show a tick if necessary
449                         // Calculate the location of this tick
450                         marker_ys = scrn_rect.top + FloatToInt(((i - vmin) * factor()/*+.5f*/));
451                         // marker_ys = scrn_rect.top + (int)((i - vmin) * factor() + .5);
452                         // Block calculation artifact from drawing ticks below min coordinate.
453                         // Calculation here accounts for text height.
454
455                         if(( marker_ys < (scrn_rect.top + 4)) |
456                            ( marker_ys > (height - 4)))
457                         {
458                             // Magic numbers!!!
459                             continue;
460                         }
461
462                         if (oddtype == 1) 
463                             k = i+1; //enable ticks at odd values
464                         else
465                             k = i;
466
467                         // Minor ticks
468                         if( div_min()) { 
469                             // if( (i%div_min()) == 0) {
470                             if( !(k%(int)div_min())) {             
471                                 if((( marker_ys - 5) > scrn_rect.top ) &&
472                                    (( marker_ys + 5) < (height))) {
473                             
474                                 //vertical/left OR vertical/right
475                                 if( huds_both(options) ) {
476                                     if(tick_type=="line") {
477                                         if(tick_length=="variable") {
478                                             drawOneLine( scrn_rect.left, marker_ys,
479                                                          marker_xs,      marker_ys );
480                                             drawOneLine( marker_xe,      marker_ys,
481                                                          width,  marker_ys );
482                                         } else {
483                                             drawOneLine( scrn_rect.left, marker_ys,
484                                                          marker_xs,      marker_ys );
485                                             drawOneLine( marker_xe,      marker_ys,
486                                                          width,  marker_ys );
487                                         }
488                                     } else if(tick_type=="circle") // begin suma  this func. is written below
489                                         circles(scrn_rect.left,(float)marker_ys,3.0); //end suma
490
491                                     else {
492                                         // if neither line nor circle draw default as line
493                                         drawOneLine( scrn_rect.left, marker_ys,
494                                                      marker_xs,      marker_ys );
495                                         drawOneLine( marker_xe,      marker_ys,
496                                                      width,  marker_ys );
497                                     }
498                                     // glBegin(GL_LINES);
499                                     // glVertex2f( scrn_rect.left, marker_ys );
500                                     // glVertex2f( marker_xs,      marker_ys );
501                                     // glVertex2f( marker_xe,      marker_ys);
502                                     // glVertex2f( scrn_rect.left + scrn_rect.right,  marker_ys );
503                                     // glEnd();
504                                     // anything other than huds_both
505                                 } else {
506                                     if( huds_left(options) ) {
507                                         if(tick_type=="line") {
508                                             if(tick_length=="variable") {
509                                                 drawOneLine( marker_xs + 4, marker_ys,
510                                                              marker_xe,     marker_ys );
511                                             } else {
512                                                 drawOneLine( marker_xs , marker_ys,
513                                                              marker_xe,     marker_ys );
514                                             } 
515                                         } else if(tick_type=="circle") // begin suma
516                                             circles((float)marker_xs + 4, (float)marker_ys,3.0); //end suma
517                                                                            
518                                         else { 
519                                             drawOneLine( marker_xs + 4, marker_ys,
520                                                          marker_xe,     marker_ys );
521                                         } 
522                                     }  else {
523                                         if(tick_type=="line") {
524                                             if(tick_length=="variable") {
525                                                 drawOneLine( marker_xs,     marker_ys,
526                                                              marker_xe - 4, marker_ys );
527                                             } else { 
528                                                 drawOneLine( marker_xs,     marker_ys,
529                                                              marker_xe , marker_ys );
530                                             } 
531                                         } else if(tick_type=="circle") //begin suma
532                                             circles((float)marker_xe - 4, (float)marker_ys,3.0);  //end suma
533                                         else { 
534                                             drawOneLine( marker_xs,     marker_ys,
535                                                          marker_xe - 4, marker_ys );
536                                         } 
537                                     } 
538                                 } //end huds both
539                               }
540                             } //end draw minor ticks
541                         }  //end minor ticks
542
543                         // Major ticks
544                         if( div_max() ) {
545                                         
546                             if( !(k%(int)div_max()) ) {
547                                 if(modulo()) {
548                                     disp_val = i % (int) modulo(); // ?????????
549                                     if( disp_val < 0) {
550                                         while(disp_val < 0)
551                                             disp_val += modulo();
552                                     }
553                                 } else {
554                                     disp_val = i;
555                                 } 
556
557                                 lenstr = sprintf( TextScale, "%d",
558                                                   FloatToInt(disp_val * data_scaling()/*+.5*/));
559                                 // (int)(disp_val  * data_scaling() +.5));
560                                 /* if(( (marker_ys - 8 ) > scrn_rect.top ) &&
561                                    ( (marker_ys + 8) < (height))){ */ //suma
562                                 // huds_both
563                                 if( huds_both(options) ) {
564                                     // drawOneLine( scrn_rect.left, marker_ys,
565                                     //              marker_xs,      marker_ys);
566                                     // drawOneLine( marker_xs, marker_ys,
567                                     //              scrn_rect.left + scrn_rect.right,
568                                     //              marker_ys);
569                                     if(tick_type=="line") {
570                                         glBegin(GL_LINE_STRIP);
571                                         glVertex2f( scrn_rect.left, marker_ys );
572                                         glVertex2f( marker_xs, marker_ys);
573                                         glVertex2f( width, marker_ys);
574                                         glEnd();
575                                     } else if(tick_type=="circle") //begin suma
576                                         circles(scrn_rect.left, (float)marker_ys,5.0); //end suma
577                                     else { 
578                                         glBegin(GL_LINE_STRIP);
579                                         glVertex2f( scrn_rect.left, marker_ys );
580                                         glVertex2f( marker_xs, marker_ys);
581                                         glVertex2f( width, marker_ys);
582                                         glEnd();
583                                     } 
584                                                                 
585                                     if( !huds_notext(options)) {
586                                         textString ( marker_xs + 2,  marker_ys,
587                                                      TextScale,  GLUT_BITMAP_8_BY_13,0 );
588                                     } 
589                                 } else { 
590                                     //begin suma 
591                                     /* Changes are made to draw a circle when tick_type="circle" */                                                     
592                                     // anything other than huds_both
593                                     if(tick_type=="line") {
594                                         drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
595                                     } else if(tick_type=="circle")
596                                         circles((float)marker_xs + 4, (float)marker_ys,5.0);//end suma
597                                     else {
598                                         drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
599                                     } 
600                                     if( !huds_notext(options) ) {
601                                         if( huds_left(options) ) { 
602                                             textString( marker_xs -  8 * lenstr - 2,
603                                                         marker_ys - 4,
604                                                         TextScale, GLUT_BITMAP_8_BY_13,0 );                                                                              
605                                         } else { 
606                                             textString( marker_xe + 3 * lenstr,
607                                                         marker_ys - 4,
608                                                         TextScale, GLUT_BITMAP_8_BY_13,0 );
609                                         } //End if huds_left
610                                     } //End if !huds_notext
611                                 }  //End if huds-both
612                             }  // End if draw major ticks
613                         }   // End if major ticks
614                     }  // End condition
615                 }  // End for 
616             }  //end of zoom
617             // End if VERTICAL SCALE TYPE (tape loop yet to be closed)
618         } else {
619             // Horizontal scale by default
620             // left tick bar
621             if (draw_tick_left) {
622                 drawOneLine( scrn_rect.left, scrn_rect.top,
623                              scrn_rect.left, height);
624             }  // endif draw_tick_left
625             // right tick bar
626             if (draw_tick_right) {
627                 drawOneLine( width, scrn_rect.top,
628                              width,
629                              height );
630             }  // endif draw_tick_right
631
632             marker_ys = scrn_rect.top;           // Starting point for
633             marker_ye = height;                  // tick y location calcs
634             marker_xe = width;
635             marker_xs = scrn_rect.left + FloatToInt((cur_value - vmin) * factor() /*+ .5f*/);
636                   
637
638             //    glBegin(GL_LINES);
639             // left tick bar
640             //    glVertex2f( scrn_rect.left, scrn_rect.top);
641             //    glVertex2f( scrn_rect.left, marker_ye);
642
643             // right tick bar
644             //    glVertex2f( marker_xe, scrn_rect.top);
645             //    glVertex2f( marker_xe, marker_ye );
646             //    glEnd();
647
648             if( huds_top(options) ) {
649                 if (draw_cap_bottom) {
650                     // Bottom box line
651                     drawOneLine( scrn_rect.left,
652                                  scrn_rect.top,
653                                  width,
654                                  scrn_rect.top);
655                 }  //endif cap_bottom
656
657                 // Tick point adjust
658                 marker_ye  = scrn_rect.top + scrn_rect.bottom / 2;
659                 // Bottom arrow
660                 // drawOneLine( mid_scr.x, marker_ye,
661                 //              mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
662                 // drawOneLine( mid_scr.x, marker_ye,
663                 //              mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
664                 // draw pointer
665                 if(pointer) {
666                     if(pointer_type=="moving") { 
667                         if (zoom ==0) {
668                             //Code for Moving Type Pointer included by suma.
669                             // static float xcentre,xpoint,ypoint;
670                             // static int range;
671                             if(cur_value > maxValue) cur_value = maxValue;
672                             if(cur_value < minValue) cur_value = minValue;
673                             float xcentre = mid_scr.x;
674                             int range = scrn_rect.right;
675                             float xpoint = xcentre + (cur_value * range / val_span);
676                             float ypoint = scrn_rect.top - marker_offset;
677                             drawOneLine(xcentre, ypoint,xpoint,ypoint);
678                             drawOneLine(xpoint,ypoint,xpoint,ypoint+marker_offset);
679                             drawOneLine(xpoint,ypoint+marker_offset,xpoint+5.0,ypoint+5.0);
680                             drawOneLine(xpoint,ypoint+marker_offset,xpoint-5.0,ypoint+5.0);
681                         } 
682                     } else { 
683                         //default to fixed
684                         fixed( marker_xs - scrn_rect.bottom / 4, scrn_rect.top,
685                                marker_xs, marker_ye, marker_xs + scrn_rect.bottom / 4,scrn_rect.top);
686                     } 
687                 }  //if pointer
688             } //End Horizontal scale/top
689
690             if( huds_bottom(options) ) {
691                 // Top box line
692                 if (draw_cap_top) {
693                     drawOneLine( scrn_rect.left, height,
694                                  width, height);
695                 }  //endif cap_top
696
697                 // Tick point adjust
698                 marker_ys = height - scrn_rect.bottom  / 2;
699                 // Top arrow
700                 //      drawOneLine( mid_scr.x + scrn_rect.bottom / 4,
701                 //                   scrn_rect.top + scrn_rect.bottom,
702                 //                   mid_scr.x, marker_ys );
703                 //      drawOneLine( mid_scr.x - scrn_rect.bottom / 4,
704                 //                   scrn_rect.top + scrn_rect.bottom,
705                 //                   mid_scr.x , marker_ys );
706             
707                 // draw pointer
708                 if(pointer) {
709                     if(pointer_type=="moving") { 
710                         if(zoom == 0) { 
711                             //Code for Moving Type Pointer included by suma.
712                             // static float xcentre,xpoint,ypoint;
713                             // static int range,hgt;
714                             if(cur_value > maxValue) cur_value = maxValue;
715                             if(cur_value < minValue) cur_value = minValue;
716                             float xcentre = mid_scr.x ;
717                             int range = scrn_rect.right;
718                             int hgt   = scrn_rect.top + scrn_rect.bottom;
719                             float xpoint = xcentre + (cur_value * range / val_span);
720                             float ypoint = hgt + marker_offset;
721                             drawOneLine(xcentre, ypoint,xpoint,ypoint);
722                             drawOneLine(xpoint,ypoint,xpoint,ypoint-marker_offset);
723                             drawOneLine(xpoint,ypoint-marker_offset,xpoint+5.0,ypoint-5.0);
724                             drawOneLine(xpoint,ypoint-marker_offset,xpoint-5.0,ypoint-5.0);
725                         } 
726                     } else { 
727                         fixed( marker_xs + scrn_rect.bottom / 4, height, marker_xs, marker_ys,
728                                marker_xs - scrn_rect.bottom / 4, height);
729                                 }  
730                 } //if pointer
731             }  //end horizontal scale bottom
732
733             //    if(( options & HUDS_BOTTOM) == HUDS_BOTTOM ) {
734             //      marker_xe = marker_ys;
735             //      marker_ys = marker_ye;
736             //      marker_ye = marker_xe;
737             //      }
738
739             // printf("vmin = %d  vmax = %d\n", (int)vmin, (int)vmax);
740             
741             //  last = FloatToInt(vmax)+1;
742             //  i    = FloatToInt(vmin);
743
744             if(zoom ==1) {  
745                 zoomed_scale((int)vmin,(int)vmax); //suma
746             } else  { 
747                 //default to zoom=0
748                 last = (int)vmax + 1;
749                 i = (int)vmin;
750                 for(; i <last ; i++ ) {
751                     // for( i = (int)vmin; i <= (int)vmax; i++ )     {
752                     // printf("<*> i = %d\n", i);
753                     condition = true;
754                     if( !modulo()) {
755                         if( i < min_val()) {
756                             condition = false;
757                         }
758                     } 
759                     // printf("<**> i = %d\n", i);
760                     if( condition )        {
761                         // marker_xs = scrn_rect.left + (int)((i - vmin) * factor() + .5);
762                         marker_xs = scrn_rect.left + FloatToInt(((i - vmin) * factor()/*+ .5f*/));
763
764                         if (oddtype == 1) 
765                             k = i+1; //enable ticks at odd values
766                         else
767                             k = i;
768
769                         if( div_min()) {
770                             //          if( (i%(int)div_min()) == 0 ) {
771                             //draw minor ticks
772                             if( !(k%(int)div_min() )) {           
773                                 // draw in ticks only if they aren't too close to the edge.
774                                 if((( marker_xs - 5) > scrn_rect.left ) &&
775                                   (( marker_xs + 5 )< (scrn_rect.left + scrn_rect.right))){
776                             
777                                 if( huds_both(options) ) { 
778                                     if(tick_length=="variable") { 
779                                         drawOneLine( marker_xs, scrn_rect.top,
780                                                      marker_xs, marker_ys - 4);
781                                         drawOneLine( marker_xs, marker_ye + 4,
782                                                      marker_xs, height);
783                                     } else { 
784                                         drawOneLine( marker_xs, scrn_rect.top,
785                                                      marker_xs, marker_ys);
786                                         drawOneLine( marker_xs, marker_ye,
787                                                      marker_xs, height);
788                                     } 
789                                     // glBegin(GL_LINES);
790                                     // glVertex2f( marker_xs, scrn_rect.top);
791                                     // glVertex2f( marker_xs, marker_ys - 4);
792                                     // glVertex2f( marker_xs, marker_ye + 4);
793                                                 // glVertex2f( marker_xs, scrn_rect.top + scrn_rect.bottom);
794                                     // glEnd();
795                                 }  else {
796                                     if( huds_top(options)) {
797                                         //draw minor ticks
798                                         if(tick_length=="variable")
799                                             drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye-4);
800                                         else
801                                             drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye);
802                                     } else  
803                                         if(tick_length=="variable")
804                                             drawOneLine(marker_xs,marker_ys+4,marker_xs,marker_ye);
805                                         else
806                                             drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye);
807                                 }
808                               }
809                             } //end draw minor ticks
810                         } //end minor ticks
811                         //major ticks
812                         if( div_max()) {
813                             // printf("i = %d\n", i);
814                             //          if( (i%(int)div_max())==0 ) {
815                             //draw major ticks
816                             if( !(k%(int)div_max()) ) {           
817                                 if(modulo()) {
818                                     disp_val = i % (int) modulo(); // ?????????
819                                     if( disp_val < 0) {
820                                         while(disp_val<0)
821                                             disp_val += modulo();
822                                     } 
823                                 } else {
824                                     disp_val = i;
825                                 } 
826                                 // printf("disp_val = %d\n", disp_val);
827                                 // printf("%d\n", (int)(disp_val  * (double)data_scaling() + 0.5));
828                                 lenstr = sprintf( TextScale, "%d",
829                                                   // (int)(disp_val  * data_scaling() +.5));
830                                                   FloatToInt(disp_val * data_scaling()/*+.5*/));
831                                 // Draw major ticks and text only if far enough from the edge.
832                                 if(( (marker_xs - 10)> scrn_rect.left ) &&
833                                           ( (marker_xs + 10) < (scrn_rect.left + scrn_rect.right))){
834                                 if( huds_both(options) ) {
835                                     // drawOneLine( marker_xs, scrn_rect.top,
836                                     //              marker_xs, marker_ys);
837                                     // drawOneLine( marker_xs, marker_ye,
838                                     //              marker_xs, scrn_rect.top + scrn_rect.bottom);
839                                     glBegin(GL_LINE_STRIP);
840                                     glVertex2f( marker_xs, scrn_rect.top);
841                                     glVertex2f( marker_xs, marker_ye);
842                                     glVertex2f( marker_xs, height);
843                                     glEnd();
844                                     if( !huds_notext(options) ) {
845                                         textString ( marker_xs - 4 * lenstr,
846                                                      marker_ys + 4,
847                                                              TextScale,  GLUT_BITMAP_8_BY_13,0 ); //suma
848                                     } 
849                                 } else {
850                                     drawOneLine( marker_xs, marker_ys,
851                                                  marker_xs, marker_ye );
852                                     if( !huds_notext(options)) {
853                                         if( huds_top(options) )              {
854                                             textString ( marker_xs - 4 * lenstr,
855                                                          height - 10,
856                                                          TextScale, GLUT_BITMAP_8_BY_13,0 ); //suma
857                                         }  else  {
858                                             textString( marker_xs - 4 * lenstr,
859                                                         scrn_rect.top,
860                                                         TextScale, GLUT_BITMAP_8_BY_13,0 ); //suma
861                                         } 
862                                     } 
863                                 }
864                               }
865                             }  //end draw major ticks
866                         } //endif major ticks
867                     }   //end condition
868                 } //end for
869             }  //end zoom
870         } //end horizontal/vertical scale
871     } // end of type tape
872 } //draw
873
874
875 //begin suma
876
877 void hud_card :: 
878 circles(float x,float y,float size)
879 {
880     glEnable(GL_POINT_SMOOTH);
881     glPointSize(size); 
882
883     glBegin(GL_POINTS);
884     glVertex2f(x,y);
885     glEnd();
886                                                                                   
887     glPointSize(1.0);
888     glDisable(GL_POINT_SMOOTH); 
889 }
890  
891 //end suma
892
893 void hud_card ::
894 fixed(float x1, float y1, float x2, float y2, float x3, float y3)
895 {
896     glBegin(GL_LINE_STRIP);
897     glVertex2f(x1, y1);
898     glVertex2f(x2, y2);
899     glVertex2f(x3, y3);   
900     glEnd();
901 }
902
903
904 void hud_card ::
905 zoomed_scale(int first, int last)
906 {
907         
908     POINT mid_scr    = get_centroid();
909     RECT   scrn_rect = get_location();
910     UINT options     = get_options();
911     char TextScale[80];
912     // int disp_val = 0;
913     int data[80];
914  
915     float x,y,w,h,bottom;
916     float cur_value=get_value();
917     if(cur_value > maxValue) cur_value = maxValue;
918     if(cur_value < minValue) cur_value = minValue;
919         
920     int a=0;
921         
922     while(first <= last) {
923         if((first % (int)Maj_div) == 0) {   
924             data[a] = first;
925             a++ ;
926         }
927         first++;
928     }
929     int centre =a/2;
930
931         
932     if( huds_vert(options) ) {
933
934         x=scrn_rect.left;
935         y=scrn_rect.top;
936         w=scrn_rect.left+scrn_rect.right;
937         h=scrn_rect.top+scrn_rect.bottom;
938         bottom=scrn_rect.bottom;
939             
940         float xstart, yfirst, ycentre, ysecond; 
941
942         float hgt = bottom * 20.0 /100.0;  // 60% of height should be zoomed
943         yfirst = mid_scr.y - hgt;
944         ycentre = mid_scr.y;
945         ysecond = mid_scr.y + hgt;
946         float range = hgt * 2;
947                 
948         int i;
949         float factor = range /10.0;
950        
951         float hgt1 = bottom * 30.0 /100.0;
952         int  incrs = ((int)val_span - (Maj_div * 2)) / Maj_div ;
953         int  incr = incrs / 2;
954         float factors = hgt1 / incr;
955
956
957
958         // begin
959         //this is for moving type pointer 
960         static float ycent, ypoint,xpoint;
961         static int wth;
962                  
963         ycent = mid_scr.y;
964         wth=scrn_rect.left+scrn_rect.right;
965                  
966         if(cur_value <= data[centre+1])
967             if(cur_value > data[centre]) {  
968                 ypoint = ycent + ((cur_value - data[centre]) * hgt/Maj_div);
969             }                                                      
970
971         if(cur_value >= data[centre-1])
972             if(cur_value <= data[centre]) { 
973                 ypoint = ycent - ((data[centre]-cur_value) * hgt/Maj_div);
974             } 
975
976         if(cur_value < data[centre-1])
977             if(cur_value >= minValue) {   
978                 float diff  = minValue  - data[centre-1];
979                 float diff1 = cur_value - data[centre-1];
980                 float val = (diff1 * hgt1) / diff;
981                           
982                 ypoint = ycent - hgt -  val;
983             }                                                      
984                 
985
986         if(cur_value > data[centre+1])
987             if(cur_value <= maxValue) {    
988                 float diff  = maxValue  - data[centre+1];
989                 float diff1 = cur_value - data[centre+1];
990                 float val = (diff1 * hgt1) / diff;
991                           
992                 ypoint = ycent + hgt +  val;
993             }            
994                                    
995         if(huds_left(options)) { 
996             xstart = w;
997
998             drawOneLine( xstart, ycentre, xstart - 5.0, ycentre); //centre tick
999            
1000             sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
1001
1002             if( !huds_notext(options)) { 
1003                 textString (x, ycentre, TextScale, GLUT_BITMAP_8_BY_13,0 );
1004             } 
1005         
1006             for(i=1;i<5;i++) {  
1007                 yfirst  += factor;
1008                 ycentre += factor;
1009                 circles(xstart-2.5,yfirst, 3.0);
1010                 circles(xstart-2.5,ycentre,3.0);
1011             } 
1012                                                 
1013             yfirst = mid_scr.y - hgt;
1014
1015             for(i=0;i<=incr;i++) { 
1016                 drawOneLine( xstart, yfirst, xstart - 5.0, yfirst);
1017                 drawOneLine( xstart,ysecond, xstart - 5.0,ysecond);
1018                 
1019                 sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
1020
1021                 if( !huds_notext(options)) 
1022                     textString (x, yfirst, TextScale, GLUT_BITMAP_8_BY_13,0 );
1023                    
1024                 sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
1025
1026                 if( !huds_notext(options)) 
1027                     textString (x, ysecond, TextScale, GLUT_BITMAP_8_BY_13,0 );
1028                    
1029
1030                 yfirst    -= factors;
1031                 ysecond   += factors;
1032
1033             } 
1034             //to draw moving type pointer for left option
1035             //begin             
1036             xpoint = wth + 10.0;
1037         
1038             if(pointer_type == "moving") { 
1039                 drawOneLine(xpoint,ycent,xpoint,ypoint);
1040                 drawOneLine(xpoint,ypoint,xpoint-10.0,ypoint);
1041                 drawOneLine(xpoint-10.0,ypoint,xpoint-5.0,ypoint+5.0);
1042                 drawOneLine(xpoint-10.0,ypoint,xpoint-5.0,ypoint-5.0);
1043             } 
1044             //end
1045         
1046         } else { 
1047             //huds_right
1048             xstart = (x+w)/2;
1049            
1050             drawOneLine( xstart, ycentre, xstart + 5.0, ycentre); //centre tick
1051            
1052             sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
1053
1054             if( !huds_notext(options)) { 
1055                 textString (w, ycentre, TextScale, GLUT_BITMAP_8_BY_13,0 );
1056             } 
1057         
1058             for(i=1;i<5;i++) {  
1059                 yfirst  += factor;
1060                 ycentre += factor;
1061                 circles(xstart+2.5,yfirst, 3.0);
1062                 circles(xstart+2.5,ycentre,3.0);
1063             } 
1064                                                 
1065             yfirst = mid_scr.y - hgt;
1066
1067             for(i=0;i<=incr;i++) { 
1068                 drawOneLine( xstart, yfirst, xstart + 5.0, yfirst);
1069                 drawOneLine( xstart,ysecond, xstart + 5.0,ysecond);
1070                   
1071                 sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
1072
1073                 if( !huds_notext(options)) 
1074                     textString (w, yfirst, TextScale, GLUT_BITMAP_8_BY_13,0 );
1075                    
1076                 sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
1077
1078                 if( !huds_notext(options)) 
1079                     textString (w, ysecond, TextScale, GLUT_BITMAP_8_BY_13,0 );
1080                    
1081                 yfirst -= factors;
1082                 ysecond   += factors;
1083
1084             } 
1085
1086             // to draw moving type pointer for right option
1087             //begin               
1088             xpoint = scrn_rect.left;
1089                 
1090             if(pointer_type == "moving") { 
1091                 drawOneLine(xpoint,ycent,xpoint,ypoint);
1092                 drawOneLine(xpoint,ypoint,xpoint+10.0,ypoint);
1093                 drawOneLine(xpoint+10.0,ypoint,xpoint+5.0,ypoint+5.0);
1094                 drawOneLine(xpoint+10.0,ypoint,xpoint+5.0,ypoint-5.0);
1095             } 
1096             //end                                        
1097         }//end huds_right /left
1098         //end of vertical scale
1099     } else { 
1100         //horizontal scale
1101         x=scrn_rect.left;
1102         y=scrn_rect.top;
1103         w=scrn_rect.left+scrn_rect.right;
1104         h=scrn_rect.top+scrn_rect.bottom;
1105         bottom=scrn_rect.right;
1106             
1107         float ystart, xfirst, xcentre, xsecond; 
1108
1109         float hgt = bottom * 20.0 /100.0;  // 60% of height should be zoomed
1110         xfirst = mid_scr.x - hgt;
1111         xcentre = mid_scr.x;
1112         xsecond = mid_scr.x + hgt;
1113         float range = hgt * 2;
1114                 
1115         int i;
1116         float factor = range /10.0;
1117
1118         float hgt1 = bottom * 30.0 /100.0;
1119         int  incrs = ((int)val_span - (Maj_div * 2)) / Maj_div ;
1120         int  incr = incrs / 2;
1121         float factors = hgt1 / incr;
1122
1123                 
1124         //Code for Moving Type Pointer
1125         //begin
1126         static float xcent,xpoint,ypoint;
1127                 
1128         xcent = mid_scr.x;
1129                  
1130         if(cur_value <= data[centre+1])
1131             if(cur_value > data[centre]) {   
1132                 xpoint = xcent + ((cur_value - data[centre]) * hgt/Maj_div);
1133             }                                                      
1134         
1135         if(cur_value >= data[centre-1])
1136             if(cur_value <= data[centre]) {   
1137                 xpoint = xcent - ((data[centre]-cur_value) * hgt/Maj_div);
1138             }     
1139                    
1140         if(cur_value < data[centre-1])
1141             if(cur_value >= minValue) {   
1142                 float diff  = minValue  - data[centre-1];
1143                 float diff1 = cur_value - data[centre-1];
1144                 float val = (diff1 * hgt1) / diff;
1145                           
1146                 xpoint = xcent - hgt -  val;
1147             }
1148                 
1149            
1150         if(cur_value > data[centre+1])
1151             if(cur_value <= maxValue) {   
1152                 float diff  = maxValue  - data[centre+1];
1153                 float diff1 = cur_value - data[centre+1];
1154                 float val = (diff1 * hgt1) / diff;
1155                           
1156                 xpoint = xcent + hgt +  val;
1157             }                                                      
1158                 
1159         //end
1160         if(huds_top(options)) { 
1161
1162             ystart =h;
1163            
1164             drawOneLine( xcentre, ystart, xcentre, ystart - 5.0); //centre tick
1165            
1166             sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
1167
1168             if( !huds_notext(options)) { 
1169                 textString (xcentre-10.0, y, TextScale, GLUT_BITMAP_8_BY_13,0 );
1170             } 
1171         
1172             for(i=1;i<5;i++) {  
1173                 xfirst  += factor;
1174                 xcentre += factor;
1175                 circles(xfirst,  ystart-2.5, 3.0);
1176                 circles(xcentre, ystart-2.5, 3.0);
1177             } 
1178                                                 
1179             xfirst = mid_scr.x - hgt;                           
1180            
1181             for(i=0;i<=incr;i++) { 
1182                 drawOneLine( xfirst,  ystart, xfirst,  ystart - 5.0);
1183                 drawOneLine( xsecond, ystart, xsecond, ystart - 5.0);
1184                   
1185                 sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
1186
1187                 if( !huds_notext(options)) 
1188                     textString (xfirst-10.0, y, TextScale, GLUT_BITMAP_8_BY_13,0 );
1189                    
1190                 sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
1191                             
1192                 if( !huds_notext(options)) 
1193                     textString (xsecond-10.0, y, TextScale, GLUT_BITMAP_8_BY_13,0 );
1194                    
1195
1196                 xfirst -= factors;
1197                 xsecond   += factors;
1198                 
1199             } 
1200             //this is for moving pointer for top option
1201             //begin
1202                 
1203             ypoint = scrn_rect.top + scrn_rect.bottom + 10.0;
1204
1205             if(pointer_type == "moving") { 
1206                 drawOneLine(xcent, ypoint,xpoint,ypoint);
1207                 drawOneLine(xpoint,ypoint,xpoint,ypoint-10.0);
1208                 drawOneLine(xpoint,ypoint-10.0,xpoint+5.0,ypoint-5.0);
1209                 drawOneLine(xpoint,ypoint-10.0,xpoint-5.0,ypoint-5.0);
1210             } 
1211             //end of top option
1212         } else { 
1213             //else huds_bottom
1214             ystart = (y+h)/2;
1215                         
1216             //drawOneLine( xstart, yfirst,  xstart - 5.0, yfirst );
1217             drawOneLine( xcentre, ystart, xcentre, ystart + 5.0); //centre tick
1218            
1219             sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
1220             
1221             if( !huds_notext(options)) { 
1222                 textString (xcentre-10.0, h, TextScale, GLUT_BITMAP_8_BY_13,0 );
1223             } 
1224         
1225             for(i=1;i<5;i++) {  
1226                 xfirst  += factor;
1227                 xcentre += factor;
1228                 circles(xfirst,  ystart+2.5, 3.0);
1229                 circles(xcentre, ystart+2.5,3.0);
1230             } 
1231                                                 
1232             xfirst = mid_scr.x - hgt;
1233                 
1234             for(i=0;i<=incr;i++) { 
1235                 drawOneLine( xfirst, ystart, xfirst, ystart + 5.0);
1236                 drawOneLine( xsecond,ystart, xsecond,ystart + 5.0);
1237                 
1238                 sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
1239
1240                 if( !huds_notext(options)) 
1241                     textString (xfirst-10.0,h, TextScale, GLUT_BITMAP_8_BY_13,0 );
1242                    
1243                 sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
1244
1245                 if( !huds_notext(options)) 
1246                     textString (xsecond-10.0,h, TextScale, GLUT_BITMAP_8_BY_13,0 );
1247                    
1248
1249                 xfirst -= factors;
1250                 xsecond   += factors;
1251
1252             } 
1253             //this is for movimg pointer for bottom option
1254             //begin
1255         
1256             ypoint = scrn_rect.top - 10.0;
1257             if(pointer_type == "moving") { 
1258                 drawOneLine(xcent, ypoint,xpoint,ypoint);
1259                 drawOneLine(xpoint,ypoint,xpoint,ypoint+10.0);
1260                 drawOneLine(xpoint,ypoint+10.0,xpoint+5.0,ypoint+5.0);
1261                 drawOneLine(xpoint,ypoint+10.0,xpoint-5.0,ypoint+5.0);
1262             } 
1263
1264                 
1265             //end                       
1266         }//end hud_top or hud_bottom 
1267
1268     }  //end of horizontal/vertical scales
1269
1270 }//end draw