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