mirror of https://github.com/icsharpcode/ILSpy.git
46 changed files with 1232 additions and 220 deletions
@ -0,0 +1,43 @@
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2019 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.Data; |
||||
using ICSharpCode.ILSpy.ViewModels; |
||||
|
||||
namespace ICSharpCode.ILSpy.Docking |
||||
{ |
||||
public class ActiveDocumentConverter : IValueConverter |
||||
{ |
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) |
||||
{ |
||||
if (value is DocumentModel) |
||||
return value; |
||||
|
||||
return Binding.DoNothing; |
||||
} |
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) |
||||
{ |
||||
if (value is DocumentModel) |
||||
return value; |
||||
|
||||
return Binding.DoNothing; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,116 @@
@@ -0,0 +1,116 @@
|
||||
// Copyright (c) 2019 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.ObjectModel; |
||||
using System.ComponentModel; |
||||
using System.Runtime.CompilerServices; |
||||
using System.Threading; |
||||
using System.Threading.Tasks; |
||||
using ICSharpCode.AvalonEdit.Highlighting; |
||||
using ICSharpCode.ILSpy.TextView; |
||||
using ICSharpCode.ILSpy.ViewModels; |
||||
|
||||
namespace ICSharpCode.ILSpy.Docking |
||||
{ |
||||
public class DockWorkspace : INotifyPropertyChanged |
||||
{ |
||||
private SessionSettings sessionSettings; |
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
public static DockWorkspace Instance { get; } = new DockWorkspace(); |
||||
|
||||
private DockWorkspace() |
||||
{ |
||||
} |
||||
|
||||
public PaneCollection<DocumentModel> Documents { get; } = new PaneCollection<DocumentModel>(); |
||||
|
||||
public PaneCollection<ToolPaneModel> ToolPanes { get; } = new PaneCollection<ToolPaneModel>(); |
||||
|
||||
public void Remove(PaneModel model) |
||||
{ |
||||
Documents.Remove(model as DocumentModel); |
||||
ToolPanes.Remove(model as ToolPaneModel); |
||||
} |
||||
|
||||
private DocumentModel _activeDocument = null; |
||||
public DocumentModel ActiveDocument { |
||||
get { |
||||
return _activeDocument; |
||||
} |
||||
set { |
||||
if (_activeDocument != value) { |
||||
_activeDocument = value; |
||||
if (value is DecompiledDocumentModel ddm) { |
||||
this.sessionSettings.FilterSettings.Language = ddm.Language; |
||||
this.sessionSettings.FilterSettings.LanguageVersion = ddm.LanguageVersion; |
||||
} |
||||
RaisePropertyChanged(nameof(ActiveDocument)); |
||||
} |
||||
} |
||||
} |
||||
|
||||
protected void RaisePropertyChanged([CallerMemberName] string propertyName = null) |
||||
{ |
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); |
||||
} |
||||
|
||||
public void ShowText(AvalonEditTextOutput textOutput) |
||||
{ |
||||
GetTextView().ShowText(textOutput); |
||||
} |
||||
|
||||
public DecompilerTextView GetTextView() |
||||
{ |
||||
return ((DecompiledDocumentModel)ActiveDocument).TextView; |
||||
} |
||||
|
||||
public DecompilerTextViewState GetState() |
||||
{ |
||||
return GetTextView().GetState(); |
||||
} |
||||
|
||||
public Task<T> RunWithCancellation<T>(Func<CancellationToken, Task<T>> taskCreation) |
||||
{ |
||||
return GetTextView().RunWithCancellation(taskCreation); |
||||
} |
||||
|
||||
internal void ShowNodes(AvalonEditTextOutput output, TreeNodes.ILSpyTreeNode[] nodes, IHighlightingDefinition highlighting) |
||||
{ |
||||
GetTextView().ShowNodes(output, nodes, highlighting); |
||||
} |
||||
|
||||
internal void LoadSettings(SessionSettings sessionSettings) |
||||
{ |
||||
this.sessionSettings = sessionSettings; |
||||
sessionSettings.FilterSettings.PropertyChanged += FilterSettings_PropertyChanged; |
||||
} |
||||
|
||||
private void FilterSettings_PropertyChanged(object sender, PropertyChangedEventArgs e) |
||||
{ |
||||
if (ActiveDocument is DecompiledDocumentModel ddm) { |
||||
if (e.PropertyName == "Language" || e.PropertyName == "LanguageVersion") { |
||||
ddm.Language = sessionSettings.FilterSettings.Language; |
||||
ddm.LanguageVersion = sessionSettings.FilterSettings.LanguageVersion; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,32 +0,0 @@
@@ -1,32 +0,0 @@
|
||||
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,143 @@
@@ -0,0 +1,143 @@
|
||||
// Copyright (c) 2019 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.Linq; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using ICSharpCode.ILSpy.ViewModels; |
||||
using Xceed.Wpf.AvalonDock.Layout; |
||||
|
||||
namespace ICSharpCode.ILSpy.Docking |
||||
{ |
||||
public class LayoutUpdateStrategy : ILayoutUpdateStrategy |
||||
{ |
||||
public bool BeforeInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableToShow, ILayoutContainer destinationContainer) |
||||
{ |
||||
if (destinationContainer?.FindParent<LayoutFloatingWindow>() != null) |
||||
return false; |
||||
|
||||
PanePosition targetPosition = anchorableToShow.Content is PaneModel model ? model.DefaultPosition : PanePosition.Document; |
||||
|
||||
switch (targetPosition) { |
||||
case PanePosition.Top: |
||||
case PanePosition.Bottom: |
||||
case PanePosition.Left: |
||||
case PanePosition.Right: |
||||
var pane = GetOrCreatePane(layout, targetPosition.ToString()); |
||||
if (pane == null) |
||||
return false; |
||||
anchorableToShow.CanDockAsTabbedDocument = false; |
||||
pane.Children.Add(anchorableToShow); |
||||
return true; |
||||
case PanePosition.Document: |
||||
var documentPane = GetOrCreateDocumentPane(layout); |
||||
if (documentPane == null) |
||||
return false; |
||||
documentPane.Children.Add(anchorableToShow); |
||||
return true; |
||||
default: |
||||
throw new NotSupportedException($"Enum value {targetPosition} is not supported"); |
||||
} |
||||
} |
||||
|
||||
private LayoutAnchorablePane GetOrCreatePane(LayoutRoot layout, string name) |
||||
{ |
||||
var pane = layout.Descendents().OfType<LayoutAnchorablePane>().FirstOrDefault(p => p.Name == name + "Pane"); |
||||
if (pane != null) |
||||
return pane; |
||||
var layoutPanel = layout.Children.OfType<LayoutPanel>().FirstOrDefault(); |
||||
if (layoutPanel == null) { |
||||
layout.RootPanel = new LayoutPanel() { Orientation = Orientation.Horizontal }; |
||||
} |
||||
if (layoutPanel.Orientation != Orientation.Horizontal) { |
||||
layoutPanel.Orientation = Orientation.Horizontal; |
||||
} |
||||
LayoutAnchorablePane result = null; |
||||
switch (name) { |
||||
case "Top": |
||||
case "Bottom": |
||||
var centerLayoutPanel = layoutPanel.Children.OfType<LayoutPanel>().FirstOrDefault(); |
||||
if (centerLayoutPanel == null) { |
||||
layoutPanel.Children.Insert(0, centerLayoutPanel = new LayoutPanel() { Orientation = Orientation.Vertical }); |
||||
} |
||||
if (centerLayoutPanel.Orientation != Orientation.Vertical) { |
||||
centerLayoutPanel.Orientation = Orientation.Vertical; |
||||
} |
||||
if (name == "Top") |
||||
centerLayoutPanel.Children.Insert(0, result = new LayoutAnchorablePane { Name = name + "Pane", DockMinHeight = 250 }); |
||||
else |
||||
centerLayoutPanel.Children.Add(result = new LayoutAnchorablePane { Name = name + "Pane", DockMinHeight = 250 }); |
||||
return result; |
||||
case "Left": |
||||
case "Right": |
||||
if (name == "Left") |
||||
layoutPanel.Children.Insert(0, result = new LayoutAnchorablePane { Name = name + "Pane", DockMinWidth = 250 }); |
||||
else |
||||
layoutPanel.Children.Add(result = new LayoutAnchorablePane { Name = name + "Pane", DockMinWidth = 250 }); |
||||
return result; |
||||
default: |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public void AfterInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableShown) |
||||
{ |
||||
} |
||||
|
||||
public bool BeforeInsertDocument(LayoutRoot layout, LayoutDocument anchorableToShow, ILayoutContainer destinationContainer) |
||||
{ |
||||
if (destinationContainer?.FindParent<LayoutFloatingWindow>() != null) |
||||
return false; |
||||
|
||||
var documentPane = GetOrCreateDocumentPane(layout); |
||||
if (documentPane == null) |
||||
return false; |
||||
documentPane.Children.Add(anchorableToShow); |
||||
return true; |
||||
} |
||||
|
||||
private LayoutDocumentPane GetOrCreateDocumentPane(LayoutRoot layout) |
||||
{ |
||||
var pane = layout.Descendents().OfType<LayoutDocumentPane>().FirstOrDefault(); |
||||
if (pane != null) |
||||
return pane; |
||||
var layoutPanel = layout.Children.OfType<LayoutPanel>().FirstOrDefault(); |
||||
if (layoutPanel == null) { |
||||
layout.RootPanel = new LayoutPanel() { Orientation = Orientation.Horizontal }; |
||||
} |
||||
if (layoutPanel.Orientation != Orientation.Horizontal) { |
||||
layoutPanel.Orientation = Orientation.Horizontal; |
||||
} |
||||
var centerLayoutPanel = layoutPanel.Children.OfType<LayoutPanel>().FirstOrDefault(); |
||||
if (centerLayoutPanel == null) { |
||||
layoutPanel.Children.Insert(0, centerLayoutPanel = new LayoutPanel() { Orientation = Orientation.Vertical }); |
||||
} |
||||
if (centerLayoutPanel.Orientation != Orientation.Vertical) { |
||||
centerLayoutPanel.Orientation = Orientation.Vertical; |
||||
} |
||||
LayoutDocumentPane result; |
||||
centerLayoutPanel.Children.Add(result = new LayoutDocumentPane()); |
||||
return result; |
||||
} |
||||
|
||||
public void AfterInsertDocument(LayoutRoot layout, LayoutDocument anchorableShown) |
||||
{ |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,61 @@
@@ -0,0 +1,61 @@
|
||||
// Copyright (c) 2019 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.Collections; |
||||
using System.Collections.Generic; |
||||
using System.Collections.ObjectModel; |
||||
using System.Collections.Specialized; |
||||
using System.ComponentModel; |
||||
using System.Linq; |
||||
using ICSharpCode.ILSpy.ViewModels; |
||||
|
||||
namespace ICSharpCode.ILSpy.Docking |
||||
{ |
||||
public class PaneCollection<T> : INotifyCollectionChanged, INotifyPropertyChanged, ICollection<T> |
||||
where T : PaneModel |
||||
{ |
||||
private ObservableCollection<T> observableCollection = new ObservableCollection<T>(); |
||||
|
||||
public event NotifyCollectionChangedEventHandler CollectionChanged; |
||||
public event PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
public PaneCollection() |
||||
{ |
||||
observableCollection.CollectionChanged += (sender, e) => CollectionChanged?.Invoke(this, e); |
||||
} |
||||
|
||||
public void Add(T item) |
||||
{ |
||||
if (!this.Any(pane => pane.ContentId == item.ContentId)) { |
||||
observableCollection.Add(item); |
||||
} |
||||
|
||||
item.IsVisible = true; |
||||
item.IsActive = true; |
||||
} |
||||
|
||||
public int Count => observableCollection.Count(); |
||||
public bool IsReadOnly => false; |
||||
public void Clear() => observableCollection.Clear(); |
||||
public bool Contains(T item) => observableCollection.Contains(item); |
||||
public void CopyTo(T[] array, int arrayIndex) => observableCollection.CopyTo(array, arrayIndex); |
||||
public bool Remove(T item) => observableCollection.Remove(item); |
||||
public IEnumerator<T> GetEnumerator() => observableCollection.GetEnumerator(); |
||||
IEnumerator IEnumerable.GetEnumerator() => observableCollection.GetEnumerator(); |
||||
} |
||||
} |
@ -1,9 +1,29 @@
@@ -1,9 +1,29 @@
|
||||
namespace ICSharpCode.ILSpy |
||||
// Copyright (c) 2019 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.
|
||||
|
||||
namespace ICSharpCode.ILSpy |
||||
{ |
||||
public enum PanePosition |
||||
{ |
||||
Top, |
||||
Bottom, |
||||
Left, |
||||
Right, |
||||
Document |
||||
} |
||||
} |
||||
|
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using ICSharpCode.ILSpy.ViewModels; |
||||
// Copyright (c) 2019 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.
|
||||
|
||||
namespace ICSharpCode.ILSpy.Docking |
||||
{ |
||||
public class PaneStyleSelector : StyleSelector |
||||
{ |
||||
public Style ToolPaneStyle { get; set; } |
||||
|
||||
public Style DocumentStyle { get; set; } |
||||
|
||||
public override Style SelectStyle(object item, DependencyObject container) |
||||
{ |
||||
if (item is DocumentModel) |
||||
return DocumentStyle; |
||||
|
||||
if (item is ToolPaneModel) |
||||
return ToolPaneStyle; |
||||
|
||||
return base.SelectStyle(item, container); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,43 @@
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2019 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.ObjectModel; |
||||
using System.Linq; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
|
||||
namespace ICSharpCode.ILSpy.Docking |
||||
{ |
||||
public class TemplateMapping |
||||
{ |
||||
public Type Type { get; set; } |
||||
public DataTemplate Template { get; set; } |
||||
} |
||||
|
||||
public class PaneTemplateSelector : DataTemplateSelector |
||||
{ |
||||
public Collection<TemplateMapping> Mappings { get; set; } = new Collection<TemplateMapping>(); |
||||
|
||||
public override DataTemplate SelectTemplate(object item, DependencyObject container) |
||||
{ |
||||
return Mappings.FirstOrDefault(m => m.Type == item.GetType())?.Template |
||||
?? base.SelectTemplate(item, container); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 2019 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.
|
||||
|
||||
namespace ICSharpCode.ILSpy.ViewModels |
||||
{ |
||||
public class AnalyzerPaneModel : ToolPaneModel |
||||
{ |
||||
public const string PaneContentId = "analyzerPane"; |
||||
|
||||
public static AnalyzerPaneModel Instance { get; } = new AnalyzerPaneModel(); |
||||
|
||||
public override PanePosition DefaultPosition => PanePosition.Bottom; |
||||
|
||||
private AnalyzerPaneModel() |
||||
{ |
||||
ContentId = PaneContentId; |
||||
Title = Properties.Resources.Analyze; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,38 @@
@@ -0,0 +1,38 @@
|
||||
// Copyright (c) 2019 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 ICSharpCode.ILSpy.Properties; |
||||
|
||||
namespace ICSharpCode.ILSpy.ViewModels |
||||
{ |
||||
public class AssemblyListPaneModel : ToolPaneModel |
||||
{ |
||||
public const string PaneContentId = "assemblyListPane"; |
||||
|
||||
public static AssemblyListPaneModel Instance { get; } = new AssemblyListPaneModel(); |
||||
|
||||
public override PanePosition DefaultPosition => PanePosition.Left; |
||||
|
||||
private AssemblyListPaneModel() |
||||
{ |
||||
Title = Resources.Assemblies; |
||||
ContentId = PaneContentId; |
||||
IsCloseable = false; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 2019 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.
|
||||
|
||||
namespace ICSharpCode.ILSpy.ViewModels |
||||
{ |
||||
public class DebugStepsPaneModel : ToolPaneModel |
||||
{ |
||||
public const string PaneContentId = "debugStepsPane"; |
||||
|
||||
public static DebugStepsPaneModel Instance { get; } = new DebugStepsPaneModel(); |
||||
|
||||
public override PanePosition DefaultPosition => PanePosition.Top; |
||||
|
||||
private DebugStepsPaneModel() |
||||
{ |
||||
ContentId = PaneContentId; |
||||
Title = Properties.Resources.DebugSteps; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,80 @@
@@ -0,0 +1,80 @@
|
||||
// Copyright (c) 2019 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 ICSharpCode.ILSpy.Properties; |
||||
using ICSharpCode.ILSpy.TextView; |
||||
|
||||
namespace ICSharpCode.ILSpy.ViewModels |
||||
{ |
||||
public abstract class DocumentModel : PaneModel |
||||
{ |
||||
public override PanePosition DefaultPosition => PanePosition.Document; |
||||
|
||||
protected DocumentModel(string contentId, string title) |
||||
{ |
||||
this.ContentId = contentId; |
||||
this.Title = title; |
||||
} |
||||
} |
||||
|
||||
public class DecompiledDocumentModel : DocumentModel |
||||
{ |
||||
public DecompiledDocumentModel() |
||||
: base("//Decompiled", Resources.View) |
||||
{ |
||||
} |
||||
|
||||
public DecompiledDocumentModel(string id, string title) |
||||
: base("//Decompiled/" + id, title) |
||||
{ |
||||
} |
||||
|
||||
private DecompilerTextView textView; |
||||
public DecompilerTextView TextView { |
||||
get => textView; |
||||
set { |
||||
if (textView != value) { |
||||
textView = value; |
||||
RaisePropertyChanged(nameof(TextView)); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private Language language; |
||||
public Language Language { |
||||
get => language; |
||||
set { |
||||
if (language != value) { |
||||
language = value; |
||||
RaisePropertyChanged(nameof(Language)); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private LanguageVersion languageVersion; |
||||
public LanguageVersion LanguageVersion { |
||||
get => languageVersion; |
||||
set { |
||||
if (languageVersion != value) { |
||||
languageVersion = value; |
||||
RaisePropertyChanged(nameof(LanguageVersion)); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,140 @@
@@ -0,0 +1,140 @@
|
||||
// Copyright (c) 2019 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.ComponentModel; |
||||
using System.Windows.Input; |
||||
|
||||
namespace ICSharpCode.ILSpy.ViewModels |
||||
{ |
||||
public abstract class PaneModel : INotifyPropertyChanged |
||||
{ |
||||
class CloseCommandImpl : ICommand |
||||
{ |
||||
readonly PaneModel model; |
||||
|
||||
public CloseCommandImpl(PaneModel model) |
||||
{ |
||||
this.model = model; |
||||
} |
||||
|
||||
public event EventHandler CanExecuteChanged; |
||||
|
||||
public bool CanExecute(object parameter) |
||||
{ |
||||
return model.IsCloseable; |
||||
} |
||||
|
||||
public void Execute(object parameter) |
||||
{ |
||||
Docking.DockWorkspace.Instance.Remove(model); |
||||
} |
||||
} |
||||
|
||||
public PaneModel() |
||||
{ |
||||
this.closeCommand = new CloseCommandImpl(this); |
||||
} |
||||
|
||||
public abstract PanePosition DefaultPosition { get; } |
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
protected void RaisePropertyChanged(string propertyName) |
||||
{ |
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); |
||||
} |
||||
|
||||
private bool isSelected = false; |
||||
public bool IsSelected { |
||||
get => isSelected; |
||||
set { |
||||
if (isSelected != value) { |
||||
isSelected = value; |
||||
RaisePropertyChanged(nameof(IsSelected)); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private bool isActive = false; |
||||
public bool IsActive { |
||||
get => isActive; |
||||
set { |
||||
if (isActive != value) { |
||||
isActive = value; |
||||
RaisePropertyChanged(nameof(IsActive)); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private bool isVisible = true; |
||||
public bool IsVisible { |
||||
get { return isVisible; } |
||||
set { |
||||
if (isVisible != value) { |
||||
isVisible = value; |
||||
RaisePropertyChanged(nameof(IsVisible)); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private bool isCloseable = true; |
||||
public bool IsCloseable { |
||||
get { return isCloseable; } |
||||
set { |
||||
if (isCloseable != value) { |
||||
isCloseable = value; |
||||
RaisePropertyChanged(nameof(IsCloseable)); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private ICommand closeCommand; |
||||
public ICommand CloseCommand { |
||||
get { return closeCommand; } |
||||
set { |
||||
if (closeCommand != value) { |
||||
closeCommand = value; |
||||
RaisePropertyChanged(nameof(CloseCommand)); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private string contentId; |
||||
public string ContentId { |
||||
get => contentId; |
||||
set { |
||||
if (contentId != value) { |
||||
contentId = value; |
||||
RaisePropertyChanged(nameof(ContentId)); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private string title; |
||||
public string Title { |
||||
get => title; |
||||
set { |
||||
if (title != value) { |
||||
title = value; |
||||
RaisePropertyChanged(nameof(Title)); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
// Copyright (c) 2019 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.
|
||||
|
||||
namespace ICSharpCode.ILSpy.ViewModels |
||||
{ |
||||
public class SearchPaneModel : ToolPaneModel |
||||
{ |
||||
public const string PaneContentId = "searchPane"; |
||||
|
||||
public static SearchPaneModel Instance { get; } = new SearchPaneModel(); |
||||
|
||||
public override PanePosition DefaultPosition => PanePosition.Top; |
||||
|
||||
private SearchPaneModel() |
||||
{ |
||||
ContentId = PaneContentId; |
||||
Title = Properties.Resources.SearchPane_Search; |
||||
IsCloseable = true; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
// Copyright (c) 2019 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.
|
||||
|
||||
namespace ICSharpCode.ILSpy.ViewModels |
||||
{ |
||||
public abstract class ToolPaneModel : PaneModel |
||||
{ |
||||
|
||||
} |
||||
} |
Loading…
Reference in new issue