[f-spot] Move panning code into its own new region.



commit 1d7b223cffe844067192f9a4e4506be4a1486ed8
Author: Wojciech Dzierżanowski <wojciech dzierzanowski gmail com>
Date:   Thu Sep 17 20:12:09 2009 +0200

    Move panning code into its own new region.

 src/Widgets/ImageView.cs |  121 +++++++++++++++++++++++-----------------------
 1 files changed, 61 insertions(+), 60 deletions(-)
---
diff --git a/src/Widgets/ImageView.cs b/src/Widgets/ImageView.cs
index 60057d8..6b2a3ca 100644
--- a/src/Widgets/ImageView.cs
+++ b/src/Widgets/ImageView.cs
@@ -1016,66 +1016,6 @@ namespace FSpot.Widgets
 		}
 
 
-		bool panning = false;
-		Point pan_anchor = new Point (0, 0);
-
-		bool OnPanButtonPressEvent (EventButton evnt)
-		{
-			if (2 != evnt.Button) {
-				return false;
-			}
-
-			System.Diagnostics.Debug.Assert (!panning);
-			panning = true;
-
-			pan_anchor.X = (int) evnt.X;
-			pan_anchor.Y = (int) evnt.Y;
-
-			PanSetPointer ();
-
-			return true;
-		}
-
-		bool OnPanMotionNotifyEvent (EventMotion evnt)
-		{
-			if (!panning) {
-				return false;
-			}
-
-			int pan_x = pan_anchor.X - (int) evnt.X;
-			int pan_y = pan_anchor.Y - (int) evnt.Y;
-			ScrollBy (pan_x, pan_y);
-
-			pan_anchor.X = (int) evnt.X;
-			pan_anchor.Y = (int) evnt.Y;
-
-			PanSetPointer ();
-
-			return true;
-		}
-
-		bool OnPanButtonReleaseEvent (EventButton evnt)
-		{
-			if (2 != evnt.Button) {
-				return false;
-			}
-
-			System.Diagnostics.Debug.Assert (panning);
-			panning = false;
-
-			PanSetPointer ();
-
-			return true;
-		}
-
-		void PanSetPointer ()
-		{
-			GdkWindow.Cursor = panning
-					? new Cursor (CursorType.Fleur)
-					: null;
-		}
-
-
 		const int SELECTION_THRESHOLD = 5;
 		bool OnSelectionMotionNotifyEvent (EventMotion evnt)
 		{
@@ -1161,5 +1101,66 @@ namespace FSpot.Widgets
 					      width, height);
 		}
 #endregion
+
+#region panning
+		bool panning = false;
+		Point pan_anchor = new Point (0, 0);
+
+		bool OnPanButtonPressEvent (EventButton evnt)
+		{
+			if (2 != evnt.Button) {
+				return false;
+			}
+
+			System.Diagnostics.Debug.Assert (!panning);
+			panning = true;
+
+			pan_anchor.X = (int) evnt.X;
+			pan_anchor.Y = (int) evnt.Y;
+
+			PanSetPointer ();
+
+			return true;
+		}
+
+		bool OnPanMotionNotifyEvent (EventMotion evnt)
+		{
+			if (!panning) {
+				return false;
+			}
+
+			int pan_x = pan_anchor.X - (int) evnt.X;
+			int pan_y = pan_anchor.Y - (int) evnt.Y;
+			ScrollBy (pan_x, pan_y);
+
+			pan_anchor.X = (int) evnt.X;
+			pan_anchor.Y = (int) evnt.Y;
+
+			PanSetPointer ();
+
+			return true;
+		}
+
+		bool OnPanButtonReleaseEvent (EventButton evnt)
+		{
+			if (2 != evnt.Button) {
+				return false;
+			}
+
+			System.Diagnostics.Debug.Assert (panning);
+			panning = false;
+
+			PanSetPointer ();
+
+			return true;
+		}
+
+		void PanSetPointer ()
+		{
+			GdkWindow.Cursor = panning
+					? new Cursor (CursorType.Fleur)
+					: null;
+		}
+#endregion
 	}
 }



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