From: curt Date: Thu, 20 Sep 2001 22:10:45 +0000 (+0000) Subject: White space changes. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f77877ffa80ef7cf79633735fc3d33fd84846c11;p=flightgear.git White space changes. --- diff --git a/src/Cockpit/hud.cxx b/src/Cockpit/hud.cxx index d840b4ece..74c2d08ff 100644 --- a/src/Cockpit/hud.cxx +++ b/src/Cockpit/hud.cxx @@ -60,7 +60,7 @@ #if defined ( __sun__ ) || defined ( __sgi ) extern "C" { - extern void *memmove(void *, const void *, size_t); + extern void *memmove(void *, const void *, size_t); } #endif @@ -173,7 +173,7 @@ static instr_item * readTBI( const SGPropertyNode * node); void fgHUDalphaInit( void ); class locRECT { - public: +public: RECT rect; locRECT( UINT left, UINT top, UINT right, UINT bottom); @@ -182,10 +182,10 @@ class locRECT { locRECT :: locRECT( UINT left, UINT top, UINT right, UINT bottom) { - rect.left = left; - rect.top = top; - rect.right = right; - rect.bottom = bottom; + rect.left = left; + rect.top = top; + rect.right = right; + rect.bottom = bottom; } // #define DEBUG @@ -193,31 +193,30 @@ locRECT :: locRECT( UINT left, UINT top, UINT right, UINT bottom) #ifdef OLD_CODE void drawOneLine( UINT x1, UINT y1, UINT x2, UINT y2) { - glBegin(GL_LINES); - glVertex2f(x1, y1); - glVertex2f(x2, y2); - glEnd(); + glBegin(GL_LINES); + glVertex2f(x1, y1); + glVertex2f(x2, y2); + glEnd(); } void drawOneLine( RECT &rect) { - glBegin(GL_LINES); - glVertex2f(rect.left, rect.top); - glVertex2f(rect.right, rect.bottom); - glEnd(); + glBegin(GL_LINES); + glVertex2f(rect.left, rect.top); + glVertex2f(rect.right, rect.bottom); + glEnd(); } // // The following code deals with painting the "instrument" on the display // - /* textString - Bitmap font string */ +/* textString - Bitmap font string */ void textString( int x, int y, char *msg, void *font,int digit) //suma { - if(*msg) - { -// puDrawString ( NULL, msg, x, y ); + if(*msg) { + // puDrawString ( NULL, msg, x, y ); glRasterPos2f(x, y); while (*msg) { glutBitmapCharacter(font, *msg); @@ -236,27 +235,25 @@ void strokeString(int x, int y, char *msg, void *font, float theta) float sintheta,costheta; - if(*msg) - { - glPushMatrix(); - glRotatef(theta * SGD_RADIANS_TO_DEGREES, 0.0, 0.0, 1.0); - sintheta = sin(theta); - costheta = cos(theta); - xx = (int)(x * costheta + y * sintheta); - yy = (int)(y * costheta - x * sintheta); - glTranslatef( xx, yy, 0); - glScalef(.1, .1, 0.0); - while( (c=*msg++) ) { - glutStrokeCharacter(font, c); - } - glPopMatrix(); + if(*msg) { + glPushMatrix(); + glRotatef(theta * SGD_RADIANS_TO_DEGREES, 0.0, 0.0, 1.0); + sintheta = sin(theta); + costheta = cos(theta); + xx = (int)(x * costheta + y * sintheta); + yy = (int)(y * costheta - x * sintheta); + glTranslatef( xx, yy, 0); + glScalef(.1, .1, 0.0); + while( (c=*msg++) ) { + glutStrokeCharacter(font, c); + } + glPopMatrix(); } } int getStringWidth ( char *str ) { - if ( HUDtext && str ) - { + if ( HUDtext && str ) { float r, l ; guiFntHandle->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ; return FloatToInt( r - l ); @@ -282,48 +279,48 @@ static instr_item * readLadder(const SGPropertyNode * node) { - instr_item *p; - - name = node->getStringValue("name"); - x = node->getIntValue("x"); - y = node->getIntValue("y"); - width = node->getIntValue("width"); - height = node->getIntValue("height"); - factor = node->getFloatValue("compression_factor"); - span_units = node->getFloatValue("span_units"); - division_units = node->getFloatValue("division_units"); - screen_hole = node->getIntValue("screen_hole"); - lbl_pos = node->getIntValue("lbl_pos"); - frl_spot = node->getBoolValue("enable_frl",false); - target = node->getBoolValue("enable_target_spot",false); - vel_vector = node->getBoolValue("enable_velocity_vector",false); - drift = node->getBoolValue("enable_drift_marker",false); - alpha = node->getBoolValue("enable_alpha_bracket",false); - energy = node->getBoolValue("enable_energy_marker",false); - climb_dive = node->getBoolValue("enable_climb_dive_marker",false); - glide = node->getBoolValue("enable_glide_slope_marker",false); - glide_slope_val = node->getFloatValue("glide_slope",-4.0); - worm_energy = node->getBoolValue("enable_energy_marker",false); - waypoint = node->getBoolValue("enable_waypoint_marker",false); - working = node->getBoolValue("working"); - zenith = node->getIntValue("zenith"); //suma - nadir = node->getIntValue("nadir"); //suma - hat = node->getIntValue("hat"); - - - SG_LOG(SG_INPUT, SG_INFO, "Done reading instrument " << name); + instr_item *p; + + name = node->getStringValue("name"); + x = node->getIntValue("x"); + y = node->getIntValue("y"); + width = node->getIntValue("width"); + height = node->getIntValue("height"); + factor = node->getFloatValue("compression_factor"); + span_units = node->getFloatValue("span_units"); + division_units = node->getFloatValue("division_units"); + screen_hole = node->getIntValue("screen_hole"); + lbl_pos = node->getIntValue("lbl_pos"); + frl_spot = node->getBoolValue("enable_frl",false); + target = node->getBoolValue("enable_target_spot",false); + vel_vector = node->getBoolValue("enable_velocity_vector",false); + drift = node->getBoolValue("enable_drift_marker",false); + alpha = node->getBoolValue("enable_alpha_bracket",false); + energy = node->getBoolValue("enable_energy_marker",false); + climb_dive = node->getBoolValue("enable_climb_dive_marker",false); + glide = node->getBoolValue("enable_glide_slope_marker",false); + glide_slope_val = node->getFloatValue("glide_slope",-4.0); + worm_energy = node->getBoolValue("enable_energy_marker",false); + waypoint = node->getBoolValue("enable_waypoint_marker",false); + working = node->getBoolValue("working"); + zenith = node->getIntValue("zenith"); //suma + nadir = node->getIntValue("nadir"); //suma + hat = node->getIntValue("hat"); + + + SG_LOG(SG_INPUT, SG_INFO, "Done reading instrument " << name); - p = (instr_item *) new HudLadder( name, x, y, - width, height, factor, - get_roll, get_pitch, - span_units, division_units, minor_division, - screen_hole, lbl_pos, frl_spot, target, vel_vector, - drift, alpha, energy, climb_dive, - glide, glide_slope_val, worm_energy, - waypoint, working, zenith, nadir, hat); + p = (instr_item *) new HudLadder( name, x, y, + width, height, factor, + get_roll, get_pitch, + span_units, division_units, minor_division, + screen_hole, lbl_pos, frl_spot, target, vel_vector, + drift, alpha, energy, climb_dive, + glide, glide_slope_val, worm_energy, + waypoint, working, zenith, nadir, hat); - return p; + return p; } //end readLadder @@ -331,325 +328,316 @@ static instr_item * readCard(const SGPropertyNode * node) { - instr_item *p; - - name = node->getStringValue("name"); - x = node->getIntValue("x"); - y = node->getIntValue("y"); - width = node->getIntValue("width"); - height = node->getIntValue("height"); - loadfn = node->getStringValue("loadfn"); - options = node->getIntValue("options"); - maxValue = node->getFloatValue("maxValue"); - minValue = node->getFloatValue("minValue"); - scaling = node->getFloatValue("disp_scaling"); - major_divs = node->getIntValue("major_divs"); - minor_divs = node->getIntValue("minor_divs"); - modulator = node->getIntValue("modulator"); - span_units = node->getFloatValue("value_span"); - type = node->getStringValue("type"); - tick_bottom = node->getBoolValue("tick_bottom",false); - tick_top = node->getBoolValue("tick_top",false); - tick_right = node->getBoolValue("tick_right",false); - tick_left = node->getBoolValue("tick_left",false); - cap_bottom = node->getBoolValue("cap_bottom",false); - cap_top = node->getBoolValue("cap_top",false); - cap_right = node->getBoolValue("cap_right",false); - cap_left = node->getBoolValue("cap_left",false); - marker_off = node->getFloatValue("marker_offset",0.0); - enable_pointer = node->getBoolValue("enable_pointer",true); - type_pointer = node->getStringValue("pointer_type"); - type_tick = node->getStringValue("tick_type");//hud Can be 'circle' or 'line' - length_tick = node->getStringValue("tick_length");//hud For variable length - working = node->getBoolValue("working"); - radius = node->getFloatValue("radius"); //suma - divisions = node->getIntValue("divisions"); //suma - zoom = node->getIntValue("zoom"); //suma - - SG_LOG(SG_INPUT, SG_INFO, "Done reading instrument " << name); - - - if(type=="gauge") - span_units = maxValue - minValue; - - if(loadfn=="anzg") - load_fn = get_anzg; - else - if(loadfn=="heading") - load_fn = get_heading; - else - if(loadfn=="aoa") - load_fn = get_aoa; - else - if(loadfn=="climb") - load_fn = get_climb_rate; - else - if(loadfn=="altitude") - load_fn = get_altitude; - else - if(loadfn=="agl") - load_fn = get_agl; - else - if(loadfn=="speed") - load_fn = get_speed; - else - if(loadfn=="view_direction") - load_fn = get_view_direction; - else - if(loadfn=="aileronval") - load_fn = get_aileronval; - else - if(loadfn=="elevatorval") - load_fn = get_elevatorval; - else - if(loadfn=="rudderval") - load_fn = get_rudderval; - else - if(loadfn=="throttleval") - load_fn = get_throttleval; - - - if ( (type == "dial") | (type == "tape") ) { - p = (instr_item *) new hud_card( x, - y, - width, - height, - load_fn, - options, - maxValue, minValue, - scaling, - major_divs, minor_divs, - modulator, - dp_showing, - span_units, - type, - tick_bottom, - tick_top, - tick_right, - tick_left, - cap_bottom, - cap_top, - cap_right, - cap_left, - marker_off, - enable_pointer, - type_pointer, - type_tick,//hud - length_tick,//hud - working, - radius, //suma - divisions, //suma - zoom //suma - ); - } else { - p = (instr_item *) new gauge_instr( x, // x - y, // y - width, // width - height, // height - load_fn, // data source - options, - scaling, - maxValue,minValue, - major_divs, minor_divs, - dp_showing, - modulator, - working); - } - - return p; + instr_item *p; + + name = node->getStringValue("name"); + x = node->getIntValue("x"); + y = node->getIntValue("y"); + width = node->getIntValue("width"); + height = node->getIntValue("height"); + loadfn = node->getStringValue("loadfn"); + options = node->getIntValue("options"); + maxValue = node->getFloatValue("maxValue"); + minValue = node->getFloatValue("minValue"); + scaling = node->getFloatValue("disp_scaling"); + major_divs = node->getIntValue("major_divs"); + minor_divs = node->getIntValue("minor_divs"); + modulator = node->getIntValue("modulator"); + span_units = node->getFloatValue("value_span"); + type = node->getStringValue("type"); + tick_bottom = node->getBoolValue("tick_bottom",false); + tick_top = node->getBoolValue("tick_top",false); + tick_right = node->getBoolValue("tick_right",false); + tick_left = node->getBoolValue("tick_left",false); + cap_bottom = node->getBoolValue("cap_bottom",false); + cap_top = node->getBoolValue("cap_top",false); + cap_right = node->getBoolValue("cap_right",false); + cap_left = node->getBoolValue("cap_left",false); + marker_off = node->getFloatValue("marker_offset",0.0); + enable_pointer = node->getBoolValue("enable_pointer",true); + type_pointer = node->getStringValue("pointer_type"); + type_tick = node->getStringValue("tick_type");//hud Can be 'circle' or 'line' + length_tick = node->getStringValue("tick_length");//hud For variable length + working = node->getBoolValue("working"); + radius = node->getFloatValue("radius"); //suma + divisions = node->getIntValue("divisions"); //suma + zoom = node->getIntValue("zoom"); //suma + + SG_LOG(SG_INPUT, SG_INFO, "Done reading instrument " << name); + + + if(type=="gauge") { + span_units = maxValue - minValue; + } + + if (loadfn=="anzg") { + load_fn = get_anzg; + } else if (loadfn=="heading") { + load_fn = get_heading; + } else if (loadfn=="aoa") { + load_fn = get_aoa; + } else if (loadfn=="climb") { + load_fn = get_climb_rate; + } else if (loadfn=="altitude") { + load_fn = get_altitude; + } else if (loadfn=="agl") { + load_fn = get_agl; + } else if (loadfn=="speed") { + load_fn = get_speed; + } else if (loadfn=="view_direction") { + load_fn = get_view_direction; + } else if (loadfn=="aileronval") { + load_fn = get_aileronval; + } else if (loadfn=="elevatorval") { + load_fn = get_elevatorval; + } else if (loadfn=="rudderval") { + load_fn = get_rudderval; + } else if (loadfn=="throttleval") { + load_fn = get_throttleval; + } + + + if ( (type == "dial") | (type == "tape") ) { + p = (instr_item *) new hud_card( x, + y, + width, + height, + load_fn, + options, + maxValue, minValue, + scaling, + major_divs, minor_divs, + modulator, + dp_showing, + span_units, + type, + tick_bottom, + tick_top, + tick_right, + tick_left, + cap_bottom, + cap_top, + cap_right, + cap_left, + marker_off, + enable_pointer, + type_pointer, + type_tick,//hud + length_tick,//hud + working, + radius, //suma + divisions, //suma + zoom //suma + ); + } else { + p = (instr_item *) new gauge_instr( x, // x + y, // y + width, // width + height, // height + load_fn, // data source + options, + scaling, + maxValue,minValue, + major_divs, minor_divs, + dp_showing, + modulator, + working); + } + + return p; }// end readCard static instr_item * readLabel(const SGPropertyNode * node) { - instr_item *p; - - int font_size = (fgGetInt("/sim/startup/xsize") > 1000) ? LARGE : SMALL; - - name = node->getStringValue("name"); - x = node->getIntValue("x"); - y = node->getIntValue("y"); - width = node->getIntValue("width"); - height = node->getIntValue("height"); - loadfn = node->getStringValue("data_source"); - label_format = node->getStringValue("label_format"); - prelabel = node->getStringValue("pre_label_string"); - postlabel = node->getStringValue("post_label_string"); - scaling = node->getFloatValue("scale_data"); - options = node->getIntValue("options"); - justi = node->getIntValue("justification"); - blinking = node->getIntValue("blinking"); - latitude = node->getBoolValue("latitude",false); - longitude = node->getBoolValue("longitude",false); - label_box = node->getBoolValue("label_box",false);//hud - working = node->getBoolValue("working"); - digits = node->getIntValue("digits"); //suma - - - SG_LOG(SG_INPUT, SG_INFO, "Done reading instrument " << name); - - - if ( justi == 0 ) { - justification = LEFT_JUST; + instr_item *p; + + int font_size = (fgGetInt("/sim/startup/xsize") > 1000) ? LARGE : SMALL; + + name = node->getStringValue("name"); + x = node->getIntValue("x"); + y = node->getIntValue("y"); + width = node->getIntValue("width"); + height = node->getIntValue("height"); + loadfn = node->getStringValue("data_source"); + label_format = node->getStringValue("label_format"); + prelabel = node->getStringValue("pre_label_string"); + postlabel = node->getStringValue("post_label_string"); + scaling = node->getFloatValue("scale_data"); + options = node->getIntValue("options"); + justi = node->getIntValue("justification"); + blinking = node->getIntValue("blinking"); + latitude = node->getBoolValue("latitude",false); + longitude = node->getBoolValue("longitude",false); + label_box = node->getBoolValue("label_box",false);//hud + working = node->getBoolValue("working"); + digits = node->getIntValue("digits"); //suma + + + SG_LOG(SG_INPUT, SG_INFO, "Done reading instrument " << name); + + + if ( justi == 0 ) { + justification = LEFT_JUST; + } else { + if ( justi == 1 ) { + justification = CENTER_JUST; } else { - if ( justi == 1 ) { - justification = CENTER_JUST; - } else { - if ( justi == 2 ) { - justification = RIGHT_JUST; - } + if ( justi == 2 ) { + justification = RIGHT_JUST; } } + } - if ( prelabel == "NULL" ) { - pre_label_string = NULL; + if ( prelabel == "NULL" ) { + pre_label_string = NULL; + } else { + if ( prelabel == "blank" ) { + pre_label_string = " "; } else { - if ( prelabel == "blank" ) { - pre_label_string = " "; - } else { - pre_label_string = prelabel.c_str(); - } + pre_label_string = prelabel.c_str(); } + } - if ( postlabel == "blank" ) { - post_label_string = " "; + if ( postlabel == "blank" ) { + post_label_string = " "; + } else { + if ( postlabel == "NULL" ) { + post_label_string = NULL; } else { - if ( postlabel == "NULL" ) { - post_label_string = NULL; + if ( postlabel == "units" ) { + post_label_string = units; } else { - if ( postlabel == "units" ) { - post_label_string = units; - } else { - post_label_string = postlabel.c_str(); - } + post_label_string = postlabel.c_str(); } } + } - if ( loadfn== "aux1" ) { - load_fn = get_aux1; - } else if ( loadfn == "aux2" ) { - load_fn = get_aux2; - } else if ( loadfn == "aux3" ) { - load_fn = get_aux3; - } else if ( loadfn == "aux4" ) { - load_fn = get_aux4; - } else if ( loadfn == "aux5" ) { - load_fn = get_aux5; - } else if ( loadfn == "aux6" ) { - load_fn = get_aux6; - } else if ( loadfn == "aux7" ) { - load_fn = get_aux7; - } else if ( loadfn == "aux8" ) { - load_fn = get_aux8; - } else if ( loadfn == "aux9" ) { - load_fn = get_aux9; - } else if ( loadfn == "aux10" ) { - load_fn = get_aux10; - } else if ( loadfn == "aux11" ) { - load_fn = get_aux11; - } else if ( loadfn == "aux12" ) { - load_fn = get_aux12; - } else if ( loadfn == "aux13" ) { - load_fn = get_aux13; - } else if ( loadfn == "aux14" ) { - load_fn = get_aux14; - } else if ( loadfn == "aux15" ) { - load_fn = get_aux15; - } else if ( loadfn == "aux16" ) { - load_fn = get_aux16; - } else if ( loadfn == "aux17" ) { - load_fn = get_aux17; - } else if ( loadfn == "aux18" ) { - load_fn = get_aux18; - } else if ( loadfn == "ax" ) { - load_fn = get_Ax; - } else if ( loadfn == "speed" ) { - load_fn = get_speed; - } else if ( loadfn == "mach" ) { - load_fn = get_mach; - } else if ( loadfn == "altitude" ) { - load_fn = get_altitude; - } else if ( loadfn == "agl" ) { - load_fn = get_agl; - } else if ( loadfn == "framerate" ) { - load_fn = get_frame_rate; - } else if ( loadfn == "heading" ) { - load_fn = get_heading; - } else if ( loadfn == "fov" ) { - load_fn = get_fov; - } else if ( loadfn == "vfc_tris_culled" ) { - load_fn = get_vfc_tris_culled; - } else if ( loadfn == "vfc_tris_drawn" ) { - load_fn = get_vfc_tris_drawn; - } else if ( loadfn == "aoa" ) { - load_fn = get_aoa; - } else if ( loadfn == "latitude" ) { - load_fn = get_latitude; - } else if ( loadfn == "anzg" ) { - load_fn = get_anzg; - } else if ( loadfn == "longitude" ) { - load_fn = get_longitude; - } else if (loadfn=="throttleval") { - load_fn = get_throttleval; - } + if ( loadfn== "aux1" ) { + load_fn = get_aux1; + } else if ( loadfn == "aux2" ) { + load_fn = get_aux2; + } else if ( loadfn == "aux3" ) { + load_fn = get_aux3; + } else if ( loadfn == "aux4" ) { + load_fn = get_aux4; + } else if ( loadfn == "aux5" ) { + load_fn = get_aux5; + } else if ( loadfn == "aux6" ) { + load_fn = get_aux6; + } else if ( loadfn == "aux7" ) { + load_fn = get_aux7; + } else if ( loadfn == "aux8" ) { + load_fn = get_aux8; + } else if ( loadfn == "aux9" ) { + load_fn = get_aux9; + } else if ( loadfn == "aux10" ) { + load_fn = get_aux10; + } else if ( loadfn == "aux11" ) { + load_fn = get_aux11; + } else if ( loadfn == "aux12" ) { + load_fn = get_aux12; + } else if ( loadfn == "aux13" ) { + load_fn = get_aux13; + } else if ( loadfn == "aux14" ) { + load_fn = get_aux14; + } else if ( loadfn == "aux15" ) { + load_fn = get_aux15; + } else if ( loadfn == "aux16" ) { + load_fn = get_aux16; + } else if ( loadfn == "aux17" ) { + load_fn = get_aux17; + } else if ( loadfn == "aux18" ) { + load_fn = get_aux18; + } else if ( loadfn == "ax" ) { + load_fn = get_Ax; + } else if ( loadfn == "speed" ) { + load_fn = get_speed; + } else if ( loadfn == "mach" ) { + load_fn = get_mach; + } else if ( loadfn == "altitude" ) { + load_fn = get_altitude; + } else if ( loadfn == "agl" ) { + load_fn = get_agl; + } else if ( loadfn == "framerate" ) { + load_fn = get_frame_rate; + } else if ( loadfn == "heading" ) { + load_fn = get_heading; + } else if ( loadfn == "fov" ) { + load_fn = get_fov; + } else if ( loadfn == "vfc_tris_culled" ) { + load_fn = get_vfc_tris_culled; + } else if ( loadfn == "vfc_tris_drawn" ) { + load_fn = get_vfc_tris_drawn; + } else if ( loadfn == "aoa" ) { + load_fn = get_aoa; + } else if ( loadfn == "latitude" ) { + load_fn = get_latitude; + } else if ( loadfn == "anzg" ) { + load_fn = get_anzg; + } else if ( loadfn == "longitude" ) { + load_fn = get_longitude; + } else if (loadfn=="throttleval") { + load_fn = get_throttleval; + } - p = (instr_item *) new instr_label ( x, - y, - width, - height, - load_fn, - label_format.c_str(), - pre_label_string, - post_label_string, - scaling, - options, - justification, - font_size, - blinking, - latitude, - longitude, - label_box, //hud - working, - digits); //suma - - return p; + p = (instr_item *) new instr_label ( x, + y, + width, + height, + load_fn, + label_format.c_str(), + pre_label_string, + post_label_string, + scaling, + options, + justification, + font_size, + blinking, + latitude, + longitude, + label_box, //hud + working, + digits); //suma + + return p; } // end readLabel static instr_item * readTBI(const SGPropertyNode * node) { - instr_item *p; - - name = node->getStringValue("name"); - x = node->getIntValue("x"); - y = node->getIntValue("y"); - width = node->getIntValue("width"); - height = node->getIntValue("height"); - maxBankAngle = node->getFloatValue("maxBankAngle"); - maxSlipAngle = node->getFloatValue("maxSlipAngle"); - gap_width = node->getIntValue("gap_width"); - working = node->getBoolValue("working"); - tsi = node->getBoolValue("tsi"); //suma - rad = node->getFloatValue("rad"); //suma - - SG_LOG(SG_INPUT, SG_INFO, "Done reading instrument " << name); - - - p = (instr_item *) new fgTBI_instr( x, - y, - width, - height, - get_roll, - get_sideslip, - maxBankAngle, - maxSlipAngle, - gap_width, - working, - tsi, //suma - rad); //suma - - return p; + instr_item *p; + + name = node->getStringValue("name"); + x = node->getIntValue("x"); + y = node->getIntValue("y"); + width = node->getIntValue("width"); + height = node->getIntValue("height"); + maxBankAngle = node->getFloatValue("maxBankAngle"); + maxSlipAngle = node->getFloatValue("maxSlipAngle"); + gap_width = node->getIntValue("gap_width"); + working = node->getBoolValue("working"); + tsi = node->getBoolValue("tsi"); //suma + rad = node->getFloatValue("rad"); //suma + + SG_LOG(SG_INPUT, SG_INFO, "Done reading instrument " << name); + + + p = (instr_item *) new fgTBI_instr( x, + y, + width, + height, + get_roll, + get_sideslip, + maxBankAngle, + maxSlipAngle, + gap_width, + working, + tsi, //suma + rad); //suma + + return p; } //end readTBI @@ -718,10 +706,10 @@ int readHud( istream &input ) SGPropertyNode root; try { - readProperties(input, &root); + readProperties(input, &root); } catch (const sg_exception &e) { - guiErrorMessage("Error reading HUD: ", e); - return 0; + guiErrorMessage("Error reading HUD: ", e); + return 0; } @@ -778,16 +766,13 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ ) path.append(hud_path); ifstream input(path.c_str()); - if (!input.good()) - { - SG_LOG(SG_INPUT, SG_ALERT, - "Cannot read Hud configuration from " << path.str()); - } - else - { - readHud(input); - input.close(); - } + if (!input.good()) { + SG_LOG(SG_INPUT, SG_ALERT, + "Cannot read Hud configuration from " << path.str()); + } else { + readHud(input); + input.close(); + } fgHUDalphaInit(); fgHUDReshape(); @@ -811,8 +796,7 @@ int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ ) if (!input.good()) { SG_LOG(SG_INPUT, SG_ALERT, "Cannot read Hud configuration from " << path.str()); - } - else { + } else { readHud(input); input.close(); } @@ -967,9 +951,9 @@ void fgHUDalphaInit( void ) { PUSTR_TGAP + PUSTR_BGAP + 5; /* puFrame * - HUDalphaFrame = new puFrame ( 0, 0, DialogWidth, - 85 + nSliders - * horiz_slider_height ); */ + HUDalphaFrame = new puFrame ( 0, 0, DialogWidth, + 85 + nSliders + * horiz_slider_height ); */ puText * HUDalphaDialogMessage = new puText ( labelX, @@ -1065,188 +1049,188 @@ void fgUpdateHUD( void ) { void fgUpdateHUD( GLfloat x_start, GLfloat y_start, GLfloat x_end, GLfloat y_end ) { - int brightness; - // int day_night_sw = current_aircraft.controls->day_night_switch; - int day_night_sw = global_day_night_switch; - int hud_displays = HUD_deque.size(); - instr_item *pHUDInstr; - // float line_width; - - if( !hud_displays ) { // Trust everyone, but ALWAYS cut the cards! - return; + int brightness; + // int day_night_sw = current_aircraft.controls->day_night_switch; + int day_night_sw = global_day_night_switch; + int hud_displays = HUD_deque.size(); + instr_item *pHUDInstr; + // float line_width; + + if( !hud_displays ) { // Trust everyone, but ALWAYS cut the cards! + return; } - HUD_TextList.erase(); - HUD_LineList.erase(); - // HUD_StippleLineList.erase(); + HUD_TextList.erase(); + HUD_LineList.erase(); + // HUD_StippleLineList.erase(); - pHUDInstr = HUD_deque[0]; - brightness = pHUDInstr->get_brightness(); - // brightness = HUD_deque.at(0)->get_brightness(); - - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - - glLoadIdentity(); - gluOrtho2D(x_start, x_end, y_start, y_end); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity(); - - glDisable(GL_DEPTH_TEST); - glDisable(GL_LIGHTING); - - static const SGPropertyNode * antialiased_node - = fgGetNode("/sim/hud/antialiased"); - - if( antialiased_node->getBoolValue() ) { - glEnable(GL_LINE_SMOOTH); -// glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); - glHint(GL_LINE_SMOOTH_HINT,GL_DONT_CARE); - glLineWidth(1.5); - } else { - glLineWidth(1.0); - } - - if( day_night_sw == DAY) { - switch (brightness) - { - case BRT_LIGHT: - set_hud_color (0.1f, 0.9f, 0.1f); - break; - - case BRT_MEDIUM: - set_hud_color (0.1f, 0.7f, 0.0f); - break; - - case BRT_DARK: - set_hud_color (0.0f, 0.6f, 0.0f); - break; - - case BRT_BLACK: - set_hud_color( 0.0f, 0.0f, 0.0f); - break; - - default: - set_hud_color (0.1f, 0.9f, 0.1f); - } - } else { - if( day_night_sw == NIGHT) { - switch (brightness) - { - case BRT_LIGHT: - set_hud_color (0.9f, 0.1f, 0.1f); - break; - - case BRT_MEDIUM: - set_hud_color (0.7f, 0.0f, 0.1f); - break; - - case BRT_DARK: - set_hud_color (0.6f, 0.0f, 0.0f); - break; - - case BRT_BLACK: - set_hud_color( 0.0f, 0.0f, 0.0f); - break; - - default: - set_hud_color (0.6f, 0.0f, 0.0f); - } - } else { // Just in case default - set_hud_color (0.1f, 0.9f, 0.1f); - } - } - - deque < instr_item * > :: iterator current = HUD_deque.begin(); - deque < instr_item * > :: iterator last = HUD_deque.end(); - - for ( ; current != last; ++current ) { - pHUDInstr = *current; - - if( pHUDInstr->enabled()) { - // fgPrintf( SG_COCKPIT, SG_DEBUG, "HUD Code %d Status %d\n", - // hud->code, hud->status ); - pHUDInstr->draw(); + pHUDInstr = HUD_deque[0]; + brightness = pHUDInstr->get_brightness(); + // brightness = HUD_deque.at(0)->get_brightness(); + + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + + glLoadIdentity(); + gluOrtho2D(x_start, x_end, y_start, y_end); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + + glDisable(GL_DEPTH_TEST); + glDisable(GL_LIGHTING); + + static const SGPropertyNode * antialiased_node + = fgGetNode("/sim/hud/antialiased"); + + if( antialiased_node->getBoolValue() ) { + glEnable(GL_LINE_SMOOTH); + // glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); + glHint(GL_LINE_SMOOTH_HINT,GL_DONT_CARE); + glLineWidth(1.5); + } else { + glLineWidth(1.0); + } + + if( day_night_sw == DAY) { + switch (brightness) + { + case BRT_LIGHT: + set_hud_color (0.1f, 0.9f, 0.1f); + break; + + case BRT_MEDIUM: + set_hud_color (0.1f, 0.7f, 0.0f); + break; + + case BRT_DARK: + set_hud_color (0.0f, 0.6f, 0.0f); + break; + + case BRT_BLACK: + set_hud_color( 0.0f, 0.0f, 0.0f); + break; + + default: + set_hud_color (0.1f, 0.9f, 0.1f); + } + } else { + if( day_night_sw == NIGHT) { + switch (brightness) + { + case BRT_LIGHT: + set_hud_color (0.9f, 0.1f, 0.1f); + break; + + case BRT_MEDIUM: + set_hud_color (0.7f, 0.0f, 0.1f); + break; + + case BRT_DARK: + set_hud_color (0.6f, 0.0f, 0.0f); + break; + + case BRT_BLACK: + set_hud_color( 0.0f, 0.0f, 0.0f); + break; + + default: + set_hud_color (0.6f, 0.0f, 0.0f); + } + } else { // Just in case default + set_hud_color (0.1f, 0.9f, 0.1f); + } + } + + deque < instr_item * > :: iterator current = HUD_deque.begin(); + deque < instr_item * > :: iterator last = HUD_deque.end(); + + for ( ; current != last; ++current ) { + pHUDInstr = *current; + + if( pHUDInstr->enabled()) { + // fgPrintf( SG_COCKPIT, SG_DEBUG, "HUD Code %d Status %d\n", + // hud->code, hud->status ); + pHUDInstr->draw(); - } - } + } + } - char *gmt_str = get_formated_gmt_time(); - HUD_TextList.add( fgText(40, 10, gmt_str, 0) ); + char *gmt_str = get_formated_gmt_time(); + HUD_TextList.add( fgText(40, 10, gmt_str, 0) ); #ifdef FG_NETWORK_OLK - if ( net_hud_display ) { - net_hud_update(); - } + if ( net_hud_display ) { + net_hud_update(); + } #endif - // temporary - // extern bool fgAPAltitudeEnabled( void ); - // extern bool fgAPHeadingEnabled( void ); - // extern bool fgAPWayPointEnabled( void ); - // extern char *fgAPget_TargetDistanceStr( void ); - // extern char *fgAPget_TargetHeadingStr( void ); - // extern char *fgAPget_TargetAltitudeStr( void ); - // extern char *fgAPget_TargetLatLonStr( void ); - - int apY = 480 - 80; - // char scratch[128]; - // HUD_TextList.add( fgText( "AUTOPILOT", 20, apY) ); - // apY -= 15; - if( current_autopilot->get_HeadingEnabled() ) { - HUD_TextList.add( fgText( 40, apY, - current_autopilot->get_TargetHeadingStr()) ); - apY -= 15; - } - if( current_autopilot->get_AltitudeEnabled() ) { - HUD_TextList.add( fgText( 40, apY, - current_autopilot->get_TargetAltitudeStr()) ); - apY -= 15; - } - if( current_autopilot->get_HeadingMode() == - FGAutopilot::FG_HEADING_WAYPOINT ) - { - char *wpstr; - wpstr = current_autopilot->get_TargetWP1Str(); - if ( strlen( wpstr ) ) { - HUD_TextList.add( fgText( 40, apY, wpstr ) ); - apY -= 15; - } - wpstr = current_autopilot->get_TargetWP2Str(); - if ( strlen( wpstr ) ) { - HUD_TextList.add( fgText( 40, apY, wpstr ) ); - apY -= 15; - } - wpstr = current_autopilot->get_TargetWP3Str(); - if ( strlen( wpstr ) ) { - HUD_TextList.add( fgText( 40, apY, wpstr ) ); - apY -= 15; - } - } + // temporary + // extern bool fgAPAltitudeEnabled( void ); + // extern bool fgAPHeadingEnabled( void ); + // extern bool fgAPWayPointEnabled( void ); + // extern char *fgAPget_TargetDistanceStr( void ); + // extern char *fgAPget_TargetHeadingStr( void ); + // extern char *fgAPget_TargetAltitudeStr( void ); + // extern char *fgAPget_TargetLatLonStr( void ); + + int apY = 480 - 80; + // char scratch[128]; + // HUD_TextList.add( fgText( "AUTOPILOT", 20, apY) ); + // apY -= 15; + if( current_autopilot->get_HeadingEnabled() ) { + HUD_TextList.add( fgText( 40, apY, + current_autopilot->get_TargetHeadingStr()) ); + apY -= 15; + } + if( current_autopilot->get_AltitudeEnabled() ) { + HUD_TextList.add( fgText( 40, apY, + current_autopilot->get_TargetAltitudeStr()) ); + apY -= 15; + } + if( current_autopilot->get_HeadingMode() == + FGAutopilot::FG_HEADING_WAYPOINT ) + { + char *wpstr; + wpstr = current_autopilot->get_TargetWP1Str(); + if ( strlen( wpstr ) ) { + HUD_TextList.add( fgText( 40, apY, wpstr ) ); + apY -= 15; + } + wpstr = current_autopilot->get_TargetWP2Str(); + if ( strlen( wpstr ) ) { + HUD_TextList.add( fgText( 40, apY, wpstr ) ); + apY -= 15; + } + wpstr = current_autopilot->get_TargetWP3Str(); + if ( strlen( wpstr ) ) { + HUD_TextList.add( fgText( 40, apY, wpstr ) ); + apY -= 15; + } + } - HUD_TextList.draw(); - - HUD_LineList.draw(); - - // glEnable(GL_LINE_STIPPLE); - // glLineStipple( 1, 0x00FF ); - // HUD_StippleLineList.draw(); - // glDisable(GL_LINE_STIPPLE); - - if( antialiased_node->getBoolValue() ) { - // glDisable(GL_BLEND); - glDisable(GL_LINE_SMOOTH); - glLineWidth(1.0); - } - - glEnable(GL_DEPTH_TEST); - glEnable(GL_LIGHTING); - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); + HUD_TextList.draw(); + + HUD_LineList.draw(); + + // glEnable(GL_LINE_STIPPLE); + // glLineStipple( 1, 0x00FF ); + // HUD_StippleLineList.draw(); + // glDisable(GL_LINE_STIPPLE); + + if( antialiased_node->getBoolValue() ) { + // glDisable(GL_BLEND); + glDisable(GL_LINE_SMOOTH); + glLineWidth(1.0); + } + + glEnable(GL_DEPTH_TEST); + glEnable(GL_LIGHTING); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); } diff --git a/src/Cockpit/hud.hxx b/src/Cockpit/hud.hxx index 8d6871a9f..336a4497b 100644 --- a/src/Cockpit/hud.hxx +++ b/src/Cockpit/hud.hxx @@ -70,13 +70,13 @@ SG_USING_NAMESPACE(std); // some of Norman's crazy optimizations. :-) #ifndef WIN32 - typedef struct { - int x, y; - } POINT; +typedef struct { + int x, y; +} POINT; - typedef struct { - int top, bottom, left, right; - } RECT; +typedef struct { + int top, bottom, left, right; +} RECT; #endif // View mode definitions @@ -239,16 +239,16 @@ extern char *get_formated_gmt_time( void ); extern void fgHUDReshape(void); enum hudinstype{ HUDno_instr, - HUDscale, - HUDlabel, - HUDladder, - HUDcirc_ladder, - HUDhorizon, - HUDgauge, - HUDdual_inst, - HUDmoving_scale, - HUDtbi - }; + HUDscale, + HUDlabel, + HUDladder, + HUDcirc_ladder, + HUDhorizon, + HUDgauge, + HUDdual_inst, + HUDmoving_scale, + HUDtbi +}; typedef struct gltagRGBTRIPLE { // rgbt GLfloat Blue; @@ -309,8 +309,7 @@ public: int getStringWidth ( char *str ) { - if ( HUDtext && str ) - { + if ( HUDtext && str ) { float r, l ; guiFntHandle->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ; return FloatToInt( r - l ); @@ -320,8 +319,7 @@ public: int StringWidth (void ) { - if ( HUDtext && strlen( msg )) - { + if ( HUDtext && strlen( msg )) { float r, l ; guiFntHandle->getBBox ( msg, HUD_TextSize, 0, &l, &r, NULL, NULL ) ; return FloatToInt( r - l ); @@ -339,9 +337,9 @@ public: char *t=msg; int p=4; - if(t[0]=='-') //if negative value then increase the c and p values for '-' sign. - { - c++; + if(t[0]=='-') { + //if negative value then increase the c and p values + //for '-' sign. c++; p++; } char *tmp=msg; @@ -393,28 +391,28 @@ public: ~fgLineList( void ) {} void add( fgLineSeg2D seg ) { List.push_back(seg); } void erase( void ) { List.erase( List.begin(), List.end() ); } - void draw( void ) { - vector < fgLineSeg2D > :: iterator curSeg; - vector < fgLineSeg2D > :: iterator lastSeg; - curSeg = List.begin(); - lastSeg = List.end(); - glBegin(GL_LINES); - for ( ; curSeg != lastSeg; curSeg++ ) { - curSeg->draw(); - } - glEnd(); - } -/* void draw( void ) { + void draw( void ) { vector < fgLineSeg2D > :: iterator curSeg; vector < fgLineSeg2D > :: iterator lastSeg; - curSeg = List.begin(); + curSeg = List.begin(); lastSeg = List.end(); glBegin(GL_LINES); for ( ; curSeg != lastSeg; curSeg++ ) { curSeg->draw(); } glEnd(); - } */ + } + /* void draw( void ) { + vector < fgLineSeg2D > :: iterator curSeg; + vector < fgLineSeg2D > :: iterator lastSeg; + curSeg = List.begin(); + lastSeg = List.end(); + glBegin(GL_LINES); + for ( ; curSeg != lastSeg; curSeg++ ) { + curSeg->draw(); + } + glEnd(); + } */ }; class fgTextList { @@ -475,14 +473,14 @@ extern fgLineList HUD_StippleLineList; class instr_item { // An Abstract Base Class (ABC) - private: +private: static UINT instances; // More than 64K instruments? Nah! static int brightness; static glRGBTRIPLE color; UINT handle; RECT scrn_pos; // Framing - affects scale dimensions - // and orientation. Vert vs Horz, etc. + // and orientation. Vert vs Horz, etc. FLTFNPTR load_value_fn; float disp_factor; // Multiply by to get numbers shown on scale. UINT opts; @@ -492,7 +490,7 @@ class instr_item { // An Abstract Base Class (ABC) POINT mid_span; // int digits; //suma - public: +public: instr_item( int x, int y, UINT height, @@ -524,7 +522,9 @@ class instr_item { // An Abstract Base Class (ABC) UINT huds_vert (UINT options) { return( options & HUDS_VERT ); } UINT huds_left (UINT options) { return( options & HUDS_LEFT ); } UINT huds_right (UINT options) { return( options & HUDS_RIGHT ); } - UINT huds_both (UINT options) { return( (options & HUDS_BOTH) == HUDS_BOTH ); } + UINT huds_both (UINT options) { + return( (options & HUDS_BOTH) == HUDS_BOTH ); + } UINT huds_noticks (UINT options) { return( options & HUDS_NOTICKS ); } UINT huds_notext (UINT options) { return( options & HUDS_NOTEXT ); } UINT huds_top (UINT options) { return( options & HUDS_TOP ); } @@ -553,8 +553,7 @@ class instr_item { // An Abstract Base Class (ABC) } int getStringWidth ( char *str ) { - if ( HUDtext && str ) - { + if ( HUDtext && str ) { float r, l ; guiFntHandle->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ; return FloatToInt( r - l ); @@ -591,7 +590,7 @@ extern int HUD_style; class instr_label : public instr_item { - private: +private: const char *pformat; const char *pre_str; const char *post_str; @@ -603,7 +602,7 @@ class instr_label : public instr_item { bool lon; bool lbox; - public: +public: instr_label( int x, int y, UINT width, @@ -634,7 +633,7 @@ typedef instr_label * pInstlabel; class lat_label : public instr_item { - private: +private: const char *pformat; const char *pre_str; const char *post_str; @@ -643,7 +642,7 @@ class lat_label : public instr_item { int blink; char format_buffer[80]; - public: +public: lat_label( int x, int y, UINT width, @@ -670,7 +669,7 @@ class lat_label : public instr_item { typedef lat_label * pLatlabel; class lon_label : public instr_item { - private: +private: const char *pformat; const char *pre_str; const char *post_str; @@ -679,7 +678,7 @@ class lon_label : public instr_item { int blink; char format_buffer[80]; - public: +public: lon_label( int x, int y, UINT width, @@ -713,7 +712,7 @@ typedef lon_label * pLonlabel; // class instr_scale : public instr_item { - private: +private: float range_shown; // Width Units. float Maximum_value; // ceiling. float Minimum_value; // Representation floor. @@ -723,7 +722,7 @@ class instr_scale : public instr_item { UINT Modulo; // Roll over point int signif_digits; // digits to show to the right. - public: +public: instr_scale( int x, int y, UINT width, @@ -760,7 +759,7 @@ class instr_scale : public instr_item { // line. class hud_card : public instr_scale { - private: +private: float val_span; string type; float half_width_units; @@ -786,7 +785,7 @@ class hud_card : public instr_scale { UINT Min_div; //suma - public: +public: hud_card( int x, int y, UINT width, @@ -824,7 +823,7 @@ class hud_card : public instr_scale { ~hud_card(); hud_card( const hud_card & image); hud_card & operator = (const hud_card & rhs ); -// virtual void display_enable( bool setting ); + // virtual void display_enable( bool setting ); virtual void draw( void ); // Required method in base class void circles(float,float,float); // suma void fixed(float,float,float,float,float,float); //suma @@ -834,7 +833,7 @@ class hud_card : public instr_scale { typedef hud_card * pCardScale; class gauge_instr : public instr_scale { - public: +public: gauge_instr( int x, int y, UINT width, @@ -862,10 +861,10 @@ typedef gauge_instr * pGaugeInst; // for both panel and HUD Turn Bank Indicators. class dual_instr_item : public instr_item { - private: +private: FLTFNPTR alt_data_source; - public: +public: dual_instr_item ( int x, int y, UINT width, @@ -886,14 +885,14 @@ class dual_instr_item : public instr_item { class fgTBI_instr : public dual_instr_item { - private: +private: UINT BankLimit; UINT SlewLimit; UINT scr_hole; bool tsi; //suma float rad; //suma - public: +public: fgTBI_instr( int x, int y, UINT width, @@ -921,7 +920,7 @@ class fgTBI_instr : public dual_instr_item typedef fgTBI_instr * pTBI; class HudLadder : public dual_instr_item { - private: +private: UINT width_units; int div_units; UINT minor_div; @@ -951,7 +950,7 @@ class HudLadder : public dual_instr_item { fgLineList LineList; fgLineList StippleLineList; - public: +public: HudLadder( string name, int x, int y, diff --git a/src/Cockpit/hud_card.cxx b/src/Cockpit/hud_card.cxx index 62d606a4e..0a06d7b65 100644 --- a/src/Cockpit/hud_card.cxx +++ b/src/Cockpit/hud_card.cxx @@ -45,51 +45,51 @@ hud_card( int x, string type_pointer, string type_tick,//hud string length_tick,//hud - bool working, + bool working, float rad,//suma int divs, //suma int zooms //suma - ) : //suma - instr_scale( x,y,width,height, - data_source, options, - value_span, - max_value, min_value, disp_scaling, - major_divs, minor_divs, modulus, - working), - val_span ( value_span), - type ( card_type), - draw_tick_bottom (tick_bottom), - draw_tick_top (tick_top), - draw_tick_right (tick_right), - draw_tick_left (tick_left), - draw_cap_bottom (cap_bottom), - draw_cap_top (cap_top), - draw_cap_right (cap_right), - draw_cap_left (cap_left), - marker_offset (mark_offset), - pointer (pointer_enable), - pointer_type (type_pointer), - tick_type (type_tick), //hud - tick_length (length_tick), //hud - Maj_div (major_divs), //suma - Min_div (minor_divs) //suma + ) : //suma + instr_scale( x,y,width,height, + data_source, options, + value_span, + max_value, min_value, disp_scaling, + major_divs, minor_divs, modulus, + working), + val_span ( value_span), + type ( card_type), + draw_tick_bottom (tick_bottom), + draw_tick_top (tick_top), + draw_tick_right (tick_right), + draw_tick_left (tick_left), + draw_cap_bottom (cap_bottom), + draw_cap_top (cap_top), + draw_cap_right (cap_right), + draw_cap_left (cap_left), + marker_offset (mark_offset), + pointer (pointer_enable), + pointer_type (type_pointer), + tick_type (type_tick), //hud + tick_length (length_tick), //hud + Maj_div (major_divs), //suma + Min_div (minor_divs) //suma { - half_width_units = range_to_show() / 2.0; - radius=rad; //suma - maxValue=max_value; //suma - minValue=min_value; //suma - divisions=divs; //suma - zoom = zooms; //suma - -// UINT options = get_options(); -// huds_both = (options & HUDS_BOTH) == HUDS_BOTH; -// huds_right = options & HUDS_RIGHT; -// huds_left = options & HUDS_LEFT; -// huds_vert = options & HUDS_VERT; -// huds_notext = options & HUDS_NOTEXT; -// huds_top = options & HUDS_TOP; -// huds_bottom = options & HUDS_BOTTOM; + half_width_units = range_to_show() / 2.0; + radius=rad; //suma + maxValue=max_value; //suma + minValue=min_value; //suma + divisions=divs; //suma + zoom = zooms; //suma + + // UINT options = get_options(); + // huds_both = (options & HUDS_BOTH) == HUDS_BOTH; + // huds_right = options & HUDS_RIGHT; + // huds_left = options & HUDS_LEFT; + // huds_vert = options & HUDS_VERT; + // huds_notext = options & HUDS_NOTEXT; + // huds_top = options & HUDS_TOP; + // huds_bottom = options & HUDS_BOTTOM; } hud_card :: @@ -114,18 +114,18 @@ hud_card( const hud_card & image): pointer_type (image.pointer_type), tick_type(image.tick_type), //hud tick_length(image.tick_length), //hud - Maj_div(image.Maj_div), //suma - Min_div(image.Min_div)//suma + Maj_div(image.Maj_div), //suma + Min_div(image.Min_div)//suma { -// UINT options = get_options(); -// huds_both = (options & HUDS_BOTH) == HUDS_BOTH; -// huds_right = options & HUDS_RIGHT; -// huds_left = options & HUDS_LEFT; -// huds_vert = options & HUDS_VERT; -// huds_notext = options & HUDS_NOTEXT; -// huds_top = options & HUDS_TOP; -// huds_bottom = options & HUDS_BOTTOM; + // UINT options = get_options(); + // huds_both = (options & HUDS_BOTH) == HUDS_BOTH; + // huds_right = options & HUDS_RIGHT; + // huds_left = options & HUDS_LEFT; + // huds_vert = options & HUDS_VERT; + // huds_notext = options & HUDS_NOTEXT; + // huds_top = options & HUDS_TOP; + // huds_bottom = options & HUDS_BOTTOM; } hud_card & hud_card :: @@ -178,10 +178,10 @@ draw( void ) // (HUD_scale * pscale ) POINT mid_scr = get_centroid(); float cur_value = get_value(); - if (!((int)maxValue%2) ) - oddtype =0; //draw ticks at even values - else - oddtype = 1;//draw ticks at odd values + if (!((int)maxValue%2) ) + oddtype =0; //draw ticks at even values + else + oddtype = 1;//draw ticks at odd values RECT scrn_rect = get_location(); UINT options = get_options(); @@ -189,743 +189,676 @@ draw( void ) // (HUD_scale * pscale ) height = scrn_rect.top + scrn_rect.bottom; width = scrn_rect.left + scrn_rect.right; - //begin suma - // if type=gauge then display dial - if(type=="gauge") - { + //begin suma + // if type=gauge then display dial + if(type=="gauge") { float x,y; - float i; - int decimal, sign; - y=(float)(scrn_rect.top); + float i; + int decimal, sign; + y=(float)(scrn_rect.top); x=(float)(scrn_rect.left); - glEnable(GL_POINT_SMOOTH); - glPointSize(3.0); - - float incr= 360.0/divisions; - for(i=0.0;i<360.0;i+=incr) - { float i1=i*SGD_DEGREES_TO_RADIANS; - float x1=x+radius*cos(i1); - float y1=y+radius*sin(i1); + glEnable(GL_POINT_SMOOTH); + glPointSize(3.0); + + float incr= 360.0/divisions; + for(i=0.0;i<360.0;i+=incr) { + float i1=i*SGD_DEGREES_TO_RADIANS; + float x1=x+radius*cos(i1); + float y1=y+radius*sin(i1); - glBegin(GL_POINTS); - glVertex2f(x1,y1); - glEnd(); - } - glPointSize(1.0); - glDisable(GL_POINT_SMOOTH); + glBegin(GL_POINTS); + glVertex2f(x1,y1); + glEnd(); + } + glPointSize(1.0); + glDisable(GL_POINT_SMOOTH); - if(data_available()) - { - float offset = 90.0*SGD_DEGREES_TO_RADIANS; - float r1=10.0; //size of carrot - float theta= get_value(); - - float theta1= -theta*SGD_DEGREES_TO_RADIANS+offset; - float x1=x+radius*cos(theta1); - float y1=y+radius*sin(theta1); - float x2=x1-r1*cos(theta1-30.0*SGD_DEGREES_TO_RADIANS); - float y2=y1-r1*sin(theta1-30.0*SGD_DEGREES_TO_RADIANS); - float x3=x1-r1*cos(theta1+30.0*SGD_DEGREES_TO_RADIANS); - float y3=y1-r1*sin(theta1+30.0*SGD_DEGREES_TO_RADIANS); + if(data_available()) { + float offset = 90.0*SGD_DEGREES_TO_RADIANS; + float r1=10.0; //size of carrot + float theta= get_value(); + + float theta1= -theta*SGD_DEGREES_TO_RADIANS+offset; + float x1=x+radius*cos(theta1); + float y1=y+radius*sin(theta1); + float x2=x1-r1*cos(theta1-30.0*SGD_DEGREES_TO_RADIANS); + float y2=y1-r1*sin(theta1-30.0*SGD_DEGREES_TO_RADIANS); + float x3=x1-r1*cos(theta1+30.0*SGD_DEGREES_TO_RADIANS); + float y3=y1-r1*sin(theta1+30.0*SGD_DEGREES_TO_RADIANS); - // draw carrot - drawOneLine(x1,y1,x2,y2); - drawOneLine(x1,y1,x3,y3); - sprintf(TextScale,"%3.1f\n",theta); + // draw carrot + drawOneLine(x1,y1,x2,y2); + drawOneLine(x1,y1,x3,y3); + sprintf(TextScale,"%3.1f\n",theta); - // draw value - int l= abs((int)theta); - if((l>=0) && (l<=9)) - textString (x,y,TextScale,GLUT_BITMAP_8_BY_13,0 ); - if((l>=10) && (l<=99)) - textString (x-1.0,y,TextScale,GLUT_BITMAP_8_BY_13,0 ); - if((l>=100) && (l<=359)) - textString (x-2.0,y,TextScale,GLUT_BITMAP_8_BY_13,0 ); + // draw value + int l= abs((int)theta); + if((l>=0) && (l<=9)) + textString (x,y,TextScale,GLUT_BITMAP_8_BY_13,0 ); + if((l>=10) && (l<=99)) + textString (x-1.0,y,TextScale,GLUT_BITMAP_8_BY_13,0 ); + if((l>=100) && (l<=359)) + textString (x-2.0,y,TextScale,GLUT_BITMAP_8_BY_13,0 ); - } + } - } //end type=gauge - else // if its not explicitly a gauge default to tape - { - if(pointer) - { - if(pointer_type=="moving") - { - vmin = minValue; - vmax = maxValue; - } - else // default to fixed - { - + //end type=gauge + } else { + // if its not explicitly a gauge default to tape + if(pointer) { + if(pointer_type=="moving") { + vmin = minValue; + vmax = maxValue; + } else { + // default to fixed vmin = cur_value - half_width_units; // width units == needle travel vmax = cur_value + half_width_units; // or picture unit span. text_x = mid_scr.x; text_y = mid_scr.y; - } - } else { + } + } else { vmin = cur_value - half_width_units; // width units == needle travel vmax = cur_value + half_width_units; // or picture unit span. text_x = mid_scr.x; text_y = mid_scr.y; - } + } + // Draw the basic markings for the scale... - // Draw the basic markings for the scale... - - if( huds_vert(options) ) { // Vertical scale - if (draw_tick_bottom) { - drawOneLine( scrn_rect.left, // Bottom tick bar - scrn_rect.top, - width, - scrn_rect.top); - } // endif draw_tick_bottom - if (draw_tick_top) { - drawOneLine( scrn_rect.left, // Top tick bar - height, - width, - height ); - } // endif draw_tick_top + if( huds_vert(options) ) { // Vertical scale + if (draw_tick_bottom) { + drawOneLine( scrn_rect.left, // Bottom tick bar + scrn_rect.top, + width, + scrn_rect.top); + } // endif draw_tick_bottom + if (draw_tick_top) { + drawOneLine( scrn_rect.left, // Top tick bar + height, + width, + height ); + } // endif draw_tick_top - marker_xs = scrn_rect.left; // x start - marker_xe = width; // x extent - marker_ye = height; + marker_xs = scrn_rect.left; // x start + marker_xe = width; // x extent + marker_ye = height; - // glBegin(GL_LINES); + // glBegin(GL_LINES); - // Bottom tick bar - // glVertex2f( marker_xs, scrn_rect.top); - // glVertex2f( marker_xe, scrn_rect.top); + // Bottom tick bar + // glVertex2f( marker_xs, scrn_rect.top); + // glVertex2f( marker_xe, scrn_rect.top); - // Top tick bar - // glVertex2f( marker_xs, marker_ye); - // glVertex2f( marker_xe, marker_ye ); - // glEnd(); + // Top tick bar + // glVertex2f( marker_xs, marker_ye); + // glVertex2f( marker_xe, marker_ye ); + // glEnd(); - // We do not use else in the following so that combining the - // two options produces a "caged" display with double - // carrots. The same is done for horizontal card indicators. + // We do not use else in the following so that combining the + // two options produces a "caged" display with double + // carrots. The same is done for horizontal card indicators. - // begin vertical/left - //First draw capping lines and pointers - if( huds_left(options) ) { // Calculate x marker offset + // begin vertical/left + //First draw capping lines and pointers + if( huds_left(options) ) { // Calculate x marker offset - if (draw_cap_right) { + if (draw_cap_right) { - drawOneLine( marker_xe, scrn_rect.top, - marker_xe, marker_ye); // Cap right side - } //endif cap_right - - marker_xs = marker_xe - scrn_rect.right / 3; // Adjust tick xs - - // drawOneLine( marker_xs, mid_scr.y, - // marker_xe, mid_scr.y + scrn_rect.right / 6); - // drawOneLine( marker_xs, mid_scr.y, - // marker_xe, mid_scr.y - scrn_rect.right / 6); - - // draw pointer - if(pointer) - { - if(pointer_type=="moving") - { - if(zoom == 0) - { - //Code for Moving Type Pointer included by suma. - static float ycentre, ypoint,xpoint; - static int range,wth; - if(cur_value > maxValue) cur_value = maxValue; - if(cur_value < minValue) cur_value = minValue; - if (minValue >= 0.0) - ycentre = scrn_rect.top; - else if (maxValue + minValue == 0.0) - ycentre = mid_scr.y; - else - if (oddtype == 1) - ycentre = scrn_rect.top + (1.0-minValue)*scrn_rect.bottom/(maxValue-minValue); - else - ycentre = scrn_rect.top + minValue*scrn_rect.bottom/(maxValue-minValue); - range = scrn_rect.bottom; - wth = scrn_rect.left + scrn_rect.right; - if (oddtype == 1) - ypoint = ycentre + ((cur_value-1.0) * range / val_span); - else - ypoint = ycentre + (cur_value * range / val_span); - xpoint = wth + marker_offset; - drawOneLine(xpoint,ycentre,xpoint,ypoint); - drawOneLine(xpoint,ypoint,xpoint-marker_offset,ypoint); - drawOneLine(xpoint-marker_offset,ypoint,xpoint-5.0,ypoint+5.0); - drawOneLine(xpoint-marker_offset,ypoint,xpoint-5.0,ypoint-5.0); - }//zoom=0 - } else // default to fixed - { - fixed(marker_offset+marker_xe, text_y + scrn_rect.right / 6, - marker_offset+marker_xs, text_y,marker_offset+marker_xe, - text_y - scrn_rect.right / 6); - }//end pointer type - - } //if pointer - } //end vertical/left + drawOneLine( marker_xe, scrn_rect.top, + marker_xe, marker_ye); // Cap right side + } //endif cap_right + + marker_xs = marker_xe - scrn_rect.right / 3; // Adjust tick xs + + // drawOneLine( marker_xs, mid_scr.y, + // marker_xe, mid_scr.y + scrn_rect.right / 6); + // drawOneLine( marker_xs, mid_scr.y, + // marker_xe, mid_scr.y - scrn_rect.right / 6); + + // draw pointer + if(pointer) { + if(pointer_type=="moving") { + if(zoom == 0) { + //Code for Moving Type Pointer included by suma. + static float ycentre, ypoint,xpoint; + static int range,wth; + if(cur_value > maxValue) cur_value = maxValue; + if(cur_value < minValue) cur_value = minValue; + if (minValue >= 0.0) + ycentre = scrn_rect.top; + else if (maxValue + minValue == 0.0) + ycentre = mid_scr.y; + else + if (oddtype == 1) + ycentre = scrn_rect.top + (1.0-minValue)*scrn_rect.bottom/(maxValue-minValue); + else + ycentre = scrn_rect.top + minValue*scrn_rect.bottom/(maxValue-minValue); + range = scrn_rect.bottom; + wth = scrn_rect.left + scrn_rect.right; + if (oddtype == 1) + ypoint = ycentre + ((cur_value-1.0) * range / val_span); + else + ypoint = ycentre + (cur_value * range / val_span); + xpoint = wth + marker_offset; + drawOneLine(xpoint,ycentre,xpoint,ypoint); + drawOneLine(xpoint,ypoint,xpoint-marker_offset,ypoint); + drawOneLine(xpoint-marker_offset,ypoint,xpoint-5.0,ypoint+5.0); + drawOneLine(xpoint-marker_offset,ypoint,xpoint-5.0,ypoint-5.0); + }//zoom=0 + } else { + // default to fixed + fixed(marker_offset+marker_xe, text_y + scrn_rect.right / 6, + marker_offset+marker_xs, text_y,marker_offset+marker_xe, + text_y - scrn_rect.right / 6); + }//end pointer type + + } //if pointer + } //end vertical/left - // begin vertical/right - //First draw capping lines and pointers - if( huds_right(options) ) { // We'll default this for now. - if (draw_cap_left) { - drawOneLine( scrn_rect.left, scrn_rect.top, - scrn_rect.left, marker_ye ); // Cap left side - } //endif cap_left - - marker_xe = scrn_rect.left + scrn_rect.right / 3; // Adjust tick xe - // Indicator carrot - // drawOneLine( scrn_rect.left, mid_scr.y + scrn_rect.right / 6, - // marker_xe, mid_scr.y ); - // drawOneLine( scrn_rect.left, mid_scr.y - scrn_rect.right / 6, - // marker_xe, mid_scr.y); - - // draw pointer - if(pointer) - { - if(pointer_type=="moving") - { - if(zoom == 0) //type-fixed & zoom=1, behaviour to be defined - { - // Code for Moving Type Pointer included by suma. - static float ycentre, ypoint,xpoint; - static int range,wth; - if(cur_value > maxValue) cur_value = maxValue; - if(cur_value < minValue) cur_value = minValue; - if (minValue >= 0.0) - ycentre = scrn_rect.top; - else if (maxValue + minValue == 0.0) - ycentre = mid_scr.y; - else - if (oddtype == 1) - ycentre = scrn_rect.top + (1.0-minValue)*scrn_rect.bottom/(maxValue-minValue); - else - ycentre = scrn_rect.top + minValue*scrn_rect.bottom/(maxValue-minValue); - range = scrn_rect.bottom; - if (oddtype == 1) - ypoint = ycentre + ((cur_value-1.0) * range / val_span); - else - ypoint = ycentre + (cur_value * range / val_span); - xpoint = scrn_rect.left - marker_offset; - drawOneLine(xpoint,ycentre,xpoint,ypoint); - drawOneLine(xpoint,ypoint,xpoint+marker_offset,ypoint); - drawOneLine(xpoint+marker_offset,ypoint,xpoint+5.0,ypoint+5.0); - drawOneLine(xpoint+marker_offset,ypoint,xpoint+5.0,ypoint-5.0); - } - } - else // default to fixed - { - fixed( -marker_offset+scrn_rect.left, text_y + scrn_rect.right / 6, - -marker_offset+marker_xe, text_y,-marker_offset+scrn_rect.left, - text_y - scrn_rect.right / 6); - } - }//if pointer - } //end vertical/right - - // At this point marker x_start and x_end values are transposed. - // To keep this from confusing things they are now interchanged. - if(huds_both(options)) { - marker_ye = marker_xs; - marker_xs = marker_xe; - marker_xe = marker_ye; - } - - // Work through from bottom to top of scale. Calculating where to put - // minor and major ticks. - - // draw scale or tape + // begin vertical/right + //First draw capping lines and pointers + if( huds_right(options) ) { // We'll default this for now. + if (draw_cap_left) { + drawOneLine( scrn_rect.left, scrn_rect.top, + scrn_rect.left, marker_ye ); // Cap left side + } //endif cap_left + + marker_xe = scrn_rect.left + scrn_rect.right / 3; // Adjust tick xe + // Indicator carrot + // drawOneLine( scrn_rect.left, mid_scr.y + scrn_rect.right / 6, + // marker_xe, mid_scr.y ); + // drawOneLine( scrn_rect.left, mid_scr.y - scrn_rect.right / 6, + // marker_xe, mid_scr.y); + + // draw pointer + if(pointer) { + if(pointer_type=="moving") { + if(zoom == 0) { + //type-fixed & zoom=1, behaviour to be defined + // Code for Moving Type Pointer included by suma. + static float ycentre, ypoint,xpoint; + static int range,wth; + if(cur_value > maxValue) cur_value = maxValue; + if(cur_value < minValue) cur_value = minValue; + if (minValue >= 0.0) + ycentre = scrn_rect.top; + else if (maxValue + minValue == 0.0) + ycentre = mid_scr.y; + else + if (oddtype == 1) + ycentre = scrn_rect.top + (1.0-minValue)*scrn_rect.bottom/(maxValue-minValue); + else + ycentre = scrn_rect.top + minValue*scrn_rect.bottom/(maxValue-minValue); + range = scrn_rect.bottom; + if (oddtype == 1) + ypoint = ycentre + ((cur_value-1.0) * range / val_span); + else + ypoint = ycentre + (cur_value * range / val_span); + xpoint = scrn_rect.left - marker_offset; + drawOneLine(xpoint,ycentre,xpoint,ypoint); + drawOneLine(xpoint,ypoint,xpoint+marker_offset,ypoint); + drawOneLine(xpoint+marker_offset,ypoint,xpoint+5.0,ypoint+5.0); + drawOneLine(xpoint+marker_offset,ypoint,xpoint+5.0,ypoint-5.0); + } + } else { + // default to fixed + fixed( -marker_offset+scrn_rect.left, text_y + scrn_rect.right / 6, + -marker_offset+marker_xe, text_y,-marker_offset+scrn_rect.left, + text_y - scrn_rect.right / 6); + } + } //if pointer + } //end vertical/right + + // At this point marker x_start and x_end values are transposed. + // To keep this from confusing things they are now interchanged. + if(huds_both(options)) { + marker_ye = marker_xs; + marker_xs = marker_xe; + marker_xe = marker_ye; + } + + // Work through from bottom to top of scale. Calculating where to put + // minor and major ticks. + + // draw scale or tape - last = FloatToInt(vmax)+1; - i = FloatToInt(vmin); - - if(zoom ==1) - { - zoomed_scale(vmin,vmax); //suma - } - else - { - - for( ; i (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))){ */ + last = FloatToInt(vmax)+1; + i = FloatToInt(vmin); + + if(zoom ==1) { + zoomed_scale(vmin,vmax); //suma + } else { + for( ; i (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 + //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() ) - { + 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( !(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, GLUT_BITMAP_8_BY_13,0 ); - } - } - //begin suma - /* Changes are made to draw a circle when tick_type="circle" */ - // anything other than huds_both - else - { - 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, GLUT_BITMAP_8_BY_13,0 ); - } - else - { - textString( marker_xe + 3 * lenstr, - marker_ys - 4, - TextScale, GLUT_BITMAP_8_BY_13,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); + if( !huds_notext(options)) { + textString ( marker_xs + 2, marker_ys, + TextScale, GLUT_BITMAP_8_BY_13,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, GLUT_BITMAP_8_BY_13,0 ); + } else { + textString( marker_xe + 3 * lenstr, + marker_ys - 4, + TextScale, GLUT_BITMAP_8_BY_13,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 - // right tick bar - // glVertex2f( marker_xe, scrn_rect.top); - // glVertex2f( marker_xe, marker_ye ); - // glEnd(); + 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*/); + - 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; - xcentre = mid_scr.x; - range = scrn_rect.right; - xpoint = xcentre + (cur_value * range / val_span); - 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 ); + // 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; + xcentre = mid_scr.x; + range = scrn_rect.right; + xpoint = xcentre + (cur_value * range / val_span); + 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; - xcentre = mid_scr.x ; - range = scrn_rect.right; - hgt = scrn_rect.top + scrn_rect.bottom; - xpoint = xcentre + (cur_value * range / val_span); - 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(vmin,vmax); //suma - } - else //default to zoom=0 - { - - last = (int)vmax + 1; - i = (int)vmin; - for(; i 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))){ */ //suma + // 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; + xcentre = mid_scr.x ; + range = scrn_rect.right; + hgt = scrn_rect.top + scrn_rect.bottom; + xpoint = xcentre + (cur_value * range / val_span); + 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(vmin,vmax); //suma + } else { + //default to zoom=0 + last = (int)vmax + 1; + i = (int)vmin; + for(; i 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))){ */ //suma - 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))){*/ //suma - 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, GLUT_BITMAP_8_BY_13,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, GLUT_BITMAP_8_BY_13,0 ); //suma - } else { - textString( marker_xs - 4 * lenstr, - scrn_rect.top, - TextScale, GLUT_BITMAP_8_BY_13,0 ); //suma - } - } - } - } //end draw major ticks - } //endif major ticks - } //end condition - } //end for - } //end zoom - } //end horizontal/vertical scale - } // end of type tape + 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))){*/ //suma + 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, GLUT_BITMAP_8_BY_13,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, GLUT_BITMAP_8_BY_13,0 ); //suma + } else { + textString( marker_xs - 4 * lenstr, + scrn_rect.top, + TextScale, GLUT_BITMAP_8_BY_13,0 ); //suma + } + } + } + } //end draw major ticks + } //endif major ticks + } //end condition + } //end for + } //end zoom + } //end horizontal/vertical scale + } // end of type tape } //draw @@ -938,11 +871,11 @@ circles(float x,float y,float size) glPointSize(size); glBegin(GL_POINTS); - glVertex2f(x,y); - glEnd(); + glVertex2f(x,y); + glEnd(); glPointSize(1.0); - glDisable(GL_POINT_SMOOTH); + glDisable(GL_POINT_SMOOTH); } //end suma @@ -950,10 +883,10 @@ circles(float x,float y,float size) 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); + glBegin(GL_LINE_STRIP); + glVertex2f(x1, y1); + glVertex2f(x2, y2); + glVertex2f(x3, y3); glEnd(); } @@ -965,397 +898,363 @@ zoomed_scale(int first, int last) POINT mid_scr = get_centroid(); RECT scrn_rect = get_location(); UINT options = get_options(); - char TextScale[80]; + char TextScale[80]; int disp_val = 0; - int data[80]; + int data[80]; - float x,y,w,h,bottom; + 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; + if(cur_value > maxValue) cur_value = maxValue; + if(cur_value < minValue) cur_value = minValue; - int a=0; + int a=0; - while(first <= last) - { - if((first % (int)Maj_div) == 0) - { - data[a] = first; - a++ ; - } + while(first <= last) { + if((first % (int)Maj_div) == 0) { + data[a] = first; + a++ ; + } first++; - } + } int centre =a/2; - if( huds_vert(options) ) - { - - x=scrn_rect.left; - y=scrn_rect.top; - w=scrn_rect.left+scrn_rect.right; - h=scrn_rect.top+scrn_rect.bottom; - bottom=scrn_rect.bottom; + if( huds_vert(options) ) { + + x=scrn_rect.left; + y=scrn_rect.top; + w=scrn_rect.left+scrn_rect.right; + h=scrn_rect.top+scrn_rect.bottom; + bottom=scrn_rect.bottom; - float xstart, yfirst, ycentre, ysecond; + float xstart, yfirst, ycentre, ysecond; - float hgt = bottom * 20.0 /100.0; // 60% of height should be zoomed - yfirst = mid_scr.y - hgt; - ycentre = mid_scr.y; - ysecond = mid_scr.y + hgt; - float range = hgt * 2; + float hgt = bottom * 20.0 /100.0; // 60% of height should be zoomed + yfirst = mid_scr.y - hgt; + ycentre = mid_scr.y; + ysecond = mid_scr.y + hgt; + float range = hgt * 2; - int i; - float factor = range /10.0; + int i; + float factor = range /10.0; - float hgt1 = bottom * 30.0 /100.0; - int incrs = ((int)val_span - (Maj_div * 2)) / Maj_div ; - int incr = incrs / 2; - float factors = hgt1 / incr; + float hgt1 = bottom * 30.0 /100.0; + int incrs = ((int)val_span - (Maj_div * 2)) / Maj_div ; + int incr = incrs / 2; + float factors = hgt1 / incr; - // begin - //this is for moving type pointer - static float ycent, ypoint,xpoint; - static int wth; + // begin + //this is for moving type pointer + static float ycent, ypoint,xpoint; + static int wth; - ycent = mid_scr.y; - wth=scrn_rect.left+scrn_rect.right; + ycent = mid_scr.y; + wth=scrn_rect.left+scrn_rect.right; - if(cur_value <= data[centre+1]) - if(cur_value > data[centre]) - { - ypoint = ycent + ((cur_value - data[centre]) * hgt/Maj_div); - } - - if(cur_value >= data[centre-1]) - if(cur_value <= data[centre]) - { - ypoint = ycent - ((data[centre]-cur_value) * hgt/Maj_div); - } - - if(cur_value < data[centre-1]) - if(cur_value >= minValue) - { - float diff = minValue - data[centre-1]; - float diff1 = cur_value - data[centre-1]; - float val = (diff1 * hgt1) / diff; + if(cur_value <= data[centre+1]) + if(cur_value > data[centre]) { + ypoint = ycent + ((cur_value - data[centre]) * hgt/Maj_div); + } + + if(cur_value >= data[centre-1]) + if(cur_value <= data[centre]) { + ypoint = ycent - ((data[centre]-cur_value) * hgt/Maj_div); + } + + if(cur_value < data[centre-1]) + if(cur_value >= minValue) { + float diff = minValue - data[centre-1]; + float diff1 = cur_value - data[centre-1]; + float val = (diff1 * hgt1) / diff; - ypoint = ycent - hgt - val; - } + ypoint = ycent - hgt - val; + } - if(cur_value > data[centre+1]) - if(cur_value <= maxValue) - { - float diff = maxValue - data[centre+1]; - float diff1 = cur_value - data[centre+1]; - float val = (diff1 * hgt1) / diff; + if(cur_value > data[centre+1]) + if(cur_value <= maxValue) { + float diff = maxValue - data[centre+1]; + float diff1 = cur_value - data[centre+1]; + float val = (diff1 * hgt1) / diff; - ypoint = ycent + hgt + val; - } + ypoint = ycent + hgt + val; + } - if(huds_left(options)) - { - xstart = w; - - drawOneLine( xstart, ycentre, xstart - 5.0, ycentre); //centre tick + if(huds_left(options)) { + xstart = w; + + drawOneLine( xstart, ycentre, xstart - 5.0, ycentre); //centre tick - sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling())); + sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling())); - if( !huds_notext(options)) - { - textString (x, ycentre, TextScale, GLUT_BITMAP_8_BY_13,0 ); - } + if( !huds_notext(options)) { + textString (x, ycentre, TextScale, GLUT_BITMAP_8_BY_13,0 ); + } - for(i=1;i<5;i++) - { - yfirst += factor; - ycentre += factor; - circles(xstart-2.5,yfirst, 3.0); - circles(xstart-2.5,ycentre,3.0); - } + for(i=1;i<5;i++) { + yfirst += factor; + ycentre += factor; + circles(xstart-2.5,yfirst, 3.0); + circles(xstart-2.5,ycentre,3.0); + } - yfirst = mid_scr.y - hgt; + yfirst = mid_scr.y - hgt; - for(i=0;i<=incr;i++) - { - drawOneLine( xstart, yfirst, xstart - 5.0, yfirst); - drawOneLine( xstart,ysecond, xstart - 5.0,ysecond); - - sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling())); + for(i=0;i<=incr;i++) { + drawOneLine( xstart, yfirst, xstart - 5.0, yfirst); + drawOneLine( xstart,ysecond, xstart - 5.0,ysecond); + + sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling())); - if( !huds_notext(options)) - textString (x, yfirst, TextScale, GLUT_BITMAP_8_BY_13,0 ); + if( !huds_notext(options)) + textString (x, yfirst, TextScale, GLUT_BITMAP_8_BY_13,0 ); - sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling())); + sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling())); - if( !huds_notext(options)) - textString (x, ysecond, TextScale, GLUT_BITMAP_8_BY_13,0 ); + if( !huds_notext(options)) + textString (x, ysecond, TextScale, GLUT_BITMAP_8_BY_13,0 ); - yfirst -= factors; - ysecond += factors; + yfirst -= factors; + ysecond += factors; - } - //to draw moving type pointer for left option - //begin - xpoint = wth + 10.0; + } + //to draw moving type pointer for left option + //begin + xpoint = wth + 10.0; - if(pointer_type == "moving") - { - drawOneLine(xpoint,ycent,xpoint,ypoint); - drawOneLine(xpoint,ypoint,xpoint-10.0,ypoint); - drawOneLine(xpoint-10.0,ypoint,xpoint-5.0,ypoint+5.0); - drawOneLine(xpoint-10.0,ypoint,xpoint-5.0,ypoint-5.0); - } - //end + if(pointer_type == "moving") { + drawOneLine(xpoint,ycent,xpoint,ypoint); + drawOneLine(xpoint,ypoint,xpoint-10.0,ypoint); + drawOneLine(xpoint-10.0,ypoint,xpoint-5.0,ypoint+5.0); + drawOneLine(xpoint-10.0,ypoint,xpoint-5.0,ypoint-5.0); + } + //end - } - else //huds_right - { - - xstart = (x+w)/2; + } else { + //huds_right + xstart = (x+w)/2; - drawOneLine( xstart, ycentre, xstart + 5.0, ycentre); //centre tick + drawOneLine( xstart, ycentre, xstart + 5.0, ycentre); //centre tick - sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling())); + sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling())); - if( !huds_notext(options)) - { - textString (w, ycentre, TextScale, GLUT_BITMAP_8_BY_13,0 ); - } + if( !huds_notext(options)) { + textString (w, ycentre, TextScale, GLUT_BITMAP_8_BY_13,0 ); + } - for(i=1;i<5;i++) - { - yfirst += factor; - ycentre += factor; - circles(xstart+2.5,yfirst, 3.0); - circles(xstart+2.5,ycentre,3.0); - } + for(i=1;i<5;i++) { + yfirst += factor; + ycentre += factor; + circles(xstart+2.5,yfirst, 3.0); + circles(xstart+2.5,ycentre,3.0); + } - yfirst = mid_scr.y - hgt; + yfirst = mid_scr.y - hgt; - for(i=0;i<=incr;i++) - { - drawOneLine( xstart, yfirst, xstart + 5.0, yfirst); - drawOneLine( xstart,ysecond, xstart + 5.0,ysecond); + for(i=0;i<=incr;i++) { + drawOneLine( xstart, yfirst, xstart + 5.0, yfirst); + drawOneLine( xstart,ysecond, xstart + 5.0,ysecond); - sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling())); + sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling())); - if( !huds_notext(options)) - textString (w, yfirst, TextScale, GLUT_BITMAP_8_BY_13,0 ); + if( !huds_notext(options)) + textString (w, yfirst, TextScale, GLUT_BITMAP_8_BY_13,0 ); - sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling())); + sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling())); - if( !huds_notext(options)) - textString (w, ysecond, TextScale, GLUT_BITMAP_8_BY_13,0 ); + if( !huds_notext(options)) + textString (w, ysecond, TextScale, GLUT_BITMAP_8_BY_13,0 ); - yfirst -= factors; - ysecond += factors; + yfirst -= factors; + ysecond += factors; - } + } - // to draw moving type pointer for right option - //begin - xpoint = scrn_rect.left; + // to draw moving type pointer for right option + //begin + xpoint = scrn_rect.left; - if(pointer_type == "moving") - { - drawOneLine(xpoint,ycent,xpoint,ypoint); - drawOneLine(xpoint,ypoint,xpoint+10.0,ypoint); - drawOneLine(xpoint+10.0,ypoint,xpoint+5.0,ypoint+5.0); - drawOneLine(xpoint+10.0,ypoint,xpoint+5.0,ypoint-5.0); - } - //end - }//end huds_right /left - } //end of vertical scale - else //horizontal scale - { - x=scrn_rect.left; - y=scrn_rect.top; - w=scrn_rect.left+scrn_rect.right; - h=scrn_rect.top+scrn_rect.bottom; - bottom=scrn_rect.right; + if(pointer_type == "moving") { + drawOneLine(xpoint,ycent,xpoint,ypoint); + drawOneLine(xpoint,ypoint,xpoint+10.0,ypoint); + drawOneLine(xpoint+10.0,ypoint,xpoint+5.0,ypoint+5.0); + drawOneLine(xpoint+10.0,ypoint,xpoint+5.0,ypoint-5.0); + } + //end + }//end huds_right /left + //end of vertical scale + } else { + //horizontal scale + x=scrn_rect.left; + y=scrn_rect.top; + w=scrn_rect.left+scrn_rect.right; + h=scrn_rect.top+scrn_rect.bottom; + bottom=scrn_rect.right; - float ystart, xfirst, xcentre, xsecond; + float ystart, xfirst, xcentre, xsecond; - float hgt = bottom * 20.0 /100.0; // 60% of height should be zoomed - xfirst = mid_scr.x - hgt; - xcentre = mid_scr.x; - xsecond = mid_scr.x + hgt; - float range = hgt * 2; + float hgt = bottom * 20.0 /100.0; // 60% of height should be zoomed + xfirst = mid_scr.x - hgt; + xcentre = mid_scr.x; + xsecond = mid_scr.x + hgt; + float range = hgt * 2; - int i; - float factor = range /10.0; + int i; + float factor = range /10.0; - float hgt1 = bottom * 30.0 /100.0; - int incrs = ((int)val_span - (Maj_div * 2)) / Maj_div ; - int incr = incrs / 2; - float factors = hgt1 / incr; + float hgt1 = bottom * 30.0 /100.0; + int incrs = ((int)val_span - (Maj_div * 2)) / Maj_div ; + int incr = incrs / 2; + float factors = hgt1 / incr; - //Code for Moving Type Pointer - //begin - static float xcent,xpoint,ypoint; + //Code for Moving Type Pointer + //begin + static float xcent,xpoint,ypoint; - xcent = mid_scr.x; + xcent = mid_scr.x; - if(cur_value <= data[centre+1]) - if(cur_value > data[centre]) - { - xpoint = xcent + ((cur_value - data[centre]) * hgt/Maj_div); - } - - if(cur_value >= data[centre-1]) - if(cur_value <= data[centre]) - { - xpoint = xcent - ((data[centre]-cur_value) * hgt/Maj_div); - } + if(cur_value <= data[centre+1]) + if(cur_value > data[centre]) { + xpoint = xcent + ((cur_value - data[centre]) * hgt/Maj_div); + } + + if(cur_value >= data[centre-1]) + if(cur_value <= data[centre]) { + xpoint = xcent - ((data[centre]-cur_value) * hgt/Maj_div); + } - if(cur_value < data[centre-1]) - if(cur_value >= minValue) - { - float diff = minValue - data[centre-1]; - float diff1 = cur_value - data[centre-1]; - float val = (diff1 * hgt1) / diff; + if(cur_value < data[centre-1]) + if(cur_value >= minValue) { + float diff = minValue - data[centre-1]; + float diff1 = cur_value - data[centre-1]; + float val = (diff1 * hgt1) / diff; - xpoint = xcent - hgt - val; - } + xpoint = xcent - hgt - val; + } - if(cur_value > data[centre+1]) - if(cur_value <= maxValue) - { - float diff = maxValue - data[centre+1]; - float diff1 = cur_value - data[centre+1]; - float val = (diff1 * hgt1) / diff; + if(cur_value > data[centre+1]) + if(cur_value <= maxValue) { + float diff = maxValue - data[centre+1]; + float diff1 = cur_value - data[centre+1]; + float val = (diff1 * hgt1) / diff; - xpoint = xcent + hgt + val; - } + xpoint = xcent + hgt + val; + } - //end - if(huds_top(options)) - { + //end + if(huds_top(options)) { - ystart =h; + ystart =h; - drawOneLine( xcentre, ystart, xcentre, ystart - 5.0); //centre tick + drawOneLine( xcentre, ystart, xcentre, ystart - 5.0); //centre tick - sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling())); + sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling())); - if( !huds_notext(options)) - { - textString (xcentre-10.0, y, TextScale, GLUT_BITMAP_8_BY_13,0 ); - } + if( !huds_notext(options)) { + textString (xcentre-10.0, y, TextScale, GLUT_BITMAP_8_BY_13,0 ); + } - for(i=1;i<5;i++) - { - xfirst += factor; - xcentre += factor; - circles(xfirst, ystart-2.5, 3.0); - circles(xcentre, ystart-2.5, 3.0); - } + for(i=1;i<5;i++) { + xfirst += factor; + xcentre += factor; + circles(xfirst, ystart-2.5, 3.0); + circles(xcentre, ystart-2.5, 3.0); + } - xfirst = mid_scr.x - hgt; + xfirst = mid_scr.x - hgt; - for(i=0;i<=incr;i++) - { - drawOneLine( xfirst, ystart, xfirst, ystart - 5.0); - drawOneLine( xsecond, ystart, xsecond, ystart - 5.0); + for(i=0;i<=incr;i++) { + drawOneLine( xfirst, ystart, xfirst, ystart - 5.0); + drawOneLine( xsecond, ystart, xsecond, ystart - 5.0); - sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling())); + sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling())); - if( !huds_notext(options)) - textString (xfirst-10.0, y, TextScale, GLUT_BITMAP_8_BY_13,0 ); + if( !huds_notext(options)) + textString (xfirst-10.0, y, TextScale, GLUT_BITMAP_8_BY_13,0 ); - sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling())); - - if( !huds_notext(options)) - textString (xsecond-10.0, y, TextScale, GLUT_BITMAP_8_BY_13,0 ); + sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling())); + + if( !huds_notext(options)) + textString (xsecond-10.0, y, TextScale, GLUT_BITMAP_8_BY_13,0 ); - xfirst -= factors; - xsecond += factors; - - } - //this is for moving pointer for top option - //begin + xfirst -= factors; + xsecond += factors; + + } + //this is for moving pointer for top option + //begin - ypoint = scrn_rect.top + scrn_rect.bottom + 10.0; - - if(pointer_type == "moving") - { - drawOneLine(xcent, ypoint,xpoint,ypoint); - drawOneLine(xpoint,ypoint,xpoint,ypoint-10.0); - drawOneLine(xpoint,ypoint-10.0,xpoint+5.0,ypoint-5.0); - drawOneLine(xpoint,ypoint-10.0,xpoint-5.0,ypoint-5.0); - } - //end - - } //end of top option - else //else huds_bottom - { - - ystart = (y+h)/2; + ypoint = scrn_rect.top + scrn_rect.bottom + 10.0; + + if(pointer_type == "moving") { + drawOneLine(xcent, ypoint,xpoint,ypoint); + drawOneLine(xpoint,ypoint,xpoint,ypoint-10.0); + drawOneLine(xpoint,ypoint-10.0,xpoint+5.0,ypoint-5.0); + drawOneLine(xpoint,ypoint-10.0,xpoint-5.0,ypoint-5.0); + } + //end of top option + } else { + //else huds_bottom + ystart = (y+h)/2; - //drawOneLine( xstart, yfirst, xstart - 5.0, yfirst ); - drawOneLine( xcentre, ystart, xcentre, ystart + 5.0); //centre tick + //drawOneLine( xstart, yfirst, xstart - 5.0, yfirst ); + drawOneLine( xcentre, ystart, xcentre, ystart + 5.0); //centre tick - sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling())); - - if( !huds_notext(options)) - { - textString (xcentre-10.0, h, TextScale, GLUT_BITMAP_8_BY_13,0 ); - } + sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling())); + + if( !huds_notext(options)) { + textString (xcentre-10.0, h, TextScale, GLUT_BITMAP_8_BY_13,0 ); + } - for(i=1;i<5;i++) - { - xfirst += factor; - xcentre += factor; - circles(xfirst, ystart+2.5, 3.0); - circles(xcentre, ystart+2.5,3.0); - } + for(i=1;i<5;i++) { + xfirst += factor; + xcentre += factor; + circles(xfirst, ystart+2.5, 3.0); + circles(xcentre, ystart+2.5,3.0); + } - xfirst = mid_scr.x - hgt; + xfirst = mid_scr.x - hgt; - for(i=0;i<=incr;i++) - { - drawOneLine( xfirst, ystart, xfirst, ystart + 5.0); - drawOneLine( xsecond,ystart, xsecond,ystart + 5.0); - - sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling())); - - if( !huds_notext(options)) - textString (xfirst-10.0,h, TextScale, GLUT_BITMAP_8_BY_13,0 ); + for(i=0;i<=incr;i++) { + drawOneLine( xfirst, ystart, xfirst, ystart + 5.0); + drawOneLine( xsecond,ystart, xsecond,ystart + 5.0); + + sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling())); + + if( !huds_notext(options)) + textString (xfirst-10.0,h, TextScale, GLUT_BITMAP_8_BY_13,0 ); - sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling())); + sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling())); - if( !huds_notext(options)) - textString (xsecond-10.0,h, TextScale, GLUT_BITMAP_8_BY_13,0 ); + if( !huds_notext(options)) + textString (xsecond-10.0,h, TextScale, GLUT_BITMAP_8_BY_13,0 ); - xfirst -= factors; - xsecond += factors; + xfirst -= factors; + xsecond += factors; - } - //this is for movimg pointer for bottom option - //begin + } + //this is for movimg pointer for bottom option + //begin - ypoint = scrn_rect.top - 10.0; - if(pointer_type == "moving") - { - drawOneLine(xcent, ypoint,xpoint,ypoint); - drawOneLine(xpoint,ypoint,xpoint,ypoint+10.0); - drawOneLine(xpoint,ypoint+10.0,xpoint+5.0,ypoint+5.0); - drawOneLine(xpoint,ypoint+10.0,xpoint-5.0,ypoint+5.0); - } + ypoint = scrn_rect.top - 10.0; + if(pointer_type == "moving") { + drawOneLine(xcent, ypoint,xpoint,ypoint); + drawOneLine(xpoint,ypoint,xpoint,ypoint+10.0); + drawOneLine(xpoint,ypoint+10.0,xpoint+5.0,ypoint+5.0); + drawOneLine(xpoint,ypoint+10.0,xpoint-5.0,ypoint+5.0); + } - //end - }//end hud_top or hud_bottom + //end + }//end hud_top or hud_bottom - } //end of horizontal/vertical scales + } //end of horizontal/vertical scales }//end draw