+
+ if( condition ) { // Show a tick if necessary
+ // Calculate the location of this tick
+ marker_ys = scrn_rect.top + FloatToInt(((i - vmin) * factor()/*+.5f*/));
+ // marker_ys = scrn_rect.top + (int)((i - vmin) * factor() + .5);
+ // Block calculation artifact from drawing ticks below min coordinate.
+ // Calculation here accounts for text height.
+
+ if(( marker_ys < (scrn_rect.top + 4)) |
+ ( marker_ys > (height - 4)))
+ {
+ // Magic numbers!!!
+ continue;
+ }
+
+ if (oddtype == 1)
+ k = i+1; //enable ticks at odd values
+ else
+ k = i;
+
+ // Minor ticks
+ if( div_min()) {
+ // if( (i%div_min()) == 0) {
+ if( !(k%(int)div_min())) {
+ if((( marker_ys - 5) > scrn_rect.top ) &&
+ (( marker_ys + 5) < (height))) {
+
+ //vertical/left OR vertical/right
+ if( huds_both(options) ) {
+ if(tick_type=="line") {
+ if(tick_length=="variable") {
+ drawOneLine( scrn_rect.left, marker_ys,
+ marker_xs, marker_ys );
+ drawOneLine( marker_xe, marker_ys,
+ width, marker_ys );
+ } else {
+ drawOneLine( scrn_rect.left, marker_ys,
+ marker_xs, marker_ys );
+ drawOneLine( marker_xe, marker_ys,
+ width, marker_ys );
+ }
+ } else if(tick_type=="circle") // begin suma this func. is written below
+ circles(scrn_rect.left,(float)marker_ys,3.0); //end suma
+
+ else {
+ // if neither line nor circle draw default as line
+ drawOneLine( scrn_rect.left, marker_ys,
+ marker_xs, marker_ys );
+ drawOneLine( marker_xe, marker_ys,
+ width, marker_ys );
+ }
+ // glBegin(GL_LINES);
+ // glVertex2f( scrn_rect.left, marker_ys );
+ // glVertex2f( marker_xs, marker_ys );
+ // glVertex2f( marker_xe, marker_ys);
+ // glVertex2f( scrn_rect.left + scrn_rect.right, marker_ys );
+ // glEnd();
+ // anything other than huds_both
+ } else {
+ if( huds_left(options) ) {
+ if(tick_type=="line") {
+ if(tick_length=="variable") {
+ drawOneLine( marker_xs + 4, marker_ys,
+ marker_xe, marker_ys );
+ } else {
+ drawOneLine( marker_xs , marker_ys,
+ marker_xe, marker_ys );
+ }
+ } else if(tick_type=="circle") // begin suma
+ circles((float)marker_xs + 4, (float)marker_ys,3.0); //end suma
+
+ else {
+ drawOneLine( marker_xs + 4, marker_ys,
+ marker_xe, marker_ys );
+ }
+ } else {
+ if(tick_type=="line") {
+ if(tick_length=="variable") {
+ drawOneLine( marker_xs, marker_ys,
+ marker_xe - 4, marker_ys );
+ } else {
+ drawOneLine( marker_xs, marker_ys,
+ marker_xe , marker_ys );
+ }
+ } else if(tick_type=="circle") //begin suma
+ circles((float)marker_xe - 4, (float)marker_ys,3.0); //end suma
+ else {
+ drawOneLine( marker_xs, marker_ys,
+ marker_xe - 4, marker_ys );
+ }
+ }
+ } //end huds both
+ }
+ } //end draw minor ticks
+ } //end minor ticks
+
+ // Major ticks
+ if( div_max() ) {
+
+ if( !(k%(int)div_max()) ) {
+ if(modulo()) {
+ disp_val = i % (int) modulo(); // ?????????
+ if( disp_val < 0) {
+ while(disp_val < 0)
+ disp_val += modulo();
+ }
+ } else {
+ disp_val = i;
+ }
+
+ lenstr = sprintf( TextScale, "%d",
+ FloatToInt(disp_val * data_scaling()/*+.5*/));
+ // (int)(disp_val * data_scaling() +.5));
+ /* if(( (marker_ys - 8 ) > scrn_rect.top ) &&
+ ( (marker_ys + 8) < (height))){ */ //suma
+ // huds_both
+ if( huds_both(options) ) {
+ // drawOneLine( scrn_rect.left, marker_ys,
+ // marker_xs, marker_ys);
+ // drawOneLine( marker_xs, marker_ys,
+ // scrn_rect.left + scrn_rect.right,
+ // marker_ys);
+ if(tick_type=="line") {
+ glBegin(GL_LINE_STRIP);
+ glVertex2f( scrn_rect.left, marker_ys );
+ glVertex2f( marker_xs, marker_ys);
+ glVertex2f( width, marker_ys);
+ glEnd();
+ } else if(tick_type=="circle") //begin suma
+ circles(scrn_rect.left, (float)marker_ys,5.0); //end suma
+ else {
+ glBegin(GL_LINE_STRIP);
+ glVertex2f( scrn_rect.left, marker_ys );
+ glVertex2f( marker_xs, marker_ys);
+ glVertex2f( width, marker_ys);
+ glEnd();
+ }
+
+ if( !huds_notext(options)) {
+ textString ( marker_xs + 2, marker_ys,
+ TextScale,0 );
+ }
+ } else {
+ //begin suma
+ /* Changes are made to draw a circle when tick_type="circle" */
+ // anything other than huds_both
+ if(tick_type=="line") {
+ drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
+ } else if(tick_type=="circle")
+ circles((float)marker_xs + 4, (float)marker_ys,5.0);//end suma
+ else {
+ drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
+ }
+ if( !huds_notext(options) ) {
+ if( huds_left(options) ) {
+ textString( marker_xs - 8 * lenstr - 2,
+ marker_ys - 4,
+ TextScale, 0 );
+ } else {
+ textString( marker_xe + 3 * lenstr,
+ marker_ys - 4,
+ TextScale, 0 );
+ } //End if huds_left
+ } //End if !huds_notext
+ } //End if huds-both
+ } // End if draw major ticks
+ } // End if major ticks
+ } // End condition
+ } // End for
+ } //end of zoom
+ // End if VERTICAL SCALE TYPE (tape loop yet to be closed)
+ } else {
+ // Horizontal scale by default
+ // left tick bar
+ if (draw_tick_left) {
+ drawOneLine( scrn_rect.left, scrn_rect.top,
+ scrn_rect.left, height);
+ } // endif draw_tick_left
+ // right tick bar
+ if (draw_tick_right) {
+ drawOneLine( width, scrn_rect.top,
+ width,
+ height );
+ } // endif draw_tick_right
+
+ marker_ys = scrn_rect.top; // Starting point for
+ marker_ye = height; // tick y location calcs
+ marker_xe = width;
+ marker_xs = scrn_rect.left + FloatToInt((cur_value - vmin) * factor() /*+ .5f*/);
+
+
+ // glBegin(GL_LINES);
+ // left tick bar
+ // glVertex2f( scrn_rect.left, scrn_rect.top);
+ // glVertex2f( scrn_rect.left, marker_ye);
+
+ // right tick bar
+ // glVertex2f( marker_xe, scrn_rect.top);
+ // glVertex2f( marker_xe, marker_ye );
+ // glEnd();
+
+ if( huds_top(options) ) {
+ if (draw_cap_bottom) {
+ // Bottom box line
+ drawOneLine( scrn_rect.left,
+ scrn_rect.top,
+ width,
+ scrn_rect.top);
+ } //endif cap_bottom
+
+ // Tick point adjust
+ marker_ye = scrn_rect.top + scrn_rect.bottom / 2;
+ // Bottom arrow
+ // drawOneLine( mid_scr.x, marker_ye,
+ // mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
+ // drawOneLine( mid_scr.x, marker_ye,
+ // mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
+ // draw pointer
+ if(pointer) {
+ if(pointer_type=="moving") {
+ if (zoom ==0) {
+ //Code for Moving Type Pointer included by suma.
+ // static float xcentre,xpoint,ypoint;
+ // static int range;
+ if(cur_value > maxValue) cur_value = maxValue;
+ if(cur_value < minValue) cur_value = minValue;
+ float xcentre = mid_scr.x;
+ int range = scrn_rect.right;
+ float xpoint = xcentre + (cur_value * range / val_span);
+ float ypoint = scrn_rect.top - marker_offset;
+ drawOneLine(xcentre, ypoint,xpoint,ypoint);
+ drawOneLine(xpoint,ypoint,xpoint,ypoint+marker_offset);
+ drawOneLine(xpoint,ypoint+marker_offset,xpoint+5.0,ypoint+5.0);
+ drawOneLine(xpoint,ypoint+marker_offset,xpoint-5.0,ypoint+5.0);
+ }
+ } else {
+ //default to fixed
+ fixed( marker_xs - scrn_rect.bottom / 4, scrn_rect.top,
+ marker_xs, marker_ye, marker_xs + scrn_rect.bottom / 4,scrn_rect.top);
+ }
+ } //if pointer
+ } //End Horizontal scale/top
+
+ if( huds_bottom(options) ) {
+ // Top box line
+ if (draw_cap_top) {
+ drawOneLine( scrn_rect.left, height,
+ width, height);
+ } //endif cap_top
+
+ // Tick point adjust
+ marker_ys = height - scrn_rect.bottom / 2;
+ // Top arrow
+ // drawOneLine( mid_scr.x + scrn_rect.bottom / 4,
+ // scrn_rect.top + scrn_rect.bottom,
+ // mid_scr.x, marker_ys );
+ // drawOneLine( mid_scr.x - scrn_rect.bottom / 4,
+ // scrn_rect.top + scrn_rect.bottom,
+ // mid_scr.x , marker_ys );
+
+ // draw pointer
+ if(pointer) {
+ if(pointer_type=="moving") {
+ if(zoom == 0) {
+ //Code for Moving Type Pointer included by suma.
+ // static float xcentre,xpoint,ypoint;
+ // static int range,hgt;
+ if(cur_value > maxValue) cur_value = maxValue;
+ if(cur_value < minValue) cur_value = minValue;
+ float xcentre = mid_scr.x ;
+ int range = scrn_rect.right;
+ int hgt = scrn_rect.top + scrn_rect.bottom;
+ float xpoint = xcentre + (cur_value * range / val_span);
+ float ypoint = hgt + marker_offset;
+ drawOneLine(xcentre, ypoint,xpoint,ypoint);
+ drawOneLine(xpoint,ypoint,xpoint,ypoint-marker_offset);
+ drawOneLine(xpoint,ypoint-marker_offset,xpoint+5.0,ypoint-5.0);
+ drawOneLine(xpoint,ypoint-marker_offset,xpoint-5.0,ypoint-5.0);
+ }
+ } else {
+ fixed( marker_xs + scrn_rect.bottom / 4, height, marker_xs, marker_ys,
+ marker_xs - scrn_rect.bottom / 4, height);
+ }
+ } //if pointer
+ } //end horizontal scale bottom
+
+ // if(( options & HUDS_BOTTOM) == HUDS_BOTTOM ) {
+ // marker_xe = marker_ys;
+ // marker_ys = marker_ye;
+ // marker_ye = marker_xe;
+ // }
+
+ // printf("vmin = %d vmax = %d\n", (int)vmin, (int)vmax);
+
+ // last = FloatToInt(vmax)+1;
+ // i = FloatToInt(vmin);
+
+ if(zoom ==1) {
+ zoomed_scale((int)vmin,(int)vmax); //suma
+ } else {
+ //default to zoom=0
+ last = (int)vmax + 1;
+ i = (int)vmin;
+ for(; i <last ; i++ ) {
+ // for( i = (int)vmin; i <= (int)vmax; i++ ) {
+ // printf("<*> i = %d\n", i);
+ condition = true;
+ if( !modulo()) {
+ if( i < min_val()) {
+ condition = false;
+ }
+ }
+ // printf("<**> i = %d\n", i);
+ if( condition ) {
+ // marker_xs = scrn_rect.left + (int)((i - vmin) * factor() + .5);
+ marker_xs = scrn_rect.left + FloatToInt(((i - vmin) * factor()/*+ .5f*/));
+
+ if (oddtype == 1)
+ k = i+1; //enable ticks at odd values
+ else
+ k = i;
+
+ if( div_min()) {
+ // if( (i%(int)div_min()) == 0 ) {
+ //draw minor ticks
+ if( !(k%(int)div_min() )) {
+ // draw in ticks only if they aren't too close to the edge.
+ if((( marker_xs - 5) > scrn_rect.left ) &&
+ (( marker_xs + 5 )< (scrn_rect.left + scrn_rect.right))){
+
+ if( huds_both(options) ) {
+ if(tick_length=="variable") {
+ drawOneLine( marker_xs, scrn_rect.top,
+ marker_xs, marker_ys - 4);
+ drawOneLine( marker_xs, marker_ye + 4,
+ marker_xs, height);
+ } else {
+ drawOneLine( marker_xs, scrn_rect.top,
+ marker_xs, marker_ys);
+ drawOneLine( marker_xs, marker_ye,
+ marker_xs, height);
+ }
+ // glBegin(GL_LINES);
+ // glVertex2f( marker_xs, scrn_rect.top);
+ // glVertex2f( marker_xs, marker_ys - 4);
+ // glVertex2f( marker_xs, marker_ye + 4);
+ // glVertex2f( marker_xs, scrn_rect.top + scrn_rect.bottom);
+ // glEnd();
+ } else {
+ if( huds_top(options)) {
+ //draw minor ticks
+ if(tick_length=="variable")
+ drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye-4);
+ else
+ drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye);
+ } else
+ if(tick_length=="variable")
+ drawOneLine(marker_xs,marker_ys+4,marker_xs,marker_ye);
+ else
+ drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye);
+ }
+ }
+ } //end draw minor ticks
+ } //end minor ticks
+ //major ticks
+ if( div_max()) {
+ // printf("i = %d\n", i);
+ // if( (i%(int)div_max())==0 ) {
+ //draw major ticks
+ if( !(k%(int)div_max()) ) {
+ if(modulo()) {
+ disp_val = i % (int) modulo(); // ?????????
+ if( disp_val < 0) {
+ while(disp_val<0)
+ disp_val += modulo();
+ }
+ } else {
+ disp_val = i;
+ }
+ // printf("disp_val = %d\n", disp_val);
+ // printf("%d\n", (int)(disp_val * (double)data_scaling() + 0.5));
+ lenstr = sprintf( TextScale, "%d",
+ // (int)(disp_val * data_scaling() +.5));
+ FloatToInt(disp_val * data_scaling()/*+.5*/));
+ // Draw major ticks and text only if far enough from the edge.
+ if(( (marker_xs - 10)> scrn_rect.left ) &&
+ ( (marker_xs + 10) < (scrn_rect.left + scrn_rect.right))){
+ if( huds_both(options) ) {
+ // drawOneLine( marker_xs, scrn_rect.top,
+ // marker_xs, marker_ys);
+ // drawOneLine( marker_xs, marker_ye,
+ // marker_xs, scrn_rect.top + scrn_rect.bottom);
+ glBegin(GL_LINE_STRIP);
+ glVertex2f( marker_xs, scrn_rect.top);
+ glVertex2f( marker_xs, marker_ye);
+ glVertex2f( marker_xs, height);
+ glEnd();
+ if( !huds_notext(options) ) {
+ textString ( marker_xs - 4 * lenstr,
+ marker_ys + 4,
+ TextScale, 0 ); //suma
+ }
+ } else {
+ drawOneLine( marker_xs, marker_ys,
+ marker_xs, marker_ye );
+ if( !huds_notext(options)) {
+ if( huds_top(options) ) {
+ textString ( marker_xs - 4 * lenstr,
+ height - 10,
+ TextScale, 0 ); //suma
+ } else {
+ textString( marker_xs - 4 * lenstr,
+ scrn_rect.top,
+ TextScale, 0 ); //suma
+ }
+ }
+ }
+ }
+ } //end draw major ticks
+ } //endif major ticks
+ } //end condition
+ } //end for
+ } //end zoom
+ } //end horizontal/vertical scale
+ } // end of type tape
+} //draw
+
+
+//begin suma
+
+void hud_card ::
+circles(float x,float y,float size)
+{
+ glEnable(GL_POINT_SMOOTH);
+ glPointSize(size);
+
+ glBegin(GL_POINTS);
+ glVertex2f(x,y);
+ glEnd();
+
+ glPointSize(1.0);
+ glDisable(GL_POINT_SMOOTH);
+}
+
+//end suma
+
+void hud_card ::
+fixed(float x1, float y1, float x2, float y2, float x3, float y3)
+{
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(x1, y1);
+ glVertex2f(x2, y2);
+ glVertex2f(x3, y3);
+ glEnd();
+}
+
+
+void hud_card ::
+zoomed_scale(int first, int last)
+{
+
+ POINT mid_scr = get_centroid();
+ RECT scrn_rect = get_location();
+ UINT options = get_options();
+ char TextScale[80];
+ // int disp_val = 0;
+ int data[80];
+
+ float x,y,w,h,bottom;
+ float cur_value=get_value();
+ if(cur_value > maxValue) cur_value = maxValue;
+ if(cur_value < minValue) cur_value = minValue;
+
+ int a=0;
+
+ while(first <= last) {
+ if((first % (int)Maj_div) == 0) {
+ data[a] = first;
+ a++ ;