[Monodevelop-patches-list] r788 - in trunk/MonoDevelop/src/AddIns/DisplayBindings: SourceEditor/Gui TextEditor/Conditions
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Wed Feb 4 23:14:57 EST 2004
Author: benm
Date: 2004-02-04 23:14:57 -0500 (Wed, 04 Feb 2004)
New Revision: 788
Modified:
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Conditions/TextContentCondition.cs
Log:
half assed, yes, breaks
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs 2004-02-05 03:32:20 UTC (rev 787)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs 2004-02-05 04:14:57 UTC (rev 788)
@@ -15,6 +15,7 @@
using MonoDevelop.GuiUtils;
using MonoDevelop.EditorBindings.Properties;
+using MonoDevelop.EditorBindings.FormattingStrategy;
namespace MonoDevelop.SourceEditor.Gui {
public class SourceEditorDisplayBinding : IDisplayBinding {
@@ -135,6 +136,7 @@
{
se.Buffer.Save (fileName);
ContentName = fileName;
+ InitializeFormatter ();
}
public override void Load (string fileName)
@@ -142,8 +144,20 @@
se.Buffer.LoadFile (fileName, Vfs.GetMimeType (fileName));
ContentName = fileName;
+ InitializeFormatter ();
}
+ public void InitializeFormatter()
+ {
+ IFormattingStrategy[] formater = (IFormattingStrategy[])(AddInTreeSingleton.AddInTree.GetTreeNode("/AddIns/DefaultTextEditor/Formater").BuildChildItems(this)).ToArray(typeof(IFormattingStrategy));
+ //Console.WriteLine("SET FORMATTER : " + formater[0]);
+ if (formater != null && formater.Length > 0) {
+// formater[0].Document = Document;
+ se.View.fmtr = formater[0];
+ }
+
+ }
+
public void LoadString (string mime, string val)
{
if (mime != null)
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs 2004-02-05 03:32:20 UTC (rev 787)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs 2004-02-05 04:14:57 UTC (rev 788)
@@ -5,8 +5,8 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
-
-using MonoDevelop.SourceEditor.CodeCompletion;
+using ICSharpCode.Core.AddIns.Conditions;
+using ICSharpCode.Core.AddIns;using MonoDevelop.SourceEditor.CodeCompletion;
using MonoDevelop.SourceEditor.InsightWindow;
using MonoDevelop.EditorBindings.Properties;
using MonoDevelop.EditorBindings.FormattingStrategy;
@@ -89,6 +89,18 @@
Console.WriteLine("EXCEPTION: " + e);
}
break;
+
+ default:
+ if (fmtr != null) {
+ TextIter itr = Buffer.GetIterAtMark (Buffer.InsertMark);
+ int offset = itr.Offset;
+ int delta = fmtr.FormatLine (this, itr.Line, itr.Offset, (char)key);
+ if (delta != 0) {
+ Buffer.PlaceCursor (Buffer.GetIterAtOffset (offset + delta));
+ return true;
+ }
+ }
+ break;
}
return base.OnKeyPressEvent (ref evnt);
@@ -253,7 +265,10 @@
offset = begin.Offset;
len = begin.CharsInLine;
}
-
+
+ internal IFormattingStrategy fmtr;
+
+
#endregion
}
}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Conditions/TextContentCondition.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Conditions/TextContentCondition.cs 2004-02-05 03:32:20 UTC (rev 787)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Conditions/TextContentCondition.cs 2004-02-05 04:14:57 UTC (rev 788)
@@ -41,6 +41,13 @@
return textcontent == ctrl.Document.HighlightingStrategy.Name;
}
}
+
+ if (owner is IViewContent) {
+ IViewContent ctrl = (IViewContent) owner;
+ if (textcontent == "C#" && ctrl.ContentName.EndsWith (".cs"))
+ return true;
+ }
+
return false;
}
}
More information about the Monodevelop-patches-list
mailing list