diff --git a/Diffusion.Toolkit/Behaviors/DTBehaviors.IsScrollDisabled.cs b/Diffusion.Toolkit/Behaviors/DTBehaviors.IsScrollDisabled.cs index ca335e6..a5b4fb4 100644 --- a/Diffusion.Toolkit/Behaviors/DTBehaviors.IsScrollDisabled.cs +++ b/Diffusion.Toolkit/Behaviors/DTBehaviors.IsScrollDisabled.cs @@ -62,11 +62,13 @@ void ElementOnPreviewMouseWheel(object sender, MouseWheelEventArgs e) private static T GetVisualParent(DependencyObject child) where T : Visual { + var parent = default(T); + var v = (Visual?)VisualTreeHelper.GetParent(child); - var parent = v as T; + parent = v as T; - if (parent == null) + if (parent == null && v != null) { parent = GetVisualParent(v); } diff --git a/Diffusion.Toolkit/Localization/default.json b/Diffusion.Toolkit/Localization/default.json index 607c7cb..f638b56 100644 --- a/Diffusion.Toolkit/Localization/default.json +++ b/Diffusion.Toolkit/Localization/default.json @@ -20,6 +20,7 @@ "Menu.View.FitToPreview": "_Fit to Preview", "Menu.View.TogglePreview": "Show/Hide Preview", "Menu.View.PopoutPreview": "Popout Preview", + "Menu.View.ResetLayout": "Reset Layout", "Menu.Albums": "_Albums", "Menu.Albums.AlbumPane": "Album Pane", "Menu.Albums.Sort": "_Sort", diff --git a/Diffusion.Toolkit/Settings.cs b/Diffusion.Toolkit/Settings.cs index 86e6e3a..bcf7a55 100644 --- a/Diffusion.Toolkit/Settings.cs +++ b/Diffusion.Toolkit/Settings.cs @@ -12,7 +12,7 @@ namespace Diffusion.Toolkit; public interface IScanOptions { - List ImagePaths { get; set; } + List ImagePaths { get; set; } List ExcludePaths { get; set; } @@ -77,8 +77,8 @@ public Settings() : this(false) { Instance = this; } - - public Settings(bool initialize) + + public Settings(bool initialize) { DontShowWelcomeOnStartup = false; ImagePaths = new List(); @@ -98,6 +98,14 @@ public Settings(bool initialize) MetadataSection = new MetadataSectionSettings(); MetadataSection.Attach(this); + MainGridWidth = "5*"; + MainGridWidth2 = "*"; + NavigationThumbnailGridWidth = "*"; + NavigationThumbnailGridWidth2 = "3*"; + PreviewGridHeight = "*"; + PreviewGridHeight2 = "3*"; + + NavigationSection = new NavigationSectionSettings(initialize); NavigationSection.Attach(this); @@ -106,7 +114,7 @@ public Settings(bool initialize) RecurseFolders = true; } } - + public List ImagePaths { get => _imagePaths; @@ -190,7 +198,7 @@ public string? PreviewGridHeight2 private double? _top; private double? _left; - + public double? Top { get => _top; @@ -202,7 +210,7 @@ public double? Left get => _left; set => UpdateValue(ref _left, value); } - + public WindowState? WindowState { get => _windowState; @@ -428,7 +436,7 @@ protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } - + protected bool UpdateValue(ref T field, T value, [CallerMemberName] string propertyName = "") { if (EqualityComparer.Default.Equals(field, value)) return false; @@ -493,7 +501,7 @@ public class NavigationSectionSettings : SettingsContainer private bool _showFolders; private bool _showModels; private bool _showAlbums; - + public NavigationSectionSettings() { @@ -609,7 +617,7 @@ public AccordionState SeedState get => _seedState; set => UpdateValue(ref _seedState, value); } - + public AccordionState SamplerState { get => _samplerState;