[f-spot] Stop zooming to fit whenever a new pixbuf is pushed in.
- From: Ruben Vermeersch <rubenv src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [f-spot] Stop zooming to fit whenever a new pixbuf is pushed in.
- Date: Wed, 12 Aug 2009 12:59:56 +0000 (UTC)
commit 98d84032913a0800e9d0d31712b94499c168167e
Author: Ruben Vermeersch <ruben savanne be>
Date: Thu Jul 23 19:38:02 2009 +0200
Stop zooming to fit whenever a new pixbuf is pushed in.
This is now a parameter to ChangeImage. We don't want to zoom to fit
when a higher resolution version is loaded.
src/Editors/Editor.cs | 6 ++----
src/ImportCommand.cs | 3 +--
src/PhotoImageView.cs | 16 +++++-----------
src/Widgets/ImageView.cs | 7 +++++--
4 files changed, 13 insertions(+), 19 deletions(-)
---
diff --git a/src/Editors/Editor.cs b/src/Editors/Editor.cs
index 043d2ce..b14e01e 100644
--- a/src/Editors/Editor.cs
+++ b/src/Editors/Editor.cs
@@ -203,8 +203,7 @@ namespace FSpot.Editors {
}
Pixbuf previewed = ProcessFast (preview, null);
- State.PhotoImageView.ChangeImage (previewed, State.PhotoImageView.PixbufOrientation, false);
- State.PhotoImageView.ZoomFit (false);
+ State.PhotoImageView.ChangeImage (previewed, State.PhotoImageView.PixbufOrientation, false, false);
MainWindow.Toplevel.InfoBox.UpdateHistogram (previewed);
if (old_preview != null) {
@@ -235,8 +234,7 @@ namespace FSpot.Editors {
public void Restore () {
if (original != null && State.PhotoImageView != null) {
- State.PhotoImageView.ChangeImage (original, state.PhotoImageView.PixbufOrientation, false);
- State.PhotoImageView.ZoomFit (false);
+ State.PhotoImageView.ChangeImage (original, state.PhotoImageView.PixbufOrientation, false, false);
MainWindow.Toplevel.InfoBox.UpdateHistogram (null);
}
diff --git a/src/ImportCommand.cs b/src/ImportCommand.cs
index 67be5a6..74b747e 100644
--- a/src/ImportCommand.cs
+++ b/src/ImportCommand.cs
@@ -638,8 +638,7 @@ public class ImportCommand : GladeDialog
GtkUtil.ModifyColors (photo_scrolled);
GtkUtil.ModifyColors (photo_view);
- photo_view.ChangeImage (GtkUtil.TryLoadIcon (FSpot.Global.IconTheme, "f-spot", 128, (Gtk.IconLookupFlags)0), PixbufOrientation.TopLeft, true);
- photo_view.ZoomFit (false);
+ photo_view.ChangeImage (GtkUtil.TryLoadIcon (FSpot.Global.IconTheme, "f-spot", 128, (Gtk.IconLookupFlags)0), PixbufOrientation.TopLeft, true, false);
tag_entry = new FSpot.Widgets.TagEntry (MainWindow.Toplevel.Database.Tags, false);
tag_entry.UpdateFromTagNames (new string []{});
diff --git a/src/PhotoImageView.cs b/src/PhotoImageView.cs
index 527d53d..75d5174 100644
--- a/src/PhotoImageView.cs
+++ b/src/PhotoImageView.cs
@@ -222,11 +222,9 @@ namespace FSpot.Widgets {
Gdk.Pixbuf prev = Pixbuf;
PixbufOrientation orientation = Accelerometer.GetViewOrientation (loader.PixbufOrientation);
- ChangeImage (loader.Pixbuf, orientation, prepared_is_new);
+ ChangeImage (loader.Pixbuf, orientation, prepared_is_new, args.ReducedResolution);
prepared_is_new = false;
- this.ZoomFit (args.ReducedResolution);
-
if (prev != null)
prev.Dispose ();
}
@@ -253,7 +251,7 @@ namespace FSpot.Widgets {
Pixbuf prev = this.Pixbuf;
if (Pixbuf != loader.Pixbuf)
- ChangeImage (loader.Pixbuf, Accelerometer.GetViewOrientation (loader.PixbufOrientation), false);
+ ChangeImage (loader.Pixbuf, Accelerometer.GetViewOrientation (loader.PixbufOrientation), false, false);
if (Pixbuf == null) {
// FIXME: Do we have test cases for this ???
@@ -263,7 +261,7 @@ namespace FSpot.Widgets {
// than try to load the image one last time.
try {
Log.Warning ("Falling back to file loader");
- ChangeImage (PhotoLoader.Load (item.Collection, item.Index), PixbufOrientation.TopLeft, true);
+ ChangeImage (PhotoLoader.Load (item.Collection, item.Index), PixbufOrientation.TopLeft, true, false);
} catch (Exception e) {
LoadErrorImage (e);
}
@@ -271,8 +269,6 @@ namespace FSpot.Widgets {
if (Pixbuf == null)
LoadErrorImage (null);
- else
- ZoomFit ();
progressive_display = true;
@@ -305,14 +301,12 @@ namespace FSpot.Widgets {
Pixbuf err = new Pixbuf (PixbufUtils.ErrorPixbuf, 0, 0,
PixbufUtils.ErrorPixbuf.Width,
PixbufUtils.ErrorPixbuf.Height);
- ChangeImage (err, PixbufOrientation.TopLeft, true);
+ ChangeImage (err, PixbufOrientation.TopLeft, true, false);
if (old != null)
old.Dispose ();
-
- ZoomFit (false);
}
- void HandlePhotoItemChanged (object sender, BrowsablePointerChangedEventArgs args)
+ void HandlePhotoItemChanged (object sender, BrowsablePointerChangedEventArgs args)
{
// If it is just the position that changed fall out
if (args != null &&
diff --git a/src/Widgets/ImageView.cs b/src/Widgets/ImageView.cs
index 7879191..d8c4760 100644
--- a/src/Widgets/ImageView.cs
+++ b/src/Widgets/ImageView.cs
@@ -44,11 +44,13 @@ namespace FSpot.Widgets
// (true, in that case the scrolling can be reset), or a new version of
// the currently loaded image (false, e.g. a higher resolution
// version).
- public void ChangeImage (Pixbuf pixbuf, PixbufOrientation orientation, bool is_new)
+ public void ChangeImage (Pixbuf pixbuf, PixbufOrientation orientation, bool is_new, bool upscale)
{
if (Pixbuf == pixbuf)
return;
+ Pixbuf prev = Pixbuf;
+
Pixbuf = pixbuf;
PixbufOrientation = orientation;
@@ -60,6 +62,7 @@ namespace FSpot.Widgets
Hadjustment.Value = Vadjustment.Value = 0;
XOffset = YOffset = 0;
AdjustmentsChanged += ScrollToAdjustments;
+ ZoomFit (upscale);
} else {
// TODO: Recalculate the adjustments and offsets such that the
// view on the image is maintained.
@@ -201,7 +204,7 @@ namespace FSpot.Widgets
get { return fit; }
}
- public void ZoomFit (bool upscale)
+ void ZoomFit (bool upscale)
{
Gtk.ScrolledWindow scrolled = Parent as Gtk.ScrolledWindow;
if (scrolled != null)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]