[f-spot] use a Gdk.Rectangle for selection in editors too



commit a21399cf264e0ce44a1a2afb197da2645004993a
Author: Stephane Delcroix <stephane delcroix org>
Date:   Tue Jun 16 09:56:46 2009 +0200

    use a Gdk.Rectangle for selection in editors too

 src/Editors/CropEditor.cs   |    6 +++---
 src/Editors/Editor.cs       |    8 +-------
 src/Editors/RedEyeEditor.cs |    4 ++--
 src/Widgets/EditorPage.cs   |   13 +++----------
 4 files changed, 9 insertions(+), 22 deletions(-)
---
diff --git a/src/Editors/CropEditor.cs b/src/Editors/CropEditor.cs
index ac5fb02..ac6283c 100644
--- a/src/Editors/CropEditor.cs
+++ b/src/Editors/CropEditor.cs
@@ -172,10 +172,10 @@ namespace FSpot.Editors {
 		protected override Pixbuf Process (Pixbuf input, Cms.Profile input_profile) {
 			Pixbuf edited = new Pixbuf (input.Colorspace,
 						 input.HasAlpha, input.BitsPerSample,
-						 State.Selection.width, State.Selection.height);
+						 State.Selection.Width, State.Selection.Height);
 
-			input.CopyArea (State.Selection.x, State.Selection.y,
-					State.Selection.width, State.Selection.height, edited, 0, 0);
+			input.CopyArea (State.Selection.X, State.Selection.Y,
+					State.Selection.Width, State.Selection.Height, edited, 0, 0);
 			return edited;
 		}
 	}
diff --git a/src/Editors/Editor.cs b/src/Editors/Editor.cs
index 5e96edd..f2d3d65 100644
--- a/src/Editors/Editor.cs
+++ b/src/Editors/Editor.cs
@@ -30,15 +30,9 @@ namespace FSpot.Editors {
 		}
 	}
 
-	[Obsolete ("use a Gdk.Rectangle")]
-	public class EditorSelection {
-		public int x, y;
-		public int width, height;
-	}
-
 	public class EditorState {
 		// The area selected by the user.
-		public EditorSelection Selection;
+		public Rectangle Selection;
 
 		// The images selected by the user.
 		public IBrowsableItem [] Items;
diff --git a/src/Editors/RedEyeEditor.cs b/src/Editors/RedEyeEditor.cs
index 318c49d..4fd9749 100644
--- a/src/Editors/RedEyeEditor.cs
+++ b/src/Editors/RedEyeEditor.cs
@@ -26,8 +26,8 @@ namespace FSpot.Editors {
 		}
 
 		protected override Pixbuf Process (Pixbuf input, Cms.Profile input_profile) {
-			Gdk.Rectangle area = new Gdk.Rectangle (State.Selection.x, State.Selection.y,
-					State.Selection.width, State.Selection.height);
+			Gdk.Rectangle area = new Gdk.Rectangle (State.Selection.X, State.Selection.Y,
+					State.Selection.Width, State.Selection.Height);
 			int threshold = Preferences.Get<int> (Preferences.EDIT_REDEYE_THRESHOLD);
 			return PixbufUtils.RemoveRedeye (input, area, threshold);
 		}
diff --git a/src/Widgets/EditorPage.cs b/src/Widgets/EditorPage.cs
index a732a3c..96e0c04 100644
--- a/src/Widgets/EditorPage.cs
+++ b/src/Widgets/EditorPage.cs
@@ -171,21 +171,14 @@ namespace FSpot.Widgets {
 		private bool SetupEditor (Editor editor) {
 			EditorState state = editor.CreateState ();
 
-			EditorSelection selection = new EditorSelection ();
+			Gdk.Rectangle selection = Gdk.Rectangle.Zero;;
 			PhotoImageView photo_view = MainWindow.Toplevel.PhotoView.View;
 
 			if (Page.InPhotoView && photo_view != null) {
-				if (photo_view.Selection != Gdk.Rectangle.Zero) {
-					selection.x = photo_view.Selection.X;
-					selection.y = photo_view.Selection.Y;
-					selection.width = photo_view.Selection.Width;
-					selection.height = photo_view.Selection.Height;
-					state.Selection = selection;
-				} else
-					state.Selection = null;
+				state.Selection = selection = photo_view.Selection;
 				state.PhotoImageView = photo_view;
 			} else {
-				state.Selection = null;
+				state.Selection = Gdk.Rectangle.Zero;
 				state.PhotoImageView = null;
 			}
 			if (Page.Sidebar.Selection == null)



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