Browse Source

Fix variable highlighting

pull/2334/head
tom-englert 4 years ago
parent
commit
7177a9afd2
  1. 4
      ILSpy/Controls/ResourceObjectTable.xaml
  2. 1
      ILSpy/ILSpy.csproj
  3. 11
      ILSpy/TextView/DecompilerTextView.cs
  4. 6
      ILSpy/themes/DarkTheme.xaml
  5. 10
      ILSpy/themes/ResourceKeys.cs
  6. 5
      ILSpy/themes/generic.xaml
  7. 4
      SharpTreeView/SharpTreeView.cs

4
ILSpy/Controls/ResourceObjectTable.xaml

@ -13,8 +13,8 @@ @@ -13,8 +13,8 @@
<Grid Margin="5,0,0,0">
<Grid.Resources>
<AlternationConverter x:Key="BackgroundConverter">
<SolidColorBrush Color="White"></SolidColorBrush>
<SolidColorBrush Color="Beige"></SolidColorBrush>
<SolidColorBrush Color="Transparent" />
<SolidColorBrush Color="#CCCC33" Opacity="0.15" />
</AlternationConverter>
<Style x:Key="alternatingWithBinding"
TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource {x:Type ListBoxItem}}">

1
ILSpy/ILSpy.csproj

@ -218,6 +218,7 @@ @@ -218,6 +218,7 @@
<Compile Include="Metadata\MetadataTableTreeNode.cs" />
<Compile Include="Metadata\DebugMetadataTreeNode.cs" />
<Compile Include="ThemeManager.cs" />
<Compile Include="themes\ResourceKeys.cs" />
<Compile Include="TreeNodes\PackageFolderTreeNode.cs" />
<Compile Include="ViewModels\LegacyToolPaneModel.cs" />
<Compile Include="ViewModels\ManageAssemblyListsViewModel.cs" />

11
ILSpy/TextView/DecompilerTextView.cs

@ -54,6 +54,7 @@ using ICSharpCode.Decompiler.Output; @@ -54,6 +54,7 @@ using ICSharpCode.Decompiler.Output;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.ILSpy.AvalonEdit;
using ICSharpCode.ILSpy.Options;
using ICSharpCode.ILSpy.themes;
using ICSharpCode.ILSpy.TreeNodes;
using ICSharpCode.ILSpy.ViewModels;
@ -460,14 +461,15 @@ namespace ICSharpCode.ILSpy.TextView @@ -460,14 +461,15 @@ namespace ICSharpCode.ILSpy.TextView
};
viewer.Document = document;
Border border = new Border {
Background = SystemColors.ControlBrush,
BorderBrush = SystemColors.ControlDarkBrush,
BorderThickness = new Thickness(1),
MaxHeight = 400,
Child = viewer
};
border.SetResourceReference(Border.BackgroundProperty, SystemColors.ControlBrushKey);
border.SetResourceReference(Border.BorderBrushProperty, SystemColors.ControlDarkBrushKey);
this.Child = border;
viewer.Foreground = SystemColors.InfoTextBrush;
viewer.SetResourceReference(ForegroundProperty, SystemColors.InfoTextBrushKey);
document.TextAlignment = TextAlignment.Left;
document.FontSize = fontSize;
document.FontFamily = SystemFonts.SmallCaptionFontFamily;
@ -926,8 +928,9 @@ namespace ICSharpCode.ILSpy.TextView @@ -926,8 +928,9 @@ namespace ICSharpCode.ILSpy.TextView
{
if (reference.Equals(r.Reference))
{
var mark = textMarkerService.Create(r.StartOffset, r.Length);
mark.BackgroundColor = r.IsDefinition ? Colors.LightSeaGreen : Colors.GreenYellow;
mark.BackgroundColor = (Color)(r.IsDefinition ? FindResource(ResourceKeys.TextMarkerDefinitionBackgroundColor) : FindResource(ResourceKeys.TextMarkerBackgroundColor));
localReferenceMarks.Add(mark);
}
}

6
ILSpy/themes/DarkTheme.xaml

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:styles="urn:TomsToolbox.Wpf.Styles">
xmlns:styles="urn:TomsToolbox.Wpf.Styles"
xmlns:themes="clr-namespace:ICSharpCode.ILSpy.themes">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/AvalonDock.Themes.VS2013;component/darktheme.xaml" />
</ResourceDictionary.MergedDictionaries>
@ -28,4 +29,7 @@ @@ -28,4 +29,7 @@
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveCaptionTextBrushKey}" Color="#F1F1F1" />
<SolidColorBrush x:Key="{x:Static styles:ResourceKeys.BorderBrush}" Color="#3F3F46" />
<SolidColorBrush x:Key="{x:Static styles:ResourceKeys.DisabledBrush}" Color="#2D2D30" />
<Color x:Key="{x:Static themes:ResourceKeys.TextMarkerBackgroundColor}">MediumVioletRed</Color>
</ResourceDictionary>

10
ILSpy/themes/ResourceKeys.cs

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
using System.Windows;
namespace ICSharpCode.ILSpy.themes
{
public static class ResourceKeys
{
public static ResourceKey TextMarkerBackgroundColor = new ComponentResourceKey(typeof(ResourceKeys), "TextMarkerBackgroundColor");
public static ResourceKey TextMarkerDefinitionBackgroundColor = new ComponentResourceKey(typeof(ResourceKeys), "TextMarkerDefinitionBackgroundColor");
}
}

5
ILSpy/themes/generic.xaml

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:ICSharpCode.ILSpy.Controls"
>
xmlns:themes="clr-namespace:ICSharpCode.ILSpy.themes">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../Controls/SearchBoxStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
@ -26,4 +26,7 @@ @@ -26,4 +26,7 @@
Data = "M 5,5 L 10,10 L 15,5 L 5,5"/>
</StackPanel>
</DataTemplate>
<Color x:Key="{x:Static themes:ResourceKeys.TextMarkerBackgroundColor}">GreenYellow</Color>
<Color x:Key="{x:Static themes:ResourceKeys.TextMarkerDefinitionBackgroundColor}">LightSeaGreen</Color>
</ResourceDictionary>

4
SharpTreeView/SharpTreeView.cs

@ -669,8 +669,8 @@ namespace ICSharpCode.TreeView @@ -669,8 +669,8 @@ namespace ICSharpCode.TreeView
if (place == DropPlace.Inside)
{
previewNodeView.TextBackground = SystemColors.HighlightBrush;
previewNodeView.Foreground = SystemColors.HighlightTextBrush;
previewNodeView.SetResourceReference(SharpTreeNodeView.TextBackgroundProperty, SystemColors.HighlightBrushKey);
previewNodeView.SetResourceReference(SharpTreeNodeView.ForegroundProperty, SystemColors.HighlightTextBrushKey);
}
else
{

Loading…
Cancel
Save