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
// Now we got a StreamReader with the correct encoding // Now we got a StreamReader with the correct encoding
// Check for XML now // Check for XML now
try { try {
XmlTextReader xmlReader = new XmlTextReader(stream); XmlTextReader xmlReader = new XmlTextReader(reader);
xmlReader.XmlResolver = null; xmlReader.XmlResolver = null;
xmlReader.MoveToContent(); xmlReader.MoveToContent();
return FileType.Xml; return FileType.Xml;

2
ILSpy/MainWindow.xaml

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

7
ILSpy/MainWindow.xaml.cs

@ -57,12 +57,16 @@ namespace ICSharpCode.ILSpy
this.Top = sessionSettings.WindowBounds.Top; this.Top = sessionSettings.WindowBounds.Top;
this.Width = sessionSettings.WindowBounds.Width; this.Width = sessionSettings.WindowBounds.Width;
this.Height = sessionSettings.WindowBounds.Height; 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; this.WindowState = sessionSettings.WindowState;
InitializeComponent(); InitializeComponent();
decompilerTextView.mainWindow = this; 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; sessionSettings.FilterSettings.PropertyChanged += filterSettings_PropertyChanged;
#if DEBUG #if DEBUG
@ -347,6 +351,7 @@ namespace ICSharpCode.ILSpy
sessionSettings.ActiveAssemblyList = assemblyList.ListName; sessionSettings.ActiveAssemblyList = assemblyList.ListName;
sessionSettings.ActiveTreeViewPath = GetPathForNode(treeView.SelectedItem as SharpTreeNode); sessionSettings.ActiveTreeViewPath = GetPathForNode(treeView.SelectedItem as SharpTreeNode);
sessionSettings.WindowBounds = this.RestoreBounds; sessionSettings.WindowBounds = this.RestoreBounds;
sessionSettings.SplitterPosition = leftColumn.Width.Value / (leftColumn.Width.Value + rightColumn.Width.Value);
sessionSettings.Save(); sessionSettings.Save();
} }
} }

3
ILSpy/SessionSettings.cs

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

Loading…
Cancel
Save