5 #ifdef USE_HUD_TextList
6 #define textString(x, y, text, digit) TextString(text, x , y ,digit)
8 #define textString(x, y, text, digit) puDrawString(guiFnt, text, x, y)
11 //======================= Top of instr_label class =========================
12 lat_label::lat_label(int x,
17 const char *label_format,
18 const char *pre_label_string,
19 const char *post_label_string,
22 fgLabelJust justification,
27 instr_item( x, y, width, height,
28 data_source, scale_data,options, working,digit),
29 pformat ( label_format ),
30 pre_str ( pre_label_string ),
31 post_str ( post_label_string ),
32 justify ( justification ),
33 fontSize ( font_size ),
36 if (pre_str != NULL) {
38 sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
40 sprintf( format_buffer, "%s%s", pre_str, pformat );
42 } else if (post_str != NULL) {
43 sprintf( format_buffer, "%s%s", pformat, post_str );
44 } // else do nothing if both pre and post strings are nulls. Interesting.
48 // I put this in to make it easy to construct a class member using the current
52 lat_label::~lat_label()
58 lat_label::lat_label( const lat_label & image) :
59 instr_item((const instr_item &)image),
60 pformat ( image.pformat ),
61 pre_str ( image.pre_str ),
62 post_str ( image.post_str ),
65 if (pre_str != NULL) {
67 sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
69 sprintf( format_buffer, "%s%s", pre_str, pformat );
71 } else if (post_str != NULL) {
72 sprintf( format_buffer, "%s%s", pformat, post_str );
73 } // else do nothing if both pre and post strings are nulls. Interesting.
79 // draw Draws a label anywhere in the HUD
82 void lat_label::draw( void ) // Required method in base class
84 char label_buffer[80];
87 RECT scrn_rect = get_location();
88 // float lat = get_value();
90 if (data_available()) {
91 // // sprintf( label_buffer, format_buffer, coord_format_lat(lat) );
92 sprintf( label_buffer, format_buffer,
93 coord_format_lat( get_value()) );
96 sprintf( label_buffer, format_buffer );
100 fgPrintf( SG_COCKPIT, SG_DEBUG, format_buffer );
101 fgPrintf( SG_COCKPIT, SG_DEBUG, "\n" );
102 fgPrintf( SG_COCKPIT, SG_DEBUG, label_buffer );
103 fgPrintf( SG_COCKPIT, SG_DEBUG, "\n" );
106 lenstr = getStringWidth(label_buffer);
108 if (justify == RIGHT_JUST)
109 posincr = scrn_rect.right - lenstr;
110 else if (justify == CENTER_JUST)
111 posincr = get_span() - (lenstr/2);
112 else // justify == LEFT_JUST
115 if (fontSize == HUD_FONT_SMALL) {
116 textString( scrn_rect.left + posincr, scrn_rect.top,
117 label_buffer, get_digits());
119 } else if (fontSize == HUD_FONT_LARGE) {
120 textString( scrn_rect.left + posincr, scrn_rect.top,
121 label_buffer, get_digits());