[Monodevelop-patches-list] r1155 - in trunk/MonoDevelop: . build/data/templates/project/CSharp src/AddIns/DisplayBindings/SourceEditor src/AddIns/DisplayBindings/SourceEditor/CodeCompletion src/AddIns/DisplayBindings/SourceEditor/Codons src/AddIns/DisplayBindings/SourceEditor/Commands src/AddIns/DisplayBindings/SourceEditor/Gui src/AddIns/DisplayBindings/SourceEditor/Gui/Dialogs src/AddIns/DisplayBindings/SourceEditor/Gui/OptionPanels src/Main/Base/Gui/Components/StatusBar src/Main/Base/Services/StatusBar
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Thu Mar 11 19:15:29 EST 2004
Author: jluke
Date: 2004-03-11 19:15:29 -0500 (Thu, 11 Mar 2004)
New Revision: 1155
Added:
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Dialogs/EditTemplateGroupDialog.cs
Removed:
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/EditTemplateGroupDialog.cs
Modified:
trunk/MonoDevelop/ChangeLog
trunk/MonoDevelop/build/data/templates/project/CSharp/Makefile.am
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionData.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionDataProvider.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CommentCompletionDataProvider.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionWindow.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/DeclarationViewWindow.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/TemplateCompletionDataProvider.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/TextUtilities.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Codons/EditActionCodon.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/BookmarkCommands.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/CodeActions.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/CommentRegionCommand.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/FoldingCommands.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/IEditAction.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/ProjectCommands.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/SearchCommands.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/TextAreaContextmenuCommands.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/ToolCommands.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Dialogs/ExportProjectToHtmlDialog.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/OptionPanels/BehaviorTextEditorPanel.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorWidget.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Makefile.am
trunk/MonoDevelop/src/Main/Base/Gui/Components/StatusBar/SdStatusBar.cs
trunk/MonoDevelop/src/Main/Base/Services/StatusBar/DefaultStatusBarService.cs
trunk/MonoDevelop/src/Main/Base/Services/StatusBar/IStatusBarService.cs
Log:
code formatting changes while reading through the SourceEditor
simplify the StatusBar Cursor position to work off of 3 ints
partially port ExportProjectToHtml and fix the Makefile.am
to have the right files in the Dialog subdir
and maybe something else I forgot
Modified: trunk/MonoDevelop/ChangeLog
===================================================================
--- trunk/MonoDevelop/ChangeLog 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/ChangeLog 2004-03-12 00:15:29 UTC (rev 1155)
@@ -1,3 +1,22 @@
+2004-03-11 John Luke <jluke at cfl.rr.com>
+
+ * src/AddIns/DisplayBindings/SourceEditor/:
+ CompletionWindow: subclass properly and
+ remove KeyRelease for CompletionWindow
+
+ partially port ExportToProjectHtml and add it to Makefile.am
+
+ mv EditTemplateGroupDialog to Dialogs subdir
+ and update Makefile.am
+
+ * src/Main/Base/Services/StatusBar:
+ make statusbar accept 3 ints
+ do the work in the service
+
+ * src/Libraries/CsVbParser:
+ import CsVbParser from SD, in hopes of fixing our
+ horribly broken one
+
2004-03-10 John Luke <jluke at cfl.rr.com>
* README: add monodoc and debugger to list of deps
Modified: trunk/MonoDevelop/build/data/templates/project/CSharp/Makefile.am
===================================================================
--- trunk/MonoDevelop/build/data/templates/project/CSharp/Makefile.am 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/build/data/templates/project/CSharp/Makefile.am 2004-03-12 00:15:29 UTC (rev 1155)
@@ -2,7 +2,8 @@
monodevelopdir = $(prefix)/lib/monodevelop
cstemplatedir = $(monodevelopdir)/data/templates/project/CSharp
-cstemplate_DATA = ConsoleProject.xpt \
+cstemplate_DATA = AspNetProject.xpt \
+ ConsoleProject.xpt \
GnomeSharpProject.xpt \
Library.xpt \
EmptyProject.xpt \
@@ -14,3 +15,4 @@
EXTRA_DIST = $(cstemplate_DATA)
+
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionData.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionData.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionData.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -14,26 +14,28 @@
using SharpDevelop.Internal.Parser;
using MonoDevelop.Services;
using MonoDevelop.Core.Services;
-
using MonoDevelop.SourceEditor.Gui;
-namespace MonoDevelop.SourceEditor.CodeCompletion {
- class CodeCompletionData : ICompletionDataWithMarkup {
- static ClassBrowserIconsService classBrowserIconService = (ClassBrowserIconsService)ServiceManager.Services.GetService(typeof(ClassBrowserIconsService));
- static IParserService parserService = (IParserService)MonoDevelop.Core.Services.ServiceManager.Services.GetService(typeof(IParserService));
- static AmbienceService ambienceService = (AmbienceService)ServiceManager.Services.GetService(typeof(AmbienceService));
+namespace MonoDevelop.SourceEditor.CodeCompletion
+{
+ class CodeCompletionData : ICompletionDataWithMarkup
+ {
+ ClassBrowserIconsService classBrowserIconService = (ClassBrowserIconsService) ServiceManager.Services.GetService (typeof (ClassBrowserIconsService));
+ IParserService parserService = (IParserService) MonoDevelop.Core.Services.ServiceManager.Services.GetService (typeof (IParserService));
+ static AmbienceService ambienceService = (AmbienceService) ServiceManager.Services.GetService (typeof (AmbienceService));
- string image;
- int overloads;
- string text;
- string description;
- string pango_description;
- string documentation;
- string completionString;
- IClass c;
- bool convertedDocumentation = false;
+ string image;
+ int overloads;
+ string text;
+ string description;
+ string pango_description;
+ string documentation;
+ string completionString;
+ IClass c;
+ bool convertedDocumentation = false;
- static IAmbience PangoAmbience {
+ static IAmbience PangoAmbience
+ {
get {
IAmbience asvc = ambienceService.CurrentAmbience;
asvc.ConversionFlags |= ConversionFlags.IncludePangoMarkup;
@@ -41,7 +43,8 @@
}
}
- public int Overloads {
+ public int Overloads
+ {
get {
return overloads;
}
@@ -50,7 +53,8 @@
}
}
- public string Image {
+ public string Image
+ {
get {
return image;
}
@@ -59,7 +63,8 @@
}
}
- public string[] Text {
+ public string[] Text
+ {
get {
return new string[] { text };
}
@@ -67,7 +72,9 @@
text = value[0];
}
}
- public string Description {
+
+ public string Description
+ {
get {
// get correct delegate description (when description is requested)
// in the classproxies aren't methods saved, therefore delegate methods
@@ -105,7 +112,8 @@
}
}
- public string DescriptionPango {
+ public string DescriptionPango
+ {
get {
// get correct delegate description (when description is requested)
// in the classproxies aren't methods saved, therefore delegate methods
@@ -143,7 +151,7 @@
}
}
- public CodeCompletionData(string s, string image)
+ public CodeCompletionData (string s, string image)
{
description = pango_description = documentation = String.Empty;
text = s;
@@ -151,7 +159,7 @@
this.image = image;
}
- public CodeCompletionData(IClass c)
+ public CodeCompletionData (IClass c)
{
// save class (for the delegate description shortcut
this.c = c;
@@ -163,7 +171,7 @@
documentation = c.Documentation;
}
- public CodeCompletionData(IMethod method)
+ public CodeCompletionData (IMethod method)
{
image = classBrowserIconService.GetIcon(method);
text = method.Name;
@@ -173,7 +181,7 @@
documentation = method.Documentation;
}
- public CodeCompletionData(IField field)
+ public CodeCompletionData (IField field)
{
image = classBrowserIconService.GetIcon(field);
text = field.Name;
@@ -183,7 +191,7 @@
documentation = field.Documentation;
}
- public CodeCompletionData(IProperty property)
+ public CodeCompletionData (IProperty property)
{
image = classBrowserIconService.GetIcon(property);
text = property.Name;
@@ -193,7 +201,7 @@
documentation = property.Documentation;
}
- public CodeCompletionData(IEvent e)
+ public CodeCompletionData (IEvent e)
{
image = classBrowserIconService.GetIcon(e);
text = e.Name;
@@ -203,12 +211,12 @@
documentation = e.Documentation;
}
- public void InsertAction(SourceEditorView control)
+ public void InsertAction (SourceEditorView control)
{
control.Buffer.InsertAtCursor (completionString);
}
- public static string GetDocumentation(string doc)
+ public static string GetDocumentation (string doc)
{
System.IO.StringReader reader = new System.IO.StringReader("<docroot>" + doc + "</docroot>");
XmlTextReader xml = new XmlTextReader(reader);
@@ -247,18 +255,24 @@
} else if (xml.NodeType == XmlNodeType.Text) {
ret.Append(whitespace.Replace(xml.Value, " "));
}
- } while(xml.Read());
+ } while (xml.Read ());
} catch {
return doc;
}
- return ret.ToString();
+ return ret.ToString ();
}
- static string GetCref(string cref)
+ static string GetCref (string cref)
{
- if (cref == null) return "";
- if (cref.Length < 2) return cref;
- if (cref.Substring(1, 1) == ":") return cref.Substring(2, cref.Length - 2);
+ if (cref == null)
+ return "";
+
+ if (cref.Length < 2)
+ return cref;
+
+ if (cref.Substring(1, 1) == ":")
+ return cref.Substring (2, cref.Length - 2);
+
return cref;
}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionDataProvider.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionDataProvider.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionDataProvider.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -46,8 +46,8 @@
{
//FIXME: THIS IS A HACK
string lang = "C#";
- Console.WriteLine ("resolve " + lang);
- Console.WriteLine ("nm " + fileName);
+ //Console.WriteLine ("resolve " + lang);
+ //Console.WriteLine ("nm " + fileName);
completionData = new ArrayList();
this.fileName = fileName;
@@ -63,6 +63,7 @@
if (expression.Length == 0) {
return null;
}
+
IParserService parserService = (IParserService)MonoDevelop.Core.Services.ServiceManager.Services.GetService(typeof(IParserService));
if (charTyped == ' ') {
if (expression == "using" || expression.EndsWith(" using") || expression.EndsWith("\tusing")|| expression.EndsWith("\nusing")|| expression.EndsWith("\rusing")) {
@@ -89,7 +90,7 @@
} else {
//FIXME: I added the null check, #D doesnt need it, why do we?
if (fileName != null) {
- Console.WriteLine ("resolve " + lang);
+ //Console.WriteLine ("resolve " + lang);
results = parserService.Resolve(expression,
caretLineNumber,
caretColumn,
@@ -100,10 +101,10 @@
}
}
- return (ICompletionData[])completionData.ToArray(typeof(ICompletionData));
+ return (ICompletionData[]) completionData.ToArray (typeof (ICompletionData));
}
- void AddResolveResults(ResolveResult results)
+ void AddResolveResults (ResolveResult results)
{
if (results != null) {
completionData.Capacity += results.Namespaces.Count +
@@ -111,31 +112,31 @@
if (results.Namespaces != null && results.Namespaces.Count > 0) {
foreach (string s in results.Namespaces) {
- completionData.Add(new CodeCompletionData(s, Stock.NameSpace));
+ completionData.Add (new CodeCompletionData (s, Stock.NameSpace));
}
}
if (results.Members != null && results.Members.Count > 0) {
foreach (object o in results.Members) {
if (o is IClass) {
- completionData.Add(new CodeCompletionData((IClass)o));
+ completionData.Add (new CodeCompletionData ((IClass)o));
} else if (o is IProperty) {
- IProperty property = (IProperty)o;
+ IProperty property = (IProperty) o;
if (property.Name != null && insertedPropertiesElements[property.Name] == null) {
- completionData.Add(new CodeCompletionData(property));
+ completionData.Add (new CodeCompletionData (property));
insertedPropertiesElements[property.Name] = property;
}
} else if (o is IMethod) {
- IMethod method = (IMethod)o;
+ IMethod method = (IMethod) o;
if (method.Name != null && insertedElements[method.Name] == null && !method.IsConstructor) {
- completionData.Add(new CodeCompletionData(method));
+ completionData.Add (new CodeCompletionData(method));
insertedElements[method.Name] = method;
}
} else if (o is IField) {
- completionData.Add(new CodeCompletionData((IField)o));
+ completionData.Add (new CodeCompletionData ((IField)o));
} else if (o is IEvent) {
- IEvent e = (IEvent)o;
+ IEvent e = (IEvent) o;
if (e.Name != null && insertedEventElements[e.Name] == null) {
- completionData.Add(new CodeCompletionData(e));
+ completionData.Add (new CodeCompletionData (e));
insertedEventElements[e.Name] = e;
}
}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CommentCompletionDataProvider.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CommentCompletionDataProvider.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CommentCompletionDataProvider.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -20,11 +20,13 @@
using MonoDevelop.SourceEditor.Gui;
using Stock = MonoDevelop.Gui.Stock;
-namespace MonoDevelop.SourceEditor.CodeCompletion {
+namespace MonoDevelop.SourceEditor.CodeCompletion
+{
/// <summary>
/// Data provider for code completion.
/// </summary>
- public class CommentCompletionDataProvider : ICompletionDataProvider {
+ public class CommentCompletionDataProvider : ICompletionDataProvider
+ {
static ClassBrowserIconsService classBrowserIconService = (ClassBrowserIconsService)ServiceManager.Services.GetService(typeof(ClassBrowserIconsService));
static IParserService parserService = (IParserService)MonoDevelop.Core.Services.ServiceManager.Services.GetService(typeof(IParserService));
@@ -56,12 +58,12 @@
/// <remarks>
/// Returns true, if the given coordinates (row, column) are in the region.
/// </remarks>
- bool IsBetween(int row, int column, IRegion region)
+ bool IsBetween (int row, int column, IRegion region)
{
return row >= region.BeginLine && (row <= region.EndLine || region.EndLine == -1);
}
- public ICompletionData[] GenerateCompletionData(string fileName, SourceEditorView textArea, char charTyped)
+ public ICompletionData[] GenerateCompletionData (string fileName, SourceEditorView textArea, char charTyped)
{
/*caretLineNumber = textArea.Caret.Line;
caretColumn = textArea.Caret.Column;
@@ -71,11 +73,11 @@
return null;
}
*/
- ArrayList completionData = new ArrayList();
+ ArrayList completionData = new ArrayList ();
/*foreach (string[] tag in commentTags) {
completionData.Add(new CommentCompletionData(tag[0], tag[1]));
}*/
- return (ICompletionData[])completionData.ToArray(typeof(ICompletionData));
+ return (ICompletionData[])completionData.ToArray (typeof (ICompletionData));
}
class CommentCompletionData : ICompletionData
@@ -83,32 +85,35 @@
string text;
string description;
- public string Image {
+ public string Image
+ {
get {
return Stock.Method;
}
}
- public string[] Text {
+ public string[] Text
+ {
get {
return new string[] { text };
}
}
- public string Description {
+ public string Description
+ {
get {
return description;
}
}
- public void InsertAction(SourceEditorView control)
+ public void InsertAction (SourceEditorView control)
{
//((SharpDevelopTextAreaControl)control).ActiveTextAreaControl.TextArea.InsertString(text);
}
- public CommentCompletionData(string text, string description)
+ public CommentCompletionData (string text, string description)
{
- this.text = text;
+ this.text = text;
this.description = description;
}
}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionWindow.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionWindow.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionWindow.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -7,12 +7,9 @@
using System;
using System.Drawing;
-using System.Reflection;
using System.Collections;
using Gtk;
-using GtkSharp;
-
using MonoDevelop.SourceEditor.Gui;
namespace MonoDevelop.SourceEditor.CodeCompletion
@@ -20,24 +17,23 @@
public class CompletionWindow : Window
{
const int DeclarationIndent = 1;
- static GLib.GType type;
- Gtk.TreeViewColumn complete_column;
+ private static GLib.GType gtype;
+ TreeViewColumn complete_column;
ICompletionDataProvider completionDataProvider;
- SourceEditorView control;
- Gtk.TreeView listView;
- Gtk.TreeStore store;
- DeclarationViewWindow declarationviewwindow = new DeclarationViewWindow();
- Gdk.Pixbuf[] imgList;
- int insertLength = 0;
+ SourceEditorView control;
+ TreeView listView;
+ TreeStore store;
+ DeclarationViewWindow declarationviewwindow = new DeclarationViewWindow ();
+ int insertLength = 0;
- string GetTypedString()
+ string GetTypedString ()
{
TextIter startIter = control.Buffer.GetIterAtMark (control.Buffer.InsertMark);
TextIter offsetIter = control.Buffer.GetIterAtOffset (startIter.Offset - insertLength);
return control.Buffer.GetText (offsetIter, startIter, true);
}
-
+
void DeleteInsertion()
{
if (insertLength > 0) {
@@ -48,23 +44,6 @@
control.Buffer.MoveMark (control.Buffer.InsertMark, control.Buffer.GetIterAtOffset (newPos));
}
}
-
- // Lame fix. The backspace press event is not being caught. The release event yes, though
- // ???
- void ListKeyreleaseEvent(object sender, KeyReleaseEventArgs ex) {
- if (ex.Event.Key == Gdk.Key.BackSpace) {
- //Console.WriteLine("Got BackSpace on key release");
- TextIter insertIter = control.Buffer.GetIterAtMark (control.Buffer.InsertMark);
- TextIter oneCharBackIter = control.Buffer.GetIterAtOffset (insertIter.Offset == 0 ? insertIter.Offset : insertIter.Offset- 1);
- control.Buffer.Delete (insertIter, oneCharBackIter);
- if (insertLength > 0) {
- --insertLength;
- } else {
- // no need to delete here (insertLength <= 0)
- LostFocusListView(null, null);
- }
- }
- }
protected override bool OnKeyPressEvent (Gdk.EventKey e)
{
@@ -81,7 +60,7 @@
return base.OnKeyPressEvent (e);
}
- void ListKeypressEvent(object sender, KeyPressEventArgs ex)
+ void ListKeypressEvent (object sender, KeyPressEventArgs ex)
{
Gdk.Key key = ex.Event.Key;
char val = (char) key;
@@ -95,16 +74,16 @@
return;
case Gdk.Key.Escape:
- LostFocusListView(null, null);
+ LostFocusListView (null, null);
ex.RetVal = true;
return;
default:
- if (val != '_' && !Char.IsLetterOrDigit(val)) {
- if (listView.Selection.CountSelectedRows() > 0) {
- ActivateItem(null, null);
+ if (val != '_' && !Char.IsLetterOrDigit (val)) {
+ if (listView.Selection.CountSelectedRows () > 0) {
+ ActivateItem (null, null);
} else {
- LostFocusListView(null, null);
+ LostFocusListView (null, null);
}
//control.Buffer.InsertAtCursor (val.ToString ());
@@ -121,13 +100,13 @@
int lastSelected = -1;
int capitalizationIndex = -1;
- string typedString = GetTypedString();
+ string typedString = GetTypedString ();
TreeIter iter;
int i = 0;
- for (store.GetIterFirst(out iter); store.IterNext(out iter) == true; i++) {
- string text = (string)store.GetValue(iter, 0);
+ for (store.GetIterFirst (out iter); store.IterNext (out iter) == true; i++) {
+ string text = (string) store.GetValue (iter, 0);
- if (text.ToUpper().StartsWith(typedString.ToUpper())) {
+ if (text.ToUpper ().StartsWith (typedString.ToUpper ())) {
int currentCapitalizationIndex = 0;
for (int j = 0; j < typedString.Length && j < text.Length; ++j) {
if (typedString[j] == text[j]) {
@@ -142,18 +121,18 @@
}
}
- listView.Selection.UnselectAll();
+ listView.Selection.UnselectAll ();
if (lastSelected != -1) {
- TreePath path = new TreePath("" + (lastSelected + 1));
- listView.Selection.SelectPath(path);
+ TreePath path = new TreePath ("" + (lastSelected + 1));
+ listView.Selection.SelectPath (path);
listView.SetCursor (path, complete_column, false);
- listView.ScrollToCell(path, null, false, 0, 0);
+ listView.ScrollToCell (path, null, false, 0, 0);
}
ex.RetVal = true;
}
- void InitializeControls()
+ void InitializeControls ()
{
Decorated = false;
SkipPagerHint = true;
@@ -162,10 +141,9 @@
store = new Gtk.TreeStore (typeof (string), typeof (string), typeof(ICompletionData));
listView = new Gtk.TreeView (store);
-
listView.HeadersVisible = false;
- complete_column = new Gtk.TreeViewColumn ();
+ complete_column = new TreeViewColumn ();
complete_column.Title = "completion";
Gtk.CellRendererPixbuf pix_render = new Gtk.CellRendererPixbuf ();
@@ -185,25 +163,25 @@
Gtk.Frame frame = new Gtk.Frame ();
frame.Add (scroller);
- this.Add(frame);
+ this.Add (frame);
- listView.KeyPressEvent += new KeyPressEventHandler(ListKeypressEvent);
- listView.KeyReleaseEvent += new KeyReleaseEventHandler(ListKeyreleaseEvent);
- listView.FocusOutEvent += new FocusOutEventHandler(LostFocusListView);
- listView.RowActivated += new RowActivatedHandler(ActivateItem);
+ listView.KeyPressEvent += new KeyPressEventHandler (ListKeypressEvent);
+ //listView.KeyReleaseEvent += new KeyReleaseEventHandler(ListKeyreleaseEvent);
+ listView.FocusOutEvent += new FocusOutEventHandler (LostFocusListView);
+ listView.RowActivated += new RowActivatedHandler (ActivateItem);
listView.AddEvents ((int) (Gdk.EventMask.KeyPressMask));
}
/// <remarks>
/// Shows the filled completion window, if it has no items it isn't shown.
/// </remarks>
- public void ShowCompletionWindow(char firstChar)
+ public void ShowCompletionWindow (char firstChar)
{
- FillList(true, firstChar);
+ FillList (true, firstChar);
TreeIter iter;
- if (store.GetIterFirst(out iter) == false) {
- control.GrabFocus();
+ if (store.GetIterFirst (out iter) == false) {
+ control.GrabFocus ();
return;
}
@@ -217,65 +195,71 @@
control.BufferToWindowCoords (Gtk.TextWindowType.Widget, rect.X + rect.Width, rect.Y + rect.Height, out wx, out wy);
int tx, ty;
- control.GdkWindow.GetOrigin(out tx, out ty);
- Move(tx + wx, ty + wy);
+ control.GdkWindow.GetOrigin (out tx, out ty);
+ Move (tx + wx, ty + wy);
listView.Selection.Changed += new EventHandler (RowActivated);
ShowAll ();
}
+
string fileName;
- static CompletionWindow ()
+ public static new GLib.GType GType
{
- type = RegisterGType (typeof (CompletionWindow));
+ get
+ {
+ if (gtype == GLib.GType.Invalid)
+ gtype = RegisterGType (typeof (CompletionWindow));
+ return gtype;
+ }
}
/// <remarks>
/// Creates a new Completion window and puts it location under the caret
/// </remarks>
- public CompletionWindow (SourceEditorView control, string fileName, ICompletionDataProvider completionDataProvider) : base (type)
+ public CompletionWindow (SourceEditorView control, string fileName, ICompletionDataProvider completionDataProvider) : base (GType)
{
this.fileName = fileName;
this.completionDataProvider = completionDataProvider;
- this.control = control;
+ this.control = control;
- InitializeControls();
+ InitializeControls ();
}
/// <remarks>
/// Creates a new Completion window at a given location
/// </remarks>
- CompletionWindow (SourceEditorView control, Point location, ICompletionDataProvider completionDataProvider) : base (type)
+ CompletionWindow (SourceEditorView control, Point location, ICompletionDataProvider completionDataProvider) : base (GType)
{
this.completionDataProvider = completionDataProvider;
- this.control = control;
+ this.control = control;
- InitializeControls();
+ InitializeControls ();
}
- void ActivateItem(object sender, RowActivatedArgs e)
+ void ActivateItem (object sender, RowActivatedArgs e)
{
- if (listView.Selection.CountSelectedRows() > 0) {
+ if (listView.Selection.CountSelectedRows () > 0) {
TreeModel foo;
TreeIter iter;
- listView.Selection.GetSelected(out foo, out iter);
- ICompletionData data = (ICompletionData) store.GetValue(iter, 2);
- DeleteInsertion();
- data.InsertAction(control);
- LostFocusListView(null, null);
+ listView.Selection.GetSelected (out foo, out iter);
+ ICompletionData data = (ICompletionData) store.GetValue (iter, 2);
+ DeleteInsertion ();
+ data.InsertAction (control);
+ LostFocusListView (null, null);
}
}
- void LostFocusListView(object sender, FocusOutEventArgs e)
+ void LostFocusListView (object sender, FocusOutEventArgs e)
{
control.HasFocus = true;
declarationviewwindow.HideAll ();
- Hide();
+ this.Hide ();
}
- void FillList(bool firstTime, char ch)
+ void FillList (bool firstTime, char ch)
{
ICompletionData[] completionData = completionDataProvider.GenerateCompletionData(fileName, control, ch);
- Console.WriteLine ("testing");
+ //Console.WriteLine ("testing");
if (completionData == null || completionData.Length == 0) {
return;
}
@@ -287,7 +271,7 @@
store.SetSortColumnId (0, SortType.Ascending);
}
- void RowActivated (object sender, EventArgs a)
+ void RowActivated (object sender, EventArgs a)
{
Gtk.TreeIter iter;
Gtk.TreeModel model;
@@ -296,13 +280,14 @@
ICompletionData data = (ICompletionData) store.GetValue (iter, 2);
if (data == null)
return;
- //This code is for sizing the treeview properly.
+ // This code is for sizing the treeview properly.
Gtk.TreePath path = store.GetPath (iter);
Gdk.Rectangle backRect = listView.GetBackgroundArea (path, (Gtk.TreeViewColumn)listView.Columns[0]);
listView.HeightRequest = (backRect.Height * 5) + 2;
- //FIXME: This code is buggy, and generates a bad placement sometimes when you jump a lot. but it is better than 0,0
+ // FIXME: This code is buggy, and generates a bad placement sometimes when you jump a lot.
+ // but it is better than 0,0
Gdk.Rectangle rect = listView.GetCellArea (path, (Gtk.TreeViewColumn)listView.Columns[0]);
@@ -316,10 +301,12 @@
vert = listpos_y;
}
- //FIXME: This is a bad calc, its always on the right, it needs to test if thats too big, and if so, place on the left;
+ // FIXME: This is a bad calc, its always on the right,
+ // it needs to test if thats too big, and if so, place on the left;
int horiz = listpos_x + listView.GdkWindow.Size.Width + 30;
ICompletionDataWithMarkup wMarkup = data as ICompletionDataWithMarkup;
declarationviewwindow.Destroy ();
+
if (wMarkup != null) {
declarationviewwindow = new DeclarationViewWindow ();
declarationviewwindow.DescriptionMarkup = wMarkup.DescriptionPango;
@@ -332,9 +319,11 @@
return;
declarationviewwindow.ShowAll ();
+
if (listView.Screen.Width <= horiz + declarationviewwindow.GdkWindow.FrameExtents.Width) {
horiz = listpos_x - declarationviewwindow.GdkWindow.FrameExtents.Width - 10;
}
+
declarationviewwindow.Move (horiz, vert);
}
}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/DeclarationViewWindow.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/DeclarationViewWindow.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/DeclarationViewWindow.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -11,15 +11,15 @@
using System.Collections;
using Gtk;
-using GtkSharp;
namespace MonoDevelop.SourceEditor.CodeCompletion
{
- public class DeclarationViewWindow : Gtk.Window
+ public class DeclarationViewWindow : Window
{
Label label;
- public string DescriptionMarkup {
+ public string DescriptionMarkup
+ {
get {
return label.Text;
}
@@ -32,9 +32,9 @@
public DeclarationViewWindow () : base (WindowType.Popup)
{
- Gtk.Frame frame = new Gtk.Frame ();
+ Frame frame = new Frame ();
frame.Add (label = new Label (""));
- Add (frame);
+ this.Add (frame);
}
}
}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/TemplateCompletionDataProvider.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/TemplateCompletionDataProvider.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/TemplateCompletionDataProvider.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -12,13 +12,15 @@
using MonoDevelop.Core.Properties;
using MonoDevelop.Internal.Templates;
-
using MonoDevelop.SourceEditor.Gui;
using Stock = MonoDevelop.Gui.Stock;
-namespace MonoDevelop.SourceEditor.CodeCompletion {
- public class TemplateCompletionDataProvider : ICompletionDataProvider {
- public Gdk.Pixbuf[] ImageList {
+namespace MonoDevelop.SourceEditor.CodeCompletion
+{
+ public class TemplateCompletionDataProvider : ICompletionDataProvider
+ {
+ public Gdk.Pixbuf[] ImageList
+ {
get {
return null;
}
@@ -42,19 +44,22 @@
{
CodeTemplate template;
- public string Image {
+ public string Image
+ {
get {
return Stock.Method;
}
}
- public string[] Text {
+ public string[] Text
+ {
get {
return new string[] { template.Shortcut, template.Description };
}
}
- public string Description {
+ public string Description
+ {
get {
return template.Text;
}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/TextUtilities.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/TextUtilities.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/TextUtilities.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -62,7 +62,8 @@
return true;
}
- public enum CharacterType {
+ public enum CharacterType
+ {
LetterDigitOrUnderscore,
WhiteSpace,
Other
@@ -75,7 +76,7 @@
/// </remarks>
public static string GetExpressionBeforeOffset(SourceEditorView textArea, int offset)
{
- // HACK HACK we should actually use GtkTextIter's
+ // FIXME: we should actually use GtkTextIter's
string text = textArea.Buffer.Text;
while (offset - 1 > 0) {
@@ -244,7 +245,7 @@
*/
static bool ScanLineComment(SourceEditorView document, int offset)
{
- // HACK HACK: use iters
+ // FIXME: use iters
string text = document.Buffer.Text;
while (offset > 0 && offset < document.Buffer.Text.Length) {
char ch = text [offset];
@@ -265,14 +266,11 @@
public static int SearchBracketBackward(SourceEditorView document, int offset, char openBracket, char closingBracket)
{
- // HACK HACK: use iters
- string text = document.Buffer.Text;
-
- int brackets = -1;
-
+ // FIXME: use iters
+ string text = document.Buffer.Text;
+ int brackets = -1;
bool inString = false;
- bool inChar = false;
-
+ bool inChar = false;
bool blockComment = false;
while (offset >= 0 && offset < document.Buffer.Text.Length) {
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Codons/EditActionCodon.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Codons/EditActionCodon.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Codons/EditActionCodon.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -37,18 +37,18 @@
/// Creates an item with the specified sub items. And the current
/// Condition status for this item.
/// </summary>
- public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions)
+ public override object BuildItem (object owner, ArrayList subItems, ConditionCollection conditions)
{
//FIXME: This code is *not* fully ported yet
if (subItems.Count > 0) {
- throw new ApplicationException("more than one level of edit actions don't make sense!");
+ throw new ApplicationException ("more than one level of edit actions don't make sense!");
}
- IEditAction editAction = (IEditAction)AddIn.CreateObject(Class);
+ IEditAction editAction = (IEditAction) AddIn.CreateObject (Class);
Gdk.Key[] actionKeys = new Gdk.Key[keys.Length];
for (int j = 0; j < keys.Length; ++j) {
- string[] keydescr = keys[j].Split(new char[] { '|' });
+ string[] keydescr = keys[j].Split (new char[] { '|' });
//Keys key = (Keys)((System.Windows.Forms.Keys.Space.GetType()).InvokeMember(keydescr[0], BindingFlags.GetField, null, System.Windows.Forms.Keys.Space, new object[0]));
//Console.Write (keydescr[0] + " -- ");
for (int k = 1; k < keydescr.Length; ++k) {
@@ -56,13 +56,11 @@
//Console.Write (keydescr[k] + " -- ");
}
//actionKeys[j] = key;
- //Console.WriteLine ("");
}
+
editAction.Keys = actionKeys;
return editAction;
-
}
-
}
}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/BookmarkCommands.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/BookmarkCommands.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/BookmarkCommands.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -6,8 +6,10 @@
using MonoDevelop.Gui;
using MonoDevelop.Core.AddIns.Codons;
-namespace MonoDevelop.EditorBindings.Commands {
- public class ToggleBookmark : AbstractMenuCommand {
+namespace MonoDevelop.EditorBindings.Commands
+{
+ public class ToggleBookmark : AbstractMenuCommand
+ {
public override void Run ()
{
IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
@@ -22,7 +24,8 @@
}
}
- public class PrevBookmark : AbstractMenuCommand {
+ public class PrevBookmark : AbstractMenuCommand
+ {
public override void Run ()
{
IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
@@ -37,7 +40,8 @@
}
}
- public class NextBookmark : AbstractMenuCommand {
+ public class NextBookmark : AbstractMenuCommand
+ {
public override void Run ()
{
IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
@@ -52,7 +56,8 @@
}
}
- public class ClearBookmarks : AbstractMenuCommand {
+ public class ClearBookmarks : AbstractMenuCommand
+ {
public override void Run ()
{
IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/CodeActions.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/CodeActions.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/CodeActions.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -19,9 +19,7 @@
using MonoDevelop.Gui;
using MonoDevelop.TextEditor.Actions;
using MonoDevelop.TextEditor;
-using SharpDevelop.Internal.Parser;
using MonoDevelop.Services;
-
using MonoDevelop.EditorBindings.FormattingStrategy;
using MonoDevelop.SourceEditor.Gui;
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/CommentRegionCommand.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/CommentRegionCommand.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/CommentRegionCommand.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -22,7 +22,7 @@
{
public class CommentRegion : AbstractMenuCommand
{
- public override void Run()
+ public override void Run ()
{
Console.WriteLine ("Not ported to the new editor yet");
/*
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/FoldingCommands.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/FoldingCommands.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/FoldingCommands.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -14,7 +14,6 @@
using MonoDevelop.Core.AddIns;
using MonoDevelop.Core.Properties;
using MonoDevelop.Core.AddIns.Codons;
-
using MonoDevelop.Gui.Dialogs;
using MonoDevelop.TextEditor.Document;
using MonoDevelop.TextEditor;
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/IEditAction.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/IEditAction.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/IEditAction.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -6,11 +6,8 @@
// </file>
using System;
-
using MonoDevelop.SourceEditor.Gui;
-using Gdk;
-
namespace MonoDevelop.TextEditor.Actions
{
/// <summary>
@@ -22,7 +19,8 @@
/// <value>
/// An array of keys on which this edit action occurs.
/// </value>
- Gdk.Key[] Keys {
+ Gdk.Key[] Keys
+ {
get;
set;
}
@@ -30,7 +28,7 @@
/// <remarks>
/// When the key which is defined per XML is pressed, this method will be launched.
/// </remarks>
- void Execute(SourceEditorView textArea);
+ void Execute (SourceEditorView textArea);
}
/// <summary>
@@ -44,7 +42,8 @@
/// <value>
/// An array of keys on which this edit action occurs.
/// </value>
- public Gdk.Key[] Keys {
+ public Gdk.Key[] Keys
+ {
get {
return keys;
}
@@ -56,6 +55,6 @@
/// <remarks>
/// When the key which is defined per XML is pressed, this method will be launched.
/// </remarks>
- public abstract void Execute(SourceEditorView textArea);
+ public abstract void Execute (SourceEditorView textArea);
}
}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/ProjectCommands.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/ProjectCommands.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/ProjectCommands.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -6,18 +6,12 @@
// </file>
using System;
-using System.IO;
-using System.Collections;
-using System.Text;
-using MonoDevelop.Core.AddIns;
-using MonoDevelop.Core.Properties;
+using MonoDevelop.Services;
using MonoDevelop.Core.AddIns.Codons;
using MonoDevelop.Core.Services;
-using MonoDevelop.Services;
-using MonoDevelop.Gui.Dialogs;
-using MonoDevelop.TextEditor.Document;
using MonoDevelop.Gui;
+using MonoDevelop.Gui.Dialogs;
namespace MonoDevelop.DefaultEditor.Commands
{
@@ -25,16 +19,15 @@
{
public override void Run()
{
- IProjectService projectService = (IProjectService)MonoDevelop.Core.Services.ServiceManager.Services.GetService(typeof(IProjectService));
+ IProjectService projectService = (IProjectService) MonoDevelop.Core.Services.ServiceManager.Services.GetService (typeof (IProjectService));
if (projectService.CurrentSelectedProject != null) {
- /*
- ExportProjectToHtmlDialog ephd = new ExportProjectToHtmlDialog (projectService.CurrentSelectedProject);
- ephd.TransientFor = (Gtk.Window) WorkbenchSingleton.Workbench;
- ephd.Run ();
- ephd.Hide ();
- ephd.Dispose();*/
+
+ using (ExportProjectToHtmlDialog ephd = new ExportProjectToHtmlDialog (projectService.CurrentSelectedProject)) {
+ ephd.TransientFor = (Gtk.Window) WorkbenchSingleton.Workbench;
+ ephd.Run ();
+ ephd.Hide ();
+ }
}
}
}
-
}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/SearchCommands.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/SearchCommands.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/SearchCommands.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -9,21 +9,17 @@
using System.IO;
using System.Threading;
using System.Drawing;
-using System.Drawing.Printing;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Text;
using MonoDevelop.Core.AddIns;
-
using MonoDevelop.Core.Properties;
using MonoDevelop.Core.AddIns.Codons;
-
using MonoDevelop.TextEditor;
using MonoDevelop.TextEditor.Actions;
using MonoDevelop.TextEditor.Document;
-
using MonoDevelop.Gui.Dialogs;
using MonoDevelop.Gui;
using MonoDevelop.SourceEditor.Gui;
@@ -33,7 +29,8 @@
public abstract class AbstractEditActionMenuCommand : AbstractMenuCommand
{
- public abstract IEditAction EditAction {
+ public abstract IEditAction EditAction
+ {
get;
}
@@ -52,7 +49,7 @@
public class Find : AbstractMenuCommand
{
- public static void SetSearchPattern()
+ public static void SetSearchPattern ()
{
IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
@@ -68,7 +65,6 @@
public override void Run()
{
-
SetSearchPattern();
if (SearchReplaceManager.ReplaceDialog != null) {
if (SearchReplaceManager.ReplaceDialog.replaceMode == false) {
@@ -80,7 +76,7 @@
rd.ShowAll ();
}
} else {
- ReplaceDialog rd = new ReplaceDialog(false);
+ ReplaceDialog rd = new ReplaceDialog (false);
rd.ShowAll();
}
}
@@ -88,17 +84,17 @@
public class FindNext : AbstractMenuCommand
{
- public override void Run()
+ public override void Run ()
{
- SearchReplaceManager.FindNext();
+ SearchReplaceManager.FindNext ();
}
}
public class Replace : AbstractMenuCommand
{
- public override void Run()
+ public override void Run ()
{
- Find.SetSearchPattern();
+ Find.SetSearchPattern ();
if (SearchReplaceManager.ReplaceDialog != null) {
if (SearchReplaceManager.ReplaceDialog.replaceMode == true) {
@@ -118,7 +114,7 @@
public class FindInFiles : AbstractMenuCommand
{
- public static void SetSearchPattern()
+ public static void SetSearchPattern ()
{
IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
if (window != null && window.ViewContent is SourceEditorDisplayBindingWrapper)
@@ -130,9 +126,9 @@
}
}
- public override void Run()
+ public override void Run ()
{
- SetSearchPattern();
+ SetSearchPattern ();
if (SearchReplaceInFilesManager.ReplaceDialog != null) {
if (SearchReplaceInFilesManager.ReplaceDialog.replaceMode == false) {
//SearchReplaceInFilesManager.ReplaceDialog.SetSearchPattern(SearchReplaceInFilesManager.SearchOptions.SearchPattern);
@@ -153,7 +149,7 @@
{
public override void Run()
{
- FindInFiles.SetSearchPattern();
+ FindInFiles.SetSearchPattern ();
if (SearchReplaceInFilesManager.ReplaceDialog != null) {
if (SearchReplaceInFilesManager.ReplaceDialog.replaceMode == true) {
@@ -165,15 +161,15 @@
rd.ShowAll ();
}
} else {
- ReplaceInFilesDialog rd = new ReplaceInFilesDialog(true);
- rd.ShowAll();
+ ReplaceInFilesDialog rd = new ReplaceInFilesDialog (true);
+ rd.ShowAll ();
}
}
}
public class GotoLineNumber : AbstractMenuCommand
{
- public override void Run()
+ public override void Run ()
{
if (!GotoLineNumberDialog.IsVisible)
using (GotoLineNumberDialog gnd = new GotoLineNumberDialog ())
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/TextAreaContextmenuCommands.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/TextAreaContextmenuCommands.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/TextAreaContextmenuCommands.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -50,15 +50,12 @@
}
}
-
public class HighlightingTypeBuilder : ISubmenuBuilder
{
-
//TextEditorControl control = null;
//Gtk.MenuItem[] menuCommands = null;
-
-
- public Gtk.MenuItem[] BuildSubmenu(ConditionCollection conditionCollection, object owner)
+
+ public Gtk.MenuItem[] BuildSubmenu (ConditionCollection conditionCollection, object owner)
{
/*
control = (TextEditorControl)owner;
@@ -77,7 +74,7 @@
return null;
}
- void ChangeSyntax(object sender, EventArgs e)
+ void ChangeSyntax (object sender, EventArgs e)
{
/*
if (control != null) {
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/ToolCommands.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/ToolCommands.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Commands/ToolCommands.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -20,12 +20,12 @@
using MonoDevelop.SourceEditor.Gui;
using Gtk;
-using GtkSharp;
namespace MonoDevelop.DefaultEditor.Commands
{
public class ColorDialog : ColorSelectionDialog
{
+ // FIXME: i18n
public ColorDialog () : base ("Insert a color hex string")
{
this.ColorSelection.HasPalette = true;
Copied: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Dialogs/EditTemplateGroupDialog.cs (from rev 1141, trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/EditTemplateGroupDialog.cs)
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Dialogs/ExportProjectToHtmlDialog.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Dialogs/ExportProjectToHtmlDialog.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Dialogs/ExportProjectToHtmlDialog.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -16,29 +16,33 @@
using MonoDevelop.Internal.Project;
using MonoDevelop.TextEditor.Document;
//using MonoDevelop.TextEditor.Util;
+using MonoDevelop.Gui.Widgets;
using Gtk;
+// FIXME: use IdleHandler instead of threads here
+// also, what is the point of exporting to HTML?
+
namespace MonoDevelop.Gui.Dialogs
{
public class ExportProjectToHtmlDialog : Dialog
{
- /*
- Entry pathTextBox = new Entry ();
- Label pathLabel = new Label();
- Button okButton = new Button();
- Button cancelButton = new Button();
- Button browseButton = new Button();
+ Entry pathTextBox = new Entry ();
+ Label pathLabel = new Label ();
+ Button okButton = new Button ();
+ Button cancelButton = new Button ();
+ Button browseButton = new Button ();
+ ProgressBar progressBar = new ProgressBar ();
- ProgressBar progressBar = new ProgressBar();
+ FileUtilityService fileUtilityService = (FileUtilityService) ServiceManager.Services.GetService(typeof(FileUtilityService));
+ IconService iconService = (IconService) ServiceManager.Services.GetService(typeof(IconService));
+ ResourceService resourceService = (ResourceService) ServiceManager.Services.GetService(typeof(IResourceService));
- FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
- IconService iconService = (IconService)ServiceManager.Services.GetService(typeof(IconService));
- ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
IProject project;
int filesExported = 0;
- int FilesExported {
+ int FilesExported
+ {
get {
return filesExported;
}
@@ -47,54 +51,53 @@
}
}
- void StartExporting()
+ void StartExporting ()
{
- cancelButton = new Button (Stock.Cancel);
- cancelButton.Click += new EventHandler(StopThread);
+ cancelButton = new Button (Gtk.Stock.Cancel);
+ cancelButton.Clicked += new EventHandler (StopThread);
}
-*/
- public ExportProjectToHtmlDialog(IProject project)
+
+ public ExportProjectToHtmlDialog (IProject project)
{
-/* PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
-
+ PropertyService propertyService = (PropertyService) ServiceManager.Services.GetService (typeof (PropertyService));
this.project = project;
- pathLabel.Text = resourceService.GetString("Dialog.ExportProjectToHtml.FolderLabel");
+ pathLabel.Text = resourceService.GetString ("Dialog.ExportProjectToHtml.FolderLabel");
- browseButton.Text = "...";
- browseButton.Click += new EventHandler(BrowseDirectories);
+ //browseButton.Text = "...";
+ //browseButton.Click += new EventHandler(BrowseDirectories);
- okButton.Text = resourceService.GetString("Global.OKButtonText");
- okButton.Click += new EventHandler(ExportProject);
+ //okButton.Text = resourceService.GetString("Global.OKButtonText");
+ //okButton.Click += new EventHandler(ExportProject);
- cancelButton.DialogResult = DialogResult.Cancel;
+ //cancelButton.DialogResult = DialogResult.Cancel;
RequestSize = new Size (350, 88 + 6);
- Position = StartPosition.CenterParent;
- //ShowInTaskbar = false;
+ WindowPosition = WindowPosition.CenterOnParent;
- Title = resourceService.GetString("Dialog.ExportProjectToHtml.DialogName");
-*/
+ Title = resourceService.GetString ("Dialog.ExportProjectToHtml.DialogName");
}
-/*
- void BrowseDirectories(object sender, EventArgs e)
+
+ void BrowseDirectories (object sender, EventArgs e)
{
- FolderDialog fd = new FolderDialog();
-
- if(fd.DisplayDialog(resourceService.GetString("Dialog.ExportProjectToHtml.SelectTargetDirInfo")) == DialogResult.OK) {
- pathTextBox.Text = fd.Path;
+ using (FolderDialog fd = new FolderDialog (resourceService.GetString ("Dialog.ExportProjectToHtml.SelectTargetDirInfo"))) {
+ if (fd.Run () == (int) ResponseType.Ok) {
+ //pathTextBox.Text = fd.Path;
+ }
+
+ fd.Hide ();
}
}
- Hashtable projectTable = new Hashtable();
- Hashtable bitmapTable = new Hashtable();
- int bitmapIconIndex = 0;
- int indexFileIndex = 0;
+ Hashtable projectTable = new Hashtable ();
+ Hashtable bitmapTable = new Hashtable ();
+ int bitmapIconIndex = 0;
+ int indexFileIndex = 0;
- public Hashtable GetPath(string filename, Hashtable table, bool create)
+ public Hashtable GetPath (string filename, Hashtable table, bool create)
{
- string directory = Path.GetDirectoryName(filename);
- string[] treepath = directory.Split(new char[] { Path.DirectorySeparatorChar });
+ string directory = System.IO.Path.GetDirectoryName (filename);
+ string[] treepath = directory.Split (new char[] { System.IO.Path.DirectorySeparatorChar });
Hashtable curTable = table;
foreach (string path in treepath) {
@@ -112,16 +115,20 @@
} else {
return null;
}
- }
+ }
+
curTable = (Hashtable)node;
}
+
return curTable;
}
- int GetImageIndex(string filename)
+
+ int GetImageIndex (string filename)
{
if (filename != null) {
- return iconService.GetImageIndexForFile(filename);
+ return 0; //iconService.GetImageIndexForFile (filename);
}
+
return -1;
}
@@ -129,7 +136,8 @@
{
public string title;
public string url;
- public Descriptor(string title, string url)
+
+ public Descriptor (string title, string url)
{
this.title = title;
this.url = url;
@@ -137,55 +145,57 @@
}
StreamWriter curFileStream = null;
- Stack curIndexStreamStack = new Stack();
- int curSpanNumber = 0;
- Hashtable Spans = new Hashtable();
+ Stack curIndexStreamStack = new Stack ();
+ int curSpanNumber = 0;
+ Hashtable Spans = new Hashtable();
string ExportFile (string fileName, string targetPath)
{
- string targetFile = fileUtilityService.AbsoluteToRelativePath(project.BaseDirectory, fileName).Substring(2).Replace(System.IO.Path.DirectorySeparatorChar.ToString(), "") + ".html";
+ string targetFile = fileUtilityService.AbsoluteToRelativePath (project.BaseDirectory, fileName).Substring (2).Replace (System.IO.Path.DirectorySeparatorChar.ToString (), "") + ".html";
- IDocument document = new DocumentFactory().CreateDocument();
- document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategyForFile(fileName);
- StreamReader stream = File.OpenText(fileName);
- document.TextContent = stream.ReadToEnd();
- stream.Close();
+ //IDocument document = new DocumentFactory ().CreateDocument ();
+ //document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategyForFile (fileName);
+ StreamReader stream = File.OpenText (fileName);
+ //document.TextContent = stream.ReadToEnd ();
+ stream.Close ();
- curFileStream = File.CreateText(targetPath + Path.DirectorySeparatorChar + targetFile);
- curFileStream.Write("<html>\r\n");
- curFileStream.Write("<head>\r\n");
- curFileStream.Write("<link rel=\"stylesheet\" type=\"text/css\" href=\"sdcss.css\">\r\n");
- curFileStream.Write("<title>" + Path.GetFileName(fileName) + "</title>\r\n");
- curFileStream.Write("</head>\r\n");
- curFileStream.Write("<body>\r\n");
+ curFileStream = File.CreateText (System.IO.Path.Combine (targetPath, targetFile));
+ curFileStream.Write ("<html>\r\n");
+ curFileStream.Write ("<head>\r\n");
+ curFileStream.Write ("<link rel=\"stylesheet\" type=\"text/css\" href=\"sdcss.css\">\r\n");
+ curFileStream.Write ("<title>" + System.IO.Path.GetFileName (fileName) + "</title>\r\n");
+ curFileStream.Write ("</head>\r\n");
+ curFileStream.Write ("<body>\r\n");
- curFileStream.Write("<div class=\"code\"><TABLE SUMMARY=\"SourceCode\" BORDER=0 CELLSPACING=0 CELLPADDING=2 WIDTH=\"100%\">\r\n");
- curFileStream.Write(" <TR BGCOLOR=\"#FFFFFF\">\r\n");
- curFileStream.Write(" <TH WIDTH=\"50\" NOWRAP ALIGN=LEFT></TH>\r\n");
- curFileStream.Write(" <TH WIDTH=\"1%\" NOWRAP ALIGN=LEFT></TH>\r\n");
- curFileStream.Write(" <TH VALIGN=TOP ALIGN=LEFT> \r\n");
- curFileStream.Write(" </TH>\r\n");
+ curFileStream.Write ("<div class=\"code\"><TABLE SUMMARY=\"SourceCode\" BORDER=0 CELLSPACING=0 CELLPADDING=2 WIDTH=\"100%\">\r\n");
+ curFileStream.Write (" <TR BGCOLOR=\"#FFFFFF\">\r\n");
+ curFileStream.Write (" <TH WIDTH=\"50\" NOWRAP ALIGN=LEFT></TH>\r\n");
+ curFileStream.Write (" <TH WIDTH=\"1%\" NOWRAP ALIGN=LEFT></TH>\r\n");
+ curFileStream.Write (" <TH VALIGN=TOP ALIGN=LEFT> \r\n");
+ curFileStream.Write (" </TH>\r\n");
- curFileStream.Write(" </TR>\r\n");
+ curFileStream.Write (" </TR>\r\n");
int i = 0;
- foreach (LineSegment line in document.LineSegmentCollection) {
- curFileStream.Write(" <TR BGCOLOR=\"#FFFFFF\" VALIGN=TOP>\r\n");
- curFileStream.Write(" <TD NOWRAP VALIGN=TOP ALIGN=RIGHT>" + ++i + ":</TD>\r\n");
- curFileStream.Write(" <TD NOWRAP VALIGN=TOP ALIGN=LEFT> \r\n");
+
+ /*foreach (LineSegment line in document.LineSegmentCollection) {
+ curFileStream.Write (" <TR BGCOLOR=\"#FFFFFF\" VALIGN=TOP>\r\n");
+ curFileStream.Write (" <TD NOWRAP VALIGN=TOP ALIGN=RIGHT>" + ++i + ":</TD>\r\n");
+ curFileStream.Write (" <TD NOWRAP VALIGN=TOP ALIGN=LEFT> \r\n");
bool spanOpen = false;
Color curColor = Color.Black;
- bool oldItalic = false;
- bool oldBold = false;
+ bool oldItalic = false;
+ bool oldBold = false;
bool firstSpan = true;
+
foreach (TextWord word in line.Words) {
switch (word.Type) {
case TextWordType.Space:
- curFileStream.Write(" ");
+ curFileStream.Write (" ");
break;
case TextWordType.Tab:
for (int k = 0; k < document.TextEditorProperties.TabIndent; ++k) {
- curFileStream.Write(" ");
+ curFileStream.Write (" ");
}
break;
@@ -196,24 +206,28 @@
if (word.Font.Italic) {
colorstr = "i" + colorstr;
}
+
if (word.Font.Bold) {
colorstr = "b" + colorstr;
}
+
if (Spans[colorstr] == null) {
Spans[colorstr] = "span" + ++curSpanNumber;
}
bool newColor = c != curColor || oldItalic != word.Font.Italic || oldBold != word.Font.Bold;
+
if (newColor) {
if (!firstSpan) {
- curFileStream.Write("</span>" );
+ curFileStream.Write ("</span>" );
}
- curFileStream.Write("<span class=\"" + Spans[colorstr].ToString() + "\">" );
+ curFileStream.Write ("<span class=\"" + Spans[colorstr].ToString () + "\">" );
spanOpen = true;
firstSpan = false;
}
- curFileStream.Write(HtmlLize(word.Word));
+ curFileStream.Write (HtmlLize (word.Word));
+
if (newColor) {
curColor = c;
oldItalic = word.Font.Italic;
@@ -222,82 +236,85 @@
break;
}
}
+
if (spanOpen) {
- curFileStream.Write("</span>" );
+ curFileStream.Write ("</span>" );
}
- curFileStream.Write("</TD>\r\n");
- curFileStream.Write("</TR>\r\n");
+
+ curFileStream.Write ("</TD>\r\n");
+ curFileStream.Write ("</TR>\r\n");
}
- curFileStream.Write("</TABLE></div>\r\n");
+ */
+ curFileStream.Write ("</TABLE></div>\r\n");
- curFileStream.Write("<P>\r\n");
- curFileStream.Write("This page was automatically generated by \r\n");
- curFileStream.Write("<A TARGET=\"_blank\" HREF=\"http://www.icsharpcode.net/OpenSource/SD\">SharpDevelop</A>.\r\n");
- curFileStream.Write("</p>\r\n");
- curFileStream.Write("</body>\r\n");
- curFileStream.Write("</html>\r\n");
- curFileStream.Close();
+ curFileStream.Write ("<P>\r\n");
+ curFileStream.Write ("This page was automatically generated by \r\n");
+ curFileStream.Write ("<A TARGET=\"_blank\" HREF=\"http://www.icsharpcode.net/OpenSource/SD\">SharpDevelop</A>.\r\n");
+ curFileStream.Write ("</p>\r\n");
+ curFileStream.Write ("</body>\r\n");
+ curFileStream.Write ("</html>\r\n");
+ curFileStream.Close ();
return targetFile;
}
- string HtmlLize(string str)
+ string HtmlLize (string str)
{
- return str.Replace("&", "&").Replace("<", "<").Replace(">", ">");
+ return str.Replace ("&", "&").Replace ("<", "<").Replace (">", ">");
}
- void WriteIndexTable(string fileName, string name, ArrayList nameList, Hashtable table)
+ void WriteIndexTable (string fileName, string name, ArrayList nameList, Hashtable table)
{
- curIndexStreamStack.Push(File.CreateText(fileName));
- StreamWriter curIndexStream = (StreamWriter)curIndexStreamStack.Peek();
+ curIndexStreamStack.Push (File.CreateText(fileName));
+ StreamWriter curIndexStream = (StreamWriter) curIndexStreamStack.Peek();
- curIndexStream.Write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\r\n");
- curIndexStream.Write("<html>\r\n");
- curIndexStream.Write("<head>\r\n");
- curIndexStream.Write("<title>" + project.Name + "</title>\r\n");
- curIndexStream.Write("</head>\r\n");
+ curIndexStream.Write ("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\r\n");
+ curIndexStream.Write ("<html>\r\n");
+ curIndexStream.Write ("<head>\r\n");
+ curIndexStream.Write ("<title>" + project.Name + "</title>\r\n");
+ curIndexStream.Write ("</head>\r\n");
- curIndexStream.Write("<body>\r\n");
- curIndexStream.Write("<p>Location : ");
+ curIndexStream.Write ("<body>\r\n");
+ curIndexStream.Write ("<p>Location : ");
foreach (Descriptor d in nameList) {
- curIndexStream.Write("<a href=\""+ d.url + "\">" + d.title + "</a>/");
+ curIndexStream.Write ("<a href=\""+ d.url + "\">" + d.title + "</a>/");
}
- curIndexStream.Write(name);
- curIndexStream.Write("</p>\r\n");
+ curIndexStream.Write (name);
+ curIndexStream.Write ("</p>\r\n");
nameList.Add (new Descriptor (name, System.IO.Path.GetFileName (fileName)));
- curIndexStream.Write("<TABLE SUMMARY=\"Directory\" BORDER=0 CELLSPACING=0 CELLPADDING=2 WIDTH=\"100%\">\r\n");
- curIndexStream.Write(" <TR BGCOLOR=\"#F38C00\">\r\n");
- curIndexStream.Write(" <TH WIDTH=\"1%\"> </TH>\r\n");
- curIndexStream.Write(" <TH WIDTH=\"1%\" NOWRAP ALIGN=LEFT>Name</TH>\r\n");
- curIndexStream.Write(" <TH WIDTH=\"1%\" NOWRAP ALIGN=RIGHT>Size</TH>\r\n");
- curIndexStream.Write(" <TH WIDTH=\"1%\" NOWRAP ALIGN=LEFT>Date</TH>\r\n");
- curIndexStream.Write(" <TH VALIGN=TOP ALIGN=LEFT> \r\n");
- curIndexStream.Write(" </TH>\r\n");
- curIndexStream.Write(" </TR>\r\n");
+ curIndexStream.Write ("<TABLE SUMMARY=\"Directory\" BORDER=0 CELLSPACING=0 CELLPADDING=2 WIDTH=\"100%\">\r\n");
+ curIndexStream.Write (" <TR BGCOLOR=\"#F38C00\">\r\n");
+ curIndexStream.Write (" <TH WIDTH=\"1%\"> </TH>\r\n");
+ curIndexStream.Write (" <TH WIDTH=\"1%\" NOWRAP ALIGN=LEFT>Name</TH>\r\n");
+ curIndexStream.Write (" <TH WIDTH=\"1%\" NOWRAP ALIGN=RIGHT>Size</TH>\r\n");
+ curIndexStream.Write (" <TH WIDTH=\"1%\" NOWRAP ALIGN=LEFT>Date</TH>\r\n");
+ curIndexStream.Write (" <TH VALIGN=TOP ALIGN=LEFT> \r\n");
+ curIndexStream.Write (" </TH>\r\n");
+ curIndexStream.Write (" </TR>\r\n");
bool coloring = false;
foreach (DictionaryEntry entry in table) {
if (entry.Value is Hashtable) {
string filename = "index" + ++indexFileIndex + ".html";
WriteIndexTable (System.IO.Path.GetDirectoryName (fileName) + System.IO.Path.DirectorySeparatorChar + filename, entry.Key.ToString(), nameList, (Hashtable)entry.Value);
- nameList.RemoveAt(nameList.Count - 1);
- curIndexStream.Write(" <TR BGCOLOR=\"" + (coloring ? "#FFFFFF" : "#EEEEEE") + "\" VALIGN=TOP>\r\n");
- curIndexStream.Write(" <TD NOWRAP VALIGN=TOP ALIGN=RIGHT><a href=\"" + filename + "\"><IMG ALIGN=ABSBOTTOM BORDER=0 WIDTH=16 HEIGHT=16 SRC=\"folderbitmap.png\"></a></TD>\r\n");
- curIndexStream.Write(" <TD NOWRAP VALIGN=TOP ALIGN=LEFT><a href=\""+ filename + "\">" + entry.Key.ToString() + "</a> </TD>\r\n");
- curIndexStream.Write(" <TD NOWRAP VALIGN=TOP ALIGN=RIGHT>-</TD>\r\n");
- curIndexStream.Write(" <TD NOWRAP VALIGN=TOP ALIGN=RIGHT>-</TD>\r\n");
- curIndexStream.Write(" <TD VALIGN=TOP ALIGN=LEFT> \r\n");
- curIndexStream.Write(" </TD>\r\n");
- curIndexStream.Write(" </TR>\r\n");
+ nameList.RemoveAt (nameList.Count - 1);
+ curIndexStream.Write (" <TR BGCOLOR=\"" + (coloring ? "#FFFFFF" : "#EEEEEE") + "\" VALIGN=TOP>\r\n");
+ curIndexStream.Write (" <TD NOWRAP VALIGN=TOP ALIGN=RIGHT><a href=\"" + filename + "\"><IMG ALIGN=ABSBOTTOM BORDER=0 WIDTH=16 HEIGHT=16 SRC=\"folderbitmap.png\"></a></TD>\r\n");
+ curIndexStream.Write (" <TD NOWRAP VALIGN=TOP ALIGN=LEFT><a href=\""+ filename + "\">" + entry.Key.ToString() + "</a> </TD>\r\n");
+ curIndexStream.Write (" <TD NOWRAP VALIGN=TOP ALIGN=RIGHT>-</TD>\r\n");
+ curIndexStream.Write (" <TD NOWRAP VALIGN=TOP ALIGN=RIGHT>-</TD>\r\n");
+ curIndexStream.Write (" <TD VALIGN=TOP ALIGN=LEFT> \r\n");
+ curIndexStream.Write (" </TD>\r\n");
+ curIndexStream.Write (" </TR>\r\n");
} else if (entry.Value is ProjectFile) {
- ProjectFile fInfo = (ProjectFile)entry.Value;
- DateTime time = Directory.GetLastAccessTime(fInfo.Name);
- FileStream reader = File.OpenRead(fInfo.Name);
+ ProjectFile fInfo = (ProjectFile) entry.Value;
+ DateTime time = Directory.GetLastAccessTime (fInfo.Name);
+ FileStream reader = File.OpenRead (fInfo.Name);
long size = reader.Length;
- reader.Close();
+ reader.Close ();
- int idx = GetImageIndex(fInfo.Name);
+ int idx = GetImageIndex (fInfo.Name);
if (bitmapTable[idx] == null) {
string filename = "fileicon" + ++bitmapIconIndex + ".png";
@@ -307,111 +324,111 @@
}
string outFile = ExportFile(fInfo.Name, System.IO.Path.GetDirectoryName(fileName));
++FilesExported;
- curIndexStream.Write(" <TR BGCOLOR=\"" + (coloring ? "#FFFFFF" : "#EEEEEE") + "\" VALIGN=TOP>\r\n");
- curIndexStream.Write(" <TD NOWRAP VALIGN=TOP ALIGN=RIGHT><a href=\"" + outFile + "\"><IMG ALIGN=ABSBOTTOM BORDER=0 WIDTH=16 HEIGHT=16 SRC=\"" + bitmapTable[idx].ToString() +"\"></a></TD>\r\n");
- curIndexStream.Write(" <TD NOWRAP VALIGN=TOP ALIGN=LEFT><a href=\"" + outFile + "\">" + System.IO.Path.GetFileName(fInfo.Name) + "</a> </TD>\r\n");
- curIndexStream.Write(" <TD NOWRAP VALIGN=TOP ALIGN=RIGHT>" + size + "</TD>\r\n");
- curIndexStream.Write(" <TD NOWRAP VALIGN=TOP ALIGN=RIGHT>" + time.ToString("d") + "</TD>\r\n");
- curIndexStream.Write(" <TD VALIGN=TOP ALIGN=LEFT> \r\n");
- curIndexStream.Write(" </TD>\r\n");
- curIndexStream.Write(" </TR>\r\n");
-
+ curIndexStream.Write (" <TR BGCOLOR=\"" + (coloring ? "#FFFFFF" : "#EEEEEE") + "\" VALIGN=TOP>\r\n");
+ curIndexStream.Write (" <TD NOWRAP VALIGN=TOP ALIGN=RIGHT><a href=\"" + outFile + "\"><IMG ALIGN=ABSBOTTOM BORDER=0 WIDTH=16 HEIGHT=16 SRC=\"" + bitmapTable[idx].ToString() +"\"></a></TD>\r\n");
+ curIndexStream.Write (" <TD NOWRAP VALIGN=TOP ALIGN=LEFT><a href=\"" + outFile + "\">" + System.IO.Path.GetFileName(fInfo.Name) + "</a> </TD>\r\n");
+ curIndexStream.Write (" <TD NOWRAP VALIGN=TOP ALIGN=RIGHT>" + size + "</TD>\r\n");
+ curIndexStream.Write (" <TD NOWRAP VALIGN=TOP ALIGN=RIGHT>" + time.ToString("d") + "</TD>\r\n");
+ curIndexStream.Write (" <TD VALIGN=TOP ALIGN=LEFT> \r\n");
+ curIndexStream.Write (" </TD>\r\n");
+ curIndexStream.Write (" </TR>\r\n");
}
+
coloring = !coloring;
}
- curIndexStream.Write("</TABLE>\r\n");
+ curIndexStream.Write ("</TABLE>\r\n");
- curIndexStream.Write("<p>\r\n");
- curIndexStream.Write("This page was automatically generated by \r\n");
- curIndexStream.Write("<A TARGET=\"_blank\" HREF=\"http://www.icsharpcode.net/OpenSource/SD\">SharpDevelop</A>.\r\n");
- curIndexStream.Write("</p>\r\n");
- curIndexStream.Write("</body>\r\n");
- curIndexStream.Write("</html>\r\n");
+ curIndexStream.Write ("<p>\r\n");
+ curIndexStream.Write ("This page was automatically generated by \r\n");
+ curIndexStream.Write ("<A TARGET=\"_blank\" HREF=\"http://www.icsharpcode.net/OpenSource/SD\">SharpDevelop</A>.\r\n");
+ curIndexStream.Write ("</p>\r\n");
+ curIndexStream.Write ("</body>\r\n");
+ curIndexStream.Write ("</html>\r\n");
lock (this) {
- curIndexStream.Close();
- curIndexStreamStack.Pop();
+ curIndexStream.Close ();
+ curIndexStreamStack.Pop ();
}
}
- delegate void MyD();
+ delegate void MyD ();
- void QuitDialog()
+ void QuitDialog ()
{
//DialogResult = DialogResult.OK;
}
- Thread exportFilesThread;
- void ExportFilesThread()
+// Thread exportFilesThread;
+ void ExportFilesThread ()
{
- resourceService.GetBitmap("Icons.16x16.ClosedFolderBitmap").Save(fileUtilityService.GetDirectoryNameWithSeparator(pathTextBox.Text) + "folderbitmap.png");
- WriteIndexTable(fileUtilityService.GetDirectoryNameWithSeparator(pathTextBox.Text) + "index.html", "[ROOT]", new ArrayList(), projectTable);
- CreateCSS(pathTextBox.Text);
- Invoke(new MyD(QuitDialog));
+ //resourceService.GetBitmap ("Icons.16x16.ClosedFolderBitmap").Save (fileUtilityService.GetDirectoryNameWithSeparator (pathTextBox.Text) + "folderbitmap.png");
+ WriteIndexTable (fileUtilityService.GetDirectoryNameWithSeparator (pathTextBox.Text) + "index.html", "[ROOT]", new ArrayList (), projectTable);
+ CreateCSS (pathTextBox.Text);
+ //Invoke (new MyD (QuitDialog));
}
void StopThread(object sender, EventArgs e)
{
- lock (this) {
- exportFilesThread.Abort();
- curFileStream.Close();
+ //lock (this) {
+ //exportFilesThread.Abort ();
+ curFileStream.Close ();
while (curIndexStreamStack.Count > 0) {
- ((StreamWriter)curIndexStreamStack.Pop()).Close();
+ ((StreamWriter) curIndexStreamStack.Pop ()).Close ();
}
- QuitDialog();
- }
+ QuitDialog ();
+ //}
}
- void CreateCSS(string targetPath)
+ void CreateCSS (string targetPath)
{
- lock (this) {
- StreamWriter sw = File.CreateText(targetPath + Path.DirectorySeparatorChar + "sdcss.css");
- sw.Write("div.code\r\n");
- sw.Write("{\r\n");
- sw.Write(" background-color: rgb(255,255,255);\r\n");
- sw.Write(" font-family: \"Lucida Console\", \"courier new\", courier;\r\n");
- sw.Write(" color: rgb(0,0,0);\r\n");
- sw.Write(" font-size: x-small;\r\n");
- sw.Write(" padding: 1em;\r\n");
- sw.Write(" margin: 1em;\r\n");
- sw.Write("}\r\n");
+ //lock (this) {
+ StreamWriter sw = File.CreateText (System.IO.Path.Combine (targetPath, "sdcss.css"));
+ sw.Write ("div.code\r\n");
+ sw.Write ("{\r\n");
+ sw.Write (" background-color: rgb(255,255,255);\r\n");
+ sw.Write (" font-family: \"Lucida Console\", \"courier new\", courier;\r\n");
+ sw.Write (" color: rgb(0,0,0);\r\n");
+ sw.Write (" font-size: x-small;\r\n");
+ sw.Write (" padding: 1em;\r\n");
+ sw.Write (" margin: 1em;\r\n");
+ sw.Write ("}\r\n");
foreach (DictionaryEntry entry in Spans) {
- string color = entry.Key.ToString();
- string name = entry.Value.ToString();
- bool bold = color.StartsWith("b");
+ string color = entry.Key.ToString ();
+ string name = entry.Value.ToString ();
+ bool bold = color.StartsWith ("b");
if (bold) {
color = color.Substring(1);
}
- bool italic = color.StartsWith("i");
+ bool italic = color.StartsWith ("i");
if (italic) {
- color = color.Substring(1);
+ color = color.Substring (1);
}
- sw.Write("div.code span." + name +"\r\n");
- sw.Write("{\r\n");
- sw.Write(" color: rgb("+ color + ");\r\n");
+ sw.Write ("div.code span." + name +"\r\n");
+ sw.Write ("{\r\n");
+ sw.Write (" color: rgb("+ color + ");\r\n");
if (bold) {
- sw.Write(" font-weight: bold;\r\n");
+ sw.Write (" font-weight: bold;\r\n");
} else
if (italic) {
- sw.Write(" font-weight: italic;\r\n");
+ sw.Write (" font-weight: italic;\r\n");
} else {
- sw.Write(" font-weight: normal;\r\n");
+ sw.Write (" font-weight: normal;\r\n");
}
sw.Write("}\r\n");
}
- sw.Close();
- }
+ sw.Close ();
+ //}
}
- void ExportProject(object sender, EventArgs e)
+ void ExportProject (object sender, EventArgs e)
{
- if (!Directory.Exists(pathTextBox.Text)) {
- MessageBox.Show("Directory doesn't exists", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ if (!Directory.Exists (pathTextBox.Text)) {
+ //MessageBox.Show ("Directory doesn't exists", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
@@ -420,17 +437,16 @@
if (fInfo.BuildAction == BuildAction.Compile ||
fInfo.BuildAction == BuildAction.Nothing) {
string relativefile = fileUtilityService.AbsoluteToRelativePath(project.BaseDirectory, fInfo.Name);
- Hashtable table = GetPath(relativefile, projectTable, true);
+ Hashtable table = GetPath (relativefile, projectTable, true);
table [System.IO.Path.GetFileName(fInfo.Name)] = fInfo;
}
}
}
- StartExporting();
- exportFilesThread = new Thread(new ThreadStart(ExportFilesThread));
+ StartExporting ();
+ /*exportFilesThread = new Thread (new ThreadStart(ExportFilesThread));
exportFilesThread.IsBackground = true;
- exportFilesThread.Start();
+ exportFilesThread.Start ();*/
}
- */
}
}
Deleted: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/EditTemplateGroupDialog.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/EditTemplateGroupDialog.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/EditTemplateGroupDialog.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -1,87 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
-// <version value="$version"/>
-// </file>
-
-using System;
-using System.IO;
-
-using MonoDevelop.Internal.Templates;
-using MonoDevelop.Core.Services;
-
-namespace MonoDevelop.EditorBindings.Gui.Dialogs
-{
- public class EditTemplateGroupDialog : Gtk.Dialog
- {
- CodeTemplateGroup codeTemplateGroup;
- string titlePrefix = string.Empty;
-
- // Gtk members
- Gtk.Entry templateExtensionsTextBox;
-
- // Services
- StringParserService StringParserService = (StringParserService)ServiceManager.Services.GetService (typeof (StringParserService));
-
- public CodeTemplateGroup CodeTemplateGroup {
- get {
- return codeTemplateGroup;
- }
- }
-
- public EditTemplateGroupDialog(CodeTemplateGroup codeTemplateGroup, string titlePrefix)
- {
- this.codeTemplateGroup = codeTemplateGroup;
- this.titlePrefix = titlePrefix;
- InitializeComponents();
- this.ShowAll();
- }
-
- void AcceptEvent(object sender, EventArgs e)
- {
- codeTemplateGroup.ExtensionStrings = templateExtensionsTextBox.Text.Split(';');
-
- // close the window
- CancelEvent(sender, EventArgs.Empty);
- }
-
- void CancelEvent(object sender, EventArgs e)
- {
- this.Destroy();
- }
-
- void InitializeComponents()
- {
- // set up this actual dialog
- this.Modal = true;
- // FIXME: make this a resource in the resource file
- this.Title = titlePrefix + "Code Group";
-
- // set up the dialog fields and add them
- templateExtensionsTextBox = new Gtk.Entry();
- templateExtensionsTextBox.ActivatesDefault = true;
- // FIXME: make this a resource in the resource file
- Gtk.Label label1 = new Gtk.Label("Extensions (; seperated)");
-
- label1.Xalign = 0;
- templateExtensionsTextBox.Text = string.Join(";", codeTemplateGroup.ExtensionStrings);
-
- // FIXME: make the labels both part of the same sizing group so they have the same left and right rows.
- Gtk.HBox hBox1 = new Gtk.HBox(false, 6);
- hBox1.PackStart(label1, false, false, 6);
- hBox1.PackStart(templateExtensionsTextBox, false, false, 6);
-
- this.VBox.PackStart(hBox1, false, false, 6);
-
- // set up the buttons and add them
- this.DefaultResponse = (int) Gtk.ResponseType.Ok;
- Gtk.Button cancelButton = new Gtk.Button(Gtk.Stock.Cancel);
- Gtk.Button okButton = new Gtk.Button(Gtk.Stock.Ok);
- okButton.Clicked += new EventHandler(AcceptEvent);
- cancelButton.Clicked += new EventHandler(CancelEvent);
- this.AddActionWidget (cancelButton, Gtk.ResponseType.Cancel);
- this.AddActionWidget (okButton, (int) Gtk.ResponseType.Ok);
- }
- }
-}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/OptionPanels/BehaviorTextEditorPanel.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/OptionPanels/BehaviorTextEditorPanel.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/OptionPanels/BehaviorTextEditorPanel.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -13,17 +13,15 @@
using MonoDevelop.Internal.Templates;
using MonoDevelop.Core.Properties;
using MonoDevelop.Core.AddIns.Codons;
-
using MonoDevelop.Core.Services;
-
using MonoDevelop.TextEditor;
using MonoDevelop.TextEditor.Document;
using MonoDevelop.Gui.Dialogs;
-
-using Gtk;
using MonoDevelop.Gui.Widgets;
using MonoDevelop.EditorBindings.FormattingStrategy;
+using Gtk;
+
namespace MonoDevelop.EditorBindings.Gui.OptionPanels
{
/// <summary>
@@ -33,12 +31,12 @@
{
BehaviorTextEditorPanelWidget widget;
- public override void LoadPanelContents()
+ public override void LoadPanelContents ()
{
Add (widget = new BehaviorTextEditorPanelWidget ((IProperties) CustomizationObject));
}
- public override bool StorePanelContents()
+ public override bool StorePanelContents ()
{
widget.Store ((IProperties) CustomizationObject);
return true;
@@ -51,27 +49,27 @@
StringParserService)ServiceManager.Services.GetService (typeof (StringParserService));
// GTK controls
- [Glade.Widget] Label tabsGroupBoxLabel;
- [Glade.Widget] Label behaviourGroupBoxLabel;
- [Glade.Widget] Label tabSizeLabel;
- [Glade.Widget] Label indentSizeLabel;
- [Glade.Widget] Label indentLabel;
- [Glade.Widget] CheckButton autoinsertCurlyBraceCheckBox;
- [Glade.Widget] CheckButton hideMouseCursorCheckBox;
- [Glade.Widget] CheckButton caretBehindEOLCheckBox;
- [Glade.Widget] CheckButton autoInsertTemplatesCheckBox;
- [Glade.Widget] CheckButton convertTabsToSpacesCheckBox;
- [Glade.Widget] RadioButton noneIndentStyle;
- [Glade.Widget] RadioButton automaticIndentStyle;
- [Glade.Widget] RadioButton smartIndentStyle;
- [Glade.Widget] SpinButton indentAndTabSizeSpinButton;
+ [Glade.Widget] Label tabsGroupBoxLabel;
+ [Glade.Widget] Label behaviourGroupBoxLabel;
+ [Glade.Widget] Label tabSizeLabel;
+ [Glade.Widget] Label indentSizeLabel;
+ [Glade.Widget] Label indentLabel;
+ [Glade.Widget] CheckButton autoinsertCurlyBraceCheckBox;
+ [Glade.Widget] CheckButton hideMouseCursorCheckBox;
+ [Glade.Widget] CheckButton caretBehindEOLCheckBox;
+ [Glade.Widget] CheckButton autoInsertTemplatesCheckBox;
+ [Glade.Widget] CheckButton convertTabsToSpacesCheckBox;
+ [Glade.Widget] RadioButton noneIndentStyle;
+ [Glade.Widget] RadioButton automaticIndentStyle;
+ [Glade.Widget] RadioButton smartIndentStyle;
+ [Glade.Widget] SpinButton indentAndTabSizeSpinButton;
public BehaviorTextEditorPanelWidget (IProperties CustomizationObject) :
base ("EditorBindings.glade", "BehaviorTextEditorPanel")
{
// Set up Text
- //FIXME: i8n the following Labels
+ //FIXME: i18n the following Labels
noneIndentStyle.Label = "None";
automaticIndentStyle.Label = "Automatic";
// FIXME: renable this when smart indent is back
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -1,5 +1,4 @@
using Gtk;
-using GtkSharp;
using GLib;
using MonoDevelop.Gui;
@@ -14,9 +13,10 @@
using System.IO;
using System.Runtime.InteropServices;
-namespace MonoDevelop.SourceEditor.Gui {
-
- public enum SourceMarkerType {
+namespace MonoDevelop.SourceEditor.Gui
+{
+ public enum SourceMarkerType
+ {
SourceEditorBookmark,
BreakpointMark,
ExecutionMark
@@ -24,10 +24,12 @@
// This gives us a nice way to avoid the try/finally
// which is really long.
- struct NoUndo : IDisposable {
+ struct NoUndo : IDisposable
+ {
SourceEditorBuffer b;
- public NoUndo (SourceEditorBuffer b) {
+ public NoUndo (SourceEditorBuffer b)
+ {
this.b = b;
b.BeginNotUndoableAction ();
}
@@ -40,10 +42,12 @@
// This gives us a nice way to avoid the try/finally
// which is really long.
- struct AtomicUndo : IDisposable {
+ struct AtomicUndo : IDisposable
+ {
SourceEditorBuffer b;
- public AtomicUndo (SourceEditorBuffer b) {
+ public AtomicUndo (SourceEditorBuffer b)
+ {
this.b = b;
b.BeginUserAction ();
}
@@ -54,8 +58,8 @@
}
}
- public class SourceEditorBuffer : SourceBuffer, IClipboardHandler {
-
+ public class SourceEditorBuffer : SourceBuffer, IClipboardHandler
+ {
SourceLanguagesManager slm = new SourceLanguagesManager ();
TextTag markup;
@@ -97,7 +101,6 @@
public void LoadText (string text, string mime)
{
-
SourceLanguage lang = slm.GetLanguageFromMimeType (mime);
if (lang != null)
Language = lang;
@@ -125,43 +128,51 @@
}
#region IClipboardHandler
- bool HasSelection {
+ bool HasSelection
+ {
get {
TextIter dummy, dummy2;
return GetSelectionBounds (out dummy, out dummy2);
}
}
- public string GetSelectedText () {
+ public string GetSelectedText ()
+ {
if (HasSelection)
{
TextIter select1, select2;
GetSelectionBounds (out select1, out select2);
return GetText (select1, select2, true);
}
+
return String.Empty;
}
- bool IClipboardHandler.EnableCut {
+ bool IClipboardHandler.EnableCut
+ {
get { return true; }
}
- bool IClipboardHandler.EnableCopy {
+ bool IClipboardHandler.EnableCopy
+ {
get { return true; }
}
- bool IClipboardHandler.EnablePaste {
+ bool IClipboardHandler.EnablePaste
+ {
get {
return true;
//return clipboard.WaitIsTextAvailable ();
}
}
- bool IClipboardHandler.EnableDelete {
+ bool IClipboardHandler.EnableDelete
+ {
get { return true; }
}
- bool IClipboardHandler.EnableSelectAll {
+ bool IClipboardHandler.EnableSelectAll
+ {
get { return true; }
}
@@ -210,11 +221,10 @@
#region Bookmark Operations
//
- // Ok, the GtkSourceView people made this extremely dificult because they took over
- // the TextMark type for their SourceMarker, So i have to marshall for them. It is annoying
- // I filed a bug.
+ // GtkSourceView made this difficult because they took over
+ // the TextMark type for their SourceMarker, so we have to marshall manually.
//
- // Again, this is retarded
+ // http://bugzilla.gnome.org/show_bug.cgi?id=132525
//
[DllImport("gtksourceview-1.0")]
static extern IntPtr gtk_source_buffer_get_markers_in_region (IntPtr raw, ref Gtk.TextIter begin, ref Gtk.TextIter end);
@@ -286,7 +296,6 @@
g_slist_free (lst);
return fnd_marker;
-
}
public void ToggleBookmark (int linenum)
@@ -309,11 +318,11 @@
bool found_marker = false;
//
- // Ok, again, this is absurd. The problem is that the buffer owns the
+ // The problem is that the buffer owns the
// reference to the marker. So, if we use the nice Gtk# stuff, we get
// a problem when we dispose it later. Thus we must basically write this
- // in C. It sucks. It really sucks.
- //
+ // in C.
+ // FIXME: Is there a bug# for this?
IntPtr current = lst;
while (current != IntPtr.Zero) {
@@ -336,12 +345,12 @@
return;
switch (type.ToString ()) {
- case "ExecutionMark":
- begin_line.LineOffset = 2;
- break;
- case "BreakpointMark":
- begin_line.LineOffset = 1;
- break;
+ case "ExecutionMark":
+ begin_line.LineOffset = 2;
+ break;
+ case "BreakpointMark":
+ begin_line.LineOffset = 1;
+ break;
}
gtk_source_buffer_create_marker (Handle, null, type.ToString (), ref begin_line);
@@ -509,7 +518,6 @@
{
TextIter start = GetIterAtOffset (offset);
TextIter end = GetIterAtOffset (offset + length);
-
Delete (start, end);
}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -1,5 +1,6 @@
using System;
using System.IO;
+using System.Runtime.InteropServices;
using MonoDevelop.Gui;
using MonoDevelop.Internal.Project;
@@ -8,20 +9,19 @@
using MonoDevelop.Core.Services;
using MonoDevelop.Services;
using MonoDevelop.Core.AddIns.Codons;
-using System.Runtime.InteropServices;
-
-using Gtk;
-using GtkSharp;
-
using MonoDevelop.Gui.Utils;
using MonoDevelop.EditorBindings.Properties;
using MonoDevelop.EditorBindings.FormattingStrategy;
-
using MonoDevelop.Services;
-namespace MonoDevelop.SourceEditor.Gui {
- public class SourceEditorDisplayBinding : IDisplayBinding {
+using Gtk;
+namespace MonoDevelop.SourceEditor.Gui
+{
+ public class SourceEditorDisplayBinding : IDisplayBinding
+ {
+ StringParserService sps = (StringParserService) ServiceManager.Services.GetService (typeof (StringParserService));
+
static SourceEditorDisplayBinding ()
{
GtkSourceView.Init ();
@@ -34,8 +34,10 @@
public virtual bool CanCreateContentForMimeType (string mimetype)
{
- if (mimetype == null) return false;
- if (mimetype.StartsWith ("text")) return true;
+ if (mimetype == null)
+ return false;
+ if (mimetype.StartsWith ("text"))
+ return true;
return false;
}
@@ -54,30 +56,19 @@
public virtual IViewContent CreateContentForLanguage (string language, string content)
{
- SourceEditorDisplayBindingWrapper w = new SourceEditorDisplayBindingWrapper ();
-
- // HACK HACK
- if (language == "C#")
- language = "text/x-csharp";
- else
- language = "text/plain";
-
- w.LoadString (language, content);
- return w;
+ return CreateContentForLanguage (language, content, null);
}
public virtual IViewContent CreateContentForLanguage (string language, string content, string new_file_name)
{
SourceEditorDisplayBindingWrapper w = new SourceEditorDisplayBindingWrapper ();
- // HACK HACK
+ // FIXME
if (language == "C#")
language = "text/x-csharp";
else
language = "text/plain";
- StringParserService sps = (StringParserService)ServiceManager.Services.GetService (typeof (StringParserService));
-
w.LoadString (language, sps.Parse (content));
return w;
}
@@ -128,13 +119,11 @@
public void JumpTo (int line, int column)
{
- // NOTE: 0 based!
-
+ // NOTE: 0 based!
TextIter itr = se.Buffer.GetIterAtLine (line);
itr.LineOffset = column;
- se.Buffer.PlaceCursor (itr);
-
+ se.Buffer.PlaceCursor (itr);
se.View.ScrollMarkOnscreen (se.Buffer.InsertMark);
se.View.GrabFocus ();
}
@@ -161,8 +150,10 @@
this.IsDirty = se.Buffer.Modified;
}
- public override bool IsReadOnly {
+ public override bool IsReadOnly
+ {
get {
+ // FIXME
return false;
}
}
@@ -196,8 +187,7 @@
public void InsertAtCursor (string s)
{
se.Buffer.InsertAtCursor (s);
- se.View.ScrollMarkOnscreen (se.Buffer.InsertMark);
-
+ se.View.ScrollMarkOnscreen (se.Buffer.InsertMark);
}
public void LoadString (string mime, string val)
@@ -228,6 +218,7 @@
se.Buffer.Redo ();
}
#endregion
+
#region Status Bar Handling
IStatusBarService statusBarService = (IStatusBarService) ServiceManager.Services.GetService (typeof (IStatusBarService));
@@ -281,9 +272,7 @@
iter.ForwardChar ();
}
- // NOTE: this is absurd, *I* should tell the status bar which numbers
- // to print.
- statusBarService.SetCaretPosition (col - 1, iter.Line, chr - 1);
+ statusBarService.SetCaretPosition (iter.Line + 1, col, chr);
}
// This is false because we at first `toggle' it to set it to true
@@ -318,22 +307,27 @@
void PropertiesChanged (object sender, PropertyEventArgs e)
{
+ // FIXME: do these seperately
se.View.ModifyFont (TextEditorProperties.Font);
se.View.ShowLineNumbers = TextEditorProperties.ShowLineNumbers;
se.Buffer.CheckBrackets = TextEditorProperties.ShowMatchingBracket;
se.View.ShowMargin = TextEditorProperties.ShowVerticalRuler;
+
if (TextEditorProperties.VerticalRulerRow > -1) {
se.View.Margin = (uint) TextEditorProperties.VerticalRulerRow;
} else {
se.View.Margin = (uint) 80; // FIXME: should i be doing this on a bad vruller setting?
}
+
if (TextEditorProperties.TabIndent > -1) {
se.View.TabsWidth = (uint) TextEditorProperties.TabIndent;
} else {
- se.View.TabsWidth = (uint) 8; // FIXME: should i be doing this on a bad tabindent setting?
+ se.View.TabsWidth = (uint) 4; // FIXME: should i be doing this on a bad tabindent setting?
}
+
se.View.InsertSpacesInsteadOfTabs = TextEditorProperties.ConvertTabsToSpaces;
se.View.AutoIndent = (TextEditorProperties.IndentStyle == IndentStyle.Auto);
+
//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)
// CANTDO: show spaces Key = "ShowSpaces"
@@ -347,9 +341,8 @@
// TODO: Code Folding Key = "EnableFolding"
// TODO: Double Buffering Key = "DoubleBuffer"
// TODO: can move past EOL Key = "CursorBehindEOL"
- // TODO: auot insert template Key = "AutoInsertTemplates"
+ // TODO: auto insert template Key = "AutoInsertTemplates"
// TODO: hide mouse while typing Key = "HideMouseCursor"
}
-
}
}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -1,10 +1,10 @@
using Gtk;
-using GtkSharp;
using Gdk;
using System;
using System.IO;
using System.Runtime.InteropServices;
+
using MonoDevelop.Core.AddIns.Conditions;
using MonoDevelop.Core.AddIns;
using MonoDevelop.Internal.Templates;
@@ -14,27 +14,30 @@
using MonoDevelop.EditorBindings.Properties;
using MonoDevelop.EditorBindings.FormattingStrategy;
using MonoDevelop.Gui.Utils;
-
using MonoDevelop.Services;
-namespace MonoDevelop.SourceEditor.Gui {
- public class SourceEditorView : SourceView, IFormattableDocument {
-
- private static GLib.GType type;
-
- SourceEditorBuffer buf;
- public readonly SourceEditor ParentEditor;
-
+namespace MonoDevelop.SourceEditor.Gui
+{
+ public class SourceEditorView : SourceView, IFormattableDocument
+ {
+ private static GLib.GType gtype;
+ public readonly SourceEditor ParentEditor;
+ internal IFormattingStrategy fmtr;
+ SourceEditorBuffer buf;
int lineToMark = -1;
-
CompletionWindow completionWindow;
- static SourceEditorView ()
+ public static new GLib.GType GType
{
- type = RegisterGType (typeof (SourceEditorView));
+ get
+ {
+ if (gtype == GLib.GType.Invalid)
+ gtype = RegisterGType (typeof (SourceEditorView));
+ return gtype;
+ }
}
- public SourceEditorView (SourceEditorBuffer buf, SourceEditor parent) : base (type)
+ public SourceEditorView (SourceEditorBuffer buf, SourceEditor parent) : base (GType)
{
this.ParentEditor = parent;
this.TabsWidth = 4;
@@ -54,7 +57,7 @@
if (e.Event.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.Event.X, (int) e.Event.Y, out x, out y);
TextIter line;
int top;
@@ -144,7 +147,7 @@
switch ((char)key) {
case ' ':
if (1 == 1) {
- string word = GetWordBeforeCaret();
+ string word = GetWordBeforeCaret ();
if (word != null) {
CodeTemplateGroup templateGroup = CodeTemplateLoader.GetTemplateGroupPerFilename(ParentEditor.DisplayBinding.ContentName);
@@ -198,14 +201,14 @@
return ++offset;
}
- public string GetWordBeforeCaret()
+ public string GetWordBeforeCaret ()
{
int offset = buf.GetIterAtMark (buf.InsertMark).Offset;
int start = FindPrevWordStart (buf.Text, offset);
return buf.Text.Substring (start, offset - start);
}
- public int DeleteWordBeforeCaret()
+ public int DeleteWordBeforeCaret ()
{
int offset = buf.GetIterAtMark (buf.InsertMark).Offset;
int start = FindPrevWordStart (buf.Text, offset);
@@ -214,13 +217,14 @@
}
- public void InsertTemplate(CodeTemplate template)
+ public void InsertTemplate (CodeTemplate template)
{
- int newCaretOffset = buf.GetIterAtMark (buf.InsertMark).Offset;
- string word = GetWordBeforeCaret().Trim();
- if (word.Length > 0) {
- newCaretOffset = DeleteWordBeforeCaret();
- }
+ int newCaretOffset = buf.GetIterAtMark (buf.InsertMark).Offset;
+ string word = GetWordBeforeCaret ().Trim ();
+
+ if (word.Length > 0)
+ newCaretOffset = DeleteWordBeforeCaret ();
+
int finalCaretOffset = newCaretOffset;
for (int i =0; i < template.Text.Length; ++i) {
@@ -244,6 +248,7 @@
break;
}
}
+
buf.PlaceCursor (buf.GetIterAtOffset (finalCaretOffset));
}
@@ -369,15 +374,22 @@
Buffer.Insert (begin, txt);
}
- IndentStyle IFormattableDocument.IndentStyle {
+ IndentStyle IFormattableDocument.IndentStyle
+ {
get { return TextEditorProperties.IndentStyle; }
}
- bool IFormattableDocument.AutoInsertCurlyBracket {
+
+ bool IFormattableDocument.AutoInsertCurlyBracket
+ {
get { return TextEditorProperties.AutoInsertCurlyBracket; }
}
- string IFormattableDocument.TextContent { get { return Buffer.Text; } }
- int IFormattableDocument.TextLength { get { return Buffer.EndIter.Offset; } }
+ string IFormattableDocument.TextContent
+ { get { return Buffer.Text; } }
+
+ int IFormattableDocument.TextLength
+ { get { return Buffer.EndIter.Offset; } }
+
char IFormattableDocument.GetCharAt (int offset)
{
TextIter it = Buffer.GetIterAtOffset (offset);
@@ -389,7 +401,8 @@
Buffer.Insert (Buffer.GetIterAtOffset (offset), text);
}
- string IFormattableDocument.IndentString {
+ string IFormattableDocument.IndentString
+ {
get { return !InsertSpacesInsteadOfTabs ? "\t" : new string (' ', (int) TabsWidth); }
}
@@ -401,16 +414,13 @@
openingLine = offset == -1 ? -1 : Buffer.GetIterAtOffset (offset).Line;
return offset;
}
+
void IFormattableDocument.GetLineLengthInfo (int ln, out int offset, out int len)
{
TextIter begin = Buffer.GetIterAtLine (ln);
offset = begin.Offset;
len = begin.CharsInLine;
}
-
- internal IFormattingStrategy fmtr;
-
-
#endregion
}
}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorWidget.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorWidget.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorWidget.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -1,27 +1,33 @@
using Gtk;
-using GtkSharp;
-using Gdk;
using System;
-using System.IO;
using System.Runtime.InteropServices;
-namespace MonoDevelop.SourceEditor.Gui {
- public class SourceEditor : ScrolledWindow {
-
+namespace MonoDevelop.SourceEditor.Gui
+{
+ public class SourceEditor : ScrolledWindow
+ {
public readonly SourceEditorBuffer Buffer;
public readonly SourceEditorView View;
public readonly SourceEditorDisplayBindingWrapper DisplayBinding;
+ private static GLib.GType gtype;
- public SourceEditor (SourceEditorDisplayBindingWrapper bind) : base ()
+ public static new GLib.GType GType
{
+ get
+ {
+ if (gtype == GLib.GType.Invalid)
+ gtype = RegisterGType (typeof (SourceEditor));
+ return gtype;
+ }
+ }
+
+ public SourceEditor (SourceEditorDisplayBindingWrapper bind) : base (GType)
+ {
ShadowType = Gtk.ShadowType.In;
DisplayBinding = bind;
- Buffer = new SourceEditorBuffer ();
-
+ Buffer = new SourceEditorBuffer ();
View = new SourceEditorView (Buffer, this);
-
-
Buffer.Highlight = true;
View.SetMarkerPixbuf ("SourceEditorBookmark", new Gdk.Pixbuf (drag_icon_xpm));
@@ -41,7 +47,8 @@
View.ClearExecutingAt (linenumber);
}
- public string Text {
+ public string Text
+ {
get { return Buffer.Text; }
set { Buffer.Text = value; }
}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Makefile.am
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Makefile.am 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Makefile.am 2004-03-12 00:15:29 UTC (rev 1155)
@@ -21,7 +21,8 @@
./Gui/OptionPanels/MarkersTextEditorPanel.cs \
./Gui/OptionPanels/CodeTemplatePanel.cs \
./Gui/OptionPanels/GeneralTextEditorPanel.cs \
-./Gui/EditTemplateGroupDialog.cs \
+./Gui/Dialogs/EditTemplateGroupDialog.cs \
+./Gui/Dialogs/ExportProjectToHtmlDialog.cs \
./Gui/Dialogs/GotoLineNumberDialog.cs \
./Gui/Dialogs/ReplaceDialog.cs \
./Gui/Dialogs/ReplaceInFilesDialog.cs \
Modified: trunk/MonoDevelop/src/Main/Base/Gui/Components/StatusBar/SdStatusBar.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Components/StatusBar/SdStatusBar.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Components/StatusBar/SdStatusBar.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -16,23 +16,27 @@
Statusbar txtStatusBarPanel = new Statusbar ();
Statusbar cursorStatusBarPanel = new Statusbar ();
Statusbar modeStatusBarPanel = new Statusbar ();
+ bool cancelEnabled;
+ const int ctx = 1;
private static GLib.GType gtype;
- public Statusbar CursorStatusBarPanel {
+ /*
+ public Statusbar CursorStatusBarPanel
+ {
get {
return cursorStatusBarPanel;
}
- }
+ }*/
- public Statusbar ModeStatusBarPanel {
+ public Statusbar ModeStatusBarPanel
+ {
get {
return modeStatusBarPanel;
}
}
-
- bool cancelEnabled;
- public bool CancelEnabled {
+ public bool CancelEnabled
+ {
get {
return cancelEnabled;
}
@@ -41,7 +45,8 @@
}
}
- public static new GLib.GType GType {
+ public static new GLib.GType GType
+ {
get {
if (gtype == GLib.GType.Invalid)
gtype = RegisterGType (typeof (SdStatusBar));
@@ -66,57 +71,62 @@
public void ShowErrorMessage(string message)
{
- txtStatusBarPanel.Push (1, "Error : " + message);
+ txtStatusBarPanel.Push (ctx, "Error : " + message);
}
public void ShowErrorMessage(Image image, string message)
{
- txtStatusBarPanel.Push (1, "Error : " + message);
+ txtStatusBarPanel.Push (ctx, "Error : " + message);
}
- public void SetMessage(string message)
+ public void SetCursorPosition (int ln, int col, int ch)
{
- txtStatusBarPanel.Push (1, message);
+ // FIXME: I18N
+ // FIXME: Properly space, perhaps 3 seperate Labels
+ cursorStatusBarPanel.Push (ctx, String.Format ("ln {0} col {1} ch {2}", ln, col, ch));
}
- public void SetMessage(Image image, string message)
+ public void SetMessage (string message)
{
- txtStatusBarPanel.Push (1, message);
+ txtStatusBarPanel.Push (ctx, message);
}
+ public void SetMessage (Image image, string message)
+ {
+ txtStatusBarPanel.Push (ctx, message);
+ }
+
// Progress Monitor implementation
- string oldMessage = null;
- public void BeginTask(string name, int totalWork)
+ public void BeginTask (string name, int totalWork)
{
- //oldMessage = txtStatusBarPanel.Pop (1);
- SetMessage(name);
- //statusProgressBar.Maximum = totalWork;
+ SetMessage (name);
this.Progress.Visible = true;
}
- public void Worked(int work, string status)
+ public void Worked (int work, string status)
{
this.Progress.Fraction = (double) work;
this.Progress.Text = status;
}
- public void Done()
+ public void Done ()
{
- SetMessage(oldMessage);
- oldMessage = null;
+ txtStatusBarPanel.Pop (ctx);
this.Progress.Visible = false;
}
- public bool Canceled {
+ public bool Canceled
+ {
get {
- return oldMessage == null;
+ return true;
}
set {
- Done();
+ Done ();
}
}
- public string TaskName {
+ public string TaskName
+ {
get {
return "";
}
Modified: trunk/MonoDevelop/src/Main/Base/Services/StatusBar/DefaultStatusBarService.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Services/StatusBar/DefaultStatusBarService.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/Main/Base/Services/StatusBar/DefaultStatusBarService.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -56,28 +56,24 @@
}
}
- public void SetCaretPosition(int x, int y, int charOffset)
+ public void SetCaretPosition (int ln, int col, int ch)
{
- StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService));
- statusBar.CursorStatusBarPanel.Push (1, stringParserService.Parse("${res:StatusBarService.CursorStatusBarPanelText}",
- new string[,] { {"Line", String.Format("{0,-10}", y + 1)},
- {"Column", String.Format("{0,-5}", x + 1)},
- {"Character", String.Format("{0,-5}", charOffset + 1)}}));
+ statusBar.SetCursorPosition (ln, col, ch);
}
- public void SetInsertMode(bool insertMode)
+ public void SetInsertMode (bool insertMode)
{
StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService));
statusBar.ModeStatusBarPanel.Push (1, insertMode ? stringParserService.Parse("${res:StatusBarService.CaretModes.Insert}") : stringParserService.Parse("${res:StatusBarService.CaretModes.Overwrite}"));
}
- public void ShowErrorMessage(string message)
+ public void ShowErrorMessage (string message)
{
Debug.Assert(statusBar != null);
statusBar.ShowErrorMessage(stringParserService.Parse(message));
}
- public void SetMessage(string message)
+ public void SetMessage (string message)
{
Debug.Assert(statusBar != null);
lastMessage = message;
Modified: trunk/MonoDevelop/src/Main/Base/Services/StatusBar/IStatusBarService.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Services/StatusBar/IStatusBarService.cs 2004-03-12 00:06:25 UTC (rev 1154)
+++ trunk/MonoDevelop/src/Main/Base/Services/StatusBar/IStatusBarService.cs 2004-03-12 00:15:29 UTC (rev 1155)
@@ -30,8 +30,8 @@
void SetMessage(string message);
//void SetMessage(Image image, string message);
- void SetCaretPosition(int x, int y, int charOffset);
- void SetInsertMode(bool insertMode);
+ void SetCaretPosition (int ln, int col, int ch);
+ void SetInsertMode (bool insertMode);
void RedrawStatusbar();
}
More information about the Monodevelop-patches-list
mailing list