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