483 |
cache_context_t *context = (cache_context_t*)data; |
cache_context_t *context = (cache_context_t*)data; |
484 |
|
|
485 |
/* extract position from entries */ |
/* extract position from entries */ |
486 |
context->gotoc.pos.lat = lat_get(context->gotoc.lat_entry); |
context->gotoc.pos.lat = lat_entry_get(context->gotoc.lat_entry); |
487 |
context->gotoc.pos.lon = lon_get(context->gotoc.lon_entry); |
context->gotoc.pos.lon = lon_entry_get(context->gotoc.lon_entry); |
488 |
|
|
489 |
goto_update(context); |
goto_update(context); |
490 |
} |
} |
498 |
|
|
499 |
context->gotoc.pos = gpx_cache_pos(context->cache); |
context->gotoc.pos = gpx_cache_pos(context->cache); |
500 |
|
|
501 |
GtkWidget *hbox = gtk_hbox_new(FALSE, 0); |
GtkWidget *hbox = gtk_hbox_new(FALSE, 32); |
502 |
|
|
503 |
context->gotoc.compass_area = gtk_drawing_area_new(); |
context->gotoc.compass_area = gtk_drawing_area_new(); |
504 |
gtk_drawing_area_size(GTK_DRAWING_AREA(context->gotoc.compass_area), |
gtk_drawing_area_size(GTK_DRAWING_AREA(context->gotoc.compass_area), |
534 |
g_signal_connect(G_OBJECT(context->gotoc.lon_entry), "changed", |
g_signal_connect(G_OBJECT(context->gotoc.lon_entry), "changed", |
535 |
G_CALLBACK(pos_modified), context); |
G_CALLBACK(pos_modified), context); |
536 |
|
|
537 |
GtkWidget *popup = coo_popup(context->appdata, |
context->gotoc.coo_popup = preset_coordinate_picker(context->appdata, |
538 |
context->gotoc.lat_entry, context->gotoc.lon_entry); |
context->gotoc.lat_entry, context->gotoc.lon_entry); |
539 |
gtk_table_attach_defaults(GTK_TABLE(table), popup, 2,3,0,1); |
gtk_table_attach_defaults(GTK_TABLE(table), |
540 |
|
context->gotoc.coo_popup, 2,3,0,1); |
541 |
|
|
542 |
gtk_table_set_row_spacing(GTK_TABLE(table), 1, 16); |
gtk_table_set_row_spacing(GTK_TABLE(table), 1, 16); |
543 |
gtk_table_set_col_spacing(GTK_TABLE(table), 0, 16); |
gtk_table_set_col_spacing(GTK_TABLE(table), 0, 16); |
582 |
(GtkSignalFunc)on_mm_button_clicked, context); |
(GtkSignalFunc)on_mm_button_clicked, context); |
583 |
gtk_box_pack_start(GTK_BOX(ihbox), mm_button, 1,0,0); |
gtk_box_pack_start(GTK_BOX(ihbox), mm_button, 1,0,0); |
584 |
#endif |
#endif |
585 |
|
|
586 |
gtk_table_attach_defaults(GTK_TABLE(table), ihbox, 0,3,5,6); |
gtk_table_attach_defaults(GTK_TABLE(table), ihbox, 0,3,5,6); |
587 |
|
|
588 |
/* ------------------------------------------------------- */ |
/* ------------------------------------------------------- */ |
589 |
|
|
590 |
gtk_box_pack_start(GTK_BOX(vbox), table, 1,0,0); |
gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, FALSE, 0); |
591 |
gtk_box_pack_start(GTK_BOX(hbox), vbox, 1,0,0); |
gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0); |
592 |
|
|
593 |
context->gotoc.handler_id = |
context->gotoc.handler_id = |
594 |
gtk_timeout_add(UPDATE_MS, goto_update, context); |
gtk_timeout_add(UPDATE_MS, goto_update, context); |
598 |
|
|
599 |
void goto_coordinate_update(cache_context_t *context) { |
void goto_coordinate_update(cache_context_t *context) { |
600 |
static pos_t pos = { 0.0, 0.0 }; |
static pos_t pos = { 0.0, 0.0 }; |
|
char str[32]; |
|
601 |
|
|
602 |
if(!context->notes.modified) |
if(!context->notes.modified) |
603 |
return; |
return; |
606 |
if(pos_differ(&npos, &pos)) { |
if(pos_differ(&npos, &pos)) { |
607 |
pos = npos; |
pos = npos; |
608 |
|
|
609 |
pos_lat_str(str, sizeof(str)-1, npos.lat); |
lat_entry_set(context->gotoc.lat_entry, npos.lat); |
610 |
gtk_entry_set_text(GTK_ENTRY(context->gotoc.lat_entry), str); |
lon_entry_set(context->gotoc.lon_entry, npos.lon); |
|
pos_lon_str(str, sizeof(str)-1, npos.lon); |
|
|
gtk_entry_set_text(GTK_ENTRY(context->gotoc.lon_entry), str); |
|
611 |
} |
} |
612 |
} |
} |