156 |
int type = semi?ICON_CACHE_TYPE_SEMI:ICON_CACHE_TYPE; |
int type = semi?ICON_CACHE_TYPE_SEMI:ICON_CACHE_TYPE; |
157 |
|
|
158 |
GdkPixbuf *icon = icon_get(type, cache->type); |
GdkPixbuf *icon = icon_get(type, cache->type); |
159 |
|
GdkPixbuf *over = NULL; |
160 |
|
|
161 |
|
if(cache->mine) over = icon_get(type, 14); |
162 |
|
else if(cache->found) over = icon_get(type, 12); |
163 |
|
else if(cache->notes) { |
164 |
|
if(cache->notes->found) over = icon_get(type, 12); |
165 |
|
else if(cache->notes->override) over = icon_get(type, 11); |
166 |
|
else over = icon_get(type, 13); |
167 |
|
} |
168 |
|
|
169 |
|
pos_t *pos = &cache->pos; |
170 |
/* check if there's also an overwritten coordinate */ |
/* check if there's also an overwritten coordinate */ |
171 |
if(cache->notes && cache->notes->override) { |
if(cache->notes && cache->notes->override) |
172 |
GdkPixbuf *over = icon_get(type, 11); |
pos = &cache->notes->pos; |
173 |
|
|
174 |
|
if(!isnan(pos->lat) && !isnan(pos->lon)) { |
175 |
osm_gps_map_add_image(OSM_GPS_MAP(map), |
osm_gps_map_add_image(OSM_GPS_MAP(map), |
176 |
cache->notes->pos.lat, cache->notes->pos.lon, icon); |
pos->lat, pos->lon, icon); |
177 |
|
if(over) |
178 |
osm_gps_map_add_image(OSM_GPS_MAP(map), |
osm_gps_map_add_image(OSM_GPS_MAP(map), |
179 |
cache->notes->pos.lat, cache->notes->pos.lon, over); |
pos->lat, pos->lon, over); |
|
} else { |
|
|
if(!isnan(cache->pos.lat) && !isnan(cache->pos.lon)) |
|
|
osm_gps_map_add_image(OSM_GPS_MAP(map), |
|
|
cache->pos.lat, cache->pos.lon, icon); |
|
180 |
} |
} |
181 |
} |
} |
182 |
|
|
231 |
if(context->state != MAP_ALL) { |
if(context->state != MAP_ALL) { |
232 |
printf("map_setup(ALL)\n"); |
printf("map_setup(ALL)\n"); |
233 |
|
|
234 |
|
/* clear any pending balloon */ |
235 |
|
context->balloon = NULL; |
236 |
|
osm_gps_map_osd_clear_balloon (OSM_GPS_MAP(context->widget)); |
237 |
|
|
238 |
#ifdef OSD_NAV |
#ifdef OSD_NAV |
239 |
/* no navigation in this mode */ |
/* no navigation in this mode */ |
240 |
osm_gps_map_osd_clear_nav (OSM_GPS_MAP(context->widget)); |
osm_gps_map_osd_clear_nav (OSM_GPS_MAP(context->widget)); |
266 |
if(context->state != MAP_GPX) { |
if(context->state != MAP_GPX) { |
267 |
printf("map_setup(GPX)\n"); |
printf("map_setup(GPX)\n"); |
268 |
|
|
269 |
|
/* clear any pending balloon */ |
270 |
|
context->balloon = NULL; |
271 |
|
osm_gps_map_osd_clear_balloon (OSM_GPS_MAP(context->widget)); |
272 |
|
|
273 |
#ifdef OSD_NAV |
#ifdef OSD_NAV |
274 |
/* no navigation in this mode */ |
/* no navigation in this mode */ |
275 |
osm_gps_map_osd_clear_nav (OSM_GPS_MAP(context->widget)); |
osm_gps_map_osd_clear_nav (OSM_GPS_MAP(context->widget)); |
276 |
#endif |
#endif |
277 |
|
|
278 |
/* clear all existing ccahe images */ |
/* clear all existing cache images */ |
279 |
osm_gps_map_clear_images (OSM_GPS_MAP(context->widget)); |
osm_gps_map_clear_images (OSM_GPS_MAP(context->widget)); |
280 |
memset(context->caches_displayed, 0, |
memset(context->caches_displayed, 0, |
281 |
(cache_num+1) * sizeof(cache_display_t)); |
(cache_num+1) * sizeof(cache_display_t)); |
301 |
|
|
302 |
printf("map_setup(CACHE)\n"); |
printf("map_setup(CACHE)\n"); |
303 |
|
|
304 |
/* no balloons in this mode */ |
/* clear any pending balloon */ |
305 |
context->balloon = NULL; |
context->balloon = NULL; |
306 |
osm_gps_map_osd_clear_balloon (OSM_GPS_MAP(context->widget)); |
osm_gps_map_osd_clear_balloon (OSM_GPS_MAP(context->widget)); |
307 |
|
|
627 |
/* draw terrain stars */ |
/* draw terrain stars */ |
628 |
cairo_draw_pixbuf(event->data.draw.cr, icon, x, y + icon_y); |
cairo_draw_pixbuf(event->data.draw.cr, icon, x, y + icon_y); |
629 |
|
|
630 |
x += gdk_pixbuf_get_width(icon) + LINE_SKIP; |
x += gdk_pixbuf_get_width(icon) + FONT_SIZE/2; |
631 |
} |
} |
632 |
|
|
633 |
if(cache->difficulty) { |
if(cache->difficulty) { |
651 |
|
|
652 |
cairo_draw_pixbuf(event->data.draw.cr, icon, x, y + icon_y); |
cairo_draw_pixbuf(event->data.draw.cr, icon, x, y + icon_y); |
653 |
} |
} |
654 |
|
|
655 |
|
/* draw container info */ |
656 |
|
/* TODO ... */ |
657 |
|
|
658 |
|
|
659 |
} else if(event->type == OSM_GPS_MAP_BALLOON_EVENT_TYPE_CLICK) { |
} else if(event->type == OSM_GPS_MAP_BALLOON_EVENT_TYPE_CLICK) { |
660 |
printf("click %s event at %d %d\n", |
printf("click %s event at %d %d\n", |
661 |
event->data.click.down?"down":"up", |
event->data.click.down?"down":"up", |
719 |
/* in "MAP_CACHE" state only one cache is visible */ |
/* in "MAP_CACHE" state only one cache is visible */ |
720 |
/* and the map is in navigation mode. the balloon is */ |
/* and the map is in navigation mode. the balloon is */ |
721 |
/* pretty useless there */ |
/* pretty useless there */ |
722 |
if(context->press_on && (context->state != MAP_CACHE)) { |
if(context->press_on) { |
723 |
|
|
724 |
coord_t coo; |
coord_t coo; |
725 |
coo = osm_gps_map_get_co_ordinates(map, event->x, event->y); |
coo = osm_gps_map_get_co_ordinates(map, event->x, event->y); |