浏览代码

Interface improvements

Ruben 6 年之前
父节点
当前提交
2beed877be

+ 20 - 1
PicView/Settings/Settings.cs → PicView/Configs/Configs.cs

@@ -1,8 +1,12 @@
 using System.Windows;
+using static PicView.Fields;
+using static PicView.Resize_and_Zoom;
+using static PicView.Helper;
+using static PicView.Interface;
 
 namespace PicView
 {
-    internal static class Settings
+    internal static class Configs
     {
 
         internal static void SetSlidetimer()
@@ -72,6 +76,21 @@ namespace PicView
         }
 
 
+        internal static void SetScrolling(object sender, RoutedEventArgs e)
+        {
+            if (Properties.Settings.Default.ScrollEnabled)
+            {
+                Properties.Settings.Default.ScrollEnabled = false;
+                
+                IsScrollEnabled = false;
+            }
+            else
+            {
+                Properties.Settings.Default.ScrollEnabled = true;
+                IsScrollEnabled = true;
+            }
+        }
+
         internal static void SetLooping(object sender, RoutedEventArgs e)
         {
             if (Properties.Settings.Default.Looping)

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

@@ -192,6 +192,8 @@ namespace PicView
             FolderIndex = 0;
             mainWindow.img.Width = mainWindow.Scroller.Width = mainWindow.Scroller.Height =
             mainWindow.img.Height = double.NaN;
+            xWidth = xHeight = 0;
+            prevPicResource = null;
 
             if (!string.IsNullOrWhiteSpace(TempZipPath))
             {

+ 2 - 0
PicView/File Logic/Copy_Paste.cs

@@ -152,6 +152,8 @@ namespace PicView
             Clipboard.Clear();
             Clipboard.SetDataObject(data, true);
 
+            PreloadCount = 4;
+
             ToolTipStyle("Added Image to move clipboard");
         }
     }

+ 15 - 4
PicView/File Logic/DeleteFiles.cs

@@ -1,12 +1,12 @@
 using Microsoft.VisualBasic.FileIO;
 using System;
+using System.Diagnostics;
 using System.IO;
 using static PicView.Error_Handling;
+using static PicView.Fields;
 using static PicView.Helper;
 using static PicView.Interface;
 using static PicView.Navigation;
-using static PicView.Fields;
-
 
 namespace PicView
 {
@@ -56,8 +56,11 @@ namespace PicView
                 FileSystem.DeleteFile(file, UIOption.OnlyErrorDialogs, recycle);
                 Pics.Remove(file);
             }
-            catch (Exception)
+            catch (Exception e)
             {
+#if DEBUG
+                        Trace.WriteLine("Delete exception \n" + e.Message);
+#endif
                 return false;
             }
             return true;
@@ -78,7 +81,15 @@ namespace PicView
                 filename = filename.Length >= 25 ? Shorten(filename, 21) : filename;
                 ToolTipStyle(Recyclebin ? "Sent " + filename + " to the recyle bin" : "Deleted " + filename);
 
-                Pic(reverse);
+                PreloadCount = reverse ? PreloadCount - 1 : PreloadCount + 1;
+
+                // Go to next image
+                if (!reverse)
+                    Pic(FolderIndex);
+                else if (FolderIndex - 2 >= 0)
+                    Pic(FolderIndex - 2);
+                else
+                    Unload();
             }
             else
             {

+ 1 - 1
PicView/File Logic/RecentFiles.cs

@@ -161,7 +161,7 @@ namespace PicView
 
                 var cmIcon = new System.Windows.Shapes.Path
                 {
-                    Data = Geometry.Parse(CameraIconSVG),
+                    Data = Geometry.Parse(SVGiconCamera),
                     Stretch = Stretch.Fill,
                     Width = 12,
                     Height = 12,

+ 1 - 1
PicView/Helpers/Fields.cs

@@ -151,7 +151,7 @@ namespace PicView
         /// If higher than 0, Preload forwards.
         /// If less than 0, Preload backwards.
         /// </summary>
-        internal static short PreloadCount { get; set; }
+        internal static int PreloadCount { get; set; }
 
         /// <summary>
         /// Used to get and set Aspect Ratio

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

@@ -108,6 +108,9 @@ namespace PicView
                 if (!PicGalleryLogic.LoadComplete && !PicGalleryLogic.isLoading)
                     await PicGalleryLogic.Load();
             }
+
+            if (prevPicResource != null)
+                prevPicResource = null;
         }
 
         /// <summary>
@@ -233,13 +236,9 @@ namespace PicView
 
             if (picGallery != null)
             {
-                if (freshStartup)
-                {
+                if (!freshStartup)
                     if (PicGalleryLogic.LoadComplete)
                         PicGalleryLogic.ScrollTo();
-                }
-                else
-                    PicGalleryLogic.ScrollTo(reverse);
 
                 //if (x < picGallery.Container.Children.Count)
                 //{

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

@@ -367,15 +367,23 @@ namespace PicView
         internal static void ZoomFit(double width, double height)
         {
             double maxWidth, maxHeight;
-            //var interfaceHeight = 93; // TopBar + mainWindow.LowerBar height
-            var interfaceHeight = mainWindow.TitleBar.ActualHeight + mainWindow.LowerBar.ActualHeight;
+            var interfaceHeight = 93; // TopBar + mainWindow.LowerBar height
+            //var interfaceHeight = (mainWindow.TitleBar.ActualHeight + mainWindow.LowerBar.ActualHeight) + 2; // + 2 for window border
 
             if (FitToWindow)
             {
                 // Get max width and height, based on user's screen
-                maxWidth = Math.Min(MonitorInfo.Width - ComfySpace, width);
-                maxHeight = Math.Min((MonitorInfo.Height - interfaceHeight), height);
-            }
+                if (Properties.Settings.Default.ShowInterface)
+                {
+                    maxWidth = Math.Min(MonitorInfo.Width - ComfySpace, width);
+                    maxHeight = Math.Min((MonitorInfo.Height - interfaceHeight), height);
+                }
+                else
+                {
+                    maxWidth = Math.Min(MonitorInfo.Width - 2, width - 2);
+                    maxHeight = Math.Min(MonitorInfo.Height - 2, height - 2);
+                }
+            }       
             else
             {
                 // Get max width and height, based on window size

+ 95 - 75
PicView/Interface Logic/ContextMenus.cs

@@ -8,12 +8,10 @@ using static PicView.DeleteFiles;
 using static PicView.Fields;
 using static PicView.FileLists;
 using static PicView.Helper;
-using static PicView.Navigation;
 using static PicView.Open_Save;
 using static PicView.RecentFiles;
 using static PicView.SvgIcons;
 using static PicView.Wallpaper;
-using static PicView.Interface;
 
 namespace PicView
 {
@@ -40,7 +38,7 @@ namespace PicView
             };
             var opencmIcon = new System.Windows.Shapes.Path
             {
-                Data = Geometry.Parse("M1717 931q0-35-53-35h-1088q-40 0-85.5 21.5t-71.5 52.5l-294 363q-18 24-18 40 0 35 53 35h1088q40 0 86-22t71-53l294-363q18-22 18-39zm-1141-163h768v-160q0-40-28-68t-68-28h-576q-40 0-68-28t-28-68v-64q0-40-28-68t-68-28h-320q-40 0-68 28t-28 68v853l256-315q44-53 116-87.5t140-34.5zm1269 163q0 62-46 120l-295 363q-43 53-116 87.5t-140 34.5h-1088q-92 0-158-66t-66-158v-960q0-92 66-158t158-66h320q92 0 158 66t66 158v32h544q92 0 158 66t66 158v160h192q54 0 99 24.5t67 70.5q15 32 15 68z"),
+                Data = Geometry.Parse(SVGiconFile),
                 Stretch = Stretch.Fill
             };
             opencmIcon.Width = opencmIcon.Height = 12;
@@ -62,7 +60,7 @@ namespace PicView
             };
             var savecmIcon = new System.Windows.Shapes.Path
             {
-                Data = Geometry.Parse("M512 1536h768v-384h-768v384zm896 0h128v-896q0-14-10-38.5t-20-34.5l-281-281q-10-10-34-20t-39-10v416q0 40-28 68t-68 28h-576q-40 0-68-28t-28-68v-416h-128v1280h128v-416q0-40 28-68t68-28h832q40 0 68 28t28 68v416zm-384-928v-320q0-13-9.5-22.5t-22.5-9.5h-192q-13 0-22.5 9.5t-9.5 22.5v320q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5-9.5t9.5-22.5zm640 32v928q0 40-28 68t-68 28h-1344q-40 0-68-28t-28-68v-1344q0-40 28-68t68-28h928q40 0 88 20t76 48l280 280q28 28 48 76t20 88z"),
+                Data = Geometry.Parse(SVGiconSave),
                 Stretch = Stretch.Fill
             };
             savecmIcon.Width = savecmIcon.Height = 12;
@@ -85,7 +83,7 @@ namespace PicView
             };
             var printcmIcon = new System.Windows.Shapes.Path
             {
-                Data = Geometry.Parse("M448 1536h896v-256h-896v256zm0-640h896v-384h-160q-40 0-68-28t-28-68v-160h-640v640zm1152 64q0-26-19-45t-45-19-45 19-19 45 19 45 45 19 45-19 19-45zm128 0v416q0 13-9.5 22.5t-22.5 9.5h-224v160q0 40-28 68t-68 28h-960q-40 0-68-28t-28-68v-160h-224q-13 0-22.5-9.5t-9.5-22.5v-416q0-79 56.5-135.5t135.5-56.5h64v-544q0-40 28-68t68-28h672q40 0 88 20t76 48l152 152q28 28 48 76t20 88v256h64q79 0 135.5 56.5t56.5 135.5z"),
+                Data = Geometry.Parse(SVGiconPrint),
                 Stretch = Stretch.Fill
             };
             printcmIcon.Width = printcmIcon.Height = 12;
@@ -107,7 +105,7 @@ namespace PicView
             };
             var recentcmIcon = new System.Windows.Shapes.Path
             {
-                Data = Geometry.Parse("M288,48H136c-22.092,0-40,17.908-40,40v336c0,22.092,17.908,40,40,40h240c22.092,0,40-17.908,40-40V176L288,48z M272,192 V80l112, 112H272z"),
+                Data = Geometry.Parse(SVGiconPaper),
                 Stretch = Stretch.Fill
             };
             recentcmIcon.Width = recentcmIcon.Height = 12;
@@ -126,7 +124,7 @@ namespace PicView
             };
             var sortcmIcon = new System.Windows.Shapes.Path
             {
-                Data = Geometry.Parse("M666 481q-60 92-137 273-22-45-37-72.5t-40.5-63.5-51-56.5-63-35-81.5-14.5h-224q-14 0-23-9t-9-23v-192q0-14 9-23t23-9h224q250 0 410 225zm1126 799q0 14-9 23l-320 320q-9 9-23 9-13 0-22.5-9.5t-9.5-22.5v-192q-32 0-85 .5t-81 1-73-1-71-5-64-10.5-63-18.5-58-28.5-59-40-55-53.5-56-69.5q59-93 136-273 22 45 37 72.5t40.5 63.5 51 56.5 63 35 81.5 14.5h256v-192q0-14 9-23t23-9q12 0 24 10l319 319q9 9 9 23zm0-896q0 14-9 23l-320 320q-9 9-23 9-13 0-22.5-9.5t-9.5-22.5v-192h-256q-48 0-87 15t-69 45-51 61.5-45 77.5q-32 62-78 171-29 66-49.5 111t-54 105-64 100-74 83-90 68.5-106.5 42-128 16.5h-224q-14 0-23-9t-9-23v-192q0-14 9-23t23-9h224q48 0 87-15t69-45 51-61.5 45-77.5q32-62 78-171 29-66 49.5-111t54-105 64-100 74-83 90-68.5 106.5-42 128-16.5h256v-192q0-14 9-23t23-9q12 0 24 10l319 319q9 9 9 23z"),
+                Data = Geometry.Parse(SVGiconSort),
                 Stretch = Stretch.Fill
             };
             sortcmIcon.Width = sortcmIcon.Height = 12;
@@ -254,33 +252,55 @@ namespace PicView
             ///////////////////////////
             ///   Looping          \\\\
             ///////////////////////////
-            var settingscmLoop = new MenuItem();
+            var settingscmLoop = new MenuItem
+            {
+                InputGestureText = "L"
+            };
             var settingscmLoopHeader = new CheckBox {
                 IsChecked = Properties.Settings.Default.Looping,
-                Content = "Looping"
-            };
-            settingscmLoopHeader.Click += Settings.SetLooping;
+                Content = "Looping",
+                FontSize = 13,
+                Width = double.NaN,
+                Height = double.NaN
+            };            
             settingscmLoopHeader.Style = Application.Current.FindResource("Checkstyle") as Style;
-            settingscmLoopHeader.FontSize = 13;
+            settingscmLoopHeader.HorizontalAlignment = HorizontalAlignment.Left;
             settingscmLoop.Header = settingscmLoopHeader;
+            //var settingscmLoopIcon = new System.Windows.Shapes.Path
+            //{
+            //    Data = Geometry.Parse(InfiniteIconSVG),
+            //    Stretch = Stretch.Fill,
+            //    Width = 13,
+            //    Height = 13,
+            //    Fill = scbf
+            //};
+            //settingscmLoop.Icon = settingscmLoopIcon;
+            settingscmLoop.Click += (s, x) => { Configs.SetLooping(s, x); settingscmLoopHeader.IsChecked = (bool)settingscmLoopHeader.IsChecked ? false : true; };
             settingscm.Items.Add(settingscmLoop);
+            
 
 
             ///////////////////////////
             ///   Scroll         \\\\
             ///////////////////////////
-            var settingscmScroll = new MenuItem();
+            var settingscmScroll = new MenuItem
+            {
+                InputGestureText = "X"
+            };
             var settingscmScrollHeader = new CheckBox
             {
                 IsChecked = Properties.Settings.Default.ScrollEnabled,
-                Content = "Scrolling"
+                Content = "Scrolling",
+                FontSize = 13,
+                Width = double.NaN,
+                Height = double.NaN
             };
-            settingscmScrollHeader.Click += delegate { IsScrollEnabled = IsScrollEnabled ? false : true; };
+            settingscmScrollHeader.Click += Configs.SetScrolling;
             settingscmScrollHeader.Style = Application.Current.FindResource("Checkstyle") as Style;
             settingscmScrollHeader.FontSize = 13;
             settingscmScroll.Header = settingscmScrollHeader;
+            settingscmScroll.Click += (s, x) => { Configs.SetScrolling(s, x); settingscmScrollHeader.IsChecked = (bool)settingscmScrollHeader.IsChecked ? false : true; };
             settingscm.Items.Add(settingscmScroll);
-            //settingscmScroll.Checked += delegate { IsScrollEnabled = IsScrollEnabled ? false : true; };
             cm.Items.Add(new Separator());
 
             ///////////////////////////
@@ -295,7 +315,7 @@ namespace PicView
             wallcm.Click += (s, x) => SetWallpaper(PicPath, WallpaperStyle.Fill);
             var wallcmIcon = new System.Windows.Shapes.Path
             {
-                Data = Geometry.Parse(CameraIconSVG),
+                Data = Geometry.Parse(SVGiconCamera),
                 Stretch = Stretch.Fill
             };
             wallcmIcon.Width = wallcmIcon.Height = 12;
@@ -347,7 +367,7 @@ namespace PicView
             };
             var cppcmIcon = new System.Windows.Shapes.Path
             {
-                Data = Geometry.Parse(CopyIconSVG),
+                Data = Geometry.Parse(SVGiconCopy),
                 Stretch = Stretch.Fill
             };
             cppcmIcon.Width = cppcmIcon.Height = 12;
@@ -367,7 +387,7 @@ namespace PicView
                 InputGestureText = "Ctrl + X"
             };
             var cpccmIcon = new System.Windows.Shapes.Path();
-            cpccmIcon.Data = Geometry.Parse(ScissorIconSVG);
+            cpccmIcon.Data = Geometry.Parse(SVGiconScissor);
             cpccmIcon.Stretch = Stretch.Fill;
             cpccmIcon.Width = cpccmIcon.Height = 12;
             cpccmIcon.Fill = scbf;
@@ -426,66 +446,66 @@ namespace PicView
                 InputGestureText = "Esc",
                 StaysOpenOnClick = false
             };
-            //var mclcmIcon = new System.Windows.Shapes.Path();
-            //mclcmIcon.Data = Geometry.Parse("M443.6,387.1L312.4,255.4l131.5-130c5.4-5.4,5.4-14.2,0-19.6l-37.4-37.6c-2.6-2.6-6.1-4-9.8-4c-3.7,0-7.2,1.5-9.8,4  L256,197.8L124.9,68.3c-2.6-2.6-6.1-4-9.8-4c-3.7,0-7.2,1.5-9.8,4L68,105.9c-5.4,5.4-5.4,14.2,0,19.6l131.5,130L68.4,387.1  c-2.6,2.6-4.1,6.1-4.1,9.8c0,3.7,1.4,7.2,4.1,9.8l37.4,37.6c2.7,2.7,6.2,4.1,9.8,4.1c3.5,0,7.1-1.3,9.8-4.1L256,313.1l130.7,131.1  c2.7,2.7,6.2,4.1,9.8,4.1c3.5,0,7.1-1.3,9.8-4.1l37.4-37.6c2.6-2.6,4.1-6.1,4.1-9.8C447.7,393.2,446.2,389.7,443.6,387.1z");
-            //mclcmIcon.Stretch = Stretch.Fill;
-            //mclcmIcon.Width = mclcmIcon.Height = 12;
-            //mclcmIcon.Fill = scbf;
-            //clcm.Icon = mclcmIcon;
-            //clcm.Click += (s, x) => Close();
-            //cm.Items.Add(clcm);
+            var mclcmIcon = new System.Windows.Shapes.Path();
+            mclcmIcon.Data = Geometry.Parse("M443.6,387.1L312.4,255.4l131.5-130c5.4-5.4,5.4-14.2,0-19.6l-37.4-37.6c-2.6-2.6-6.1-4-9.8-4c-3.7,0-7.2,1.5-9.8,4  L256,197.8L124.9,68.3c-2.6-2.6-6.1-4-9.8-4c-3.7,0-7.2,1.5-9.8,4L68,105.9c-5.4,5.4-5.4,14.2,0,19.6l131.5,130L68.4,387.1  c-2.6,2.6-4.1,6.1-4.1,9.8c0,3.7,1.4,7.2,4.1,9.8l37.4,37.6c2.7,2.7,6.2,4.1,9.8,4.1c3.5,0,7.1-1.3,9.8-4.1L256,313.1l130.7,131.1  c2.7,2.7,6.2,4.1,9.8,4.1c3.5,0,7.1-1.3,9.8-4.1l37.4-37.6c2.6-2.6,4.1-6.1,4.1-9.8C447.7,393.2,446.2,389.7,443.6,387.1z");
+            mclcmIcon.Stretch = Stretch.Fill;
+            mclcmIcon.Width = mclcmIcon.Height = 12;
+            mclcmIcon.Fill = scbf;
+            clcm.Icon = mclcmIcon;
+            clcm.Click += (s, x) => { cm.Visibility = Visibility.Collapsed; SystemCommands.CloseWindow(mainWindow); };
+            cm.Items.Add(clcm);
 
             // Add to elements
-            mainWindow.img.ContextMenu = mainWindow.bg.ContextMenu = cm;
+            mainWindow.img.ContextMenu = mainWindow.bg.ContextMenu = mainWindow.LowerBar.ContextMenu = cm;
 
             // Add left and right ContextMenus
-            var cmLeft = new ContextMenu();
-            var cmRight = new ContextMenu();
-
-            var nextcm = new MenuItem
-            {
-                Header = "Next picture",
-                InputGestureText = "ᗌ or D",
-                ToolTip = "Go to Next image",
-                StaysOpenOnClick = true
-            };
-            nextcm.Click += (s, x) => Pic();
-            cmRight.Items.Add(nextcm);
-
-            var prevcm = new MenuItem
-            {
-                Header = "Previous picture",
-                InputGestureText = "ᗏ or A",
-                ToolTip = "Go to previous image in folder",
-                StaysOpenOnClick = true
-            };
-            prevcm.Click += (s, x) => Pic(false);
-            cmLeft.Items.Add(prevcm);
-
-            var firstcm = new MenuItem
-            {
-                Header = "First picture",
-                InputGestureText = "Ctrl + D or Ctrl + ᗌ",
-                ToolTip = "Go to first image in folder"
-            };
-            firstcm.Click += (s, x) => Pic(false, true);
-            cmLeft.Items.Add(firstcm);
-
-            var lastcm = new MenuItem
-            {
-                Header = "Last picture",
-                InputGestureText = "Ctrl + A or Ctrl + ᗏ",
-                ToolTip = "Go to last image in folder"
-            };
-            lastcm.Click += (s, x) => Pic(true, true);
-            cmRight.Items.Add(lastcm);
-
-            // Add to elements
-            mainWindow.RightButton.ContextMenu = cmRight;
-            mainWindow.LeftButton.ContextMenu = cmLeft;
-
-            clickArrowRight.ContextMenu = cmRight;
-            clickArrowLeft.ContextMenu = cmLeft;
+            //var cmLeft = new ContextMenu();
+            //var cmRight = new ContextMenu();
+
+            //var nextcm = new MenuItem
+            //{
+            //    Header = "Next picture",
+            //    InputGestureText = "ᗌ or D",
+            //    ToolTip = "Go to Next image",
+            //    StaysOpenOnClick = true
+            //};
+            //nextcm.Click += (s, x) => Pic();
+            //cmRight.Items.Add(nextcm);
+
+            //var prevcm = new MenuItem
+            //{
+            //    Header = "Previous picture",
+            //    InputGestureText = "ᗏ or A",
+            //    ToolTip = "Go to previous image in folder",
+            //    StaysOpenOnClick = true
+            //};
+            //prevcm.Click += (s, x) => Pic(false);
+            //cmLeft.Items.Add(prevcm);
+
+            //var firstcm = new MenuItem
+            //{
+            //    Header = "First picture",
+            //    InputGestureText = "Ctrl + D or Ctrl + ᗌ",
+            //    ToolTip = "Go to first image in folder"
+            //};
+            //firstcm.Click += (s, x) => Pic(false, true);
+            //cmLeft.Items.Add(firstcm);
+
+            //var lastcm = new MenuItem
+            //{
+            //    Header = "Last picture",
+            //    InputGestureText = "Ctrl + A or Ctrl + ᗏ",
+            //    ToolTip = "Go to last image in folder"
+            //};
+            //lastcm.Click += (s, x) => Pic(true, true);
+            //cmRight.Items.Add(lastcm);
+
+            //// Add to elements
+            //mainWindow.RightButton.ContextMenu = cmRight;
+            //mainWindow.LeftButton.ContextMenu = cmLeft;
+
+            //clickArrowRight.ContextMenu = cmRight;
+            //clickArrowLeft.ContextMenu = cmLeft;
 
             // Add Title contextMenu
             var cmTitle = new ContextMenu();

+ 76 - 43
PicView/Interface Logic/Interface.cs

@@ -170,41 +170,27 @@ namespace PicView
                 x2.Visibility =
                 minus.Visibility = Visibility.Collapsed;
 
-
-                if (!FitToWindow)
-                    ZoomFit(xWidth, xHeight);
-
                 if (activityTimer != null)
                     activityTimer.Stop();
             }
+            if (xWidth != 0 && xHeight != 0)
+                ZoomFit(xWidth, xHeight);
 
             ToggleMenus.Close_UserControls();
         }
 
+
+
         /// <summary>
-        /// Hides/shows interface elements with a fade animation
+        /// Logic for mouse enter mainwindow event
         /// </summary>
-        /// <param name="show"></param>
-        internal static async void FadeControlsAsync(bool show)
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        internal static void MainWindow_MouseEnter(object sender, MouseEventArgs e)
         {
-            var fadeTo = show ? 1 : 0;
-
-            /// Might cause unnecessary cpu usage? Need to check
-            await mainWindow.Dispatcher.BeginInvoke((Action)(() =>
-            {
-                if (!Properties.Settings.Default.ShowInterface | Slidetimer.Enabled == true)
-                {
-                    if (clickArrowRight != null && clickArrowLeft != null && x2 != null)
-                    {
-                        AnimationHelper.Fade(clickArrowLeft, fadeTo, TimeSpan.FromSeconds(.5));
-                        AnimationHelper.Fade(clickArrowRight, fadeTo, TimeSpan.FromSeconds(.5));
-                        AnimationHelper.Fade(x2, fadeTo, TimeSpan.FromSeconds(.5));
-                        AnimationHelper.Fade(minus, fadeTo, TimeSpan.FromSeconds(.5));
-                    }
-                }
-
-                ScrollbarFade(show);
-            }));
+            // Start timer when mouse enters mainwindow
+            activityTimer.Start();
+            //FadeControlsAsync(true);
         }
 
 
@@ -215,26 +201,27 @@ namespace PicView
         /// <param name="e"></param>
         internal static void MainWindow_MouseMove(object sender, MouseEventArgs e)
         {
-            //If Mouse is hidden, show it and interface elements.
-            if (e.MouseDevice.OverrideCursor == Cursors.None)
-            {
-                Mouse.OverrideCursor = null;
-                HideCursorTimer.Stop();
-            }
+            ////If Mouse is hidden, show it and interface elements.
+            //if (e.MouseDevice.OverrideCursor == Cursors.None)
+            //{
+            //    Mouse.OverrideCursor = null;
+            //    HideCursorTimer.Stop();
+            //}
+
 
-            // Stop timer if mouse moves on mainwindow and show elements
-            activityTimer.Stop();
+            // If mouse moves on mainwindow, show elements
             FadeControlsAsync(true);
 
-            // If Slideshow is running the interface will hide after 2,5 sec.
-            if (Slidetimer.Enabled == true)
-            {
-                MouseIdleTimer.Start();
-            }
-            else
-            {
-                MouseIdleTimer.Stop();
-            }
+
+            //// If Slideshow is running the interface will hide after 2,5 sec.
+            //if (Slidetimer.Enabled == true)
+            //{
+            //    MouseIdleTimer.Start();
+            //}
+            //else
+            //{
+            //    MouseIdleTimer.Stop();
+            //}
         }
 
         /// <summary>
@@ -245,7 +232,8 @@ namespace PicView
         internal static void MainWindow_MouseLeave(object sender, MouseEventArgs e)
         {
             // Start timer when mouse leaves mainwindow
-            activityTimer.Start();
+            //activityTimer.Start();
+            FadeControlsAsync(false);
         }
 
         /// <summary>
@@ -358,5 +346,50 @@ namespace PicView
 
 
         #endregion Manipulate Interface
+
+        #region Fade controls 
+
+        /// <summary>
+        /// Hides/shows interface elements with a fade animation
+        /// </summary>
+        /// <param name="show"></param>
+        internal static async void FadeControlsAsync(bool show, double time = .5)
+        {
+            /// Might cause unnecessary cpu usage? Need to check
+            await mainWindow.Dispatcher.BeginInvoke((Action)(() =>
+            {
+                if (!Properties.Settings.Default.ShowInterface | Slidetimer.Enabled == true)
+                {
+                    if (clickArrowRight != null && clickArrowLeft != null && x2 != null)
+                    {
+                        var fadeTo = show ? 1 : 0;
+                        var timespan = TimeSpan.FromSeconds(time);
+
+                        AnimationHelper.Fade(clickArrowLeft, fadeTo, timespan);
+                        AnimationHelper.Fade(clickArrowRight, fadeTo, timespan);
+                        AnimationHelper.Fade(x2, fadeTo, timespan);
+                        AnimationHelper.Fade(minus, fadeTo, timespan);
+                    }
+                }
+
+                ScrollbarFade(show);
+            }));
+        }
+
+        //internal static async void FadeCursor(double time = .5)
+        //{
+        //    /// Might cause unnecessary cpu usage? Need to check
+        //    await mainWindow.Dispatcher.BeginInvoke((Action)(() =>
+        //    {
+        //        AnimationHelper.Fade(clickArrowLeft, 0, TimeSpan.FromSeconds(.5));
+        //        AnimationHelper.Fade(clickArrowRight, 0, TimeSpan.FromSeconds(.5));
+        //        AnimationHelper.Fade(x2, 0, TimeSpan.FromSeconds(.5));
+        //        Mouse.OverrideCursor = Cursors.None;
+
+        //        MouseIdleTimer.Stop();
+        //    }));
+        //}
+
+        #endregion
     }
 }

+ 12 - 4
PicView/Interface Logic/SvgIcons.cs

@@ -5,10 +5,18 @@ namespace PicView
     internal static class SvgIcons
     {
         // https://ionicons.com/
-        internal const string CameraIconSVG = "M448 405.333V106.667C448 83.198 428.802 64 405.333 64H106.667C83.198 64 64 83.198 64 106.667v298.666C64 428.802 83.198 448 106.667 448h298.666C428.802 448 448 428.802 448 405.333zM181.333 288l53.334 64 74.666-96 96 128H106.667l74.666-96z";
-        internal const string CopyIconSVG = "M1696 384q40 0 68 28t28 68v1216q0 40-28 68t-68 28h-960q-40 0-68-28t-28-68v-288h-544q-40 0-68-28t-28-68v-672q0-40 20-88t48-76l408-408q28-28 76-48t88-20h416q40 0 68 28t28 68v328q68-40 128-40h416zm-544 213l-299 299h299v-299zm-640-384l-299 299h299v-299zm196 647l316-316v-416h-384v416q0 40-28 68t-68 28h-416v640h512v-256q0-40 20-88t48-76zm956 804v-1152h-384v416q0 40-28 68t-68 28h-416v640h896z";
-
+        internal const string SVGiconCamera = "M448 405.333V106.667C448 83.198 428.802 64 405.333 64H106.667C83.198 64 64 83.198 64 106.667v298.666C64 428.802 83.198 448 106.667 448h298.666C428.802 448 448 428.802 448 405.333zM181.333 288l53.334 64 74.666-96 96 128H106.667l74.666-96z";
+        internal const string SVGiconCopy = "M1696 384q40 0 68 28t28 68v1216q0 40-28 68t-68 28h-960q-40 0-68-28t-28-68v-288h-544q-40 0-68-28t-28-68v-672q0-40 20-88t48-76l408-408q28-28 76-48t88-20h416q40 0 68 28t28 68v328q68-40 128-40h416zm-544 213l-299 299h299v-299zm-640-384l-299 299h299v-299zm196 647l316-316v-416h-384v416q0 40-28 68t-68 28h-416v640h512v-256q0-40 20-88t48-76zm956 804v-1152h-384v416q0 40-28 68t-68 28h-416v640h896z";
+        //internal const string InfiniteIconSVG = "M434.7 188c-18.8-18-43.8-28-70.5-28-26.6 0-51.6 9.9-70.4 27.9l-17.6 15.9 33.1 32.1 17-15.4.1-.1c10.1-9.6 23.5-15 37.7-15 14.2 0 27.6 5.3 37.7 14.9 10 9.6 15.4 22.3 15.4 35.8 0 13.5-5.5 26.1-15.4 35.6-10.1 9.6-23.5 15-37.7 15s-27.6-5.3-37.7-14.9L218.2 188c-18.9-18-43.9-28-70.4-28-26.7 0-51.7 9.9-70.5 28C58.4 206.1 48 230.2 48 256c0 25.7 10.4 49.9 29.3 68 18.8 18 43.8 28 70.5 28 26.7 0 51.7-9.9 70.4-28l37.8-36.1 37.7 36.1c18.9 18 43.9 28 70.4 28 26.7 0 51.7-9.9 70.4-27.9 19-18.1 29.4-42.2 29.4-68 .1-25.8-10.3-50-29.2-68.1zM185.5 291.7c-10.1 9.6-23.5 15-37.7 15-14.2 0-27.6-5.3-37.7-14.9-10-9.6-15.4-22.3-15.4-35.8 0-13.5 5.5-26.1 15.4-35.6 10.1-9.6 23.5-15 37.7-15 14.2 0 27.6 5.3 37.7 14.9l37.4 35.8-37.4 35.6z";
+        
         // http://www.zondicons.com/
-        internal const string ScissorIconSVG = "M9.77 11.5l5.34 3.91c.44.33 1.24.59 1.79.59H20L6.89 6.38A3.5 3.5 0 1 0 5.5 8.37L7.73 10 5.5 11.63a3.5 3.5 0 1 0 1.38 1.99l2.9-2.12zM3.5 7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm0 9a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zM15.1 4.59A3.53 3.53 0 0 1 16.9 4H20l-7.5 5.5L10.45 8l4.65-3.41z";
+        internal const string SVGiconScissor = "M9.77 11.5l5.34 3.91c.44.33 1.24.59 1.79.59H20L6.89 6.38A3.5 3.5 0 1 0 5.5 8.37L7.73 10 5.5 11.63a3.5 3.5 0 1 0 1.38 1.99l2.9-2.12zM3.5 7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm0 9a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zM15.1 4.59A3.53 3.53 0 0 1 16.9 4H20l-7.5 5.5L10.45 8l4.65-3.41z";
+
+        internal const string SVGiconFile = "M1717 931q0-35-53-35h-1088q-40 0-85.5 21.5t-71.5 52.5l-294 363q-18 24-18 40 0 35 53 35h1088q40 0 86-22t71-53l294-363q18-22 18-39zm-1141-163h768v-160q0-40-28-68t-68-28h-576q-40 0-68-28t-28-68v-64q0-40-28-68t-68-28h-320q-40 0-68 28t-28 68v853l256-315q44-53 116-87.5t140-34.5zm1269 163q0 62-46 120l-295 363q-43 53-116 87.5t-140 34.5h-1088q-92 0-158-66t-66-158v-960q0-92 66-158t158-66h320q92 0 158 66t66 158v32h544q92 0 158 66t66 158v160h192q54 0 99 24.5t67 70.5q15 32 15 68z";
+        internal const string SVGiconSave = "M512 1536h768v-384h-768v384zm896 0h128v-896q0-14-10-38.5t-20-34.5l-281-281q-10-10-34-20t-39-10v416q0 40-28 68t-68 28h-576q-40 0-68-28t-28-68v-416h-128v1280h128v-416q0-40 28-68t68-28h832q40 0 68 28t28 68v416zm-384-928v-320q0-13-9.5-22.5t-22.5-9.5h-192q-13 0-22.5 9.5t-9.5 22.5v320q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5-9.5t9.5-22.5zm640 32v928q0 40-28 68t-68 28h-1344q-40 0-68-28t-28-68v-1344q0-40 28-68t68-28h928q40 0 88 20t76 48l280 280q28 28 48 76t20 88z";
+        internal const string SVGiconPrint = "M448 1536h896v-256h-896v256zm0-640h896v-384h-160q-40 0-68-28t-28-68v-160h-640v640zm1152 64q0-26-19-45t-45-19-45 19-19 45 19 45 45 19 45-19 19-45zm128 0v416q0 13-9.5 22.5t-22.5 9.5h-224v160q0 40-28 68t-68 28h-960q-40 0-68-28t-28-68v-160h-224q-13 0-22.5-9.5t-9.5-22.5v-416q0-79 56.5-135.5t135.5-56.5h64v-544q0-40 28-68t68-28h672q40 0 88 20t76 48l152 152q28 28 48 76t20 88v256h64q79 0 135.5 56.5t56.5 135.5z";
+        internal const string SVGiconPaper = "M288,48H136c-22.092,0-40,17.908-40,40v336c0,22.092,17.908,40,40,40h240c22.092,0,40-17.908,40-40V176L288,48z M272,192 V80l112, 112H272z";
+        internal const string SVGiconSort = "M666 481q-60 92-137 273-22-45-37-72.5t-40.5-63.5-51-56.5-63-35-81.5-14.5h-224q-14 0-23-9t-9-23v-192q0-14 9-23t23-9h224q250 0 410 225zm1126 799q0 14-9 23l-320 320q-9 9-23 9-13 0-22.5-9.5t-9.5-22.5v-192q-32 0-85 .5t-81 1-73-1-71-5-64-10.5-63-18.5-58-28.5-59-40-55-53.5-56-69.5q59-93 136-273 22 45 37 72.5t40.5 63.5 51 56.5 63 35 81.5 14.5h256v-192q0-14 9-23t23-9q12 0 24 10l319 319q9 9 9 23zm0-896q0 14-9 23l-320 320q-9 9-23 9-13 0-22.5-9.5t-9.5-22.5v-192h-256q-48 0-87 15t-69 45-51 61.5-45 77.5q-32 62-78 171-29 66-49.5 111t-54 105-64 100-74 83-90 68.5-106.5 42-128 16.5h-224q-14 0-23-9t-9-23v-192q0-14 9-23t23-9h224q48 0 87-15t69-45 51-61.5 45-77.5q32-62 78-171 29-66 49.5-111t54-105 64-100 74-83 90-68.5 106.5-42 128-16.5h256v-192q0-14 9-23t23-9q12 0 24 10l319 319q9 9 9 23z";
+
     }
 }

+ 14 - 51
PicView/Interface Logic/Timers.cs

@@ -26,11 +26,11 @@ namespace PicView
 
             activityTimer = new Timer()
             {
-                Interval = 1500,
+                Interval = 6000,
                 AutoReset = true,
                 Enabled = false
             };
-            activityTimer.Elapsed += ActivityTimer_Elapsed;
+            activityTimer.Elapsed += delegate { FadeControlsAsync(false); };
 
             //fastPicTimer = new Timer()
             //{
@@ -46,58 +46,21 @@ namespace PicView
             };
             Slidetimer.Elapsed += SlideShow.SlideTimer_Elapsed;
 
-            HideCursorTimer = new Timer()
-            {
-                Interval = 2500,
-                Enabled = false
-            };
-            HideCursorTimer.Elapsed += HideCursorTimer_Elapsed;
+            //HideCursorTimer = new Timer()
+            //{
+            //    Interval = 2500,
+            //    Enabled = false
+            //};
+            //HideCursorTimer.Elapsed += delegate { FadeCursor(false); };
 
-            MouseIdleTimer = new Timer()
-            {
-                Interval = 2500,
-                Enabled = false
-            };
-            MouseIdleTimer.Elapsed += MouseIdleTimer_Elapsed;
+            //MouseIdleTimer = new Timer()
+            //{
+            //    Interval = 2500,
+            //    Enabled = false
+            //};
+            //MouseIdleTimer.Elapsed += delegate { HideCursorTimer.Start(); };
         }
 
         #endregion
-
-        /// <summary>
-        /// Timer starts FadeControlsAsync
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        internal static void ActivityTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
-        {
-            FadeControlsAsync(false);
-        }
-
-        /// <summary>
-        /// Timer to show/hide cursor.
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        internal static void HideCursorTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
-        {
-            mainWindow.Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, new System.Threading.ThreadStart(() =>
-            {
-                AnimationHelper.Fade(clickArrowLeft, 0, TimeSpan.FromSeconds(.5));
-                AnimationHelper.Fade(clickArrowRight, 0, TimeSpan.FromSeconds(.5));
-                AnimationHelper.Fade(x2, 0, TimeSpan.FromSeconds(.5));
-                Mouse.OverrideCursor = Cursors.None;
-            }));
-            MouseIdleTimer.Stop();
-        }
-
-        /// <summary>
-        /// Timer to check if Mouse is idle in Slideshow.
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        internal static void MouseIdleTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
-        {
-            HideCursorTimer.Start();
-        }
     }
 }

+ 4 - 4
PicView/Library/Styles/ScrollBar.xaml

@@ -14,7 +14,7 @@
                     <Rectangle
                         Name="ellipse"
                         Width="17"
-                        Fill="WhiteSmoke" />
+                        Fill="#FF535353" />
                     <ControlTemplate.Triggers>
                         <Trigger Property="IsMouseOver" Value="true">
                             <Setter TargetName="ellipse" Property="Fill" Value="{StaticResource ChosenColorBrush}" />
@@ -37,7 +37,7 @@
                     <Rectangle
                         Name="ellipse"
                         Height="15"
-                        Fill="#D8FFFFFF"
+                        Fill="#FF535353"
                         RadiusX="3.5"
                         RadiusY="3.5" />
                     <ControlTemplate.Triggers>
@@ -75,7 +75,7 @@
                             HorizontalAlignment="Center"
                             VerticalAlignment="Center"
                             Data="M413.1,327.3l-1.8-2.1l-136-156.5c-4.6-5.3-11.5-8.6-19.2-8.6c-7.7,0-14.6,3.4-19.2,8.6L101,324.9l-2.3,2.6  C97,330,96,333,96,336.2c0,8.7,7.4,15.8,16.6,15.8v0h286.8v0c9.2,0,16.6-7.1,16.6-15.8C416,332.9,414.9,329.8,413.1,327.3z"
-                            Fill="WhiteSmoke"
+                            Fill="#FF595959"
                             Stretch="Fill" />
                     </Grid>
                     <ControlTemplate.Triggers>
@@ -106,7 +106,7 @@
                             HorizontalAlignment="Center"
                             VerticalAlignment="Center"
                             Data="M98.9,184.7l1.8,2.1l136,156.5c4.6,5.3,11.5,8.6,19.2,8.6c7.7,0,14.6-3.4,19.2-8.6L411,187.1l2.3-2.6  c1.7-2.5,2.7-5.5,2.7-8.7c0-8.7-7.4-15.8-16.6-15.8v0H112.6v0c-9.2,0-16.6,7.1-16.6,15.8C96,179.1,97.1,182.2,98.9,184.7z"
-                            Fill="WhiteSmoke"
+                            Fill="#FF595959"
                             Stretch="Fill" />
                     </Grid>
                     <ControlTemplate.Triggers>

+ 2 - 0
PicView/MainWindow.xaml.cs

@@ -344,6 +344,7 @@ namespace PicView
 
             // This
             Closing += Window_Closing;
+            MouseEnter += MainWindow_MouseEnter;
             MouseMove += MainWindow_MouseMove;
             MouseLeave += MainWindow_MouseLeave;
             StateChanged += MainWindow_StateChanged;
@@ -353,6 +354,7 @@ namespace PicView
             
         }
 
+
         #endregion Add events
 
         #region Changed Events

+ 1 - 1
PicView/PicVIew.csproj

@@ -166,7 +166,7 @@
     <Compile Include="Screen-Logic\MonitorSize.cs" />
     <Compile Include="Native\NativeMethods.cs" />
     <Compile Include="File Logic\RecentFiles.cs" />
-    <Compile Include="Settings\Settings.cs" />
+    <Compile Include="Configs\Configs.cs" />
     <Compile Include="Shortcuts\Shortcuts.cs" />
     <Compile Include="UserControls\CustomControls\AutoScrollSign.xaml.cs">
       <DependentUpon>AutoScrollSign.xaml</DependentUpon>

+ 1 - 1
PicView/Properties/AssemblyInfo.cs

@@ -52,6 +52,6 @@ using System.Windows;
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("0.9.2.5")]
+[assembly: AssemblyFileVersion("0.9.3.2")]
 [assembly: NeutralResourcesLanguage("en")]
 

+ 168 - 363
PicView/Shortcuts/Shortcuts.cs

@@ -55,7 +55,7 @@ namespace PicView
                         //fastPicTimer.Start();
                         FastPic();
                     }
-                    break;
+                    return;
 
                 // Prev
                 case Key.BrowserBack:
@@ -87,7 +87,7 @@ namespace PicView
                         //fastPicTimer.Start();
                         FastPic();
                     }
-                    break;
+                    return;
 
                 // Scroll
                 case Key.PageUp:
@@ -101,7 +101,7 @@ namespace PicView
                     }
                     if (Properties.Settings.Default.ScrollEnabled)
                         mainWindow.Scroller.ScrollToVerticalOffset(mainWindow.Scroller.VerticalOffset - 30);
-                    break;
+                    return;
 
                 case Key.PageDown:
                     if (picGallery != null)
@@ -114,7 +114,7 @@ namespace PicView
                     }
                     if (Properties.Settings.Default.ScrollEnabled)
                         mainWindow.Scroller.ScrollToVerticalOffset(mainWindow.Scroller.VerticalOffset + 30);
-                    break;
+                    return;
 
                 // Rotate or Scroll
                 case Key.Up:
@@ -135,7 +135,7 @@ namespace PicView
                     }
                     else if (!e.IsRepeat && (Keyboard.Modifiers & ModifierKeys.Control) != ModifierKeys.Control)
                         Rotate(false);
-                    break;
+                    return;
                 case Key.Down:
                 case Key.S:
                     if (Properties.Settings.Default.ScrollEnabled && mainWindow.Scroller.ScrollableHeight > 0)
@@ -154,7 +154,7 @@ namespace PicView
                         }
                     else if (!e.IsRepeat && (Keyboard.Modifiers & ModifierKeys.Control) != ModifierKeys.Control)
                         Rotate(true);
-                    break;
+                    return;
 
                 // Zoom
                 case Key.Add:
@@ -163,7 +163,7 @@ namespace PicView
                         Zoom(1, true);
                     else
                         Zoom(1, false);
-                    break;
+                    return;
 
                 case Key.Subtract:
                 case Key.OemMinus:
@@ -171,377 +171,182 @@ namespace PicView
                         Zoom(-1, true);
                     else
                         Zoom(-1, false);
-                    break;
-            }
-        }
-
-        internal static void MainWindow_KeysUp(object sender, KeyEventArgs e)
-        {
-            #region Unused switch... Alt key won't work with switch
-            //switch (e.Key)
-            //{
-            //    // FastPicUpdate()
-            //    case Key.E:
-            //    case Key.A:
-            //    case Key.Right:
-            //    case Key.D:
-            //        if (!FastPicRunning)
-            //            return;
-            //        FastPicUpdate();
-            //        break;
-            //    // Esc
-            //    case Key.Escape:
-            //        if (UserControls_Open())
-            //            Close_UserControls();
-            //        else if (SlideshowActive)
-            //            UnloadSlideshow();
-            //        else if (picGallery != null)
-            //            if (Properties.Settings.Default.PicGallery != 2 && PicGalleryLogic.IsOpen)
-            //                PicGalleryLogic.PicGalleryFade(false);
-            //            else
-            //                SystemCommands.CloseWindow(mainWindow);
-            //        else
-            //            SystemCommands.CloseWindow(mainWindow);
-            //        break;
-            //    // Ctrl + Q
-            //    case Key.Q:
-            //        if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
-            //            SystemCommands.CloseWindow(mainWindow);
-            //        break;
-            //    // O, Ctrl + O
-            //    case Key.O:
-            //        Open();
-            //        break;
-            //    // X, Ctrl + X
-            //    case Key.X:
-            //        if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
-            //            Cut(PicPath);
-            //        else
-            //            IsScrollEnabled = IsScrollEnabled ? false : true;
-            //        break;
-            //    // F
-            //    case Key.F:
-            //        Flip();
-            //        break;
-            //    // Delete, Shift + Delete
-            //    case Key.Delete:
-            //        DeleteFile(PicPath, e.KeyboardDevice.Modifiers != ModifierKeys.Shift);
-            //        break;
-            //    // Ctrl + C, Ctrl + Shift + C
-            //    case Key.C:
-            //        if ((Keyboard.Modifiers & (ModifierKeys.Control | ModifierKeys.Shift)) == (ModifierKeys.Control | ModifierKeys.Shift))
-            //            CopyBitmap();
-            //        else if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
-            //            CopyPic();
-            //        break;
-            //    // Ctrl + V
-            //    case Key.V:
-            //        if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
-            //            Paste();
-            //        break;
-            //    // Ctrl + S
-            //    case Key.S:
-            //        if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
-            //            SaveFiles();
-            //        break;
-            //    // Ctrl + I
-            //    case Key.I:
-            //        if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
-            //            NativeMethods.ShowFileProperties(PicPath);
-            //        break;
-            //    // Ctrl + P
-            //    case Key.P:
-            //        if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
-            //            Print(PicPath);
-            //        break;
-            //    // Ctrl + R
-            //    case Key.R:
-            //        if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
-            //            Reload();
-            //        break;
-            //    // Alt + Enter
-            //    case Key.Enter:
-            //        if (e.KeyboardDevice.Modifiers == ModifierKeys.Alt && (e.SystemKey == Key.Enter))
-            //            mainWindow.Fullscreen_Restore();
-            //        break;
-            //    // Space
-            //    case Key.Space:
-            //        if (picGallery != null)
-            //        {
-            //            if (PicGalleryLogic.IsOpen)
-            //            {
-            //                PicGalleryLogic.ScrollTo();
-            //                return;
-            //            }
-            //        }
-            //        mainWindow.CenterWindowOnScreen();
-            //        break;
-            //    // F1
-            //    case Key.F1:
-            //        HelpWindow();
-            //        break;
-            //    // F2
-            //    case Key.F2:
-            //        AboutWindow();
-            //        break;
-            //    // F3
-            //    case Key.F3:
-            //        Open_In_Explorer();
-            //        break;
-            //    // F4
-            //    case Key.F4:
-            //        if (Properties.Settings.Default.PicGallery == 0)
-            //            break;
-
-            //        Properties.Settings.Default.PicGallery = 1;
-            //        if (picGallery != null)
-            //            PicGalleryLogic.PicGalleryFade(picGallery.Visibility == Visibility.Collapsed);
-            //        break;
-            //    // F5
-            //    case Key.F5:
-            //        if (Properties.Settings.Default.PicGallery == 0)
-            //            return;
-
-            //        var change = Properties.Settings.Default.PicGallery == 2;
-
-            //        Properties.Settings.Default.PicGallery = 2;
-
-            //        if (picGallery != null)
-            //            PicGalleryLogic.PicGalleryFade(picGallery.Visibility == Visibility.Collapsed);
-
-            //        if (change)
-            //            Properties.Settings.Default.PicGallery = 1;
-            //        break;
-            //    // F6
-            //    case Key.F6:
-            //        ResetZoom();
-            //        break;
-            //    // F11
-            //    case Key.F11:
-            //        mainWindow.Fullscreen_Restore();
-            //        break;
-            //    // F12
-            //    case Key.F12:
-            //        if (!SlideshowActive)
-            //            LoadSlideshow();
-            //        else
-            //            UnloadSlideshow();
-            //        break;
-            //    // Home
-            //    case Key.Home:
-            //        mainWindow.Scroller.ScrollToHome();
-            //        break;
-            //    // End
-            //    case Key.End:
-            //        mainWindow.Scroller.ScrollToEnd();
-            //        break;
-            //    // Alt + Z
-            //    case Key.Z:
-            //        if (e.KeyboardDevice.Modifiers == ModifierKeys.Alt && (e.SystemKey == Key.Z))
-            //            HideInterface();
-            //        break;
-            //}
-
-            #endregion
-
-            // FastPicUpdate()
-            if (e.Key == Key.Left || e.Key == Key.A || e.Key == Key.Right || e.Key == Key.D)
-            {
-                //if (!FastPicRunning)
-                //    return;
-                FastPicUpdate();
-            }
-
-            // Esc
-            else if (e.Key == Key.Escape)
-            {
-                if (UserControls_Open())
-                {
-                    Close_UserControls();
-                }
-                else if (SlideshowActive)
-                {
-                    UnloadSlideshow();
-                }
-                else if (Properties.Settings.Default.Fullscreen)
-                {
-                    Fullscreen_Restore();
-                }
-                else if (Properties.Settings.Default.PicGallery > 0)
-                {
-                    if (PicGalleryLogic.IsOpen)
-                        PicGalleryLogic.PicGalleryToggle();
-                    else 
-                        SystemCommands.CloseWindow(mainWindow);
-                }
-                else
-                {
-                    SystemCommands.CloseWindow(mainWindow);
-                }
-            }
-
-            // Ctrl + Q
-            else if (e.Key == Key.Q && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
-            {
-                SystemCommands.CloseWindow(mainWindow);
-            }
-
-            // O, Ctrl + O
-            else if (e.Key == Key.O && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control || e.Key == Key.O)
-            {
-                Open();
-            }
-
-            // X
-            else if (e.Key == Key.X)
-            {
-                if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
-                    Cut(PicPath);
-                else
-                    IsScrollEnabled = IsScrollEnabled ? false : true;
-            }
-
-            // F
-            else if (e.Key == Key.F)
-            {
-                Flip();
-            }
-
-            // Delete, Shift + Delete
-            else if (e.Key == Key.Delete)
-            {
-                DeleteFile(PicPath, e.KeyboardDevice.Modifiers != ModifierKeys.Shift);
-            }
-
-            // Ctrl + C, Ctrl + Shift + C
-            else if (e.Key == Key.C)
-            {
-                if ((Keyboard.Modifiers & (ModifierKeys.Control | ModifierKeys.Shift)) == (ModifierKeys.Control | ModifierKeys.Shift))
-                    CopyBitmap();
-                else if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
-                    CopyPic();
-            }
-
-            // Ctrl + V
-            else if (e.Key == Key.V && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
-            {
-                Paste();
-            }
-
-            // Ctrl + S
-            else if (e.Key == Key.S && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
-            {
-                SaveFiles();
-            }
-
-            // Ctrl + I
-            else if (e.Key == Key.I && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
-            {
-                NativeMethods.ShowFileProperties(PicPath);
-            }
-
-            // Ctrl + P
-            else if (e.Key == Key.P && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
-            {
-                Print(PicPath);
+                    return;
             }
 
-            // Ctrl + R
-            else if (e.Key == Key.R && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
+            // Alt doesn't work in switch? Waiting for key up is confusing in this case
+            // Alt + Z
+            if (e.KeyboardDevice.Modifiers == ModifierKeys.Alt && (e.SystemKey == Key.Z))
             {
-                Reload();
+                if (!e.IsRepeat)
+                    HideInterface();
+                return;
             }
 
             // Alt + Enter
             else if (e.KeyboardDevice.Modifiers == ModifierKeys.Alt && (e.SystemKey == Key.Enter))
             {
-                Maximize_Restore();
+                if (!e.IsRepeat)
+                    Fullscreen_Restore();
             }
+        }
 
-            // Space
-            else if (e.Key == Key.Space)
+        internal static void MainWindow_KeysUp(object sender, KeyEventArgs e)
+        {
+            switch (e.Key)
             {
-                if (picGallery != null)
-                {
-                    if (PicGalleryLogic.IsOpen)
+                // FastPicUpdate()
+                case Key.E:
+                case Key.A:
+                case Key.Right:
+                case Key.D:
+                    FastPicUpdate();
+                    break;
+                // Esc
+                case Key.Escape:
+                    if (UserControls_Open())
                     {
-                        PicGalleryLogic.ScrollTo();
-                        return;
+                        Close_UserControls();
                     }
-                }
-                CenterWindowOnScreen();
-            }
-
-            // F1
-            else if (e.Key == Key.F1)
-            {
-                HelpWindow();
-            }
-
-            //F2
-            else if (e.Key == Key.F2)
-            {
-                AboutWindow();
-            }
-
-            // F3
-            else if (e.Key == Key.F3)
-            {
-                Open_In_Explorer();
-            }
-
-            // F4
-            else if (e.Key == Key.F4)
-            {
-                if (picGallery != null)
-                    PicGalleryLogic.PicGalleryToggle(Properties.Settings.Default.PicGallery == 2);
-            }
-
-            // F5
-            else if (e.Key == Key.F5)
-            {
-                if (picGallery != null)
-                    PicGalleryLogic.PicGalleryToggle(Properties.Settings.Default.PicGallery == 1);
-            }
-
-            // F6
-            else if (e.Key == Key.F6)
-            {
-                ResetZoom();
-            }
-
-            //F11
-            else if (e.Key == Key.F11)
-            {
-                Fullscreen_Restore();
-            }
-
-            //F12
-            else if (e.Key == Key.F12)
-            {
-                if (!SlideshowActive)
-                    LoadSlideshow();
-                else
-                    UnloadSlideshow();
-            }
-
-            // Home
-            else if (e.Key == Key.Home)
-            {
-                mainWindow.Scroller.ScrollToHome();
-            }
-
-            // End
-            else if (e.Key == Key.End)
-            {
-                mainWindow.Scroller.ScrollToEnd();
+                    else if (SlideshowActive)
+                    {
+                        UnloadSlideshow();
+                    }
+                    else if (Properties.Settings.Default.Fullscreen)
+                    {
+                        Fullscreen_Restore();
+                    }
+                    else if (Properties.Settings.Default.PicGallery > 0)
+                    {
+                        if (PicGalleryLogic.IsOpen)
+                            PicGalleryLogic.PicGalleryToggle();
+                        else if (!cm.IsVisible)
+                            SystemCommands.CloseWindow(mainWindow);
+                    }
+                    else if (!cm.IsVisible)
+                    {
+                        SystemCommands.CloseWindow(mainWindow);
+                    }
+                    break;
+                // Ctrl + Q
+                case Key.Q:
+                    if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
+                        SystemCommands.CloseWindow(mainWindow);
+                    break;
+                // O, Ctrl + O
+                case Key.O:
+                    Open();
+                    break;
+                // X, Ctrl + X
+                case Key.X:
+                    if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
+                        Cut(PicPath);
+                    else
+                        IsScrollEnabled = IsScrollEnabled ? false : true;
+                    break;
+                // F
+                case Key.F:
+                    Flip();
+                    break;
+                // Delete, Shift + Delete
+                case Key.Delete:
+                    DeleteFile(PicPath, e.KeyboardDevice.Modifiers != ModifierKeys.Shift);
+                    break;
+                // Ctrl + C, Ctrl + Shift + C
+                case Key.C:
+                    if ((Keyboard.Modifiers & (ModifierKeys.Control | ModifierKeys.Shift)) == (ModifierKeys.Control | ModifierKeys.Shift))
+                        CopyBitmap();
+                    else if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
+                        CopyPic();
+                    break;
+                // Ctrl + V
+                case Key.V:
+                    if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
+                        Paste();
+                    break;
+                // Ctrl + S
+                case Key.S:
+                    if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
+                        SaveFiles();
+                    break;
+                // Ctrl + I
+                case Key.I:
+                    if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
+                        NativeMethods.ShowFileProperties(PicPath);
+                    break;
+                // Ctrl + P
+                case Key.P:
+                    if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
+                        Print(PicPath);
+                    break;
+                // Ctrl + R
+                case Key.R:
+                    if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
+                        Reload();
+                    break;
+                // L
+                case Key.L:
+                    Configs.SetLooping(sender, e);
+                    break;
+                // Space
+                case Key.Space:
+                    if (picGallery != null)
+                    {
+                        if (PicGalleryLogic.IsOpen)
+                        {
+                            PicGalleryLogic.ScrollTo();
+                            return;
+                        }
+                    }
+                    CenterWindowOnScreen();
+                    break;
+                // F1
+                case Key.F1:
+                    HelpWindow();
+                    break;
+                // F2
+                case Key.F2:
+                    AboutWindow();
+                    break;
+                // F3
+                case Key.F3:
+                    Open_In_Explorer();
+                    break;
+                // F4
+                case Key.F4:
+                    if (picGallery != null)
+                        PicGalleryLogic.PicGalleryToggle(Properties.Settings.Default.PicGallery == 2);
+                    break;
+                // F5
+                case Key.F5:
+                    if (picGallery != null)
+                        PicGalleryLogic.PicGalleryToggle(Properties.Settings.Default.PicGallery == 1);
+                    break;
+                // F6
+                case Key.F6:
+                    ResetZoom();
+                    break;
+                // F11
+                case Key.F11:
+                    Fullscreen_Restore();
+                    break;
+                // F12
+                case Key.F12:
+                    if (!SlideshowActive)
+                        LoadSlideshow();
+                    else
+                        UnloadSlideshow();
+                    break;
+                // Home
+                case Key.Home:
+                    mainWindow.Scroller.ScrollToHome();
+                    break;
+                // End
+                case Key.End:
+                    mainWindow.Scroller.ScrollToEnd();
+                    break;
             }
 
-            // Alt + Z
-            else if (e.KeyboardDevice.Modifiers == ModifierKeys.Alt && (e.SystemKey == Key.Z))
-            {
-                HideInterface();
-            }
         }
 
         internal static void MainWindow_MouseDown(object sender, MouseButtonEventArgs e)

+ 3 - 3
PicView/Windows/AllSettings.xaml.cs

@@ -102,7 +102,7 @@ namespace PicView.Windows
                 LoopRadio.MouseEnter += LoopRadio_MouseEnter;
                 LoopRadio.MouseLeave += LoopRadio_MouseLeave;
                 LoopRadio.IsChecked = Properties.Settings.Default.Looping;
-                LoopRadio.Click += Settings.SetLooping;
+                LoopRadio.Click += Configs.SetLooping;
 
                 // PicGalleryRadio
                 PicGalleryRadio.PreviewMouseLeftButtonDown += PicGalleryRadio_PreviewMouseLeftButtonDown;
@@ -124,7 +124,7 @@ namespace PicView.Windows
                 BorderRadio.PreviewMouseLeftButtonDown += BorderRadio_PreviewMouseLeftButtonDown;
                 BorderRadio.MouseEnter += BorderRadio_MouseEnter;
                 BorderRadio.MouseLeave += BorderRadio_MouseLeave;
-                BorderRadio.Click += Settings.SetBgColorEnabled;
+                BorderRadio.Click += Configs.SetBgColorEnabled;
                 if (Properties.Settings.Default.WindowBorderColorEnabled)
                     BorderRadio.IsChecked = true;
 
@@ -740,7 +740,7 @@ namespace PicView.Windows
 
         private void Window_Closing(object sender, CancelEventArgs e)
         {
-            Settings.SetSlidetimer();
+            Configs.SetSlidetimer();
             UpdateColor();
             Closing -= Window_Closing;
             e.Cancel = true;

+ 9 - 9
PicView/Windows/Help.xaml

@@ -17,7 +17,7 @@
     ShowInTaskbar="False"
     WindowStartupLocation="CenterOwner"
     WindowStyle="None"
-    mc:Ignorable="d">
+    mc:Ignorable="d" FontSize="14">
 
 
     <Border
@@ -148,8 +148,8 @@
                     HorizontalScrollBarVisibility="Disabled"
                     VerticalScrollBarVisibility="Auto">
                     <StackPanel Margin="8,0,3,0">
-                        <Label Margin="0,5,0,0" FontSize="15">Shortcuts:</Label>
-                        <Label Margin="0,2,0,2" Content="Show windows:" />
+                        <Label Margin="0,5,0,0" FontSize="16">Shortcuts:</Label>
+                        <Label Margin="0,2,0,2" FontSize="15" Content="Show windows:" />
                         <BulletDecorator Margin="7,2">
                             <BulletDecorator.Bullet>
                                 <Ellipse
@@ -210,7 +210,7 @@
                                 to show/hide slideshow.</TextBlock>
                         </BulletDecorator>
 
-                        <Label Margin="0,10,0,0" Content="File functions:" />
+                        <Label Margin="0,10,0,0" FontSize="15" Content="File functions:" />
 
                         <BulletDecorator Margin="7,2">
                             <BulletDecorator.Bullet>
@@ -322,7 +322,7 @@
                                 to move image to the recycle bin.</TextBlock>
                         </BulletDecorator>
 
-                        <Label Margin="0,10,0,0" Content="Navigate:" />
+                        <Label Margin="0,10,0,0" FontSize="15" Content="Navigate:" />
                         <BulletDecorator Margin="7,2">
                             <BulletDecorator.Bullet>
                                 <Ellipse
@@ -415,7 +415,7 @@
                         <Label
                             Margin="0,10,0,0"
                             Content="Transform image:"
-                            FontSize="14" />
+                            FontSize="15" />
                         <BulletDecorator Margin="7,2">
                             <BulletDecorator.Bullet>
                                 <Ellipse
@@ -475,7 +475,7 @@
                         <Label
                             Margin="0,10,0,0"
                             Content="Zoom:"
-                            FontSize="14" />
+                            FontSize="15" />
                         <BulletDecorator Margin="7,2">
                             <BulletDecorator.Bullet>
                                 <Ellipse
@@ -551,7 +551,7 @@
                         <Label
                             Margin="0,10,0,0"
                             Content="Misc:"
-                            FontSize="14" />
+                            FontSize="15" />
                         <BulletDecorator Margin="7,2">
                             <BulletDecorator.Bullet>
                                 <Ellipse
@@ -587,7 +587,7 @@
                     Padding="0"
                     HorizontalAlignment="Center"
                     VerticalAlignment="Bottom"
-                    Content="© PicView anno 2017"
+                    Content="© PicView 2017"
                     FontSize="14"
                     FontStyle="Italic" />
             </Border>