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

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

revision 65 by harbaum, Wed Aug 19 14:21:14 2009 UTC revision 73 by harbaum, Sun Aug 23 19:38:15 2009 UTC
# Line 23  Line 23 
23    
24  #ifdef ENABLE_OSM_GPS_MAP  #ifdef ENABLE_OSM_GPS_MAP
25  #include "osm-gps-map.h"  #include "osm-gps-map.h"
26    #include "osm-gps-map-osd-classic.h"
27  #endif  #endif
28    
29  #define MAP_SOURCE  OSM_GPS_MAP_SOURCE_OPENSTREETMAP  #define MAP_SOURCE  OSM_GPS_MAP_SOURCE_OPENSTREETMAP
# Line 66  static const char *get_proxy_uri(appdata Line 67  static const char *get_proxy_uri(appdata
67    return NULL;    return NULL;
68  }  }
69    
70  /* TODO: This needs to be wired to the GPS button in osm_gps_map */  static void
71  #if 0  cb_map_gps(osd_button_t but, map_context_t *context) {
72  static gboolean    if(but == OSD_GPS) {
73  cb_map_gps(GtkButton *button, map_context_t *context) {      pos_t *refpos = get_pos(context->appdata);
74    pos_t *refpos = get_pos(context->appdata);      if(refpos && !isnan(refpos->lat) && !isnan(refpos->lon)) {
75    if(refpos && !isnan(refpos->lat) && !isnan(refpos->lon)) {        osm_gps_map_set_mapcenter(OSM_GPS_MAP(context->widget),
76      osm_gps_map_set_mapcenter(OSM_GPS_MAP(context->widget),                                  refpos->lat, refpos->lon, GPS_DEFAULT_ZOOM);
77                        refpos->lat, refpos->lon, GPS_DEFAULT_ZOOM);      } else {
78    } else {        /* no coordinates given: display the entire world */
79      /* no coordinates given: display the entire world */        osm_gps_map_set_mapcenter(OSM_GPS_MAP(context->widget),
80      osm_gps_map_set_mapcenter(OSM_GPS_MAP(context->widget),                                  0.0, 0.0, 1);
81                                0.0, 0.0, 1);      }
82    }    }
   
   return FALSE;  
83  }  }
 #endif  
84    
85  static int dist2pixel(map_context_t *context, float km, float lat) {  static int dist2pixel(map_context_t *context, float km, float lat) {
86    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 94  static gboolean map_gps_update(gpointer
94    gboolean ok = (refpos!= NULL) && !isnan(refpos->lat) && !isnan(refpos->lon);    gboolean ok = (refpos!= NULL) && !isnan(refpos->lat) && !isnan(refpos->lon);
95    
96    /* ... and enable "goto" button if it's valid */    /* ... and enable "goto" button if it's valid */
97    /* TODO: gtk_widget_set_sensitive(context->gps, ok); */    osm_gps_map_osd_enable_gps (OSM_GPS_MAP(context->widget),
98                     OSM_GPS_MAP_OSD_CALLBACK(ok?cb_map_gps:NULL), context);
99    
100    if(ok) {    if(ok) {
101      float heading = NAN;      float heading = NAN;
# Line 148  static gboolean on_map_configure(GtkWidg Line 147  static gboolean on_map_configure(GtkWidg
147                              context->appdata->map.pos.lat,                              context->appdata->map.pos.lat,
148                              context->appdata->map.pos.lon,                              context->appdata->map.pos.lon,
149                              context->appdata->map.zoom);                              context->appdata->map.zoom);
150    
151    return FALSE;    return FALSE;
152  }  }
153    
# Line 325  balloon_draw_cb(cairo_t *cr, OsmGpsMapRe Line 324  balloon_draw_cb(cairo_t *cr, OsmGpsMapRe
324  #ifndef BIG_BALLOONS  #ifndef BIG_BALLOONS
325    cairo_set_font_size (cr, 14.0);    cairo_set_font_size (cr, 14.0);
326  #else  #else
327    cairo_set_font_size (cr, 24.0);    cairo_set_font_size (cr, 22.0);
328  #endif  #endif
329    
330    if(cache->name) {    if(cache->name) {
# Line 468  void map(appdata_t *appdata) { Line 467  void map(appdata_t *appdata) {
467    
468    g_free(path);    g_free(path);
469    
470      osm_gps_map_osd_classic_init(OSM_GPS_MAP(context->widget));
471    
472    char *name = NULL;    char *name = NULL;
473  #ifdef USE_MAEMO  #ifdef USE_MAEMO
474    if(!appdata->cur_gpx) {    if(!appdata->cur_gpx) {
# Line 516  void map(appdata_t *appdata) { Line 517  void map(appdata_t *appdata) {
517    g_signal_connect(G_OBJECT(context->widget), "button-release-event",    g_signal_connect(G_OBJECT(context->widget), "button-release-event",
518                     G_CALLBACK(on_map_button_release_event), context);                     G_CALLBACK(on_map_button_release_event), context);
519    
   /* TODO: gtk_widget_set_sensitive(context->gps, FALSE); */  
   
520    /* install handler for timed updates of the gps button */    /* install handler for timed updates of the gps button */
521    context->handler_id = gtk_timeout_add(1000, map_gps_update, context);    context->handler_id = gtk_timeout_add(1000, map_gps_update, context);
522    

Legend:
Removed from v.65  
changed lines
  Added in v.73