diff options
author | Mike Krüger <mkrueger@xamarin.com> | 2011-11-18 00:22:30 +0400 |
---|---|---|
committer | Mike Krüger <mkrueger@xamarin.com> | 2011-11-18 00:22:30 +0400 |
commit | 095f2d7ec19bc4f78ed0fa54d5ca5a4e9423f4ba (patch) | |
tree | 4b8f293a7dbc3bbbe600eda7694153d090f89b22 | |
parent | ae607a1050d901ae22d95cd6023a0aed2c7601e9 (diff) | |
parent | 532138fa22ed040ed3a353d755c259163c77398f (diff) |
Merge branch 'master' into newresolver
Conflicts:
extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.addin.xml
extras/MonoDevelop.Database/MonoDevelop.Database.Components/Widgets/DataGrid/DataGrid.cs
main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.addin.xml
main/src/addins/NUnit/Makefile.am
main/src/addins/NUnit/MonoDevelop.NUnit.csproj
main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Dom.Serialization/ProjectCodeCompletionDatabase.cs
main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWindow.cs
143 files changed, 3310 insertions, 12418 deletions
diff --git a/extras/GtkSourceViewEditor/AssemblyInfo.cs.in b/extras/GtkSourceViewEditor/AssemblyInfo.cs.in deleted file mode 100644 index 589dd4b116..0000000000 --- a/extras/GtkSourceViewEditor/AssemblyInfo.cs.in +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -[assembly: AssemblyTitle("SourceEditor")] -[assembly: AssemblyDescription("Default texteditor add-in of MonoDevelop")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("MonoDevelop")] -[assembly: AssemblyCopyright("MonoDevelop team")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -[assembly: AssemblyVersion("@ASSEMBLY_VERSION@")] - -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyKeyFile("")] diff --git a/extras/GtkSourceViewEditor/ChangeLog b/extras/GtkSourceViewEditor/ChangeLog deleted file mode 100644 index 5e0e9b3357..0000000000 --- a/extras/GtkSourceViewEditor/ChangeLog +++ /dev/null @@ -1,2444 +0,0 @@ -2008-11-05 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.addin.xml: Bump MD version. - -2008-06-05 Michael Hutchinson <mhutchinson@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs, - MonoDevelop.SourceEditor.Gui/SourceEditorView.cs, - MonoDevelop.SourceEditor/Services.cs: Track API changes. - -2008-06-04 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.addin.xml: Bump MD version. - -2008-06-03 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorWidget.cs, - MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Use the - OnDestroyed event instead of Dispose, since with the latest changes - in gtk#, Dispose is not called anymore when a widget is destroyed. - -2008-05-21 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs, - MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: New - project model changes. - -2008-05-15 Michael Hutchinson <mhutchinson@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Track API - changes. - -2008-03-13 Michael Hutchinson <mhutchinson@novell.com> - - * MonoDevelop.SourceEditor.mdp: Update references. - -2008-03-07 Michael Hutchinson <mhutchinson@novell.com> - - * MonoDevelop.SourceEditor.Gui.OptionPanels/BehaviorTextEditorPanel.cs: - * MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs: - * MonoDevelop.SourceEditor.Gui.OptionPanels/MarkersTextEditorPanel.cs: - * MonoDevelop.SourceEditor.Gui.OptionPanels/GeneralTextEditorPanel.cs: - * MonoDevelop.SourceEditor.addin.xml: Track options panel API changes. - -2008-03-06 Michael Hutchinson <mhutchinson@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: - * MonoDevelop.SourceEditor/Services.cs: - * MonoDevelop.SourceEditor.Gui.Dialogs/GotoLineNumberDialog.cs: - Track API changes to get the GtkSourceView2 editor building again. - -2008-02-09 Mike Krüger <mkrueger@novell.com> - - * Makefile.am: Managed texteditor is now standard - the gtksourceview1&2 are - now optional. - -2008-02-06 Michael Hutchinson <mhutchinson@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: Tidy up - commenting/uncommenting code, using atomic undos, and fix "Bug 325469 - - Comment and uncomment function". - * MonoDevelop.SourceEditor.addin.xml: Fix command IDs for comment/uncomment. - -2008-02-05 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Coneverted - comment/uncomment to the more common toggle comment logic. - -2008-02-04 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Implemented - Bug 323946 - Undo/Redo functionality are not context sensitive. - -2008-02-03 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorWidget.cs, - MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs, - MonoDevelop.SourceEditor/EditorCommands.cs, - MonoDevelop.SourceEditor.addin.xml: Use new print infrastructure. - -2008-01-29 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: clipboard handler - delete now works without a selection. - -2008-01-28 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorWidget.cs, - MonoDevelop.SourceEditor.Gui/SourceEditorView.cs, - MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs, - MonoDevelop.SourceEditor/EditorCommands.cs: Moved some text editor - commands to the ide: bookmarks, goto line number and goto matching - brace. - -2008-01-25 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.addin.xml: Update MD version. - -2008-01-23 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui.OptionPanels/BehaviorTextEditorPanel.cs: - Ensure we don't create subclasses of classes with private fields bound - by glade#. It would not work due to bug 355228. - * MonoDevelop.SourceEditor.Gui.OptionPanels/GeneralTextEditorPanel.cs, - MonoDevelop.SourceEditor.Gui.OptionPanels/MarkersTextEditorPanel.cs, - MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs: - Made internal some classes that don't need to be public. - -2008-01-22 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.addin.xml: Updated add-in category and - description. - -2008-01-21 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: Fixed Bug 354248 - - Uncomment does not work when comment tag is not the first two signs. - -2008-01-14 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Set the file - name before firing the CommitCountChange event, since the name may be - needed by the handlers. Fixes bug #353649. - -2008-01-10 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Ellipsize long - class and member names in the combos. Fixes bug #350887. - -2008-01-08 Lluis Sanchez Gual <lluis@novell.com> - - * EditorBindings.glade, - MonoDevelop.SourceEditor.Gui.OptionPanels/MarkersTextEditorPanel.cs: - Remove unused error underlining option. Fixes bug #351226. - -2007-12-18 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Added default handler - for the help command that starts Monodoc. - -2007-12-14 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: TreeView - sorting is too slow. Use Array.Sort instead. Fixes bug #344296. - -2007-12-13 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Moved - PlatformService to MD.Core.Gui. Removed old FileIconService class, which - is now implemented in PlatformService. - -2007-12-12 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.addin.xml: Bump add-in versions. - -2007-12-06 Geoff Norton <gnorton@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: - Use the PlatformService to get mime information instead of Gnome.Vfs - * MonoDevelop.SourceEditor.Gui/SourceEditorWidget.cs: Remove unused - Gnome widgets. - -2007-12-04 Lluis Sanchez Gual <lluis@novell.com> - - * Makefile.am, MonoDevelop.SourceEditor.mdp: Moved SourceEditor2 back to - main. - -2007-12-04 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.mdp: Directory reorganization. - -2007-12-01 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Removed - unnecessary parse call. - * MonoDevelop.SourceEditor.addin.xml: Added help command to context menu. - -2007-11-19 Zach Lute <zach.lute@gmail.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: LineCountChanged now - sends a negative count if lines were removed again. - -2007-11-16 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: fixed "Bug - 341880 - Find and Whole words only". - -2007-11-16 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Fixed "Bug - 341886 - Quick Class navigator does not sort file types". - -2007-11-14 Michael Hutchinson <mhutchinson@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: Implemented a - workaround for "Bug 341762 - Some TextIters should be passed by ref" as - a partial fix for "Bug 341319 - Tab not working correctly". Also added a - catch for infinite recursion in OnTextChanged, which additionally stops - consumers from invalidating TextIters by altering the buffer in - TextChanged handlers. - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Remove unused field. - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: When jumping - to a line, only highlight it if line highlighting is not already - enabled, or it gets "double-highlighted", which is disconcerting on dark - themes. Explicitly enable IndentOnTab. - * MonoDevelop.SourceEditor.Gui.OptionPanels/MarkersTextEditorPanel.cs: - Re-enable options now that they have an effect. - * MonoDevelop.SourceEditor.Actions/DefaultEditActions.cs, - MonoDevelop.SourceEditor.addin.xml: Remove EditActions that duplicated - features in GtkSourceView 1.8/2.0. - -2007-11-09 Michael Hutchinson <mhutchinson@novell.com> - - * MonoDevelop.SourceEditor.Gui/LanguageItemWindow.cs: Track - LoggingService API changes. - -2007-11-06 Michael Hutchinson <mhutchinson@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: - Track API: implement ITextEditorExtension.TextChanged. - -2007-11-01 Michael Hutchinson <mhutchinson@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorWidget.cs, - MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs, - MonoDevelop.SourceEditor.Gui/SourceEditorView.cs, - MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs, - MonoDevelop.SourceEditor.addin.xml: Disable all the bookmarks and - printing related code as GTKSV2 can't handle this stuff. - -2007-11-01 Michael Hutchinson <mhutchinson@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: Don't fire - LineCountChanged when count hasn't changed. - * MonoDevelop.SourceEditor.addin.xml: SourceViewService is now static, so - stop MD from trying to start it as a service. - -2007-10-29 Michael Hutchinson <mhutchinson@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorWidget.cs, - MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs, - MonoDevelop.SourceEditor.Gui/SourceEditorView.cs, - MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs, - MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs, - MonoDevelop.SourceEditor/SourceViewService.cs, Makefile.am, - MonoDevelop.SourceEditor.addin.xml, MonoDevelop.SourceEditor.mdp: Get - the SourceEditor working with GtkSourceView 2. - -2007-10-29 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.addin.xml: Bump MD version. - -2007-10-23 Lluis Sanchez Gual <lluis@novell.com> - - - -2007-10-23 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.mdp: Project file names updated by change in MD - path functions. - -2007-10-23 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: fixed "Bug - 335270 - Quick Class navigator ignores newly created types". - -2007-10-16 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Fixed "Bug - 331787 - Quick Class navigator does not display nested types". - -2007-10-16 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs, - MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Fixed "Bug - 331944 - MD does not keep selected line when file is re-loaded". - -2007-10-15 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Fixed "Bug - 327062 - MD Search (Whole Words Only) is very slow". - -2007-10-15 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: Fixed "Bug 330113 - - Clicking a line bookmark crashes md". - -2007-10-11 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Changed calls - for the new StringParser. - -2007-10-02 Grzegorz Sobański <silk@boktor.net> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Use the - Ambience to render names for class and memebers combos in source - editors. - -2007-10-10 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorWidget.cs: There is no need to - manually dispose the child view. It will be disposed when the parent is - destroyed. - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: Removed old error - underlining code. Avoid leak caused by event subscription. - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Don't try to show the - tooltip after the window has been disposed. - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Destroy the - main widget when the view is disposed. Removed some old error - underlining code. - -2007-10-09 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Fixed "Bug - 325519 - Unable to open web.config files from solution explorer". - -2007-10-05 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Bug 328817 - New created - file use Tab with Convert Tab to spaces enabled - -2007-10-05 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Fixed bug - 330265 - Tab to spaces not used if indent type is none or automatic. - -2007-10-02 Zach Lute <zach.lute@gmail.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Fixed error causing - an extra space to be unindented. (Bug #328776) - -2007-10-02 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Don't crash if the - parser does not provide error information. Fixes bug #330025. - -2007-09-26 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Use the - TextEditorProperties class to get the properties object to which - subscribe for events. - -2007-09-21 Jérémie Laval <jeremie.laval@gmail.com> - - * MonoDevelop.SourceEditor.Gui/LanguageItemWindow.cs: Added support - for on-the-fly parsing errors visually with a red underline and - error informations in the tooltip. Tuned LanguageItemWindow - constructor to use a StringBuilder instead of repetititive string - concatenation. Added the associated AutoCorrection option in - GeneralTextEditorPanel and the glade file. - -2007-09-21 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.addin.xml: Bump MD version. - -2007-09-17 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Added missing - length check. Fixes bug #325675. - -2007-09-17 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: CursorPosition property - not available in gtk# 2.8. - -2007-09-17 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: It's now possible to set - the caret positon in the code completion data (using the | char in the - data text). Required for bug 325438. - -2007-09-14 Jeffrey Stedfast <fejj@novell.com> - - Fixes bug #82865 - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs (OnMoveCursor): - Move the cursor, /then/ call - ITextEditorExtension.CursorPositionChanged(). - (OnButtonPressEvent): Same. - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs - (GetLineTextAtOffset): If the cursor is at the end of a line, - don't advance thru the next line (this returning 2 lines of text - rather than the 1). - -2007-09-13 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: changed libglib - reference. - -2007-09-13 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: Removed - MonoDevelop.SourceEditor.dll.config - changed DllImports. - -2007-09-11 Michael Hutchinson <mhutchinson@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Add - a null check to defend against unexpected parser output. - - * MonoDevelop.SourceEditor.mdp: Commit a minor automatic - formatting change. - -2007-09-04 Michael Hutchinson <MHutchinson@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs, - MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs, - MonoDevelop.SourceEditor.Gui.OptionPanels/BehaviorTextEditorPanel.cs, - MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs, - MonoDevelop.SourceEditor.Gui.OptionPanels/MarkersTextEditorPanel.cs, - MonoDevelop.SourceEditor.Gui.OptionPanels/GeneralTextEditorPanel.cs, - MonoDevelop.SourceEditor.Gui.Dialogs/GotoLineNumberDialog.cs: Fix some - compile warnings. - -2007-09-04 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Fixed - remaining issue with bug 82282. - -2007-08-31 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs, - MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs, - MonoDevelop.SourceEditor.Codons/EditActionCodon.cs, - MonoDevelop.SourceEditor.Gui.OptionPanels/BehaviorTextEditorPanel.cs, - MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs, - MonoDevelop.SourceEditor.Gui.OptionPanels/MarkersTextEditorPanel.cs, - MonoDevelop.SourceEditor.Gui.OptionPanels/GeneralTextEditorPanel.cs, - MonoDevelop.SourceEditor.Gui.Dialogs/GotoLineNumberDialog.cs: Changes - due to new property infrastructure. - -2007-08-29 Mike Krüger <mkrueger@novell.com> - - * Makefile.am, MonoDevelop.SourceEditor.mdp: Applied the patch from ankit to - use Mono.Cairo version 2.0.0.0 instead of the older 1.0 version. - -2007-08-28 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Fixed 82207: Incorrect - autocomplete insertion. - -2007-08-20 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs, - MonoDevelop.SourceEditor.Gui/SourceEditorView.cs, - MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Fixed bug - 82282: Error list pad should take into account line changes done in - files. - -2007-08-16 Wade Berrier <wberrier@novell.com> - - * Makefile.am: - Removed MonoDevelop.SourceEditor.dll.config.in. AFAICT MD runs without it. - This will enable mono-find-requires script to not generate deps on - gtksourceview so that the md rpm can be used on all distros. (Otherwise - we would need to build MD for all distros, since 10.3 has gtksourceview18) - -2007-08-14 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Make sure the - correct lastSaveTime is stored when the file is reloaded in the editor. - -2007-08-09 David Makovský (Yakeen) <yakeen@sannyas-on.net> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Properly dispose - Cairo.Context to avoid runtime warnings - -2007-08-09 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.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> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs, - MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs, Makefile.am, - MonoDevelop.SourceEditor.addin.xml, MonoDevelop.SourceEditor.mdp: - Reorganized the extension point hierarchy. Embedded all add-in manifests - as resources. - -2007-08-03 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs, - MonoDevelop.SourceEditor/Services.cs: API cleanup. Converted core - services into regular classes. - -2007-08-02 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs, - MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs, - MonoDevelop.SourceEditor/Services.cs: Converted DispatchService to a - static class. - -2007-07-27 Jeffrey Stedfast <fejj@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs (IndentLine): If - no text was inserted, simply return instead of spending time - readjusting the cursor position unnecessarily. - -2007-07-25 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.addin.xml: Add commands to the TextEditor - category. - -2007-07-18 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs, - MonoDevelop.SourceEditor.Actions/DefaultEditActions.cs, - MonoDevelop.SourceEditor.addin.xml: Replaced old actions by command - handlers. - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: When - setting the cursor position, also set the selection bound, and make - sure the new cursor position is visible. - -2007-07-18 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Track api changes. - -2007-07-18 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs, - MonoDevelop.SourceEditor.Gui/LanguageItemWindow.cs, - MonoDevelop.SourceEditor/SourceViewService.cs: Fix log calls. - -2007-07-17 Lluis Sanchez Gual <lluis@novell.com> - - * Makefile.am: Fix build. - -2007-07-17 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Uncommented code - that draws space marks. - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Fixed - several issues with the class and member combos. Added tooltips to - the combos which display type information. - * MonoDevelop.SourceEditor.Gui/LanguageItemWindow.cs: When using - 'gtk-tooltips' as window name, the window will be shown with the - tooltip background. Fixes bug #81794. - * MonoDevelop.SourceEditor.mdp: Updated. - -2007-07-16 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Sort the - class and member combos. - -2007-07-13 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Track api changes. - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Added - null checks. - * MonoDevelop.SourceEditor.Properties, - MonoDevelop.SourceEditor.InsightWindow, - MonoDevelop.SourceEditor.InsightWindow/MethodInsightDataProvider.cs, - MonoDevelop.SourceEditor.InsightWindow/InsightWindow.cs, - MonoDevelop.SourceEditor.InsightWindow/IInsightDataProvider.cs, - MonoDevelop.SourceEditor.InsightWindow/IndexerInsightDataProvider.cs, - MonoDevelop.SourceEditor.Document: Removed unused files and - directories. - -2007-07-11 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Use the - MarkSet event to update the method browser. Fixes bug #81864. - -2007-07-07 Jacob Ilsø Christensen <jacobilsoe@gmail.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: - Make sure files are reverted also when created. Fixes bug #81911. - -2007-07-05 Mike Krüger <mkrueger@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Changed - source a bit due to core refactorings. - -2007-07-03 Mike Krüger <mkrueger@novell.com> - - * EditorBindings.glade, - MonoDevelop.SourceEditor.Gui/SourceEditorView.cs, - MonoDevelop.SourceEditor.Gui.OptionPanels/CodeTemplatePanel.cs, - MonoDevelop.SourceEditor.addin.xml, MonoDevelop.SourceEditor.mdp: - Removed the code template options (now they're part of the Ide - project). - -2007-07-02 Fabian Sturm <f@rtfs.org> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Added separate spaces, tabs and newline highlighting. - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Same. - * MonoDevelop.SourceEditor.Gui.OptionPanels/MarkersTextEditorPanel.cs: Same. - -2007-07-01 Jacob Ilsø Christensen <jacobilsoe@gmail.com> - - * EditorBindings.glade: Fixed capitalization issue. - -2007-06-11 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: Added IntPtr - constructor. Should fix bug #81826. - -2007-06-06 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Some - fixes to make sure combo events are properly released. - -2007-05-31 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Reduce - padding in the members drop down menu. Added missing null check. - * MonoDevelop.SourceEditor.addin.xml: Changed category to MonoDevelop - Core. - -2007-05-29 Jeffrey Stedfast <fejj@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Set the - mainBox.FocusChain to focus the editor widget first. Fixes bug #81765. - -2007-05-22 Jeffrey Stedfast <fejj@novell.com> - - * MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs: - Same. - - * MonoDevelop.SourceEditor.Gui.OptionPanels/MarkersTextEditorPanel.cs: - Same. - - * MonoDevelop.SourceEditor.Gui.OptionPanels/GeneralTextEditorPanel.cs: - Same. - - * MonoDevelop.SourceEditor.Gui.OptionPanels/BehaviorTextEditorPanel.cs: - Same. - - * MonoDevelop.SourceEditor.Gui/SourceEditorWidget.cs: Same. - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Same. - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Same - as below. - - * MonoDevelop.SourceEditor.FormattingStrategy/DefaultFormattingStrategy.cs: - MonoDevelop.SourceEditor.Properties namespace no longer exists. - -2007-05-21 Jeffrey Stedfast <fejj@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs - (CommentCode): Changed the logic a bit to not comment the last - line if no chars were actually in the selection on that - line. Fixes bug #81632. - -2007-05-21 Ankit Jain <jankit@novell.com> - - * MonoDevelop.SourceEditor.Gui.OptionPanels/CodeTemplatePanel.cs: - Ensure that dialogs are Destroy()'ed. - -2007-05-11 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.mdp: Don't copy project references. - -2007-05-09 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Codons/EditActionCodon.cs: Use the - Mono.Addins attributes to provide extension documentation. - * Makefile.am, MonoDevelop.SourceEditor.mdp: Reference shared - assemblies from the correct location. - -2007-05-04 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs, - MonoDevelop.SourceEditor.Gui/SourceEditorView.cs, - MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs, - MonoDevelop.SourceEditor.Codons/EditActionCodon.cs, Makefile.am, - MonoDevelop.SourceEditor.addin.xml, MonoDevelop.SourceEditor.mdp: - Migration to Mono.Addins. - -2007-03-03 James Fitzsimons <james.fitzsimons@gmail.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Added new - event handlers to update method combo when user mouse clicks on editor. - -2007-04-29 David Makovský (Yakeen) <yakeen@sannyas-on.net> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Fix for initial - settings for drawing control characters. - -2007-04-27 Michael Hutchinson <m.j.hutchinson@gmail.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Align white space - indicators with pixel grid, and interpolate their colour from BG and FG. - -2007-04-27 David Makovský (Yakeen) <yakeen@sannyas-on.net> - * EditorBindings.glade, - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs, - * MonoDevelop.SourceEditor.Properties/TextEditorProperties.cs, - * MonoDevelop.SourceEditor.Gui.OptionPanels/MarkersTextEditorPanel.cs: - Fixed typo. - -2007-04-26 David Makovský (Yakeen) <yakeen@sannyas-on.net> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Added highlighting - current line functionality when gtksourceview supports it and - drawing of white spaces. - * EditorBindings.glade: Configuraion checkboxes. - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs, - * MonoDevelop.SourceEditor.Properties/TextEditorProperties.cs, - * MonoDevelop.SourceEditor.Gui.OptionPanels/MarkersTextEditorPanel.cs: - HighlightCurrentLine and ShowContolCharacters confiuration properties. - * Makefile.am, - * MonoDevelop.SourceEditor.mdp: Added reference to Mono.Cairo. - -2007-04-26 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.addin.xml: Register the editor after the - default display binding, so other bindings can be registered before - of it and have more priority when opening files. - * MonoDevelop.SourceEditor.mdp: Updated. - -2007-04-10 Jeffrey Stedfast <fejj@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: - Implement IViewHistory - (BuildNavPoint() is no longer part of IViewHistory). - -2007-04-06 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Don't try - to update the class combo after the editor has been disposed. - * MonoDevelop.SourceEditor.mdp: Added missing file. - -2007-04-02 Jeffrey Stedfast <fejj@novell.com> - - * MonoDevelop.SourceEditor.Gui/TextNavigationPoint.cs (Description): - Don't include the column number, it's not worth the extra space taken - to display that info in the menu. - -2007-03-29 Jeffrey Stedfast <fejj@novell.com> - - * MonoDevelop.SourceEditor.Gui/TextNavigationPoint.cs: New source - file implementing the INavigationPoint interface for the SourceEditor. - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs - (CursorPositionChanged): Log the new NavigationPoint. - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs - (BuildNavPoint): Implemented. - (GetLineColumnFromPosition): Make column 1-based like the line - already is (hopefully this doesn't break anything). - -2007-03-28 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Don't - crash if the method combo is empty. - -2007-03-26 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Avoid - crash when no entry is selected in the class combo. - -2007-03-26 James Fitzsimons <james.fitzsimons@gmail.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Added class - and method browser combos. Added ascx to list in CanCreateContentForMimeType(). - * EditorBindings.glade: Added checkbox for Class & Method combos to GeneralTextEditorPanel. - * MonoDevelop.SourceEditor.Gui.OptionPanels/GeneralTextEditorPanel.cs: - Added support for turning on and off the class and method browser combos in the editor. - * MonoDevelop.SourceEditor.Properties/TextEditorProperties.cs: Added - ShowClassBrowser property. - -2007-03-23 Jeffrey Stedfast <fejj@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs - (GetCharAt): Need to check that offset < (len - 1) because the - last iter won't have a char. Fixes bug #81216. - -2007-03-19 Jeffrey Stedfast <fejj@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs - (GetCharAt): Changed since we are now implementing - ITextFile.GetCharAt - -2007-03-16 Jeffrey Stedfast <fejj@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs (DeleteLine): - Emulate the Emacs Ctrl-K delete-line behavior (which appears to be - what it was intended to emulate in the first place based on - previous commit messages). - -2007-02-27 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorWidget.cs, - MonoDevelop.SourceEditor.Properties/TextEditorProperties.cs, - MonoDevelop.SourceEditor.Gui.OptionPanels/BehaviorTextEditorPanel.cs, - MonoDevelop.SourceEditor.Gui.OptionPanels/MarkersTextEditorPanel.cs: - Removed unused namespace. - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Use TextEditor for - formatting operations. - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: The - ICompletionWidget interface is now obtained through the GetContent - method. Implemented some soon to be added ITextFile methods. - * MonoDevelop.SourceEditor.FormattingStrategy/DefaultFormattingStrategy.cs, - MonoDevelop.SourceEditor.Document/DefaultFormattingStrategy.cs: - Moved to FormattingStrategy dir. - * MonoDevelop.SourceEditor.FormattingStrategy/IFormattingStrategy.cs: - Use TextEditor instead of IFormattableDocument. - * MonoDevelop.SourceEditor.FormattingStrategy/IFormattableDocument.cs: - Removed. Replaced by TextEditor. - * Makefile.am, MonoDevelop.SourceEditor.mdp: Updated. - -2007-02-22 Jeffrey Stedfast <fejj@gnome.org> - - * MonoDevelop.SourceEditor.Properties/TextEditorProperties.cs: - Added some new font properties that GeneralTextEditorPanel.cs - needed in order to drop the need for the CustomizationObject. - Also changed the default IndentStyle to Smart. - - * MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs: - Same as below. - - * MonoDevelop.SourceEditor.Gui.OptionPanels.MarkersTextEditorPanel.cs: - Same as below. - - * MonoDevelop.SourceEditor.Gui.OptionPanels/GeneralTextEditorPanel.cs: - Same as below. - - * MonoDevelop.SourceEditor.Gui.OptionPanels/BehaviorTextEditorPanel.cs: - Don't use the CustomizationObject, wherever that comes - from(?). Instead, directly use TextEditorProperties so that - changing the defaults in TextEditorProperties changes it in the - Preferences dialog as well. - -2007-02-21 Jeffrey Stedfast <fejj@gnome.org> - - * EditorBindings.glade: Fixed the UseUnderline attribute for the - "_wrap mode" label. - -2007-02-16 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.addin.xml: Change add-in versions to 0.13. - -2007-02-15 Lluis Sanchez Gual <lluis@novell.com> - - * Makefile.am, MonoDevelop.SourceEditor.mdp: Synchronized MD project - and makefile. - -2007-02-13 Lluis Sanchez Gual <lluis@novell.com> - - * EditorBindings.glade, - MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs, - MonoDevelop.SourceEditor/SourceViewService.cs: Properly get and set - the color mask for language styles. Fixes bug #77101. - -2007-02-11 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs, - MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs, - MonoDevelop.SourceEditor.Actions/DefaultEditActions.cs: Allow - indenting single lines. Fixes bug #80717. - -2007-02-10 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorWidget.cs: Make sure markers - are not bigger than the height of a text line. - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs, - MonoDevelop.SourceEditor.InsightWindow/IndexerInsightDataProvider.cs, - MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs, - MonoDevelop.SourceEditor.Gui.Dialogs/GotoLineNumberDialog.cs: Fix - warnings. - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Removed unneeded - code when trying to find the language item for which to show help. - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Update - marker sizes when font size changes. - * bookmark.png: New bookmark icon. - * Makefile.am, MonoDevelop.SourceEditor.mdp: Removed obsolete classes. - -2007-02-09 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Added some null - checks. A file may not always be able to return a parser context. - * Makefile.am: distcheck fixes - * MonoDevelop.SourceEditor.mdp: Flush. - -2007-01-29 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui.Dialogs/GotoLineNumberDialog.cs: Track - api changes in Document class. - -2007-01-29 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs, - MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs, - MonoDevelop.SourceEditor.Actions/DefaultEditActions.cs: Implemented - IExtensibleTextEditor. Moved most of code completion code to - TextEditorExtension. - * MonoDevelop.SourceEditor.InsightWindow/MethodInsightDataProvider.cs, - MonoDevelop.SourceEditor.InsightWindow/IndexerInsightDataProvider.cs: - Track api changes. - * MonoDevelop.SourceEditor.addin.xml: Removed obsolete extensions. - * MonoDevelop.SourceEditor.mdp: Updated. - -2007-01-21 Atsushi Enomoto <atsushi@ximian.com> - - * EditorBindings.glade, - MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs, - MonoDevelop.SourceEditor.Properties/TextEditorProperties.cs, - MonoDevelop.SourceEditor.Gui.OptionPanels/MarkersTextEditorPanel.cs: - added WrapMode selector in markers and rules section. - -2007-01-15 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Avoid - crash when jumping to an empty line. - -2006-12-07 Jacob Ilsø Christensen <jacobilsoe@gmail.com> - - * MonoDevelop.SourceEditor.mdp: Updated to ensure - it can be built from MonoDevelop. - -2006-12-01 Jacob Ilsø Christensen <jacobilsoe@gmail.com> - - * MonoDevelop.SourceEditor.addin.xml: Changed goto to go to. - -2006-11-30 Jacob Ilsø Christensen <jacobilsoe@gmail.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Fixed a typo. - Thanks to Mike Morano <mmorano@mikeandwan.us>. - -2006-10-06 Andrés G. Aragoneses <knocte@gmail.com> - - * MonoDevelop.SourceEditor.addin.xml: Added strings to l10n. - -2006-09-19 Jacob Ilsø Christensen <jacobilsoe@gmail.com> - - * MonoDevelop.SourceEditor.addin.xml: Fixed a couple - of HIG issues. - -2006-09-19 Jacob Ilsø Christensen <jacobilsoe@gmail.com> - - * .: Added svn:ignore for MonoDevelop.SourceEditor.pidb - -2006-09-15 Jacob Ilsø Christensen <jacobilsoe@gmail.com> - - * MonoDevelop.SourceEditor.Gui/LanguageItemWindow.cs: Makes - sure multiline documentation is shown correctly. Remove examples - from popup documentation. Fixes bug #79363. - -2006-09-12 Jacob Ilsø Christensen <jacobilsoe@gmail.com> - - * MonoDevelop.SourceEditor.Gui/LanguageItemWindow.cs: Moved - things to Ambience plus cleaned up a bit. - -2006-09-11 Jacob Ilsø Christensen <jacobilsoe@gmail.com> - - * MonoDevelop.SourceEditor.addin.xml: A few minor - HIG updates. - -2006-09-01 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: - Added missing Dispose call to base class. - -2006-08-11 Jacob Ilsø Christensen <jacobilsoe@gmail.com> - - * MonoDevelop.SourceEditor.Gui/LanguageItemWindow.cs: Prepend - namespace tooltips with a namespace clause. - -2006-08-10 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/LanguageItemWindow.cs: - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Provide the - ambience to use for code completion. - -2006-08-07 Philip Turnbull <philip.turnbull@gmail.com> - - * MonoDevelop.SourceEditor.Gui/LanguageItemWindow.cs: - * MonoDevelop.SourceEditor.InsightWindow/MethodInsightDataProvider.cs: - * MonoDevelop.SourceEditor.InsightWindow/IndexerInsightDataProvider.cs: - Track API changes in Ambience. - -2006-08-07 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Ensure that the - cursor is visible after using the code completion window. Fixes - bug #78955. - -2006-08-04 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: - Implement support for IEncodedTextContent. - -2006-08-02 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Added null checks. - -2006-07-27 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Properly dispose - the code completion data provider. Increased the tooltip delay. - -2006-07-17 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Show a tooltip with - identifier information when hovering over the source code. - * MonoDevelop.SourceEditor.Gui/LanguageItemWindow.cs: Added. - * MonoDevelop.SourceEditor.mdp: Updated. - -2006-07-15 John Luke <john.luke@gmail.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: - rename HasSelection to _HasSelection so it wont conflict with - gtk 2.10 version - * MonoDevelop.SourceEditor.Gui/SourceEditorWidget.cs: - disambiguate PrintJob for gtk 2.10 - -2006-07-14 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: When calling - g_utf8_validate, use -1 as byte count, so it checks the whole text. - Patch by John Luke. Fixes bug #78707. - -2006-07-03 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.addin.xml: Updated versions. - -2006-05-30 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: - Added DisplayName property. - -2006-05-29 David Makovský (Yakeen) <yakeen@sannyas-on.net> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: reverted changes - implemented in MonoDevelop.Ide - -2006-05-23 David Makovský (Yakeen) <yakeen@sannyas-on.net> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: implementation of uppercase and lowercase actions - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: update interface implementation - * Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.addin.xml: include these actions in context menu - -2006-05-22 Lluis Sanchez Gual <lluis@novell.com> - - * Makefile.am: - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: Removed - ICSharpCode.SharpRefactory dependency. - -2006-05-05 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui.OptionPanels/CodeTemplatePanel.cs: - Code Template Combobox was adding a new column to store after - each action. Fix for bug #78082 by Chris Wilson. - -2006-05-04 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.addin.xml: Updated versions. - * MonoDevelop.SourceEditor.mdp: Updated. - -2006-04-19 Andrés G. Aragoneses <knocte@gmail.com> - - * MonoDevelop.SourceEditor.FormattingStrategy/IndentStyle.cs: fixed typos. - -2006-04-17 Andrés G. Aragoneses <knocte@gmail.com> - - * MonoDevelop.SourceEditor.addin.xml: Added string to l10n and fixed a typo. - -2006-04-07 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Codons/EditActionCodon.cs: - * MonoDevelop.SourceEditor.addin.xml: Added documentation. - -2006-04-03 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Fix for - bug #77945. - -2006-03-30 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.addin.xml: Updated references. - -2006-03-24 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.mdp: Updated. - * Makefile.am: Use an unified format. Patch by Matze Braun. - * MonoDevelop.SourceEditor.addin.xml: Updated add-in versions. - -2006-03-16 Jacob Ilsø Christensen <jacobilsoe@gmail.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: - Use new DocumentationService. - -2006-03-12 David Makovský (Yakeen) <yakeen@sannyas-on.net> - - * EditorBindings.glade: Marking some strings not to be translated. Not include balast in pot file. - -2006-03-07 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorWidget.cs: - * MonoDevelop.SourceEditor/EditorCommands.cs: - * MonoDevelop.SourceEditor.addin.xml: Added printing support. - Patch by David Makovský. - -2006-02-24 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: - Track api changes. - * MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs: - Removed unused namespace include. - -2006-02-24 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui.OptionPanels/GeneralTextEditorPanel.cs: - Use one line per field, in order to get attributes properly applied. - -2006-02-19 Andrés G. Aragoneses <knocte@gmail.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: added - messages to l10n and improved one string. - -2006-01-30 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: workaround - for bug #77362. - -2006-01-26 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.addin.xml: Added refactory commands to - context menu. - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Right click now - moves the cursor to the clicked position. - -2006-01-13 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.addin.xml: - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Made extensible the - context menu of the editor. - -2006-01-10 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: Track api changes. - -2006-01-04 Alexandre Miguel Pedro Gomes <alexmipego@gmail.com> - - * MonoDevelop.SourceEditor.addin.xml: Added icon to Goto Line option. - -2005-12-13 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: - Track changes in the api. - -2005-12-02 Itamar Rogel <chastamar@yahoo.com> - - * Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: - Added XML and VBNET to the switch statement so new xml files that - are added to a project would be identified as - such and so would have proper syntax highlighting. - bug #76882 - -2005-11-30 Jacob Ilsø Christensen <jacobilsoe@gmail.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: - Fixed search when the search starts in the middle of the word being - searched for. Fixed looping when backward search wraps. - -2005-11-28 Peter Johanson <latexer@gentoo.org> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Set the - mime type for boo files for initial creation as well. Makes newly - created boo files get syntax highlighting/completion. - -2005-11-28 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.addin.xml: Added missing label to toolbar. - -2005-11-22 John Luke <john.luke@gmail.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: - percent escape files before passing them to vfs to get the - mimetype, fixes bug #75256 - -2005-11-17 John Luke <john.luke@gmail.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: - initialize the formatter to the default, so that unsaved - files will have a fmtr and not crash on a keypress - bug #76729 - -2005-11-14 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: Increased undo - limit. - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Scroll - to cursor after undoing or redoing. - -2005-11-09 John Luke <john.luke@gmail.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: - only FormatLine when IndentStyle is Smart - part of bug #76652 - -2005-11-09 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: - In InitializeFormatter don't crash for files without extension. - Implement some new methods defined in ITextBuffer and IEditor. - -2005-11-04 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: - Implement some new methods defined in ITextBuffer and IEditor. - -2005-10-28 John Luke <john.luke@gmail.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: - add FormatLine to give us better smart indenting - * MonoDevelop.SourceEditor.Actions/DefaultEditActions.cs: - use FormatLine on enter instead of indentline - -2005-10-28 John Luke <john.luke@gmail.com> - - * EditorBindings.glade: add smart indent radio button - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: - indent through the formatter, instead of gtksourceview - * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: - load the formatters from the addin file per language - * MonoDevelop.SourceEditor.Properties/TextEditorProperties.cs: - add a FIXME comment - * MonoDevelop.SourceEditor.Gui.OptionPanels/BehaviorTextEditorPanel.cs: - load/store smart indent settings - * MonoDevelop.SourceEditor.Actions/DefaultEditActions.cs: - add return for indentation handling - * MonoDevelop.SourceEditor.addin.xml: add Return EditAction - -2005-10-28 John Luke <john.luke@gmail.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs (DeleteLine): - rework to delete the whole line, not just erase its contents - -2005-10-28 John Luke <john.luke@gmail.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs (PeekCharIsWhitespace): - fix GTK+ assertion when the next char is a new line by - using Offset instead of LineOffset - -2005-10-23 John Luke <john.luke@gmail.com> - - * MonoDevelop.SourceEditor.Actions/EditActionCollection.cs: - filter out problematic Masks, so far just LockMask and Mod2Mask - -2005-10-23 John Luke <john.luke@gmail.com> - - * MonoDevelop.SourceEditor.addin.xml: fix space - * MonoDevelop.SourceEditor.Actions/DefaultEditActions.cs: - fix completion for space key presses - -2005-10-23 John Luke <john.luke@gmail.com> - - * MonoDevelop.SourceEditor.Actions/IEditAction.cs: - add PreExecute and PostExecute methods - * MonoDevelop.SourceEditor.Actions/DefaultEditActions.cs: - reset PassToBase to false after running the action - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: - call PreExecute and PostExecute methods - fixes bug #76523 - -2005-10-19 John Luke <john.luke@gmail.com> - - * *.cs: fix some warnings by removing unused fields - -2005-10-19 Christian Hergert <christian.hergert@gmail.com> - - * MonoDevelop.SourceEditor/SourceViewService.cs: Check for a valid source - languages manager before persisting settings to file. - -2005-10-18 John Luke <john.luke@gmail.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: - use new TreeNodeExists method instead of relying on an - exception - -2005-10-18 John Luke <john.luke@gmail.com> - - * MonoDevelop.SourceEditor.Codons/EditActionCodon.cs: - add all the current ModifierTypes in gdk 2.4 - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: - order using statements, remove ProcessPressEvent() - combine UnIndentSelection and IndentSelection - implement editactions instead of a bunch of switch - statements to control the editor, mark some methods - internal - * MonoDevelop.SourceEditor.Actions/IEditAction.cs: - add PassToBase property - * MonoDevelop.SourceEditor.Actions/DefaultEditActions.cs: - move the default editing actions here as IEditActions - * MonoDevelop.SourceEditor.Actions/EditActionCollection.cs: - used to get unique IEditAction from a Gdk.Key and Gdk.ModifierType - * MonoDevelop.SourceEditor.addin.xml: add EditActions - * Makefile.am: add EditActionCollection and DefaultEditActions - -2005-10-17 John Luke <john.luke@gmail.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: - add InsertTemplate () method which handles the details for us - and move the relevant code to it - * MonoDevelop.SourceEditor.Codons/EditActionCodon.cs: - MonoDevelop.SourceEditor.Actions/IEditAction.cs: update and implement - for gdk key handling, they are still not used - * MonoDevelop.SourceEditor.addin.xml: change InsertTemplate key to Tab - -2005-10-11 John Luke <john.luke@gmail.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs: - make tab activate templates instead of space - part of bug #55843 - -2005-10-11 John Luke <john.luke@gmail.com> - - * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs (GetLineAsString): - don't go ForwardToLineEnd if we are already at EndsLine - fixes bug# 76208 - -2005-10-11 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.addin.xml: Fixed addin header information. - Use "id" attribuet instead of "name" to identify addins. - * MonoDevelop.SourceEditor/SourceViewService.cs: create the language - manager in InitializeService. - -2005-10-04 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.SourceEditor.addin.xml: Added addin dependencies. - -2005-10-04 Lluis Sanchez Gual <lluis@novell.com> - - * Makefile.am: Install the assembly in the AddIns directory. - -2005-09-28 Lluis Sanchez Gual <lluis@novell.com> - - * Renamed to from MonoDevelop.SourceEditor. - Changed internal organization of files and namespaces. - -2005-09-23 Lluis Sanchez Gual <lluis@novell.com> - - * Gui/SourceEditorDisplayBinding.cs: IDocumentInformation.FileName - now returns the untitled file name if the file has not been saved. - This fixes bug #61771. - Use special search flags that work for the old and the new API - of gtksourceview (the enum values where changed in the API). - Fixes bug #75770. - -2005-08-20 John Luke <john.luke@gmail.com> - - * Gui/SourceEditorBuffer.cs: - * Gui/SourceEditorView.cs: fix some warnings with the new - gtk# - -2005-08-19 Lluis Sanchez Gual <lluis@novell.com> - - * Gui/SourceEditorView.cs: Display the completion window even if - the char at the cursor is not a whitespace. - -2005-08-12 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelopEditor.addin.xml: - * Gui/SourceEditorDisplayBinding.cs: Use stock icon id instead of - file name. - -2005-08-10 Ben Motmans <ben.motmans@gmail.com> - - * SourceEditor.mdp: references update - -2005-08-09 Lluis Sanchez Gual <lluis@novell.com> - - * InsightWindow/IndexerInsightDataProvider.cs: - * InsightWindow/MethodInsightDataProvider.cs: - * Gui/SourceEditorView.cs: Use the new IParserContext API. - - * Gui/SourceEditorDisplayBinding.cs: Implement IEditable.TextChanged. - -2005-08-06 John Luke <john.luke@gmail.com> - - * SourceEditor.mdp: update - -2005-08-03 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelopEditor.addin.xml: Removed old menu entries. - -2005-07-27 Lluis Sanchez Gual <lluis@novell.com> - - * Gui/SourceEditorDisplayBinding.cs: Make sure the PropertyChanged - handler runs in the gui thread. - -2005-07-22 John Luke <john.luke@gmail.com> - - * SourceEditor.mdp: remove completion files moved into Base assembly - -2005-07-20 Lluis Sanchez Gual <lluis@novell.com> - - * Gui/SourceEditorWidget.cs: Factorized some code into - SearchReplaceManager. - -2005-07-20 Peter Johanson <latexer@gentoo.org> - - * CodeCompletion/*: Migrated to MonoDevelop.Base assembly. - * Makefile.am: Remove CodeCompletion file entries. - * Gui/SourceEditorView.cs: - * InsightWindow/InsightWindow.cs: - * InsightWindow/IndexerInsightDataProvider.cs: - * InsightWindow/MethodInsightDataProvider.cs: Changed to reflect - completion API/location changes. - -2005-07-20 Lluis Sanchez Gual <lluis@novell.com> - - * Gui/SourceEditorWidget.cs: Implemented FindPrevious command. - * Gui/SourceEditorDisplayBinding.cs: Implemented SelectionStartPosition - and SelectionEndPosition properties. Implemented an ITextIterator - that supports SourceView's native search methods. - * MonoDevelopEditor.addin.xml: Added FindPrevious command to the menu. - -2005-07-13 John Luke <john.luke@gmail.com> - - * Gui/SourceEditorView.cs: make DeleteLine () use AtomicUndo - remove incorrect special case for shift + del as it is = cut - and control + k for DeleteLine like emacs - fixes bug #75425, based on patch by Paul.Betts@Gmail.com (Paul Betts) - -2005-07-13 John Luke <john.luke@gmail.com> - - * CodeCompletion/ListWindow.cs: scroll with the mousewheel - * CodeCompletion/CompletionListWindow.cs: complete on double-click - -2005-07-13 Lluis Sanchez Gual <lluis@novell.com> - - * Gui/SourceEditorDisplayBinding.cs: The editor is now responsible - of showing its own widgets. - -2005-07-01 Jacob Ils Christensen <jacobilsoe@gmail.com> - - * Gui/Dialogs/GotoLineNumberDialog.cs: - * Gui/SourceEditorDisplayBinding.cs: - Make lines and columns 1-based. - -2005-07-01 Jacob Ils Christensen <jacobilsoe@gmail.com> - - * CodeCompletion/ListWindow.cs: Make sure the list - window is no larger than necessary. - -2005-06-28 Raja R Harinath <rharinath@novell.com> - - * Makefile.am (FILES): Move AssemblyInfo.cs ... - (GENERATED_FILES): ... here. - -2005-06-27 Lluis Sanchez Gual <lluis@novell.com> - - * Gui/SourceEditorWidget.cs: Added some imports. - - * Search/*.cs: - * Commands/SearchCommands.cs: - * Gui/Dialogs/ReplaceInFilesDialog.cs: - * Gui/Dialogs/ReplaceDialog.cs: Moved to MonoDevelop.Base. - - * Gui/SourceEditorDisplayBinding.cs: Implement some new interfaces. - * Commands/BookmarkCommands.cs: Those are implemented with inline - command handlers. - - * texteditoraddin.glade: Moved search/replace dialogs to MonoDevelop.Base. - * Makefile.am: Removed moved files. - * MonoDevelopEditor.addin.xml: Search/replace commands are now defined in - MonoDevelop.Base. - -2005-06-09 Lluis Sanchez Gual <lluis@novell.com> - - * Services/SourceViewService.cs: Added null check. - * CodeCompletion/CompletionListWindow.cs: Added some error checking to - avoid crashes. - * MonoDevelopEditor.addin.xml: Create a toolbar specific for the editor. - -2005-05-22 Todd Berman <tberman@off.net> - - * Gui/Dialogs/ReplaceDialog.cs: - * Gui/Dialogs/ReplaceInFilesDialog.cs: - Duh. Actually fix #74965 totally. stupid miss on my end. - -2005-05-21 Todd Berman <tberman@off.net> - - * Gui/Dialogs/ReplaceDialog.cs: - * Gui/Dialogs/ReplaceInFilesDialog.cs: - Fix #74965. - -2005-05-21 Todd Berman <tberman@off.net> - - * Search/SearchReplaceManager.cs: - * Search/SearchStrategy/RegExSearchStrategy.cs: - * Search/SearchReplaceInFilesManager.cs: - Fix #74966 and display a meaningful error message. - -2005-05-20 Jacob Ils Christensen <jacobilsoe@gmail.com> - - * Gui/SourceEditorView.cs: Fixed problem with monodoc on words followed by a newline. - -2005-05-16 Jacob Ils Christensen <jacobilsoe@gmail.com> - - * Gui/SourceEditorView.cs: Added support to ctrl+tab/shift+ctrl+tab through open files. - -2005-05-15 Todd Berman <tberman@off.net> - - * texteditoraddin.glade: Add some missing 'Activates Default' props. - -2005-05-15 Lluis Sanchez Gual <lluis@novell.com> - - * EditorBindings.glade: Many fixes to make the dialogs more conforming - to the HIG. - * Gui/SourceEditorView.cs: Added IntPtr constructor to make gtk# happy. - * Gui/SourceEditorDisplayBinding.cs: Removed unused code. Minor fixes. - -2005-04-30 Lluis Sanchez Gual <lluis@novell.com> - - * Gui/SourceEditorWidget.cs: Handler toggle breakpoint command. - * Gui/SourceEditorView.cs: Use the new command system to show - the contextual menu. - * Gui/SourceEditorDisplayBinding.cs: Show only breakpoints for the - file being edited. Catch exceptions when reloading the file. - * MonoDevelopEditor.addin.xml: Added some command descriptions. - -2005-04-27 Lluis Sanchez Gual <lluis@novell.com> - - * Gui/SourceEditorDisplayBinding.cs: Don't crash if the debugger - is not installed. - -2005-04-27 Lluis Sanchez Gual <lluis@novell.com> - - * Gui/SourceEditorView.cs: - * Gui/SourceEditorDisplayBinding.cs: Track changes in breakpoints, and - debug execution location. - -2005-04-26 Lluis Sanchez Gual <lluis@novell.com> - - * texteditoraddin.glade: Added missing stop button in the replace - in files dialog. - -2005-04-25 Lluis Sanchez Gual <lluis@novell.com> - - * Gui/SourceEditorWidget.cs: Moved here editor-specific commands. - * Gui/SourceEditorDisplayBinding.cs: The methods for managing - bookmarks are now in the editor widget, not the buffer. - * Commands/EditorCommands.cs: New enum with IDs for edit commands. - * Commands/SearchCommands.cs: Moved editor-specific commands to - SourceEditorWidget.cs. - * MonoDevelopEditor.addin.xml: Created the new command structure. - -2005-04-25 Lluis Sanchez Gual <lluis@novell.com> - - * Gui/SourceEditorWidget.cs: - * Gui/SourceEditorBuffer.cs: - * SourceEditorDisplayBinding.cs: Improve memory usage. - -2005-04-17 John Luke <john.luke@gmail.com> - - * Makefile.am: fix distcheck - -2005-04-09 John Luke <john.luke@gmail.com> - - * CodeCompletion/ListWindow.cs: dont crash - if the provider is null, fixes bug #74492 - -2005-04-09 John Luke <john.luke@gmail.com> - - * Services/SourceViewService.cs: catch XmlException - while restoring style/color prefs - -2005-04-06 John Luke <john.luke@gmail.com> - - * Services/SourceViewService.cs: dont serialize - the defaults, add some logging, and use SourceTag.Id - not the .Name - -2005-04-06 Alexandre Gomes <alexmipego@gmail.com> - - * Services/SourceViewService.cs: Fix a small problem that can occur - to svn users since some users that can be missing isDefault at all. - -2005-04-05 John Luke <john.luke@gmail.com> - - * Gui/OptionPanels/SyntaxHighlightingPanel.cs: - fix two buglets with the sensitivity of restore - apparently we have to set .IsDefault to false ourselves - and update the toggle/colorbutton when it is restored - * Services/SourceViewService.cs: add is_default to - store/restore - -2005-04-02 John Luke <john.luke@gmail.com> - - * EditorBindings.glade: add glade part of new Panel - * Services/SourceViewService.cs: new service to share - the SourceLanguagesManager info - * Gui/SourceEditorBuffer.cs: use service - * Gui/OptionPanels/SyntaxHighlightingPanel.cs: new panel - for controlling all things about syntax highlighting - * Gui/OptionPanels/GeneralTextEditorPanel.cs: move enable syntax - highlighting to its own panel - * Makefile.am: add new files - * MonoDevelopEditor.addin.xml: add service - -2005-03-14 Lluis Sanchez Gual <lluis@novell.com> - - * Gui/SourceEditorWidget.cs: Added IntPtr constructor. Nullify - DisplayBinding field on dispose. - * Gui/SourceEditorDisplayBinding.cs: Set SourceEditor to null on dispose. - -2005-03-10 John Luke <john.luke@gmail.com> - - * Gui/SourceEditorView.cs: - * Gui/SourceEditorDisplayBinding.cs: dont create - a char array from the string, it is already indexed - that way - -2005-03-09 John Luke <john.luke@gmail.com> - - * Gui/SourceEditorDisplayBinding.cs: only - UpdateFSW if File.Exists, otherwise we would crash - -2005-03-07 Lluis Sanchez Gual <lluis@novell.com> - - * Gui/SourceEditorWidget.cs: Properly dispose the widget. - * Gui/SourceEditorView.cs: Added dispose method. - * Gui/SourceEditorDisplayBinding.cs: Unsubscribe events on dispose. - * CodeCompletion/CodeCompletionDataProvider.cs: Track api changes. - * MonoDevelopEditor.addin.xml: Removed unused view. - -2005-02-26 Poul Andersen <pba@mailme.dk> - * Gui/Dialogs/ReplaceDialog.cs: Added property DialogPointer. - * Gui/Dialogs/ReplaceInFilesDialog.cs: Added property DialogPointer. - Added StopButton for search in files. - * Commands/SearchCommands.cs: Added call to SetSearchPattern to ensure - selected text in the editor is used for searching. - * Search/SearchReplaceManager.cs: Changed MessageBoxes to call - Runtime.Service... using new "window on top" modal dialog box. - * Search/SearchReplaceInFilesManager.cs: Added property DialogPointer - * texteditoraddin.glade: Added Stop Button for Find in Files. - -2005-02-26 John Luke <john.luke@gmail.com> - - * Gui/SourceEditorWidget.cs: dont always set Highlight=true - * Gui/OptionPanels/MarkersTextEditorPanel.cs: un-sensitize ShowErrors - * Gui/SourceEditorDisplayBinding.cs: only modify properties - that were changed. - * Gui/OptionPanels/GeneralTextEditorPanel.cs: - * Properties/TextEditorProperties.cs: - * EditorBindings.glade: add SyntaxHighlight check button - -2005-02-23 Christian Hergert <christian.hergert@gmail.com> - - * Gui/Dialogs/ReplaceDialog.cs: Check for null to prevent Exception. - -2005-02-22 John Luke <john.luke@gmail.com> - - * CodeCompletion/CodeCompletionDataProvider.cs: - track the added Classes so we dont add them twice to the - completion list, I think it should fix bug 72941 - -2005-02-22 John Luke <john.luke@gmail.com> - - * Gui/SourceEditorView.cs (ScrollDown): don't change the - value above maxvalue, fixes a little stutter I noticed - -2005-02-12 Christian Hergert <christian.hergert@gmail.com> - - * Gui/SourceEditorBuffer.cs: Changed to DllImport the .dll rather - than .so for glib. - -2005-02-10 Ben Motmans <ben.motmans@gmail.com> - - * Gui/SourceEditorView.cs: Added ScrollUp and ScrollDown methods - for ctrl-up/down keybinds - -2005-02-02 John Luke <john.luke@gmail.com> - - * EditorBindings.glade: - * Gui/OptionPanels/MarkersTextEditorPanel.cs: - * Gui/OptionPanels/GeneralTextEditorPanel.cs: - use Gnome.FileEntry where appropriate - remove window-ish editor props (show line endings, etc) - remove double buffering pref (we always are) - -2005-02-01 John Luke <john.luke@gmail.com> - - * Gui.SourceEditorBuffer.cs: use ErrorInfo - and error underline improvements - -2005-01-31 John Luke <john.luke@gmail.com> - - * EditorBindings.glade: - * Gui/SourceEditorBuffer.cs: - * Gui/SourceEditorView.cs: - * Gui/OptionPanels/MarkersTextEditorPanel.cs: - * Gui/SourceEditorDisplayBinding.cs: - * Properties/TextEditorProperties.cs: - finish off underlining of errors, seems to - work alright - -2005-01-31 John Luke <john.luke@gmail.com> - - * EditorBindings.glade: - * Gui/SourceEditorView.cs: - * Gui/OptionPanels/BehaviorTextEditorPanel.cs: - * Gui/SourceEditorDisplayBinding.cs: - * Properties/TextEditorProperties.cs: - remove a couple useless texteditor props, enable - the AutoInsertTemplates property - -2005-01-31 Lluis Sanchez Gual <lluis@novell.com> - - * Gui/SourceEditorDisplayBinding.cs: - * Gui/SourceEditorBuffer.cs: Highlight the selected line when jumping - from the task view. ScrollMarkOnscreen after paste command. - * Gui/SourceEditorView.cs: Use function overrides instead of - subscribing its own events. - -2005-01-31 John Luke <john.luke@gmail.com> - - * EditorBindings.glade - * Gui/OptionPanels/GeneralTextEditorPanel.cs: - use Gtk.FontButton instead of Gnome.FontPicker - -2005-01-30 Todd Berman <tberman@off.net> - - * CodeCompletion/CompletionListWindow: comment out - UpdateDeclarationView in one place because it crashes - sometimes - -2005-01-30 John Luke <john.luke@gmail.com> - - * Gui/SourceEditorView.cs: only show completion if the - next char is not whitespace, ctl+space will override this - fixes bug# 60113 - -2005-01-30 Todd Berman <tberman@off.net> - - * CodeCompletion/CompletionListWindow.cs: Small changes, make sure the - placement of the declaration view window is redone when the list size - is changed. Fixes bug #71974 - -2005-01-29 Todd Berman <tberman@off.net> - - * Gui/SourceEditorView.cs: Only show "Breakpoint" if the - DebuggingService is available. - -2005-01-27 John Luke <john.luke@gmail.com> - - * EditorBindings.glade: - * texteditoraddin.glade: update to new glade format - - * EditorBindings.glade: - * texteditoraddin.glade: - * CodeCompletion/ListWindow.cs: - * Gui/SourceEditorBuffer.cs: - * Gui/SourceEditorDisplayBinding.cs - * Gui/SourceEditorWidget.cs: - * Gui/SourceEditorView.cs: - * Gui/Dialogs/ReplaceDialog.cs: - * Gui/Dialogs/ReplaceInFilesDialog.cs: - * Gui/OptionPanels/CodeTemplatePanel.cs: - * Gui/OptionPanels/GeneralTextEditorPanel.cs: - * InsightWindow/InsightWindow.cs: - * Search/DocumentIterator/DirectoryDocumentIterator.cs: - use ComboBox instead of OptionMenus - use Gtk.Entry w/completion instead of Gnome.Entry - remove obselete warnings, etc. - - * Makefile.am: remove Html from build - * Commands/ProjectCommands.cs: comment out that - * Gui/Dialogs/ExportProjectToHtmlDialog.cs: kill this - -2005-01-26 Christian Hergert <chris@mosaix.net> - * Gui/SourceEditorView.cs: Fix for new ShowView method in - DefaultWorkbench. - -2005-01-26 John Luke <john.luke@gmail.com> - - * Makefile.am: - * Gui/SourceEditorDisplayBinding.cs: use Gnome.Vfs - -2005-01-26 Todd Berman <tberman@off.net> - - * CodeCompletion/CompletionListWindow.cs: - * CodeCompletion/CodeCompletionData.cs: - * CodeCompletion/ListWindow.cs: - * CodeCompletion/DeclarationViewWindow.cs: A bit of a nicer overload - dialog. - -2005-01-26 Alexandre Gomes <alexmipego@gmail.com> - - * CodeCompletion/CompletationListWindow.cs: Fixed completion - window when near screen edges. - -2005-01-26 Alexandre Gomes <alexmipego@gmail.com> - - * CodeCompletion/CompletationListWindow.cs: - * CodeCompletion/ListWindow.cs: Closes bug #71686. Also makes - list sorted case-isensitive. - -2005-01-25 Todd Berman <tberman@off.net> - - * Gui/SourceEditorDisplayBinding.cs: Use new - IWorkbenchWindow.ShowNotification for when a file has been modified - outside MD. - -2005-01-25 Lluis Sanchez Gual <lluis@novell.com> - - * Gui/Pads/CompilerMessageView.cs: - * Makefile.am: CompilerMessageView moved to Monodevelop.Base. - - * Commands/SearchCommands.cs: - * Search/SearchReplaceManager.cs: - * Search/DocumentIterator/CurrentDocumentIterator.cs: - * Search/DocumentIterator/WholeProjectDocumentIterator.cs: - * Search/DocumentIterator/AllOpenDocumentIterator.cs: - * Gui/SourceEditorDisplayBinding.cs: New GUI for warning about modified - files. - -2005-01-11 Lluis Sanchez Gual <lluis@novell.com> - - * Gui/SourceEditorDisplayBinding.cs: Use a different method for detecting - that a file change event is the result of a save operation (the current - doesn't work if the that event is delayed). - -2005-01-11 Lluis Sanchez Gual <lluis@novell.com> - - * Gui/Dialogs/ExportProjectToHtmlDialog.cs: - * InsightWindow/MethodInsightDataProvider.cs: - * InsightWindow/InsightWindow.cs: - * InsightWindow/IInsightDataProvider.cs: - * InsightWindow/IndexerInsightDataProvider.cs: - * CodeCompletion/CompletionListWindow.cs - * CodeCompletion/CompletionWindow.cs: - * CodeCompletion/CommentCompletionDataProvider.cs: - * CodeCompletion/ICompletionDataProvider.cs: - * CodeCompletion/CodeCompletionDataProvider.cs: - * CodeCompletion/TemplateCompletionDataProvider.cs: - * Search/DocumentIterator/WholeProjectDocumentIterator.cs: - Follow architecture changes. - -2004-12-14 Todd Berman <tberman@off.net> - - * Gui/SourceEditorDisplayBinding.cs: Finish off some code to detect - if a source file is changed externally, so it can be reloaded. - -2004-12-14 Todd Berman <tberman@off.net> - - * Gui/SourceEditorBuffer.cs: Single line commenting changed a bit. - Fixed bug #70574. - -2004-12-13 Lluis Sanchez Gual <lluis@novell.com> - - * Search/SearchReplaceUtilities.cs: - * Search/SearchStrategy/BruteForceSearchStrategy.cs: Word boundaries - can be white spaces or punctuation chars. Added new method - IsWordSeparator that checks both. - -2004-12-11 Alexandre Gomes <alexmipego@hotmail.com> - - * Gui/SourceEditorDisplayBinding.cs: Added support for the already - implemented Indent and UnIndent selection. - -2004-12-10 Alexandre Gomes <alexmipego@hotmail.com> - - * Gui/SourceEditorDisplayBinding.cs: - * Gui/SourceEditorBuffer.cs: Keys 'Home' and 'End' while having - selected text now moves to Start/End of selection instead of Start/End - of insertmark line. - -2004-12-07 Alexandre Gomes <alexmipego@hotmail.com> - - * Gui/SourceEditorDisplayBinding.cs, - * Gui/SourceEditorBuffer.cs: Added implementation for CommentCode and - UncommentCode - -2004-12-07 Lluis Sanchez Gual <lluis@novell.com> - - * Gui/Pads/CompilerMessageView.cs: Subscribe to service events using - gui-thread aware delegates. Use Runtime class to access services. - * Search/SearchReplaceInFilesManager.cs: TaskService is now gui-thread - safe, so this class can be simplified. - -2004-12-06 Lluis Sanchez Gual <lluis@novell.com> - - * InsightWindow/MethodInsightDataProvider.cs: - * InsightWindow/IndexerInsightDataProvider.cs: - * CodeCompletion/CodeCompletionData.cs: - * CodeCompletion/CommentCompletionDataProvider.cs: - * CodeCompletion/CodeCompletionDataProvider.cs: ClassBrowserIconsService - methods are now in IconService. - -2004-12-03 Alp Toker <alp@atoker.com> - - * CodeCompletion/CompletionListWindow.cs: Fix tooltip positioning. - -2004-12-03 Todd Berman <tberman@off.net> - - * Gui/SourceEditorBuffer.cs: - * Gui/SourceEditorView.cs: - * Gui/SourceEditorDisplayBinding.cs: - * CodeCompletion/CompletionListWindow.cs: - * CodeCompletion/CompletionWindow.cs: Update to new gtk# API. - -2004-11-24 Alp Toker <alp@atoker.com> - - * CodeCompletion/CodeCompletionData.cs: - * CodeCompletion/CompletionListWindow.cs: - * CodeCompletion/DeclarationViewWindow.cs: - Fix wrapping of completion documentation. - Remove redundant overload count. - Add arrow UI hint for selecting an overloaded method. - Don't reinstantiate the tooltip each time. - Ignore bogus identical overloads. - * CodeCompletion/ListWindow.cs: - Make list rendering more like Gtk+ and don't override user's font size - -2004-11-23 Alp Toker <alp@atoker.com> - - * CodeCompletion/CodeCompletionData.cs: - * CodeCompletion/CompletionListWindow.cs: - * CodeCompletion/CodeCompletionDataProvider.cs: - Initial code completion support for overloaded methods. - -2004-10-12 Gert Driesen <drieseng@users.sourceforge.net> - - * Commands/SearchCommands.cs: use alias to work around mcs change - * Search/SearchReplaceManager.cs - * Search/DocumentIterator/EditorDocumentInformation.cs - * Search/DocumentIterator/CurrentDocumentIterator.cs - * Search/DocumentIterator/DirectoryDocumentIterator.cs - * Search/DocumentIterator/WholeProjectDocumentIterator.cs - * Search/DocumentIterator/AllOpenDocumentIterator.cs - -2004-10-04 Todd Berman <tberman@off.net> - - * Gui/SourceEditorView.cs: - * CodeCompletion/ListWindow.cs: Need to use System.Char w/ - gtk-sharp-2-0 for some reason. Not sure why. - -2004-09-18 Lluis Sanchez Gual <lluis@ximian.com> - - * Gui/SourceEditorView.cs: Use the new completion window. - * CodeCompletion/CompletionListWindow.cs: New completion window for the - source editor. - * CodeCompletion/ListWindow.cs: The list window from which - CompletionListWindow inherits. - * Search/SearchReplaceInFilesManager.cs: Catch exceptions during search and - replace, and show an error message in this case. - * Search/TextIterator/ForwardTextFileIterator.cs: File.Move does not allow - overwriting files. Changed to Copy. - * Makefile.am: Added new files. - -2004-08-07 Todd Berman <tberman@off.net> - - * AssemblyInfo.cs.in: Use new ASSEMBLY_VERSION variable. - -2004-07-05 John Luke <jluke@cfl.rr.com> - - * Gui/SourceEditorDisplayBinding.cs: - * Gui/SourceEditorView.cs: remove pinvokes where possible - anything that needs to be done in unmanaged code needs to go - to gtksourceview-sharp, except g_utf8_validate for now - -2004-07-01 Todd Berman <tberman@off.net> - - * CodeCompletion/CompletionWindow.cs: Fix bug #61020, by marking the - completion window a transient for the main window. - -2004-07-01 Todd Berman <tberman@off.net> - - * CodeCompletion/CompletionWindow.cs: Sigh, this was an evil bug - to let slip, this will work far far better though. Now the completion - gui should go away properly. - -2004-06-29 Todd Berman <tberman@off.net> - - * Gui/SourceEditorDisplayBinding.cs: Removing that patch for now, - that was half-cooked. - -2004-06-28 Todd Berman <tberman@off.net> - - * Gui/SourceEditorDisplayBinding.cs: Add a FSW to monitor for external - changes to a loaded file. - -2004-06-26 Lluis Sanchez Gual <lluis@ximian.com> - - * Search/SearchReplaceManager.cs: Make sure the search starts at the current - cursor position. - - * Search/SearchReplaceUtilities.cs: Added IsWholeWordAt() method, to be - reused from all search strategies. - - * Search/SearchResult/ISearchResult.cs, - Search/SearchResult/DefaultSearchResult.cs: Removed unused - CreateDocument(). The documentInformation now returns and interface: - IDocumentInformation. - - * Search/SearchStrategy/KMPSearchStrategy.cs, - Search/SearchStrategy/WildcardSearchStrategy.cs, - Search/SearchStrategy/RegExSearchStrategy.cs: - Removed SourceEditorBuffer dependency. Everything is done through the - text iterator. - - * Search/SearchStrategy/BruteForceSearchStrategy.cs: Implemented a more - efficient search algorithm. - - * Search/DocumentIterator/IDocumentInformation.cs: New interface that - represents a file to be searched. The SourceEditorBuffer dependency has - been removed so the file don't need to be loaded. - - * Search/DocumentIterator/CurrentDocumentIterator.cs, - Search/DocumentIterator/AllOpenDocumentIterator.cs: Current property - now returns a EditorDocumentInformation instance. - - * Search/DocumentIterator/EditorDocumentInformation.cs: New File. Document - information for a file opened in the editor. - - * Search/DocumentIterator/DirectoryDocumentIterator.cs: Current property - now returns a FileDocumentInformation instance. - - * Search/DocumentIterator/WholeProjectDocumentIterator.cs: Current property - now returns a EditorDocumentInformation if the file is opened, or - FileDocumentInformation otherwise. - - * Search/DocumentIterator/IDocumentIterator.cs, - Search/DocumentIterator/ReverseDocumentIterator.cs: Current now returns a - IDocumentInformation. - - * Search/DocumentIterator/ProvidedDocumentInformation.cs: Removed. - - * Search/DocumentIterator/FileDocumentInformation.cs: New File. Document - information for a file not opened in the editor. - - * Search/DefaultFind.cs: Removed ITextIteratorBuilder dependency. Text - iterators are now created through the IDocumentInformation instance. - Added support for cancellation. - Do replacements through the textIterator instead of the document. - - * Search/SearchReplaceInFilesManager.cs: Do the search in a background - thread. - - * Search/IFind.cs: Removed ITextIteratorBuilder dependency. Added Cancel(), - SearchedFileCount and MatchCount. - - * Search/TextIterator/ITextIteratorBuilder.cs, - Search/TextIterator/ForwardTextIteratorBuilder.cs: Removed. Iterator - creation is now done through the IDocumentInformation instance. - - * Search/TextIterator/ExtendedStreamReader.cs: Extends StreamReader to - allow position change and modification of the stream (adapted from the - one in mcs). - - * Search/TextIterator/ForwardTextIterator.cs: GetCharRelative now returns - Char.MinValue if the relative position is out of the text limits. - Added ReadToEnd and Replace. Other minor fixes. - - * Search/TextIterator/ForwardTextFileIterator.cs: New iterator for files - in disk. It uses and extended StreamReader to search directly from the - disk file. - - * Search/TextIterator/ITextIterator.cs: Removed SourceEditorBuffer - dependency. - - * Makefile.am: Updated. - -2004-06-22 Todd Berman <tberman@off.net> - - * CodeCompletion/CompletionWindow.cs: Changed from Destroy to - this LostFocusListView inside ShuffleSelection. I don't think this - introduces any undo bugs. - -2004-06-21 Todd Berman <tberman@off.net> - - * Gui/SourceEditorView.cs: - * CodeCompletion/CompletionWindow.cs: - Refactor to use one static instance of the completion window across - the entire app instead of recreating it every time. Now it is accessed - via: - - CompletionWindow.ShowWindow (args); - - Everything should be functionally the same for the end user. - * CodeCompletion/CodeCompletionDataProvider.cs: - restyle, cleanup formatting. - * MonoDevelop.SourceEditor.dll.config: - Add gtksourceview-1.0 -> libgtksourceview-1.0.so.0 mapping. - -2004-06-21 Todd Berman <tberman@off.net> - - * CodeCompletion/CompletionWindow.cs: Small code cleanups. - -2004-06-11 Lluis Sanchez Gual <lluis@ximian.com> - - * CodeCompletion/CompletionWindow.cs: Make sure that EndAtomicUndo is called - when the completion list is empty. This should definitely fix the undo - issue. - -2004-06-11 Todd Berman <tberman@sevenl.net> - - * CodeCompletion/CompletionWindow.cs: pretty sure this is the undo - bug that has people all freaked out (for good reason). well, one of the - two changed lines is, the other is just to be a bit more correct. - -2004-06-10 John BouAntoun <jba-mono@optusnet.com.au> - - * Gui/Dialogs/ReplaceInFilesDialog.cs: Fix ReplaceInFilesDialog to - make it show instead of crashing MD, also made the '...' browse - button pick up current path or use default project path in the - folder selection dialog it opens up. - -2004-06-10 Todd Berman <tberman@sevenl.net> - - * Gui/SourceEditorBuffer.cs: use the win32 dll name that gtk-sharp - uses for coherence. - * Makefile.am: properly install .dll.config - * MonoDevelop.SourceEditor.dll.config: new mapping file - * Search/DocumentIterator/WholeProjectDocumentIterator.cs: remove - warning - -2004-06-10 John BouAntoun <jba-mono@optusnet.com.au> - * Gui/Dialogs/GotoLineNumberDialog.cs: made dialog close on pressing - escape key. - -2004-06-10 John BouAntoun <jba-mono@optusnet.com.au> - * Gui/SourceEditorBuffer.cs: Added g_utf8_validate check to LoadText, - refactored LoadText and LoadFile usage - * Search/DefaultFind.cs: Added check for empty string .Text property - of a source buffer in find routine. BuildTextIterator hangs on - empty strings for some reason - -2004-06-06 John Luke <jluke@cfl.rr.com> - - * Gui/SourceEditorWidget.cs: set PolicyType.Automatic for scrolling - fixes bug #58767 - -2004-05-28 Todd Berman <tberman@sevenl.net> - - * Gui/OptionPanels/CodeTemplatePanel.cs: - * CodeCompletion/CompletionWindow.cs: update to reflect gtk-sharp api - out -> ref change - -2004-05-25 Todd Berman <tberman@sevenl.net> - - * Gui/SourceEditorView.cs: Update MonodocResolver for new changes. - * CodeCompletion/CodeCompletionDataProvider.cs: Update IsAsResolver - stuff for new ParserService. - -2004-05-24 Lluis Sanchez Gual <lluis@ximian.com> - - * Gui/SourceEditorBuffer.cs: Close the files used to read the text. - - * Gui/SourceEditorView.cs: Provide the project of the current file when - creating the code completion window. - - * CodeCompletion/CodeCompletionData.cs: Removed ClassProxy stuff. - - * CodeCompletion/CompletionWindow.cs: Added project parameter to ctor. - - * CodeCompletion/ICompletionDataProvider.cs, - CodeCompletion/CommentCompletionDataProvider.cs, - CodeCompletion/TemplateCompletionDataProvider.cs, - CodeCompletion/CodeCompletionDataProvider.cs: Added project parameter - to GenerateCompletionData(). - - * InsightWindow/MethodInsightDataProvider.cs - InsightWindow/InsightWindow.cs: Added project parameter to constructor. - - * InsightWindow/IInsightDataProvider.cs, - InsightWindow/IndexerInsightDataProvider.cs: Added project parameter to - SetupDataProvider. - -2004-05-22 Todd Berman <tberman@sevenl.net> - - * Gui/SourceEditorView.cs: applied patch by Gustav Munkby <grrdev AT - gmx.net> to fix bug #58789. - -2004-05-20 Todd Berman <tberman@sevenl.net> - - * Gui/SourceEditorBuffer.cs: update to gtk-sharp from cvs. - -2004-05-17 Todd Berman <tberman@sevenl.net> - - * Gui/SourceEditorView.cs: workaround potential nullref. - -2004-05-16 Todd Berman <tberman@sevenl.net> - - * Gui/SourceEditorView.cs: Implement beta monodoc resolving. - This works only with types for right now, so its now 100% of what - you would expect. - -2004-05-09 Todd Berman <tberman@sevenl.net> - - * Gui/SourceEditorView.cs: bring current with gtk-sharp cvs. - * Gui/OptionPanels/CodeTemplatePanel.cs: ^^ - -2004-04-30 Todd Berman <tberman@sevenl.net> - - * CodeCompletion/CompletionWindow.cs: properly handle enter. - -2004-04-29 Todd Berman <tberman@sevenl.net> - - * Gui/OptionPanels/CodeTemplatePanel.cs: match gtk-sharp from cvs. - -2004-04-28 Pawel Rozanski <tokugawa@afn.no-ip.org> - - * Gui/SourceEditorDisplayBinding.cs: added a case for setting mime for - new Nemerle files. - -2004-04-27 Todd Berman <tberman@sevenl.net> - - * Gui/SourceEditorDisplayBinding.cs: workaround some to reduce the - amount of times the idle handler is called, and to reuse the delegate. - -2004-04-27 Todd Berman <tberman@sevenl.net> - - * Gui/SourceEditorBuffer.cs: - * Gui/SourceEditorView.cs: - * Gui/SourceEditorDisplayBinding.cs: update to match gsv-sharp from - cvs. - -2004-04-26 John Luke <jluke@cfl.rr.com> - - * Gui/SourceEditorDisplayBinding.cs: add python mimetype to - CanCreateContent, needs a more robust fix - -2004-04-26 Todd Berman <tberman@sevenl.net> - - * Gui/SourceEditorDisplayBinding.cs: Make goto matching brace work - a bit better. now ctrl+b ctrl+b will bring you back to the same place. - -2004-04-24 Todd Berman <tberman@sevenl.net> - - * CodeCompletion/CompletionWindow.cs: make sure to properly handle - people typing things other than whats in our window (that is legal - too... (for now ;) )). - -2004-04-24 Todd Berman <tberman@sevenl.net> - - * CodeCompletion/CodeCompletionDataProvider.cs: hook into is/as resolve - method. - -2004-04-23 Todd Berman <tberman@sevenl.net> - - * Gui/SourceEditorBuffer.cs: add a check for a 0 length iter.Char - value, closes bug #57549. - -2004-04-20 Todd Berman <tberman@sevenl.net> - - * CodeCompletion/CompletionWindow.cs: Properly attach to the lost focus - event. - * CodeCompletion/CodeCompletionDataProvider.cs: add //'d dbg info - * Gui/SourceEditorView.cs: more of the same. - -2004-04-19 Todd Berman <tberman@sevenl.net> - - * CodeCompletion/CodeCompletionDataProvider.cs: Wrap docs. - -2004-04-19 Todd Berman <tberman@sevenl.net> - - * Gui/SourceEditorView.cs: call the right resolver method. - * CodeCompletion/CodeCompletionDataProvider.cs: Add IParameter results. - * CodeCompletion/CodeCompletionData.cs: Add IParameter ctor. - -2004-04-16 Todd Berman <tberman@sevenl.net> - - * Gui/SourceEditorBuffer.cs: On load, place the cursor at the top - and grab focus. - -2004-04-12 Nick Drochak <ndrochak@gol.com> - - * Gui/SourceEditorView.cs: Use white space already on the line to - indent the 2nd and following lines of an inserted template. - -2004-04-10 Todd Berman <tberman@sevenl.net> - - * Gui/SourceEditorView.cs: fix logic bug. - -2004-04-10 Todd Berman <tberman@sevenl.net> - - * CodeCompletion/CompletionWindow.cs: convert to RenderIcon and away - from stock-id, because of gtk+2.4 sizing issues. - -2004-04-10 Todd Berman <tberman@sevenl.net> - - * Gui/SourceEditorView.cs: cleanup the delete line func. - -2004-04-09 Todd Berman <tberman@sevenl.net> - - * Gui/SourceEditorBuffer.cs: - * CodeCompletion/CompletionWindow.cs: - add atomic undo on code completion, cause its scary now. - -2004-04-09 Todd Berman <tberman@sevenl.net> - - * Gui/SourceEditorBuffer.cs: - * Gui/SourceEditorView.cs: - * CodeCompletion/ICompletionData.cs: - * CodeCompletion/CodeCompletionData.cs: - * CodeCompletion/CompletionWindow.cs: - * CodeCompletion/CommentCompletionDataProvider.cs: - * CodeCompletion/TemplateCompletionDataProvider.cs: - add support for xcode style type ahead completion. It looks cool, and - is actually pretty useful. - - -2004-04-03 Todd Berman <tberman@sevenl.net> - - * Gui/SourceEditorView.cs: - * Gui/SourceEditorDisplayBinding.cs: attempt to solve gtk+ threading - issues - -2004-04-03 Todd Berman <tberman@sevenl.net> - - * Gui/Dialogs/ReplaceInFilesDialog.cs: - * Gui/SourceEditorView.cs: - * Gui/Pads/CompilerMessageView.cs: - * Gui/OptionPanels/BehaviorTextEditorPanel.cs: - * Gui/OptionPanels/MarkersTextEditorPanel.cs: - * Gui/OptionPanels/CodeTemplatePanel.cs: - * Gui/OptionPanels/GeneralTextEditorPanel.cs: - * Gui/SourceEditorDisplayBinding.cs: - * Search/SearchReplaceManager.cs: - * Search/SearchReplaceInFilesManager.cs: - gettextify - -2004-04-03 Todd Berman <tberman@sevenl.net> - - * Commands/ToolCommands.cs: - * Gui/Dialogs/ReplaceDialog.cs: - * Gui/Dialogs/EditTemplateGroupDialog.cs: - Gettextify - -2004-04-01 Todd Berman <tberman@sevenl.net> - - * CodeCompletion/TextUtilities.cs: if we are already caching the string - might as well use it. - -2004-03-29 Todd Berman <tberman@sevenl.net> - - * Gui/SourceEditorDisplayBinding.cs: second half of the double clicking - not setting focus properly, in specific this is a gtk+ 2.4 regression, - bug filed: http://bugzilla.gnome.org/show_bug.cgi?id=138458 - -2004-03-29 Todd Berman <tberman@sevenl.net> - - * Gui/SourceEditorDisplayBinding.cs: properly mark IsReadOnly - -2004-03-28 Todd Berman <tberman@sevenl.net> - - * CodeCompletion/CodeCompletionDataProvider.cs: adding null check, - should be the last of the code completion bugs relating to the new code - -2004-03-28 Todd Berman <tberman@sevenl.net> - - * CodeCompletion/CompletionWindow.cs: apply patch from Haakon Nilsen - <haakon AT ii.uib.no> to fix completion window on KDE. - -2004-03-28 John Luke <jluke@cfl.rr.com> - - * Gui/SourceEditorDisplayBinding.cs: - implement IsReadOnly, fix language to be a switch statement - -2004-03-27 Todd berman <tberman@sevenl.net> - - * CodeCompletion/CodeCompletionDataProvider.cs: use the - ExpressionFinder if it exists. - -2004-03-27 Todd Berman <tberman@sevenl.net> - - * CodeCompletion/CodeCompletionDataProvider.cs: add refactorying of - AddResolveResults. - -2004-03-27 Todd Berman <tberman@sevenl.net> - - * CodeCompletion/*Provider.cs: - * InsightWindow/*Provider.cs: update to reflect parser differences. - -2004-03-26 John Luke <jluke@cfl.rr.com> - - * Gui/SourceEditorView.xs: add DeleteLine for control + L and - shift + delete, bug #55993 - -2004-03-26 Todd Berman <tberman@sevenl.net> - - * Gui/SourceEditorView.cs: - * CodeCompletion/CompletionWindow.cs: now, ctrl+space will autocomplete - the entire thing if there is only one match. - -2004-03-25 Todd Berman <tberman@sevenl.net> - - * Gui/SourceEditorView.cs: setup completionWindow to be reused properly - * CodeCompletion/CompletionWindow.cs: delay a bit before movement to - attempt to fix correct placement issues. this goes from working - properly 90% of the time to 99% of the time. - -2004-03-25 Todd Berman <tberman@sevenl.net> - - * Gui/SourceEditorView.cs: - * CodeCompletion/TextUtilities.cs: - * CodeCompletion/CompletionWindow.cs: - * CodeCompletion/ICompletionDataProvider.cs: - * CodeCompletion/CommentCompletionDataProvider.cs: - * CodeCompletion/CodeCompletionDataProvider.cs: - * CodeCompletion/TemplateCompletionDataProvider.cs: - Lots of changes to allow for ctrl+space code completion - activation. Most of the changes revolve around removing the - assumption that the completion window is shown when the text - insert mark is right after the triggering character. - -2004-03-25 Todd Berman <tberman@sevenl.net> - - * Properties/TextEditorProperties.cs: add a EnableCodeCompletion prop - * Gui/SourceEditorDisplayBinding.cs: - * Gui/SourceEditorView.cs: hookup EnabledCodeCompletion prop - * Gui/OptionPanels/GeneralTextEditorProperties: sensify checkbox - -2004-03-25 Todd Berman <tberman@sevenl.net> - - * CodeCompletion/CompletionWindow.cs: fix bug that didnt allow you to - enter shift+p or shift+n. - -2004-03-25 Todd Berman <tberman@sevenl.net> - - * CodeCompletion/CompletionWindow.cs: fix bug where the first item - in the list was never being touched due to a for loop miscue. - -2004-03-25 Todd Berman <tberman@sevenl.net> - - * Gui/SourceEditorView.cs: insert the character, *then* start the code - completion window, this results in the code completion window showing - up in the correct place (under the cursor, not under the previous char) - -2004-03-25 Todd Berman <tberman@sevenl.net> - - * CodeCompletion/CompletionWindow.cs: only UnselectAll when you have - a better option, otherwise stay where you are. - -2004-03-25 Todd Berman <tberman@sevenl.net> - - * CodeCompletion/CompletionWindow.cs: add proper checking on when - to close the window based on backspacing. diff --git a/extras/GtkSourceViewEditor/EditorBindings.glade b/extras/GtkSourceViewEditor/EditorBindings.glade deleted file mode 100644 index fc56b74cb3..0000000000 --- a/extras/GtkSourceViewEditor/EditorBindings.glade +++ /dev/null @@ -1,1919 +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="GtkWindow" id="GeneralTextEditorPanel"> - <property name="visible">True</property> - <property name="title">GeneralTextEditorPanel</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</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_NORMAL</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <property name="focus_on_map">True</property> - <property name="urgency_hint">False</property> - - <child> - <widget class="GtkVBox" id="vbox37"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkVBox" id="vbox38"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="genOptions"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>General Options</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</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">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox20"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label38"> - <property name="visible">True</property> - <property name="label" translatable="yes"> </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.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="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox41"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkCheckButton" id="enableCodeCompletionCheckBox"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Enable code _completion</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="enableAutoCorrectionCheckBox"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Enable error underlining as you type</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="enableFoldingCheckBox"> - <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Enable code _folding</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="showClassMethodCheckBox"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Show Class & Method combos</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox39"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="fontOptions"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Font</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</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">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox21"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label39"> - <property name="visible">True</property> - <property name="label" translatable="yes"> </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.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="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox44"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkRadioButton" id="use_monospace"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Use default _monospace font</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkRadioButton" id="use_sans"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Use default _sans-serif font</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <property name="group">use_monospace</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox53"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">4</property> - - <child> - <widget class="GtkRadioButton" id="use_cust"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Use custom font:</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <property name="group">use_monospace</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox28"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label50"> - <property name="width_request">30</property> - <property name="visible">True</property> - <property name="label" translatable="yes"></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.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="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkFontButton" id="fontNameDisplayTextBox"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="show_style">True</property> - <property name="show_size">True</property> - <property name="use_font">True</property> - <property name="use_size">True</property> - <property name="focus_on_click">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="encodingBox"> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="encOptions"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>File encoding</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</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">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox22"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label40"> - <property name="visible">True</property> - <property name="label" translatable="yes"> </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.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="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox43"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="encVBox"> - <property name="visible">True</property> - <property name="label" translatable="yes">Choose _encoding</property> - <property name="use_underline">True</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.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="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkComboBox" id="textEncodingComboBox"> - <property name="visible">True</property> - <property name="add_tearoffs">False</property> - <property name="focus_on_click">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - -<widget class="GtkWindow" id="MarkersTextEditorPanel"> - <property name="visible">True</property> - <property name="title">MarkersTextEditorPanel</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</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_NORMAL</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <property name="focus_on_map">True</property> - <property name="urgency_hint">False</property> - - <child> - <widget class="GtkVBox" id="vbox45"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkVBox" id="vbox47"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="markersLabel"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Markers</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</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">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox24"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label42"> - <property name="width_request">18</property> - <property name="visible">True</property> - <property name="label" translatable="yes"> -</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.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="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox49"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkCheckButton" id="showLineNumberCheckBox"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Show _line numbers</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="showBracketHighlighterCheckBox"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Highlight _matching bracket</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="highlightCurrentLineCheckBox"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Hi_ghlight current line</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="highlightSpacesCheckBox"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Highlight space characters</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="highlightTabsCheckBox"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Highlight tab characters</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="highlightNewlinesCheckBox"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Highlight newline characters</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox46"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="rulersLabel"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Rulers</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</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">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox23"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label41"> - <property name="width_request">18</property> - <property name="visible">True</property> - <property name="label" translatable="yes"></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.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="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox48"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkHBox" id="hbox26"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">3</property> - - <child> - <widget class="GtkCheckButton" id="showVRulerCheckBox"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Show _column ruler,</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="atColumnLabel"> - <property name="visible">True</property> - <property name="label" translatable="yes">at column:</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.490000009537</property> - <property name="xpad">1</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">showVRulerCheckBox</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">False</property> - </packing> - </child> - - <child> - <widget class="GtkSpinButton" id="vRulerRowTextBox"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">True</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">85 0 1000 5 10 10</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox65"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label61"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Wrap Mode</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</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">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox33"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label62"> - <property name="width_request">18</property> - <property name="visible">True</property> - <property name="label" translatable="yes"></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.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="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label63"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Wrap mode: </property> - <property name="use_underline">True</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.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="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkComboBox" id="wrapModeComboBox"> - <property name="visible">True</property> - <property name="items" translatable="yes">None -Char -Word -WordChar</property> - <property name="add_tearoffs">False</property> - <property name="focus_on_click">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label64"> - <property name="visible">True</property> - <property name="label" translatable="yes"></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.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_END</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">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - -<widget class="GtkWindow" id="BehaviorTextEditorPanel"> - <property name="visible">True</property> - <property name="title">BehaviorTextEditorPanel</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</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_NORMAL</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <property name="focus_on_map">True</property> - <property name="urgency_hint">False</property> - - <child> - <widget class="GtkVBox" id="vbox54"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkVBox" id="vbox55"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="tabsGroupBoxLabel"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Tabs</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</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">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox29"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label51"> - <property name="visible">True</property> - <property name="label" translatable="yes"> </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.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="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox57"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="indentLabel"> - <property name="visible">True</property> - <property name="label" translatable="yes">I_ndentation</property> - <property name="use_underline">True</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="mnemonic_widget">noneIndentStyle</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">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox31"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label54"> - <property name="visible">True</property> - <property name="label" translatable="yes"> </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.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="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox59"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkRadioButton" id="noneIndentStyle"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">None</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkRadioButton" id="automaticIndentStyle"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Automatic</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <property name="group">noneIndentStyle</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkRadioButton" id="smartIndentStyle"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Smart</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <property name="group">noneIndentStyle</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="indentAndTabSizeBox"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="tabSizeLabel"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Tab and indentation size</property> - <property name="use_underline">True</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.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">indentAndTabSizeSpinButton</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">False</property> - </packing> - </child> - - <child> - <widget class="GtkSpinButton" id="indentAndTabSizeSpinButton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">True</property> - <property name="update_policy">GTK_UPDATE_IF_VALID</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">4 1 40 1 4 10</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="convertTabsToSpacesCheckBox"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">C_onvert Tabs to Spaces</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox56"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="behaviourGroupBoxLabel"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Behavior</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</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">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox30"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label52"> - <property name="visible">True</property> - <property name="label" translatable="yes"> </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.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="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox60"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkCheckButton" id="autoInsertTemplatesCheckBox"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Automatic template insertion</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="autoinsertCurlyBraceCheckBox"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">A_uto insert curly braces</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</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> - -<widget class="GtkWindow" id="SyntaxHighlightingPanel"> - <property name="height_request">460</property> - <property name="visible">True</property> - <property name="title">window1</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</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_NORMAL</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <property name="focus_on_map">True</property> - <property name="urgency_hint">False</property> - - <child> - <widget class="GtkVBox" id="vbox61"> - <property name="height_request">500</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkCheckButton" id="enableSyntaxHighlighting"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Enable syntax highlighting</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="OnHighlightingToggled" last_modification_time="Sat, 02 Apr 2005 17:17:08 GMT"/> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="childrenVBox"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkHBox" id="hbox34"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label65"> - <property name="visible">True</property> - <property name="label" translatable="yes">File type:</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.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="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkComboBox" id="sourceLanguages"> - <property name="visible">True</property> - <property name="add_tearoffs">False</property> - <property name="focus_on_click">True</property> - <signal name="changed" handler="OnLanguageSelected" last_modification_time="Sat, 02 Apr 2005 05:35:28 GMT"/> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label58"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Elements</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</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">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox32"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow5"> - <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="GtkTreeView" id="stylesTreeView"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="headers_visible">False</property> - <property name="rules_hint">False</property> - <property name="reorderable">False</property> - <property name="enable_search">True</property> - <property name="fixed_height_mode">False</property> - <property name="hover_selection">False</property> - <property name="hover_expand">False</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox62"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkToggleButton" id="boldToggle"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-bold</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_HALF</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <signal name="toggled" handler="OnButtonToggled" last_modification_time="Sat, 02 Apr 2005 17:18:07 GMT"/> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkToggleButton" id="italicToggle"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-italic</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_HALF</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <signal name="toggled" handler="OnButtonToggled" last_modification_time="Sat, 02 Apr 2005 17:18:23 GMT"/> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkToggleButton" id="underlineToggle"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-underline</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_HALF</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <signal name="toggled" handler="OnButtonToggled" last_modification_time="Sat, 02 Apr 2005 17:18:38 GMT"/> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkToggleButton" id="strikeToggle"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-strikethrough</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_HALF</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <signal name="toggled" handler="OnButtonToggled" last_modification_time="Sat, 02 Apr 2005 17:18:53 GMT"/> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox63"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkCheckButton" id="checkColor"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Color:</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <signal name="clicked" handler="OnColorSet" last_modification_time="Tue, 13 Feb 2007 16:14:12 GMT"/> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkColorButton" id="fgColorButton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="use_alpha">False</property> - <property name="focus_on_click">True</property> - <signal name="color_set" handler="OnColorSet" last_modification_time="Sat, 02 Apr 2005 17:17:34 GMT"/> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox64"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkCheckButton" id="checkBackground"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Background:</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <signal name="clicked" handler="OnColorSet" last_modification_time="Tue, 13 Feb 2007 16:14:02 GMT"/> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkColorButton" id="bgColorButton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="use_alpha">False</property> - <property name="focus_on_click">True</property> - <signal name="color_set" handler="OnColorSet" last_modification_time="Sat, 02 Apr 2005 17:17:48 GMT"/> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="restoreDefaultButton"> - <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Restore default</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <signal name="clicked" handler="OnRestoreClicked" last_modification_time="Sat, 02 Apr 2005 06:54:14 GMT"/> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</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/extras/GtkSourceViewEditor/Makefile.am b/extras/GtkSourceViewEditor/Makefile.am deleted file mode 100644 index 4bd0c858d3..0000000000 --- a/extras/GtkSourceViewEditor/Makefile.am +++ /dev/null @@ -1,81 +0,0 @@ -DLLNAME = MonoDevelop.SourceEditor.dll -ASSEMBLY = $(top_builddir)/build/AddIns/$(DLLNAME) - -FILES = \ - AssemblyInfo.cs \ - gtk-gui/generated.cs \ - MonoDevelop.SourceEditor.Actions/DefaultEditActions.cs \ - MonoDevelop.SourceEditor.Actions/EditActionCollection.cs \ - MonoDevelop.SourceEditor.Actions/IEditAction.cs \ - MonoDevelop.SourceEditor.Codons/EditActionCodon.cs \ - MonoDevelop.SourceEditor.FormattingStrategy/DefaultFormattingStrategy.cs \ - MonoDevelop.SourceEditor.FormattingStrategy/IFormattingStrategy.cs \ - MonoDevelop.SourceEditor.Gui.Dialogs/EditTemplateGroupDialog.cs \ - MonoDevelop.SourceEditor.Gui.Dialogs/GotoLineNumberDialog.cs \ - MonoDevelop.SourceEditor.Gui.OptionPanels/BehaviorTextEditorPanel.cs \ - MonoDevelop.SourceEditor.Gui.OptionPanels/GeneralTextEditorPanel.cs \ - MonoDevelop.SourceEditor.Gui.OptionPanels/MarkersTextEditorPanel.cs \ - MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs \ - MonoDevelop.SourceEditor.Gui/LanguageItemWindow.cs \ - MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs \ - MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs \ - MonoDevelop.SourceEditor.Gui/SourceEditorView.cs \ - MonoDevelop.SourceEditor.Gui/SourceEditorWidget.cs \ - MonoDevelop.SourceEditor.Gui/TextNavigationPoint.cs \ - MonoDevelop.SourceEditor/EditorCommands.cs \ - MonoDevelop.SourceEditor/Services.cs \ - MonoDevelop.SourceEditor/SourceViewService.cs - -RES = \ - bookmark.png \ - EditorBindings.glade \ - gtk-gui/gui.stetic \ - gtk-gui/objects.xml \ - MonoDevelop.SourceEditor.addin.xml \ - texteditoraddin.glade - -DEPS = \ - $(top_builddir)/build/bin/MonoDevelop.Components.dll \ - $(top_builddir)/build/bin/MonoDevelop.Core.dll \ - $(top_builddir)/build/bin/MonoDevelop.Core.Gui.dll \ - $(top_builddir)/build/bin/MonoDevelop.Ide.dll \ - $(top_builddir)/build/bin/MonoDevelop.Projects.dll \ - $(top_builddir)/build/bin/MonoDevelop.Projects.Gui.dll - -REFS = \ - $(GCONF_SHARP_LIBS) \ - $(GLADE_SHARP_LIBS) \ - $(GLIB_SHARP_LIBS) \ - $(GNOME_VFS_SHARP_LIBS) \ - $(GTK_SHARP_LIBS) \ - $(GTKSOURCEVIEW2_SHARP_LIBS) \ - $(MONO_ADDINS_LIBS) \ - -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:$(top_builddir)/build/bin/MonoDevelop.Projects.dll \ - -r:$(top_builddir)/build/bin/MonoDevelop.Projects.Gui.dll \ - -r:Mono.Cairo \ - -r:Mono.Posix \ - -r:System \ - -r:System.Drawing \ - -r:System.Xml - -ADDIN_BUILD = $(top_builddir)/build/AddIns - -all: $(ASSEMBLY) - -$(ASSEMBLY) : $(build_sources) $(build_resources) $(DEPS) - mkdir -p $(top_builddir)/build/bin - $(CSC) $(CSC_FLAGS) $(build_resources:%=/resource:%) $(build_sources) -out:$@ -t:library $(REFS) - -assemblydir = $(MD_ADDIN_DIR) -assembly_DATA = $(ASSEMBLY) $(ASSEMBLY).mdb - -CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb - -EXTRA_DIST = $(FILES) $(RES) - -include $(top_srcdir)/Makefile.include - diff --git a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Actions/DefaultEditActions.cs b/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Actions/DefaultEditActions.cs deleted file mode 100644 index 6a5cde77a2..0000000000 --- a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Actions/DefaultEditActions.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using MonoDevelop.SourceEditor.Gui; - -namespace MonoDevelop.SourceEditor.Actions -{ - // indents the next line using the FormattingStrategy - public class Return : AbstractEditAction - { - public override void PreExecute (SourceEditorView sourceView) - { - PassToBase = true; - } - - public override void Execute (SourceEditorView sourceView) - { - sourceView.FormatLine (); - PassToBase = false; - } - } - - public class Tab : AbstractEditAction - { - public override void Execute (SourceEditorView sourceView) - { - if (!sourceView.InsertTemplate ()) - PassToBase = true; - } - } -} - diff --git a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Actions/EditActionCollection.cs b/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Actions/EditActionCollection.cs deleted file mode 100644 index 95ace4a666..0000000000 --- a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Actions/EditActionCollection.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections; -using MonoDevelop.SourceEditor.Gui; - -namespace MonoDevelop.SourceEditor.Actions -{ - public sealed class EditActionCollection //: IEnumerable - { - ArrayList actions = new ArrayList (); - - public void Add (IEditAction action) - { - actions.Add (action); - } - - /* requires C# 2.0 for iterators - public IEnumerator GetEnumerator () - { - foreach (IEditAction action in actions) - yield return action; - } - */ - - public IEditAction GetAction (Gdk.Key key, Gdk.ModifierType state) - { - // some problematic ones have to be filtered - Gdk.ModifierType filteredState = state & ~(Gdk.ModifierType.LockMask | Gdk.ModifierType.Mod2Mask); - foreach (IEditAction action in actions) - { - if (action.State == filteredState && action.Key == key) - return action; - } - - return null; - } - } -} - diff --git a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Actions/IEditAction.cs b/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Actions/IEditAction.cs deleted file mode 100644 index d6ba76f19d..0000000000 --- a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Actions/IEditAction.cs +++ /dev/null @@ -1,123 +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.SourceEditor.Gui; - -namespace MonoDevelop.SourceEditor.Actions -{ - /// <summary> - /// To define a new key for the textarea, you must write a class which - /// implements this interface. - /// </summary> - public interface IEditAction - { - /// <value> - /// Whether to pass the event to the base editor - /// <value> - bool PassToBase { - get; - set; - } - - /// <value> - /// An array of keys on which this edit action occurs. - /// </value> - Gdk.Key Key { - get; - set; - } - - Gdk.ModifierType State { - get; - set; - } - - /// <remarks> - /// When the key which is defined in the addin is pressed, this method will be invoked. - /// </remarks> - void Execute (SourceEditorView sourceView); - - /// <remarks> - /// Invoked before the Execute method - /// <remarks> - void PreExecute (SourceEditorView sourceView); - - /// <remarks> - /// Invoked after the Execute method - /// <remarks> - void PostExecute (SourceEditorView sourceView); - } - - /// <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.ModifierType modifier = Gdk.ModifierType.None; - Gdk.Key key; - bool pass = false; - - // whether to pass the event to the base editor - public bool PassToBase { - get { return pass; } - set { pass = value; } - } - - /// <value> - /// An array of keys on which this edit action occurs. - /// </value> - public Gdk.Key Key - { - get { return key; } - set { key = value; } - } - - public Gdk.ModifierType State { - get { return modifier; } - set { modifier = value; } - } - - /// <remarks> - /// When the key which is defined in the addin is pressed, this method will be invoked. - /// </remarks> - public abstract void Execute (SourceEditorView sourceView); - - /// <remarks> - /// When the key which is defined in the addin is pressed, - /// this method will be invoked before Execute (). - /// </remarks> - public virtual void PreExecute (SourceEditorView sourceView) - { - } - - /// <remarks> - /// When the key which is defined in the addin is pressed, - /// this method will be invoked after Execute (). - /// </remarks> - public virtual void PostExecute (SourceEditorView sourceView) - { - // reset the state - pass = false; - } - } -} - diff --git a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Codons/EditActionCodon.cs b/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Codons/EditActionCodon.cs deleted file mode 100644 index 2eda884d1f..0000000000 --- a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Codons/EditActionCodon.cs +++ /dev/null @@ -1,123 +0,0 @@ -// EditActionCodon.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.ComponentModel; - -using Mono.Addins; -using MonoDevelop.Core; -using MonoDevelop.Core.Gui.Components; -using MonoDevelop.SourceEditor.Actions; - -namespace MonoDevelop.SourceEditor.Codons -{ - [ExtensionNode (Description="A custom editor action. The provided class must implement IEditAction.")] - public class EditActionCodon : TypeExtensionNode - { - [NodeAttribute("keys", true, "Key combinations that trigger the edit action (for example Control|k).")] - string[] keys = null; - - public string[] Keys { - get { return keys; } - set { keys = value; } - } - - /// <summary> - /// Creates an item with the specified sub items. And the current - /// Condition status for this item. - /// </summary> - public override object CreateInstance () - { - IEditAction editAction = (IEditAction) base.CreateInstance (); - if (editAction == null) - return null; - - // basically, we want to take a string like: - // Control|J and turn it into the value to trigger the edit action - // in GTK+ lingo that is a Gdk.Key and Gdk.ModifierType - // we assume the order is Modifier|Modifier|Key - Gdk.Key key = Gdk.Key.VoidSymbol; - Gdk.ModifierType state = Gdk.ModifierType.None; - for (int i = 0; i < keys.Length; i++) { - string[] keydescr = keys[i].Split ('|'); - - // the last keydescr is the Gdk.Key - key = (Gdk.Key) Enum.Parse (typeof (Gdk.Key), keydescr[keydescr.Length - 1]); - - // the rest, if any, are modifiers - for (int j = 0; j < keydescr.Length - 1; j++) { - // FIXME: newer gdk's have more values here - switch (keydescr[j]) { - // ignore the buttons - case "Button1": - case "Button2": - case "Button3": - case "Button4": - case "Button5": - break; - case "Control": - state |= Gdk.ModifierType.ControlMask; - break; - // Caps Lock or Shift Lock - case "Lock": - state |= Gdk.ModifierType.LockMask; - break; - // this is normally Alt - case "Alt": - case "Mod1": - state |= Gdk.ModifierType.Mod1Mask; - break; - case "Mod2": - state |= Gdk.ModifierType.Mod2Mask; - break; - case "Mod3": - state |= Gdk.ModifierType.Mod3Mask; - break; - case "Mod4": - state |= Gdk.ModifierType.Mod4Mask; - break; - case "Mod5": - state |= Gdk.ModifierType.Mod5Mask; - break; - // all the modifiers - case "Modifier": - state |= Gdk.ModifierType.ModifierMask; - break; - // ignore internal to GTK+ - case "Release": - break; - case "Shift": - state |= Gdk.ModifierType.ShiftMask; - break; - default: - break; - } - } - } - - editAction.Key = key; - editAction.State = state; - - return editAction; - } - } -} diff --git a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.FormattingStrategy/DefaultFormattingStrategy.cs b/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.FormattingStrategy/DefaultFormattingStrategy.cs deleted file mode 100644 index d4ed9889df..0000000000 --- a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.FormattingStrategy/DefaultFormattingStrategy.cs +++ /dev/null @@ -1,108 +0,0 @@ -// DefaultFormattingStrategy.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.Collections; - -using MonoDevelop.Ide.Gui; -using MonoDevelop.Ide.Gui.Content; - -namespace MonoDevelop.SourceEditor.FormattingStrategy -{ - /// <summary> - /// This class handles the auto and smart indenting in the textbuffer while - /// you type. - /// </summary> - public class DefaultFormattingStrategy : IFormattingStrategy { - /// <summary> - /// returns the whitespaces which are before a non white space character in the line - /// as a string. - /// </summary> - protected string GetIndentation (TextEditor d, int lineNumber) - { - string lineText = d.GetLineText (lineNumber); - StringBuilder whitespaces = new StringBuilder (); - - foreach (char ch in lineText) { - if (! Char.IsWhiteSpace (ch)) - break; - whitespaces.Append (ch); - } - - return whitespaces.ToString (); - } - - /// <summary> - /// Could be overwritten to define more complex indenting. - /// </summary> - protected virtual int AutoIndentLine (TextEditor d, int lineNumber, string indentString) - { - string indentation = lineNumber != 0 ? GetIndentation (d, lineNumber - 1) : ""; - - if (indentation.Length > 0) { - string newLineText = indentation + d.GetLineText (lineNumber).Trim (); - d.ReplaceLine (lineNumber, newLineText); - } - - return indentation.Length; - } - - /// <summary> - /// Could be overwritten to define more complex indenting. - /// </summary> - protected virtual int SmartIndentLine (TextEditor d, int line, string indentString) - { - return AutoIndentLine (d, line, indentString); // smart = autoindent in normal texts - } - - /// <summary> - /// This function formats a specific line after <code>ch</code> is pressed. - /// </summary> - /// <returns> - /// the caret delta position the caret will be moved this number - /// of bytes (e.g. the number of bytes inserted before the caret, or - /// removed, if this number is negative) - /// </returns> - public virtual int FormatLine (TextEditor d, int line, int cursorOffset, char ch, string indentString, bool autoInsertCurlyBracket) - { - if (ch == '\n') - return IndentLine (d, line, indentString); - - return 0; - } - - /// <summary> - /// This function sets the indentation level in a specific line - /// </summary> - /// <returns> - /// the number of inserted characters. - /// </returns> - public int IndentLine (TextEditor d, int line, string indentString) - { - switch (TextEditorProperties.IndentStyle) { - case IndentStyle.Auto : return AutoIndentLine (d, line, indentString); - case IndentStyle.Smart : return SmartIndentLine (d, line, indentString); - case IndentStyle.None : - default : return 0; - } - } - } -} diff --git a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.FormattingStrategy/IFormattingStrategy.cs b/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.FormattingStrategy/IFormattingStrategy.cs deleted file mode 100644 index db60ae4210..0000000000 --- a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.FormattingStrategy/IFormattingStrategy.cs +++ /dev/null @@ -1,31 +0,0 @@ - -using MonoDevelop.Ide.Gui; - -namespace MonoDevelop.SourceEditor.FormattingStrategy -{ - /// <summary> - /// This interface handles the auto and smart indenting and formating - /// in the document while you type. Language bindings could overwrite this - /// interface and define their own indentation/formating. - /// </summary> - public interface IFormattingStrategy { - - /// <summary> - /// This function formats a specific line after <code>ch</code> is pressed. - /// </summary> - /// <returns> - /// the caret delta position the caret will be moved this number - /// of bytes (e.g. the number of bytes inserted before the caret, or - /// removed, if this number is negative) - /// </returns> - int FormatLine (TextEditor editor, int line, int caretOffset, char charTyped, string indentString, bool autoInsertCurlyBracket); - - /// <summary> - /// This function sets the indentation level in a specific line - /// </summary> - /// <returns> - /// the number of inserted characters. - /// </returns> - int IndentLine (TextEditor editor, int line, string indentString); - } -} diff --git a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui.Dialogs/EditTemplateGroupDialog.cs b/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui.Dialogs/EditTemplateGroupDialog.cs deleted file mode 100644 index 58ef5b89fc..0000000000 --- a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui.Dialogs/EditTemplateGroupDialog.cs +++ /dev/null @@ -1,97 +0,0 @@ -// EditTemplateGroupDialog.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 MonoDevelop.Ide.CodeTemplates; -using MonoDevelop.Core; - -namespace MonoDevelop.SourceEditor.Gui.Dialogs -{ - public class EditTemplateGroupDialog : Gtk.Dialog - { - CodeTemplateGroup codeTemplateGroup; - string titlePrefix = string.Empty; - - // Gtk members - Gtk.Entry templateExtensionsTextBox; - - public CodeTemplateGroup CodeTemplateGroup { - get { - return codeTemplateGroup; - } - } - - public EditTemplateGroupDialog(CodeTemplateGroup codeTemplateGroup, string titlePrefix) - { - this.codeTemplateGroup = codeTemplateGroup; - this.titlePrefix = titlePrefix; - InitializeComponents(); - this.ShowAll(); - } - - void AcceptEvent(object sender, EventArgs e) - { - codeTemplateGroup.ExtensionStrings = templateExtensionsTextBox.Text.Split(';'); - - // close the window - CancelEvent(sender, EventArgs.Empty); - } - - void CancelEvent(object sender, EventArgs e) - { - this.Destroy(); - } - - void InitializeComponents() - { - // set up this actual dialog - this.Modal = true; - // FIXME: make this a resource in the resource file - this.Title = String.Format (GettextCatalog.GetString ("{0} Code Group"), titlePrefix); - - // set up the dialog fields and add them - templateExtensionsTextBox = new Gtk.Entry(); - templateExtensionsTextBox.ActivatesDefault = true; - // FIXME: make this a resource in the resource file - Gtk.Label label1 = new Gtk.Label("Extensions (; seperated)"); - - label1.Xalign = 0; - templateExtensionsTextBox.Text = string.Join(";", codeTemplateGroup.ExtensionStrings); - - // FIXME: make the labels both part of the same sizing group so they have the same left and right rows. - Gtk.HBox hBox1 = new Gtk.HBox(false, 6); - hBox1.PackStart(label1, false, false, 6); - hBox1.PackStart(templateExtensionsTextBox, false, false, 6); - - this.VBox.PackStart(hBox1, false, false, 6); - - // set up the buttons and add them - this.DefaultResponse = Gtk.ResponseType.Ok; - Gtk.Button cancelButton = new Gtk.Button(Gtk.Stock.Cancel); - Gtk.Button okButton = new Gtk.Button(Gtk.Stock.Ok); - okButton.Clicked += new EventHandler(AcceptEvent); - cancelButton.Clicked += new EventHandler(CancelEvent); - this.AddActionWidget (cancelButton, Gtk.ResponseType.Cancel); - this.AddActionWidget (okButton, (int) Gtk.ResponseType.Ok); - } - } -} diff --git a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui.Dialogs/GotoLineNumberDialog.cs b/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui.Dialogs/GotoLineNumberDialog.cs deleted file mode 100644 index 6f4ab08223..0000000000 --- a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui.Dialogs/GotoLineNumberDialog.cs +++ /dev/null @@ -1,91 +0,0 @@ -// GotoLineNumberDialog.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.Resources; - -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui; -using MonoDevelop.Ide.Gui.Content; - -using Gtk; -using Glade; - -namespace MonoDevelop.SourceEditor.Gui.Dialogs -{ - public class GotoLineNumberDialog : IDisposable - { - public static bool IsVisible = false; - - [Widget] Dialog GotoLineDialog; - [Widget] Entry line_number_entry; - - public GotoLineNumberDialog () - { - new Glade.XML (null, "texteditoraddin.glade", "GotoLineDialog", null).Autoconnect (this); - GotoLineDialog.Close += new EventHandler(on_btn_close_clicked); - } - - public void Run () - { - GotoLineDialog.TransientFor = IdeApp.Workbench.RootWindow; - GotoLineDialog.ShowAll (); - IsVisible = true; - GotoLineDialog.Run (); - } - - public void Hide () - { - GotoLineDialog.Hide (); - IsVisible = false; - } - - void on_btn_close_clicked (object sender, EventArgs e) - { - GotoLineDialog.Hide (); - } - - protected void on_btn_go_to_line_clicked (object sender, EventArgs e) - { - try { - IEditableTextBuffer view = IdeApp.Workbench.ActiveDocument.GetContent<IEditableTextBuffer> (); - if (view != null) { - int l = Math.Max (1, Int32.Parse(line_number_entry.Text)); - view.SetCaretTo (l, 1); - } - } catch (Exception) { - - } finally { - GotoLineDialog.Hide (); - } - } - - public void Dispose () - { - if (GotoLineDialog != null) { - GotoLineDialog.Dispose (); - GotoLineDialog = null; - line_number_entry = null; - IsVisible = false; - } - } - } -} diff --git a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/BehaviorTextEditorPanel.cs b/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/BehaviorTextEditorPanel.cs deleted file mode 100644 index dbec34c96c..0000000000 --- a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/BehaviorTextEditorPanel.cs +++ /dev/null @@ -1,113 +0,0 @@ -// BehaviorTextEditorPanel.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 Gtk; - -using MonoDevelop.Core; -using MonoDevelop.Core.Gui.Dialogs; - -using MonoDevelop.Components; - -using MonoDevelop.Ide.CodeTemplates; -using MonoDevelop.Ide.Gui.Content; - -using MonoDevelop.SourceEditor; -using MonoDevelop.SourceEditor.FormattingStrategy; - -namespace MonoDevelop.SourceEditor.Gui.OptionPanels -{ - /// <summary> - /// Summary description for Form8. - /// </summary> - public class BehaviorTextEditorPanel : OptionsPanel - { - BehaviorTextEditorPanelWidget widget; - - public override Widget CreatePanelWidget () - { - widget = new BehaviorTextEditorPanelWidget (); - return widget; - } - - public override void ApplyChanges () - { - widget.Store (); - } - - sealed class BehaviorTextEditorPanelWidget : GladeWidgetExtract - { - // GTK controls - [Glade.Widget] CheckButton autoinsertCurlyBraceCheckBox; - [Glade.Widget] CheckButton autoInsertTemplatesCheckBox; - [Glade.Widget] CheckButton convertTabsToSpacesCheckBox; - [Glade.Widget] RadioButton noneIndentStyle; - [Glade.Widget] RadioButton automaticIndentStyle; - [Glade.Widget] RadioButton smartIndentStyle; - [Glade.Widget] SpinButton indentAndTabSizeSpinButton; - - public BehaviorTextEditorPanelWidget () : - base ("EditorBindings.glade", "BehaviorTextEditorPanel") - { - // FIXME: enable when it is implemented - autoinsertCurlyBraceCheckBox.Sensitive = false; - - // Set up Values - autoinsertCurlyBraceCheckBox.Active = TextEditorProperties.AutoInsertCurlyBracket; - - autoInsertTemplatesCheckBox.Active = TextEditorProperties.AutoInsertTemplates; - - convertTabsToSpacesCheckBox.Active = TextEditorProperties.ConvertTabsToSpaces; - - //FIXME: Only one of these should be selected to hold the value - indentAndTabSizeSpinButton.Value = TextEditorProperties.TabIndent; - - IndentStyle currentIndent = TextEditorProperties.IndentStyle; - if (currentIndent == IndentStyle.None) - noneIndentStyle.Active = true; - else if (currentIndent == IndentStyle.Auto) - automaticIndentStyle.Active = true; - else if (currentIndent == IndentStyle.Smart) - smartIndentStyle.Active = true; - } - - public void Store () - { - TextEditorProperties.ConvertTabsToSpaces = convertTabsToSpacesCheckBox.Active; - TextEditorProperties.AutoInsertCurlyBracket = autoinsertCurlyBraceCheckBox.Active; - TextEditorProperties.AutoInsertTemplates = autoInsertTemplatesCheckBox.Active; - - - if (noneIndentStyle.Active) - TextEditorProperties.IndentStyle = IndentStyle.None; - else if (automaticIndentStyle.Active) - TextEditorProperties.IndentStyle = IndentStyle.Auto; - else if (smartIndentStyle.Active) - TextEditorProperties.IndentStyle = IndentStyle.Smart; - - //FIXME: Only one of these should be selected to save the value - TextEditorProperties.TabIndent = (int) indentAndTabSizeSpinButton.Value; - } - } - } -} diff --git a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/GeneralTextEditorPanel.cs b/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/GeneralTextEditorPanel.cs deleted file mode 100644 index 3d214c4f82..0000000000 --- a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/GeneralTextEditorPanel.cs +++ /dev/null @@ -1,149 +0,0 @@ -// GeneralTextEditorPanel.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.Text; -using System.Collections; - -using Gtk; -using Pango; - -using MonoDevelop.Core; -using MonoDevelop.Core.Gui.Dialogs; - -using MonoDevelop.Components; - -using MonoDevelop.Ide.Gui.Content; - -namespace MonoDevelop.SourceEditor.Gui.OptionPanels -{ - /// <summary> - /// General texteditor options panelS. - /// </summary> - class GeneralTextEditorPanel : OptionsPanel - { - GeneralTextEditorPanelWidget widget; - - public override Widget CreatePanelWidget () - { - widget = new GeneralTextEditorPanelWidget (); - return widget; - } - - public override void ApplyChanges () - { - widget.Store (); - } - - class GeneralTextEditorPanelWidget : GladeWidgetExtract - { - [Glade.Widget] CheckButton enableCodeCompletionCheckBox; - [Glade.Widget] CheckButton enableAutoCorrectionCheckBox; - [Glade.Widget] CheckButton enableFoldingCheckBox; - [Glade.Widget] CheckButton showClassMethodCheckBox; - [Glade.Widget] FontButton fontNameDisplayTextBox; - [Glade.Widget] VBox encodingBox; - [Glade.Widget] RadioButton use_monospace; - [Glade.Widget] RadioButton use_sans; - [Glade.Widget] RadioButton use_cust; - - public GeneralTextEditorPanelWidget () : base ("EditorBindings.glade", "GeneralTextEditorPanel") - { - encodingBox.Destroy(); // this is a really dirty way of hiding encodingBox, but Hide() doesn't work - enableCodeCompletionCheckBox.Active = TextEditorProperties.EnableCodeCompletion; - enableAutoCorrectionCheckBox.Active = TextEditorProperties.EnableAutoCorrection; - enableFoldingCheckBox.Active = TextEditorProperties.EnableFolding; - - showClassMethodCheckBox.Active = TextEditorProperties.ShowClassBrowser; - - switch (TextEditorProperties.FontType) { - case EditorFontType.DefaultMonospace: - use_monospace.Active = true; - fontNameDisplayTextBox.Sensitive = false; - break; - case EditorFontType.DefaultSans: - use_sans.Active = true; - fontNameDisplayTextBox.Sensitive = false; - break; - default: - use_cust.Active = true; - fontNameDisplayTextBox.FontName = TextEditorProperties.FontName; - fontNameDisplayTextBox.Sensitive = true; - break; - } - - use_monospace.Toggled += new EventHandler (ItemToggled); - use_sans.Toggled += new EventHandler (ItemToggled); - use_cust.Toggled += new EventHandler (ItemToggled); - -// encVBox.TextWithMnemonic = StringParserService.Parse( -// "${res:Dialog.Options.IDEOptions.TextEditor.General.FontGroupBox.FileEncodingLabel}"); - -// Menu m = new Menu (); -// foreach (String name in CharacterEncodings.Names) { -// m.Append (new MenuItem (name)); -// } -// textEncodingComboBox.Menu = m; - -// int i = 0; -// try { -// Console.WriteLine("Getting encoding Property"); -// i = CharacterEncodings.GetEncodingIndex( -// (Int32)((Properties) CustomizationObject).Get("Encoding", encoding)); -// } catch { -// Console.WriteLine("Getting encoding Default"); -// i = CharacterEncodings.GetEncodingIndex(encoding); -// } - -// selectedIndex = i; -// encoding = CharacterEncodings.GetEncodingByIndex(i).CodePage; - -// textEncodingComboBox.Changed += new EventHandler (OnOptionChanged); - } - - public void Store () - { - TextEditorProperties.EnableCodeCompletion = enableCodeCompletionCheckBox.Active; - TextEditorProperties.EnableAutoCorrection = enableAutoCorrectionCheckBox.Active; - TextEditorProperties.EnableFolding = enableFoldingCheckBox.Active; - TextEditorProperties.ShowClassBrowser = showClassMethodCheckBox.Active; - - if (use_monospace.Active) { - TextEditorProperties.FontType = EditorFontType.DefaultMonospace; - } else if (use_sans.Active) { - TextEditorProperties.FontType = EditorFontType.DefaultSans; - } else { - TextEditorProperties.FontName = fontNameDisplayTextBox.FontName; - } - -// Console.WriteLine (CharacterEncodings.GetEncodingByIndex (selectedIndex).CodePage); -// ((Properties) CustomizationObject).Set ( -// "Encoding",CharacterEncodings.GetEncodingByIndex (selectedIndex).CodePage); - } - - void ItemToggled (object o, EventArgs args) - { - fontNameDisplayTextBox.Sensitive = use_cust.Active; - } - } - } -} - diff --git a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/MarkersTextEditorPanel.cs b/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/MarkersTextEditorPanel.cs deleted file mode 100644 index 10140091e3..0000000000 --- a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/MarkersTextEditorPanel.cs +++ /dev/null @@ -1,106 +0,0 @@ -// MarkersTextEditorPanel.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 Gtk; - -using MonoDevelop.Components; - -using MonoDevelop.Core; -using MonoDevelop.Core.Gui.Dialogs; - -using MonoDevelop.Ide.Gui.Content; - -namespace MonoDevelop.SourceEditor.Gui.OptionPanels -{ - /// <summary> - /// Summary description for Form9. - /// </summary> - - class MarkersTextEditorPanel : OptionsPanel - { - MarkersTextEditorPanelWidget widget; - - public override Widget CreatePanelWidget () - { - // set up the form controls instance - widget = new MarkersTextEditorPanelWidget (); - return widget; - } - - public override void ApplyChanges () - { - widget.Store (); - } - - class MarkersTextEditorPanelWidget : GladeWidgetExtract - { - // Gtk Controls - [Glade.Widget] CheckButton showLineNumberCheckBox; - [Glade.Widget] CheckButton showBracketHighlighterCheckBox; - [Glade.Widget] CheckButton showVRulerCheckBox; - [Glade.Widget] CheckButton highlightCurrentLineCheckBox; - [Glade.Widget] CheckButton highlightSpacesCheckBox; - [Glade.Widget] CheckButton highlightTabsCheckBox; - [Glade.Widget] CheckButton highlightNewlinesCheckBox; - [Glade.Widget] SpinButton vRulerRowTextBox; - [Glade.Widget] ComboBox wrapModeComboBox; - - public MarkersTextEditorPanelWidget () : - base ("EditorBindings.glade", "MarkersTextEditorPanel") - { - showLineNumberCheckBox.Active = TextEditorProperties.ShowLineNumbers; - showBracketHighlighterCheckBox.Active = TextEditorProperties.ShowMatchingBracket; - - highlightCurrentLineCheckBox.Active = TextEditorProperties.HighlightCurrentLine; - - highlightSpacesCheckBox.Active = TextEditorProperties.HighlightSpaces; - highlightTabsCheckBox.Active = TextEditorProperties.HighlightTabs; - highlightNewlinesCheckBox.Active = TextEditorProperties.HighlightNewlines; - - showVRulerCheckBox.Active = TextEditorProperties.ShowVerticalRuler; - vRulerRowTextBox.Value = TextEditorProperties.VerticalRulerRow; - - wrapModeComboBox.Active = (int) TextEditorProperties.WrapMode; - } - - public void Store () - { - TextEditorProperties.ShowLineNumbers = showLineNumberCheckBox.Active; - TextEditorProperties.ShowMatchingBracket = showBracketHighlighterCheckBox.Active; - TextEditorProperties.ShowVerticalRuler = showVRulerCheckBox.Active; - TextEditorProperties.HighlightCurrentLine = highlightCurrentLineCheckBox.Active; - TextEditorProperties.HighlightSpaces = highlightSpacesCheckBox.Active; - TextEditorProperties.HighlightTabs = highlightTabsCheckBox.Active; - TextEditorProperties.HighlightNewlines = highlightNewlinesCheckBox.Active; - try { - TextEditorProperties.VerticalRulerRow = (int) vRulerRowTextBox.Value; - } - catch { } - try { - TextEditorProperties.WrapMode = (WrapMode) wrapModeComboBox.Active; - } - catch { } - } - } - } -} diff --git a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs b/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs deleted file mode 100644 index 5fab794c15..0000000000 --- a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs +++ /dev/null @@ -1,188 +0,0 @@ -using System; -using System.IO; -using System.Text; -using System.Collections; - -using Gtk; -using Pango; -using GtkSourceView; - -using MonoDevelop.Components; - -using MonoDevelop.Core; -using MonoDevelop.Core.Gui.Dialogs; - -using MonoDevelop.Ide.Gui.Content; - -namespace MonoDevelop.SourceEditor.Gui.OptionPanels -{ - class SyntaxHighlightingPanel : OptionsPanel - { - SyntaxHighlightingPanelWidget widget; - - public override Widget CreatePanelWidget () - { - widget = new SyntaxHighlightingPanelWidget (); - return widget; - } - - public override void ApplyChanges () - { - widget.Store (); - } - - class SyntaxHighlightingPanelWidget : GladeWidgetExtract - { - [Glade.Widget] CheckButton enableSyntaxHighlighting; - [Glade.Widget] ComboBox sourceLanguages; - [Glade.Widget] Gtk.TreeView stylesTreeView; - [Glade.Widget] ToggleButton boldToggle; - [Glade.Widget] ToggleButton italicToggle; - [Glade.Widget] ToggleButton underlineToggle; - [Glade.Widget] ToggleButton strikeToggle; - [Glade.Widget] ColorButton fgColorButton; - [Glade.Widget] ColorButton bgColorButton; - [Glade.Widget] Button restoreDefaultButton; - [Glade.Widget] VBox childrenVBox; - [Glade.Widget] CheckButton checkColor; - [Glade.Widget] CheckButton checkBackground; - - SourceLanguage currentLanguage; - SourceStyleScheme currentStyle; - string styleid; - - public SyntaxHighlightingPanelWidget () : base ("EditorBindings.glade", "SyntaxHighlightingPanel") - { - enableSyntaxHighlighting.Active = TextEditorProperties.SyntaxHighlight; - - // add available sourceLanguages - ListStore store = new ListStore (typeof (string)); - foreach (SourceLanguage sl in SourceViewService.AvailableLanguages) - store.AppendValues (sl.Name); - store.SetSortColumnId (0, SortType.Ascending); - sourceLanguages.Model = store; - - CellRendererText cr = new CellRendererText (); - sourceLanguages.PackStart (cr, true); - sourceLanguages.AddAttribute (cr, "text", 0); - sourceLanguages.Active = 0; - - stylesTreeView.AppendColumn ("styles", new CellRendererText (), "text", 0); - stylesTreeView.Selection.Changed += new EventHandler (OnStyleChanged); - } - - public void Store () - { - TextEditorProperties.SyntaxHighlight = enableSyntaxHighlighting.Active; - } - - void SetCurrentLanguage (string name) - { - currentLanguage = SourceViewService.FindLanguage (name); - SetTreeValues (); - } - - void SetSourceTagStyle () - { - //FIXME GTKSV2 - /* - SourceTagStyle sts = currentStyle; - boldToggle.Active = sts.Bold; - italicToggle.Active = sts.Italic; - underlineToggle.Active = sts.Underline; - strikeToggle.Active = sts.Strikethrough; - fgColorButton.Color = sts.Foreground; - bgColorButton.Color = sts.Background; - checkColor.Active = (sts.Mask & 2) != 0; - checkBackground.Active = (sts.Mask & 1) != 0; - fgColorButton.Sensitive = checkColor.Active; - bgColorButton.Sensitive = checkBackground.Active; - restoreDefaultButton.Sensitive = !sts.IsDefault;*/ - } - - void SetTreeValues () - { - //FIXME GTKSV2 - /* - // name, id - ListStore store = new ListStore (typeof (string), typeof (string)); - foreach (SourceTag t in currentLanguage.Tags) - store.AppendValues (t.Name, t.Id); - stylesTreeView.Model = store; - - TreeIter first; - store.GetIterFirst (out first); - stylesTreeView.Selection.SelectIter (first);*/ - } - - protected void OnButtonToggled (object sender, EventArgs a) - { - //FIXME GTKSV2 - /* - SourceTagStyle sts = currentStyle; - sts.Bold = boldToggle.Active; - sts.Italic = italicToggle.Active; - sts.Underline = underlineToggle.Active; - sts.Strikethrough = strikeToggle.Active; - sts.IsDefault = false; - currentLanguage.SetTagStyle (styleid, sts); - restoreDefaultButton.Sensitive = true;*/ - } - - protected void OnColorSet (object sender, EventArgs a) - { - //FIXME GTKSV2 - /* - SourceTagStyle sts = currentStyle; - sts.Foreground = fgColorButton.Color; - sts.Background = bgColorButton.Color; - sts.Mask = checkColor.Active ? 2u : 0u; - sts.Mask += checkBackground.Active ? 1u : 0u; - fgColorButton.Sensitive = checkColor.Active; - bgColorButton.Sensitive = checkBackground.Active; - sts.IsDefault = false; - currentLanguage.SetTagStyle (styleid, sts); - restoreDefaultButton.Sensitive = true;*/ - } - - protected void OnHighlightingToggled (object sender, EventArgs a) - { - CheckButton cb = sender as CheckButton; - childrenVBox.Sensitive = cb.Active; - } - - protected void OnLanguageSelected (object sender, EventArgs a) - { - TreeIter iter; - if (sourceLanguages.GetActiveIter (out iter)) { - SetCurrentLanguage ((string) sourceLanguages.Model.GetValue (iter, 0)); - } - } - - protected void OnRestoreClicked (object sender, EventArgs a) - { - //FIXME GTKSV2 - /* - currentLanguage = svs.RestoreDefaults (currentLanguage); - OnStyleChanged (stylesTreeView.Selection, EventArgs.Empty); - */ - } - - private void OnStyleChanged (object sender, EventArgs a) - { - //FIXME GTKSV2 - /* - TreeIter iter; - TreeModel model; - TreeSelection selection = sender as TreeSelection; - - if (selection.GetSelected (out model, out iter)) { - styleid = (string) model.GetValue (iter, 1); - currentStyle = currentLanguage.GetTagStyle (styleid); - SetSourceTagStyle (); - }*/ - } - } - } -} - diff --git a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui/LanguageItemWindow.cs b/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui/LanguageItemWindow.cs deleted file mode 100644 index ee2bb7218f..0000000000 --- a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui/LanguageItemWindow.cs +++ /dev/null @@ -1,156 +0,0 @@ - -using System; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml; - -using Gtk; - -using MonoDevelop.Ide.Gui; -using MonoDevelop.Core; -using MonoDevelop.Projects; -using MonoDevelop.Projects.Ambience; -using MonoDevelop.Projects.Parser; - -namespace MonoDevelop.SourceEditor -{ - public class LanguageItemWindow: Gtk.Window - { - static ConversionFlags WindowConversionFlags = ConversionFlags.StandardConversionFlags | ConversionFlags.IncludePangoMarkup; - - static string paramStr = GettextCatalog.GetString ("Parameter"); - static string localStr = GettextCatalog.GetString ("Local variable"); - static string fieldStr = GettextCatalog.GetString ("Field"); - static string propertyStr = GettextCatalog.GetString ("Property"); - - public LanguageItemWindow (ILanguageItem item, IParserContext ctx, Ambience ambience, - string errorInformations) : base (WindowType.Popup) - { - Name = "gtk-tooltips"; - - // Approximate value for usual case - StringBuilder s = new StringBuilder(150); - - if (item != null) { - if (item is IParameter) { - s.Append ("<small><i>"); - s.Append (paramStr); - s.Append ("</i></small>\n"); - s.Append (ambience.Convert ((IParameter)item, WindowConversionFlags)); - } else if (item is LocalVariable) { - s.Append ("<small><i>"); - s.Append (localStr); - s.Append ("</i></small>\n"); - s.Append (ambience.Convert ((LocalVariable)item, WindowConversionFlags)); - } else if (item is IField) { - s.Append ("<small><i>"); - s.Append (fieldStr); - s.Append ("</i></small>\n"); - s.Append (ambience.Convert ((IField)item, WindowConversionFlags)); - } else if (item is IProperty) { - s.Append ("<small><i>"); - s.Append (propertyStr); - s.Append ("</i></small>\n"); - s.Append (ambience.Convert ((IProperty)item, WindowConversionFlags)); - } else if (item is Namespace) { - s.Append ("namespace <b>"); - s.Append (item.Name); - s.Append ("</b>"); - } else - s.Append (ambience.Convert (item, WindowConversionFlags)); - - string doc = GetDocumentation (item.Documentation).Trim ('\n'); - if (!string.IsNullOrEmpty (doc)) { - s.Append ("\n<small>"); - s.Append (doc); - s.Append ("</small>"); - } - } - - if (!string.IsNullOrEmpty (errorInformations)) { - if (s.Length != 0) - s.Append ("\n\n"); - s.Append ("<small>"); - s.Append (errorInformations); - s.Append ("</small>"); - } - - Label lab = new Label (); - lab.Markup = s.ToString (); - lab.Xalign = 0; - lab.Xpad = 3; - lab.Ypad = 3; - Add (lab); - } - - protected override bool OnExposeEvent (Gdk.EventExpose ev) - { - base.OnExposeEvent (ev); - Gtk.Requisition req = SizeRequest (); - Gtk.Style.PaintFlatBox (this.Style, this.GdkWindow, Gtk.StateType.Normal, Gtk.ShadowType.Out, Gdk.Rectangle.Zero, this, "tooltip", 0, 0, req.Width, req.Height); - return true; - } - - 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(70); - - try { - xml.Read(); - do { - if (xml.NodeType == XmlNodeType.Element) { - string elname = xml.Name.ToLower(); - if (elname == "remarks") { - ret.Append("Remarks:\n"); - // skip <example>-nodes - } else if (elname == "example") { - xml.Skip(); - xml.Skip(); - } 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(xml.Value); - } - } while (xml.Read ()); - } catch (Exception ex) { - LoggingService.LogError (ex.ToString ()); - 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/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs b/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs deleted file mode 100644 index c1630db570..0000000000 --- a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs +++ /dev/null @@ -1,845 +0,0 @@ -using Gtk; -using GLib; - -using MonoDevelop.Ide.Gui.Content; -using MonoDevelop.Core; -using Mono.Addins; -using MonoDevelop.Projects; -using MonoDevelop.Projects.Parser; -using MonoDevelop.Projects.Text; -using MonoDevelop.Ide.Gui; - -using System; -using System.IO; -using System.Text; -using System.Collections; -using System.Runtime.InteropServices; - -using GtkSourceView; - -namespace MonoDevelop.SourceEditor.Gui -{/* FIXME GTKSV 2 - public enum SourceMarkerType - { - SourceEditorBookmark, - BreakpointMark, - ExecutionMark - } -*/ - // This gives us a nice way to avoid the try/finally - // which is really long. - struct NoUndo : IDisposable - { - SourceEditorBuffer b; - - public NoUndo (SourceEditorBuffer b) - { - this.b = b; - b.BeginNotUndoableAction (); - } - - public void Dispose () - { - b.EndNotUndoableAction (); - } - } - - // This gives us a nice way to avoid the try/finally - // which is really long. - struct AtomicUndo : IDisposable - { - SourceEditorBuffer b; - - public AtomicUndo (SourceEditorBuffer b) - { - this.b = b; - b.BeginUserAction (); - } - - public void Dispose () - { - b.EndUserAction (); - } - } - - public class SourceEditorBuffer : SourceBuffer, IClipboardHandler - { - TextTag markup; - TextTag complete_ahead; - TextTag compilation_error; - TextMark complete_end; - TextTag highlightLineTag; - AtomicUndo atomic_undo; - SourceEditorView view; - int highlightLine = -1; - string sourceEncoding; - - protected SourceEditorBuffer (IntPtr ptr): base (ptr) - { - } - - public SourceEditorView View - { - get { return view; } - set { view = value; } - } - - public string SourceEncoding { - get { return sourceEncoding; } - set { sourceEncoding = value; } - } - - public SourceEditorBuffer (SourceEditorView view) : this () - { - this.view = view; - } - - public SourceEditorBuffer () : base (new TextTagTable ()) - { - markup = new TextTag ("breakpoint"); - markup.Background = "yellow"; - TagTable.Add (markup); - - complete_ahead = new TextTag ("complete_ahead"); - complete_ahead.Foreground = "grey"; - TagTable.Add (complete_ahead); - - compilation_error = new TextTag ("compilation_error"); - compilation_error.Underline = Pango.Underline.Error; - TagTable.Add (compilation_error); - - complete_end = CreateMark (null, StartIter, true); - highlightLineTag = new TextTag ("highlightLine"); - highlightLineTag.Background = "lightgrey"; - TagTable.Add (highlightLineTag); - - MaxUndoLevels = 1000; - - base.InsertText += OnInsertText; - base.DeleteRange += onDeleteRangeAfter; - base.DeleteRange += onDeleteRangeBefore; - } - - void OnInsertText (object sender, InsertTextArgs args) - { - int lines = 0; - for (int i = 0; i < args.Text.Length; i++) { - if (args.Text [i] == '\n') - lines++; - } - TextIter iter = this.GetIterAtOffset (args.Pos.Offset - args.Length); - if (lines != 0) - OnLineCountChanged (iter.Line, lines, iter.LineOffset); - - OnTextChanged (args.Pos.Offset, args.Pos.Offset + args.Length); - } - - bool onTextChangedFiring = false; - protected void OnTextChanged (int startOffset, int endOffset) - { - if (onTextChangedFiring) - throw new InvalidOperationException ("Cannot modify the text buffer within a TextChanged event handler"); - - if (TextChanged != null) { - onTextChangedFiring = true; - TextChanged (this, new TextChangedEventArgs (startOffset, endOffset)); - onTextChangedFiring = false; - } - } - - public event EventHandler<TextChangedEventArgs> TextChanged; - - public delegate void LineCountChange (int line, int count, int column); - public event LineCountChange LineCountChanged; - protected virtual void OnLineCountChanged (int line, int count, int column) - { - if (LineCountChanged != null) - LineCountChanged (line, count, column); - } - - //HACK: Can't use an override, as it should use ref TextIter parameters, but GTK# doesn't. - //bug https://bugzilla.novell.com/show_bug.cgi?id=341762 - //protected override void OnDeleteRange (TextIter start, TextIter end) - //Hence we have to have two event handlers; one to get state before the delete, - //and the other to fire the OnTextChanged event afterwards - [GLib.ConnectBefore] - void onDeleteRangeBefore (object sender, DeleteRangeArgs args) - { - onDeleteRangeStartLine = args.Start.Line; - onDeleteRangeEndLine = args.End.Line; - onDeleteRangeStartCol = args.Start.LineOffset; - onDeleteRangeStartIndex = args.Start.Offset; - onDeleteRangeEndIndex = args.End.Offset; - } - - int onDeleteRangeStartLine = -1, onDeleteRangeEndLine = -1, onDeleteRangeStartCol = -1; - int onDeleteRangeStartIndex = -1, onDeleteRangeEndIndex = -1; - - void onDeleteRangeAfter (object sender, DeleteRangeArgs args) - { - // We want the count to be negative here if lines were removed. - int count = onDeleteRangeStartLine - onDeleteRangeEndLine; - if (count != 0) - OnLineCountChanged (onDeleteRangeStartLine, count, onDeleteRangeStartCol); - OnTextChanged (onDeleteRangeStartIndex, onDeleteRangeEndIndex); - } - - public override void Dispose () - { - base.InsertText -= OnInsertText; - base.DeleteRange -= onDeleteRangeAfter; - base.DeleteRange -= onDeleteRangeBefore; - - Language = null; - base.Dispose (); - } - - public void MarkupLine (int linenumber) - { - TextIter begin_line = GetIterAtLine (linenumber); - TextIter end_line = begin_line; - begin_line.LineOffset = 0; - end_line.ForwardToLineEnd (); - ApplyTag (markup, begin_line, end_line); - } - - public void UnMarkupLine (int line) - { - //FIXME GTKSV2 - //ClearMarks (SourceMarkerType.ExecutionMark); - RemoveTag (markup, StartIter, EndIter); - } - - public void HighlightLine (int linenumber) - { - TextIter begin_line = GetIterAtLine (linenumber); - TextIter end_line = begin_line; - begin_line.LineOffset = 0; - end_line.ForwardToLineEnd (); - ApplyTag (highlightLineTag, begin_line, end_line); - highlightLine = linenumber; - } - - public void HideHighlightLine () - { - if (highlightLine != -1) { - RemoveTag (highlightLineTag, StartIter, EndIter); - highlightLine = -1; - } - } - - public void DropCompleteAhead () - { - if (GetIterAtMark (complete_end).Offset == 0) - return; - RemoveTag (complete_ahead, GetIterAtMark (InsertMark), GetIterAtMark (complete_end)); - TextIter insertIter = GetIterAtMark (InsertMark); - TextIter completionEnd = GetIterAtMark (complete_end); - Delete (ref insertIter, ref completionEnd); - MoveMark (complete_end, GetIterAtOffset (0)); - } - - public void CompleteAhead (string what) - { - DropCompleteAhead (); - TextIter insertIter = GetIterAtMark (InsertMark); - InsertWithTags (ref insertIter, what, new TextTag[] - { complete_ahead }); - TextIter it = GetIterAtMark (InsertMark); - MoveMark (complete_end, it); - it.BackwardChars (what.Length); - PlaceCursor (it); - } - - public void StartAtomicUndo () - { - atomic_undo = new AtomicUndo (this); - } - - public void EndAtomicUndo () - { - atomic_undo.Dispose (); - } - - public void LoadFile (string file) - { - LoadFile (file, null); - } - - public void LoadFile (string fileName, string mime) - { - LoadFile (fileName, mime, null); - } - - public void LoadFile (string fileName, string mime, string encoding) - { - TextFile file = TextFile.ReadFile (fileName, encoding); - sourceEncoding = file.SourceEncoding; - LoadText (file.Text, mime); - } - - public void LoadText (string text, string mime) - { - if (mime != null) { - SourceLanguage lang = SourceViewService.GetLanguageFromMimeType (mime); - if (lang != null) - Language = lang; - } - - using (NoUndo n = new NoUndo (this)) { - Text = text; - } - - Modified = false; - ScrollToTop (); - } - - void ScrollToTop () - { - PlaceCursor (StartIter); - if (View != null) { -// View.ScrollMarkOnscreen (InsertMark); -// GLib.Timeout.Add (20, new TimeoutHandler (changeFocus)); - } - } - - protected bool changeFocus () - { - View.GrabFocus (); - return false; - } - - public void Save (string fileName, string encoding) - { - // This is workaround for Mono bug #77423. - TextWriter s = new StreamWriter (fileName, true); - s.Close (); - - TextFile.WriteFile (fileName, Text, SourceEncoding); - Modified = false; - } - -#region IClipboardHandler - // FIXME: remove when we depend on gtk > 2.10 - bool _HasSelection - { - get { - TextIter dummy, dummy2; - return GetSelectionBounds (out dummy, out dummy2); - } - } - - public string GetSelectedText () - { - if (_HasSelection) - { - TextIter select1, select2; - GetSelectionBounds (out select1, out select2); - return GetText (select1, select2, true); - } - - return String.Empty; - } - - bool IClipboardHandler.EnableCut - { - get { return true; } - } - - bool IClipboardHandler.EnableCopy - { - get { return true; } - } - - bool IClipboardHandler.EnablePaste - { - get { - return true; - } - } - - bool IClipboardHandler.EnableDelete - { - get { return true; } - } - - bool IClipboardHandler.EnableSelectAll - { - get { return true; } - } - - void IClipboardHandler.Cut () - { - if (_HasSelection) - CutClipboard (clipboard, true); - } - - void IClipboardHandler.Copy () - { - if (_HasSelection) - CopyClipboard (clipboard); - } - - void IClipboardHandler.Paste () - { - if (clipboard.WaitIsTextAvailable ()) { - PasteClipboard (clipboard); - View.ScrollMarkOnscreen (InsertMark); - } - } - - void IClipboardHandler.Delete () - { - if (_HasSelection) - DeleteSelection (true, true); - else - this.Delete (GetIterAtMark (InsertMark).Offset, 1); - } - - void IClipboardHandler.SelectAll () - { - // Sadly, this is not in our version of the bindings: - // - //gtk_text_view_select_all (GtkWidget *widget, - // gboolean select) - //{ - // gtk_text_buffer_get_bounds (buffer, &start_iter, &end_iter); - // gtk_text_buffer_move_mark_by_name (buffer, "insert", &start_iter); - // gtk_text_buffer_move_mark_by_name (buffer, "selection_bound", &end_iter); - - MoveMark ("insert", StartIter); - MoveMark ("selection_bound", EndIter); - } - - Gtk.Clipboard clipboard = Gtk.Clipboard.Get (Gdk.Atom.Intern ("CLIPBOARD", false)); -#endregion - -#region Bookmark Operations - - // - // GtkSourceView made this difficult because they took over - // the TextMark type for their SourceMarker, so we have to marshall manually. - // - // http://bugzilla.gnome.org/show_bug.cgi?id=132525 - // - /* fixme gtksv 2.0 - [DllImport("libgtksourceview-1.0.so.0")] - static extern IntPtr gtk_source_buffer_get_markers_in_region (IntPtr raw, ref Gtk.TextIter begin, ref Gtk.TextIter end); - - [DllImport("libgtksourceview-1.0.so.0")] - static extern IntPtr gtk_source_buffer_create_marker(IntPtr raw, string name, string type, ref Gtk.TextIter where); - - [DllImport("libgtksourceview-1.0.so.0")] - static extern void gtk_source_buffer_delete_marker(IntPtr raw, IntPtr marker); - - [DllImport("libglibsharpglue-2.so")] - static extern IntPtr gtksharp_slist_get_data (IntPtr l); - - [DllImport("libglibsharpglue-2.so")] - static extern IntPtr gtksharp_slist_get_next (IntPtr l); - - [DllImport("libgtksourceview-1.0.so.0")] - static extern IntPtr gtk_source_marker_get_marker_type(IntPtr raw); - - [DllImport("libglib-2.0.so")] - static extern void g_slist_free (IntPtr l); - - [DllImport("libgtksourceview-1.0.so.0")] - static extern void gtk_source_buffer_get_iter_at_marker (IntPtr raw, ref Gtk.TextIter iter, IntPtr marker); - - public void ToggleBookmark () - { - ToggleBookmark (GetIterAtMark (InsertMark).Line); - } - - public bool IsBookmarked (int linenum) - { - return IsMarked (linenum, SourceMarkerType.SourceEditorBookmark); - } - - public bool IsBreakpoint (int linenum) - { - return IsMarked (linenum, SourceMarkerType.BreakpointMark); - } - - public bool IsMarked (int linenum, SourceMarkerType type) - { - TextIter insert = GetIterAtLine (linenum); - TextIter begin_line = insert, end_line = insert; - begin_line.LineOffset = 0; - - while (! end_line.EndsLine ()) - end_line.ForwardChar (); - - IntPtr lst = gtk_source_buffer_get_markers_in_region (Handle, ref begin_line, ref end_line); - - bool fnd_marker = false; - - IntPtr current = lst; - while (current != IntPtr.Zero) - { - IntPtr data = gtksharp_slist_get_data (current); - IntPtr nm = gtk_source_marker_get_marker_type (data); - - string name = GLib.Marshaller.PtrToStringGFree (nm); - if (name == type.ToString ()) { - fnd_marker = true; - break; - } - current = gtksharp_slist_get_next (current); - } - - if (lst != IntPtr.Zero) - g_slist_free (lst); - - return fnd_marker; - } - - public void ToggleBookmark (int linenum) - { - ToggleMark (linenum, SourceMarkerType.SourceEditorBookmark); - } - - public void ToggleMark (int linenum, SourceMarkerType type) - { - TextIter insert = GetIterAtLine (linenum); - TextIter begin_line = insert, end_line = insert; - begin_line.LineOffset = 0; - - while (! end_line.EndsLine ()) - end_line.ForwardChar (); - - - IntPtr lst = gtk_source_buffer_get_markers_in_region (Handle, ref begin_line, ref end_line); - - bool found_marker = false; - - // - // The problem is that the buffer owns the - // reference to the marker. So, if we use the nice Gtk# stuff, we get - // a problem when we dispose it later. Thus we must basically write this - // in C. - // FIXME: Is there a bug# for this? - - IntPtr current = lst; - while (current != IntPtr.Zero) { - - IntPtr data = gtksharp_slist_get_data (current); - IntPtr nm = gtk_source_marker_get_marker_type (data); - string name = GLib.Marshaller.PtrToStringGFree (nm); - if (name == type.ToString ()) { - gtk_source_buffer_delete_marker (Handle, data); - found_marker = true; - } - - current = gtksharp_slist_get_next (current); - } - - if (lst != IntPtr.Zero) - g_slist_free (lst); - - if (found_marker) - return; - - switch (type.ToString ()) { - case "ExecutionMark": - begin_line.LineOffset = 2; - break; - case "BreakpointMark": - begin_line.LineOffset = 1; - break; - } - - gtk_source_buffer_create_marker (Handle, null, type.ToString (), ref begin_line); - }*/ - /* FIXME GTKSV 2.0 - [DllImport("libgtksourceview-1.0.so.0")] - static extern IntPtr gtk_source_buffer_get_prev_marker(IntPtr raw, ref Gtk.TextIter iter); - - [DllImport("libgtksourceview-1.0.so.0")] - static extern IntPtr gtk_source_buffer_get_last_marker(IntPtr raw); - - [DllImport("libgtksourceview-1.0.so.0")] - static extern IntPtr gtk_source_marker_prev (IntPtr raw); - - public void PrevBookmark () - { - TextIter loc = GetIterAtMark (InsertMark); - int ln = loc.Line; - - IntPtr prevMarker = gtk_source_buffer_get_prev_marker (Handle, ref loc); - //IntPtr firstMarker = prevMarker; - bool first = true; - while (true) { - // Thats a wrap! - if (prevMarker == IntPtr.Zero) - prevMarker = gtk_source_buffer_get_last_marker (Handle); - - // no markers - if (prevMarker == IntPtr.Zero) - return; - - IntPtr nm = gtk_source_marker_get_marker_type (prevMarker); - string name = GLib.Marshaller.PtrToStringGFree (nm); - if (name == "SourceEditorBookmark") { - gtk_source_buffer_get_iter_at_marker (Handle, ref loc, prevMarker); - - if (! first || loc.Line != ln) - break; - } - - prevMarker = gtk_source_marker_prev (prevMarker); - - first = false; - } - - PlaceCursor (loc); - }*/ - /* FIXME GTKSV 2.0 - [DllImport("libgtksourceview-1.0.so.0")] - static extern IntPtr gtk_source_buffer_get_first_marker (IntPtr raw); - - [DllImport("libgtksourceview-1.0.so.0")] - static extern IntPtr gtk_source_buffer_get_next_marker(IntPtr raw, ref Gtk.TextIter iter); - - [DllImport("libgtksourceview-1.0.so.0")] - static extern IntPtr gtk_source_marker_next(IntPtr raw); - - public void NextBookmark () - { - TextIter loc = GetIterAtMark (InsertMark); - int ln = loc.Line; - - IntPtr nextMarker = gtk_source_buffer_get_next_marker (Handle, ref loc); - //IntPtr firstMarker = nextMarker; - bool first = true; - while (true) { - // Thats a wrap! - if (nextMarker == IntPtr.Zero) - nextMarker = gtk_source_buffer_get_first_marker (Handle); - - // no markers - if (nextMarker == IntPtr.Zero) - return; - - IntPtr nm = gtk_source_marker_get_marker_type (nextMarker); - string name = GLib.Marshaller.PtrToStringGFree (nm); - if (name == "SourceEditorBookmark") { - gtk_source_buffer_get_iter_at_marker (Handle, ref loc, nextMarker); - - if (! first || loc.Line != ln) - break; - } - - nextMarker = gtk_source_marker_next (nextMarker); - - first = false; - } - - PlaceCursor (loc); - } - - public void ClearBookmarks () - { - ClearMarks (SourceMarkerType.SourceEditorBookmark); - } - - public void ClearMarks (SourceMarkerType type) - { - TextIter begin = StartIter; - TextIter end = EndIter; - IntPtr lst = gtk_source_buffer_get_markers_in_region (Handle, ref begin, ref end); - - IntPtr current = lst; - while (current != IntPtr.Zero) { - - IntPtr data = gtksharp_slist_get_data (current); - IntPtr nm = gtk_source_marker_get_marker_type (data); - string name = GLib.Marshaller.PtrToStringGFree (nm); - if (name == type.ToString ()) - gtk_source_buffer_delete_marker (Handle, data); - - current = gtksharp_slist_get_next (current); - } - - if (lst != IntPtr.Zero) - g_slist_free (lst); - }*/ -#endregion - -#region ITextBufferStrategy compat interface, this should be removed ASAP - - public int Length - { - get { return EndIter.Offset + 1; } - } - - public char GetCharAt (int offset) - { - if (offset < 0) - offset = 0; - - TextIter iter = GetIterAtOffset (offset); - if (iter.Equals (TextIter.Zero)) - return ' '; - if (iter.Char == null || iter.Char.Length == 0) - return ' '; - return iter.Char[0]; - } - - public string GetText (int start, int length) - { - TextIter begin_iter = GetIterAtOffset (start); - TextIter end_iter = GetIterAtOffset (start + length); - return GetText (begin_iter, end_iter, true); - } - - public void Insert (int offset, string text) - { - TextIter put = GetIterAtOffset (offset); - Insert (ref put, text); - } - - public int GetLowerSelectionBounds () - { - if (_HasSelection) - { - TextIter select1, select2; - GetSelectionBounds (out select1, out select2); - return select1.Offset > select2.Offset ? select2.Offset : select1.Offset; - } - return 0; - } - - public void Delete (int offset, int length) - { - TextIter start = GetIterAtOffset (offset); - TextIter end = GetIterAtOffset (offset + length); - Delete (ref start, ref end); - } - - public void Replace (int offset, int length, string pattern) - { - Delete (offset, length); - Insert (offset, pattern); - } - - public static SourceEditorBuffer CreateTextBufferFromFile (string filename) - { - SourceEditorBuffer buff = new SourceEditorBuffer (); - buff.LoadFile (filename); - // don't return a buffer that couldn't load the file - if (buff.Text == null) { - return null; - } else { - return buff; - } - } - -#endregion - -#region ICodeStyleOperations - public void CommentCode () - { - TextMark curMark, endMark; - TextIter start, end; - string commentTag; - - if (GetSelectionBounds (out start, out end)) { - //selection; can contain multiple lines - // Don't comment lines where no chars are actually selected (fixes bug #81632) - if (end.LineOffset == 0) - end.BackwardLine (); - } - - ILanguageBinding binding = Services.Languages.GetBindingPerFileName (IdeApp.Workbench.ActiveDocument.FileName); - commentTag = "//"; - if (binding != null && binding.CommentTag != null) - commentTag = binding.CommentTag; - - start.LineOffset = 0; - - endMark = CreateMark (null, end, false); - using (new AtomicUndo (this)) { - while (start.Line <= end.Line) { - curMark = CreateMark (null, start, true); - Insert (ref start, commentTag); - start = GetIterAtMark (curMark); - end = GetIterAtMark (endMark); - start.ForwardLine (); - } - } - } - - public void UncommentCode () - { - string commentTag = "//"; // as default - commentTag = Services.Languages.GetBindingPerFileName (IdeApp.Workbench.ActiveDocument.FileName).CommentTag; - - TextIter textStart; - TextIter textEnd; - GetSelectionBounds (out textStart, out textEnd); - - int numberOfLines = textStart.Line == textEnd.Line ? 1 : textEnd.Line - textStart.Line + 1; - TextMark mTextStart = CreateMark (null, textStart, true); - TextMark mTextTmp = mTextStart; - - using (new AtomicUndo (this)) { - for (int i=0; i<numberOfLines; i++) - { - TextIter textTmp = GetIterAtMark (mTextTmp); - // delete the comment tag - textTmp.LineOffset = 0; - - // the user can have spaces at start of line, handling that - TextIter textLineEnd = textTmp; - textLineEnd.ForwardToLineEnd (); - string trimmedText, fullText; - int spaces; - fullText = textTmp.GetText (textLineEnd); - trimmedText = fullText.TrimStart (); - spaces = fullText.Length - trimmedText.Length; - if (trimmedText.StartsWith (commentTag)) - { - textTmp.ForwardChars (spaces); - textEnd = textTmp; - textEnd.ForwardChars (commentTag.Length); - Delete (ref textTmp, ref textEnd); - } - - // setup a mark on next line - textTmp = GetIterAtMark (mTextTmp); - textTmp.ForwardLine (); - mTextTmp = CreateMark (null, textTmp, true); - } - } - } -#endregion - - public bool GotoSelectionEnd () - { - TextIter textStart; - TextIter textEnd; - if (GetSelectionBounds (out textStart, out textEnd)) - { - MoveMark (SelectionBound, textEnd); - MoveMark (InsertMark, textEnd); - return true; - } - return false; - } - - public bool GotoSelectionStart () - { - TextIter textStart; - TextIter textEnd; - if (GetSelectionBounds (out textStart, out textEnd)) - { - MoveMark (SelectionBound, textStart); - MoveMark (InsertMark, textStart); - return true; - } - return false; - } - } -} diff --git a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs b/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs deleted file mode 100644 index 003f49bd69..0000000000 --- a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs +++ /dev/null @@ -1,1497 +0,0 @@ -using System; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.Runtime.InteropServices; - -using Gtk; -using GtkSourceView; - -using Mono.Addins; - -using MonoDevelop.Core; -using MonoDevelop.Core.Execution; - -using MonoDevelop.Ide.Gui; -using MonoDevelop.Ide.Gui.Search; -using MonoDevelop.Ide.Gui.Content; -using MonoDevelop.Ide.Codons; - -using MonoDevelop.Projects; -using MonoDevelop.Projects.Text; -using MonoDevelop.Projects.Parser; -using MonoDevelop.Ide.CodeCompletion; - -using MonoDevelop.SourceEditor.FormattingStrategy; - -namespace MonoDevelop.SourceEditor.Gui -{ - public class SourceEditorDisplayBinding : IDisplayBinding - { - static SourceEditorDisplayBinding () - { - GtkSourceViewManager.Init (); - } - - public string DisplayName { - get { return "GtkSourceView Source Code Editor"; } - } - - public virtual bool CanCreateContentForFile (string fileName) - { - return false; - } - - public virtual bool CanCreateContentForMimeType (string mimetype) - { - if (String.IsNullOrEmpty (mimetype)) - return false; - return DesktopService.GetMimeTypeIsText (mimetype); - } - - public virtual IViewContent CreateContentForFile (string fileName) - { - SourceEditorDisplayBindingWrapper w = new SourceEditorDisplayBindingWrapper (); - return w; - } - - public virtual IViewContent CreateContentForMimeType (string mimeType, Stream content) - { - StreamReader sr = new StreamReader (content); - string text = sr.ReadToEnd (); - sr.Close (); - - SourceEditorDisplayBindingWrapper w = new SourceEditorDisplayBindingWrapper (); - w.LoadString (mimeType, text); - return w; - } - } - - public class SourceEditorDisplayBindingWrapper : AbstractViewContent, - IExtensibleTextEditor, ICodeStyleOperations, IDocumentInformation, IEncodedTextContent, IViewHistory, IClipboardHandler - //FIXME GTKSV2 IDebuggableEditor, IBookmarkBuffer, IPrintable - { - VBox mainBox; - VBox editorBar; - HBox reloadBar; - HBox classBrowser; - Gtk.ComboBox classCombo; - Gtk.ComboBox membersCombo; - bool loadingMembers; - ListStore classStore; - ListStore memberStore; - bool classBrowserVisible = true; - internal FileSystemWatcher fsw; - Properties properties; - IParseInformation memberParseInfo; - bool handlingParseEvent = false; - bool disposed; - Tooltips tips = new Tooltips (); - - BreakpointEventHandler breakpointAddedHandler; - BreakpointEventHandler breakpointRemovedHandler; - EventHandler executionChangedHandler; - int currentExecutionLine = -1; - - internal SourceEditor se; - - object fileSaveLock = new object (); - DateTime lastSaveTime; - bool warnOverwrite = false; - - EventHandler<PropertyChangedEventArgs> propertyHandler; - - void UpdateFSW (object o, EventArgs e) - { - if (ContentName == null || ContentName.Length == 0 || !File.Exists (ContentName)) - return; - - fsw.EnableRaisingEvents = false; - lastSaveTime = File.GetLastWriteTime (ContentName); - fsw.Path = Path.GetDirectoryName (ContentName); - fsw.Filter = Path.GetFileName (ContentName); - fsw.EnableRaisingEvents = true; - } - - private void OnFileChanged (object o, FileSystemEventArgs e) - { - lock (fileSaveLock) { - if (lastSaveTime == File.GetLastWriteTime (ContentName)) - return; - } - - if (e.ChangeType == WatcherChangeTypes.Changed || e.ChangeType == WatcherChangeTypes.Created) { - ShowFileChangedWarning (); - } - } -/* FIXME GTKSV2 - public void ExecutingAt (int line) - { - se.ExecutingAt (line); - } - - public void ClearExecutingAt (int line) - { - se.ClearExecutingAt (line); - } - */ - public override Gtk.Widget Control { - get { - return mainBox; - } - } - - public SourceEditor Editor { - get { - return se; - } - } - - public override string TabPageLabel { - get { - return GettextCatalog.GetString ("Source Editor"); - } - } - - public bool ClassBrowserVisible { - get { - return classBrowserVisible; - } - set { - classBrowser.Visible = value; - classBrowserVisible = value; - if (classBrowserVisible) - BindClassCombo (); - } - } - - public SourceEditorDisplayBindingWrapper () - { - mainBox = new VBox (); - mainBox.Spacing = 3; - editorBar = new VBox (); - mainBox.PackStart (editorBar, false, true, 0); - - classBrowser = new HBox(true, 2); - classCombo = new Gtk.ComboBox(); - classCombo.WidthRequest = 1; - - membersCombo = new Gtk.ComboBox(); - membersCombo.WidthRequest = 1; - - // Setup the columns and column renders for the comboboxes - CellRendererPixbuf pixr = new CellRendererPixbuf(); - pixr.Ypad = 0; - classCombo.PackStart(pixr, false); - classCombo.AddAttribute(pixr, "pixbuf", 0); - CellRendererText colr = new CellRendererText(); - colr.Ypad = 0; - colr.Ellipsize = Pango.EllipsizeMode.End; - classCombo.PackStart(colr, true); - classCombo.AddAttribute(colr, "text", 1); - - pixr = new CellRendererPixbuf(); - pixr.Ypad = 0; - membersCombo.PackStart(pixr, false); - membersCombo.AddAttribute(pixr, "pixbuf", 0); - colr = new CellRendererText(); - colr.Ypad = 0; - colr.Ellipsize = Pango.EllipsizeMode.End; - membersCombo.PackStart(colr, true); - membersCombo.AddAttribute(colr, "text", 1); - - // Pack the controls into the editorbar just below the file name tabs. - EventBox tbox = new EventBox (); - tbox.Add (classCombo); - classBrowser.PackStart(tbox, true, true, 0); - tbox = new EventBox (); - tbox.Add (membersCombo); - classBrowser.PackStart (tbox, true, true, 0); - - editorBar.PackEnd (classBrowser, false, true, 0); - - - // Set up the data stores for the comboboxes - classStore = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(IClass)); - classCombo.Model = classStore; - memberStore = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(IMember)); - memberStore.SetSortColumnId (1, Gtk.SortType.Ascending); - membersCombo.Model = memberStore; - membersCombo.Changed += new EventHandler (MemberChanged); - classCombo.Changed += new EventHandler (ClassChanged); - - se = new SourceEditor (this); - se.Buffer.ModifiedChanged += new EventHandler (OnModifiedChanged); - se.Buffer.MarkSet += new MarkSetHandler (OnMarkSet); - se.Buffer.Changed += new EventHandler (OnChanged); - se.View.ToggleOverwrite += new EventHandler (CaretModeChanged); - se.Buffer.LineCountChanged += delegate (int line, int count, int column) { - TextFileService.FireLineCountChanged (this, line, count, column); - }; - ContentNameChanged += new EventHandler (UpdateFSW); - - // setup a focus chain so that the editor widget gets focus when - // switching tabs rather than the classCombo, by default - Widget [] chain = new Widget [3]; - chain[0] = se; - chain[1] = classCombo; - chain[2] = membersCombo; - ((Container) mainBox).FocusChain = chain; - - CaretModeChanged (null, null); - - propertyHandler = (EventHandler<PropertyChangedEventArgs>) DispatchService.GuiDispatch (new EventHandler<PropertyChangedEventArgs> (PropertiesChanged)); - properties = TextEditorProperties.Properties; - properties.PropertyChanged += propertyHandler; - fsw = new FileSystemWatcher (); - fsw.Created += (FileSystemEventHandler) DispatchService.GuiDispatch (new FileSystemEventHandler (OnFileChanged)); - fsw.Changed += (FileSystemEventHandler) DispatchService.GuiDispatch (new FileSystemEventHandler (OnFileChanged)); - UpdateFSW (null, null); - mainBox.PackStart (se, true, true, 0); - /* FIXME GTKSV 2 - if (Services.DebuggingService != null) { - breakpointAddedHandler = (BreakpointEventHandler) DispatchService.GuiDispatch (new BreakpointEventHandler (OnBreakpointAdded)); - breakpointRemovedHandler = (BreakpointEventHandler) DispatchService.GuiDispatch (new BreakpointEventHandler (OnBreakpointRemoved)); - executionChangedHandler = (EventHandler) DispatchService.GuiDispatch (new EventHandler (OnExecutionLocationChanged)); - - Services.DebuggingService.BreakpointAdded += breakpointAddedHandler; - Services.DebuggingService.BreakpointRemoved += breakpointRemovedHandler; - Services.DebuggingService.ExecutionLocationChanged += executionChangedHandler; - } - */ - IdeApp.Workspace.ParserDatabase.ParseInformationChanged += new ParseInformationEventHandler(UpdateClassBrowser); - - mainBox.ShowAll (); - - SetInitialValues (); - } - - public override object GetContent (Type type) - { - if (type == typeof(ICompletionWidget)) { - if (se.View.EnableCodeCompletion) - return se.View; - else - return null; - } else - return base.GetContent (type); - } - - public void SetCaretTo (int line, int column) - { - // NOTE: 1 based! - TextIter itr = se.Buffer.GetIterAtLine (line - 1); - itr.LineOffset = column - 1; - - se.Buffer.PlaceCursor (itr); - if (!se.View.HighlightCurrentLine) - se.Buffer.HighlightLine (line - 1); - se.View.ScrollToMark (se.Buffer.InsertMark, 0.3, false, 0, 0); - GLib.Timeout.Add (20, new GLib.TimeoutHandler (changeFocus)); - } - - protected virtual void OnCaretPositionSet (EventArgs args) - { - if (CaretPositionSet != null) - CaretPositionSet (this, args); - } - public event EventHandler CaretPositionSet; - - //This code exists to workaround a gtk+ 2.4 regression/bug - // - //The gtk+ 2.4 treeview steals focus with double clicked - //row_activated. - // http://bugzilla.gnome.org/show_bug.cgi?id=138458 - bool changeFocus () - { - if (disposed) - return false; - se.View.GrabFocus (); - se.View.ScrollToMark (se.Buffer.InsertMark, 0.3, false, 0, 0); - OnCaretPositionSet (EventArgs.Empty); - return false; - } - - public override void RedrawContent() - { - } - - public override void Dispose() - { - disposed = true; - /*FIXME gtksv2 - if (Services.DebuggingService != null) { - Services.DebuggingService.BreakpointAdded -= breakpointAddedHandler; - Services.DebuggingService.BreakpointRemoved -= breakpointRemovedHandler; - Services.DebuggingService.ExecutionLocationChanged -= executionChangedHandler; - }*/ - TextFileService.FireResetCountChanges (this); - - properties.PropertyChanged -= propertyHandler; - se.Buffer.ModifiedChanged -= new EventHandler (OnModifiedChanged); - se.Buffer.MarkSet -= new MarkSetHandler (OnMarkSet); - se.Buffer.Changed -= new EventHandler (OnChanged); - se.View.ToggleOverwrite -= new EventHandler (CaretModeChanged); - ContentNameChanged -= new EventHandler (UpdateFSW); - membersCombo.Changed -= new EventHandler (MemberChanged); - classCombo.Changed -= new EventHandler (ClassChanged); - - classStore.Dispose (); - memberStore.Dispose (); - - membersCombo.Model = null; - classCombo.Model = null; - - IdeApp.Workspace.ParserDatabase.ParseInformationChanged -= new ParseInformationEventHandler(UpdateClassBrowser); - mainBox.Destroy (); - fsw.Dispose (); - se = null; - base.Dispose (); - } - - void OnModifiedChanged (object o, EventArgs e) - { - base.IsDirty = se.Buffer.Modified; - } - - public override bool IsDirty { - get { - return base.IsDirty; - } - set { - se.Buffer.Modified = value; - } - } - - public override bool IsReadOnly - { - get { - return !se.View.Editable; - } - } - - public override void Save (string fileName) - { - Save (fileName, null); - } - - public void Save (string fileName, string encoding) - { - if (warnOverwrite) { - if (fileName == ContentName) { - if ( MonoDevelop.Ide.MessageService.AskQuestion (GettextCatalog.GetString ("This file {0} has been changed outside of MonoDevelop. Are you sure you want to overwrite the file?", fileName), MonoDevelop.Core.Gui.AlertButton.Cancel, MonoDevelop.Core.Gui.AlertButton.OverwriteFile) != MonoDevelop.Core.Gui.AlertButton.OverwriteFile) - return; - } - warnOverwrite = false; - editorBar.Remove (reloadBar); - WorkbenchWindow.ShowNotification = false; - } - - lock (fileSaveLock) { - se.Buffer.Save (fileName, encoding); - lastSaveTime = File.GetLastWriteTime (fileName); - } - if (encoding != null) - se.Buffer.SourceEncoding = encoding; - ContentName = fileName; - TextFileService.FireCommitCountChanges (this); - InitializeFormatter (); - } - - public override void Load (string fileName) - { - Load (fileName, null); - } - - public void Load (string fileName, string encoding) - { - if (warnOverwrite) { - warnOverwrite = false; - editorBar.Remove (reloadBar); - WorkbenchWindow.ShowNotification = false; - } - string vfsname = fileName; - vfsname = vfsname.Replace ("%", "%25"); - vfsname = vfsname.Replace ("#", "%23"); - vfsname = vfsname.Replace ("?", "%3F"); - se.Buffer.LoadFile (fileName, DesktopService.GetMimeTypeForUri (vfsname), encoding); - ContentName = fileName; - lastSaveTime = File.GetLastWriteTime (ContentName); - InitializeFormatter (); - /* FIXME GTKSV2 - if (Services.DebuggingService != null) { - foreach (IBreakpoint b in Services.DebuggingService.GetBreakpointsAtFile (fileName)) - se.View.ShowBreakpointAt (b.Line - 1); - - UpdateExecutionLocation (); - } - */ - IFileParserContext context = IdeApp.Workspace.ParserDatabase.GetFileParserContext(fileName); - memberParseInfo = context.ParseFile(fileName); - BindClassCombo(); - } - - public INavigationPoint BuildNavPoint () - { - int line, column; - string content; - - GetLineColumnFromPosition (CursorPosition, out line, out column); - content = GetLineTextAtOffset (CursorPosition); - - return new TextNavigationPoint (ContentName, line, column, content); - } - - private void UpdateClassBrowser(object sender, ParseInformationEventArgs args) - { - // This event handler can get called when files other than the current content are updated. eg. - // when loading a new document. If we didn't do this check the member combo for this tab would have - // methods for a different class in it! - - if (ContentName == args.FileName && !handlingParseEvent) { - handlingParseEvent = true; - memberParseInfo = args.ParseInformation; - GLib.Timeout.Add (1000, new GLib.TimeoutHandler (BindClassCombo)); - } - } - KeyValuePair<IClass, int> SearchClass (int line) - { - TreeIter iter; - int i = 0, foundIndex = 0; - IClass result = null; - if (classStore.GetIterFirst (out iter)) { - do { - IClass c = (IClass)classStore.GetValue (iter, 2); - if (c.BodyRegion != null && c.BodyRegion.BeginLine <= line && line <= c.BodyRegion.EndLine) { - if (result == null || result.BodyRegion.BeginLine <= c.BodyRegion.BeginLine) { - result = c; - foundIndex = i; - } - } - i++; - } while (classStore.IterNext (ref iter)); - } - return new KeyValuePair<IClass, int> (result, foundIndex); - } - - void UpdateMethodBrowser () - { - if (!ClassBrowserVisible) - return; - - if (memberParseInfo == null) { - classBrowser.Visible = false; - return; - } - - int line; - int column; - GetLineColumnFromPosition (this.CursorPosition, out line, out column); - - // Find the selected class - - KeyValuePair<IClass, int> c = SearchClass (line); - IClass classFound = c.Key; - - loadingMembers = true; - - try { - if (classFound == null) { - classCombo.Active = -1; - membersCombo.Active = -1; - memberStore.Clear (); - UpdateComboTip (classCombo, null); - UpdateComboTip (membersCombo, null); - return; - } - - TreeIter iter; - if (c.Value != classCombo.Active) { - classCombo.Active = c.Value; - BindMemberCombo (classFound); - return; - } - - // Find the member - - if (!memberStore.GetIterFirst (out iter)) - return; - - do { - IMember mem = (IMember) memberStore.GetValue (iter, 2); - if (IsMemberSelected (mem, line, column)) { - membersCombo.SetActiveIter (iter); - UpdateComboTip (membersCombo, mem); - return; - } - } - while (memberStore.IterNext (ref iter)); - - membersCombo.Active = -1; - UpdateComboTip (membersCombo, null); - } - finally { - loadingMembers = false; - } - } - - void Add (IClass c, string prefix) - { - MonoDevelop.Projects.Ambience.Ambience am = se.View.GetAmbience (); - Gdk.Pixbuf pix = ImageService.GetPixbuf (IdeApp.Services.Icons.GetIcon (c), IconSize.Menu); - string name = prefix + am.Convert (c, MonoDevelop.Projects.Ambience.ConversionFlags.ShowGenericParameters); - classStore.AppendValues (pix, name, c); - - foreach (IClass inner in c.InnerClasses) - Add (inner, name + "."); - } - - private bool BindClassCombo () - { - if (disposed) - return false; - if (!ClassBrowserVisible) - return false; - - loadingMembers = true; - - try { - // Clear down all our local stores. - classStore.Clear(); - - // check the IParseInformation member variable to see if we could get ParseInformation for the - // current docuement. If not we can't display class and member info so hide the browser bar. - if (memberParseInfo == null) { - classBrowser.Visible = false; - return false; - } - - ClassCollection cls = ((ICompilationUnit)memberParseInfo.MostRecentCompilationUnit).Classes; - // if we've got this far then we have valid parse info - but if we have not classes the not much point - // in displaying the browser bar - if (cls.Count == 0) { - classBrowser.Visible = false; - return false; - } - - classBrowser.Visible = true; - ArrayList classes = new ArrayList (); - classes.AddRange (cls); - classes.Sort (new LanguageItemComparer ()); - foreach (IClass c in classes) - Add (c, ""); - - // find out where the current cursor position is and set the combos. - int line; - int column; - this.GetLineColumnFromPosition(this.CursorPosition, out line, out column); - KeyValuePair<IClass, int> ckvp = SearchClass (line); - - IClass foundClass = ckvp.Key; - if (foundClass != null) { - // found the right class. Now need right method - classCombo.Active = ckvp.Value; - BindMemberCombo (foundClass); - } else { - // Sometimes there might be no classes e.g. AssemblyInfo.cs - classCombo.Active = -1; - UpdateComboTip (classCombo, null); - } - } finally { - handlingParseEvent = false; - loadingMembers = false; - } - - // return false to stop the GLib.Timeout - return false; - } - - private void BindMemberCombo (IClass c) - { - if (!ClassBrowserVisible) - return; - - int position = 0; - int activeIndex = -1; - - // find out where the current cursor position is and set the combos. - int line; - int column; - this.GetLineColumnFromPosition(this.CursorPosition, out line, out column); - - UpdateComboTip (classCombo, c); - membersCombo.Changed -= new EventHandler (MemberChanged); - // Clear down all our local stores. - - membersCombo.Model = null; - memberStore.Clear(); - UpdateComboTip (membersCombo, null); - - HybridDictionary methodMap = new HybridDictionary(); - - Gdk.Pixbuf pix; - - ArrayList members = new ArrayList (); - members.AddRange (c.Methods); - members.AddRange (c.Properties); - members.AddRange (c.Fields); - members.Sort (new LanguageItemComparer ()); - - // Add items to the member drop down - - foreach (IMember mem in members) - { - pix = ImageService.GetPixbuf(IdeApp.Services.Icons.GetIcon (mem), IconSize.Menu); - - // Add the member to the list - MonoDevelop.Projects.Ambience.Ambience am = se.View.GetAmbience (); - string displayName = am.Convert (mem, MonoDevelop.Projects.Ambience.ConversionFlags.UseIntrinsicTypeNames | - MonoDevelop.Projects.Ambience.ConversionFlags.ShowParameters | - MonoDevelop.Projects.Ambience.ConversionFlags.ShowParameterNames | - MonoDevelop.Projects.Ambience.ConversionFlags.ShowGenericParameters); - memberStore.AppendValues (pix, displayName, mem); - - // Check if the current cursor position in inside this member - if (IsMemberSelected (mem, line, column)) { - UpdateComboTip (membersCombo, mem); - activeIndex = position; - } - - position++; - } - membersCombo.Model = memberStore; - - // don't need method map anymore - methodMap.Clear (); - - // set active the method the cursor is in - membersCombo.Active = activeIndex; - membersCombo.Changed += new EventHandler (MemberChanged); - } - - private void MemberChanged(object sender, EventArgs e) - { - if (loadingMembers) - return; - - Gtk.TreeIter iter; - if (membersCombo.GetActiveIter (out iter)) { - // Find the IMember object in our list store by name from the member combo - IMember member = (IMember) memberStore.GetValue (iter, 2); - int line = member.Region.BeginLine; - - // Get a handle to the current document - if (IdeApp.Workbench.ActiveDocument == null) { - return; - } - - // If we can we navigate to the line location of the IMember. - IEditableTextBuffer content = IdeApp.Workbench.ActiveDocument.GetContent<IEditableTextBuffer> (); - if (content != null) { - content.SetCaretTo (Math.Max (1, line), 1); - } - } - } - - private void ClassChanged(object sender, EventArgs e) - { - if (loadingMembers) - return; - - Gtk.TreeIter iter; - if (classCombo.GetActiveIter(out iter)) { - IClass selectedClass = (IClass)classStore.GetValue(iter, 2); - int line = selectedClass.Region.BeginLine; - - // Get a handle to the current document - if (IdeApp.Workbench.ActiveDocument == null) { - return; - } - - // If we can we navigate to the line location of the IMember. - IEditableTextBuffer content = IdeApp.Workbench.ActiveDocument.GetContent <IEditableTextBuffer> (); - if (content != null) - content.SetCaretTo (Math.Max (1, line), 1); - - // check that selected "class" isn't a delegate - if (selectedClass.ClassType == ClassType.Delegate) { - memberStore.Clear(); - } else { - BindMemberCombo(selectedClass); - } - } - } - - void UpdateComboTip (ComboBox combo, ILanguageItem it) - { - MonoDevelop.Projects.Ambience.Ambience am = se.View.GetAmbience (); - string txt; - if (it != null) - txt = am.Convert (it, MonoDevelop.Projects.Ambience.ConversionFlags.All); - else - txt = null; - tips.SetTip (combo.Parent, txt, txt); - } - - bool IsMemberSelected (IMember mem, int line, int column) - { - if (mem is IMethod) { - IMethod method = (IMethod) mem; - return (method.BodyRegion != null && method.BodyRegion.BeginLine <= line && line <= method.BodyRegion.EndLine); - } - else if (mem is IProperty) { - IProperty property = (IProperty) mem; - return (property.BodyRegion != null && property.BodyRegion.BeginLine <= line && line <= property.BodyRegion.EndLine); - } - else - return (mem.Region != null && mem.Region.BeginLine <= line && line <= mem.Region.EndLine); - } - /* FIXME GTKSV2 - void OnBreakpointAdded (object sender, BreakpointEventArgs args) - { - if (args.Breakpoint.FileName == ContentName) - se.View.ShowBreakpointAt (args.Breakpoint.Line - 1); - } - - void OnBreakpointRemoved (object sender, BreakpointEventArgs args) - { - if (args.Breakpoint.FileName == ContentName) - se.View.ClearBreakpointAt (args.Breakpoint.Line - 1); - } - - void OnExecutionLocationChanged (object sender, EventArgs args) - { - UpdateExecutionLocation (); - } - - void UpdateExecutionLocation () - { - if (currentExecutionLine != -1) - se.View.ClearExecutingAt (currentExecutionLine - 1); - - if (Services.DebuggingService.CurrentFilename == ContentName) { - currentExecutionLine = Services.DebuggingService.CurrentLineNumber; - se.View.ExecutingAt (currentExecutionLine - 1); - - TextIter itr = se.Buffer.GetIterAtLine (currentExecutionLine - 1); - itr.LineOffset = 0; - se.Buffer.PlaceCursor (itr); - se.View.ScrollToMark (se.Buffer.InsertMark, 0.3, false, 0, 0); - GLib.Timeout.Add (200, new GLib.TimeoutHandler (changeFocus)); - } - else - currentExecutionLine = -1; - } - */ - void ShowFileChangedWarning () - { - if (reloadBar == null) { - reloadBar = new HBox (); - reloadBar.BorderWidth = 3; - Gtk.Image img = Services.Resources.GetImage ("gtk-dialog-warning", IconSize.Menu); - reloadBar.PackStart (img, false, false, 2); - reloadBar.PackStart (new Gtk.Label (GettextCatalog.GetString ("This file has been changed outside of MonoDevelop")), false, false, 5); - HBox box = new HBox (); - reloadBar.PackStart (box, true, true, 10); - - Button b1 = new Button (GettextCatalog.GetString("Reload")); - box.PackStart (b1, false, false, 5); - b1.Clicked += new EventHandler (ClickedReload); - - Button b2 = new Button (GettextCatalog.GetString("Ignore")); - box.PackStart (b2, false, false, 5); - b2.Clicked += new EventHandler (ClickedIgnore); - - reloadBar.ShowAll (); - } - warnOverwrite = true; - editorBar.PackStart (reloadBar, false, true, 0); - reloadBar.ShowAll (); - WorkbenchWindow.ShowNotification = true; - } - - void ClickedReload (object sender, EventArgs args) - { - try { - double vscroll = se.View.VScroll; - Load (ContentName); - editorBar.Remove (reloadBar); - se.View.VScroll = vscroll; - WorkbenchWindow.ShowNotification = false; - } catch (Exception ex) { - LoggingService.LogError ("Could not reload the file.", ex); - MessageService.ShowError ("Could not reload the file.", ex.ToString ()); - } - } - - void ClickedIgnore (object sender, EventArgs args) - { - editorBar.Remove (reloadBar); - WorkbenchWindow.ShowNotification = false; - } - - public void InitializeFormatter() - { - string ext = Path.GetExtension (ContentName).ToLower (); - - if (ext.Length > 0) { - string id = ext.Substring (1); - TypeExtensionNode node = AddinManager.GetExtensionNode ("/MonoDevelop/SourceEditor/Formatters/" + id) as TypeExtensionNode; - if (node != null) { - se.View.fmtr = (IFormattingStrategy) node.CreateInstance (typeof(IFormattingStrategy)); - return; - } - } - - // if the above specific formatter is not found - // we fall back to the default formatter - se.View.fmtr = new DefaultFormattingStrategy (); - } - - public void InsertAtCursor (string s) - { - se.Buffer.InsertAtCursor (s); - se.View.ScrollMarkOnscreen (se.Buffer.InsertMark); - } - - public void LoadString (string mime, string val) - { - se.Buffer.LoadText (val, mime); - } - -#region IExtensibleTextEditor - ITextEditorExtension IExtensibleTextEditor.AttachExtension (ITextEditorExtension extension) - { - return se.View.AttachExtension (extension); - } -#endregion -/* FIXME GTKSV2 -#region IPrintable - void IPrintable.PrintDocument () - { - se.PrintDocument (); - } - - void IPrintable.PrintPreviewDocument () - { - se.PrintPreviewDocument (); - } -#endregion -*/ - - #region IClipboardHandler - public bool EnableCut { - get { - return ((IClipboardHandler)se.Buffer).EnableCut; - } - } - public bool EnableCopy { - get { - return ((IClipboardHandler)se.Buffer).EnableCopy; - } - } - public bool EnablePaste { - get { - return ((IClipboardHandler)se.Buffer).EnablePaste; - } - } - public bool EnableDelete { - get { - return ((IClipboardHandler)se.Buffer).EnableDelete; - } - } - public bool EnableSelectAll { - get { - return ((IClipboardHandler)se.Buffer).EnableSelectAll; - } - } - - public void Cut () - { - ((IClipboardHandler)se.Buffer).Cut (); - } - - public void Copy () - { - ((IClipboardHandler)se.Buffer).Copy (); - } - - public void Paste () - { - ((IClipboardHandler)se.Buffer).Paste (); - } - - public void Delete () - { - ((IClipboardHandler)se.Buffer).Delete (); - } - - public void SelectAll () - { - ((IClipboardHandler)se.Buffer).SelectAll (); - } - #endregion - -#region IEditableTextBuffer - - public string Name { - get { return ContentName; } - } - - string cachedText; - GLib.IdleHandler bouncingDelegate; - - public string Text { - get { - if (bouncingDelegate == null) - bouncingDelegate = new GLib.IdleHandler (BounceAndGrab); - if (needsUpdate) { - cachedText = se.Buffer.Text; -/* GLib.Idle.Add (bouncingDelegate); - if (cachedText == null) - return se.Buffer.Text; -*/ } - return cachedText; - } - set { se.Buffer.Text = value; } - } - - bool needsUpdate; - bool BounceAndGrab () - { - if (needsUpdate && se != null) { - cachedText = se.Buffer.Text; - needsUpdate = false; - } - return false; - } - public bool EnableUndo { - get { - return ((SourceBuffer)se.Buffer).CanUndo; - } - } - - public void Undo () - { - if (((SourceBuffer)se.Buffer).CanUndo) { - se.Buffer.Undo (); - TextIter iter = se.Buffer.GetIterAtMark (se.Buffer.InsertMark); - if (!se.View.VisibleRect.Contains (se.View.GetIterLocation (iter))) - se.View.ScrollToMark (se.Buffer.InsertMark, 0.1, false, 0, 0); - } - } - - public bool EnableRedo { - get { - return ((SourceBuffer)se.Buffer).CanRedo; - } - } - - public void Redo () - { - if (((SourceBuffer)se.Buffer).CanRedo) { - se.Buffer.Redo (); - TextIter iter = se.Buffer.GetIterAtMark (se.Buffer.InsertMark); - if (!se.View.VisibleRect.Contains (se.View.GetIterLocation (iter))) - se.View.ScrollToMark (se.Buffer.InsertMark, 0.1, false, 0, 0); - } - } - - public void BeginAtomicUndo () - { - Editor.Buffer.BeginUserAction (); - } - - public void EndAtomicUndo () - { - Editor.Buffer.EndUserAction (); - } - - public string SelectedText { - get { - return se.Buffer.GetSelectedText (); - } - set { - int offset = se.Buffer.GetLowerSelectionBounds (); - ((IClipboardHandler)se.Buffer).Delete (); - se.Buffer.Insert (offset, value); - se.Buffer.PlaceCursor (se.Buffer.GetIterAtOffset (offset + value.Length)); - se.View.ScrollMarkOnscreen (se.Buffer.InsertMark); - } - } - - public int GetLineLength (int line) - { - TextIter begin = Editor.Buffer.GetIterAtLine (line); - return begin.CharsInLine; - } - - public int GetPositionFromLineColumn (int line, int column) - { - if (line > Editor.Buffer.LineCount) - return -1; - - TextIter itr = se.Buffer.GetIterAtLine (line - 1); - if (column - 1 > itr.CharsInLine) - itr.LineOffset = itr.CharsInLine > 0 ? itr.CharsInLine - 1 : 0; - else - itr.LineOffset = column - 1; - return itr.Offset; - } - - public void InsertText (int position, string text) - { - se.Buffer.Insert (position, text); - } - - public void DeleteText (int pos, int length) - { - se.Buffer.Delete (pos, length); - } - - public event EventHandler<TextChangedEventArgs> TextChanged { - add { se.Buffer.TextChanged += value; } - remove { se.Buffer.TextChanged -= value; } - } - - public string SourceEncoding { - get { return se.Buffer.SourceEncoding; } - } - -#endregion - -#region Status Bar Handling - void OnMarkSet (object o, MarkSetArgs args) - { - if (args.Mark == se.Buffer.InsertMark) { - UpdateLineCol (); - UpdateMethodBrowser (); - } - } - - void OnChanged (object o, EventArgs e) - { - // gedit also hooks this event, but do we need it? - UpdateLineCol (); - OnContentChanged (null); - needsUpdate = true; - } - - void UpdateLineCol () - { - int col = 1; // first char == 1 - int chr = 1; - bool found_non_ws = false; - int tab_size = (int) se.View.TabWidth; - - TextIter iter = se.Buffer.GetIterAtMark (se.Buffer.InsertMark); - TextIter start = iter; - - iter.LineOffset = 0; - - while (!iter.Equal (start)) - { - char c = iter.Char[0]; - - if (c == '\t') - col += (tab_size - (col % tab_size)); - else - col ++; - - if (c != '\t' && c != ' ') - found_non_ws = true; - - if (found_non_ws ) { - if (c == '\t') - chr += (tab_size - (col % tab_size)); - else - chr ++; - } - - iter.ForwardChar (); - } - - //FIXME: show logical column too - IdeApp.Workbench.StatusBar.ShowCaretState (iter.Line + 1, col, chr, insert_mode); - } - - // This is false because we at first `toggle' it to set it to true - bool insert_mode = false; // TODO: is this always the default - void CaretModeChanged (object sender, EventArgs e) - { - UpdateLineCol (); - } -#endregion -#region ICodeStyleOperations - void ICodeStyleOperations.ToggleCodeComment () - { - string text = this.GetLineTextAtOffset (this.CursorPosition); - string commentTag = Services.Languages.GetBindingPerFileName (IdeApp.Workbench.ActiveDocument.FileName).CommentTag; - if (commentTag == null) - commentTag = "//"; - if (text.TrimStart ().StartsWith (commentTag)) { - se.Buffer.UncommentCode (); - } else { - se.Buffer.CommentCode (); - } - } - - void ICodeStyleOperations.IndentSelection () - { - se.View.IndentSelection (false, false); - } - - void ICodeStyleOperations.UnIndentSelection () - { - se.View.IndentSelection (true, false); - } -#endregion - - public int CursorPosition { - get { return se.Buffer.GetIterAtMark (se.Buffer.InsertMark).Offset; } - set { - se.Buffer.MoveMark (se.Buffer.InsertMark, se.Buffer.GetIterAtOffset (value)); - se.Buffer.MoveMark (se.Buffer.SelectionBound, se.Buffer.GetIterAtOffset (value)); - se.View.ScrollMarkOnscreen (se.Buffer.InsertMark); - } - } - - public void Select (int startPosition, int endPosition) - { - se.Buffer.MoveMark (se.Buffer.InsertMark, se.Buffer.GetIterAtOffset (startPosition)); - se.Buffer.MoveMark (se.Buffer.SelectionBound, se.Buffer.GetIterAtOffset (endPosition)); - } - - public int SelectionStartPosition { - get { - TextIter p1 = se.Buffer.GetIterAtMark (se.Buffer.InsertMark); - TextIter p2 = se.Buffer.GetIterAtMark (se.Buffer.SelectionBound); - if (p1.Offset < p2.Offset) return p1.Offset; - else return p2.Offset; - } - } - - public int SelectionEndPosition { - get { - TextIter p1 = se.Buffer.GetIterAtMark (se.Buffer.InsertMark); - TextIter p2 = se.Buffer.GetIterAtMark (se.Buffer.SelectionBound); - if (p1.Offset > p2.Offset) return p1.Offset; - else return p2.Offset; - } - } - - public void GetLineColumnFromPosition (int position, out int line, out int column) - { - TextIter it = se.Buffer.GetIterAtOffset (position); - line = it.Line + 1; - column = it.LineOffset + 1; - } - - public void ShowPosition (int position) - { - se.View.ScrollToIter (se.Buffer.GetIterAtOffset (position), 0.3, false, 0, 0); - } - - public string GetText (int startPosition, int endPosition) - { - return se.Buffer.GetText (se.Buffer.GetIterAtOffset (startPosition), se.Buffer.GetIterAtOffset (endPosition), true); - } - - int ITextFile.Length { - get { return se.Buffer.Length; } - } - - char ITextFile.GetCharAt (int offset) - { - if (offset < (se.Buffer.Length - 1)) - return se.Buffer.GetIterAtOffset (offset).Char[0]; - else - return (char) 0; - } -/* FIXME GTKSV2 - public void SetBookmarked (int position, bool mark) - { - int line = se.Buffer.GetIterAtOffset (position).Line; - if (se.Buffer.IsBookmarked (line) != mark) - se.Buffer.ToggleBookmark (line); - } - - public bool IsBookmarked (int position) - { - int line = se.Buffer.GetIterAtOffset (position).Line; - return se.Buffer.IsBookmarked (line); - } - - public void PrevBookmark () - { - se.Buffer.PrevBookmark (); - } - - public void NextBookmark () - { - se.Buffer.NextBookmark (); - } - - public void ClearBookmarks () - { - se.Buffer.ClearBookmarks (); - } - */ -#region IDocumentInformation - string IDocumentInformation.FileName { - get { return ContentName != null ? ContentName : UntitledName; } - } - - public ITextIterator GetTextIterator () - { - int startOffset = Editor.Buffer.GetIterAtMark (Editor.Buffer.InsertMark).Offset; - return new SourceViewTextIterator (this, se.View, startOffset); - } - - public string GetLineTextAtOffset (int offset) - { - TextIter resultIter = se.Buffer.GetIterAtOffset (offset); - TextIter start_line = resultIter, end_line = resultIter; - start_line.LineOffset = 0; - if (end_line.Char.Length == 0) - return string.Empty; - while (end_line.Char[0] != '\n' && end_line.ForwardChar ()) - ; - return se.Buffer.GetText (start_line.Offset, end_line.Offset - start_line.Offset); - } -#endregion - - void UpdateStyleScheme () - { - string id = properties.Get<string> ("GtkSourceViewStyleScheme", "classic"); - SourceStyleScheme scheme = GtkSourceView.SourceStyleSchemeManager.Default.GetScheme (id); - if (scheme == null) - MonoDevelop.Core.LoggingService.LogWarning ("GTKSourceView style scheme '" + id + "' is missing."); - else - se.Buffer.StyleScheme = scheme; - } - - void SetInitialValues () - { - se.View.ModifyFont (TextEditorProperties.Font); - se.View.ShowLineNumbers = TextEditorProperties.ShowLineNumbers; - se.Buffer.HighlightMatchingBrackets = TextEditorProperties.ShowMatchingBracket; - se.View.ShowRightMargin = TextEditorProperties.ShowVerticalRuler; - se.View.EnableCodeCompletion = TextEditorProperties.EnableCodeCompletion; - se.View.InsertSpacesInsteadOfTabs = TextEditorProperties.ConvertTabsToSpaces; - se.View.AutoIndent = (TextEditorProperties.IndentStyle == IndentStyle.Auto); - se.View.AutoInsertTemplates = TextEditorProperties.AutoInsertTemplates; - se.View.HighlightCurrentLine = TextEditorProperties.HighlightCurrentLine; - se.Buffer.HighlightSyntax = TextEditorProperties.SyntaxHighlight; - se.DisplayBinding.ClassBrowserVisible = TextEditorProperties.ShowClassBrowser; - UpdateStyleScheme (); - - //tab and shift-tab respectively indent and unindent the selected code block - se.View.IndentOnTab = true; - - if (TextEditorProperties.VerticalRulerRow > -1) - se.View.RightMarginPosition = (uint) TextEditorProperties.VerticalRulerRow; - else - se.View.RightMarginPosition = 80; - - if (TextEditorProperties.TabIndent > -1) - se.View.TabWidth = (uint) TextEditorProperties.TabIndent; - else - se.View.TabWidth = (uint) 4; - - se.View.WrapMode = TextEditorProperties.WrapMode; - } - - void PropertiesChanged (object sender, PropertyChangedEventArgs e) - { - switch (e.Key) { - case "DefaultFont": - se.View.ModifyFont (TextEditorProperties.Font); - se.UpdateMarkerSize (); - break; - case "ShowLineNumbers": - se.View.ShowLineNumbers = TextEditorProperties.ShowLineNumbers; - break; - case "ShowBracketHighlight": - se.Buffer.HighlightMatchingBrackets = TextEditorProperties.ShowMatchingBracket; - break; - case "ShowVRuler": - se.View.ShowRightMargin = TextEditorProperties.ShowVerticalRuler; - break; - case "EnableCodeCompletion": - se.View.EnableCodeCompletion = TextEditorProperties.EnableCodeCompletion; - break; - case "ConvertTabsToSpaces": - se.View.InsertSpacesInsteadOfTabs = TextEditorProperties.ConvertTabsToSpaces; - break; - case "IndentStyle": - se.View.AutoIndent = (TextEditorProperties.IndentStyle == IndentStyle.Auto); - break; - case "AutoInsertTemplates": - se.View.AutoInsertTemplates = TextEditorProperties.AutoInsertTemplates; - break; - case "SyntaxHighlight": - se.Buffer.HighlightSyntax = TextEditorProperties.SyntaxHighlight; - break; - case "VRulerRow": - if (TextEditorProperties.VerticalRulerRow > -1) - se.View.RightMarginPosition = (uint) TextEditorProperties.VerticalRulerRow; - else - se.View.RightMarginPosition = 80; - break; - case "TabIndent": - if (TextEditorProperties.TabIndent > -1) - se.View.TabWidth = (uint) TextEditorProperties.TabIndent; - else - se.View.TabWidth = (uint) 4; - break; - case "TabsToSpaces": - se.View.InsertSpacesInsteadOfTabs = TextEditorProperties.ConvertTabsToSpaces; - break; - case "EnableFolding": - // TODO - break; - case "WrapMode": - se.View.WrapMode = TextEditorProperties.WrapMode; - break; - case "ShowClassBrowser": - se.DisplayBinding.ClassBrowserVisible = TextEditorProperties.ShowClassBrowser; - break; - case "HighlightCurrentLine": - se.View.HighlightCurrentLine = TextEditorProperties.HighlightCurrentLine; - break; - case "HighlightSpaces": - SourceEditorView.HighlightSpacesEnabled = TextEditorProperties.HighlightSpaces; - se.View.QueueDraw (); - break; - case "HighlightTabs": - SourceEditorView.HighlightTabsEnabled = TextEditorProperties.HighlightTabs; - se.View.QueueDraw (); - break; - case "HighlightNewlines": - SourceEditorView.HighlightNewlinesEnabled = TextEditorProperties.HighlightNewlines; - se.View.QueueDraw (); - break; - case "GtkSourceViewStyleScheme": - UpdateStyleScheme (); - break; - default: - break; - } - } - } - - class SourceViewTextIterator: ForwardTextIterator - { - bool initialBackwardsPosition; - bool hasWrapped; - - public SourceViewTextIterator (IDocumentInformation docInfo, Gtk.TextView document, int endOffset) - : base (docInfo, document, endOffset) - { - // Make sure the iterator is ready for use - this.MoveAhead(1); - this.hasWrapped = false; - } - - public override bool SupportsSearch (SearchOptions options, bool reverse) - { - return true; - } - - public override void MoveToEnd () - { - initialBackwardsPosition = true; - base.MoveToEnd (); - } - - public override bool SearchNext (string text, SearchOptions options, bool reverse) - { - // Make sure the backward search finds the first match when that match is just - // at the left of the cursor. Position needs to be incremented in this case because it will be - // at the last char of the match, and BackwardSearch don't return results that include - // the initial search position. - if (reverse && Position < BufferLength && initialBackwardsPosition) { - Position++; - initialBackwardsPosition = false; - } - - // Use special search flags that work for both the old and new API - // of gtksourceview (the enum values where changed in the API). - // See bug #75770 - SourceSearchFlags flags = options.IgnoreCase ? (SourceSearchFlags)7 : (SourceSearchFlags)1; - - Gtk.TextIter matchStart, matchEnd, limit; - - if (reverse) { - if (!hasWrapped) - limit = Buffer.StartIter; - else - limit = Buffer.GetIterAtOffset (EndOffset); - } else { - if (!hasWrapped) - limit = Buffer.EndIter; - else - limit = Buffer.GetIterAtOffset (EndOffset + text.Length); - } - - // machEnd is the position of the last matched char + 1 - // When searching forward, the limit check is: matchEnd < limit - // When searching backwards, the limit check is: matchEnd > limit - - TextIter iterator = Buffer.GetIterAtOffset (DocumentOffset); - bool res; - do { - res = Find (reverse, iterator, text, flags, out matchStart, out matchEnd, limit); - - if (!res && !hasWrapped) { - - hasWrapped = true; - - // Not found in the first half of the document, try the other half - if (reverse && DocumentOffset <= EndOffset) { - limit = Buffer.GetIterAtOffset (EndOffset); - res = Find (true, Buffer.EndIter, text, flags, out matchStart, out matchEnd, limit); - // Not found in the second half of the document, try the other half - } else if (!reverse && DocumentOffset >= EndOffset) { - limit = Buffer.GetIterAtOffset (EndOffset + text.Length); - res = Find (false, Buffer.StartIter, text, flags, out matchStart, out matchEnd, limit); - } - } - iterator = matchEnd; - } while (res && options.SearchWholeWordOnly && (!IsWordSeparator (matchStart.Offset > 0 ? Buffer.Text [matchStart.Offset - 1] : ' ') || - !IsWordSeparator (matchEnd.Offset < Buffer.CharCount ? Buffer.Text [matchEnd.Offset] : ' '))); - - if (!res) - return false; - - DocumentOffset = matchStart.Offset; - return true; - } - - static bool IsWordSeparator (char c)
- {
- return Char.IsWhiteSpace (c) || (Char.IsPunctuation (c) && c != '_');
- } - - bool Find (bool reverse, Gtk.TextIter iter, string str, GtkSourceView.SourceSearchFlags flags, out Gtk.TextIter match_start, out Gtk.TextIter match_end, Gtk.TextIter limit) - { - if (reverse) - return ((SourceBuffer)Buffer).BackwardSearch (iter, str, flags, out match_start, out match_end, limit); - else - return ((SourceBuffer)Buffer).ForwardSearch (iter, str, flags, out match_start, out match_end, limit); - } - } - - class LanguageItemComparer: IComparer - { - public int Compare (object x, object y) - { - return string.Compare (((ILanguageItem)x).Name, ((ILanguageItem)y).Name, true); - } - } -} - - diff --git a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui/SourceEditorView.cs b/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui/SourceEditorView.cs deleted file mode 100644 index 3bded53f84..0000000000 --- a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui/SourceEditorView.cs +++ /dev/null @@ -1,1177 +0,0 @@ -using System; -using System.IO; -using System.Collections.Generic; -using System.Runtime.InteropServices; - -using Gtk; -using Gdk; -using Global = Gtk.Global; -using GtkSourceView; - -using Mono.Addins; - -using MonoDevelop.Components.Commands; - -using MonoDevelop.Core; - - -using MonoDevelop.Ide.Commands; -using MonoDevelop.Ide.CodeTemplates; -using MonoDevelop.Ide.Gui; -using MonoDevelop.Ide.Gui.Content; - -using MonoDevelop.Projects; -using MonoDevelop.Ide.CodeCompletion; -using MonoDevelop.Projects.Parser; - -using MonoDevelop.SourceEditor; -using MonoDevelop.SourceEditor.Actions; -using MonoDevelop.SourceEditor.FormattingStrategy; - -namespace MonoDevelop.SourceEditor.Gui -{ - public class SourceEditorView : SourceView, ICompletionWidget, ITextEditorExtension - { - public static bool HighlightSpacesEnabled = TextEditorProperties.HighlightSpaces; - public static bool HighlightTabsEnabled = TextEditorProperties.HighlightTabs; - public static bool HighlightNewlinesEnabled = TextEditorProperties.HighlightNewlines; - - public readonly SourceEditor ParentEditor; - internal IFormattingStrategy fmtr = new DefaultFormattingStrategy (); - public SourceEditorBuffer buf; - bool codeCompleteEnabled; - bool autoInsertTemplates; - EditActionCollection editactions = new EditActionCollection (); - LanguageItemWindow languageItemWindow; - ITextEditorExtension extension; - TextEditor thisEditor; - DrawControlCharacterImp controlsDrawer; - event EventHandler completionContextChanged; - - const int LanguageItemTipTimer = 800; - ILanguageItem tipItem; - bool showTipScheduled; - int langTipX, langTipY; - uint tipTimeoutId; - - IParserDatabase db = IdeApp.Workspace.ParserDatabase; - TextTag synErrorTag = new TextTag ("synError"); - bool resetTimerStarted = false; - uint resetTimerId; - ICompilationUnitBase lastCu = null; - int tiItem = -1; - - Dictionary<int, ErrorInfo> errors = new Dictionary<int,ErrorInfo> (); - - void InitAutoCorrectionValues () - { - synErrorTag.Underline = Pango.Underline.Error; - buf.TagTable.Add (synErrorTag); - synErrorTag.Priority = buf.TagTable.Size - 1; - - buf.Changed += OnBufferChanged; - buf.TextChanged += OnBufferTextChanged; - TextEditorProperties.Properties.PropertyChanged += OnPropertyChanged; - if (TextEditorProperties.EnableAutoCorrection) - db.ParseInformationChanged += OnParseInformationChanged; - } - - void CleanAutoCorrectionValues () - { - db.ParseInformationChanged -= OnParseInformationChanged; - buf.Changed -= OnBufferChanged; - buf.TextChanged -= OnBufferTextChanged; - TextEditorProperties.Properties.PropertyChanged -= OnPropertyChanged; - } - - void OnParseInformationChanged (object sender, ParseInformationEventArgs e) - { - // To prevent some NullReferenceException (possibly when the user switch between editors) - if (this.ParentEditor == null || this.ParentEditor.DisplayBinding == null || e == null) - return; - if (this.ParentEditor.DisplayBinding.ContentName != e.FileName) - return; - - lastCu = e.ParseInformation.MostRecentCompilationUnit; - UpdateAutocorTimer (); - } - - void OnBufferChanged (object sender, EventArgs e) - { - ResetUnderlineChangement (); - } - - void OnBufferTextChanged (object sender, TextChangedEventArgs e) - { - if (extension == null) - ((ITextEditorExtension)this).TextChanged (e.StartIndex, e.EndIndex); - else - extension.TextChanged (e.StartIndex, e.EndIndex); - } - - void OnPropertyChanged (object sender, PropertyChangedEventArgs e) { - if (e.Key != "EnableAutoCorrection") - return; - if (!(e.NewValue is bool) || !(e.OldValue is bool)) - return; - - bool newValue = (bool)e.NewValue; - bool oldValue = (bool)e.OldValue; - - if (newValue && !oldValue) { - db.ParseInformationChanged += OnParseInformationChanged; - } else if (!newValue && oldValue) { - ResetUnderlineChangement (); - db.ParseInformationChanged -= OnParseInformationChanged; - } - } - - void ParseCompilationUnit (ICompilationUnitBase cu) - { - // No new errors - if (!cu.ErrorsDuringCompile || cu.ErrorInformation == null) - return; - - // We replace the error tags at the highest priority - synErrorTag.Priority = buf.TagTable.Size - 1; - // Else we underline the error - foreach (ErrorInfo info in cu.ErrorInformation) - UnderLineError (info); - } - - void UnderLineError (ErrorInfo info) - { - // Adjust the line to Gtk line representation - info.Line -= 1; - - // If the line is already underlined - if (errors.ContainsKey (info.Line)) - return; - - TextIter startIter = buf.GetIterAtLine (info.Line); - while (startIter.Char == "\t" || startIter.Char == " ") - startIter.ForwardChar (); - - TextIter endIter = buf.GetIterAtLine (info.Line); - endIter.ForwardToLineEnd (); - - errors [info.Line] = info; - - UnderlineErrorAt (ref startIter, ref endIter); - } - - void UnderlineErrorAt (ref TextIter start, ref TextIter end) - { - buf.ApplyTag ("synError", start, end); - } - - void ResetUnderlineChangement () - { - if (errors.Count > 0) { - buf.RemoveTag ("synError", buf.StartIter, buf.EndIter); - errors.Clear (); - } - } - - string GetErrorInformationAt (TextIter iter) - { - ErrorInfo info; - if (errors.TryGetValue (iter.Line, out info)) - return "<b>" + GettextCatalog.GetString ("Parser Error:") + "</b> " + info.Message; - else - return null; - } - - bool AutocorrResetMeth () - { - ResetUnderlineChangement (); - if (lastCu != null) - ParseCompilationUnit (lastCu); - resetTimerStarted = false; - return false; - } - - void UpdateAutocorTimer () - { - uint timeout = 900; - - if (resetTimerStarted) { - // Reset the timer - GLib.Source.Remove (resetTimerId); - resetTimerId = GLib.Timeout.Add (timeout, AutocorrResetMeth); - } else { - // Start the timer for the first time - resetTimerStarted = true; - resetTimerId = GLib.Timeout.Add (timeout, AutocorrResetMeth); - } - } - - - public bool EnableCodeCompletion { - get { return codeCompleteEnabled; } - set { codeCompleteEnabled = value; } - } - - public bool AutoInsertTemplates { - get { return autoInsertTemplates; } - set { autoInsertTemplates = value; } - } - - protected SourceEditorView (IntPtr p): base (p) - { - } - - public SourceEditorView (SourceEditorBuffer buf, SourceEditor parent) - { - this.ParentEditor = parent; - this.TabWidth = 4; - Buffer = this.buf = buf; - AutoIndent = false; - SmartHomeEnd = SourceSmartHomeEndType.Always; - ShowLineNumbers = true; - //FIXME GTKSV2 - //ShowLineMarkers = true; - controlsDrawer = new DrawControlCharacterImp (this); - buf.PlaceCursor (buf.StartIter); - GrabFocus (); - buf.MarkSet += new MarkSetHandler (BufferMarkSet); - buf.Changed += new EventHandler (BufferChanged); - LoadEditActions (); - this.Events = this.Events | EventMask.PointerMotionMask | EventMask.LeaveNotifyMask | EventMask.ExposureMask; - - InitAutoCorrectionValues(); - } - - protected override void OnDestroyed () - { - if (showTipScheduled) - GLib.Source.Remove (tipTimeoutId); - controlsDrawer.Detach (); - HideLanguageItemWindow (); - buf.MarkSet -= new MarkSetHandler (BufferMarkSet); - buf.Changed -= new EventHandler (BufferChanged); - CleanAutoCorrectionValues(); - - base.OnDestroyed (); - } - - public ITextEditorExtension AttachExtension (ITextEditorExtension extension) - { - this.extension = extension; - return this; - } - - TextEditor ThisEditor { - get { - if (thisEditor == null) - thisEditor = TextEditor.GetTextEditor (ParentEditor.DisplayBinding); - return thisEditor; - } - } - - protected override bool OnMotionNotifyEvent (Gdk.EventMotion evnt) - { - bool res = base.OnMotionNotifyEvent (evnt); - UpdateLanguageItemWindow (); - return res; - } - - void UpdateLanguageItemWindow () - { - if (languageItemWindow != null) { - // Tip already being shown. Update it. - ShowTooltip (); - } - else if (showTipScheduled) { - // Tip already scheduled. Reset the timer. - GLib.Source.Remove (tipTimeoutId); - tipTimeoutId = GLib.Timeout.Add (LanguageItemTipTimer, ShowTooltip); - } - else { - // Start a timer to show the tip - showTipScheduled = true; - tipTimeoutId = GLib.Timeout.Add (LanguageItemTipTimer, ShowTooltip); - } - } - - bool ShowTooltip () - { - ModifierType mask; // ignored - int xloc, yloc; - string errorInfo; - - showTipScheduled = false; - - this.GetWindow (TextWindowType.Text).GetPointer (out xloc, out yloc, out mask); - - TextIter ti = this.GetIterAtLocation (xloc + this.VisibleRect.X, yloc + this.VisibleRect.Y); - ILanguageItem item = GetLanguageItem (ti); - - if (item != null) { - // Tip already being shown for this language item? - if (languageItemWindow != null && tipItem != null && tipItem.Equals (item)) - return false; - - langTipX = xloc; - langTipY = yloc; - tipItem = item; - - HideLanguageItemWindow (); - - IParserContext pctx = GetParserContext (); - if (pctx == null) - return false; - - DoShowTooltip (new LanguageItemWindow (tipItem, pctx, GetAmbience (), - GetErrorInformationAt (ti)), langTipX, langTipY); - - - } else if (!string.IsNullOrEmpty ((errorInfo = GetErrorInformationAt(ti)))) { - // Error tooltip already shown - if (languageItemWindow != null && tiItem == ti.Line) - return false; - tiItem = ti.Line; - - HideLanguageItemWindow (); - DoShowTooltip (new LanguageItemWindow (null, null, null, errorInfo), xloc, yloc); - } else - HideLanguageItemWindow (); - - return false; - } - - void DoShowTooltip (LanguageItemWindow liw, int xloc, int yloc) - { - languageItemWindow = liw; - - int ox, oy; - this.GetWindow (TextWindowType.Text).GetOrigin (out ox, out oy); - int w = languageItemWindow.Child.SizeRequest ().Width; - languageItemWindow.Move (xloc + ox - (w/2), yloc + oy + 20); - languageItemWindow.ShowAll (); - } - - protected override void OnUnrealized () - { - if (showTipScheduled) { - GLib.Source.Remove (tipTimeoutId); - showTipScheduled = false; - } - base.OnUnrealized (); - } - - - - protected override bool OnLeaveNotifyEvent (Gdk.EventCrossing evnt) - { - HideLanguageItemWindow (); - return base.OnLeaveNotifyEvent (evnt); - } - - protected override bool OnScrollEvent (Gdk.EventScroll evnt) - { - HideLanguageItemWindow (); - return base.OnScrollEvent (evnt); - } - - public void HideLanguageItemWindow () - { - if (showTipScheduled) { - GLib.Source.Remove (tipTimeoutId); - showTipScheduled = false; - } - if (languageItemWindow != null) { - languageItemWindow.Destroy (); - languageItemWindow = null; - } - } - - void BufferMarkSet (object s, MarkSetArgs a) - { - if (a.Mark.Name == "insert") { - NotifyCompletionContextChanged (); - buf.HideHighlightLine (); - } - } - - void LoadEditActions () - { - string editactionsPath = "/MonoDevelop/SourceEditor/EditActions"; - IEditAction[] actions = (IEditAction[]) AddinManager.GetExtensionObjects (editactionsPath, typeof(IEditAction)); - foreach (IEditAction action in actions) - editactions.Add (action); - } - - protected override bool OnFocusOutEvent (EventFocus e) - { - NotifyCompletionContextChanged (); - return base.OnFocusOutEvent (e); - } - - void BufferChanged (object s, EventArgs args) - { - NotifyCompletionContextChanged (); - } - - protected override bool OnButtonPressEvent (Gdk.EventButton e) - { - bool result; - - NotifyCompletionContextChanged (); - HideLanguageItemWindow (); - - //FIXME GTKSV2 - //if (!ShowLineMarkers) - // goto done; - - if (e.Window == GetWindow (Gtk.TextWindowType.Left)) { - int x, y; - WindowToBufferCoords (Gtk.TextWindowType.Left, (int) e.X, (int) e.Y, out x, out y); - TextIter line; - int top; - - GetLineAtY (out line, y, out top); - buf.PlaceCursor (line); - - if (e.Button == 1) { - //FIXME GTKSV2 - //buf.ToggleBookmark (line.Line); - } else if (e.Button == 3) { - /*FIXME GTKSV2 - CommandEntrySet cset = new CommandEntrySet (); - - cset.AddItem (SearchCommands.ToggleBookmark); - cset.AddItem (SearchCommands.ClearBookmarks); - cset.AddItem (Command.Separator); - cset.AddItem (DebugCommands.ToggleBreakpoint); - cset.AddItem (DebugCommands.ClearAllBreakpoints); - Gtk.Menu menu = IdeApp.CommandService.CreateMenu (cset); - - menu.Popup (null, null, null, 3, e.Time);*/ - } - } else if (e.Button == 3 && buf.GetSelectedText ().Length == 0) { - int x, y; - WindowToBufferCoords (Gtk.TextWindowType.Text, (int) e.X, (int) e.Y, out x, out y); - buf.PlaceCursor (GetIterAtLocation (x, y)); - } - - //done: - - result = base.OnButtonPressEvent (e); - - if (extension != null) - extension.CursorPositionChanged (); - - return result; - } - - protected override void OnPopulatePopup (Menu menu) - { - HideLanguageItemWindow (); - - CommandEntrySet cset = IdeApp.CommandService.CreateCommandEntrySet ("/MonoDevelop/SourceEditor/ContextMenu/Editor"); - if (cset.Count > 0) { - cset.AddItem (Command.Separator); - IdeApp.CommandService.InsertOptions (menu, cset, 0); - } - base.OnPopulatePopup (menu); - } - /* FIXME GTKSV2 - public void ShowBreakpointAt (int linenumber) - { - if (!buf.IsMarked (linenumber, SourceMarkerType.BreakpointMark)) - buf.ToggleMark (linenumber, SourceMarkerType.BreakpointMark); - } - - public void ClearBreakpointAt (int linenumber) - { - if (buf.IsMarked (linenumber, SourceMarkerType.BreakpointMark)) - buf.ToggleMark (linenumber, SourceMarkerType.BreakpointMark); - } - - public void ExecutingAt (int linenumber) - { - buf.ToggleMark (linenumber, SourceMarkerType.ExecutionMark); - buf.MarkupLine (linenumber); - } - - public void ClearExecutingAt (int linenumber) - { - buf.ToggleMark (linenumber, SourceMarkerType.ExecutionMark); - buf.UnMarkupLine (linenumber); - } -*/ - public void SimulateKeyPress (ref Gdk.EventKey evnt) - { - Global.PropagateEvent (this, evnt); - } - - [CommandHandler (TextEditorCommands.DeleteToLineEnd)] - internal void DeleteLine () - { - TextIter start = buf.GetIterAtMark (buf.InsertMark); - TextIter end = start; - - if (!end.EndsLine ()) { - // Delete up to, but not including, the end-of-line marker - end.ForwardToLineEnd (); - } else { - // Delete the end-of-line marker - end.Offset++; - } - - using (AtomicUndo a = new AtomicUndo (buf)) - buf.Delete (ref start, ref end); - } - - IParserContext GetParserContext () - { - string file = ParentEditor.DisplayBinding.IsUntitled ? ParentEditor.DisplayBinding.UntitledName : ParentEditor.DisplayBinding.ContentName; - Project project = ParentEditor.DisplayBinding.Project; - IParserDatabase pdb = IdeApp.Workspace.ParserDatabase; - - if (project != null) - return pdb.GetProjectParserContext (project); - else - return pdb.GetFileParserContext (file); - } - - public MonoDevelop.Projects.Ambience.Ambience GetAmbience () - { - Project project = ParentEditor.DisplayBinding.Project; - if (project != null) - return project.Ambience; - else { - string file = ParentEditor.DisplayBinding.IsUntitled ? ParentEditor.DisplayBinding.UntitledName : ParentEditor.DisplayBinding.ContentName; - return MonoDevelop.Projects.Services.Ambience.GetAmbienceForFile (file); - } - } - - [CommandHandler (HelpCommands.Help)] - internal void MonodocResolver () - { - TextIter insertIter = buf.GetIterAtMark (buf.InsertMark); - ILanguageItem languageItem = GetLanguageItem (insertIter); - - if (languageItem != null) - IdeApp.HelpOperations.ShowHelp (MonoDevelop.Projects.Services.DocumentationService.GetHelpUrl(languageItem)); - } - - [CommandUpdateHandler (HelpCommands.Help)] - internal void MonodocResolverUpdate (CommandInfo cinfo) - { - TextIter insertIter = buf.GetIterAtMark (buf.InsertMark); - ILanguageItem languageItem = GetLanguageItem (insertIter); - - if (languageItem == null) - cinfo.Bypass = true; - } - - ILanguageItem GetLanguageItem (TextIter ti) - { - string txt = buf.Text; - string fileName = ParentEditor.DisplayBinding.ContentName; - if (fileName == null) - fileName = ParentEditor.DisplayBinding.UntitledName; - - IParserContext ctx = GetParserContext (); - if (ctx == null) - return null; - - IExpressionFinder expressionFinder = null; - if (fileName != null) - expressionFinder = ctx.GetExpressionFinder (fileName); - - string expression = expressionFinder == null ? TextUtilities.GetExpressionBeforeOffset (this, ti.Offset) : expressionFinder.FindFullExpression (txt, ti.Offset).Expression; - if (expression == null) - return null; - - return ctx.ResolveIdentifier (expression, ti.Line + 1, ti.LineOffset + 1, fileName, txt); - } - - public double VScroll { - get { - return ParentEditor.Vadjustment.Value; - } - set { - ParentEditor.Vadjustment.Value = value; - ParentEditor.Vadjustment.ChangeValue(); - } - - } - - [CommandHandler (TextEditorCommands.ScrollLineUp)] - internal void ScrollUp () - { - ParentEditor.Vadjustment.Value -= (ParentEditor.Vadjustment.StepIncrement / 5); - if (ParentEditor.Vadjustment.Value < 0.0d) - ParentEditor.Vadjustment.Value = 0.0d; - - ParentEditor.Vadjustment.ChangeValue(); - } - - [CommandHandler (TextEditorCommands.ScrollLineDown)] - internal void ScrollDown () - { - double maxvalue = ParentEditor.Vadjustment.Upper - ParentEditor.Vadjustment.PageSize; - double newvalue = ParentEditor.Vadjustment.Value + (ParentEditor.Vadjustment.StepIncrement / 5); - - if (newvalue > maxvalue) - ParentEditor.Vadjustment.Value = maxvalue; - else - ParentEditor.Vadjustment.Value = newvalue; - - ParentEditor.Vadjustment.ChangeValue(); - } - - protected override bool OnKeyPressEvent (Gdk.EventKey evnt) - { - evntCopy = evnt; - - //FIXME use Gdk.Keyval.ToUnicode rtc - if (extension == null) - return ((ITextEditorExtension)this).KeyPress (evnt.Key, (char)evnt.KeyValue, evnt.State); - else - return extension.KeyPress (evnt.Key, (char)evnt.KeyValue, evnt.State); - } - - Gdk.EventKey evntCopy; - - bool ITextEditorExtension.KeyPress (Gdk.Key key, char ch, Gdk.ModifierType modifier) - { - Gdk.EventKey evnt = evntCopy; - HideLanguageItemWindow (); - - bool res = false; - IEditAction action = editactions.GetAction (evnt.Key, evnt.State); - if (action != null) { - action.PreExecute (this); - if (action.PassToBase) - base.OnKeyPressEvent (evnt); - - action.Execute (this); - - if (action.PassToBase) - base.OnKeyPressEvent (evnt); - action.PostExecute (this); - - res = true; - } else { - res = base.OnKeyPressEvent (evnt); - } - return res; - } - - void ITextEditorExtension.TextChanged (int startIndex, int endIndex) - { - } - - protected override void OnMoveCursor (MovementStep step, int count, bool extend_selection) - { - base.OnMoveCursor (step, count, extend_selection); - - if (extension != null) - extension.CursorPositionChanged (); - } - - void ITextEditorExtension.CursorPositionChanged () - { - NavigationService.Log (ParentEditor.DisplayBinding.BuildNavPoint ()); - } - - object ITextEditorExtension.GetExtensionCommandTarget () - { - // There is no need to process commands here because they are all - // processed before the editor extensions - return null; - } - - [CommandHandler (TextEditorCommands.CharRight)] - internal void CursorRight () - { - buf.BeginUserAction (); - TextIter it = buf.GetIterAtMark (buf.InsertMark); - it.ForwardChar (); - buf.MoveMark (buf.InsertMark, it); - buf.MoveMark (buf.SelectionBound, it); - buf.EndUserAction (); - } - - int FindPrevWordStart (string doc, int offset) - { - for (offset--; offset >= 0; offset--) { - if (System.Char.IsWhiteSpace (doc, offset)) - break; - } - return ++offset; - } - - public string GetWordBeforeCaret () - { - int offset = buf.GetIterAtMark (buf.InsertMark).Offset; - int start = FindPrevWordStart (buf.Text, offset); - return buf.Text.Substring (start, offset - start); - } - - public int DeleteWordBeforeCaret () - { - int offset = buf.GetIterAtMark (buf.InsertMark).Offset; - int start = FindPrevWordStart (buf.Text, offset); - TextIter startIter = buf.GetIterAtOffset (start); - TextIter offsetIter = buf.GetIterAtOffset (offset); - buf.Delete (ref startIter, ref offsetIter); - return start; - } - - public string GetLeadingWhiteSpace (int line) - { - string lineText = ThisEditor.GetLineText (line + 1); - int index = 0; - while (index < lineText.Length && System.Char.IsWhiteSpace (lineText[index])) - index++; - - return index > 0 ? lineText.Substring (0, index) : ""; - } - - // handles the details of inserting a code template - // returns true if it was inserted - public bool InsertTemplate () - { - if (AutoInsertTemplates) { - string word = GetWordBeforeCaret (); - if (word != null) { - CodeTemplateGroup templateGroup = CodeTemplateService.GetTemplateGroupPerFilename (ParentEditor.DisplayBinding.ContentName); - if (templateGroup != null) { - foreach (CodeTemplate template in templateGroup.Templates) { - if (template.Shortcut == word) { - InsertTemplate (template); - return true; - } - } - } - } - } - return false; - } - - public void InsertTemplate (CodeTemplate template) - { - TextIter iter = buf.GetIterAtMark (buf.InsertMark); - int newCaretOffset = iter.Offset; - string word = GetWordBeforeCaret ().Trim (); - int beginLine = iter.Line; - int endLine = beginLine; - if (word.Length > 0) - newCaretOffset = DeleteWordBeforeCaret (); - - string leadingWhiteSpace = GetLeadingWhiteSpace (beginLine); - - int finalCaretOffset = newCaretOffset; - - for (int i =0; i < template.Text.Length; ++i) { - switch (template.Text[i]) { - case '|': - finalCaretOffset = newCaretOffset; - break; - case '\r': - break; - case '\t': - buf.InsertAtCursor ("\t"); - newCaretOffset++; - break; - case '\n': - buf.InsertAtCursor ("\n"); - newCaretOffset++; - endLine++; - break; - default: - buf.InsertAtCursor (template.Text[i].ToString ()); - newCaretOffset++; - break; - } - } - - if (endLine > beginLine) { - IndentLines (beginLine+1, endLine, leadingWhiteSpace); - } - - buf.PlaceCursor (buf.GetIterAtOffset (finalCaretOffset)); - } - - -#region Indentation - public bool IndentSelection (bool unindent, bool requireLineSelection) - { - TextIter begin, end; - bool hasSelection = buf.GetSelectionBounds (out begin, out end); - if (!hasSelection) { - if (requireLineSelection) - return false; - else - begin = end = buf.GetIterAtMark (buf.InsertMark); - } - - int y0 = begin.Line, y1 = end.Line; - - if (requireLineSelection && y0 == y1) - return false; - - // If last line isn't selected, it's illogical to indent it. - if (end.StartsLine() && hasSelection && y0 != y1) - y1--; - - using (AtomicUndo a = new AtomicUndo (buf)) { - if (unindent) - UnIndentLines (y0, y1); - else - IndentLines (y0, y1); - if (hasSelection) - SelectLines (y0, y1); - } - - return true; - } - - public void FormatLine () - { - if (TextEditorProperties.IndentStyle == IndentStyle.Smart) { - TextIter iter = buf.GetIterAtMark (buf.InsertMark); - fmtr.FormatLine (ThisEditor, iter.Line + 1, iter.Offset, '\n', TextEditorProperties.IndentString, TextEditorProperties.AutoInsertCurlyBracket); - } - IndentLine (); - } - - public void IndentLine () - { - TextIter iter = buf.GetIterAtMark (buf.InsertMark); - - // preserve offset in line - int n, offset = 0; - - if ((n = fmtr.IndentLine (ThisEditor, iter.Line + 1, TextEditorProperties.IndentString)) == 0) - return; - - offset += n; - - // FIXME: not quite right yet - // restore the offset - TextIter nl = buf.GetIterAtMark (buf.InsertMark); - if (offset < nl.CharsInLine) - nl.LineOffset = offset; - buf.PlaceCursor (nl); - } - - void IndentLines (int y0, int y1) - { - IndentLines (y0, y1, InsertSpacesInsteadOfTabs ? new string (' ', (int) TabWidth) : "\t"); - } - - void IndentLines (int y0, int y1, string indent) - { - for (int l = y0; l <= y1; l ++) { - TextIter it = Buffer.GetIterAtLine (l); - if (!it.EndsLine()) - Buffer.Insert (ref it, indent); - } - } - - void UnIndentLines (int y0, int y1) - { - for (int l = y0; l <= y1; l ++) { - TextIter start = Buffer.GetIterAtLine (l); - TextIter end = start; - - char c = start.Char[0]; - - if (c == '\t') { - end.ForwardChar (); - buf.Delete (ref start, ref end); - - } else if (c == ' ') { - int cnt = 0; - int max = (int) TabWidth; - - while (cnt < max && end.Char[0] == ' ' && ! end.EndsLine ()) { - cnt ++; - end.ForwardChar (); - } - - if (cnt == 0) - return; - - buf.Delete (ref start, ref end); - } - } - } - - void SelectLines (int y0, int y1) - { - Buffer.PlaceCursor (Buffer.GetIterAtLine (y0)); - - if (y1 < Buffer.EndIter.Line) { - TextIter end = Buffer.GetIterAtLine (y1 + 1); - end.LineOffset = 0; - Buffer.MoveMark ("selection_bound", end); - } else - Buffer.MoveMark ("selection_bound", Buffer.EndIter); - } - -#endregion - - -#region ICompletionWidget - - void NotifyCompletionContextChanged () - { - if (completionContextChanged != null) - completionContextChanged (this, EventArgs.Empty); - } - - event EventHandler ICompletionWidget.CompletionContextChanged { - add { completionContextChanged += value; } - remove { completionContextChanged -= value; } - } - - CodeCompletionContext ICompletionWidget.CreateCodeCompletionContext (int triggerOffset) - { - TextIter iter = Buffer.GetIterAtOffset (triggerOffset); - Gdk.Rectangle rect = GetIterLocation (iter); - int wx, wy; - BufferToWindowCoords (Gtk.TextWindowType.Widget, rect.X, rect.Y + rect.Height, out wx, out wy); - int tx, ty; - GdkWindow.GetOrigin (out tx, out ty); - - CodeCompletionContext ctx = new CodeCompletionContext (); - ctx.TriggerOffset = iter.Offset; - ctx.TriggerLine = iter.Line; - ctx.TriggerLineOffset = iter.LineOffset; - ctx.TriggerXCoord = tx + wx; - ctx.TriggerYCoord = ty + wy; - ctx.TriggerTextHeight = rect.Height; - return ctx; - } - - string ICompletionWidget.GetCompletionText (CodeCompletionContext ctx) - { - return Buffer.GetText (Buffer.GetIterAtOffset (ctx.TriggerOffset), Buffer.GetIterAtMark (Buffer.InsertMark), false); - } - int ICompletionWidget.SelectedLength { get { return buf.GetSelectedText ().Length; } } - void ICompletionWidget.SetCompletionText (CodeCompletionContext ctx, string partial_word, string complete_word) - { - TextIter iter1, iter2; - if (buf.GetSelectionBounds (out iter1, out iter2)) { - buf.Delete (ref iter1, ref iter2); - } - TextIter offsetIter = buf.GetIterAtOffset (ctx.TriggerOffset); - TextIter endIter = buf.GetIterAtOffset (offsetIter.Offset + partial_word.Length); - buf.MoveMark (buf.InsertMark, offsetIter); - buf.Delete (ref offsetIter, ref endIter); - int idx = complete_word.IndexOf ('|'); // | in the completion text now marks the caret position - if (idx >= 0) - complete_word = complete_word.Remove (idx, 1); - buf.InsertAtCursor (complete_word); - if (idx >= 0) { - TextIter it = buf.GetIterAtMark (buf.InsertMark); - buf.PlaceCursor (buf.GetIterAtOffset (it.Offset - complete_word.Length + idx)); - } - ScrollMarkOnscreen (buf.InsertMark); - } - - int ICompletionWidget.TextLength - { - get - { - return buf.EndIter.Offset + 1; - } - } - - char ICompletionWidget.GetChar (int offset) - { - return buf.GetIterAtOffset (offset).Char[0]; - } - - string ICompletionWidget.GetText (int startOffset, int endOffset) - { - return buf.GetText(buf.GetIterAtOffset (startOffset), buf.GetIterAtOffset(endOffset), true); - } - - Gtk.Style ICompletionWidget.GtkStyle - { - get - { - return Style.Copy(); - } - } -#endregion - -#region Drawing control characters functionality - class DrawControlCharacterImp - { - SourceView view; - - public DrawControlCharacterImp (SourceView view) - { - this.view = view; - view.WidgetEventAfter += OnWidgetEvent; - } - - public void Detach () - { - view.WidgetEventAfter -= OnWidgetEvent; - view = null; - } - - void OnWidgetEvent (object o, WidgetEventAfterArgs args) - { - if (args.Event.Type == Gdk.EventType.Expose && - o is TextView && - args.Event.Window == view.GetWindow (TextWindowType.Text)) - { - int x, y; - view.WindowToBufferCoords (TextWindowType.Text, - args.Event.Window.ClipRegion.Clipbox.X, - args.Event.Window.ClipRegion.Clipbox.Y, - out x, out y); - - TextIter start, end; - int topLine; - view.GetLineAtY (out start, y, out topLine); - view.GetLineAtY (out end, y + args.Event.Window.ClipRegion.Clipbox.Height, out topLine); - end.ForwardToLineEnd (); - Draw (args.Event.Window, view, start, end); - } - } - - static Cairo.Color GetDrawingColorForIter (TextView view, TextIter iter) - { - TextIter start, end; - Gdk.Color color; - Gdk.Color bgColor; - - if (iter.Buffer.GetSelectionBounds (out start, out end) && iter.InRange (start, end)) { - bgColor = view.Style.Base (StateType.Selected); - color = view.Style.Text (StateType.Selected); - } else { - bgColor = view.Style.Base (StateType.Normal); - color = view.Style.Text (StateType.Normal); - } - - //simple interpolation 1/4 of way between BG colour and text colour - int red = (bgColor.Red * 3 + color.Red ) / 4; - int green = (bgColor.Green * 3 + color.Green) / 4; - int blue = (bgColor.Blue * 3 + color.Blue ) / 4; - - return new Cairo.Color ((double)(red) / UInt16.MaxValue, - (double)(green) / UInt16.MaxValue, - (double)(blue) / UInt16.MaxValue); - } - - static void DrawSpaceAtIter (Cairo.Context cntx, TextView view, TextIter iter) - { - Gdk.Rectangle rect = view.GetIterLocation (iter); - int x, y; - view.BufferToWindowCoords (TextWindowType.Text, - rect.X + rect.Width / 2, - rect.Y + rect.Height / 2, - out x, out y); - cntx.Save (); - cntx.Color = GetDrawingColorForIter (view, iter); - //no overlap on the circle, even if context is set to LineCap.Square - cntx.LineCap = Cairo.LineCap.Butt; - - cntx.MoveTo (x, y); - cntx.Arc (x, y, 0.5, 0, 2 * Math.PI); - - cntx.Stroke (); - cntx.Restore (); - } - - static void DrawTabAtIter (Cairo.Context cntx, TextView view, TextIter iter) - { - Gdk.Rectangle rect = view.GetIterLocation (iter); - int x, y; - view.BufferToWindowCoords (TextWindowType.Text, - rect.X, - rect.Y + rect.Height / 2, - out x, out y); - cntx.Save (); - cntx.Color = GetDrawingColorForIter (view, iter); - - double arrowSize = 3; - cntx.MoveTo (x + 2, y + 0); - cntx.RelLineTo (new Cairo.Distance (rect.Width - 4, 0)); - cntx.RelLineTo (new Cairo.Distance (-arrowSize, -arrowSize)); - cntx.RelMoveTo (new Cairo.Distance (arrowSize, arrowSize)); - cntx.RelLineTo (new Cairo.Distance (-arrowSize, arrowSize)); - - cntx.Stroke (); - cntx.Restore (); - } - - static void DrawLineEndAtIter (Cairo.Context cntx, TextView view, TextIter iter) - { - Gdk.Rectangle rect = view.GetIterLocation (iter); - int x, y; - view.BufferToWindowCoords (TextWindowType.Text, - rect.X, - rect.Y + rect.Height / 2, - out x, out y); - cntx.Save (); - cntx.Color = GetDrawingColorForIter (view, iter); - - double arrowSize = 3; - cntx.MoveTo (x + 10, y); - cntx.RelLineTo (new Cairo.Distance (0, -arrowSize)); - cntx.RelMoveTo (new Cairo.Distance (0, arrowSize)); - cntx.RelLineTo (new Cairo.Distance (-8, 0)); - cntx.RelLineTo (new Cairo.Distance (arrowSize, arrowSize)); - cntx.RelMoveTo (new Cairo.Distance (-arrowSize, -arrowSize)); - cntx.RelLineTo (new Cairo.Distance (arrowSize, -arrowSize)); - - cntx.Stroke (); - cntx.Restore (); - } - - static void Draw (Gdk.Drawable drawable, TextView view, TextIter start, TextIter end) - { - if (HighlightSpacesEnabled || HighlightTabsEnabled || HighlightNewlinesEnabled) - { - Cairo.Context cntx = Gdk.CairoHelper.Create (drawable); - - //shift to pixel grid to reduce antialiasing - cntx.Antialias = Cairo.Antialias.Default; - cntx.LineCap = Cairo.LineCap.Square; - cntx.LineWidth = 1; - cntx.Translate (0.5, 0.5); - - TextIter iter = start; - while (iter.Compare (end) <= 0) - { - switch (iter.Char) - { - case " ": - if (HighlightSpacesEnabled) - DrawSpaceAtIter (cntx, view, iter); - break; - case "\t": - if (HighlightTabsEnabled) - DrawTabAtIter (cntx, view, iter); - break; - case "\n": - case "\r": - if (HighlightNewlinesEnabled) - DrawLineEndAtIter (cntx, view, iter); - break; - default: - break; - } - if (! iter.ForwardChar ()) - break; - } - ((IDisposable)cntx).Dispose (); - } - } - } -#endregion - } -} diff --git a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui/SourceEditorWidget.cs b/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui/SourceEditorWidget.cs deleted file mode 100644 index 02b5bd12bf..0000000000 --- a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui/SourceEditorWidget.cs +++ /dev/null @@ -1,288 +0,0 @@ -using Gtk; - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; - -using MonoDevelop.Components.Commands; - -using MonoDevelop.SourceEditor.Gui.Dialogs; -using GtkSourceView; -using MonoDevelop.SourceEditor; -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui.Search; -using MonoDevelop.Ide.Commands; -using MonoDevelop.Ide.Gui; -using Stock = Stock; - -namespace MonoDevelop.SourceEditor.Gui -{ - public class SourceEditor : ScrolledWindow - { - public SourceEditorBuffer Buffer; - public SourceEditorView View; - public SourceEditorDisplayBindingWrapper DisplayBinding; - Dictionary<string,Gdk.Pixbuf> markers = new Dictionary<string,Gdk.Pixbuf> (); - - static Gdk.Pixbuf dragIconPixbuf; - static Gdk.Pixbuf executionMarkerPixbuf; - static Gdk.Pixbuf breakPointPixbuf; - - static SourceEditor () - { - dragIconPixbuf = Gdk.Pixbuf.LoadFromResource ("bookmark.png"); - executionMarkerPixbuf = ImageService.GetPixbuf (Stock.ExecutionMarker); - breakPointPixbuf = ImageService.GetPixbuf (Stock.BreakPoint); - } - - protected SourceEditor (IntPtr ptr): base (ptr) - { - } - - public SourceEditor (SourceEditorDisplayBindingWrapper bind) - { - ShadowType = Gtk.ShadowType.In; - DisplayBinding = bind; - Buffer = new SourceEditorBuffer (); - View = new SourceEditorView (Buffer, this); - Buffer.View = View; - this.VscrollbarPolicy = PolicyType.Automatic; - this.HscrollbarPolicy = PolicyType.Automatic; - - AddMarker ("SourceEditorBookmark", dragIconPixbuf); - AddMarker ("ExecutionMark", executionMarkerPixbuf); - AddMarker ("BreakpointMark", breakPointPixbuf); - - Add (View); - } - - protected override void OnDestroyed () - { - Buffer.Dispose (); - base.OnDestroyed (); - } -/* FIXME GTKSV2 - public void ExecutingAt (int linenumber) - { - View.ExecutingAt (linenumber); - } - - public void ClearExecutingAt (int linenumber) - { - View.ClearExecutingAt (linenumber); - } -*/ - public string Text - { - get { return Buffer.Text; } - set { Buffer.Text = value; } - } - - public void Replace (int offset, int length, string pattern) - { - Buffer.Replace (offset, length, pattern); - } - - - public void SetSearchPattern () - { - string selectedText = Buffer.GetSelectedText (); - - if (selectedText != null && selectedText != String.Empty) - SearchReplaceManager.SearchOptions.SearchPattern = selectedText.Split ('\n')[0]; - } - - public void AddMarker (string name, Gdk.Pixbuf image) - { - // Keep track of markers in a dictionary. It is used in case the - // line height of the editor changes. - markers.Add (name, image); - //FIXME GTKSV2 - //View.SetMarkerPixbuf (name, FixMarkerSize (image)); - } - - internal void UpdateMarkerSize () - { - // Makes sure markers are not bigger than the line height - //foreach (KeyValuePair<string, Gdk.Pixbuf> entry in markers) { - //FIXME GTKSV2 - //View.SetMarkerPixbuf (entry.Key, FixMarkerSize (entry.Value)); - //} - } - - Gdk.Pixbuf FixMarkerSize (Gdk.Pixbuf pix) - { - // Returns a marker image with a size that fits the line height - - TextIter iter = View.Buffer.GetIterAtMark (View.Buffer.InsertMark); - int markerSize = View.GetIterLocation (iter).Height; - - if (pix.Height <= markerSize) - return pix; - - int width = pix.Width; - int height = markerSize; - - if ((pix.Width - width) > (pix.Height - height)) { - if (pix.Width != width) { - float prop = (float) pix.Height / (float) pix.Width; - return pix.ScaleSimple (width, (int)(width * prop), Gdk.InterpType.Bilinear); - } - } else { - if (pix.Height != height) { - float prop = (float) pix.Width / (float) pix.Height; - return pix.ScaleSimple ((int)(height * prop), height, Gdk.InterpType.Bilinear); - } - } - return pix; - } - - [CommandHandler (SearchCommands.Find)] - public void Find() - { - SetSearchPattern(); - SearchReplaceManager.ShowFindWindow (); - } - - [CommandHandler (SearchCommands.FindNext)] - public void FindNext () - { - SearchReplaceManager.FindNext (); - } - - [CommandHandler (SearchCommands.FindPrevious)] - public void FindPrevious () - { - SearchReplaceManager.FindPrevious (); - } - - [CommandHandler (SearchCommands.FindNextSelection)] - public void FindNextSelection () - { - SetSearchPattern(); - SearchReplaceManager.FindNext (); - } - - [CommandHandler (SearchCommands.FindPreviousSelection)] - public void FindPreviousSelection () - { - SetSearchPattern(); - SearchReplaceManager.FindPrevious (); - } - - [CommandHandler (SearchCommands.Replace)] - public void Replace () - { - SetSearchPattern (); - SearchReplaceManager.ShowFindReplaceWindow (); - - } - - protected static string StrMiddleTruncate (string str, int truncLen) - { - if (str == null) return String.Empty; - if (str.Length <= truncLen) return str; - - string delimiter = "..."; - int leftOffset = (truncLen - delimiter.Length) / 2; - int rightOffset = str.Length - truncLen + leftOffset + delimiter.Length; - - return str.Substring (0, leftOffset) + delimiter + str.Substring (rightOffset); - } -/* FIXME GTKSV2 - - protected void CreatePrintJob () - { - if (printDialog == null || printJob == null) - { - PrintConfig config = PrintConfig.Default (); - SourcePrintJob sourcePrintJob = new SourcePrintJob (config, Buffer); - sourcePrintJob.upFromView = View; - sourcePrintJob.PrintHeader = true; - sourcePrintJob.PrintFooter = true; - sourcePrintJob.SetHeaderFormat (GettextCatalog.GetString ("File:") + " " + - StrMiddleTruncate (IdeApp.Workbench.ActiveDocument.FileName, 60), null, null, true); - sourcePrintJob.SetFooterFormat (GettextCatalog.GetString ("MonoDevelop"), null, GettextCatalog.GetString ("Page") + " %N/%Q", true); - sourcePrintJob.WrapMode = WrapMode.Word; - printJob = sourcePrintJob.Print (); - } - } - - public void PrintDocument () - { - if (printDialog == null) - { - CreatePrintJob (); - printDialog = new PrintDialog (printJob, GettextCatalog.GetString ("Print Source Code")); - printDialog.SkipTaskbarHint = true; - printDialog.Modal = true; -// printDialog.IconName = "gtk-print"; - printDialog.SetPosition (WindowPosition.CenterOnParent); - printDialog.Gravity = Gdk.Gravity.Center; - printDialog.TypeHint = Gdk.WindowTypeHint.Dialog; - printDialog.TransientFor = IdeApp.Workbench.RootWindow; - printDialog.KeepAbove = false; - printDialog.Response += new ResponseHandler (OnPrintDialogResponsed); - printDialog.Close += new EventHandler (OnPrintDialogClosing); - printDialog.Run (); - } - } - - protected void OnPrintDialogClosing (object o, EventArgs args) - { - printDialog = null; - } - - protected void OnPrintDialogResponsed (object o, ResponseArgs args) - { - switch ((int)args.ResponseId) - { - case (int)PrintButtons.Print: - int result = printJob.Print (); - if (result != 0) - IdeApp.Services.MessageService.ShowError (GettextCatalog.GetString ("Print operation failed.")); - goto default; - case (int)PrintButtons.Preview: - PrintPreviewDocument (); - break; - default: - printDialog.HideAll (); - printDialog.Destroy (); - break; - } - } - - public void PrintPreviewDocument () - { - CreatePrintJob (); - PrintJobPreview preview = new PrintJobPreview (printJob, GettextCatalog.GetString ("Print Preview - Source Code")); - preview.Modal = true; - preview.SetPosition (WindowPosition.CenterOnParent); - preview.Gravity = Gdk.Gravity.Center; - if (printDialog != null) - preview.TransientFor = printDialog; - else - preview.TransientFor = IdeApp.Workbench.RootWindow; -// preview.IconName = "gtk-print-preview"; - preview.ShowAll (); - } - - [CommandHandler (DebugCommands.ToggleBreakpoint)] - public void ToggleBreakpoint () - { - if (Services.DebuggingService != null && DisplayBinding.ContentName != null) { - int line = Buffer.GetIterAtMark (Buffer.InsertMark).Line + 1; - Services.DebuggingService.ToggleBreakpoint (DisplayBinding.ContentName, line); - } - } - - [CommandUpdateHandler (DebugCommands.ToggleBreakpoint)] - public void UpdateToggleBreakpoint (CommandInfo info) - { - if (Services.DebuggingService == null) - info.Visible = false; - else - info.Enabled = DisplayBinding.ContentName != null; - }*/ - } -} diff --git a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui/TextNavigationPoint.cs b/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui/TextNavigationPoint.cs deleted file mode 100644 index ea0d084493..0000000000 --- a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.Gui/TextNavigationPoint.cs +++ /dev/null @@ -1,130 +0,0 @@ -// <file> -// <copyright see="prj:///doc/copyright.txt"/> -// <license see="prj:///doc/license.txt"/> -// <owner name="David Alpert" email="david@spinthemoose.com"/> -// <version>$Revision: 2247 $</version> -// </file> - -using System; -using System.Drawing; -using System.IO; - -using MonoDevelop.Ide.Gui; - -namespace MonoDevelop.SourceEditor.Gui { - /// <summary> - /// Description of TextNavigationPoint. - /// </summary> - public class TextNavigationPoint : DefaultNavigationPoint { - const int THREASHOLD = 5; - string content; - int lineNumber; - int column; - -#region constructors - public TextNavigationPoint () : this (String.Empty, 1, 1) - { - - } - - public TextNavigationPoint (string fileName) : this (fileName, 1, 1) - { - - } - - public TextNavigationPoint (string fileName, int lineNumber, int column) - : this (fileName, lineNumber, column, String.Empty) - { - - } - - public TextNavigationPoint (string fileName, int lineNumber, int column, string content) - : base (fileName) - { - this.column = column; - this.lineNumber = lineNumber; - this.content = content.Trim (); - } -#endregion - - // TODO: Navigation - eventually, we'll store a reference to the document - // itself so we can track filename changes, inserts (that affect - // line numbers), and dynamically retrieve the text at this.lineNumber - // - // what happens to the doc reference when the document is closed? - // - public int LineNumber { - get { return lineNumber; } - } - - public int Column { - get { return column; } - } - - public override void JumpTo () - { - IdeApp.Workbench.OpenDocument (FileName, lineNumber, column, true); - } - - public override void ContentChanging (object sender, EventArgs e) - { - // TODO: Navigation - finish ContentChanging -// if (e is DocumentEventArgs) { -// DocumentEventArgs de = (DocumentEventArgs)e; -// if (this.LineNumber >= -// } - } - -#region IComparable - public override int CompareTo (object obj) - { - int cmp; - - if ((cmp = base.CompareTo (obj)) != 0) - return cmp; - - TextNavigationPoint b = obj as TextNavigationPoint; - - if (this.LineNumber == b.LineNumber) - return 0; - - if (this.LineNumber > b.LineNumber) - return 1; - - return -1; - } -#endregion - -#region Equality - public override bool Equals (object obj) - { - TextNavigationPoint b = obj as TextNavigationPoint; - - if (b == null) - return false; - - return this.FileName.Equals (b.FileName) - && (Math.Abs (this.LineNumber - b.LineNumber) <= THREASHOLD); - } - - public override int GetHashCode () - { - return this.FileName.GetHashCode () ^ this.LineNumber.GetHashCode (); - } -#endregion - - public override string Description { - get { - return String.Format ("{0}: {1}", LineNumber, content); - } - } - - public override string FullDescription { - get { - return String.Format ("{0} - {1}", - Path.GetFileName (FileName), - Description); - } - } - } -} diff --git a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.mdp b/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.mdp deleted file mode 100644 index 3d3e5b5b88..0000000000 --- a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor.mdp +++ /dev/null @@ -1,89 +0,0 @@ -<Project name="MonoDevelop.SourceEditor" fileversion="2.0" language="C#" clr-version="Net_2_0" ctype="DotNetProject"> - <Configurations active="Debug"> - <Configuration name="Debug" ctype="DotNetProjectConfiguration"> - <Output directory="../../build/AddIns/" assembly="MonoDevelop.SourceEditor" /> - <Build debugmode="True" target="Library" /> - <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" /> - <CodeGeneration compiler="Mcs" warninglevel="3" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> - </Configuration> - <Configuration name="Release" ctype="DotNetProjectConfiguration"> - <Output directory="../../build/AddIns/" assembly="MonoDevelop.SourceEditor" /> - <Build debugmode="False" target="Library" /> - <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" /> - <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> - </Configuration> - </Configurations> - <Contents> - <File name="texteditoraddin.glade" subtype="Code" buildaction="EmbedAsResource" /> - <File name="EditorBindings.glade" subtype="Code" buildaction="EmbedAsResource" /> - <File name="MonoDevelop.SourceEditor/SourceViewService.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.SourceEditor.Gui/SourceEditorView.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.SourceEditor.Gui/SourceEditorWidget.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.SourceEditor.Gui.OptionPanels/MarkersTextEditorPanel.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.SourceEditor.Gui.Dialogs/EditTemplateGroupDialog.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.SourceEditor.Gui.Dialogs/GotoLineNumberDialog.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.SourceEditor/EditorCommands.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.SourceEditor.Actions/IEditAction.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.SourceEditor.Actions/EditActionCollection.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.SourceEditor.Actions/DefaultEditActions.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.SourceEditor.Codons/EditActionCodon.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.SourceEditor/Services.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.SourceEditor.Gui/LanguageItemWindow.cs" subtype="Code" buildaction="Compile" /> - <File name="ChangeLog" subtype="Code" buildaction="Nothing" /> - <File name="MonoDevelop.SourceEditor.addin.xml" subtype="Code" buildaction="EmbedAsResource" /> - <File name="bookmark.png" subtype="Code" buildaction="EmbedAsResource" /> - <File name="MonoDevelop.SourceEditor.FormattingStrategy/IFormattingStrategy.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.SourceEditor.FormattingStrategy/DefaultFormattingStrategy.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.SourceEditor.Gui.OptionPanels/BehaviorTextEditorPanel.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.SourceEditor.Gui.OptionPanels/GeneralTextEditorPanel.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.SourceEditor.Gui/TextNavigationPoint.cs" subtype="Code" buildaction="Compile" /> - <File name="gtk-gui/gui.stetic" subtype="Code" buildaction="EmbedAsResource" /> - <File name="gtk-gui/generated.cs" subtype="Code" buildaction="Compile" /> - <File name="gtk-gui/objects.xml" subtype="Code" buildaction="EmbedAsResource" /> - <File name="Makefile.am" subtype="Code" buildaction="Nothing" /> - <File name="AssemblyInfo.cs" subtype="Code" buildaction="Compile" /> - </Contents> - <References> - <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Core" /> - <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Core.Gui" /> - <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Ide" /> - <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Projects" /> - <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Projects.Gui" /> - <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Components" /> - <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> - <ProjectReference type="Gac" localcopy="True" refto="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> - <ProjectReference type="Gac" localcopy="True" refto="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> - <ProjectReference type="Gac" localcopy="True" refto="Mono.Cairo, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> - <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> - <ProjectReference type="Gac" localcopy="True" refto="gconf-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Gac" localcopy="True" refto="glade-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Gac" localcopy="True" refto="glib-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Gac" localcopy="True" refto="gnome-vfs-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <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="Gac" localcopy="True" specificVersion="False" refto="Mono.Addins, Version=0.3.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> - <ProjectReference type="Gac" localcopy="True" refto="gtksourceview2-sharp, Version=2.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - </References> - <GtkDesignInfo gtkVersion="2.8.3" /> - <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="Makefile.am" BuildTargetName="" CleanTargetName="" SyncReferences="True" IsAutotoolsProject="True" RelativeConfigureInPath="../../.."> - <ExcludedFiles> - <File>AssemblyInfo.cs</File> - </ExcludedFiles> - <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> - <MonoDevelop.Gettext.TranslationInfo /> - <DeploymentInformation strategy="File"> - <excludeFiles /> - </DeploymentInformation> -</Project>
\ No newline at end of file diff --git a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor/EditorCommands.cs b/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor/EditorCommands.cs deleted file mode 100644 index c53d60fb67..0000000000 --- a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor/EditorCommands.cs +++ /dev/null @@ -1,38 +0,0 @@ -// -// EditorCommands.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2005 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; - -namespace MonoDevelop.SourceEditor -{ - public enum EditorCommands - { - HighlightingTypeList, - ShowBufferOptions - } -} diff --git a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor/Services.cs b/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor/Services.cs deleted file mode 100644 index 9369de11de..0000000000 --- a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor/Services.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; - -using MonoDevelop.Core; -using MonoDevelop.Core.Execution; - -using MonoDevelop.Projects; - -namespace MonoDevelop.SourceEditor -{ - class Services - { - public static ResourceService Resources { - get { return MonoDevelop.Core.Gui.Services.Resources; } - } - - public static LanguageBindingService Languages { - get { return MonoDevelop.Projects.Services.Languages; } - } - } -} - diff --git a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor/SourceViewService.cs b/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor/SourceViewService.cs deleted file mode 100644 index 9222ea1fb2..0000000000 --- a/extras/GtkSourceViewEditor/MonoDevelop.SourceEditor/SourceViewService.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Text; -using System.Xml; -using GtkSourceView; - -using MonoDevelop.Core; -using MonoDevelop.SourceEditor; - -namespace MonoDevelop.SourceEditor -{ - public static class SourceViewService - { - public static SourceLanguage FindLanguage (string name) - { - foreach (SourceLanguage sl in AvailableLanguages) - { - if (sl.Name == name) - return sl; - } - // not found - return null; - } - - public static SourceLanguage GetLanguageFromMimeType (string mimetype) - { - foreach (SourceLanguage sl in AvailableLanguages) { - string[] supportedMimeTypes = sl.MimeTypes; - if (supportedMimeTypes != null) - foreach (string mt in supportedMimeTypes) - if (mt == mimetype) - return sl; - } - return null; - } - - public static SourceLanguageManager LanguageManager { - get { - return SourceLanguageManager.Default; - } - } - - public static SourceStyleSchemeManager StyleSchemeManager { - get { - return SourceStyleSchemeManager.Default; - } - } - - public static IEnumerable<SourceLanguage> AvailableLanguages { - get { - foreach (string id in LanguageManager.LanguageIds) - yield return LanguageManager.GetLanguage (id); - } - } - - public static IEnumerable<SourceStyleScheme> AvailableStyleSchemes { - get { - foreach (string id in StyleSchemeManager.SchemeIds) - yield return StyleSchemeManager.GetScheme (id); - } - } - } -} - diff --git a/extras/GtkSourceViewEditor/bookmark.png b/extras/GtkSourceViewEditor/bookmark.png Binary files differdeleted file mode 100644 index ef0a8b4fd9..0000000000 --- a/extras/GtkSourceViewEditor/bookmark.png +++ /dev/null diff --git a/extras/GtkSourceViewEditor/gtk-gui/generated.cs b/extras/GtkSourceViewEditor/gtk-gui/generated.cs deleted file mode 100644 index c67023088d..0000000000 --- a/extras/GtkSourceViewEditor/gtk-gui/generated.cs +++ /dev/null @@ -1,35 +0,0 @@ -// ------------------------------------------------------------------------------ -// <autogenerated> -// This code was generated by a tool. -// Mono Runtime Version: 2.0.50727.42 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// </autogenerated> -// ------------------------------------------------------------------------------ - -namespace Stetic { - - - internal class Gui { - - private static bool initialized; - - internal static void Initialize(Gtk.Widget iconRenderer) { - if ((Stetic.Gui.initialized == false)) { - Stetic.Gui.initialized = true; - } - } - } - - internal class ActionGroups { - - public static Gtk.ActionGroup GetActionGroup(System.Type type) { - return Stetic.ActionGroups.GetActionGroup(type.FullName); - } - - public static Gtk.ActionGroup GetActionGroup(string name) { - return null; - } - } -} diff --git a/extras/GtkSourceViewEditor/gtk-gui/gui.stetic b/extras/GtkSourceViewEditor/gtk-gui/gui.stetic deleted file mode 100644 index 4f7c4824a3..0000000000 --- a/extras/GtkSourceViewEditor/gtk-gui/gui.stetic +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<stetic-interface> - <configuration> - <images-root-path>..</images-root-path> - <target-gtk-version>2.10.2</target-gtk-version> - </configuration> - <import> - <widget-library name="../../../build/bin/MonoDevelop.Ide.dll" /> - <widget-library name="../../../build/bin/MonoDevelop.Projects.Gui.dll" /> - <widget-library name="../../../build/bin/MonoDevelop.Components.dll" /> - <widget-library name="../../../build/AddIns/MonoDevelop.SourceEditor.dll" internal="true" /> - </import> -</stetic-interface>
\ No newline at end of file diff --git a/extras/GtkSourceViewEditor/gtk-gui/objects.xml b/extras/GtkSourceViewEditor/gtk-gui/objects.xml deleted file mode 100644 index 0c550b40d1..0000000000 --- a/extras/GtkSourceViewEditor/gtk-gui/objects.xml +++ /dev/null @@ -1,2 +0,0 @@ -<objects> -</objects>
\ No newline at end of file diff --git a/extras/GtkSourceViewEditor/texteditoraddin.glade b/extras/GtkSourceViewEditor/texteditoraddin.glade deleted file mode 100644 index 0dbcd58140..0000000000 --- a/extras/GtkSourceViewEditor/texteditoraddin.glade +++ /dev/null @@ -1,195 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> -<requires lib="gnome"/> - -<widget class="GtkDialog" id="GotoLineDialog"> - <property name="visible">True</property> - <property name="title" translatable="yes">Go to Line</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">False</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="btn_close"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-close</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">-7</property> - <signal name="clicked" handler="on_btn_close_clicked" last_modification_time="Fri, 16 Jan 2004 21:49:16 GMT"/> - </widget> - </child> - - <child> - <widget class="GtkButton" id="btn_go_to_line"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="can_focus">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="response_id">0</property> - <signal name="clicked" handler="on_btn_go_to_line_clicked" last_modification_time="Fri, 16 Jan 2004 21:50:12 GMT"/> - - <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">0</property> - <property name="yscale">0</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkHBox" id="hbox2"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">2</property> - - <child> - <widget class="GtkImage" id="image1"> - <property name="visible">True</property> - <property name="stock">gtk-jump-to</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Go to Line</property> - <property name="use_underline">True</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.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="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - </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="GtkHBox" id="hbox1"> - <property name="border_width">6</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">8</property> - - <child> - <widget class="GtkLabel" id="lbl_line_number"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Line Number:</property> - <property name="use_underline">True</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.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">line_number_entry</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">False</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="line_number_entry"> - <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">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</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/extras/MonoDevelop.AddinAuthoring/MonoDevelop.AddinAuthoring/ExtensionEditorWidget.cs b/extras/MonoDevelop.AddinAuthoring/MonoDevelop.AddinAuthoring/ExtensionEditorWidget.cs index d2868ed74a..9f9a953464 100644 --- a/extras/MonoDevelop.AddinAuthoring/MonoDevelop.AddinAuthoring/ExtensionEditorWidget.cs +++ b/extras/MonoDevelop.AddinAuthoring/MonoDevelop.AddinAuthoring/ExtensionEditorWidget.cs @@ -42,6 +42,14 @@ namespace MonoDevelop.AddinAuthoring { this.Build(); + //FIXME: avoid unnecessary creation of old treeview + scrolledwindow6.Remove (tree); + tree.Destroy (); + tree = new ContextMenuTreeView (); + tree.ShowAll (); + scrolledwindow6.Add (tree); + ((ContextMenuTreeView)tree).DoPopupMenu = ShowPopupMenu; + pixAddin = ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.Addin, IconSize.Menu); pixLocalAddin = ImageService.GetPixbuf ("md-addinauthoring-current-addin", IconSize.Menu); pixExtensionPoint = ImageService.GetPixbuf ("md-extension-point", IconSize.Menu); @@ -126,7 +134,7 @@ namespace MonoDevelop.AddinAuthoring state.Load (); } - void ShowPopupMenu () + void ShowPopupMenu (Gdk.EventButton evt) { TreeIter it; if (!tree.Selection.GetSelected (out it)) @@ -148,7 +156,7 @@ namespace MonoDevelop.AddinAuthoring mi.Activated += delegate { DeleteSelection (); }; menu.ShowAll (); - menu.Popup (); + GtkWorkarounds.ShowContextMenu (menu, tree, evt); } void PopulateNodeTypes (Gtk.Menu menu, TreeIter it) @@ -419,17 +427,6 @@ namespace MonoDevelop.AddinAuthoring currentEditor = null; } } - - protected virtual void OnTreePopupMenu(object o, Gtk.PopupMenuArgs args) - { - ShowPopupMenu (); - } - - protected virtual void OnTreeButtonReleaseEvent(object o, Gtk.ButtonReleaseEventArgs args) - { - if (args.Event.Button == 3) - ShowPopupMenu (); - } protected virtual void OnButtonRemoveClicked(object sender, System.EventArgs e) { @@ -456,5 +453,32 @@ namespace MonoDevelop.AddinAuthoring y += addNodeButton.Allocation.Bottom; pushIn = true; } + + //FIXME: this should be a re-usable class in MonoDevelop.Ide + class ContextMenuTreeView : Gtk.TreeView + { + public Action<Gdk.EventButton> DoPopupMenu { get; set; } + + protected override bool OnButtonPressEvent (Gdk.EventButton evnt) + { + bool res = base.OnButtonPressEvent (evnt); + + if (DoPopupMenu != null && Mono.TextEditor.GtkWorkarounds.TriggersContextMenu (evnt)) { + DoPopupMenu (evnt); + return true; + } + + return res; + } + + protected override bool OnPopupMenu () + { + if (DoPopupMenu != null) { + DoPopupMenu (null); + return true; + } + return base.OnPopupMenu (); + } + } } } diff --git a/extras/MonoDevelop.AddinAuthoring/gtk-gui/MonoDevelop.AddinAuthoring.ExtensionEditorWidget.cs b/extras/MonoDevelop.AddinAuthoring/gtk-gui/MonoDevelop.AddinAuthoring.ExtensionEditorWidget.cs index 4aef6d9537..728cff8542 100644 --- a/extras/MonoDevelop.AddinAuthoring/gtk-gui/MonoDevelop.AddinAuthoring.ExtensionEditorWidget.cs +++ b/extras/MonoDevelop.AddinAuthoring/gtk-gui/MonoDevelop.AddinAuthoring.ExtensionEditorWidget.cs @@ -176,8 +176,6 @@ namespace MonoDevelop.AddinAuthoring this.buttonAdd.Clicked += new global::System.EventHandler (this.OnButtonAddClicked); this.addNodeButton.Pressed += new global::System.EventHandler (this.OnAddNodeButtonPressed); this.buttonRemove.Clicked += new global::System.EventHandler (this.OnButtonRemoveClicked); - this.tree.PopupMenu += new global::Gtk.PopupMenuHandler (this.OnTreePopupMenu); - this.tree.ButtonReleaseEvent += new global::Gtk.ButtonReleaseEventHandler (this.OnTreeButtonReleaseEvent); } } } diff --git a/extras/MonoDevelop.AddinAuthoring/gtk-gui/gui.stetic b/extras/MonoDevelop.AddinAuthoring/gtk-gui/gui.stetic index bea15584b8..c4a20cf04a 100644 --- a/extras/MonoDevelop.AddinAuthoring/gtk-gui/gui.stetic +++ b/extras/MonoDevelop.AddinAuthoring/gtk-gui/gui.stetic @@ -1024,8 +1024,6 @@ <widget class="Gtk.TreeView" id="tree"> <property name="MemberName" /> <property name="CanFocus">True</property> - <signal name="PopupMenu" handler="OnTreePopupMenu" /> - <signal name="ButtonReleaseEvent" handler="OnTreeButtonReleaseEvent" /> </widget> </child> </widget> diff --git a/extras/MonoDevelop.Database/MonoDevelop.Database.Components/Widgets/DataGrid/DataGrid.cs b/extras/MonoDevelop.Database/MonoDevelop.Database.Components/Widgets/DataGrid/DataGrid.cs index eb4cddf521..734c74874f 100644 --- a/extras/MonoDevelop.Database/MonoDevelop.Database.Components/Widgets/DataGrid/DataGrid.cs +++ b/extras/MonoDevelop.Database/MonoDevelop.Database.Components/Widgets/DataGrid/DataGrid.cs @@ -1,26 +1,46 @@ // // Authors: // Ben Motmans <ben.motmans@gmail.com> -//
-// Copyright (c) 2007 Ben Motmans
-//
-// 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.
+// + +// Copyright (c) 2007 Ben Motmans + +// + +// 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; @@ -33,6 +53,7 @@ using MonoDevelop.Core; using MonoDevelop.Ide; using MonoDevelop.Ide.Gui; using MonoDevelop.Components.Commands; +using Mono.TextEditor; namespace MonoDevelop.Database.Components { @@ -69,7 +90,9 @@ namespace MonoDevelop.Database.Components this.Build (); //Gtk# 2.10: grid.EnableGridLines = TreeViewGridLines.Both; - grid.ButtonPressEvent += new ButtonPressEventHandler (ButtonPressed); + grid.ButtonPressEvent += ButtonPressed; + grid.PopupMenu += (o, args) => DoPopupMenu (null); + grid.Selection.Mode = Gtk.SelectionMode.Multiple; contentRenderers = new Dictionary<Type, IDataGridContentRenderer> (); @@ -387,8 +410,15 @@ namespace MonoDevelop.Database.Components return; } - if (args.Event.Button == 3) - IdeApp.CommandService.ShowContextMenu ("/MonoDevelop/Database/ContextMenu/DataGrid"); + if (args.Event.TriggersContextMenu ()) { + DoPopupMenu (args.Event); + args.RetVal = true; + } + } + + void DoPopupMenu (Gdk.EventButton evt) + { + IdeApp.CommandService.ShowContextMenu (grid, evt, "/MonoDevelop/Database/ContextMenu/DataGrid"); } private static string ByteConvertFunc (object obj) diff --git a/extras/MonoDevelop.Database/MonoDevelop.Database.Components/Widgets/SqlEditorWidget.cs b/extras/MonoDevelop.Database/MonoDevelop.Database.Components/Widgets/SqlEditorWidget.cs index 0144cece01..d21efe3a37 100644 --- a/extras/MonoDevelop.Database/MonoDevelop.Database.Components/Widgets/SqlEditorWidget.cs +++ b/extras/MonoDevelop.Database/MonoDevelop.Database.Components/Widgets/SqlEditorWidget.cs @@ -61,10 +61,8 @@ namespace MonoDevelop.Database.Components // sourceView.ShowLineNumbers = true; sourceView.Document.TextReplaced += BufferChanged; - sourceView.TextViewMargin.ButtonPressed += delegate (object s, MarginMouseEventArgs args) { - if (args.Button == 3) { - IdeApp.CommandService.ShowContextMenu ("/MonoDevelop/Database/ContextMenu/SqlEditor"); - } + sourceView.DoPopupMenu = delegate (Gdk.EventButton e) { + IdeApp.CommandService.ShowContextMenu (sourceView, e, "/MonoDevelop/Database/ContextMenu/SqlEditor"); }; scrolledwindow.Add (sourceView); diff --git a/main/src/addins/MacPlatform/MacInterop/AppleEvents/Native.cs b/main/src/addins/MacPlatform/MacInterop/AppleEvents/Native.cs new file mode 100644 index 0000000000..49d76a776a --- /dev/null +++ b/main/src/addins/MacPlatform/MacInterop/AppleEvents/Native.cs @@ -0,0 +1,1086 @@ +// +// Structs.cs +// +// Author: +// Michael Hutchinson <mhutch@xamarin.com> +// +// Copyright (c) 2011 Xamarin Inc. (http://xamarin.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.Runtime.InteropServices; + +namespace MonoDevelop.MacInterop.AppleEvents +{ + +/* + //Apple event manager data types + typedef ResType DescType; + typedef Ptr AEDataStorageType; + typedef AEDataStorageType * AEDataStorage; +*/ + + /* + Useful references: + + Apple Event Manager + http://developer.apple.com/legacy/mac/library/documentation/Carbon/reference/Apple_Event_Manager/apple_event_manager.pdf + + AEGizmo, AEBuildAppleEvent and Mac OS X 10.4 + http://www.wincent.com/a/about/wincent/weblog/archives/2005/05/aegizmo_aebuild.php + + AEVTBuilder + http://www.cocoadev.com/index.pl?AEVTBuilder + + AEBuildAppleEvent + http://www.cocoadev.com/index.pl?AEBuildAppleEvent + + AppScript + http://appscript.sourceforge.net/ + + Scripting Bridge Criticisms + http://www.cocoadev.com/index.pl?ScriptingBridgeCriticisms + + Using Scripting Bridge + http://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ScriptingBridgeConcepts/ScriptingBridgeConcepts.pdf + + */ + unsafe class Native + { + const string AELib = Carbon.CarbonLib; + + //********************* AEDataModel.h ********************** + + //for Mach binaries the UPP is identical to the ProcPtr + public delegate OSErr AECoerceDescUPP (ref AEDesc fromDesc, DescType toType, uint refConst, out AEDesc toDesc); + public delegate OSErr AECoercePtrUPP (DescType typeCode, IntPtr dataPtr, Size dataSize, DescType toType, + uint refConst, out AEDesc result); + public delegate void AEDisposeExternalUPP (IntPtr dataPtr, Size dataLength, uint refcon); + public delegate OSErr AEEventHandlerUPP (ref AppleEvent evt, ref AppleEvent reply, uint refConst); + + [DllImport (AELib)] + public static extern OSErr AEInstallCoercionHandler (DescType fromType, DescType toType, AECoerceDescUPP handler, + uint handlerRefcon, bool fromTypeIsDesc, bool isSysHandler); + + [DllImport (AELib)] + public static extern OSErr AEInstallCoercionHandler (DescType fromType, DescType toType, AECoercePtrUPP handler, + uint handlerRefcon, bool fromTypeIsDesc, bool isSysHandler); + + [DllImport (AELib)] + public static extern OSErr AERemoveCoercionHandler (DescType fromType, DescType toType, AECoerceDescUPP handler, + bool isSysHandler); + + [DllImport (AELib)] + public static extern OSErr AERemoveCoercionHandler (DescType fromType, DescType toType, AECoercePtrUPP handler, + bool isSysHandler); + + [DllImport (AELib)] + public static extern OSErr AEGetCoercionHandler (DescType fromType, DescType toType, out IntPtr handler, + out uint handlerRefcon, out bool fromTypeIsDesc, bool isSysHandler); + + [DllImport (AELib)] + public static extern OSErr AECoercePtr (DescType typeCode, IntPtr data, Size dataSize, DescType toType, + out AEDesc result); + + [DllImport (AELib)] + public static extern OSErr AECoerceDesc (ref AEDesc desc, DescType toType, out AEDesc result); + + [DllImport (AELib)] + public static extern void AEInitializeDesc (ref AEDesc desc); + + public static void AEInitializeDescInline (ref AEDesc desc) + { + desc.descriptorType = (int) AEDescriptorType.Null; + desc.dataHandle = IntPtr.Zero; + } + + [DllImport (AELib)] + public static extern OSErr AECreateDesc (DescType typeCode, IntPtr dataPtr, Size dataSize, out AEDesc result); + + [DllImport (AELib)] + public static extern OSErr AEDisposeDesc (ref AEDesc desc); + + [DllImport (AELib)] + public static extern OSErr AEDuplicateDesc (ref AEDesc desc, out AEDesc result); + + [DllImport (AELib)] + public static extern OSStatus AECreateDescFromExternalPtr (OSType descriptorType, IntPtr dataPtr, Size dataLength, + AEDisposeExternalUPP disposeCallback, uint disposeRefcon, out AEDesc result); + + [DllImport (AELib)] + public static extern OSErr AECreateList (IntPtr factoringPtr, Size factoredSize, bool isRecord, out AEDescList result); + + [DllImport (AELib)] + public static extern OSErr AECountItems (ref AEDescList descList, out Size count); + + [DllImport (AELib)] + public static extern OSErr AEPutPtr (ref AEDescList descList, Size index, DescType typeCode, IntPtr dataPtr, + Size dataSize); + + [DllImport (AELib)] + public static extern OSErr AEPutDesc (ref AEDescList descList, Index index, out AEDesc desc); + + [DllImport (AELib)] + public static extern OSErr AEGetNthPtr (ref AEDescList descList, Index index, DescType desiredType, + ref AEKeyword keyword, ref DescType typeCode, IntPtr dataPtr, Size maximumSize, out Size actualSize); + + [DllImport (AELib)] + public static extern OSErr AEGetNthDesc (ref AEDescList descList, Index index, DescType desiredType, + ref AEKeyword keyword, out AEDesc result); + + [DllImport (AELib)] + public static extern OSErr SizeOfNthItem (ref AEDescList descList, Index index, ref DescType typeCode, + out Size dataSize); + + [DllImport (AELib)] static extern OSErr AEGetArray (ref AEDescList descList, AEArrayType arrayType, + ref AEArrayData array, Size maximumSize, ref DescType itemType, Size itemSize, out Size itemCount); + + [DllImport (AELib)] + public static extern OSErr + AEPutArray (ref AEDescList descList, AEArrayType arrayType, ref AEArrayData array, DescType itemType, + Size itemSize, Size itemCount); + + [DllImport (AELib)] + public static extern OSErr AEDeleteItem (ref AEDescList descList, Index index); + + [DllImport (AELib)] + public static extern bool AECheckIsRecord (ref AEDesc desc); + + [DllImport (AELib, EntryPoint="AEPutParamPtr")] + public static extern OSErr AEPutKeyPtr (ref AERecord record, AEKeyword keyword, DescType typeCode, + IntPtr dataPtr, Size dataSize); + + [DllImport (AELib, EntryPoint="AEPutParamDesc")] + public static extern OSErr AEPutKeyDesc (ref AERecord record, AEKeyword keyword, ref AEDesc desc); + + [DllImport (AELib, EntryPoint="AEGetParamPtr")] + public static extern OSErr AEGetKeyPtr (ref AERecord record, AEKeyword keyword, DescType desiredType, + ref DescType actualType, IntPtr dataPtr, Size maximumSize, out Size actualSize); + + [DllImport (AELib, EntryPoint="AEGetParamDesc")] + public static extern OSErr AEGetKeyDesc (ref AERecord record, AEKeyword keyword, DescType desiredType, + out AEDesc result); + + [DllImport (AELib, EntryPoint="SizeOfParam")] + public static extern OSErr SizeOfKeyDesc (ref AERecord record, AEKeyword keyword, + ref DescType typeCode, out Size dataSize); + + [DllImport (AELib, EntryPoint="AEDeleteParam")] + public static extern OSErr AEDeleteKeyDesc (ref AERecord record, AEKeyword keyword); + + [DllImport (AELib)] + public static extern OSErr AECreateAppleEvent (AEEventClass eventClass, AEEventID eventID, ref AEAddressDesc target, + AEReturnID returnID, AETransactionID transactionID, out AppleEvent result); + + [DllImport (AELib)] + public static extern OSErr AEPutParamPtr (ref AppleEvent evt, AEKeyword keyword, DescType typeCode, + IntPtr dataPtr, Size dataSize); + + [DllImport (AELib)] + public static extern OSErr AEPutParamDesc (ref AppleEvent evt, AEKeyword keyword, ref AEDesc desc); + + [DllImport (AELib)] + public static extern OSErr AEGetParamPtr ( ref AppleEvent evt, AEKeyword keyword, DescType desiredType, + out DescType actualType, IntPtr dataPtr, Size maximumSize, out Size actualSize); + + [DllImport (AELib)] + public static extern OSErr AEGetParamDesc (ref AppleEvent evt, AEKeyword keyword, DescType desiredType, + out AEDesc result); + + [DllImport (AELib)] + public static extern OSErr SizeOfParam (ref AppleEvent evt, AEKeyword keyword, + out DescType typeCode, out Size dataSize); + + [DllImport (AELib)] + public static extern OSErr AEDeleteParam (ref AppleEvent evt, AEKeyword keyword); + + [DllImport (AELib)] + public static extern OSErr AEGetAttributePtr (ref AppleEvent evt, AEKeyword keyword, DescType desiredType, + out DescType typeCode, IntPtr dataPtr, Size maximumSize, out Size actualSize); + + [DllImport (AELib)] + public static extern OSErr AEGetAttributeDesc (ref AppleEvent evt, AEKeyword keyword, DescType desiredType, + out AEDesc result); + + [DllImport (AELib)] + public static extern OSErr SizeOfAttribute (ref AppleEvent evt, AEKeyword keyword, + out DescType typeCode, out Size dataSize); + + [DllImport (AELib)] + public static extern OSErr AEPutAttributePtr (ref AppleEvent evt, AEKeyword keyword, DescType typeCode, + IntPtr dataPtr, Size dataSize); + + [DllImport (AELib)] + public static extern OSErr AEPutAttributeDesc (ref AppleEvent evt, AEKeyword keyword, ref AEDesc desc); + + [DllImport (AELib)] + public static extern Size SizeOfFlattenedDesc (ref AEDesc desc); + + [DllImport (AELib)] + public static extern OSStatus AEFlattenDesc (ref AEDesc desc, IntPtr buffer, Size bufferSize, out Size actualSize); + + [DllImport (AELib)] + public static extern OSStatus AEUnflattenDesc (IntPtr buffer, out AEDesc result); + + [DllImport (AELib)] + public static extern OSErr AEGetDescData (ref AEDesc desc, IntPtr dataPtr, Size maximumSize); + + [DllImport (AELib)] + public static extern Size AEGetDescDataSize (ref AEDesc desc); + + [DllImport (AELib)] + public static extern OSErr AEReplaceDescData (DescType typeCode, IntPtr dataPtr, Size dataSize, ref AEDesc desc); + + [DllImport (AELib)] + public static extern OSStatus AEGetDescDataRange (ref AEDesc dataDesc, IntPtr buffer, Size offset, Size length); + + public struct AEDesc + { + public int descriptorType; //DescType + public IntPtr dataHandle; //AEDataStorage + } + + //is an AEDesc with address data + public struct AEAddressDesc + { + public int descriptorType; //DescType + public IntPtr dataHandle; //AEDataStorage + + public static implicit operator AEDesc (AEAddressDesc a) { return *((AEDesc*)&a); } + public static explicit operator AEAddressDesc (AEDesc a) { return *((AEAddressDesc*)&a); } + } + + //is a special AEDesc + public struct AEDescList + { + public int descriptorType; //DescType + public IntPtr dataHandle; //AEDataStorage + + public static implicit operator AEDesc (AEDescList a) { return *((AEDesc*)&a); } + public static explicit operator AEDescList (AEDesc a) { return *((AEDescList*)&a); } + } + + //is an AEDescList with keys + public struct AERecord + { + public int descriptorType; //DescType + public IntPtr dataHandle; //AEDataStorage + + public static implicit operator AEDescList (AERecord a) { return *((AEDescList*)&a); } + public static explicit operator AERecord (AEDescList a) { return *((AERecord*)&a); } + } + + //is an AERecord with event + public struct AppleEvent + { + public int descriptorType; //DescType + public IntPtr dataHandle; //AEDataStorage + + public static implicit operator AERecord (AppleEvent a) { return *((AERecord*)&a); } + public static explicit operator AppleEvent (AERecord a) { return *((AppleEvent*)&a); } + } + + public struct AEKeyDesc + { + public int descKey; //AEKeyword + public AEDesc descContent; + } + + public enum AEArrayType : sbyte + { + Data = 0, + Packed = 1, + Handle = 2, + Desc = 3, + KeyDesc = 4, + } + + public struct AEArrayData + { + public IntPtr Ptr; + + public short AsData { + get { + unsafe { return *((short*)Ptr); } + } + } + + public byte AsPacked { + get { + unsafe { return *((byte*)Ptr); } + } + } + + public IntPtr AsHandle { + get { + unsafe { return *((IntPtr*)Ptr); } + } + } + + public AEDesc AsDesc { + get { + unsafe { return *((AEDesc*)Ptr); } + } + } + + public AEKeyDesc AsKeyDesc { + get { + unsafe { return *((AEKeyDesc*)Ptr); } + } + } + } + + public struct Size + { + IntPtr value; + + public Size (int a) + { + value = (IntPtr) a; + } + + public Size (long a) + { + value = (IntPtr) a; + } + + public static implicit operator long (Size a) + { + return a.value.ToInt64 (); + } + + public static implicit operator int (Size a) + { + return a.value.ToInt32 (); + } + + public static explicit operator Size (int a) + { + return new Size (a); + } + + public static explicit operator Size (long a) + { + return new Size (a); + } + } + + public struct Index + { + IntPtr value; + + public Index (int a) + { + value = (IntPtr) a; + } + + public Index (long a) + { + value = (IntPtr) a; + } + + public static implicit operator long (Index a) + { + return a.value.ToInt64 (); + } + + public static implicit operator int (Index a) + { + return a.value.ToInt32 (); + } + + public static explicit operator Index (int a) + { + return new Index (a); + } + + public static explicit operator Index (long a) + { + return new Index (a); + } + } + + public struct AEKeyword + { + public int FourCC; + } + + public struct AEEventClass + { + public int FourCC; + + public AEEventClass (int fourcc) + { + this.FourCC = fourcc; + } + + public static implicit operator AEEventClass (int a) + { + return new AEEventClass (a); + } + + public static AEEventClass Core { get { return 0; } } //'aevt' + } + + public struct AEEventID + { + public int FourCC; + + public AEEventID (int fourcc) + { + this.FourCC = fourcc; + } + + public static implicit operator AEEventID (int a) + { + return new AEEventID (a); + } + + public static AEEventID OpenApplication { get { return 0; } } // 'oapp', + public static AEEventID OpenDocuments { get { return 0; } } // 'odoc', + public static AEEventID PrintDocuments { get { return 0; } } // 'pdoc', + public static AEEventID OpenContents { get { return 0; } } // 'ocon', + public static AEEventID QuitApplication { get { return 0; } } // 'quit', + public static AEEventID Answer { get { return 0; } } // 'ansr', + public static AEEventID ApplicationDied { get { return 0; } } // 'obit', + public static AEEventID ShowPreferences { get { return 0; } } // 'pref' + } + + public struct AEReturnID + { + public short Value; + + public AEReturnID (short value) { this.Value = value; } + + ///<summary>Make AECreateAppleEvent create session-unique value for returnID</summary> + public AEReturnID AutoGenerate { get { return new AEReturnID (-1); } } + } + + public struct AETransactionID + { + public int Value; + + public AETransactionID (int value) { this.Value = value; } + + /// <summary>Not using transactions</summary> + public AETransactionID Any { get { return new AETransactionID (0); } } + } + + public enum OSErr + { + Ok = 0, + } + + public enum OSStatus + { + Ok = 0, + } + + public enum AEDescriptorType + { + Boolean = 0, //'bool', + + [Obsolete("Use Utf8Text")] + Char = 0, //'TEXT' + + [Obsolete ("Use explicit encoding and byte order, e.g. Utf16ExternalRepresentation or Utf8Text")] + ///<summary>Not implemented</summary> + StyledUnicodeText = 0,//'sutx', + + [Obsolete ("Use explicit encoding and byte order, e.g. Utf16ExternalRepresentation or Utf8Text")] + ///<summary>Not implemented</summary> + EncodedString = 0,//'encs', + + [Obsolete ("Use explicit encoding and byte order, e.g. Utf16ExternalRepresentation or Utf8Text")] + ///<summary>Not implemented. Native byte ordering, optional BOM.</summary> + UnicodeText = 0,//'utxt', + + [Obsolete ("Use explicit encoding and byte order, e.g. Utf16ExternalRepresentation or Utf8Text")] + ///<summary>Null terminated MacRoman char</summary> + CString = 0,//'cstr', + + [Obsolete ("Use explicit encoding and byte order, e.g. Utf16ExternalRepresentation or Utf8Text")] + ///<summary>Unsigned length byte followed by MacRoman characters</summary> + PString = 0,//'pstr' + + ///<summary>Big-endian UTF-16 with optional BOM, or little-endian UTF16 with required BOM</summary> + ///<remarks>No length byte or null termination</remarks> + Utf16ExternalRepresentation = 0,//'ut16', + + /// <summary>UTF8</summary> + ///<remarks>No length byte or null termination</remarks> + Utf8Text = 0,//'utf8' + + SInt16 = 0,//'shor', + UInt16 = 0,//'ushr', + SInt32 = 0,//'long', + UInt32 = 0,//'magn', + SInt64 = 0,//'comp', + UInt64 = 0,//'ucom', + FloatingPointIeee32Bit = 0,//'sing', + FloatingPointIeee64Bit = 0,//'doub', + FloatingPoint128Bit = 0,//'ldbl', + DecimalStruct = 0,//'decm' + + AEList = 0,//'list', + AERecord = 0,//'reco', + AppleEvent = 0,//'aevt', + EventRecord = 0,//'evrc', + True = 0,//'true', + False = 0,//'fals', + /// <summary>AliasPtr, from a valid AliasHandle</summary> + Alias = 0,//'alis', + Enumerated = 0,//'enum', + /// <summary>OSType</summary> + Type = 0,//'type', + AppParameters = 0,//'appa', + Property = 0,//'prop', + FSRef = 0,//'fsrf', + /// <summary>UTF8-encoded full path with native path separators</summary> + FileURL = 0,//'furl', + /// <summary>Bytes of a CFURLBookmarkData</summary> + BookmarkData = 0,//'bmrk', + /// <summary>OSType</summary> + Keyword = 0,//'keyw', + SectionH = 0,//'sect', + WildCard = 0,//'****', + /// <summary>OSType</summary> + ApplSignature = 0,//'sign', + QDRectangle = 0,//'qdrt', + Fixed = 0,//'fixd', + ProcessSerialNumber = 0,//'psn ', + ApplicationUrl = 0,//'aprl', + /// <summary>Null or nonexistent data</summary> + Null = 0,//'null' + + [Obsolete ("Not fully supported on 64-bit, use FSRef")] + typeFSS = 0,//'fss ' /* FSSpec */ + + CFAttributedStringRef = 0,//'cfas', + CFMutableAttributedStringRef = 0,//'cfaa', + CFStringRef = 0,//'cfst', + CFMutableStringRef = 0,//'cfms', + CFArrayRef = 0,//'cfar', + CFMutableArrayRef = 0,//'cfma', + CFDictionaryRef = 0,//'cfdc', + CFMutableDictionaryRef = 0,//'cfmd', + CFNumberRef = 0,//'cfnb', + CFBooleanRef = 0,//'cftf', + CFTypeRef = 0,//'cfty' + + KernelProcessID = 0,//'kpid', + MachPort = 0,//'port' + + ApplicationBundleID = 0,//'bund' + } + + public enum AEAttribute + { + TransactionID = 0,//'tran', + ReturnID = 0,//'rtid', + EventClass = 0,//'evcl', + EventID = 0,//'evid', + Address = 0,//'addr', + OptionalKeyword = 0,//'optk', + ///<summary>AEDescriptorType.SInt32</summary> + Timeout = 0,//'timo', + ///<summary>Read-only, set in AESend</summary> + InteractLevel = 0,//'inte', + ///<summary>Read-only, AEDescriptorType.SInt16</summary> + EventSource = 0,//'esrc' + ///<summary>Read-only</summary> + MissedKeyword = 0,//'miss' + OriginalAddress = 0,//'from' + AcceptTimeout = 0,//'actm' + ///<summary>Whether reply was requested, Boolean</summary> + ReplyRequested = 0,//'repq' + ///<summary>Read-only, AEDescriptorType.SInt32</summary> + SenderEuid = 0,//'seid' + ///<summary>Read-only, AEDescriptorType.SInt32</summary> + SenderEgid = 0,//'sgid' + ///<summary>Read-only, AEDescriptorType.SInt32</summary> + SenderUid = 0,//'uids' + ///<summary>Read-only, AEDescriptorType.SInt32</summary> + SenderGid = 0,//'gids' + ///<summary>Read-only, AEDescriptorType.SInt32</summary> + SenderPid = 0,//'spid' + } + + public enum AEDescListFactor + { + None = 0, + Type = 4, + TypeAndSize = 8 + } + + public enum AESendPriority + { + /// <summary>Post message at end of event queue</summary> + Normal = 0x00000000, + /// <summary>Post message at front of event queue</summary> + High = 0x00000001 + } + + [Flags] + public enum AESendMode + { + /// <summary>Sender doesn't want reply</summary> + NoReply = 0x00000001, + /// <summary>Sender wants reply but won't wait</summary> + QueueReply = 0x00000002, + /// <summary>Sender wants reply and will wait</summary> + WaitReply = 0x00000003, + /// <summary>Don't reconnect on sessClosedErr</summary> + DontReconnect = 0x00000080, + /// <summary>Sender wants receipt</summary> + WantReceipt = 0x00000200, + /// <summary>Server shouldn't interact with user</summary> + NeverInteract = 0x00000010, + /// <summary>Server may interact with user</summary> + CanInteract = 0x00000020, + /// <summary>Server should interact with user if appropriate</summary> + AlwaysInteract = 0x00000030, + /// <summary></summary> + CanSwitchLayer = 0x00000040, + /// <summary></summary> + DontRecord = 0x00001000, + /// <summary></summary> + DontExecute = 0x00002000, + /// <summary>Allow processing other events while waiting for reply</summary> + ProcessNonReplyEvents = 0x00008000, + /// <summary></summary> + DoNotAutomaticallyAddAnnotationsToEvent = 0x00010000, + } + + // ********************** AppleEvents.h ******************** + + public enum AEEventParameterKeys + { + DirectObject = 0,//'----', + ErrorNumber = 0,//'errn', + ErrorString = 0,//'errs', + ProcessSerialNumber = 0,//'psn ', + PreDispatch = 0,//'phac', + SelectProc = 0,//'selh', + AERecorderCount = 0,//'recr', + AEVersion = 0,//'vers', + } + + public enum AERecording + { + Start = 0,//'reca', + Stop = 0,//'recc', + NotifyStart = 0,//'rec1', + NotifyStop = 0,//'rec0', + Notify = 0,//'recr', + } + + // keyEventSourceAttr treats this as a short + enum AEEventSource : sbyte + { + UnknownSource = 0, + DirectCall = 1, + SameProcess = 2, + LocalProcess = 3, + RemoteProcess = 4 + } + + [DllImport (AELib)] + public static extern OSErr AEInstallEventHandler (AEEventClass eventClass, AEEventID eventID, + AEEventHandlerUPP handler, uint handlerRefcon, bool isSysHandler); + + [DllImport (AELib)] + public static extern OSErr AERemoveEventHandler (AEEventClass eventClass, AEEventID eventID, + AEEventHandlerUPP handler, bool isSysHandler); + + [DllImport (AELib)] + public static extern OSErr AEGetEventHandler (AEEventClass eventClass, AEEventID eventID, + out AEEventHandlerUPP handler, out uint handlerRefcon, Boolean isSysHandler); + + [DllImport (AELib)] + public static extern OSErr AEInstallSpecialHandler (AEKeyword functionClass, AEEventHandlerUPP handler, + Boolean isSysHandler); + + [DllImport (AELib)] + public static extern OSErr AERemoveSpecialHandler (AEKeyword functionClass, AEEventHandlerUPP handler, + Boolean isSysHandler); + + [DllImport (AELib)] + public static extern OSErr AEGetSpecialHandler (AEKeyword functionClass, out AEEventHandlerUPP handler, + Boolean isSysHandler); + + [DllImport (AELib)] + public static extern OSErr AEManagerInfo (AEKeyword keyWord, out IntPtr /* long */ result); + + //extern const CFStringRef kAERemoteProcessURLKey; + //extern const CFStringRef kAERemoteProcessNameKey; + //extern const CFStringRef kAERemoteProcessUserIDKey; + //extern const CFStringRef kAERemoteProcessProcessIDKey; + + public struct AERemoteProcessResolverContext + { + public Index Version; //CFIndex + public IntPtr Info; + public IntPtr Retain; // CFAllocatorRetainCallBack + public IntPtr Release; //CFAllocatorReleaseCallBack + public IntPtr CopyDescription; //CFAllocatorCopyDescriptionCallBack + } + + public struct AERemoteProcessResolverRef { public IntPtr Ptr; } + public struct CFAllocatorRef { public IntPtr Ptr; } + public struct CFURLRef { public IntPtr Ptr; } + public struct CFArrayRef { public IntPtr Ptr; } + public struct CFStringRef { public IntPtr Ptr; } + public struct CFRunLoopRef { public IntPtr Ptr; } + + public struct CFStreamError + { + public Index Domain; //CFIndex + public int Error; + } + + [DllImport (AELib)] + public static extern AERemoteProcessResolverRef AECreateRemoteProcessResolver (CFAllocatorRef allocator, + CFURLRef url); + + [DllImport (AELib)] + public static extern void AEDisposeRemoteProcessResolver (AERemoteProcessResolverRef resRef); + + [DllImport (AELib)] + public static extern CFArrayRef AERemoteProcessResolverGetProcesses (AERemoteProcessResolverRef resRef, + out CFStreamError outError); + + public delegate void AERemoteProcessResolverCallback (AERemoteProcessResolverRef resRef, IntPtr info); + + [DllImport (AELib)] + public static extern void AERemoteProcessResolverScheduleWithRunLoop (AERemoteProcessResolverRef resRef, + CFRunLoopRef runLoop, CFStringRef runLoopMode, AERemoteProcessResolverCallback callback, + ref AERemoteProcessResolverContext ctx); + + //******************** AEHelpers.h ********************** + + public class AppleEventTimeout + { + /// <summary>The default timeout of the Event Manager</summary> + public const int Default = -1; + + /// <summary>Wait indefinitely</summary> + public const int NoTimeOut = -2; + } + + public enum AEBuildErrorCode : uint + { + NoErr = 0, + BadToken = 1, + BadEOF = 2, + NoEOF = 3, + BadNegative = 4, + MissingQuote = 5, + BadHex = 6, + OddHex = 7, + NoCloseHex = 8, + UncoercedHex = 9, + NoCloseString = 10, + BadDesc = 11, + BadData = 12, + NoCloseParen = 13, + NoCloseBracket = 14, + NoCloseBrace = 15, + NoKey = 16, + NoColon = 17, + CoercedList = 18, + UncoercedDoubleAt = 19 + } + + public struct AEBuildError + { + public AEBuildErrorCode Error; + public uint ErrorPos; + } + + [DllImport (AELib)] + public static extern OSStatus AEBuildDesc (ref AEDesc dst, out AEBuildError error, string src, __arglist); + + [DllImport (AELib)] + public static extern OSStatus + AEBuildParameters (ref AppleEvent evt, out AEBuildError error, string format, __arglist); + + [DllImport (AELib)] + public static extern OSStatus AEBuildAppleEvent (AEEventClass theClass, AEEventID theID, DescType addressType, + IntPtr addressData, Size addressLength, AEReturnID returnID, AETransactionID transactionID, + out AppleEvent result, out AEBuildError error, string paramsFmt, __arglist); + + [DllImport (AELib)] + public static extern OSStatus AEPrintDescToHandle (ref AEDesc desc, out IntPtr resultHandle); + + public struct AEStreamRef + { + public IntPtr Ptr; + } + + [DllImport (AELib)] + public static extern AEStreamRef AEStreamOpen (); + + [DllImport (AELib)] + public static extern OSStatus AEStreamClose (AEStreamRef streamRef, out AEDesc desc); + + [DllImport (AELib)] + public static extern OSStatus AEStreamOpenDesc (AEStreamRef streamRef, DescType newType); + + [DllImport (AELib)] + public static extern OSStatus AEStreamWriteData (AEStreamRef streamRef, IntPtr data, Size length); + + [DllImport (AELib)] + public static extern OSStatus AEStreamCloseDesc (AEStreamRef streamRef); + + [DllImport (AELib)] + public static extern OSStatus AEStreamWriteDesc (AEStreamRef streamRef, DescType newType, IntPtr data, + Size length); + + [DllImport (AELib)] + public static extern OSStatus AEStreamWriteAEDesc (AEStreamRef streamRef, ref AEDesc desc); + + [DllImport (AELib)] + public static extern OSStatus AEStreamOpenList (AEStreamRef streamRef); + + [DllImport (AELib)] + public static extern OSStatus AEStreamCloseList (AEStreamRef streamRef); + + [DllImport (AELib)] + public static extern OSStatus AEStreamOpenRecord (AEStreamRef streamRef, DescType newType); + + [DllImport (AELib)] + public static extern OSStatus AEStreamSetRecordType (AEStreamRef streamRef, DescType newType); + + [DllImport (AELib)] + public static extern OSStatus AEStreamCloseRecord (AEStreamRef streamRef); + + [DllImport (AELib)] + public static extern OSStatus AEStreamWriteKeyDesc (AEStreamRef streamRef, AEKeyword key, DescType newType, + IntPtr data, Size length); + + [DllImport (AELib)] + public static extern OSStatus AEStreamOpenKeyDesc (AEStreamRef streamRef, AEKeyword key, DescType newType); + + [DllImport (AELib)] + public static extern OSStatus AEStreamWriteKey (AEStreamRef streamRef, AEKeyword key); + + [DllImport (AELib)] + public static extern AEStreamRef AEStreamCreateEvent (AEEventClass clazz, AEEventID id, DescType targetType, + IntPtr targetData, Size targetLength, AEReturnID returnID, AETransactionID transactionID); + + [DllImport (AELib)] + public static extern AEStreamRef AEStreamOpenEvent (ref AppleEvent evt); + + [DllImport (AELib)] + public static extern OSStatus AEStreamOptionalParam (AEStreamRef streamRef, AEKeyword key); + + + //*********************** AEMach.h ******************** + + public const int keyReplyPortAttr = 0;//'repp'; + + [DllImport (AELib)] + public static extern uint /* mach_port_t */ AEGetRegisteredMachPort (); + + [DllImport (AELib)] + public static extern OSStatus AEDecodeMessage (IntPtr /* ref mach_msg_header_t */ header, ref AppleEvent evt, + out AppleEvent reply); + + [DllImport (AELib)] + public static extern OSStatus AEProcessMessage (IntPtr /* ref mach_msg_header_t */ header); + + [DllImport (AELib)] + public static extern OSStatus AESendMessage (ref AppleEvent evnt, out AppleEvent reply, AESendMode sendMode, + Size timeOutInTicks); + + + //******************* AEObjects.h ************** + + public static class AEOperator + { + public static readonly int And = 0x414e4420;//'AND ' + public static readonly int Or = 0x4f522020;//'OR ' + public static readonly int Not = 0x4e4f5420;//'NOT ' + } + + public static class AEOrdinal + { + public static readonly int First = 0x66697273;//'firs' + public static readonly int Last = 0x6c617374;//'last' + public static readonly int Middle = 0x6d696464;//'midd' + public static readonly int Any = 0x616e7920;//'any ' + public static readonly int All = 0x616c6c20;//'all ' + public static readonly int Next = 0x6e657874;//'next' + public static readonly int Previous = 0x70726576;//'prev' + } + + public static class AEObjectKeywords + { + // KEYWORD CONSTANT + public static readonly int keyAECompOperator = 0x72656c6f;//'relo' + public static readonly int keyAELogicalTerms = 0x7465726d;//'term' + public static readonly int keyAELogicalOperator = 0x6c6f6763;//'logc' + public static readonly int keyAEObject1 = 0x6f626a31;//'obj1' + public static readonly int keyAEObject2 = 0x6f626a32;//'obj2' + // for getting fields out of object specifier records + public static readonly int keyAEDesiredClass = 0x77616e74;//'want' + public static readonly int keyAEContainer = 0x66726f6d;//'from' + public static readonly int keyAEKeyForm = 0x666f726d;//'form' + public static readonly int keyAEKeyData = 0x73656c64;//'seld' + + // for getting fields out of Range specifier records + public static readonly int keyAERangeStart = 0x73746172;//'star' + public static readonly int keyAERangeStop = 0x73746f70;//'stop' + // special handler selectors for OSL Callbacks. + public static readonly int keyDisposeTokenProc = 0x78746f6b;//'xtok' + public static readonly int keyAECompareProc = 0x636d7072;//'cmpr' + public static readonly int keyAECountProc = 0x636f6e74;//'cont' + public static readonly int keyAEMarkTokenProc = 0x6d6b6964;//'mkid' + public static readonly int keyAEMarkProc = 0x6d61726b;//'mark' + public static readonly int keyAEAdjustMarksProc = 0x61646a6d;//'adjm' + public static readonly int keyAEGetErrDescProc = 0x696e6463;//'indc' + + // VALUE and TYPE CONSTANTS + // possible values for the keyAEKeyForm field of an object specifier + public static readonly int formAbsolutePosition = 0x696e6478;//'indx' + public static readonly int formRelativePosition = 0x72656c65;//'rele' + public static readonly int formTest = 0x74657374;//'test' + public static readonly int formRange = 0x72616e67;//'rang' + public static readonly int formPropertyID = 0x70726f70;//'prop' + public static readonly int formName = 0x6e616d65;//'name' + public static readonly int formUniqueID = 0x49442020;//'ID ' + // relevant types (some of these are often paired with forms above). + public static readonly int typeObjectSpecifier = 0x6f626a20;//'obj ' + public static readonly int typeObjectBeingExamined = 0x65786d6e;//'exmn' + public static readonly int typeCurrentContainer = 0x63636e74;//'ccnt' + public static readonly int typeToken = 0x746f6b65;//'toke' + public static readonly int typeRelativeDescriptor = 0x72656c20;//'rel ' + public static readonly int typeAbsoluteOrdinal = 0x6162736f;//'abso' + public static readonly int typeIndexDescriptor = 0x696e6465;//'inde' + public static readonly int typeRangeDescriptor = 0x72616e67;//'rang' + public static readonly int typeLogicalDescriptor = 0x6c6f6769;//'logi' + public static readonly int typeCompDescriptor = 0x636d7064;//'cmpd' + public static readonly int typeOSLTokenList = 0x6F73746C;//'ostl' + + //SPECIAL CONSTANTS FOR CUSTOM WHOSE-CLAUSE RESOLUTION + public static readonly int typeWhoseDescriptor = 0x77686f73;//'whos' + public static readonly int formWhose = 0x77686f73;//'whos' + public static readonly int typeWhoseRange = 0x77726e67;//'wrng' + public static readonly int keyAEWhoseRangeStart = 0x77737472;//'wstr' + public static readonly int keyAEWhoseRangeStop = 0x77737470;//'wstp' + public static readonly int keyAEIndex = 0x6b696478;//'kidx' + public static readonly int keyAETest = 0x6b747374;//'ktst' + } + + [Flags] + public enum AEResolveFlags + { + IDoMinimum = 0x0000, + IDoWhose = 0x0001, + IDoMarking = 0x0004, + PassSubDescs = 0x0008, + ResolveNestedLists = 0x0010, + HandleSimpleRanges = 0x0020, + UseRelativeIterators = 0x0040 + } + + public struct ccntTokenRecord + { + public DescType tokenClass; + public AEDesc token; + } + + public struct ccntTokenRecPtr + { + public ccntTokenRecord *Ptr; + } + + public struct ccntTokenRecHandle + { + public ccntTokenRecPtr *Handle; + } + + public delegate OSErr OSLAccessorUPP (DescType desiredClass, ref AEDesc container, + DescType containerClass, DescType form, ref AEDesc selectionData, out AEDesc value, uint accessorRefcon); + public delegate OSErr OSLCompareUPP (DescType oper, ref AEDesc obj1, ref AEDesc obj2, out bool result); + public delegate OSErr OSLCountUPP (DescType desiredType, DescType containerClass, ref AEDesc container, out Size result); + public delegate OSErr OSLDisposeTokenUPP (ref AEDesc unneededToken); + public delegate OSErr OSLGetMarkTokenUPP (ref AEDesc dContainerToken, DescType containerClass, out AEDesc result); + public delegate OSErr OSLGetErrDescUPP (AEDesc ** appDescPtr); + public delegate OSErr OSLMarkUPP (ref AEDesc dToken, ref AEDesc markToken, Index index); + public delegate OSErr OSLAdjustMarksUPP (Index newStart, Index newStop, ref AEDesc markToken); + + [DllImport (AELib)] + public static extern OSErr AEObjectInit (); + + [DllImport (AELib)] + public static extern OSErr AESetObjectCallbacks (OSLCompareUPP compare, OSLCountUPP count, + OSLDisposeTokenUPP disposeToken, OSLGetMarkTokenUPP getMarkToken, OSLMarkUPP mark, + OSLAdjustMarksUPP adjustMarks, OSLGetErrDescUPP getErrDesc); + + [DllImport (AELib)] + public static extern OSErr AEResolve (ref AEDesc objectSpecifier, short callbackFlags, out AEDesc theToken); + + [DllImport (AELib)] + public static extern OSErr AEInstallObjectAccessor (DescType desiredClass, DescType containerType, + OSLAccessorUPP accessor, uint accessorRefcon, bool isSysHandler); + + [DllImport (AELib)] + public static extern OSErr AERemoveObjectAccessor (DescType desiredClass, DescType containerType, + OSLAccessorUPP theAccessor, Boolean isSysHandler); + + [DllImport (AELib)] + public static extern OSErr AEGetObjectAccessor (DescType desiredClass, DescType containerType, + out OSLAccessorUPP accessor, out uint accessorRefcon, bool isSysHandler); + + [DllImport (AELib)] + public static extern OSErr AEDisposeToken (ref AEDesc token); + + [DllImport (AELib)] + public static extern OSErr AECallObjectAccessor (DescType desiredClass, ref AEDesc containerToken, + DescType containerClass, DescType keyForm, ref AEDesc keyData, ref AEDesc token); + + //**************** AEPackObject.h *************** + + [DllImport (AELib)] + public static extern OSErr CreateOffsetDescriptor (Index theOffset, out AEDesc theDescriptor); + + [DllImport (AELib)] + public static extern OSErr CreateCompDescriptor (DescType comparisonOperator, ref AEDesc operand1, + ref AEDesc operand2, bool disposeInputs, out AEDesc theDescriptor); + + [DllImport (AELib)] + public static extern OSErr CreateLogicalDescriptor (ref AEDescList theLogicalTerms, + DescType theLogicOperator, bool disposeInputs, out AEDesc theDescriptor); + + [DllImport (AELib)] + public static extern OSErr CreateObjSpecifier (DescType desiredClass, ref AEDesc theContainer, + DescType keyForm, ref AEDesc keyData, bool disposeInputs, out AEDesc objSpecifier); + + [DllImport (AELib)] + public static extern OSErr CreateRangeDescriptor (ref AEDesc rangeStart, ref AEDesc rangeStop, + bool disposeInputs, out AEDesc theDescriptor); + + //**************** AERegistry.h, AEUserTermTypes.h, *************** + + //about 1000 lines of constants, didn't figure out how to sanely structure them + } +}
\ No newline at end of file diff --git a/main/src/addins/MacPlatform/MacPlatform.addin.xml b/main/src/addins/MacPlatform/MacPlatform.addin.xml index 569cc5d996..26c69d440b 100644 --- a/main/src/addins/MacPlatform/MacPlatform.addin.xml +++ b/main/src/addins/MacPlatform/MacPlatform.addin.xml @@ -50,8 +50,6 @@ <Class class="MonoDevelop.MacIntegration.MacSelectFileDialogHandler" /> <Class class="MonoDevelop.MacIntegration.MacAddFileDialogHandler" /> <Class class="MonoDevelop.MacIntegration.MacOpenFileDialogHandler" /> - <!-- <Class class="MonoDevelop.MacIntegration.MacAlertDialogHandler" /> - --> </Extension> </Addin> diff --git a/main/src/addins/MacPlatform/MacPlatform.csproj b/main/src/addins/MacPlatform/MacPlatform.csproj index ea222e0183..0cd83b3172 100644 --- a/main/src/addins/MacPlatform/MacPlatform.csproj +++ b/main/src/addins/MacPlatform/MacPlatform.csproj @@ -71,7 +71,6 @@ <Compile Include="Dialogs\SelectEncodingPopUpButton.cs" /> <Compile Include="Dialogs\Layout.cs" /> <Compile Include="Dialogs\MacAlertDialogHandler.cs" /> - <Compile Include="MacInterop\Carbon.cs" /> <Compile Include="MacInterop\CoreFoundation.cs" /> <Compile Include="MacInterop\HIToolbox.cs" /> <Compile Include="MacInterop\ApplicationEvents.cs" /> @@ -86,6 +85,8 @@ <Compile Include="MacIntegrationCommands.cs" /> <Compile Include="MacExternalConsoleProcess.cs" /> <Compile Include="MacMainMenu.cs" /> + <Compile Include="MacInterop\Carbon.cs" /> + <Compile Include="MacInterop\AppleEvents\Native.cs" /> </ItemGroup> <ItemGroup> <None Include="ChangeLog" /> @@ -115,5 +116,6 @@ <ItemGroup> <Folder Include="Dialogs\" /> <Folder Include="MacInterop\" /> + <Folder Include="MacInterop\AppleEvents\" /> </ItemGroup> </Project> diff --git a/main/src/addins/MacPlatform/Makefile.am b/main/src/addins/MacPlatform/Makefile.am index e8b3d03f2b..f0bd73498b 100644 --- a/main/src/addins/MacPlatform/Makefile.am +++ b/main/src/addins/MacPlatform/Makefile.am @@ -34,6 +34,7 @@ FILES = \ MacExternalConsoleProcess.cs \ MacIntegrationCommands.cs \ MacInterop/AppleEvent.cs \ + MacInterop/AppleEvents/Native.cs \ MacInterop/AppleScript.cs \ MacInterop/ApplicationEvents.cs \ MacInterop/Carbon.cs \ diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs index 463d1e2222..e413e6a2e3 100644 --- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs +++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs @@ -67,7 +67,8 @@ namespace MonoDevelop.AssemblyBrowser } DocumentationPanel documentationPanel = new DocumentationPanel (); - Mono.TextEditor.TextEditor inspectEditor = new Mono.TextEditor.TextEditor (); + Mono.TextEditor.TextEditor inspectEditor; + public AssemblyBrowserWidget () { this.Build (); @@ -101,21 +102,18 @@ namespace MonoDevelop.AssemblyBrowser this.documentationLabel.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (255, 255, 225)); this.documentationLabel.Wrap = true; - PropertyService.PropertyChanged += HandlePropertyChanged; - - var options = new Mono.TextEditor.TextEditorOptions (); - options.FontName = PropertyService.Get<string> ("FontName"); - options.ShowFoldMargin = false; - options.ShowIconMargin = false; - options.ShowInvalidLines = false; - options.ShowLineNumberMargin = false; - options.ShowSpaces = false; - options.ShowTabs = false; - options.HighlightCaretLine = true; - options.ColorScheme = PropertyService.Get ("ColorScheme", "Default"); - this.inspectEditor.Options = options; - + var options = new MonoDevelop.Ide.Gui.CommonTextEditorOptions () { + ShowFoldMargin = false, + ShowIconMargin = false, + ShowInvalidLines = false, + ShowLineNumberMargin = false, + ShowSpaces = false, + ShowTabs = false, + HighlightCaretLine = true, + }; + inspectEditor = new Mono.TextEditor.TextEditor (new Mono.TextEditor.Document (), options); inspectEditor.ButtonPressEvent += HandleInspectEditorButtonPressEvent; + this.inspectEditor.Document.ReadOnly = true; // this.inspectEditor.Document.SyntaxMode = new Mono.TextEditor.Highlighting.MarkupSyntaxMode (); this.inspectEditor.TextViewMargin.GetLink = delegate(Mono.TextEditor.MarginMouseEventArgs arg) { @@ -318,12 +316,6 @@ namespace MonoDevelop.AssemblyBrowser base.OnRealized (); TreeView.GrabFocus (); } - - void HandlePropertyChanged(object sender, MonoDevelop.Core.PropertyChangedEventArgs e) - { - if (e.Key == "ColorScheme") - ((Mono.TextEditor.TextEditorOptions)this.inspectEditor.Options).ColorScheme = PropertyService.Get ("ColorScheme", "Default"); - } ITreeNavigator SearchMember (IEntity member) { @@ -1049,7 +1041,6 @@ namespace MonoDevelop.AssemblyBrowser // this.searchEntry.Changed -= SearchEntryhandleChanged; this.searchTreeview.RowActivated -= SearchTreeviewhandleRowActivated; hpaned1.ExposeEvent -= HPaneExpose; - PropertyService.PropertyChanged -= HandlePropertyChanged; base.OnDestroyed (); } diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPad.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPad.cs index 03f7c50103..e09d0d661a 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPad.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPad.cs @@ -46,7 +46,7 @@ namespace MonoDevelop.Debugger { BreakpointStore bps; - BreakpointsTreeView tree; + PadTreeView tree; Gtk.TreeStore store; Widget control; ScrolledWindow sw; @@ -102,10 +102,11 @@ namespace MonoDevelop.Debugger store = new TreeStore (typeof(string), typeof (bool), typeof(string), typeof(object), typeof(string), typeof(string), typeof(string), typeof(string)); - tree = new BreakpointsTreeView (this); + tree = new PadTreeView (); tree.Model = store; tree.RulesHint = true; tree.HeadersVisible = true; + tree.DoPopupMenu = ShowPopup; treeState = new TreeViewState (tree, (int) Columns.Breakpoint); @@ -154,8 +155,6 @@ namespace MonoDevelop.Debugger bps = DebuggingService.Breakpoints; UpdateDisplay (); - - tree.PopupMenu += new PopupMenuHandler (OnPopupMenu); breakpointUpdatedHandler = DispatchService.GuiDispatch (new EventHandler<BreakpointEventArgs> (OnBreakpointUpdated)); @@ -186,15 +185,10 @@ namespace MonoDevelop.Debugger DebuggingService.ResumedEvent -= OnDebuggerStatusCheck; DebuggingService.StoppedEvent -= OnDebuggerStatusCheck; } - - private void OnPopupMenu (object o, PopupMenuArgs args) - { - ShowPopup (); - } - internal void ShowPopup () + void ShowPopup (Gdk.EventButton evt) { - IdeApp.CommandService.ShowContextMenu (menuSet, tree); + IdeApp.CommandService.ShowContextMenu (tree, evt, menuSet, tree); } [CommandHandler (LocalCommands.Properties)] @@ -349,23 +343,4 @@ namespace MonoDevelop.Debugger OnDeleted (); } } - - class BreakpointsTreeView: MonoDevelop.Ide.Gui.Components.PadTreeView - { - BreakpointPad pad; - - public BreakpointsTreeView (BreakpointPad pad) - { - this.pad = pad; - } - - protected override bool OnButtonPressEvent (Gdk.EventButton evnt) - { - bool ret = base.OnButtonPressEvent (evnt); - if (evnt.Button == 3) - pad.ShowPopup (); - return ret; - } - - } -} +}
\ No newline at end of file diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs index f138edefeb..c0a0c5f2eb 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs @@ -37,6 +37,7 @@ using MonoDevelop.Ide.CodeCompletion; using MonoDevelop.Ide.Gui.Components; using MonoDevelop.Components.Commands; using MonoDevelop.Ide.Commands; +using Mono.TextEditor; namespace MonoDevelop.Debugger @@ -129,7 +130,7 @@ namespace MonoDevelop.Debugger store = new TreeStore (typeof(string), typeof(string), typeof(string), typeof(ObjectValue), typeof(bool), typeof(bool), typeof(bool), typeof(string), typeof(string), typeof(string), typeof(bool), typeof(string), typeof(Gdk.Pixbuf), typeof(bool)); Model = store; RulesHint = true; - Selection.Mode = SelectionMode.Multiple; + Selection.Mode = Gtk.SelectionMode.Multiple; ResetColumnSizes (); Pango.FontDescription newFont = this.Style.FontDescription.Copy (); @@ -972,6 +973,12 @@ namespace MonoDevelop.Debugger TreeViewColumn col; CellRenderer cr; + //HACK: show context menu in release event instead of show event to work around gtk bug + if (evnt.TriggersContextMenu ()) { + // ShowPopup (evnt); + return true; + } + if (evnt.Button == 1 && GetCellAtPos ((int)evnt.X, (int)evnt.Y, out path, out col, out cr)) { TreeIter it; store.GetIter (out it, path); @@ -1001,28 +1008,31 @@ namespace MonoDevelop.Debugger } } - if (evnt.Button == 3) - ShowPopup (); - return res; } protected override bool OnButtonReleaseEvent (Gdk.EventButton evnt) { allowStoreColumnSizes = false; - return base.OnButtonReleaseEvent (evnt); + var res = base.OnButtonReleaseEvent (evnt); + + //HACK: show context menu in release event instead of show event to work around gtk bug + if (evnt.IsContextMenuButton ()) { + ShowPopup (evnt); + return true; + } + return res; } - protected override bool OnPopupMenu () { - ShowPopup (); + ShowPopup (null); return true; } - void ShowPopup () + void ShowPopup (Gdk.EventButton evt) { - IdeApp.CommandService.ShowContextMenu (menuSet, this); + IdeApp.CommandService.ShowContextMenu (this, evt, menuSet, this); } [CommandHandler (EditCommands.Delete)] diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/StackTracePad.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/StackTracePad.cs index f03e326d69..41b79b1cf8 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/StackTracePad.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/StackTracePad.cs @@ -41,8 +41,7 @@ namespace MonoDevelop.Debugger tree.RulesHint = true; tree.HeadersVisible = true; tree.Selection.Mode = SelectionMode.Multiple; - tree.ButtonPressEvent += HandleTreeButtonPressEvent;; - tree.PopupMenu += HandleTreePopupMenu; + tree.DoPopupMenu = ShowPopup; TreeViewColumn col = new TreeViewColumn (); CellRenderer crp = new CellRendererIcon (); @@ -201,22 +200,9 @@ namespace MonoDevelop.Debugger UpdateDisplay (); } - [GLib.ConnectBefore] - void HandleTreeButtonPressEvent (object o, ButtonPressEventArgs args) + void ShowPopup (Gdk.EventButton evt) { - if (args.Event.Button == 3) - ShowPopup (); - } - - [GLib.ConnectBefore] - void HandleTreePopupMenu (object o, PopupMenuArgs args) - { - ShowPopup (); - } - - internal void ShowPopup () - { - IdeApp.CommandService.ShowContextMenu (menuSet, tree); + IdeApp.CommandService.ShowContextMenu (tree, evt, menuSet, tree); } [CommandHandler ("StackTracePad.ActivateFrame")] diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/Toolbox.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/Toolbox.cs index 7150256b93..765f694e04 100644 --- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/Toolbox.cs +++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/Toolbox.cs @@ -37,6 +37,7 @@ using MonoDevelop.Ide.Gui; using MonoDevelop.Components.Commands;
using MonoDevelop.Components.Docking;
using MonoDevelop.Ide;
+using Mono.TextEditor;
namespace MonoDevelop.DesignerSupport.Toolbox
{ @@ -115,7 +116,7 @@ namespace MonoDevelop.DesignerSupport.Toolbox fontChanger = new MonoDevelop.Ide.Gui.PadFontChanger (toolboxWidget, toolboxWidget.SetCustomFont, toolboxWidget.QueueResize);
- this.toolboxWidget.ButtonReleaseEvent += OnButtonRelease; + this.toolboxWidget.DoPopupMenu = ShowPopup; scrolledWindow = new MonoDevelop.Components.CompactScrolledWindow (); base.PackEnd (scrolledWindow, true, true, 0); @@ -185,17 +186,10 @@ namespace MonoDevelop.DesignerSupport.Toolbox toolboxService.AddUserItems (); } - private void OnButtonRelease(object sender, Gtk.ButtonReleaseEventArgs args) - { - if (args.Event.Button == 3) { - ShowPopup (); - } - } - - void ShowPopup () + void ShowPopup (Gdk.EventButton evt) { CommandEntrySet eset = IdeApp.CommandService.CreateCommandEntrySet ("/MonoDevelop/DesignerSupport/ToolboxItemContextMenu"); - IdeApp.CommandService.ShowContextMenu (eset, this); + IdeApp.CommandService.ShowContextMenu (this, evt, eset, this); } [CommandHandler (MonoDevelop.Ide.Commands.EditCommands.Delete)] diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/ToolboxWidget.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/ToolboxWidget.cs index 2fb5cd79fe..809e0a5cac 100644 --- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/ToolboxWidget.cs +++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/ToolboxWidget.cs @@ -32,6 +32,7 @@ using System.Collections.ObjectModel; using Gtk; using Pango; using Gdk; +using Mono.TextEditor; namespace MonoDevelop.DesignerSupport.Toolbox { @@ -417,12 +418,14 @@ namespace MonoDevelop.DesignerSupport.Toolbox return base.OnScrollEvent (evnt); } + public Action<Gdk.EventButton> DoPopupMenu { get; set; } + protected override bool OnButtonPressEvent (Gdk.EventButton e) { this.GrabFocus (); HideTooltipWindow (); if (this.mouseOverItem is Category) { - if (e.Button == 1) { + if (!e.TriggersContextMenu () && e.Button == 1) { Category mouseOverCateogry = (Category)this.mouseOverItem; mouseOverCateogry.IsExpanded = !mouseOverCateogry.IsExpanded; } @@ -432,11 +435,27 @@ namespace MonoDevelop.DesignerSupport.Toolbox this.SelectedItem = mouseOverItem; this.QueueDraw (); } - if (e.Type == EventType.TwoButtonPress && this.SelectedItem != null) + if (e.TriggersContextMenu ()) { + if (DoPopupMenu != null) { + DoPopupMenu (null); + return true; + } + } else if (e.Type == EventType.TwoButtonPress && this.SelectedItem != null) { this.OnActivateSelectedItem (EventArgs.Empty); + return true; + } return base.OnButtonPressEvent (e); } + protected override bool OnPopupMenu () + { + if (DoPopupMenu != null) { + DoPopupMenu (null); + return true; + } + return base.OnPopupMenu (); + } + protected override bool OnMotionNotifyEvent (Gdk.EventMotion e) { int xpos = 0; diff --git a/main/src/addins/MonoDevelop.Gettext/Makefile.am b/main/src/addins/MonoDevelop.Gettext/Makefile.am index 407522907c..8dfdb887e0 100644 --- a/main/src/addins/MonoDevelop.Gettext/Makefile.am +++ b/main/src/addins/MonoDevelop.Gettext/Makefile.am @@ -64,7 +64,6 @@ FILES = \ RES = \ gtk-gui/gui.stetic \ - gtk-gui/objects.xml \ icons/gettext-overlay-16.png \ icons/gettext-overlay-32.png \ icons/locale_16x16.png \ diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs index c1af5850df..947027b174 100644 --- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs +++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs @@ -46,8 +46,6 @@ using System.Threading; namespace MonoDevelop.Gettext { - [System.ComponentModel.Category("widget")] - [System.ComponentModel.ToolboxItem(true)] public partial class POEditorWidget : Gtk.Bin, IUndoHandler { TranslationProject project; @@ -96,6 +94,15 @@ namespace MonoDevelop.Gettext { this.project = project; this.Build (); + + //FIXME: avoid unnecessary creation of old treeview + scrolledwindow1.Remove (treeviewEntries); + treeviewEntries.Destroy (); + treeviewEntries = new MonoDevelop.Components.ContextMenuTreeView (); + treeviewEntries.ShowAll (); + scrolledwindow1.Add (treeviewEntries); + ((MonoDevelop.Components.ContextMenuTreeView)treeviewEntries).DoPopupMenu = ShowPopup; + this.headersEditor = new CatalogHeadersWidget (); this.notebookPages.AppendPage (headersEditor, new Gtk.Label ()); @@ -221,15 +228,6 @@ namespace MonoDevelop.Gettext UpdateProgressBar (); }; - this.treeviewEntries.PopupMenu += delegate { - ShowPopup (); - }; - - this.treeviewEntries.ButtonReleaseEvent += delegate(object sender, Gtk.ButtonReleaseEventArgs e) { - if (e.Event.Button == 3) - ShowPopup (); - }; - searchEntryFilter.Ready = true; searchEntryFilter.Visible = true; searchEntryFilter.ForceFilterButtonVisible = true; @@ -519,11 +517,11 @@ namespace MonoDevelop.Gettext this.notebookTranslated.AppendPage (window, label); } - void ShowPopup () + void ShowPopup (EventButton evt) { Gtk.Menu contextMenu = CreateContextMenu (); if (contextMenu != null) - contextMenu.Popup (); + GtkWorkarounds.ShowContextMenu (contextMenu, this, evt); } Gtk.Menu CreateContextMenu () @@ -1292,4 +1290,4 @@ namespace MonoDevelop.Gettext } #endregion } -} +}
\ No newline at end of file diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.csproj b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.csproj index ca569cde13..8d5d329b97 100644 --- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.csproj +++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.csproj @@ -140,9 +140,6 @@ <EmbeddedResource Include="gtk-gui\gui.stetic"> <LogicalName>gui.stetic</LogicalName> </EmbeddedResource> - <EmbeddedResource Include="gtk-gui\objects.xml"> - <LogicalName>objects.xml</LogicalName> - </EmbeddedResource> <EmbeddedResource Include="MonoDevelop.Gettext.addin.xml"> <LogicalName>MonoDevelop.Gettext.addin.xml</LogicalName> </EmbeddedResource> diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/GettextFeatureWidget.cs b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/GettextFeatureWidget.cs index bb919398a1..c045111024 100644 --- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/GettextFeatureWidget.cs +++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/GettextFeatureWidget.cs @@ -36,8 +36,6 @@ using MonoDevelop.Ide; namespace MonoDevelop.Gettext { - [System.ComponentModel.Category("widget")] - [System.ComponentModel.ToolboxItem(true)] public partial class GettextFeatureWidget : Gtk.Bin { ListStore store; diff --git a/main/src/addins/MonoDevelop.Gettext/gtk-gui/gui.stetic b/main/src/addins/MonoDevelop.Gettext/gtk-gui/gui.stetic index 1dc0651eff..9e30ff6227 100644 --- a/main/src/addins/MonoDevelop.Gettext/gtk-gui/gui.stetic +++ b/main/src/addins/MonoDevelop.Gettext/gtk-gui/gui.stetic @@ -7,7 +7,6 @@ <import> <widget-library name="../../../../build/AddIns/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.dll" /> <widget-library name="../../../../build/bin/MonoDevelop.Ide.dll" /> - <widget-library name="../../../../build/AddIns/MonoDevelop.Autotools/MonoDevelop.Autotools.dll" /> <widget-library name="../../../../build/AddIns/MonoDevelop.Deployment/MonoDevelop.Deployment.dll" /> <widget-library name="../../../../build/bin/Mono.TextEditor.dll" /> <widget-library name="../../../../build/AddIns/MonoDevelop.Gettext/MonoDevelop.Gettext.dll" internal="true" /> diff --git a/main/src/addins/MonoDevelop.Gettext/gtk-gui/objects.xml b/main/src/addins/MonoDevelop.Gettext/gtk-gui/objects.xml deleted file mode 100644 index f87c293eb8..0000000000 --- a/main/src/addins/MonoDevelop.Gettext/gtk-gui/objects.xml +++ /dev/null @@ -1 +0,0 @@ -<objects attr-sync="on"></objects>
\ No newline at end of file diff --git a/main/src/addins/MonoDevelop.GtkCore/libstetic/Makefile.am b/main/src/addins/MonoDevelop.GtkCore/libstetic/Makefile.am index 8cf7e8afbe..20090eee8b 100644 --- a/main/src/addins/MonoDevelop.GtkCore/libstetic/Makefile.am +++ b/main/src/addins/MonoDevelop.GtkCore/libstetic/Makefile.am @@ -29,6 +29,7 @@ FILES = \ editor/FlagsSelectorDialog.cs \ editor/FloatRange.cs \ editor/GroupPicker.cs \ + editor/GtkWorkarounds.cs \ editor/IconList.cs \ editor/IconSelectorItem.cs \ editor/IconSelectorMenu.cs \ diff --git a/main/src/addins/MonoDevelop.GtkCore/libstetic/editor/ActionItem.cs b/main/src/addins/MonoDevelop.GtkCore/libstetic/editor/ActionItem.cs index 5d2d09cdd8..755ce1392c 100644 --- a/main/src/addins/MonoDevelop.GtkCore/libstetic/editor/ActionItem.cs +++ b/main/src/addins/MonoDevelop.GtkCore/libstetic/editor/ActionItem.cs @@ -132,7 +132,9 @@ namespace Stetic.Editor public bool ProcessButtonPress (Gdk.EventButton ev) { - if (ev.Button == 1) { + if (GtkWorkarounds.TriggersContextMenu (ev)) { + parentMenu.ShowContextMenu (this); + } else if (ev.Button == 1) { IDesignArea area = GetDesignArea (); if (area == null) return true; @@ -142,8 +144,6 @@ namespace Stetic.Editor editOnRelease = true; return true; } - } else if (ev.Button == 3) { - parentMenu.ShowContextMenu (this); } Select (); diff --git a/main/src/addins/MonoDevelop.GtkCore/libstetic/editor/ActionToolItem.cs b/main/src/addins/MonoDevelop.GtkCore/libstetic/editor/ActionToolItem.cs index 5b27ab4c1c..b0372cda87 100644 --- a/main/src/addins/MonoDevelop.GtkCore/libstetic/editor/ActionToolItem.cs +++ b/main/src/addins/MonoDevelop.GtkCore/libstetic/editor/ActionToolItem.cs @@ -320,7 +320,7 @@ namespace Stetic.Editor args.RetVal = true; return; } - if (args.Event.Button == 1) + if (args.Event.Button == 1 && !GtkWorkarounds.TriggersContextMenu (args.Event)) motionDrag = true; args.RetVal = ProcessButtonPress (args.Event); } diff --git a/main/src/addins/MonoDevelop.GtkCore/libstetic/editor/GtkWorkarounds.cs b/main/src/addins/MonoDevelop.GtkCore/libstetic/editor/GtkWorkarounds.cs new file mode 100644 index 0000000000..2f8d350e5c --- /dev/null +++ b/main/src/addins/MonoDevelop.GtkCore/libstetic/editor/GtkWorkarounds.cs @@ -0,0 +1,97 @@ +// +// GtkWorkarounds.cs +// +// Author: +// Michael Hutchinson <mhutch@xamarin.com> +// +// Copyright (c) 2011 Xamarin Inc. (http://xamarin.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.Runtime.InteropServices; + +namespace Stetic.Editor +{ + //from Mono.TextEditor/GtkWorkarounds.cs + public static class GtkWorkarounds + { + public static bool TriggersContextMenu (Gdk.EventButton evt) + { + return evt.Type == Gdk.EventType.ButtonPress && IsContextMenuButton (evt); + } + + public static bool IsContextMenuButton (Gdk.EventButton evt) + { + if (evt.Button == 3 && + (evt.State & (Gdk.ModifierType.Button1Mask | Gdk.ModifierType.Button2Mask)) == 0) + return true; + + if (Platform.IsMac) { + if (evt.Button == 1 && + (evt.State & Gdk.ModifierType.ControlMask) != 0 && + (evt.State & (Gdk.ModifierType.Button2Mask | Gdk.ModifierType.Button3Mask)) == 0) + return true; + } + + return false; + } + } + + //from Mono.TextEditor/Platform.cs + public static class Platform + { + static Platform () + { + IsWindows = System.IO.Path.DirectorySeparatorChar == '\\'; + IsMac = !IsWindows && IsRunningOnMac(); + IsX11 = !IsMac && System.Environment.OSVersion.Platform == PlatformID.Unix; + } + + static Gdk.Keymap keymap = Gdk.Keymap.Default; + + public static bool IsMac { get; private set; } + public static bool IsX11 { get; private set; } + public static bool IsWindows { get; private set; } + + //From Managed.Windows.Forms/XplatUI + static bool IsRunningOnMac () + { + IntPtr buf = IntPtr.Zero; + try { + buf = Marshal.AllocHGlobal (8192); + // This is a hacktastic way of getting sysname from uname () + if (uname (buf) == 0) { + string os = Marshal.PtrToStringAnsi (buf); + if (os == "Darwin") + return true; + } + } catch { + } finally { + if (buf != IntPtr.Zero) + Marshal.FreeHGlobal (buf); + } + + return false; + } + + [DllImport ("libc")] + static extern int uname (IntPtr buf); + } +}
\ No newline at end of file diff --git a/main/src/addins/MonoDevelop.GtkCore/libstetic/libstetic.csproj b/main/src/addins/MonoDevelop.GtkCore/libstetic/libstetic.csproj index ef877a1887..c26235cec2 100644 --- a/main/src/addins/MonoDevelop.GtkCore/libstetic/libstetic.csproj +++ b/main/src/addins/MonoDevelop.GtkCore/libstetic/libstetic.csproj @@ -218,6 +218,7 @@ <Compile Include="TopLevelDialog.cs" /> <Compile Include="TopLevelWindow.cs" /> <Compile Include="wrapper\NotifyWorkaround.cs" /> + <Compile Include="editor\GtkWorkarounds.cs" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="stetic.glade"> diff --git a/main/src/addins/MonoDevelop.GtkCore/libstetic/wrapper/Container.cs b/main/src/addins/MonoDevelop.GtkCore/libstetic/wrapper/Container.cs index 889be5edbf..a2c101ccd3 100644 --- a/main/src/addins/MonoDevelop.GtkCore/libstetic/wrapper/Container.cs +++ b/main/src/addins/MonoDevelop.GtkCore/libstetic/wrapper/Container.cs @@ -818,13 +818,13 @@ namespace Stetic.Wrapper return; Placeholder ph = obj as Placeholder; - - if (args.Event.Button == 1) { - proj.Selection = ph; - args.RetVal = true; - } else if (args.Event.Button == 3) { + + if (GtkWorkarounds.TriggersContextMenu (args.Event)) { proj.PopupContextMenu (ph); args.RetVal = true; + } else if (args.Event.Button == 1) { + proj.Selection = ph; + args.RetVal = true; } } diff --git a/main/src/addins/MonoDevelop.GtkCore/libstetic/wrapper/Widget.cs b/main/src/addins/MonoDevelop.GtkCore/libstetic/wrapper/Widget.cs index 604c9f95f8..76c1b581cf 100644 --- a/main/src/addins/MonoDevelop.GtkCore/libstetic/wrapper/Widget.cs +++ b/main/src/addins/MonoDevelop.GtkCore/libstetic/wrapper/Widget.cs @@ -333,15 +333,19 @@ namespace Stetic.Wrapper { Widget wrapper = FindWrapper (Wrapped, x, y); if (wrapper == null) return false; - + + bool handled = false; if (wrapper.Wrapped != proj.Selection) { wrapper.Select (); - return true; - } else if (evb.Button == 3) { + handled = true; + } + + if (Stetic.Editor.GtkWorkarounds.TriggersContextMenu (evb)) { proj.PopupContextMenu (wrapper); return true; - } else - return false; + } + + return handled; } Widget FindWrapper (Gtk.Widget top, int x, int y) diff --git a/main/src/addins/MonoDevelop.GtkCore/libsteticui/ProjectViewBackend.cs b/main/src/addins/MonoDevelop.GtkCore/libsteticui/ProjectViewBackend.cs index 3d93a71e7c..65dec7e0b7 100644 --- a/main/src/addins/MonoDevelop.GtkCore/libsteticui/ProjectViewBackend.cs +++ b/main/src/addins/MonoDevelop.GtkCore/libsteticui/ProjectViewBackend.cs @@ -301,10 +301,11 @@ namespace Stetic { else frontend.NotifySelectionChanged (null, null, null); } - - protected override bool OnButtonPressEvent (Gdk.EventButton evt) + + //HACK: show context menu in release event instead of show event to work around gtk bug + protected override bool OnButtonReleaseEvent (Gdk.EventButton evt) { - if (evt.Button == 3 && evt.Type == Gdk.EventType.ButtonPress) + if (Stetic.Editor.GtkWorkarounds.IsContextMenuButton (evt)) return OnPopupMenu (); return base.OnButtonPressEvent (evt); } diff --git a/main/src/addins/MonoDevelop.GtkCore/libsteticui/WidgetDesignerBackend.cs b/main/src/addins/MonoDevelop.GtkCore/libsteticui/WidgetDesignerBackend.cs index 6f0905dc82..73d4f70790 100644 --- a/main/src/addins/MonoDevelop.GtkCore/libsteticui/WidgetDesignerBackend.cs +++ b/main/src/addins/MonoDevelop.GtkCore/libsteticui/WidgetDesignerBackend.cs @@ -32,6 +32,7 @@ using System.Collections; using System.Reflection; using Gtk; using Gdk; +using Stetic.Editor; namespace Stetic { @@ -884,7 +885,7 @@ namespace Stetic protected override bool OnButtonPressEvent (Gdk.EventButton evb) { - if (evb.Type == Gdk.EventType.ButtonPress && evb.Button == 1) { + if (evb.Type == Gdk.EventType.ButtonPress && evb.Button == 1 && !GtkWorkarounds.TriggersContextMenu (evb)) { clickX = (int)evb.XRoot; clickY = (int)evb.YRoot; localClickX = (int) evb.X; diff --git a/main/src/addins/MonoDevelop.MacDev/Makefile.am b/main/src/addins/MonoDevelop.MacDev/Makefile.am index f0691ec8f9..af9a5b258e 100644 --- a/main/src/addins/MonoDevelop.MacDev/Makefile.am +++ b/main/src/addins/MonoDevelop.MacDev/Makefile.am @@ -29,8 +29,6 @@ FILES = \ AssemblyInfo.cs \ BindingProject/ObjcBindingProject.cs \ BindingProject/ObjcBindingProjectConfiguration.cs \ - gtk-gui/generated.cs \ - gtk-gui/MonoDevelop.MacDev.PlistEditor.CustomPropertiesWidget.cs \ MacBuildUtilities.cs \ MonoDevelop.MacDev.InterfaceBuilder/Collections.cs \ MonoDevelop.MacDev.InterfaceBuilder/IBConnectionRecord.cs \ @@ -103,9 +101,7 @@ FILES = \ XcodeSyncing/XcodeSyncedItem.cs \ XcodeSyncing/XcodeSyncedType.cs -RES = \ - gtk-gui/gui.stetic \ - MonoDevelop.MacDev.addin.xml +RES = MonoDevelop.MacDev.addin.xml ICON_FILES = \ icons/application-x-mono-develop-xib-48.png \ diff --git a/main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.PlistEditor/CustomPropertiesWidget.cs b/main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.PlistEditor/CustomPropertiesWidget.cs index 92b6fcd8b9..ae9f59ff97 100644 --- a/main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.PlistEditor/CustomPropertiesWidget.cs +++ b/main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.PlistEditor/CustomPropertiesWidget.cs @@ -31,18 +31,19 @@ using MonoMac.Foundation; using System.Linq; using MonoDevelop.Components.Commands; using MonoDevelop.Ide; +using Mono.TextEditor; namespace MonoDevelop.MacDev.PlistEditor { [System.ComponentModel.ToolboxItem(true)] - public partial class CustomPropertiesWidget : Gtk.Bin, IPListDisplayWidget + public partial class CustomPropertiesWidget : VBox, IPListDisplayWidget { const string AddKeyNode = "Add new entry"; TreeStore treeStore = new TreeStore (typeof(string), typeof (PObject)); Gtk.ListStore keyStore = new ListStore (typeof (string), typeof (PListScheme.Key)); Gtk.ListStore valueStore = new ListStore (typeof (string), typeof (string)); - PopupTreeView treeview1; + PopupTreeView treeview; PListScheme scheme; HashSet<PObject> expandedObjects = new HashSet<PObject> (); bool showDescriptions = true; @@ -93,30 +94,16 @@ namespace MonoDevelop.MacDev.PlistEditor return new PString ("<error>"); } - class PopupTreeView : Gtk.TreeView + class PopupTreeView : MonoDevelop.Components.ContextMenuTreeView { CustomPropertiesWidget widget; public PopupTreeView (CustomPropertiesWidget widget) { this.widget = widget; + this.DoPopupMenu += ShowPopup; } - - protected override bool OnPopupMenu () - { - ShowPopup (); - return base.OnPopupMenu (); - } - - protected override bool OnButtonReleaseEvent (Gdk.EventButton evnt) - { - if (evnt.Button == 3) { - ShowPopup (); - } - return base.OnButtonReleaseEvent (evnt); - } - - void ShowPopup () + void ShowPopup (Gdk.EventButton evnt) { Gtk.TreeIter iter; bool hasSelection = Selection.GetSelected (out iter); @@ -179,8 +166,8 @@ namespace MonoDevelop.MacDev.PlistEditor }; menu.Append (showDescItem); } - IdeApp.CommandService.ShowContextMenu (menu, this); menu.ShowAll (); + IdeApp.CommandService.ShowContextMenu (this, evnt, menu, this); } @@ -248,10 +235,9 @@ namespace MonoDevelop.MacDev.PlistEditor public CustomPropertiesWidget (PListScheme scheme) { this.scheme = scheme = scheme ?? PListScheme.Empty; - this.Build (); - treeview1 = new PopupTreeView (this); - treeview1.HeadersClickable = true; - this.vbox1.PackStart (treeview1, true, true, 0); + treeview = new PopupTreeView (this); + treeview.HeadersClickable = true; + this.PackStart (treeview, true, true, 0); ShowAll (); var keyRenderer = new CellRendererCombo (); @@ -297,7 +283,7 @@ namespace MonoDevelop.MacDev.PlistEditor renderer.Sensitive = true; renderer.Text = key != null && ShowDescriptions ? GettextCatalog.GetString (key.Description) : id; }); - treeview1.AppendColumn (col); + treeview.AppendColumn (col); var iconSize = IconSize.Menu; col = new TreeViewColumn { MinWidth = 25, Resizable = true, Sizing = Gtk.TreeViewColumnSizing.Autosize }; @@ -305,7 +291,7 @@ namespace MonoDevelop.MacDev.PlistEditor var removeRenderer = new CellRendererButton (ImageService.GetPixbuf ("gtk-remove", IconSize.Menu)); removeRenderer.Clicked += delegate { TreeIter iter; - bool hasSelection = treeview1.Selection.GetSelected (out iter); + bool hasSelection = treeview.Selection.GetSelected (out iter); PObject obj = null; if (hasSelection) { obj = (PObject)treeStore.GetValue (iter, 1); @@ -314,13 +300,13 @@ namespace MonoDevelop.MacDev.PlistEditor }; col.PackEnd (removeRenderer, false); col.SetCellDataFunc (removeRenderer, delegate(TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) { - removeRenderer.Visible = treeview1.Selection.IterIsSelected (iter) && !AddKeyNode.Equals (treeStore.GetValue (iter, 0)); + removeRenderer.Visible = treeview.Selection.IterIsSelected (iter) && !AddKeyNode.Equals (treeStore.GetValue (iter, 0)); }); var addRenderer = new CellRendererButton (ImageService.GetPixbuf ("gtk-add", IconSize.Menu)); addRenderer.Clicked += delegate { Gtk.TreeIter iter = Gtk.TreeIter.Zero; - if (!treeview1.Selection.GetSelected (out iter)) + if (!treeview.Selection.GetSelected (out iter)) return; PObject obj = null; @@ -345,15 +331,15 @@ namespace MonoDevelop.MacDev.PlistEditor col.PackEnd (addRenderer, false); col.SetCellDataFunc (addRenderer, delegate(TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) { - addRenderer.Visible = treeview1.Selection.IterIsSelected (iter) && AddKeyNode.Equals (treeStore.GetValue (iter, 0)); + addRenderer.Visible = treeview.Selection.IterIsSelected (iter) && AddKeyNode.Equals (treeStore.GetValue (iter, 0)); }); - treeview1.AppendColumn (col); + treeview.AppendColumn (col); - treeview1.RowExpanded += delegate(object o, RowExpandedArgs args) { + treeview.RowExpanded += delegate(object o, RowExpandedArgs args) { var obj = (PObject)treeStore.GetValue (args.Iter, 1); expandedObjects.Add (obj); }; - treeview1.RowCollapsed += delegate(object o, RowCollapsedArgs args) { + treeview.RowCollapsed += delegate(object o, RowCollapsedArgs args) { var obj = (PObject)treeStore.GetValue (args.Iter, 1); expandedObjects.Remove (obj); }; @@ -381,7 +367,7 @@ namespace MonoDevelop.MacDev.PlistEditor oldObj.Replace (CreateNewObject (args.NewText)); }; - treeview1.AppendColumn (GettextCatalog.GetString ("Type"), comboRenderer, delegate(TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) { + treeview.AppendColumn (GettextCatalog.GetString ("Type"), comboRenderer, delegate(TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) { var renderer = (CellRendererCombo)cell; string id = (string)tree_model.GetValue (iter, 0) ?? ""; var key = scheme.GetKey (id); @@ -453,7 +439,7 @@ namespace MonoDevelop.MacDev.PlistEditor };*/ - treeview1.AppendColumn (GettextCatalog.GetString ("Value"), propRenderer, delegate(TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) { + treeview.AppendColumn (GettextCatalog.GetString ("Value"), propRenderer, delegate(TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) { var renderer = (CellRendererCombo)cell; var obj = (PObject)tree_model.GetValue (iter, 1); if (obj == null) { @@ -464,8 +450,8 @@ namespace MonoDevelop.MacDev.PlistEditor renderer.Editable = !(obj is PArray || obj is PDictionary || obj is PData); obj.RenderValue (this, renderer); }); - treeview1.EnableGridLines = TreeViewGridLines.Horizontal; - treeview1.Model = treeStore; + treeview.EnableGridLines = TreeViewGridLines.Horizontal; + treeview.Model = treeStore; } bool GetIsExpanded (Gtk.TreeIter iter, TreeStore treeStore) @@ -473,7 +459,7 @@ namespace MonoDevelop.MacDev.PlistEditor if (TreeIter.Zero.Equals (iter)) return false; var path = treeStore.GetPath (iter); - return path != null ? treeview1.GetRowExpanded (path) : false; + return path != null ? treeview.GetRowExpanded (path) : false; } Dictionary<PObject, Gtk.TreeIter> iterTable = new Dictionary<PObject, Gtk.TreeIter> (); @@ -498,7 +484,7 @@ namespace MonoDevelop.MacDev.PlistEditor if (item.Value is PDictionary) AddToTree (treeStore, subIter, (PDictionary)item.Value); if (expandedObjects.Contains (item.Value)) - treeview1.ExpandRow (treeStore.GetPath (subIter), true); + treeview.ExpandRow (treeStore.GetPath (subIter), true); } AddCreateNewEntry (iter); @@ -516,7 +502,7 @@ namespace MonoDevelop.MacDev.PlistEditor RemoveChildren (iter); AddToTree (treeStore, iter, dict); if (isExpanded) - treeview1.ExpandRow (treeStore.GetPath (iter), false); + treeview.ExpandRow (treeStore.GetPath (iter), false); } HashSet<PObject> rebuildArrays = new HashSet<PObject> (); @@ -536,7 +522,7 @@ namespace MonoDevelop.MacDev.PlistEditor if (item is PDictionary) AddToTree (treeStore, subIter, (PDictionary)item); if (expandedObjects.Contains (item)) - treeview1.ExpandRow (treeStore.GetPath (subIter), true); + treeview.ExpandRow (treeStore.GetPath (subIter), true); } AddCreateNewEntry (iter); @@ -555,7 +541,7 @@ namespace MonoDevelop.MacDev.PlistEditor RemoveChildren (iter); AddToTree (treeStore, iter, arr); if (isExpanded) - treeview1.ExpandRow (treeStore.GetPath (iter), false); + treeview.ExpandRow (treeStore.GetPath (iter), false); } void RemoveChildren (Gtk.TreeIter iter) diff --git a/main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.PlistEditor/PListEditorViewContent.cs b/main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.PlistEditor/PListEditorViewContent.cs index 1efd494e5a..7be1d08f93 100644 --- a/main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.PlistEditor/PListEditorViewContent.cs +++ b/main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.PlistEditor/PListEditorViewContent.cs @@ -41,15 +41,21 @@ namespace MonoDevelop.MacDev.PlistEditor { PObjectContainer pobject; IPListDisplayWidget widget; + Gtk.Widget control; - public override Gtk.Widget Control { get { return (Gtk.Widget)widget; } } + public override Gtk.Widget Control { get { return control; } } public PListEditorViewContent (IPlistEditingHandler handler, Project proj) { if (handler != null) { widget = new PListEditorWidget (handler, proj); + control = (Gtk.Widget) widget; } else { widget = new CustomPropertiesWidget (); + var csw = new MonoDevelop.Components.CompactScrolledWindow (); + csw.Show (); + csw.AddWithViewport ((Gtk.Widget)widget); + control = csw; } } diff --git a/main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.csproj b/main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.csproj index f976ef51cb..c5964f14ef 100644 --- a/main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.csproj +++ b/main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.csproj @@ -123,8 +123,6 @@ <Compile Include="XcodeSyncing\XcodeSyncContext.cs" /> <Compile Include="AppleSdkSettingsPanel.cs" /> <Compile Include="AppleSdkSettings.cs" /> - <Compile Include="gtk-gui\generated.cs" /> - <Compile Include="gtk-gui\MonoDevelop.MacDev.PlistEditor.CustomPropertiesWidget.cs" /> <Compile Include="MonoDevelop.MacDev.PlistEditor\PListEditorWidget.cs" /> <Compile Include="MonoDevelop.MacDev.PlistEditor\PListEditorDisplayBinding.cs" /> <Compile Include="MonoDevelop.MacDev.PlistEditor\PListEditorViewContent.cs" /> @@ -149,9 +147,6 @@ <EmbeddedResource Include="MonoDevelop.MacDev.addin.xml"> <LogicalName>MonoDevelop.MacDev.addin.xml</LogicalName> </EmbeddedResource> - <EmbeddedResource Include="gtk-gui\gui.stetic"> - <LogicalName>gui.stetic</LogicalName> - </EmbeddedResource> </ItemGroup> <ItemGroup> <None Include="icons\application-x-mono-develop-xib.svg" /> diff --git a/main/src/addins/MonoDevelop.MacDev/gtk-gui/MonoDevelop.MacDev.PlistEditor.CustomPropertiesWidget.cs b/main/src/addins/MonoDevelop.MacDev/gtk-gui/MonoDevelop.MacDev.PlistEditor.CustomPropertiesWidget.cs deleted file mode 100644 index 706bb9e7be..0000000000 --- a/main/src/addins/MonoDevelop.MacDev/gtk-gui/MonoDevelop.MacDev.PlistEditor.CustomPropertiesWidget.cs +++ /dev/null @@ -1,26 +0,0 @@ - -// This file has been generated by the GUI designer. Do not modify. -namespace MonoDevelop.MacDev.PlistEditor -{ - public partial class CustomPropertiesWidget - { - private global::Gtk.VBox vbox1; - - protected virtual void Build () - { - global::Stetic.Gui.Initialize (this); - // Widget MonoDevelop.MacDev.PlistEditor.CustomPropertiesWidget - global::Stetic.BinContainer.Attach (this); - this.Name = "MonoDevelop.MacDev.PlistEditor.CustomPropertiesWidget"; - // Container child MonoDevelop.MacDev.PlistEditor.CustomPropertiesWidget.Gtk.Container+ContainerChild - this.vbox1 = new global::Gtk.VBox (); - this.vbox1.Name = "vbox1"; - this.vbox1.Spacing = 6; - this.Add (this.vbox1); - if ((this.Child != null)) { - this.Child.ShowAll (); - } - this.Hide (); - } - } -} diff --git a/main/src/addins/MonoDevelop.MacDev/gtk-gui/generated.cs b/main/src/addins/MonoDevelop.MacDev/gtk-gui/generated.cs deleted file mode 100644 index 8d3a3ae5d9..0000000000 --- a/main/src/addins/MonoDevelop.MacDev/gtk-gui/generated.cs +++ /dev/null @@ -1,81 +0,0 @@ - -// This file has been generated by the GUI designer. Do not modify. -namespace Stetic -{ - internal class Gui - { - private static bool initialized; - - internal static void Initialize (Gtk.Widget iconRenderer) - { - if ((Stetic.Gui.initialized == false)) { - Stetic.Gui.initialized = true; - } - } - } - - internal class BinContainer - { - private Gtk.Widget child; - private Gtk.UIManager uimanager; - - public static BinContainer Attach (Gtk.Bin bin) - { - BinContainer bc = new BinContainer (); - bin.SizeRequested += new Gtk.SizeRequestedHandler (bc.OnSizeRequested); - bin.SizeAllocated += new Gtk.SizeAllocatedHandler (bc.OnSizeAllocated); - bin.Added += new Gtk.AddedHandler (bc.OnAdded); - return bc; - } - - private void OnSizeRequested (object sender, Gtk.SizeRequestedArgs args) - { - if ((this.child != null)) { - args.Requisition = this.child.SizeRequest (); - } - } - - private void OnSizeAllocated (object sender, Gtk.SizeAllocatedArgs args) - { - if ((this.child != null)) { - this.child.Allocation = args.Allocation; - } - } - - private void OnAdded (object sender, Gtk.AddedArgs args) - { - this.child = args.Widget; - } - - public void SetUiManager (Gtk.UIManager uim) - { - this.uimanager = uim; - this.child.Realized += new System.EventHandler (this.OnRealized); - } - - private void OnRealized (object sender, System.EventArgs args) - { - if ((this.uimanager != null)) { - Gtk.Widget w; - w = this.child.Toplevel; - if (((w != null) && typeof(Gtk.Window).IsInstanceOfType (w))) { - ((Gtk.Window)(w)).AddAccelGroup (this.uimanager.AccelGroup); - this.uimanager = null; - } - } - } - } - - internal class ActionGroups - { - public static Gtk.ActionGroup GetActionGroup (System.Type type) - { - return Stetic.ActionGroups.GetActionGroup (type.FullName); - } - - public static Gtk.ActionGroup GetActionGroup (string name) - { - return null; - } - } -} diff --git a/main/src/addins/MonoDevelop.MacDev/gtk-gui/gui.stetic b/main/src/addins/MonoDevelop.MacDev/gtk-gui/gui.stetic deleted file mode 100644 index a009c73ea1..0000000000 --- a/main/src/addins/MonoDevelop.MacDev/gtk-gui/gui.stetic +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<stetic-interface> - <configuration> - <images-root-path>..</images-root-path> - <target-gtk-version>2.12</target-gtk-version> - </configuration> - <import> - <widget-library name="../../../../build/AddIns/MacPlatform.dll" /> - <widget-library name="../../../../build/bin/MonoDevelop.Ide.dll" /> - <widget-library name="../../../../build/AddIns/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.dll" /> - <widget-library name="../../../../build/bin/Mono.TextEditor.dll" /> - <widget-library name="../../../../build/AddIns/MonoDevelop.MacDev/MonoDevelop.MacDev.dll" internal="true" /> - </import> - <widget class="Gtk.Bin" id="MonoDevelop.MacDev.PlistEditor.CustomPropertiesWidget" design-size="503 416"> - <property name="MemberName" /> - <property name="Visible">False</property> - <child> - <widget class="Gtk.VBox" id="vbox1"> - <property name="MemberName" /> - <property name="Spacing">6</property> - <child> - <placeholder /> - </child> - </widget> - </child> - </widget> -</stetic-interface>
\ No newline at end of file diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.ContextAction/ContextActionWidget.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.ContextAction/ContextActionWidget.cs index 9b1a0dc8ea..9927237a1b 100644 --- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.ContextAction/ContextActionWidget.cs +++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.ContextAction/ContextActionWidget.cs @@ -67,9 +67,14 @@ namespace MonoDevelop.ContextAction document.Editor.Parent.EditorOptionsChanged -= HandleDocumentEditorParentEditorOptionsChanged; base.OnDestroyed (); } - + public void PopupQuickFixMenu () { + PopupQuickFixMenu (null); + } + + void PopupQuickFixMenu (Gdk.EventButton evt) + { Gtk.Menu menu = new Gtk.Menu (); Dictionary<Gtk.MenuItem, ContextAction> fixTable = new Dictionary<Gtk.MenuItem, ContextAction> (); @@ -93,29 +98,19 @@ namespace MonoDevelop.ContextAction menu.Add (menuItem); } menu.ShowAll (); - int dx, dy; - this.ParentWindow.GetOrigin (out dx, out dy); - dx += ((TextEditorContainer.EditorContainerChild)(this.document.Editor.Parent.Parent as TextEditorContainer) [this]).X; - dy += ((TextEditorContainer.EditorContainerChild)(this.document.Editor.Parent.Parent as TextEditorContainer) [this]).Y - (int)document.Editor.VAdjustment.Value; - - menu.Popup (null, null, delegate (Gtk.Menu menu2, out int x, out int y, out bool pushIn) { - x = dx; - y = dy + Allocation.Height; - pushIn = false; - menuPushed = true; - QueueDraw (); - }, 0, Gtk.Global.CurrentEventTime); menu.SelectFirst (true); + menuPushed = true; menu.Destroyed += delegate { menuPushed = false; QueueDraw (); }; + GtkWorkarounds.ShowContextMenu (menu, this, evt, Allocation); } protected override bool OnButtonPressEvent (Gdk.EventButton evnt) { - if (evnt.Button == 1) - PopupQuickFixMenu (); + if (!evnt.TriggersContextMenu () && evnt.Button == 1) + PopupQuickFixMenu (evnt); return base.OnButtonPressEvent (evnt); } diff --git a/main/src/addins/MonoDevelop.SourceEditor2/Makefile.am b/main/src/addins/MonoDevelop.SourceEditor2/Makefile.am index 650945aeca..e581850162 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/Makefile.am +++ b/main/src/addins/MonoDevelop.SourceEditor2/Makefile.am @@ -49,7 +49,6 @@ FILES = \ MonoDevelop.SourceEditor/SourceEditorPrintOperation.cs \ MonoDevelop.SourceEditor/SourceEditorView.cs \ MonoDevelop.SourceEditor/SourceEditorWidget.cs \ - MonoDevelop.SourceEditor/StatusBox.cs \ MonoDevelop.SourceEditor/StyledSourceEditorOptions.cs \ MonoDevelop.SourceEditor/SyntaxModeCodon.cs \ MonoDevelop.SourceEditor/SyntaxModeService.cs diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.addin.xml b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.addin.xml index 5cf8f3d06f..929df6c653 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.addin.xml +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.addin.xml @@ -115,12 +115,7 @@ _description = "Activates code focus on caret move" shortcut = "Ctrl|Shift|k" macShortcut = "Meta|Shift|k" /> - - <Command id = "MonoDevelop.SourceEditor.NavigationBarCommands.ToggleNavPanelViews" - defaultHandler = "MonoDevelop.SourceEditor.ToggleNavPanelViewsHandler" - _label = "" - type="array"/> - + <Command id = "MonoDevelop.SourceEditor.MessageBubbleCommands.HideIssues" defaultHandler = "MonoDevelop.SourceEditor.HideIssuesHandler" _label = "_Hide Issues"/> @@ -188,7 +183,6 @@ <CommandItem id = "MonoDevelop.SourceEditor.NavigationBarCommands.ToggleNavPanelViews" /> </Extension> - <Extension path = "/MonoDevelop/SourceEditor2/IconContextMenu/Editor"> <CommandItem id = "MonoDevelop.Ide.Commands.SearchCommands.ToggleBookmark" /> <CommandItem id = "MonoDevelop.Ide.Commands.SearchCommands.ClearBookmarks" /> diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj index 85d3e58248..147143cd6c 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj @@ -152,7 +152,6 @@ <Compile Include="MonoDevelop.SourceEditor\SourceEditorPrintOperation.cs" /> <Compile Include="MonoDevelop.SourceEditor\PrintSettingsWidget.cs" /> <Compile Include="gtk-gui\MonoDevelop.SourceEditor.PrintSettingsWidget.cs" /> - <Compile Include="MonoDevelop.SourceEditor\StatusBox.cs" /> <Compile Include="MonoDevelop.SourceEditor\MessageBubbleCommands.cs" /> <Compile Include="MonoDevelop.SourceEditor\MessageBubbleTextMarker.cs" /> <Compile Include="MonoDevelop.SourceEditor\MessageBubbleHighlightPopupWindow.cs" /> diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs index 792bb6b1e9..3e160d7c60 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs @@ -55,8 +55,6 @@ namespace MonoDevelop.SourceEditor SourceEditorView view; ExtensionContext extensionContext; - Cairo.Point menuPopupLocation; - public ITextEditorExtension Extension { get; set; @@ -108,8 +106,7 @@ namespace MonoDevelop.SourceEditor UpdateEditMode (); this.GetTextEditorData ().Paste += HandleTextPaste; - - this.ButtonPressEvent += OnPopupMenu; + this.DoPopupMenu = ShowPopup; } void HandleSkipCharsOnReplace (object sender, ReplaceEventArgs args) @@ -179,7 +176,6 @@ namespace MonoDevelop.SourceEditor { ExtensionContext = null; view = null; - this.ButtonPressEvent -= OnPopupMenu; base.OnDestroyed (); } @@ -199,22 +195,6 @@ namespace MonoDevelop.SourceEditor TooltipProviders.Remove (provider); } } - - void OnPopupMenu (object sender, Gtk.ButtonPressEventArgs args) - { - if (args.Event.Button == 3) { - int textEditorXOffset = (int)args.Event.X - (int)this.TextViewMargin.XOffset; - if (textEditorXOffset < 0) - return; - this.menuPopupLocation = new Cairo.Point ((int)args.Event.X, (int)args.Event.Y); - DocumentLocation loc= PointToLocation (textEditorXOffset, (int)args.Event.Y); - if (!this.IsSomethingSelected || !this.SelectionRange.Contains (Document.LocationToOffset (loc))) - Caret.Location = loc; - - this.ShowPopup (); - base.ResetMouseState (); - } - } public void FireOptionsChange () { @@ -230,19 +210,12 @@ namespace MonoDevelop.SourceEditor UpdateEditMode (); base.OptionsChanged (sender, args); } + bool isInKeyStroke = false; protected override bool OnKeyPressEvent (Gdk.EventKey evnt) { isInKeyStroke = true; try { - // Handle keyboard menu popup - if (evnt.Key == Gdk.Key.Menu || (evnt.Key == Gdk.Key.F10 && (evnt.State & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask)) { - this.menuPopupLocation = LocationToPoint (this.Caret.Location); - this.menuPopupLocation.Y += (int)LineHeight; - this.ShowPopup (); - return true; - } - // Handle keyboard toolip popup /* if ((evnt.Key == Gdk.Key.F1 && (evnt.State & Gdk.ModifierType.ControlMask) == Gdk.ModifierType.ControlMask)) { Gdk.Point p = this.TextViewMargin.LocationToDisplayCoordinates (this.Caret.Location); @@ -588,34 +561,30 @@ namespace MonoDevelop.SourceEditor return base.OnFocusOutEvent (evnt); } - void ShowPopup () + void ShowPopup (Gdk.EventButton evt) { HideTooltip (); - CommandEntrySet cset = IdeApp.CommandService.CreateCommandEntrySet (ExtensionContext ?? AddinManager.AddinEngine, "/MonoDevelop/SourceEditor2/ContextMenu/Editor"); + const string menuPath = "/MonoDevelop/SourceEditor2/ContextMenu/Editor"; + var ctx = ExtensionContext ?? AddinManager.AddinEngine; + CommandEntrySet cset = IdeApp.CommandService.CreateCommandEntrySet (ctx, menuPath); Gtk.Menu menu = IdeApp.CommandService.CreateMenu (cset); - menu.Append (new SeparatorMenuItem ()); + var imMenu = CreateInputMethodMenuItem (GettextCatalog.GetString ("_Input Methods")); if (imMenu != null) { + menu.Append (new SeparatorMenuItem ()); menu.Append (imMenu); } + menu.Destroyed += delegate { this.QueueDraw (); }; - menu.Popup (null, null, new Gtk.MenuPositionFunc (PositionPopupMenu), 0, Gtk.Global.CurrentEventTime); - } - - void PositionPopupMenu (Menu menu, out int x, out int y, out bool pushIn) - { - this.GdkWindow.GetOrigin (out x, out y); - x += this.menuPopupLocation.X; - y += this.menuPopupLocation.Y; - Requisition request = menu.SizeRequest (); - Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry (Screen, Screen.GetMonitorAtPoint (x, y)); - - y = Math.Max (geometry.Top, Math.Min (y, geometry.Bottom - request.Height)); - x = Math.Max (geometry.Left, Math.Min (x, geometry.Right - request.Width)); - pushIn = true; + if (evt != null) { + GtkWorkarounds.ShowContextMenu (menu, this, evt); + } else { + var pt = LocationToPoint (this.Caret.Location); + GtkWorkarounds.ShowContextMenu (menu, this, new Gdk.Rectangle (pt.X, pt.Y, 1, (int)LineHeight)); + } } #region Templates diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleHighlightPopupWindow.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleHighlightPopupWindow.cs index 48bb35ccd6..449b8df33c 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleHighlightPopupWindow.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleHighlightPopupWindow.cs @@ -51,12 +51,12 @@ namespace MonoDevelop.SourceEditor protected override Gdk.Rectangle CalculateInitialBounds () { - int spaceX = marker.ErrorTextBounds.Width / 2; - - return new Gdk.Rectangle (marker.ErrorTextBounds.X - spaceX, - (int)(marker.ErrorTextBounds.Y - Editor.LineHeight), - marker.ErrorTextBounds.Width + spaceX * 2, - (int)(marker.ErrorTextBounds.Height + Editor.LineHeight * 2)); + var bounds = marker.ErrorTextBounds; + int spaceX = bounds.Width / 2; + return new Gdk.Rectangle (bounds.X - spaceX, + (int)(bounds.Y - Editor.LineHeight), + bounds.Width + spaceX * 2, + (int)(bounds.Height + Editor.LineHeight * 2)); } protected override void OnAnimationCompleted () @@ -72,22 +72,23 @@ namespace MonoDevelop.SourceEditor cr.Paint (); } + var bounds = marker.ErrorTextBounds; using (var cr = Gdk.CairoHelper.Create (evnt.Window)) { cr.Translate (width / 2, height / 2); cr.Scale (1 + scale / 8, 1 + scale / 8); - int x = -(marker.ErrorTextBounds.Width) / 2; - int y = -marker.ErrorTextBounds.Height / 2; + int x = -(bounds.Width) / 2; + int y = -bounds.Height / 2; if (marker.FitsInSameLine) { cr.MoveTo (x + Editor.LineHeight / 2, y); cr.LineTo (x, 0); - cr.LineTo (x + Editor.LineHeight / 2, marker.ErrorTextBounds.Height / 2); + cr.LineTo (x + Editor.LineHeight / 2, bounds.Height / 2); } else { - cr.MoveTo (x, -marker.ErrorTextBounds.Height / 2); - cr.LineTo (x, marker.ErrorTextBounds.Height / 2); + cr.MoveTo (x, -bounds.Height / 2); + cr.LineTo (x, bounds.Height / 2); } - cr.LineTo (x + marker.ErrorTextBounds.Width, marker.ErrorTextBounds.Height / 2); - cr.LineTo (x + marker.ErrorTextBounds.Width, y); + cr.LineTo (x + bounds.Width, bounds.Height / 2); + cr.LineTo (x + bounds.Width, y); cr.ClosePath (); Mono.TextEditor.HslColor hsl = marker.colorMatrix [0, 0, 0, 0, 0]; @@ -110,7 +111,7 @@ namespace MonoDevelop.SourceEditor int ew, eh; marker.errorCountLayout.GetPixelSize (out ew, out eh); errorCounterWidth = ew + 10; - int rX = x + marker.ErrorTextBounds.Width - errorCounterWidth; + int rX = x + bounds.Width - errorCounterWidth; int rW = errorCounterWidth - 2; double rH = Editor.LineHeight * 3 / 4; @@ -134,7 +135,7 @@ namespace MonoDevelop.SourceEditor marker.Layouts [0].Layout.GetPixelSize (out layoutWidth, out layoutHeight); double ly; if (marker.CollapseExtendedErrors || marker.Errors.Count == 1) { - ly = 1 + y + (marker.ErrorTextBounds.Height - layoutHeight) / 2; + ly = 1 + y + (bounds.Height - layoutHeight) / 2; double x2 = x + MessageBubbleTextMarker.border; if (marker.FitsInSameLine) x2 += 1 + Editor.LineHeight / 2; @@ -148,7 +149,7 @@ namespace MonoDevelop.SourceEditor cr.Save (); double x2; if (i == 0) { - x2 = x + marker.ErrorTextBounds.Width - layoutWidth - errorCounterWidth; + x2 = x + bounds.Width - layoutWidth - errorCounterWidth; } else { x2 = x + MessageBubbleTextMarker.border; } diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleTextMarker.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleTextMarker.cs index 37a39a19a8..83537b5d1e 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleTextMarker.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleTextMarker.cs @@ -75,7 +75,7 @@ namespace MonoDevelop.SourceEditor set { task.Completed = !value; } } - bool collapseExtendedErrors; + bool collapseExtendedErrors = true; public bool CollapseExtendedErrors { get { return collapseExtendedErrors; } set { @@ -86,10 +86,11 @@ namespace MonoDevelop.SourceEditor if (collapseExtendedErrors) { editor.Document.UnRegisterVirtualTextMarker (this); } else { - for (int i = 1; i < errors.Count; i++) - editor.Document.RegisterVirtualTextMarker (lineNumber + i, this); + var fitting = IsCurrentErrorTextFitting (); + for (int i = fitting ? 1 : 0; i < errors.Count; i++) + editor.Document.RegisterVirtualTextMarker (lineNumber + i + (fitting ? 0 : 1), this); } - editor.Document.CommitMultipleLineUpdate (lineNumber, lineNumber + errors.Count); + editor.Document.CommitMultipleLineUpdate (lineNumber, lineNumber + errors.Count + 1); } } @@ -107,6 +108,8 @@ namespace MonoDevelop.SourceEditor public double GetLineHeight (TextEditor editor) { + return editor.LineHeight; + /* if (!IsVisible || DebuggingService.IsDebugging) return editor.LineHeight; @@ -129,7 +132,7 @@ namespace MonoDevelop.SourceEditor lastLineLength = lineSegment.EditableLength; lastHeight = height; - return height; + return height;*/ } public void SetPrimaryError (string text) @@ -156,17 +159,17 @@ namespace MonoDevelop.SourceEditor layouts.Insert (0, tmplayout); } - void CalculateLineFit (TextEditor editor, LineSegment lineSegment) - { - double textWidth; - if (!cache.lineWidthDictionary.TryGetValue (lineSegment, out textWidth)) { - var textLayout = editor.TextViewMargin.GetLayout (lineSegment); - textWidth = textLayout.PangoWidth / Pango.Scale.PangoScale; - cache.lineWidthDictionary[lineSegment] = textWidth; - } - EnsureLayoutCreated (editor); - fitsInSameLine = editor.TextViewMargin.XOffset + textWidth + LayoutWidth + cache.errorPixbuf.Width + border + editor.LineHeight / 2 < editor.Allocation.Width; - } +// void CalculateLineFit (TextEditor editor, LineSegment lineSegment) +// { +// double textWidth; +// if (!cache.lineWidthDictionary.TryGetValue (lineSegment, out textWidth)) { +// var textLayout = editor.TextViewMargin.GetLayout (lineSegment); +// textWidth = textLayout.PangoWidth / Pango.Scale.PangoScale; +// cache.lineWidthDictionary[lineSegment] = textWidth; +// } +// EnsureLayoutCreated (editor); +// fitsInSameLine = editor.TextViewMargin.XOffset + textWidth + LayoutWidth + cache.errorPixbuf.Width + border + editor.LineHeight / 2 < editor.Allocation.Width; +// } string initialText; internal MessageBubbleTextMarker (MessageBubbleCache cache, Task task, LineSegment lineSegment, bool isError, string errorMessage) @@ -178,7 +181,7 @@ namespace MonoDevelop.SourceEditor this.initialText = editor.Document.GetTextAt (lineSegment); this.Flags = TextMarkerFlags.DrawsSelection; AddError (isError, errorMessage); - cache.Changed += (sender, e) => CalculateLineFit (editor, lineSegment); +// cache.Changed += (sender, e) => CalculateLineFit (editor, lineSegment); } static System.Text.RegularExpressions.Regex mcsErrorFormat = new System.Text.RegularExpressions.Regex ("(.+)\\(CS\\d+\\)\\Z"); @@ -188,7 +191,7 @@ namespace MonoDevelop.SourceEditor if (match.Success) errorMessage = match.Groups [1].Value; errors.Add (new ErrorText (isError, errorMessage)); - CollapseExtendedErrors = errors.Count > 1; + CollapseExtendedErrors = true; DisposeLayout (); } @@ -236,7 +239,6 @@ namespace MonoDevelop.SourceEditor layouts = new List<MessageBubbleCache.LayoutDescriptor> (); foreach (ErrorText errorText in errors) { - layouts.Add (cache.CreateLayoutDescriptor (errorText)); } @@ -260,7 +262,68 @@ namespace MonoDevelop.SourceEditor return 0; if (!CollapseExtendedErrors && errors.Count > 1) return layouts.Max (l => l.Width); - return layouts[0].Width; + return layouts [0].Width; + } + } + + Tuple<int, int> GetErrorCountBounds (TextViewMargin.LayoutWrapper wrapper = null) + { + EnsureLayoutCreated (editor); + var layout = wrapper ?? editor.TextViewMargin.GetLayout (lineSegment); + try { + var lineTextPx = editor.TextViewMargin.XOffset + editor.TextViewMargin.TextStartPosition + layout.PangoWidth / Pango.Scale.PangoScale; + if (errors.Count > 1 && errorCountLayout != null || editor.Allocation.Width < lineTextPx + layouts [0].Width) { + int ew = 0, eh = 0; + if (errorCountLayout != null) { + errorCountLayout.GetPixelSize (out ew, out eh); + } else { + ew = 10; + } + return Tuple.Create (ew + 10, eh); + } + return Tuple.Create (0, 0); + } finally { + if (wrapper == null && layout.IsUncached) + layout.Dispose (); + } + } + + void DrawMessageExtendIcon (Mono.TextEditor.TextEditor editor, Cairo.Context g, double y, int errorCounterWidth, int eh) + { + EnsureLayoutCreated (editor); + double rW = errorCounterWidth - 2; + double rH = editor.LineHeight * 3 / 4; + + double rX = editor.Allocation.Width - rW - 2; + double rY = y + (editor.LineHeight - rH) / 2; + BookmarkMarker.DrawRoundRectangle (g, rX, rY, 8, rW, rH); + + g.Color = oldIsOver ? new Cairo.Color (0.3, 0.3, 0.3) : new Cairo.Color (0.5, 0.5, 0.5); + g.Fill (); + if (CollapseExtendedErrors) { + if (errorCountLayout != null) { + g.Color = cache.gcLight; + g.Save (); + g.Translate (rX + rW / 4, rY + (rH - eh) / 2); + g.ShowLayout (errorCountLayout); + g.Restore (); + } else { + g.MoveTo (rX + rW / 2 - rW / 4, rY + rH / 4); + g.LineTo (rX + rW / 2 + rW / 4, rY + rH / 4); + g.LineTo (rX + rW / 2, rY + rH - rH / 4); + g.ClosePath (); + + g.Color = new Cairo.Color (1, 1, 1); + g.Fill (); + } + } else { + g.MoveTo (rX + rW / 2 - rW / 4, rY + rH - rH / 4); + g.LineTo (rX + rW / 2 + rW / 4, rY + rH - rH / 4); + g.LineTo (rX + rW / 2, rY + rH / 4); + g.ClosePath (); + + g.Color = new Cairo.Color (1, 1, 1); + g.Fill (); } } @@ -271,15 +334,12 @@ namespace MonoDevelop.SourceEditor EnsureLayoutCreated (editor); double x = editor.TextViewMargin.XOffset; int right = editor.Allocation.Width; - int errorCounterWidth = 0; bool isCaretInLine = startOffset <= editor.Caret.Offset && editor.Caret.Offset <= endOffset; - int ew = 0, eh = 0; - if (errors.Count > 1 && errorCountLayout != null) { - errorCountLayout.GetPixelSize (out ew, out eh); - errorCounterWidth = ew + 10; - } - + var lineTextPx = editor.TextViewMargin.XOffset + editor.TextViewMargin.TextStartPosition + layout2.PangoWidth / Pango.Scale.PangoScale; + int errorCounterWidth = GetErrorCountBounds (layout2).Item1; +// int eh = GetErrorCountBounds ().Item2; double x2 = System.Math.Max (right - LayoutWidth - border - (ShowIconsInBubble ? cache.errorPixbuf.Width : 0) - errorCounterWidth, fitsInSameLine ? editor.TextViewMargin.XOffset + editor.LineHeight / 2 : editor.TextViewMargin.XOffset); + bool isEolSelected = editor.IsSomethingSelected && editor.SelectionMode != SelectionMode.Block ? editor.SelectionRange.Contains (lineSegment.Offset + lineSegment.EditableLength) : false; int active = editor.Document.GetTextAt (lineSegment) == initialText ? 0 : 1; @@ -322,7 +382,7 @@ namespace MonoDevelop.SourceEditor g.Color = colorMatrix [active, BOTTOM, LINE, highlighted, selected]; g.Stroke (); } - + // draw background if (layout2.StartSet || selectionStart == endOffset) { double startX; @@ -386,10 +446,12 @@ namespace MonoDevelop.SourceEditor y += editor.LineHeight; double y2 = y + 0.5; double y2Bottom = y2 + editor.LineHeight - 1; - selected = isEolSelected && (CollapseExtendedErrors || errors.Count == 1) ? 1 : 0; - + selected = isEolSelected && (CollapseExtendedErrors) ? 1 : 0; + if (x2 < lineTextPx) + x2 = lineTextPx; + // draw message text background - if (CollapseExtendedErrors || errors.Count == 1) { + if (CollapseExtendedErrors) { if (!fitsInSameLine) { // draw box below line g.MoveTo (new Cairo.PointD (x2 + 0.5, y2 - 1)); @@ -407,24 +469,26 @@ namespace MonoDevelop.SourceEditor g.Stroke (); } else { // draw 'arrow marker' in the same line - g.MoveTo (new Cairo.PointD (x2 + 0.5, y2)); - double mid = y2 + topSize; - g.LineTo (new Cairo.PointD (x2 - editor.LineHeight / 2 + 0.5, mid)); - - g.LineTo (new Cairo.PointD (right, mid)); - g.LineTo (new Cairo.PointD (right, y2)); - g.ClosePath (); - g.Color = colorMatrix [active, TOP, DARK, highlighted, selected]; - g.Fill (); - g.MoveTo (new Cairo.PointD (x2 + 0.5, y2Bottom)); - g.LineTo (new Cairo.PointD (x2 - editor.LineHeight / 2 + 0.5, mid)); - - g.LineTo (new Cairo.PointD (right, mid)); - g.LineTo (new Cairo.PointD (right, y2Bottom)); - g.ClosePath (); - - g.Color = colorMatrix [active, BOTTOM, DARK, highlighted, selected]; - g.Fill (); + if (errors.Count > 1) { + g.MoveTo (new Cairo.PointD (x2 + 0.5, y2)); + double mid = y2 + topSize; + g.LineTo (new Cairo.PointD (x2 - editor.LineHeight / 2 + 0.5, mid)); + + g.LineTo (new Cairo.PointD (right, mid)); + g.LineTo (new Cairo.PointD (right, y2)); + g.ClosePath (); + g.Color = colorMatrix [active, TOP, DARK, highlighted, selected]; + g.Fill (); + g.MoveTo (new Cairo.PointD (x2 + 0.5, y2Bottom)); + g.LineTo (new Cairo.PointD (x2 - editor.LineHeight / 2 + 0.5, mid)); + + g.LineTo (new Cairo.PointD (right, mid)); + g.LineTo (new Cairo.PointD (right, y2Bottom)); + g.ClosePath (); + + g.Color = colorMatrix [active, BOTTOM, DARK, highlighted, selected]; + g.Fill (); + } // draw border g.MoveTo (new Cairo.PointD (x2 + 0.5, y2)); @@ -448,12 +512,14 @@ namespace MonoDevelop.SourceEditor g.ClosePath (); } else { // draw filled arrow box - g.MoveTo (new Cairo.PointD (x2 + 0.5, y2)); - g.LineTo (new Cairo.PointD (x2 - editor.LineHeight / 2 + 0.5, y2 + editor.LineHeight / 2)); - g.LineTo (new Cairo.PointD (x2 + 0.5, y2Bottom)); - g.LineTo (new Cairo.PointD (right, y2Bottom)); - g.LineTo (new Cairo.PointD (right, y2)); - g.ClosePath (); + if (!(errors.Count == 1 && !CollapseExtendedErrors)) { + g.MoveTo (new Cairo.PointD (x2 + 0.5, y2)); + g.LineTo (new Cairo.PointD (x2 - editor.LineHeight / 2 + 0.5, y2 + editor.LineHeight / 2)); + g.LineTo (new Cairo.PointD (x2 + 0.5, y2Bottom)); + g.LineTo (new Cairo.PointD (right, y2Bottom)); + g.LineTo (new Cairo.PointD (right, y2)); + g.ClosePath (); + } } g.Color = colorMatrix [active, BOTTOM, LIGHT, highlighted, selected]; g.Fill (); @@ -494,39 +560,24 @@ namespace MonoDevelop.SourceEditor g.Stroke (); } } - - if (errors.Count > 1 && errorCountLayout != null) { - double rX = x2 + (ShowIconsInBubble ? cache.errorPixbuf.Width : 0) + border + LayoutWidth; - double rY = y + editor.LineHeight / 6; - double rW = errorCounterWidth - 2; - double rH = editor.LineHeight * 3 / 4; - BookmarkMarker.DrawRoundRectangle (g, rX, rY, 8, rW, rH); - - g.Color = oldIsOver ? new Cairo.Color (0.3, 0.3, 0.3) : new Cairo.Color (0.5, 0.5, 0.5); - g.Fill (); - if (CollapseExtendedErrors) { - g.Color = cache.gcLight; - g.Save (); - g.Translate (x2 + (ShowIconsInBubble ? cache.errorPixbuf.Width : 0) + border + LayoutWidth + 4, y + (editor.LineHeight - eh) / 2 + eh % 2); - g.ShowLayout (errorCountLayout); - g.Restore (); - } else { - g.MoveTo (rX + rW / 2 - rW / 4, rY + rH - rH / 4); - g.LineTo (rX + rW / 2 + rW / 4, rY + rH - rH / 4); - g.LineTo (rX + rW / 2, rY + rH / 4); - g.ClosePath (); - - g.Color = new Cairo.Color (1, 1, 1); - g.Fill (); - } - } + for (int i = 0; i < layouts.Count; i++) { + if (!IsCurrentErrorTextFitting (layout2) && !CollapseExtendedErrors) + break; + var layout = layouts [i]; x2 = right - layout.Width - border - (ShowIconsInBubble ? cache.errorPixbuf.Width : 0); - if (i == 0) + if (i == 0) { x2 -= errorCounterWidth; - x2 = System.Math.Max (x2, fitsInSameLine ? editor.TextViewMargin.XOffset + editor.LineHeight / 2 : editor.TextViewMargin.XOffset); + if (x2 < lineTextPx) { + // if (CollapseExtendedErrors) { + x2 = lineTextPx; + // } + } + } +// x2 = System.Math.Max (x2, fitsInSameLine ? editor.TextViewMargin.XOffset + editor.LineHeight / 2 : editor.TextViewMargin.XOffset); + if (i > 0) { editor.TextViewMargin.DrawRectangleWithRuler (g, x, new Cairo.Rectangle (x, y, right, editor.LineHeight), isEolSelected ? editor.ColorStyle.Selection.CairoBackgroundColor : editor.ColorStyle.Default.CairoBackgroundColor, true); g.MoveTo (new Cairo.PointD (x2 + 0.5, y)); @@ -542,7 +593,7 @@ namespace MonoDevelop.SourceEditor g.Pattern = pat; } } else { - g.Color = colorMatrix[active, TOP, LIGHT, highlighted, selected]; + g.Color = colorMatrix [active, TOP, LIGHT, highlighted, selected]; } g.Fill (); if (editor.Options.ShowRuler) { @@ -550,7 +601,7 @@ namespace MonoDevelop.SourceEditor if (divider >= x2) { g.MoveTo (new Cairo.PointD (divider + 0.5, y)); g.LineTo (new Cairo.PointD (divider + 0.5, y + editor.LineHeight)); - g.Color = colorMatrix[active, BOTTOM, DARK, highlighted, selected]; + g.Color = colorMatrix [active, BOTTOM, DARK, highlighted, selected]; g.Stroke (); } } @@ -622,17 +673,16 @@ namespace MonoDevelop.SourceEditor double height = editor.LineHeight * errors.Count; if (!fitsInSameLine) y += editor.LineHeight; - int errorCounterWidth = 0; - - int ew = 0, eh = 0; - if (errors.Count > 1 && errorCountLayout != null) { - errorCountLayout.GetPixelSize (out ew, out eh); - errorCounterWidth = ew + 10; - } + int errorCounterWidth = GetErrorCountBounds ().Item1; double labelWidth = LayoutWidth + border + (ShowIconsInBubble ? cache.errorPixbuf.Width : 0) + errorCounterWidth; if (fitsInSameLine) labelWidth += editor.LineHeight / 2; + + var layout = editor.TextViewMargin.GetLayout (lineSegment); + var lineTextPx = editor.TextViewMargin.XOffset + editor.TextViewMargin.TextStartPosition + layout.PangoWidth / Pango.Scale.PangoScale; + labelWidth = Math.Min (editor.Allocation.Width - lineTextPx - editor.TextViewMargin.TextStartPosition, labelWidth); + return new Gdk.Rectangle ((int)(editor.Allocation.Width - labelWidth), (int)y, (int)labelWidth, (int)height); } } @@ -651,7 +701,6 @@ namespace MonoDevelop.SourceEditor bool MouseIsOverMarker (TextEditor editor, MarginMouseEventArgs args) { - int ew = 0, eh = 0; int lineNumber = editor.Document.OffsetToLineNumber (lineSegment.Offset); double y = editor.LineToY (lineNumber) - editor.VAdjustment.Value; if (fitsInSameLine) { @@ -662,14 +711,26 @@ namespace MonoDevelop.SourceEditor return false; } - if (errors.Count > 1 && errorCountLayout != null) { - errorCountLayout.GetPixelSize (out ew, out eh); - int errorCounterWidth = ew + 10; - if (editor.Allocation.Width - args.X - editor.TextViewMargin.XOffset <= errorCounterWidth) - return true; - } + int errorCounterWidth = GetErrorCountBounds ().Item1; + if (errorCounterWidth > 0) + return editor.Allocation.Width - editor.TextViewMargin.XOffset - 2 - errorCounterWidth <= args.X; return false; } + + bool IsCurrentErrorTextFitting (TextViewMargin.LayoutWrapper wrapper = null) + { + int errorCounterWidth = GetErrorCountBounds (wrapper).Item1; + double labelWidth = LayoutWidth + border + (ShowIconsInBubble ? cache.errorPixbuf.Width : 0) + errorCounterWidth + editor.LineHeight / 2; + + var layout = wrapper ?? editor.TextViewMargin.GetLayout (lineSegment); + + var lineTextPx = editor.TextViewMargin.XOffset + editor.TextViewMargin.TextStartPosition + layout.PangoWidth / Pango.Scale.PangoScale; + + if (wrapper == null && layout.IsUncached) + layout.Dispose (); + + return labelWidth < editor.Allocation.Width - lineTextPx - editor.TextViewMargin.TextStartPosition; + } int MouseIsOverError (TextEditor editor, MarginMouseEventArgs args) { @@ -687,17 +748,17 @@ namespace MonoDevelop.SourceEditor // Console.WriteLine ("error:" + error); if (error >= layouts.Count) return -1; - int errorCounterWidth = 0; - - int ew = 0, eh = 0; - if (error == 0 && errors.Count > 1 && errorCountLayout != null) { - errorCountLayout.GetPixelSize (out ew, out eh); - errorCounterWidth = ew + 10; - } + int errorCounterWidth = GetErrorCountBounds ().Item1; double labelWidth = LayoutWidth + border + (ShowIconsInBubble ? cache.errorPixbuf.Width : 0) + errorCounterWidth + editor.LineHeight / 2; - if (editor.Allocation.Width - editor.TextViewMargin.XOffset - args.X < labelWidth) + var layout = editor.TextViewMargin.GetLayout (lineSegment); + + var lineTextPx = editor.TextViewMargin.XOffset + editor.TextViewMargin.TextStartPosition + layout.PangoWidth / Pango.Scale.PangoScale; + + labelWidth = Math.Min (editor.Allocation.Width - lineTextPx - editor.TextViewMargin.TextStartPosition, labelWidth); + + if (editor.Allocation.Width - editor.TextViewMargin.XOffset - labelWidth < args.X) return error; return -1; @@ -723,8 +784,18 @@ namespace MonoDevelop.SourceEditor } } - #endregion + + public override void Draw (TextEditor editor, Cairo.Context g, Pango.Layout layout, bool selected, int startOffset, int endOffset, double y, double startXPos, double endXPos) + { + var bounds = GetErrorCountBounds (); + int errorCounterWidth = bounds.Item1; + int eh = bounds.Item2; + + if (errorCounterWidth > 0) + DrawMessageExtendIcon (editor, g, y, errorCounterWidth, eh); + + } #region IExtendingTextMarker implementation public void Draw (TextEditor editor, Cairo.Context g, int lineNr, Cairo.Rectangle lineArea) @@ -732,18 +803,17 @@ namespace MonoDevelop.SourceEditor EnsureLayoutCreated (editor); int lineNumber = editor.Document.OffsetToLineNumber (lineSegment.Offset); int errorNumber = lineNr - lineNumber; + if (!IsCurrentErrorTextFitting ()) + errorNumber--; double x = editor.TextViewMargin.XOffset; double y = lineArea.Y; double right = editor.Allocation.Width; - int errorCounterWidth = 0; - - int ew = 0, eh = 0; - if (errors.Count > 1 && errorCountLayout != null) { - errorCountLayout.GetPixelSize (out ew, out eh); - errorCounterWidth = ew + 10; - } + int errorCounterWidth = GetErrorCountBounds ().Item1; +// int eh = GetErrorCountBounds ().Item2; double x2 = System.Math.Max (right - LayoutWidth - border - (ShowIconsInBubble ? cache.errorPixbuf.Width : 0) - errorCounterWidth, fitsInSameLine ? editor.TextViewMargin.XOffset + editor.LineHeight / 2 : editor.TextViewMargin.XOffset); + if (errors.Count == 1) + x2 = editor.TextViewMargin.XOffset; // bool isEolSelected = editor.IsSomethingSelected && editor.SelectionMode != SelectionMode.Block ? editor.SelectionRange.Contains (lineSegment.Offset + lineSegment.EditableLength) : false; int active = editor.Document.GetTextAt (lineSegment) == initialText ? 0 : 1; bool isCaretInLine = lineSegment.Offset <= editor.Caret.Offset && editor.Caret.Offset <= lineSegment.EndOffset; @@ -784,6 +854,7 @@ namespace MonoDevelop.SourceEditor g.Color = selected == 0 ? gc : cache.gcSelected; g.ShowLayout (layout.Layout); g.Restore (); + // if (ShowIconsInBubble) // win.DrawPixbuf (editor.Style.BaseGC (Gtk.StateType.Normal), errors[errorNumber].IsError ? errorPixbuf : warningPixbuf, 0, 0, x2, y + (editor.LineHeight - errorPixbuf.Height) / 2, errorPixbuf.Width, errorPixbuf.Height, Gdk.RgbDither.None, 0, 0); } diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/QuickTaskStrip.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/QuickTaskStrip.cs index 3dff32e3bf..de7ceaeccf 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/QuickTaskStrip.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/QuickTaskStrip.cs @@ -372,7 +372,7 @@ namespace MonoDevelop.SourceEditor { button |= evnt.Button; - if (evnt.Button == 1 && hoverTask != null) { + if (!evnt.TriggersContextMenu () && evnt.Button == 1 && hoverTask != null) { TextEditor.Caret.Location = new DocumentLocation (hoverTask.Location.Line, Math.Max (DocumentLocation.MinColumn, hoverTask.Location.Column)); TextEditor.CenterToCaret (); TextEditor.StartCaretPulseAnimation (); diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs index 5cdbe166b8..758a346445 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs @@ -1041,7 +1041,7 @@ namespace MonoDevelop.SourceEditor void OnIconButtonPress (object s, MarginMouseEventArgs args) { - if (args.Button == 3) { + if (args.TriggersContextMenu ()) { TextEditor.Caret.Line = args.LineNumber; TextEditor.Caret.Column = 1; IdeApp.CommandService.ShowContextMenu (WorkbenchWindow.ExtensionContext, "/MonoDevelop/SourceEditor2/IconContextMenu/Editor"); diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/StatusBox.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/StatusBox.cs deleted file mode 100644 index 0090ad42e4..0000000000 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/StatusBox.cs +++ /dev/null @@ -1,202 +0,0 @@ -// -// StatusBox.cs -// -// Author: -// Mike Krüger <mkrueger@novell.com> -// -// Copyright (c) 2010 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.ComponentModel; -using Gtk; -using Mono.TextEditor; -using MonoDevelop.Components.Commands; -using MonoDevelop.Ide.Gui; -using MonoDevelop.Core; -using MonoDevelop.Ide; - -namespace MonoDevelop.SourceEditor -{ - class StatusBox : Gtk.Button - { - Pango.Layout layout; - const int leftSpacing = 2; - const int ySpacing = 1; - - public string Text { - get { - return layout.Text; - } - set { - layout.SetText (value); - } - } - - public bool DrawRightBorder { - get; - set; - } - - public static bool ShowRealColumns { - get { - return PropertyService.Get ("CaretStatusBoxShowRealColumns", true); - } - set { - PropertyService.Set ("CaretStatusBoxShowRealColumns", value); - } - } - SourceEditorWidget Editor { - get; - set; - } - - public StatusBox (SourceEditorWidget editor) - { - this.Editor = editor; - PropertyService.AddPropertyHandler ("CaretStatusBoxShowRealColumns", PropertyHandler); - - WidgetFlags |= WidgetFlags.NoWindow; - - layout = new Pango.Layout (this.PangoContext); - measureLayout = new Pango.Layout (this.PangoContext); - } - - - void PropertyHandler (object sender, MonoDevelop.Core.PropertyChangedEventArgs e) - { - Text = GetText (false); - UpdateWidth (); - } - - protected override void OnDestroyed () - { - base.OnDestroyed (); - if (measureLayout != null) { - measureLayout.Dispose (); - measureLayout = null; - } - if (layout != null) { - layout.Dispose (); - layout = null; - } - Editor = null; - PropertyService.RemovePropertyHandler ("CaretStatusBoxShowRealColumns", PropertyHandler); - } - - int requestWidth = 200; - Pango.Layout measureLayout; - public void UpdateWidth () - { - measureLayout.SetText (GetText (true)); - int h, w; - measureLayout.GetPixelSize (out w, out h); - if (w != requestWidth) { - requestWidth = w; - QueueResize (); - } - } - - string GetText (bool showMax) - { - int line = showMax ? Editor.Document.LineCount : Editor.TextEditor.Caret.Line; - int column; - if (showMax) { - column = System.Math.Max (Editor.TextEditor.Caret.Column, 100); - } else if (ShowRealColumns) { - DocumentLocation location = Editor.TextEditor.LogicalToVisualLocation (Editor.TextEditor.Caret.Location); - column = location.Column; - } else { - column = Editor.TextEditor.Caret.Column ; - } - - return string.Format (ShowRealColumns ? GettextCatalog.GetString ("Line: {0}, Column: {1}") : "{0} : {1}", line, column); - } - - public void ShowCaretState () - { - this.Text = GetText (false); - this.QueueDraw (); - } - - protected override bool OnButtonPressEvent (Gdk.EventButton evnt) - { - if (evnt.Button == 3) { - ShowNavigationBarContextMenu (); - return true; - } - return base.OnButtonPressEvent (evnt); - } - - internal static void ShowNavigationBarContextMenu () - { - CommandEntrySet cset = IdeApp.CommandService.CreateCommandEntrySet ("/MonoDevelop/SourceEditor2/ContextMenu/NavigationBar"); - Gtk.Menu menu = IdeApp.CommandService.CreateMenu (cset); - IdeApp.CommandService.ShowContextMenu (menu); - } - - protected override void OnSizeRequested (ref Gtk.Requisition requisition) - { - requisition.Width = requestWidth + leftSpacing * 2; - } - protected override void OnSizeAllocated (Gdk.Rectangle allocation) - { - base.OnSizeAllocated (allocation); - } - - protected override bool OnExposeEvent (Gdk.EventExpose args) - { - Gdk.Drawable win = args.Window; - - int width, height; - layout.GetPixelSize (out width, out height); - - int arrowHeight = height / 2; - int arrowWidth = arrowHeight + 1; - int arrowXPos = this.Allocation.X + this.Allocation.Width - arrowWidth; - if (DrawRightBorder) - arrowXPos -= 2; - var state = StateType.Normal; - //HACK: don't ever draw insensitive, only active/prelight/normal, because insensitive generally looks really ugly - //this *might* cause some theme issues with the state of the text/arrows rendering on top of it - - //HACK: paint the button background as if it were bigger, but it stays clipped to the real area, - // so we get the content but not the border. This might break with crazy themes. - //FIXME: we can't use the style's actual internal padding because GTK# hasn't wrapped GtkBorder AFAICT - // (default-border, inner-border, default-outside-border, etc - see http://git.gnome.org/browse/gtk+/tree/gtk/gtkbutton.c) - const int padding = 4; - Style.PaintBox (Style, args.Window, state, ShadowType.None, args.Area, this, "button", - Allocation.X - padding, Allocation.Y - padding, Allocation.Width + padding * 2, Allocation.Height + padding * 2); - -// int xPos = Allocation.Left; - - //constrain the text area so it doesn't get rendered under the arrows -// var textArea = new Gdk.Rectangle (xPos + 2, Allocation.Y + ySpacing, arrowXPos - xPos - 2, Allocation.Height - ySpacing); - args.Window.DrawLayout (Style.TextGC (StateType.Normal), Allocation.X + 2, Allocation.Y+ ySpacing, layout); - //Style.PaintLayout (Style, win, state, true, textArea, this, "", textArea.X, textArea.Y, layout); - - if (DrawRightBorder) - win.DrawLine (this.Style.DarkGC (StateType.Normal), Allocation.X + Allocation.Width - 1, Allocation.Y, Allocation.X + Allocation.Width - 1, Allocation.Y + Allocation.Height); - return false; - } - - } -} - diff --git a/main/src/addins/MonoDeveloperExtensions/NUnit/Makefile.am b/main/src/addins/MonoDeveloperExtensions/NUnit/Makefile.am index 53fb15821b..257b7c2dbb 100644 --- a/main/src/addins/MonoDeveloperExtensions/NUnit/Makefile.am +++ b/main/src/addins/MonoDeveloperExtensions/NUnit/Makefile.am @@ -1,10 +1,11 @@ FILES = MonoTestProvider.cs -REFS = -r:System +REFS = \ + -r:../../../../build/AddIns/NUnit/MonoDevelop.NUnit.dll \ + -r:System DEPS = \ $(top_builddir)/build/AddIns/MonoDeveloperExtensions/MonoDeveloperExtensions.dll \ - $(top_builddir)/build/AddIns/NUnit/MonoDevelop.NUnit.dll \ $(top_builddir)/build/bin/MonoDevelop.Core.dll ADDIN_BUILD = $(top_builddir)/build/AddIns/MonoDeveloperExtensions diff --git a/main/src/addins/NUnit/Gui/TestPad.cs b/main/src/addins/NUnit/Gui/TestPad.cs index 0d4698e571..5642b7d20a 100644 --- a/main/src/addins/NUnit/Gui/TestPad.cs +++ b/main/src/addins/NUnit/Gui/TestPad.cs @@ -41,6 +41,7 @@ using MonoDevelop.Ide.Execution; using MonoDevelop.Components.Docking; using MonoDevelop.Ide; using MonoDevelop.Projects; +using Mono.TextEditor; namespace MonoDevelop.NUnit { @@ -146,7 +147,7 @@ namespace MonoDevelop.NUnit VBox boxPaned1 = new VBox (); chart = new TestChart (); - chart.ButtonReleaseEvent += new Gtk.ButtonReleaseEventHandler (OnChartPopupMenu); + chart.ButtonPressEvent += OnChartButtonPress; chart.SelectionChanged += new EventHandler (OnChartDateChanged); chart.HeightRequest = 50; @@ -712,10 +713,11 @@ namespace MonoDevelop.NUnit chart.GoLast (); } - void OnChartPopupMenu (object o, Gtk.ButtonReleaseEventArgs args) + void OnChartButtonPress (object o, Gtk.ButtonPressEventArgs args) { - if (args.Event.Button == 3) { + if (args.Event.TriggersContextMenu ()) { IdeApp.CommandService.ShowContextMenu ("/MonoDevelop/NUnit/ContextMenu/TestChart"); + args.RetVal = true; } } diff --git a/main/src/addins/NUnit/Gui/TestResultsPad.cs b/main/src/addins/NUnit/Gui/TestResultsPad.cs index 78c57dfb86..a23e06074a 100644 --- a/main/src/addins/NUnit/Gui/TestResultsPad.cs +++ b/main/src/addins/NUnit/Gui/TestResultsPad.cs @@ -59,7 +59,7 @@ namespace MonoDevelop.NUnit Label resultLabel = new Label (); ProgressBar progressBar = new ProgressBar (); - TreeView failuresTreeView; + MonoDevelop.Ide.Gui.Components.PadTreeView failuresTreeView; TreeStore failuresStore; TextView outputView; TextTag bold; @@ -109,7 +109,7 @@ namespace MonoDevelop.NUnit panel.FocusChain = new Gtk.Widget [] { book }; // Failures tree - failuresTreeView = new TreeView (); + failuresTreeView = new MonoDevelop.Ide.Gui.Components.PadTreeView (); failuresTreeView.HeadersVisible = false; failuresStore = new TreeStore (typeof(Pixbuf), typeof (string), typeof(object), typeof(string)); var pr = new CellRendererPixbuf (); @@ -138,9 +138,12 @@ namespace MonoDevelop.NUnit book.Pack2 (sw, true, true); outputViewScrolled = sw; - failuresTreeView.ButtonReleaseEvent += new Gtk.ButtonReleaseEventHandler (OnPopupMenu); failuresTreeView.RowActivated += OnRowActivated; failuresTreeView.Selection.Changed += OnRowSelected; + failuresTreeView.DoPopupMenu = delegate (EventButton evt) { + IdeApp.CommandService.ShowContextMenu (failuresTreeView, evt, + "/MonoDevelop/NUnit/ContextMenu/TestResultsPad"); + }; Control.ShowAll (); @@ -408,13 +411,6 @@ namespace MonoDevelop.NUnit return; NUnitService.Instance.RunTest (rootTest, null); } - - void OnPopupMenu (object o, Gtk.ButtonReleaseEventArgs args) - { - if (args.Event.Button == 3) { - IdeApp.CommandService.ShowContextMenu ("/MonoDevelop/NUnit/ContextMenu/TestResultsPad"); - } - } void OnRowActivated (object s, EventArgs a) { diff --git a/main/src/addins/NUnit/Makefile.am b/main/src/addins/NUnit/Makefile.am index 029caf68c4..4dcf8974ad 100644 --- a/main/src/addins/NUnit/Makefile.am +++ b/main/src/addins/NUnit/Makefile.am @@ -6,6 +6,7 @@ ASSEMBLY = $(ADDIN_BUILD)/MonoDevelop.NUnit.dll DEPS = \ $(top_builddir)/build/AddIns/NUnit/NUnitRunner.dll \ $(top_builddir)/build/bin/ICSharpCode.NRefactory.dll \ + $(top_builddir)/build/bin/Mono.TextEditor.dll \ $(top_builddir)/build/bin/MonoDevelop.Core.dll \ $(top_builddir)/build/bin/MonoDevelop.Ide.dll diff --git a/main/src/addins/NUnit/MonoDevelop.NUnit.csproj b/main/src/addins/NUnit/MonoDevelop.NUnit.csproj index 899018851d..7cba5dfd5a 100644 --- a/main/src/addins/NUnit/MonoDevelop.NUnit.csproj +++ b/main/src/addins/NUnit/MonoDevelop.NUnit.csproj @@ -90,6 +90,10 @@ <ProjectReference Include="..\..\..\contrib\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj"> <Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project> <Name>ICSharpCode.NRefactory</Name> + <ProjectReference Include="..\..\core\Mono.Texteditor\Mono.TextEditor.csproj"> + <Project>{A2329308-3751-4DBD-9A75-5F7B8B024625}</Project> + <Name>Mono.TextEditor</Name> + <Private>False</Private> </ProjectReference> </ItemGroup> <ItemGroup> diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/Makefile.am b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/Makefile.am index 85f7f29af4..14230113a7 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/Makefile.am +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/Makefile.am @@ -3,9 +3,9 @@ ADDIN_BUILD = $(top_builddir)/build/AddIns/VersionControl ASSEMBLY = $(ADDIN_BUILD)/MonoDevelop.VersionControl.Git.dll DEPS = \ + $(top_builddir)/build/AddIns/VersionControl/MonoDevelop.VersionControl.dll \ $(top_builddir)/build/bin/ICSharpCode.NRefactory.CSharp.dll \ $(top_builddir)/build/bin/ICSharpCode.NRefactory.dll \ - $(top_builddir)/build/AddIns/VersionControl/MonoDevelop.VersionControl.dll \ $(top_builddir)/build/bin/Mono.TextEditor.dll \ $(top_builddir)/build/bin/MonoDevelop.Core.dll \ $(top_builddir)/build/bin/MonoDevelop.Ide.dll \ diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs index f51021eca4..f6aebf085f 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs @@ -135,26 +135,11 @@ namespace MonoDevelop.VersionControl.Views editor.Document.FoldTreeUpdated += delegate { QueueDraw (); }; - editor.ButtonPressEvent += OnPopupMenu; + editor.DoPopupMenu = ShowPopup; Show (); } - void OnPopupMenu (object sender, Gtk.ButtonPressEventArgs args) - { - if (args.Event.Button == 3) { - int textEditorXOffset = (int)args.Event.X - (int)editor.TextViewMargin.XOffset; - if (textEditorXOffset < 0) - return; - this.menuPopupLocation = new Cairo.Point ((int)args.Event.X, (int)args.Event.Y); - DocumentLocation loc = editor.PointToLocation (textEditorXOffset, (int)args.Event.Y); - if (!editor.IsSomethingSelected || !editor.SelectionRange.Contains (editor.Document.LocationToOffset (loc))) - editor.Caret.Location = loc; - - this.ShowPopup (); - } - } - - void ShowPopup () + void ShowPopup (EventButton evt) { CommandEntrySet cset = IdeApp.CommandService.CreateCommandEntrySet ("/MonoDevelop/VersionControl/BlameView/ContextMenu"); Gtk.Menu menu = IdeApp.CommandService.CreateMenu (cset); @@ -162,21 +147,12 @@ namespace MonoDevelop.VersionControl.Views this.QueueDraw (); }; - menu.Popup (null, null, new Gtk.MenuPositionFunc (PositionPopupMenu), 0, Gtk.Global.CurrentEventTime); - } - - Cairo.Point menuPopupLocation; - void PositionPopupMenu (Menu menu, out int x, out int y, out bool pushIn) - { - this.GdkWindow.GetOrigin (out x, out y); - x += this.menuPopupLocation.X; - y += this.menuPopupLocation.Y; - Requisition request = menu.SizeRequest (); - Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry (Screen, Screen.GetMonitorAtPoint (x, y)); - - y = Math.Max (geometry.Top, Math.Min (y, geometry.Bottom - request.Height)); - x = Math.Max (geometry.Left, Math.Min (x, geometry.Right - request.Width)); - pushIn = true; + if (evt != null) { + GtkWorkarounds.ShowContextMenu (menu, this, evt); + } else { + var pt = editor.LocationToPoint (editor.Caret.Location); + GtkWorkarounds.ShowContextMenu (menu, editor, new Gdk.Rectangle (pt.X, pt.Y, 1, (int)editor.LineHeight)); + } } void HandleAdjustmentChanged (object sender, EventArgs e) @@ -259,25 +235,19 @@ namespace MonoDevelop.VersionControl.Views } } - static double GetWheelDelta (Scrollbar scrollbar, ScrollDirection direction) - { - double delta = System.Math.Pow (scrollbar.Adjustment.PageSize, 2.0 / 3.0); - if (direction == ScrollDirection.Up || direction == ScrollDirection.Left) - delta = -delta; - if (scrollbar.Inverted) - delta = -delta; - return delta; - } - protected override bool OnScrollEvent (EventScroll evnt) { - Scrollbar scrollWidget = (evnt.Direction == ScrollDirection.Up || evnt.Direction == ScrollDirection.Down) ? (Scrollbar)vScrollBar : hScrollBar; - if (scrollWidget.Visible) { - double newValue = scrollWidget.Adjustment.Value + GetWheelDelta (scrollWidget, evnt.Direction); - newValue = System.Math.Max (System.Math.Min (scrollWidget.Adjustment.Upper - scrollWidget.Adjustment.PageSize, newValue), scrollWidget.Adjustment.Lower); - scrollWidget.Adjustment.Value = newValue; - } - return base.OnScrollEvent (evnt); + var alloc = Allocation; + double dx, dy; + evnt.GetPageScrollPixelDeltas (alloc.Width, alloc.Height, out dx, out dy); + + if (dx != 0.0 && hScrollBar.Visible) + hAdjustment.AddValueClamped (dx); + + if (dy != 0.0 && vScrollBar.Visible) + vAdjustment.AddValueClamped (dy); + + return (dx != 0.0 || dy != 0.0) || base.OnScrollEvent (evnt); } protected override void OnSizeRequested (ref Gtk.Requisition requisition) @@ -467,13 +437,14 @@ namespace MonoDevelop.VersionControl.Views uint grabTime; protected override bool OnButtonPressEvent (EventButton evnt) { - if (evnt.Button == 3) { + if (evnt.TriggersContextMenu ()) { CommandEntrySet opset = new CommandEntrySet (); opset.AddItem (BlameCommands.ShowDiff); opset.AddItem (BlameCommands.ShowLog); opset.AddItem (Command.Separator); opset.AddItem (BlameCommands.CopyRevision); - IdeApp.CommandService.ShowContextMenu (opset, this); + IdeApp.CommandService.ShowContextMenu (this, evnt, opset, this); + return true; } else { if (evnt.X < leftSpacer) { grabTime = evnt.Time; diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DropDownBox.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DropDownBox.cs index 82f4d4f98c..d5e11c447e 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DropDownBox.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DropDownBox.cs @@ -28,9 +28,11 @@ using System; using System.ComponentModel; using MonoDevelop.Ide; using Gtk; +using Mono.TextEditor; namespace MonoDevelop.VersionControl.Views { + //FIXME: re-merge this with MonoDevelop.Components.DropDownBox [Category ("Widgets")] [ToolboxItem (true)] public class DropDownBox : Gtk.Button @@ -193,8 +195,7 @@ namespace MonoDevelop.VersionControl.Views protected override bool OnButtonPressEvent (Gdk.EventButton e) { - if (e.Button == 3) { -// StatusBox.ShowNavigationBarContextMenu (); + if (e.TriggersContextMenu ()) { return base.OnButtonPressEvent (e); } if (e.Type == Gdk.EventType.ButtonPress) { diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.cs index 4a23fb10b1..b67178b913 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.cs @@ -146,7 +146,7 @@ namespace MonoDevelop.VersionControl.Views for (int i = 0; i < editors.Length; i++) { var editor = editors[i]; Add (editor); - editor.ButtonPressEvent += OnPopupMenu; + editor.DoPopupMenu += (e) => ShowPopup (editor, e); editor.Caret.PositionChanged += CaretPositionChanged; editor.FocusInEvent += EditorFocusIn; editor.SetScrollAdjustments (attachedHAdjustments[i], attachedVAdjustments[i]); @@ -205,25 +205,7 @@ namespace MonoDevelop.VersionControl.Views this.MainEditor.EditorOptionsChanged += HandleMainEditorhandleEditorOptionsChanged; } - #region context menu - void OnPopupMenu (object sender, Gtk.ButtonPressEventArgs args) - { - var editor = (TextEditor)sender; - if (args.Event.Button == 3) { - int textEditorXOffset = (int)args.Event.X - (int)editor.TextViewMargin.XOffset; - if (textEditorXOffset < 0) - return; - popupEditor = editor; - this.menuPopupLocation = new Cairo.Point ((int)args.Event.X, (int)args.Event.Y); - DocumentLocation loc = editor.PointToLocation (textEditorXOffset, (int)args.Event.Y); - if (!editor.IsSomethingSelected || !editor.SelectionRange.Contains (editor.Document.LocationToOffset (loc))) - editor.Caret.Location = loc; - - this.ShowPopup (); - } - } - - void ShowPopup () + void ShowPopup (TextEditor editor, EventButton evt) { CommandEntrySet cset = IdeApp.CommandService.CreateCommandEntrySet ("/MonoDevelop/VersionControl/DiffView/ContextMenu"); Gtk.Menu menu = IdeApp.CommandService.CreateMenu (cset); @@ -231,24 +213,13 @@ namespace MonoDevelop.VersionControl.Views this.QueueDraw (); }; - menu.Popup (null, null, new Gtk.MenuPositionFunc (PositionPopupMenu), 0, Gtk.Global.CurrentEventTime); - } - - TextEditor popupEditor; - Cairo.Point menuPopupLocation; - void PositionPopupMenu (Menu menu, out int x, out int y, out bool pushIn) - { - popupEditor.GdkWindow.GetOrigin (out x, out y); - x += this.menuPopupLocation.X; - y += this.menuPopupLocation.Y; - Requisition request = menu.SizeRequest (); - Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry (Screen, Screen.GetMonitorAtPoint (x, y)); - - y = Math.Max (geometry.Top, Math.Min (y, geometry.Bottom - request.Height)); - x = Math.Max (geometry.Left, Math.Min (x, geometry.Right - request.Width)); - pushIn = true; + if (evt != null) { + GtkWorkarounds.ShowContextMenu (menu, this, evt); + } else { + var pt = editor.LocationToPoint (editor.Caret.Location); + GtkWorkarounds.ShowContextMenu (menu, editor, new Gdk.Rectangle (pt.X, pt.Y, 1, (int)editor.LineHeight)); + } } - #endregion void HandleMainEditorhandleEditorOptionsChanged (object sender, EventArgs e) { @@ -387,8 +358,6 @@ namespace MonoDevelop.VersionControl.Views attachedVAdjustments.Select (adj => adj.PageIncrement / (adj.Upper - adj.Lower)).Min (), attachedVAdjustments.Select (adj => adj.PageSize / (adj.Upper - adj.Lower)).Min ()); - - hAdjustment.SetBounds (0, 1.0, attachedHAdjustments.Select (adj => adj.StepIncrement / (adj.Upper - adj.Lower)).Min (), attachedHAdjustments.Select (adj => adj.PageIncrement / (adj.Upper - adj.Lower)).Min (), @@ -513,25 +482,25 @@ namespace MonoDevelop.VersionControl.Views } base.OnSizeAllocated (allocation); } - - static double GetWheelDelta (Adjustment adjustment, ScrollDirection direction) - { - double delta = adjustment.StepIncrement * 4; - if (direction == ScrollDirection.Up || direction == ScrollDirection.Left) - delta = -delta; - return delta; - } - + + // FIXME: if the editors have different adjustment ranges, the pixel deltas + // don't really feel quite right since they're applied after scaling via the + // linked adjustment protected override bool OnScrollEvent (EventScroll evnt) { - var adjustment = (evnt.Direction == ScrollDirection.Up || evnt.Direction == ScrollDirection.Down) ? vAdjustment : hAdjustment; - - if (adjustment.PageSize < adjustment.Upper) { - double newValue = adjustment.Value + GetWheelDelta (adjustment, evnt.Direction); - newValue = System.Math.Max (System.Math.Min (adjustment.Upper - adjustment.PageSize, newValue), adjustment.Lower); - adjustment.Value = newValue; - } - return base.OnScrollEvent (evnt); + //using the size of an editor for the calculations means pixel deltas apply better + var alloc = editors[0].Allocation; + + double dx, dy; + evnt.GetPageScrollPixelDeltas (alloc.Width, alloc.Height, out dx, out dy); + + if (dx != 0.0 && hAdjustment.PageSize < (hAdjustment.Upper - hAdjustment.Lower)) + hAdjustment.AddValueClamped (dx / (alloc.Width / hAdjustment.PageSize)); + + if (dy != 0.0 && vAdjustment.PageSize < (vAdjustment.Upper - vAdjustment.Lower)) + vAdjustment.AddValueClamped (dy / (alloc.Height / vAdjustment.PageSize)); + + return (dx != 0.0 || dy != 0.0) || base.OnScrollEvent (evnt); } protected override void OnSizeRequested (ref Gtk.Requisition requisition) @@ -755,8 +724,10 @@ namespace MonoDevelop.VersionControl.Views protected override bool OnButtonPressEvent (EventButton evnt) { - if (evnt.Button == 1 && !selectedHunk.IsEmpty) + if (!evnt.TriggersContextMenu () && evnt.Button == 1 && !selectedHunk.IsEmpty) { widget.UndoChange (fromEditor, toEditor, selectedHunk); + return true; + } return base.OnButtonPressEvent (evnt); } @@ -1025,7 +996,12 @@ namespace MonoDevelop.VersionControl.Views FillGradient (cr, 0.5 + curY, Allocation.Height - curY); - DrawBar (cr, Allocation.Height * adj.Value / adj.Upper + cr.LineWidth + 0.5, Allocation.Height * (adj.PageSize / adj.Upper)); + int barPadding = 3; + var allocH = Allocation.Height; + var adjUpper = adj.Upper; + var barY = allocH * adj.Value / adjUpper + barPadding; + var barH = allocH * (adj.PageSize / adjUpper) - barPadding - barPadding; + DrawBar (cr, barY, barH); cr.Rectangle (0.5, 0.5, Allocation.Width - 1, Allocation.Height - 1); cr.Color = (Mono.TextEditor.HslColor)Style.Dark (StateType.Normal); diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeWidget.cs index 4cb9dc10c1..25b03dbbb5 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeWidget.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeWidget.cs @@ -35,6 +35,7 @@ using MonoDevelop.Ide; using MonoDevelop.Components; using System.ComponentModel; using MonoDevelop.Core; +using MonoDevelop.Ide.Gui; namespace MonoDevelop.VersionControl.Views { @@ -106,7 +107,12 @@ namespace MonoDevelop.VersionControl.Views protected override void CreateComponents () { - this.editors = new [] { new TextEditor (), new TextEditor (), new TextEditor () }; + this.editors = new [] { + new TextEditor (new Mono.TextEditor.Document (), new CommonTextEditorOptions ()), + new TextEditor (new Mono.TextEditor.Document (), new CommonTextEditorOptions ()), + new TextEditor (new Mono.TextEditor.Document (), new CommonTextEditorOptions ()), + }; + this.editors[0].Document.ReadOnly = true; this.editors[2].Document.ReadOnly = true; @@ -243,7 +249,7 @@ namespace MonoDevelop.VersionControl.Views void UpdateConflictsOnTextReplace (object sender, ReplaceEventArgs e) { this.UpdateDiff (); - Document.UpdateSegments (GetAllConflictingSegments (), e); + Mono.TextEditor.Document.UpdateSegments (GetAllConflictingSegments (), e); } } }
\ No newline at end of file diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs index 01da1e3a8c..2061e4979b 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs @@ -13,6 +13,7 @@ using MonoDevelop.Projects; using MonoDevelop.Ide.Gui.Components; using MonoDevelop.Ide; using MonoDevelop.Ide.Gui; +using Mono.TextEditor; namespace MonoDevelop.VersionControl.Views { @@ -172,7 +173,7 @@ namespace MonoDevelop.VersionControl.Views scroller = new ScrolledWindow(); scroller.ShadowType = Gtk.ShadowType.In; filelist = new FileTreeView(); - filelist.Selection.Mode = SelectionMode.Multiple; + filelist.Selection.Mode = Gtk.SelectionMode.Multiple; scroller.Add(filelist); scroller.HscrollbarPolicy = PolicyType.Automatic; @@ -278,7 +279,7 @@ namespace MonoDevelop.VersionControl.Views filestore.SetSortColumnId (3, Gtk.SortType.Ascending); - filelist.ShowContextMenu += OnPopupMenu; + filelist.DoPopupMenu = DoPopupMenu; StartUpdate(); } @@ -662,7 +663,7 @@ namespace MonoDevelop.VersionControl.Views } } - void OnPopupMenu (object o, EventArgs args) + void DoPopupMenu (Gdk.EventButton evnt) { object commandChain = this; CommandEntrySet opset = new CommandEntrySet (); @@ -684,7 +685,7 @@ namespace MonoDevelop.VersionControl.Views } else opset.AddSeparator (); } - IdeApp.CommandService.ShowContextMenu (opset, commandChain); + IdeApp.CommandService.ShowContextMenu (filelist, evnt, opset, commandChain); } public VersionControlItemList GetSelectedItems () @@ -1030,39 +1031,47 @@ namespace MonoDevelop.VersionControl.Views class FileTreeView: TreeView { - protected override bool OnButtonPressEvent(Gdk.EventButton evnt) + const Gdk.ModifierType selectionModifiers = Gdk.ModifierType.ShiftMask | Gdk.ModifierType.ControlMask; + + protected override bool OnButtonPressEvent (Gdk.EventButton evnt) { bool keepPos = false; double vpos = 0; - TreePath path, cpath; - GetPathAtPos ((int)evnt.X, (int)evnt.Y, out path); - - TreeViewColumn col; - GetCursor (out cpath, out col); - - if (path != null && path.Depth == 2) { - vpos = Vadjustment.Value; - keepPos = true; - if (Selection.PathIsSelected (path) && Selection.GetSelectedRows ().Length == 1 && evnt.Button == 1) { - if (evnt.Type == Gdk.EventType.TwoButtonPress && DiffLineActivated != null) - DiffLineActivated (this, EventArgs.Empty); - return true; + bool ctxMenu = evnt.TriggersContextMenu (); + bool handled = false; + + if (!ctxMenu) { + TreePath path; + GetPathAtPos ((int)evnt.X, (int)evnt.Y, out path); + if (path != null && path.Depth == 2) { + vpos = Vadjustment.Value; + keepPos = true; + if (Selection.PathIsSelected (path) && Selection.GetSelectedRows ().Length == 1 && evnt.Button == 1) { + if (evnt.Type == Gdk.EventType.TwoButtonPress && DiffLineActivated != null) + DiffLineActivated (this, EventArgs.Empty); + handled = true; + } } } - bool res = true; - bool withModifider = (evnt.State & Gdk.ModifierType.ShiftMask) != 0 || (evnt.State & Gdk.ModifierType.ControlMask) != 0; - if (!IsClickedNodeSelected ((int)evnt.X, (int)evnt.Y) || (Selection.GetSelectedRows ().Length <= 1) || withModifider || evnt.Button != 3) - res = base.OnButtonPressEvent (evnt); + handled = handled || ( + IsClickedNodeSelected ((int)evnt.X, (int)evnt.Y) + && this.Selection.GetSelectedRows ().Length > 1 + && (evnt.State & selectionModifiers) == 0); - if (evnt.Button == 3) { - if (ShowContextMenu != null) - ShowContextMenu (this, EventArgs.Empty); + if (!handled) + handled = base.OnButtonPressEvent (evnt); + + if (ctxMenu) { + if (DoPopupMenu != null) + DoPopupMenu (evnt); + handled = true; } + if (keepPos) Vadjustment.Value = vpos; - return res; + return handled; } bool IsClickedNodeSelected (int x, int y) @@ -1076,8 +1085,8 @@ namespace MonoDevelop.VersionControl.Views protected override bool OnPopupMenu() { - if (ShowContextMenu != null) - ShowContextMenu (this, EventArgs.Empty); + if (DoPopupMenu != null) + DoPopupMenu (null); return true; } @@ -1116,7 +1125,7 @@ namespace MonoDevelop.VersionControl.Views return base.OnScrollEvent (evnt); } - public event EventHandler ShowContextMenu; + public Action<Gdk.EventButton> DoPopupMenu; public event EventHandler DiffLineActivated; } } diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor.PopupWindow/ListWindow.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor.PopupWindow/ListWindow.cs index 5a0a31c8c7..30ed33b26b 100644 --- a/main/src/core/Mono.Texteditor/Mono.TextEditor.PopupWindow/ListWindow.cs +++ b/main/src/core/Mono.Texteditor/Mono.TextEditor.PopupWindow/ListWindow.cs @@ -30,6 +30,7 @@ using Gdk; using Pango; using System; using System.Text; +using Mono.TextEditor; namespace Mono.TextEditor.PopupWindow { @@ -339,10 +340,29 @@ namespace Mono.TextEditor.PopupWindow void OnScrolled (object o, ScrollEventArgs args) { - if (args.Event.Direction == Gdk.ScrollDirection.Up) - scrollbar.Value --; - else if (args.Event.Direction == Gdk.ScrollDirection.Down) - scrollbar.Value ++; + if (!scrollbar.Visible) + return; + + var adj = scrollbar.Adjustment; + var alloc = Allocation; + + //This widget is a special case because it's always aligned to items as it scrolls. + //Although this means we can't use the pixel deltas for true smooth scrolling, we + //can still make use of the effective scrolling velocity by basing the calculation + //on pixels and rounding to the nearest item. + + double dx, dy; + args.Event.GetPageScrollPixelDeltas (0, alloc.Height, out dx, out dy); + if (dy == 0) + return; + + var itemDelta = dy / (alloc.Height / adj.PageSize); + double discreteItemDelta = System.Math.Round (itemDelta); + if (discreteItemDelta == 0.0 && dy != 0.0) + discreteItemDelta = dy > 0? 1.0 : -1.0; + + adj.AddValueClamped (discreteItemDelta); + args.RetVal = true; } void OnSelectionChanged (object o, EventArgs args) diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor.Theatrics/SmartScrolledWindow.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor.Theatrics/SmartScrolledWindow.cs index 440453a0ab..7d6b2b48f2 100644 --- a/main/src/core/Mono.Texteditor/Mono.TextEditor.Theatrics/SmartScrolledWindow.cs +++ b/main/src/core/Mono.Texteditor/Mono.TextEditor.Theatrics/SmartScrolledWindow.cs @@ -199,38 +199,35 @@ namespace Mono.TextEditor.Theatrics vChildTopHeight += child.Child.Requisition.Height; } int v = vScrollBar is Scrollbar && hScrollBar.Visible ? hScrollBar.Requisition.Height : 0; - vScrollBar.SizeAllocate (new Rectangle (right, childRectangle.Y + vChildTopHeight, vwidth, Allocation.Height - v - vChildTopHeight - 1)); + vScrollBar.SizeAllocate (new Rectangle (right + 1, childRectangle.Y + vChildTopHeight, vwidth, Allocation.Height - v - vChildTopHeight - 1)); vAdjustment.Value = System.Math.Max (System.Math.Min (vAdjustment.Upper - vAdjustment.PageSize, vAdjustment.Value), vAdjustment.Lower); } if (hScrollBar.Visible) { int v = vScrollBar.Visible ? vScrollBar.Requisition.Width : 0; - hScrollBar.SizeAllocate (new Rectangle (allocation.X, childRectangle.Bottom, Allocation.Width - v, hheight)); + hScrollBar.SizeAllocate (new Rectangle (allocation.X, childRectangle.Bottom + 1, Allocation.Width - v, hheight)); hScrollBar.Value = System.Math.Max (System.Math.Min (hAdjustment.Upper - hAdjustment.PageSize, hScrollBar.Value), hAdjustment.Lower); } } - static double GetWheelDelta (Adjustment adj, ScrollDirection direction, bool inverted = false) + static double Clamp (double min, double val, double max) { - double delta = System.Math.Pow (adj.PageSize, 2.0 / 3.0); - if (direction == ScrollDirection.Up || direction == ScrollDirection.Left) - delta = -delta; - if (inverted) - delta = -delta; - return delta; + return System.Math.Max (min, System.Math.Min (val, max)); } protected override bool OnScrollEvent (EventScroll evnt) { - var scrollWidget = (evnt.Direction == ScrollDirection.Up || evnt.Direction == ScrollDirection.Down) ? vScrollBar : hScrollBar; - var adj = (evnt.Direction == ScrollDirection.Up || evnt.Direction == ScrollDirection.Down) ? vAdjustment : hAdjustment; + var alloc = Allocation; + double dx, dy; + evnt.GetPageScrollPixelDeltas (alloc.Width, alloc.Height, out dx, out dy); - if (scrollWidget.Visible) { - double newValue = adj.Value + GetWheelDelta (adj, evnt.Direction, scrollWidget is Scrollbar ? ((Scrollbar)scrollWidget).Inverted : false); - newValue = System.Math.Max (System.Math.Min (adj.Upper - adj.PageSize, newValue), adj.Lower); - adj.Value = newValue; - } - return base.OnScrollEvent (evnt); + if (dx != 0.0 && hScrollBar.Visible) + hAdjustment.AddValueClamped (dx); + + if (dy != 0.0 && vScrollBar.Visible) + vAdjustment.AddValueClamped (dy); + + return (dx != 0.0 || dy != 0.0) || base.OnScrollEvent (evnt); } protected override void OnSizeRequested (ref Gtk.Requisition requisition) diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/GtkWorkarounds.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/GtkWorkarounds.cs index 869f8cf729..a97c0d31fb 100644 --- a/main/src/core/Mono.Texteditor/Mono.TextEditor/GtkWorkarounds.cs +++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/GtkWorkarounds.cs @@ -27,6 +27,7 @@ using System; using System.Drawing; using System.Runtime.InteropServices; +using System.Collections.Generic; namespace Mono.TextEditor { @@ -65,7 +66,8 @@ namespace Mono.TextEditor static System.Reflection.MethodInfo glibObjectGetProp, glibObjectSetProp; - public static int GtkMinorVersion = 12; + public static int GtkMinorVersion = 12, GtkMicroVersion = 0; + static bool oldMacKeyHacks = false; static GtkWorkarounds () { @@ -83,6 +85,21 @@ namespace Mono.TextEditor break; } } + + for (int i = 1; i < 20; i++) { + if (Gtk.Global.CheckVersion (2, (uint)GtkMinorVersion, (uint)i) == null) { + GtkMicroVersion = i; + } else { + break; + } + } + + //TODO: opt into the fixes on GTK+ >= 2.24.8 + oldMacKeyHacks = true; + + keymap.KeysChanged += delegate { + mappedKeys.Clear (); + }; } static void InitMac () @@ -192,6 +209,298 @@ namespace Mono.TextEditor glibObjectSetProp.Invoke (obj, new object[] { name, value }); } + public static bool TriggersContextMenu (this Gdk.EventButton evt) + { + return evt.Type == Gdk.EventType.ButtonPress && IsContextMenuButton (evt); + } + + public static bool IsContextMenuButton (this Gdk.EventButton evt) + { + if (evt.Button == 3 && + (evt.State & (Gdk.ModifierType.Button1Mask | Gdk.ModifierType.Button2Mask)) == 0) + return true; + + if (Platform.IsMac) { + if (evt.Button == 1 && + (evt.State & Gdk.ModifierType.ControlMask) != 0 && + (evt.State & (Gdk.ModifierType.Button2Mask | Gdk.ModifierType.Button3Mask)) == 0) + return true; + } + + return false; + } + + public static void GetPageScrollPixelDeltas (this Gdk.EventScroll evt, double pageSizeX, double pageSizeY, + out double deltaX, out double deltaY) + { + if (!GetEventScrollDeltas (evt, out deltaX, out deltaY)) { + var direction = evt.Direction; + deltaX = deltaY = 0; + if (pageSizeY != 0 && (direction == Gdk.ScrollDirection.Down || direction == Gdk.ScrollDirection.Up)) { + deltaY = System.Math.Pow (pageSizeY, 2.0 / 3.0); + deltaX = 0.0; + if (direction == Gdk.ScrollDirection.Up) + deltaY = -deltaY; + } else if (pageSizeX != 0) { + deltaX = System.Math.Pow (pageSizeX, 2.0 / 3.0); + deltaY = 0.0; + if (direction == Gdk.ScrollDirection.Left) + deltaX = -deltaX; + } + } + } + + public static void AddValueClamped (this Gtk.Adjustment adj, double value) + { + adj.Value = System.Math.Max (adj.Lower, System.Math.Min (adj.Value + value, adj.Upper - adj.PageSize)); + } + + [DllImport (PangoUtil.LIBGTK)] + extern static bool gdk_event_get_scroll_deltas (IntPtr eventScroll, out double deltaX, out double deltaY); + static bool scrollDeltasNotSupported; + + public static bool GetEventScrollDeltas (Gdk.EventScroll evt, out double deltaX, out double deltaY) + { + if (!scrollDeltasNotSupported) { + try { + return gdk_event_get_scroll_deltas (evt.Handle, out deltaX, out deltaY); + } catch (EntryPointNotFoundException) { + scrollDeltasNotSupported = true; + } + } + deltaX = deltaY = 0; + return false; + } + + /// <summary>Shows a context menu.</summary> + /// <param name='menu'>The menu.</param> + /// <param name='parent'>The parent widget.</param> + /// <param name='evt'>The mouse event. May be null if triggered by keyboard.</param> + /// <param name='caret'>The caret/selection position within the parent, if the EventButton is null.</param> + public static void ShowContextMenu (Gtk.Menu menu, Gtk.Widget parent, Gdk.EventButton evt, Gdk.Rectangle caret) + { + Gtk.MenuPositionFunc posFunc = null; + + if (parent != null) { + menu.AttachToWidget (parent, null); + posFunc = delegate (Gtk.Menu m, out int x, out int y, out bool pushIn) { + Gdk.Window window = evt != null? evt.Window : parent.GdkWindow; + window.GetOrigin (out x, out y); + var alloc = parent.Allocation; + if (evt != null) { + x += (int) evt.X; + y += (int) evt.Y; + } else if (caret.X >= alloc.X && caret.Y >= alloc.Y) { + x += caret.X; + y += caret.Y + caret.Height; + } else { + x += alloc.X; + y += alloc.Y; + } + Gtk.Requisition request = m.SizeRequest (); + var screen = parent.Screen; + Gdk.Rectangle geometry = GetUsableMonitorGeometry (screen, screen.GetMonitorAtPoint (x, y)); + + if (x + request.Width > geometry.Right) { + x -= request.Width; + } + if (y + request.Height > geometry.Bottom) { + y -= request.Height; + } + y = System.Math.Max (geometry.Top, System.Math.Min (y, geometry.Bottom - request.Height)); + x = System.Math.Max (geometry.Left, System.Math.Min (x, geometry.Right - request.Width)); + + pushIn = false; + }; + } + + if (evt == null) { + menu.Popup (null, null, posFunc, 0, Gtk.Global.CurrentEventTime); + } else { + menu.Popup (null, null, posFunc, evt.Button, evt.Time); + } + } + + public static void ShowContextMenu (Gtk.Menu menu, Gtk.Widget parent, Gdk.EventButton evt) + { + ShowContextMenu (menu, parent, evt, Gdk.Rectangle.Zero); + } + + public static void ShowContextMenu (Gtk.Menu menu, Gtk.Widget parent, Gdk.Rectangle caret) + { + ShowContextMenu (menu, parent, null, caret); + } + + struct MappedKeys + { + public Gdk.Key Key; + public Gdk.ModifierType State; + public KeyboardShortcut[] Accels; + } + + //introduced in GTK 2.20 + [DllImport (PangoUtil.LIBGDK)] + extern static bool gdk_keymap_add_virtual_modifiers (IntPtr keymap, ref Gdk.ModifierType state); + + static Gdk.Keymap keymap = Gdk.Keymap.Default; + static Dictionary<long,MappedKeys> mappedKeys = new Dictionary<long,MappedKeys> (); + + /// <summary>Map raw GTK key input to work around platform bugs and decompose accelerator keys</summary> + /// <param name='evt'>The raw key event</param> + /// <param name='key'>The composed key</param> + /// <param name='mod'>The composed modifiers</param> + /// <param name='accels'>All the key/modifier decompositions that can be used as accelerators</param> + public static void MapKeys (Gdk.EventKey evt, out Gdk.Key key, out Gdk.ModifierType state, + out KeyboardShortcut[] accels) + { + //this uniquely identifies the raw key + long id = (((long)evt.State)) | (((long)evt.HardwareKeycode) << 32) | ((long)evt.Group << 48); + + MappedKeys mapped; + if (!mappedKeys.TryGetValue (id, out mapped)) { + mappedKeys[id] = mapped = MapKeys (evt); + } + accels = mapped.Accels; + key = mapped.Key; + state = mapped.State; + } + + static MappedKeys MapKeys (Gdk.EventKey evt) + { + MappedKeys mapped; + ushort keycode = evt.HardwareKeycode; + Gdk.ModifierType modifier = evt.State; + byte grp = evt.Group; + + if (GtkMinorVersion >= 20) { + gdk_keymap_add_virtual_modifiers (keymap.Handle, ref modifier); + } + + // Workaround for bug "Bug 688247 - Ctrl+Alt key not work on windows7 with bootcamp on a Mac Book Pro" + // Ctrl+Alt should behave like right alt key - unfortunately TranslateKeyboardState doesn't handle it. + if (Platform.IsWindows) { + const Gdk.ModifierType ctrlAlt = Gdk.ModifierType.ControlMask | Gdk.ModifierType.Mod1Mask; + if ((modifier & ctrlAlt) == ctrlAlt) { + modifier = (modifier & ~ctrlAlt) | Gdk.ModifierType.Mod2Mask; + grp = 1; + } + } + + //full key mapping + uint keyval; + int effectiveGroup, level; + Gdk.ModifierType consumedModifiers; + keymap.TranslateKeyboardState (keycode, modifier, grp, out keyval, out effectiveGroup, + out level, out consumedModifiers); + mapped.Key = (Gdk.Key)keyval; + mapped.State = FixMacModifiers (evt.State & ~consumedModifiers, grp); + + //decompose the key into accel combinations + var accelList = new List<KeyboardShortcut> (); + + const Gdk.ModifierType accelMods = Gdk.ModifierType.ShiftMask | Gdk.ModifierType.Mod1Mask + | Gdk.ModifierType.ControlMask | Gdk.ModifierType.SuperMask |Gdk.ModifierType.MetaMask; + + //all accels ignore the lock key + modifier &= ~Gdk.ModifierType.LockMask; + + //fully decomposed + keymap.TranslateKeyboardState (evt.HardwareKeycode, Gdk.ModifierType.None, 0, + out keyval, out effectiveGroup, out level, out consumedModifiers); + accelList.Add (new KeyboardShortcut ((Gdk.Key)keyval, FixMacModifiers (modifier, grp) & accelMods)); + + //with shift composed + if ((modifier & Gdk.ModifierType.ShiftMask) != 0) { + keymap.TranslateKeyboardState (evt.HardwareKeycode, Gdk.ModifierType.ShiftMask, 0, + out keyval, out effectiveGroup, out level, out consumedModifiers); + var m = FixMacModifiers ((modifier & ~consumedModifiers), grp) & accelMods; + AddIfNotDuplicate (accelList, new KeyboardShortcut ((Gdk.Key)keyval, m)); + } + + //with group 1 composed + if (grp == 1) { + keymap.TranslateKeyboardState (evt.HardwareKeycode, modifier & ~Gdk.ModifierType.ShiftMask, 1, + out keyval, out effectiveGroup, out level, out consumedModifiers); + //somehow GTK on mac manages to consume a shift that we don't even pass to it + if (oldMacKeyHacks) { + consumedModifiers &= ~Gdk.ModifierType.ShiftMask; + } + var m = FixMacModifiers ((modifier & ~consumedModifiers), 0) & accelMods; + AddIfNotDuplicate (accelList, new KeyboardShortcut ((Gdk.Key)keyval, m)); + } + + //with group 1 and shift composed + if (grp == 1 && (modifier & Gdk.ModifierType.ShiftMask) != 0) { + keymap.TranslateKeyboardState (evt.HardwareKeycode, modifier, 1, + out keyval, out effectiveGroup, out level, out consumedModifiers); + var m = FixMacModifiers ((modifier & ~consumedModifiers), 0) & accelMods; + AddIfNotDuplicate (accelList, new KeyboardShortcut ((Gdk.Key)keyval, m)); + } + + //and also allow the fully mapped key as an accel + AddIfNotDuplicate (accelList, new KeyboardShortcut (mapped.Key, mapped.State & accelMods)); + + mapped.Accels = accelList.ToArray (); + return mapped; + } + + static Gdk.ModifierType FixMacModifiers (Gdk.ModifierType mod, byte grp) + { + if (!oldMacKeyHacks) + return mod; + + // Mac GTK+ maps the command key to the Mod1 modifier, which usually means alt/ + // We map this instead to meta, because the Mac GTK+ has mapped the cmd key + // to the meta key (yay inconsistency!). IMO super would have been saner. + if ((mod & Gdk.ModifierType.Mod1Mask) != 0) { + mod ^= Gdk.ModifierType.Mod1Mask; + mod |= Gdk.ModifierType.MetaMask; + } + + //some versions of GTK map opt as mod5, which converts to the virtual super modifier + if ((mod & (Gdk.ModifierType.Mod5Mask | Gdk.ModifierType.SuperMask)) != 0) { + mod ^= (Gdk.ModifierType.Mod5Mask | Gdk.ModifierType.SuperMask); + mod |= Gdk.ModifierType.Mod1Mask; + } + + // When opt modifier is active, we need to decompose this to make the command appear correct for Mac. + // In addition, we can only inspect whether the opt/alt key is pressed by examining + // the key's "group", because the Mac GTK+ treats opt as a group modifier and does + // not expose it as an actual GDK modifier. + if (grp == (byte) 1) { + mod |= Gdk.ModifierType.Mod1Mask; + } + + return mod; + } + + static void AddIfNotDuplicate<T> (List<T> list, T item) where T : IEquatable<T> + { + for (int i = 0; i < list.Count; i++) { + if (list[i].Equals (item)) + return; + } + list.Add (item); + } + + /// <summary>Map raw GTK key input to work around platform bugs and decompose accelerator keys</summary> + /// <param name='evt'>The raw key event</param> + /// <param name='key'>The decomposed accelerator key</param> + /// <param name='mod'>The decomposed accelerator modifiers</param> + /// <param name='keyval'>The fully mapped keyval</param> + [Obsolete ("Use MapKeys")] + public static void MapRawKeys (Gdk.EventKey evt, out Gdk.Key key, out Gdk.ModifierType mod, out uint keyval) + { + Gdk.Key mappedKey; + Gdk.ModifierType mappedMod; + KeyboardShortcut[] accels; + MapKeys (evt, out mappedKey, out mappedMod, out accels); + + keyval = (uint) mappedKey; + key = accels[0].Key; + mod = accels[0].Modifier; + } + [System.Runtime.InteropServices.DllImport ("libgdk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern IntPtr gdk_win32_drawable_get_handle (IntPtr drawable); @@ -257,4 +566,40 @@ namespace Mono.TextEditor ctx.CursorLocation = cursor; } } -} + + public struct KeyboardShortcut : IEquatable<KeyboardShortcut> + { + Gdk.Key key; + Gdk.ModifierType mod; + + public KeyboardShortcut (Gdk.Key key, Gdk.ModifierType mod) + { + this.key = key; + this.mod = mod; + } + + public Gdk.Key Key { + get { return key; } + } + + public Gdk.ModifierType Modifier { + get { return mod; } + } + + public override bool Equals (object obj) + { + return obj is KeyboardShortcut && this.Equals ((KeyboardShortcut)obj); + } + + public override int GetHashCode () + { + //FIXME: we're only using a few bits of mod and mostly the lower bits of key - distribute it better + return (int)key ^ (int)mod; + } + + public bool Equals (KeyboardShortcut other) + { + return other.key == key && other.mod == mod; + } + } +}
\ No newline at end of file diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/GutterMargin.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/GutterMargin.cs index a2c2ea943b..33559c6773 100644 --- a/main/src/core/Mono.Texteditor/Mono.TextEditor/GutterMargin.cs +++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/GutterMargin.cs @@ -150,7 +150,7 @@ namespace Mono.TextEditor { base.MouseHover (args); - if (args.Button == 1) { + if (!args.TriggersContextMenu () && args.Button == 1) { // DocumentLocation loc = editor.Document.LogicalToVisualLocation (editor.GetTextEditorData (), editor.Caret.Location); int lineNumber = args.LineNumber >= DocumentLocation.MinLine ? args.LineNumber : editor.Document.LineCount; diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Margin.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Margin.cs index 8003ef2fd8..33f67e39b6 100644 --- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Margin.cs +++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Margin.cs @@ -127,6 +127,11 @@ namespace Mono.TextEditor private set; } + /// <summary> + /// The raw GDK event. May be null if the event was synthesized. + /// </summary> + public Gdk.Event RawEvent { get; private set; } + public Gdk.EventType Type { get; private set; @@ -142,6 +147,12 @@ namespace Mono.TextEditor private set; } + public bool TriggersContextMenu () + { + var evt = RawEvent as Gdk.EventButton; + return evt != null && evt.TriggersContextMenu (); + } + int lineNumber = -2; // -2 means that line number has not yet been calculated public int LineNumber { get { @@ -171,14 +182,21 @@ namespace Mono.TextEditor private set; } - public MarginMouseEventArgs (TextEditor editor, uint button, double x, double y, Gdk.EventType type, Gdk.ModifierType modifierState) + public MarginMouseEventArgs (TextEditor editor, Gdk.Event raw, uint button, double x, double y, Gdk.ModifierType modifierState) + : this (editor, raw.Type, button, x, y, modifierState) + { + this.RawEvent = raw; + } + + public MarginMouseEventArgs (TextEditor editor, Gdk.EventType type, uint button, double x, double y, Gdk.ModifierType modifierState) { this.Editor = editor; + this.Type = type; + this.Button = button; this.X = x; this.Y = y; - this.Type = type; this.ModifierState = modifierState; } } -} +}
\ No newline at end of file diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Platform.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Platform.cs index aeb4d7c19e..ec2f51e5ee 100755 --- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Platform.cs +++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Platform.cs @@ -38,14 +38,8 @@ namespace Mono.TextEditor IsWindows = System.IO.Path.DirectorySeparatorChar == '\\'; IsMac = !IsWindows && IsRunningOnMac(); IsX11 = !IsMac && System.Environment.OSVersion.Platform == PlatformID.Unix; - - keymap.KeysChanged += delegate { - groupZeroMappings.Clear (); - }; } - static Gdk.Keymap keymap = Gdk.Keymap.Default; - public static bool IsMac { get; private set; } public static bool IsX11 { get; private set; } public static bool IsWindows { get; private set; } @@ -72,103 +66,5 @@ namespace Mono.TextEditor [DllImport ("libc")] static extern int uname (IntPtr buf); - - //from MonoDevelop.Components.Commands.KeyBindingManager - internal static void MapRawKeys (Gdk.EventKey evt, out Gdk.Key key, out Gdk.ModifierType mod, out uint keyval) - { - mod = evt.State; - key = evt.Key; - keyval = evt.KeyValue; - - int effectiveGroup, level; - Gdk.ModifierType consumedModifiers; - ModifierType modifier = evt.State; - byte grp = evt.Group; - // Workaround for bug "Bug 688247 - Ctrl+Alt key not work on windows7 with bootcamp on a Mac Book Pro" - // Ctrl+Alt should behave like right alt key - unfortunately TranslateKeyboardState doesn't handle it. - if (IsWindows && (modifier & ~ModifierType.LockMask) == (ModifierType.Mod1Mask | ModifierType.ControlMask)) { - modifier = ModifierType.Mod2Mask; - grp = 1; - } - - keymap.TranslateKeyboardState (evt.HardwareKeycode, modifier, grp, out keyval, out effectiveGroup, - out level, out consumedModifiers); - key = (Gdk.Key)keyval; - mod = modifier & ~consumedModifiers; - - if (IsX11) { - //this is a workaround for a common X mapping issue - //where the alt key is mapped to the meta key when the shift modifier is active - if (key.Equals (Gdk.Key.Meta_L) || key.Equals (Gdk.Key.Meta_R)) - key = Gdk.Key.Alt_L; - } - - //HACK: the MAC GTK+ port currently does some horrible, un-GTK-ish key mappings - // so we work around them by playing some tricks to remap and decompose modifiers. - // We also decompose keys to the root physical key so that the Mac command - // combinations appear as expected, e.g. shift-{ is treated as shift-[. - if (IsMac && !IsX11) { - // Mac GTK+ maps the command key to the Mod1 modifier, which usually means alt/ - // We map this instead to meta, because the Mac GTK+ has mapped the cmd key - // to the meta key (yay inconsistency!). IMO super would have been saner. - if ((mod & Gdk.ModifierType.Mod1Mask) != 0) { - mod ^= Gdk.ModifierType.Mod1Mask; - mod |= Gdk.ModifierType.MetaMask; - } - - // If Mod5 is active it *might* mean that opt/alt is active, - // so we can unset this and map it back to the normal modifier. - if ((mod & Gdk.ModifierType.Mod5Mask) != 0) { - mod ^= Gdk.ModifierType.Mod5Mask; - mod |= Gdk.ModifierType.Mod1Mask; - } - - // When opt modifier is active, we need to decompose this to make the command appear correct for Mac. - // In addition, we can only inspect whether the opt/alt key is pressed by examining - // the key's "group", because the Mac GTK+ treats opt as a group modifier and does - // not expose it as an actual GDK modifier. - if (evt.Group == (byte) 1) { - mod |= Gdk.ModifierType.Mod1Mask; - key = GetGroupZeroKey (key, evt); - } - - // Fix for allow ctrl+shift+a/ctrl+shift+e keys on mac (select to line begin/end actions) - if ((key == Gdk.Key.A || key == Gdk.Key.E) && (evt.State & (Gdk.ModifierType.ShiftMask | Gdk.ModifierType.ControlMask)) == (Gdk.ModifierType.ShiftMask | Gdk.ModifierType.ControlMask)) - mod = Gdk.ModifierType.ShiftMask | Gdk.ModifierType.ControlMask; - } - - //fix shift-tab weirdness. There isn't a nice name for untab, so make it shift-tab - if (key == Gdk.Key.ISO_Left_Tab) { - key = Gdk.Key.Tab; - mod |= Gdk.ModifierType.ShiftMask; - } - - if ((key == Gdk.Key.space || key == Gdk.Key.parenleft || key == Gdk.Key.parenright) && (mod & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) - mod = ModifierType.None; - } - - static Dictionary<Gdk.Key,Gdk.Key> groupZeroMappings = new Dictionary<Gdk.Key,Gdk.Key> (); - - static Gdk.Key GetGroupZeroKey (Gdk.Key mappedKey, Gdk.EventKey evt) - { - Gdk.Key ret; - if (groupZeroMappings.TryGetValue (mappedKey, out ret)) - return ret; - - //LookupKey isn't implemented on Mac, so we have to use this workaround - uint[] keyvals; - Gdk.KeymapKey [] keys; - keymap.GetEntriesForKeycode (evt.HardwareKeycode, out keys, out keyvals); - - //find the key that has the same level (so we preserve shift) but with group 0 - for (uint i = 0; i < keyvals.Length; i++) - if (keyvals[i] == (uint)mappedKey) - for (uint j = 0; j < keys.Length; j++) - if (keys[j].Group == 0 && keys[j].Level == keys[i].Level) - return groupZeroMappings[mappedKey] = ret = (Gdk.Key)keyvals[j]; - - //failed, but avoid looking it up again - return groupZeroMappings[mappedKey] = mappedKey; - } } }
\ No newline at end of file diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/TextEditor.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/TextEditor.cs index 4d4146366e..c495a689f3 100644 --- a/main/src/core/Mono.Texteditor/Mono.TextEditor/TextEditor.cs +++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/TextEditor.cs @@ -889,7 +889,7 @@ namespace Mono.TextEditor ModifierType mod; Gdk.Key key; uint keyVal; - Platform.MapRawKeys (evt, out key, out mod, out keyVal); + GtkWorkarounds.MapRawKeys (evt, out key, out mod, out keyVal); if (key == Gdk.Key.F1 && (mod & (ModifierType.ControlMask | ModifierType.ShiftMask)) == ModifierType.ControlMask) { var p = LocationToPoint (Caret.Location); ShowTooltip (Gdk.ModifierType.None, Caret.Offset, p.X, p.Y); @@ -900,6 +900,9 @@ namespace Mono.TextEditor return true; } + if ((key == Gdk.Key.space || key == Gdk.Key.parenleft || key == Gdk.Key.parenright) && (mod & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) + mod = Gdk.ModifierType.None; + uint unicodeChar = Gdk.Keyval.ToUnicode (keyVal); if (CurrentMode.WantsToPreemptIM || CurrentMode.PreemptIM (key, unicodeChar, mod)) { @@ -939,6 +942,20 @@ namespace Mono.TextEditor pressPositionX = e.X; pressPositionY = e.Y; base.IsFocus = true; + + //main context menu + if (DoPopupMenu != null && e.TriggersContextMenu ()) { + double tmOffset = e.X - textViewMargin.XOffset; + if (tmOffset >= 0) { + DocumentLocation loc = PointToLocation (tmOffset, e.Y); + if (!this.IsSomethingSelected || !this.SelectionRange.Contains (Document.LocationToOffset (loc))) + Caret.Location = loc; + DoPopupMenu (e); + this.ResetMouseState (); + return true; + } + } + if (lastTime != e.Time) {// filter double clicks if (e.Type == EventType.TwoButtonPress) { lastTime = e.Time; @@ -949,15 +966,21 @@ namespace Mono.TextEditor double startPos; Margin margin = GetMarginAtX (e.X, out startPos); if (margin != null) - margin.MousePressed (new MarginMouseEventArgs (this, e.Button, e.X - startPos, e.Y, e.Type, e.State)); + margin.MousePressed (new MarginMouseEventArgs (this, e, e.Button, e.X - startPos, e.Y, e.State)); } return base.OnButtonPressEvent (e); } - /* protected override bool OnWidgetEvent (Event evnt) + + public Action<Gdk.EventButton> DoPopupMenu { get; set; } + + protected override bool OnPopupMenu () { - Console.WriteLine (evnt.Type); - return base.OnWidgetEvent (evnt); - }*/ + if (DoPopupMenu != null) { + DoPopupMenu (null); + return true; + } + return base.OnPopupMenu (); + } public Margin LockedMargin { get; @@ -993,7 +1016,7 @@ namespace Mono.TextEditor double startPos; Margin margin = GetMarginAtX (e.X, out startPos); if (margin != null) - margin.MouseReleased (new MarginMouseEventArgs (this, e.Button, e.X - startPos, e.Y, EventType.ButtonRelease, e.State)); + margin.MouseReleased (new MarginMouseEventArgs (this, e, e.Button, e.X - startPos, e.Y, e.State)); ResetMouseState (); return base.OnButtonReleaseEvent (e); } @@ -1186,7 +1209,8 @@ namespace Mono.TextEditor oldMargin.MouseLeft (); if (margin != null) - margin.MouseHover (new MarginMouseEventArgs (this, mouseButtonPressed, x - startPos, y, EventType.MotionNotify, state)); + margin.MouseHover (new MarginMouseEventArgs (this, EventType.MotionNotify, + mouseButtonPressed, x - startPos, y, state)); oldMargin = margin; } diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/TextViewMargin.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/TextViewMargin.cs index a9b6feb51a..32abc0088a 100644 --- a/main/src/core/Mono.Texteditor/Mono.TextEditor/TextViewMargin.cs +++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/TextViewMargin.cs @@ -1531,6 +1531,10 @@ namespace Mono.TextEditor protected internal override void MousePressed (MarginMouseEventArgs args) { base.MousePressed (args); + + if (args.TriggersContextMenu ()) + return; + inSelectionDrag = false; inDrag = false; Selection selection = textEditor.MainSelection; diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/BrandingService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/BrandingService.cs index fb0592c6e8..6ba2b46305 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/BrandingService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/BrandingService.cs @@ -129,21 +129,31 @@ namespace MonoDevelop.Core } [MethodImpl (MethodImplOptions.NoInlining)] - public static Stream GetStream (string name) + public static FilePath GetFile (string name) { - //read branding directory, then calling assembly's resources if (localizedBrandingDir != null) { var file = localizedBrandingDir.Combine (name); if (File.Exists (file)) - return File.OpenRead (file); + return file; } if (brandingDir != null) { var file = brandingDir.Combine (name); if (File.Exists (file)) - return File.OpenRead (file); + return file; } + return null; + } + + [MethodImpl (MethodImplOptions.NoInlining)] + public static Stream GetStream (string name, bool lookInCallingAssembly=false) + { + //read branding directory, then calling assembly's resources + var file = GetFile (name); + if (file != null) + return File.OpenRead (file); + return Assembly.GetCallingAssembly ().GetManifestResourceStream (name); } } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Dom.Parser/ProjectDomService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Dom.Parser/ProjectDomService.cs index e92bf7171c..378dcbfbb0 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Dom.Parser/ProjectDomService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Dom.Parser/ProjectDomService.cs @@ -416,11 +416,7 @@ namespace MonoDevelop.Projects.Dom.Parser string uri = "Project:" + project.FileName; if (UnrefDom (uri)) { - project.Modified -= HandleModified; - if (project is DotNetProject) { - ((DotNetProject)project).ReferenceAddedToProject -= OnProjectReferenceAdded; - ((DotNetProject)project).ReferenceRemovedFromProject -= OnProjectReferenceRemoved; - } + project.Modified -= HandleModified; } } @@ -444,10 +440,6 @@ namespace MonoDevelop.Projects.Dom.Parser ProjectDom db = ParserDatabase.LoadProjectDom (project); RegisterDom (db, uri); project.Modified += HandleModified; - if (project is DotNetProject) { - ((DotNetProject)project).ReferenceAddedToProject += OnProjectReferenceAdded; - ((DotNetProject)project).ReferenceRemovedFromProject += OnProjectReferenceRemoved; - } } catch (Exception ex) { LoggingService.LogError ("Parser database for project '" + project.Name + " could not be loaded", ex); } @@ -469,7 +461,7 @@ namespace MonoDevelop.Projects.Dom.Parser databases.Remove (pair.Key); string uri = "Project:" + project.FileName; pair.Value.Uri = uri; - databases[uri] = pair.Value; + databases [uri] = pair.Value; return; } } @@ -642,22 +634,6 @@ namespace MonoDevelop.Projects.Dom.Parser Unload ((Project) args.SolutionItem); } - static void OnProjectReferenceAdded (object sender, ProjectReferenceEventArgs args) - { - ProjectDom db = GetProjectDom (args.Project); - if (db != null) { - db.OnProjectReferenceAdded (args.ProjectReference); - } - } - - static void OnProjectReferenceRemoved (object sender, ProjectReferenceEventArgs args) - { - ProjectDom db = GetProjectDom (args.Project); - if (db != null) { - db.OnProjectReferenceRemoved (args.ProjectReference); - } - } - internal static int PendingJobCount { get { lock (parseQueueLock) { diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Dom.Serialization/ProjectCodeCompletionDatabase.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Dom.Serialization/ProjectCodeCompletionDatabase.cs new file mode 100644 index 0000000000..c7cb9eb539 --- /dev/null +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Dom.Serialization/ProjectCodeCompletionDatabase.cs @@ -0,0 +1,333 @@ +// +// ProjectCodeCompletionDatabase.cs +// +// Author: +// Lluis Sanchez Gual +// +// Copyright (C) 2005 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.Linq; +using System.Collections; +using System.Collections.Generic; +using System.IO; + +using MonoDevelop.Core; +using MonoDevelop.Projects; +using MonoDevelop.Projects.Dom.Parser; +using MonoDevelop.Core.Assemblies; +using System.Reflection; + +namespace MonoDevelop.Projects.Dom.Serialization +{ + internal class ProjectCodeCompletionDatabase : SerializationCodeCompletionDatabase + { + Project project; + bool initialFileCheck; + int parseCount; + + public ProjectCodeCompletionDatabase (Project project, ParserDatabase pdb): base (pdb, true) + { + Counters.LiveProjectDatabases++; + this.project = project; + SetLocation (project.BaseDirectory, project.Name); + + Read (); + + UpdateFromProject (); + + project.FileChangedInProject += new ProjectFileEventHandler (OnFileChanged); + project.FileAddedToProject += new ProjectFileEventHandler (OnFileAdded); + project.FileRemovedFromProject += new ProjectFileEventHandler (OnFileRemoved); + project.FileRenamedInProject += new ProjectFileRenamedEventHandler (OnFileRenamed); + project.Modified += new SolutionItemModifiedEventHandler (OnProjectModified); + + initialFileCheck = true; + } + + public override Project Project { + get { return project; } + } + + public override void Dispose () + { + Counters.LiveProjectDatabases--; + base.Dispose (); + project.FileChangedInProject -= new ProjectFileEventHandler (OnFileChanged); + project.FileAddedToProject -= new ProjectFileEventHandler (OnFileAdded); + project.FileRemovedFromProject -= new ProjectFileEventHandler (OnFileRemoved); + project.FileRenamedInProject -= new ProjectFileRenamedEventHandler (OnFileRenamed); + project.Modified -= new SolutionItemModifiedEventHandler (OnProjectModified); + } + + public override void CheckModifiedFiles () + { + // Once the first modification check is done, change detection + // is done through project events + + if (initialFileCheck) + base.CheckModifiedFiles (); + initialFileCheck = false; + } + + void OnFileChanged (object sender, ProjectFileEventArgs args) + { + foreach (ProjectFileEventInfo fargs in args) { + FileEntry file = GetFile (fargs.ProjectFile.Name); + if (file != null) { + file.ParseErrorRetries = 0; + QueueParseJob (file); + } + } + } + + void OnFileAdded (object sender, ProjectFileEventArgs args) + { + foreach (ProjectFileEventInfo fargs in args) { + FileEntry file = AddFile (fargs.ProjectFile.Name); + // CheckModifiedFiles won't detect new files, so parsing + // must be manyally signaled + QueueParseJob (file); + } + } + + void OnFileRemoved (object sender, ProjectFileEventArgs args) + { + foreach (ProjectFileEventInfo fargs in args) + RemoveFile (fargs.ProjectFile.Name); + } + + void OnFileRenamed (object sender, ProjectFileRenamedEventArgs args) + { + foreach (ProjectFileRenamedEventInfo fargs in args) { + RemoveFile (fargs.OldName); + FileEntry file = AddFile (fargs.NewName); + // CheckModifiedFiles won't detect new files, so parsing + // must be manyally signaled + QueueParseJob (file); + } + } + + void OnProjectModified (object s, SolutionItemModifiedEventArgs args) + { + foreach (var a in args.OfType<SolutionItemModifiedEventInfo> ()) { + if (a.Hint == "TargetFramework") { + if (UpdateFromProject ()) { + SourceProjectDom.UpdateReferences (); + return; + } + } + if (a.Hint == "References") { + UpdateFromProject (); + SourceProjectDom.UpdateReferences (); + return; + } + } + } + + internal static string GetReferenceUri (DotNetProject netProject, string file) + { + string fileName; + if (!Path.IsPathRooted (file)) { + fileName = Path.Combine (Path.GetDirectoryName (netProject.FileName), file); + } else { + fileName = Path.GetFullPath (file); + } + return "Assembly:" + netProject.TargetRuntime.Id + ":" + fileName; + } + + public bool UpdateFromProject () + { + Hashtable fs = new Hashtable (); + foreach (ProjectFile file in project.Files) { + if (GetFile (file.Name) == null) + AddFile (file.Name); + fs [file.Name] = null; + } + + foreach (string file in files.Keys.ToArray ()) { + if (!fs.Contains (file)) + RemoveFile (file); + } + + fs.Clear (); + if (project is DotNetProject) { + DotNetProject netProject = (DotNetProject)project; + foreach (SolutionItem pr in netProject.GetReferencedItems (ConfigurationSelector.Default)) { + if (pr is Project) { + string refId = "Project:" + ((Project)pr).FileName; + fs [refId] = null; + if (!HasReference (refId)) + AddReference (refId); + } + } + + // Get the assembly references throught the project, since it may have custom references + foreach (string file in netProject.GetReferencedAssemblies (ConfigurationSelector.Default, false)) { + string refId = GetReferenceUri (netProject, file); + fs [refId] = null; + if (!HasReference (refId)) + AddReference (refId); + } + } + + foreach (ReferenceEntry re in References) { + // Don't delete corlib references. They are implicit to projects, but not to pidbs. + if (!fs.Contains (re.Uri) && !IsCorlibReference (re)) + RemoveReference (re.Uri); + } + return UpdateCorlibReference (); + } + + bool UpdateCorlibReference () + { + // Creates a reference to the correct version of mscorlib, depending + // on the target runtime version. Returns true if the references + // have changed. + + DotNetProject prj = project as DotNetProject; + if (prj == null) return false; + + // Look for an existing mscorlib reference + string currentRefUri = null; + foreach (ReferenceEntry re in References) { + if (IsCorlibReference (re)) { + currentRefUri = re.Uri; + break; + } + } + + // Gets the name and version of the mscorlib assembly required by the project + string requiredRefUri = "Assembly:" + prj.TargetRuntime.Id + ":"; + SystemAssembly asm = prj.TargetRuntime.AssemblyContext.GetAssemblyForVersion (typeof(object).Assembly.FullName, null, prj.TargetFramework); + if (asm == null) { + LoggingService.LogWarning ("mscorlib assembly not found for framework '" + prj.TargetFramework.Id + "'. The framework may not be installed."); + return false; + } + requiredRefUri += asm.Location; + + // Replace the old reference if the target version has changed + if (currentRefUri != null) { + if (currentRefUri != requiredRefUri) { + RemoveReference (currentRefUri); + AddReference (requiredRefUri); + return true; + } + } else { + AddReference (requiredRefUri); + return true; + } + return false; + } + + bool IsCorlibReference (ReferenceEntry re) + { + TargetRuntime tr; + TargetFramework fx; + string file; + if (ProjectDomService.ParseAssemblyUri (re.Uri, out tr, out fx, out file)) + return Path.GetFileNameWithoutExtension (file) == "mscorlib"; + else + return false; + } + + protected override void ParseFile (string fileName, IProgressMonitor monitor) + { + if (monitor != null) monitor.BeginTask (string.Format (GettextCatalog.GetString ("Parsing file: {0}"), Path.GetFileName (fileName)), 1); + + try { + ProjectDomService.Parse (project, fileName); + // The call to ProjectDomService.Parse will call UpdateFromParseInfo when done + } finally { + if (monitor != null) monitor.EndTask (); + } + } + + int totalUnresolvedCount; + + public TypeUpdateInformation UpdateFromParseInfo (ICompilationUnit parserInfo, string fileName, bool isFromFile) + { + lock (rwlock) { + ICompilationUnit cu = parserInfo; + + List<IType> resolved; + List<IAttribute> resolvedAtts; + + int unresolvedCount = ResolveTypes (cu, cu.Types, cu.Attributes, out resolved, out resolvedAtts); + totalUnresolvedCount += unresolvedCount; + + TypeUpdateInformation res = UpdateTypeInformation (resolved, resolvedAtts, parserInfo.FileName); + + FileEntry file; + if (files.TryGetValue (fileName, out file)) { + if (unresolvedCount > 0) { + if (file.ParseErrorRetries != 1) { + file.ParseErrorRetries = 1; + + // Enqueue the file for quickly reparse. Types can't be resolved most probably because + // the file that implements them is not yet parsed. + + if (isFromFile) { + // To reduce memory usage, we don't keep the compilation unit in memory if the + // content comes from a saved file. We'll just reparse the file. + file.InParseQueue = false; + QueueParseJob (file); + } else { + ProjectDomService.QueueParseJob (SourceProjectDom, + delegate { UpdateFromParseInfo (parserInfo, fileName, false); }, + file.FileName); + } + } + } + else { + file.ParseErrorRetries = 0; + } + } + + if ((++parseCount % MAX_ACTIVE_COUNT) == 0) + Flush (); + return res; + } + } + + protected override void OnFileRemoved (string fileName, TypeUpdateInformation classInfo) + { + if (classInfo.Removed.Count > 0) + ProjectDomService.NotifyTypeUpdate (project, fileName, classInfo); + } + + protected internal override void ForceUpdateBROKEN () + { + int lastCount; + totalUnresolvedCount = int.MaxValue; + + do { + // Keep trying updating the db while types are being resolved + lastCount = totalUnresolvedCount; + totalUnresolvedCount = 0; + base.ForceUpdateBROKEN (); + } + while (totalUnresolvedCount != 0 && totalUnresolvedCount < lastCount); + } + } +} diff --git a/main/src/core/MonoDevelop.Ide/Makefile.am b/main/src/core/MonoDevelop.Ide/Makefile.am index 868bb5eca9..b1b4b51d03 100644 --- a/main/src/core/MonoDevelop.Ide/Makefile.am +++ b/main/src/core/MonoDevelop.Ide/Makefile.am @@ -41,7 +41,6 @@ FILES = \ gtk-gui/MonoDevelop.Ide.Execution.MonoExecutionParametersWidget.cs \ gtk-gui/MonoDevelop.Ide.ExternalTools.ExternalToolPanelWidget.cs \ gtk-gui/MonoDevelop.Ide.FindInFiles.FindInFilesDialog.cs \ - gtk-gui/MonoDevelop.Ide.FindInFiles.SearchResultWidget.cs \ gtk-gui/MonoDevelop.Ide.Fonts.FontChooserPanelWidget.cs \ gtk-gui/MonoDevelop.Ide.Gui.Components.ExecutionModeComboBox.cs \ gtk-gui/MonoDevelop.Ide.Gui.Components.PriorityList.cs \ @@ -245,6 +244,7 @@ FILES = \ MonoDevelop.Components/CellRendererComboBox.cs \ MonoDevelop.Components/CompactScrolledWindow.cs \ MonoDevelop.Components/ConsoleView.cs \ + MonoDevelop.Components/ContextMenuTreeView.cs \ MonoDevelop.Components/DataGrid.cs \ MonoDevelop.Components/DropDownBox.cs \ MonoDevelop.Components/DropDownBoxListWindow.cs \ @@ -526,8 +526,6 @@ FILES = \ MonoDevelop.Ide.Gui.Pads.ProjectPad/WorkspaceNodeBuilder.cs \ MonoDevelop.Ide.Gui.Pads/DefaultMonitorPad.cs \ MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs \ - MonoDevelop.Ide.Gui.Pads/FileList.cs \ - MonoDevelop.Ide.Gui.Pads/FileListItem.cs \ MonoDevelop.Ide.Gui.Pads/InternalLogPad.cs \ MonoDevelop.Ide.Gui.Pads/MonodocTreePad.cs \ MonoDevelop.Ide.Gui.Pads/SolutionPad.cs \ diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Chart/BasicChart.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Chart/BasicChart.cs index 52304a20f2..21e9fc9aad 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Chart/BasicChart.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Chart/BasicChart.cs @@ -31,6 +31,7 @@ using System.Collections; using System.Collections.Generic; using Gtk; using Gdk; +using Mono.TextEditor; namespace MonoDevelop.Components.Chart { @@ -836,7 +837,7 @@ namespace MonoDevelop.Components.Chart protected override bool OnButtonPressEvent (Gdk.EventButton ev) { - if (ev.Button == 1) { + if (!ev.TriggersContextMenu () && ev.Button == 1) { foreach (ChartCursor cursor in cursors) { int cx, cy; GetPoint (cursor.Value, cursor.Value, out cx, out cy); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandFrame.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandFrame.cs index 218a1d75f6..836250a967 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandFrame.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandFrame.cs @@ -29,6 +29,7 @@ using System; using Mono.Addins; using MonoDevelop.Components.DockToolbars; +using Mono.TextEditor; namespace MonoDevelop.Components.Commands { @@ -62,7 +63,7 @@ namespace MonoDevelop.Components.Commands protected override void OnPanelClick (Gdk.EventButton e, Placement placement) { - if (e.Button == 3) { + if (e.TriggersContextMenu ()) { CommandEntrySet opset = new CommandEntrySet (); opset.AddItem (CommandSystemCommands.ToolbarList); Gtk.Menu menu = manager.CreateMenu (opset); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs index fe50782c37..6b12a16cc6 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs @@ -142,11 +142,24 @@ namespace MonoDevelop.Components.Commands return CreateMenu (cset); } + public void ShowContextMenu (Gtk.Widget parent, Gdk.EventButton evt, string addinPath) + { + ShowContextMenu (parent, evt, CreateCommandEntrySet (addinPath)); + } + + public void ShowContextMenu (Gtk.Widget parent, Gdk.EventButton evt, + ExtensionContext ctx, string addinPath) + { + ShowContextMenu (parent, evt, CreateCommandEntrySet (ctx, addinPath)); + } + + [Obsolete("Use ShowContextMenu (Gtk.Widget parent, Gdk.EventButton evt, ...)")] public void ShowContextMenu (string addinPath) { ShowContextMenu (CreateCommandEntrySet (addinPath)); } + [Obsolete("Use ShowContextMenu (Gtk.Widget parent, Gdk.EventButton evt, ...)")] public void ShowContextMenu (ExtensionContext ctx, string addinPath) { ShowContextMenu (CreateCommandEntrySet (ctx, addinPath)); @@ -434,6 +447,13 @@ namespace MonoDevelop.Components.Commands return CreateMenu (entrySet, new CommandMenu (this)); } + public Gtk.Menu CreateMenu (CommandEntrySet entrySet, object initialTarget) + { + var menu = (CommandMenu) CreateMenu (entrySet, new CommandMenu (this)); + menu.InitialCommandTarget = initialTarget; + return menu; + } + public void InsertOptions (Gtk.Menu menu, CommandEntrySet entrySet, int index) { CommandTargetRoute route = new CommandTargetRoute (); @@ -452,28 +472,55 @@ namespace MonoDevelop.Components.Commands } } + public void ShowContextMenu (Gtk.Widget parent, Gdk.EventButton evt, CommandEntrySet entrySet, + object initialCommandTarget = null) + { + var menu = CreateMenu (entrySet); + if (menu != null) + ShowContextMenu (parent, evt, menu, initialCommandTarget); + } + + public void ShowContextMenu (Gtk.Widget parent, Gdk.EventButton evt, Gtk.Menu menu, + object initialCommandTarget = null) + { + if (menu is CommandMenu) { + ((CommandMenu)menu).InitialCommandTarget = initialCommandTarget ?? parent; + } + + Mono.TextEditor.GtkWorkarounds.ShowContextMenu (menu, parent, evt); + } + + [Obsolete ("Use ShowContextMenu (Gtk.Widget parent, Gdk.EventButton evt, ...)")] + public void ShowContextMenu (Gtk.Menu menu, object initialCommandTarget, Gdk.EventButton evt) + { + if (menu is CommandMenu) { + ((CommandMenu)menu).InitialCommandTarget = initialCommandTarget; + } + ShowContextMenu (null, evt, menu, initialCommandTarget); + } + + [Obsolete ("Use ShowContextMenu (Gtk.Widget parent, Gdk.EventButton evt, ...)")] public void ShowContextMenu (CommandEntrySet entrySet) { ShowContextMenu (entrySet, null); } + [Obsolete ("Use ShowContextMenu (Gtk.Widget parent, Gdk.EventButton evt, ...)")] public void ShowContextMenu (CommandEntrySet entrySet, object initialTarget) { - CommandMenu menu = (CommandMenu) CreateMenu (entrySet); - ShowContextMenu (menu, initialTarget); + ShowContextMenu (CreateMenu (entrySet, initialTarget)); } + [Obsolete ("Use ShowContextMenu (Gtk.Widget parent, Gdk.EventButton evt, ...)")] public void ShowContextMenu (Gtk.Menu menu) { - menu.Popup (null, null, null, 0, Gtk.Global.CurrentEventTime); + ShowContextMenu (menu, null, (Gdk.EventButton) null); } + [Obsolete ("Use ShowContextMenu (Gtk.Widget parent, Gdk.EventButton evt, ...)")] public void ShowContextMenu (Gtk.Menu menu, object initialCommandTarget) { - if (menu is CommandMenu) { - ((CommandMenu)menu).InitialCommandTarget = initialCommandTarget; - } - ShowContextMenu (menu); + ShowContextMenu (menu, initialCommandTarget, null); } public Gtk.Toolbar CreateToolbar (CommandEntrySet entrySet) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/KeyBindingManager.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/KeyBindingManager.cs index e96a314acb..0f5388b2d8 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/KeyBindingManager.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/KeyBindingManager.cs @@ -67,10 +67,6 @@ namespace MonoDevelop.Components.Commands SelectionModifierControl = Gdk.ModifierType.ControlMask; SelectionModifierSuper = Gdk.ModifierType.SuperMask; } - - keymap.KeysChanged += delegate { - groupZeroMappings.Clear (); - }; } static Gdk.Keymap keymap = Gdk.Keymap.Default; @@ -150,7 +146,8 @@ namespace MonoDevelop.Components.Commands { Gdk.Key key; Gdk.ModifierType modifier; - MapRawKeys (raw, out key, out modifier); + uint keyVal; + Mono.TextEditor.GtkWorkarounds.MapRawKeys (raw, out key, out modifier, out keyVal); //we restore shift modifier if it was consumed for a letter, as accelerators are always //displayed uppercase, so the shift key must be included in the binding @@ -300,89 +297,6 @@ namespace MonoDevelop.Components.Commands return mode + "|" + accel; } - // NOTE: changes in this should be mirrored in to Mono.TextEditor/Platform.cs - public static void MapRawKeys (Gdk.EventKey evt, out Gdk.Key key, out Gdk.ModifierType mod) - { - mod = evt.State; - key = evt.Key; - - uint keyval; - int effectiveGroup, level; - Gdk.ModifierType consumedModifiers; - keymap.TranslateKeyboardState (evt.HardwareKeycode, evt.State, evt.Group, out keyval, out effectiveGroup, - out level, out consumedModifiers); - - key = (Gdk.Key)keyval; - mod = evt.State & ~consumedModifiers; - - if (isX11) { - //this is a workaround for a common X mapping issue - //where the alt key is mapped to the meta key when the shift modifier is active - if (key.Equals (Gdk.Key.Meta_L) || key.Equals (Gdk.Key.Meta_R)) - key = Gdk.Key.Alt_L; - } - - //HACK: the MAC GTK+ port currently does some horrible, un-GTK-ish key mappings - // so we work around them by playing some tricks to remap and decompose modifiers. - // We also decompose keys to the root physical key so that the Mac command - // combinations appear as expected, e.g. shift-{ is treated as shift-[. - if (isMac && !isX11) { - // Mac GTK+ maps the command key to the Mod1 modifier, which usually means alt/ - // We map this instead to meta, because the Mac GTK+ has mapped the cmd key - // to the meta key (yay inconsistency!). IMO super would have been saner. - if ((mod & Gdk.ModifierType.Mod1Mask) != 0) { - mod ^= Gdk.ModifierType.Mod1Mask; - mod |= Gdk.ModifierType.MetaMask; - } - - // If Mod5 is active it *might* mean that opt/alt is active, - // so we can unset this and map it back to the normal modifier. - if ((mod & Gdk.ModifierType.Mod5Mask) != 0) { - mod ^= Gdk.ModifierType.Mod5Mask; - mod |= Gdk.ModifierType.Mod1Mask; - } - - // When opt modifier is active, we need to decompose this to make the command appear correct for Mac. - // In addition, we can only inspect whether the opt/alt key is pressed by examining - // the key's "group", because the Mac GTK+ treats opt as a group modifier and does - // not expose it as an actual GDK modifier. - if (evt.Group == (byte) 1) { - mod |= Gdk.ModifierType.Mod1Mask; - key = GetGroupZeroKey (key, evt); - } - } - - //fix shift-tab weirdness. There isn't a nice name for untab, so make it shift-tab - if (key == Gdk.Key.ISO_Left_Tab) { - key = Gdk.Key.Tab; - mod |= Gdk.ModifierType.ShiftMask; - } - } - - static Dictionary<Gdk.Key,Gdk.Key> groupZeroMappings = new Dictionary<Gdk.Key,Gdk.Key> (); - - static Gdk.Key GetGroupZeroKey (Gdk.Key mappedKey, Gdk.EventKey evt) - { - Gdk.Key ret; - if (groupZeroMappings.TryGetValue (mappedKey, out ret)) - return ret; - - //LookupKey isn't implemented on Mac, so we have to use this workaround - uint[] keyvals; - Gdk.KeymapKey [] keys; - keymap.GetEntriesForKeycode (evt.HardwareKeycode, out keys, out keyvals); - - //find the key that has the same level (so we preserve shift) but with group 0 - for (uint i = 0; i < keyvals.Length; i++) - if (keyvals[i] == (uint)mappedKey) - for (uint j = 0; j < keys.Length; j++) - if (keys[j].Group == 0 && keys[j].Level == keys[i].Level) - return groupZeroMappings[mappedKey] = ret = (Gdk.Key)keyvals[j]; - - //failed, but avoid looking it up again - return groupZeroMappings[mappedKey] = mappedKey; - } - static string ModifierToPartialAccel (Gdk.ModifierType mod, Gdk.Key key, out bool keyIsModifier) { string label = String.Empty; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbar.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbar.cs index 3777238c32..4e7c905e0f 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbar.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbar.cs @@ -30,6 +30,7 @@ using System; using System.Collections.Generic; using Gtk; using Gdk; +using Mono.TextEditor; namespace MonoDevelop.Components.DockToolbars { @@ -244,7 +245,7 @@ namespace MonoDevelop.Components.DockToolbars protected override bool OnButtonPressEvent (EventButton e) { - if (parentFrame != null && e.Button == 1) { + if (parentFrame != null && e.Button == 1 && !e.TriggersContextMenu ()) { if (Orientation == Orientation.Horizontal && e.X <= 10) { dragging = true; parentFrame.StartDragBar (this, (int)e.X, (int)e.Y, e.Time); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarFrame.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarFrame.cs index 25f3182f43..791bb12428 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarFrame.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarFrame.cs @@ -33,6 +33,7 @@ using System.Collections; using System.Xml; using System.Xml.Serialization; using System.Collections.Generic; +using Mono.TextEditor; namespace MonoDevelop.Components.DockToolbars { @@ -369,7 +370,7 @@ namespace MonoDevelop.Components.DockToolbars protected override bool OnButtonPressEvent (Gdk.EventButton e) { - if (e.Button == 3) { + if (e.TriggersContextMenu ()) { int sx,sy; this.GdkWindow.GetOrigin (out sx, out sy); int rx = (int)e.XRoot - sx; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/AutoHideBox.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/AutoHideBox.cs index 7463709f53..0670fe8f81 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/AutoHideBox.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/AutoHideBox.cs @@ -31,6 +31,7 @@ using System; using Gtk; using Gdk; +using Mono.TextEditor; namespace MonoDevelop.Components.Docking { @@ -261,7 +262,7 @@ namespace MonoDevelop.Components.Docking void OnSizeButtonPress (object ob, Gtk.ButtonPressEventArgs args) { - if (args.Event.Button == 1 && !animating) { + if (!animating && args.Event.Button == 1 && !args.Event.TriggersContextMenu ()) { int n; if (horiz) { Toplevel.GetPointer (out resizePos, out n); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockBarItem.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockBarItem.cs index 9cba56cb93..56d9ffed81 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockBarItem.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockBarItem.cs @@ -31,6 +31,7 @@ using System; using Gtk; +using Mono.TextEditor; namespace MonoDevelop.Components.Docking { @@ -383,14 +384,14 @@ namespace MonoDevelop.Components.Docking protected override bool OnButtonPressEvent (Gdk.EventButton evnt) { - if (evnt.Button == 1) { + if (evnt.TriggersContextMenu ()) { + it.ShowDockPopupMenu (evnt.Time); + } else if (evnt.Button == 1) { if (evnt.Type == Gdk.EventType.TwoButtonPress) it.Status = DockItemStatus.Dockable; else AutoShow (); } - else if (evnt.Button == 3) - it.ShowDockPopupMenu (evnt.Time); return base.OnButtonPressEvent (evnt); } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemContainer.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemContainer.cs index 0c40762e3c..e24abeb24c 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemContainer.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemContainer.cs @@ -31,6 +31,7 @@ using System; using Gtk; using Mono.Unix; +using Mono.TextEditor; namespace MonoDevelop.Components.Docking { @@ -198,21 +199,20 @@ namespace MonoDevelop.Components.Docking void HeaderButtonPress (object ob, Gtk.ButtonPressEventArgs args) { - if (args.Event.Button == 1) { + if (args.Event.TriggersContextMenu ()) { + item.ShowDockPopupMenu (args.Event.Time); + } else if (args.Event.Button == 1) { frame.ShowPlaceholder (); header.GdkWindow.Cursor = fleurCursor; frame.Toplevel.KeyPressEvent += HeaderKeyPress; frame.Toplevel.KeyReleaseEvent += HeaderKeyRelease; allowPlaceholderDocking = true; } - else if (args.Event.Button == 3) { - item.ShowDockPopupMenu (args.Event.Time); - } } void HeaderButtonRelease (object ob, Gtk.ButtonReleaseEventArgs args) { - if (args.Event.Button == 1) { + if (!args.Event.TriggersContextMenu () && args.Event.Button == 1) { frame.DockInPlaceholder (item); frame.HidePlaceholder (); if (header.GdkWindow != null) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ConsoleView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ConsoleView.cs index 852e4346fd..626a096464 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ConsoleView.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ConsoleView.cs @@ -42,8 +42,6 @@ namespace MonoDevelop.Components bool inBlock = false; string blockText = ""; - - bool auto_indent; TextView textView; @@ -73,6 +71,8 @@ namespace MonoDevelop.Components } public string PromptString { get; set; } + + public bool AutoIndent { get; set; } public string PromptMultiLineString { get; set; } @@ -108,14 +108,14 @@ namespace MonoDevelop.Components } else { blockText += "\n" + InputLine; string whiteSpace = null; - if (auto_indent) { + if (AutoIndent) { System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex (@"^(\s+).*"); whiteSpace = r.Replace (InputLine, "$1"); if (InputLine.EndsWith (BlockStart)) whiteSpace += "\t"; } Prompt (true, true); - if (auto_indent) + if (AutoIndent) InputLine += whiteSpace; } } else { @@ -124,7 +124,7 @@ namespace MonoDevelop.Components inBlock = true; blockText = InputLine; Prompt (true, true); - if (auto_indent) + if (AutoIndent) InputLine += "\t"; return true; } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuTreeView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuTreeView.cs new file mode 100644 index 0000000000..83c8aadb07 --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuTreeView.cs @@ -0,0 +1,104 @@ +// +// ContextMenuTreeView.cs +// +// Author: +// Michael Hutchinson <mhutch@xamarin.com> +// +// Copyright (c) 2011 Xamarin Inc. (http://xamarin.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 Mono.TextEditor; + +namespace MonoDevelop.Components +{ + /// <summary> + /// TreeView with context menu support. + /// </summary> + public class ContextMenuTreeView : Gtk.TreeView + { + const Gdk.ModifierType selectionModifiers = Gdk.ModifierType.ShiftMask | Gdk.ModifierType.ControlMask; + + public ContextMenuTreeView () + { + } + + public ContextMenuTreeView (Gtk.TreeModel model) : base (model) + { + } + + public Action<Gdk.EventButton> DoPopupMenu { get; set; } + + protected override bool OnButtonPressEvent (Gdk.EventButton evnt) + { + bool res = false; + bool withModifier = (evnt.State & selectionModifiers) != 0; + if (IsClickedNodeSelected ((int)evnt.X, (int)evnt.Y) && MultipleNodesSelected () && !withModifier) { + res = true; + } + + if (!res) + res = base.OnButtonPressEvent (evnt); + + //HACK: show context menu in release event instead of show event to work around gtk bug + if (DoPopupMenu != null && evnt.TriggersContextMenu ()) { + // DoPopupMenu (evnt); + return true; + } + + return res; + } + + protected override bool OnButtonReleaseEvent (Gdk.EventButton evnt) + { + bool res = base.OnButtonReleaseEvent (evnt); + + //HACK: show context menu in release event instead of show event to work around gtk bug + if (DoPopupMenu != null && evnt.IsContextMenuButton ()) { + DoPopupMenu (evnt); + return true; + } + + return res; + } + + protected override bool OnPopupMenu () + { + if (DoPopupMenu != null) { + DoPopupMenu (null); + return true; + } + return base.OnPopupMenu (); + } + + bool IsClickedNodeSelected (int x, int y) + { + Gtk.TreePath path; + if (this.GetPathAtPos (x, y, out path)) + return this.Selection.PathIsSelected (path); + else + return false; + } + + bool MultipleNodesSelected () + { + return this.Selection.GetSelectedRows ().Length > 1; + } + } +}
\ No newline at end of file diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBox.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBox.cs index f8d6618cdb..24fb69fab7 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBox.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBox.cs @@ -29,6 +29,7 @@ using System.ComponentModel; using Gtk; using MonoDevelop.Ide; +using Mono.TextEditor; namespace MonoDevelop.Components { @@ -207,8 +208,8 @@ namespace MonoDevelop.Components protected override bool OnButtonPressEvent (Gdk.EventButton e) { - if (e.Button == 3) { - return true; + if (e.TriggersContextMenu ()) { + return base.OnButtonPressEvent (e); } if (e.Type == Gdk.EventType.ButtonPress) { if (window != null) { diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBoxListWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBoxListWindow.cs index 33bc01ef0a..e48af5878a 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBoxListWindow.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBoxListWindow.cs @@ -28,6 +28,7 @@ using System; using System.Collections.Generic; using MonoDevelop.Ide; using Gtk; +using Mono.TextEditor; namespace MonoDevelop.Components { @@ -56,13 +57,7 @@ namespace MonoDevelop.Components Destroy (); }; - list.ScrollEvent += delegate(object o, ScrollEventArgs args) { - if (args.Event.Direction == Gdk.ScrollDirection.Up) { - vScrollbar.Value--; - } else if (args.Event.Direction == Gdk.ScrollDirection.Down) { - vScrollbar.Value++; - } - }; + list.ScrollEvent += HandleListScrollEvent; list.SizeAllocated += delegate { QueueResize (); }; @@ -79,6 +74,33 @@ namespace MonoDevelop.Components ShowAll (); } + void HandleListScrollEvent (object o, ScrollEventArgs args) + { + if (!vScrollbar.Visible) + return; + + var adj = vScrollbar.Adjustment; + var alloc = Allocation; + + //This widget is a special case because it's always aligned to items as it scrolls. + //Although this means we can't use the pixel deltas for true smooth scrolling, we + //can still make use of the effective scrolling velocity by basing the calculation + //on pixels and rounding to the nearest item. + + double dx, dy; + args.Event.GetPageScrollPixelDeltas (0, alloc.Height, out dx, out dy); + if (dy == 0) + return; + + var itemDelta = dy / (alloc.Height / adj.PageSize); + double discreteItemDelta = System.Math.Round (itemDelta); + if (discreteItemDelta == 0.0 && dy != 0.0) + discreteItemDelta = dy > 0? 1.0 : -1.0; + + adj.AddValueClamped (discreteItemDelta); + args.RetVal = true; + } + void HandleListPageChanged (object sender, EventArgs e) { vScrollbar.Value = list.Page; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/GtkUtil.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/GtkUtil.cs index 5b36081558..4f3d39c277 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/GtkUtil.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/GtkUtil.cs @@ -376,6 +376,7 @@ namespace MonoDevelop.Components public Gdk.ScrollDirection direction; public IntPtr device; public double x_root; - public double y_root; + public double y_root; + //FIXME: scroll deltas } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/MiniButton.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/MiniButton.cs index 94686ae281..5e05ea2f42 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/MiniButton.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/MiniButton.cs @@ -26,6 +26,7 @@ using System; using Gtk; +using Mono.TextEditor; namespace MonoDevelop.Components { @@ -105,7 +106,7 @@ namespace MonoDevelop.Components protected override bool OnButtonPressEvent (Gdk.EventButton evnt) { - if (evnt.Button == 1 && Clickable && !ClickOnRelease) { + if (!ClickOnRelease && Clickable && evnt.Button == 1 && !evnt.TriggersContextMenu ()) { OnClicked (); return true; } @@ -114,7 +115,7 @@ namespace MonoDevelop.Components protected override bool OnButtonReleaseEvent (Gdk.EventButton evnt) { - if (evnt.Button == 1 && Clickable && ClickOnRelease) { + if (ClickOnRelease && evnt.Button == 1 && !evnt.TriggersContextMenu ()) { OnClicked (); return true; } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWindow.cs index 45fcc118a8..52c9d169b1 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWindow.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWindow.cs @@ -35,6 +35,7 @@ using System.Text; using System.Collections.Generic; using MonoDevelop.Core.Text; using ICSharpCode.NRefactory.Completion; +using Mono.TextEditor; namespace MonoDevelop.Ide.CodeCompletion { @@ -594,14 +595,29 @@ namespace MonoDevelop.Ide.CodeCompletion void OnScrolled (object o, ScrollEventArgs args) { - switch (args.Event.Direction) { - case ScrollDirection.Up: - scrollbar.Value--; - break; - case ScrollDirection.Down: - scrollbar.Value++; - break; - } + if (!scrollbar.Visible) + return; + + var adj = scrollbar.Adjustment; + var alloc = Allocation; + + //This widget is a special case because it's always aligned to items as it scrolls. + //Although this means we can't use the pixel deltas for true smooth scrolling, we + //can still make use of the effective scrolling velocity by basing the calculation + //on pixels and rounding to the nearest item. + + double dx, dy; + args.Event.GetPageScrollPixelDeltas (0, alloc.Height, out dx, out dy); + if (dy == 0) + return; + + var itemDelta = dy / (alloc.Height / adj.PageSize); + double discreteItemDelta = System.Math.Round (itemDelta); + if (discreteItemDelta == 0.0 && dy != 0.0) + discreteItemDelta = dy > 0? 1.0 : -1.0; + + adj.AddValueClamped (discreteItemDelta); + args.RetVal = true; } void OnSelectionChanged (object o, EventArgs args) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResultWidget.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResultWidget.cs index 0a0e940c96..e769ef301d 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResultWidget.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResultWidget.cs @@ -41,14 +41,14 @@ using MonoDevelop.Ide.Commands; using System.IO; using MonoDevelop.Ide.Gui.Content; using MonoDevelop.Ide.Navigation; +using MonoDevelop.Ide.Gui.Components; +using MonoDevelop.Components; namespace MonoDevelop.Ide.FindInFiles { - [System.ComponentModel.ToolboxItem(true)] - partial class SearchResultWidget : Bin, ILocationList + class SearchResultWidget : HBox, ILocationList { - ListStore store; readonly ToolButton buttonStop; @@ -60,6 +60,11 @@ namespace MonoDevelop.Ide.FindInFiles Mono.TextEditor.Highlighting.ColorSheme highlightStyle; + ScrolledWindow scrolledwindowLogView; + PadTreeView treeviewSearchResults; + Label labelStatus; + TextView textviewLog; + public string BasePath { get; set; @@ -78,17 +83,43 @@ namespace MonoDevelop.Ide.FindInFiles public SearchResultWidget () { - Build (); + var vbox = new VBox (); + var toolbar = new Toolbar () { + Orientation = Orientation.Vertical, + IconSize = IconSize.Menu, + ToolbarStyle = ToolbarStyle.Icons, + }; + this.PackStart (vbox, true, true, 0); + this.PackStart (toolbar, false, false, 0); + labelStatus = new Label () { + Xalign = 0, + Justify = Justification.Left, + }; + var hpaned = new HPaned (); + vbox.PackStart (hpaned, true, true, 0); + vbox.PackStart (labelStatus, false, false, 0); + var resultsScroll = new CompactScrolledWindow (); + hpaned.Pack1 (resultsScroll, true, true); + scrolledwindowLogView = new CompactScrolledWindow (); + hpaned.Pack2 (scrolledwindowLogView, true, true); + textviewLog = new TextView () { + Editable = false, + }; + scrolledwindowLogView.Add (textviewLog); + + store = new ListStore (typeof (SearchResult), + typeof (bool) // didRead + ); - store = new ListStore (typeof (SearchResult), - typeof (bool) // didRead - ); - treeviewSearchResults.Model = store; + treeviewSearchResults = new PadTreeView () { + Model = store, + HeadersClickable = true, + RulesHint = true, + }; treeviewSearchResults.Selection.Mode = Gtk.SelectionMode.Multiple; - treeviewSearchResults.HeadersClickable = true; - treeviewSearchResults.PopupMenu += OnPopupMenu; - treeviewSearchResults.ButtonPressEvent += HandleButtonPressEvent; - treeviewSearchResults.RulesHint = true; + resultsScroll.Add (treeviewSearchResults); + + this.ShowAll (); var fileNameColumn = new TreeViewColumn { Resizable = false, @@ -102,9 +133,8 @@ namespace MonoDevelop.Ide.FindInFiles fileNameColumn.PackStart (fileNamePixbufRenderer, false); fileNameColumn.SetCellDataFunc (fileNamePixbufRenderer, FileIconDataFunc); - var fileNameRenderer = new CellRendererText (); - fileNameColumn.PackStart (fileNameRenderer, true); - fileNameColumn.SetCellDataFunc (fileNameRenderer, FileNameDataFunc); + fileNameColumn.PackStart (treeviewSearchResults.TextRenderer, true); + fileNameColumn.SetCellDataFunc (treeviewSearchResults.TextRenderer, FileNameDataFunc); treeviewSearchResults.AppendColumn (fileNameColumn); // TreeViewColumn lineColumn = treeviewSearchResults.AppendColumn (GettextCatalog.GetString ("Line"), new CellRendererText (), ResultLineDataFunc); @@ -112,13 +142,15 @@ namespace MonoDevelop.Ide.FindInFiles // lineColumn.FixedWidth = 50; // - TreeViewColumn textColumn = treeviewSearchResults.AppendColumn (GettextCatalog.GetString ("Text"), new CellRendererText (), ResultTextDataFunc); + TreeViewColumn textColumn = treeviewSearchResults.AppendColumn (GettextCatalog.GetString ("Text"), + treeviewSearchResults.TextRenderer, ResultTextDataFunc); textColumn.SortColumnId = 2; textColumn.Resizable = false; textColumn.FixedWidth = 300; - TreeViewColumn pathColumn = treeviewSearchResults.AppendColumn (GettextCatalog.GetString ("Path"), new CellRendererText (), ResultPathDataFunc); + TreeViewColumn pathColumn = treeviewSearchResults.AppendColumn (GettextCatalog.GetString ("Path"), + treeviewSearchResults.TextRenderer, ResultPathDataFunc); pathColumn.SortColumnId = 3; pathColumn.Resizable = false; pathColumn.FixedWidth = 500; @@ -251,26 +283,15 @@ namespace MonoDevelop.Ide.FindInFiles base.OnDestroyed (); } - [GLib.ConnectBefore] - void HandleButtonPressEvent(object sender, ButtonPressEventArgs args) - { - if (args.Event.Button == 3) { - OnPopupMenu (this, null); - args.RetVal = treeviewSearchResults.Selection.GetSelectedRows ().Length > 1; - } - } - - - static Color AdjustColor (Color baseColor, Color color) { - double b1 = HslColor.Brightness (color); - double b2 = HslColor.Brightness (baseColor); + double b1 = Mono.TextEditor.HslColor.Brightness (color); + double b2 = Mono.TextEditor.HslColor.Brightness (baseColor); double delta = Math.Abs (b1 - b2); if (delta < 0.1) { - HslColor color1 = color; + Mono.TextEditor.HslColor color1 = color; color1.L -= 0.5; - if (Math.Abs (HslColor.Brightness (color1) - b2) < delta) { + if (Math.Abs (Mono.TextEditor.HslColor.Brightness (color1) - b2) < delta) { color1 = color; color1.L += 0.5; } @@ -315,13 +336,13 @@ namespace MonoDevelop.Ide.FindInFiles return result.ToString (); } - void OnPopupMenu (object sender, PopupMenuArgs args) - { - var contextMenu = new CommandEntrySet (); - contextMenu.AddItem (ViewCommands.Open); - contextMenu.AddItem (EditCommands.Copy); - contextMenu.AddItem (EditCommands.SelectAll); - IdeApp.CommandService.ShowContextMenu (contextMenu, this); + void DoPopupMenu (Gdk.EventButton evt) + { + IdeApp.CommandService.ShowContextMenu (this.treeviewSearchResults, evt, new CommandEntrySet () { + new CommandEntry (ViewCommands.Open), + new CommandEntry (EditCommands.Copy), + new CommandEntry (EditCommands.SelectAll), + }, this); } public void ShowStatus (string text) @@ -458,11 +479,11 @@ namespace MonoDevelop.Ide.FindInFiles if (pos1 >= 0 && pos2 >= 0) { markup = tag.StartsWith ("span") ? markup.Insert (pos2, "</span></span><" + tag + ">") : markup.Insert (pos2, "</span>"); Color searchColor = Mono.TextEditor.Highlighting.ColorSheme.ToGdkColor (highlightStyle.SearchTextBg); - double b1 = HslColor.Brightness (searchColor); - double b2 = HslColor.Brightness (AdjustColor (Style.Base (StateType.Normal), highlightStyle.Default.Color)); + double b1 = Mono.TextEditor.HslColor.Brightness (searchColor); + double b2 = Mono.TextEditor.HslColor.Brightness (AdjustColor (Style.Base (StateType.Normal), highlightStyle.Default.Color)); double delta = Math.Abs (b1 - b2); if (delta < 0.1) { - HslColor color1 = highlightStyle.SearchTextBg; + Mono.TextEditor.HslColor color1 = highlightStyle.SearchTextBg; if (color1.L + 0.5 > 1.0) { color1.L -= 0.5; } else { diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs index 305c02c85a..4278258cde 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs @@ -48,6 +48,7 @@ using MonoDevelop.Ide.Commands; using MonoDevelop.Components.Commands; using MonoDevelop.Ide.Gui.Pads; using MonoDevelop.Projects.Extensions; +using Mono.TextEditor; namespace MonoDevelop.Ide.Gui.Components { @@ -64,7 +65,7 @@ namespace MonoDevelop.Ide.Gui.Components Dictionary<Type, NodeBuilder[]> builderChains = new Dictionary<Type, NodeBuilder[]> (); Hashtable nodeHash = new Hashtable (); - Gtk.TreeView tree = new Gtk.TreeView (); + ContextMenuTreeView tree = new ContextMenuTreeView (); Gtk.TreeStore store; internal Gtk.TreeViewColumn complete_column; internal ZoomableCellRendererPixbuf pix_render; @@ -220,11 +221,7 @@ namespace MonoDevelop.Ide.Gui.Components tree.TestExpandRow += OnTestExpandRow; tree.RowActivated += OnNodeActivated; - - tree.ButtonReleaseEvent += OnButtonRelease; - tree.ButtonPressEvent += OnButtonPress; - - tree.PopupMenu += OnPopupMenu; + tree.DoPopupMenu += ShowPopup; workNode = new TreeNodeNavigator (this); compareNode1 = new TreeNodeNavigator (this); compareNode2 = new TreeNodeNavigator (this); @@ -1743,7 +1740,7 @@ namespace MonoDevelop.Ide.Gui.Components args.RetVal = false; } - void ShowPopup () + void ShowPopup (Gdk.EventButton evt) { ITreeNavigator tnav = GetSelectedNode (); if (tnav == null) @@ -1756,7 +1753,7 @@ namespace MonoDevelop.Ide.Gui.Components opset.AddItem (ViewCommands.TreeDisplayOptionList); opset.AddItem (Command.Separator); opset.AddItem (ViewCommands.ResetTreeDisplayOptions); - IdeApp.CommandService.ShowContextMenu (opset, this); + IdeApp.CommandService.ShowContextMenu (this, evt, opset, this); } } else { ExtensionContext ctx = AddinManager.CreateExtensionContext (); @@ -1770,7 +1767,7 @@ namespace MonoDevelop.Ide.Gui.Components opset.AddItem (ViewCommands.ResetTreeDisplayOptions); opset.AddItem (ViewCommands.RefreshTree); opset.AddItem (ViewCommands.CollapseAllTreeNodes); - IdeApp.CommandService.ShowContextMenu (eset, this); + IdeApp.CommandService.ShowContextMenu (this, evt, eset, this); } } @@ -1828,36 +1825,46 @@ namespace MonoDevelop.Ide.Gui.Components [GLib.ConnectBefore] void OnKeyPress (object o, Gtk.KeyPressEventArgs args) { - if (args.Event.Key == Gdk.Key.F10 && (args.Event.State & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask) - ShowPopup (); - if (args.Event.Key == Gdk.Key.Delete || args.Event.Key == Gdk.Key.KP_Delete) + if (args.Event.Key == Gdk.Key.Delete || args.Event.Key == Gdk.Key.KP_Delete) { DeleteCurrentItem (); + args.RetVal = true; + return; + } //HACK: to work around "Bug 377810 - Many errors when expanding MonoDevelop treeviews with keyboard" // The shift-right combo recursively expands all child nodes but the OnTestExpandRow callback // modifies tree and successive calls get passed an invalid iter. Using the path to regenerate the iter // causes a Gtk-Fatal. bool shift = (args.Event.State & Gdk.ModifierType.ShiftMask) != 0; - if (args.Event.Key == Gdk.Key.asterisk || args.Event.Key == Gdk.Key.KP_Multiply || (shift && (args.Event.Key == Gdk.Key.Right || args.Event.Key == Gdk.Key.KP_Right || args.Event.Key == Gdk.Key.plus || args.Event.Key == Gdk.Key.KP_Add))) { + if (args.Event.Key == Gdk.Key.asterisk || args.Event.Key == Gdk.Key.KP_Multiply + || (shift && (args.Event.Key == Gdk.Key.Right || args.Event.Key == Gdk.Key.KP_Right + || args.Event.Key == Gdk.Key.plus || args.Event.Key == Gdk.Key.KP_Add))) + { Gtk.TreeIter iter; foreach (Gtk.TreePath path in tree.Selection.GetSelectedRows ()) { store.GetIter (out iter, path); Expand (iter); } args.RetVal = true; + return; } + if (args.Event.Key == Gdk.Key.Right || args.Event.Key == Gdk.Key.KP_Right) { ExpandCurrentItem (); + args.RetVal = true; + return; } + if (args.Event.Key == Gdk.Key.Left || args.Event.Key == Gdk.Key.KP_Left) { CollapseCurrentItem (); + args.RetVal = true; + return; } if (args.Event.Key == Gdk.Key.Return || args.Event.Key == Gdk.Key.KP_Enter) { ActivateCurrentItem (); args.RetVal = true; - } else if (args.Event.Key == Gdk.Key.Menu) { - ShowPopup (); + return; } } @@ -1871,36 +1878,6 @@ namespace MonoDevelop.Ide.Gui.Components } while (store.IterNext (ref ci)); } } - - void OnPopupMenu (object o, Gtk.PopupMenuArgs args) - { - if (GetSelectedNode () != null) - ShowPopup (); - } - - [GLib.ConnectBefore] - private void OnButtonPress (object sender, Gtk.ButtonPressEventArgs args) - { - bool withModifider = (args.Event.State & Gdk.ModifierType.ShiftMask) != 0 || (args.Event.State & Gdk.ModifierType.ControlMask) != 0; - if (IsClickedNodeSelected ((int)args.Event.X, (int)args.Event.Y) && MultipleNodesSelected () && !withModifider) { - args.RetVal = true; - } - } - - private void OnButtonRelease (object sender, Gtk.ButtonReleaseEventArgs args) - { - if (args.Event.Button == 3 && GetSelectedNode() != null) { - ShowPopup (); - } - - bool withModifider = (args.Event.State & Gdk.ModifierType.ShiftMask) != 0 || (args.Event.State & Gdk.ModifierType.ControlMask) != 0; - if (args.Event.Button == 1 && MultipleNodesSelected () && !withModifider) { - tree.Selection.UnselectAll (); - Gtk.TreePath path; - if (tree.GetPathAtPos ((int)args.Event.X, (int)args.Event.Y, out path)) - tree.Selection.SelectPath (path); - } - } protected override bool OnScrollEvent (Gdk.EventScroll evnt) { @@ -1920,16 +1897,6 @@ namespace MonoDevelop.Ide.Gui.Components return base.OnScrollEvent (evnt); } - - bool IsClickedNodeSelected (int x, int y) - { - Gtk.TreePath path; - if (tree.GetPathAtPos (x, y, out path)) - return tree.Selection.PathIsSelected (path); - else - return false; - } - protected virtual void OnNodeActivated (object sender, Gtk.RowActivatedArgs args) { ActivateCurrentItem (); @@ -2207,4 +2174,4 @@ namespace MonoDevelop.Ide.Gui.Components return resized; } } -} +}
\ No newline at end of file diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/PadTreeView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/PadTreeView.cs index ba5a02d49c..688178e3c4 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/PadTreeView.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/PadTreeView.cs @@ -26,11 +26,11 @@ using System; using Gtk; +using Mono.TextEditor; namespace MonoDevelop.Ide.Gui.Components { - - public class PadTreeView : TreeView + public class PadTreeView : MonoDevelop.Components.ContextMenuTreeView { PadFontChanger changer; CellRendererText textRenderer = new CellRendererText (); @@ -66,4 +66,4 @@ namespace MonoDevelop.Ide.Gui.Components base.Dispose (); } } -} +}
\ No newline at end of file diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/AboutMonoDevelopTabPage.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/AboutMonoDevelopTabPage.cs index cad3725955..10658db1f2 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/AboutMonoDevelopTabPage.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/AboutMonoDevelopTabPage.cs @@ -53,7 +53,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs aboutPictureScrollBox = new ScrollBox (); PackStart (aboutPictureScrollBox, false, false, 0); - using (var stream = BrandingService.GetStream ("AboutImageSep.png")) + using (var stream = BrandingService.GetStream ("AboutImageSep.png", true)) imageSep = new Pixbuf (stream); PackStart (new Gtk.Image (imageSep), false, false, 0); @@ -215,7 +215,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs this.Realized += new EventHandler (OnRealized); this.ModifyBg (Gtk.StateType.Normal, bgColor); this.ModifyText (Gtk.StateType.Normal, textColor); - using (var stream = BrandingService.GetStream ("AboutImage.png")) + using (var stream = BrandingService.GetStream ("AboutImage.png", true)) image = new Gdk.Pixbuf (stream); monoPowered = new Gdk.Pixbuf (GetType ().Assembly, "mono-powered.png"); this.SetSizeRequest (450, image.Height - 1); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GtkAlertDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GtkAlertDialog.cs index ba3b509299..7d455625cd 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GtkAlertDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GtkAlertDialog.cs @@ -117,6 +117,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs } label.Markup = markup.ToString (); label.Selectable = true; + label.CanFocus = false; foreach (AlertButton button in message.Buttons) { Button newButton = new Button (); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/SplashScreen.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/SplashScreen.cs index 1ae0ceabca..fb91f52d8a 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/SplashScreen.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/SplashScreen.cs @@ -37,7 +37,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs { this.WindowPosition = WindowPosition.Center; this.TypeHint = Gdk.WindowTypeHint.Splashscreen; try { - using (var stream = BrandingService.GetStream ("SplashScreen.png")) + using (var stream = BrandingService.GetStream ("SplashScreen.png", true)) bitmap = new Gdk.Pixbuf (stream); } catch (Exception e) { LoggingService.LogError ("Can't load splash screen pixbuf 'SplashScreen.png'.", e); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs index 23900e96d3..e28dac28d4 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs @@ -174,8 +174,7 @@ namespace MonoDevelop.Ide.Gui.Pads view = new MonoDevelop.Ide.Gui.Components.PadTreeView (sort); view.RulesHint = true; - view.PopupMenu += new PopupMenuHandler (OnPopupMenu); - view.ButtonPressEvent += new ButtonPressEventHandler (OnButtonPressed); + view.DoPopupMenu = (evnt) => IdeApp.CommandService.ShowContextMenu (view, evnt, CreateMenu ()); AddColumns (); LoadColumnsVisibility (); view.Columns[VisibleColumns.Type].SortColumnId = VisibleColumns.Type; @@ -212,8 +211,6 @@ namespace MonoDevelop.Ide.Gui.Pads }; outputView.Hide (); - - CreateMenu (); // Load existing tasks foreach (Task t in TaskService.Errors) { @@ -283,128 +280,116 @@ namespace MonoDevelop.Ide.Gui.Pads { } - void CreateMenu () - { - if (menu == null) - { - ActionGroup group = new ActionGroup ("Popup"); - - Gtk.Action help = new Gtk.Action ("help", GettextCatalog.GetString ("Show Error Reference"), - GettextCatalog.GetString ("Show Error Reference"), Gtk.Stock.Help); - help.Activated += new EventHandler (OnShowReference); - group.Add (help, "F1"); - - Gtk.Action copy = new Gtk.Action ("copy", GettextCatalog.GetString ("_Copy"), - GettextCatalog.GetString ("Copy task"), Gtk.Stock.Copy); - copy.Activated += new EventHandler (OnTaskCopied); - group.Add (copy, "<Control><Mod2>c"); - - Gtk.Action jump = new Gtk.Action ("jump", GettextCatalog.GetString ("_Go to"), - GettextCatalog.GetString ("Go to task"), Gtk.Stock.JumpTo); - jump.Activated += new EventHandler (OnTaskJumpto); - group.Add (jump); - - Gtk.Action columns = new Gtk.Action ("columns", GettextCatalog.GetString ("Columns")); - group.Add (columns, null); - - ToggleAction columnType = new ToggleAction ("columnType", GettextCatalog.GetString ("Type"), - GettextCatalog.GetString ("Toggle visibility of Type column"), null); - columnType.Toggled += new EventHandler (OnColumnVisibilityChanged); - columnsActions[columnType] = VisibleColumns.Type; - group.Add (columnType); - - ToggleAction columnValidity = new ToggleAction ("columnValidity", GettextCatalog.GetString ("Validity"), - GettextCatalog.GetString ("Toggle visibility of Validity column"), null); - columnValidity.Toggled += new EventHandler (OnColumnVisibilityChanged); - columnsActions[columnValidity] = VisibleColumns.Marked; - group.Add (columnValidity); - - ToggleAction columnLine = new ToggleAction ("columnLine", GettextCatalog.GetString ("Line"), - GettextCatalog.GetString ("Toggle visibility of Line column"), null); - columnLine.Toggled += new EventHandler (OnColumnVisibilityChanged); - columnsActions[columnLine] = VisibleColumns.Line; - group.Add (columnLine); - - ToggleAction columnDescription = new ToggleAction ("columnDescription", GettextCatalog.GetString ("Description"), - GettextCatalog.GetString ("Toggle visibility of Description column"), null); - columnDescription.Toggled += new EventHandler (OnColumnVisibilityChanged); - columnsActions[columnDescription] = VisibleColumns.Description; - group.Add (columnDescription); - - ToggleAction columnFile = new ToggleAction ("columnFile", GettextCatalog.GetString ("File"), - GettextCatalog.GetString ("Toggle visibility of File column"), null); - columnFile.Toggled += new EventHandler (OnColumnVisibilityChanged); - columnsActions[columnFile] = VisibleColumns.File; - group.Add (columnFile); - - ToggleAction columnProject = new ToggleAction ("columnProject", GettextCatalog.GetString ("Project"), - GettextCatalog.GetString ("Toggle visibility of Project column"), null); - columnProject.Toggled += new EventHandler (OnColumnVisibilityChanged); - columnsActions[columnProject] = VisibleColumns.Project; - group.Add (columnProject); - - ToggleAction columnPath = new ToggleAction ("columnPath", GettextCatalog.GetString ("Path"), - GettextCatalog.GetString ("Toggle visibility of Path column"), null); - columnPath.Toggled += new EventHandler (OnColumnVisibilityChanged); - columnsActions[columnPath] = VisibleColumns.Path; - group.Add (columnPath); - - UIManager uiManager = new UIManager (); - uiManager.InsertActionGroup (group, 0); - - string uiStr = "<ui><popup name='popup'>" - + "<menuitem action='help'/>" - + "<menuitem action='copy'/>" - + "<menuitem action='jump'/>" - + "<separator/>" - + "<menu action='columns'>" - + "<menuitem action='columnType' />" - + "<menuitem action='columnValidity' />" - + "<menuitem action='columnLine' />" - + "<menuitem action='columnDescription' />" - + "<menuitem action='columnFile' />" - + "<menuitem action='columnProject' />" - + "<menuitem action='columnPath' />" - + "</menu>" - + "</popup></ui>"; - - uiManager.AddUiFromString (uiStr); - menu = (Menu)uiManager.GetWidget ("/popup"); - menu.ShowAll (); - - menu.Shown += delegate (object o, EventArgs args) - { - columnType.Active = view.Columns[VisibleColumns.Type].Visible; - columnValidity.Active = view.Columns[VisibleColumns.Marked].Visible; - columnLine.Active = view.Columns[VisibleColumns.Line].Visible; - columnDescription.Active = view.Columns[VisibleColumns.Description].Visible; - columnFile.Active = view.Columns[VisibleColumns.File].Visible; - columnProject.Active = view.Columns[VisibleColumns.Project].Visible; - columnPath.Active = view.Columns[VisibleColumns.Path].Visible; - help.Sensitive = copy.Sensitive = jump.Sensitive = - view.Selection != null && - view.Selection.CountSelectedRows () > 0 && - (columnType.Active || + Gtk.Menu CreateMenu () + { + if (menu != null) + return menu; + + var group = new ActionGroup ("Popup"); + + var help = new Gtk.Action ("help", GettextCatalog.GetString ("Show Error Reference"), + GettextCatalog.GetString ("Show Error Reference"), Gtk.Stock.Help); + help.Activated += OnShowReference; + group.Add (help, "F1"); + + var copy = new Gtk.Action ("copy", GettextCatalog.GetString ("_Copy"), + GettextCatalog.GetString ("Copy task"), Gtk.Stock.Copy); + copy.Activated += OnTaskCopied; + group.Add (copy, "<Control><Mod2>c"); + + var jump = new Gtk.Action ("jump", GettextCatalog.GetString ("_Go to"), + GettextCatalog.GetString ("Go to task"), Gtk.Stock.JumpTo); + jump.Activated += OnTaskJumpto; + group.Add (jump); + + var columns = new Gtk.Action ("columns", GettextCatalog.GetString ("Columns")); + group.Add (columns, null); + + var columnType = new ToggleAction ("columnType", GettextCatalog.GetString ("Type"), + GettextCatalog.GetString ("Toggle visibility of Type column"), null); + columnType.Toggled += OnColumnVisibilityChanged; + columnsActions[columnType] = VisibleColumns.Type; + group.Add (columnType); + + var columnValidity = new ToggleAction ("columnValidity", GettextCatalog.GetString ("Validity"), + GettextCatalog.GetString ("Toggle visibility of Validity column"), null); + columnValidity.Toggled += OnColumnVisibilityChanged; + columnsActions[columnValidity] = VisibleColumns.Marked; + group.Add (columnValidity); + + var columnLine = new ToggleAction ("columnLine", GettextCatalog.GetString ("Line"), + GettextCatalog.GetString ("Toggle visibility of Line column"), null); + columnLine.Toggled += OnColumnVisibilityChanged; + columnsActions[columnLine] = VisibleColumns.Line; + group.Add (columnLine); + + var columnDescription = new ToggleAction ("columnDescription", GettextCatalog.GetString ("Description"), + GettextCatalog.GetString ("Toggle visibility of Description column"), null); + columnDescription.Toggled += OnColumnVisibilityChanged; + columnsActions[columnDescription] = VisibleColumns.Description; + group.Add (columnDescription); + + var columnFile = new ToggleAction ("columnFile", GettextCatalog.GetString ("File"), + GettextCatalog.GetString ("Toggle visibility of File column"), null); + columnFile.Toggled += OnColumnVisibilityChanged; + columnsActions[columnFile] = VisibleColumns.File; + group.Add (columnFile); + + var columnProject = new ToggleAction ("columnProject", GettextCatalog.GetString ("Project"), + GettextCatalog.GetString ("Toggle visibility of Project column"), null); + columnProject.Toggled += OnColumnVisibilityChanged; + columnsActions[columnProject] = VisibleColumns.Project; + group.Add (columnProject); + + var columnPath = new ToggleAction ("columnPath", GettextCatalog.GetString ("Path"), + GettextCatalog.GetString ("Toggle visibility of Path column"), null); + columnPath.Toggled += OnColumnVisibilityChanged; + columnsActions[columnPath] = VisibleColumns.Path; + group.Add (columnPath); + + var uiManager = new UIManager (); + uiManager.InsertActionGroup (group, 0); + + string uiStr = "<ui><popup name='popup'>" + + "<menuitem action='help'/>" + + "<menuitem action='copy'/>" + + "<menuitem action='jump'/>" + + "<separator/>" + + "<menu action='columns'>" + + "<menuitem action='columnType' />" + + "<menuitem action='columnValidity' />" + + "<menuitem action='columnLine' />" + + "<menuitem action='columnDescription' />" + + "<menuitem action='columnFile' />" + + "<menuitem action='columnProject' />" + + "<menuitem action='columnPath' />" + + "</menu>" + + "</popup></ui>"; + + uiManager.AddUiFromString (uiStr); + menu = (Menu)uiManager.GetWidget ("/popup"); + menu.ShowAll (); + + menu.Shown += delegate { + columnType.Active = view.Columns[VisibleColumns.Type].Visible; + columnValidity.Active = view.Columns[VisibleColumns.Marked].Visible; + columnLine.Active = view.Columns[VisibleColumns.Line].Visible; + columnDescription.Active = view.Columns[VisibleColumns.Description].Visible; + columnFile.Active = view.Columns[VisibleColumns.File].Visible; + columnProject.Active = view.Columns[VisibleColumns.Project].Visible; + columnPath.Active = view.Columns[VisibleColumns.Path].Visible; + help.Sensitive = copy.Sensitive = jump.Sensitive = + view.Selection != null && + view.Selection.CountSelectedRows () > 0 && + (columnType.Active || columnValidity.Active || columnLine.Active || columnDescription.Active || columnFile.Active || columnPath.Active); - }; - } - } - - - [GLib.ConnectBefore] - void OnButtonPressed (object o, ButtonPressEventArgs args) - { - if (args.Event.Button == 3) - menu.Popup (); - } - - void OnPopupMenu (object o, PopupMenuArgs args) - { - menu.Popup (); + }; + + return menu; } Task SelectedTask diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/FileList.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/FileList.cs deleted file mode 100644 index d880024326..0000000000 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/FileList.cs +++ /dev/null @@ -1,213 +0,0 @@ -// FileList.cs -// -// Author: -// John Luke <jluke@cfl.rr.com> -// -// Copyright (c) 2004 John Luke -// -// 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.Core; -using MonoDevelop.Components; - -namespace MonoDevelop.Ide.Gui.Pads -{ - internal class FileList : Gtk.TreeView - { - private FileSystemWatcher watcher; - private ArrayList Items; - private Gtk.ListStore store; - FileListItem selectedItem = null; - Gtk.TreeIter selectedIter; - Gtk.CellRendererText textRender = new Gtk.CellRendererText (); - - public FileList () - { - Items = new ArrayList (); - store = new Gtk.ListStore (typeof (string), typeof (string), typeof (string), typeof (FileListItem), typeof (Gdk.Pixbuf)); - Model = store; - - HeadersVisible = true; - HeadersClickable = true; - RulesHint = true; - - Gtk.TreeViewColumn name_column = new Gtk.TreeViewColumn (); - name_column.Title = GettextCatalog.GetString ("Files"); - - Gtk.TreeViewColumn size_column = new Gtk.TreeViewColumn (); - size_column.Title = GettextCatalog.GetString ("Size"); - - Gtk.TreeViewColumn modi_column = new Gtk.TreeViewColumn (); - modi_column.Title = GettextCatalog.GetString ("Last modified"); - - Gtk.CellRendererPixbuf pix_render = new Gtk.CellRendererPixbuf (); - name_column.PackStart (pix_render, false); - name_column.AddAttribute (pix_render, "pixbuf", 4); - - name_column.PackStart (textRender, false); - name_column.AddAttribute (textRender, "text", 0); - - size_column.PackStart (textRender, false); - size_column.AddAttribute (textRender, "text", 1); - - modi_column.PackStart (textRender, false); - modi_column.AddAttribute (textRender, "text", 2); - - AppendColumn (name_column); - AppendColumn (size_column); - AppendColumn (modi_column); - - this.PopupMenu += new Gtk.PopupMenuHandler (OnPopupMenu); - this.ButtonReleaseEvent += new Gtk.ButtonReleaseEventHandler (OnButtonReleased); - this.Selection.Changed += new EventHandler (OnSelectionChanged); - - watcher = new FileSystemWatcher (); - watcher.EnableRaisingEvents = false; - watcher.NotifyFilter = NotifyFilters.FileName; - - watcher.Created += DispatchService.GuiDispatch (new FileSystemEventHandler (fileCreated)); - watcher.Deleted += DispatchService.GuiDispatch (new FileSystemEventHandler (fileDeleted)); - watcher.Changed += DispatchService.GuiDispatch (new FileSystemEventHandler (fileChanged)); - watcher.Renamed += DispatchService.GuiDispatch (new RenamedEventHandler (fileRenamed)); - } - - private void fileCreated (Object o, FileSystemEventArgs e) - { - FileInfo fileInfo = new FileInfo (e.FullPath); - Items.Add(new FileListItem(e.FullPath, String.Format("{0} KB", fileInfo.Length / 512 * 2), fileInfo.LastWriteTime.ToString())); - } - - private void fileDeleted (Object o, FileSystemEventArgs e) - { - foreach (FileListItem fileListItem in Items) { - if (String.Compare (fileListItem.FullName, e.FullPath, StringComparison.InvariantCultureIgnoreCase) == 0) - Items.Remove (fileListItem); - } - } - - private void fileChanged (Object o, FileSystemEventArgs e) - { - foreach (FileListItem fileListItem in Items) { - if (String.Compare (fileListItem.FullName, e.FullPath, StringComparison.InvariantCultureIgnoreCase) == 0) { - FileInfo info = new FileInfo(e.FullPath); - fileListItem.Size = String.Format("{0} KB", info.Length / 512 * 2); - fileListItem.LastModified = info.LastWriteTime.ToString (); - } - } - } - - private void fileRenamed (Object o, RenamedEventArgs e) - { - foreach (FileListItem fileListItem in Items) { - if (String.Compare (fileListItem.FullName, e.OldFullPath, StringComparison.InvariantCultureIgnoreCase) == 0) { - fileListItem.FullName = e.FullPath; - } - } - } - - internal void ItemAdded(FileListItem item) { - store.AppendValues(item.Text, item.Size, item.LastModified, item, item.Icon); - } - - void ItemRemoved (FileListItem item) { - store.Remove (ref selectedIter); - } - - internal void Clear() { - store.Clear(); - } - - - - - - private void OnRenameFile (object sender, EventArgs e) - { - } - - private void OnDeleteFiles (object sender, EventArgs e) - { - if (MessageService.Confirm (GettextCatalog.GetString ("Are you sure you want to delete this file?"), AlertButton.Delete)) - { - try - { - FileService.DeleteFile (selectedItem.FullName); - ItemRemoved (selectedItem); - } - catch (Exception ex) - { - MessageService.ShowException (ex, "Could not delete file '" + System.IO.Path.GetFileName (selectedItem.FullName) + "'"); - } - } - } - - private void OnPopupMenu (object o, Gtk.PopupMenuArgs args) - { - ShowPopup (); - } - - private void OnButtonReleased (object o, Gtk.ButtonReleaseEventArgs args) - { - if (args.Event.Button == 3) - ShowPopup (); - } - - private void ShowPopup () - { - Gtk.Menu menu = new Gtk.Menu (); - - Gtk.MenuItem deleteFile = new Gtk.MenuItem (GettextCatalog.GetString ("Delete file")); - deleteFile.Activated += new EventHandler (OnDeleteFiles); - - Gtk.MenuItem renameFile = new Gtk.MenuItem (GettextCatalog.GetString ("Rename file")); - renameFile.Activated += new EventHandler (OnRenameFile); - renameFile.Sensitive = false; - - menu.Append (deleteFile); - menu.Append (renameFile); - - menu.Popup (null, null, null, 3, Gtk.Global.CurrentEventTime); - menu.ShowAll (); - } - - void OnSelectionChanged (object o, EventArgs args) - { - Gtk.TreeIter iter; - Gtk.TreeModel model; - - if (this.Selection.GetSelected (out model, out iter)) - { - selectedItem = (FileListItem) model.GetValue (iter, 3); - selectedIter = iter; - } - } - - internal void SetCustomFont (Pango.FontDescription desc) - { - textRender.FontDesc = desc; - } - } -} - diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/FileListItem.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/FileListItem.cs deleted file mode 100644 index f69cf621d1..0000000000 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/FileListItem.cs +++ /dev/null @@ -1,105 +0,0 @@ -// FileListItem.cs -// -// Author: -// John Luke <john.luke@gmail.com> -// -// Copyright (c) 2007 John Luke -// -// 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; - -namespace MonoDevelop.Ide.Gui.Pads -{ - internal class FileListItem - { - string fullname; - string text; - string size; - string lastModified; - Gdk.Pixbuf icon; - - public string FullName { - get { - return fullname; - } - set { - fullname = System.IO.Path.GetFullPath(value); - text = System.IO.Path.GetFileName(fullname); - } - } - - public string Text { - get { - return text; - } - } - - public string Size { - get { - return size; - } - set { - size = value; - } - } - - public string LastModified { - get { - return lastModified; - } - set { - lastModified = value; - } - } - - public Gdk.Pixbuf Icon { - get { - return icon; - } - set { - icon = value; - } - } - - public FileListItem(string fullname, string size, string lastModified) - { - this.size = size; - this.lastModified = lastModified; - //FIXME: This is because //home/blah is not the same as /home/blah according to Icon.LookupSync, if we get weird behaviours, lets look at this again, see if we still need it. - FullName = fullname.Substring (1); - icon = DesktopService.GetPixbufForFile (FullName, Gtk.IconSize.Menu); - } - - public FileListItem (string name) - { - FileInfo fi = new FileInfo (name); - this.size = Math.Round ((double) fi.Length / 1024).ToString () + " KB"; - this.lastModified = fi.LastWriteTime.ToString (); - FullName = System.IO.Path.GetFullPath (name); - icon = DesktopService.GetPixbufForFile (FullName, Gtk.IconSize.Menu); - } - } -} - diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/InternalLogPad.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/InternalLogPad.cs index 2ea593129d..31231afbad 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/InternalLogPad.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/InternalLogPad.cs @@ -191,11 +191,15 @@ namespace MonoDevelop.Ide.Gui.Pads view = new MonoDevelop.Ide.Gui.Components.PadTreeView (new Gtk.TreeModelSort (filter)); view.RulesHint = true; - view.PopupMenu += new PopupMenuHandler (OnPopupMenu); - view.ButtonPressEvent += new ButtonPressEventHandler (OnButtonPressed); view.HeadersClickable = true; view.Selection.Mode = SelectionMode.Multiple; + view.DoPopupMenu = (evt) => + IdeApp.CommandService.ShowContextMenu (view, evt, new CommandEntrySet () { + new CommandEntry (EditCommands.Copy), + new CommandEntry (EditCommands.SelectAll), + }); + AddColumns (); sw = new Gtk.ScrolledWindow (); @@ -247,23 +251,6 @@ namespace MonoDevelop.Ide.Gui.Pads col.SortColumnId = (int) Columns.Description; } - [GLib.ConnectBefore] - void OnButtonPressed (object o, ButtonPressEventArgs args) - { - if (args.Event.Button == 3) { - OnPopupMenu (null, null); - args.RetVal = view.Selection.GetSelectedRows ().Length > 1; - } - } - - void OnPopupMenu (object o, PopupMenuArgs args) - { - CommandEntrySet opset = new CommandEntrySet (); - opset.AddItem (EditCommands.Copy); - opset.AddItem (EditCommands.SelectAll); - IdeApp.CommandService.ShowContextMenu (opset, this); - } - [CommandHandler (EditCommands.SelectAll)] internal void OnSelectAll () { diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs index 4c3ed90c63..90825c363f 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs @@ -44,6 +44,7 @@ using MonoDevelop.Components.DockToolbars; using Gtk; using MonoDevelop.Components; using MonoDevelop.Ide.Extensions; +using Mono.TextEditor; namespace MonoDevelop.Ide.Gui { @@ -78,8 +79,6 @@ namespace MonoDevelop.Ide.Gui bool fullscreen; Rectangle normalBounds = new Rectangle(0, 0, 640, 480); - internal static GType gtype; - Gtk.Container rootWidget; DockToolbarFrame toolbarFrame; DockFrame dock; @@ -211,15 +210,7 @@ namespace MonoDevelop.Ide.Gui DeleteEvent += new Gtk.DeleteEventHandler (OnClosing); - if (Gtk.IconTheme.Default.HasIcon ("monodevelop")) - Gtk.Window.DefaultIconName = "monodevelop"; - else - this.IconList = new Gdk.Pixbuf[] { - ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.MonoDevelop, Gtk.IconSize.Menu), - ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.MonoDevelop, Gtk.IconSize.Button), - ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.MonoDevelop, Gtk.IconSize.Dnd), - ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.MonoDevelop, Gtk.IconSize.Dialog) - }; + SetAppIcons (); //this.WindowPosition = Gtk.WindowPosition.None; @@ -228,6 +219,37 @@ namespace MonoDevelop.Ide.Gui IdeApp.CommandService.SetRootWindow (this); } + + void SetAppIcons () + { + //first try to get the icon from the GTK icon theme + var appIconName = BrandingService.GetString ("ApplicationIconId") + ?? BrandingService.ApplicationName.ToLower (); + if (Gtk.IconTheme.Default.HasIcon (appIconName)) { + Gtk.Window.DefaultIconName = appIconName; + return; + } + + //branded icons + var iconsEl = BrandingService.GetElement ("ApplicationIcons"); + if (iconsEl != null) { + try { + this.IconList = iconsEl.Elements ("Icon") + .Select (el => new Gdk.Pixbuf (BrandingService.GetFile ((string)el))).ToArray (); + return; + } catch (Exception ex) { + LoggingService.LogError ("Could not load app icons", ex); + } + } + + //built-ins + this.IconList = new Gdk.Pixbuf[] { + ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.MonoDevelop, Gtk.IconSize.Menu), + ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.MonoDevelop, Gtk.IconSize.Button), + ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.MonoDevelop, Gtk.IconSize.Dnd), + ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.MonoDevelop, Gtk.IconSize.Dialog) + }; + } void onDragDataRec (object o, Gtk.DragDataReceivedArgs args) { @@ -807,16 +829,7 @@ namespace MonoDevelop.Ide.Gui ToggleFullViewMode (); }; - this.tabControl.PopupMenu += delegate { - ShowPopup (); - }; - this.tabControl.ButtonReleaseEvent += delegate (object sender, Gtk.ButtonReleaseEventArgs e) { - int tab = tabControl.FindTabAtPosition (e.Event.XRoot, e.Event.YRoot); - if (tab < 0) - return; - if (e.Event.Button == 3) - ShowPopup (); - }; + this.tabControl.DoPopupMenu = ShowPopup; tabControl.TabsReordered += new TabsReorderedHandler (OnTabsReordered); @@ -939,11 +952,10 @@ namespace MonoDevelop.Ide.Gui } } - void ShowPopup () + void ShowPopup (int tabIndex, Gdk.EventButton evt) { - Gtk.Menu contextMenu = IdeApp.CommandService.CreateMenu ("/MonoDevelop/Ide/ContextMenu/DocumentTab"); - if (contextMenu != null) - contextMenu.Popup (); + this.tabControl.Page = tabIndex; + IdeApp.CommandService.ShowContextMenu (this.tabControl, evt, "/MonoDevelop/Ide/ContextMenu/DocumentTab"); } void OnTabsReordered (Widget widget, int oldPlacement, int newPlacement) @@ -1384,6 +1396,28 @@ namespace MonoDevelop.Ide.Gui rect.Height -= CurrentPageWidget.Allocation.Height; yield return rect; } + + public Action<int,Gdk.EventButton> DoPopupMenu { get; set; } + + protected override bool OnButtonPressEvent (Gdk.EventButton evnt) + { + if (DoPopupMenu != null && evnt.TriggersContextMenu ()) { + int tab = FindTabAtPosition (evnt.XRoot, evnt.YRoot); + if (tab >= 0) { + DoPopupMenu (tab, evnt); + return true; + } + } + return base.OnButtonPressEvent (evnt); + } + + protected override bool OnPopupMenu () + { + if (DoPopupMenu != null) { + DoPopupMenu (this.Page, null); + return true; + } + return base.OnPopupMenu (); + } } -} - +}
\ No newline at end of file diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DocumentSwitcher.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DocumentSwitcher.cs index 5552b99c23..414015e081 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DocumentSwitcher.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DocumentSwitcher.cs @@ -262,7 +262,8 @@ namespace MonoDevelop.Ide { Gdk.Key key; Gdk.ModifierType mod; - KeyBindingManager.MapRawKeys (evnt, out key, out mod); + uint keyval; + Mono.TextEditor.GtkWorkarounds.MapRawKeys (evnt, out key, out mod, out keyval); switch (key) { case Gdk.Key.Left: diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DragNotebook.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DragNotebook.cs index 3b1cb8e493..367108f94b 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DragNotebook.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DragNotebook.cs @@ -28,6 +28,7 @@ using Gdk; using Gtk; using System; +using Mono.TextEditor; namespace MonoDevelop.Ide.Gui { @@ -101,7 +102,7 @@ namespace MonoDevelop.Ide.Gui [GLib.ConnectBefore] void OnButtonPress (object obj, ButtonPressEventArgs args) { - if (DragInProgress) + if (DragInProgress || args.Event.TriggersContextMenu ()) return; if (args.Event.Button == 1 && args.Event.Type == EventType.ButtonPress && FindTabAtPosition (args.Event.XRoot, args.Event.YRoot) >= 0) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/InternalLog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/InternalLog.cs index 36aa769d93..7a7e4fe0f3 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/InternalLog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/InternalLog.cs @@ -144,7 +144,6 @@ namespace MonoDevelop.Ide.Gui public int InfoCount = 0; public int DebugCount = 0; - bool errorNotificationEnabled; public LogMessage LastError = null; public void Log (LogLevel level, string message) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs index 6431a73e7a..91b9da9aaa 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs @@ -1055,7 +1055,7 @@ namespace MonoDevelop.Ide.Gui } catch (InvalidEncodingException iex) { fileInfo.ProgressMonitor.ReportError (GettextCatalog.GetString ("The file '{0}' could not opened. {1}", fileName, iex.Message), null); return; - } catch (OverflowException oex) { + } catch (OverflowException) { fileInfo.ProgressMonitor.ReportError (GettextCatalog.GetString ("The file '{0}' could not opened. File too large.", fileName), null); return; } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/CommentTasksView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/CommentTasksView.cs index 9f24810f03..457a68573c 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/CommentTasksView.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/CommentTasksView.cs @@ -102,8 +102,7 @@ namespace MonoDevelop.Ide.Tasks view = new MonoDevelop.Ide.Gui.Components.PadTreeView (store); view.RulesHint = true; view.SearchColumn = (int)Columns.Description; - view.PopupMenu += new PopupMenuHandler (OnPopupMenu); - view.ButtonPressEvent += new ButtonPressEventHandler (OnButtonPressed); + view.DoPopupMenu = (evt) => IdeApp.CommandService.ShowContextMenu (view, evt, menu); view.RowActivated += new RowActivatedHandler (OnRowActivated); TreeViewColumn col; @@ -114,19 +113,19 @@ namespace MonoDevelop.Ide.Tasks col.Clickable = true; col.SortColumnId = (int)Columns.Description; col.Resizable = true; - col.Clicked += new EventHandler (Resort); + col.Clicked += Resort; col = view.AppendColumn (GettextCatalog.GetString ("File"), view.TextRenderer, "text", Columns.File, "foreground-gdk", Columns.Foreground, "weight", Columns.Bold); col.Clickable = true; col.SortColumnId = (int)Columns.File; col.Resizable = true; - col.Clicked += new EventHandler (Resort); + col.Clicked += Resort; col = view.AppendColumn (GettextCatalog.GetString ("Path"), view.TextRenderer, "text", Columns.Path, "foreground-gdk", Columns.Foreground, "weight", Columns.Bold); col.Clickable = true; col.SortColumnId = (int)Columns.Path; col.Resizable = true; - col.Clicked += new EventHandler (Resort); + col.Clicked += Resort; LoadColumnsVisibility (); @@ -144,8 +143,6 @@ namespace MonoDevelop.Ide.Tasks PropertyService.PropertyChanged += DispatchService.GuiDispatch<EventHandler<PropertyChangedEventArgs>> (OnPropertyUpdated); - CreateMenu (); - // Initialize with existing tags. foreach (Task t in comments) AddGeneratedTask (t); @@ -346,101 +343,90 @@ namespace MonoDevelop.Ide.Tasks return TreeIter.Zero; } - void CreateMenu () + Menu CreateMenu () { - if (menu == null) + if (menu != null) + return menu; + + var group = new ActionGroup ("Popup"); + + var copy = new Gtk.Action ("copy", GettextCatalog.GetString ("_Copy"), + GettextCatalog.GetString ("Copy comment task"), Gtk.Stock.Copy); + copy.Activated += OnGenTaskCopied; + group.Add (copy, "<Control><Mod2>c"); + + var jump = new Gtk.Action ("jump", GettextCatalog.GetString ("_Go to"), + GettextCatalog.GetString ("Go to comment task"), Gtk.Stock.JumpTo); + jump.Activated += OnGenTaskJumpto; + group.Add (jump); + + var delete = new Gtk.Action ("delete", GettextCatalog.GetString ("_Delete"), + GettextCatalog.GetString ("Delete comment task"), Gtk.Stock.Delete); + delete.Activated += OnGenTaskDelete; + group.Add (delete); + + var columns = new Gtk.Action ("columns", GettextCatalog.GetString ("Columns")); + group.Add (columns, null); + + var columnLine = new ToggleAction ("columnLine", GettextCatalog.GetString ("Line"), + GettextCatalog.GetString ("Toggle visibility of Line column"), null); + columnLine.Toggled += OnColumnVisibilityChanged; + columnsActions[columnLine] = (int)Columns.Line; + group.Add (columnLine); + + var columnDescription = new ToggleAction ("columnDescription", GettextCatalog.GetString ("Description"), + GettextCatalog.GetString ("Toggle visibility of Description column"), null); + columnDescription.Toggled += OnColumnVisibilityChanged; + columnsActions[columnDescription] = (int)Columns.Description; + group.Add (columnDescription); + + var columnFile = new ToggleAction ("columnFile", GettextCatalog.GetString ("File"), + GettextCatalog.GetString ("Toggle visibility of File column"), null); + columnFile.Toggled += OnColumnVisibilityChanged; + columnsActions[columnFile] = (int)Columns.File; + group.Add (columnFile); + + var columnPath = new ToggleAction ("columnPath", GettextCatalog.GetString ("Path"), + GettextCatalog.GetString ("Toggle visibility of Path column"), null); + columnPath.Toggled += OnColumnVisibilityChanged; + columnsActions[columnPath] = (int)Columns.Path; + group.Add (columnPath); + + UIManager uiManager = new UIManager (); + uiManager.InsertActionGroup (group, 0); + + string uiStr = "<ui><popup name='popup'>" + + "<menuitem action='copy'/>" + + "<menuitem action='jump'/>" + + "<menuitem action='delete'/>" + + "<separator/>" + + "<menu action='columns'>" + + "<menuitem action='columnLine' />" + + "<menuitem action='columnDescription' />" + + "<menuitem action='columnFile' />" + + "<menuitem action='columnPath' />" + + "</menu>" + + "</popup></ui>"; + + uiManager.AddUiFromString (uiStr); + menu = (Menu)uiManager.GetWidget ("/popup"); + menu.ShowAll (); + + menu.Shown += delegate (object o, EventArgs args) { - ActionGroup group = new ActionGroup ("Popup"); - - Gtk.Action copy = new Gtk.Action ("copy", GettextCatalog.GetString ("_Copy"), - GettextCatalog.GetString ("Copy comment task"), Gtk.Stock.Copy); - copy.Activated += new EventHandler (OnGenTaskCopied); - group.Add (copy, "<Control><Mod2>c"); - - Gtk.Action jump = new Gtk.Action ("jump", GettextCatalog.GetString ("_Go to"), - GettextCatalog.GetString ("Go to comment task"), Gtk.Stock.JumpTo); - jump.Activated += new EventHandler (OnGenTaskJumpto); - group.Add (jump); - - Gtk.Action delete = new Gtk.Action ("delete", GettextCatalog.GetString ("_Delete"), - GettextCatalog.GetString ("Delete comment task"), Gtk.Stock.Delete); - delete.Activated += new EventHandler (OnGenTaskDelete); - group.Add (delete); - - Gtk.Action columns = new Gtk.Action ("columns", GettextCatalog.GetString ("Columns")); - group.Add (columns, null); - - ToggleAction columnLine = new ToggleAction ("columnLine", GettextCatalog.GetString ("Line"), - GettextCatalog.GetString ("Toggle visibility of Line column"), null); - columnLine.Toggled += new EventHandler (OnColumnVisibilityChanged); - columnsActions[columnLine] = (int)Columns.Line; - group.Add (columnLine); - - ToggleAction columnDescription = new ToggleAction ("columnDescription", GettextCatalog.GetString ("Description"), - GettextCatalog.GetString ("Toggle visibility of Description column"), null); - columnDescription.Toggled += new EventHandler (OnColumnVisibilityChanged); - columnsActions[columnDescription] = (int)Columns.Description; - group.Add (columnDescription); - - ToggleAction columnFile = new ToggleAction ("columnFile", GettextCatalog.GetString ("File"), - GettextCatalog.GetString ("Toggle visibility of File column"), null); - columnFile.Toggled += new EventHandler (OnColumnVisibilityChanged); - columnsActions[columnFile] = (int)Columns.File; - group.Add (columnFile); - - ToggleAction columnPath = new ToggleAction ("columnPath", GettextCatalog.GetString ("Path"), - GettextCatalog.GetString ("Toggle visibility of Path column"), null); - columnPath.Toggled += new EventHandler (OnColumnVisibilityChanged); - columnsActions[columnPath] = (int)Columns.Path; - group.Add (columnPath); - - UIManager uiManager = new UIManager (); - uiManager.InsertActionGroup (group, 0); - - string uiStr = "<ui><popup name='popup'>" - + "<menuitem action='copy'/>" - + "<menuitem action='jump'/>" - + "<menuitem action='delete'/>" - + "<separator/>" - + "<menu action='columns'>" - + "<menuitem action='columnLine' />" - + "<menuitem action='columnDescription' />" - + "<menuitem action='columnFile' />" - + "<menuitem action='columnPath' />" - + "</menu>" - + "</popup></ui>"; - - uiManager.AddUiFromString (uiStr); - menu = (Menu)uiManager.GetWidget ("/popup"); - menu.ShowAll (); - - menu.Shown += delegate (object o, EventArgs args) - { - columnLine.Active = view.Columns[(int)Columns.Line].Visible; - columnDescription.Active = view.Columns[(int)Columns.Description].Visible; - columnFile.Active = view.Columns[(int)Columns.File].Visible; - columnPath.Active = view.Columns[(int)Columns.Path].Visible; - copy.Sensitive = jump.Sensitive = delete.Sensitive = - view.Selection != null && - view.Selection.CountSelectedRows () > 0 && - (columnLine.Active || - columnDescription.Active || - columnFile.Active || - columnPath.Active); - }; - } - } - - [GLib.ConnectBefore] - void OnButtonPressed (object o, ButtonPressEventArgs args) - { - if (args.Event.Button == 3) - menu.Popup (); - } - - void OnPopupMenu (object o, PopupMenuArgs args) - { - menu.Popup (); + columnLine.Active = view.Columns[(int)Columns.Line].Visible; + columnDescription.Active = view.Columns[(int)Columns.Description].Visible; + columnFile.Active = view.Columns[(int)Columns.File].Visible; + columnPath.Active = view.Columns[(int)Columns.Path].Visible; + copy.Sensitive = jump.Sensitive = delete.Sensitive = + view.Selection != null && + view.Selection.CountSelectedRows () > 0 && + (columnLine.Active || + columnDescription.Active || + columnFile.Active || + columnPath.Active); + }; + return menu; } void OnGenTaskCopied (object o, EventArgs args) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/UserTasksView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/UserTasksView.cs index 759ef815a4..b0b3fd45b4 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/UserTasksView.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/UserTasksView.cs @@ -84,9 +84,7 @@ namespace MonoDevelop.Ide.Tasks view.RulesHint = true; view.SearchColumn = (int)Columns.Description; view.Selection.Changed += new EventHandler (SelectionChanged); - view.PopupMenu += new PopupMenuHandler (OnUserPopupMenu); - view.ButtonPressEvent += new ButtonPressEventHandler (OnUserButtonPressed); - + view.DoPopupMenu = ShowUserPopup; TreeViewColumn col; CellRendererComboBox cellRendPriority = new CellRendererComboBox (); @@ -344,28 +342,16 @@ namespace MonoDevelop.Ide.Tasks return lowPrioColor; } } - - [GLib.ConnectBefore] - void OnUserButtonPressed (object o, ButtonPressEventArgs args) - { - if (args.Event.Button == 3) - ShowUserPopup (); - } - - void OnUserPopupMenu (object o, PopupMenuArgs args) - { - ShowUserPopup (); - } - void ShowUserPopup () + void ShowUserPopup (Gdk.EventButton evt) { - Menu menu = new Menu (); - menu.AccelGroup = new AccelGroup (); - ImageMenuItem copy = new ImageMenuItem (Gtk.Stock.Copy, menu.AccelGroup); - copy.Activated += new EventHandler (OnUserTaskCopied); + var menu = new Menu () { + AccelGroup = new AccelGroup (), + }; + var copy = new ImageMenuItem (Gtk.Stock.Copy, menu.AccelGroup); + copy.Activated += OnUserTaskCopied; menu.Append (copy); - menu.Popup (null, null, null, 3, Gtk.Global.CurrentEventTime); - menu.ShowAll (); + IdeApp.CommandService.ShowContextMenu (view, evt, menu); } void OnUserTaskCopied (object o, EventArgs args) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Updater/AddinsUpdateHandler.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Updater/AddinsUpdateHandler.cs index 1beded6eeb..d47ac86962 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Updater/AddinsUpdateHandler.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Updater/AddinsUpdateHandler.cs @@ -32,6 +32,7 @@ using Mono.Addins.Gui; using MonoDevelop.Ide.ProgressMonitoring; using Mono.Addins; using MonoDevelop.Core.Setup; +using Mono.TextEditor; namespace MonoDevelop.Ide.Updater { @@ -85,7 +86,7 @@ namespace MonoDevelop.Ide.Updater void OnUpdateClicked (object s, ButtonPressEventArgs args) { - if (args.Event.Button == 1) { + if (!args.Event.TriggersContextMenu () && args.Event.Button == 1) { HideAlert (); AddinManagerWindow.Run (IdeApp.Workbench.RootWindow); } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageBranding.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageBranding.cs index 7f211204ef..ea8f08787a 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageBranding.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageBranding.cs @@ -51,6 +51,8 @@ namespace MonoDevelop.Ide.WelcomePage }
} catch (Exception ex) {
LoggingService.LogError ("Error while reading welcome page contents.", ex);
+ }
+ if (Content == null) {
using (var stream = typeof (WelcomePageBranding).Assembly.GetManifestResourceStream ("WelcomePageContent.xml")) {
Content = XDocument.Load (stream);
}
@@ -72,13 +74,13 @@ namespace MonoDevelop.Ide.WelcomePage public static Gdk.Pixbuf GetLogoImage ()
{
- using (var stream = BrandingService.GetStream ("WelcomePage_Logo.png"))
+ using (var stream = BrandingService.GetStream ("WelcomePage_Logo.png", true))
return new Gdk.Pixbuf (stream);
}
public static Gdk.Pixbuf GetTopBorderImage ()
{
- using (var stream = BrandingService.GetStream ("WelcomePage_TopBorderRepeat.png"))
+ using (var stream = BrandingService.GetStream ("WelcomePage_TopBorderRepeat.png", true))
return new Gdk.Pixbuf (stream);
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageLinkButton.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageLinkButton.cs index f640888ec0..2aaffb332f 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageLinkButton.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageLinkButton.cs @@ -211,7 +211,6 @@ namespace MonoDevelop.Ide.WelcomePage IdeApp.Workspace.OpenWorkspaceItem (fileuri.LocalPath, !inWorkspace);
} else if (uri.StartsWith ("monodevelop://")) {
var cmdId = uri.Substring ("monodevelop://".Length);
- var cmd = IdeApp.CommandService.GetCommand (cmdId);
IdeApp.CommandService.DispatchCommand (cmdId, MonoDevelop.Components.Commands.CommandSource.WelcomePage);
} else {
DesktopService.ShowUrl (uri);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageNewsFeed.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageNewsFeed.cs index df8baa0f2d..851cd0c79d 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageNewsFeed.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageNewsFeed.cs @@ -108,7 +108,6 @@ namespace MonoDevelop.Ide.WelcomePage object updateLock = new object ();
bool isUpdating;
- event EventHandler NewsUpdated;
void UpdateNewsXmlAsync ()
{
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageRecentProjectsList.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageRecentProjectsList.cs index a2254ec26c..0dc9b45e9a 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageRecentProjectsList.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageRecentProjectsList.cs @@ -106,7 +106,7 @@ namespace MonoDevelop.Ide.WelcomePage static string GetIcon (string fileName)
{
- string icon;
+ //string icon;
//getting the icon requires probing the file, so handle IO errors
try {
if (!System.IO.File.Exists (fileName))
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj index a710593d81..ed8aa926b5 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj @@ -861,8 +861,6 @@ <Compile Include="MonoDevelop.Ide.Gui.OptionPanels\LoadSavePanel.cs" /> <Compile Include="MonoDevelop.Ide.Gui.OptionPanels\AddInsOptionsPanel.cs" /> <Compile Include="MonoDevelop.Ide.Gui.Pads\DefaultMonitorPad.cs" /> - <Compile Include="MonoDevelop.Ide.Gui.Pads\FileList.cs" /> - <Compile Include="MonoDevelop.Ide.Gui.Pads\FileListItem.cs" /> <Compile Include="MonoDevelop.Ide.Gui.Pads\MonodocTreePad.cs" /> <Compile Include="MonoDevelop.Ide.Gui.Pads.ProjectPad\SolutionFolderNodeBuilder.cs" /> <Compile Include="MonoDevelop.Ide.Gui.Pads.ProjectPad\FolderNodeBuilder.cs" /> @@ -1020,7 +1018,6 @@ <Compile Include="MonoDevelop.Ide.FindInFiles\FilterOptions.cs" /> <Compile Include="MonoDevelop.Ide.FindInFiles\FindReplace.cs" /> <Compile Include="MonoDevelop.Ide.FindInFiles\SearchResultWidget.cs" /> - <Compile Include="gtk-gui\MonoDevelop.Ide.FindInFiles.SearchResultWidget.cs" /> <Compile Include="MonoDevelop.Ide.FindInFiles\ISearchProgressMonitor.cs" /> <Compile Include="MonoDevelop.Ide.FindInFiles\SearchProgressMonitor.cs" /> <Compile Include="MonoDevelop.Ide.Gui\IAttachableViewContent.cs" /> @@ -1508,6 +1505,7 @@ <Compile Include="MonoDevelop.Ide.Gui\CommonTextEditorOptions.cs" /> <Compile Include="MonoDevelop.Components\FileFilterSet.cs" /> <Compile Include="MonoDevelop.Ide\IdeVersionInfo.cs" /> + <Compile Include="MonoDevelop.Components\ContextMenuTreeView.cs" /> </ItemGroup> <ItemGroup> <None Include="ChangeLog" /> diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs index 23e3bc1a64..38df753cd9 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs @@ -50,6 +50,7 @@ using MonoDevelop.Core.Execution; using MonoDevelop.Core.Instrumentation; using System.Diagnostics; using MonoDevelop.Projects; +using System.Collections.Generic; namespace MonoDevelop.Ide { @@ -61,27 +62,18 @@ namespace MonoDevelop.Ide internal static string DefaultTheme; static readonly int ipcBasePort = 40000; - public int Run (string[] args) + int IApplication.Run (string[] args) + { + var options = MonoDevelopOptions.Parse (args); + if (options.Error != null || options.ShowHelp) + return options.Error != null? -1 : 0; + return Run (options); + } + + int Run (MonoDevelopOptions options) { Counters.Initialization.BeginTiming (); - var options = new MonoDevelopOptions (); - var optionsSet = new Mono.Options.OptionSet () { - { "nologo", "Do not display splash screen.", s => options.NoLogo = true }, - { "ipc-tcp", "Use the Tcp channel for inter-process comunication.", s => options.IpcTcp = true }, - { "newwindow", "Do not open in an existing instance of " + BrandingService.ApplicationName, s => options.NewWindow = true }, - { "h|?|help", "Show help", s => options.ShowHelp = true }, - { "clog", "Log internal counter data", s => options.LogCounters = true }, - { "clog-interval=", "Interval between counter logs (in miliseconds)", s => options.LogCountersInterval = int.Parse (s) }, - }; - var remainingArgs = optionsSet.Parse (args); - if (options.ShowHelp) { - Console.WriteLine ("MonoDevelop IDE " + MonoDevelop.Ide.BuildVariables.PackageVersionLabel); - Console.WriteLine ("Options:"); - optionsSet.WriteOptionDescriptions (Console.Out); - return 0; - } - if (options.LogCounters) { string logFile = Path.Combine (Environment.CurrentDirectory, "monodevelop.clog"); LoggingService.LogInfo ("Logging instrumentation service data to file: " + logFile); @@ -98,6 +90,7 @@ namespace MonoDevelop.Ide } //OSXFIXME + var args = options.RemainingArgs.ToArray (); Gtk.Application.Init ("monodevelop", ref args); //default to Windows IME on Windows @@ -119,7 +112,7 @@ namespace MonoDevelop.Ide AddinManager.AddinLoadError += OnAddinError; - var startupInfo = new StartupInfo (remainingArgs); + var startupInfo = new StartupInfo (args); // If a combine was specified, force --newwindow. @@ -288,7 +281,6 @@ namespace MonoDevelop.Ide Runtime.Shutdown (); InstrumentationService.Stop (); - System.Environment.Exit (0); return 0; } @@ -534,15 +526,21 @@ namespace MonoDevelop.Ide public static int Main (string[] args) { - bool retry = false; - - EnableFileLogging (); + var options = MonoDevelopOptions.Parse (args); + if (options.ShowHelp || options.Error != null) + return options.Error != null? -1 : 0; + if (Platform.IsWindows || options.RedirectOutput) + RedirectOutputToLogFile (); + + int ret = -1; + bool retry = false; do { try { Runtime.SetProcessName (BrandingService.ApplicationName); var app = new IdeStartup (); - return app.Run (args); + ret = app.Run (options); + break; } catch (Exception ex) { if (!retry && AddinManager.IsInitialized) { LoggingService.LogWarning (BrandingService.ApplicationName + " failed to start. Rebuilding addins registry."); @@ -559,63 +557,137 @@ namespace MonoDevelop.Ide } while (retry); - if (logFile != null) - logFile.Close (); + CloseOutputLogFile (); - return -1; + return ret; } - static StreamWriter logFile; - - static void EnableFileLogging ( ) + static void RedirectOutputToLogFile () { - if (Path.DirectorySeparatorChar != '\\') - return; - - // On Windows log all output to a log file - FilePath logDir = UserProfile.Current.LogDir; if (!Directory.Exists (logDir)) Directory.CreateDirectory (logDir); - - string file = logDir.Combine ("log.txt"); + + //TODO: log rotation + string file = logDir.Combine ("MonoDevelop.log"); try { - logFile = new StreamWriter (file); - logFile.AutoFlush = true; - - var tw = new MonoDevelop.Core.ProgressMonitoring.LogTextWriter (); - tw.ChainWriter (logFile); - tw.ChainWriter (Console.Out); - Console.SetOut (tw); + if (Platform.IsWindows) { + //TODO: redirect the file descriptors on Windows, just plugging in a textwriter won't get everything + RedirectOutputToFileWindows (file); + } else { + RedirectOutputToFileUnix (file); + } + } catch { + } + } - tw = new MonoDevelop.Core.ProgressMonitoring.LogTextWriter (); - tw.ChainWriter (logFile); - tw.ChainWriter (Console.Error); - Console.SetError (tw); + static StreamWriter logFile; + static int logFd = -1; + + static void CloseOutputLogFile () + { + if (logFile != null) { + logFile.Dispose (); + logFile = null; } - catch { + if (logFd > -1) { + Mono.Unix.Native.Syscall.close (logFd); + logFd = -1; } } + + static void RedirectOutputToFileWindows (string file) + { + logFile = new StreamWriter (file); + logFile.AutoFlush = true; + Console.SetOut (logFile); + Console.SetError (logFile); + } + + static void RedirectOutputToFileUnix (string file) + { + const int STDOUT_FILENO = 1; + const int STDERR_FILENO = 2; + + Mono.Unix.Native.OpenFlags flags = Mono.Unix.Native.OpenFlags.O_WRONLY + | Mono.Unix.Native.OpenFlags.O_CREAT | Mono.Unix.Native.OpenFlags.O_TRUNC; + var mode = Mono.Unix.Native.FilePermissions.S_IFREG + | Mono.Unix.Native.FilePermissions.S_IRUSR | Mono.Unix.Native.FilePermissions.S_IWUSR + | Mono.Unix.Native.FilePermissions.S_IRGRP | Mono.Unix.Native.FilePermissions.S_IWGRP; + + int fd = Mono.Unix.Native.Syscall.open (file, flags, mode); + if (fd < 0) + //error + return; + + int res = Mono.Unix.Native.Syscall.dup2 (fd, STDOUT_FILENO); + if (res < 0) + //error + return; + + res = Mono.Unix.Native.Syscall.dup2 (fd, STDERR_FILENO); + if (res < 0) + //error + return; + } } -#pragma warning disable 0618 public class MonoDevelopOptions { - public MonoDevelopOptions () + MonoDevelopOptions () { IpcTcp = (PlatformID.Unix != Environment.OSVersion.Platform); } + Mono.Options.OptionSet GetOptionSet () + { + return new Mono.Options.OptionSet () { + { "nologo", "Do not display splash screen.", s => NoLogo = true }, + { "ipc-tcp", "Use the Tcp channel for inter-process comunication.", s => IpcTcp = true }, + { "newwindow", "Do not open in an existing instance of " + BrandingService.ApplicationName, s => NewWindow = true }, + { "h|?|help", "Show help", s => ShowHelp = true }, + { "clog", "Log internal counter data", s => LogCounters = true }, + { "clog-interval=", "Interval between counter logs (in milliseconds)", (int i) => LogCountersInterval = i }, + { "redirect-output", "Whether to redirect stdout/stderr to a log file", s => RedirectOutput = true }, + }; + } + + public static MonoDevelopOptions Parse (string[] args) + { + var opt = new MonoDevelopOptions (); + var optSet = opt.GetOptionSet (); + + try { + opt.RemainingArgs = optSet.Parse (args); + } catch (Mono.Options.OptionException ex) { + opt.Error = ex.ToString (); + } + + if (opt.Error != null) { + Console.WriteLine ("ERROR: {0}", opt.Error); + Console.WriteLine ("Pass --help for usage information."); + } + + if (opt.ShowHelp) { + Console.WriteLine (BrandingService.ApplicationName + " " + BuildVariables.PackageVersionLabel); + Console.WriteLine ("Options:"); + optSet.WriteOptionDescriptions (Console.Out); + } + + return opt; + } + public bool NoLogo { get; set; } public bool IpcTcp { get; set; } public bool NewWindow { get; set; } public bool ShowHelp { get; set; } public bool LogCounters { get; set; } public int LogCountersInterval { get; set; } + public bool RedirectOutput { get; set; } + public string Error { get; set; } + public IList<string> RemainingArgs { get; set; } } -#pragma warning restore 0618 - public class AddinError { string addinFile; diff --git a/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.FindInFiles.SearchResultWidget.cs b/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.FindInFiles.SearchResultWidget.cs deleted file mode 100644 index 39def0a5b0..0000000000 --- a/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.FindInFiles.SearchResultWidget.cs +++ /dev/null @@ -1,103 +0,0 @@ - -// This file has been generated by the GUI designer. Do not modify. -namespace MonoDevelop.Ide.FindInFiles -{ - internal partial class SearchResultWidget - { - private global::Gtk.UIManager UIManager; - private global::Gtk.Action ViewModeAction; - private global::Gtk.HBox hbox1; - private global::Gtk.VBox vbox2; - private global::Gtk.HPaned hpaned1; - private global::Gtk.ScrolledWindow GtkScrolledWindow; - private global::Gtk.TreeView treeviewSearchResults; - private global::Gtk.ScrolledWindow scrolledwindowLogView; - private global::Gtk.TextView textviewLog; - private global::Gtk.Label labelStatus; - private global::Gtk.Toolbar toolbar; - - protected virtual void Build () - { - global::Stetic.Gui.Initialize (this); - // Widget MonoDevelop.Ide.FindInFiles.SearchResultWidget - Stetic.BinContainer w1 = global::Stetic.BinContainer.Attach (this); - this.UIManager = new global::Gtk.UIManager (); - global::Gtk.ActionGroup w2 = new global::Gtk.ActionGroup ("Default"); - this.ViewModeAction = new global::Gtk.Action ("ViewModeAction", global::MonoDevelop.Core.GettextCatalog.GetString ("ViewMode"), null, null); - this.ViewModeAction.ShortLabel = global::MonoDevelop.Core.GettextCatalog.GetString ("ViewMode"); - w2.Add (this.ViewModeAction, null); - this.UIManager.InsertActionGroup (w2, 0); - this.Name = "MonoDevelop.Ide.FindInFiles.SearchResultWidget"; - // Container child MonoDevelop.Ide.FindInFiles.SearchResultWidget.Gtk.Container+ContainerChild - this.hbox1 = new global::Gtk.HBox (); - this.hbox1.Name = "hbox1"; - this.hbox1.Spacing = 6; - // Container child hbox1.Gtk.Box+BoxChild - this.vbox2 = new global::Gtk.VBox (); - this.vbox2.Name = "vbox2"; - // Container child vbox2.Gtk.Box+BoxChild - this.hpaned1 = new global::Gtk.HPaned (); - this.hpaned1.CanFocus = true; - this.hpaned1.Name = "hpaned1"; - this.hpaned1.Position = 499; - // Container child hpaned1.Gtk.Paned+PanedChild - this.GtkScrolledWindow = new global::Gtk.ScrolledWindow (); - this.GtkScrolledWindow.Name = "GtkScrolledWindow"; - // Container child GtkScrolledWindow.Gtk.Container+ContainerChild - this.treeviewSearchResults = new global::Gtk.TreeView (); - this.treeviewSearchResults.CanFocus = true; - this.treeviewSearchResults.Name = "treeviewSearchResults"; - this.GtkScrolledWindow.Add (this.treeviewSearchResults); - this.hpaned1.Add (this.GtkScrolledWindow); - global::Gtk.Paned.PanedChild w4 = ((global::Gtk.Paned.PanedChild)(this.hpaned1 [this.GtkScrolledWindow])); - w4.Resize = false; - // Container child hpaned1.Gtk.Paned+PanedChild - this.scrolledwindowLogView = new global::Gtk.ScrolledWindow (); - this.scrolledwindowLogView.CanFocus = true; - this.scrolledwindowLogView.Name = "scrolledwindowLogView"; - this.scrolledwindowLogView.ShadowType = ((global::Gtk.ShadowType)(1)); - // Container child scrolledwindowLogView.Gtk.Container+ContainerChild - this.textviewLog = new global::Gtk.TextView (); - this.textviewLog.CanFocus = true; - this.textviewLog.Name = "textviewLog"; - this.textviewLog.Editable = false; - this.scrolledwindowLogView.Add (this.textviewLog); - this.hpaned1.Add (this.scrolledwindowLogView); - this.vbox2.Add (this.hpaned1); - global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.hpaned1])); - w7.Position = 0; - // Container child vbox2.Gtk.Box+BoxChild - this.labelStatus = new global::Gtk.Label (); - this.labelStatus.Name = "labelStatus"; - this.labelStatus.Xalign = 0F; - this.vbox2.Add (this.labelStatus); - global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.labelStatus])); - w8.Position = 1; - w8.Expand = false; - w8.Fill = false; - w8.Padding = ((uint)(3)); - this.hbox1.Add (this.vbox2); - global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.vbox2])); - w9.Position = 0; - // Container child hbox1.Gtk.Box+BoxChild - this.UIManager.AddUiFromString ("<ui><toolbar name='toolbar'/></ui>"); - this.toolbar = ((global::Gtk.Toolbar)(this.UIManager.GetWidget ("/toolbar"))); - this.toolbar.Name = "toolbar"; - this.toolbar.Orientation = ((global::Gtk.Orientation)(1)); - this.toolbar.ShowArrow = false; - this.toolbar.ToolbarStyle = ((global::Gtk.ToolbarStyle)(0)); - this.toolbar.IconSize = ((global::Gtk.IconSize)(1)); - this.hbox1.Add (this.toolbar); - global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.toolbar])); - w10.Position = 1; - w10.Expand = false; - w10.Fill = false; - this.Add (this.hbox1); - if ((this.Child != null)) { - this.Child.ShowAll (); - } - w1.SetUiManager (UIManager); - this.Hide (); - } - } -} diff --git a/main/src/core/MonoDevelop.Ide/gtk-gui/gui.stetic b/main/src/core/MonoDevelop.Ide/gtk-gui/gui.stetic index 69bf306f08..832d8246ff 100644 --- a/main/src/core/MonoDevelop.Ide/gtk-gui/gui.stetic +++ b/main/src/core/MonoDevelop.Ide/gtk-gui/gui.stetic @@ -5883,103 +5883,6 @@ Large</property> </widget> </child> </widget> - <widget class="Gtk.Bin" id="MonoDevelop.Ide.FindInFiles.SearchResultWidget" design-size="724 227"> - <action-group name="Default"> - <action id="ViewModeAction"> - <property name="Type">Action</property> - <property name="Label" translatable="yes">ViewMode</property> - <property name="ShortLabel" translatable="yes">ViewMode</property> - </action> - </action-group> - <property name="MemberName" /> - <property name="Visible">False</property> - <property name="GeneratePublic">False</property> - <child> - <widget class="Gtk.HBox" id="hbox1"> - <property name="MemberName" /> - <property name="Spacing">6</property> - <child> - <widget class="Gtk.VBox" id="vbox2"> - <property name="MemberName" /> - <child> - <widget class="Gtk.HPaned" id="hpaned1"> - <property name="MemberName" /> - <property name="CanFocus">True</property> - <property name="Position">499</property> - <child> - <widget class="Gtk.ScrolledWindow" id="GtkScrolledWindow"> - <property name="MemberName" /> - <child> - <widget class="Gtk.TreeView" id="treeviewSearchResults"> - <property name="MemberName" /> - <property name="CanFocus">True</property> - <property name="ShowScrollbars">True</property> - </widget> - </child> - </widget> - <packing> - <property name="Resize">False</property> - </packing> - </child> - <child> - <widget class="Gtk.ScrolledWindow" id="scrolledwindowLogView"> - <property name="MemberName" /> - <property name="CanFocus">True</property> - <property name="ShadowType">In</property> - <child> - <widget class="Gtk.TextView" id="textviewLog"> - <property name="MemberName" /> - <property name="CanFocus">True</property> - <property name="Editable">False</property> - <property name="Text" translatable="yes" /> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="Position">0</property> - <property name="AutoSize">True</property> - </packing> - </child> - <child> - <widget class="Gtk.Label" id="labelStatus"> - <property name="MemberName" /> - <property name="Xalign">0</property> - </widget> - <packing> - <property name="Position">1</property> - <property name="AutoSize">True</property> - <property name="Expand">False</property> - <property name="Fill">False</property> - <property name="Padding">3</property> - </packing> - </child> - </widget> - <packing> - <property name="Position">0</property> - <property name="AutoSize">False</property> - </packing> - </child> - <child> - <widget class="Gtk.Toolbar" id="toolbar"> - <property name="MemberName" /> - <property name="Orientation">Vertical</property> - <property name="ShowArrow">False</property> - <property name="ButtonStyle">Icons</property> - <property name="IconSize">Menu</property> - <node name="toolbar" type="Toolbar" /> - </widget> - <packing> - <property name="Position">1</property> - <property name="AutoSize">True</property> - <property name="Expand">False</property> - <property name="Fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> <widget class="Gtk.Bin" id="MonoDevelop.Ide.Execution.CustomExecutionModeWidget" design-size="486 313"> <property name="MemberName" /> <property name="Visible">False</property> |