Diff of /trunk/src/misc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 138 by harbaum, Tue Oct 20 13:25:04 2009 UTC revision 185 by harbaum, Sat Nov 14 16:55:33 2009 UTC
# Line 151  float pos_parse_lon(char *str) { Line 151  float pos_parse_lon(char *str) {
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 */
# Line 499  GtkWidget *link_icon_button_by_id(appdat Line 505  GtkWidget *link_icon_button_by_id(appdat
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    }

Legend:
Removed from v.138  
changed lines
  Added in v.185