[Monodevelop-patches-list] r1944 - in branches/MonoDevelop-plan-43: . src/Plugins src/Plugins/CSharp src/Plugins/Editor
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Sun Aug 15 08:27:11 EDT 2004
Author: jzwart
Date: 2004-08-15 08:27:11 -0400 (Sun, 15 Aug 2004)
New Revision: 1944
Added:
branches/MonoDevelop-plan-43/src/Plugins/CSharp/
branches/MonoDevelop-plan-43/src/Plugins/CSharp/CSharpFileNode.cs
branches/MonoDevelop-plan-43/src/Plugins/CSharp/CSharpNodeViewer.cs
branches/MonoDevelop-plan-43/src/Plugins/CSharp/CSharpNodeViewerFactory.cs
branches/MonoDevelop-plan-43/src/Plugins/CSharp/csharp.build
branches/MonoDevelop-plan-43/src/Plugins/CSharp/csharp.plugin.in
Modified:
branches/MonoDevelop-plan-43/ChangeLog
branches/MonoDevelop-plan-43/src/Plugins/Editor/EditorManager.cs
branches/MonoDevelop-plan-43/src/Plugins/Editor/TextNodeViewer.cs
branches/MonoDevelop-plan-43/src/Plugins/plugins.build
Log:
2004-08-15 Jeroen Zwartepoorte <jeroen at xs4all.nl>
* src/Plugins/plugins.build: add csharp.build.
* src/Plugins/CSharp/*: new C# specific classes: CSharpNodeViewer and
Factory and a CSharpFileNode. It should allow you to open a .cs file and
have it highlighted properly in the editor, *if* gnome-vfs says the .cs
file has a 'text/x-csharp' mimetype (which it doesn't here).
* src/Plugins/Editor/EditorManager.cs: create a SourceBuffer for the
EditorView.
* src/Plugins/Editor/TextNodeViewer.cs: don't return a structure widget.
Modified: branches/MonoDevelop-plan-43/ChangeLog
===================================================================
--- branches/MonoDevelop-plan-43/ChangeLog 2004-08-15 11:29:29 UTC (rev 1943)
+++ branches/MonoDevelop-plan-43/ChangeLog 2004-08-15 12:27:11 UTC (rev 1944)
@@ -1,5 +1,16 @@
2004-08-15 Jeroen Zwartepoorte <jeroen at xs4all.nl>
+ * src/Plugins/plugins.build: add csharp.build.
+ * src/Plugins/CSharp/*: new C# specific classes: CSharpNodeViewer and
+ Factory and a CSharpFileNode. It should allow you to open a .cs file and
+ have it highlighted properly in the editor, *if* gnome-vfs says the .cs
+ file has a 'text/x-csharp' mimetype (which it doesn't here).
+ * src/Plugins/Editor/EditorManager.cs: create a SourceBuffer for the
+ EditorView.
+ * src/Plugins/Editor/TextNodeViewer.cs: don't return a structure widget.
+
+2004-08-15 Jeroen Zwartepoorte <jeroen at xs4all.nl>
+
* src/Plugins/Editor/TextNodeViewer.cs: Renamed EditorNodeViewer: better
name for a generic editor viewer.
* src/Plugins/Editor/TextNodeViewerFactory.cs: idem.
Added: branches/MonoDevelop-plan-43/src/Plugins/CSharp/CSharpFileNode.cs
===================================================================
--- branches/MonoDevelop-plan-43/src/Plugins/CSharp/CSharpFileNode.cs 2004-08-15 11:29:29 UTC (rev 1943)
+++ branches/MonoDevelop-plan-43/src/Plugins/CSharp/CSharpFileNode.cs 2004-08-15 12:27:11 UTC (rev 1944)
@@ -0,0 +1,33 @@
+//
+// CSharpFileNode.cs: Class for text files.
+//
+// Author:
+// Jeroen Zwartepoorte <jeroen at xs4all.nl>
+//
+// (C) Copyright Jeroen Zwartepoorte 2004
+//
+
+using MonoDevelop.Node;
+using log4net;
+
+namespace MonoDevelop.CSharp {
+ public class CSharpFileNode : TextFileNode {
+ static private readonly ILog log = LogManager.GetLogger (typeof (CSharpFileNode));
+
+ public CSharpFileNode (Project project, Node parent, string filename)
+ : base (project, parent, filename)
+ {
+ log.Debug ("Created instance of CSharpFileNode");
+ }
+
+ public static new void InitializePlugin (byte major, byte minor)
+ {
+ FileNode.RegisterFileNodeType ("text/x-csharp", "C# source file",
+ typeof (CSharpFileNode), null);
+ }
+
+ public static new void FinalizePlugin ()
+ {
+ }
+ }
+}
Added: branches/MonoDevelop-plan-43/src/Plugins/CSharp/CSharpNodeViewer.cs
===================================================================
--- branches/MonoDevelop-plan-43/src/Plugins/CSharp/CSharpNodeViewer.cs 2004-08-15 11:29:29 UTC (rev 1943)
+++ branches/MonoDevelop-plan-43/src/Plugins/CSharp/CSharpNodeViewer.cs 2004-08-15 12:27:11 UTC (rev 1944)
@@ -0,0 +1,103 @@
+//
+// CSharpNodeViewer.cs: Node viewer for text/* mimetypes.
+//
+// Author:
+// Jeroen Zwartepoorte <jeroen at xs4all.nl>
+//
+// (C) Copyright Jeroen Zwartepoorte 2004
+//
+
+using System;
+using System.IO;
+using System.Text;
+using Gtk;
+using GtkSourceView;
+using MonoDevelop.Content;
+using MonoDevelop.Editor;
+using MonoDevelop.Node;
+using log4net;
+
+namespace MonoDevelop.CSharp {
+ public class CSharpNodeViewer : AbstractNodeViewer {
+ static private readonly ILog log = LogManager.GetLogger (typeof (CSharpNodeViewer));
+
+ private ScrolledWindow viewer;
+ private SourceBuffer buffer;
+ private EditorView editor;
+ private string description;
+ private string title;
+ private Gdk.Pixbuf icon;
+ private SourceLanguagesManager slm;
+
+ public CSharpNodeViewer (Context context) : base (context)
+ {
+ viewer = new ScrolledWindow ();
+ viewer.ShadowType = ShadowType.In;
+ editor = EditorManager.CreateEditor ();
+ buffer = editor.Buffer as SourceBuffer;
+ viewer.Add (editor);
+
+ slm = new SourceLanguagesManager ();
+ SourceLanguage lang = slm.GetLanguageFromMimeType ("text/x-csharp");
+ if (lang != null) {
+ buffer.Highlight = true;
+ buffer.Language = lang;
+ } else {
+ log.Error ("No SourceLanguage for 'text/x-csharp' mimetype");
+ }
+
+ CSharpFileNode node = (CSharpFileNode)context.Node;
+ LoadText (node.Buffer.Reader);
+ }
+
+ public override Widget StructureWidget {
+ get {
+ return null;
+ }
+ }
+
+ public override Widget ViewerWidget {
+ get {
+ return viewer;
+ }
+ }
+
+ public new string ViewerDescription {
+ get {
+ return description;
+ }
+ }
+
+ public new string ViewerTitle {
+ get {
+ return title;
+ }
+ }
+
+ public new Gdk.Pixbuf ViewerIcon {
+ get {
+ return icon;
+ }
+ }
+
+ private void LoadText (Stream reader)
+ {
+ StreamReader sr = new StreamReader (reader);
+ string line;
+ buffer.Text = "";
+ while ((line = sr.ReadLine ()) != null) {
+ log.Debug (line);
+ buffer.Text += line + "\n";
+ }
+ }
+
+ public static void InitializePlugin (byte major, byte minor)
+ {
+ ContentManager.AddNodeViewerFactory (new CSharpNodeViewerFactory ());
+ }
+
+ public static void FinalizePlugin ()
+ {
+ }
+ }
+}
Added: branches/MonoDevelop-plan-43/src/Plugins/CSharp/CSharpNodeViewerFactory.cs
===================================================================
--- branches/MonoDevelop-plan-43/src/Plugins/CSharp/CSharpNodeViewerFactory.cs 2004-08-15 11:29:29 UTC (rev 1943)
+++ branches/MonoDevelop-plan-43/src/Plugins/CSharp/CSharpNodeViewerFactory.cs 2004-08-15 12:27:11 UTC (rev 1944)
@@ -0,0 +1,30 @@
+//
+// CSharpNodeViewerFactory.cs: Node viewer factory for text/x-csharp mimetypes.
+//
+// Author:
+// Jeroen Zwartepoorte <jeroen at xs4all.nl>
+//
+// (C) Copyright Jeroen Zwartepoorte 2004
+//
+
+using System;
+using MonoDevelop.Content;
+using MonoDevelop.Node;
+
+namespace MonoDevelop.CSharp {
+ public class CSharpNodeViewerFactory : INodeViewerFactory {
+ public CSharpNodeViewerFactory ()
+ {
+ }
+
+ public bool CanDisplayNode (Node node)
+ {
+ return node is CSharpFileNode;
+ }
+
+ public INodeViewer CreateNodeViewer (Context context)
+ {
+ return new CSharpNodeViewer (context);
+ }
+ }
+}
Added: branches/MonoDevelop-plan-43/src/Plugins/CSharp/csharp.build
===================================================================
--- branches/MonoDevelop-plan-43/src/Plugins/CSharp/csharp.build 2004-08-15 11:29:29 UTC (rev 1943)
+++ branches/MonoDevelop-plan-43/src/Plugins/CSharp/csharp.build 2004-08-15 12:27:11 UTC (rev 1944)
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<project name="monodevelop.plugins.csharp" default="build">
+ <!-- build the project -->
+ <target name="build" description="compiles the source code">
+ <property name="assemblyfile" value="${path::combine(plugin.dir, 'csharp.dll')}"/>
+ <csc target="library" output="${assemblyfile}" debug="${build.debug}">
+ <arg value="${gtk-sharp.libs}"/>
+ <arg value="${gtksourceview-sharp.libs}"/>
+ <sources>
+ <include name="*.cs"/>
+ </sources>
+ <references>
+ <include name="${lib.dir}/log4net.dll"/>
+ <include name="${bin.dir}/monodevelop.exe"/>
+ <include name="${lib.dir}/gdl-sharp.dll"/>
+ <include name="${plugin.dir}/node.dll"/>
+ <include name="${plugin.dir}/workbench.dll"/>
+ <include name="${plugin.dir}/content.dll"/>
+ <include name="${plugin.dir}/editor.dll"/>
+ </references>
+ </csc>
+
+ <!-- install the plugin file -->
+ <copy file="csharp.plugin.in" tofile="csharp.plugin">
+ <filterchain>
+ <replacetokens>
+ <token key="assembly" value="${assemblyfile}"/>
+ </replacetokens>
+ </filterchain>
+ </copy>
+ <move file="csharp.plugin" todir="${plugin.dir}" overwrite="true"/>
+ </target>
+</project>
Added: branches/MonoDevelop-plan-43/src/Plugins/CSharp/csharp.plugin.in
===================================================================
--- branches/MonoDevelop-plan-43/src/Plugins/CSharp/csharp.plugin.in 2004-08-15 11:29:29 UTC (rev 1943)
+++ branches/MonoDevelop-plan-43/src/Plugins/CSharp/csharp.plugin.in 2004-08-15 12:27:11 UTC (rev 1944)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin version="1.0">
+ <assembly>@assembly@</assembly>
+ <class name="MonoDevelop.CSharp.CSharpFileNode"/>
+ <class name="MonoDevelop.CSharp.CSharpNodeViewer"/>
+</plugin>
Modified: branches/MonoDevelop-plan-43/src/Plugins/Editor/EditorManager.cs
===================================================================
--- branches/MonoDevelop-plan-43/src/Plugins/Editor/EditorManager.cs 2004-08-15 11:29:29 UTC (rev 1943)
+++ branches/MonoDevelop-plan-43/src/Plugins/Editor/EditorManager.cs 2004-08-15 12:27:11 UTC (rev 1944)
@@ -7,6 +7,8 @@
// (C) Copyright Jeroen Zwartepoorte 2004
//
+using GtkSourceView;
+
namespace MonoDevelop.Editor {
public class EditorManager {
private int tabSize;
@@ -23,6 +25,7 @@
// FIXME: the following properties should be retrieved
// from the config system (GConf?).
editor.AutoIndent = true;
+ editor.Buffer = new SourceBuffer (new SourceTagTable ());
editor.InsertSpacesInsteadOfTabs = false;
editor.Margin = 80;
editor.ShowLineNumbers = true;
Modified: branches/MonoDevelop-plan-43/src/Plugins/Editor/TextNodeViewer.cs
===================================================================
--- branches/MonoDevelop-plan-43/src/Plugins/Editor/TextNodeViewer.cs 2004-08-15 11:29:29 UTC (rev 1943)
+++ branches/MonoDevelop-plan-43/src/Plugins/Editor/TextNodeViewer.cs 2004-08-15 12:27:11 UTC (rev 1944)
@@ -19,8 +19,6 @@
public class TextNodeViewer : AbstractNodeViewer {
static private readonly ILog log = LogManager.GetLogger (typeof (TextNodeViewer));
- private ScrolledWindow structure;
- private TreeView tree;
private ScrolledWindow viewer;
private TextBuffer buffer;
private EditorView editor;
@@ -30,11 +28,6 @@
public TextNodeViewer (Context context) : base (context)
{
- structure = new ScrolledWindow ();
- structure.ShadowType = ShadowType.In;
- tree = new TreeView ();
- structure.Add (tree);
-
viewer = new ScrolledWindow ();
viewer.ShadowType = ShadowType.In;
editor = EditorManager.CreateEditor ();
@@ -47,7 +40,7 @@
public override Widget StructureWidget {
get {
- return structure;
+ return null;
}
}
Modified: branches/MonoDevelop-plan-43/src/Plugins/plugins.build
===================================================================
--- branches/MonoDevelop-plan-43/src/Plugins/plugins.build 2004-08-15 11:29:29 UTC (rev 1943)
+++ branches/MonoDevelop-plan-43/src/Plugins/plugins.build 2004-08-15 12:27:11 UTC (rev 1944)
@@ -20,5 +20,7 @@
<nant buildfile="Content/content.build" target="build"/>
<!-- build MonoDevelop.Editor assembly -->
<nant buildfile="Editor/editor.build" target="build"/>
+ <!-- build MonoDevelop.CSharp assembly -->
+ <nant buildfile="CSharp/csharp.build" target="build"/>
</target>
</project>
More information about the Monodevelop-patches-list
mailing list