
9 changed files with 375 additions and 52 deletions
-
83ILSpy/AnalyzerTreeView.cs
-
4ILSpy/ContextMenuEntry.cs
-
117ILSpy/Controls/DockedPane.cs
-
4ILSpy/ILSpy.csproj
-
30ILSpy/MainWindow.xaml
-
78ILSpy/MainWindow.xaml.cs
-
11ILSpy/SessionSettings.cs
-
10ILSpy/TreeNodes/Analyzer/AnalyzeContextMenuEntry.cs
-
90ILSpy/themes/generic.xaml
@ -0,0 +1,83 @@ |
|||
// Copyright (c) 2011 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.Collections.Generic; |
|||
using System.Text; |
|||
using System.Windows; |
|||
using System.Windows.Controls; |
|||
using System.Windows.Data; |
|||
using System.Windows.Documents; |
|||
using System.Windows.Input; |
|||
using System.Windows.Media; |
|||
|
|||
using ICSharpCode.ILSpy.TreeNodes.Analyzer; |
|||
using ICSharpCode.TreeView; |
|||
|
|||
namespace ICSharpCode.ILSpy |
|||
{ |
|||
/// <summary>
|
|||
/// Analyzer tree view.
|
|||
/// </summary>
|
|||
public partial class AnalyzerTreeView : SharpTreeView |
|||
{ |
|||
static AnalyzerTreeView instance; |
|||
|
|||
public static AnalyzerTreeView Instance { |
|||
get { |
|||
if (instance == null) { |
|||
App.Current.VerifyAccess(); |
|||
instance = new AnalyzerTreeView(); |
|||
} |
|||
return instance; |
|||
} |
|||
} |
|||
|
|||
private AnalyzerTreeView() |
|||
{ |
|||
this.ShowRoot = false; |
|||
this.Root = new AnalyzerTreeNode { Language = MainWindow.Instance.CurrentLanguage }; |
|||
ContextMenuProvider.Add(this); |
|||
} |
|||
|
|||
public void Show() |
|||
{ |
|||
if (!IsVisible) |
|||
MainWindow.Instance.ShowInBottomPane("Analyzer", this); |
|||
} |
|||
|
|||
public void Show(AnalyzerTreeNode node) |
|||
{ |
|||
Show(); |
|||
|
|||
node.IsExpanded = true; |
|||
this.Root.Children.Add(node); |
|||
this.SelectedItem = node; |
|||
this.FocusNode(node); |
|||
} |
|||
} |
|||
|
|||
[ExportMainMenuCommand(Menu = "_View", Header = "_Analyzer", MenuCategory = "ShowPane", MenuOrder = 100)] |
|||
sealed class ShowAnalyzerCommand : SimpleCommand |
|||
{ |
|||
public override void Execute(object parameter) |
|||
{ |
|||
AnalyzerTreeView.Instance.Show(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,117 @@ |
|||
// Copyright (c) 2011 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.Windows; |
|||
using System.Windows.Controls; |
|||
using System.Windows.Input; |
|||
using System.Windows.Markup; |
|||
using System.Windows.Media; |
|||
|
|||
namespace ICSharpCode.ILSpy.Controls |
|||
{ |
|||
class DockedPane : Control |
|||
{ |
|||
static DockedPane() |
|||
{ |
|||
DefaultStyleKeyProperty.OverrideMetadata(typeof(DockedPane), new FrameworkPropertyMetadata(typeof(DockedPane))); |
|||
} |
|||
|
|||
public static readonly DependencyProperty TitleProperty = |
|||
DependencyProperty.Register("Title", typeof(string), typeof(DockedPane)); |
|||
|
|||
public string Title { |
|||
get { return (string)GetValue(TitleProperty); } |
|||
set { SetValue(TitleProperty, value); } |
|||
} |
|||
|
|||
public static readonly DependencyProperty ContentProperty = |
|||
DependencyProperty.Register("Content", typeof(object), typeof(DockedPane)); |
|||
|
|||
public object Content { |
|||
get { return GetValue(ContentProperty); } |
|||
set { SetValue(ContentProperty, value); } |
|||
} |
|||
|
|||
public override void OnApplyTemplate() |
|||
{ |
|||
base.OnApplyTemplate(); |
|||
Button closeButton = (Button)this.Template.FindName("PART_Close", this); |
|||
if (closeButton != null) { |
|||
closeButton.Click += closeButton_Click; |
|||
} |
|||
} |
|||
|
|||
void closeButton_Click(object sender, RoutedEventArgs e) |
|||
{ |
|||
if (CloseButtonClicked != null) |
|||
CloseButtonClicked(this, e); |
|||
} |
|||
|
|||
public event EventHandler CloseButtonClicked; |
|||
|
|||
protected override void OnKeyDown(System.Windows.Input.KeyEventArgs e) |
|||
{ |
|||
base.OnKeyDown(e); |
|||
if (!e.Handled && e.Key == Key.F4 && e.KeyboardDevice.Modifiers == ModifierKeys.Control) { |
|||
if (CloseButtonClicked != null) |
|||
CloseButtonClicked(this, e); |
|||
e.Handled = true; |
|||
} |
|||
} |
|||
} |
|||
|
|||
[MarkupExtensionReturnType(typeof(Color))] |
|||
class ControlColor : MarkupExtension |
|||
{ |
|||
float val; |
|||
|
|||
/// <summary>
|
|||
/// Amount of highlight (0..1)
|
|||
/// </summary>
|
|||
public float Highlight { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// val: Color value in the range 105..255.
|
|||
/// </summary>
|
|||
public ControlColor(float val) |
|||
{ |
|||
if (!(val >= 105 && val <= 255)) |
|||
throw new ArgumentOutOfRangeException("val"); |
|||
this.val = val; |
|||
} |
|||
|
|||
public override object ProvideValue(IServiceProvider serviceProvider) |
|||
{ |
|||
if (val > 227) { |
|||
return Interpolate(227, SystemColors.ControlLightColor, 255, SystemColors.ControlLightLightColor); |
|||
} else if (val > 160) { |
|||
return Interpolate(160, SystemColors.ControlDarkColor, 227, SystemColors.ControlLightColor); |
|||
} else { |
|||
return Interpolate(105, SystemColors.ControlDarkDarkColor, 160, SystemColors.ControlDarkColor); |
|||
} |
|||
} |
|||
|
|||
Color Interpolate(float v1, Color c1, float v2, Color c2) |
|||
{ |
|||
float v = (val - v1) / (v2 - v1); |
|||
Color c = c1 * (1 - v) + c2 * v; |
|||
return c * (1 - Highlight) + SystemColors.HighlightColor * Highlight; |
|||
} |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue