[Monodevelop-patches-list] r2205 - in trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor: . Gui
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Mon Jan 31 14:36:22 EST 2005
Author: lluis
Date: 2005-01-31 14:36:21 -0500 (Mon, 31 Jan 2005)
New Revision: 2205
Modified:
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
Log:
2005-01-31 Lluis Sanchez Gual <lluis at novell.com>
* Gui/SourceEditorDisplayBinding.cs:
* Gui/SourceEditorBuffer.cs: Highlight the selected line when jumping
from the task view. ScrollMarkOnscreen after paste command.
* Gui/SourceEditorView.cs: Use function overrides instead of
subscribing its own events.
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog 2005-01-31 19:36:03 UTC (rev 2204)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog 2005-01-31 19:36:21 UTC (rev 2205)
@@ -1,3 +1,11 @@
+2005-01-31 Lluis Sanchez Gual <lluis at novell.com>
+
+ * Gui/SourceEditorDisplayBinding.cs:
+ * Gui/SourceEditorBuffer.cs: Highlight the selected line when jumping
+ from the task view. ScrollMarkOnscreen after paste command.
+ * Gui/SourceEditorView.cs: Use function overrides instead of
+ subscribing its own events.
+
2005-01-31 John Luke <john.luke at gmail.com>
* EditorBindings.glade
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs 2005-01-31 19:36:03 UTC (rev 2204)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs 2005-01-31 19:36:21 UTC (rev 2205)
@@ -69,8 +69,10 @@
TextTag complete_ahead;
TextTag compilation_error;
TextMark complete_end;
+ TextTag highlightLineTag;
AtomicUndo atomic_undo;
SourceEditorView view;
+ int highlightLine = -1;
public SourceEditorView View
{
@@ -102,9 +104,12 @@
compilation_error.Underline = Pango.Underline.Single;
TagTable.Add (compilation_error);
complete_end = CreateMark (null, StartIter, true);
+ highlightLineTag = new TextTag ("highlightLine");
+ highlightLineTag.Background = "lightgrey";
+ TagTable.Add (highlightLineTag);
//ps.ParseInformationChanged += new ParseInformationEventHandler (parseChanged);
}
-
+
ArrayList points = new ArrayList ();
public void parseChanged (object o, ParseInformationEventArgs e)
{
@@ -161,6 +166,24 @@
RemoveTag (markup, StartIter, EndIter);
}
+ public void HighlightLine (int linenumber)
+ {
+ TextIter begin_line = GetIterAtLine (linenumber);
+ TextIter end_line = begin_line;
+ begin_line.LineOffset = 0;
+ end_line.ForwardToLineEnd ();
+ ApplyTag (highlightLineTag, begin_line, end_line);
+ highlightLine = linenumber;
+ }
+
+ public void HideHighlightLine ()
+ {
+ if (highlightLine != -1) {
+ RemoveTag (highlightLineTag, StartIter, EndIter);
+ highlightLine = -1;
+ }
+ }
+
public void DropCompleteAhead ()
{
if (GetIterAtMark (complete_end).Offset == 0)
@@ -330,8 +353,10 @@
void IClipboardHandler.Paste (object sender, EventArgs e)
{
- if (clipboard.WaitIsTextAvailable ())
+ if (clipboard.WaitIsTextAvailable ()) {
PasteClipboard (clipboard);
+ View.ScrollMarkOnscreen (InsertMark);
+ }
}
void IClipboardHandler.Delete (object sender, EventArgs e)
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs 2005-01-31 19:36:03 UTC (rev 2204)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs 2005-01-31 19:36:21 UTC (rev 2205)
@@ -204,9 +204,10 @@
// NOTE: 0 based!
TextIter itr = se.Buffer.GetIterAtLine (line);
itr.LineOffset = column;
-
+
se.Buffer.PlaceCursor (itr);
- se.View.ScrollMarkOnscreen (se.Buffer.InsertMark);
+ se.Buffer.HighlightLine (line);
+ se.View.ScrollToMark (se.Buffer.InsertMark, 0.3, false, 0, 0);
GLib.Timeout.Add (20, new GLib.TimeoutHandler (changeFocus));
}
@@ -218,6 +219,7 @@
bool changeFocus ()
{
se.View.GrabFocus ();
+ se.View.ScrollToMark (se.Buffer.InsertMark, 0.3, false, 0, 0);
return false;
}
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs 2005-01-31 19:36:03 UTC (rev 2204)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs 2005-01-31 19:36:21 UTC (rev 2205)
@@ -46,8 +46,6 @@
SmartHomeEnd = true;
ShowLineNumbers = true;
ShowLineMarkers = true;
- ButtonPressEvent += new ButtonPressEventHandler (buttonPress);
- FocusOutEvent += new FocusOutEventHandler (OnFocusOut);
buf.PlaceCursor (buf.StartIter);
GrabFocus ();
buf.MarkSet += new MarkSetHandler (BufferMarkSet);
@@ -56,13 +54,17 @@
void BufferMarkSet (object s, MarkSetArgs a)
{
- if (autoHideCompletionWindow && a.Mark.Name == "insert")
- CompletionListWindow.HideWindow ();
+ if (a.Mark.Name == "insert") {
+ if (autoHideCompletionWindow)
+ CompletionListWindow.HideWindow ();
+ buf.HideHighlightLine ();
+ }
}
- void OnFocusOut (object s, FocusOutEventArgs args)
+ protected override bool OnFocusOutEvent (EventFocus e)
{
CompletionListWindow.HideWindow ();
+ return base.OnFocusOutEvent (e);
}
void BufferChanged (object s, EventArgs args)
@@ -71,24 +73,24 @@
CompletionListWindow.HideWindow ();
}
- void buttonPress (object o, ButtonPressEventArgs e)
+ protected override bool OnButtonPressEvent (Gdk.EventButton e)
{
CompletionListWindow.HideWindow ();
if (!ShowLineMarkers)
- return;
+ return base.OnButtonPressEvent (e);
- if (e.Event.Window == GetWindow (Gtk.TextWindowType.Left)) {
+ if (e.Window == GetWindow (Gtk.TextWindowType.Left)) {
int x, y;
- WindowToBufferCoords (Gtk.TextWindowType.Left, (int) e.Event.X, (int) e.Event.Y, out x, out y);
+ WindowToBufferCoords (Gtk.TextWindowType.Left, (int) e.X, (int) e.Y, out x, out y);
TextIter line;
int top;
GetLineAtY (out line, y, out top);
- if (e.Event.Button == 1) {
+ if (e.Button == 1) {
buf.ToggleBookmark (line.Line);
- } else if (e.Event.Button == 3) {
+ } else if (e.Button == 3) {
Gtk.Menu popup = new Gtk.Menu ();
Gtk.CheckMenuItem bookmarkItem = new Gtk.CheckMenuItem (GettextCatalog.GetString ("Bookmark"));
bookmarkItem.Active = buf.IsBookmarked (line.Line);
@@ -106,9 +108,10 @@
popup.ShowAll ();
lineToMark = line.Line;
- popup.Popup (null, null, null, IntPtr.Zero, 3, e.Event.Time);
+ popup.Popup (null, null, null, IntPtr.Zero, 3, e.Time);
}
}
+ return base.OnButtonPressEvent (e);
}
public void bookmarkToggled (object o, EventArgs e)
More information about the Monodevelop-patches-list
mailing list