53 |
gtk_box_pack_start(GTK_BOX(hbox), gtk_image_new_from_pixbuf( |
gtk_box_pack_start(GTK_BOX(hbox), gtk_image_new_from_pixbuf( |
54 |
icon_bearing(refpos, pos)),1,0,0); |
icon_bearing(refpos, pos)),1,0,0); |
55 |
|
|
56 |
if(refpos.lat && refpos.lon) { |
if(!isnan(refpos.lat) && !isnan(refpos.lon)) { |
57 |
gtk_box_pack_start_defaults(GTK_BOX(hbox), |
gtk_box_pack_start_defaults(GTK_BOX(hbox), |
58 |
GTK_LABEL_SMALL((char*)pos_get_bearing_str(refpos, pos))); |
GTK_LABEL_SMALL((char*)pos_get_bearing_str(refpos, pos))); |
59 |
snprintf(str, sizeof(str), _("%.1f°"), |
snprintf(str, sizeof(str), _("%.1f°"), |
92 |
(GtkCallback)gtk_widget_destroy, NULL); |
(GtkCallback)gtk_widget_destroy, NULL); |
93 |
|
|
94 |
/* update distance/etc */ |
/* update distance/etc */ |
95 |
bearing_fill_hbox(context->bearing_hbox, context->appdata, |
if(!isnan(context->cache->pos.lat) && |
96 |
*get_pos(context->appdata), notes_get_pos(context)); |
!isnan(context->cache->pos.lon)) |
97 |
|
bearing_fill_hbox(context->bearing_hbox, context->appdata, |
98 |
|
*get_pos(context->appdata), notes_get_pos(context)); |
99 |
|
|
100 |
gtk_widget_show_all(context->bearing_hbox); |
gtk_widget_show_all(context->bearing_hbox); |
101 |
} |
} |
102 |
|
|
215 |
context->pos_lon_label = pos_lon(cache->pos.lon, SIZE_BIG, strike)); |
context->pos_lon_label = pos_lon(cache->pos.lon, SIZE_BIG, strike)); |
216 |
|
|
217 |
/* but calculations may be done with respect to the overriden one */ |
/* but calculations may be done with respect to the overriden one */ |
218 |
context->bearing_hbox = gtk_hbox_new(FALSE, 0); |
if(!isnan(cache->pos.lat) && !isnan(cache->pos.lon)) { |
219 |
bearing_fill_hbox(context->bearing_hbox, appdata, *refpos, |
context->bearing_hbox = gtk_hbox_new(FALSE, 0); |
220 |
gpx_cache_pos(cache)); |
bearing_fill_hbox(context->bearing_hbox, appdata, *refpos, |
221 |
gtk_box_pack_start_defaults(GTK_BOX(ivbox), context->bearing_hbox); |
gpx_cache_pos(cache)); |
222 |
|
gtk_box_pack_start_defaults(GTK_BOX(ivbox), context->bearing_hbox); |
223 |
|
} |
224 |
|
|
225 |
gtk_table_attach_defaults(GTK_TABLE(table), ivbox, 3,4,0,2); |
gtk_table_attach_defaults(GTK_TABLE(table), ivbox, 3,4,0,2); |
226 |
|
|
239 |
|
|
240 |
/* slow but short, we don't need performance here ... */ |
/* slow but short, we don't need performance here ... */ |
241 |
static void rot13(char *t) { |
static void rot13(char *t) { |
242 |
|
int braces = 0; |
243 |
|
|
244 |
while(*t) { |
while(*t) { |
245 |
if(((*t >= 'a') && (*t < 'n')) || |
if(!braces) { |
246 |
((*t >= 'A') && (*t < 'N'))) *t += 13; |
if(*t == '[') |
247 |
else if(((*t >= 'n') && (*t <= 'z')) || |
braces++; |
248 |
((*t >= 'N') && (*t <= 'Z'))) *t -= 13; |
else if(((*t >= 'a') && (*t < 'n')) || |
249 |
|
((*t >= 'A') && (*t < 'N'))) *t += 13; |
250 |
|
else if(((*t >= 'n') && (*t <= 'z')) || |
251 |
|
((*t >= 'N') && (*t <= 'Z'))) *t -= 13; |
252 |
|
} else { |
253 |
|
if(braces > 0 && *t == ']') |
254 |
|
braces--; |
255 |
|
} |
256 |
|
|
257 |
t++; |
t++; |
258 |
} |
} |
363 |
GtkTextBuffer *buffer = gtk_text_buffer_new(NULL); |
GtkTextBuffer *buffer = gtk_text_buffer_new(NULL); |
364 |
gtk_text_buffer_set_text(buffer, wpt->desc, strlen(wpt->desc)); |
gtk_text_buffer_set_text(buffer, wpt->desc, strlen(wpt->desc)); |
365 |
|
|
366 |
#ifndef USE_MAEMO |
#ifndef USE_HILDON_TEXT_VIEW |
367 |
GtkWidget *textview = gtk_text_view_new_with_buffer(buffer); |
GtkWidget *textview = gtk_text_view_new_with_buffer(buffer); |
368 |
#else |
#else |
369 |
GtkWidget *textview = hildon_text_view_new(); |
GtkWidget *textview = hildon_text_view_new(); |
382 |
if(wpt->cmt) { |
if(wpt->cmt) { |
383 |
GtkTextBuffer *buffer = gtk_text_buffer_new(NULL); |
GtkTextBuffer *buffer = gtk_text_buffer_new(NULL); |
384 |
gtk_text_buffer_set_text(buffer, wpt->cmt, strlen(wpt->cmt)); |
gtk_text_buffer_set_text(buffer, wpt->cmt, strlen(wpt->cmt)); |
385 |
#ifndef USE_MAEMO |
#ifndef USE_HILDON_TEXT_VIEW |
386 |
GtkWidget *textview = gtk_text_view_new_with_buffer(buffer); |
GtkWidget *textview = gtk_text_view_new_with_buffer(buffer); |
387 |
#else |
#else |
388 |
GtkWidget *textview = hildon_text_view_new(); |
GtkWidget *textview = hildon_text_view_new(); |
679 |
|
|
680 |
#else |
#else |
681 |
#ifdef USE_STACKABLE_WINDOW |
#ifdef USE_STACKABLE_WINDOW |
682 |
|
static void on_cache_destroy (GtkWidget *widget, appdata_t *appdata) { |
683 |
|
appdata->cur_cache = NULL; |
684 |
|
|
685 |
|
/* restore cur_view */ |
686 |
|
appdata->cur_view = g_object_get_data(G_OBJECT(widget), "cur_view"); |
687 |
|
} |
688 |
|
|
689 |
void cache_dialog(appdata_t *appdata, cache_t *cache) { |
void cache_dialog(appdata_t *appdata, cache_t *cache) { |
690 |
GtkWidget *window = hildon_stackable_window_new(); |
GtkWidget *window = hildon_stackable_window_new(); |
691 |
|
|
692 |
gtk_window_set_title(GTK_WINDOW(window), cache->name); |
/* store last "cur_view" in window */ |
693 |
|
g_object_set_data(G_OBJECT(window), "cur_view", appdata->cur_view); |
694 |
|
|
695 |
|
appdata->cur_cache = cache; |
696 |
|
char *title = g_strdup_printf("%s - GPXView", cache->name); |
697 |
|
gtk_window_set_title(GTK_WINDOW(window), title); |
698 |
|
g_free(title); |
699 |
|
|
700 |
/* create cache visualization widget */ |
/* create cache visualization widget */ |
701 |
gtk_container_add(GTK_CONTAINER(window), |
appdata->cur_view = cache_view(appdata, cache); |
702 |
cache_view(appdata, cache)); |
gtk_container_add(GTK_CONTAINER(window), appdata->cur_view); |
703 |
|
|
704 |
|
hildon_window_set_app_menu(HILDON_WINDOW(window), |
705 |
|
menu_create(appdata, MENU_CACHE)); |
706 |
|
|
707 |
|
g_signal_connect(G_OBJECT(window), "destroy", |
708 |
|
G_CALLBACK(on_cache_destroy), appdata); |
709 |
|
|
710 |
gtk_widget_show_all(window); |
gtk_widget_show_all(window); |
711 |
} |
} |