Procházet zdrojové kódy

Improvements, work in progress

Ruben před 6 roky
rodič
revize
44456961ef

+ 149 - 150
PicView/Helpers/AnimationHelper.cs

@@ -1,5 +1,4 @@
-using PicView.Properties;
-using System;
+using System;
 using System.Windows;
 using System.Windows.Media;
 using System.Windows.Media.Animation;
@@ -80,40 +79,40 @@ namespace PicView
             {
                 case 1:
                 default:
-                    ccAnim.From = Settings.Default.Blue;
+                    ccAnim.From = Properties.Settings.Default.Blue;
                     break;
                 case 2:
-                    ccAnim.From = Settings.Default.Pink;
+                    ccAnim.From = Properties.Settings.Default.Pink;
                     break;
                 case 3:
-                    ccAnim.From = Settings.Default.Orange;
+                    ccAnim.From = Properties.Settings.Default.Orange;
                     break;
                 case 4:
-                    ccAnim.From = Settings.Default.Green;
+                    ccAnim.From = Properties.Settings.Default.Green;
                     break;
                 case 5:
-                    ccAnim.From = Settings.Default.Red;
+                    ccAnim.From = Properties.Settings.Default.Red;
                     break;
                 case 6:
-                    ccAnim.From = Settings.Default.Teal;
+                    ccAnim.From = Properties.Settings.Default.Teal;
                     break;
                 case 7:
-                    ccAnim.From = Settings.Default.Aqua;
+                    ccAnim.From = Properties.Settings.Default.Aqua;
                     break;
                 case 8:
-                    ccAnim.From = Settings.Default.Beige;
+                    ccAnim.From = Properties.Settings.Default.Beige;
                     break;
                 case 9:
-                    ccAnim.From = Settings.Default.Purple;
+                    ccAnim.From = Properties.Settings.Default.Purple;
                     break;
                 case 10:
-                    ccAnim.From = Settings.Default.Cyan;
+                    ccAnim.From = Properties.Settings.Default.Cyan;
                     break;
                 case 11:
-                    ccAnim.From = Settings.Default.Magenta;
+                    ccAnim.From = Properties.Settings.Default.Magenta;
                     break;
                 case 12:
-                    ccAnim.From = Settings.Default.Grey;
+                    ccAnim.From = Properties.Settings.Default.Grey;
                     break;
             }
             ccAnim.To = Color.FromArgb(a, r, g, b);
@@ -127,40 +126,40 @@ namespace PicView
             {
                 case 1:
                 default:
-                    ccAnim.To = Settings.Default.Blue;
+                    ccAnim.To = Properties.Settings.Default.Blue;
                     break;
                 case 2:
-                    ccAnim.To = Settings.Default.Pink;
+                    ccAnim.To = Properties.Settings.Default.Pink;
                     break;
                 case 3:
-                    ccAnim.To = Settings.Default.Orange;
+                    ccAnim.To = Properties.Settings.Default.Orange;
                     break;
                 case 4:
-                    ccAnim.To = Settings.Default.Green;
+                    ccAnim.To = Properties.Settings.Default.Green;
                     break;
                 case 5:
-                    ccAnim.To = Settings.Default.Red;
+                    ccAnim.To = Properties.Settings.Default.Red;
                     break;
                 case 6:
-                    ccAnim.To = Settings.Default.Teal;
+                    ccAnim.To = Properties.Settings.Default.Teal;
                     break;
                 case 7:
-                    ccAnim.To = Settings.Default.Aqua;
+                    ccAnim.To = Properties.Settings.Default.Aqua;
                     break;
                 case 8:
-                    ccAnim.To = Settings.Default.Beige;
+                    ccAnim.To = Properties.Settings.Default.Beige;
                     break;
                 case 9:
-                    ccAnim.To = Settings.Default.Purple;
+                    ccAnim.To = Properties.Settings.Default.Purple;
                     break;
                 case 10:
-                    ccAnim.To = Settings.Default.Cyan;
+                    ccAnim.To = Properties.Settings.Default.Cyan;
                     break;
                 case 11:
-                    ccAnim.To = Settings.Default.Magenta;
+                    ccAnim.To = Properties.Settings.Default.Magenta;
                     break;
                 case 12:
-                    ccAnim.To = Settings.Default.Grey;
+                    ccAnim.To = Properties.Settings.Default.Grey;
                     break;
             }
             brush.BeginAnimation(SolidColorBrush.ColorProperty, ccAnim);
@@ -172,52 +171,52 @@ namespace PicView
             {
                 case 1:
                 default:
-                    ccAnim.From = Settings.Default.Blue;
-                    ccAnim.To = Settings.Default.BlueMouse;
+                    ccAnim.From = Properties.Settings.Default.Blue;
+                    ccAnim.To = Properties.Settings.Default.BlueMouse;
                     break;
                 case 2:
-                    ccAnim.From = Settings.Default.Pink;
-                    ccAnim.To = Settings.Default.PinkMouse;
+                    ccAnim.From = Properties.Settings.Default.Pink;
+                    ccAnim.To = Properties.Settings.Default.PinkMouse;
                     break;
                 case 3:
-                    ccAnim.From = Settings.Default.Orange;
-                    ccAnim.To = Settings.Default.OrangeMouse;
+                    ccAnim.From = Properties.Settings.Default.Orange;
+                    ccAnim.To = Properties.Settings.Default.OrangeMouse;
                     break;
                 case 4:
-                    ccAnim.From = Settings.Default.Green;
-                    ccAnim.To = Settings.Default.GreenMouse;
+                    ccAnim.From = Properties.Settings.Default.Green;
+                    ccAnim.To = Properties.Settings.Default.GreenMouse;
                     break;
                 case 5:
-                    ccAnim.From = Settings.Default.Red;
-                    ccAnim.To = Settings.Default.RedMouse;
+                    ccAnim.From = Properties.Settings.Default.Red;
+                    ccAnim.To = Properties.Settings.Default.RedMouse;
                     break;
                 case 6:
-                    ccAnim.From = Settings.Default.Teal;
-                    ccAnim.To = Settings.Default.TealMouse;
+                    ccAnim.From = Properties.Settings.Default.Teal;
+                    ccAnim.To = Properties.Settings.Default.TealMouse;
                     break;
                 case 7:
-                    ccAnim.From = Settings.Default.Aqua;
-                    ccAnim.To = Settings.Default.AquaMouse;
+                    ccAnim.From = Properties.Settings.Default.Aqua;
+                    ccAnim.To = Properties.Settings.Default.AquaMouse;
                     break;
                 case 8:
-                    ccAnim.From = Settings.Default.Beige;
-                    ccAnim.To = Settings.Default.BeigeMouse;
+                    ccAnim.From = Properties.Settings.Default.Beige;
+                    ccAnim.To = Properties.Settings.Default.BeigeMouse;
                     break;
                 case 9:
-                    ccAnim.From = Settings.Default.Purple;
-                    ccAnim.To = Settings.Default.PurpleMouse;
+                    ccAnim.From = Properties.Settings.Default.Purple;
+                    ccAnim.To = Properties.Settings.Default.PurpleMouse;
                     break;
                 case 10:
-                    ccAnim.From = Settings.Default.Cyan;
-                    ccAnim.To = Settings.Default.CyanMouse;
+                    ccAnim.From = Properties.Settings.Default.Cyan;
+                    ccAnim.To = Properties.Settings.Default.CyanMouse;
                     break;
                 case 11:
-                    ccAnim.From = Settings.Default.Magenta;
-                    ccAnim.To = Settings.Default.MagentaMouse;
+                    ccAnim.From = Properties.Settings.Default.Magenta;
+                    ccAnim.To = Properties.Settings.Default.MagentaMouse;
                     break;
                 case 12:
-                    ccAnim.From = Settings.Default.Grey;
-                    ccAnim.To = Settings.Default.GreyMouse;
+                    ccAnim.From = Properties.Settings.Default.Grey;
+                    ccAnim.To = Properties.Settings.Default.GreyMouse;
                     break;
             }
             brush.BeginAnimation(SolidColorBrush.ColorProperty, ccAnim);
@@ -231,66 +230,66 @@ namespace PicView
 
         internal static Color GetPrefferedColorOver()
         {
-            switch (Settings.Default.ColorTheme)
+            switch (Properties.Settings.Default.ColorTheme)
             {
                 case 1:
                 default:
-                    return Settings.Default.Blue;
+                    return Properties.Settings.Default.Blue;
                 case 2:
-                    return Settings.Default.Pink;
+                    return Properties.Settings.Default.Pink;
                 case 3:
-                    return Settings.Default.Orange;
+                    return Properties.Settings.Default.Orange;
                 case 4:
-                    return Settings.Default.Green;
+                    return Properties.Settings.Default.Green;
                 case 5:
-                    return Settings.Default.Red;
+                    return Properties.Settings.Default.Red;
                 case 6:
-                    return Settings.Default.Teal;
+                    return Properties.Settings.Default.Teal;
                 case 7:
-                    return Settings.Default.Aqua;
+                    return Properties.Settings.Default.Aqua;
                 case 8:
-                    return Settings.Default.Beige;
+                    return Properties.Settings.Default.Beige;
                 case 9:
-                    return Settings.Default.Purple;
+                    return Properties.Settings.Default.Purple;
                 case 10:
-                    return Settings.Default.Cyan;
+                    return Properties.Settings.Default.Cyan;
                 case 11:
-                    return Settings.Default.Magenta;
+                    return Properties.Settings.Default.Magenta;
                 case 12:
-                    return Settings.Default.Grey;
+                    return Properties.Settings.Default.Grey;
 
             }
         }
 
         internal static Color GetPrefferedColorDown()
         {
-            switch (Settings.Default.ColorTheme)
+            switch (Properties.Settings.Default.ColorTheme)
             {
                 case 1:
                 default:
-                    return Settings.Default.BlueMouse;
+                    return Properties.Settings.Default.BlueMouse;
                 case 2:
-                    return Settings.Default.PinkMouse;
+                    return Properties.Settings.Default.PinkMouse;
                 case 3:
-                    return Settings.Default.OrangeMouse;
+                    return Properties.Settings.Default.OrangeMouse;
                 case 4:
-                    return Settings.Default.GreenMouse;
+                    return Properties.Settings.Default.GreenMouse;
                 case 5:
-                    return Settings.Default.RedMouse;
+                    return Properties.Settings.Default.RedMouse;
                 case 6:
-                    return Settings.Default.TealMouse;
+                    return Properties.Settings.Default.TealMouse;
                 case 7:
-                    return Settings.Default.AquaMouse;
+                    return Properties.Settings.Default.AquaMouse;
                 case 8:
-                    return Settings.Default.BeigeMouse;
+                    return Properties.Settings.Default.BeigeMouse;
                 case 9:
-                    return Settings.Default.PurpleMouse;
+                    return Properties.Settings.Default.PurpleMouse;
                 case 10:
-                    return Settings.Default.CyanMouse;
+                    return Properties.Settings.Default.CyanMouse;
                 case 11:
-                    return Settings.Default.MagentaMouse;
+                    return Properties.Settings.Default.MagentaMouse;
                 case 12:
-                    return Settings.Default.GreyMouse;
+                    return Properties.Settings.Default.GreyMouse;
             }
         }
 
@@ -298,161 +297,161 @@ namespace PicView
 
         internal static Color GetPrefferedColorDownAlpha()
         {
-            switch (Settings.Default.ColorTheme)
+            switch (Properties.Settings.Default.ColorTheme)
             {
                 case 1:
                 default:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.BlueMouse.R,
-                        Settings.Default.BlueMouse.G,
-                        Settings.Default.BlueMouse.B);
+                        Properties.Settings.Default.BlueMouse.R,
+                        Properties.Settings.Default.BlueMouse.G,
+                        Properties.Settings.Default.BlueMouse.B);
                 case 2:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.PinkMouse.R,
-                        Settings.Default.PinkMouse.G,
-                        Settings.Default.PinkMouse.B);
+                        Properties.Settings.Default.PinkMouse.R,
+                        Properties.Settings.Default.PinkMouse.G,
+                        Properties.Settings.Default.PinkMouse.B);
                 case 3:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.OrangeMouse.R,
-                        Settings.Default.OrangeMouse.G,
-                        Settings.Default.OrangeMouse.B);
+                        Properties.Settings.Default.OrangeMouse.R,
+                        Properties.Settings.Default.OrangeMouse.G,
+                        Properties.Settings.Default.OrangeMouse.B);
                 case 4:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.GreenMouse.R,
-                        Settings.Default.GreenMouse.G,
-                        Settings.Default.GreenMouse.B);
+                        Properties.Settings.Default.GreenMouse.R,
+                        Properties.Settings.Default.GreenMouse.G,
+                        Properties.Settings.Default.GreenMouse.B);
                 case 5:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.RedMouse.R,
-                        Settings.Default.RedMouse.G,
-                        Settings.Default.RedMouse.B);
+                        Properties.Settings.Default.RedMouse.R,
+                        Properties.Settings.Default.RedMouse.G,
+                        Properties.Settings.Default.RedMouse.B);
                 case 6:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.TealMouse.R,
-                        Settings.Default.TealMouse.G,
-                        Settings.Default.TealMouse.B);
+                        Properties.Settings.Default.TealMouse.R,
+                        Properties.Settings.Default.TealMouse.G,
+                        Properties.Settings.Default.TealMouse.B);
                 case 7:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.AquaMouse.R,
-                        Settings.Default.AquaMouse.G,
-                        Settings.Default.AquaMouse.B);
+                        Properties.Settings.Default.AquaMouse.R,
+                        Properties.Settings.Default.AquaMouse.G,
+                        Properties.Settings.Default.AquaMouse.B);
                 case 8:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.BeigeMouse.R,
-                        Settings.Default.BeigeMouse.G,
-                        Settings.Default.BeigeMouse.B);
+                        Properties.Settings.Default.BeigeMouse.R,
+                        Properties.Settings.Default.BeigeMouse.G,
+                        Properties.Settings.Default.BeigeMouse.B);
                 case 9:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.PurpleMouse.R,
-                        Settings.Default.PurpleMouse.G,
-                        Settings.Default.PurpleMouse.B);
+                        Properties.Settings.Default.PurpleMouse.R,
+                        Properties.Settings.Default.PurpleMouse.G,
+                        Properties.Settings.Default.PurpleMouse.B);
                 case 10:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.CyanMouse.R,
-                        Settings.Default.CyanMouse.G,
-                        Settings.Default.CyanMouse.B);
+                        Properties.Settings.Default.CyanMouse.R,
+                        Properties.Settings.Default.CyanMouse.G,
+                        Properties.Settings.Default.CyanMouse.B);
                 case 11:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.MagentaMouse.R,
-                        Settings.Default.MagentaMouse.G,
-                        Settings.Default.MagentaMouse.B);
+                        Properties.Settings.Default.MagentaMouse.R,
+                        Properties.Settings.Default.MagentaMouse.G,
+                        Properties.Settings.Default.MagentaMouse.B);
                 case 12:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.GreyMouse.R,
-                        Settings.Default.GreyMouse.G,
-                        Settings.Default.GreyMouse.B);
+                        Properties.Settings.Default.GreyMouse.R,
+                        Properties.Settings.Default.GreyMouse.G,
+                        Properties.Settings.Default.GreyMouse.B);
             }
         }
 
         internal static Color GetPrefferedColorOverAlpha()
         {
-            switch (Settings.Default.ColorTheme)
+            switch (Properties.Settings.Default.ColorTheme)
             {
                 case 1:
                 default:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.Blue.R,
-                        Settings.Default.Blue.G,
-                        Settings.Default.Blue.B);
+                        Properties.Settings.Default.Blue.R,
+                        Properties.Settings.Default.Blue.G,
+                        Properties.Settings.Default.Blue.B);
                 case 2:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.Pink.R,
-                        Settings.Default.Pink.G,
-                        Settings.Default.Pink.B);
+                        Properties.Settings.Default.Pink.R,
+                        Properties.Settings.Default.Pink.G,
+                        Properties.Settings.Default.Pink.B);
                 case 3:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.Orange.R,
-                        Settings.Default.Orange.G,
-                        Settings.Default.Orange.B);
+                        Properties.Settings.Default.Orange.R,
+                        Properties.Settings.Default.Orange.G,
+                        Properties.Settings.Default.Orange.B);
                 case 4:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.Green.R,
-                        Settings.Default.Green.G,
-                        Settings.Default.Green.B);
+                        Properties.Settings.Default.Green.R,
+                        Properties.Settings.Default.Green.G,
+                        Properties.Settings.Default.Green.B);
                 case 5:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.Red.R,
-                        Settings.Default.Red.G,
-                        Settings.Default.Red.B);
+                        Properties.Settings.Default.Red.R,
+                        Properties.Settings.Default.Red.G,
+                        Properties.Settings.Default.Red.B);
                 case 6:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.Teal.R,
-                        Settings.Default.Teal.G,
-                        Settings.Default.Teal.B);
+                        Properties.Settings.Default.Teal.R,
+                        Properties.Settings.Default.Teal.G,
+                        Properties.Settings.Default.Teal.B);
                 case 7:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.Aqua.R,
-                        Settings.Default.Aqua.G,
-                        Settings.Default.Aqua.B);
+                        Properties.Settings.Default.Aqua.R,
+                        Properties.Settings.Default.Aqua.G,
+                        Properties.Settings.Default.Aqua.B);
                 case 8:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.Beige.R,
-                        Settings.Default.Beige.G,
-                        Settings.Default.Beige.B);
+                        Properties.Settings.Default.Beige.R,
+                        Properties.Settings.Default.Beige.G,
+                        Properties.Settings.Default.Beige.B);
                 case 9:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.Purple.R,
-                        Settings.Default.Purple.G,
-                        Settings.Default.Purple.B);
+                        Properties.Settings.Default.Purple.R,
+                        Properties.Settings.Default.Purple.G,
+                        Properties.Settings.Default.Purple.B);
                 case 10:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.Cyan.R,
-                        Settings.Default.Cyan.G,
-                        Settings.Default.Cyan.B);
+                        Properties.Settings.Default.Cyan.R,
+                        Properties.Settings.Default.Cyan.G,
+                        Properties.Settings.Default.Cyan.B);
                 case 11:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.Magenta.R,
-                        Settings.Default.Magenta.G,
-                        Settings.Default.Magenta.B);
+                        Properties.Settings.Default.Magenta.R,
+                        Properties.Settings.Default.Magenta.G,
+                        Properties.Settings.Default.Magenta.B);
                 case 12:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.Grey.R,
-                        Settings.Default.Grey.G,
-                        Settings.Default.Grey.B);
+                        Properties.Settings.Default.Grey.R,
+                        Properties.Settings.Default.Grey.G,
+                        Properties.Settings.Default.Grey.B);
             }
         }
 

+ 7 - 2
PicView/Image Logic/Resize_and_Zoom.cs

@@ -367,7 +367,8 @@ namespace PicView
         internal static void ZoomFit(double width, double height)
         {
             double maxWidth, maxHeight;
-            var interfaceHeight = 93; // TopBar + mainWindow.LowerBar height
+            //var interfaceHeight = 93; // TopBar + mainWindow.LowerBar height
+            var interfaceHeight = mainWindow.TitleBar.ActualHeight + mainWindow.LowerBar.ActualHeight;
 
             if (FitToWindow)
             {
@@ -379,7 +380,11 @@ namespace PicView
             {
                 // Get max width and height, based on window size
                 maxWidth = Math.Min(mainWindow.Width, width);
-                maxHeight = Math.Min(mainWindow.Height - interfaceHeight, height);
+
+                if (Properties.Settings.Default.ShowInterface)
+                    maxHeight = Math.Min(mainWindow.Height - interfaceHeight, height);
+                else
+                    maxHeight = Math.Min(mainWindow.Height, height);
             }
 
             AspectRatio = Math.Min((maxWidth / width), (maxHeight / height));

+ 185 - 21
PicView/Interface Logic/ContextMenus.cs

@@ -13,6 +13,7 @@ using static PicView.Open_Save;
 using static PicView.RecentFiles;
 using static PicView.SvgIcons;
 using static PicView.Wallpaper;
+using static PicView.Interface;
 
 namespace PicView
 {
@@ -26,6 +27,12 @@ namespace PicView
             cm = new ContextMenu();
             var scbf = (SolidColorBrush)Application.Current.Resources["MainColorFadedBrush"];
 
+
+            ///////////////////////////
+            ///////////////////////////
+            ///     Open           \\\\
+            ///////////////////////////
+            ///////////////////////////
             var opencm = new MenuItem
             {
                 Header = "Open",
@@ -42,6 +49,12 @@ namespace PicView
             opencm.Click += (s, x) => Open();
             cm.Items.Add(opencm);
 
+
+            ///////////////////////////
+            ///////////////////////////
+            ///     Save           \\\\
+            ///////////////////////////
+            ///////////////////////////
             var savecm = new MenuItem()
             {
                 Header = "Save",
@@ -58,6 +71,13 @@ namespace PicView
             savecm.Click += (s, x) => SaveFiles();
             cm.Items.Add(savecm);
 
+
+
+            ///////////////////////////
+            ///////////////////////////
+            ///     Print          \\\\
+            ///////////////////////////
+            ///////////////////////////
             var printcm = new MenuItem
             {
                 Header = "Print",
@@ -74,29 +94,48 @@ namespace PicView
             printcm.Click += (s, x) => Print(PicPath);
             cm.Items.Add(printcm);
 
+
+            ///////////////////////////
+            ///////////////////////////
+            ///     Recent Files   \\\\
+            ///////////////////////////
+            ///////////////////////////
             cm.Items.Add(new Separator());
             var recentcm = new MenuItem
             {
                 Header = "Recent files"
             };
-            var recentcmIcon = new System.Windows.Shapes.Path();
-            recentcmIcon.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");
-            recentcmIcon.Stretch = Stretch.Fill;
+            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"),
+                Stretch = Stretch.Fill
+            };
             recentcmIcon.Width = recentcmIcon.Height = 12;
             recentcmIcon.Fill = scbf;
             recentcm.Icon = recentcmIcon;
             cm.Items.Add(recentcm);
 
+            ///////////////////////////
+            ///////////////////////////
+            ///     Sort Files     \\\\
+            ///////////////////////////
+            ///////////////////////////
             var sortcm = new MenuItem
             {
                 Header = "Sort files by"
             };
-            var sortcmIcon = new System.Windows.Shapes.Path();
-            sortcmIcon.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");
-            sortcmIcon.Stretch = Stretch.Fill;
+            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"),
+                Stretch = Stretch.Fill
+            };
             sortcmIcon.Width = sortcmIcon.Height = 12;
             sortcmIcon.Fill = scbf;
             sortcm.Icon = sortcmIcon;
+
+            ///////////////////////////
+            ///   File Name        \\\\
+            ///////////////////////////
             var sortcmChild0 = new RadioButton
             {
                 Content = "File name"
@@ -108,8 +147,14 @@ namespace PicView
                     Pics = FileList(Path.GetDirectoryName(PicPath));
             };
             sortcm.Items.Add(sortcmChild0);
-            var sortcmChild1 = new RadioButton();
-            sortcmChild1.Content = "File Size";
+
+            ///////////////////////////
+            ///   File Size        \\\\
+            ///////////////////////////
+            var sortcmChild1 = new RadioButton
+            {
+                Content = "File Size"
+            };
             sortcmChild1.Click += (s, x) =>
             {
                 Properties.Settings.Default.SortPreference = 1;
@@ -117,8 +162,14 @@ namespace PicView
                     Pics = FileList(Path.GetDirectoryName(PicPath));
             };
             sortcm.Items.Add(sortcmChild1);
-            var sortcmChild2 = new RadioButton();
-            sortcmChild2.Content = "Creation time";
+
+            ///////////////////////////
+            ///   Creatin Time     \\\\
+            ///////////////////////////
+            var sortcmChild2 = new RadioButton
+            {
+                Content = "Creation time"
+            };
             sortcmChild2.Click += (s, x) =>
             {
                 Properties.Settings.Default.SortPreference = 2;
@@ -126,8 +177,14 @@ namespace PicView
                     Pics = FileList(Path.GetDirectoryName(PicPath));
             };
             sortcm.Items.Add(sortcmChild2);
-            var sortcmChild3 = new RadioButton();
-            sortcmChild3.Content = "File extension";
+
+            ///////////////////////////
+            ///   File extension   \\\\
+            ///////////////////////////
+            var sortcmChild3 = new RadioButton
+            {
+                Content = "File extension"
+            };
             sortcmChild3.Click += (s, x) =>
             {
                 Properties.Settings.Default.SortPreference = 3;
@@ -135,8 +192,14 @@ namespace PicView
                     Pics = FileList(Path.GetDirectoryName(PicPath));
             };
             sortcm.Items.Add(sortcmChild3);
-            var sortcmChild4 = new RadioButton();
-            sortcmChild4.Content = "Last access time";
+
+            ///////////////////////////
+            ///   Last Access Time \\\\
+            ///////////////////////////
+            var sortcmChild4 = new RadioButton
+            {
+                Content = "Last access time"
+            };
             sortcmChild4.Click += (s, x) =>
             {
                 Properties.Settings.Default.SortPreference = 4;
@@ -144,8 +207,14 @@ namespace PicView
                     Pics = FileList(Path.GetDirectoryName(PicPath));
             };
             sortcm.Items.Add(sortcmChild4);
-            var sortcmChild5 = new RadioButton();
-            sortcmChild5.Content = "Last write time";
+
+            ///////////////////////////
+            ///   Last Write Time  \\\\
+            ///////////////////////////
+            var sortcmChild5 = new RadioButton
+            {
+                Content = "Last write time"
+            };
             sortcmChild5.Click += (s, x) =>
             {
                 Properties.Settings.Default.SortPreference = 5;
@@ -153,8 +222,14 @@ namespace PicView
                     Pics = FileList(Path.GetDirectoryName(PicPath));
             };
             sortcm.Items.Add(sortcmChild5);
-            var sortcmChild6 = new RadioButton();
-            sortcmChild6.Content = "Random";
+
+            ///////////////////////////
+            ///   Random        \\\\
+            ///////////////////////////
+            var sortcmChild6 = new RadioButton
+            {
+                Content = "Random"
+            };
             sortcmChild6.Click += (s, x) =>
             {
                 Properties.Settings.Default.SortPreference = 6;
@@ -163,22 +238,79 @@ namespace PicView
             };
             sortcm.Items.Add(sortcmChild6);
             cm.Items.Add(sortcm);
+
+
+            ///////////////////////////
+            ///////////////////////////
+            ///     Settings       \\\\
+            ///////////////////////////
+            ///////////////////////////
+            var settingscm = new MenuItem
+            {
+                Header = "Setings"
+            };
+            cm.Items.Add(settingscm);
+
+            ///////////////////////////
+            ///   Looping          \\\\
+            ///////////////////////////
+            var settingscmLoop = new MenuItem();
+            var settingscmLoopHeader = new CheckBox {
+                IsChecked = Properties.Settings.Default.Looping,
+                Content = "Looping"
+            };
+            settingscmLoopHeader.Click += Settings.SetLooping;
+            settingscmLoopHeader.Style = Application.Current.FindResource("Checkstyle") as Style;
+            settingscmLoopHeader.FontSize = 13;
+            settingscmLoop.Header = settingscmLoopHeader;
+            settingscm.Items.Add(settingscmLoop);
+
+
+            ///////////////////////////
+            ///   Scroll         \\\\
+            ///////////////////////////
+            var settingscmScroll = new MenuItem();
+            var settingscmScrollHeader = new CheckBox
+            {
+                IsChecked = Properties.Settings.Default.ScrollEnabled,
+                Content = "Scrolling"
+            };
+            settingscmScrollHeader.Click += delegate { IsScrollEnabled = IsScrollEnabled ? false : true; };
+            settingscmScrollHeader.Style = Application.Current.FindResource("Checkstyle") as Style;
+            settingscmScrollHeader.FontSize = 13;
+            settingscmScroll.Header = settingscmScrollHeader;
+            settingscm.Items.Add(settingscmScroll);
+            //settingscmScroll.Checked += delegate { IsScrollEnabled = IsScrollEnabled ? false : true; };
             cm.Items.Add(new Separator());
 
+            ///////////////////////////
+            ///////////////////////////
+            ///  Set as Wallpaper  \\\\
+            ///////////////////////////
+            ///////////////////////////
             var wallcm = new MenuItem
             {
                 Header = "Set as wallpaper"
             };
             wallcm.Click += (s, x) => SetWallpaper(PicPath, WallpaperStyle.Fill);
-            var wallcmIcon = new System.Windows.Shapes.Path();
-            wallcmIcon.Data = Geometry.Parse(CameraIconSVG);
-            wallcmIcon.Stretch = Stretch.Fill;
+            var wallcmIcon = new System.Windows.Shapes.Path
+            {
+                Data = Geometry.Parse(CameraIconSVG),
+                Stretch = Stretch.Fill
+            };
             wallcmIcon.Width = wallcmIcon.Height = 12;
             wallcmIcon.Fill = scbf;
             wallcm.Icon = wallcmIcon;
             cm.Items.Add(wallcm);
             cm.Items.Add(new Separator());
 
+
+
+            ///////////////////////////
+            ///////////////////////////
+            ///   Locate on disk   \\\\
+            ///////////////////////////
+            ///////////////////////////
             var lcdcm = new MenuItem
             {
                 Header = "Locate on disk",
@@ -188,6 +320,12 @@ namespace PicView
             lcdcm.Click += (s, x) => Open_In_Explorer();
             cm.Items.Add(lcdcm);
 
+
+            ///////////////////////////
+            ///////////////////////////
+            ///   File Details     \\\\
+            ///////////////////////////
+            ///////////////////////////
             var fildecm = new MenuItem
             {
                 Header = "File Details",
@@ -197,6 +335,11 @@ namespace PicView
             cm.Items.Add(fildecm);
             cm.Items.Add(new Separator());
 
+            ///////////////////////////
+            ///////////////////////////
+            ///   Copy Picture     \\\\
+            ///////////////////////////
+            ///////////////////////////
             var cppcm = new MenuItem
             {
                 Header = "Copy picture",
@@ -213,6 +356,11 @@ namespace PicView
             cppcm.Click += (s, x) => CopyPic();
             cm.Items.Add(cppcm);
 
+            ///////////////////////////
+            ///////////////////////////
+            ///   Cut Picture      \\\\
+            ///////////////////////////
+            ///////////////////////////
             var cpccm = new MenuItem
             {
                 Header = "Cut picture",
@@ -227,6 +375,11 @@ namespace PicView
             cpccm.Click += (s, x) => Cut(PicPath);
             cm.Items.Add(cpccm);
 
+            ///////////////////////////
+            ///////////////////////////
+            ///   Paste Picture    \\\\
+            ///////////////////////////
+            ///////////////////////////
             var pastecm = new MenuItem
             {
                 Header = "Paste picture",
@@ -241,6 +394,11 @@ namespace PicView
             pastecm.Click += (s, x) => Paste();
             cm.Items.Add(pastecm);
 
+            ///////////////////////////
+            ///////////////////////////
+            ///   Delete Picture   \\\\
+            ///////////////////////////
+            ///////////////////////////
             var MovetoRecycleBin = new MenuItem
             {
                 Header = "Delete picture",
@@ -255,6 +413,12 @@ namespace PicView
             MovetoRecycleBin.Click += (s, x) => DeleteFile(PicPath, true);
             cm.Items.Add(MovetoRecycleBin);
 
+
+            ///////////////////////////
+            ///////////////////////////
+            ///   Close            \\\\
+            ///////////////////////////
+            ///////////////////////////
             cm.Items.Add(new Separator());
             var clcm = new MenuItem
             {

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

@@ -9,6 +9,7 @@ using System.Windows.Media.Animation;
 using static PicView.Fields;
 using static PicView.FileFunctions;
 using static PicView.Resize_and_Zoom;
+using static PicView.WindowLogic;
 
 namespace PicView
 {
@@ -157,6 +158,8 @@ namespace PicView
             // Show interface
             else
             {
+                Properties.Settings.Default.ShowInterface = true;
+
                 mainWindow.TitleBar.Visibility =
                 mainWindow.LowerBar.Visibility =
                 mainWindow.LeftBorderRectangle.Visibility =
@@ -167,11 +170,15 @@ namespace PicView
                 x2.Visibility =
                 minus.Visibility = Visibility.Collapsed;
 
-                Properties.Settings.Default.ShowInterface = true;
+
+                if (!FitToWindow)
+                    ZoomFit(xWidth, xHeight);
 
                 if (activityTimer != null)
                     activityTimer.Stop();
             }
+
+            ToggleMenus.Close_UserControls();
         }
 
         /// <summary>

+ 13 - 6
PicView/Interface Logic/PicGalleryLogic.cs

@@ -489,15 +489,14 @@ namespace PicView
             }
             else
             {
-                if (Preloader.Contains(Pics[id]))
+                if (!Preloader.Contains(Pics[id]))
                 {
-                    ItemClick(id);
-                }
-                else
-                {
-                    ItemClick(id);
+                    PreloadCount = 4;
+                    Preloader.Clear();
+                    Preloader.Add(Pics[id]);
                 }
 
+                ItemClick(id);
             }
 
             IsOpen = false;
@@ -505,6 +504,14 @@ namespace PicView
 
         internal static void PreviewItemClick(ImageSource source, int id)
         {
+            if (!Preloader.Contains(Pics[id]))
+            {
+                PreloadCount = 4;
+                Preloader.Clear();
+                Preloader.Add(Pics[id]);
+            }
+            
+
             mainWindow.img.Source = source;
             var size = ImageSize(Pics[id]);
             if (size.HasValue)

+ 1 - 0
PicView/PicVIew.csproj

@@ -166,6 +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="Shortcuts\Shortcuts.cs" />
     <Compile Include="UserControls\CustomControls\AutoScrollSign.xaml.cs">
       <DependentUpon>AutoScrollSign.xaml</DependentUpon>

+ 92 - 0
PicView/Settings/Settings.cs

@@ -0,0 +1,92 @@
+using System.Windows;
+
+namespace PicView
+{
+    internal static class Settings
+    {
+
+        internal static void SetSlidetimer()
+        {
+            switch (Properties.Settings.Default.Slidetimeren.ToString("0"))
+            {
+                case "1":
+                    Properties.Settings.Default.Slidetimeren = 1000;
+                    break;
+
+                case "2":
+                    Properties.Settings.Default.Slidetimeren = 2000;
+                    break;
+
+                case "3":
+                    Properties.Settings.Default.Slidetimeren = 3000;
+                    break;
+
+                case "4":
+                    Properties.Settings.Default.Slidetimeren = 4000;
+                    break;
+
+                case "5":
+                    Properties.Settings.Default.Slidetimeren = 5000;
+                    break;
+
+                case "6":
+                    Properties.Settings.Default.Slidetimeren = 6000;
+                    break;
+
+                case "7":
+                    Properties.Settings.Default.Slidetimeren = 7000;
+                    break;
+
+                case "8":
+                    Properties.Settings.Default.Slidetimeren = 8000;
+                    break;
+
+                case "9":
+                    Properties.Settings.Default.Slidetimeren = 9000;
+                    break;
+
+                case "10":
+                    Properties.Settings.Default.Slidetimeren = 10000;
+                    break;
+
+                case "11":
+                    Properties.Settings.Default.Slidetimeren = 11000;
+                    break;
+
+                case "12":
+                    Properties.Settings.Default.Slidetimeren = 12000;
+                    break;
+
+                case "13":
+                    Properties.Settings.Default.Slidetimeren = 13000;
+                    break;
+
+                case "14":
+                    Properties.Settings.Default.Slidetimeren = 140000;
+                    break;
+
+                case "15":
+                    Properties.Settings.Default.Slidetimeren = 15000;
+                    break;
+            }
+        }
+
+
+        internal static void SetLooping(object sender, RoutedEventArgs e)
+        {
+            if (Properties.Settings.Default.Looping)
+            {
+                Properties.Settings.Default.Looping = false;
+            }
+            else
+            {
+                Properties.Settings.Default.Looping = true;
+            }
+        }
+
+        internal static void SetBgColorEnabled(object sender, RoutedEventArgs e)
+        {
+            Properties.Settings.Default.WindowBorderColorEnabled = Properties.Settings.Default.WindowBorderColorEnabled ? false : true;
+        }
+    }
+}

+ 22 - 109
PicView/Windows/AllSettings.xaml.cs

@@ -102,20 +102,29 @@ namespace PicView.Windows
                 LoopRadio.MouseEnter += LoopRadio_MouseEnter;
                 LoopRadio.MouseLeave += LoopRadio_MouseLeave;
                 LoopRadio.IsChecked = Properties.Settings.Default.Looping;
-                LoopRadio.Click += SetLooping;
+                LoopRadio.Click += Settings.SetLooping;
 
                 // PicGalleryRadio
                 PicGalleryRadio.PreviewMouseLeftButtonDown += PicGalleryRadio_PreviewMouseLeftButtonDown;
                 PicGalleryRadio.MouseEnter += PicGalleryRadio_MouseEnter;
                 PicGalleryRadio.MouseLeave += PicGalleryRadio_MouseLeave;
                 PicGalleryRadio.IsChecked = Properties.Settings.Default.PicGallery > 0;
-                PicGalleryRadio.Checked += SetPicGallery;
+                PicGalleryRadio.Checked += delegate {
+                    if (PicGalleryRadio.IsChecked.Value)
+                    {
+                        Properties.Settings.Default.PicGallery = 0;
+                    }
+                    else
+                    {
+                        Properties.Settings.Default.PicGallery = 1;
+                    }
+                }; 
 
                 // BorderColorRadio
                 BorderRadio.PreviewMouseLeftButtonDown += BorderRadio_PreviewMouseLeftButtonDown;
                 BorderRadio.MouseEnter += BorderRadio_MouseEnter;
                 BorderRadio.MouseLeave += BorderRadio_MouseLeave;
-                BorderRadio.Click += SetBgColorEnabled;
+                BorderRadio.Click += Settings.SetBgColorEnabled;
                 if (Properties.Settings.Default.WindowBorderColorEnabled)
                     BorderRadio.IsChecked = true;
 
@@ -185,6 +194,15 @@ namespace PicView.Windows
             }
         }
 
+        //Slideslider
+        void SlideSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
+        {
+            double value = Properties.Settings.Default.Slidetimeren;
+            var slider = sender as Slider;
+            value = slider.Value;
+            txtSlide.Text = value.ToString("0");
+        }
+
 
         #region EventHandlers
 
@@ -720,114 +738,9 @@ namespace PicView.Windows
 
         #endregion
 
-        //Slideslider
-        private void SlideSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
-        {
-            double value = Properties.Settings.Default.Slidetimeren;
-            var slider = sender as Slider;
-            value = slider.Value;
-            txtSlide.Text = value.ToString("0");
-        }
-
-        private void SetSlidetimer()
-        {
-            switch (Properties.Settings.Default.Slidetimeren.ToString("0"))
-            {
-                case "1":
-                    Properties.Settings.Default.Slidetimeren = 1000;
-                    break;
-
-                case "2":
-                    Properties.Settings.Default.Slidetimeren = 2000;
-                    break;
-
-                case "3":
-                    Properties.Settings.Default.Slidetimeren = 3000;
-                    break;
-
-                case "4":
-                    Properties.Settings.Default.Slidetimeren = 4000;
-                    break;
-
-                case "5":
-                    Properties.Settings.Default.Slidetimeren = 5000;
-                    break;
-
-                case "6":
-                    Properties.Settings.Default.Slidetimeren = 6000;
-                    break;
-
-                case "7":
-                    Properties.Settings.Default.Slidetimeren = 7000;
-                    break;
-
-                case "8":
-                    Properties.Settings.Default.Slidetimeren = 8000;
-                    break;
-
-                case "9":
-                    Properties.Settings.Default.Slidetimeren = 9000;
-                    break;
-
-                case "10":
-                    Properties.Settings.Default.Slidetimeren = 10000;
-                    break;
-
-                case "11":
-                    Properties.Settings.Default.Slidetimeren = 11000;
-                    break;
-
-                case "12":
-                    Properties.Settings.Default.Slidetimeren = 12000;
-                    break;
-
-                case "13":
-                    Properties.Settings.Default.Slidetimeren = 13000;
-                    break;
-
-                case "14":
-                    Properties.Settings.Default.Slidetimeren = 140000;
-                    break;
-
-                case "15":
-                    Properties.Settings.Default.Slidetimeren = 15000;
-                    break;
-            }
-        }
-
-
-        private void SetLooping(object sender, RoutedEventArgs e)
-        {
-            if (Properties.Settings.Default.Looping)
-            {
-                Properties.Settings.Default.Looping = false;
-            }
-            else
-            {
-                Properties.Settings.Default.Looping = true;
-            }
-        }
-
-        private void SetPicGallery(object sender, RoutedEventArgs e)
-        {
-            if (PicGalleryRadio.IsChecked.Value)
-            {
-                Properties.Settings.Default.PicGallery = 0;
-            }
-            else
-            {
-                Properties.Settings.Default.PicGallery = 1;
-            }
-        }
-
-        private void SetBgColorEnabled(object sender, RoutedEventArgs e)
-        {
-            Properties.Settings.Default.WindowBorderColorEnabled = Properties.Settings.Default.WindowBorderColorEnabled ? false : true;
-        }
-
         private void Window_Closing(object sender, CancelEventArgs e)
         {
-            SetSlidetimer();
+            Settings.SetSlidetimer();
             UpdateColor();
             Closing -= Window_Closing;
             e.Cancel = true;