Fix zooming problem in print preview.

svn: r9044
This commit is contained in:
Zsolt Foldvari 2007-09-30 18:52:57 +00:00
parent 7f3d94ae44
commit 291ea85269
2 changed files with 12 additions and 12 deletions

View File

@ -1,3 +1,6 @@
2007-09-30 Zsolt Foldvari <zfoldvar@users.sourceforge.net>
* src/docgen/GtkPrint.py (on_draw_page): Fix zooming problem in preview.
2007-09-29 Brian Matherly <brian@gramps-project.org> 2007-09-29 Brian Matherly <brian@gramps-project.org>
* src/plugins/GVHourGlass.py: Added. * src/plugins/GVHourGlass.py: Added.
* src/ReportBase/_GraphvizReportDialog: Added * src/ReportBase/_GraphvizReportDialog: Added

View File

@ -31,6 +31,7 @@ __author__ = "Zsolt Foldvari"
# Python modules # Python modules
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
from gettext import gettext as _
from math import radians from math import radians
import os import os
##try: ##try:
@ -549,22 +550,22 @@ class GtkPrint(CairoDoc):
def on_begin_print(self, operation, context): def on_begin_print(self, operation, context):
"""Setup environment for printing. """Setup environment for printing.
""" """
# get data from print context # get data from context here only once to save time on pagination
self.page_width = round(context.get_width()) self.page_width = round(context.get_width())
self.page_height = round(context.get_height()) self.page_height = round(context.get_height())
self.dpi_x = context.get_dpi_x()
self.dpi_y = context.get_dpi_y()
def on_paginate(self, operation, context): def on_paginate(self, operation, context):
"""Paginate the whole document in chunks. """Paginate the whole document in chunks.
""" """
layout = context.create_pango_layout() layout = context.create_pango_layout()
dpi_x = context.get_dpi_x()
dpi_y = context.get_dpi_y()
finished = self.paginate(layout, finished = self.paginate(layout,
self.page_width, self.page_width,
self.page_height, self.page_height,
dpi_x, self.dpi_x,
dpi_y) self.dpi_y)
# update page number # update page number
operation.set_n_pages(len(self._pages)) operation.set_n_pages(len(self._pages))
@ -579,16 +580,12 @@ class GtkPrint(CairoDoc):
""" """
cr = context.get_cairo_context() cr = context.get_cairo_context()
layout = context.create_pango_layout() layout = context.create_pango_layout()
width = round(context.get_width())
height = round(context.get_height())
dpi_x = context.get_dpi_x() dpi_x = context.get_dpi_x()
dpi_y = context.get_dpi_y() dpi_y = context.get_dpi_y()
self.draw_page(page_nr, self.draw_page(page_nr, cr, layout, width, height, dpi_x, dpi_y)
cr,
layout,
self.page_width,
self.page_height,
dpi_x,
dpi_y)
def on_preview(self, operation, preview, context, parent): def on_preview(self, operation, preview, context, parent):
"""Implement custom print preview functionality. """Implement custom print preview functionality.