mirror of https://github.com/icsharpcode/ILSpy.git
15 changed files with 197 additions and 388 deletions
@ -0,0 +1,52 @@
@@ -0,0 +1,52 @@
|
||||
// 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.Linq; |
||||
using ICSharpCode.ILSpy.Properties; |
||||
using ICSharpCode.ILSpy.TextView; |
||||
using ICSharpCode.ILSpy.TreeNodes; |
||||
|
||||
namespace ICSharpCode.ILSpy.Commands |
||||
{ |
||||
// [ExportContextMenuEntry(Header = nameof(Resources.DecompileToNewPanel), Icon = "images/Search", Category = nameof(Resources.Analyze), Order = 90)]
|
||||
internal sealed class DecompileInNewViewCommand : IContextMenuEntry |
||||
{ |
||||
public bool IsVisible(TextViewContext context) |
||||
{ |
||||
if (context.SelectedTreeNodes == null) |
||||
return false; |
||||
return true; |
||||
} |
||||
|
||||
public bool IsEnabled(TextViewContext context) |
||||
{ |
||||
if (context.SelectedTreeNodes == null) |
||||
return false; |
||||
return true; |
||||
} |
||||
|
||||
public async void Execute(TextViewContext context) |
||||
{ |
||||
var dtv = new DecompilerTextView(); |
||||
var nodes = context.SelectedTreeNodes.Cast<ILSpyTreeNode>().ToArray(); |
||||
var title = string.Join(", ", nodes.Select(x => x.ToString())); |
||||
MainWindow.Instance.ShowInNewPane(title, dtv, PanePosition.Document); |
||||
await dtv.DecompileAsync(MainWindow.Instance.CurrentLanguage, nodes, new DecompilationOptions()); |
||||
} |
||||
} |
||||
} |
@ -1,76 +0,0 @@
@@ -1,76 +0,0 @@
|
||||
// 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; |
||||
|
||||
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(KeyEventArgs e) |
||||
{ |
||||
base.OnKeyDown(e); |
||||
if (e.Key == Key.F4 && e.KeyboardDevice.Modifiers == ModifierKeys.Control || e.Key == Key.Escape) { |
||||
if (CloseButtonClicked != null) |
||||
CloseButtonClicked(this, e); |
||||
e.Handled = true; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,32 @@
@@ -0,0 +1,32 @@
|
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using Xceed.Wpf.AvalonDock.Layout; |
||||
|
||||
namespace ICSharpCode.ILSpy.Docking |
||||
{ |
||||
public static class DockingHelper |
||||
{ |
||||
public static void DockHorizontal(LayoutContent layoutContent, ILayoutElement paneRelativeTo, GridLength dockHeight, bool dockBefore = false) |
||||
{ |
||||
if (paneRelativeTo is ILayoutDocumentPane parentDocumentPane) { |
||||
var parentDocumentGroup = paneRelativeTo.FindParent<LayoutDocumentPaneGroup>(); |
||||
if (parentDocumentGroup == null) { |
||||
var grandParent = parentDocumentPane.Parent as ILayoutContainer; |
||||
parentDocumentGroup = new LayoutDocumentPaneGroup() { Orientation = System.Windows.Controls.Orientation.Vertical }; |
||||
grandParent.ReplaceChild(paneRelativeTo, parentDocumentGroup); |
||||
parentDocumentGroup.Children.Add(parentDocumentPane); |
||||
} |
||||
parentDocumentGroup.Orientation = System.Windows.Controls.Orientation.Vertical; |
||||
int indexOfParentPane = parentDocumentGroup.IndexOfChild(parentDocumentPane); |
||||
var layoutDocumentPane = new LayoutDocumentPane(layoutContent) { DockHeight = dockHeight }; |
||||
parentDocumentGroup.InsertChildAt(dockBefore ? indexOfParentPane : indexOfParentPane + 1, layoutDocumentPane); |
||||
layoutContent.IsActive = true; |
||||
layoutContent.Root.CollectGarbage(); |
||||
Application.Current.MainWindow.Dispatcher.Invoke(() => { |
||||
|
||||
layoutDocumentPane.DockHeight = dockHeight; |
||||
}, System.Windows.Threading.DispatcherPriority.Loaded); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
namespace ICSharpCode.ILSpy |
||||
{ |
||||
public enum PanePosition |
||||
{ |
||||
Top, |
||||
Bottom, |
||||
Document |
||||
} |
||||
} |
Loading…
Reference in new issue