rpms/gtk2/F-12 gtk2-landscape-pdf-print.patch, NONE, 1.1 gtk2.spec, 1.432, 1.433
Marek Kašík
mkasik at fedoraproject.org
Thu Nov 5 12:47:46 UTC 2009
- Previous message: rpms/kdenetwork/F-12 kdenetwork.spec,1.204,1.205
- Next message: rpms/asterisk/F-10 .cvsignore, 1.21, 1.22 asterisk.spec, 1.46, 1.47 sources, 1.21, 1.22 asterisk-strip.sh, 1.5, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: mkasik
Update of /cvs/pkgs/rpms/gtk2/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv24726
Modified Files:
gtk2.spec
Added Files:
gtk2-landscape-pdf-print.patch
Log Message:
* Thu Nov 5 2009 Marek Kasik <mkasik at redhat.com> - 2.18.3-20
- Do not rotate page when printing to landscape PDF, just
- set correct width and height
gtk2-landscape-pdf-print.patch:
gtk/gtkprintcontext.c | 31 ++++++++++++++++++++++-
gtk/gtkprintoperation-private.h | 11 ++++----
gtk/gtkprintoperation-unix.c | 13 ++++-----
gtk/gtkprintoperation.c | 13 ++++-----
modules/printbackends/file/gtkprintbackendfile.c | 14 +++++++++-
5 files changed, 61 insertions(+), 21 deletions(-)
--- NEW FILE gtk2-landscape-pdf-print.patch ---
--- gtk+-2.18.3/gtk/gtkprintcontext.c 2009-10-09 07:00:44.000000000 +0200
+++ gtk+-2.18.3/gtk/gtkprintcontext.c 2009-11-05 11:57:31.000000000 +0100
@@ -155,7 +155,6 @@ gtk_print_context_set_cairo_context (Gtk
context->pixels_per_unit_y);
}
-
void
_gtk_print_context_rotate_according_to_orientation (GtkPrintContext *context)
{
@@ -204,6 +203,36 @@ _gtk_print_context_rotate_according_to_o
}
void
+_gtk_print_context_reverse_according_to_orientation (GtkPrintContext *context)
+{
+ cairo_t *cr = context->cr;
+ cairo_matrix_t matrix;
+ gdouble width, height;
+
+ width = gtk_page_setup_get_paper_width (context->page_setup, GTK_UNIT_INCH);
+ width = width * context->surface_dpi_x / context->pixels_per_unit_x;
+ height = gtk_page_setup_get_paper_height (context->page_setup, GTK_UNIT_INCH);
+ height = height * context->surface_dpi_y / context->pixels_per_unit_y;
+
+ switch (gtk_page_setup_get_orientation (context->page_setup))
+ {
+ default:
+ case GTK_PAGE_ORIENTATION_PORTRAIT:
+ case GTK_PAGE_ORIENTATION_LANDSCAPE:
+ break;
+ case GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT:
+ case GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE:
+ cairo_translate (cr, width, height);
+ cairo_matrix_init (&matrix,
+ -1, 0,
+ 0, -1,
+ 0, 0);
+ cairo_transform (cr, &matrix);
+ break;
+ }
+}
+
+void
_gtk_print_context_translate_into_margin (GtkPrintContext *context)
{
GtkPrintOperationPrivate *priv;
--- gtk+-2.18.3/gtk/gtkprintoperation.c 2009-11-05 12:02:52.000000000 +0100
+++ gtk+-2.18.3/gtk/gtkprintoperation.c 2009-11-05 12:01:40.000000000 +0100
@@ -1960,14 +1960,11 @@ pdf_start_page (GtkPrintOperation *op,
GtkPrintContext *print_context,
GtkPageSetup *page_setup)
{
- GtkPaperSize *paper_size;
cairo_surface_t *surface = op->priv->platform_data;
gdouble w, h;
- paper_size = gtk_page_setup_get_paper_size (page_setup);
-
- w = gtk_paper_size_get_width (paper_size, GTK_UNIT_POINTS);
- h = gtk_paper_size_get_height (paper_size, GTK_UNIT_POINTS);
+ w = gtk_page_setup_get_paper_width (page_setup, GTK_UNIT_POINTS);
+ h = gtk_page_setup_get_paper_height (page_setup, GTK_UNIT_POINTS);
cairo_pdf_surface_set_size (surface, w, h);
}
@@ -2056,7 +2053,7 @@ run_pdf (GtkPrintOperation *op,
priv->manual_reverse = FALSE;
priv->manual_page_set = GTK_PAGE_SET_ALL;
priv->manual_scale = 1.0;
- priv->manual_orientation = TRUE;
+ priv->manual_orientation = FALSE;
priv->manual_number_up = 1;
priv->manual_number_up_layout = GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM;
@@ -2400,6 +2397,8 @@ common_render_page (GtkPrintOperation *o
if (priv->manual_orientation)
_gtk_print_context_rotate_according_to_orientation (print_context);
+ else
+ _gtk_print_context_reverse_according_to_orientation (print_context);
if (priv->manual_number_up > 1)
{
@@ -2934,7 +2933,7 @@ print_pages (GtkPrintOperation *op
priv->manual_reverse = gtk_print_settings_get_reverse (priv->print_settings);
priv->manual_page_set = gtk_print_settings_get_page_set (priv->print_settings);
priv->manual_scale = gtk_print_settings_get_scale (priv->print_settings) / 100.0;
- priv->manual_orientation = TRUE;
+ priv->manual_orientation = FALSE;
priv->manual_number_up = gtk_print_settings_get_number_up (priv->print_settings);
priv->manual_number_up_layout = gtk_print_settings_get_number_up_layout (priv->print_settings);
}
--- gtk+-2.18.3/gtk/gtkprintoperation-private.h 2009-10-09 07:00:44.000000000 +0200
+++ gtk+-2.18.3/gtk/gtkprintoperation-private.h 2009-11-05 11:58:07.000000000 +0100
@@ -135,11 +135,12 @@ void _gtk_print_operation_set_status (Gt
/* GtkPrintContext private functions: */
-GtkPrintContext *_gtk_print_context_new (GtkPrintOperation *op);
-void _gtk_print_context_set_page_setup (GtkPrintContext *context,
- GtkPageSetup *page_setup);
-void _gtk_print_context_translate_into_margin (GtkPrintContext *context);
-void _gtk_print_context_rotate_according_to_orientation (GtkPrintContext *context);
+GtkPrintContext *_gtk_print_context_new (GtkPrintOperation *op);
+void _gtk_print_context_set_page_setup (GtkPrintContext *context,
+ GtkPageSetup *page_setup);
+void _gtk_print_context_translate_into_margin (GtkPrintContext *context);
+void _gtk_print_context_rotate_according_to_orientation (GtkPrintContext *context);
+void _gtk_print_context_reverse_according_to_orientation (GtkPrintContext *context);
G_END_DECLS
--- gtk+-2.18.3/gtk/gtkprintoperation-unix.c 2009-11-05 12:02:52.000000000 +0100
+++ gtk+-2.18.3/gtk/gtkprintoperation-unix.c 2009-11-05 12:00:08.000000000 +0100
@@ -109,6 +109,8 @@ unix_start_page (GtkPrintOperation *op,
}
else if (type == CAIRO_SURFACE_TYPE_PDF)
{
+ w = gtk_page_setup_get_paper_width (page_setup, GTK_UNIT_POINTS);
+ h = gtk_page_setup_get_paper_height (page_setup, GTK_UNIT_POINTS);
cairo_pdf_surface_set_size (op_unix->surface, w, h);
}
}
@@ -771,7 +773,6 @@ _gtk_print_operation_platform_backend_cr
{
gchar *filename;
gint fd;
- GtkPaperSize *paper_size;
gdouble w, h;
cairo_surface_t *surface;
static cairo_user_data_key_t key;
@@ -787,9 +788,8 @@ _gtk_print_operation_platform_backend_cr
*target = filename;
- paper_size = gtk_page_setup_get_paper_size (page_setup);
- w = gtk_paper_size_get_width (paper_size, GTK_UNIT_POINTS);
- h = gtk_paper_size_get_height (paper_size, GTK_UNIT_POINTS);
+ w = gtk_page_setup_get_paper_width (page_setup, GTK_UNIT_POINTS);
+ h = gtk_page_setup_get_paper_height (page_setup, GTK_UNIT_POINTS);
*dpi_x = *dpi_y = 72;
surface = cairo_pdf_surface_create_for_stream (write_preview, GINT_TO_POINTER (fd), w, h);
@@ -822,9 +822,8 @@ _gtk_print_operation_platform_backend_re
GtkPaperSize *paper_size;
gdouble w, h;
- paper_size = gtk_page_setup_get_paper_size (page_setup);
- w = gtk_paper_size_get_width (paper_size, GTK_UNIT_POINTS);
- h = gtk_paper_size_get_height (paper_size, GTK_UNIT_POINTS);
+ w = gtk_page_setup_get_paper_width (page_setup, GTK_UNIT_POINTS);
+ h = gtk_page_setup_get_paper_height (page_setup, GTK_UNIT_POINTS);
cairo_pdf_surface_set_size (surface, w, h);
}
--- gtk+-2.18.3/modules/printbackends/file/gtkprintbackendfile.c 2009-10-09 07:00:45.000000000 +0200
+++ gtk+-2.18.3/modules/printbackends/file/gtkprintbackendfile.c 2009-11-05 12:02:32.000000000 +0100
@@ -698,6 +698,7 @@ file_printer_prepare_for_print (GtkPrint
GtkPageSetup *page_setup)
{
gdouble scale;
+ OutputFormat format;
print_job->print_pages = gtk_print_settings_get_print_pages (settings);
print_job->page_ranges = NULL;
@@ -719,7 +720,18 @@ file_printer_prepare_for_print (GtkPrint
print_job->scale = scale/100.0;
print_job->page_set = gtk_print_settings_get_page_set (settings);
- print_job->rotate_to_orientation = TRUE;
+
+ format = format_from_settings (settings);
+ switch (format)
+ {
+ case FORMAT_PDF:
+ print_job->rotate_to_orientation = FALSE;
+ break;
+ case FORMAT_PS:
+ case FORMAT_SVG:
+ print_job->rotate_to_orientation = TRUE;
+ break;
+ }
}
static GList *
Index: gtk2.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gtk2/F-12/gtk2.spec,v
retrieving revision 1.432
retrieving revision 1.433
diff -u -p -r1.432 -r1.433
--- gtk2.spec 2 Nov 2009 12:12:10 -0000 1.432
+++ gtk2.spec 5 Nov 2009 12:47:45 -0000 1.433
@@ -17,7 +17,7 @@
Summary: The GIMP ToolKit (GTK+), a library for creating GUIs for X
Name: gtk2
Version: %{base_version}
-Release: 19%{?dist}
+Release: 20%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
Source: http://download.gnome.org/sources/gtk+/2.18/gtk+-%{version}.tar.bz2
@@ -51,6 +51,7 @@ Patch11: gtk2-remove-connecting-reason.p
# https://bugzilla.gnome.org/show_bug.cgi?id=592582
Patch12: gtk2-preview.patch
Patch13: gtk2-rotate-layout.patch
+Patch14: gtk2-landscape-pdf-print.patch
BuildRequires: atk-devel >= %{atk_version}
BuildRequires: pango-devel >= %{pango_version}
@@ -175,6 +176,7 @@ This package contains developer document
%patch11 -p1 -b .remove-connecting-reason
%patch12 -p1 -b .preview
%patch13 -p1 -b .rotate-layout
+%patch14 -p1 -b .landscape-pdf-print
%build
libtoolize --force --copy
@@ -411,6 +413,10 @@ fi
%changelog
+* Thu Nov 5 2009 Marek Kasik <mkasik at redhat.com> - 2.18.3-20
+- Do not rotate page when printing to landscape PDF, just
+- set correct width and height
+
* Mon Nov 2 2009 Marek Kasik <mkasik at redhat.com> - 2.18.3-19
- Correct rotation of number-up layout when printing landscape
- Previous message: rpms/kdenetwork/F-12 kdenetwork.spec,1.204,1.205
- Next message: rpms/asterisk/F-10 .cvsignore, 1.21, 1.22 asterisk.spec, 1.46, 1.47 sources, 1.21, 1.22 asterisk-strip.sh, 1.5, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the scm-commits
mailing list