[Monodevelop-patches-list] r2037 - in trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor: . CodeCompletion

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Wed Nov 24 02:22:06 EST 2004


Author: alp
Date: 2004-11-24 02:22:06 -0500 (Wed, 24 Nov 2004)
New Revision: 2037

Modified:
   trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
   trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionData.cs
   trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionListWindow.cs
   trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/DeclarationViewWindow.cs
Log:
  Fix wrapping of completion documentation.
  Don't reinstantiate the tooltip each time.
  Ignore bogus identical overloads.


Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog	2004-11-24 03:48:25 UTC (rev 2036)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog	2004-11-24 07:22:06 UTC (rev 2037)
@@ -6,6 +6,8 @@
 	Fix wrapping of completion documentation.
 	Remove redundant overload count.
 	Add arrow UI hint for selecting an overloaded method.
+	Don't reinstantiate the tooltip each time.
+	Ignore bogus identical overloads.
 	* CodeCompletion/ListWindow.cs:
 	Make list rendering more like Gtk+ and don't override user's font size
 

Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionData.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionData.cs	2004-11-24 03:48:25 UTC (rev 2036)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionData.cs	2004-11-24 07:22:06 UTC (rev 2037)
@@ -56,7 +56,8 @@
 		public int Overloads
 		{
 			get {
-				return overloads;
+				//return overloads;
+				return overload_data.Count;
 			}
 			set {
 				overloads = value;
@@ -82,7 +83,13 @@
 				text = value[0];
 			}
 		}
-		
+		public string SimpleDescription
+		{
+			get {
+				return description;
+			}
+		}
+				
 		public string Description
 		{
 			get {
@@ -139,16 +146,19 @@
 			}
 		}
 
-		ArrayList overload_data = new ArrayList ();
+		Hashtable overload_data = new Hashtable ();
 
 		public CodeCompletionData[] GetOverloads ()
 		{
-			return (CodeCompletionData[]) overload_data.ToArray (typeof (CodeCompletionData));
+			return (CodeCompletionData[]) (new ArrayList (overload_data.Values)).ToArray (typeof (CodeCompletionData));
 		}
 
 		public void AddOverload (CodeCompletionData overload)
 		{
-			overload_data.Add (overload);
+			string desc = overload.SimpleDescription;
+
+			if (desc != description && !overload_data.Contains (desc))
+				overload_data[desc] = overload;
 		}
 		
 		public CodeCompletionData (string s, string image)
@@ -231,7 +241,7 @@
 			System.IO.StringReader reader = new System.IO.StringReader("<docroot>" + doc + "</docroot>");
 			XmlTextReader xml   = new XmlTextReader(reader);
 			StringBuilder ret   = new StringBuilder();
-			Regex whitespace    = new Regex(@"\s+", RegexOptions.Singleline);
+			Regex whitespace    = new Regex(@"(\s|\n)+", RegexOptions.Singleline);
 			
 			try {
 				xml.Read();

Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionListWindow.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionListWindow.cs	2004-11-24 03:48:25 UTC (rev 2036)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionListWindow.cs	2004-11-24 07:22:06 UTC (rev 2037)
@@ -145,7 +145,6 @@
 			int horiz = listpos_x + lvWidth + 2;
 
 			ICompletionDataWithMarkup datawMarkup = data as ICompletionDataWithMarkup;
-			declarationviewwindow.Destroy ();
 
 			string descMarkup;
 
@@ -161,7 +160,6 @@
 				descMarkup += "\n\n" + (odatawMarkup == null ? odata.Description : odatawMarkup.DescriptionPango);
 			}
 
-			declarationviewwindow = new DeclarationViewWindow ();
 			declarationviewwindow.DescriptionMarkup = descMarkup;
 
 			if (declarationviewwindow.DescriptionMarkup.Length == 0)
@@ -172,12 +170,14 @@
 
 			declarationviewwindow.ShowAll ();
 			declarationviewwindow.Multiple = (ccdata.Overloads != 0);
-			
+
+			//FIXME: GetSize returns the size /before/ the window was automatically shrunk
 			declarationviewwindow.GdkWindow.GetSize (out dvwWidth, out dvwHeight);
+
 			if (this.Screen.Width <= horiz + dvwWidth) {
 				horiz = listpos_x - dvwWidth - 10;
 			}
-		
+			
 			declarationviewwindow.Move (horiz, vert);
 		}
 		

Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/DeclarationViewWindow.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/DeclarationViewWindow.cs	2004-11-24 03:48:25 UTC (rev 2036)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/DeclarationViewWindow.cs	2004-11-24 07:22:06 UTC (rev 2037)
@@ -19,8 +19,9 @@
 		static char[] newline = {'\n'};
 		static char[] whitespace = {' '};
 
-		Label headlabel, bodylabel;
+		Label headlabel, bodylabel, helplabel;
 		Arrow left, right;
+		VBox helpbox;
 		
 		public string DescriptionMarkup
 		{
@@ -41,6 +42,9 @@
 				string[] parts = value.Split (newline, 2);
 				headlabel.Markup = parts[0].Trim (whitespace);
 				bodylabel.Markup = (parts.Length == 2 ? parts[1].Trim (whitespace) : String.Empty);
+
+				headlabel.Visible = headlabel.Text != "";
+				bodylabel.Visible = bodylabel.Text != "";
 				//QueueDraw ();
 			}
 		}
@@ -54,11 +58,19 @@
 			set {
 				left.Visible = value;
 				right.Visible = value;
+				helpbox.Visible = value;
+				
+				//this could go somewhere better, as long as it's after realization
+				headlabel.Visible = headlabel.Text != "";
+				bodylabel.Visible = bodylabel.Text != "";
 			}
 		}
-		
+
 		public DeclarationViewWindow () : base (WindowType.Popup)
 		{
+			this.AllowShrink = false;
+			this.AllowGrow = false;
+
 			headlabel = new Label ("");
 			headlabel.LineWrap = false;
 			headlabel.Xalign = 0;
@@ -66,10 +78,10 @@
 			bodylabel = new Label ("");
 			bodylabel.LineWrap = true;
 			bodylabel.Xalign = 0;
-			
+
 			VBox vb = new VBox (false, 0);
-			vb.PackStart (headlabel, true, true, 0);
-			vb.PackStart (bodylabel, true, true, 0);
+			vb.PackStart (headlabel, false, true, 0);
+			vb.PackStart (bodylabel, false, true, 0);
 
 			left = new Arrow (ArrowType.Left, ShadowType.None);
 			right = new Arrow (ArrowType.Right, ShadowType.None);
@@ -80,8 +92,24 @@
 			hb.PackStart (vb, true, true, 0);
 			hb.PackStart (right, false, true, 0);
 
+			helplabel = new Label ("");
+			helplabel.Xpad = 2;
+			helplabel.Ypad = 2;
+			helplabel.Xalign = 1;
+			helplabel.UseMarkup = true;
+			helplabel.Markup = "<small>i of n overloads</small>";
+			
+			helpbox = new VBox (false, 0);
+			helpbox.PackStart (new HSeparator (), false, true, 0);
+			helpbox.PackStart (helplabel, false, true, 0);
+			
+			VBox vb2 = new VBox (false, 0);
+			vb2.Spacing = 4;
+			vb2.PackStart (hb, false, true, 0);
+			vb2.PackStart (helpbox, false, true, 0);
+
 			Frame frame = new Frame ();
-			frame.Add (hb);
+			frame.Add (vb2);
 			
 			this.Add (frame);
 		}




More information about the Monodevelop-patches-list mailing list