151 |
|
|
152 |
const char *pos_get_bearing_str(pos_t from, pos_t to) { |
const char *pos_get_bearing_str(pos_t from, pos_t to) { |
153 |
static const char *bear_str[]={ |
static const char *bear_str[]={ |
154 |
"N", "NE", "E", "SE", "S", "SW", "W", "NW" }; |
"N", "NE", "E", "SE", "S", "SW", "W", "NW", "" }; |
155 |
int idx = (gpx_pos_get_bearing(from, to)+22.5)/45.0; |
|
156 |
/* make sure we stay in icon bounds */ |
float bearing = gpx_pos_get_bearing(from, to); |
157 |
while(idx < 0) idx += 8; |
if(!isnan(bearing)) { |
158 |
while(idx > 7) idx -= 8; |
int idx = (bearing+22.5)/45.0; |
159 |
return _(bear_str[idx]); |
/* make sure we stay in icon bounds */ |
160 |
|
while(idx < 0) idx += 8; |
161 |
|
while(idx > 7) idx -= 8; |
162 |
|
return _(bear_str[idx]); |
163 |
|
} |
164 |
|
|
165 |
|
return bear_str[8]; // empty string |
166 |
} |
} |
167 |
|
|
168 |
/* the maemo font size is quite huge, so we adjust some fonts */ |
/* the maemo font size is quite huge, so we adjust some fonts */ |
505 |
return icon; |
return icon; |
506 |
} |
} |
507 |
|
|
508 |
|
/* left aligned, word wrapped multiline widget */ |
509 |
|
GtkWidget *simple_text_widget(char *text) { |
510 |
|
GtkWidget *label = gtk_label_new(text); |
511 |
|
|
512 |
|
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
513 |
|
gtk_label_set_line_wrap_mode(GTK_LABEL(label), PANGO_WRAP_WORD); |
514 |
|
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); |
515 |
|
|
516 |
|
return label; |
517 |
|
} |