Browse Source

Improved docking.

pull/1801/head
Siegfried Pammer 6 years ago
parent
commit
69a7ffd61a
  1. 2
      ILSpy/Docking/DockWorkspace.cs
  2. 72
      ILSpy/Docking/DockingHelper.cs
  3. 109
      ILSpy/Docking/LayoutUpdateStrategy.cs
  4. 3
      ILSpy/ILSpy.csproj
  5. 320
      ILSpy/MainWindow.xaml
  6. 20
      ILSpy/MainWindow.xaml.cs
  7. 2
      ILSpy/ViewModels/AnalyzerPaneModel.cs
  8. 2
      ILSpy/ViewModels/AssemblyListPaneModel.cs
  9. 2
      ILSpy/ViewModels/DebugStepsPaneModel.cs
  10. 2
      ILSpy/ViewModels/DocumentModel.cs
  11. 5
      ILSpy/ViewModels/PaneModel.cs
  12. 2
      ILSpy/ViewModels/SearchPaneModel.cs
  13. 2
      ILSpy/ViewModels/ToolPaneModel.cs

2
ILSpy/Docking/DockWorkspace.cs

@ -12,8 +12,6 @@ namespace ICSharpCode.ILSpy.Docking @@ -12,8 +12,6 @@ namespace ICSharpCode.ILSpy.Docking
private DockWorkspace()
{
Documents.Add(new DocumentModel());
ToolPanes.Add(AssemblyListPaneModel.Instance);
}
public PaneCollection<DocumentModel> Documents { get; } = new PaneCollection<DocumentModel>();

72
ILSpy/Docking/DockingHelper.cs

@ -1,72 +0,0 @@ @@ -1,72 +0,0 @@
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using Xceed.Wpf.AvalonDock.Layout;
namespace ICSharpCode.ILSpy.Docking
{
public static class DockingHelper
{
public static bool Dock(LayoutRoot root, LayoutContent layoutContent, PanePosition position)
{
var documentPane = root.Descendents().OfType<LayoutDocumentPane>().FirstOrDefault();
if ((position == PanePosition.Top) || (position == PanePosition.Bottom)) {
return DockHorizontal(layoutContent, documentPane, new GridLength(200), position == PanePosition.Top);
} else if ((position == PanePosition.Left) || (position == PanePosition.Right)) {
return DockVertical(layoutContent as LayoutAnchorable, documentPane, new GridLength(400), position == PanePosition.Left);
}
return false;
}
public static bool 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);
return true;
}
return false;
}
public static bool DockVertical(LayoutAnchorable anchorable, ILayoutElement paneRelativeTo, GridLength dockWidth, bool dockBefore = false)
{
if (paneRelativeTo is ILayoutDocumentPane parentDocumentPane) {
var grandParent = parentDocumentPane.Parent as LayoutPanel;
var targetAnchorablePane = grandParent.Children.OfType<LayoutAnchorablePane>().FirstOrDefault();
if (targetAnchorablePane == null) {
targetAnchorablePane = new LayoutAnchorablePane() {
DockWidth = new GridLength(400)
};
int targetIndex = dockBefore ? 0 : grandParent.ChildrenCount;
grandParent.InsertChildAt(targetIndex, targetAnchorablePane);
}
grandParent.Orientation = Orientation.Horizontal;
targetAnchorablePane.Children.Add(anchorable);
anchorable.IsActive = true;
anchorable.Root.CollectGarbage();
Application.Current.MainWindow.Dispatcher.Invoke(
() => targetAnchorablePane.DockWidth = dockWidth,
System.Windows.Threading.DispatcherPriority.Loaded);
return true;
}
return false;
}
}
}

109
ILSpy/Docking/LayoutUpdateStrategy.cs

@ -1,5 +1,7 @@ @@ -1,5 +1,7 @@
using System.Linq;
using System;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using ICSharpCode.ILSpy.ViewModels;
using Xceed.Wpf.AvalonDock.Layout;
@ -9,21 +11,71 @@ namespace ICSharpCode.ILSpy.Docking @@ -9,21 +11,71 @@ namespace ICSharpCode.ILSpy.Docking
{
public bool BeforeInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableToShow, ILayoutContainer destinationContainer)
{
if ((destinationContainer != null) &&
(destinationContainer.FindParent<LayoutFloatingWindow>() != null))
if (destinationContainer?.FindParent<LayoutFloatingWindow>() != null)
return false;
PanePosition targetPosition = PanePosition.Top;
switch (anchorableToShow.Content) {
case AnalyzerPaneModel _:
targetPosition = PanePosition.Bottom;
break;
case AssemblyListPaneModel _:
targetPosition = PanePosition.Left;
break;
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");
}
}
return DockingHelper.Dock(layout, anchorableToShow, targetPosition);
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)
@ -32,7 +84,38 @@ namespace ICSharpCode.ILSpy.Docking @@ -32,7 +84,38 @@ namespace ICSharpCode.ILSpy.Docking
public bool BeforeInsertDocument(LayoutRoot layout, LayoutDocument anchorableToShow, ILayoutContainer destinationContainer)
{
return false;
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)

3
ILSpy/ILSpy.csproj

@ -50,7 +50,7 @@ @@ -50,7 +50,7 @@
<ItemGroup>
<PackageReference Include="AvalonEdit" Version="6.0.0" />
<PackageReference Include="Dirkster.AvalonDock" Version="3.5.12" />
<PackageReference Include="Dirkster.AvalonDock" Version="3.6.1" />
<PackageReference Include="Microsoft.VisualStudio.Composition" Version="16.3.7" />
<PackageReference Include="System.Composition" Version="1.3.0" />
<PackageReference Include="Mono.Cecil" Version="0.10.3" />
@ -141,7 +141,6 @@ @@ -141,7 +141,6 @@
</Compile>
<Compile Include="Docking\ActiveDocumentConverter.cs" />
<Compile Include="ViewModels\AssemblyListPaneModel.cs" />
<Compile Include="Docking\DockingHelper.cs" />
<Compile Include="Docking\DockLayoutSettings.cs" />
<Compile Include="ViewModels\DocumentModel.cs" />
<Compile Include="Docking\LayoutUpdateStrategy.cs" />

320
ILSpy/MainWindow.xaml

@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:tv="clr-namespace:ICSharpCode.TreeView;assembly=ICSharpCode.TreeView"
xmlns:local="clr-namespace:ICSharpCode.ILSpy"
xmlns:avalondock="http://schemas.xceed.com/wpf/xaml/avalondock"
xmlns:avalondockproperties="clr-namespace:Xceed.Wpf.AvalonDock.Properties;assembly=Xceed.Wpf.AvalonDock"
xmlns:docking="clr-namespace:ICSharpCode.ILSpy.Docking"
xmlns:controls="clr-namespace:ICSharpCode.ILSpy.Controls"
xmlns:analyzers="clr-namespace:ICSharpCode.ILSpy.Analyzers"
@ -22,7 +23,8 @@ @@ -22,7 +23,8 @@
<Window.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
<docking:ActiveDocumentConverter x:Key="ActiveDocumentConverter"/>
<avalondock:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
<tv:SharpTreeView x:Key="TreeView"
AutomationProperties.Name="Assemblies and Classes"
SelectionChanged="TreeView_SelectionChanged"
@ -30,7 +32,7 @@ @@ -30,7 +32,7 @@
AllowDropOrder="True"
AllowDrop="True"
BorderThickness="0,1,1,1" Visibility="Visible" />
<DataTemplate x:Key="AssemblyListPaneTemplate">
<ContentControl Content="{StaticResource TreeView}" />
</DataTemplate>
@ -42,11 +44,11 @@ @@ -42,11 +44,11 @@
</DataTemplate>
<local:SearchPane x:Key="SearchPane" />
<DataTemplate x:Key="SearchPaneTemplate">
<ContentControl Content="{StaticResource SearchPane}" />
</DataTemplate>
<analyzers:AnalyzerTreeView x:Key="AnalyzerTreeView" />
<DataTemplate x:Key="AnalyzerPaneTemplate">
@ -162,16 +164,313 @@ @@ -162,16 +164,313 @@
<avalondock:DockingManager x:Name="DockManager"
DataContext="{Binding Workspace}"
AnchorablesSource="{Binding ToolPanes}"
DocumentsSource="{Binding Documents}"
ActiveContent="{Binding ActiveDocument, Mode=Default, Converter={StaticResource ActiveDocumentConverter}}"
DocumentsSource="{Binding Documents}"
ActiveContent="{Binding ActiveDocument, Mode=Default, Converter={StaticResource ActiveDocumentConverter}}"
AllowMixedOrientation="True">
<avalondock:DockingManager.Resources>
<Style TargetType="avalondock:AnchorablePaneTitle">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<avalondock:DropDownControlArea DropDownContextMenu="{Binding Model.Root.Manager.AnchorableContextMenu, RelativeSource={RelativeSource TemplatedParent}}"
DropDownContextMenuDataContext="{Binding Path=LayoutItem, RelativeSource={RelativeSource TemplatedParent}}">
<ContentPresenter Content="{Binding Model, RelativeSource={RelativeSource TemplatedParent}}"
ContentTemplate="{Binding Model.Root.Manager.AnchorableTitleTemplate, RelativeSource={RelativeSource TemplatedParent}}"
ContentTemplateSelector="{Binding Model.Root.Manager.AnchorableTitleTemplateSelector, RelativeSource={RelativeSource TemplatedParent}}" />
</avalondock:DropDownControlArea>
<avalondock:DropDownButton Style="{StaticResource {x:Static ToolBar.ToggleButtonStyleKey}}"
Focusable="False"
Grid.Column="1"
DropDownContextMenu="{Binding Model.Root.Manager.AnchorableContextMenu, RelativeSource={RelativeSource TemplatedParent}}"
DropDownContextMenuDataContext="{Binding Path=LayoutItem, RelativeSource={RelativeSource TemplatedParent}}"
ToolTip="{x:Static avalondockproperties:Resources.Anchorable_CxMenu_Hint}">
<Border Background="White">
<Image Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/PinMenu.png">
</Image>
</Border>
</avalondock:DropDownButton>
<Button x:Name="PART_AutoHidePin"
Grid.Column="2"
Focusable="False"
Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
Visibility="{Binding Path=IsEnabled, RelativeSource={RelativeSource Self}, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"
Command="{Binding Path=LayoutItem.AutoHideCommand, RelativeSource={RelativeSource TemplatedParent}}"
ToolTip="{x:Static avalondockproperties:Resources.Anchorable_BtnAutoHide_Hint}">
<Border Background="White">
<Image Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/PinAutoHide.png">
</Image>
</Border>
</Button>
<Button x:Name="PART_HidePin"
Grid.Column="3"
Focusable="False"
Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
Visibility="{Binding Path=LayoutItem.Model.IsCloseable, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"
Command="{Binding Path=LayoutItem.Model.CloseCommand, RelativeSource={RelativeSource TemplatedParent}}"
ToolTip="{x:Static avalondockproperties:Resources.Anchorable_BtnClose_Hint}">
<Border Background="White">
<Image Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/PinClose.png">
</Image>
</Border>
</Button>
</Grid>
</Border>
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding Model.IsAutoHidden, RelativeSource={RelativeSource Mode=Self}}"
Value="True">
<Setter Property="LayoutTransform"
TargetName="PART_AutoHidePin">
<Setter.Value>
<RotateTransform Angle="90" />
</Setter.Value>
</Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Model.CanClose, RelativeSource={RelativeSource Mode=Self}}"
Value="True">
<Setter Property="Command"
TargetName="PART_HidePin"
Value="{Binding Path=LayoutItem.CloseCommand, RelativeSource={RelativeSource TemplatedParent}}" />
<Setter Property="ToolTip"
TargetName="PART_HidePin"
Value="{x:Static avalondockproperties:Resources.Document_Close}" />
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type avalondock:LayoutAnchorableControl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type avalondock:LayoutAnchorableControl}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
KeyboardNavigation.TabNavigation="Cycle">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Border x:Name="Header">
<avalondock:AnchorablePaneTitle Model="{Binding Model, RelativeSource={RelativeSource TemplatedParent}}" />
</Border>
<!--
Added ContentTemplate and ContentTemplateSelector
https://github.com/xceedsoftware/wpftoolkit/issues/1525
-->
<ContentPresenter Grid.Row="1"
FlowDirection="{TemplateBinding FlowDirection}"
Content="{Binding LayoutItem.View, RelativeSource={RelativeSource TemplatedParent}}"
ContentTemplate="{Binding LayoutItem.View.ContentTemplate, RelativeSource={RelativeSource TemplatedParent}}"
ContentTemplateSelector="{Binding LayoutItem.View.ContentTemplateSelector, RelativeSource={RelativeSource TemplatedParent}}"
/>
<!--<ContentPresenter
FlowDirection="{TemplateBinding FlowDirection}"
Content="{Binding Model.Content, RelativeSource={RelativeSource TemplatedParent}}"
ContentTemplate="{Binding LayoutItemTemplate, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}"
ContentTemplateSelector="{Binding LayoutItemTemplateSelector, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}"
Grid.Row="1"/>-->
</Grid>
</Border>
<ControlTemplate.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=Model.IsFloating}"
Value="True" />
<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=Model.Parent.IsDirectlyHostedInFloatingWindow}"
Value="True" />
</MultiDataTrigger.Conditions>
<Setter Property="Visibility"
Value="Collapsed"
TargetName="Header" />
</MultiDataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--AnchorablePaneControlStyle-->
<Style x:Key="AnchorablePaneControlStyle"
TargetType="{x:Type avalondock:LayoutAnchorablePaneControl}">
<Setter Property="Foreground"
Value="{Binding Model.Root.Manager.Foreground, RelativeSource={RelativeSource Self}}" />
<Setter Property="Background"
Value="{Binding Model.Root.Manager.Background, RelativeSource={RelativeSource Self}}" />
<Setter Property="TabStripPlacement"
Value="Bottom" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type avalondock:LayoutAnchorablePaneControl}">
<Grid ClipToBounds="true"
SnapsToDevicePixels="true"
KeyboardNavigation.TabNavigation="Local">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!--Following border is required to catch mouse events-->
<Border Background="Transparent"
Grid.RowSpan="2" />
<Border x:Name="ContentPanel"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
Grid.Column="0"
KeyboardNavigation.DirectionalNavigation="Contained"
Grid.Row="0"
KeyboardNavigation.TabIndex="2"
KeyboardNavigation.TabNavigation="Cycle">
<ContentPresenter x:Name="PART_SelectedContentHost"
ContentSource="SelectedContent"
Margin="{TemplateBinding Padding}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
<avalondock:AnchorablePaneTabPanel x:Name="HeaderPanel"
Margin="2,0,2,2"
IsItemsHost="true"
Grid.Row="1"
KeyboardNavigation.TabIndex="1"
Panel.ZIndex="1" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled"
Value="false">
<Setter Property="Foreground"
Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="{x:Type TabItem}">
<Setter Property="IsSelected"
Value="{Binding IsSelected, Mode=TwoWay}" />
<Setter Property="IsEnabled"
Value="{Binding IsEnabled}" />
<Setter Property="ToolTip"
Value="{Binding ToolTip}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<Grid SnapsToDevicePixels="true">
<Border x:Name="Bd"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1,0,1,1"
Background="{TemplateBinding Background}"
Padding="{TemplateBinding Padding}">
<ContentPresenter x:Name="Content"
ContentSource="Header"
HorizontalAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"
VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="Selector.IsSelected"
Value="true">
<Setter Property="Background"
Value="White" />
<Setter Property="Panel.ZIndex"
Value="1" />
<Setter Property="Margin"
Value="0,-1,-1,-2" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver"
Value="true" />
<Condition Property="Selector.IsSelected"
Value="false" />
</MultiTrigger.Conditions>
<Setter Property="Background"
Value="{DynamicResource {x:Static SystemColors.GradientInactiveCaptionBrushKey}}" />
<Setter Property="BorderBrush"
Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
<Setter Property="Panel.ZIndex"
Value="0" />
</MultiTrigger>
<Trigger Property="IsEnabled"
Value="false">
<Setter Property="Foreground"
Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type TabControl}}, Path=Items.Count, FallbackValue=1}"
Value="1">
<Setter Property="Visibility"
Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</Setter.Value>
</Setter>
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<avalondock:LayoutAnchorableTabItem Model="{Binding}" />
</DataTemplate>
</Setter.Value>
</Setter>
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<avalondock:LayoutAnchorableControl Model="{Binding}" />
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</avalondock:DockingManager.Resources>
<avalondock:DockingManager.AnchorablePaneControlStyle>
<StaticResource ResourceKey="AnchorablePaneControlStyle" />
</avalondock:DockingManager.AnchorablePaneControlStyle>
<avalondock:LayoutRoot>
<avalondock:LayoutPanel Orientation="Horizontal">
<avalondock:LayoutAnchorablePane DockMinWidth="150" Name="LeftPane" />
<avalondock:LayoutPanel Orientation="Vertical">
<avalondock:LayoutAnchorablePane DockMinHeight="150" Name="TopPane" />
<avalondock:LayoutDocumentPane />
<avalondock:LayoutAnchorablePane DockMinHeight="150" Name="BottomPane" />
</avalondock:LayoutPanel>
<avalondock:LayoutAnchorablePane DockMinWidth="150" Name="RightPane" />
</avalondock:LayoutPanel>
</avalondock:LayoutRoot>
<avalondock:DockingManager.LayoutUpdateStrategy>
<docking:LayoutUpdateStrategy />
</avalondock:DockingManager.LayoutUpdateStrategy>
@ -191,14 +490,13 @@ @@ -191,14 +490,13 @@
<avalondock:DockingManager.LayoutItemContainerStyleSelector>
<docking:PaneStyleSelector>
<docking:PaneStyleSelector.ToolPaneStyle>
<Style TargetType="{x:Type avalondock:LayoutAnchorableItem}">
<Style TargetType="{x:Type avalondock:LayoutItem}">
<Setter Property="Title" Value="{Binding Model.Title}"/>
<Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
<Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
<Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
<Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
<Setter Property="CanClose" Value="{Binding Model.IsCloseable, Mode=TwoWay}" />
<Setter Property="CanHide" Value="{Binding Model.IsCloseable}" />
<Setter Property="CanClose" Value="{Binding Model.IsCloseable}" />
</Style>
</docking:PaneStyleSelector.ToolPaneStyle>
<docking:PaneStyleSelector.DocumentStyle>
@ -208,7 +506,7 @@ @@ -208,7 +506,7 @@
<Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
<Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
<Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
<Setter Property="CanClose" Value="{Binding Model.IsCloseable, Mode=TwoWay}" />
<Setter Property="CanClose" Value="{Binding Model.IsCloseable}" />
</Style>
</docking:PaneStyleSelector.DocumentStyle>
</docking:PaneStyleSelector>

20
ILSpy/MainWindow.xaml.cs

@ -460,6 +460,9 @@ namespace ICSharpCode.ILSpy @@ -460,6 +460,9 @@ namespace ICSharpCode.ILSpy
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
DockWorkspace.Instance.ToolPanes.Add(AssemblyListPaneModel.Instance);
DockWorkspace.Instance.Documents.Add(new DocumentModel());
ILSpySettings spySettings = this.spySettingsForMainWindow_Loaded;
this.spySettingsForMainWindow_Loaded = null;
var loadPreviousAssemblies = Options.MiscSettingsPanel.CurrentMiscSettings.LoadPreviousAssemblies;
@ -1074,23 +1077,6 @@ namespace ICSharpCode.ILSpy @@ -1074,23 +1077,6 @@ namespace ICSharpCode.ILSpy
return loadedAssy.FileName;
}
//#region Top/Bottom Pane management
//public void ShowInNewPane(string title, object content, PanePosition panePosition, string toolTip = null)
//{
// if (panePosition == PanePosition.Document) {
// var layoutDocument = new LayoutDocument() { Title = title, Content = content, ToolTip = toolTip, CanClose = true };
// var documentPane = this.DockManager.Layout.Descendents().OfType<LayoutDocumentPane>().FirstOrDefault();
// documentPane.Children.Add(layoutDocument);
// } else {
// var layoutAnchorable = new LayoutAnchorable() { Title = title, Content = content, ToolTip = toolTip, CanClose = true, CanHide = true };
// var documentPane = this.DockManager.Layout.Descendents().OfType<LayoutDocumentPane>().FirstOrDefault();
// Docking.DockingHelper.DockHorizontal(layoutAnchorable, documentPane, new GridLength(200), panePosition == PanePosition.Top);
// }
//}
//#endregion
public void UnselectAll()
{
treeView.UnselectAll();

2
ILSpy/ViewModels/AnalyzerPaneModel.cs

@ -6,6 +6,8 @@ @@ -6,6 +6,8 @@
public static AnalyzerPaneModel Instance { get; } = new AnalyzerPaneModel();
public override PanePosition DefaultPosition => PanePosition.Bottom;
private AnalyzerPaneModel()
{
ContentId = PaneContentId;

2
ILSpy/ViewModels/AssemblyListPaneModel.cs

@ -6,6 +6,8 @@ @@ -6,6 +6,8 @@
public static AssemblyListPaneModel Instance { get; } = new AssemblyListPaneModel();
public override PanePosition DefaultPosition => PanePosition.Left;
private AssemblyListPaneModel()
{
Title = "Assemblies";

2
ILSpy/ViewModels/DebugStepsPaneModel.cs

@ -6,6 +6,8 @@ @@ -6,6 +6,8 @@
public static DebugStepsPaneModel Instance { get; } = new DebugStepsPaneModel();
public override PanePosition DefaultPosition => PanePosition.Top;
private DebugStepsPaneModel()
{
ContentId = PaneContentId;

2
ILSpy/ViewModels/DocumentModel.cs

@ -2,6 +2,8 @@ @@ -2,6 +2,8 @@
{
public class DocumentModel : PaneModel
{
public override PanePosition DefaultPosition => PanePosition.Document;
public DocumentModel()
{
ContentId = "document";

5
ILSpy/ViewModels/PaneModel.cs

@ -1,9 +1,12 @@ @@ -1,9 +1,12 @@
using System.ComponentModel;
using System.Windows.Input;
namespace ICSharpCode.ILSpy.ViewModels
{
public class PaneModel : INotifyPropertyChanged
public abstract class PaneModel : INotifyPropertyChanged
{
public abstract PanePosition DefaultPosition { get; }
public event PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName)

2
ILSpy/ViewModels/SearchPaneModel.cs

@ -6,6 +6,8 @@ @@ -6,6 +6,8 @@
public static SearchPaneModel Instance { get; } = new SearchPaneModel();
public override PanePosition DefaultPosition => PanePosition.Top;
private SearchPaneModel()
{
ContentId = PaneContentId;

2
ILSpy/ViewModels/ToolPaneModel.cs

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
namespace ICSharpCode.ILSpy.ViewModels
{
public class ToolPaneModel : PaneModel
public abstract class ToolPaneModel : PaneModel
{
}

Loading…
Cancel
Save