[Monodevelop-patches-list] r2408 - trunk/MonoDevelop/Core/src/MonoDevelop.Dock

John Luke <jluke@cfl.rr.com> jluke at mono-cvs.ximian.com
Thu Mar 31 17:19:04 EST 2005


Author: jluke
Date: 2005-03-31 17:19:04 -0500 (Thu, 31 Mar 2005)
New Revision: 2408

Modified:
   trunk/MonoDevelop/Core/src/MonoDevelop.Dock/ChangeLog
   trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockPaned.cs
Log:
emit less layoutchanged events for paned


Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Dock/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Dock/ChangeLog	2005-03-31 17:22:50 UTC (rev 2407)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Dock/ChangeLog	2005-03-31 22:19:04 UTC (rev 2408)
@@ -1,5 +1,10 @@
 2005-03-31  John Luke  <john.luke at gmail.com>
 
+	* DockPaned.cs: only emit layout_changed when
+	the position has changed and on button release
+
+2005-03-31  John Luke  <john.luke at gmail.com>
+
 	* *.cs: add license headers
 	* TODO: update
 

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockPaned.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockPaned.cs	2005-03-31 17:22:50 UTC (rev 2407)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockPaned.cs	2005-03-31 22:19:04 UTC (rev 2408)
@@ -31,6 +31,7 @@
 	public class DockPaned : DockItem
 	{
 		private const float SplitRatio = 0.3f;
+		bool positionChanged = false;
 
 		protected DockPaned (IntPtr raw) : base (raw) { }
 
@@ -82,7 +83,8 @@
 			else
 				Child = new VPaned ();
 			
-			Child.AddNotification ("Position", new GLib.NotifyHandler (OnNotifyPosition));
+			Child.AddNotification ("position", new GLib.NotifyHandler (OnNotifyPosition));
+			Child.ButtonReleaseEvent += OnButtonReleased;
 												
 			Child.Parent = this;
 			Child.Show ();
@@ -141,6 +143,7 @@
 
 			// after that we can remove the Paned child
 			if (Child != null) {
+				Child.ButtonReleaseEvent -= OnButtonReleased;
 				Child.Unparent ();
 				Child = null;
 			}
@@ -308,9 +311,18 @@
 
 		void OnNotifyPosition (object sender, GLib.NotifyArgs a)
 		{
-			Master.EmitLayoutChangedEvent ();
+			positionChanged = true;
 		}
 
+		[GLib.ConnectBefore]
+		void OnButtonReleased (object sender, ButtonReleaseEventArgs a)
+		{
+			if (a.Event.Button == 1 && positionChanged) {
+				Master.EmitLayoutChangedEvent ();
+				positionChanged = false;
+			}
+		}
+
 		void OnPropertyChanged (object sender, string name)
 		{
 			if (name == "orientation") {




More information about the Monodevelop-patches-list mailing list