gboolean configure_dialog;
VikTrwLayer *vtl;
VikTrack *tr;
+ gpointer trk_id;
VikViewport *vvp;
VikLayersPanel *vlp;
gint profile_width;
GtkWidget *w_time_start;
GtkWidget *w_time_end;
GtkWidget *w_time_dur;
+ GtkWidget *w_color;
GtkWidget *w_cur_dist; /*< Current distance */
GtkWidget *w_cur_elevation;
GtkWidget *w_cur_gradient_dist; /*< Current distance on gradient graph */
/* since vlp not set, vvp should be valid instead! */
if ( vvp )
vik_viewport_set_center_coord ( vvp, &coord );
- vik_layer_emit_update ( VIK_LAYER(vtl), FALSE );
+ vik_layer_emit_update ( VIK_LAYER(vtl) );
}
}
return trackpoint;
gdouble marker_x = (pc * widgets->profile_width) + MARGIN;
save_image_and_draw_graph_marks(image,
marker_x,
- window->style->black_gc,
+ gtk_widget_get_style(window)->black_gc,
-1, // Don't draw blob on clicks
0,
graph_saved_img,
save_image_and_draw_graph_marks (image,
marker_x,
- window->style->black_gc,
+ gtk_widget_get_style(window)->black_gc,
MARGIN+x,
y_blob,
&widgets->elev_graph_saved_img,
save_image_and_draw_graph_marks (image,
marker_x,
- window->style->black_gc,
+ gtk_widget_get_style(window)->black_gc,
MARGIN+x,
y_blob,
&widgets->gradient_graph_saved_img,
save_image_and_draw_graph_marks (image,
marker_x,
- window->style->black_gc,
+ gtk_widget_get_style(window)->black_gc,
MARGIN+x,
y_blob,
&widgets->speed_graph_saved_img,
save_image_and_draw_graph_marks (image,
marker_x,
- window->style->black_gc,
+ gtk_widget_get_style(window)->black_gc,
MARGIN+x,
y_blob,
&widgets->dist_graph_saved_img,
save_image_and_draw_graph_marks (image,
marker_x,
- window->style->black_gc,
+ gtk_widget_get_style(window)->black_gc,
MARGIN+x,
y_blob,
&widgets->elev_time_graph_saved_img,
save_image_and_draw_graph_marks (image,
marker_x,
- window->style->black_gc,
+ gtk_widget_get_style(window)->black_gc,
MARGIN+x,
y_blob,
&widgets->speed_dist_graph_saved_img,
window = gtk_widget_get_toplevel (widgets->elev_box);
- pix = gdk_pixmap_new( window->window, widgets->profile_width + MARGIN, widgets->profile_height, -1 );
+ pix = gdk_pixmap_new( gtk_widget_get_window(window), widgets->profile_width + MARGIN, widgets->profile_height, -1 );
gtk_image_set_from_pixmap ( GTK_IMAGE(image), pix, NULL );
- no_alt_info = gdk_gc_new ( window->window );
+ no_alt_info = gdk_gc_new ( gtk_widget_get_window(window) );
gdk_color_parse ( "yellow", &color );
gdk_gc_set_rgb_fg_color ( no_alt_info, &color);
/* clear the image */
- gdk_draw_rectangle(GDK_DRAWABLE(pix), window->style->bg_gc[0],
+ gdk_draw_rectangle(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->bg_gc[0],
TRUE, 0, 0, MARGIN, widgets->profile_height);
- gdk_draw_rectangle(GDK_DRAWABLE(pix), window->style->mid_gc[0],
+ gdk_draw_rectangle(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->mid_gc[0],
TRUE, MARGIN, 0, widgets->profile_width, widgets->profile_height);
/* draw grid */
int w, h;
pango_layout_set_alignment (pl, PANGO_ALIGN_RIGHT);
- pango_layout_set_font_description (pl, window->style->font_desc);
+ pango_layout_set_font_description (pl, gtk_widget_get_style(window)->font_desc);
switch (height_units) {
case VIK_UNITS_HEIGHT_METRES:
}
pango_layout_set_text(pl, s, -1);
pango_layout_get_pixel_size (pl, &w, &h);
- gdk_draw_layout(GDK_DRAWABLE(pix), window->style->fg_gc[0], MARGIN-w-3,
+ gdk_draw_layout(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->fg_gc[0], MARGIN-w-3,
CLAMP((int)i*widgets->profile_height/LINES - h/2, 0, widgets->profile_height-h), pl);
- gdk_draw_line (GDK_DRAWABLE(pix), window->style->dark_gc[0],
+ gdk_draw_line (GDK_DRAWABLE(pix), gtk_widget_get_style(window)->dark_gc[0],
MARGIN, widgets->profile_height/LINES * i, MARGIN + widgets->profile_width, widgets->profile_height/LINES * i);
g_object_unref ( G_OBJECT ( pl ) );
pl = NULL;
gdk_draw_line ( GDK_DRAWABLE(pix), no_alt_info,
i + MARGIN, 0, i + MARGIN, widgets->profile_height );
else
- gdk_draw_line ( GDK_DRAWABLE(pix), window->style->dark_gc[3],
+ gdk_draw_line ( GDK_DRAWABLE(pix), gtk_widget_get_style(window)->dark_gc[3],
i + MARGIN, widgets->profile_height, i + MARGIN, widgets->profile_height-widgets->profile_height*(widgets->altitudes[i]-mina)/(chunksa[widgets->cia]*LINES) );
if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(widgets->w_show_dem)) ||
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(widgets->w_show_alt_gps_speed)) ) {
- GdkGC *dem_alt_gc = gdk_gc_new ( window->window );
- GdkGC *gps_speed_gc = gdk_gc_new ( window->window );
+ GdkGC *dem_alt_gc = gdk_gc_new ( gtk_widget_get_window(window) );
+ GdkGC *gps_speed_gc = gdk_gc_new ( gtk_widget_get_window(window) );
gdk_color_parse ( "green", &color );
gdk_gc_set_rgb_fg_color ( dem_alt_gc, &color);
}
/* draw border */
- gdk_draw_rectangle(GDK_DRAWABLE(pix), window->style->black_gc, FALSE, MARGIN, 0, widgets->profile_width-1, widgets->profile_height-1);
+ gdk_draw_rectangle(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->black_gc, FALSE, MARGIN, 0, widgets->profile_width-1, widgets->profile_height-1);
g_object_unref ( G_OBJECT(pix) );
g_object_unref ( G_OBJECT(no_alt_info) );
window = gtk_widget_get_toplevel (widgets->gradient_box);
- pix = gdk_pixmap_new( window->window, widgets->profile_width + MARGIN, widgets->profile_height, -1 );
+ pix = gdk_pixmap_new( gtk_widget_get_window(window), widgets->profile_width + MARGIN, widgets->profile_height, -1 );
gtk_image_set_from_pixmap ( GTK_IMAGE(image), pix, NULL );
/* clear the image */
- gdk_draw_rectangle(GDK_DRAWABLE(pix), window->style->bg_gc[0],
+ gdk_draw_rectangle(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->bg_gc[0],
TRUE, 0, 0, MARGIN, widgets->profile_height);
- gdk_draw_rectangle(GDK_DRAWABLE(pix), window->style->mid_gc[0],
+ gdk_draw_rectangle(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->mid_gc[0],
TRUE, MARGIN, 0, widgets->profile_width, widgets->profile_height);
/* draw grid */
int w, h;
pango_layout_set_alignment (pl, PANGO_ALIGN_RIGHT);
- pango_layout_set_font_description (pl, window->style->font_desc);
+ pango_layout_set_font_description (pl, gtk_widget_get_style(window)->font_desc);
sprintf(s, "%8d%%", (int)(mina + (LINES-i)*chunksg[widgets->cig]));
pango_layout_set_text(pl, s, -1);
pango_layout_get_pixel_size (pl, &w, &h);
- gdk_draw_layout(GDK_DRAWABLE(pix), window->style->fg_gc[0], MARGIN-w-3,
+ gdk_draw_layout(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->fg_gc[0], MARGIN-w-3,
CLAMP((int)i*widgets->profile_height/LINES - h/2, 0, widgets->profile_height-h), pl);
- gdk_draw_line (GDK_DRAWABLE(pix), window->style->dark_gc[0],
+ gdk_draw_line (GDK_DRAWABLE(pix), gtk_widget_get_style(window)->dark_gc[0],
MARGIN, widgets->profile_height/LINES * i, MARGIN + widgets->profile_width, widgets->profile_height/LINES * i);
g_object_unref ( G_OBJECT ( pl ) );
pl = NULL;
/* draw gradients */
for ( i = 0; i < widgets->profile_width; i++ )
- gdk_draw_line ( GDK_DRAWABLE(pix), window->style->dark_gc[3],
+ gdk_draw_line ( GDK_DRAWABLE(pix), gtk_widget_get_style(window)->dark_gc[3],
i + MARGIN, widgets->profile_height, i + MARGIN, widgets->profile_height-widgets->profile_height*(widgets->gradients[i]-mina)/(chunksg[widgets->cig]*LINES) );
if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(widgets->w_show_gradient_gps_speed)) ) {
- GdkGC *gps_speed_gc = gdk_gc_new ( window->window );
+ GdkGC *gps_speed_gc = gdk_gc_new ( gtk_widget_get_window(window) );
gdk_color_parse ( "red", &color );
gdk_gc_set_rgb_fg_color ( gps_speed_gc, &color);
}
/* draw border */
- gdk_draw_rectangle(GDK_DRAWABLE(pix), window->style->black_gc, FALSE, MARGIN, 0, widgets->profile_width-1, widgets->profile_height-1);
+ gdk_draw_rectangle(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->black_gc, FALSE, MARGIN, 0, widgets->profile_width-1, widgets->profile_height-1);
g_object_unref ( G_OBJECT(pix) );
}
window = gtk_widget_get_toplevel (widgets->speed_box);
- pix = gdk_pixmap_new( window->window, widgets->profile_width + MARGIN, widgets->profile_height, -1 );
+ pix = gdk_pixmap_new( gtk_widget_get_window(window), widgets->profile_width + MARGIN, widgets->profile_height, -1 );
gtk_image_set_from_pixmap ( GTK_IMAGE(image), pix, NULL );
mins = widgets->draw_min_speed;
/* clear the image */
- gdk_draw_rectangle(GDK_DRAWABLE(pix), window->style->bg_gc[0],
+ gdk_draw_rectangle(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->bg_gc[0],
TRUE, 0, 0, MARGIN, widgets->profile_height);
- gdk_draw_rectangle(GDK_DRAWABLE(pix), window->style->mid_gc[0],
+ gdk_draw_rectangle(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->mid_gc[0],
TRUE, MARGIN, 0, widgets->profile_width, widgets->profile_height);
/* draw grid */
int w, h;
pango_layout_set_alignment (pl, PANGO_ALIGN_RIGHT);
- pango_layout_set_font_description (pl, window->style->font_desc);
+ pango_layout_set_font_description (pl, gtk_widget_get_style(window)->font_desc);
// NB: No need to convert here anymore as numbers are in the appropriate units
switch (speed_units) {
pango_layout_set_text(pl, s, -1);
pango_layout_get_pixel_size (pl, &w, &h);
- gdk_draw_layout(GDK_DRAWABLE(pix), window->style->fg_gc[0], MARGIN-w-3,
+ gdk_draw_layout(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->fg_gc[0], MARGIN-w-3,
CLAMP((int)i*widgets->profile_height/LINES - h/2, 0, widgets->profile_height-h), pl);
- gdk_draw_line (GDK_DRAWABLE(pix), window->style->dark_gc[0],
+ gdk_draw_line (GDK_DRAWABLE(pix), gtk_widget_get_style(window)->dark_gc[0],
MARGIN, widgets->profile_height/LINES * i, MARGIN + widgets->profile_width, widgets->profile_height/LINES * i);
g_object_unref ( G_OBJECT ( pl ) );
pl = NULL;
/* draw speeds */
for ( i = 0; i < widgets->profile_width; i++ )
- gdk_draw_line ( GDK_DRAWABLE(pix), window->style->dark_gc[3],
+ gdk_draw_line ( GDK_DRAWABLE(pix), gtk_widget_get_style(window)->dark_gc[3],
i + MARGIN, widgets->profile_height, i + MARGIN, widgets->profile_height-widgets->profile_height*(widgets->speeds[i]-mins)/(chunkss[widgets->cis]*LINES) );
if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->w_show_gps_speed)) ) {
- GdkGC *gps_speed_gc = gdk_gc_new ( window->window );
+ GdkGC *gps_speed_gc = gdk_gc_new ( gtk_widget_get_window(window) );
GdkColor color;
gdk_color_parse ( "red", &color );
gdk_gc_set_rgb_fg_color ( gps_speed_gc, &color);
}
/* draw border */
- gdk_draw_rectangle(GDK_DRAWABLE(pix), window->style->black_gc, FALSE, MARGIN, 0, widgets->profile_width-1, widgets->profile_height-1);
+ gdk_draw_rectangle(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->black_gc, FALSE, MARGIN, 0, widgets->profile_width-1, widgets->profile_height-1);
g_object_unref ( G_OBJECT(pix) );
}
window = gtk_widget_get_toplevel (widgets->dist_box);
- pix = gdk_pixmap_new( window->window, widgets->profile_width + MARGIN, widgets->profile_height, -1 );
+ pix = gdk_pixmap_new( gtk_widget_get_window(window), widgets->profile_width + MARGIN, widgets->profile_height, -1 );
gtk_image_set_from_pixmap ( GTK_IMAGE(image), pix, NULL );
get_new_min_and_chunk_index (0, maxd, chunksd, sizeof(chunksd)/sizeof(chunksd[0]), &dummy, &widgets->cid);
/* clear the image */
- gdk_draw_rectangle(GDK_DRAWABLE(pix), window->style->bg_gc[0],
+ gdk_draw_rectangle(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->bg_gc[0],
TRUE, 0, 0, MARGIN, widgets->profile_height);
- gdk_draw_rectangle(GDK_DRAWABLE(pix), window->style->mid_gc[0],
+ gdk_draw_rectangle(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->mid_gc[0],
TRUE, MARGIN, 0, widgets->profile_width, widgets->profile_height);
/* draw grid */
int w, h;
pango_layout_set_alignment (pl, PANGO_ALIGN_RIGHT);
- pango_layout_set_font_description (pl, window->style->font_desc);
+ pango_layout_set_font_description (pl, gtk_widget_get_style(window)->font_desc);
if ( dist_units == VIK_UNITS_DISTANCE_MILES )
sprintf(s, _("%.1f miles"), ((LINES-i)*chunksd[widgets->cid]));
pango_layout_set_text(pl, s, -1);
pango_layout_get_pixel_size (pl, &w, &h);
- gdk_draw_layout(GDK_DRAWABLE(pix), window->style->fg_gc[0], MARGIN-w-3,
+ gdk_draw_layout(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->fg_gc[0], MARGIN-w-3,
CLAMP((int)i*widgets->profile_height/LINES - h/2, 0, widgets->profile_height-h), pl);
- gdk_draw_line (GDK_DRAWABLE(pix), window->style->dark_gc[0],
+ gdk_draw_line (GDK_DRAWABLE(pix), gtk_widget_get_style(window)->dark_gc[0],
MARGIN, widgets->profile_height/LINES * i, MARGIN + widgets->profile_width, widgets->profile_height/LINES * i);
g_object_unref ( G_OBJECT ( pl ) );
pl = NULL;
/* draw distance */
for ( i = 0; i < widgets->profile_width; i++ )
- gdk_draw_line ( GDK_DRAWABLE(pix), window->style->dark_gc[3],
+ gdk_draw_line ( GDK_DRAWABLE(pix), gtk_widget_get_style(window)->dark_gc[3],
i + MARGIN, widgets->profile_height, i + MARGIN, widgets->profile_height-widgets->profile_height*(widgets->distances[i])/(chunksd[widgets->cid]*LINES) );
// Show speed indicator
if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->w_show_dist_speed)) ) {
- GdkGC *dist_speed_gc = gdk_gc_new ( window->window );
+ GdkGC *dist_speed_gc = gdk_gc_new ( gtk_widget_get_window(window) );
GdkColor color;
gdk_color_parse ( "red", &color );
gdk_gc_set_rgb_fg_color ( dist_speed_gc, &color);
}
/* draw border */
- gdk_draw_rectangle(GDK_DRAWABLE(pix), window->style->black_gc, FALSE, MARGIN, 0, widgets->profile_width-1, widgets->profile_height-1);
+ gdk_draw_rectangle(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->black_gc, FALSE, MARGIN, 0, widgets->profile_width-1, widgets->profile_height-1);
g_object_unref ( G_OBJECT(pix) );
window = gtk_widget_get_toplevel (widgets->elev_time_box);
- pix = gdk_pixmap_new( window->window, widgets->profile_width + MARGIN, widgets->profile_height, -1 );
+ pix = gdk_pixmap_new( gtk_widget_get_window(window), widgets->profile_width + MARGIN, widgets->profile_height, -1 );
gtk_image_set_from_pixmap ( GTK_IMAGE(image), pix, NULL );
/* clear the image */
- gdk_draw_rectangle(GDK_DRAWABLE(pix), window->style->bg_gc[0],
+ gdk_draw_rectangle(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->bg_gc[0],
TRUE, 0, 0, MARGIN, widgets->profile_height);
- gdk_draw_rectangle(GDK_DRAWABLE(pix), window->style->mid_gc[0],
+ gdk_draw_rectangle(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->mid_gc[0],
TRUE, MARGIN, 0, widgets->profile_width, widgets->profile_height);
/* draw grid */
int w, h;
pango_layout_set_alignment (pl, PANGO_ALIGN_RIGHT);
- pango_layout_set_font_description (pl, window->style->font_desc);
+ pango_layout_set_font_description (pl, gtk_widget_get_style(window)->font_desc);
switch (height_units) {
case VIK_UNITS_HEIGHT_METRES:
}
pango_layout_set_text(pl, s, -1);
pango_layout_get_pixel_size (pl, &w, &h);
- gdk_draw_layout(GDK_DRAWABLE(pix), window->style->fg_gc[0], MARGIN-w-3,
+ gdk_draw_layout(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->fg_gc[0], MARGIN-w-3,
CLAMP((int)i*widgets->profile_height/LINES - h/2, 0, widgets->profile_height-h), pl);
- gdk_draw_line (GDK_DRAWABLE(pix), window->style->dark_gc[0],
+ gdk_draw_line (GDK_DRAWABLE(pix), gtk_widget_get_style(window)->dark_gc[0],
MARGIN, widgets->profile_height/LINES * i, MARGIN + widgets->profile_width, widgets->profile_height/LINES * i);
g_object_unref ( G_OBJECT ( pl ) );
pl = NULL;
/* draw elevations */
for ( i = 0; i < widgets->profile_width; i++ )
- gdk_draw_line ( GDK_DRAWABLE(pix), window->style->dark_gc[3],
+ gdk_draw_line ( GDK_DRAWABLE(pix), gtk_widget_get_style(window)->dark_gc[3],
i + MARGIN, widgets->profile_height, i + MARGIN, widgets->profile_height-widgets->profile_height*(widgets->ats[i]-mina)/(chunksa[widgets->ciat]*LINES) );
// Show speed indicator
if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->w_show_elev_speed)) ) {
- GdkGC *elev_speed_gc = gdk_gc_new ( window->window );
+ GdkGC *elev_speed_gc = gdk_gc_new ( gtk_widget_get_window(window) );
GdkColor color;
gdk_color_parse ( "red", &color );
gdk_gc_set_rgb_fg_color ( elev_speed_gc, &color);
}
/* draw border */
- gdk_draw_rectangle(GDK_DRAWABLE(pix), window->style->black_gc, FALSE, MARGIN, 0, widgets->profile_width-1, widgets->profile_height-1);
+ gdk_draw_rectangle(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->black_gc, FALSE, MARGIN, 0, widgets->profile_width-1, widgets->profile_height-1);
g_object_unref ( G_OBJECT(pix) );
window = gtk_widget_get_toplevel (widgets->speed_dist_box);
- pix = gdk_pixmap_new( window->window, widgets->profile_width + MARGIN, widgets->profile_height, -1 );
+ pix = gdk_pixmap_new( gtk_widget_get_window(window), widgets->profile_width + MARGIN, widgets->profile_height, -1 );
gtk_image_set_from_pixmap ( GTK_IMAGE(image), pix, NULL );
mins = widgets->draw_min_speed;
/* clear the image */
- gdk_draw_rectangle(GDK_DRAWABLE(pix), window->style->bg_gc[0],
+ gdk_draw_rectangle(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->bg_gc[0],
TRUE, 0, 0, MARGIN, widgets->profile_height);
- gdk_draw_rectangle(GDK_DRAWABLE(pix), window->style->mid_gc[0],
+ gdk_draw_rectangle(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->mid_gc[0],
TRUE, MARGIN, 0, widgets->profile_width, widgets->profile_height);
/* draw grid */
int w, h;
pango_layout_set_alignment (pl, PANGO_ALIGN_RIGHT);
- pango_layout_set_font_description (pl, window->style->font_desc);
+ pango_layout_set_font_description (pl, gtk_widget_get_style(window)->font_desc);
// NB: No need to convert here anymore as numbers are in the appropriate units
switch (speed_units) {
pango_layout_set_text(pl, s, -1);
pango_layout_get_pixel_size (pl, &w, &h);
- gdk_draw_layout(GDK_DRAWABLE(pix), window->style->fg_gc[0], MARGIN-w-3,
+ gdk_draw_layout(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->fg_gc[0], MARGIN-w-3,
CLAMP((int)i*widgets->profile_height/LINES - h/2, 0, widgets->profile_height-h), pl);
- gdk_draw_line (GDK_DRAWABLE(pix), window->style->dark_gc[0],
+ gdk_draw_line (GDK_DRAWABLE(pix), gtk_widget_get_style(window)->dark_gc[0],
MARGIN, widgets->profile_height/LINES * i, MARGIN + widgets->profile_width, widgets->profile_height/LINES * i);
g_object_unref ( G_OBJECT ( pl ) );
pl = NULL;
/* draw speeds */
for ( i = 0; i < widgets->profile_width; i++ )
- gdk_draw_line ( GDK_DRAWABLE(pix), window->style->dark_gc[3],
+ gdk_draw_line ( GDK_DRAWABLE(pix), gtk_widget_get_style(window)->dark_gc[3],
i + MARGIN, widgets->profile_height, i + MARGIN, widgets->profile_height-widgets->profile_height*(widgets->speeds_dist[i]-mins)/(chunkss[widgets->cisd]*LINES) );
if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->w_show_sd_gps_speed)) ) {
- GdkGC *gps_speed_gc = gdk_gc_new ( window->window );
+ GdkGC *gps_speed_gc = gdk_gc_new ( gtk_widget_get_window(window) );
GdkColor color;
gdk_color_parse ( "red", &color );
gdk_gc_set_rgb_fg_color ( gps_speed_gc, &color);
}
/* draw border */
- gdk_draw_rectangle(GDK_DRAWABLE(pix), window->style->black_gc, FALSE, MARGIN, 0, widgets->profile_width-1, widgets->profile_height-1);
+ gdk_draw_rectangle(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->black_gc, FALSE, MARGIN, 0, widgets->profile_width-1, widgets->profile_height-1);
g_object_unref ( G_OBJECT(pix) );
}
save_image_and_draw_graph_marks (image,
marker_x,
- window->style->black_gc,
+ gtk_widget_get_style(window)->black_gc,
x_blob+MARGIN,
y_blob,
&widgets->elev_graph_saved_img,
save_image_and_draw_graph_marks (image,
marker_x,
- window->style->black_gc,
+ gtk_widget_get_style(window)->black_gc,
x_blob+MARGIN,
y_blob,
&widgets->gradient_graph_saved_img,
save_image_and_draw_graph_marks (image,
marker_x,
- window->style->black_gc,
+ gtk_widget_get_style(window)->black_gc,
x_blob+MARGIN,
y_blob,
&widgets->speed_graph_saved_img,
save_image_and_draw_graph_marks (image,
marker_x,
- window->style->black_gc,
+ gtk_widget_get_style(window)->black_gc,
x_blob+MARGIN,
y_blob,
&widgets->dist_graph_saved_img,
save_image_and_draw_graph_marks (image,
marker_x,
- window->style->black_gc,
+ gtk_widget_get_style(window)->black_gc,
x_blob+MARGIN,
y_blob,
&widgets->elev_time_graph_saved_img,
save_image_and_draw_graph_marks (image,
marker_x,
- window->style->black_gc,
+ gtk_widget_get_style(window)->black_gc,
x_blob+MARGIN,
y_blob,
&widgets->speed_dist_graph_saved_img,
minmax_array(widgets->altitudes, min_alt, max_alt, TRUE, widgets->profile_width);
- pix = gdk_pixmap_new( window->window, widgets->profile_width + MARGIN, widgets->profile_height, -1 );
+ pix = gdk_pixmap_new( gtk_widget_get_window(window), widgets->profile_width + MARGIN, widgets->profile_height, -1 );
image = gtk_image_new_from_pixmap ( pix, NULL );
g_object_unref ( G_OBJECT(pix) );
return NULL;
}
- pix = gdk_pixmap_new( window->window, widgets->profile_width + MARGIN, widgets->profile_height, -1 );
+ pix = gdk_pixmap_new( gtk_widget_get_window(window), widgets->profile_width + MARGIN, widgets->profile_height, -1 );
image = gtk_image_new_from_pixmap ( pix, NULL );
g_object_unref ( G_OBJECT(pix) );
if ( widgets->speeds == NULL )
return NULL;
- pix = gdk_pixmap_new( window->window, widgets->profile_width + MARGIN, widgets->profile_height, -1 );
+ pix = gdk_pixmap_new( gtk_widget_get_window(window), widgets->profile_width + MARGIN, widgets->profile_height, -1 );
image = gtk_image_new_from_pixmap ( pix, NULL );
#if 0
/* XXX this can go out, it's just a helpful dev tool */
{
int j;
- GdkGC **colors[8] = { window->style->bg_gc,
- window->style->fg_gc,
- window->style->light_gc,
- window->style->dark_gc,
- window->style->mid_gc,
- window->style->text_gc,
- window->style->base_gc,
- window->style->text_aa_gc };
+ GdkGC **colors[8] = { gtk_widget_get_style(window)->bg_gc,
+ gtk_widget_get_style(window)->fg_gc,
+ gtk_widget_get_style(window)->light_gc,
+ gtk_widget_get_style(window)->dark_gc,
+ gtk_widget_get_style(window)->mid_gc,
+ gtk_widget_get_style(window)->text_gc,
+ gtk_widget_get_style(window)->base_gc,
+ gtk_widget_get_style(window)->text_aa_gc };
for (i=0; i<5; i++) {
for (j=0; j<8; j++) {
gdk_draw_rectangle(GDK_DRAWABLE(pix), colors[j][i],
TRUE, i*20, j*20, 20, 20);
- gdk_draw_rectangle(GDK_DRAWABLE(pix), window->style->black_gc,
+ gdk_draw_rectangle(GDK_DRAWABLE(pix), gtk_widget_get_style(window)->black_gc,
FALSE, i*20, j*20, 20, 20);
}
}
if ( widgets->distances == NULL )
return NULL;
- pix = gdk_pixmap_new( window->window, widgets->profile_width + MARGIN, widgets->profile_height, -1 );
+ pix = gdk_pixmap_new( gtk_widget_get_window(window), widgets->profile_width + MARGIN, widgets->profile_height, -1 );
image = gtk_image_new_from_pixmap ( pix, NULL );
g_object_unref ( G_OBJECT(pix) );
if ( widgets->ats == NULL )
return NULL;
- pix = gdk_pixmap_new( window->window, widgets->profile_width + MARGIN, widgets->profile_height, -1 );
+ pix = gdk_pixmap_new( gtk_widget_get_window(window), widgets->profile_width + MARGIN, widgets->profile_height, -1 );
image = gtk_image_new_from_pixmap ( pix, NULL );
g_object_unref ( G_OBJECT(pix) );
if ( widgets->speeds_dist == NULL )
return NULL;
- pix = gdk_pixmap_new( window->window, widgets->profile_width + MARGIN, widgets->profile_height, -1 );
+ pix = gdk_pixmap_new( gtk_widget_get_window(window), widgets->profile_width + MARGIN, widgets->profile_height, -1 );
image = gtk_image_new_from_pixmap ( pix, NULL );
g_object_unref ( G_OBJECT(pix) );
case GTK_RESPONSE_ACCEPT:
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)));
+ gtk_color_button_get_color ( GTK_COLOR_BUTTON(widgets->w_color), &(tr->color) );
+ trw_layer_update_treeview ( widgets->vtl, widgets->tr, widgets->trk_id );
+ vik_layer_emit_update ( VIK_LAYER(vtl) );
break;
case VIK_TRW_LAYER_PROPWIN_REVERSE:
vik_track_reverse(tr);
- vik_layer_emit_update ( VIK_LAYER(vtl), FALSE );
+ vik_layer_emit_update ( VIK_LAYER(vtl) );
break;
case VIK_TRW_LAYER_PROPWIN_DEL_DUP:
vik_track_remove_dup_points(tr); // NB ignore the returned answer
/* above operation could have deleted current_tp or last_tp */
trw_layer_cancel_tps_of_track ( vtl, tr );
- vik_layer_emit_update ( VIK_LAYER(vtl), FALSE );
+ vik_layer_emit_update ( VIK_LAYER(vtl) );
break;
case VIK_TRW_LAYER_PROPWIN_SPLIT:
{
vik_trw_layer_delete_route ( vtl, tr );
else
vik_trw_layer_delete_track ( vtl, tr );
- vik_layer_emit_update ( VIK_LAYER(vtl), FALSE ); /* chase thru the hoops */
+ vik_layer_emit_update ( VIK_LAYER(vtl) ); /* chase thru the hoops */
}
}
break;
vik_trw_layer_add_route(vtl, r_name, tr_right);
else
vik_trw_layer_add_track(vtl, r_name, tr_right);
- vik_layer_emit_update ( VIK_LAYER(vtl), FALSE );
+ vik_layer_emit_update ( VIK_LAYER(vtl) );
}
break;
default:
return vbox;
}
-void vik_trw_layer_propwin_run ( GtkWindow *parent, VikTrwLayer *vtl, VikTrack *tr, gpointer vlp, VikViewport *vvp )
+void vik_trw_layer_propwin_run ( GtkWindow *parent,
+ VikTrwLayer *vtl,
+ VikTrack *tr,
+ gpointer vlp,
+ VikViewport *vvp,
+ gpointer *trk_id )
{
PropWidgets *widgets = prop_widgets_new();
widgets->vtl = vtl;
widgets->vvp = vvp;
widgets->vlp = vlp;
widgets->tr = tr;
+ widgets->trk_id = trk_id;
widgets->profile_width = PROPWIN_PROFILE_WIDTH;
widgets->profile_height = PROPWIN_PROFILE_HEIGHT;
gchar *title = g_strdup_printf(_("%s - Track Properties"), tr->name);
N_("<b>Total Elevation Gain/Loss:</b>"),
N_("<b>Start:</b>"),
N_("<b>End:</b>"),
- N_("<b>Duration:</b>") };
+ N_("<b>Duration:</b>"),
+ N_("<b>Color:</b>") };
static gchar tmp_buf[50];
gdouble tmp_speed;
t1 = VIK_TRACKPOINT(tr->trackpoints->data)->timestamp;
t2 = VIK_TRACKPOINT(g_list_last(tr->trackpoints)->data)->timestamp;
- strncpy(tmp_buf, ctime(&t1), sizeof(tmp_buf));
- tmp_buf[sizeof(tmp_buf)-1] = 0;
- g_strchomp(tmp_buf);
+ strftime (tmp_buf, sizeof(tmp_buf), "%c", localtime(&(t1)));
widgets->w_time_start = content[cnt++] = gtk_label_new(tmp_buf);
- strncpy(tmp_buf, ctime(&t2), sizeof(tmp_buf));
- tmp_buf[sizeof(tmp_buf)-1] = 0;
- g_strchomp(tmp_buf);
+ strftime (tmp_buf, sizeof(tmp_buf), "%c", localtime(&(t2)));
widgets->w_time_end = content[cnt++] = gtk_label_new(tmp_buf);
g_snprintf(tmp_buf, sizeof(tmp_buf), _("%d minutes"), (int)(t2-t1)/60);
widgets->w_time_dur = content[cnt++] = gtk_label_new(_("No Data"));
}
+ widgets->w_color = content[cnt++] = gtk_color_button_new_with_color ( &(tr->color) );
+
table = GTK_TABLE(gtk_table_new (cnt, 2, FALSE));
gtk_table_set_col_spacing (table, 0, 10);
for (i=0; i<cnt; i++) {
gtk_notebook_append_page(GTK_NOTEBOOK(graphs), page, gtk_label_new(_("Speed-distance")));
}
- gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), graphs, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), graphs, FALSE, FALSE, 0);
gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), VIK_TRW_LAYER_PROPWIN_SPLIT_MARKER, FALSE);
if (seg_count <= 1)