Browse Source

Save the splitter position.

pull/1/head
Daniel Grunwald 15 years ago
parent
commit
8e83ecc944
  1. 2
      ILSpy/GuessFileType.cs
  2. 2
      ILSpy/MainWindow.xaml
  3. 7
      ILSpy/MainWindow.xaml.cs
  4. 3
      ILSpy/SessionSettings.cs

2
ILSpy/GuessFileType.cs

@ -48,7 +48,7 @@ namespace ICSharpCode.ILSpy @@ -48,7 +48,7 @@ namespace ICSharpCode.ILSpy
// Now we got a StreamReader with the correct encoding
// Check for XML now
try {
XmlTextReader xmlReader = new XmlTextReader(stream);
XmlTextReader xmlReader = new XmlTextReader(reader);
xmlReader.XmlResolver = null;
xmlReader.MoveToContent();
return FileType.Xml;

2
ILSpy/MainWindow.xaml

@ -97,11 +97,13 @@ @@ -97,11 +97,13 @@
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition
Name="leftColumn"
MinWidth="100"
Width="0.4*" />
<ColumnDefinition
Width="3" />
<ColumnDefinition
Name="rightColumn"
MinWidth="100"
Width="0.6*" />
</Grid.ColumnDefinitions>

7
ILSpy/MainWindow.xaml.cs

@ -57,12 +57,16 @@ namespace ICSharpCode.ILSpy @@ -57,12 +57,16 @@ namespace ICSharpCode.ILSpy
this.Top = sessionSettings.WindowBounds.Top;
this.Width = sessionSettings.WindowBounds.Width;
this.Height = sessionSettings.WindowBounds.Height;
// TODO: validate bounds (maybe a screen was removed...)
// TODO: validate bounds (maybe a monitor was removed...)
this.WindowState = sessionSettings.WindowState;
InitializeComponent();
decompilerTextView.mainWindow = this;
if (sessionSettings.SplitterPosition > 0 && sessionSettings.SplitterPosition < 1) {
leftColumn.Width = new GridLength(sessionSettings.SplitterPosition, GridUnitType.Star);
rightColumn.Width = new GridLength(1 - sessionSettings.SplitterPosition, GridUnitType.Star);
}
sessionSettings.FilterSettings.PropertyChanged += filterSettings_PropertyChanged;
#if DEBUG
@ -347,6 +351,7 @@ namespace ICSharpCode.ILSpy @@ -347,6 +351,7 @@ namespace ICSharpCode.ILSpy
sessionSettings.ActiveAssemblyList = assemblyList.ListName;
sessionSettings.ActiveTreeViewPath = GetPathForNode(treeView.SelectedItem as SharpTreeNode);
sessionSettings.WindowBounds = this.RestoreBounds;
sessionSettings.SplitterPosition = leftColumn.Width.Value / (leftColumn.Width.Value + rightColumn.Width.Value);
sessionSettings.Save();
}
}

3
ILSpy/SessionSettings.cs

@ -48,6 +48,7 @@ namespace ICSharpCode.ILSpy @@ -48,6 +48,7 @@ namespace ICSharpCode.ILSpy
this.WindowState = FromString((string)doc.Element("WindowState"), WindowState.Normal);
this.WindowBounds = FromString((string)doc.Element("WindowBounds"), new Rect(10, 10, 750, 550));
this.SplitterPosition = FromString((string)doc.Element("SplitterPosition"), 0.4);
}
public event PropertyChangedEventHandler PropertyChanged;
@ -66,6 +67,7 @@ namespace ICSharpCode.ILSpy @@ -66,6 +67,7 @@ namespace ICSharpCode.ILSpy
public WindowState WindowState = WindowState.Normal;
public Rect WindowBounds;
public double SplitterPosition;
public void Save()
{
@ -79,6 +81,7 @@ namespace ICSharpCode.ILSpy @@ -79,6 +81,7 @@ namespace ICSharpCode.ILSpy
}
doc.Add(new XElement("WindowState", ToString(this.WindowState)));
doc.Add(new XElement("WindowBounds", ToString(this.WindowBounds)));
doc.Add(new XElement("SplitterPosition", ToString(this.SplitterPosition)));
ILSpySettings.SaveSettings(doc);
}

Loading…
Cancel
Save