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 =========================
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 ),
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) {
39 sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
41 sprintf( format_buffer, "%s%s", pre_str, pformat );
43 } else if (post_str != NULL) {
44 sprintf( format_buffer, "%s%s", pformat, post_str );
45 } // else do nothing if both pre and post strings are nulls. Interesting.
50 lon_label::~lon_label()
56 lon_label::lon_label( const lon_label & image) :
57 instr_item((const instr_item &)image),
58 pformat ( image.pformat ),
59 pre_str ( image.pre_str ),
60 post_str ( image.post_str ),
63 if (pre_str != NULL) {
65 sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
67 sprintf( format_buffer, "%s%s", pre_str, pformat );
69 } else if (post_str != NULL) {
70 sprintf( format_buffer, "%s%s", pformat, post_str );
71 } // else do nothing if both pre and post strings are nulls. Interesting.
76 // draw Draws a label anywhere in the HUD
79 void lon_label::draw( void )
81 char label_buffer[80];
84 RECT scrn_rect = get_location();
85 float lon = get_value();
87 if ( data_available() ) {
88 lenstr = sprintf( label_buffer, format_buffer, coord_format_lon(lon) );
90 lenstr = sprintf( label_buffer, format_buffer );
94 fgPrintf( SG_COCKPIT, SG_DEBUG, format_buffer );
95 fgPrintf( SG_COCKPIT, SG_DEBUG, "\n" );
96 fgPrintf( SG_COCKPIT, SG_DEBUG, label_buffer );
97 fgPrintf( SG_COCKPIT, SG_DEBUG, "\n" );
100 lenstr = getStringWidth(label_buffer);
102 if (justify == RIGHT_JUST)
103 posincr = scrn_rect.right - lenstr;
104 else if (justify == CENTER_JUST)
105 posincr = get_span() - (lenstr/2);
106 else // justify == LEFT_JUST
109 if (fontSize == HUD_FONT_SMALL) {
110 textString( scrn_rect.left + posincr, scrn_rect.top,
111 label_buffer, get_digits());
113 } else if (fontSize == HUD_FONT_LARGE) {
114 textString( scrn_rect.left + posincr, scrn_rect.top,
115 label_buffer, get_digits());