Diff of /trunk/src/map-tool.c

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

revision 63 by harbaum, Wed Aug 19 12:35:25 2009 UTC revision 69 by harbaum, Thu Aug 20 18:54:06 2009 UTC
# Line 66  static const char *get_proxy_uri(appdata Line 66  static const char *get_proxy_uri(appdata
66    return NULL;    return NULL;
67  }  }
68    
69  /* TODO: This needs to be wired to the GPS button in osm_gps_map */  static void
70  #if 0  cb_map_gps(map_context_t *context) {
 static gboolean  
 cb_map_gps(GtkButton *button, map_context_t *context) {  
71    pos_t *refpos = get_pos(context->appdata);    pos_t *refpos = get_pos(context->appdata);
72    if(refpos && !isnan(refpos->lat) && !isnan(refpos->lon)) {    if(refpos && !isnan(refpos->lat) && !isnan(refpos->lon)) {
73      osm_gps_map_set_mapcenter(OSM_GPS_MAP(context->widget),      osm_gps_map_set_mapcenter(OSM_GPS_MAP(context->widget),
# Line 79  cb_map_gps(GtkButton *button, map_contex Line 77  cb_map_gps(GtkButton *button, map_contex
77      osm_gps_map_set_mapcenter(OSM_GPS_MAP(context->widget),      osm_gps_map_set_mapcenter(OSM_GPS_MAP(context->widget),
78                                0.0, 0.0, 1);                                0.0, 0.0, 1);
79    }    }
   
   return FALSE;  
80  }  }
 #endif  
81    
82  static int dist2pixel(map_context_t *context, float km, float lat) {  static int dist2pixel(map_context_t *context, float km, float lat) {
83    return 1000.0*km/osm_gps_map_get_scale(OSM_GPS_MAP(context->widget));    return 1000.0*km/osm_gps_map_get_scale(OSM_GPS_MAP(context->widget));
# Line 96  static gboolean map_gps_update(gpointer Line 91  static gboolean map_gps_update(gpointer
91    gboolean ok = (refpos!= NULL) && !isnan(refpos->lat) && !isnan(refpos->lon);    gboolean ok = (refpos!= NULL) && !isnan(refpos->lat) && !isnan(refpos->lon);
92    
93    /* ... and enable "goto" button if it's valid */    /* ... and enable "goto" button if it's valid */
94    /* TODO: gtk_widget_set_sensitive(context->gps, ok); */    osm_gps_map_osd_enable_gps (OSM_GPS_MAP(context->widget),
95                     OSM_GPS_MAP_OSD_GPS_CALLBACK(ok?cb_map_gps:NULL), context);
96    
97    if(ok) {    if(ok) {
98      float heading = NAN;      float heading = NAN;
# Line 260  cairo_draw_pixbuf(cairo_t *cr, GdkPixbuf Line 256  cairo_draw_pixbuf(cairo_t *cr, GdkPixbuf
256    cairo_paint(cr);    cairo_paint(cr);
257  }  }
258    
259    #ifndef BIG_BALLOONS
260  #define LINE_SKIP  7  #define LINE_SKIP  7
261    #else
262    #define LINE_SKIP  12
263    #endif
264    
265  static void  static void
266  balloon_draw_cb(cairo_t *cr, OsmGpsMapRect_t *rect, gpointer data) {  balloon_draw_cb(cairo_t *cr, OsmGpsMapRect_t *rect, gpointer data) {
# Line 292  balloon_draw_cb(cairo_t *cr, OsmGpsMapRe Line 292  balloon_draw_cb(cairo_t *cr, OsmGpsMapRe
292                              CAIRO_FONT_SLANT_NORMAL,                              CAIRO_FONT_SLANT_NORMAL,
293                              CAIRO_FONT_WEIGHT_BOLD);                              CAIRO_FONT_WEIGHT_BOLD);
294    
295    #ifndef BIG_BALLOONS
296      cairo_set_font_size (cr, 20.0);      cairo_set_font_size (cr, 20.0);
297    #else
298        cairo_set_font_size (cr, 36.0);
299    #endif
300    
301      cairo_text_extents (cr, cache->id, &extents);      cairo_text_extents (cr, cache->id, &extents);
302    
303      /* display id right of icon vertically centered */      /* display id right of icon vertically centered */
# Line 313  balloon_draw_cb(cairo_t *cr, OsmGpsMapRe Line 318  balloon_draw_cb(cairo_t *cr, OsmGpsMapRe
318    /* everything from here uses the same font */    /* everything from here uses the same font */
319    cairo_select_font_face (cr, "Sans", CAIRO_FONT_SLANT_NORMAL,    cairo_select_font_face (cr, "Sans", CAIRO_FONT_SLANT_NORMAL,
320                            CAIRO_FONT_WEIGHT_NORMAL);                            CAIRO_FONT_WEIGHT_NORMAL);
321    #ifndef BIG_BALLOONS
322    cairo_set_font_size (cr, 14.0);    cairo_set_font_size (cr, 14.0);
323    #else
324      cairo_set_font_size (cr, 22.0);
325    #endif
326    
327    if(cache->name) {    if(cache->name) {
328      /* draw cache name */      /* draw cache name */
# Line 503  void map(appdata_t *appdata) { Line 512  void map(appdata_t *appdata) {
512    g_signal_connect(G_OBJECT(context->widget), "button-release-event",    g_signal_connect(G_OBJECT(context->widget), "button-release-event",
513                     G_CALLBACK(on_map_button_release_event), context);                     G_CALLBACK(on_map_button_release_event), context);
514    
   /* TODO: gtk_widget_set_sensitive(context->gps, FALSE); */  
   
515    /* install handler for timed updates of the gps button */    /* install handler for timed updates of the gps button */
516    context->handler_id = gtk_timeout_add(1000, map_gps_update, context);    context->handler_id = gtk_timeout_add(1000, map_gps_update, context);
517    

Legend:
Removed from v.63  
changed lines
  Added in v.69