From dcf48a1fc99250dd1f4ac2ff1a3bdd0b8a232d95 Mon Sep 17 00:00:00 2001 From: Lorenzo Delana Date: Sun, 22 Jan 2023 15:23:48 +0100 Subject: [PATCH] allow to override treeview fontsize within ILSPY_TREEVIEW_FONTSIZE environment variable --- ILSpy.Core/MainWindow.xaml.cs | 50 ++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/ILSpy.Core/MainWindow.xaml.cs b/ILSpy.Core/MainWindow.xaml.cs index 9103072..dd62e11 100644 --- a/ILSpy.Core/MainWindow.xaml.cs +++ b/ILSpy.Core/MainWindow.xaml.cs @@ -115,34 +115,42 @@ static MainWindow() } public MainWindow() - { - instance = this; - var spySettings = ILSpySettings.Load(); - this.spySettingsForMainWindow_Loaded = spySettings; - this.sessionSettings = new SessionSettings(spySettings); - this.assemblyListManager = new AssemblyListManager(spySettings); - - InitializeComponent(); + { + instance = this; + var spySettings = ILSpySettings.Load(); + this.spySettingsForMainWindow_Loaded = spySettings; + this.sessionSettings = new SessionSettings(spySettings); + this.assemblyListManager = new AssemblyListManager(spySettings); + + InitializeComponent(); + + var q = Environment.GetEnvironmentVariable("ILSPY_TREEVIEW_FONTSIZE"); + if (q != null) + { + var invariant = System.Globalization.CultureInfo.InvariantCulture; + if (double.TryParse(q, System.Globalization.NumberStyles.Any, invariant.NumberFormat, out var fontSize)) + this.treeView.FontSize = fontSize; + } - this.DataContext = sessionSettings; + this.DataContext = sessionSettings; #if DEBUG - this.AttachDevTools(); + this.AttachDevTools(); #endif - decompilerTextView = App.ExportProvider.GetExportedValue(); - mainPane.Content = decompilerTextView; - + decompilerTextView = App.ExportProvider.GetExportedValue(); + mainPane.Content = decompilerTextView; + 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; - - ContextMenuProvider.Add(treeView, decompilerTextView); + leftColumn.Width = new GridLength(sessionSettings.SplitterPosition, GridUnitType.Star); + rightColumn.Width = new GridLength(1 - sessionSettings.SplitterPosition, GridUnitType.Star); + } + sessionSettings.FilterSettings.PropertyChanged += filterSettings_PropertyChanged; - } - private void InitializeComponent() + ContextMenuProvider.Add(treeView, decompilerTextView); + + } + private void InitializeComponent() { AvaloniaXamlLoader.Load(this); mainMenu = this.FindControl("mainMenu");