[Monodevelop-patches-list] r2214 - in trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor: . Gui Properties
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Mon Jan 31 18:17:28 EST 2005
Author: jluke
Date: 2005-01-31 18:17:28 -0500 (Mon, 31 Jan 2005)
New Revision: 2214
Modified:
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/EditorBindings.glade
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
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Properties/TextEditorProperties.cs
Log:
underlining of errors
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog 2005-01-31 21:14:42 UTC (rev 2213)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog 2005-01-31 23:17:28 UTC (rev 2214)
@@ -1,7 +1,18 @@
2005-01-31 John Luke <john.luke at gmail.com>
* EditorBindings.glade:
+ * Gui/SourceEditorBuffer.cs:
* Gui/SourceEditorView.cs:
+ * Gui/OptionPanels/MarkersTextEditorPanel.cs:
+ * Gui/SourceEditorDisplayBinding.cs:
+ * Properties/TextEditorProperties.cs:
+ finish off underlining of errors, seems to
+ work alright
+
+2005-01-31 John Luke <john.luke at gmail.com>
+
+ * EditorBindings.glade:
+ * Gui/SourceEditorView.cs:
* Gui/OptionPanels/BehaviorTextEditorPanel.cs:
* Gui/SourceEditorDisplayBinding.cs:
* Properties/TextEditorProperties.cs:
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/EditorBindings.glade
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/EditorBindings.glade 2005-01-31 21:14:42 UTC (rev 2213)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/EditorBindings.glade 2005-01-31 23:17:28 UTC (rev 2214)
@@ -845,7 +845,7 @@
<property name="spacing">6</property>
<child>
- <widget class="GtkCheckButton" id="showInvalidLinesCheckBox">
+ <widget class="GtkCheckButton" id="showErrorsCheckBox">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Underline errors</property>
@@ -1023,7 +1023,7 @@
</child>
<child>
- <widget class="GtkCheckButton" id="showErrorsCheckBox">
+ <widget class="GtkCheckButton" id="showInvalidLinesCheckBox">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs 2005-01-31 21:14:42 UTC (rev 2213)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs 2005-01-31 23:17:28 UTC (rev 2214)
@@ -73,20 +73,22 @@
AtomicUndo atomic_undo;
SourceEditorView view;
int highlightLine = -1;
+ bool underlineErrors = true;
+ ArrayList points;
+ IParserService ps = (IParserService)ServiceManager.GetService (typeof (IParserService));
+
public SourceEditorView View
{
- get {
- return view;
- }
- set {
- view = value;
- }
+ get { return view; }
+ set { view = value; }
}
-
-
- IParserService ps = (IParserService)ServiceManager.GetService (typeof (IParserService));
+ public bool UnderlineErrors {
+ get { return underlineErrors; }
+ set { underlineErrors = value; }
+ }
+
public SourceEditorBuffer (SourceEditorView view) : this ()
{
this.view = view;
@@ -101,54 +103,58 @@
complete_ahead.Foreground = "grey";
TagTable.Add (complete_ahead);
compilation_error = new TextTag ("compilation_error");
- compilation_error.Underline = Pango.Underline.Single;
+ compilation_error.Underline = Pango.Underline.Error;
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);
+
+ points = new ArrayList ();
+ ps.ParseInformationChanged += new ParseInformationEventHandler (ParseChanged);
+ GLib.Timeout.Add (50, new GLib.TimeoutHandler (DrawErrors));
}
- ArrayList points = new ArrayList ();
- public void parseChanged (object o, ParseInformationEventArgs e)
+ public void ParseChanged (object o, ParseInformationEventArgs e)
{
if (view != null) {
- if (view.ParentEditor.DisplayBinding.ContentName == e.FileName){
+ if (view.ParentEditor.DisplayBinding.ContentName == e.FileName) {
if (e.ParseInformation.MostRecentCompilationUnit.ErrorsDuringCompile) {
string[] errors = e.ParseInformation.MostRecentCompilationUnit.ErrorOutput.Split ('\n');
foreach (string error in errors) {
string[] pieces = error.Split (' ');
- if (pieces.Length == 1) continue;
- Console.WriteLine ("line: {0} col: {1}", pieces[2], pieces[4]);
+ if (pieces.Length == 1)
+ continue;
int[] point = new int[2];
point[0] = Convert.ToInt32 (pieces[2]) - 1;
- point[1] = Convert.ToInt32 (pieces[4]);
+ point[1] = Convert.ToInt32 (pieces[4]) - 1;
points.Add (point);
}
- GLib.Idle.Add (new GLib.IdleHandler (addMarkup));
}
else {
- //Clear errors
+ points.Clear ();
}
}
}
}
- bool addMarkup ()
+ bool DrawErrors ()
{
+ // FIXME: clear old ones nicer
+ RemoveTag (compilation_error, StartIter, EndIter);
+ if (!underlineErrors)
+ return true;
+
foreach (int[] point in points) {
- Console.WriteLine ("line: {0} col: {1}", point[0], point[1]);
- TextIter start = GetIterAtLine (point[0]);
- Console.WriteLine (start.Line);
- //start.LineOffset = point[1] - 1;
- Console.WriteLine (start.Line);
+ //Console.WriteLine ("Error is line: {0} col: {1}", point[0], point[1]);
+ // FIXME: maybe we can be more precise
+ TextIter start = GetIterAtLineOffset (point[0], point[1]);
TextIter end = start;
end.ForwardToLineEnd ();
ApplyTag (compilation_error, start, end);
}
- points.Clear ();
- return false;
+
+ return true;
}
public void MarkupLine (int linenumber)
@@ -325,7 +331,6 @@
{
get {
return true;
- //return clipboard.WaitIsTextAvailable ();
}
}
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs 2005-01-31 21:14:42 UTC (rev 2213)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs 2005-01-31 23:17:28 UTC (rev 2214)
@@ -519,6 +519,7 @@
se.View.InsertSpacesInsteadOfTabs = TextEditorProperties.ConvertTabsToSpaces;
se.View.AutoIndent = (TextEditorProperties.IndentStyle == IndentStyle.Auto);
se.View.AutoInsertTemplates = TextEditorProperties.AutoInsertTemplates;
+ se.Buffer.UnderlineErrors = TextEditorProperties.UnderlineErrors;
//System.Console.WriteLine(e.Key + " = " + e.NewValue + "(from " + e.OldValue + ")" );
// The items below can't be done (since there is no support for it in gtksourceview)
@@ -526,7 +527,6 @@
// CANTDO: show tabs Key = "ShowTabs"
// CANTDO eol makers Key = "ShowEOLMarkers"
// CANTDO: show horizontal ruler Key = "ShowHRuler"
- // CANDO in pango1.4: underline errors Key = "ShowErrors"
// DONOTDO: auto insert braces Key = "AutoInsertCurlyBracket"
// TODO: Show Invalid Lines Key = "ShowInvalidLines"
// TODO: Code Folding Key = "EnableFolding"
@@ -536,3 +536,4 @@
}
}
}
+
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs 2005-01-31 21:14:42 UTC (rev 2213)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs 2005-01-31 23:17:28 UTC (rev 2214)
@@ -42,7 +42,7 @@
get { return autoInsertTemplates; }
set { autoInsertTemplates = value; }
}
-
+
public SourceEditorView (SourceEditorBuffer buf, SourceEditor parent)
{
this.ParentEditor = parent;
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Properties/TextEditorProperties.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Properties/TextEditorProperties.cs 2005-01-31 21:14:42 UTC (rev 2213)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Properties/TextEditorProperties.cs 2005-01-31 23:17:28 UTC (rev 2214)
@@ -281,6 +281,15 @@
properties.SetProperty("AutoInsertTemplates", value);
}
}
+
+ public static bool UnderlineErrors {
+ get {
+ return properties.GetProperty("ShowErrors", true);
+ }
+ set {
+ properties.SetProperty("ShowErrors", value);
+ }
+ }
public static FontDescription Font {
get {
More information about the Monodevelop-patches-list
mailing list