static gchar *line_comment;
static gchar *line_description;
static gchar *line_source;
+static gchar *line_xtype;
static gchar *line_color;
static gint line_name_label = 0;
static gint line_dist_label = 0;
if ( line_source )
vik_waypoint_set_source ( wp, line_source );
+ if ( line_xtype )
+ vik_waypoint_set_type ( wp, line_xtype );
+
if ( line_image ) {
// Ensure the filename is absolute
if ( g_path_is_absolute ( line_image ) )
if ( line_source )
vik_track_set_source ( pl, line_source );
+ if ( line_xtype )
+ vik_track_set_type ( pl, line_xtype );
+
if ( line_color )
{
if ( gdk_color_parse ( line_color, &(pl->color) ) )
g_free ( line_description );
if (line_source)
g_free ( line_source );
+ if (line_xtype)
+ g_free ( line_xtype );
if (line_color)
g_free ( line_color );
if (line_image)
line_comment = NULL;
line_description = NULL;
line_source = NULL;
+ line_xtype = NULL;
line_color = NULL;
line_image = NULL;
line_symbol = NULL;
if (line_source == NULL)
line_source = deslashndup ( value, value_len );
}
+ // NB using 'xtype' to differentiate from our own 'type' key
+ else if (key_len == 5 && strncasecmp( key, "xtype", key_len ) == 0 && value != NULL)
+ {
+ if (line_xtype == NULL)
+ line_xtype = deslashndup ( value, value_len );
+ }
else if (key_len == 5 && strncasecmp( key, "color", key_len ) == 0 && value != NULL)
{
if (line_color == NULL)
fprintf ( f, " source=\"%s\"", tmp_source );
g_free ( tmp_source );
}
+ if ( wp->type )
+ {
+ gchar *tmp_type = slashdup(wp->type);
+ fprintf ( f, " xtype=\"%s\"", tmp_type );
+ g_free ( tmp_type );
+ }
if ( wp->image )
{
gchar *tmp_image = NULL;
g_free ( tmp );
}
+ if ( trk->type ) {
+ gchar *tmp = slashdup(trk->type);
+ fprintf ( f, " xtype=\"%s\"", tmp );
+ g_free ( tmp );
+ }
+
if ( trk->has_color ) {
fprintf ( f, " color=#%.2x%.2x%.2x", (int)(trk->color.red/256),(int)(trk->color.green/256),(int)(trk->color.blue/256));
}
tt_wpt_cmt,
tt_wpt_desc,
tt_wpt_src,
+ tt_wpt_type,
tt_wpt_name,
tt_wpt_ele,
tt_wpt_sym,
tt_trk_cmt,
tt_trk_desc,
tt_trk_src,
+ tt_trk_type,
tt_trk_name,
tt_rte,
{ tt_wpt_cmt, "/gpx/wpt/cmt" },
{ tt_wpt_desc, "/gpx/wpt/desc" },
{ tt_wpt_src, "/gpx/wpt/src" },
+ { tt_wpt_type, "/gpx/wpt/type" },
{ tt_wpt_sym, "/gpx/wpt/sym" },
{ tt_wpt_sym, "/loc/waypoint/type" },
{ tt_wpt_url, "/gpx/wpt/url" },
{ tt_trk_cmt, "/gpx/trk/cmt" },
{ tt_trk_desc, "/gpx/trk/desc" },
{ tt_trk_src, "/gpx/trk/src" },
+ { tt_trk_type, "/gpx/trk/type" },
{ tt_trk_trkseg, "/gpx/trk/trkseg" },
{ tt_trk_trkseg_trkpt, "/gpx/trk/trkseg/trkpt" },
{ tt_trk_trkseg_trkpt_ele, "/gpx/trk/trkseg/trkpt/ele" },
case tt_wpt_cmt:
case tt_wpt_desc:
case tt_wpt_src:
+ case tt_wpt_type:
case tt_wpt_name:
case tt_wpt_ele:
case tt_wpt_time:
case tt_trk_cmt:
case tt_trk_desc:
case tt_trk_src:
+ case tt_trk_type:
case tt_trk_name:
g_string_erase ( c_cdata, 0, -1 ); /* clear the cdata buffer */
break;
g_string_erase ( c_cdata, 0, -1 );
break;
+ case tt_wpt_type:
+ vik_waypoint_set_type ( c_wp, c_cdata->str );
+ g_string_erase ( c_cdata, 0, -1 );
+ break;
+
case tt_wpt_url:
vik_waypoint_set_url ( c_wp, c_cdata->str );
g_string_erase ( c_cdata, 0, -1 );
g_string_erase ( c_cdata, 0, -1 );
break;
+ case tt_trk_type:
+ vik_track_set_type ( c_tr, c_cdata->str );
+ g_string_erase ( c_cdata, 0, -1 );
+ break;
+
case tt_trk_cmt:
vik_track_set_comment ( c_tr, c_cdata->str );
g_string_erase ( c_cdata, 0, -1 );
case tt_wpt_cmt:
case tt_wpt_desc:
case tt_wpt_src:
+ case tt_wpt_type:
case tt_wpt_sym:
case tt_wpt_url:
case tt_wpt_link:
case tt_trk_cmt:
case tt_trk_desc:
case tt_trk_src:
+ case tt_trk_type:
case tt_trk_trkseg_trkpt_time:
case tt_wpt_time:
case tt_trk_trkseg_trkpt_name:
fprintf ( f, " <src>%s</src>\n", tmp );
g_free ( tmp );
}
+ if ( wp->type )
+ {
+ tmp = entitize(wp->type);
+ fprintf ( f, " <type>%s</type>\n", tmp );
+ g_free ( tmp );
+ }
if ( wp->url )
{
tmp = entitize(wp->url);
g_free ( tmp );
}
+ if ( t->type )
+ {
+ tmp = entitize ( t->type );
+ fprintf ( f, " <type>%s</type>\n", tmp );
+ g_free ( tmp );
+ }
+
/* No such thing as a rteseg! */
if ( !t->is_route )
fprintf ( f, " <trkseg>\n" );
tr->source = NULL;
}
+void vik_track_set_type(VikTrack *tr, const gchar *type)
+{
+ if ( tr->type )
+ g_free ( tr->type );
+
+ if ( type && type[0] != '\0' )
+ tr->type = g_strdup(type);
+ else
+ tr->type = NULL;
+}
+
void vik_track_ref(VikTrack *tr)
{
tr->ref_count++;
g_free ( tr->description );
if ( tr->source )
g_free ( tr->source );
+ if ( tr->type )
+ g_free ( tr->type );
g_list_foreach ( tr->trackpoints, (GFunc) vik_trackpoint_free, NULL );
g_list_free( tr->trackpoints );
if (tr->property_dialog)
gchar *comment;
gchar *description;
gchar *source;
+ gchar *type;
guint8 ref_count;
gchar *name;
GtkWidget *property_dialog;
void vik_track_set_comment(VikTrack *tr, const gchar *comment);
void vik_track_set_description(VikTrack *tr, const gchar *description);
void vik_track_set_source(VikTrack *tr, const gchar *source);
+void vik_track_set_type(VikTrack *tr, const gchar *type);
void vik_track_ref(VikTrack *tr);
void vik_track_free(VikTrack *tr);
VikTrack *vik_track_copy ( const VikTrack *tr, gboolean copy_points );
GtkWidget *w_comment;
GtkWidget *w_description;
GtkWidget *w_source;
+ GtkWidget *w_type;
GtkWidget *w_track_length;
GtkWidget *w_tp_count;
GtkWidget *w_segment_count;
vik_track_set_comment(tr, gtk_entry_get_text(GTK_ENTRY(widgets->w_comment)));
vik_track_set_description(tr, gtk_entry_get_text(GTK_ENTRY(widgets->w_description)));
vik_track_set_source(tr, gtk_entry_get_text(GTK_ENTRY(widgets->w_source)));
+ vik_track_set_type(tr, gtk_entry_get_text(GTK_ENTRY(widgets->w_type)));
gtk_color_button_get_color ( GTK_COLOR_BUTTON(widgets->w_color), &(tr->color) );
tr->draw_name_mode = gtk_combo_box_get_active ( GTK_COMBO_BOX(widgets->w_namelabel) );
tr->max_number_dist_labels = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON(widgets->w_number_distlabels) );
N_("<b>Comment:</b>"),
N_("<b>Description:</b>"),
N_("<b>Source:</b>"),
+ N_("<b>Type:</b>"),
N_("<b>Color:</b>"),
N_("<b>Draw Name:</b>"),
N_("<b>Distance Labels:</b>"),
gtk_entry_set_text ( GTK_ENTRY(widgets->w_source), tr->source );
content_prop[cnt_prop++] = widgets->w_source;
+ widgets->w_type = gtk_entry_new ();
+ if ( tr->type )
+ gtk_entry_set_text ( GTK_ENTRY(widgets->w_type), tr->type );
+ content_prop[cnt_prop++] = widgets->w_type;
+
widgets->w_color = content_prop[cnt_prop++] = gtk_color_button_new_with_color ( &(tr->color) );
static gchar *draw_name_labels[] = {
GtkWidget *latlabel, *lonlabel, *namelabel, *latentry, *lonentry, *altentry, *altlabel, *nameentry=NULL;
GtkWidget *commentlabel, *commententry, *descriptionlabel, *descriptionentry, *imagelabel, *imageentry, *symbollabel, *symbolentry;
GtkWidget *sourcelabel = NULL, *sourceentry = NULL;
+ GtkWidget *typelabel = NULL, *typeentry = NULL;
GtkWidget *timelabel = NULL;
GtkWidget *timevaluebutton = NULL;
GtkWidget *hasGeotagCB = NULL;
gtk_entry_set_text(GTK_ENTRY(sourceentry), wp->source);
}
+ typelabel = gtk_label_new (_("Type:"));
+ if ( wp->type ) {
+ typeentry = gtk_entry_new ();
+ gtk_entry_set_text(GTK_ENTRY(typeentry), wp->type);
+ }
+
imagelabel = gtk_label_new (_("Image:"));
imageentry = vik_file_entry_new (GTK_FILE_CHOOSER_ACTION_OPEN, VF_FILTER_IMAGE, NULL, NULL);
gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), sourcelabel, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), sourceentry, FALSE, FALSE, 0);
}
+ if ( wp->type ) {
+ gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), typelabel, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), typeentry, FALSE, FALSE, 0);
+ }
gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), imagelabel, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), imageentry, FALSE, FALSE, 0);
if ( hasGeotagCB ) {
vik_waypoint_set_image ( wp, vik_file_entry_get_filename ( VIK_FILE_ENTRY(imageentry) ) );
if ( g_strcmp0 ( wp->source, gtk_entry_get_text ( GTK_ENTRY(sourceentry) ) ) )
vik_waypoint_set_source ( wp, gtk_entry_get_text ( GTK_ENTRY(sourceentry) ) );
+ if ( g_strcmp0 ( wp->type, gtk_entry_get_text ( GTK_ENTRY(typeentry) ) ) )
+ vik_waypoint_set_type ( wp, gtk_entry_get_text ( GTK_ENTRY(typeentry) ) );
if ( wp->image && *(wp->image) && (!a_thumbnails_exists(wp->image)) )
a_thumbnails_create ( wp->image );
if ( edit_wp->timestamp ) {
wp->source = NULL;
}
+void vik_waypoint_set_type(VikWaypoint *wp, const gchar *type)
+{
+ if ( wp->type )
+ g_free ( wp->type );
+
+ if ( type && type[0] != '\0' )
+ wp->type = g_strdup(type);
+ else
+ wp->type = NULL;
+}
+
void vik_waypoint_set_url(VikWaypoint *wp, const gchar *url)
{
if ( wp->url )
g_free ( wp->description );
if ( wp->source )
g_free ( wp->source );
+ if ( wp->type )
+ g_free ( wp->type );
if ( wp->url )
g_free ( wp->url );
if ( wp->image )
vik_waypoint_set_comment(new_wp,wp->comment);
vik_waypoint_set_description(new_wp,wp->description);
vik_waypoint_set_source(new_wp,wp->source);
+ vik_waypoint_set_type(new_wp,wp->type);
vik_waypoint_set_url(new_wp,wp->url);
vik_waypoint_set_image(new_wp,wp->image);
vik_waypoint_set_symbol(new_wp,wp->symbol);
vwm_append(wp->comment);
vwm_append(wp->description);
vwm_append(wp->source);
+ vwm_append(wp->type);
vwm_append(wp->url);
vwm_append(wp->image);
vwm_append(wp->symbol);
vwu_get(new_wp->comment);
vwu_get(new_wp->description);
vwu_get(new_wp->source);
+ vwu_get(new_wp->type);
vwu_get(new_wp->url);
vwu_get(new_wp->image);
vwu_get(new_wp->symbol);
gchar *comment;
gchar *description;
gchar *source;
+ gchar *type;
gchar *url;
gchar *image;
/* a rather misleading, ugly hack needed for trwlayer's click image.
void vik_waypoint_set_comment(VikWaypoint *wp, const gchar *comment);
void vik_waypoint_set_description(VikWaypoint *wp, const gchar *description);
void vik_waypoint_set_source(VikWaypoint *wp, const gchar *source);
+void vik_waypoint_set_type(VikWaypoint *wp, const gchar *type);
void vik_waypoint_set_url(VikWaypoint *wp, const gchar *url);
void vik_waypoint_set_image(VikWaypoint *wp, const gchar *image);
void vik_waypoint_set_symbol(VikWaypoint *wp, const gchar *symname);