[Monodevelop-patches-list] r1796 - in trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor: . CodeCompletion Gui
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Mon Jun 21 12:31:06 EDT 2004
Author: tberman
Date: 2004-06-21 12:31:06 -0400 (Mon, 21 Jun 2004)
New Revision: 1796
Modified:
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionDataProvider.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionWindow.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/MonoDevelop.SourceEditor.dll.config
Log:
refactor completion display code a bit to use one static instance, and cut down on the cost of recreating every piece of that window from scratch every time. this should have been done a long time ago. some small fixups as well
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/ChangeLog 2004-06-21 16:15:47 UTC (rev 1795)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/ChangeLog 2004-06-21 16:31:06 UTC (rev 1796)
@@ -1,5 +1,21 @@
2004-06-21 Todd Berman <tberman at off.net>
+ * Gui/SourceEditorView.cs:
+ * CodeCompletion/CompletionWindow.cs:
+ Refactor to use one static instance of the completion window across
+ the entire app instead of recreating it every time. Now it is accessed
+ via:
+
+ CompletionWindow.ShowWindow (args);
+
+ Everything should be functionally the same for the end user.
+ * CodeCompletion/CodeCompletionDataProvider.cs:
+ restyle, cleanup formatting.
+ * MonoDevelop.SourceEditor.dll.config:
+ Add gtksourceview-1.0 -> libgtksourceview-1.0.so.0 mapping.
+
+2004-06-21 Todd Berman <tberman at off.net>
+
* CodeCompletion/CompletionWindow.cs: Small code cleanups.
2004-06-11 Lluis Sanchez Gual <lluis at ximian.com>
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionDataProvider.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionDataProvider.cs 2004-06-21 16:15:47 UTC (rev 1795)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionDataProvider.cs 2004-06-21 16:31:06 UTC (rev 1796)
@@ -45,14 +45,13 @@
bool ctrlspace;
public CodeCompletionDataProvider() : this (false)
- {
- }
+ {
+ }
- public CodeCompletionDataProvider (bool ctrl)
- {
- this.ctrlspace = ctrl;
- }
-
+ public CodeCompletionDataProvider (bool ctrl)
+ {
+ this.ctrlspace = ctrl;
+ }
ArrayList completionData = null;
@@ -93,16 +92,10 @@
} else {
//FIXME: I added the null check, #D doesnt need it, why do we?
if (fileName != null) {
- results = parserService.Resolve(project,
- expression,
- caretLineNumber,
- caretColumn,
- fileName,
- textArea.Buffer.Text);
+ results = parserService.Resolve(project, expression, caretLineNumber, caretColumn, fileName, textArea.Buffer.Text);
AddResolveResults(results);
}
}
-
return (ICompletionData[]) completionData.ToArray (typeof (ICompletionData));
}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionWindow.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionWindow.cs 2004-06-21 16:15:47 UTC (rev 1795)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionWindow.cs 2004-06-21 16:31:06 UTC (rev 1796)
@@ -18,7 +18,6 @@
public class CompletionWindow : Window
{
const int DeclarationIndent = 1;
- private static GLib.GType gtype;
TreeViewColumn complete_column;
ICompletionDataProvider completionDataProvider;
@@ -31,6 +30,13 @@
DeclarationViewWindow declarationviewwindow = new DeclarationViewWindow ();
string fileName;
IProject project;
+
+ static CompletionWindow wnd;
+
+ static CompletionWindow ()
+ {
+ wnd = new CompletionWindow ();
+ }
string GetTypedString ()
{
@@ -70,10 +76,7 @@
case ';':
case '(':
case '[':
- //case (char) Gdk.Key.Return:
- //case (char) Gdk.Key.ISO_Enter:
- //case (char) Gdk.Key.Key_3270_Enter:
- //case (char) Gdk.Key.KP_Enter:
+ case ',':
control.SimulateKeyPress (ref e);
LostFocusListView (null, null);
return true;
@@ -140,7 +143,6 @@
LostFocusListView (null, null);
}
- //control.Buffer.InsertAtCursor (val.ToString ());
ex.RetVal = true;
return;
} else {
@@ -156,7 +158,7 @@
ex.RetVal = true;
}
- public bool ShuffleSelection (bool magic)
+ bool ShuffleSelection (bool magic)
{
// select the current typed word
int lastSelected = -1;
@@ -240,7 +242,6 @@
this.Add (frame);
listView.KeyPressEvent += new KeyPressEventHandler (ListKeypressEvent);
- //listView.KeyReleaseEvent += new KeyReleaseEventHandler(ListKeyreleaseEvent);
listView.FocusOutEvent += new FocusOutEventHandler (LostFocusListView);
listView.RowActivated += new RowActivatedHandler (ActivateItem);
listView.AddEvents ((int) (Gdk.EventMask.KeyPressMask | Gdk.EventMask.LeaveNotifyMask));
@@ -249,8 +250,18 @@
/// <remarks>
/// Shows the filled completion window, if it has no items it isn't shown.
/// </remarks>
- public void ShowCompletionWindow (char firstChar, TextIter trigIter, bool magic)
+ public static void ShowWindow (char firstChar, TextIter trigIter, bool magic, ICompletionDataProvider provider, SourceEditorView ctrl)
{
+ wnd.ShowCompletionWindow (firstChar, trigIter, magic, provider, ctrl);
+ }
+
+ void ShowCompletionWindow (char firstChar, TextIter trigIter, bool magic, ICompletionDataProvider provider, SourceEditorView ctrl)
+ {
+ this.completionDataProvider = provider;
+ this.control = ctrl;
+ this.fileName = ctrl.ParentEditor.DisplayBinding.ContentName;
+ this.project = ctrl.ParentEditor.DisplayBinding.Project;
+ this.store.Clear ();
control.buf.StartAtomicUndo ();
triggeringMark = control.Buffer.CreateMark (null, trigIter, true);
origOffset = trigIter.Offset;
@@ -264,6 +275,7 @@
return;
}
+ listView.Selection.Changed -= new EventHandler (RowActivated);
if (magic) {
if (ShuffleSelection (true))
return;
@@ -276,50 +288,23 @@
int tx, ty;
control.GdkWindow.GetOrigin (out tx, out ty);
- //Console.WriteLine ("Moving to: " + (tx + wx) + " . " + (ty + wy));
- //System.Threading.Thread.Sleep (50);
+
ShowAll ();
Move (tx + wx, ty + wy);
Present ();
+ listView.GrabFocus ();
listView.Selection.Changed += new EventHandler (RowActivated);
RowActivated (null, null);
- //GdkWindow.Move (tx + wx, ty + wy);
}
- public static new GLib.GType GType
- {
- get
- {
- if (gtype == GLib.GType.Invalid)
- gtype = RegisterGType (typeof (CompletionWindow));
- return gtype;
- }
- }
-
/// <remarks>
/// Creates a new Completion window and puts it location under the caret
/// </remarks>
- public CompletionWindow (SourceEditorView control, IProject project, string fileName, ICompletionDataProvider completionDataProvider) : base (GType)
+ CompletionWindow () : base (Gtk.WindowType.Toplevel)
{
- this.fileName = fileName;
- this.project = project;
- this.completionDataProvider = completionDataProvider;
- this.control = control;
-
InitializeControls ();
}
- /// <remarks>
- /// Creates a new Completion window at a given location
- /// </remarks>
- CompletionWindow (SourceEditorView control, Point location, ICompletionDataProvider completionDataProvider) : base (GType)
- {
- this.completionDataProvider = completionDataProvider;
- this.control = control;
-
- InitializeControls ();
- }
-
void ActivateItem (object sender, RowActivatedArgs e)
{
TreeModel foo;
@@ -339,8 +324,8 @@
control.buf.EndAtomicUndo ();
listView.FocusOutEvent -= LostFocusListView;
control.HasFocus = true;
- declarationviewwindow.Destroy ();
- this.Destroy ();
+ declarationviewwindow.HideAll ();
+ this.Hide ();
}
void FillList (bool firstTime, char ch)
@@ -382,7 +367,7 @@
control.buf.DropCompleteAhead ();
control.buf.CompleteAhead (data.CompletionString.Substring(inst));
}
-
+
// This code is for sizing the treeview properly.
Gtk.TreePath path = store.GetPath (iter);
Gdk.Rectangle backRect = listView.GetBackgroundArea (path, (Gtk.TreeViewColumn)listView.Columns[0]);
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs 2004-06-21 16:15:47 UTC (rev 1795)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs 2004-06-21 16:31:06 UTC (rev 1796)
@@ -30,20 +30,8 @@
internal IFormattingStrategy fmtr;
public SourceEditorBuffer buf;
int lineToMark = -1;
- CompletionWindow completionWnd;
bool codeCompleteEnabled;
- CompletionWindow completionWindow {
- set {
- if (completionWnd != null) {
- completionWnd.Destroy ();
- completionWnd = null;
- }
- completionWnd = value;
- }
- get { return completionWnd; }
- }
-
public static new GLib.GType GType
{
get
@@ -181,9 +169,8 @@
if (triggerIter.Equals (TextIter.Zero)) return;
triggerIter.ForwardChar ();
- completionWindow = new CompletionWindow (this, ParentEditor.DisplayBinding.Project, ParentEditor.DisplayBinding.ContentName, new CodeCompletionDataProvider (true));
- completionWindow.ShowCompletionWindow (triggerChar, triggerIter, true);
+ CompletionWindow.ShowWindow (triggerChar, triggerIter, true, new CodeCompletionDataProvider (true), this);
}
bool MonodocResolver ()
@@ -304,8 +291,7 @@
case '.':
bool retval = base.OnKeyPressEvent (evnt);
if (EnableCodeCompletion) {
- completionWindow = new CompletionWindow (this, ParentEditor.DisplayBinding.Project, ParentEditor.DisplayBinding.ContentName, new CodeCompletionDataProvider ());
- completionWindow.ShowCompletionWindow ((char)key, buf.GetIterAtMark (buf.InsertMark), false);
+ CompletionWindow.ShowWindow ((char)key, buf.GetIterAtMark (buf.InsertMark), false, new CodeCompletionDataProvider (), this);
}
return retval;
/*case '(':
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/MonoDevelop.SourceEditor.dll.config
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/MonoDevelop.SourceEditor.dll.config 2004-06-21 16:15:47 UTC (rev 1795)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/MonoDevelop.SourceEditor.dll.config 2004-06-21 16:31:06 UTC (rev 1796)
@@ -1,3 +1,4 @@
<configuration>
<dllmap dll="libglib-2.0-0.dll" target="libglib-2.0.so.0"/>
+ <dllmap dll="gtksourceview-1.0" target="libgtksourceview-1.0.so.0"/>
</configuration>
More information about the Monodevelop-patches-list
mailing list