]> git.tdb.fi Git - ext/subsurface.git/blobdiff - print.c
Separate out the UI from the program logic
[ext/subsurface.git] / print.c
diff --git a/print.c b/print.c
index c2114d56cbe90d860245c3ba420c2400315c7a61..af7fc4cd6c232368ebe6adcaa111a626b17f88cd 100644 (file)
--- a/print.c
+++ b/print.c
@@ -2,6 +2,7 @@
 
 #include "dive.h"
 #include "display.h"
+#include "display-gtk.h"
 
 static void draw_page(GtkPrintOperation *operation,
                        GtkPrintContext *context,
@@ -11,7 +12,7 @@ static void draw_page(GtkPrintOperation *operation,
        cairo_t *cr;
        PangoLayout *layout;
        double w, h;
-       struct graphics_context gc = { 0 };
+       struct graphics_context gc = { .printer = 1 };
 
        cr = gtk_print_context_get_cairo_context(context);
        gc.cr = cr;
@@ -21,11 +22,9 @@ static void draw_page(GtkPrintOperation *operation,
        w = gtk_print_context_get_width(context);
        h = gtk_print_context_get_height(context);
 
-       /* Do the profile on the top third of the page.. */
-       cairo_set_source_rgb(cr, 0, 0, 0);
-       cairo_rectangle(cr, 0, 0, w, h/3);
-       cairo_fill(cr);
-       plot(&gc, w, h/3, current_dive);
+       /* Do the profile on the top half of the page.. */
+       if (current_dive)
+               plot(&gc, w, h/2, current_dive);
 
        pango_cairo_show_layout(cr,layout);
        g_object_unref(layout);