From ad7d1ad4ca4c9ab9460f59acc6e5cc2606970f45 Mon Sep 17 00:00:00 2001 From: Gonzalo Odiard Date: Wed, 02 May 2012 12:59:24 +0000 Subject: Add a button to zoom to width Our users use the screen more than paper, zoom to width should be the more useful zoom value. Use the same icon a position as in Read. Signed-off-by: Gonzalo Odiard --- (limited to 'toolbar.py') diff --git a/toolbar.py b/toolbar.py index 4af47ff..49c15be 100644 --- a/toolbar.py +++ b/toolbar.py @@ -299,6 +299,12 @@ class ViewToolbar(gtk.Toolbar): self.insert(self._zoom_in, -1) self._zoom_in.show() + self._zoom_to_width = ToolButton('zoom-best-fit') + self._zoom_to_width.set_tooltip(_('Zoom to width')) + self._zoom_to_width.connect('clicked', self._zoom_to_width_cb) + self.insert(self._zoom_to_width, -1) + self._zoom_to_width.show() + # TODO: fix the initial value self._zoom_spin_adj = gtk.Adjustment(0, 25, 400, 25, 50, 0) self._zoom_spin = gtk.SpinButton(self._zoom_spin_adj, 0, 0) @@ -375,6 +381,10 @@ class ViewToolbar(gtk.Toolbar): if self._zoom_percentage <= 375: self.set_zoom_percentage(self._zoom_percentage + 25) + def _zoom_to_width_cb(self, button): + self._abiword_canvas.zoom_width() + self._zoom_percentage = self._abiword_canvas.get_zoom_percentage() + def _zoom_spin_cb(self, button): self._zoom_percentage = self._zoom_spin.get_value_as_int() self._abiword_canvas.set_zoom_percentage(self._zoom_percentage) -- cgit v0.9.1