Commit 4bc09a6a authored by Matthias Clasen's avatar Matthias Clasen

printing: Simplify sheet drawing

We don't need the scaling support anymore - icon sizes are
no longer settable.
parent 10d0dad2
...@@ -2195,21 +2195,17 @@ update_collate_icon (GtkToggleButton *toggle_button, ...@@ -2195,21 +2195,17 @@ update_collate_icon (GtkToggleButton *toggle_button,
static void static void
paint_page (GtkWidget *widget, paint_page (GtkWidget *widget,
cairo_t *cr, cairo_t *cr,
gfloat scale, gint x,
gint x_offset, gint y,
gint y_offset,
gchar *text, gchar *text,
gint text_x) gint text_x)
{ {
GtkStyleContext *context; GtkStyleContext *context;
gint x, y, width, height; gint width, height;
gint text_y; gint text_y;
x = x_offset * scale; width = 20;
y = y_offset * scale; height = 26;
width = 20 * scale;
height = 26 * scale;
text_y = 21; text_y = 21;
context = gtk_widget_get_style_context (widget); context = gtk_widget_get_style_context (widget);
...@@ -2224,8 +2220,8 @@ paint_page (GtkWidget *widget, ...@@ -2224,8 +2220,8 @@ paint_page (GtkWidget *widget,
cairo_select_font_face (cr, "Sans", cairo_select_font_face (cr, "Sans",
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL); CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, (gint)(9 * scale)); cairo_set_font_size (cr, 9);
cairo_move_to (cr, x + (gint)(text_x * scale), y + (gint)(text_y * scale)); cairo_move_to (cr, x + text_x, y + text_y);
cairo_show_text (cr, text); cairo_show_text (cr, text);
gtk_style_context_restore (context); gtk_style_context_restore (context);
...@@ -2236,8 +2232,6 @@ draw_collate_cb (GtkWidget *widget, ...@@ -2236,8 +2232,6 @@ draw_collate_cb (GtkWidget *widget,
cairo_t *cr, cairo_t *cr,
GtkPrintUnixDialog *dialog) GtkPrintUnixDialog *dialog)
{ {
gint size;
gfloat scale;
gboolean collate, reverse, rtl; gboolean collate, reverse, rtl;
gint copies; gint copies;
gint text_x; gint text_x;
...@@ -2249,11 +2243,8 @@ draw_collate_cb (GtkWidget *widget, ...@@ -2249,11 +2243,8 @@ draw_collate_cb (GtkWidget *widget,
rtl = (gtk_widget_get_direction (GTK_WIDGET (widget)) == GTK_TEXT_DIR_RTL); rtl = (gtk_widget_get_direction (GTK_WIDGET (widget)) == GTK_TEXT_DIR_RTL);
gtk_icon_size_lookup (GTK_ICON_SIZE_DIALOG, &size, NULL); x = (gtk_widget_get_allocated_width (widget) - 66) / 2;
scale = size / 48.0; y = (gtk_widget_get_allocated_height (widget) - 36) / 2;
x = (gtk_widget_get_allocated_width (widget) - 66 * scale) / 2;
y = (gtk_widget_get_allocated_height (widget) - 36 * scale) / 2;
if (rtl) if (rtl)
{ {
x1 = x + 36; x1 = x + 36;
...@@ -2273,16 +2264,16 @@ draw_collate_cb (GtkWidget *widget, ...@@ -2273,16 +2264,16 @@ draw_collate_cb (GtkWidget *widget,
if (copies == 1) if (copies == 1)
{ {
paint_page (widget, cr, scale, x1 + p1, y, reverse ? "1" : "2", text_x); paint_page (widget, cr, x1 + p1, y, reverse ? "1" : "2", text_x);
paint_page (widget, cr, scale, x1 + p2, y + 10, reverse ? "2" : "1", text_x); paint_page (widget, cr, x1 + p2, y + 10, reverse ? "2" : "1", text_x);
} }
else else
{ {
paint_page (widget, cr, scale, x1 + p1, y, collate == reverse ? "1" : "2", text_x); paint_page (widget, cr, x1 + p1, y, collate == reverse ? "1" : "2", text_x);
paint_page (widget, cr, scale, x1 + p2, y + 10, reverse ? "2" : "1", text_x); paint_page (widget, cr, x1 + p2, y + 10, reverse ? "2" : "1", text_x);
paint_page (widget, cr, scale, x2 + p1, y, reverse ? "1" : "2", text_x); paint_page (widget, cr, x2 + p1, y, reverse ? "1" : "2", text_x);
paint_page (widget, cr, scale, x2 + p2, y + 10, collate == reverse ? "2" : "1", text_x); paint_page (widget, cr, x2 + p2, y + 10, collate == reverse ? "2" : "1", text_x);
} }
return TRUE; return TRUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment