aboutsummaryrefslogtreecommitdiffstats
path: root/print.c
diff options
context:
space:
mode:
authorGravatar Amit Chaudhuri <amit.k.chaudhuri@gmail.com>2013-03-13 07:18:49 +0000
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-03-13 02:53:35 -0700
commit3e1098bd038a8568fd3a216b59b753dac59f45fa (patch)
treeaaba9ecff8e7425270dd19a43ae9dbf2e7dc13f3 /print.c
parent099953e776bf5d59c281eb2b72efa1eab40be714 (diff)
downloadsubsurface-3e1098bd038a8568fd3a216b59b753dac59f45fa.tar.gz
Hook up color printing with print dialog.
- Add a button and callback to the print dialog to let the user select color printing. - Add a state variable to the options struct to track the users choice. - Use a darker color for the grid on dive plot; that way we can see it. - Default to use color printing. Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'print.c')
-rw-r--r--print.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/print.c b/print.c
index 61d4a9dc4..a015a4e18 100644
--- a/print.c
+++ b/print.c
@@ -599,8 +599,9 @@ static int show_dive_table(struct dive *dive, cairo_t *cr, PangoLayout *layout,
static void show_dive_profile(struct dive *dive, cairo_t *cr, double w,
double h)
{
+ int color = print_options.color_selected == 1 ? 2 : 1; /* 1 for B/W, 2 for color */
struct graphics_context gc = {
- .printer = 1,
+ .printer = color,
.cr = cr,
.drawing_area = { w/20.0, h/20.0, w, h},
};
@@ -871,6 +872,7 @@ static void name(GtkWidget *w, gpointer data) \
}
OPTIONSELECTEDCALLBACK(print_selection_toggle, print_options.print_selected)
+OPTIONSELECTEDCALLBACK(color_selection_toggle, print_options.color_selected)
static GtkWidget *print_dialog(GtkPrintOperation *operation, gpointer user_data)
@@ -920,6 +922,12 @@ static GtkWidget *print_dialog(GtkPrintOperation *operation, gpointer user_data)
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 2);
g_signal_connect(G_OBJECT(button), "toggled",
G_CALLBACK(print_selection_toggle), NULL);
+ GtkWidget *colorButton;
+ colorButton = gtk_check_button_new_with_label(_("Print in color"));
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(colorButton),TRUE);
+ gtk_box_pack_start(GTK_BOX(box), colorButton, FALSE, FALSE, 2);
+ g_signal_connect(G_OBJECT(colorButton), "toggled",
+ G_CALLBACK(color_selection_toggle), NULL);
}
gtk_widget_show_all(vbox);