[Xfce4-commits] <ristretto:master> If the image is smaller then the window-size and beyond the window-size (maximum for small images), set auto_scale to TRUE.
Stephan Arts
noreply at xfce.org
Mon Aug 22 23:30:02 CEST 2011
Updating branch refs/heads/master
to ef002949d3e0a393c8d2ed2c43b28616baa0fb59 (commit)
from cd04169b6b8ccc09fbcc77d27af92733ba637e72 (commit)
commit ef002949d3e0a393c8d2ed2c43b28616baa0fb59
Author: Stephan Arts <stephan at xfce.org>
Date: Mon Aug 22 19:07:15 2011 +0200
If the image is smaller then the window-size and beyond the window-size (maximum for small images), set auto_scale to TRUE.
src/image_viewer.c | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/src/image_viewer.c b/src/image_viewer.c
index 5bf45e5..a8374f8 100644
--- a/src/image_viewer.c
+++ b/src/image_viewer.c
@@ -989,6 +989,7 @@ rstto_image_viewer_set_scale (RsttoImageViewer *viewer, gdouble scale)
gint pixbuf_height = 0;
gint pixbuf_x_offset = 0;
gint pixbuf_y_offset = 0;
+ gboolean auto_scale = FALSE;
if (scale == 0)
{
@@ -1023,15 +1024,23 @@ rstto_image_viewer_set_scale (RsttoImageViewer *viewer, gdouble scale)
{
if(h_scale < v_scale)
{
+ /* If the image is scaled beyond the window-size,
+ * force the scale to fit the window and set auto_scale = TRUE.
+ */
if (scale > h_scale)
{
+ auto_scale = TRUE;
scale = h_scale;
}
}
else
{
+ /* If the image is scaled beyond the window-size,
+ * force the scale to fit the window and set auto_scale = TRUE.
+ */
if (scale > v_scale)
{
+ auto_scale = TRUE;
scale = v_scale;
}
}
@@ -1072,7 +1081,7 @@ rstto_image_viewer_set_scale (RsttoImageViewer *viewer, gdouble scale)
}
}
- viewer->priv->auto_scale = FALSE;
+ viewer->priv->auto_scale = auto_scale;
if (viewer->priv->dst_pixbuf)
{
@@ -1722,6 +1731,7 @@ cb_rstto_image_viewer_scroll_event (RsttoImageViewer *viewer, GdkEventScroll *ev
gint pixbuf_height = 0;
gint pixbuf_x_offset = 0;
gint pixbuf_y_offset = 0;
+ gboolean auto_scale = FALSE;
GtkWidget *widget = GTK_WIDGET(viewer);
@@ -1780,15 +1790,23 @@ cb_rstto_image_viewer_scroll_event (RsttoImageViewer *viewer, GdkEventScroll *ev
{
if(h_scale < v_scale)
{
+ /* If the image is scaled beyond the window-size,
+ * force the scale to fit the window and set auto_scale = TRUE.
+ */
if (scale > h_scale)
{
+ auto_scale = TRUE;
scale = h_scale;
}
}
else
{
+ /* If the image is scaled beyond the window-size,
+ * force the scale to fit the window and set auto_scale = TRUE.
+ */
if (scale > v_scale)
{
+ auto_scale = TRUE;
scale = v_scale;
}
}
@@ -1830,7 +1848,9 @@ cb_rstto_image_viewer_scroll_event (RsttoImageViewer *viewer, GdkEventScroll *ev
}
}
+ viewer->priv->auto_scale = auto_scale;
viewer->priv->scale = scale;
+
g_object_freeze_notify(G_OBJECT(viewer->hadjustment));
g_object_freeze_notify(G_OBJECT(viewer->vadjustment));
More information about the Xfce4-commits
mailing list