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