Add a unit test for VikGotoXmlTool
[viking/guyou.git] / src / garminsymbols.c
blobd44e4407a3d771c465cb96db4330656e5aa03645
1 /*
2 * viking -- GPS Data and Topo Analyzer, Explorer, and Manager
4 * Copyright (C) 2003-2005, Evan Battaglia <gtoevan@gmx.net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "viking.h"
23 #include "garminsymbols.h"
24 #include "icons/icons.h"
26 #include <string.h>
27 #include <stdlib.h>
29 static struct {
30 gchar *sym; /* icon names used by gpsbabel, garmin */
31 gchar *old_sym; /* keep backward compatible */
32 gint num;
33 gchar *desc;
34 const GdkPixdata *data;
35 const GdkPixdata *data_large;
36 GdkPixbuf *icon;
37 } garmin_syms[] = {
38 /* "sym" are in all lower case. This is because viking convert symbol
39 * names to lowercase when reading gpx files (see gpx.c:gpx_end()).
40 * This method works with gpsbable (when viking upload back to GPS
41 * device), but I don't know it works with other application.
42 * The method (lower case for sym, that is) is more eficient but if
43 * it is not compatible to all application, change sym to the right
44 * case (see http://www.gpsbabel.org/) change gpx.c not to convert
45 * symbol to lower case and use g_utf8_casefold() in key_equal_func
46 * for g_hash_table_new_full() (see init_icons() in this file).
47 * Quy Tonthat <qtonthat@gmail.com>
49 /*---------------------------------------------------------------
50 Marine symbols
51 ---------------------------------------------------------------*/
52 { "marina", "anchor", 0, "white anchor symbol", &wp_anchor_pixbuf, &wp_anchor_large_pixbuf, NULL },
53 { "bell", "bell", 1, "white bell symbol", &wp_bell_pixbuf, &wp_bell_large_pixbuf, NULL },
54 { "green diamon", "diamond_grn", 2, "green diamond symbol", &wp_diamond_grn_pixbuf, NULL, NULL },
55 { "red diamon", "diamond_red", 3, "red diamond symbol", &wp_diamond_red_pixbuf, NULL, NULL },
56 { "diver down flag 1", "dive1", 4, "diver down flag 1", &wp_dive1_pixbuf, &wp_dive1_large_pixbuf, NULL },
57 { "diver down flag 2", "dive2", 5, "diver down flag 2", &wp_dive2_pixbuf, &wp_dive2_large_pixbuf, NULL },
58 { "bank", "dollar", 6, "white dollar symbol", &wp_dollar_pixbuf, &wp_dollar_large_pixbuf, NULL },
59 { "fishing area", "fish", 7, "white fish symbol", &wp_fish_pixbuf, &wp_fish_large_pixbuf, NULL },
60 { "gas station", "fuel", 8, "white fuel symbol", &wp_fuel_pixbuf, &wp_fuel_large_pixbuf, NULL },
61 { "horn", "horn", 9, "white horn symbol", &wp_horn_pixbuf, &wp_horn_large_pixbuf, NULL },
62 { "residence", "house", 10, "white house symbol", &wp_house_pixbuf, &wp_house_large_pixbuf, NULL },
63 { "restaurant", "knife", 11, "white knife & fork symbol", &wp_knife_pixbuf, &wp_knife_large_pixbuf, NULL },
64 { "light", "light", 12, "white light symbol", &wp_light_pixbuf, &wp_light_large_pixbuf, NULL },
65 { "bar", "mug", 13, "white mug symbol", &wp_mug_pixbuf, &wp_mug_large_pixbuf, NULL },
66 { "skull and crossbones", "skull", 14, "white skull and crossbones symbol", &wp_skull_pixbuf, &wp_skull_large_pixbuf, NULL },
67 { "green square", "square_grn", 15, "green square symbol", &wp_square_grn_pixbuf, NULL, NULL },
68 { "red square", "square_red", 16, "red square symbol", &wp_square_red_pixbuf, NULL, NULL },
69 { "white buoy", "wbuoy", 17, "white buoy waypoint symbol", &wp_wbuoy_pixbuf, &wp_wbuoy_large_pixbuf, NULL },
70 { "waypoint", "wpt_dot", 18, "waypoint dot", &wp_wpt_dot_pixbuf, NULL, NULL },
71 { "shipwreck", "wreck", 19, "white wreck symbol", &wp_wreck_pixbuf, &wp_wreck_large_pixbuf, NULL },
72 { "none", "null", 20, "null symbol (transparent)", &wp_null_pixbuf, NULL, NULL },
73 { "man overboard", "mob", 21, "man overboard symbol", &wp_mob_pixbuf, &wp_mob_large_pixbuf, NULL },
74 { "navaid, amber", "buoy_ambr", 22, "amber map buoy symbol", &wp_buoy_ambr_pixbuf, &wp_buoy_ambr_large_pixbuf, NULL },
75 { "navaid, black", "buoy_blck", 23, "black map buoy symbol", &wp_buoy_blck_pixbuf, &wp_buoy_blck_large_pixbuf, NULL },
76 { "navaid, blue", "buoy_blue", 24, "blue map buoy symbol", &wp_buoy_blue_pixbuf, &wp_buoy_blue_large_pixbuf, NULL },
77 { "navaid, green", "buoy_grn", 25, "green map buoy symbol", &wp_buoy_grn_pixbuf, &wp_buoy_grn_large_pixbuf, NULL },
78 { "navaid, green/Red", "buoy_grn_red", 26, "green/red map buoy symbol", &wp_buoy_grn_red_pixbuf, &wp_buoy_grn_red_large_pixbuf, NULL },
79 { "navaid, green/White", "buoy_grn_wht", 27, "green/white map buoy symbol", &wp_buoy_grn_wht_pixbuf, &wp_buoy_grn_wht_large_pixbuf, NULL },
80 { "navaid, orange", "buoy_orng", 28, "orange map buoy symbol", &wp_buoy_orng_pixbuf, &wp_buoy_orng_large_pixbuf, NULL },
81 { "navaid, red", "buoy_red", 29, "red map buoy symbol", &wp_buoy_red_pixbuf, &wp_buoy_red_large_pixbuf, NULL },
82 { "navaid, red/green", "buoy_red_grn", 30, "red/green map buoy symbol", &wp_buoy_red_grn_pixbuf, &wp_buoy_red_grn_large_pixbuf, NULL },
83 { "navaid, red/white", "buoy_red_wht", 31, "red/white map buoy symbol", &wp_buoy_red_wht_pixbuf, &wp_buoy_red_wht_large_pixbuf, NULL },
84 { "navaid, violet", "buoy_violet", 32, "violet map buoy symbol", &wp_buoy_violet_pixbuf, &wp_buoy_violet_large_pixbuf, NULL },
85 { "navaid, white", "buoy_wht", 33, "white map buoy symbol", &wp_buoy_wht_pixbuf, &wp_buoy_wht_large_pixbuf, NULL },
86 { "navaid, whit/green", "buoy_wht_grn", 34, "white/green map buoy symbol", &wp_buoy_wht_grn_pixbuf, &wp_buoy_wht_grn_large_pixbuf, NULL },
87 { "navaid, white/red", "buoy_wht_red", 35, "white/red map buoy symbol", &wp_buoy_wht_red_pixbuf, &wp_buoy_wht_red_large_pixbuf, NULL },
88 { "white dot", "dot", 36, "white dot symbol", &wp_dot_pixbuf, NULL, NULL },
89 { "radio beacon", "rbcn", 37, "radio beacon symbol", &wp_rbcn_pixbuf, &wp_rbcn_large_pixbuf, NULL },
90 { "boat ramp", "boat_ramp", 150, "boat ramp symbol", &wp_boat_ramp_pixbuf, &wp_boat_ramp_large_pixbuf, NULL },
91 { "campground", "camp", 151, "campground symbol", &wp_camp_pixbuf, &wp_camp_large_pixbuf, NULL },
92 { "restroom", "restrooms", 152, "restrooms symbol", &wp_restroom_pixbuf, &wp_restroom_large_pixbuf, NULL },
93 { "shower", "showers", 153, "shower symbol", &wp_shower_pixbuf, &wp_shower_large_pixbuf, NULL },
94 { "drinking water", "drinking_wtr", 154, "drinking water symbol", &wp_drinking_wtr_pixbuf, &wp_drinking_wtr_large_pixbuf, NULL },
95 { "telephone", "phone", 155, "telephone symbol", &wp_phone_pixbuf, &wp_phone_large_pixbuf, NULL },
96 { "medical facility", "1st_aid", 156, "first aid symbol", &wp_1st_aid_pixbuf, &wp_1st_aid_large_pixbuf, NULL },
97 { "information", "info", 157, "information symbol", &wp_info_pixbuf, &wp_info_large_pixbuf, NULL },
98 { "parking area", "parking", 158, "parking symbol", &wp_parking_pixbuf, &wp_parking_large_pixbuf, NULL },
99 { "park", "park", 159, "park symbol", &wp_park_pixbuf, &wp_park_large_pixbuf, NULL },
100 { "picnic area", "picnic", 160, "picnic symbol", &wp_picnic_pixbuf, &wp_picnic_large_pixbuf, NULL },
101 { "scenic", "scenic", 161, "scenic area symbol", &wp_scenic_pixbuf, &wp_scenic_large_pixbuf, NULL },
102 { "skiing area", "skiing", 162, "skiing symbol", &wp_skiing_pixbuf, &wp_skiing_large_pixbuf, NULL },
103 { "swimming area", "swimming", 163, "swimming symbol", &wp_swimming_pixbuf, &wp_swimming_large_pixbuf, NULL },
104 { "dam", "dam", 164, "dam symbol", &wp_dam_pixbuf, &wp_dam_large_pixbuf, NULL },
105 { "controlled area", "controlled", 165, "controlled area symbol", &wp_controlled_pixbuf, &wp_controlled_large_pixbuf, NULL },
106 { "danger area", "danger", 166, "danger symbol", &wp_danger_pixbuf, &wp_danger_large_pixbuf, NULL },
107 { "restricted area", "restricted", 167, "restricted area symbol", &wp_restricted_pixbuf, &wp_restricted_large_pixbuf, NULL },
108 { "null 2", "null_2", 168, "null symbol", NULL, NULL, NULL }, /* not exist */
109 { "ball park", "ball", 169, "ball symbol", &wp_ball_pixbuf, &wp_ball_large_pixbuf, NULL },
110 { "car", "car", 170, "car symbol", &wp_car_pixbuf, &wp_car_large_pixbuf, NULL },
111 { "hunting area", "deer", 171, "deer symbol", &wp_deer_pixbuf, &wp_deer_large_pixbuf, NULL },
112 { "shopping center", "shopping", 172, "shopping cart symbol", NULL, &wp_shopping_large_pixbuf, NULL },
113 { "lodging", "lodging", 173, "lodging symbol", NULL, &wp_lodging_large_pixbuf, NULL },
114 { "mine", "mine", 174, "mine symbol", &wp_mine_pixbuf, &wp_mine_large_pixbuf, NULL },
115 { "trail head", "trail_head", 175, "trail head symbol", NULL, &wp_trail_head_large_pixbuf, NULL },
116 { "truck stop", "truck_stop", 176, "truck stop symbol", NULL, &wp_truck_stop_large_pixbuf, NULL },
117 { "exit", "user_exit", 177, "user exit symbol", NULL, NULL, NULL },
118 { "flag", "flag", 178, "flag symbol", &wp_flag_pixbuf, NULL, NULL },
119 { "circle with x", "circle_x", 179, "circle with x in the center", NULL, NULL, NULL },
120 { "open 24 hours", "open_24hr", 180, "open 24 hours symbol", NULL, NULL, NULL },
121 { "fishing hot spot facility", "fhs_facility", 181, "U Fishing Hot SpotsTM Facility", NULL, &wp_fhs_facility_large_pixbuf, NULL },
122 { "bottom conditions", "bot_cond", 182, "Bottom Conditions", NULL, NULL, NULL },
123 { "tide/current prediction station", "tide_pred_stn", 183, "Tide/Current Prediction Station", NULL, NULL, NULL },
124 { "anchor prohibited", "anchor_prohib", 184, "U anchor prohibited symbol", NULL, NULL, NULL },
125 { "beacon", "beacon", 185, "U beacon symbol", NULL, NULL, NULL },
126 { "coast Guard", "coast_guard", 186, "U coast guard symbol", NULL, NULL, NULL },
127 { "reef", "reef", 187, "U reef symbol", NULL, NULL, NULL },
128 { "weed bed", "weedbed", 188, "U weedbed symbol", NULL, NULL, NULL },
129 { "dropoff", "dropoff", 189, "U dropoff symbol", NULL, NULL, NULL },
130 { "dock", "dock", 190, "U dock symbol", NULL, NULL, NULL },
131 { "u marina", "marina", 191, "U marina symbol", NULL, NULL, NULL },
132 { "bait and tackle", "bait_tackle", 192, "U bait and tackle symbol", NULL, NULL, NULL },
133 { "stump", "stump", 193, "U stump symbol", NULL, NULL, NULL },
134 { "ground transportation", "grnd_trans", 229, "ground transportation", NULL, &wp_grnd_trans_large_pixbuf, NULL },
135 /*---------------------------------------------------------------
136 User customizable symbols
137 The values from begin_custom to end_custom inclusive are
138 reserved for the identification of user customizable symbols.
139 ---------------------------------------------------------------*/
140 { "custom begin placeholder", "begin_custom", 7680, "first user customizable symbol", NULL, NULL, NULL },
141 { "custom end placeholder","end_custom", 8191, "last user customizable symbol", NULL, NULL, NULL },
142 /*---------------------------------------------------------------
143 Land symbols
144 ---------------------------------------------------------------*/
145 { "interstate highway", "is_hwy", 8192, "interstate hwy symbol", NULL, NULL, NULL }, /* TODO: check symbol name */
146 { "us hwy", "us_hwy", 8193, "us hwy symbol", NULL, NULL, NULL },
147 { "state hwy", "st_hwy", 8194, "state hwy symbol", NULL, NULL, NULL },
148 { "mile marker", "mi_mrkr", 8195, "mile marker symbol", NULL, NULL, NULL },
149 { "tracBack point", "trcbck", 8196, "TracBack (feet) symbol", NULL, NULL, NULL },
150 { "golf course", "golf", 8197, "golf symbol", &wp_golf_pixbuf, &wp_golf_large_pixbuf, NULL },
151 { "city (small)", "sml_cty", 8198, "small city symbol", &wp_sml_cty_pixbuf, &wp_sml_cty_large_pixbuf, NULL },
152 { "city (medium)", "med_cty", 8199, "medium city symbol", &wp_med_cty_pixbuf, &wp_med_cty_large_pixbuf, NULL },
153 { "city (large)", "lrg_cty", 8200, "large city symbol", &wp_lrg_cty_pixbuf, &wp_lrg_cty_large_pixbuf, NULL },
154 { "intl freeway hwy", "freeway", 8201, "intl freeway hwy symbol", NULL, NULL, NULL },
155 { "intl national hwy", "ntl_hwy", 8202, "intl national hwy symbol", NULL, NULL, NULL },
156 { "city (capitol)", "cap_cty", 8203, "capitol city symbol (star)", &wp_cap_cty_pixbuf, NULL, NULL },
157 { "amusement park", "amuse_pk", 8204, "amusement park symbol", NULL, &wp_amuse_pk_large_pixbuf, NULL },
158 { "bowling", "bowling", 8205, "bowling symbol", NULL, &wp_bowling_large_pixbuf, NULL },
159 { "car rental", "car_rental", 8206, "car rental symbol", NULL, &wp_car_rental_large_pixbuf, NULL },
160 { "car repair", "car_repair", 8207, "car repair symbol", NULL, &wp_car_repair_large_pixbuf, NULL },
161 { "fast food", "fastfood", 8208, "fast food symbol", NULL, &wp_fastfood_large_pixbuf, NULL },
162 { "fitness center", "fitness", 8209, "fitness symbol", NULL, &wp_fitness_large_pixbuf, NULL },
163 { "movie theater", "movie", 8210, "movie symbol", NULL, &wp_movie_large_pixbuf, NULL },
164 { "museum", "museum", 8211, "museum symbol", NULL, &wp_museum_large_pixbuf, NULL },
165 { "pharmacy", "pharmacy", 8212, "pharmacy symbol", NULL, &wp_pharmacy_large_pixbuf, NULL },
166 { "pizza", "pizza", 8213, "pizza symbol", NULL, &wp_pizza_large_pixbuf, NULL },
167 { "post office", "post_ofc", 8214, "post office symbol", NULL, &wp_post_ofc_large_pixbuf, NULL },
168 { "rv park", "rv_park", 8215, "RV park symbol", &wp_rv_park_pixbuf, &wp_rv_park_large_pixbuf, NULL },
169 { "school", "school", 8216, "school symbol", &wp_school_pixbuf, &wp_school_large_pixbuf, NULL },
170 { "stadium", "stadium", 8217, "stadium symbol", NULL, &wp_stadium_large_pixbuf, NULL },
171 { "department store", "store", 8218, "dept. store symbol", NULL, &wp_store_large_pixbuf, NULL },
172 { "zoo", "zoo", 8219, "zoo symbol", NULL, &wp_zoo_large_pixbuf, NULL },
173 { "convenience store", "conv_store", 8220, "convenience store symbol", NULL, &wp_conv_store_large_pixbuf, NULL },
174 { "live theater", "theater", 8221, "live theater symbol", NULL, &wp_theater_large_pixbuf, NULL },
175 { "ramp intersection", "ramp_int", 8222, "ramp intersection symbol", NULL, NULL, NULL },
176 { "street intersection", "st_int", 8223, "street intersection symbol", NULL, NULL, NULL },
177 { "scales", "weigh_station", 8226, "inspection/weigh station symbol", NULL, &wp_weigh_station_large_pixbuf, NULL },
178 { "toll booth", "toll_booth", 8227, "toll booth symbol", NULL, &wp_toll_booth_large_pixbuf, NULL },
179 { "elevation point", "elev_pt", 8228, "elevation point symbol", NULL, NULL, NULL },
180 { "exit without services", "ex_no_srvc", 8229, "exit without services symbol", NULL, NULL, NULL },
181 { "geographic place name, man-made", "geo_place_mm", 8230, "Geographic place name, man-made", NULL, NULL, NULL },
182 { "geographic place name, water","geo_place_wtr", 8231, "Geographic place name, water", NULL, NULL, NULL },
183 { "geographic place name, land", "geo_place_lnd", 8232, "Geographic place name, land", NULL, NULL, NULL },
184 { "bridge", "bridge", 8233, "bridge symbol", &wp_bridge_pixbuf, &wp_bridge_large_pixbuf, NULL },
185 { "building", "building", 8234, "building symbol", &wp_building_pixbuf, &wp_building_large_pixbuf, NULL },
186 { "cemetery", "cemetery", 8235, "cemetery symbol", &wp_cemetery_pixbuf, &wp_cemetery_large_pixbuf, NULL },
187 { "church", "church", 8236, "church symbol", &wp_church_pixbuf, &wp_church_large_pixbuf, NULL },
188 { "civil", "civil", 8237, "civil location symbol", NULL, &wp_civil_large_pixbuf, NULL },
189 { "crossing", "crossing", 8238, "crossing symbol", NULL, &wp_crossing_large_pixbuf, NULL },
190 { "ghost town", "hist_town", 8239, "historical town symbol", NULL, NULL, NULL },
191 { "levee", "levee", 8240, "levee symbol", NULL, NULL, NULL },
192 { "military", "military", 8241, "military location symbol", &wp_military_pixbuf, NULL, NULL },
193 { "oil field", "oil_field", 8242, "oil field symbol", NULL, &wp_oil_field_large_pixbuf, NULL },
194 { "tunnel", "tunnel", 8243, "tunnel symbol", &wp_tunnel_pixbuf, &wp_tunnel_large_pixbuf, NULL },
195 { "beach", "beach", 8244, "beach symbol", &wp_beach_pixbuf, &wp_beach_large_pixbuf, NULL },
196 { "forest", "forest", 8245, "forest symbol", &wp_forest_pixbuf, &wp_forest_large_pixbuf, NULL },
197 { "summit", "summit", 8246, "summit symbol", &wp_summit_pixbuf, &wp_summit_large_pixbuf, NULL },
198 { "large ramp intersection", "lrg_ramp_int", 8247, "large ramp intersection symbol", NULL, NULL, NULL },
199 { "large exit without services", "lrg_ex_no_srvc", 8248, "large exit without services smbl", NULL, NULL, NULL },
200 { "police station", "police", 8249, "police/official badge symbol", NULL, &wp_police_large_pixbuf, NULL },
201 { "gambling/casino", "cards", 8250, "gambling/casino symbol", NULL, NULL, NULL },
202 { "ski resort", "ski_resort", 8251, "snow skiing symbol", NULL, &wp_ski_resort_large_pixbuf, NULL },
203 { "ice skating", "ice_skating", 8252, "ice skating symbol", &wp_ice_skating_pixbuf, &wp_ice_skating_large_pixbuf, NULL },
204 { "wrecker", "wrecker", 8253, "tow truck (wrecker) symbol", NULL, &wp_wrecker_large_pixbuf, NULL },
205 { "border crossing (port of entry)", "border", 8254, "border crossing (port of entry)", NULL, NULL, NULL },
206 { "geocache", "geocache", 8255, "geocache location", &wp_geocache_pixbuf, &wp_geocache_large_pixbuf, NULL },
207 { "geocache found", "geocache_fnd", 8256, "found geocache", &wp_geocache_fnd_pixbuf, &wp_geocache_fnd_large_pixbuf, NULL },
208 { "contact, smiley", "cntct_smiley", 8257, "Rino contact symbol, ""smiley""", NULL, NULL, NULL },
209 { "contact, ball cap", "cntct_ball_cap", 8258, "Rino contact symbol, ""ball cap""", NULL, NULL, NULL },
210 { "contact, big ears", "cntct_big_ears", 8259, "Rino contact symbol, ""big ear""", NULL, NULL, NULL },
211 { "contact, spike", "cntct_spike", 8260, "Rino contact symbol, ""spike""", NULL, NULL, NULL },
212 { "contact, goatee", "cntct_goatee", 8261, "Rino contact symbol, ""goatee""", NULL, NULL, NULL },
213 { "contact, afro", "cntct_afro", 8262, "Rino contact symbol, ""afro""", NULL, NULL, NULL },
214 { "contact, dreadlocks", "cntct_dreads", 8263, "Rino contact symbol, ""dreads""", NULL, NULL, NULL },
215 { "contact, female1", "cntct_female1", 8264, "Rino contact symbol, ""female 1""", NULL, NULL, NULL },
216 { "contact, female2", "cntct_female2", 8265, "Rino contact symbol, ""female 2""", NULL, NULL, NULL },
217 { "contact, female3", "cntct_female3", 8266, "Rino contact symbol, ""female 3""", NULL, NULL, NULL },
218 { "contact, ranger", "cntct_ranger", 8267, "Rino contact symbol, ""ranger""", NULL, NULL, NULL },
219 { "contact, kung-Fu", "cntct_kung_fu", 8268, "Rino contact symbol, ""kung fu""", NULL, NULL, NULL },
220 { "contact, sumo", "cntct_sumo", 8269, "Rino contact symbol, ""sumo""", NULL, NULL, NULL },
221 { "contact, pirate", "cntct_pirate", 8270, "Rino contact symbol, ""pirate""", NULL, NULL, NULL },
222 { "contact, biker", "cntct_biker", 8271, "Rino contact symbol, ""biker""", NULL, NULL, NULL },
223 { "contact, alien", "cntct_alien", 8272, "Rino contact symbol, ""alien""", NULL, NULL, NULL },
224 { "contact, bug", "cntct_bug", 8273, "Rino contact symbol, ""bug""", NULL, NULL, NULL },
225 { "contact, cat", "cntct_cat", 8274, "Rino contact symbol, ""cat""", NULL, NULL, NULL },
226 { "contact, dog", "cntct_dog", 8275, "Rino contact symbol, ""dog""", NULL, NULL, NULL },
227 { "contact, pig", "cntct_pig", 8276, "Rino contact symbol, ""pig""", NULL, NULL, NULL },
228 { "water hydrant", "hydrant", 8282, "water hydrant symbol", NULL, NULL, NULL },
229 { "flag, blue", "flag_blue", 8284, "blue flag symbol", NULL, &wp_flag_blue_large_pixbuf, NULL },
230 { "flag, green", "flag_green", 8285, "green flag symbol", NULL, &wp_flag_green_large_pixbuf, NULL },
231 { "flag, red", "flag_red", 8286, "red flag symbol", NULL, &wp_flag_red_large_pixbuf, NULL },
232 { "pin, blue", "pin_blue", 8287, "blue pin symbol", NULL, &wp_pin_blue_large_pixbuf, NULL },
233 { "pin, green", "pin_green", 8288, "green pin symbol", NULL, &wp_pin_green_large_pixbuf, NULL },
234 { "pin, red", "pin_red", 8289, "red pin symbol", NULL, &wp_pin_red_large_pixbuf, NULL },
235 { "block, blue", "block_blue", 8290, "blue block symbol", NULL, &wp_block_blue_large_pixbuf, NULL },
236 { "block, green", "block_green", 8291, "green block symbol", NULL, &wp_block_green_large_pixbuf, NULL },
237 { "block, red", "block_red", 8292, "red block symbol", NULL, &wp_block_red_large_pixbuf, NULL },
238 { "bike trail", "bike_trail", 8293, "bike trail symbol", NULL, &wp_bike_trail_large_pixbuf, NULL },
239 { "circle, red", "circle_red", 8294, "red circle symbol", NULL, NULL, NULL },
240 { "circle, green", "circle_green", 8295, "green circle symbol", NULL, NULL, NULL },
241 { "circle, blue", "circle_blue", 8296, "blue circle symbol", NULL, NULL, NULL },
242 { "diamond, blue", "diamond_blue", 8299, "blue diamond symbol", NULL, NULL, NULL },
243 { "oval, red", "oval_red", 8300, "red oval symbol", NULL, NULL, NULL },
244 { "oval, green", "oval_green", 8301, "green oval symbol", NULL, NULL, NULL },
245 { "oval, blue", "oval_blue", 8302, "blue oval symbol", NULL, NULL, NULL },
246 { "rectangle, red", "rect_red", 8303, "red rectangle symbol", NULL, NULL, NULL },
247 { "rectangle, green", "rect_green", 8304, "green rectangle symbol", NULL, NULL, NULL },
248 { "rectangle, blue", "rect_blue", 8305, "blue rectangle symbol", NULL, NULL, NULL },
249 { "square, blue", "square_blue", 8308, "blue square symbol", NULL, NULL, NULL },
250 { "letter a, red", "letter_a_red", 8309, "red letter 'A' symbol", NULL, NULL, NULL },
251 { "letter b, red", "letter_b_red", 8310, "red letter 'B' symbol", NULL, NULL, NULL },
252 { "letter c, red", "letter_c_red", 8311, "red letter 'C' symbol", NULL, NULL, NULL },
253 { "letter d, red", "letter_d_red", 8312, "red letter 'D' symbol", NULL, NULL, NULL },
254 { "letter a, green", "letter_a_green", 8313, "green letter 'A' symbol", NULL, NULL, NULL },
255 { "letter c, green", "letter_c_green", 8314, "green letter 'C' symbol", NULL, NULL, NULL },
256 { "letter b, green", "letter_b_green", 8315, "green letter 'B' symbol", NULL, NULL, NULL },
257 { "letter d, green", "letter_d_green", 8316, "green letter 'D' symbol", NULL, NULL, NULL },
258 { "letter a, blue", "letter_a_blue", 8317, "blue letter 'A' symbol", NULL, NULL, NULL },
259 { "letter b, blue", "letter_b_blue", 8318, "blue letter 'B' symbol", NULL, NULL, NULL },
260 { "letter c, blue", "letter_c_blue", 8319, "blue letter 'C' symbol", NULL, NULL, NULL },
261 { "letter d, blue", "letter_d_blue", 8320, "blue letter 'D' symbol", NULL, NULL, NULL },
262 { "number 0, red", "number_0_red", 8321, "red number '0' symbol", NULL, NULL, NULL },
263 { "number 1, red", "number_1_red", 8322, "red number '1' symbol", NULL, NULL, NULL },
264 { "number 2, red", "number_2_red", 8323, "red number '2' symbol", NULL, NULL, NULL },
265 { "number 3, red", "number_3_red", 8324, "red number '3' symbol", NULL, NULL, NULL },
266 { "number 4, red", "number_4_red", 8325, "red number '4' symbol", NULL, NULL, NULL },
267 { "number 5, red", "number_5_red", 8326, "red number '5' symbol", NULL, NULL, NULL },
268 { "number 6, red", "number_6_red", 8327, "red number '6' symbol", NULL, NULL, NULL },
269 { "number 7, red", "number_7_red", 8328, "red number '7' symbol", NULL, NULL, NULL },
270 { "number 8, red", "number_8_red", 8329, "red number '8' symbol", NULL, NULL, NULL },
271 { "number 9, red", "number_9_red", 8330, "red number '9' symbol", NULL, NULL, NULL },
272 { "number 0, green", "number_0_green", 8331, "green number '0' symbol", NULL, NULL, NULL },
273 { "number 1, green", "number_1_green", 8332, "green number '1' symbol", NULL, NULL, NULL },
274 { "number 2, green", "number_2_green", 8333, "green number '2' symbol", NULL, NULL, NULL },
275 { "number 3, green", "number_3_green", 8334, "green number '3' symbol", NULL, NULL, NULL },
276 { "number 4, green", "number_4_green", 8335, "green number '4' symbol", NULL, NULL, NULL },
277 { "number 5, green", "number_5_green", 8336, "green number '5' symbol", NULL, NULL, NULL },
278 { "number 6, green", "number_6_green", 8337, "green number '6' symbol", NULL, NULL, NULL },
279 { "number 7, green", "number_7_green", 8338, "green number '7' symbol", NULL, NULL, NULL },
280 { "number 8, green", "number_8_green", 8339, "green number '8' symbol", NULL, NULL, NULL },
281 { "number 9, green", "number_9_green", 8340, "green number '9' symbol", NULL, NULL, NULL },
282 { "number 0, blue", "number_0_blue", 8341, "blue number '0' symbol", NULL, NULL, NULL },
283 { "number 1, blue", "number_1_blue", 8342, "blue number '1' symbol", NULL, NULL, NULL },
284 { "number 2, blue", "number_2_blue", 8343, "blue number '2' symbol", NULL, NULL, NULL },
285 { "number 3, blue", "number_3_blue", 8344, "blue number '3' symbol", NULL, NULL, NULL },
286 { "number 4, blue", "number_4_blue", 8345, "blue number '4' symbol", NULL, NULL, NULL },
287 { "number 5, blue", "number_5_blue", 8346, "blue number '5' symbol", NULL, NULL, NULL },
288 { "number 6, blue", "number_6_blue", 8347, "blue number '6' symbol", NULL, NULL, NULL },
289 { "number 7, blue", "number_7_blue", 8348, "blue number '7' symbol", NULL, NULL, NULL },
290 { "number 8, blue", "number_8_blue", 8349, "blue number '8' symbol", NULL, NULL, NULL },
291 { "number 9, blue", "number_9_blue", 8350, "blue number '9' symbol", NULL, NULL, NULL },
292 { "triangle, blue", "triangle_blue", 8351, "blue triangle symbol", NULL, NULL, NULL },
293 { "triangle, green", "triangle_green", 8352, "green triangle symbol", NULL, NULL, NULL },
294 { "triangle, red", "triangle_red", 8353, "red triangle symbol", NULL, NULL, NULL },
295 /*---------------------------------------------------------------
296 Aviation symbols
297 ---------------------------------------------------------------*/
298 { "airport", "airport", 16384, "airport symbol", &wp_airplane_pixbuf, &wp_airplane_large_pixbuf, NULL },
299 { "intersection", "int", 16385, "intersection symbol", NULL, NULL, NULL },
300 { "non-directional beacon", "ndb", 16386, "non-directional beacon symbol", NULL, NULL, NULL },
301 { "vhf omni-range", "vor", 16387, "VHF omni-range symbol", NULL, NULL, NULL },
302 { "heliport", "heliport", 16388, "heliport symbol", NULL, NULL, NULL },
303 { "private field", "private", 16389, "private field symbol", NULL, NULL, NULL },
304 { "soft field", "soft_fld", 16390, "soft field symbol", NULL, NULL, NULL },
305 { "tall tower", "tall_tower", 16391, "tall tower symbol", NULL, &wp_tall_tower_large_pixbuf, NULL },
306 { "short tower", "short_tower", 16392, "short tower symbol", NULL, &wp_short_tower_large_pixbuf, NULL },
307 { "glider area", "glider", 16393, "glider symbol", NULL, &wp_glider_large_pixbuf, NULL },
308 { "ultralight area", "ultralight", 16394, "ultralight symbol", NULL, &wp_ultralight_large_pixbuf, NULL },
309 { "parachute area", "parachute", 16395, "parachute symbol", NULL, &wp_parachute_large_pixbuf, NULL },
310 { "vor/tacan", "vortac", 16396, "VOR/TACAN symbol", NULL, NULL, NULL },
311 { "vor-dme", "vordme", 16397, "VOR-DME symbol", NULL, NULL, NULL },
312 { "first approach fix", "faf", 16398, "first approach fix", NULL, NULL, NULL },
313 { "localizer outer marker", "lom", 16399, "localizer outer marker", NULL, NULL, NULL },
314 { "missed approach point", "map", 16400, "missed approach point", NULL, NULL, NULL },
315 { "tacan", "tacan", 16401, "TACAN symbol", NULL, NULL, NULL },
316 { "seaplane base", "seaplane", 16402, "Seaplane Base", NULL, NULL, NULL }
319 static GHashTable *icons = NULL;
320 static GHashTable *old_icons = NULL;
322 static void init_icons() {
323 icons = g_hash_table_new_full ( g_str_hash, g_str_equal, NULL, NULL);
324 old_icons = g_hash_table_new_full ( g_str_hash, g_str_equal, NULL, NULL);
325 gint i;
326 for (i=0; i<G_N_ELEMENTS(garmin_syms); i++) {
327 g_hash_table_insert(icons, garmin_syms[i].sym, GINT_TO_POINTER (i));
328 g_hash_table_insert(old_icons, garmin_syms[i].old_sym, GINT_TO_POINTER (i));
332 static GdkPixbuf *get_wp_sym_from_index ( gint i ) {
333 if ( !garmin_syms[i].icon &&
334 ((vik_use_small_wp_icons && garmin_syms[i].data) ||
335 (!vik_use_small_wp_icons && garmin_syms[i].data_large))) {
336 garmin_syms[i].icon = gdk_pixbuf_from_pixdata (
337 vik_use_small_wp_icons ? garmin_syms[i].data : garmin_syms[i].data_large,
338 FALSE, NULL );
340 return garmin_syms[i].icon;
343 GdkPixbuf *a_get_wp_sym ( const gchar *sym ) {
344 gpointer gp;
345 gpointer x;
347 if (!sym) {
348 return NULL;
350 if (!icons) {
351 init_icons();
353 if (g_hash_table_lookup_extended(icons, sym, &x, &gp))
354 return get_wp_sym_from_index(GPOINTER_TO_INT(gp));
355 else if (g_hash_table_lookup_extended(old_icons, sym, &x, &gp))
356 return get_wp_sym_from_index(GPOINTER_TO_INT(gp));
357 else
358 return NULL;
361 void a_populate_sym_list ( GtkListStore *list ) {
362 gint i;
363 for (i=0; i<G_N_ELEMENTS(garmin_syms); i++) {
364 if ((vik_use_small_wp_icons && garmin_syms[i].data) ||
365 (!vik_use_small_wp_icons && garmin_syms[i].data_large)) {
366 GtkTreeIter iter;
367 gtk_list_store_append(list, &iter);
368 gtk_list_store_set(list, &iter, 0, garmin_syms[i].sym, 1, get_wp_sym_from_index(i), -1);