From acaf7113fffde4a6a6f6c0d57a4eea27e1024a31 Mon Sep 17 00:00:00 2001 From: Alex Foobarian Date: Thu, 29 Sep 2005 19:50:30 +0000 Subject: [PATCH] Added wp symbol support; added scale ruler --- ChangeLog | 8 +- src/Makefile.am | 3 +- src/dialog.c | 72 ++++++- src/garminsymbols.c | 343 ++++++++++++++++++++++++++++++++ src/garminsymbols.h | 28 +++ src/gpspoint.c | 22 ++ src/icons.h | 8 + src/icons/wp_camp.png | Bin 0 -> 473 bytes src/icons/wp_camp.png.h | 43 ++++ src/icons/wp_car.png | Bin 0 -> 390 bytes src/icons/wp_car.png.h | 36 ++++ src/icons/wp_deer.png | Bin 0 -> 436 bytes src/icons/wp_deer.png.h | 36 ++++ src/icons/wp_flag.png | Bin 0 -> 296 bytes src/icons/wp_flag.png.h | 29 +++ src/icons/wp_geocache.png | Bin 0 -> 556 bytes src/icons/wp_geocache.png.h | 42 ++++ src/icons/wp_geocache_fnd.png | Bin 0 -> 586 bytes src/icons/wp_geocache_fnd.png.h | 46 +++++ src/icons/wp_house.png | Bin 0 -> 359 bytes src/icons/wp_house.png.h | 40 ++++ src/icons/wp_wpt_dot.png | Bin 0 -> 421 bytes src/icons/wp_wpt_dot.png.h | 36 ++++ src/viktrwlayer.c | 18 +- src/vikviewport.c | 85 ++++++++ src/vikviewport.h | 1 + src/vikwaypoint.c | 18 ++ src/vikwaypoint.h | 3 +- src/vikwindow.c | 5 +- 29 files changed, 907 insertions(+), 15 deletions(-) create mode 100644 src/garminsymbols.c create mode 100644 src/garminsymbols.h create mode 100644 src/icons/wp_camp.png create mode 100644 src/icons/wp_camp.png.h create mode 100644 src/icons/wp_car.png create mode 100644 src/icons/wp_car.png.h create mode 100644 src/icons/wp_deer.png create mode 100644 src/icons/wp_deer.png.h create mode 100644 src/icons/wp_flag.png create mode 100644 src/icons/wp_flag.png.h create mode 100644 src/icons/wp_geocache.png create mode 100644 src/icons/wp_geocache.png.h create mode 100644 src/icons/wp_geocache_fnd.png create mode 100644 src/icons/wp_geocache_fnd.png.h create mode 100644 src/icons/wp_house.png create mode 100644 src/icons/wp_house.png.h create mode 100644 src/icons/wp_wpt_dot.png create mode 100644 src/icons/wp_wpt_dot.png.h diff --git a/ChangeLog b/ChangeLog index 1c7b6c1d..9ae467ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,15 @@ +2005-09-29 +Alex Foobarian : + * Added support for waypoint symbols (changing, loading, saving), and a small number of icons. + * Added a scale ruler + * Changed panning to show less "garbage" in exposed areas + 2005-09-28 Evan: * menu.xml & icons inline 2005-09-27 -Alex Foobarian : * GtkUIManager/Toolbar * DND in the LayersPanel Evan: diff --git a/src/Makefile.am b/src/Makefile.am index 372fbd6f..9f14dca0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -39,7 +39,8 @@ viking_SOURCES = main.c \ gtkcellrendererprogress.c gtkcellrendererprogress.h \ khmaps.c khmaps.h \ usgs.c usgs.h \ - gpx.c gpx.h + gpx.c gpx.h \ + garminsymbols.c garminsymbols.h INCLUDES = @GTK_CFLAGS@ LDADD = @GTK_LIBS@ diff --git a/src/dialog.c b/src/dialog.c index 0e6da62f..333f0811 100644 --- a/src/dialog.c +++ b/src/dialog.c @@ -21,6 +21,7 @@ #include "viking.h" #include "thumbnails.h" +#include "garminsymbols.h" #include #include @@ -168,7 +169,12 @@ gboolean a_dialog_new_waypoint ( GtkWindow *parent, gchar **dest, VikWaypoint *w GTK_RESPONSE_ACCEPT, NULL); struct LatLon ll; - GtkWidget *latlabel, *lonlabel, *namelabel, *latentry, *lonentry, *altentry, *altlabel, *nameentry, *commentlabel, *commententry, *imagelabel, *imageentry; + GtkWidget *latlabel, *lonlabel, *namelabel, *latentry, *lonentry, *altentry, *altlabel, *nameentry, *commentlabel, + *commententry, *imagelabel, *imageentry, *symbollabel, *symbolentry; + GtkListStore *store; + + + gchar *lat, *lon, *alt; @@ -208,13 +214,44 @@ gboolean a_dialog_new_waypoint ( GtkWindow *parent, gchar **dest, VikWaypoint *w imagelabel = gtk_label_new ("Image:"); imageentry = vik_file_entry_new (); + { + GtkCellRenderer *r; + symbollabel = gtk_label_new ("Symbol:"); + GtkTreeIter iter; + + store = gtk_list_store_new(2, G_TYPE_STRING, GDK_TYPE_PIXBUF); + symbolentry = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store)); + gtk_combo_box_set_wrap_width(symbolentry, 3); + gtk_list_store_append (store, &iter); + gtk_list_store_set (store, &iter, 0, "(none)", 1, NULL, -1); + a_populate_sym_list(store); + + r = gtk_cell_renderer_pixbuf_new (); + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (symbolentry), r, FALSE); + gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (symbolentry), r, "pixbuf", 1, NULL); + + if ( dest == NULL && wp->symbol ) { + gboolean ok; + gchar *sym; + for (ok = gtk_tree_model_get_iter_first ( GTK_TREE_MODEL(store), &iter ); ok; ok = gtk_tree_model_iter_next ( GTK_TREE_MODEL(store), &iter)) { + gtk_tree_model_get ( GTK_TREE_MODEL(store), &iter, 0, (void *)&sym, -1 ); + if (!strcmp(sym, wp->symbol)) { + g_free(sym); + break; + } else { + g_free(sym); + } + } + gtk_combo_box_set_active_iter(symbolentry, &iter); + } + } + if ( dest == NULL && wp->comment ) gtk_entry_set_text ( GTK_ENTRY(commententry), wp->comment ); if ( dest == NULL && wp->image ) vik_file_entry_set_filename ( VIK_FILE_ENTRY(imageentry), wp->image ); - gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), latlabel, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), latentry, FALSE, FALSE, 0); @@ -226,9 +263,11 @@ gboolean a_dialog_new_waypoint ( GtkWindow *parent, gchar **dest, VikWaypoint *w gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), commententry, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), imagelabel, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), imageentry, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), symbollabel, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), GTK_WIDGET(symbolentry), FALSE, FALSE, 0); gtk_widget_show_all ( GTK_DIALOG(dialog)->vbox ); - + while ( gtk_dialog_run ( GTK_DIALOG(dialog) ) == GTK_RESPONSE_ACCEPT ) { if ( dest ) @@ -257,6 +296,20 @@ gboolean a_dialog_new_waypoint ( GtkWindow *parent, gchar **dest, VikWaypoint *w vik_waypoint_set_image ( wp, vik_file_entry_get_filename ( VIK_FILE_ENTRY(imageentry) ) ); if ( wp->image && *(wp->image) && (!a_thumbnails_exists(wp->image)) ) a_thumbnails_create ( wp->image ); + + { + GtkTreeIter iter, first; + gtk_tree_model_get_iter_first ( GTK_TREE_MODEL(store), &first ); + if ( !gtk_combo_box_get_active_iter ( symbolentry, &iter ) || !memcmp(&iter, &first, sizeof(GtkTreeIter)) ) { + vik_waypoint_set_symbol ( wp, NULL ); + } else { + gchar *sym; + gtk_tree_model_get ( GTK_TREE_MODEL(store), &iter, 0, (void *)&sym, -1 ); + vik_waypoint_set_symbol ( wp, sym ); + g_free(sym); + } + } + gtk_widget_destroy ( dialog ); return TRUE; } @@ -277,6 +330,19 @@ gboolean a_dialog_new_waypoint ( GtkWindow *parent, gchar **dest, VikWaypoint *w a_thumbnails_create ( wp->image ); } + { + GtkTreeIter iter, first; + gtk_tree_model_get_iter_first ( GTK_TREE_MODEL(store), &first ); + if ( !gtk_combo_box_get_active_iter ( symbolentry, &iter ) || !memcmp(&iter, &first, sizeof(GtkTreeIter)) ) { + vik_waypoint_set_symbol ( wp, NULL ); + } else { + gchar *sym; + gtk_tree_model_get ( GTK_TREE_MODEL(store), &iter, 0, (void *)&sym, -1 ); + vik_waypoint_set_symbol ( wp, sym ); + g_free(sym); + } + } + gtk_widget_destroy ( dialog ); return TRUE; diff --git a/src/garminsymbols.c b/src/garminsymbols.c new file mode 100644 index 00000000..73a0fd4e --- /dev/null +++ b/src/garminsymbols.c @@ -0,0 +1,343 @@ +/* + * viking -- GPS Data and Topo Analyzer, Explorer, and Manager + * + * Copyright (C) 2003-2005, Evan Battaglia + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "viking.h" +#include "garminsymbols.h" +#include "icons.h" + +#include +#include + +struct { + gchar *sym; + gint num; + gchar *desc; + const GdkPixdata *data; + GdkPixbuf *icon; +} garmin_syms[] = { + /*--------------------------------------------------------------- + Marine symbols + ---------------------------------------------------------------*/ + { "anchor", 0, "white anchor symbol", NULL, NULL }, + { "bell", 1, "white bell symbol", NULL, NULL }, + { "diamond_grn", 2, "green diamond symbol", NULL, NULL }, + { "diamond_red", 3, "red diamond symbol", NULL, NULL }, + { "dive1", 4, "diver down flag 1", NULL, NULL }, + { "dive2", 5, "diver down flag 2", NULL, NULL }, + { "dollar", 6, "white dollar symbol", NULL, NULL }, + { "fish", 7, "white fish symbol", NULL, NULL }, + { "fuel", 8, "white fuel symbol", NULL, NULL }, + { "horn", 9, "white horn symbol", NULL, NULL }, + { "house", 10, "white house symbol", &wp_house, NULL }, + { "knife", 11, "white knife & fork symbol", NULL, NULL }, + { "light", 12, "white light symbol", NULL, NULL }, + { "mug", 13, "white mug symbol", NULL, NULL }, + { "skull", 14, "white skull and crossbones symbol", NULL, NULL }, + { "square_grn", 15, "green square symbol", NULL, NULL }, + { "square_red", 16, "red square symbol", NULL, NULL }, + { "wbuoy", 17, "white buoy waypoint symbol", NULL, NULL }, + { "wpt_dot", 18, "waypoint dot", &wp_wpt_dot, NULL }, + { "wreck", 19, "white wreck symbol", NULL, NULL }, + { "null", 20, "null symbol (transparent)", NULL, NULL }, + { "mob", 21, "man overboard symbol", NULL, NULL }, + { "buoy_ambr", 22, "amber map buoy symbol", NULL, NULL }, + { "buoy_blck", 23, "black map buoy symbol", NULL, NULL }, + { "buoy_blue", 24, "blue map buoy symbol", NULL, NULL }, + { "buoy_grn", 25, "green map buoy symbol", NULL, NULL }, + { "buoy_grn_red", 26, "green/red map buoy symbol", NULL, NULL }, + { "buoy_grn_wht", 27, "green/white map buoy symbol", NULL, NULL }, + { "buoy_orng", 28, "orange map buoy symbol", NULL, NULL }, + { "buoy_red", 29, "red map buoy symbol", NULL, NULL }, + { "buoy_red_grn", 30, "red/green map buoy symbol", NULL, NULL }, + { "buoy_red_wht", 31, "red/white map buoy symbol", NULL, NULL }, + { "buoy_violet", 32, "violet map buoy symbol", NULL, NULL }, + { "buoy_wht", 33, "white map buoy symbol", NULL, NULL }, + { "buoy_wht_grn", 34, "white/green map buoy symbol", NULL, NULL }, + { "buoy_wht_red", 35, "white/red map buoy symbol", NULL, NULL }, + { "dot", 36, "white dot symbol", NULL, NULL }, + { "rbcn", 37, "radio beacon symbol", NULL, NULL }, + { "boat_ramp", 150, "boat ramp symbol", NULL, NULL }, + { "camp", 151, "campground symbol", &wp_camp, NULL }, + { "restrooms", 152, "restrooms symbol", NULL, NULL }, + { "showers", 153, "shower symbol", NULL, NULL }, + { "drinking_wtr", 154, "drinking water symbol", NULL, NULL }, + { "phone", 155, "telephone symbol", NULL, NULL }, + { "1st_aid", 156, "first aid symbol", NULL, NULL }, + { "info", 157, "information symbol", NULL, NULL }, + { "parking", 158, "parking symbol", NULL, NULL }, + { "park", 159, "park symbol", NULL, NULL }, + { "picnic", 160, "picnic symbol", NULL, NULL }, + { "scenic", 161, "scenic area symbol", NULL, NULL }, + { "skiing", 162, "skiing symbol", NULL, NULL }, + { "swimming", 163, "swimming symbol", NULL, NULL }, + { "dam", 164, "dam symbol", NULL, NULL }, + { "controlled", 165, "controlled area symbol", NULL, NULL }, + { "danger", 166, "danger symbol", NULL, NULL }, + { "restricted", 167, "restricted area symbol", NULL, NULL }, + { "null_2", 168, "null symbol", NULL, NULL }, + { "ball", 169, "ball symbol", NULL, NULL }, + { "car", 170, "car symbol", &wp_car, NULL }, + { "deer", 171, "deer symbol", &wp_deer, NULL }, + { "shpng_cart", 172, "shopping cart symbol", NULL, NULL }, + { "lodging", 173, "lodging symbol", NULL, NULL }, + { "mine", 174, "mine symbol", NULL, NULL }, + { "trail_head", 175, "trail head symbol", NULL, NULL }, + { "truck_stop", 176, "truck stop symbol", NULL, NULL }, + { "user_exit", 177, "user exit symbol", NULL, NULL }, + { "flag", 178, "flag symbol", &wp_flag, NULL }, + { "circle_x", 179, "circle with x in the center", NULL, NULL }, + { "open_24hr", 180, "open 24 hours symbol", NULL, NULL }, + { "fhs_facility", 181, "U Fishing Hot SpotsTM Facility", NULL, NULL }, + { "bot_cond", 182, "Bottom Conditions", NULL, NULL }, + { "tide_pred_stn", 183, "Tide/Current Prediction Station", NULL, NULL }, + { "anchor_prohib", 184, "U anchor prohibited symbol", NULL, NULL }, + { "beacon", 185, "U beacon symbol", NULL, NULL }, + { "coast_guard", 186, "U coast guard symbol", NULL, NULL }, + { "reef", 187, "U reef symbol", NULL, NULL }, + { "weedbed", 188, "U weedbed symbol", NULL, NULL }, + { "dropoff", 189, "U dropoff symbol", NULL, NULL }, + { "dock", 190, "U dock symbol", NULL, NULL }, + { "marina", 191, "U marina symbol", NULL, NULL }, + { "bait_tackle", 192, "U bait and tackle symbol", NULL, NULL }, + { "stump", 193, "U stump symbol", NULL, NULL }, + /*--------------------------------------------------------------- + User customizable symbols + The values from begin_custom to end_custom inclusive are + reserved for the identification of user customizable symbols. + ---------------------------------------------------------------*/ + { "begin_custom", 7680, "first user customizable symbol", NULL, NULL }, + { "end_custom", 8191, "last user customizable symbol", NULL, NULL }, + /*--------------------------------------------------------------- + Land symbols + ---------------------------------------------------------------*/ + { "is_hwy", 8192, "interstate hwy symbol", NULL, NULL }, + { "us_hwy", 8193, "us hwy symbol", NULL, NULL }, + { "st_hwy", 8194, "state hwy symbol", NULL, NULL }, + { "mi_mrkr", 8195, "mile marker symbol", NULL, NULL }, + { "trcbck", 8196, "TracBack (feet) symbol", NULL, NULL }, + { "golf", 8197, "golf symbol", NULL, NULL }, + { "sml_cty", 8198, "small city symbol", NULL, NULL }, + { "med_cty", 8199, "medium city symbol", NULL, NULL }, + { "lrg_cty", 8200, "large city symbol", NULL, NULL }, + { "freeway", 8201, "intl freeway hwy symbol", NULL, NULL }, + { "ntl_hwy", 8202, "intl national hwy symbol", NULL, NULL }, + { "cap_cty", 8203, "capitol city symbol (star)", NULL, NULL }, + { "amuse_pk", 8204, "amusement park symbol", NULL, NULL }, + { "bowling", 8205, "bowling symbol", NULL, NULL }, + { "car_rental", 8206, "car rental symbol", NULL, NULL }, + { "car_repair", 8207, "car repair symbol", NULL, NULL }, + { "fastfood", 8208, "fast food symbol", NULL, NULL }, + { "fitness", 8209, "fitness symbol", NULL, NULL }, + { "movie", 8210, "movie symbol", NULL, NULL }, + { "museum", 8211, "museum symbol", NULL, NULL }, + { "pharmacy", 8212, "pharmacy symbol", NULL, NULL }, + { "pizza", 8213, "pizza symbol", NULL, NULL }, + { "post_ofc", 8214, "post office symbol", NULL, NULL }, + { "rv_park", 8215, "RV park symbol", NULL, NULL }, + { "school", 8216, "school symbol", NULL, NULL }, + { "stadium", 8217, "stadium symbol", NULL, NULL }, + { "store", 8218, "dept. store symbol", NULL, NULL }, + { "zoo", 8219, "zoo symbol", NULL, NULL }, + { "gas_plus", 8220, "convenience store symbol", NULL, NULL }, + { "faces", 8221, "live theater symbol", NULL, NULL }, + { "ramp_int", 8222, "ramp intersection symbol", NULL, NULL }, + { "st_int", 8223, "street intersection symbol", NULL, NULL }, + { "weigh_sttn", 8226, "inspection/weigh station symbol", NULL, NULL }, + { "toll_booth", 8227, "toll booth symbol", NULL, NULL }, + { "elev_pt", 8228, "elevation point symbol", NULL, NULL }, + { "ex_no_srvc", 8229, "exit without services symbol", NULL, NULL }, + { "geo_place_mm", 8230, "Geographic place name, man-made", NULL, NULL }, + { "geo_place_wtr", 8231, "Geographic place name, water", NULL, NULL }, + { "geo_place_lnd", 8232, "Geographic place name, land", NULL, NULL }, + { "bridge", 8233, "bridge symbol", NULL, NULL }, + { "building", 8234, "building symbol", NULL, NULL }, + { "cemetery", 8235, "cemetery symbol", NULL, NULL }, + { "church", 8236, "church symbol", NULL, NULL }, + { "civil", 8237, "civil location symbol", NULL, NULL }, + { "crossing", 8238, "crossing symbol", NULL, NULL }, + { "hist_town", 8239, "historical town symbol", NULL, NULL }, + { "levee", 8240, "levee symbol", NULL, NULL }, + { "military", 8241, "military location symbol", NULL, NULL }, + { "oil_field", 8242, "oil field symbol", NULL, NULL }, + { "tunnel", 8243, "tunnel symbol", NULL, NULL }, + { "beach", 8244, "beach symbol", NULL, NULL }, + { "forest", 8245, "forest symbol", NULL, NULL }, + { "summit", 8246, "summit symbol", NULL, NULL }, + { "lrg_ramp_int", 8247, "large ramp intersection symbol", NULL, NULL }, + { "lrg_ex_no_srvc", 8248, "large exit without services smbl", NULL, NULL }, + { "badge", 8249, "police/official badge symbol", NULL, NULL }, + { "cards", 8250, "gambling/casino symbol", NULL, NULL }, + { "snowski", 8251, "snow skiing symbol", NULL, NULL }, + { "iceskate", 8252, "ice skating symbol", NULL, NULL }, + { "wrecker", 8253, "tow truck (wrecker) symbol", NULL, NULL }, + { "border", 8254, "border crossing (port of entry)", NULL, NULL }, + { "geocache", 8255, "geocache location", &wp_geocache, NULL }, + { "geocache_fnd", 8256, "found geocache", &wp_geocache_fnd, NULL }, + { "cntct_smiley", 8257, "Rino contact symbol, ""smiley""", NULL, NULL }, + { "cntct_ball_cap", 8258, "Rino contact symbol, ""ball cap""", NULL, NULL }, + { "cntct_big_ears", 8259, "Rino contact symbol, ""big ear""", NULL, NULL }, + { "cntct_spike", 8260, "Rino contact symbol, ""spike""", NULL, NULL }, + { "cntct_goatee", 8261, "Rino contact symbol, ""goatee""", NULL, NULL }, + { "cntct_afro", 8262, "Rino contact symbol, ""afro""", NULL, NULL }, + { "cntct_dreads", 8263, "Rino contact symbol, ""dreads""", NULL, NULL }, + { "cntct_female1", 8264, "Rino contact symbol, ""female 1""", NULL, NULL }, + { "cntct_female2", 8265, "Rino contact symbol, ""female 2""", NULL, NULL }, + { "cntct_female3", 8266, "Rino contact symbol, ""female 3""", NULL, NULL }, + { "cntct_ranger", 8267, "Rino contact symbol, ""ranger""", NULL, NULL }, + { "cntct_kung_fu", 8268, "Rino contact symbol, ""kung fu""", NULL, NULL }, + { "cntct_sumo", 8269, "Rino contact symbol, ""sumo""", NULL, NULL }, + { "cntct_pirate", 8270, "Rino contact symbol, ""pirate""", NULL, NULL }, + { "cntct_biker", 8271, "Rino contact symbol, ""biker""", NULL, NULL }, + { "cntct_alien", 8272, "Rino contact symbol, ""alien""", NULL, NULL }, + { "cntct_bug", 8273, "Rino contact symbol, ""bug""", NULL, NULL }, + { "cntct_cat", 8274, "Rino contact symbol, ""cat""", NULL, NULL }, + { "cntct_dog", 8275, "Rino contact symbol, ""dog""", NULL, NULL }, + { "cntct_pig", 8276, "Rino contact symbol, ""pig""", NULL, NULL }, + { "hydrant", 8282, "water hydrant symbol", NULL, NULL }, + { "flag_blue", 8284, "blue flag symbol", NULL, NULL }, + { "flag_green", 8285, "green flag symbol", NULL, NULL }, + { "flag_red", 8286, "red flag symbol", NULL, NULL }, + { "pin_blue", 8287, "blue pin symbol", NULL, NULL }, + { "pin_green", 8288, "green pin symbol", NULL, NULL }, + { "pin_red", 8289, "red pin symbol", NULL, NULL }, + { "block_blue", 8290, "blue block symbol", NULL, NULL }, + { "block_green", 8291, "green block symbol", NULL, NULL }, + { "block_red", 8292, "red block symbol", NULL, NULL }, + { "bike_trail", 8293, "bike trail symbol", NULL, NULL }, + { "circle_red", 8294, "red circle symbol", NULL, NULL }, + { "circle_green", 8295, "green circle symbol", NULL, NULL }, + { "circle_blue", 8296, "blue circle symbol", NULL, NULL }, + { "diamond_blue", 8299, "blue diamond symbol", NULL, NULL }, + { "oval_red", 8300, "red oval symbol", NULL, NULL }, + { "oval_green", 8301, "green oval symbol", NULL, NULL }, + { "oval_blue", 8302, "blue oval symbol", NULL, NULL }, + { "rect_red", 8303, "red rectangle symbol", NULL, NULL }, + { "rect_green", 8304, "green rectangle symbol", NULL, NULL }, + { "rect_blue", 8305, "blue rectangle symbol", NULL, NULL }, + { "square_blue", 8308, "blue square symbol", NULL, NULL }, + { "letter_a_red", 8309, "red letter 'A' symbol", NULL, NULL }, + { "letter_b_red", 8310, "red letter 'B' symbol", NULL, NULL }, + { "letter_c_red", 8311, "red letter 'C' symbol", NULL, NULL }, + { "letter_d_red", 8312, "red letter 'D' symbol", NULL, NULL }, + { "letter_a_green", 8313, "green letter 'A' symbol", NULL, NULL }, + { "letter_c_green", 8314, "green letter 'C' symbol", NULL, NULL }, + { "letter_b_green", 8315, "green letter 'B' symbol", NULL, NULL }, + { "letter_d_green", 8316, "green letter 'D' symbol", NULL, NULL }, + { "letter_a_blue", 8317, "blue letter 'A' symbol", NULL, NULL }, + { "letter_b_blue", 8318, "blue letter 'B' symbol", NULL, NULL }, + { "letter_c_blue", 8319, "blue letter 'C' symbol", NULL, NULL }, + { "letter_d_blue", 8320, "blue letter 'D' symbol", NULL, NULL }, + { "number_0_red", 8321, "red number '0' symbol", NULL, NULL }, + { "number_1_red", 8322, "red number '1' symbol", NULL, NULL }, + { "number_2_red", 8323, "red number '2' symbol", NULL, NULL }, + { "number_3_red", 8324, "red number '3' symbol", NULL, NULL }, + { "number_4_red", 8325, "red number '4' symbol", NULL, NULL }, + { "number_5_red", 8326, "red number '5' symbol", NULL, NULL }, + { "number_6_red", 8327, "red number '6' symbol", NULL, NULL }, + { "number_7_red", 8328, "red number '7' symbol", NULL, NULL }, + { "number_8_red", 8329, "red number '8' symbol", NULL, NULL }, + { "number_9_red", 8330, "red number '9' symbol", NULL, NULL }, + { "number_0_green", 8331, "green number '0' symbol", NULL, NULL }, + { "number_1_green", 8332, "green number '1' symbol", NULL, NULL }, + { "number_2_green", 8333, "green number '2' symbol", NULL, NULL }, + { "number_3_green", 8334, "green number '3' symbol", NULL, NULL }, + { "number_4_green", 8335, "green number '4' symbol", NULL, NULL }, + { "number_5_green", 8336, "green number '5' symbol", NULL, NULL }, + { "number_6_green", 8337, "green number '6' symbol", NULL, NULL }, + { "number_7_green", 8338, "green number '7' symbol", NULL, NULL }, + { "number_8_green", 8339, "green number '8' symbol", NULL, NULL }, + { "number_9_green", 8340, "green number '9' symbol", NULL, NULL }, + { "number_0_blue", 8341, "blue number '0' symbol", NULL, NULL }, + { "number_1_blue", 8342, "blue number '1' symbol", NULL, NULL }, + { "number_2_blue", 8343, "blue number '2' symbol", NULL, NULL }, + { "number_3_blue", 8344, "blue number '3' symbol", NULL, NULL }, + { "number_4_blue", 8345, "blue number '4' symbol", NULL, NULL }, + { "number_5_blue", 8346, "blue number '5' symbol", NULL, NULL }, + { "number_6_blue", 8347, "blue number '6' symbol", NULL, NULL }, + { "number_7_blue", 8348, "blue number '7' symbol", NULL, NULL }, + { "number_8_blue", 8349, "blue number '8' symbol", NULL, NULL }, + { "number_9_blue", 8350, "blue number '9' symbol", NULL, NULL }, + { "triangle_blue", 8351, "blue triangle symbol", NULL, NULL }, + { "triangle_green", 8352, "green triangle symbol", NULL, NULL }, + { "triangle_red", 8353, "red triangle symbol", NULL, NULL }, + /*--------------------------------------------------------------- + Aviation symbols + ---------------------------------------------------------------*/ + { "airport", 16384, "airport symbol", NULL, NULL }, + { "int", 16385, "intersection symbol", NULL, NULL }, + { "ndb", 16386, "non-directional beacon symbol", NULL, NULL }, + { "vor", 16387, "VHF omni-range symbol", NULL, NULL }, + { "heliport", 16388, "heliport symbol", NULL, NULL }, + { "private", 16389, "private field symbol", NULL, NULL }, + { "soft_fld", 16390, "soft field symbol", NULL, NULL }, + { "tall_tower", 16391, "tall tower symbol", NULL, NULL }, + { "short_tower", 16392, "short tower symbol", NULL, NULL }, + { "glider", 16393, "glider symbol", NULL, NULL }, + { "ultralight", 16394, "ultralight symbol", NULL, NULL }, + { "parachute", 16395, "parachute symbol", NULL, NULL }, + { "vortac", 16396, "VOR/TACAN symbol", NULL, NULL }, + { "vordme", 16397, "VOR-DME symbol", NULL, NULL }, + { "faf", 16398, "first approach fix", NULL, NULL }, + { "lom", 16399, "localizer outer marker", NULL, NULL }, + { "map", 16400, "missed approach point", NULL, NULL }, + { "tacan", 16401, "TACAN symbol", NULL, NULL }, + { "seaplane", 16402, "Seaplane Base", NULL, NULL } +}; + +GHashTable *icons = NULL; + +static void init_icons() { + icons = g_hash_table_new_full ( g_str_hash, g_str_equal, NULL, NULL); + gint i; + for (i=0; i + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef __VIKING_GARMINSYMBOLS_H +#define __VIKING_GARMINSYMBOLS_H + +GdkPixbuf *a_get_wp_sym ( const gchar *sym ); +void a_populate_sym_list ( GtkListStore *list ); + +#endif diff --git a/src/gpspoint.c b/src/gpspoint.c index e7f2d320..00837a7a 100644 --- a/src/gpspoint.c +++ b/src/gpspoint.c @@ -64,6 +64,7 @@ static struct LatLon line_latlon; static gchar *line_name; static gchar *line_comment; static gchar *line_image; +static gchar *line_symbol; static gboolean line_newsegment = FALSE; static gboolean line_has_timestamp = FALSE; static time_t line_timestamp = 0; @@ -137,6 +138,9 @@ void a_gpspoint_read_file(VikTrwLayer *trw, FILE *f ) { line_type = 0; line_timestamp = 0; line_newsegment = FALSE; + line_image = NULL; + line_symbol = NULL; + current_track = NULL; while (fgets(line_buffer, 2048, f)) { @@ -207,6 +211,12 @@ void a_gpspoint_read_file(VikTrwLayer *trw, FILE *f ) { line_image = NULL; } + if ( line_symbol ) + { + vik_waypoint_set_symbol ( wp, line_symbol ); + line_symbol = NULL; + } + line_name = NULL; /* will be freed automatically */ } else if (line_type == GPSPOINT_TYPE_TRACK && line_name) @@ -252,14 +262,18 @@ void a_gpspoint_read_file(VikTrwLayer *trw, FILE *f ) { g_free ( line_comment ); if (line_image) g_free ( line_image ); + if (line_symbol) + g_free ( line_symbol ); line_comment = NULL; line_image = NULL; + line_symbol = NULL; line_type = GPSPOINT_TYPE_NONE; line_newsegment = FALSE; line_has_timestamp = FALSE; line_timestamp = 0; line_altitude = VIK_DEFAULT_ALTITUDE; line_visible = TRUE; + line_symbol = NULL; } } @@ -363,6 +377,10 @@ static void gpspoint_process_key_and_value ( const gchar *key, gint key_len, con { line_visible = FALSE; } + else if (key_len == 6 && strncasecmp( key, "symbol", key_len ) == 0 && value != NULL) + { + line_symbol = g_strndup ( value, value_len ); + } else if (key_len == 8 && strncasecmp( key, "unixtime", key_len ) == 0 && value != NULL) { line_timestamp = g_strtod(value, NULL); @@ -394,6 +412,10 @@ static void a_gpspoint_write_waypoint ( const gchar *name, VikWaypoint *wp, FILE fprintf ( f, " image=\"%s\"", tmp_image ); g_free ( tmp_image ); } + if ( wp->symbol ) + { + fprintf ( f, " symbol=\"%s\"", wp->symbol ); + } if ( ! wp->visible ) fprintf ( f, " visible=\"n\"" ); fprintf ( f, "\n" ); diff --git a/src/icons.h b/src/icons.h index 03c367d9..929cf3cd 100644 --- a/src/icons.h +++ b/src/icons.h @@ -7,4 +7,12 @@ #include "icons/mapdl_18.png.h" #include "icons/ruler_18.png.h" #include "icons/showpic_18.png.h" +#include "icons/wp_camp.png.h" +#include "icons/wp_car.png.h" +#include "icons/wp_deer.png.h" +#include "icons/wp_flag.png.h" +#include "icons/wp_geocache_fnd.png.h" +#include "icons/wp_geocache.png.h" +#include "icons/wp_house.png.h" +#include "icons/wp_wpt_dot.png.h" #include "icons/zoom_18.png.h" diff --git a/src/icons/wp_camp.png b/src/icons/wp_camp.png new file mode 100644 index 0000000000000000000000000000000000000000..9079fe3e771f4484fdd9e7a3bc9813c86ea3cb83 GIT binary patch literal 473 zcmV;~0Ve*5P)t|} z>De##=l{22MIf}+cD&eZ0VrpAXgLu_q66Gqp7UFbJWAxCrP4GNKmlC^K)%0FXJe|e z^egHsS!}jKZ5*UFcHP7Ci{F~oS~^G%sK}B|<*xQ%NAIXr0-(zA1)q(FH@T7l-`BYhW{YAVDIwDKoQOYkH}&M z25w;xW@MN(M*=9wUgGKN%6^qoRzQ=XQsvteppa~dYeb22er|4RUI~M9QEFmIYKlU6 zW=V!ZNJgrHyQgo!`xMnYpu*RlE{-7@--Xq>tHRE$kndcDdZ# z{Z;gCu;P`8>lMV($}=9Tsbo4HI?*LN=kq~JheKO}Zk#P+l%B`m7roYUS>=;C&n8OC z1vzZ8s8(=cVGuYjd_88}_R=+W3L=H;JHxmlxsFIUr$#0%;$)c6eW#a`flHIo!G(YK zT=nOX&&tm4a!uZK_^)qx*jcqgBZd@y_EVO>H)T!Qxn|aT`y$CD4a}+HYkpe4-nFd7 zD=_{_dqY{;zcq3l))NkWT*3Kpuh80SG4t1k9^LeFY1F3AMR$3g#9fNb|9`8Ihr#Fi e;gY{<3&j5_&)f64`Hnr%+YFwrelF{r5}E+d2$zrm literal 0 HcmV?d00001 diff --git a/src/icons/wp_car.png.h b/src/icons/wp_car.png.h new file mode 100644 index 00000000..f5c12af5 --- /dev/null +++ b/src/icons/wp_car.png.h @@ -0,0 +1,36 @@ +/* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */ + +static const GdkPixdata wp_car = { + 0x47646b50, /* Pixbuf magic: 'GdkP' */ + 24 + 527, /* header length + pixel_data length */ + 0x2010002, /* pixdata_type */ + 72, /* rowstride */ + 18, /* width */ + 18, /* height */ + /* pixel_data: */ + "\206\0\0\0\0\1\213\211\211\0\222\0\0\0\0\1\213\211\211\0\220\0\0\0\0" + "\1\315\305\277\0\202\0\0\0\0\1\203\213\213\0\202\0\0\0\0\6\377\365\356" + "\0\203\213\213\0\0\0\0\0\377\365\356\0\0\0\0\0\213\211\211\0\210\0\0" + "\0\0\202\203\213\213\0\1\377\377\377\0\202\0\0\0\0\5\203\213\213\0\0" + "\0\0\0\203\213\213\0\0\0\0\0\213\211\211\0\207\0\0\0\0\1\203\213\213" + "\0\205\0\0\0\377\202\0\0\0\0\3\203\213\213\0\0\0\0\0\213\211\211\0\206" + "\0\0\0\0\2\276\276\276\377\0\0\0\377\202\360\377\360\377\1\0\0\0\377" + "\202\360\377\360\377\202\0\0\0\377\3\276\276\276\377\0\0\0\0\213\211" + "\211\0\203\0\0\0\0\1\276\276\276\377\203\0\0\0\377\203\360\377\360\377" + "\1\0\0\0\377\204\360\377\360\377\203\0\0\0\377\1\0\0\0\0\203\0\0\0\377" + "\202\315\263\213\377\215\0\0\0\377\205\315\263\213\377\1\0\0\0\377\203" + "\315\263\213\377\1\0\0\0\377\203\315\263\213\377\1\0\0\0\377\202\315" + "\263\213\377\202\0\0\0\377\1\315\263\213\377\203\0\0\0\377\2\315\263" + "\213\377\0\0\0\377\203\315\263\213\377\1\0\0\0\377\203\315\263\213\377" + "\207\0\0\0\377\1iii\377\213\0\0\0\377\1iii\377\202\0\0\0\377\202\0\0" + "\0\0\203\0\0\0\377\11\377\377\377\0\0\0\0\0\377\377\377\0\0\0\0\0\377" + "\377\377\0\0\0\0\0\377\377\377\0\0\0\0\0\377\377\377\0\203\0\0\0\377" + "\206\0\0\0\0\5\377\377\377\0\0\0\0\0\377\377\377\0\0\0\0\0\377\377\377" + "\0\203\0\0\0\0\3\377\377\377\0\0\0\0\0\203\213\213\0\207\0\0\0\0\4\377" + "\377\377\0\0\0\0\0\377\377\377\0\0\0\0\0\205\377\377\377\0\2\0\0\0\0" + "\203\213\213\0\221\0\0\0\0\1\203\213\213\0\207\0\0\0\0\213\203\213\213" + "\0\210\0\0\0\0\1\315\305\277\0\217\0\0\0\0\1\315\305\277\0\202\213\206" + "\202\0\213\0\0\0\0", +}; + + diff --git a/src/icons/wp_deer.png b/src/icons/wp_deer.png new file mode 100644 index 0000000000000000000000000000000000000000..fc551a57fcd14255a6fde1037eafd84bbb7489e9 GIT binary patch literal 436 zcmeAS@N?&q;$mQ6;PUiv2?EkWAk4uAB*V`2g##(JByV>YAPodRop;v*Db50q$YKTt zZeb8+WSBKa0w~B{;_2(kew9;Jz*MF?=zAMbNVdc^qQp5rH#aq}gu%HeHL)Z$MWH;i zBts!2BUQoO(>LIKifSGM1EZv;i(`nz>7|nm{SF(5wAqK>y-~$p#VEku5mMOQcSpgQ zU2Q@@N?MzTPE2Fx(a_M1A)h#_*v+0De_&B2b3FH`e&l=APrpCy|1NU0rN^)~E_75I>`p;f%MRQ6HPZ&%chbx)*#Wmp_?%=YH(&JzKT1xb{YJE1b`N z|MOapp{)wrrvm3YL4Q9n9!QS$=IUC@uI{jTN2z|a^gGLTtyy;y3J&f3wAO0*2YUhLPffk1!Sxgtb@$}Mpk0)E%mvb$+;#pP5 zWDs{uGvN7}@J}`W!kSGbkA7jW$+Z2uo>61zrj1K8Pc{NfAdYe b@gGCgvUZD>qY*8@&}8s*^>bP0l+XkK%YhHi#VhECV7ise8N&H|6f zVg?3oVGw3ym^DWND9B#o>FdgVl~Y!LU99c9*Gr&~Y>8_`iF1B#Zfaf$gL6@8Vo7R> zLV0FMhC)b2s)D9dt!l zbVF}#ZDnqB07G(RVRU6=Aa`kWXdqN*WgtgMO;GP-C2jx!0g*{WK~y-)m6I`R!ax+q z|5q~A#l%qrLl!3&og6X*Aw%2QFCYacLGTlFl0YGAzk#z|0wu*rJCp{*NhoOw#j%MF zov%Z^P09wsyw*XZSyh}v5Bk%Q9!%O{)U{Axurv=}B+y5P%s2DI&SnZ9}z<0xY<>2LL>VVdgu7h&=)TsJ4OB zi};>b@EZT1qgSw8eio7yu3xnZtj1HWprcp#8S{mgPVx>F8i&DPfUADL0AS~M2nlXm z(h(t=R!5S2@iIDk1(&-W2MGNrK=Kcg@QlK+UbkAHl#=}dTL5t9ILAiye?Vn}nKuz6 un>BJO(^(e2Jf9V>$N>I)0e`+Y3-kw0PQ8XYPP60y0000\263r\377" + "\1\0\0\0\377\210\0\0\0\0\203\276\276\276\0\202\0\0\0\377\202>\263r\377" + "\203.\213W\377\4\0\0\0\377\377\365\356\0\0\0\0\0\213\211\211\0\204\0" + "\0\0\0\1\276\276\276\0\202\0\0\0\377\4>\263r\377.\213W\377\35D4\377>" + "\263r\377\204.\213W\377\3\0\0\0\377\0\0\0\0\213\211\211\0\203\0\0\0\0" + "\202\0\0\0\377\5>\263r\377.\213W\377\35D4\377>\263r\377.\213W\377\202" + "\35D4\377\1>\263r\377\202.\213W\377\4\35D4\377\0\0\0\377\213\211\211" + "\0\0\0\0\0\202\0\0\0\377\202>\263r\377\3\35D4\377>\263r\377.\213W\377" + "\202\35D4\377\5>\263r\377.\213W\377\35D4\377>\263r\377\35D4\377\202\0" + "\0\0\377\2\213\211\211\0\0\0\0\377\202>\263r\377\203.\213W\377\202\35" + "D4\377\5>\263r\377.\213W\377\35D4\377>\263r\377\35D4\377\202\0\0\0\377" + "\3\356\356\340\377\0\0\0\377\0\0\0\0\202\0\0\0\377\206.\213W\377\3\35" + "D4\377>\263r\377\35D4\377\202\0\0\0\377\203\356\356\340\377\6\0\0\0\377" + "\0\0\0\0\0\0\0\377\356\356\340\377\0\0\0\377\35D4\377\204.\213W\377\1" + "\35D4\377\202\0\0\0\377\202\264\315\315\377\202\356\356\340\377\1\0\0" + "\0\377\202\0\0\0\0\7\0\0\0\377\356\356\340\377\0\0\0\377.\213W\377\35" + "D4\377.\213W\377\35D4\377\202\0\0\0\377\202\356\356\340\377\2\264\315" + "\315\377\356\356\340\377\202\276\276\276\377\1\0\0\0\377\202\0\0\0\0" + "\3\0\0\0\377\356\356\340\377\0\0\0\377\202.\213W\377\202\0\0\0\377\1" + "\264\315\315\377\205\356\356\340\377\202\0\0\0\377\204\0\0\0\0\2\0\0" + "\0\377\356\356\340\377\202\0\0\0\377\1iii\377\203\264\315\315\377\202" + "\356\356\340\377\202\0\0\0\377\1\0\232\315\0\206\0\0\0\0\1\0\0\0\377" + "\202\356\356\340\377\4iii\377\356\356\340\377\276\276\276\377\264\315" + "\315\377\202\0\0\0\377\212\0\0\0\0\4\0\0\0\377\356\356\340\377iii\377" + "\356\356\340\377\202\0\0\0\377\205\377\377\377\0\2\0\0\0\0\203\213\213" + "\0\206\0\0\0\0\203\0\0\0\377\210\0\0\0\0\1\203\213\213\0\207\0\0\0\0" + "\213\203\213\213\0\210\0\0\0\0\1\315\305\277\0\217\0\0\0\0\1\315\305" + "\277\0\202\213\206\202\0\213\0\0\0\0", +}; + + diff --git a/src/icons/wp_geocache_fnd.png b/src/icons/wp_geocache_fnd.png new file mode 100644 index 0000000000000000000000000000000000000000..fe8678fd6b2870ae5f660dcfc29e41f22c9e2058 GIT binary patch literal 586 zcmV-Q0=4~#P)YD-S<+agIja;~EJ6yg&KHn_R6-!#byvy4!M67btYfnvE3SCOVL+^eBd#Ep zZnU`iUE>V1n=$ub*~iZ8kN^9>HzRx!d7j%mj$@PR$6K2FH&_$d?>{a;quGRLHgSPA zN9$qNZg774&?dc~YWGhf3rdgWCajem7 zLO&T%rUl!3JG6&A%CumaE!f`Mv72`f_HCIh*F;l-tDsB^0K$`~rmjp2o-b}|9;wfR zWwxjRmf2zjP*qO^K^H*8sOcvoZ|6P(m@uH0OWr-$r#1?E0G!X~weJSvdIUgw z*khS3?7OMpSNX~y>~MGYSnm+%O8eWx9{1BTt6&gz?3&4)Nf-UF#tfu7#xWj`IXpgI z0ho1u&V{dEa3N-nBnY}x)srn_5O&ynf42a~j~c{;TbcwxSKW@75>!pc00lp`Rcc#8gr|LQJvhD_9esk%Qs^(#hM;4G@U6Ws3\263r\377" + "\1\0\0\0\377\210\0\0\0\0\203\276\276\276\0\202\0\0\0\377\202>\263r\377" + "\203.\213W\377\4\0\0\0\377\377\365\356\0\0\0\0\0\213\211\211\0\204\0" + "\0\0\0\1\276\276\276\0\202\0\0\0\377\4>\263r\377.\213W\377\35D4\377>" + "\263r\377\204.\213W\377\3\0\0\0\377\0\0\0\0\213\211\211\0\203\0\0\0\0" + "\202\0\0\0\377\5>\263r\377.\213W\377\35D4\377>\263r\377.\213W\377\202" + "\35D4\377\1>\263r\377\202.\213W\377\4\35D4\377\0\0\0\377\213\211\211" + "\0\0\0\0\0\202\0\0\0\377\202>\263r\377\3\35D4\377>\263r\377.\213W\377" + "\202\35D4\377\5>\263r\377.\213W\377\35D4\377>\263r\377\35D4\377\202\0" + "\0\0\377\2\213\211\211\0\0\0\0\377\202>\263r\377\203.\213W\377\202\35" + "D4\377\5>\263r\377.\213W\377\35D4\377>\263r\377\35D4\377\202\0\0\0\377" + "\3\356\356\340\377\0\0\0\377\0\0\0\0\202\0\0\0\377\206.\213W\377\3\35" + "D4\377>\263r\377\35D4\377\202\0\0\0\377\203\356\356\340\377\6\0\0\0\377" + "\0\0\0\0\0\0\0\377\356\356\340\377\0\0\0\377\35D4\377\204.\213W\377\1" + "\35D4\377\202\0\0\0\377\202\264\315\315\377\202\356\356\340\377\1\0\0" + "\0\377\202\0\0\0\0\7\0\0\0\377\356\356\340\377\0\0\0\377.\213W\377\35" + "D4\377.\213W\377\35D4\377\202\0\0\0\377\202\356\356\340\377\2\264\315" + "\315\377\356\356\340\377\202\276\276\276\377\6\0\0\0\377\0\0\0\0\377" + "\0\0\377\0\0\0\377\356\356\340\377\0\0\0\377\202.\213W\377\202\0\0\0" + "\377\1\264\315\315\377\205\356\356\340\377\202\0\0\0\377\1\0\0\0\0\202" + "\377\0\0\377\3\0\0\0\0\0\0\0\377\356\356\340\377\202\0\0\0\377\1iii\377" + "\203\264\315\315\377\202\356\356\340\377\202\0\0\0\377\2\0\232\315\0" + "\0\0\0\0\202\377\0\0\377\1\0\0\0\377\202\0\0\0\0\1\0\0\0\377\202\356" + "\356\340\377\4iii\377\356\356\340\377\276\276\276\377\264\315\315\377" + "\202\0\0\0\377\203\0\0\0\0\203\377\0\0\377\1\0\0\0\377\203\0\0\0\0\4" + "\0\0\0\377\356\356\340\377iii\377\356\356\340\377\202\0\0\0\377\4\377" + "\377\377\0\377\0\0\377\0\0\0\377\377\377\377\0\203\377\0\0\377\1\0\0" + "\0\377\205\0\0\0\0\203\0\0\0\377\203\0\0\0\0\202\377\0\0\377\1\0\0\0" + "\377\202\377\0\0\377\1\0\0\0\377\207\0\0\0\0\206\203\213\213\0\204\377" + "\0\0\377\1\0\0\0\377\210\0\0\0\0\1\315\305\277\0\204\0\0\0\0\203\377" + "\0\0\377\1\0\0\0\377\207\0\0\0\0\1\315\305\277\0\202\213\206\202\0\205" + "\0\0\0\0\2\377\0\0\377\0\0\0\377\204\0\0\0\0", +}; + + diff --git a/src/icons/wp_house.png b/src/icons/wp_house.png new file mode 100644 index 0000000000000000000000000000000000000000..00672afbc73020e7f349f0fae56c5db73a43c22e GIT binary patch literal 359 zcmeAS@N?&q;$mQ6;PUiv2?EkWAk4uAB*V`2g##(JByV>YhHi#VhECV7ise8N&H|6f zVg?3oVGw3ym^DWND9B#o>FdgVl~YzgR&d2W)rmkM*%H@?66gHf+|;}h2Ir#G#FEq$ zh4Rdj426)4R0VfW-+=cis(C<#XFOdTLo80OoxG9nkb*$ldk=H-_@f&qzYn>5bgkZ# zGV}PQ%Q9tZr{?+IIk&KYk%j5ie1RQPe(!j!&%inHTHc8d-8?;W1J^%)tT&<2BVmtT zLUNqAWx!I0_HQQ`7?>|!lg?*-n5REAcAa_TatFC5cS_}SmMs%elAp;aXg_HK+apye ziOk-_?6|v@9jk-yfA-egpI*4w;hOJc;r$uA19kk5=(#*S#TR>O=duU>tC)`Fod4_Y znk&}$=H$Z|?n85y-rx5x$<*+G#aRQtV$l~|soXQ#Rz~XX1Nw`>)78&qol`;+0HbGx A)c^nh literal 0 HcmV?d00001 diff --git a/src/icons/wp_house.png.h b/src/icons/wp_house.png.h new file mode 100644 index 00000000..1f66ae6b --- /dev/null +++ b/src/icons/wp_house.png.h @@ -0,0 +1,40 @@ +/* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */ + +static const GdkPixdata wp_house = { + 0x47646b50, /* Pixbuf magic: 'GdkP' */ + 24 + 596, /* header length + pixel_data length */ + 0x2010002, /* pixdata_type */ + 72, /* rowstride */ + 18, /* width */ + 18, /* height */ + /* pixel_data: */ + "\206\0\0\0\0\1\213\211\211\0\202\0\0\0\0\1\0\0\0\377\217\0\0\0\0\1\213" + "\211\211\0\203\0\0\0\377\215\0\0\0\0\1\315\305\277\0\202\0\0\0\377\1" + "\203\213\213\377\202\0\0\0\377\6\377\365\356\0\203\213\213\377\0\0\0" + "\377\377\365\356\0\0\0\0\0\213\211\211\0\206\0\0\0\0\202\0\0\0\377\202" + "\203\213\213\377\1\377\377\377\377\202\0\0\0\377\5\203\213\213\377\0" + "\0\0\377\203\213\213\377\0\0\0\0\213\211\211\0\205\0\0\0\0\202\0\0\0" + "\377\202\203\213\213\377\203\377\377\377\377\6\0\0\0\377\203\213\213" + "\377\0\0\0\377\203\213\213\377\0\0\0\0\213\211\211\0\204\0\0\0\0\202" + "\0\0\0\377\202\203\213\213\377\205\377\377\377\377\202\0\0\0\377\3\203" + "\213\213\377\0\0\0\0\213\211\211\0\203\0\0\0\0\202\0\0\0\377\202\203" + "\213\213\377\207\377\377\377\377\202\0\0\0\377\202\213\211\211\0\202" + "\0\0\0\0\203\0\0\0\377\1\203\213\213\377\210\377\377\377\377\203\0\0" + "\0\377\1\203\213\213\377\203\0\0\0\0\2\203\213\213\377\0\0\0\377\211" + "\377\377\377\377\1\0\0\0\377\202\203\213\213\377\205\0\0\0\0\2\0\0\0" + "\377\377\377\377\377\203\0\0\0\377\1\377\377\377\377\203\0\0\0\377\3" + "\377\377\377\377\0\0\0\377\203\213\213\377\206\0\0\0\0\14\0\0\0\377\377" + "\377\377\377\0\0\0\377\377\377\377\377\0\0\0\377\377\377\377\377\0\0" + "\0\377\377\377\377\377\0\0\0\377\377\377\377\377\0\0\0\377\203\213\213" + "\377\206\0\0\0\0\14\0\0\0\377\377\377\377\377\0\0\0\377\377\377\377\377" + "\0\0\0\377\377\377\377\377\0\0\0\377\377\377\377\377\0\0\0\377\377\377" + "\377\377\0\0\0\377\203\213\213\377\206\0\0\0\0\6\0\0\0\377\377\377\377" + "\377\0\0\0\377\377\377\377\377\0\0\0\377\377\377\377\377\203\0\0\0\377" + "\3\377\377\377\377\0\0\0\377\203\213\213\377\206\0\0\0\0\5\0\0\0\377" + "\377\377\377\377\0\0\0\377\377\377\377\377\0\0\0\377\205\377\377\377" + "\377\2\0\0\0\377\203\213\213\377\206\0\0\0\0\213\0\0\0\377\1\203\213" + "\213\377\207\0\0\0\0\213\203\213\213\377\210\0\0\0\0\1\315\305\277\0" + "\217\0\0\0\0\1\315\305\277\0\202\213\206\202\0\213\0\0\0\0", +}; + + diff --git a/src/icons/wp_wpt_dot.png b/src/icons/wp_wpt_dot.png new file mode 100644 index 0000000000000000000000000000000000000000..597c9ed700f7e4378e8a244e0bb09789c2b26d97 GIT binary patch literal 421 zcmeAS@N?&q;$mQ6;PUiv2?EkWAk4uAB*V`2g##(JByV>YAPodRop;v*Db50q$YKTt zZeb8+WSBKa0w~B{;_2(kew9;Jz(_p!;Et0(A=whwh!W@g+}zZ>5(ej@)Wnk16ovB4 zk_?5Aj8p}8Pv3y|DXMu442)c!E{-7#1RYN0INd6Qxe zxc*`}v}t9qL=9JX-Z6>E#}wiZOx1s&w>4RCzf(RwUX#6G&VBtGK1b(w`<@B44D!!h@Zx1~`!u5fh8dxk zC(3>)IC`kW>sMKB>BehOTdu11x;WYIH8J0;^?LC^Aq1@|6oI5H*m!`l7l z+qQnoddq&G`tp+dQVl^`yV7iL)h(Z$SZ5ab+})7r=DP`R^}1j1SCv+Ox%~gZR$%Zk Nc)I$ztaD0e0stEMuCxFE literal 0 HcmV?d00001 diff --git a/src/icons/wp_wpt_dot.png.h b/src/icons/wp_wpt_dot.png.h new file mode 100644 index 00000000..c6f39062 --- /dev/null +++ b/src/icons/wp_wpt_dot.png.h @@ -0,0 +1,36 @@ +/* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */ + +static const GdkPixdata wp_wpt_dot = { + 0x47646b50, /* Pixbuf magic: 'GdkP' */ + 24 + 581, /* header length + pixel_data length */ + 0x2010002, /* pixdata_type */ + 72, /* rowstride */ + 18, /* width */ + 18, /* height */ + /* pixel_data: */ + "\206\0\0\0\0\203\276\276\276\0\202w\210\231\0\215\0\0\0\0\2\276\276\276" + "\0w\210\231\0\202\276\276\276\0\1w\210\231\0\213\0\0\0\0\203\276\276" + "\276\0\2w\210\231\0\276\276\276\0\206\0\0\0\0\3\377\365\356\0\0\0\0\0" + "\213\211\211\0\204\0\0\0\0\2\276\276\276\0w\210\231\0\202\276\276\276" + "\0\2w\210\231\0\0\232\315\0\202\0\0\0\0\1\0\232\315\0\202\0\0\0\0\3\203" + "\213\213\0\0\0\0\0\213\211\211\0\203\0\0\0\0\1\276\276\276\0\202w\210" + "\231\0\1\276\276\276\0\202w\210\231\0\203\0\0\0\0\202\0\232\315\0\4\0" + "\0\0\0\203\213\213\0\0\0\0\0\213\211\211\0\203\0\0\0\0\3\276\276\276" + "\0w\210\231\0\276\276\276\0\202w\210\231\0\4\0\232\315\0\0\0\0\0\0\232" + "\315\0\0\0\0\0\202\0\232\315\0\4\0\0\0\0\276\276\276\0\0\0\0\0\213\211" + "\211\0\202\0\0\0\0\1\377\214\0\0\203\276\276\276\0\206\0\0\0\377\1\0" + "\0\0\0\202\0\232\315\0\205\0\0\0\0\4\377\214\0\0\377E\0\0\276\276\276" + "\0w\210\231\0\206\0\0\0\377\1\0\0\0\0\202\0\232\315\0\204\0\0\0\0\5\315" + "\263\213\0\377\214\0\0\377E\0\0\377\214\0\0w\210\231\0\206\0\0\0\377" + "\2\0\232\315\0\0\0\0\0\202\0\232\315\0\203\0\0\0\0\5\377E\0\0\377\214" + "\0\0\0\0\0\0\377\214\0\0\377E\0\0\206\0\0\0\377\1\0\232\315\0\202\0\0" + "\0\0\1\0\232\315\0\202\0\0\0\0\2\377E\0\0\315&&\0\202\0\0\0\0\2\377\214" + "\0\0\377E\0\0\206\0\0\0\377\202\0\232\315\0\207\0\0\0\0\1\377E\0\0\202" + "\0\0\0\0\206\0\0\0\377\2\0\0\0\0\0\232\315\0\206\0\0\0\0\2\377E\0\0\315" + "&&\0\203\0\0\0\0\1\315&&\0\217\0\0\0\0\4\377\377\377\0\0\0\0\0\377\377" + "\377\0\0\0\0\0\205\377\377\377\0\2\0\0\0\0\203\213\213\0\221\0\0\0\0" + "\1\203\213\213\0\207\0\0\0\0\213\203\213\213\0\210\0\0\0\0\1\315\305" + "\277\0\217\0\0\0\0\1\315\305\277\0\202\213\206\202\0\213\0\0\0\0", +}; + + diff --git a/src/viktrwlayer.c b/src/viktrwlayer.c index acf98a0b..67151a0b 100644 --- a/src/viktrwlayer.c +++ b/src/viktrwlayer.c @@ -28,6 +28,7 @@ #include "viktrwlayer_pixmap.h" #include "viktrwlayer_tpwin.h" #include "viktrwlayer_propwin.h" +#include "garminsymbols.h" #include "thumbnails.h" #include "background.h" @@ -906,6 +907,7 @@ static void trw_layer_draw_waypoint ( const gchar *name, VikWaypoint *wp, struct wp->coord.north_south > dp->cn1 && wp->coord.north_south < dp->cn2 ) ) { gint x, y; + GdkPixbuf *sym; vik_viewport_coord_to_screen ( dp->vp, &(wp->coord), &x, &y ); /* if in shrunken_cache, get that. If not, get and add to shrunken_cache */ @@ -978,7 +980,10 @@ static void trw_layer_draw_waypoint ( const gchar *name, VikWaypoint *wp, struct } /* DRAW ACTUAL DOT */ - if ( wp == dp->vtl->current_wp ) { + if ( wp->symbol && (sym = a_get_wp_sym(wp->symbol)) ) { + vik_viewport_draw_pixbuf ( dp->vp, sym, 0, 0, x - gdk_pixbuf_get_width(sym)/2, y - gdk_pixbuf_get_height(sym)/2, -1, -1 ); + } + else if ( wp == dp->vtl->current_wp ) { switch ( dp->vtl->wp_symbol ) { case WP_SYMBOL_FILLED_SQUARE: vik_viewport_draw_rectangle ( dp->vp, dp->vtl->waypoint_gc, TRUE, x - (dp->vtl->wp_size), y - (dp->vtl->wp_size), dp->vtl->wp_size*2, dp->vtl->wp_size*2 ); break; case WP_SYMBOL_SQUARE: vik_viewport_draw_rectangle ( dp->vp, dp->vtl->waypoint_gc, FALSE, x - (dp->vtl->wp_size), y - (dp->vtl->wp_size), dp->vtl->wp_size*2, dp->vtl->wp_size*2 ); break; @@ -1363,17 +1368,16 @@ static void trw_layer_goto_wp ( gpointer layer_and_vlp[2] ) gboolean vik_trw_layer_new_waypoint ( VikTrwLayer *vtl, GtkWindow *w, const VikCoord *def_coord ) { gchar *name; - static VikWaypoint st_wp; - st_wp.coord = *def_coord; - st_wp.altitude = VIK_DEFAULT_ALTITUDE; + VikWaypoint *wp = vik_waypoint_new(); + wp->coord = *def_coord; + wp->altitude = VIK_DEFAULT_ALTITUDE; - if ( a_dialog_new_waypoint ( w, &name, &st_wp, vik_trw_layer_get_waypoints ( vtl ), vtl->coord_mode ) ) + if ( a_dialog_new_waypoint ( w, &name, wp, vik_trw_layer_get_waypoints ( vtl ), vtl->coord_mode ) ) { - VikWaypoint *wp = vik_waypoint_new(); - *wp = st_wp; vik_trw_layer_add_waypoint ( vtl, name, wp ); return TRUE; } + vik_waypoint_free(wp); return FALSE; } diff --git a/src/vikviewport.c b/src/vikviewport.c index 78f9a7cc..cdfb0ee7 100644 --- a/src/vikviewport.c +++ b/src/vikviewport.c @@ -281,6 +281,72 @@ void vik_viewport_clear ( VikViewport *vvp ) gdk_draw_rectangle(GDK_DRAWABLE(vvp->scr_buffer), vvp->background_gc, TRUE, 0, 0, vvp->width, vvp->height); } +void vik_viewport_draw_scale ( VikViewport *vvp ) +{ + VikCoord left, right; + gdouble unit, base, diff, old_unit, old_diff, ratio; + gint odd, len, PAD = 10, SCSIZE = 5, HEIGHT=10; + PangoFontDescription *pfd; + PangoLayout *pl; + gchar s[128]; + + g_return_if_fail ( vvp != NULL ); + + vik_viewport_screen_to_coord ( vvp, 0, vvp->height, &left ); + vik_viewport_screen_to_coord ( vvp, vvp->width/SCSIZE, vvp->height, &right ); + + base = vik_coord_diff ( &left, &right ); // in meters + ratio = (vvp->width/SCSIZE)/base; + + unit = 1; + diff = fabs(base-unit); + old_unit = unit; + old_diff = diff; + odd = 1; + while (diff <= old_diff) { + old_unit = unit; + old_diff = diff; + unit = unit * (odd%2 ? 5 : 2); + diff = fabs(base-unit); + odd++; + } + unit = old_unit; + len = unit * ratio; + + vik_viewport_draw_line(vvp, GTK_WIDGET(&vvp->drawing_area)->style->black_gc, + PAD, vvp->height-PAD, PAD + len, vvp->height-PAD); + vik_viewport_draw_line(vvp, GTK_WIDGET(&vvp->drawing_area)->style->black_gc, + PAD, vvp->height-PAD, PAD, vvp->height-PAD-HEIGHT); + vik_viewport_draw_line(vvp, GTK_WIDGET(&vvp->drawing_area)->style->black_gc, + PAD + len, vvp->height-PAD, PAD + len, vvp->height-PAD-HEIGHT); + if (odd%2) { + int i; + for (i=1; i<5; i++) { + vik_viewport_draw_line(vvp, GTK_WIDGET(&vvp->drawing_area)->style->black_gc, + PAD+i*len/5, vvp->height-PAD, PAD+i*len/5, vvp->height-PAD-((i==5)?(2*HEIGHT/3):(HEIGHT/2))); + } + } else { + int i; + for (i=1; i<10; i++) { + vik_viewport_draw_line(vvp, GTK_WIDGET(&vvp->drawing_area)->style->black_gc, + PAD+i*len/10, vvp->height-PAD, PAD+i*len/10, vvp->height-PAD-((i==5)?(2*HEIGHT/3):(HEIGHT/2))); + } + } + pl = gtk_widget_create_pango_layout (GTK_WIDGET(&vvp->drawing_area), NULL); + pfd = pango_font_description_from_string ("Sans 8"); // FIXME: settable option? global variable? + pango_layout_set_font_description (pl, pfd); + pango_font_description_free (pfd); + + if (unit >= 1000) { + sprintf(s, "%d km", (int)unit/1000); + } else { + sprintf(s, "%d m", (int)unit); + } + pango_layout_set_text(pl, s, -1); + vik_viewport_draw_layout(vvp, GTK_WIDGET(&vvp->drawing_area)->style->black_gc, + PAD + len + PAD, vvp->height - PAD - 10, pl); +} + void vik_viewport_sync ( VikViewport *vvp ) { g_return_if_fail ( vvp != NULL ); @@ -289,8 +355,27 @@ void vik_viewport_sync ( VikViewport *vvp ) void vik_viewport_pan_sync ( VikViewport *vvp, gint x_off, gint y_off ) { + gint x, y, wid, hei; + g_return_if_fail ( vvp != NULL ); gdk_draw_drawable(GTK_WIDGET(vvp)->window, GTK_WIDGET(vvp)->style->bg_gc[0], GDK_DRAWABLE(vvp->scr_buffer), 0, 0, x_off, y_off, vvp->width, vvp->height); + + if (x_off >= 0) { + x = 0; + wid = x_off; + } else { + x = vvp->width+x_off; + wid = -x_off; + } + if (y_off >= 0) { + y = 0; + hei = y_off; + } else { + y = vvp->height+y_off; + hei = -y_off; + } + gtk_widget_queue_draw_area(GTK_WIDGET(vvp), x, 0, wid, vvp->height); + gtk_widget_queue_draw_area(GTK_WIDGET(vvp), 0, y, vvp->width, hei); } void vik_viewport_set_zoom ( VikViewport *vvp, gdouble xympp ) diff --git a/src/vikviewport.h b/src/vikviewport.h index ef8c8248..b3202c3b 100644 --- a/src/vikviewport.h +++ b/src/vikviewport.h @@ -60,6 +60,7 @@ gboolean vik_viewport_configure ( VikViewport *vp ); void vik_viewport_clear ( VikViewport *vvp ); +void vik_viewport_draw_scale ( VikViewport *vvp ); GdkPixmap *vik_viewport_get_pixmap ( VikViewport *vvp ); diff --git a/src/vikwaypoint.c b/src/vikwaypoint.c index d5598f5e..d530d422 100644 --- a/src/vikwaypoint.c +++ b/src/vikwaypoint.c @@ -24,11 +24,13 @@ #include "vikcoord.h" #include "vikwaypoint.h" + VikWaypoint *vik_waypoint_new() { VikWaypoint *wp = g_malloc ( sizeof ( VikWaypoint ) ); wp->comment = NULL; wp->image = NULL; + wp->symbol = NULL; return wp; } @@ -61,12 +63,25 @@ void vik_waypoint_set_image(VikWaypoint *wp, const gchar *image) wp->image = NULL; } +void vik_waypoint_set_symbol(VikWaypoint *wp, const gchar *symname) +{ + if ( wp->symbol ) + g_free ( wp->symbol ); + + if ( symname && symname[0] != '\0' ) + wp->symbol = g_strdup(symname); + else + wp->symbol = NULL; +} + void vik_waypoint_free(VikWaypoint *wp) { if ( wp->comment ) g_free ( wp->comment ); if ( wp->image ) g_free ( wp->image ); + if ( wp->symbol ) + g_free ( wp->symbol ); g_free ( wp ); } @@ -78,5 +93,8 @@ VikWaypoint *vik_waypoint_copy(const VikWaypoint *wp) vik_waypoint_set_comment(new_wp,wp->comment); new_wp->image = NULL; vik_waypoint_set_image(new_wp,wp->image); + new_wp->symbol = NULL; + vik_waypoint_set_symbol(new_wp,wp->symbol); return new_wp; } + diff --git a/src/vikwaypoint.h b/src/vikwaypoint.h index 965cc651..f9f27eb5 100644 --- a/src/vikwaypoint.h +++ b/src/vikwaypoint.h @@ -39,12 +39,13 @@ struct _VikWaypoint { * dimensions of the original image. */ guint8 image_width; guint8 image_height; - /* int symbol; */ + gchar *symbol; }; VikWaypoint *vik_waypoint_new(); void vik_waypoint_set_comment(VikWaypoint *wp, const gchar *comment); void vik_waypoint_set_image(VikWaypoint *wp, const gchar *image); +void vik_waypoint_set_symbol(VikWaypoint *wp, const gchar *symname); void vik_waypoint_free(VikWaypoint * wp); VikWaypoint *vik_waypoint_copy(const VikWaypoint *wp); void vik_waypoint_set_comment_no_copy(VikWaypoint *wp, gchar *comment); diff --git a/src/vikwindow.c b/src/vikwindow.c index 7ddb95a6..cebb7bbc 100644 --- a/src/vikwindow.c +++ b/src/vikwindow.c @@ -300,8 +300,8 @@ static void draw_status ( VikWindow *vw ) static void draw_redraw ( VikWindow *vw ) { vik_viewport_clear ( vw->viking_vvp); - vik_layers_panel_draw_all ( vw->viking_vlp ); + vik_viewport_draw_scale ( vw->viking_vvp ); } static void draw_mouse_motion (VikWindow *vw, GdkEventMotion *event) @@ -317,8 +317,9 @@ static void draw_mouse_motion (VikWindow *vw, GdkEventMotion *event) g_snprintf ( pointer_buf, 36, "Cursor: %f %f", ll.lat, ll.lon ); - if ( vw->pan_x != -1 ) + if ( vw->pan_x != -1 ) { vik_viewport_pan_sync ( vw->viking_vvp, event->x - vw->pan_x, event->y - vw->pan_y ); + } vik_statusbar_set_message ( vw->viking_vs, 4, pointer_buf ); } -- 2.39.5