Bug 535158 – can't rearrange the order of multi pages per side

2008-08-21  Marek Kasik  <mkasik@redhat.com>

	Bug 535158 – can't rearrange the order of multi pages per side

	* gtk/gtkprinter.c
	* gtk/gtkprinter.h
	* gtk/gtkprintunixdialog.c
	* gtk/gtkprintsettings.c
	* gtk/gtkprintsettings.h
	* gtk/gtkenums.h
	* modules/printbackends/cups/gtkprintbackendcups.c: Allow user to
	specify layout of pages per sheet in number-up mode

svn path=/trunk/; revision=21175
This commit is contained in:
Marek Kasik 2008-08-21 10:25:27 +00:00 committed by Marek Kašík
parent 0f942a3cb8
commit 6e7941db6d
7 changed files with 590 additions and 138 deletions

View File

@ -487,6 +487,18 @@ typedef enum
GTK_PAGE_SET_ODD
} GtkPageSet;
typedef enum
{
GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM,
GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_BOTTOM_TO_TOP,
GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_TOP_TO_BOTTOM,
GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_BOTTOM_TO_TOP,
GTK_NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_LEFT_TO_RIGHT,
GTK_NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_RIGHT_TO_LEFT,
GTK_NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_LEFT_TO_RIGHT,
GTK_NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_RIGHT_TO_LEFT
} GtkNumberUpLayout;
typedef enum
{
GTK_PAGE_ORIENTATION_PORTRAIT,

View File

@ -1224,6 +1224,7 @@ gtk_print_capabilities_get_type (void)
{ GTK_PRINT_CAPABILITY_GENERATE_PS, "GTK_PRINT_CAPABILITY_GENERATE_PS", "generate-ps" },
{ GTK_PRINT_CAPABILITY_PREVIEW, "GTK_PRINT_CAPABILITY_PREVIEW", "preview" },
{ GTK_PRINT_CAPABILITY_NUMBER_UP, "GTK_PRINT_CAPABILITY_NUMBER_UP", "number-up"},
{ GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT, "GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT", "number-up-layout" },
{ 0, NULL, NULL }
};

View File

@ -36,15 +36,16 @@ G_BEGIN_DECLS
*/
typedef enum
{
GTK_PRINT_CAPABILITY_PAGE_SET = 1 << 0,
GTK_PRINT_CAPABILITY_COPIES = 1 << 1,
GTK_PRINT_CAPABILITY_COLLATE = 1 << 2,
GTK_PRINT_CAPABILITY_REVERSE = 1 << 3,
GTK_PRINT_CAPABILITY_SCALE = 1 << 4,
GTK_PRINT_CAPABILITY_GENERATE_PDF = 1 << 5,
GTK_PRINT_CAPABILITY_GENERATE_PS = 1 << 6,
GTK_PRINT_CAPABILITY_PREVIEW = 1 << 7,
GTK_PRINT_CAPABILITY_NUMBER_UP = 1 << 8
GTK_PRINT_CAPABILITY_PAGE_SET = 1 << 0,
GTK_PRINT_CAPABILITY_COPIES = 1 << 1,
GTK_PRINT_CAPABILITY_COLLATE = 1 << 2,
GTK_PRINT_CAPABILITY_REVERSE = 1 << 3,
GTK_PRINT_CAPABILITY_SCALE = 1 << 4,
GTK_PRINT_CAPABILITY_GENERATE_PDF = 1 << 5,
GTK_PRINT_CAPABILITY_GENERATE_PS = 1 << 6,
GTK_PRINT_CAPABILITY_PREVIEW = 1 << 7,
GTK_PRINT_CAPABILITY_NUMBER_UP = 1 << 8,
GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT = 1 << 9
} GtkPrintCapabilities;
GType gtk_print_capabilities_get_type (void) G_GNUC_CONST;

View File

@ -25,6 +25,7 @@
#include "gtkprintsettings.h"
#include "gtkprintutils.h"
#include "gtkalias.h"
#include <gtk/gtk.h>
typedef struct _GtkPrintSettingsClass GtkPrintSettingsClass;
@ -1038,6 +1039,108 @@ gtk_print_settings_set_page_set (GtkPrintSettings *settings,
gtk_print_settings_set (settings, GTK_PRINT_SETTINGS_PAGE_SET, str);
}
/**
* gtk_print_settings_get_number_up_layout:
* @settings: a #GtkPrintSettings
*
* Gets the value of %GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT.
*
* Return value: layout of page in number-up mode
*
* Since: 2.14
*/
GtkNumberUpLayout
gtk_print_settings_get_number_up_layout (GtkPrintSettings *settings)
{
GtkNumberUpLayout layout;
GtkTextDirection text_direction;
const gchar *val;
val = gtk_print_settings_get (settings, GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT);
text_direction = gtk_widget_get_default_direction ();
if (text_direction == GTK_TEXT_DIR_LTR)
layout = GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM;
else
layout = GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_TOP_TO_BOTTOM;
if (val == NULL)
return layout;
if (strcmp (val, "lrtb") == 0)
return GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM;
if (strcmp (val, "lrbt") == 0)
return GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_BOTTOM_TO_TOP;
if (strcmp (val, "rltb") == 0)
return GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_TOP_TO_BOTTOM;
if (strcmp (val, "rlbt") == 0)
return GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_BOTTOM_TO_TOP;
if (strcmp (val, "tblr") == 0)
return GTK_NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_LEFT_TO_RIGHT;
if (strcmp (val, "tbrl") == 0)
return GTK_NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_RIGHT_TO_LEFT;
if (strcmp (val, "btlr") == 0)
return GTK_NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_LEFT_TO_RIGHT;
if (strcmp (val, "btrl") == 0)
return GTK_NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_RIGHT_TO_LEFT;
return layout;
}
/**
* gtk_print_settings_set_number_up_layout:
* @settings: a #GtkPrintSettings
* @number_up_layout: a #GtkNumberUpLayout value
*
* Sets the value of %GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT.
*
* Since: 2.14
*/
void
gtk_print_settings_set_number_up_layout (GtkPrintSettings *settings,
GtkNumberUpLayout number_up_layout)
{
const gchar *str;
switch (number_up_layout)
{
default:
case GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM:
str = "lrtb";
break;
case GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_BOTTOM_TO_TOP:
str = "lrbt";
break;
case GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_TOP_TO_BOTTOM:
str = "rltb";
break;
case GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_BOTTOM_TO_TOP:
str = "rlbt";
break;
case GTK_NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_LEFT_TO_RIGHT:
str = "tblr";
break;
case GTK_NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_RIGHT_TO_LEFT:
str = "tbrl";
break;
case GTK_NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_LEFT_TO_RIGHT:
str = "btlr";
break;
case GTK_NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_RIGHT_TO_LEFT:
str = "btrl";
break;
}
gtk_print_settings_set (settings, GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT, str);
}
/**
* gtk_print_settings_get_n_copies:
* @settings: a #GtkPrintSettings

View File

@ -46,8 +46,8 @@ struct _GtkPageRange
gint end;
};
GType gtk_print_settings_get_type (void) G_GNUC_CONST;
GtkPrintSettings *gtk_print_settings_new (void);
GType gtk_print_settings_get_type (void) G_GNUC_CONST;
GtkPrintSettings *gtk_print_settings_new (void);
GtkPrintSettings *gtk_print_settings_copy (GtkPrintSettings *other);
@ -71,7 +71,7 @@ void gtk_print_settings_to_key_file (GtkPrintSettings
const gchar *group_name);
gboolean gtk_print_settings_has_key (GtkPrintSettings *settings,
const gchar *key);
G_CONST_RETURN gchar *gtk_print_settings_get (GtkPrintSettings *settings,
G_CONST_RETURN gchar *gtk_print_settings_get (GtkPrintSettings *settings,
const gchar *key);
void gtk_print_settings_set (GtkPrintSettings *settings,
const gchar *key,
@ -110,28 +110,29 @@ void gtk_print_settings_set_int (GtkPrintSettings
const gchar *key,
gint value);
#define GTK_PRINT_SETTINGS_PRINTER "printer"
#define GTK_PRINT_SETTINGS_ORIENTATION "orientation"
#define GTK_PRINT_SETTINGS_PAPER_FORMAT "paper-format"
#define GTK_PRINT_SETTINGS_PAPER_WIDTH "paper-width"
#define GTK_PRINT_SETTINGS_PAPER_HEIGHT "paper-height"
#define GTK_PRINT_SETTINGS_N_COPIES "n-copies"
#define GTK_PRINT_SETTINGS_DEFAULT_SOURCE "default-source"
#define GTK_PRINT_SETTINGS_QUALITY "quality"
#define GTK_PRINT_SETTINGS_RESOLUTION "resolution"
#define GTK_PRINT_SETTINGS_USE_COLOR "use-color"
#define GTK_PRINT_SETTINGS_DUPLEX "duplex"
#define GTK_PRINT_SETTINGS_COLLATE "collate"
#define GTK_PRINT_SETTINGS_REVERSE "reverse"
#define GTK_PRINT_SETTINGS_MEDIA_TYPE "media-type"
#define GTK_PRINT_SETTINGS_DITHER "dither"
#define GTK_PRINT_SETTINGS_SCALE "scale"
#define GTK_PRINT_SETTINGS_PRINT_PAGES "print-pages"
#define GTK_PRINT_SETTINGS_PAGE_RANGES "page-ranges"
#define GTK_PRINT_SETTINGS_PAGE_SET "page-set"
#define GTK_PRINT_SETTINGS_FINISHINGS "finishings"
#define GTK_PRINT_SETTINGS_NUMBER_UP "number-up"
#define GTK_PRINT_SETTINGS_OUTPUT_BIN "output-bin"
#define GTK_PRINT_SETTINGS_PRINTER "printer"
#define GTK_PRINT_SETTINGS_ORIENTATION "orientation"
#define GTK_PRINT_SETTINGS_PAPER_FORMAT "paper-format"
#define GTK_PRINT_SETTINGS_PAPER_WIDTH "paper-width"
#define GTK_PRINT_SETTINGS_PAPER_HEIGHT "paper-height"
#define GTK_PRINT_SETTINGS_N_COPIES "n-copies"
#define GTK_PRINT_SETTINGS_DEFAULT_SOURCE "default-source"
#define GTK_PRINT_SETTINGS_QUALITY "quality"
#define GTK_PRINT_SETTINGS_RESOLUTION "resolution"
#define GTK_PRINT_SETTINGS_USE_COLOR "use-color"
#define GTK_PRINT_SETTINGS_DUPLEX "duplex"
#define GTK_PRINT_SETTINGS_COLLATE "collate"
#define GTK_PRINT_SETTINGS_REVERSE "reverse"
#define GTK_PRINT_SETTINGS_MEDIA_TYPE "media-type"
#define GTK_PRINT_SETTINGS_DITHER "dither"
#define GTK_PRINT_SETTINGS_SCALE "scale"
#define GTK_PRINT_SETTINGS_PRINT_PAGES "print-pages"
#define GTK_PRINT_SETTINGS_PAGE_RANGES "page-ranges"
#define GTK_PRINT_SETTINGS_PAGE_SET "page-set"
#define GTK_PRINT_SETTINGS_FINISHINGS "finishings"
#define GTK_PRINT_SETTINGS_NUMBER_UP "number-up"
#define GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT "number-up-layout"
#define GTK_PRINT_SETTINGS_OUTPUT_BIN "output-bin"
#define GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT "output-file-format"
#define GTK_PRINT_SETTINGS_OUTPUT_URI "output-uri"
@ -141,78 +142,81 @@ void gtk_print_settings_set_int (GtkPrintSettings
/* Helpers: */
G_CONST_RETURN gchar *gtk_print_settings_get_printer (GtkPrintSettings *settings);
void gtk_print_settings_set_printer (GtkPrintSettings *settings,
const gchar *printer);
GtkPageOrientation gtk_print_settings_get_orientation (GtkPrintSettings *settings);
void gtk_print_settings_set_orientation (GtkPrintSettings *settings,
GtkPageOrientation orientation);
GtkPaperSize * gtk_print_settings_get_paper_size (GtkPrintSettings *settings);
void gtk_print_settings_set_paper_size (GtkPrintSettings *settings,
GtkPaperSize *paper_size);
gdouble gtk_print_settings_get_paper_width (GtkPrintSettings *settings,
GtkUnit unit);
void gtk_print_settings_set_paper_width (GtkPrintSettings *settings,
gdouble width,
GtkUnit unit);
gdouble gtk_print_settings_get_paper_height (GtkPrintSettings *settings,
GtkUnit unit);
void gtk_print_settings_set_paper_height (GtkPrintSettings *settings,
gdouble height,
GtkUnit unit);
gboolean gtk_print_settings_get_use_color (GtkPrintSettings *settings);
void gtk_print_settings_set_use_color (GtkPrintSettings *settings,
gboolean use_color);
gboolean gtk_print_settings_get_collate (GtkPrintSettings *settings);
void gtk_print_settings_set_collate (GtkPrintSettings *settings,
gboolean collate);
gboolean gtk_print_settings_get_reverse (GtkPrintSettings *settings);
void gtk_print_settings_set_reverse (GtkPrintSettings *settings,
gboolean reverse);
GtkPrintDuplex gtk_print_settings_get_duplex (GtkPrintSettings *settings);
void gtk_print_settings_set_duplex (GtkPrintSettings *settings,
GtkPrintDuplex duplex);
GtkPrintQuality gtk_print_settings_get_quality (GtkPrintSettings *settings);
void gtk_print_settings_set_quality (GtkPrintSettings *settings,
GtkPrintQuality quality);
gint gtk_print_settings_get_n_copies (GtkPrintSettings *settings);
void gtk_print_settings_set_n_copies (GtkPrintSettings *settings,
gint num_copies);
gint gtk_print_settings_get_number_up (GtkPrintSettings *settings);
void gtk_print_settings_set_number_up (GtkPrintSettings *settings,
gint number_up);
gint gtk_print_settings_get_resolution (GtkPrintSettings *settings);
void gtk_print_settings_set_resolution (GtkPrintSettings *settings,
gint resolution);
gdouble gtk_print_settings_get_scale (GtkPrintSettings *settings);
void gtk_print_settings_set_scale (GtkPrintSettings *settings,
gdouble scale);
GtkPrintPages gtk_print_settings_get_print_pages (GtkPrintSettings *settings);
void gtk_print_settings_set_print_pages (GtkPrintSettings *settings,
GtkPrintPages pages);
GtkPageRange * gtk_print_settings_get_page_ranges (GtkPrintSettings *settings,
gint *num_ranges);
void gtk_print_settings_set_page_ranges (GtkPrintSettings *settings,
GtkPageRange *page_ranges,
gint num_ranges);
GtkPageSet gtk_print_settings_get_page_set (GtkPrintSettings *settings);
void gtk_print_settings_set_page_set (GtkPrintSettings *settings,
GtkPageSet page_set);
G_CONST_RETURN gchar *gtk_print_settings_get_default_source (GtkPrintSettings *settings);
void gtk_print_settings_set_default_source (GtkPrintSettings *settings,
const gchar *default_source);
G_CONST_RETURN gchar *gtk_print_settings_get_media_type (GtkPrintSettings *settings);
void gtk_print_settings_set_media_type (GtkPrintSettings *settings,
const gchar *media_type);
G_CONST_RETURN gchar *gtk_print_settings_get_dither (GtkPrintSettings *settings);
void gtk_print_settings_set_dither (GtkPrintSettings *settings,
const gchar *dither);
G_CONST_RETURN gchar *gtk_print_settings_get_finishings (GtkPrintSettings *settings);
void gtk_print_settings_set_finishings (GtkPrintSettings *settings,
const gchar *finishings);
G_CONST_RETURN gchar *gtk_print_settings_get_output_bin (GtkPrintSettings *settings);
void gtk_print_settings_set_output_bin (GtkPrintSettings *settings,
const gchar *output_bin);
G_CONST_RETURN gchar *gtk_print_settings_get_printer (GtkPrintSettings *settings);
void gtk_print_settings_set_printer (GtkPrintSettings *settings,
const gchar *printer);
GtkPageOrientation gtk_print_settings_get_orientation (GtkPrintSettings *settings);
void gtk_print_settings_set_orientation (GtkPrintSettings *settings,
GtkPageOrientation orientation);
GtkPaperSize * gtk_print_settings_get_paper_size (GtkPrintSettings *settings);
void gtk_print_settings_set_paper_size (GtkPrintSettings *settings,
GtkPaperSize *paper_size);
gdouble gtk_print_settings_get_paper_width (GtkPrintSettings *settings,
GtkUnit unit);
void gtk_print_settings_set_paper_width (GtkPrintSettings *settings,
gdouble width,
GtkUnit unit);
gdouble gtk_print_settings_get_paper_height (GtkPrintSettings *settings,
GtkUnit unit);
void gtk_print_settings_set_paper_height (GtkPrintSettings *settings,
gdouble height,
GtkUnit unit);
gboolean gtk_print_settings_get_use_color (GtkPrintSettings *settings);
void gtk_print_settings_set_use_color (GtkPrintSettings *settings,
gboolean use_color);
gboolean gtk_print_settings_get_collate (GtkPrintSettings *settings);
void gtk_print_settings_set_collate (GtkPrintSettings *settings,
gboolean collate);
gboolean gtk_print_settings_get_reverse (GtkPrintSettings *settings);
void gtk_print_settings_set_reverse (GtkPrintSettings *settings,
gboolean reverse);
GtkPrintDuplex gtk_print_settings_get_duplex (GtkPrintSettings *settings);
void gtk_print_settings_set_duplex (GtkPrintSettings *settings,
GtkPrintDuplex duplex);
GtkPrintQuality gtk_print_settings_get_quality (GtkPrintSettings *settings);
void gtk_print_settings_set_quality (GtkPrintSettings *settings,
GtkPrintQuality quality);
gint gtk_print_settings_get_n_copies (GtkPrintSettings *settings);
void gtk_print_settings_set_n_copies (GtkPrintSettings *settings,
gint num_copies);
gint gtk_print_settings_get_number_up (GtkPrintSettings *settings);
void gtk_print_settings_set_number_up (GtkPrintSettings *settings,
gint number_up);
GtkNumberUpLayout gtk_print_settings_get_number_up_layout (GtkPrintSettings *settings);
void gtk_print_settings_set_number_up_layout (GtkPrintSettings *settings,
GtkNumberUpLayout number_up_layout);
gint gtk_print_settings_get_resolution (GtkPrintSettings *settings);
void gtk_print_settings_set_resolution (GtkPrintSettings *settings,
gint resolution);
gdouble gtk_print_settings_get_scale (GtkPrintSettings *settings);
void gtk_print_settings_set_scale (GtkPrintSettings *settings,
gdouble scale);
GtkPrintPages gtk_print_settings_get_print_pages (GtkPrintSettings *settings);
void gtk_print_settings_set_print_pages (GtkPrintSettings *settings,
GtkPrintPages pages);
GtkPageRange * gtk_print_settings_get_page_ranges (GtkPrintSettings *settings,
gint *num_ranges);
void gtk_print_settings_set_page_ranges (GtkPrintSettings *settings,
GtkPageRange *page_ranges,
gint num_ranges);
GtkPageSet gtk_print_settings_get_page_set (GtkPrintSettings *settings);
void gtk_print_settings_set_page_set (GtkPrintSettings *settings,
GtkPageSet page_set);
G_CONST_RETURN gchar *gtk_print_settings_get_default_source (GtkPrintSettings *settings);
void gtk_print_settings_set_default_source (GtkPrintSettings *settings,
const gchar *default_source);
G_CONST_RETURN gchar *gtk_print_settings_get_media_type (GtkPrintSettings *settings);
void gtk_print_settings_set_media_type (GtkPrintSettings *settings,
const gchar *media_type);
G_CONST_RETURN gchar *gtk_print_settings_get_dither (GtkPrintSettings *settings);
void gtk_print_settings_set_dither (GtkPrintSettings *settings,
const gchar *dither);
G_CONST_RETURN gchar *gtk_print_settings_get_finishings (GtkPrintSettings *settings);
void gtk_print_settings_set_finishings (GtkPrintSettings *settings,
const gchar *finishings);
G_CONST_RETURN gchar *gtk_print_settings_get_output_bin (GtkPrintSettings *settings);
void gtk_print_settings_set_output_bin (GtkPrintSettings *settings,
const gchar *output_bin);
G_END_DECLS

View File

@ -168,6 +168,7 @@ struct GtkPrintUnixDialogPrivate
GtkPrinterOptionWidget *billing_info;
GtkPrinterOptionWidget *cover_before;
GtkPrinterOptionWidget *cover_after;
GtkPrinterOptionWidget *number_up_layout;
GtkWidget *conflicts_widget;
@ -189,6 +190,9 @@ struct GtkPrintUnixDialogPrivate
* is changed by the user it is cleared.
*/
GtkPrintSettings *initial_settings;
GtkPrinterOption *number_up_layout_n_option;
GtkPrinterOption *number_up_layout_2_option;
/* This is the initial printer set by set_settings. We look for it in the
* added printers. We clear this whenever the user manually changes
@ -415,6 +419,8 @@ gtk_print_unix_dialog_init (GtkPrintUnixDialog *dialog)
priv = dialog->priv = GTK_PRINT_UNIX_DIALOG_GET_PRIVATE (dialog);
priv->print_backends = NULL;
priv->current_page = -1;
priv->number_up_layout_n_option = NULL;
priv->number_up_layout_2_option = NULL;
priv->page_setup = gtk_page_setup_new ();
priv->page_setup_set = FALSE;
@ -509,6 +515,24 @@ gtk_print_unix_dialog_finalize (GObject *object)
priv->options = NULL;
}
if (priv->number_up_layout_2_option)
{
priv->number_up_layout_2_option->choices[0] = NULL;
priv->number_up_layout_2_option->choices[1] = NULL;
g_free (priv->number_up_layout_2_option->choices_display[0]);
g_free (priv->number_up_layout_2_option->choices_display[1]);
priv->number_up_layout_2_option->choices_display[0] = NULL;
priv->number_up_layout_2_option->choices_display[1] = NULL;
g_object_unref (priv->number_up_layout_2_option);
priv->number_up_layout_2_option = NULL;
}
if (priv->number_up_layout_n_option)
{
g_object_unref (priv->number_up_layout_n_option);
priv->number_up_layout_n_option = NULL;
}
if (priv->page_setup)
{
g_object_unref (priv->page_setup);
@ -1149,6 +1173,7 @@ update_dialog_from_settings (GtkPrintUnixDialog *dialog)
}
setup_option (dialog, "gtk-n-up", priv->pages_per_sheet);
setup_option (dialog, "gtk-n-up-layout", priv->number_up_layout);
setup_option (dialog, "gtk-duplex", priv->duplex);
setup_option (dialog, "gtk-paper-type", priv->paper_type);
setup_option (dialog, "gtk-paper-source", priv->paper_source);
@ -2095,6 +2120,59 @@ dialog_get_pages_per_sheet (GtkPrintUnixDialog *dialog)
return num;
}
static GtkNumberUpLayout
dialog_get_number_up_layout (GtkPrintUnixDialog *dialog)
{
GtkPrintUnixDialogPrivate *priv = dialog->priv;
GtkPrintCapabilities caps;
GtkNumberUpLayout layout;
GtkTextDirection text_direction;
const gchar *val;
val = gtk_printer_option_widget_get_value (priv->number_up_layout);
text_direction = gtk_widget_get_default_direction ();
caps = priv->manual_capabilities | priv->printer_capabilities;
if (caps & GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT)
{
if (text_direction == GTK_TEXT_DIR_LTR)
layout = GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM;
else
layout = GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_TOP_TO_BOTTOM;
}
else
layout = GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM;
if (val == NULL)
return layout;
if (strcmp (val, "lrtb") == 0)
return GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM;
if (strcmp (val, "lrbt") == 0)
return GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_BOTTOM_TO_TOP;
if (strcmp (val, "rltb") == 0)
return GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_TOP_TO_BOTTOM;
if (strcmp (val, "rlbt") == 0)
return GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_BOTTOM_TO_TOP;
if (strcmp (val, "tblr") == 0)
return GTK_NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_LEFT_TO_RIGHT;
if (strcmp (val, "tbrl") == 0)
return GTK_NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_RIGHT_TO_LEFT;
if (strcmp (val, "btlr") == 0)
return GTK_NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_LEFT_TO_RIGHT;
if (strcmp (val, "btrl") == 0)
return GTK_NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_RIGHT_TO_LEFT;
return layout;
}
static gboolean
draw_page_cb (GtkWidget *widget,
@ -2113,11 +2191,17 @@ draw_page_cb (GtkWidget *widget,
PangoFontDescription *font;
gchar *text;
GdkColor *color;
GtkNumberUpLayout number_up_layout;
gint start_x, end_x, start_y, end_y;
gint dx, dy;
gboolean horizontal;
orientation = gtk_page_setup_get_orientation (priv->page_setup);
landscape =
(orientation == GTK_PAGE_ORIENTATION_LANDSCAPE) ||
(orientation == GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE);
number_up_layout = dialog_get_number_up_layout (dialog);
cr = gdk_cairo_create (widget->window);
@ -2196,25 +2280,120 @@ draw_page_cb (GtkWidget *widget,
pango_layout_set_width (layout, page_width * PANGO_SCALE);
pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
for (y = 0; y < pages_y; y++)
switch (number_up_layout)
{
for (x = 0; x < pages_x; x++)
{
text = g_strdup_printf ("%d", i++);
pango_layout_set_text (layout, text, -1);
g_free (text);
pango_layout_get_size (layout, &layout_w, &layout_h);
cairo_save (cr);
cairo_translate (cr,
x * page_width,
y * page_height + (page_height - layout_h / 1024.0) / 2
);
pango_cairo_show_layout (cr, layout);
cairo_restore (cr);
}
default:
case GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM:
start_x = 0;
end_x = pages_x - 1;
start_y = 0;
end_y = pages_y - 1;
dx = 1;
dy = 1;
horizontal = TRUE;
break;
case GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_BOTTOM_TO_TOP:
start_x = 0;
end_x = pages_x - 1;
start_y = pages_y - 1;
end_y = 0;
dx = 1;
dy = - 1;
horizontal = TRUE;
break;
case GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_TOP_TO_BOTTOM:
start_x = pages_x - 1;
end_x = 0;
start_y = 0;
end_y = pages_y - 1;
dx = - 1;
dy = 1;
horizontal = TRUE;
break;
case GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_BOTTOM_TO_TOP:
start_x = pages_x - 1;
end_x = 0;
start_y = pages_y - 1;
end_y = 0;
dx = - 1;
dy = - 1;
horizontal = TRUE;
break;
case GTK_NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_LEFT_TO_RIGHT:
start_x = 0;
end_x = pages_x - 1;
start_y = 0;
end_y = pages_y - 1;
dx = 1;
dy = 1;
horizontal = FALSE;
break;
case GTK_NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_RIGHT_TO_LEFT:
start_x = pages_x - 1;
end_x = 0;
start_y = 0;
end_y = pages_y - 1;
dx = - 1;
dy = 1;
horizontal = FALSE;
break;
case GTK_NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_LEFT_TO_RIGHT:
start_x = 0;
end_x = pages_x - 1;
start_y = pages_y - 1;
end_y = 0;
dx = 1;
dy = - 1;
horizontal = FALSE;
break;
case GTK_NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_RIGHT_TO_LEFT:
start_x = pages_x - 1;
end_x = 0;
start_y = pages_y - 1;
end_y = 0;
dx = - 1;
dy = - 1;
horizontal = FALSE;
break;
}
if (horizontal)
for (y = start_y; y != end_y + dy; y += dy)
{
for (x = start_x; x != end_x + dx; x += dx)
{
text = g_strdup_printf ("%d", i++);
pango_layout_set_text (layout, text, -1);
g_free (text);
pango_layout_get_size (layout, &layout_w, &layout_h);
cairo_save (cr);
cairo_translate (cr,
x * page_width,
y * page_height + (page_height - layout_h / 1024.0) / 2);
pango_cairo_show_layout (cr, layout);
cairo_restore (cr);
}
}
else
for (x = start_x; x != end_x + dx; x += dx)
{
for (y = start_y; y != end_y + dy; y += dy)
{
text = g_strdup_printf ("%d", i++);
pango_layout_set_text (layout, text, -1);
g_free (text);
pango_layout_get_size (layout, &layout_w, &layout_h);
cairo_save (cr);
cairo_translate (cr,
x * page_width,
y * page_height + (page_height - layout_h / 1024.0) / 2);
pango_cairo_show_layout (cr, layout);
cairo_restore (cr);
}
}
g_object_unref (layout);
cairo_destroy (cr);
@ -2230,6 +2409,103 @@ redraw_page_layout_preview (GtkPrintUnixDialog *dialog)
gtk_widget_queue_draw (priv->page_layout_preview);
}
static void
update_number_up_layout (GtkPrintUnixDialog *dialog)
{
GtkPrintUnixDialogPrivate *priv = dialog->priv;
GtkPrintCapabilities caps;
GtkPrinterOptionSet *set;
GtkNumberUpLayout layout;
GtkPrinterOption *option;
GtkPrinterOption *old_option;
set = priv->options;
caps = priv->manual_capabilities | priv->printer_capabilities;
if (caps & GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT)
{
if (priv->number_up_layout_n_option == NULL)
{
priv->number_up_layout_n_option = gtk_printer_option_set_lookup (set, "gtk-n-up-layout");
g_object_ref (priv->number_up_layout_n_option);
priv->number_up_layout_2_option = gtk_printer_option_new ("gtk-n-up-layout",
_("Page Ordering"),
GTK_PRINTER_OPTION_TYPE_PICKONE);
gtk_printer_option_allocate_choices (priv->number_up_layout_2_option, 2);
priv->number_up_layout_2_option->choices[0] = priv->number_up_layout_n_option->choices[0];
priv->number_up_layout_2_option->choices[1] = priv->number_up_layout_n_option->choices[2];
priv->number_up_layout_2_option->choices_display[0] = g_strdup ( _("Left to right"));
priv->number_up_layout_2_option->choices_display[1] = g_strdup ( _("Right to left"));
}
layout = dialog_get_number_up_layout (dialog);
old_option = gtk_printer_option_set_lookup (set, "gtk-n-up-layout");
if (old_option != NULL)
gtk_printer_option_set_remove (set, old_option);
if (dialog_get_pages_per_sheet (dialog) != 1)
{
if (dialog_get_pages_per_sheet (dialog) == 2)
{
option = priv->number_up_layout_2_option;
if (layout == GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM ||
layout == GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_BOTTOM_TO_TOP ||
layout == GTK_NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_LEFT_TO_RIGHT ||
layout == GTK_NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_LEFT_TO_RIGHT)
gtk_printer_option_set (option, "lrtb");
else
gtk_printer_option_set (option, "rltb");
}
else
{
option = priv->number_up_layout_n_option;
switch (layout)
{
case GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM:
gtk_printer_option_set (option, "lrtb");
break;
case GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_BOTTOM_TO_TOP:
gtk_printer_option_set (option, "lrbt");
break;
case GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_TOP_TO_BOTTOM:
gtk_printer_option_set (option, "rltb");
break;
case GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_BOTTOM_TO_TOP:
gtk_printer_option_set (option, "rlbt");
break;
case GTK_NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_LEFT_TO_RIGHT:
gtk_printer_option_set (option, "tblr");
break;
case GTK_NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_RIGHT_TO_LEFT:
gtk_printer_option_set (option, "tbrl");
break;
case GTK_NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_LEFT_TO_RIGHT:
gtk_printer_option_set (option, "btlr");
break;
case GTK_NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_RIGHT_TO_LEFT:
gtk_printer_option_set (option, "btrl");
break;
}
}
gtk_printer_option_set_add (set, option);
}
}
setup_option (dialog, "gtk-n-up-layout", priv->number_up_layout);
if (priv->number_up_layout != NULL)
gtk_widget_set_sensitive (GTK_WIDGET (priv->number_up_layout),
(caps & GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT) &&
(dialog_get_pages_per_sheet (dialog) > 1));
}
static void
create_page_setup_page (GtkPrintUnixDialog *dialog)
{
@ -2253,7 +2529,7 @@ create_page_setup_page (GtkPrintUnixDialog *dialog)
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
gtk_widget_show (table);
label = gtk_label_new_with_mnemonic (_("Pages per _side:"));
label = gtk_label_new_with_mnemonic (_("T_wo-sided:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (table), label,
@ -2261,15 +2537,14 @@ create_page_setup_page (GtkPrintUnixDialog *dialog)
0, 0);
widget = gtk_printer_option_widget_new (NULL);
g_signal_connect_swapped (widget, "changed", G_CALLBACK (redraw_page_layout_preview), dialog);
priv->pages_per_sheet = GTK_PRINTER_OPTION_WIDGET (widget);
priv->duplex = GTK_PRINTER_OPTION_WIDGET (widget);
gtk_widget_show (widget);
gtk_table_attach (GTK_TABLE (table), widget,
1, 2, 0, 1, GTK_FILL, 0,
0, 0);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
label = gtk_label_new_with_mnemonic (_("T_wo-sided:"));
label = gtk_label_new_with_mnemonic (_("Pages per _side:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (table), label,
@ -2277,25 +2552,44 @@ create_page_setup_page (GtkPrintUnixDialog *dialog)
0, 0);
widget = gtk_printer_option_widget_new (NULL);
priv->duplex = GTK_PRINTER_OPTION_WIDGET (widget);
g_signal_connect_swapped (widget, "changed", G_CALLBACK (redraw_page_layout_preview), dialog);
g_signal_connect_swapped (widget, "changed", G_CALLBACK (update_number_up_layout), dialog);
priv->pages_per_sheet = GTK_PRINTER_OPTION_WIDGET (widget);
gtk_widget_show (widget);
gtk_table_attach (GTK_TABLE (table), widget,
1, 2, 1, 2, GTK_FILL, 0,
0, 0);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
label = gtk_label_new_with_mnemonic (_("Page or_dering:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (table), label,
0, 1, 2, 3, GTK_FILL, 0,
0, 0);
widget = gtk_printer_option_widget_new (NULL);
g_signal_connect_swapped (widget, "changed", G_CALLBACK (redraw_page_layout_preview), dialog);
priv->number_up_layout = GTK_PRINTER_OPTION_WIDGET (widget);
gtk_widget_show (widget);
gtk_table_attach (GTK_TABLE (table), widget,
1, 2, 2, 3, GTK_FILL, 0,
0, 0);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
label = gtk_label_new_with_mnemonic (_("_Only print:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (table), label,
0, 1, 2, 3, GTK_FILL, 0,
0, 1, 3, 4, GTK_FILL, 0,
0, 0);
combo = gtk_combo_box_new_text ();
priv->page_set_combo = combo;
gtk_widget_show (combo);
gtk_table_attach (GTK_TABLE (table), combo,
1, 2, 2, 3, GTK_FILL, 0,
1, 2, 3, 4, GTK_FILL, 0,
0, 0);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
/* In enum order */
@ -2308,13 +2602,13 @@ create_page_setup_page (GtkPrintUnixDialog *dialog)
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (table), label,
0, 1, 3, 4, GTK_FILL, 0,
0, 1, 4, 5, GTK_FILL, 0,
0, 0);
hbox2 = gtk_hbox_new (FALSE, 6);
gtk_widget_show (hbox2);
gtk_table_attach (GTK_TABLE (table), hbox2,
1, 2, 3, 4, GTK_FILL, 0,
1, 2, 4, 5, GTK_FILL, 0,
0, 0);
spinbutton = gtk_spin_button_new_with_range (1.0, 1000.0, 1.0);

View File

@ -2684,17 +2684,23 @@ cups_printer_get_options (GtkPrinter *printer,
char *n_up[] = {"1", "2", "4", "6", "9", "16" };
char *prio[] = {"100", "80", "50", "30" };
char *prio_display[] = {N_("Urgent"), N_("High"), N_("Medium"), N_("Low") };
char *n_up_layout[] = { "lrtb", "lrbt", "rltb", "rlbt", "tblr", "tbrl", "btlr", "btrl" };
char *n_up_layout_display[] = { N_("Left to right, top to bottom"), N_("Left to right, bottom to top"),
N_("Right to left, top to bottom"), N_("Right to left, bottom to top"),
N_("Top to bottom, left to right"), N_("Top to bottom, right to left"),
N_("Bottom to top, left to right"), N_("Bottom to top, right to left") };
char *name;
int num_opts;
cups_option_t *opts = NULL;
GtkPrintBackendCups *backend;
GtkTextDirection text_direction;
set = gtk_printer_option_set_new ();
/* Cups specific, non-ppd related settings */
option = gtk_printer_option_new ("gtk-n-up", "Pages Per Sheet", GTK_PRINTER_OPTION_TYPE_PICKONE);
option = gtk_printer_option_new ("gtk-n-up", _("Pages Per Sheet"), GTK_PRINTER_OPTION_TYPE_PICKONE);
gtk_printer_option_choices_from_array (option, G_N_ELEMENTS (n_up),
n_up, n_up);
gtk_printer_option_set (option, "1");
@ -2702,10 +2708,30 @@ cups_printer_get_options (GtkPrinter *printer,
gtk_printer_option_set_add (set, option);
g_object_unref (option);
if (cups_printer_get_capabilities (printer) & GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT)
{
for (i = 0; i < G_N_ELEMENTS (n_up_layout_display); i++)
n_up_layout_display[i] = _(n_up_layout_display[i]);
option = gtk_printer_option_new ("gtk-n-up-layout", _("Page Ordering"), GTK_PRINTER_OPTION_TYPE_PICKONE);
gtk_printer_option_choices_from_array (option, G_N_ELEMENTS (n_up_layout),
n_up_layout, n_up_layout_display);
text_direction = gtk_widget_get_default_direction ();
if (text_direction == GTK_TEXT_DIR_LTR)
gtk_printer_option_set (option, "lrtb");
else
gtk_printer_option_set (option, "rltb");
set_option_from_settings (option, settings);
gtk_printer_option_set_add (set, option);
g_object_unref (option);
}
for (i = 0; i < G_N_ELEMENTS(prio_display); i++)
prio_display[i] = _(prio_display[i]);
option = gtk_printer_option_new ("gtk-job-prio", "Job Priority", GTK_PRINTER_OPTION_TYPE_PICKONE);
option = gtk_printer_option_new ("gtk-job-prio", _("Job Priority"), GTK_PRINTER_OPTION_TYPE_PICKONE);
gtk_printer_option_choices_from_array (option, G_N_ELEMENTS (prio),
prio, prio_display);
gtk_printer_option_set (option, "50");
@ -2713,7 +2739,7 @@ cups_printer_get_options (GtkPrinter *printer,
gtk_printer_option_set_add (set, option);
g_object_unref (option);
option = gtk_printer_option_new ("gtk-billing-info", "Billing Info", GTK_PRINTER_OPTION_TYPE_STRING);
option = gtk_printer_option_new ("gtk-billing-info", _("Billing Info"), GTK_PRINTER_OPTION_TYPE_STRING);
gtk_printer_option_set (option, "");
set_option_from_settings (option, settings);
gtk_printer_option_set_add (set, option);
@ -2756,7 +2782,7 @@ cups_printer_get_options (GtkPrinter *printer,
for (i = 0; i < num_of_covers; i++)
cover_display_translated[i] = _(cover_display[i]);
option = gtk_printer_option_new ("gtk-cover-before", "Before", GTK_PRINTER_OPTION_TYPE_PICKONE);
option = gtk_printer_option_new ("gtk-cover-before", _("Before"), GTK_PRINTER_OPTION_TYPE_PICKONE);
gtk_printer_option_choices_from_array (option, num_of_covers,
cover, cover_display_translated);
@ -2768,7 +2794,7 @@ cups_printer_get_options (GtkPrinter *printer,
gtk_printer_option_set_add (set, option);
g_object_unref (option);
option = gtk_printer_option_new ("gtk-cover-after", "After", GTK_PRINTER_OPTION_TYPE_PICKONE);
option = gtk_printer_option_new ("gtk-cover-after", _("After"), GTK_PRINTER_OPTION_TYPE_PICKONE);
gtk_printer_option_choices_from_array (option, num_of_covers,
cover, cover_display_translated);
if (backend->default_cover_after != NULL)
@ -2784,7 +2810,7 @@ cups_printer_get_options (GtkPrinter *printer,
g_free (cover_display_translated);
}
option = gtk_printer_option_new ("gtk-print-time", "Print at", GTK_PRINTER_OPTION_TYPE_PICKONE);
option = gtk_printer_option_new ("gtk-print-time", _("Print at"), GTK_PRINTER_OPTION_TYPE_PICKONE);
gtk_printer_option_choices_from_array (option, G_N_ELEMENTS (print_at),
print_at, print_at);
gtk_printer_option_set (option, "now");
@ -2792,7 +2818,7 @@ cups_printer_get_options (GtkPrinter *printer,
gtk_printer_option_set_add (set, option);
g_object_unref (option);
option = gtk_printer_option_new ("gtk-print-time-text", "Print at time", GTK_PRINTER_OPTION_TYPE_STRING);
option = gtk_printer_option_new ("gtk-print-time-text", _("Print at time"), GTK_PRINTER_OPTION_TYPE_STRING);
gtk_printer_option_set (option, "");
set_option_from_settings (option, settings);
gtk_printer_option_set_add (set, option);
@ -3149,6 +3175,11 @@ set_option_from_settings (GtkPrinterOption *option,
map_settings_to_option (option, all_map, G_N_ELEMENTS (all_map),
settings, GTK_PRINT_SETTINGS_NUMBER_UP, "number-up");
}
else if (strcmp (option->name, "gtk-n-up-layout") == 0)
{
map_settings_to_option (option, all_map, G_N_ELEMENTS (all_map),
settings, GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT, "number-up-layout");
}
else if (strcmp (option->name, "gtk-billing-info") == 0)
{
cups_value = gtk_print_settings_get (settings, "cups-job-billing");
@ -3229,6 +3260,9 @@ foreach_option_get_settings (GtkPrinterOption *option,
else if (strcmp (option->name, "gtk-n-up") == 0)
map_option_to_settings (value, all_map, G_N_ELEMENTS (all_map),
settings, GTK_PRINT_SETTINGS_NUMBER_UP, "number-up");
else if (strcmp (option->name, "gtk-n-up-layout") == 0)
map_option_to_settings (value, all_map, G_N_ELEMENTS (all_map),
settings, GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT, "number-up-layout");
else if (strcmp (option->name, "gtk-billing-info") == 0 && strlen (value) > 0)
gtk_print_settings_set (settings, "cups-job-billing", value);
else if (strcmp (option->name, "gtk-job-prio") == 0)
@ -3458,5 +3492,8 @@ cups_printer_get_capabilities (GtkPrinter *printer)
GTK_PRINT_CAPABILITY_COPIES |
GTK_PRINT_CAPABILITY_COLLATE |
GTK_PRINT_CAPABILITY_REVERSE |
#if (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 1 && CUPS_VERSION_PATCH >= 15) || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR > 1) || CUPS_VERSION_MAJOR > 1
GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT |
#endif
GTK_PRINT_CAPABILITY_NUMBER_UP;
}