37 |
{ NULL, 8 }, /* ICON_MISC */ |
{ NULL, 8 }, /* ICON_MISC */ |
38 |
{ NULL, WPT_SYM_MAX+CACHE_TYPE_MAX+11 },/* ICON_POS */ |
{ NULL, WPT_SYM_MAX+CACHE_TYPE_MAX+11 },/* ICON_POS */ |
39 |
{ NULL, 3 }, /* ICON_FILE */ |
{ NULL, 3 }, /* ICON_FILE */ |
40 |
|
{ NULL, 46 }, /* ICON_ATT */ |
41 |
{ NULL, -1 } |
{ NULL, -1 } |
42 |
}; |
}; |
43 |
|
|
44 |
|
/* ICON_ATT */ |
45 |
|
static const char *att_icon_name[] = { |
46 |
|
"no", "unknown", |
47 |
|
"dogs", "fee", "rappelling", "boat", // 1-4 |
48 |
|
"scuba", "kids", "onehour", "scenic", "hiking", // 5-9 |
49 |
|
"climbing", "wading", "swimming", "available", "night", // 10-14 |
50 |
|
"winter", "unknown", "poisonoak", "snakes", "ticks", // 15-19 |
51 |
|
"mine", "cliff", "hunting", "danger", "wheelchair", // 20-24 |
52 |
|
"parking", "public", "water", "restrooms", "phone", // 25-29 |
53 |
|
"picnic", "camping", "bicycles", "motorcycles", "quads", // 30-34 |
54 |
|
"jeeps", "snowmobiles", "horses", "campfires", "thorn", // 35-39 |
55 |
|
"stealth", "stroller", "firstaid", "cow", "flashlight", // 40-44 |
56 |
|
|
57 |
|
NULL |
58 |
|
}; |
59 |
|
|
60 |
/* ICON_CACHE_TYPE / ICON_CACHE_TYPE_SEMI / ICON_CACHE_TYPE_2X */ |
/* ICON_CACHE_TYPE / ICON_CACHE_TYPE_SEMI / ICON_CACHE_TYPE_2X */ |
61 |
const char *cache_type_icon_name[] = { |
const char *cache_type_icon_name[] = { |
62 |
"traditional", "multi", "mystery", "virtual", "webcam", "event", |
"traditional", "multi", "mystery", "virtual", "webcam", "event", |
185 |
|
|
186 |
if(error) { |
if(error) { |
187 |
icons[type].data[i] = NULL; |
icons[type].data[i] = NULL; |
188 |
g_warning("Could not load cache type icon %s: %s\n", |
g_warning("Could not load icon %s: %s\n", names[i], error->message); |
|
names[i], error->message); |
|
189 |
g_error_free(error); |
g_error_free(error); |
190 |
error = NULL; |
error = NULL; |
191 |
} |
} |
255 |
|
|
256 |
/* load file icons */ |
/* load file icons */ |
257 |
icons_load(ICON_FILE, "file_%s.%s", file_icon_name); |
icons_load(ICON_FILE, "file_%s.%s", file_icon_name); |
258 |
|
|
259 |
|
/* load attribute icons */ |
260 |
|
icons_load(ICON_ATT, "32x32/att_%s.%s", att_icon_name); |
261 |
} |
} |
262 |
|
|
263 |
void icons_free(void) { |
void icons_free(void) { |
291 |
return gtk_image_new_from_pixbuf(pbuf); |
return gtk_image_new_from_pixbuf(pbuf); |
292 |
} |
} |
293 |
|
|
294 |
|
/* routine to overlay two pixbufs */ |
295 |
|
GdkPixbuf *pixbuf_overlay(GdkPixbuf *bot, GdkPixbuf *top) { |
296 |
|
GdkPixbuf *pix = gdk_pixbuf_copy(bot); |
297 |
|
|
298 |
|
gdk_pixbuf_composite(top, pix, |
299 |
|
0, 0, gdk_pixbuf_get_width(bot), gdk_pixbuf_get_height(bot), |
300 |
|
0.0, 0.0, 1.0, 1.0, GDK_INTERP_NEAREST, 255); |
301 |
|
|
302 |
|
return pix; |
303 |
|
} |
304 |
|
|
305 |
|
GtkWidget *icon_get_widget_ovl(int type, int num, int ovl) { |
306 |
|
GdkPixbuf *pbuf0 = icon_get(type, num); |
307 |
|
GdkPixbuf *pbuf1 = icon_get(type, ovl); |
308 |
|
if(!pbuf0 || !pbuf1) return NULL; |
309 |
|
|
310 |
|
GdkPixbuf *pbuf = pixbuf_overlay(pbuf0, pbuf1); |
311 |
|
GtkWidget *widget = gtk_image_new_from_pixbuf(pbuf); |
312 |
|
|
313 |
|
/* widget now holds a reference */ |
314 |
|
gdk_pixbuf_unref(pbuf); |
315 |
|
|
316 |
|
return widget; |
317 |
|
} |
318 |
|
|
319 |
GdkPixbuf *icon_bearing(pos_t from, pos_t to) { |
GdkPixbuf *icon_bearing(pos_t from, pos_t to) { |
320 |
if(isnan(from.lat) || isnan(from.lon) || |
if(isnan(from.lat) || isnan(from.lon) || |
321 |
isnan(to.lat) || isnan(to.lon)) |
isnan(to.lat) || isnan(to.lon)) |