From 6c1a9789864c558dd7b56bdb4a73add5fc4f5e3f Mon Sep 17 00:00:00 2001 From: Qball Cow Date: Thu, 2 Jul 2009 14:36:10 +0200 Subject: [PATCH] Draw title --- src/gpx-viewer.c | 1 + src/speed-plot.vala | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/gpx-viewer.c b/src/gpx-viewer.c index 73f7531..9cdd56b 100644 --- a/src/gpx-viewer.c +++ b/src/gpx-viewer.c @@ -443,6 +443,7 @@ int main (int argc, char **argv) } gtk_widget_destroy(dialog); g_object_unref(fbuilder); + if(files == NULL) return EXIT_SUCCESS; } for(i =1; i < argc; i++) diff --git a/src/speed-plot.vala b/src/speed-plot.vala index 33f54b6..f7285a7 100644 --- a/src/speed-plot.vala +++ b/src/speed-plot.vala @@ -68,7 +68,6 @@ namespace Gpx Point f = track.points.data; stdout.printf("%f\n", f.get_time()); - ctx.new_path(); /* Draw Grid */ double graph_width = win.allocation.width-LEFT_OFFSET-10; double graph_height = win.allocation.height-20-BOTTOM_OFFSET; @@ -105,7 +104,6 @@ namespace Gpx ctx.stroke(); } /* Draw axis */ - ctx.new_path(); ctx.move_to(0.0,0.0); ctx.set_source_rgba(0.0, 0.0, 0.0, 1); ctx.set_line_width(1.5); @@ -115,7 +113,6 @@ namespace Gpx /* Draw the graph */ - ctx.new_path(); ctx.set_source_rgba(0.1, 0.2, 0.3, 1); ctx.set_line_width(1); weak List iter = track.points.first(); @@ -178,6 +175,18 @@ namespace Gpx ctx.move_to(0.0, graph_height*(1-avg/max_speed)); ctx.line_to(graph_width, graph_height*(1-avg/max_speed)); ctx.stroke(); + + { + int w,h; + ctx.set_source_rgba(0.0, 0.0, 0.0, 1.0); + fd.set_absolute_size(12*1024); + layout.set_font_description(fd); + layout.set_text("Speed (km/h) vs Time (HH:MM)",-1); + layout.get_pixel_size(out w, out h); + ctx.move_to(graph_width/2-w/2, -20); + Pango.cairo_layout_path(ctx, layout); + ctx.fill(); + } } } } -- 2.11.4.GIT