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