diff options
author | Lluis Sanchez <lluis@novell.com> | 2007-12-04 14:06:06 +0300 |
---|---|---|
committer | Lluis Sanchez <lluis@novell.com> | 2007-12-04 14:06:06 +0300 |
commit | 1b5db90ae2b22dacbe76aa3a2e612e6f9ba195d4 (patch) | |
tree | 77a8189a3e006bfd927c09dcd226cfd77986cd91 /main | |
parent | c9ceadfcfcf68b4c4c2e10b356dffc1d35ebe76e (diff) |
Directory reorganization
svn path=/branches/monodevelop/reorg/; revision=90652
Diffstat (limited to 'main')
303 files changed, 0 insertions, 40252 deletions
diff --git a/main/Unused/GladeAddIn/ChangeLog b/main/Unused/GladeAddIn/ChangeLog deleted file mode 100644 index 2af91703cf..0000000000 --- a/main/Unused/GladeAddIn/ChangeLog +++ /dev/null @@ -1,69 +0,0 @@ -2006-03-24 Lluis Sanchez Gual <lluis@novell.com> - - * GladeAddIn.mdp: Updated. - * Makefile.am: Use an unified format. Patch by Matze Braun. - * GladeAddIn.addin.xml: Updated add-in versions. - -2006-02-24 Lluis Sanchez Gual <lluis@novell.com> - - * GladeAddIn.Gui/GladeService.cs: Catch errors while creating - a project. - * GladeAddIn.Gui/GuiBuilderDisplayBinding.cs: - * GladeAddIn.Gui/GladeFileDisplayBinding.cs: Track api changes. - -2006-01-22 Lluis Sanchez Gual <lluis@novell.com> - - * GladeAddIn.Gui/GladeService.cs: Enable layout switching when selecting - a window file. - -2006-01-18 Lluis Sanchez Gual <lluis@novell.com> - - * GladeAddIn.Gui/GladePalettePad.cs: Hide the palette buttons which - create a top level window. - * GladeAddIn.addin.xml: Assign an Id to the file templates. - Added commands for creating a window and dialog. - * GladeAddIn.Gui/ProjectFolderNodeBuilderExtension.cs: - * GladeAddIn.Commands/GladeCommands.cs: Implemented new commands. - * GladeAddIn.Gui/GladeFileDisplayBinding.cs: New display binding - for glade files that just does nothing (it avoids starting glade - when clicking on the glade resource file). - * GladeAddIn.mdp: Updated. - - * templates/GladeWindow.xft.xml: - * templates/GladeDialog.xft.xml: Moved to Gtk category. - - * GladeAddIn.Gui/GladePropertiesPad.cs: - * GladeAddIn.Gui/GladeProjectNodeBuilder.cs: - * GladeAddIn.Gui/GuiBuilderProject.cs: - * GladeAddIn.Gui/GuiBuilderWindow.cs: - * GladeAddIn.Gui/GladeWidgetTreePad.cs: - * GladeAddIn.Gui/ClassUtils.cs: - * GladeAddIn.Gui/GuiBuilderView.cs: - * GladeAddIn.Gui/WindowsFolder.cs: - * GladeAddIn.Gui/GladeProjectPad.cs: - * GladeAddIn.Gui/PreviewBox.cs: - * GladeAddIn.Gui/GladeService.cs: - * GladeAddIn.Gui/GuiBuilderProjectNodeBuilder.cs: - * GladeAddIn.Gui/GuiBuilderWindowNodeBuilder.cs: - * GladeAddIn.Gui/WindowsFolderNodeBuilder.cs: - * GladeAddIn.Gui/EmbedWindow.cs: - * GladeAddIn.Gui/GuiBuilderEditSession.cs: - * GladeAddIn.Gui/GladeFileTemplate.cs: - * GladeAddIn.Gui/GuiBuilderDisplayBinding.cs: Added license header. - - * Makefile.am: Added new files. - -2006-01-13 Lluis Sanchez Gual <lluis@novell.com> - - * GladeAddIn.Gui/GladePropertiesPad.cs: - * GladeAddIn.Gui/GladePalettePad.cs: - * GladeAddIn.Gui/GladeWidgetTreePad.cs: - * GladeAddIn.Gui/GladeProjectPad.cs: Set a better default placement - for the pads. - - * GladeAddIn.Gui/GladeFileTemplate.cs: When adding a window or - dialog, create a new glade file if it doesn't yet exist. - -2006-01-10 Lluis Sanchez Gual <lluis@novell.com> - - Initial implementation of the glade-3 add-in diff --git a/main/Unused/GladeAddIn/GladeAddIn.Commands/GladeCommands.cs b/main/Unused/GladeAddIn/GladeAddIn.Commands/GladeCommands.cs deleted file mode 100644 index 88b8fe30ea..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.Commands/GladeCommands.cs +++ /dev/null @@ -1,36 +0,0 @@ -// -// GladeCommands.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -namespace GladeAddIn -{ - public enum GladeCommands - { - AddNewDialog, - AddNewWindow, - } -} diff --git a/main/Unused/GladeAddIn/GladeAddIn.Gui/ClassUtils.cs b/main/Unused/GladeAddIn/GladeAddIn.Gui/ClassUtils.cs deleted file mode 100644 index c2f2ed206b..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.Gui/ClassUtils.cs +++ /dev/null @@ -1,79 +0,0 @@ -// -// ClassUtils.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using Gtk; -using System; -using System.Collections; -using System.CodeDom; -using MonoDevelop.Projects.Parser; - -namespace GladeAddIn.Gui -{ - internal class ClassUtils - { - public static IField FindWidgetField (IClass cls, string name) - { - foreach (IField field in cls.Fields) { - if (name == GetWidgetFieldName (field)) - return field; - } - return null; - } - - public static string GetWidgetFieldName (IField field) - { - foreach (IAttributeSection asec in field.Attributes) { - foreach (IAttribute att in asec.Attributes) { - if (att.Name == "Glade.Widget" || att.Name == "Widget" || att.Name == "Glade.WidgetAttribute" || att.Name == "WidgetAttribute") { - if (att.PositionalArguments != null && att.PositionalArguments.Length > 0) { - CodePrimitiveExpression exp = att.PositionalArguments [0] as CodePrimitiveExpression; - if (exp != null) - return exp.Value.ToString (); - } else { - return field.Name; - } - } - } - } - return null; - } - - public static string GetWindowId (IClass cls) - { - foreach (IField f in cls.Fields) { - if (f.ReturnType.FullyQualifiedName != "Gtk.Dialog" && f.ReturnType.FullyQualifiedName != "Gtk.Window") - continue; - - string name = GetWidgetFieldName (f); - if (name != null) - return name; - } - return null; - } - } -} diff --git a/main/Unused/GladeAddIn/GladeAddIn.Gui/EmbedWindow.cs b/main/Unused/GladeAddIn/GladeAddIn.Gui/EmbedWindow.cs deleted file mode 100644 index 441b7753cc..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.Gui/EmbedWindow.cs +++ /dev/null @@ -1,126 +0,0 @@ -// -// EmbedWindow.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using Gtk; -using System; -using System.Collections; - -namespace GladeAddIn.Gui { - - public class EmbedWindow { - - public static Widget Wrap (Window window) - { - if (window.IsRealized) - throw new ApplicationException ("Cannot make a realized window embeddable"); - - window.WidgetFlags &= ~(WidgetFlags.Toplevel); - window.SizeAllocated += new SizeAllocatedHandler (OnSizeAllocated); - window.Realized += new EventHandler (OnRealized); - - PreviewBox prev = new PreviewBox (window); - prev.Title = window.Title; - prev.Theme = Theme; - return prev; - } - - static private void OnSizeAllocated (object obj, SizeAllocatedArgs args) - { - Window window = obj as Window; - Gdk.Rectangle allocation = args.Allocation; - - if (window.IsRealized) { - window.GdkWindow.MoveResize (allocation.X, - allocation.Y, - allocation.Width, - allocation.Height); - } - } - - static private void OnRealized (object obj, EventArgs args) - { - Window window = obj as Window; - - window.WidgetFlags |= WidgetFlags.Realized; - - Gdk.WindowAttr attrs = new Gdk.WindowAttr (); - attrs.Mask = window.Events | - (Gdk.EventMask.ExposureMask | - Gdk.EventMask.KeyPressMask | - Gdk.EventMask.KeyReleaseMask | - Gdk.EventMask.EnterNotifyMask | - Gdk.EventMask.LeaveNotifyMask | - Gdk.EventMask.StructureMask); - attrs.X = window.Allocation.X; - attrs.Y = window.Allocation.Y; - attrs.Width = window.Allocation.Width; - attrs.Height = window.Allocation.Height; - attrs.Wclass = Gdk.WindowClass.InputOutput; - attrs.Visual = window.Visual; - attrs.Colormap = window.Colormap; - attrs.WindowType = Gdk.WindowType.Child; - - Gdk.WindowAttributesType mask = - Gdk.WindowAttributesType.X | - Gdk.WindowAttributesType.Y | - Gdk.WindowAttributesType.Colormap | - Gdk.WindowAttributesType.Visual; - - window.GdkWindow = new Gdk.Window (window.ParentWindow, attrs, mask); - window.GdkWindow.UserData = window.Handle; - - window.Style = window.Style.Attach (window.GdkWindow); - window.Style.SetBackground (window.GdkWindow, StateType.Normal); - - // FIXME: gtk-sharp 2.6 - // window.GdkWindow.EnableSynchronizedConfigure (); - } - - static Metacity.Theme theme; - static Metacity.Theme Theme { - get { - if (theme == null) { - GConf.Client client = new GConf.Client (); -// client.AddNotify ("/apps/metacity/general", GConfNotify); - string themeName = (string)client.Get ("/apps/metacity/general/theme"); - theme = Metacity.Theme.Load (themeName); - } - return theme; - } - } - -/* static void GConfNotify (object obj, GConf.NotifyEventArgs args) - { - if (args.Key == "/apps/metacity/general/theme") { - theme = Metacity.Theme.Load ((string)args.Value); - foreach (Metacity.Preview prev in wrappers.Values) - prev.Theme = Theme; - } - } -*/ } -} diff --git a/main/Unused/GladeAddIn/GladeAddIn.Gui/GladeFileDisplayBinding.cs b/main/Unused/GladeAddIn/GladeAddIn.Gui/GladeFileDisplayBinding.cs deleted file mode 100644 index 106e1128ab..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.Gui/GladeFileDisplayBinding.cs +++ /dev/null @@ -1,59 +0,0 @@ -// -// GladeFileDisplayBinding.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - - -using System; -using System.IO; -using MonoDevelop.Ide.Codons; -using MonoDevelop.Ide.Gui; - -namespace GladeAddIn.Gui -{ - public class GladeFileDisplayBinding: IDisplayBinding - { - public bool CanCreateContentForFile (string fileName) - { - return Path.GetExtension (fileName) == ".glade"; - } - - public bool CanCreateContentForMimeType (string mimetype) - { - return false; - } - - public IViewContent CreateContentForFile(string fileName) - { - return null; - } - - public IViewContent CreateContentForMimeType (string mimeType, Stream content) - { - return null; - } - } -} diff --git a/main/Unused/GladeAddIn/GladeAddIn.Gui/GladeFileTemplate.cs b/main/Unused/GladeAddIn/GladeAddIn.Gui/GladeFileTemplate.cs deleted file mode 100644 index 35aaee90c1..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.Gui/GladeFileTemplate.cs +++ /dev/null @@ -1,87 +0,0 @@ -// -// GladeFileTemplate.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - - -using System; -using System.IO; - -using MonoDevelop.Core; -using MonoDevelop.Projects; -using MonoDevelop.Projects.Parser; -using MonoDevelop.Ide.Gui; -using MonoDevelop.Ide.Templates; - -namespace GladeAddIn.Gui -{ - public class GladeFileTemplate: FileTemplate - { - protected override void CreateProjectFile (Project project, string fileName, string fileContent) - { - GuiBuilderProject[] projects = GladeService.GetGuiBuilderProjects (project); - GuiBuilderProject gproject = null; - if (projects.Length == 0) { - // Create an empty glade file - string gladeFile = Path.Combine (project.BaseDirectory, "gui.glade"); - StreamWriter sw = new StreamWriter (gladeFile); - sw.WriteLine ("<?xml version=\"1.0\" standalone=\"no\"?> <!--*- mode: xml -*-->"); - sw.WriteLine ("<!DOCTYPE glade-interface SYSTEM \"http://glade.gnome.org/glade-2.0.dtd\">"); - sw.WriteLine ("<glade-interface>"); - sw.WriteLine ("</glade-interface>"); - sw.Close (); - ProjectFile file = new ProjectFile (gladeFile, BuildAction.EmbedAsResource); - project.ProjectFiles.Add (file); - projects = GladeService.GetGuiBuilderProjects (project); - if (projects.Length > 0) - gproject = projects [0]; - else - throw new UserException ("A new glade file for the window could not be created."); - } else { - gproject = projects [0]; - } - - fileContent = fileContent.Replace ("${GladeFile}", System.IO.Path.GetFileName (gproject.File)); - - base.CreateProjectFile (project, fileName, fileContent); - - ProjectFile pf = project.ProjectFiles.GetFile (fileName); - if (pf == null || pf.BuildAction != BuildAction.Compile) - return; - - IParseInformation pinfo = IdeApp.ProjectOperations.ParserDatabase.UpdateFile (project, fileName, fileContent); - if (pinfo == null) return; - - ICompilationUnit cunit = (ICompilationUnit)pinfo.BestCompilationUnit; - foreach (IClass cls in cunit.Classes) { - string id = ClassUtils.GetWindowId (cls); - if (id != null) { - gproject.NewDialog (id); - } - } - } - } -} diff --git a/main/Unused/GladeAddIn/GladeAddIn.Gui/GladePalettePad.cs b/main/Unused/GladeAddIn/GladeAddIn.Gui/GladePalettePad.cs deleted file mode 100644 index 7ded0ffd30..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.Gui/GladePalettePad.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -// GladePalettePad.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - - -using System; -using Gtk; -using MonoDevelop.Ide.Gui; - -namespace GladeAddIn.Gui -{ - public class GladePalettePad: AbstractPadContent - { - Gtk.Widget widget; - - public GladePalettePad (): base ("") - { - DefaultPlacement = "right"; - try { - widget = GladeService.App.Palette; - widget.ShowAll (); - HideWindowWidgets (widget); - } catch (Exception ex) { - Console.WriteLine (ex); - } - } - - public override Gtk.Widget Control { - get { return widget; } - } - - void HideWindowWidgets (Gtk.Widget w) - { - if (w is Gtk.RadioButton) { - IntPtr data = w.GetData ("user"); - if (!data.Equals (IntPtr.Zero)) { - Gladeui.WidgetClass wc = new Gladeui.WidgetClass (data); - Type t = (Type) wc.Type; - if (typeof(Gtk.Window).IsAssignableFrom (t)) - w.Hide (); - } - } else if (w is Gtk.Container) { - foreach (Widget cw in ((Container)w).Children) - HideWindowWidgets (cw); - } - } - } -} diff --git a/main/Unused/GladeAddIn/GladeAddIn.Gui/GladeProjectNodeBuilder.cs b/main/Unused/GladeAddIn/GladeAddIn.Gui/GladeProjectNodeBuilder.cs deleted file mode 100644 index 42b93b0524..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.Gui/GladeProjectNodeBuilder.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// GladeProjectNodeBuilder.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; - -using MonoDevelop.Projects; -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui.Pads; -using MonoDevelop.Ide.Gui; - -namespace GladeAddIn.Gui -{ - public class GladeProjectNodeBuilder: NodeBuilderExtension - { - public override bool CanBuildNode (Type dataType) - { - return typeof(Project).IsAssignableFrom (dataType); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - GuiBuilderProject[] projects = GladeService.GetGuiBuilderProjects ((Project)dataObject); - if (projects.Length != 0) - builder.AddChild (new WindowsFolder ((Project)dataObject)); - } - } -} diff --git a/main/Unused/GladeAddIn/GladeAddIn.Gui/GladeProjectPad.cs b/main/Unused/GladeAddIn/GladeAddIn.Gui/GladeProjectPad.cs deleted file mode 100644 index 84a10ac823..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.Gui/GladeProjectPad.cs +++ /dev/null @@ -1,90 +0,0 @@ -// -// GladeProjectPad.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - - -using System; -using Gtk; -using MonoDevelop.Ide.Gui; -using MonoDevelop.Ide.Commands; -using MonoDevelop.Components.Commands; - -namespace GladeAddIn.Gui -{ - public class GladeProjectPad: AbstractPadContent - { - Gladeui.ProjectView pview; - - public GladeProjectPad (): base ("") - { - DefaultPlacement = "bottom"; - pview = new Gladeui.ProjectView (Gladeui.ProjectViewType.Tree); - GladeService.App.AddProjectView (pview); - pview.ShowAll (); - } - - public override Gtk.Widget Control { - get { return pview; } - } - - [CommandHandler (EditCommands.Undo)] - protected void OnUndo () - { - GladeService.App.CommandUndo (); - } - - [CommandHandler (EditCommands.Redo)] - protected void OnRedo () - { - GladeService.App.CommandRedo (); - } - - [CommandHandler (EditCommands.Copy)] - protected void OnCopy () - { - GladeService.App.CommandCopy (); - } - - [CommandHandler (EditCommands.Cut)] - protected void OnCut () - { - GladeService.App.CommandCut (); - } - - [CommandHandler (EditCommands.Paste)] - protected void OnPaste () - { - GladeService.App.CommandPaste (); - } - - [CommandHandler (EditCommands.Delete)] - protected void OnDelete () - { - GladeService.App.CommandDelete (); - } - } -} diff --git a/main/Unused/GladeAddIn/GladeAddIn.Gui/GladePropertiesPad.cs b/main/Unused/GladeAddIn/GladeAddIn.Gui/GladePropertiesPad.cs deleted file mode 100644 index 3ed2520d8c..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.Gui/GladePropertiesPad.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// GladePropertiesPad.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - - -using System; -using Gtk; -using MonoDevelop.Ide.Gui; - -namespace GladeAddIn.Gui -{ - public class GladePropertiesPad: AbstractPadContent - { - Gtk.Widget widget; - Button addButton; - - public GladePropertiesPad (): base ("") - { - DefaultPlacement = "GladeAddIn.Gui.GladeWidgetTreePad/right; bottom"; - VBox box = new VBox (); - CheckButton la = new CheckButton ("Map to code"); - // box.PackStart (la, false, false, 6); - box.PackStart (GladeService.App.Editor, true, true, 0); - widget = box; - - Pango.FontDescription fd = widget.Style.FontDesc.Copy (); - Console.WriteLine ("fd.Size:" + fd.Size); - fd.Size /= 2; - Console.WriteLine ("fd.Size:" + fd.Size); - la.ModifyFont (Pango.FontDescription.FromString ("Arial 4pt")); - la.ModifyBg (StateType.Normal, new Gdk.Color (255,0,0)); - - HButtonBox bbox = GladeService.App.Editor.Children [1] as HButtonBox; - Button rbut = bbox.Children [0] as Button; - addButton = new Button ("Add to class"); - addButton.BorderWidth = rbut.BorderWidth; - bbox.PackStart (addButton, false, true, 0); - addButton.Clicked += new EventHandler (OnAdd); - - widget.ShowAll (); - } - - public override Gtk.Widget Control { - get { return widget; } - } - - void OnAdd (object s, EventArgs a) - { - GladeService.AddCurrentWidgetToClass (); - } - } -} diff --git a/main/Unused/GladeAddIn/GladeAddIn.Gui/GladeService.cs b/main/Unused/GladeAddIn/GladeAddIn.Gui/GladeService.cs deleted file mode 100644 index d3d05ac504..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.Gui/GladeService.cs +++ /dev/null @@ -1,223 +0,0 @@ -// -// GladeService.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Reflection; -using System.Collections; -using System.CodeDom; - -using MonoDevelop.Ide.Gui; -using MonoDevelop.Ide.Gui.Content; -using MonoDevelop.Projects; -using MonoDevelop.Projects.Parser; -using MonoDevelop.Projects.CodeGeneration; -using MonoDevelop.Core.Gui; -using MonoDevelop.Projects.Text; - -namespace GladeAddIn.Gui -{ - class GladeService - { - static Gladeui.App gladeApp; - static Hashtable projects = new Hashtable (); - static ProjectFileEventHandler fileAddedHandler; - static CombineEntryEventHandler entryRemovedHander; - static GladeWidgetTreePad widgetTreePad; - internal static Gladeui.Project EmptyProject; - static string GuiBuilderLayout = "GUI Builder"; - static string defaultLayout; - - static GladeService () - { - gladeApp = new Gladeui.App (); - Gladeui.App.SetDefaultApp (gladeApp); - gladeApp.Window = IdeApp.Workbench.RootWindow; - gladeApp.TransientParent = IdeApp.Workbench.RootWindow; - - fileAddedHandler = (ProjectFileEventHandler) MonoDevelop.Core.Gui.Services.DispatchService.GuiDispatch (new ProjectFileEventHandler (OnFileAdded)); - entryRemovedHander = (CombineEntryEventHandler) MonoDevelop.Core.Gui.Services.DispatchService.GuiDispatch (new CombineEntryEventHandler (OnEntryRemoved)); - - EmptyProject = new Gladeui.Project (true); - gladeApp.AddProject (EmptyProject); - gladeApp.Project = EmptyProject; - - IdeApp.ProjectOperations.CombineOpened += new CombineEventHandler (OnOpenCombine); - IdeApp.ProjectOperations.CombineClosed += new CombineEventHandler (OnCloseCombine); - IdeApp.Workbench.ActiveDocumentChanged += new EventHandler (OnActiveDocumentChanged); - } - - internal static GladeWidgetTreePad WidgetTreePad { - get { return widgetTreePad; } - set { widgetTreePad = value; } - } - - static void OnActiveDocumentChanged (object s, EventArgs args) - { - if (IdeApp.Workbench.ActiveDocument == null) { - gladeApp.Project = EmptyProject; - if (widgetTreePad != null) - widgetTreePad.Fill (null); - RestoreLayout (); - return; - } - - GuiBuilderView view = IdeApp.Workbench.ActiveDocument.Content as GuiBuilderView; - if (view != null) { - gladeApp.Project = view.EditSession.GladeProject; - if (widgetTreePad != null) - widgetTreePad.Fill (view.EditSession.GladeWidget); - SetDesignerLayout (); - } - else { - gladeApp.Project = EmptyProject; - if (widgetTreePad != null) - widgetTreePad.Fill (null); - RestoreLayout (); - } - } - - static void SetDesignerLayout () - { - if (IdeApp.Workbench.CurrentLayout != GuiBuilderLayout) { - bool exists = Array.IndexOf (IdeApp.Workbench.Layouts, GuiBuilderLayout) == -1; - defaultLayout = IdeApp.Workbench.CurrentLayout; - IdeApp.Workbench.CurrentLayout = GuiBuilderLayout; - if (!exists) { - Pad p = IdeApp.Workbench.Pads [typeof(GladePalettePad)]; - if (p != null) p.Visible = true; - p = IdeApp.Workbench.Pads [typeof(GladeWidgetTreePad)]; - if (p != null) p.Visible = true; - p = IdeApp.Workbench.Pads [typeof(GladePropertiesPad)]; - if (p != null) p.Visible = true; - } - } - } - - static void RestoreLayout () - { - if (defaultLayout != null) { - IdeApp.Workbench.CurrentLayout = defaultLayout; - defaultLayout = null; - } - } - - public static GuiBuilderProject[] GetGuiBuilderProjects (Project project) - { - ArrayList list = (ArrayList) projects [project]; - if (list == null) { - list = new ArrayList (); - projects [project] = list; - - foreach (ProjectFile file in project.ProjectFiles) { - RegisterGuiBuilderProject (project, file.Name); - } - gladeApp.Project = EmptyProject; - } - return (GuiBuilderProject[]) list.ToArray (typeof(GuiBuilderProject)); - } - - static GuiBuilderProject RegisterGuiBuilderProject (Project project, string fileName) - { - if (!fileName.EndsWith (".glade")) - return null; - - ArrayList list = (ArrayList) projects [project]; - if (list == null) - return null; - - try { - GuiBuilderProject fp = new GuiBuilderProject (gladeApp, project, fileName); - list.Add (fp); - return fp; - } catch (Exception ex) { - Console.WriteLine (ex); - return null; - } - } - - static void OnOpenCombine (object s, CombineEventArgs args) - { - args.Combine.EntryRemoved += entryRemovedHander; - args.Combine.FileAddedToProject += fileAddedHandler; - } - - static void OnCloseCombine (object s, CombineEventArgs args) - { - args.Combine.EntryRemoved -= entryRemovedHander; - args.Combine.FileAddedToProject -= fileAddedHandler; - CloseEntry (args.Combine); - } - - static void OnEntryRemoved (object s, CombineEntryEventArgs args) - { - CloseEntry (args.CombineEntry); - } - - static void CloseEntry (CombineEntry entry) - { - if (entry is Project) { - Project project = (Project) entry; - ArrayList list = (ArrayList) projects [project]; - if (list != null) { - foreach (GuiBuilderProject gproject in list) { - gladeApp.RemoveProject (gproject.GladeProject); - gproject.Dispose (); - } - projects.Remove (project); - } - } else if (entry is Combine) { - foreach (CombineEntry e in ((Combine)entry).Entries) - CloseEntry (e); - } - } - - static void OnFileAdded (object ob, ProjectFileEventArgs args) - { - // If it's a new glade file, register it - RegisterGuiBuilderProject (args.Project, args.ProjectFile.Name); - } - - internal static void SetActiveProject (Gladeui.Project gproject) - { - gladeApp.Project = gproject; - } - - internal static void AddCurrentWidgetToClass () - { - if (IdeApp.Workbench.ActiveDocument != null) { - GuiBuilderView view = IdeApp.Workbench.ActiveDocument.Content as GuiBuilderView; - if (view != null) - view.AddCurrentWidgetToClass (); - } - } - - public static Gladeui.App App { - get { return gladeApp; } - } - } -} diff --git a/main/Unused/GladeAddIn/GladeAddIn.Gui/GladeWidgetTreePad.cs b/main/Unused/GladeAddIn/GladeAddIn.Gui/GladeWidgetTreePad.cs deleted file mode 100644 index 0ec59564bc..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.Gui/GladeWidgetTreePad.cs +++ /dev/null @@ -1,282 +0,0 @@ -// -// GladeWidgetTreePad.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - - -using System; -using System.Collections; -using Gtk; -using MonoDevelop.Ide.Gui; -using MonoDevelop.Ide.Commands; -using MonoDevelop.Components.Commands; - -namespace GladeAddIn.Gui -{ - public class GladeWidgetTreePad: AbstractPadContent - { - TreeView tree; - TreeStore store; - Gladeui.Widget rootWidget; - ScrolledWindow control; - Hashtable items = new Hashtable (); - TreeViewColumn col; - bool selecting; - - public GladeWidgetTreePad (): base ("") - { - DefaultPlacement = "GladeAddIn.Gui.GladePropertiesPad/left; bottom"; - store = new Gtk.TreeStore ( - typeof (Gdk.Pixbuf), // image - typeof (string), // name - typeof (Gladeui.Widget)); // widget - - tree = new TreeView (store); - - col = new TreeViewColumn (); - CellRendererPixbuf pr = new CellRendererPixbuf (); - col.PackStart (pr, false); - col.AddAttribute (pr, "pixbuf", 0); - - CellRendererText crt = new CellRendererText (); - col.PackStart (crt, true); - col.AddAttribute (crt, "text", 1); - - tree.AppendColumn (col); - tree.HeadersVisible = false; - - control = new ScrolledWindow (); - control.ShadowType = Gtk.ShadowType.In; - control.Add (tree); - control.ShowAll (); - - GladeService.WidgetTreePad = this; - - tree.CursorChanged += new EventHandler (OnSelectionChanged); - control.PopupMenu += new Gtk.PopupMenuHandler (OnPopupMenu); - tree.ButtonPressEvent += new ButtonPressEventHandler (OnButtonPressed); - } - - public void Fill (Gladeui.Widget w) - { - if (rootWidget != null) { - rootWidget.Project.AddWidget -= new Gladeui.AddWidgetHandler (OnAddWidget); - rootWidget.Project.RemoveWidget -= new Gladeui.RemoveWidgetHandler (OnRemoveWidget); - rootWidget.Project.SelectionChangedEvent -= new EventHandler (OnWidgetSelectionChanged); - rootWidget.Project.WidgetNameChangedEvent -= new Gladeui.WidgetNameChangedEventHandler (OnWidgetNameChanged); - } - - rootWidget = w; - store.Clear (); - items.Clear (); - - if (w != null) { - Gtk.TreeIter iter = store.AppendValues (w.Class.Icon, w.Name, w); - items [w] = iter; - AddChildren (iter, w); - - rootWidget.Project.AddWidget += new Gladeui.AddWidgetHandler (OnAddWidget); - rootWidget.Project.RemoveWidget += new Gladeui.RemoveWidgetHandler (OnRemoveWidget); - rootWidget.Project.SelectionChangedEvent += new EventHandler (OnWidgetSelectionChanged); - rootWidget.Project.WidgetNameChangedEvent += new Gladeui.WidgetNameChangedEventHandler (OnWidgetNameChanged); - } - } - - void AddChildren (Gtk.TreeIter iter, Gladeui.Widget widget) - { - Gtk.Container container = widget.Object as Gtk.Container; - if (container != null) { - foreach (Gtk.Widget cw in container.Children) { - Gladeui.Widget gw = Gladeui.Widget.FromObject (cw); - if (gw != null) { - Gtk.TreeIter citer = store.AppendValues (iter, gw.Class.Icon, gw.Name, gw); - items [gw] = citer; - AddChildren (citer, gw); - } - } - } - } - - public void Refresh () - { - object ob = SaveStatus (); - Fill (rootWidget); - RestoreStatus (ob); - } - - public object SaveStatus () - { - TreeIter iter; - - if (!store.GetIterFirst (out iter)) - return null; - ArrayList list = new ArrayList (); - - do { - SaveStatus (list, iter); - } while (store.IterNext (ref iter)); - - return list; - } - - public void RestoreStatus (object ob) - { - if (ob == null) - return; - foreach (TreePath path in (ArrayList)ob) - tree.ExpandRow (path, false); - } - - void SaveStatus (ArrayList list, TreeIter iter) - { - Gtk.TreePath path = store.GetPath (iter); - if (tree.GetRowExpanded (path)) - list.Add (path); - else if (store.IterChildren (out iter, iter)) { - do { - SaveStatus (list, iter); - } while (store.IterNext (ref iter)); - } - } - - public override Gtk.Widget Control { - get { return control; } - } - - - void OnSelectionChanged (object sender, EventArgs args) - { - Gladeui.Widget widget = GetSelectedWidget (); - if (widget != null) { - selecting = true; - widget.Project.SelectionSet (widget.Object, true); - selecting = false; - } - } - - public Gladeui.Widget GetSelectedWidget () - { - Gtk.TreeModel foo; - Gtk.TreeIter iter; - if (!tree.Selection.GetSelected (out foo, out iter)) - return null; - - return (Gladeui.Widget) store.GetValue (iter, 2); - } - - void OnAddWidget (object s, Gladeui.AddWidgetArgs args) - { - Refresh (); - } - - void OnRemoveWidget (object s, Gladeui.RemoveWidgetArgs args) - { - Refresh (); - } - - void OnWidgetSelectionChanged (object s, EventArgs a) - { - if (selecting) - return; - - foreach (Gtk.Widget w in rootWidget.Project.SelectionGet ()) { - Gladeui.Widget gw = Gladeui.Widget.FromObject (w); - if (gw != null && items.Contains (gw)) { - TreeIter iter = (TreeIter) items [gw]; - Gtk.TreePath path = store.GetPath (iter); - tree.ExpandToPath (path); - tree.Selection.SelectIter (iter); - tree.SetCursor (store.GetPath (iter), col, false); - return; - } - } - } - - [GLib.ConnectBefore] - void OnPopupMenu (object o, Gtk.PopupMenuArgs args) - { - ShowPopup (); - } - - [GLib.ConnectBefore] - void OnButtonPressed (object o, ButtonPressEventArgs args) - { - if (args.Event.Button == 3) - ShowPopup (); - } - - void ShowPopup () - { - CommandEntrySet eset = new CommandEntrySet (); - eset.AddItem (EditCommands.Cut); - eset.AddItem (EditCommands.Copy); - eset.AddItem (EditCommands.Paste); - eset.AddItem (EditCommands.Delete); - IdeApp.CommandService.ShowContextMenu (eset); - } - - void OnWidgetNameChanged (object s, Gladeui.WidgetNameChangedEventArgs a) - { - Refresh (); - } - - [CommandHandler (EditCommands.Undo)] - protected void OnUndo () - { - GladeService.App.CommandUndo (); - } - - [CommandHandler (EditCommands.Redo)] - protected void OnRedo () - { - GladeService.App.CommandRedo (); - } - - [CommandHandler (EditCommands.Copy)] - protected void OnCopy () - { - GladeService.App.CommandCopy (); - } - - [CommandHandler (EditCommands.Cut)] - protected void OnCut () - { - GladeService.App.CommandCut (); - } - - [CommandHandler (EditCommands.Paste)] - protected void OnPaste () - { - GladeService.App.CommandPaste (); - } - - [CommandHandler (EditCommands.Delete)] - protected void OnDelete () - { - GladeService.App.CommandDelete (); - } - } -} diff --git a/main/Unused/GladeAddIn/GladeAddIn.Gui/GuiBuilderDisplayBinding.cs b/main/Unused/GladeAddIn/GladeAddIn.Gui/GuiBuilderDisplayBinding.cs deleted file mode 100644 index a7fefd48d6..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.Gui/GuiBuilderDisplayBinding.cs +++ /dev/null @@ -1,102 +0,0 @@ -// -// GuiBuilderDisplayBinding.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - - -using System; -using MonoDevelop.Core.Gui; -using MonoDevelop.Ide.Codons; -using MonoDevelop.Ide.Gui; -using MonoDevelop.Projects; - -namespace GladeAddIn.Gui -{ - public class GuiBuilderDisplayBinding: IDisplayBinding - { - bool excludeThis = false; - - public virtual bool CanCreateContentForFile (string fileName) - { - if (excludeThis) return false; - - if (GetWindow (fileName) == null) - return false; - - excludeThis = true; - IDisplayBinding db = IdeApp.Workbench.DisplayBindings.GetBindingPerFileName (fileName); - excludeThis = false; - return db != null; - } - - public virtual bool CanCreateContentForMimeType (string mimetype) - { - return false; - } - - public virtual IViewContent CreateContentForFile (string fileName) - { - excludeThis = true; - IDisplayBinding db = IdeApp.Workbench.DisplayBindings.GetBindingPerFileName (fileName); - GuiBuilderView view = new GuiBuilderView (db.CreateContentForFile (fileName), GetWindow (fileName)); - excludeThis = false; - view.Load (fileName); - return view; - } - - public virtual IViewContent CreateContentForMimeType (string mimeType, System.IO.Stream content) - { - return null; - } - - GuiBuilderWindow GetWindow (string file) - { - if (IdeApp.ProjectOperations.CurrentOpenCombine == null) - return null; - - Project project = null; - foreach (Project p in IdeApp.ProjectOperations.CurrentOpenCombine.GetAllProjects ()) { - if (p.IsFileInProject (file)) { - project = p; - break; - } - } - - if (project == null) - return null; - - GuiBuilderProject[] gprojects = GladeService.GetGuiBuilderProjects (project); - foreach (GuiBuilderProject gproject in gprojects) { - foreach (GuiBuilderWindow win in gproject.Windows) { - if (win.SourceCodeFile == file) - return win; - } - } - - return null; - } - } -} diff --git a/main/Unused/GladeAddIn/GladeAddIn.Gui/GuiBuilderEditSession.cs b/main/Unused/GladeAddIn/GladeAddIn.Gui/GuiBuilderEditSession.cs deleted file mode 100644 index 824c1e9225..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.Gui/GuiBuilderEditSession.cs +++ /dev/null @@ -1,408 +0,0 @@ -// -// GuiBuilderEditSession.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - - -using System; -using System.Reflection; -using System.Collections; -using System.CodeDom; - -using MonoDevelop.Projects.Parser; -using MonoDevelop.Projects.CodeGeneration; -using MonoDevelop.Projects.Text; -using MonoDevelop.Ide.Gui; -using MonoDevelop.Core.ProgressMonitoring; - -namespace GladeAddIn.Gui { - - public class GuiBuilderEditSession: IDisposable - { - GuiBuilderWindow window; - Gladeui.Project gproject; - Gladeui.Widget rootWidget; - Gtk.Widget widget; - bool disposed; - bool modified; - Gladeui.Widget lastWidget; - Hashtable names = new Hashtable (); - ITextFileProvider textFileProvider; - - public event EventHandler ModifiedChanged; - - public GuiBuilderEditSession (GuiBuilderWindow win, ITextFileProvider textFileProvider) - { - this.textFileProvider = textFileProvider; - this.window = win; - gproject = new Gladeui.Project (true); - GladeService.App.AddProject (gproject); - Gladeui.WidgetInfo widgetInfo = win.RootWidget.Write (Gladeui.Interface.Create ()); - rootWidget = Gladeui.Widget.Read (gproject, widgetInfo); - gproject.AddObject (rootWidget.Object); - ClearModified (); - - GLib.Timeout.Add (1000, new GLib.TimeoutHandler (OnCheckModified)); - gproject.SelectionChangedEvent += new EventHandler (OnWidgetSelectionChanged); - gproject.WidgetNameChangedEvent += new Gladeui.WidgetNameChangedEventHandler (OnWidgetNameChanged); - gproject.AddWidget += new Gladeui.AddWidgetHandler (OnAddWidget); - gproject.RemoveWidget += new Gladeui.RemoveWidgetHandler (OnRemoveWidget); - - CollectNames (rootWidget); - } - - public Gladeui.Project GladeProject { - get { return gproject; } - } - - public Gladeui.Widget GladeWidget { - get { return rootWidget; } - } - - public Gtk.Widget WrapperWidget { - get { - if (widget == null) { - Gtk.Window w = rootWidget.Object as Gtk.Window; - widget = EmbedWindow.Wrap (w); - } - return widget; - } - } - - public void Save () - { - ClearModified (); - Gladeui.WidgetInfo widgetInfo = rootWidget.Write (Gladeui.Interface.Create ()); - window.SetWidgetInfo (widgetInfo); - window.Save (); - if (ModifiedChanged != null) - ModifiedChanged (this, EventArgs.Empty); - } - - void ClearModified () - { - modified = false; - string tmpf = System.IO.Path.GetTempFileName (); - gproject.Save (tmpf); - System.IO.File.Delete (tmpf); - } - - public void Dispose () - { - disposed = true; - gproject.SelectionChangedEvent -= new EventHandler (OnWidgetSelectionChanged); - gproject.WidgetNameChangedEvent -= new Gladeui.WidgetNameChangedEventHandler (OnWidgetNameChanged); - gproject.AddWidget -= new Gladeui.AddWidgetHandler (OnAddWidget); - gproject.RemoveWidget -= new Gladeui.RemoveWidgetHandler (OnRemoveWidget); - GladeService.App.Project = GladeService.EmptyProject; - GladeService.App.Editor.Refresh (); - - // FIXME: This crashes sometimes -// GladeService.App.RemoveProject (gproject); - } - - public bool Modified { - get { return modified; } - } - - public void AddCurrentWidgetToClass () - { - AddWidgetField (lastWidget); - } - - public void UpdateBindings (string fileName) - { - IParseInformation pi = IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (window.Project.Project).ParseFile (fileName); - foreach (IClass cls in ((ICompilationUnit)pi.BestCompilationUnit).Classes) { - if (cls.Name == rootWidget.Name) { - UpdateBindings (cls); - break; - } - } - } - - void UpdateBindings (IClass cls) - { - UpdateBindings (rootWidget, cls); - GladeService.App.Editor.Refresh (); - } - - void UpdateBindings (Gladeui.Widget widget, IClass cls) - { - foreach (Gladeui.WidgetClassSignal csig in widget.Class.Signals) { - foreach (Gladeui.Signal ss in widget.GetSignalsHandlers (csig.Name)) { - if (FindSignalHandler (cls, ss) == null) { - widget.RemoveSignalHandler (ss); - } - } - } - - Gtk.Container container = widget.Object as Gtk.Container; - if (container != null) { - foreach (Gtk.Widget cw in container.Children) { - Gladeui.Widget gw = Gladeui.Widget.FromObject (cw); - if (gw != null) - UpdateBindings (gw, cls); - } - } - } - - IMethod FindSignalHandler (IClass cls, Gladeui.Signal signal) - { - foreach (IMethod met in cls.Methods) { - if (met.Name == signal.Handler) { - return met; - } - } - return null; - } - - void CollectNames (Gladeui.Widget widget) - { - // The WidgetNameChangedEvent event does not say what was the old name, - // so we need to keep it somewhere. - - names [widget] = widget.Name; - - Gtk.Container container = widget.Object as Gtk.Container; - if (container != null) { - foreach (Gtk.Widget cw in container.Children) { - Gladeui.Widget gw = Gladeui.Widget.FromObject (cw); - if (gw != null) - CollectNames (gw); - } - } - } - - void OnAddWidget (object s, Gladeui.AddWidgetArgs args) - { - names [args.Widget] = args.Widget.Name; - } - - void OnRemoveWidget (object s, Gladeui.RemoveWidgetArgs args) - { - names.Remove (args.Widget); - } - - void OnWidgetNameChanged (object s, Gladeui.WidgetNameChangedEventArgs args) - { - UpdateWidgetName (args.Widget); - } - - bool UpdateWidgetName (Gladeui.Widget widget) - { - string oldName = (string) names [widget]; - if (oldName == widget.Name) - return false; - - CodeRefactorer cr = GetCodeGenerator (); - IClass cls = window.GetClass ((string) names [rootWidget]); - - if (cls != null) { - IField f = ClassUtils.FindWidgetField (cls, oldName); - if (f != null) { - if (widget == rootWidget) { - // Renaming the dialog - cr.ReplaceMember (cls, f, GetFieldCode (widget, "dialog")); - if (cls.Name == oldName && widget.Name != "") - cr.RenameClass (new NullProgressMonitor (), cls, widget.Name, RefactoryScope.File); - } - else if (f.Name == oldName && widget.Name != "") { - // Rename the field and update the Widget attribute - f = (IField) cr.RenameMember (new NullProgressMonitor (), cls, f, widget.Name, RefactoryScope.File); - if (f == null) return false; - cr.ReplaceMember (cls, f, GetFieldCode (widget)); - } else { - // Update the Widget attribute only. Keep the old var name. - CodeMemberField cmf = GetFieldCode (widget); - cmf.Name = f.Name; - cr.ReplaceMember (cls, f, cmf); - } - names [widget] = widget.Name; - } - } - return true; - } - - bool OnCheckModified () - { - if (disposed) - return false; - - if (gproject.Modified != modified) { - modified = gproject.Modified; - if (ModifiedChanged != null) - ModifiedChanged (this, EventArgs.Empty); - } - - return true; - } - - void ResetSelection () - { - if (lastWidget != null) { - lastWidget.AddSignalHandlerEvent -= new Gladeui.AddSignalHandlerEventHandler (OnAddSignal); - lastWidget.RemoveSignalHandlerEvent -= new Gladeui.RemoveSignalHandlerEventHandler (OnRemoveSignal); - lastWidget.ChangeSignalHandlerEvent -= new Gladeui.ChangeSignalHandlerEventHandler (OnChangeSignal); - } - } - - void OnWidgetSelectionChanged (object s, EventArgs args) - { - ResetSelection (); - GLib.List list = gproject.SelectionGet (); - if (list.Count > 0) { - Gladeui.Widget w = Gladeui.Widget.FromObject ((Gtk.Widget)list[0]); - if (w == lastWidget || w == null) - return; - - w.AddSignalHandlerEvent += new Gladeui.AddSignalHandlerEventHandler (OnAddSignal); - w.RemoveSignalHandlerEvent += new Gladeui.RemoveSignalHandlerEventHandler (OnRemoveSignal); - w.ChangeSignalHandlerEvent += new Gladeui.ChangeSignalHandlerEventHandler (OnChangeSignal); - lastWidget = w; - } else - lastWidget = null; - } - - void OnAddSignal (object s, Gladeui.AddSignalHandlerEventArgs args) - { - if (lastWidget != null) { - AddSignal (lastWidget, args.SignalHandler); - } - } - - void OnRemoveSignal (object s, Gladeui.RemoveSignalHandlerEventArgs args) - { - } - - void OnChangeSignal (object s, Gladeui.ChangeSignalHandlerEventArgs args) - { - if (args.OldSignalHandler.Handler == args.NewSignalHandler.Handler) - return; - - IClass cls = GetClass (); - if (cls == null) return; - - IMethod met = FindSignalHandler (cls, args.OldSignalHandler); - if (met == null) return; - - CodeRefactorer gen = GetCodeGenerator (); - gen.RenameMember (new NullProgressMonitor (), cls, met, args.NewSignalHandler.Handler, RefactoryScope.File); - } - - public void AddSignal (Gladeui.Widget childWidget, Gladeui.Signal signal) - { - IClass cls = GetClass (); - if (cls == null) - return; - - if (FindSignalHandler (cls, signal) != null) - return; - - Type ht = GetHandlerType (childWidget, signal.Name); - if (ht == null) - return; - - MethodInfo invoke = ht.GetMethod ("Invoke"); - Type delReturnType = invoke.ReturnType; - ParameterInfo[] args = invoke.GetParameters (); - - CodeMemberMethod met = new CodeMemberMethod (); - met.Name = signal.Handler; - met.ReturnType = new CodeTypeReference (delReturnType.FullName); - - foreach (ParameterInfo pinfo in args) - met.Parameters.Add (new CodeParameterDeclarationExpression (pinfo.ParameterType, pinfo.Name)); - - CodeRefactorer gen = GetCodeGenerator (); - gen.AddMember (cls, met); - } - - public void AddWidgetField (Gladeui.Widget widget) - { - IClass cls = GetClass (); - - if (FindWidgetField (cls, widget) != null) - return; - - Document doc = IdeApp.Workbench.OpenDocument (cls.Region.FileName, true); - - IEditableTextFile editor = doc.Content as IEditableTextFile; - if (editor != null) { - CodeRefactorer gen = GetCodeGenerator (); - gen.AddMember (cls, GetFieldCode (widget)); - } - } - - CodeMemberField GetFieldCode (Gladeui.Widget widget) - { - return GetFieldCode (widget, null); - } - - CodeMemberField GetFieldCode (Gladeui.Widget widget, string name) - { - if (name == null) name = widget.Name; - string type = widget.Object.GetType().FullName; - CodeMemberField field = new CodeMemberField (type, name); - CodeAttributeArgument attArg = new CodeAttributeArgument (new CodePrimitiveExpression (widget.Name)); - field.CustomAttributes.Add (new CodeAttributeDeclaration ("Glade.Widget", attArg)); - return field; - } - - IField FindWidgetField (IClass cls, Gladeui.Widget w) - { - foreach (IField field in cls.Fields) - if (field.Name == w.Name) - return field; - return null; - } - - static Type GetHandlerType (Gladeui.Widget widget, string signalId) - { - signalId = signalId.Replace ('-','_'); - Type wtype = widget.Object.GetType (); - foreach (EventInfo ev in wtype.GetEvents ()) { - GLib.SignalAttribute sat = (GLib.SignalAttribute) Attribute.GetCustomAttribute (ev, typeof(GLib.SignalAttribute), true); - if (sat != null && sat.CName == signalId) - return ev.EventHandlerType; - } - return null; - } - - CodeRefactorer GetCodeGenerator () - { - CodeRefactorer cr = new CodeRefactorer (IdeApp.ProjectOperations.CurrentOpenCombine, IdeApp.ProjectOperations.ParserDatabase); - cr.TextFileProvider = textFileProvider; - return cr; - } - - IClass GetClass () - { - return window.GetClass (rootWidget.Name); - } - - } -} diff --git a/main/Unused/GladeAddIn/GladeAddIn.Gui/GuiBuilderProject.cs b/main/Unused/GladeAddIn/GladeAddIn.Gui/GuiBuilderProject.cs deleted file mode 100644 index ca68539894..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.Gui/GuiBuilderProject.cs +++ /dev/null @@ -1,179 +0,0 @@ -// -// GuiBuilderProject.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Xml; -using System.IO; -using System.Reflection; -using System.Collections; -using System.CodeDom; - -using MonoDevelop.Ide.Gui; -using MonoDevelop.Ide.Gui.Content; -using MonoDevelop.Projects; -using MonoDevelop.Projects.Parser; -using MonoDevelop.Projects.CodeGeneration; -using MonoDevelop.Core.Gui; -using MonoDevelop.Projects.Text; - -namespace GladeAddIn.Gui -{ - public class GuiBuilderProject - { - ArrayList formInfos = new ArrayList (); - Gladeui.Project gproject; - Project project; - string fileName; - - public event WindowEventHandler WindowAdded; - public event WindowEventHandler WindowRemoved; - - public GuiBuilderProject (Gladeui.App gladeApp, Project project, string fileName) - { - this.fileName = fileName; - - gproject = Gladeui.Project.Open (fileName); - //gladeApp.AddProject (gproject); - - this.project = project; - gproject.AddWidget += new Gladeui.AddWidgetHandler (OnAddWidget); - gproject.RemoveWidget += new Gladeui.RemoveWidgetHandler (OnRemoveWidget); - - foreach (GLib.Object ob in gproject.Objects) { - Gladeui.Widget w = Gladeui.Widget.FromObject (ob); - if (w.Parent == null) - RegisterWindow (w); - } - } - - public string File { - get { return fileName; } - } - - public Gladeui.Project GladeProject { - get { return gproject; } - } - - public ICollection Windows { - get { return formInfos; } - } - - public Project Project { - get { return project; } - } - - public void Dispose () - { - gproject.AddWidget -= new Gladeui.AddWidgetHandler (OnAddWidget); - gproject.RemoveWidget -= new Gladeui.RemoveWidgetHandler (OnRemoveWidget); - } - - public bool IsActive () - { - return GladeService.App.ActiveProject == gproject; - } - - public void NewWindow (string name) - { - Gladeui.WidgetClass wc = Gladeui.WidgetClass.GetByType (Gtk.Window.GType); - Gladeui.Widget gw = new Gladeui.Widget (null, wc, gproject); - gw.Name = name; - gproject.AddObject (gw.Object); - gproject.Save (gproject.Path); - } - - public void NewDialog (string name) - { - Gladeui.WidgetClass wc = Gladeui.WidgetClass.GetByType (Gtk.Dialog.GType); - Gladeui.Widget gw = new Gladeui.Widget (null, wc, gproject); - gw.Name = name; - gproject.AddObject (gw.Object); - gproject.Save (gproject.Path); - } - - GuiBuilderWindow RegisterWindow (Gladeui.Widget widget) - { - GuiBuilderWindow win = new GuiBuilderWindow (this, gproject, widget); - formInfos.Add (win); - return win; - } - - void UnregisterWindow (GuiBuilderWindow win) - { - formInfos.Remove (win); - win.Dispose (); - } - - void OnAddWidget (object s, Gladeui.AddWidgetArgs args) - { - if (args.Widget.Parent == null) { - GuiBuilderWindow win = RegisterWindow (args.Widget); - if (WindowAdded != null) - WindowAdded (this, new WindowEventArgs (win)); - } - } - - void OnRemoveWidget (object s, Gladeui.RemoveWidgetArgs args) - { - if (args.Widget.Parent == null) { - GuiBuilderWindow win = GetWindowForWidget (args.Widget); - if (win != null) { - UnregisterWindow (win); - if (WindowRemoved != null) - WindowRemoved (this, new WindowEventArgs (win)); - } - } - } - - GuiBuilderWindow GetWindowForWidget (Gladeui.Widget w) - { - while (w.Parent != null) - w = w.Parent; - foreach (GuiBuilderWindow form in formInfos) - if (form.RootWidget == w) - return form; - return null; - } - } - - public delegate void WindowEventHandler (object s, WindowEventArgs args); - - public class WindowEventArgs: EventArgs - { - GuiBuilderWindow win; - - public WindowEventArgs (GuiBuilderWindow win) - { - this.win = win; - } - - public GuiBuilderWindow Window { - get { return win; } - } - } -} diff --git a/main/Unused/GladeAddIn/GladeAddIn.Gui/GuiBuilderProjectNodeBuilder.cs b/main/Unused/GladeAddIn/GladeAddIn.Gui/GuiBuilderProjectNodeBuilder.cs deleted file mode 100644 index ad561ac216..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.Gui/GuiBuilderProjectNodeBuilder.cs +++ /dev/null @@ -1,119 +0,0 @@ -// -// GuiBuilderProjectNodeBuilder.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.IO; -using System.Collections; - -using MonoDevelop.Projects; -using MonoDevelop.Core; -using MonoDevelop.Core.Gui; -using MonoDevelop.Ide.Gui.Pads; -using MonoDevelop.Components.Commands; -using MonoDevelop.Ide.Gui; -using MonoDevelop.Ide.Commands; - -namespace GladeAddIn.Gui -{ - public class GuiBuilderProjectNodeBuilder: TypeNodeBuilder - { - public override Type CommandHandlerType { - get { return typeof(GladeFileCommandHandler); } - } - - public override string ContextMenuAddinPath { - get { return "/SharpDevelop/Views/GuiBuilderProjectNodeBuilder/ContextMenu"; } - } - - public override Type NodeDataType { - get { return typeof(GuiBuilderProject); } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - GuiBuilderProject bproject = (GuiBuilderProject) dataObject; - return Path.GetFileNameWithoutExtension (bproject.File); - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - GuiBuilderProject bproject = (GuiBuilderProject) dataObject; - label = Path.GetFileNameWithoutExtension (bproject.File); - icon = Context.GetIcon (Stock.ResourceFileIcon); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - GuiBuilderProject bproject = (GuiBuilderProject) dataObject; - foreach (GuiBuilderWindow fi in bproject.Windows) { - builder.AddChild (fi); - } - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - GuiBuilderProject bproject = (GuiBuilderProject) dataObject; - return bproject.Windows.Count > 0; - } - - public override void OnNodeAdded (object dataObject) - { - GuiBuilderProject bproject = (GuiBuilderProject) dataObject; - bproject.WindowAdded += new WindowEventHandler (OnWindowAdded); - bproject.WindowRemoved += new WindowEventHandler (OnWindowRemoved); - } - - public override void OnNodeRemoved (object dataObject) - { - GuiBuilderProject bproject = (GuiBuilderProject) dataObject; - bproject.WindowAdded -= new WindowEventHandler (OnWindowAdded); - bproject.WindowRemoved -= new WindowEventHandler (OnWindowRemoved); - } - - void UpdateWidget (GuiBuilderWindow win) - { - ITreeBuilder tb = Context.GetTreeBuilder (win.Project); - if (tb != null) - tb.UpdateAll (); - } - - void OnWindowAdded (object s, WindowEventArgs a) - { - UpdateWidget (a.Window); - } - - void OnWindowRemoved (object s, WindowEventArgs a) - { - UpdateWidget (a.Window); - } - } - - class GladeFileCommandHandler: NodeCommandHandler - { - } -} diff --git a/main/Unused/GladeAddIn/GladeAddIn.Gui/GuiBuilderView.cs b/main/Unused/GladeAddIn/GladeAddIn.Gui/GuiBuilderView.cs deleted file mode 100644 index 24dd658d22..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.Gui/GuiBuilderView.cs +++ /dev/null @@ -1,366 +0,0 @@ -// -// GuiBuilderView.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - - -using System; -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui.Content; -using MonoDevelop.Ide.Gui; -using MonoDevelop.Ide.Gui.Search; -using MonoDevelop.Core.Execution; -using MonoDevelop.Projects.Text; -using Gtk; - -namespace GladeAddIn.Gui -{ - public class GuiBuilderView : AbstractViewContent, IEditableTextBuffer, IPositionable, IBookmarkBuffer, IDebuggableEditor, ICodeStyleOperations, - IDocumentInformation - { - IViewContent content; - Gtk.Notebook notebook; - GuiBuilderEditSession editSession; - Gtk.EventBox designerPage; - VBox box; - ToggleToolButton codeButton; - ToggleToolButton designerButton; - - public GuiBuilderView (IViewContent content, GuiBuilderWindow window) - { - editSession = window.CreateEditSession (new OpenDocumentFileProvider ()); - this.content = content; - - content.ContentChanged += new EventHandler (OnTextContentChanged); - content.DirtyChanged += new EventHandler (OnTextDirtyChanged); - editSession.ModifiedChanged += new EventHandler (OnWindowChanged); - - notebook = new Gtk.Notebook (); - designerPage = new Gtk.EventBox (); - designerPage.Show (); - notebook.AppendPage (content.Control, new Gtk.Label ()); - notebook.AppendPage (designerPage, new Gtk.Label ()); - notebook.TabPos = Gtk.PositionType.Bottom; - notebook.ShowTabs = false; - notebook.SwitchPage += new Gtk.SwitchPageHandler (OnSwitchPage); - notebook.Show (); - box = new VBox (); - - Toolbar hbox = new Toolbar (); - hbox.IconSize = IconSize.SmallToolbar; - hbox.ToolbarStyle = ToolbarStyle.BothHoriz; - hbox.ShowArrow = false; - codeButton = new ToggleToolButton (); - codeButton.Label = GettextCatalog.GetString ("Source Code"); - codeButton.IsImportant = true; - codeButton.Active = true; - codeButton.Clicked += new EventHandler (OnToggledCode); - designerButton = new ToggleToolButton (); - designerButton.Label = GettextCatalog.GetString ("Window Designer"); - designerButton.IsImportant = true; - designerButton.Clicked += new EventHandler (OnToggledDesigner); - - hbox.Insert (codeButton, -1); - hbox.Insert (designerButton, -1); - hbox.ShowAll (); - - box.PackStart (notebook, true, true, 0); - box.PackStart (hbox, false, false, 6); - - box.Show (); - } - - public GuiBuilderEditSession EditSession { - get { return editSession; } - } - - void OnSwitchPage (object s, Gtk.SwitchPageArgs args) - { - if (args.PageNum == 1 && designerPage.Children.Length == 0) { - designerPage.Add (editSession.WrapperWidget); - editSession.WrapperWidget.ShowAll (); - } - } - - void OnToggledCode (object s, EventArgs args) - { - if (codeButton.Active) { - notebook.CurrentPage = 0; - designerButton.Active = false; - } - else if (!designerButton.Active) - codeButton.Active = true; - } - - void OnToggledDesigner (object s, EventArgs args) - { - if (designerButton.Active) { - notebook.CurrentPage = 1; - codeButton.Active = false; - } - else if (!codeButton.Active) - designerButton.Active = true; - } - - public override void Dispose () - { - designerPage.Remove (editSession.WrapperWidget); - notebook.SwitchPage -= new Gtk.SwitchPageHandler (OnSwitchPage); - content.ContentChanged -= new EventHandler (OnTextContentChanged); - content.DirtyChanged -= new EventHandler (OnTextDirtyChanged); - editSession.Dispose (); - base.Dispose (); - } - - public override void Load (string fileName) - { - ContentName = fileName; - content.Load (fileName); - } - - public override Gtk.Widget Control { - get { return box; } - } - - public override void Save (string fileName) - { - content.Save (fileName); - editSession.UpdateBindings (fileName); - editSession.Save (); - } - - public override bool IsDirty { - get { - return content.IsDirty || editSession.Modified; - } - set { - content.IsDirty = value; - } - } - - public override bool IsReadOnly - { - get { - return content.IsReadOnly; - } - } - - public void AddCurrentWidgetToClass () - { - editSession.AddCurrentWidgetToClass (); - } - - void OnWindowChanged (object s, EventArgs args) - { - OnContentChanged (args); - OnDirtyChanged (args); - } - - void OnTextContentChanged (object s, EventArgs args) - { - OnContentChanged (args); - } - - void OnTextDirtyChanged (object s, EventArgs args) - { - OnDirtyChanged (args); - } - - /* IEditableTextBuffer **********************/ - - public IClipboardHandler ClipboardHandler { - get { return ((IEditableTextBuffer)content).ClipboardHandler; } - } - - public void Undo() - { - ((IEditableTextBuffer)content).Undo (); - } - - public void Redo() - { - ((IEditableTextBuffer)content).Redo (); - } - - public string SelectedText { - get { return ((IEditableTextBuffer)content).SelectedText; } - set { ((IEditableTextBuffer)content).SelectedText = value; } - } - - public event EventHandler TextChanged { - add { ((IEditableTextBuffer)content).TextChanged += value; } - remove { ((IEditableTextBuffer)content).TextChanged -= value; } - } - - public void InsertText (int position, string text) - { - ((IEditableTextBuffer)content).InsertText (position, text); - } - - public void DeleteText (int position, int length) - { - ((IEditableTextBuffer)content).DeleteText (position, length); - } - - /* ITextBuffer **********************/ - - public string Name { - get { return ((ITextFile)content).Name; } - } - - public int Length { - get { return ((ITextFile)content).Length; } - } - - public string Text { - get { return ((IEditableTextFile)content).Text; } - set { ((IEditableTextFile)content).Text = value; } - } - - public int CursorPosition { - get { return ((ITextBuffer)content).CursorPosition; } - set { ((ITextBuffer)content).CursorPosition = value; } - } - - public int SelectionStartPosition { - get { return ((ITextBuffer)content).SelectionStartPosition; } - } - public int SelectionEndPosition { - get { return ((ITextBuffer)content).SelectionEndPosition; } - } - - public string GetText (int startPosition, int endPosition) - { - return ((ITextBuffer)content).GetText (startPosition, endPosition); - } - - public void Select (int startPosition, int endPosition) - { - ((ITextBuffer)content).Select (startPosition, endPosition); - } - - public void ShowPosition (int position) - { - ((ITextBuffer)content).ShowPosition (position); - } - - public int GetPositionFromLineColumn (int line, int column) - { - return ((ITextBuffer)content).GetPositionFromLineColumn (line, column); - } - - public void GetLineColumnFromPosition (int position, out int line, out int column) - { - ((ITextBuffer)content).GetLineColumnFromPosition (position, out line, out column); - } - - /* IPositionable **********************/ - - public void JumpTo(int line, int column) - { - ((IPositionable)content).JumpTo (line, column); - } - - /* IBookmarkBuffer **********************/ - - public void SetBookmarked (int position, bool mark) - { - ((IBookmarkBuffer)content).SetBookmarked (position, mark); - } - - public bool IsBookmarked (int position) - { - return ((IBookmarkBuffer)content).IsBookmarked (position); - } - - public void PrevBookmark () - { - ((IBookmarkBuffer)content).PrevBookmark (); - } - - public void NextBookmark () - { - ((IBookmarkBuffer)content).NextBookmark (); - } - - public void ClearBookmarks () - { - ((IBookmarkBuffer)content).ClearBookmarks (); - } - - /* IDebuggableEditor **********************/ - - public void ExecutingAt (int lineNumber) - { - ((IDebuggableEditor)content).ExecutingAt (lineNumber); - } - - public void ClearExecutingAt (int lineNumber) - { - ((IDebuggableEditor)content).ExecutingAt (lineNumber); - } - - /* ICodeStyleOperations **********************/ - - public void CommentCode () - { - ((ICodeStyleOperations)content).CommentCode (); - } - - public void UncommentCode () - { - ((ICodeStyleOperations)content).UncommentCode (); - } - - public void IndentSelection () - { - ((ICodeStyleOperations)content).IndentSelection (); - } - - public void UnIndentSelection () - { - ((ICodeStyleOperations)content).UnIndentSelection (); - } - - - /* IDocumentInformation **********************/ - - public string FileName { - get { return ((IDocumentInformation)content).FileName; } - } - - public ITextIterator GetTextIterator () - { - return ((IDocumentInformation)content).GetTextIterator (); - } - - public string GetLineTextAtOffset (int offset) - { - return ((IDocumentInformation)content).GetLineTextAtOffset (offset); - } - } -} - diff --git a/main/Unused/GladeAddIn/GladeAddIn.Gui/GuiBuilderWindow.cs b/main/Unused/GladeAddIn/GladeAddIn.Gui/GuiBuilderWindow.cs deleted file mode 100644 index 01755ea77d..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.Gui/GuiBuilderWindow.cs +++ /dev/null @@ -1,149 +0,0 @@ -// -// GuiBuilderWindow.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - - -using System; -using System.Reflection; -using System.Collections; -using System.CodeDom; - -using MonoDevelop.Ide.Gui; -using MonoDevelop.Ide.Gui.Content; -using MonoDevelop.Projects; -using MonoDevelop.Projects.Parser; -using MonoDevelop.Projects.CodeGeneration; -using MonoDevelop.Core.Gui; -using MonoDevelop.Projects.Text; - -namespace GladeAddIn.Gui -{ - public class GuiBuilderWindow: IDisposable - { - Gladeui.Widget rootWidget; - Gladeui.Project gproject; - GuiBuilderProject fproject; - - public event WindowEventHandler NameChanged; - - internal GuiBuilderWindow (GuiBuilderProject fproject, Gladeui.Project gproject, Gladeui.Widget rootWidget) - { - this.fproject = fproject; - this.rootWidget = rootWidget; - this.gproject = gproject; - gproject.WidgetNameChangedEvent += new Gladeui.WidgetNameChangedEventHandler (OnWidgetNameChanged); - } - - public Gladeui.Widget RootWidget { - get { return rootWidget; } - } - - public GuiBuilderProject Project { - get { return fproject; } - } - - public string Name { - get { return rootWidget.Name; } - } - - public string SourceCodeFile { - get { - IClass cls = GetClass (); - if (cls != null) return cls.Region.FileName; - else return null; - } - } - - public GuiBuilderEditSession CreateEditSession (ITextFileProvider textFileProvider) - { - return new GuiBuilderEditSession (this, textFileProvider); - } - - internal void SetWidgetInfo (Gladeui.WidgetInfo winfo) - { - gproject.RemoveObject (rootWidget.Object); - rootWidget = Gladeui.Widget.Read (gproject, winfo); - gproject.AddObject (rootWidget.Object); - } - - public void Dispose () - { - gproject.WidgetNameChangedEvent -= new Gladeui.WidgetNameChangedEventHandler (OnWidgetNameChanged); - } - - internal void Save () - { - gproject.Save (gproject.Path); - } - - void OnWidgetNameChanged (object s, Gladeui.WidgetNameChangedEventArgs args) - { - if (!InsideWindow (args.Widget)) - return; - - if (args.Widget == rootWidget && NameChanged != null) - NameChanged (this, new WindowEventArgs (this)); - } - - public IClass GetClass () - { - return GetClass (rootWidget.Name); - } - - internal IClass GetClass (string name) - { - IParserContext ctx = IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (fproject.Project); - IClass[] classes = ctx.GetProjectContents (); - foreach (IClass cls in classes) { - if (ClassUtils.FindWidgetField (cls, name) != null) - return cls; - } - return null; - } - - public bool InsideWindow (Gladeui.Widget widget) - { - while (widget.Parent != null) - widget = widget.Parent; - return widget == rootWidget; - } - } - - class OpenDocumentFileProvider: ITextFileProvider - { - public IEditableTextFile GetEditableTextFile (string filePath) - { - foreach (Document doc in IdeApp.Workbench.Documents) { - if (doc.FileName == filePath) { - IEditableTextFile ef = doc.Content as IEditableTextFile; - if (ef != null) return ef; - } - } - return null; - } - } -} diff --git a/main/Unused/GladeAddIn/GladeAddIn.Gui/GuiBuilderWindowNodeBuilder.cs b/main/Unused/GladeAddIn/GladeAddIn.Gui/GuiBuilderWindowNodeBuilder.cs deleted file mode 100644 index d88c5b80e2..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.Gui/GuiBuilderWindowNodeBuilder.cs +++ /dev/null @@ -1,97 +0,0 @@ -// -// GuiBuilderWindowNodeBuilder.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; - -using MonoDevelop.Projects; -using MonoDevelop.Core; -using MonoDevelop.Core.Gui; -using MonoDevelop.Ide.Gui.Pads; -using MonoDevelop.Components.Commands; -using MonoDevelop.Ide.Gui; -using MonoDevelop.Ide.Commands; - -namespace GladeAddIn.Gui -{ - public class GuiBuilderWindowNodeBuilder: TypeNodeBuilder - { - public override Type CommandHandlerType { - get { return typeof(GladeWindowCommandHandler); } - } - - public override string ContextMenuAddinPath { - get { return "/SharpDevelop/Views/GladeWindowNodeBuilder/ContextMenu"; } - } - - public override Type NodeDataType { - get { return typeof(GuiBuilderWindow); } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - GuiBuilderWindow win = (GuiBuilderWindow) dataObject; - return win.Name; - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - GuiBuilderWindow win = (GuiBuilderWindow) dataObject; - label = win.Name; - icon = Context.GetIcon (Stock.ResourceFileIcon); - } - - public override void OnNodeAdded (object dataObject) - { - GuiBuilderWindow win = (GuiBuilderWindow) dataObject; - win.NameChanged += new WindowEventHandler (OnNameChanged); - } - - public override void OnNodeRemoved (object dataObject) - { - GuiBuilderWindow win = (GuiBuilderWindow) dataObject; - win.NameChanged -= new WindowEventHandler (OnNameChanged); - } - - void OnNameChanged (object s, WindowEventArgs a) - { - ITreeBuilder tb = Context.GetTreeBuilder (a.Window); - if (tb != null) - tb.Update (); - } - } - - class GladeWindowCommandHandler: NodeCommandHandler - { - public override void ActivateItem () - { - GuiBuilderWindow w = (GuiBuilderWindow) CurrentNode.DataItem; - IdeApp.Workbench.OpenDocument (w.SourceCodeFile, true); - } - } -} diff --git a/main/Unused/GladeAddIn/GladeAddIn.Gui/PreviewBox.cs b/main/Unused/GladeAddIn/GladeAddIn.Gui/PreviewBox.cs deleted file mode 100644 index 15f9212dc5..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.Gui/PreviewBox.cs +++ /dev/null @@ -1,247 +0,0 @@ -// -// PreviewBox.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - - -using System; -using Gtk; -using Gdk; - -namespace GladeAddIn.Gui -{ - class PreviewBox: ScrolledWindow - { - Metacity.Preview preview; - - public Metacity.Theme Theme { - set { preview.Theme = value; } - } - - public string Title { - set { preview.Title = value; } - } - - public PreviewBox (Gtk.Window window) - { - ShadowType = ShadowType.None; - HscrollbarPolicy = PolicyType.Automatic; - VscrollbarPolicy = PolicyType.Automatic; - - preview = new Metacity.Preview (); - - switch (window.TypeHint) { - case Gdk.WindowTypeHint.Normal: - preview.FrameType = Metacity.FrameType.Normal; - break; - case Gdk.WindowTypeHint.Dialog: - preview.FrameType = window.Modal ? Metacity.FrameType.ModalDialog : Metacity.FrameType.Dialog; - break; - case Gdk.WindowTypeHint.Menu: - preview.FrameType = Metacity.FrameType.Menu; - break; - case Gdk.WindowTypeHint.Splashscreen: - preview.FrameType = Metacity.FrameType.Border; - break; - case Gdk.WindowTypeHint.Utility: - preview.FrameType = Metacity.FrameType.Utility; - break; - default: - preview.FrameType = Metacity.FrameType.Normal; - break; - } - - Metacity.FrameFlags flags = - Metacity.FrameFlags.AllowsDelete | - Metacity.FrameFlags.AllowsVerticalResize | - Metacity.FrameFlags.AllowsHorizontalResize | - Metacity.FrameFlags.AllowsMove | - Metacity.FrameFlags.AllowsShade | - Metacity.FrameFlags.HasFocus; - if (window.Resizable) - flags = flags | Metacity.FrameFlags.AllowsMaximize; - preview.FrameFlags = flags; - - preview.Add (window); - ResizableFixed fixd = new ResizableFixed (); - fixd.Put (preview, window); - AddWithViewport (fixd); - } - } - - class ResizableFixed: EventBox - { - Gtk.Widget child; - int difX, difY; - bool resizingX; - bool resizingY; - Fixed fixd; - Gtk.Window window; - - Cursor cursorX = new Cursor (CursorType.RightSide); - Cursor cursorY = new Cursor (CursorType.BottomSide); - Cursor cursorXY = new Cursor (CursorType.BottomRightCorner); - - const int padding = 6; - const int selectionBorder = 6; - - Requisition currentSizeRequest; - - public ResizableFixed () - { - fixd = new Fixed (); - Add (fixd); - this.Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask; - } - - public void Put (Gtk.Widget child, Gtk.Window window) - { - this.child = child; - this.window = window; - fixd.Put (child, selectionBorder + padding, selectionBorder + padding); - child.SizeRequested += new SizeRequestedHandler (OnSizeReq); - } - - void OnSizeReq (object o, SizeRequestedArgs a) - { - currentSizeRequest = a.Requisition; - - Rectangle alloc = child.Allocation; - int nw = alloc.Width; - int nh = alloc.Height; - - if (a.Requisition.Width > nw) nw = a.Requisition.Width; - if (a.Requisition.Height > nh) nh = a.Requisition.Height; - - if (nw != alloc.Width || nh != alloc.Height) { - child.SetSizeRequest (nw, nh); - QueueDraw (); - } - } - - protected override bool OnMotionNotifyEvent (Gdk.EventMotion ev) - { - if (resizingX || resizingY) { - if (resizingX) { - int nw = (int)(ev.X - difX - padding - selectionBorder); - if (nw < currentSizeRequest.Width) nw = currentSizeRequest.Width; - child.WidthRequest = nw; - } - - if (resizingY) { - int nh = (int)(ev.Y - difY - padding - selectionBorder); - if (nh < currentSizeRequest.Height) nh = currentSizeRequest.Height; - child.HeightRequest = nh; - } - QueueDraw (); - } else { - if (GetAreaResizeXY ().Contains ((int) ev.X, (int) ev.Y)) - GdkWindow.Cursor = cursorXY; - else if (GetAreaResizeX ().Contains ((int) ev.X, (int) ev.Y)) - GdkWindow.Cursor = cursorX; - else if (GetAreaResizeY ().Contains ((int) ev.X, (int) ev.Y)) - GdkWindow.Cursor = cursorY; - else - GdkWindow.Cursor = null; - } - - return base.OnMotionNotifyEvent (ev); - } - - protected override bool OnButtonPressEvent (Gdk.EventButton ev) - { - Gdk.Rectangle rectArea = child.Allocation; - rectArea.Inflate (selectionBorder, selectionBorder); - - if (rectArea.Contains ((int) ev.X, (int) ev.Y)) { - Gladeui.Widget gw = Gladeui.Widget.FromObject (window); - gw.Project.SelectionSet (window, true); - - Rectangle rect = GetAreaResizeXY (); - if (rect.Contains ((int) ev.X, (int) ev.Y)) { - resizingX = resizingY = true; - difX = (int) (ev.X - rect.X); - difY = (int) (ev.Y - rect.Y); - GdkWindow.Cursor = cursorXY; - } - - rect = GetAreaResizeY (); - if (rect.Contains ((int) ev.X, (int) ev.Y)) { - resizingY = true; - difY = (int) (ev.Y - rect.Y); - GdkWindow.Cursor = cursorY; - } - - rect = GetAreaResizeX (); - if (rect.Contains ((int) ev.X, (int) ev.Y)) { - resizingX = true; - difX = (int) (ev.X - rect.X); - GdkWindow.Cursor = cursorX; - } - } - - return base.OnButtonPressEvent (ev); - } - - Rectangle GetAreaResizeY () - { - Gdk.Rectangle rect = child.Allocation; - return new Gdk.Rectangle (rect.X - selectionBorder, rect.Y + rect.Height, rect.Width + selectionBorder, selectionBorder); - } - - Rectangle GetAreaResizeX () - { - Gdk.Rectangle rect = child.Allocation; - return new Gdk.Rectangle (rect.X + rect.Width, rect.Y - selectionBorder, selectionBorder, rect.Height + selectionBorder); - } - - Rectangle GetAreaResizeXY () - { - Gdk.Rectangle rect = child.Allocation; - return new Gdk.Rectangle (rect.X + rect.Width, rect.Y + rect.Height, selectionBorder, selectionBorder); - } - - protected override bool OnButtonReleaseEvent (Gdk.EventButton ev) - { - resizingX = resizingY = false; - GdkWindow.Cursor = null; - return base.OnButtonReleaseEvent (ev); - } - - protected override bool OnExposeEvent (Gdk.EventExpose ev) - { - bool r = base.OnExposeEvent (ev); - Gdk.Rectangle rect = child.Allocation; - rect.Inflate (selectionBorder, selectionBorder); - GdkWindow.DrawRectangle (Style.BlackGC, false, rect.X, rect.Y, rect.Width, rect.Height); - - int w, h; - GdkWindow.GetSize (out w, out h); - - return r; - } - } -} diff --git a/main/Unused/GladeAddIn/GladeAddIn.Gui/ProjectFolderNodeBuilderExtension.cs b/main/Unused/GladeAddIn/GladeAddIn.Gui/ProjectFolderNodeBuilderExtension.cs deleted file mode 100644 index 01d39a8aeb..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.Gui/ProjectFolderNodeBuilderExtension.cs +++ /dev/null @@ -1,84 +0,0 @@ -// -// ProjectFolderNodeBuilderExtension.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - - -using System; -using MonoDevelop.Projects; -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui; -using MonoDevelop.Ide.Gui.Pads; -using MonoDevelop.Ide.Gui.Pads.ProjectPad; -using MonoDevelop.Components.Commands; - -namespace GladeAddIn.Gui -{ - class ProjectFolderNodeBuilderExtension: NodeBuilderExtension - { - public override bool CanBuildNode (Type dataType) - { - return typeof(ProjectFolder).IsAssignableFrom (dataType) || - typeof(Project).IsAssignableFrom (dataType); - } - - public override Type CommandHandlerType { - get { return typeof(ProjectFolderNodeBuilderExtensionCommandHandler); } - } - } - - class ProjectFolderNodeBuilderExtensionCommandHandler: NodeCommandHandler - { - [CommandHandler (GladeAddIn.GladeCommands.AddNewDialog)] - public void AddNewDialogToProject() - { - AddNewWindow ("GladeDialogFileTemplate"); - } - - [CommandHandler (GladeAddIn.GladeCommands.AddNewWindow)] - public void AddNewWindowToProject() - { - AddNewWindow ("GladeWindowFileTemplate"); - } - - public void AddNewWindow (string id) - { - Project project = CurrentNode.GetParentDataItem (typeof(Project), true) as Project; - string path; - if (CurrentNode.DataItem is ProjectFolder) - path = ((ProjectFolder)CurrentNode.DataItem).Path; - else - path = ((Project)CurrentNode.DataItem).BaseDirectory; - - IdeApp.ProjectOperations.CreateProjectFile (project, path, id); - - using (IProgressMonitor m = IdeApp.Workbench.ProgressMonitors.GetSaveProgressMonitor ()) { - project.Save (m); - } - CurrentNode.Expanded = true; - } - } -} diff --git a/main/Unused/GladeAddIn/GladeAddIn.Gui/WindowsFolder.cs b/main/Unused/GladeAddIn/GladeAddIn.Gui/WindowsFolder.cs deleted file mode 100644 index 050daabbfa..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.Gui/WindowsFolder.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -// WindowsFolder.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - - -using MonoDevelop.Projects; - -namespace GladeAddIn.Gui -{ - class WindowsFolder - { - Project project; - - public WindowsFolder (Project project) - { - this.project = project; - } - - public Project Project { - get { return project; } - } - } -} diff --git a/main/Unused/GladeAddIn/GladeAddIn.Gui/WindowsFolderNodeBuilder.cs b/main/Unused/GladeAddIn/GladeAddIn.Gui/WindowsFolderNodeBuilder.cs deleted file mode 100644 index 80f8437413..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.Gui/WindowsFolderNodeBuilder.cs +++ /dev/null @@ -1,115 +0,0 @@ -// -// WindowsFolderNodeBuilder.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; - -using MonoDevelop.Projects; -using MonoDevelop.Core; -using MonoDevelop.Core.Gui; -using MonoDevelop.Ide.Gui.Pads; -using MonoDevelop.Components.Commands; -using MonoDevelop.Ide.Gui; -using MonoDevelop.Ide.Commands; -using MonoDevelop.Ide.Gui.Pads.ProjectPad; - -namespace GladeAddIn.Gui -{ - public class WindowsFolderNodeBuilder: TypeNodeBuilder - { - ProjectFileEventHandler updateDelegate; - - public WindowsFolderNodeBuilder () - { - updateDelegate = (ProjectFileEventHandler) MonoDevelop.Core.Gui.Services.DispatchService.GuiDispatch (new ProjectFileEventHandler (OnUpdateFiles)); - } - - public override Type NodeDataType { - get { return typeof(WindowsFolder); } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return "WindowsAndDialogs"; - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - label = GettextCatalog.GetString ("Windows and Dialogs"); - icon = Context.GetIcon (Stock.OpenResourceFolder); - closedIcon = Context.GetIcon (Stock.ClosedResourceFolder); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - Project p = ((WindowsFolder)dataObject).Project; - GuiBuilderProject[] projects = GladeService.GetGuiBuilderProjects (p); - foreach (GuiBuilderProject project in projects) - builder.AddChild (project); - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - Project p = ((WindowsFolder)dataObject).Project; - GuiBuilderProject[] projects = GladeService.GetGuiBuilderProjects (p); - return projects.Length != 0; - } - - public override int CompareObjects (ITreeNavigator thisNode, ITreeNavigator otherNode) - { - if (otherNode.DataItem is ResourceFolder || otherNode.DataItem is ProjectReferenceCollection) - return 1; - else - return -1; - } - - public override void OnNodeAdded (object dataObject) - { - Project project = ((WindowsFolder) dataObject).Project; - project.FileAddedToProject += updateDelegate; - project.FileRemovedFromProject += updateDelegate; - } - - public override void OnNodeRemoved (object dataObject) - { - Project project = ((WindowsFolder) dataObject).Project; - project.FileAddedToProject -= updateDelegate; - project.FileRemovedFromProject -= updateDelegate; - } - - void OnUpdateFiles (object s, ProjectFileEventArgs args) - { - ITreeBuilder tb = Context.GetTreeBuilder (args.Project); - if (tb != null) { - if (tb.MoveToChild ("WindowsAndDialogs", typeof(WindowsFolder))) { - tb.UpdateAll (); - } - } - } - } -} diff --git a/main/Unused/GladeAddIn/GladeAddIn.addin.xml b/main/Unused/GladeAddIn/GladeAddIn.addin.xml deleted file mode 100644 index 93f7ce21ba..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.addin.xml +++ /dev/null @@ -1,80 +0,0 @@ -<AddIn id = "GladeAddIn" - name = "Glade Form Editor" - author = "Lluis Sanchez Gual" - copyright = "X11" - url = "" - description = "" - category = "IDE extensions" - version = "0.1"> - - <Runtime> - <Import assembly="GladeAddIn.dll"/> - </Runtime> - - <Dependencies> - <AddIn id="MonoDevelop.Ide" version="0.10.0"/> - </Dependencies> - - <Extension path = "/SharpDevelop/Workbench/Pads"> - <Pad id = "GladeAddIn.Gui.GladePalettePad" class = "GladeAddIn.Gui.GladePalettePad" _label="Glade Widgets" /> - <Pad id = "GladeAddIn.Gui.GladePropertiesPad" class = "GladeAddIn.Gui.GladePropertiesPad" _label="Glade Properties"/> - <Pad id = "GladeAddIn.Gui.GladeWidgetTreePad" class = "GladeAddIn.Gui.GladeWidgetTreePad" _label="Widget Tree"/> - </Extension> - - <Extension path = "/SharpDevelop/Workbench/Contexts/Edit"> - <ContextPad id = "GladeAddIn.Gui.GladePalettePad" /> - <ContextPad id = "GladeAddIn.Gui.GladePropertiesPad" /> - <ContextPad id = "GladeAddIn.Gui.GladeWidgetTreePad" /> - </Extension> - - <Extension path = "/SharpDevelop/Workbench/Pads/MonoDevelop.Ide.Gui.Pads.ProjectPad"> - <NodeBuilder class = "GladeAddIn.Gui.GuiBuilderProjectNodeBuilder"/> - <NodeBuilder class = "GladeAddIn.Gui.WindowsFolderNodeBuilder"/> - <NodeBuilder class = "GladeAddIn.Gui.GladeProjectNodeBuilder"/> - <NodeBuilder class = "GladeAddIn.Gui.GuiBuilderWindowNodeBuilder"/> - </Extension> - - <Extension path = "/MonoDevelop/FileTemplates"> - <FileTemplate id = "GladeDialogFileTemplate" resource = "GladeDialog.xft.xml"/> - <FileTemplate id = "GladeWindowFileTemplate" resource = "GladeWindow.xft.xml"/> - </Extension> - - <Extension path = "/SharpDevelop/Views/GladeFileNodeBuilder/ContextMenu"> - </Extension> - - <Extension path = "/SharpDevelop/Views/GladeWindowNodeBuilder/ContextMenu"> - </Extension> - - <Extension path = "/SharpDevelop/Workbench/DisplayBindings"> - <DisplayBinding insertbefore = "NewText" - supportedformats = "Text Files,Source Files" - class = "GladeAddIn.Gui.GuiBuilderDisplayBinding" /> - </Extension> - - <Extension path = "/SharpDevelop/Commands"> - <Command id = "GladeAddIn.GladeCommands.AddNewDialog" - _label = "Add New Dialog" /> - <Command id = "GladeAddIn.GladeCommands.AddNewWindow" - _label = "Add New Window" /> - </Extension> - - <Extension path = "/SharpDevelop/Views/ProjectBrowser/ContextMenu/ProjectBrowserNode/Add"> - <CommandItem id = "GladeAddIn.GladeCommands.AddNewDialog" insertafter = "MonoDevelop.Ide.Commands.ProjectCommands.AddNewFiles" /> - <CommandItem id = "GladeAddIn.GladeCommands.AddNewWindow" /> - </Extension> - - <Extension path = "/SharpDevelop/Views/ProjectBrowser/ContextMenu/DefaultDirectoryNode/Add"> - <CommandItem id = "GladeAddIn.GladeCommands.AddNewDialog" insertafter = "MonoDevelop.Ide.Commands.ProjectCommands.AddNewFiles" /> - <CommandItem id = "GladeAddIn.GladeCommands.AddNewWindow" /> - </Extension> - - <Extension path = "/SharpDevelop/Workbench/Pads/MonoDevelop.Ide.Gui.Pads.ProjectPad"> - <NodeBuilder class = "GladeAddIn.Gui.ProjectFolderNodeBuilderExtension"/> - </Extension> - - <Extension path = "/SharpDevelop/Workbench/DisplayBindings"> - <DisplayBinding class = "GladeAddIn.Gui.GladeFileDisplayBinding"/> - </Extension> - -</AddIn> - diff --git a/main/Unused/GladeAddIn/GladeAddIn.mdp b/main/Unused/GladeAddIn/GladeAddIn.mdp deleted file mode 100644 index 21020f4320..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.mdp +++ /dev/null @@ -1,66 +0,0 @@ -<Project name="GladeAddIn" fileversion="2.0" language="C#" ctype="DotNetProject"> - <Configurations active="Debug"> - <Configuration name="Debug" ctype="DotNetProjectConfiguration"> - <Output directory="../../build/AddIns/GladeAddIn/" assembly="GladeAddIn" /> - <Build debugmode="True" target="Library" /> - <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" /> - <CodeGeneration compiler="Csc" warninglevel="4" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> - </Configuration> - <Configuration name="Release" ctype="DotNetProjectConfiguration"> - <Output directory="../../build/AddIns/GladeAddIn/" assembly="GladeAddIn" /> - <Build debugmode="False" target="Library" /> - <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" /> - <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> - </Configuration> - </Configurations> - <DeploymentInformation strategy="File"> - <excludeFiles /> - </DeploymentInformation> - <Contents> - <File name="templates/GladeWindow.xft.xml" subtype="Code" buildaction="EmbedAsResource" /> - <File name="templates/GladeDialog.xft.xml" subtype="Code" buildaction="EmbedAsResource" /> - <File name="Metacity/ButtonFunction.cs" subtype="Code" buildaction="Compile" /> - <File name="Metacity/ButtonLayout.cs" subtype="Code" buildaction="Compile" /> - <File name="Metacity/FrameFlags.cs" subtype="Code" buildaction="Compile" /> - <File name="Metacity/FrameType.cs" subtype="Code" buildaction="Compile" /> - <File name="Metacity/ObjectManager.cs" subtype="Code" buildaction="Compile" /> - <File name="Metacity/Preview.cs" subtype="Code" buildaction="Compile" /> - <File name="Metacity/Theme.cs" subtype="Code" buildaction="Compile" /> - <File name="GladeAddIn.Commands/GladeCommands.cs" subtype="Code" buildaction="Compile" /> - <File name="GladeAddIn.Gui/ProjectFolderNodeBuilderExtension.cs" subtype="Code" buildaction="Compile" /> - <File name="GladeAddIn.Gui/GladeFileTemplate.cs" subtype="Code" buildaction="Compile" /> - <File name="GladeAddIn.Gui/GladePalettePad.cs" subtype="Code" buildaction="Compile" /> - <File name="GladeAddIn.Gui/GladeProjectNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="GladeAddIn.Gui/GladeProjectPad.cs" subtype="Code" buildaction="Compile" /> - <File name="GladeAddIn.Gui/GladePropertiesPad.cs" subtype="Code" buildaction="Compile" /> - <File name="GladeAddIn.Gui/GladeService.cs" subtype="Code" buildaction="Compile" /> - <File name="GladeAddIn.Gui/GuiBuilderProject.cs" subtype="Code" buildaction="Compile" /> - <File name="GladeAddIn.Gui/GuiBuilderProjectNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="GladeAddIn.Gui/GuiBuilderWindow.cs" subtype="Code" buildaction="Compile" /> - <File name="GladeAddIn.Gui/GuiBuilderWindowNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="GladeAddIn.Gui/GladeWidgetTreePad.cs" subtype="Code" buildaction="Compile" /> - <File name="GladeAddIn.Gui/WindowsFolder.cs" subtype="Code" buildaction="Compile" /> - <File name="GladeAddIn.Gui/EmbedWindow.cs" subtype="Code" buildaction="Compile" /> - <File name="GladeAddIn.Gui/PreviewBox.cs" subtype="Code" buildaction="Compile" /> - <File name="GladeAddIn.Gui/GuiBuilderView.cs" subtype="Code" buildaction="Compile" /> - <File name="GladeAddIn.Gui/GuiBuilderDisplayBinding.cs" subtype="Code" buildaction="Compile" /> - <File name="GladeAddIn.Gui/GuiBuilderEditSession.cs" subtype="Code" buildaction="Compile" /> - <File name="GladeAddIn.Gui/ClassUtils.cs" subtype="Code" buildaction="Compile" /> - <File name="GladeAddIn.Gui/GladeFileDisplayBinding.cs" subtype="Code" buildaction="Compile" /> - <File name="GladeAddIn.Gui/WindowsFolderNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - </Contents> - <References> - <ProjectReference type="Gac" localcopy="True" refto="System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> - <ProjectReference type="Gac" localcopy="True" refto="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Gac" localcopy="True" refto="atk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Gac" localcopy="True" refto="gconf-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Core" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Components" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Core.Gui" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Projects" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Projects.Gui" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Ide" /> - </References> -</Project> diff --git a/main/Unused/GladeAddIn/GladeAddIn.mds b/main/Unused/GladeAddIn/GladeAddIn.mds deleted file mode 100644 index cd1cc4cd9d..0000000000 --- a/main/Unused/GladeAddIn/GladeAddIn.mds +++ /dev/null @@ -1,16 +0,0 @@ -<Combine name="GladeAddIn" fileversion="2.0"> - <Configurations active="Debug"> - <Configuration name="Debug" ctype="CombineConfiguration"> - <Entry configuration="Debug" build="True" name="GladeAddIn" /> - </Configuration> - <Configuration name="Release" ctype="CombineConfiguration"> - <Entry configuration="Debug" build="True" name="GladeAddIn" /> - </Configuration> - </Configurations> - <StartMode startupentry="GladeAddIn" single="True"> - <Execute type="None" entry="GladeAddIn" /> - </StartMode> - <Entries> - <Entry filename="./GladeAddIn.mdp" /> - </Entries> -</Combine>
\ No newline at end of file diff --git a/main/Unused/GladeAddIn/Makefile.am b/main/Unused/GladeAddIn/Makefile.am deleted file mode 100644 index afcf948304..0000000000 --- a/main/Unused/GladeAddIn/Makefile.am +++ /dev/null @@ -1,77 +0,0 @@ - -ADDIN = GladeAddIn.addin.xml -ADDIN_BUILD = $(top_builddir)/build/AddIns/GladeAddIn -ASSEMBLY = $(ADDIN_BUILD)/GladeAddIn.dll - -REFS = -r:System \ - $(GTK_SHARP_LIBS) \ - $(GLADEUI_LIBS) \ - $(GCONF_SHARP_LIBS) \ - -r:$(top_builddir)/build/bin/MonoDevelop.Core.dll \ - -r:$(top_builddir)/build/AddIns/MonoDevelop.Components.dll \ - -r:$(top_builddir)/build/AddIns/MonoDevelop.Core.Gui.dll \ - -r:$(top_builddir)/build/AddIns/MonoDevelop.Projects.dll \ - -r:$(top_builddir)/build/AddIns/MonoDevelop.Projects.Gui.dll \ - -r:$(top_builddir)/build/AddIns/MonoDevelop.Ide.dll - -FILES = \ -Metacity/ButtonFunction.cs \ -Metacity/ButtonLayout.cs \ -Metacity/FrameFlags.cs \ -Metacity/FrameType.cs \ -Metacity/ObjectManager.cs \ -Metacity/Preview.cs \ -Metacity/Theme.cs \ -GladeAddIn.Commands/GladeCommands.cs \ -GladeAddIn.Gui/ProjectFolderNodeBuilderExtension.cs \ -GladeAddIn.Gui/GladeFileTemplate.cs \ -GladeAddIn.Gui/GladePalettePad.cs \ -GladeAddIn.Gui/GladeProjectNodeBuilder.cs \ -GladeAddIn.Gui/GladeProjectPad.cs \ -GladeAddIn.Gui/GladePropertiesPad.cs \ -GladeAddIn.Gui/GladeService.cs \ -GladeAddIn.Gui/GuiBuilderProject.cs \ -GladeAddIn.Gui/GuiBuilderProjectNodeBuilder.cs \ -GladeAddIn.Gui/GuiBuilderWindow.cs \ -GladeAddIn.Gui/GuiBuilderWindowNodeBuilder.cs \ -GladeAddIn.Gui/GladeWidgetTreePad.cs \ -GladeAddIn.Gui/WindowsFolder.cs \ -GladeAddIn.Gui/EmbedWindow.cs \ -GladeAddIn.Gui/PreviewBox.cs \ -GladeAddIn.Gui/GuiBuilderView.cs \ -GladeAddIn.Gui/GuiBuilderDisplayBinding.cs \ -GladeAddIn.Gui/GuiBuilderEditSession.cs \ -GladeAddIn.Gui/ClassUtils.cs \ -GladeAddIn.Gui/GladeFileDisplayBinding.cs \ -GladeAddIn.Gui/WindowsFolderNodeBuilder.cs - -RES = \ -templates/GladeWindow.xft.xml \ -templates/GladeDialog.xft.xml - -EXTRA_DIST = $(FILES) $(ADDIN) $(RES) - -if ENABLE_GLADE - -all: $(ASSEMBLY) $(ADDIN_BUILD)/$(ADDIN) - -$(ADDIN_BUILD)/$(ADDIN): $(srcdir)/$(ADDIN) - mkdir -p $(ADDIN_BUILD) - cp $(srcdir)/$(ADDIN) $@ - -$(ASSEMBLY): $(build_sources) $(RES) - mkdir -p $(ADDIN_BUILD) - $(CSC) $(CSC_FLAGS) -debug -out:$@ -target:library \ - $(RES:%=/resource:%) $(build_sources) $(REFS) - -assemblydir = $(MD_ADDIN_DIR)/GladeAddIn -assembly_DATA = $(ASSEMBLY) $(ASSEMBLY).mdb $(ADDIN) - -CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb - -else -all: - -endif - -include $(top_srcdir)/Makefile.include diff --git a/main/Unused/GladeAddIn/Metacity/ButtonFunction.cs b/main/Unused/GladeAddIn/Metacity/ButtonFunction.cs deleted file mode 100644 index 4f36762ff6..0000000000 --- a/main/Unused/GladeAddIn/Metacity/ButtonFunction.cs +++ /dev/null @@ -1,19 +0,0 @@ -// This file was generated by the Gtk# code generator. -// Any changes made will be lost if regenerated. - -namespace Metacity { - - using System; - using System.Runtime.InteropServices; - -#region Autogenerated code - public enum ButtonFunction { - - Menu, - Minimize, - Maximize, - Close, - Last, - } -#endregion -} diff --git a/main/Unused/GladeAddIn/Metacity/ButtonLayout.cs b/main/Unused/GladeAddIn/Metacity/ButtonLayout.cs deleted file mode 100644 index 132228736d..0000000000 --- a/main/Unused/GladeAddIn/Metacity/ButtonLayout.cs +++ /dev/null @@ -1,35 +0,0 @@ -// This file was generated by the Gtk# code generator. -// Any changes made will be lost if regenerated. - -namespace Metacity { - - using System; - using System.Collections; - using System.Runtime.InteropServices; - -#region Autogenerated code - [StructLayout(LayoutKind.Sequential)] - public struct ButtonLayout { - - [MarshalAs (UnmanagedType.ByValArray, SizeConst=4)] - public Metacity.ButtonFunction[] LeftButtons; - [MarshalAs (UnmanagedType.ByValArray, SizeConst=4)] - public Metacity.ButtonFunction[] RightButtons; - - public static Metacity.ButtonLayout Zero = new Metacity.ButtonLayout (); - - public static Metacity.ButtonLayout New(IntPtr raw) { - if (raw == IntPtr.Zero) { - return Metacity.ButtonLayout.Zero; - } - Metacity.ButtonLayout self = new Metacity.ButtonLayout(); - self = (Metacity.ButtonLayout) Marshal.PtrToStructure (raw, self.GetType ()); - return self; - } - - private static GLib.GType GType { - get { return GLib.GType.Pointer; } - } -#endregion - } -} diff --git a/main/Unused/GladeAddIn/Metacity/FrameFlags.cs b/main/Unused/GladeAddIn/Metacity/FrameFlags.cs deleted file mode 100644 index 9acf004b2f..0000000000 --- a/main/Unused/GladeAddIn/Metacity/FrameFlags.cs +++ /dev/null @@ -1,29 +0,0 @@ -// This file was generated by the Gtk# code generator. -// Any changes made will be lost if regenerated. - -namespace Metacity { - - using System; - using System.Runtime.InteropServices; - -#region Autogenerated code - [Flags] - public enum FrameFlags { - - AllowsDelete = 1 << 0, - AllowsMenu = 1 << 1, - AllowsMinimize = 1 << 2, - AllowsMaximize = 1 << 3, - AllowsVerticalResize = 1 << 4, - AllowsHorizontalResize = 1 << 5, - HasFocus = 1 << 6, - Shaded = 1 << 7, - Stuck = 1 << 8, - Maximized = 1 << 9, - AllowsShade = 1 << 10, - AllowsMove = 1 << 11, - Fullscreen = 1 << 12, - IsFlashing = 1 << 13, - } -#endregion -} diff --git a/main/Unused/GladeAddIn/Metacity/FrameType.cs b/main/Unused/GladeAddIn/Metacity/FrameType.cs deleted file mode 100644 index 497ba57ec0..0000000000 --- a/main/Unused/GladeAddIn/Metacity/FrameType.cs +++ /dev/null @@ -1,21 +0,0 @@ -// This file was generated by the Gtk# code generator. -// Any changes made will be lost if regenerated. - -namespace Metacity { - - using System; - using System.Runtime.InteropServices; - -#region Autogenerated code - public enum FrameType { - - Normal, - Dialog, - ModalDialog, - Utility, - Menu, - Border, - Last, - } -#endregion -} diff --git a/main/Unused/GladeAddIn/Metacity/ObjectManager.cs b/main/Unused/GladeAddIn/Metacity/ObjectManager.cs deleted file mode 100644 index d5bf8ed71f..0000000000 --- a/main/Unused/GladeAddIn/Metacity/ObjectManager.cs +++ /dev/null @@ -1,19 +0,0 @@ -// This file was generated by the Gtk# code generator. -// Any changes made will be lost if regenerated. - -namespace GtkSharp.MetacitySharp { - - public class ObjectManager { - - static bool initialized = false; - // Call this method from the appropriate module init function. - public static void Initialize () - { - if (initialized) - return; - - initialized = true; - GLib.GType.Register (Metacity.Preview.GType, typeof (Metacity.Preview)); - } - } -} diff --git a/main/Unused/GladeAddIn/Metacity/Preview.cs b/main/Unused/GladeAddIn/Metacity/Preview.cs deleted file mode 100644 index 1111143784..0000000000 --- a/main/Unused/GladeAddIn/Metacity/Preview.cs +++ /dev/null @@ -1,121 +0,0 @@ -// This file was generated by the Gtk# code generator. -// Any changes made will be lost if regenerated. - -namespace Metacity { - - using System; - using System.Collections; - using System.Runtime.InteropServices; - -#region Autogenerated code - public class Preview : Gtk.Bin { - - ~Preview() - { - Dispose(); - } - - [Obsolete] - protected Preview(GLib.GType gtype) : base(gtype) {} - public Preview(IntPtr raw) : base(raw) {} - - [DllImport("libmetacity-private.so.0")] - static extern IntPtr meta_preview_new(); - - public Preview () : base (IntPtr.Zero) - { - if (GetType () != typeof (Preview)) { - CreateNativeObject (new string [0], new GLib.Value[0]); - return; - } - Raw = meta_preview_new(); - } - - [DllImport("libmetacity-private.so.0")] - static extern void meta_preview_set_title(IntPtr raw, IntPtr title); - - public string Title { - set { - IntPtr title_as_native = GLib.Marshaller.StringToPtrGStrdup (value); - meta_preview_set_title(Handle, title_as_native); - GLib.Marshaller.Free (title_as_native); - } - } - - [DllImport("libmetacity-private.so.0")] - static extern void meta_preview_set_button_layout(IntPtr raw, ref Metacity.ButtonLayout button_layout); - - public Metacity.ButtonLayout ButtonLayout { - set { - meta_preview_set_button_layout(Handle, ref value); - } - } - - [DllImport("libmetacity-private.so.0")] - static extern void meta_preview_set_theme(IntPtr raw, IntPtr theme); - - public Metacity.Theme Theme { - set { - meta_preview_set_theme(Handle, (value == null ? IntPtr.Zero : value.Handle)); - } - } - - [DllImport("libmetacity-private.so.0")] - static extern IntPtr meta_preview_get_mini_icon(); - - public static Gdk.Pixbuf MiniIcon { - get { - IntPtr raw_ret = meta_preview_get_mini_icon(); - Gdk.Pixbuf ret = GLib.Object.GetObject(raw_ret) as Gdk.Pixbuf; - return ret; - } - } - - [DllImport("libmetacity-private.so.0")] - static extern IntPtr meta_preview_get_icon(); - - public static Gdk.Pixbuf Icon { - get { - IntPtr raw_ret = meta_preview_get_icon(); - Gdk.Pixbuf ret = GLib.Object.GetObject(raw_ret) as Gdk.Pixbuf; - return ret; - } - } - - [DllImport("libmetacity-private.so.0")] - static extern void meta_preview_set_frame_type(IntPtr raw, int type); - - public Metacity.FrameType FrameType { - set { - meta_preview_set_frame_type(Handle, (int) value); - } - } - - [DllImport("libmetacity-private.so.0")] - static extern IntPtr meta_preview_get_type(); - - public static new GLib.GType GType { - get { - IntPtr raw_ret = meta_preview_get_type(); - GLib.GType ret = new GLib.GType(raw_ret); - return ret; - } - } - - [DllImport("libmetacity-private.so.0")] - static extern void meta_preview_set_frame_flags(IntPtr raw, int flags); - - public Metacity.FrameFlags FrameFlags { - set { - meta_preview_set_frame_flags(Handle, (int) value); - } - } - - - static Preview () - { - GtkSharp.MetacitySharp.ObjectManager.Initialize (); - } -#endregion - } -} diff --git a/main/Unused/GladeAddIn/Metacity/Theme.cs b/main/Unused/GladeAddIn/Metacity/Theme.cs deleted file mode 100644 index da0da02a63..0000000000 --- a/main/Unused/GladeAddIn/Metacity/Theme.cs +++ /dev/null @@ -1,40 +0,0 @@ -namespace Metacity { - - using System; - using System.Runtime.InteropServices; - - public class Theme : GLib.Opaque { - - public Theme (IntPtr raw) : base (raw) {} - - [DllImport("libmetacity-private.so.0")] - static extern IntPtr meta_theme_get_current (); - - public static Theme Current { - get { - IntPtr raw = meta_theme_get_current (); - return (Theme)GetOpaque (raw, typeof (Metacity.Theme), true); - } - } - - [DllImport("libmetacity-private.so.0")] - static extern IntPtr meta_theme_load (string theme_name, IntPtr err); - - public static Theme Load (string name) - { - IntPtr raw = meta_theme_load (name, IntPtr.Zero); - if (raw == IntPtr.Zero) - return null; - else - return (Theme)GetOpaque (raw, typeof (Metacity.Theme), true); - } - - [DllImport("libmetacity-private.so.0")] - static extern void meta_theme_free (IntPtr raw); - - protected override void Free (IntPtr raw) - { - meta_theme_free (Raw); - } - } -} diff --git a/main/Unused/GladeAddIn/README b/main/Unused/GladeAddIn/README deleted file mode 100644 index 3d3a0a1588..0000000000 --- a/main/Unused/GladeAddIn/README +++ /dev/null @@ -1,16 +0,0 @@ -This is the initial version of the Glade-3 add-in, which integrates Glade-3 -into MonoDevelop. To test the add-in you need the following: - -* Make sure you have the latest Mono and GTK# version. -* Get Glade-3 from http://ftp.gnome.org/pub/GNOME/sources/glade-3/2.90/glade-3-2.90.0.tar.gz -* Apply the patch glade3.patch, which is located in this directory. -* Compile and install Glade-3 -* Get the gladeui-sharp module from the Mono repository. -* Compile and install gladeui-sharp. -* Run autogen.sh in the MonoDevelop directory setting the --enable-glade option. -* Compile MonoDevelop. - -You are done! To use the integrated editor, create a new Glade project and -add a Window or Dialog (using the Add File option, and selection the Glade -section in the new file dialog). You should also enable the Glade Project View, -the Glade Palette and the Glade Properties editor in the View menu. diff --git a/main/Unused/GladeAddIn/glade3.patch b/main/Unused/GladeAddIn/glade3.patch deleted file mode 100644 index e27cf3d016..0000000000 --- a/main/Unused/GladeAddIn/glade3.patch +++ /dev/null @@ -1,66 +0,0 @@ -diff -u -r ../glade3ref/glade-3-2.90.0/src/glade-parser.c ./src/glade-parser.c ---- ../glade3ref/glade-3-2.90.0/src/glade-parser.c 2005-09-15 03:45:43.000000000 +0200 -+++ ./src/glade-parser.c 2005-12-22 18:08:43.000000000 +0100 -@@ -1143,6 +1143,24 @@ - } - - /** -+ * glade_interface_new -+ * -+ * Creates a GladeInterface structure. -+ */ -+GladeInterface * -+glade_interface_new () -+{ -+ GladeInterface *interface; -+ interface = g_new0 (GladeInterface, 1); -+ interface->names = g_hash_table_new (g_str_hash, g_str_equal); -+ interface->strings = g_hash_table_new_full (g_str_hash, -+ g_str_equal, -+ (GDestroyNotify)g_free, -+ NULL); -+ return interface; -+} -+ -+/** - * glade_interface_destroy - * @interface: the GladeInterface structure. - * -diff -u -r ../glade3ref/glade-3-2.90.0/src/glade-parser.h ./src/glade-parser.h ---- ../glade3ref/glade-3-2.90.0/src/glade-parser.h 2005-09-15 03:45:44.000000000 +0200 -+++ ./src/glade-parser.h 2005-12-22 18:06:39.000000000 +0100 -@@ -128,6 +128,7 @@ - const gchar *domain); - GladeInterface *glade_parser_parse_buffer (const gchar *buffer, gint len, - const gchar *domain); -+GladeInterface *glade_interface_new (); - void glade_interface_destroy (GladeInterface *interface); - void glade_interface_dump (GladeInterface *interface, - const gchar *filename); -diff -u -r ../glade3ref/glade-3-2.90.0/src/glade-widget.c ./src/glade-widget.c ---- ../glade3ref/glade-3-2.90.0/src/glade-widget.c 2005-09-29 18:25:16.000000000 +0200 -+++ ./src/glade-widget.c 2005-12-14 14:50:41.000000000 +0100 -@@ -1765,13 +1765,21 @@ - glade_widget_retrieve_from_position (GtkWidget *base, int x, int y) - { - GtkWidget *toplevel_widget; -+ GtkWidget *next_widget; - gint top_x; - gint top_y; - -- toplevel_widget = gtk_widget_get_toplevel (base); -+ next_widget = base; -+ toplevel_widget = base; -+ while (next_widget && glade_widget_get_from_gobject (next_widget)) { -+ toplevel_widget = next_widget; -+ next_widget = gtk_widget_get_parent (next_widget); -+ } -+ -+/* toplevel_widget = gtk_widget_get_toplevel (base); - if (!GTK_WIDGET_TOPLEVEL (toplevel_widget)) - return NULL; -- -+*/ - gtk_widget_translate_coordinates (base, toplevel_widget, x, y, &top_x, &top_y); - return glade_widget_find_deepest_child_at_position - (GTK_CONTAINER (toplevel_widget), diff --git a/main/Unused/GladeAddIn/templates/GladeDialog.xft.xml b/main/Unused/GladeAddIn/templates/GladeDialog.xft.xml deleted file mode 100644 index a1e55ac0be..0000000000 --- a/main/Unused/GladeAddIn/templates/GladeDialog.xft.xml +++ /dev/null @@ -1,106 +0,0 @@ -<?xml version="1.0"?> -<Template Originator="Lluis Sanchez" Created="3/09/2001" LastModified="3/09/2001"> - - <TemplateConfiguration> - <_Name>Dialog</_Name> - <Icon>md-empty-file-icon</Icon> - <Category>Gtk</Category> - <LanguageName>*</LanguageName> - <_Description>Creates a Glade dialog.</_Description> - <Type>GladeAddIn.Gui.GladeFileTemplate</Type> - </TemplateConfiguration> - - <TemplateFiles> - <File DefaultName="${Name}"> - -<CompileUnit> - <Namespaces> - <Namespace Name="${Namespace}"> - <Imports> - <NamespaceImport Namespace="System" /> - <NamespaceImport Namespace="System.Xml" /> - </Imports> - <Types> - <TypeDeclaration Name="${Name}" IsClass="true"> - <Members> - <MemberField Name="dialog" Type="Gtk.Dialog"> - <CustomAttributes> - <AttributeDeclaration Name="Glade.Widget"> - <Arguments> - <AttributeArgument> - <Value><PrimitiveExpression Value="${Name}"/></Value> - </AttributeArgument> - </Arguments> - </AttributeDeclaration> - </CustomAttributes> - </MemberField> - <Constructor Attributes="Public, Final"> - <Statements> - <MethodInvokeExpression> - <Method> - <MethodReferenceExpression MethodName="Autoconnect"> - <TargetObject> - <ObjectCreateExpression CreateType="Glade.XML"> - <Parameters> - <PrimitiveExpression/> - <PrimitiveExpression Value="${GladeFile}"/> - <PrimitiveExpression Value="${Name}"/> - <PrimitiveExpression/> - </Parameters> - </ObjectCreateExpression> - </TargetObject> - </MethodReferenceExpression> - </Method> - <Parameters> - <ThisReferenceExpression/> - </Parameters> - </MethodInvokeExpression> - </Statements> - </Constructor> - <MemberMethod Name="Run" ReturnType="System.Int32" Attributes="Public, Final"> - <Statements> - <MethodReturnStatement> - <Expression> - <MethodInvokeExpression> - <Method> - <MethodReferenceExpression MethodName="Run"> - <TargetObject> - <FieldReferenceExpression FieldName="dialog"> - <TargetObject> <ThisReferenceExpression/> </TargetObject> - </FieldReferenceExpression> - </TargetObject> - </MethodReferenceExpression> - </Method> - </MethodInvokeExpression> - </Expression> - </MethodReturnStatement> - </Statements> - </MemberMethod> - <MemberMethod Name="Show" Attributes="Public, Final"> - <Statements> - <MethodInvokeExpression> - <Method> - <MethodReferenceExpression MethodName="Show"> - <TargetObject> - <FieldReferenceExpression FieldName="dialog"> - <TargetObject> <ThisReferenceExpression/> </TargetObject> - </FieldReferenceExpression> - </TargetObject> - </MethodReferenceExpression> - </Method> - </MethodInvokeExpression> - </Statements> - </MemberMethod> - </Members> - </TypeDeclaration> - </Types> - </Namespace> - </Namespaces> -</CompileUnit> - - </File> - </TemplateFiles> - - <FileOptions/> - -</Template> diff --git a/main/Unused/GladeAddIn/templates/GladeWindow.xft.xml b/main/Unused/GladeAddIn/templates/GladeWindow.xft.xml deleted file mode 100644 index 3934524aa0..0000000000 --- a/main/Unused/GladeAddIn/templates/GladeWindow.xft.xml +++ /dev/null @@ -1,87 +0,0 @@ -<?xml version="1.0"?> -<Template Originator="Lluis Sanchez" Created="3/09/2001" LastModified="3/09/2001"> - - <TemplateConfiguration> - <_Name>Window</_Name> - <Icon>md-empty-file-icon</Icon> - <Category>Gtk</Category> - <LanguageName>*</LanguageName> - <_Description>Creates a Glade window.</_Description> - <Type>GladeAddIn.Gui.GladeFileTemplate</Type> - </TemplateConfiguration> - - <TemplateFiles> - <File DefaultName="${Name}"> - -<CompileUnit> - <Namespaces> - <Namespace Name="${Namespace}"> - <Imports> - <NamespaceImport Namespace="System" /> - <NamespaceImport Namespace="System.Xml" /> - </Imports> - <Types> - <TypeDeclaration Name="${Name}" IsClass="true"> - <Members> - <MemberField Name="window" Type="Gtk.Window"> - <CustomAttributes> - <AttributeDeclaration Name="Glade.Widget"> - <Arguments> - <AttributeArgument> - <Value><PrimitiveExpression Value="${Name}"/></Value> - </AttributeArgument> - </Arguments> - </AttributeDeclaration> - </CustomAttributes> - </MemberField> - <Constructor Attributes="Public, Final"> - <Statements> - <MethodInvokeExpression> - <Method> - <MethodReferenceExpression MethodName="Autoconnect"> - <TargetObject> - <ObjectCreateExpression CreateType="Glade.XML"> - <Parameters> - <PrimitiveExpression/> - <PrimitiveExpression Value="${GladeFile}"/> - <PrimitiveExpression Value="${Name}"/> - <PrimitiveExpression/> - </Parameters> - </ObjectCreateExpression> - </TargetObject> - </MethodReferenceExpression> - </Method> - <Parameters> - <ThisReferenceExpression/> - </Parameters> - </MethodInvokeExpression> - </Statements> - </Constructor> - <MemberMethod Name="Show" Attributes="Public, Final"> - <Statements> - <MethodInvokeExpression> - <Method> - <MethodReferenceExpression MethodName="Show"> - <TargetObject> - <FieldReferenceExpression FieldName="window"> - <TargetObject> <ThisReferenceExpression/> </TargetObject> - </FieldReferenceExpression> - </TargetObject> - </MethodReferenceExpression> - </Method> - </MethodInvokeExpression> - </Statements> - </MemberMethod> - </Members> - </TypeDeclaration> - </Types> - </Namespace> - </Namespaces> -</CompileUnit> - - </File> - </TemplateFiles> - - <FileOptions/> - -</Template> diff --git a/main/Unused/ICSharpCode.TextEditor/Makefile.am b/main/Unused/ICSharpCode.TextEditor/Makefile.am deleted file mode 100644 index 47226e58e2..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/Makefile.am +++ /dev/null @@ -1,113 +0,0 @@ -FILES= \ -./src/Actions/ClipBoardActions.cs \ -./src/Actions/IEditAction.cs \ -./src/Actions/MiscActions.cs \ -./src/Actions/CaretActions.cs \ -./src/Actions/HomeEndActions.cs \ -./src/Actions/FoldActions.cs \ -./src/Actions/SelectionActions.cs \ -./src/Actions/BookmarkActions.cs \ -./src/Actions/FormatActions.cs \ -./src/Gui/TextAreaControl.cs \ -./src/Gui/IconBarMargin.cs \ -./src/Gui/TextArea.cs \ -./src/Gui/FoldMargin.cs \ -./src/Gui/TextView.cs \ -./src/Gui/TextAreaMouseHandler.cs \ -./src/Gui/TextAreaUpdate.cs \ -./src/Gui/Ruler.cs \ -./src/Gui/TextEditorControlBase.cs \ -./src/Gui/InsightWindow/InsightWindow.cs \ -./src/Gui/InsightWindow/IInsightDataProvider.cs \ -./src/Gui/TextAreaClipboardHandler.cs \ -./src/Gui/BracketHighlighter.cs \ -./src/Gui/CompletionWindow/DeclarationViewWindow.cs \ -./src/Gui/CompletionWindow/ICompletionData.cs \ -./src/Gui/CompletionWindow/CompletionWindow.cs \ -./src/Gui/CompletionWindow/ICompletionDataProvider.cs \ -./src/Gui/TextEditorControl.cs \ -./src/Gui/Caret.cs \ -./src/Gui/Ime.cs \ -./src/Gui/TextAreaDragDropHandler.cs \ -./src/Gui/AbstractMargin.cs \ -./src/Gui/GutterMargin.cs \ -./src/AssemblyInfo.cs \ -./src/Undo/UndoStack.cs \ -./src/Undo/IUndoableOperation.cs \ -./src/Undo/UndoableDelete.cs \ -./src/Undo/UndoableInsert.cs \ -./src/Undo/UndoQueue.cs \ -./src/Undo/UndoableReplace.cs \ -./src/Util/TipPainterTools.cs \ -./src/Util/TipPainter.cs \ -./src/Util/LookupTable.cs \ -./src/Util/TipSection.cs \ -./src/Util/TipText.cs \ -./src/Util/TipSplitter.cs \ -./src/Util/TextUtility.cs \ -./src/Util/RtfWriter.cs \ -./src/Util/TipSpacer.cs \ -./src/Document/LineManager/ILineManager.cs \ -./src/Document/LineManager/LineSegment.cs \ -./src/Document/LineManager/LineManagerEventArgs.cs \ -./src/Document/LineManager/DefaultLineManager.cs \ -./src/Document/ISegment.cs \ -./src/Document/Selection/SelectionManager.cs \ -./src/Document/Selection/ISelection.cs \ -./src/Document/Selection/SelectionCollection.cs \ -./src/Document/Selection/ColumnRange.cs \ -./src/Document/Selection/DefaultSelection.cs \ -./src/Document/BookmarkManager/BookmarkManager.cs \ -./src/Document/BookmarkManager/IBookMarkManager.cs \ -./src/Document/BookmarkManager/BookmarkManagerMemento.cs \ -./src/Document/DefaultTextEditorProperties.cs \ -./src/Document/TextUtilities.cs \ -./src/Document/HighlightingStrategy/HighlightingManager.cs \ -./src/Document/HighlightingStrategy/HighlightRuleSet.cs \ -./src/Document/HighlightingStrategy/PrevMarker.cs \ -./src/Document/HighlightingStrategy/NextMarker.cs \ -./src/Document/HighlightingStrategy/TextWord.cs \ -./src/Document/HighlightingStrategy/HighlightInfo.cs \ -./src/Document/HighlightingStrategy/HighlightingStrategyFactory.cs \ -./src/Document/HighlightingStrategy/SyntaxModes/SyntaxMode.cs \ -./src/Document/HighlightingStrategy/SyntaxModes/ResourceSyntaxModeProvider.cs \ -./src/Document/HighlightingStrategy/SyntaxModes/ISyntaxModeFileProvider.cs \ -./src/Document/HighlightingStrategy/SyntaxModes/FileSyntaxModeProvider.cs \ -./src/Document/HighlightingStrategy/Span.cs \ -./src/Document/HighlightingStrategy/HighlightingDefinitionParser.cs \ -./src/Document/HighlightingStrategy/DefaultHighlightingStrategy.cs \ -./src/Document/HighlightingStrategy/IHighlightingStrategy.cs \ -./src/Document/HighlightingStrategy/HighlightingColorNotFoundException.cs \ -./src/Document/HighlightingStrategy/HighlightBackground.cs \ -./src/Document/HighlightingStrategy/HighlightColor.cs \ -./src/Document/HighlightingStrategy/FontContainer.cs \ -./src/Document/ITextEditorProperties.cs \ -./src/Document/DefaultDocument.cs \ -./src/Document/IDocument.cs \ -./src/Document/AbstractSegment.cs \ -./src/Document/TextBufferStrategy/StringTextBufferStrategy.cs \ -./src/Document/TextBufferStrategy/GapTextBufferStrategy.cs \ -./src/Document/TextBufferStrategy/ITextBufferStrategy.cs \ -./src/Document/DocumentEventArgs.cs \ -./src/Document/FoldingStrategy/ParserFoldingStrategy.cs \ -./src/Document/FoldingStrategy/FoldingManager.cs \ -./src/Document/FoldingStrategy/IFoldingStrategy.cs \ -./src/Document/FoldingStrategy/FoldMarker.cs \ -./src/Document/FoldingStrategy/IndentFoldingStrategy.cs \ -./src/Document/DocumentFactory.cs - -DLL=../../../build/bin/MonoDevelop.TextEditor.dll -REFS= \ - /r:System.Drawing \ - /r:gtk-sharp \ - /r:glib-sharp \ - /r:gdk-sharp \ - /r:pango-sharp -# \ - #/r:../../../build/bin/MonoDevelop.SourceEditor.dll -all: $(DLL) - -$(DLL): $(FILES) - $(CSC) $(CSC_FLAGS) /out:$@ /target:library $(REFS) /define:GTK /resource:data/syntaxmodes/SyntaxModes.xml,SyntaxModes.xml /resource:data/syntaxmodes/CSharp-Mode.xshd,CSharp-Mode.xshd /resource:data/Mode.xsd,Mode.xsd /resource:data/syntaxmodes/ASPX.xshd,ASPX.xshd /resource:data/syntaxmodes/BAT-Mode.xshd,BAT-Mode.xshd /resource:data/syntaxmodes/CPP-Mode.xshd,CPP-Modes.xshd /resource:data/syntaxmodes/Coco-Mode.xshd,Coco-Mode.xshd /resource:data/syntaxmodes/HTML-Mode.xshd,HTML-Mode.xshd /resource:data/syntaxmodes/Java-Mode.xshd,Java-Mode.xshd /resource:data/syntaxmodes/JavaScript-Mode.xshd,JavaScript-Mode.xshd /resource:data/syntaxmodes/PHP-Mode.xshd,PHP-Mode.xshd /resource:data/syntaxmodes/Tex-Mode.xshd,Tex-Mode.xshd /resource:data/syntaxmodes/VBNET-Mode.xshd,VBNET-Mode.xshd /resource:data/syntaxmodes/XML-Mode.xshd,XML-Mode.xshd /resource:data/RightArrow.cur,RightArrow.cur $(FILES) - -CLEANFILES=$(DLL) $(DLL).mdb diff --git a/main/Unused/ICSharpCode.TextEditor/data/ICSharpCode.TextEditor.TextEditorControl.bmp b/main/Unused/ICSharpCode.TextEditor/data/ICSharpCode.TextEditor.TextEditorControl.bmp Binary files differdeleted file mode 100644 index 4bd828012d..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/data/ICSharpCode.TextEditor.TextEditorControl.bmp +++ /dev/null diff --git a/main/Unused/ICSharpCode.TextEditor/data/ICSharpCode.TextEditor.key b/main/Unused/ICSharpCode.TextEditor/data/ICSharpCode.TextEditor.key Binary files differdeleted file mode 100644 index a49f400e76..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/data/ICSharpCode.TextEditor.key +++ /dev/null diff --git a/main/Unused/ICSharpCode.TextEditor/data/Mode.xsd b/main/Unused/ICSharpCode.TextEditor/data/Mode.xsd deleted file mode 100644 index d137905b41..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/data/Mode.xsd +++ /dev/null @@ -1,332 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" > - <xsd:annotation> - <xsd:documentation> - This schema defines the syntax for mode definitions in SharpDevelop. - The schema can be simplified quite a bit but it does the job as is. - - - If you are using this file as a reference it is probably easiest to scroll to - the botton to find the definition of the root element called SyntaxDefinition and - then unwind the different type definitions and refernces. - - Note on coloring: - Many tags define how some symbol should be colored. If a specific symbol - can not be matched onto either a Span definition, Keyword, or a Digit/Number it - will be rendered in the current default color. Which is the default color of the - current span or the default color of the mode as a whole if no span has been entered. - </xsd:documentation> - </xsd:annotation> - - <!-- Defines the default rendering of the mode --> - <xsd:complexType name="Default"> - <xsd:attribute name="bold" type="xsd:boolean" /> - <xsd:attribute name="italic" type="xsd:boolean" /> - <xsd:attribute name="color" type="xsd:string" /> - <xsd:attribute name="bgcolor" type="xsd:string" /> - </xsd:complexType> - <xsd:complexType name="VRuler"> - <xsd:attribute name="bold" type="xsd:boolean" /> - <xsd:attribute name="italic" type="xsd:boolean" /> - <xsd:attribute name="color" type="xsd:string" /> - <xsd:attribute name="bgcolor" type="xsd:string" /> - </xsd:complexType> - <!-- Defines the rendering of the current selection --> - <xsd:complexType name="Selection"> - <xsd:attribute name="bold" type="xsd:boolean" /> - <xsd:attribute name="italic" type="xsd:boolean" /> - <xsd:attribute name="color" type="xsd:string" /> - <xsd:attribute name="bgcolor" type="xsd:string" /> - </xsd:complexType> - <!-- Defines the rendering of line numbers --> - <xsd:complexType name="LineNumbers"> - <xsd:attribute name="bold" type="xsd:boolean" /> - <xsd:attribute name="italic" type="xsd:boolean" /> - <xsd:attribute name="color" type="xsd:string" /> - <xsd:attribute name="bgcolor" type="xsd:string" /> - </xsd:complexType> - <xsd:complexType name="InvalidLines"> - <xsd:attribute name="bold" type="xsd:boolean" /> - <xsd:attribute name="italic" type="xsd:boolean" /> - <xsd:attribute name="color" type="xsd:string" /> - <xsd:attribute name="bgcolor" type="xsd:string" /> - </xsd:complexType> - <xsd:complexType name="EOLMarkers"> - <xsd:attribute name="bold" type="xsd:boolean" /> - <xsd:attribute name="italic" type="xsd:boolean" /> - <xsd:attribute name="color" type="xsd:string" /> - <xsd:attribute name="bgcolor" type="xsd:string" /> - </xsd:complexType> - <xsd:complexType name="SpaceMarkers"> - <xsd:attribute name="bold" type="xsd:boolean" /> - <xsd:attribute name="italic" type="xsd:boolean" /> - <xsd:attribute name="color" type="xsd:string" /> - <xsd:attribute name="bgcolor" type="xsd:string" /> - </xsd:complexType> - <xsd:complexType name="TabMarkers"> - <xsd:attribute name="bold" type="xsd:boolean" /> - <xsd:attribute name="italic" type="xsd:boolean" /> - <xsd:attribute name="color" type="xsd:string" /> - <xsd:attribute name="bgcolor" type="xsd:string" /> - </xsd:complexType> - <xsd:complexType name="CaretMarker"> - <xsd:attribute name="bold" type="xsd:boolean" /> - <xsd:attribute name="italic" type="xsd:boolean" /> - <xsd:attribute name="color" type="xsd:string" /> - <xsd:attribute name="bgcolor" type="xsd:string" /> - </xsd:complexType> - <xsd:complexType name="FoldLine"> - <xsd:attribute name="bold" type="xsd:boolean" /> - <xsd:attribute name="italic" type="xsd:boolean" /> - <xsd:attribute name="color" type="xsd:string" /> - <xsd:attribute name="bgcolor" type="xsd:string" /> - </xsd:complexType> - <xsd:complexType name="FoldMarker"> - <xsd:attribute name="bold" type="xsd:boolean" /> - <xsd:attribute name="italic" type="xsd:boolean" /> - <xsd:attribute name="color" type="xsd:string" /> - <xsd:attribute name="bgcolor" type="xsd:string" /> - </xsd:complexType> - - <!-- The environment tag defines the coloring of various attributes in SharpDevelop --> - <xsd:complexType name="Environment"> - <xsd:sequence> - <xsd:element name="Default" type="Default" /> - <xsd:element name="Selection" type="Selection" /> - <xsd:element name="VRuler" type="VRuler" /> - <xsd:element name="InvalidLines" type="InvalidLines" /> - <xsd:element name="CaretMarker" type="CaretMarker" /> - - <xsd:element name="LineNumbers" type="LineNumbers" /> - - <xsd:element name="FoldLine" type="FoldLine" /> - <xsd:element name="FoldMarker" type="FoldMarker" /> - - <xsd:element name="EOLMarkers" type="EOLMarkers" /> - <xsd:element name="SpaceMarkers" type="SpaceMarkers" /> - <xsd:element name="TabMarkers" type="TabMarkers" /> - - </xsd:sequence> - </xsd:complexType> - - <xsd:complexType name="Properties"> - <xsd:sequence> - <xsd:element name="Property" type="Property" minOccurs="0" maxOccurs="unbounded"/> - </xsd:sequence> - </xsd:complexType> - - <xsd:complexType name="Property"> - <!-- The actual KeyWord, typically reserved words or symbols in a programming language --> - <xsd:attribute name="name" type="xsd:string" /> - <xsd:attribute name="value" type="xsd:string" /> - </xsd:complexType> - - <!-- The Digits tag defines the color for rendering Digits--> - <xsd:complexType name="Digits"> - <xsd:attribute name="name" type="xsd:string" /> - <xsd:attribute name="bold" type="xsd:boolean" /> - <xsd:attribute name="italic" type="xsd:boolean" /> - <xsd:attribute name="color" type="xsd:string" /> - <xsd:attribute name="bgcolor" type="xsd:string" /> - </xsd:complexType> - - <!-- Defines the delimiting characters of the syntax, e.g., the characters that, "break up" a line - into separate symbols, typically key words. It is not necessary, or desirable to include the - characters that denot the start or end of a span. Space and Tab are implicitly defined as delimeters - and they don't need to be includeded explicitly (this will probably be changed at some future time).--> - <xsd:complexType name="Delimiters"> - <xsd:simpleContent> - <xsd:extension base="xsd:string"> - </xsd:extension> - </xsd:simpleContent> - </xsd:complexType> - - <!-- The beginning symbol of a Span --> - <xsd:complexType name="Begin"> - <xsd:simpleContent> - <xsd:extension base="xsd:string"> - <!-- The default rendering style for the Begin symbol. If not specified - the defaul rendering style for the span will be used. --> - <xsd:attribute name="bold" type="xsd:boolean" /> - <xsd:attribute name="italic" type="xsd:boolean" /> - <xsd:attribute name="color" type="xsd:string" /> - <xsd:attribute name="bgcolor" type="xsd:string" /> - </xsd:extension> - </xsd:simpleContent> - </xsd:complexType> - - <!-- The end symbol of a Span --> - <xsd:complexType name="End"> - <xsd:simpleContent> - <xsd:extension base="xsd:string"> - <!-- The default rendering style for the End symbol. If not specified - the defaul rendering style for the span will be used. --> - <xsd:attribute name="bold" type="xsd:boolean" /> - <xsd:attribute name="italic" type="xsd:boolean" /> - <xsd:attribute name="color" type="xsd:string" /> - <xsd:attribute name="bgcolor" type="xsd:string" /> - </xsd:extension> - </xsd:simpleContent> - </xsd:complexType> - - <xsd:complexType name="Span"> - <xsd:sequence> - <!-- Defines the symbol that indicates the beginning of the span. --> - <xsd:element name="Begin" type="Begin" /> - <!-- Defines the symbol that indicates the end of the span. May be omitted for - one-line spans. --> - <xsd:element name="End" minOccurs="0" type="End" /> - </xsd:sequence> - <!-- The name of the span definition --> - <xsd:attribute name="name" type="xsd:string" /> - <!-- Defines the rule set that is applicable in the Span. May be omitted. --> - <xsd:attribute name="rule" type="xsd:string" /> - <!-- Defines wether the Span should terminate automatically at the end of line. Typical examples - include one-line comments such as // in C++ or REM in Windows .Bat files. --> - <xsd:attribute name="stopateol" type="xsd:boolean" /> - <!-- Defines whether C-style escape sequences using \ are applicable or not in the span. --> - <xsd:attribute name="noescapesequences" type="xsd:boolean" /> - <!-- The default rendering style for the span --> - <xsd:attribute name="bold" type="xsd:boolean" /> - <xsd:attribute name="italic" type="xsd:boolean" /> - <xsd:attribute name="color" type="xsd:string" /> - <xsd:attribute name="bgcolor" type="xsd:string" /> - </xsd:complexType> - - <xsd:complexType name="MarkPrevious"> - <xsd:simpleContent> - <xsd:extension base="xsd:string"> - <!-- Svante Lidman, looking in the code it is a bit unclear what the intent is here... --> - <xsd:attribute name="markmarker" type="xsd:boolean" /> - <!-- The rendering style to be used --> - <xsd:attribute name="bold" type="xsd:boolean" /> - <xsd:attribute name="italic" type="xsd:boolean" /> - <xsd:attribute name="color" type="xsd:string" /> - <xsd:attribute name="bgcolor" type="xsd:string" /> - </xsd:extension> - </xsd:simpleContent> - </xsd:complexType> - - <!-- Allows you to define the coloring of the symbol that follows a specified symbol --> - <xsd:complexType name="MarkFollowing"> - <xsd:simpleContent> - <xsd:extension base="xsd:string"> - <!-- Svante Lidman, looking in the code it is a bit unclear what the intent is here... --> - <xsd:attribute name="markmarker" type="xsd:boolean" /> - <!-- The rendering style to be used --> - <xsd:attribute name="bold" type="xsd:boolean" /> - <xsd:attribute name="italic" type="xsd:boolean" /> - <xsd:attribute name="color" type="xsd:string" /> - <xsd:attribute name="bgcolor" type="xsd:string" /> - </xsd:extension> - </xsd:simpleContent> - </xsd:complexType> - - <xsd:complexType name="Key"> - <!-- The actual KeyWord, typically reserved words or symbols in a programming language --> - <xsd:attribute name="word" type="xsd:string" /> - </xsd:complexType> - - - <!-- A grouping of keywords that sholuld be colored the same way --> - <xsd:complexType name="KeyWords"> - <xsd:sequence> - <!-- A KeyWord --> - <xsd:element name="Key" type="Key" minOccurs="1" maxOccurs="unbounded"> - </xsd:element> - </xsd:sequence> - <!-- The name of the KeyWord group --> - <xsd:attribute name="name" type="xsd:string" /> - <!-- The rendering style of the KeyWord group --> - <xsd:attribute name="bold" type="xsd:boolean" /> - <xsd:attribute name="italic" type="xsd:boolean" /> - <xsd:attribute name="color" type="xsd:string" /> - <xsd:attribute name="bgcolor" type="xsd:string" /> - </xsd:complexType> - - <xsd:complexType name="RuleSet"> - <xsd:sequence> - <!-- Defines the delimiting characters of the syntax, e.g., the characters that, "break up" a line - into separate symbols, typically key words. It is not necessary, or desirable to include the - characters that denot the start or end of a span. Space and Tab are implicitly defined as delimeters - and they don't need to be includeded explicitly (this will probably be changed at some future time).--> - <xsd:element name="Delimiters" type="Delimiters" minOccurs="0" maxOccurs="1"> - </xsd:element> - <!-- A Span tag defines a scope, or what can be seen as a separate parsing context where a different set of - highlighting rules are applicable compared to the text where the span is found. - Examples of spans include: - - A string in a language as C - - A <script> tag in Html - - The internals of a tag in XML (between < and >). - A span can have a rule set associated with it that defines the highlighting rules that are applicable - in the span. --> - <xsd:element name="Span" type="Span" minOccurs="0" maxOccurs="unbounded"> - </xsd:element> - <!-- The MarkPrevious tag allows you to define the coloring of the item that preceeds a specific - symbol. An example of where this comes in handy is when coloring the contents of an XML-tag, - in particular the attributes and attribute names. The following definition: - <MarkPrevious bold="false" italic="false" color="Red">=</MarkPrevious> - will make teh highlighter color words that are followed by an = to be colored in Red. - You can see this in this file if you view it with the default XML-mode in SharpDevelop. --> - <xsd:element name="MarkPrevious" type="MarkPrevious" minOccurs="0" maxOccurs="unbounded"> - </xsd:element> - <!-- The MarkFollowing tag works similarly as the MarkPrevious tag but relates to the coloring - of the symbol that follows the specified symbol. --> - <xsd:element name="MarkFollowing" type="MarkFollowing" minOccurs="0" maxOccurs="unbounded"> - </xsd:element> - <!-- Defines a group of keywords that should be colored the same way --> - <xsd:element name="KeyWords" type="KeyWords" minOccurs="0" maxOccurs="unbounded"> - </xsd:element> - </xsd:sequence> - <!-- The name of the RuleSet. Used when you refer to the RuleSet in the rule attribute of a Span tag. - Each mode file should have a rule definition without a defined name. This denotes the default rule - set for the mode. --> - <xsd:attribute name="name" type="xsd:string" /> - <!-- Allows you to use another mode, defined in another file as a RuleSet. For an example see the - use of the JavaScript mode from the HTML-mode. --> - <xsd:attribute name="reference" type="xsd:string" /> - <!-- Defines whether case is significant for matching keywords in the mode. --> - <xsd:attribute name="ignorecase" type="xsd:boolean" /> - <!-- Defined whether C-style escape sequences using \ is applicable for the RuleSet or not. --> - <xsd:attribute name="noescapesequences" type="xsd:boolean" /> - </xsd:complexType> - - <!-- The RuleSets tag is just a grouping of the set of RuleSets for a mode. --> - <xsd:complexType name="RuleSets"> - <xsd:sequence minOccurs="0" maxOccurs="unbounded"> - <!-- Any number of RuleSet tag can be defined in a mode --> - <xsd:element name="RuleSet" type="RuleSet" minOccurs="1" maxOccurs="unbounded"> - </xsd:element> - </xsd:sequence> - </xsd:complexType> - - <!-- SyntaxDefinition is the root-element in a mode definition file --> - <xsd:element name="SyntaxDefinition"> - <xsd:complexType> - <xsd:sequence> - <!-- The Environment tag defines colors, for various standard elements in the SharpDevelop GUI --> - <xsd:element name="Environment" type="Environment" /> - - <!-- The Properties section defines properties which are bound to the highlighting --> - <xsd:element name="Properties" type="Properties" minOccurs="0" maxOccurs="1" /> - - <!-- The Digits tag defines the color for rendering Digits--> - <xsd:element name="Digits" type="Digits" /> - - <!-- The RuleSets tag defines the rule sets that are used in the mode. Note that all modes are defined in - a flat structture even if they are used recursively. For an example of a mode that uses - multiple rule sets see the XML-mode. There is a top level rule-set and and another rule-set - that handles highligting within a tag, i.e., between < and >. --> - <xsd:element name="RuleSets" type="RuleSets" /> - </xsd:sequence> - <!-- The name of the mode. This is used when you, in the defintion of a RuleSet refers to another - mode. I.e., one that is defined in an external file. For an example of this see the HTML-Mode that - uses the JavaScript-mode this way. --> - <xsd:attribute name="name" type="xsd:string" /> - <!-- The file extensions that the mode is applicable for. Extensions must be written with lower case and - should include the ., as in .txt. If several extensions are applicable they should be separeated with | --> - <xsd:attribute name="extensions" type="xsd:string" /> - </xsd:complexType> - </xsd:element> - -</xsd:schema> diff --git a/main/Unused/ICSharpCode.TextEditor/data/RightArrow.cur b/main/Unused/ICSharpCode.TextEditor/data/RightArrow.cur Binary files differdeleted file mode 100644 index 5691efbaf8..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/data/RightArrow.cur +++ /dev/null diff --git a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/ASPX.xshd b/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/ASPX.xshd deleted file mode 100644 index 971539cf35..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/ASPX.xshd +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0"?> -<SyntaxDefinition name = "ASP3/XHTML" extensions = ".asp"> - - <Environment> - <Default color = "SystemColors.WindowText" bgcolor = "SystemColors.Window"/> - <Selection color = "SystemColors.HighlightText" bgcolor = "SystemColors.Highlight"/> -<!-- <Selection bgcolor = "LightBlue"/> --> - <VRuler color = "SystemColors.ControlLight"/> - <InvalidLines color = "Red"/> - <CaretMarker color = "Yellow"/> - - <LineNumbers color = "SystemColors.ControlDark" bgcolor = "SystemColors.Window"/> - - <FoldLine color = "#808080" bgcolor="Black"/> - <FoldMarker color = "#808080" bgcolor="White"/> - - <EOLMarkers color = "#E0E0E5"/> - <SpaceMarkers color = "#E0E0E5"/> - <TabMarkers color = "#E0E0E5"/> - </Environment> - - <Digits name = "Digits" bold = "false" italic = "false" color = "Black"/> - - <RuleSets> - <RuleSet ignorecase = "false"> - <Delimiters><> </Delimiters> - <Span name = "ASPCode" rule = "ASP" bold = "false" italic = "false" color = "Green" bgcolor = "#E7E2D3" stopateol = "false"> - <Begin><%</Begin> - <End>%></End> - </Span> - - <Span name= "HTMLCode" rule = "HTML" bold = "false" italic = "false" color = "Blue" stopateol = "false"> - <Begin><</Begin> - <End>></End> - </Span> - - </RuleSet> - - <RuleSet name="ASP" ignorecase = "false"> - <Span name = "COMMENT" bold = "false" italic = "true" color = "SlateGray" stopateol = "true"> - <Begin>'</Begin> - </Span> - </RuleSet> - - <RuleSet name="HTML" ignorecase = "false" reference="HTML"> - </RuleSet> - </RuleSets> -</SyntaxDefinition> diff --git a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/BAT-Mode.xshd b/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/BAT-Mode.xshd deleted file mode 100644 index 049b3123d5..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/BAT-Mode.xshd +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0"?> - -<!-- syntaxdefinition for BAT 2000 by Mike Krueger --> -<SyntaxDefinition name = "BAT" extensions = ".bat"> - - <Environment> - <Default color = "Yellow" bgcolor = "Black"/> - <Selection color = "White" bgcolor = "Purple"/> - <VRuler color = "Green"/> - <InvalidLines color = "Red"/> - <CaretMarker color = "Yellow"/> - - <LineNumbers color = "Gray" bgcolor = "Black"/> - - <FoldLine color = "#808080" bgcolor = "Black"/> - <FoldMarker color = "#808080" bgcolor = "White"/> - - <EOLMarkers color = "#E0E0E5"/> - <SpaceMarkers color = "#E0E0E5"/> - <TabMarkers color = "#E0E0E5"/> - </Environment> - - <Digits name = "Digits" bold = "false" italic = "false" color = "Yellow"/> - - <RuleSets> - <RuleSet ignorecase = "false"> - <Delimiters> </Delimiters> - </RuleSet> - </RuleSets> - -</SyntaxDefinition> diff --git a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/CPP-Mode.xshd b/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/CPP-Mode.xshd deleted file mode 100644 index a2edc35c74..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/CPP-Mode.xshd +++ /dev/null @@ -1,140 +0,0 @@ -<?xml version="1.0"?> -<!-- syntaxdefinition for C/C++ 2001 by Andrea Paatz and Mike Krueger --> - -<SyntaxDefinition name = "C++" extensions = ".c;.h;.cc;.C;.cpp;.hpp"> - - <Environment> - <Default color = "SystemColors.WindowText" bgcolor = "SystemColors.Window"/> - <Selection color = "SystemColors.HighlightText" bgcolor = "SystemColors.Highlight"/> -<!-- <Selection bgcolor = "LightBlue"/> --> - <VRuler color = "SystemColors.ControlLight"/> - <InvalidLines color = "Red"/> - <CaretMarker color = "Yellow"/> - - <LineNumbers color = "SystemColors.ControlDark" bgcolor = "SystemColors.Window"/> - - <FoldLine color = "#808080" bgcolor="Black"/> - <FoldMarker color = "#808080" bgcolor="White"/> - - <EOLMarkers color = "#E0E0E5"/> - <SpaceMarkers color = "#E0E0E5"/> - <TabMarkers color = "#E0E0E5"/> - </Environment> - - <Properties> - <Property name="LineComment" value="//"/> - </Properties> - - <Digits name = "Digits" bold = "false" italic = "false" color = "Black"/> - - <RuleSets> - <RuleSet ignorecase = "false"> - <Delimiters>~!%^*()-+=|\#/{}[]:;"'<> , .?</Delimiters> - - <Span name = "LINECOMMENT" bold = "false" italic = "false" color = "SlateGray" stopateol = "true"> - <Begin>//</Begin> - </Span> - - <Span name = "BLOCKCOMMENT" bold = "false" italic = "false" color = "SlateGray" stopateol = "false"> - <Begin>/*</Begin> - <End>*/</End> - </Span> - - <Span name = "STRING" bold = "false" italic = "false" color = "Black" stopateol = "true"> - <Begin>"</Begin> - <End>"</End> - </Span> - - <Span name = "CHAR" bold = "false" italic = "false" color = "Black" stopateol = "true"> - <Begin>'</Begin> - <End>'</End> - </Span> - - <KeyWords name = "PreProcessor" bold="false" italic="false" color="Blue"> - <Key word = "#define" /> - <Key word = "#if" /> - <Key word = "#elif" /> - <Key word = "#else" /> - <Key word = "#endif" /> - <Key word = "#ifdef" /> - </KeyWords> - - <KeyWords name = "KEYWORD1" bold="true" italic="false" color="Blue"> - <Key word = "and" /> - <Key word = "and_eq" /> - <Key word = "asm" /> - <Key word = "auto" /> - <Key word = "bitand" /> - <Key word = "bitor" /> - <Key word = "bool" /> - <Key word = "break" /> - <Key word = "case" /> - <Key word = "catch" /> - <Key word = "char" /> - <Key word = "class" /> - <Key word = "compl" /> - <Key word = "const" /> - <Key word = "const_cast" /> - <Key word = "continue" /> - <Key word = "default" /> - <Key word = "delete" /> - <Key word = "do" /> - <Key word = "double" /> - <Key word = "dynamic_cast" /> - <Key word = "else" /> - <Key word = "enum" /> - <Key word = "explicit" /> - <Key word = "export" /> - <Key word = "extern" /> - <Key word = "false" /> - <Key word = "float" /> - <Key word = "for" /> - <Key word = "friend" /> - <Key word = "goto" /> - <Key word = "if" /> - <Key word = "inline" /> - <Key word = "int" /> - <Key word = "long" /> - <Key word = "mutable" /> - <Key word = "namespace" /> - <Key word = "new" /> - <Key word = "not" /> - <Key word = "not_eq" /> - <Key word = "operator" /> - <Key word = "or" /> - <Key word = "or_eq" /> - <Key word = "private" /> - <Key word = "protected" /> - <Key word = "public" /> - <Key word = "register" /> - <Key word = "reinterpret_cast" /> - <Key word = "return" /> - <Key word = "short" /> - <Key word = "signed" /> - <Key word = "sizeof" /> - <Key word = "static" /> - <Key word = "static_cast" /> - <Key word = "struct" /> - <Key word = "switch" /> - <Key word = "template" /> - <Key word = "this" /> - <Key word = "throw" /> - <Key word = "true" /> - <Key word = "try" /> - <Key word = "typedef" /> - <Key word = "typeid" /> - <Key word = "typename" /> - <Key word = "union" /> - <Key word = "unsigned" /> - <Key word = "using" /> - <Key word = "virtual" /> - <Key word = "void" /> - <Key word = "volatile" /> - <Key word = "while" /> - <Key word = "xor" /> - <Key word = "xor_eq" /> - </KeyWords> - </RuleSet> - </RuleSets> -</SyntaxDefinition> - diff --git a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/CSharp-Mode.xshd b/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/CSharp-Mode.xshd deleted file mode 100644 index 1f7555e069..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/CSharp-Mode.xshd +++ /dev/null @@ -1,320 +0,0 @@ -<?xml version="1.0"?> -<!-- syntaxdefinition for C# 2000 by Mike Krueger --> - -<SyntaxDefinition name = "C#" extensions = ".cs"> - - <Environment> - <Default color = "SystemColors.WindowText" bgcolor = "SystemColors.Window"/> - <Selection color = "SystemColors.HighlightText" bgcolor = "SystemColors.Highlight"/> -<!-- <Selection bgcolor = "LightBlue"/> --> - <VRuler color = "SystemColors.ControlLight"/> - <InvalidLines color = "Red"/> - <CaretMarker color = "Yellow"/> - - <LineNumbers color = "SystemColors.ControlDark" bgcolor = "SystemColors.Window"/> - - <FoldLine color = "#808080" bgcolor="Black"/> - <FoldMarker color = "#808080" bgcolor="White"/> - - <EOLMarkers color = "#E0E0E5"/> - <SpaceMarkers color = "#E0E0E5"/> - <TabMarkers color = "#E0E0E5"/> - </Environment> - - <Properties> - <Property name="LineComment" value="//"/> - </Properties> - - <Digits name = "Digits" bold = "false" italic = "false" color = "DarkBlue"/> - - <RuleSets> - <RuleSet ignorecase="false"> - <Delimiters>&<>~!@%^*()-+=|\#/{}[]:;"' , .?</Delimiters> - <Span name = "PreprocessorDirectives" bold="false" italic="false" color="Green" stopateol = "true"> - <Begin>#</Begin> - </Span> - - <Span name = "DocLineComment" rule = "DocCommentSet" bold = "false" italic = "true" color = "Green" stopateol = "true"> - <Begin bold = "false" italic = "true" color = "Gray">///</Begin> - </Span> - - <Span name = "LineComment" rule = "CommentMarkerSet" bold = "false" italic = "true" color = "Green" stopateol = "true"> - <Begin>//@!/@</Begin> - </Span> - - <Span name = "BlockComment" rule = "CommentMarkerSet" bold = "false" italic = "true" color = "Green" stopateol = "false"> - <Begin>/*</Begin> - <End>*/</End> - </Span> - - <Span name = "String" bold = "false" italic = "false" color = "Magenta" stopateol = "true"> - <Begin>"</Begin> - <End>"</End> - </Span> - - <Span name = "MultiLineString" bold = "false" italic = "false" color = "Magenta" stopateol = "false" noescapesequences="true"> - <Begin>@@"</Begin> - <End>"</End> - </Span> - - <Span name = "Char" bold = "false" italic = "false" color = "Magenta" stopateol = "true"> - <Begin>'</Begin> - <End>'</End> - </Span> - - <MarkPrevious bold = "true" italic = "false" color = "MidnightBlue">(</MarkPrevious> - - <KeyWords name = "Punctuation" bold = "false" italic = "false" color = "DarkGreen"> - <Key word = "?" /> - <Key word = "," /> - <Key word = "." /> - <Key word = ";" /> - <Key word = "(" /> - <Key word = ")" /> - <Key word = "[" /> - <Key word = "]" /> - <Key word = "{" /> - <Key word = "}" /> - <Key word = "+" /> - <Key word = "-" /> - <Key word = "/" /> - <Key word = "%" /> - <Key word = "*" /> - <Key word = "<" /> - <Key word = ">" /> - <Key word = "^" /> - <Key word = "=" /> - <Key word = "~" /> - <Key word = "!" /> - <Key word = "|" /> - <Key word = "&" /> - </KeyWords> - - <KeyWords name = "AccessKeywords" bold="true" italic="false" color="Blue"> - <Key word = "this" /> - <Key word = "base" /> - </KeyWords> - - <KeyWords name = "OperatorKeywords" bold="true" italic="false" color="DarkCyan"> - <Key word = "as" /> - <Key word = "is" /> - <Key word = "new" /> - <Key word = "sizeof" /> - <Key word = "typeof" /> - <Key word = "true" /> - <Key word = "false" /> - <Key word = "stackalloc" /> - </KeyWords> - - - <KeyWords name = "SelectionStatements" bold="true" italic="false" color="Blue"> - <Key word = "else" /> - <Key word = "if" /> - <Key word = "switch" /> - <Key word = "case" /> - </KeyWords> - - <KeyWords name = "IterationStatements" bold="true" italic="false" color="Blue"> - <Key word = "do" /> - <Key word = "for" /> - <Key word = "foreach" /> - <Key word = "in" /> - <Key word = "while" /> - </KeyWords> - - <KeyWords name = "JumpStatements" bold="false" italic="false" color="Navy"> - <Key word = "break" /> - <Key word = "continue" /> - <Key word = "default" /> - <Key word = "goto" /> - <Key word = "return" /> - </KeyWords> - - <KeyWords name = "ExceptionHandlingStatements" bold="true" italic="false" color="Teal"> - <Key word = "try" /> - <Key word = "throw" /> - <Key word = "catch" /> - <Key word = "finally" /> - </KeyWords> - - <KeyWords name = "CheckedUncheckedStatements" bold="true" italic="false" color="DarkGray"> - <Key word = "checked" /> - <Key word = "unchecked" /> - </KeyWords> - - <KeyWords name = "UnsafeFixedStatements" bold="false" italic="false" color="Olive"> - <Key word = "fixed" /> - <Key word = "unsafe" /> - </KeyWords> - - <KeyWords name = "PreprocessorDirectives" bold="false" italic="false" color="Green"> - <Key word = "#if" /> - <Key word = "#else" /> - <Key word = "#elif" /> - <Key word = "#endif" /> - <Key word = "#define" /> - <Key word = "#undef" /> - <Key word = "#warning" /> - <Key word = "#error" /> - <Key word = "#line" /> - <Key word = "#region" /> - <Key word = "#endregion" /> - </KeyWords> - - <KeyWords name = "ValueTypes" bold="true" italic="false" color="Red"> - <Key word = "bool" /> - <Key word = "byte" /> - <Key word = "char" /> - <Key word = "decimal" /> - <Key word = "double" /> - <Key word = "enum" /> - <Key word = "float" /> - <Key word = "int" /> - <Key word = "long" /> - <Key word = "sbyte" /> - <Key word = "short" /> - <Key word = "struct" /> - <Key word = "uint" /> - <Key word = "ushort" /> - <Key word = "ulong" /> - </KeyWords> - - <KeyWords name = "ReferenceTypes" bold="false" italic="false" color="Red"> - <Key word = "class" /> - <Key word = "interface" /> - <Key word = "delegate" /> - <Key word = "object" /> - <Key word = "string" /> - </KeyWords> - - <KeyWords name = "Void" bold="false" italic="false" color="Red"> - <Key word = "void" /> - </KeyWords> - - <KeyWords name = "ConversionKeyWords" bold="true" italic="false" color="Pink"> - <Key word = "explicit" /> - <Key word = "implicit" /> - <Key word = "operator" /> - </KeyWords> - - <KeyWords name = "MethodParameters" bold="true" italic="false" color="DeepPink"> - <Key word = "params" /> - <Key word = "ref" /> - <Key word = "out" /> - </KeyWords> - - <KeyWords name = "Modifiers" bold="false" italic="false" color="Brown"> - <Key word = "abstract" /> - <Key word = "const" /> - <Key word = "event" /> - <Key word = "extern" /> - <Key word = "override" /> - <Key word = "readonly" /> - <Key word = "sealed" /> - <Key word = "static" /> - <Key word = "virtual" /> - </KeyWords> - - <KeyWords name = "AccessModifiers" bold="true" italic="false" color="Blue"> - <Key word = "public" /> - <Key word = "protected" /> - <Key word = "private" /> - <Key word = "internal" /> - </KeyWords> - - <KeyWords name = "NameSpaces" bold="true" italic="false" color="Green"> - <Key word = "namespace" /> - <Key word = "using" /> - </KeyWords> - - <KeyWords name = "LockKeyWord" bold="false" italic="false" color="DarkViolet"> - <Key word = "lock" /> - </KeyWords> - - <KeyWords name = "GetSet" bold="false" italic="false" color="SaddleBrown"> - <Key word = "get" /> - <Key word = "set" /> - <Key word = "add" /> - <Key word = "remove" /> - </KeyWords> - - <KeyWords name = "Literals" bold="true" italic="false" color="Blue"> - <Key word = "null" /> - <Key word = "value" /> - </KeyWords> - </RuleSet> - - <RuleSet name = "CommentMarkerSet" ignorecase = "true"> - <Delimiters><>~!@%^*()-+=|\#/{}[]:;"' , .?</Delimiters> - <KeyWords name = "ErrorWords" bold="true" italic="true" color="Red"> - <Key word = "TODO" /> - <Key word = "FIXME" /> - </KeyWords> - <KeyWords name = "WarningWords" bold="true" italic="true" color="#EEE0E000"> - <Key word = "HACK" /> - <Key word = "UNDONE" /> - </KeyWords> - </RuleSet> - - <RuleSet name = "DocCommentSet" ignorecase = "false"> - <Delimiters><>~!@%^*()-+=|\#/{}[]:;"' , .?</Delimiters> - - <Span name = "XmlTag" rule = "XmlDocSet" bold = "false" italic = "true" color = "Gray" stopateol = "true"> - <Begin><</Begin> - <End>></End> - </Span> - - <KeyWords name = "ErrorWords" bold="true" italic="true" color="Red"> - <Key word = "TODO" /> - <Key word = "FIXME" /> - </KeyWords> - - <KeyWords name = "WarningWords" bold="true" italic="true" color="#EEE0E000"> - <Key word = "HACK" /> - <Key word = "UNDONE" /> - </KeyWords> - </RuleSet> - - <RuleSet name = "XmlDocSet" ignorecase = "false"> - <Delimiters><>~!@%^*()-+=|\#/{}[]:;"' , .?</Delimiters> - - <Span name = "String" bold = "true" italic = "true" color = "Silver" stopateol = "true"> - <Begin>"</Begin> - <End>"</End> - </Span> - - - <KeyWords name = "Punctuation" bold = "true" italic = "true" color = "Gray"> - <Key word = "/" /> - <Key word = "|" /> - <Key word = "=" /> - </KeyWords> - - <KeyWords name = "SpecialComment" bold="true" italic="true" color="Gray"> - <Key word = "c" /> - <Key word = "code" /> - <Key word = "example" /> - <Key word = "exception" /> - <Key word = "list" /> - <Key word = "para" /> - <Key word = "param" /> - <Key word = "paramref" /> - <Key word = "permission" /> - <Key word = "remarks" /> - <Key word = "returns" /> - <Key word = "see" /> - <Key word = "seealso" /> - <Key word = "summary" /> - <Key word = "value" /> - - <Key word = "type" /> - <Key word = "name" /> - <Key word = "cref" /> - <Key word = "item" /> - <Key word = "term" /> - <Key word = "description" /> - <Key word = "listheader" /> - </KeyWords> - </RuleSet> - </RuleSets> -</SyntaxDefinition> diff --git a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/Coco-Mode.xshd b/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/Coco-Mode.xshd deleted file mode 100644 index a91011bd00..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/Coco-Mode.xshd +++ /dev/null @@ -1,115 +0,0 @@ -<?xml version="1.0" ?> -<!-- syntaxdefinition for Coco/R 2003 by Mike Krueger --> -<SyntaxDefinition name="Coco" extensions=".atg"> - - <Environment> - <Default color = "SystemColors.WindowText" bgcolor = "SystemColors.Window"/> - <Selection color = "SystemColors.HighlightText" bgcolor = "SystemColors.Highlight"/> -<!-- <Selection bgcolor = "LightBlue"/> --> - <VRuler color = "SystemColors.ControlLight"/> - <InvalidLines color = "Red"/> - <CaretMarker color = "Yellow"/> - - <LineNumbers color = "SystemColors.ControlDark" bgcolor = "SystemColors.Window"/> - - <FoldLine color = "#808080" bgcolor="Black"/> - <FoldMarker color = "#808080" bgcolor="White"/> - - <EOLMarkers color = "#E0E0E5"/> - <SpaceMarkers color = "#E0E0E5"/> - <TabMarkers color = "#E0E0E5"/> - </Environment> - - <Digits name="Digits" bold="false" italic="false" color="DarkBlue" /> - - <RuleSets> - <RuleSet ignorecase="false" noescapesequences="true"> - <Delimiters>&<>~!@%^*()-+=|\#/{}[]:;"' , .?</Delimiters> - - <Span name = "LINECOMMENT" bold = "false" italic = "true" color = "Gray" stopateol = "true"> - <Begin>//</Begin> - </Span> - - <Span name = "BLOCKCOMMENT" bold = "false" italic = "true" color = "Gray" stopateol = "false"> - <Begin>/*</Begin> - <End>*/</End> - </Span> - - - <Span name="CSharpCode2" rule="CSharp" bold="false" italic="false" color="Black" stopateol="false"> - <Begin bold = "true" color = "Blue">COMPILER</Begin> - <End bold = "true" color = "Blue">TOKENNAMES</End> - </Span> - - <Span name = "STRING" bold = "false" italic = "false" color = "DarkGreen" stopateol = "true"> - <Begin>"</Begin> - <End>"</End> - </Span> - - <Span name = "CHAR" bold = "false" italic = "false" color = "DarkGreen" stopateol = "true"> - <Begin>'</Begin> - <End>'</End> - </Span> - - <Span name = "paramlist" rule="ParamList" bold = "false" italic = "false" color = "Black" stopateol = "true"> - <Begin bold="true" color = "Black" ><</Begin> - <End bold="true" color = "Black" >></End> - </Span> - - <Span name="CSharpCode" rule="CSharp" bold="false" italic="false" color="DarkSlateGray" stopateol="false"> - <Begin bold = "true" italic="true" color = "Green">(.</Begin> - <End bold = "true" italic="true" color = "Green">.)</End> - </Span> - - - <KeyWords name = "Punctuation" bold = "true" italic = "false" color = "Black"> - <Key word = "{"/> - <Key word = "}"/> - <Key word = "("/> - <Key word = ")"/> - <Key word = "["/> - <Key word = "]"/> - <Key word = "|"/> - <Key word = "+"/> - <Key word = "-"/> - <Key word = "="/> - <Key word = "."/> - </KeyWords> - - <KeyWords name = "KeyWords" bold = "true" italic = "false" color = "Blue"> - <Key word = "ANY"/> - <Key word = "CHARACTERS"/> - <Key word = "COMMENTS"/> - <Key word = "COMPILER"/> - <Key word = "CONTEXT"/> - <Key word = "END"/> - <Key word = "FROM"/> - <Key word = "IF"/> - <Key word = "IGNORE"/> - <Key word = "NAMESPACE"/> - <Key word = "NESTED"/> - <Key word = "PRAGMAS"/> - <Key word = "PRODUCTIONS"/> - <Key word = "SYNC"/> - <Key word = "TO"/> - <Key word = "TOKENS"/> - <Key word = "TOKENNAMES"/> - <Key word = "WEAK"/> - <Key word = "using"/> - </KeyWords> - - </RuleSet> - - <RuleSet name="CSharp" reference = "C#" ignorecase="false" noescapesequences="true"> - </RuleSet> - - <RuleSet name="ParamList" reference = "C#" ignorecase="false" noescapesequences="true"> - </RuleSet> - - <RuleSet name="RuleDefinition" ignorecase="false" noescapesequences="true"> - - </RuleSet> - - </RuleSets> -</SyntaxDefinition> - diff --git a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/HTML-Mode.xshd b/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/HTML-Mode.xshd deleted file mode 100644 index fb24dc2dff..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/HTML-Mode.xshd +++ /dev/null @@ -1,403 +0,0 @@ -<?xml version="1.0"?> - -<!-- syntaxdefinition for HTML 2000 by Mike Krueger --> - -<SyntaxDefinition name = "HTML" extensions = ".htm;.html"> - - <Environment> - <Default color = "SystemColors.WindowText" bgcolor = "SystemColors.Window"/> - <Selection color = "SystemColors.HighlightText" bgcolor = "SystemColors.Highlight"/> -<!-- <Selection bgcolor = "LightBlue"/> --> - <VRuler color = "SystemColors.ControlLight"/> - <InvalidLines color = "Red"/> - <CaretMarker color = "Yellow"/> - - <LineNumbers color = "SystemColors.ControlDark" bgcolor = "SystemColors.Window"/> - - <FoldLine color = "#808080" bgcolor="Black"/> - <FoldMarker color = "#808080" bgcolor="White"/> - - <EOLMarkers color = "#E0E0E5"/> - <SpaceMarkers color = "#E0E0E5"/> - <TabMarkers color = "#E0E0E5"/> - </Environment> - - <Digits name = "Digits" bold = "false" italic = "false" color = "DarkBlue"/> - - <RuleSets> - <RuleSet ignorecase = "true" noescapesequences="true"> - <!-- It is not necessary to define span-delimiting characters as delimiters --> - <Delimiters></Delimiters> - - <Span name="Comment" bold="false" italic="false" color="DarkSlateGray" stopateol="false"> - <Begin><!--</Begin> - <End>--></End> - </Span> - <Span name="ScriptTag" rule="JavaScriptSet" bold="false" italic="false" color="SpringGreen" stopateol="false"> - <Begin><script></Begin> - <End></script></End> - </Span> - <Span name="JavaScriptTag" rule="JavaScriptSet" bold="false" italic="false" color="SpringGreen" stopateol="false"> - <Begin><script lang="JavaScript"></Begin> - <End></script></End> - </Span> - <Span name="JScriptTag" bold="false" italic="false" color="SpringGreen" stopateol="false"> - <Begin><script lang="JScript"></Begin> - <End></script></End> - </Span> - <Span name="VBScriptTag" bold="false" italic="false" color="SpringGreen" stopateol="false"> - <Begin><script lang="VBScript"></Begin> - <End></script></End> - </Span> - <Span name="UnknownScriptTag" bold="false" italic="false" color="SpringGreen" stopateol="false"> - <Begin><script</Begin> - <End></script></End> - </Span> - <Span name="HtmlTag" rule="HtmlTagSet" bold="false" italic="false" color="DarkMagenta" stopateol="false"> - <Begin><</Begin> - <End>></End> - </Span> - - <Span name="EntityReference" rule="EntityReferenceSet" bold="false" italic="false" color="Blue" stopateol="true"> - <Begin>&</Begin> - <End>;</End> - </Span> - - </RuleSet> - - <RuleSet name="JavaScriptSet" reference="JavaScript" /> - - <RuleSet name="EntityReferenceSet" ignorecase="false" noescapesequences="true"> - <KeyWords name = "Entities" bold="false" italic="false" color="Green"> - <Key word = "aacute" /> - <Key word = "agrave" /> - <Key word = "acirc" /> - <Key word = "amp" /> - <Key word = "atilde" /> - <Key word = "aring" /> - <Key word = "auml" /> - <Key word = "aelig" /> - <Key word = "ccedil" /> - <Key word = "copy" /> - <Key word = "eacute" /> - <Key word = "egrave" /> - <Key word = "ecirc" /> - <Key word = "euml" /> - <Key word = "iacute" /> - <Key word = "igrave" /> - <Key word = "icirc" /> - <Key word = "iuml" /> - <Key word = "eth" /> - <Key word = "gt" /> - <Key word = "lt" /> - <Key word = "nbsp" /> - <Key word = "ntilde" /> - <Key word = "oacute" /> - <Key word = "ograve" /> - <Key word = "ocirc" /> - <Key word = "otilde" /> - <Key word = "ouml" /> - <Key word = "oslash" /> - <Key word = "quot" /> - <Key word = "reg" /> - <Key word = "szlig" /> - <Key word = "uacute" /> - <Key word = "ugrave" /> - <Key word = "ucirc" /> - <Key word = "uuml" /> - <Key word = "yacute" /> - <Key word = "thorn" /> - <Key word = "trade" /> - <Key word = "yuml" /> - </KeyWords> - </RuleSet> - - <RuleSet name="HtmlTagSet" ignorecase="false" noescapesequences="true"> - <Delimiters>/=</Delimiters> - - <Span name="String" bold="false" italic="false" color="Blue" stopateol="true"> - <Begin>"</Begin> - <End>"</End> - </Span> - - <Span name="Char" bold="false" italic="false" color="Blue" stopateol="true"> - <Begin>'</Begin> - <End>'</End> - </Span> - - <MarkPrevious bold="false" italic="false" color="Red">=</MarkPrevious> - - <KeyWords name="Slash" bold="false" italic="false" color="DarkMagenta"> - <Key word="/" /> - </KeyWords> - - <KeyWords name="Assignment" bold="false" italic="false" color="Blue"> - <Key word="=" /> - </KeyWords> - - <KeyWords name = "Tags" bold="false" italic="false" color="DarkMagenta"> - <Key word = "!DOCTYPE" /> - <Key word = "A" /> - <Key word = "ABBR" /> - <Key word = "ACRONYM" /> - <Key word = "ADDRESS" /> - <Key word = "APPLET" /> - <Key word = "AREA" /> - <Key word = "B" /> - <Key word = "BASE" /> - <Key word = "BASEFONT" /> - <Key word = "BGSOUND" /> - <Key word = "BDO" /> - <Key word = "BIG" /> - <Key word = "BLINK" /> - <Key word = "BLOCKQUOTE" /> - <Key word = "BODY" /> - <Key word = "BR" /> - <Key word = "BUTTON" /> - <Key word = "CAPTION" /> - <Key word = "CENTER" /> - <Key word = "CITE" /> - <Key word = "CODE" /> - <Key word = "COL" /> - <Key word = "COLGROUP" /> - <Key word = "COMMENT" /> - <Key word = "DD" /> - <Key word = "DEL" /> - <Key word = "DFN" /> - <Key word = "DIR" /> - <Key word = "DIV" /> - <Key word = "DL" /> - <Key word = "DT" /> - <Key word = "EM" /> - <Key word = "EMBED" /> - <Key word = "FIELDSET" /> - <Key word = "FONT" /> - <Key word = "FORM" /> - <Key word = "FRAME" /> - <Key word = "FRAMESET" /> - <Key word = "H" /> - <Key word = "H1" /> - <Key word = "H2" /> - <Key word = "H3" /> - <Key word = "H4" /> - <Key word = "H5" /> - <Key word = "H6" /> - <Key word = "HEAD" /> - <Key word = "HR" /> - <Key word = "HTA:APPLICATION" /> - <Key word = "HTML" /> - <Key word = "I" /> - <Key word = "IFRAME" /> - <Key word = "IMG" /> - <Key word = "INPUT" /> - <Key word = "INS" /> - <Key word = "ISINDEX" /> - <Key word = "KBD" /> - <Key word = "LABEL" /> - <Key word = "LEGEnd" /> - <Key word = "LI" /> - <Key word = "LINK" /> - <Key word = "LISTING" /> - <Key word = "MAP" /> - <Key word = "MARQUEE" /> - <Key word = "MENU" /> - <Key word = "META" /> - <Key word = "MULTICOL" /> - <Key word = "NEXTID" /> - <Key word = "NOBR" /> - <Key word = "NOFRAMES" /> - <Key word = "NOSCRIPT" /> - <Key word = "OBJECT" /> - <Key word = "OL" /> - <Key word = "OPTGROUP" /> - <Key word = "OPTION" /> - <Key word = "P" /> - <Key word = "PARAM" /> - <Key word = "PLAINTEXT" /> - <Key word = "PRE" /> - <Key word = "Q" /> - <Key word = "S" /> - <Key word = "SAMP" /> - <Key word = "SCRIPT" /> - <Key word = "SELECT" /> - <Key word = "SERVER" /> - <Key word = "SMALL" /> - <Key word = "SOUND" /> - <Key word = "SPACER" /> - <Key word = "Span" /> - <Key word = "STRONG" /> - <Key word = "STYLE" /> - <Key word = "SUB" /> - <Key word = "SUP" /> - <Key word = "TABLE" /> - <Key word = "TBODY" /> - <Key word = "TD" /> - <Key word = "TEXTAREA" /> - <Key word = "TEXTFLOW" /> - <Key word = "TFOOT" /> - <Key word = "TH" /> - <Key word = "THEAD" /> - <Key word = "TITLE" /> - <Key word = "TR" /> - <Key word = "TT" /> - <Key word = "U" /> - <Key word = "VAR" /> - <Key word = "WBR" /> - <Key word = "XMP" /> - </KeyWords> - - <KeyWords name = "Attributes" bold="false" italic="false" color="Red"> - <Key word = "abbr" /> - <Key word = "accept-charset" /> - <Key word = "accept" /> - <Key word = "accesskey" /> - <Key word = "action" /> - <Key word = "align" /> - <Key word = "alink" /> - <Key word = "alt" /> - <Key word = "applicationname" /> - <Key word = "archive" /> - <Key word = "axis" /> - <Key word = "background" /> - <Key word = "behavior" /> - <Key word = "bgcolor" /> - <Key word = "bgproperties" /> - <Key word = "border" /> - <Key word = "bordercolor" /> - <Key word = "bordercolordark" /> - <Key word = "bordercolorligh" /> - <Key word = "borderstyle" /> - <Key word = "caption" /> - <Key word = "cellpadding" /> - <Key word = "cellspacing" /> - <Key word = "char" /> - <Key word = "charoff" /> - <Key word = "charset" /> - <Key word = "checked" /> - <Key word = "cite" /> - <Key word = "class" /> - <Key word = "classid" /> - <Key word = "clear" /> - <Key word = "code" /> - <Key word = "codetype" /> - <Key word = "color" /> - <Key word = "cols" /> - <Key word = "colspan" /> - <Key word = "compact" /> - <Key word = "content" /> - <Key word = "coords" /> - <Key word = "data" /> - <Key word = "datetime" /> - <Key word = "declare" /> - <Key word = "defer" /> - <Key word = "dir" /> - <Key word = "direction" /> - <Key word = "disabled" /> - <Key word = "dynsrc" /> - <Key word = "enctype" /> - <Key word = "face" /> - <Key word = "for" /> - <Key word = "frame" /> - <Key word = "frameborder" /> - <Key word = "framespacing" /> - <Key word = "gutter" /> - <Key word = "headers" /> - <Key word = "height" /> - <Key word = "href" /> - <Key word = "hreflang" /> - <Key word = "hspace" /> - <Key word = "http-equiv" /> - <Key word = "icon" /> - <Key word = "id" /> - <Key word = "ismap" /> - <Key word = "label" /> - <Key word = "language" /> - <Key word = "leftmargin" /> - <Key word = "link" /> - <Key word = "longdesc" /> - <Key word = "loop" /> - <Key word = "lowsrc" /> - <Key word = "marginheight" /> - <Key word = "marginwidth" /> - <Key word = "maximizebutton" /> - <Key word = "maxlength" /> - <Key word = "media" /> - <Key word = "method" /> - <Key word = "methods" /> - <Key word = "minimizebutton" /> - <Key word = "multiple" /> - <Key word = "name" /> - <Key word = "nohref" /> - <Key word = "noresize" /> - <Key word = "noshade" /> - <Key word = "nowrap" /> - <Key word = "object" /> - <Key word = "onabort" /> - <Key word = "onblur" /> - <Key word = "onchange" /> - <Key word = "onclick" /> - <Key word = "ondblclick" /> - <Key word = "onerror" /> - <Key word = "onfocus" /> - <Key word = "onkeydown" /> - <Key word = "onkeypress" /> - <Key word = "onkeyup" /> - <Key word = "onload" /> - <Key word = "onmousedown" /> - <Key word = "onmousemove" /> - <Key word = "onmouseout" /> - <Key word = "onmouseover" /> - <Key word = "onmouseup" /> - <Key word = "onreset" /> - <Key word = "onselect" /> - <Key word = "onsubmit" /> - <Key word = "onunload" /> - <Key word = "profile" /> - <Key word = "prompt" /> - <Key word = "readonly" /> - <Key word = "rel" /> - <Key word = "rev" /> - <Key word = "rows" /> - <Key word = "rowspan" /> - <Key word = "rules" /> - <Key word = "runat" /> - <Key word = "scheme" /> - <Key word = "scope" /> - <Key word = "scrollamount" /> - <Key word = "scrolldelay" /> - <Key word = "scrolling" /> - <Key word = "selected" /> - <Key word = "shape" /> - <Key word = "showintaskbar" /> - <Key word = "singleinstance" /> - <Key word = "size" /> - <Key word = "span" /> - <Key word = "src" /> - <Key word = "standby" /> - <Key word = "start" /> - <Key word = "style" /> - <Key word = "summary" /> - <Key word = "sysmenu" /> - <Key word = "tabindex" /> - <Key word = "target" /> - <Key word = "text" /> - <Key word = "title" /> - <Key word = "topmargin" /> - <Key word = "type" /> - <Key word = "urn" /> - <Key word = "usemap" /> - <Key word = "valign" /> - <Key word = "value" /> - <Key word = "valuetype" /> - <Key word = "version" /> - <Key word = "vlink" /> - <Key word = "vrml" /> - <Key word = "vspace" /> - <Key word = "width" /> - <Key word = "windowstate" /> - <Key word = "wrap" /> - </KeyWords> - </RuleSet> - - </RuleSets> -</SyntaxDefinition> diff --git a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/Java-Mode.xshd b/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/Java-Mode.xshd deleted file mode 100644 index 85f1c3e444..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/Java-Mode.xshd +++ /dev/null @@ -1,198 +0,0 @@ -<?xml version="1.0"?> - -<!-- syntaxdefinition for Java 2001 by Jonathan Pierce & Mike Krueger --> - -<SyntaxDefinition name = "Java" extensions = ".java"> - - <Environment> - <Default color = "SystemColors.WindowText" bgcolor = "SystemColors.Window"/> - <Selection color = "SystemColors.HighlightText" bgcolor = "SystemColors.Highlight"/> -<!-- <Selection bgcolor = "LightBlue"/> --> - <VRuler color = "SystemColors.ControlLight"/> - <InvalidLines color = "Red"/> - <CaretMarker color = "Yellow"/> - - <LineNumbers color = "SystemColors.ControlDark" bgcolor = "SystemColors.Window"/> - - <FoldLine color = "#808080" bgcolor="Black"/> - <FoldMarker color = "#808080" bgcolor="White"/> - - <EOLMarkers color = "#E0E0E5"/> - <SpaceMarkers color = "#E0E0E5"/> - <TabMarkers color = "#E0E0E5"/> - </Environment> - - <Properties> - <Property name="LineComment" value="//"/> - </Properties> - - <Digits name = "Digits" bold = "false" italic = "false" color = "DarkBlue"/> - - <RuleSets> - <RuleSet ignorecase = "false"> - <Delimiters>~!%^*()-+=|\#/{}[]:;"'<> , .?</Delimiters> - - <Span name = "LINECOMMENT" rule = "TestSet" bold = "false" italic = "true" color = "SlateGray" stopateol = "true"> - <Begin>//</Begin> - </Span> - - <Span name = "BLOCKCOMMENT" rule = "TestSet" bold = "false" italic = "true" color = "SlateGray" stopateol = "false"> - <Begin>/*</Begin> - <End>*/</End> - </Span> - - <Span name = "STRING" bold = "false" italic = "false" color = "Magenta" stopateol = "true"> - <Begin>"</Begin> - <End>"</End> - </Span> - - <Span name = "CHAR" bold = "false" italic = "false" color = "Magenta" stopateol = "true"> - <Begin>'</Begin> - <End>'</End> - </Span> - - <MarkPrevious bold = "true" italic = "false" color = "MidnightBlue">(</MarkPrevious> - - <KeyWords name = "Punctuation" bold = "false" italic = "false" color = "DarkGreen"> - <Key word = "?" /> - <Key word = "," /> - <Key word = "." /> - <Key word = "(" /> - <Key word = ")" /> - <Key word = "[" /> - <Key word = "]" /> - <Key word = "{" /> - <Key word = "}" /> - <Key word = "+" /> - <Key word = "-" /> - <Key word = "/" /> - <Key word = "%" /> - <Key word = "*" /> - <Key word = "<" /> - <Key word = ">" /> - <Key word = "^" /> - <Key word = "!" /> - <Key word = "|" /> - </KeyWords> - - - - <KeyWords name = "AccessKeywords" bold="true" italic="false" color="Black"> - <Key word = "this" /> - <Key word = "super" /> - </KeyWords> - - <KeyWords name = "OperatorKeywords" bold="true" italic="false" color="DarkCyan"> - <Key word = "new" /> - <Key word = "instanceof" /> - <Key word = "true" /> - <Key word = "false" /> - </KeyWords> - - <KeyWords name = "SelectionStatements" bold="true" italic="false" color="Blue"> - <Key word = "else" /> - <Key word = "if" /> - <Key word = "switch" /> - <Key word = "case" /> - </KeyWords> - - <KeyWords name = "IterationStatements" bold="true" italic="false" color="Blue"> - <Key word = "do" /> - <Key word = "for" /> - <Key word = "while" /> - </KeyWords> - - <KeyWords name = "JumpStatements" bold="false" italic="false" color="Navy"> - <Key word = "break" /> - <Key word = "continue" /> - <Key word = "default" /> - <Key word = "goto" /> - <Key word = "return" /> - </KeyWords> - - <KeyWords name = "ExceptionHandlingStatements" bold="true" italic="false" color="Teal"> - <Key word = "try" /> - <Key word = "throw" /> - <Key word = "catch" /> - <Key word = "finally" /> - </KeyWords> - - - <KeyWords name = "ValueTypes" bold="true" italic="false" color="Red"> - <Key word = "boolean" /> - <Key word = "double" /> - <Key word = "int" /> - <Key word = "short" /> - <Key word = "long" /> - <Key word = "float" /> - <Key word = "byte" /> - <Key word = "char" /> - </KeyWords> - - <KeyWords name = "ReferenceTypes" bold="false" italic="false" color="Red"> - <Key word = "class" /> - <Key word = "interface" /> - <Key word = "object" /> - </KeyWords> - - <KeyWords name = "Void" bold="false" italic="false" color="Red"> - <Key word = "void" /> - </KeyWords> - - - <KeyWords name = "Modifiers" bold="false" italic="false" color="Brown"> - <Key word = "abstract" /> - <Key word = "const" /> - <Key word = "static" /> - <Key word = "final" /> - <Key word = "native" /> - <Key word = "extends" /> - <Key word = "implements" /> - <Key word = "volatile" /> - <Key word = "transient" /> - <Key word = "throws" /> - <Key word = "strictfp" /> - <Key word = "synchronized" /> - </KeyWords> - - <KeyWords name = "AccessModifiers" bold="true" italic="false" color="Blue"> - <Key word = "public" /> - <Key word = "protected" /> - <Key word = "private" /> - </KeyWords> - - <KeyWords name = "NameSpaces" bold="true" italic="false" color="Green"> - <Key word = "package" /> - <Key word = "import" /> - </KeyWords> - - <KeyWords name = "Literals" bold="true" italic="false" color="Black"> - <Key word = "null" /> - </KeyWords> - </RuleSet> - - <RuleSet name = "TestSet" ignorecase = "true"> - <Delimiters>~!%^*()-+=|\#/{}[]:;"'<> , .?</Delimiters> - <KeyWords name = "Todoword" bold="true" italic="true" color="Red"> - <Key word = "TODO" /> - </KeyWords> - - <KeyWords name = "JAVADOC comments" bold="true" italic="true" color="DarkGray"> - <Key word = "@author" /> - <Key word = "@version" /> - <Key word = "@param" /> - <Key word = "@return" /> - <Key word = "@exception" /> - <Key word = "@throws" /> - <Key word = "@see" /> - <Key word = "@since" /> - <Key word = "@serial" /> - <Key word = "@serialField" /> - <Key word = "@serialData" /> - <Key word = "@deprecated" /> - </KeyWords> - - </RuleSet> - </RuleSets> - -</SyntaxDefinition> diff --git a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/JavaScript-Mode.xshd b/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/JavaScript-Mode.xshd deleted file mode 100644 index 9936802215..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/JavaScript-Mode.xshd +++ /dev/null @@ -1,154 +0,0 @@ -<?xml version="1.0"?> -<!-- syntaxdefinition for JavaScript 2.0 by Svante Lidman --> - -<SyntaxDefinition name ="JavaScript" extensions = ".js"> - - <Environment> - <Default color = "SystemColors.WindowText" bgcolor = "SystemColors.Window"/> - <Selection color = "SystemColors.HighlightText" bgcolor = "SystemColors.Highlight"/> -<!-- <Selection bgcolor = "LightBlue"/> --> - <VRuler color = "SystemColors.ControlLight"/> - <InvalidLines color = "Red"/> - <CaretMarker color = "Yellow"/> - - <LineNumbers color = "SystemColors.ControlDark" bgcolor = "SystemColors.Window"/> - - <FoldLine color = "#808080" bgcolor="Black"/> - <FoldMarker color = "#808080" bgcolor="White"/> - - <EOLMarkers color = "#E0E0E5"/> - <SpaceMarkers color = "#E0E0E5"/> - <TabMarkers color = "#E0E0E5"/> - </Environment> - - <Properties> - <Property name="LineComment" value="//"/> - </Properties> - - <Digits name ="Digits" bold ="false" italic ="false" color ="DarkBlue"/> - - <RuleSets> - <RuleSet ignorecase = "false"> - <Delimiters>=!><+-/*%&|^~.}{,;][?:</Delimiters> - - <Span name ="LineComment" bold ="false" italic ="false" color ="DarkSlateGray" stopateol ="true"> - <Begin>//</Begin> - </Span> - - <Span name ="BlockComment" bold ="false" italic ="false" color ="DarkSlateGray" stopateol ="false"> - <Begin>/*</Begin> - <End>*/</End> - </Span> - - <Span name ="String" bold ="false" italic ="false" color ="Sienna" stopateol ="false"> - <Begin>"</Begin> - <End>"</End> - </Span> - - <Span name = "Character" bold = "false" italic = "false" color = "Sienna" stopateol = "true"> - <Begin>'</Begin> - <End>'</End> - </Span> - - <KeyWords name ="JavaScriptKeyWords" bold="false" italic = "false" color = "Blue"> - <Key word = "break" /> - <Key word = "continue" /> - <Key word = "delete" /> - <Key word = "else" /> - <Key word = "for" /> - <Key word = "function" /> - <Key word = "if" /> - <Key word = "in" /> - <Key word = "new" /> - <Key word = "return" /> - <Key word = "this" /> - <Key word = "typeof" /> - <Key word = "var" /> - <Key word = "void" /> - <Key word = "while" /> - <Key word = "with" /> - <!--ECMAScript keywords--> - <!-- Reserved for future use - (some are already used in some Javascript Engines) - --> - <Key word = "abstract" /> - <Key word = "boolean" /> - <Key word = "byte" /> - <Key word = "case" /> - <Key word = "catch" /> - <Key word = "char" /> - <Key word = "class" /> - <Key word = "const" /> - <Key word = "debugger" /> - <Key word = "default" /> - <Key word = "do" /> - <Key word = "double" /> - <Key word = "enum" /> - <Key word = "export" /> - <Key word = "extends" /> - <Key word = "final" /> - <Key word = "finally" /> - <Key word = "float" /> - <Key word = "goto" /> - <Key word = "implements" /> - <Key word = "import" /> - <Key word = "instanceof" /> - <Key word = "int" /> - <Key word = "interface" /> - <Key word = "long" /> - <Key word = "native" /> - <Key word = "package" /> - <Key word = "private" /> - <Key word = "protected" /> - <Key word = "public" /> - <Key word = "short" /> - <Key word = "static" /> - <Key word = "super" /> - <Key word = "switch" /> - <Key word = "synchronized" /> - <Key word = "throw" /> - <Key word = "throws" /> - <Key word = "transient" /> - <Key word = "try" /> - <Key word = "volatile" /> - </KeyWords> - - <KeyWords name ="JavaScriptIntrinsics" bold="false" italic = "false" color = "Blue"> - <Key word = "Array" /> - <Key word = "Boolean" /> - <Key word = "Date" /> - <Key word = "Function" /> - <Key word = "Global" /> - <Key word = "Math" /> - <Key word = "Number" /> - <Key word = "Object" /> - <Key word = "RegExp" /> - <Key word = "String" /> - </KeyWords> - - <KeyWords name ="JavaScriptLiterals" bold="false" italic = "false" color = "Blue"> - <Key word = "false" /> - <Key word = "null" /> - <Key word = "true" /> - <Key word = "NaN" /> - <Key word = "Infinity" /> - </KeyWords> - - <KeyWords name ="JavaScriptLiterals" bold="false" italic = "false" color = "Blue"> - <Key word = "" /> - </KeyWords> - - <KeyWords name ="JavaScriptGlobalFunctions" bold="false" italic = "false" color = "Blue"> - <Key word = "eval" /> - <Key word = "parseInt" /> - <Key word = "parseFloat" /> - <Key word = "escape" /> - <Key word = "unescape" /> - <Key word = "isNaN" /> - <Key word = "isFinite" /> - </KeyWords> - </RuleSet> - </RuleSets> - -</SyntaxDefinition> - diff --git a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/PHP-Mode.xshd b/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/PHP-Mode.xshd deleted file mode 100644 index 7f874c8ada..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/PHP-Mode.xshd +++ /dev/null @@ -1,216 +0,0 @@ -<?xml version="1.0"?> -<!-- syntaxdefinition for PHP 2001 by Chad Smith & Mike Krueger --> - -<SyntaxDefinition name ="PHP" extensions = ".php"> - - <Environment> - <Default color = "SystemColors.WindowText" bgcolor = "SystemColors.Window"/> - <Selection color = "SystemColors.HighlightText" bgcolor = "SystemColors.Highlight"/> -<!-- <Selection bgcolor = "LightBlue"/> --> - <VRuler color = "SystemColors.ControlLight"/> - <InvalidLines color = "Red"/> - <CaretMarker color = "Yellow"/> - - <LineNumbers color = "SystemColors.ControlDark" bgcolor = "SystemColors.Window"/> - - <FoldLine color = "#808080" bgcolor="Black"/> - <FoldMarker color = "#808080" bgcolor="White"/> - - <EOLMarkers color = "#E0E0E5"/> - <SpaceMarkers color = "#E0E0E5"/> - <TabMarkers color = "#E0E0E5"/> - </Environment> - - <Digits name ="Digits" bold ="false" italic ="false" color ="DarkBlue"/> - - <RuleSets> - <RuleSet ignorecase = "false"> - <Delimiters>~!%^*()-+=|\#/{}[]:;"'<> , .?</Delimiters> - - <Span name ="PreprocessorDirectives" bold="false" italic = "false" color = "Green" stopateol ="true"> - <Begin>#</Begin> - </Span> - - <Span name ="LINECOMMENT" rule = "DocumentSet" bold ="false" italic ="true" color ="SlateGray" stopateol ="true"> - <Begin>///</Begin> - </Span> - - <Span name ="LINECOMMENT" rule = "TestSet" bold ="false" italic ="true" color ="SlateGray" stopateol ="true"> - <Begin>//@!/@</Begin> - </Span> - - <Span name ="BLOCKCOMMENT" rule = "TestSet" bold ="false" italic ="true" color ="SlateGray" stopateol ="false"> - <Begin>/*</Begin> - <End>*/</End> - </Span> - - <Span name ="STRING" bold ="false" italic ="false" color ="Magenta" stopateol ="true"> - <Begin>"</Begin> - <End>"</End> - </Span> - - <Span name ="MORELINEDSTRING" bold ="false" italic ="false" color ="Magenta" stopateol ="false"> - <Begin>@@"</Begin> - <End>"</End> - </Span> - - <Span name ="CHAR" bold ="false" italic ="false" color ="Magenta" stopateol ="true"> - <Begin>'</Begin> - <End>'</End> - </Span> - - <MarkPrevious bold ="true" italic ="false" color ="MidnightBlue">(</MarkPrevious> - - <KeyWords name ="Punctuation" bold ="false" italic ="false" color ="DarkGreen"> - <Key word = "?" /> - <Key word = "," /> - <Key word = "." /> - <Key word = "(" /> - <Key word = ")" /> - <Key word = "[" /> - <Key word = "]" /> - <Key word = "{" /> - <Key word = "}" /> - <Key word = "+" /> - <Key word = "-" /> - <Key word = "/" /> - <Key word = "%" /> - <Key word = "*" /> - <Key word = "<" /> - <Key word = ">" /> - <Key word = "^" /> - <Key word = "!" /> - <Key word = "|" /> - </KeyWords> - - <KeyWords name ="AccessKeywords" bold="true" italic = "false" color = "Black"> - <Key word = "global" /> - <Key word = "my" /> - </KeyWords> - - <KeyWords name ="OperatorKeywords" bold="true" italic = "false" color = "DarkCyan"> - <Key word = "and" /> - <Key word = "or" /> - <Key word = "new" /> - <Key word = "xor" /> - <Key word = "true" /> - <Key word = "false" /> - </KeyWords> - - - <KeyWords name ="SelectionStatements" bold="true" italic = "false" color = "Blue"> - <Key word = "else" /> - <Key word = "if" /> - <Key word = "switch" /> - <Key word = "case" /> - <Key word = "endif" /> - <Key word = "elseif" /> - </KeyWords> - - <KeyWords name ="IterationStatements" bold="true" italic = "false" color = "Blue"> - <Key word = "do" /> - <Key word = "for" /> - <Key word = "foreach" /> - <Key word = "while" /> - <Key word = "endwhile" /> - <Key word = "exit" /> - </KeyWords> - - <KeyWords name ="JumpStatements" bold="false" italic = "false" color = "Navy"> - <Key word = "break" /> - <Key word = "continue" /> - <Key word = "default" /> - <Key word = "goto" /> - <Key word = "return" /> - </KeyWords> - - <KeyWords name ="ExceptionHandlingStatements" bold="true" italic = "false" color = "Teal"> - <Key word = "require" /> - <Key word = "include" /> - <Key word = "function" /> - <Key word = "return" /> - <Key word = "old_function" /> - </KeyWords> - - <KeyWords name ="ValueTypes" bold="true" italic = "false" color = "Red"> - <Key word = "int" /> - <Key word = "integer" /> - <Key word = "real" /> - <Key word = "double" /> - <Key word = "float" /> - <Key word = "string" /> - <Key word = "array" /> - <Key word = "object" /> - </KeyWords> - - <KeyWords name ="ReferenceTypes" bold="false" italic = "false" color = "Red"> - <Key word = "class" /> - <Key word = "new" /> - </KeyWords> - - <KeyWords name ="Void" bold="false" italic = "false" color = "Red"> - <Key word = "void" /> - </KeyWords> - - <KeyWords name ="AccessModifiers" bold="true" italic = "false" color = "Blue"> - <Key word = "public" /> - <Key word = "private" /> - </KeyWords> - - <KeyWords name ="GetSet" bold="false" italic = "false" color = "SaddleBrown"> - <Key word = "get" /> - <Key word = "set" /> - </KeyWords> - - <KeyWords name ="Literals" bold="true" italic = "false" color = "Black"> - <Key word = "null" /> - <Key word = "value" /> - </KeyWords> - - <KeyWords name ="Statements" bold="true" italic = "false" color = "DarkBlue"> - <Key word = "var" /> - <Key word = "extends" /> - <Key word = "list" /> - <Key word = "each" /> - <Key word = "PHP_SELF" /> - </KeyWords> - </RuleSet> - - <RuleSet name ="TestSet" ignorecase = "true"> - <Delimiters>~!@%^*()-+=|\#/{}[]:;"'<> , .?</Delimiters> - <KeyWords name ="Testword" bold="true" italic = "true" color = "Red"> - <Key word = "TODO" /> - </KeyWords> - </RuleSet> - - <RuleSet name ="DocumentSet" ignorecase = "false"> - <Delimiters>~!@%^*()-+=|\#/{}[]:;"'<> , .?</Delimiters> - - <Span name ="XMLTAG" rule = "XMLDocuSet" bold ="false" italic ="true" color ="Gray" stopateol ="true"> - <Begin><</Begin> - <End>></End> - </Span> - - <KeyWords name ="Testword" bold="true" italic = "true" color = "Red"> - <Key word = "TODO" /> - </KeyWords> - </RuleSet> - - <RuleSet name ="XMLDocuSet" ignorecase = "false"> - <Delimiters>~!@%^*()-+=|\#/{}[]:;"'<> , .?</Delimiters> - - <Span name ="STRING" bold ="true" italic ="true" color ="Silver" stopateol ="true"> - <Begin>"</Begin> - <End>"</End> - </Span> - - - <KeyWords name ="Punctuation" bold ="true" italic ="true" color ="Gray"> - <Key word = "/" /> - <Key word = "|" /> - <Key word = "=" /> - </KeyWords> - </RuleSet> - </RuleSets> -</SyntaxDefinition> - diff --git a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/SyntaxModes.xml b/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/SyntaxModes.xml deleted file mode 100644 index 5d3d72c8ce..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/SyntaxModes.xml +++ /dev/null @@ -1,49 +0,0 @@ -<SyntaxModes version="1.0"> - <Mode file = "ASPX.xshd" - name = "ASP3/XHTML" - extensions = ".asp"/> - - <Mode file = "BAT-Mode.xshd" - name = "BAT" - extensions = ".bat"/> - - <Mode file = "Coco-Mode.xshd" - name = "Coco" - extensions = ".atg"/> - - <Mode file = "CPP-Mode.xshd" - name = "C++" - extensions = ".c;.h;.cc;.C;.cpp;.hpp"/> - - <Mode file = "CSharp-Mode.xshd" - name = "C#" - extensions = ".cs"/> - - <Mode file = "HTML-Mode.xshd" - name = "HTML" - extensions = ".htm;.html"/> - - <Mode file = "Java-Mode.xshd" - name = "Java" - extensions = ".java"/> - - <Mode file = "JavaScript-Mode.xshd" - name = "JavaScript" - extensions = ".js"/> - - <Mode file = "PHP-Mode.xshd" - name = "PHP" - extensions = ".php"/> - - <Mode file = "Tex-Mode.xshd" - name = "TeX" - extensions = ".tex"/> - - <Mode file = "VBNET-Mode.xshd" - name = "VBNET" - extensions = ".vb"/> - - <Mode file = "XML-Mode.xshd" - name = "XML" - extensions = ".xml;.xsl;.xslt;.xsd;.manifest;.config;.addin;.xshd"/> -</SyntaxModes> diff --git a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/Tex-Mode.xshd b/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/Tex-Mode.xshd deleted file mode 100644 index 6831cb58c1..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/Tex-Mode.xshd +++ /dev/null @@ -1,126 +0,0 @@ -<?xml version="1.0"?> -<!-- syntaxdefinition for TeX document 2001 by Mike Krueger (gleaned from Jedit) --> - -<SyntaxDefinition name = "TeX" extensions = ".tex"> - - <Environment> - <Default color = "SystemColors.WindowText" bgcolor = "SystemColors.Window"/> - <Selection color = "SystemColors.HighlightText" bgcolor = "SystemColors.Highlight"/> -<!-- <Selection bgcolor = "LightBlue"/> --> - <VRuler color = "SystemColors.ControlLight"/> - <InvalidLines color = "Red"/> - <CaretMarker color = "Yellow"/> - - <LineNumbers color = "SystemColors.ControlDark" bgcolor = "SystemColors.Window"/> - - <FoldLine color = "#808080" bgcolor="Black"/> - <FoldMarker color = "#808080" bgcolor="White"/> - - <EOLMarkers color = "#E0E0E5"/> - <SpaceMarkers color = "#E0E0E5"/> - <TabMarkers color = "#E0E0E5"/> - </Environment> - - <Digits name = "Digits" bold = "false" italic = "false" color = "Black"/> - - <RuleSets> - <RuleSet ignorecase = "false" noescapesequences="true"> - <Delimiters>&~!@%^*()-+=|\#/{}[]:;"'<> , .?</Delimiters> - - <Span name = "LineComment" bold = "false" italic = "true" color = "SlateGray" stopateol = "true"> - <Begin>%</Begin> - </Span> - - <Span name = "MathMode" rule = "MathMode" bold = "false" italic = "false" color = "Black" stopateol = "false"> - <Begin>$$</Begin> - <End>$$</End> - </Span> - <Span name = "LatexMathMode" rule = "MathMode" bold = "false" italic = "false" color = "Black" stopateol = "false"> - <Begin>\[</Begin> - <End>\]</End> - </Span> - - <!-- \... commands --> - <MarkFollowing markmarker ="true" bold = "true" italic = "false" color = "MidnightBlue">\</MarkFollowing> - - <!-- some commands must be handled specially --> - <KeyWords name = "Keyword1" bold = "false" italic = "false" color = "Blue"> - <Key word = "\$" /> - <Key word = "\\" /> - <Key word = "\%" /> - </KeyWords> - - <KeyWords name = "KeyWords2" bold="true" italic="false" color="Green"> - <Key word = ")" /> - <Key word = ")" /> - <Key word = "{" /> - <Key word = "}" /> - <Key word = "[" /> - <Key word = "]" /> - <Key word = "=" /> - <Key word = "!" /> - <Key word = "+" /> - <Key word = "-" /> - <Key word = "/" /> - <Key word = "*" /> - <Key word = ">" /> - <Key word = "<" /> - <Key word = "&" /> - <Key word = "|" /> - <Key word = "^" /> - <Key word = "~" /> - <Key word = "." /> - <Key word = "," /> - <Key word = ";" /> - <Key word = "?" /> - <Key word = ":" /> - <Key word = "'" /> - <!-- <Key word = """ />--> - <Key word = "`" /> - </KeyWords> - </RuleSet> - - <RuleSet name = "MathMode" ignorecase = "false" noescapesequences="true"> - <Delimiters>&~!@%^*()-+=|\#/{}[]:;"'<> , .?</Delimiters> - - - <Span name = "LineComment" bold = "false" italic = "true" color = "SlateGray" stopateol = "true"> - <Begin>%</Begin> - </Span> - - <!-- \... commands --> - <MarkFollowing markmarker ="true" bold = "true" italic = "false" color = "MidnightBlue">\</MarkFollowing> - - <KeyWords name = "KeyWords2" bold="true" italic="false" color="Green"> - <Key word = ")" /> - <Key word = ")" /> - <Key word = "{" /> - <Key word = "}" /> - <Key word = "[" /> - <Key word = "]" /> - <Key word = "=" /> - <Key word = "!" /> - <Key word = "+" /> - <Key word = "-" /> - <Key word = "/" /> - <Key word = "*" /> - <Key word = ">" /> - <Key word = "<" /> - <Key word = "&" /> - <Key word = "|" /> - <Key word = "^" /> - <Key word = "~" /> - <Key word = "." /> - <Key word = "," /> - <Key word = ";" /> - <Key word = "?" /> - <Key word = ":" /> - <Key word = "'" /> - <!-- <Key word = """ />--> - <Key word = "`" /> - </KeyWords> - </RuleSet> - </RuleSets> - -</SyntaxDefinition> - diff --git a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/VBNET-Mode.xshd b/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/VBNET-Mode.xshd deleted file mode 100644 index 295760ae8a..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/VBNET-Mode.xshd +++ /dev/null @@ -1,728 +0,0 @@ -<?xml version="1.0"?> - -<!-- Syntaxdefinition for VB.NET Beta Cycle, v0.1 Rev 1 by Christian Holm --> -<!-- compliant with SharpDevelop v0.65ST2 --> - -<SyntaxDefinition name = "VBNET" extensions = ".vb"> - - <Environment> - <Default color = "SystemColors.WindowText" bgcolor = "SystemColors.Window"/> - <Selection color = "SystemColors.HighlightText" bgcolor = "SystemColors.Highlight"/> -<!-- <Selection bgcolor = "LightBlue"/> --> - <VRuler color = "SystemColors.ControlLight"/> - <InvalidLines color = "Red"/> - <CaretMarker color = "Yellow"/> - - <LineNumbers color = "SystemColors.ControlDark" bgcolor = "SystemColors.Window"/> - - <FoldLine color = "#808080" bgcolor="Black"/> - <FoldMarker color = "#808080" bgcolor="White"/> - - <EOLMarkers color = "#E0E0E5"/> - <SpaceMarkers color = "#E0E0E5"/> - <TabMarkers color = "#E0E0E5"/> - </Environment> - - <Properties> - <Property name="LineComment" value="'"/> - </Properties> - - <Digits name = "Digits" bold = "false" italic = "false" color = "Black"/> - - <RuleSets> - <RuleSet ignorecase = "true"> - - <Delimiters>~!@%^*()-+=|\#/{}[]:;"'<>,.?</Delimiters> - - <Span name = "STRING" bold = "false" italic = "false" color = "Black" stopateol = "true"> - <Begin>"</Begin> - <End>"</End> - </Span> -<!-- - <Span name = "LINECOMMENT" rule = "DocumentSet" bold = "false" italic = "false" color = "Green" stopateol = "true"> - <Begin>'</Begin> - </Span> - - <Span name = "LINECOMMENT" rule = "DocumentSet" bold = "false" italic = "false" color = "Green" stopateol = "true"> - <Begin>REM</Begin> - </Span> ---> - <Span name = "LINECOMMENT" bold = "false" italic = "false" color = "Green" stopateol = "true"> - <Begin>'</Begin> - </Span> - - <Span name = "LINECOMMENT" bold = "false" italic = "false" color = "Green" stopateol = "true"> - <Begin>REM</Begin> - </Span> - - <KeyWords name = "PreProcessor" bold="false" italic="false" color="Blue"> - <Key word = "#Const" /> - <Key word = "#If" /> - <Key word = "#ElseIf" /> - <Key word = "#Else" /> - <Key word = "#End If" /> - <Key word = "#End" /> - </KeyWords> - - <KeyWords name = "Objects" bold="false" italic="false" color="Black"> - <Key word = "Collection" /> - <Key word = "Debug" /> - <Key word = "Dictionary" /> - <Key word = "Drive" /> - <Key word = "Drives" /> - <Key word = "Err" /> - <Key word = "File" /> - <Key word = "Files" /> - <Key word = "FileSystemObject" /> - <Key word = "Folder" /> - <Key word = "Folders" /> - <Key word = "TextStream" /> - </KeyWords> - - <KeyWords name = "Common" bold="false" italic="false" color="Black"> - <Key word = "Console" /> - <Key word = "System" /> - <Key word = "Microsoft" /> - <Key word = "VisualBasic" /> - <Key word = "Win32" /> - <Key word = "Collections" /> - <Key word = "Bases" /> - <Key word = "CodeDOM" /> - <Key word = "Compiler" /> - <Key word = "ComponentModel" /> - <Key word = "Design" /> - <Key word = "CodeModel" /> - <Key word = "Configuration" /> - <Key word = "Assemblies" /> - <Key word = "Install" /> - <Key word = "Interceptors" /> - <Key word = "Schema" /> - <Key word = "Core" /> - <Key word = "Data" /> - <Key word = "ADO" /> - <Key word = "Internal" /> - <Key word = "SQL" /> - <Key word = "SQLTypes" /> - <Key word = "DOM" /> - <Key word = "XPath" /> - <Key word = "XSLT" /> - <Key word = "Diagnostics" /> - <Key word = "SymbolStore" /> - <Key word = "DirectoryServices" /> - <Key word = "Drawing" /> - <Key word = "Drawing2D" /> - <Key word = "Imaging" /> - <Key word = "Printing" /> - <Key word = "Globalization" /> - <Key word = "IO" /> - <Key word = "IsolatedStorage" /> - <Key word = "Messaging" /> - <Key word = "Net" /> - <Key word = "NewXML" /> - <Key word = "Xsl" /> - <Key word = "Reflection" /> - <Key word = "Emit" /> - <Key word = "Resources" /> - <Key word = "Runtime" /> - <Key word = "InterOpServices" /> - <Key word = "Expando" /> - <Key word = "Remoting" /> - <Key word = "Serialization" /> - <Key word = "Formatters" /> - <Key word = "Binary" /> - <Key word = "Security" /> - <Key word = "Cryptography" /> - <Key word = "X509Certificates" /> - <Key word = "Permissions" /> - <Key word = "Policy" /> - <Key word = "Principalv" /> - <Key word = "ServiceProcess" /> - <Key word = "Text" /> - <Key word = "RegularExpressions" /> - <Key word = "Threading" /> - <Key word = "Timers" /> - <Key word = "Web" /> - <Key word = "Services" /> - <Key word = "Description" /> - <Key word = "Discovery" /> - <Key word = "Protocols" /> - <Key word = "UI" /> - <Key word = "WebControls" /> - <Key word = "ListControls" /> - <Key word = "HtmlControls" /> - <Key word = "WinForms" /> - <Key word = "ComponentModel" /> - <Key word = "Xml" /> - <Key word = "Code" /> - <Key word = "Schema" /> - </KeyWords> - - <KeyWords name = "DataTypes" bold="false" italic="false" color="Blue"> - <Key word = "Boolean" /> - <Key word = "Byte" /> - <Key word = "Char" /> - <Key word = "Date" /> - <Key word = "Decimal" /> - <Key word = "Double" /> - <Key word = "Integer" /> - <Key word = "Long" /> - <Key word = "Object" /> - <Key word = "Short" /> - <Key word = "Single" /> - <Key word = "String" /> - <Key word = "Exception" /> - </KeyWords> - - <KeyWords name = "Statements" bold="false" italic="false" color="Blue"> - <Key word = "AppActivate" /> - <Key word = "Beep" /> - <Key word = "Call" /> - <Key word = "ChDir" /> - <Key word = "ChDrive" /> - <Key word = "Class" /> - <Key word = "Declare" /> - <Key word = "Delegate" /> - <Key word = "DeleteSetting" /> - <Key word = "Dim" /> - <Key word = "Do" /> - <Key word = "Loop" /> - <Key word = "End" /> - <Key word = "Enum" /> - <Key word = "Error" /> - <Key word = "Event" /> - <Key word = "Exit" /> - <Key word = "Each" /> - <Key word = "Function" /> - <Key word = "Goto" /> - <Key word = "Overloads" /> - <Key word = "Overrides" /> - <Key word = "CantOverride" /> - <Key word = "MustOverride" /> - <Key word = "Protected" /> - <Key word = "Implements" /> - <Key word = "Imports" /> - <Key word = "Inherits" /> - <Key word = "Interface" /> - <Key word = "Kill" /> - <Key word = "Lock" /> - <Key word = "UnLock" /> - <Key word = "Mid" /> - <Key word = "MidB" /> - <Key word = "Namespace" /> - <Key word = "Open" /> - <Key word = "Option" /> - <Key word = "Compare" /> - <Key word = "Explicit" /> - <Key word = "Strict" /> - <Key word = "Print" /> - <Key word = "Private" /> - <Key word = "Property" /> - <Key word = "Public" /> - <Key word = "Put" /> - <Key word = "RaiseEvent" /> - <Key word = "Randomize" /> - <Key word = "ReDim" /> - <Key word = "Rem" /> - <Key word = "Reset" /> - <Key word = "Resume" /> - <Key word = "SaveSetting" /> - <Key word = "Seek" /> - <Key word = "Select" /> - <Key word = "Case" /> - <Key word = "SetAttr" /> - <Key word = "Stop" /> - <Key word = "Sub" /> - <Key word = "SyncLock" /> - <Key word = "TimeOfDay" /> - <Key word = "Try" /> - <Key word = "Catch" /> - <Key word = "Finally" /> - <Key word = "Structure" /> - <Key word = "Width" /> - <Key word = "With" /> - <Key word = "Write" /> - </KeyWords> - - <KeyWords name = "Keywrds" bold="false" italic="false" color="Blue"> - <Key word = "Addhandler" /> - <Key word = "As" /> - <Key word = "Assembly" /> - <Key word = "Auto" /> - <Key word = "BeginEpilogue" /> - <Key word = "Binary" /> - <Key word = "ByRef" /> - <Key word = "ByVal" /> - <Key word = "Const" /> - <Key word = "Else" /> - <Key word = "Empty" /> - <Key word = "EndPrologue" /> - <Key word = "Error" /> - <Key word = "ExternalSource" /> - <Key word = "For" /> - <Key word = "Friend" /> - <Key word = "Get" /> - <Key word = "Handles" /> - <Key word = "Input" /> - <Key word = "Is" /> - <Key word = "Len" /> - <Key word = "Let" /> - <Key word = "Lock" /> - <Key word = "Me" /> - <Key word = "Mid" /> - <Key word = "Module" /> - <Key word = "MustInherit" /> - <Key word = "MyBase" /> - <Key word = "MyClass" /> - <Key word = "New" /> - <Key word = "Next" /> - <Key word = "Nothing" /> - <Key word = "NotInheritable" /> - <Key word = "NotOverridable" /> - <Key word = "Null" /> - <Key word = "Off" /> - <Key word = "On" /> - <Key word = "Option" /> - <Key word = "Optional" /> - <Key word = "Overridable" /> - <Key word = "ParamArray" /> - <Key word = "Print" /> - <Key word = "Private" /> - <Key word = "Property" /> - <Key word = "Public" /> - <Key word = "ReadOnly" /> - <Key word = "RemoveHandler" /> - <Key word = "Resume" /> - <Key word = "Seek" /> - <Key word = "Step" /> - <Key word = "String" /> - <Key word = "Then" /> - <Key word = "Throw" /> - <Key word = "Time" /> - <Key word = "To" /> - <Key word = "WithEvents" /> - <Key word = "WriteOnly" /> - <Key word = "ElseIf" /> - <Key word = "EndIf" /> - <Key word = "Height" /> - <Key word = "In" /> - <Key word = "Return" /> - <Key word = "Set" /> - <Key word = "Shared" /> - <Key word = "Type" /> - <Key word = "TypeOf" /> - <Key word = "Until" /> - <Key word = "While" /> - </KeyWords> - - <KeyWords name = "Operators" bold="false" italic="false" color="Blue"> - <Key word = "AddressOf" /> - <Key word = "And" /> - <Key word = "BitAnd" /> - <Key word = "BitNot" /> - <Key word = "BitOr" /> - <Key word = "BitXor" /> - <Key word = "Is" /> - <Key word = "Like" /> - <Key word = "Mod" /> - <Key word = "Not" /> - <Key word = "Or" /> - <Key word = "Xor" /> - </KeyWords> - - <KeyWords name = "Functions" bold="false" italic="false" color="Blue"> - <Key word = "Abs" /> - <Key word = "Array" /> - <Key word = "Asc" /> - <Key word = "AscB" /> - <Key word = "AscW" /> - <Key word = "Atn" /> - <Key word = "CallByName" /> - <Key word = "CBool" /> - <Key word = "CByte" /> - <Key word = "CChar" /> - <Key word = "CChr" /> - <Key word = "CDate" /> - <Key word = "CDbl" /> - <Key word = "CDec" /> - <Key word = "Choose" /> - <Key word = "Chr" /> - <Key word = "Chr$" /> - <Key word = "ChrB" /> - <Key word = "ChrB$" /> - <Key word = "ChrW" /> - <Key word = "CInt" /> - <Key word = "CLng" /> - <Key word = "CLng8" /> - <Key word = "Close" /> - <Key word = "CObj" /> - <Key word = "Command" /> - <Key word = "Command$" /> - <Key word = "Cos" /> - <Key word = "CreateObject" /> - <Key word = "CShort" /> - <Key word = "CSng" /> - <Key word = "CStr" /> - <Key word = "CurDir" /> - <Key word = "CType" /> - <Key word = "CVDate" /> - <Key word = "CVErr" /> - <Key word = "DateAdd" /> - <Key word = "DateDiff" /> - <Key word = "DatePart" /> - <Key word = "DateSerial" /> - <Key word = "DateValue" /> - <Key word = "Day" /> - <Key word = "DDB" /> - <Key word = "Dir" /> - <Key word = "Dir$" /> - <Key word = "EOF" /> - <Key word = "Error" /> - <Key word = "Error$" /> - <Key word = "Exp" /> - <Key word = "FileAttr" /> - <Key word = "FileCopy" /> - <Key word = "FileDateTime" /> - <Key word = "FileLen" /> - <Key word = "Filter" /> - <Key word = "Fix" /> - <Key word = "Format" /> - <Key word = "Format$" /> - <Key word = "FormatCurrency" /> - <Key word = "FormatDateTime" /> - <Key word = "FormatNumber" /> - <Key word = "FormatPercent" /> - <Key word = "FreeFile" /> - <Key word = "FV" /> - <Key word = "Get" /> - <Key word = "GetAllSettings" /> - <Key word = "GetAttr" /> - <Key word = "GetObject" /> - <Key word = "GetSetting" /> - <Key word = "Hex" /> - <Key word = "Hex$" /> - <Key word = "Hour" /> - <Key word = "If" /> - <Key word = "IMEStatus" /> - <Key word = "Input" /> - <Key word = "Input$" /> - <Key word = "InputB" /> - <Key word = "InputB$" /> - <Key word = "InputBox" /> - <Key word = "InStr" /> - <Key word = "InStrB" /> - <Key word = "InstrRev" /> - <Key word = "Int" /> - <Key word = "IPmt" /> - <Key word = "IRR" /> - <Key word = "IsArray" /> - <Key word = "IsDate" /> - <Key word = "IsEmpty" /> - <Key word = "IsError" /> - <Key word = "IsNull" /> - <Key word = "IsNumeric" /> - <Key word = "IsObject" /> - <Key word = "Join" /> - <Key word = "LBound" /> - <Key word = "LCase" /> - <Key word = "LCase$" /> - <Key word = "Left" /> - <Key word = "Left$" /> - <Key word = "LeftB" /> - <Key word = "LeftB$" /> - <Key word = "Len" /> - <Key word = "LenB" /> - <Key word = "LineInput" /> - <Key word = "Loc" /> - <Key word = "LOF" /> - <Key word = "Log" /> - <Key word = "LTrim" /> - <Key word = "LTrim$" /> - <Key word = "Mid" /> - <Key word = "Mid$" /> - <Key word = "MidB" /> - <Key word = "MidB$" /> - <Key word = "Minute" /> - <Key word = "MIRR" /> - <Key word = "MkDir" /> - <Key word = "Month" /> - <Key word = "MonthName" /> - <Key word = "MsgBox" /> - <Key word = "Now" /> - <Key word = "NPer" /> - <Key word = "NPV" /> - <Key word = "Oct" /> - <Key word = "Oct$" /> - <Key word = "Partition" /> - <Key word = "Pmt" /> - <Key word = "PPmt" /> - <Key word = "PV" /> - <Key word = "Rate" /> - <Key word = "Replace" /> - <Key word = "Right" /> - <Key word = "Right$" /> - <Key word = "RightB" /> - <Key word = "RightB$" /> - <Key word = "RmDir" /> - <Key word = "Rnd" /> - <Key word = "RTrim" /> - <Key word = "RTrim$" /> - <Key word = "Second" /> - <Key word = "Seek" /> - <Key word = "Sgn" /> - <Key word = "Shell" /> - <Key word = "Sin" /> - <Key word = "SLN" /> - <Key word = "Space" /> - <Key word = "Space$" /> - <Key word = "Spc" /> - <Key word = "Split" /> - <Key word = "Sqr" /> - <Key word = "Str" /> - <Key word = "Str$" /> - <Key word = "StrComp" /> - <Key word = "StrConv" /> - <Key word = "String$" /> - <Key word = "StrReverse" /> - <Key word = "Switch" /> - <Key word = "SYD" /> - <Key word = "Tab" /> - <Key word = "Tan" /> - <Key word = "TimeOfDay" /> - <Key word = "Timer" /> - <Key word = "TimeSerial" /> - <Key word = "TimeValue" /> - <Key word = "DateTime" /> - <Key word = "Today" /> - <Key word = "Trim" /> - <Key word = "Trim$" /> - <Key word = "TypeName" /> - <Key word = "UBound" /> - <Key word = "UCase" /> - <Key word = "UCase$" /> - <Key word = "Val" /> - <Key word = "Weekday" /> - <Key word = "WeekdayName" /> - <Key word = "Year" /> - </KeyWords> - - <KeyWords name = "Constants" bold="false" italic="false" color="Blue"> - <Key word = "Method" /> - <Key word = "Black" /> - <Key word = "Red" /> - <Key word = "Green" /> - <Key word = "Yellow" /> - <Key word = "Blue" /> - <Key word = "Magenta" /> - <Key word = "Cyan" /> - <Key word = "White" /> - <Key word = "BinaryCompare" /> - <Key word = "TextCompare" /> - <Key word = "Win16" /> - <Key word = "Win32" /> - <Key word = "UseSystemDayOfWeek" /> - <Key word = "Sunday" /> - <Key word = "Monday" /> - <Key word = "Tuesday" /> - <Key word = "Wednesday" /> - <Key word = "Thursday" /> - <Key word = "Friday" /> - <Key word = "Saturday" /> - <Key word = "Jan1" /> - <Key word = "FirstFourDays" /> - <Key word = "FirstFullWeek" /> - <Key word = "GeneralDate" /> - <Key word = "LongDate" /> - <Key word = "ShortDate" /> - <Key word = "LongTime" /> - <Key word = "ShortTime" /> - <Key word = "Normal" /> - <Key word = "ReadOnly" /> - <Key word = "Hidden" /> - <Key word = "Volume" /> - <Key word = "Directory" /> - <Key word = "Archive" /> - <Key word = "KeyLButton" /> - <Key word = "KeyRButton" /> - <Key word = "KeyCancel" /> - <Key word = "KeyMButton" /> - <Key word = "KeyBack" /> - <Key word = "KeyTab" /> - <Key word = "KeyClear" /> - <Key word = "KeyReturn" /> - <Key word = "KeyShift" /> - <Key word = "KeyControl" /> - <Key word = "KeyMenu" /> - <Key word = "KeyPause" /> - <Key word = "KeyCapital" /> - <Key word = "KeyEscape" /> - <Key word = "KeySpace" /> - <Key word = "KeyPageUp" /> - <Key word = "KeyPageDown" /> - <Key word = "KeyEnd" /> - <Key word = "KeyHome" /> - <Key word = "KeyLeft" /> - <Key word = "KeyUp" /> - <Key word = "KeyRight" /> - <Key word = "KeyDown" /> - <Key word = "KeySelect" /> - <Key word = "KeyPrint" /> - <Key word = "KeyExecute" /> - <Key word = "KeySnapshot" /> - <Key word = "KeyInsert" /> - <Key word = "KeyDelete" /> - <Key word = "KeyHelp" /> - <Key word = "KeyNumlock" /> - <Key word = "KeyA" /> - <Key word = "KeyB" /> - <Key word = "KeyC" /> - <Key word = "KeyD" /> - <Key word = "KeyE" /> - <Key word = "KeyF" /> - <Key word = "KeyG" /> - <Key word = "KeyH" /> - <Key word = "KeyI" /> - <Key word = "KeyJ" /> - <Key word = "KeyK" /> - <Key word = "KeyL" /> - <Key word = "KeyM" /> - <Key word = "KeyN" /> - <Key word = "KeyO" /> - <Key word = "KeyP" /> - <Key word = "KeyQ" /> - <Key word = "KeyR" /> - <Key word = "KeyS" /> - <Key word = "KeyT" /> - <Key word = "KeyU" /> - <Key word = "KeyV" /> - <Key word = "KeyW" /> - <Key word = "KeyX" /> - <Key word = "KeyY" /> - <Key word = "KeyZ" /> - <Key word = "Key0" /> - <Key word = "Key1" /> - <Key word = "Key2" /> - <Key word = "Key3" /> - <Key word = "Key4" /> - <Key word = "Key5" /> - <Key word = "Key6" /> - <Key word = "Key7" /> - <Key word = "Key8" /> - <Key word = "Key9" /> - <Key word = "KeyNumpad0" /> - <Key word = "KeyNumpad1" /> - <Key word = "KeyNumpad2" /> - <Key word = "KeyNumpad3" /> - <Key word = "KeyNumpad4" /> - <Key word = "KeyNumpad5" /> - <Key word = "KeyNumpad6" /> - <Key word = "KeyNumpad7" /> - <Key word = "KeyNumpad8" /> - <Key word = "KeyNumpad9" /> - <Key word = "KeyMultiply" /> - <Key word = "KeyAdd" /> - <Key word = "KeySeparator" /> - <Key word = "KeySubtract" /> - <Key word = "KeyDecimal" /> - <Key word = "KeyDivide" /> - <Key word = "KeyF1" /> - <Key word = "KeyF2" /> - <Key word = "KeyF3" /> - <Key word = "KeyF4" /> - <Key word = "KeyF5" /> - <Key word = "KeyF6" /> - <Key word = "KeyF7" /> - <Key word = "KeyF8" /> - <Key word = "KeyF9" /> - <Key word = "KeyF10" /> - <Key word = "KeyF11" /> - <Key word = "KeyF12" /> - <Key word = "KeyF13" /> - <Key word = "KeyF14" /> - <Key word = "KeyF15" /> - <Key word = "KeyF16" /> - <Key word = "CrLf" /> - <Key word = "Cr" /> - <Key word = "Lf" /> - <Key word = "NewLine" /> - <Key word = "NullChar" /> - <Key word = "NullString" /> - <Key word = "ObjectError" /> - <Key word = "Tab" /> - <Key word = "Back" /> - <Key word = "FormFeed" /> - <Key word = "VerticalTab" /> - <Key word = "OKOnly" /> - <Key word = "OKCancel" /> - <Key word = "AbortRetryIgnore" /> - <Key word = "YesNoCancel" /> - <Key word = "YesNo" /> - <Key word = "RetryCancel" /> - <Key word = "Critical" /> - <Key word = "Question" /> - <Key word = "Exclamation" /> - <Key word = "Information" /> - <Key word = "DefaultButton1" /> - <Key word = "DefaultButton2" /> - <Key word = "DefaultButton3" /> - <Key word = "ApplicationModal" /> - <Key word = "SystemModal" /> - <Key word = "MsgBoxSetForeground" /> - <Key word = "MsgBoxRight" /> - <Key word = "MsgBoxRtlReading" /> - <Key word = "OK" /> - <Key word = "Cancel" /> - <Key word = "Abort" /> - <Key word = "Retry" /> - <Key word = "Ignore" /> - <Key word = "Yes" /> - <Key word = "No" /> - <Key word = "Hide" /> - <Key word = "NormalFocus" /> - <Key word = "MinimizedFocus" /> - <Key word = "MaximizedFocus" /> - <Key word = "NormalNoFocus" /> - <Key word = "MinimizedNoFocus" /> - <Key word = "WindowsFolder" /> - <Key word = "SystemFolder" /> - <Key word = "TemporaryFolder" /> - <Key word = "UpperCase" /> - <Key word = "LowerCase" /> - <Key word = "ProperCase" /> - <Key word = "Wide" /> - <Key word = "Narrow" /> - <Key word = "Katakana" /> - <Key word = "Hiragana" /> - <Key word = "Unicode" /> - <Key word = "FromUnicode" /> - <Key word = "ScrollBars" /> - <Key word = "Desktop" /> - <Key word = "ActiveTitleBar" /> - <Key word = "InactiveTitleBar" /> - <Key word = "MenuBar" /> - <Key word = "WindowBackground" /> - <Key word = "WindowFrame" /> - <Key word = "MenuText" /> - <Key word = "WindowText" /> - <Key word = "TitleBarText" /> - <Key word = "ActiveBorder" /> - <Key word = "InactiveBorder" /> - <Key word = "ApplicationWorkspace" /> - <Key word = "Highlight" /> - <Key word = "HighlightText" /> - <Key word = "ButtonFace" /> - <Key word = "ButtonShadow" /> - <Key word = "GrayText" /> - <Key word = "ButtonText" /> - <Key word = "InactiveCaptionText" /> - <Key word = "3DHighlight" /> - <Key word = "3DDKShadow" /> - <Key word = "3DLight" /> - <Key word = "InfoText" /> - <Key word = "InfoBackground" /> - <Key word = "true" /> - <Key word = "false" /> - <Key word = "Default" /> - </KeyWords> - </RuleSet> - </RuleSets> -</SyntaxDefinition> diff --git a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/XML-Mode.xshd b/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/XML-Mode.xshd deleted file mode 100644 index 4a79b617bb..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/data/syntaxmodes/XML-Mode.xshd +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" ?> -<!-- syntaxdefinition for XML 2000 by Mike Krueger --> -<SyntaxDefinition name="XML" extensions=".xml;.xsl;.xslt;.xsd;.manifest;.config;.addin;.xshd"> - - <Environment> - <Default color = "SystemColors.WindowText" bgcolor = "SystemColors.Window"/> - <Selection color = "SystemColors.HighlightText" bgcolor = "SystemColors.Highlight"/> -<!-- <Selection bgcolor = "LightBlue"/> --> - <VRuler color = "SystemColors.ControlLight"/> - <InvalidLines color = "Red"/> - <CaretMarker color = "Yellow"/> - - <LineNumbers color = "SystemColors.ControlDark" bgcolor = "SystemColors.Window"/> - - <FoldLine color = "#808080" bgcolor="Black"/> - <FoldMarker color = "#808080" bgcolor="White"/> - - <EOLMarkers color = "#E0E0E5"/> - <SpaceMarkers color = "#E0E0E5"/> - <TabMarkers color = "#E0E0E5"/> - </Environment> - - <Digits name="Digits" bold="false" italic="false" color="DarkBlue" /> - <RuleSets> - <RuleSet ignorecase="false" noescapesequences="true"> - <!-- It is not necessary to define span-delimiting characters as delimiters --> - <Delimiters></Delimiters> - - <Span name="Comment" bold="false" italic="false" color="DarkSlateGray" stopateol="false"> - <Begin><!--</Begin> - <End>--></End> - </Span> - <Span name="CDataSection" bold="false" italic="false" color="Blue" stopateol="false"> - <Begin><![CDATA[</Begin> - <End>]]></End> - </Span> - <Span name="DocTypeSection" bold="false" italic="false" color="Blue" stopateol="false"> - <Begin><!DOCTYPE</Begin> - <End>></End> - </Span> - <Span name="XmlDecl" bold="false" italic="false" color="Blue" stopateol="false"> - <Begin><?</Begin> - <End>?></End> - </Span> - <Span name="XmlTag" rule="XmlTagSet" bold="false" italic="false" color="DarkMagenta" stopateol="false"> - <Begin><</Begin> - <End>></End> - </Span> - <Span name="EntityReference" bold="false" italic="false" color="Blue" stopateol="true"> - <Begin>&</Begin> - <End>;</End> - </Span> - </RuleSet> - - <RuleSet name="XmlTagSet" ignorecase="false" noescapesequences="true"> - <Delimiters>/=</Delimiters> - <Span name="String" bold="false" italic="false" color="Blue" stopateol="true"> - <Begin>"</Begin> - <End>"</End> - </Span> - <Span name="Char" bold="false" italic="false" color="Blue" stopateol="true"> - <Begin>'</Begin> - <End>'</End> - </Span> - <MarkPrevious bold="false" italic="false" color="Red">=</MarkPrevious> - <KeyWords name="Slash" bold="false" italic="false" color="DarkMagenta"> - <Key word="/" /> - </KeyWords> - <KeyWords name="Assignment" bold="false" italic="false" color="Blue"> - <Key word="=" /> - </KeyWords> - </RuleSet> - </RuleSets> -</SyntaxDefinition> diff --git a/main/Unused/ICSharpCode.TextEditor/src/Actions/BookmarkActions.cs b/main/Unused/ICSharpCode.TextEditor/src/Actions/BookmarkActions.cs deleted file mode 100644 index bf66e8ffd2..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Actions/BookmarkActions.cs +++ /dev/null @@ -1,69 +0,0 @@ -// BookmarkActions.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System.Drawing; -using System; - -using MonoDevelop.TextEditor.Document; - -namespace MonoDevelop.TextEditor.Actions -{ - public class ToggleBookmark : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - textArea.Document.BookmarkManager.ToggleMarkAt(textArea.Caret.Line); - textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, textArea.Caret.Line)); - textArea.Document.CommitUpdate(); - } - } - - public class GotoPrevBookmark : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - int lineNumber = textArea.Document.BookmarkManager.GetPrevMark(textArea.Caret.Line); - if (lineNumber >= 0 && lineNumber < textArea.Document.TotalNumberOfLines) { - textArea.Caret.Line = lineNumber; - } - } - } - - public class GotoNextBookmark : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - int lineNumber = textArea.Document.BookmarkManager.GetNextMark(textArea.Caret.Line); - if (lineNumber >= 0 && lineNumber < textArea.Document.TotalNumberOfLines) { - textArea.Caret.Line = lineNumber; - } - } - } - - public class ClearAllBookmarks : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - textArea.Document.BookmarkManager.Clear(); - textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.WholeTextArea)); - textArea.Document.CommitUpdate(); - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Actions/CaretActions.cs b/main/Unused/ICSharpCode.TextEditor/src/Actions/CaretActions.cs deleted file mode 100644 index 34de2a2394..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Actions/CaretActions.cs +++ /dev/null @@ -1,126 +0,0 @@ -// CaretActions.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System.Drawing; -using System; - -using MonoDevelop.TextEditor.Document; - -namespace MonoDevelop.TextEditor.Actions -{ - public class CaretLeft : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - if (textArea.Caret.Column > 0) { - --textArea.Caret.Column; - } else if (textArea.Caret.Line > 0) { - LineSegment lineAbove = textArea.Document.GetLineSegment(textArea.Document.GetNextVisibleLineBelow(textArea.Caret.Line, 1)); - textArea.Caret.Position = new Point(lineAbove.Length, textArea.Caret.Line - 1); - } - textArea.SetDesiredColumn(); - } - } - - public class CaretRight : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - LineSegment curLine = textArea.Document.GetLineSegment(textArea.Caret.Line); - if (textArea.Caret.Column < curLine.Length || textArea.TextEditorProperties.AllowCaretBeyondEOL) { - ++textArea.Caret.Column; - } else if (textArea.Caret.Line + 1 < textArea.Document.TotalNumberOfLines) { - textArea.Caret.Position = new Point(0, textArea.Caret.Line + 1); - } - textArea.SetDesiredColumn(); - } - } - - public class CaretUp : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - if (textArea.Caret.Line > 0) { - textArea.SetCaretToDesiredColumn(textArea.Caret.Line - 1); - } - } - } - - public class CaretDown : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - if (textArea.Caret.Line + 1 < textArea.Document.TotalNumberOfLines) { - textArea.SetCaretToDesiredColumn(textArea.Caret.Line + 1); - } - } - } - - public class WordRight : CaretRight - { - public override void Execute(TextArea textArea) - { - LineSegment line = textArea.Document.GetLineSegment(textArea.Caret.Position.Y); - if (textArea.Caret.Column >= line.Length) { - textArea.Caret.Position = new Point(0, textArea.Caret.Line + 1); - } else { - - int nextWordStart = TextUtilities.FindNextWordStart(textArea.Document, textArea.Caret.Offset); - textArea.Caret.Position = textArea.Document.OffsetToPosition(nextWordStart); - textArea.SetDesiredColumn(); - } - - } - } - - public class WordLeft : CaretLeft - { - public override void Execute(TextArea textArea) - { - if (textArea.Caret.Column == 0) { - base.Execute(textArea); - } else { - LineSegment line = textArea.Document.GetLineSegment(textArea.Caret.Position.Y); - int prevWordStart = TextUtilities.FindPrevWordStart(textArea.Document, textArea.Caret.Offset); - textArea.Caret.Position = textArea.Document.OffsetToPosition(prevWordStart); - textArea.SetDesiredColumn(); - - } - } - } - - public class ScrollLineUp : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - textArea.AutoClearSelection = false; - textArea.TextView.FirstVisibleLine = Math.Max(0, textArea.TextView.FirstVisibleLine - 1); - } - } - - public class ScrollLineDown : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - textArea.AutoClearSelection = false; - textArea.TextView.FirstVisibleLine = Math.Max(0, Math.Min(textArea.Document.TotalNumberOfLines - 3, textArea.TextView.FirstVisibleLine + 1)); - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Actions/ClipBoardActions.cs b/main/Unused/ICSharpCode.TextEditor/src/Actions/ClipBoardActions.cs deleted file mode 100644 index a7136b3213..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Actions/ClipBoardActions.cs +++ /dev/null @@ -1,58 +0,0 @@ -// ClipBoardActions.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System.Drawing; -using System; - -using MonoDevelop.TextEditor.Document; - -namespace MonoDevelop.TextEditor.Actions -{ - public class Cut : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - if (textArea.Document.ReadOnly) { - return; - } - textArea.ClipboardHandler.Cut(null, null); - } - } - - public class Copy : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - textArea.AutoClearSelection = false; - textArea.ClipboardHandler.Copy(null, null); - } - } - - public class Paste : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - if (textArea.Document.ReadOnly) { - return; - } - textArea.ClipboardHandler.Paste(null, null); - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Actions/FoldActions.cs b/main/Unused/ICSharpCode.TextEditor/src/Actions/FoldActions.cs deleted file mode 100644 index 958c995ddb..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Actions/FoldActions.cs +++ /dev/null @@ -1,69 +0,0 @@ -// FoldActions.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System.Collections; -using System.Drawing; -using System; - -using MonoDevelop.TextEditor.Document; - -namespace MonoDevelop.TextEditor.Actions -{ - public class ToggleFolding : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - ArrayList foldMarkers = textArea.Document.FoldingManager.GetFoldingsWithStart(textArea.Caret.Line); - foreach (FoldMarker fm in foldMarkers) { - fm.IsFolded = !fm.IsFolded; - } - //textArea.Refresh(); - } - } - - public class ToggleAllFoldings : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - bool doFold = true; - foreach (FoldMarker fm in textArea.Document.FoldingManager.FoldMarker) { - if (fm.IsFolded) { - doFold = false; - break; - } - } - foreach (FoldMarker fm in textArea.Document.FoldingManager.FoldMarker) { - fm.IsFolded = doFold; - } - //textArea.Refresh(); - } - } - - public class ShowDefinitionsOnly : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - foreach (FoldMarker fm in textArea.Document.FoldingManager.FoldMarker) { - fm.IsFolded = fm.FoldType == FoldType.MemberBody || fm.FoldType == FoldType.Region; - } - //textArea.Refresh(); - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Actions/FormatActions.cs b/main/Unused/ICSharpCode.TextEditor/src/Actions/FormatActions.cs deleted file mode 100644 index b66504c9b6..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Actions/FormatActions.cs +++ /dev/null @@ -1,243 +0,0 @@ -// FormatActions.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using System.Text; -using System.Drawing; -using System; - -using MonoDevelop.TextEditor.Document; - -namespace MonoDevelop.TextEditor.Actions -{ - public abstract class AbstractLineFormatAction : AbstractEditAction - { - abstract protected void Convert(IDocument document, int startLine, int endLine); - - public override void Execute(TextArea textArea) - { - textArea.BeginUpdate(); - if (textArea.SelectionManager.HasSomethingSelected) { - foreach (ISelection selection in textArea.SelectionManager.SelectionCollection) { - Convert(textArea.Document, selection.StartPosition.Y, selection.EndPosition.Y); - } - } else { - Convert(textArea.Document, 0, textArea.Document.TotalNumberOfLines - 1); - } - textArea.Caret.ValidateCaretPos(); - textArea.EndUpdate(); - //textArea.Refresh(); - } - } - - public abstract class AbstractSelectionFormatAction : AbstractEditAction - { - abstract protected void Convert(IDocument document, int offset, int length); - - public override void Execute(TextArea textArea) - { - textArea.BeginUpdate(); - if (textArea.SelectionManager.HasSomethingSelected) { - foreach (ISelection selection in textArea.SelectionManager.SelectionCollection) { - Convert(textArea.Document, selection.Offset, selection.Length); - } - } else { - Convert(textArea.Document, 0, textArea.Document.TextLength); - } - textArea.Caret.ValidateCaretPos(); - textArea.EndUpdate(); - //textArea.Refresh(); - } - } - - public class RemoveLeadingWS : AbstractLineFormatAction - { - protected override void Convert(IDocument document, int y1, int y2) - { - int redocounter = 0; // must count how many Delete operations occur - for (int i = y1; i < y2; ++i) { - LineSegment line = document.GetLineSegment(i); - int removeNumber = 0; - for (int x = line.Offset; x < line.Offset + line.Length && Char.IsWhiteSpace(document.GetCharAt(x)); ++x) { - ++removeNumber; - } - if (removeNumber > 0) { - document.Remove(line.Offset, removeNumber); - ++redocounter; // count deletes - } - } - if (redocounter > 0) { - document.UndoStack.UndoLast(redocounter); // redo the whole operation (not the single deletes) - } - } - } - - public class RemoveTrailingWS : AbstractLineFormatAction - { - protected override void Convert(IDocument document, int y1, int y2) - { - int redocounter = 0; // must count how many Delete operations occur - for (int i = y2 - 1; i >= y1; --i) { - LineSegment line = document.GetLineSegment(i); - int removeNumber = 0; - for (int x = line.Offset + line.Length - 1; x >= line.Offset && Char.IsWhiteSpace(document.GetCharAt(x)); --x) { - ++removeNumber; - } - if (removeNumber > 0) { - document.Remove(line.Offset + line.Length - removeNumber, removeNumber); - ++redocounter; // count deletes - } - } - if (redocounter > 0) { - document.UndoStack.UndoLast(redocounter); // redo the whole operation (not the single deletes) - } - } - } - - - public class ToUpperCase : AbstractSelectionFormatAction - { - protected override void Convert(IDocument document, int startOffset, int length) - { - string what = document.GetText(startOffset, length).ToUpper(); - document.Replace(startOffset, length, what); - } - } - - public class ToLowerCase : AbstractSelectionFormatAction - { - protected override void Convert(IDocument document, int startOffset, int length) - { - string what = document.GetText(startOffset, length).ToLower(); - document.Replace(startOffset, length, what); - } - } - - public class InvertCaseAction : AbstractSelectionFormatAction - { - protected override void Convert(IDocument document, int startOffset, int length) - { - StringBuilder what = new StringBuilder(document.GetText(startOffset, length)); - - for (int i = 0; i < what.Length; ++i) { - what[i] = Char.IsUpper(what[i]) ? Char.ToLower(what[i]) : Char.ToUpper(what[i]); - } - - document.Replace(startOffset, length, what.ToString()); - } - } - - public class CapitalizeAction : AbstractSelectionFormatAction - { - protected override void Convert(IDocument document, int startOffset, int length) - { - StringBuilder what = new StringBuilder(document.GetText(startOffset, length)); - - for (int i = 0; i < what.Length; ++i) { - if (!Char.IsLetter(what[i]) && i < what.Length - 1) { - what[i + 1] = Char.ToUpper(what[i + 1]); - } - } - document.Replace(startOffset, length, what.ToString()); - } - - } - - public class ConvertTabsToSpaces : AbstractSelectionFormatAction - { - protected override void Convert(IDocument document, int startOffset, int length) - { - string what = document.GetText(startOffset, length); - string spaces = new string(' ', document.TextEditorProperties.TabIndent); - document.Replace(startOffset, length, what.Replace("\t", spaces)); - } - } - - public class ConvertSpacesToTabs : AbstractSelectionFormatAction - { - protected override void Convert(IDocument document, int startOffset, int length) - { - string what = document.GetText(startOffset, length); - string spaces = new string(' ', document.TextEditorProperties.TabIndent); - document.Replace(startOffset, length, what.Replace(spaces, "\t")); - } - } - - public class ConvertLeadingTabsToSpaces : AbstractLineFormatAction - { - protected override void Convert(IDocument document, int y1, int y2) - { - int redocounter = 0; - for (int i = y2; i >= y1; --i) { - LineSegment line = document.GetLineSegment(i); - - if(line.Length > 0) { - // count how many whitespace characters there are at the start - int whiteSpace = 0; - for(whiteSpace = 0; whiteSpace < line.Length && Char.IsWhiteSpace(document.GetCharAt(line.Offset + whiteSpace)); whiteSpace++) { - // deliberately empty - } - if(whiteSpace > 0) { - string newLine = document.GetText(line.Offset,whiteSpace); - string newPrefix = newLine.Replace("\t",new string(' ', document.TextEditorProperties.TabIndent)); - document.Replace(line.Offset,whiteSpace,newPrefix); - ++redocounter; - } - } - } - - if (redocounter > 0) { - document.UndoStack.UndoLast(redocounter); // redo the whole operation (not the single deletes) - } - } - } - - public class ConvertLeadingSpacesToTabs : AbstractLineFormatAction - { - protected override void Convert(IDocument document, int y1, int y2) - { - int redocounter = 0; - for (int i = y2; i >= y1; --i) { - LineSegment line = document.GetLineSegment(i); - if(line.Length > 0) { - /// note: some users may prefer a more radical ConvertLeadingSpacesToTabs that - /// means there can be no spaces before the first character even if the spaces - /// didn't add up to a whole number of tabs - string newLine = TextUtilities.LeadingWhiteSpaceToTabs(document.GetText(line.Offset,line.Length), document.TextEditorProperties.TabIndent); - document.Replace(line.Offset,line.Length,newLine); - ++redocounter; - } - } - - if (redocounter > 0) { - document.UndoStack.UndoLast(redocounter); // redo the whole operation (not the single deletes) - } - } - } - - /// <summary> - /// This is a sample editaction plugin, it indents the selected area. - /// </summary> - public class FormatBuffer : AbstractLineFormatAction - { - protected override void Convert(IDocument document, int startLine, int endLine) - { - document.FormattingStrategy.IndentLines(document, startLine, endLine); - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Actions/HomeEndActions.cs b/main/Unused/ICSharpCode.TextEditor/src/Actions/HomeEndActions.cs deleted file mode 100644 index 50256066f1..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Actions/HomeEndActions.cs +++ /dev/null @@ -1,91 +0,0 @@ -// HomeEndActions.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; - -using MonoDevelop.TextEditor.Document; - -namespace MonoDevelop.TextEditor.Actions -{ - public class Home : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - LineSegment curLine = textArea.Document.GetLineSegment(textArea.Caret.Line); - - if (TextUtilities.IsEmptyLine(textArea.Document, curLine)) { - if (textArea.Caret.Column != 0) { - textArea.Caret.Column = 0; - } else { - textArea.Caret.Column = curLine.Length; - } - } else { - int firstCharOffset = TextUtilities.GetFirstNonWSChar(textArea.Document, curLine.Offset); - int firstCharColumn = firstCharOffset - curLine.Offset; - - if (textArea.Caret.Column == firstCharColumn) { - textArea.Caret.Column = 0; - } else { - textArea.Caret.Column = firstCharColumn; - } - } - - textArea.SetDesiredColumn(); - } - } - - public class End : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - LineSegment curLine = textArea.Document.GetLineSegment(textArea.Caret.Line); - if (textArea.Caret.Column != curLine.Length) { - textArea.Caret.Column = curLine.Length; - textArea.SetDesiredColumn(); - } - } - } - - - public class MoveToStart : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - if (textArea.Caret.Line != 0 || textArea.Caret.Column != 0) { - textArea.Caret.Position = new Point(0, 0); - textArea.SetDesiredColumn(); - } - } - } - - - public class MoveToEnd : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - Point endPos = textArea.Document.OffsetToPosition(textArea.Document.TextLength); - if (textArea.Caret.Position != endPos) { - textArea.Caret.Position = endPos; - textArea.SetDesiredColumn(); - } - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Actions/IEditAction.cs b/main/Unused/ICSharpCode.TextEditor/src/Actions/IEditAction.cs deleted file mode 100644 index 667daae733..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Actions/IEditAction.cs +++ /dev/null @@ -1,74 +0,0 @@ -// IEditAction.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; - -using MonoDevelop.TextEditor.Document; - -using Gdk; - -namespace MonoDevelop.TextEditor.Actions -{ - /// <summary> - /// To define a new key for the textarea, you must write a class which - /// implements this interface. - /// </summary> - public interface IEditAction - { - /// <value> - /// An array of keys on which this edit action occurs. - /// </value> - Gdk.Key[] Keys { - get; - set; - } - - /// <remarks> - /// When the key which is defined per XML is pressed, this method will be launched. - /// </remarks> - void Execute(TextArea textArea); - } - - /// <summary> - /// To define a new key for the textarea, you must write a class which - /// implements this interface. - /// </summary> - public abstract class AbstractEditAction : IEditAction - { - Gdk.Key[] keys = null; - - /// <value> - /// An array of keys on which this edit action occurs. - /// </value> - public Gdk.Key[] Keys { - get { - return keys; - } - set { - keys = value; - } - } - - /// <remarks> - /// When the key which is defined per XML is pressed, this method will be launched. - /// </remarks> - public abstract void Execute(TextArea textArea); - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Actions/MiscActions.cs b/main/Unused/ICSharpCode.TextEditor/src/Actions/MiscActions.cs deleted file mode 100644 index c84346d00b..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Actions/MiscActions.cs +++ /dev/null @@ -1,705 +0,0 @@ -// MiscActions.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Text; - -using MonoDevelop.TextEditor.Document; - -namespace MonoDevelop.TextEditor.Actions -{ - public class Tab : AbstractEditAction - { - public static string GetIndentationString(IDocument document) - { - return document.IndentString; - } - - void InsertTabs(IDocument document, ISelection selection, int y1, int y2) - { - int redocounter = 0; - string indentationString = GetIndentationString(document); - for (int i = y2; i >= y1; --i) { - LineSegment line = document.GetLineSegment(i); - if (i == y2 && i == selection.EndPosition.Y && selection.EndPosition.X == 0) { - continue; - } - - // this bit is optional - but useful if you are using block tabbing to sort out - // a source file with a mixture of tabs and spaces -// string newLine = document.GetText(line.Offset,line.Length); -// document.Replace(line.Offset,line.Length,newLine); -// ++redocounter; - - document.Insert(line.Offset, indentationString); - ++redocounter; - } - - if (redocounter > 0) { - document.UndoStack.UndoLast(redocounter); // redo the whole operation (not the single deletes) - } - } - - void InsertTabAtCaretPosition(TextArea textArea) - { - switch (textArea.Caret.CaretMode) { - case CaretMode.InsertMode: - textArea.InsertString(GetIndentationString(textArea.Document)); - break; - case CaretMode.OverwriteMode: - string indentStr = GetIndentationString(textArea.Document); - textArea.ReplaceChar(indentStr[0]); - if (indentStr.Length > 1) { - textArea.InsertString(indentStr.Substring(1)); - } - break; - } - textArea.SetDesiredColumn(); - } - /// <remarks> - /// Executes this edit action - /// </remarks> - /// <param name="textArea">The <see cref="ItextArea"/> which is used for callback purposes</param> - public override void Execute(TextArea textArea) - { - if (textArea.Document.ReadOnly) { - return; - } - if (textArea.SelectionManager.HasSomethingSelected) { - foreach (ISelection selection in textArea.SelectionManager.SelectionCollection) { - int startLine = selection.StartPosition.Y; - int endLine = selection.EndPosition.Y; - if (startLine != endLine) { - textArea.BeginUpdate(); - InsertTabs(textArea.Document, selection, startLine, endLine); - textArea.Document.UpdateQueue.Clear(); - textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.LinesBetween, startLine, endLine)); - textArea.EndUpdate(); - } else { - InsertTabAtCaretPosition(textArea); - break; - } - } - textArea.Document.CommitUpdate(); - textArea.AutoClearSelection = false; - } else { - InsertTabAtCaretPosition(textArea); - } - } - } - - public class ShiftTab : AbstractEditAction - { - void RemoveTabs(IDocument document, ISelection selection, int y1, int y2) - { - int redocounter = 0; - for (int i = y2; i >= y1; --i) { - LineSegment line = document.GetLineSegment(i); - if (i == y2 && line.Offset == selection.EndOffset) { - continue; - } - if (line.Length > 0) { - /**** TextPad Strategy: - /// first convert leading whitespace to tabs (controversial! - not all editors work like this) - string newLine = TextUtilities.LeadingWhiteSpaceToTabs(document.GetText(line.Offset,line.Length),document.Properties.GetProperty("TabIndent", 4)); - if(newLine.Length > 0 && newLine[0] == '\t') { - document.Replace(line.Offset,line.Length,newLine.Substring(1)); - ++redocounter; - } - else if(newLine.Length > 0 && newLine[0] == ' ') { - /// there were just some leading spaces but less than TabIndent of them - int leadingSpaces = 1; - for(leadingSpaces = 1; leadingSpaces < newLine.Length && newLine[leadingSpaces] == ' '; leadingSpaces++) { - /// deliberately empty - } - document.Replace(line.Offset,line.Length,newLine.Substring(leadingSpaces)); - ++redocounter; - } - /// else - /// there were no leading tabs or spaces on this line so do nothing - /// MS Visual Studio 6 strategy: - ****/ -// string temp = document.GetText(line.Offset,line.Length); - if (line.Length > 0) { - int charactersToRemove = 0; - if(document.GetCharAt(line.Offset) == '\t') { // first character is a tab - just remove it - charactersToRemove = 1; - } else if(document.GetCharAt(line.Offset) == ' ') { - int leadingSpaces = 1; - int tabIndent = document.TextEditorProperties.TabIndent; - for (leadingSpaces = 1; leadingSpaces < line.Length && document.GetCharAt(line.Offset + leadingSpaces) == ' '; leadingSpaces++) { - // deliberately empty - } - if(leadingSpaces >= tabIndent) { - // just remove tabIndent - charactersToRemove = tabIndent; - } - else if(line.Length > leadingSpaces && document.GetCharAt(line.Offset + leadingSpaces) == '\t') { - // remove the leading spaces and the following tab as they add up - // to just one tab stop - charactersToRemove = leadingSpaces+1; - } - else { - // just remove the leading spaces - charactersToRemove = leadingSpaces; - } - } - if (charactersToRemove > 0) { - document.Remove(line.Offset,charactersToRemove); - ++redocounter; - } - } - } - } - - if (redocounter > 0) { - document.UndoStack.UndoLast(redocounter); // redo the whole operation (not the single deletes) - } - } - - /// <remarks> - /// Executes this edit action - /// </remarks> - /// <param name="textArea">The <see cref="ItextArea"/> which is used for callback purposes</param> - public override void Execute(TextArea textArea) - { - if (textArea.SelectionManager.HasSomethingSelected) { - foreach (ISelection selection in textArea.SelectionManager.SelectionCollection) { - int startLine = selection.StartPosition.Y; - int endLine = selection.EndPosition.Y; - textArea.BeginUpdate(); - RemoveTabs(textArea.Document, selection, startLine, endLine); - textArea.Document.UpdateQueue.Clear(); - textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.LinesBetween, startLine, endLine)); - textArea.EndUpdate(); - - } - textArea.AutoClearSelection = false; - } else { - // Pressing Shift-Tab with nothing selected the cursor will move back to the - // previous tab stop. It will stop at the beginning of the line. Also, the desired - // column is updated to that column. - LineSegment line = textArea.Document.GetLineSegmentForOffset(textArea.Caret.Offset); - string startOfLine = textArea.Document.GetText(line.Offset,textArea.Caret.Offset - line.Offset); - int tabIndent = textArea.Document.TextEditorProperties.TabIndent; - int currentColumn = textArea.Caret.Column; - int remainder = currentColumn % tabIndent; - if (remainder == 0) { - textArea.Caret.DesiredColumn = Math.Max(0, currentColumn - tabIndent); - } else { - textArea.Caret.DesiredColumn = Math.Max(0, currentColumn - remainder); - } - textArea.SetCaretToDesiredColumn(textArea.Caret.Line); - } - } - } - - public class ToggleComment : AbstractEditAction - { - int firstLine; - int lastLine; - - void RemoveCommentAt(IDocument document, string comment, ISelection selection, int y1, int y2) - { - int redocounter = 0; - firstLine = y1; - lastLine = y2; - - for (int i = y2; i >= y1; --i) { - LineSegment line = document.GetLineSegment(i); - if (selection != null && i == y2 && line.Offset == selection.Offset + selection.Length) { - --lastLine; - continue; - } - - string lineText = document.GetText(line.Offset, line.Length); - if (lineText.Trim().StartsWith(comment)) { - document.Remove(line.Offset + lineText.IndexOf(comment), comment.Length); - ++redocounter; - } - } - - if (redocounter > 0) { - document.UndoStack.UndoLast(redocounter); // redo the whole operation (not the single deletes) - } - } - - void SetCommentAt(IDocument document, string comment, ISelection selection, int y1, int y2) - { - int redocounter = 0; - firstLine = y1; - lastLine = y2; - - for (int i = y2; i >= y1; --i) { - LineSegment line = document.GetLineSegment(i); - if (selection != null && i == y2 && line.Offset == selection.Offset + selection.Length) { - --lastLine; - continue; - } - - string lineText = document.GetText(line.Offset, line.Length); - document.Insert(line.Offset, comment); - ++redocounter; - } - - if (redocounter > 0) { - document.UndoStack.UndoLast(redocounter); // redo the whole operation (not the single deletes) - } - } - - bool ShouldComment(IDocument document, string comment, ISelection selection, int startLine, int endLine) - { - for (int i = endLine; i >= startLine; --i) { - LineSegment line = document.GetLineSegment(i); - if (selection != null && i == endLine && line.Offset == selection.Offset + selection.Length) { - --lastLine; - continue; - } - string lineText = document.GetText(line.Offset, line.Length); - if (!lineText.Trim().StartsWith(comment)) { - return true; - } - } - return false; - } - - /// <remarks> - /// Executes this edit action - /// </remarks> - /// <param name="textArea">The <see cref="ItextArea"/> which is used for callback purposes</param> - public override void Execute(TextArea textArea) - { - if (textArea.Document.ReadOnly) { - return; - } - - string comment = null; - if (textArea.Document.HighlightingStrategy.Properties["LineComment"] != null) { - comment = textArea.Document.HighlightingStrategy.Properties["LineComment"].ToString(); - } - - if (comment == null || comment.Length == 0) { - return; - } - - if (textArea.SelectionManager.HasSomethingSelected) { - bool shouldComment = true; - foreach (ISelection selection in textArea.SelectionManager.SelectionCollection) { - if (!ShouldComment(textArea.Document, comment, selection, selection.StartPosition.Y, selection.EndPosition.Y)) { - shouldComment = false; - break; - } - } - - foreach (ISelection selection in textArea.SelectionManager.SelectionCollection) { - textArea.BeginUpdate(); - if (shouldComment) { - SetCommentAt(textArea.Document, comment, selection, selection.StartPosition.Y, selection.EndPosition.Y); - } else { - RemoveCommentAt(textArea.Document, comment, selection, selection.StartPosition.Y, selection.EndPosition.Y); - } - textArea.Document.UpdateQueue.Clear(); - textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.LinesBetween, firstLine, lastLine)); - textArea.EndUpdate(); - } - textArea.Document.CommitUpdate(); - textArea.AutoClearSelection = false; - } else { - textArea.BeginUpdate(); - int caretLine = textArea.Caret.Line; - if (ShouldComment(textArea.Document, comment, null, caretLine, caretLine)) { - SetCommentAt(textArea.Document, comment, null, caretLine, caretLine); - } else { - RemoveCommentAt(textArea.Document, comment, null, caretLine, caretLine); - } - textArea.Document.UpdateQueue.Clear(); - textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, caretLine)); - textArea.EndUpdate(); - } - } - } - - public class IndentSelection : AbstractEditAction - { - /// <remarks> - /// Executes this edit action - /// </remarks> - /// <param name="textArea">The <see cref="ItextArea"/> which is used for callback purposes</param> - public override void Execute(TextArea textArea) - { - IDocument d = textArea.Document; - - if (d.ReadOnly) - return; - - textArea.BeginUpdate(); - if (textArea.SelectionManager.HasSomethingSelected) { - foreach (ISelection selection in textArea.SelectionManager.SelectionCollection) - d.FormattingStrategy.IndentLines (d, selection.StartPosition.Y, selection.EndPosition.Y); - } else - d.FormattingStrategy.IndentLines (d, 0, textArea.Document.TotalNumberOfLines - 1); - - textArea.EndUpdate(); - //textArea.Refresh(); - } - } - - public class Backspace : AbstractEditAction - { - /// <remarks> - /// Executes this edit action - /// </remarks> - /// <param name="textArea">The <see cref="ItextArea"/> which is used for callback purposes</param> - public override void Execute(TextArea textArea) - { - if (textArea.Document.ReadOnly) { - return; - } - if (textArea.SelectionManager.HasSomethingSelected) { - textArea.BeginUpdate(); - textArea.Caret.Position = textArea.SelectionManager.SelectionCollection[0].StartPosition; - textArea.SelectionManager.RemoveSelectedText(); - textArea.ScrollToCaret(); - textArea.EndUpdate(); - } else { - if (textArea.Caret.Offset > 0) { - textArea.BeginUpdate(); - int curLineNr = textArea.Document.GetLineNumberForOffset(textArea.Caret.Offset); - int curLineOffset = textArea.Document.GetLineSegment(curLineNr).Offset; - - if (curLineOffset == textArea.Caret.Offset) { - LineSegment line = textArea.Document.GetLineSegment(curLineNr - 1); - bool lastLine = curLineNr == textArea.Document.TotalNumberOfLines; - int lineEndOffset = line.Offset + line.Length; - int lineLength = line.Length; - textArea.Document.Remove(lineEndOffset, curLineOffset - lineEndOffset); - textArea.Caret.Position = new Point(lineLength, curLineNr - 1); - textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.PositionToEnd, new Point(0, curLineNr - 1))); - textArea.EndUpdate(); - } else { - int caretOffset = textArea.Caret.Offset - 1; - textArea.Caret.Position = textArea.Document.OffsetToPosition(caretOffset); - textArea.Document.Remove(caretOffset, 1); - -// textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.PositionToLineEnd, new Point(textArea.Caret.Offset - textArea.Document.GetLineSegment(curLineNr).Offset, curLineNr))); - textArea.EndUpdate(); - } - } - } - } - } - - public class Delete : AbstractEditAction - { - /// <remarks> - /// Executes this edit action - /// </remarks> - /// <param name="textArea">The <see cref="ItextArea"/> which is used for callback purposes</param> - public override void Execute(TextArea textArea) - { - if (textArea.Document.ReadOnly) { - return; - } - if (textArea.SelectionManager.HasSomethingSelected) { - textArea.BeginUpdate(); - textArea.Caret.Position = textArea.SelectionManager.SelectionCollection[0].StartPosition; - textArea.SelectionManager.RemoveSelectedText(); - textArea.ScrollToCaret(); - textArea.EndUpdate(); - } else { - - if (textArea.Caret.Offset < textArea.Document.TextLength) { - textArea.BeginUpdate(); - int curLineNr = textArea.Document.GetLineNumberForOffset(textArea.Caret.Offset); - LineSegment curLine = textArea.Document.GetLineSegment(curLineNr); - - if (curLine.Offset + curLine.Length == textArea.Caret.Offset) { - if (curLineNr + 1 < textArea.Document.TotalNumberOfLines) { - LineSegment nextLine = textArea.Document.GetLineSegment(curLineNr + 1); - - textArea.Document.Remove(textArea.Caret.Offset, nextLine.Offset - textArea.Caret.Offset); - textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.PositionToEnd, new Point(0, curLineNr))); - } - } else { - textArea.Document.Remove(textArea.Caret.Offset, 1); -// textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.PositionToLineEnd, new Point(textArea.Caret.Offset - textArea.Document.GetLineSegment(curLineNr).Offset, curLineNr))); - } - textArea.UpdateMatchingBracket(); - textArea.EndUpdate(); - } - } - } - } - - public class MovePageDown : AbstractEditAction - { - /// <remarks> - /// Executes this edit action - /// </remarks> - /// <param name="textArea">The <see cref="ItextArea"/> which is used for callback purposes</param> - public override void Execute(TextArea textArea) - { - int curLineNr = textArea.Caret.Line; - int requestedLineNumber = Math.Min(textArea.Document.GetNextVisibleLineAbove(curLineNr, textArea.TextView.VisibleLineCount), textArea.Document.TotalNumberOfLines - 1); - - if (curLineNr != requestedLineNumber) { - textArea.Caret.Position = new Point(textArea.Caret.DesiredColumn, requestedLineNumber); - } - } - } - - public class MovePageUp : AbstractEditAction - { - /// <remarks> - /// Executes this edit action - /// </remarks> - /// <param name="textArea">The <see cref="ItextArea"/> which is used for callback purposes</param> - public override void Execute(TextArea textArea) - { - int curLineNr = textArea.Caret.Line; - int requestedLineNumber = Math.Max(textArea.Document.GetNextVisibleLineBelow(curLineNr, textArea.TextView.VisibleLineCount), 0); - - if (curLineNr != requestedLineNumber) { - textArea.Caret.Position = new Point(textArea.Caret.DesiredColumn, requestedLineNumber); - } - } - } - - public class Return : AbstractEditAction - { - /// <remarks> - /// Executes this edit action - /// </remarks> - /// <param name="textArea">The <see cref="ItextArea"/> which is used for callback purposes</param> - public override void Execute(TextArea textArea) - { - IDocument d = textArea.Document; - - if (d.ReadOnly) - return; - - textArea.BeginUpdate(); - textArea.InsertChar('\n'); - - ++textArea.Caret.Line; - int curLineNr = textArea.Caret.Line; - textArea.Caret.Column = d.FormattingStrategy.FormatLine (d, curLineNr, textArea.Caret.Offset, '\n'); - textArea.SetDesiredColumn(); - - textArea.Document.UpdateQueue.Clear(); - textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.PositionToEnd, new Point(0, curLineNr - 1))); - textArea.EndUpdate(); - } - } - - public class ToggleEditMode : AbstractEditAction - { - /// <remarks> - /// Executes this edit action - /// </remarks> - /// <param name="textArea">The <see cref="ItextArea"/> which is used for callback purposes</param> - public override void Execute(TextArea textArea) - { - if (textArea.Document.ReadOnly) { - return; - } - switch (textArea.Caret.CaretMode) { - case CaretMode.InsertMode: - textArea.Caret.CaretMode = CaretMode.OverwriteMode; - break; - case CaretMode.OverwriteMode: - textArea.Caret.CaretMode = CaretMode.InsertMode; - break; - } - } - } - - public class Undo : AbstractEditAction - { - /// <remarks> - /// Executes this edit action - /// </remarks> - /// <param name="textArea">The <see cref="ItextArea"/> which is used for callback purposes</param> - public override void Execute(TextArea textArea) - { - textArea.MotherTextEditorControl.Undo(); - } - } - - public class Redo : AbstractEditAction - { - /// <remarks> - /// Executes this edit action - /// </remarks> - /// <param name="textArea">The <see cref="ItextArea"/> which is used for callback purposes</param> - public override void Execute(TextArea textArea) - { - textArea.MotherTextEditorControl.Redo(); - } - } - - /// <summary> - /// handles the ctrl-backspace key - /// functionality attempts to roughly mimic MS Developer studio - /// I will implement this as deleting back to the point that ctrl-leftarrow would - /// take you to - /// </summary> - public class WordBackspace : AbstractEditAction - { - /// <remarks> - /// Executes this edit action - /// </remarks> - /// <param name="textArea">The <see cref="ItextArea"/> which is used for callback purposes</param> - public override void Execute(TextArea textArea) - { - // if anything is selected we will just delete it first - textArea.BeginUpdate(); - if (textArea.SelectionManager.HasSomethingSelected) { - textArea.SelectionManager.RemoveSelectedText(); - textArea.ScrollToCaret(); - } - // now delete from the caret to the beginning of the word - LineSegment line = - textArea.Document.GetLineSegmentForOffset(textArea.Caret.Offset); - // if we are not at the beginning of a line - if(textArea.Caret.Offset > line.Offset) { - int prevWordStart = TextUtilities.FindPrevWordStart(textArea.Document, - textArea.Caret.Offset); - if(prevWordStart < textArea.Caret.Offset) { - textArea.Document.Remove(prevWordStart,textArea.Caret.Offset - - prevWordStart); - textArea.Caret.Position = textArea.Document.OffsetToPosition(prevWordStart); - } - } - // if we are now at the beginning of a line - if(textArea.Caret.Offset == line.Offset) { - // if we are not on the first line - int curLineNr = - textArea.Document.GetLineNumberForOffset(textArea.Caret.Offset); - if(curLineNr > 0) { - // move to the end of the line above - LineSegment lineAbove = textArea.Document.GetLineSegment(curLineNr - - 1); - int endOfLineAbove = lineAbove.Offset + lineAbove.Length; - int charsToDelete = textArea.Caret.Offset - endOfLineAbove; - textArea.Document.Remove(endOfLineAbove,charsToDelete); - textArea.Caret.Position = textArea.Document.OffsetToPosition(endOfLineAbove); - } - } - textArea.SetDesiredColumn(); - textArea.EndUpdate(); - // if there are now less lines, we need this or there are redraw problems - textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.PositionToEnd, new Point(0, textArea.Document.GetLineNumberForOffset(textArea.Caret.Offset)))); - textArea.Document.CommitUpdate(); - } - } - - /// <summary> - /// handles the ctrl-delete key - /// functionality attempts to mimic MS Developer studio - /// I will implement this as deleting forwardto the point that - /// ctrl-leftarrow would take you to - /// </summary> - public class DeleteWord : Delete - { - /// <remarks> - /// Executes this edit action - /// </remarks> - /// <param name="textArea">The <see cref="ItextArea"/> which is used for callback purposes</param> - public override void Execute(TextArea textArea) - { - // if anything is selected we will just delete it first - textArea.BeginUpdate(); - if (textArea.SelectionManager.HasSomethingSelected) { - textArea.SelectionManager.RemoveSelectedText(); - textArea.ScrollToCaret(); - } - // now delete from the caret to the beginning of the word - LineSegment line = - textArea.Document.GetLineSegmentForOffset(textArea.Caret.Offset); - if(textArea.Caret.Offset == line.Offset + line.Length) { - // if we are at the end of a line - base.Execute(textArea); - } else { - int nextWordStart = TextUtilities.FindNextWordStart(textArea.Document, - textArea.Caret.Offset); - if(nextWordStart > textArea.Caret.Offset) { - textArea.Document.Remove(textArea.Caret.Offset,nextWordStart - - textArea.Caret.Offset); - // cursor never moves with this command - } - } - textArea.UpdateMatchingBracket(); - textArea.EndUpdate(); - // if there are now less lines, we need this or there are redraw problems - textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.PositionToEnd, new Point(0, textArea.Document.GetLineNumberForOffset(textArea.Caret.Offset)))); - textArea.Document.CommitUpdate(); - } - } - - public class DeleteLine : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - int lineNr = textArea.Caret.Line; - LineSegment line = textArea.Document.GetLineSegment(lineNr); - textArea.Document.Remove(line.Offset, line.TotalLength); - textArea.Caret.Position = textArea.Document.OffsetToPosition(line.Offset); - - textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.PositionToEnd, new Point(0, lineNr))); - textArea.UpdateMatchingBracket(); - textArea.Document.CommitUpdate(); - } - } - - public class DeleteToLineEnd : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - int lineNr = textArea.Caret.Line; - LineSegment line = textArea.Document.GetLineSegment(lineNr); - - int numRemove = (line.Offset + line.Length) - textArea.Caret.Offset; - if (numRemove > 0) { - textArea.Document.Remove(textArea.Caret.Offset, numRemove); - textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, new Point(0, lineNr))); - textArea.Document.CommitUpdate(); - } - } - } - - public class GotoMatchingBrace : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - if (textArea.TextView.Highlight != null) { - Point p1 = new Point(textArea.TextView.Highlight.CloseBrace.X + 1, textArea.TextView.Highlight.CloseBrace.Y); - Point p2 = new Point(textArea.TextView.Highlight.OpenBrace.X + 1, textArea.TextView.Highlight.OpenBrace.Y); - if (p1 == textArea.Caret.Position) { - textArea.Caret.Position = p2; - } else { - textArea.Caret.Position = p1; - } - textArea.SetDesiredColumn(); - } - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Actions/SelectionActions.cs b/main/Unused/ICSharpCode.TextEditor/src/Actions/SelectionActions.cs deleted file mode 100644 index b3e0d67567..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Actions/SelectionActions.cs +++ /dev/null @@ -1,184 +0,0 @@ -// SelectionActions.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System.Drawing; -using System; - -using MonoDevelop.TextEditor.Document; - -namespace MonoDevelop.TextEditor.Actions -{ - public class ShiftCaretRight : CaretRight - { - public override void Execute(TextArea textArea) - { - Point oldCaretPos = textArea.Caret.Position; - base.Execute(textArea); - textArea.AutoClearSelection = false; - textArea.SelectionManager.ExtendSelection(oldCaretPos, textArea.Caret.Position); - } - } - - public class ShiftCaretLeft : CaretLeft - { - public override void Execute(TextArea textArea) - { - Point oldCaretPos = textArea.Caret.Position; - base.Execute(textArea); - textArea.AutoClearSelection = false; - textArea.SelectionManager.ExtendSelection(oldCaretPos, textArea.Caret.Position); - } - } - - public class ShiftCaretUp : CaretUp - { - public override void Execute(TextArea textArea) - { - Point oldCaretPos = textArea.Caret.Position; - base.Execute(textArea); - textArea.AutoClearSelection = false; - textArea.SelectionManager.ExtendSelection(oldCaretPos, textArea.Caret.Position); - } - } - - public class ShiftCaretDown : CaretDown - { - public override void Execute(TextArea textArea) - { - Point oldCaretPos = textArea.Caret.Position; - base.Execute(textArea); - textArea.AutoClearSelection = false; - textArea.SelectionManager.ExtendSelection(oldCaretPos, textArea.Caret.Position); - } - } - - public class ShiftWordRight : WordRight - { - public override void Execute(TextArea textArea) - { - Point oldCaretPos = textArea.Caret.Position; - base.Execute(textArea); - textArea.AutoClearSelection = false; - textArea.SelectionManager.ExtendSelection(oldCaretPos, textArea.Caret.Position); - } - } - - public class ShiftWordLeft : WordLeft - { - public override void Execute(TextArea textArea) - { - Point oldCaretPos = textArea.Caret.Position; - base.Execute(textArea); - textArea.AutoClearSelection = false; - textArea.SelectionManager.ExtendSelection(oldCaretPos, textArea.Caret.Position); - } - } - - public class ShiftHome : Home - { - public override void Execute(TextArea textArea) - { - Point oldCaretPos = textArea.Caret.Position; - base.Execute(textArea); - textArea.AutoClearSelection = false; - textArea.SelectionManager.ExtendSelection(oldCaretPos, textArea.Caret.Position); - } - } - - public class ShiftEnd : End - { - public override void Execute(TextArea textArea) - { - Point oldCaretPos = textArea.Caret.Position; - base.Execute(textArea); - textArea.AutoClearSelection = false; - textArea.SelectionManager.ExtendSelection(oldCaretPos, textArea.Caret.Position); - } - } - - public class ShiftMoveToStart : MoveToStart - { - public override void Execute(TextArea textArea) - { - Point oldCaretPos = textArea.Caret.Position; - base.Execute(textArea); - textArea.AutoClearSelection = false; - textArea.SelectionManager.ExtendSelection(oldCaretPos, textArea.Caret.Position); - } - } - - public class ShiftMoveToEnd : MoveToEnd - { - public override void Execute(TextArea textArea) - { - Point oldCaretPos = textArea.Caret.Position; - base.Execute(textArea); - textArea.AutoClearSelection = false; - textArea.SelectionManager.ExtendSelection(oldCaretPos, textArea.Caret.Position); - } - } - - public class ShiftMovePageUp : MovePageUp - { - public override void Execute(TextArea textArea) - { - Point oldCaretPos = textArea.Caret.Position; - base.Execute(textArea); - textArea.AutoClearSelection = false; - textArea.SelectionManager.ExtendSelection(oldCaretPos, textArea.Caret.Position); - } - } - - public class ShiftMovePageDown : MovePageDown - { - public override void Execute(TextArea textArea) - { - Point oldCaretPos = textArea.Caret.Position; - base.Execute(textArea); - textArea.AutoClearSelection = false; - textArea.SelectionManager.ExtendSelection(oldCaretPos, textArea.Caret.Position); - } - } - - public class SelectWholeDocument : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - textArea.AutoClearSelection = false; - Point startPoint = new Point(0, 0); - Point endPoint = textArea.Document.OffsetToPosition(textArea.Document.TextLength); - if (textArea.SelectionManager.HasSomethingSelected) { - if (textArea.SelectionManager.SelectionCollection[0].StartPosition == startPoint && - textArea.SelectionManager.SelectionCollection[0].EndPosition == endPoint) { - return; - } - } - textArea.SelectionManager.SetSelection(new DefaultSelection(textArea.Document, startPoint, endPoint)); - } - } - - public class ClearAllSelections : AbstractEditAction - { - public override void Execute(TextArea textArea) - { - textArea.SelectionManager.ClearSelection(); - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/AssemblyInfo.cs b/main/Unused/ICSharpCode.TextEditor/src/AssemblyInfo.cs deleted file mode 100644 index e4cf350d5d..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -// AssemblyInfo.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using System.Reflection; -using System.Runtime.CompilerServices; - -[assembly: AssemblyTitle("MonoDevelop.TextEditor")] -[assembly: AssemblyDescription("A .NET text editor control")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyProduct("MonoDevelop.TextEditor")] -[assembly: AssemblyCopyright("MonoDevelop")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -[assembly: AssemblyVersion("0.1.0.0")] - -[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("../../data/MonoDevelop.TextEditor.key")] -[assembly: AssemblyKeyFile("")] -[assembly: AssemblyKeyName("")] diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/AbstractSegment.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/AbstractSegment.cs deleted file mode 100644 index d7e5ad5812..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/AbstractSegment.cs +++ /dev/null @@ -1,53 +0,0 @@ -// AbstractSegment.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using MonoDevelop.TextEditor.Undo; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// This interface is used to describe a span inside a text sequence - /// </summary> - public class AbstractSegment : ISegment - { - protected int offset = -1; - protected int length = -1; - -#region MonoDevelop.TextEditor.Document.ISegment interface implementation - public virtual int Offset { - get { - return offset; - } - set { - offset = value; - } - } - - public virtual int Length { - get { - return length; - } - set { - length = value; - } - } -#endregion - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/BookmarkManager/BookmarkManager.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/BookmarkManager/BookmarkManager.cs deleted file mode 100644 index d6784a5782..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/BookmarkManager/BookmarkManager.cs +++ /dev/null @@ -1,223 +0,0 @@ -// BookmarkManager.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// This class handles the bookmarks for a buffer - /// </summary> - public class BookmarkManager : IBookMarkManager - { - ArrayList bookmark = new ArrayList(); - - /// <value> - /// Contains all bookmarks as int values - /// </value> - public ArrayList Marks { - get { - return bookmark; - } - } - - /// <summary> - /// Creates a new instance of <see cref="BookmarkManager"/> - /// </summary> - public BookmarkManager(ILineManager lineTracker) - { - lineTracker.LineCountChanged += new LineManagerEventHandler(MoveIndices); - } - - void OnChanged() - { - if (Changed != null) { - Changed(this, null); - } - } - void OnBeforeChanged() - { - if (BeforeChanged != null) { - BeforeChanged(this, null); - } - } - - /// <remarks> - /// Sets the mark at the line <code>lineNr</code> if it is not set, if the - /// line is already marked the mark is cleared. - /// </remarks> - public void ToggleMarkAt(int lineNr) - { - OnBeforeChanged(); - for (int i = 0; i < bookmark.Count; ++i) { - if ((int)bookmark[i] == lineNr) { - bookmark.RemoveAt(i); - OnChanged(); - return; - } - } - bookmark.Add(lineNr); - OnChanged(); - } - - /// <returns> - /// true, if a mark at mark exists, otherwise false - /// </returns> - public bool IsMarked(int lineNr) - { - for (int i = 0; i < bookmark.Count; ++i) { - if ((int)bookmark[i] == lineNr) { - return true; - } - } - return false; - } - - /// <summary> - /// This method moves all indices from index upward count lines - /// (useful for deletion/insertion of text) - /// </summary> - void MoveIndices(object sender,LineManagerEventArgs e) - { - bool changed = false; - OnBeforeChanged(); - for (int i = 0; i < bookmark.Count; ++i) { - int mark = (int)bookmark[i]; - if (e.LinesMoved < 0 && mark == e.LineStart) { - bookmark.RemoveAt(i); - --i; - changed = true; - } else if (mark > e.LineStart + 1 || (e.LinesMoved < 0 && mark > e.LineStart)) { - changed = true; - bookmark[i] = mark + e.LinesMoved; - } - } - - if (changed) { - OnChanged(); - } - } -// -// /// <remarks> -// /// Creates a new memento -// /// </remarks> -// public IXmlConvertable CreateMemento() -// { -// return new BookmarkManagerMemento((ArrayList)bookmark.Clone()); -// } -// -// /// <remarks> -// /// Sets a memento -// /// </remarks> -// public void SetMemento(IXmlConvertable memento) -// { -// bookmark = ((BookmarkManagerMemento)memento).Bookmarks; -// } - - /// <remarks> - /// Clears all bookmark - /// </remarks> - public void Clear() - { - OnBeforeChanged(); - bookmark.Clear(); - OnChanged(); - } - - /// <value> - /// The lowest mark, if no marks exists it returns -1 - /// </value> - public int FirstMark { - get { - if (bookmark.Count < 1) { - return -1; - } - int first = (int)bookmark[0]; - for (int i = 1; i < bookmark.Count; ++i) { - first = Math.Min(first, (int)bookmark[i]); - } - return first; - } - } - - /// <value> - /// The highest mark, if no marks exists it returns -1 - /// </value> - public int LastMark { - get { - if (bookmark.Count < 1) { - return -1; - } - int last = (int)bookmark[0]; - for (int i = 1; i < bookmark.Count; ++i) { - last = Math.Max(last, (int)bookmark[i]); - } - return last; - } - } - - /// <remarks> - /// returns first mark higher than <code>lineNr</code> - /// </remarks> - /// <returns> - /// returns the next mark > cur, if it not exists it returns FirstMark() - /// </returns> - public int GetNextMark(int curLineNr) - { - int next = -1; - for (int i = 0; i < bookmark.Count; ++i) { - int j = (int)bookmark[i]; - if (j > curLineNr) { - next = next == -1 ? j : Math.Min(next, j); - } - } - return next == -1 ? FirstMark : next; - } - - /// <remarks> - /// returns first mark lower than <code>lineNr</code> - /// </remarks> - /// <returns> - /// returns the next mark lower than cur, if it not exists it returns LastMark() - /// </returns> - public int GetPrevMark(int curLineNr) - { - int prev = -1; - for (int i = 0; i < bookmark.Count; ++i) { - int j = (int)bookmark[i]; - if (j < curLineNr) { - prev = prev == -1 ? j : Math.Max(prev, j); - } - } - return prev == -1 ? LastMark : prev; - } - - /// <remarks> - /// Is fired before the bookmarks change - /// </remarks> - public event EventHandler BeforeChanged; - - /// <remarks> - /// Is fired after the bookmarks change - /// </remarks> - public event EventHandler Changed; - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/BookmarkManager/BookmarkManagerMemento.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/BookmarkManager/BookmarkManagerMemento.cs deleted file mode 100644 index 119eb200ed..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/BookmarkManager/BookmarkManagerMemento.cs +++ /dev/null @@ -1,114 +0,0 @@ -// BookmarkManagerMemento.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.Xml; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// This class is used for storing the state of a bookmark manager - /// </summary> - public class BookmarkManagerMemento - { - ArrayList bookmarks = new ArrayList(); - - /// <value> - /// Contains all bookmarks as int values - /// </value> - public ArrayList Bookmarks { - get { - return bookmarks; - } - set { - bookmarks = value; - } - } - - /// <summary> - /// Validates all bookmarks if they're in range of the document. - /// (removing all bookmarks < 0 and bookmarks > max. line number - /// </summary> - public void CheckMemento(IDocument document) - { - for (int i = 0; i < bookmarks.Count; ++i) { - int mark = (int)bookmarks[i]; - if (mark < 0 || mark >= document.TotalNumberOfLines) { - bookmarks.RemoveAt(i); - --i; - } - } - } - - /// <summary> - /// Creates a new instance of <see cref="BookmarkManagerMemento"/> - /// </summary> - public BookmarkManagerMemento() - { - } - - /// <summary> - /// Creates a new instance of <see cref="BookmarkManagerMemento"/> - /// </summary> - public BookmarkManagerMemento(XmlElement element) - { - foreach (XmlElement el in element.ChildNodes) { - bookmarks.Add(Int32.Parse(el.Attributes["line"].InnerText)); - } - } - - /// <summary> - /// Creates a new instance of <see cref="BookmarkManagerMemento"/> - /// </summary> - public BookmarkManagerMemento(ArrayList bookmarks) - { - this.bookmarks = bookmarks; - } - - /// <summary> - /// Converts a xml element to a <see cref="BookmarkManagerMemento"/> object - /// </summary> - public object FromXmlElement(XmlElement element) - { - return new BookmarkManagerMemento(element); - } - - /// <summary> - /// Converts this <see cref="BookmarkManagerMemento"/> to a xml element - /// </summary> - public XmlElement ToXmlElement(XmlDocument doc) - { - XmlElement bookmarknode = doc.CreateElement("Bookmarks"); - - foreach (int line in bookmarks) { - XmlElement markNode = doc.CreateElement("Mark"); - - XmlAttribute lineAttr = doc.CreateAttribute("line"); - lineAttr.InnerText = line.ToString(); - markNode.Attributes.Append(lineAttr); - - bookmarknode.AppendChild(markNode); - } - - return bookmarknode; - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/BookmarkManager/IBookMarkManager.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/BookmarkManager/IBookMarkManager.cs deleted file mode 100644 index 9b1a835449..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/BookmarkManager/IBookMarkManager.cs +++ /dev/null @@ -1,95 +0,0 @@ -// IBookMarkManager.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// This class handles the bookmarks for a buffer - /// </summary> - public interface IBookMarkManager - { - /// <value> - /// Contains all bookmarks as int values - /// </value> - ArrayList Marks { - get; - } - - /// <value> - /// The lowest mark, if no marks exists it returns -1 - /// </value> - int FirstMark { - get; - } - - /// <value> - /// The highest mark, if no marks exists it returns -1 - /// </value> - int LastMark { - get; - } - - /// <remarks> - /// Sets the mark at the line <code>lineNr</code> if it is not set, if the - /// line is already marked the mark is cleared. - /// </remarks> - void ToggleMarkAt(int lineNr); - - /// <remarks> - /// Returns true if the line <code>lineNr</code> is marked - /// </remarks> - bool IsMarked(int lineNr); - - /// <remarks> - /// Clears all bookmarks - /// </remarks> - void Clear(); - - /// <remarks> - /// returns first mark higher than <code>lineNr</code> - /// </remarks> - /// <returns> - /// returns the next mark > cur, if it not exists it returns FirstMark() - /// </returns> - int GetNextMark(int lineNr); - - /// <remarks> - /// returns first mark lower than <code>lineNr</code> - /// </remarks> - /// <returns> - /// returns the next mark lower than cur, if it not exists it returns LastMark() - /// </returns> - int GetPrevMark(int lineNr); - - - /// <remarks> - /// Is fired before the bookmarks change - /// </remarks> - event EventHandler BeforeChanged; - - /// <remarks> - /// Is fired after the bookmarks change - /// </remarks> - event EventHandler Changed; - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/DefaultDocument.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/DefaultDocument.cs deleted file mode 100644 index 5575cca82e..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/DefaultDocument.cs +++ /dev/null @@ -1,386 +0,0 @@ -// DefaultDocument.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.IO; -using System.Diagnostics; -using System.Drawing; - -using MonoDevelop.TextEditor.Undo; - -using MonoDevelop.EditorBindings.FormattingStrategy; - -namespace MonoDevelop.TextEditor.Document { - /// <summary> - /// The default <see cref="IDocument"/> implementation. - /// </summary> - internal class DefaultDocument : IDocument - { - bool readOnly = false; - - ILineManager lineTrackingStrategy = null; - IBookMarkManager bookmarkManager = null; - ITextBufferStrategy textBufferStrategy = null; - IFormattingStrategy formattingStrategy = null; - FoldingManager foldingManager = null; - UndoStack undoStack = new UndoStack(); - ITextEditorProperties textEditorProperties = new DefaultTextEditorProperties(); - - public ITextEditorProperties TextEditorProperties { - get { - return textEditorProperties; - } - set { - textEditorProperties = value; - } - } - - - public UndoStack UndoStack { - get { - return undoStack; - } - } - - public ArrayList LineSegmentCollection { - get { - return lineTrackingStrategy.LineSegmentCollection; - } - } - - - public bool ReadOnly { - get { - return readOnly; - } - set { - readOnly = value; - } - } - - public ILineManager LineManager { - get { - return lineTrackingStrategy; - } - set { - lineTrackingStrategy = value; - } - } - - public ITextBufferStrategy TextBufferStrategy { - get { - return textBufferStrategy; - } - set { - textBufferStrategy = value; - } - } - - public IFormattingStrategy FormattingStrategy { - get { - return formattingStrategy; - } - set { - formattingStrategy = value; - } - } - - public FoldingManager FoldingManager { - get { - return foldingManager; - } - set { - foldingManager = value; - } - } - - public IHighlightingStrategy HighlightingStrategy { - get { - return lineTrackingStrategy.HighlightingStrategy; - } - set { - lineTrackingStrategy.HighlightingStrategy = value; - } - } - - public int TextLength { - get { - return textBufferStrategy.Length; - } - } - - public IBookMarkManager BookmarkManager { - get { - return bookmarkManager; - } - set { - bookmarkManager = value; - } - } - - string language; - public string Language { - get { return language; } - set { language = value; } - } - - public string TextContent { - get { - return GetText(0, textBufferStrategy.Length); - } - set { - Debug.Assert(textBufferStrategy != null); - Debug.Assert(lineTrackingStrategy != null); - OnDocumentAboutToBeChanged(new DocumentEventArgs(this, 0, 0, value)); - textBufferStrategy.SetContent(value); - lineTrackingStrategy.SetContent(value); - OnDocumentChanged(new DocumentEventArgs(this, 0, 0, value)); - OnTextContentChanged(EventArgs.Empty); - } - } - - public void Insert(int offset, string text) - { - if (readOnly) { - return; - } - OnDocumentAboutToBeChanged(new DocumentEventArgs(this, offset, -1, text)); - DateTime time = DateTime.Now; - textBufferStrategy.Insert(offset, text); - - time = DateTime.Now; - lineTrackingStrategy.Insert(offset, text); - - time = DateTime.Now; - - undoStack.Push(new UndoableInsert(this, offset, text)); - - time = DateTime.Now; - OnDocumentChanged(new DocumentEventArgs(this, offset, -1, text)); - } - - public void Remove(int offset, int length) - { - if (readOnly) { - return; - } - OnDocumentAboutToBeChanged(new DocumentEventArgs(this, offset, length)); - undoStack.Push(new UndoableDelete(this, offset, GetText(offset, length))); - - textBufferStrategy.Remove(offset, length); - lineTrackingStrategy.Remove(offset, length); - - - OnDocumentChanged(new DocumentEventArgs(this, offset, length)); - } - - public void Replace(int offset, int length, string text) - { - if (readOnly) { - return; - } - OnDocumentAboutToBeChanged(new DocumentEventArgs(this, offset, length, text)); - undoStack.Push(new UndoableReplace(this, offset, GetText(offset, length), text)); - - textBufferStrategy.Replace(offset, length, text); - lineTrackingStrategy.Replace(offset, length, text); - - OnDocumentChanged(new DocumentEventArgs(this, offset, length, text)); - } - - public char GetCharAt(int offset) - { - return textBufferStrategy.GetCharAt(offset); - } - - public string GetText(int offset, int length) - { - return textBufferStrategy.GetText(offset, length); - } - - public int TotalNumberOfLines { - get { - return lineTrackingStrategy.TotalNumberOfLines; - } - } - - public int GetLineNumberForOffset(int offset) - { - return lineTrackingStrategy.GetLineNumberForOffset(offset); - } - - public LineSegment GetLineSegmentForOffset(int offset) - { - return lineTrackingStrategy.GetLineSegmentForOffset(offset); - } - - public LineSegment GetLineSegment(int line) - { - return lineTrackingStrategy.GetLineSegment(line); - } - - public int GetLogicalLine(int lineNumber) - { - return lineTrackingStrategy.GetLogicalLine(lineNumber); - } - - public int GetVisibleLine(int lineNumber) - { - return lineTrackingStrategy.GetVisibleLine(lineNumber); - } - - public int GetNextVisibleLineAbove(int lineNumber, int lineCount) - { - return lineTrackingStrategy.GetNextVisibleLineAbove(lineNumber, lineCount); - } - - public int GetNextVisibleLineBelow(int lineNumber, int lineCount) - { - return lineTrackingStrategy.GetNextVisibleLineBelow(lineNumber, lineCount); - } - - public Point OffsetToPosition(int offset) - { - int lineNr = GetLineNumberForOffset(offset); - LineSegment line = GetLineSegment(lineNr); - return new Point(offset - line.Offset, lineNr); - } - - public int PositionToOffset(Point p) - { - if (p.Y >= this.TotalNumberOfLines) { - return 0; - } - LineSegment line = GetLineSegment(p.Y); - return Math.Min(this.TextLength, line.Offset + Math.Min(line.Length, p.X)); - } - - protected void OnDocumentAboutToBeChanged(DocumentEventArgs e) - { - if (DocumentAboutToBeChanged != null) { - DocumentAboutToBeChanged(this, e); - } - } - - protected void OnDocumentChanged(DocumentEventArgs e) - { - if (DocumentChanged != null) { - DocumentChanged(this, e); - } - } - - public event DocumentEventHandler DocumentAboutToBeChanged; - public event DocumentEventHandler DocumentChanged; - - // UPDATE STUFF - ArrayList updateQueue = new ArrayList(); - - public ArrayList UpdateQueue { - get { - return updateQueue; - } - } - - public void RequestUpdate(TextAreaUpdate update) - { - updateQueue.Add(update); - } - - public void CommitUpdate() - { - if (UpdateCommited != null) { - UpdateCommited(this, EventArgs.Empty); - } - } - - protected virtual void OnTextContentChanged(EventArgs e) - { - if (TextContentChanged != null) { - TextContentChanged(this, e); - } - } - - public event EventHandler UpdateCommited; - public event EventHandler TextContentChanged; - -#region IFormattableDocument - public string GetLineAsString (int ln) - { - LineSegment line = GetLineSegment (ln); - return GetText (line.Offset, line.Length); - } - - int atomic_begin_level = 0; - int atomic_undo_level = 0; - - public void BeginAtomicUndo () - { - if (atomic_undo_level ++ == 0) - atomic_begin_level = UndoStack.UndoCount; - } - - public void EndAtomicUndo () - { - if (-- atomic_undo_level == 0) { - UndoStack.UndoLast (UndoStack.UndoCount - atomic_begin_level); - atomic_begin_level = 0; - } - } - - public void ReplaceLine (int ln, string txt) - { - LineSegment l = GetLineSegment (ln); - Replace (l.Offset, l.Length, txt); - } - - public IndentStyle IndentStyle { - get { - return TextEditorProperties.IndentStyle; - } - } - - public string IndentString { - get { - return TextEditorProperties.ConvertTabsToSpaces ? new string (' ', TextEditorProperties.TabIndent) : "\t"; - } - } - - public int GetClosingBraceForLine (int ln, out int openingLine) - { - int offset = TextUtilities.SearchBracketBackward (this, GetLineSegment (ln).Offset - 1, '{', '}'); - - openingLine = offset == -1 ? -1 : GetLineNumberForOffset (offset); - return offset; - } - - public bool AutoInsertCurlyBracket { - get { return TextEditorProperties.AutoInsertCurlyBracket; } - } - - public void GetLineLengthInfo (int ln, out int offset, out int len) - { - LineSegment l = GetLineSegment (ln); - offset = l.Offset; - len = l.Length; - } -#endregion - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/DefaultTextEditorProperties.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/DefaultTextEditorProperties.cs deleted file mode 100644 index 0463c09469..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/DefaultTextEditorProperties.cs +++ /dev/null @@ -1,246 +0,0 @@ -using System; -using System.Drawing; -using System.Text; - -using MonoDevelop.EditorBindings.FormattingStrategy; -using MonoDevelop.EditorBindings.Properties; - -namespace MonoDevelop.TextEditor.Document -{ - public class DefaultTextEditorProperties : ITextEditorProperties - { - int tabIndent = 4; - IndentStyle indentStyle = IndentStyle.Smart; - DocumentSelectionMode documentSelectionMode = DocumentSelectionMode.Normal; - Encoding encoding = System.Text.Encoding.UTF8; - - bool allowCaretBeyondEOL = false; - - bool showMatchingBracket = true; - bool showLineNumbers = true; - - bool showSpaces = true; - bool showTabs = true; - bool showEOLMarker = true; - - bool showInvalidLines = true; - - bool isIconBarVisible = true; - bool enableFolding = true; - bool showHorizontalRuler = false; - bool showVerticalRuler = true; - bool convertTabsToSpaces = false; - bool useAntiAliasedFont = false; - bool createBackupCopy = false; - bool mouseWheelScrollDown = true; - bool hideMouseCursor = false; - - int verticalRulerRow = 80; - LineViewerStyle lineViewerStyle = LineViewerStyle.None; - string lineTerminator = "\r\n"; - bool autoInsertCurlyBracket = true; - - public int TabIndent { - get { - return tabIndent; - } - set { - tabIndent = value; - } - } - public IndentStyle IndentStyle { - get { - return indentStyle; - } - set { - indentStyle = value; - } - } - public DocumentSelectionMode DocumentSelectionMode { - get { - return documentSelectionMode; - } - set { - documentSelectionMode = value; - } - } - public bool AllowCaretBeyondEOL { - get { - return allowCaretBeyondEOL; - } - set { - allowCaretBeyondEOL = value; - } - } - public bool ShowMatchingBracket { - get { - return showMatchingBracket; - } - set { - showMatchingBracket = value; - } - } - public bool ShowLineNumbers { - get { - return showLineNumbers; - } - set { - showLineNumbers = value; - } - } - public bool ShowSpaces { - get { - return showSpaces; - } - set { - showSpaces = value; - } - } - public bool ShowTabs { - get { - return showTabs; - } - set { - showTabs = value; - } - } - public bool ShowEOLMarker { - get { - return showEOLMarker; - } - set { - showEOLMarker = value; - } - } - public bool ShowInvalidLines { - get { - return showInvalidLines; - } - set { - showInvalidLines = value; - } - } - public bool IsIconBarVisible { - get { - return isIconBarVisible; - } - set { - isIconBarVisible = value; - } - } - public bool EnableFolding { - get { - return enableFolding; - } - set { - enableFolding = value; - } - } - public bool ShowHorizontalRuler { - get { - return showHorizontalRuler; - } - set { - showHorizontalRuler = value; - } - } - public bool ShowVerticalRuler { - get { - return showVerticalRuler; - } - set { - showVerticalRuler = value; - } - } - public bool ConvertTabsToSpaces { - get { - return convertTabsToSpaces; - } - set { - convertTabsToSpaces = value; - } - } - public bool UseAntiAliasedFont { - get { - return useAntiAliasedFont; - } - set { - useAntiAliasedFont = value; - } - } - public bool CreateBackupCopy { - get { - return createBackupCopy; - } - set { - createBackupCopy = value; - } - } - public bool MouseWheelScrollDown { - get { - return mouseWheelScrollDown; - } - set { - mouseWheelScrollDown = value; - } - } - public bool HideMouseCursor { - get { - return hideMouseCursor; - } - set { - hideMouseCursor = value; - } - } - public Encoding Encoding { - get { - return encoding; - } - set { - encoding = value; - } - } - public int VerticalRulerRow { - get { - return verticalRulerRow; - } - set { - verticalRulerRow = value; - } - } - public LineViewerStyle LineViewerStyle { - get { - return lineViewerStyle; - } - set { - lineViewerStyle = value; - } - } - public string LineTerminator { - get { - return lineTerminator; - } - set { - lineTerminator = value; - } - } - public bool AutoInsertCurlyBracket { - get { - return autoInsertCurlyBracket; - } - set { - autoInsertCurlyBracket = value; - } - } - - public Pango.FontDescription Font { - get { - return FontContainer.DefaultFont; - } - set { - FontContainer.DefaultFont = value; - } - } - - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/DocumentEventArgs.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/DocumentEventArgs.cs deleted file mode 100644 index bc92e57ace..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/DocumentEventArgs.cs +++ /dev/null @@ -1,108 +0,0 @@ -// DocumentEventArgs.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// This delegate is used for document events. - /// </summary> - public delegate void DocumentEventHandler(object sender, DocumentEventArgs e); - - /// <summary> - /// This class contains more information on a document event - /// </summary> - public class DocumentEventArgs : EventArgs - { - IDocument document; - int offset; - int length; - string text; - - /// <returns> - /// always a valid Document which is related to the Event. - /// </returns> - public IDocument Document { - get { - return document; - } - } - - /// <returns> - /// -1 if no offset was specified for this event - /// </returns> - public int Offset { - get { - return offset; - } - } - - /// <returns> - /// null if no text was specified for this event - /// </returns> - public string Text { - get { - return text; - } - } - - /// <returns> - /// -1 if no length was specified for this event - /// </returns> - public int Length { - get { - return length; - } - } - - /// <summary> - /// Creates a new instance off <see cref="DocumentEventArgs"/> - /// </summary> - public DocumentEventArgs(IDocument document) : this(document, -1, -1, null) - { - } - - /// <summary> - /// Creates a new instance off <see cref="DocumentEventArgs"/> - /// </summary> - public DocumentEventArgs(IDocument document, int offset) : this(document, offset, -1, null) - { - } - - /// <summary> - /// Creates a new instance off <see cref="DocumentEventArgs"/> - /// </summary> - public DocumentEventArgs(IDocument document, int offset, int length) : this(document, offset, length, null) - { - } - - /// <summary> - /// Creates a new instance off <see cref="DocumentEventArgs"/> - /// </summary> - public DocumentEventArgs(IDocument document, int offset, int length, string text) - { - this.document = document; - this.offset = offset; - this.length = length; - this.text = text; - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/DocumentFactory.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/DocumentFactory.cs deleted file mode 100644 index 5c0973793f..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/DocumentFactory.cs +++ /dev/null @@ -1,62 +0,0 @@ -// DocumentFactory.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.IO; - - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// This interface represents a container which holds a text sequence and - /// all necessary information about it. It is used as the base for a text editor. - /// </summary> - public class DocumentFactory - { - /// <remarks> - /// Creates a new <see cref="IDocument"/> object. Only create - /// <see cref="IDocument"/> with this method. - /// </remarks> - public IDocument CreateDocument() - { - DefaultDocument doc = new DefaultDocument(); - doc.TextBufferStrategy = new GapTextBufferStrategy(); - doc.FormattingStrategy = new DefaultFormattingStrategy(); - doc.FoldingManager = new FoldingManager(doc); - doc.FoldingManager.FoldingStrategy = new ParserFoldingStrategy(); - - doc.LineManager = new DefaultLineManager(doc, null); - doc.BookmarkManager = new BookmarkManager(doc.LineManager); - return doc; - } - - /// <summary> - /// Creates a new document and loads the given file - /// </summary> - public IDocument CreateFromFile(string fileName) - { - IDocument document = CreateDocument(); - StreamReader stream = File.OpenText(fileName); - document.TextContent = stream.ReadToEnd(); - stream.Close(); - return document; - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/FoldingStrategy/FoldMarker.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/FoldingStrategy/FoldMarker.cs deleted file mode 100644 index db7c9feadb..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/FoldingStrategy/FoldMarker.cs +++ /dev/null @@ -1,133 +0,0 @@ -// FoldMarker.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Collections; - -namespace MonoDevelop.TextEditor.Document -{ - public enum FoldType { - Unspecified, - MemberBody, - Region, - TypeBody - } - - public class FoldMarker - { - int startLine; - int startColumn; - - int endLine; - int endColumn; - - bool isFolded = false; - string foldText = "..."; - FoldType foldType = FoldType.Unspecified; - - - public override string ToString() - { - return String.Format("[FoldMarker: StartLine={0}, StartColumn={1}, EndLine={2}, EndColumn={3}, IsFolded={4}, FoldText=\"{5}\", FoldType={6}]", - startLine, startColumn, endLine, endColumn, isFolded, foldText, foldType); - } - - public FoldType FoldType { - get { - return foldType; - } - set { - foldType = value; - } - } - - - public int StartLine { - get { - return startLine; - } - set { - startLine = value; - } - } - - public int StartColumn { - get { - return startColumn; - } - set { - startColumn = value; - } - } - - public int EndLine { - get { - return endLine; - } - set { - endLine = value; - } - } - public int EndColumn { - get { - return endColumn; - } - set { - endColumn = value; - } - } - - public bool IsFolded { - get { - return isFolded; - } - set { - isFolded = value; - } - } - - public string FoldText { - get { - return foldText; - } - set { - foldText = value; - } - } - - public FoldMarker(int startLine, int startColumn, int endLine, int endColumn) - { - this.startLine = startLine; - this.startColumn = startColumn; - this.endLine = endLine; - this.endColumn = endColumn; - } - - public FoldMarker(int startLine, int startColumn, int endLine, int endColumn, FoldType foldType) - { - this.startLine = startLine; - this.startColumn = startColumn; - this.endLine = endLine; - this.endColumn = endColumn; - this.foldType = foldType; - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/FoldingStrategy/FoldingManager.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/FoldingStrategy/FoldingManager.cs deleted file mode 100644 index 4f35001d22..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/FoldingStrategy/FoldingManager.cs +++ /dev/null @@ -1,168 +0,0 @@ -// FoldingManager.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Collections; - -namespace MonoDevelop.TextEditor.Document -{ - public class FoldingManager - { - ArrayList foldMarker = new ArrayList(); - IFoldingStrategy foldingStrategy = null; - IDocument document; - public ArrayList FoldMarker { - get { - return foldMarker; - } - } - - public IFoldingStrategy FoldingStrategy { - get { - return foldingStrategy; - } - set { - foldingStrategy = value; - } - } - - public FoldingManager(IDocument document) - { - //Console.WriteLine ("new FoldingManager"); - this.document = document; -// foldMarker.Add(new FoldMarker(0, 5, 3, 5)); -// -// foldMarker.Add(new FoldMarker(5, 5, 10, 3)); -// foldMarker.Add(new FoldMarker(6, 0, 8, 2)); -// -// FoldMarker fm1 = new FoldMarker(10, 4, 10, 7); -// FoldMarker fm2 = new FoldMarker(10, 10, 10, 14); -// -// fm1.IsFolded = true; -// fm2.IsFolded = true; -// -// foldMarker.Add(fm1); -// foldMarker.Add(fm2); - } - - public ArrayList GetFoldingsWithStart(int lineNumber) - { - ArrayList foldings = new ArrayList(); - - int c = foldMarker.Count; - for (int i = 0; i < c; i ++) { - FoldMarker fm = (FoldMarker)(foldMarker [i]); - if (fm.StartLine == lineNumber) { - foldings.Add(fm); - } - } - return foldings; - } - - public ArrayList GetFoldingsWithEnd(int lineNumber) - { - ArrayList foldings = new ArrayList(); - - int c = foldMarker.Count; - for (int i = 0; i < c; i ++) { - FoldMarker fm = (FoldMarker)(foldMarker [i]); - if (fm.EndLine == lineNumber) { - foldings.Add(fm); - } - } - return foldings; - } - - public bool IsFoldStart(int lineNumber) - { - int c = foldMarker.Count; - for (int i = 0; i < c; i ++) { - FoldMarker fm = (FoldMarker)(foldMarker [i]); - if (fm.StartLine == lineNumber) { - return true; - } - } - return false; - } - - public bool IsFoldEnd(int lineNumber) - { - int c = foldMarker.Count; - for (int i = 0; i < c; i ++) { - FoldMarker fm = (FoldMarker)(foldMarker [i]); - if (fm.EndLine == lineNumber) { - return true; - } - } - return false; - } - - public bool IsBetweenFolding(int lineNumber) - { - int c = foldMarker.Count; - for (int i = 0; i < c; i ++) { - FoldMarker fm = (FoldMarker)(foldMarker [i]); - if (fm.StartLine < lineNumber && lineNumber < fm.EndLine) { - return true; - } - } - return false; - } - - public bool IsLineVisible(int lineNumber) - { - int c = foldMarker.Count; - for (int i = 0; i < c; i ++) { - FoldMarker fm = (FoldMarker)(foldMarker [i]); - if (fm.IsFolded && fm.StartLine < lineNumber && lineNumber <= fm.EndLine) { - return false; - } - } - return true; - } - - ArrayList GetTopLevelFoldedFoldings() - { - ArrayList foldings = new ArrayList(); - int c = foldMarker.Count; - for (int i = 0; i < c; i ++) { - FoldMarker fm = (FoldMarker)(foldMarker [i]); - if (fm.IsFolded) { - foldings.Add(fm); - } - } - return foldings; - } - - public void UpdateFoldings(string fileName, object parseInfo) - { - //Console.WriteLine (foldingStrategy); - ArrayList newFoldings = foldingStrategy.GenerateFoldMarkers(document, fileName, parseInfo); - if (newFoldings != null) { -// foreach (object o in newFoldings) { -// Console.WriteLine(o); -// } - // TODO : merge!!! - this.foldMarker = newFoldings; - } - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/FoldingStrategy/IFoldingStrategy.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/FoldingStrategy/IFoldingStrategy.cs deleted file mode 100644 index 819fae9623..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/FoldingStrategy/IFoldingStrategy.cs +++ /dev/null @@ -1,38 +0,0 @@ -// IFoldingStrategy.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Collections; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// This interface is used for the folding capabilities - /// of the textarea. - /// </summary> - public interface IFoldingStrategy - { - /// <remarks> - /// Calculates the fold level of a specific line. - /// </remarks> - ArrayList GenerateFoldMarkers(IDocument document, string fileName, object parseInformation); - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/FoldingStrategy/IndentFoldingStrategy.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/FoldingStrategy/IndentFoldingStrategy.cs deleted file mode 100644 index 2026957abe..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/FoldingStrategy/IndentFoldingStrategy.cs +++ /dev/null @@ -1,57 +0,0 @@ -// IndentFoldingStrategy.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Collections; - -namespace MonoDevelop.TextEditor.Document -{ - - /// <summary> - /// A simple folding strategy which calculates the folding level - /// using the indent level of the line. - /// </summary> - public class IndentFoldingStrategy : IFoldingStrategy - { - - /// <remarks> - /// Calculates the fold level of a specific line. - /// </remarks> - public int GenerateFoldMarker(IDocument document, int lineNumber) - { - LineSegment line = document.GetLineSegment(lineNumber); - int foldLevel = 0; - - while (document.GetCharAt(line.Offset + foldLevel) == '\t' && foldLevel + 1 < line.TotalLength) { - ++foldLevel; - } - - return foldLevel; - } - - public ArrayList GenerateFoldMarkers(IDocument document, string fileName, object parseInformation) - { - //FIXME: return the right info - return new ArrayList (); - } - } -} - diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/FoldingStrategy/ParserFoldingStrategy.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/FoldingStrategy/ParserFoldingStrategy.cs deleted file mode 100644 index fc08b800b6..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/FoldingStrategy/ParserFoldingStrategy.cs +++ /dev/null @@ -1,81 +0,0 @@ -// ParserFoldingStrategy.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Collections; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// A simple folding strategy which calculates the folding level - /// using the indent level of the line. - /// </summary> - public class ParserFoldingStrategy : IFoldingStrategy - { - /// <remarks> - /// Calculates the fold level of a specific line. - /// </remarks> - public ArrayList GenerateFoldMarkers(IDocument document, string fileName, object parseInformation) - { -// if (parseInformation == null || parseInformation.MostRecentCompilationUnit == null) { - return null; -// } -// -// ArrayList foldMarkers = new ArrayList(); -// ICompilationUnit cu = (ICompilationUnit)parseInformation.MostRecentCompilationUnit; -// foreach (IClass c in cu.Classes) { -// foldMarkers.Add(new FoldMarker(c.Region.BeginLine - 1, c.Region.BeginColumn - 1, -// c.Region.EndLine - 1, c.Region.EndColumn, FoldType.TypeBody)); -// foreach (IMethod m in c.Methods) { -// foldMarkers.Add(new FoldMarker(m.Region.EndLine - 1, m.Region.EndColumn, -// m.BodyRegion.EndLine - 1, m.BodyRegion.EndColumn - 1, FoldType.MemberBody)); -//// Console.WriteLine("Add folding from {0} to {1}", m.Region, m.BodyRegion); -// } -// -// foreach (IIndexer indexer in c.Indexer) { -// foldMarkers.Add(new FoldMarker(indexer.Region.EndLine - 1, indexer.Region.EndColumn - 1, -// indexer.BodyRegion.EndLine- 1, indexer.BodyRegion.EndColumn - 1, FoldType.MemberBody)); -// } -// -// foreach (IProperty p in c.Properties) { -// foldMarkers.Add(new FoldMarker(p.Region.EndLine - 1, p.Region.EndColumn - 1, -// p.BodyRegion.EndLine- 1, p.BodyRegion.EndColumn - 1, FoldType.MemberBody)); -// } -// -// foreach (IEvent evt in c.Events) { -// if (evt.BodyRegion != null) { -// foldMarkers.Add(new FoldMarker(evt.Region.EndLine - 1, evt.Region.EndColumn - 1, -// evt.BodyRegion.EndLine- 1, evt.BodyRegion.EndColumn - 1, FoldType.MemberBody)); -// } -// } -// } -// -// if (cu.DokuComments != null) { -// foreach (Comment c in cu.DokuComments) { -// foldMarkers.Add(new FoldMarker(c.Region.BeginLine- 1, c.Region.BeginColumn, -// c.Region.EndLine- 1, c.Region.EndColumn)); -// } -// } -// -// return foldMarkers; - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/DefaultHighlightingStrategy.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/DefaultHighlightingStrategy.cs deleted file mode 100644 index e30c522503..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/DefaultHighlightingStrategy.cs +++ /dev/null @@ -1,767 +0,0 @@ -// DefaultHighlightingStrategy.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Diagnostics; -using System.Collections.Specialized; -using System.Collections; -using System.Globalization; -using System.IO; -using System.Reflection; -using System.Xml; -using System.Text; - -namespace MonoDevelop.TextEditor.Document -{ - public class DefaultHighlightingStrategy : IHighlightingStrategy - { - string name; - ArrayList rules = new ArrayList(); - - HighlightBackground defaultColor; - - HighlightColor selectionColor = null; - HighlightColor vRulerColor = null; - HighlightColor spaceMarkerColor = null; - HighlightColor tabMarkerColor = null; - HighlightColor invalidLineColor = null; - HighlightColor lineNumberColor = null; - HighlightColor eolMarkerColor = null; - HighlightColor digitColor = null; - HighlightColor caretmarkerColor = null; - HighlightColor foldLine = null; - HighlightColor foldMarker = null; - - Hashtable properties = new Hashtable(); - string[] extensions; - - HighlightRuleSet defaultRuleSet = null; - - - public DefaultHighlightingStrategy() - { - name = "Default"; - defaultColor = new HighlightBackground("WindowText", "Window", false, false); - digitColor = new HighlightBackground("WindowText", "Window", false, false); - - lineNumberColor = new HighlightBackground("ControlDark", "Window", false, false); - - eolMarkerColor = new HighlightColor("ControlLight", "Window", false, false); - spaceMarkerColor= new HighlightColor("ControlLight", "Window", false, false); - tabMarkerColor = new HighlightColor("ControlLight", "Window", false, false); - - selectionColor = new HighlightColor("HighlightText", "Highlight", false, false); - vRulerColor = new HighlightColor("ControlLight", "Window", false, false); - - - invalidLineColor= new HighlightColor(Color.Red, false, false); - caretmarkerColor= new HighlightColor(Color.Yellow, false, false); - foldLine = new HighlightColor(Color.Black, false, false); - foldMarker = new HighlightColor(Color.White, false, false); - } - - public DefaultHighlightingStrategy(string name) - { - this.name = name; - } - - public Hashtable Properties { - get { - return properties; - } - } - - public string Name - { - get { - return name; - } - } - - public string[] Extensions - { - set { - extensions = value; - } - get { - return extensions; - } - } - - public ArrayList Rules - { - get { - return rules; - } - } - - public HighlightRuleSet FindHighlightRuleSet(string name) - { - foreach(HighlightRuleSet ruleSet in rules) { - if (ruleSet.Name == name) { - return ruleSet; - } - } - return null; - } - - public void AddRuleSet(HighlightRuleSet aRuleSet) - { - rules.Add(aRuleSet); - } - - internal void ResolveReferences() - { - // Resolve references from Span definitions to RuleSets - ResolveRuleSetReferences(); - // Resolve references from RuleSet defintitions to Highlighters defined in an external mode file - ResolveExternalReferences(); - } - - void ResolveRuleSetReferences() - { - foreach (HighlightRuleSet ruleSet in Rules) { - if (ruleSet.Name == null) { - defaultRuleSet = ruleSet; - } - - foreach (Span aSpan in ruleSet.Spans) { - if (aSpan.Rule != null) { - bool found = false; - foreach (HighlightRuleSet refSet in Rules) { - if (refSet.Name == aSpan.Rule) { - found = true; - aSpan.RuleSet = refSet; - break; - } - } - if (!found) { - //MessageBox.Show("The RuleSet " + aSpan.Rule + " could not be found in mode definition " + this.Name, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); - aSpan.RuleSet = null; - } - } else { - aSpan.RuleSet = null; - } - } - } - - if (defaultRuleSet == null) { - //MessageBox.Show("No default RuleSet is defined for mode definition " + this.Name, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); - } - } - - void ResolveExternalReferences() - { - foreach (HighlightRuleSet ruleSet in Rules) { - if (ruleSet.Reference != null) { - IHighlightingStrategy highlighter = HighlightingManager.Manager.FindHighlighter (ruleSet.Reference); - - if (highlighter != null) { - ruleSet.Highlighter = highlighter; - } else { - //MessageBox.Show("The mode defintion " + ruleSet.Reference + " which is refered from the " + this.Name + " mode definition could not be found", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); - ruleSet.Highlighter = this; - } - } else { - ruleSet.Highlighter = this; - } - } - } - - internal void SetDefaultColor(HighlightBackground color) - { - defaultColor = color; - } - - internal void SetColorFor(string name, HighlightColor color) - { - switch (name) { - case "InvalidLines": - invalidLineColor = color; - return; - case "EOLMarkers": - eolMarkerColor = color; - return; - case "Selection": - selectionColor = color; - return; - case "VRuler": - vRulerColor = color; - return; - case "SpaceMarkers": - spaceMarkerColor = color; - return; - case "LineNumbers": - lineNumberColor = color; - return; - case "TabMarkers": - tabMarkerColor = color; - return; - case "Digits": - digitColor = color; - return; - case "CaretMarker": - caretmarkerColor = color; - return; - case "FoldLine": - foldLine = color; - return; - case "FoldMarker": - foldMarker = color; - return; - } - throw new HighlightingColorNotFoundException(name); - } - - public HighlightColor GetColorFor(string name) - { - // Svante Lidman, clean up the code and use only the first ones here - switch (name) { - case "DefaultColor": - return defaultColor; - case "InvalidLines" : - case "InvalideLines": - return invalidLineColor; - case "EOLMarkers": - case "EolMarker": - return eolMarkerColor; - case "Selection": - return selectionColor; - case "VRuler": - case "VRulerColor": - return vRulerColor; - case "SpaceMarkers": - case "SpaceMarker": - return spaceMarkerColor; - case "LineNumbers": - case "LineNumber": - return lineNumberColor; - case "TabMarkers": - case "TabMarker": - return tabMarkerColor; - case "Digits": - case "Digit": - return digitColor; - case "CaretMarker": - case "Caretmarker": - return caretmarkerColor; - case "FoldLine": - return foldLine; - case "FoldMarker": - return foldMarker; - } - throw new HighlightingColorNotFoundException(name); - } - - public HighlightColor DigitColor { - get { - return digitColor; - } - } - - public HighlightColor GetColor(IDocument document, LineSegment currentSegment, int currentOffset, int currentLength) - { - return GetColor(defaultRuleSet, document, currentSegment, currentOffset, currentLength); - } - - HighlightColor GetColor(HighlightRuleSet ruleSet, IDocument document, LineSegment currentSegment, int currentOffset, int currentLength) - { - if (ruleSet != null) { - if (ruleSet.Reference != null) { - return ruleSet.Highlighter.GetColor(document, currentSegment, currentOffset, currentLength); - } else { - return (HighlightColor)ruleSet.KeyWords[document, currentSegment, currentOffset, currentLength]; - } - } - return null; - } - - public HighlightRuleSet GetRuleSet(Span aSpan) - { - if (aSpan == null) { - return this.defaultRuleSet; - } else { - if (aSpan.RuleSet != null) - { - if (aSpan.RuleSet.Reference != null) { - return aSpan.RuleSet.Highlighter.GetRuleSet(null); - } else { - return aSpan.RuleSet; - } - } else { - return null; - } - } - } - - // Line state variable - LineSegment currentLine; - - // Span stack state variable - Stack currentSpanStack; - - public void MarkTokens(IDocument document) - { - if (Rules.Count == 0) { - return; - } - - int lineNumber = 0; - - while (lineNumber < document.TotalNumberOfLines) { - LineSegment previousLine = (lineNumber > 0 ? document.GetLineSegment(lineNumber - 1) : null); - if (lineNumber >= document.LineSegmentCollection.Count) { // may be, if the last line ends with a delimiter - break; // then the last line is not in the collection :) - } - - currentSpanStack = ((previousLine != null && previousLine.HighlightSpanStack != null) ? ((Stack)(previousLine.HighlightSpanStack.Clone())) : null); - - if (currentSpanStack != null) { - while (currentSpanStack.Count > 0 && ((Span)currentSpanStack.Peek()).StopEOL) - { - currentSpanStack.Pop(); - } - if (currentSpanStack.Count == 0) currentSpanStack = null; - } - - currentLine = (LineSegment)document.LineSegmentCollection[lineNumber]; - - if (currentLine.Length == -1) { // happens when buffer is empty ! - return; - } - - ArrayList words = ParseLine(document); - currentLine.Words = words; - currentLine.HighlightSpanStack = (currentSpanStack==null || currentSpanStack.Count==0) ? null : currentSpanStack; - - ++lineNumber; - } - document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.WholeTextArea)); - document.CommitUpdate(); - } - - bool MarkTokensInLine(IDocument document, int lineNumber, ref bool spanChanged) - { - bool processNextLine = false; - LineSegment previousLine = (lineNumber > 0 ? document.GetLineSegment(lineNumber - 1) : null); - - currentSpanStack = ((previousLine != null && previousLine.HighlightSpanStack != null) ? ((Stack)(previousLine.HighlightSpanStack.Clone())) : null); - if(currentSpanStack != null) { - while (currentSpanStack.Count > 0 && ((Span)currentSpanStack.Peek()).StopEOL) { - currentSpanStack.Pop(); - } - if (currentSpanStack.Count == 0) { - currentSpanStack = null; - } - } - - currentLine = (LineSegment)document.LineSegmentCollection[lineNumber]; - - if (currentLine.Length == -1) { // happens when buffer is empty ! - return false; - } - - ArrayList words = ParseLine(document); - - if (currentSpanStack != null && currentSpanStack.Count == 0) { - currentSpanStack = null; - } - - // Check if the span state has changed, if so we must re-render the next line - // This check may seem utterly complicated but I didn't want to introduce any function calls - // or alllocations here for perf reasons. - if(currentLine.HighlightSpanStack != currentSpanStack) { - if (currentLine.HighlightSpanStack == null) { - processNextLine = false; - foreach (Span sp in currentSpanStack) { - if (!sp.StopEOL) { - spanChanged = true; - processNextLine = true; - break; - } - } - } else if (currentSpanStack == null) { - processNextLine = false; - foreach (Span sp in currentLine.HighlightSpanStack) { - if (!sp.StopEOL) { - spanChanged = true; - processNextLine = true; - break; - } - } - } else { - IEnumerator e1 = currentSpanStack.GetEnumerator(); - IEnumerator e2 = currentLine.HighlightSpanStack.GetEnumerator(); - bool done = false; - while (!done) { - bool blockSpanIn1 = false; - while (e1.MoveNext()) { - if (!((Span)e1.Current).StopEOL) { - blockSpanIn1 = true; - break; - } - } - bool blockSpanIn2 = false; - while (e2.MoveNext()) { - if (!((Span)e2.Current).StopEOL) { - blockSpanIn2 = true; - break; - } - } - if (blockSpanIn1 || blockSpanIn2) { - if (blockSpanIn1 && blockSpanIn2) { - if (e1.Current != e2.Current) { - done = true; - processNextLine = true; - spanChanged = true; - } - } else { - spanChanged = true; - done = true; - processNextLine = true; - } - } else { - done = true; - processNextLine = false; - } - } - } - } else { - processNextLine = false; - } - - currentLine.Words = words; - currentLine.HighlightSpanStack = (currentSpanStack != null && currentSpanStack.Count > 0) ? currentSpanStack : null; - - return processNextLine; - } - - public void MarkTokens(IDocument document, ArrayList inputLines) - { - if (Rules.Count == 0) { - return; - } - - Hashtable processedLines = new Hashtable(); - - bool spanChanged = false; - - foreach (LineSegment lineToProcess in inputLines) { - if (processedLines[lineToProcess] == null) { - int lineNumber = document.GetLineNumberForOffset(lineToProcess.Offset); - bool processNextLine = true; - - if (lineNumber != -1) { - while (processNextLine && lineNumber < document.TotalNumberOfLines) { - if (lineNumber >= document.LineSegmentCollection.Count) { // may be, if the last line ends with a delimiter - break; // then the last line is not in the collection :) - } - - processNextLine = MarkTokensInLine(document, lineNumber, ref spanChanged); - processedLines[currentLine] = String.Empty; - ++lineNumber; - } - } - } - } - - if (spanChanged) { - document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.WholeTextArea)); - } else { -// document.Caret.ValidateCaretPos(); -// document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, document.GetLineNumberForOffset(document.Caret.Offset))); -// - foreach (LineSegment lineToProcess in inputLines) { - document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, document.GetLineNumberForOffset(lineToProcess.Offset))); - } - - } - document.CommitUpdate(); - } - - // Span state variables - bool inSpan; - Span activeSpan; - HighlightRuleSet activeRuleSet; - - // Line scanning state variables - int currentOffset; - int currentLength; - - void UpdateSpanStateVariables() - { - inSpan = (currentSpanStack != null && currentSpanStack.Count > 0); - activeSpan = inSpan ? (Span)currentSpanStack.Peek() : null; - activeRuleSet = GetRuleSet(activeSpan); - } - - ArrayList ParseLine(IDocument document) - { - ArrayList words = new ArrayList(); - HighlightColor markNext = null; - - currentOffset = 0; - currentLength = 0; - UpdateSpanStateVariables(); - - for (int i = 0; i < currentLine.Length; ++i) { - char ch = document.GetCharAt(currentLine.Offset + i); - switch (ch) { - case '\n': - case '\r': - PushCurWord(document, ref markNext, words); - ++currentOffset; - break; - case ' ': - PushCurWord(document, ref markNext, words); - words.Add(TextWord.Space); - ++currentOffset; - break; - case '\t': - PushCurWord(document, ref markNext, words); - words.Add(TextWord.Tab); - ++currentOffset; - break; - case '\\': // handle escape chars - if ((activeRuleSet != null && activeRuleSet.NoEscapeSequences) || - (activeSpan != null && activeSpan.NoEscapeSequences)) { - goto default; - } - ++currentLength; - if (i + 1 < currentLine.Length) { - ++currentLength; - } - PushCurWord(document, ref markNext, words); - ++i; - continue; - default: { - // highlight digits - if (!inSpan && (Char.IsDigit(ch) || (ch == '.' && i + 1 < currentLine.Length && Char.IsDigit(document.GetCharAt(currentLine.Offset + i + 1)))) && currentLength == 0) { - bool ishex = false; - bool isfloatingpoint = false; - - if (ch == '0' && i + 1 < currentLine.Length && Char.ToUpper(document.GetCharAt(currentLine.Offset + i + 1)) == 'X') { // hex digits - const string hex = "0123456789ABCDEF"; - ++currentLength; - ++i; // skip 'x' - ++currentLength; - ishex = true; - while (i + 1 < currentLine.Length && hex.IndexOf(Char.ToUpper(document.GetCharAt(currentLine.Offset + i + 1))) != -1) { - ++i; - ++currentLength; - } - } else { - ++currentLength; - while (i + 1 < currentLine.Length && Char.IsDigit(document.GetCharAt(currentLine.Offset + i + 1))) { - ++i; - ++currentLength; - } - } - if (!ishex && i + 1 < currentLine.Length && document.GetCharAt(currentLine.Offset + i + 1) == '.') { - isfloatingpoint = true; - ++i; - ++currentLength; - while (i + 1 < currentLine.Length && Char.IsDigit(document.GetCharAt(currentLine.Offset + i + 1))) { - ++i; - ++currentLength; - } - } - - if (i + 1 < currentLine.Length && Char.ToUpper(document.GetCharAt(currentLine.Offset + i + 1)) == 'E') { - isfloatingpoint = true; - ++i; - ++currentLength; - if (i + 1 < currentLine.Length && (document.GetCharAt(currentLine.Offset + i + 1) == '+' || document.GetCharAt(currentLine.Offset + i + 1) == '-')) { - ++i; - ++currentLength; - } - while (i + 1 < currentLine.Length && Char.IsDigit(document.GetCharAt(currentLine.Offset + i + 1))) { - ++i; - ++currentLength; - } - } - - if (i + 1 < currentLine.Length) { - char nextch = Char.ToUpper(document.GetCharAt(currentLine.Offset + i + 1)); - if (nextch == 'F' || nextch == 'M' || nextch == 'D') { - isfloatingpoint = true; - ++i; - ++currentLength; - } - } - - if (!isfloatingpoint) { - bool isunsigned = false; - if (i + 1 < currentLine.Length && Char.ToUpper(document.GetCharAt(currentLine.Offset + i + 1)) == 'U') { - ++i; - ++currentLength; - isunsigned = true; - } - if (i + 1 < currentLine.Length && Char.ToUpper(document.GetCharAt(currentLine.Offset + i + 1)) == 'L') { - ++i; - ++currentLength; - if (!isunsigned && i + 1 < currentLine.Length && Char.ToUpper(document.GetCharAt(currentLine.Offset + i + 1)) == 'U') { - ++i; - ++currentLength; - } - } - } - - words.Add(new TextWord(document, currentLine, currentOffset, currentLength, DigitColor, false)); - currentOffset += currentLength; - currentLength = 0; - continue; - } - - // Check for SPAN ENDs - if (inSpan) { - if (activeSpan.End != null && !activeSpan.End.Equals("")) { - if (currentLine.MatchExpr(activeSpan.End, i, document)) { - PushCurWord(document, ref markNext, words); - string regex = currentLine.GetRegString(activeSpan.End, i, document); - currentLength += regex.Length; - words.Add(new TextWord(document, currentLine, currentOffset, currentLength, activeSpan.EndColor, false)); - currentOffset += currentLength; - currentLength = 0; - i += regex.Length - 1; - currentSpanStack.Pop(); - UpdateSpanStateVariables(); - continue; - } - } - } - - // check for SPAN BEGIN - if (activeRuleSet != null) { - foreach (Span span in activeRuleSet.Spans) { - if (currentLine.MatchExpr(span.Begin, i, document)) { - PushCurWord(document, ref markNext, words); - string regex = currentLine.GetRegString(span.Begin, i, document); - currentLength += regex.Length; - words.Add(new TextWord(document, currentLine, currentOffset, currentLength, span.BeginColor, false)); - currentOffset += currentLength; - currentLength = 0; - - i += regex.Length - 1; - if( currentSpanStack == null) currentSpanStack = new Stack(); - currentSpanStack.Push(span); - - UpdateSpanStateVariables(); - - goto skip; - } - } - } - - // check if the char is a delimiter - if (activeRuleSet != null && (int)ch < 256 && activeRuleSet.Delimiters[(int)ch]) { - PushCurWord(document, ref markNext, words); - if (currentOffset + currentLength +1 < currentLine.Length) { - ++currentLength; - PushCurWord(document, ref markNext, words); - goto skip; - } - } - - ++currentLength; - skip: continue; - } - } - } - - PushCurWord(document, ref markNext, words); - - return words; - } - - /// <summary> - /// pushes the curWord string on the word list, with the - /// correct color. - /// </summary> - void PushCurWord(IDocument document, ref HighlightColor markNext, ArrayList words) - { - // Svante Lidman : Need to look through the next prev logic. - if (currentLength > 0) { - if (words.Count > 0 && activeRuleSet != null) { - TextWord prevWord = null; - int pInd = words.Count - 1; - while (pInd >= 0) { - if (!((TextWord)words[pInd]).IsWhiteSpace) { - prevWord = (TextWord)words[pInd]; - if (prevWord.HasDefaultColor) { - PrevMarker marker = (PrevMarker)activeRuleSet.PrevMarkers[document, currentLine, currentOffset, currentLength]; - if (marker != null) { - prevWord.SyntaxColor = marker.Color; -// document.Caret.ValidateCaretPos(); -// document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, document.GetLineNumberForOffset(document.Caret.Offset))); - } - } - break; - } - pInd--; - } - } - - if (inSpan) { - HighlightColor c = null; - bool hasDefaultColor = true; - if (activeSpan.Rule == null) { - c = activeSpan.Color; - } else { - c = GetColor(activeRuleSet, document, currentLine, currentOffset, currentLength); - hasDefaultColor = false; - } - - if (c == null) { - c = activeSpan.Color; - if (c.Color == Color.Transparent) { - c = defaultColor; - } - hasDefaultColor = true; - } - words.Add(new TextWord(document, currentLine, currentOffset, currentLength, markNext != null ? markNext : c, hasDefaultColor)); - } else { - HighlightColor c = markNext != null ? markNext : GetColor(activeRuleSet, document, currentLine, currentOffset, currentLength); - if (c == null) { - words.Add(new TextWord(document, currentLine, currentOffset, currentLength, defaultColor, true)); - } else { - words.Add(new TextWord(document, currentLine, currentOffset, currentLength, c, false)); - } - } - - if (activeRuleSet != null) { - NextMarker nextMarker = (NextMarker)activeRuleSet.NextMarkers[document, currentLine, currentOffset, currentLength]; - if (nextMarker != null) { - if (nextMarker.MarkMarker && words.Count > 0) { - TextWord prevword = ((TextWord)words[words.Count - 1]); - prevword.SyntaxColor = nextMarker.Color; - } - markNext = nextMarker.Color; - } else { - markNext = null; - } - } - currentOffset += currentLength; - currentLength = 0; - } - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/FontContainer.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/FontContainer.cs deleted file mode 100644 index 6a988b7a89..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/FontContainer.cs +++ /dev/null @@ -1,117 +0,0 @@ -// FontContainer.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Diagnostics; -using System.Collections.Specialized; -using System.Collections; -using System.Globalization; -using System.IO; -using System.Reflection; -using System.Xml; - -using Pango; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// This class is used to generate bold, italic and bold/italic fonts out - /// of a base font. - /// </summary> - public class FontContainer - { - static FontDescription defaultfont = null; - static FontDescription boldfont = null; - static FontDescription italicfont = null; - static FontDescription bolditalicfont = null; - - /// <value> - /// The bold version of the base font - /// </value> - public static FontDescription BoldFont { - get { - Debug.Assert(boldfont != null, "MonoDevelop.TextEditor.Document.FontContainer : boldfont == null"); - return boldfont; - } - } - - /// <value> - /// The italic version of the base font - /// </value> - public static FontDescription ItalicFont { - get { - Debug.Assert(italicfont != null, "MonoDevelop.TextEditor.Document.FontContainer : italicfont == null"); - return italicfont; - } - } - - /// <value> - /// The bold/italic version of the base font - /// </value> - public static FontDescription BoldItalicFont { - get { - Debug.Assert(bolditalicfont != null, "MonoDevelop.TextEditor.Document.FontContainer : bolditalicfont == null"); - return bolditalicfont; - } - } - - /// <value> - /// The base font - /// </value> - public static FontDescription DefaultFont { - get { - return defaultfont; - } - set { - defaultfont = value; - - boldfont = defaultfont.Copy (); - boldfont.Weight = Weight.Bold; - - italicfont = defaultfont.Copy (); - italicfont.Style = Style.Italic; - - bolditalicfont = defaultfont.Copy (); - bolditalicfont.Style = Style.Italic; - bolditalicfont.Weight = Weight.Bold; - } - } - -// static void CheckFontChange(object sender, PropertyEventArgs e) -// { -// if (e.Key == "DefaultFont") { -// DefaultFont = ParseFont(e.NewValue.ToString()); -// } -// } - - public static FontDescription ParseFont(string font) - { - //string[] descr = font.Split(new char[]{',', '='}); - //return new Font(descr[1], Single.Parse(descr[3])); - return FontDescription.FromString (font); - } - - static FontContainer() - { - DefaultFont = FontDescription.FromString ("Courier 10 Pitch, 10"); - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightBackground.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightBackground.cs deleted file mode 100644 index b91e8e4448..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightBackground.cs +++ /dev/null @@ -1,70 +0,0 @@ -// HighlightBackground.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Diagnostics; -using System.Collections.Specialized; -using System.Collections; -using System.Globalization; -using System.IO; -using System.Reflection; -using System.Xml; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// Extens the highlighting color with a background image. - /// </summary> - public class HighlightBackground : HighlightColor - { - Image backgroundImage; - - /// <value> - /// The image used as background - /// </value> - public Image BackgroundImage { - get { - return backgroundImage; - } - } - - /// <summary> - /// Creates a new instance of <see cref="HighlightBackground"/> - /// </summary> - public HighlightBackground(XmlElement el) : base(el) - { - if (el.Attributes["image"] != null) { - backgroundImage = new Bitmap(el.Attributes["image"].InnerText); - } - } - - /// <summary> - /// Creates a new instance of <see cref="HighlightBackground"/> - /// </summary> - public HighlightBackground(Color color, Color backgroundcolor, bool bold, bool italic) : base(color, backgroundcolor, bold, italic) - { - } - - public HighlightBackground(string systemColor, string systemBackgroundColor, bool bold, bool italic) : base(systemColor, systemBackgroundColor, bold, italic) - { - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightColor.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightColor.cs deleted file mode 100644 index f5a05c42b7..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightColor.cs +++ /dev/null @@ -1,307 +0,0 @@ -// HighlightColor.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Diagnostics; -using System.Collections.Specialized; -using System.Collections; -using System.Globalization; -using System.IO; -using System.Reflection; -using System.Xml; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// A color used for highlighting - /// </summary> - public class HighlightColor - { - bool systemColor = false; - KnownColor systemColorKnownColor; - double systemColorFactor = 1.0; - - bool systemBgColor = false; - KnownColor systemBgColorKnownColor; - double systemBgColorFactor = 1.0; - - Color color; - Color backgroundcolor = System.Drawing.Color.WhiteSmoke; - - bool bold = false; - bool italic = false; - bool hasForgeground = false; - bool hasBackground = false; - - public bool HasForgeground { - get { - return hasForgeground; - } - } - - public bool HasBackground { - get { - return hasBackground; - } - } - - - /// <value> - /// If true the font will be displayed bold style - /// </value> - public bool Bold { - get { - return bold; - } - } - - /// <value> - /// If true the font will be displayed italic style - /// </value> - public bool Italic { - get { - return italic; - } - } - - /// <value> - /// The background color used - /// </value> - public Color BackgroundColor { - get { - if (!systemBgColor) { - return backgroundcolor; - } - return ParseColorString(systemBgColorKnownColor, systemBgColorFactor); - } - } - - /// <value> - /// The foreground color used - /// </value> - public Color Color { - get { - if (!systemColor) { - return color; - } - return ParseColorString(systemColorKnownColor, systemColorFactor); - } - } - - /// <value> - /// The font used - /// </value> - public Pango.FontDescription Font { - get { - if (Bold) { - return Italic ? FontContainer.BoldItalicFont : FontContainer.BoldFont; - } - return Italic ? FontContainer.ItalicFont :FontContainer.DefaultFont; - } - } - - Color ParseColorString(KnownColor color, double factor) - { - Color c = Color.FromKnownColor (color); - c = Color.FromArgb((int)((double)c.R * factor), (int)((double)c.G * factor), (int)((double)c.B * factor)); - - return c; - } - - /// <summary> - /// Creates a new instance of <see cref="HighlightColor"/> - /// </summary> - public HighlightColor(XmlElement el) - { - Debug.Assert(el != null, "MonoDevelop.TextEditor.Document.SyntaxColor(XmlElement el) : el == null"); - if (el.Attributes["bold"] != null) { - bold = Boolean.Parse(el.Attributes["bold"].InnerText); - } - - if (el.Attributes["italic"] != null) { - italic = Boolean.Parse(el.Attributes["italic"].InnerText); - } - - if (el.Attributes["color"] != null) { - string c = el.Attributes["color"].InnerText; - if (c[0] == '#') { - color = ParseColor(c); - } else if (c.StartsWith("SystemColors.")) { - systemColor = true; - string [] cNames = c.Substring ("SystemColors.".Length).Split('*'); - systemColorKnownColor = (KnownColor) Enum.Parse (typeof (KnownColor), cNames [0]); - // hack : can't figure out how to parse doubles with '.' (culture info might set the '.' to ',') - if (cNames.Length == 2) systemColorFactor = Double.Parse(cNames[1]) / 100; - } else { - color = (Color)(Color.GetType()).InvokeMember(c, BindingFlags.GetProperty, null, Color, new object[0]); - } - hasForgeground = true; - } else { - color = Color.Transparent; // to set it to the default value. - } - - if (el.Attributes["bgcolor"] != null) { - string c = el.Attributes["bgcolor"].InnerText; - if (c[0] == '#') { - backgroundcolor = ParseColor(c); - } else if (c.StartsWith("SystemColors.")) { - systemBgColor = true; - string [] cNames = c.Substring ("SystemColors.".Length).Split('*'); - systemBgColorKnownColor = (KnownColor) Enum.Parse (typeof (KnownColor), cNames [0]); - // hack : can't figure out how to parse doubles with '.' (culture info might set the '.' to ',') - if (cNames.Length == 2) systemBgColorFactor = Double.Parse(cNames[1]) / 100; - } else { - backgroundcolor = (Color)(Color.GetType()).InvokeMember(c, BindingFlags.GetProperty, null, Color, new object[0]); - } - hasBackground = true; - } - } - - /// <summary> - /// Creates a new instance of <see cref="HighlightColor"/> - /// </summary> - public HighlightColor(XmlElement el, HighlightColor defaultColor) - { - Debug.Assert(el != null, "MonoDevelop.TextEditor.Document.SyntaxColor(XmlElement el) : el == null"); - if (el.Attributes["bold"] != null) { - bold = Boolean.Parse(el.Attributes["bold"].InnerText); - } else { - bold = defaultColor.Bold; - } - - if (el.Attributes["italic"] != null) { - italic = Boolean.Parse(el.Attributes["italic"].InnerText); - } else { - italic = defaultColor.Italic; - } - - if (el.Attributes["color"] != null) { - string c = el.Attributes["color"].InnerText; - if (c[0] == '#') { - color = ParseColor(c); - } else if (c.StartsWith("SystemColors.")) { - systemColor = true; - string [] cNames = c.Substring ("SystemColors.".Length).Split('*'); - systemColorKnownColor = (KnownColor) Enum.Parse (typeof (KnownColor), cNames [0]); - // hack : can't figure out how to parse doubles with '.' (culture info might set the '.' to ',') - if (cNames.Length == 2) systemColorFactor = Double.Parse(cNames[1]) / 100; - } else { - color = (Color)(Color.GetType()).InvokeMember(c, BindingFlags.GetProperty, null, Color, new object[0]); - } - } else { - color = defaultColor.color; - } - - if (el.Attributes["bgcolor"] != null) { - string c = el.Attributes["bgcolor"].InnerText; - if (c[0] == '#') { - backgroundcolor = ParseColor(c); - } else if (c.StartsWith("SystemColors.")) { - systemBgColor = true; - string [] cNames = c.Substring ("SystemColors.".Length).Split('*'); - systemBgColorKnownColor = (KnownColor) Enum.Parse (typeof (KnownColor), cNames [0]); - // hack : can't figure out how to parse doubles with '.' (culture info might set the '.' to ',') - if (cNames.Length == 2) systemBgColorFactor = Double.Parse(cNames[1]) / 100; - - } else { - backgroundcolor = (Color)(Color.GetType()).InvokeMember(c, BindingFlags.GetProperty, null, Color, new object[0]); - } - } else { - backgroundcolor = defaultColor.BackgroundColor; - } - } - - /// <summary> - /// Creates a new instance of <see cref="HighlightColor"/> - /// </summary> - public HighlightColor(Color color, bool bold, bool italic) - { - hasForgeground = true; - this.color = color; - this.bold = bold; - this.italic = italic; - } - - /// <summary> - /// Creates a new instance of <see cref="HighlightColor"/> - /// </summary> - public HighlightColor(Color color, Color backgroundcolor, bool bold, bool italic) - { - hasForgeground = true; - hasBackground = true; - this.color = color; - this.backgroundcolor = backgroundcolor; - this.bold = bold; - this.italic = italic; - } - - - /// <summary> - /// Creates a new instance of <see cref="HighlightColor"/> - /// </summary> - public HighlightColor(string systemColor, string systemBackgroundColor, bool bold, bool italic) - { - hasForgeground = true; - hasBackground = true; - - this.systemColor = true; - string [] cNames = systemColor.Split('*'); - systemColorKnownColor = (KnownColor) Enum.Parse (typeof (KnownColor), cNames [0]); - // hack : can't figure out how to parse doubles with '.' (culture info might set the '.' to ',') - if (cNames.Length == 2) systemColorFactor = Double.Parse(cNames[1]) / 100; - - systemBgColor = true; - cNames = systemBackgroundColor.Split('*'); - systemBgColorKnownColor = (KnownColor) Enum.Parse (typeof (KnownColor), cNames [0]); - // hack : can't figure out how to parse doubles with '.' (culture info might set the '.' to ',') - if (cNames.Length == 2) systemBgColorFactor = Double.Parse(cNames[1]) / 100; - - this.bold = bold; - this.italic = italic; - } - - static Color ParseColor(string c) - { - int a = 255; - int offset = 0; - if (c.Length > 7) { - offset = 2; - a = Int32.Parse(c.Substring(1,2), NumberStyles.HexNumber); - } - - int r = Int32.Parse(c.Substring(1 + offset,2), NumberStyles.HexNumber); - int g = Int32.Parse(c.Substring(3 + offset,2), NumberStyles.HexNumber); - int b = Int32.Parse(c.Substring(5 + offset,2), NumberStyles.HexNumber); - return Color.FromArgb(a, r, g, b); - } - - /// <summary> - /// Converts a <see cref="HighlightColor"/> instance to string (for debug purposes) - /// </summary> - public override string ToString() - { - return "[HighlightColor: Bold = " + Bold + - ", Italic = " + Italic + - ", Color = " + Color + - ", BackgroundColor = " + BackgroundColor + "]"; - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightInfo.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightInfo.cs deleted file mode 100644 index bb976224cd..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightInfo.cs +++ /dev/null @@ -1,46 +0,0 @@ -// HighlightInfo.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Diagnostics; -using System.Collections.Specialized; -using System.Collections; -using System.Globalization; -using System.IO; -using System.Reflection; -using System.Xml; - -namespace MonoDevelop.TextEditor.Document -{ - public class HighlightInfo - { - public bool BlockSpanOn = false; - public bool Span = false; - public Span CurSpan = null; - - public HighlightInfo(Span curSpan, bool span, bool blockSpanOn) - { - this.CurSpan = curSpan; - this.Span = span; - this.BlockSpanOn = blockSpanOn; - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightRuleSet.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightRuleSet.cs deleted file mode 100644 index 3a513566bb..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightRuleSet.cs +++ /dev/null @@ -1,190 +0,0 @@ -// HighlightRuleSet.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Drawing; -using System.Text; -using System.Xml; - -using MonoDevelop.TextEditor.Util; - -namespace MonoDevelop.TextEditor.Document -{ - public class HighlightRuleSet - { - LookupTable keyWords; - Span [] spans; - - LookupTable prevMarkers; - LookupTable nextMarkers; - IHighlightingStrategy highlighter = null; - bool noEscapeSequences = false; - - bool ignoreCase = false; - string name = null; - - bool[] delimiters = new bool[256]; - - string reference = null; - - public Span [] Spans { - get { - return spans; - } - } - - internal IHighlightingStrategy Highlighter { - get { - return highlighter; - } - set { - highlighter = value; - } - } - - public LookupTable KeyWords { - get { - return keyWords; - } - } - - public LookupTable PrevMarkers { - get { - return prevMarkers; - } - } - - public LookupTable NextMarkers { - get { - return nextMarkers; - } - } - - public bool[] Delimiters { - get { - return delimiters; - } - } - - public bool NoEscapeSequences { - get { - return noEscapeSequences; - } - } - - public bool IgnoreCase { - get { - return ignoreCase; - } - } - - public string Name { - get { - return name; - } - set { - name = value; - } - } - - public string Reference { - get { - return reference; - } - } - - public HighlightRuleSet() - { - keyWords = new LookupTable(false); - prevMarkers = new LookupTable(false); - nextMarkers = new LookupTable(false); - } - - public HighlightRuleSet(XmlElement el) - { - ArrayList spans = new ArrayList (); - XmlNodeList nodes = el.GetElementsByTagName("KeyWords"); - - if (el.Attributes["name"] != null) { - Name = el.Attributes["name"].InnerText; - } - - if (el.Attributes["noescapesequences"] != null) { - noEscapeSequences = Boolean.Parse(el.Attributes["noescapesequences"].InnerText); - } - - if (el.Attributes["reference"] != null) { - reference = el.Attributes["reference"].InnerText; - } - - if (el.Attributes["ignorecase"] != null) { - ignoreCase = Boolean.Parse(el.Attributes["ignorecase"].InnerText); - } - - for (int i = 0; i < Delimiters.Length; ++i) { - Delimiters[i] = false; - } - - if (el["Delimiters"] != null) { - string delimiterString = el["Delimiters"].InnerText; - foreach (char ch in delimiterString) { - Delimiters[(int)ch] = true; - } - } - - keyWords = new LookupTable(!IgnoreCase); - prevMarkers = new LookupTable(!IgnoreCase); - nextMarkers = new LookupTable(!IgnoreCase); - - foreach (XmlElement el2 in nodes) { - HighlightColor color = new HighlightColor(el2); - - XmlNodeList keys = el2.GetElementsByTagName("Key"); - foreach (XmlElement node in keys) { - keyWords[node.Attributes["word"].InnerText] = color; - } - } - - nodes = el.GetElementsByTagName("Span"); - foreach (XmlElement el2 in nodes) { - spans.Add(new Span(el2)); - /* - Span span = new Span(el2); - Spans[span.Begin] = span;*/ - } - - nodes = el.GetElementsByTagName("MarkPrevious"); - foreach (XmlElement el2 in nodes) { - PrevMarker prev = new PrevMarker(el2); - prevMarkers[prev.What] = prev; - } - - nodes = el.GetElementsByTagName("MarkFollowing"); - foreach (XmlElement el2 in nodes) { - NextMarker next = new NextMarker(el2); - nextMarkers[next.What] = next; - } - - this.spans = (Span []) spans.ToArray (typeof (Span)); - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightingColorNotFoundException.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightingColorNotFoundException.cs deleted file mode 100644 index 57c26c4631..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightingColorNotFoundException.cs +++ /dev/null @@ -1,30 +0,0 @@ -// HighlightingColorNotFoundException.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using System; - -namespace MonoDevelop.TextEditor.Document -{ - public class HighlightingColorNotFoundException : Exception - { - public HighlightingColorNotFoundException(string name) : base(name) - { - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightingDefinitionParser.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightingDefinitionParser.cs deleted file mode 100644 index ce9bd02904..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightingDefinitionParser.cs +++ /dev/null @@ -1,125 +0,0 @@ -// HighlightingDefinitionParser.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.IO; -using System.Xml; -using System.Xml.Schema; -using System.Text; -using System.Collections; -using System.Reflection; - -namespace MonoDevelop.TextEditor.Document -{ - internal class HighlightingDefinitionParser - { - private HighlightingDefinitionParser() - { - // This is a pure utility class with no instances. - } - - static string[] environmentColors = {"VRuler", "Selection", "LineNumbers", - "InvalidLines", "EOLMarkers", "SpaceMarkers", "TabMarkers", - "CaretMarker", "FoldLine", "FoldMarker"}; - static ArrayList errors = null; - - public static DefaultHighlightingStrategy Parse(SyntaxMode syntaxMode, XmlTextReader xmlTextReader) - { - try { - XmlValidatingReader validatingReader = new XmlValidatingReader(xmlTextReader); - Stream shemaStream = Assembly.GetCallingAssembly().GetManifestResourceStream("Mode.xsd"); - validatingReader.Schemas.Add("", new XmlTextReader(shemaStream)); - validatingReader.ValidationType = ValidationType.Schema; - validatingReader.ValidationEventHandler += new ValidationEventHandler (ValidationHandler); - - - XmlDocument doc = new XmlDocument(); - doc.Load(validatingReader); - - DefaultHighlightingStrategy highlighter = new DefaultHighlightingStrategy(doc.DocumentElement.Attributes["name"].InnerText); - - if (doc.DocumentElement.Attributes["extensions"]!= null) { - highlighter.Extensions = doc.DocumentElement.Attributes["extensions"].InnerText.Split(new char[] { ';', '|' }); - } - /* - if (doc.DocumentElement.Attributes["indent"]!= null) { - highlighter.DoIndent = Boolean.Parse(doc.DocumentElement.Attributes["indent"].InnerText); - } - */ - XmlElement environment = doc.DocumentElement["Environment"]; - - highlighter.SetDefaultColor(new HighlightBackground(environment["Default"])); - - foreach (string aColorName in environmentColors) { - highlighter.SetColorFor(aColorName, new HighlightColor(environment[aColorName])); - } - - // parse properties - if (doc.DocumentElement["Properties"]!= null) { - foreach (XmlElement propertyElement in doc.DocumentElement["Properties"].ChildNodes) { - highlighter.Properties[propertyElement.Attributes["name"].InnerText] = propertyElement.Attributes["value"].InnerText; - } - } - - if (doc.DocumentElement["Digits"]!= null) { - highlighter.SetColorFor("Digits", new HighlightColor(doc.DocumentElement["Digits"])); - } - - XmlNodeList nodes = doc.DocumentElement.GetElementsByTagName("RuleSet"); - foreach (XmlElement element in nodes) { - highlighter.AddRuleSet(new HighlightRuleSet(element)); - } - - xmlTextReader.Close(); - - if(errors!=null) { - ReportErrors(syntaxMode.FileName); - errors = null; - return null; - } else { - return highlighter; - } - } catch (Exception) { - //MessageBox.Show("Could not load mode definition file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); - return null; - } - } - - private static void ValidationHandler(object sender, ValidationEventArgs args) - { - if (errors==null) { - errors=new ArrayList(); - } - errors.Add(args); - } - - private static void ReportErrors(string fileName) - { - StringBuilder msg = new StringBuilder(); - msg.Append("Could not load mode definition file. Reason:\n\n"); - foreach(ValidationEventArgs args in errors) { - msg.Append(args.Message); - msg.Append(Console.Out.NewLine); - } - //MessageBox.Show(msg.ToString(), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); - } - - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightingManager.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightingManager.cs deleted file mode 100644 index 8c91aa37f7..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightingManager.cs +++ /dev/null @@ -1,113 +0,0 @@ -// HighlightingManager.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Reflection; - -namespace MonoDevelop.TextEditor.Document -{ - public class HighlightingManager - { - ArrayList syntaxModeFileProviders = new ArrayList(); - static HighlightingManager highlightingManager; - - Hashtable highlightingDefs = new Hashtable(); - internal Hashtable extensionsToName = new Hashtable(); - - public Hashtable HighlightingDefinitions { - get { - return highlightingDefs; - } - } - - public static HighlightingManager Manager { - get { - return highlightingManager; - } - } - - static HighlightingManager() - { - highlightingManager = new HighlightingManager(); - highlightingManager.AddSyntaxModeFileProvider(new ResourceSyntaxModeProvider()); - } - - public HighlightingManager() - { - CreateDefaultHighlightingStrategy(); - } - - public void AddSyntaxModeFileProvider(ISyntaxModeFileProvider syntaxModeFileProvider) - { - foreach (SyntaxMode syntaxMode in syntaxModeFileProvider.SyntaxModes) { - highlightingDefs[syntaxMode.Name] = new DictionaryEntry(syntaxMode, syntaxModeFileProvider); - foreach (string extension in syntaxMode.Extensions) { - extensionsToName[extension.ToUpper()] = syntaxMode.Name; - } - } - } - - void CreateDefaultHighlightingStrategy() - { - DefaultHighlightingStrategy defaultHighlightingStrategy = new DefaultHighlightingStrategy(); - defaultHighlightingStrategy.Extensions = new string[] {}; - defaultHighlightingStrategy.Rules.Add(new HighlightRuleSet()); - highlightingDefs["Default"] = defaultHighlightingStrategy; - } - - IHighlightingStrategy LoadDefinition(DictionaryEntry entry) - { - SyntaxMode syntaxMode = (SyntaxMode)entry.Key; - ISyntaxModeFileProvider syntaxModeFileProvider = (ISyntaxModeFileProvider)entry.Value; - - DefaultHighlightingStrategy highlightingStrategy = HighlightingDefinitionParser.Parse(syntaxMode, syntaxModeFileProvider.GetSyntaxModeFile(syntaxMode)); - highlightingDefs[syntaxMode.Name] = highlightingStrategy; - highlightingStrategy.ResolveReferences(); - - return highlightingStrategy; - } - - public IHighlightingStrategy FindHighlighter(string name) - { - object def = highlightingDefs[name]; - if (def is DictionaryEntry) { - return LoadDefinition((DictionaryEntry)def); - } - return (IHighlightingStrategy)(def == null ? highlightingDefs["Default"] : def); - } - - public IHighlightingStrategy FindHighlighterForFile(string fileName) - { - string highlighterName = (string)extensionsToName[Path.GetExtension(fileName).ToUpper()]; - if (highlighterName != null) { - object def = highlightingDefs[highlighterName]; - if (def is DictionaryEntry) { - return LoadDefinition((DictionaryEntry)def); - } - return (IHighlightingStrategy)(def == null ? highlightingDefs["Default"] : def); - } else { - return (IHighlightingStrategy)highlightingDefs["Default"]; - } - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightingStrategyFactory.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightingStrategyFactory.cs deleted file mode 100644 index 182c0cda74..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightingStrategyFactory.cs +++ /dev/null @@ -1,65 +0,0 @@ -// HighlightingStrategyFactory.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Diagnostics; -using System.Collections.Specialized; -using System.Collections; -using System.Globalization; -using System.IO; -using System.Reflection; -using System.Xml; - -namespace MonoDevelop.TextEditor.Document -{ - public class HighlightingStrategyFactory - { - public static IHighlightingStrategy CreateHighlightingStrategy() - { - return (IHighlightingStrategy)HighlightingManager.Manager.HighlightingDefinitions["Default"]; - } - - public static IHighlightingStrategy CreateHighlightingStrategy(string name) - { - IHighlightingStrategy highlightingStrategy = HighlightingManager.Manager.FindHighlighter(name); - - if (highlightingStrategy == null) { - return CreateHighlightingStrategy(); - } - return highlightingStrategy; - } - - public static IHighlightingStrategy CreateHighlightingStrategyForFile(string fileName) - { - IHighlightingStrategy highlightingStrategy = HighlightingManager.Manager.FindHighlighterForFile(fileName); - if (highlightingStrategy == null) { - return CreateHighlightingStrategy(); - } - return highlightingStrategy; - } - - // HACK: this shouldnt be here ;-) - public static string LanguageFromFile (string file) - { - return (string) HighlightingManager.Manager.extensionsToName [Path.GetExtension(file).ToUpper()]; - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/IHighlightingStrategy.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/IHighlightingStrategy.cs deleted file mode 100644 index 567f59f924..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/IHighlightingStrategy.cs +++ /dev/null @@ -1,80 +0,0 @@ -// IHighlightingStrategy.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.Drawing; -using System.Text; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// A highlighting strategy for a buffer. - /// </summary> - public interface IHighlightingStrategy - { - /// <value> - /// The name of the highlighting strategy, must be unique - /// </value> - string Name { - get; - } - - /// <value> - /// The file extenstions on which this highlighting strategy gets - /// used - /// </value> - string[] Extensions { - set; - get; - } - - Hashtable Properties { - get; - } - - // returns special color. (BackGround Color, Cursor Color and so on) - - /// <remarks> - /// Used internally, do not call - /// </remarks> - HighlightColor GetColorFor(string name); - - /// <remarks> - /// Used internally, do not call - /// </remarks> - HighlightRuleSet GetRuleSet(Span span); - - /// <remarks> - /// Used internally, do not call - /// </remarks> - HighlightColor GetColor(IDocument document, LineSegment keyWord, int index, int length); - - /// <remarks> - /// Used internally, do not call - /// </remarks> - void MarkTokens(IDocument document, ArrayList lines); - - /// <remarks> - /// Used internally, do not call - /// </remarks> - void MarkTokens(IDocument document); - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/NextMarker.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/NextMarker.cs deleted file mode 100644 index 99f141b503..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/NextMarker.cs +++ /dev/null @@ -1,83 +0,0 @@ -// NextMarker.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Diagnostics; -using System.Collections.Specialized; -using System.Collections; -using System.Globalization; -using System.IO; -using System.Reflection; -using System.Xml; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// Used for mark next token - /// </summary> - public class NextMarker - { - string what; - HighlightColor color; - bool markMarker = false; - - /// <value> - /// String value to indicate to mark next token - /// </value> - public string What { - get { - return what; - } - } - - /// <value> - /// Color for marking next token - /// </value> - public HighlightColor Color { - get { - return color; - } - } - - /// <value> - /// If true the indication text will be marked with the same color - /// too - /// </value> - public bool MarkMarker { - get { - return markMarker; - } - } - - /// <summary> - /// Creates a new instance of <see cref="NextMarker"/> - /// </summary> - public NextMarker(XmlElement mark) - { - color = new HighlightColor(mark); - what = mark.InnerText; - if (mark.Attributes["markmarker"] != null) { - markMarker = Boolean.Parse(mark.Attributes["markmarker"].InnerText); - } - } - } - -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/PrevMarker.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/PrevMarker.cs deleted file mode 100644 index 29e1376313..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/PrevMarker.cs +++ /dev/null @@ -1,83 +0,0 @@ -// PrevMarker.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Diagnostics; -using System.Collections.Specialized; -using System.Collections; -using System.Globalization; -using System.IO; -using System.Reflection; -using System.Xml; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// Used for mark previous token - /// </summary> - public class PrevMarker - { - string what; - HighlightColor color; - bool markMarker = false; - - /// <value> - /// String value to indicate to mark previous token - /// </value> - public string What { - get { - return what; - } - } - - /// <value> - /// Color for marking previous token - /// </value> - public HighlightColor Color { - get { - return color; - } - } - - /// <value> - /// If true the indication text will be marked with the same color - /// too - /// </value> - public bool MarkMarker { - get { - return markMarker; - } - } - - /// <summary> - /// Creates a new instance of <see cref="PrevMarker"/> - /// </summary> - public PrevMarker(XmlElement mark) - { - color = new HighlightColor(mark); - what = mark.InnerText; - if (mark.Attributes["markmarker"] != null) { - markMarker = Boolean.Parse(mark.Attributes["markmarker"].InnerText); - } - } - } - -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/Span.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/Span.cs deleted file mode 100644 index d6bede80b9..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/Span.cs +++ /dev/null @@ -1,136 +0,0 @@ -// Span.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Diagnostics; -using System.Collections.Specialized; -using System.Collections; -using System.Globalization; -using System.IO; -using System.Reflection; -using System.Xml; - -namespace MonoDevelop.TextEditor.Document -{ - public class Span - { - bool stopEOL; - HighlightColor color; - HighlightColor beginColor = null; - HighlightColor endColor = null; - char[] begin = null; - char[] end = null; - string name = null; - string rule = null; - HighlightRuleSet ruleSet = null; - bool noEscapeSequences = false; - - internal HighlightRuleSet RuleSet { - get { - return ruleSet; - } - set { - ruleSet = value; - } - } - - public bool StopEOL { - get { - return stopEOL; - } - } - - public HighlightColor Color { - get { - return color; - } - } - - public HighlightColor BeginColor { - get { - if(beginColor != null) { - return beginColor; - } else { - return color; - } - } - } - - public HighlightColor EndColor { - get { - return endColor!=null ? endColor : color; - } - } - - public char[] Begin { - get { - return begin; - } - } - - public char[] End { - get { - return end; - } - } - - public string Name { - get { - return name; - } - } - - public string Rule { - get { - return rule; - } - } - - public bool NoEscapeSequences { - get { - return noEscapeSequences; - } - } - - public Span(XmlElement span) - { - color = new HighlightColor(span); - - if (span.Attributes["rule"] != null) { - rule = span.Attributes["rule"].InnerText; - } - - if (span.Attributes["noescapesequences"] != null) { - noEscapeSequences = Boolean.Parse(span.Attributes["noescapesequences"].InnerText); - } - - name = span.Attributes["name"].InnerText; - stopEOL = Boolean.Parse(span.Attributes["stopateol"].InnerText); - begin = span["Begin"].InnerText.ToCharArray(); - beginColor = new HighlightColor(span["Begin"], color); - - if (span["End"] != null) { - end = span["End"].InnerText.ToCharArray(); - endColor = new HighlightColor(span["End"], color); - } - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/SyntaxModes/FileSyntaxModeProvider.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/SyntaxModes/FileSyntaxModeProvider.cs deleted file mode 100644 index 27df5b9849..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/SyntaxModes/FileSyntaxModeProvider.cs +++ /dev/null @@ -1,94 +0,0 @@ -// FileSyntaxModeProvider.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.IO; -using System.Collections; -using System.Reflection; -using System.Xml; - -namespace MonoDevelop.TextEditor.Document -{ - public class FileSyntaxModeProvider : ISyntaxModeFileProvider - { - string directory; - ArrayList syntaxModes = null; - - public ArrayList SyntaxModes { - get { - return syntaxModes; - } - } - - public FileSyntaxModeProvider(string directory) - { - this.directory = directory; - string syntaxModeFile = Path.Combine(directory, "SyntaxModes.xml"); - if (File.Exists(syntaxModeFile)) { - Stream s = File.OpenRead(syntaxModeFile); - syntaxModes = SyntaxMode.GetSyntaxModes(s); - s.Close(); - } else { - syntaxModes = ScanDirectory(directory); - } - } - - public XmlTextReader GetSyntaxModeFile(SyntaxMode syntaxMode) - { - string syntaxModeFile = Path.Combine(directory, syntaxMode.FileName); - if (!File.Exists(syntaxModeFile)) { - //MessageBox.Show("Can't load highlighting definition " + syntaxModeFile + " (file not found)!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1); - return null; - } - return new XmlTextReader(File.OpenRead(syntaxModeFile)); - } - - ArrayList ScanDirectory(string directory) - { - string[] files = Directory.GetFiles(directory); - ArrayList modes = new ArrayList(); - foreach (string file in files) { - if (Path.GetExtension(file).ToUpper() == ".XSHD") { - XmlTextReader reader = new XmlTextReader(file); - while (reader.Read()) { - if (reader.NodeType == XmlNodeType.Element) { - switch (reader.Name) { - case "SyntaxDefinition": - string name = reader.GetAttribute("name"); - string extensions = reader.GetAttribute("extensions"); - modes.Add(new SyntaxMode(Path.GetFileName(file), - name, - extensions)); - goto bailout; - default: - //MessageBox.Show("Unknown root node in syntax highlighting file :" + reader.Name, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1); - goto bailout; - } - } - } - bailout: - reader.Close(); - - } - } - return modes; - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/SyntaxModes/ISyntaxModeFileProvider.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/SyntaxModes/ISyntaxModeFileProvider.cs deleted file mode 100644 index dea94dbf37..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/SyntaxModes/ISyntaxModeFileProvider.cs +++ /dev/null @@ -1,35 +0,0 @@ -// ISyntaxModeFileProvider.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.Xml; - -namespace MonoDevelop.TextEditor.Document -{ - public interface ISyntaxModeFileProvider - { - ArrayList SyntaxModes { - get; - } - - XmlTextReader GetSyntaxModeFile(SyntaxMode syntaxMode); - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/SyntaxModes/ResourceSyntaxModeProvider.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/SyntaxModes/ResourceSyntaxModeProvider.cs deleted file mode 100644 index 72f339d8d9..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/SyntaxModes/ResourceSyntaxModeProvider.cs +++ /dev/null @@ -1,53 +0,0 @@ -// ResourceSyntaxModeProvider.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.Reflection; -using System.Xml; -using System.IO; - -namespace MonoDevelop.TextEditor.Document -{ - public class ResourceSyntaxModeProvider : ISyntaxModeFileProvider - { - ArrayList syntaxModes = null; - - public ArrayList SyntaxModes { - get { - return syntaxModes; - } - } - - public ResourceSyntaxModeProvider() - { - Assembly assembly = this.GetType().Assembly; - Stream syntaxModeStream = assembly.GetManifestResourceStream("SyntaxModes.xml"); - if (syntaxModeStream == null) throw new ApplicationException("DAMN RESOURCES!"); - syntaxModes = SyntaxMode.GetSyntaxModes(syntaxModeStream); - } - - public XmlTextReader GetSyntaxModeFile(SyntaxMode syntaxMode) - { - Assembly assembly = typeof(SyntaxMode).Assembly; - return new XmlTextReader(assembly.GetManifestResourceStream(syntaxMode.FileName)); - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/SyntaxModes/SyntaxMode.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/SyntaxModes/SyntaxMode.cs deleted file mode 100644 index 8751287f5d..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/SyntaxModes/SyntaxMode.cs +++ /dev/null @@ -1,110 +0,0 @@ -// SyntaxMode.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.IO; -using System.Collections; -using System.Xml; - -namespace MonoDevelop.TextEditor.Document -{ - public class SyntaxMode - { - string fileName; - string name; - string[] extensions; - - public string FileName { - get { - return fileName; - } - set { - fileName = value; - } - } - - public string Name { - get { - return name; - } - set { - name = value; - } - } - - public string[] Extensions { - get { - return extensions; - } - set { - extensions = value; - } - } - - public SyntaxMode(string fileName, string name, string extensions) - { - this.fileName = fileName; - this.name = name; - this.extensions = extensions.Split(';', '|', ','); - } - - public SyntaxMode(string fileName, string name, string[] extensions) - { - this.fileName = fileName; - this.name = name; - this.extensions = extensions; - } - - public static ArrayList GetSyntaxModes(Stream xmlSyntaxModeStream) - { - XmlTextReader reader = new XmlTextReader(xmlSyntaxModeStream); - ArrayList syntaxModes = new ArrayList(); - while (reader.Read()) { - switch (reader.NodeType) { - case XmlNodeType.Element: - switch (reader.Name) { - case "SyntaxModes": - string version = reader.GetAttribute("version"); - if (version != "1.0") { - //MessageBox.Show("Unknown syntax mode file defininition with version " + version , "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1); - return syntaxModes; - } - break; - case "Mode": - syntaxModes.Add(new SyntaxMode(reader.GetAttribute("file"), - reader.GetAttribute("name"), - reader.GetAttribute("extensions"))); - break; - default: - //MessageBox.Show("Unknown node in syntax mode file :" + reader.Name, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1); - return syntaxModes; - } - break; - } - } - reader.Close(); - return syntaxModes; - } - public override string ToString() - { - return String.Format("[SyntaxMode: FileName={0}, Name={1}, Extensions=({2})]", fileName, name, String.Join(",", extensions)); - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/TextWord.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/TextWord.cs deleted file mode 100644 index f79ba38a23..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/TextWord.cs +++ /dev/null @@ -1,153 +0,0 @@ -// TextWord.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Diagnostics; - -namespace MonoDevelop.TextEditor.Document -{ - - public enum TextWordType { - Word, - Space, - Tab - } - - /// <summary> - /// This class represents single words with color information, two special versions of a word are - /// spaces and tabs. - /// </summary> - public class TextWord - { - HighlightColor color; - LineSegment word; - IDocument document; - - int offset; - int length; - TextWordType type; - - static TextWord spaceWord = new TextWord(TextWordType.Space); - static TextWord tabWord = new TextWord(TextWordType.Tab); - - public bool hasDefaultColor; - - static public TextWord Space { - get { - return spaceWord; - } - } - - static public TextWord Tab { - get { - return tabWord; - } - } - - public int Length { - get { - if (type == TextWordType.Word) { - return length; - } - return 1; - } - } - - public bool HasDefaultColor { - get { - return hasDefaultColor; - } - } - - public TextWordType Type { - get { - return type; - } - } - -// string myword = null; - public string Word { - get { - return document.GetText(word.Offset + offset, length); -// if (myword == null) { -// myword = document.GetText(word.Offset + offset, length); -// } -// return myword; - } - } - - public Pango.FontDescription Font { - get { - return color.Font; - } - } - - public Color Color { - get { - return color.Color; - } - } - - public HighlightColor SyntaxColor { - get { - return color; - } - set { - color = value; - } - } - - public bool IsWhiteSpace { - get { - return type == TextWordType.Space || type == TextWordType.Tab; - } - } - - // TAB - private TextWord(TextWordType type) - { - this.type = type; - } - - public TextWord(IDocument document, LineSegment word, int offset, int length, HighlightColor color, bool hasDefaultColor) - { - Debug.Assert(document != null); - Debug.Assert(word != null); - Debug.Assert(color != null); - - this.document = document; - this.word = word; - this.offset = offset; - this.length = length; - this.color = color; - this.hasDefaultColor = hasDefaultColor; - this.type = TextWordType.Word; - } - - /// <summary> - /// Converts a <see cref="TextWord"/> instance to string (for debug purposes) - /// </summary> - public override string ToString() - { - return "[TextWord: Word = " + Word + ", Font = " + Font.Family + ", Color = " + Color + "]"; - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/IDocument.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/IDocument.cs deleted file mode 100644 index 8beac7b969..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/IDocument.cs +++ /dev/null @@ -1,303 +0,0 @@ -// IDocument.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using System; -using System.Collections; -using System.Drawing; - -using MonoDevelop.TextEditor.Undo; -using MonoDevelop.EditorBindings.FormattingStrategy; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// This interface represents a container which holds a text sequence and - /// all necessary information about it. It is used as the base for a text editor. - /// </summary> - public interface IDocument : IFormattableDocument - { - ITextEditorProperties TextEditorProperties { - get; - set; - } - - UndoStack UndoStack { - get; - } - /// <value> - /// If true the document can't be altered - /// </value> - bool ReadOnly { - get; - set; - } - - /// <summary> - /// The <see cref="IFormattingStrategy"/> attached to the <see cref="IDocument"/> instance - /// </summary> - IFormattingStrategy FormattingStrategy { - get; - set; - } - - /// <summary> - /// The <see cref="ITextBufferStrategy"/> attached to the <see cref="IDocument"/> instance - /// </summary> - ITextBufferStrategy TextBufferStrategy { - get; - } - - /// <summary> - /// The <see cref="FoldingManager"/> attached to the <see cref="IDocument"/> instance - /// </summary> - FoldingManager FoldingManager { - get; - } - - /// <summary> - /// The <see cref="IHighlightingStrategy"/> attached to the <see cref="IDocument"/> instance - /// </summary> - IHighlightingStrategy HighlightingStrategy { - get; - set; - } - - /// <summary> - /// The <see cref="IBookMarkManager"/> attached to the <see cref="IDocument"/> instance - /// </summary> - IBookMarkManager BookmarkManager { - get; - } - - string Language { - get; set; - } - -// /// <summary> -// /// The <see cref="SelectionManager"/> attached to the <see cref="IDocument"/> instance -// /// </summary> -// SelectionManager SelectionManager { -// get; -// } - -#region ILineManager interface - /// <value> - /// A collection of all line segments - /// </value> - /// <remarks> - /// The collection should only be used if you're aware - /// of the 'last line ends with a delimiter problem'. Otherwise - /// the <see cref="GetLineSegment"/> method should be used. - /// </remarks> - ArrayList LineSegmentCollection { - get; - } - - /// <value> - /// The total number of lines, this may be != ArrayList.Count - /// if the last line ends with a delimiter. - /// </value> - int TotalNumberOfLines { - get; - } - - /// <remarks> - /// Returns a valid line number for the given offset. - /// </remarks> - /// <param name="offset"> - /// A offset which points to a character in the line which - /// line number is returned. - /// </param> - /// <returns> - /// An int which value is the line number. - /// </returns> - /// <exception cref="System.ArgumentException">If offset points not to a valid position</exception> - int GetLineNumberForOffset(int offset); - - /// <remarks> - /// Returns a <see cref="LineSegment"/> for the given offset. - /// </remarks> - /// <param name="offset"> - /// A offset which points to a character in the line which - /// is returned. - /// </param> - /// <returns> - /// A <see cref="LineSegment"/> object. - /// </returns> - /// <exception cref="System.ArgumentException">If offset points not to a valid position</exception> - LineSegment GetLineSegmentForOffset(int offset); - - /// <remarks> - /// Returns a <see cref="LineSegment"/> for the given line number. - /// This function should be used to get a line instead of getting the - /// line using the <see cref="ArrayList"/>. - /// </remarks> - /// <param name="lineNumber"> - /// The line number which is requested. - /// </param> - /// <returns> - /// A <see cref="LineSegment"/> object. - /// </returns> - /// <exception cref="System.ArgumentException">If offset points not to a valid position</exception> - LineSegment GetLineSegment(int lineNumber); - - /// <remarks> - /// Get the logical line for a given visible line. - /// example : lineNumber == 100 foldings are in the linetracker - /// between 0..1 (2 folded, invisible lines) this method returns 102 - /// the 'logical' line number - /// </remarks> - int GetLogicalLine(int lineNumber); - - /// <remarks> - /// Get the visible line for a given logical line. - /// example : lineNumber == 100 foldings are in the linetracker - /// between 0..1 (2 folded, invisible lines) this method returns 98 - /// the 'visible' line number - /// </remarks> - int GetVisibleLine(int lineNumber); - - /// <remarks> - /// Get the next visible line after lineNumber - /// </remarks> - int GetNextVisibleLineAbove(int lineNumber, int lineCount); - - /// <remarks> - /// Get the next visible line below lineNumber - /// </remarks> - int GetNextVisibleLineBelow(int lineNumber, int lineCount); -#endregion - -#region ITextBufferStrategy interface - /// <value> - /// Get the whole text as string - /// </value> - string TextContent { - get; - set; - } - - /// <value> - /// The current length of the sequence of characters that can be edited. - /// </value> - int TextLength { - get; - } - - /// <summary> - /// Inserts a string of characters into the sequence. - /// </summary> - /// <param name="offset"> - /// offset where to insert the string. - /// </param> - /// <param name="text"> - /// text to be inserted. - /// </param> - void Insert(int offset, string text); - - /// <summary> - /// Removes some portion of the sequence. - /// </summary> - /// <param name="offset"> - /// offset of the remove. - /// </param> - /// <param name="length"> - /// number of characters to remove. - /// </param> - void Remove(int offset, int length); - - /// <summary> - /// Replace some portion of the sequence. - /// </summary> - /// <param name="offset"> - /// offset. - /// </param> - /// <param name="length"> - /// number of characters to replace. - /// </param> - /// <param name="text"> - /// text to be replaced with. - /// </param> - void Replace(int offset, int length, string text); - - /// <summary> - /// Returns a specific char of the sequence. - /// </summary> - /// <param name="offset"> - /// Offset of the char to get. - /// </param> - char GetCharAt(int offset); - - /// <summary> - /// Fetches a string of characters contained in the sequence. - /// </summary> - /// <param name="offset"> - /// Offset into the sequence to fetch - /// </param> - /// <param name="length"> - /// number of characters to copy. - /// </param> - string GetText(int offset, int length); -#endregion - -#region ITextModel interface - /// <summary> - /// returns the logical line/column position from an offset - /// </summary> - Point OffsetToPosition(int offset); - - /// <summary> - /// returns the offset from a logical line/column position - /// </summary> - int PositionToOffset(Point p); -#endregion - /// <value> - /// A container where all TextAreaUpdate objects get stored - /// </value> - ArrayList UpdateQueue { - get; - } - - /// <remarks> - /// Requests an update of the textarea - /// </remarks> - void RequestUpdate(TextAreaUpdate update); - - /// <remarks> - /// Commits all updates in the queue to the textarea (the - /// textarea will be painted) - /// </remarks> - void CommitUpdate(); - - /// <summary> - /// Is fired when CommitUpdate is called - /// </summary> - event EventHandler UpdateCommited; - - /// <summary> - /// </summary> - event DocumentEventHandler DocumentAboutToBeChanged; - - /// <summary> - /// </summary> - event DocumentEventHandler DocumentChanged; - - event EventHandler TextContentChanged; - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/ISegment.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/ISegment.cs deleted file mode 100644 index ae6b184aac..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/ISegment.cs +++ /dev/null @@ -1,45 +0,0 @@ -// ISegment.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using MonoDevelop.TextEditor.Undo; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// This interface is used to describe a span inside a text sequence - /// </summary> - public interface ISegment - { - /// <value> - /// The offset where the span begins - /// </value> - int Offset { - get; - } - - /// <value> - /// The length of the span - /// </value> - int Length { - get; - } - } - -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/ITextEditorProperties.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/ITextEditorProperties.cs deleted file mode 100644 index b54a45ffd5..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/ITextEditorProperties.cs +++ /dev/null @@ -1,137 +0,0 @@ -using System; -using System.Drawing; -using System.Text; - -using MonoDevelop.EditorBindings.FormattingStrategy; -using MonoDevelop.EditorBindings.Properties; - -namespace MonoDevelop.TextEditor.Document -{ - public interface ITextEditorProperties - { - bool AutoInsertCurlyBracket { // is wrapped in text editor control - get; - set; - } - - bool HideMouseCursor { // is wrapped in text editor control - get; - set; - } - - bool IsIconBarVisible { // is wrapped in text editor control - get; - set; - } - - bool AllowCaretBeyondEOL { - get; - set; - } - - bool ShowMatchingBracket { // is wrapped in text editor control - get; - set; - } - - bool UseAntiAliasedFont { // is wrapped in text editor control - get; - set; - } - - bool MouseWheelScrollDown { - get; - set; - } - - string LineTerminator { - get; - set; - } - - bool CreateBackupCopy { // is wrapped in text editor control - get; - set; - } - - LineViewerStyle LineViewerStyle { // is wrapped in text editor control - get; - set; - } - - bool ShowInvalidLines { // is wrapped in text editor control - get; - set; - } - - int VerticalRulerRow { // is wrapped in text editor control - get; - set; - } - - bool ShowSpaces { // is wrapped in text editor control - get; - set; - } - - bool ShowTabs { // is wrapped in text editor control - get; - set; - } - - bool ShowEOLMarker { // is wrapped in text editor control - get; - set; - } - - bool ConvertTabsToSpaces { // is wrapped in text editor control - get; - set; - } - - bool ShowHorizontalRuler { // is wrapped in text editor control - get; - set; - } - - bool ShowVerticalRuler { // is wrapped in text editor control - get; - set; - } - - Encoding Encoding { - get; - set; - } - - bool EnableFolding { // is wrapped in text editor control - get; - set; - } - - bool ShowLineNumbers { // is wrapped in text editor control - get; - set; - } - - int TabIndent { // is wrapped in text editor control - get; - set; - } - - IndentStyle IndentStyle { // is wrapped in text editor control - get; - set; - } - - DocumentSelectionMode DocumentSelectionMode { - get; - set; - } - - Pango.FontDescription Font { // is wrapped in text editor control - get; - set; - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/LineManager/DefaultLineManager.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/LineManager/DefaultLineManager.cs deleted file mode 100644 index 8b7c901198..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/LineManager/DefaultLineManager.cs +++ /dev/null @@ -1,586 +0,0 @@ -// DefaultLineManager.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Diagnostics; -using System.Collections; - -namespace MonoDevelop.TextEditor.Document -{ - internal class DefaultLineManager : ILineManager - { - ArrayList lineCollection = new ArrayList(); - - IDocument document; - IHighlightingStrategy highlightingStrategy; - - // keep track of the textlength ourselves - int textLength; - - public ArrayList LineSegmentCollection { - get { - return lineCollection; - } - } - - public int TotalNumberOfLines { - get { - if (lineCollection.Count == 0) { - return 1; - } - - return ((LineSegment)lineCollection[lineCollection.Count - 1]).DelimiterLength > 0 ? lineCollection.Count + 1 : lineCollection.Count; - } - } - - public IHighlightingStrategy HighlightingStrategy { - get { - return highlightingStrategy; - } - set { - if (highlightingStrategy != value) { - highlightingStrategy = value; - if (highlightingStrategy != null) { - highlightingStrategy.MarkTokens(document); - } - } - } - } - - public DefaultLineManager(IDocument document, IHighlightingStrategy highlightingStrategy) - { - this.document = document; - this.highlightingStrategy = highlightingStrategy; - } - - public int GetLineNumberForOffset(int offset) - { - if (offset < 0 || offset > textLength) { - throw new ArgumentOutOfRangeException("offset", offset, "should be between 0 and " + textLength); - } - - if (offset == textLength) { - if (lineCollection.Count == 0) { - return 0; - } - - LineSegment lastLine = (LineSegment)lineCollection[lineCollection.Count - 1]; - return lastLine.DelimiterLength > 0 ? lineCollection.Count : lineCollection.Count - 1; - } - - return FindLineNumber(offset); - } - - public LineSegment GetLineSegmentForOffset(int offset) - { - if (offset < 0 || offset > textLength) { - throw new ArgumentOutOfRangeException("offset", offset, "should be between 0 and " + textLength); - } - - if (offset == textLength) { - if (lineCollection.Count == 0) { - return new LineSegment(0, 0); - } - LineSegment lastLine = (LineSegment)lineCollection[lineCollection.Count - 1]; - return lastLine.DelimiterLength > 0 ? new LineSegment(textLength, 0) : lastLine; - } - - return GetLineSegment(FindLineNumber(offset)); - } - - public LineSegment GetLineSegment(int lineNr) - { - if (lineNr < 0 || lineNr > lineCollection.Count) { - throw new ArgumentOutOfRangeException("lineNr", lineNr, "should be between 0 and " + lineCollection.Count); - } - - if (lineNr == lineCollection.Count) { - if (lineCollection.Count == 0) { - return new LineSegment(0, 0); - } - LineSegment lastLine = (LineSegment)lineCollection[lineCollection.Count - 1]; - return lastLine.DelimiterLength > 0 ? new LineSegment(lastLine.Offset + lastLine.TotalLength, 0) : lastLine; - } - - return (LineSegment)lineCollection[lineNr]; - } - - int Insert(int lineNumber, int offset, string text) - { - if (text == null || text.Length == 0) { - return 0; - } - - textLength += text.Length; - - if (lineCollection.Count == 0 || lineNumber >= lineCollection.Count) { - return CreateLines(text, lineCollection.Count, offset); - } - - LineSegment line = (LineSegment)lineCollection[lineNumber]; - - ISegment nextDelimiter = NextDelimiter(text, 0); - if (nextDelimiter == null || nextDelimiter.Offset < 0) { - line.TotalLength += text.Length; - markLines.Add(line); - return 0; - } - - int restLength = line.Offset + line.TotalLength - offset; - - if (restLength > 0) { - LineSegment lineRest = new LineSegment(offset, restLength); - lineRest.DelimiterLength = line.DelimiterLength; - - lineRest.Offset += text.Length; - markLines.Add(lineRest); - - if (restLength - line.DelimiterLength < 0) { - throw new ApplicationException("tried to insert inside delimiter string " + lineRest.ToString() + "!!!"); - } - - lineCollection.Insert(lineNumber + 1, lineRest); - OnLineCountChanged(new LineManagerEventArgs(document, lineNumber - 1, 1)); - } - - line.DelimiterLength = nextDelimiter.Length; - int nextStart = offset + nextDelimiter.Offset + nextDelimiter.Length; - line.TotalLength = nextStart - line.Offset; - - markLines.Add(line); - text = text.Substring(nextDelimiter.Offset + nextDelimiter.Length); - - return CreateLines(text, lineNumber + 1, nextStart) + 1; - } - -// OLD SAFE & TESTED REmove -// bool Remove(int lineNumber, int offset, int length) -// { -// if (length == 0) { -// return false; -// } -// -// int removedLineEnds = GetNumberOfLines(lineNumber, offset, length) - 1; -// -// LineSegment line = (LineSegment)lineCollection[lineNumber]; -// if ((lineNumber == lineCollection.Count - 1) && removedLineEnds > 0) { -// line.TotalLength -= length; -// line.DelimiterLength = 0; -// } else { -// ++lineNumber; -// for (int i = 1; i <= removedLineEnds; ++i) { -// -// if (lineNumber == lineCollection.Count) { -// line.DelimiterLength = 0; -// break; -// } -// -// LineSegment line2 = (LineSegment)lineCollection[lineNumber]; -// -// line.TotalLength += line2.TotalLength; -// line.DelimiterLength = line2.DelimiterLength; -// lineCollection.RemoveAt(lineNumber); -// } -// line.TotalLength -= length; -// -// if (lineNumber < lineCollection.Count && removedLineEnds > 0) { -// markLines.Add(lineCollection[lineNumber]); -// } -// } -// -// textLength -= length; -// -// if (line.TotalLength == 0) { -// lineCollection.Remove(line); -// OnLineCountChanged(new LineManagerEventArgs(document, lineNumber, -removedLineEnds)); -// return true; -// } -// -// markLines.Add(line); -// OnLineCountChanged(new LineManagerEventArgs(document, lineNumber, -removedLineEnds)); -// return false; -// } - - bool Remove(int lineNumber, int offset, int length) - { - if (length == 0) { - return false; - } - - int removedLineEnds = GetNumberOfLines(lineNumber, offset, length) - 1; - - LineSegment line = (LineSegment)lineCollection[lineNumber]; - if ((lineNumber == lineCollection.Count - 1) && removedLineEnds > 0) { - line.TotalLength -= length; - line.DelimiterLength = 0; - } else { - ++lineNumber; - LineSegment line2 = null; - - // todo: take out this unneccessary loop... - for (int i = 0; i < removedLineEnds && lineNumber + i < lineCollection.Count; ++i) { - line2 = (LineSegment)lineCollection[lineNumber + i]; - - line.TotalLength += line2.TotalLength; - line.DelimiterLength = line2.DelimiterLength; - } - - if (lineNumber + removedLineEnds >= lineCollection.Count) { - line.DelimiterLength = 0; - } else { - if (line2 != null) { - line.DelimiterLength = line2.DelimiterLength; - } - } - - lineCollection.RemoveRange(lineNumber, Math.Max(0, Math.Min(lineCollection.Count - lineNumber, removedLineEnds))); - - line.TotalLength -= length; - if (lineNumber < lineCollection.Count && removedLineEnds > 0) { - markLines.Add(lineCollection[lineNumber]); - } - } - - textLength -= length; - - if (line.TotalLength == 0) { - lineCollection.Remove(line); - OnLineCountChanged(new LineManagerEventArgs(document, lineNumber, -removedLineEnds)); - return true; - } - - markLines.Add(line); - OnLineCountChanged(new LineManagerEventArgs(document, lineNumber, -removedLineEnds)); - return false; - } - - ArrayList markLines = new ArrayList(); - - public void Insert(int offset, string text) - { - Replace(offset, 0, text); - } - - public void Remove(int offset, int length) - { - Replace(offset, length, String.Empty); - } - - - public void Replace(int offset, int length, string text) - { - int lineNumber = GetLineNumberForOffset(offset); - int insertLineNumber = lineNumber; - if (Remove(lineNumber, offset, length)) { - --lineNumber; - } - - lineNumber += Insert(insertLineNumber, offset, text); - - int delta = -length; - if (text != null) { - delta = text.Length + delta; - } - - if (delta != 0) { - AdaptLineOffsets(lineNumber, delta); - } - - RunHighlighter(); - } - - void RunHighlighter() - { - DateTime time = DateTime.Now; - if (highlightingStrategy != null) { - highlightingStrategy.MarkTokens(document, markLines); - } - markLines.Clear(); - } - - public void SetContent(string text) - { - lineCollection.Clear(); - if (text != null) { - textLength = text.Length; - CreateLines(text, 0, 0); - RunHighlighter(); - } - } - - void AdaptLineOffsets(int lineNumber, int delta) - { - for (int i = lineNumber + 1; i < lineCollection.Count; ++i) { - ((LineSegment)lineCollection[i]).Offset += delta; - } - } - - int GetNumberOfLines(int startLine, int offset, int length) - { - if (length == 0) { - return 1; - } - - int target = offset + length; - - LineSegment l = (LineSegment)lineCollection[startLine]; - - if (l.DelimiterLength == 0) { - return 1; - } - - if (l.Offset + l.TotalLength > target) { - return 1; - } - - if (l.Offset + l.TotalLength == target) { - return 2; - } - - return GetLineNumberForOffset(target) - startLine + 1; - } - - int FindLineNumber(int offset) - { - if (lineCollection.Count == 0) { - return - 1; - } - - int leftIndex = 0; - int rightIndex = lineCollection.Count - 1; - - LineSegment curLine = null; - - while (leftIndex < rightIndex) { - int pivotIndex = (leftIndex + rightIndex) / 2; - - curLine = (LineSegment)lineCollection[pivotIndex]; - - if (offset < curLine.Offset) { - rightIndex = pivotIndex - 1; - } else if (offset > curLine.Offset) { - leftIndex = pivotIndex + 1; - } else { - leftIndex = pivotIndex; - break; - } - } - - return ((LineSegment)lineCollection[leftIndex]).Offset > offset ? leftIndex - 1 : leftIndex; - } - - -// OLD 'SAFE & TESTED' CreateLines -// int CreateLines(string text, int insertPosition, int offset) -// { -// int count = 0; -// int start = 0; -// ISegment nextDelimiter = NextDelimiter(text, 0); -// while (nextDelimiter != null && nextDelimiter.Offset >= 0) { -// int index = nextDelimiter.Offset + (nextDelimiter.Length - 1); -// -// LineSegment newLine = new LineSegment(offset + start, offset + index, nextDelimiter.Length); -// -// markLines.Add(newLine); -// -// if (insertPosition + count >= lineCollection.Count) { -// lineCollection.Add(newLine); -// } else { -// lineCollection.Insert(insertPosition + count, newLine); -// } -// -// ++count; -// start = index + 1; -// nextDelimiter = NextDelimiter(text, start); -// } -// -// if (start < text.Length) { -// if (insertPosition + count < lineCollection.Count) { -// LineSegment l = (LineSegment)lineCollection[insertPosition + count]; -// -// int delta = text.Length - start; -// -// l.Offset -= delta; -// l.TotalLength += delta; -// } else { -// LineSegment newLine = new LineSegment(offset + start, text.Length - start); -// -// markLines.Add(newLine); -// lineCollection.Add(newLine); -// ++count; -// } -// } -// OnLineCountChanged(new LineManagerEventArgs(document, insertPosition, count)); -// return count; -// } - - int CreateLines(string text, int insertPosition, int offset) - { - int start = 0; - ISegment nextDelimiter = NextDelimiter(text, 0); - - ArrayList newLines = new ArrayList(); - while (nextDelimiter != null && nextDelimiter.Offset >= 0) { - int index = nextDelimiter.Offset + (nextDelimiter.Length - 1); - - LineSegment newLine = new LineSegment(offset + start, offset + index, nextDelimiter.Length); - newLines.Add(newLine); - - start = index + 1; - nextDelimiter = NextDelimiter(text, start); - } - - if (start < text.Length) { - if (insertPosition + newLines.Count < lineCollection.Count) { - LineSegment l = (LineSegment)lineCollection[insertPosition]; - - int delta = text.Length - start; - l.Offset -= delta; - l.TotalLength += delta; - } else { - LineSegment newLine = new LineSegment(offset + start, text.Length - start); - newLines.Add(newLine); - } - } - - if (insertPosition >= lineCollection.Count) { - lineCollection.AddRange(newLines); - } else { - lineCollection.InsertRange(insertPosition, newLines); - } - markLines.AddRange(newLines); - - OnLineCountChanged(new LineManagerEventArgs(document, insertPosition, newLines.Count)); - return newLines.Count; - } - - public int GetLogicalLine(int lineNumber) - { - int invisibleLines = 0; - for (int i = 0; i < lineCollection.Count; ++i) { - if (!document.FoldingManager.IsLineVisible(i)) { - ++invisibleLines; - } - if (i >= lineNumber) { - return i - invisibleLines; - } - } - return lineCollection.Count - invisibleLines; - } - - public int GetVisibleLine(int lineNumber) - { - int visibleLines = 0; - for (int i = 0; i < lineCollection.Count; ++i) { - if (document.FoldingManager.IsLineVisible(i)) { - ++visibleLines; - } - if (visibleLines > lineNumber) { - return i; - } - } - return lineCollection.Count; - } - - // TODO : speedup the next/prev visible line search - // HOW? : save the foldings in a sorted list and lookup the - // line numbers in this list - public int GetNextVisibleLineAbove(int lineNumber, int lineCount) - { - int curLineNumber = lineNumber; - for (int i = 0; i < lineCount; ++i) { - ++curLineNumber; - while (curLineNumber < TotalNumberOfLines && (curLineNumber >= lineCollection.Count || !document.FoldingManager.IsLineVisible(curLineNumber))) { - ++curLineNumber; - } - } - return Math.Min(TotalNumberOfLines - 1, curLineNumber); - } - - public int GetNextVisibleLineBelow(int lineNumber, int lineCount) - { - int curLineNumber = lineNumber; - for (int i = 0; i < lineCount; ++i) { - --curLineNumber; - while (curLineNumber >= 0 && !document.FoldingManager.IsLineVisible(curLineNumber)) { - --curLineNumber; - } - } - return Math.Max(0, curLineNumber); - } - - protected virtual void OnLineCountChanged(LineManagerEventArgs e) - { - if (LineCountChanged != null) { - LineCountChanged(this, e); - } - } - - // use always the same ISegment object for the DelimiterInfo - DelimiterSegment delimiterSegment = new DelimiterSegment(); - ISegment NextDelimiter(string text, int offset) - { - for (int i = offset; i < text.Length; i++) { - switch (text[i]) { - case '\r': - if (i + 1 < text.Length) { - if (text[i + 1] == '\n') { - delimiterSegment.Offset = i; - delimiterSegment.Length = 2; - return delimiterSegment; - } - } - goto case '\n'; - case '\n': - delimiterSegment.Offset = i; - delimiterSegment.Length = 1; - return delimiterSegment; - } - } - return null; - } - - public event LineManagerEventHandler LineCountChanged; - - public class DelimiterSegment : ISegment - { - int offset; - int length; - - public int Offset { - get { - return offset; - } - set { - offset = value; - } - } - - public int Length { - get { - return length; - } - set { - length = value; - } - } - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/LineManager/ILineManager.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/LineManager/ILineManager.cs deleted file mode 100644 index d5e96affa4..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/LineManager/ILineManager.cs +++ /dev/null @@ -1,144 +0,0 @@ -// ILineManager.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using System.Collections; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// The line tracker keeps track of all lines in a document. - /// </summary> - public interface ILineManager - { - /// <value> - /// A collection of all line segments - /// </value> - ArrayList LineSegmentCollection { - get; - } - - /// <value> - /// The total number of lines, this may be != ArrayList.Count - /// if the last line ends with a delimiter. - /// </value> - int TotalNumberOfLines { - get; - } - - /// <value> - /// The current <see cref="IHighlightingStrategy"/> attached to this line manager - /// </value> - IHighlightingStrategy HighlightingStrategy { - get; - set; - } - - /// <remarks> - /// Returns a valid line number for the given offset. - /// </remarks> - /// <param name="offset"> - /// A offset which points to a character in the line which - /// line number is returned. - /// </param> - /// <returns> - /// An int which value is the line number. - /// </returns> - /// <exception cref="System.ArgumentException">If offset points not to a valid position</exception> - int GetLineNumberForOffset(int offset); - - /// <remarks> - /// Returns a <see cref="LineSegment"/> for the given offset. - /// </remarks> - /// <param name="offset"> - /// A offset which points to a character in the line which - /// is returned. - /// </param> - /// <returns> - /// A <see cref="LineSegment"/> object. - /// </returns> - /// <exception cref="System.ArgumentException">If offset points not to a valid position</exception> - LineSegment GetLineSegmentForOffset(int offset); - - /// <remarks> - /// Returns a <see cref="LineSegment"/> for the given line number. - /// This function should be used to get a line instead of getting the - /// line using the <see cref="ArrayList"/>. - /// </remarks> - /// <param name="lineNumber"> - /// The line number which is requested. - /// </param> - /// <returns> - /// A <see cref="LineSegment"/> object. - /// </returns> - /// <exception cref="System.ArgumentException">If offset points not to a valid position</exception> - LineSegment GetLineSegment(int lineNumber); - - /// <summary> - /// Used internally, do not call yourself. - /// </summary> - void Insert(int offset, string text); - - /// <summary> - /// Used internally, do not call yourself. - /// </summary> - void Remove(int offset, int length); - - /// <summary> - /// Used internally, do not call yourself. - /// </summary> - void Replace(int offset, int length, string text); - - /// <remarks> - /// Sets the content of this line manager = break the text - /// into lines. - /// </remarks> - void SetContent(string text); - - /// <remarks> - /// Get the logical line for a given visible line. - /// example : lineNumber == 100 foldings are in the linetracker - /// between 0..1 (2 folded, invisible lines) this method returns 102 - /// the 'logical' line number - /// </remarks> - int GetLogicalLine(int lineNumber); - - /// <remarks> - /// Get the visible line for a given logical line. - /// example : lineNumber == 100 foldings are in the linetracker - /// between 0..1 (2 folded, invisible lines) this method returns 98 - /// the 'visible' line number - /// </remarks> - int GetVisibleLine(int lineNumber); - - /// <remarks> - /// Get the next visible line after lineNumber - /// </remarks> - int GetNextVisibleLineAbove(int lineNumber, int lineCount); - - /// <remarks> - /// Get the next visible line below lineNumber - /// </remarks> - int GetNextVisibleLineBelow(int lineNumber, int lineCount); - - /// <remarks> - /// Is fired when lines are inserted or removed - /// </remarks> - event LineManagerEventHandler LineCountChanged; - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/LineManager/LineManagerEventArgs.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/LineManager/LineManagerEventArgs.cs deleted file mode 100644 index e897dc53aa..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/LineManager/LineManagerEventArgs.cs +++ /dev/null @@ -1,67 +0,0 @@ -// LineManagerEventArgs.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; - -namespace MonoDevelop.TextEditor.Document -{ - public delegate void LineManagerEventHandler(object sender,LineManagerEventArgs e); - - public class LineManagerEventArgs : EventArgs - { - IDocument document; - int start; - int moved; - - /// <returns> - /// always a valid Document which is related to the Event. - /// </returns> - public IDocument Document { - get { - return document; - } - } - - /// <returns> - /// -1 if no offset was specified for this event - /// </returns> - public int LineStart { - get { - return start; - } - } - - /// <returns> - /// -1 if no length was specified for this event - /// </returns> - public int LinesMoved { - get { - return moved; - } - } - - public LineManagerEventArgs(IDocument document, int lineStart, int linesMoved) - { - this.document = document; - this.start = lineStart; - this.moved = linesMoved; - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/LineManager/LineSegment.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/LineManager/LineSegment.cs deleted file mode 100644 index bc2341db60..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/LineManager/LineSegment.cs +++ /dev/null @@ -1,225 +0,0 @@ -// LineSegment.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Collections; -using System.Text; - -namespace MonoDevelop.TextEditor.Document -{ - public class LineSegment : AbstractSegment - { - int delimiterLength; - - ArrayList words = null; - Stack highlightSpanStack = null; - - public override int Length { - get { - return length - delimiterLength; - } - set { - throw new System.NotSupportedException(); - } - } - - public int TotalLength { - get { - return length; - } - set { - length = value; - } - } - - public int DelimiterLength { - get { - return delimiterLength; - } - set { - delimiterLength = value; - } - } - - // highlighting information - public ArrayList Words { - get { - return words; - } - set { - words = value; - } - } - - public HighlightColor GetColorForPosition(int x) - { - if (Words != null) { - int xPos = 0; - foreach (TextWord word in Words) { - if (x < xPos + word.Length) { - return word.SyntaxColor; - } - xPos += word.Length; - } - } - return new HighlightColor(Color.Black, false, false); - } - - public Stack HighlightSpanStack { - get { - return highlightSpanStack; - } - set { - highlightSpanStack = value; - } - } - - public LineSegment(int offset, int end, int delimiterLength) - { - this.offset = offset; - this.length = end - offset + 1; - this.delimiterLength = delimiterLength; - } - - public LineSegment(int offset, int length) - { - this.offset = offset; - this.length = length; - this.delimiterLength = 0; - } - - /// <summary> - /// Converts a <see cref="LineSegment"/> instance to string (for debug purposes) - /// </summary> - public override string ToString() - { - return "[LineSegment: Offset = "+ offset +", TotalLength = " + length + ", DelimiterLength = " + delimiterLength + "]"; - } - - // Svante Lidman: reconsider whether it was the right descision to move these methids here. - - /// <summary> - /// get the string, which matches the regular expression expr, - /// in string s2 at index - /// </summary> - internal string GetRegString(char[] expr, int index, IDocument document) - { - int j = 0; - StringBuilder regexpr = new StringBuilder();; - - for (int i = 0; i < expr.Length; ++i, ++j) { - if (index + j >= this.Length) - break; - - switch (expr[i]) { - case '@': // "special" meaning - ++i; - switch (expr[i]) { - case '!': // don't match the following expression - StringBuilder whatmatch = new StringBuilder(); - ++i; - while (i < expr.Length && expr[i] != '@') { - whatmatch.Append(expr[i++]); - } - break; - case '@': // matches @ - regexpr.Append(document.GetCharAt(this.Offset + index + j)); - break; - } - break; - default: - if (expr[i] != document.GetCharAt(this.Offset + index + j)) { - return regexpr.ToString(); - } - regexpr.Append(document.GetCharAt(this.Offset + index + j)); - break; - } - } - return regexpr.ToString(); - } - - /// <summary> - /// returns true, if the get the string s2 at index matches the expression expr - /// </summary> - internal bool MatchExpr(char[] expr, int index, IDocument document) - { - for (int i = 0, j = 0; i < expr.Length; ++i, ++j) { - switch (expr[i]) { - case '@': // "special" meaning - ++i; - if (i < expr.Length) { - switch (expr[i]) { - case '!': // don't match the following expression - { StringBuilder whatmatch = new StringBuilder(); - ++i; - while (i < expr.Length && expr[i] != '@') { - whatmatch.Append(expr[i++]); - } - if (this.Offset + index + j + whatmatch.Length < document.TextLength) { - int k = 0; - for (; k < whatmatch.Length; ++k) - if (document.GetCharAt(this.Offset + index + j + k) != whatmatch[k]) - break; - if (k >= whatmatch.Length) { - return false; - } - } -// --j; - break; - } - case '-': // don't match the expression before - { - StringBuilder whatmatch = new StringBuilder(); - ++i; - while (i < expr.Length && expr[i] != '@') { - whatmatch.Append(expr[i++]); - } - if (index - whatmatch.Length >= 0) { - int k = 0; - for (; k < whatmatch.Length; ++k) - if (document.GetCharAt(this.Offset + index - whatmatch.Length + k) != whatmatch[k]) - break; - if (k >= whatmatch.Length) { - return false; - } - } -// --j; - break; - } - case '@': // matches @ - if (index + j >= this.Length || '@' != document.GetCharAt(this.Offset + index + j)) { - return false; - } - break; - } - } - break; - default: - if (index + j >= this.Length || expr[i] != document.GetCharAt(this.Offset + index + j)) { - return false; - } - break; - } - } - return true; - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/Selection/ColumnRange.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/Selection/ColumnRange.cs deleted file mode 100644 index 198688e430..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/Selection/ColumnRange.cs +++ /dev/null @@ -1,84 +0,0 @@ -// ColumnRange.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using System; -using System.Drawing; -using System.Collections; -using System.Text; -using MonoDevelop.TextEditor.Undo; - -namespace MonoDevelop.TextEditor.Document -{ - public class ColumnRange - { - public static readonly ColumnRange NoColumn = new ColumnRange(-2, -2); - public static readonly ColumnRange WholeColumn = new ColumnRange(-1, -1); - - int startColumn; - int endColumn; - - public int StartColumn { - get { - return startColumn; - } - set { - startColumn = value; - } - } - - public int EndColumn { - get { - return endColumn; - } - set { - endColumn = value; - } - } - - public ColumnRange(int startColumn, int endColumn) - { - this.startColumn = startColumn; - this.endColumn = endColumn; - - } - - public override int GetHashCode() - { - return startColumn + (endColumn << 16); - } - - public override bool Equals(object obj) - { - if (obj is ColumnRange) { - return ((ColumnRange)obj).startColumn == startColumn && - ((ColumnRange)obj).endColumn == endColumn; - - } - return false; - } - - public override string ToString() - { - return String.Format("[ColumnRange: StartColumn={0}, EndColumn={1}]", startColumn, endColumn); - } - - - - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/Selection/DefaultSelection.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/Selection/DefaultSelection.cs deleted file mode 100644 index bad051264d..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/Selection/DefaultSelection.cs +++ /dev/null @@ -1,138 +0,0 @@ -// DefaultSelection.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// Default implementation of the <see cref="MonoDevelop.TextEditor.Document.ISelection"/> interface. - /// </summary> - public class DefaultSelection : ISelection - { - IDocument document = null; - bool isRectangularSelection = false; - Point startPosition = new Point(-1, -1); - Point endPosition = new Point(-1, -1); - - public Point StartPosition { - get { - return startPosition; - } - set { - startPosition = value; - } - } - - public Point EndPosition { - get { - return endPosition; - } - set { - endPosition = value; - } - } - - public int Offset { - get { - return document.PositionToOffset(startPosition); - } - } - - public int EndOffset { - get { - return document.PositionToOffset(endPosition); - } - } - - public int Length { - get { - return EndOffset - Offset; - } - } - - /// <value> - /// Returns true, if the selection is empty - /// </value> - public bool IsEmpty { - get { - return startPosition == endPosition; - } - } - - /// <value> - /// Returns true, if the selection is rectangular - /// </value> - // TODO : make this unused property used. - public bool IsRectangularSelection { - get { - return isRectangularSelection; - } - set { - isRectangularSelection = value; - } - } - - /// <value> - /// The text which is selected by this selection. - /// </value> - public string SelectedText { - get { - if (document != null) { - if (Length < 0) { - return null; - } - return document.GetText(Offset, Length); - } - return null; - } - } - - /// <summary> - /// Creates a new instance of <see cref="DefaultSelection"/> - /// </summary> - public DefaultSelection(IDocument document, Point startPosition, Point endPosition) - { - this.document = document; - this.startPosition = startPosition; - this.endPosition = endPosition; - } - - /// <summary> - /// Converts a <see cref="DefaultSelection"/> instance to string (for debug purposes) - /// </summary> - public override string ToString() - { - return String.Format("[DefaultSelection : StartPosition={0}, EndPosition={1}]", startPosition, endPosition); - } - public bool ContainsPosition(Point position) - { - return startPosition.Y < position.Y && position.Y < endPosition.Y || - startPosition.Y == position.Y && startPosition.X <= position.X && (startPosition.Y != endPosition.Y || position.X <= endPosition.X) || - endPosition.Y == position.Y && startPosition.Y != endPosition.Y && position.X <= endPosition.X; - } - - public bool ContainsOffset(int offset) - { - return Offset <= offset && offset <= EndOffset; - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/Selection/ISelection.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/Selection/ISelection.cs deleted file mode 100644 index 016c03fe19..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/Selection/ISelection.cs +++ /dev/null @@ -1,77 +0,0 @@ -// ISelection.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using System.Drawing; -using MonoDevelop.TextEditor.Undo; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// An interface representing a portion of the current selection. - /// </summary> - public interface ISelection - { - Point StartPosition { - get; - set; - } - - Point EndPosition { - get; - set; - } - - int Offset { - get; - } - - int EndOffset { - get; - } - - int Length { - get; - } - - /// <value> - /// Returns true, if the selection is rectangular - /// </value> - bool IsRectangularSelection { - get; - } - - /// <value> - /// Returns true, if the selection is empty - /// </value> - bool IsEmpty { - get; - } - - /// <value> - /// The text which is selected by this selection. - /// </value> - string SelectedText { - get; - } - - bool ContainsOffset(int offset); - - bool ContainsPosition(Point position); - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/Selection/SelectionCollection.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/Selection/SelectionCollection.cs deleted file mode 100644 index a0eb8f49dd..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/Selection/SelectionCollection.cs +++ /dev/null @@ -1,279 +0,0 @@ -// SelectionCollection.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// <para> - /// A collection that stores <see cref='ISelection'/> objects. - /// </para> - /// </summary> - /// <seealso cref='SelectionCollection'/> - [Serializable()] - public class SelectionCollection : CollectionBase { - - /// <summary> - /// <para> - /// Initializes a new instance of <see cref='SelectionCollection'/>. - /// </para> - /// </summary> - public SelectionCollection() - { - } - - /// <summary> - /// <para> - /// Initializes a new instance of <see cref='SelectionCollection'/> based on another <see cref='SelectionCollection'/>. - /// </para> - /// </summary> - /// <param name='value'> - /// A <see cref='SelectionCollection'/> from which the contents are copied - /// </param> - public SelectionCollection(SelectionCollection value) - { - this.AddRange(value); - } - - /// <summary> - /// <para> - /// Initializes a new instance of <see cref='SelectionCollection'/> containing any array of <see cref='ISelection'/> objects. - /// </para> - /// </summary> - /// <param name='value'> - /// A array of <see cref='ISelection'/> objects with which to intialize the collection - /// </param> - public SelectionCollection(ISelection[] value) - { - this.AddRange(value); - } - - /// <summary> - /// <para>Represents the entry at the specified index of the <see cref='ISelection'/>.</para> - /// </summary> - /// <param name='index'><para>The zero-based index of the entry to locate in the collection.</para></param> - /// <value> - /// <para> The entry at the specified index of the collection.</para> - /// </value> - /// <exception cref='System.ArgumentOutOfRangeException'><paramref name='index'/> is outside the valid range of indexes for the collection.</exception> - public ISelection this[int index] - { - get { - return ((ISelection)(List[index])); - } - set { - List[index] = value; - } - } - - /// <summary> - /// <para>Adds a <see cref='ISelection'/> with the specified value to the - /// <see cref='SelectionCollection'/> .</para> - /// </summary> - /// <param name='value'>The <see cref='ISelection'/> to add.</param> - /// <returns> - /// <para>The index at which the new element was inserted.</para> - /// </returns> - /// <seealso cref='SelectionCollection.AddRange'/> - public int Add(ISelection value) - { - return List.Add(value); - } - - /// <summary> - /// <para>Copies the elements of an array to the end of the <see cref='SelectionCollection'/>.</para> - /// </summary> - /// <param name='value'> - /// An array of type <see cref='ISelection'/> containing the objects to add to the collection. - /// </param> - /// <returns> - /// <para>None.</para> - /// </returns> - /// <seealso cref='SelectionCollection.Add'/> - public void AddRange(ISelection[] value) - { - for (int i = 0; (i < value.Length); i = (i + 1)) { - this.Add(value[i]); - } - } - - /// <summary> - /// <para> - /// Adds the contents of another <see cref='SelectionCollection'/> to the end of the collection. - /// </para> - /// </summary> - /// <param name='value'> - /// A <see cref='SelectionCollection'/> containing the objects to add to the collection. - /// </param> - /// <returns> - /// <para>None.</para> - /// </returns> - /// <seealso cref='SelectionCollection.Add'/> - public void AddRange(SelectionCollection value) - { - for (int i = 0; (i < value.Count); i = (i + 1)) { - this.Add(value[i]); - } - } - - /// <summary> - /// <para>Gets a value indicating whether the - /// <see cref='SelectionCollection'/> contains the specified <see cref='ISelection'/>.</para> - /// </summary> - /// <param name='value'>The <see cref='ISelection'/> to locate.</param> - /// <returns> - /// <para><see langword='true'/> if the <see cref='ISelection'/> is contained in the collection; - /// otherwise, <see langword='false'/>.</para> - /// </returns> - /// <seealso cref='SelectionCollection.IndexOf'/> - public bool Contains(ISelection value) - { - return List.Contains(value); - } - - /// <summary> - /// <para>Copies the <see cref='SelectionCollection'/> values to a one-dimensional <see cref='System.Array'/> instance at the - /// specified index.</para> - /// </summary> - /// <param name='array'><para>The one-dimensional <see cref='System.Array'/> that is the destination of the values copied from <see cref='SelectionCollection'/> .</para></param> - /// <param name='index'>The index in <paramref name='array'/> where copying begins.</param> - /// <returns> - /// <para>None.</para> - /// </returns> - /// <exception cref='System.ArgumentException'><para><paramref name='array'/> is multidimensional.</para> <para>-or-</para> <para>The number of elements in the <see cref='SelectionCollection'/> is greater than the available space between <paramref name='arrayIndex'/> and the end of <paramref name='array'/>.</para></exception> - /// <exception cref='System.ArgumentNullException'><paramref name='array'/> is <see langword='null'/>. </exception> - /// <exception cref='System.ArgumentOutOfRangeException'><paramref name='arrayIndex'/> is less than <paramref name='array'/>'s lowbound. </exception> - /// <seealso cref='System.Array'/> - public void CopyTo(ISelection[] array, int index) - { - List.CopyTo(array, index); - } - - /// <summary> - /// <para>Returns the index of a <see cref='ISelection'/> in - /// the <see cref='SelectionCollection'/> .</para> - /// </summary> - /// <param name='value'>The <see cref='ISelection'/> to locate.</param> - /// <returns> - /// <para>The index of the <see cref='ISelection'/> of <paramref name='value'/> in the - /// <see cref='SelectionCollection'/>, if found; otherwise, -1.</para> - /// </returns> - /// <seealso cref='SelectionCollection.Contains'/> - public int IndexOf(ISelection value) - { - return List.IndexOf(value); - } - - /// <summary> - /// <para>Inserts a <see cref='ISelection'/> into the <see cref='SelectionCollection'/> at the specified index.</para> - /// </summary> - /// <param name='index'>The zero-based index where <paramref name='value'/> should be inserted.</param> - /// <param name=' value'>The <see cref='ISelection'/> to insert.</param> - /// <returns><para>None.</para></returns> - /// <seealso cref='SelectionCollection.Add'/> - public void Insert(int index, ISelection value) - { - List.Insert(index, value); - } - - /// <summary> - /// <para>Returns an enumerator that can iterate through - /// the <see cref='SelectionCollection'/> .</para> - /// </summary> - /// <returns><para>None.</para></returns> - /// <seealso cref='System.Collections.IEnumerator'/> - public new ISelectionEnumerator GetEnumerator() - { - return new ISelectionEnumerator(this); - } - - /// <summary> - /// <para> Removes a specific <see cref='ISelection'/> from the - /// <see cref='SelectionCollection'/> .</para> - /// </summary> - /// <param name='value'>The <see cref='ISelection'/> to remove from the <see cref='SelectionCollection'/> .</param> - /// <returns><para>None.</para></returns> - /// <exception cref='System.ArgumentException'><paramref name='value'/> is not found in the Collection. </exception> - public void Remove(ISelection value) - { - List.Remove(value); - } - - /// <summary> - /// used internally - /// </summary> - public class ISelectionEnumerator : object, IEnumerator { - - private IEnumerator baseEnumerator; - - private IEnumerable temp; - - /// <summary> - /// Creates a new instance of <see cref="ISelectionEnumerator"/> - /// </summary> - public ISelectionEnumerator(SelectionCollection mappings) - { - this.temp = ((IEnumerable)(mappings)); - this.baseEnumerator = temp.GetEnumerator(); - } - - /// <remarks> - /// </remarks> - public ISelection Current { - get { - return ((ISelection)(baseEnumerator.Current)); - } - } - - object IEnumerator.Current { - get { - return baseEnumerator.Current; - } - } - - /// <remarks> - /// </remarks> - public bool MoveNext() - { - return baseEnumerator.MoveNext(); - } - - bool IEnumerator.MoveNext() - { - return baseEnumerator.MoveNext(); - } - - /// <remarks> - /// </remarks> - public void Reset() - { - baseEnumerator.Reset(); - } - - void IEnumerator.Reset() - { - baseEnumerator.Reset(); - } - } - } -} - diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/Selection/SelectionManager.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/Selection/SelectionManager.cs deleted file mode 100644 index ace9440077..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/Selection/SelectionManager.cs +++ /dev/null @@ -1,350 +0,0 @@ -// SelectionManager.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using System; -using System.Drawing; -using System.Collections; -using System.Text; -using MonoDevelop.TextEditor.Undo; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// This class manages the selections in a document. - /// </summary> - public class SelectionManager - { - IDocument document; - SelectionCollection selectionCollection = new SelectionCollection(); - - /// <value> - /// A collection containing all selections. - /// </value> - public SelectionCollection SelectionCollection { - get { - return selectionCollection; - } - } - - /// <value> - /// true if the <see cref="SelectionCollection"/> is not empty, false otherwise. - /// </value> - public bool HasSomethingSelected { - get { - return selectionCollection.Count > 0; - } - } - - /// <value> - /// The text that is currently selected. - /// </value> - public string SelectedText { - get { - StringBuilder builder = new StringBuilder(); - -// PriorityQueue queue = new PriorityQueue(); - - foreach (ISelection s in selectionCollection) { - builder.Append(s.SelectedText); -// queue.Insert(-s.Offset, s); - } - -// while (queue.Count > 0) { -// ISelection s = ((ISelection)queue.Remove()); -// builder.Append(s.SelectedText); -// } - - return builder.ToString(); - } - } - - /// <summary> - /// Creates a new instance of <see cref="SelectionManager"/> - /// </summary> - public SelectionManager(IDocument document) - { - this.document = document; - document.DocumentChanged += new DocumentEventHandler(DocumentChanged); - } - - void DocumentChanged(object sender, DocumentEventArgs e) - { - if (e.Text == null) { - Remove(e.Offset, e.Length); - } else { - if (e.Length < 0) { - Insert(e.Offset, e.Text); - } else { - Replace(e.Offset, e.Length, e.Text); - } - } - } - - /// <remarks> - /// Clears the selection and sets a new selection - /// using the given <see cref="ISelection"/> object. - /// </remarks> - public void SetSelection(ISelection selection) - { -// autoClearSelection = false; - ClearSelection(); - - if (selection != null) { - selectionCollection.Add(selection); - document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.LinesBetween, selection.StartPosition.Y, selection.EndPosition.Y)); - document.CommitUpdate(); - OnSelectionChanged(EventArgs.Empty); - } - } - - bool GreaterEqPos(Point p1, Point p2) - { - return p1.Y > p2.Y || p1.Y == p2.Y && p1.X >= p2.X; - } - - public void ExtendSelection(Point oldPosition, Point newPosition) - { - //TODO: Andrea darf basteln - if (oldPosition == newPosition) { - return; - } - Point min; - Point max; - bool oldIsGreater = GreaterEqPos(oldPosition, newPosition); - if (oldIsGreater) { - min = newPosition; - max = oldPosition; - } else { - min = oldPosition; - max = newPosition; - } - if (!HasSomethingSelected) { - SetSelection(new DefaultSelection(document, min, max)); - return; - } - ISelection selection = this.selectionCollection[0]; - if (selection.ContainsPosition(newPosition)) { - if (oldIsGreater) { - selection.EndPosition = newPosition; - } else { - selection.StartPosition = newPosition; - } - } else { - if (oldPosition == selection.StartPosition) { - if (GreaterEqPos(newPosition, selection.EndPosition)) { - selection.StartPosition = selection.EndPosition; - selection.EndPosition = newPosition; - } else { - selection.StartPosition = newPosition; - } - } else { - if (GreaterEqPos(selection.StartPosition, newPosition)) { - selection.EndPosition = selection.StartPosition; - selection.StartPosition = newPosition; - } else { - selection.EndPosition = newPosition; - } - } - } - -// if (GreaterEqPos(selection.StartPosition, min) && GreaterEqPos(selection.EndPosition, max)) { -// if (oldIsGreater) { -// selection.StartPosition = min; -// } else { -// selection.StartPosition = max; -// } -// } else { -// if (oldIsGreater) { -// selection.EndPosition = min; -// } else { -// selection.EndPosition = max; -// } -// } - document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.LinesBetween, min.Y, max.Y)); - document.CommitUpdate(); - OnSelectionChanged(EventArgs.Empty); - } - - /// <remarks> - /// Clears the selection. - /// </remarks> - public void ClearSelection() - { - while (selectionCollection.Count > 0) { - ISelection selection = selectionCollection[selectionCollection.Count - 1]; - selectionCollection.RemoveAt(selectionCollection.Count - 1); - document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.LinesBetween, selection.StartPosition.Y, selection.EndPosition.Y)); - OnSelectionChanged(EventArgs.Empty); - } - document.CommitUpdate(); - } - - /// <remarks> - /// Removes the selected text from the buffer and clears - /// the selection. - /// </remarks> - public void RemoveSelectedText() - { - ArrayList lines = new ArrayList(); - int offset = -1; - bool oneLine = true; -// PriorityQueue queue = new PriorityQueue(); - foreach (ISelection s in selectionCollection) { -// ISelection s = ((ISelection)queue.Remove()); - if (oneLine) { - int lineBegin = s.StartPosition.Y; - if (lineBegin != s.EndPosition.Y) { - oneLine = false; - } else { - lines.Add(lineBegin); - } - } - offset = s.Offset; - document.Remove(s.Offset, s.Length); - -// queue.Insert(-s.Offset, s); - } - ClearSelection(); - if (offset >= 0) { -// TODO: -// document.Caret.Offset = offset; - } - if (offset != -1) { - if (oneLine) { - foreach (int i in lines) { - document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, i)); - } - } else { - document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.WholeTextArea)); - } - document.CommitUpdate(); - } - } - - - bool SelectionsOverlap(ISelection s1, ISelection s2) - { - return (s1.Offset <= s2.Offset && s2.Offset <= s1.Offset + s1.Length) || - (s1.Offset <= s2.Offset + s2.Length && s2.Offset + s2.Length <= s1.Offset + s1.Length) || - (s1.Offset >= s2.Offset && s1.Offset + s1.Length <= s2.Offset + s2.Length); - } - - /// <remarks> - /// Returns true if the given offset points to a section which is - /// selected. - /// </remarks> - public bool IsSelected(int offset) - { - return GetSelectionAt(offset) != null; - } - - /// <remarks> - /// Returns a <see cref="ISelection"/> object giving the selection in which - /// the offset points to. - /// </remarks> - /// <returns> - /// <code>null</code> if the offset doesn't point to a selection - /// </returns> - public ISelection GetSelectionAt(int offset) - { - foreach (ISelection s in selectionCollection) { - if (s.ContainsOffset(offset)) { - return s; - } - } - return null; - } - - /// <remarks> - /// Used internally, do not call. - /// </remarks> - public void Insert(int offset, string text) - { -// foreach (ISelection selection in SelectionCollection) { -// if (selection.Offset > offset) { -// selection.Offset += text.Length; -// } else if (selection.Offset + selection.Length > offset) { -// selection.Length += text.Length; -// } -// } - } - - /// <remarks> - /// Used internally, do not call. - /// </remarks> - public void Remove(int offset, int length) - { -// foreach (ISelection selection in selectionCollection) { -// if (selection.Offset > offset) { -// selection.Offset -= length; -// } else if (selection.Offset + selection.Length > offset) { -// selection.Length -= length; -// } -// } - } - - /// <remarks> - /// Used internally, do not call. - /// </remarks> - public void Replace(int offset, int length, string text) - { -// foreach (ISelection selection in selectionCollection) { -// if (selection.Offset > offset) { -// selection.Offset = selection.Offset - length + text.Length; -// } else if (selection.Offset + selection.Length > offset) { -// selection.Length = selection.Length - length + text.Length; -// } -// } - } - - public ColumnRange GetSelectionAtLine(int lineNumber) - { - foreach (ISelection selection in selectionCollection) { - int startLine = selection.StartPosition.Y; - int endLine = selection.EndPosition.Y; - if (startLine < lineNumber && lineNumber < endLine) { - return ColumnRange.WholeColumn; - } - - if (startLine == lineNumber) { - LineSegment line = document.GetLineSegment(startLine); - int startColumn = selection.StartPosition.X; - int endColumn = endLine == lineNumber ? selection.EndPosition.X : line.Length + 1; - return new ColumnRange(startColumn, endColumn); - } - - if (endLine == lineNumber) { - int endColumn = selection.EndPosition.X; - return new ColumnRange(0, endColumn); - } - } - - return ColumnRange.NoColumn; - } - - protected virtual void OnSelectionChanged(EventArgs e) - { - if (SelectionChanged != null) { - SelectionChanged(this, e); - } - } - - public event EventHandler SelectionChanged; - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/TextBufferStrategy/GapTextBufferStrategy.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/TextBufferStrategy/GapTextBufferStrategy.cs deleted file mode 100644 index 3a8c8e800f..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/TextBufferStrategy/GapTextBufferStrategy.cs +++ /dev/null @@ -1,150 +0,0 @@ -// GapTextBufferStrategy.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Text; - -namespace MonoDevelop.TextEditor.Document -{ - public class GapTextBufferStrategy : ITextBufferStrategy - { - char[] buffer = new char[0]; - - int gapBeginOffset = 0; - int gapEndOffset = 0; - - int minGapLength = 32; - int maxGapLength = 256; - - public int Length { - get { - return buffer.Length - GapLength; - } - } - - int GapLength { - get { - return gapEndOffset - gapBeginOffset; - } - } - - public void SetContent(string text) - { - if (text == null) { - text = String.Empty; - } - buffer = text.ToCharArray(); - gapBeginOffset = gapEndOffset = 0; - } - - public char GetCharAt(int offset) - { - return offset < gapBeginOffset ? buffer[offset] : buffer[offset + GapLength]; - } - - public string GetText(int offset, int length) - { - int end = offset + length; - - if (end < gapBeginOffset) { - return new string(buffer, offset, length); - } - - if (offset > gapBeginOffset) { - return new string(buffer, offset + GapLength, length); - } - - StringBuilder buf = new StringBuilder(); - buf.Append(buffer, offset, gapBeginOffset - offset); - buf.Append(buffer, gapEndOffset, end - gapBeginOffset); - return buf.ToString(); - } - - public void Insert(int offset, string text) - { - Replace(offset, 0, text); - } - - public void Remove(int offset, int length) - { - Replace(offset, length, String.Empty); - } - - public void Replace(int offset, int length, string text) - { - if (text == null) { - text = String.Empty; - } - - // Math.Max is used so that if we need to resize the array - // the new array has enough space for all old chars - PlaceGap(offset + length, Math.Max(text.Length - length, 0)); - text.CopyTo(0, buffer, offset, text.Length); - gapBeginOffset += text.Length - length; - } - - void PlaceGap(int offset, int length) - { - int deltaLength = GapLength - length; - // if the gap has the right length, move the chars between offset and gap - if (minGapLength <= deltaLength && deltaLength <= maxGapLength) { - int delta = gapBeginOffset - offset; - // check if the gap is already in place - if (offset == gapBeginOffset) { - return; - } else if (offset < gapBeginOffset) { - int gapLength = gapEndOffset - gapBeginOffset; - Array.Copy(buffer, offset, buffer, offset + gapLength, delta); - } else { //offset > gapBeginOffset - Array.Copy(buffer, gapEndOffset, buffer, gapBeginOffset, -delta); - } - gapBeginOffset -= delta; - gapEndOffset -= delta; - return; - } - - // the gap has not the right length so - // create new Buffer with new size and copy - int oldLength = GapLength; - int newLength = maxGapLength + length; - int newGapEndOffset = offset + newLength; - char[] newBuffer = new char[buffer.Length + newLength - oldLength]; - - if (oldLength == 0) { - Array.Copy(buffer, 0, newBuffer, 0, offset); - Array.Copy(buffer, offset, newBuffer, newGapEndOffset, newBuffer.Length - newGapEndOffset); - } else if (offset < gapBeginOffset) { - int delta = gapBeginOffset - offset; - Array.Copy(buffer, 0, newBuffer, 0, offset); - Array.Copy(buffer, offset, newBuffer, newGapEndOffset, delta); - Array.Copy(buffer, gapEndOffset, newBuffer, newGapEndOffset + delta, buffer.Length - gapEndOffset); - } else { - int delta = offset - gapBeginOffset; - Array.Copy(buffer, 0, newBuffer, 0, gapBeginOffset); - Array.Copy(buffer, gapEndOffset, newBuffer, gapBeginOffset, delta); - Array.Copy(buffer, gapEndOffset + delta, newBuffer, newGapEndOffset, newBuffer.Length - newGapEndOffset); - } - - buffer = newBuffer; - gapBeginOffset = offset; - gapEndOffset = newGapEndOffset; - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/TextBufferStrategy/ITextBufferStrategy.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/TextBufferStrategy/ITextBufferStrategy.cs deleted file mode 100644 index 392fd00b7f..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/TextBufferStrategy/ITextBufferStrategy.cs +++ /dev/null @@ -1,99 +0,0 @@ -// ITextBufferStrategy.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using MonoDevelop.TextEditor.Undo; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// Interface to describe a sequence of characters that can be edited. - /// </summary> - public interface ITextBufferStrategy - { - /// <value> - /// The current length of the sequence of characters that can be edited. - /// </value> - int Length { - get; - } - - /// <summary> - /// Inserts a string of characters into the sequence. - /// </summary> - /// <param name="offset"> - /// offset where to insert the string. - /// </param> - /// <param name="text"> - /// text to be inserted. - /// </param> - void Insert(int offset, string text); - - /// <summary> - /// Removes some portion of the sequence. - /// </summary> - /// <param name="offset"> - /// offset of the remove. - /// </param> - /// <param name="length"> - /// number of characters to remove. - /// </param> - void Remove(int offset, int length); - - /// <summary> - /// Replace some portion of the sequence. - /// </summary> - /// <param name="offset"> - /// offset. - /// </param> - /// <param name="length"> - /// number of characters to replace. - /// </param> - /// <param name="text"> - /// text to be replaced with. - /// </param> - void Replace(int offset, int length, string text); - - /// <summary> - /// Fetches a string of characters contained in the sequence. - /// </summary> - /// <param name="offset"> - /// Offset into the sequence to fetch - /// </param> - /// <param name="length"> - /// number of characters to copy. - /// </param> - string GetText(int offset, int length); - - /// <summary> - /// Returns a specific char of the sequence. - /// </summary> - /// <param name="offset"> - /// Offset of the char to get. - /// </param> - char GetCharAt(int offset); - - /// <summary> - /// This method sets the stored content. - /// </summary> - /// <param name="text"> - /// The string that represents the character sequence. - /// </param> - void SetContent(string text); - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/TextBufferStrategy/StringTextBufferStrategy.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/TextBufferStrategy/StringTextBufferStrategy.cs deleted file mode 100644 index 42c3c26e0b..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/TextBufferStrategy/StringTextBufferStrategy.cs +++ /dev/null @@ -1,101 +0,0 @@ -// StringTextBufferStrategy.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.IO; -using System.Diagnostics; -using MonoDevelop.TextEditor.Undo; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// Simple implementation of the ITextBuffer interface implemented using a - /// string. - /// Only for fall-back purposes. - /// </summary> - public class StringTextBufferStrategy : ITextBufferStrategy - { - string storedText = ""; - - public int Length { - get { - return storedText.Length; - } - } - - public void Insert(int offset, string text) - { - if (text != null) { - storedText = storedText.Insert(offset, text); - } - } - - public void Remove(int offset, int length) - { - storedText = storedText.Remove(offset, length); - } - - public void Replace(int offset, int length, string text) - { - Remove(offset, length); - Insert(offset, text); - } - - public string GetText(int offset, int length) - { - if (length == 0) { - return ""; - } - return storedText.Substring(offset, Math.Min(length, storedText.Length - offset)); - } - - public char GetCharAt(int offset) - { - if (offset == Length) { - return '\0'; - } - return storedText[offset]; - } - - public void SetContent(string text) - { - storedText = text; - } - - public StringTextBufferStrategy() - { - } - - StringTextBufferStrategy(string fileName) - { - StreamReader streamReader = File.OpenText(fileName); - SetContent(streamReader.ReadToEnd()); - streamReader.Close(); - } - - public static ITextBufferStrategy CreateTextBufferFromFile(string fileName) - { - if (!File.Exists(fileName)) { - throw new System.IO.FileNotFoundException(fileName); - } - return new StringTextBufferStrategy(fileName); - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Document/TextUtilities.cs b/main/Unused/ICSharpCode.TextEditor/src/Document/TextUtilities.cs deleted file mode 100644 index 885e4283d5..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Document/TextUtilities.cs +++ /dev/null @@ -1,413 +0,0 @@ -// TextUtilities.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Text; -using System.Diagnostics; - -using MonoDevelop.TextEditor.Undo; - -namespace MonoDevelop.TextEditor.Document -{ - public sealed class TextUtilities - { - - /// <remarks> - /// This function takes a string and converts the whitespace in front of - /// it to tabs. If the length of the whitespace at the start of the string - /// was not a whole number of tabs then there will still be some spaces just - /// before the text starts. - /// the output string will be of the form: - /// 1. zero or more tabs - /// 2. zero or more spaces (less than tabIndent) - /// 3. the rest of the line - /// </remarks> - public static string LeadingWhiteSpaceToTabs(string line, int tabIndent) { - StringBuilder sb = new StringBuilder(line.Length); - int consecutiveSpaces = 0; - int i = 0; - for(i = 0; i < line.Length; i++) { - if(line[i] == ' ') { - consecutiveSpaces++; - if(consecutiveSpaces == tabIndent) { - sb.Append('\t'); - consecutiveSpaces = 0; - } - } - else if(line[i] == '\t') { - sb.Append('\t'); - // if we had say 3 spaces then a tab and tabIndent was 4 then - // we would want to simply replace all of that with 1 tab - consecutiveSpaces = 0; - } - else { - break; - } - } - if(i < line.Length) { - sb.Append(line.Substring(i-consecutiveSpaces)); - } - return sb.ToString(); - } - - public static bool IsLetterDigitOrUnderscore(char c) - { - if(!Char.IsLetterOrDigit(c)) { - return c == '_'; - } - return true; - } - - public enum CharacterType { - LetterDigitOrUnderscore, - WhiteSpace, - Other - } - - /// <remarks> - /// This method returns the expression before a specified offset. - /// That method is used in code completion to determine the expression given - /// to the parser for type resolve. - /// </remarks> - public static string GetExpressionBeforeOffset(TextArea textArea, int offset) - { - IDocument document = textArea.Document; - - while (offset - 1 > 0) { - switch (document.GetCharAt(offset - 1)) { - case '}': - goto done; -// offset = SearchBracketBackward(document, offset - 2, '{','}'); -// break; - case ']': - offset = SearchBracketBackward(document, offset - 2, '[',']'); - break; - case ')': - offset = SearchBracketBackward(document, offset - 2, '(',')'); - break; - case '.': - --offset; - break; - case '"': - return "\"\""; - case '\'': - return "'a'"; - case '>': - if (document.GetCharAt(offset - 2) == '-') { - offset -= 2; - break; - } - goto done; - default: - if (Char.IsWhiteSpace(document.GetCharAt(offset - 1))) { - --offset; - break; - } - int start = offset - 1; - if (!IsLetterDigitOrUnderscore(document.GetCharAt(start))) { - goto done; - } - - while (start > 0 && IsLetterDigitOrUnderscore(document.GetCharAt(start - 1))) { - --start; - } - - Console.WriteLine("{0} -- {1}", offset, start); - string word = document.GetText(start, offset - start).Trim(); - Console.WriteLine("word >{0}<", word); - switch (word) { - case "ref": - case "out": - case "in": - case "return": - case "throw": - case "case": - goto done; - } - - if (word.Length > 0 && !IsLetterDigitOrUnderscore(word[0])) { - goto done; - } - offset = start; - break; - } - } - done: -// Console.WriteLine("ofs : {0} cart:{1}", offset, document.Caret.Offset); -// Console.WriteLine("return:" + document.GetText(offset, document.Caret.Offset - offset).Trim()); - return document.GetText(offset, textArea.Caret.Offset - offset ).Trim(); - } - - - public static CharacterType GetCharacterType(char c) - { - if(IsLetterDigitOrUnderscore(c)) - return CharacterType.LetterDigitOrUnderscore; - if(Char.IsWhiteSpace(c)) - return CharacterType.WhiteSpace; - return CharacterType.Other; - } - - public static int GetFirstNonWSChar(IDocument document, int offset) - { - while (offset < document.TextLength && Char.IsWhiteSpace(document.GetCharAt(offset))) { - ++offset; - } - return offset; - } - - public static int FindWordEnd(IDocument document, int offset) - { - LineSegment line = document.GetLineSegmentForOffset(offset); - int endPos = line.Offset + line.Length; - while (offset < endPos && IsLetterDigitOrUnderscore(document.GetCharAt(offset))) { - ++offset; - } - - return offset; - } - - public static int FindWordStart(IDocument document, int offset) - { - LineSegment line = document.GetLineSegmentForOffset(offset); - - while (offset > line.Offset && !IsLetterDigitOrUnderscore(document.GetCharAt(offset - 1))) { - --offset; - } - - return offset; - } - - // go forward to the start of the next word - // if the cursor is at the start or in the middle of a word we move to the end of the word - // and then past any whitespace that follows it - // if the cursor is at the start or in the middle of some whitespace we move to the start of the - // next word - public static int FindNextWordStart(IDocument document, int offset) - { - int originalOffset = offset; - LineSegment line = document.GetLineSegmentForOffset(offset); - int endPos = line.Offset + line.Length; - // lets go to the end of the word, whitespace or operator - CharacterType t = GetCharacterType(document.GetCharAt(offset)); - while (offset < endPos && GetCharacterType(document.GetCharAt(offset)) == t) { - ++offset; - } - - // now we're at the end of the word, lets find the start of the next one by skipping whitespace - while (offset < endPos && GetCharacterType(document.GetCharAt(offset)) == CharacterType.WhiteSpace) { - ++offset; - } - - return offset; - } - - // go back to the start of the word we are on - // if we are already at the start of a word or if we are in whitespace, then go back - // to the start of the previous word - public static int FindPrevWordStart(IDocument document, int offset) - { - int originalOffset = offset; - LineSegment line = document.GetLineSegmentForOffset(offset); - if (offset > 0) { - CharacterType t = GetCharacterType(document.GetCharAt(offset - 1)); - while (offset > line.Offset && GetCharacterType(document.GetCharAt(offset - 1)) == t) { - --offset; - } - - // if we were in whitespace, and now we're at the end of a word or operator, go back to the beginning of it - if(t == CharacterType.WhiteSpace && offset > line.Offset) { - t = GetCharacterType(document.GetCharAt(offset - 1)); - while (offset > line.Offset && GetCharacterType(document.GetCharAt(offset - 1)) == t) { - --offset; - } - } - } - - return offset; - } - - public static string GetLineAsString(IDocument document, int lineNumber) - { - LineSegment line = document.GetLineSegment(lineNumber); - return document.GetText(line.Offset, line.Length); - } - - static bool ScanLineComment(IDocument document, int offset) - { - while (offset > 0 && offset < document.TextLength) { - char ch = document.GetCharAt(offset); - switch (ch) { - case '\r': - case '\n': - return false; - case '/': - if (document.GetCharAt(offset + 1) == '/') { - return true; - } - break; - } - --offset; - } - return false; - } - - public static int SearchBracketBackward(IDocument document, int offset, char openBracket, char closingBracket) - { - int brackets = -1; - - bool inString = false; - bool inChar = false; - - bool blockComment = false; - - while (offset >= 0 && offset < document.TextLength) { - char ch = document.GetCharAt(offset); - switch (ch) { - case '/': - if (blockComment) { - if (document.GetCharAt(offset + 1) == '*') { - blockComment = false; - } - } - if (!inString && !inChar && offset + 1 < document.TextLength) { - if (offset > 0 && document.GetCharAt(offset - 1) == '*') { - blockComment = true; - } - } - break; - case '"': - if (!inChar && !blockComment && !ScanLineComment(document, offset)) { - inString = !inString; - } - break; - case '\'': - if (!inString && !blockComment && !ScanLineComment(document, offset)) { - inChar = !inChar; - } - break; - default : - if (ch == closingBracket) { - if (!(inString || inChar || blockComment) && !ScanLineComment(document, offset)) { - --brackets; - } - } else if (ch == openBracket) { - if (!(inString || inChar || blockComment) && !ScanLineComment(document, offset)) { - ++brackets; - if (brackets == 0) { - return offset; - } - } - } - break; - } - --offset; - } - return - 1; - } - - public static int SearchBracketForward(IDocument document, int offset, char openBracket, char closingBracket) - { - int brackets = 1; - - bool inString = false; - bool inChar = false; - - bool lineComment = false; - bool blockComment = false; - - if (offset >= 0) { - while (offset < document.TextLength) { - char ch = document.GetCharAt(offset); - switch (ch) { - case '\r': - case '\n': - lineComment = false; - break; - case '/': - if (blockComment) { - Debug.Assert(offset > 0); - if (document.GetCharAt(offset - 1) == '*') { - blockComment = false; - } - } - if (!inString && !inChar && offset + 1 < document.TextLength) { - if (!blockComment && document.GetCharAt(offset + 1) == '/') { - lineComment = true; - } - if (!lineComment && document.GetCharAt(offset + 1) == '*') { - blockComment = true; - } - } - break; - case '"': - if (!(inChar || lineComment || blockComment)) { - inString = !inString; - } - break; - case '\'': - if (!(inString || lineComment || blockComment)) { - inChar = !inChar; - } - break; - default : - if (ch == openBracket) { - if (!(inString || inChar || lineComment || blockComment)) { - ++brackets; - } - } else if (ch == closingBracket) { - if (!(inString || inChar || lineComment || blockComment)) { - --brackets; - if (brackets == 0) { - return offset; - } - } - } - break; - } - ++offset; - } - } - return -1; - } - - /// <remarks> - /// Returns true, if the line lineNumber is empty or filled with whitespaces. - /// </remarks> - public static bool IsEmptyLine(IDocument document, int lineNumber) - { - return IsEmptyLine(document, document.GetLineSegment(lineNumber)); - } - - /// <remarks> - /// Returns true, if the line lineNumber is empty or filled with whitespaces. - /// </remarks> - public static bool IsEmptyLine(IDocument document, LineSegment line) - { - for (int i = line.Offset; i < line.Offset + line.Length; ++i) { - char ch = document.GetCharAt(i); - if (!Char.IsWhiteSpace(ch)) { - return false; - } - } - return true; - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Gui/AbstractMargin.cs b/main/Unused/ICSharpCode.TextEditor/src/Gui/AbstractMargin.cs deleted file mode 100644 index b04edb8742..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Gui/AbstractMargin.cs +++ /dev/null @@ -1,91 +0,0 @@ -// AbstractMargin.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.Drawing; -using MonoDevelop.TextEditor.Document; - -using Gdk; - -namespace MonoDevelop.TextEditor -{ - /// <summary> - /// This class views the line numbers and folding markers. - /// </summary> - public abstract class AbstractMargin - { - protected System.Drawing.Rectangle drawingPosition = new System.Drawing.Rectangle(0, 0, 0, 0); - protected TextArea textArea; - - public System.Drawing.Rectangle DrawingPosition { - get { - return drawingPosition; - } - set { - drawingPosition = value; - } - } - - public TextArea TextArea { - get { - return textArea; - } - } - - public IDocument Document { - get { - return textArea.Document; - } - } - - public ITextEditorProperties TextEditorProperties { - get { - return textArea.Document.TextEditorProperties; - } - } - - public virtual Cursor Cursor { - get { - //return Cursors.Default; - return null; - } - } - - public virtual Size Size { - get { - return new Size(-1, -1); - } - } - - public virtual bool IsVisible { - get { - return true; - } - } - - public AbstractMargin(TextArea textArea) - { - this.textArea = textArea; - } - - public abstract void Paint(Gdk.Drawable wnd, System.Drawing.Rectangle rect); - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Gui/BracketHighlighter.cs b/main/Unused/ICSharpCode.TextEditor/src/Gui/BracketHighlighter.cs deleted file mode 100644 index 4518aca3de..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Gui/BracketHighlighter.cs +++ /dev/null @@ -1,111 +0,0 @@ -// BracketHighlighter.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.Drawing; -using System.Diagnostics; - -using MonoDevelop.TextEditor.Document; - -namespace MonoDevelop.TextEditor -{ - public class Highlight - { - Point openBrace; - Point closeBrace; - - public Point OpenBrace { - get { - return openBrace; - } - set { - openBrace = value; - } - } - public Point CloseBrace { - get { - return closeBrace; - } - set { - closeBrace = value; - } - } - - public Highlight(Point openBrace, Point closeBrace) - { - this.openBrace = openBrace; - this.closeBrace = closeBrace; - } - } - - public class BracketHighlightingSheme - { - char opentag; - char closingtag; - - public char OpenTag { - get { - return opentag; - } - set { - opentag = value; - } - } - - public char ClosingTag { - get { - return closingtag; - } - set { - closingtag = value; - } - } - - public BracketHighlightingSheme(char opentag, char closingtag) - { - this.opentag = opentag; - this.closingtag = closingtag; - } - public Highlight GetHighlight(IDocument document, int offset) - { - char word = document.GetCharAt(Math.Max(0, Math.Min(document.TextLength - 1, offset))); - Point endP = document.OffsetToPosition(offset); - if (word == opentag) { - if (offset < document.TextLength) { - int bracketOffset = TextUtilities.SearchBracketForward(document, offset + 1, opentag, closingtag); - if (bracketOffset >= 0) { - Point p = document.OffsetToPosition(bracketOffset); - return new Highlight(p, endP); - } - } - } else if (word == closingtag) { - if (offset > 0) { - int bracketOffset = TextUtilities.SearchBracketBackward(document, offset - 1, opentag, closingtag); - if (bracketOffset >= 0) { - Point p = document.OffsetToPosition(bracketOffset); - return new Highlight(p, endP); - } - } - } - return null; - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Gui/Caret.cs b/main/Unused/ICSharpCode.TextEditor/src/Gui/Caret.cs deleted file mode 100644 index d5d9824dbf..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Gui/Caret.cs +++ /dev/null @@ -1,293 +0,0 @@ -// Caret.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.IO; -using System.Drawing; -using System.Drawing.Text; -using System.Diagnostics; -using System.Text; - -using MonoDevelop.TextEditor.Document; - -namespace MonoDevelop.TextEditor -{ - /// <summary> - /// In this enumeration are all caret modes listed. - /// </summary> - public enum CaretMode { - /// <summary> - /// If the caret is in insert mode typed characters will be - /// inserted at the caret position - /// </summary> - InsertMode, - - /// <summary> - /// If the caret is in overwirte mode typed characters will - /// overwrite the character at the caret position - /// </summary> - OverwriteMode - } - - - public class Caret : System.IDisposable - { - int line = 0; - int column = 0; - int desiredColumn = 0; - Gdk.Point physicalPosition; - CaretMode caretMode; - uint currentTimeout = 0; - - static bool caretCreated = false; - bool hidden = false; - bool blinkShows = false; - TextArea textArea; - - /// <value> - /// The 'prefered' column in which the caret moves, when it is moved - /// up/down. - /// </value> - public int DesiredColumn { - get { - return desiredColumn; - } - set { - desiredColumn = value; - } - } - - /// <value> - /// The current caret mode. - /// </value> - public CaretMode CaretMode { - get { - return caretMode; - } - set { - caretMode = value; - OnCaretModeChanged(EventArgs.Empty); - } - } - - public int Line { - get { - return line; - } - set { - int oldLine = line; - line = value; - ValidateCaretPos(); - UpdateCaretPosition(oldLine, column, line, column); - OnPositionChanged(EventArgs.Empty); - //Console.WriteLine("set_Line: Caret position ({0}, {1})", line, column); - } - } - - public int Column { - get { - return column; - } - set { - int oldColumn = column; - column = value; - ValidateCaretPos(); - UpdateCaretPosition(line, oldColumn, line, column); - OnPositionChanged(EventArgs.Empty); - //Console.WriteLine("set_Column: Caret position ({0}, {1})", line, column); - } - } - - public Point Position { - get { - return new Point(column, line); - } - set { - int oldLine = line; - int oldColumn = column; - line = value.Y; - column = value.X; - ValidateCaretPos(); - UpdateCaretPosition(oldLine, oldColumn, line, column); - OnPositionChanged(EventArgs.Empty); - //Console.WriteLine("set_Position: Caret position ({0}, {1})", line, column); - } - } - - public Gdk.Point PhysicalPosition { - get { - return physicalPosition; - } - set { - physicalPosition = value; - } - } - - public void Paint(Gdk.Drawable g, Gdk.GC gc) { - if (hidden || !blinkShows) { - return; - } - int x = physicalPosition.x; - int y = physicalPosition.y; - int xp = physicalPosition.x + (int)textArea.TextView.GetWidth(' ') - 1; - int yp = physicalPosition.y + textArea.TextView.FontHeight - 1; - - if (caretMode == CaretMode.OverwriteMode) { - g.DrawLine(gc, x, y, x, yp); - g.DrawLine(gc, xp, y, xp, yp); - g.DrawLine(gc, x, y, xp, y); - g.DrawLine(gc, x, yp, xp, yp); - } else { - g.DrawLine(gc, x, y, x, yp); - g.DrawLine(gc, x + 1, y, x + 1, yp); - } - } - - public int Offset { - get { - return textArea.Document.PositionToOffset(Position); - } - } - - public Caret(TextArea textArea) - { - this.textArea = textArea; - textArea.FocusInEvent += new GtkSharp.FocusInEventHandler(GotFocus); - textArea.FocusOutEvent += new GtkSharp.FocusOutEventHandler(LostFocus); - //textArea.GotFocus += new EventHandler(GotFocus); - //textArea.LostFocus += new EventHandler(LostFocus); - } - - /// <remarks> - /// If the caret position is outside the document text bounds - /// it is set to the correct position by calling ValidateCaretPos. - /// </remarks> - public void ValidateCaretPos() - { - line = Math.Max(0, Math.Min(textArea.Document.TotalNumberOfLines - 1, line)); - column = Math.Max(0, column); - - if (!textArea.TextEditorProperties.AllowCaretBeyondEOL) { - LineSegment lineSegment = textArea.Document.GetLineSegment(line); - column = Math.Min(column, lineSegment.Length); - } - } - -#if GTK - void GotFocus(object sender, GtkSharp.FocusInEventArgs e) -#else - void GotFocus(object sender, EventArgs e) -#endif - { - StartBlinking(); - hidden = false; - if (!textArea.MotherTextEditorControl.IsUpdating) { - //CreateCaret(); - } - } - -#if GTK - void LostFocus(object sender, GtkSharp.FocusOutEventArgs e) -#else - void LostFocus(object sender, EventArgs e) -#endif - { - EndBlinking(); - hidden = true; - //DisposeCaret(); - } - - bool DoBlink() { - textArea.Invalidate(new System.Drawing.Rectangle(physicalPosition.x, physicalPosition.y, (int)textArea.TextView.GetWidth('w'), (int)textArea.TextView.FontHeight)); - blinkShows = !blinkShows; - return true; - } - - void StartBlinking() { - if (currentTimeout != 0) { - return; - } - currentTimeout = Gtk.Timeout.Add(500, new Gtk.Function(DoBlink)); - } - - void EndBlinking() { - if (currentTimeout == 0) { - return; - } - Gtk.Timeout.Remove(currentTimeout); - currentTimeout = 0; - } - - public void UpdateCaretPosition() { - // Nothin (remove) - } - - public void UpdateCaretPosition(int oldLine, int oldColumn, int newLine, int newColumn) - { - if (hidden) { - return; - } - try { - //ValidateCaretPos(); - textArea.UpdateLineToEnd(oldLine, 0); - if (newLine != oldLine) { - textArea.UpdateLineToEnd(newLine, 0); - } - - } catch (Exception e) { - Console.WriteLine("Got exception while update caret position : " + e); - } - } - - protected virtual void OnPositionChanged(EventArgs e) - { - EndBlinking(); - blinkShows = true; - if (PositionChanged != null) { - PositionChanged(this, e); - } - textArea.ScrollToCaret(); - StartBlinking(); - } - - protected virtual void OnCaretModeChanged(EventArgs e) - { - if (CaretModeChanged != null) { - CaretModeChanged(this, e); - } - caretCreated = false; - } - - public void Dispose() - { - } - - /// <remarks> - /// Is called each time the caret is moved. - /// </remarks> - public event EventHandler PositionChanged; - - /// <remarks> - /// Is called each time the CaretMode has changed. - /// </remarks> - public event EventHandler CaretModeChanged; - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Gui/CompletionWindow/CompletionWindow.cs b/main/Unused/ICSharpCode.TextEditor/src/Gui/CompletionWindow/CompletionWindow.cs deleted file mode 100644 index cd2497c8cf..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Gui/CompletionWindow/CompletionWindow.cs +++ /dev/null @@ -1,340 +0,0 @@ -// CompletionWindow.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Reflection; -using System.Collections; - -using MonoDevelop.TextEditor; - -using Gtk; -using GtkSharp; - -namespace MonoDevelop.TextEditor.Gui.CompletionWindow -{ - public class CompletionWindow : Window - { - const int DeclarationIndent = 1; - static GLib.GType type; - Gtk.TreeViewColumn complete_column; - - ICompletionDataProvider completionDataProvider; - TextEditorControl control; - Gtk.TreeView listView; - Gtk.TreeStore store; - DeclarationViewWindow declarationviewwindow = new DeclarationViewWindow(); - Gdk.Pixbuf[] imgList; - int insertLength = 0; - - string GetTypedString() - { - return control.Document.GetText(control.ActiveTextAreaControl.Caret.Offset - insertLength, insertLength); - } - - void DeleteInsertion() - { - if (insertLength > 0) { - int startOffset = control.ActiveTextAreaControl.Caret.Offset - insertLength; - control.Document.Remove(startOffset, insertLength); - control.ActiveTextAreaControl.Caret.Position = control.Document.OffsetToPosition(startOffset); - control.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, new Point(0, control.Document.GetLineNumberForOffset(control.ActiveTextAreaControl.Caret.Offset)))); - control.Document.CommitUpdate(); - } - } - - // 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) { - new MonoDevelop.TextEditor.Actions.Backspace().Execute(control.ActiveTextAreaControl.TextArea); - if (insertLength > 0) { - --insertLength; - } else { - // no need to delete here (insertLength <= 0) - LostFocusListView(null, null); - } - } - } - void ListKeypressEvent(object sender, KeyPressEventArgs ex) - { - Gdk.Key key = ex.Event.Key; - char val = (char) key; - switch (key) { - case Gdk.Key.Shift_L: - case Gdk.Key.Shift_R: - case Gdk.Key.Control_L: - case Gdk.Key.Control_R: - ex.RetVal = true; - return; - - case Gdk.Key.Escape: - LostFocusListView(null, null); - ex.RetVal = true; - return; - - case Gdk.Key.BackSpace: - new MonoDevelop.TextEditor.Actions.Backspace().Execute(control.ActiveTextAreaControl.TextArea); - if (insertLength > 0) { - --insertLength; - } else { - // no need to delete here (insertLength <= 0) - LostFocusListView(null, null); - } - break; - - default: - if (val != '_' && !Char.IsLetterOrDigit(val)) { - if (listView.Selection.CountSelectedRows() > 0) { - ActivateItem(null, null); - } else { - LostFocusListView(null, null); - } - - control.ActiveTextAreaControl.TextArea.SimulateKeyPress(key); - ex.RetVal = true; - return; - } else { - control.ActiveTextAreaControl.TextArea.InsertChar(val); - ++insertLength; - } - break; - } - - // select the current typed word - int lastSelected = -1; - int capitalizationIndex = -1; - - 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); - - 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]) { - ++currentCapitalizationIndex; - } - } - - if (currentCapitalizationIndex > capitalizationIndex) { - lastSelected = i; - capitalizationIndex = currentCapitalizationIndex; - } - } - } - - listView.Selection.UnselectAll(); - if (lastSelected != -1) { - TreePath path = new TreePath("" + (lastSelected + 1)); - listView.Selection.SelectPath(path); - listView.SetCursor (path, complete_column, false); - listView.ScrollToCell(path, null, false, 0, 0); - } - - ex.RetVal = true; - } - - void InitializeControls() - { - RequestSize = new Size (340, 210 - 85); - Decorated = false; - SkipPagerHint = true; - SkipTaskbarHint = true; - TypeHint = Gdk.WindowTypeHint.Dialog; - - store = new Gtk.TreeStore (typeof (string), typeof (Gdk.Pixbuf), typeof(ICompletionData)); - listView = new Gtk.TreeView (store); - - listView.HeadersVisible = false; - - complete_column = new Gtk.TreeViewColumn (); - complete_column.Title = "completion"; - - Gtk.CellRendererPixbuf pix_render = new Gtk.CellRendererPixbuf (); - complete_column.PackStart (pix_render, false); - complete_column.AddAttribute (pix_render, "pixbuf", 1); - - Gtk.CellRendererText text_render = new Gtk.CellRendererText (); - complete_column.PackStart (text_render, true); - complete_column.AddAttribute (text_render, "text", 0); - - listView.AppendColumn (complete_column); - - Gtk.ScrolledWindow scroller = new Gtk.ScrolledWindow (); - scroller.Add (listView); - - Gtk.Frame frame = new Gtk.Frame (); - frame.Add (scroller); - this.Add(frame); - - imgList = completionDataProvider.ImageList; - 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)); - - /* - Panel buttonPanel = new Panel(); - buttonPanel.Dock = DockStyle.Bottom; - buttonPanel.Size = new Size(100, 30); - - this.Controls.Add(buttonPanel); - */ - } - - /// <remarks> - /// Shows the filled completion window, if it has no items it isn't shown. - /// </remarks> - public void ShowCompletionWindow(char firstChar) - { - FillList(true, firstChar); - - TreeIter iter; - if (store.GetIterFirst(out iter) == false) { - control.GrabFocus(); - return; - } - - Point caretPos = control.ActiveTextAreaControl.Caret.Position; - Point visualPos = new Point(control.ActiveTextAreaControl.TextArea.TextView.GetDrawingXPos(caretPos.Y, caretPos.X) + control.ActiveTextAreaControl.TextArea.TextView.DrawingPosition.X, - (int)((1 + caretPos.Y) * control.ActiveTextAreaControl.TextArea.TextView.FontHeight) - control.ActiveTextAreaControl.TextArea.VirtualTop.Y - 1 + control.ActiveTextAreaControl.TextArea.TextView.DrawingPosition.Y); - - int tx, ty; - control.ActiveTextAreaControl.TextArea.GdkWindow.GetOrigin(out tx, out ty); - Move(tx + visualPos.X, ty + visualPos.Y); - listView.Selection.Changed += new EventHandler (RowActivated); - ShowAll (); - } - string fileName; - - static CompletionWindow () - { - type = RegisterGType (typeof (CompletionWindow)); - } - - /// <remarks> - /// Creates a new Completion window and puts it location under the caret - /// </remarks> - public CompletionWindow (TextEditorControl control, string fileName, ICompletionDataProvider completionDataProvider) : base (type) - { - this.fileName = fileName; - this.completionDataProvider = completionDataProvider; - this.control = control; - - InitializeControls(); - } - - /// <remarks> - /// Creates a new Completion window at a given location - /// </remarks> - CompletionWindow (TextEditorControl control, Point location, ICompletionDataProvider completionDataProvider) : base (type) - { - this.completionDataProvider = completionDataProvider; - this.control = control; - - InitializeControls(); - } - - void ActivateItem(object sender, RowActivatedArgs e) - { - 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); - } - } - - void LostFocusListView(object sender, FocusOutEventArgs e) - { - control.HasFocus = true; - declarationviewwindow.HideAll (); - Hide(); - } - - void FillList(bool firstTime, char ch) - { - ICompletionData[] completionData = completionDataProvider.GenerateCompletionData(fileName, control.ActiveTextAreaControl.TextArea, ch); - if (completionData == null || completionData.Length == 0) { - return; - } - - foreach (ICompletionData data in completionData) { - store.AppendValues (data.Text[0], imgList[data.ImageIndex], data); - } - // sort here - store.SetSortColumnId (0, SortType.Ascending); - } - - void RowActivated (object sender, EventArgs a) - { - Gtk.TreeIter iter; - Gtk.TreeModel model; - - if (listView.Selection.GetSelected (out model, out iter)){ - ICompletionData data = (ICompletionData) store.GetValue (iter, 2); - - //FIXME: This code is buggy, and generates a bad placement sometimes when you jump a lot. but it is better than 0,0 - - Gtk.TreePath path = store.GetPath (iter); - Gdk.Rectangle rect; - rect = listView.GetCellArea (path, (Gtk.TreeViewColumn)listView.Columns[0]); - - int x, y; - listView.TreeToWidgetCoords (rect.x, rect.y, out x, out y); - - int listpos_x, listpos_y; - GetPosition (out listpos_x, out listpos_y); - int vert = listpos_y + rect.y; - - if (vert > listpos_y + listView.GdkWindow.Size.Height) { - vert = listpos_y + listView.GdkWindow.Size.Height - rect.height; - } else if (vert < listpos_y) { - 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; - 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; - } else { - declarationviewwindow = new DeclarationViewWindow (); - declarationviewwindow.DescriptionMarkup = data.Description; - } - - declarationviewwindow.ShowAll (); - if (listView.Screen.Width <= horiz + declarationviewwindow.GdkWindow.FrameExtents.Width) { - horiz = listpos_x - declarationviewwindow.GdkWindow.FrameExtents.Width - 10; - } - declarationviewwindow.Move (horiz, vert); - } - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Gui/CompletionWindow/DeclarationViewWindow.cs b/main/Unused/ICSharpCode.TextEditor/src/Gui/CompletionWindow/DeclarationViewWindow.cs deleted file mode 100644 index 38531769a6..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Gui/CompletionWindow/DeclarationViewWindow.cs +++ /dev/null @@ -1,57 +0,0 @@ -// DeclarationViewWindow.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Reflection; -using System.Collections; - -using MonoDevelop.TextEditor.Document; -using MonoDevelop.TextEditor.Util; -using MonoDevelop.TextEditor; - -using Gtk; -using GtkSharp; - -namespace MonoDevelop.TextEditor.Gui.CompletionWindow -{ - public class DeclarationViewWindow : Gtk.Window - { - Label label; - - public string DescriptionMarkup { - get { - return label.Text; - } - - set { - label.Markup = value; - //QueueDraw (); - } - } - - public DeclarationViewWindow () : base (WindowType.Popup) - { - Gtk.Frame frame = new Gtk.Frame (); - frame.Add (label = new Label ("")); - Add (frame); - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Gui/CompletionWindow/ICompletionData.cs b/main/Unused/ICSharpCode.TextEditor/src/Gui/CompletionWindow/ICompletionData.cs deleted file mode 100644 index 08d6344daf..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Gui/CompletionWindow/ICompletionData.cs +++ /dev/null @@ -1,52 +0,0 @@ -// ICompletionData.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Reflection; -using System.Collections; -using MonoDevelop.TextEditor; - -namespace MonoDevelop.TextEditor.Gui.CompletionWindow -{ - public interface ICompletionData - { - int ImageIndex { - get; - } - - string[] Text { - get; - } - - string Description { - get; - } - - void InsertAction(TextEditorControl control); - } - - public interface ICompletionDataWithMarkup : ICompletionData - { - string DescriptionPango { - get; - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Gui/CompletionWindow/ICompletionDataProvider.cs b/main/Unused/ICSharpCode.TextEditor/src/Gui/CompletionWindow/ICompletionDataProvider.cs deleted file mode 100644 index 98e93efad6..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Gui/CompletionWindow/ICompletionDataProvider.cs +++ /dev/null @@ -1,40 +0,0 @@ -// ICompletionDataProvider.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Reflection; -using System.Collections; - -using MonoDevelop.TextEditor.Document; - -using Gdk; - -namespace MonoDevelop.TextEditor.Gui.CompletionWindow -{ - public interface ICompletionDataProvider - { - Pixbuf[] ImageList { - get; - } - - ICompletionData[] GenerateCompletionData(IProject project, string fileName, TextArea textArea, char charTyped); - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Gui/FoldMargin.cs b/main/Unused/ICSharpCode.TextEditor/src/Gui/FoldMargin.cs deleted file mode 100644 index c75c1d27ee..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Gui/FoldMargin.cs +++ /dev/null @@ -1,254 +0,0 @@ -// FoldMargin.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.Drawing; -using MonoDevelop.TextEditor.Document; - -using Gdk; - -namespace MonoDevelop.TextEditor -{ - /// <summary> - /// This class views the line numbers and folding markers. - /// </summary> - public class FoldMargin : AbstractMargin - { - public override Size Size { - get { - return new Size((int)(textArea.TextView.FontHeight), - -1); - } - } - - public override Cursor Cursor { - get { - return GutterMargin.RightLeftCursor; - } - } - - public override bool IsVisible { - get { - return textArea.TextEditorProperties.EnableFolding; - } - } - - public FoldMargin(TextArea textArea) : base(textArea) - { - } - - public override void Paint(Gdk.Drawable wnd, System.Drawing.Rectangle rect) - { - HighlightColor lineNumberPainterColor = textArea.Document.HighlightingStrategy.GetColorFor("LineNumbers"); - - Gdk.Color rect_fg = TextArea.Style.White; - Gdk.Color text_fg = new Gdk.Color (lineNumberPainterColor.Color); - Gdk.Color text_bg = new Gdk.Color (lineNumberPainterColor.BackgroundColor); - - using (Gdk.GC gc = new Gdk.GC(wnd)) { - for (int y = 0; y < (DrawingPosition.Height + textArea.TextView.VisibleLineDrawingRemainder) / textArea.TextView.FontHeight + 1; ++y) { - - gc.RgbFgColor = rect_fg; - System.Drawing.Rectangle markerRectangle = new System.Drawing.Rectangle(DrawingPosition.X, DrawingPosition.Top + y * textArea.TextView.FontHeight - textArea.TextView.VisibleLineDrawingRemainder, DrawingPosition.Width, textArea.TextView.FontHeight); - - if (rect.IntersectsWith(markerRectangle)) { - wnd.DrawRectangle (gc, true, new System.Drawing.Rectangle (markerRectangle.X + 1, markerRectangle.Y, markerRectangle.Width - 1, markerRectangle.Height)); - - int currentLine = textArea.TextView.FirstVisibleLine + y; - PaintFoldMarker(wnd, currentLine, markerRectangle); - } //Using - } - } - - } - - - void PaintFoldMarker(Gdk.Drawable g, int lineNumber, System.Drawing.Rectangle drawingRectangle) - { - HighlightColor foldLineColor = textArea.Document.HighlightingStrategy.GetColorFor("FoldLine"); - - bool isFoldStart = textArea.Document.FoldingManager.IsFoldStart(lineNumber); - bool isBetween = textArea.Document.FoldingManager.IsBetweenFolding(lineNumber); - bool isFoldEnd = textArea.Document.FoldingManager.IsFoldEnd(lineNumber); - - int foldMarkerSize = (int)Math.Round(textArea.TextView.FontHeight * 0.57f); - foldMarkerSize -= (foldMarkerSize) % 2; - int foldMarkerYPos = drawingRectangle.Y + (int)((drawingRectangle.Height - foldMarkerSize) / 2); - int xPos = drawingRectangle.X + (drawingRectangle.Width - foldMarkerSize) / 2 + foldMarkerSize / 2; - - - if (isFoldStart) { - ArrayList startFoldings = textArea.Document.FoldingManager.GetFoldingsWithStart(lineNumber); - bool isVisible = true; - bool moreLinedOpenFold = false; - foreach (FoldMarker foldMarker in startFoldings) { - if (foldMarker.IsFolded) { - isVisible = false; - } else { - moreLinedOpenFold = foldMarker.EndLine > foldMarker.StartLine; - } - } - - ArrayList endFoldings = textArea.Document.FoldingManager.GetFoldingsWithEnd(lineNumber); - bool isFoldEndFromUpperFold = false; - foreach (FoldMarker foldMarker in endFoldings) { - if (foldMarker.EndLine > foldMarker.StartLine && !foldMarker.IsFolded) { - isFoldEndFromUpperFold = true; - } - } - - DrawFoldMarker(g, new RectangleF(drawingRectangle.X + (drawingRectangle.Width - foldMarkerSize) / 2, - foldMarkerYPos, - foldMarkerSize, - foldMarkerSize), - isVisible); - if (isBetween || isFoldEndFromUpperFold) { - using (Gdk.GC gc = new Gdk.GC(g)) { - gc.RgbFgColor = new Gdk.Color (foldLineColor.Color); - - g.DrawLine(gc, - xPos, - drawingRectangle.Top, - xPos, - foldMarkerYPos); - } - } - - if (isBetween || moreLinedOpenFold) { - using (Gdk.GC gc = new Gdk.GC(g)) { - gc.RgbFgColor = new Gdk.Color (foldLineColor.Color); - g.DrawLine(gc, - xPos, - foldMarkerYPos + foldMarkerSize, - xPos, - drawingRectangle.Bottom); - } - } - } else { - if (isFoldEnd) { - int midy = drawingRectangle.Top + drawingRectangle.Height / 2; - using (Gdk.GC gc = new Gdk.GC(g)) { - gc.RgbFgColor = new Gdk.Color (foldLineColor.Color); - g.DrawLine(gc, - xPos, - drawingRectangle.Top, - xPos, - isBetween ? drawingRectangle.Bottom : midy); - g.DrawLine(gc, - xPos, - midy, - xPos + foldMarkerSize / 2, - midy); - } - } else if (isBetween) { - using (Gdk.GC gc = new Gdk.GC(g)) { - gc.RgbFgColor = new Gdk.Color (foldLineColor.Color); - g.DrawLine(gc, - xPos, - drawingRectangle.Top, - xPos, - drawingRectangle.Bottom); - } - } - } - } - -// protected override void OnClick(EventArgs e) - public void OnClick (System.Drawing.Point mousepos) - { - bool showFolding = textArea.Document.TextEditorProperties.EnableFolding; - //Point mousepos = PointToClient(Control.MousePosition); - int realline = textArea.Document.GetVisibleLine((int)((mousepos.Y/* + virtualTop*/) / textArea.TextView.FontHeight)); - - // focus the textarea if the user clicks on the line number view - textArea.GrabFocus(); - - if (!showFolding || mousepos.X < Size.Width - 15 || realline < 0 || realline + 1 >= textArea.Document.TotalNumberOfLines) { - return; - } - - ArrayList foldMarkers = textArea.Document.FoldingManager.GetFoldingsWithStart(realline); - foreach (FoldMarker fm in foldMarkers) { - fm.IsFolded = !fm.IsFolded; - } - //this.QueueDraw (); - textArea.QueueDraw (); - //TextEditorControl.IconBar.QueueDraw (); - } -// { -// base.OnClick(e); -// bool showFolding = textarea.Document.TextEditorProperties.EnableFolding; -// Point mousepos = PointToClient(Control.MousePosition); -// int realline = textarea.Document.GetVisibleLine((int)((mousepos.Y + virtualTop) / textarea.FontHeight)); -// -// // focus the textarea if the user clicks on the line number view -// textarea.Focus(); -// -// if (!showFolding || mousepos.X < Width - 15 || realline < 0 || realline + 1 >= textarea.Document.TotalNumberOfLines) { -// return; -// } -// -// ArrayList foldMarkers = textarea.Document.FoldingManager.GetFoldingsWithStart(realline); -// foreach (FoldMarker fm in foldMarkers) { -// fm.IsFolded = !fm.IsFolded; -// } -// Refresh(); -// textarea.Refresh(); -// TextEditorControl.IconBar.Refresh(); -// } - -#region Drawing functions - void DrawFoldMarker(Gdk.Drawable g, RectangleF rectangle, bool isOpened) - { - - HighlightColor foldMarkerColor = textArea.Document.HighlightingStrategy.GetColorFor("FoldMarker"); - HighlightColor foldLineColor = textArea.Document.HighlightingStrategy.GetColorFor("FoldLine"); - - System.Drawing.Rectangle intRect = new System.Drawing.Rectangle((int)rectangle.X, (int)rectangle.Y, (int)rectangle.Width, (int)rectangle.Height); - using (Gdk.GC gc = new Gdk.GC(g)) { - gc.RgbFgColor = new Gdk.Color (foldMarkerColor.BackgroundColor); - g.DrawRectangle(gc, true, intRect); - gc.RgbFgColor = new Gdk.Color (foldMarkerColor.Color); - g.DrawRectangle(gc, false, intRect); - - int space = (int)Math.Round(((double)rectangle.Height) / 8d) + 1; - int mid = intRect.Height / 2 + intRect.Height % 2; - - gc.RgbFgColor = new Gdk.Color (foldMarkerColor.Color); - g.DrawLine(gc, - (int)rectangle.X + space, - (int)rectangle.Y + mid, - (int)rectangle.X + (int)rectangle.Width - space, - (int)rectangle.Y + mid); - - if (!isOpened) { - g.DrawLine(gc, - (int)rectangle.X + mid, - (int)rectangle.Y + space, - (int)rectangle.X + mid, - (int)rectangle.Y + (int)rectangle.Height - space); - - } - } - } -#endregion - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Gui/GutterMargin.cs b/main/Unused/ICSharpCode.TextEditor/src/Gui/GutterMargin.cs deleted file mode 100644 index 6c4600a342..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Gui/GutterMargin.cs +++ /dev/null @@ -1,111 +0,0 @@ -// GutterMargin.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.IO; -using System.Reflection; -using System.Collections; -using System.Drawing; -using System.Diagnostics; -using MonoDevelop.TextEditor.Document; - -using Gdk; - -namespace MonoDevelop.TextEditor -{ - /// <summary> - /// This class views the line numbers and folding markers. - /// </summary> - public class GutterMargin : AbstractMargin - { - - public static Cursor RightLeftCursor; - - static GutterMargin() - { - Stream cursorStream = Assembly.GetCallingAssembly().GetManifestResourceStream("RightArrow.cur"); - //RightLeftCursor = new Cursor(cursorStream); - cursorStream.Close(); - } - - - public override Cursor Cursor { - get { - return RightLeftCursor; - } - } - - public override Size Size { - get { - return new Size((int)(textArea.TextView.GetWidth('w') * Math.Max(3, (int)Math.Log10(textArea.Document.TotalNumberOfLines) + 1)), - -1); - } - } - - public override bool IsVisible { - get { - return textArea.TextEditorProperties.ShowLineNumbers; - } - } - - - - public GutterMargin(TextArea textArea) : base(textArea) - { - } - - public override void Paint(Gdk.Drawable wnd, System.Drawing.Rectangle rect) - { - int one_width = (int) textArea.TextView.GetWidth ('w'); - - using (Gdk.GC gc = new Gdk.GC (wnd)) { - using (Pango.Layout ly = new Pango.Layout (TextArea.PangoContext)) { - ly.FontDescription = FontContainer.DefaultFont; - ly.Width = drawingPosition.Width; - ly.Alignment = Pango.Alignment.Right; - - HighlightColor lineNumberPainterColor = textArea.Document.HighlightingStrategy.GetColorFor("LineNumbers"); - - gc.RgbBgColor = new Gdk.Color (lineNumberPainterColor.BackgroundColor); - gc.RgbFgColor = TextArea.Style.White; - wnd.DrawRectangle (gc, true, drawingPosition); - - gc.RgbFgColor = new Gdk.Color (lineNumberPainterColor.Color); - gc.SetLineAttributes (1, LineStyle.OnOffDash, CapStyle.NotLast, JoinStyle.Miter); - wnd.DrawLine (gc, drawingPosition.X + drawingPosition.Width, drawingPosition.Y, drawingPosition.X + drawingPosition.Width, drawingPosition.Height); - - - //FIXME: This doesnt allow different fonts and what not - int fontHeight = TextArea.TextView.FontHeight; - - for (int y = 0; y < (DrawingPosition.Height + textArea.TextView.VisibleLineDrawingRemainder) / fontHeight + 1; ++y) { - int ypos = drawingPosition.Y + fontHeight * y - textArea.TextView.VisibleLineDrawingRemainder; - - - int curLine = y + textArea.TextView.FirstVisibleLine; - if (curLine < textArea.Document.TotalNumberOfLines) { - ly.SetText ((curLine + 1).ToString ()); - wnd.DrawLayout (gc, drawingPosition.X + drawingPosition.Width - one_width, ypos, ly); - } - } - }} - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Gui/IconBarMargin.cs b/main/Unused/ICSharpCode.TextEditor/src/Gui/IconBarMargin.cs deleted file mode 100644 index 6bd5079d38..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Gui/IconBarMargin.cs +++ /dev/null @@ -1,134 +0,0 @@ -// IconBarMargin.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.ComponentModel; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Drawing.Text; -using MonoDevelop.TextEditor.Document; - -namespace MonoDevelop.TextEditor -{ - /// <summary> - /// This class views the line numbers and folding markers. - /// </summary> - public class IconBarMargin : AbstractMargin - { - public override Size Size { - get { - return new Size((int)(textArea.TextView.FontHeight * 1.2f), - -1); - } - } - - public override bool IsVisible { - get { - return textArea.TextEditorProperties.IsIconBarVisible; - } - } - - - public IconBarMargin(TextArea textArea) : base(textArea) - { - } - - public override void Paint(Gdk.Drawable wnd, Rectangle rect) - { - HighlightColor lineNumberPainterColor = textArea.Document.HighlightingStrategy.GetColorFor("LineNumbers"); - - Gdk.Color rect_fg = TextArea.Style.White; - Gdk.Color text_fg = new Gdk.Color (lineNumberPainterColor.Color); - Gdk.Color text_bg = new Gdk.Color (lineNumberPainterColor.BackgroundColor); - - using (Gdk.GC gc = new Gdk.GC (wnd)) { - gc.RgbFgColor = rect_fg; - wnd.DrawRectangle (gc, true, new System.Drawing.Rectangle (drawingPosition.X, rect.Top, drawingPosition.Width - 1, rect.Height)); - - - //g.DrawLine(SystemPens.ControlDark, base.drawingPosition.Right - 1, rect.Top, base.drawingPosition.Right - 1, rect.Bottom); - - // paint icons - foreach (int mark in textArea.Document.BookmarkManager.Marks) { - int lineNumber = textArea.Document.GetLogicalLine(mark); - int yPos = (int)(lineNumber * textArea.TextView.FontHeight) - textArea.VirtualTop.Y; -// if (yPos >= rect.Y && yPos <= rect.Bottom) { - DrawBookmark(gc, wnd, yPos); -// } - } - } - - } - -#region Drawing functions - void DrawBookmark(Gdk.GC gc, Gdk.Drawable wnd, int y) - { - gc.RgbFgColor = new Gdk.Color (Color.DarkBlue); - int delta = textArea.TextView.FontHeight / 6; - Rectangle rect = new Rectangle( 2, y + delta, base.drawingPosition.Width - 6, textArea.TextView.FontHeight - 2 * delta); - - wnd.DrawRectangle (gc, true, rect); - - gc.RgbFgColor = new Gdk.Color (Color.Black); - - wnd.DrawRectangle (gc, false, rect); - //FillRoundRect(g, Brushes.Cyan, rect); - //DrawRoundRect(g, Pens.Black, rect); - } - - GraphicsPath CreateRoundRectGraphicsPath(Rectangle r) - { - /* - GraphicsPath gp = new GraphicsPath(); - int radius = r.Width / 2; - gp.AddLine(r.X + radius, r.Y, r.Right - radius, r.Y); - gp.AddArc(r.Right - radius, r.Y, radius, radius, 270, 90); - - gp.AddLine(r.Right, r.Y + radius, r.Right, r.Bottom - radius); - gp.AddArc(r.Right - radius, r.Bottom - radius, radius, radius, 0, 90); - - gp.AddLine(r.Right - radius, r.Bottom, r.X + radius, r.Bottom); - gp.AddArc(r.X, r.Bottom - radius, radius, radius, 90, 90); - - gp.AddLine(r.X, r.Bottom - radius, r.X, r.Y + radius); - gp.AddArc(r.X, r.Y, radius, radius, 180, 90); - - gp.CloseFigure(); - */ - return new GraphicsPath(); - } - - /*void DrawRoundRect(Gdk.GC gc, Gdk.Drawable wnd, Rectangle r) - { - GraphicsPath gp = CreateRoundRectGraphicsPath(r); - g.DrawPath(p, gp); - gp.Dispose(); - } - - void FillRoundRect(Gdk.GC gc, Gdk.Drawable wnd, Rectangle r) - { - GraphicsPath gp = CreateRoundRectGraphicsPath(r); - g.FillPath(b, gp); - gp.Dispose(); - }*/ -#endregion - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Gui/Ime.cs b/main/Unused/ICSharpCode.TextEditor/src/Gui/Ime.cs deleted file mode 100644 index c86b8f1d77..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Gui/Ime.cs +++ /dev/null @@ -1,150 +0,0 @@ -// Ime.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Shinsaku Nakagawa <shinsaku@users.sourceforge.jp> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Runtime.InteropServices; -using System.Drawing; - -namespace MonoDevelop.TextEditor -{ - /// <summary> - /// Used internally, not for own use. - /// </summary> - /* - internal class Ime - { - public Ime(IntPtr hWnd, Font font) - { - hIMEWnd = ImmGetDefaultIMEWnd(hWnd); - this.font = font; - SetIMEWindowFont(font); - } - - private Font font = null; - public Font Font - { - get { - return font; - } - set { - if (font.Equals(value) == false) { - SetIMEWindowFont(value); - font = value; - } - } - } - - [ DllImport("imm32.dll") ] - private static extern IntPtr ImmGetDefaultIMEWnd(IntPtr hWnd); - - [ DllImport("user32.dll") ] - private static extern int SendMessage(IntPtr hWnd, int msg, int wParam, COMPOSITIONFORM lParam); - [ DllImport("user32.dll") ] - private static extern int SendMessage(IntPtr hWnd, int msg, int wParam, LOGFONT lParam); - - [ StructLayout(LayoutKind.Sequential) ] - private class COMPOSITIONFORM - { - public int dwStyle = 0; - public POINT ptCurrentPos = null; - public RECT rcArea = null; - } - - [ StructLayout(LayoutKind.Sequential) ] - private class POINT - { - public int x = 0; - public int y = 0; - } - - [ StructLayout(LayoutKind.Sequential) ] - private class RECT - { - public int left = 0; - public int top = 0; - public int right = 0; - public int bottom = 0; - } - - private const int WM_IME_CONTROL = 0x0283; - - private const int IMC_SETCOMPOSITIONWINDOW = 0x000c; - private IntPtr hIMEWnd; - private const int CFS_POINT = 0x0002; - - [ StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto) ] - private class LOGFONT - { - public int lfHeight = 0; - public int lfWidth = 0; - public int lfEscapement = 0; - public int lfOrientation = 0; - public int lfWeight = 0; - public byte lfItalic = 0; - public byte lfUnderline = 0; - public byte lfStrikeOut = 0; - public byte lfCharSet = 0; - public byte lfOutPrecision = 0; - public byte lfClipPrecision = 0; - public byte lfQuality = 0; - public byte lfPitchAndFamily = 0; - [ MarshalAs(UnmanagedType.ByValTStr, SizeConst=32) ] public string lfFaceName = null; - } - private const int IMC_SETCOMPOSITIONFONT = 0x000a; - - const byte FF_MODERN = 48; - const byte FIXED_PITCH = 1; - - private void SetIMEWindowFont(Font f) - { - LOGFONT lf = new LOGFONT(); - f.ToLogFont(lf); - lf.lfPitchAndFamily = FIXED_PITCH | FF_MODERN; - - SendMessage( - hIMEWnd, - WM_IME_CONTROL, - IMC_SETCOMPOSITIONFONT, - lf - ); - } - - - public void SetIMEWindowLocation(int x, int y) - { - - POINT p = new POINT(); - p.x = x; - p.y = y; - - COMPOSITIONFORM lParam = new COMPOSITIONFORM(); - lParam.dwStyle = CFS_POINT; - lParam.ptCurrentPos = p; - lParam.rcArea = new RECT(); - - SendMessage( - hIMEWnd, - WM_IME_CONTROL, - IMC_SETCOMPOSITIONWINDOW, - lParam - ); - } - }*/ -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Gui/InsightWindow/IInsightDataProvider.cs b/main/Unused/ICSharpCode.TextEditor/src/Gui/InsightWindow/IInsightDataProvider.cs deleted file mode 100644 index 716d2c0a9b..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Gui/InsightWindow/IInsightDataProvider.cs +++ /dev/null @@ -1,43 +0,0 @@ -// IInsightDataProvider.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Reflection; -using System.Collections; - -using MonoDevelop.TextEditor.Document; - -namespace MonoDevelop.TextEditor.Gui.InsightWindow -{ - public interface IInsightDataProvider - { - void SetupDataProvider(string fileName, TextArea textArea); - - bool CaretOffsetChanged(); - bool CharTyped(); - - string GetInsightData(int number); - - int InsightDataCount { - get; - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Gui/InsightWindow/InsightWindow.cs b/main/Unused/ICSharpCode.TextEditor/src/Gui/InsightWindow/InsightWindow.cs deleted file mode 100644 index 943cb53c29..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Gui/InsightWindow/InsightWindow.cs +++ /dev/null @@ -1,288 +0,0 @@ -// InsightWindow.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using System; -using System.Drawing; -using System.Reflection; -using System.Collections; - -using MonoDevelop.TextEditor.Document; -using MonoDevelop.TextEditor.Util; -using MonoDevelop.TextEditor; -using Gtk; -using GtkSharp; - -namespace MonoDevelop.TextEditor.Gui.InsightWindow -{ - public class InsightWindow : Window - { - static GLib.GType type; - TextEditorControl control; - Stack insightDataProviderStack = new Stack(); - - EventHandler focusEventHandler; -#if GTK - // FIXME: GTKize? -#else - KeyPressEventHandler keyPressEventHandler; -#endif - - class InsightDataProviderStackElement - { - public int currentData; - public IInsightDataProvider dataProvider; - - public InsightDataProviderStackElement(IInsightDataProvider dataProvider) - { - this.currentData = 0; - this.dataProvider = dataProvider; - } - } - - public void AddInsightDataProvider(IInsightDataProvider provider) - { - provider.SetupDataProvider(fileName, control.ActiveTextAreaControl.TextArea); - if (provider.InsightDataCount > 0) { - insightDataProviderStack.Push(new InsightDataProviderStackElement(provider)); - } - } - - int CurrentData { - get { - return ((InsightDataProviderStackElement)insightDataProviderStack.Peek()).currentData; - } - set { - ((InsightDataProviderStackElement)insightDataProviderStack.Peek()).currentData = value; - } - } - - IInsightDataProvider DataProvider { - get { - if (insightDataProviderStack.Count == 0) { - return null; - } - return ((InsightDataProviderStackElement)insightDataProviderStack.Peek()).dataProvider; - } - } - - void CloseCurrentDataProvider() - { - insightDataProviderStack.Pop(); - if (insightDataProviderStack.Count == 0) { - Hide(); - } else { - this.QueueDraw (); - } - } - - public void ShowInsightWindow() - { - if (!Visible) { - if (insightDataProviderStack.Count > 0) { -// control.TextAreaPainter.IHaveTheFocusLock = true; - BeforeShow (); - //this.ShowAll (); -// dialogKeyProcessor = new TextEditorControl.DialogKeyProcessor(ProcessTextAreaKey); -// control.ProcessDialogKeyProcessor += dialogKeyProcessor; - control.GrabFocus (); - -// control.TextAreaPainter.IHaveTheFocus = true; -// control.TextAreaPainter.IHaveTheFocusLock = false; - } - } else { - - this.QueueDraw (); - - } - } - string fileName; - - static InsightWindow () - { - type = RegisterGType (typeof (InsightWindow)); - } - - public InsightWindow(TextEditorControl control, string fileName) : base (type) - { - this.control = control; - this.fileName = fileName; - System.Drawing.Point caretPos = control.ActiveTextAreaControl.TextArea.Caret.Position; - System.Drawing.Point visualPos = new System.Drawing.Point(control.ActiveTextAreaControl.TextArea.TextView.GetDrawingXPos(caretPos.Y, caretPos.X) + control.ActiveTextAreaControl.TextArea.TextView.DrawingPosition.X, - (int)((1 + caretPos.Y) * control.ActiveTextAreaControl.TextArea.TextView.FontHeight) - control.ActiveTextAreaControl.TextArea.VirtualTop.Y - 1 + control.ActiveTextAreaControl.TextArea.TextView.DrawingPosition.Y); - - focusEventHandler = new EventHandler(TextEditorLostFocus); - - control.ActiveTextAreaControl.Caret.PositionChanged += new EventHandler(CaretOffsetChanged); -// control.TextAreaPainter.IHaveTheFocusChanged += focusEventHandler; - -// control.TextAreaPainter.KeyPress += keyPressEventHandler; - -#if GTK - this.SkipPagerHint = true; - this.SkipTaskbarHint = true; - this.Decorated = false; - this.BorderWidth = 2; - this.TypeHint = Gdk.WindowTypeHint.Dialog; -#else - Location = control.ActiveTextAreaControl.PointToScreen(visualPos); - - StartPosition = FormStartPosition.Manual; - FormBorderStyle = FormBorderStyle.None; - TopMost = true; - ShowInTaskbar = false; - Size = new Size(0, 0); - - SetStyle(ControlStyles.UserPaint, true); - SetStyle(ControlStyles.DoubleBuffer, true); -#endif - } - - // Methods that are inserted into the TextArea : - bool ProcessTextAreaKey(Gdk.Key keyData) - { - switch (keyData) { - case Gdk.Key.Escape: - Hide(); - return true; - case Gdk.Key.Down: - if (DataProvider != null && DataProvider.InsightDataCount > 0) { - CurrentData = (CurrentData + 1) % DataProvider.InsightDataCount; - this.QueueDraw (); - } - return true; - case Gdk.Key.Up: - if (DataProvider != null && DataProvider.InsightDataCount > 0) { - CurrentData = (CurrentData + DataProvider.InsightDataCount - 1) % DataProvider.InsightDataCount; - this.QueueDraw (); - } - return true; - } - return false; - } - -#if GTK - // FIXME: GTKize -#else - void KeyPressEvent(object sender, KeyPressEventArgs e) - { - if (DataProvider != null && DataProvider.CharTyped()) { - CloseCurrentDataProvider(); - } - } -#endif - - void CaretOffsetChanged(object sender, EventArgs e) - { - // move the window under the caret (don't change the x position) - - //FIXME: This code nullrefs for some reason - /* - System.Drawing.Point caretPos = control.ActiveTextAreaControl.Caret.Position; - int y = (int)((1 + caretPos.Y) * control.ActiveTextAreaControl.TextArea.TextView.FontHeight) - control.ActiveTextAreaControl.TextArea.VirtualTop.Y - 1 + control.ActiveTextAreaControl.TextArea.TextView.DrawingPosition.Y; - -#if GTK - System.Drawing.Point p = control.RootWindow.Position; - - p.X = RootWindow.Position.X; - if (p.Y != RootWindow.Position.Y) { - RootWindow.Move (p); - } -#else - Point p = control.ActiveTextAreaControl.PointToScreen(new Point(0, y)); - p.X = Location.X; - if (p.Y != Location.Y) { - Location = p; - } -#endif - - while (DataProvider != null && DataProvider.CaretOffsetChanged()) { - CloseCurrentDataProvider(); - }*/ - } - -#if !GTK - protected override void OnClosed(EventArgs e) - { - base.OnClosed(e); - - // take out the inserted methods - control.ActiveTextAreaControl.Caret.PositionChanged -= new EventHandler(CaretOffsetChanged); -// control.ProcessDialogKeyProcessor -= dialogKeyProcessor; -// control.TextAreaPainter.IHaveTheFocusChanged -= focusEventHandler; -// control.TextAreaPainter.KeyPress -= keyPressEventHandler; - } -#endif - - protected void TextEditorLostFocus(object sender, EventArgs e) - { - if (!control.ActiveTextAreaControl.TextArea.IsFocus) { - Hide(); - } - } - -#if GTK - protected void BeforeShow () - { - string methodCountMessage = null, description; - if (DataProvider == null || DataProvider.InsightDataCount < 1) { - description = "Unknown Method"; - } else { - /*if (DataProvider.InsightDataCount > 1) { - StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService)); - stringParserService.Properties["CurrentMethodNumber"] = (CurrentData + 1).ToString(); - stringParserService.Properties["NumberOfTotalMethods"] = DataProvider.InsightDataCount.ToString(); - methodCountMessage = stringParserService.Parse("${res:MonoDevelop.DefaultEditor.Gui.Editor.InsightWindow.NumberOfText}"); - }*/ - - description = DataProvider.GetInsightData(CurrentData); - } - - Console.WriteLine ("Current Data: {0}", CurrentData); - Console.WriteLine ("Description: {0}", description); - //TipPainterTools.DrawHelpTipFromCombinedDescription(this, pe.Graphics, - // Font, methodCountMessage, description); - } -#else - protected override void OnPaint(PaintEventArgs pe) - { - string methodCountMessage = null, description; - if (DataProvider == null || DataProvider.InsightDataCount < 1) { - description = "Unknown Method"; - } else { -// if (DataProvider.InsightDataCount > 1) { -// StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService)); -// stringParserService.Properties["CurrentMethodNumber"] = (CurrentData + 1).ToString(); -// stringParserService.Properties["NumberOfTotalMethods"] = DataProvider.InsightDataCount.ToString(); -// methodCountMessage = stringParserService.Parse("${res:MonoDevelop.DefaultEditor.Gui.Editor.InsightWindow.NumberOfText}"); -// } - - description = DataProvider.GetInsightData(CurrentData); - } - - TipPainterTools.DrawHelpTipFromCombinedDescription(this, pe.Graphics, - Font, methodCountMessage, description); - } - - protected override void OnPaintBackground(PaintEventArgs pe) - { - pe.Graphics.FillRectangle(SystemBrushes.Info, pe.ClipRectangle); - } -#endif - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Gui/Ruler.cs b/main/Unused/ICSharpCode.TextEditor/src/Gui/Ruler.cs deleted file mode 100644 index bea1759bf3..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Gui/Ruler.cs +++ /dev/null @@ -1,64 +0,0 @@ -/* -// Ruler.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using MonoDevelop.TextEditor.Document; - -namespace MonoDevelop.TextEditor -{ - /// <summary> - /// Used internally, not for own use. - /// </summary> - [ToolboxItem(false)] - public class Ruler : UserControl - { - TextAreaPainter textarea; - - /// <summary> - /// Creates a new instance of <see cref="Ruler"/> - /// </summary> - public Ruler(TextAreaPainter textarea) - { - this.textarea = textarea; - } - - protected override void OnPaint(PaintEventArgs pe) - { - float start = textarea.Document.TextEditorProperties.ShowLineNumbers ? 40 : 10; - for (float i = start; i < Width; i += textarea.FontWidth) { - int lineheight = ((int)((i - start + 1) / textarea.FontWidth)) % 5 == 0 ? 4 : 6; - - lineheight = ((int)((i - start + 1) / textarea.FontWidth)) % 10 == 0 ? 2 : lineheight; - - pe.Graphics.DrawLine(Pens.Black, (int)i, Height - lineheight, (int)i, lineheight); - } - } - - protected override void OnPaintBackground(PaintEventArgs pe) - { - HighlightColor hColor = textarea.Document.HighlightingStrategy.GetColorFor("LineNumber"); - Color color = Enabled ? hColor.BackgroundColor : SystemColors.InactiveBorder; - pe.Graphics.FillRectangle(new SolidBrush(color), pe.ClipRectangle); - } - } -} -*/ diff --git a/main/Unused/ICSharpCode.TextEditor/src/Gui/TextArea.cs b/main/Unused/ICSharpCode.TextEditor/src/Gui/TextArea.cs deleted file mode 100644 index c4ece6bfe5..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Gui/TextArea.cs +++ /dev/null @@ -1,845 +0,0 @@ -// TextArea.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.IO; -using System.Drawing; -using System.Drawing.Printing; -using System.Diagnostics; -using System.Runtime.InteropServices; -using System.Text; -using MonoDevelop.TextEditor.Actions; -using MonoDevelop.TextEditor.Document; -using MonoDevelop.EditorBindings.Properties; - -namespace MonoDevelop.TextEditor -{ - public delegate bool KeyEventHandler(char ch); - - /// <summary> - /// This class paints the textarea. - /// </summary> - //[ToolboxItem(false)] - public class TextArea : Gtk.DrawingArea - { - public static bool HiddenMouseCursor = false; - - System.Drawing.Point virtualTop = new System.Drawing.Point(0, 0); - TextAreaControl motherTextAreaControl; - TextEditorControl motherTextEditorControl; - - ArrayList bracketshemes = new ArrayList(); - TextAreaClipboardHandler textAreaClipboardHandler; - bool autoClearSelection = false; - - ArrayList leftMargins = new ArrayList(); - ArrayList topMargins = new ArrayList(); - - TextView textView; - GutterMargin gutterMargin; - FoldMargin foldMargin; - IconBarMargin iconBarMargin; - - - SelectionManager selectionManager; - Caret caret; - - public TextEditorControl MotherTextEditorControl { - get { - return motherTextEditorControl; - } - } - - public SelectionManager SelectionManager { - get { - return selectionManager; - } - } - - public Caret Caret { - get { - return caret; - } - } - - public TextView TextView { - get { - return textView; - } - } - - public GutterMargin GutterMargin { - get { - return gutterMargin; - } - } - - public FoldMargin FoldMargin { - get { - return foldMargin; - } - } - - public IconBarMargin IconBarMargin { - get { - return iconBarMargin; - } - } - - public Encoding Encoding { - get { - return motherTextEditorControl.Encoding; - } - } - - public System.Drawing.Point VirtualTop { - get { - return virtualTop; - } - set { - if (virtualTop != value) { - virtualTop = value; - Invalidate(); - } - } - } - - public bool AutoClearSelection { - get { - return autoClearSelection; - } - set { - autoClearSelection = value; - } - } - - //[Browsable(false)] - public IDocument Document { - get { - return motherTextEditorControl.Document; - } - } - - public TextAreaClipboardHandler ClipboardHandler { - get { - return textAreaClipboardHandler; - } - } - - public ITextEditorProperties TextEditorProperties { - get { - return motherTextEditorControl.TextEditorProperties; - } - } - - public TextArea(TextEditorControl motherTextEditorControl, TextAreaControl motherTextAreaControl) : base () - { - this.motherTextAreaControl = motherTextAreaControl; - this.motherTextEditorControl = motherTextEditorControl; - - caret = new Caret(this); - selectionManager = new SelectionManager(Document); - - this.textAreaClipboardHandler = new TextAreaClipboardHandler(this); - -#if GTK - // FIXME: GTKize? - this.DoubleBuffered = false; -#else - ResizeRedraw = true; - - SetStyle(ControlStyles.DoubleBuffer, false); - SetStyle(ControlStyles.AllPaintingInWmPaint, true); - SetStyle(ControlStyles.UserPaint, true); - SetStyle(ControlStyles.Opaque, false); -#endif - - textView = new TextView(this); - - gutterMargin = new GutterMargin(this); - foldMargin = new FoldMargin(this); - iconBarMargin = new IconBarMargin(this); - leftMargins.AddRange(new AbstractMargin[] { iconBarMargin, gutterMargin, foldMargin }); - OptionsChanged(); - - new TextAreaMouseHandler(this).Attach(); - new TextAreaDragDropHandler().Attach(this); - - bracketshemes.Add(new BracketHighlightingSheme('{', '}')); - bracketshemes.Add(new BracketHighlightingSheme('(', ')')); - bracketshemes.Add(new BracketHighlightingSheme('[', ']')); - - CanFocus = true; - - caret.PositionChanged += new EventHandler(SearchMatchingBracket); - Document.TextContentChanged += new EventHandler(TextContentChanged); - -#if GTK - KeyPressEvent += new GtkSharp.KeyPressEventHandler (OnKeyPress); - - AddEvents ((int) (Gdk.EventMask.ExposureMask | - Gdk.EventMask.LeaveNotifyMask | - Gdk.EventMask.ButtonPressMask | - Gdk.EventMask.ButtonReleaseMask | - Gdk.EventMask.PointerMotionMask | - Gdk.EventMask.KeyPressMask | - Gdk.EventMask.ScrollMask | - Gdk.EventMask.KeyReleaseMask)); - - ExposeEvent += new GtkSharp.ExposeEventHandler (ExposeHandler); -#endif - } - - public TextArea(): base() - { - } - - public void UpdateMatchingBracket() - { - SearchMatchingBracket(null, null); - } - - void TextContentChanged(object sender, EventArgs e) - { -#if GTK - // FIXME: GTKize -#else - Caret.Position = new System.Drawing.Point(0, 0); -#endif - SelectionManager.SelectionCollection.Clear(); - } - void SearchMatchingBracket(object sender, EventArgs e) - { - if (!TextEditorProperties.ShowMatchingBracket) { - textView.Highlight = null; - return; - } - bool changed = false; - if (caret.Offset == 0) { - if (textView.Highlight != null) { - int line = textView.Highlight.OpenBrace.Y; - int line2 = textView.Highlight.CloseBrace.Y; - textView.Highlight = null; - UpdateLine(line); - UpdateLine(line2); - } - return; - } - foreach (BracketHighlightingSheme bracketsheme in bracketshemes) { -// if (bracketsheme.IsInside(textareapainter.Document, textareapainter.Document.Caret.Offset)) { - Highlight highlight = bracketsheme.GetHighlight(Document, Caret.Offset - 1); - if (textView.Highlight != null && textView.Highlight.OpenBrace.Y >=0 && textView.Highlight.OpenBrace.Y < Document.TotalNumberOfLines) { - UpdateLine(textView.Highlight.OpenBrace.Y); - } - if (textView.Highlight != null && textView.Highlight.CloseBrace.Y >=0 && textView.Highlight.CloseBrace.Y < Document.TotalNumberOfLines) { - UpdateLine(textView.Highlight.CloseBrace.Y); - } - textView.Highlight = highlight; - if (highlight != null) { - changed = true; - break; - } -// } - } - if (changed || textView.Highlight != null) { - int line = textView.Highlight.OpenBrace.Y; - int line2 = textView.Highlight.CloseBrace.Y; - if (!changed) { - textView.Highlight = null; - } - UpdateLine(line); - UpdateLine(line2); - } - } - - public void SetDesiredColumn() - { - Caret.DesiredColumn = Caret.Column; - } - - public void SetCaretToDesiredColumn(int caretLine) - { - Caret.Position = new System.Drawing.Point(Caret.DesiredColumn, caretLine); - } - - public void OptionsChanged() - { -#if GTK - textView.OptionsChanged(); - Invalidate(); -#else - UpdateMatchingBracket(); - textView.OptionsChanged(); - caret.RecreateCaret(); - Refresh(); -#endif - } - -#if GTK - void ExposeHandler (object obj, GtkSharp.ExposeEventArgs args) - { - Gdk.Rectangle grect = args.Event.area; - System.Drawing.Rectangle drect = new System.Drawing.Rectangle(grect.x, grect.y, grect.width, grect.height); - - if (grect.width == 0 || grect.height == 0) { - return; - } - /* - if (updateMargin != null) { - updateMargin.Paint(e.Graphics, updateMargin.DrawingPosition); - return; - } - */ - if (this.motherTextEditorControl.IsInUpdate) { - return; - } - int currentXPos = 0; - int currentYPos = 0; - bool adjustScrollBars = false; - - System.Drawing.Rectangle clipRectangle = drect; - - GdkWindow.BeginPaintRect(grect); - - /* - if (this.TextEditorProperties.UseAntiAliasedFont) { - GdkWindow.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; - } else { - GdkWindow.TextRenderingHint = TextRenderingHint.SystemDefault; - }*/ - - foreach (AbstractMargin margin in leftMargins) { - if (margin.IsVisible) { - System.Drawing.Rectangle marginRectangle = - new System.Drawing.Rectangle(currentXPos , - currentYPos, - margin.Size.Width, - GdkWindow.Size.Height - currentYPos); - if (marginRectangle != margin.DrawingPosition) { - adjustScrollBars = true; - margin.DrawingPosition = marginRectangle; - } - currentXPos += margin.DrawingPosition.Width; - if (clipRectangle.IntersectsWith(marginRectangle)) { - marginRectangle.Intersect(clipRectangle); - margin.Paint(GdkWindow, marginRectangle); - } - } - } - - System.Drawing.Rectangle textViewArea = new System.Drawing.Rectangle(currentXPos, currentYPos, GdkWindow.Size.Width - 2, GdkWindow.Size.Height - 2); - if (textViewArea != textView.DrawingPosition) { - adjustScrollBars = true; - textView.DrawingPosition = textViewArea; - } - if (clipRectangle.IntersectsWith(textViewArea)) { - textViewArea.Intersect(clipRectangle); - textView.Paint(GdkWindow, textViewArea); - } - - if (adjustScrollBars) { - this.motherTextAreaControl.AdjustScrollBars(null, null); - } - Caret.UpdateCaretPosition(); - - this.GdkWindow.EndPaint (); - } -#else /* !GTK */ - protected void OnMouseLeave(System.EventArgs e) - { - this.Cursor = Cursors.Default; - } - - protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e) - { - base.OnMouseMove(e); - foreach (AbstractMargin margin in leftMargins) { - if (margin.DrawingPosition.Contains(e.X, e.Y)) { - this.Cursor = margin.Cursor; - return; - } - } - if (textView.DrawingPosition.Contains(e.X, e.Y)) { - this.Cursor = textView.Cursor; - return; - } - this.Cursor = Cursors.Default; - } - - AbstractMargin updateMargin = null; - - public void Refresh(AbstractMargin margin) - { - updateMargin = margin; - Invalidate(updateMargin.DrawingPosition); - Update(); - updateMargin = null; - } - - protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs pevent) - { - } - - protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) - { - if (updateMargin != null) { - updateMargin.Paint(e.Graphics, updateMargin.DrawingPosition); - return; - } - if (this.motherTextEditorControl.IsInUpdate) { - return; - } - int currentXPos = 0; - int currentYPos = 0; - bool adjustScrollBars = false; - Graphics g = e.Graphics; - Rectangle clipRectangle = e.ClipRectangle; - - if (this.TextEditorProperties.UseAntiAliasedFont) { - g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; - } else { - g.TextRenderingHint = TextRenderingHint.SystemDefault; - } - - foreach (AbstractMargin margin in leftMargins) { - if (margin.IsVisible) { - Rectangle marginRectangle = new Rectangle(currentXPos , currentYPos, margin.Size.Width, Height - currentYPos); - if (marginRectangle != margin.DrawingPosition) { - adjustScrollBars = true; - margin.DrawingPosition = marginRectangle; - } - currentXPos += margin.DrawingPosition.Width; - if (clipRectangle.IntersectsWith(marginRectangle)) { - marginRectangle.Intersect(clipRectangle); - margin.Paint(g, marginRectangle); - } - } - } - - Rectangle textViewArea = new Rectangle(currentXPos, currentYPos, Width - currentXPos, Height - currentYPos); - if (textViewArea != textView.DrawingPosition) { - adjustScrollBars = true; - textView.DrawingPosition = textViewArea; - } - if (clipRectangle.IntersectsWith(textViewArea)) { - textViewArea.Intersect(clipRectangle); - textView.Paint(g, textViewArea); - } - - if (adjustScrollBars) { - this.motherTextAreaControl.AdjustScrollBars(null, null); - } - Caret.UpdateCaretPosition(); - } -#endif /* GTK */ - - /// <summary> - /// This method is called on each Keypress - /// </summary> - /// <returns> - /// True, if the key is handled by this method and should NOT be - /// inserted in the textarea. - /// </returns> - protected virtual bool HandleKeyPress(char ch) - { - if (KeyEventHandler != null) { - return KeyEventHandler(ch); - } - return false; - } - - public void SimulateKeyPress(Gdk.Key key) - { - //FIXME: This code below is prolly a real bad idea - //char ch = key.ToString ().ToCharArray ()[0]; - char ch = (char)Gdk.Keyval.ToUnicode((uint)key); - - if (Document.ReadOnly) { - return; - } - - if (ch < ' ') { - return; - } - - if (!HiddenMouseCursor && TextEditorProperties.HideMouseCursor) { - HiddenMouseCursor = true; -#if GTK - // FIXME: GTKize -#else - Cursor.Hide(); -#endif - } - - motherTextEditorControl.BeginUpdate(); - switch (ch) { - default: // INSERT char - if (!HandleKeyPress(ch)) { - switch (Caret.CaretMode) { - case CaretMode.InsertMode: - InsertChar(ch); - break; - case CaretMode.OverwriteMode: - ReplaceChar(ch); - break; - default: - Debug.Assert(false, "Unknown caret mode " + Caret.CaretMode); - break; - } - } - break; - } - - int currentLineNr = Caret.Line; - int delta = Document.FormattingStrategy.FormatLine(Document, currentLineNr, Document.PositionToOffset(Caret.Position), ch); - - motherTextEditorControl.EndUpdate(); - if (delta != 0) { -#if GTK - // FIXME: GTKize -#else - this.motherTextEditorControl.UpdateLines(currentLineNr, currentLineNr); -#endif - } - } - - protected void OnKeyPress(object o, GtkSharp.KeyPressEventArgs e) - { -#if GTK - e.RetVal = true; - /*if (KeyEventHandler != null) { - if (KeyEventHandler((char)e.Event.Key)) { - return; - } - }*/ - - if (ExecuteDialogKey(e.Event)) { - return; - } -#else - base.OnKeyPress(e); -#endif - SimulateKeyPress(e.Event.Key); - } - - /// <summary> - /// This method executes a dialog key - /// </summary> - public bool ExecuteDialogKey(Gdk.EventKey keyData) - { -// // try, if a dialog key processor was set to use this -// if (ProcessDialogKeyProcessor != null && ProcessDialogKeyProcessor(keyData)) { -// return true; -// } - - // if not (or the process was 'silent', use the standard edit actions - - IEditAction action = motherTextEditorControl.GetEditAction(keyData); - AutoClearSelection = true; - if (action != null) { - motherTextEditorControl.BeginUpdate(); - try { - lock (Document) { - action.Execute(this); - if (SelectionManager.HasSomethingSelected && AutoClearSelection /*&& caretchanged*/) { - if (Document.TextEditorProperties.DocumentSelectionMode == DocumentSelectionMode.Normal) { - SelectionManager.ClearSelection(); - } - } - } - } catch (Exception e) { - Console.WriteLine("Got Exception while executing action " + action + " : " + e.ToString()); - } finally { - motherTextEditorControl.EndUpdate(); - Caret.UpdateCaretPosition(); - } - return true; - } - return false; - } - -#if GTK - // FIXME: GTKize -#else - protected override bool ProcessDialogKey(Keys keyData) - { - return ExecuteDialogKey(keyData) || base.ProcessDialogKey(keyData); - } -#endif - - public void ScrollToCaret() - { - motherTextAreaControl.ScrollToCaret(); - } - - public void ScrollTo(int line) - { - motherTextAreaControl.ScrollTo(line); - } - - public void BeginUpdate() - { - motherTextEditorControl.BeginUpdate(); - } - - public void EndUpdate() - { - motherTextEditorControl.EndUpdate(); - } - - string GenerateWhitespaceString(int length) - { - return new String(' ', length); - } - /// <remarks> - /// Inserts a single character at the caret position - /// </remarks> - public void InsertChar(char ch) - { - bool updating = motherTextEditorControl.IsUpdating; - if (!updating) { - BeginUpdate(); - } - - // filter out forgein whitespace chars and replace them with standard space (ASCII 32) - if (Char.IsWhiteSpace(ch) && ch != '\t' && ch != '\n') { - ch = ' '; - } - bool removedText = false; - if (Document.TextEditorProperties.DocumentSelectionMode == DocumentSelectionMode.Normal && - SelectionManager.SelectionCollection.Count > 0) { - Caret.Position = SelectionManager.SelectionCollection[0].StartPosition; - SelectionManager.RemoveSelectedText(); - removedText = true; - } - LineSegment caretLine = Document.GetLineSegment(Caret.Line); - int offset = Caret.Offset; - if (caretLine.Length < Caret.Column && ch != '\n') { - Document.Insert(offset, GenerateWhitespaceString(Caret.Column - caretLine.Length) + ch); - } else { - Document.Insert(offset, ch.ToString()); - } - ++Caret.Column; - - if (removedText) { - Document.UndoStack.UndoLast(2); - } - - if (!updating) { - EndUpdate(); - UpdateLineToEnd(Caret.Line, Caret.Column); - } - - // I prefer to set NOT the standard column, if you type something -// ++Caret.DesiredColumn; - } - - /// <remarks> - /// Inserts a whole string at the caret position - /// </remarks> - public void InsertString(string str) - { - bool updating = motherTextEditorControl.IsUpdating; - if (!updating) { - BeginUpdate(); - } - try { - bool removedText = false; - if (Document.TextEditorProperties.DocumentSelectionMode == DocumentSelectionMode.Normal && - SelectionManager.SelectionCollection.Count > 0) { - Caret.Position = SelectionManager.SelectionCollection[0].StartPosition; - SelectionManager.RemoveSelectedText(); - removedText = true; - } - - int oldOffset = Document.PositionToOffset(Caret.Position); - int oldLine = Caret.Line; - LineSegment caretLine = Document.GetLineSegment(Caret.Line); - if (caretLine.Length < Caret.Column) { - int whiteSpaceLength = Caret.Column - caretLine.Length; - Document.Insert(oldOffset, GenerateWhitespaceString(whiteSpaceLength) + str); - Caret.Position = Document.OffsetToPosition(oldOffset + str.Length + whiteSpaceLength); - } else { - Document.Insert(oldOffset, str); - Caret.Position = Document.OffsetToPosition(oldOffset + str.Length); - } - if (removedText) { - Document.UndoStack.UndoLast(2); - } - if (oldLine != Caret.Line) { - UpdateToEnd(oldLine); - } else { - UpdateLineToEnd(Caret.Line, Caret.Column); - } - } finally { - if (!updating) { - EndUpdate(); - } - } - } - - /// <remarks> - /// Replaces a char at the caret position - /// </remarks> - public void ReplaceChar(char ch) - { - bool updating = motherTextEditorControl.IsUpdating; - if (!updating) { - BeginUpdate(); - } - if (Document.TextEditorProperties.DocumentSelectionMode == DocumentSelectionMode.Normal && SelectionManager.SelectionCollection.Count > 0) { - Caret.Position = SelectionManager.SelectionCollection[0].StartPosition; - SelectionManager.RemoveSelectedText(); - } - - int lineNr = Caret.Line; - LineSegment line = Document.GetLineSegment(lineNr); - int offset = Document.PositionToOffset(Caret.Position); - if (offset < line.Offset + line.Length) { - Document.Replace(offset, 1, ch.ToString()); - } else { - Document.Insert(offset, ch.ToString()); - } - if (!updating) { - EndUpdate(); - UpdateLineToEnd(lineNr, Caret.Column); - } - ++Caret.Column; -// ++Caret.DesiredColumn; - } - -#if GTK - // FIXME: GTKize? -#else - protected override void Dispose(bool disposing) - { - base.Dispose(disposing); - if (disposing) { - Caret.Dispose(); - } - } -#endif - - internal void UpdateLine(int line) - { - UpdateLines(0, line, line); - } - - internal void UpdateLines(int lineBegin, int lineEnd) - { - UpdateLines(0, lineBegin, lineEnd); - } - - internal void UpdateToEnd(int lineBegin) - { - if (lineBegin > this.textView.FirstVisibleLine + textView.VisibleLineCount) { - return; - } - - lineBegin = Math.Max(Document.GetLogicalLine(lineBegin), textView.FirstVisibleLine); - int y = Math.Max( 0, (int)(lineBegin * textView.FontHeight)); - y = Math.Max(0, y - 1 - this.virtualTop.Y); - System.Drawing.Rectangle r = new System.Drawing.Rectangle(0, - y, - WidthRequest, - HeightRequest - y); - Invalidate(r); - } - - internal void UpdateLineToEnd(int lineNr, int xStart) - { - UpdateLines(xStart, lineNr, lineNr); - } - - internal void UpdateLine(int line, int begin, int end) - { - UpdateLines(line, line); - } - - internal void UpdateLines(int xPos, int lineBegin, int lineEnd) - { - if (lineEnd < this.textView.FirstVisibleLine || lineBegin > this.textView.FirstVisibleLine + textView.VisibleLineCount) { - return; - } - - InvalidateLines((int)(xPos * this.TextView.GetWidth(' ')), lineBegin, lineEnd); - } - - void InvalidateLines(int xPos, int lineBegin, int lineEnd) - { - int firstLine = textView.FirstVisibleLine; - - lineBegin = Math.Max(Document.GetLogicalLine(lineBegin), textView.FirstVisibleLine); - lineEnd = Math.Min(Document.GetLogicalLine(lineEnd), textView.FirstVisibleLine + textView.VisibleLineCount); - int y = Math.Max( 0, (int)(lineBegin * textView.FontHeight)); - int height = Math.Min(textView.DrawingPosition.Height, (int)((1 + lineEnd - lineBegin) * (textView.FontHeight + 1))); - - System.Drawing.Rectangle r = new System.Drawing.Rectangle(0, - y - 1 - this.virtualTop.Y, - WidthRequest, - height + 3); - - Invalidate(r); - } - -#if GTK - public event KeyEventHandler KeyEventHandler; - - public void Invalidate() - { - if (GdkWindow == null) { - return; - } - - Invalidate (new System.Drawing.Rectangle(0, 0, GdkWindow.Size.Width, GdkWindow.Size.Height)); - } - - internal void Invalidate (System.Drawing.Rectangle rect) - { - // Uff, this are "empirical", non-optimal rules from what I saw - // FIXME Improve this - - try { - int x = Math.Max(rect.X, 0); - int y = Math.Max(rect.Y, 0); - int width = Math.Max(rect.Width, 0); - if (rect.Width < 0) { - width = GdkWindow.Size.Width; - } - int height = Math.Max(rect.Height, 0); - if (rect.Height < 0) { - height = GdkWindow.Size.Height; - } - - //Console.WriteLine ("{0} {1} {2} {3}", x, y, width, height); - GdkWindow.InvalidateRect(new Gdk.Rectangle(x, y, width, height), false); - } catch { - //This try/catch seems to fix a bug when creating files - } - } - - public void Refresh() { - Invalidate(); // FIXME PEDRO - } - -#endif - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Gui/TextAreaClipboardHandler.cs b/main/Unused/ICSharpCode.TextEditor/src/Gui/TextAreaClipboardHandler.cs deleted file mode 100644 index f99333d9c5..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Gui/TextAreaClipboardHandler.cs +++ /dev/null @@ -1,134 +0,0 @@ -// TextAreaClipboardHandler.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.IO; -using System.ComponentModel; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Drawing.Printing; -using System.Diagnostics; -using System.Threading; -using System.Runtime.Remoting; -using System.Runtime.InteropServices; -using System.Xml; -using System.Text; - -using MonoDevelop.TextEditor.Document; -using MonoDevelop.TextEditor.Undo; -using MonoDevelop.TextEditor.Util; - -namespace MonoDevelop.TextEditor -{ - public class TextAreaClipboardHandler - { - TextArea textArea; - Gtk.Clipboard clipboard; - - public bool EnableCut { - get { - return textArea.SelectionManager.HasSomethingSelected; - } - } - - public bool EnableCopy { - get { - return textArea.SelectionManager.HasSomethingSelected; - } - } - - - public bool EnablePaste { - get { - return clipboard.WaitIsTextAvailable (); - } - } - - public bool EnableDelete { - get { - return textArea.SelectionManager.HasSomethingSelected; - } - } - - public bool EnableSelectAll { - get { - return true; - } - } - - public TextAreaClipboardHandler(TextArea textArea) - { - this.textArea = textArea; - clipboard = Gtk.Clipboard.Get (Gdk.Atom.Intern("CLIPBOARD", false)); - textArea.SelectionManager.SelectionChanged += new EventHandler(DocumentSelectionChanged); - } - - void DocumentSelectionChanged(object sender, EventArgs e) - { -// ((DefaultWorkbench)WorkbenchSingleton.Workbench).UpdateToolbars(); - } - - bool CopyTextToClipboard() - { - string str = textArea.SelectionManager.SelectedText; - clipboard.SetText(str); - - return true; - } - - public void Cut(object sender, EventArgs e) - { - if (CopyTextToClipboard()) { - // remove text - textArea.BeginUpdate(); - textArea.Caret.Position = textArea.SelectionManager.SelectionCollection[0].StartPosition; - textArea.SelectionManager.RemoveSelectedText(); - textArea.EndUpdate(); - } - } - - public void Copy(object sender, EventArgs e) - { - CopyTextToClipboard(); - } - - public void Paste(object sender, EventArgs e) - { - try { - if (clipboard.WaitIsTextAvailable()) { - textArea.InsertString(clipboard.WaitForText()); - } - } catch (Exception ex) { - Console.WriteLine("Error pasting text: " + ex.Message); - } - } - - public void Delete(object sender, EventArgs e) - { - new MonoDevelop.TextEditor.Actions.Delete().Execute(textArea); - } - - public void SelectAll(object sender, EventArgs e) - { - new MonoDevelop.TextEditor.Actions.SelectWholeDocument().Execute(textArea); - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Gui/TextAreaControl.cs b/main/Unused/ICSharpCode.TextEditor/src/Gui/TextAreaControl.cs deleted file mode 100644 index 923d935afb..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Gui/TextAreaControl.cs +++ /dev/null @@ -1,275 +0,0 @@ -// TextAreaControl.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.IO; -using System.Drawing; -using System.Diagnostics; -using System.Text; -using MonoDevelop.TextEditor.Actions; -using MonoDevelop.TextEditor.Document; - -namespace MonoDevelop.TextEditor -{ - /// <summary> - /// This class paints the textarea. - /// </summary> - //[ToolboxItem(false)] - public class TextAreaControl : Gtk.Table - { - TextEditorControl motherTextEditorControl; - - Gtk.VScrollbar vScrollBar = new Gtk.VScrollbar(null); - Gtk.HScrollbar hScrollBar = new Gtk.HScrollbar(null); - TextArea textArea; - Size size; - Gtk.Menu contextMenu = null; - - public TextArea TextArea { - get { - return textArea; - } - } - - public Gtk.Menu ContextMenu { - get { - return contextMenu; - } - - set { - contextMenu = value; - } - } - - public SelectionManager SelectionManager { - get { - return textArea.SelectionManager; - } - } - public Caret Caret { - get { - return textArea.Caret; - } - } - - - //[Browsable(false)] - public IDocument Document { - get { - return motherTextEditorControl.Document; - } - } - - public ITextEditorProperties TextEditorProperties { - get { - return motherTextEditorControl.TextEditorProperties; - } - } - - public TextAreaControl(TextEditorControl motherTextEditorControl): base(2, 2, false) - { - this.motherTextEditorControl = motherTextEditorControl; - - this.textArea = new TextArea(motherTextEditorControl, this); -#if GTK - vScrollBar.ValueChanged += new EventHandler(VScrollBarValueChanged); - hScrollBar.ValueChanged += new EventHandler(HScrollBarValueChanged); - - textArea.HasFocus = true; - //Gtk.Table table = new Gtk.Table(2, 2, false); - Gtk.Table table = this; - //table.Homogeneous = false; - table.Attach(textArea, 0, 1, 0, 1, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, 0); - table.Attach(vScrollBar, 1, 2, 0, 1, Gtk.AttachOptions.Shrink, Gtk.AttachOptions.Fill, 0, 0); - table.Attach(hScrollBar, 0, 1, 1, 2, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Shrink, 0, 0); - table.Attach(new Gtk.Label(""), 1, 2, 1, 2, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Shrink, 0, 0); - table.ShowAll(); - //Add(table); - - ScrollEvent += new GtkSharp.ScrollEventHandler(OnScroll); - ButtonPressEvent += new GtkSharp.ButtonPressEventHandler(OnButtonPress); -#else - Controls.Add(textArea); - - vScrollBar.ValueChanged += new EventHandler(VScrollBarValueChanged); - Controls.Add(this.vScrollBar); - - hScrollBar.ValueChanged += new EventHandler(HScrollBarValueChanged); - Controls.Add(this.hScrollBar); - ResizeRedraw = true; -#endif - - Document.DocumentChanged += new DocumentEventHandler(AdjustScrollBars); - } - -#if GTK - -#else - protected override void OnResize(System.EventArgs e) - { - base.OnResize(e); - textArea.Bounds = new Rectangle(0, 0, - Width - SystemInformation.HorizontalScrollBarArrowWidth, - Height - SystemInformation.VerticalScrollBarArrowHeight); - SetScrollBarBounds(); - } -#endif - - public void AdjustScrollBars(object sender, DocumentEventArgs e) - { - double v_curval = vScrollBar.Adjustment.Value; - int v_min = 0; - int v_max = (Document.TotalNumberOfLines + textArea.TextView.VisibleLineCount - 2) * textArea.TextView.FontHeight; - int v_lc = Math.Max(0, textArea.TextView.DrawingPosition.Height); - int v_sc = Math.Max(0, textArea.TextView.FontHeight); - - double h_curval = hScrollBar.Adjustment.Value; - int h_min = 0; - int h_max = (int)(1000 * textArea.TextView.GetWidth(' ')) ; //Math.Max(0, max + textArea.TextView.VisibleColumnCount - 1); - int h_lc = Math.Max(0, textArea.TextView.DrawingPosition.Width); - int h_sc = Math.Max(0, (int)textArea.TextView.GetWidth(' ')); - - - Gtk.Adjustment ha = new Gtk.Adjustment(h_curval, h_min, h_max, h_sc, h_lc, 100); - Gtk.Adjustment va = new Gtk.Adjustment(v_curval, v_min, v_max, v_sc, v_lc, 100); - - hScrollBar.Adjustment = ha; - vScrollBar.Adjustment = va; - } - - public void OptionsChanged() - { - textArea.OptionsChanged(); - - AdjustScrollBars(null, null); - } - - void VScrollBarValueChanged(object sender, EventArgs e) - { - textArea.VirtualTop = new System.Drawing.Point((int)textArea.VirtualTop.X, (int)vScrollBar.Value); - } - - void HScrollBarValueChanged(object sender, EventArgs e) - { - textArea.VirtualTop = new System.Drawing.Point((int)hScrollBar.Value, textArea.VirtualTop.Y); - } - -#if GTK - // FIXME: GTKize - protected void OnScroll (object o, GtkSharp.ScrollEventArgs args) - { - //Console.WriteLine (args.Event.y); - switch (args.Event.direction) { - case Gdk.ScrollDirection.Up: - //Console.WriteLine (this.vScrollBar.Value); - this.vScrollBar.Value -= args.Event.y; - break; - case Gdk.ScrollDirection.Down: - //Console.WriteLine (this.vScrollBar.Value); - this.vScrollBar.Value += args.Event.y; - break; - case Gdk.ScrollDirection.Right: - case Gdk.ScrollDirection.Left: - break; - default: - break; - } - } -#else - protected override void OnMouseWheel(MouseEventArgs e) - { - base.OnMouseWheel(e); - int MAX_DELTA = 120; // basically it's constant now, but could be changed later by MS - int multiplier = Math.Abs(e.Delta) / MAX_DELTA; - - int newValue; - if (System.Windows.Forms.SystemInformation.MouseWheelScrollLines > 0) { - newValue = this.vScrollBar.Value - (TextEditorProperties.MouseWheelScrollDown ? 1 : -1) * Math.Sign(e.Delta) * System.Windows.Forms.SystemInformation.MouseWheelScrollLines * vScrollBar.SmallChange * multiplier ; - } else { - newValue = this.vScrollBar.Value - (TextEditorProperties.MouseWheelScrollDown ? 1 : -1) * Math.Sign(e.Delta) * vScrollBar.LargeChange; - } - vScrollBar.Value = Math.Max(vScrollBar.Minimum, Math.Min(vScrollBar.Maximum, newValue)); - } -#endif - - public void ScrollToCaret() - { - int curCharMin = (int)(this.hScrollBar.Value - this.hScrollBar.Adjustment.Lower); - int curCharMax = curCharMin + textArea.TextView.VisibleColumnCount; - - int pos = textArea.TextView.GetVisualColumn(textArea.Caret.Line, textArea.Caret.Column); - - if (textArea.TextView.VisibleColumnCount < 0) { - hScrollBar.Adjustment.Value = 0; - } else { - if (pos < curCharMin) { - hScrollBar.Adjustment.Value = (int)(Math.Max(0, pos - scrollMarginHeight)); - } else { - if (pos > curCharMax) { - hScrollBar.Adjustment.Value = (int)Math.Max(0, Math.Min(hScrollBar.Adjustment.Upper, (pos - textArea.TextView.VisibleColumnCount + scrollMarginHeight))); - } - } - } - ScrollTo(textArea.Caret.Line); - } - - int scrollMarginHeight = 3; - - public void ScrollTo(int line) - { - line = Math.Max(0, Math.Min(Document.TotalNumberOfLines - 1, line)); - line = Document.GetLogicalLine(line); - - int curLineMin = textArea.TextView.FirstVisibleLine; - if (line - scrollMarginHeight < curLineMin) { - this.vScrollBar.Adjustment.Value = Math.Max(0, Math.Min(Document.TotalNumberOfLines - 1, line - scrollMarginHeight)) * textArea.TextView.FontHeight; - } else { - int curLineMax = curLineMin + this.textArea.TextView.VisibleLineCount; - if (line + scrollMarginHeight > curLineMax) { - this.vScrollBar.Adjustment.Value = Math.Min(Document.TotalNumberOfLines - 1, - line - this.textArea.TextView.VisibleLineCount + scrollMarginHeight) * textArea.TextView.FontHeight; - } - } - } - - public void JumpTo(int line, int column) - { - textArea.SelectionManager.ClearSelection(); - textArea.Caret.Position = new System.Drawing.Point(column, line); - textArea.SetDesiredColumn(); - ScrollToCaret(); -#if GTK - textArea.GrabFocus(); -#else - textArea.Focus(); -#endif - } - - private void OnButtonPress(object sender, GtkSharp.ButtonPressEventArgs args) { - if (args.Event.button == 3) { - if (contextMenu != null) { - args.RetVal = true; - contextMenu.Popup(null, null, null, IntPtr.Zero, 3, Gtk.Global.CurrentEventTime); - } - } - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Gui/TextAreaDragDropHandler.cs b/main/Unused/ICSharpCode.TextEditor/src/Gui/TextAreaDragDropHandler.cs deleted file mode 100644 index f201140610..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Gui/TextAreaDragDropHandler.cs +++ /dev/null @@ -1,143 +0,0 @@ -// TextAreaDragDropHandler.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.IO; -using System.ComponentModel; -using System.Drawing; -using System.Threading; -using System.Drawing.Text; -using System.Drawing.Drawing2D; -using System.Drawing.Printing; -using System.Diagnostics; -using System.Runtime.Remoting; -using System.Runtime.InteropServices; -using System.Xml; - -using MonoDevelop.TextEditor.Document; - -namespace MonoDevelop.TextEditor -{ - public class TextAreaDragDropHandler - { - TextArea textArea; - - public void Attach(TextArea textArea) - { - this.textArea = textArea; - //textArea.AllowDrop = true; - - //textArea.DragEnter += new DragEventHandler(OnDragEnter); - //textArea.DragDrop += new DragEventHandler(OnDragDrop); - //textArea.DragOver += new DragEventHandler(OnDragOver); - } - - - /*static DragDropEffects GetDragDropEffect(DragEventArgs e) - { - if ((e.AllowedEffect & DragDropEffects.Move) > 0 && - (e.AllowedEffect & DragDropEffects.Copy) > 0) { - return (e.KeyState & 8) > 0 ? DragDropEffects.Copy : DragDropEffects.Move; - } else if ((e.AllowedEffect & DragDropEffects.Move) > 0) { - return DragDropEffects.Move; - } else if ((e.AllowedEffect & DragDropEffects.Copy) > 0) { - return DragDropEffects.Copy; - } - return DragDropEffects.None; - }*/ - - /*protected void OnDragEnter(object sender, DragEventArgs e) - { - if (e.Data.GetDataPresent(typeof(string))) { - //e.Effect = GetDragDropEffect(e); - } - }*/ - - - void InsertString(int offset, string str) - { - textArea.Document.Insert(offset, str); - - textArea.SelectionManager.SetSelection(new DefaultSelection(textArea.Document, - textArea.Document.OffsetToPosition(offset), - textArea.Document.OffsetToPosition(offset + str.Length))); - textArea.Caret.Position = textArea.Document.OffsetToPosition(offset + str.Length); - //textArea.Refresh(); - } - - /*protected void OnDragDrop(object sender, DragEventArgs e) - { - Point p = textArea.PointToClient(new Point(e.X, e.Y)); - - if (e.Data.GetDataPresent(typeof(string))) { - bool two = false; - textArea.BeginUpdate(); - try { - int offset = textArea.Caret.Offset; - if (e.Data.GetDataPresent(typeof(DefaultSelection))) { - ISelection sel = (ISelection)e.Data.GetData(typeof(DefaultSelection)); - if (sel.ContainsPosition(textArea.Caret.Position)) { - return; - } - if (GetDragDropEffect(e) == DragDropEffects.Move) { - int len = sel.Length; - textArea.Document.Remove(sel.Offset, len); - if (sel.Offset < offset) { - offset -= len; - } - } - two = true; - } - textArea.SelectionManager.ClearSelection(); - InsertString(offset, (string)e.Data.GetData(typeof(string))); - if (two) { - textArea.Document.UndoStack.UndoLast(2); - } - textArea.Document.UpdateQueue.Clear(); - textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.WholeTextArea)); - } finally { - textArea.EndUpdate(); - } - } - } - - protected void OnDragOver(object sender, DragEventArgs e) - { - if (!textArea.Focused) { - textArea.Focus(); - } - - Point p = textArea.PointToClient(new Point(e.X, e.Y)); - - if (textArea.TextView.DrawingPosition.Contains(p.X, p.Y)) { - Point realmousepos= textArea.TextView.GetLogicalPosition(p.X - textArea.TextView.DrawingPosition.X, - p.Y - textArea.TextView.DrawingPosition.Y); - int lineNr = Math.Min(textArea.Document.TotalNumberOfLines - 1, Math.Max(0, realmousepos.Y)); - - textArea.Caret.Position = new Point(realmousepos.X, lineNr); - textArea.SetDesiredColumn(); - if (e.Data.GetDataPresent(typeof(string))) { - e.Effect = GetDragDropEffect(e); - } - } - }*/ - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Gui/TextAreaMouseHandler.cs b/main/Unused/ICSharpCode.TextEditor/src/Gui/TextAreaMouseHandler.cs deleted file mode 100644 index fc4fdf38fa..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Gui/TextAreaMouseHandler.cs +++ /dev/null @@ -1,402 +0,0 @@ -// TextAreaMouseHandler.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Threading; -using MonoDevelop.TextEditor.Document; - -namespace MonoDevelop.TextEditor -{ - /// <summary> - /// This class handles all mouse stuff for a textArea. - /// </summary> - public class TextAreaMouseHandler - { - - TextArea textArea; - bool doubleclick = false; - Point mousepos = new Point(0, 0); - int selbegin; - int selend; - bool clickedOnSelectedText = false; - - uint button; - - Point mousedownpos = new Point(-1, -1); - bool gotmousedown = false; - bool dodragdrop = false; - - public TextAreaMouseHandler(TextArea textArea) - { - this.textArea = textArea; - } - - public void Attach() - { -#if GTK - textArea.ButtonReleaseEvent += new GtkSharp.ButtonReleaseEventHandler(OnButtonRelease); - textArea.ButtonPressEvent += new GtkSharp.ButtonPressEventHandler(OnButtonPress); - textArea.MotionNotifyEvent += new GtkSharp.MotionNotifyEventHandler(OnMotionNotify); -#else - textArea.Click += new EventHandler(TextAreaClick); - textArea.MouseMove += new MouseEventHandler(TextAreaMouseMove); - - textArea.MouseDown += new MouseEventHandler(OnMouseDown); - textArea.DoubleClick += new EventHandler(OnDoubleClick); - textArea.MouseLeave += new EventHandler(OnMouseLeave); - textArea.MouseUp += new MouseEventHandler(OnMouseUp); - textArea.LostFocus += new EventHandler(TextAreaLostFocus); -#endif - } - - void ShowHiddenCursor() - { - if (TextArea.HiddenMouseCursor) { -#if GTK - // FIXME: GTKize -#else - Cursor.Show(); -#endif - TextArea.HiddenMouseCursor = false; - } - } - - void TextAreaLostFocus(object sender, EventArgs e) - { - ShowHiddenCursor(); - } - void OnMouseLeave(object sender, EventArgs e) - { - ShowHiddenCursor(); - gotmousedown = false; - mousedownpos = new Point(-1, -1); - } - -#if GTK - private void OnButtonRelease (object obj, GtkSharp.ButtonReleaseEventArgs args) - { - if (gotmousedown) { // It should - TextAreaClick(); - } - gotmousedown = false; - mousedownpos = new Point(-1, -1); - } -#else - void OnMouseUp(object sender, MouseEventArgs e) - { - gotmousedown = false; - mousedownpos = new Point(-1, -1); - } -#endif - - void TextAreaClick() - { - if (dodragdrop) { - return; - } - - if (textArea.FoldMargin.DrawingPosition.Contains(mousepos.X, mousepos.Y)) { - textArea.FoldMargin.OnClick(mousepos); - } - if (clickedOnSelectedText && textArea.TextView.DrawingPosition.Contains(mousepos.X, mousepos.Y)) { - textArea.SelectionManager.ClearSelection(); - - Point clickPosition = textArea.TextView.GetLogicalPosition(mousepos.X - textArea.TextView.DrawingPosition.X, mousepos.Y - textArea.TextView.DrawingPosition.Y); - textArea.Caret.Position = clickPosition; - textArea.SetDesiredColumn(); - } - } - -#if GTK - /* - private void OnMotionNotifyEvent(object o, MotionNotifyEventArgs args) { - DateTime start = DateTime.Now; - //if (args.Event.time < last_draw) { - // return; - //} - } - */ -#endif - -#if GTK - void OnMotionNotify(object sender, GtkSharp.MotionNotifyEventArgs args) -#else - void TextAreaMouseMove(object sender, MouseEventArgs e) -#endif - { -#if GTK - if (gotmousedown == false) { - return; - } -#endif - ShowHiddenCursor(); - if (dodragdrop) { - dodragdrop = false; - return; - } - - doubleclick = false; - mousepos = new Point((int)args.Event.x, (int)args.Event.y); - - if (textArea.GutterMargin.DrawingPosition.Contains(mousepos.X, mousepos.Y) || textArea.FoldMargin.DrawingPosition.Contains(mousepos.X, mousepos.Y)) { - if (button == 1) { - Point realmousepos = textArea.TextView.GetLogicalPosition(0, mousepos.Y /*- textArea.TextView.DrawingPosition.Y*/); - if (realmousepos.Y < textArea.Document.TotalNumberOfLines) { - if (selectionStartPos.Y == realmousepos.Y) { - textArea.SelectionManager.SetSelection(new DefaultSelection(textArea.Document, realmousepos, new Point(textArea.Document.GetLineSegment(realmousepos.Y).Length + 1, realmousepos.Y))); - } else if (selectionStartPos.Y < realmousepos.Y && textArea.SelectionManager.HasSomethingSelected) { - textArea.SelectionManager.ExtendSelection(textArea.SelectionManager.SelectionCollection[0].EndPosition, realmousepos); - } else { - textArea.SelectionManager.ExtendSelection(textArea.Caret.Position, realmousepos); - } - textArea.Caret.Position = realmousepos; - } - } - } else if (textArea.TextView.DrawingPosition.Contains(mousepos.X, mousepos.Y)) { - if (clickedOnSelectedText) { -#if GTK - // FIXME: GTKize? - if (Math.Abs(mousedownpos.X - mousepos.X) >= 5 || - Math.Abs(mousedownpos.Y - mousepos.Y) >= 5) { -#else - if (Math.Abs(mousedownpos.X - mousepos.X) >= SystemInformation.DragSize.Width / 2 || - Math.Abs(mousedownpos.Y - mousepos.Y) >= SystemInformation.DragSize.Height / 2) { -#endif - clickedOnSelectedText = false; - ISelection selection = textArea.SelectionManager.GetSelectionAt(textArea.Caret.Offset); - if (selection != null) { - string text = selection.SelectedText; - if (text != null && text.Length > 0) { -#if GTK - // FIXME: GTKize -#else - DataObject dataObject = new DataObject (); - dataObject.SetData(DataFormats.UnicodeText, true, text); - dataObject.SetData(selection); - dodragdrop = true; - textArea.DoDragDrop(dataObject, DragDropEffects.All); -#endif - } - } - } - - return; - } - - if (button == 1) { - if (gotmousedown) { - ExtendSelectionToMouse(); - } - } - } - } - - void ExtendSelectionToMouse() - { - Point realmousepos = textArea.TextView.GetLogicalPosition(mousepos.X /*- textArea.TextView.DrawingPosition.X*/, - mousepos.Y /*- textArea.TextView.DrawingPosition.Y*/); - Point oldPos = textArea.Caret.Position; - textArea.Caret.Position = realmousepos; - textArea.SelectionManager.ExtendSelection(oldPos, textArea.Caret.Position); - textArea.SetDesiredColumn(); - } - - Point selectionStartPos = new Point(-1, -1); - -#if GTK - private void OnButtonPress (object obj, GtkSharp.ButtonPressEventArgs args) -#else - void OnMouseDown(object sender, MouseEventArgs e) -#endif - { - if (args.Event.type == Gdk.EventType.TwoButtonPress) { - OnDoubleClick(); - return; - } - - if (dodragdrop) { - return; - } - - if (doubleclick) { - doubleclick = false; - return; - } - - gotmousedown = true; - mousedownpos = new Point((int)args.Event.x, (int)args.Event.y); - - mousepos = mousedownpos; - - button = args.Event.button; - - if (textArea.GutterMargin.DrawingPosition.Contains(mousepos.X, mousepos.Y) || textArea.FoldMargin.DrawingPosition.Contains(mousepos.X, mousepos.Y)) { - Point realmousepos = textArea.TextView.GetLogicalPosition(0, mousepos.Y - textArea.TextView.DrawingPosition.Y); - if (realmousepos.Y < textArea.Document.TotalNumberOfLines) { - selectionStartPos = realmousepos; - textArea.SelectionManager.ClearSelection(); - textArea.SelectionManager.SetSelection(new DefaultSelection(textArea.Document, realmousepos, new Point(textArea.Document.GetLineSegment(realmousepos.Y).Length + 1, realmousepos.Y))); - textArea.Caret.Position = realmousepos; - } - } else if (textArea.TextView.DrawingPosition.Contains(mousepos.X, mousepos.Y)) { - if (button == 1) { -#if GTK - //FIXME: GTKize - if (true) { -#else - if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift) { - ExtendSelectionToMouse(); - } else { -#endif - -#if GTK - // FIZME: GTKize? - Point realmousepos = textArea.TextView.GetLogicalPosition(mousepos.X, mousepos.Y); -#else - Point realmousepos = textArea.TextView.GetLogicalPosition(mousepos.X - textArea.TextView.DrawingPosition.X, mousepos.Y - textArea.TextView.DrawingPosition.Y); -#endif - clickedOnSelectedText = false; - - int offset = textArea.Document.PositionToOffset(realmousepos); - - - if (textArea.SelectionManager.HasSomethingSelected && - textArea.SelectionManager.IsSelected(offset)) { - clickedOnSelectedText = true; - } else { - selbegin = selend = offset; - textArea.SelectionManager.ClearSelection(); - if (mousepos.Y > 0 && mousepos.Y < textArea.TextView.DrawingPosition.Height) { - Point pos = new Point(); - pos.Y = Math.Min(textArea.Document.TotalNumberOfLines - 1, realmousepos.Y); - pos.X = realmousepos.X; - textArea.Caret.Position = pos;//Math.Max(0, Math.Min(textArea.Document.TextLength, line.Offset + Math.Min(line.Length, pos.X))); - textArea.SetDesiredColumn(); - } - } - } - } - } -#if GTK - textArea.GrabFocus(); -#else - textArea.Focus(); -#endif - } - - int FindNext(IDocument document, int offset, char ch) - { - LineSegment line = document.GetLineSegmentForOffset(offset); - int endPos = line.Offset + line.Length; - - while (offset < endPos && document.GetCharAt(offset) != ch) { - ++offset; - } - return offset; - } - - bool IsSelectableChar(char ch) - { - return Char.IsLetterOrDigit(ch) || ch=='_'; - } - - int FindWordStart(IDocument document, int offset) - { - LineSegment line = document.GetLineSegmentForOffset(offset); - - if (offset > 0 && Char.IsWhiteSpace(document.GetCharAt(offset - 1)) && Char.IsWhiteSpace(document.GetCharAt(offset))) { - while (offset > line.Offset && Char.IsWhiteSpace(document.GetCharAt(offset - 1))) { - --offset; - } - } else if (IsSelectableChar(document.GetCharAt(offset)) || (offset > 0 && Char.IsWhiteSpace(document.GetCharAt(offset)) && IsSelectableChar(document.GetCharAt(offset - 1)))) { - while (offset > line.Offset && IsSelectableChar(document.GetCharAt(offset - 1))) { - --offset; - } - } else { - if (offset > 0 && !Char.IsWhiteSpace(document.GetCharAt(offset - 1)) && !IsSelectableChar(document.GetCharAt(offset - 1)) ) { - return Math.Max(0, offset - 1); - } - } - return offset; - } - - int FindWordEnd(IDocument document, int offset) - { - LineSegment line = document.GetLineSegmentForOffset(offset); - int endPos = line.Offset + line.Length; - - if (IsSelectableChar(document.GetCharAt(offset))) { - while (offset < endPos && IsSelectableChar(document.GetCharAt(offset))) { - ++offset; - } - } else if (Char.IsWhiteSpace(document.GetCharAt(offset))) { - if (offset > 0 && Char.IsWhiteSpace(document.GetCharAt(offset - 1))) { - while (offset < endPos && Char.IsWhiteSpace(document.GetCharAt(offset))) { - ++offset; - } - } - } else { - return Math.Max(0, offset + 1); - } - - return offset; - } - - void OnDoubleClick() - { - if (dodragdrop) { - return; - } - - doubleclick = true; - - textArea.SelectionManager.ClearSelection(); - if (textArea.TextView.DrawingPosition.Contains(mousepos.X, mousepos.Y)) { - if (textArea.Caret.Offset < textArea.Document.TextLength) { - switch (textArea.Document.GetCharAt(textArea.Caret.Offset)) { - case '"': - if (textArea.Caret.Offset < textArea.Document.TextLength) { - int next = FindNext(textArea.Document, textArea.Caret.Offset + 1, '"'); - textArea.SelectionManager.ExtendSelection(textArea.Caret.Position, - textArea.Document.OffsetToPosition(next > textArea.Caret.Offset ? next + 1 : next)); - } - break; - default: - textArea.SelectionManager.ExtendSelection(textArea.Document.OffsetToPosition(FindWordStart(textArea.Document, textArea.Caret.Offset)), - textArea.Document.OffsetToPosition(FindWordEnd(textArea.Document, textArea.Caret.Offset))); - break; - - } - // HACK WARNING !!! - // must refresh here, because when a error tooltip is showed and the underlined - // code is double clicked the textArea don't update corrctly, updateline doesn't - // work ... but the refresh does. - // Mike -#if GTK - // FIXME: GTKize -#else - textArea.Refresh(); -#endif - } - } - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Gui/TextAreaUpdate.cs b/main/Unused/ICSharpCode.TextEditor/src/Gui/TextAreaUpdate.cs deleted file mode 100644 index 40a835e37b..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Gui/TextAreaUpdate.cs +++ /dev/null @@ -1,100 +0,0 @@ -// TextAreaUpdate.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; - -using MonoDevelop.TextEditor.Document; - -namespace MonoDevelop.TextEditor -{ - /// <summary> - /// This enum describes all implemented request types - /// </summary> - public enum TextAreaUpdateType { - WholeTextArea, - SingleLine, - SinglePosition, - PositionToLineEnd, - PositionToEnd, - LinesBetween - } - - /// <summary> - /// This class is used to request an update of the textarea - /// </summary> - public class TextAreaUpdate - { - Point position; - TextAreaUpdateType type; - - public TextAreaUpdateType TextAreaUpdateType { - get { - return type; - } - } - - public Point Position { - get { - return position; - } - } - - /// <summary> - /// Creates a new instance of <see cref="TextAreaUpdate"/> - /// </summary> - public TextAreaUpdate(TextAreaUpdateType type) - { - this.type = type; - } - - /// <summary> - /// Creates a new instance of <see cref="TextAreaUpdate"/> - /// </summary> - public TextAreaUpdate(TextAreaUpdateType type, Point position) - { - this.type = type; - this.position = position; - } - - /// <summary> - /// Creates a new instance of <see cref="TextAreaUpdate"/> - /// </summary> - public TextAreaUpdate(TextAreaUpdateType type, int startLine, int endLine) - { - this.type = type; - this.position = new Point(startLine, endLine); - } - - /// <summary> - /// Creates a new instance of <see cref="TextAreaUpdate"/> - /// </summary> - public TextAreaUpdate(TextAreaUpdateType type, int singleLine) - { - this.type = type; - this.position = new Point(0, singleLine); - } - - public override string ToString() - { - return String.Format("[TextAreaUpdate: Type={0}, Position={1}]", type, position); - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Gui/TextEditorControl.cs b/main/Unused/ICSharpCode.TextEditor/src/Gui/TextEditorControl.cs deleted file mode 100644 index 5c8af42e93..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Gui/TextEditorControl.cs +++ /dev/null @@ -1,245 +0,0 @@ -// TextEditorControl.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.IO; -using System.ComponentModel; -using System.Drawing.Printing; -using System.Diagnostics; -using System.Text; - -using MonoDevelop.TextEditor.Document; -using MonoDevelop.TextEditor.Actions; - -namespace MonoDevelop.TextEditor -{ - /// <summary> - /// This class is used for a basic text area control - /// </summary> -// [ToolboxBitmap("MonoDevelop.TextEditor.TextEditorControl.bmp")] - [ToolboxItem(true)] - public class TextEditorControl : TextEditorControlBase - { - TextAreaControl primaryTextArea; -#if GTK - // FIXME: GTKize - //VPaned pane = new VPaned (); -#else - Splitter textAreaSplitter = null; -#endif - TextAreaControl secondaryTextArea = null; - - public PrintDocument PrintDocument { - get { - PrintDocument printDocument = new PrintDocument(); - printDocument.PrintPage += new PrintPageEventHandler(this.PrintPage); - return null; - } - } - - public TextAreaControl ActiveTextAreaControl { - get { - return primaryTextArea; - } - } - - public TextEditorControl() - { - Document = (new DocumentFactory()).CreateDocument(); - Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy(); - - primaryTextArea = new TextAreaControl(this); -#if GTK - // FIXME: GTKize - //pane.Add1(primaryTextArea); - PackEnd(primaryTextArea, true, true, 0); -#else - primaryTextArea = new TextAreaControl(this); - primaryTextArea.Dock = DockStyle.Fill; - Controls.Add(primaryTextArea); - ResizeRedraw = true; -#endif - InitializeTextAreaControl(primaryTextArea); - Document.UpdateCommited += new EventHandler(CommitUpdateRequested); - OptionsChanged(); - } - - protected virtual void InitializeTextAreaControl(TextAreaControl newControl) - { - } - - public override void OptionsChanged() - { - primaryTextArea.OptionsChanged(); - if (secondaryTextArea != null) { - secondaryTextArea.OptionsChanged(); - } - } - -#if GTK - // FIXME: GTKize -#else - public void Split() - { - if (secondaryTextArea == null) { - secondaryTextArea = new TextAreaControl(this); - secondaryTextArea.Dock = DockStyle.Bottom; - secondaryTextArea.Height = Height / 2; - textAreaSplitter = new Splitter(); - textAreaSplitter.BorderStyle = BorderStyle.FixedSingle ; - textAreaSplitter.Height = 8; - textAreaSplitter.Dock = DockStyle.Bottom; - Controls.Add(textAreaSplitter); - Controls.Add(secondaryTextArea); - InitializeTextAreaControl(secondaryTextArea); - secondaryTextArea.OptionsChanged(); - } else { - Controls.Remove(secondaryTextArea); - Controls.Remove(textAreaSplitter); - - secondaryTextArea.Dispose(); - textAreaSplitter.Dispose(); - secondaryTextArea = null; - textAreaSplitter = null; - } - } -#endif - - public void Undo() - { - if (Document.ReadOnly) { - return; - } - if (Document.UndoStack.CanUndo) { - BeginUpdate(); - Document.UndoStack.Undo(); - - Document.UpdateQueue.Clear(); - Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.WholeTextArea)); - this.primaryTextArea.TextArea.UpdateMatchingBracket(); - if (secondaryTextArea != null) { - this.secondaryTextArea.TextArea.UpdateMatchingBracket(); - } - EndUpdate(); - //this.primaryTextArea.TextArea.Refresh (); - } - } - - public void Redo() - { - if (Document.ReadOnly) { - return; - } - if (Document.UndoStack.CanRedo) { - BeginUpdate(); - Document.UndoStack.Redo(); - - Document.UpdateQueue.Clear(); - Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.WholeTextArea)); - this.primaryTextArea.TextArea.UpdateMatchingBracket(); - if (secondaryTextArea != null) { - this.secondaryTextArea.TextArea.UpdateMatchingBracket(); - } - EndUpdate(); - //this.primaryTextArea.TextArea.Refresh (); - } - } - - public void SetHighlighting(string name) - { - Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy(name); - } - - -#region Update Methods - public override void EndUpdate() - { - base.EndUpdate(); - Document.CommitUpdate(); - } - - void CommitUpdateRequested(object sender, EventArgs e) - { - if (IsUpdating) { - return; - } - foreach (TextAreaUpdate update in Document.UpdateQueue) { - switch (update.TextAreaUpdateType) { - case TextAreaUpdateType.PositionToEnd: - this.primaryTextArea.TextArea.UpdateToEnd(update.Position.Y); - if (this.secondaryTextArea != null) { - this.secondaryTextArea.TextArea.UpdateToEnd(update.Position.Y); - } - break; - case TextAreaUpdateType.PositionToLineEnd: - case TextAreaUpdateType.SingleLine: - this.primaryTextArea.TextArea.UpdateLine(update.Position.Y); - if (this.secondaryTextArea != null) { - this.secondaryTextArea.TextArea.UpdateLine(update.Position.Y); - } - break; - case TextAreaUpdateType.SinglePosition: - this.primaryTextArea.TextArea.UpdateLine(update.Position.Y, update.Position.X, update.Position.X); - if (this.secondaryTextArea != null) { - this.secondaryTextArea.TextArea.UpdateLine(update.Position.Y, update.Position.X, update.Position.X); - } - break; - case TextAreaUpdateType.LinesBetween: - this.primaryTextArea.TextArea.UpdateLines(update.Position.X, update.Position.Y); - if (this.secondaryTextArea != null) { - this.secondaryTextArea.TextArea.UpdateLines(update.Position.X, update.Position.Y); - } - break; - case TextAreaUpdateType.WholeTextArea: - this.primaryTextArea.TextArea.Refresh(); - if (this.secondaryTextArea != null) { - this.secondaryTextArea.TextArea.Refresh(); - } - break; - } - } - Document.UpdateQueue.Clear(); -#if GTK - // FIXME: GTKize -#else - this.primaryTextArea.TextArea.Update(); - if (this.secondaryTextArea != null) { - this.secondaryTextArea.TextArea.Update(); - } -#endif -// Console.WriteLine("-------END"); - } -#endregion - -#region Printing routines - void PrintPage(object sender, PrintPageEventArgs ev) - { -// float leftMargin = ev.MarginBounds.Left; -// float topMargin = ev.MarginBounds.Top; -// -// // Calculate the number of lines per page. -// int linesPerPage = ev.MarginBounds.Height / this.TextEditorProperties.Font.GetHeight(ev.Graphics); - - //TODO - } -#endregion - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Gui/TextEditorControlBase.cs b/main/Unused/ICSharpCode.TextEditor/src/Gui/TextEditorControlBase.cs deleted file mode 100644 index bbddea6a7f..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Gui/TextEditorControlBase.cs +++ /dev/null @@ -1,712 +0,0 @@ -// TextEditorControlBase.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.ComponentModel; -using System.Drawing; -using System.Diagnostics; -using System.Text; - -using MonoDevelop.TextEditor.Document; -using MonoDevelop.TextEditor.Actions; - -using MonoDevelop.EditorBindings.FormattingStrategy; -using MonoDevelop.EditorBindings.Properties; - -namespace MonoDevelop.TextEditor -{ - /// <summary> - /// This class is used for a basic text area control - /// </summary> - [ToolboxItem(false)] - public abstract class TextEditorControlBase : Gtk.VBox - { - string currentFileName = null; - int updateLevel = 0; - IDocument document; - - /// <summary> - /// This hashtable contains all editor keys, where - /// the key is the key combination and the value the - /// action. - /// </summary> -#if GTK - protected Hashtable states = new Hashtable(); -#else - protected Hashtable editactions = new Hashtable(); -#endif - - public ITextEditorProperties TextEditorProperties { - get { - return document.TextEditorProperties; - } - set { - document.TextEditorProperties = value; - } - } - - /// <value> - /// Current file's character encoding - /// </value> - public Encoding Encoding { - get { - return TextEditorProperties.Encoding; - } - set { -// if (encoding != null && value != null && !encoding.Equals(value) && !CharacterEncoding.IsUnicode(value)) { -// Byte[] bytes = encoding.GetBytes(Text); -// Text = new String(value.GetChars(bytes)); -// } - TextEditorProperties.Encoding = value; - } - } - - /// <value> - /// The current file name - /// </value> - [Browsable(false)] - [ReadOnly(true)] - public string FileName { - get { - return currentFileName; - } - set { - if (currentFileName != value) { - currentFileName = value; - OnFileNameChanged(EventArgs.Empty); - } - } - } - - /// <value> - /// true, if the textarea is updating it's status, while - /// it updates it status no redraw operation occurs. - /// </value> - [Browsable(false)] - public bool IsUpdating { - get { - return updateLevel > 0; - } - } - - /// <value> - /// The current document - /// </value> - [Browsable(false)] - public IDocument Document { - get { - return document; - } - set { - document = value; - } - } - - [Browsable(true)] - public string Text { - get { - return Document.TextContent; - } - set { - Document.TextContent = value; - } - } - - static Font ParseFont(string font) - { - string[] descr = font.Split(new char[]{',', '='}); - return new Font(descr[1], Single.Parse(descr[3])); - } - - /// <value> - /// If set to true the contents can't be altered. - /// </value> - [Browsable(false)] - [ReadOnly(true)] - public bool IsReadOnly { - get { - return Document.ReadOnly; - } - set { - Document.ReadOnly = value; - } - } - - [Browsable(false)] - public bool IsInUpdate { - get { - return this.updateLevel > 0; - } - } - - /// <value> - /// supposedly this is the way to do it according to .NET docs, - /// as opposed to setting the size in the constructor - /// </value> - protected Size DefaultSize { - get { - return new Size(100, 100); - } - } - -#region Document Properties - /// <value> - /// If true spaces are shown in the textarea - /// </value> - [Category("Appearance")] - [DefaultValue(false)] - [Description("If true spaces are shown in the textarea")] - public bool ShowSpaces { - get { - return document.TextEditorProperties.ShowSpaces; - } - set { - document.TextEditorProperties.ShowSpaces = value; - OptionsChanged(); - } - } - - /// <value> - /// If true antialiased fonts are used inside the textarea - /// </value> - [Category("Appearance")] - [DefaultValue(false)] - [Description("If true antialiased fonts are used inside the textarea")] - public bool UseAntiAliasFont { - get { - return document.TextEditorProperties.UseAntiAliasedFont; - } - set { - document.TextEditorProperties.UseAntiAliasedFont = value; - OptionsChanged(); - } - } - - /// <value> - /// If true tabs are shown in the textarea - /// </value> - [Category("Appearance")] - [DefaultValue(false)] - [Description("If true tabs are shown in the textarea")] - public bool ShowTabs { - get { - return document.TextEditorProperties.ShowTabs; - } - set { - document.TextEditorProperties.ShowTabs = value; - OptionsChanged(); - } - } - - /// <value> - /// If true EOL markers are shown in the textarea - /// </value> - [Category("Appearance")] - [DefaultValue(false)] - [Description("If true EOL markers are shown in the textarea")] - public bool ShowEOLMarkers { - get { - return document.TextEditorProperties.ShowEOLMarker; - } - set { - document.TextEditorProperties.ShowEOLMarker = value; - OptionsChanged(); - } - } - - /// <value> - /// If true the horizontal ruler is shown in the textarea - /// </value> - [Category("Appearance")] - [DefaultValue(false)] - [Description("If true the horizontal ruler is shown in the textarea")] - public bool ShowHRuler { - get { - return document.TextEditorProperties.ShowHorizontalRuler; - } - set { - document.TextEditorProperties.ShowHorizontalRuler = value; - OptionsChanged(); - } - } - - /// <value> - /// If true the vertical ruler is shown in the textarea - /// </value> - [Category("Appearance")] - [DefaultValue(false)] - [Description("If true the vertical ruler is shown in the textarea")] - public bool ShowVRuler { - get { - return document.TextEditorProperties.ShowVerticalRuler; - } - set { - document.TextEditorProperties.ShowVerticalRuler = value; - OptionsChanged(); - } - } - - /// <value> - /// The row in which the vertical ruler is displayed - /// </value> - [Category("Appearance")] - [DefaultValue(80)] - [Description("The row in which the vertical ruler is displayed")] - public int VRulerRow { - get { - return document.TextEditorProperties.VerticalRulerRow; - } - set { - document.TextEditorProperties.VerticalRulerRow = value; - OptionsChanged(); - } - } - - /// <value> - /// If true line numbers are shown in the textarea - /// </value> - [Category("Appearance")] - [DefaultValue(true)] - [Description("If true line numbers are shown in the textarea")] - public bool ShowLineNumbers { - get { - return document.TextEditorProperties.ShowLineNumbers; - } - set { - document.TextEditorProperties.ShowLineNumbers = value; - OptionsChanged(); - } - } - - /// <value> - /// If true invalid lines are marked in the textarea - /// </value> - [Category("Appearance")] - [DefaultValue(true)] - [Description("If true invalid lines are marked in the textarea")] - public bool ShowInvalidLines { - get { - return document.TextEditorProperties.ShowInvalidLines; - } - set { - document.TextEditorProperties.ShowInvalidLines = value; - OptionsChanged(); - } - } - - /// <value> - /// If true folding is enabled in the textarea - /// </value> - [Category("Appearance")] - [DefaultValue(true)] - [Description("If true folding is enabled in the textarea")] - public bool EnableFolding { - get { - return document.TextEditorProperties.EnableFolding; - } - set { - document.TextEditorProperties.EnableFolding = value; - OptionsChanged(); - } - } - - [Category("Appearance")] - [DefaultValue(true)] - [Description("If true matching brackets are highlighted")] - public bool ShowMatchingBracket { - get { - return document.TextEditorProperties.ShowMatchingBracket; - } - set { - document.TextEditorProperties.ShowMatchingBracket = value; - OptionsChanged(); - } - } - - [Category("Appearance")] - [DefaultValue(true)] - [Description("If true the icon bar is displayed")] - public bool IsIconBarVisible { - get { - return document.TextEditorProperties.IsIconBarVisible; - } - set { - document.TextEditorProperties.IsIconBarVisible = value; - OptionsChanged(); - } - } - - /// <value> - /// The width in spaces of a tab character - /// </value> - [Category("Appearance")] - [DefaultValue(4)] - [Description("The width in spaces of a tab character")] - public int TabIndent { - get { - return document.TextEditorProperties.TabIndent; - } - set { - document.TextEditorProperties.TabIndent = value; - OptionsChanged(); - } - } - - /// <value> - /// The line viewer style - /// </value> - [Category("Appearance")] - [DefaultValue(LineViewerStyle.None)] - [Description("The line viewer style")] - public LineViewerStyle LineViewerStyle { - get { - return document.TextEditorProperties.LineViewerStyle; - } - set { - document.TextEditorProperties.LineViewerStyle = value; - OptionsChanged(); - } - } - - /// <value> - /// The indent style - /// </value> - [Category("Behavior")] - [DefaultValue(IndentStyle.Smart)] - [Description("The indent style")] - public IndentStyle IndentStyle { - get { - return document.TextEditorProperties.IndentStyle; - } - set { - document.TextEditorProperties.IndentStyle = value; - OptionsChanged(); - } - } - - /// <value> - /// if true spaces are converted to tabs - /// </value> - [Category("Behavior")] - [DefaultValue(false)] - [Description("Converts tabs to spaces while typing")] - public bool ConvertTabsToSpaces { - get { - return document.TextEditorProperties.ConvertTabsToSpaces; - } - set { - document.TextEditorProperties.ConvertTabsToSpaces = value; - OptionsChanged(); - } - } - - /// <value> - /// if true spaces are converted to tabs - /// </value> - [Category("Behavior")] - [DefaultValue(false)] - [Description("Creates a backup copy for overwritten files")] - public bool CreateBackupCopy { - get { - return document.TextEditorProperties.CreateBackupCopy; - } - set { - document.TextEditorProperties.CreateBackupCopy = value; - OptionsChanged(); - } - } - - /// <value> - /// if true spaces are converted to tabs - /// </value> - [Category("Behavior")] - [DefaultValue(false)] - [Description("Hide the mouse cursor while typing")] - public bool HideMouseCursor { - get { - return document.TextEditorProperties.HideMouseCursor; - } - set { - document.TextEditorProperties.HideMouseCursor = value; - OptionsChanged(); - } - } - - /// <value> - /// if true spaces are converted to tabs - /// </value> - [Category("Behavior")] - [DefaultValue(false)] - [Description("Allows the caret to be places beyonde the end of line")] - public bool AllowCaretBeyondEOL { - get { - return document.TextEditorProperties.AllowCaretBeyondEOL; - } - set { - document.TextEditorProperties.AllowCaretBeyondEOL = value; - OptionsChanged(); - } - } - - /// <value> - /// The base font of the text area. No bold or italic fonts - /// can be used because bold/italic is reserved for highlighting - /// purposes. - /// </value> - [Browsable(true)] - [Description("The base font of the text area. No bold or italic fonts can be used because bold/italic is reserved for highlighting purposes.")] - public Pango.FontDescription Font { - get { - return document.TextEditorProperties.Font; - } - set { - document.TextEditorProperties.Font = value; - OptionsChanged(); - } - } - -#endregion - - public TextEditorControlBase(): base(false, 0) - { - GenerateDefaultActions(); - } - - - internal IEditAction GetEditAction(Gdk.EventKey eventKey) - { - uint state = eventKey.state; - state &= 1101u; // Filter all but shift, ctrl & alt - Hashtable h = (Hashtable)states[state]; - if (h == null) { - return null; - } - Gdk.Key key = (Gdk.Key) Gdk.Keyval.ToLower((uint)eventKey.Key); - IEditAction a = (IEditAction)h[key]; - return a; - } - - void GenerateDefaultActions() - { - Hashtable normal = new Hashtable(); - Hashtable shift = new Hashtable(); - Hashtable control = new Hashtable(); - Hashtable shift_control = new Hashtable(); - Hashtable alt = new Hashtable(); - - states[(uint) 0] = normal; - states[(uint) 1] = shift; - states[(uint) 4] = control; - states[(uint) 5] = shift_control; - states[(uint) 8] = alt; - - normal[Gdk.Key.Left] = new CaretLeft(); - shift[Gdk.Key.Left] = new ShiftCaretLeft(); - - control[Gdk.Key.Left] = new WordLeft(); - shift_control[Gdk.Key.Left] = new ShiftWordLeft(); - normal[Gdk.Key.Right] = new CaretRight(); - shift[Gdk.Key.Right] = new ShiftCaretRight(); - control[Gdk.Key.Right] = new WordRight(); - shift_control[Gdk.Key.Right] = new ShiftWordRight(); - normal[Gdk.Key.Up] = new CaretUp(); - shift[Gdk.Key.Up] = new ShiftCaretUp(); - control[Gdk.Key.Up] = new ScrollLineUp(); - normal[Gdk.Key.Down] = new CaretDown(); - shift[Gdk.Key.Down] = new ShiftCaretDown(); - control[Gdk.Key.Down] = new ScrollLineDown(); - - normal[Gdk.Key.Insert] = new ToggleEditMode(); - control[Gdk.Key.Insert] = new Copy(); - shift[Gdk.Key.Insert] = new Paste(); - normal[Gdk.Key.Delete] = new Delete(); - shift[Gdk.Key.Delete] = new Cut(); - normal[Gdk.Key.Home] = new Home(); - shift[Gdk.Key.Home] = new ShiftHome(); - control[Gdk.Key.Home] = new MoveToStart(); - shift_control[Gdk.Key.Home] = new ShiftMoveToStart(); - normal[Gdk.Key.End] = new End(); - shift[Gdk.Key.End] = new ShiftEnd(); - control[Gdk.Key.End] = new MoveToEnd(); - shift_control[Gdk.Key.End] = new ShiftMoveToEnd(); - normal[Gdk.Key.Page_Up] = new MovePageUp(); - shift[Gdk.Key.Page_Up] = new ShiftMovePageUp(); - normal[Gdk.Key.Page_Down] = new MovePageDown(); - shift[Gdk.Key.Page_Down] = new ShiftMovePageDown(); - normal[Gdk.Key.Return] = new Return(); - - normal[Gdk.Key.Tab] = new Tab(); - shift[Gdk.Key.Tab] = new ShiftTab(); - normal[Gdk.Key.BackSpace] = new Backspace(); - shift[Gdk.Key.BackSpace] = new Backspace(); - - control[Gdk.Key.x] = new Cut();; - control[Gdk.Key.c] = new Copy(); - control[Gdk.Key.v] = new Paste(); - - control[Gdk.Key.a] = new SelectWholeDocument(); - normal[Gdk.Key.Escape] = new ClearAllSelections(); - control[Gdk.Key.KP_Divide] = new ToggleComment(); - control[Gdk.Key.question] = new ToggleComment(); - - //editactions[Gdk.Key.Back | Gdk.Key.Alt] = new Actions.Undo(); - control[Gdk.Key.z] = new Actions.Undo(); - control[Gdk.Key.y] = new Redo(); - - control[Gdk.Key.Delete] = new DeleteWord(); - control[Gdk.Key.BackSpace] = new WordBackspace(); - control[Gdk.Key.d] = new DeleteLine(); - shift_control[Gdk.Key.d] = new DeleteToLineEnd(); - - control[Gdk.Key.B] = new GotoMatchingBrace(); - } - - /// <remarks> - /// Call this method before a long update operation this - /// 'locks' the text area so that no screen update occurs. - /// </remarks> - public virtual void BeginUpdate() - { - ++updateLevel; - } - - /// <remarks> - /// Call this method to 'unlock' the text area. After this call - /// screen update can occur. But no automatical refresh occurs you - /// have to commit the updates in the queue. - /// </remarks> - public virtual void EndUpdate() - { - Debug.Assert(updateLevel > 0); - updateLevel = Math.Max(0, updateLevel - 1); - } - - public void LoadFile(string fileName) - { - LoadFile(fileName, true); - } - /// <remarks> - /// Loads a file given by fileName - /// </remarks> - public void LoadFile(string fileName, bool autoLoadHighlighting) - { - BeginUpdate(); - document.TextContent = String.Empty; - document.UndoStack.ClearAll(); - document.BookmarkManager.Clear(); - if (autoLoadHighlighting) { - document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategyForFile(fileName); - } - - StreamReader stream; - if (Encoding != null) { - stream = new StreamReader(fileName, Encoding); - } else { - stream = new StreamReader(fileName); - } - Document.TextContent = stream.ReadToEnd(); - stream.Close(); - - this.FileName = fileName; - OptionsChanged(); - Document.UpdateQueue.Clear(); - EndUpdate(); - - Refresh(); - } - - /// <remarks> - /// Saves a file given by fileName - /// </remarks> - public void SaveFile(string fileName) - { - if (document.TextEditorProperties.CreateBackupCopy) { - MakeBackupCopy(fileName); - } - - StreamWriter stream; - if (Encoding != null && Encoding.CodePage != 65001) { - stream = new StreamWriter(fileName, false, Encoding); - } else { - stream = new StreamWriter(fileName, false); - } - - foreach (LineSegment line in Document.LineSegmentCollection) { - stream.Write(Document.GetText(line.Offset, line.Length)); - stream.Write(document.TextEditorProperties.LineTerminator); - } - - stream.Close(); - - this.FileName = fileName; - } - - void MakeBackupCopy(string fileName) - { - try { - if (File.Exists(fileName)) { - string backupName = fileName + ".bak"; - if (File.Exists(backupName)) { - File.Delete(backupName); - } - File.Copy(fileName, backupName); - } - } catch (Exception) { - //IMessageService messageService = (IMessageService) ServiceManager.Services.GetService (typeof (IMessageService)); - //messageService.ShowError (e, "Can not create backup copy of " + fileName); - } - } - - public abstract void OptionsChanged(); - - /// <remarks> - /// Overwritten refresh method that locks if the control is in - /// an update cycle. - /// </remarks> - public void Refresh() - { - if (IsUpdating) { - return; - } - - this.QueueDraw (); - } - - protected virtual void OnFileNameChanged(EventArgs e) - { - if (FileNameChanged != null) { - FileNameChanged(this, e); - } - } - - protected virtual void OnChanged(EventArgs e) - { - if (Changed != null) { - Changed(this, e); - } - } - - public event EventHandler FileNameChanged; - public event EventHandler Changed; - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Gui/TextView.cs b/main/Unused/ICSharpCode.TextEditor/src/Gui/TextView.cs deleted file mode 100644 index 21dad5b04a..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Gui/TextView.cs +++ /dev/null @@ -1,607 +0,0 @@ -// <file> -// <copyright see="prj:///doc/copyright.txt"/> -// <license see="prj:///doc/license.txt"/> -// <owner name="Mike Krüger" email="mike@icsharpcode.net"/> -// <version value="$version"/> -// </file> - -using System; -using System.Collections; -using System.IO; -using System.Drawing; -using System.Diagnostics; -using System.Text; - -using MonoDevelop.TextEditor.Document; - -using Gdk; -using Pango; - -namespace MonoDevelop.TextEditor -{ - /// <summary> - /// This class paints the textarea. - /// </summary> - public class TextView : AbstractMargin - { - int fontHeight; - Hashtable charWidth = new Hashtable(); - Highlight highlight; - - Layout _layout; // Avoid building new layouts all the time - - public Highlight Highlight { - get { - return highlight; - } - set { - highlight = value; - } - } - - /* - public Cursor Cursor { - get { - return Cursors.IBeam; - } - } - */ - - public int FirstVisibleLine { - get { - return textArea.VirtualTop.Y / fontHeight; - } - set { - if (FirstVisibleLine != value) { - textArea.VirtualTop = new System.Drawing.Point(textArea.VirtualTop.X, value * fontHeight); - } - } - } - - public int VisibleLineDrawingRemainder { - get { - return textArea.VirtualTop.Y % fontHeight; - } - } - - public int FontHeight { - get { - return fontHeight; - } - } - - public int VisibleLineCount { - get { - return 1 + DrawingPosition.Height / fontHeight; - } - } - - public int VisibleColumnCount { - get { - return (int)(DrawingPosition.Width / GetWidth(' ')) - 1; - } - } - - public TextView(TextArea textArea) : base(textArea) - { - _layout = new Layout(textArea.PangoContext); - OptionsChanged(); - } - - public void OptionsChanged() - { - this.fontHeight = (int) Math.Ceiling(GetHeight(TextEditorProperties.Font)); - this.charWidth = new Hashtable(); - } - -#region Paint functions - public override void Paint(Gdk.Drawable g, System.Drawing.Rectangle rect) - { - using (Gdk.GC backgroundGC = new Gdk.GC(g)) { - using (Gdk.GC gc = new Gdk.GC(g)) { - - int horizontalDelta = (int)(textArea.VirtualTop.X * GetWidth(g, ' ')); - if (horizontalDelta > 0) { - Gdk.Rectangle r = new Gdk.Rectangle(this.DrawingPosition.X, this.DrawingPosition.Y, this.DrawingPosition.Width, this.DrawingPosition.Height); - gc.ClipRectangle = r; - backgroundGC.ClipRectangle = r; - } - - for (int y = 0; y < (DrawingPosition.Height + VisibleLineDrawingRemainder) / fontHeight + 1; ++y) { - System.Drawing.Rectangle lineRectangle = new System.Drawing.Rectangle(DrawingPosition.X - horizontalDelta, - DrawingPosition.Top + y * fontHeight - VisibleLineDrawingRemainder, - DrawingPosition.Width + horizontalDelta, - fontHeight); - if (rect.IntersectsWith(lineRectangle)) { - int currentLine = FirstVisibleLine + y; - PaintDocumentLine(g, gc, backgroundGC, currentLine, lineRectangle); - } - } - }} // using - } - - void PaintDocumentLine(Gdk.Drawable g, Gdk.GC gc, Gdk.GC backgroundGC, int lineNumber, System.Drawing.Rectangle lineRectangle) - { - HighlightBackground background = (HighlightBackground)textArea.Document.HighlightingStrategy.GetColorFor("DefaultColor"); - //Brush backgroundBrush = textArea.Sensitive ? new SolidBrush(background.BackgroundColor) : SystemBrushes.InactiveBorder; - - if (textArea.Sensitive) { - backgroundGC.RgbFgColor = new Gdk.Color(background.BackgroundColor); - } else { - Gdk.Color grey = new Gdk.Color (); - Gdk.Color.Parse ("grey", ref grey); - backgroundGC.RgbFgColor = grey; - } - - if (lineNumber >= textArea.Document.TotalNumberOfLines) { - g.DrawRectangle(backgroundGC, true, lineRectangle); - if (TextEditorProperties.ShowInvalidLines) { - DrawInvalidLineMarker(g, lineRectangle.Left, lineRectangle.Top); - } - if (TextEditorProperties.ShowVerticalRuler) { - DrawVerticalRuler(g, lineRectangle); - } - return; - } - HighlightColor selectionColor = textArea.Document.HighlightingStrategy.GetColorFor("Selection"); - ColumnRange selectionRange = textArea.SelectionManager.GetSelectionAtLine(lineNumber); - HighlightColor defaultColor = textArea.Document.HighlightingStrategy.GetColorFor("DefaultColor"); - HighlightColor tabMarkerColor = textArea.Document.HighlightingStrategy.GetColorFor("TabMarker"); - HighlightColor spaceMarkerColor = textArea.Document.HighlightingStrategy.GetColorFor("SpaceMarker"); - - float spaceWidth = GetWidth(g, ' '); - - int logicalColumn = 0; - int physicalColumn = 0; - - float physicalXPos = lineRectangle.X; - LineSegment currentLine = textArea.Document.GetLineSegment(lineNumber); - - if (currentLine.Words != null) { - for (int i = 0; i <= currentLine.Words.Count + 1; ++i) { - // needed to draw fold markers beyond the logical end of line - if (i >= currentLine.Words.Count) { - ++logicalColumn; - continue; - } - - TextWord currentWord = ((TextWord)currentLine.Words[i]); - switch (currentWord.Type) { - case TextWordType.Space: - if (ColumnRange.WholeColumn.Equals(selectionRange) || logicalColumn >= selectionRange.StartColumn && logicalColumn <= selectionRange.EndColumn - 1) { - gc.RgbFgColor = new Gdk.Color(selectionColor.BackgroundColor); - //gc.RgbBgColor = new Gdk.Color(selectionColor.BackgroundColor); - g.DrawRectangle(gc, true, new Gdk.Rectangle((int) Math.Round(physicalXPos), lineRectangle.Y, (int) Math.Round(spaceWidth), lineRectangle.Height)); - } else { - g.DrawRectangle(backgroundGC, true, - new Gdk.Rectangle((int) Math.Round(physicalXPos), lineRectangle.Y, (int) Math.Round(spaceWidth), lineRectangle.Height)); - } - if (TextEditorProperties.ShowSpaces) { - DrawSpaceMarker(g, spaceMarkerColor.Color, physicalXPos, lineRectangle.Y); - } - - physicalXPos += spaceWidth; - - ++logicalColumn; - ++physicalColumn; - break; - - case TextWordType.Tab: - int oldPhysicalColumn = physicalColumn; - physicalColumn += TextEditorProperties.TabIndent; - physicalColumn = (physicalColumn / TextEditorProperties.TabIndent) * TextEditorProperties.TabIndent; - - float tabWidth = (physicalColumn - oldPhysicalColumn) * spaceWidth; - - if (ColumnRange.WholeColumn.Equals(selectionRange) || logicalColumn >= selectionRange.StartColumn && logicalColumn <= selectionRange.EndColumn - 1) { - gc.RgbBgColor = new Gdk.Color(selectionColor.Color); - gc.RgbFgColor = new Gdk.Color(selectionColor.BackgroundColor); - - g.DrawRectangle(gc, true, - new Gdk.Rectangle((int) Math.Round(physicalXPos), lineRectangle.Y, (int) Math.Round(tabWidth), lineRectangle.Height)); - } else { - g.DrawRectangle(backgroundGC, true, - new Gdk.Rectangle((int) Math.Round(physicalXPos), lineRectangle.Y, (int) Math.Round(tabWidth), lineRectangle.Height)); - } - if (TextEditorProperties.ShowTabs) { - DrawTabMarker(g, tabMarkerColor.Color, physicalXPos, lineRectangle.Y); - } - - physicalXPos += tabWidth; - - ++logicalColumn; - break; - - case TextWordType.Word: - string word = currentWord.Word; - float lastPos = physicalXPos; - - if (ColumnRange.WholeColumn.Equals(selectionRange) || selectionRange.EndColumn - 1 >= word.Length + logicalColumn && - selectionRange.StartColumn <= logicalColumn) { - gc.RgbFgColor = new Gdk.Color(selectionColor.BackgroundColor); - //gc.RgbBgColor = new Gdk.Color(selectionColor.BackgroundColor); - - physicalXPos += DrawDocumentWord(g, word, new PointF(physicalXPos, lineRectangle.Y), currentWord.Font, selectionColor.HasForgeground ? selectionColor.Color : currentWord.Color, gc); - } else { - if (ColumnRange.NoColumn.Equals(selectionRange) /* || selectionRange.StartColumn > logicalColumn + word.Length || selectionRange.EndColumn - 1 <= logicalColumn */) { - physicalXPos += DrawDocumentWord(g, word, new PointF(physicalXPos, lineRectangle.Y), currentWord.Font, currentWord.Color, backgroundGC); - } else { - int offset1 = Math.Min(word.Length, Math.Max(0, selectionRange.StartColumn - logicalColumn )); - int offset2 = Math.Max(offset1, Math.Min(word.Length, selectionRange.EndColumn - logicalColumn)); - - string word1 = word.Substring(0, offset1); - string word2 = word.Substring(offset1, offset2 - offset1); - string word3 = word.Substring(offset2); - - physicalXPos += DrawDocumentWord(g, - word1, - new PointF(physicalXPos, lineRectangle.Y), - currentWord.Font, - currentWord.Color, - backgroundGC); - gc.RgbFgColor = new Gdk.Color(selectionColor.Color); - gc.RgbFgColor = new Gdk.Color(selectionColor.BackgroundColor); - //gc.RgbBgColor = new Gdk.Color(selectionColor.BackgroundColor); - - physicalXPos += DrawDocumentWord(g, - word2, - new PointF(physicalXPos, lineRectangle.Y), - currentWord.Font, - selectionColor.HasForgeground ? selectionColor.Color : currentWord.Color, - gc); - - physicalXPos += DrawDocumentWord(g, - word3, - new PointF(physicalXPos, lineRectangle.Y), - currentWord.Font, - currentWord.Color, - backgroundGC); - } - } - - // draw bracket highlight - if (highlight != null) { - if (highlight.OpenBrace.Y == lineNumber && highlight.OpenBrace.X == logicalColumn || - highlight.CloseBrace.Y == lineNumber && highlight.CloseBrace.X == logicalColumn) { - DrawBracketHighlight(g, new System.Drawing.Rectangle((int)lastPos, lineRectangle.Y, (int)(physicalXPos - lastPos) - 1, lineRectangle.Height - 1)); - } - } - physicalColumn += word.Length; - logicalColumn += word.Length; - break; - } - } - } - - bool selectionBeyondEOL = selectionRange.EndColumn > currentLine.Length || ColumnRange.WholeColumn.Equals(selectionRange); - - - if (TextEditorProperties.ShowEOLMarker) { - HighlightColor eolMarkerColor = textArea.Document.HighlightingStrategy.GetColorFor("EolMarker"); - // selectionBeyondEOL ? selectionColor.Color: eolMarkerColor.Color - //physicalXPos += DrawEOLMarker(g, eolMarkerColor.Color, selectionBeyondEOL ? new SolidBrush(selectionColor.BackgroundColor) : backgroundBrush, physicalXPos, lineRectangle.Y); - physicalXPos += DrawEOLMarker(g, eolMarkerColor.Color, backgroundGC, physicalXPos, lineRectangle.Y); // FIXME beyond EOL color - } else { - if (selectionBeyondEOL && !TextEditorProperties.AllowCaretBeyondEOL) { - gc.RgbFgColor = new Gdk.Color(selectionColor.BackgroundColor); - gc.RgbBgColor = new Gdk.Color(selectionColor.Color); - g.DrawRectangle(gc, true, - new Gdk.Rectangle((int) Math.Round(physicalXPos), lineRectangle.Y, (int) Math.Round(spaceWidth), lineRectangle.Height)); - - physicalXPos += spaceWidth; - } - } - - if (selectionBeyondEOL && TextEditorProperties.AllowCaretBeyondEOL) { -// gc.RgbBgColor = new Gdk.Color(selectionColor.BackgroundColor); - } - - g.DrawRectangle(backgroundGC, true, - new Gdk.Rectangle((int) Math.Round(physicalXPos), lineRectangle.Y, (int) Math.Round(lineRectangle.Width - physicalXPos + lineRectangle.X), lineRectangle.Height)); - - if (TextArea.Caret.Line == lineNumber) { - DrawCaret(g, gc, new PointF(GetDrawingXPos(TextArea.Caret.Line, TextArea.Caret.Column) + lineRectangle.X, lineRectangle.Y)); - } - - if (TextEditorProperties.ShowVerticalRuler) { - DrawVerticalRuler(g, lineRectangle); - } - } - - // FIXME: draw the whole line using Pango - float DrawDocumentWord(Gdk.Drawable g, string word, PointF position, Pango.FontDescription font, System.Drawing.Color foreColor, Gdk.GC gc) - { - if (word == null || word.Length == 0) { - return 0f; - } - float wordWidth = MeasureString(font, word); - g.DrawRectangle(gc, true, new Gdk.Rectangle((int) Math.Abs(position.X), (int) position.Y, (int) Math.Abs(wordWidth), (int) Math.Abs(FontHeight))); - using (Gdk.GC tgc = new Gdk.GC(g)) { - tgc.Copy(gc); - tgc.RgbFgColor = new Gdk.Color(foreColor); - return DrawString(g, tgc, position.X, position.Y, word); - } - } - void DrawCaret(Gdk.Drawable g, Gdk.GC gc, PointF point) { - TextArea.Caret.PhysicalPosition = new Gdk.Point((int)point.X, (int)point.Y); - TextArea.Caret.Paint(g, gc); - //g.DrawLine(gc, (int)point.X, (int)point.Y, (int)point.X, (int)(point.Y + fontHeight)); - } - -#endregion - -#region Conversion Functions - private float GetHeight(Pango.FontDescription font) { - Pango.Layout ly = _layout; - ly.FontDescription = font; - ly.SetText("Wwgq|$%?*_-"); - return ly.Size.Height/1024.0f; - } - - public float GetWidth(char ch) - { - return GetWidth(TextArea.GdkWindow, ch); - } - - public float GetWidth(Gdk.Drawable g, char ch) - { - if (ch == ' ') { - return GetWidth(g, 'w'); // Hack! FIXME PEDRO - } - object width = charWidth[ch]; - if (width == null) { - Pango.Layout ly = _layout; - ly.SetText(ch.ToString()); - - charWidth[ch] = (float) (ly.Size.Width/1024.0f - 1); // Hack! I don't know why it works substracting 1. FIXME PEDRO - return (float)charWidth[ch]; - } - return (float)width; - } - - public int GetVisualColumn(int logicalLine, int logicalColumn) - { - return GetVisualColumn(Document.GetLineSegment(logicalLine), logicalColumn); - } - public int GetVisualColumn(LineSegment line, int logicalColumn) - { - int tabIndent = Document.TextEditorProperties.TabIndent; - int column = 0; - for (int i = 0; i < logicalColumn; ++i) { - char ch; - if (i >= line.Length) { - ch = ' '; - } else { - ch = Document.GetCharAt(line.Offset + i); - } - - switch (ch) { - case '\t': - int oldColumn = column; - column += tabIndent; - column = (column / tabIndent) * tabIndent; - break; - default: - ++column; - break; - } - } - return column; - } - - /// <summary> - /// returns line/column for a visual point position - /// </summary> - public System.Drawing.Point GetLogicalPosition(int xPos, int yPos) - { - xPos -= DrawingPosition.X; - yPos -= DrawingPosition.Y; - int clickedVisualLine = (yPos + this.textArea.VirtualTop.Y) / fontHeight; - int logicalLine = clickedVisualLine; // todo : folding - - return new System.Drawing.Point(GetLogicalColumn(logicalLine < Document.TotalNumberOfLines ? Document.GetLineSegment(logicalLine) : null, xPos), - logicalLine); - } - - int GetLogicalColumn(LineSegment line, int xPos) - { - int currentColumn = 0; - int realColumn = 0; - float spaceWidth = GetWidth(' '); - float physicalXPos = 0; - int tabIndent = Document.TextEditorProperties.TabIndent; - LineSegment currentLine = line; - - if (currentLine == null || currentLine.Words == null) { - return 0; - } - for (int i = 0; i < currentLine.Words.Count && xPos + spaceWidth/2 > physicalXPos; ++i) { - TextWord currentWord = ((TextWord)currentLine.Words[i]); - switch (currentWord.Type) { - case TextWordType.Space: - physicalXPos += spaceWidth; - currentColumn++; - realColumn++; - break; - - case TextWordType.Tab: - int ind = realColumn % tabIndent; - int hop = tabIndent - ind; - physicalXPos += hop * spaceWidth; - currentColumn++; - realColumn += hop; - break; - - case TextWordType.Word: - string word = currentWord.Word; - - if (physicalXPos + MeasureString(FontContainer.DefaultFont, word) > xPos + spaceWidth/2) { - do { - word = word.Substring(0, word.Length - 1); - } while (physicalXPos + MeasureString(FontContainer.DefaultFont, word) > xPos + spaceWidth/2); - return currentColumn + word.Length; - } - physicalXPos += MeasureString(FontContainer.DefaultFont, word); - currentColumn += word.Length; - realColumn += word.Length; - break; - } - } - return currentColumn; // FIXME!!! -// return (int)(physicalXPos - textArea.VirtualTop.X * spaceWidth); - } - - public int GetDrawingXPos(int logicalLine, int logicalColumn) - { - return GetDrawingXPos(Document.GetLineSegment(logicalLine), logicalColumn); - } - - public int GetDrawingXPos(LineSegment line, int logicalColumn) - { - int currentColumn = 0; - int realColumn = 0; - float physicalXPos = 0; - float spaceWidth = GetWidth(' '); - int tabIndent = Document.TextEditorProperties.TabIndent; - LineSegment currentLine = line; - if (currentLine.Words == null) { - return (int)(physicalXPos - textArea.VirtualTop.X * spaceWidth); - } - for (int i = 0; i < currentLine.Words.Count && currentColumn < logicalColumn; ++i) { - TextWord currentWord = ((TextWord)currentLine.Words[i]); - switch (currentWord.Type) { - case TextWordType.Space: - physicalXPos += spaceWidth; - currentColumn++; - realColumn++; - break; - - case TextWordType.Tab: - int ind = realColumn % tabIndent; - int hop = tabIndent - ind; - physicalXPos += hop * spaceWidth; - currentColumn++; - realColumn += hop; - break; - - case TextWordType.Word: - string word = currentWord.Word; - if (currentColumn + word.Length > logicalColumn) { - word = word.Substring(0, logicalColumn - currentColumn); - } - float lastPos = physicalXPos; - - physicalXPos += MeasureString(FontContainer.DefaultFont, word); - currentColumn += word.Length; - realColumn += word.Length; - break; - } - } - return (int)(physicalXPos /*- textArea.VirtualTop.X * spaceWidth*/); - } -#endregion - -#region DrawHelper functions - void DrawBracketHighlight(Gdk.Drawable g, System.Drawing.Rectangle rect) - { - using (Gdk.GC gc = new Gdk.GC(g)) { - gc.RgbFgColor = new Gdk.Color(System.Drawing.Color.FromArgb(50, 0, 0, 255)); - g.DrawRectangle(gc, false, rect); - } - } - - float MeasureString(Pango.FontDescription font, string s) - { - //Pango.Layout ly = new Pango.Layout(TextArea.PangoContext); - Pango.Layout ly = _layout; - ly.SetText(s); - ly.FontDescription = font; - int size = (int)Math.Round(ly.Size.Width/1024.0f); - return size; - } - - float DrawString(Gdk.Drawable g, Gdk.GC gc, float x, float y, string s) - { - return DrawString(g, gc, FontContainer.DefaultFont, x, y, s); - } - - float DrawString(Gdk.Drawable g, Gdk.GC gc, Pango.FontDescription font, float x, float y, string s) - { - Pango.Layout ly = _layout; - ly.FontDescription = font; - ly.SetText(s); - g.DrawLayout(gc, (int) Math.Round(x), (int) Math.Round(y), ly); - int size = (int)Math.Round(ly.Size.Width/1024.0f); - return size; - } - - void DrawInvalidLineMarker(Gdk.Drawable g, float x, float y) - { - HighlightColor invalidLinesColor = textArea.Document.HighlightingStrategy.GetColorFor("InvalidLines"); - //g.DrawString("~", invalidLinesColor.Font, new SolidBrush(invalidLinesColor.Color), x, y, measureStringFormat); - using (Gdk.GC gc = new Gdk.GC(g)) { - gc.RgbFgColor = new Gdk.Color(invalidLinesColor.Color); - DrawString(g, gc, x, y, "~"); - } - } - - void DrawSpaceMarker(Gdk.Drawable g, System.Drawing.Color color, float x, float y) - { - HighlightColor spaceMarkerColor = textArea.Document.HighlightingStrategy.GetColorFor("SpaceMarker"); - //g.DrawString("\u00B7", spaceMarkerColor.Font, new SolidBrush(color), x, y, measureStringFormat); - using (Gdk.GC gc = new Gdk.GC(g)) { - gc.RgbFgColor = new Gdk.Color(spaceMarkerColor.Color); - //DrawString(g, gc, x, y, "\u00B7"); - DrawString(g, gc, x, y, " "); - } - - } - - void DrawTabMarker(Gdk.Drawable g, System.Drawing.Color color, float x, float y) - { - HighlightColor tabMarkerColor = textArea.Document.HighlightingStrategy.GetColorFor("TabMarker"); - //g.DrawString("\u00BB", tabMarkerColor.Font, new SolidBrush(color), x, y, measureStringFormat); - using (Gdk.GC gc = new Gdk.GC(g)) { - gc.RgbFgColor = new Gdk.Color(tabMarkerColor.Color); - //DrawString(g, gc, x, y, "\u00BB"); - DrawString(g, gc, x, y, ">"); - } - } - - float DrawEOLMarker(Gdk.Drawable g, System.Drawing.Color color, Gdk.GC gc, float x, float y) - { - //string EOLMarker = "\u00B6"; - string EOLMarker = "|"; - float width = MeasureString(FontContainer.DefaultFont, EOLMarker); - g.DrawRectangle(gc, true, - new Gdk.Rectangle((int)Math.Round(x), (int) Math.Round(y), (int) Math.Round(width), fontHeight)); - HighlightColor eolMarkerColor = textArea.Document.HighlightingStrategy.GetColorFor("EolMarker"); - //g.DrawString("\u00B6", eolMarkerColor.Font, new SolidBrush(color), x, y, measureStringFormat); - using (Gdk.GC tgc = new Gdk.GC(g)) { - tgc.Copy(gc); - tgc.RgbFgColor = new Gdk.Color(eolMarkerColor.Color); - return DrawString(g, tgc, x, y, EOLMarker); - } - } - - void DrawVerticalRuler(Gdk.Drawable g, System.Drawing.Rectangle lineRectangle) - { - if (TextEditorProperties.VerticalRulerRow < textArea.VirtualTop.X) { - return; - } - HighlightColor vRulerColor = textArea.Document.HighlightingStrategy.GetColorFor("VRulerColor"); - int xpos = (int)MeasureString(FontContainer.DefaultFont, "12345678901234567890123456789012345678901234567890123456789012345678901234567890"); - //int xpos = (int)(drawingPosition.Left + GetWidth(g, ' ') * (TextEditorProperties.VerticalRulerRow - textArea.VirtualTop.X)); - using (Gdk.GC gc = new Gdk.GC(g)) { - gc.RgbFgColor = new Gdk.Color(vRulerColor.Color); - - g.DrawLine(gc, - xpos, - lineRectangle.Top, - xpos, - lineRectangle.Bottom); - } - } -#endregion - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Undo/IUndoableOperation.cs b/main/Unused/ICSharpCode.TextEditor/src/Undo/IUndoableOperation.cs deleted file mode 100644 index 0d0fe8c635..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Undo/IUndoableOperation.cs +++ /dev/null @@ -1,38 +0,0 @@ -// IUndoableOperation.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -namespace MonoDevelop.TextEditor.Undo -{ - /// <summary> - /// This Interface describes a the basic Undo/Redo operation - /// all Undo Operations must implement this interface. - /// </summary> - public interface IUndoableOperation - { - /// <summary> - /// Undo the last operation - /// </summary> - void Undo(); - - /// <summary> - /// Redo the last operation - /// </summary> - void Redo(); - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Undo/UndoQueue.cs b/main/Unused/ICSharpCode.TextEditor/src/Undo/UndoQueue.cs deleted file mode 100644 index b04b852460..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Undo/UndoQueue.cs +++ /dev/null @@ -1,65 +0,0 @@ -// UndoQueue.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Diagnostics; -using System.Collections; - -namespace MonoDevelop.TextEditor.Undo -{ - /// <summary> - /// This class stacks the last x operations from the undostack and makes - /// one undo/redo operation from it. - /// </summary> - public class UndoQueue : IUndoableOperation - { - ArrayList undolist = new ArrayList(); - - /// <summary> - /// </summary> - public UndoQueue(UndoStack stack, int numops) - { - if (stack == null) { - throw new ArgumentNullException("stack"); - } - - Debug.Assert(numops > 0 , "MonoDevelop.TextEditor.Undo.UndoQueue : numops should be > 0"); - - for (int i = 0; i < numops; ++i) { - if (stack._UndoStack.Count > 0) { - undolist.Add(stack._UndoStack.Pop()); - } - } - } - public void Undo() - { -// for (int i = 0; i < undolist.Count; ++i) { -// ((IUndoableOperation)undolist[i]).Undo(); -/ } - } - - public void Redo() - { - for (int i = undolist.Count - 1 ; i >= 0 ; --i) { - ((IUndoableOperation)undolist[i]).Redo(); - } - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Undo/UndoStack.cs b/main/Unused/ICSharpCode.TextEditor/src/Undo/UndoStack.cs deleted file mode 100644 index 168d34ee39..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Undo/UndoStack.cs +++ /dev/null @@ -1,159 +0,0 @@ -// UndoStack.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Diagnostics; -using System.Collections; - -namespace MonoDevelop.TextEditor.Undo -{ - /// <summary> - /// This class implements an undo stack - /// </summary> - public class UndoStack - { - Stack undostack = new Stack(); - Stack redostack = new Stack(); - - /// <summary> - /// </summary> - public event EventHandler ActionUndone; - /// <summary> - /// </summary> - public event EventHandler ActionRedone; - - /// <summary> - /// </summary> - public bool AcceptChanges = true; - - /// <summary> - /// This property is EXCLUSIVELY for the UndoQueue class, don't USE it - /// </summary> - internal Stack _UndoStack { - get { - return undostack; - } - } - - /// <summary> - /// </summary> - public bool CanUndo { - get { - return undostack.Count > 0; - } - } - - /// <summary> - /// </summary> - public bool CanRedo { - get { - return redostack.Count > 0; - } - } - - public int UndoCount { get { return undostack.Count; } } - - /// <summary> - /// You call this method to pool the last x operations from the undo stack - /// to make 1 operation from it. - /// </summary> - public void UndoLast(int x) - { - if (x > 0) - undostack.Push(new UndoQueue(this, x)); - } - - /// <summary> - /// Call this method to undo the last operation on the stack - /// </summary> - public void Undo() - { - if (undostack.Count > 0) { - IUndoableOperation uedit = (IUndoableOperation)undostack.Pop(); - redostack.Push(uedit); - uedit.Undo(); - OnActionUndone(); - } - } - - /// <summary> - /// Call this method to redo the last undone operation - /// </summary> - public void Redo() - { - if (redostack.Count > 0) { - IUndoableOperation uedit = (IUndoableOperation)redostack.Pop(); - undostack.Push(uedit); - uedit.Redo(); - OnActionRedone(); - } - } - - /// <summary> - /// Call this method to push an UndoableOperation on the undostack, the redostack - /// will be cleared, if you use this method. - /// </summary> - public void Push(IUndoableOperation operation) - { - if (operation == null) { - throw new ArgumentNullException("UndoStack.Push(UndoableOperation operation) : operation can't be null"); - } - - if (AcceptChanges) { - undostack.Push(operation); - ClearRedoStack(); - } - } - - /// <summary> - /// Call this method, if you want to clear the redo stack - /// </summary> - public void ClearRedoStack() - { - redostack.Clear(); - } - - /// <summary> - /// </summary> - public void ClearAll() - { - undostack.Clear(); - redostack.Clear(); - } - - /// <summary> - /// </summary> - protected void OnActionUndone() - { - if (ActionUndone != null) { - ActionUndone(null, null); - } - } - - /// <summary> - /// </summary> - protected void OnActionRedone() - { - if (ActionRedone != null) { - ActionRedone(null, null); - } - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Undo/UndoableDelete.cs b/main/Unused/ICSharpCode.TextEditor/src/Undo/UndoableDelete.cs deleted file mode 100644 index 827a821669..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Undo/UndoableDelete.cs +++ /dev/null @@ -1,88 +0,0 @@ -// UndoableDelete.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Diagnostics; -using System.Drawing; - -using MonoDevelop.TextEditor.Document; -using MonoDevelop.TextEditor.Undo; - -namespace MonoDevelop.TextEditor.Undo -{ - /// <summary> - /// This class is for the undo of Document insert operations - /// </summary> - public class UndoableDelete : IUndoableOperation - { - IDocument document; -// int oldCaretPos; - int offset; - string text; - - /// <summary> - /// Creates a new instance of <see cref="UndoableDelete"/> - /// </summary> - public UndoableDelete(IDocument document, int offset, string text) - { - if (document == null) { - throw new ArgumentNullException("document"); - } - if (offset < 0 || offset > document.TextLength) { - throw new ArgumentOutOfRangeException("offset"); - } - - Debug.Assert(text != null, "text can't be null"); -// oldCaretPos = document.Caret.Offset; - this.document = document; - this.offset = offset; - this.text = text; - } - - /// <remarks> - /// Undo last operation - /// </remarks> - public void Undo() - { - // we clear all selection direct, because the redraw - // is done per refresh at the end of the action -// textArea.SelectionManager.SelectionCollection.Clear(); - document.UndoStack.AcceptChanges = false; - document.Insert(offset, text); -// document.Caret.Offset = Math.Min(document.TextLength, Math.Max(0, oldCaretPos)); - document.UndoStack.AcceptChanges = true; - } - - /// <remarks> - /// Redo last undone operation - /// </remarks> - public void Redo() - { - // we clear all selection direct, because the redraw - // is done per refresh at the end of the action -// textArea.SelectionManager.SelectionCollection.Clear(); - - document.UndoStack.AcceptChanges = false; - document.Remove(offset, text.Length); -// document.Caret.Offset = Math.Min(document.TextLength, Math.Max(0, document.Caret.Offset)); - document.UndoStack.AcceptChanges = true; - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Undo/UndoableInsert.cs b/main/Unused/ICSharpCode.TextEditor/src/Undo/UndoableInsert.cs deleted file mode 100644 index 28e5ce9a2f..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Undo/UndoableInsert.cs +++ /dev/null @@ -1,89 +0,0 @@ -// UndoableInsert.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Diagnostics; -using System.Drawing; -using MonoDevelop.TextEditor.Document; -using MonoDevelop.TextEditor.Undo; - -namespace MonoDevelop.TextEditor.Undo -{ - /// <summary> - /// This class is for the undo of Document insert operations - /// </summary> - public class UndoableInsert : IUndoableOperation - { - IDocument document; -// int oldCaretPos; - int offset; - string text; - - /// <summary> - /// Creates a new instance of <see cref="UndoableInsert"/> - /// </summary> - public UndoableInsert(IDocument document, int offset, string text) - { - if (document == null) { - throw new ArgumentNullException("document"); - } - if (offset < 0 || offset > document.TextLength) { - throw new ArgumentOutOfRangeException("offset"); - } - - Debug.Assert(text != null, "text can't be null"); -// oldCaretPos = document.Caret.Offset; - this.document = document; - this.offset = offset; - this.text = text; - } - - /// <remarks> - /// Undo last operation - /// </remarks> - public void Undo() - { - // we clear all selection direct, because the redraw - // is done per refresh at the end of the action -// document.SelectionCollection.Clear(); - - document.UndoStack.AcceptChanges = false; - document.Remove(offset, text.Length); -// document.Caret.Offset = Math.Min(document.TextLength, Math.Max(0, oldCaretPos)); - document.UndoStack.AcceptChanges = true; - } - - /// <remarks> - /// Redo last undone operation - /// </remarks> - public void Redo() - { - // we clear all selection direct, because the redraw - // is done per refresh at the end of the action -// document.SelectionCollection.Clear(); - - document.UndoStack.AcceptChanges = false; - document.Insert(offset, text); -// document.Caret.Offset = Math.Min(document.TextLength, Math.Max(0, document.Caret.Offset)); - document.UndoStack.AcceptChanges = true; - } - } -} - diff --git a/main/Unused/ICSharpCode.TextEditor/src/Undo/UndoableReplace.cs b/main/Unused/ICSharpCode.TextEditor/src/Undo/UndoableReplace.cs deleted file mode 100644 index 24a76a465a..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Undo/UndoableReplace.cs +++ /dev/null @@ -1,90 +0,0 @@ -// UndoableReplace.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Diagnostics; -using System.Drawing; -using MonoDevelop.TextEditor.Document; -using MonoDevelop.TextEditor.Undo; - -namespace MonoDevelop.TextEditor.Undo -{ - /// <summary> - /// This class is for the undo of Document insert operations - /// </summary> - public class UndoableReplace : IUndoableOperation - { - IDocument document; -// int oldCaretPos; - int offset; - string text; - string origText; - - /// <summary> - /// Creates a new instance of <see cref="UndoableReplace"/> - /// </summary> - public UndoableReplace(IDocument document, int offset, string origText, string text) - { - if (document == null) { - throw new ArgumentNullException("document"); - } - if (offset < 0 || offset > document.TextLength) { - throw new ArgumentOutOfRangeException("offset"); - } - - Debug.Assert(text != null, "text can't be null"); -// oldCaretPos = document.Caret.Offset; - this.document = document; - this.offset = offset; - this.text = text; - this.origText = origText; - } - - /// <remarks> - /// Undo last operation - /// </remarks> - public void Undo() - { - // we clear all selection direct, because the redraw - // is done per refresh at the end of the action -// document.SelectionCollection.Clear(); - - document.UndoStack.AcceptChanges = false; - document.Replace(offset, text.Length, origText); -// document.Caret.Offset = Math.Min(document.TextLength, Math.Max(0, oldCaretPos)); - document.UndoStack.AcceptChanges = true; - } - - /// <remarks> - /// Redo last undone operation - /// </remarks> - public void Redo() - { - // we clear all selection direct, because the redraw - // is done per refresh at the end of the action -// document.SelectionCollection.Clear(); - - document.UndoStack.AcceptChanges = false; - document.Replace(offset, origText.Length, text); -// document.Caret.Offset = Math.Min(document.TextLength, Math.Max(0, document.Caret.Offset)); - document.UndoStack.AcceptChanges = true; - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Util/LookupTable.cs b/main/Unused/ICSharpCode.TextEditor/src/Util/LookupTable.cs deleted file mode 100644 index 71f28447f9..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Util/LookupTable.cs +++ /dev/null @@ -1,155 +0,0 @@ -// LookupTable.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.Drawing; -using MonoDevelop.TextEditor.Document; - -namespace MonoDevelop.TextEditor.Util -{ - /// <summary> - /// This class implements a keyword map. It implements a digital search trees (tries) to find - /// a word. - /// </summary> - public class LookupTable - { - Node root = new Node(null, null); - bool casesensitive; - int length; - - /// <value> - /// The number of elements in the table - /// </value> - public int Count { - get { - return length; - } - } - - /// <summary> - /// Get the object, which was inserted under the keyword (line, at offset, with length length), - /// returns null, if no such keyword was inserted. - /// </summary> - public object this[IDocument document, LineSegment line, int offset, int length] { - get { - if(length == 0) { - return null; - } - Node next = root; - - int wordOffset = line.Offset + offset; - if (casesensitive) { - for (int i = 0; i < length; ++i) { - int index = ((int)document.GetCharAt(wordOffset + i)) % 256; - next = next.leaf[index]; - - if (next == null) { - return null; - } - - if (next.color != null && TextUtility.RegionMatches(document, wordOffset, length, next.word)) { - return next.color; - } - } - } else { - for (int i = 0; i < length; ++i) { - int index = ((int)Char.ToUpper(document.GetCharAt(wordOffset + i))) % 256; - - next = next.leaf[index]; - - if (next == null) { - return null; - } - - if (next.color != null && TextUtility.RegionMatches(document, casesensitive, wordOffset, length, next.word)) { - return next.color; - } - } - } - return null; - } - } - - /// <summary> - /// Inserts an object in the tree, under keyword - /// </summary> - public object this[string keyword] { - set { - Node node = root; - Node next = root; - if (!casesensitive) { - keyword = keyword.ToUpper(); - } - ++length; - - // insert word into the tree - for (int i = 0; i < keyword.Length; ++i) { - int index = ((int)keyword[i]) % 256; // index of curchar - bool d = keyword[i] == '\\'; - - next = next.leaf[index]; // get node to this index - - if (next == null) { // no node created -> insert word here - node.leaf[index] = new Node(value, keyword); - break; - } - - if (next.word != null && next.word.Length != i) { // node there, take node content and insert them again - string tmpword = next.word; // this word will be inserted 1 level deeper (better, don't need too much - object tmpcolor = next.color; // string comparisons for finding.) - next.color = next.word = null; - this[tmpword] = tmpcolor; - } - - if (i == keyword.Length - 1) { // end of keyword reached, insert node there, if a node was here it was - next.word = keyword; // reinserted, if it has the same length (keyword EQUALS this word) it will be overwritten - next.color = value; - break; - } - - node = next; - } - } - } - - /// <summary> - /// Creates a new instance of <see cref="LookupTable"/> - /// </summary> - public LookupTable(bool casesensitive) - { - this.casesensitive = casesensitive; - } - - class Node - { - public Node(object color, string word) - { - this.word = word; - this.color = color; - } - - public string word; - public object color; - - public Node[] leaf = new Node[256]; - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Util/RtfWriter.cs b/main/Unused/ICSharpCode.TextEditor/src/Util/RtfWriter.cs deleted file mode 100644 index 044707b8e3..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Util/RtfWriter.cs +++ /dev/null @@ -1,181 +0,0 @@ -// RtfWriter.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Text; -using System.Collections; -using MonoDevelop.TextEditor.Document; - -namespace MonoDevelop.TextEditor.Util -{ - public class RtfWriter - { - static Hashtable colors; - static int colorNum; - static StringBuilder colorString; - - public static string GenerateRtf(TextArea textArea) - { - try { - colors = new Hashtable(); - colorNum = 0; - colorString = new StringBuilder(); - - - StringBuilder rtf = new StringBuilder(); - - rtf.Append(@"{\rtf1\ansi\ansicpg1252\deff0\deflang1031"); - BuildFontTable(textArea.Document, rtf); - rtf.Append('\n'); - - string fileContent = BuildFileContent(textArea); - BuildColorTable(textArea.Document, rtf); - rtf.Append('\n'); - rtf.Append(@"\viewkind4\uc1\pard"); - rtf.Append(fileContent); - rtf.Append("}"); - return rtf.ToString(); - } catch (Exception e) { - Console.WriteLine(e.ToString()); - } - return null; - } - - static void BuildColorTable(IDocument doc, StringBuilder rtf) - { - rtf.Append(@"{\colortbl ;"); - rtf.Append(colorString.ToString()); - rtf.Append("}"); - } - - static void BuildFontTable(IDocument doc, StringBuilder rtf) - { - rtf.Append(@"{\fonttbl"); - rtf.Append(@"{\f0\fmodern\fprq1\fcharset0 " + FontContainer.DefaultFont.Family + ";}"); - rtf.Append("}"); - } - - static string BuildFileContent(TextArea textArea) - { - StringBuilder rtf = new StringBuilder(); - bool firstLine = true; - Color curColor = Color.Black; - bool oldItalic = false; - bool oldBold = false; - bool escapeSequence = false; - - foreach (ISelection selection in textArea.SelectionManager.SelectionCollection) { - int selectionOffset = textArea.Document.PositionToOffset(selection.StartPosition); - int selectionEndOffset = textArea.Document.PositionToOffset(selection.EndPosition); - for (int i = selection.StartPosition.Y; i <= selection.EndPosition.Y; ++i) { - LineSegment line = textArea.Document.GetLineSegment(i); - int offset = line.Offset; - if (line.Words == null) { - continue; - } - - foreach (TextWord word in line.Words) { - switch (word.Type) { - case TextWordType.Space: - if (selection.ContainsOffset(offset)) { - rtf.Append(' '); - } - ++offset; - break; - - case TextWordType.Tab: - if (selection.ContainsOffset(offset)) { - rtf.Append(@"\tab"); - } - ++offset; - escapeSequence = true; - break; - - case TextWordType.Word: - Color c = word.Color; - - if (offset + word.Word.Length > selectionOffset && offset < selectionEndOffset) { - string colorstr = c.R + ", " + c.G + ", " + c.B; - - if (colors[colorstr] == null) { - colors[colorstr] = ++colorNum; - colorString.Append(@"\red" + c.R + @"\green" + c.G + @"\blue" + c.B + ";"); - } - if (c != curColor || firstLine) { - rtf.Append(@"\cf" + colors[colorstr].ToString()); - curColor = c; - escapeSequence = true; - } - -/* if (oldItalic != word.Font.Italic) { - if (word.Font.Italic) { - rtf.Append(@"\i"); - } else { - rtf.Append(@"\i0"); - } - oldItalic = word.Font.Italic; - escapeSequence = true; - //} - - if (oldBold != word.Font.Bold) { - if (word.Font.Bold) { - rtf.Append(@"\b"); - } else { - rtf.Append(@"\b0"); - } - oldBold = word.Font.Bold; - escapeSequence = true; - } -*/ - if (firstLine) { - rtf.Append(@"\f0\fs" + (FontContainer.DefaultFont.Size * 2)); - firstLine = false; - } - if (escapeSequence) { - rtf.Append(' '); - escapeSequence = false; - } - string printWord; - if (offset < selectionOffset) { - printWord = word.Word.Substring(selectionOffset - offset); - } else if (offset + word.Word.Length > selectionEndOffset) { - printWord = word.Word.Substring(0, (offset + word.Word.Length) - selectionEndOffset); - } else { - printWord = word.Word; - } - - rtf.Append(printWord.Replace("{", "\\{").Replace("}", "\\}")); - } - offset += word.Length; - break; - } - } - if (offset < selectionEndOffset) { - rtf.Append(@"\par"); - } - rtf.Append('\n'); - } - } - - return rtf.ToString(); - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Util/TextUtility.cs b/main/Unused/ICSharpCode.TextEditor/src/Util/TextUtility.cs deleted file mode 100644 index 64c14173ef..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Util/TextUtility.cs +++ /dev/null @@ -1,94 +0,0 @@ -// TextUtility.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; - -using MonoDevelop.TextEditor.Document; - -namespace MonoDevelop.TextEditor.Util -{ - public class TextUtility - { - - public static bool RegionMatches(IDocument document, int offset, int length, string word) - { - if (length != word.Length || document.TextLength < offset + length) { - return false; - } - - for (int i = 0; i < length; ++i) { - if (document.GetCharAt(offset + i) != word[i]) { - return false; - } - } - return true; - } - - public static bool RegionMatches(IDocument document, bool casesensitive, int offset, int length, string word) - { - if (casesensitive) { - return RegionMatches(document, offset, length, word); - } - - if (length != word.Length || document.TextLength < offset + length) { - return false; - } - - for (int i = 0; i < length; ++i) { - if (Char.ToUpper(document.GetCharAt(offset + i)) != Char.ToUpper(word[i])) { - return false; - } - } - return true; - } - - public static bool RegionMatches(IDocument document, int offset, int length, char[] word) - { - if (length != word.Length || document.TextLength < offset + length) { - return false; - } - - for (int i = 0; i < length; ++i) { - if (document.GetCharAt(offset + i) != word[i]) { - return false; - } - } - return true; - } - - public static bool RegionMatches(IDocument document, bool casesensitive, int offset, int length, char[] word) - { - if (casesensitive) { - return RegionMatches(document, offset, length, word); - } - - if (length != word.Length || document.TextLength < offset + length) { - return false; - } - - for (int i = 0; i < length; ++i) { - if (Char.ToUpper(document.GetCharAt(offset + i)) != Char.ToUpper(word[i])) { - return false; - } - } - return true; - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Util/TipPainter.cs b/main/Unused/ICSharpCode.TextEditor/src/Util/TipPainter.cs deleted file mode 100644 index e3d6752288..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Util/TipPainter.cs +++ /dev/null @@ -1,102 +0,0 @@ -// TipPainter.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 http://www.icsharpcode.net/ <#Develop> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System.Drawing; -using System.Drawing.Text; - -namespace MonoDevelop.TextEditor.Util -{ - sealed class TipPainter - { - const float HorizontalBorder = 2; - const float VerticalBorder = 1; - - //static StringFormat centerTipFormat = CreateTipStringFormat(); - - TipPainter() - { - - } - - public static void DrawTip(Gtk.Widget control, Graphics graphics, - Font font, string description) - { - DrawTip(control, graphics, new TipText (graphics, font, description)); - } - - public static void DrawTip(Gtk.Widget control, Graphics graphics, - TipSection tipData) - { - Size tipSize = Size.Empty; SizeF tipSizeF = SizeF.Empty; - -#if GTK - RectangleF workingArea = control.RootWindow.FrameExtents; - int x, y; - control.GetPointer (out x, out y); -#else - RectangleF workingArea = SystemInformation.WorkingArea; -#endif - - PointF screenLocation = new PointF (x, y); - - SizeF maxLayoutSize = new SizeF - (workingArea.Right - screenLocation.X - HorizontalBorder * 2, - workingArea.Bottom - screenLocation.Y - VerticalBorder * 2); - - if (maxLayoutSize.Width > 0 && maxLayoutSize.Height > 0) { - graphics.TextRenderingHint = - TextRenderingHint.AntiAliasGridFit; - - tipData.SetMaximumSize(maxLayoutSize); - tipSizeF = tipData.GetRequiredSize(); - tipData.SetAllocatedSize(tipSizeF); - - tipSizeF += new SizeF(HorizontalBorder * 2, - VerticalBorder * 2); - tipSize = Size.Ceiling(tipSizeF); - } - -#if GTK - if (control.RequestSize != tipSize) { - control.RequestSize = tipSize; - } -#else - if (control.ClientSize != tipSize) { - control.ClientSize = tipSize; - } -#endif - - if (tipSize != Size.Empty) { - Rectangle borderRectangle = new Rectangle - (Point.Empty, tipSize - new Size(1, 1)); - - RectangleF displayRectangle = new RectangleF - (HorizontalBorder, VerticalBorder, - tipSizeF.Width - HorizontalBorder * 2, - tipSizeF.Height - VerticalBorder * 2); - - // DrawRectangle draws from Left to Left + Width. A bug? :-/ - graphics.DrawRectangle(SystemPens.WindowFrame, - borderRectangle); - tipData.Draw(new PointF(HorizontalBorder, VerticalBorder)); - } - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Util/TipPainterTools.cs b/main/Unused/ICSharpCode.TextEditor/src/Util/TipPainterTools.cs deleted file mode 100644 index 38b0906286..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Util/TipPainterTools.cs +++ /dev/null @@ -1,105 +0,0 @@ -// TipPainterTools.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 http://www.icsharpcode.net/ <#Develop> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; - -namespace MonoDevelop.TextEditor.Util -{ - class TipPainterTools - { - const int SpacerSize = 4; - - private TipPainterTools() - { - - } - - public static void DrawHelpTipFromCombinedDescription(Gtk.Widget control, - Graphics graphics, - Font font, - string countMessage, - string description) - { - string basicDescription = null; - string documentation = null; - - if (IsVisibleText(description)) { - string[] splitDescription = description.Split - (new char[] { '\n' }, 2); - - if (splitDescription.Length > 0) { - basicDescription = splitDescription[0]; - - if (splitDescription.Length > 1) { - documentation = splitDescription[1].Trim(); - } - } - } - - DrawHelpTip(control, graphics, font, countMessage, - basicDescription, documentation); - } - - public static void DrawHelpTip(Gtk.Widget control, - Graphics graphics, Font font, - string countMessage, - string basicDescription, - string documentation) - { - if (IsVisibleText(countMessage) || - IsVisibleText(basicDescription) || - IsVisibleText(documentation)) { - // Create all the TipSection objects. - TipText countMessageTip = new TipText(graphics, font, - countMessage); - - TipSpacer countSpacer = new TipSpacer - (graphics, new SizeF(IsVisibleText(countMessage) ? 4 : 0, 0)); - - TipText descriptionTip = new TipText(graphics, font, - basicDescription); - - TipSpacer docSpacer = new TipSpacer - (graphics, new SizeF(0, IsVisibleText(documentation) ? 4 : 0)); - - TipText docTip = new TipText(graphics, font, documentation); - - // Now put them together. - TipSplitter descSplitter = new TipSplitter(graphics, false, - descriptionTip, - docSpacer, docTip); - - TipSplitter mainSplitter = new TipSplitter(graphics, true, - countMessageTip, - countSpacer, - descSplitter); - - // Show it. - TipPainter.DrawTip(control, graphics, mainSplitter); - } - } - - static bool IsVisibleText(string text) - { - return text != null && text.Length > 0; - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Util/TipSection.cs b/main/Unused/ICSharpCode.TextEditor/src/Util/TipSection.cs deleted file mode 100644 index 552cffe84d..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Util/TipSection.cs +++ /dev/null @@ -1,96 +0,0 @@ -// TipSection.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 http://www.icsharpcode.net/ <#Develop> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System.Diagnostics; -using System.Drawing; - -namespace MonoDevelop.TextEditor.Util -{ - abstract class TipSection - { - SizeF tipAllocatedSize; - Graphics tipGraphics; - SizeF tipMaxSize; - SizeF tipRequiredSize; - - public TipSection(Graphics graphics) - { - tipGraphics = graphics; - } - - public abstract void Draw(PointF location); - - public SizeF GetRequiredSize() - { - return tipRequiredSize; - } - - public void SetAllocatedSize(SizeF allocatedSize) - { - Debug.Assert(allocatedSize.Width >= tipRequiredSize.Width && - allocatedSize.Height >= tipRequiredSize.Height); - - tipAllocatedSize = allocatedSize; OnAllocatedSizeChanged(); - } - - public void SetMaximumSize(SizeF maximumSize) - { - tipMaxSize = maximumSize; OnMaximumSizeChanged(); - } - - protected virtual void OnAllocatedSizeChanged() - { - - } - - protected virtual void OnMaximumSizeChanged() - { - - } - - protected void SetRequiredSize(SizeF requiredSize) - { - Debug.Assert(requiredSize.Width >= 0 && - requiredSize.Width <= tipMaxSize.Width && - requiredSize.Height >= 0 && - requiredSize.Height <= tipMaxSize.Height); - - tipRequiredSize = requiredSize; - } - - protected Graphics Graphics { - get { - return tipGraphics; - } - } - - protected SizeF AllocatedSize { - get { - return tipAllocatedSize; - } - } - - protected SizeF MaximumSize { - get { - return tipMaxSize; - } - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Util/TipSpacer.cs b/main/Unused/ICSharpCode.TextEditor/src/Util/TipSpacer.cs deleted file mode 100644 index 380409be20..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Util/TipSpacer.cs +++ /dev/null @@ -1,49 +0,0 @@ -// TipSpacer.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 http://www.icsharpcode.net/ <#Develop> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; - -namespace MonoDevelop.TextEditor.Util -{ - class TipSpacer: TipSection - { - SizeF spacerSize; - - public TipSpacer(Graphics graphics, SizeF size): base(graphics) - { - spacerSize = size; - } - - public override void Draw(PointF location) - { - - } - - protected override void OnMaximumSizeChanged() - { - base.OnMaximumSizeChanged(); - - SetRequiredSize(new SizeF - (Math.Min(MaximumSize.Width, spacerSize.Width), - Math.Min(MaximumSize.Height, spacerSize.Height))); - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Util/TipSplitter.cs b/main/Unused/ICSharpCode.TextEditor/src/Util/TipSplitter.cs deleted file mode 100644 index a71b501f70..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Util/TipSplitter.cs +++ /dev/null @@ -1,115 +0,0 @@ -// TipSplitter.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 http://www.icsharpcode.net/ <#Develop> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Diagnostics; -using System.Drawing; - -namespace MonoDevelop.TextEditor.Util -{ - class TipSplitter: TipSection - { - bool isHorizontal; - float [] offsets; - TipSection[] tipSections; - - public TipSplitter(Graphics graphics, bool horizontal, - params TipSection[] sections): base(graphics) - { - Debug.Assert(sections != null); - - isHorizontal = horizontal; - offsets = new float[sections.Length]; - tipSections = (TipSection[])sections.Clone(); - } - - public override void Draw(PointF location) - { - if (isHorizontal) { - for (int i = 0; i < tipSections.Length; i ++) { - tipSections[i].Draw - (new PointF(location.X + offsets[i], location.Y)); - } - } else { - for (int i = 0; i < tipSections.Length; i ++) { - tipSections[i].Draw - (new PointF(location.X, location.Y + offsets[i])); - } - } - } - - protected override void OnMaximumSizeChanged() - { - base.OnMaximumSizeChanged(); - - float currentDim = 0; - float otherDim = 0; - SizeF availableArea = MaximumSize; - - for (int i = 0; i < tipSections.Length; i ++) { - TipSection section = (TipSection)tipSections[i]; - - section.SetMaximumSize(availableArea); - - SizeF requiredArea = section.GetRequiredSize(); - offsets[i] = currentDim; - - // It's best to start on pixel borders, so this will - // round up to the nearest pixel. Otherwise there are - // weird cutoff artifacts. - float pixelsUsed; - - if (isHorizontal) { - pixelsUsed = (float)Math.Ceiling(requiredArea.Width); - currentDim += pixelsUsed; - - availableArea.Width = Math.Max - (0, availableArea.Width - pixelsUsed); - - otherDim = Math.Max(otherDim, requiredArea.Height); - } else { - pixelsUsed = (float)Math.Ceiling(requiredArea.Height); - currentDim += pixelsUsed; - - availableArea.Height = Math.Max - (0, availableArea.Height - pixelsUsed); - - otherDim = Math.Max(otherDim, requiredArea.Width); - } - } - - foreach (TipSection section in tipSections) { - if (isHorizontal) { - section.SetAllocatedSize - (new SizeF(section.GetRequiredSize().Width, otherDim)); - } else { - section.SetAllocatedSize - (new SizeF(otherDim, section.GetRequiredSize().Height)); - } - } - - if (isHorizontal) { - SetRequiredSize(new SizeF(currentDim, otherDim)); - } else { - SetRequiredSize(new SizeF(otherDim, currentDim)); - } - } - } -} diff --git a/main/Unused/ICSharpCode.TextEditor/src/Util/TipText.cs b/main/Unused/ICSharpCode.TextEditor/src/Util/TipText.cs deleted file mode 100644 index a6a59bdc12..0000000000 --- a/main/Unused/ICSharpCode.TextEditor/src/Util/TipText.cs +++ /dev/null @@ -1,131 +0,0 @@ -// TipText.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 http://www.icsharpcode.net/ <#Develop> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System.Drawing; -using System.Drawing.Text; - -namespace MonoDevelop.TextEditor.Util -{ - class TipText: TipSection - { - StringAlignment horzAlign; - StringAlignment vertAlign; - Color tipColor; - Font tipFont; - StringFormat tipFormat; - string tipText; - - public TipText(Graphics graphics, Font font, string text): - base(graphics) - { - tipFont = font; tipText = text; - - Color = SystemColors.InfoText; - HorizontalAlignment = StringAlignment.Near; - VerticalAlignment = StringAlignment.Near; - } - - public override void Draw(PointF location) - { - if (IsTextVisible()) { - RectangleF drawRectangle = new RectangleF - (location, AllocatedSize); - - Graphics.DrawString(tipText, tipFont, - new SolidBrush(Color), - drawRectangle, - GetInternalStringFormat()); - } - } - - protected StringFormat GetInternalStringFormat() - { - if (tipFormat == null) { - tipFormat = CreateTipStringFormat(horzAlign, vertAlign); - } - - return tipFormat; - } - - protected override void OnMaximumSizeChanged() - { - base.OnMaximumSizeChanged(); - - if (IsTextVisible()) { - SizeF tipSize = Graphics.MeasureString - (tipText, tipFont, MaximumSize, - GetInternalStringFormat()); - - SetRequiredSize(tipSize); - } else { - SetRequiredSize(SizeF.Empty); - } - } - - static StringFormat CreateTipStringFormat - (StringAlignment horizontalAlignment, - StringAlignment verticalAlignment) - { - //StringFormat format = (StringFormat)StringFormat.GenericTypographic.Clone(); - StringFormat format = null; - //format.FormatFlags = StringFormatFlags.FitBlackBox; - // note: Align Near, Line Center seemed to do something before - - //format.Alignment = horizontalAlignment; - //format.LineAlignment = verticalAlignment; - - return format; - } - - bool IsTextVisible() - { - return tipText != null && tipText.Length > 0; - } - - public Color Color { - get { - return tipColor; - } - set { - tipColor = value; - } - } - - public StringAlignment HorizontalAlignment { - get { - return horzAlign; - } - set { - horzAlign = value; - tipFormat = null; - } - } - - public StringAlignment VerticalAlignment { - get { - return vertAlign; - } - set { - vertAlign = value; - tipFormat = null; - } - } - } -} diff --git a/main/Unused/MonoQuery/ChangeLog b/main/Unused/MonoQuery/ChangeLog deleted file mode 100644 index 5fdface57f..0000000000 --- a/main/Unused/MonoQuery/ChangeLog +++ /dev/null @@ -1,515 +0,0 @@ -2007-09-21 Lluis Sanchez Gual <lluis@novell.com> - - * MonoQuery/MonoQuery.addin.xml: Bump MD version. - -2007-09-04 Michael Hutchinson <MHutchinson@novell.com> - - * Mono.Data.Sql/Providers/SqlDbProvider.cs, - Mono.Data.Sql/Providers/SqliteDbProvider.cs, - Mono.Data.Sql/Providers/NpgsqlDbProvider.cs, - Mono.Data.Sql/Providers/MySqlDbProvider.cs, - Mono.Data.Sql/Providers/OracleDbProvider.cs, - Mono.Data.Sql/Providers/SybaseDbProvider.cs, - MonoQuery/MonoQueryService.cs: Fix some compile warnings. - * Mono.Data.Sql/Mono.Data.Sql.mdp: Add optional providers to project, but - build using autotools in order to compile only the valid/detected ones. - -2007-08-09 Lluis Sanchez Gual <lluis@novell.com> - - * MonoQuery/MonoQuery.addin.xml: Removed the CommandService class. - Everything is done directly with CommandManager. Moved all extension - node types to MD.Components. - -2007-08-09 Lluis Sanchez Gual <lluis@novell.com> - - * Mono.Data.Sql/Mono.Data.Sql.mdp, MonoQuery/Makefile.am, - MonoQuery/MonoQuery.addin.xml, MonoQuery/MonoQuery.mdp: Reorganized the - extension point hierarchy. Embedded all add-in manifests as resources. - -2007-08-02 Lluis Sanchez Gual <lluis@novell.com> - - * MonoQuery/Gui/NodeBuilders/DatabaseNodeBuilder.cs, - MonoQuery/Gui/NodeBuilders/TablesNodeBuilder.cs, - MonoQuery/Gui/NodeBuilders/ProceduresNodeBuilder.cs, - MonoQuery/Gui/NodeBuilders/TableNodeBuilder.cs, - MonoQuery/Gui/SqlQueryView.cs: Converted DispatchService to a static - class. - -2007-07-19 Lluis Sanchez Gual <lluis@novell.com> - - * MonoQuery/MonoQuery.addin.xml: Fix pad icon. - -2007-07-06 Jeffrey Stedfast <fejj@novell.com> - - * MonoQuery/Gui/DbProviderCollection.cs: Removed, this is now - autogenerated. - -2007-06-01 Jeffrey Stedfast <fejj@novell.com> - - * Mono.Data.Sql/Makefile.am: Only build the supported database - providers (based on configure results). - -2007-05-11 Lluis Sanchez Gual <lluis@novell.com> - - * MonoQuery/MonoQuery.mdp: Copy the .addins.xml file to the output dir. - -2007-05-11 Lluis Sanchez Gual <lluis@novell.com> - - * Mono.Data.Sql/Makefile.am, Mono.Data.Sql/Mono.Data.Sql.mdp, - MonoQuery/Makefile.am, MonoQuery/MonoQuery.mdp: Fixed. - -2007-05-10 Lluis Sanchez Gual <lluis@novell.com> - - * Mono.Data.Sql/Makefile.am, Mono.Data.Sql/Mono.Data.Sql.mdp, - MonoQuery/Makefile.am, MonoQuery/MonoQuery.mdp: Fix build. - -2007-05-09 Lluis Sanchez Gual <lluis@novell.com> - - * Mono.Data.Sql/Makefile.am, Mono.Data.Sql/Mono.Data.Sql.mdp: Reference - shared assemblies from the correct location. Added missing assembly - reference. - * MonoQuery/Makefile.am, MonoQuery/MonoQuery.mdp: Reference shared - assemblies from the correct location. - -2007-05-04 Lluis Sanchez Gual <lluis@novell.com> - - * MonoQuery/Makefile.am, MonoQuery/MonoQuery.addin.xml, - MonoQuery/MonoQuery.mdp: Migration to Mono.Addins. - -2007-04-19 Lluis Sanchez Gual <lluis@novell.com> - - * tests/Mono.Data.Sql.Tests.mdp, Mono.Data.Sql/Mono.Data.Sql.mdp, - MonoQuery/MonoQuery.mdp: Don't copy referenced assemblies. - -2007-02-22 Atsushi Enomoto <atsushi@ximian.com> - - * Mono.Data.Sql/Providers/NpgsqlDbProvider.cs : pgsql somehow - returns user ID as int64 while it should be int32, so using - GetValue() here. - -2007-02-20 Ankit Jain <jankit@novell.com> - - * MonoQuery/Commands/Commands.cs (Run): Handle empty connection string. - Destroy the dialog even if an exception is thrown. - -2007-02-16 Lluis Sanchez Gual <lluis@novell.com> - - * MonoQuery/MonoQuery.addin.xml: Change add-in versions to 0.13. - -2007-02-15 Lluis Sanchez Gual <lluis@novell.com> - - * Mono.Data.Sql.mds, tests/Mono.Data.Sql.Tests.mdp, - Mono.Data.Sql/Makefile.am, Mono.Data.Sql/Mono.Data.Sql.mdp, - MonoQuery/Makefile.am, MonoQuery/MonoQuery.mdp: Synchronized the MD - project and the Makefile - -2007-02-06 David Makovský (Yakeen) <yakeen@sannyas-on.net> - - * MonoQuery/MonoQuery.addin.xml: added translatable string for SQL definition pad - -2006-12-17 Lluis Sanchez Gual <lluis@novell.com> - - * MonoQuery/MonoQueryService.cs: Use the FileService for copying and - deleting files. - -2006-09-18 Jacob Ilsø Christensen <jacobilsoe@gmail.com> - - * Mono.Data.Sql.mds: - * tests/Mono.Data.Sql.Tests.mdp: - * Mono.Data.Sql/Mono.Data.Sql.mdp: - * MonoQuery/MonoQuery.mdp: - Updated. - -2006-09-15 Jimmy <jkernel1234@bellsouth.net> - - * Mono.Data.Sql/Providers/SqliteDbProvider.cs: - Fix to not show indices in table view. - -2006-08-31 Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> - - * MonoQuery/MonoQueryService.cs: File existence check on unload. - -2006-08-08 Jacob Ilsø Christensen <jacobilsoe@gmail.com> - - * Mono.Data.Sql/Makefile.am: - * MonoQuery/Makefile.am: - Added support for enabling/disabling MonoQuery. - -2006-07-03 Lluis Sanchez Gual <lluis@novell.com> - - * MonoQuery/MonoQuery.addin.xml: Updated references. - -2006-05-04 Lluis Sanchez Gual <lluis@novell.com> - - * Mono.Data.Sql.mds: Updated. - * tests/Mono.Data.Sql.Tests.mdp: Updated. - * Mono.Data.Sql/Mono.Data.Sql.mdp: Updated. - * MonoQuery/MonoQuery.mdp: Updated. - -2006-03-30 Lluis Sanchez Gual <lluis@novell.com> - - * MonoQuery/MonoQuery.addin.xml: Updated references. - -2006-03-24 Lluis Sanchez Gual <lluis@novell.com> - - * Mono.Data.Sql/Mono.Data.Sql.mdp: - * MonoQuery/MonoQuery.mdp: - * MonoQuery/Makefile.am: - * Mono.Data.Sql/Makefile.am: Use an unified format. - Patch by Matze Braun. - - * MonoQuery/MonoQuery.addin.xml: Updated add-in versions. - -2006-02-24 Lluis Sanchez Gual <lluis@novell.com> - - * MonoQuery/MonoQuery/MonoQuery.mdp: Updated references. - -2006-02-23 Daniel Morgan <danielmorgan@verizon.net> - - * TODO: add ToDo file for MonoQuery and Mono.Data.Sql - -2006-02-22 Daniel Morgan <danielmorgan@verizon.net> - - * Mono.Data.Sql/Makefile.Win32: added file to build - Mono.Data.Sql on Win32 without autotools - -2006-01-14 Andrés G. Aragoneses <knocte@gmail.com> - - * MonoQuery/Gui/SqlQueryView.cs: Fixed a typo. - -2005-11-04 Lluis Sanchez Gual <lluis@novell.com> - - * MonoQuery/Gui/SqlDefinitionPad.cs: Fix gtksourceview warning. - -2005-10-11 Lluis Sanchez Gual <lluis@novell.com> - - * MonoQuery/MonoQuery.addin.xml: Fixed addin header information. - Use "id" attribuet instead of "name" to identify addins. - -2005-10-04 Lluis Sanchez Gual <lluis@novell.com> - - * MonoQuery/MonoQuery.addin.xml: Added addin dependencies. - -2005-09-27 Christian Hergert <christian.hergert@gmail.com> - - * Mono.Data.Sql/Providers/SqliteDbProvider.cs: Add ankit's sqlite - updates. - -2005-09-23 Christian Hergert <christian.hergert@gmail.com> - - * Update svn:ignore - -2005-09-22 Christian Hergert <christian.hergert@gmail.com> - - * Mono.Data.Sql/Providers/NpgsqlDbProvider.cs: Encapsulate GetDateTime - method in a try catch. - -2005-09-05 Sureshkumar T <tsureshkumar@novell.com> - - * Mono.Data.Sql/Providers/SqlDbProvider.cs: implemented procedure - and their parameters listing. - -2005-08-25 Daniel Morgan <danielmorgan@verizon.net> - - * Extras/MonoQuery/MonoQuery/Gui/SqlQueryView.cs: implement - execution of SQL statements in different modes: if text - selected then execute as-is, execute one statement starting at - cursor, and execute multiple statements one-at-a-time starting - at cursor - - * Mono.Data.Sql/Providers/OracleDbProvider.cs: only show - what can be browsed - - * Extras/MonoQuery/Mono.Data.Sql/Providers/SqlDbProvider.cs: add - ColumnSchema and remove others not used. Remove constraints since - they are not working - - * Extras/MonoQuery/Mono.Data.Sql/Providers/SybaseDbProvider.cs: add - ColumnSchema and remove others not used. - -2005-08-22 Daniel Morgan <danielmorgan@verizon.net> - - * Mono.Data.Sql/Providers/OracleDbProvider.cs: fix ExecuteSQL - -2005-08-21 Christian Hergert <christian.hergert@gmail.com> - - * MonoQuery/Commands/Commands.cs: Add some new commands to the enum - * MonoQuery/Gui/NodeBuilders/DatabaseNodeBuilder.cs: Use new icons - * MonoQuery/Gui/NodeBuilders/ProviderCollectionNodeBuilder.cs: Use new - icon. - * MonoQuery/Gui/NodeBuilders/TablesNodeBuilder.cs: Add new commands - for refresh and show query tool. - * MonoQuery/Gui/NodeBuilders/TableNodeBuilder.cs: Add new - commands for empty, drop, refresh, and show query tool. - * MonoQuery/Gui/NodeBuilders/ColumnNodeBuilder.cs: Build icons - reflective of the columns datatype. - * MonoQuery/Gui/FakeNodes.cs: add refresh to the fake tables node. - This way the builder can subscribe and rebuild the tree. Probably can - be done in a better way. - * MonoQuery/Gui/SqlQueryView.cs: new query tool - * MonoQuery/Makefile.am: updated - * MonoQuery/icons/MonoQuery.Stop: New icon for query tool - * MonoQuery/icons/MonoQuery.RunFromCursor: New icon for query tool - * MonoQuery/icons/MonoQuery.Explain: New icon for query tool - * MonoQuery/icons/MonoQuery.Param: New icon for procedure parameters. - * MonoQuery/icons/MonoQuery.Numeric: new icon for numeric data type. - * MonoQuery/icons/MonoQuery.Execute: New icon for query tool - * MonoQuery/icons/MonoQuery.Database.Connected: Database connected - icon - * MonoQuery/icons/MonoQuery.Database.Disconnected: Database error on - connection icon. - * MonoQuery/icons/MonoQuery.String: String data type icon - * MonoQuery/icons/MonoQuery.Providers: New providers icon - * MonoQuery/icons/MonoQuery.Blob: Blob|byte[] data type icon - * MonoQuery/icons/MonoQuery.SqlQueryView: Query view icon - * MonoQuery/MonoQuery.addin.xml: Updated with new context menus and - icons. - * MonoQuery/MonoQuery.mdp: Updated - * Mono.Data.Sql/Providers/DbProviderBase.cs: Add explain support. - * Mono.Data.Sql/Providers/SqlDbProvider.cs: Catch errors for async - mode and return null. - * Mono.Data.Sql/Providers/NpgsqlDbProvider.cs: - * Mono.Data.Sql/Providers/OracleDbProvider.cs: - * Mono.Data.Sql/Providers/MySqlDbProvider.cs: - * Mono.Data.Sql/Providers/FirebirdDbProvider.cs: - * Mono.Data.Sql/Providers/SybaseDbProvider.cs: - * Mono.Data.Sql/Providers/OdbcDbProvider.cs: - -2005-08-20 Christian Hergert <christian.hergert@gmail.com> - - * tests/test-oracle-1.cs: Test. Will be converted to nunit later. - * tests/test-firebird-1.cs: - * tests/test-sybase-1.cs: - * MonoQuery/Gui/NodeBuilders/TableNodeBuilder.cs: Do not append the - sql statement with `;' as this breaks oracle. - * MonoQuery/monoquery.glade: Make password hidden by default. - Passwords can be still seen in advanced textview. this is ok and done - on purpose. - * MonoQuery/MonoQuery.mdp: Updated - * Mono.Data.Sql/Makefile.am: - * Mono.Data.Sql/Providers/FirebirdDbProvider.cs: New firebird - provider. - * Mono.Data.Sql/Providers/SybaseDbProvider.cs: New sybase provider - * Mono.Data.Sql/Providers/OdbcDbProvider.cs: New generic odbc - connector. - * Mono.Data.Sql/Mono.Data.Sql.mdp: Updated - -2005-08-12 Lluis Sanchez Gual <lluis@novell.com> - - * MonoQuery/Makefile.am: embed icons as resources. - * MonoQuery/MonoQuery.addin.xml: Register new stock icons. - -2005-08-06 Christian Hergert <christian.hergert@gmail.com> - - * Mono.Data.Sql/AssemblyInfo.cs: Fix versioning stuff - * Mono.Data.Sql/Providers/NpgsqlDbProvider.cs: Update supported types. - properly close data readers. - * Mono.Data.Sql/Providers/MySqlDbProvider.cs: Add basic support for - tables, their columns, and users. This should be somewhat useful now. Need - to still determine which versions of mysql ByteFX driver works with. - * MonoQuery/AssemblyInfo.cs: Fix versioning stuff - * MonoQuery/Gui/NodeBuilders/TableNodeBuilder.cs: Update to check that the - type is supported before showing a dummy node. - * MonoQuery/Gui/ConnectionDialog.cs: Change Secret to Password. - -2005-08-06 Christian Hergert <christian.hergert@gmail.com> - - * Mono.Data.Sql.mds: Updated - * Mono.Data.Sql/Schema/ForeignKeyConstraintSchema.cs: Add setter for - reference table name. - * Mono.Data.Sql/Schema/UniqueConstraintSchema.cs: Add default Constructor. - * Mono.Data.Sql/Makefile.am: Updated to build when files change. - * Mono.Data.Sql/Providers/NpgsqlDbProvider.cs: Add some more guts to the - Constraint builders for tables. - * MonoQuery/Gui/NodeBuilders/ConstraintNodeBuilder.cs: Add a handler - * MonoQuery/MonoQuery.addin.xml: Load mono.data.sql. - -2005-08-06 Christian Hergert <christian.hergert@gmail.com> - - * tests/Mono.Data.Sql.Tests.mdp: Updated - * Mono.Data.Sql/Schema/AbstractSchema.cs: Add Options hashtable for - generic extra options above and beyond the hardcoded properties. - * Mono.Data.Sql/Schema/UserSchema.cs: Add a few new descriptor objects. - * Mono.Data.Sql/Providers/NpgsqlDbProvider.cs: Add GetUser () : - UserSchema[] support. - * Mono.Data.Sql/Mono.Data.Sql.mdp: Updated - * MonoQuery/Gui/NodeBuilders/UsersNodeBuilder.cs: Build the underlying - users. - * MonoQuery/Gui/NodeBuilders/UserNodeBuilder.cs: New builder to build a - user object in the tree. - * MonoQuery/Gui/DbProviderCollection.cs: Add some more xml includes for - the database persistence file. - * MonoQuery/Makefile.am: Updated - * MonoQuery/MonoQuery.addin.xml: Updated - * MonoQuery/MonoQuery.mdp: Updated - -2005-08-08 John Luke <john.luke@gmail.com> - - * MonoQuery/Makefile.am: add glade file to EXTRA_DIST to - fix distcheck - -2005-08-06 Christian Hergert <christian.hergert@gmail.com> - - * MonoQuery/Makefile.in: should not have been imported. - * MonoQuery/Makefile: should not have been imported. - -2005-08-03 Lluis Sanchez Gual <lluis@novell.com> - - * MonoQuery/Commands/Commands.cs: - * MonoQuery/Gui/NodeBuilders/DatabaseNodeBuilder.cs: - * MonoQuery/Gui/DatabasePad.cs: Moved command handlers to node builders. - -2005-08-02 Christian Hergert <christian.hergert@gmail.com> - - * MonoQuery.prjx: deleted - * MonoQuery.addin.xml.in: removed - * Exceptions: removed - * Services: removed - * Gui: removed - * Codons: removed - * SchemaClass: removed - * MonoQuery.cmbx: removed - * Collection: removed - * MonoQueryView.cs: removed - * MonoQuery/AssemblyInfo.cs: part of monoquery2 - * MonoQuery/MonoQuery.mds: - * MonoQuery/Commands: - * MonoQuery/Commands/Commands.cs: - * MonoQuery/Makefile.in: - * MonoQuery/MonoQueryService.cs: - * MonoQuery/Gui/NodeBuilders/UsersNodeBuilder.cs: - * MonoQuery/Gui/NodeBuilders/ParametersNodeBuilder.cs: - * MonoQuery/Gui/NodeBuilders/DatabaseNodeBuilder.cs: - * MonoQuery/Gui/NodeBuilders/TypesNodeBuilder.cs: - * MonoQuery/Gui/NodeBuilders/LanguagesNodeBuilder.cs: - * MonoQuery/Gui/NodeBuilders/ProviderCollectionNodeBuilder.cs: - * MonoQuery/Gui/NodeBuilders/ConstraintsNodeBuilder.cs: - * MonoQuery/Gui/NodeBuilders/AggregatesNodeBuilder.cs: - * MonoQuery/Gui/NodeBuilders/TablesNodeBuilder.cs: - * MonoQuery/Gui/NodeBuilders/ViewNodeBuilder.cs: - * MonoQuery/Gui/NodeBuilders/ProceduresNodeBuilder.cs: - * MonoQuery/Gui/NodeBuilders/OperatorsNodeBuilder.cs: - * MonoQuery/Gui/NodeBuilders/GroupsNodeBuilder.cs: - * MonoQuery/Gui/NodeBuilders/ColumnsNodeBuilder.cs: - * MonoQuery/Gui/NodeBuilders/RolesNodeBuilder.cs: - * MonoQuery/Gui/NodeBuilders/ConstraintNodeBuilder.cs: - * MonoQuery/Gui/NodeBuilders/TriggersNodeBuilder.cs: - * MonoQuery/Gui/NodeBuilders/TableNodeBuilder.cs: - * MonoQuery/Gui/NodeBuilders/ProcedureNodeBuilder.cs: - * MonoQuery/Gui/NodeBuilders/RulesNodeBuilder.cs: - * MonoQuery/Gui/NodeBuilders/SequencesNodeBuilder.cs: - * MonoQuery/Gui/NodeBuilders/ColumnNodeBuilder.cs: - * MonoQuery/Gui/NodeBuilders/ViewsNodeBuilder.cs: - * MonoQuery/Gui/DbProviderCollection.cs: - * MonoQuery/Gui/SqlDefinitionPad.cs: - * MonoQuery/Gui/ConnectionDialog.cs: - * MonoQuery/Gui/FakeNodes.cs: - * MonoQuery/Gui/DatabasePad.cs: - * MonoQuery/Gui/DataGridView.cs: - * MonoQuery/monoquery.glade: - * MonoQuery/Makefile.am: - * MonoQuery/MonoQuery.addin.xml: - * MonoQuery/Makefile: - * MonoQuery/MonoQuery.mdp: - * AssemblyInfo.cs: removed - * Mono.Data.Sql.mds: removed - * Commands: removed - * tests/NpgsqlTablesTest.cs: start of tests for monoquery2. these dont - really do anything at the moment - * tests/pgsql.sql - * tests/CreateProviderTests.cs - * tests/Mono.Data.Sql.Tests.mdp - * MonoQuery.mdsx: removed - * Makefile.am: updated - * Mono.Data.Sql/AssemblyInfo.cs: core to monoquery2 - * Mono.Data.Sql/Schema: - * Mono.Data.Sql/Schema/OperatorSchema.cs: - * Mono.Data.Sql/Schema/GroupSchema.cs: - * Mono.Data.Sql/Schema/ColumnSchema.cs: - * Mono.Data.Sql/Schema/SchemaSchema.cs: - * Mono.Data.Sql/Schema/RoleSchema.cs: - * Mono.Data.Sql/Schema/PrimaryKeyConstraintSchema.cs: - * Mono.Data.Sql/Schema/AbstractSchema.cs: - * Mono.Data.Sql/Schema/TriggerSchema.cs: - * Mono.Data.Sql/Schema/RuleSchema.cs: - * Mono.Data.Sql/Schema/ForeignKeyConstraintSchema.cs: - * Mono.Data.Sql/Schema/SequenceSchema.cs: - * Mono.Data.Sql/Schema/ViewSchema.cs: - * Mono.Data.Sql/Schema/UniqueConstraintSchema.cs: - * Mono.Data.Sql/Schema/DataTypeSchema.cs: - * Mono.Data.Sql/Schema/IndexConstraintSchema.cs: - * Mono.Data.Sql/Schema/UserSchema.cs: - * Mono.Data.Sql/Schema/ParameterSchema.cs: - * Mono.Data.Sql/Schema/CheckConstraintSchema.cs: - * Mono.Data.Sql/Schema/LanguageSchema.cs: - * Mono.Data.Sql/Schema/ConstraintSchema.cs: - * Mono.Data.Sql/Schema/PrivilegeSchema.cs: - * Mono.Data.Sql/Schema/AggregateSchema.cs: - * Mono.Data.Sql/Schema/TableSchema.cs: - * Mono.Data.Sql/Schema/ISchema.cs: - * Mono.Data.Sql/Schema/ProcedureSchema.cs: - * Mono.Data.Sql/Makefile.am: - * Mono.Data.Sql/Providers: - * Mono.Data.Sql/Providers/DbProviderBase.cs: - * Mono.Data.Sql/Providers/SqlDbProvider.cs: - * Mono.Data.Sql/Providers/SqliteDbProvider.cs: - * Mono.Data.Sql/Providers/NpgsqlDbProvider.cs: - * Mono.Data.Sql/Providers/MySqlDbProvider.cs: - * Mono.Data.Sql/Providers/OracleDbProvider.cs: - * Mono.Data.Sql/Mono.Data.Sql.mdp: - -2005-07-13 Lluis Sanchez Gual <lluis@novell.com> - - * MonoQueryView.cs: - * Gui/DataView/MonoQueryDataView.cs: Pads are now responsible - of showing its own widgets. - -2005-03-31 Christian Hergert <chris@mosaix.net> - - * MonoQueryView.cs: Fix the momento icon. - -2005-03-14 Lluis Sanchez Gual <lluis@novell.com> - - * MonoQuery.addin.xml.in: Define the MonoQuery pad. - -2005-03-06 Christian Hergert <chris@mosaix.net> - - * MonoQuery/Makefile.am: EXTRA_DIST doesnt support conditional variables. - -2005-02-02 Christian Hergert <chris@mosaix.net> - - * MonoQuery/MonoQuery.addin.xml: Moved to .in to be autogenerated - by automake. - -2005-02-02 Christian Hergert <chris@mosaix.net> - - * Extras/MonoQuery/Gui/SqlQueryView/SqlQueryView.cs: flush - -2005-01-31 Christian Hergert <chris@mosaix.net> - - * Extras/MonoQuery/Gui/SqlQueryView/SqlQueryView.cs: Updated to new - ToolItem to fix compiler warning. - -2005-01-26 Christian Hergert <chris@mosaix.net> - - * Extras/MonoQuery/Gui/Abstract/AbstractMonoQueryNode.cs: - * Extras/MonoQuery/Commands/MonoQueryCommands.cs: Fixed to use new - ShowView - -2005-01-08 Christian Hergert <chris@mosaix.net> - - * Fixed druid to expand the connection after building - -2005-01-08 Christian Hergert <chris@mosaix.net> - - * Following Makefile.am fixes - * Copy .addin.xml if it changes - * Fix setup to work if layout changes in the future - * If .addin.xml changes, only copy addin and not rebuild the dll - * Get package references from configure rather than statically - * Added files with GetString to the PO .in file - * Fixed a few warnings from build stage - -2005-01-06 Christian Hergert <chris@mosaix.net> - - * Initial creation of MonoQuery AddIn diff --git a/main/Unused/MonoQuery/Makefile.am b/main/Unused/MonoQuery/Makefile.am deleted file mode 100644 index e21cfb3aaf..0000000000 --- a/main/Unused/MonoQuery/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ - -SUBDIRS = Mono.Data.Sql MonoQuery -#SUBDIRS = Mono.Data.Sql MonoQuery tests diff --git a/main/Unused/MonoQuery/Mono.Data.Sql.mds b/main/Unused/MonoQuery/Mono.Data.Sql.mds deleted file mode 100644 index 57838f2661..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql.mds +++ /dev/null @@ -1,24 +0,0 @@ -<Combine name="MonoQuery" fileversion="2.0"> - <Configurations active="Debug"> - <Configuration name="Debug" ctype="CombineConfiguration"> - <Entry build="True" name="Mono.Data.Sql" configuration="Debug" /> - <Entry build="True" name="Mono.Data.Sql.Tests" configuration="Debug" /> - <Entry build="True" name="MonoQuery" configuration="Debug" /> - </Configuration> - <Configuration name="Release" ctype="CombineConfiguration"> - <Entry build="False" name="Mono.Data.Sql" configuration="Release" /> - <Entry build="True" name="Mono.Data.Sql.Tests" configuration="Release" /> - <Entry build="True" name="MonoQuery" configuration="Release" /> - </Configuration> - </Configurations> - <StartMode startupentry="Mono.Data.Sql" single="True"> - <Execute type="None" entry="Mono.Data.Sql" /> - <Execute type="None" entry="Mono.Data.Sql.Tests" /> - <Execute type="None" entry="MonoQuery" /> - </StartMode> - <Entries> - <Entry filename="./Mono.Data.Sql/Mono.Data.Sql.mdp" /> - <Entry filename="./tests/Mono.Data.Sql.Tests.mdp" /> - <Entry filename="./MonoQuery/MonoQuery.mdp" /> - </Entries> -</Combine>
\ No newline at end of file diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/AssemblyInfo.cs b/main/Unused/MonoQuery/Mono.Data.Sql/AssemblyInfo.cs deleted file mode 100644 index 133c3f5012..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/AssemblyInfo.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-//
-[assembly: AssemblyTitle("")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("")]
-[assembly: AssemblyCopyright("")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-//
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-
-[assembly: AssemblyVersion("1.0.0.0")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the "project output directory". The location of the project output
-// directory is dependent on whether you are working with a local or web project.
-// For local projects, the project output directory is defined as
-// <Project Directory>\obj\<Configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// For web projects, the project output directory is defined as
-// %HOMEPATH%\VSWebCache\<Machine Name>\<Project Directory>\obj\<Configuration>.
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Makefile.Win32 b/main/Unused/MonoQuery/Mono.Data.Sql/Makefile.Win32 deleted file mode 100755 index 87c5640f7e..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Makefile.Win32 +++ /dev/null @@ -1,78 +0,0 @@ -CSC=mcs - -SCS_FLAGS= - -top_srcdir = ../../.. -top_builddir = ../../.. - -FILES = \ -Schema/IndexConstraintSchema.cs \ -Schema/OperatorSchema.cs \ -Schema/GroupSchema.cs \ -Schema/ColumnSchema.cs \ -Schema/SchemaSchema.cs \ -Schema/RoleSchema.cs \ -Schema/ISchema.cs \ -Schema/PrimaryKeyConstraintSchema.cs \ -Schema/AbstractSchema.cs \ -Schema/TriggerSchema.cs \ -Schema/RuleSchema.cs \ -Schema/ForeignKeyConstraintSchema.cs \ -Schema/SequenceSchema.cs \ -Schema/ViewSchema.cs \ -Schema/DataTypeSchema.cs \ -Schema/UniqueConstraintSchema.cs \ -Schema/UserSchema.cs \ -Schema/ParameterSchema.cs \ -Schema/CheckConstraintSchema.cs \ -Schema/LanguageSchema.cs \ -Schema/ConstraintSchema.cs \ -Schema/PrivilegeSchema.cs \ -Schema/AggregateSchema.cs \ -Schema/TableSchema.cs \ -Schema/ProcedureSchema.cs \ -Providers/MySqlDbProvider.cs \ -Providers/DbProviderBase.cs \ -Providers/NpgsqlDbProvider.cs \ -Providers/SqliteDbProvider.cs \ -Providers/OracleDbProvider.cs \ -Providers/OdbcDbProvider.cs \ -Providers/SybaseDbProvider.cs \ -Providers/SqlDbProvider.cs \ -Providers/MetaDataProviderSectionHandler.cs \ -Providers/MetaDataProviderFactory.cs \ -AssemblyInfo.cs - -# Providers/FirebirdDbProvider.cs - -#build_sources = $(addprefix $(srcdir)/, $(FILES)) -build_sources=$(FILES) - -REFS = \ --r:System.Data \ --r:Mono.Data \ --r:Npgsql \ --r:ByteFX.Data \ --r:Mono.Data.SqliteClient \ --r:Mono.Data.SybaseClient \ --r:System.Data.OracleClient - -# -r:FirebirdSql.Data.Firebird.dll -# -r:$(top_srcdir)/contrib/FirebirdSql.Data.Firebird.dll - -ADDIN_BUILD = $(top_builddir)/build/AddIns/MonoQuery - -DLL = $(ADDIN_BUILD)/Mono.Data.Sql.dll - -all: $(DLL) - -$(DLL): $(FILES) - mkdir -p $(ADDIN_BUILD) - $(CSC) $(SCS_FLAGS) -target:library -out:$@ $(build_sources) $(REFS) - -CLEANFILES = $(DLL) $(DLL).mdb - -EXTRA_DIST = $(FILES) - -monoquerydir = $(MD_ADDIN_DIR)/MonoQuery -monoquery_DATA = $(DLL) diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Makefile.am b/main/Unused/MonoQuery/Mono.Data.Sql/Makefile.am deleted file mode 100644 index e737688af5..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Makefile.am +++ /dev/null @@ -1,94 +0,0 @@ -COND_FILES= -COND_REFS= - -if ENABLE_POSTGRES -COND_FILES += $(srcdir)/Providers/NpgsqlDbProvider.cs -COND_REFS += -r:Npgsql -endif - -if ENABLE_MYSQL -COND_FILES += $(srcdir)/Providers/MySqlDbProvider.cs -COND_REFS += -r:ByteFX.Data -endif - -if ENABLE_SQLITE -COND_FILES += $(srcdir)/Providers/SqliteDbProvider.cs -COND_REFS += -r:Mono.Data.SqliteClient -endif - -if ENABLE_ORACLE -COND_FILES += $(srcdir)/Providers/OracleDbProvider.cs -COND_REFS += -r:System.Data.OracleClient -endif - -if ENABLE_SQLSERV -COND_FILES += $(srcdir)/Providers/SqlDbProvider.cs -endif - -if ENABLE_SYBASE -COND_FILES += $(srcdir)/Providers/SybaseDbProvider.cs -COND_REFS += -r:Mono.Data.SybaseClient -endif - -FILES = \ - $(COND_FILES) \ - AssemblyInfo.cs \ - Providers/DbProviderBase.cs \ - Providers/FirebirdDbProvider.cs \ - Providers/OdbcDbProvider.cs \ - Schema/AbstractSchema.cs \ - Schema/AggregateSchema.cs \ - Schema/CheckConstraintSchema.cs \ - Schema/ColumnSchema.cs \ - Schema/ConstraintSchema.cs \ - Schema/DataTypeSchema.cs \ - Schema/ForeignKeyConstraintSchema.cs \ - Schema/GroupSchema.cs \ - Schema/IndexConstraintSchema.cs \ - Schema/ISchema.cs \ - Schema/LanguageSchema.cs \ - Schema/OperatorSchema.cs \ - Schema/ParameterSchema.cs \ - Schema/PrimaryKeyConstraintSchema.cs \ - Schema/PrivilegeSchema.cs \ - Schema/ProcedureSchema.cs \ - Schema/RoleSchema.cs \ - Schema/RuleSchema.cs \ - Schema/SchemaSchema.cs \ - Schema/SequenceSchema.cs \ - Schema/TableSchema.cs \ - Schema/TriggerSchema.cs \ - Schema/UniqueConstraintSchema.cs \ - Schema/UserSchema.cs \ - Schema/ViewSchema.cs - -REFS = \ - $(COND_REFS) \ - -r:$(top_srcdir)/contrib/Firebird/FirebirdSql.Data.Firebird.dll \ - -r:System \ - -r:System.Data - -ADDIN_BUILD = $(top_builddir)/build/AddIns/MonoQuery - -ASSEMBLY = $(ADDIN_BUILD)/Mono.Data.Sql.dll - -if ENABLE_MONOQUERY -all: $(ASSEMBLY) -else -all: -endif - -$(ASSEMBLY): $(FILES) $(COND_FILES) - mkdir -p $(ADDIN_BUILD) - $(CSC) $(SCS_FLAGS) -target:library -out:$@ $(build_sources) $(REFS) - -CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb - -EXTRA_DIST = $(FILES) - -if ENABLE_MONOQUERY -monoquerydir = $(MD_ADDIN_DIR)/MonoQuery -monoquery_DATA = $(ASSEMBLY) -endif - -include $(top_srcdir)/Makefile.include diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Mono.Data.Sql.mdp b/main/Unused/MonoQuery/Mono.Data.Sql/Mono.Data.Sql.mdp deleted file mode 100644 index 054ad695b4..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Mono.Data.Sql.mdp +++ /dev/null @@ -1,76 +0,0 @@ -<Project name="Mono.Data.Sql" fileversion="2.0" language="C#" clr-version="Net_2_0" ctype="DotNetProject"> - <Configurations active="Debug"> - <Configuration name="Debug" ctype="DotNetProjectConfiguration"> - <Output directory="../../../build/AddIns/MonoQuery/" assembly="Mono.Data.Sql" /> - <Build debugmode="True" target="Library" /> - <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" /> - <CodeGeneration compiler="Csc" warninglevel="4" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> - </Configuration> - <Configuration name="Release" ctype="DotNetProjectConfiguration"> - <Output directory="../../../build/AddIns/MonoQuery/" assembly="Mono.Data.Sql" /> - <Build debugmode="False" target="Library" /> - <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" /> - <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> - </Configuration> - </Configurations> - <Contents> - <File name="./Schema/IndexConstraintSchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Schema/OperatorSchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Schema/GroupSchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Schema/ColumnSchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Schema/SchemaSchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Schema/RoleSchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Schema/ISchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Schema/PrimaryKeyConstraintSchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Schema/AbstractSchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Schema/TriggerSchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Schema/RuleSchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Schema/ForeignKeyConstraintSchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Schema/SequenceSchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Schema/ViewSchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Schema/DataTypeSchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Schema/UniqueConstraintSchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Schema/UserSchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Schema/ParameterSchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Schema/CheckConstraintSchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Schema/LanguageSchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Schema/ConstraintSchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Schema/PrivilegeSchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Schema/AggregateSchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Schema/TableSchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Schema/ProcedureSchema.cs" subtype="Code" buildaction="Compile" /> - <File name="./Providers/DbProviderBase.cs" subtype="Code" buildaction="Compile" /> - <File name="./Providers/FirebirdDbProvider.cs" subtype="Code" buildaction="Compile" /> - <File name="./Providers/OdbcDbProvider.cs" subtype="Code" buildaction="Compile" /> - <File name="./AssemblyInfo.cs" subtype="Code" buildaction="Compile" /> - <File name="./Providers/NpgsqlDbProvider.cs" subtype="Code" buildaction="Compile" /> - <File name="./Providers/MySqlDbProvider.cs" subtype="Code" buildaction="Compile" /> - <File name="./Providers/OracleDbProvider.cs" subtype="Code" buildaction="Compile" /> - <File name="./Providers/SqlDbProvider.cs" subtype="Code" buildaction="Compile" /> - <File name="./Providers/SqliteDbProvider.cs" subtype="Code" buildaction="Compile" /> - <File name="./Providers/SybaseDbProvider.cs" subtype="Code" buildaction="Compile" /> - <File name="./Makefile.am" subtype="Code" buildaction="Nothing" /> - </Contents> - <References> - <ProjectReference type="Gac" localcopy="False" refto="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> - <ProjectReference type="Gac" localcopy="False" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> - <ProjectReference type="Assembly" localcopy="False" refto="../../../contrib/Firebird/FirebirdSql.Data.Firebird.dll" /> - </References> - <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="./Makefile.am" SyncReferences="True" IsAutotoolsProject="True" RelativeConfigureInPath="../../../"> - <ExcludedFiles> - <File>./Providers/SybaseDbProvider.cs</File> - <File>./Providers/SqliteDbProvider.cs</File> - <File>./Providers/SqlDbProvider.cs</File> - <File>./Providers/OracleDbProvider.cs</File> - <File>./Providers/NpgsqlDbProvider.cs</File> - <File>./Providers/MySqlDbProvider.cs</File> - </ExcludedFiles> - <BuildFilesVar Sync="True" Name="FILES" /> - <DeployFilesVar /> - <ResourcesVar /> - <OthersVar /> - <GacRefVar Sync="True" Name="REFS" Prefix="-r:" /> - <AsmRefVar Sync="True" Name="REFS" Prefix="-r:" /> - <ProjectRefVar Sync="True" Name="REFS" Prefix="-r:" /> - </MonoDevelop.Autotools.MakefileInfo> -</Project> diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Providers/DbProviderBase.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Providers/DbProviderBase.cs deleted file mode 100644 index a099582c2c..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Providers/DbProviderBase.cs +++ /dev/null @@ -1,381 +0,0 @@ -// -// DbProviderBase.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.Data; -using System.Threading; - -namespace Mono.Data.Sql -{ - public delegate void DbProviderChangedEventHandler (object sender, DbProviderChangedArgs args); - public delegate void SQLCallback (object sender, object Results); - - public class DbProviderChangedArgs : EventArgs - { - public DbProviderBase Provider = null; - - public DbProviderChangedArgs (DbProviderBase provider) - { - Provider = provider; - } - } - - [Serializable] - public abstract class DbProviderBase - { - public event DbProviderChangedEventHandler NameChanged; - public event DbProviderChangedEventHandler StateChanged; - public event DbProviderChangedEventHandler Refreshed; - - protected string name = String.Empty; - - #region // Threading objects - Object ThreadSync = new Object (); - SQLCallback ThreadedSQLCallback; - TableSchema ThreadedTableSchema; - ViewSchema ThreadedViewSchema; - ProcedureSchema ThreadedProcedureSchema; - String ThreadedSQLText = String.Empty; - #endregion // End of Threading objects - - public DbProviderBase () - { - } - - public virtual string ProviderName { - get { - return "Unknown Provider"; - } - } - - public virtual string Name { - get { - return name; - } - set { - name = value; - if (NameChanged != null) - NameChanged (this, new DbProviderChangedArgs (this)); - } - } - - public virtual IDbConnection Connection { - get { - return (IDbConnection) null; - } - } - - public virtual string ConnectionString { - get { - throw new NotImplementedException (); - } - set { - throw new NotImplementedException (); - } - } - - public virtual bool IsConnectionStringWrong { - get { - return true; - } - } - - public virtual bool IsOpen { - get { - return false; - } - } - - public virtual bool CanExplain { - get { - return true; - } - } - - public virtual bool Open () - { - return IsOpen; - } - - public virtual void Close () - { - throw new NotImplementedException (); - } - - public virtual void Refresh () - { - if (Refreshed != null) - Refreshed (this, new DbProviderChangedArgs (this)); - } - - public virtual bool SupportsSchemaType (Type type) - { - return false; - } - - public virtual void ExecuteSQL (string SQLText, SQLCallback Callback) - { - lock (ThreadSync) { - ThreadedSQLCallback = Callback; - ThreadedSQLText = SQLText; - Thread eThread = new Thread (new ThreadStart (ExecuteSQLThreadStart)); - eThread.Start (); - } - } - - public virtual DataTable ExecuteSQL (string SQLText) - { - throw new NotImplementedException (); - } - - public virtual void ExplainSQL (string SQLText, SQLCallback Callback) - { - if (CanExplain != true) - return; - - lock (ThreadSync) { - ThreadedSQLCallback = Callback; - ThreadedSQLText = SQLText; - Thread eThread = new Thread (new ThreadStart (ExplainSQLThreadStart)); - eThread.Start (); - } - } - - public virtual DataTable ExplainSQL (string SQLText) - { - if (CanExplain == false) - return null; - - return ExecuteSQL (String.Format ("EXPLAIN {0}", SQLText)); - } - - public virtual void GetTables (SQLCallback Callback) - { - Thread eThread = null; - lock (ThreadSync) { - ThreadedSQLCallback = Callback; - eThread = new Thread (new ThreadStart (GetTablesThreadStart)); - eThread.Start (); - } - } - - public virtual TableSchema[] GetTables () - { - throw new NotImplementedException (); - } - - public virtual void GetTableColumns (SQLCallback Callback, TableSchema schema) - { - Thread eThread = null; - lock (ThreadSync) { - ThreadedSQLCallback = Callback; - ThreadedTableSchema = schema; - eThread = new Thread (new ThreadStart (GetTableColumnsThreadStart)); - eThread.Start (); - } - } - - public virtual ColumnSchema[] GetTableColumns (TableSchema schema) - { - throw new NotImplementedException (); - } - - public virtual void GetTableConstraints (SQLCallback Callback, TableSchema schema) - { - Thread eThread = null; - lock (ThreadSync) { - ThreadedSQLCallback = Callback; - ThreadedTableSchema = schema; - eThread = new Thread (new ThreadStart (GetTableConstraintsThreadStart)); - eThread.Start (); - } - } - - public virtual ConstraintSchema[] GetTableConstraints (TableSchema schema) - { - throw new NotImplementedException (); - } - - public virtual void GetViews (SQLCallback Callback) - { - Thread eThread = null; - lock (ThreadSync) { - ThreadedSQLCallback = Callback; - eThread = new Thread (new ThreadStart (GetViewsThreadStart)); - eThread.Start (); - } - } - - public virtual ViewSchema[] GetViews () - { - throw new NotImplementedException (); - } - - public virtual void GetViewColumns (SQLCallback Callback, ViewSchema schema) - { - Thread eThread = null; - lock (ThreadSync) { - ThreadedSQLCallback = Callback; - ThreadedViewSchema = schema; - eThread = new Thread (new ThreadStart (GetViewColumnsThreadStart)); - eThread.Start (); - } - } - - public virtual ColumnSchema[] GetViewColumns (ViewSchema schema) - { - throw new NotImplementedException (); - } - - public virtual void GetProcedures (SQLCallback Callback) - { - Thread eThread = null; - lock (ThreadSync) { - ThreadedSQLCallback = Callback; - eThread = new Thread (new ThreadStart (GetProceduresThreadStart)); - eThread.Start (); - } - } - - public virtual ProcedureSchema[] GetProcedures () - { - throw new NotImplementedException (); - } - - public virtual void GetProcedureColumns (SQLCallback Callback, ProcedureSchema schema) - { - Thread eThread = null; - lock (ThreadSync) { - ThreadedSQLCallback = Callback; - ThreadedProcedureSchema = schema; - eThread = new Thread (new ThreadStart ( - GetProcedureColumnsThreadStart)); - eThread.Start (); - } - } - - public virtual ColumnSchema[] GetProcedureColumns (ProcedureSchema schema) - { - throw new NotImplementedException (); - } - - public virtual void GetUsers (SQLCallback Callback) - { - Thread eThread = null; - lock (ThreadSync) { - ThreadedSQLCallback = Callback; - eThread = new Thread (new ThreadStart (GetUsersThreadStart)); - eThread.Start (); - } - } - - public virtual UserSchema[] GetUsers () - { - throw new NotImplementedException (); - } - - protected virtual void OnOpen () - { - if (StateChanged != null) - StateChanged (this, new DbProviderChangedArgs (this)); - } - - protected virtual void OnClose () - { - if (StateChanged != null) - StateChanged (this, new DbProviderChangedArgs (this)); - } - - protected virtual void ExecuteSQLThreadStart () - { - string SQLText = ThreadedSQLText; - SQLCallback Callback = ThreadedSQLCallback; - Callback (this, ExecuteSQL (SQLText)); - } - - protected virtual void ExplainSQLThreadStart () - { - string SQLText = ThreadedSQLText; - SQLCallback Callback = ThreadedSQLCallback; - Callback (this, ExplainSQL (SQLText)); - } - - protected virtual void GetTablesThreadStart () - { - SQLCallback Callback = ThreadedSQLCallback; - Callback (this, GetTables ()); - } - - protected virtual void GetTableColumnsThreadStart () - { - SQLCallback Callback = ThreadedSQLCallback; - TableSchema Table = ThreadedTableSchema; - Callback (this, GetTableColumns (Table)); - } - - protected virtual void GetTableConstraintsThreadStart () - { - SQLCallback Callback = ThreadedSQLCallback; - TableSchema Table = ThreadedTableSchema; - Callback (this, GetTableConstraints (Table)); - } - - protected virtual void GetViewsThreadStart () - { - SQLCallback Callback = ThreadedSQLCallback; - Callback (this, GetViews ()); - } - - protected virtual void GetViewColumnsThreadStart () - { - SQLCallback Callback = ThreadedSQLCallback; - ViewSchema view = ThreadedViewSchema; - Callback (this, GetViewColumns (view)); - } - - protected virtual void GetProceduresThreadStart () - { - SQLCallback Callback = ThreadedSQLCallback; - Callback (this, GetProcedures ()); - } - - protected virtual void GetProcedureColumnsThreadStart () - { - SQLCallback Callback = ThreadedSQLCallback; - ProcedureSchema schema = ThreadedProcedureSchema; - Callback (this, GetProcedureColumns (schema)); - } - - protected virtual void GetUsersThreadStart () - { - SQLCallback Callback = ThreadedSQLCallback; - Callback (this, GetUsers ()); - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Providers/FirebirdDbProvider.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Providers/FirebirdDbProvider.cs deleted file mode 100644 index 830ef806d7..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Providers/FirebirdDbProvider.cs +++ /dev/null @@ -1,460 +0,0 @@ -// -// Provider/FirebirdDbProvider.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// Daniel Morgan <danielmorgan@verizon.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// Copyright (C) 2005 Daniel Morgan -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.Data; -using System.Text; -using System.Text.RegularExpressions; - -using FirebirdSql.Data.Firebird; - -namespace Mono.Data.Sql -{ - /// <summary> - /// Mono.Data.Sql provider for PostgreSQL databases. - /// </summary> - [Serializable] - public class FirebirdDbProvider : DbProviderBase - { - protected FbConnection connection = null; - protected FbDataAdapter adapter = new FbDataAdapter(); - protected bool isConnectionStringWrong = false; - - /// <summary> - /// Default Constructor - /// </summary> - public FirebirdDbProvider () : base () - { - } - - public override string ProviderName { - get { - return "Firebird Database"; - } - } - - /// <summary> - /// Constructor with ADO.NET Npgsql connection. - /// </summary> - public FirebirdDbProvider (FbConnection conn) - { - connection = conn; - } - - /// <summary> - /// ADO.NET Connection - /// </summary> - public override IDbConnection Connection { - get { - if (connection == null) - connection = new FbConnection(); - - return (IDbConnection) connection; - } - } - - /// <summary> - /// Connection String - /// </summary> - public override string ConnectionString { - get { - return Connection.ConnectionString; - } - set { - if (IsOpen == true) - Close(); - - Connection.ConnectionString = value; - isConnectionStringWrong = false; - } - } - - /// <summary> - /// Is the connection open - /// </summary> - public override bool IsOpen { - get { - return Connection.State == ConnectionState.Open; - } - } - - /// <summary> - /// Is the last used connection string wrong - /// </summary> - public override bool IsConnectionStringWrong { - get { - return isConnectionStringWrong; - } - } - - /// <summary> - /// Open the connection. Returns true on success. - /// </summary> - public override bool Open() - { - try { - Connection.Open(); - } catch { - isConnectionStringWrong = true; - } - OnOpen (); - return IsOpen; - } - - /// <summary> - /// Close the database connection. - /// </summary> - public override void Close() - { - Connection.Close(); - OnClose(); - } - - /// <summary> - /// Do we support the passed schema type - /// </summary> - public override bool SupportsSchemaType(Type type) - { - if (type == typeof(TableSchema)) - return true; - else if (type == typeof(ViewSchema)) - return true; - else if (type == typeof(ProcedureSchema)) - return true; - else if (type == typeof(AggregateSchema)) - return true; - else if (type == typeof(GroupSchema)) - return true; - else if (type == typeof(UserSchema)) - return true; - else if (type == typeof(LanguageSchema)) - return true; - else if (type == typeof(OperatorSchema)) - return true; - else if (type == typeof(RoleSchema)) - return true; - else if (type == typeof(SequenceSchema)) - return true; - else if (type == typeof(DataTypeSchema)) - return true; - else if (type == typeof(TriggerSchema)) - return true; - else if (type == typeof(ColumnSchema)) - return true; - else if (type == typeof(ConstraintSchema)) - return true; - else if (type == typeof(RuleSchema)) - return true; - else - return false; - } - - /// <summary> - /// Thread safe SQL execution. - /// </summary> - public override DataTable ExecuteSQL(string SQLText) - { - try { - FbCommand command = new FbCommand(); - command.Connection = connection; - command.CommandText = SQLText; - - DataSet resultSet = new DataSet (); - - lock(adapter) { - adapter.SelectCommand = command; - adapter.Fill(resultSet); - } - - return resultSet.Tables[0]; - } catch { - return null; - } - } - - /// <summary> - /// Get a list of tables in the system. - /// </summary> - public override TableSchema[] GetTables() - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - - DataTable dataTable = connection.GetSchema ("Tables", new string[] {null, null, null, "TABLE"}); - - for (int r = 0; r < dataTable.Rows.Count; r++) { - DataRow row = dataTable.Rows[r]; - string tableName = row["TABLE_NAME"].ToString(); - - TableSchema table = new TableSchema(); - table.Provider = this; - table.Name = tableName; - table.IsSystemTable = false; // TODO - - table.SchemaName = String.Empty; - table.OwnerName = String.Empty; - table.Comment = String.Empty; - - StringBuilder sb = new StringBuilder(); - sb.AppendFormat ("-- Table: {0}\n", table.Name); - sb.AppendFormat ("-- DROP TABLE {0};\n\n", table.Name); - sb.AppendFormat ("CREATE TABLE {0} (\n", table.Name); - - ColumnSchema[] columns = table.Columns; - string[] parts = new string[columns.Length]; - for (int i = 0; i < parts.Length; i++) { - parts[i] = "\t" + columns[i].Definition; - } - sb.Append (String.Join (",\n", parts)); - - //ConstraintSchema[] cons = table.Constraints; - /* - parts = new string[cons.Length]; - if (cons.Length > 0) - sb.Append (",\n"); - for (int i = 0; i < parts.Length; i++) { - parts[i] = "\t" + cons[i].Definition; - } - sb.Append (String.Join (",\n", parts)); - */ - - sb.Append ("\n);\n"); - //sb.AppendFormat ("COMMENT ON TABLE {0} IS '{1}';", table.Name, table.Comment); - table.Definition = sb.ToString(); - collection.Add (table); - - } - - return (TableSchema[]) collection.ToArray (typeof (TableSchema)); - } - - /// <summary> - /// Get columns for a table. - /// </summary> - public override ColumnSchema[] GetTableColumns(TableSchema table) - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList(); - - DataTable table2 = connection.GetSchema ("Columns", new string[] {null, null, table.Name, null}); - for (int r = 0; r < table2.Rows.Count; r++) { - DataRow row2 = table2.Rows[r]; - - string columnName = row2["COLUMN_NAME"].ToString(); - string dataType = row2["COLUMN_DATA_TYPE"].ToString(); - - int columnSize = 0; - if (row2["COLUMN_SIZE"] != DBNull.Value) - columnSize = (int) row2["COLUMN_SIZE"]; - - int precision = 0; - if (row2["NUMERIC_PRECISION"] != DBNull.Value) - precision = (int) row2["NUMERIC_PRECISION"]; - - int scale = 0; - if (row2["NUMERIC_SCALE"] != DBNull.Value) - scale = (int) row2["NUMERIC_SCALE"]; - - //bool isNullable = false; // FIXME: is nullable - //short n = 0; - //if (row2["IS_NULLABLE"] != DBNull.Value) - // n = (short) row2["IS_NULLABLE"]; - // - //if (n == 1) - // isNullable = true; - - //int pos = 0; // FIXME: ordinal position - //if (row2["ORDINAL_POSITION"] != DBNull.Value) - // pos = (int) row2["ORDINAL_POSITION"]; - - ColumnSchema column = new ColumnSchema(); - - column.Name = columnName; - column.Provider = this; - column.DataTypeName = dataType; - column.Default = ""; - column.Comment = ""; - column.OwnerName = ""; - column.SchemaName = table.SchemaName; - column.NotNull = false; // TODO - column.Length = columnSize; - column.Precision = precision; - column.Scale = scale; - - StringBuilder sb = new StringBuilder(); - sb.AppendFormat("{0} {1}{2}", - column.Name, - column.DataTypeName, - (column.Length > 0) ? ("(" + column.Length + ")") : ""); - sb.AppendFormat(" {0}", column.NotNull ? "NOT NULL" : "NULL"); - if (column.Default.Length > 0) - sb.AppendFormat(" DEFAULT {0}", column.Default); - column.Definition = sb.ToString(); - - collection.Add(column); - } - - return (ColumnSchema[]) collection.ToArray(typeof(ColumnSchema)); - } - - /// <summary> - /// Get a collection of views from the system. - /// </summary> - public override ViewSchema[] GetViews() - { - ArrayList collection = new ArrayList(); - - DataTable table2 = connection.GetSchema ("Views", new string[] {null, null, null}); - for (int r = 0; r < table2.Rows.Count; r++) { - DataRow row2 = table2.Rows[r]; - string viewName = row2["VIEW_NAME"].ToString(); - - ViewSchema view = new ViewSchema(); - view.Provider = this; - - view.Name = viewName; - view.SchemaName = ""; - view.OwnerName = ""; - - StringBuilder sb = new StringBuilder(); - sb.AppendFormat ("-- View: {0}\n", view.Name); - sb.AppendFormat ("-- DROP VIEW {0};\n\n", view.Name); - sb.AppendFormat ("CREATE VIEW {0} AS (\n", view.Name); - view.Definition = ""; - - view.IsSystemView = false; - view.Comment = ""; - - collection.Add(view); - } - - return (ViewSchema[]) collection.ToArray (typeof (ViewSchema)); - } - - /// <summary> - /// Get a collection of columns within a view - /// </summary> - public override ColumnSchema[] GetViewColumns(ViewSchema view) - { - if (IsOpen == false && Open() == false) - throw new Exception ("No connection to database"); - - ArrayList collection = new ArrayList(); - - // TODO: get view columns - - return (ColumnSchema[]) collection.ToArray (typeof(ColumnSchema)); - } - - /// <summary> - /// Get a collection of constraints within a a table. - /// </summary> - public override ConstraintSchema[] GetTableConstraints (TableSchema table) - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - - // TODO: get constraints - - return (ConstraintSchema[]) collection.ToArray (typeof(ConstraintSchema)); - } - - public override UserSchema[] GetUsers () - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - - // TODO: get users - - return (UserSchema[]) collection.ToArray (typeof (UserSchema)); - } - - public override ProcedureSchema[] GetProcedures () - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - - DataTable table2 = null; - DataRow row2 = null; - table2 = connection.GetSchema ("Procedures", new string[] {null, null, null}); - for (int r = 0; r < table2.Rows.Count; r++) { - row2 = table2.Rows[r]; - ProcedureSchema procedure = new ProcedureSchema (); - procedure.Provider = this; - procedure.Name = row2["PROCEDURE_NAME"].ToString(); - procedure.Definition = ""; - procedure.LanguageName = ""; - procedure.IsSystemProcedure = false; - collection.Add (procedure); - row2 = null; - } - table2 = null; - - table2 = connection.GetSchema ("Functions", new string[] {null, null, null, null}); - for (int r = 0; r < table2.Rows.Count; r++) { - row2 = table2.Rows[r]; - ProcedureSchema procedure = new ProcedureSchema (); - procedure.Provider = this; - procedure.Name = row2["FUNCTION_NAME"].ToString(); - procedure.Definition = ""; - procedure.LanguageName = ""; - procedure.IsSystemProcedure = false; - collection.Add (procedure); - row2 = null; - } - table2 = null; - - return (ProcedureSchema[]) collection.ToArray (typeof (ProcedureSchema)); - } - - public override ColumnSchema[] GetProcedureColumns (ProcedureSchema schema) - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - - // TODO - - return (ColumnSchema[]) collection.ToArray (typeof (ColumnSchema)); - } - } -} diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Providers/MySqlDbProvider.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Providers/MySqlDbProvider.cs deleted file mode 100644 index ef89a4de06..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Providers/MySqlDbProvider.cs +++ /dev/null @@ -1,253 +0,0 @@ -// -// Providers/MySqlDbProvider.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.Data; - -using ByteFX.Data.MySqlClient; - -namespace Mono.Data.Sql -{ - [Serializable] - public class MySqlDbProvider : DbProviderBase - { - protected MySqlConnection connection = null; - protected MySqlDataAdapter adapter = new MySqlDataAdapter (); - protected bool isConnectionStringWrong = false; - - public override string ProviderName { - get { - return "MySQL Database"; - } - } - - public override IDbConnection Connection { - get { - if (connection == null) - connection = new MySqlConnection (); - - return (IDbConnection) connection; - } - } - - public override string ConnectionString { - get { - return Connection.ConnectionString; - } - set { - if (IsOpen) - Close (); - - Connection.ConnectionString = value; - isConnectionStringWrong = false; - } - } - - public override bool IsOpen { - get { - return Connection.State == ConnectionState.Open; - } - } - - public override bool IsConnectionStringWrong { - get { - return isConnectionStringWrong; - } - } - - public override bool Open () - { - try { - Connection.Open (); - OnOpen (); - } catch { - isConnectionStringWrong = true; - } - - - return IsOpen; - } - - public override void Close () - { - Connection.Close (); - OnClose (); - } - - public override bool SupportsSchemaType(Type type) - { - if (type == typeof(TableSchema)) - return true; - if (type == typeof(ColumnSchema)) - return true; - else if (type == typeof(UserSchema)) - return true; - else - return false; - } - - public override DataTable ExecuteSQL (string SQLText) - { - try { - MySqlCommand command = new MySqlCommand (); - command.Connection = Connection; - command.CommandText = SQLText; - - DataSet resultSet = null; - - lock (adapter) { - adapter.SelectCommand = command; - adapter.Fill (resultSet); - } - - return resultSet.Tables[0]; - } catch { - return null; - } - } - - public override TableSchema[] GetTables () - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - - using (MySqlCommand command = new MySqlCommand ()) { - command.Connection = Connection; - command.CommandText = - "SHOW TABLES;"; - MySqlDataReader r = command.ExecuteReader (); - - while (r.Read ()) { - TableSchema table = new TableSchema (); - table.Provider = this; - - table.Name = r.GetString (0); - - collection.Add (table); - } - - r.Close (); - } - - return (TableSchema[]) collection.ToArray (typeof (TableSchema)); - } - - public override ColumnSchema[] GetTableColumns (TableSchema table) - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - - using (MySqlCommand command = new MySqlCommand ()) { - command.Connection = Connection; - - // XXX: Use String.Format cause mysql parameters suck assmar. - command.CommandText = - String.Format ("DESCRIBE {0}", table.Name); - MySqlDataReader r = command.ExecuteReader (); - - while (r.Read ()) { - ColumnSchema column = new ColumnSchema (); - column.Provider = this; - - column.Name = r.GetString (0); - column.DataTypeName = r.GetString (1); - column.NotNull = r.IsDBNull (2); - column.Default = r.GetString (4); - column.Options["extra"] = r.GetString (5); - - collection.Add (column); - } - - r.Close (); - } - - return (ColumnSchema[]) collection.ToArray (typeof (ColumnSchema)); - } - - public override ConstraintSchema[] GetTableConstraints (TableSchema table) - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - - using (MySqlCommand command = new MySqlCommand ()) { - command.Connection = Connection; - command.CommandText = - ""; - MySqlDataReader r = command.ExecuteReader (); - - while (r.Read ()) { - ConstraintSchema constraint = new ConstraintSchema (); - constraint.Provider = this; - - // TODO: Implement - - collection.Add (constraint); - } - - r.Close (); - } - - return (ConstraintSchema[]) collection.ToArray ( - typeof (ConstraintSchema)); - } - - public override UserSchema[] GetUsers () - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - - using (MySqlCommand command = new MySqlCommand ()) { - command.Connection = connection; - command.CommandText = - "SELECT DISTINCT user from mysql.user where user != '';"; - MySqlDataReader r = command.ExecuteReader (); - - while (r.Read ()) { - UserSchema user = new UserSchema (); - user.Provider = this; - user.Name = r.GetString (0); - - collection.Add (user); - } - - r.Close (); - } - - return (UserSchema[]) collection.ToArray (typeof (UserSchema)); - } - } -} diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Providers/NpgsqlDbProvider.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Providers/NpgsqlDbProvider.cs deleted file mode 100644 index f33bc53c53..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Providers/NpgsqlDbProvider.cs +++ /dev/null @@ -1,665 +0,0 @@ -// -// Provider/NpgsqlDbProvider.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.Data; -using System.Text; -using System.Text.RegularExpressions; - -using Npgsql; - -namespace Mono.Data.Sql -{ - /// <summary> - /// Mono.Data.Sql provider for PostgreSQL databases. - /// </summary> - [Serializable] - public class NpgsqlDbProvider : DbProviderBase - { - protected NpgsqlConnection connection = null; - protected NpgsqlDataAdapter adapter = new NpgsqlDataAdapter(); - protected bool isConnectionStringWrong = false; - - /// <summary> - /// Default Constructor - /// </summary> - public NpgsqlDbProvider () : base () - { - } - - public override string ProviderName { - get { - return "PostgreSQL Database"; - } - } - - /// <summary> - /// Constructor with ADO.NET Npgsql connection. - /// </summary> - public NpgsqlDbProvider (NpgsqlConnection conn) - { - connection = conn; - } - - /// <summary> - /// ADO.NET Connection - /// </summary> - public override IDbConnection Connection { - get { - if (connection == null) - connection = new NpgsqlConnection(); - - return (IDbConnection) connection; - } - } - - /// <summary> - /// Connection String - /// </summary> - public override string ConnectionString { - get { - return Connection.ConnectionString; - } - set { - if (IsOpen == true) - Close(); - - Connection.ConnectionString = value; - isConnectionStringWrong = false; - } - } - - /// <summary> - /// Is the connection open - /// </summary> - public override bool IsOpen { - get { - return Connection.State == ConnectionState.Open; - } - } - - /// <summary> - /// Is the last used connection string wrong - /// </summary> - public override bool IsConnectionStringWrong { - get { - return isConnectionStringWrong; - } - } - - /// <summary> - /// Last system OID used in postgres to monitor system vs user - /// objects. This varies based on the connections Server Version. - /// </summary> - protected int LastSystemOID { - get { - int major = connection.ServerVersion.Major; - int minor = connection.ServerVersion.Minor; - - if (major == 8) - return 17137; - else if (major == 7 && minor == 1) - return 18539; - else if (major == 7 && minor == 2) - return 16554; - else if (major == 7 && minor == 3) - return 16974; - else if (major == 7 && minor == 4) - return 17137; - else - return 17137; - } - } - - /// <summary> - /// Open the connection. Returns true on success. - /// </summary> - public override bool Open() - { - try { - Connection.Open(); - } catch { - isConnectionStringWrong = true; - } - OnOpen (); - return IsOpen; - } - - /// <summary> - /// Close the database connection. - /// </summary> - public override void Close() - { - Connection.Close(); - OnClose(); - } - - /// <summary> - /// Do we support the passed schema type - /// </summary> - public override bool SupportsSchemaType(Type type) - { - if (type == typeof(TableSchema)) - return true; - else if (type == typeof(ViewSchema)) - return true; - else if (type == typeof(ProcedureSchema)) - return true; - else if (type == typeof(AggregateSchema)) - return true; - else if (type == typeof(GroupSchema)) - return true; - else if (type == typeof(UserSchema)) - return true; - else if (type == typeof(LanguageSchema)) - return true; - else if (type == typeof(OperatorSchema)) - return true; - else if (type == typeof(RoleSchema)) - return true; - else if (type == typeof(SequenceSchema)) - return true; - else if (type == typeof(DataTypeSchema)) - return true; - else if (type == typeof(TriggerSchema)) - return true; - else if (type == typeof(ColumnSchema)) - return true; - else if (type == typeof(ConstraintSchema)) - return true; - else if (type == typeof(RuleSchema)) - return true; - else - return false; - } - - /// <summary> - /// Thread safe SQL execution. - /// </summary> - public override DataTable ExecuteSQL(string SQLText) - { - try { - NpgsqlCommand command = new NpgsqlCommand(); - command.Connection = connection; - command.CommandText = SQLText; - - DataSet resultSet = new DataSet (); - - lock(adapter) { - adapter.SelectCommand = command; - adapter.Fill(resultSet); - } - - return resultSet.Tables[0]; - } catch { - return null; - } - } - - /// <summary> - /// Get a list of tables in the system. - /// </summary> - public override TableSchema[] GetTables() - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - - NpgsqlCommand command = new NpgsqlCommand(); - command.Connection = connection; - command.CommandText = - "SELECT c.relname, n.nspname, u.usename, d.description " - + "FROM pg_class c " - + " LEFT JOIN pg_description d ON c.oid = d.objoid, " - + "pg_namespace n, pg_user u " - + "WHERE c.relnamespace = n.oid " - + "AND c.relowner = u.usesysid " - + "AND c.relkind='r' AND NOT EXISTS " - + " (SELECT 1 FROM pg_rewrite r " - + " WHERE r.ev_class = c.oid AND r.ev_type = '1') " - + "ORDER BY relname;"; - NpgsqlDataReader r = command.ExecuteReader(); - - while (r.Read()) { - TableSchema table = new TableSchema(); - table.Provider = this; - table.Name = r.GetString(0); - - if (table.Name.Substring(0, 3) == "pg_" || - table.Name.Substring(0, 4) == "sql_") - { - table.IsSystemTable = true; - } - - try { table.SchemaName = r.GetString(1); } catch {} - try { table.OwnerName = r.GetString(2); } catch {} - try { table.Comment = r.GetString(3); } catch {} - - StringBuilder sb = new StringBuilder(); - sb.AppendFormat ("-- Table: {0}\n", table.Name); - sb.AppendFormat ("-- DROP TABLE {0};\n\n", table.Name); - sb.AppendFormat ("CREATE TABLE {0} (\n", table.Name); - - ColumnSchema[] columns = table.Columns; - string[] parts = new string[columns.Length]; - for (int i = 0; i < parts.Length; i++) { - parts[i] = "\t" + columns[i].Definition; - } - sb.Append (String.Join (",\n", parts)); - - ConstraintSchema[] cons = table.Constraints; - parts = new string[cons.Length]; - if (cons.Length > 0) - sb.Append (",\n"); - for (int i = 0; i < parts.Length; i++) { - parts[i] = "\t" + cons[i].Definition; - } - sb.Append (String.Join (",\n", parts)); - - sb.Append ("\n);\n"); - sb.AppendFormat ("COMMENT ON TABLE {0} IS '{1}';", table.Name, table.Comment); - table.Definition = sb.ToString(); - collection.Add (table); - } - - r.Close (); - - return (TableSchema[]) collection.ToArray (typeof (TableSchema)); - } - - /// <summary> - /// Get columns for a table. - /// </summary> - public override ColumnSchema[] GetTableColumns(TableSchema table) - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList(); - - NpgsqlCommand command = new NpgsqlCommand(); - command.Connection = connection; - command.CommandText = "SELECT a.attname, a.attnotnull, a.attlen, " - + "typ.typname, adef.adsrc " - + "FROM " - + " pg_catalog.pg_attribute a LEFT JOIN " - + " pg_catalog.pg_attrdef adef " - + " ON a.attrelid=adef.adrelid " - + " AND a.attnum=adef.adnum " - + " LEFT JOIN pg_catalog.pg_type t ON a.atttypid=t.oid, " - + " pg_catalog.pg_type typ " - + "WHERE " - + " a.attrelid = (SELECT oid FROM pg_catalog.pg_class " - + " WHERE relname='" + table.Name + "') " - + "AND a.attnum > 0 AND NOT a.attisdropped " - + "AND a.atttypid = typ.oid " - + "ORDER BY a.attnum;"; - NpgsqlDataReader r = command.ExecuteReader(); - - while (r.Read()) { - ColumnSchema column = new ColumnSchema(); - - try { column.Name = r.GetString(0); } catch {} - column.Provider = this; - try { column.DataTypeName = r.GetString(3); } catch {} - try { column.Default = r.GetString(4); } catch {} - column.Comment = ""; - column.OwnerName = ""; - column.SchemaName = table.SchemaName; - try { column.NotNull = r.GetBoolean(1); } catch {} - try { column.Length = r.GetInt32(2); } catch {} - - StringBuilder sb = new StringBuilder(); - sb.AppendFormat("{0} {1}{2}", - column.Name, - column.DataTypeName, - (column.Length > 0) ? ("(" + column.Length + ")") : ""); - sb.AppendFormat(" {0}", column.NotNull ? "NOT NULL" : "NULL"); - if (column.Default.Length > 0) - sb.AppendFormat(" DEFAULT {0}", column.Default); - column.Definition = sb.ToString(); - - collection.Add(column); - } - - r.Close (); - - return (ColumnSchema[]) collection.ToArray(typeof(ColumnSchema)); - } - - /// <summary> - /// Get a collection of views from the system. - /// </summary> - public override ViewSchema[] GetViews() - { - ArrayList collection = new ArrayList(); - - NpgsqlCommand command = new NpgsqlCommand(); - command.Connection = connection; - command.CommandText = - "SELECT v.schemaname, v.viewname, v.viewowner, v.definition," - + " (c.oid <= " + LastSystemOID + "), " - + "(SELECT description from pg_description pd, " - + " pg_class pc WHERE pc.oid=pd.objoid AND pc.relname=" - + " v.viewname) " - + "FROM pg_views v, pg_class c " - + "WHERE v.viewname = c.relname " - + "ORDER BY viewname"; - NpgsqlDataReader r = command.ExecuteReader(); - - while (r.Read()) { - ViewSchema view = new ViewSchema(); - view.Provider = this; - - try { - view.Name = r.GetString(1); - view.SchemaName = r.GetString(0); - view.OwnerName = r.GetString(2); - - StringBuilder sb = new StringBuilder(); - sb.AppendFormat ("-- View: {0}\n", view.Name); - sb.AppendFormat ("-- DROP VIEW {0};\n\n", view.Name); - sb.AppendFormat ("CREATE VIEW {0} AS (\n", view.Name); - string core = r.GetString(3); - sb.AppendFormat (" {0}\n);", core.Substring (0, core.Length-1)); - view.Definition = sb.ToString (); - - view.IsSystemView = (r.GetBoolean(4)); - view.Comment = r.GetString(5); - } catch { - } - - collection.Add(view); - } - - r.Close (); - - return (ViewSchema[]) collection.ToArray (typeof (ViewSchema)); - } - - /// <summary> - /// Get a collection of columns within a view - /// </summary> - public override ColumnSchema[] GetViewColumns(ViewSchema view) - { - if (IsOpen == false && Open() == false) - throw new Exception ("No connection to database"); - - ArrayList collection = new ArrayList(); - - NpgsqlCommand command = new NpgsqlCommand (); - command.Connection = connection; - command.CommandText = - "SELECT attname, typname, attlen, attnotnull " - + "FROM " - + " pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_attrdef adef " - + " ON a.attrelid=adef.adrelid " - + " AND a.attnum=adef.adnum " - + " LEFT JOIN pg_catalog.pg_type t ON a.atttypid=t.oid " - + "WHERE " - + " a.attrelid = (SELECT oid FROM pg_catalog.pg_class WHERE relname='" - + view.Name + "') " - + " AND a.attnum > 0 AND NOT a.attisdropped " - + " ORDER BY a.attnum;"; - NpgsqlDataReader r = command.ExecuteReader(); - - while (r.Read()) { - ColumnSchema column = new ColumnSchema(); - - try { - column.Name = r.GetString(0); - column.Provider = this; - column.DataTypeName = r.GetString(1); - column.Default = ""; - column.SchemaName = view.SchemaName; - column.Definition = ""; - column.NotNull = r.GetBoolean(3); - column.Length = r.GetInt32(2); - } catch { - } finally { - collection.Add(column); - } - } - - r.Close (); - - return (ColumnSchema[]) collection.ToArray (typeof(ColumnSchema)); - } - - /// <summary> - /// Get a collection of constraints within a a table. - /// </summary> - public override ConstraintSchema[] GetTableConstraints (TableSchema table) - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - - NpgsqlCommand command = new NpgsqlCommand (); - command.Connection = connection; - command.CommandText = String.Format ( - "SELECT " - + "pc.conname, " - + "pg_catalog.pg_get_constraintdef(pc.oid, true) AS consrc, " - + "pc.contype, " - + "CASE WHEN pc.contype='u' OR pc.contype='p' THEN ( " - + " SELECT " - + " indisclustered " - + " FROM " - + " pg_catalog.pg_depend pd, " - + " pg_catalog.pg_class pl, " - + " pg_catalog.pg_index pi " - + " WHERE " - + " pd.refclassid=pc.tableoid " - + " AND pd.refobjid=pc.oid " - + " AND pd.objid=pl.oid " - + " AND pl.oid=pi.indexrelid " - + ") ELSE " - + " NULL " - + "END AS indisclustered " - + "FROM " - + "pg_catalog.pg_constraint pc " - + "WHERE " - + "pc.conrelid = (SELECT oid FROM pg_catalog.pg_class WHERE relname='{0}' " - + " AND relnamespace = (SELECT oid FROM pg_catalog.pg_namespace " - + " WHERE nspname='{1}')) " - + "ORDER BY " - + "1;", table.Name, table.SchemaName); - NpgsqlDataReader r = command.ExecuteReader (); - - while (r.Read ()) { - ConstraintSchema constraint = null; - - // XXX: Add support for Check constraints. - switch (r.GetString(2)) { - case "f": - string match = @".*REFERENCES (.+)\(.*\).*"; - constraint = new ForeignKeyConstraintSchema (); - if (Regex.IsMatch (r.GetString (1), match)) - (constraint as ForeignKeyConstraintSchema).ReferenceTableName - = Regex.Match (r.GetString (1), match).Groups[0].Captures[0].Value; - break; - case "u": - constraint = new UniqueConstraintSchema (); - break; - case "p": - default: - constraint = new PrimaryKeyConstraintSchema (); - break; - } - - constraint.Name = r.GetString (0); - constraint.Definition = r.GetString (1); - - collection.Add (constraint); - } - - r.Close (); - - return (ConstraintSchema[]) collection.ToArray (typeof(ConstraintSchema)); - } - - public override UserSchema[] GetUsers () - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - - NpgsqlCommand command = new NpgsqlCommand (); - command.Connection = connection; - command.CommandText = "SELECT * FROM pg_user;"; - NpgsqlDataReader r = command.ExecuteReader (); - - while (r.Read ()) { - UserSchema user = new UserSchema (); - - user.Name = r.GetString (0); - user.UserId = String.Format ("{0}", r.GetValue (1)); - - try { user.Expires = r.GetDateTime (6); } - catch { user.Expires = DateTime.MinValue; } - - user.Options["createdb"] = r.GetBoolean (2); - user.Options["createuser"] = r.GetBoolean (3); - user.Password = r.GetString (5); - - StringBuilder sb = new StringBuilder (); - sb.AppendFormat ("-- User: \"{0}\"\n\n", user.Name); - sb.AppendFormat ("-- DROP USER {0};\n\n", user.Name); - sb.AppendFormat ("CREATE USER {0}", user.Name); - sb.AppendFormat (" WITH SYSID {0}", user.UserId); - if (user.Password != "********") - sb.AppendFormat (" ENCRYPTED PASSWORD {0}", user.Password); - sb.AppendFormat (((bool) user.Options["createdb"]) ? - " CREATEDB" : " NOCREATEDB"); - sb.AppendFormat (((bool) user.Options["createuser"]) ? - " CREATEUSER" : " NOCREATEUSER"); - if (user.Expires != DateTime.MinValue) - sb.AppendFormat (" VALID UNTIL {0}", user.Expires); - sb.Append (";"); - user.Definition = sb.ToString (); - - collection.Add (user); - } - - r.Close (); - - return (UserSchema[]) collection.ToArray (typeof (UserSchema)); - } - - public override ProcedureSchema[] GetProcedures () - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - - NpgsqlCommand command = new NpgsqlCommand (); - command.Connection = connection; - command.CommandText = - "SELECT pc.proname, pc.oid::integer, pl.lanname, pc.prosrc " - + "FROM " - + " pg_proc pc, " - + " pg_user pu, " - + " pg_type pt, " - + " pg_language pl " - + "WHERE pc.proowner = pu.usesysid " - + "AND pc.prorettype = pt.oid " - + "AND pc.prolang = pl.oid " - + "UNION " - + "SELECT pc.proname, pt.oid::integer, pl.lanname, pc.prosrc " - + "FROM " - + " pg_proc pc, " - + " pg_user pu, " - + " pg_type pt, " - + " pg_language pl " - + "WHERE pc.proowner = pu.usesysid " - + "AND pc.prorettype = 0 " - + "AND pc.prolang = pl.oid;"; - NpgsqlDataReader r = command.ExecuteReader (); - - while (r.Read ()) { - ProcedureSchema procedure = new ProcedureSchema (); - - procedure.Provider = this; - procedure.Name = r.GetString (0); - procedure.Definition = r.GetString (3); - procedure.LanguageName = r.GetString (2); - - try { - if (r.GetInt32 (1) <= LastSystemOID) - procedure.IsSystemProcedure = true; - } catch {} - - collection.Add (procedure); - } - - r.Close (); - - return (ProcedureSchema[]) collection.ToArray (typeof (ProcedureSchema)); - } - - public override ColumnSchema[] GetProcedureColumns (ProcedureSchema schema) - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - - // FIXME: Won't work properly with overload functions. - // Maybe check the number of columns in the parameters for - // proper match. - NpgsqlCommand command = new NpgsqlCommand (); - command.Connection = connection; - command.CommandText = String.Format ( - "SELECT format_type (prorettype, NULL) " - + "FROM pg_proc pc, pg_language pl " - + "WHERE pc.prolang = pl.oid " - + "AND pc.proname = '{0}';", schema.Name); - NpgsqlDataReader r = command.ExecuteReader (); - - while (r.Read ()) { - ColumnSchema column = new ColumnSchema (); - column.Provider = this; - - column.DataTypeName = r.GetString (0); - column.Name = r.GetString (0); - - collection.Add (column); - } - - r.Close (); - - return (ColumnSchema[]) collection.ToArray (typeof (ColumnSchema)); - } - } -} diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Providers/OdbcDbProvider.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Providers/OdbcDbProvider.cs deleted file mode 100644 index d97ec409a6..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Providers/OdbcDbProvider.cs +++ /dev/null @@ -1,299 +0,0 @@ -// -// Provider/OdbcDbProvider.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// Daniel Morgan <danielmorgan@verizon.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// Copyright (C) 2005 Daniel Morgan -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.Data; -using System.Text; -using System.Text.RegularExpressions; - -using System.Data.Odbc; - -namespace Mono.Data.Sql -{ - /// <summary> - /// Mono.Data.Sql provider for PostgreSQL databases. - /// </summary> - [Serializable] - public class OdbcDbProvider : DbProviderBase - { - protected OdbcConnection connection = null; - protected OdbcDataAdapter adapter = new OdbcDataAdapter(); - protected bool isConnectionStringWrong = false; - - /// <summary> - /// Default Constructor - /// </summary> - public OdbcDbProvider () : base () - { - } - - public override string ProviderName { - get { - return "Provider for ODBC Data Sources"; - } - } - - /// <summary> - /// Constructor with ADO.NET ODBC connection. - /// </summary> - public OdbcDbProvider (OdbcConnection conn) - { - connection = conn; - } - - /// <summary> - /// ADO.NET Connection - /// </summary> - public override IDbConnection Connection { - get { - if (connection == null) - connection = new OdbcConnection(); - - return (IDbConnection) connection; - } - } - - /// <summary> - /// Connection String - /// </summary> - public override string ConnectionString { - get { - return Connection.ConnectionString; - } - set { - if (IsOpen == true) - Close(); - - Connection.ConnectionString = value; - isConnectionStringWrong = false; - } - } - - /// <summary> - /// Is the connection open - /// </summary> - public override bool IsOpen { - get { - return Connection.State == ConnectionState.Open; - } - } - - /// <summary> - /// Is the last used connection string wrong - /// </summary> - public override bool IsConnectionStringWrong { - get { - return isConnectionStringWrong; - } - } - - /// <summary> - /// Open the connection. Returns true on success. - /// </summary> - public override bool Open() - { - try { - Connection.Open(); - } catch { - isConnectionStringWrong = true; - } - OnOpen (); - return IsOpen; - } - - /// <summary> - /// Close the database connection. - /// </summary> - public override void Close() - { - Connection.Close(); - OnClose(); - } - - /// <summary> - /// Do we support the passed schema type - /// </summary> - public override bool SupportsSchemaType(Type type) - { - if (type == typeof(TableSchema)) - return true; - else if (type == typeof(ViewSchema)) - return true; - else if (type == typeof(ProcedureSchema)) - return true; - else if (type == typeof(AggregateSchema)) - return true; - else if (type == typeof(GroupSchema)) - return true; - else if (type == typeof(UserSchema)) - return true; - else if (type == typeof(LanguageSchema)) - return true; - else if (type == typeof(OperatorSchema)) - return true; - else if (type == typeof(RoleSchema)) - return true; - else if (type == typeof(SequenceSchema)) - return true; - else if (type == typeof(DataTypeSchema)) - return true; - else if (type == typeof(TriggerSchema)) - return true; - else if (type == typeof(ColumnSchema)) - return true; - else if (type == typeof(ConstraintSchema)) - return true; - else if (type == typeof(RuleSchema)) - return true; - else - return false; - } - - /// <summary> - /// Thread safe SQL execution. - /// </summary> - public override DataTable ExecuteSQL(string SQLText) - { - try { - OdbcCommand command = new OdbcCommand(); - command.Connection = connection; - command.CommandText = SQLText; - - DataSet resultSet = new DataSet (); - - lock(adapter) { - adapter.SelectCommand = command; - adapter.Fill(resultSet); - } - - return resultSet.Tables[0]; - } catch { - return null; - } - } - - /// <summary> - /// Get a list of tables in the system. - /// </summary> - public override TableSchema[] GetTables() - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - // TODO: - return (TableSchema[]) collection.ToArray (typeof (TableSchema)); - } - - /// <summary> - /// Get columns for a table. - /// </summary> - public override ColumnSchema[] GetTableColumns(TableSchema table) - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList(); - // TODO: - return (ColumnSchema[]) collection.ToArray(typeof(ColumnSchema)); - } - - /// <summary> - /// Get a collection of views from the system. - /// </summary> - public override ViewSchema[] GetViews() - { - ArrayList collection = new ArrayList(); - // TODO: - return (ViewSchema[]) collection.ToArray (typeof (ViewSchema)); - } - - /// <summary> - /// Get a collection of columns within a view - /// </summary> - public override ColumnSchema[] GetViewColumns(ViewSchema view) - { - if (IsOpen == false && Open() == false) - throw new Exception ("No connection to database"); - - ArrayList collection = new ArrayList(); - // TODO: - - return (ColumnSchema[]) collection.ToArray (typeof(ColumnSchema)); - } - - /// <summary> - /// Get a collection of constraints within a a table. - /// </summary> - public override ConstraintSchema[] GetTableConstraints (TableSchema table) - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - // TODO: - - return (ConstraintSchema[]) collection.ToArray (typeof(ConstraintSchema)); - } - - public override UserSchema[] GetUsers () - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - // TODO: - return (UserSchema[]) collection.ToArray (typeof (UserSchema)); - } - - public override ProcedureSchema[] GetProcedures () - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - - // TODO: - return (ProcedureSchema[]) collection.ToArray (typeof (ProcedureSchema)); - } - - public override ColumnSchema[] GetProcedureColumns (ProcedureSchema schema) - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - // TODO: - return (ColumnSchema[]) collection.ToArray (typeof (ColumnSchema)); - } - } -} - diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Providers/OracleDbProvider.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Providers/OracleDbProvider.cs deleted file mode 100644 index a49316c446..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Providers/OracleDbProvider.cs +++ /dev/null @@ -1,424 +0,0 @@ -// -// Provider/OracleDbProvider.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// Daniel Morgan <danielmorgan@verizon.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// Copyright (C) 2005 Daniel Morgan -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.Data; -using System.Text; -using System.Text.RegularExpressions; - -using System.Data.OracleClient; - -namespace Mono.Data.Sql -{ - /// <summary> - /// Mono.Data.Sql provider for Orace databases. - /// </summary> - [Serializable] - public class OracleDbProvider : DbProviderBase - { - protected OracleConnection connection = null; - protected OracleDataAdapter adapter = new OracleDataAdapter(); - protected bool isConnectionStringWrong = false; - - public override string ProviderName { - get { - return "Oracle 8i/9i/10g"; - } - } - - /// <summary> - /// ADO.NET Connection - /// </summary> - public override IDbConnection Connection { - get { - if (connection == null) { - connection = new OracleConnection(); - } - - return (IDbConnection) connection; - } - } - - /// <summary> - /// Connection String - /// </summary> - public override string ConnectionString { - get { - return Connection.ConnectionString; - } - set { - if (IsOpen == true) - Close(); - - Connection.ConnectionString = value; - isConnectionStringWrong = false; - } - } - - /// <summary> - /// Is the connection open - /// </summary> - public override bool IsOpen { - get { - return Connection.State == ConnectionState.Open; - } - } - - /// <summary> - /// Is the last used connection string wrong - /// </summary> - public override bool IsConnectionStringWrong { - get { - return isConnectionStringWrong; - } - } - - /// <summary> - /// Open the connection. Returns true on success. - /// </summary> - public override bool Open() - { - try { - Connection.Open(); - } catch { - isConnectionStringWrong = true; - } - OnOpen(); - return IsOpen; - } - - /// <summary> - /// Close the database connection. - /// </summary> - public override void Close() - { - Connection.Close(); - OnClose(); - } - - /// <summary> - /// Do we support the passed schema type - /// </summary> - public override bool SupportsSchemaType(Type type) - { - if (type == typeof(TableSchema)) - return true; - else if (type == typeof(ColumnSchema)) - return true; - else if (type == typeof(ViewSchema)) - return true; - else if (type == typeof(ProcedureSchema)) - return true; - else if (type == typeof(UserSchema)) - return true; - else if (type == typeof(SequenceSchema)) - return true; - else if (type == typeof(TriggerSchema)) - return true; - else - return false; - } - - /// <summary> - /// Thread safe SQL execution. - /// </summary> - public override DataTable ExecuteSQL(string SQLText) - { - try { - OracleCommand command = new OracleCommand(); - command.Connection = connection; - command.CommandText = SQLText; - - DataSet resultSet = new DataSet (); - - lock(adapter) { - adapter.SelectCommand = command; - adapter.Fill(resultSet); - } - - return resultSet.Tables[0]; - } catch { - return null; - } - } - - private bool IsSystem(string owner) - { - switch(owner) { - case "SYSTEM": - case "SYS": - case "DRSYS": - case "CTXSYS": - case "MDSYS": - case "WKSYS": - return true; - } - - return false; - } - - - /// <summary> - /// Get a list of tables in the system. - /// </summary> - public override TableSchema[] GetTables() - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection."); - - ArrayList collection = new ArrayList(); - - OracleCommand command = new OracleCommand(); - command.Connection = connection; - command.CommandText = - "SELECT OWNER, TABLE_NAME, TABLESPACE_NAME " + - "FROM ALL_TABLES " + - "ORDER BY OWNER, TABLE_NAME"; - OracleDataReader r = command.ExecuteReader(); - - while (r.Read()) { - TableSchema table = new TableSchema(); - table.Provider = this; - table.OwnerName = r.GetValue(0).ToString(); - table.SchemaName = r.GetValue(0).ToString(); - table.Name = r.GetString(1).ToString(); - table.IsSystemTable = IsSystem(table.OwnerName); - table.TableSpaceName = r.GetValue(2).ToString(); - - StringBuilder sb = new StringBuilder(); - sb.AppendFormat ("-- Table: {0}\n", table.Name); - sb.AppendFormat ("-- DROP TABLE {0};\n\n", table.Name); - sb.AppendFormat ("CREATE TABLE {0} (\n", table.Name); - - ColumnSchema[] columns = table.Columns; - string[] parts = new string[columns.Length]; - for (int i = 0; i < parts.Length; i++) { - parts[i] = "\t" + columns[i].Definition; - } - sb.Append (String.Join (",\n", parts)); - - ConstraintSchema[] cons = table.Constraints; - parts = new string[cons.Length]; - if (cons.Length > 0) - sb.Append (",\n"); - for (int i = 0; i < parts.Length; i++) { - parts[i] = "\t" + cons[i].Definition; - } - sb.Append (String.Join (",\n", parts)); - - //sb.AppendFormat ("\n) COMMENT '{0}';", table.Comment); - table.Definition = ""; - collection.Add (table); - } - - return (TableSchema[]) collection.ToArray(typeof(TableSchema)); - } - - private int GetInt (IDataReader reader, int field) - { - if (reader.IsDBNull(field) == true) - return 0; - - object v = reader.GetValue(field); - string ds = v.ToString(); - int iss = Int32.Parse(ds); - return iss; - } - - /// <summary> - /// Get columns for a table. - /// </summary> - public override ColumnSchema[] GetTableColumns(TableSchema table) - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection."); - - ArrayList collection = new ArrayList(); - - OracleCommand command = new OracleCommand(); - command.Connection = connection; - command.CommandText = - "SELECT OWNER, TABLE_NAME, COLUMN_NAME, " + - " DATA_TYPE, DATA_LENGTH, DATA_PRECISION, DATA_SCALE, " + - " NULLABLE, COLUMN_ID, DEFAULT_LENGTH, DATA_DEFAULT " + - "FROM ALL_TAB_COLUMNS " + - "WHERE OWNER = '" + table.OwnerName + "' " + - "AND TABLE_NAME = '" + table.Name + "' " + - "ORDER BY OWNER, TABLE_NAME, COLUMN_ID"; - OracleDataReader r = command.ExecuteReader(); - - while (r.Read()) { - ColumnSchema column = new ColumnSchema(); - - try { column.Name = r.GetValue(2).ToString(); } catch {} - column.Provider = this; - try { column.DataTypeName = r.GetValue(3).ToString(); } catch {} - column.Default = ""; - column.Comment = ""; - column.OwnerName = table.OwnerName; - column.SchemaName = table.OwnerName; - - try { column.NotNull = r.GetValue(7).ToString() == "Y" ? true : false; } catch {} - - try { column.Length = GetInt(r, 4); } catch {} - try { column.Precision = GetInt(r, 5); } catch {} - try { column.Scale = GetInt(r, 6); } catch {} - - try { column.ColumnID = GetInt(r, 8); } catch {} - - StringBuilder sb = new StringBuilder(); - sb.AppendFormat("{0} {1}{2}", - column.Name, - column.DataTypeName, - (column.Length > 0) ? ("(" + column.Length + ")") : ""); - sb.AppendFormat(" {0}", column.NotNull ? "NOT NULL" : "NULL"); - //if (column.Default.Length > 0) - // sb.AppendFormat(" DEFAULT {0}", column.Default); - column.Definition = sb.ToString(); - - collection.Add(column); - } - - return (ColumnSchema[]) collection.ToArray(typeof(ColumnSchema)); - } - - /// <summary> - /// Get a collection of views from the system. - /// </summary> - public override ViewSchema[] GetViews() - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection."); - - ArrayList collection = new ArrayList(); - - OracleCommand command = new OracleCommand(); - command.Connection = connection; - command.CommandText = - "SELECT OWNER, VIEW_NAME, TEXT " + - "FROM ALL_VIEWS " + - "ORDER BY OWNER, VIEW_NAME"; - OracleDataReader r = command.ExecuteReader(); - - while (r.Read()) { - ViewSchema view = new ViewSchema(); - view.Provider = this; - - try { - view.Name = r.GetString(1); - view.SchemaName = r.GetString(0); - view.OwnerName = r.GetString(0); - view.Definition = r.GetString(2); - view.IsSystemView = IsSystem (view.OwnerName); - view.Comment = ""; - } catch { - } - - collection.Add(view); - } - - return (ViewSchema[]) collection.ToArray (typeof(ViewSchema)); - } - - /// <summary> - /// Get a collection of columns within a view - /// </summary> - public override ColumnSchema[] GetViewColumns(ViewSchema view) - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection."); - - ArrayList collection = new ArrayList(); - - OracleCommand command = new OracleCommand (); - command.Connection = connection; - command.CommandText = - "SELECT * " + - " FROM " + view.Name + - " WHERE 1 = 0"; - OracleDataReader r = command.ExecuteReader(); - - for (int i = 0; i < r.FieldCount; i++) { - ColumnSchema column = new ColumnSchema(); - - column.Name = r.GetName(i); - column.DataTypeName = r.GetDataTypeName(i); - column.Default = ""; - column.Definition = ""; - column.OwnerName = view.OwnerName; - column.SchemaName = view.OwnerName; - - collection.Add(column); - } - - return (ColumnSchema[]) collection.ToArray (typeof(ColumnSchema)); - } - - /// <summary> - /// Get a collection of constraints within a a table. - /// </summary> - public override ConstraintSchema[] GetTableConstraints (TableSchema table) - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection."); - - ArrayList collection = new ArrayList (); - - OracleCommand command = new OracleCommand (); - command.Connection = connection; - command.CommandText = - "SELECT k.owner, k.table_name, k.constraint_name, " + - " k.constraint_type, k.status, k.validated " + - "FROM all_constraints k " + - "WHERE k.owner = '" + table.OwnerName + "' " + - "AND k.table_name = '" + table.Name + "' " + - "and k.constraint_type = 'P'"; - OracleDataReader r = command.ExecuteReader (); - - while (r.Read ()) { - ConstraintSchema constraint = null; - switch (r.GetString(4)) { - case "P": - default: - constraint = new PrimaryKeyConstraintSchema(); - break; - } - - constraint.Name = r.GetString (3); - constraint.Definition = ""; - - collection.Add (constraint); - } - - return (ConstraintSchema[]) collection.ToArray (typeof(ConstraintSchema)); - } - } -} diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Providers/SqlDbProvider.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Providers/SqlDbProvider.cs deleted file mode 100644 index b210067976..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Providers/SqlDbProvider.cs +++ /dev/null @@ -1,531 +0,0 @@ -// -// Provider/SqlDbProvider.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// Daniel Morgan <danielmorgan@verizon.net> -// Sureshkumar T <tsureshkumar@novell.com> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.Data; -using System.Text; -using System.Text.RegularExpressions; - -using System.Data.SqlClient; - -namespace Mono.Data.Sql -{ - /// <summary> - /// Mono.Data.Sql provider for SqlServer databases. - /// </summary> - [Serializable] - public class SqlDbProvider : DbProviderBase - { - protected SqlConnection connection = null; - protected SqlDataAdapter adapter = new SqlDataAdapter(); - protected bool isConnectionStringWrong = false; - - /// <summary> - /// Default Constructor - /// </summary> - public SqlDbProvider () : base () - { - } - - public override string ProviderName { - get { - return "SQL Server Database"; - } - } - - /// <summary> - /// Constructor with ADO.NET Sql connection. - /// </summary> - public SqlDbProvider (SqlConnection conn) - { - connection = conn; - } - - /// <summary> - /// ADO.NET Connection - /// </summary> - public override IDbConnection Connection { - get { - if (connection == null) - connection = new SqlConnection(); - - return (IDbConnection) connection; - } - } - - /// <summary> - /// Connection String - /// </summary> - public override string ConnectionString { - get { - return Connection.ConnectionString; - } - set { - if (IsOpen == true) - Close(); - - Connection.ConnectionString = value; - isConnectionStringWrong = false; - } - } - - /// <summary> - /// Is the connection open - /// </summary> - public override bool IsOpen { - get { - return Connection.State == ConnectionState.Open; - } - } - - /// <summary> - /// Is the last used connection string wrong - /// </summary> - public override bool IsConnectionStringWrong { - get { - return isConnectionStringWrong; - } - } - - /// <summary> - /// Open the connection. Returns true on success. - /// </summary> - public override bool Open() - { - try { - Connection.Open(); - } catch { - isConnectionStringWrong = true; - } - OnOpen (); - return IsOpen; - } - - /// <summary> - /// Close the database connection. - /// </summary> - public override void Close() - { - Connection.Close(); - OnClose(); - } - - /// <summary> - /// Do we support the passed schema type - /// </summary> - public override bool SupportsSchemaType(Type type) - { - if (type == typeof(TableSchema)) - return true; - else if (type == typeof(ColumnSchema)) - return true; - else if (type == typeof(ViewSchema)) - return true; - else if (type == typeof(ProcedureSchema)) - return true; - else if (type == typeof(UserSchema)) - return true; - else if (type == typeof(SequenceSchema)) - return true; - else if (type == typeof(TriggerSchema)) - return true; - else - return false; - } - - /// <summary> - /// Thread safe SQL execution. - /// </summary> - public override DataTable ExecuteSQL(string SQLText) - { - try { - SqlCommand command = new SqlCommand(); - command.Connection = connection; - command.CommandText = SQLText; - - DataSet resultSet = new DataSet (); - - lock(adapter) { - adapter.SelectCommand = command; - adapter.Fill(resultSet); - } - - return resultSet.Tables[0]; - } catch { - return null; - } - } - - /// <summary> - /// Get a list of tables in the system. - /// </summary> - public override TableSchema[] GetTables() - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - - SqlCommand command = new SqlCommand(); - command.Connection = connection; - command.CommandText = - "SELECT su.name AS owner, so.name as table_name, so.id as table_id, " + - " so.crdate as created_date, so.xtype as table_type " + - " FROM dbo.sysobjects so, dbo.sysusers su " + - "WHERE xtype IN ('S','U') " + - "AND su.uid = so.uid " + - "ORDER BY 1, 2"; - SqlDataReader r = command.ExecuteReader(); - - while (r.Read()) { - TableSchema table = new TableSchema(); - table.Provider = this; - table.Name = r.GetString(1); - - table.IsSystemTable = r.GetString(4) == "S" ? true : false; - - table.SchemaName = r.GetString(0); - table.OwnerName = r.GetString(0); - table.Comment = ""; - - StringBuilder sb = new StringBuilder(); - sb.AppendFormat ("-- Table: {0}\n", table.Name); - sb.AppendFormat ("-- DROP TABLE {0};\n\n", table.Name); - sb.AppendFormat ("CREATE TABLE {0} (\n", table.Name); - - ColumnSchema[] columns = table.Columns; - string[] parts = new string[columns.Length]; - for (int i = 0; i < parts.Length; i++) { - parts[i] = "\t" + columns[i].Definition; - } - sb.Append (String.Join (",\n", parts)); - - ConstraintSchema[] cons = table.Constraints; - parts = new string[cons.Length]; - if (cons.Length > 0) - sb.Append (",\n"); - for (int i = 0; i < parts.Length; i++) { - parts[i] = "\t" + cons[i].Definition; - } - sb.Append (String.Join (",\n", parts)); - - sb.Append ("\n);\n"); - //sb.AppendFormat ("COMMENT ON TABLE {0} IS '{1}';", table.Name, table.Comment); - table.Definition = sb.ToString(); - collection.Add (table); - } - r.Close (); - r = null; - command.Dispose (); - command = null; - - return (TableSchema[]) collection.ToArray (typeof (TableSchema)); - } - - /// <summary> - /// Get columns for a table. - /// </summary> - public override ColumnSchema[] GetTableColumns(TableSchema table) - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList(); - SqlConnection con2 = (SqlConnection) (((ICloneable) connection).Clone ()); - if (con2.State == ConnectionState.Closed) - con2.Open(); - SqlCommand command = con2.CreateCommand (); - - command.CommandText = - "SELECT su.name as owner, so.name as table_name, " + - " sc.name as column_name, " + - " st.name as date_type, sc.length as column_length, " + - " sc.xprec as data_preceision, sc.xscale as data_scale, " + - " sc.isnullable, sc.colid as column_id " + - "FROM dbo.syscolumns sc, dbo.sysobjects so, " + - " dbo.systypes st, dbo.sysusers su " + - "WHERE sc.id = so.id " + - "AND so.xtype in ('U','S') " + - "AND so.name = 'employee' " + - "AND su.name = 'dbo' " + - "AND sc.xusertype = st.xusertype " + - "AND su.uid = so.uid " + - "ORDER BY sc.colid"; - SqlDataReader r = command.ExecuteReader(); - - while (r.Read()) { - ColumnSchema column = new ColumnSchema(); - - try { column.Name = r.GetString(2); } catch {} - column.Provider = this; - try { column.DataTypeName = r.GetString(3); } catch {} - try { column.Default = ""; } catch {} - column.Comment = ""; - column.OwnerName = table.OwnerName; - column.SchemaName = table.OwnerName; - try { column.NotNull = r.GetValue(7).ToString() == "0" ? true : false; } catch {} - try { column.Length = r.GetInt32(4); } catch {} - //try { column.Precision = GetInt(r, 5)); } catch {} - //try { column.Scale = GetIn(r, 6); } catch {} - - StringBuilder sb = new StringBuilder(); - sb.AppendFormat("{0} {1}{2}", - column.Name, - column.DataTypeName, - (column.Length > 0) ? ("(" + column.Length + ")") : ""); - sb.AppendFormat(" {0}", column.NotNull ? "NOT NULL" : "NULL"); - //if (column.Default.Length > 0) - // sb.AppendFormat(" DEFAULT {0}", column.Default); - column.Definition = sb.ToString(); - - collection.Add(column); - } - r.Close (); - r = null; - command.Dispose (); - command = null; - con2.Close (); - con2 = null; - - return (ColumnSchema[]) collection.ToArray(typeof(ColumnSchema)); - } - - private string GetSource (string objectName) - { - string sql = String.Format ("EXEC [master].[dbo].[sp_helptext] '{0}', null", objectName); - SqlConnection con2 = (SqlConnection) (((ICloneable) connection).Clone ()); - if (con2.State == ConnectionState.Closed) - con2.Open(); - SqlCommand cmd = con2.CreateCommand (); - cmd.CommandText = sql; - IDataReader reader = cmd.ExecuteReader (); - - StringBuilder sb = new StringBuilder (); - - while (reader.Read ()) { - string text = reader.GetString (0); - sb.Append (text); - } - - reader.Close (); - reader = null; - cmd.Dispose (); - cmd = null; - con2.Close (); - con2 = null; - - return sb.ToString (); - } - - /// <summary> - /// Get a collection of views from the system. - /// </summary> - public override ViewSchema[] GetViews() - { - ArrayList collection = new ArrayList(); - - SqlCommand command = new SqlCommand(); - command.Connection = connection; - command.CommandText = - "SELECT su.name AS owner, so.name as table_name, so.id as table_id, " + - " so.crdate as created_date, so.xtype as table_type " + - "FROM dbo.sysobjects so, dbo.sysusers su " + - "WHERE xtype = 'V' " + - "AND su.uid = so.uid " + - "ORDER BY 1, 2"; - SqlDataReader r = command.ExecuteReader(); - - while (r.Read()) { - ViewSchema view = new ViewSchema(); - view.Provider = this; - - try { - view.Name = r.GetString(1); - view.SchemaName = r.GetString(0); - view.OwnerName = r.GetString(0); - - StringBuilder sb = new StringBuilder(); - sb.AppendFormat ("-- View: {0}\n", view.Name); - sb.AppendFormat ("-- DROP VIEW {0};\n\n", view.Name); - string source = GetSource(view.Owner + "." + view.Name); - sb.AppendFormat (" {0}\n);", source); - view.Definition = sb.ToString (); - //view.Comment = r.GetString(5); - } catch { - } - - collection.Add(view); - } - r.Close (); - r = null; - command.Dispose(); - command = null; - - return (ViewSchema[]) collection.ToArray (typeof (ViewSchema)); - } - - /// <summary> - /// Get a collection of columns within a view - /// </summary> - public override ColumnSchema[] GetViewColumns(ViewSchema view) - { - if (IsOpen == false && Open() == false) - throw new Exception ("No connection to database"); - - ArrayList collection = new ArrayList(); - - SqlConnection con2 = (SqlConnection) (((ICloneable) connection).Clone ()); - if (con2.State == ConnectionState.Closed) - con2.Open(); - SqlCommand command = con2.CreateCommand (); - command.CommandText = - "SELECT * " + - " FROM " + view.Name + - " WHERE 1 = 0"; - SqlDataReader r = command.ExecuteReader(); - - for (int i = 0; i < r.FieldCount; i++) { - ColumnSchema column = new ColumnSchema(); - - column.Name = r.GetName(i); - column.DataTypeName = r.GetDataTypeName(i); - column.Default = ""; - column.Definition = ""; - column.OwnerName = view.OwnerName; - column.SchemaName = view.OwnerName; - - collection.Add(column); - } - - command.Dispose (); - command = null; - con2.Close (); - con2 = null; - - return (ColumnSchema[]) collection.ToArray (typeof(ColumnSchema)); - } - - /// <summary> - /// Get a collection of constraints within a a table. - /// </summary> - public override ConstraintSchema[] GetTableConstraints (TableSchema table) - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - - return (ConstraintSchema[]) collection.ToArray (typeof(ConstraintSchema)); - } - - public override UserSchema[] GetUsers () - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - - return (UserSchema[]) collection.ToArray (typeof (UserSchema)); - } - - public override ProcedureSchema[] GetProcedures () - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - - using (SqlCommand cmd = connection.CreateCommand ()) { - cmd.CommandText = "SELECT su.name AS owner, so.name as proc_name, so.id as proc_id, " + - " so.crdate as created_date, so.xtype as proc_type " + - "FROM dbo.sysobjects so, dbo.sysusers su " + - "WHERE xtype = 'P' " + - "AND su.uid = so.uid " + - "ORDER BY 1, 2"; - using (SqlDataReader reader = cmd.ExecuteReader ()) { - while (reader.Read ()) { - ProcedureSchema proc = new ProcedureSchema (); - proc.Provider = this; - proc.Name = (string) reader ["proc_name"]; - proc.OwnerName = (string) reader ["owner"]; - proc.LanguageName = "TSQL"; - - // FIXME : get sysproc or not - collection.Add (proc); - } - } - - // get procedure text - cmd.CommandType = CommandType.StoredProcedure; - cmd.CommandText = "sp_helptext"; - SqlParameter param = cmd.Parameters.Add ("@objname", SqlDbType.VarChar); - foreach (ProcedureSchema proc in collection) { - param.Value = proc.Name; - using (SqlDataReader reader = cmd.ExecuteReader ()) { - if (reader.Read ()) - proc.Definition = (string) reader [0]; - } - } - } - - return (ProcedureSchema []) collection.ToArray (typeof (ProcedureSchema)); - } - - public override ColumnSchema[] GetProcedureColumns (ProcedureSchema schema) - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - - using (SqlCommand cmd = connection.CreateCommand ()) { - cmd.CommandType = CommandType.StoredProcedure; - cmd.CommandText = "sp_sproc_columns"; - SqlParameter owner = cmd.Parameters.Add ("@procedure_owner", SqlDbType.VarChar); - SqlParameter name = cmd.Parameters.Add ("@procedure_name", SqlDbType.VarChar); - owner.Value = schema.OwnerName; - name.Value = schema.Name; - using (SqlDataReader reader = cmd.ExecuteReader ()) { - while (reader.Read ()) { - ColumnSchema column = new ColumnSchema (); - column.Provider = this; - column.Name = (string) reader ["COLUMN_NAME"]; - column.DataTypeName = (string) reader ["TYPE_NAME"]; - - collection.Add (column); - } - } - } - - return (ColumnSchema []) collection.ToArray (typeof (ColumnSchema)); - } - } -} diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Providers/SqliteDbProvider.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Providers/SqliteDbProvider.cs deleted file mode 100644 index da5e541040..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Providers/SqliteDbProvider.cs +++ /dev/null @@ -1,209 +0,0 @@ -// -// Providers/SqliteDbProvider.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// Ankit Jain <radical@corewars.org> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.Data; - -using Mono.Data.SqliteClient; - -namespace Mono.Data.Sql -{ - [Serializable] - public class SqliteDbProvider : DbProviderBase - { - protected SqliteConnection connection = null; - protected SqliteDataAdapter adapter = new SqliteDataAdapter (); - protected bool isConnectionStringWrong = false; - - public override string ProviderName { - get { - return "SQLite Database"; - } - } - - public override IDbConnection Connection { - get { - if (connection == null) - connection = new SqliteConnection (); - - return (IDbConnection) connection; - } - } - - public override string ConnectionString { - get { - return Connection.ConnectionString; - } - set { - if (IsOpen) - Close (); - - Connection.ConnectionString = value; - isConnectionStringWrong = false; - } - } - - public override bool IsOpen { - get { - return Connection.State == ConnectionState.Open; - } - } - - public override bool IsConnectionStringWrong { - get { - return isConnectionStringWrong; - } - } - - public override bool Open () - { - try { - Connection.Open (); - OnOpen (); - } catch { - isConnectionStringWrong = true; - } - - return IsOpen; - } - - public override void Close () - { - Connection.Close (); - OnClose (); - } - - public override bool SupportsSchemaType(Type type) - { - if (type == typeof(TableSchema)) - return true; - if (type == typeof(ColumnSchema)) - return true; - else if (type == typeof(UserSchema)) - return false; - else - return false; - } - - public override DataTable ExecuteSQL (string SQLText) - { - try { - SqliteCommand command = new SqliteCommand (); - command.Connection = connection; - command.CommandText = SQLText; - - DataSet resultSet = new DataSet (); - - lock (adapter) { - adapter.SelectCommand = command; - adapter.Fill (resultSet); - } - - return resultSet.Tables [0]; - } catch { - return null; - } - } - - public override ViewSchema[] GetViews () - { - throw new NotImplementedException (); - } - - public override TableSchema[] GetTables () - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - - using (SqliteCommand command = new SqliteCommand ()) { - command.CommandText = "select * from sqlite_master where type = 'table'"; - command.Connection = this.connection; - - SqliteDataReader r = command.ExecuteReader (); - - while (r.Read ()) { - TableSchema table = new TableSchema (); - table.Provider = this; - - table.Name = r.GetString (1); - collection.Add (table); - } - - r.Close (); - } - - return (TableSchema []) collection.ToArray (typeof (TableSchema)); - } - - public override ColumnSchema[] GetTableColumns (TableSchema table) - { - if ( IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - - using (SqliteCommand command = new SqliteCommand()) { - command.CommandText = "PRAGMA table_info('" + table.Name + "')"; - command.Connection = this.connection; - - SqliteDataReader r = command.ExecuteReader (); - - while (r.Read ()) { - ColumnSchema column = new ColumnSchema (); - column.Provider = this; - - column.ColumnID = r.GetInt32 (0); - column.Name = r.GetString (1); - column.DataTypeName = r.GetString (2); - column.NotNull = r.IsDBNull (3); - column.Default = r.GetString (4); - - collection.Add (column); - } - - r.Close (); - } - - return (ColumnSchema[]) collection.ToArray (typeof (ColumnSchema)); - } - - public override ColumnSchema[] GetViewColumns (ViewSchema view) - { - throw new NotImplementedException (); - } - - public override ConstraintSchema[] GetTableConstraints (TableSchema table) - { - throw new NotImplementedException (); - } - } -} diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Providers/SybaseDbProvider.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Providers/SybaseDbProvider.cs deleted file mode 100644 index 6c59c12238..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Providers/SybaseDbProvider.cs +++ /dev/null @@ -1,463 +0,0 @@ -// -// Provider/SybaseDbProvider.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// Daniel Morgan <danielmorgan@verizon.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.Data; -using System.Text; -using System.Text.RegularExpressions; - -using Mono.Data.SybaseClient; - -namespace Mono.Data.Sql -{ - /// <summary> - /// Mono.Data.Sql provider for PostgreSQL databases. - /// </summary> - [Serializable] - public class SybaseDbProvider : DbProviderBase - { - protected SybaseConnection connection = null; - protected SybaseDataAdapter adapter = new SybaseDataAdapter(); - protected bool isConnectionStringWrong = false; - - /// <summary> - /// Default Constructor - /// </summary> - public SybaseDbProvider () : base () - { - } - - public override string ProviderName { - get { - return "Sybase ASE Database"; - } - } - - /// <summary> - /// Constructor with ADO.NET Sql connection. - /// </summary> - public SybaseDbProvider (SybaseConnection conn) - { - connection = conn; - } - - /// <summary> - /// ADO.NET Connection - /// </summary> - public override IDbConnection Connection { - get { - if (connection == null) - connection = new SybaseConnection(); - - return (IDbConnection) connection; - } - } - - /// <summary> - /// Connection String - /// </summary> - public override string ConnectionString { - get { - return Connection.ConnectionString; - } - set { - if (IsOpen == true) - Close(); - - Connection.ConnectionString = value; - isConnectionStringWrong = false; - } - } - - /// <summary> - /// Is the connection open - /// </summary> - public override bool IsOpen { - get { - return Connection.State == ConnectionState.Open; - } - } - - /// <summary> - /// Is the last used connection string wrong - /// </summary> - public override bool IsConnectionStringWrong { - get { - return isConnectionStringWrong; - } - } - - /// <summary> - /// Open the connection. Returns true on success. - /// </summary> - public override bool Open() - { - try { - Connection.Open(); - } catch { - isConnectionStringWrong = true; - } - OnOpen (); - return IsOpen; - } - - /// <summary> - /// Close the database connection. - /// </summary> - public override void Close() - { - Connection.Close(); - OnClose(); - } - - /// <summary> - /// Do we support the passed schema type - /// </summary> - public override bool SupportsSchemaType(Type type) - { - if (type == typeof(TableSchema)) - return true; - else if (type == typeof(ColumnSchema)) - return true; - else if (type == typeof(ViewSchema)) - return true; - else if (type == typeof(ProcedureSchema)) - return true; - else if (type == typeof(UserSchema)) - return true; - else if (type == typeof(SequenceSchema)) - return true; - else if (type == typeof(TriggerSchema)) - return true; - else - return false; - } - - /// <summary> - /// Thread safe SQL execution. - /// </summary> - public override DataTable ExecuteSQL(string SQLText) - { - try { - SybaseCommand command = new SybaseCommand(); - command.Connection = connection; - command.CommandText = SQLText; - - DataSet resultSet = new DataSet (); - - lock(adapter) { - adapter.SelectCommand = command; - adapter.Fill(resultSet); - } - - return resultSet.Tables[0]; - } catch { - return null; - } - } - - /// <summary> - /// Get a list of tables in the system. - /// </summary> - public override TableSchema[] GetTables() - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - - SybaseCommand command = new SybaseCommand(); - command.Connection = connection; - command.CommandText = - "SELECT su.name AS owner, so.name as table_name, so.id as table_id, " + - " so.crdate as created_date, so.type as table_type " + - "FROM dbo.sysobjects so, dbo.sysusers su " + - "WHERE type IN ('S','U') " + - "AND su.uid = so.uid " + - "ORDER BY 1, 2"; - SybaseDataReader r = command.ExecuteReader(); - - while (r.Read()) { - TableSchema table = new TableSchema(); - table.Provider = this; - table.Name = r.GetString(1); - - table.IsSystemTable = r.GetString(4) == "S" ? true : false; - - table.SchemaName = r.GetString(0); - table.OwnerName = r.GetString(0); - table.Comment = ""; - - StringBuilder sb = new StringBuilder(); - sb.AppendFormat ("-- Table: {0}\n", table.Name); - sb.AppendFormat ("-- DROP TABLE {0};\n\n", table.Name); - sb.AppendFormat ("CREATE TABLE {0} (\n", table.Name); - - ColumnSchema[] columns = table.Columns; - string[] parts = new string[columns.Length]; - for (int i = 0; i < parts.Length; i++) { - parts[i] = "\t" + columns[i].Definition; - } - sb.Append (String.Join (",\n", parts)); - - ConstraintSchema[] cons = table.Constraints; - parts = new string[cons.Length]; - if (cons.Length > 0) - sb.Append (",\n"); - for (int i = 0; i < parts.Length; i++) { - parts[i] = "\t" + cons[i].Definition; - } - sb.Append (String.Join (",\n", parts)); - - sb.Append ("\n);\n"); - //sb.AppendFormat ("COMMENT ON TABLE {0} IS '{1}';", table.Name, table.Comment); - table.Definition = sb.ToString(); - collection.Add (table); - } - r.Close (); - r = null; - command.Dispose (); - command = null; - - return (TableSchema[]) collection.ToArray (typeof (TableSchema)); - } - - /// <summary> - /// Get columns for a table. - /// </summary> - public override ColumnSchema[] GetTableColumns(TableSchema table) - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList(); - SybaseConnection con2 = (SybaseConnection) (((ICloneable) connection).Clone ()); - if (con2.State == ConnectionState.Closed) - con2.Open(); - SybaseCommand command = con2.CreateCommand (); - - command.CommandText = - "select su.name as owner, so.name as table_name, sc.name as column_name, " + - " st.name as date_type, sc.length as column_length, " + - " sc.prec as data_preceision, sc.scale as data_scale, " + - " 0 as isnullable, sc.colid as column_id " + - "from dbo.syscolumns sc, dbo.sysobjects so, " + - " dbo.systypes st, dbo.sysusers su " + - "where sc.id = so.id " + - "and so.type in ('U','S') " + - "and so.name = '" + table.Name + "' " + - "and su.name = '" + table.OwnerName + "' " + - "and su.uid = so.uid " + - "and sc.usertype = st.usertype " + - "order by sc.colid"; - - SybaseDataReader r = command.ExecuteReader(); - - while (r.Read()) { - ColumnSchema column = new ColumnSchema(); - - try { column.Name = r.GetString(2); } catch {} - column.Provider = this; - try { column.DataTypeName = r.GetString(3); } catch {} - try { column.Default = ""; } catch {} - column.Comment = ""; - column.OwnerName = table.OwnerName; - column.SchemaName = table.OwnerName; - try { column.NotNull = r.GetValue(7).ToString() == "0" ? true : false; } catch {} - try { column.Length = r.GetInt32(4); } catch {} - //try { column.Precision = GetInt(r, 5)); } catch {} - //try { column.Scale = GetIn(r, 6); } catch {} - - StringBuilder sb = new StringBuilder(); - sb.AppendFormat("{0} {1}{2}", - column.Name, - column.DataTypeName, - (column.Length > 0) ? ("(" + column.Length + ")") : ""); - sb.AppendFormat(" {0}", column.NotNull ? "NOT NULL" : "NULL"); - //if (column.Default.Length > 0) - // sb.AppendFormat(" DEFAULT {0}", column.Default); - column.Definition = sb.ToString(); - - collection.Add(column); - } - r.Close (); - r = null; - command.Dispose (); - command = null; - con2.Close (); - con2 = null; - - return (ColumnSchema[]) collection.ToArray(typeof(ColumnSchema)); - } - - private string GetSource (string objectName) - { - string sql = String.Format ("EXEC [master].[dbo].[sp_helptext] '{0}', null", objectName); - SybaseConnection con2 = (SybaseConnection) (((ICloneable) connection).Clone ()); - if (con2.State == ConnectionState.Closed) - con2.Open(); - SybaseCommand cmd = con2.CreateCommand (); - cmd.CommandText = sql; - IDataReader reader = cmd.ExecuteReader (); - - StringBuilder sb = new StringBuilder (); - - while (reader.Read ()) { - string text = reader.GetString (0); - sb.Append (text); - } - - reader.Close (); - reader = null; - cmd.Dispose (); - cmd = null; - con2.Close (); - con2 = null; - - return sb.ToString (); - } - - /// <summary> - /// Get a collection of views from the system. - /// </summary> - public override ViewSchema[] GetViews() - { - ArrayList collection = new ArrayList(); - - SybaseCommand command = new SybaseCommand(); - command.Connection = connection; - command.CommandText = - "SELECT su.name AS owner, so.name as table_name, so.id as table_id, " + - " so.crdate as created_date, so.type as table_type " + - "FROM dbo.sysobjects so, dbo.sysusers su " + - "WHERE type = 'V' " + - "AND su.uid = so.uid " + - "ORDER BY 1, 2"; - SybaseDataReader r = command.ExecuteReader(); - - while (r.Read()) { - ViewSchema view = new ViewSchema(); - view.Provider = this; - - try { - view.Name = r.GetString(1); - view.SchemaName = r.GetString(0); - view.OwnerName = r.GetString(0); - - StringBuilder sb = new StringBuilder(); - sb.AppendFormat ("-- View: {0}\n", view.Name); - sb.AppendFormat ("-- DROP VIEW {0};\n\n", view.Name); - string source = GetSource(view.Owner + "." + view.Name); - sb.AppendFormat (" {0}\n);", source); - view.Definition = sb.ToString (); - //view.Comment = r.GetString(5); - } catch { - } - - collection.Add(view); - } - r.Close (); - r = null; - command.Dispose(); - command = null; - - return (ViewSchema[]) collection.ToArray (typeof (ViewSchema)); - } - - /// <summary> - /// Get a collection of columns within a view - /// </summary> - public override ColumnSchema[] GetViewColumns(ViewSchema view) - { - if (IsOpen == false && Open() == false) - throw new Exception ("No connection to database"); - - ArrayList collection = new ArrayList(); - - SybaseConnection con2 = (SybaseConnection) (((ICloneable) connection).Clone ()); - if (con2.State == ConnectionState.Closed) - con2.Open(); - SybaseCommand command = con2.CreateCommand (); - command.CommandText = - "SELECT * " + - " FROM " + view.Name + - " WHERE 1 = 0"; - SybaseDataReader r = command.ExecuteReader(); - - for (int i = 0; i < r.FieldCount; i++) { - ColumnSchema column = new ColumnSchema(); - - column.Name = r.GetName(i); - column.DataTypeName = r.GetDataTypeName(i); - column.Default = ""; - column.Definition = ""; - column.OwnerName = view.OwnerName; - column.SchemaName = view.OwnerName; - - collection.Add(column); - } - - command.Dispose (); - command = null; - con2.Close (); - con2 = null; - - return (ColumnSchema[]) collection.ToArray (typeof(ColumnSchema)); - } - - /// <summary> - /// Get a collection of constraints within a a table. - /// </summary> - public override ConstraintSchema[] GetTableConstraints (TableSchema table) - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - -// ArrayList collection = new ArrayList (); -// -// SybaseConnection con2 = (SybaseConnection) (((ICloneable) connection).Clone ()); -// con2.Open(); -// SybaseCommand command = con2.CreateCommand (); - - // TODO: get constraints - return new ConstraintSchema[0]; - } - - public override UserSchema[] GetUsers () - { - if (IsOpen == false && Open () == false) - throw new InvalidOperationException ("Invalid connection"); - - ArrayList collection = new ArrayList (); - - return (UserSchema[]) collection.ToArray (typeof (UserSchema)); - } - } -} diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/AbstractSchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/AbstractSchema.cs deleted file mode 100644 index 214cadb55a..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/AbstractSchema.cs +++ /dev/null @@ -1,160 +0,0 @@ -// -// Schema/AbstractSchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; - -namespace Mono.Data.Sql -{ - public abstract class AbstractSchema : ISchema - { - public event EventHandler Changed; - - protected string name = String.Empty; - protected string ownerName = String.Empty; - protected string comment = String.Empty; - protected string definition = String.Empty; - protected string schema = String.Empty; - protected DbProviderBase provider = null; - - protected Hashtable options; - - public virtual string Name { - get { - return name; - } - set { - name = value; - OnChanged(); - } - } - - public virtual string FullName { - get { - if (schema.Length > 0) - return schema + "." + name; - else - return name; - } - } - - public virtual string SchemaName { - get { - return schema; - } - set { - schema = value; - OnChanged(); - } - } - - public virtual SchemaSchema Schema { - get { - throw new NotImplementedException(); - } - set { - if (value != null) - schema = value.Name; - else - schema = String.Empty; - } - } - - public virtual string Comment { - get { - return comment; - } - set { - comment = value; - OnChanged(); - } - } - - public virtual string Definition { - get { - return definition; - } - set { - definition = value; - OnChanged(); - } - } - - public DbProviderBase Provider { - get { - return provider; - } - set { - provider = value; - OnChanged(); - } - } - - public virtual string OwnerName { - get { - return ownerName; - } - set { - ownerName = value; - OnChanged(); - } - } - - public virtual UserSchema Owner { - get { - throw new NotImplementedException(); - } - } - - public virtual PrivilegeSchema [] Privileges { - get { - throw new NotImplementedException(); - } - } - - public virtual Hashtable Options { - get { - if (options == null) - options = new Hashtable (); - - return options; - } - } - - public virtual void OnChanged() - { - if (Changed != null) { - Changed(this, null); - } - } - - public virtual void Refresh() - { - } - } -} diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/AggregateSchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/AggregateSchema.cs deleted file mode 100644 index a8234ba909..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/AggregateSchema.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -// Schema/AggregateSchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Data.Sql -{ - public class AggregateSchema : AbstractSchema - { - public override string ToString() - { - return Name + "()"; - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/CheckConstraintSchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/CheckConstraintSchema.cs deleted file mode 100644 index 3102307705..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/CheckConstraintSchema.cs +++ /dev/null @@ -1,36 +0,0 @@ -// -// Schema/CheckConstraintSchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Data.Sql -{ - public class CheckConstraintSchema : ConstraintSchema - { - } -} diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/ColumnSchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/ColumnSchema.cs deleted file mode 100644 index 3a850737e2..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/ColumnSchema.cs +++ /dev/null @@ -1,120 +0,0 @@ -// -// Schema/ColumnSchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Data.Sql -{ - public class ColumnSchema : AbstractSchema - { - protected string dataType = String.Empty; - protected string defaultValue = String.Empty; - protected bool notNull = false; - protected int length = 0; - protected int precision = 0; - protected int scale = 0; - protected int columnID = 0; - - public DataTypeSchema DataType { - get { - // TODO: Load the datatype based on its name. - throw new NotImplementedException(); - } - } - - public string DataTypeName { - get { - return dataType; - } - set { - dataType = value; - OnChanged (); - } - } - - public virtual string Default { - get { - return defaultValue; - } - set { - defaultValue = value; - OnChanged(); - } - } - - public virtual bool NotNull { - get { - return notNull; - } - set { - notNull = value; - OnChanged(); - } - } - - public virtual int Length { - get { - return length; - } - set { - length = value; - OnChanged(); - } - } - - public virtual int Precision { - get { - return precision; - } - set { - precision = value; - OnChanged (); - } - } - - public virtual int Scale { - get { - return scale; - } - set { - scale = value; - OnChanged (); - } - } - - public virtual int ColumnID { - get { - return columnID; - } - set { - columnID = value; - OnChanged (); - } - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/ConstraintSchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/ConstraintSchema.cs deleted file mode 100644 index a9bad60b5c..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/ConstraintSchema.cs +++ /dev/null @@ -1,41 +0,0 @@ -// -// Schema/ConstraintSchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Data.Sql -{ - public class ConstraintSchema : AbstractSchema - { - public ColumnSchema[] Columns { - get { - return (ColumnSchema[]) null; - } - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/DataTypeSchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/DataTypeSchema.cs deleted file mode 100644 index 6a8a71fb7e..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/DataTypeSchema.cs +++ /dev/null @@ -1,64 +0,0 @@ -// -// Schema/DataTypeSchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Data.Sql -{ - public class DataTypeSchema : AbstractSchema - { - protected bool isComplex = false; - - public DataTypeSchema (string name, bool isComplex) - { - this.isComplex = isComplex; - this.name = name; - } - - public bool IsComplex { - get { - return isComplex; - } - set { - isComplex = value; - OnChanged(); - } - } - - public ColumnSchema [] Columns { - get { - if (isComplex == false) { - return new ColumnSchema[0]; - } else { - // TODO: Get complex columns from the provider - throw new NotImplementedException(); - } - } - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/ForeignKeyConstraintSchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/ForeignKeyConstraintSchema.cs deleted file mode 100644 index ab643adbc7..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/ForeignKeyConstraintSchema.cs +++ /dev/null @@ -1,59 +0,0 @@ -// -// Schema/ForeignKeyConstraintSchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Data.Sql -{ - public class ForeignKeyConstraintSchema : ConstraintSchema - { - protected string referenceTable = String.Empty; - - public TableSchema ReferenceTable { - get { - throw new NotImplementedException(); - } - set { - referenceTable = value.FullName; - OnChanged(); - } - } - - public string ReferenceTableName { - set { - referenceTable = value; - } - } - - public ColumnSchema[] ReferenceColumns { - get { - return (ColumnSchema[]) null; - } - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/GroupSchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/GroupSchema.cs deleted file mode 100644 index b63085e826..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/GroupSchema.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -// Schema/ParameterSchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Data.Sql -{ - public class GroupSchema : AbstractSchema - { - public UserSchema Users { - get { - throw new NotImplementedException (); - } - } - - public RoleSchema[] Roles { - get { - throw new NotImplementedException (); - } - } - } -} diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/ISchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/ISchema.cs deleted file mode 100644 index 0347edf0e0..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/ISchema.cs +++ /dev/null @@ -1,96 +0,0 @@ -// -// Schema/ISchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Data.Sql -{ - public interface ISchema - { - /// <summary> - /// Event fired when the object is changed. - /// </summary> - event EventHandler Changed; - - /// <summary> - /// SQL object name. - /// </summary> - string Name { get; set; } - - /// <summary> - /// Full name of the object. This is typically `schema.objectname'. - /// </summary> - string FullName { get; } - - /// <summary> - /// SQL Comment associated with this object. - /// </summary> - string Comment { get; set; } - - /// <summary> - /// SQL Syntax Definition of this object. - /// </summary> - string Definition { get; set; } - - /// <summary> - /// Name of schema - /// </summary> - string SchemaName { get; set; } - - /// <summary> - /// Schema object representing the schema this object is part of. - /// </summary> - SchemaSchema Schema { get; set; } - - /// <summary> - /// Set the owners name in the database by the literal string name - /// of the user. - /// </summary> - string OwnerName { get; set; } - - /// <summary> - /// Owner of this sql object. - /// </summary> - UserSchema Owner { get; } - - /// <summary> - /// Privileges (sometimes known as ACL's) associated with this object. - /// </summary> - PrivilegeSchema [] Privileges { get; } - - /// <summary> - /// The connection provider associated with this SQL object. - /// </summary> - DbProviderBase Provider { get; set; } - - /// <summary> - /// Refresh the object from the database. - /// </summary> - void Refresh(); - } -} diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/IndexConstraintSchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/IndexConstraintSchema.cs deleted file mode 100644 index fe6125444a..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/IndexConstraintSchema.cs +++ /dev/null @@ -1,36 +0,0 @@ -// -// Schema/IndexConstraintSchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Data.Sql -{ - public class IndexConstraintSchema : ConstraintSchema - { - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/LanguageSchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/LanguageSchema.cs deleted file mode 100644 index 81cc053d7a..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/LanguageSchema.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -// Schema/PrimaryKeyConstraintSchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Data.Sql -{ - public class LanguageSchema : AbstractSchema - { - protected string handler = String.Empty; - - public ProcedureSchema Handler { - get { - // TODO: Get procedure - throw new NotImplementedException(); - } - set { - handler = value.FullName; - } - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/OperatorSchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/OperatorSchema.cs deleted file mode 100644 index 5c9ead6872..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/OperatorSchema.cs +++ /dev/null @@ -1,56 +0,0 @@ -// -// Schema/OperatorSchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Data.Sql -{ - public class OperatorSchema : AbstractSchema - { - protected string leftDataType = String.Empty; - protected string rightDataType = String.Empty; - - public override string Name { - get { - return name; - } - } - - public DataTypeSchema LeftDataType { - get { - throw new NotImplementedException(); - } - set { - if (value != null) - leftDataType = value.Name; - else - leftDataType = String.Empty; - } - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/ParameterSchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/ParameterSchema.cs deleted file mode 100644 index 703369892d..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/ParameterSchema.cs +++ /dev/null @@ -1,46 +0,0 @@ -// -// Schema/ParameterSchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Data.Sql -{ - public class ParameterSchema : AbstractSchema - { - protected string dataType = String.Empty; - - public DataTypeSchema DataType { - get { - throw new NotImplementedException(); - } - set { - dataType = value.FullName; - } - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/PrimaryKeyConstraintSchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/PrimaryKeyConstraintSchema.cs deleted file mode 100644 index 274778b303..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/PrimaryKeyConstraintSchema.cs +++ /dev/null @@ -1,36 +0,0 @@ -// -// Schema/PrimaryKeyConstraintSchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Data.Sql -{ - public class PrimaryKeyConstraintSchema : ConstraintSchema - { - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/PrivilegeSchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/PrivilegeSchema.cs deleted file mode 100644 index b54cf18bbd..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/PrivilegeSchema.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -// Schema/PrivilegeSchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Data.Sql -{ - public class PrivilegeSchema : AbstractSchema - { - protected bool canGrant = false; - - public bool CanGrant { - get { - return canGrant; - } - set { - canGrant = value; - OnChanged(); - } - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/ProcedureSchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/ProcedureSchema.cs deleted file mode 100644 index e34642ba0d..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/ProcedureSchema.cs +++ /dev/null @@ -1,81 +0,0 @@ -// -// Schema/ProcedureSchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Data.Sql -{ - public class ProcedureSchema : AbstractSchema - { - protected ParameterSchema[] parameters; - protected ColumnSchema[] columns; - protected string language = String.Empty; - protected bool isSystemProcedure = false; - - public ParameterSchema[] Parameters { - get { - return parameters; - } - } - - public ColumnSchema[] Columns { - get { - return columns; - } - } - - public LanguageSchema Language { - get { - throw new NotImplementedException(); - } - set { - language = value.FullName; - } - } - - public string LanguageName { - get { - return language; - } - set { - language = value; - OnChanged (); - } - } - - public bool IsSystemProcedure { - get { - return isSystemProcedure; - } - set { - isSystemProcedure = value; - OnChanged (); - } - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/RoleSchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/RoleSchema.cs deleted file mode 100644 index d0da2706e2..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/RoleSchema.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -// Schema/RoleSchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Data.Sql -{ - public class RoleSchema : AbstractSchema - { -// TODO: Should include a list of Privileges to object mappings. Also -// needs to include what Identity this Role is connected to. IE: Group -// or user. - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/RuleSchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/RuleSchema.cs deleted file mode 100644 index e1968ec8cb..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/RuleSchema.cs +++ /dev/null @@ -1,36 +0,0 @@ -// -// Schema/RuleSchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Data.Sql -{ - public class RuleSchema : AbstractSchema - { - } -} diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/SchemaSchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/SchemaSchema.cs deleted file mode 100644 index 27a76fa631..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/SchemaSchema.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -// Schema/SchemaSchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Data.Sql -{ - public class SchemaSchema : AbstractSchema - { - public override SchemaSchema Schema { - get { - return null; - } - set { - } - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/SequenceSchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/SequenceSchema.cs deleted file mode 100644 index f72c0ebfc1..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/SequenceSchema.cs +++ /dev/null @@ -1,80 +0,0 @@ -// -// Schema/SequenceSchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Data.Sql -{ - public class SequenceSchema : AbstractSchema - { - protected string minValue = String.Empty; - protected string maxValue = String.Empty; - protected string currentValue = String.Empty; - protected string increment = String.Empty; - - public string MinValue { - get { - return minValue; - } - set { - minValue = value; - OnChanged(); - } - } - - public string MaxValue { - get { - return maxValue; - } - set { - maxValue = value; - OnChanged(); - } - } - - public string CurrentValue { - get { - return currentValue; - } - set { - currentValue = value; - OnChanged(); - } - } - - public string Increment { - get { - return increment; - } - set { - increment = value; - OnChanged(); - } - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/TableSchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/TableSchema.cs deleted file mode 100644 index 656560e5fe..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/TableSchema.cs +++ /dev/null @@ -1,102 +0,0 @@ -// -// Schema/TableSchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; - -namespace Mono.Data.Sql -{ - /// <summary> - /// SQL schema object representing a table - /// </summary> - public class TableSchema : AbstractSchema - { - protected bool isSystemTable = false; - protected string tableSpaceName = String.Empty; - - /// <summary> - /// Is this table part of the database core - /// </summary> - public bool IsSystemTable { - get { - return isSystemTable; - } - set { - isSystemTable = value; - OnChanged (); - } - } - - public string TableSpaceName { - get { - return tableSpaceName; - } - set { - tableSpaceName = value; - OnChanged (); - } - } - - /// <summary> - /// Override ToString() to show the tables FullName - /// <remarks> - /// Returns 'schema.tablename' - /// </remarks> - /// </summary> - public override string ToString () - { - return FullName; - } - - /// <summary> - /// Collection of columns associated with this table. - /// </summary> - public ColumnSchema[] Columns { - get { - return (Provider.GetTableColumns(this)); - } - } - - /// <summary> - /// Collection of constraints associated with this table. - /// </summary> - public ConstraintSchema[] Constraints { - get { - return (Provider.GetTableConstraints(this)); - } - } - - /// <summary> - /// Refresh the information associated with this table. - /// </summary> - public override void Refresh() - { - // Update Name, etc. - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/TriggerSchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/TriggerSchema.cs deleted file mode 100644 index c9451930f4..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/TriggerSchema.cs +++ /dev/null @@ -1,37 +0,0 @@ -// -// Schema/TriggerSchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Data.Sql -{ - public class TriggerSchema : AbstractSchema - { - - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/UniqueConstraintSchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/UniqueConstraintSchema.cs deleted file mode 100644 index 2117c70f39..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/UniqueConstraintSchema.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -// Schema/UniqueConstraintSchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Data.Sql -{ - public class UniqueConstraintSchema : ConstraintSchema - { - public UniqueConstraintSchema () - { - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/UserSchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/UserSchema.cs deleted file mode 100644 index 788a7db951..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/UserSchema.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -// Schema/UserSchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Data.Sql -{ - public class UserSchema : AbstractSchema - { - protected string userId = String.Empty; - protected string password = String.Empty; - protected DateTime expires = DateTime.MinValue; - - public virtual RoleSchema [] Roles { - get { - throw new NotImplementedException(); - } - } - - public virtual string UserId { - get { - return userId; - } - set { - userId = value; - } - } - - public virtual string Password { - get { - return password; - } - set { - password = value; - } - } - - public virtual DateTime Expires { - get { - return expires; - } - set { - expires = value; - } - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/ViewSchema.cs b/main/Unused/MonoQuery/Mono.Data.Sql/Schema/ViewSchema.cs deleted file mode 100644 index ffa7cadf8f..0000000000 --- a/main/Unused/MonoQuery/Mono.Data.Sql/Schema/ViewSchema.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -// Schema/ViewSchema.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Mosaix Communications, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Data.Sql -{ - public class ViewSchema : AbstractSchema - { - protected bool isSystemView = false; - - public bool IsSystemView { - get { - return isSystemView; - } - set { - isSystemView = value; - OnChanged(); - } - } - } -} diff --git a/main/Unused/MonoQuery/MonoQuery/AssemblyInfo.cs b/main/Unused/MonoQuery/MonoQuery/AssemblyInfo.cs deleted file mode 100644 index 198a48c0ab..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/AssemblyInfo.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all values by your own or you can build default build and revision -// numbers with the '*' character (the default): - -[assembly: AssemblyVersion("1.0.0.0")] - -// The following attributes specify the key for the sign of your assembly. See the -// .NET Framework documentation for more information about signing. -// This is not required, if you don't want signing let these attributes like they're. -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyKeyFile("")] diff --git a/main/Unused/MonoQuery/MonoQuery/Commands/Commands.cs b/main/Unused/MonoQuery/MonoQuery/Commands/Commands.cs deleted file mode 100644 index 04f89bb344..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Commands/Commands.cs +++ /dev/null @@ -1,87 +0,0 @@ -// -// AddConnectionCommand.cs -// -// Author: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Reflection; - -using MonoDevelop.Core.Gui; -using MonoDevelop.Ide.Gui; -using MonoDevelop.Ide.Gui.Pads; -using MonoDevelop.Components.Commands; -using MonoDevelop.Core; - -using Gtk; - -using Mono.Data.Sql; -using MonoQuery; - -namespace MonoQuery.Commands -{ - public enum MonoQueryCommands { - AddConnection, - RemoveConnection, - DisconnectConnection, - RefreshProviderList, - RefreshConnection, - QueryCommand, - EmptyTable, - DropTable, - Refresh - } - - public class AddConnection : CommandHandler - { - protected override void Run () - { - ConnectionDialog dialog = new ConnectionDialog (); - try { - int retval = dialog.Run (); - if (retval == (int) Gtk.ResponseType.Ok) { - if (String.IsNullOrEmpty (dialog.ConnectionString)) { - IdeApp.Services.MessageService.ShowError (GettextCatalog.GetString ( - "Connection string cannot be blank.")); - return; - } - - Assembly asm = Assembly.GetAssembly (typeof (Mono.Data.Sql.DbProviderBase)); - DbProviderBase provider = (DbProviderBase) asm.CreateInstance (dialog.ConnectionType.FullName); - if (provider == null) - return; - provider.Name = dialog.ConnectionName; - provider.ConnectionString = dialog.ConnectionString; - - MonoQueryService service = (MonoQueryService) - ServiceManager.GetService (typeof (MonoQueryService)); - service.Providers.Add ( (DbProviderBase) provider); - } - } finally { - dialog.Destroy (); - } - } - } -} diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/ConnectionDialog.cs b/main/Unused/MonoQuery/MonoQuery/Gui/ConnectionDialog.cs deleted file mode 100644 index 29342e18c5..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/ConnectionDialog.cs +++ /dev/null @@ -1,134 +0,0 @@ -// -// ConnectionDialog.cs -// -// Author: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Reflection; - -using Gtk; -using Glade; - -using Mono.Data.Sql; - -using MonoDevelop.Core.Gui; -using MonoDevelop.Core; - -namespace MonoQuery -{ - public class ConnectionDialog - { - [Glade.Widget] - protected Dialog newConnectionDialog; - [Glade.Widget] - protected ComboBox providersCombo; - [Glade.Widget] - protected Entry nameEntry; - [Glade.Widget] - protected Entry serverEntry; - [Glade.Widget] - protected Entry databaseEntry; - [Glade.Widget] - protected Entry useridEntry; - [Glade.Widget] - protected Entry passwordEntry; - [Glade.Widget] - protected Entry otherEntry; - [Glade.Widget] - protected TextView connectionStringTextView; - - public ConnectionDialog () : base () - { - Glade.XML gxml = new Glade.XML (null, "monoquery.glade", "newConnectionDialog", null); - gxml.Autoconnect (this); - - ListStore store = new ListStore (typeof (string), typeof (Type)); - - MonoQueryService service = (MonoQueryService) ServiceManager.GetService (typeof (MonoQueryService)); - foreach (Type type in service.ProviderTypes) { - Assembly asm = Assembly.GetAssembly (typeof (Mono.Data.Sql.DbProviderBase)); - DbProviderBase provider = (DbProviderBase) asm.CreateInstance (type.FullName); - store.AppendValues (provider.ProviderName, type); - } - - providersCombo.Clear (); - - CellRendererText ctext = new CellRendererText (); - providersCombo.PackStart (ctext, false); - providersCombo.AddAttribute (ctext, "text", 0); - providersCombo.Model = store; - providersCombo.Active = 0; - } - - public virtual string ConnectionString { - get { - return connectionStringTextView.Buffer.Text; - } - } - - public virtual string ConnectionName { - get { - return nameEntry.Text; - } - } - - public virtual Type ConnectionType { - get { - TreeIter iter; - providersCombo.GetActiveIter (out iter); - return (Type) providersCombo.Model.GetValue (iter, 1); - } - } - - public int Run () - { - return newConnectionDialog.Run (); - } - - public void Destroy () - { - newConnectionDialog.Destroy (); - } - - protected void OnChanged (object sender, EventArgs args) - { - string connString = String.Empty; - - if (serverEntry.Text != String.Empty) - connString += String.Format ("Server={0};", serverEntry.Text); - if (databaseEntry.Text != String.Empty) - connString += String.Format ("Database={0};", databaseEntry.Text); - if (useridEntry.Text != String.Empty) - connString += String.Format ("User ID={0};", useridEntry.Text); - if (passwordEntry.Text != String.Empty) - connString += String.Format ("Password={0};", passwordEntry.Text); - if (otherEntry.Text != String.Empty) - connString += otherEntry.Text; - - connectionStringTextView.Buffer.Text = connString; - } - } -} diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/DataGridView.cs b/main/Unused/MonoQuery/MonoQuery/Gui/DataGridView.cs deleted file mode 100644 index 008f9b6a2b..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/DataGridView.cs +++ /dev/null @@ -1,87 +0,0 @@ -// -// DataGridView.cs: View information in a data table. -// -// Author: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Data; - -using Gtk; - -using Mono.Data.Sql; - -using MonoDevelop.Core.Gui; -using MonoDevelop.Components; -using MonoDevelop.Ide.Gui; - -namespace MonoQuery -{ - public class DataGridView : AbstractViewContent - { - protected Frame frame; - protected DataGrid grid; - - public DataGridView () : base () - { - frame = new Gtk.Frame (); - grid = new DataGrid (); - frame.Add (grid); - frame.ShowAll (); - } - - public DataGridView (DataTable table) : this () - { - LoadDataTable (table); - } - - public override string UntitledName { - get { - return "UntitledResult"; - } - } - - public override void Dispose () - { - Control.Dispose (); - } - - public override void Load (string filename) - { - } - - public void LoadDataTable (DataTable table) - { - grid.DataSource = table; - grid.DataBind (); - } - - public override Gtk.Widget Control { - get { - return frame; - } - } - } -} diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/DatabasePad.cs b/main/Unused/MonoQuery/MonoQuery/Gui/DatabasePad.cs deleted file mode 100644 index 23d6bb33bf..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/DatabasePad.cs +++ /dev/null @@ -1,68 +0,0 @@ -// -// DatabasePad.cs -// -// Author: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Resources; - -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui.Pads; -using MonoDevelop.Components.Commands; -using MonoQuery.Commands; - -using Mono.Data.Sql; - -namespace MonoQuery -{ - public class DatabasePad : TreeViewPad - { - public DatabasePad () : base () - { - MonoQueryService service = (MonoQueryService) ServiceManager.GetService (typeof (MonoQueryService)); - service.Providers.Changed += new EventHandler (OnProvidersChanged); - } - - public override void Initialize (NodeBuilder[] builders, TreePadOption[] options) - { - base.Initialize (builders, options); - OnProvidersChanged (this, null); - } - - [CommandHandler (MonoQueryCommands.RefreshProviderList)] - public void Refresh () - { - OnProvidersChanged (this, null); - } - - protected virtual void OnProvidersChanged (object sender, EventArgs args) - { - MonoQueryService service = (MonoQueryService) ServiceManager.GetService (typeof (MonoQueryService)); - Clear (); - LoadTree (service.Providers); - } - } -} diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/DbProviderCollection.cs.in b/main/Unused/MonoQuery/MonoQuery/Gui/DbProviderCollection.cs.in deleted file mode 100644 index 9a3719df84..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/DbProviderCollection.cs.in +++ /dev/null @@ -1,92 +0,0 @@ -// -// Providers/DbProviderCollection.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Xml.Serialization; -using System.Collections; - -using Mono.Data.Sql; - -namespace MonoQuery -{ - [Serializable] - @SQLProviderAttributes@ - public class DbProviderCollection : CollectionBase - { - public DbProviderCollection () : base () - { - } - - public event EventHandler Changed; - - public DbProviderBase this[int index] { - get { - return ((DbProviderBase) List[index]); - } - set { - List[index] = value; - } - } - - public int Add (DbProviderBase item) - { - int retval = List.Add (item); - - if( Changed != null ) - Changed (this, new EventArgs ()); - - return( retval ); - } - - public int IndexOf (DbProviderBase item) - { - return (List.IndexOf (item)); - } - - public void Insert (int index, DbProviderBase item) - { - List.Insert (index, item); - - if (Changed != null) - Changed (this, new EventArgs ()); - } - - public void Remove (DbProviderBase item) - { - List.Remove (item); - - if( Changed != null ) - Changed (this, new EventArgs ()); - } - - public bool Contains(DbProviderBase item) - { - return (List.Contains (item)); - } - } -} diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/FakeNodes.cs b/main/Unused/MonoQuery/MonoQuery/Gui/FakeNodes.cs deleted file mode 100644 index 9962efeb18..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/FakeNodes.cs +++ /dev/null @@ -1,206 +0,0 @@ -// -// FakeNodes.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -using Mono.Data.Sql; - -namespace MonoQuery -{ - public class TablesNode - { - public event EventHandler RefreshEvent; - - public DbProviderBase Provider = null; - - public TablesNode (DbProviderBase provider) - { - Provider = provider; - } - - public void Refresh () - { - if (RefreshEvent != null) - RefreshEvent (this, null); - } - } - - public class ViewsNode - { - public DbProviderBase Provider = null; - - public ViewsNode (DbProviderBase provider) - { - Provider = provider; - } - } - - public class ProceduresNode - { - public DbProviderBase Provider = null; - - public ProceduresNode (DbProviderBase provider) - { - Provider = provider; - } - } - - public class AggregatesNode - { - public DbProviderBase Provider = null; - - public AggregatesNode (DbProviderBase provider) - { - Provider = provider; - } - } - - public class GroupsNode - { - public DbProviderBase Provider = null; - - public GroupsNode (DbProviderBase provider) - { - Provider = provider; - } - } - - public class LanguagesNode - { - public DbProviderBase Provider = null; - - public LanguagesNode (DbProviderBase provider) - { - Provider = provider; - } - } - - public class OperatorsNode - { - public DbProviderBase Provider = null; - - public OperatorsNode (DbProviderBase provider) - { - Provider = provider; - } - } - - public class RulesNode - { - public DbProviderBase Provider = null; - - public RulesNode (DbProviderBase provider) - { - Provider = provider; - } - } - - public class RolesNode - { - public DbProviderBase Provider = null; - - public RolesNode (DbProviderBase provider) - { - Provider = provider; - } - } - - public class SequencesNode - { - public DbProviderBase Provider = null; - - public SequencesNode (DbProviderBase provider) - { - Provider = provider; - } - } - - public class UsersNode - { - public DbProviderBase Provider = null; - - public UsersNode (DbProviderBase provider) - { - Provider = provider; - } - } - - public class TypesNode - { - public DbProviderBase Provider = null; - - public TypesNode (DbProviderBase provider) - { - Provider = provider; - } - } - - public class ColumnsNode - { - public DbProviderBase Provider = null; - public ISchema Parent = null; - - public ColumnsNode (DbProviderBase provider, ISchema parent) - { - Provider = provider; - Parent = parent; - } - } - - public class ConstraintsNode - { - public DbProviderBase Provider = null; - public TableSchema Table = null; - - public ConstraintsNode (DbProviderBase provider, TableSchema table) - { - Provider = provider; - Table = table; - } - } - - public class TriggersNode - { - public DbProviderBase Provider = null; - - public TriggersNode (DbProviderBase provider) - { - Provider = provider; - } - } - - public class ParametersNode - { - public DbProviderBase Provider = null; - - public ParametersNode (DbProviderBase provider) - { - Provider = provider; - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/AggregatesNodeBuilder.cs b/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/AggregatesNodeBuilder.cs deleted file mode 100644 index 5f9a869bd8..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/AggregatesNodeBuilder.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// AggregatesNodeBuilder.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -using Mono.Data.Sql; -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui.Pads; - -namespace MonoQuery -{ - public class AggregatesNodeBuilder : TypeNodeBuilder - { - public AggregatesNodeBuilder () - { - } - - public override Type NodeDataType { - get { - return typeof (AggregatesNode); - } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return GettextCatalog.GetString ("Aggregates"); - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - label = GettextCatalog.GetString ("Aggregates"); - string iconName = "md-mono-query-tables"; - icon = Context.GetIcon (iconName); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - AggregatesNode node = (AggregatesNode) dataObject; - BuildChildNodes (builder, node); - } - - public static void BuildChildNodes (ITreeBuilder builder, AggregatesNode node) - { - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - return true; - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ColumnNodeBuilder.cs b/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ColumnNodeBuilder.cs deleted file mode 100644 index 80f5454736..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ColumnNodeBuilder.cs +++ /dev/null @@ -1,88 +0,0 @@ -// -// ColumnNodeBuilder.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Text.RegularExpressions; - -using Mono.Data.Sql; -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui.Pads; - -namespace MonoQuery -{ - public class ColumnNodeBuilder : TypeNodeBuilder - { - public ColumnNodeBuilder() - { - } - - public override Type NodeDataType { - get { - return typeof(ColumnSchema); - } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return GettextCatalog.GetString ("Column"); - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - ColumnSchema schema = (ColumnSchema) dataObject; - label = schema.Name; - string iconName = "md-mono-query-column"; - - string typeName = schema.DataTypeName.ToLower (); - - if (Regex.IsMatch (typeName, "(timestamp|datetime)")) - iconName = "md-mono-query-date-time"; - else if (Regex.IsMatch (typeName, "(bytea|blob)")) - iconName = "md-mono-query-blob"; - else if (Regex.IsMatch (typeName, "numeric")) - iconName = "md-mono-query-numeric"; - else if (Regex.IsMatch (typeName, "(varchar|character var|char)")) - iconName = "md-mono-query-string"; - - icon = Context.GetIcon (iconName); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - } - - public static void BuildChildNodes (ITreeBuilder builder, ColumnSchema node) - { - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - return false; - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ColumnsNodeBuilder.cs b/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ColumnsNodeBuilder.cs deleted file mode 100644 index 3f98fa0bf0..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ColumnsNodeBuilder.cs +++ /dev/null @@ -1,86 +0,0 @@ -// -// ColumnsNodeBuilder.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -using Mono.Data.Sql; -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui.Pads; - -namespace MonoQuery -{ - public class ColumnsNodeBuilder : TypeNodeBuilder - { - public ColumnsNodeBuilder () - { - } - - public override Type NodeDataType { - get { - return typeof (ColumnsNode); - } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return GettextCatalog.GetString ("Columns"); - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - label = GettextCatalog.GetString ("Columns"); - string iconName = "md-mono-query-tables"; - icon = Context.GetIcon (iconName); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - ColumnsNode node = (ColumnsNode) dataObject; - BuildChildNodes (builder, node); - } - - public static void BuildChildNodes (ITreeBuilder builder, ColumnsNode node) - { - if (node.Parent is TableSchema) { - foreach (ColumnSchema col in node.Provider.GetTableColumns ((TableSchema)node.Parent)) - builder.AddChild (col); - } else if (node.Parent is ViewSchema) { - foreach (ColumnSchema col in node.Provider.GetViewColumns ((ViewSchema)node.Parent)) - builder.AddChild (col); - } else if (node.Parent is ProcedureSchema) { - foreach (ColumnSchema col in node.Provider.GetProcedureColumns ((ProcedureSchema)node.Parent)) - builder.AddChild (col); - } - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - return true; - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ConstraintNodeBuilder.cs b/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ConstraintNodeBuilder.cs deleted file mode 100644 index e81725f722..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ConstraintNodeBuilder.cs +++ /dev/null @@ -1,104 +0,0 @@ -// -// ConstraintNodeBuilder.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -using Mono.Data.Sql; -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui.Pads; - -namespace MonoQuery -{ - public class ConstraintNodeBuilder : TypeNodeBuilder - { - public ConstraintNodeBuilder () - { - } - - public override Type NodeDataType { - get { - return typeof (ConstraintSchema); - } - } - - public override Type CommandHandlerType { - get { - return typeof (ConstraintNodeCommandHandler); - } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return GettextCatalog.GetString ("Constraint"); - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - ConstraintSchema schema = (ConstraintSchema) dataObject; - label = schema.Name; - string iconName = "md-mono-query-column"; - if (schema as ForeignKeyConstraintSchema != null) - iconName = "md-mono-query-column-f-k"; - else if (schema as PrimaryKeyConstraintSchema != null) - iconName = "md-mono-query-column-p-k"; - icon = Context.GetIcon (iconName); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - ConstraintSchema node = (ConstraintSchema) dataObject; - BuildChildNodes (builder, node); - } - - public static void BuildChildNodes (ITreeBuilder builder, ConstraintSchema node) - { - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - return false; - } - } - - public class ConstraintNodeCommandHandler : NodeCommandHandler - { - public override DragOperation CanDragNode () - { - return DragOperation.None; - } - - public override void OnItemSelected () - { - ConstraintSchema schema = CurrentNode.DataItem as ConstraintSchema; - MonoQueryService service = (MonoQueryService) ServiceManager.GetService (typeof (MonoQueryService)); - - if (service.SqlDefinitionPad != null) - service.SqlDefinitionPad.SetText(schema.Definition); - } - } -} diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ConstraintsNodeBuilder.cs b/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ConstraintsNodeBuilder.cs deleted file mode 100644 index 1afc125439..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ConstraintsNodeBuilder.cs +++ /dev/null @@ -1,89 +0,0 @@ -// -// ConstraintsNodeBuilder.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -using Mono.Data.Sql; -using MonoDevelop.Core; -using MonoDevelop.Core.Gui; -using MonoDevelop.Ide.Gui.Pads; - -namespace MonoQuery -{ - public class ConstraintsNodeBuilder : TypeNodeBuilder - { - public ConstraintsNodeBuilder () - { - } - - public override Type NodeDataType { - get { - return typeof(ConstraintsNode); - } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return GettextCatalog.GetString ("Constraints"); - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - label = GettextCatalog.GetString ("Constraints"); - string iconName = "md-mono-query-tables"; - icon = Context.GetIcon (iconName); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - ConstraintsNode node = (ConstraintsNode) dataObject; - BuildChildNodes (builder, node); - } - - public static void BuildChildNodes (ITreeBuilder builder, ConstraintsNode node) - { - if (node.Provider.IsOpen == false) { - try { - if (node.Provider.Open() == false) return; - } catch { - Services.MessageService.ShowMessage (GettextCatalog.GetString ("There was an error connecting to the database server.")); - return; - } - } - - foreach (ConstraintSchema con in node.Provider.GetTableConstraints(node.Table)) { - builder.AddChild (con); - } - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - return true; - } - } -} diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/DatabaseNodeBuilder.cs b/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/DatabaseNodeBuilder.cs deleted file mode 100644 index 641e34a051..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/DatabaseNodeBuilder.cs +++ /dev/null @@ -1,257 +0,0 @@ -// -// DatabaseNodeBuilder.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Threading; -using System.Runtime.Remoting.Messaging; - -using Mono.Data.Sql; -using MonoDevelop.Core; -using MonoDevelop.Core.Gui; -using MonoDevelop.Ide.Gui; -using MonoDevelop.Ide.Gui.Pads; -using MonoDevelop.Components.Commands; -using MonoQuery.Commands; - -namespace MonoQuery -{ - public class DatabaseNodeBuilder : TypeNodeBuilder - { - DbProviderChangedEventHandler providerNameChanged; - DbProviderChangedEventHandler connectionStateChanged; - DbProviderChangedEventHandler providerRefreshed; - - object ThreadSync = new Object (); - ITreeBuilder threadedBuilder; - DbProviderBase threadedProvider; - - private delegate void ExpandToNodeHandler (ITreeBuilder builder); - private event ExpandToNodeHandler ExpandToNode; - private delegate void AddChildHandler (ITreeBuilder builder, object child); - private event AddChildHandler AddChildEvent; - - public DatabaseNodeBuilder () - { - providerNameChanged = (DbProviderChangedEventHandler) DispatchService.GuiDispatch (new DbProviderChangedEventHandler (OnProviderNameChanged)); - connectionStateChanged = (DbProviderChangedEventHandler) DispatchService.GuiDispatch (new DbProviderChangedEventHandler (OnProviderStateChanged)); - providerRefreshed = (DbProviderChangedEventHandler) DispatchService.GuiDispatch (new DbProviderChangedEventHandler (OnProviderRefreshed)); - - ExpandToNode += (ExpandToNodeHandler) DispatchService.GuiDispatch (new ExpandToNodeHandler (OnExpandToNode)); - AddChildEvent += (AddChildHandler) DispatchService.GuiDispatch (new AddChildHandler (OnAddChild)); - } - - public override Type NodeDataType { - get { - return typeof (DbProviderBase); - } - } - - public override string ContextMenuAddinPath { - get { - return "/SharpDevelop/Views/DatabasePad/ContextMenu/ConnectionBrowserNode"; - } - } - - public override Type CommandHandlerType { - get { - return typeof (DatabaseNodeCommandHandler); - } - } - - public override void OnNodeAdded (object dataObject) - { - DbProviderBase provider = (DbProviderBase) dataObject; - provider.NameChanged += providerNameChanged; - provider.StateChanged += connectionStateChanged; - provider.Refreshed += providerRefreshed; - } - - public override void OnNodeRemoved (object dataObject) - { - DbProviderBase provider = (DbProviderBase) dataObject; - provider.NameChanged -= providerNameChanged; - provider.StateChanged -= connectionStateChanged; - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return ( (DbProviderBase)dataObject).Name; - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - DbProviderBase p = dataObject as DbProviderBase; - label = p.Name; - - string iconName = "md-mono-query-database"; - - if (p.IsConnectionStringWrong && p.IsOpen == false) - iconName = "md-mono-query-disconnected"; - else if (p.IsOpen) - iconName = "md-mono-query-connected"; - - icon = Context.GetIcon (iconName); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - DbProviderBase provider = (DbProviderBase) dataObject; - BuildChildNodes (builder, provider); - } - - public void BuildChildNodes (ITreeBuilder builder, DbProviderBase provider) - { - lock (ThreadSync) { - threadedBuilder = builder; - threadedProvider = provider; - Thread thread = new Thread (new ThreadStart (BuildChildNodesThreadStart)); - thread.Start (); - } - } - - private void BuildChildNodesThreadStart () - { - ITreeBuilder builder = threadedBuilder; - DbProviderBase provider = threadedProvider; - - if (provider.IsOpen == false && provider.Open () == false) - return; - - if (provider.SupportsSchemaType (typeof (TableSchema))) - AddChildEvent (builder, new TablesNode (provider)); - - if (provider.SupportsSchemaType (typeof (ViewSchema))) - AddChildEvent (builder, new ViewsNode (provider)); - - if (provider.SupportsSchemaType (typeof (ProcedureSchema))) - AddChildEvent (builder, new ProceduresNode (provider)); - - if (provider.SupportsSchemaType (typeof (AggregateSchema))) - AddChildEvent (builder, new AggregatesNode (provider)); - - if (provider.SupportsSchemaType (typeof (GroupSchema))) - AddChildEvent (builder, new GroupsNode (provider)); - - if (provider.SupportsSchemaType (typeof (LanguageSchema))) - AddChildEvent (builder, new LanguagesNode (provider)); - - if (provider.SupportsSchemaType (typeof (OperatorSchema))) - AddChildEvent (builder, new OperatorsNode (provider)); - - if (provider.SupportsSchemaType (typeof (RoleSchema))) - AddChildEvent (builder, new RolesNode (provider)); - - if (provider.SupportsSchemaType (typeof (SequenceSchema))) - AddChildEvent (builder, new SequencesNode (provider)); - - if (provider.SupportsSchemaType (typeof (UserSchema))) - AddChildEvent (builder, new UsersNode (provider)); - - if (provider.SupportsSchemaType (typeof (DataTypeSchema))) - AddChildEvent (builder, new TypesNode (provider)); - - ExpandToNode (builder); - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - return true; - } - - protected void OnProviderNameChanged (object sender, DbProviderChangedArgs args) - { - ITreeBuilder tb = Context.GetTreeBuilder (args.Provider); - if (tb != null) - tb.Update (); - } - - protected void OnProviderStateChanged (object sender, DbProviderChangedArgs args) - { - ITreeBuilder tb = Context.GetTreeBuilder (args.Provider); - if (tb != null) - tb.Update (); - } - - protected void OnProviderRefreshed (object sender, DbProviderChangedArgs args) - { - ITreeBuilder tb = Context.GetTreeBuilder (args.Provider); - if (tb != null) - tb.UpdateAll (); - } - - protected void OnExpandToNode (ITreeBuilder builder) - { - builder.Expanded = true; - } - - protected void OnAddChild (ITreeBuilder builder, object child) - { - builder.AddChild (child); - } - } - - public class DatabaseNodeCommandHandler: NodeCommandHandler - { - [CommandHandler (MonoQueryCommands.RemoveConnection)] - protected void OnRemoveConnection () - { - MonoQueryService service = (MonoQueryService) ServiceManager.GetService (typeof (MonoQueryService)); - DbProviderBase provider = (DbProviderBase) CurrentNode.DataItem; - service.Providers.Remove (provider); - } - - [CommandHandler (MonoQueryCommands.RefreshConnection)] - protected void OnRefreshConnection () - { - DbProviderBase provider = (DbProviderBase) CurrentNode.DataItem; - provider.Refresh (); - } - - [CommandHandler (MonoQueryCommands.DisconnectConnection)] - protected void OnDisconnectConnection () - { - DbProviderBase provider = (DbProviderBase) CurrentNode.DataItem; - provider.Close (); - } - - public override void ActivateItem () - { - OnQueryCommand (); - } - - [CommandHandler (MonoQueryCommands.QueryCommand)] - protected void OnQueryCommand () - { - SqlQueryView sql = new SqlQueryView (); - sql.Connection = (DbProviderBase) CurrentNode.DataItem; - IdeApp.Workbench.OpenDocument (sql, true); - - CurrentNode.MoveToParent (); - } - } -} diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/GroupsNodeBuilder.cs b/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/GroupsNodeBuilder.cs deleted file mode 100644 index 3072ccde41..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/GroupsNodeBuilder.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// GroupsNodeBuilder.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -using Mono.Data.Sql; -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui.Pads; - -namespace MonoQuery -{ - public class GroupsNodeBuilder : TypeNodeBuilder - { - public GroupsNodeBuilder() - { - } - - public override Type NodeDataType { - get { - return typeof(GroupsNode); - } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return GettextCatalog.GetString ("Groups"); - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - label = GettextCatalog.GetString ("Groups"); - string iconName = "md-mono-query-tables"; - icon = Context.GetIcon (iconName); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - GroupsNode node = (GroupsNode) dataObject; - BuildChildNodes (builder, node); - } - - public static void BuildChildNodes (ITreeBuilder builder, GroupsNode node) - { - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - return true; - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/LanguagesNodeBuilder.cs b/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/LanguagesNodeBuilder.cs deleted file mode 100644 index d0de03c135..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/LanguagesNodeBuilder.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// LanguagesNodeBuilder.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -using Mono.Data.Sql; -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui.Pads; - -namespace MonoQuery -{ - public class LanguagesNodeBuilder : TypeNodeBuilder - { - public LanguagesNodeBuilder() - { - } - - public override Type NodeDataType { - get { - return typeof(LanguagesNode); - } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return GettextCatalog.GetString ("Languages"); - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - label = GettextCatalog.GetString ("Languages"); - string iconName = "md-mono-query-tables"; - icon = Context.GetIcon (iconName); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - LanguagesNode node = (LanguagesNode) dataObject; - BuildChildNodes (builder, node); - } - - public static void BuildChildNodes (ITreeBuilder builder, LanguagesNode node) - { - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - return true; - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/OperatorsNodeBuilder.cs b/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/OperatorsNodeBuilder.cs deleted file mode 100644 index eecec67cec..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/OperatorsNodeBuilder.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// OperatorsNodeBuilder.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -using Mono.Data.Sql; -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui.Pads; - -namespace MonoQuery -{ - public class OperatorsNodeBuilder : TypeNodeBuilder - { - public OperatorsNodeBuilder() - { - } - - public override Type NodeDataType { - get { - return typeof(OperatorsNode); - } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return GettextCatalog.GetString ("Operators"); - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - label = GettextCatalog.GetString ("Operators"); - string iconName = "md-mono-query-tables"; - icon = Context.GetIcon (iconName); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - OperatorsNode node = (OperatorsNode) dataObject; - BuildChildNodes (builder, node); - } - - public static void BuildChildNodes (ITreeBuilder builder, OperatorsNode node) - { - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - return true; - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ParametersNodeBuilder.cs b/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ParametersNodeBuilder.cs deleted file mode 100644 index 5221c696cd..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ParametersNodeBuilder.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// ParametersNodeBuilder.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -using Mono.Data.Sql; -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui.Pads; - -namespace MonoQuery -{ - public class ParametersNodeBuilder : TypeNodeBuilder - { - public ParametersNodeBuilder() - { - } - - public override Type NodeDataType { - get { - return typeof(ParametersNode); - } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return GettextCatalog.GetString ("Parameters"); - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - label = GettextCatalog.GetString ("Parameters"); - string iconName = "md-mono-query-tables"; - icon = Context.GetIcon (iconName); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - ParametersNode node = (ParametersNode) dataObject; - BuildChildNodes (builder, node); - } - - public static void BuildChildNodes (ITreeBuilder builder, ParametersNode node) - { - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - return true; - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ProcedureNodeBuilder.cs b/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ProcedureNodeBuilder.cs deleted file mode 100644 index 157338a0f0..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ProcedureNodeBuilder.cs +++ /dev/null @@ -1,109 +0,0 @@ -// -// ProcedureNodeBuilder.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Data; - -using Mono.Data.Sql; - -using MonoDevelop.Core; -using MonoDevelop.Core.Gui; -using MonoDevelop.Ide.Gui.Pads; -using MonoDevelop.Components; - -namespace MonoQuery -{ - public class ProcedureNodeBuilder : TypeNodeBuilder - { - public ProcedureNodeBuilder () - { - } - - public override Type NodeDataType { - get { - return typeof (ProcedureSchema); - } - } - - public override Type CommandHandlerType { - get { - return typeof (ProcedureNodeCommandHandler); - } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return GettextCatalog.GetString ("Procedure"); - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - label = (dataObject as ProcedureSchema).Name; - string iconName = "md-mono-query-table"; - icon = Context.GetIcon (iconName); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - ProcedureSchema node = (ProcedureSchema) dataObject; - BuildChildNodes (builder, node); - } - - public static void BuildChildNodes (ITreeBuilder builder, ProcedureSchema node) - { - builder.AddChild (new ColumnsNode (node.Provider, node)); - builder.AddChild (new ParametersNode (node.Provider)); - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - return true; - } - } - - public class ProcedureNodeCommandHandler : NodeCommandHandler - { - public override DragOperation CanDragNode () - { - return DragOperation.None; - } - - public override void OnItemSelected () - { - ProcedureSchema table = CurrentNode.DataItem as ProcedureSchema; - MonoQueryService service = (MonoQueryService) ServiceManager.GetService (typeof (MonoQueryService)); - - if (service.SqlDefinitionPad != null) - service.SqlDefinitionPad.SetText (table.Definition); - } - - public override void ActivateItem () - { - } - } -} diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ProceduresNodeBuilder.cs b/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ProceduresNodeBuilder.cs deleted file mode 100644 index 11f87b9c0d..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ProceduresNodeBuilder.cs +++ /dev/null @@ -1,107 +0,0 @@ -// -// ProceduresNodeBuilder.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Threading; - -using Mono.Data.Sql; -using MonoDevelop.Core; -using MonoDevelop.Core.Gui; -using MonoDevelop.Ide.Gui.Pads; - -namespace MonoQuery -{ - public class ProceduresNodeBuilder : TypeNodeBuilder - { - private delegate void AddProcedureHandler (ITreeBuilder builder, ProcedureSchema schema); - private event AddProcedureHandler AddProcedure; - - private object ThreadSync = new Object (); - private ITreeBuilder threadedBuilder; - private ProceduresNode threadedNode; - - public ProceduresNodeBuilder() - { - AddProcedure += (AddProcedureHandler) DispatchService.GuiDispatch (new AddProcedureHandler (OnProcedureAdd)); - } - - public override Type NodeDataType { - get { - return typeof(ProceduresNode); - } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return GettextCatalog.GetString ("Procedures"); - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - label = GettextCatalog.GetString ("Procedures"); - string iconName = "md-mono-query-tables"; - icon = Context.GetIcon (iconName); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - ProceduresNode node = (ProceduresNode) dataObject; - BuildChildNodes (builder, node); - } - - public void BuildChildNodes (ITreeBuilder builder, ProceduresNode node) - { - lock (ThreadSync) { - threadedBuilder = builder; - threadedNode = node; - Thread thread = new Thread (new ThreadStart (BuildChildNodesThreadStart)); - thread.Start (); - } - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - return true; - } - - private void OnProcedureAdd (ITreeBuilder builder, ProcedureSchema schema) - { - if (((bool)builder.Options["ShowSystemObjects"]) == true || schema.IsSystemProcedure == false) - builder.AddChild (schema); - builder.Expanded = true; - } - - private void BuildChildNodesThreadStart () - { - ITreeBuilder builder = threadedBuilder; - foreach (ProcedureSchema proc in threadedNode.Provider.GetProcedures ()) { - AddProcedure (builder, proc); - } - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ProviderCollectionNodeBuilder.cs b/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ProviderCollectionNodeBuilder.cs deleted file mode 100644 index ff081ddb30..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ProviderCollectionNodeBuilder.cs +++ /dev/null @@ -1,84 +0,0 @@ -// -// ProviderCollectionNodeBuilder.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -using Mono.Data.Sql; -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui.Pads; - -namespace MonoQuery -{ - public class ProviderCollectionNodeBuilder : TypeNodeBuilder - { - public ProviderCollectionNodeBuilder() : base() - { - } - - public override Type NodeDataType { - get { - return typeof(DbProviderCollection); - } - } - - public override string ContextMenuAddinPath { - get { - return "/SharpDevelop/Views/DatabasePad/ContextMenu/ConnectionsBrowserNode"; - } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return GettextCatalog.GetString ("Database Connections"); - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - label = GettextCatalog.GetString ("Database Connections"); - string iconName = "md-mono-query-providers"; - icon = Context.GetIcon (iconName); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - DbProviderCollection collection = (DbProviderCollection) dataObject; - BuildChildNodes (builder, collection); - } - - public static void BuildChildNodes (ITreeBuilder builder, DbProviderCollection collection) - { - foreach (DbProviderBase provider in collection) - builder.AddChild (provider); - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - return true; - } - } -} diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/RolesNodeBuilder.cs b/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/RolesNodeBuilder.cs deleted file mode 100644 index 0353c94afb..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/RolesNodeBuilder.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// RolesNodeBuilder.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -using Mono.Data.Sql; -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui.Pads; - -namespace MonoQuery -{ - public class RolesNodeBuilder : TypeNodeBuilder - { - public RolesNodeBuilder() - { - } - - public override Type NodeDataType { - get { - return typeof(RolesNode); - } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return GettextCatalog.GetString ("Roles"); - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - label = GettextCatalog.GetString ("Roles"); - string iconName = "md-mono-query-tables"; - icon = Context.GetIcon (iconName); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - RolesNode node = (RolesNode) dataObject; - BuildChildNodes (builder, node); - } - - public static void BuildChildNodes (ITreeBuilder builder, RolesNode node) - { - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - return true; - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/RulesNodeBuilder.cs b/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/RulesNodeBuilder.cs deleted file mode 100644 index b3f9abfeb8..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/RulesNodeBuilder.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// RulesNodeBuilder.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -using Mono.Data.Sql; -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui.Pads; - -namespace MonoQuery -{ - public class RulesNodeBuilder : TypeNodeBuilder - { - public RulesNodeBuilder() - { - } - - public override Type NodeDataType { - get { - return typeof(RulesNode); - } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return GettextCatalog.GetString ("Rules"); - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - label = GettextCatalog.GetString ("Rules"); - string iconName = "md-mono-query-tables"; - icon = Context.GetIcon (iconName); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - RulesNode node = (RulesNode) dataObject; - BuildChildNodes (builder, node); - } - - public static void BuildChildNodes (ITreeBuilder builder, RulesNode node) - { - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - return true; - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/SequencesNodeBuilder.cs b/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/SequencesNodeBuilder.cs deleted file mode 100644 index f23a1a911f..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/SequencesNodeBuilder.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// NodeBuilder.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -using Mono.Data.Sql; -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui.Pads; - -namespace MonoQuery -{ - public class SequencesNodeBuilder : TypeNodeBuilder - { - public SequencesNodeBuilder() - { - } - - public override Type NodeDataType { - get { - return typeof(SequencesNode); - } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return GettextCatalog.GetString ("Sequences"); - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - label = GettextCatalog.GetString ("Sequences"); - string iconName = "md-mono-query-tables"; - icon = Context.GetIcon (iconName); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - SequencesNode node = (SequencesNode) dataObject; - BuildChildNodes (builder, node); - } - - public static void BuildChildNodes (ITreeBuilder builder, SequencesNode node) - { - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - return true; - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/TableNodeBuilder.cs b/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/TableNodeBuilder.cs deleted file mode 100644 index 4db1e8c0c2..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/TableNodeBuilder.cs +++ /dev/null @@ -1,180 +0,0 @@ -// -// TableNodeBuilder.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Data; - -using Mono.Data.Sql; - -using MonoDevelop.Core; -using MonoDevelop.Core.Gui; -using MonoDevelop.Ide.Gui; -using MonoDevelop.Ide.Gui.Pads; -using MonoDevelop.Components.Commands; - -using MonoQuery.Commands; - -namespace MonoQuery -{ - public class TableNodeBuilder : TypeNodeBuilder - { - public TableNodeBuilder () - { - } - - public override Type NodeDataType { - get { - return typeof (TableSchema); - } - } - - public override Type CommandHandlerType { - get { - return typeof (TableNodeCommandHandler); - } - } - - public override string ContextMenuAddinPath { - get { - return "/SharpDevelop/Views/DatabasePad/ContextMenu/TableBrowserNode"; - } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return GettextCatalog.GetString ("Table"); - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - label = (dataObject as TableSchema).Name; - string iconName = "md-mono-query-table"; - icon = Context.GetIcon (iconName); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - TableSchema node = (TableSchema) dataObject; - BuildChildNodes (builder, node); - } - - public static void BuildChildNodes (ITreeBuilder builder, TableSchema node) - { - if (node.Provider.SupportsSchemaType (typeof (ColumnSchema))) - builder.AddChild (new ColumnsNode (node.Provider, node)); - - if (node.Provider.SupportsSchemaType (typeof (RuleSchema))) - builder.AddChild (new RulesNode (node.Provider)); - - if (node.Provider.SupportsSchemaType (typeof (ConstraintSchema))) - builder.AddChild (new ConstraintsNode (node.Provider, node)); - - if (node.Provider.SupportsSchemaType (typeof (TriggerSchema))) - builder.AddChild (new TriggersNode (node.Provider)); - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - return true; - } - } - - public class TableNodeCommandHandler : NodeCommandHandler - { - public override DragOperation CanDragNode () - { - return DragOperation.None; - } - - public override void OnItemSelected () - { - TableSchema table = CurrentNode.DataItem as TableSchema; - MonoQueryService service = (MonoQueryService) ServiceManager.GetService (typeof (MonoQueryService)); - - if (service.SqlDefinitionPad != null) - service.SqlDefinitionPad.SetText (table.Definition); - } - - public override void ActivateItem () - { - TableSchema table = CurrentNode.DataItem as TableSchema; - string query = String.Format ("SELECT * FROM {0}", table.Name); - table.Provider.ExecuteSQL (query, (SQLCallback) DispatchService.GuiDispatch (new SQLCallback (ActivateSQLCallback))); - } - - protected void ActivateSQLCallback (object sender, object res) - { - DataTable results = (res as DataTable); - - DataGridView dataView = new DataGridView (results); - IdeApp.Workbench.OpenDocument (dataView, true); - } - - [CommandHandler (MonoQueryCommands.QueryCommand)] - protected void OnQueryCommand () - { - SqlQueryView sql = new SqlQueryView (); - TableSchema table = (TableSchema) CurrentNode.DataItem; - sql.Connection = table.Provider; - sql.Text = String.Format ("SELECT * FROM {0}", table.Name); - IdeApp.Workbench.OpenDocument (sql, true); - } - - [CommandHandler (MonoQueryCommands.EmptyTable)] - protected void OnEmptyTable () - { - TableSchema table = (TableSchema) CurrentNode.DataItem; - table.Provider.ExecuteSQL (String.Format ( - "DELETE FROM {0}", table.Name)); - IdeApp.Workbench.StatusBar.SetMessage ( - GettextCatalog.GetString ("Table emptied")); - } - - [CommandHandler (MonoQueryCommands.DropTable)] - protected void OnDropTable () - { - TableSchema table = (TableSchema) CurrentNode.DataItem; - table.Provider.ExecuteSQL (String.Format ( - "DROP TABLE {0}", table.Name)); - IdeApp.Workbench.StatusBar.SetMessage ( - GettextCatalog.GetString ("Table dropped")); - - OnRefresh (); - } - - [CommandHandler (MonoQueryCommands.Refresh)] - protected void OnRefresh () - { - CurrentNode.MoveToParent (); - if (CurrentNode.DataItem as TablesNode != null) - (CurrentNode.DataItem as TablesNode).Refresh (); - - CurrentNode.ExpandToNode (); - } - } -} diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/TablesNodeBuilder.cs b/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/TablesNodeBuilder.cs deleted file mode 100644 index 194dfcfb15..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/TablesNodeBuilder.cs +++ /dev/null @@ -1,166 +0,0 @@ -// -// TablesNodeBuilder.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Threading; - -using Mono.Data.Sql; -using MonoDevelop.Core; -using MonoDevelop.Core.Gui; -using MonoDevelop.Ide.Gui; -using MonoDevelop.Ide.Gui.Pads; -using MonoDevelop.Components.Commands; - -using MonoQuery.Commands; - -namespace MonoQuery -{ - public class TablesNodeBuilder : TypeNodeBuilder - { - private delegate void AddTableHandler (ITreeBuilder builder, TableSchema schema); - private event AddTableHandler AddTable; - - private object ThreadSync = new Object (); - private ITreeBuilder threadedBuilder; - private TablesNode threadedNode; - - private EventHandler RefreshHandler; - - public TablesNodeBuilder() - { - AddTable += (AddTableHandler) DispatchService.GuiDispatch (new AddTableHandler (OnTableAdd)); - RefreshHandler = (EventHandler) DispatchService.GuiDispatch (new EventHandler (OnRefreshEvent)); - } - - public override Type NodeDataType { - get { - return typeof(TablesNode); - } - } - - public override Type CommandHandlerType { - get { - return typeof (TablesNodeCommandHandler); - } - } - - public override string ContextMenuAddinPath { - get { - return "/SharpDevelop/Views/DatabasePad/ContextMenu/TablesBrowserNode"; - } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return GettextCatalog.GetString ("Tables"); - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - label = GettextCatalog.GetString ("Tables"); - string iconName = "md-mono-query-tables"; - icon = Context.GetIcon (iconName); - - TablesNode node = (TablesNode) dataObject; - node.RefreshEvent += RefreshHandler; - } - - void OnRefreshEvent (object sender, EventArgs args) - { - ITreeBuilder builder = Context.GetTreeBuilder (); - - if (builder != null) - builder.UpdateChildren (); - - builder.ExpandToNode (); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - TablesNode node = (TablesNode) dataObject; - BuildChildNodes (builder, node); - } - - public void BuildChildNodes (ITreeBuilder builder, TablesNode node) - { - if (node.Provider.IsOpen == false && node.Provider.Open () == false) - return; - - lock (ThreadSync) { - threadedBuilder = builder; - threadedNode = node; - Thread thread = new Thread (new ThreadStart (BuildChildNodesThreadStart)); - thread.Start (); - } - } - - private void BuildChildNodesThreadStart () - { - ITreeBuilder builder = threadedBuilder; - foreach (TableSchema schema in threadedNode.Provider.GetTables ()) { - AddTable (builder, schema); - } - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - return true; - } - - private void OnTableAdd (ITreeBuilder builder, TableSchema schema) - { - if (((bool)builder.Options["ShowSystemObjects"]) == true || schema.IsSystemTable == false) - builder.AddChild (schema); - builder.Expanded = true; - } - } - - public class TablesNodeCommandHandler : NodeCommandHandler - { - public override DragOperation CanDragNode () - { - return DragOperation.None; - } - - [CommandHandler (MonoQueryCommands.QueryCommand)] - protected void OnQueryCommand () - { - SqlQueryView sql = new SqlQueryView (); - TablesNode node = (TablesNode) CurrentNode.DataItem; - sql.Connection = node.Provider; - IdeApp.Workbench.OpenDocument (sql, true); - } - - [CommandHandler (MonoQueryCommands.Refresh)] - protected void OnRefresh () - { - TablesNode node = (TablesNode) CurrentNode.DataItem; - node.Refresh (); - } - } -} diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/TriggersNodeBuilder.cs b/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/TriggersNodeBuilder.cs deleted file mode 100644 index ee49ba82e2..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/TriggersNodeBuilder.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// TriggersNodeBuilder.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -using Mono.Data.Sql; -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui.Pads; - -namespace MonoQuery -{ - public class TriggersNodeBuilder : TypeNodeBuilder - { - public TriggersNodeBuilder() - { - } - - public override Type NodeDataType { - get { - return typeof(TriggersNode); - } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return GettextCatalog.GetString ("Triggers"); - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - label = GettextCatalog.GetString ("Triggers"); - string iconName = "md-mono-query-tables"; - icon = Context.GetIcon (iconName); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - TriggersNode node = (TriggersNode) dataObject; - BuildChildNodes (builder, node); - } - - public static void BuildChildNodes (ITreeBuilder builder, TriggersNode node) - { - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - return true; - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/TypesNodeBuilder.cs b/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/TypesNodeBuilder.cs deleted file mode 100644 index c0893a3923..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/TypesNodeBuilder.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// TypesNodeBuilder.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -using Mono.Data.Sql; -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui.Pads; - -namespace MonoQuery -{ - public class TypesNodeBuilder : TypeNodeBuilder - { - public TypesNodeBuilder () - { - } - - public override Type NodeDataType { - get { - return typeof(TypesNode); - } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return GettextCatalog.GetString ("Types"); - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - label = GettextCatalog.GetString ("Types"); - string iconName = "md-mono-query-tables"; - icon = Context.GetIcon (iconName); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - TypesNode node = (TypesNode) dataObject; - BuildChildNodes (builder, node); - } - - public static void BuildChildNodes (ITreeBuilder builder, TypesNode node) - { - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - return true; - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/UserNodeBuilder.cs b/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/UserNodeBuilder.cs deleted file mode 100644 index 6b7dbb5f01..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/UserNodeBuilder.cs +++ /dev/null @@ -1,90 +0,0 @@ -// -// UserNodeBuilder.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -using Mono.Data.Sql; -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui.Pads; - -namespace MonoQuery -{ - public class UserNodeBuilder : TypeNodeBuilder - { - public UserNodeBuilder () - { - } - - public override Type NodeDataType { - get { - return typeof (UserSchema); - } - } - - public override Type CommandHandlerType { - get { - return typeof (UserNodeCommandHandler); - } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return GettextCatalog.GetString ("User"); - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - UserSchema user = (UserSchema) dataObject; - label = user.Name; - string iconName = "md-mono-query-user"; - icon = Context.GetIcon (iconName); - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - return false; - } - } - - public class UserNodeCommandHandler : NodeCommandHandler - { - public override DragOperation CanDragNode () - { - return DragOperation.None; - } - - public override void OnItemSelected () - { - UserSchema user = CurrentNode.DataItem as UserSchema; - MonoQueryService service = (MonoQueryService) ServiceManager.GetService (typeof (MonoQueryService)); - - if (service.SqlDefinitionPad != null) - service.SqlDefinitionPad.SetText(user.Definition); - } - } -} diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/UsersNodeBuilder.cs b/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/UsersNodeBuilder.cs deleted file mode 100644 index 4b8bd386f9..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/UsersNodeBuilder.cs +++ /dev/null @@ -1,78 +0,0 @@ -// -// UsersNodeBuilder.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -using Mono.Data.Sql; -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui.Pads; - -namespace MonoQuery -{ - public class UsersNodeBuilder : TypeNodeBuilder - { - public UsersNodeBuilder() - { - } - - public override Type NodeDataType { - get { - return typeof(UsersNode); - } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return GettextCatalog.GetString ("Users"); - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - label = GettextCatalog.GetString ("Users"); - string iconName = "md-mono-query-user"; - icon = Context.GetIcon (iconName); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - UsersNode node = (UsersNode) dataObject; - BuildChildNodes (builder, node); - } - - public static void BuildChildNodes (ITreeBuilder builder, UsersNode node) - { - foreach (UserSchema user in node.Provider.GetUsers ()) - builder.AddChild (user); - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - return true; - } - } -} diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ViewNodeBuilder.cs b/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ViewNodeBuilder.cs deleted file mode 100644 index 2d37907946..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ViewNodeBuilder.cs +++ /dev/null @@ -1,101 +0,0 @@ -// -// ViewNodeBuilder.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -using Mono.Data.Sql; -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui.Pads; - -namespace MonoQuery -{ - public class ViewNodeBuilder : TypeNodeBuilder - { - public ViewNodeBuilder () - { - } - - public override Type NodeDataType { - get { - return typeof (ViewSchema); - } - } - - public override Type CommandHandlerType { - get { - return typeof (ViewNodeCommandHandler); - } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return GettextCatalog.GetString ("View"); - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - ViewSchema schema = (ViewSchema) dataObject; - label = schema.Name; - string iconName = "md-mono-query-table"; - icon = Context.GetIcon (iconName); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - ViewSchema node = (ViewSchema) dataObject; - BuildChildNodes (builder, node); - } - - public static void BuildChildNodes (ITreeBuilder builder, ViewSchema node) - { - builder.AddChild(new ColumnsNode(node.Provider, node)); - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - return true; - } - } - - public class ViewNodeCommandHandler : NodeCommandHandler - { - public override DragOperation CanDragNode () - { - return DragOperation.None; - } - - public override void OnItemSelected () - { - ViewSchema view = CurrentNode.DataItem as ViewSchema; - MonoQueryService service = (MonoQueryService) ServiceManager.GetService (typeof (MonoQueryService)); - - if (service.SqlDefinitionPad != null) - service.SqlDefinitionPad.SetText(view.Definition); - } - } -} diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ViewsNodeBuilder.cs b/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ViewsNodeBuilder.cs deleted file mode 100644 index eae848ecca..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/NodeBuilders/ViewsNodeBuilder.cs +++ /dev/null @@ -1,90 +0,0 @@ -// -// ViewsNodeBuilder.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -using Mono.Data.Sql; -using MonoDevelop.Core; -using MonoDevelop.Core.Gui; -using MonoDevelop.Ide.Gui.Pads; - -namespace MonoQuery -{ - public class ViewsNodeBuilder : TypeNodeBuilder - { - public ViewsNodeBuilder() - { - } - - public override Type NodeDataType { - get { - return typeof(ViewsNode); - } - } - - public override string GetNodeName (ITreeNavigator thisNode, object dataObject) - { - return GettextCatalog.GetString ("Views"); - } - - public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) - { - label = GettextCatalog.GetString ("Views"); - string iconName = "md-mono-query-tables"; - icon = Context.GetIcon (iconName); - } - - public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { - ViewsNode node = (ViewsNode) dataObject; - BuildChildNodes (builder, node); - } - - public static void BuildChildNodes (ITreeBuilder builder, ViewsNode node) - { - if (node.Provider.IsOpen == false) { - try { - if (node.Provider.Open() == false) return; - } catch { - Services.MessageService.ShowMessage (GettextCatalog.GetString ("There was an error connecting to the database server.")); - return; - } - } - - foreach(ViewSchema schema in node.Provider.GetViews()) { - if ((bool)builder.Options["ShowSystemObjects"] == true || schema.IsSystemView == false) - builder.AddChild(schema); - } - } - - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) - { - return true; - } - } -} diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/SqlDefinitionPad.cs b/main/Unused/MonoQuery/MonoQuery/Gui/SqlDefinitionPad.cs deleted file mode 100644 index 540f3fe000..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/SqlDefinitionPad.cs +++ /dev/null @@ -1,88 +0,0 @@ -// -// SqlDefinitionPad.cs: Displays definition of a sql object. -// -// Author: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (C) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Resources; - -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui; -using MonoDevelop.Ide.Gui.Pads; -using MonoDevelop.Core.Gui; - -using Gtk; -using GtkSourceView; - -using Mono.Data.Sql; - -namespace MonoQuery -{ - public class SqlDefinitionPad : AbstractPadContent - { - MonoQueryService service = (MonoQueryService)ServiceManager.GetService (typeof (MonoQueryService)); - - Gtk.Frame frame; - Gtk.ScrolledWindow sw; - GtkSourceView.SourceView textView; - GtkSourceView.SourceBuffer textBuffer; - - public SqlDefinitionPad () : base ("SQL Definition", "md-mono-query-view") - { - frame = new Gtk.Frame (); - sw = new Gtk.ScrolledWindow (); - frame.Add (sw); - SourceLanguagesManager lm = new SourceLanguagesManager (); - GtkSourceView.SourceLanguage lang = lm.GetLanguageFromMimeType("text/x-sql"); - if (lang != null) - textBuffer = new SourceBuffer (lang); - else - textBuffer = new SourceBuffer (new GtkSourceView.SourceTagTable ()); - - textBuffer.Highlight = true; - textView = new SourceView (textBuffer); - textView.ShowLineNumbers = false; - textView.ShowMargin = false; - textView.TabsWidth = 2; - textView.Editable = false; - sw.Add (textView); - frame.ShowAll (); - - service.SqlDefinitionPad = this; - } - - public override Gtk.Widget Control { - get { - return frame; - } - } - - public void SetText (string text) - { - this.textBuffer.Text = text; - } - } -} diff --git a/main/Unused/MonoQuery/MonoQuery/Gui/SqlQueryView.cs b/main/Unused/MonoQuery/MonoQuery/Gui/SqlQueryView.cs deleted file mode 100644 index b8e8e51124..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Gui/SqlQueryView.cs +++ /dev/null @@ -1,502 +0,0 @@ -// -// SqlQueryView.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// Daniel Morgan <danielmorgan@verizon.net> -// -// Copyright (C) 2005 Christian Hergert -// Copyright (C) 2005 Daniel Morgan -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -using System; -using System.Data; - -using Gtk; -using GtkSourceView; - -using Mono.Data.Sql; - -using MonoDevelop.Core; -using MonoDevelop.Components; -using MonoDevelop.Ide.Gui; -using MonoDevelop.Core.Gui; - -namespace MonoQuery -{ - public class SqlQueryView : AbstractViewContent - { - protected Frame control; - protected SourceView sourceView; - protected ComboBox providers; - - protected ListStore model; - - protected EventHandler changedHandler; - - protected MonoQueryService service; - - private int executeMode = 0; - private int offset = 0; - - public SqlQueryView () : base () - { - control = new Frame (); - control.Show (); - - VBox vbox = new VBox (); - vbox.Show (); - - Tooltips tips = new Tooltips (); - - Toolbar toolbar = new Toolbar (); - vbox.PackStart (toolbar, false, true, 0); - toolbar.Show (); - - Image image = new Image (); - image.Pixbuf = Gdk.Pixbuf.LoadFromResource ("MonoQuery.Execute"); - image.Show (); - - Button execute = new Button (image); - execute.Clicked += new EventHandler (OnExecute); - execute.Relief = ReliefStyle.None; - tips.SetTip (execute, "Execute", ""); - toolbar.Add (execute); - execute.Show (); - - image = new Image (); - image.Pixbuf = Gdk.Pixbuf.LoadFromResource ("MonoQuery.RunFromCursor"); - image.Show (); - - Button run = new Button (image); - run.Clicked += new EventHandler (OnRunFromCursor); - run.Relief = ReliefStyle.None; - tips.SetTip (run, "Run from cursor", ""); - toolbar.Add (run); - run.Show (); - - image = new Image (); - image.Pixbuf = Gdk.Pixbuf.LoadFromResource ("MonoQuery.Explain"); - image.Show (); - - Button explain = new Button (image); - explain.Clicked += new EventHandler (OnExplain); - explain.Relief = ReliefStyle.None; - tips.SetTip (explain, "Explain query", ""); - toolbar.Add (explain); - explain.Show (); - - image = new Image (); - image.Pixbuf = Gdk.Pixbuf.LoadFromResource ("MonoQuery.Stop"); - image.Show (); - - Button stop = new Button (image); - stop.Clicked += new EventHandler (OnStop); - stop.Relief = ReliefStyle.None; - stop.Sensitive = false; - tips.SetTip (stop, "Stop", ""); - toolbar.Add (stop); - stop.Show (); - - VSeparator sep = new VSeparator (); - toolbar.Add (sep); - sep.Show (); - - model = new ListStore (typeof (string), typeof (DbProviderBase)); - - providers = new ComboBox (); - providers.Model = model; - CellRendererText ctext = new CellRendererText (); - providers.PackStart (ctext, true); - providers.AddAttribute (ctext, "text", 0); - toolbar.Add (providers); - providers.Show (); - - SourceLanguagesManager lm = new SourceLanguagesManager (); - SourceLanguage lang = lm.GetLanguageFromMimeType ("text/x-sql"); - SourceBuffer buf = new SourceBuffer (lang); - buf.Highlight = true; - sourceView = new SourceView (buf); - sourceView.ShowLineNumbers = true; - sourceView.Show (); - - ScrolledWindow scroller = new ScrolledWindow (); - scroller.Add (sourceView); - scroller.Show (); - vbox.PackStart (scroller, true, true, 0); - - control.Add (vbox); - - service = (MonoQueryService) - ServiceManager.GetService (typeof (MonoQueryService)); - changedHandler - = (EventHandler) DispatchService.GuiDispatch ( - new EventHandler (OnProvidersChanged)); - service.Providers.Changed += changedHandler; - - foreach (DbProviderBase p in service.Providers) { - model.AppendValues (p.Name, p); - } - } - - public string Text { - get { - return sourceView.Buffer.Text; - } - set { - sourceView.Buffer.Text = value; - } - } - - public override Gtk.Widget Control { - get { - return control; - } - } - - public override string UntitledName { - get { - return "SQL Query"; - } - } - - public override void Dispose () - { - service.Providers.Changed -= changedHandler; - } - - public override void Load (string filename) - { - } - - public DbProviderBase Connection { - set { - int i = 0; - foreach (object[] row in model) { - if (row[1] == value) - providers.Active = i; - i++; - } - } - get { - TreeIter iter; - providers.GetActiveIter (out iter); - return (DbProviderBase) model.GetValue (iter, 1); - } - } - - void OnExecute (object sender, EventArgs args) - { - TextBuffer buf = (TextBuffer) sourceView.Buffer; - TextIter iter = buf.StartIter; - TextIter end_iter = buf.EndIter; - string query = String.Empty; - - if (buf.GetSelectionBounds (out iter, out end_iter) == true) { - query = buf.GetText (iter, end_iter, false); - executeMode = 2; // as-is - } else { - query = GetSqlStatementAtCursor (buf, out iter); - executeMode = 0; // one single statement at cursor - } - - if (query.Trim ().Length > 0) { - IdeApp.Workbench.StatusBar.BeginProgress ( - GettextCatalog.GetString("Executing sql query on") - + String.Format (" {0}", Connection.Name)); - IdeApp.Workbench.StatusBar.SetProgressFraction (0.1); - - IdeApp.Workbench.StatusBar.SetMessage ( - GettextCatalog.GetString ("Query sent, waiting for response.")); - IdeApp.Workbench.StatusBar.SetProgressFraction (0.5); - - SQLCallback callback = (SQLCallback) - DispatchService.GuiDispatch ( - new SQLCallback (OnExecuteReturn)); - - buf.MoveMark (buf.InsertMark, iter); - buf.MoveMark (buf.SelectionBound, iter); - - offset = 0; - Connection.ExecuteSQL (query, callback); - } - } - - void OnRunFromCursor (object sender, EventArgs args) - { - TextBuffer buf = (TextBuffer) sourceView.Buffer; - TextIter iter = buf.StartIter; - TextIter end_iter = buf.EndIter; - string query = String.Empty; - - if (buf.GetSelectionBounds (out iter, out end_iter) == true) { - query = buf.GetText (iter, end_iter, false); - executeMode = 2; // as-is - } else { - query = GetSqlStatementAtCursor (buf, out iter); - executeMode = 1; // one multiple statements one-at-a-time starting at cursor - } - - if (query.Trim ().Length > 0) { - IdeApp.Workbench.StatusBar.BeginProgress ( - GettextCatalog.GetString("Executing sql query on") - + String.Format (" {0}", Connection.Name)); - IdeApp.Workbench.StatusBar.SetProgressFraction (0.1); - - IdeApp.Workbench.StatusBar.SetMessage ( - GettextCatalog.GetString ("Query sent, waiting for response.")); - IdeApp.Workbench.StatusBar.SetProgressFraction (0.5); - - SQLCallback callback = (SQLCallback) - DispatchService.GuiDispatch ( - new SQLCallback (OnExecuteReturn)); - - buf.MoveMark (buf.InsertMark, iter); - buf.MoveMark (buf.SelectionBound, iter); - - executeMode = 1; // Execute multiple statements one-at-a-time starting at cursor - offset = iter.Offset; - Connection.ExecuteSQL (query, callback); - } - } - - void OnExecuteReturn (object sender, object results) - { - IdeApp.Workbench.StatusBar.SetMessage ( - GettextCatalog.GetString ("Query results received")); - IdeApp.Workbench.StatusBar.SetProgressFraction (0.9); - - TextBuffer buf = (TextBuffer) sourceView.Buffer; - if (results == null) { - IdeApp.Workbench.StatusBar.ShowErrorMessage ( - GettextCatalog.GetString ("Invalid select query")); - if (executeMode == 1) - sourceView.ScrollToMark (buf.InsertMark, 0.4, true, 0.0, 1.0); - } else { - DataGridView dataView = new DataGridView (results as DataTable); - IdeApp.Workbench.OpenDocument (dataView, true); - - if (executeMode == 1) { - // execute multiple SQL - TextIter iter = buf.StartIter; - iter.Offset = offset; - string query = GetNextSqlStatement (buf, ref iter); - if (query.Trim ().Length > 0) { - SQLCallback callback = (SQLCallback) - DispatchService.GuiDispatch ( - new SQLCallback (OnExecuteReturn)); - - // move insert mark to end of SQL statement to be executed - buf.MoveMark (buf.InsertMark, iter); - buf.MoveMark (buf.SelectionBound, iter); - - IdeApp.Workbench.StatusBar.SetMessage ( - GettextCatalog.GetString ("Query sent, waiting for response.")); - IdeApp.Workbench.StatusBar.SetProgressFraction (0.5); - - executeMode = 1; - offset = iter.Offset; - Connection.ExecuteSQL (query, callback); - } - else { - sourceView.ScrollToMark (buf.InsertMark, 0.4, true, 0.0, 1.0); - IdeApp.Workbench.StatusBar.EndProgress (); - } - } - else { - sourceView.ScrollToMark (buf.InsertMark, 0.4, true, 0.0, 1.0); - IdeApp.Workbench.StatusBar.EndProgress (); - } - } - } - - // Execute first SQL statement at cursor - public string GetSqlStatementAtCursor (TextBuffer sqlTextBuffer, out TextIter iter) - { - TextIter start_iter, end_iter, insert_iter; - TextIter match_start1, match_end1, match_start2, match_end2; - TextIter begin_iter, finish_iter; - string text = String.Empty; - int char_count = 0; - TextMark insert_mark; - - insert_mark = sqlTextBuffer.InsertMark; - insert_iter = sqlTextBuffer.GetIterAtMark (insert_mark); - start_iter = sqlTextBuffer.GetIterAtOffset (0); - - char_count = sqlTextBuffer.CharCount; - end_iter = sqlTextBuffer.GetIterAtOffset (char_count); - iter = end_iter; - - match_start1 = sqlTextBuffer.GetIterAtOffset (0); - match_end1 = sqlTextBuffer.GetIterAtOffset (char_count); - match_start2 = sqlTextBuffer.GetIterAtOffset (0); - match_end2 = sqlTextBuffer.GetIterAtOffset (char_count); - - begin_iter = sqlTextBuffer.GetIterAtOffset (0); - finish_iter = sqlTextBuffer.GetIterAtOffset (char_count); - - if (start_iter.IsEnd == false) - { - if (insert_iter.BackwardSearch (";", TextSearchFlags.TextOnly, - out match_start1, out match_end1, start_iter) == true) { - begin_iter = match_start1; - begin_iter.ForwardChars (1); - } - - if (insert_iter.ForwardSearch (";", TextSearchFlags.TextOnly, - out match_start2, out match_end2, end_iter) == true) { - finish_iter = match_end2; - finish_iter.BackwardChars (1); - } - iter = finish_iter; - text = sqlTextBuffer.GetText (begin_iter, finish_iter, false); - - // FIXME: for this to work. GetSqlStatement has to rewritten to be line-based - if (text.Length > 0) { - // search does not work if what you are searching for is - // at the end of the buffer, - // this compensates for this - int j = text.Length; - int cont = 1; - for(int i = text.Length - 1; cont == 1 && i >= 0; i--) { - char ch = text[i]; - switch(ch) { - case ' ': - case ';': - j--; - break; - default: - cont = 0; - break; - } - } - - if (j != text.Length) { - string t = text.Substring(0, j); - text = t; - } - } - } - - return text; - } - - // get next SQL statement. Requires GetSqlStatementAtCursor having been called first - public string GetNextSqlStatement (TextBuffer sqlTextBuffer, ref TextIter iter) - { - TextIter start_iter, end_iter; - TextIter match_start2, match_end2; - TextIter finish_iter; - string text = String.Empty; - int char_count = 0; - - char_count = sqlTextBuffer.CharCount; - end_iter = sqlTextBuffer.GetIterAtOffset (char_count); - if (iter.IsEnd == false) { - iter.ForwardChars (1); - if (sqlTextBuffer.GetText (iter, end_iter, false).Equals (";")) - iter.ForwardChars (1); - } - - if (iter.IsEnd == true) - return ""; - - start_iter = iter; - match_start2 = iter; - match_end2 = sqlTextBuffer.GetIterAtOffset (char_count); - finish_iter = sqlTextBuffer.GetIterAtOffset (char_count); - - if (start_iter.IsEnd == false) { - if (iter.ForwardSearch (";", TextSearchFlags.TextOnly, - out match_start2, out match_end2, end_iter) == true) { - finish_iter = match_end2; - finish_iter.BackwardChars (1); - } - - text = sqlTextBuffer.GetText (iter, finish_iter, false); - iter = finish_iter; - - if(text.Length > 0) { - // search does not work if what you are searching for is - // at the end of the buffer, - // this compensates for this - int j = text.Length; - int cont = 1; - for(int i = text.Length - 1; cont == 1 && i >= 0; i--) { - char ch = text[i]; - switch(ch) { - case ' ': - case ';': - j--; - break; - default: - cont = 0; - break; - } - } - - if(j != text.Length) { - string t = text.Substring(0, j); - text = t; - } - } - } - - return text; - } - - void OnExplain (object sender, EventArgs args) - { - IdeApp.Workbench.StatusBar.BeginProgress ( - GettextCatalog.GetString("Executing sql query on") - + String.Format (" {0}", Connection.Name)); - IdeApp.Workbench.StatusBar.SetProgressFraction (0.1); - - string query = sourceView.Buffer.Text; - SQLCallback callback = (SQLCallback) - DispatchService.GuiDispatch ( - new SQLCallback (OnExecuteReturn)); - - IdeApp.Workbench.StatusBar.SetMessage ( - GettextCatalog.GetString ("Query sent, waiting for response.")); - IdeApp.Workbench.StatusBar.SetProgressFraction (0.5); - - Connection.ExplainSQL (query, callback); - } - - void OnStop (object sender, EventArgs args) - { - } - - void OnProvidersChanged (object sender, EventArgs args) - { - DbProviderBase current = Connection; - model.Clear (); - - foreach (DbProviderBase p in service.Providers) { - TreeIter cur = model.AppendValues (p.Name, p); - if (p == current) - providers.SetActiveIter (cur); - } - } - } -} diff --git a/main/Unused/MonoQuery/MonoQuery/Makefile.am b/main/Unused/MonoQuery/MonoQuery/Makefile.am deleted file mode 100644 index 8599026922..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/Makefile.am +++ /dev/null @@ -1,106 +0,0 @@ - - -FILES = \ - AssemblyInfo.cs \ - Commands/Commands.cs \ - Gui/ConnectionDialog.cs \ - Gui/DatabasePad.cs \ - Gui/DataGridView.cs \ - Gui/DbProviderCollection.cs \ - Gui/FakeNodes.cs \ - Gui/NodeBuilders/AggregatesNodeBuilder.cs \ - Gui/NodeBuilders/ColumnNodeBuilder.cs \ - Gui/NodeBuilders/ColumnsNodeBuilder.cs \ - Gui/NodeBuilders/ConstraintNodeBuilder.cs \ - Gui/NodeBuilders/ConstraintsNodeBuilder.cs \ - Gui/NodeBuilders/DatabaseNodeBuilder.cs \ - Gui/NodeBuilders/GroupsNodeBuilder.cs \ - Gui/NodeBuilders/LanguagesNodeBuilder.cs \ - Gui/NodeBuilders/OperatorsNodeBuilder.cs \ - Gui/NodeBuilders/ParametersNodeBuilder.cs \ - Gui/NodeBuilders/ProcedureNodeBuilder.cs \ - Gui/NodeBuilders/ProceduresNodeBuilder.cs \ - Gui/NodeBuilders/ProviderCollectionNodeBuilder.cs \ - Gui/NodeBuilders/RolesNodeBuilder.cs \ - Gui/NodeBuilders/RulesNodeBuilder.cs \ - Gui/NodeBuilders/SequencesNodeBuilder.cs \ - Gui/NodeBuilders/TableNodeBuilder.cs \ - Gui/NodeBuilders/TablesNodeBuilder.cs \ - Gui/NodeBuilders/TriggersNodeBuilder.cs \ - Gui/NodeBuilders/TypesNodeBuilder.cs \ - Gui/NodeBuilders/UserNodeBuilder.cs \ - Gui/NodeBuilders/UsersNodeBuilder.cs \ - Gui/NodeBuilders/ViewNodeBuilder.cs \ - Gui/NodeBuilders/ViewsNodeBuilder.cs \ - Gui/SqlDefinitionPad.cs \ - Gui/SqlQueryView.cs \ - MonoQueryService.cs - -RES = \ - icons/MonoQuery.Addconnection \ - icons/MonoQuery.Blob \ - icons/MonoQuery.Column \ - icons/MonoQuery.ColumnFK \ - icons/MonoQuery.ColumnPK \ - icons/MonoQuery.Connect \ - icons/MonoQuery.Database \ - icons/MonoQuery.Database.Connected \ - icons/MonoQuery.Database.Disconnected \ - icons/MonoQuery.DateTime \ - icons/MonoQuery.Disconnect \ - icons/MonoQuery.Execute \ - icons/MonoQuery.Explain \ - icons/MonoQuery.Numeric \ - icons/MonoQuery.Param \ - icons/MonoQuery.Procedure \ - icons/MonoQuery.Providers \ - icons/MonoQuery.RunFromCursor \ - icons/MonoQuery.SqlQueryView \ - icons/MonoQuery.Stop \ - icons/MonoQuery.String \ - icons/MonoQuery.Table \ - icons/MonoQuery.Tables \ - icons/MonoQuery.User \ - icons/MonoQuery.View \ - MonoQuery.addin.xml \ - monoquery.glade - -ASSEMBLY = $(ADDIN_BUILD)/MonoQuery.dll - -ADDIN_BUILD = $(top_builddir)/build/AddIns/MonoQuery - -REFS = \ - $(GLADE_SHARP_LIBS) \ - $(GTK_SHARP_LIBS) \ - $(GTKSOURCEVIEW_SHARP_LIBS) \ - -r:$(top_builddir)/build/AddIns/MonoQuery/Mono.Data.Sql.dll \ - -r:$(top_builddir)/build/bin/Mono.Addins.dll \ - -r:$(top_builddir)/build/bin/MonoDevelop.Components.dll \ - -r:$(top_builddir)/build/bin/MonoDevelop.Core.dll \ - -r:$(top_builddir)/build/bin/MonoDevelop.Core.Gui.dll \ - -r:$(top_builddir)/build/bin/MonoDevelop.Ide.dll \ - -r:System \ - -r:System.Data \ - -r:System.Xml - -if ENABLE_MONOQUERY -all: $(ASSEMBLY) -else -all: -endif - -$(ASSEMBLY): $(build_sources) $(build_resources) - mkdir -p $(ADDIN_BUILD) - $(CSC) $(CSC_FLAGS) -target:library -out:$@ $(build_sources) $(REFS) \ - $(build_resources:%=/resource:%) - -CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb - -EXTRA_DIST = $(FILES) $(RES) Gui/DbProviderCollection.cs.in - -if ENABLE_MONOQUERY -monoquerydir = $(MD_ADDIN_DIR)/MonoQuery -monoquery_DATA = $(ASSEMBLY) -endif - -include $(top_srcdir)/Makefile.include diff --git a/main/Unused/MonoQuery/MonoQuery/MonoQuery.addin.xml b/main/Unused/MonoQuery/MonoQuery/MonoQuery.addin.xml deleted file mode 100644 index ff85ee312c..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/MonoQuery.addin.xml +++ /dev/null @@ -1,169 +0,0 @@ -<Addin id = "MonoQuery" - namespace = "MonoDevelop" - name = "MonoQuery Database Management" - author = "Christian Hergert" - copyright = "MIT X11" - url = "http://www.dronestudios.com" - description = "Database Management Module" - category = "IDE extensions" - version = "0.6.0"> - - <Runtime> - <Import assembly="Mono.Data.Sql.dll"/> - <Import assembly="MonoQuery.dll"/> - </Runtime> - - <Dependencies> - <Addin id="Core" version="0.16.0"/> - <Addin id="Core.Gui" version="0.16.0"/> - <Addin id="Ide" version="0.16.0"/> - </Dependencies> - - <ExtensionPoint path = "/SharpDevelop/Views/DatabasePad/ContextMenu/ConnectionsBrowserNode"> - <ExtensionNodeSet id="MonoDevelop.Components.Commands.ItemSet"/> - </ExtensionPoint> - - <ExtensionPoint path = "/SharpDevelop/Views/DatabasePad/ContextMenu/ConnectionBrowserNode"> - <ExtensionNodeSet id="MonoDevelop.Components.Commands.ItemSet"/> - </ExtensionPoint> - - <ExtensionPoint path = "/SharpDevelop/Views/DatabasePad/ContextMenu/TablesBrowserNode"> - <ExtensionNodeSet id="MonoDevelop.Components.Commands.ItemSet"/> - </ExtensionPoint> - - <ExtensionPoint path = "/SharpDevelop/Views/DatabasePad/ContextMenu/TableBrowserNode"> - <ExtensionNodeSet id="MonoDevelop.Components.Commands.ItemSet"/> - </ExtensionPoint> - - <Extension path = "/MonoDevelop/Core/Services"> - <Class id = "MonoQueryService" - class = "MonoQuery.MonoQueryService"/> - </Extension> - - <Extension path = "/MonoDevelop/Ide/Pads"> - <SolutionPad id = "MonoQuery.DatabasePad" class = "MonoQuery.DatabasePad" defaultPlacement = "Left" _label = "Database Browser" icon = "md-mono-query-view"> - <PadOption id = "ShowSystemObjects" _label = "Show System Objects" defaultValue = "False"/> - <NodeBuilder id = "ProviderCollectionNodeBuilder" class = "MonoQuery.ProviderCollectionNodeBuilder"/> - <NodeBuilder id = "DatabaseNodeBuilder" class = "MonoQuery.DatabaseNodeBuilder"/> - <NodeBuilder id = "TablesNodeBuilder" class = "MonoQuery.TablesNodeBuilder"/> - <NodeBuilder id = "ViewsNodeBuilder" class = "MonoQuery.ViewsNodeBuilder"/> - <NodeBuilder id = "ProceduresNodeBuilder" class = "MonoQuery.ProceduresNodeBuilder"/> - <NodeBuilder id = "AggregatesNodeBuilder" class = "MonoQuery.AggregatesNodeBuilder"/> - <NodeBuilder id = "GroupsNodeBuilder" class = "MonoQuery.GroupsNodeBuilder"/> - <NodeBuilder id = "LanguagesNodeBuilder" class = "MonoQuery.LanguagesNodeBuilder"/> - <NodeBuilder id = "OperatorsNodeBuilder" class = "MonoQuery.OperatorsNodeBuilder"/> - <NodeBuilder id = "RolesNodeBuilder" class = "MonoQuery.RolesNodeBuilder"/> - <NodeBuilder id = "SequencesNodeBuilder" class = "MonoQuery.SequencesNodeBuilder"/> - <NodeBuilder id = "UsersNodeBuilder" class = "MonoQuery.UsersNodeBuilder"/> - <NodeBuilder id = "UserNodeBuilder" class = "MonoQuery.UserNodeBuilder"/> - <NodeBuilder id = "TypesNodeBuilder" class = "MonoQuery.TypesNodeBuilder"/> - <NodeBuilder id = "ColumnsNodeBuilder" class = "MonoQuery.ColumnsNodeBuilder"/> - <NodeBuilder id = "RulesNodeBuilder" class = "MonoQuery.RulesNodeBuilder"/> - <NodeBuilder id = "TriggersNodeBuilder" class = "MonoQuery.TriggersNodeBuilder"/> - <NodeBuilder id = "ConstraintsNodeBuilder" class = "MonoQuery.ConstraintsNodeBuilder"/> - <NodeBuilder id = "TableNodeBuilder" class = "MonoQuery.TableNodeBuilder"/> - <NodeBuilder id = "ViewNodeBuilder" class = "MonoQuery.ViewNodeBuilder"/> - <NodeBuilder id = "ColumnNodeBuilder" class = "MonoQuery.ColumnNodeBuilder"/> - <NodeBuilder id = "ConstraintNodeBuilder" class = "MonoQuery.ConstraintNodeBuilder"/> - <NodeBuilder id = "ProcedureNodeBuilder" class = "MonoQuery.ProcedureNodeBuilder"/> - <NodeBuilder id = "ParametersNodeBuilder" class = "MonoQuery.ParametersNodeBuilder"/> - </SolutionPad> - - <Pad id = "MonoQuery.SqlDefinitionPad" class = "MonoQuery.SqlDefinitionPad" defaultPlacement = "Bottom" _label = "SQL Definition" icon = "md-mono-query-view"/> - </Extension> - - <Extension path = "/MonoDevelop/Ide/WorkbenchContexts/Edit"> - <ContextPad id = "MonoQuery.DatabasePad"/> - <ContextPad id = "MonoQuery.SqlDefinitionPad"/> - </Extension> - - <Extension path = "/MonoDevelop/Ide/Commands"> - <Category _name = "MonoQuery" id = "MonoQuery"> - <Command id = "MonoQuery.Commands.MonoQueryCommands.AddConnection" - defaultHandler = "MonoQuery.Commands.AddConnection" - _label = "Add connection" - icon = "md-mono-query-addconnection"/> - <Command id = "MonoQuery.Commands.MonoQueryCommands.RemoveConnection" - _label = "Remove Connection"/> - <Command id = "MonoQuery.Commands.MonoQueryCommands.RefreshProviderList" - _label = "Refresh Provider List" - icon = "gtk-refresh"/> - <Command id = "MonoQuery.Commands.MonoQueryCommands.RefreshConnection" - _label = "Refresh Connection" - icon = "gtk-refresh"/> - <Command id = "MonoQuery.Commands.MonoQueryCommands.DisconnectConnection" - _label = "Disconnect" - icon = "md-mono-query-disconnect"/> - <Command id = "MonoQuery.Commands.MonoQueryCommands.QueryCommand" - _label = "SQL Query Editor" - icon = "md-mono-query-sql-query-view"/> - <Command id = "MonoQuery.Commands.MonoQueryCommands.EmptyTable" - _label = "Empty table" - icon = "gtk-clear"/> - <Command id = "MonoQuery.Commands.MonoQueryCommands.DropTable" - _label = "Drop table" - icon = "gtk-remove"/> - <Command id = "MonoQuery.Commands.MonoQueryCommands.Refresh" - _label = "Refresh" - icon = "gtk-refresh"/> - </Category> - </Extension> - - <Extension path = "/SharpDevelop/Views/DatabasePad/ContextMenu/ConnectionsBrowserNode"> - <CommandItem id = "MonoQuery.Commands.MonoQueryCommands.AddConnection"/> - <SeparatorItem id = "ConnectionSeparator"/> - <CommandItem id = "MonoQuery.Commands.MonoQueryCommands.RefreshProviderList"/> - </Extension> - - <Extension path = "/SharpDevelop/Views/DatabasePad/ContextMenu/ConnectionBrowserNode"> - <CommandItem id = "MonoQuery.Commands.MonoQueryCommands.RemoveConnection"/> - <CommandItem id = "MonoQuery.Commands.MonoQueryCommands.DisconnectConnection"/> - <SeparatorItem id = "ConnectionSeparator"/> - <CommandItem id = "MonoQuery.Commands.MonoQueryCommands.RefreshConnection"/> - <SeparatorItem id = "ConnectionSeparator2"/> - <CommandItem id = "MonoQuery.Commands.MonoQueryCommands.QueryCommand"/> - </Extension> - - <Extension path = "/SharpDevelop/Views/DatabasePad/ContextMenu/TableBrowserNode"> - <CommandItem id = "MonoQuery.Commands.MonoQueryCommands.Refresh"/> - <SeparatorItem id = "RefreshSeparator"/> - <CommandItem id = "MonoQuery.Commands.MonoQueryCommands.QueryCommand"/> - <CommandItem id = "MonoQuery.Commands.MonoQueryCommands.EmptyTable"/> - <CommandItem id = "MonoQuery.Commands.MonoQueryCommands.DropTable"/> - </Extension> - - <Extension path = "/SharpDevelop/Views/DatabasePad/ContextMenu/TablesBrowserNode"> - <CommandItem id = "MonoQuery.Commands.MonoQueryCommands.Refresh"/> - <SeparatorItem id = "RefreshSeparator"/> - <CommandItem id = "MonoQuery.Commands.MonoQueryCommands.QueryCommand"/> - </Extension> - - <Extension path = "/MonoDevelop/Core/StockIcons"> - <StockIcon stockid = "md-mono-query-addconnection" resource = "MonoQuery.Addconnection" /> - <StockIcon stockid = "md-mono-query-column" resource = "MonoQuery.Column" /> - <StockIcon stockid = "md-mono-query-column-f-k" resource = "MonoQuery.ColumnFK" /> - <StockIcon stockid = "md-mono-query-column-p-k" resource = "MonoQuery.ColumnPK" /> - <StockIcon stockid = "md-mono-query-connect" resource = "MonoQuery.Connect" /> - <StockIcon stockid = "md-mono-query-database" resource = "MonoQuery.Database" /> - <StockIcon stockid = "md-mono-query-date-time" resource = "MonoQuery.DateTime" /> - <StockIcon stockid = "md-mono-query-disconnect" resource = "MonoQuery.Disconnect" /> - <StockIcon stockid = "md-mono-query-procedure" resource = "MonoQuery.Procedure" /> - <StockIcon stockid = "md-mono-query-table" resource = "MonoQuery.Table" /> - <StockIcon stockid = "md-mono-query-tables" resource = "MonoQuery.Tables" /> - <StockIcon stockid = "md-mono-query-user" resource = "MonoQuery.User" /> - <StockIcon stockid = "md-mono-query-view" resource = "MonoQuery.View" /> - <StockIcon stockid = "md-mono-query-sql-query-view" resource = "MonoQuery.SqlQueryView" /> - <StockIcon stockid = "md-mono-query-stop" resource = "MonoQuery.Stop" /> - <StockIcon stockid = "md-mono-query-run-from-cursor" resource = "MonoQuery.RunFromCursor" /> - <StockIcon stockid = "md-mono-query-param" resource = "MonoQuery.Param" /> - <StockIcon stockid = "md-mono-query-explain" resource = "MonoQuery.Explain" /> - <StockIcon stockid = "md-mono-query-execute" resource = "MonoQuery.Execute" /> - <StockIcon stockid = "md-mono-query-numeric" resource = "MonoQuery.Numeric" /> - <StockIcon stockid = "md-mono-query-connected" resource = "MonoQuery.Database.Connected" /> - <StockIcon stockid = "md-mono-query-disconnected" resource = "MonoQuery.Database.Disconnected" /> - <StockIcon stockid = "md-mono-query-string" resource = "MonoQuery.String" /> - <StockIcon stockid = "md-mono-query-providers" resource = "MonoQuery.Providers" /> - <StockIcon stockid = "md-mono-query-blob" resource = "MonoQuery.Blob" /> - </Extension> - -</Addin> diff --git a/main/Unused/MonoQuery/MonoQuery/MonoQuery.mdp b/main/Unused/MonoQuery/MonoQuery/MonoQuery.mdp deleted file mode 100644 index ee3d462cd6..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/MonoQuery.mdp +++ /dev/null @@ -1,105 +0,0 @@ -<Project name="MonoQuery" fileversion="2.0" language="C#" clr-version="Net_2_0" ctype="DotNetProject"> - <Configurations active="Debug"> - <Configuration name="Debug" ctype="DotNetProjectConfiguration"> - <Output directory="../../../build/AddIns/MonoQuery/" assembly="MonoQuery" /> - <Build debugmode="True" target="Library" /> - <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" /> - <CodeGeneration compiler="Csc" warninglevel="4" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> - </Configuration> - <Configuration name="Release" ctype="DotNetProjectConfiguration"> - <Output directory="../../../build/AddIns/MonoQuery/" assembly="MonoQuery" /> - <Build debugmode="False" target="Library" /> - <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" /> - <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> - </Configuration> - </Configurations> - <Contents> - <File name="./monoquery.glade" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.Addconnection" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.Column" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.ColumnFK" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.ColumnPK" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.Connect" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.Database" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.DateTime" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.Disconnect" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.Procedure" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.Table" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.Tables" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.User" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.View" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.Stop" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.RunFromCursor" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.Explain" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.Param" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.Numeric" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.Execute" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.Database.Connected" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.Database.Disconnected" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.String" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.Providers" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.Blob" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./icons/MonoQuery.SqlQueryView" subtype="Code" buildaction="EmbedAsResource" /> - <File name="./Commands/Commands.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/NodeBuilders/DatabaseNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/NodeBuilders/UsersNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/NodeBuilders/UserNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/NodeBuilders/LanguagesNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/NodeBuilders/TypesNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/NodeBuilders/ProviderCollectionNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/NodeBuilders/ConstraintsNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/NodeBuilders/AggregatesNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/NodeBuilders/TablesNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/NodeBuilders/ViewNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/NodeBuilders/ProceduresNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/NodeBuilders/ProcedureNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/NodeBuilders/OperatorsNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/NodeBuilders/GroupsNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/NodeBuilders/ColumnsNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/NodeBuilders/RolesNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/NodeBuilders/ConstraintNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/NodeBuilders/TriggersNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/NodeBuilders/TableNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/NodeBuilders/RulesNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/NodeBuilders/SequencesNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/NodeBuilders/ColumnNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/NodeBuilders/ViewsNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/NodeBuilders/ParametersNodeBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/SqlDefinitionPad.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/FakeNodes.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/DatabasePad.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/ConnectionDialog.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/DataGridView.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/SqlQueryView.cs" subtype="Code" buildaction="Compile" /> - <File name="./Gui/DbProviderCollection.cs" subtype="Code" buildaction="Compile" /> - <File name="./MonoQueryService.cs" subtype="Code" buildaction="Compile" /> - <File name="./AssemblyInfo.cs" subtype="Code" buildaction="Compile" /> - <File name="./MonoQuery.addin.xml" subtype="Code" buildaction="EmbedAsResource" /> - </Contents> - <References> - <ProjectReference type="Gac" localcopy="False" refto="glade-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Gac" localcopy="False" refto="gtksourceview-sharp, Version=1.0.0.2, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Project" localcopy="False" refto="Mono.Data.Sql" /> - <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Ide" /> - <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Core" /> - <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Core.Gui" /> - <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Components" /> - <ProjectReference type="Gac" localcopy="False" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> - <ProjectReference type="Gac" localcopy="False" refto="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> - <ProjectReference type="Gac" localcopy="False" refto="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> - <ProjectReference type="Gac" localcopy="True" refto="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Gac" localcopy="True" refto="atk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Project" localcopy="False" refto="Mono.Addins" /> - </References> - <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="./Makefile.am" BuildTargetName="" CleanTargetName="" SyncReferences="True" IsAutotoolsProject="True" RelativeConfigureInPath="../../../"> - <BuildFilesVar Sync="True" Name="FILES" /> - <DeployFilesVar /> - <ResourcesVar Sync="True" Name="RES" /> - <OthersVar /> - <GacRefVar Sync="True" Name="REFS" Prefix="-r:" /> - <AsmRefVar Sync="True" Name="REFS" Prefix="-r:" /> - <ProjectRefVar Sync="True" Name="REFS" Prefix="-r:" /> - </MonoDevelop.Autotools.MakefileInfo> -</Project>
\ No newline at end of file diff --git a/main/Unused/MonoQuery/MonoQuery/MonoQuery.mds b/main/Unused/MonoQuery/MonoQuery/MonoQuery.mds deleted file mode 100644 index eeaedbff13..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/MonoQuery.mds +++ /dev/null @@ -1,16 +0,0 @@ -<Combine name="MonoQuery" fileversion="2.0"> - <Configurations> - <Configuration name="Debug" ctype="CombineConfiguration"> - <Entry build="True" name="MonoQuery" /> - </Configuration> - <Configuration name="Release" ctype="CombineConfiguration"> - <Entry build="True" name="MonoQuery" /> - </Configuration> - </Configurations> - <StartMode startupentry="MonoQuery" single="True"> - <Execute type="None" entry="MonoQuery" /> - </StartMode> - <Entries> - <Entry filename="./MonoQuery.mdp" /> - </Entries> -</Combine>
\ No newline at end of file diff --git a/main/Unused/MonoQuery/MonoQuery/MonoQueryService.cs b/main/Unused/MonoQuery/MonoQuery/MonoQueryService.cs deleted file mode 100644 index 205a7aa2f0..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/MonoQueryService.cs +++ /dev/null @@ -1,114 +0,0 @@ -// -// MonoQueryService.cs -// -// Authors: -// Christian Hergert <chris@mosaix.net> -// -// Copyright (c) 2005 Christian Hergert -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.IO; -using System.Reflection; -using System.Xml.Serialization; - -using Mono.Data.Sql; - -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui.Pads; -using MonoDevelop.Core.Gui; - -namespace MonoQuery -{ - public class MonoQueryService : AbstractService - { - DbProviderCollection providers = null; - SqlDefinitionPad definitionPad = null; - - static string serializedFile = Environment.GetFolderPath ( - Environment.SpecialFolder.ApplicationData) - + System.IO.Path.DirectorySeparatorChar - + "MonoDevelop" - + System.IO.Path.DirectorySeparatorChar - + "MonoQuery-Providers.xml"; - - public MonoQueryService () : base () {} - - public DbProviderCollection Providers { - get { - if (providers == null) - providers = new DbProviderCollection (); - - return providers; - } - } - - public Type[] ProviderTypes { - get { - ArrayList types = new ArrayList (); - Assembly asm = Assembly.GetAssembly (typeof (Mono.Data.Sql.DbProviderBase)); - foreach (Type type in asm.GetTypes ()) { - if (type.IsSubclassOf (typeof (DbProviderBase))) - types.Add (type); - } - return (Type[]) types.ToArray (typeof (Type)); - } - } - - public SqlDefinitionPad SqlDefinitionPad { - get { - return definitionPad; - } - set { - definitionPad = value; - } - } - - public override void InitializeService () - { - if (File.Exists (serializedFile)) { - try { - using (FileStream fs = File.OpenRead (serializedFile)) { - XmlSerializer serializer - = new XmlSerializer (typeof (DbProviderCollection)); - providers - = (DbProviderCollection) serializer.Deserialize (fs); - } - } catch { - Runtime.LoggingService.Error ("Invalid monoquery file."); - Runtime.FileService.DeleteFile (serializedFile); - } - } - } - - public override void UnloadService () - { - if(File.Exists(serializedFile)) { - using (FileStream fs = new FileStream(serializedFile, FileMode.Create)) { - XmlSerializer serializer = new XmlSerializer (typeof (DbProviderCollection)); - serializer.Serialize (fs, providers); - } - } - } - } -} diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Addconnection b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Addconnection Binary files differdeleted file mode 100644 index 70ca5d7a99..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Addconnection +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Blob b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Blob Binary files differdeleted file mode 100644 index 679113c829..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Blob +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Column b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Column Binary files differdeleted file mode 100644 index 94ecf912c9..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Column +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.ColumnFK b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.ColumnFK Binary files differdeleted file mode 100644 index ac445f3ce8..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.ColumnFK +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.ColumnPK b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.ColumnPK Binary files differdeleted file mode 100644 index 74cb4b644c..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.ColumnPK +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Connect b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Connect Binary files differdeleted file mode 100644 index 50d68fa067..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Connect +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Database b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Database Binary files differdeleted file mode 100644 index 06307c52cb..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Database +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Database.Connected b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Database.Connected Binary files differdeleted file mode 100644 index 9c7278bf10..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Database.Connected +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Database.Disconnected b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Database.Disconnected Binary files differdeleted file mode 100644 index 85f64cfe5c..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Database.Disconnected +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.DateTime b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.DateTime Binary files differdeleted file mode 100644 index 8681377f33..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.DateTime +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Disconnect b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Disconnect Binary files differdeleted file mode 100644 index ce441fa448..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Disconnect +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Execute b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Execute Binary files differdeleted file mode 100644 index 5b49963f81..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Execute +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Explain b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Explain Binary files differdeleted file mode 100644 index b9817d4640..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Explain +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Numeric b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Numeric Binary files differdeleted file mode 100644 index 85a1781bb4..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Numeric +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Param b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Param Binary files differdeleted file mode 100644 index d2a9116263..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Param +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Procedure b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Procedure Binary files differdeleted file mode 100644 index 672b1aeea8..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Procedure +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Providers b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Providers Binary files differdeleted file mode 100644 index ece6892423..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Providers +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.RunFromCursor b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.RunFromCursor Binary files differdeleted file mode 100644 index 55ccb81929..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.RunFromCursor +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.SqlQueryView b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.SqlQueryView Binary files differdeleted file mode 100644 index 1a0e116d99..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.SqlQueryView +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Stop b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Stop Binary files differdeleted file mode 100644 index 9a85242803..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Stop +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.String b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.String Binary files differdeleted file mode 100644 index ede9704875..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.String +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Table b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Table Binary files differdeleted file mode 100644 index c7a8747254..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Table +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Tables b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Tables Binary files differdeleted file mode 100644 index 33da8cb6f8..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.Tables +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.User b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.User Binary files differdeleted file mode 100644 index 17e257bd55..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.User +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.View b/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.View Binary files differdeleted file mode 100644 index d54b2f4357..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/icons/MonoQuery.View +++ /dev/null diff --git a/main/Unused/MonoQuery/MonoQuery/monoquery.glade b/main/Unused/MonoQuery/MonoQuery/monoquery.glade deleted file mode 100644 index 4f075680af..0000000000 --- a/main/Unused/MonoQuery/MonoQuery/monoquery.glade +++ /dev/null @@ -1,591 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> - -<widget class="GtkDialog" id="newConnectionDialog"> - <property name="border_width">6</property> - <property name="width_request">450</property> - <property name="height_request">400</property> - <property name="visible">True</property> - <property name="title" translatable="yes">MonoDevelop</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property> - <property name="modal">True</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <property name="focus_on_map">True</property> - <property name="has_separator">True</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="dialog-vbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="dialog-action_area1"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - - <child> - <widget class="GtkButton" id="cancelbutton1"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-cancel</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="response_id">-6</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="okbutton1"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-ok</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="response_id">-5</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="label" translatable="yes"><span weight="bold" size="larger"><span size="larger">Create new connection</span></span></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0</property> - <property name="xpad">0</property> - <property name="ypad">4</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment1"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">5</property> - <property name="left_padding">10</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkTable" id="table1"> - <property name="border_width">5</property> - <property name="visible">True</property> - <property name="n_rows">7</property> - <property name="n_columns">2</property> - <property name="homogeneous">False</property> - <property name="row_spacing">3</property> - <property name="column_spacing">10</property> - - <child> - <widget class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="label" translatable="yes">Provider</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label3"> - <property name="visible">True</property> - <property name="label" translatable="yes">Name</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label4"> - <property name="visible">True</property> - <property name="label" translatable="yes">Server</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label5"> - <property name="visible">True</property> - <property name="label" translatable="yes">Database</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label6"> - <property name="visible">True</property> - <property name="label" translatable="yes">User ID</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label7"> - <property name="visible">True</property> - <property name="label" translatable="yes">Password</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkComboBox" id="providersCombo"> - <property name="visible">True</property> - <property name="add_tearoffs">False</property> - <property name="focus_on_click">True</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="nameEntry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="serverEntry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char">*</property> - <property name="activates_default">False</property> - <signal name="changed" handler="OnChanged" last_modification_time="Wed, 29 Jun 2005 00:24:28 GMT"/> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="databaseEntry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char">*</property> - <property name="activates_default">False</property> - <signal name="changed" handler="OnChanged" last_modification_time="Wed, 29 Jun 2005 00:24:39 GMT"/> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="useridEntry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char">*</property> - <property name="activates_default">False</property> - <signal name="changed" handler="OnChanged" last_modification_time="Wed, 29 Jun 2005 00:24:47 GMT"/> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="passwordEntry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">False</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char">*</property> - <property name="activates_default">False</property> - <signal name="changed" handler="OnChanged" last_modification_time="Wed, 29 Jun 2005 00:24:53 GMT"/> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label10"> - <property name="visible">True</property> - <property name="label" translatable="yes">Other</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="otherEntry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char">*</property> - <property name="activates_default">False</property> - <signal name="changed" handler="OnChanged" last_modification_time="Wed, 29 Jun 2005 00:25:02 GMT"/> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> - <property name="y_options"></property> - </packing> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkExpander" id="expander1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="expanded">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkAlignment" id="alignment2"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">10</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkVBox" id="vbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label9"> - <property name="visible">True</property> - <property name="label" translatable="yes">Connection String</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">3</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <property name="window_placement">GTK_CORNER_TOP_LEFT</property> - - <child> - <widget class="GtkTextView" id="connectionStringTextView"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="overwrite">False</property> - <property name="accepts_tab">True</property> - <property name="justification">GTK_JUSTIFY_LEFT</property> - <property name="wrap_mode">GTK_WRAP_NONE</property> - <property name="cursor_visible">True</property> - <property name="pixels_above_lines">0</property> - <property name="pixels_below_lines">0</property> - <property name="pixels_inside_wrap">0</property> - <property name="left_margin">0</property> - <property name="right_margin">0</property> - <property name="indent">0</property> - <property name="text" translatable="yes"></property> - </widget> - </child> - </widget> - <packing> - <property name="padding">5</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label8"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Advanced</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="type">label_item</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - -</glade-interface> diff --git a/main/Unused/MonoQuery/TODO b/main/Unused/MonoQuery/TODO deleted file mode 100644 index 8c2a1426c8..0000000000 --- a/main/Unused/MonoQuery/TODO +++ /dev/null @@ -1,71 +0,0 @@ -TODO For MonoQuery and Mono.Data.Sql - -MonoQuery -- change SQL View to work the following way: - if selected, only execute the selecte statement, otherwise, execute everything -- Make this "execute selected sql/execute everything unselected" a preference. The current way - which separates statements by semicolon can be a preference as well. However, make - the "execute selected sql/execute everything unselected an preference" as default -- create a second view in the sql view. The top pane being a text view that contains the SQL statements - and the bottom pane containing a data grid (treeview/liststore) or text view for the results -- create a database table import/export assistant - -Mono.Data.Sql -- tie to Mono.Data by using the ProviderFactory to create connections, adapters, command builders, parameters, etc... - Either Mono.Data.Sql can use Mono.Data.ProviderFactory or merge Mono.Data into Mono.Data.Sql so you can have - one config file. -- remove the references (as in /r:System.Data.OracleClient.dll) from Mono.Data.Sql and MonoQuery -- have the ability to list servers (data sources) and databases (catalogs) for a given database. - * oracle can parse a TNSNAMES.ORA file - * SQL Server can use port 1434 to discover instances at a host. Once you connect to a server, - you can get a list of databases from sysdatabases. - * MySQL has show databases - * others? -- modify Mono.Data.Sql to be on-demand meaning, you can list tables, but don't get the table columns, indexes, etc... Only - Get the table columns for a given table when requested. Same thing with create the CREATE TABLE SQL. - Loading all the database objects, such as stored procedures and their arguments takes awhile -- allow Mono.Data.Sql to build SQL for SELECT, INSERT, UPDATE, DELETE statements for a given table -- connection error handling. When a connectione exception happens, the error is silent and IsOpen is set to false. - We could add a property like ErrorMessage would return the error message from an exception. This way, the user - of the DbProvider would get the ErrorMessage if Open() returns false. Or create an absract DbProviderError class to handle - errors gracefully -- create collection classes instead of arrays for the schema types: TableSchemaCollection for TableSchema -- ProcedureSchema needs a way to indicate it is a "package" containing procedures and functions (this is to support - Oracle packages which can contain stored procedures and functions). - Maybe have two properties: bool HasSubProcedures and ProcedureSchema[] SubProcedures -- ProcedureSchema should provide a way to return the source of the stored procedure (the CREATE PROCEDURE SQL). - An Oracle Package would include two parts: CREATE PACKAGE and the CREATE PACKAGE BODY -- ParameterSchema needs a property called Direction (input, output, input/output, return). -- create an abstract class to create a test procedure so you can test/debug a procedure -- abstract support for debugging of stored procedures -- have DataTypeSchema to list available primitive types. -- List available pre-defined types available like varchar, date, blob, etc... put in an array of DataTypeSchema -- add these Properties to DataTypeSchema for the above - can be used for a database table editor or data migration: - * have a Length or not. Valid minium/maximum range - * have a Precision and Scale or not. Valid min/max range for precision and scale. In Oracle scale can be negative. - * is type a large object? blob or clob in oracle, text or image in sql server, etc... - * is binary like blob or raw or binary - * is character like char or varchar - * is multibyte character like nchar or nvarchar - * other attributes, such as, a int in sql server can be an identity column with a seed starting at 1 step 1 (think autonumber) - * has padding, such as, char (but not varchar) pad with spaces if value has length less then defined size - * can be empty (have zero length). varchar in sql server can have an empty string while a clob in oracle can be not null but empty. - * is integer like: byte, smallint, int, bigint - * is numeric like: number, numeric, decimal (i'm not sure if this should include integer types or not), but types - like decimal have precision and scale -- need to get abstract command builder from provider factory -- if a command builder is not available for a given data provider or is not set in config file for provider, - then create a class to build insert, update, and delete statements like command builder does. Use - parameterprefix in provider factory for this to determine what kind of parameter to add/use, or use xml db provider -- create a class as a db data provider but for xml (think the DataSet saved as xml and later loaded) -- create a DataMigration class to copy a table (definition and data) from one data source to another (optionally with constraints, keys, indexes, etc...) - which can be used in a GUI app to import tables from one database to another. If command builder available, use it. If not, use - a special command builder or the xml db provider - - -Future ADO.NET 2.0 Direction in Dot Net 2.0 -- if using ADO.NET 2.0 and a provider supports the ADO.NET 2.0 features, use the ADO.NET 2.0 features - for the metadata - -
\ No newline at end of file diff --git a/main/Unused/MonoQuery/tests/CreateProviderTests.cs b/main/Unused/MonoQuery/tests/CreateProviderTests.cs deleted file mode 100644 index a31534adb9..0000000000 --- a/main/Unused/MonoQuery/tests/CreateProviderTests.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// This test aims to test as much of the NpgsqlDbProvider as possbile. -// It requires a local setup of postgres with user and db chris and -// the connection should be trusted via 127.0.0.1. A script may be -// provided at some point to make these tests possible by others. -// - -using System; - -using NUnit.Framework; -using Mono.Data.Sql; - -namespace Mono.Data.Sql.Tests -{ - [TestFixture] - public class CreateProviderTests - { - public CreateProviderTests () - { - } - - [TestFixtureSetUp] - public void Initialize() - { - } - - [TestFixtureTearDown] - public void Dispose() - { - } - - [Test] - public void CreateNpgsqlProvider () - { - NpgsqlDbProvider provider = new NpgsqlDbProvider (); - Assert.IsNotNull (provider); - } - - [Test] - public void CreateMySqlProvider () - { - MySqlDbProvider provider = new MySqlDbProvider (); - Assert.IsNotNull (provider); - } - - [Test] - public void CreateSqliteProvider () - { - SqliteDbProvider provider = new SqliteDbProvider (); - Assert.IsNotNull (provider); - } - } -} diff --git a/main/Unused/MonoQuery/tests/Mono.Data.Sql.Tests.mdp b/main/Unused/MonoQuery/tests/Mono.Data.Sql.Tests.mdp deleted file mode 100644 index 4daf0b71dc..0000000000 --- a/main/Unused/MonoQuery/tests/Mono.Data.Sql.Tests.mdp +++ /dev/null @@ -1,24 +0,0 @@ -<Project name="Mono.Data.Sql.Tests" fileversion="2.0" language="C#" clr-version="Net_1_1" ctype="DotNetProject"> - <Configurations active="Debug"> - <Configuration name="Debug" ctype="DotNetProjectConfiguration"> - <Output directory="./bin/Debug" assembly="Mono.Data.Sql.Tests" /> - <Build debugmode="True" target="Library" /> - <Execution runwithwarnings="False" consolepause="True" runtime="MsNet" clr-version="Net_1_1" /> - <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> - </Configuration> - <Configuration name="Release" ctype="DotNetProjectConfiguration"> - <Output directory="./bin/Release" assembly="Mono.Data.Sql.Tests" /> - <Build debugmode="False" target="Library" /> - <Execution runwithwarnings="False" consolepause="True" runtime="MsNet" clr-version="Net_1_1" /> - <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> - </Configuration> - </Configurations> - <Contents> - <File name="./CreateProviderTests.cs" subtype="Code" buildaction="Compile" /> - <File name="./NpgsqlTablesTest.cs" subtype="Code" buildaction="Compile" /> - </Contents> - <References> - <ProjectReference type="Project" localcopy="False" refto="Mono.Data.Sql" /> - <ProjectReference type="Gac" localcopy="False" refto="nunit.framework, Version=2.2.0.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" /> - </References> -</Project>
\ No newline at end of file diff --git a/main/Unused/MonoQuery/tests/NpgsqlTablesTest.cs b/main/Unused/MonoQuery/tests/NpgsqlTablesTest.cs deleted file mode 100644 index 213e2044f9..0000000000 --- a/main/Unused/MonoQuery/tests/NpgsqlTablesTest.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -// This test should try to load tables and check their contents for npgsql. -// - -using System; - -using Mono.Data.Sql; -using NUnit.Framework; - -namespace Mono.Data.Sql.Tests -{ - [TestFixture] - public class NpgsqlTablesTest - { - NpgsqlDbProvider provider = null; - - [TestFixtureSetUp] - public void SetUp () - { - provider = new NpgsqlDbProvider (); - provider.ConnectionString = - "Server=localhost;User ID=chris;Database=chris;"; - provider.Open (); - } - - [Test] - public void GetTablesTest () - { - TableSchema[] tables = provider.GetTables (); - Assert.IsTrue (tables.Length > 0); - } - } -}
\ No newline at end of file diff --git a/main/Unused/MonoQuery/tests/pgsql.sql b/main/Unused/MonoQuery/tests/pgsql.sql deleted file mode 100644 index 2e64661778..0000000000 --- a/main/Unused/MonoQuery/tests/pgsql.sql +++ /dev/null @@ -1,15 +0,0 @@ --- --- pgsql.sql: Database for Npgsql Tests on PostgreSQL. --- --- Authors: --- Christian Hergert (christian.hergert@gmail.com) --- - -CREATE TABLE users ( - id serial NOT NULL PRIMARY KEY, - email varchar(100) NOT NULL UNIQUE, - password varchar(32) NOT NULL DEFAULT md5(''), - firstname varchar(30) NOT NULL, - lastname varchar(30), - created timestamp DEFAULT CURRENT_TIMESTAMP -);
\ No newline at end of file diff --git a/main/Unused/MonoQuery/tests/test-firebird-1.cs b/main/Unused/MonoQuery/tests/test-firebird-1.cs deleted file mode 100644 index 15ef7b2b11..0000000000 --- a/main/Unused/MonoQuery/tests/test-firebird-1.cs +++ /dev/null @@ -1,99 +0,0 @@ -// test-firebird-1.cs -// -// $ mcs test-firebird-1.cs /r:System.Data /r:FirebirdSql.Data.Firebird /r:Mono.Data.Sql -// - -using System; -using System.Data; -using FirebirdSql.Data.Firebird; -using System.Text; -using Mono.Data.Sql; - -namespace Mono.Data.Sql.Tests -{ - public class CreateProviderTest - { - static FirebirdDbProvider provider = null; - - static TableSchema[] tables = null; - static ViewSchema[] views = null; - - public static void Main(string[] args) - { - Console.WriteLine("Test Firebird Meta Data Provider..."); - - provider = new FirebirdDbProvider (); - provider.ConnectionString = @"Database=D:\PROGRA~1\Firebird\Firebird_1_5\examples\EMPLOYEE.FDB;User=SYSDBA;Password=masterkey;Dialect=3;Server=localhost"; - - Console.WriteLine("Opening database..."); - provider.Open (); - - Console.WriteLine("Do tests..."); - - ListTables (); - ListViews (); - - tables = null; - views = null; - - Console.WriteLine("Close provider..."); - - provider.Close(); - - Console.WriteLine("Test Done."); - } - - public static void ListTables () - { - Console.WriteLine("List Tables..."); - tables = provider.GetTables (); - Console.WriteLine("Tables Found: {0}", tables.Length); - - for (int i = 0; i < tables.Length; i++) { - TableSchema table = tables[i]; - Console.WriteLine(" Table{0} Owner: {1} Name: {2} ", - i, table.OwnerName, table.Name); - if (i == 0) - ListTableColumns(table); - } - } - - public static void ListTableColumns (TableSchema table) - { - ColumnSchema[] columns = table.Columns; - - for (int c = 0; c < columns.Length; c++) { - ColumnSchema column = columns[c]; - Console.WriteLine("Column{0}: ", c); - Console.WriteLine(" Name: {0}", column.Name); - Console.WriteLine(" DataTypeName: {0}", column.DataTypeName); - Console.WriteLine(" Length: {0}", column.Length); - //Console.WriteLine(" Precision: {0}", column.Precision); - //Console.WriteLine(" Scale: {0}", column.Scale); - //Console.WriteLine(" NotNull: {0}", column.NotNull); - Console.WriteLine(""); - } - } - - public static void ListViews () - { - Console.WriteLine("List Views..."); - - views = provider.GetViews (); - for (int v = 0; v < views.Length; v++) { - ViewSchema view = views[v]; - Console.WriteLine("View{0}: " ,v); - Console.WriteLine(" Name: {0}", view.Name); - Console.WriteLine(" Owner: {0}", view.OwnerName); - if (v == 0) - ListView (view); - } - } - - public static void ListView (ViewSchema view) - { - Console.WriteLine("View Definition:\n" + view.Definition); - } - } -} - diff --git a/main/Unused/MonoQuery/tests/test-oracle-1.cs b/main/Unused/MonoQuery/tests/test-oracle-1.cs deleted file mode 100644 index 079bf0719a..0000000000 --- a/main/Unused/MonoQuery/tests/test-oracle-1.cs +++ /dev/null @@ -1,93 +0,0 @@ -// test-oracle-1.cs -// -// $ mcs test-oracle-1.cs /r:System.Data /r:System.Data.OracleClient /r:Mono.Data.Sql -// - -using System; -using System.Data; -using System.Data.OracleClient; -using System.Text; -using Mono.Data.Sql; - -namespace Mono.Data.Sql.Tests -{ - public class CreateProviderTest - { - static OracleDbProvider provider = null; - - static TableSchema[] tables = null; - static ViewSchema[] views = null; - - public static void Main(string[] args) - { - Console.WriteLine("Test Oracle Meta Data Provider..."); - - provider = new OracleDbProvider (); - provider.ConnectionString = "Data Source=palis;user id=scott;password=tiger"; - provider.Open (); - - ListTables (); - ListViews (); - - tables = null; - views = null; - - provider.Close(); - - Console.WriteLine("Test Done."); - } - - public static void ListTables () - { - Console.WriteLine("List Tables..."); - tables = provider.GetTables (); - Console.WriteLine("Tables Found: {0}", tables.Length); - - for (int i = 0; i < tables.Length; i++) { - TableSchema table = tables[i]; - Console.WriteLine(" Table{0} Owner: {1} Name: {2} TableSpace: {3}", - i, table.OwnerName, table.Name, table.TableSpaceName); - if (i == 0) - ListTableColumns(table); - } - } - - public static void ListTableColumns (TableSchema table) - { - ColumnSchema[] columns = table.Columns; - - for (int c = 0; c < columns.Length; c++) { - ColumnSchema column = columns[c]; - Console.WriteLine("Column{0}: ", c); - Console.WriteLine(" Name: {0}", column.Name); - Console.WriteLine(" DataTypeName: {0}", column.DataTypeName); - Console.WriteLine(" Length: {0}", column.Length); - Console.WriteLine(" Precision: {0}", column.Precision); - Console.WriteLine(" Scale: {0}", column.Scale); - Console.WriteLine(" NotNull: {0}", column.NotNull); - Console.WriteLine(""); - } - } - - public static void ListViews () - { - Console.WriteLine("List Views..."); - - views = provider.GetViews (); - for (int v = 0; v < views.Length; v++) { - ViewSchema view = views[v]; - Console.WriteLine("View{0}: " ,v); - Console.WriteLine(" Name: {0}", view.Name); - Console.WriteLine(" Owner: {0}", view.OwnerName); - if (v == 0) - ListView (view); - } - } - - public static void ListView (ViewSchema view) - { - Console.WriteLine("View Definition:\n" + view.Definition); - } - } -} - diff --git a/main/Unused/MonoQuery/tests/test-sybase-1.cs b/main/Unused/MonoQuery/tests/test-sybase-1.cs deleted file mode 100644 index a31201a759..0000000000 --- a/main/Unused/MonoQuery/tests/test-sybase-1.cs +++ /dev/null @@ -1,99 +0,0 @@ -// test-sybase-1.cs -// -// $ mcs test-sybase-1.cs /r:System.Data /r:Mono.Data.SybaseClient /r:Mono.Data.Sql -// - -using System; -using System.Data; -using Mono.Data.SybaseClient; -using System.Text; -using Mono.Data.Sql; - -namespace Mono.Data.Sql.Tests -{ - public class CreateProviderTest - { - static SybaseDbProvider provider = null; - - static TableSchema[] tables = null; - static ViewSchema[] views = null; - - public static void Main(string[] args) - { - Console.WriteLine("Test Sybase Meta Data Provider..."); - - provider = new SybaseDbProvider (); - provider.ConnectionString = "Server=DANPC,5000;Database=testdb;User ID=sa;Password=;"; - - Console.WriteLine("Opening database..."); - provider.Open (); - - Console.WriteLine("Do tests..."); - - ListTables (); - ListViews (); - - tables = null; - views = null; - - Console.WriteLine("Close provider..."); - - provider.Close(); - - Console.WriteLine("Test Done."); - } - - public static void ListTables () - { - Console.WriteLine("List Tables..."); - tables = provider.GetTables (); - Console.WriteLine("Tables Found: {0}", tables.Length); - - for (int i = 0; i < tables.Length; i++) { - TableSchema table = tables[i]; - Console.WriteLine(" Table{0} Owner: {1} Name: {2} ", - i, table.OwnerName, table.Name); - if (i == 0) - ListTableColumns(table); - } - } - - public static void ListTableColumns (TableSchema table) - { - ColumnSchema[] columns = table.Columns; - - for (int c = 0; c < columns.Length; c++) { - ColumnSchema column = columns[c]; - Console.WriteLine("Column{0}: ", c); - Console.WriteLine(" Name: {0}", column.Name); - Console.WriteLine(" DataTypeName: {0}", column.DataTypeName); - Console.WriteLine(" Length: {0}", column.Length); - //Console.WriteLine(" Precision: {0}", column.Precision); - //Console.WriteLine(" Scale: {0}", column.Scale); - //Console.WriteLine(" NotNull: {0}", column.NotNull); - Console.WriteLine(""); - } - } - - public static void ListViews () - { - Console.WriteLine("List Views..."); - - views = provider.GetViews (); - for (int v = 0; v < views.Length; v++) { - ViewSchema view = views[v]; - Console.WriteLine("View{0}: " ,v); - Console.WriteLine(" Name: {0}", view.Name); - Console.WriteLine(" Owner: {0}", view.OwnerName); - if (v == 0) - ListView (view); - } - } - - public static void ListView (ViewSchema view) - { - Console.WriteLine("View Definition:\n" + view.Definition); - } - } -} - diff --git a/main/Unused/TextEditor/Actions.cs b/main/Unused/TextEditor/Actions.cs deleted file mode 100644 index 2e5cb80151..0000000000 --- a/main/Unused/TextEditor/Actions.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Actions.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System.Drawing; -using System; - -using MonoDevelop.Core.Properties; -using MonoDevelop.DefaultEditor.Gui.Editor; -using MonoDevelop.TextEditor.Document; -using MonoDevelop.TextEditor.Actions; -using MonoDevelop.TextEditor; -using MonoDevelop.TextEditor.Gui.CompletionWindow; - -namespace MonoDevelop.DefaultEditor.Actions -{ - public class TemplateCompletion : AbstractEditAction - { - public override void Execute(TextArea services) - { - CompletionWindow completionWindow = new CompletionWindow(services.MotherTextEditorControl, "a.cs", new TemplateCompletionDataProvider()); - completionWindow.ShowCompletionWindow('\0'); - } - } -} diff --git a/main/Unused/TextEditor/AssemblyInfo.cs b/main/Unused/TextEditor/AssemblyInfo.cs deleted file mode 100644 index 6c9618e253..0000000000 --- a/main/Unused/TextEditor/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -// AssemblyInfo.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System.Reflection; -using System.Runtime.CompilerServices; - -[assembly: AssemblyTitle("MonoDevelopDefaultEditor")] -[assembly: AssemblyDescription("Default texteditor add-in of MonoDevelop")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("MonoDevelop")] -[assembly: AssemblyCopyright("Mike Krueger 2000")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -[assembly: AssemblyVersion("0.2.0.0")] - -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyKeyFile("")] diff --git a/main/Unused/TextEditor/Conditions/TextContentCondition.cs b/main/Unused/TextEditor/Conditions/TextContentCondition.cs deleted file mode 100644 index 51d6f183ca..0000000000 --- a/main/Unused/TextEditor/Conditions/TextContentCondition.cs +++ /dev/null @@ -1,65 +0,0 @@ -// TextContentCondition.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Xml; - -using MonoDevelop.Core.AddIns; - -using MonoDevelop.Core.Gui; -using MonoDevelop.DefaultEditor.Gui.Editor; -using MonoDevelop.TextEditor; - -namespace MonoDevelop.DefaultEditor.Conditions -{ - [ConditionAttribute()] - public class TextContentCondition : AbstractCondition - { - [XmlMemberAttribute("textcontent", IsRequired = true)] - string textcontent; - - public string TextContent { - get { - return textcontent; - } - set { - textcontent = value; - } - } - - public override bool IsValid(object owner) - { - if (owner is TextEditorControl) { - TextEditorControl ctrl = (TextEditorControl)owner; - if (ctrl.Document != null && ctrl.Document.HighlightingStrategy != null) { - return textcontent == ctrl.Document.HighlightingStrategy.Name; - } - } - - if (owner is IViewContent) { - IViewContent ctrl = (IViewContent) owner; - if (textcontent == "C#" && ctrl.ContentName.EndsWith (".cs")) - return true; - } - - return false; - } - } -} diff --git a/main/Unused/TextEditor/Gui/Dialogs/ExportProjectToHtmlDialog.cs b/main/Unused/TextEditor/Gui/Dialogs/ExportProjectToHtmlDialog.cs deleted file mode 100644 index 64b12144af..0000000000 --- a/main/Unused/TextEditor/Gui/Dialogs/ExportProjectToHtmlDialog.cs +++ /dev/null @@ -1,482 +0,0 @@ -// ExportProjectToHtmlDialog.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Collections; -using System.Collections.Specialized; -using System.ComponentModel; -using System.Threading; -using System.IO; -using MonoDevelop.TextEditor.Document; -using MonoDevelop.Core.Properties; - -using MonoDevelop.Core; -using MonoDevelop.TextEditor.Util; - -using MonoDevelop.Projects; - -namespace MonoDevelop.Core.Gui.Dialogs -{ - public class ExportProjectToHtmlDialog //: Form - {/* - TextBox pathTextBox = new TextBox(); - Label pathLabel = new Label(); - Button okButton = new Button(); - Button cancelButton = new Button(); - Button browseButton = new Button(); - - 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)); - IProject project; - int filesExported = 0; - - int FilesExported { - get { - return filesExported; - } - set { - progressBar.Value = filesExported = value; - } - } - - void StartExporting() - { - Controls.Clear(); - - progressBar.Location = new Point(8, 8); - progressBar.Size = new Size(Width - 16, 16); - progressBar.Minimum = 0; - progressBar.Maximum = project.ProjectFiles.Count; - - Controls.Add(progressBar); - - cancelButton = new Button(); - cancelButton.Location = new Point(188 + 80, 36); - cancelButton.Size = new Size(74, 23); - cancelButton.Text = resourceService.GetString("Global.CancelButtonText"); - cancelButton.Click += new EventHandler(StopThread); - Controls.Add(cancelButton); - } - public ExportProjectToHtmlDialog(IProject project) - { - PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService)); - - this.project = project; - - pathLabel.Location = new Point(8, 8); - pathLabel.Size = new Size(60,16); - pathLabel.Text = resourceService.GetString("Dialog.ExportProjectToHtml.FolderLabel"); - Controls.Add(pathLabel); - - pathTextBox.Location = new Point(70, 8); - pathTextBox.Size = new Size(230,16); - Controls.Add(pathTextBox); - - browseButton.Location = new Point(310, 8); - browseButton.Size = new Size(32,23); - browseButton.Text = "..."; - browseButton.Click += new EventHandler(BrowseDirectories); - browseButton.FlatStyle = FlatStyle.System; - Controls.Add(browseButton); - - okButton.Location = new Point(188, 36); - okButton.Size = new Size(74, 23); - okButton.Text = resourceService.GetString("Global.OKButtonText"); - okButton.Click += new EventHandler(ExportProject); - okButton.FlatStyle = FlatStyle.System; - Controls.Add(okButton); - - cancelButton.Location = new Point(188 + 80, 36); - cancelButton.Size = new Size(74, 23); - cancelButton.Text = resourceService.GetString("Global.CancelButtonText"); - cancelButton.DialogResult = DialogResult.Cancel; - cancelButton.FlatStyle = FlatStyle.System; - Controls.Add(cancelButton); - - Icon = null; - FormBorderStyle = FormBorderStyle.FixedDialog; - Size = new Size(350, 88 + 6); - StartPosition = FormStartPosition.CenterParent; - ShowInTaskbar = false; - MinimizeBox = MaximizeBox = false; - - Text = resourceService.GetString("Dialog.ExportProjectToHtml.DialogName"); - } - - void BrowseDirectories(object sender, EventArgs e) - { - FolderDialog fd = new FolderDialog(); - - if(fd.DisplayDialog(resourceService.GetString("Dialog.ExportProjectToHtml.SelectTargetDirInfo")) == DialogResult.OK) { - pathTextBox.Text = fd.Path; - } - } - - Hashtable projectTable = new Hashtable(); - Hashtable bitmapTable = new Hashtable(); - int bitmapIconIndex = 0; - int indexFileIndex = 0; - - public Hashtable GetPath(string filename, Hashtable table, bool create) - { - string directory = Path.GetDirectoryName(filename); - string[] treepath = directory.Split(new char[] { Path.DirectorySeparatorChar }); - Hashtable curTable = table; - - foreach (string path in treepath) { - if (path.Length == 0 || path[0] == '.') - continue; - - object node = curTable[path]; - - if (node == null) { - if (create) { - Hashtable newTable = new Hashtable(); - curTable[path] = newTable; - curTable = newTable; - continue; - } else { - return null; - } - } - curTable = (Hashtable)node; - } - return curTable; - } - int GetImageIndex(string filename) - { - if (filename != null) { - return iconService.GetImageIndexForFile(filename); - } - return -1; - } - - class Descriptor - { - public string title; - public string url; - public Descriptor(string title, string url) - { - this.title = title; - this.url = url; - } - } - - StreamWriter curFileStream = null; - 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(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(); - - 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.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"); - 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"); - bool spanOpen = false; - Color curColor = Color.Black; - bool oldItalic = false; - bool oldBold = false; - bool firstSpan = true; - foreach (TextWord word in line.Words) { - switch (word.Type) { - case TextWordType.Space: - curFileStream.Write(" "); - break; - - case TextWordType.Tab: - for (int k = 0; k < document.TextEditorProperties.TabIndent; ++k) { - curFileStream.Write(" "); - } - break; - - case TextWordType.Word: - Color c = word.Color; - string colorstr = c.R + ", " + c.G + ", " + c.B; - - 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 class=\"" + Spans[colorstr].ToString() + "\">" ); - spanOpen = true; - firstSpan = false; - } - curFileStream.Write(HtmlLize(word.Word)); - - if (newColor) { - curColor = c; - oldItalic = word.Font.Italic; - oldBold = word.Font.Bold; - } - break; - } - } - if (spanOpen) { - curFileStream.Write("</span>" ); - } - curFileStream.Write("</TD>\r\n"); - curFileStream.Write("</TR>\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(); - return targetFile; - } - - string HtmlLize(string str) - { - return str.Replace("&", "&").Replace("<", "<").Replace(">", ">"); - } - - void WriteIndexTable(string fileName, string name, ArrayList nameList, Hashtable table) - { - 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("<body>\r\n"); - curIndexStream.Write("<p>Location : "); - foreach (Descriptor d in nameList) { - curIndexStream.Write("<a href=\""+ d.url + "\">" + d.title + "</a>/"); - } - curIndexStream.Write(name); - curIndexStream.Write("</p>\r\n"); - - nameList.Add(new Descriptor(name, 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"); - - bool coloring = false; - foreach (DictionaryEntry entry in table) { - if (entry.Value is Hashtable) { - string filename = "index" + ++indexFileIndex + ".html"; - WriteIndexTable(Path.GetDirectoryName(fileName) + 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"); - } else if (entry.Value is ProjectFile) { - ProjectFile fInfo = (ProjectFile)entry.Value; - DateTime time = Directory.GetLastAccessTime(fInfo.Name); - FileStream reader = File.OpenRead(fInfo.Name); - long size = reader.Length; - reader.Close(); - - int idx = GetImageIndex(fInfo.Name); - if (bitmapTable[idx] == null) { - string filename = "fileicon" + ++bitmapIconIndex + ".png"; - - Bitmap bmp = (Bitmap)iconService.ImageList.Images[idx]; - bmp.Save(Path.GetDirectoryName(fileName) + Path.DirectorySeparatorChar + filename); - bitmapTable[idx] = filename; - } - string outFile = ExportFile(fInfo.Name, 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 + "\">" + 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("<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(); - } - } - - delegate void MyD(); - - void QuitDialog() - { - DialogResult = DialogResult.OK; - } - - 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)); - } - - void StopThread(object sender, EventArgs e) - { - lock (this) { - exportFilesThread.Abort(); - curFileStream.Close(); - while (curIndexStreamStack.Count > 0) { - ((StreamWriter)curIndexStreamStack.Pop()).Close(); - } - QuitDialog(); - } - } - - 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"); - - foreach (DictionaryEntry entry in Spans) { - 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"); - if (italic) { - color = color.Substring(1); - } - - 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"); - } else - if (italic) { - sw.Write(" font-weight: italic;\r\n"); - } else { - sw.Write(" font-weight: normal;\r\n"); - } - - sw.Write("}\r\n"); - } - sw.Close(); - } - - } - - void ExportProject(object sender, EventArgs e) - { - if (!Directory.Exists(pathTextBox.Text)) { - MessageBox.Show("Directory doesn't exists", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - return; - } - - foreach (ProjectFile fInfo in project.ProjectFiles) { - if (fInfo.Subtype != Subtype.Directory) { - if (fInfo.BuildAction == BuildAction.Compile || - fInfo.BuildAction == BuildAction.Nothing) { - string relativefile = fileUtilityService.AbsoluteToRelativePath(project.BaseDirectory, fInfo.Name); - Hashtable table = GetPath(relativefile, projectTable, true); - table[Path.GetFileName(fInfo.Name)] = fInfo; - } - } - } - - StartExporting(); - exportFilesThread = new Thread(new ThreadStart(ExportFilesThread)); - exportFilesThread.IsBackground = true; - exportFilesThread.Start(); - }*/ - } -} diff --git a/main/Unused/TextEditor/Gui/Dialogs/ReplaceDialog.cs b/main/Unused/TextEditor/Gui/Dialogs/ReplaceDialog.cs deleted file mode 100644 index b90b5a213c..0000000000 --- a/main/Unused/TextEditor/Gui/Dialogs/ReplaceDialog.cs +++ /dev/null @@ -1,462 +0,0 @@ -// ReplaceDialog.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.IO; -using System.Drawing; -using System.ComponentModel; -using System.Collections.Specialized; - -using MonoDevelop.Core.Gui; -using MonoDevelop.DefaultEditor.Gui.Editor; -using MonoDevelop.TextEditor.Document; -using MonoDevelop.Core.Properties; - -using MonoDevelop.Core; -using MonoDevelop.Core; -//using MonoDevelop.XmlForms; -//using MonoDevelop.Core.Gui.XmlForms; -using MonoDevelop.TextEditor; -using MonoDevelop.EditorBindings.Search; - -using Gtk; -using Glade; - -namespace MonoDevelop.Core.Gui.Dialogs -{ - public class ReplaceDialog - { - private const int HISTORY_LIMIT = 20; - private const char HISTORY_SEPARATOR_CHAR = (char) 10; - // regular members - public bool replaceMode; - StringCollection findHistory = new StringCollection(); - StringCollection replaceHistory = new StringCollection(); - - // services - ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService)); - static PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService)); - static FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService)); - StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService (typeof (StringParserService)); - - // gtk widgets - [Glade.Widget] Gtk.Combo searchPatternComboBox; - [Glade.Widget] Gtk.Combo replacePatternComboBox; - [Glade.Widget] Gtk.Button findHelpButton; - [Glade.Widget] Gtk.Button findButton; - [Glade.Widget] Gtk.Button markAllButton; - [Glade.Widget] Gtk.Button closeButton; - [Glade.Widget] Gtk.Button replaceButton; - [Glade.Widget] Gtk.Button replaceAllButton; - [Glade.Widget] Gtk.Button replaceHelpButton; - [Glade.Widget] Gtk.CheckButton ignoreCaseCheckBox; - [Glade.Widget] Gtk.CheckButton searchWholeWordOnlyCheckBox; - [Glade.Widget] Gtk.CheckButton useSpecialSearchStrategyCheckBox; - [Glade.Widget] Gtk.OptionMenu specialSearchStrategyComboBox; - [Glade.Widget] Gtk.OptionMenu searchLocationComboBox; - [Glade.Widget] Gtk.Label label1; - [Glade.Widget] Gtk.Label label2; - [Glade.Widget] Gtk.Label searchLocationLabel; - [Glade.Widget] Gtk.Dialog FindDialogWidget; - [Glade.Widget] Gtk.Dialog ReplaceDialogWidget; - Gtk.Dialog ReplaceDialogPointer; - - void InitDialog () - { - label1.Text = stringParserService.Parse ("${res:Dialog.NewProject.SearchReplace.FindWhat}"); - searchLocationLabel.Text = stringParserService.Parse ("${res:Dialog.NewProject.SearchReplace.SearchIn}"); - //findButton.Label = stringParserService.Parse ("${res:Dialog.NewProject.SearchReplace.FindNextButton}"); - //closeButton.Label = stringParserService.Parse ("${res:Global.CloseButtonText}"); - findButton.UseUnderline = true; - closeButton.UseUnderline = true; - ignoreCaseCheckBox.Label = stringParserService.Parse ("${res:Dialog.NewProject.SearchReplace.CaseSensitive}"); - searchWholeWordOnlyCheckBox.Label = stringParserService.Parse ("${res:Dialog.NewProject.SearchReplace.WholeWord}"); - useSpecialSearchStrategyCheckBox.Label = stringParserService.Parse ("${res:Dialog.NewProject.SearchReplace.UseMethodLabel}"); - - - //set up the size groups - SizeGroup labels = new SizeGroup(SizeGroupMode.Horizontal); - SizeGroup combos = new SizeGroup(SizeGroupMode.Horizontal); - SizeGroup options = new SizeGroup(SizeGroupMode.Horizontal); - SizeGroup helpButtons = new SizeGroup(SizeGroupMode.Horizontal); - SizeGroup checkButtons = new SizeGroup(SizeGroupMode.Horizontal); - labels.AddWidget(label1); - combos.AddWidget(searchPatternComboBox); - helpButtons.AddWidget(findHelpButton); - checkButtons.AddWidget(ignoreCaseCheckBox); - checkButtons.AddWidget(searchWholeWordOnlyCheckBox); - checkButtons.AddWidget(useSpecialSearchStrategyCheckBox); - checkButtons.AddWidget(searchLocationLabel); - options.AddWidget(specialSearchStrategyComboBox); - options.AddWidget(searchLocationComboBox); - - // set button sensitivity - findHelpButton.Sensitive = false; - - // set replace dialog properties - if(replaceMode) - { - ReplaceDialogPointer = this.ReplaceDialogWidget; - // set the label properties - label2.Text = stringParserService.Parse ("${res:Dialog.NewProject.SearchReplace.ReplaceWith}"); - //replaceButton.Label = stringParserService.Parse ("${res:Dialog.NewProject.SearchReplace.ReplaceButton}"); - replaceAllButton.Label = stringParserService.Parse ("${res:Dialog.NewProject.SearchReplace.ReplaceAllButton}"); - replaceButton.UseUnderline = true; - replaceAllButton.UseUnderline = true; - - // set te size groups to include the replace dialog - labels.AddWidget(label2); - combos.AddWidget(replacePatternComboBox); - helpButtons.AddWidget(replaceHelpButton); - - replaceHelpButton.Sensitive = false; - } - else - { - ReplaceDialogPointer = this.FindDialogWidget; - markAllButton.UseUnderline = true; - markAllButton.Label = stringParserService.Parse ("${res:Dialog.NewProject.SearchReplace.MarkAllButton}"); - } - } - - public ReplaceDialog(bool replaceMode) - { - // some members needed to initialise this dialog based on replace mode - this.replaceMode = replaceMode; - string dialogName = (replaceMode) ? "ReplaceDialogWidget" : "FindDialogWidget"; - - // we must do it from *here* otherwise, we get this assembly, not the caller - Glade.XML glade = new XML (null, "texteditoraddin.glade", dialogName, null); - glade.Autoconnect (this); - InitDialog (); - /*if (replaceMode) { - //this.SetupFromXml(Path.Combine(propertyService.DataDirectory, @"resources\dialogs\ReplaceDialog.xfrm")); - //ControlDictionary["replaceHelpButton"].Enabled = false; - InitDialogForReplace (); - } else { - InitDialogForFind (); - //this.SetupFromXml(Path.Combine(propertyService.DataDirectory, @"resources\dialogs\FindDialog.xfrm")); - }*/ - - //AcceptButton = (Button)ControlDictionary["findButton"]; - //CancelButton = (Button)ControlDictionary["closeButton"]; - - LoadHistoryValues(); - - ignoreCaseCheckBox.Active = !SearchReplaceManager.SearchOptions.IgnoreCase; - searchWholeWordOnlyCheckBox.Active = SearchReplaceManager.SearchOptions.SearchWholeWordOnly; - - useSpecialSearchStrategyCheckBox.Active = SearchReplaceManager.SearchOptions.SearchStrategyType != SearchStrategyType.Normal; - useSpecialSearchStrategyCheckBox.Toggled += new EventHandler(SpecialSearchStrategyCheckBoxChangedEvent); - - Gtk.MenuItem tmpItem = new Gtk.MenuItem ("Wildcards"); - Gtk.Menu stratMenu = new Gtk.Menu (); - stratMenu.Append (tmpItem); - tmpItem = new Gtk.MenuItem (resourceService.GetString("Dialog.NewProject.SearchReplace.SearchStrategy.RegexSearch")); - stratMenu.Append (tmpItem); - specialSearchStrategyComboBox.Menu = stratMenu; - - uint index = 0; - switch (SearchReplaceManager.SearchOptions.SearchStrategyType) { - case SearchStrategyType.Normal: - case SearchStrategyType.Wildcard: - break; - case SearchStrategyType.RegEx: - index = 1; - break; - } - specialSearchStrategyComboBox.SetHistory (index); - - Gtk.Menu locMenu = new Gtk.Menu (); - tmpItem = new Gtk.MenuItem (resourceService.GetString("Global.Location.currentfile")); - locMenu.Append (tmpItem); - tmpItem = new Gtk.MenuItem (resourceService.GetString("Global.Location.allopenfiles")); - locMenu.Append (tmpItem); - tmpItem = new Gtk.MenuItem (resourceService.GetString("Global.Location.wholeproject")); - locMenu.Append (tmpItem); - - searchLocationComboBox.Menu = locMenu; - - index = 0; - switch (SearchReplaceManager.SearchOptions.DocumentIteratorType) { - case DocumentIteratorType.AllOpenFiles: - index = 1; - break; - case DocumentIteratorType.WholeCombine: - SearchReplaceManager.SearchOptions.DocumentIteratorType = DocumentIteratorType.CurrentDocument; - break; - } - searchLocationComboBox.SetHistory (index); - - searchPatternComboBox.Entry.Text = SearchReplaceManager.SearchOptions.SearchPattern; - - // insert event handlers - findButton.Clicked += new EventHandler(FindNextEvent); - closeButton.Clicked += new EventHandler(CloseDialogEvent); - ReplaceDialogPointer.Close += new EventHandler(CloseDialogEvent); - ReplaceDialogPointer.DeleteEvent += new GtkSharp.DeleteEventHandler (OnDeleted); - - if (replaceMode) { - ReplaceDialogPointer.Title = resourceService.GetString("Dialog.NewProject.SearchReplace.ReplaceDialogName"); - replaceButton.Clicked += new EventHandler(ReplaceEvent); - replaceAllButton.Clicked += new EventHandler(ReplaceAllEvent); - replacePatternComboBox.Entry.Text = SearchReplaceManager.SearchOptions.ReplacePattern; - } else { - ReplaceDialogPointer.Title = resourceService.GetString("Dialog.NewProject.SearchReplace.FindDialogName"); - markAllButton.Clicked += new EventHandler(MarkAllEvent); - } - - //ControlDictionary["replacePatternComboBox"].Visible = false; - //ControlDictionary["replaceAllButton"].Visible = false; - //ControlDictionary["replacePatternLabel"].Visible = false; - //ControlDictionary["replacePatternButton"].Visible = false; - //ControlDictionary["replaceButton"].Text = resourceService.GetString("Dialog.NewProject.SearchReplace.ToggleReplaceModeButton"); - //ClientSize = new Size(ClientSize.Width, ClientSize.Height - 32); - - SpecialSearchStrategyCheckBoxChangedEvent(null, null); - SearchReplaceManager.ReplaceDialog = this; - } - - protected void OnClosed() - { - SaveHistoryValues(); - - } - - void OnDeleted (object o, GtkSharp.DeleteEventArgs args) - { - // perform the standard closing windows event - OnClosed(); - SearchReplaceManager.ReplaceDialog = null; - } - - public void SetSearchPattern(string pattern) - { - searchPatternComboBox.Entry.Text = pattern; - } - - void SetupSearchReplaceManager() - { - SearchReplaceManager.SearchOptions.SearchPattern = searchPatternComboBox.Entry.Text; - if (replaceMode) { - SearchReplaceManager.SearchOptions.ReplacePattern = replacePatternComboBox.Entry.Text; - } - - SearchReplaceManager.SearchOptions.IgnoreCase = !ignoreCaseCheckBox.Active; - SearchReplaceManager.SearchOptions.SearchWholeWordOnly = searchWholeWordOnlyCheckBox.Active; - - if (useSpecialSearchStrategyCheckBox.Active) { - switch (specialSearchStrategyComboBox.History) { - case 0: - SearchReplaceManager.SearchOptions.SearchStrategyType = SearchStrategyType.Wildcard; - break; - case 1: - SearchReplaceManager.SearchOptions.SearchStrategyType = SearchStrategyType.RegEx; - break; - } - } else { - SearchReplaceManager.SearchOptions.SearchStrategyType = SearchStrategyType.Normal; - } - - switch (searchLocationComboBox.History) { - case 0: - SearchReplaceManager.SearchOptions.DocumentIteratorType = DocumentIteratorType.CurrentDocument; - break; - case 1: - SearchReplaceManager.SearchOptions.DocumentIteratorType = DocumentIteratorType.AllOpenFiles; - break; - case 2: - SearchReplaceManager.SearchOptions.DocumentIteratorType = DocumentIteratorType.WholeCombine; - break; - } - } - - void FindNextEvent(object sender, EventArgs e) - { - if (searchPatternComboBox.Entry.Text.Length == 0) { - return; - } - - try { - //Cursor = Cursors.WaitCursor; - SetupSearchReplaceManager(); - SearchReplaceManager.FindNext(); - //this.Focus(); - } - finally { - //Cursor = Cursors.Default; - } - - AddSearchHistoryItem(findHistory, searchPatternComboBox.Entry.Text); - } - - void ReplaceEvent(object sender, EventArgs e) - { - if (searchPatternComboBox.Entry.Text.Length == 0) { - return; - } - - try { - //Cursor = Cursors.WaitCursor; - - SetupSearchReplaceManager(); - SearchReplaceManager.Replace(); - } - finally { - //Cursor = Cursors.Default; - } - - AddSearchHistoryItem(replaceHistory, replacePatternComboBox.Entry.Text); - } - - void ReplaceAllEvent(object sender, EventArgs e) - { - if (searchPatternComboBox.Entry.Text.Length == 0) { - return; - } - - try { - //Cursor = Cursors.WaitCursor; - - SetupSearchReplaceManager(); - SearchReplaceManager.ReplaceAll(); - } finally { - //Cursor = Cursors.Default; - } - - AddSearchHistoryItem(replaceHistory, replacePatternComboBox.Entry.Text); - } - - void MarkAllEvent(object sender, EventArgs e) - { - if (searchPatternComboBox.Entry.Text.Length == 0) { - return; - } - - try { - //Cursor = Cursors.WaitCursor; - - SetupSearchReplaceManager(); - SearchReplaceManager.MarkAll(); - } finally { - //Cursor = Cursors.Default; - } - - AddSearchHistoryItem(findHistory, searchPatternComboBox.Entry.Text); - } - - void CloseDialogEvent(object sender, EventArgs e) - { - ReplaceDialogPointer.Hide(); - OnClosed (); - } - - void SpecialSearchStrategyCheckBoxChangedEvent(object sender, EventArgs e) - { - if (useSpecialSearchStrategyCheckBox != null) { - specialSearchStrategyComboBox.Sensitive = useSpecialSearchStrategyCheckBox.Active; - } - } - - // generic method to add a string to a history item - private void AddSearchHistoryItem(StringCollection history, string toAdd) - { - // add the item to the find history - if (history.Contains(toAdd)) { - // remove it so it gets added at the top - history.Remove(toAdd); - } - // make sure there is only 20 - if (history.Count == HISTORY_LIMIT) { - history.RemoveAt(HISTORY_LIMIT - 1); - } - history.Insert(0, toAdd); - - // update the drop down for the combobox - string[] stringArray = new string[history.Count]; - history.CopyTo(stringArray, 0); - if (history == findHistory) { - searchPatternComboBox.SetPopdownStrings(stringArray); - } else if( history == replaceHistory) { - replacePatternComboBox.SetPopdownStrings(stringArray); - } - } - - // loads the history arrays from the property service - // NOTE: this dialog uses a newline character to separate search history strings in the properties file - private void LoadHistoryValues() - { - object stringArray; - // set the history in properties - stringArray = propertyService.GetProperty("MonoDevelop.FindReplaceDialogs.FindHistory"); - - if(stringArray != null) { - findHistory.AddRange(stringArray.ToString().Split(HISTORY_SEPARATOR_CHAR)); - searchPatternComboBox.SetPopdownStrings(stringArray.ToString().Split(HISTORY_SEPARATOR_CHAR)); - } - - // now do the replace history - if(replaceMode) { - stringArray = propertyService.GetProperty("MonoDevelop.FindReplaceDialogs.ReplaceHistory"); - if(stringArray != null) { - replaceHistory.AddRange(stringArray.ToString().Split(HISTORY_SEPARATOR_CHAR)); - replacePatternComboBox.SetPopdownStrings(stringArray.ToString().Split(HISTORY_SEPARATOR_CHAR)); - } - } - } - - // saves the history arrays to the property service - // NOTE: this dialog uses a newline character to separate search history strings in the properties file - private void SaveHistoryValues() - { - string[] stringArray; - // set the history in properties - stringArray = new string[findHistory.Count]; - findHistory.CopyTo(stringArray, 0); - propertyService.SetProperty("MonoDevelop.FindReplaceDialogs.FindHistory", string.Join(HISTORY_SEPARATOR_CHAR.ToString(), stringArray)); - - // now do the replace history - if(replaceMode) { - stringArray = new string[replaceHistory.Count]; - replaceHistory.CopyTo(stringArray, 0); - propertyService.SetProperty("MonoDevelop.FindReplaceDialogs.ReplaceHistory", string.Join(HISTORY_SEPARATOR_CHAR.ToString(), stringArray)); - } - } - - #region code to pretend to be a dialog (cause we can't inherit Dialog and use glade) - public void Present() - { - ReplaceDialogPointer.Present(); - } - - public void Destroy() - { - // save the search and replace history to properties - OnClosed (); - ReplaceDialogPointer.Destroy(); - } - - public void ShowAll() - { - ReplaceDialogPointer.ShowAll(); - } - #endregion - } -} diff --git a/main/Unused/TextEditor/Gui/Dialogs/ReplaceInFilesDialog.cs b/main/Unused/TextEditor/Gui/Dialogs/ReplaceInFilesDialog.cs deleted file mode 100644 index 4608d5db6f..0000000000 --- a/main/Unused/TextEditor/Gui/Dialogs/ReplaceInFilesDialog.cs +++ /dev/null @@ -1,223 +0,0 @@ -// ReplaceInFilesDialog.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.IO; -using System.Drawing; -using System.ComponentModel; - -using MonoDevelop.Core.Gui; -using MonoDevelop.DefaultEditor.Gui.Editor; -using MonoDevelop.TextEditor.Document; -using MonoDevelop.Core.Properties; - -using MonoDevelop.Core; -using MonoDevelop.Core; -//using MonoDevelop.XmlForms; -//using MonoDevelop.Core.Gui.XmlForms; -using MonoDevelop.TextEditor; - -namespace MonoDevelop.Core.Gui.Dialogs -{ - public class ReplaceInFilesDialog //: BaseSharpDevelopForm - {/* - ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService)); - IMessageService messageService = (IMessageService)ServiceManager.Services.GetService(typeof(IMessageService)); - static PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService)); - bool replaceMode; - - public ReplaceInFilesDialog(bool replaceMode) - { - this.replaceMode = replaceMode; - FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService)); - if (replaceMode) { - this.SetupFromXml(propertyService.DataDirectory + @"\resources\dialogs\ReplaceInFilesDialog.xfrm"); - ControlDictionary["replacePatternComboBox"].Text = SearchReplaceInFilesManager.SearchOptions.ReplacePattern; - ControlDictionary["replaceHelpButton"].Enabled = false; - } else { - this.SetupFromXml(propertyService.DataDirectory + @"\resources\dialogs\FindInFilesDialog.xfrm"); - } - - ControlDictionary["findHelpButton"].Enabled = false; - ControlDictionary["searchPatternComboBox"].Text = SearchReplaceInFilesManager.SearchOptions.SearchPattern; - - AcceptButton = (Button)ControlDictionary["findButton"]; - CancelButton = (Button)ControlDictionary["closeButton"]; - - ((ComboBox)ControlDictionary["specialSearchStrategyComboBox"]).Items.Add(resourceService.GetString("Dialog.NewProject.SearchReplace.SearchStrategy.WildcardSearch")); - ((ComboBox)ControlDictionary["specialSearchStrategyComboBox"]).Items.Add(resourceService.GetString("Dialog.NewProject.SearchReplace.SearchStrategy.RegexSearch")); - int index = 0; - switch (SearchReplaceManager.SearchOptions.SearchStrategyType) { - case SearchStrategyType.Normal: - case SearchStrategyType.Wildcard: - break; - case SearchStrategyType.RegEx: - index = 1; - break; - } - ((ComboBox)ControlDictionary["specialSearchStrategyComboBox"]).SelectedIndex = index; - - ((ComboBox)ControlDictionary["searchLocationComboBox"]).Items.Add(resourceService.GetString("Global.Location.directories")); - ((ComboBox)ControlDictionary["searchLocationComboBox"]).Items.Add(resourceService.GetString("Global.Location.allopenfiles")); - ((ComboBox)ControlDictionary["searchLocationComboBox"]).Items.Add(resourceService.GetString("Global.Location.wholeproject")); - - index = 0; - switch (SearchReplaceInFilesManager.SearchOptions.DocumentIteratorType) { - case DocumentIteratorType.AllOpenFiles: - index = 1; - break; - case DocumentIteratorType.WholeCombine: - index = 2; - break; - } - - ((ComboBox)ControlDictionary["searchLocationComboBox"]).SelectedIndex = index; - ((ComboBox)ControlDictionary["searchLocationComboBox"]).SelectedIndexChanged += new EventHandler(SearchLocationCheckBoxChangedEvent); - - ((CheckBox)ControlDictionary["useSpecialSearchStrategyCheckBox"]).CheckedChanged += new EventHandler(SpecialSearchStrategyCheckBoxChangedEvent); - - ControlDictionary["directoryTextBox"].Text = SearchReplaceInFilesManager.SearchOptions.SearchDirectory; - ControlDictionary["fileMaskTextBox"].Text = SearchReplaceInFilesManager.SearchOptions.FileMask; - ((CheckBox)ControlDictionary["includeSubdirectoriesCheckBox"]).Checked = SearchReplaceInFilesManager.SearchOptions.SearchSubdirectories; - - ControlDictionary["browseButton"].Click += new EventHandler(BrowseDirectoryEvent); - - ControlDictionary["findButton"].Click += new EventHandler(FindEvent); - - if (replaceMode) { - ControlDictionary["replaceAllButton"].Click += new EventHandler(ReplaceEvent); - } - - - SearchLocationCheckBoxChangedEvent(null, null); - SpecialSearchStrategyCheckBoxChangedEvent(null, null); - } - - void FindEvent(object sender, EventArgs e) - { - if (SetupSearchReplaceInFilesManager()) { - SearchReplaceInFilesManager.FindAll(); - } - } - - void ReplaceEvent(object sender, EventArgs e) - { - if (SetupSearchReplaceInFilesManager()) { - SearchReplaceInFilesManager.ReplaceAll(); - } - } - - void BrowseDirectoryEvent(object sender, EventArgs e) - { - FolderDialog fd = new FolderDialog(); - if (fd.DisplayDialog(resourceService.GetString("NewProject.SearchReplace.FindInFilesBrowseLabel")) == DialogResult.OK) { - ControlDictionary["directoryTextBox"].Text = fd.Path; - } - } - - void SearchLocationCheckBoxChangedEvent(object sender, EventArgs e) - { - bool enableDirectorySearch = ((ComboBox)ControlDictionary["searchLocationComboBox"]).SelectedIndex == 0; - ControlDictionary["fileMaskTextBox"].Enabled = enableDirectorySearch; - ControlDictionary["directoryTextBox"].Enabled = enableDirectorySearch; - ControlDictionary["browseButton"].Enabled = enableDirectorySearch; - ControlDictionary["includeSubdirectoriesCheckBox"].Enabled = enableDirectorySearch; - } - - void SpecialSearchStrategyCheckBoxChangedEvent(object sender, EventArgs e) - { - CheckBox cb = (CheckBox)ControlDictionary["useSpecialSearchStrategyCheckBox"]; - if (cb != null) { - ControlDictionary["specialSearchStrategyComboBox"].Enabled = cb.Checked; - } - } - - bool SetupSearchReplaceInFilesManager() - { - FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService)); - - string directoryName = ControlDictionary["directoryTextBox"].Text; - string fileMask = ControlDictionary["fileMaskTextBox"].Text; - if (fileMask == null || fileMask.Length == 0) { - fileMask = "*"; - } - - if (SearchReplaceInFilesManager.SearchOptions.DocumentIteratorType == DocumentIteratorType.Directory) { - - if (!fileUtilityService.IsValidFileName(directoryName)) { - messageService.ShowErrorFormatted("${res:NewProject.SearchReplace.FindInFilesInvalidDirectoryMessage}", directoryName); - return false; - } - - if (!Directory.Exists(directoryName)) { - messageService.ShowErrorFormatted("${res:NewProject.SearchReplace.FindInFilesDirectoryNotExistingMessage}", directoryName); - return false; - } - - if (!fileUtilityService.IsValidFileName(fileMask) || fileMask.IndexOf('\\') >= 0) { - messageService.ShowErrorFormatted("${res:NewProject.SearchReplace.FindInFilesInvalidFilemaskMessage}", fileMask); - return false; - } - } - if (fileMask == null || fileMask.Length == 0) { - SearchReplaceInFilesManager.SearchOptions.FileMask = "*"; - } else { - SearchReplaceInFilesManager.SearchOptions.FileMask = fileMask; - } - SearchReplaceInFilesManager.SearchOptions.SearchDirectory = directoryName; - SearchReplaceInFilesManager.SearchOptions.SearchSubdirectories = ((CheckBox)ControlDictionary["includeSubdirectoriesCheckBox"]).Checked; - - SearchReplaceInFilesManager.SearchOptions.SearchPattern = ControlDictionary["searchPatternComboBox"].Text; - if (replaceMode) { - SearchReplaceInFilesManager.SearchOptions.ReplacePattern = ControlDictionary["replacePatternComboBox"].Text; - } - - SearchReplaceInFilesManager.SearchOptions.IgnoreCase = !((CheckBox)ControlDictionary["ignoreCaseCheckBox"]).Checked; - SearchReplaceInFilesManager.SearchOptions.SearchWholeWordOnly = ((CheckBox)ControlDictionary["searchWholeWordOnlyCheckBox"]).Checked; - - if (((CheckBox)ControlDictionary["useSpecialSearchStrategyCheckBox"]).Checked) { - switch (((ComboBox)ControlDictionary["specialSearchStrategyComboBox"]).SelectedIndex) { - case 0: - SearchReplaceInFilesManager.SearchOptions.SearchStrategyType = SearchStrategyType.Wildcard; - break; - case 1: - SearchReplaceInFilesManager.SearchOptions.SearchStrategyType = SearchStrategyType.RegEx; - break; - } - } else { - SearchReplaceInFilesManager.SearchOptions.SearchStrategyType = SearchStrategyType.Normal; - } - - switch (((ComboBox)ControlDictionary["searchLocationComboBox"]).SelectedIndex) { - case 0: - SearchReplaceInFilesManager.SearchOptions.DocumentIteratorType = DocumentIteratorType.Directory; - break; - case 1: - SearchReplaceInFilesManager.SearchOptions.DocumentIteratorType = DocumentIteratorType.AllOpenFiles; - break; - case 2: - SearchReplaceInFilesManager.SearchOptions.DocumentIteratorType = DocumentIteratorType.WholeCombine; - break; - } - return true; - } - */ - } -} diff --git a/main/Unused/TextEditor/Gui/Dialogs/SortOptionsDialog.cs b/main/Unused/TextEditor/Gui/Dialogs/SortOptionsDialog.cs deleted file mode 100644 index e6e687b7c4..0000000000 --- a/main/Unused/TextEditor/Gui/Dialogs/SortOptionsDialog.cs +++ /dev/null @@ -1,78 +0,0 @@ -// SortOptionsDialog.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.DirectoryServices; // for SortDirection -using System.ComponentModel; - -using MonoDevelop.Core.Gui; -using MonoDevelop.DefaultEditor.Gui.Editor; -using MonoDevelop.TextEditor.Document; -using MonoDevelop.Core.Properties; - -using MonoDevelop.Core; -using MonoDevelop.Core; -//using MonoDevelop.XmlForms; -//using MonoDevelop.Core.Gui.XmlForms; -using MonoDevelop.TextEditor; - - -namespace MonoDevelop.Core.Gui.Dialogs -{ - public class SortOptionsDialog //: BaseSharpDevelopForm - {/* - public static readonly string removeDupesOption = "MonoDevelop.Core.Gui.Dialogs.SortOptionsDialog.RemoveDuplicateLines"; - public static readonly string caseSensitiveOption = "MonoDevelop.Core.Gui.Dialogs.SortOptionsDialog.CaseSensitive"; - public static readonly string ignoreWhiteSpacesOption = "MonoDevelop.Core.Gui.Dialogs.SortOptionsDialog.IgnoreWhitespaces"; - public static readonly string sortDirectionOption = "MonoDevelop.Core.Gui.Dialogs.SortOptionsDialog.SortDirection"; - - static PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService)); - - public SortOptionsDialog() - { - this.SetupFromXml(propertyService.DataDirectory + @"\resources\dialogs\SortOptionsDialog.xfrm"); - - AcceptButton = (Button)ControlDictionary["okButton"]; - CancelButton = (Button)ControlDictionary["cancelButton"]; - ((CheckBox)ControlDictionary["removeDupesCheckBox"]).Checked = propertyService.GetProperty(removeDupesOption, false); - ((CheckBox)ControlDictionary["caseSensitiveCheckBox"]).Checked = propertyService.GetProperty(caseSensitiveOption, true); - ((CheckBox)ControlDictionary["ignoreWhiteSpacesCheckBox"]).Checked = propertyService.GetProperty(ignoreWhiteSpacesOption, false); - - ((RadioButton)ControlDictionary["ascendingRadioButton"]).Checked = ((SortDirection)propertyService.GetProperty(sortDirectionOption, SortDirection.Ascending)) == SortDirection.Ascending; - ((RadioButton)ControlDictionary["descendingRadioButton"]).Checked = ((SortDirection)propertyService.GetProperty(sortDirectionOption, SortDirection.Ascending)) == SortDirection.Descending; - - // insert event handlers - ControlDictionary["okButton"].Click += new EventHandler(OkEvent); - } - - void OkEvent(object sender, EventArgs e) - { - propertyService.SetProperty(removeDupesOption, ((CheckBox)ControlDictionary["removeDupesCheckBox"]).Checked); - propertyService.SetProperty(caseSensitiveOption, ((CheckBox)ControlDictionary["caseSensitiveCheckBox"]).Checked); - propertyService.SetProperty(ignoreWhiteSpacesOption, ((CheckBox)ControlDictionary["ignoreWhiteSpacesCheckBox"]).Checked); - if (((RadioButton)ControlDictionary["ascendingRadioButton"]).Checked) { - propertyService.SetProperty(sortDirectionOption, SortDirection.Ascending); - } else { - propertyService.SetProperty(sortDirectionOption, SortDirection.Descending); - } - }*/ - } -} diff --git a/main/Unused/TextEditor/Gui/Editor/CompletionWindow/CodeCompletionData.cs b/main/Unused/TextEditor/Gui/Editor/CompletionWindow/CodeCompletionData.cs deleted file mode 100644 index c6345ace5a..0000000000 --- a/main/Unused/TextEditor/Gui/Editor/CompletionWindow/CodeCompletionData.cs +++ /dev/null @@ -1,281 +0,0 @@ -// CodeCompletionData.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Xml; -using System.Text; -using System.Text.RegularExpressions; -using System.IO; - -using SharpDevelop.Internal.Parser; -using MonoDevelop.TextEditor; -using MonoDevelop.Core; -using MonoDevelop.Core; -using MonoDevelop.TextEditor.Gui.CompletionWindow; - -namespace MonoDevelop.DefaultEditor.Gui.Editor -{ - class CodeCompletionData : ICompletionDataWithMarkup - { - static IconService classBrowserIconService = (IconService)ServiceManager.Services.GetService(typeof(IconService)); - static IParserService parserService = (IParserService)MonoDevelop.Core.ServiceManager.Services.GetService(typeof(IParserService)); - static AmbienceService ambienceService = (AmbienceService)ServiceManager.Services.GetService(typeof(AmbienceService)); - - int imageIndex; - int overloads; - string text; - string description; - string pango_description; - string documentation; - string completionString; - IClass c; - bool convertedDocumentation = false; - - static IAmbience PangoAmbience { - get { - IAmbience asvc = ambienceService.CurrentAmbience; - asvc.ConversionFlags |= ConversionFlags.IncludePangoMarkup; - return asvc; - } - } - - public int Overloads { - get { - return overloads; - } - set { - overloads = value; - } - } - - public int ImageIndex { - get { - return imageIndex; - } - set { - imageIndex = value; - } - } - - public string[] Text { - get { - return new string[] { text }; - } - set { - text = value[0]; - } - } - public string Description { - get { - // get correct delegate description (when description is requested) - // in the classproxies aren't methods saved, therefore delegate methods - // must be get through the real class instead out of the proxy - // - // Mike - if (c is ClassProxy && c.ClassType == ClassType.Delegate) { - description = ambienceService.CurrentAmbience.Convert(parserService.GetClass(c.FullyQualifiedName)); - pango_description = PangoAmbience.Convert(parserService.GetClass(c.FullyQualifiedName)); - c = null; - } - - // don't give a description string, if no documentation or description is provided - if (description.Length + documentation.Length == 0) { - return null; - } - if (!convertedDocumentation) { - convertedDocumentation = true; - try { - documentation = GetDocumentation(documentation); - // new (by G.B.) - // XmlDocument doc = new XmlDocument(); - // doc.LoadXml("<doc>" + documentation + "</doc>"); - // XmlNode root = doc.DocumentElement; - // XmlNode paramDocu = root.SelectSingleNode("summary"); - // documentation = paramDocu.InnerXml; - } catch (Exception e) { - Console.WriteLine(e.ToString()); - } - } - return (description + (overloads > 0 ? " (+" + overloads + " overloads)" : String.Empty) + "\n" + documentation).Trim (); - } - set { - description = value; - } - } - - public string DescriptionPango { - get { - // get correct delegate description (when description is requested) - // in the classproxies aren't methods saved, therefore delegate methods - // must be get through the real class instead out of the proxy - // - // Mike - if (c is ClassProxy && c.ClassType == ClassType.Delegate) { - description = ambienceService.CurrentAmbience.Convert(parserService.GetClass(c.FullyQualifiedName)); - pango_description = PangoAmbience.Convert(parserService.GetClass(c.FullyQualifiedName)); - c = null; - } - - // don't give a description string, if no documentation or description is provided - if (description.Length + documentation.Length == 0) { - return null; - } - if (!convertedDocumentation) { - convertedDocumentation = true; - try { - documentation = GetDocumentation(documentation); - // new (by G.B.) - // XmlDocument doc = new XmlDocument(); - // doc.LoadXml("<doc>" + documentation + "</doc>"); - // XmlNode root = doc.DocumentElement; - // XmlNode paramDocu = root.SelectSingleNode("summary"); - // documentation = paramDocu.InnerXml; - } catch (Exception e) { - Console.WriteLine(e.ToString()); - } - } - return (pango_description + (overloads > 0 ? " (+" + overloads + " overloads)" : String.Empty) + "\n" + documentation).Trim (); - } - set { - description = value; - } - } - - public CodeCompletionData(string s, int imageIndex) - { - description = pango_description = documentation = String.Empty; - text = s; - completionString = s; - this.imageIndex = imageIndex; - } - - public CodeCompletionData(IClass c) - { - // save class (for the delegate description shortcut - this.c = c; - imageIndex = classBrowserIconService.GetIcon(c); - text = c.Name; - completionString = c.Name; - description = ambienceService.CurrentAmbience.Convert(c); - pango_description = PangoAmbience.Convert(c); - documentation = c.Documentation; - } - - public CodeCompletionData(IMethod method) - { - imageIndex = classBrowserIconService.GetIcon(method); - text = method.Name; - description = ambienceService.CurrentAmbience.Convert(method); - pango_description = PangoAmbience.Convert (method); - completionString = method.Name; - documentation = method.Documentation; - } - - public CodeCompletionData(IField field) - { - imageIndex = classBrowserIconService.GetIcon(field); - text = field.Name; - description = ambienceService.CurrentAmbience.Convert(field); - pango_description = PangoAmbience.Convert (field); - completionString = field.Name; - documentation = field.Documentation; - } - - public CodeCompletionData(IProperty property) - { - imageIndex = classBrowserIconService.GetIcon(property); - text = property.Name; - description = ambienceService.CurrentAmbience.Convert(property); - pango_description = PangoAmbience.Convert (property); - completionString = property.Name; - documentation = property.Documentation; - } - - public CodeCompletionData(IEvent e) - { - imageIndex = classBrowserIconService.GetIcon(e); - text = e.Name; - description = ambienceService.CurrentAmbience.Convert(e); - pango_description = PangoAmbience.Convert (e); - completionString = e.Name; - documentation = e.Documentation; - } - - public void InsertAction(TextEditorControl control) - { - ((SharpDevelopTextAreaControl)control).ActiveTextAreaControl.TextArea.InsertString(completionString); - } - - public static string GetDocumentation(string doc) - { - System.IO.StringReader reader = new System.IO.StringReader("<docroot>" + doc + "</docroot>"); - XmlTextReader xml = new XmlTextReader(reader); - StringBuilder ret = new StringBuilder(); - Regex whitespace = new Regex(@"\s+"); - - try { - xml.Read(); - do { - if (xml.NodeType == XmlNodeType.Element) { - string elname = xml.Name.ToLower(); - if (elname == "remarks") { - ret.Append("Remarks:\n"); - } else if (elname == "example") { - ret.Append("Example:\n"); - } else if (elname == "exception") { - ret.Append("Exception: " + GetCref(xml["cref"]) + ":\n"); - } else if (elname == "returns") { - ret.Append("Returns: "); - } else if (elname == "see") { - ret.Append(GetCref(xml["cref"]) + xml["langword"]); - } else if (elname == "seealso") { - ret.Append("See also: " + GetCref(xml["cref"]) + xml["langword"]); - } else if (elname == "paramref") { - ret.Append(xml["name"]); - } else if (elname == "param") { - ret.Append(xml["name"].Trim() + ": "); - } else if (elname == "value") { - ret.Append("Value: "); - } - } else if (xml.NodeType == XmlNodeType.EndElement) { - string elname = xml.Name.ToLower(); - if (elname == "para" || elname == "param") { - ret.Append("\n"); - } - } else if (xml.NodeType == XmlNodeType.Text) { - ret.Append(whitespace.Replace(xml.Value, " ")); - } - } while(xml.Read()); - } catch { - return doc; - } - return ret.ToString(); - } - - 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); - return cref; - } - - } -} diff --git a/main/Unused/TextEditor/Gui/Editor/CompletionWindow/CodeCompletionDataProvider.cs b/main/Unused/TextEditor/Gui/Editor/CompletionWindow/CodeCompletionDataProvider.cs deleted file mode 100644 index ed4f9d019d..0000000000 --- a/main/Unused/TextEditor/Gui/Editor/CompletionWindow/CodeCompletionDataProvider.cs +++ /dev/null @@ -1,163 +0,0 @@ -// CodeCompletionDataProvider.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Diagnostics; -using System.Reflection; -using System.Collections; -using System.Collections.Specialized; -using System.Xml; - -using MonoDevelop.Core.Properties; -using MonoDevelop.TextEditor.Document; -using MonoDevelop.TextEditor; -using MonoDevelop.Core; -using MonoDevelop.Core; -using SharpDevelop.Internal.Parser; -using MonoDevelop.TextEditor.Gui.CompletionWindow; -using MonoDevelop.Core.Gui; - -namespace MonoDevelop.DefaultEditor.Gui.Editor -{ - /// <summary> - /// Data provider for code completion. - /// </summary> - public class CodeCompletionDataProvider : ICompletionDataProvider - { - static IconService classBrowserIconService = (IconService)ServiceManager.Services.GetService(typeof(IconService)); -// static AmbienceService ambienceService = (AmbienceService)ServiceManager.Services.GetService(typeof(AmbienceService)); - Hashtable insertedElements = new Hashtable(); - Hashtable insertedPropertiesElements = new Hashtable(); - Hashtable insertedEventElements = new Hashtable(); - - public Gdk.Pixbuf[] ImageList { - get { - PixbufList list = classBrowserIconService.ImageList; - return (Gdk.Pixbuf[])list.ToArray (typeof(Gdk.Pixbuf)); - } - } - - int caretLineNumber; - int caretColumn; - string fileName; - - ArrayList completionData = null; - - public ICompletionData[] GenerateCompletionData(IProject project, string fileName, TextArea textArea, char charTyped) - { - IDocument document = textArea.Document; - Console.WriteLine ("resolve " + document.Language); - Console.WriteLine ("nm " + fileName); - completionData = new ArrayList(); - this.fileName = fileName; - - // the parser works with 1 based coordinates - caretLineNumber = document.GetLineNumberForOffset(textArea.Caret.Offset) + 1; - caretColumn = textArea.Caret.Offset - document.GetLineSegment(caretLineNumber - 1).Offset + 1; - string expression = TextUtilities.GetExpressionBeforeOffset(textArea, textArea.Caret.Offset); - ResolveResult results; - - if (expression.Length == 0) { - return null; - } - IParserService parserService = (IParserService)MonoDevelop.Core.ServiceManager.Services.GetService(typeof(IParserService)); - if (charTyped == ' ') { - if (expression == "using" || expression.EndsWith(" using") || expression.EndsWith("\tusing")|| expression.EndsWith("\nusing")|| expression.EndsWith("\rusing")) { - string[] namespaces = parserService.GetNamespaceList(""); -// AddResolveResults(new ResolveResult(namespaces, ShowMembers.Public)); - AddResolveResults(new ResolveResult(namespaces)); -// IParseInformation info = parserService.GetParseInformation(fileName); -// ICompilationUnit unit = info.BestCompilationUnit as ICompilationUnit; -// if (unit != null) { -// foreach (IUsing u in unit.Usings) { -// if (u.Region.IsInside(caretLineNumber, caretColumn)) { -// foreach (string usingStr in u.Usings) { -// results = parserService.Resolve(usingStr, caretLineNumber, caretColumn, fileName); -// AddResolveResults(results); -// } -// if (u.Aliases[""] != null) { -// results = parserService.Resolve(u.Aliases[""].ToString(), caretLineNumber, caretColumn, fileName); -// AddResolveResults(results); -// } -// } -// } -// } - } - } else { - //FIXME: I added the null check, #D doesnt need it, why do we? - if (fileName != null) { - Console.WriteLine ("resolve " + document.Language); - results = parserService.Resolve(expression, - caretLineNumber, - caretColumn, - fileName, - document.TextContent, - document.Language); - - AddResolveResults(results); - } - } - - return (ICompletionData[])completionData.ToArray(typeof(ICompletionData)); - } - - void AddResolveResults(ResolveResult results) - { - if (results != null) { - completionData.Capacity += results.Namespaces.Count + - results.Members.Count; - - if (results.Namespaces != null && results.Namespaces.Count > 0) { - foreach (string s in results.Namespaces) { - completionData.Add(new CodeCompletionData(s, classBrowserIconService.NamespaceIndex)); - } - } - if (results.Members != null && results.Members.Count > 0) { - foreach (object o in results.Members) { - if (o is IClass) { - completionData.Add(new CodeCompletionData((IClass)o)); - } else if (o is IProperty) { - IProperty property = (IProperty)o; - if (property.Name != null && insertedPropertiesElements[property.Name] == null) { - completionData.Add(new CodeCompletionData(property)); - insertedPropertiesElements[property.Name] = property; - } - } else if (o is IMethod) { - IMethod method = (IMethod)o; - if (method.Name != null && insertedElements[method.Name] == null && !method.IsConstructor) { - completionData.Add(new CodeCompletionData(method)); - insertedElements[method.Name] = method; - } - } else if (o is IField) { - completionData.Add(new CodeCompletionData((IField)o)); - } else if (o is IEvent) { - IEvent e = (IEvent)o; - if (e.Name != null && insertedEventElements[e.Name] == null) { - completionData.Add(new CodeCompletionData(e)); - insertedEventElements[e.Name] = e; - } - } - } - } - } - } - } -} diff --git a/main/Unused/TextEditor/Gui/Editor/CompletionWindow/CommentCompletionDataProvider.cs b/main/Unused/TextEditor/Gui/Editor/CompletionWindow/CommentCompletionDataProvider.cs deleted file mode 100644 index 42d7b78f03..0000000000 --- a/main/Unused/TextEditor/Gui/Editor/CompletionWindow/CommentCompletionDataProvider.cs +++ /dev/null @@ -1,138 +0,0 @@ -// CommentCompletionDataProvider.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Reflection; -using System.Collections; - -using MonoDevelop.Core.Properties; -using MonoDevelop.TextEditor.Document; -using MonoDevelop.TextEditor; -using MonoDevelop.Core; -using MonoDevelop.Core; - -using SharpDevelop.Internal.Parser; -using MonoDevelop.TextEditor.Gui.CompletionWindow; -using MonoDevelop.Core.Gui; - -namespace MonoDevelop.DefaultEditor.Gui.Editor -{ - /// <summary> - /// Data provider for code completion. - /// </summary> - public class CommentCompletionDataProvider : ICompletionDataProvider - { - static IconService classBrowserIconService = (IconService)ServiceManager.Services.GetService(typeof(IconService)); - static IParserService parserService = (IParserService)MonoDevelop.Core.ServiceManager.Services.GetService(typeof(IParserService)); - - int caretLineNumber; - int caretColumn; - - string[][] commentTags = new string[][] { - new string[] {"c", "marks text as code"}, - new string[] {"code", "marks text as code"}, - new string[] {"example", "A description of the code example\n(must have a <code> tag inside)"}, - new string[] {"exception cref=\"\"", "description to an exception thrown"}, - new string[] {"list type=\"\"", "A list"}, - new string[] {"listheader", "The header from the list"}, - new string[] {"item", "A list item"}, - new string[] {"term", "A term in a list"}, - new string[] {"description", "A description to a term in a list"}, - new string[] {"param name=\"\"", "A description for a parameter"}, - new string[] {"paramref name=\"\"", "A reference to a parameter"}, - new string[] {"permission cref=\"\"", ""}, - new string[] {"remarks", "Gives description for a member"}, - new string[] {"include file=\"\" path=\"\"", "Includes comments from other files"}, - new string[] {"returns", "Gives description for a return value"}, - new string[] {"see cref=\"\"", "A reference to a member"}, - new string[] {"seealso cref=\"\"", "A reference to a member in the seealso section"}, - new string[] {"summary", "A summary of the object"}, - new string[] {"value", "A description of a property"} - }; - - public Gdk.Pixbuf[] ImageList { - get { - PixbufList list = classBrowserIconService.ImageList; - return (Gdk.Pixbuf[])list.ToArray (typeof (Gdk.Pixbuf)); - } - } - - /// <remarks> - /// Returns true, if the given coordinates (row, column) are in the region. - /// </remarks> - bool IsBetween(int row, int column, IRegion region) - { - return row >= region.BeginLine && (row <= region.EndLine || region.EndLine == -1); - } - - public ICompletionData[] GenerateCompletionData(IProject project, string fileName, TextArea textArea, char charTyped) - { - caretLineNumber = textArea.Caret.Line; - caretColumn = textArea.Caret.Column; - LineSegment caretLine = textArea.Document.GetLineSegment(caretLineNumber); - string lineText = textArea.Document.GetText(caretLine.Offset, caretLine.Length); - if (!lineText.Trim().StartsWith("///")) { - return null; - } - - ArrayList completionData = new ArrayList(); - foreach (string[] tag in commentTags) { - completionData.Add(new CommentCompletionData(tag[0], tag[1])); - } - return (ICompletionData[])completionData.ToArray(typeof(ICompletionData)); - } - - class CommentCompletionData : ICompletionData - { - string text; - string description; - - public int ImageIndex { - get { - return classBrowserIconService.MethodIndex; - } - } - - public string[] Text { - get { - return new string[] { text }; - } - } - - public string Description { - get { - return description; - } - } - - public void InsertAction(TextEditorControl control) - { - ((SharpDevelopTextAreaControl)control).ActiveTextAreaControl.TextArea.InsertString(text); - } - - public CommentCompletionData(string text, string description) - { - this.text = text; - this.description = description; - } - } - } -} diff --git a/main/Unused/TextEditor/Gui/Editor/CompletionWindow/TemplateCompletionDataProvider.cs b/main/Unused/TextEditor/Gui/Editor/CompletionWindow/TemplateCompletionDataProvider.cs deleted file mode 100644 index 749f875fe2..0000000000 --- a/main/Unused/TextEditor/Gui/Editor/CompletionWindow/TemplateCompletionDataProvider.cs +++ /dev/null @@ -1,89 +0,0 @@ -// TemplateCompletionDataProvider.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Reflection; -using System.Collections; - -using MonoDevelop.Core.Properties; -using MonoDevelop.Projects; -using MonoDevelop.TextEditor.Document; -using MonoDevelop.TextEditor; -using MonoDevelop.TextEditor.Gui.CompletionWindow; - -namespace MonoDevelop.DefaultEditor.Gui.Editor -{ - public class TemplateCompletionDataProvider : ICompletionDataProvider - { - public Gdk.Pixbuf[] ImageList { - get { - return null; - } - } - - public ICompletionData[] GenerateCompletionData(IProject project, string fileName, TextArea textArea, char charTyped) - { - CodeTemplateGroup templateGroup = CodeTemplateLoader.GetTemplateGroupPerFilename(fileName); - if (templateGroup == null) { - return null; - } - ArrayList completionData = new ArrayList(); - foreach (CodeTemplate template in templateGroup.Templates) { - completionData.Add(new TemplateCompletionData(template)); - } - - return (ICompletionData[])completionData.ToArray(typeof(ICompletionData)); - } - - class TemplateCompletionData : ICompletionData - { - CodeTemplate template; - - public int ImageIndex { - get { - return 0; - } - } - - public string[] Text { - get { - return new string[] { template.Shortcut, template.Description }; - } - } - - public string Description { - get { - return template.Text; - } - } - - public void InsertAction(TextEditorControl control) - { - ((SharpDevelopTextAreaControl)control).InsertTemplate(template); - } - - public TemplateCompletionData(CodeTemplate template) - { - this.template = template; - } - } - } -} diff --git a/main/Unused/TextEditor/Gui/Editor/ErrorDrawer.cs b/main/Unused/TextEditor/Gui/Editor/ErrorDrawer.cs deleted file mode 100644 index 004f439ae8..0000000000 --- a/main/Unused/TextEditor/Gui/Editor/ErrorDrawer.cs +++ /dev/null @@ -1,236 +0,0 @@ -//// <file> -//// <copyright see="prj:///doc/copyright.txt"/> -//// <license see="prj:///doc/license.txt"/> -//// <owner name="Mike Krüger" email="mike@icsharpcode.net"/> -//// <version value="$version"/> -//// </file> -// -//using System; -//using System.Collections; -//using System.Drawing; -//using System.Drawing.Text; -// -//using MonoDevelop.TextEditor.Document; -//using MonoDevelop.Core; -//using MonoDevelop.Core.Gui; -//using MonoDevelop.TextEditor; -// -//namespace MonoDevelop.DefaultEditor.Gui.Editor -//{ -// /// <summary> -// /// reperesents a visual error, this class is needed by the errordrawer. -// /// </summary> -// public class VisualError -// { -// int offset; -// int length; -// string description; -// -// public int Offset { -// get { -// return offset; -// } -// set { -// offset = value; -// } -// } -// -// public int Length { -// get { -// return length; -// } -// set { -// length = value; -// } -// } -// -// public string Description { -// get { -// return description; -// } -// } -// -// public VisualError(int offset, int length, string description) -// { -// this.offset = offset; -// this.length = length; -// this.description = description; -// } -// } -// -// /// <summary> -// /// This class draws error underlines. -// /// </summary> -// public class ErrorDrawer -// { -// ArrayList errors = new ArrayList(); -// TextAreaControl textarea; -// -// public ErrorDrawer(TextAreaControl textarea) -// { -// this.textarea = textarea; -// textarea.Document.DocumentChanged += new DocumentAggregatorEventHandler(MoveIndices); -// textarea.TextAreaPainter.ToolTipEvent += new ToolTipEvent(ToolTip); -// textarea.TextAreaPainter.LinePainter += new LinePainter(ErrorPainter); -// -// TaskService taskService = (TaskService)MonoDevelop.Core.ServiceManager.Services.GetService(typeof(TaskService)); -// taskService.TasksChanged += new EventHandler(SetErrors); -// textarea.FileNameChanged += new EventHandler(SetErrors); -// } -// -// public void MoveIndices(object sender, DocumentAggregatorEventArgs e) -// { -// ArrayList newerrors = new ArrayList(); -// bool redraw = false; -// lock (this) { -// foreach (VisualError error in errors) { -// if (e.Length == -1) { // insert -// if (e.Offset <= error.Offset) { -// error.Offset += e.Text.Length; -// redraw = true; -// } else if (e.Offset < error.Offset + error.Length) { -// error.Length += e.Text.Length; -// redraw = true; -// } -// } else if (e.Text == null) { // remove -// if (e.Offset < error.Offset) { -// error.Offset -= e.Length; -// redraw = true; -// } else if (e.Offset == error.Offset) { -// error.Length -= e.Length; -// } else if (e.Offset <= error.Offset + error.Length) { -// if (e.Offset + e.Length <= error.Offset + error.Length) { -// error.Length = error.Length - e.Length; -// } else { -// error.Length = e.Offset - error.Offset; -// } -// } -// } else { // replace -// if (e.Offset <= error.Offset) { -// error.Offset -= e.Length; -// error.Offset += e.Text.Length; -// redraw = true; -// } -// } -// if (error.Offset > 0 && error.Offset + error.Length < e.Document.TextLength) { -// newerrors.Add(error); -// } -// } -// errors = newerrors; -// } -// -// if (redraw) { -// textarea.Refresh(); -// } -// } -// -// void ClearErrors() -// { -// ArrayList lines = new ArrayList(); -// foreach (VisualError error in errors) { -// lines.Add(textarea.Document.GetLineNumberForOffset(error.Offset)); -// } -// lock (this) { -// errors.Clear(); -// } -// foreach (int line in lines) { -// textarea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, new Point(0, line))); -// } -// textarea.Document.CommitUpdate(); -// } -// -// void SetErrors(object sender, EventArgs e) -// { -// ClearErrors(); -// TaskService taskService = (TaskService)MonoDevelop.Core.ServiceManager.Services.GetService(typeof(TaskService)); -// foreach (Task task in taskService.Tasks) { -// if (task.FileName == textarea.FileName && (task.TaskType == TaskType.Warning || -// task.TaskType == TaskType.Error)) { -// if (task.Line >= 0 && task.Line < textarea.Document.TotalNumberOfLines) { -// LineSegment line = textarea.Document.GetLineSegment(task.Line); -// int offset = Math.Min(textarea.Document.TextLength, line.Offset + task.Column); -// int length = Math.Max(1, TextUtilities.FindWordEnd(textarea.Document, offset) - offset); -// AddError(new VisualError(offset, length, task.Description)); -// } -// } -// } -// -// textarea.Refresh(); -// } -// -// bool AddError(VisualError newerror) -// { -//// Console.WriteLine("Add Error"); -// lock (this) { -// -// foreach (VisualError error in errors) { -// if (error.Offset == newerror.Offset && error.Length == newerror.Length) { -// return false; -// } -// } -// -// errors.Add(newerror); -// } -// -// int lineNr = textarea.Document.GetLineNumberForOffset(newerror.Offset); -// textarea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, new Point(0, lineNr))); -// textarea.Document.CommitUpdate(); -//// Console.WriteLine("Add Error .DONE"); -// return true; -// } -// -// void ToolTip(int xpos, int ypos, ref bool toolTipSet) -// { -//// Console.WriteLine("Tool Tip"); -// -// lock (this) { -// foreach (VisualError error in errors) { -// Point errorpos = textarea.Document.OffsetToView(error.Offset); -// Rectangle r = new Rectangle((int)(errorpos.X * textarea.TextAreaPainter.FontWidth), -// (int)(errorpos.Y * textarea.TextAreaPainter.FontHeight), -// (int)(error.Length * textarea.TextAreaPainter.FontWidth), -// (int)textarea.TextAreaPainter.FontHeight); -// if (r.Contains(xpos, ypos)) { -// textarea.TextAreaPainter.ToolTip.SetToolTip(textarea.TextAreaPainter, error.Description); -// toolTipSet = true; -// break; -// } -// } -// } -//// Console.WriteLine("Tool Tip .DONE"); -// } -// -// void DrawWaveLine(Graphics g, int from, int to, int ypos) -// { -// Pen pen = Pens.Red; -// for (int i = from; i < to; i+= 6) { -// g.DrawLine(pen, i, ypos + 3, i + 3, ypos + 1); -// g.DrawLine(pen, i + 3, ypos + 1, i + 6, ypos + 3); -// } -// } -// -// void ErrorPainter(Graphics g, int line, RectangleF rect, PointF pos, int virtualLeft, int virtualTop) -// { -//// Console.WriteLine("Paint"); -// if (textarea.Properties.GetProperty("ShowErrors", true)) { -// lock(this) { -// foreach (VisualError error in errors) { -// try { -// int offsetLineNumber = textarea.Document.GetLineNumberForOffset(error.Offset); -// -// if (offsetLineNumber == line) { -// LineSegment lineSegment = textarea.Document.GetLineSegment(offsetLineNumber); -// int xPos = error.Offset - lineSegment.Offset; -// DrawWaveLine(g, -// (int)(pos.X + textarea.TextAreaPainter.CalculateVisualXPos(offsetLineNumber, xPos) - virtualLeft), -// (int)(pos.X + textarea.TextAreaPainter.CalculateVisualXPos(offsetLineNumber, xPos + error.Length) - virtualLeft), -// (int)(pos.Y + textarea.TextAreaPainter.FontHeight - 3) - virtualTop); -// } -// } catch (Exception) {} -// } -// } -// } -//// Console.WriteLine("Paint .DONE"); -// } -// } -//} diff --git a/main/Unused/TextEditor/Gui/Editor/ITextAreaControlProvider.cs b/main/Unused/TextEditor/Gui/Editor/ITextAreaControlProvider.cs deleted file mode 100644 index 3625a0020b..0000000000 --- a/main/Unused/TextEditor/Gui/Editor/ITextAreaControlProvider.cs +++ /dev/null @@ -1,39 +0,0 @@ -// ITextAreaControlProvider.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.Drawing; -using System.Drawing.Text; - -using MonoDevelop.TextEditor.Document; -using MonoDevelop.Core; -using MonoDevelop.Core.Gui; -using MonoDevelop.TextEditor; - -namespace MonoDevelop.DefaultEditor.Gui.Editor -{ - public interface ITextEditorControlProvider - { - TextEditorControl TextEditorControl { - get; - } - } -} diff --git a/main/Unused/TextEditor/Gui/Editor/InsightWindow/IndexerInsightDataProvider.cs b/main/Unused/TextEditor/Gui/Editor/InsightWindow/IndexerInsightDataProvider.cs deleted file mode 100644 index 599a9d36f0..0000000000 --- a/main/Unused/TextEditor/Gui/Editor/InsightWindow/IndexerInsightDataProvider.cs +++ /dev/null @@ -1,141 +0,0 @@ -// IndexerInsightDataProvider.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Reflection; -using System.Collections; - -using MonoDevelop.Core; -using MonoDevelop.Core.Properties; -using MonoDevelop.Core; -using MonoDevelop.TextEditor.Document; -using SharpDevelop.Internal.Parser; -using MonoDevelop.TextEditor; -using MonoDevelop.TextEditor.Gui.InsightWindow; -using MonoDevelop.DefaultEditor.Gui.Editor; - - -namespace MonoDevelop.DefaultEditor.Gui.Editor -{ - public class IndexerInsightDataProvider : IInsightDataProvider - { - AmbienceService ambienceService = (AmbienceService)ServiceManager.Services.GetService(typeof(AmbienceService)); - - string fileName = null; - IDocument document = null; - TextArea textArea; - IndexerCollection methods = new IndexerCollection(); - - public int InsightDataCount { - get { - return methods.Count; - } - } - - public string GetInsightData(int number) - { - IIndexer method = methods[number]; - IAmbience conv = ambienceService.CurrentAmbience; - conv.ConversionFlags = ConversionFlags.StandardConversionFlags; - return conv.Convert(method) + - "\n" + - CodeCompletionData.GetDocumentation(method.Documentation); // new (by G.B.) - } - - int initialOffset; - public void SetupDataProvider(string fileName, TextArea textArea) - { - this.fileName = fileName; - this.document = textArea.Document; - this.textArea = textArea; - initialOffset = textArea.Caret.Offset; - - string word = TextUtilities.GetExpressionBeforeOffset(textArea, textArea.Caret.Offset); - string methodObject = word; - - // the parser works with 1 based coordinates - int caretLineNumber = document.GetLineNumberForOffset(textArea.Caret.Offset) + 1; - int caretColumn = textArea.Caret.Offset - document.GetLineSegment(caretLineNumber - 1).Offset + 1; - IParserService parserService = (IParserService)ServiceManager.Services.GetService(typeof(IParserService)); - ResolveResult results = parserService.Resolve(methodObject, - caretLineNumber, - caretColumn, - fileName, - document.TextContent); - if (results != null && results.Type != null) { - foreach (IClass c in results.Type.ClassInheritanceTree) { - foreach (IIndexer indexer in c.Indexer) { - methods.Add(indexer); - } - } - foreach (object o in results.ResolveContents) { - if (o is IClass) { - foreach (IClass c in ((IClass)o).ClassInheritanceTree) { - foreach (IIndexer indexer in c.Indexer) { - methods.Add(indexer); - } - } - } - } - } - } - - public bool CaretOffsetChanged() - { - bool closeDataProvider = textArea.Caret.Offset <= initialOffset; - - if (!closeDataProvider) { - bool insideChar = false; - bool insideString = false; - for (int offset = initialOffset; offset < Math.Min(textArea.Caret.Offset, document.TextLength); ++offset) { - char ch = document.GetCharAt(offset); - switch (ch) { - case '\'': - insideChar = !insideChar; - break; - case '"': - insideString = !insideString; - break; - case ']': - case '}': - case '{': - case ';': - if (!(insideChar || insideString)) { - return true; - } - break; - } - } - } - - return closeDataProvider; - } - - public bool CharTyped() - { - int offset = textArea.Caret.Offset - 1; - if (offset >= 0) { - return document.GetCharAt(offset) == ']'; - } - return false; - } - } -} diff --git a/main/Unused/TextEditor/Gui/Editor/InsightWindow/MethodInsightDataProvider.cs b/main/Unused/TextEditor/Gui/Editor/InsightWindow/MethodInsightDataProvider.cs deleted file mode 100644 index 9e83d2d1e3..0000000000 --- a/main/Unused/TextEditor/Gui/Editor/InsightWindow/MethodInsightDataProvider.cs +++ /dev/null @@ -1,228 +0,0 @@ -// MethodInsightDataProvider.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Reflection; -using System.Collections; - -using MonoDevelop.Core; -using MonoDevelop.Core.Properties; -using MonoDevelop.Core; -using MonoDevelop.TextEditor.Document; -using SharpDevelop.Internal.Parser; -using MonoDevelop.DefaultEditor.Gui.Editor; -using MonoDevelop.TextEditor; -using MonoDevelop.TextEditor.Gui.InsightWindow; - - -namespace MonoDevelop.DefaultEditor.Gui.Editor -{ - public class MethodInsightDataProvider : IInsightDataProvider - { - AmbienceService ambienceService = (AmbienceService)ServiceManager.Services.GetService(typeof(AmbienceService)); - - string fileName = null; - IDocument document = null; - TextArea textArea = null; - MethodCollection methods = new MethodCollection(); - - int caretLineNumber; - int caretColumn; - - public int InsightDataCount { - get { - return methods.Count; - } - } - - public string GetInsightData(int number) - { - IMethod method = methods[number]; - Console.WriteLine ("Method: {0}", method); - IAmbience conv = ambienceService.CurrentAmbience; - conv.ConversionFlags = ConversionFlags.StandardConversionFlags; - return conv.Convert(method) + - "\n" + - CodeCompletionData.GetDocumentation(method.Documentation); // new (by G.B.) - } - - int initialOffset; - public void SetupDataProvider(string fileName, TextArea textArea) - { - IDocument document = textArea.Document; - - this.fileName = fileName; - this.document = document; - this.textArea = textArea; - initialOffset = textArea.Caret.Offset; - - string word = TextUtilities.GetExpressionBeforeOffset(textArea, textArea.Caret.Offset); - string methodObject = word; - string methodName = null; - int idx = methodObject.LastIndexOf('.'); - if (idx >= 0) { - methodName = methodObject.Substring(idx + 1); - methodObject = methodObject.Substring(0, idx); - } else { - methodObject = "this"; - methodName = word; - } - - if (methodName.Length == 0 || methodObject.Length == 0) { - return; - } - - // the parser works with 1 based coordinates - caretLineNumber = document.GetLineNumberForOffset(textArea.Caret.Offset) + 1; - caretColumn = textArea.Caret.Offset - document.GetLineSegment(caretLineNumber).Offset + 1; - - string[] words = word.Split(' '); - bool contructorInsight = false; - if (words.Length > 1) { - contructorInsight = words[words.Length - 2] == "new"; - if (contructorInsight) { - methodObject = words[words.Length - 1]; - } - } - IParserService parserService = (IParserService)ServiceManager.Services.GetService(typeof(IParserService)); - ResolveResult results = parserService.Resolve(methodObject, caretLineNumber, caretColumn, fileName, document.TextContent); - - if (results != null && results.Type != null) { - if (contructorInsight) { - AddConstructors(results.Type); - } else { - foreach (IClass c in results.Type.ClassInheritanceTree) { - AddMethods(c, methodName, false); - } - } - } - } - - bool IsAlreadyIncluded(IMethod newMethod) - { - foreach (IMethod method in methods) { - if (method.Name == newMethod.Name) { - if (newMethod.Parameters.Count != method.Parameters.Count) { - return false; - } - - for (int i = 0; i < newMethod.Parameters.Count; ++i) { - if (newMethod.Parameters[i].ReturnType != method.Parameters[i].ReturnType) { - return false; - } - } - - // take out old method, when it isn't documented. - if (method.Documentation == null || method.Documentation.Length == 0) { - methods.Remove(method); - return false; - } - return true; - } - } - return false; - } - - void AddConstructors(IClass c) - { - foreach (IMethod method in c.Methods) { - if (method.IsConstructor && !method.IsStatic) { - methods.Add(method); - } - } - } - - void AddMethods(IClass c, string methodName, bool discardPrivate) - { - foreach (IMethod method in c.Methods) { - if (!(method.IsPrivate && discardPrivate) && - method.Name == methodName && - !IsAlreadyIncluded(method)) { - methods.Add(method); - } - } - } - - public bool CaretOffsetChanged() - { - bool closeDataProvider = textArea.Caret.Offset <= initialOffset; - int brackets = 0; - int curlyBrackets = 0; - if (!closeDataProvider) { - bool insideChar = false; - bool insideString = false; - for (int offset = initialOffset; offset < Math.Min(textArea.Caret.Offset, document.TextLength); ++offset) { - char ch = document.GetCharAt(offset); - switch (ch) { - case '\'': - insideChar = !insideChar; - break; - case '(': - if (!(insideChar || insideString)) { - ++brackets; - } - break; - case ')': - if (!(insideChar || insideString)) { - --brackets; - } - if (brackets <= 0) { - return true; - } - break; - case '"': - insideString = !insideString; - break; - case '}': - if (!(insideChar || insideString)) { - --curlyBrackets; - } - if (curlyBrackets < 0) { - return true; - } - break; - case '{': - if (!(insideChar || insideString)) { - ++curlyBrackets; - } - break; - case ';': - if (!(insideChar || insideString)) { - return true; - } - break; - } - } - } - - return closeDataProvider; - } - - public bool CharTyped() - { - int offset = textArea.Caret.Offset - 1; - if (offset >= 0) { - return document.GetCharAt(offset) == ')'; - } - return false; - } - } -} diff --git a/main/Unused/TextEditor/Gui/Editor/ParserFoldingStrategy.cs b/main/Unused/TextEditor/Gui/Editor/ParserFoldingStrategy.cs deleted file mode 100644 index f446af22ec..0000000000 --- a/main/Unused/TextEditor/Gui/Editor/ParserFoldingStrategy.cs +++ /dev/null @@ -1,85 +0,0 @@ -// ParserFoldingStrategy.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Drawing; -using System.Collections; -using MonoDevelop.Core; -using SharpDevelop.Internal.Parser; -using MonoDevelop.TextEditor.Document; - -namespace MonoDevelop.DefaultEditor.Gui.Editor -{ - /// <summary> - /// A simple folding strategy which calculates the folding level - /// using the indent level of the line. - /// </summary> - public class ParserFoldingStrategy : IFoldingStrategy - { - /// <remarks> - /// Calculates the fold level of a specific line. - /// </remarks> - public ArrayList GenerateFoldMarkers(IDocument document, string fileName, object parseInfo) - { - ParseInformation parseInformation = parseInfo as ParseInformation; - if (parseInformation == null || parseInformation.MostRecentCompilationUnit == null) { - return null; - } - - ArrayList foldMarkers = new ArrayList(); - ICompilationUnit cu = (ICompilationUnit)parseInformation.MostRecentCompilationUnit; - foreach (IClass c in cu.Classes) { - foldMarkers.Add(new FoldMarker(c.Region.BeginLine - 1, c.Region.BeginColumn - 1, - c.Region.EndLine - 1, c.Region.EndColumn, FoldType.TypeBody)); - foreach (IMethod m in c.Methods) { - foldMarkers.Add(new FoldMarker(m.Region.EndLine - 1, m.Region.EndColumn, - m.BodyRegion.EndLine - 1, m.BodyRegion.EndColumn - 1, FoldType.MemberBody)); -// Console.WriteLine("Add folding from {0} to {1}", m.Region, m.BodyRegion); - } - - foreach (IIndexer indexer in c.Indexer) { - foldMarkers.Add(new FoldMarker(indexer.Region.EndLine - 1, indexer.Region.EndColumn - 1, - indexer.BodyRegion.EndLine- 1, indexer.BodyRegion.EndColumn - 1, FoldType.MemberBody)); - } - - foreach (IProperty p in c.Properties) { - foldMarkers.Add(new FoldMarker(p.Region.EndLine - 1, p.Region.EndColumn - 1, - p.BodyRegion.EndLine- 1, p.BodyRegion.EndColumn - 1, FoldType.MemberBody)); - } - - foreach (IEvent evt in c.Events) { - if (evt.BodyRegion != null) { - foldMarkers.Add(new FoldMarker(evt.Region.EndLine - 1, evt.Region.EndColumn - 1, - evt.BodyRegion.EndLine- 1, evt.BodyRegion.EndColumn - 1, FoldType.MemberBody)); - } - } - } - - if (cu.DokuComments != null) { - foreach (Comment c in cu.DokuComments) { - foldMarkers.Add(new FoldMarker(c.Region.BeginLine- 1, c.Region.BeginColumn, - c.Region.EndLine- 1, c.Region.EndColumn)); - } - } - - return foldMarkers; - } - } -} diff --git a/main/Unused/TextEditor/Gui/Editor/SharpDevelopTextAreaControl.cs b/main/Unused/TextEditor/Gui/Editor/SharpDevelopTextAreaControl.cs deleted file mode 100644 index eb07f182ef..0000000000 --- a/main/Unused/TextEditor/Gui/Editor/SharpDevelopTextAreaControl.cs +++ /dev/null @@ -1,251 +0,0 @@ -// SharpDevelopTextAreaControl.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.Drawing; -using System.Diagnostics; - -using MonoDevelop.Core; -using MonoDevelop.Core.AddIns; -using MonoDevelop.Core.Properties; -using MonoDevelop.TextEditor.Document; -using MonoDevelop.Core.Gui; -using MonoDevelop.DefaultEditor.Actions; -using MonoDevelop.TextEditor; -using MonoDevelop.TextEditor.Actions; -using MonoDevelop.Core; -using MonoDevelop.Core.Gui.Components; -using MonoDevelop.TextEditor.Gui.InsightWindow; -using MonoDevelop.TextEditor.Gui.CompletionWindow; - -using MonoDevelop.EditorBindings.FormattingStrategy; - -namespace MonoDevelop.DefaultEditor.Gui.Editor -{ - public class SharpDevelopTextAreaControl : TextEditorControl - { - readonly static string contextMenuPath = "/SharpDevelop/ViewContent/DefaultTextEditor/ContextMenu"; - readonly static string editActionsPath = "/AddIns/DefaultTextEditor/EditActions"; - readonly static string formatingStrategyPath = "/AddIns/DefaultTextEditor/Formater"; - - public SharpDevelopTextAreaControl() - { - Document.FoldingManager.FoldingStrategy = new MonoDevelop.DefaultEditor.Gui.Editor.ParserFoldingStrategy(); - GenerateEditActions(); - - TextAreaDragDropHandler dragDropHandler = new TextAreaDragDropHandler(); - Document.TextEditorProperties = new SharpDevelopTextEditorProperties(); - } - - protected override void InitializeTextAreaControl(TextAreaControl newControl) - { - base.InitializeTextAreaControl(newControl); - MenuService menuService = (MenuService)MonoDevelop.Core.ServiceManager.Services.GetService(typeof(MenuService)); - newControl.ContextMenu = menuService.CreateContextMenu(this, contextMenuPath); - newControl.TextArea.KeyEventHandler += new MonoDevelop.TextEditor.KeyEventHandler(HandleKeyPress); - newControl.SelectionManager.SelectionChanged += new EventHandler(SelectionChanged); - newControl.Caret.PositionChanged += new EventHandler(CaretPositionChanged); - } - - void CaretPositionChanged(object sender, EventArgs e) - { - IStatusBarService statusBarService = (IStatusBarService)MonoDevelop.Core.ServiceManager.Services.GetService(typeof(IStatusBarService)); - statusBarService.SetCaretPosition(ActiveTextAreaControl.TextArea.TextView.GetVisualColumn(ActiveTextAreaControl.Caret.Line, ActiveTextAreaControl.Caret.Column), ActiveTextAreaControl.Caret.Line, ActiveTextAreaControl.Caret.Column); - } - - bool lastStatus; - void SelectionChanged(object sender, EventArgs e) - { - if (ActiveTextAreaControl.SelectionManager.HasSomethingSelected != lastStatus) { - lastStatus = ActiveTextAreaControl.SelectionManager.HasSomethingSelected; - ((DefaultWorkbench)WorkbenchSingleton.Workbench).UpdateMenu(null, null); - } - } - - void GenerateEditActions() - { - try { - IEditAction[] actions = (IEditAction[])(AddInTreeSingleton.AddInTree.GetTreeNode(editActionsPath).BuildChildItems(this)).ToArray(typeof(IEditAction)); - - foreach (IEditAction action in actions) { - //foreach (Keys key in action.Keys) { - // editactions[key] = action; - //} - } - } catch (TreePathNotFoundException) { - Console.WriteLine(editActionsPath + " doesn't exists in the AddInTree"); - } - } - - - InsightWindow insightWindow = null; - bool HandleKeyPress(char ch) - { - CompletionWindow completionWindow; - - string fileName = FileName; - - switch (ch) { - case ' ': - //TextEditorProperties.AutoInsertTemplates - if (1 == 1) { - string word = GetWordBeforeCaret(); - if (word != null) { - CodeTemplateGroup templateGroup = CodeTemplateLoader.GetTemplateGroupPerFilename(FileName); - - if (templateGroup != null) { - foreach (CodeTemplate template in templateGroup.Templates) { - if (template.Shortcut == word) { - InsertTemplate(template); - return false; - } - } - } - } - } - goto case '.'; - case '<': - try { - completionWindow = new CompletionWindow(this, fileName, new CommentCompletionDataProvider()); - completionWindow.ShowCompletionWindow('<'); - } catch (Exception e) { - Console.WriteLine("EXCEPTION: " + e); - } - return false; - case '(': - try { - if (insightWindow == null ) {//|| insightWindow.IsDisposed) { - insightWindow = new InsightWindow(this, fileName); - } - - insightWindow.AddInsightDataProvider(new MethodInsightDataProvider()); - insightWindow.ShowInsightWindow(); - } catch (Exception e) { - Console.WriteLine("EXCEPTION: " + e); - } - return false; - case '[': - try { - if (insightWindow == null ) {//|| insightWindow.IsDisposed) { - insightWindow = new InsightWindow(this, fileName); - } - - insightWindow.AddInsightDataProvider(new IndexerInsightDataProvider()); - insightWindow.ShowInsightWindow(); - } catch (Exception e) { - Console.WriteLine("EXCEPTION: " + e); - } - return false; - case '.': - try { -// TextAreaPainter.IHaveTheFocusLock = true; - completionWindow = new CompletionWindow(this, fileName, new CodeCompletionDataProvider()); - completionWindow.ShowCompletionWindow(ch); -// TextAreaPainter.IHaveTheFocusLock = false; - } catch (Exception e) { - Console.WriteLine("EXCEPTION: " + e); - } - return false; - } - return false; - } - - - public string GetWordBeforeCaret() - { - int start = TextUtilities.FindPrevWordStart(Document, ActiveTextAreaControl.TextArea.Caret.Offset); - return Document.GetText(start, ActiveTextAreaControl.TextArea.Caret.Offset - start); - } - - public int DeleteWordBeforeCaret() - { - int start = TextUtilities.FindPrevWordStart(Document, ActiveTextAreaControl.TextArea.Caret.Offset); - Document.Remove(start, ActiveTextAreaControl.TextArea.Caret.Offset - start); - return start; - } - - /// <remarks> - /// This method inserts a code template at the current caret position - /// </remarks> - public void InsertTemplate(CodeTemplate template) - { - int newCaretOffset = ActiveTextAreaControl.TextArea.Caret.Offset; - string word = GetWordBeforeCaret().Trim(); - if (word.Length > 0) { - newCaretOffset = DeleteWordBeforeCaret(); - } - int finalCaretOffset = newCaretOffset; - int firstLine = Document.GetLineNumberForOffset(newCaretOffset); - - // save old properties, these properties cause strange effects, when not - // be turned off (like insert curly braces or other formatting stuff) - bool save1 = TextEditorProperties.AutoInsertCurlyBracket; - IndentStyle save2 = TextEditorProperties.IndentStyle; - TextEditorProperties.AutoInsertCurlyBracket = false; - TextEditorProperties.IndentStyle = IndentStyle.Auto; - - BeginUpdate(); - for (int i =0; i < template.Text.Length; ++i) { - switch (template.Text[i]) { - case '|': - finalCaretOffset = newCaretOffset; - break; - case '\r': - break; - case '\t': - new Tab().Execute(ActiveTextAreaControl.TextArea); - break; - case '\n': - ActiveTextAreaControl.TextArea.Caret.Position = Document.OffsetToPosition(newCaretOffset); - new Return().Execute(ActiveTextAreaControl.TextArea); - newCaretOffset = ActiveTextAreaControl.TextArea.Caret.Offset; - break; - default: - ActiveTextAreaControl.TextArea.InsertChar(template.Text[i]); - newCaretOffset = ActiveTextAreaControl.TextArea.Caret.Offset; - break; - } - } - EndUpdate(); - Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.LinesBetween, firstLine, Document.GetLineNumberForOffset(newCaretOffset))); - Document.CommitUpdate(); - ActiveTextAreaControl.TextArea.Caret.Position = Document.OffsetToPosition(finalCaretOffset); - - // restore old property settings - TextEditorProperties.AutoInsertCurlyBracket = save1; - TextEditorProperties.IndentStyle = save2; - } - - public void InitializeFormatter() - { - try { - IFormattingStrategy[] formater = (IFormattingStrategy[])(AddInTreeSingleton.AddInTree.GetTreeNode(formatingStrategyPath).BuildChildItems(this)).ToArray(typeof(IFormattingStrategy)); - //Console.WriteLine("SET FORMATTER : " + formater[0]); - if (formater != null && formater.Length > 0) { -// formater[0].Document = Document; - Document.FormattingStrategy = formater[0]; - } - } catch (TreePathNotFoundException) { - Console.WriteLine(formatingStrategyPath + " doesn't exists in the AddInTree"); - } - } - } -} diff --git a/main/Unused/TextEditor/Gui/Editor/SharpDevelopTextEditorProperties.cs b/main/Unused/TextEditor/Gui/Editor/SharpDevelopTextEditorProperties.cs deleted file mode 100644 index 1f718db3f3..0000000000 --- a/main/Unused/TextEditor/Gui/Editor/SharpDevelopTextEditorProperties.cs +++ /dev/null @@ -1,162 +0,0 @@ -using System; -using System.Text; -using System.Drawing; - -using MonoDevelop.Core.Properties; -using MonoDevelop.Core; -using MonoDevelop.Core.Gui.OptionPanels; - -using MonoDevelop.TextEditor; -using MonoDevelop.TextEditor.Document; - -using Pango; - -using MonoDevelop.EditorBindings.FormattingStrategy; -using MonoDevelop.EditorBindings.Properties; - -namespace MonoDevelop.DefaultEditor.Gui.Editor -{ - public class SharpDevelopTextEditorProperties : ITextEditorProperties - { - static SharpDevelopTextEditorProperties() - { - PropertyService propertyService = (PropertyService) ServiceManager.Services.GetService (typeof(PropertyService)); - IProperties properties2 = ((IProperties) propertyService.GetProperty("MonoDevelop.TextEditor.Document.Document.DefaultDocumentAggregatorProperties", new DefaultProperties())); - properties2.PropertyChanged += new PropertyEventHandler (CheckFontChange); - - FontContainer.DefaultFont = TextEditorProperties.Font; - } - - static void CheckFontChange(object sender, PropertyEventArgs e) - { - if (e.Key == "DefaultFont") - FontContainer.DefaultFont = TextEditorProperties.Font; - } - - public int TabIndent { - get { return TextEditorProperties.TabIndent; } - set { TextEditorProperties.TabIndent = value; } - } - - public IndentStyle IndentStyle { - get { return TextEditorProperties.IndentStyle; } - set { TextEditorProperties.IndentStyle = value; } - } - - public DocumentSelectionMode DocumentSelectionMode { - get { return TextEditorProperties.DocumentSelectionMode; } - set { TextEditorProperties.DocumentSelectionMode = value; } - } - - public bool AllowCaretBeyondEOL { - get { return TextEditorProperties.AllowCaretBeyondEOL; } - set { TextEditorProperties.AllowCaretBeyondEOL = value; } - } - - public bool ShowMatchingBracket { - get { return TextEditorProperties.ShowMatchingBracket; } - set { TextEditorProperties.ShowMatchingBracket = value; } - } - - public bool ShowLineNumbers { - get { return TextEditorProperties.ShowLineNumbers; } - set { TextEditorProperties.ShowLineNumbers = value; } - } - - public bool ShowSpaces { - get { return TextEditorProperties.ShowSpaces; } - set { TextEditorProperties.ShowSpaces = value; } - } - - public bool ShowTabs { - get { return TextEditorProperties.ShowTabs; } - set { TextEditorProperties.ShowTabs = value; } - } - - public bool ShowEOLMarker { - get { return TextEditorProperties.ShowEOLMarker; } - set { TextEditorProperties.ShowEOLMarker = value; } - } - - public bool ShowInvalidLines { - get { return TextEditorProperties.ShowInvalidLines; } - set { TextEditorProperties.ShowInvalidLines = value; } - } - - public bool IsIconBarVisible { - get { return TextEditorProperties.IsIconBarVisible; } - set { TextEditorProperties.IsIconBarVisible = value; } - } - - public bool EnableFolding { - get { return TextEditorProperties.EnableFolding; } - set { TextEditorProperties.EnableFolding = value; } - } - - public bool ShowHorizontalRuler { - get { return TextEditorProperties.ShowHorizontalRuler; } - set { TextEditorProperties.ShowHorizontalRuler = value; } - } - public bool ShowVerticalRuler { - get { return TextEditorProperties.ShowVerticalRuler; } - set { TextEditorProperties.ShowVerticalRuler = value; } - } - - public bool ConvertTabsToSpaces { - get { return TextEditorProperties.ConvertTabsToSpaces; } - set { TextEditorProperties.ConvertTabsToSpaces = value; } - } - - public bool UseAntiAliasedFont { - get { return TextEditorProperties.UseAntiAliasedFont; } - set { TextEditorProperties.UseAntiAliasedFont = value; } - } - - public bool CreateBackupCopy { - get { return TextEditorProperties.CreateBackupCopy; } - set { TextEditorProperties.CreateBackupCopy = value; } - } - - public bool MouseWheelScrollDown { - get { return TextEditorProperties.MouseWheelScrollDown; } - set { TextEditorProperties.MouseWheelScrollDown = value; } - } - - public bool HideMouseCursor { - get { return TextEditorProperties.HideMouseCursor; } - set { TextEditorProperties.HideMouseCursor = value; } - } - - public Encoding Encoding { - get { return TextEditorProperties.Encoding; } - set { TextEditorProperties.Encoding = value; } - } - - public int VerticalRulerRow { - get { return TextEditorProperties.VerticalRulerRow; } - set { TextEditorProperties.VerticalRulerRow = value; } - } - - public LineViewerStyle LineViewerStyle { - get { return TextEditorProperties.LineViewerStyle; } - set { TextEditorProperties.LineViewerStyle = value; } - } - - public string LineTerminator { - get { return TextEditorProperties.LineTerminator; } - set { TextEditorProperties.LineTerminator = value; } - } - - public bool AutoInsertCurlyBracket { - get { return TextEditorProperties.AutoInsertCurlyBracket; } - set { TextEditorProperties.AutoInsertCurlyBracket = value; } - } - - public FontDescription Font { - get { return TextEditorProperties.Font; } - set { - TextEditorProperties.Font = FontContainer.DefaultFont = value; - } - } - } -} diff --git a/main/Unused/TextEditor/Gui/Editor/TextEditorDisplayBinding.cs b/main/Unused/TextEditor/Gui/Editor/TextEditorDisplayBinding.cs deleted file mode 100644 index 0581728986..0000000000 --- a/main/Unused/TextEditor/Gui/Editor/TextEditorDisplayBinding.cs +++ /dev/null @@ -1,457 +0,0 @@ -// TextEditorDisplayBinding.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.IO; -using System.Drawing; -using System.Drawing.Printing; - -using MonoDevelop.Core.Gui; -using MonoDevelop.TextEditor; -using MonoDevelop.TextEditor.Document; -using MonoDevelop.Projects; -using MonoDevelop.Ide.Gui.Undo; - - -using MonoDevelop.Core.Properties; -using MonoDevelop.Core.AddIns; -using MonoDevelop.Core; -using MonoDevelop.Core; - -namespace MonoDevelop.DefaultEditor.Gui.Editor -{ - public class TextEditorDisplayBinding : IDisplayBinding - { - // load #D-specific syntax highlighting files here - // don't know if this could be solved better by new codons, - // but this will do - static TextEditorDisplayBinding() - { - PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService)); - - string modeDir = Path.Combine(propertyService.ConfigDirectory, "modes"); - if (!Directory.Exists(modeDir)) Directory.CreateDirectory(modeDir); - - HighlightingManager.Manager.AddSyntaxModeFileProvider(new FileSyntaxModeProvider(modeDir)); - } - - public virtual bool CanCreateContentForFile(string fileName) - { - return false; - } - - public virtual bool CanCreateContentForMimeType (string mimetype) - { - if (mimetype.StartsWith ("text")) return true; - return false; - } - - public virtual bool CanCreateContentForLanguage(string language) - { - return true; - } - - public virtual IViewContent CreateContentForFile(string fileName) - { - TextEditorDisplayBindingWrapper b2 = new TextEditorDisplayBindingWrapper(); - -#if GTK - // FIXME: GTKize -#else - b2.textAreaControl.Dock = DockStyle.Fill; -#endif - b2.Load(fileName); - b2.textAreaControl.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategyForFile(fileName); - b2.textAreaControl.Document.Language = HighlightingStrategyFactory.LanguageFromFile (fileName); - b2.textAreaControl.InitializeFormatter(); - return b2; - } - - public virtual IViewContent CreateContentForLanguage(string language, string content) - { - TextEditorDisplayBindingWrapper b2 = new TextEditorDisplayBindingWrapper(); - StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService)); - b2.textAreaControl.Document.TextContent = stringParserService.Parse(content); - b2.textAreaControl.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy(language); - Console.WriteLine (language); - b2.textAreaControl.Document.Language = language; - b2.textAreaControl.InitializeFormatter(); - return b2; - } - - public virtual IViewContent CreateContentForLanguage(string language, string content, string new_file_name) - { - TextEditorDisplayBindingWrapper b2 = new TextEditorDisplayBindingWrapper(); - StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService)); - b2.textAreaControl.Document.TextContent = stringParserService.Parse(content); - b2.textAreaControl.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy(language); - Console.WriteLine (language); - b2.textAreaControl.Document.Language = language; - b2.textAreaControl.FileName = new_file_name; - b2.textAreaControl.InitializeFormatter(); - return b2; - } - } - - public class TextEditorDisplayBindingWrapper : AbstractViewContent, IMementoCapable, IPrintable, IEditable, IPositionable, ITextEditorControlProvider, IParseInformationListener, IClipboardHandler, - IBookmarkOperations - { - public SharpDevelopTextAreaControl textAreaControl = new SharpDevelopTextAreaControl(); - - public TextEditorControl TextEditorControl { - get { - return textAreaControl; - } - } - - // KSL Start, New lines - FileSystemWatcher watcher; - bool wasChangedExternally = false; - // KSL End - - - public string Text { - get { - return textAreaControl.Document.TextContent; - } - set { - textAreaControl.Document.TextContent = value; - } - } - - public PrintDocument PrintDocument { - get { - return textAreaControl.PrintDocument; - } - } - - public IClipboardHandler ClipboardHandler { - get { - return this; - } - } - - public override Gtk.Widget Control { - get { - return textAreaControl; - } - } - - public override string TabPageText { - get { - return "${res:FormsDesigner.DesignTabPages.SourceTabPage}"; - } - } - - public void Undo() - { - this.textAreaControl.Undo(); - } - - public void Redo() - { - this.textAreaControl.Redo(); - } - - public TextEditorDisplayBindingWrapper() - { - textAreaControl.Document.DocumentChanged += new DocumentEventHandler(TextAreaChangedEvent); - textAreaControl.ActiveTextAreaControl.Caret.CaretModeChanged += new EventHandler(CaretModeChanged); -#if GTK - textAreaControl.FileNameChanged += new EventHandler(FileNameChangedEvent); -#else - textAreaControl.ActiveTextAreaControl.Enter += new EventHandler(CaretUpdate); - - // KSL Start, New lines - textAreaControl.FileNameChanged += new EventHandler(FileNameChangedEvent); - textAreaControl.GotFocus += new EventHandler(GotFocusEvent); - // KSL End -#endif - - - } - // KSL Start, new event handlers - - - void SetWatcher() - { - try { - if (this.watcher == null) { - this.watcher = new FileSystemWatcher(); - this.watcher.Changed += new FileSystemEventHandler(this.OnFileChangedEvent); - } - else { - this.watcher.EnableRaisingEvents = false; - } - this.watcher.Path = Path.GetDirectoryName(textAreaControl.FileName); - this.watcher.Filter = Path.GetFileName(textAreaControl.FileName); - this.watcher.NotifyFilter = NotifyFilters.LastWrite; - this.watcher.EnableRaisingEvents = true; - } catch (Exception) { - watcher = null; - } - } - - void FileNameChangedEvent(object sender, EventArgs e) - { - if (textAreaControl.FileName != null) { - SetWatcher(); - } else { - this.watcher = null; - } - } - - void GotFocusEvent(object sender, EventArgs e) - { - lock (this) { - if (wasChangedExternally) { - wasChangedExternally = false; -#if GTK - MessageService msgService = (MessageService) ServiceManager.Services.GetService(typeof(MessageService)); - if (msgService.AskQuestion ("The file " + textAreaControl.FileName + " has been changed externally to SharpDevelop.\nDo you want to reload it?")) { - Load(textAreaControl.FileName); - } -#else - if (MessageBox.Show("The file " + textAreaControl.FileName + " has been changed externally to SharpDevelop.\nDo you want to reload it?", - "SharpDevelop", - MessageBoxButtons.YesNo, - MessageBoxIcon.Question) == DialogResult.Yes) { - Load(textAreaControl.FileName); - } -#endif - } - } - } - - void OnFileChangedEvent(object sender, FileSystemEventArgs e) - { - lock (this) { - wasChangedExternally = true; - } - } - - // KSL End - - void TextAreaChangedEvent(object sender, DocumentEventArgs e) - { - IsDirty = true; - } - - public override void RedrawContent() - { - textAreaControl.OptionsChanged(); - } - - public override void Dispose() - { - textAreaControl.Dispose(); - } - - public override bool IsReadOnly { - get { - return textAreaControl.IsReadOnly; - } - } - - public override void Save(string fileName) - { - OnBeforeSave(EventArgs.Empty); - // KSL, Start new line - if (watcher != null) { - this.watcher.EnableRaisingEvents = false; - } - // KSL End - - textAreaControl.SaveFile(fileName); - ContentName = fileName; - IsDirty = false; - - // KSL, Start new lines - if (this.watcher != null) { - this.watcher.EnableRaisingEvents = true; - } - // KSL End - } - - public override void Load(string fileName) - { - textAreaControl.IsReadOnly = (File.GetAttributes(fileName) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly; - - textAreaControl.LoadFile(fileName); - ContentName = fileName; - IsDirty = false; - } - - public IXmlConvertable CreateMemento() - { - DefaultProperties properties = new DefaultProperties(); -// properties.SetProperty("Bookmarks", textAreaControl.Document.BookmarkManager.CreateMemento()); -// properties.SetProperty("CaretOffset", textAreaControl.Document.Caret.Offset); -// properties.SetProperty("VisibleLine", textAreaControl.FirstVisibleColumn); -// properties.SetProperty("VisibleColumn", textAreaControl.FirstVisibleRow); -//// properties.SetProperty("Properties", textAreaControl.Properties); -// properties.SetProperty("HighlightingLanguage", textAreaControl.Document.HighlightingStrategy.Name); - return properties; - } - - public void SetMemento(IXmlConvertable memento) - { -// IProperties properties = (IProperties)memento; -// BookmarkManagerMemento bookmarkMemento = (BookmarkManagerMemento)properties.GetProperty("Bookmarks", textAreaControl.Document.BookmarkManager.CreateMemento()); -// bookmarkMemento.CheckMemento(textAreaControl.Document); -// textAreaControl.Document.BookmarkManager.SetMemento(bookmarkMemento); -// textAreaControl.Document.Caret.Offset = Math.Min(textAreaControl.Document.TextLength, Math.Max(0, properties.GetProperty("CaretOffset", textAreaControl.Document.Caret.Offset))); -// textAreaControl.Document.SetDesiredColumn(); -// textAreaControl.FirstVisibleColumn = Math.Min(textAreaControl.Document.TotalNumberOfLines, Math.Max(0, properties.GetProperty("VisibleLine", textAreaControl.FirstVisibleColumn))); -// textAreaControl.FirstVisibleRow = Math.Max(0, properties.GetProperty("VisibleColumn", textAreaControl.FirstVisibleRow)); -//// textAreaControl.Document.Properties = (IProperties)properties.GetProperty("Properties", textAreaControl.Properties); -// IHighlightingStrategy highlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy(properties.GetProperty("HighlightingLanguage", textAreaControl.Document.HighlightingStrategy.Name)); -// -// if (highlightingStrategy != null) { -// textAreaControl.Document.HighlightingStrategy = highlightingStrategy; -// } -// -// // insane check for cursor position, may be required for document reload. -// int lineNr = textAreaControl.Document.GetLineNumberForOffset(textAreaControl.Document.Caret.Offset); -// LineSegment lineSegment = textAreaControl.Document.GetLineSegment(lineNr); -// textAreaControl.Document.Caret.Offset = Math.Min(lineSegment.Offset + lineSegment.Length, textAreaControl.Document.Caret.Offset); -// -// textAreaControl.OptionsChanged(); -// textAreaControl.Refresh(); - } - - void CaretUpdate(object sender, EventArgs e) - { - CaretChanged(null, null); - CaretModeChanged(null, null); - } - - void CaretChanged(object sender, EventArgs e) - { - Point pos = textAreaControl.Document.OffsetToPosition(textAreaControl.ActiveTextAreaControl.Caret.Offset); - LineSegment line = textAreaControl.Document.GetLineSegment(pos.Y); - IStatusBarService statusBarService = (IStatusBarService)MonoDevelop.Core.ServiceManager.Services.GetService(typeof(IStatusBarService)); - statusBarService.SetCaretPosition(pos.X + 1, pos.Y + 1, textAreaControl.ActiveTextAreaControl.Caret.Offset - line.Offset + 1); - } - - void CaretModeChanged(object sender, EventArgs e) - { - IStatusBarService statusBarService = (IStatusBarService)MonoDevelop.Core.ServiceManager.Services.GetService(typeof(IStatusBarService)); - statusBarService.SetInsertMode(textAreaControl.ActiveTextAreaControl.Caret.CaretMode == CaretMode.InsertMode); - } - - public override string ContentName { - set { - if (Path.GetExtension(ContentName) != Path.GetExtension(value)) { - if (textAreaControl.Document.HighlightingStrategy != null) { - textAreaControl.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategyForFile(value); - textAreaControl.Refresh(); - } - } - base.ContentName = value; - } - } - - public void JumpTo(int line, int column) - { - textAreaControl.ActiveTextAreaControl.JumpTo(line, column); - } - delegate void VoidDelegate(AbstractMargin margin); - - public void ParseInformationUpdated(IParseInformation parseInfo) - { - if (textAreaControl.TextEditorProperties.EnableFolding) { -#if GTK - textAreaControl.Document.FoldingManager.UpdateFoldings(ContentName, parseInfo); - //textAreaControl.ActiveTextAreaControl.TextArea.Invoke(new VoidDelegate(textAreaControl.ActiveTextAreaControl.TextArea.Refresh), new object[] { textAreaControl.ActiveTextAreaControl.TextArea.FoldMargin}); - //FIXME: Should the above line compile or not? -#else - textAreaControl.Document.FoldingManager.UpdateFoldings(ContentName, parseInfo); - textAreaControl.ActiveTextAreaControl.TextArea.Invoke(new VoidDelegate(textAreaControl.ActiveTextAreaControl.TextArea.Refresh), new object[] { textAreaControl.ActiveTextAreaControl.TextArea.FoldMargin}); -#endif - } - } - - -#region MonoDevelop.Core.Gui.IClipboardHandler interface implementation - public bool EnableCut { - get { - return textAreaControl.ActiveTextAreaControl.TextArea.ClipboardHandler.EnableCut; - } - } - - public bool EnableCopy { - get { - return textAreaControl.ActiveTextAreaControl.TextArea.ClipboardHandler.EnableCopy; - } - } - - public bool EnablePaste { - get { - return textAreaControl.ActiveTextAreaControl.TextArea.ClipboardHandler.EnablePaste; - } - } - - public bool EnableDelete { - get { - return textAreaControl.ActiveTextAreaControl.TextArea.ClipboardHandler.EnableDelete; - } - } - - public bool EnableSelectAll { - get { - return textAreaControl.ActiveTextAreaControl.TextArea.ClipboardHandler.EnableSelectAll; - } - } - - public void SelectAll(object sender, System.EventArgs e) - { - textAreaControl.ActiveTextAreaControl.TextArea.ClipboardHandler.SelectAll(sender, e); - } - - public void Delete(object sender, System.EventArgs e) - { - textAreaControl.ActiveTextAreaControl.TextArea.ClipboardHandler.Delete(sender, e); - } - - public void Paste(object sender, System.EventArgs e) - { - textAreaControl.ActiveTextAreaControl.TextArea.ClipboardHandler.Paste(sender, e); - } - - public void Copy(object sender, System.EventArgs e) - { - textAreaControl.ActiveTextAreaControl.TextArea.ClipboardHandler.Copy(sender, e); - } - - public void Cut(object sender, System.EventArgs e) - { - textAreaControl.ActiveTextAreaControl.TextArea.ClipboardHandler.Cut(sender, e); - } -#endregion - -#region IBookmarkOperations - void IBookmarkOperations.ToggleBookmark () { new MonoDevelop.TextEditor.Actions.ToggleBookmark ().Execute (TextEditorControl.ActiveTextAreaControl.TextArea); } - void IBookmarkOperations.PrevBookmark () { new MonoDevelop.TextEditor.Actions.GotoPrevBookmark ().Execute (TextEditorControl.ActiveTextAreaControl.TextArea); } - void IBookmarkOperations.NextBookmark () { new MonoDevelop.TextEditor.Actions.GotoNextBookmark ().Execute (TextEditorControl.ActiveTextAreaControl.TextArea); } - void IBookmarkOperations.ClearBookmarks () { new MonoDevelop.TextEditor.Actions.ClearAllBookmarks ().Execute (TextEditorControl.ActiveTextAreaControl.TextArea); } -#endregion - } -} diff --git a/main/Unused/TextEditor/Makefile.am b/main/Unused/TextEditor/Makefile.am deleted file mode 100644 index 5529d490b4..0000000000 --- a/main/Unused/TextEditor/Makefile.am +++ /dev/null @@ -1,60 +0,0 @@ -SDDIR=../../../SharpDevelop/src/Main/Core -FILES = \ -./Gui/Editor/ParserFoldingStrategy.cs \ -./Gui/Editor/SharpDevelopTextEditorProperties.cs \ -./Gui/Editor/SharpDevelopTextAreaControl.cs \ -./Gui/Editor/InsightWindow/IndexerInsightDataProvider.cs \ -./Gui/Editor/InsightWindow/MethodInsightDataProvider.cs \ -./Gui/Editor/CompletionWindow/TemplateCompletionDataProvider.cs \ -./Gui/Editor/CompletionWindow/CodeCompletionDataProvider.cs \ -./Gui/Editor/CompletionWindow/CodeCompletionData.cs \ -./Gui/Editor/CompletionWindow/CommentCompletionDataProvider.cs \ -./Gui/Editor/ErrorDrawer.cs \ -./Gui/Editor/ITextAreaControlProvider.cs \ -./Gui/Editor/TextEditorDisplayBinding.cs \ -./Gui/Dialogs/ExportProjectToHtmlDialog.cs \ -./Gui/Dialogs/SortOptionsDialog.cs \ -./Gui/Dialogs/ReplaceInFilesDialog.cs \ -./Gui/Dialogs/ReplaceDialog.cs \ -./Conditions/TextContentCondition.cs \ -./Actions.cs \ -./Search/DocumentIterator/ProvidedDocumentInformation.cs \ -./Search/DocumentIterator/DirectoryDocumentIterator.cs \ -./Search/DocumentIterator/AllOpenDocumentIterator.cs \ -./Search/DocumentIterator/IDocumentIterator.cs \ -./Search/DocumentIterator/ReverseDocumentIterator.cs \ -./Search/DocumentIterator/WholeProjectDocumentIterator.cs \ -./Search/DocumentIterator/CurrentDocumentIterator.cs \ -./Search/SearchReplaceManager.cs \ -./Search/DefaultFind.cs \ -./Search/SearchResult/DefaultSearchResult.cs \ -./Search/SearchResult/ISearchResult.cs \ -./Search/SearchReplaceInFilesManager.cs \ -./Search/SearchReplaceUtilities.cs \ -./Search/IFind.cs \ -./Search/TextIterator/ITextIteratorBuilder.cs \ -./Search/TextIterator/ForwardTextIteratorBuilder.cs \ -./Search/TextIterator/ForwardTextIterator.cs \ -./AssemblyInfo.cs \ -./XmlFormattingStrategy.cs - -DLL=../../../../build/bin/MonoDevelop.DefaultTexteditor.dll - -all: $(DLL) - -$(DLL): $(FILES) ../../../../data/resources/glade/texteditoraddin.glade - $(CSC) $(CSC_FLAGS) /out:$(DLL) /target:library /r:System.Drawing \ - /r:../../../../build/bin/MonoDevelop.Core.dll \ - /r:../../../../build/bin/MonoDevelop.Base.dll \ - /r:../../../../build/bin/MonoDevelop.SourceEditor.dll \ - /r:System.DirectoryServices /r:pango-sharp /r:glade-sharp \ - /r:../../../../build/bin/MonoDevelop.Gui.Widgets.dll \ - /r:glib-sharp \ - /resource:../../../../data/resources/glade/texteditoraddin.glade,texteditoraddin.glade \ - /define:GTK /r:gtk-sharp /r:gdk-sharp /r:gnome-sharp\ - $(FILES) - -CLEANFILES=$(DLL) $(DLL).mdb - -EXTRA_DIST = $(FILES) - diff --git a/main/Unused/TextEditor/Search/DefaultFind.cs b/main/Unused/TextEditor/Search/DefaultFind.cs deleted file mode 100644 index 441e227683..0000000000 --- a/main/Unused/TextEditor/Search/DefaultFind.cs +++ /dev/null @@ -1,139 +0,0 @@ -// DefaultFind.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using System; -using System.Collections; -using System.Diagnostics; - -using MonoDevelop.Core.Gui; -using MonoDevelop.EditorBindings.Search; - -namespace MonoDevelop.TextEditor.Document -{ - public class DefaultFind : IFind - { - ISearchStrategy searchStrategy = null; - IDocumentIterator documentIterator = null; - ITextIterator textIterator = null; - ITextIteratorBuilder textIteratorBuilder = null; - ProvidedDocumentInformation info = null; - - public ProvidedDocumentInformation CurrentDocumentInformation { - get { - return info; - } - } - - public ITextIteratorBuilder TextIteratorBuilder { - get { - return textIteratorBuilder; - } - set { - textIteratorBuilder = value; - } - } - - public ITextIterator TextIterator { - get { - return textIterator; - } - } - - public ISearchStrategy SearchStrategy { - get { - return searchStrategy; - } - set { - searchStrategy = value; - } - } - - public IDocumentIterator DocumentIterator { - get { - return documentIterator; - } - set { - documentIterator = value; - } - } - - ISearchResult CreateNamedSearchResult(SearchResult pos) - { - if (info == null || pos == null) - return null; - - DefaultSearchResult res = new DefaultSearchResult (pos.Position, pos.Length); - res.ProvidedDocumentInformation = info; - return res; - } - - public void Reset() - { - documentIterator.Reset(); - textIterator = null; - } - - public void Replace(int offset, int length, string pattern) - { - if (CurrentDocumentInformation != null && TextIterator != null) { - CurrentDocumentInformation.Replace(offset, length, pattern); - CurrentDocumentInformation.SaveBuffer(); - TextIterator.InformReplace(offset, length, pattern.Length); - } - } - - public ISearchResult FindNext(SearchOptions options) - { - // insanity check - Debug.Assert(searchStrategy != null); - Debug.Assert(documentIterator != null); - Debug.Assert(textIteratorBuilder != null); - Debug.Assert(options != null); - - if (info != null && textIterator != null && documentIterator.CurrentFileName != null) { - if (info.FileName != documentIterator.CurrentFileName) { // create new iterator, if document changed - info = documentIterator.Current; - textIterator = textIteratorBuilder.BuildTextIterator(info); - } else { // old document -> initialize iterator position to caret pos - textIterator.Position = info.CurrentOffset; - } - - ISearchResult result = CreateNamedSearchResult(searchStrategy.FindNext(textIterator, options)); - if (result != null) { - info.CurrentOffset = textIterator.Position; - return result; - } - } - - // not found or first start -> move forward to the next document - if (documentIterator.MoveForward()) { - info = documentIterator.Current; - // document is valid for searching -> set iterator & fileName - if (info != null && info.TextBuffer != null && info.EndOffset >= 0 && info.EndOffset < info.TextBuffer.Length) { - textIterator = textIteratorBuilder.BuildTextIterator(info); - } else { - textIterator = null; - } - - return FindNext(options); - } - return null; - } - } -} diff --git a/main/Unused/TextEditor/Search/DocumentIterator/AllOpenDocumentIterator.cs b/main/Unused/TextEditor/Search/DocumentIterator/AllOpenDocumentIterator.cs deleted file mode 100644 index 682812a49c..0000000000 --- a/main/Unused/TextEditor/Search/DocumentIterator/AllOpenDocumentIterator.cs +++ /dev/null @@ -1,124 +0,0 @@ -// AllOpenDocumentIterator.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; - -using MonoDevelop.Core.Gui; -using MonoDevelop.DefaultEditor.Gui.Editor; -using MonoDevelop.TextEditor; - -namespace MonoDevelop.TextEditor.Document -{ - public class AllOpenDocumentIterator : IDocumentIterator - { - int startIndex = -1; - bool resetted = true; - - public AllOpenDocumentIterator() - { - Reset(); - } - - public string CurrentFileName { - get { - if (!SearchReplaceUtilities.IsTextAreaSelected) { - return null; - } - - if (IdeApp.Workbench.ActiveDocument.FileName == null) { - return IdeApp.Workbench.ActiveDocument.Window.ViewContent.UntitledName; - } - - return IdeApp.Workbench.ActiveDocument.FileName; - } - } - - public ProvidedDocumentInformation Current { - get { - if (!SearchReplaceUtilities.IsTextAreaSelected) { - return null; - } - IDocument document = (((ITextEditorControlProvider)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).TextEditorControl).Document; - return new ProvidedDocumentInformation(document, - CurrentFileName); - } - } - - int GetCurIndex() - { - for (int i = 0; i < IdeApp.Workbench.Documents.Count; ++i) { - if (IdeApp.Workbench.ActiveDocument == IdeApp.Workbench.Documents [i]) { - return i; - } - } - return -1; - } - - public bool MoveForward() - { - int curIndex = GetCurIndex(); - if (curIndex < 0) { - return false; - } - - if (resetted) { - resetted = false; - return true; - } - - int nextIndex = (curIndex + 1) % IdeApp.Workbench.Documents.Count; - if (nextIndex == startIndex) { - return false; - } - IdeApp.Workbench.Documents [nextIndex].Select (); - return true; - } - - public bool MoveBackward() - { - int curIndex = GetCurIndex(); - if (curIndex < 0) { - return false; - } - if (resetted) { - resetted = false; - return true; - } - - if (curIndex == 0) { - curIndex = IdeApp.Workbench.Documents.Count - 1; - } - - if (curIndex > 0) { - --curIndex; - IdeApp.Workbench.Documents [curIndex].Select (); - return true; - } - return false; - } - - public void Reset() - { - startIndex = GetCurIndex(); - resetted = true; - } - } -} diff --git a/main/Unused/TextEditor/Search/DocumentIterator/CurrentDocumentIterator.cs b/main/Unused/TextEditor/Search/DocumentIterator/CurrentDocumentIterator.cs deleted file mode 100644 index 570a78f82c..0000000000 --- a/main/Unused/TextEditor/Search/DocumentIterator/CurrentDocumentIterator.cs +++ /dev/null @@ -1,86 +0,0 @@ -// CurrentDocumentIterator.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; - -using MonoDevelop.Core.Gui; -using MonoDevelop.TextEditor; -using MonoDevelop.DefaultEditor.Gui.Editor; - -namespace MonoDevelop.TextEditor.Document -{ - public class CurrentDocumentIterator : IDocumentIterator - { - bool didRead = false; - IDocument curDocument = null; - - public CurrentDocumentIterator() - { - Reset(); - } - - public string CurrentFileName { - get { - if (!SearchReplaceUtilities.IsTextAreaSelected) { - return null; - } - if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.ContentName == null) { - return WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.UntitledName; - } - return WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.ContentName; - } - } - - public ProvidedDocumentInformation Current { - get { - if (!SearchReplaceUtilities.IsTextAreaSelected) { - return null; - } - curDocument = (((ITextEditorControlProvider)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).TextEditorControl).Document; - return new ProvidedDocumentInformation(curDocument, - CurrentFileName); - } - } - - public bool MoveForward() - { - if (!SearchReplaceUtilities.IsTextAreaSelected) { - return false; - } - if (didRead) { - return false; - } - didRead = true; - - return true; - } - - public bool MoveBackward() - { - return MoveForward(); - } - - public void Reset() - { - didRead = false; - } - } -} diff --git a/main/Unused/TextEditor/Search/DocumentIterator/DirectoryDocumentIterator.cs b/main/Unused/TextEditor/Search/DocumentIterator/DirectoryDocumentIterator.cs deleted file mode 100644 index 12a297f1c7..0000000000 --- a/main/Unused/TextEditor/Search/DocumentIterator/DirectoryDocumentIterator.cs +++ /dev/null @@ -1,121 +0,0 @@ -// DirectoryDocumentIterator.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; - -using MonoDevelop.Core.Gui; -using MonoDevelop.Projects; -using MonoDevelop.DefaultEditor.Gui.Editor; -using MonoDevelop.Core; -using MonoDevelop.Core; -using MonoDevelop.TextEditor; - -namespace MonoDevelop.TextEditor.Document -{ - public class DirectoryDocumentIterator : IDocumentIterator - { - string searchDirectory; - string fileMask; - bool searchSubdirectories; - - StringCollection files = null; - int curIndex = -1; - - public DirectoryDocumentIterator(string searchDirectory, string fileMask, bool searchSubdirectories) - { - this.searchDirectory = searchDirectory; - this.fileMask = fileMask; - this.searchSubdirectories = searchSubdirectories; - - Reset(); - } - - public string CurrentFileName { - get { - if (curIndex < 0 || curIndex >= files.Count) { - return null; - } - - return files[curIndex].ToString();; - } - } - - public ProvidedDocumentInformation Current { - get { - if (curIndex < 0 || curIndex >= files.Count) { - return null; - } - if (!File.Exists(files[curIndex].ToString())) { - ++curIndex; - return Current; - } - IDocument document; - string fileName = files[curIndex].ToString(); - foreach (Document doc in IdeApp.Workbench.Documents) { - // WINDOWS DEPENDENCY : ToUpper - if (doc.FileName != null && - doc.FileName.ContentName.ToUpper() == fileName.ToUpper()) { - document = ((ITextEditorControlProvider)content).TextEditorControl.Document; - return new ProvidedDocumentInformation(document, - fileName); - } - } - ITextBufferStrategy strategy = null; - try { - strategy = StringTextBufferStrategy.CreateTextBufferFromFile(fileName); - } catch (Exception) { - TaskService taskService = (TaskService)MonoDevelop.Core.ServiceManager.Services.GetService(typeof(TaskService)); - taskService.Tasks.Add(new Task(String.Empty, "can't access " + fileName, -1, -1)); - return null; - } - return new ProvidedDocumentInformation(strategy, - fileName, - 0); - } - } - - public bool MoveForward() - { - if (curIndex == -1) { - FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService)); - files = fileUtilityService.SearchDirectory(this.searchDirectory, this.fileMask, this.searchSubdirectories); - } - return ++curIndex < files.Count; - } - - public bool MoveBackward() - { - if (curIndex == -1) { - curIndex = files.Count - 1; - return true; - } - return --curIndex >= -1; - } - - - public void Reset() - { - curIndex = -1; - } - } -} diff --git a/main/Unused/TextEditor/Search/DocumentIterator/IDocumentIterator.cs b/main/Unused/TextEditor/Search/DocumentIterator/IDocumentIterator.cs deleted file mode 100644 index 46acb991de..0000000000 --- a/main/Unused/TextEditor/Search/DocumentIterator/IDocumentIterator.cs +++ /dev/null @@ -1,67 +0,0 @@ -// IDocumentIterator.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// Represents a bi-directional iterator which could move froward/backward - /// in a document queue. Note that after move forward is called - /// move backward needn't to function correctly either move forward or move - /// backward is called but they're not mixed. After a reset the move operation - /// can be switched. - /// </summary> - public interface IDocumentIterator - { - /// <value> - /// Returns the current ProvidedDocumentInformation. This method - /// usually creates a new ProvidedDocumentInformation object which can - /// be time consuming - /// </value> - ProvidedDocumentInformation Current { - get; - } - - /// <value> - /// Returns the file name of the current provided document information. This - /// property usually is not time consuming - /// </value> - string CurrentFileName { - get; - } - - /// <remarks> - /// Moves the iterator one document forward. - /// </remarks> - bool MoveForward(); - - /// <remarks> - /// Moves the iterator one document backward. - /// </remarks> - bool MoveBackward(); - - /// <remarks> - /// Resets the iterator to the start position. - /// </remarks> - void Reset(); - } -} diff --git a/main/Unused/TextEditor/Search/DocumentIterator/ProvidedDocumentInformation.cs b/main/Unused/TextEditor/Search/DocumentIterator/ProvidedDocumentInformation.cs deleted file mode 100644 index 6faad7c363..0000000000 --- a/main/Unused/TextEditor/Search/DocumentIterator/ProvidedDocumentInformation.cs +++ /dev/null @@ -1,123 +0,0 @@ -// ProvidedDocumentInformation.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.IO; -using System.Collections; - -using MonoDevelop.Core.Gui; - -namespace MonoDevelop.TextEditor.Document -{ - public class ProvidedDocumentInformation - { - IDocument document; - ITextBufferStrategy textBuffer; - string fileName; - int currentOffset; - - public ITextBufferStrategy TextBuffer { - get { - return textBuffer; - } - set { - textBuffer = value; - } - } - - public string FileName { - get { - return fileName; - } - } - - public int CurrentOffset { - get { -// if (document != null) { -// return document.Caret.Offset; -// } - return currentOffset; - } - set { -// if (document != null) { -// document.Caret.Offset = value; -// } else { - currentOffset = value; -// } - } - } - - public int EndOffset { - get { - if (document != null) { - return SearchReplaceUtilities.CalcCurrentOffset(document); - } - return currentOffset; - } - } - - public void Replace(int offset, int length, string pattern) - { - if (document != null) { - document.Replace(offset, length, pattern); - } else { - textBuffer.Replace(offset, length, pattern); - } - - if (offset <= CurrentOffset) { - CurrentOffset = CurrentOffset - length + pattern.Length; - } - } - - public void SaveBuffer() - { - if (document != null) { - - } else { - StreamWriter streamWriter = File.CreateText(this.fileName); - streamWriter.Write(textBuffer.GetText(0, textBuffer.Length)); - streamWriter.Close(); - } - } - - public IDocument CreateDocument() - { - if (document != null) { - return document; - } - return new DocumentFactory().CreateFromFile(fileName); - } - - public ProvidedDocumentInformation(IDocument document, string fileName) - { - this.document = document; - this.textBuffer = document.TextBufferStrategy; - this.fileName = fileName; -// this.currentOffset = document.Caret.Offset; - } - - public ProvidedDocumentInformation(ITextBufferStrategy textBuffer, string fileName, int currentOffset) - { - this.textBuffer = textBuffer; - this.fileName = fileName; - this.currentOffset = currentOffset; - } - } -} diff --git a/main/Unused/TextEditor/Search/DocumentIterator/ReverseDocumentIterator.cs b/main/Unused/TextEditor/Search/DocumentIterator/ReverseDocumentIterator.cs deleted file mode 100644 index df18d90104..0000000000 --- a/main/Unused/TextEditor/Search/DocumentIterator/ReverseDocumentIterator.cs +++ /dev/null @@ -1,66 +0,0 @@ -// ReverseDocumentIterator.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// Represents a bi-directional iterator which could move froward/backward - /// in a document queue. - /// </summary> - public class ReverseDocumentIterator : IDocumentIterator - { - IDocumentIterator documentIterator; - - public string CurrentFileName { - get { - return documentIterator.CurrentFileName; - } - } - - public ProvidedDocumentInformation Current { - get { - return documentIterator.Current; - } - } - - public ReverseDocumentIterator(IDocumentIterator documentIterator) - { - this.documentIterator = documentIterator; - } - - public bool MoveForward() - { - return documentIterator.MoveBackward(); - } - - public bool MoveBackward() - { - return documentIterator.MoveBackward(); - } - - public void Reset() - { - documentIterator.Reset(); - } - } -} diff --git a/main/Unused/TextEditor/Search/DocumentIterator/WholeProjectDocumentIterator.cs b/main/Unused/TextEditor/Search/DocumentIterator/WholeProjectDocumentIterator.cs deleted file mode 100644 index 09336e02eb..0000000000 --- a/main/Unused/TextEditor/Search/DocumentIterator/WholeProjectDocumentIterator.cs +++ /dev/null @@ -1,135 +0,0 @@ -// WholeProjectDocumentIterator.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.IO; - -using MonoDevelop.Core.Gui; -using MonoDevelop.Projects; -using MonoDevelop.DefaultEditor.Gui.Editor; -using MonoDevelop.Core; -using MonoDevelop.Core; -using MonoDevelop.TextEditor; - -namespace MonoDevelop.TextEditor.Document -{ - public class WholeProjectDocumentIterator : IDocumentIterator - { - ArrayList files = new ArrayList(); - int curIndex = -1; - - public WholeProjectDocumentIterator() - { - Reset(); - } - - public string CurrentFileName { - get { - if (curIndex < 0 || curIndex >= files.Count) { - return null; - } - - return files[curIndex].ToString();; - } - } - - public ProvidedDocumentInformation Current { - get { - if (curIndex < 0 || curIndex >= files.Count) { - return null; - } - if (!File.Exists(files[curIndex].ToString())) { - ++curIndex; - return Current; - } - IDocument document; - string fileName = files[curIndex].ToString(); - foreach (Document doc in IdeApp.Workbench.Documents) { - // WINDOWS DEPENDENCY : ToUpper - if (doc.FileName != null && - doc.FileName.ContentName.ToUpper() == fileName.ToUpper()) { - document = (((ITextEditorControlProvider)content).TextEditorControl).Document; - return new ProvidedDocumentInformation(document, - fileName); - } - } - ITextBufferStrategy strategy = null; - try { - strategy = StringTextBufferStrategy.CreateTextBufferFromFile(fileName); - } catch (Exception) { - TaskService taskService = (TaskService)MonoDevelop.Core.ServiceManager.Services.GetService(typeof(TaskService)); - taskService.Tasks.Add(new Task(String.Empty, "can't access " + fileName, -1, -1)); - return null; - } - return new ProvidedDocumentInformation(strategy, - fileName, - 0); - } - } - - public bool MoveForward() - { - return ++curIndex < files.Count; - } - - public bool MoveBackward() - { - if (curIndex == -1) { - curIndex = files.Count - 1; - return true; - } - return --curIndex >= -1; - } - - - void AddFiles(IProject project) - { - foreach (ProjectFile file in project.ProjectFiles) { - if (file.BuildAction == BuildAction.Compile && - file.Subtype == Subtype.Code) { - files.Add(file.Name); - } - } - } - - void AddFiles(Combine combine) - { - foreach (CombineEntry entry in combine.Entries) { - if (entry is ProjectCombineEntry) { - AddFiles(((ProjectCombineEntry)entry).Project); - } else { - AddFiles(((CombineCombineEntry)entry).Combine); - } - } - } - - public void Reset() - { - files.Clear(); - IProjectService projectService = (IProjectService)MonoDevelop.Core.ServiceManager.Services.GetService(typeof(IProjectService)); - if (projectService.CurrentOpenCombine != null) { - AddFiles(projectService.CurrentOpenCombine); - } - - curIndex = -1; - } - } -} diff --git a/main/Unused/TextEditor/Search/IFind.cs b/main/Unused/TextEditor/Search/IFind.cs deleted file mode 100644 index 7436bfbbd8..0000000000 --- a/main/Unused/TextEditor/Search/IFind.cs +++ /dev/null @@ -1,89 +0,0 @@ -// IFind.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.Diagnostics; - -using MonoDevelop.Core.Gui; -using MonoDevelop.EditorBindings.Search; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// The basic interface for search operations in a document. - /// </summary> - public interface IFind - { - /// <value> - /// An object that implements a search algorithm. - /// </value> - ISearchStrategy SearchStrategy { - get; - set; - } - - /// <value> - /// Gets the current document information - /// </value> - ProvidedDocumentInformation CurrentDocumentInformation { - get; - } - - /// <value> - /// An object that provides a document loading approach. - /// </value> - IDocumentIterator DocumentIterator { - get; - set; - } - - /// <value> - /// The text iterator builder which builds ITextIterator objects - /// for the find. - /// </value> - ITextIteratorBuilder TextIteratorBuilder { - get; - set; - } - - /// <remarks> - /// Does a replace in the current document information. This - /// is the only method which should be used for doing replacements - /// in a searched document. - /// </remarks> - void Replace(int offset, int length, string pattern); - - /// <remarks> - /// Finds next pattern. - /// <remarks> - /// <returns> - /// null if the pattern wasn't found. If it returns null the current document - /// information will be null too otherwise it will point to the document in which - /// the search pattern was found. - /// </returns> - ISearchResult FindNext(SearchOptions options); - - /// <remarks> - /// Resets the find object to the original state. - /// </remarks> - void Reset(); - } -} diff --git a/main/Unused/TextEditor/Search/SearchReplaceInFilesManager.cs b/main/Unused/TextEditor/Search/SearchReplaceInFilesManager.cs deleted file mode 100644 index 1ae213acca..0000000000 --- a/main/Unused/TextEditor/Search/SearchReplaceInFilesManager.cs +++ /dev/null @@ -1,159 +0,0 @@ -// SearchReplaceInFilesManager.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.Diagnostics; - -using MonoDevelop.Core.Gui; - -using MonoDevelop.Core; -using MonoDevelop.Core; -using MonoDevelop.Core.Gui.Dialogs; -using MonoDevelop.DefaultEditor.Gui.Editor; -using MonoDevelop.TextEditor; -using MonoDevelop.Ide.Gui.Pads; -using MonoDevelop.EditorBindings.Search; - -namespace MonoDevelop.TextEditor.Document -{ - public class SearchReplaceInFilesManager - { - static IFind find = new DefaultFind(); - static SearchOptions searchOptions = new SearchOptions("SharpDevelop.SearchAndReplace.SearchAndReplaceInFilesProperties"); - - static PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService)); - - static string currentFileName = String.Empty; - static IDocument currentDocument = null; - - public static SearchOptions SearchOptions { - get { - return searchOptions; - } - } - - static SearchReplaceInFilesManager() - { - find.TextIteratorBuilder = new ForwardTextIteratorBuilder(); - searchOptions.SearchStrategyTypeChanged += new EventHandler(InitializeSearchStrategy); - searchOptions.DocumentIteratorTypeChanged += new EventHandler(InitializeDocumentIterator); - InitializeDocumentIterator(null, null); - InitializeSearchStrategy(null, null); - } - - static void InitializeSearchStrategy(object sender, EventArgs e) - { - find.SearchStrategy = SearchReplaceUtilities.CreateSearchStrategy(SearchOptions.SearchStrategyType); - } - - static void InitializeDocumentIterator(object sender, EventArgs e) - { - find.DocumentIterator = SearchReplaceUtilities.CreateDocumentIterator(SearchOptions.DocumentIteratorType); - } - - /// <remarks> - /// This method displays the search result in the task view - /// </remarks> - static void DisplaySearchResult(ISearchResult result) - { - TaskService taskService = (TaskService)MonoDevelop.Core.ServiceManager.Services.GetService(typeof(TaskService)); - - // check if the current document is up to date - if (currentFileName != result.FileName) { - // if not, create new document - currentFileName = result.FileName; - currentDocument = result.CreateDocument(); - } - - // get line out of the document and display it in the task list - int lineNumber = currentDocument.GetLineNumberForOffset(Math.Min(currentDocument.TextLength, result.Offset)); - LineSegment line = currentDocument.GetLineSegment(lineNumber); - taskService.Tasks.Add(new Task(result.FileName, currentDocument.GetText(line.Offset, line.Length), result.Offset - line.Offset, lineNumber)); - } - - static bool InitializeSearchInFiles() - { - Debug.Assert(searchOptions != null); - - TaskService taskService = (TaskService)MonoDevelop.Core.ServiceManager.Services.GetService(typeof(TaskService)); - taskService.Tasks.Clear(); - - InitializeDocumentIterator(null, null); - InitializeSearchStrategy(null, null); - find.Reset(); - find.SearchStrategy.CompilePattern(searchOptions); - - currentFileName = String.Empty; - currentDocument = null; - - return true; - } - - static void FinishSearchInFiles() - { - TaskService taskService = (TaskService)MonoDevelop.Core.ServiceManager.Services.GetService(typeof(TaskService)); - taskService.NotifyTaskChange(); - - OpenTaskView taskView = WorkbenchSingleton.Workbench.GetPad(typeof(OpenTaskView)) as OpenTaskView; - if (taskView != null) taskView.BringToFront(); - } - - public static void ReplaceAll() - { - if (!InitializeSearchInFiles()) { - return; - } - - while (true) { - ISearchResult result = find.FindNext(searchOptions); - if (result == null) { - break; - } - - find.Replace(result.Offset, - result.Length, - result.TransformReplacePattern(SearchOptions.ReplacePattern)); - - DisplaySearchResult(result); - } - - FinishSearchInFiles(); - } - - public static void FindAll() - { - if (!InitializeSearchInFiles()) { - return; - } - - while (true) { - ISearchResult result = find.FindNext(searchOptions); - if (result == null) { - break; - } - - DisplaySearchResult(result); - } - - FinishSearchInFiles(); - } - } -} diff --git a/main/Unused/TextEditor/Search/SearchReplaceManager.cs b/main/Unused/TextEditor/Search/SearchReplaceManager.cs deleted file mode 100644 index 632751bee7..0000000000 --- a/main/Unused/TextEditor/Search/SearchReplaceManager.cs +++ /dev/null @@ -1,201 +0,0 @@ -// SearchReplaceManager.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.Diagnostics; - -using MonoDevelop.Core.Gui; - -using MonoDevelop.Core; -using MonoDevelop.Core; -using MonoDevelop.Core.Gui.Dialogs; -using MonoDevelop.DefaultEditor.Gui.Editor; -using MonoDevelop.TextEditor; -using MonoDevelop.EditorBindings.Search; -using MonoDevelop.Ide.Gui.Dialogs; - -namespace MonoDevelop.TextEditor.Document -{ - public class SearchReplaceManager - { - public static ReplaceDialog ReplaceDialog = null; - - static IFind find = new DefaultFind(); - static SearchOptions searchOptions = new SearchOptions("SharpDevelop.SearchAndReplace.SearchAndReplaceProperties"); - - - public static SearchOptions SearchOptions { - get { - return searchOptions; - } - } - - static SearchReplaceManager() - { - find.TextIteratorBuilder = new ForwardTextIteratorBuilder(); - searchOptions.SearchStrategyTypeChanged += new EventHandler(InitializeSearchStrategy); - searchOptions.DocumentIteratorTypeChanged += new EventHandler(InitializeDocumentIterator); - InitializeDocumentIterator(null, null); - InitializeSearchStrategy(null, null); - } - - static void InitializeSearchStrategy(object sender, EventArgs e) - { - find.SearchStrategy = SearchReplaceUtilities.CreateSearchStrategy(SearchOptions.SearchStrategyType); - } - - static void InitializeDocumentIterator(object sender, EventArgs e) - { - find.DocumentIterator = SearchReplaceUtilities.CreateDocumentIterator(SearchOptions.DocumentIteratorType); - } - - // TODO: Transform Replace Pattern - public static void Replace() - { - if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) { - TextEditorControl textarea = ((ITextEditorControlProvider)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).TextEditorControl; - string text = textarea.ActiveTextAreaControl.TextArea.SelectionManager.SelectedText; - if (text == SearchOptions.SearchPattern) { - int offset = textarea.ActiveTextAreaControl.TextArea.SelectionManager.SelectionCollection[0].Offset; - - textarea.BeginUpdate(); - textarea.ActiveTextAreaControl.TextArea.SelectionManager.RemoveSelectedText(); - textarea.Document.Insert(offset, SearchOptions.ReplacePattern); - textarea.ActiveTextAreaControl.Caret.Position = textarea.Document.OffsetToPosition(offset + SearchOptions.ReplacePattern.Length); - textarea.EndUpdate(); - } - } - FindNext(); - } - - public static void MarkAll() - { - TextEditorControl textArea = null; - if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) { - textArea = ((ITextEditorControlProvider)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).TextEditorControl; - textArea.ActiveTextAreaControl.TextArea.SelectionManager.ClearSelection(); - } - find.Reset(); - find.SearchStrategy.CompilePattern(searchOptions); - while (true) { - ISearchResult result = SearchReplaceManager.find.FindNext(searchOptions); - - if (result == null) { - //MessageBox.Show((Form)WorkbenchSingleton.Workbench, "Mark all done", "Finished"); - find.Reset(); - return; - } else { - textArea = OpenTextArea(result.FileName); - - textArea.ActiveTextAreaControl.Caret.Position = textArea.Document.OffsetToPosition(result.Offset); - int lineNr = textArea.Document.GetLineNumberForOffset(result.Offset); - - if (!textArea.Document.BookmarkManager.IsMarked(lineNr)) { - textArea.Document.BookmarkManager.ToggleMarkAt(lineNr); - } - } - } - } - - public static void ReplaceAll() - { - TextEditorControl textArea = null; - if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) { - textArea = ((ITextEditorControlProvider)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).TextEditorControl; - textArea.ActiveTextAreaControl.TextArea.SelectionManager.ClearSelection(); - } - find.Reset(); - find.SearchStrategy.CompilePattern(searchOptions); - - while (true) { - ISearchResult result = SearchReplaceManager.find.FindNext(SearchReplaceManager.searchOptions); - - if (result == null) { - //MessageBox.Show((Form)WorkbenchSingleton.Workbench, "Replace all done", "Finished"); - find.Reset(); - return; - } else { - textArea = OpenTextArea(result.FileName); - - textArea.BeginUpdate(); - textArea.ActiveTextAreaControl.TextArea.SelectionManager.SelectionCollection.Clear(); - - string transformedPattern = result.TransformReplacePattern(SearchOptions.ReplacePattern); - find.Replace(result.Offset, - result.Length, - transformedPattern); - textArea.EndUpdate(); - textArea.Refresh(); - } - } - } - - static ISearchResult lastResult = null; - public static void FindNext() - { - if (find == null || - searchOptions.SearchPattern == null || - searchOptions.SearchPattern.Length == 0) { - return; - } - - find.SearchStrategy.CompilePattern(searchOptions); - ISearchResult result = find.FindNext(searchOptions); - - if (result == null) { - ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService)); - //MessageBox.Show((Form)WorkbenchSingleton.Workbench, - // resourceService.GetString("Dialog.NewProject.SearchReplace.SearchStringNotFound"), - // "Not Found", - // MessageBoxButtons.OK, - // MessageBoxIcon.Information); - find.Reset(); - } else { - TextEditorControl textArea = OpenTextArea(result.FileName); - - if (lastResult != null && lastResult.FileName == result.FileName && - textArea.ActiveTextAreaControl.Caret.Offset != lastResult.Offset + lastResult.Length) { - find.Reset(); - } - int startPos = Math.Min(textArea.Document.TextLength, Math.Max(0, result.Offset)); - int endPos = Math.Min(textArea.Document.TextLength, startPos + result.Length); - - textArea.ActiveTextAreaControl.Caret.Position = textArea.Document.OffsetToPosition(endPos); - textArea.ActiveTextAreaControl.TextArea.SelectionManager.ClearSelection(); - textArea.ActiveTextAreaControl.TextArea.SelectionManager.SetSelection(new DefaultSelection(textArea.Document, textArea.Document.OffsetToPosition(startPos), - textArea.Document.OffsetToPosition(endPos))); - textArea.Refresh(); - } - - lastResult = result; - } - - static TextEditorControl OpenTextArea(string fileName) - { - if (fileName != null) { - IFileService fileService = (IFileService)MonoDevelop.Core.ServiceManager.Services.GetService(typeof(IFileService)); - fileService.OpenFile(fileName); - } - - return ((ITextEditorControlProvider)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).TextEditorControl; - } - } -} diff --git a/main/Unused/TextEditor/Search/SearchReplaceUtilities.cs b/main/Unused/TextEditor/Search/SearchReplaceUtilities.cs deleted file mode 100644 index e333659054..0000000000 --- a/main/Unused/TextEditor/Search/SearchReplaceUtilities.cs +++ /dev/null @@ -1,93 +0,0 @@ -// SearchReplaceUtilities.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; - -using MonoDevelop.Core.Gui; -using MonoDevelop.DefaultEditor.Gui.Editor; -using MonoDevelop.TextEditor; -using MonoDevelop.EditorBindings.Search; - -namespace MonoDevelop.TextEditor.Document -{ - public sealed class SearchReplaceUtilities - { - public static bool IsTextAreaSelected { - get { - return WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null && - WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent is ITextEditorControlProvider; - } - } - - - public static bool IsWholeWordAt(ITextBufferStrategy document, int offset, int length) - { - return (offset - 1 < 0 || Char.IsWhiteSpace(document.GetCharAt(offset - 1))) && - (offset + length + 1 >= document.Length || Char.IsWhiteSpace(document.GetCharAt(offset + length))); - } - - public static int CalcCurrentOffset(IDocument document) - { -// TODO: -// int endOffset = document.Caret.Offset % document.TextLength; -// return endOffset; - return 0; - } - - public static ISearchStrategy CreateSearchStrategy(SearchStrategyType type) - { - switch (type) { - case SearchStrategyType.None: - return null; - case SearchStrategyType.Normal: - return new BruteForceSearchStrategy(); // new KMPSearchStrategy(); - case SearchStrategyType.RegEx: - return new RegExSearchStrategy(); - case SearchStrategyType.Wildcard: - return new WildcardSearchStrategy(); - default: - throw new System.NotImplementedException("CreateSearchStrategy for type " + type); - } - } - - - public static IDocumentIterator CreateDocumentIterator(DocumentIteratorType type) - { - switch (type) { - case DocumentIteratorType.None: - return null; - case DocumentIteratorType.CurrentDocument: - return new CurrentDocumentIterator(); - case DocumentIteratorType.Directory: - return new DirectoryDocumentIterator(SearchReplaceInFilesManager.SearchOptions.SearchDirectory, - SearchReplaceInFilesManager.SearchOptions.FileMask, - SearchReplaceInFilesManager.SearchOptions.SearchSubdirectories); - case DocumentIteratorType.AllOpenFiles: - return new AllOpenDocumentIterator(); - case DocumentIteratorType.WholeCombine: - return new WholeProjectDocumentIterator(); - default: - throw new System.NotImplementedException("CreateDocumentIterator for type " + type); - } - } - } - -} diff --git a/main/Unused/TextEditor/Search/SearchResult/DefaultSearchResult.cs b/main/Unused/TextEditor/Search/SearchResult/DefaultSearchResult.cs deleted file mode 100644 index cff0d841f6..0000000000 --- a/main/Unused/TextEditor/Search/SearchResult/DefaultSearchResult.cs +++ /dev/null @@ -1,84 +0,0 @@ -// DefaultSearchResult.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.IO; -using System.Drawing; - -using MonoDevelop.Core.Properties; -using MonoDevelop.Ide.Gui.Undo; - -namespace MonoDevelop.TextEditor.Document -{ - public class DefaultSearchResult : ISearchResult - { - ProvidedDocumentInformation providedDocumentInformation; - int offset; - int length; - - public string FileName { - get { - return providedDocumentInformation.FileName; - } - } - - public ProvidedDocumentInformation ProvidedDocumentInformation { - set { - providedDocumentInformation = value; - } - } - - public int Offset { - get { - return offset; - } - } - - public int Length { - get { - return length; - } - } - - public virtual string TransformReplacePattern(string pattern) - { - return pattern; - } - - public IDocument CreateDocument() - { - return providedDocumentInformation.CreateDocument(); - } - - public DefaultSearchResult(int offset, int length) - { - this.offset = offset; - this.length = length; - } - - public override string ToString() - { - return String.Format("[DefaultLocation: FileName={0}, Offset={1}, Length={2}]", - FileName, - Offset, - Length); - } - } -} diff --git a/main/Unused/TextEditor/Search/SearchResult/ISearchResult.cs b/main/Unused/TextEditor/Search/SearchResult/ISearchResult.cs deleted file mode 100644 index 6b904f781a..0000000000 --- a/main/Unused/TextEditor/Search/SearchResult/ISearchResult.cs +++ /dev/null @@ -1,80 +0,0 @@ -// ISearchResult.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.IO; -using System.Drawing; - -using MonoDevelop.Core.Properties; -using MonoDevelop.Ide.Gui.Undo; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// This interface describes the result a search strategy must - /// return with a call to find next. - /// </summary> - public interface ISearchResult - { - /// <value> - /// Returns the file name of the search result. This - /// value is null till the ProvidedDocumentInformation - /// property is set. - /// </value> - string FileName { - get; - } - - /// <value> - /// This property is set by the find object and need not to be - /// set by the search strategies. All search results that are returned - /// by the find object do have a ProvidedDocumentInformation. - /// </value> - ProvidedDocumentInformation ProvidedDocumentInformation { - set; - } - - /// <value> - /// The offset of the pattern match - /// </value> - int Offset { - get; - } - - /// <value> - /// The length of the pattern match. - /// </value> - int Length { - get; - } - - /// <remarks> - /// This method creates a document for the file FileName. This method works - /// only after the ProvidedDocumentInformation is set. - /// </remarks> - IDocument CreateDocument(); - - /// <remarks> - /// Replace operations must transform the replace pattern with this - /// method. - /// </remarks> - string TransformReplacePattern(string pattern); - } -} diff --git a/main/Unused/TextEditor/Search/TextIterator/ForwardTextIterator.cs b/main/Unused/TextEditor/Search/TextIterator/ForwardTextIterator.cs deleted file mode 100644 index 1ad69b7201..0000000000 --- a/main/Unused/TextEditor/Search/TextIterator/ForwardTextIterator.cs +++ /dev/null @@ -1,161 +0,0 @@ -// ForwardTextIterator.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Diagnostics; -using System.Collections; - -using MonoDevelop.EditorBindings.Search; - -namespace MonoDevelop.TextEditor.Document -{ - public class ForwardTextIterator : ITextIterator - { - enum TextIteratorState { - Resetted, - Iterating, - Done, - } - - TextIteratorState state; - - ITextBufferStrategy textBuffer; - int currentOffset; - int endOffset; - int oldOffset = -1; - - public ITextBufferStrategy TextBuffer { - get { - return textBuffer; - } - } - - public char Current { - get { - switch (state) { - case TextIteratorState.Resetted: - throw new System.InvalidOperationException("Call moveAhead first"); - case TextIteratorState.Iterating: - return textBuffer.GetCharAt(currentOffset); - case TextIteratorState.Done: - throw new System.InvalidOperationException("TextIterator is at the end"); - default: - throw new System.InvalidOperationException("unknown text iterator state"); - } - } - } - - public int Position { - get { - return currentOffset; - } - set { - currentOffset = value; - } - } - - public int Length { get { return textBuffer.Length; } } - public string FullDocumentText { get { return textBuffer.GetText (0, textBuffer.Length); } } - - // doesnt this feel like java ;-) - public char GetCharAt (int p) - { - return textBuffer.GetCharAt (p); - } - - public bool IsWholeWordAt (int offset, int length) - { - return SearchReplaceUtilities.IsWholeWordAt (textBuffer, offset, length); - } - - public ForwardTextIterator(ITextBufferStrategy textBuffer, int endOffset) - { - Debug.Assert(textBuffer != null); - Debug.Assert(endOffset >= 0 && endOffset < textBuffer.Length); - - this.textBuffer = textBuffer; - this.endOffset = endOffset; - Reset(); - } - - public char GetCharRelative(int offset) - { - if (state != TextIteratorState.Iterating) { - throw new System.InvalidOperationException(); - } - - int realOffset = (currentOffset + (1 + Math.Abs(offset) / textBuffer.Length) * textBuffer.Length + offset) % textBuffer.Length; - return textBuffer.GetCharAt(realOffset); - } - - public bool MoveAhead(int numChars) - { - Debug.Assert(numChars > 0); - - switch (state) { - case TextIteratorState.Resetted: - currentOffset = endOffset; - state = TextIteratorState.Iterating; - return true; - case TextIteratorState.Done: - return false; - case TextIteratorState.Iterating: - currentOffset = (currentOffset + numChars) % textBuffer.Length; - bool finish = oldOffset != -1 && (oldOffset > currentOffset || oldOffset < endOffset) && currentOffset >= endOffset; - - oldOffset = currentOffset; - if (finish) { - state = TextIteratorState.Done; - return false; - } - return true; - default: - throw new Exception("Unknown text iterator state"); - } - } - - public void InformReplace(int offset, int length, int newLength) - { - if (offset <= endOffset) { - endOffset = endOffset - length + newLength; - } - - if (offset <= currentOffset) { - currentOffset = currentOffset - length + newLength; - } - - if (offset <= oldOffset) { - oldOffset = oldOffset - length + newLength; - } - } - - public void Reset() - { - state = TextIteratorState.Resetted; - currentOffset = endOffset; - oldOffset = -1; - } - - public override string ToString() - { - return String.Format("[ForwardTextIterator: currentOffset={0}, endOffset={1}, state={2}]", currentOffset, endOffset, state); - } - } -} diff --git a/main/Unused/TextEditor/Search/TextIterator/ForwardTextIteratorBuilder.cs b/main/Unused/TextEditor/Search/TextIterator/ForwardTextIteratorBuilder.cs deleted file mode 100644 index 200e621014..0000000000 --- a/main/Unused/TextEditor/Search/TextIterator/ForwardTextIteratorBuilder.cs +++ /dev/null @@ -1,36 +0,0 @@ -// ForwardTextIteratorBuilder.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Diagnostics; -using System.Collections; -using MonoDevelop.EditorBindings.Search; - -namespace MonoDevelop.TextEditor.Document -{ - public class ForwardTextIteratorBuilder : ITextIteratorBuilder - { - public ITextIterator BuildTextIterator(ProvidedDocumentInformation info) - { - Debug.Assert(info != null); - return new ForwardTextIterator(info.TextBuffer, info.EndOffset); - } - } -} diff --git a/main/Unused/TextEditor/Search/TextIterator/ITextIteratorBuilder.cs b/main/Unused/TextEditor/Search/TextIterator/ITextIteratorBuilder.cs deleted file mode 100644 index 3e394eae3a..0000000000 --- a/main/Unused/TextEditor/Search/TextIterator/ITextIteratorBuilder.cs +++ /dev/null @@ -1,34 +0,0 @@ -// ITextIteratorBuilder.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using MonoDevelop.EditorBindings.Search; - -namespace MonoDevelop.TextEditor.Document -{ - /// <summary> - /// Builds a text iterator object. - /// </summary> - public interface ITextIteratorBuilder - { - ITextIterator BuildTextIterator(ProvidedDocumentInformation info); - } -} diff --git a/main/Unused/TextEditor/XmlFormattingStrategy.cs b/main/Unused/TextEditor/XmlFormattingStrategy.cs deleted file mode 100644 index e77afbc3d4..0000000000 --- a/main/Unused/TextEditor/XmlFormattingStrategy.cs +++ /dev/null @@ -1,88 +0,0 @@ -// XmlFormattingStrategy.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System.Drawing; -using System.Diagnostics; -using System.Text; -using System.Xml; -using System; - -using MonoDevelop.Core.Properties; -using MonoDevelop.DefaultEditor.Gui.Editor; -using MonoDevelop.TextEditor.Document; -using MonoDevelop.TextEditor.Actions; -using MonoDevelop.TextEditor; - -using MonoDevelop.EditorBindings.FormattingStrategy; - -namespace MonoDevelop.DefaultEditor -{ - /// <summary> - /// This class currently only inserts the closing tags to - /// typed openening tags. - /// </summary> - public class XmlFormattingStrategy : DefaultFormattingStrategy - { - public override int FormatLine(IFormattableDocument d, int lineNr, int caretOffset, char charTyped) // used for comment tag formater/inserter - { - try { - if (charTyped == '>') { - StringBuilder stringBuilder = new StringBuilder(); - int offset = Math.Min(caretOffset - 2, d.TextLength - 1); - while (true) { - if (offset < 0) { - break; - } - char ch = d.GetCharAt(offset); - if (ch == '<') { - string reversedTag = stringBuilder.ToString().Trim(); - if (!reversedTag.StartsWith("/") && !reversedTag.EndsWith("/")) { - bool validXml = true; - try { - XmlDocument doc = new XmlDocument(); - doc.LoadXml(d.TextContent); - } catch (Exception) { - validXml = false; - } - // only insert the tag, if something is missing - if (!validXml) { - StringBuilder tag = new StringBuilder(); - for (int i = reversedTag.Length - 1; i >= 0 && !Char.IsWhiteSpace(reversedTag[i]); --i) { - tag.Append(reversedTag[i]); - } - string tagString = tag.ToString(); - if (tagString.Length > 0) { - d.Insert(caretOffset, "</" + tagString + ">"); - } - } - } - break; - } - stringBuilder.Append(ch); - --offset; - } - } - } catch (Exception e) { // Insanity check - Debug.Assert(false, e.ToString()); - } - return charTyped == '\n' ? IndentLine(d, lineNr) : 0; - } - } -} |