gc[9] = vik_viewport_new_gc ( vp, "#96059f", width );
gc[10] = vik_viewport_new_gc ( vp, "#f22ef2", width );
- gc[11] = vik_viewport_new_gc ( vp, "#ff0000", width ); /* above range */
+ gc[11] = vik_viewport_new_gc ( vp, "#874200", width ); /* above range */
gc[12] = vik_viewport_new_gc ( vp, "#000000", width ); /* black / no speed data */
// Setup info dependent on distance units
if ( a_vik_get_units_distance() == VIK_UNITS_DISTANCE_MILES ) {
g_snprintf (tbuf4, sizeof(tbuf4), "miles");
- len_in_units = tt.length/1600.0;
+ len_in_units = VIK_METERS_TO_MILES(tt.length);
}
else {
g_snprintf (tbuf4, sizeof(tbuf4), "kms");
g_snprintf (tmp_buf, sizeof(tmp_buf), _("%s%.1f km %s"), time_buf1, tr_len/1000.0, time_buf2);
break;
case VIK_UNITS_DISTANCE_MILES:
- g_snprintf (tmp_buf, sizeof(tmp_buf), _("%s%.1f miles %s"), time_buf1, tr_len/1600.0, time_buf2);
+ g_snprintf (tmp_buf, sizeof(tmp_buf), _("%s%.1f miles %s"), time_buf1, VIK_METERS_TO_MILES(tr_len), time_buf2);
break;
default:
break;
gboolean vik_trw_layer_new_waypoint ( VikTrwLayer *vtl, GtkWindow *w, const VikCoord *def_coord )
{
- gchar *name = highest_wp_number_get(vtl);
+ gchar *default_name = highest_wp_number_get(vtl);
VikWaypoint *wp = vik_waypoint_new();
+ gchar *returned_name;
+ gboolean updated;
wp->coord = *def_coord;
- if ( a_dialog_new_waypoint ( w, &name, wp, vik_trw_layer_get_waypoints ( vtl ), vtl->coord_mode ) )
+ if ( ( returned_name = a_dialog_waypoint ( w, default_name, wp, vik_trw_layer_get_waypoints ( vtl ), vtl->coord_mode, TRUE, &updated ) ) )
{
wp->visible = TRUE;
- vik_trw_layer_add_waypoint ( vtl, name, wp );
+ vik_trw_layer_add_waypoint ( vtl, returned_name, wp );
+ g_free (default_name);
return TRUE;
}
+ g_free (default_name);
vik_waypoint_free(wp);
return FALSE;
}
VikWaypoint *wp = g_hash_table_lookup ( vtl->waypoints, pass_along[3] );
if ( wp )
{
- if ( a_dialog_new_waypoint ( VIK_GTK_WINDOW_FROM_LAYER(vtl), NULL, wp, NULL, vtl->coord_mode ) )
+ gboolean updated = FALSE;
+ a_dialog_waypoint ( VIK_GTK_WINDOW_FROM_LAYER(vtl), pass_along[3], wp, NULL, vtl->coord_mode, FALSE, &updated );
- if ( VIK_LAYER(vtl)->visible )
- vik_layer_emit_update ( VIK_LAYER(vtl) );
+ if ( updated && VIK_LAYER(vtl)->visible )
+ vik_layer_emit_update ( VIK_LAYER(vtl) );
}
}
else
trw_layer_cancel_current_tp ( vtl, TRUE );
else if ( response == VIK_TRW_LAYER_TPWIN_SPLIT && vtl->current_tpl->next && vtl->current_tpl->prev )
{
- gchar *name;
- if ( ( name = a_dialog_new_track ( GTK_WINDOW(vtl->tpwin), vtl->tracks, NULL ) ) )
+ gchar *name = get_new_unique_sublayer_name(vtl, VIK_TRW_LAYER_SUBLAYER_TRACK, vtl->current_tp_track_name);
+ if ( ( name = a_dialog_new_track ( GTK_WINDOW(vtl->tpwin), vtl->tracks, name ) ) )
{
VikTrack *tr = vik_track_new ();
GList *newglist = g_list_alloc ();
while ( pics )
{
a_thumbnails_create ( (gchar *) pics->data );
- a_background_thread_progress ( threaddata, ((gdouble) ++done) / total );
+ int result = a_background_thread_progress ( threaddata, ((gdouble) ++done) / total );
+ if ( result != 0 )
+ return -1; /* Abort thread */
+
pics = pics->next;
}
}