Diff of /trunk/src/goto.c

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

revision 229 by harbaum, Fri Dec 4 19:58:26 2009 UTC revision 288 by harbaum, Mon Jun 7 19:19:50 2010 UTC
# Line 38  Line 38 
38  #define SAT_WIDTH 330  #define SAT_WIDTH 330
39  #define SAT_HEIGHT 60  #define SAT_HEIGHT 60
40    
41  /* http://www.gtk.org/tutorial1.2/gtk_tut-30.html */  #ifdef ESPEAK
42  /* http://developer.gimp.org/api/2.0/gdk/gdk-Drawing-Primitives.html */  #include <espeak/speak_lib.h>
43    
44    #define ESPEAK_TIMEOUT (15000)   // every 15 seconds
45    
46    char *espeak_make_string(float dist, gboolean imperial) {
47      char *retval = NULL;
48    
49      if(!imperial) {
50        /* distance is in kilometers */
51        if(dist < 2.0/1000.0)
52          retval = g_strdup(_("1 meter"));
53        else if(dist < 1.0)
54          retval = g_strdup_printf(_("%u meters"), (int)(dist*1000));
55        else if(dist < 2.0)
56          retval = g_strdup(_("1 kilometer"));
57        else
58          retval = g_strdup_printf(_("%u kilometers"), (int)dist);
59      } else {
60    
61        /* 1 mil = 1760 yd = 5280 ft ... */
62        if(dist < (2.0/5280.0))
63          retval = g_strdup(_("1 foot"));
64        else if(dist < (1.0/1760.0))
65          retval = g_strdup_printf(_("%u feet"), (int)(dist*5280));
66        else if(dist < (2.0/1760.0))
67          retval = g_strdup(_("1 yard"));
68        else if(dist < 1.0)
69          retval = g_strdup_printf(_("%u yard"), (int)(dist*1760));
70        else if(dist < 2.0)
71          retval = g_strdup(_("1 mile"));
72        else
73          retval = g_strdup_printf(_("%u miles"), (int)dist);
74      }
75      return retval;
76    }
77    
78    static gboolean espeak_do(gpointer data) {
79      cache_context_t *context = (cache_context_t*)data;
80    
81      pos_t *pos = gps_get_pos(context->appdata);
82      if(pos && !isnan(pos->lat) && !isnan(pos->lon) &&
83         !isnan(context->gotoc.pos.lat) && !isnan(context->gotoc.pos.lon)) {
84    
85        /* build distance */
86        float dist =
87          gpx_pos_get_distance(*pos, context->gotoc.pos,
88                               context->appdata->imperial);
89    
90        char *talk = espeak_make_string(dist, context->appdata->imperial);
91    
92        unsigned int unique_identifier=0;
93        espeak_Synth(talk, strlen(talk)+1, 0, 0, 0, espeakCHARS_AUTO,
94                     &unique_identifier, NULL);
95    
96        g_free(talk);
97      }
98    
99      return TRUE;  // speak again
100    }
101    
102    static void espeak_enable(cache_context_t *context, gboolean enable) {
103      if(enable) {
104        g_assert(!context->gotoc.espeak_handler);
105    
106        context->gotoc.espeak_handler =
107          gtk_timeout_add(ESPEAK_TIMEOUT, espeak_do, context);
108    
109        espeak_do(context);
110    
111      } else {
112        if(context->gotoc.espeak_handler) {
113          gtk_timeout_remove(context->gotoc.espeak_handler);
114          context->gotoc.espeak_handler = 0;
115        }
116      }
117    }
118    #endif
119    
120  static float rad2deg(float rad) {  static float rad2deg(float rad) {
121    return fmodf(360.0 + (180.0/M_PI) * rad, 360.0);    return fmodf(360.0 + (180.0/M_PI) * rad, 360.0);
# Line 50  static void compass_draw(GtkWidget *widg Line 125  static void compass_draw(GtkWidget *widg
125    float f;    float f;
126    int i;    int i;
127    
128      cairo_t *cr = gdk_cairo_create(context->gotoc.compass_pixmap);
129    
130    gint width = widget->allocation.width;    gint width = widget->allocation.width;
131    gint height = widget->allocation.height;    gint height = widget->allocation.height;
132    gint diameter = (height < width)?height:width;    gint diameter = (height < width)?height:width;
# Line 70  static void compass_draw(GtkWidget *widg Line 147  static void compass_draw(GtkWidget *widg
147       widget->style->bg[GTK_STATE_NORMAL].green +       widget->style->bg[GTK_STATE_NORMAL].green +
148       widget->style->bg[GTK_STATE_NORMAL].blue < 3*60000) {       widget->style->bg[GTK_STATE_NORMAL].blue < 3*60000) {
149      /* background is very bright, use white */      /* background is very bright, use white */
150      gdk_draw_arc(context->gotoc.compass_pixmap, widget->style->white_gc, TRUE,      cairo_set_source_rgb(cr, 1, 1, 1);
151                   (width-diameter)/2, (height-diameter)/2, diameter, diameter,    } else
152                   0, 360*64);      cairo_set_source_rgb(cr, 0.87, 0.87, 0.87);
153    } else {  
154      GdkGC *lgrey_gc = gdk_gc_new(context->gotoc.compass_pixmap);    cairo_arc(cr, width/2, height/2, diameter/2, 0, 2 * M_PI);
155      gdk_gc_copy(lgrey_gc, widget->style->black_gc);    cairo_fill(cr);
     GdkColor lgrey_color;  
     gdk_color_parse("#DDDDDD", &lgrey_color);  
     gdk_gc_set_rgb_fg_color(lgrey_gc,  &lgrey_color);  
   
     gdk_draw_arc(context->gotoc.compass_pixmap, lgrey_gc, TRUE,  
                  (width-diameter)/2, (height-diameter)/2, diameter, diameter,  
                  0, 360*64);  
   }  
156    
157    /* draw the locked/unlocked icon */    /* draw the locked/unlocked icon */
158    gdk_draw_pixbuf(context->gotoc.compass_pixmap,    gdk_draw_pixbuf(context->gotoc.compass_pixmap,
159                    widget->style->fg_gc[GTK_STATE_NORMAL],                    widget->style->fg_gc[GTK_STATE_NORMAL],
160                    icon_get(ICON_MISC, context->appdata->compass_locked?1:2),                    icon_get(ICON_MISC, context->appdata->compass_locked?0:1),
161                    0, 0, (width-diameter)/2 + diameter/32,                    0, 0, (width-diameter)/2 + diameter/32,
162                    (height+diameter)/2 - 16 - diameter/32 , 16, 16,                    (height+diameter)/2 - 16 - diameter/32 , 16, 16,
163                    GDK_RGB_DITHER_NONE,0,0);                    GDK_RGB_DITHER_NONE,0,0);
# Line 135  static void compass_draw(GtkWidget *widg Line 204  static void compass_draw(GtkWidget *widg
204    
205    if(!isnan(context->gotoc.heading)) {    if(!isnan(context->gotoc.heading)) {
206    
207        /* --------------------------- draw sun ---------------------- */
208        float sun_az = astro_get_sun_azimuth(context->appdata);
209        if(!isnan(sun_az)) {
210          float sang = sun_az - context->gotoc.heading;
211    
212          cairo_set_source_rgb(cr, 1.0, 0.8, 0.0);
213    
214          int sd = diameter/6;
215          int sx = xcenter + (diameter/2 - sd/2) * sin(sang);
216          int sy = ycenter - (diameter/2 - sd/2) * cos(sang);
217    
218          int scd = 0.6*sd;
219    
220          cairo_arc (cr, sx, sy, scd/2, 0, 2 * M_PI);
221          cairo_fill(cr);
222    
223          /* draw sun rays */
224          for(f=0;f<2*M_PI-M_PI/8;f+=M_PI/4) {
225            float ang = f - context->gotoc.heading;
226    
227            cairo_move_to(cr, sx + sd *  0.5 *  sin(ang),
228                              sy + sd *  0.5 * -cos(ang));
229    
230            cairo_line_to(cr, sx + sd *  0.2 *  sin(ang+0.5),
231                              sy + sd *  0.2 * -cos(ang+0.5));
232    
233            cairo_line_to(cr, sx + sd *  0.2 *  sin(ang-0.5),
234                              sy + sd *  0.2 * -cos(ang-0.5));
235    
236            cairo_close_path (cr);
237            cairo_fill(cr);
238          }
239        }
240    
241        /* ---------------- draw markers -------------------- */
242        cairo_set_source_rgb(cr, 0, 0, 0);
243    
244      for(i=0,f=0;f<2*M_PI-M_PI/8;f+=M_PI/4,i++) {      for(i=0,f=0;f<2*M_PI-M_PI/8;f+=M_PI/4,i++) {
245        float ang = f - context->gotoc.heading;        float ang = f - context->gotoc.heading;
246    
247        if(!(i&1)) {        if(!(i&1)) {
         /* draw diamonds */  
         GdkPoint diamond[4];  
   
248  #define OUT  (1.0-LETTER_SPACE)  #define OUT  (1.0-LETTER_SPACE)
249    
250          diamond[0].x = xcenter + radius * OUT *  sin(ang);          cairo_move_to(cr, xcenter + radius * OUT *  sin(ang),
251          diamond[0].y = ycenter + radius * OUT * -cos(ang);                            ycenter + radius * OUT * -cos(ang));
252    
253            cairo_line_to(cr, xcenter + radius * (OUT-DIAMOND_HEIGHT/2) *
254                                         sin(ang+DIAMOND_WIDTH),
255                              ycenter + radius * (OUT-DIAMOND_HEIGHT/2)*
256                                        -cos(ang+DIAMOND_WIDTH));
257    
258          diamond[1].x = xcenter + radius * (OUT-DIAMOND_HEIGHT/2) *          cairo_line_to(cr, xcenter + radius * (OUT-DIAMOND_HEIGHT) *  sin(ang),
259            sin(ang+DIAMOND_WIDTH);                            ycenter + radius * (OUT-DIAMOND_HEIGHT) * -cos(ang));
260          diamond[1].y = ycenter + radius * (OUT-DIAMOND_HEIGHT/2)*  
261            -cos(ang+DIAMOND_WIDTH);          cairo_line_to(cr, xcenter + radius * (OUT-DIAMOND_HEIGHT/2) *
262                                         sin(ang-DIAMOND_WIDTH),
263          diamond[2].x = xcenter + radius * (OUT-DIAMOND_HEIGHT) *  sin(ang);                            ycenter + radius * (OUT-DIAMOND_HEIGHT/2) *
264          diamond[2].y = ycenter + radius * (OUT-DIAMOND_HEIGHT) * -cos(ang);                                      -cos(ang-DIAMOND_WIDTH));
265    
266          diamond[3].x = xcenter + radius * (OUT-DIAMOND_HEIGHT/2) *          cairo_close_path (cr);
267            sin(ang-DIAMOND_WIDTH);          cairo_fill(cr);
         diamond[3].y = ycenter + radius * (OUT-DIAMOND_HEIGHT/2) *  
           -cos(ang-DIAMOND_WIDTH);  
   
         gdk_draw_polygon(context->gotoc.compass_pixmap,  
                          widget->style->black_gc, TRUE,  
                          diamond, sizeof(diamond)/sizeof(GdkPoint));  
268    
269          const char *str[] = { "N", "E", "S", "W" };          const char *str[] = { "N", "E", "S", "W" };
270          PangoLayout *layout = gtk_widget_create_pango_layout(widget, _(str[i/2]));          PangoLayout *layout =
271              gtk_widget_create_pango_layout(widget, _(str[i/2]));
272          int tw, th;          int tw, th;
273          pango_layout_get_pixel_size(layout, &tw, &th);          pango_layout_get_pixel_size(layout, &tw, &th);
274    
# Line 175  static void compass_draw(GtkWidget *widg Line 278  static void compass_draw(GtkWidget *widg
278                  layout);                  layout);
279    
280          g_object_unref(layout);          g_object_unref(layout);
281        } else        } else {
282          gdk_draw_line(context->gotoc.compass_pixmap, widget->style->black_gc,          cairo_move_to(cr, xcenter + radius * 0.9 *  sin(ang),
283                        xcenter + radius * 0.9 *  sin(ang),                            ycenter + radius * 0.9 * -cos(ang));
284                        ycenter + radius * 0.9 * -cos(ang),  
285                        xcenter + radius * 1.0 *  sin(ang),          cairo_line_to(cr, xcenter + radius * 1.0 *  sin(ang),
286                        ycenter + radius * 1.0 * -cos(ang));                            ycenter + radius * 1.0 * -cos(ang));
287    
288            cairo_stroke(cr);
289          }
290      }      }
291    
292      /* draw arrow */      /* --------------------------- draw arrow ---------------------- */
   
     /* setup required colors */  
     GdkGC *arrow_gc = gdk_gc_new(context->gotoc.compass_pixmap);  
     gdk_gc_copy(arrow_gc, widget->style->black_gc);  
     GdkColor arrow_color;  
     gdk_color_parse("#800000", &arrow_color);  
     gdk_gc_set_rgb_fg_color(arrow_gc,  &arrow_color);  
   
     GdkPoint arrow[4];  
293    
294      pos_t *pos = gps_get_pos(context->appdata);      pos_t *pos = gps_get_pos(context->appdata);
295      if(pos && !isnan(pos->lat) && !isnan(pos->lon)) {      if(pos && !isnan(pos->lat) && !isnan(pos->lon)) {
296        context->appdata->gps = *pos;   /* save position */        context->appdata->gps.saved = *pos;   /* save position */
297    
298        float arot =        float arot =
299          gpx_pos_get_bearing(*pos, context->gotoc.pos) *          gpx_pos_get_bearing(*pos, context->gotoc.pos) *
300          M_PI/180 - context->gotoc.heading;          M_PI/180 - context->gotoc.heading;
301    
302        arrow[0].x = xcenter + radius *  ARROW_LENGTH *  sin(arot);        cairo_move_to(cr, xcenter + radius *  ARROW_LENGTH *  sin(arot),
303        arrow[0].y = ycenter + radius *  ARROW_LENGTH * -cos(arot);                          ycenter + radius *  ARROW_LENGTH * -cos(arot));
304    
305        arrow[1].x = xcenter + radius * -ARROW_LENGTH *  sin(arot+ARROW_WIDTH);        cairo_line_to(cr, xcenter + radius * -ARROW_LENGTH *  sin(arot+ARROW_WIDTH),
306        arrow[1].y = ycenter + radius * -ARROW_LENGTH * -cos(arot+ARROW_WIDTH);                          ycenter + radius * -ARROW_LENGTH * -cos(arot+ARROW_WIDTH));
307    
308        arrow[2].x = xcenter + radius * -0.5 * ARROW_LENGTH *  sin(arot);        cairo_line_to(cr, xcenter + radius * -0.5 * ARROW_LENGTH *  sin(arot),
309        arrow[2].y = ycenter + radius * -0.5 * ARROW_LENGTH * -cos(arot);                          ycenter + radius * -0.5 * ARROW_LENGTH * -cos(arot));
310    
311        arrow[3].x = xcenter + radius * -ARROW_LENGTH *  sin(arot-ARROW_WIDTH);        cairo_line_to(cr, xcenter + radius * -ARROW_LENGTH *  sin(arot-ARROW_WIDTH),
312        arrow[3].y = ycenter + radius * -ARROW_LENGTH * -cos(arot-ARROW_WIDTH);                          ycenter + radius * -ARROW_LENGTH * -cos(arot-ARROW_WIDTH));
313    
314        gdk_draw_polygon(context->gotoc.compass_pixmap, arrow_gc, TRUE,        cairo_set_source_rgb(cr, 0.5, 0.0, 0.0);
315                         arrow, sizeof(arrow)/sizeof(GdkPoint));        cairo_close_path (cr);
316          cairo_fill(cr);
317    
318      } else {      } else {
319        PangoLayout *layout;        PangoLayout *layout;
320    
# Line 233  static void compass_draw(GtkWidget *widg Line 332  static void compass_draw(GtkWidget *widg
332        g_object_unref(layout);        g_object_unref(layout);
333      }      }
334    }    }
335      cairo_destroy(cr);
336  }  }
337    
338  /* Create a new backing pixmap of the appropriate size */  /* Create a new backing pixmap of the appropriate size */
# Line 278  static void sat_draw(GtkWidget *widget, Line 378  static void sat_draw(GtkWidget *widget,
378                       0, 0, width, height);                       0, 0, width, height);
379    
380    gps_sat_t *sat = gps_get_sats(context->appdata);    gps_sat_t *sat = gps_get_sats(context->appdata);
381    if(sat && sat->num) {    gint sat_num = gps_get_satnum(context->appdata);
382    
383      if(sat && sat_num) {
384      /* setup required colors */      /* setup required colors */
385      GdkGC *used_gc = gdk_gc_new(context->gotoc.sat_pixmap);      GdkGC *used_gc = gdk_gc_new(context->gotoc.sat_pixmap);
386      gdk_gc_copy(used_gc, widget->style->black_gc);      gdk_gc_copy(used_gc, widget->style->black_gc);
# Line 288  static void sat_draw(GtkWidget *widget, Line 390  static void sat_draw(GtkWidget *widget,
390    
391  #define SAT_SPACING 3  #define SAT_SPACING 3
392      int i, x;      int i, x;
393      int swid = (width-SAT_SPACING*(sat->num-1))/sat->num;      int swid = (width-SAT_SPACING*(sat_num-1))/sat_num;
394    
395      /* as of xgps, a ss of 40 and more is "plenty" */      /* as of xgps, a ss of 40 and more is "plenty" */
396      int max_ss = 40;      int max_ss = 40;
397      for(i=0;i<sat->num;i++)      for(i=0;i<sat_num;i++)
398        if(sat->ss[i] > max_ss) sat->ss[i] = max_ss;        if(sat[i].ss > max_ss) sat[i].ss = max_ss;
399    
400      if(swid > 40) {      if(swid > 40) {
401        swid = 40;        swid = 40;
402        x = (width-sat->num*swid)/2;        x = (width-sat_num*swid)/2;
403      } else      } else
404        x = 0;        x = 0;
405    
406      for(i=0;i<sat->num;i++) {      for(i=0;i<sat_num;i++) {
407        char str[32];        char str[32];
408  #ifdef USE_MAEMO  #ifdef USE_MAEMO
409        snprintf(str, sizeof(str), "<span size=\"small\">%d</span>", sat->PRN[i]);        snprintf(str, sizeof(str), "<span size=\"small\">%d</span>", sat[i].prn);
410        PangoLayout *layout = gtk_widget_create_pango_layout(widget, NULL);        PangoLayout *layout = gtk_widget_create_pango_layout(widget, NULL);
411        pango_layout_set_markup(layout, str, strlen(str));        pango_layout_set_markup(layout, str, strlen(str));
412  #else  #else
413        snprintf(str, sizeof(str), "%d", sat->PRN[i]);        snprintf(str, sizeof(str), "%d", sat[i].prn);
414        PangoLayout *layout = gtk_widget_create_pango_layout(widget, str);        PangoLayout *layout = gtk_widget_create_pango_layout(widget, str);
415  #endif  #endif
416    
# Line 320  static void sat_draw(GtkWidget *widget, Line 422  static void sat_draw(GtkWidget *widget,
422    
423        g_object_unref(layout);        g_object_unref(layout);
424    
425        int h = (height-th) * sat->ss[i] / max_ss;        int h = (height-th) * sat[i].ss / max_ss;
426    
427        gdk_draw_rectangle(context->gotoc.sat_pixmap,        gdk_draw_rectangle(context->gotoc.sat_pixmap,
428                   sat->used[i]?used_gc:widget->style->fg_gc[GTK_STATE_NORMAL],                   sat[i].used?used_gc:widget->style->fg_gc[GTK_STATE_NORMAL],
429                   TRUE, x, height-h-th, swid, h);                   TRUE, x, height-h-th, swid, h);
430    
431        x += SAT_SPACING+swid;        x += SAT_SPACING+swid;
432      }      }
433    
     /* free sat infos */  
     free(sat->PRN);  
     free(sat->ss);  
     free(sat->used);  
434    } else {    } else {
435      PangoLayout *layout =      PangoLayout *layout =
436        gtk_widget_create_pango_layout(widget, _("No SAT info"));        gtk_widget_create_pango_layout(widget, _("No SAT info"));
# Line 344  static void sat_draw(GtkWidget *widget, Line 442  static void sat_draw(GtkWidget *widget,
442    
443      g_object_unref(layout);      g_object_unref(layout);
444    }    }
   
   /* free the sat structure */  
   if(sat)  
     free(sat);  
445  }  }
446    
447  /* Create a new backing pixmap of the appropriate size */  /* Create a new backing pixmap of the appropriate size */
# Line 387  gint goto_destroy_event(GtkWidget *widge Line 481  gint goto_destroy_event(GtkWidget *widge
481    
482    printf("destroying goto view\n");    printf("destroying goto view\n");
483    
484    #ifdef ESPEAK
485      espeak_enable(context, FALSE);
486    #endif
487    
488    /* stop timer */    /* stop timer */
489    if(context->gotoc.handler_id)    if(context->gotoc.handler_id)
490      gtk_timeout_remove(context->gotoc.handler_id);      gtk_timeout_remove(context->gotoc.handler_id);
# Line 452  static gboolean goto_update(gpointer dat Line 550  static gboolean goto_update(gpointer dat
550    return TRUE;   // fire again    return TRUE;   // fire again
551  }  }
552    
 #ifdef ENABLE_MAEMO_MAPPER  
 static void on_mm_button_clicked(GtkButton *button, gpointer data) {  
   cache_context_t *context = (cache_context_t*)data;  
   
   dbus_mm_set_position(context->appdata, &context->gotoc.pos);  
 }  
 #endif  
   
553  static gboolean compass_clicked_event(GtkWidget *widget, GdkEventButton *event,  static gboolean compass_clicked_event(GtkWidget *widget, GdkEventButton *event,
554                              gpointer user_data) {                              gpointer user_data) {
555    cache_context_t *context = (cache_context_t*)user_data;    cache_context_t *context = (cache_context_t*)user_data;
# Line 489  static void pos_modified(GtkWidget *widg Line 579  static void pos_modified(GtkWidget *widg
579    goto_update(context);    goto_update(context);
580  }  }
581    
582    #ifdef ESPEAK
583    static void espeak_clicked(GtkWidget *widget, gpointer data) {
584      cache_context_t *context = (cache_context_t*)data;
585    
586      GtkWidget *icon = gtk_button_get_image(GTK_BUTTON(widget));
587      gtk_widget_destroy(icon);
588      context->appdata->espeak.enabled = !context->appdata->espeak.enabled;
589      gtk_button_set_image(GTK_BUTTON(widget), icon_get_widget(ICON_MISC,
590                           context->appdata->espeak.enabled?6:7));
591    
592      espeak_enable(context, context->appdata->espeak.enabled);
593    }
594    #endif
595    
596    /* create "goto" tab */
597  GtkWidget *goto_cache(cache_context_t *context) {  GtkWidget *goto_cache(cache_context_t *context) {
598    int i;    int i;
599    
# Line 498  GtkWidget *goto_cache(cache_context_t *c Line 603  GtkWidget *goto_cache(cache_context_t *c
603    
604    context->gotoc.pos = gpx_cache_pos(context->cache);    context->gotoc.pos = gpx_cache_pos(context->cache);
605    
606    GtkWidget *hbox = gtk_hbox_new(FALSE, 32);    GtkWidget *hbox = portrait_box_new(FALSE, 32);
607    
608    context->gotoc.compass_area = gtk_drawing_area_new();    context->gotoc.compass_area = gtk_drawing_area_new();
609    gtk_drawing_area_size(GTK_DRAWING_AREA(context->gotoc.compass_area),    gtk_drawing_area_size(GTK_DRAWING_AREA(context->gotoc.compass_area),
# Line 534  GtkWidget *goto_cache(cache_context_t *c Line 639  GtkWidget *goto_cache(cache_context_t *c
639    g_signal_connect(G_OBJECT(context->gotoc.lon_entry), "changed",    g_signal_connect(G_OBJECT(context->gotoc.lon_entry), "changed",
640                     G_CALLBACK(pos_modified), context);                     G_CALLBACK(pos_modified), context);
641    
642    context->gotoc.coo_popup = preset_coordinate_picker(context->appdata,    gtk_table_attach_defaults(GTK_TABLE(table), preset_coordinate_picker(context->appdata,
643                 context->gotoc.lat_entry, context->gotoc.lon_entry);                 context->gotoc.lat_entry, context->gotoc.lon_entry), 2,3,0,1);
644    gtk_table_attach_defaults(GTK_TABLE(table),  
645                              context->gotoc.coo_popup, 2,3,0,1);    gtk_table_attach_defaults(GTK_TABLE(table), goto_coordinate(context->appdata,
646                        context->gotoc.lat_entry, context->gotoc.lon_entry), 2,3,1,2);
647    
648    gtk_table_set_row_spacing(GTK_TABLE(table), 1, 16);    gtk_table_set_row_spacing(GTK_TABLE(table), 1, 16);
649    gtk_table_set_col_spacing(GTK_TABLE(table), 0, 16);    gtk_table_set_col_spacing(GTK_TABLE(table), 0, 16);
# Line 545  GtkWidget *goto_cache(cache_context_t *c Line 651  GtkWidget *goto_cache(cache_context_t *c
651    /* -------------- distance label ------------------------- */    /* -------------- distance label ------------------------- */
652    gtk_table_attach_defaults(GTK_TABLE(table), left_label_new(_("Distance:")), 0,1,2,3);    gtk_table_attach_defaults(GTK_TABLE(table), left_label_new(_("Distance:")), 0,1,2,3);
653    gtk_table_attach_defaults(GTK_TABLE(table),    gtk_table_attach_defaults(GTK_TABLE(table),
654              (context->gotoc.distance_label = left_label_new("-----")), 1,2,2,3);              (context->gotoc.distance_label = gtk_label_new("-----")), 1,2,2,3);
655    
656    /* -------------- bearing label ------------------------- */    /* -------------- bearing label ------------------------- */
657    gtk_table_attach_defaults(GTK_TABLE(table), left_label_new(_("Bearing:")), 0,1,3,4);    gtk_table_attach_defaults(GTK_TABLE(table), left_label_new(_("Bearing:")), 0,1,3,4);
658    gtk_table_attach_defaults(GTK_TABLE(table),    gtk_table_attach_defaults(GTK_TABLE(table),
659              (context->gotoc.bearing_label = left_label_new("-----")), 1,2,3,4);              (context->gotoc.bearing_label = gtk_label_new("-----")), 1,2,3,4);
660    
661    /* -------------- error label ------------------------- */    /* -------------- error label ------------------------- */
662    gtk_table_attach_defaults(GTK_TABLE(table), left_label_new(_("Est. error:")), 0,1,4,5);    gtk_table_attach_defaults(GTK_TABLE(table), left_label_new(_("Est. error:")), 0,1,4,5);
663    gtk_table_attach_defaults(GTK_TABLE(table),    gtk_table_attach_defaults(GTK_TABLE(table),
664              (context->gotoc.eph_label = left_label_new("-----")), 1,2,4,5);              (context->gotoc.eph_label = gtk_label_new("-----")), 1,2,4,5);
665    
666    gtk_table_set_row_spacing(GTK_TABLE(table), 4, 16);    gtk_table_set_row_spacing(GTK_TABLE(table), 4, 16);
667    
# Line 575  GtkWidget *goto_cache(cache_context_t *c Line 681  GtkWidget *goto_cache(cache_context_t *c
681    
682    gtk_box_pack_start(GTK_BOX(ihbox), context->gotoc.sat_area, 1,0,0);    gtk_box_pack_start(GTK_BOX(ihbox), context->gotoc.sat_area, 1,0,0);
683    
684  #ifdef ENABLE_MAEMO_MAPPER  #ifdef ESPEAK
685    GtkWidget *mm_button = gtk_button_new();    GtkWidget *ivbox = gtk_vbox_new(FALSE, 0);
686    gtk_button_set_image(GTK_BUTTON(mm_button), icon_get_widget(ICON_MISC, 0));    GtkWidget *button = button_new();
687    gtk_signal_connect(GTK_OBJECT(mm_button), "clicked",    gtk_button_set_image(GTK_BUTTON(button), icon_get_widget(ICON_MISC,
688                       (GtkSignalFunc)on_mm_button_clicked, context);                         context->appdata->espeak.enabled?6:7));
689    gtk_box_pack_start(GTK_BOX(ihbox), mm_button, 1,0,0);    gtk_signal_connect (GTK_OBJECT(button), "clicked",
690                          GTK_SIGNAL_FUNC(espeak_clicked), context);
691      if(context->appdata->espeak.sample_rate < 0)
692        gtk_widget_set_sensitive(button, FALSE);
693      else
694        if(context->appdata->espeak.enabled)
695          espeak_enable(context, TRUE);
696    
697      gtk_box_pack_start(GTK_BOX(ivbox), button, 1,0,0);
698      gtk_box_pack_start(GTK_BOX(ihbox), ivbox, 1,0,0);
699  #endif  #endif
700    
701    gtk_table_attach_defaults(GTK_TABLE(table), ihbox, 0,3,5,6);    gtk_table_attach_defaults(GTK_TABLE(table), ihbox, 0,3,5,6);

Legend:
Removed from v.229  
changed lines
  Added in v.288