Explorar o código

Interface and window fixes

Ruben %!s(int64=6) %!d(string=hai) anos
pai
achega
e29b1b5531

+ 18 - 0
PicView/App.config

@@ -115,6 +115,24 @@
             <setting name="FitToWindow" serializeAs="String">
                 <value>True</value>
             </setting>
+            <setting name="Top" serializeAs="String">
+                <value>0</value>
+            </setting>
+            <setting name="Left" serializeAs="String">
+                <value>0</value>
+            </setting>
+            <setting name="Height" serializeAs="String">
+                <value>0</value>
+            </setting>
+            <setting name="Width" serializeAs="String">
+                <value>0</value>
+            </setting>
+            <setting name="Maximized" serializeAs="String">
+                <value>False</value>
+            </setting>
+            <setting name="Fullscreen" serializeAs="String">
+                <value>False</value>
+            </setting>
         </PicView.Properties.Settings>
     </userSettings>
   <runtime>

+ 2 - 2
PicView/Error Handling/Error_Handling.cs

@@ -18,13 +18,13 @@ namespace PicView
     internal static class Error_Handling
     {
         /// <summary>
-        /// Attemps to fix Pics list by removing invalid files
+        /// Attemps to fix erros and prevent crashes
         /// </summary>
         /// <param name="x">The index to start from</param>
         internal static bool PicErrorFix(int x)
         {
 #if DEBUG
-            Trace.WriteLine("Entered PicErrorFix");
+            Trace.WriteLine("Entered PicErrorFix"); // We don't want to go in here
 #endif
             if (Pics == null)
             {

+ 4 - 10
PicView/File Logic/Open_Save.cs

@@ -43,6 +43,7 @@ namespace PicView
             };
             if (dlg.ShowDialog() == true)
             {
+                
                 Pic(dlg.FileName);
 
                 if (string.IsNullOrWhiteSpace(PicPath))
@@ -69,23 +70,16 @@ namespace PicView
             {
                 if (Savedlg.ShowDialog() == true)
                 {
-                    if (TrySaveImage(Rotateint, Flipped, PicPath, Savedlg.FileName) == false)
-                    {
-                        ToolTipStyle("Error, File didn't get saved - File not Found.");
-                    }
+                    if (!TrySaveImage(Rotateint, Flipped, PicPath, Savedlg.FileName))
+                        ToolTipStyle("Error, File didn't get saved");
                 }
-                else
-                    return;
+                else return;
 
                 //Refresh the list of pictures.
                 Reload();
 
                 Close_UserControls();
             }
-            else if (mainWindow.img.Source != null)
-            {
-                ToolTipStyle("Error, File does not exist, or something went wrong...");
-            }
         }
     }
 }

+ 3 - 5
PicView/Helpers/Fields.cs

@@ -20,8 +20,7 @@ namespace PicView
         internal const string FileCopy = "File copied to Clipboard";
         internal const string ImageCopy = "Image copied to Clipboard";
         internal const string ExpFind = "Locating in file explorer";
-        internal const string NoImage = "No image loaded";
-        
+        internal const string NoImage = "No image loaded";        
 
         internal const string SupportedFiles =
         " *.jpg *.jpeg *.jpe *.png *.bmp *.tif *.tiff *.gif *.ico *.wdp *.svg *.psd *.psb *.orf *.cr2 *.crw *.dng *.raf *.raw *.mrw *.nef *.x3f *.arw *.webp *"
@@ -54,8 +53,6 @@ namespace PicView
 
         internal static MainWindow mainWindow = ((MainWindow)Application.Current.MainWindow);
 
-        internal static FakeWindow fake;
-
         /// <summary>
         /// File path of current image
         /// </summary>
@@ -110,7 +107,7 @@ namespace PicView
         internal static bool fileMenuOpen;
         internal static bool quickSettingsMenuOpen;
         internal static bool functionsMenuOpen;
-        internal static bool FastPicRunning;
+        //internal static bool FastPicRunning;
         internal static bool isZoomed;
         internal static bool Flipped;
         internal static bool canNavigate;
@@ -121,6 +118,7 @@ namespace PicView
         internal static bool clickArrowLeftClicked;
         internal static bool SlideshowActive;
         internal static bool reverse;
+        //internal static bool dialogOpen;
 
         /// <summary>
         /// Used as comfortable space for standard viewing

+ 10 - 0
PicView/Helpers/Helper.cs

@@ -1,6 +1,7 @@
 using Microsoft.WindowsAPICodePack.Taskbar;
 using System.Diagnostics;
 using System.Windows;
+using System.Windows.Media;
 
 namespace PicView
 {
@@ -64,6 +65,15 @@ namespace PicView
             }
         }
 
+        internal static void RemoveBorderColor()
+        {
+            if (Properties.Settings.Default.WindowBorderColorEnabled)
+            {
+                var bgBrush = Application.Current.Resources["WindowBackgroundColorBrush"] as System.Windows.Media.SolidColorBrush;
+                bgBrush.Color = Colors.Black;
+            }
+        }
+
         internal static string Shorten(string name,int amount)
         {
             if (name.Length >= 25)

+ 2 - 2
PicView/Image Logic/Navigation.cs

@@ -397,7 +397,7 @@ namespace PicView
 
             mainWindow.img.Source = Preloader.Contains(Pics[FolderIndex]) ? Preloader.Load(Pics[FolderIndex]) : GetBitmapSourceThumb(Pics[FolderIndex]);
             Progress(FolderIndex, Pics.Count);
-            FastPicRunning = true;
+            //FastPicRunning = true;
 
         }
 
@@ -407,7 +407,7 @@ namespace PicView
         internal static void FastPicUpdate()
         {
             //fastPicTimer.Stop();
-            FastPicRunning = false;
+            //FastPicRunning = false;
 
             //if (!Preloader.Contains(Pics[FolderIndex]))
             //{

+ 5 - 4
PicView/Image Logic/Resize_and_Zoom.cs

@@ -6,7 +6,7 @@ using System.Windows.Media;
 using static PicView.Fields;
 using static PicView.Interface;
 using static PicView.Navigation;
-using static PicView.ResizeLogic;
+using static PicView.WindowLogic;
 
 namespace PicView
 {
@@ -84,7 +84,7 @@ namespace PicView
         {
             if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
             {
-                mainWindow.Move(sender, e);
+                Move(sender, e);
                 return;
             }
             if (autoScrolling)
@@ -111,7 +111,7 @@ namespace PicView
         internal static void Bg_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
         {
             if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
-                mainWindow.Move(sender, e);
+                Move(sender, e);
         }
 
         /// <summary>
@@ -415,7 +415,8 @@ namespace PicView
                 mainWindow.Bar.MaxWidth = xWidth - interfaceSize < interfaceSize ? interfaceSize : xWidth - interfaceSize;
 
                 // Loses position gradually if not forced to center
-                mainWindow.CenterWindowOnScreen();
+                if (!Properties.Settings.Default.Fullscreen)
+                    CenterWindowOnScreen();
             }
 
 

+ 1 - 1
PicView/Interface Logic/ContextMenus.cs

@@ -282,7 +282,7 @@ namespace PicView
             {
                 Header = "Next picture",
                 InputGestureText = "ᗌ or D",
-                ToolTip = "Go to Next image in folder",
+                ToolTip = "Go to Next image",
                 StaysOpenOnClick = true
             };
             nextcm.Click += (s, x) => Pic();

+ 15 - 11
PicView/Interface Logic/Interface.cs

@@ -128,6 +128,7 @@ namespace PicView
         /// </summary>
         internal static void HideInterface(bool slideshow = false, bool navigationButtons = true)
         {
+            // Hide interface
             if (Properties.Settings.Default.ShowInterface)
             {
                 mainWindow.TitleBar.Visibility =
@@ -140,31 +141,34 @@ namespace PicView
                     clickArrowLeft.Visibility =
                     clickArrowRight.Visibility =
                     x2.Visibility =
-                    minus.Visibility =
-                    Visibility.Visible;
+                    minus.Visibility = Visibility.Visible;
+                else
+                    clickArrowLeft.Visibility =
+                    clickArrowRight.Visibility =
+                    x2.Visibility =
+                    minus.Visibility = Visibility.Collapsed;
 
-                if (!slideshow)
+                if (!slideshow || !Properties.Settings.Default.Fullscreen)
                     Properties.Settings.Default.ShowInterface = false;
 
                 if (activityTimer != null)
                     activityTimer.Start();
             }
+            // Show interface
             else
             {
                 mainWindow.TitleBar.Visibility =
                 mainWindow.LowerBar.Visibility =
                 mainWindow.LeftBorderRectangle.Visibility =
-                mainWindow.RightBorderRectangle.Visibility
-                = Visibility.Visible;
+                mainWindow.RightBorderRectangle.Visibility = Visibility.Visible;
 
-                if (navigationButtons)
-                    clickArrowLeft.Visibility =
-                    clickArrowRight.Visibility =
-                    x2.Visibility =
-                    minus.Visibility =
-                    Visibility.Collapsed;
+                clickArrowLeft.Visibility =
+                clickArrowRight.Visibility =
+                x2.Visibility =
+                minus.Visibility = Visibility.Collapsed;
 
                 Properties.Settings.Default.ShowInterface = true;
+
                 if (activityTimer != null)
                     activityTimer.Stop();
             }

+ 1 - 0
PicView/Interface Logic/PicGalleryLogic.cs

@@ -14,6 +14,7 @@ using static PicView.Fields;
 using static PicView.ImageManager;
 using static PicView.Interface;
 using static PicView.Navigation;
+using static PicView.WindowLogic;
 
 
 namespace PicView

+ 0 - 46
PicView/Interface Logic/ResizeLogic.cs

@@ -1,46 +0,0 @@
-using System.Windows;
-using static PicView.Fields;
-using static PicView.Resize_and_Zoom;
-
-namespace PicView
-{
-    internal static class ResizeLogic
-    {
-        /// <summary>
-        /// Set whether to fit window to image or image to window
-        /// </summary>
-        internal static bool FitToWindow
-        {
-            get
-            {
-                return Properties.Settings.Default.FitToWindow;
-            }
-            set
-            {
-                Properties.Settings.Default.FitToWindow = value;
-
-                if (value)
-                {
-                    mainWindow.SizeToContent = SizeToContent.WidthAndHeight;
-                    mainWindow.ResizeMode = ResizeMode.NoResize;
-
-                    if (quickSettingsMenu != null)
-                        quickSettingsMenu.SetFit.IsChecked = true;
-
-                    mainWindow.WindowState = WindowState.Normal;
-
-                }
-                else
-                {
-                    mainWindow.SizeToContent = SizeToContent.Manual;
-                    mainWindow.ResizeMode = ResizeMode.CanResizeWithGrip;
-
-                    if (quickSettingsMenu != null)
-                        quickSettingsMenu.SetCenter.IsChecked = true;
-                }
-
-                if (mainWindow.img.Source != null)
-                    ZoomFit(mainWindow.img.Source.Width, mainWindow.img.Source.Height);            }
-        }
-    }
-}

+ 2 - 2
PicView/Interface Logic/SlideShow.cs

@@ -6,7 +6,7 @@ using System.Windows.Input;
 using static PicView.Fields;
 using static PicView.Interface;
 using static PicView.Navigation;
-using static PicView.ResizeLogic;
+using static PicView.WindowLogic;
 
 namespace PicView
 {
@@ -25,7 +25,7 @@ namespace PicView
             }
 
             if (mainWindow.WindowState == WindowState.Maximized)
-                mainWindow.Maximize_Restore();
+                Maximize_Restore();
 
             HideInterface(false);
             mainWindow.Topmost = true;

+ 203 - 0
PicView/Interface Logic/WindowLogic.cs

@@ -0,0 +1,203 @@
+using PicView.Windows;
+using System;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+using static PicView.Fields;
+using static PicView.Helper;
+using static PicView.Interface;
+using static PicView.Resize_and_Zoom;
+
+namespace PicView
+{
+    internal static class WindowLogic
+    {
+        internal static FakeWindow fake;
+
+        /// <summary>
+        /// Set whether to fit window to image or image to window
+        /// </summary>
+        internal static bool FitToWindow
+        {
+            get
+            {
+                return Properties.Settings.Default.FitToWindow;
+            }
+            set
+            {
+                Properties.Settings.Default.FitToWindow = value;
+
+                if (value)
+                {
+                    mainWindow.SizeToContent = SizeToContent.WidthAndHeight;
+                    mainWindow.ResizeMode = ResizeMode.NoResize;
+
+                    if (quickSettingsMenu != null)
+                        quickSettingsMenu.SetFit.IsChecked = true;
+
+                    mainWindow.WindowState = WindowState.Normal;
+
+                }
+                else
+                {
+                    mainWindow.SizeToContent = SizeToContent.Manual;
+                    mainWindow.ResizeMode = ResizeMode.CanResizeWithGrip;
+
+                    if (quickSettingsMenu != null)
+                        quickSettingsMenu.SetCenter.IsChecked = true;
+                }
+
+                if (mainWindow.img.Source != null)
+                    ZoomFit(mainWindow.img.Source.Width, mainWindow.img.Source.Height);
+            }
+        }
+
+        #region Window Functions
+
+        /// <summary>
+        /// Move window and maximize on double click
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        internal static void Move(object sender, MouseButtonEventArgs e)
+        {
+            if (e.ChangedButton != MouseButton.Left)
+                return;
+
+            if (e.ClickCount == 2)
+            {
+                // Prevent method from being called twice
+                var bar = sender as TextBlock;
+                if (bar != null)
+                {
+                    if (bar.Name == "Bar")
+                        return;
+                }
+                Maximize_Restore();
+            }
+            else
+            {
+                if (e.LeftButton == MouseButtonState.Pressed)
+                    mainWindow.DragMove();
+
+                // Update info for possible new screen, needs more engineering
+                MonitorInfo = MonitorSize.GetMonitorSize();
+            }
+        }
+
+
+        /// <summary>
+        /// Function made to restore and drag window from maximized windowstate
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        internal static void Restore_From_Move(object sender, MouseEventArgs e)
+        {
+            if (mainWindow.WindowState == WindowState.Maximized && e.LeftButton == MouseButtonState.Pressed)
+            {
+                //Maximize_Restore();
+                try
+                {
+                    mainWindow.DragMove();
+                }
+                catch (InvalidOperationException)
+                {
+                    //Supress "Can only call DragMove when primary mouse button is down"
+                }
+            }
+        }
+
+        /// <summary>
+        /// Maximizes/restore window
+        /// </summary>
+        internal static void Maximize_Restore()
+        {
+            // Maximize
+            if (mainWindow.WindowState == WindowState.Normal)
+            {
+                // Update new setting and sizing
+                if (FitToWindow)
+                    FitToWindow = false;
+
+                // Tell Windows that it's maximized
+                mainWindow.WindowState = WindowState.Maximized;
+                SystemCommands.MaximizeWindow(mainWindow);
+            }
+
+            // Restore
+            else if (mainWindow.WindowState == WindowState.Maximized)
+            {
+                // Update new setting and sizing
+                FitToWindow = true;
+
+                // Tell Windows that it's normal
+                mainWindow.WindowState = WindowState.Normal;
+                SystemCommands.RestoreWindow(mainWindow);
+            }
+        }
+
+        /// <summary>
+        /// Fullscreen/restore window
+        /// </summary>
+        internal static void Fullscreen_Restore(bool startup = false)
+        {
+            if (startup || !Properties.Settings.Default.Fullscreen)
+            {
+                Properties.Settings.Default.Fullscreen = true;
+                // Update new setting and sizing
+                //FitToWindow = false;
+
+                HideInterface(false, false);
+
+                mainWindow.TitleBar.Visibility =
+                mainWindow.LowerBar.Visibility =
+                mainWindow.LeftBorderRectangle.Visibility =
+                mainWindow.RightBorderRectangle.Visibility = Visibility.Collapsed;
+
+
+                mainWindow.ResizeMode = ResizeMode.NoResize;
+                mainWindow.SizeToContent = SizeToContent.Manual;
+                mainWindow.Width = mainWindow.bg.Width = SystemParameters.PrimaryScreenWidth + 2;
+                mainWindow.Height = SystemParameters.PrimaryScreenHeight + 2;
+
+                mainWindow.Top = 0;
+                mainWindow.Left = 0;
+
+                mainWindow.Topmost = true;
+
+
+
+                RemoveBorderColor();
+            }
+            else
+            {
+                Properties.Settings.Default.Fullscreen = false;
+                FitToWindow = FitToWindow; // Just run it...
+
+                HideInterface();
+
+                mainWindow.Width = mainWindow.bg.Width = double.NaN;
+                mainWindow.Height = mainWindow.bg.Height = double.NaN;
+                mainWindow.Topmost = false;
+                UpdateColor(); // Regain border
+            }
+
+        }
+
+        /// <summary>
+        /// Centers on the current monitor
+        /// </summary>
+        internal static void CenterWindowOnScreen()
+        {
+            if (!FitToWindow)
+                return;
+
+            //move to the centre
+            mainWindow.Left = (((MonitorInfo.WorkArea.Width - (mainWindow.Width * MonitorInfo.DpiScaling)) / 2) + (MonitorInfo.WorkArea.Left * MonitorInfo.DpiScaling));
+            mainWindow.Top = ((MonitorInfo.WorkArea.Height - (mainWindow.Height * MonitorInfo.DpiScaling)) / 2) + (MonitorInfo.WorkArea.Top * MonitorInfo.DpiScaling);
+
+        }
+
+        #endregion
+    }
+}

+ 31 - 130
PicView/MainWindow.xaml.cs

@@ -5,7 +5,6 @@ using System.Collections.Generic;
 using System.ComponentModel;
 using System.Windows;
 using System.Windows.Controls;
-using System.Windows.Input;
 using System.Windows.Media;
 using static PicView.ContextMenus;
 using static PicView.Copy_Paste;
@@ -22,12 +21,12 @@ using static PicView.Navigation;
 using static PicView.Open_Save;
 using static PicView.PicGalleryLogic;
 using static PicView.Resize_and_Zoom;
-using static PicView.ResizeLogic;
 using static PicView.Rotate_and_Flip;
 using static PicView.Shortcuts;
 using static PicView.SlideShow;
 using static PicView.Timers;
 using static PicView.ToggleMenus;
+using static PicView.WindowLogic;
 
 namespace PicView
 {
@@ -39,6 +38,22 @@ namespace PicView
             InitializeComponent();
             Loaded += (s, e) => MainWindow_Loaded(s, e);
             ContentRendered += MainWindow_ContentRendered;
+
+            // If normal window style
+            if (!Properties.Settings.Default.FitToWindow)
+            {
+                Top = Properties.Settings.Default.Top;
+                Left = Properties.Settings.Default.Left;
+                Height = Properties.Settings.Default.Height;
+                Width = Properties.Settings.Default.Width;
+
+                if (Properties.Settings.Default.Maximized)
+                {
+                    WindowState = WindowState.Maximized;
+                }
+                FitToWindow = false;
+            }
+            else FitToWindow = true;
         }
 
         #region Loaded and Rendered
@@ -71,7 +86,6 @@ namespace PicView
             freshStartup = true;
             DataContext = this;
             MonitorInfo = MonitorSize.GetMonitorSize();
-            FitToWindow = Properties.Settings.Default.FitToWindow;
 
             if (!Properties.Settings.Default.BgColorWhite)
                 imgBorder.Background = new SolidColorBrush(Colors.Transparent);
@@ -112,14 +126,16 @@ namespace PicView
                 minus.Visibility =
                 Visibility.Visible;
             }
+            if (Properties.Settings.Default.Fullscreen)
+                Fullscreen_Restore(true);
 
             // Update UserControl values
             mainColor = (Color)Application.Current.Resources["MainColor"];
             quickSettingsMenu.ToggleScroll.IsChecked = IsScrollEnabled;
             if (FitToWindow)
             {
-                quickSettingsMenu.SetFit.IsChecked = false;
-                quickSettingsMenu.SetCenter.IsChecked = true;
+                quickSettingsMenu.SetFit.IsChecked = true;
+                quickSettingsMenu.SetCenter.IsChecked = false;
             }
 
             else
@@ -414,131 +430,7 @@ namespace PicView
 
         #endregion Changed Events
 
-        #region Window Functions
-
-        /// <summary>
-        /// Move window and maximize on double click
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        internal void Move(object sender, MouseButtonEventArgs e)
-        {
-            if (e.ChangedButton != MouseButton.Left)
-                return;
-
-            if (e.ClickCount == 2)
-            {
-                // Prevent method from being called twice
-                var bar = sender as TextBlock;
-                if (bar != null)
-                {
-                    if (bar.Name == "Bar")
-                        return;
-                }
-                Maximize_Restore();
-            }
-            else
-            {
-                if (e.LeftButton == MouseButtonState.Pressed)
-                DragMove();
-
-                // Update info for possible new screen, needs more engineering
-                MonitorInfo = MonitorSize.GetMonitorSize();
-            }
-        }
-
-
-        /// <summary>
-        /// Function made to restore and drag window from maximized windowstate
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void Restore_From_Move(object sender, MouseEventArgs e)
-        {
-            if (WindowState == WindowState.Maximized && e.LeftButton == MouseButtonState.Pressed)
-            {
-                //Maximize_Restore();
-                try
-                {
-                    DragMove();
-                }
-                catch (InvalidOperationException)
-                {
-                    //Supress "Can only call DragMove when primary mouse button is down"
-                }
-            }
-        }
-
-        /// <summary>
-        /// Maximizes/restore window
-        /// </summary>
-        internal void Maximize_Restore()
-        {
-            // Maximize
-            if (WindowState == WindowState.Normal)
-            {
-                // Update new setting and sizing
-                FitToWindow = false;
-
-                // Tell Windows that it's maximized
-                WindowState = WindowState.Maximized;
-                SystemCommands.MaximizeWindow(this);
-
-                //// Update button to reflect change
-                //MaxButton.ToolTip = "Restore";
-                //MaxButtonPath.Data = Geometry.Parse("M143-7h428v286h-428v-286z m571 286h286v428h-429v-143h54q37 0 63-26t26-63v-196z m429 482v-536q0-37-26-63t-63-26h-340v-197q0-37-26-63t-63-26h-536q-36 0-63 26t-26 63v536q0 37 26 63t63 26h340v197q0 37 26 63t63 26h536q36 0 63-26t26-63z");
-            }
-
-            // Restore
-            else if (WindowState == WindowState.Maximized)
-            {
-                // Update new setting and sizing
-                FitToWindow = true;
-
-                // Tell Windows that it's normal
-                WindowState = WindowState.Normal;
-                SystemCommands.RestoreWindow(this);
-
-                //// Update button to reflect change
-                //MaxButton.ToolTip = "Maximize";
-                //MaxButtonPath.Data = Geometry.Parse("M143 64h714v429h-714v-429z m857 625v-678q0-37-26-63t-63-27h-822q-36 0-63 27t-26 63v678q0 37 26 63t63 27h822q37 0 63-27t26-63z");
-            }
-        }
-
-        /// <summary>
-        /// Fullscreen/restore window
-        /// </summary>
-        internal void Fullscreen_Restore()
-        {
-            // Update new setting and sizing
-            FitToWindow = false;
-
-            HideInterface(false, false);
-
-            Width = bg.Width = SystemParameters.PrimaryScreenWidth + 2;
-            Height = bg.Height = SystemParameters.PrimaryScreenHeight + 2;
-
-            Top = 0;
-            Left = 0;
-
-            Topmost = true;
-        }
-
-        /// <summary>
-        /// Centers on the current monitor
-        /// </summary>
-        internal void CenterWindowOnScreen()
-        {
-            if (!FitToWindow)
-                return;
-
-            //move to the centre
-            Left = (((MonitorInfo.WorkArea.Width - (Width * MonitorInfo.DpiScaling)) / 2) + (MonitorInfo.WorkArea.Left * MonitorInfo.DpiScaling));
-            Top = ((MonitorInfo.WorkArea.Height - (Height * MonitorInfo.DpiScaling)) / 2) + (MonitorInfo.WorkArea.Top * MonitorInfo.DpiScaling);
-
-        }
-
-        #endregion
+        
 
         /// <summary>
         /// Save settings when closing
@@ -553,6 +445,15 @@ namespace PicView
 
             Hide(); // Make it feel faster
 
+            if (!Properties.Settings.Default.FitToWindow)
+            {
+                Properties.Settings.Default.Top = Top;
+                Properties.Settings.Default.Left = Left;
+                Properties.Settings.Default.Height = Height;
+                Properties.Settings.Default.Width = Width;
+                Properties.Settings.Default.Maximized = WindowState == WindowState.Maximized;
+            }
+
             Properties.Settings.Default.Save();
             DeleteTempFiles();
             RecentFiles.WriteToFile();

+ 5 - 5
PicView/PicVIew.csproj

@@ -93,8 +93,8 @@
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="Magick.NET-Q16-HDRI-x64, Version=7.14.2.0, Culture=neutral, PublicKeyToken=2004825badfa91ec, processorArchitecture=AMD64">
-      <HintPath>..\packages\Magick.NET-Q16-HDRI-x64.7.14.2\lib\net40\Magick.NET-Q16-HDRI-x64.dll</HintPath>
+    <Reference Include="Magick.NET-Q16-x64, Version=7.14.3.0, Culture=neutral, PublicKeyToken=2004825badfa91ec, processorArchitecture=AMD64">
+      <HintPath>..\packages\Magick.NET-Q16-x64.7.14.3\lib\net40\Magick.NET-Q16-x64.dll</HintPath>
     </Reference>
     <Reference Include="Microsoft.VisualBasic" />
     <Reference Include="Microsoft.WindowsAPICodePack, Version=1.1.3.3, Culture=neutral, PublicKeyToken=8985beaab7ea3f04, processorArchitecture=MSIL">
@@ -156,7 +156,7 @@
     <Compile Include="Interface Logic\PicGalleryLogic.cs" />
     <Compile Include="Image Logic\Resize_and_Zoom.cs" />
     <Compile Include="Image Logic\Rotate_and_Flip.cs" />
-    <Compile Include="Interface Logic\ResizeLogic.cs" />
+    <Compile Include="Interface Logic\WindowLogic.cs" />
     <Compile Include="Interface Logic\SlideShow.cs" />
     <Compile Include="Interface Logic\ContextMenus.cs" />
     <Compile Include="Interface Logic\Interface.cs" />
@@ -443,12 +443,12 @@
     <PostBuildEvent>
     </PostBuildEvent>
   </PropertyGroup>
-  <Import Project="..\packages\Magick.NET-Q16-HDRI-x64.7.14.2\build\net40\Magick.NET-Q16-HDRI-x64.targets" Condition="Exists('..\packages\Magick.NET-Q16-HDRI-x64.7.14.2\build\net40\Magick.NET-Q16-HDRI-x64.targets')" />
+  <Import Project="..\packages\Magick.NET-Q16-x64.7.14.3\build\net40\Magick.NET-Q16-x64.targets" Condition="Exists('..\packages\Magick.NET-Q16-x64.7.14.3\build\net40\Magick.NET-Q16-x64.targets')" />
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
     <PropertyGroup>
       <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
     </PropertyGroup>
-    <Error Condition="!Exists('..\packages\Magick.NET-Q16-HDRI-x64.7.14.2\build\net40\Magick.NET-Q16-HDRI-x64.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Magick.NET-Q16-HDRI-x64.7.14.2\build\net40\Magick.NET-Q16-HDRI-x64.targets'))" />
+    <Error Condition="!Exists('..\packages\Magick.NET-Q16-x64.7.14.3\build\net40\Magick.NET-Q16-x64.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Magick.NET-Q16-x64.7.14.3\build\net40\Magick.NET-Q16-x64.targets'))" />
   </Target>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.

+ 72 - 0
PicView/Properties/Settings.Designer.cs

@@ -442,5 +442,77 @@ namespace PicView.Properties {
                 this["FitToWindow"] = value;
             }
         }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("0")]
+        public double Top {
+            get {
+                return ((double)(this["Top"]));
+            }
+            set {
+                this["Top"] = value;
+            }
+        }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("0")]
+        public double Left {
+            get {
+                return ((double)(this["Left"]));
+            }
+            set {
+                this["Left"] = value;
+            }
+        }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("0")]
+        public double Height {
+            get {
+                return ((double)(this["Height"]));
+            }
+            set {
+                this["Height"] = value;
+            }
+        }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("0")]
+        public double Width {
+            get {
+                return ((double)(this["Width"]));
+            }
+            set {
+                this["Width"] = value;
+            }
+        }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("False")]
+        public bool Maximized {
+            get {
+                return ((bool)(this["Maximized"]));
+            }
+            set {
+                this["Maximized"] = value;
+            }
+        }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("False")]
+        public bool Fullscreen {
+            get {
+                return ((bool)(this["Fullscreen"]));
+            }
+            set {
+                this["Fullscreen"] = value;
+            }
+        }
     }
 }

+ 18 - 0
PicView/Properties/Settings.settings

@@ -107,5 +107,23 @@
     <Setting Name="FitToWindow" Type="System.Boolean" Scope="User">
       <Value Profile="(Default)">True</Value>
     </Setting>
+    <Setting Name="Top" Type="System.Double" Scope="User">
+      <Value Profile="(Default)">0</Value>
+    </Setting>
+    <Setting Name="Left" Type="System.Double" Scope="User">
+      <Value Profile="(Default)">0</Value>
+    </Setting>
+    <Setting Name="Height" Type="System.Double" Scope="User">
+      <Value Profile="(Default)">0</Value>
+    </Setting>
+    <Setting Name="Width" Type="System.Double" Scope="User">
+      <Value Profile="(Default)">0</Value>
+    </Setting>
+    <Setting Name="Maximized" Type="System.Boolean" Scope="User">
+      <Value Profile="(Default)">False</Value>
+    </Setting>
+    <Setting Name="Fullscreen" Type="System.Boolean" Scope="User">
+      <Value Profile="(Default)">False</Value>
+    </Setting>
   </Settings>
 </SettingsFile>

+ 15 - 10
PicView/Shortcuts/Shortcuts.cs

@@ -14,6 +14,7 @@ using static PicView.Resize_and_Zoom;
 using static PicView.Rotate_and_Flip;
 using static PicView.SlideShow;
 using static PicView.ToggleMenus;
+using static PicView.WindowLogic;
 
 namespace PicView
 {
@@ -346,8 +347,8 @@ namespace PicView
             // FastPicUpdate()
             if (e.Key == Key.Left || e.Key == Key.A || e.Key == Key.Right || e.Key == Key.D)
             {
-                if (!FastPicRunning)
-                    return;
+                //if (!FastPicRunning)
+                //    return;
                 FastPicUpdate();
             }
 
@@ -362,11 +363,15 @@ namespace PicView
                 {
                     UnloadSlideshow();
                 }
-                else if (picGallery != null)
+                else if (Properties.Settings.Default.Fullscreen)
                 {
-                    if (Properties.Settings.Default.PicGallery != 2 && PicGalleryLogic.IsOpen)
+                    Fullscreen_Restore();
+                }
+                else if (Properties.Settings.Default.PicGallery > 0)
+                {
+                    if (PicGalleryLogic.IsOpen)
                         PicGalleryLogic.PicGalleryToggle();
-                    else
+                    else 
                         SystemCommands.CloseWindow(mainWindow);
                 }
                 else
@@ -450,7 +455,7 @@ namespace PicView
             // Alt + Enter
             else if (e.KeyboardDevice.Modifiers == ModifierKeys.Alt && (e.SystemKey == Key.Enter))
             {
-                mainWindow.Fullscreen_Restore();
+                Maximize_Restore();
             }
 
             // Space
@@ -464,7 +469,7 @@ namespace PicView
                         return;
                     }
                 }
-                mainWindow.CenterWindowOnScreen();
+                CenterWindowOnScreen();
             }
 
             // F1
@@ -505,10 +510,10 @@ namespace PicView
                 ResetZoom();
             }
 
-            //F10
-            else if (e.Key == Key.F10)
+            //F11
+            else if (e.Key == Key.F11)
             {
-                mainWindow.Fullscreen_Restore();
+                Fullscreen_Restore();
             }
 
             //F12

+ 1 - 1
PicView/packages.config

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
-  <package id="Magick.NET-Q16-HDRI-x64" version="7.14.2" targetFramework="net472" />
+  <package id="Magick.NET-Q16-x64" version="7.14.3" targetFramework="net48" />
   <package id="Microsoft-WindowsAPICodePack-Core" version="1.1.3.3" targetFramework="net472" />
   <package id="Microsoft-WindowsAPICodePack-Shell" version="1.1.3.3" targetFramework="net472" />
   <package id="Microsoft-WindowsAPICodePack-ShellExtensions" version="1.1.3.3" targetFramework="net472" />