[f-spot] Fix ZoomFit



commit fc7345a69d381764534d92aef600d74a52e3561b
Author: Stephane Delcroix <stephane delcroix org>
Date:   Mon Jul 6 15:28:08 2009 +0200

    Fix ZoomFit

 src/Widgets/ImageView.cs |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/Widgets/ImageView.cs b/src/Widgets/ImageView.cs
index afbbc03..126227b 100644
--- a/src/Widgets/ImageView.cs
+++ b/src/Widgets/ImageView.cs
@@ -209,11 +209,19 @@ namespace FSpot.Widgets
 
 		public void ZoomFit (bool upscale)
 		{
-			if (this.upscale != upscale)
-				min_zoom = ComputeMinZoom (upscale);
+			Gtk.ScrolledWindow scrolled = Parent as Gtk.ScrolledWindow;
+			if (scrolled != null)
+				scrolled.SetPolicy (Gtk.PolicyType.Never, Gtk.PolicyType.Never);
+			
+			min_zoom = ComputeMinZoom (upscale);
+			
 			this.upscale = upscale;
+
 			fit = true;
 			DoZoom (MIN_ZOOM, false, 0, 0);
+
+			if (scrolled != null)
+				GLib.Idle.Add (delegate {scrolled.SetPolicy (Gtk.PolicyType.Automatic, Gtk.PolicyType.Automatic); return false;});
 		}
 
 		public Point WindowCoordsToImage (Point win)
@@ -437,6 +445,9 @@ namespace FSpot.Widgets
 				ScrollTo (XOffset, (int)(Vadjustment.Upper - Vadjustment.PageSize), false);
 
 			base.OnSizeAllocated (allocation);
+
+			if (fit)
+				ZoomFit (upscale);
 		}
 
 		protected override bool OnExposeEvent (Gdk.EventExpose evnt)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]