5 #ifdef USE_HUD_TextList
6 #define textString( x , y, text, digit ) TextString( text, x , y,digit ) //suma
8 #define textString( x , y, text, digit ) puDrawString ( guiFnt, text, x, y ); //suma
11 //======================= Top of instr_label class =========================
18 const char *label_format,
19 const char *pre_label_string,
20 const char *post_label_string,
23 fgLabelJust justification,
28 instr_item( x, y, width, height,
29 data_source, scale_data,options, working,digit), //suma
30 pformat ( label_format ),
31 pre_str ( pre_label_string ),
32 post_str ( post_label_string ),
33 justify ( justification ),
34 fontSize ( font_size ),
37 if( pre_str != NULL) {
38 if( post_str != NULL ) {
39 sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
42 sprintf( format_buffer, "%s%s", pre_str, pformat );
46 if( post_str != NULL ) {
47 sprintf( format_buffer, "%s%s", pformat, post_str );
49 } // else do nothing if both pre and post strings are nulls. Interesting.
53 // I put this in to make it easy to construct a class member using the current
57 lat_label :: ~lat_label()
62 lat_label :: lat_label( const lat_label & image) :
63 instr_item((const instr_item &)image),
64 pformat ( image.pformat ),
65 pre_str ( image.pre_str ),
66 post_str ( image.post_str ),
69 if( pre_str != NULL) {
70 if( post_str != NULL ) {
71 sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
74 sprintf( format_buffer, "%s%s", pre_str, pformat );
78 if( post_str != NULL ) {
79 sprintf( format_buffer, "%s%s", pformat, post_str );
81 } // else do nothing if both pre and post strings are nulls. Interesting.
85 lat_label & lat_label ::operator = (const lat_label & rhs )
87 if( !(this == &rhs)) {
88 instr_item::operator = (rhs);
89 pformat = rhs.pformat;
90 fontSize = rhs.fontSize;
92 justify = rhs.justify;
93 pre_str = rhs.pre_str;
94 post_str = rhs.post_str;
95 strcpy(format_buffer,rhs.format_buffer);
101 // draw Draws a label anywhere in the HUD
105 draw( void ) // Required method in base class
107 char label_buffer[80];
110 RECT scrn_rect = get_location();
111 // float lat = get_value();
113 if( data_available() ) {
114 // sprintf( label_buffer, format_buffer, coord_format_lat(lat) );
115 sprintf( label_buffer, format_buffer,
116 coord_format_lat( get_value()) );
119 sprintf( label_buffer, format_buffer );
123 fgPrintf( SG_COCKPIT, SG_DEBUG, format_buffer );
124 fgPrintf( SG_COCKPIT, SG_DEBUG, "\n" );
125 fgPrintf( SG_COCKPIT, SG_DEBUG, label_buffer );
126 fgPrintf( SG_COCKPIT, SG_DEBUG, "\n" );
129 lenstr = getStringWidth(label_buffer);
131 if( justify == RIGHT_JUST ) {
132 posincr = scrn_rect.right - lenstr;
133 }else if( justify == CENTER_JUST ) {
134 posincr = get_span() - (lenstr/2);
135 } else { // justify == LEFT_JUST
139 if( fontSize == HUD_FONT_SMALL ) {
140 textString( scrn_rect.left + posincr, scrn_rect.top,
141 label_buffer, get_digits()); //suma
144 if( fontSize == HUD_FONT_LARGE ) {
145 textString( scrn_rect.left + posincr, scrn_rect.top,
146 label_buffer, get_digits()); //suma