35 |
{ NULL, WPT_SYM_MAX+1 }, /* ICON_WPT */ |
{ NULL, WPT_SYM_MAX+1 }, /* ICON_WPT */ |
36 |
{ NULL, 2 }, /* ICON_TB */ |
{ NULL, 2 }, /* ICON_TB */ |
37 |
{ NULL, 8 }, /* ICON_MISC */ |
{ NULL, 8 }, /* ICON_MISC */ |
38 |
{ NULL, WPT_SYM_MAX+CACHE_TYPE_MAX+7 }, /* 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", |
108 |
|
|
109 |
/* ICON_MISC */ |
/* ICON_MISC */ |
110 |
const char *misc_icon_name[] = { |
const char *misc_icon_name[] = { |
111 |
"maemo-mapper-out", "locked", "unlocked", |
"locked", "unlocked", "delete", |
|
"maemo-mapper-in", "delete", |
|
112 |
#ifdef FREMANTLE |
#ifdef FREMANTLE |
113 |
"64x64/paypal", |
"64x64/paypal", |
114 |
#else |
#else |
120 |
#else |
#else |
121 |
"32x32/gpxview", |
"32x32/gpxview", |
122 |
#endif |
#endif |
123 |
|
#ifndef USE_MAEMO |
124 |
|
"16x16/speaker", "16x16/speaker_off", |
125 |
|
#else |
126 |
|
#ifndef FREMANTLE |
127 |
|
"24x24/speaker", "24x24/speaker_off", |
128 |
|
#else |
129 |
|
"32x32/speaker", "32x32/speaker_off", |
130 |
|
#endif |
131 |
|
#endif |
132 |
|
|
133 |
NULL |
NULL |
134 |
}; |
}; |
135 |
|
|
143 |
"cache_type_letterbox", "cache_type_earthcache", "cache_type_wherigo", |
"cache_type_letterbox", "cache_type_earthcache", "cache_type_wherigo", |
144 |
"cache_type_megaevent", "cache_type_cito", |
"cache_type_megaevent", "cache_type_cito", |
145 |
|
|
146 |
"pos_btn", "pos_gps", "pos_geomath", "pos_map", "pos_home", |
"pos_wpt", "pos_gps", "pos_geomath", "pos_map", "pos_home", |
147 |
|
|
148 |
|
"pos_get", "pos_set", "maemo-mapper", "clipboard", |
149 |
|
|
150 |
NULL |
NULL |
151 |
}; |
}; |
152 |
|
|
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 |
} |
} |
243 |
icons_load(ICON_MISC, "%s.%s", misc_icon_name); |
icons_load(ICON_MISC, "%s.%s", misc_icon_name); |
244 |
|
|
245 |
/* load pos icons */ |
/* load pos icons */ |
246 |
#if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5) |
#if !defined(USE_MAEMO) |
247 |
icons_load(ICON_POS, "16x16/%s.%s", pos_icon_name); |
icons_load(ICON_POS, "16x16/%s.%s", pos_icon_name); |
248 |
#else |
#else |
249 |
|
#if (MAEMO_VERSION_MAJOR < 5) |
250 |
|
icons_load(ICON_POS, "24x24/%s.%s", pos_icon_name); |
251 |
|
#else |
252 |
icons_load(ICON_POS, "32x32/%s.%s", pos_icon_name); |
icons_load(ICON_POS, "32x32/%s.%s", pos_icon_name); |
253 |
#endif |
#endif |
254 |
|
#endif |
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)) |