Browse Source

Update to AvalonEdit commit a4f053c2d.

pull/603/head
Daniel Grunwald 11 years ago
parent
commit
013a3425df
  1. 4
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/SharpDevelopCompletionWindow.cs
  2. 6
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/ICSharpCode.AvalonEdit.Tests.csproj
  3. 21
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionList.cs
  4. 2
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingColorizer.cs
  5. 6
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj
  6. 25
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs
  7. 3
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/VisualLineLinkText.cs

4
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/SharpDevelopCompletionWindow.cs

@ -45,7 +45,9 @@ namespace ICSharpCode.AvalonEdit.AddIn
} }
set { set {
var itemAdapters = this.CompletionList.CompletionData.Cast<CodeCompletionDataAdapter>(); var itemAdapters = this.CompletionList.CompletionData.Cast<CodeCompletionDataAdapter>();
this.CompletionList.SelectedItem = itemAdapters.FirstOrDefault(a => a.Item == value); var item = itemAdapters.FirstOrDefault(a => a.Item == value);
this.CompletionList.SelectedItem = item;
this.CompletionList.ScrollIntoView(item);
} }
} }

6
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/ICSharpCode.AvalonEdit.Tests.csproj

@ -46,8 +46,8 @@
<Optimize>False</Optimize> <Optimize>False</Optimize>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath> <BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
<DefineDebug /> <DefineDebug>True</DefineDebug>
<DefineTrace /> <DefineTrace>True</DefineTrace>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugSymbols>false</DebugSymbols> <DebugSymbols>false</DebugSymbols>
@ -55,7 +55,7 @@
<Optimize>True</Optimize> <Optimize>True</Optimize>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath> <BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
<DefineTrace /> <DefineTrace>True</DefineTrace>
</PropertyGroup> </PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup> <ItemGroup>

21
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionList.cs

@ -192,6 +192,10 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion
/// <summary> /// <summary>
/// Gets/Sets the selected item. /// Gets/Sets the selected item.
/// </summary> /// </summary>
/// <remarks>
/// The setter of this property does not scroll to the selected item.
/// You might want to also call <see cref="ScrollIntoView"/>.
/// </remarks>
public ICompletionData SelectedItem { public ICompletionData SelectedItem {
get { get {
return (listBox != null ? listBox.SelectedItem : null) as ICompletionData; return (listBox != null ? listBox.SelectedItem : null) as ICompletionData;
@ -199,11 +203,22 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion
set { set {
if (listBox == null && value != null) if (listBox == null && value != null)
ApplyTemplate(); ApplyTemplate();
listBox.SelectedItem = value; if (listBox != null) // may still be null if ApplyTemplate fails, or if listBox and value both are null
listBox.ScrollIntoView(value); listBox.SelectedItem = value;
} }
} }
/// <summary>
/// Scrolls the specified item into view.
/// </summary>
public void ScrollIntoView(ICompletionData item)
{
if (listBox == null)
ApplyTemplate();
if (listBox != null)
listBox.ScrollIntoView(item);
}
/// <summary> /// <summary>
/// Occurs when the SelectedItem property changes. /// Occurs when the SelectedItem property changes.
/// </summary> /// </summary>
@ -370,7 +385,7 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion
if (itemText.IndexOf(query, StringComparison.InvariantCultureIgnoreCase) >= 0) if (itemText.IndexOf(query, StringComparison.InvariantCultureIgnoreCase) >= 0)
return 2; return 2;
} }
if (!camelCaseMatch.HasValue) if (!camelCaseMatch.HasValue)
camelCaseMatch = CamelCaseMatch(itemText, query); camelCaseMatch = CamelCaseMatch(itemText, query);
if (camelCaseMatch == true) if (camelCaseMatch == true)

2
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingColorizer.cs

@ -266,7 +266,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting
)); ));
} }
if(color.Underline ?? false) if(color.Underline ?? false)
element.TextRunProperties.SetTextDecorations(TextDecorations.Underline); element.TextRunProperties.SetTextDecorations(TextDecorations.Underline);
} }
/// <summary> /// <summary>

6
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj

@ -49,8 +49,8 @@
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath> <BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
<DebugType>Full</DebugType> <DebugType>Full</DebugType>
<DefineDebug/> <DefineDebug>True</DefineDebug>
<DefineTrace/> <DefineTrace>True</DefineTrace>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>
@ -59,7 +59,7 @@
<Optimize>True</Optimize> <Optimize>True</Optimize>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<DebugType>Full</DebugType> <DebugType>Full</DebugType>
<DefineTrace/> <DefineTrace>True</DefineTrace>
</PropertyGroup> </PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup> <ItemGroup>

25
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs

@ -596,7 +596,27 @@ namespace ICSharpCode.AvalonEdit.Rendering
set { SetValue(LinkTextBackgroundBrushProperty, value); } set { SetValue(LinkTextBackgroundBrushProperty, value); }
} }
#endregion #endregion
/// <summary>
/// LinkTextUnderlinedBrush dependency property.
/// </summary>
public static readonly DependencyProperty LinkTextUnderlineProperty =
DependencyProperty.Register("LinkTextUnderline", typeof(bool), typeof(TextView),
new FrameworkPropertyMetadata(true));
/// <summary>
/// Gets/sets whether to underline link texts.
/// </summary>
/// <remarks>
/// Note that when setting this property to false, link text remains clickable and the LinkTextForegroundBrush (if any) is still applied.
/// Set TextEditorOptions.EnableHyperlinks and EnableEmailHyperlinks to false to disable links completely.
/// </remarks>
public bool LinkTextUnderline
{
get { return (bool)GetValue(LinkTextUnderlineProperty); }
set { SetValue(LinkTextUnderlineProperty, value); }
}
#region Redraw methods / VisualLine invalidation #region Redraw methods / VisualLine invalidation
/// <summary> /// <summary>
/// Causes the text editor to regenerate all visual lines. /// Causes the text editor to regenerate all visual lines.
@ -1989,7 +2009,8 @@ namespace ICSharpCode.AvalonEdit.Rendering
} else if (e.Property == Control.ForegroundProperty } else if (e.Property == Control.ForegroundProperty
|| e.Property == TextView.NonPrintableCharacterBrushProperty || e.Property == TextView.NonPrintableCharacterBrushProperty
|| e.Property == TextView.LinkTextBackgroundBrushProperty || e.Property == TextView.LinkTextBackgroundBrushProperty
|| e.Property == TextView.LinkTextForegroundBrushProperty) || e.Property == TextView.LinkTextForegroundBrushProperty
|| e.Property == TextView.LinkTextUnderlineProperty)
{ {
// changing brushes requires recreating the cached elements // changing brushes requires recreating the cached elements
RecreateCachedElements(); RecreateCachedElements();

3
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/VisualLineLinkText.cs

@ -64,7 +64,8 @@ namespace ICSharpCode.AvalonEdit.Rendering
{ {
this.TextRunProperties.SetForegroundBrush(context.TextView.LinkTextForegroundBrush); this.TextRunProperties.SetForegroundBrush(context.TextView.LinkTextForegroundBrush);
this.TextRunProperties.SetBackgroundBrush(context.TextView.LinkTextBackgroundBrush); this.TextRunProperties.SetBackgroundBrush(context.TextView.LinkTextBackgroundBrush);
this.TextRunProperties.SetTextDecorations(TextDecorations.Underline); if (context.TextView.LinkTextUnderline)
this.TextRunProperties.SetTextDecorations(TextDecorations.Underline);
return base.CreateTextRun(startVisualColumn, context); return base.CreateTextRun(startVisualColumn, context);
} }

Loading…
Cancel
Save