1
0
Fork 0

White space changes.

This commit is contained in:
curt 2001-09-20 22:10:45 +00:00
parent 1dfe83dfd4
commit f77877ffa8
3 changed files with 1518 additions and 1636 deletions

View file

@ -215,8 +215,7 @@ void drawOneLine( RECT &rect)
void textString( int x, int y, char *msg, void *font,int digit) //suma void textString( int x, int y, char *msg, void *font,int digit) //suma
{ {
if(*msg) if(*msg) {
{
// puDrawString ( NULL, msg, x, y ); // puDrawString ( NULL, msg, x, y );
glRasterPos2f(x, y); glRasterPos2f(x, y);
while (*msg) { while (*msg) {
@ -236,8 +235,7 @@ void strokeString(int x, int y, char *msg, void *font, float theta)
float sintheta,costheta; float sintheta,costheta;
if(*msg) if(*msg) {
{
glPushMatrix(); glPushMatrix();
glRotatef(theta * SGD_RADIANS_TO_DEGREES, 0.0, 0.0, 1.0); glRotatef(theta * SGD_RADIANS_TO_DEGREES, 0.0, 0.0, 1.0);
sintheta = sin(theta); sintheta = sin(theta);
@ -255,8 +253,7 @@ void strokeString(int x, int y, char *msg, void *font, float theta)
int getStringWidth ( char *str ) int getStringWidth ( char *str )
{ {
if ( HUDtext && str ) if ( HUDtext && str ) {
{
float r, l ; float r, l ;
guiFntHandle->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ; guiFntHandle->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
return FloatToInt( r - l ); return FloatToInt( r - l );
@ -369,44 +366,35 @@ readCard(const SGPropertyNode * node)
SG_LOG(SG_INPUT, SG_INFO, "Done reading instrument " << name); SG_LOG(SG_INPUT, SG_INFO, "Done reading instrument " << name);
if(type=="gauge") if(type=="gauge") {
span_units = maxValue - minValue; span_units = maxValue - minValue;
}
if(loadfn=="anzg") if (loadfn=="anzg") {
load_fn = get_anzg; load_fn = get_anzg;
else } else if (loadfn=="heading") {
if(loadfn=="heading")
load_fn = get_heading; load_fn = get_heading;
else } else if (loadfn=="aoa") {
if(loadfn=="aoa")
load_fn = get_aoa; load_fn = get_aoa;
else } else if (loadfn=="climb") {
if(loadfn=="climb")
load_fn = get_climb_rate; load_fn = get_climb_rate;
else } else if (loadfn=="altitude") {
if(loadfn=="altitude")
load_fn = get_altitude; load_fn = get_altitude;
else } else if (loadfn=="agl") {
if(loadfn=="agl")
load_fn = get_agl; load_fn = get_agl;
else } else if (loadfn=="speed") {
if(loadfn=="speed")
load_fn = get_speed; load_fn = get_speed;
else } else if (loadfn=="view_direction") {
if(loadfn=="view_direction")
load_fn = get_view_direction; load_fn = get_view_direction;
else } else if (loadfn=="aileronval") {
if(loadfn=="aileronval")
load_fn = get_aileronval; load_fn = get_aileronval;
else } else if (loadfn=="elevatorval") {
if(loadfn=="elevatorval")
load_fn = get_elevatorval; load_fn = get_elevatorval;
else } else if (loadfn=="rudderval") {
if(loadfn=="rudderval")
load_fn = get_rudderval; load_fn = get_rudderval;
else } else if (loadfn=="throttleval") {
if(loadfn=="throttleval")
load_fn = get_throttleval; load_fn = get_throttleval;
}
if ( (type == "dial") | (type == "tape") ) { if ( (type == "dial") | (type == "tape") ) {
@ -778,13 +766,10 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
path.append(hud_path); path.append(hud_path);
ifstream input(path.c_str()); ifstream input(path.c_str());
if (!input.good()) if (!input.good()) {
{
SG_LOG(SG_INPUT, SG_ALERT, SG_LOG(SG_INPUT, SG_ALERT,
"Cannot read Hud configuration from " << path.str()); "Cannot read Hud configuration from " << path.str());
} } else {
else
{
readHud(input); readHud(input);
input.close(); input.close();
} }
@ -811,8 +796,7 @@ int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ )
if (!input.good()) { if (!input.good()) {
SG_LOG(SG_INPUT, SG_ALERT, SG_LOG(SG_INPUT, SG_ALERT,
"Cannot read Hud configuration from " << path.str()); "Cannot read Hud configuration from " << path.str());
} } else {
else {
readHud(input); readHud(input);
input.close(); input.close();
} }

View file

@ -309,8 +309,7 @@ public:
int getStringWidth ( char *str ) int getStringWidth ( char *str )
{ {
if ( HUDtext && str ) if ( HUDtext && str ) {
{
float r, l ; float r, l ;
guiFntHandle->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ; guiFntHandle->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
return FloatToInt( r - l ); return FloatToInt( r - l );
@ -320,8 +319,7 @@ public:
int StringWidth (void ) int StringWidth (void )
{ {
if ( HUDtext && strlen( msg )) if ( HUDtext && strlen( msg )) {
{
float r, l ; float r, l ;
guiFntHandle->getBBox ( msg, HUD_TextSize, 0, &l, &r, NULL, NULL ) ; guiFntHandle->getBBox ( msg, HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
return FloatToInt( r - l ); return FloatToInt( r - l );
@ -339,9 +337,9 @@ public:
char *t=msg; char *t=msg;
int p=4; int p=4;
if(t[0]=='-') //if negative value then increase the c and p values for '-' sign. if(t[0]=='-') {
{ //if negative value then increase the c and p values
c++; //for '-' sign. c++;
p++; p++;
} }
char *tmp=msg; char *tmp=msg;
@ -524,7 +522,9 @@ class instr_item { // An Abstract Base Class (ABC)
UINT huds_vert (UINT options) { return( options & HUDS_VERT ); } UINT huds_vert (UINT options) { return( options & HUDS_VERT ); }
UINT huds_left (UINT options) { return( options & HUDS_LEFT ); } UINT huds_left (UINT options) { return( options & HUDS_LEFT ); }
UINT huds_right (UINT options) { return( options & HUDS_RIGHT ); } 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_noticks (UINT options) { return( options & HUDS_NOTICKS ); }
UINT huds_notext (UINT options) { return( options & HUDS_NOTEXT ); } UINT huds_notext (UINT options) { return( options & HUDS_NOTEXT ); }
UINT huds_top (UINT options) { return( options & HUDS_TOP ); } 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 ) int getStringWidth ( char *str )
{ {
if ( HUDtext && str ) if ( HUDtext && str ) {
{
float r, l ; float r, l ;
guiFntHandle->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ; guiFntHandle->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
return FloatToInt( r - l ); return FloatToInt( r - l );

View file

@ -191,8 +191,7 @@ draw( void ) // (HUD_scale * pscale )
//begin suma //begin suma
// if type=gauge then display dial // if type=gauge then display dial
if(type=="gauge") if(type=="gauge") {
{
float x,y; float x,y;
float i; float i;
int decimal, sign; int decimal, sign;
@ -202,8 +201,8 @@ draw( void ) // (HUD_scale * pscale )
glPointSize(3.0); glPointSize(3.0);
float incr= 360.0/divisions; float incr= 360.0/divisions;
for(i=0.0;i<360.0;i+=incr) for(i=0.0;i<360.0;i+=incr) {
{ float i1=i*SGD_DEGREES_TO_RADIANS; float i1=i*SGD_DEGREES_TO_RADIANS;
float x1=x+radius*cos(i1); float x1=x+radius*cos(i1);
float y1=y+radius*sin(i1); float y1=y+radius*sin(i1);
@ -215,8 +214,7 @@ draw( void ) // (HUD_scale * pscale )
glDisable(GL_POINT_SMOOTH); glDisable(GL_POINT_SMOOTH);
if(data_available()) if(data_available()) {
{
float offset = 90.0*SGD_DEGREES_TO_RADIANS; float offset = 90.0*SGD_DEGREES_TO_RADIANS;
float r1=10.0; //size of carrot float r1=10.0; //size of carrot
float theta= get_value(); float theta= get_value();
@ -245,19 +243,15 @@ draw( void ) // (HUD_scale * pscale )
} }
} //end type=gauge //end type=gauge
else // if its not explicitly a gauge default to tape } else {
{ // if its not explicitly a gauge default to tape
if(pointer) if(pointer) {
{ if(pointer_type=="moving") {
if(pointer_type=="moving")
{
vmin = minValue; vmin = minValue;
vmax = maxValue; vmax = maxValue;
} } else {
else // default to fixed // default to fixed
{
vmin = cur_value - half_width_units; // width units == needle travel vmin = cur_value - half_width_units; // width units == needle travel
vmax = cur_value + half_width_units; // or picture unit span. vmax = cur_value + half_width_units; // or picture unit span.
text_x = mid_scr.x; text_x = mid_scr.x;
@ -270,7 +264,6 @@ draw( void ) // (HUD_scale * pscale )
text_y = mid_scr.y; 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( huds_vert(options) ) { // Vertical scale
@ -325,12 +318,9 @@ draw( void ) // (HUD_scale * pscale )
// marker_xe, mid_scr.y - scrn_rect.right / 6); // marker_xe, mid_scr.y - scrn_rect.right / 6);
// draw pointer // draw pointer
if(pointer) if(pointer) {
{ if(pointer_type=="moving") {
if(pointer_type=="moving") if(zoom == 0) {
{
if(zoom == 0)
{
//Code for Moving Type Pointer included by suma. //Code for Moving Type Pointer included by suma.
static float ycentre, ypoint,xpoint; static float ycentre, ypoint,xpoint;
static int range,wth; static int range,wth;
@ -357,8 +347,8 @@ draw( void ) // (HUD_scale * pscale )
drawOneLine(xpoint-marker_offset,ypoint,xpoint-5.0,ypoint+5.0); drawOneLine(xpoint-marker_offset,ypoint,xpoint-5.0,ypoint+5.0);
drawOneLine(xpoint-marker_offset,ypoint,xpoint-5.0,ypoint-5.0); drawOneLine(xpoint-marker_offset,ypoint,xpoint-5.0,ypoint-5.0);
}//zoom=0 }//zoom=0
} else // default to fixed } else {
{ // default to fixed
fixed(marker_offset+marker_xe, text_y + scrn_rect.right / 6, fixed(marker_offset+marker_xe, text_y + scrn_rect.right / 6,
marker_offset+marker_xs, text_y,marker_offset+marker_xe, marker_offset+marker_xs, text_y,marker_offset+marker_xe,
text_y - scrn_rect.right / 6); text_y - scrn_rect.right / 6);
@ -383,12 +373,10 @@ draw( void ) // (HUD_scale * pscale )
// marker_xe, mid_scr.y); // marker_xe, mid_scr.y);
// draw pointer // draw pointer
if(pointer) if(pointer) {
{ if(pointer_type=="moving") {
if(pointer_type=="moving") if(zoom == 0) {
{ //type-fixed & zoom=1, behaviour to be defined
if(zoom == 0) //type-fixed & zoom=1, behaviour to be defined
{
// Code for Moving Type Pointer included by suma. // Code for Moving Type Pointer included by suma.
static float ycentre, ypoint,xpoint; static float ycentre, ypoint,xpoint;
static int range,wth; static int range,wth;
@ -414,9 +402,8 @@ draw( void ) // (HUD_scale * pscale )
drawOneLine(xpoint+marker_offset,ypoint,xpoint+5.0,ypoint+5.0); drawOneLine(xpoint+marker_offset,ypoint,xpoint+5.0,ypoint+5.0);
drawOneLine(xpoint+marker_offset,ypoint,xpoint+5.0,ypoint-5.0); drawOneLine(xpoint+marker_offset,ypoint,xpoint+5.0,ypoint-5.0);
} }
} } else {
else // default to fixed // default to fixed
{
fixed( -marker_offset+scrn_rect.left, text_y + scrn_rect.right / 6, fixed( -marker_offset+scrn_rect.left, text_y + scrn_rect.right / 6,
-marker_offset+marker_xe, text_y,-marker_offset+scrn_rect.left, -marker_offset+marker_xe, text_y,-marker_offset+scrn_rect.left,
text_y - scrn_rect.right / 6); text_y - scrn_rect.right / 6);
@ -440,15 +427,10 @@ draw( void ) // (HUD_scale * pscale )
last = FloatToInt(vmax)+1; last = FloatToInt(vmax)+1;
i = FloatToInt(vmin); i = FloatToInt(vmin);
if(zoom ==1) if(zoom ==1) {
{
zoomed_scale(vmin,vmax); //suma zoomed_scale(vmin,vmax); //suma
} } else {
else for( ; i <last ; i++ ) {
{
for( ; i <last ; i++ )
{
condition = true; condition = true;
if( !modulo()) { if( !modulo()) {
if( i < min_val()) { if( i < min_val()) {
@ -476,39 +458,31 @@ draw( void ) // (HUD_scale * pscale )
k = i; k = i;
// Minor ticks // Minor ticks
if( div_min()) if( div_min()) {
{
// if( (i%div_min()) == 0) { // if( (i%div_min()) == 0) {
if( !(k%(int)div_min())) if( !(k%(int)div_min())) {
{
/* if((( marker_ys - 5) > scrn_rect.top ) && /* if((( marker_ys - 5) > scrn_rect.top ) &&
(( marker_ys + 5) < (height))){ */ (( marker_ys + 5) < (height))){ */
//vertical/left OR vertical/right //vertical/left OR vertical/right
if( huds_both(options) ) if( huds_both(options) ) {
{ if(tick_type=="line") {
if(tick_type=="line") if(tick_length=="variable") {
{ drawOneLine( scrn_rect.left, marker_ys,
if(tick_length=="variable") marker_xs, marker_ys );
{ drawOneLine( marker_xe, marker_ys,
width, marker_ys );
} else {
drawOneLine( scrn_rect.left, marker_ys, drawOneLine( scrn_rect.left, marker_ys,
marker_xs, marker_ys ); marker_xs, marker_ys );
drawOneLine( marker_xe, marker_ys, drawOneLine( marker_xe, marker_ys,
width, marker_ys ); width, marker_ys );
} }
else } else if(tick_type=="circle") // begin suma this func. is written below
{
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 circles(scrn_rect.left,(float)marker_ys,3.0); //end suma
else // if neither line nor circle draw default as line else {
{ // if neither line nor circle draw default as line
drawOneLine( scrn_rect.left, marker_ys, drawOneLine( scrn_rect.left, marker_ys,
marker_xs, marker_ys ); marker_xs, marker_ys );
drawOneLine( marker_xe, marker_ys, drawOneLine( marker_xe, marker_ys,
@ -523,45 +497,33 @@ draw( void ) // (HUD_scale * pscale )
// anything other than huds_both // anything other than huds_both
} else { } else {
if( huds_left(options) ) { if( huds_left(options) ) {
if(tick_type=="line") if(tick_type=="line") {
{ if(tick_length=="variable") {
if(tick_length=="variable")
{
drawOneLine( marker_xs + 4, marker_ys, drawOneLine( marker_xs + 4, marker_ys,
marker_xe, marker_ys ); marker_xe, marker_ys );
} } else {
else
{
drawOneLine( marker_xs , marker_ys, drawOneLine( marker_xs , marker_ys,
marker_xe, marker_ys ); marker_xe, marker_ys );
} }
} } else if(tick_type=="circle") // begin suma
else if(tick_type=="circle") // begin suma
circles((float)marker_xs + 4, (float)marker_ys,3.0); //end suma circles((float)marker_xs + 4, (float)marker_ys,3.0); //end suma
else else {
{
drawOneLine( marker_xs + 4, marker_ys, drawOneLine( marker_xs + 4, marker_ys,
marker_xe, marker_ys ); marker_xe, marker_ys );
} }
} else { } else {
if(tick_type=="line") if(tick_type=="line") {
{ if(tick_length=="variable") {
if(tick_length=="variable")
{
drawOneLine( marker_xs, marker_ys, drawOneLine( marker_xs, marker_ys,
marker_xe - 4, marker_ys ); marker_xe - 4, marker_ys );
} } else {
else
{
drawOneLine( marker_xs, marker_ys, drawOneLine( marker_xs, marker_ys,
marker_xe , marker_ys ); marker_xe , marker_ys );
} }
} } else if(tick_type=="circle") //begin suma
else if(tick_type=="circle") //begin suma
circles((float)marker_xe - 4, (float)marker_ys,3.0); //end suma circles((float)marker_xe - 4, (float)marker_ys,3.0); //end suma
else else {
{
drawOneLine( marker_xs, marker_ys, drawOneLine( marker_xs, marker_ys,
marker_xe - 4, marker_ys ); marker_xe - 4, marker_ys );
} }
@ -571,8 +533,7 @@ draw( void ) // (HUD_scale * pscale )
} //end minor ticks } //end minor ticks
// Major ticks // Major ticks
if( div_max() ) if( div_max() ) {
{
if( !(k%(int)div_max()) ) { if( !(k%(int)div_max()) ) {
if(modulo()) { if(modulo()) {
@ -591,25 +552,21 @@ draw( void ) // (HUD_scale * pscale )
/* if(( (marker_ys - 8 ) > scrn_rect.top ) && /* if(( (marker_ys - 8 ) > scrn_rect.top ) &&
( (marker_ys + 8) < (height))){ */ //suma ( (marker_ys + 8) < (height))){ */ //suma
// huds_both // huds_both
if( huds_both(options) ) if( huds_both(options) ) {
{
// drawOneLine( scrn_rect.left, marker_ys, // drawOneLine( scrn_rect.left, marker_ys,
// marker_xs, marker_ys); // marker_xs, marker_ys);
// drawOneLine( marker_xs, marker_ys, // drawOneLine( marker_xs, marker_ys,
// scrn_rect.left + scrn_rect.right, // scrn_rect.left + scrn_rect.right,
// marker_ys); // marker_ys);
if(tick_type=="line") if(tick_type=="line") {
{
glBegin(GL_LINE_STRIP); glBegin(GL_LINE_STRIP);
glVertex2f( scrn_rect.left, marker_ys ); glVertex2f( scrn_rect.left, marker_ys );
glVertex2f( marker_xs, marker_ys); glVertex2f( marker_xs, marker_ys);
glVertex2f( width, marker_ys); glVertex2f( width, marker_ys);
glEnd(); glEnd();
} } else if(tick_type=="circle") //begin suma
else if(tick_type=="circle") //begin suma
circles(scrn_rect.left, (float)marker_ys,5.0); //end suma circles(scrn_rect.left, (float)marker_ys,5.0); //end suma
else else {
{
glBegin(GL_LINE_STRIP); glBegin(GL_LINE_STRIP);
glVertex2f( scrn_rect.left, marker_ys ); glVertex2f( scrn_rect.left, marker_ys );
glVertex2f( marker_xs, marker_ys); glVertex2f( marker_xs, marker_ys);
@ -621,32 +578,23 @@ draw( void ) // (HUD_scale * pscale )
textString ( marker_xs + 2, marker_ys, textString ( marker_xs + 2, marker_ys,
TextScale, GLUT_BITMAP_8_BY_13,0 ); TextScale, GLUT_BITMAP_8_BY_13,0 );
} }
} } else {
//begin suma //begin suma
/* Changes are made to draw a circle when tick_type="circle" */ /* Changes are made to draw a circle when tick_type="circle" */
// anything other than huds_both // anything other than huds_both
else if(tick_type=="line") {
{
if(tick_type=="line")
{
drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys ); drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
} } else if(tick_type=="circle")
else if(tick_type=="circle")
circles((float)marker_xs + 4, (float)marker_ys,5.0);//end suma circles((float)marker_xs + 4, (float)marker_ys,5.0);//end suma
else else {
{
drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys ); drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
} }
if( !huds_notext(options) ) if( !huds_notext(options) ) {
{ if( huds_left(options) ) {
if( huds_left(options) )
{
textString( marker_xs - 8 * lenstr - 2, textString( marker_xs - 8 * lenstr - 2,
marker_ys - 4, marker_ys - 4,
TextScale, GLUT_BITMAP_8_BY_13,0 ); TextScale, GLUT_BITMAP_8_BY_13,0 );
} } else {
else
{
textString( marker_xe + 3 * lenstr, textString( marker_xe + 3 * lenstr,
marker_ys - 4, marker_ys - 4,
TextScale, GLUT_BITMAP_8_BY_13,0 ); TextScale, GLUT_BITMAP_8_BY_13,0 );
@ -658,8 +606,9 @@ draw( void ) // (HUD_scale * pscale )
} // End condition } // End condition
} // End for } // End for
} //end of zoom } //end of zoom
} // End if VERTICAL SCALE TYPE (tape loop yet to be closed) // End if VERTICAL SCALE TYPE (tape loop yet to be closed)
else { // Horizontal scale by default } else {
// Horizontal scale by default
// left tick bar // left tick bar
if (draw_tick_left) { if (draw_tick_left) {
drawOneLine( scrn_rect.left, scrn_rect.top, drawOneLine( scrn_rect.left, scrn_rect.top,
@ -705,12 +654,9 @@ draw( void ) // (HUD_scale * pscale )
// drawOneLine( mid_scr.x, marker_ye, // drawOneLine( mid_scr.x, marker_ye,
// mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top); // mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
// draw pointer // draw pointer
if(pointer) if(pointer) {
{ if(pointer_type=="moving") {
if(pointer_type=="moving") if (zoom ==0) {
{
if (zoom ==0)
{
//Code for Moving Type Pointer included by suma. //Code for Moving Type Pointer included by suma.
static float xcentre,xpoint,ypoint; static float xcentre,xpoint,ypoint;
static int range; static int range;
@ -725,9 +671,8 @@ draw( void ) // (HUD_scale * pscale )
drawOneLine(xpoint,ypoint+marker_offset,xpoint+5.0,ypoint+5.0); drawOneLine(xpoint,ypoint+marker_offset,xpoint+5.0,ypoint+5.0);
drawOneLine(xpoint,ypoint+marker_offset,xpoint-5.0,ypoint+5.0); drawOneLine(xpoint,ypoint+marker_offset,xpoint-5.0,ypoint+5.0);
} }
} } else {
else //default to fixed //default to fixed
{
fixed( marker_xs - scrn_rect.bottom / 4, scrn_rect.top, fixed( marker_xs - scrn_rect.bottom / 4, scrn_rect.top,
marker_xs, marker_ye, marker_xs + scrn_rect.bottom / 4,scrn_rect.top); marker_xs, marker_ye, marker_xs + scrn_rect.bottom / 4,scrn_rect.top);
} }
@ -752,12 +697,9 @@ draw( void ) // (HUD_scale * pscale )
// mid_scr.x , marker_ys ); // mid_scr.x , marker_ys );
// draw pointer // draw pointer
if(pointer) if(pointer) {
{ if(pointer_type=="moving") {
if(pointer_type=="moving") if(zoom == 0) {
{
if(zoom == 0)
{
//Code for Moving Type Pointer included by suma. //Code for Moving Type Pointer included by suma.
static float xcentre,xpoint,ypoint; static float xcentre,xpoint,ypoint;
static int range,hgt; static int range,hgt;
@ -773,9 +715,7 @@ draw( void ) // (HUD_scale * pscale )
drawOneLine(xpoint,ypoint-marker_offset,xpoint+5.0,ypoint-5.0); drawOneLine(xpoint,ypoint-marker_offset,xpoint+5.0,ypoint-5.0);
drawOneLine(xpoint,ypoint-marker_offset,xpoint-5.0,ypoint-5.0); drawOneLine(xpoint,ypoint-marker_offset,xpoint-5.0,ypoint-5.0);
} }
} } else {
else
{
fixed( marker_xs + scrn_rect.bottom / 4, height, marker_xs, marker_ys, fixed( marker_xs + scrn_rect.bottom / 4, height, marker_xs, marker_ys,
marker_xs - scrn_rect.bottom / 4, height); marker_xs - scrn_rect.bottom / 4, height);
} }
@ -793,13 +733,10 @@ draw( void ) // (HUD_scale * pscale )
// last = FloatToInt(vmax)+1; // last = FloatToInt(vmax)+1;
// i = FloatToInt(vmin); // i = FloatToInt(vmin);
if(zoom ==1) if(zoom ==1) {
{
zoomed_scale(vmin,vmax); //suma zoomed_scale(vmin,vmax); //suma
} } else {
else //default to zoom=0 //default to zoom=0
{
last = (int)vmax + 1; last = (int)vmax + 1;
i = (int)vmin; i = (int)vmin;
for(; i <last ; i++ ) { for(; i <last ; i++ ) {
@ -829,17 +766,13 @@ draw( void ) // (HUD_scale * pscale )
/*if((( marker_xs - 5) > scrn_rect.left ) && /*if((( marker_xs - 5) > scrn_rect.left ) &&
(( marker_xs + 5 )< (scrn_rect.left + scrn_rect.right))){ */ //suma (( marker_xs + 5 )< (scrn_rect.left + scrn_rect.right))){ */ //suma
if( huds_both(options) ) if( huds_both(options) ) {
{ if(tick_length=="variable") {
if(tick_length=="variable")
{
drawOneLine( marker_xs, scrn_rect.top, drawOneLine( marker_xs, scrn_rect.top,
marker_xs, marker_ys - 4); marker_xs, marker_ys - 4);
drawOneLine( marker_xs, marker_ye + 4, drawOneLine( marker_xs, marker_ye + 4,
marker_xs, height); marker_xs, height);
} } else {
else
{
drawOneLine( marker_xs, scrn_rect.top, drawOneLine( marker_xs, scrn_rect.top,
marker_xs, marker_ys); marker_xs, marker_ys);
drawOneLine( marker_xs, marker_ye, drawOneLine( marker_xs, marker_ye,
@ -852,8 +785,8 @@ draw( void ) // (HUD_scale * pscale )
// glVertex2f( marker_xs, scrn_rect.top + scrn_rect.bottom); // glVertex2f( marker_xs, scrn_rect.top + scrn_rect.bottom);
// glEnd(); // glEnd();
} else { } else {
if( huds_top(options)) if( huds_top(options)) {
{ //draw minor ticks //draw minor ticks
if(tick_length=="variable") if(tick_length=="variable")
drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye-4); drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye-4);
else else
@ -976,10 +909,8 @@ zoomed_scale(int first, int last)
int a=0; int a=0;
while(first <= last) while(first <= last) {
{ if((first % (int)Maj_div) == 0) {
if((first % (int)Maj_div) == 0)
{
data[a] = first; data[a] = first;
a++ ; a++ ;
} }
@ -988,8 +919,7 @@ zoomed_scale(int first, int last)
int centre =a/2; int centre =a/2;
if( huds_vert(options) ) if( huds_vert(options) ) {
{
x=scrn_rect.left; x=scrn_rect.left;
y=scrn_rect.top; y=scrn_rect.top;
@ -1024,20 +954,17 @@ zoomed_scale(int first, int last)
wth=scrn_rect.left+scrn_rect.right; wth=scrn_rect.left+scrn_rect.right;
if(cur_value <= data[centre+1]) if(cur_value <= data[centre+1])
if(cur_value > data[centre]) if(cur_value > data[centre]) {
{
ypoint = ycent + ((cur_value - data[centre]) * hgt/Maj_div); ypoint = ycent + ((cur_value - data[centre]) * hgt/Maj_div);
} }
if(cur_value >= data[centre-1]) if(cur_value >= data[centre-1])
if(cur_value <= data[centre]) if(cur_value <= data[centre]) {
{
ypoint = ycent - ((data[centre]-cur_value) * hgt/Maj_div); ypoint = ycent - ((data[centre]-cur_value) * hgt/Maj_div);
} }
if(cur_value < data[centre-1]) if(cur_value < data[centre-1])
if(cur_value >= minValue) if(cur_value >= minValue) {
{
float diff = minValue - data[centre-1]; float diff = minValue - data[centre-1];
float diff1 = cur_value - data[centre-1]; float diff1 = cur_value - data[centre-1];
float val = (diff1 * hgt1) / diff; float val = (diff1 * hgt1) / diff;
@ -1047,8 +974,7 @@ zoomed_scale(int first, int last)
if(cur_value > data[centre+1]) if(cur_value > data[centre+1])
if(cur_value <= maxValue) if(cur_value <= maxValue) {
{
float diff = maxValue - data[centre+1]; float diff = maxValue - data[centre+1];
float diff1 = cur_value - data[centre+1]; float diff1 = cur_value - data[centre+1];
float val = (diff1 * hgt1) / diff; float val = (diff1 * hgt1) / diff;
@ -1056,21 +982,18 @@ zoomed_scale(int first, int last)
ypoint = ycent + hgt + val; ypoint = ycent + hgt + val;
} }
if(huds_left(options)) if(huds_left(options)) {
{
xstart = w; xstart = w;
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)) if( !huds_notext(options)) {
{
textString (x, ycentre, TextScale, GLUT_BITMAP_8_BY_13,0 ); textString (x, ycentre, TextScale, GLUT_BITMAP_8_BY_13,0 );
} }
for(i=1;i<5;i++) for(i=1;i<5;i++) {
{
yfirst += factor; yfirst += factor;
ycentre += factor; ycentre += factor;
circles(xstart-2.5,yfirst, 3.0); circles(xstart-2.5,yfirst, 3.0);
@ -1079,8 +1002,7 @@ zoomed_scale(int first, int last)
yfirst = mid_scr.y - hgt; yfirst = mid_scr.y - hgt;
for(i=0;i<=incr;i++) for(i=0;i<=incr;i++) {
{
drawOneLine( xstart, yfirst, xstart - 5.0, yfirst); drawOneLine( xstart, yfirst, xstart - 5.0, yfirst);
drawOneLine( xstart,ysecond, xstart - 5.0,ysecond); drawOneLine( xstart,ysecond, xstart - 5.0,ysecond);
@ -1103,8 +1025,7 @@ zoomed_scale(int first, int last)
//begin //begin
xpoint = wth + 10.0; xpoint = wth + 10.0;
if(pointer_type == "moving") if(pointer_type == "moving") {
{
drawOneLine(xpoint,ycent,xpoint,ypoint); drawOneLine(xpoint,ycent,xpoint,ypoint);
drawOneLine(xpoint,ypoint,xpoint-10.0,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);
@ -1112,23 +1033,19 @@ zoomed_scale(int first, int last)
} }
//end //end
} } else {
else //huds_right //huds_right
{
xstart = (x+w)/2; 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)) if( !huds_notext(options)) {
{
textString (w, ycentre, TextScale, GLUT_BITMAP_8_BY_13,0 ); textString (w, ycentre, TextScale, GLUT_BITMAP_8_BY_13,0 );
} }
for(i=1;i<5;i++) for(i=1;i<5;i++) {
{
yfirst += factor; yfirst += factor;
ycentre += factor; ycentre += factor;
circles(xstart+2.5,yfirst, 3.0); circles(xstart+2.5,yfirst, 3.0);
@ -1137,8 +1054,7 @@ zoomed_scale(int first, int last)
yfirst = mid_scr.y - hgt; yfirst = mid_scr.y - hgt;
for(i=0;i<=incr;i++) for(i=0;i<=incr;i++) {
{
drawOneLine( xstart, yfirst, xstart + 5.0, yfirst); drawOneLine( xstart, yfirst, xstart + 5.0, yfirst);
drawOneLine( xstart,ysecond, xstart + 5.0,ysecond); drawOneLine( xstart,ysecond, xstart + 5.0,ysecond);
@ -1161,8 +1077,7 @@ zoomed_scale(int first, int last)
//begin //begin
xpoint = scrn_rect.left; xpoint = scrn_rect.left;
if(pointer_type == "moving") if(pointer_type == "moving") {
{
drawOneLine(xpoint,ycent,xpoint,ypoint); drawOneLine(xpoint,ycent,xpoint,ypoint);
drawOneLine(xpoint,ypoint,xpoint+10.0,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);
@ -1170,9 +1085,9 @@ zoomed_scale(int first, int last)
} }
//end //end
}//end huds_right /left }//end huds_right /left
} //end of vertical scale //end of vertical scale
else //horizontal scale } else {
{ //horizontal scale
x=scrn_rect.left; x=scrn_rect.left;
y=scrn_rect.top; y=scrn_rect.top;
w=scrn_rect.left+scrn_rect.right; w=scrn_rect.left+scrn_rect.right;
@ -1203,20 +1118,17 @@ zoomed_scale(int first, int last)
xcent = mid_scr.x; xcent = mid_scr.x;
if(cur_value <= data[centre+1]) if(cur_value <= data[centre+1])
if(cur_value > data[centre]) if(cur_value > data[centre]) {
{
xpoint = xcent + ((cur_value - data[centre]) * hgt/Maj_div); xpoint = xcent + ((cur_value - data[centre]) * hgt/Maj_div);
} }
if(cur_value >= data[centre-1]) if(cur_value >= data[centre-1])
if(cur_value <= data[centre]) if(cur_value <= data[centre]) {
{
xpoint = xcent - ((data[centre]-cur_value) * hgt/Maj_div); xpoint = xcent - ((data[centre]-cur_value) * hgt/Maj_div);
} }
if(cur_value < data[centre-1]) if(cur_value < data[centre-1])
if(cur_value >= minValue) if(cur_value >= minValue) {
{
float diff = minValue - data[centre-1]; float diff = minValue - data[centre-1];
float diff1 = cur_value - data[centre-1]; float diff1 = cur_value - data[centre-1];
float val = (diff1 * hgt1) / diff; float val = (diff1 * hgt1) / diff;
@ -1226,8 +1138,7 @@ zoomed_scale(int first, int last)
if(cur_value > data[centre+1]) if(cur_value > data[centre+1])
if(cur_value <= maxValue) if(cur_value <= maxValue) {
{
float diff = maxValue - data[centre+1]; float diff = maxValue - data[centre+1];
float diff1 = cur_value - data[centre+1]; float diff1 = cur_value - data[centre+1];
float val = (diff1 * hgt1) / diff; float val = (diff1 * hgt1) / diff;
@ -1236,8 +1147,7 @@ zoomed_scale(int first, int last)
} }
//end //end
if(huds_top(options)) if(huds_top(options)) {
{
ystart =h; ystart =h;
@ -1245,13 +1155,11 @@ zoomed_scale(int first, int last)
sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling())); sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
if( !huds_notext(options)) if( !huds_notext(options)) {
{
textString (xcentre-10.0, y, TextScale, GLUT_BITMAP_8_BY_13,0 ); textString (xcentre-10.0, y, TextScale, GLUT_BITMAP_8_BY_13,0 );
} }
for(i=1;i<5;i++) for(i=1;i<5;i++) {
{
xfirst += factor; xfirst += factor;
xcentre += factor; xcentre += factor;
circles(xfirst, ystart-2.5, 3.0); circles(xfirst, ystart-2.5, 3.0);
@ -1260,8 +1168,7 @@ zoomed_scale(int first, int last)
xfirst = mid_scr.x - hgt; xfirst = mid_scr.x - hgt;
for(i=0;i<=incr;i++) for(i=0;i<=incr;i++) {
{
drawOneLine( xfirst, ystart, xfirst, ystart - 5.0); drawOneLine( xfirst, ystart, xfirst, ystart - 5.0);
drawOneLine( xsecond, ystart, xsecond, ystart - 5.0); drawOneLine( xsecond, ystart, xsecond, ystart - 5.0);
@ -1285,19 +1192,15 @@ zoomed_scale(int first, int last)
ypoint = scrn_rect.top + scrn_rect.bottom + 10.0; ypoint = scrn_rect.top + scrn_rect.bottom + 10.0;
if(pointer_type == "moving") if(pointer_type == "moving") {
{
drawOneLine(xcent, ypoint,xpoint,ypoint); drawOneLine(xcent, ypoint,xpoint,ypoint);
drawOneLine(xpoint,ypoint,xpoint,ypoint-10.0); 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);
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 {
} //end of top option //else huds_bottom
else //else huds_bottom
{
ystart = (y+h)/2; ystart = (y+h)/2;
//drawOneLine( xstart, yfirst, xstart - 5.0, yfirst ); //drawOneLine( xstart, yfirst, xstart - 5.0, yfirst );
@ -1305,13 +1208,11 @@ zoomed_scale(int first, int last)
sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling())); sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
if( !huds_notext(options)) if( !huds_notext(options)) {
{
textString (xcentre-10.0, h, TextScale, GLUT_BITMAP_8_BY_13,0 ); textString (xcentre-10.0, h, TextScale, GLUT_BITMAP_8_BY_13,0 );
} }
for(i=1;i<5;i++) for(i=1;i<5;i++) {
{
xfirst += factor; xfirst += factor;
xcentre += factor; xcentre += factor;
circles(xfirst, ystart+2.5, 3.0); circles(xfirst, ystart+2.5, 3.0);
@ -1320,8 +1221,7 @@ zoomed_scale(int first, int last)
xfirst = mid_scr.x - hgt; xfirst = mid_scr.x - hgt;
for(i=0;i<=incr;i++) for(i=0;i<=incr;i++) {
{
drawOneLine( xfirst, ystart, xfirst, ystart + 5.0); drawOneLine( xfirst, ystart, xfirst, ystart + 5.0);
drawOneLine( xsecond,ystart, xsecond,ystart + 5.0); drawOneLine( xsecond,ystart, xsecond,ystart + 5.0);
@ -1344,8 +1244,7 @@ zoomed_scale(int first, int last)
//begin //begin
ypoint = scrn_rect.top - 10.0; ypoint = scrn_rect.top - 10.0;
if(pointer_type == "moving") if(pointer_type == "moving") {
{
drawOneLine(xcent, ypoint,xpoint,ypoint); drawOneLine(xcent, ypoint,xpoint,ypoint);
drawOneLine(xpoint,ypoint,xpoint,ypoint+10.0); 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);