Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5236 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61pull/1/head
45 changed files with 193 additions and 3630 deletions
@ -1,142 +0,0 @@
@@ -1,142 +0,0 @@
|
||||
<Components version="1.0"> |
||||
<System.Windows.Forms.UserControl> |
||||
<Name value="CreatedObject0" /> |
||||
<DockPadding value="" /> |
||||
<ClientSize value="{Width=384, Height=352}" /> |
||||
<Controls> |
||||
<System.Windows.Forms.GroupBox> |
||||
<Name value="CreatedObject2" /> |
||||
<TabIndex value="0" /> |
||||
<Location value="{X=8,Y=8}" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<ClientSize value="{Width=368, Height=112}" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.TabsGroupBox}" /> |
||||
<Controls> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="convertTabsToSpacesCheckBox" /> |
||||
<Location value="{X=16,Y=80}" /> |
||||
<ClientSize value="{Width=344, Height=24}" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.ConvertTabsToSpacesCheckBox}" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="6" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="CreatedObject5" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.IndentLabel}" /> |
||||
<TextAlign value="BottomLeft" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="4" /> |
||||
<ClientSize value="{Width=152, Height=24}" /> |
||||
<Location value="{X=208,Y=18}" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.ComboBox> |
||||
<Name value="indentStyleComboBox" /> |
||||
<DropDownWidth value="128" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="5" /> |
||||
<Location value="{X=208,Y=44}" /> |
||||
<ClientSize value="{Width=152, Height=21}" /> |
||||
<DropDownStyle value="DropDownList" /> |
||||
</System.Windows.Forms.ComboBox> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="CreatedObject13" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.TabSizeLabel}" /> |
||||
<TextAlign value="MiddleRight" /> |
||||
<TabIndex value="0" /> |
||||
<ClientSize value="{Width=112, Height=24}" /> |
||||
<Location value="{X=8,Y=16}" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.TextBox> |
||||
<Name value="tabSizeTextBox" /> |
||||
<TabIndex value="1" /> |
||||
<Location value="{X=120,Y=16}" /> |
||||
<ClientSize value="{Width=52, Height=17}" /> |
||||
<Text value="" /> |
||||
</System.Windows.Forms.TextBox> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="CreatedObject18" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.IndentSizeLabel}" /> |
||||
<TextAlign value="MiddleRight" /> |
||||
<TabIndex value="2" /> |
||||
<ClientSize value="{Width=112, Height=24}" /> |
||||
<Location value="{X=8,Y=40}" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.TextBox> |
||||
<Name value="indentSizeTextBox" /> |
||||
<TabIndex value="3" /> |
||||
<Location value="{X=120,Y=40}" /> |
||||
<ClientSize value="{Width=52, Height=17}" /> |
||||
<Text value="" /> |
||||
</System.Windows.Forms.TextBox> |
||||
</Controls> |
||||
</System.Windows.Forms.GroupBox> |
||||
<System.Windows.Forms.GroupBox> |
||||
<Name value="CreatedObject27" /> |
||||
<TabIndex value="1" /> |
||||
<Location value="{X=8,Y=128}" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<ClientSize value="{Width=368, Height=200}" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.BehaviourGroupBox}" /> |
||||
<Controls> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="autoinsertCurlyBraceCheckBox" /> |
||||
<Location value="{X=8,Y=68}" /> |
||||
<ClientSize value="{Width=348, Height=24}" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.CurlyBracketCheckBox}" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="2" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="hideMouseCursorCheckBox" /> |
||||
<Location value="{X=8,Y=92}" /> |
||||
<ClientSize value="{Width=348, Height=24}" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.HideMouseCheckBox}" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="3" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="cutCopyWholeLine" /> |
||||
<Location value="{X=8,Y=116}" /> |
||||
<ClientSize value="{Width=348, Height=24}" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.CutCopyWholeLine}" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="4" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="caretBehindEOLCheckBox" /> |
||||
<Location value="{X=8,Y=20}" /> |
||||
<ClientSize value="{Width=348, Height=24}" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.BehindEOLCheckBox}" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="0" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="auotInsertTemplatesCheckBox" /> |
||||
<Location value="{X=8,Y=44}" /> |
||||
<ClientSize value="{Width=348, Height=24}" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.TemplateInsertCheckBox}" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="1" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.ComboBox> |
||||
<Name value="mouseWhellDirectionComboBox" /> |
||||
<Anchor value="Bottom, Left" /> |
||||
<TabIndex value="6" /> |
||||
<Location value="{X=8,Y=168}" /> |
||||
<ClientSize value="{Width=152, Height=21}" /> |
||||
<DropDownStyle value="DropDownList" /> |
||||
</System.Windows.Forms.ComboBox> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="label" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.MouseWhellGroupBox}" /> |
||||
<TextAlign value="BottomLeft" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="5" /> |
||||
<ClientSize value="{Width=160, Height=24}" /> |
||||
<Location value="{X=8,Y=142}" /> |
||||
</System.Windows.Forms.Label> |
||||
</Controls> |
||||
</System.Windows.Forms.GroupBox> |
||||
</Controls> |
||||
</System.Windows.Forms.UserControl> |
||||
</Components> |
@ -1,134 +0,0 @@
@@ -1,134 +0,0 @@
|
||||
<Components version="1.0"> |
||||
<System.Windows.Forms.UserControl> |
||||
<Name value="CreatedObject0" /> |
||||
<ClientSize value="{Width=376, Height=344}" /> |
||||
<Controls> |
||||
<System.Windows.Forms.GroupBox> |
||||
<Name value="CreatedObject2" /> |
||||
<Location value="8, 8" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.General.GeneralOptionsGroupBox}" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<Size value="360, 80" /> |
||||
<TabIndex value="0" /> |
||||
<Controls> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="showQuickClassBrowserCheckBox" /> |
||||
<Location value="8, 52" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.General.ShowQuickClassBrowserCheckBox}" /> |
||||
<TabIndex value="4" /> |
||||
<Size value="344, 24" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="enableFoldingCheckBox" /> |
||||
<Location value="8, 24" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.General.FoldingCheckBox}" /> |
||||
<TabIndex value="3" /> |
||||
<Size value="344, 24" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
</Controls> |
||||
</System.Windows.Forms.GroupBox> |
||||
<System.Windows.Forms.GroupBox> |
||||
<Name value="CreatedObject7" /> |
||||
<Location value="8, 96" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.General.FontGroupBox}" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<Size value="360, 136" /> |
||||
<TabIndex value="1" /> |
||||
<Controls> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="fontPreviewLabel" /> |
||||
<Location value="8, 71" /> |
||||
<Text value="AaBbCcXxYyZz" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TextAlign value="MiddleCenter" /> |
||||
<Size value="344, 40" /> |
||||
<BackColor value="Color [ControlLightLight]" /> |
||||
<TabIndex value="4" /> |
||||
<BorderStyle value="FixedSingle" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="fontSizeLabel" /> |
||||
<Location value="248, 21" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.General.FontSizeLabel}" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TextAlign value="BottomLeft" /> |
||||
<Size value="100, 20" /> |
||||
<TabIndex value="2" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.ComboBox> |
||||
<Name value="fontSizeComboBox" /> |
||||
<Size value="104, 21" /> |
||||
<TabIndex value="3" /> |
||||
<FormattingEnabled value="True" /> |
||||
<Location value="248, 41" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.ComboBox> |
||||
<System.Windows.Forms.ComboBox> |
||||
<Name value="fontListComboBox" /> |
||||
<Size value="224, 21" /> |
||||
<TabIndex value="1" /> |
||||
<DrawMode value="OwnerDrawFixed" /> |
||||
<FormattingEnabled value="True" /> |
||||
<DropDownStyle value="DropDownList" /> |
||||
<RightToLeft value="No" /> |
||||
<Location value="8, 40" /> |
||||
</System.Windows.Forms.ComboBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="mouseWheelZoomCheckBox" /> |
||||
<Location value="{X=182,Y=109}" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.General.MouseWheelZoomCheckBoxCheckBox}" /> |
||||
<TabIndex value="6" /> |
||||
<Size value="{Width=170, Height=24}" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="CreatedObject9" /> |
||||
<Location value="8, 20" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.General.TextfontLabel}" /> |
||||
<TextAlign value="BottomLeft" /> |
||||
<Size value="208, 20" /> |
||||
<TabIndex value="0" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="enableAAFontRenderingCheckBox" /> |
||||
<Location value="8, 108" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.General.AntialiasedFontCheckBox}" /> |
||||
<TabIndex value="5" /> |
||||
<Size value="184, 24" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
</Controls> |
||||
</System.Windows.Forms.GroupBox> |
||||
<System.Windows.Forms.GroupBox> |
||||
<Name value="CreatedObject8b" /> |
||||
<Location value="8, 240" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.General.FontGroupBox.FileEncodingGroupBox}" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<Size value="360, 72" /> |
||||
<TabIndex value="2" /> |
||||
<Controls> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="CreatedObject9b" /> |
||||
<Location value="8, 24" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.General.FontGroupBox.FileEncodingLabel}" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TextAlign value="BottomLeft" /> |
||||
<Size value="336, 16" /> |
||||
<TabIndex value="0" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.ComboBox> |
||||
<Name value="textEncodingComboBox" /> |
||||
<Size value="344, 21" /> |
||||
<TabIndex value="1" /> |
||||
<FormattingEnabled value="True" /> |
||||
<DropDownStyle value="DropDownList" /> |
||||
<RightToLeft value="No" /> |
||||
<Location value="8, 40" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.ComboBox> |
||||
</Controls> |
||||
</System.Windows.Forms.GroupBox> |
||||
</Controls> |
||||
</System.Windows.Forms.UserControl> |
||||
</Components> |
@ -1,136 +0,0 @@
@@ -1,136 +0,0 @@
|
||||
<Components version="1.0"> |
||||
<System.Windows.Forms.UserControl> |
||||
<Name value="CreatedObject0" /> |
||||
<ClientSize value="{Width=408, Height=328}" /> |
||||
<Controls> |
||||
<System.Windows.Forms.GroupBox> |
||||
<Name value="CreatedObject2" /> |
||||
<Location value="8, 8" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Markers.MarkersGroupBox}" /> |
||||
<Size value="392, 308" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="0" /> |
||||
<Controls> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="showCaretLineCheckBox" /> |
||||
<Location value="8, 68" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Markers.CaretCheckBox}" /> |
||||
<TabIndex value="14" /> |
||||
<Size value="176, 24" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.ComboBox> |
||||
<Name value="bracketMatchingStyleComboBox" /> |
||||
<TabIndex value="9" /> |
||||
<Location value="236, 186" /> |
||||
<Anchor value="Bottom, Right" /> |
||||
<Size value="148, 21" /> |
||||
<DropDownStyle value="DropDownList" /> |
||||
</System.Windows.Forms.ComboBox> |
||||
<System.Windows.Forms.ComboBox> |
||||
<Name value="lineMarkerStyleComboBox" /> |
||||
<TabIndex value="5" /> |
||||
<Location value="192, 100" /> |
||||
<Anchor value="Top, Right" /> |
||||
<Size value="188, 21" /> |
||||
<DropDownStyle value="DropDownList" /> |
||||
<DropDownWidth value="168" /> |
||||
</System.Windows.Forms.ComboBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="showLineNumberCheckBox" /> |
||||
<Location value="8, 138" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Markers.LineNumberCheckBox}" /> |
||||
<TabIndex value="6" /> |
||||
<Size value="376, 24" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="showErrorsCheckBox" /> |
||||
<Location value="8, 162" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Markers.UnderLineErrorsCheckBox}" /> |
||||
<TabIndex value="7" /> |
||||
<Size value="376, 24" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="showBracketHighlighterCheckBox" /> |
||||
<Location value="8, 186" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Markers.HiglightBracketCheckBox}" /> |
||||
<TabIndex value="8" /> |
||||
<Size value="222, 24" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="showInvalidLinesCheckBox" /> |
||||
<Location value="8, 210" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Markers.InvalidLinesCheckBox}" /> |
||||
<TabIndex value="10" /> |
||||
<Size value="376, 24" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="showHRulerCheckBox" /> |
||||
<Location value="8, 16" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Markers.HorizontalRulerCheckBox}" /> |
||||
<TabIndex value="0" /> |
||||
<Size value="176, 24" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="showEOLMarkersCheckBox" /> |
||||
<Location value="8, 234" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Markers.EOLMarkersCheckBox}" /> |
||||
<TabIndex value="11" /> |
||||
<Size value="376, 24" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="showVRulerCheckBox" /> |
||||
<Location value="8, 42" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Markers.VerticalRulerCheckBox}" /> |
||||
<TabIndex value="1" /> |
||||
<Size value="176, 24" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="showTabCharsCheckBox" /> |
||||
<Location value="8, 282" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Markers.TabsCheckBox}" /> |
||||
<TabIndex value="13" /> |
||||
<Size value="376, 24" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="showSpaceCharsCheckBox" /> |
||||
<Location value="8, 258" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Markers.SpacesCheckBox}" /> |
||||
<TabIndex value="12" /> |
||||
<Size value="376, 24" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="CreatedObject23" /> |
||||
<Location value="208, 44" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Markers.AtRowLabel}" /> |
||||
<Size value="104, 24" /> |
||||
<TextAlign value="MiddleRight" /> |
||||
<Anchor value="Top, Right" /> |
||||
<TabIndex value="2" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.TextBox> |
||||
<Name value="vRulerRowTextBox" /> |
||||
<TabIndex value="3" /> |
||||
<Location value="312, 43" /> |
||||
<Anchor value="Top, Right" /> |
||||
<Size value="64, 20" /> |
||||
</System.Windows.Forms.TextBox> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="CreatedObject28" /> |
||||
<Location value="8, 95" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.Markers.LineMarkerLabel}" /> |
||||
<Size value="152, 24" /> |
||||
<TextAlign value="MiddleLeft" /> |
||||
<TabIndex value="4" /> |
||||
</System.Windows.Forms.Label> |
||||
</Controls> |
||||
</System.Windows.Forms.GroupBox> |
||||
</Controls> |
||||
</System.Windows.Forms.UserControl> |
||||
</Components> |
@ -1,70 +0,0 @@
@@ -1,70 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.TextEditor; |
||||
using ICSharpCode.TextEditor.Actions; |
||||
using ICSharpCode.TextEditor.Document; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.DefaultEditor.Actions |
||||
{ |
||||
public class CodeCompletionPopup : AbstractEditAction |
||||
{ |
||||
public override void Execute(TextArea textArea) |
||||
{ |
||||
SharpDevelopTextAreaControl sdtac = (SharpDevelopTextAreaControl)textArea.MotherTextEditorControl; |
||||
sdtac.StartCtrlSpaceCompletion(); |
||||
} |
||||
} |
||||
|
||||
public class ExpandTemplateAction : Tab |
||||
{ |
||||
public override void Execute(TextArea textArea) |
||||
{ |
||||
SharpDevelopTextAreaControl sdtac = (SharpDevelopTextAreaControl)textArea.MotherTextEditorControl; |
||||
if (!sdtac.ExpandTemplateOnTab()) |
||||
base.Execute(textArea); |
||||
} |
||||
} |
||||
|
||||
public class GoToDefinition : AbstractEditAction |
||||
{ |
||||
public override void Execute(TextArea textArea) |
||||
{ |
||||
TextEditorControl textEditorControl = textArea.MotherTextEditorControl; |
||||
IDocument document = textEditorControl.Document; |
||||
string textContent = document.TextContent; |
||||
|
||||
int caretLineNumber = document.GetLineNumberForOffset(textEditorControl.ActiveTextAreaControl.Caret.Offset) + 1; |
||||
int caretColumn = textEditorControl.ActiveTextAreaControl.Caret.Offset - document.GetLineSegment(caretLineNumber - 1).Offset + 1; |
||||
|
||||
IExpressionFinder expressionFinder = ParserService.GetExpressionFinder(textEditorControl.FileName); |
||||
if (expressionFinder == null) |
||||
return; |
||||
ExpressionResult expression = expressionFinder.FindFullExpression(textContent, textEditorControl.ActiveTextAreaControl.Caret.Offset); |
||||
if (expression.Expression == null || expression.Expression.Length == 0) |
||||
return; |
||||
ResolveResult result = ParserService.Resolve(expression, caretLineNumber, caretColumn, textEditorControl.FileName, textContent); |
||||
if (result != null) { |
||||
FilePosition pos = result.GetDefinitionPosition(); |
||||
if (pos.IsEmpty == false) { |
||||
try { |
||||
if (pos.Position.IsEmpty) |
||||
FileService.OpenFile(pos.FileName); |
||||
else |
||||
FileService.JumpToFilePosition(pos.FileName, pos.Line, pos.Column); |
||||
} catch (Exception ex) { |
||||
MessageService.ShowException(ex, "Error jumping to '" + pos.FileName + "'."); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,63 +0,0 @@
@@ -1,63 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Collections; |
||||
using System.Reflection; |
||||
using System.Windows.Forms; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.TextEditor.Actions; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.DefaultEditor.Codons |
||||
{ |
||||
/// <summary>
|
||||
/// Creates IEditAction objects for the text editor.
|
||||
/// </summary>
|
||||
/// <attribute name="keys" use="required">
|
||||
/// Comma-separated list of keyboard shortcuts that activate the edit action.
|
||||
/// E.g. "Control|C,Control|Insert"
|
||||
/// </attribute>
|
||||
/// <attribute name="class" use="required">
|
||||
/// Name of the IEditAction class.
|
||||
/// </attribute>
|
||||
/// <usage>Only in /AddIns/DefaultTextEditor/EditActions</usage>
|
||||
/// <returns>
|
||||
/// An IEditAction object.
|
||||
/// </returns>
|
||||
public class EditActionDoozer : IDoozer |
||||
{ |
||||
/// <summary>
|
||||
/// Gets if the doozer handles codon conditions on its own.
|
||||
/// If this property return false, the item is excluded when the condition is not met.
|
||||
/// </summary>
|
||||
public bool HandleConditions { |
||||
get { |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
public object BuildItem(object caller, Codon codon, ArrayList subItems) |
||||
{ |
||||
IEditAction editAction = (IEditAction)codon.AddIn.CreateObject(codon.Properties["class"]); |
||||
string[] keys = codon.Properties["keys"].Split(','); |
||||
|
||||
Keys[] actionKeys = new Keys[keys.Length]; |
||||
for (int j = 0; j < keys.Length; ++j) { |
||||
string[] keydescr = keys[j].Split('|'); |
||||
Keys key = (Keys)((System.Windows.Forms.Keys.Space.GetType()).InvokeMember(keydescr[0], BindingFlags.GetField, null, System.Windows.Forms.Keys.Space, new object[0])); |
||||
for (int k = 1; k < keydescr.Length; ++k) { |
||||
key |= (Keys)((System.Windows.Forms.Keys.Space.GetType()).InvokeMember(keydescr[k], BindingFlags.GetField, null, System.Windows.Forms.Keys.Space, new object[0])); |
||||
} |
||||
actionKeys[j] = key; |
||||
} |
||||
editAction.Keys = actionKeys; |
||||
|
||||
return editAction; |
||||
} |
||||
} |
||||
} |
@ -1,30 +0,0 @@
@@ -1,30 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Markus Palme" email="MarkusPalme@gmx.de"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.TextEditor; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands |
||||
{ |
||||
public class CommentRegion : AbstractMenuCommand |
||||
{ |
||||
public override void Run() |
||||
{ |
||||
IViewContent viewContent = WorkbenchSingleton.Workbench.ActiveViewContent; |
||||
|
||||
if (viewContent == null || !(viewContent is ITextEditorControlProvider)) { |
||||
return; |
||||
} |
||||
|
||||
TextEditorControl textarea = ((ITextEditorControlProvider)viewContent).TextEditorControl; |
||||
new ICSharpCode.TextEditor.Actions.ToggleComment().Execute(textarea.ActiveTextAreaControl.TextArea); |
||||
} |
||||
} |
||||
} |
@ -1,141 +0,0 @@
@@ -1,141 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Collections; |
||||
using System.Windows.Forms; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.TextEditor; |
||||
using ICSharpCode.TextEditor.Actions; |
||||
using ICSharpCode.TextEditor.Document; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands |
||||
{ |
||||
public abstract class AbstractEditActionMenuCommand : AbstractMenuCommand |
||||
{ |
||||
public abstract IEditAction EditAction { |
||||
get; |
||||
} |
||||
|
||||
public override void Run() |
||||
{ |
||||
IViewContent viewContent = WorkbenchSingleton.Workbench.ActiveViewContent; |
||||
|
||||
if (viewContent == null || !(viewContent is ITextEditorControlProvider)) { |
||||
return; |
||||
} |
||||
TextEditorControl textEditor = ((ITextEditorControlProvider)viewContent).TextEditorControl; |
||||
EditAction.Execute(textEditor.ActiveTextAreaControl.TextArea); |
||||
} |
||||
} |
||||
|
||||
public class RemoveLeadingWS : AbstractEditActionMenuCommand |
||||
{ |
||||
public override IEditAction EditAction { |
||||
get { |
||||
return new ICSharpCode.TextEditor.Actions.RemoveLeadingWS(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public class RemoveTrailingWS : AbstractEditActionMenuCommand |
||||
{ |
||||
public override IEditAction EditAction { |
||||
get { |
||||
return new ICSharpCode.TextEditor.Actions.RemoveTrailingWS(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
public class ToUpperCase : AbstractEditActionMenuCommand |
||||
{ |
||||
public override IEditAction EditAction { |
||||
get { |
||||
return new ICSharpCode.TextEditor.Actions.ToUpperCase(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public class ToLowerCase : AbstractEditActionMenuCommand |
||||
{ |
||||
public override IEditAction EditAction { |
||||
get { |
||||
return new ICSharpCode.TextEditor.Actions.ToLowerCase(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public class InvertCaseAction : AbstractEditActionMenuCommand |
||||
{ |
||||
public override IEditAction EditAction { |
||||
get { |
||||
return new ICSharpCode.TextEditor.Actions.InvertCaseAction(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public class CapitalizeAction : AbstractEditActionMenuCommand |
||||
{ |
||||
public override IEditAction EditAction { |
||||
get { |
||||
return new ICSharpCode.TextEditor.Actions.CapitalizeAction(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public class ConvertTabsToSpaces : AbstractEditActionMenuCommand |
||||
{ |
||||
public override IEditAction EditAction { |
||||
get { |
||||
return new ICSharpCode.TextEditor.Actions.ConvertTabsToSpaces(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public class ConvertSpacesToTabs : AbstractEditActionMenuCommand |
||||
{ |
||||
public override IEditAction EditAction { |
||||
get { |
||||
return new ICSharpCode.TextEditor.Actions.ConvertSpacesToTabs(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public class ConvertLeadingTabsToSpaces : AbstractEditActionMenuCommand |
||||
{ |
||||
public override IEditAction EditAction { |
||||
get { |
||||
return new ICSharpCode.TextEditor.Actions.ConvertLeadingTabsToSpaces(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public class ConvertLeadingSpacesToTabs : AbstractEditActionMenuCommand |
||||
{ |
||||
public override IEditAction EditAction { |
||||
get { |
||||
return new ICSharpCode.TextEditor.Actions.ConvertLeadingSpacesToTabs(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// This is a sample editaction plugin, it indents the selected area.
|
||||
/// </summary>
|
||||
public class IndentSelection : AbstractEditActionMenuCommand |
||||
{ |
||||
public override IEditAction EditAction { |
||||
get { |
||||
return new ICSharpCode.TextEditor.Actions.IndentSelection(); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,22 +0,0 @@
@@ -1,22 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using ICSharpCode.TextEditor.Actions; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands |
||||
{ |
||||
public class GoToDefinition : AbstractEditActionMenuCommand |
||||
{ |
||||
public override IEditAction EditAction { |
||||
get { |
||||
// TODO: use click position instead of cursor position
|
||||
return new ICSharpCode.SharpDevelop.DefaultEditor.Actions.GoToDefinition(); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,70 +0,0 @@
@@ -1,70 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using System; |
||||
using System.Collections; |
||||
using System.Windows.Forms; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.Core.WinForms; |
||||
using ICSharpCode.SharpDevelop.Commands; |
||||
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; |
||||
using ICSharpCode.TextEditor; |
||||
using ICSharpCode.TextEditor.Document; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands |
||||
{ |
||||
public class ShowBufferOptions : AbstractMenuCommand |
||||
{ |
||||
public override void Run() |
||||
{ |
||||
OptionsCommand.ShowTabbedOptions( |
||||
ResourceService.GetString("Dialog.Options.BufferOptions"), |
||||
AddInTree.GetTreeNode("/SharpDevelop/ViewContent/DefaultTextEditor/OptionsDialog")); |
||||
} |
||||
} |
||||
|
||||
|
||||
public class HighlightingTypeBuilder : ISubmenuBuilder |
||||
{ |
||||
TextEditorControl control = null; |
||||
ToolStripItem[] menuCommands = null; |
||||
|
||||
public ToolStripItem[] BuildSubmenu(Codon codon, object owner) |
||||
{ |
||||
control = (TextEditorControl)owner; |
||||
|
||||
ArrayList menuItems = new ArrayList(); |
||||
|
||||
foreach (DictionaryEntry entry in HighlightingManager.Manager.HighlightingDefinitions) { |
||||
MenuCheckBox item = new MenuCheckBox(entry.Key.ToString()); |
||||
item.Click += new EventHandler(ChangeSyntax); |
||||
item.Checked = control.Document.HighlightingStrategy.Name == entry.Key.ToString(); |
||||
menuItems.Add(item); |
||||
} |
||||
menuCommands = (ToolStripItem[])menuItems.ToArray(typeof(ToolStripItem)); |
||||
return menuCommands; |
||||
} |
||||
|
||||
void ChangeSyntax(object sender, EventArgs e) |
||||
{ |
||||
if (control != null) { |
||||
MenuCheckBox item = (MenuCheckBox)sender; |
||||
foreach (MenuCheckBox i in menuCommands) { |
||||
i.Checked = false; |
||||
} |
||||
item.Checked = true; |
||||
try { |
||||
control.SetHighlighting(item.Text); |
||||
} catch (HighlightingDefinitionInvalidException ex) { |
||||
MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); |
||||
} |
||||
control.Refresh(); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,203 +0,0 @@
@@ -1,203 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.TextEditor; |
||||
using ICSharpCode.TextEditor.Document; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor |
||||
{ |
||||
/// <summary>
|
||||
/// Interface for advanced syntax highlighters.
|
||||
/// </summary>
|
||||
public interface IAdvancedHighlighter : IDisposable |
||||
{ |
||||
/// <summary>
|
||||
/// Is called once after creating the highlighter. Gives your highlighter a chance
|
||||
/// to register events on the text editor.
|
||||
/// </summary>
|
||||
void Initialize(TextEditorControl textEditor); |
||||
|
||||
void BeginUpdate(IDocument document, IList<LineSegment> inputLines); |
||||
void EndUpdate(); |
||||
|
||||
/// <summary>
|
||||
/// Gives your highlighter the chance to change the highlighting of the words.
|
||||
/// </summary>
|
||||
void MarkLine(int lineNumber, LineSegment currentLine, List<TextWord> words); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Advanced syntax highlighter that stores a list of changed lines and can mark them
|
||||
/// later by calling <see cref="MarkOutstanding"/>.
|
||||
/// </summary>
|
||||
public abstract class AsynchronousAdvancedHighlighter : IAdvancedHighlighter |
||||
{ |
||||
protected abstract void MarkWords(int lineNumber, LineSegment currentLine, List<TextWord> words); |
||||
|
||||
readonly object lockObject = new object(); |
||||
Dictionary<LineSegment, List<TextWord>> outstanding = new Dictionary<LineSegment, List<TextWord>>(); |
||||
TextEditorControl textEditor; |
||||
IDocument document; |
||||
|
||||
#region Settings
|
||||
public TextEditorControl TextEditor { |
||||
get { |
||||
return textEditor; |
||||
} |
||||
} |
||||
|
||||
public IDocument Document { |
||||
get { |
||||
return document; |
||||
} |
||||
} |
||||
|
||||
int immediateMarkLimit = 3; |
||||
|
||||
/// <summary>
|
||||
/// Maximum number of changed lines to immediately mark the changes.
|
||||
/// </summary>
|
||||
protected int ImmediateMarkLimit { |
||||
get { |
||||
return immediateMarkLimit; |
||||
} |
||||
set { |
||||
if (value < 0) throw new ArgumentOutOfRangeException("value", value, "value must be >= 0"); |
||||
immediateMarkLimit = value; |
||||
} |
||||
} |
||||
|
||||
bool markVisibleOnly = true; |
||||
/// <summary>
|
||||
/// Gets/Sets whether to only mark lines in the visible region of the text area.
|
||||
/// </summary>
|
||||
protected bool MarkVisibleOnly { |
||||
get { |
||||
return markVisibleOnly; |
||||
} |
||||
set { |
||||
if (markVisibleOnly != value) { |
||||
if (textEditor != null) |
||||
throw new InvalidOperationException("Cannot change value after initialization"); |
||||
markVisibleOnly = value; |
||||
} |
||||
} |
||||
} |
||||
int markVisibleAdditional = 5; |
||||
/// <summary>
|
||||
/// Number of additional lines around the visible region that should be marked.
|
||||
/// </summary>
|
||||
public int MarkVisibleAdditional { |
||||
get { |
||||
return markVisibleAdditional; |
||||
} |
||||
set { |
||||
if (value < 0) throw new ArgumentOutOfRangeException("value", value, "value must be >= 0"); |
||||
markVisibleAdditional = value; |
||||
} |
||||
} |
||||
#endregion
|
||||
|
||||
public virtual void Initialize(TextEditorControl textEditor) |
||||
{ |
||||
if (textEditor == null) |
||||
throw new ArgumentNullException("textEditor"); |
||||
if (this.textEditor != null) |
||||
throw new InvalidOperationException("Already initialized"); |
||||
this.textEditor = textEditor; |
||||
this.document = textEditor.Document; |
||||
} |
||||
|
||||
public virtual void Dispose() |
||||
{ |
||||
textEditor = null; |
||||
document = null; |
||||
} |
||||
|
||||
int directMark; |
||||
|
||||
public virtual void BeginUpdate(IDocument document, IList<LineSegment> inputLines) |
||||
{ |
||||
if (this.document == null) |
||||
throw new InvalidOperationException("Not initialized"); |
||||
if (document != this.document) |
||||
throw new InvalidOperationException("document != this.document"); |
||||
if (inputLines == null) { |
||||
lock (lockObject) { |
||||
outstanding.Clear(); |
||||
} |
||||
} else { |
||||
directMark = inputLines.Count > immediateMarkLimit ? 0 : inputLines.Count; |
||||
} |
||||
} |
||||
|
||||
public virtual void EndUpdate() |
||||
{ |
||||
} |
||||
|
||||
void IAdvancedHighlighter.MarkLine(int lineNumber, LineSegment currentLine, List<TextWord> words) |
||||
{ |
||||
if (directMark > 0) { |
||||
directMark--; |
||||
MarkWords(lineNumber, currentLine, words); |
||||
} else { |
||||
lock (lockObject) { |
||||
outstanding[currentLine] = words; |
||||
} |
||||
} |
||||
} |
||||
|
||||
protected virtual void MarkOutstanding() |
||||
{ |
||||
if (WorkbenchSingleton.InvokeRequired) { |
||||
// TODO: allow calling MarkOutstanding in separate threads
|
||||
throw new InvalidOperationException("Invoke required"); |
||||
} |
||||
|
||||
IEnumerable<KeyValuePair<LineSegment, List<TextWord>>> oldOutstanding; |
||||
lock (lockObject) { |
||||
oldOutstanding = outstanding; |
||||
outstanding = new Dictionary<LineSegment, List<TextWord>>(); |
||||
} |
||||
// We cannot call MarkLine inside lock(lockObject) because then the main
|
||||
// thread could deadlock with the highlighter thread.
|
||||
foreach (KeyValuePair<LineSegment, List<TextWord>> pair in oldOutstanding) { |
||||
if (pair.Key.IsDeleted) |
||||
continue; |
||||
int offset = pair.Key.Offset; |
||||
if (offset < 0 || offset >= document.TextLength) |
||||
continue; |
||||
int lineNumber = document.GetLineNumberForOffset(offset); |
||||
if (markVisibleOnly && IsVisible(lineNumber) == false) { |
||||
lock (lockObject) { |
||||
outstanding[pair.Key] = pair.Value; |
||||
} |
||||
} else { |
||||
MarkWords(lineNumber, pair.Key, pair.Value); |
||||
} |
||||
} |
||||
} |
||||
|
||||
bool IsVisible(int lineNumber) |
||||
{ |
||||
TextView textView = textEditor.ActiveTextAreaControl.TextArea.TextView; |
||||
int firstLine = textView.FirstVisibleLine; |
||||
if (lineNumber < firstLine - markVisibleAdditional) { |
||||
return false; |
||||
} |
||||
int lastLine = document.GetFirstLogicalLine(textView.FirstPhysicalLine + textView.VisibleLineCount); |
||||
if (lineNumber > lastLine + markVisibleAdditional) { |
||||
return false; |
||||
} |
||||
// line is visible if it is not folded away
|
||||
return document.GetVisibleLine(lineNumber) != document.GetVisibleLine(lineNumber - 1); |
||||
} |
||||
} |
||||
} |
@ -1,49 +0,0 @@
@@ -1,49 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.TextEditor.Document; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor |
||||
{ |
||||
/// <summary>
|
||||
/// Modifies the TextEditor's IHighlightingStrategy to be able to plug in
|
||||
/// an <see cref="IAdvancedHighlighter"/>.
|
||||
/// </summary>
|
||||
internal class AdvancedHighlightingStrategy : DefaultHighlightingStrategy |
||||
{ |
||||
readonly IAdvancedHighlighter highlighter; |
||||
|
||||
public AdvancedHighlightingStrategy(DefaultHighlightingStrategy baseStrategy, IAdvancedHighlighter highlighter) |
||||
{ |
||||
if (highlighter == null) |
||||
throw new ArgumentNullException("highlighter"); |
||||
ImportSettingsFrom(baseStrategy); |
||||
this.highlighter = highlighter; |
||||
} |
||||
|
||||
public override void MarkTokens(IDocument document) |
||||
{ |
||||
highlighter.BeginUpdate(document, null); |
||||
base.MarkTokens(document); |
||||
highlighter.EndUpdate(); |
||||
} |
||||
|
||||
public override void MarkTokens(IDocument document, List<LineSegment> inputLines) |
||||
{ |
||||
highlighter.BeginUpdate(document, inputLines); |
||||
base.MarkTokens(document, inputLines); |
||||
highlighter.EndUpdate(); |
||||
} |
||||
|
||||
protected override void OnParsedLine(IDocument document, LineSegment currentLine, List<TextWord> words) |
||||
{ |
||||
highlighter.MarkLine(currentLineNumber, currentLine, words); |
||||
} |
||||
} |
||||
} |
@ -1,148 +0,0 @@
@@ -1,148 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <author name="Daniel Grunwald"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Windows.Forms; |
||||
|
||||
using ICSharpCode.TextEditor; |
||||
using ICSharpCode.TextEditor.Document; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor |
||||
{ |
||||
/// <summary>
|
||||
/// A text area used for an interactive command prompt.
|
||||
/// </summary>
|
||||
public abstract class CommandPromptControl : SharpDevelopTextAreaControl |
||||
{ |
||||
TextMarker readOnlyMarker; |
||||
int promptStartOffset; |
||||
int promptEndOffset; |
||||
IList<string> history; |
||||
int historyPointer; |
||||
|
||||
public CommandPromptControl() |
||||
: base(false, false) |
||||
{ |
||||
this.TextEditorProperties.SupportReadOnlySegments = true; |
||||
this.TextEditorProperties.ShowLineNumbers = false; |
||||
this.history = new List<string>(); |
||||
base.contextMenuPath = null; |
||||
} |
||||
|
||||
protected void PrintPrompt() |
||||
{ |
||||
promptStartOffset = this.Document.TextLength; |
||||
PrintPromptInternal(); |
||||
promptEndOffset = this.Document.TextLength; |
||||
MakeReadOnly(); |
||||
} |
||||
|
||||
protected virtual void Clear() |
||||
{ |
||||
if (readOnlyMarker != null) |
||||
this.Document.MarkerStrategy.RemoveMarker(readOnlyMarker); |
||||
this.Document.Remove(0, this.Document.TextLength); |
||||
this.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.WholeTextArea)); |
||||
this.Document.CommitUpdate(); |
||||
readOnlyMarker = null; |
||||
promptStartOffset = 0; |
||||
promptEndOffset = 0; |
||||
} |
||||
|
||||
protected abstract void PrintPromptInternal(); |
||||
|
||||
/// <summary>
|
||||
/// Makes the current control content read-only (but still allows appending more content at the end).
|
||||
/// </summary>
|
||||
protected void MakeReadOnly() |
||||
{ |
||||
if (this.Document.TextLength == 0) |
||||
return; |
||||
this.ActiveTextAreaControl.Caret.Position = this.Document.OffsetToPosition(this.Document.TextLength); |
||||
if (readOnlyMarker == null) { |
||||
readOnlyMarker = new TextMarker(0, this.Document.TextLength, TextMarkerType.Invisible) { IsReadOnly = true }; |
||||
this.Document.MarkerStrategy.AddMarker(readOnlyMarker); |
||||
} |
||||
readOnlyMarker.Offset = 0; |
||||
readOnlyMarker.Length = this.Document.TextLength; |
||||
this.Document.UndoStack.ClearAll(); // prevent user from undoing the prompt insertion
|
||||
} |
||||
|
||||
protected override void InitializeTextAreaControl(TextAreaControl newControl) |
||||
{ |
||||
newControl.TextArea.DoProcessDialogKey += HandleDialogKey; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets the current command (text from end of prompt to end of document)
|
||||
/// </summary>
|
||||
protected string GetCommand() |
||||
{ |
||||
return this.Document.GetText(promptEndOffset, this.Document.TextLength - promptEndOffset); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Sets the current command
|
||||
/// </summary>
|
||||
protected void SetCommand(string cmd) |
||||
{ |
||||
this.Document.Replace(promptEndOffset, this.Document.TextLength - promptEndOffset, cmd); |
||||
this.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, this.Document.GetLineNumberForOffset(promptEndOffset))); |
||||
this.Document.CommitUpdate(); |
||||
this.ActiveTextAreaControl.Caret.Position = this.Document.OffsetToPosition(this.Document.TextLength); |
||||
} |
||||
|
||||
bool HandleDialogKey(Keys keys) |
||||
{ |
||||
switch (keys) { |
||||
case Keys.Enter: |
||||
history.Add(GetCommand()); |
||||
historyPointer = history.Count; |
||||
AcceptCommand(GetCommand()); |
||||
return true; |
||||
case Keys.Up: |
||||
historyPointer = Math.Max(historyPointer - 1, 0); |
||||
SetCommand(history[historyPointer]); |
||||
return true; |
||||
case Keys.Down: |
||||
historyPointer = Math.Min(historyPointer + 1, history.Count); |
||||
if (historyPointer == history.Count) |
||||
SetCommand(string.Empty); |
||||
else |
||||
SetCommand(history[historyPointer]); |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Causes evaluation of a command when the user presses Enter.
|
||||
/// </summary>
|
||||
/// <param name="command">The command to evaluate.</param>
|
||||
protected abstract void AcceptCommand(string command); |
||||
|
||||
/// <summary>
|
||||
/// Appends text at the end of the document.
|
||||
/// </summary>
|
||||
protected void Append(string text) |
||||
{ |
||||
this.Document.Insert(this.Document.TextLength, text); |
||||
} |
||||
|
||||
protected void InsertLineBeforePrompt(string text) |
||||
{ |
||||
text += Environment.NewLine; |
||||
this.Document.Insert(promptStartOffset, text); |
||||
promptStartOffset += text.Length; |
||||
promptEndOffset += text.Length; |
||||
if (readOnlyMarker != null) { |
||||
readOnlyMarker.Offset = 0; |
||||
readOnlyMarker.Length = promptEndOffset; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,71 +0,0 @@
@@ -1,71 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Windows.Forms; |
||||
using ICSharpCode.TextEditor; |
||||
using ICSharpCode.TextEditor.Gui.CompletionWindow; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor |
||||
{ |
||||
public class CachedCompletionDataProvider : AbstractCompletionDataProvider |
||||
{ |
||||
ICompletionDataProvider baseProvider; |
||||
|
||||
public CachedCompletionDataProvider(ICompletionDataProvider baseProvider) |
||||
{ |
||||
this.baseProvider = baseProvider; |
||||
} |
||||
|
||||
ICompletionData[] completionData; |
||||
|
||||
public ICompletionData[] CompletionData { |
||||
get { |
||||
return completionData; |
||||
} |
||||
set { |
||||
completionData = value; |
||||
} |
||||
} |
||||
|
||||
public override ImageList ImageList { |
||||
get { |
||||
return baseProvider.ImageList; |
||||
} |
||||
} |
||||
|
||||
public override CompletionDataProviderKeyResult ProcessKey(char key) |
||||
{ |
||||
return baseProvider.ProcessKey(key); |
||||
} |
||||
|
||||
public override bool InsertAction(ICompletionData data, TextArea textArea, int insertionOffset, char key) |
||||
{ |
||||
return baseProvider.InsertAction(data, textArea, insertionOffset, key); |
||||
} |
||||
|
||||
public override ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped) |
||||
{ |
||||
if (completionData == null) { |
||||
completionData = baseProvider.GenerateCompletionData(fileName, textArea, charTyped) ?? new ICompletionData[0]; |
||||
preSelection = baseProvider.PreSelection; |
||||
this.DefaultIndex = baseProvider.DefaultIndex; |
||||
} |
||||
return completionData; |
||||
} |
||||
|
||||
[Obsolete("Cannot use InsertSpace on CachedCompletionDataProvider, please set it on the underlying provider!")] |
||||
public new bool InsertSpace { |
||||
get { |
||||
return false; |
||||
} |
||||
set { |
||||
throw new NotSupportedException(); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,80 +0,0 @@
@@ -1,80 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Diagnostics; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.TextEditor; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor |
||||
{ |
||||
/// <summary>
|
||||
/// Data provider for code completion.
|
||||
/// </summary>
|
||||
public class CodeCompletionDataProvider : AbstractCodeCompletionDataProvider |
||||
{ |
||||
/// <summary>
|
||||
/// Initialize a CodeCompletionDataProvider that reads the expression from the text area.
|
||||
/// </summary>
|
||||
public CodeCompletionDataProvider() |
||||
{ |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Initalize a CodeCompletionDataProvider with a fixed expression.
|
||||
/// </summary>
|
||||
public CodeCompletionDataProvider(ExpressionResult expression) |
||||
{ |
||||
this.fixedExpression = expression; |
||||
} |
||||
|
||||
ExpressionResult fixedExpression; |
||||
|
||||
protected override void GenerateCompletionData(TextArea textArea, char charTyped) |
||||
{ |
||||
#if DEBUG
|
||||
if (DebugMode) { |
||||
Debugger.Break(); |
||||
} |
||||
#endif
|
||||
preSelection = null; |
||||
if (fixedExpression.Expression == null) |
||||
GenerateCompletionData(textArea, GetExpression(textArea)); |
||||
else |
||||
GenerateCompletionData(textArea, fixedExpression); |
||||
} |
||||
|
||||
#if DEBUG
|
||||
internal bool DebugMode = false; |
||||
#endif
|
||||
|
||||
protected void GenerateCompletionData(TextArea textArea, ExpressionResult expressionResult) |
||||
{ |
||||
// allow empty string as expression (for VB 'With' statements)
|
||||
if (expressionResult.Expression == null) { |
||||
return; |
||||
} |
||||
if (LoggingService.IsDebugEnabled) { |
||||
if (expressionResult.Context == ExpressionContext.Default) |
||||
LoggingService.DebugFormatted("GenerateCompletionData for >>{0}<<", expressionResult.Expression); |
||||
else |
||||
LoggingService.DebugFormatted("GenerateCompletionData for >>{0}<<, context={1}", expressionResult.Expression, expressionResult.Context); |
||||
} |
||||
string textContent = textArea.Document.TextContent; |
||||
ResolveResult rr = Resolve(expressionResult, caretLineNumber, caretColumn, fileName, textContent); |
||||
AddResolveResults(rr, expressionResult.Context); |
||||
} |
||||
|
||||
protected virtual ResolveResult Resolve(ExpressionResult expressionResult, |
||||
int caretLineNumber, int caretColumn, |
||||
string fileName, string fileContent) |
||||
{ |
||||
return ParserService.Resolve(expressionResult, caretLineNumber, caretColumn, fileName, fileContent); |
||||
} |
||||
} |
||||
} |
@ -1,195 +0,0 @@
@@ -1,195 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Drawing; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.TextEditor; |
||||
using ICSharpCode.TextEditor.Document; |
||||
using ICSharpCode.SharpDevelop.Debugging; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor |
||||
{ |
||||
/// <summary>
|
||||
/// reperesents a visual error, this class is needed by the errordrawer.
|
||||
/// </summary>
|
||||
public class VisualError : TextMarker |
||||
{ |
||||
Task task; |
||||
|
||||
public Task Task { |
||||
get { |
||||
return task; |
||||
} |
||||
} |
||||
|
||||
public VisualError(int offset, int length, Task task) |
||||
: base(offset, length, TextMarkerType.WaveLine, (task.TaskType == TaskType.Error) ? Color.Red : Color.Orange) |
||||
{ |
||||
this.task = task; |
||||
base.ToolTip = task.Description; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// This class draws error underlines.
|
||||
/// </summary>
|
||||
public class ErrorDrawer : IDisposable |
||||
{ |
||||
TextEditorControl textEditor; |
||||
|
||||
public ErrorDrawer(TextEditorControl textEditor) |
||||
{ |
||||
this.textEditor = textEditor; |
||||
|
||||
TaskService.Added += new TaskEventHandler(OnAdded); |
||||
TaskService.Removed += new TaskEventHandler(OnRemoved); |
||||
TaskService.Cleared += new EventHandler(OnCleared); |
||||
TaskService.InUpdateChanged += OnInUpdateChanged; |
||||
DebuggerService.DebugStarted += OnDebugStarted; |
||||
DebuggerService.DebugStopped += OnDebugStopped; |
||||
} |
||||
|
||||
bool isDisposed; |
||||
bool requireTextEditorRefresh; |
||||
|
||||
void RefreshTextEditor() |
||||
{ |
||||
if (TaskService.InUpdate) { |
||||
requireTextEditorRefresh = true; |
||||
} else { |
||||
textEditor.Refresh(); |
||||
} |
||||
} |
||||
|
||||
void OnInUpdateChanged(object sender, EventArgs e) |
||||
{ |
||||
if (requireTextEditorRefresh) { |
||||
requireTextEditorRefresh = false; |
||||
textEditor.Refresh(); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Deregisters the event handlers so the error drawer (and associated TextEditorControl)
|
||||
/// can be garbage collected.
|
||||
/// </summary>
|
||||
public void Dispose() |
||||
{ |
||||
if (isDisposed) |
||||
return; |
||||
isDisposed = true; |
||||
TaskService.Added -= new TaskEventHandler(OnAdded); |
||||
TaskService.Removed -= new TaskEventHandler(OnRemoved); |
||||
TaskService.Cleared -= new EventHandler(OnCleared); |
||||
TaskService.InUpdateChanged -= OnInUpdateChanged; |
||||
DebuggerService.DebugStarted -= OnDebugStarted; |
||||
DebuggerService.DebugStopped -= OnDebugStopped; |
||||
ClearErrors(); |
||||
} |
||||
|
||||
void OnDebugStarted(object sender, EventArgs e) |
||||
{ |
||||
ClearErrors(); |
||||
} |
||||
|
||||
void OnDebugStopped(object sender, EventArgs e) |
||||
{ |
||||
foreach (Task task in TaskService.Tasks) { |
||||
AddTask(task, false); |
||||
} |
||||
textEditor.Refresh(); |
||||
} |
||||
|
||||
void OnAdded(object sender, TaskEventArgs e) |
||||
{ |
||||
AddTask(e.Task, true); |
||||
} |
||||
|
||||
void OnRemoved(object sender, TaskEventArgs e) |
||||
{ |
||||
Task t = e.Task; |
||||
foreach (TextMarker marker in textEditor.Document.MarkerStrategy.TextMarker) { |
||||
VisualError ve = marker as VisualError; |
||||
if (ve != null && ve.Task == t) { |
||||
textEditor.Document.MarkerStrategy.RemoveMarker(marker); |
||||
RefreshTextEditor(); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
void OnCleared(object sender, EventArgs e) |
||||
{ |
||||
if (ClearErrors()) { |
||||
RefreshTextEditor(); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Clears all TextMarkers representing errors.
|
||||
/// </summary>
|
||||
/// <returns>Returns true when there were markers deleted, false when there were no error markers.</returns>
|
||||
bool ClearErrors() |
||||
{ |
||||
bool removed = false; |
||||
textEditor.Document.MarkerStrategy.RemoveAll(delegate (TextMarker marker) { |
||||
if (marker is VisualError) { |
||||
removed = true; |
||||
return true; |
||||
} |
||||
return false;}); |
||||
return removed; |
||||
} |
||||
|
||||
bool CheckTask(Task task) |
||||
{ |
||||
if (textEditor.FileName == null) |
||||
return false; |
||||
if (task.FileName == null || task.Column < 0) |
||||
return false; |
||||
if (task.TaskType != TaskType.Warning && task.TaskType != TaskType.Error) |
||||
return false; |
||||
return FileUtility.IsEqualFileName(task.FileName, textEditor.FileName); |
||||
} |
||||
|
||||
void AddTask(Task task, bool refresh) |
||||
{ |
||||
if (!CheckTask(task)) return; |
||||
if (task.Line >= 0 && task.Line < textEditor.Document.TotalNumberOfLines) { |
||||
LineSegment line = textEditor.Document.GetLineSegment(task.Line); |
||||
int offset = line.Offset + task.Column - 1; |
||||
int length = 1; |
||||
if (line.Words != null) { |
||||
foreach (TextWord tw in line.Words) { |
||||
if (task.Column - 1 == tw.Offset) { |
||||
length = tw.Length; |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
if (length == 1 && task.Column - 1 < line.Length) { |
||||
length = 2; // use minimum length
|
||||
} |
||||
textEditor.Document.MarkerStrategy.AddMarker(new VisualError(offset, length, task)); |
||||
if (refresh) RefreshTextEditor(); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Clears all errors and adds them again.
|
||||
/// </summary>
|
||||
public void UpdateErrors() |
||||
{ |
||||
ClearErrors(); |
||||
foreach (Task task in TaskService.Tasks) { |
||||
AddTask(task, false); |
||||
} |
||||
textEditor.Refresh(); |
||||
} |
||||
} |
||||
} |
@ -1,41 +0,0 @@
@@ -1,41 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.TextEditor.Document; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor |
||||
{ |
||||
public class IndexerInsightDataProvider : MethodInsightDataProvider |
||||
{ |
||||
/// <summary>
|
||||
/// Creates a IndexerInsightDataProvider looking at the caret position.
|
||||
/// </summary>
|
||||
public IndexerInsightDataProvider() {} |
||||
|
||||
/// <summary>
|
||||
/// Creates a IndexerInsightDataProvider looking at the specified position.
|
||||
/// </summary>
|
||||
public IndexerInsightDataProvider(int lookupOffset, bool setupOnlyOnce) : base(lookupOffset, setupOnlyOnce) {} |
||||
|
||||
protected override void SetupDataProvider(string fileName, IDocument document, ExpressionResult expressionResult, int caretLineNumber, int caretColumn) |
||||
{ |
||||
ResolveResult result = ParserService.Resolve(expressionResult, caretLineNumber, caretColumn, fileName, document.TextContent); |
||||
if (result == null) |
||||
return; |
||||
IReturnType type = result.ResolvedType; |
||||
if (type == null) |
||||
return; |
||||
foreach (IProperty i in type.GetProperties()) { |
||||
if (i.IsIndexer) { |
||||
methods.Add(i); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,253 +0,0 @@
@@ -1,253 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.TextEditor; |
||||
using ICSharpCode.TextEditor.Document; |
||||
using ICSharpCode.TextEditor.Gui.InsightWindow; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor |
||||
{ |
||||
public class MethodInsightDataProvider : IInsightDataProvider |
||||
{ |
||||
string fileName = null; |
||||
IDocument document = null; |
||||
TextArea textArea = null; |
||||
protected List<IMethodOrProperty> methods = new List<IMethodOrProperty>(); |
||||
|
||||
public List<IMethodOrProperty> Methods { |
||||
get { |
||||
return methods; |
||||
} |
||||
} |
||||
|
||||
public int InsightDataCount { |
||||
get { |
||||
return methods.Count; |
||||
} |
||||
} |
||||
|
||||
int defaultIndex = -1; |
||||
|
||||
public int DefaultIndex { |
||||
get { |
||||
return defaultIndex; |
||||
} |
||||
set { |
||||
defaultIndex = value; |
||||
} |
||||
} |
||||
|
||||
public string GetInsightData(int number) |
||||
{ |
||||
IMember method = methods[number]; |
||||
IAmbience conv = AmbienceService.GetCurrentAmbience(); |
||||
conv.ConversionFlags = ConversionFlags.StandardConversionFlags| ConversionFlags.UseFullyQualifiedMemberNames; |
||||
string documentation = method.Documentation; |
||||
string text = conv.Convert(method); |
||||
return text + "\n" + CodeCompletionData.ConvertDocumentation(documentation); |
||||
} |
||||
|
||||
int lookupOffset; |
||||
bool setupOnlyOnce; |
||||
|
||||
/// <summary>
|
||||
/// Creates a MethodInsightDataProvider looking at the caret position.
|
||||
/// </summary>
|
||||
public MethodInsightDataProvider() |
||||
{ |
||||
this.lookupOffset = -1; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Creates a MethodInsightDataProvider looking at the specified position.
|
||||
/// </summary>
|
||||
public MethodInsightDataProvider(int lookupOffset, bool setupOnlyOnce) |
||||
{ |
||||
this.lookupOffset = lookupOffset; |
||||
this.setupOnlyOnce = setupOnlyOnce; |
||||
} |
||||
|
||||
int initialOffset; |
||||
|
||||
public void SetupDataProvider(string fileName, TextArea textArea) |
||||
{ |
||||
if (setupOnlyOnce && this.textArea != null) return; |
||||
IDocument document = textArea.Document; |
||||
this.fileName = fileName; |
||||
this.document = document; |
||||
this.textArea = textArea; |
||||
int useOffset = (lookupOffset < 0) ? textArea.Caret.Offset : lookupOffset; |
||||
initialOffset = useOffset; |
||||
|
||||
|
||||
IExpressionFinder expressionFinder = ParserService.GetExpressionFinder(fileName); |
||||
ExpressionResult expressionResult; |
||||
if (expressionFinder == null) |
||||
expressionResult = new ExpressionResult(TextUtilities.GetExpressionBeforeOffset(textArea, useOffset)); |
||||
else |
||||
expressionResult = expressionFinder.FindExpression(textArea.Document.TextContent, useOffset); |
||||
|
||||
if (expressionResult.Expression == null) // expression is null when cursor is in string/comment
|
||||
return; |
||||
expressionResult.Expression = expressionResult.Expression.Trim(); |
||||
|
||||
if (LoggingService.IsDebugEnabled) { |
||||
if (expressionResult.Context == ExpressionContext.Default) |
||||
LoggingService.DebugFormatted("ShowInsight for >>{0}<<", expressionResult.Expression); |
||||
else |
||||
LoggingService.DebugFormatted("ShowInsight for >>{0}<<, context={1}", expressionResult.Expression, expressionResult.Context); |
||||
} |
||||
|
||||
int caretLineNumber = document.GetLineNumberForOffset(useOffset); |
||||
int caretColumn = useOffset - document.GetLineSegment(caretLineNumber).Offset; |
||||
// the parser works with 1 based coordinates
|
||||
SetupDataProvider(fileName, document, expressionResult, caretLineNumber + 1, caretColumn + 1); |
||||
} |
||||
|
||||
protected virtual void SetupDataProvider(string fileName, IDocument document, ExpressionResult expressionResult, int caretLineNumber, int caretColumn) |
||||
{ |
||||
bool constructorInsight = false; |
||||
if (expressionResult.Context == ExpressionContext.Attribute) { |
||||
constructorInsight = true; |
||||
} else if (expressionResult.Context.IsObjectCreation) { |
||||
constructorInsight = true; |
||||
expressionResult.Context = ExpressionContext.Type; |
||||
} else if (expressionResult.Context == ExpressionContext.BaseConstructorCall) { |
||||
constructorInsight = true; |
||||
} |
||||
|
||||
ResolveResult results = ParserService.Resolve(expressionResult, caretLineNumber, caretColumn, fileName, document.TextContent); |
||||
if (results == null) |
||||
return; |
||||
LanguageProperties language = ParserService.CurrentProjectContent.Language; |
||||
TypeResolveResult trr = results as TypeResolveResult; |
||||
if (trr == null && language.AllowObjectConstructionOutsideContext) { |
||||
if (results is MixedResolveResult) |
||||
trr = (results as MixedResolveResult).TypeResult; |
||||
} |
||||
if (trr != null && !constructorInsight) { |
||||
if (language.AllowObjectConstructionOutsideContext) |
||||
constructorInsight = true; |
||||
} |
||||
if (constructorInsight) { |
||||
if (trr != null || expressionResult.Context == ExpressionContext.BaseConstructorCall) { |
||||
if (results.ResolvedType != null) { |
||||
methods.AddRange(GetConstructorMethods(results.ResolvedType.GetMethods())); |
||||
} |
||||
} |
||||
} else { |
||||
MethodGroupResolveResult result = results as MethodGroupResolveResult; |
||||
if (result == null) |
||||
return; |
||||
bool classIsInInheritanceTree = false; |
||||
if (result.CallingClass != null) |
||||
classIsInInheritanceTree = result.CallingClass.IsTypeInInheritanceTree(result.ContainingType.GetUnderlyingClass()); |
||||
|
||||
foreach (IMethod method in result.ContainingType.GetMethods()) { |
||||
if (language.NameComparer.Equals(method.Name, result.Name)) { |
||||
if (method.IsAccessible(result.CallingClass, classIsInInheritanceTree)) { |
||||
methods.Add(method); |
||||
} |
||||
} |
||||
} |
||||
if (methods.Count == 0 && result.CallingClass != null && language.SupportsExtensionMethods) { |
||||
List<IMethodOrProperty> list = new List<IMethodOrProperty>(); |
||||
ResolveResult.AddExtensions(language, list.Add, result.CallingClass, result.ContainingType); |
||||
foreach (IMethodOrProperty mp in list) { |
||||
if (language.NameComparer.Equals(mp.Name, result.Name) && mp is IMethod) { |
||||
DefaultMethod m = (DefaultMethod)mp.CreateSpecializedMember(); |
||||
// for the insight window, remove first parameter and mark the
|
||||
// method as normal - this is required to show the list of
|
||||
// parameters the method expects.
|
||||
m.IsExtensionMethod = false; |
||||
m.Parameters.RemoveAt(0); |
||||
methods.Add(m); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
IEnumerable<IMethodOrProperty> GetConstructorMethods(List<IMethod> methods) |
||||
{ |
||||
return from method in methods |
||||
where method.IsConstructor && !method.IsStatic |
||||
select (IMethodOrProperty)method; |
||||
} |
||||
|
||||
public bool CaretOffsetChanged() |
||||
{ |
||||
bool closeDataProvider = textArea.Caret.Offset <= initialOffset; |
||||
int brackets = 0; |
||||
int curlyBrackets = 0; |
||||
if (!closeDataProvider) { |
||||
bool insideChar = false; |
||||
bool insideString = false; |
||||
for (int offset = initialOffset; offset < Math.Min(textArea.Caret.Offset, document.TextLength); ++offset) { |
||||
char ch = document.GetCharAt(offset); |
||||
switch (ch) { |
||||
case '\'': |
||||
insideChar = !insideChar; |
||||
break; |
||||
case '(': |
||||
if (!(insideChar || insideString)) { |
||||
++brackets; |
||||
} |
||||
break; |
||||
case ')': |
||||
if (!(insideChar || insideString)) { |
||||
--brackets; |
||||
} |
||||
if (brackets <= 0) { |
||||
return true; |
||||
} |
||||
break; |
||||
case '"': |
||||
insideString = !insideString; |
||||
break; |
||||
case '}': |
||||
if (!(insideChar || insideString)) { |
||||
--curlyBrackets; |
||||
} |
||||
if (curlyBrackets < 0) { |
||||
return true; |
||||
} |
||||
break; |
||||
case '{': |
||||
if (!(insideChar || insideString)) { |
||||
++curlyBrackets; |
||||
} |
||||
break; |
||||
case ';': |
||||
if (!(insideChar || insideString)) { |
||||
return true; |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
return closeDataProvider; |
||||
} |
||||
|
||||
public bool CharTyped() |
||||
{ |
||||
// int offset = document.Caret.Offset - 1;
|
||||
// if (offset >= 0) {
|
||||
// return document.GetCharAt(offset) == ')';
|
||||
// }
|
||||
return false; |
||||
} |
||||
} |
||||
} |
@ -1,114 +0,0 @@
@@ -1,114 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.TextEditor.Document; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor |
||||
{ |
||||
public class ParserFoldingStrategy : IFoldingStrategy |
||||
{ |
||||
/* |
||||
void AddClassMembers(IClass c, List<FoldMarker> foldMarkers, IDocument document) |
||||
{ |
||||
if (c.ClassType == ClassType.Delegate) { |
||||
return; |
||||
} |
||||
DomRegion cRegion = c.BodyRegion; |
||||
if (cRegion.IsEmpty) cRegion = c.Region; |
||||
if (cRegion.BeginLine < cRegion.EndLine) { |
||||
FoldMarker newFoldMarker = new FoldMarker(document, cRegion.BeginLine - 1, cRegion.BeginColumn - 1, |
||||
cRegion.EndLine - 1, cRegion.EndColumn, c.ClassType == ClassType.Enum ? FoldType.MemberBody : FoldType.TypeBody); |
||||
if (newFoldMarker.Length > 0) { |
||||
foldMarkers.Add(newFoldMarker); |
||||
} |
||||
} |
||||
foreach (IClass innerClass in c.InnerClasses) { |
||||
AddClassMembers(innerClass, foldMarkers, document); |
||||
} |
||||
|
||||
foreach (IMethod m in c.Methods) { |
||||
if (m.Region.EndLine < m.BodyRegion.EndLine) { |
||||
foldMarkers.Add(new FoldMarker(document, m.Region.EndLine - 1, m.Region.EndColumn - 1, |
||||
m.BodyRegion.EndLine - 1, m.BodyRegion.EndColumn - 1, FoldType.MemberBody)); |
||||
} |
||||
} |
||||
|
||||
foreach (IProperty p in c.Properties) { |
||||
if (p.Region.EndLine < p.BodyRegion.EndLine) { |
||||
foldMarkers.Add(new FoldMarker(document, p.Region.EndLine - 1, p.Region.EndColumn - 1, |
||||
p.BodyRegion.EndLine- 1, p.BodyRegion.EndColumn - 1, FoldType.MemberBody)); |
||||
} |
||||
} |
||||
|
||||
foreach (IEvent evt in c.Events) { |
||||
if (evt.Region.EndLine < evt.BodyRegion.EndLine) { |
||||
if (!evt.BodyRegion.IsEmpty) { |
||||
foldMarkers.Add(new FoldMarker(document, evt.Region.EndLine - 1, evt.Region.EndColumn - 1, |
||||
evt.BodyRegion.EndLine- 1, evt.BodyRegion.EndColumn - 1, FoldType.MemberBody)); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
/// <remarks>
|
||||
/// Calculates the fold level of a specific line.
|
||||
/// </remarks>
|
||||
public List<FoldMarker> GenerateFoldMarkers(IDocument document, string fileName, object parseInfo) |
||||
{ |
||||
ParseInformation parseInformation = parseInfo as ParseInformation; |
||||
if (parseInformation == null || parseInformation.MostRecentCompilationUnit == null) { |
||||
return null; |
||||
} |
||||
List<FoldMarker> foldMarkers = GetFoldMarkers(document, parseInformation.MostRecentCompilationUnit); |
||||
if (parseInformation.BestCompilationUnit != parseInformation.MostRecentCompilationUnit) { |
||||
List<FoldMarker> oldFoldMarkers = GetFoldMarkers(document, parseInformation.BestCompilationUnit); |
||||
int lastLine = (foldMarkers.Count == 0) ? 0 : foldMarkers[foldMarkers.Count - 1].EndLine; |
||||
int totalNumberOfLines = document.TotalNumberOfLines; |
||||
foreach (FoldMarker marker in oldFoldMarkers) { |
||||
if (marker.StartLine > lastLine && marker.EndLine < totalNumberOfLines) |
||||
foldMarkers.Add(marker); |
||||
} |
||||
} |
||||
return foldMarkers; |
||||
} |
||||
|
||||
List<FoldMarker> GetFoldMarkers(IDocument document, ICompilationUnit cu) |
||||
{ |
||||
List<FoldMarker> foldMarkers = new List<FoldMarker>(); |
||||
|
||||
bool firstTime = document.FoldingManager.FoldMarker.Count == 0; |
||||
foreach (FoldingRegion foldingRegion in cu.FoldingRegions) { |
||||
foldMarkers.Add(new FoldMarker(document, foldingRegion.Region.BeginLine - 1, foldingRegion.Region.BeginColumn - 1, |
||||
foldingRegion.Region.EndLine - 1, foldingRegion.Region.EndColumn - 1, FoldType.Region, foldingRegion.Name, firstTime)); |
||||
|
||||
} |
||||
foreach (IClass c in cu.Classes) { |
||||
AddClassMembers(c, foldMarkers, document); |
||||
} |
||||
|
||||
if (cu.DokuComments != null) { |
||||
foreach (IComment c in cu.DokuComments) { |
||||
foldMarkers.Add(new FoldMarker(document, c.Region.BeginLine - 1, c.Region.BeginColumn - 1, |
||||
c.Region.EndLine - 1, c.Region.EndColumn - 1)); |
||||
} |
||||
} |
||||
return foldMarkers; |
||||
} |
||||
*/ |
||||
|
||||
/// <remarks>
|
||||
/// Calculates the fold level of a specific line.
|
||||
/// </remarks>
|
||||
public List<FoldMarker> GenerateFoldMarkers(IDocument document, string fileName, object parseInfo) |
||||
{ |
||||
return null; |
||||
} |
||||
} |
||||
} |
@ -1,420 +0,0 @@
@@ -1,420 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using ICSharpCode.SharpDevelop.Editor.CodeCompletion; |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Windows.Forms; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.Core.WinForms; |
||||
using ICSharpCode.SharpDevelop.DefaultEditor.Actions; |
||||
using ICSharpCode.SharpDevelop.Editor; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Internal.Templates; |
||||
using ICSharpCode.TextEditor; |
||||
using ICSharpCode.TextEditor.Actions; |
||||
using ICSharpCode.TextEditor.Document; |
||||
using ICSharpCode.TextEditor.Gui.CompletionWindow; |
||||
using ICSharpCode.TextEditor.Gui.InsightWindow; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor |
||||
{ |
||||
public class SharpDevelopTextAreaControl : TextEditorControl |
||||
{ |
||||
protected string contextMenuPath = "/SharpDevelop/ViewContent/DefaultTextEditor/ContextMenu"; |
||||
const string editActionsPath = "/AddIns/DefaultTextEditor/EditActions"; |
||||
const string formatingStrategyPath = "/AddIns/DefaultTextEditor/Formatter"; |
||||
const string advancedHighlighterPath = "/AddIns/DefaultTextEditor/AdvancedHighlighter"; |
||||
|
||||
readonly TextEditorAdapter adapter; |
||||
|
||||
public TextEditorAdapter Adapter { |
||||
get { return adapter; } |
||||
} |
||||
|
||||
ErrorDrawer errorDrawer; |
||||
IAdvancedHighlighter advancedHighlighter; |
||||
|
||||
public SharpDevelopTextAreaControl() |
||||
: this(true, true) |
||||
{ |
||||
GenerateEditActions(); |
||||
|
||||
TextEditorProperties = SharpDevelopTextEditorProperties.Instance; |
||||
} |
||||
|
||||
protected SharpDevelopTextAreaControl(bool enableFolding, bool sdBookmarks) |
||||
{ |
||||
adapter = new TextEditorAdapter(this); |
||||
|
||||
Document.FoldingManager.FoldingStrategy = new ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor.ParserFoldingStrategy(); |
||||
// Document.BookmarkManager.Factory = new Bookmarks.SDBookmarkFactory(Document.BookmarkManager);
|
||||
// Document.BookmarkManager.Added += new BookmarkEventHandler(BookmarkAdded);
|
||||
// Document.BookmarkManager.Removed += new BookmarkEventHandler(BookmarkRemoved);
|
||||
// Document.LineCountChanged += BookmarkLineCountChanged;
|
||||
} |
||||
|
||||
/* |
||||
void BookmarkAdded(object sender, BookmarkEventArgs e) |
||||
{ |
||||
Bookmarks.SDBookmark b = e.Bookmark as Bookmarks.SDBookmark; |
||||
if (b != null) { |
||||
Bookmarks.BookmarkManager.AddMark(b); |
||||
} |
||||
} |
||||
|
||||
void BookmarkRemoved(object sender, BookmarkEventArgs e) |
||||
{ |
||||
Bookmarks.SDBookmark b = e.Bookmark as Bookmarks.SDBookmark; |
||||
if (b != null) { |
||||
Bookmarks.BookmarkManager.RemoveMark(b); |
||||
} |
||||
} |
||||
|
||||
void BookmarkLineCountChanged(object sender, LineCountChangeEventArgs e) |
||||
{ |
||||
foreach (Bookmark b in Document.BookmarkManager.Marks) { |
||||
if (b.LineNumber >= e.LineStart) { |
||||
Bookmarks.SDBookmark sdb = b as Bookmarks.SDBookmark; |
||||
if (sdb != null) { |
||||
sdb.RaiseLineNumberChanged(); |
||||
} |
||||
} |
||||
} |
||||
}*/ |
||||
|
||||
protected override void InitializeTextAreaControl(TextAreaControl newControl) |
||||
{ |
||||
base.InitializeTextAreaControl(newControl); |
||||
|
||||
newControl.ShowContextMenu += delegate(object sender, MouseEventArgs e) { |
||||
if (contextMenuPath != null) { |
||||
MenuService.ShowContextMenu(this, contextMenuPath, (Control)sender, e.X, e.Y); |
||||
} |
||||
}; |
||||
newControl.TextArea.KeyEventHandler += new ICSharpCode.TextEditor.KeyEventHandler(HandleKeyPress); |
||||
newControl.TextArea.ClipboardHandler.CopyText += new CopyTextEventHandler(ClipboardHandlerCopyText); |
||||
|
||||
// newControl.TextArea.IconBarMargin.Painted += new MarginPaintEventHandler(PaintIconBarBreakPoints);
|
||||
// newControl.TextArea.IconBarMargin.MouseDown += new MarginMouseEventHandler(IconBarMouseDown);
|
||||
|
||||
newControl.MouseWheel += new MouseEventHandler(TextAreaMouseWheel); |
||||
newControl.DoHandleMousewheel = false; |
||||
} |
||||
|
||||
protected override void Dispose(bool disposing) |
||||
{ |
||||
base.Dispose(disposing); |
||||
if (disposing) { |
||||
if (errorDrawer != null) { |
||||
errorDrawer.Dispose(); |
||||
errorDrawer = null; |
||||
} |
||||
if (advancedHighlighter != null) { |
||||
advancedHighlighter.Dispose(); |
||||
advancedHighlighter = null; |
||||
} |
||||
CloseCodeCompletionWindow(this, EventArgs.Empty); |
||||
CloseInsightWindow(this, EventArgs.Empty); |
||||
} |
||||
} |
||||
|
||||
void CloseCodeCompletionWindow(object sender, EventArgs e) |
||||
{ |
||||
if (codeCompletionWindow != null) { |
||||
codeCompletionWindow.Closed -= new EventHandler(CloseCodeCompletionWindow); |
||||
codeCompletionWindow.Dispose(); |
||||
codeCompletionWindow = null; |
||||
} |
||||
} |
||||
|
||||
void CloseInsightWindow(object sender, EventArgs e) |
||||
{ |
||||
if (insightWindow != null) { |
||||
insightWindow.Closed -= new EventHandler(CloseInsightWindow); |
||||
insightWindow.Dispose(); |
||||
insightWindow = null; |
||||
} |
||||
} |
||||
|
||||
void TextAreaMouseWheel(object sender, MouseEventArgs e) |
||||
{ |
||||
TextAreaControl textAreaControl = (TextAreaControl)sender; |
||||
if (insightWindow != null && !insightWindow.IsDisposed && insightWindow.Visible) { |
||||
insightWindow.HandleMouseWheel(e); |
||||
} else if (codeCompletionWindow != null && !codeCompletionWindow.IsDisposed && codeCompletionWindow.Visible) { |
||||
codeCompletionWindow.HandleMouseWheel(e); |
||||
} else { |
||||
textAreaControl.HandleMouseWheel(e); |
||||
} |
||||
} |
||||
|
||||
void ClipboardHandlerCopyText(object sender, CopyTextEventArgs e) |
||||
{ |
||||
TextEditorSideBar.Instance.PutInClipboardRing(e.Text); |
||||
} |
||||
|
||||
public override void OptionsChanged() |
||||
{ |
||||
base.OptionsChanged(); |
||||
SharpDevelopTextEditorProperties sdtep = base.TextEditorProperties as SharpDevelopTextEditorProperties; |
||||
|
||||
if (sdtep != null) { |
||||
if (sdtep.UnderlineErrors) { |
||||
if (errorDrawer == null) { |
||||
errorDrawer = new ErrorDrawer(this); |
||||
} |
||||
} else { |
||||
if (errorDrawer != null) { |
||||
errorDrawer.Dispose(); |
||||
errorDrawer = null; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
internal void FileLoaded() |
||||
{ |
||||
if (errorDrawer != null) { |
||||
errorDrawer.UpdateErrors(); |
||||
} |
||||
} |
||||
|
||||
#if DEBUG
|
||||
internal const Keys DebugBreakModifiers = Keys.Control | Keys.Shift | Keys.Alt; |
||||
#endif
|
||||
|
||||
void GenerateEditActions() |
||||
{ |
||||
try { |
||||
IEditAction[] actions = (IEditAction[])(AddInTree.GetTreeNode(editActionsPath).BuildChildItems(this)).ToArray(typeof(IEditAction)); |
||||
|
||||
foreach (IEditAction action in actions) { |
||||
foreach (Keys key in action.Keys) { |
||||
editactions[key] = action; |
||||
} |
||||
} |
||||
} catch (TreePathNotFoundException) { |
||||
LoggingService.Warn("EditAction " + editActionsPath + " doesn't exists in the AddInTree"); |
||||
} |
||||
} |
||||
|
||||
public void ActivateQuickClassBrowserOnDemand() |
||||
{ |
||||
|
||||
} |
||||
|
||||
protected override void OnFileNameChanged(EventArgs e) |
||||
{ |
||||
base.OnFileNameChanged(e); |
||||
ActivateQuickClassBrowserOnDemand(); |
||||
} |
||||
|
||||
static ICodeCompletionBinding[] codeCompletionBindings; |
||||
|
||||
public static ICodeCompletionBinding[] CodeCompletionBindings { |
||||
get { |
||||
if (codeCompletionBindings == null) { |
||||
try { |
||||
codeCompletionBindings = (ICodeCompletionBinding[])(AddInTree.GetTreeNode("/AddIns/DefaultTextEditor/CodeCompletion").BuildChildItems(null)).ToArray(typeof(ICodeCompletionBinding)); |
||||
} catch (TreePathNotFoundException) { |
||||
codeCompletionBindings = new ICodeCompletionBinding[] {}; |
||||
} |
||||
} |
||||
return codeCompletionBindings; |
||||
} |
||||
} |
||||
|
||||
InsightWindow insightWindow = null; |
||||
CodeCompletionWindow codeCompletionWindow = null; |
||||
bool inHandleKeyPress; |
||||
|
||||
bool HandleKeyPress(char ch) |
||||
{ |
||||
if (inHandleKeyPress) |
||||
return false; |
||||
inHandleKeyPress = true; |
||||
try { |
||||
if (codeCompletionWindow != null && !codeCompletionWindow.IsDisposed) { |
||||
if (codeCompletionWindow.ProcessKeyEvent(ch)) { |
||||
return true; |
||||
} |
||||
if (codeCompletionWindow != null && !codeCompletionWindow.IsDisposed) { |
||||
// code-completion window is still opened but did not want to handle
|
||||
// the keypress -> don't try to restart code-completion
|
||||
return false; |
||||
} |
||||
} |
||||
|
||||
if (CodeCompletionOptions.EnableCodeCompletion) { |
||||
foreach (ICodeCompletionBinding ccBinding in CodeCompletionBindings) { |
||||
CodeCompletionKeyPressResult result = ccBinding.HandleKeyPress(adapter, ch); |
||||
if (result == CodeCompletionKeyPressResult.Completed) |
||||
return false; |
||||
else if (result == CodeCompletionKeyPressResult.CompletedIncludeKeyInCompletion) |
||||
return false; |
||||
else if (result == CodeCompletionKeyPressResult.EatKey) |
||||
return true; |
||||
} |
||||
if (ch == '\n') |
||||
StartDelayedReparse(); |
||||
} |
||||
} catch (Exception ex) { |
||||
LogException(ex); |
||||
} finally { |
||||
inHandleKeyPress = false; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
bool startedDelayedReparse; |
||||
|
||||
void StartDelayedReparse() |
||||
{ |
||||
if (startedDelayedReparse) |
||||
return; |
||||
startedDelayedReparse = true; |
||||
WorkbenchSingleton.SafeThreadAsyncCall( |
||||
delegate { |
||||
startedDelayedReparse = false; |
||||
if (!this.IsDisposed) { |
||||
ParserService.BeginParse(this.FileName, this.adapter.Document); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
public void StartCtrlSpaceCompletion() |
||||
{ |
||||
foreach (ICodeCompletionBinding ccBinding in CodeCompletionBindings) { |
||||
if (ccBinding.CtrlSpace(adapter)) |
||||
return; |
||||
} |
||||
} |
||||
|
||||
internal bool ExpandTemplateOnTab() |
||||
{ |
||||
string word = GetWordBeforeCaret(); |
||||
if (word != null) { |
||||
/*CodeTemplateGroup templateGroup = CodeTemplateLoader.GetTemplateGroupPerFilename(FileName); |
||||
if (templateGroup != null) { |
||||
foreach (CodeTemplate template in templateGroup.Templates) { |
||||
if (template.Shortcut == word) { |
||||
if (word.Length > 0) { |
||||
int newCaretOffset = DeleteWordBeforeCaret(); |
||||
//// set new position in text area
|
||||
ActiveTextAreaControl.TextArea.Caret.Position = Document.OffsetToPosition(newCaretOffset); |
||||
} |
||||
|
||||
InsertTemplate(template); |
||||
return true; |
||||
} |
||||
} |
||||
}*/ |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
public void ShowInsightWindow(IInsightDataProvider insightDataProvider) |
||||
{ |
||||
if (insightWindow == null || insightWindow.IsDisposed) { |
||||
insightWindow = new InsightWindow(WorkbenchSingleton.MainWin32Window, this); |
||||
insightWindow.Closed += new EventHandler(CloseInsightWindow); |
||||
} |
||||
insightWindow.AddInsightDataProvider(insightDataProvider, this.FileName); |
||||
insightWindow.ShowInsightWindow(); |
||||
} |
||||
|
||||
public bool InsightWindowVisible { |
||||
get { |
||||
return insightWindow != null; |
||||
} |
||||
} |
||||
|
||||
public void ShowCompletionWindow(ICompletionDataProvider completionDataProvider, char ch) |
||||
{ |
||||
codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow(WorkbenchSingleton.MainWin32Window, this, this.FileName, completionDataProvider, ch); |
||||
if (codeCompletionWindow != null) { |
||||
codeCompletionWindow.Closed += new EventHandler(CloseCodeCompletionWindow); |
||||
} |
||||
} |
||||
|
||||
private void LogException(Exception ex) |
||||
{ |
||||
ICSharpCode.Core.MessageService.ShowException(ex); |
||||
} |
||||
|
||||
public string GetWordBeforeCaret() |
||||
{ |
||||
int start = TextUtilities.FindPrevWordStart(Document, ActiveTextAreaControl.TextArea.Caret.Offset); |
||||
return Document.GetText(start, ActiveTextAreaControl.TextArea.Caret.Offset - start); |
||||
} |
||||
|
||||
public int DeleteWordBeforeCaret() |
||||
{ |
||||
int start = TextUtilities.FindPrevWordStart(Document, ActiveTextAreaControl.TextArea.Caret.Offset); |
||||
Document.Remove(start, ActiveTextAreaControl.TextArea.Caret.Offset - start); |
||||
return start; |
||||
} |
||||
|
||||
protected override void OnReloadHighlighting(object sender, EventArgs e) |
||||
{ |
||||
base.OnReloadHighlighting(sender, e); |
||||
InitializeAdvancedHighlighter(); |
||||
} |
||||
|
||||
public bool HighlightingExplicitlySet { get; set; } |
||||
|
||||
/// <summary>
|
||||
/// Explicitly set the highlighting to use. Will be persisted.
|
||||
/// </summary>
|
||||
public override void SetHighlighting(string name) |
||||
{ |
||||
base.SetHighlighting(name); |
||||
this.HighlightingExplicitlySet = true; |
||||
InitializeAdvancedHighlighter(); |
||||
} |
||||
|
||||
public void InitializeAdvancedHighlighter() |
||||
{ |
||||
if (advancedHighlighter != null) { |
||||
advancedHighlighter.Dispose(); |
||||
advancedHighlighter = null; |
||||
} |
||||
string highlighterPath = advancedHighlighterPath + "/" + Document.HighlightingStrategy.Name; |
||||
if (AddInTree.ExistsTreeNode(highlighterPath)) { |
||||
IList<IAdvancedHighlighter> highlighter = AddInTree.BuildItems<IAdvancedHighlighter>(highlighterPath, this); |
||||
if (highlighter != null && highlighter.Count > 0) { |
||||
advancedHighlighter = highlighter[0]; |
||||
advancedHighlighter.Initialize(this); |
||||
Document.HighlightingStrategy = new AdvancedHighlightingStrategy((DefaultHighlightingStrategy)Document.HighlightingStrategy, advancedHighlighter); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public void InitializeFormatter() |
||||
{ |
||||
string formatterPath = formatingStrategyPath + "/" + Document.HighlightingStrategy.Name; |
||||
var formatter = AddInTree.BuildItems<ICSharpCode.SharpDevelop.Editor.IFormattingStrategy>(formatterPath, this, false); |
||||
if (formatter != null && formatter.Count > 0) { |
||||
//Document.FormattingStrategy = formatter[0];
|
||||
} |
||||
} |
||||
|
||||
public override string GetRangeDescription(int selectedItem, int itemCount) |
||||
{ |
||||
return StringParser.Parse("${res:ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor.InsightWindow.NumberOfText}", |
||||
new StringTagPair("CurrentMethodNumber", selectedItem.ToString("##")), |
||||
new StringTagPair("NumberOfTotalMethods", itemCount.ToString("##"))); |
||||
} |
||||
|
||||
// public override IDeclarationViewWindow CreateDeclarationViewWindow()
|
||||
// {
|
||||
// return new HtmlDeclarationViewWindow();
|
||||
// }
|
||||
//
|
||||
} |
||||
} |
@ -1,547 +0,0 @@
@@ -1,547 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Diagnostics; |
||||
using System.Drawing.Printing; |
||||
using System.IO; |
||||
using System.Windows.Forms; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.Core.Presentation; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Refactoring; |
||||
using ICSharpCode.TextEditor; |
||||
using ICSharpCode.TextEditor.Document; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor |
||||
{ |
||||
public class TextEditorDisplayBinding : IDisplayBinding |
||||
{ |
||||
static TextEditorDisplayBinding() |
||||
{ |
||||
// ConfigDirectory is null during unit tests
|
||||
if (PropertyService.ConfigDirectory != null) { |
||||
// load #D-specific syntax highlighting files here
|
||||
string modeDir = Path.Combine(PropertyService.ConfigDirectory, "modes"); |
||||
if (!Directory.Exists(modeDir)) { |
||||
Directory.CreateDirectory(modeDir); |
||||
} |
||||
|
||||
HighlightingManager.Manager.AddSyntaxModeFileProvider(new ICSharpCode.SharpDevelop.DefaultEditor.Codons.AddInTreeSyntaxModeProvider()); |
||||
HighlightingManager.Manager.AddSyntaxModeFileProvider(new FileSyntaxModeProvider(Path.Combine(PropertyService.DataDirectory, "modes"))); |
||||
HighlightingManager.Manager.AddSyntaxModeFileProvider(new FileSyntaxModeProvider(modeDir)); |
||||
} |
||||
ClipboardHandling.Initialize(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Force static constructor to be called. Otherwise other editor's such as the XML editor do not
|
||||
/// use custom syntax highlighting.
|
||||
/// </summary>
|
||||
public static void InitializeSyntaxModes() |
||||
{ |
||||
} |
||||
|
||||
public virtual bool CanCreateContentForFile(string fileName) |
||||
{ |
||||
return true; |
||||
} |
||||
|
||||
protected virtual TextEditorDisplayBindingWrapper CreateWrapper(OpenedFile file) |
||||
{ |
||||
return new TextEditorDisplayBindingWrapper(file); |
||||
} |
||||
|
||||
public virtual IViewContent CreateContentForFile(OpenedFile file) |
||||
{ |
||||
TextEditorDisplayBindingWrapper b2 = CreateWrapper(file); |
||||
file.ForceInitializeView(b2); // load file to initialize folding etc.
|
||||
|
||||
b2.textEditorControl.Dock = DockStyle.Fill; |
||||
try { |
||||
b2.textEditorControl.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategyForFile(file.FileName); |
||||
b2.textEditorControl.InitializeAdvancedHighlighter(); |
||||
} catch (HighlightingDefinitionInvalidException ex) { |
||||
b2.textEditorControl.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy(); |
||||
MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); |
||||
} |
||||
b2.textEditorControl.InitializeFormatter(); |
||||
b2.textEditorControl.ActivateQuickClassBrowserOnDemand(); |
||||
|
||||
return b2; |
||||
} |
||||
} |
||||
|
||||
public class TextEditorDisplayBindingWrapper : AbstractViewContent, IMementoCapable, IPrintable, IEditable, IUndoHandler, IPositionable, ITextEditorControlProvider, IParseInformationListener, IClipboardHandler, IContextHelpProvider, IToolsHost |
||||
{ |
||||
internal readonly SharpDevelopTextAreaControl textEditorControl; |
||||
|
||||
public TextEditorControl TextEditorControl { |
||||
get { |
||||
return textEditorControl; |
||||
} |
||||
} |
||||
|
||||
public ICSharpCode.SharpDevelop.Editor.ITextEditor TextEditor { |
||||
get { return textEditorControl.Adapter; } |
||||
} |
||||
|
||||
public ICSharpCode.SharpDevelop.Editor.IDocument GetDocumentForFile(OpenedFile file) |
||||
{ |
||||
if (file == this.PrimaryFile) { |
||||
return this.TextEditor.Document; |
||||
} else { |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
public bool EnableUndo { |
||||
get { |
||||
return textEditorControl.EnableUndo; |
||||
} |
||||
} |
||||
public bool EnableRedo { |
||||
get { |
||||
return textEditorControl.EnableRedo; |
||||
} |
||||
} |
||||
|
||||
// ParserUpdateThread uses the text property via IEditable, I had an exception
|
||||
// because multiple threads were accessing the GapBufferStrategy at the same time.
|
||||
|
||||
string GetText() |
||||
{ |
||||
return textEditorControl.Document.TextContent; |
||||
} |
||||
|
||||
void SetText(string value) |
||||
{ |
||||
textEditorControl.Document.Replace(0, textEditorControl.Document.TextLength, value); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Creates a snapshot of the editor content.
|
||||
/// This method is thread-safe.
|
||||
/// </summary>
|
||||
public ITextBuffer CreateSnapshot() |
||||
{ |
||||
string content = WorkbenchSingleton.SafeThreadFunction<string>(GetText); |
||||
return new StringTextBuffer(content); |
||||
} |
||||
|
||||
string IEditable.Text { |
||||
get { |
||||
if (WorkbenchSingleton.InvokeRequired) |
||||
return WorkbenchSingleton.SafeThreadFunction<string>(GetText); |
||||
else |
||||
return GetText(); |
||||
} |
||||
} |
||||
|
||||
public PrintDocument PrintDocument { |
||||
get { |
||||
return textEditorControl.PrintDocument; |
||||
} |
||||
} |
||||
|
||||
public override object Control { |
||||
get { |
||||
return textEditorControl; |
||||
} |
||||
} |
||||
|
||||
public void Undo() |
||||
{ |
||||
this.textEditorControl.Undo(); |
||||
} |
||||
|
||||
public void Redo() |
||||
{ |
||||
this.textEditorControl.Redo(); |
||||
} |
||||
|
||||
protected virtual SharpDevelopTextAreaControl CreateSharpDevelopTextAreaControl() |
||||
{ |
||||
return new SharpDevelopTextAreaControl(); |
||||
} |
||||
|
||||
public TextEditorDisplayBindingWrapper(OpenedFile file) : base(file) |
||||
{ |
||||
this.TabPageText = "${res:FormsDesigner.DesignTabPages.SourceTabPage}"; |
||||
|
||||
textEditorControl = CreateSharpDevelopTextAreaControl(); |
||||
textEditorControl.RightToLeft = RightToLeft.No; |
||||
textEditorControl.Document.DocumentChanged += new DocumentEventHandler(TextAreaChangedEvent); |
||||
textEditorControl.ActiveTextAreaControl.Caret.CaretModeChanged += new EventHandler(CaretModeChanged); |
||||
textEditorControl.ActiveTextAreaControl.Enter += new EventHandler(CaretUpdate); |
||||
textEditorControl.ActiveTextAreaControl.Caret.PositionChanged += CaretUpdate; |
||||
|
||||
textEditorControl.FileName = file.FileName; |
||||
} |
||||
|
||||
public void ShowHelp() |
||||
{ |
||||
// Resolve expression at cursor and show help
|
||||
TextArea textArea = textEditorControl.ActiveTextAreaControl.TextArea; |
||||
IDocument doc = textArea.Document; |
||||
IExpressionFinder expressionFinder = ParserService.GetExpressionFinder(textArea.MotherTextEditorControl.FileName); |
||||
if (expressionFinder == null) |
||||
return; |
||||
LineSegment seg = doc.GetLineSegment(textArea.Caret.Line); |
||||
string textContent = doc.TextContent; |
||||
ExpressionResult expressionResult = expressionFinder.FindFullExpression(textContent, seg.Offset + textArea.Caret.Column); |
||||
string expression = expressionResult.Expression; |
||||
if (expression != null && expression.Length > 0) { |
||||
ResolveResult result = ParserService.Resolve(expressionResult, textArea.Caret.Line + 1, textArea.Caret.Column + 1, textEditorControl.FileName, textContent); |
||||
TypeResolveResult trr = result as TypeResolveResult; |
||||
if (trr != null) { |
||||
HelpProvider.ShowHelp(trr.ResolvedClass); |
||||
} |
||||
MemberResolveResult mrr = result as MemberResolveResult; |
||||
if (mrr != null) { |
||||
HelpProvider.ShowHelp(mrr.ResolvedMember); |
||||
} |
||||
} |
||||
} |
||||
|
||||
void TextAreaChangedEvent(object sender, DocumentEventArgs e) |
||||
{ |
||||
this.PrimaryFile.MakeDirty(); |
||||
NavigationService.ContentChanging(this.textEditorControl, e); |
||||
} |
||||
|
||||
public override void Dispose() |
||||
{ |
||||
if (this.PrimaryFile.IsUntitled) { |
||||
ParserService.ClearParseInformation(this.PrimaryFile.FileName); |
||||
} |
||||
textEditorControl.Dispose(); |
||||
base.Dispose(); |
||||
} |
||||
|
||||
public override bool IsReadOnly { |
||||
get { |
||||
return textEditorControl.IsReadOnly; |
||||
} |
||||
} |
||||
|
||||
public override void Save(OpenedFile file, Stream stream) |
||||
{ |
||||
if (file != PrimaryFile) |
||||
throw new ArgumentException("file != PrimaryFile"); |
||||
|
||||
if (!textEditorControl.CanSaveWithCurrentEncoding()) { |
||||
if (MessageService.AskQuestion("The file cannot be saved with the current encoding " + |
||||
textEditorControl.Encoding.EncodingName + " without losing data." + |
||||
"\nDo you want to save it using UTF-8 instead?")) { |
||||
textEditorControl.Encoding = System.Text.Encoding.UTF8; |
||||
} |
||||
} |
||||
|
||||
textEditorControl.SaveFile(stream); |
||||
} |
||||
|
||||
public override void Load(OpenedFile file, Stream stream) |
||||
{ |
||||
if (file != PrimaryFile) |
||||
throw new ArgumentException("file != PrimaryFile"); |
||||
|
||||
if (!file.IsUntitled) { |
||||
textEditorControl.IsReadOnly = (File.GetAttributes(file.FileName) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly; |
||||
} |
||||
|
||||
bool autodetectEncoding = true; |
||||
textEditorControl.LoadFile(file.FileName, stream, true, autodetectEncoding); |
||||
textEditorControl.FileLoaded(); |
||||
// foreach (Bookmarks.SDBookmark mark in Bookmarks.BookmarkManager.GetBookmarks(file.FileName)) {
|
||||
// mark.Document = textEditorControl.Document;
|
||||
// textEditorControl.Document.BookmarkManager.AddMark(mark);
|
||||
// }
|
||||
ForceFoldingUpdate(); |
||||
} |
||||
|
||||
public Properties CreateMemento() |
||||
{ |
||||
Properties properties = new Properties(); |
||||
properties.Set("CaretOffset", textEditorControl.ActiveTextAreaControl.Caret.Offset); |
||||
properties.Set("VisibleLine", textEditorControl.ActiveTextAreaControl.TextArea.TextView.FirstVisibleLine); |
||||
if (textEditorControl.HighlightingExplicitlySet) { |
||||
properties.Set("HighlightingLanguage", textEditorControl.Document.HighlightingStrategy.Name); |
||||
} |
||||
return properties; |
||||
} |
||||
|
||||
public void SetMemento(Properties properties) |
||||
{ |
||||
textEditorControl.ActiveTextAreaControl.Caret.Position = textEditorControl.Document.OffsetToPosition(Math.Min(textEditorControl.Document.TextLength, Math.Max(0, properties.Get("CaretOffset", textEditorControl.ActiveTextAreaControl.Caret.Offset)))); |
||||
// textAreaControl.SetDesiredColumn();
|
||||
|
||||
string highlightingName = properties.Get("HighlightingLanguage", string.Empty); |
||||
if (!string.IsNullOrEmpty(highlightingName)) { |
||||
if (highlightingName == textEditorControl.Document.HighlightingStrategy.Name) { |
||||
textEditorControl.HighlightingExplicitlySet = true; |
||||
} else { |
||||
IHighlightingStrategy highlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy(highlightingName); |
||||
if (highlightingStrategy != null) { |
||||
textEditorControl.HighlightingExplicitlySet = true; |
||||
textEditorControl.Document.HighlightingStrategy = highlightingStrategy; |
||||
} |
||||
} |
||||
} |
||||
textEditorControl.ActiveTextAreaControl.TextArea.TextView.FirstVisibleLine = properties.Get("VisibleLine", 0); |
||||
|
||||
// // insane check for cursor position, may be required for document reload.
|
||||
// int lineNr = textAreaControl.Document.GetLineNumberForOffset(textAreaControl.Document.Caret.Offset);
|
||||
// LineSegment lineSegment = textAreaControl.Document.GetLineSegment(lineNr);
|
||||
// textAreaControl.Document.Caret.Offset = Math.Min(lineSegment.Offset + lineSegment.Length, textAreaControl.Document.Caret.Offset);
|
||||
//
|
||||
// textAreaControl.OptionsChanged();
|
||||
// textAreaControl.Refresh();
|
||||
} |
||||
|
||||
public override INavigationPoint BuildNavPoint() |
||||
{ |
||||
int lineNumber = this.Line; |
||||
LineSegment lineSegment = textEditorControl.Document.GetLineSegment(lineNumber); |
||||
string txt = textEditorControl.Document.GetText(lineSegment); |
||||
return new TextNavigationPoint(this.PrimaryFileName, lineNumber, this.Column, txt); |
||||
} |
||||
|
||||
void CaretUpdate(object sender, EventArgs e) |
||||
{ |
||||
CaretChanged(null, null); |
||||
CaretModeChanged(null, null); |
||||
} |
||||
|
||||
void CaretChanged(object sender, EventArgs e) |
||||
{ |
||||
TextAreaControl activeTextAreaControl = textEditorControl.ActiveTextAreaControl; |
||||
int line = activeTextAreaControl.Caret.Line; |
||||
int col = activeTextAreaControl.Caret.Column; |
||||
StatusBarService.SetCaretPosition(activeTextAreaControl.TextArea.TextView.GetVisualColumn(line, col) + 1, line + 1, col + 1); |
||||
NavigationService.Log(this.BuildNavPoint()); |
||||
} |
||||
|
||||
void CaretModeChanged(object sender, EventArgs e) |
||||
{ |
||||
StatusBarService.SetInsertMode(textEditorControl.ActiveTextAreaControl.Caret.CaretMode == CaretMode.InsertMode); |
||||
} |
||||
|
||||
protected override void OnFileNameChanged(OpenedFile file) |
||||
{ |
||||
base.OnFileNameChanged(file); |
||||
Debug.Assert(file == this.Files[0]); |
||||
|
||||
string oldFileName = textEditorControl.FileName; |
||||
string newFileName = file.FileName; |
||||
|
||||
if (Path.GetExtension(oldFileName) != Path.GetExtension(newFileName)) { |
||||
if (textEditorControl.Document.HighlightingStrategy != null) { |
||||
textEditorControl.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategyForFile(newFileName); |
||||
textEditorControl.Refresh(); |
||||
} |
||||
} |
||||
|
||||
SetIcon(); |
||||
|
||||
ParserService.ClearParseInformation(oldFileName); |
||||
textEditorControl.FileName = newFileName; |
||||
ParserService.ParseViewContent(this); |
||||
} |
||||
|
||||
protected override void OnWorkbenchWindowChanged() |
||||
{ |
||||
base.OnWorkbenchWindowChanged(); |
||||
SetIcon(); |
||||
} |
||||
|
||||
void SetIcon() |
||||
{ |
||||
if (this.WorkbenchWindow != null) { |
||||
var icon = PresentationResourceService.GetBitmapSource(IconService.GetImageForFile(this.PrimaryFileName)); |
||||
if (icon != null) { |
||||
this.WorkbenchWindow.Icon = icon; |
||||
} |
||||
} |
||||
} |
||||
|
||||
#region IPositionable implementation
|
||||
public void JumpTo(int line, int column) |
||||
{ |
||||
textEditorControl.ActiveTextAreaControl.JumpTo(line, column); |
||||
|
||||
// we need to delay this call here because the text editor does not know its height if it was just created
|
||||
WorkbenchSingleton.SafeThreadAsyncCall( |
||||
delegate { |
||||
textEditorControl.ActiveTextAreaControl.CenterViewOn( |
||||
line, (int)(0.3 * textEditorControl.ActiveTextAreaControl.TextArea.TextView.VisibleLineCount)); |
||||
}); |
||||
} |
||||
|
||||
public int Line { |
||||
get { |
||||
return textEditorControl.ActiveTextAreaControl.Caret.Line; |
||||
} |
||||
} |
||||
|
||||
public int Column { |
||||
get { |
||||
return textEditorControl.ActiveTextAreaControl.Caret.Column; |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
public void ForceFoldingUpdate() |
||||
{ |
||||
if (textEditorControl.TextEditorProperties.EnableFolding) { |
||||
string fileName = textEditorControl.FileName; |
||||
ParseInformation parseInfo = ParserService.GetParseInformation(fileName); |
||||
if (parseInfo == null) { |
||||
parseInfo = ParserService.ParseFile(fileName, |
||||
new StringTextBuffer(textEditorControl.Document.TextContent)); |
||||
} |
||||
textEditorControl.Document.FoldingManager.UpdateFoldings(fileName, parseInfo); |
||||
//UpdateClassMemberBookmarks(parseInfo);
|
||||
} |
||||
} |
||||
|
||||
public void ParseInformationUpdated(ParseInformation parseInfo) |
||||
{ |
||||
if (textEditorControl.TextEditorProperties.EnableFolding) { |
||||
WorkbenchSingleton.SafeThreadAsyncCall(ParseInformationUpdatedInvoked, parseInfo); |
||||
} |
||||
} |
||||
|
||||
void ParseInformationUpdatedInvoked(ParseInformation parseInfo) |
||||
{ |
||||
try { |
||||
textEditorControl.Document.FoldingManager.UpdateFoldings(TitleName, parseInfo); |
||||
//UpdateClassMemberBookmarks(parseInfo);
|
||||
textEditorControl.ActiveTextAreaControl.TextArea.Refresh(textEditorControl.ActiveTextAreaControl.TextArea.FoldMargin); |
||||
textEditorControl.ActiveTextAreaControl.TextArea.Refresh(textEditorControl.ActiveTextAreaControl.TextArea.IconBarMargin); |
||||
} catch (Exception ex) { |
||||
MessageService.ShowException(ex); |
||||
} |
||||
} |
||||
|
||||
/* |
||||
void UpdateClassMemberBookmarks(ParseInformation parseInfo) |
||||
{ |
||||
BookmarkManager bm = textEditorControl.Document.BookmarkManager; |
||||
bm.RemoveMarks(new Predicate<Bookmark>(IsClassMemberBookmark)); |
||||
if (parseInfo == null) return; |
||||
Debug.Assert(textEditorControl.Document.TotalNumberOfLines >= 1); |
||||
if (textEditorControl.Document.TotalNumberOfLines < 1) { |
||||
return; |
||||
} |
||||
foreach (IClass c in parseInfo.MostRecentCompilationUnit.Classes) { |
||||
AddClassMemberBookmarks(bm, c); |
||||
} |
||||
} |
||||
|
||||
void AddClassMemberBookmarks(BookmarkManager bm, IClass c) |
||||
{ |
||||
if (c.IsSynthetic) return; |
||||
if (!c.Region.IsEmpty) { |
||||
bm.AddMark(new Bookmarks.ClassBookmark(c)); |
||||
} |
||||
foreach (IClass innerClass in c.InnerClasses) { |
||||
AddClassMemberBookmarks(bm, innerClass); |
||||
} |
||||
foreach (IMethod m in c.Methods) { |
||||
if (m.Region.IsEmpty || m.IsSynthetic) continue; |
||||
bm.AddMark(new Bookmarks.MethodBookmark(m)); |
||||
} |
||||
foreach (IProperty m in c.Properties) { |
||||
if (m.Region.IsEmpty || m.IsSynthetic) continue; |
||||
bm.AddMark(new Bookmarks.PropertyBookmark(m)); |
||||
} |
||||
foreach (IField f in c.Fields) { |
||||
if (f.Region.IsEmpty || f.IsSynthetic) continue; |
||||
bm.AddMark(new Bookmarks.FieldBookmark(f)); |
||||
} |
||||
foreach (IEvent e in c.Events) { |
||||
if (e.Region.IsEmpty || e.IsSynthetic) continue; |
||||
bm.AddMark(new Bookmarks.EventBookmark(e)); |
||||
} |
||||
} |
||||
|
||||
bool IsClassMemberBookmark(Bookmark b) |
||||
{ |
||||
return b is Bookmarks.ClassMemberBookmark || b is Bookmarks.ClassBookmark; |
||||
} |
||||
*/ |
||||
|
||||
#region ICSharpCode.SharpDevelop.Gui.IClipboardHandler interface implementation
|
||||
public bool EnableCut { |
||||
get { |
||||
return !this.IsDisposed && textEditorControl.ActiveTextAreaControl.TextArea.ClipboardHandler.EnableCut; |
||||
} |
||||
} |
||||
|
||||
public bool EnableCopy { |
||||
get { |
||||
return !this.IsDisposed && textEditorControl.ActiveTextAreaControl.TextArea.ClipboardHandler.EnableCopy; |
||||
} |
||||
} |
||||
|
||||
public bool EnablePaste { |
||||
get { |
||||
return !this.IsDisposed && textEditorControl.ActiveTextAreaControl.TextArea.ClipboardHandler.EnablePaste; |
||||
} |
||||
} |
||||
|
||||
public bool EnableDelete { |
||||
get { |
||||
return !this.IsDisposed && textEditorControl.ActiveTextAreaControl.TextArea.ClipboardHandler.EnableDelete; |
||||
} |
||||
} |
||||
|
||||
public bool EnableSelectAll { |
||||
get { |
||||
return !this.IsDisposed && textEditorControl.ActiveTextAreaControl.TextArea.ClipboardHandler.EnableSelectAll; |
||||
} |
||||
} |
||||
|
||||
public void SelectAll() |
||||
{ |
||||
textEditorControl.ActiveTextAreaControl.TextArea.ClipboardHandler.SelectAll(null, null); |
||||
} |
||||
|
||||
public void Delete() |
||||
{ |
||||
textEditorControl.ActiveTextAreaControl.TextArea.ClipboardHandler.Delete(null, null); |
||||
} |
||||
|
||||
public void Paste() |
||||
{ |
||||
textEditorControl.ActiveTextAreaControl.TextArea.ClipboardHandler.Paste(null, null); |
||||
} |
||||
|
||||
public void Copy() |
||||
{ |
||||
textEditorControl.ActiveTextAreaControl.TextArea.ClipboardHandler.Copy(null, null); |
||||
} |
||||
|
||||
public void Cut() |
||||
{ |
||||
textEditorControl.ActiveTextAreaControl.TextArea.ClipboardHandler.Cut(null, null); |
||||
} |
||||
#endregion
|
||||
|
||||
object IToolsHost.ToolsContent { |
||||
get { return TextEditorSideBar.Instance; } |
||||
} |
||||
|
||||
public override string ToString() |
||||
{ |
||||
return "[" + GetType().Name + " " + this.PrimaryFileName + "]"; |
||||
} |
||||
} |
||||
} |
@ -1,93 +0,0 @@
@@ -1,93 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using ICSharpCode.SharpDevelop.Gui.OptionPanels; |
||||
using System; |
||||
using System.Windows.Forms; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.TextEditor; |
||||
using ICSharpCode.TextEditor.Document; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.OptionPanels |
||||
{ |
||||
/// <summary>
|
||||
/// Summary description for Form8.
|
||||
/// </summary>
|
||||
public class BehaviorTextEditorPanel : XmlFormsOptionPanel |
||||
{ |
||||
public override void LoadPanelContents() |
||||
{ |
||||
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.BehaviorTextEditorPanel.xfrm")); |
||||
|
||||
SharpDevelopTextEditorProperties properties = SharpDevelopTextEditorProperties.Instance; |
||||
|
||||
((CheckBox)ControlDictionary["autoinsertCurlyBraceCheckBox"]).Checked = properties.AutoInsertCurlyBracket; |
||||
((CheckBox)ControlDictionary["hideMouseCursorCheckBox"]).Checked = properties.HideMouseCursor; |
||||
((CheckBox)ControlDictionary["caretBehindEOLCheckBox"]).Checked = properties.AllowCaretBeyondEOL; |
||||
((CheckBox)ControlDictionary["auotInsertTemplatesCheckBox"]).Checked = properties.AutoInsertTemplates; |
||||
((CheckBox)ControlDictionary["cutCopyWholeLine"]).Checked = properties.CutCopyWholeLine; |
||||
|
||||
((CheckBox)ControlDictionary["convertTabsToSpacesCheckBox"]).Checked = properties.ConvertTabsToSpaces; |
||||
|
||||
ControlDictionary["tabSizeTextBox"].Text = properties.TabIndent.ToString(); |
||||
ControlDictionary["indentSizeTextBox"].Text = properties.IndentationSize.ToString(); |
||||
|
||||
((ComboBox)ControlDictionary["indentStyleComboBox"]).Items.Add(StringParser.Parse("${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.IndentStyle.None}")); |
||||
((ComboBox)ControlDictionary["indentStyleComboBox"]).Items.Add(StringParser.Parse("${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.IndentStyle.Automatic}")); |
||||
((ComboBox)ControlDictionary["indentStyleComboBox"]).Items.Add(StringParser.Parse("${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.IndentStyle.Smart}")); |
||||
|
||||
((ComboBox)ControlDictionary["indentStyleComboBox"]).SelectedIndex = (int)properties.IndentStyle; |
||||
|
||||
((ComboBox)ControlDictionary["mouseWhellDirectionComboBox"]).Items.Add(StringParser.Parse("${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.NormalMouseDirectionRadioButton}")); |
||||
((ComboBox)ControlDictionary["mouseWhellDirectionComboBox"]).Items.Add(StringParser.Parse("${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.ReverseMouseDirectionRadioButton}")); |
||||
((ComboBox)ControlDictionary["mouseWhellDirectionComboBox"]).SelectedIndex = properties.MouseWheelScrollDown ? 0 : 1; |
||||
} |
||||
|
||||
public override bool StorePanelContents() |
||||
{ |
||||
SharpDevelopTextEditorProperties properties = SharpDevelopTextEditorProperties.Instance; |
||||
|
||||
properties.ConvertTabsToSpaces = ((CheckBox)ControlDictionary["convertTabsToSpacesCheckBox"]).Checked; |
||||
properties.MouseWheelScrollDown = ((ComboBox)ControlDictionary["mouseWhellDirectionComboBox"]).SelectedIndex == 0; |
||||
|
||||
properties.AutoInsertCurlyBracket = ((CheckBox)ControlDictionary["autoinsertCurlyBraceCheckBox"]).Checked; |
||||
properties.HideMouseCursor = ((CheckBox)ControlDictionary["hideMouseCursorCheckBox"]).Checked; |
||||
properties.AllowCaretBeyondEOL = ((CheckBox)ControlDictionary["caretBehindEOLCheckBox"]).Checked; |
||||
properties.AutoInsertTemplates = ((CheckBox)ControlDictionary["auotInsertTemplatesCheckBox"]).Checked; |
||||
properties.CutCopyWholeLine = ((CheckBox)ControlDictionary["cutCopyWholeLine"]).Checked; |
||||
|
||||
properties.IndentStyle = (IndentStyle)((ComboBox)ControlDictionary["indentStyleComboBox"]).SelectedIndex; |
||||
|
||||
try { |
||||
int tabSize = Int32.Parse(ControlDictionary["tabSizeTextBox"].Text); |
||||
|
||||
// FIX: don't allow to set tab size to zero as this will cause divide by zero exceptions in the text control.
|
||||
// Zero isn't a setting that makes sense, anyway.
|
||||
if (tabSize > 0) { |
||||
properties.TabIndent = tabSize; |
||||
} |
||||
} catch (Exception) { |
||||
} |
||||
|
||||
try { |
||||
properties.IndentationSize = Int32.Parse(ControlDictionary["indentSizeTextBox"].Text); |
||||
} catch (Exception) { |
||||
} |
||||
|
||||
IViewContent activeViewContent = WorkbenchSingleton.Workbench.ActiveViewContent; |
||||
|
||||
if (activeViewContent is ITextEditorControlProvider) { |
||||
TextEditorControl textarea = ((ITextEditorControlProvider)activeViewContent).TextEditorControl; |
||||
textarea.OptionsChanged(); |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
} |
||||
} |
@ -1,132 +0,0 @@
@@ -1,132 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using ICSharpCode.SharpDevelop.Gui.OptionPanels; |
||||
using System; |
||||
using System.Drawing; |
||||
using System.Drawing.Text; |
||||
using System.Text; |
||||
using System.Windows.Forms; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.TextEditor; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.OptionPanels |
||||
{ |
||||
/// <summary>
|
||||
/// General texteditor options panel.
|
||||
/// </summary>
|
||||
public class GeneralTextEditorPanel : XmlFormsOptionPanel |
||||
{ |
||||
ComboBox fontListComboBox, fontSizeComboBox; |
||||
FontSelectionPanelHelper helper; |
||||
|
||||
public override void LoadPanelContents() |
||||
{ |
||||
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.GeneralTextEditorPanel.xfrm")); |
||||
|
||||
fontListComboBox = ((ComboBox)ControlDictionary["fontListComboBox"]); |
||||
fontSizeComboBox = ((ComboBox)ControlDictionary["fontSizeComboBox"]); |
||||
|
||||
SharpDevelopTextEditorProperties properties = SharpDevelopTextEditorProperties.Instance; |
||||
|
||||
((CheckBox)ControlDictionary["enableFoldingCheckBox"]).Checked = properties.EnableFolding; |
||||
((CheckBox)ControlDictionary["showQuickClassBrowserCheckBox"]).Checked = properties.ShowQuickClassBrowserPanel; |
||||
|
||||
if (IsClearTypeEnabled) { |
||||
// Somehow, SingleBitPerPixelGridFit still renders as Cleartype if cleartype is enabled
|
||||
// and we're using the TextRenderer for rendering.
|
||||
// So we cannot support not using antialiasing if system-wide font smoothening is enabled.
|
||||
((CheckBox)ControlDictionary["enableAAFontRenderingCheckBox"]).Checked = true; |
||||
((CheckBox)ControlDictionary["enableAAFontRenderingCheckBox"]).Enabled = false; |
||||
} else { |
||||
((CheckBox)ControlDictionary["enableAAFontRenderingCheckBox"]).Checked = |
||||
(properties.TextRenderingHint == TextRenderingHint.AntiAliasGridFit || properties.TextRenderingHint == TextRenderingHint.ClearTypeGridFit); |
||||
} |
||||
|
||||
((CheckBox)ControlDictionary["mouseWheelZoomCheckBox"]).Checked = properties.MouseWheelTextZoom; |
||||
|
||||
foreach (String name in CharacterEncodings.Names) { |
||||
((ComboBox)ControlDictionary["textEncodingComboBox"]).Items.Add(name); |
||||
} |
||||
int encodingIndex = 0; |
||||
try { |
||||
encodingIndex = CharacterEncodings.GetEncodingIndex(properties.EncodingCodePage); |
||||
} catch { |
||||
encodingIndex = CharacterEncodings.GetEncodingIndex(Encoding.UTF8.CodePage); |
||||
} |
||||
((ComboBox)ControlDictionary["textEncodingComboBox"]).SelectedIndex = encodingIndex; |
||||
|
||||
for (int i = 6; i <= 24; ++i) { |
||||
fontSizeComboBox.Items.Add(i); |
||||
} |
||||
|
||||
fontSizeComboBox.TextChanged += new EventHandler(UpdateFontPreviewLabel); |
||||
fontSizeComboBox.Enabled = false; |
||||
|
||||
fontListComboBox.Enabled = false; |
||||
fontListComboBox.TextChanged += new EventHandler(UpdateFontPreviewLabel); |
||||
fontListComboBox.SelectedIndexChanged += new EventHandler(UpdateFontPreviewLabel); |
||||
|
||||
Font currentFont = FontSelectionPanel.ParseFont(properties.FontContainer.DefaultFont.ToString()); |
||||
helper = new FontSelectionPanelHelper(fontSizeComboBox, fontListComboBox, currentFont); |
||||
|
||||
fontListComboBox.MeasureItem += new System.Windows.Forms.MeasureItemEventHandler(helper.MeasureComboBoxItem); |
||||
fontListComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(helper.ComboBoxDrawItem); |
||||
|
||||
UpdateFontPreviewLabel(null, null); |
||||
helper.StartThread(); |
||||
} |
||||
|
||||
Font CurrentFont { |
||||
get { |
||||
return helper.GetSelectedFont(); |
||||
} |
||||
} |
||||
|
||||
bool IsClearTypeEnabled { |
||||
get { |
||||
return SystemInformation.IsFontSmoothingEnabled && SystemInformation.FontSmoothingType >= 2; |
||||
} |
||||
} |
||||
|
||||
void UpdateFontPreviewLabel(object sender, EventArgs e) |
||||
{ |
||||
helper.UpdateFontPreviewLabel(ControlDictionary["fontPreviewLabel"]); |
||||
} |
||||
|
||||
public override bool StorePanelContents() |
||||
{ |
||||
SharpDevelopTextEditorProperties properties = SharpDevelopTextEditorProperties.Instance; |
||||
|
||||
if (((CheckBox)ControlDictionary["enableAAFontRenderingCheckBox"]).Enabled) { |
||||
properties.TextRenderingHint = ((CheckBox)ControlDictionary["enableAAFontRenderingCheckBox"]).Checked |
||||
? TextRenderingHint.ClearTypeGridFit : TextRenderingHint.SystemDefault; |
||||
} else { |
||||
properties.TextRenderingHint = TextRenderingHint.SystemDefault; |
||||
} |
||||
properties.MouseWheelTextZoom = ((CheckBox)ControlDictionary["mouseWheelZoomCheckBox"]).Checked; |
||||
//((Properties)CustomizationObject).Set("EnableCodeCompletion", ((CheckBox)ControlDictionary["enableCodeCompletionCheckBox"]).Checked);
|
||||
properties.EnableFolding = ((CheckBox)ControlDictionary["enableFoldingCheckBox"]).Checked; |
||||
Font currentFont = CurrentFont; |
||||
if (currentFont != null) { |
||||
properties.Font = currentFont; |
||||
} |
||||
properties.EncodingCodePage = CharacterEncodings.GetCodePageByIndex(((ComboBox)ControlDictionary["textEncodingComboBox"]).SelectedIndex); |
||||
properties.ShowQuickClassBrowserPanel = ((CheckBox)ControlDictionary["showQuickClassBrowserCheckBox"]).Checked; |
||||
|
||||
IViewContent activeViewContent = WorkbenchSingleton.Workbench.ActiveViewContent; |
||||
|
||||
if (activeViewContent is ITextEditorControlProvider) { |
||||
TextEditorControl textarea = ((ITextEditorControlProvider)activeViewContent).TextEditorControl; |
||||
textarea.OptionsChanged(); |
||||
} |
||||
return true; |
||||
} |
||||
} |
||||
} |
@ -1,86 +0,0 @@
@@ -1,86 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using ICSharpCode.SharpDevelop.Gui.OptionPanels; |
||||
using System; |
||||
using System.Windows.Forms; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.TextEditor; |
||||
using ICSharpCode.TextEditor.Document; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.OptionPanels |
||||
{ |
||||
/// <summary>
|
||||
/// Summary description for Form9.
|
||||
/// </summary>
|
||||
public class MarkersTextEditorPanel : XmlFormsOptionPanel |
||||
{ |
||||
public override void LoadPanelContents() |
||||
{ |
||||
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.MarkersTextEditorPanel.xfrm")); |
||||
|
||||
SharpDevelopTextEditorProperties properties = SharpDevelopTextEditorProperties.Instance; |
||||
((CheckBox)ControlDictionary["showLineNumberCheckBox"]).Checked = properties.ShowLineNumbers; |
||||
((CheckBox)ControlDictionary["showInvalidLinesCheckBox"]).Checked = properties.ShowInvalidLines; |
||||
((CheckBox)ControlDictionary["showBracketHighlighterCheckBox"]).Checked = properties.ShowMatchingBracket; |
||||
((CheckBox)ControlDictionary["showErrorsCheckBox"]).Checked = properties.UnderlineErrors; |
||||
((CheckBox)ControlDictionary["showHRulerCheckBox"]).Checked = properties.ShowHorizontalRuler; |
||||
((CheckBox)ControlDictionary["showEOLMarkersCheckBox"]).Checked = properties.ShowEOLMarker; |
||||
((CheckBox)ControlDictionary["showVRulerCheckBox"]).Checked = properties.ShowVerticalRuler; |
||||
((CheckBox)ControlDictionary["showTabCharsCheckBox"]).Checked = properties.ShowTabs; |
||||
((CheckBox)ControlDictionary["showSpaceCharsCheckBox"]).Checked = properties.ShowSpaces; |
||||
((CheckBox)ControlDictionary["showCaretLineCheckBox"]).Checked = properties.CaretLine; |
||||
|
||||
ControlDictionary["vRulerRowTextBox"].Text = properties.VerticalRulerRow.ToString(); |
||||
|
||||
|
||||
((ComboBox)ControlDictionary["lineMarkerStyleComboBox"]).Items.Add(ResourceService.GetString("Dialog.Options.IDEOptions.TextEditor.Markers.LineViewerStyle.None")); |
||||
((ComboBox)ControlDictionary["lineMarkerStyleComboBox"]).Items.Add(ResourceService.GetString("Dialog.Options.IDEOptions.TextEditor.Markers.LineViewerStyle.FullRow")); |
||||
((ComboBox)ControlDictionary["lineMarkerStyleComboBox"]).SelectedIndex = (int)properties.LineViewerStyle; |
||||
|
||||
|
||||
|
||||
((ComboBox)ControlDictionary["bracketMatchingStyleComboBox"]).Items.Add(ResourceService.GetString("Dialog.Options.IDEOptions.TextEditor.Markers.BracketMatchingStyle.BeforeCaret")); |
||||
((ComboBox)ControlDictionary["bracketMatchingStyleComboBox"]).Items.Add(ResourceService.GetString("Dialog.Options.IDEOptions.TextEditor.Markers.BracketMatchingStyle.AfterCaret")); |
||||
((ComboBox)ControlDictionary["bracketMatchingStyleComboBox"]).SelectedIndex = (int)properties.BracketMatchingStyle; |
||||
} |
||||
|
||||
public override bool StorePanelContents() |
||||
{ |
||||
SharpDevelopTextEditorProperties properties = SharpDevelopTextEditorProperties.Instance; |
||||
properties.ShowInvalidLines = ((CheckBox)ControlDictionary["showInvalidLinesCheckBox"]).Checked; |
||||
properties.ShowLineNumbers = ((CheckBox)ControlDictionary["showLineNumberCheckBox"]).Checked; |
||||
properties.ShowMatchingBracket = ((CheckBox)ControlDictionary["showBracketHighlighterCheckBox"]).Checked; |
||||
properties.UnderlineErrors = ((CheckBox)ControlDictionary["showErrorsCheckBox"]).Checked; |
||||
properties.ShowHorizontalRuler = ((CheckBox)ControlDictionary["showHRulerCheckBox"]).Checked; |
||||
properties.ShowEOLMarker = ((CheckBox)ControlDictionary["showEOLMarkersCheckBox"]).Checked; |
||||
properties.ShowVerticalRuler = ((CheckBox)ControlDictionary["showVRulerCheckBox"]).Checked; |
||||
properties.ShowTabs = ((CheckBox)ControlDictionary["showTabCharsCheckBox"]).Checked; |
||||
properties.ShowSpaces = ((CheckBox)ControlDictionary["showSpaceCharsCheckBox"]).Checked; |
||||
properties.CaretLine = ((CheckBox)ControlDictionary["showCaretLineCheckBox"]).Checked; |
||||
|
||||
try { |
||||
properties.VerticalRulerRow = Int32.Parse(ControlDictionary["vRulerRowTextBox"].Text); |
||||
} catch (Exception) { |
||||
} |
||||
|
||||
properties.LineViewerStyle = (LineViewerStyle)((ComboBox)ControlDictionary["lineMarkerStyleComboBox"]).SelectedIndex; |
||||
properties.BracketMatchingStyle = (BracketMatchingStyle)((ComboBox)ControlDictionary["bracketMatchingStyleComboBox"]).SelectedIndex; |
||||
|
||||
IViewContent activeViewContent = WorkbenchSingleton.Workbench.ActiveViewContent; |
||||
|
||||
if (activeViewContent is ITextEditorControlProvider) { |
||||
TextEditorControl textarea = ((ITextEditorControlProvider)activeViewContent).TextEditorControl; |
||||
textarea.OptionsChanged(); |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue