[Monodevelop-patches-list] r664 - in trunk/MonoDevelop/src/AddIns/DisplayBindings: . SourceEditor SourceEditor/Gui
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Mon Jan 26 20:00:28 EST 2004
Author: benm
Date: 2004-01-26 20:00:28 -0500 (Mon, 26 Jan 2004)
New Revision: 664
Added:
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorWidget.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Makefile
Log:
what i already have on the disk. Doesnt compile yet ;-). It is not in the build, of course
Added: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs 2004-01-27 00:09:49 UTC (rev 663)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs 2004-01-27 01:00:28 UTC (rev 664)
@@ -0,0 +1,85 @@
+using System;
+using System.IO;
+
+using ICSharpCode.SharpDevelop.Gui;
+using ICSharpCode.SharpDevelop.Internal.Project;
+using ICSharpCode.Core.Properties;
+using ICSharpCode.Core.AddIns;
+using ICSharpCode.Core.Services;
+using ICSharpCode.SharpDevelop.Services;
+using ICSharpCode.Core.AddIns.Codons;
+
+namespace MonoDevelop.SourceEditor.Gui {
+ public class SourceEditorDisplayBinding : IDisplayBinding
+ {
+
+ public virtual bool CanCreateContentForFile (string fileName)
+ {
+ return true;
+ }
+
+ public virtual bool CanCreateContentForLanguage (string language)
+ {
+ return true;
+ }
+
+ public virtual IViewContent CreateContentForFile (string fileName)
+ {
+ SourceEditorDisplayBindingWrapper w = new SourceEditorDisplayBindingWrapper ();
+ w.Load (fileName);
+ }
+
+ public virtual IViewContent CreateContentForLanguage (string language, string content)
+ {
+ w.LoadString (language, content);
+ }
+
+ public virtual IViewContent CreateContentForLanguage (string language, string content, string new_file_name)
+ {
+ w.LoadString (language, content);
+ }
+ }
+
+ public class SourceEditorDisplayBindingWrapper : AbstractViewContent
+ {
+ internal SourceEditor se;
+
+ public override Gtk.Widget Control {
+ get {
+ return textAreaControl;
+ }
+ }
+
+ public override string TabPageText {
+ get {
+ return "${res:FormsDesigner.DesignTabPages.SourceTabPage}";
+ }
+ }
+
+ public SourceEditorDisplayBindingWrapper ()
+ {
+ }
+
+ public override void RedrawContent()
+ {
+ }
+
+ public override void Dispose()
+ {
+ }
+
+ public override bool IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ public override void Save (string fileName)
+ {
+ }
+
+ public override void Load (string fileName)
+ {
+ }
+ }
+}
Added: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorWidget.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorWidget.cs 2004-01-27 00:09:49 UTC (rev 663)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorWidget.cs 2004-01-27 01:00:28 UTC (rev 664)
@@ -0,0 +1,41 @@
+using Gtk;
+using GtkSharp;
+
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+
+namespace MonoDevelop.SourceEditor.Gui {
+ public class SourceEditor : ScrolledWindow {
+ SourceView sv;
+ SourceBuffer sb;
+ SourceLanguagesManager slm = new SourceLanguagesManager ();
+
+ public SourceEditor ()
+ {
+ sb = new SourceBuffer (new SourceTagTable ());
+ sv = new SourceView (sb);
+
+ sv.AutoIndent = true;
+ sv.SmartHomeEnd = true;
+ sv.ShowLineNumbers = true;
+ sv.ShowLineMarkers = true;
+ sb.Highlight = true;
+
+ Add (sv);
+ }
+
+ public void LoadFile (string file, string mime)
+ {
+ LoadText (File.OpenText (file).ReadToEnd (), mime);
+ }
+
+ public void LoadText (string text, string mime)
+ {
+ sb.Text = text;
+ sb.Language = slm.GetLanguageFromMimeType (mime);
+ }
+
+ public string Text { get { return sb.Text; } }
+ }
+}
\ No newline at end of file
Added: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Makefile
===================================================================
More information about the Monodevelop-patches-list
mailing list