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

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Wed Jan 26 17:38:14 EST 2005


Author: tberman
Date: 2005-01-26 17:38:13 -0500 (Wed, 26 Jan 2005)
New Revision: 2169

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
   trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/ListWindow.cs
Log:
2005-01-26  Todd Berman  <tberman at off.net>

	* CodeCompletion/CompletionListWindow.cs:
	* CodeCompletion/CodeCompletionData.cs:
	* CodeCompletion/ListWindow.cs:
	* CodeCompletion/DeclarationViewWindow.cs: A bit of a nicer overload
	dialog.



Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog	2005-01-26 21:37:16 UTC (rev 2168)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog	2005-01-26 22:38:13 UTC (rev 2169)
@@ -1,3 +1,11 @@
+2005-01-26  Todd Berman  <tberman at off.net>
+
+	* CodeCompletion/CompletionListWindow.cs:
+	* CodeCompletion/CodeCompletionData.cs:
+	* CodeCompletion/ListWindow.cs:
+	* CodeCompletion/DeclarationViewWindow.cs: A bit of a nicer overload
+	dialog.
+
 2005-01-26  Alexandre Gomes  <alexmipego at gmail.com>
 
 	* CodeCompletion/CompletationListWindow.cs: Fixed completion

Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionData.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionData.cs	2005-01-26 21:37:16 UTC (rev 2168)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionData.cs	2005-01-26 22:38:13 UTC (rev 2169)
@@ -101,12 +101,6 @@
 					convertedDocumentation = true;
 					try {
 						documentation = GetDocumentation(documentation);
-						// new (by G.B.)
-						// XmlDocument doc = new XmlDocument();
-						// doc.LoadXml("<doc>" + documentation + "</doc>");
-						// XmlNode root      = doc.DocumentElement;
-						// XmlNode paramDocu = root.SelectSingleNode("summary");
-						// documentation = paramDocu.InnerXml;
 					} catch (Exception e) {
 						Console.WriteLine(e.ToString());
 					}
@@ -129,12 +123,6 @@
 					convertedDocumentation = true;
 					try {
 						documentation = GetDocumentation(documentation);
-						// new (by G.B.)
-						// XmlDocument doc = new XmlDocument();
-						// doc.LoadXml("<doc>" + documentation + "</doc>");
-						// XmlNode root      = doc.DocumentElement;
-						// XmlNode paramDocu = root.SelectSingleNode("summary");
-						// documentation = paramDocu.InnerXml;
 					} catch (Exception e) {
 						Console.WriteLine(e.ToString());
 					}

Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionListWindow.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionListWindow.cs	2005-01-26 21:37:16 UTC (rev 2168)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionListWindow.cs	2005-01-26 22:38:13 UTC (rev 2169)
@@ -122,7 +122,17 @@
 			
 			if ((ka & ListWindow.KeyAction.Ignore) != 0)
 				return true;
-				
+
+			if ((ka & ListWindow.KeyAction.Process) != 0) {
+				if (e.Key == Gdk.Key.Left) {
+					wnd.declarationviewwindow.OverloadLeft ();
+					return true;
+				} else if (e.Key == Gdk.Key.Right) {
+					wnd.declarationviewwindow.OverloadRight ();
+					return true;
+				}
+			}
+
 			return false;
 		}
 		
@@ -157,6 +167,7 @@
 			ICompletionData data = completionData[List.Selection];
 			
 			declarationviewwindow.Hide ();
+			declarationviewwindow.Clear ();
 			
 			// FIXME: This code is buggy, and generates a bad placement sometimes when you jump a lot.
 			// but it is better than 0,0
@@ -176,35 +187,35 @@
 			} else if (vert < listpos_y) {
 				vert = listpos_y;
 			}
-			// FIXME: This is a bad calc, its always on the right,
-			// it needs to test if thats too big, and if so, place on the left;
 			int horiz = listpos_x + lvWidth + 2;
 
 			ICompletionDataWithMarkup datawMarkup = data as ICompletionDataWithMarkup;
 
-			string descMarkup;
+			string descMarkup = String.Empty;
 
 			if (datawMarkup != null)
 				descMarkup = datawMarkup.DescriptionPango;
 			else
 				descMarkup = declarationviewwindow.DescriptionMarkup = data.Description;
 
+			declarationviewwindow.Realize ();
+
+			declarationviewwindow.AddOverload (descMarkup);
+
 			CodeCompletionData ccdata = (CodeCompletionData) data;
 
 			foreach (CodeCompletionData odata in ccdata.GetOverloads ()) {
 				ICompletionDataWithMarkup odatawMarkup = odata as ICompletionDataWithMarkup;
-				descMarkup += "\n\n" + (odatawMarkup == null ? odata.Description : odatawMarkup.DescriptionPango);
+				declarationviewwindow.AddOverload (odatawMarkup == null ? odata.Description : odatawMarkup.DescriptionPango);
 			}
 
-			declarationviewwindow.DescriptionMarkup = descMarkup;
-
 			if (declarationviewwindow.DescriptionMarkup.Length == 0)
 				return;
 
-			declarationviewwindow.Multiple = (ccdata.Overloads != 0);
 			int dvwWidth, dvwHeight;
+
 			declarationviewwindow.Move (this.Screen.Width+1, vert);
-
+			
 			declarationviewwindow.ReshowWithInitialSize ();
 			declarationviewwindow.ShowAll ();
 			declarationviewwindow.Multiple = (ccdata.Overloads != 0);

Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/DeclarationViewWindow.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/DeclarationViewWindow.cs	2005-01-26 21:37:16 UTC (rev 2168)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/DeclarationViewWindow.cs	2005-01-26 22:38:13 UTC (rev 2169)
@@ -19,6 +19,9 @@
 		static char[] newline = {'\n'};
 		static char[] whitespace = {' '};
 
+		ArrayList overloads;
+		int current_overload;
+
 		Label headlabel, bodylabel, helplabel;
 		Arrow left, right;
 		VBox helpbox;
@@ -66,8 +69,50 @@
 			}
 		}
 
+		public void AddOverload (string desc)
+		{
+			overloads.Add (desc);
+			if (overloads.Count == 2) {
+				Multiple = true;
+			}
+			ShowOverload ();
+		}
+
+		void ShowOverload ()
+		{
+			DescriptionMarkup = (string)overloads[current_overload];
+			helplabel.Markup = String.Format ("<small>{0} of {1} overloads</small>", current_overload + 1, overloads.Count);
+		}
+
+		public void OverloadLeft ()
+		{
+			if (current_overload == 0)
+				current_overload = overloads.Count - 1;
+			else
+				current_overload--;
+			ShowOverload ();
+		}
+
+		public void OverloadRight ()
+		{
+			if (current_overload == overloads.Count - 1)
+				current_overload = 0;
+			else
+				current_overload++;
+			ShowOverload ();
+		}
+
+		public void Clear ()
+		{
+			overloads.Clear ();
+			Multiple = false;
+			DescriptionMarkup = String.Empty;
+			current_overload = 0;
+		}
+
 		public DeclarationViewWindow () : base (WindowType.Popup)
 		{
+			overloads = new ArrayList ();
 			this.AllowShrink = false;
 			this.AllowGrow = false;
 
@@ -97,7 +142,7 @@
 			helplabel.Ypad = 2;
 			helplabel.Xalign = 1;
 			helplabel.UseMarkup = true;
-			helplabel.Markup = "<small>i of n overloads</small>";
+			helplabel.Markup = "";
 			
 			helpbox = new VBox (false, 0);
 			helpbox.PackStart (new HSeparator (), false, true, 0);

Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/ListWindow.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/ListWindow.cs	2005-01-26 21:37:16 UTC (rev 2168)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/ListWindow.cs	2005-01-26 22:38:13 UTC (rev 2169)
@@ -117,8 +117,8 @@
 					return KeyAction.Ignore;
 					
 				case Gdk.Key.Left:
-					if (curPos == 0) return KeyAction.CloseWindow | KeyAction.Process;
-					curPos--;
+					//if (curPos == 0) return KeyAction.CloseWindow | KeyAction.Process;
+					//curPos--;
 					return KeyAction.Process;
 					
 				case Gdk.Key.BackSpace:
@@ -129,8 +129,8 @@
 					return KeyAction.Process;
 					
 				case Gdk.Key.Right:
-					if (curPos == word.Length) return KeyAction.CloseWindow | KeyAction.Process;
-					curPos++;
+					//if (curPos == word.Length) return KeyAction.CloseWindow | KeyAction.Process;
+					//curPos++;
 					return KeyAction.Process;
 					
 				case Gdk.Key.Tab:




More information about the Monodevelop-patches-list mailing list