Browse Source

Add Window menu commands.

pull/1820/head
Siegfried Pammer 6 years ago
parent
commit
53dbea5646
  1. 27
      ILSpy/Docking/CloseAllDocumentsCommand.cs
  2. 5
      ILSpy/Docking/DockLayoutSettings.cs
  3. 24
      ILSpy/Docking/DockWorkspace.cs
  4. 1
      ILSpy/ILSpy.csproj
  5. 1
      ILSpy/MainWindow.xaml
  6. 27
      ILSpy/Properties/Resources.Designer.cs
  7. 9
      ILSpy/Properties/Resources.resx

27
ILSpy/Docking/CloseAllDocumentsCommand.cs

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ICSharpCode.ILSpy.Properties;
namespace ICSharpCode.ILSpy.Docking
{
[ExportMainMenuCommand(Header = nameof(Resources.Window_CloseAllDocuments), Menu = nameof(Resources._Window))]
class CloseAllDocumentsCommand : SimpleCommand
{
public override void Execute(object parameter)
{
DockWorkspace.Instance.CloseAllDocuments();
}
}
[ExportMainMenuCommand(Header = nameof(Resources.Window_ResetLayout), Menu = nameof(Resources._Window))]
class ResetLayoutCommand : SimpleCommand
{
public override void Execute(object parameter)
{
DockWorkspace.Instance.ResetLayout();
}
}
}

5
ILSpy/Docking/DockLayoutSettings.cs

@ -63,6 +63,11 @@ namespace ICSharpCode.ILSpy.Docking @@ -63,6 +63,11 @@ namespace ICSharpCode.ILSpy.Docking
public bool Valid => rawSettings != null;
public void Reset()
{
this.rawSettings = DefaultLayout;
}
public DockLayoutSettings(XElement element)
{
if ((element != null) && element.HasElements) {

24
ILSpy/Docking/DockWorkspace.cs

@ -98,8 +98,6 @@ namespace ICSharpCode.ILSpy.Docking @@ -98,8 +98,6 @@ namespace ICSharpCode.ILSpy.Docking
} finally {
serializer.LayoutSerializationCallback -= LayoutSerializationCallback;
}
EnsureUnclosablePanes();
}
void LayoutSerializationCallback(object sender, LayoutSerializationCallbackEventArgs e)
@ -136,11 +134,6 @@ namespace ICSharpCode.ILSpy.Docking @@ -136,11 +134,6 @@ namespace ICSharpCode.ILSpy.Docking
}
}
internal void EnsureUnclosablePanes()
{
AssemblyListPaneModel.Instance.IsVisible = true;
}
protected void RaisePropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
@ -186,5 +179,22 @@ namespace ICSharpCode.ILSpy.Docking @@ -186,5 +179,22 @@ namespace ICSharpCode.ILSpy.Docking
}
}
}
internal void CloseAllDocuments()
{
foreach (var doc in Documents.ToArray()) {
if (doc.IsCloseable)
Documents.Remove(doc);
}
}
internal void ResetLayout()
{
foreach (var pane in ToolPanes) {
pane.IsVisible = false;
}
sessionSettings.DockLayout.Reset();
InitializeLayout(MainWindow.Instance.DockManager);
}
}
}

1
ILSpy/ILSpy.csproj

@ -140,6 +140,7 @@ @@ -140,6 +140,7 @@
<DependentUpon>DebugSteps.xaml</DependentUpon>
</Compile>
<Compile Include="Docking\ActiveDocumentConverter.cs" />
<Compile Include="Docking\CloseAllDocumentsCommand.cs" />
<Compile Include="ViewModels\AssemblyListPaneModel.cs" />
<Compile Include="Docking\DockLayoutSettings.cs" />
<Compile Include="ViewModels\DocumentModel.cs" />

1
ILSpy/MainWindow.xaml

@ -99,6 +99,7 @@ @@ -99,6 +99,7 @@
<MenuItem Header="{x:Static properties:Resources.Show_internalTypesMembers}" IsCheckable="True" IsChecked="{Binding SessionSettings.FilterSettings.ApiVisPublicAndInternal}" />
<MenuItem Header="{x:Static properties:Resources.Show_allTypesAndMembers}" IsCheckable="True" IsChecked="{Binding SessionSettings.FilterSettings.ApiVisAll}" />
</MenuItem>
<MenuItem Header="{x:Static properties:Resources._Window}" />
</Menu>
<!-- ToolBar -->
<ToolBar

27
ILSpy/Properties/Resources.Designer.cs generated

@ -267,6 +267,15 @@ namespace ICSharpCode.ILSpy.Properties { @@ -267,6 +267,15 @@ namespace ICSharpCode.ILSpy.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to _Window.
/// </summary>
public static string _Window {
get {
return ResourceManager.GetString("_Window", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to About.
/// </summary>
@ -2051,5 +2060,23 @@ namespace ICSharpCode.ILSpy.Properties { @@ -2051,5 +2060,23 @@ namespace ICSharpCode.ILSpy.Properties {
return ResourceManager.GetString("WatermarkText", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Close all documents.
/// </summary>
public static string Window_CloseAllDocuments {
get {
return ResourceManager.GetString("Window_CloseAllDocuments", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Reset layout.
/// </summary>
public static string Window_ResetLayout {
get {
return ResourceManager.GetString("Window_ResetLayout", resourceCulture);
}
}
}
}

9
ILSpy/Properties/Resources.resx

@ -781,4 +781,13 @@ Are you sure you want to continue?</value> @@ -781,4 +781,13 @@ Are you sure you want to continue?</value>
<data name="Assemblies" xml:space="preserve">
<value>Assemblies</value>
</data>
<data name="Window_CloseAllDocuments" xml:space="preserve">
<value>Close all documents</value>
</data>
<data name="Window_ResetLayout" xml:space="preserve">
<value>Reset layout</value>
</data>
<data name="_Window" xml:space="preserve">
<value>_Window</value>
</data>
</root>
Loading…
Cancel
Save