[Monodevelop-patches-list] r1731 - trunk/MonoDevelop/src/Libraries/Gdl

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Thu Jun 10 00:48:59 EDT 2004


Author: tberman
Date: 2004-06-10 00:48:59 -0400 (Thu, 10 Jun 2004)
New Revision: 1731

Modified:
   trunk/MonoDevelop/src/Libraries/Gdl/DockItem.cs
   trunk/MonoDevelop/src/Libraries/Gdl/DockMaster.cs
   trunk/MonoDevelop/src/Libraries/Gdl/DockObject.cs
   trunk/MonoDevelop/src/Libraries/Gdl/DockPaned.cs
Log:
checking in some stuff so jeroen can looksee


Modified: trunk/MonoDevelop/src/Libraries/Gdl/DockItem.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/DockItem.cs	2004-06-10 03:10:43 UTC (rev 1730)
+++ trunk/MonoDevelop/src/Libraries/Gdl/DockItem.cs	2004-06-10 04:48:59 UTC (rev 1731)
@@ -4,6 +4,11 @@
 
 namespace Gdl
 {
+
+	public delegate void DockItemMotionHandler (DockItem o, int x, int y);
+	public delegate void DockItemDragBeginHandler (DockItem o);
+	public delegate void DockItemDragEndHandler (DockItem o, bool cancel);
+	
 	public class DockItem : DockObject
 	{		
 		private Widget child = null;
@@ -202,7 +207,7 @@
 				return;
 			}
 			if (InDrag) {
-				DockDragEnd ();
+				DockDragEnd (true);
 			}
 			
 			if (widget != Child)
@@ -420,7 +425,7 @@
 				}
 			} else if (evnt.Type == Gdk.EventType.ButtonRelease && evnt.Button == 1) {
 				if (InDrag) {
-					DockDragEnd ();
+					DockDragEnd (false);
 					event_handled = true;
 				} else if (InPreDrag) {
 					DockObjectFlags &= ~(DockObjectFlags.InPreDrag);
@@ -462,15 +467,23 @@
 			int new_x = (int)evnt.XRoot;
 			int new_y = (int)evnt.YRoot;
 			
-			//PORT THIS:
-			//    g_signal_emit (item, gdl_dock_item_signals [DOCK_DRAG_MOTION], 0, new_x, new_y);
+			
+			OnMotion (new_x, new_y);
 			return true;
 		}
 		
+		public event DockItemMotionHandler DockItemMotion;
+				
+		protected void OnMotion (int x, int y)
+		{
+			if (DockItemMotion != null)
+				DockItemMotion (this, x, y);
+		}
+		
 		protected override bool OnKeyPressEvent (Gdk.EventKey evnt)
 		{
 			if (InDrag && evnt.Key == Gdk.Key.Escape) {
-				DockDragEnd ();
+				DockDragEnd (false);
 				return true;
 			}
 			return base.OnKeyPressEvent (evnt);
@@ -599,7 +612,6 @@
 				newParent.Add (requestor);
 				newParent.Add (this);
 			}
-			Console.WriteLine ("Done Adding");
 			
 			if (parent != null)
 				parent.Add (newParent);
@@ -656,20 +668,34 @@
 			
 			Grab.Add (this);
 			
-			//PORT THIS:
-			//g_signal_emit (item, gdl_dock_item_signals [DOCK_DRAG_BEGIN], 0);
+			OnDragBegin ();
 		}
 		
-		public void DockDragEnd ()
+		public event DockItemDragBeginHandler DockItemDragBegin;
+		
+		protected void OnDragBegin ()
 		{
+			if (DockItemDragBegin != null)
+				DockItemDragBegin (this);
+		}
+		
+		public void DockDragEnd (bool cancel)
+		{
 			Grab.Remove (Grab.Current);
 			
-			//PORT THIS:
-			//g_signal_emit (item, gdl_dock_item_signals [DOCK_DRAG_END], 0);
+			OnDragEnd (cancel);
 			
 			DockObjectFlags &= ~(DockObjectFlags.InDrag);
 		}
 		
+		public event DockItemDragEndHandler DockItemDragEnd;
+		
+		protected void OnDragEnd (bool cancel)
+		{
+			if (DockItemDragEnd != null)
+				DockItemDragEnd (this, cancel);
+		}
+		
 		private void ShowHideGrip ()
 		{
 			if (grip != null) {

Modified: trunk/MonoDevelop/src/Libraries/Gdl/DockMaster.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/DockMaster.cs	2004-06-10 03:10:43 UTC (rev 1730)
+++ trunk/MonoDevelop/src/Libraries/Gdl/DockMaster.cs	2004-06-10 04:48:59 UTC (rev 1731)
@@ -23,6 +23,8 @@
 		private Hashtable locked_items = new Hashtable ();
 		private Hashtable unlocked_items = new Hashtable ();
 		
+		public DockMaster () { Console.WriteLine ("Creating a new DockMaster"); }
+		
 		public string DefaultTitle {
 			get { return default_title; }
 			set { default_title = value; }
@@ -236,13 +238,12 @@
                           G_CALLBACK (item_dock_cb), master);
 				*/
 			} else if (objekt is DockItem) {
+				Console.WriteLine ("HOOKING UP EVENTS");
+				DockItem dock_item = objekt as DockItem;
+				dock_item.DockItemDragBegin += new DockItemDragBeginHandler (DragBegin);
+				dock_item.DockItemMotion += new DockItemMotionHandler (DragMotion);
+				dock_item.DockItemDragEnd += new DockItemDragEndHandler (DragEnd);
 				/* PORT THIS:
-				        g_signal_connect (object, "dock_drag_begin",
-                          G_CALLBACK (gdl_dock_master_drag_begin), master);
-        g_signal_connect (object, "dock_drag_motion",
-                          G_CALLBACK (gdl_dock_master_drag_motion), master);
-        g_signal_connect (object, "dock_drag_end",
-                          G_CALLBACK (gdl_dock_master_drag_end), master);
         g_signal_connect (object, "dock",
                           G_CALLBACK (item_dock_cb), master);
         g_signal_connect (object, "detach",
@@ -305,6 +306,13 @@
 				}
 			}
 			
+			if (objekt is DockItem) {
+				DockItem dock_item = objekt as DockItem;
+				dock_item.DockItemDragBegin -= DragBegin;
+				dock_item.DockItemDragEnd -= DragEnd;
+				dock_item.DockItemMotion -= DragMotion;
+			}
+			
 			/*PORT THIS:
     g_signal_handlers_disconnect_matched (object, G_SIGNAL_MATCH_DATA, 
                                           0, 0, NULL, NULL, master);*/

Modified: trunk/MonoDevelop/src/Libraries/Gdl/DockObject.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/DockObject.cs	2004-06-10 03:10:43 UTC (rev 1730)
+++ trunk/MonoDevelop/src/Libraries/Gdl/DockObject.cs	2004-06-10 04:48:59 UTC (rev 1731)
@@ -217,10 +217,15 @@
 		
 		public void Bind (DockMaster _master)
 		{
-			if (_master == null)
+			Console.WriteLine ("About to attempt a bind");
+			if (_master == null) {
+				Console.WriteLine ("passed master is null");
 				return;
-			if (master == _master)
+			}
+			if (master == _master) {
+				Console.WriteLine ("passed master is this master");
 				return;
+			}
 			if (master != null) {
 				Console.WriteLine ("Attempt to bind an already bound object");
 				return;

Modified: trunk/MonoDevelop/src/Libraries/Gdl/DockPaned.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/DockPaned.cs	2004-06-10 03:10:43 UTC (rev 1730)
+++ trunk/MonoDevelop/src/Libraries/Gdl/DockPaned.cs	2004-06-10 04:48:59 UTC (rev 1731)
@@ -38,7 +38,6 @@
 		
 		private void CreateChild (Orientation orientation)
 		{
-			Console.WriteLine ("DockPaned.CreateChild");
 			if (Child != null)
 				Child.Unparent ();
 				
@@ -92,8 +91,6 @@
 		
 		public override void Docking (DockObject requestor, DockPlacement position, object other_data)
 		{
-			Console.WriteLine ("DockPaned.Docking");
-		
 			if (Child == null)
 				return;
 			Paned paned = (Paned)Child;
@@ -126,7 +123,6 @@
 				}
 				break;
 			}
-			Console.WriteLine ("DONE: {0}", done);
 			if (!done) {
 				base.Docking (requestor, position, other_data);
 			} else {




More information about the Monodevelop-patches-list mailing list