#include "hud.hxx" #ifdef USE_HUD_TextList #define textString( x , y, text, digit ) TextString( text, x , y,digit ) //suma #else #define textString( x , y, text, digit ) puDrawString ( guiFnt, text, x, y ); //suma #endif //============== Top of gauge_instr class member definitions ============== gauge_instr :: gauge_instr( int x, int y, UINT width, UINT height, FLTFNPTR load_fn, UINT options, float disp_scale, float maxValue, float minValue, UINT major_divs, UINT minor_divs, int dp_showing, UINT modulus, bool working) : instr_scale( x, y, width, height, load_fn, options, (maxValue - minValue), // Always shows span? maxValue, minValue, disp_scale, major_divs, minor_divs, modulus, dp_showing, working) { // UINT options = get_options(); // huds_vert = options & HUDS_VERT; // huds_left = options & HUDS_LEFT; // huds_right = options & HUDS_RIGHT; // huds_both = (options & HUDS_BOTH) == HUDS_BOTH; // huds_noticks = options & HUDS_NOTICKS; // huds_notext = options & HUDS_NOTEXT; // huds_top = options & HUDS_TOP; // huds_bottom = options & HUDS_BOTTOM; } gauge_instr :: ~gauge_instr() { } gauge_instr :: gauge_instr( const gauge_instr & image): instr_scale( (instr_scale &) image) { // UINT options = get_options(); // huds_vert = options & HUDS_VERT; // huds_left = options & HUDS_LEFT; // huds_right = options & HUDS_RIGHT; // huds_both = (options & HUDS_BOTH) == HUDS_BOTH; // huds_noticks = options & HUDS_NOTICKS; // huds_notext = options & HUDS_NOTEXT; // huds_top = options & HUDS_TOP; // huds_bottom = options & HUDS_BOTTOM; } gauge_instr & gauge_instr :: operator = (const gauge_instr & rhs ) { if( !(this == &rhs)) { instr_scale::operator = (rhs); } return *this; } // As implemented, draw only correctly draws a horizontal or vertical // scale. It should contain a variation that permits clock type displays. // Now is supports "tickless" displays such as control surface indicators. // This routine should be worked over before using. Current value would be // fetched and not used if not commented out. Clearly that is intollerable. void gauge_instr :: draw (void) { int marker_xs, marker_xe; int marker_ys, marker_ye; int text_x, text_y; int width, height, bottom_4; int lenstr; int i; char TextScale[80]; bool condition; int disp_val = 0; float vmin = min_val(); float vmax = max_val(); POINT mid_scr = get_centroid(); float cur_value = get_value(); RECT scrn_rect = get_location(); UINT options = get_options(); width = scrn_rect.left + scrn_rect.right; height = scrn_rect.top + scrn_rect.bottom, bottom_4 = scrn_rect.bottom / 4; // Draw the basic markings for the scale... if( huds_vert(options) ) { // Vertical scale drawOneLine( scrn_rect.left, // Bottom tick bar scrn_rect.top, width, scrn_rect.top); drawOneLine( scrn_rect.left, // Top tick bar height, width, height ); marker_xs = scrn_rect.left; marker_xe = width; if( huds_left(options) ) { // Read left, so line down right side drawOneLine( width, scrn_rect.top, width, height); marker_xs = marker_xe - scrn_rect.right / 3; // Adjust tick xs } if( huds_right(options) ) { // Read right, so down left sides drawOneLine( scrn_rect.left, scrn_rect.top, scrn_rect.left, height); marker_xe = scrn_rect.left + scrn_rect.right / 3; // Adjust tick xe } // 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. if( !huds_noticks(options)) { // If not no ticks...:) // Calculate x marker offsets int last = (int)vmax + 1; //FloatToInt(vmax)+1; i = (int)vmin; //FloatToInt(vmin); for(; i scrn_rect.left ) || (( marker_xs - 5 )< (width))){ if( huds_both(options) ) { drawOneLine( marker_xs, scrn_rect.top, marker_xs, marker_ys - 4); drawOneLine( marker_xs, marker_ye + 4, marker_xs, height); } else { if( huds_top(options) ) { drawOneLine( marker_xs, marker_ys, marker_xs, marker_ye - 4); } else { drawOneLine( marker_xs, marker_ys + 4, marker_xs, marker_ye); } } } } } if( div_max()) { if( !(i%(int)div_max()) ) { if(modulo()) { if( disp_val < 0) { while( disp_val < 0 ) { disp_val += modulo(); } } disp_val = i % (int)modulo(); } else { disp_val = i; } sprintf( TextScale, "%d", FloatToInt(disp_val * data_scaling()/* +.5*/ )); lenstr = getStringWidth( TextScale); // Draw major ticks and text only if far enough from the edge. if(( (marker_xs - 10)> scrn_rect.left ) && ( (marker_xs + 10) < width )){ if( huds_both(options) ) { drawOneLine( marker_xs, scrn_rect.top, marker_xs, marker_ys); drawOneLine( marker_xs, marker_ye, marker_xs, height); if( !huds_notext(options) ) { textString ( marker_xs - lenstr, marker_ys + 4, TextScale ,0); //suma } } else { drawOneLine( marker_xs, marker_ys, marker_xs, marker_ye ); if( !huds_notext(options) ) { if( huds_top(options) ) { textString ( marker_xs - lenstr, height - 10, TextScale, 0 ); //suma } else { textString( marker_xs - lenstr, scrn_rect.top, TextScale, 0 ); //suma } } } } } } } } } }