diff --git a/ChangeLog b/ChangeLog index c4e29fa02..271a03ee1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2007-09-01 Zsolt Foldvari + * src/images/16x16/gramps-zoom-fit-width.png: + * src/images/16x16/Makefile.am: + * src/images/22x22/gramps-zoom-fit-width.png; + * src/images/22x22/Makefile.am: + * src/images/48x48/gramps-zoom-fit-width.png: + * src/images/48x48/Makefile.am: + * src/images/scalable/gramps-zoom-fit-width.svg: + * src/images/scalable/Makefile.am: + * src/gramps_main.py: + 'Zoom to fit width' stock icon added. (Please draw a better one!!!) + * src/docgen/gtkprintpreview.glade: + * src/docgen/GtkPrint.py: + Print preview is 99.999% complete. + 2007-08-31 Benny Malengier * src/PlaceUtils.py: request #1199: replace unicode symbols with u codes diff --git a/src/docgen/GtkPrint.py b/src/docgen/GtkPrint.py index 09caeac60..1c90f1fa0 100644 --- a/src/docgen/GtkPrint.py +++ b/src/docgen/GtkPrint.py @@ -119,16 +119,10 @@ class PrintPreview: glade_file = os.path.join(os.path.dirname(__file__), 'gtkprintpreview.glade') - window_xml = gtk.glade.XML(glade_file, 'window2', 'gramps') - self._window = window_xml.get_widget('window2') + window_xml = gtk.glade.XML(glade_file, 'window', 'gramps') + self._window = window_xml.get_widget('window') #self._window.set_transient_for(parent) - # add the page number entry box into the toolbar - entry_xml = gtk.glade.XML(glade_file, 'entry_hbox', 'gramps') - entry_box = entry_xml.get_widget('entry_hbox') - entry_item = window_xml.get_widget('entry_item') - entry_item.add(entry_box) - # remember active widgets for future use self._swin = window_xml.get_widget('swin') self._drawing_area = window_xml.get_widget('drawingarea') @@ -136,13 +130,13 @@ class PrintPreview: self._prev_button = window_xml.get_widget('prev') self._next_button = window_xml.get_widget('next') self._last_button = window_xml.get_widget('last') + self._pages_entry = window_xml.get_widget('entry') + self._pages_label = window_xml.get_widget('label') self._zoom_fit_width_button = window_xml.get_widget('zoom_fit_width') + self._zoom_fit_width_button.set_stock_id('gramps-zoom-fit-width') self._zoom_best_fit_button = window_xml.get_widget('zoom_best_fit') self._zoom_in_button = window_xml.get_widget('zoom_in') self._zoom_out_button = window_xml.get_widget('zoom_out') - - self._pages_entry = entry_xml.get_widget('entry') - self._pages_label = entry_xml.get_widget('label') # connect the signals window_xml.signal_autoconnect({ @@ -159,9 +153,6 @@ class PrintPreview: 'on_zoom_in_clicked': self.on_zoom_in_clicked, 'on_zoom_out_clicked': self.on_zoom_out_clicked, 'on_window_delete_event': self.on_window_delete_event, - }) - - entry_xml.signal_autoconnect({ 'on_entry_activate': self.on_entry_activate, }) @@ -285,14 +276,30 @@ class PrintPreview: cr.rectangle(event.area) cr.clip() - # TODO put the paper on the middle of the window - cr.translate(MARGIN, MARGIN) + # get the extents of the page and the screen + paper_w = self._paper_width * self._zoom + paper_h = self._paper_height * self._zoom + + width, height, vsb_w, hsb_h = self.__get_view_size() + if paper_h > height: + width -= vsb_w + if paper_w > width: + height -= hsb_h + + # put the paper on the middle of the window + xtranslate = MARGIN + if paper_w < width: + xtranslate += (width - paper_w) / 2 + + ytranslate = MARGIN + if paper_h < height: + ytranslate += (height - paper_h) / 2 + + cr.translate(xtranslate, ytranslate) # draw an empty white page cr.set_source_rgb(1.0, 1.0, 1.0) - cr.rectangle(0, 0, - self._paper_width * self._zoom, - self._paper_height * self._zoom) + cr.rectangle(0, 0, paper_w, paper_h) cr.fill_preserve() cr.set_source_rgb(0, 0, 0) cr.set_line_width(1) diff --git a/src/docgen/gtkprintpreview.glade b/src/docgen/gtkprintpreview.glade index d6c6513c0..9ec0325af 100644 --- a/src/docgen/gtkprintpreview.glade +++ b/src/docgen/gtkprintpreview.glade @@ -3,77 +3,7 @@ - - True - window1 - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - True - False - - - - True - False - 6 - - - - True - True - True - 0 - - True - - False - 6 - - - - 0 - False - True - - - - - - True - of 8 - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - True - - - - - - - + Print Preview GTK_WINDOW_TOPLEVEL GTK_WIN_POS_CENTER @@ -232,11 +162,64 @@ - + True True True - True + False + + + + True + False + 6 + + + + True + True + True + 0 + + True + + False + 6 + + + + 0 + False + True + + + + + + True + of 8 + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + True + + + + False @@ -260,9 +243,9 @@ True + Zooms to fit the page width True - gtk-missing-image True True False @@ -278,6 +261,7 @@ True + Zooms to fit the whole page gtk-zoom-fit True True diff --git a/src/gramps_main.py b/src/gramps_main.py index 5528fab42..a4589feee 100644 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -124,6 +124,7 @@ def register_stock_icons (): ('gramps-tools',_('Tools'),gtk.gdk.CONTROL_MASK,0,''), ('gramps-unlock',_('Private'),gtk.gdk.CONTROL_MASK,0,''), ('gramps-viewmedia',_('View'),gtk.gdk.CONTROL_MASK,0,''), + ('gramps-zoom-fit-width',_('Fit Width'),gtk.gdk.CONTROL_MASK,0,''), ] # the following icons are not yet in new directory structure # they should be ported in the near future diff --git a/src/images/16x16/Makefile.am b/src/images/16x16/Makefile.am index 308fdb36a..18ddd1cc8 100644 --- a/src/images/16x16/Makefile.am +++ b/src/images/16x16/Makefile.am @@ -26,4 +26,5 @@ dist_pkgdata_DATA = \ gramps-repository.png \ gramps-source.png \ gramps-spouse.png \ - gramps-unlock.png + gramps-unlock.png \ + gramps-zoom-fit-width.png diff --git a/src/images/16x16/gramps-zoom-fit-width.png b/src/images/16x16/gramps-zoom-fit-width.png new file mode 100644 index 000000000..1c495cab6 Binary files /dev/null and b/src/images/16x16/gramps-zoom-fit-width.png differ diff --git a/src/images/22x22/Makefile.am b/src/images/22x22/Makefile.am index 9de7de0ac..37a2d5128 100644 --- a/src/images/22x22/Makefile.am +++ b/src/images/22x22/Makefile.am @@ -26,4 +26,5 @@ dist_pkgdata_DATA = \ gramps-repository.png \ gramps-source.png \ gramps-spouse.png \ - gramps-unlock.png \ No newline at end of file + gramps-unlock.png \ + gramps-zoom-fit-width.png diff --git a/src/images/22x22/gramps-zoom-fit-width.png b/src/images/22x22/gramps-zoom-fit-width.png new file mode 100644 index 000000000..4bed0553b Binary files /dev/null and b/src/images/22x22/gramps-zoom-fit-width.png differ diff --git a/src/images/48x48/Makefile.am b/src/images/48x48/Makefile.am index a2eddc0ef..ec619c419 100644 --- a/src/images/48x48/Makefile.am +++ b/src/images/48x48/Makefile.am @@ -34,4 +34,5 @@ dist_pkgdata_DATA = \ gramps-spouse.png \ gramps-tools.png \ gramps-unlock.png \ - gramps-viewmedia.png \ No newline at end of file + gramps-viewmedia.png \ + gramps-zoom-fit-width.png diff --git a/src/images/48x48/gramps-zoom-fit-width.png b/src/images/48x48/gramps-zoom-fit-width.png new file mode 100644 index 000000000..395162ebb Binary files /dev/null and b/src/images/48x48/gramps-zoom-fit-width.png differ diff --git a/src/images/scalable/Makefile.am b/src/images/scalable/Makefile.am index 233a59b49..4047710e3 100644 --- a/src/images/scalable/Makefile.am +++ b/src/images/scalable/Makefile.am @@ -34,4 +34,5 @@ dist_pkgdata_DATA = \ gramps-spouse.svg \ gramps-tools.svg \ gramps-unlock.svg \ - gramps-viewmedia.svg + gramps-viewmedia.svg \ + gramps-zoom-fit-width.svg diff --git a/src/images/scalable/gramps-zoom-fit-width.svg b/src/images/scalable/gramps-zoom-fit-width.svg new file mode 100644 index 000000000..d1498db57 --- /dev/null +++ b/src/images/scalable/gramps-zoom-fit-width.svg @@ -0,0 +1,252 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + +