42 |
#endif |
#endif |
43 |
|
|
44 |
static const char *cache_size_name[] = { |
static const char *cache_size_name[] = { |
45 |
"Regular", "Small", "Micro", "Other", |
"Regular", "Small", "Micro", "Other", "Not chosen", "Large", "Virtual" |
|
"Not chosen", "Large", "Virtual" |
|
46 |
}; |
}; |
47 |
|
|
48 |
void bearing_fill_hbox(GtkWidget *hbox, |
void bearing_fill_hbox(GtkWidget *hbox, |
51 |
|
|
52 |
if(!isnan(pos.lat) && !isnan(pos.lon)) { |
if(!isnan(pos.lat) && !isnan(pos.lon)) { |
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)),TRUE,FALSE,0); |
55 |
|
|
56 |
if(!isnan(refpos.lat) && !isnan(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 |
|
gtk_box_pack_start_defaults(GTK_BOX(hbox), GTK_LABEL_SMALL(" ")); |
60 |
snprintf(str, sizeof(str), _("%.1f°"), |
snprintf(str, sizeof(str), _("%.1f°"), |
61 |
gpx_pos_get_bearing(refpos, pos)); |
gpx_pos_get_bearing(refpos, pos)); |
62 |
gtk_box_pack_start_defaults(GTK_BOX(hbox), GTK_LABEL_SMALL(str)); |
gtk_box_pack_start_defaults(GTK_BOX(hbox), GTK_LABEL_SMALL(str)); |
63 |
gpx_pos_get_distance_str(str, sizeof(str), |
gpx_pos_get_distance_str(str, sizeof(str), |
64 |
refpos, pos, appdata->imperial); |
refpos, pos, appdata->imperial); |
65 |
|
gtk_box_pack_start_defaults(GTK_BOX(hbox), GTK_LABEL_SMALL(" ")); |
66 |
gtk_box_pack_start(GTK_BOX(hbox), |
gtk_box_pack_start(GTK_BOX(hbox), |
67 |
gtk_label_attrib(str, SIZE_SMALL, STRIKETHROUGH_NONE),1,0,0); |
gtk_label_attrib(str, SIZE_SMALL, STRIKETHROUGH_NONE),TRUE,FALSE,0); |
68 |
} else |
} else |
69 |
gtk_box_pack_start(GTK_BOX(hbox), |
gtk_box_pack_start(GTK_BOX(hbox), |
70 |
gtk_label_attrib(_("(no position)"), |
gtk_label_attrib(_("(no position)"), |
71 |
SIZE_SMALL, STRIKETHROUGH_NONE),1,0,0); |
SIZE_SMALL, STRIKETHROUGH_NONE),TRUE,FALSE,0); |
72 |
} else |
} else |
73 |
gtk_box_pack_start(GTK_BOX(hbox), |
gtk_box_pack_start(GTK_BOX(hbox), |
74 |
gtk_label_attrib(_("(invalid position in notes)"), |
gtk_label_attrib(_("(invalid position in notes)"), |
75 |
SIZE_SMALL, STRIKETHROUGH_NONE),1,0,0); |
SIZE_SMALL, STRIKETHROUGH_NONE),TRUE,FALSE,0); |
76 |
} |
} |
77 |
|
|
78 |
/* this function sets everthing related to the coordinate. used to */ |
/* this function sets everything related to the coordinate. used to */ |
79 |
/* cope with the user setting a new "note coordinate" */ |
/* cope with the user setting a new "note coordinate" */ |
80 |
void overview_coordinate_update(cache_context_t *context) { |
void overview_coordinate_update(cache_context_t *context) { |
81 |
if(!context->notes.modified) |
if(!context->notes.modified) |
164 |
context->gcvote_request = NULL; |
context->gcvote_request = NULL; |
165 |
} |
} |
166 |
|
|
167 |
|
static void pack_vcentered(GtkWidget *vbox, GtkWidget *child) { |
168 |
|
GtkWidget *align = gtk_alignment_new(0.5, 0.5, 0.0, 0.0); |
169 |
|
gtk_container_add(GTK_CONTAINER(align), child); |
170 |
|
gtk_box_pack_start_defaults(GTK_BOX(vbox), align); |
171 |
|
} |
172 |
|
|
173 |
static GtkWidget *cache_overview(cache_context_t *context) { |
static GtkWidget *cache_overview(cache_context_t *context) { |
174 |
GtkWidget *vbox, *ivbox; |
GtkWidget *vbox, *ivbox; |
175 |
GtkWidget *table, *tip; |
GtkWidget *colbox, *tip; |
176 |
char str[64]; |
char str[64]; |
177 |
#ifndef USE_MAEMO |
#ifndef USE_MAEMO |
178 |
GtkTooltips *tips = gtk_tooltips_new(); |
GtkTooltips *tips = gtk_tooltips_new(); |
180 |
appdata_t *appdata = context->appdata; |
appdata_t *appdata = context->appdata; |
181 |
cache_t *cache = context->cache; |
cache_t *cache = context->cache; |
182 |
|
|
183 |
vbox = gtk_vbox_new(FALSE, 0); |
vbox = gtk_vbox_new(FALSE, 4); |
184 |
|
|
185 |
|
/* hbox containing the four columns of cache details */ |
186 |
|
GtkWidget *ihbox = gtk_hbox_new(FALSE, 0); |
187 |
|
|
188 |
table = gtk_table_new(3,4, FALSE); |
/* vbox containing leftmost column (icon and container) */ |
189 |
|
colbox = gtk_vbox_new(FALSE, 0); |
190 |
|
|
191 |
if(cache->type != CACHE_TYPE_UNKNOWN) { |
if(cache->type != CACHE_TYPE_UNKNOWN) { |
192 |
gtk_table_attach(GTK_TABLE(table), |
gtk_box_pack_start_defaults(GTK_BOX(colbox), |
193 |
|
|
194 |
#if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5) |
#if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5) |
195 |
tip = icon_get_widget(ICON_CACHE_TYPE_2X, cache->type), |
tip = icon_get_widget(ICON_CACHE_TYPE_2X, cache->type)); |
196 |
#else |
#else |
197 |
tip = icon_get_widget(ICON_CACHE_TYPE_1_5X, cache->type), |
tip = icon_get_widget(ICON_CACHE_TYPE_1_5X, cache->type)); |
198 |
#endif |
#endif |
|
0,1,0,1, GTK_FILL, 0, GTK_FILL, 0); |
|
199 |
|
|
200 |
#ifndef USE_MAEMO |
#ifndef USE_MAEMO |
201 |
gtk_tooltips_set_tip(tips, tip, _(cache_type_tip[cache->type]), NULL); |
gtk_tooltips_set_tip(tips, tip, _(cache_type_tip[cache->type]), NULL); |
211 |
gtk_box_pack_start(GTK_BOX(ivbox), |
gtk_box_pack_start(GTK_BOX(ivbox), |
212 |
icon_get_widget(ICON_CACHE_SIZE, cache->container), |
icon_get_widget(ICON_CACHE_SIZE, cache->container), |
213 |
FALSE, FALSE, 0); |
FALSE, FALSE, 0); |
214 |
gtk_table_attach(GTK_TABLE(table), ivbox, 0,1,1,2, |
|
215 |
GTK_EXPAND | GTK_FILL, 0, GTK_FILL, 0); |
pack_vcentered(colbox, ivbox); |
216 |
#ifndef USE_MAEMO |
#ifndef USE_MAEMO |
217 |
gtk_tooltips_set_tip(tips, ivbox, _(cache_size_tip[cache->container]), NULL); |
gtk_tooltips_set_tip(tips, ivbox, _(cache_size_tip[cache->container]), NULL); |
218 |
#endif |
#endif |
219 |
} |
} |
220 |
|
|
221 |
|
gtk_box_pack_start_defaults(GTK_BOX(ihbox), colbox); |
222 |
|
colbox = gtk_vbox_new(FALSE, 0); |
223 |
|
|
224 |
/* ----------------------- id ---------------------------- */ |
/* ----------------------- id ---------------------------- */ |
225 |
if(cache->id) { |
if(cache->id) { |
226 |
int strike = cache->archived?STRIKETHROUGH_RED: |
int strike = cache->archived?STRIKETHROUGH_RED: |
228 |
GtkWidget *lbl = link_button_attrib(context->appdata, |
GtkWidget *lbl = link_button_attrib(context->appdata, |
229 |
cache->id, context->cache->url, |
cache->id, context->cache->url, |
230 |
SIZE_BIG, strike); |
SIZE_BIG, strike); |
231 |
gtk_table_attach(GTK_TABLE(table), lbl, 1,2,0,1, FALSE, FALSE, 0, 0); |
pack_vcentered(colbox, lbl); |
232 |
} |
} |
233 |
|
|
234 |
/* --------------- box containing owner info ------------- */ |
/* --------------- box containing owner info ------------- */ |
235 |
if(cache->owner) { |
if(cache->owner) { |
236 |
ivbox = gtk_vbox_new(FALSE, 0); |
gtk_box_pack_start_defaults(GTK_BOX(colbox), GTK_LABEL_SMALL(_("by"))); |
|
gtk_box_pack_start_defaults(GTK_BOX(ivbox), GTK_LABEL_SMALL(_("by"))); |
|
237 |
|
|
238 |
static const char *owner_type = "profile/"; |
static const char *owner_type = "profile/"; |
239 |
gtk_box_pack_start_defaults(GTK_BOX(ivbox), |
pack_vcentered(colbox, |
240 |
link_button_by_id(appdata, cache->owner->name, |
link_button_by_id(appdata, cache->owner->name, |
241 |
owner_type, cache->owner->id)); |
owner_type, cache->owner->id)); |
|
gtk_table_attach(GTK_TABLE(table), ivbox, 1,2,1,2, FALSE,FALSE,0,0); |
|
242 |
} |
} |
243 |
|
|
244 |
|
gtk_box_pack_start_defaults(GTK_BOX(ihbox), colbox); |
245 |
|
|
246 |
/* ----------- vbox containing all ratings ---------- */ |
/* ----------- vbox containing all ratings ---------- */ |
247 |
GtkWidget *ratebox = gtk_vbox_new(FALSE, 0); |
colbox = gtk_vbox_new(FALSE, 0); |
248 |
|
|
249 |
/* ----------- box containing difficulty rating ---------- */ |
/* ----------- box containing difficulty rating ---------- */ |
250 |
if(cache->difficulty != 0) { |
if(cache->difficulty != 0) { |
256 |
icon_get_widget(ICON_STARS, (int)(cache->difficulty*2-2)), |
icon_get_widget(ICON_STARS, (int)(cache->difficulty*2-2)), |
257 |
FALSE, FALSE, 0); |
FALSE, FALSE, 0); |
258 |
|
|
259 |
GtkWidget *align = gtk_alignment_new(0.5, 0.5, 0.0, 0.0); |
pack_vcentered(colbox, ivbox); |
|
gtk_container_add(GTK_CONTAINER(align), ivbox); |
|
|
gtk_box_pack_start_defaults(GTK_BOX(ratebox), align); |
|
260 |
#ifndef USE_MAEMO |
#ifndef USE_MAEMO |
261 |
sprintf(str, _("Difficulty: %.1f"), cache->difficulty); |
sprintf(str, _("Difficulty: %.1f"), cache->difficulty); |
262 |
gtk_tooltips_set_tip(tips, ivbox, str, NULL); |
gtk_tooltips_set_tip(tips, ivbox, str, NULL); |
271 |
gtk_box_pack_start(GTK_BOX(ivbox), |
gtk_box_pack_start(GTK_BOX(ivbox), |
272 |
icon_get_widget(ICON_STARS, (int)(cache->terrain*2-2)), |
icon_get_widget(ICON_STARS, (int)(cache->terrain*2-2)), |
273 |
FALSE, FALSE, 0); |
FALSE, FALSE, 0); |
274 |
GtkWidget *align = gtk_alignment_new(0.5, 0.5, 0.0, 0.0); |
pack_vcentered(colbox, ivbox); |
|
gtk_container_add(GTK_CONTAINER(align), ivbox); |
|
|
gtk_box_pack_start_defaults(GTK_BOX(ratebox), align); |
|
275 |
#ifndef USE_MAEMO |
#ifndef USE_MAEMO |
276 |
sprintf(str, _("Terrain: %.1f"), cache->terrain); |
sprintf(str, _("Terrain: %.1f"), cache->terrain); |
277 |
gtk_tooltips_set_tip(tips, ivbox, str, NULL); |
gtk_tooltips_set_tip(tips, ivbox, str, NULL); |
286 |
gcvote_request(appdata, gcvote_callback, cache->url, context); |
gcvote_request(appdata, gcvote_callback, cache->url, context); |
287 |
|
|
288 |
context->votebox = gtk_vbox_new(FALSE, 0); |
context->votebox = gtk_vbox_new(FALSE, 0); |
289 |
GtkWidget *align = gtk_alignment_new(0.5, 0.5, 0.0, 0.0); |
pack_vcentered(colbox, context->votebox); |
|
gtk_container_add(GTK_CONTAINER(align), context->votebox); |
|
|
gtk_box_pack_start_defaults(GTK_BOX(ratebox), align); |
|
290 |
|
|
291 |
/* fill with vote if present on disk (will also free vote) */ |
/* fill with vote if present on disk (will also free vote) */ |
292 |
if(vote) |
if(vote) |
293 |
gcvote_set(context, vote); |
gcvote_set(context, vote); |
294 |
} |
} |
295 |
|
|
296 |
gtk_table_attach_defaults(GTK_TABLE(table), ratebox, 2,3,0,2); |
gtk_box_pack_start_defaults(GTK_BOX(ihbox), colbox); |
297 |
|
|
298 |
/* ----------------------------------------------------- */ |
/* ----------------------------------------------------- */ |
299 |
|
|
300 |
|
|
301 |
/* ----------------- the two coordinates ----------------- */ |
/* ----------------- the two coordinates ----------------- */ |
302 |
/* ----------------- and the heading/distance ------------ */ |
/* ----------------- and the heading/distance ------------ */ |
303 |
|
colbox = gtk_vbox_new(FALSE, 0); |
304 |
|
|
305 |
pos_t *refpos = get_pos(appdata); |
pos_t *refpos = get_pos(appdata); |
306 |
|
|
307 |
ivbox = gtk_vbox_new(FALSE, 0); |
ivbox = gtk_vbox_new(FALSE, 0); |
309 |
STRIKETHROUGH:STRIKETHROUGH_NONE; |
STRIKETHROUGH:STRIKETHROUGH_NONE; |
310 |
|
|
311 |
/* the original coordinate is being displayed */ |
/* the original coordinate is being displayed */ |
312 |
gtk_box_pack_start_defaults(GTK_BOX(ivbox), |
gtk_box_pack_start(GTK_BOX(ivbox), |
313 |
context->pos_lat_label = pos_lat(cache->pos.lat, SIZE_BIG, strike)); |
context->pos_lat_label = pos_lat(cache->pos.lat, SIZE_BIG, strike), FALSE, FALSE, 0); |
314 |
gtk_box_pack_start_defaults(GTK_BOX(ivbox), |
gtk_box_pack_start(GTK_BOX(ivbox), |
315 |
context->pos_lon_label = pos_lon(cache->pos.lon, SIZE_BIG, strike)); |
context->pos_lon_label = pos_lon(cache->pos.lon, SIZE_BIG, strike), FALSE, FALSE, 0); |
316 |
|
|
317 |
|
pack_vcentered(colbox, ivbox); |
318 |
|
|
319 |
/* but calculations may be done with respect to the overriden one */ |
/* but calculations may be done with respect to the overriden one */ |
320 |
if(!isnan(cache->pos.lat) && !isnan(cache->pos.lon)) { |
if(!isnan(cache->pos.lat) && !isnan(cache->pos.lon)) { |
321 |
context->bearing_hbox = gtk_hbox_new(FALSE, 0); |
context->bearing_hbox = gtk_hbox_new(FALSE, 0); |
322 |
bearing_fill_hbox(context->bearing_hbox, appdata, *refpos, |
bearing_fill_hbox(context->bearing_hbox, appdata, *refpos, |
323 |
gpx_cache_pos(cache)); |
gpx_cache_pos(cache)); |
324 |
gtk_box_pack_start_defaults(GTK_BOX(ivbox), context->bearing_hbox); |
pack_vcentered(colbox, context->bearing_hbox); |
325 |
} |
} |
326 |
|
|
327 |
gtk_table_attach_defaults(GTK_TABLE(table), ivbox, 3,4,0,2); |
gtk_box_pack_start_defaults(GTK_BOX(ihbox), colbox); |
328 |
|
|
329 |
/* ----------------------------------------------------- */ |
/* ----------------------------------------------------- */ |
330 |
|
|
331 |
gtk_box_pack_start(GTK_BOX(vbox), table, 0,0,0); |
gtk_box_pack_start(GTK_BOX(vbox), ihbox, FALSE, FALSE, 0); |
332 |
gtk_box_pack_start(GTK_BOX(vbox), gtk_hseparator_new(),FALSE,FALSE,0); |
gtk_box_pack_start(GTK_BOX(vbox), gtk_hseparator_new(), FALSE, FALSE, 0); |
333 |
|
|
334 |
/* ----------------------------------------------------- */ |
/* ----------------------------------------------------- */ |
335 |
|
|
451 |
pos_lon(wpt->pos.lon, SIZE_BIG, STRIKETHROUGH_NONE), |
pos_lon(wpt->pos.lon, SIZE_BIG, STRIKETHROUGH_NONE), |
452 |
2,3, wpt_row, wpt_row+1); |
2,3, wpt_row, wpt_row+1); |
453 |
|
|
454 |
ihbox = gtk_hbox_new(FALSE, 0); |
if(refpos && !isnan(refpos->lat) && !isnan(refpos->lon)) { |
455 |
gtk_box_pack_start(GTK_BOX(ihbox), gtk_image_new_from_pixbuf( |
ihbox = gtk_hbox_new(FALSE, 0); |
456 |
|
gtk_box_pack_start(GTK_BOX(ihbox), gtk_image_new_from_pixbuf( |
457 |
icon_bearing(*refpos, wpt->pos)),1,0,0); |
icon_bearing(*refpos, wpt->pos)),1,0,0); |
458 |
gtk_box_pack_start_defaults(GTK_BOX(ihbox), |
snprintf(str, sizeof(str), _("%.1f°"), |
459 |
GTK_LABEL_SMALL((char*)pos_get_bearing_str(*refpos, wpt->pos))); |
gpx_pos_get_bearing(*refpos, wpt->pos)); |
460 |
snprintf(str, sizeof(str), _("%.1f°"), |
gtk_box_pack_start_defaults(GTK_BOX(ihbox), GTK_LABEL_SMALL(str)); |
461 |
gpx_pos_get_bearing(*refpos, wpt->pos)); |
|
462 |
gtk_box_pack_start_defaults(GTK_BOX(ihbox), GTK_LABEL_SMALL(str)); |
gpx_pos_get_distance_str(str, sizeof(str), |
463 |
gpx_pos_get_distance_str(str, sizeof(str), |
*refpos, wpt->pos, appdata->imperial); |
464 |
*refpos, wpt->pos, appdata->imperial); |
gtk_box_pack_start(GTK_BOX(ihbox), GTK_LABEL_SMALL(str),1,0,0); |
465 |
gtk_box_pack_start(GTK_BOX(ihbox), GTK_LABEL_SMALL(str),1,0,0); |
|
466 |
|
gtk_table_attach_defaults(GTK_TABLE(table), ihbox, 3,4, |
467 |
|
wpt_row+0, wpt_row+1); |
468 |
|
} |
469 |
|
|
|
gtk_table_attach_defaults(GTK_TABLE(table), ihbox, 3,4, |
|
|
wpt_row+0, wpt_row+1); |
|
|
|
|
470 |
/* ------------------ description ------------------------- */ |
/* ------------------ description ------------------------- */ |
471 |
if(wpt->desc) |
if(wpt->desc) |
472 |
gtk_table_attach_defaults(GTK_TABLE(table), |
gtk_table_attach_defaults(GTK_TABLE(table), |
608 |
gtk_signal_connect(GTK_OBJECT(but), "clicked", |
gtk_signal_connect(GTK_OBJECT(but), "clicked", |
609 |
GTK_SIGNAL_FUNC(on_gclink_clicked), context); |
GTK_SIGNAL_FUNC(on_gclink_clicked), context); |
610 |
|
|
611 |
gtk_box_pack_start_defaults(GTK_BOX(vbox), but); |
gtk_box_pack_start(GTK_BOX(vbox), but, FALSE, FALSE, 0); |
612 |
} |
} |
613 |
#endif |
#endif |
614 |
|
|
657 |
|
|
658 |
gtk_box_pack_start(GTK_BOX(ivbox), ihbox, FALSE, FALSE, 0); |
gtk_box_pack_start(GTK_BOX(ivbox), ihbox, FALSE, FALSE, 0); |
659 |
|
|
660 |
gtk_table_attach_defaults(GTK_TABLE(table), ivbox, 0, 1, |
gtk_table_attach(GTK_TABLE(table), ivbox, 0, 1, |
661 |
2*log_cnt, 2*log_cnt+1); |
2*log_cnt, 2*log_cnt+1, 0, GTK_EXPAND | GTK_FILL, 0, 0); |
662 |
|
|
663 |
if(log->text) { |
if(log->text) { |
664 |
gtk_table_attach_defaults(GTK_TABLE(table), |
gtk_table_attach_defaults(GTK_TABLE(table), |
665 |
html_view(appdata, log->text, |
html_view(appdata, log->text, |
680 |
log_cnt++; |
log_cnt++; |
681 |
} |
} |
682 |
|
|
683 |
gtk_box_pack_start_defaults(GTK_BOX(vbox), table); |
gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); |
684 |
|
|
685 |
#ifndef USE_PANNABLE_AREA |
#ifndef USE_PANNABLE_AREA |
686 |
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window), |
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window), |