diff --git a/data/resources/StringResources.resx b/data/resources/StringResources.resx
index 0be935f412..0fd83c63fb 100644
--- a/data/resources/StringResources.resx
+++ b/data/resources/StringResources.resx
@@ -1729,6 +1729,9 @@ Examples: "120", "MainClass", "Main.cs, 120".
Italic
+
+ Underlined
+
Export highlighting colors
diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj b/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj
index 970be27a88..848785d6fb 100644
--- a/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj
+++ b/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj
@@ -78,6 +78,7 @@
+
diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Resources/CSharp-Semantic.xshd b/src/AddIns/BackendBindings/CSharpBinding/Project/Resources/CSharp-Semantic.xshd
index 157dc9e717..3e1bba50c7 100644
--- a/src/AddIns/BackendBindings/CSharpBinding/Project/Resources/CSharp-Semantic.xshd
+++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Resources/CSharp-Semantic.xshd
@@ -32,7 +32,11 @@
+
+
+
+
diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpSemanticHighlighterVisitor.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpSemanticHighlighterVisitor.cs
index 8e4765c939..f50df9abb3 100644
--- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpSemanticHighlighterVisitor.cs
+++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpSemanticHighlighterVisitor.cs
@@ -58,10 +58,10 @@ namespace CSharpBinding
//this.defaultTextColor = ???;
this.referenceTypeColor = highlighting.GetNamedColor("ReferenceTypes");
this.valueTypeColor = highlighting.GetNamedColor("ValueTypes");
- this.interfaceTypeColor = this.referenceTypeColor;
- this.enumerationTypeColor = this.valueKeywordColor;
- this.typeParameterTypeColor = this.referenceTypeColor;
- this.delegateTypeColor = this.referenceTypeColor;
+ this.interfaceTypeColor = highlighting.GetNamedColor("InterfaceTypes");
+ this.enumerationTypeColor = highlighting.GetNamedColor("EnumTypes");
+ this.typeParameterTypeColor = highlighting.GetNamedColor("TypeParameters");
+ this.delegateTypeColor = highlighting.GetNamedColor("DelegateType");
this.methodDeclarationColor = this.methodCallColor = highlighting.GetNamedColor("MethodCall");
//this.eventDeclarationColor = this.eventAccessColor = defaultTextColor;
//this.propertyDeclarationColor = this.propertyAccessColor = defaultTextColor;
diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionDataFactory.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionDataFactory.cs
index c3f005e892..9396dc084c 100644
--- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionDataFactory.cs
+++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionDataFactory.cs
@@ -86,8 +86,7 @@ namespace CSharpBinding.Completion
ICompletionData ICompletionDataFactory.CreateMemberCompletionData(IType type, IEntity member)
{
- string typeName = builder.ConvertType(type).ToString();
- return new CompletionData(typeName + "." + member.Name);
+ return new EnumMemberCompletionData(type, member, builder);
}
ICompletionData ICompletionDataFactory.CreateLiteralCompletionData(string title, string description, string insertText)
diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/EntityCompletionData.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/EntityCompletionData.cs
index 65ea84fc1b..16d627ef43 100644
--- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/EntityCompletionData.cs
+++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/EntityCompletionData.cs
@@ -37,14 +37,15 @@ namespace CSharpBinding.Completion
public EntityCompletionData(IEntity entity) : base(entity.Name)
{
this.entity = entity;
- this.Description = entity.Documentation;
this.Image = ClassBrowserIconService.GetIcon(entity);
+ // don't set this.Description -- we use CreateFancyDescription() instead,
+ // and accessing entity.Documentation in the constructor is too slow
}
protected override object CreateFancyDescription()
{
return new FlowDocumentScrollViewer {
- Document = XmlDocFormatter.CreateTooltip(entity, false),
+ Document = XmlDocFormatter.CreateTooltip(entity, entity is ITypeDefinition),
VerticalScrollBarVisibility = ScrollBarVisibility.Auto
};
}
diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/EnumMemberCompletionData.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/EnumMemberCompletionData.cs
new file mode 100644
index 0000000000..9d0b2c9d33
--- /dev/null
+++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/EnumMemberCompletionData.cs
@@ -0,0 +1,52 @@
+// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
+// software and associated documentation files (the "Software"), to deal in the Software
+// without restriction, including without limitation the rights to use, copy, modify, merge,
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
+// to whom the Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all copies or
+// substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Linq;
+using System.Windows.Controls;
+using ICSharpCode.NRefactory.CSharp.Refactoring;
+using ICSharpCode.NRefactory.TypeSystem;
+using ICSharpCode.SharpDevelop;
+using ICSharpCode.SharpDevelop.Editor;
+namespace CSharpBinding.Completion
+{
+ class EnumMemberCompletionData : CompletionData
+ {
+ IType enumType;
+
+ IEntity member;
+
+ public EnumMemberCompletionData(IType enumType, IEntity member, TypeSystemAstBuilder builder) : base(enumType.Name + "." + member.Name)
+ {
+ this.enumType = enumType;
+ this.member = member;
+ this.Image = ClassBrowserIconService.Const;
+ this.CompletionText = builder.ConvertType(enumType).ToString() + "." + member.Name;
+ }
+
+ protected override object CreateFancyDescription()
+ {
+ return new FlowDocumentScrollViewer {
+ Document = XmlDocFormatter.CreateTooltip(member, false),
+ VerticalScrollBarVisibility = ScrollBarVisibility.Auto
+ };
+ }
+ }
+}
+
+
diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/TypeCompletionData.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/TypeCompletionData.cs
index e2351811c4..a60836e910 100644
--- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/TypeCompletionData.cs
+++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/TypeCompletionData.cs
@@ -35,16 +35,15 @@ namespace CSharpBinding.Completion
public TypeCompletionData(IType type) : base(type.Name)
{
this.type = type;
- ITypeDefinition typeDef = type.GetDefinition();
- if (typeDef != null)
- this.Description = typeDef.Documentation;
this.Image = ClassBrowserIconService.GetIcon(type);
+ // don't set this.Description -- we use CreateFancyDescription() instead,
+ // and accessing entity.Documentation in the constructor is too slow
}
protected override object CreateFancyDescription()
{
return new FlowDocumentScrollViewer {
- Document = XmlDocFormatter.CreateTooltip(type, false),
+ Document = XmlDocFormatter.CreateTooltip(type),
VerticalScrollBarVisibility = ScrollBarVisibility.Auto
};
}
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeCompletionEditorAdapter.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeCompletionEditorAdapter.cs
index 4c21ee704e..16ef070ad6 100644
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeCompletionEditorAdapter.cs
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeCompletionEditorAdapter.cs
@@ -55,20 +55,30 @@ namespace ICSharpCode.AvalonEdit.AddIn
{
if (items == null)
return null;
- var insightWindow = new SharpDevelopInsightWindow(this.TextEditor.TextArea);
- insightWindow.Items.AddRange(items);
- if (insightWindow.Items.Count > 0) {
- insightWindow.SelectedItem = insightWindow.Items[0];
+ var insightWindow = textEditor.ActiveInsightWindow;
+ bool isNewWindow = false;
+ if (insightWindow == null) {
+ insightWindow = new SharpDevelopInsightWindow(this.TextEditor.TextArea);
+ isNewWindow = true;
+ }
+ var adapter = new SharpDevelopInsightWindowAdapter(insightWindow);
+ adapter.Items.AddRange(items);
+ if (adapter.Items.Count > 0) {
+ adapter.SelectedItem = adapter.Items[0];
} else {
// don't open insight window when there are no items
return null;
}
- textEditor.ShowInsightWindow(insightWindow);
- return insightWindow;
+ insightWindow.SetActiveAdapter(adapter, isNewWindow);
+ if (isNewWindow)
+ {
+ textEditor.ShowInsightWindow(insightWindow);
+ }
+ return adapter;
}
public override IInsightWindow ActiveInsightWindow {
- get { return textEditor.ActiveInsightWindow; }
+ get { return textEditor.ActiveInsightWindow.activeAdapter; }
}
public override ICompletionListWindow ActiveCompletionWindow {
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CustomizedHighlightingColor.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CustomizedHighlightingColor.cs
index a5df6f78c6..c113ed576c 100644
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CustomizedHighlightingColor.cs
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CustomizedHighlightingColor.cs
@@ -43,6 +43,7 @@ namespace ICSharpCode.AvalonEdit.AddIn
public bool Bold { get; set; }
public bool Italic { get; set; }
+ public bool Underline { get; set; }
public Color? Foreground { get; set; }
public Color? Background { get; set; }
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/CustomizedHighlightingItem.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/CustomizedHighlightingItem.cs
index ce076196b5..e18c5be58a 100644
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/CustomizedHighlightingItem.cs
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/CustomizedHighlightingItem.cs
@@ -66,6 +66,7 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
{
OnPropertyChanged("Bold");
OnPropertyChanged("Italic");
+ OnPropertyChanged("Underline");
OnPropertyChanged("Foreground");
OnPropertyChanged("UseDefaultForeground");
OnPropertyChanged("Background");
@@ -73,7 +74,7 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
OnPropertyChanged("IsCustomized");
}
- void SetCustomization(bool? bold = null, bool? italic = null,
+ void SetCustomization(bool? bold = null, bool? italic = null, bool? underline = null,
Color? foreground = null, bool? useDefaultForeground = null,
Color? background = null, bool? useDefaultBackground = null)
{
@@ -82,6 +83,7 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
newColor.Name = this.Name;
newColor.Bold = bold ?? this.Bold;
newColor.Italic = italic ?? this.Italic;
+ newColor.Underline = underline ?? this.Underline;
if (useDefaultBackground ?? this.UseDefaultBackground)
newColor.Background = null;
@@ -99,7 +101,7 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
else if (customization != null)
customizationList.Remove(customization);
- if (newColor.Bold == original.Bold && newColor.Italic == original.Italic &&
+ if (newColor.Bold == original.Bold && newColor.Italic == original.Italic && newColor.Underline == original.Underline &&
(newColor.Background == null) == original.UseDefaultBackground &&
(newColor.Background == null || newColor.Background == original.Background) &&
(newColor.Foreground == null) == original.UseDefaultForeground &&
@@ -140,6 +142,15 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
}
}
+ public bool Underline {
+ get {
+ return (customization != null) ? customization.Underline : original.Underline;
+ }
+ set {
+ SetCustomization(underline: value);
+ }
+ }
+
public Color Foreground {
get {
return (customization != null) ? (customization.Foreground ?? original.Foreground) : original.Foreground;
@@ -191,7 +202,7 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
public void Reset()
{
original.Reset();
- SetCustomization(original.Bold, original.Italic, original.Foreground, original.UseDefaultForeground, original.Background, original.UseDefaultBackground);
+ SetCustomization(original.Bold, original.Italic, original.Underline, original.Foreground, original.UseDefaultForeground, original.Background, original.UseDefaultBackground);
AllPropertiesChanged();
}
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml
index 93508d4370..b78fff3c35 100644
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml
@@ -44,6 +44,8 @@
Content="{core:Localize Dialog.HighlightingEditor.ColorDlg.Bold}"/>
+
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/IHighlightingItem.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/IHighlightingItem.cs
index 29d342a800..7852173772 100644
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/IHighlightingItem.cs
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/IHighlightingItem.cs
@@ -43,6 +43,11 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
///
bool Italic { get; set; }
+ ///
+ /// Gets/Sets whether the element uses an underlined font.
+ ///
+ bool Underline { get; set; }
+
Color Foreground { get; set; }
bool UseDefaultForeground { get; set; }
Color Background { get; set; }
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/NamedColorHighlightingItem.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/NamedColorHighlightingItem.cs
index c2e158f526..e5176fdc80 100644
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/NamedColorHighlightingItem.cs
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/NamedColorHighlightingItem.cs
@@ -68,6 +68,15 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
}
}
+ public bool Underline {
+ get {
+ return color.Underline == true;
+ }
+ set {
+ throw new NotSupportedException();
+ }
+ }
+
public Color Foreground {
get {
Color? c = color.Foreground != null ? color.Foreground.GetColor(null) : null;
@@ -161,7 +170,12 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
marker.ForegroundColor = item.Foreground;
marker.FontStyle = item.Italic ? FontStyles.Italic : FontStyles.Normal;
marker.FontWeight = item.Bold ? FontWeights.Bold : FontWeights.Normal;
- });
+ if(item.Underline)
+ {
+ marker.MarkerColor = item.Foreground;
+ marker.MarkerTypes = TextMarkerTypes.NormalUnderline;
+ }
+ });
}
} else {
exampleTextArea.Document.Text = exampleText;
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/SimpleHighlightingItem.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/SimpleHighlightingItem.cs
index 99376357d7..8c165207ec 100644
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/SimpleHighlightingItem.cs
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/SimpleHighlightingItem.cs
@@ -40,6 +40,7 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
public string Name { get; private set; }
public bool Bold { get; set; }
public bool Italic { get; set; }
+ public bool Underline { get; set; }
public Color Foreground { get; set; }
public bool UseDefaultForeground { get; set; }
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/SharpDevelopInsightWindow.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/SharpDevelopInsightWindow.cs
index e2a26ad1d5..0bed5d79f2 100644
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/SharpDevelopInsightWindow.cs
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/SharpDevelopInsightWindow.cs
@@ -22,6 +22,7 @@ using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
+using System.Windows.Threading;
using ICSharpCode.AvalonEdit.CodeCompletion;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Editing;
@@ -30,17 +31,94 @@ using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
namespace ICSharpCode.AvalonEdit.AddIn
{
+ class SharpDevelopInsightWindow : OverloadInsightWindow
+ {
+ public SharpDevelopInsightWindow(TextArea textArea) : base(textArea)
+ {
+ this.Style = ICSharpCode.Core.Presentation.GlobalStyles.WindowStyle;
+ AttachEvents();
+ }
+
+ internal SharpDevelopInsightWindowAdapter activeAdapter;
+
+ public void SetActiveAdapter(SharpDevelopInsightWindowAdapter adapter, bool isNewWindow)
+ {
+ if (activeAdapter != null) {
+ // tell the previous adapter that its window was closed,
+ // but actually reuse the window for the new adapter
+ activeAdapter.OnClosed();
+ }
+ activeAdapter = adapter;
+ this.Provider = adapter.Provider;
+ if (!isNewWindow) {
+ // reset insight window to initial state
+ CloseAutomatically = true;
+ StartOffset = EndOffset = this.TextArea.Caret.Offset;
+ Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new Action(SetPositionToStartOffset));
+ }
+ }
+
+ void SetPositionToStartOffset()
+ {
+ if (document != null && this.StartOffset != this.TextArea.Caret.Offset) {
+ SetPosition(new TextViewPosition(document.GetLocation(this.StartOffset)));
+ } else {
+ SetPosition(this.TextArea.Caret.Position);
+ }
+ }
+
+ TextDocument document;
+ Caret caret;
+
+ void AttachEvents()
+ {
+ document = this.TextArea.Document;
+ caret = this.TextArea.Caret;
+ if (document != null)
+ document.Changed += document_Changed;
+ if (caret != null)
+ caret.PositionChanged += caret_PositionChanged;
+ this.Closed += OnClosed;
+ }
+
+ ///
+ protected override void DetachEvents()
+ {
+ if (document != null)
+ document.Changed -= document_Changed;
+ if (caret != null)
+ caret.PositionChanged -= caret_PositionChanged;
+ this.Closed -= OnClosed;
+ base.DetachEvents();
+ }
+
+ void OnClosed(object sender, EventArgs e)
+ {
+ activeAdapter.OnClosed();
+ }
+
+ void caret_PositionChanged(object sender, EventArgs e)
+ {
+ activeAdapter.OnCaretPositionChanged(e);
+ }
+
+ void document_Changed(object sender, DocumentChangeEventArgs e)
+ {
+ activeAdapter.OnDocumentChanged(e);
+ }
+ }
+
///
/// Adapter between AvalonEdit InsightWindow and SharpDevelop IInsightWindow interface.
///
- public class SharpDevelopInsightWindow : OverloadInsightWindow, IInsightWindow
+ class SharpDevelopInsightWindowAdapter : IInsightWindow
{
sealed class SDItemProvider : IOverloadProvider
{
- readonly SharpDevelopInsightWindow insightWindow;
+ readonly SharpDevelopInsightWindowAdapter insightWindow;
int selectedIndex;
- public SDItemProvider(SharpDevelopInsightWindow insightWindow)
+ public SDItemProvider(SharpDevelopInsightWindowAdapter insightWindow)
{
this.insightWindow = insightWindow;
insightWindow.items.CollectionChanged += insightWindow_items_CollectionChanged;
@@ -103,16 +181,21 @@ namespace ICSharpCode.AvalonEdit.AddIn
}
readonly ObservableCollection items = new ObservableCollection();
+ SharpDevelopInsightWindow insightWindow;
+ readonly SDItemProvider provider;
- public SharpDevelopInsightWindow(TextArea textArea) : base(textArea)
+ internal IOverloadProvider Provider {
+ get { return provider; }
+ }
+
+ internal SharpDevelopInsightWindowAdapter(SharpDevelopInsightWindow insightWindow)
{
- this.Provider = new SDItemProvider(this);
- this.Provider.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) {
+ this.insightWindow = insightWindow;
+ provider = new SDItemProvider(this);
+ provider.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) {
if (e.PropertyName == "SelectedIndex")
OnSelectedItemChanged(EventArgs.Empty);
};
- this.Style = ICSharpCode.Core.Presentation.GlobalStyles.WindowStyle;
- AttachEvents();
}
public IList Items {
@@ -121,55 +204,28 @@ namespace ICSharpCode.AvalonEdit.AddIn
public IInsightItem SelectedItem {
get {
- int index = this.Provider.SelectedIndex;
+ int index = provider.SelectedIndex;
if (index < 0 || index >= items.Count)
return null;
else
return items[index];
}
set {
- this.Provider.SelectedIndex = items.IndexOf(value);
+ provider.SelectedIndex = items.IndexOf(value);
OnSelectedItemChanged(EventArgs.Empty);
}
}
- TextDocument document;
- Caret caret;
IInsightItem oldSelectedItem;
- void AttachEvents()
- {
- document = this.TextArea.Document;
- caret = this.TextArea.Caret;
- if (document != null)
- document.Changed += document_Changed;
- if (caret != null)
- caret.PositionChanged += caret_PositionChanged;
- }
+ public event EventHandler DocumentChanged;
- void caret_PositionChanged(object sender, EventArgs e)
- {
- OnCaretPositionChanged(e);
- }
-
- ///
- protected override void DetachEvents()
- {
- if (document != null)
- document.Changed -= document_Changed;
- if (caret != null)
- caret.PositionChanged -= caret_PositionChanged;
- base.DetachEvents();
- }
-
- void document_Changed(object sender, DocumentChangeEventArgs e)
+ internal void OnDocumentChanged(DocumentChangeEventArgs e)
{
if (DocumentChanged != null)
DocumentChanged(this, e);
}
- public event EventHandler DocumentChanged;
-
public event EventHandler SelectedItemChanged;
protected virtual void OnSelectedItemChanged(EventArgs e)
@@ -186,8 +242,6 @@ namespace ICSharpCode.AvalonEdit.AddIn
void SelectedItemPropertyChanged(object sender, PropertyChangedEventArgs e)
{
- var provider = Provider as SDItemProvider;
- if (provider == null) return;
switch (e.PropertyName) {
case "Header":
provider.OnPropertyChanged("CurrentHeader");
@@ -199,12 +253,77 @@ namespace ICSharpCode.AvalonEdit.AddIn
}
public event EventHandler CaretPositionChanged;
-
- protected virtual void OnCaretPositionChanged(EventArgs e)
+
+ internal void OnCaretPositionChanged(EventArgs e)
{
if (CaretPositionChanged != null) {
CaretPositionChanged(this, e);
}
}
+
+ public event EventHandler Closed;
+
+ internal void OnClosed()
+ {
+ if (Closed != null)
+ Closed(this, EventArgs.Empty);
+ insightWindow = null;
+ }
+
+ public void Close()
+ {
+ if (insightWindow != null)
+ insightWindow.Close();
+ }
+
+ public double Width {
+ get {
+ return insightWindow != null ? insightWindow.Width : 0;
+ }
+ set {
+ if (insightWindow != null)
+ insightWindow.Width = value;
+ }
+ }
+
+ public double Height {
+ get {
+ return insightWindow != null ? insightWindow.Height : 0;
+ }
+ set {
+ if (insightWindow != null)
+ insightWindow.Height = value;
+ }
+ }
+
+ public bool CloseAutomatically {
+ get {
+ return insightWindow != null && insightWindow.CloseAutomatically;
+ }
+ set {
+ if (insightWindow != null)
+ insightWindow.CloseAutomatically = value;
+ }
+ }
+
+ public int StartOffset {
+ get {
+ return insightWindow != null ? insightWindow.StartOffset : 0;
+ }
+ set {
+ if (insightWindow != null)
+ insightWindow.StartOffset = value;
+ }
+ }
+
+ public int EndOffset {
+ get {
+ return insightWindow != null ? insightWindow.EndOffset : 0;
+ }
+ set {
+ if (insightWindow != null)
+ insightWindow.EndOffset = value;
+ }
+ }
}
}
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/SharpDevelopTextEditor.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/SharpDevelopTextEditor.cs
index ead5adfe6c..07294e8ff6 100755
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/SharpDevelopTextEditor.cs
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/SharpDevelopTextEditor.cs
@@ -97,7 +97,7 @@ namespace ICSharpCode.AvalonEdit.AddIn
get { return completionWindow; }
}
- public SharpDevelopInsightWindow ActiveInsightWindow {
+ internal SharpDevelopInsightWindow ActiveInsightWindow {
get { return insightWindow; }
}
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/SyntaxHighlighting/CustomizingHighlighter.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/SyntaxHighlighting/CustomizingHighlighter.cs
index 0ababb9de6..8f70e0b457 100644
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/SyntaxHighlighting/CustomizingHighlighter.cs
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/SyntaxHighlighting/CustomizingHighlighter.cs
@@ -267,7 +267,8 @@ namespace ICSharpCode.AvalonEdit.AddIn
Background = CreateBrush(customization.Background),
Foreground = CreateBrush(customization.Foreground),
FontWeight = customization.Bold ? FontWeights.Bold : FontWeights.Normal,
- FontStyle = customization.Italic ? FontStyles.Italic : FontStyles.Normal
+ FontStyle = customization.Italic ? FontStyles.Italic : FontStyles.Normal,
+ Underline = customization.Underline
};
}
}
diff --git a/src/AddIns/DisplayBindings/HexEditor/Project/Src/View/HexEditOptionsPanel.xaml.cs b/src/AddIns/DisplayBindings/HexEditor/Project/Src/View/HexEditOptionsPanel.xaml.cs
index f1978f6747..8026d1672c 100644
--- a/src/AddIns/DisplayBindings/HexEditor/Project/Src/View/HexEditOptionsPanel.xaml.cs
+++ b/src/AddIns/DisplayBindings/HexEditor/Project/Src/View/HexEditOptionsPanel.xaml.cs
@@ -103,6 +103,8 @@ namespace HexEditor.View
preview.FontWeight = FontWeights.Bold;
else
preview.FontWeight = FontWeights.Normal;
+ if (font.Underline)
+ preview.TextDecorations = TextDecorations.Underline;
}
}
}
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionWindow.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionWindow.cs
index 3a81b86a0f..bf1c8ac678 100644
--- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionWindow.cs
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionWindow.cs
@@ -64,8 +64,6 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion
}
#region ToolTip handling
- public bool ShowDocumentationTooltips { get; set; }
-
void toolTip_Closed(object sender, RoutedEventArgs e)
{
// Clear content after tooltip is closed.
@@ -77,11 +75,6 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion
void completionList_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
- if (!ShowDocumentationTooltips) {
- toolTip.IsOpen = false;
- return;
- }
-
var item = completionList.SelectedItem;
if (item == null)
return;
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/OverloadInsightWindow.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/OverloadInsightWindow.cs
index ac192835b4..2ec182ce44 100644
--- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/OverloadInsightWindow.cs
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/OverloadInsightWindow.cs
@@ -52,7 +52,7 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion
protected override void OnKeyDown(KeyEventArgs e)
{
base.OnKeyDown(e);
- if (!e.Handled && this.Provider.Count > 1) {
+ if (!e.Handled && this.Provider != null && this.Provider.Count > 1) {
switch (e.Key) {
case Key.Up:
e.Handled = true;
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedInlineBuilder.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedInlineBuilder.cs
index e5f2e24bba..97ada1628a 100644
--- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedInlineBuilder.cs
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedInlineBuilder.cs
@@ -113,7 +113,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting
{
if (color == null)
throw new ArgumentNullException("color");
- if (color.Foreground == null && color.Background == null && color.FontStyle == null && color.FontWeight == null) {
+ if (color.Foreground == null && color.Background == null && color.FontStyle == null && color.FontWeight == null && color.Underline == null) {
// Optimization: don't split the HighlightingState when we're not changing
// any property. For example, the "Punctuation" color in C# is
// empty by default.
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingColor.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingColor.cs
index f8f13182a7..6dfb652d05 100644
--- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingColor.cs
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingColor.cs
@@ -38,6 +38,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting
string name;
FontWeight? fontWeight;
FontStyle? fontStyle;
+ bool? underline;
HighlightingBrush foreground;
HighlightingBrush background;
bool frozen;
@@ -84,6 +85,20 @@ namespace ICSharpCode.AvalonEdit.Highlighting
}
}
+ ///
+ /// Gets/sets the underline flag. Null if the underline status does not change the font style.
+ ///
+ public bool? Underline {
+ get {
+ return underline;
+ }
+ set {
+ if (frozen)
+ throw new InvalidOperationException();
+ underline = value;
+ }
+ }
+
///
/// Gets/sets the foreground color applied by the highlighting.
///
@@ -131,6 +146,8 @@ namespace ICSharpCode.AvalonEdit.Highlighting
this.FontWeight = System.Windows.FontWeight.FromOpenTypeWeight(info.GetInt32("Weight"));
if (info.GetBoolean("HasStyle"))
this.FontStyle = (FontStyle?)new FontStyleConverter().ConvertFromInvariantString(info.GetString("Style"));
+ if (info.GetBoolean("HasUnderline"))
+ this.Underline = info.GetBoolean("Underline");
this.Foreground = (HighlightingBrush)info.GetValue("Foreground", typeof(HighlightingBrush));
this.Background = (HighlightingBrush)info.GetValue("Background", typeof(HighlightingBrush));
}
@@ -154,6 +171,9 @@ namespace ICSharpCode.AvalonEdit.Highlighting
info.AddValue("HasStyle", this.FontStyle.HasValue);
if (this.FontStyle.HasValue)
info.AddValue("Style", this.FontStyle.Value.ToString());
+ info.AddValue("HasUnderline", this.Underline.HasValue);
+ if (this.Underline.HasValue)
+ info.AddValue("Underline", this.Underline.Value);
info.AddValue("Foreground", this.Foreground);
info.AddValue("Background", this.Background);
}
@@ -181,6 +201,12 @@ namespace ICSharpCode.AvalonEdit.Highlighting
b.Append(FontStyle.Value.ToString().ToLowerInvariant());
b.Append("; ");
}
+ if (Underline != null)
+ {
+ b.Append("text-decoration: ");
+ b.Append(Underline.Value ? "underline" : "none");
+ b.Append("; ");
+ }
return b.ToString();
}
@@ -232,7 +258,9 @@ namespace ICSharpCode.AvalonEdit.Highlighting
{
if (other == null)
return false;
- return this.name == other.name && this.fontWeight == other.fontWeight && this.fontStyle == other.fontStyle && object.Equals(this.foreground, other.foreground) && object.Equals(this.background, other.background);
+ return this.name == other.name && this.fontWeight == other.fontWeight
+ && this.fontStyle == other.fontStyle && this.underline == other.underline
+ && object.Equals(this.foreground, other.foreground) && object.Equals(this.background, other.background);
}
///
@@ -267,11 +295,14 @@ namespace ICSharpCode.AvalonEdit.Highlighting
this.foreground = color.foreground;
if (color.background != null)
this.background = color.background;
+ if (color.underline != null)
+ this.underline = color.underline;
}
internal bool IsEmptyForMerge {
get {
- return fontWeight == null && fontStyle == null && foreground == null && background == null;
+ return fontWeight == null && fontStyle == null && underline == null
+ && foreground == null && background == null;
}
}
}
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingColorizer.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingColorizer.cs
index 68a625745e..6867f87c24 100644
--- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingColorizer.cs
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingColorizer.cs
@@ -18,6 +18,7 @@
using System;
using System.Diagnostics;
+using System.Windows;
using System.Windows.Media;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Rendering;
@@ -231,7 +232,8 @@ namespace ICSharpCode.AvalonEdit.Highlighting
if (color == null)
return true;
return color.Background == null && color.Foreground == null
- && color.FontStyle == null && color.FontWeight == null;
+ && color.FontStyle == null && color.FontWeight == null
+ && color.Underline == null;
}
///
@@ -263,6 +265,8 @@ namespace ICSharpCode.AvalonEdit.Highlighting
tf.Stretch
));
}
+ if(color.Underline ?? false)
+ element.TextRunProperties.SetTextDecorations(TextDecorations.Underline);
}
///
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Resources/ModeV2.xsd b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Resources/ModeV2.xsd
index 047ef38a19..c2e242ac28 100644
--- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Resources/ModeV2.xsd
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Resources/ModeV2.xsd
@@ -35,6 +35,7 @@
+
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Xshd/V2Loader.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Xshd/V2Loader.cs
index 7a239d8196..b9b81d1dec 100644
--- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Xshd/V2Loader.cs
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Xshd/V2Loader.cs
@@ -297,6 +297,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting.Xshd
color.Background = ParseColor(position, reader.GetAttribute("background"));
color.FontWeight = ParseFontWeight(reader.GetAttribute("fontWeight"));
color.FontStyle = ParseFontStyle(reader.GetAttribute("fontStyle"));
+ color.Underline = reader.GetBoolAttribute("underline");
return color;
}
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Xshd/XmlHighlightingDefinition.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Xshd/XmlHighlightingDefinition.cs
index 62128c81fa..9743277ba8 100644
--- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Xshd/XmlHighlightingDefinition.cs
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Xshd/XmlHighlightingDefinition.cs
@@ -204,6 +204,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting.Xshd
c.Name = color.Name;
c.Foreground = color.Foreground;
c.Background = color.Background;
+ c.Underline = color.Underline;
c.FontStyle = color.FontStyle;
c.FontWeight = color.FontWeight;
return c;
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Xshd/XshdColor.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Xshd/XshdColor.cs
index 3812a57e71..a6968508b8 100644
--- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Xshd/XshdColor.cs
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Xshd/XshdColor.cs
@@ -49,6 +49,11 @@ namespace ICSharpCode.AvalonEdit.Highlighting.Xshd
///
public FontWeight? FontWeight { get; set; }
+ ///
+ /// Gets/sets the underline flag
+ ///
+ public bool? Underline { get; set; }
+
///
/// Gets/sets the font style.
///
@@ -81,6 +86,8 @@ namespace ICSharpCode.AvalonEdit.Highlighting.Xshd
if (info.GetBoolean("HasStyle"))
this.FontStyle = (FontStyle?)new FontStyleConverter().ConvertFromInvariantString(info.GetString("Style"));
this.ExampleText = info.GetString("ExampleText");
+ if (info.GetBoolean("HasUnderline"))
+ this.Underline = info.GetBoolean("Underline");
}
///
@@ -98,6 +105,9 @@ namespace ICSharpCode.AvalonEdit.Highlighting.Xshd
info.AddValue("Name", this.Name);
info.AddValue("Foreground", this.Foreground);
info.AddValue("Background", this.Background);
+ info.AddValue("HasUnderline", this.Underline.HasValue);
+ if (this.Underline.HasValue)
+ info.AddValue("Underline", this.Underline.Value);
info.AddValue("HasWeight", this.FontWeight.HasValue);
if (this.FontWeight.HasValue)
info.AddValue("Weight", this.FontWeight.Value.ToOpenTypeWeight());
diff --git a/src/Main/Base/Project/Src/Services/ParserService/CodeCompletionOptions.cs b/src/Main/Base/Project/Src/Services/ParserService/CodeCompletionOptions.cs
index 730bb2ac95..61c81972e7 100644
--- a/src/Main/Base/Project/Src/Services/ParserService/CodeCompletionOptions.cs
+++ b/src/Main/Base/Project/Src/Services/ParserService/CodeCompletionOptions.cs
@@ -84,7 +84,7 @@ namespace ICSharpCode.SharpDevelop
}
public static string CompletionCharList {
- get { return properties.Get("CompletionCharList", @"{}[]().,:;+-*/%&|^!~=<>?@#'""\"); }
+ get { return properties.Get("CompletionCharList", @" {}[]().,:;+-*/%&|^!~=<>?@#'""\"); }
set { properties.Set("CompletionCharList", value); }
}