24 |
#include "osm-gps-map.h" |
#include "osm-gps-map.h" |
25 |
#endif |
#endif |
26 |
|
|
27 |
|
/* equatorial radius in meters */ |
28 |
|
#define EQ_RADIUS (6378137.0) |
29 |
|
|
30 |
|
#define RAD2DEG(a) (((a)*180.0)/M_PI) |
31 |
|
#define DEG2RAD(a) (((a)*M_PI)/180.0) |
32 |
|
|
33 |
typedef struct { |
typedef struct { |
34 |
appdata_t *appdata; |
appdata_t *appdata; |
35 |
GtkWidget *widget; |
GtkWidget *widget; |
36 |
GtkWidget *zoomin, *zoomout, *gps; |
GtkWidget *zoomin, *zoomout, *gps; |
37 |
gint handler_id; |
gint handler_id; |
38 |
|
cache_t *press_on; |
39 |
#if MAEMO_VERSION_MAJOR == 5 |
#if MAEMO_VERSION_MAJOR == 5 |
40 |
GtkWidget *old_view; |
GtkWidget *old_view; |
41 |
#endif |
#endif |
122 |
char *tooltip) { |
char *tooltip) { |
123 |
GtkWidget *button = gtk_button_new(); |
GtkWidget *button = gtk_button_new(); |
124 |
gtk_button_set_image(GTK_BUTTON(button), |
gtk_button_set_image(GTK_BUTTON(button), |
125 |
gtk_image_new_from_stock(icon, GTK_ICON_SIZE_MENU)); |
gtk_image_new_from_stock(icon, GTK_ICON_SIZE_BUTTON)); |
126 |
g_signal_connect(button, "clicked", cb, data); |
g_signal_connect(button, "clicked", cb, data); |
127 |
#ifndef USE_MAEMO |
#ifndef USE_MAEMO |
128 |
gtk_widget_set_tooltip_text(button, tooltip); |
gtk_widget_set_tooltip_text(button, tooltip); |
169 |
GMainLoop *loop; |
GMainLoop *loop; |
170 |
} popup_context_t; |
} popup_context_t; |
171 |
|
|
172 |
|
/* draw shape */ |
173 |
|
#define ARROW_BORDER 20 |
174 |
|
#define CORNER_RADIUS 10 |
175 |
|
|
176 |
#ifndef USE_HILDON |
#ifndef USE_MAEMO |
177 |
#define POPUP_WIDTH 300 |
#define POPUP_WIDTH 300 |
178 |
#define POPUP_HEIGHT 100 |
#define POPUP_HEIGHT 100 |
179 |
#else |
#else |
180 |
#define POPUP_WIDTH 600 |
#define POPUP_WIDTH 350 |
181 |
#define POPUP_HEIGHT 200 |
#define POPUP_HEIGHT 120 |
182 |
#endif |
#endif |
183 |
|
|
184 |
static gboolean |
static gboolean |
202 |
GdkEventButton *event, popup_context_t *context) { |
GdkEventButton *event, popup_context_t *context) { |
203 |
gboolean in = pointer_in_window(widget, event->x_root, event->y_root); |
gboolean in = pointer_in_window(widget, event->x_root, event->y_root); |
204 |
|
|
205 |
printf("overlay button press(in = %d)\n", in); |
printf("overlay button press (in = %d)\n", in); |
206 |
return !in; |
return !in; |
207 |
} |
} |
208 |
|
|
211 |
GdkEventButton *event, popup_context_t *context) { |
GdkEventButton *event, popup_context_t *context) { |
212 |
gboolean in = pointer_in_window(widget, event->x_root, event->y_root); |
gboolean in = pointer_in_window(widget, event->x_root, event->y_root); |
213 |
|
|
214 |
printf("overlay button release(in = %d)\n", in); |
printf("overlay button release (in = %d)\n", in); |
215 |
|
|
216 |
if(!in) { |
if(!in) { |
217 |
printf("destroying popup\n"); |
printf("destroying popup\n"); |
245 |
shutdown_loop(context); |
shutdown_loop(context); |
246 |
} |
} |
247 |
|
|
248 |
void cache_popup(appdata_t *appdata, cache_t *cache) { |
static void popup_window_shape(GtkWidget *window, int tip_x, int tip_y) { |
249 |
popup_context_t context; |
GdkBitmap *mask = gdk_pixmap_new(NULL, POPUP_WIDTH, POPUP_HEIGHT, 1); |
250 |
context.appdata = appdata; |
|
251 |
|
GdkGC *gc = gdk_gc_new(mask); |
252 |
context.window = gtk_window_new(GTK_WINDOW_POPUP); |
GdkColormap *colormap; |
253 |
gtk_widget_realize(context.window); |
GdkColor black; |
254 |
gtk_window_set_default_size(GTK_WINDOW(context.window), |
GdkColor white; |
255 |
|
|
256 |
|
/* get black/white color values */ |
257 |
|
colormap = gdk_colormap_get_system(); |
258 |
|
gdk_color_black(colormap, &black); |
259 |
|
gdk_color_white(colormap, &white); |
260 |
|
|
261 |
|
/* erase */ |
262 |
|
gdk_gc_set_foreground(gc, &black); |
263 |
|
gdk_gc_set_background(gc, &white); |
264 |
|
|
265 |
|
/* erase background */ |
266 |
|
gdk_draw_rectangle(mask, gc, TRUE, 0, 0, POPUP_WIDTH, POPUP_HEIGHT); |
267 |
|
|
268 |
|
gdk_gc_set_foreground(gc, &white); |
269 |
|
gdk_gc_set_background(gc, &black); |
270 |
|
|
271 |
|
/* the tip is always above or below the "bubble" but never at its side */ |
272 |
|
guint tip_offset = (tip_y == 0)?ARROW_BORDER:0; |
273 |
|
|
274 |
|
gdk_draw_rectangle(mask, gc, TRUE, |
275 |
|
0, tip_offset + CORNER_RADIUS, |
276 |
|
POPUP_WIDTH, |
277 |
|
POPUP_HEIGHT - 2*CORNER_RADIUS - ARROW_BORDER); |
278 |
|
|
279 |
|
gdk_draw_rectangle(mask, gc, TRUE, |
280 |
|
CORNER_RADIUS, tip_offset, |
281 |
|
POPUP_WIDTH - 2*CORNER_RADIUS, |
282 |
|
POPUP_HEIGHT - ARROW_BORDER); |
283 |
|
|
284 |
|
int off[][2] = { |
285 |
|
{ CORNER_RADIUS, tip_offset + CORNER_RADIUS }, |
286 |
|
{ POPUP_WIDTH - CORNER_RADIUS, tip_offset + CORNER_RADIUS }, |
287 |
|
{ POPUP_WIDTH - CORNER_RADIUS, |
288 |
|
POPUP_HEIGHT - CORNER_RADIUS - ARROW_BORDER + tip_offset}, |
289 |
|
{ CORNER_RADIUS, |
290 |
|
POPUP_HEIGHT - CORNER_RADIUS - ARROW_BORDER + tip_offset}}; |
291 |
|
|
292 |
|
int i; |
293 |
|
for(i=0;i<4;i++) { |
294 |
|
gdk_draw_arc(mask, gc, TRUE, |
295 |
|
off[i][0]-CORNER_RADIUS, off[i][1]-CORNER_RADIUS, |
296 |
|
2*CORNER_RADIUS, 2*CORNER_RADIUS, |
297 |
|
0, 360*64); |
298 |
|
} |
299 |
|
|
300 |
|
GdkPoint points[3] = { {POPUP_WIDTH*1/3, POPUP_HEIGHT/2}, |
301 |
|
{POPUP_WIDTH*2/3, POPUP_HEIGHT/2}, |
302 |
|
{tip_x,tip_y} }; |
303 |
|
gdk_draw_polygon(mask, gc, TRUE, points, 3); |
304 |
|
|
305 |
|
|
306 |
|
gdk_window_shape_combine_mask(window->window, mask, 0, 0); |
307 |
|
} |
308 |
|
|
309 |
|
/* create a left aligned label (normal ones are centered) */ |
310 |
|
static GtkWidget *gtk_label_left_new(char *str) { |
311 |
|
GtkWidget *label = gtk_label_new(str); |
312 |
|
gtk_misc_set_alignment(GTK_MISC(label), 0.f, .5f); |
313 |
|
return label; |
314 |
|
} |
315 |
|
|
316 |
|
/* the small labels are actually only on maemo small */ |
317 |
|
#ifdef USE_MAEMO |
318 |
|
#define MARKUP_SMALL "<span size='small'>%s</span>" |
319 |
|
GtkWidget *gtk_label_small_left_new(char *str) { |
320 |
|
GtkWidget *label = gtk_label_new(""); |
321 |
|
char *markup = g_markup_printf_escaped(MARKUP_SMALL, str); |
322 |
|
gtk_label_set_markup(GTK_LABEL(label), markup); |
323 |
|
g_free(markup); |
324 |
|
gtk_misc_set_alignment(GTK_MISC(label), 0.f, .5f); |
325 |
|
return label; |
326 |
|
} |
327 |
|
#define gtk_label_big_left_new(a) gtk_label_left_new(a) |
328 |
|
#else |
329 |
|
#define gtk_label_small_left_new(a) gtk_label_left_new(a) |
330 |
|
#define MARKUP_BIG "<span size='x-large'>%s</span>" |
331 |
|
GtkWidget *gtk_label_big_left_new(char *str) { |
332 |
|
GtkWidget *label = gtk_label_new(""); |
333 |
|
char *markup = g_markup_printf_escaped(MARKUP_BIG, str); |
334 |
|
gtk_label_set_markup(GTK_LABEL(label), markup); |
335 |
|
g_free(markup); |
336 |
|
gtk_misc_set_alignment(GTK_MISC(label), 0.f, .5f); |
337 |
|
return label; |
338 |
|
} |
339 |
|
#endif |
340 |
|
|
341 |
|
void cache_popup(map_context_t *mcontext, cache_t *cache) { |
342 |
|
popup_context_t pcontext; |
343 |
|
pcontext.appdata = mcontext->appdata; |
344 |
|
|
345 |
|
pcontext.window = gtk_window_new(GTK_WINDOW_POPUP); |
346 |
|
gtk_widget_realize(pcontext.window); |
347 |
|
gtk_window_set_default_size(GTK_WINDOW(pcontext.window), |
348 |
POPUP_WIDTH, POPUP_HEIGHT); |
POPUP_WIDTH, POPUP_HEIGHT); |
349 |
gtk_window_resize(GTK_WINDOW(context.window), |
gtk_window_resize(GTK_WINDOW(pcontext.window), POPUP_WIDTH, POPUP_HEIGHT); |
350 |
POPUP_WIDTH, POPUP_HEIGHT); |
// gtk_window_set_resizable(GTK_WINDOW(pcontext.window), FALSE); |
351 |
// gtk_window_set_resizable(GTK_WINDOW(context.window), FALSE); |
gtk_window_set_transient_for(GTK_WINDOW(pcontext.window), |
352 |
gtk_window_set_transient_for(GTK_WINDOW(context.window), |
GTK_WINDOW(mcontext->appdata->window)); |
353 |
GTK_WINDOW(appdata->window)); |
gtk_window_set_keep_above(GTK_WINDOW(pcontext.window), TRUE); |
354 |
gtk_window_set_keep_above(GTK_WINDOW(context.window), TRUE); |
gtk_window_set_destroy_with_parent(GTK_WINDOW(pcontext.window), TRUE); |
355 |
gtk_window_set_destroy_with_parent(GTK_WINDOW(context.window), TRUE); |
gtk_window_set_gravity(GTK_WINDOW(pcontext.window), GDK_GRAVITY_STATIC); |
356 |
gtk_window_set_gravity(GTK_WINDOW(context.window), GDK_GRAVITY_STATIC); |
gtk_window_set_modal(GTK_WINDOW(pcontext.window), TRUE); |
|
gtk_window_set_modal(GTK_WINDOW(context.window), TRUE); |
|
357 |
|
|
358 |
/* connect events */ |
/* connect events */ |
359 |
g_signal_connect(G_OBJECT(context.window), "button-press-event", |
g_signal_connect(G_OBJECT(pcontext.window), "button-press-event", |
360 |
G_CALLBACK(on_button_press_event), &context); |
G_CALLBACK(on_button_press_event), &pcontext); |
361 |
g_signal_connect(G_OBJECT(context.window), "button-release-event", |
g_signal_connect(G_OBJECT(pcontext.window), "button-release-event", |
362 |
G_CALLBACK(on_button_release_event), &context); |
G_CALLBACK(on_button_release_event), &pcontext); |
363 |
g_signal_connect(G_OBJECT(context.window), "delete-event", |
g_signal_connect(G_OBJECT(pcontext.window), "delete-event", |
364 |
G_CALLBACK(run_delete_handler), &context); |
G_CALLBACK(run_delete_handler), &pcontext); |
365 |
g_signal_connect(G_OBJECT(context.window), "destroy", |
g_signal_connect(G_OBJECT(pcontext.window), "destroy", |
366 |
G_CALLBACK(run_destroy_handler), &context); |
G_CALLBACK(run_destroy_handler), &pcontext); |
367 |
g_signal_connect(G_OBJECT(context.window), "unmap", |
g_signal_connect(G_OBJECT(pcontext.window), "unmap", |
368 |
G_CALLBACK(run_unmap_handler), &context); |
G_CALLBACK(run_unmap_handler), &pcontext); |
369 |
|
|
370 |
gdk_pointer_grab(context.window->window, TRUE, |
gdk_pointer_grab(pcontext.window->window, TRUE, |
371 |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_MOTION_MASK, |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_MOTION_MASK, |
372 |
NULL, NULL, GDK_CURRENT_TIME); |
NULL, NULL, GDK_CURRENT_TIME); |
373 |
gtk_grab_add(context.window); |
gtk_grab_add(pcontext.window); |
374 |
|
|
375 |
|
/* check whether cache is in upper or lower half of window */ |
376 |
|
gint x, y, sx, sy; |
377 |
|
osm_gps_map_geographic_to_screen(OSM_GPS_MAP(mcontext->widget), |
378 |
|
cache->pos.lat, cache->pos.lon, |
379 |
|
&sx, &sy); |
380 |
|
|
381 |
|
gdk_window_get_origin(mcontext->widget->window, &x, &y); |
382 |
|
|
383 |
|
gint ax = 0, ay = 0; |
384 |
|
if(sx > mcontext->widget->allocation.width/2) |
385 |
|
ax = POPUP_WIDTH; |
386 |
|
|
387 |
|
if(sy > mcontext->widget->allocation.height/2) |
388 |
|
ay = POPUP_HEIGHT; |
389 |
|
|
390 |
|
#if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5) |
391 |
|
GdkColor color; |
392 |
|
gdk_color_parse("darkgray", &color); |
393 |
|
gtk_widget_modify_bg(GTK_WIDGET(pcontext.window), GTK_STATE_NORMAL, &color); |
394 |
|
#endif |
395 |
|
|
396 |
|
gtk_window_move(GTK_WINDOW(pcontext.window), |
397 |
|
x + mcontext->widget->allocation.x + sx - ax, |
398 |
|
y + mcontext->widget->allocation.y + sy - ay); |
399 |
|
|
400 |
|
|
401 |
|
GtkWidget *alignment = gtk_alignment_new(0.5, 0.5, 1.0, 1.0); |
402 |
|
gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), |
403 |
|
CORNER_RADIUS/2 + (ay?0:ARROW_BORDER), |
404 |
|
CORNER_RADIUS/2 + (ay?ARROW_BORDER:0), |
405 |
|
CORNER_RADIUS, CORNER_RADIUS); |
406 |
|
|
407 |
|
/* --- actual content ---- */ |
408 |
|
GtkWidget *vbox = gtk_vbox_new(FALSE, 0); |
409 |
|
|
410 |
|
if(cache->id) { |
411 |
|
GtkWidget *ihbox = gtk_hbox_new(FALSE, 0); |
412 |
|
|
413 |
|
gtk_box_pack_start(GTK_BOX(ihbox), |
414 |
|
icon_get_widget(ICON_CACHE_TYPE, cache->type), |
415 |
|
FALSE, FALSE, 5); |
416 |
|
|
417 |
|
gtk_box_pack_start_defaults(GTK_BOX(ihbox), |
418 |
|
gtk_label_big_left_new(cache->id)); |
419 |
|
|
420 |
|
gtk_box_pack_start_defaults(GTK_BOX(vbox), ihbox); |
421 |
|
} |
422 |
|
|
423 |
|
if(cache->name) { |
424 |
|
GtkWidget *label = gtk_label_small_left_new(cache->name); |
425 |
|
gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END); |
426 |
|
gtk_box_pack_start_defaults(GTK_BOX(vbox), label); |
427 |
|
} |
428 |
|
|
429 |
|
GtkWidget *hbox = gtk_hbox_new(FALSE, 0); |
430 |
|
if(cache->terrain) { |
431 |
|
GtkWidget *ihbox = gtk_hbox_new(FALSE, 0); |
432 |
|
gtk_box_pack_start(GTK_BOX(ihbox), |
433 |
|
gtk_label_small_left_new(_("Terrain:")), FALSE, FALSE, 0); |
434 |
|
gtk_box_pack_start(GTK_BOX(ihbox), |
435 |
|
icon_get_widget(ICON_STARS, (int)(cache->terrain*2-2)), |
436 |
|
FALSE, FALSE, 5); |
437 |
|
gtk_box_pack_start_defaults(GTK_BOX(hbox), ihbox); |
438 |
|
} |
439 |
|
|
440 |
|
if(cache->difficulty) { |
441 |
|
GtkWidget *ihbox = gtk_hbox_new(FALSE, 0); |
442 |
|
gtk_box_pack_start(GTK_BOX(ihbox), |
443 |
|
gtk_label_small_left_new(_("Difficulty:")), FALSE, FALSE, 0); |
444 |
|
gtk_box_pack_start(GTK_BOX(ihbox), |
445 |
|
icon_get_widget(ICON_STARS, (int)(cache->difficulty*2-2)), |
446 |
|
FALSE, FALSE, 5); |
447 |
|
gtk_box_pack_start_defaults(GTK_BOX(hbox), ihbox); |
448 |
|
} |
449 |
|
|
450 |
|
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
451 |
|
|
452 |
// gint x, y; |
gtk_container_add(GTK_CONTAINER(alignment), vbox); |
453 |
// gdk_window_get_origin(button->window, &x, &y); |
/* ----------------------- */ |
|
|
|
|
// gtk_window_move(GTK_WINDOW(context.window), |
|
|
// x + button->allocation.x, |
|
|
// y + button->allocation.y - HEIGHT); |
|
|
|
|
|
|
|
|
gtk_window_move(GTK_WINDOW(context.window), |
|
|
100, |
|
|
100); |
|
|
|
|
|
/* a frame with a vscale inside */ |
|
|
GtkWidget *frame = gtk_frame_new(NULL); |
|
|
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT); |
|
454 |
|
|
455 |
gtk_container_add(GTK_CONTAINER(frame), gtk_label_new(cache->name)); |
|
456 |
gtk_container_add(GTK_CONTAINER(context.window), frame); |
gtk_container_add(GTK_CONTAINER(pcontext.window), alignment); |
457 |
|
|
458 |
gtk_widget_show_all(context.window); |
/* give window its shape */ |
459 |
|
popup_window_shape(pcontext.window, ax, ay); |
460 |
|
|
461 |
|
gtk_widget_show_all(pcontext.window); |
462 |
|
|
463 |
/* handle this popup until it's gone */ |
/* handle this popup until it's gone */ |
464 |
|
|
465 |
context.loop = g_main_loop_new(NULL, FALSE); |
pcontext.loop = g_main_loop_new(NULL, FALSE); |
466 |
|
|
467 |
GDK_THREADS_LEAVE(); |
GDK_THREADS_LEAVE(); |
468 |
g_main_loop_run(context.loop); |
g_main_loop_run(pcontext.loop); |
469 |
GDK_THREADS_ENTER(); |
GDK_THREADS_ENTER(); |
470 |
|
|
471 |
g_main_loop_unref(context.loop); |
g_main_loop_unref(pcontext.loop); |
472 |
|
|
473 |
printf("cache popup removed\n"); |
printf("cache popup removed\n"); |
474 |
} |
} |
475 |
|
|
|
#define RAD2DEG(a) (((a)*180.0)/M_PI) |
|
|
|
|
476 |
static void |
static void |
477 |
map_cachelist_nearest(cache_t *cache, pos_t *pos, |
map_cachelist_nearest(cache_t *cache, pos_t *pos, |
478 |
cache_t **result, float *distance) { |
cache_t **result, float *distance) { |
521 |
return pos; |
return pos; |
522 |
} |
} |
523 |
|
|
524 |
|
static int dist2pixel(map_context_t *context, float km, float lat) { |
525 |
|
int zoom; |
526 |
|
g_object_get(OSM_GPS_MAP(context->widget), "zoom", &zoom, NULL); |
527 |
|
|
528 |
|
/* world at zoom 1 == 512 pixels */ |
529 |
|
float m_per_pix = |
530 |
|
cos(DEG2RAD(lat))*2*M_PI*EQ_RADIUS/(1<<(8+zoom)); |
531 |
|
|
532 |
|
return 1000.0*km/m_per_pix; |
533 |
|
} |
534 |
|
|
535 |
|
#define CLICK_FUZZ (24) |
536 |
|
|
537 |
static gboolean |
static gboolean |
538 |
on_map_button_press_event(GtkWidget *widget, |
on_map_button_press_event(GtkWidget *widget, |
539 |
GdkEventButton *event, map_context_t *context) { |
GdkEventButton *event, map_context_t *context) { |
540 |
OsmGpsMap *map = OSM_GPS_MAP(context->widget); |
OsmGpsMap *map = OSM_GPS_MAP(context->widget); |
541 |
|
|
542 |
pos_t pos = |
/* got a press event without release event? eat it! */ |
543 |
coord2pos(osm_gps_map_get_co_ordinates(map, (int)event->x, (int)event->y)); |
if(context->press_on != NULL) { |
544 |
|
printf("PRESS: already\n"); |
545 |
|
return TRUE; |
546 |
|
} |
547 |
|
|
548 |
printf("clicked at %f/%f\n", pos.lat, pos.lon); |
pos_t pos = |
549 |
|
coord2pos(osm_gps_map_get_co_ordinates(map, event->x, event->y)); |
550 |
|
|
551 |
|
cache_t *nearest = map_closest(context, &pos); |
552 |
|
if(nearest) { |
553 |
|
float dist = gpx_pos_get_distance(pos, nearest->pos, FALSE); |
554 |
|
if(dist2pixel(context, dist, nearest->pos.lat) < CLICK_FUZZ) |
555 |
|
context->press_on = nearest; |
556 |
|
} |
557 |
|
|
558 |
return FALSE; |
return FALSE; |
559 |
} |
} |
560 |
|
|
561 |
static gboolean |
static gboolean |
562 |
on_map_button_release_event(GtkWidget *widget, |
on_map_button_release_event(GtkWidget *widget, |
563 |
GdkEventButton *event, map_context_t *context) { |
GdkEventButton *event, map_context_t *context) { |
564 |
OsmGpsMap *map = OSM_GPS_MAP(context->widget); |
if(context->press_on) { |
565 |
|
OsmGpsMap *map = OSM_GPS_MAP(context->widget); |
|
pos_t pos = |
|
|
coord2pos(osm_gps_map_get_co_ordinates(map, (int)event->x, (int)event->y)); |
|
|
|
|
|
printf("released at %f/%f\n", pos.lat, pos.lon); |
|
566 |
|
|
567 |
/* return true if we clicked a cache */ |
pos_t pos = |
568 |
/* ... */ |
coord2pos(osm_gps_map_get_co_ordinates(map, event->x, event->y)); |
569 |
|
|
570 |
cache_t *nearest = map_closest(context, &pos); |
cache_t *nearest = map_closest(context, &pos); |
571 |
|
if(nearest && nearest == context->press_on) { |
572 |
if(nearest) { |
float dist = gpx_pos_get_distance(pos, nearest->pos, FALSE); |
573 |
float dist = gpx_pos_get_distance(pos, nearest->pos, FALSE); |
if(dist2pixel(context, dist, nearest->pos.lat) < CLICK_FUZZ) |
574 |
|
cache_popup(context, nearest); |
575 |
printf("nearest = %s, distance = %fkm\n", nearest->name, dist); |
} |
576 |
|
context->press_on = NULL; |
|
cache_popup(context->appdata, nearest); |
|
|
|
|
|
return TRUE; |
|
577 |
} |
} |
578 |
|
|
579 |
return FALSE; |
return FALSE; |
580 |
} |
} |
581 |
|
|
582 |
|
|
583 |
#if MAEMO_VERSION_MAJOR == 5 |
#if MAEMO_VERSION_MAJOR == 5 |
584 |
static void on_window_destroy(GtkWidget *widget, map_context_t *context) { |
static void on_window_destroy(GtkWidget *widget, map_context_t *context) { |
585 |
printf("destroy map view\n"); |
printf("destroy map view\n"); |
623 |
#ifdef USE_MAEMO |
#ifdef USE_MAEMO |
624 |
} else { |
} else { |
625 |
map_draw_cachelist(context->widget, appdata->cur_gpx->cache); |
map_draw_cachelist(context->widget, appdata->cur_gpx->cache); |
626 |
name = g_strdup(_("appdata->cur_gpx->name")); |
name = g_strdup(appdata->cur_gpx->name); |
627 |
} |
} |
628 |
#endif |
#endif |
629 |
|
|
641 |
NULL); |
NULL); |
642 |
|
|
643 |
#ifndef USE_MAEMO |
#ifndef USE_MAEMO |
644 |
gtk_window_set_default_size(GTK_WINDOW(dialog), 400, 350); |
gtk_window_set_default_size(GTK_WINDOW(dialog), 640, 480); |
645 |
#else |
#else |
646 |
gtk_window_set_default_size(GTK_WINDOW(dialog), 800, 480); |
gtk_window_set_default_size(GTK_WINDOW(dialog), 800, 480); |
647 |
#endif |
#endif |