Browse Source

Remove Viewbox special cases.

pull/1725/head
Siegfried Pammer 7 years ago
parent
commit
9c0200a296
  1. 2
      ILSpy/Analyzers/RemoveAnalyzeContextMenuEntry.cs
  2. 2
      ILSpy/Commands/DecompileInNewViewCommand.cs
  3. 14
      ILSpy/ContextMenuEntry.cs
  4. 28
      ILSpy/MainWindow.xaml.cs

2
ILSpy/Analyzers/RemoveAnalyzeContextMenuEntry.cs

@ -20,7 +20,7 @@ using System.Linq;
namespace ICSharpCode.ILSpy.Analyzers namespace ICSharpCode.ILSpy.Analyzers
{ {
[ExportContextMenuEntry(Header = "Remove", Icon = "images/Delete.png", Category = "Analyze", Order = 200)] [ExportContextMenuEntry(Header = "Remove", Icon = "images/Delete", Category = "Analyze", Order = 200)]
internal sealed class RemoveAnalyzeContextMenuEntry : IContextMenuEntry internal sealed class RemoveAnalyzeContextMenuEntry : IContextMenuEntry
{ {
public bool IsVisible(TextViewContext context) public bool IsVisible(TextViewContext context)

2
ILSpy/Commands/DecompileInNewViewCommand.cs

@ -23,7 +23,7 @@ using ICSharpCode.ILSpy.TreeNodes;
namespace ICSharpCode.ILSpy.Analyzers namespace ICSharpCode.ILSpy.Analyzers
{ {
[ExportContextMenuEntry(Header = nameof(Resources.DecompileToNewPanel), Icon = "images/Search.png", Category = nameof(Resources.Analyze), Order = 90)] [ExportContextMenuEntry(Header = nameof(Resources.DecompileToNewPanel), Icon = "images/Search", Category = nameof(Resources.Analyze), Order = 90)]
internal sealed class DecompileInNewViewCommand : IContextMenuEntry internal sealed class DecompileInNewViewCommand : IContextMenuEntry
{ {
public bool IsVisible(TextViewContext context) public bool IsVisible(TextViewContext context)

14
ILSpy/ContextMenuEntry.cs

@ -222,15 +222,11 @@ namespace ICSharpCode.ILSpy
menuItem.Header = MainWindow.GetResourceString( entryPair.Metadata.Header); menuItem.Header = MainWindow.GetResourceString( entryPair.Metadata.Header);
menuItem.InputGestureText = entryPair.Metadata.InputGestureText; menuItem.InputGestureText = entryPair.Metadata.InputGestureText;
if (!string.IsNullOrEmpty(entryPair.Metadata.Icon)) { if (!string.IsNullOrEmpty(entryPair.Metadata.Icon)) {
object image = Images.Load(entryPair.Value, entryPair.Metadata.Icon); menuItem.Icon = new Image {
if (!(image is Viewbox)) { Width = 16,
image = new Image { Height = 16,
Width = 16, Source = Images.Load(entryPair.Value, entryPair.Metadata.Icon)
Height = 16, };
Source = (ImageSource)image
};
}
menuItem.Icon = image;
} }
if (entryPair.Value.IsEnabled(context)) { if (entryPair.Value.IsEnabled(context)) {
menuItem.Click += delegate { entry.Execute(context); }; menuItem.Click += delegate { entry.Execute(context); };

28
ILSpy/MainWindow.xaml.cs

@ -142,19 +142,15 @@ namespace ICSharpCode.ILSpy
Button MakeToolbarItem(Lazy<ICommand, IToolbarCommandMetadata> command) Button MakeToolbarItem(Lazy<ICommand, IToolbarCommandMetadata> command)
{ {
object image = Images.Load(command.Value, command.Metadata.ToolbarIcon);
if (!(image is Viewbox)) {
image = new Image {
Width = 16,
Height = 16,
Source = (ImageSource)image
};
}
return new Button { return new Button {
Command = CommandWrapper.Unwrap(command.Value), Command = CommandWrapper.Unwrap(command.Value),
ToolTip = Properties.Resources.ResourceManager.GetString(command.Metadata.ToolTip), ToolTip = Properties.Resources.ResourceManager.GetString(command.Metadata.ToolTip),
Tag = command.Metadata.Tag, Tag = command.Metadata.Tag,
Content = image Content = new Image {
Width = 16,
Height = 16,
Source = Images.Load(command.Value, command.Metadata.ToolbarIcon)
}
}; };
} }
#endregion #endregion
@ -180,15 +176,11 @@ namespace ICSharpCode.ILSpy
if (!string.IsNullOrEmpty(GetResourceString(entry.Metadata.Header))) if (!string.IsNullOrEmpty(GetResourceString(entry.Metadata.Header)))
menuItem.Header = GetResourceString(entry.Metadata.Header); menuItem.Header = GetResourceString(entry.Metadata.Header);
if (!string.IsNullOrEmpty(entry.Metadata.MenuIcon)) { if (!string.IsNullOrEmpty(entry.Metadata.MenuIcon)) {
object image = Images.Load(entry.Value, entry.Metadata.MenuIcon); menuItem.Icon = new Image {
if (!(image is Viewbox)) { Width = 16,
image = new Image { Height = 16,
Width = 16, Source = Images.Load(entry.Value, entry.Metadata.MenuIcon)
Height = 16, };
Source = (ImageSource)image
};
}
menuItem.Icon = image;
} }
menuItem.IsEnabled = entry.Metadata.IsEnabled; menuItem.IsEnabled = entry.Metadata.IsEnabled;

Loading…
Cancel
Save