Browse Source

Updates to picture gallery, interface design updates, bug fixes

Ruben 6 years ago
parent
commit
b4ebfa7feb

+ 0 - 2
.travis.yml

@@ -1,2 +0,0 @@
-language: csharp
-solution: PicView.sln

+ 1 - 4
PicView/MainWindow.xaml

@@ -10,8 +10,6 @@
     Icon="lib/img/reflex-icon.png"
     SizeToContent="WidthAndHeight"
     Style="{DynamicResource MyWindowStyle}"
-    TextOptions.TextFormattingMode="Display"
-    TextOptions.TextRenderingMode="ClearType"
     WindowStartupLocation="CenterScreen">
     <DockPanel LastChildFill="True">
         <DockPanel
@@ -130,10 +128,9 @@
             </Button>
             <TextBlock
                 x:Name="Bar"
-                HorizontalAlignment="Center"
                 VerticalAlignment="Center"
                 Background="{x:Null}"
-                FontFamily="Proxima Nova Alt Th"
+                FontFamily="/PicView;component/lib/fonts/#Aller"
                 FontSize="15"
                 FontWeight="Bold"
                 Foreground="{StaticResource MainColorBrush}"

+ 84 - 118
PicView/MainWindow.xaml.cs

@@ -156,8 +156,8 @@ namespace PicView
 
             // keyboard and Mouse_Keys Keys
             //PreviewKeyDown += previewKeys;
-            KeyDown += MainWindow_KeyDown;
-            KeyUp += MainWindow_KeyUp;
+            KeyDown += KeysDown;
+            KeyUp += KeysUp;
             MouseDown += MainWindow_MouseDown;
 
             // Close Button
@@ -266,9 +266,17 @@ namespace PicView
                     return;
 
                 if (cc.Color == Colors.White)
+                {
                     imgBorder.Background = new SolidColorBrush(Colors.Transparent);
+                    Properties.Settings.Default.BgColorWhite = false;
+                }
+                    
                 else
+                {
                     imgBorder.Background = new SolidColorBrush(Colors.White);
+                    Properties.Settings.Default.BgColorWhite = true;
+                }
+                    
             };
 
             // FlipButton
@@ -392,14 +400,9 @@ namespace PicView
 
             //Keep position when size has changed
             if (size.HeightChanged)
-            {
                 Top += (size.PreviousSize.Height - size.NewSize.Height) / 2;
-            }
-
             if (size.WidthChanged)
-            {
                 Left += (size.PreviousSize.Width - size.NewSize.Width) / 2;
-            }
 
             // Move cursor after resize when the button has been pressed
             if (RightbuttonClicked)
@@ -512,13 +515,13 @@ namespace PicView
             Hide(); // Make it feel faster
 
             // Update user preference for white or transparent image border
-            if (imgBorder != null && bg != null)
-            {
-                var cc = imgBorder.Background as SolidColorBrush;
+            //if (imgBorder != null && bg != null)
+            //{
+            //    var cc = imgBorder.Background as SolidColorBrush;
 
-                if (cc.Color != Colors.White)
-                    Properties.Settings.Default.BgColorWhite = false;
-            }
+            //    if (cc.Color != Colors.White)
+            //        Properties.Settings.Default.BgColorWhite = false;
+            //}
 
             Properties.Settings.Default.Save();
             DeleteTempFiles();
@@ -781,6 +784,8 @@ namespace PicView
                 // Load new value manually
                 await Task.Run(() => pic = RenderToBitmapSource(Pics[x], Extension));
 
+                canNavigate = true;
+
                 // If pic is still null, image can't be rendered
                 if (pic == null)
                 {
@@ -789,6 +794,8 @@ namespace PicView
                 }
             }
 
+            img.Source = pic;
+
             // Scroll to top if scroll enabled
             if (IsScrollEnabled)
                 Scroller.ScrollToTop();
@@ -800,20 +807,13 @@ namespace PicView
             // Fit image to new values
             ZoomFit(pic.PixelWidth, pic.PixelHeight);
 
-            // If gif, use XamlAnimatedGif to animate it
-            if (Extension == ".gif")
-                XamlAnimatedGif.AnimationBehavior.SetSourceUri(img, new Uri(Pics[x]));
-            else
-                img.Source = pic;
-
-            // Update values
+            // Update values          
             var titleString = TitleString(pic.PixelWidth, pic.PixelHeight, x);
             Title = titleString[0];
             Bar.Text = titleString[1];
             Bar.ToolTip = titleString[2];
 
             PicPath = Pics[x];
-            canNavigate = true;
             Progress(x, Pics.Count);
             FolderIndex = x;
             if (!freshStartup)
@@ -823,15 +823,12 @@ namespace PicView
             AjaxLoadingEnd();
 
             // Preload images \\
-            // Only preload every second entry
-            // and determine if going backwards or forwards
             var direction = PreloadDirection();
-
             if (direction.HasValue)
             {
                 await Task.Run(() =>
                 {
-                    Preloader.PreLoad(x, direction.Value);
+                    Preloader.PreLoad(x, reverse);
                     PreloadCount = 0;
 
                     if (x < Pics.Count)
@@ -855,6 +852,7 @@ namespace PicView
                 else
                     picGallery.ScrollTo(reverse);
             }
+
             freshStartup = false;
         }
 
@@ -1026,13 +1024,11 @@ namespace PicView
         private async void PicWeb(string path)
         {
             if (ajaxLoading.Opacity != 1)
-            {
                 AjaxLoadingStart();
-            }
-            var backUp = Bar.Text;
+
             Bar.Text = Loading;
 
-            BitmapSource pic = null;
+            BitmapSource pic;
             try
             {
                 pic = await LoadImageWebAsync(path);
@@ -1044,11 +1040,7 @@ namespace PicView
 
             if (pic == null)
             {
-                if (backUp == Loading)
-                {
-                    backUp = NoImage;
-                }
-                Bar.Text = backUp;
+                Reload(true);
                 ToolTipStyle("Unable to load image");
                 AjaxLoadingEnd();
                 return;
@@ -1205,62 +1197,48 @@ namespace PicView
             Bar.Text = "Unzipping...";
             do
             {
-                //try
-                //{
-                //    // If there are no pictures, but a folder when TempZipPath has a value,
-                //    // we should open the folder
-                //    var directory = Directory.GetDirectories(TempZipPath);
-                //    if (directory.Length > -1)
-                //        TempZipPath = directory[0];
+                var processed = false;
+                var getProcesses = Process.GetProcessesByName("7z");
+                if (getProcesses.Length > 0)
+                    processed = true;
 
-                //    Pics = FileList(TempZipPath);
-                //}
-                //catch (Exception) { }
+                getProcesses = Process.GetProcessesByName("Zip");
+                if (getProcesses.Length > 0)
+                    processed = true;
 
-                if (count > 3)
+                if (!processed)
                 {
-                    var processed = false;
-                    var getProcesses = Process.GetProcessesByName("7z");
-                    if (getProcesses.Length > 0)
-                        processed = true;
-
-                    getProcesses = Process.GetProcessesByName("Zip");
-                    if (getProcesses.Length > 0)
-                        processed = true;
-
-                    if (!processed)
-                    {
-                        Reload(true);
-                        return false;
-                    }
+                    Reload(true);
+                    return false;
+                }
 
-                    if (getProcesses.Length == 0)
+                // Kill it if it's asking for password
+                if (!getProcesses[0].HasExited)
+                    if (getProcesses[0].Threads[0].ThreadState == System.Diagnostics.ThreadState.Wait)
                     {
+                        ToolTipStyle("Password protected archive not supported");
                         Reload(true);
+                        getProcesses[0].Kill();
                         return false;
                     }
 
-                    // Kill it if it's asking for password
-                    if (!getProcesses[0].HasExited)
-                        if (getProcesses[0].Threads[0].ThreadState == System.Diagnostics.ThreadState.Wait)
-                        {
-                            Reload(true);
-                            ToolTipStyle("Password protected archive not supported");
-                            getProcesses[0].Kill();
-                            return false;
-                        }
+                if (count > 3)
+                {
+                    Reload(true);
+                    return false;
                 }
                 switch (count)
                 {
                     case 0:
+                        await Task.Delay(400);
                         break;
 
                     case 1:
-                        await Task.Delay(100);
+                        await Task.Delay(600);
                         break;
 
                     case 2:
-                        await Task.Delay(500);
+                        await Task.Delay(750);
                         break;
 
                     default:
@@ -1284,9 +1262,7 @@ namespace PicView
             PreloadCount = 0;
 
             if (Properties.Settings.Default.PicGallery > 0)
-            {
                 picGallery.Clear();
-            }
         }
 
         /// <summary>
@@ -1631,7 +1607,7 @@ namespace PicView
 
         #region Keyboard & Mouse Shortcuts
 
-        private void MainWindow_KeyDown(object sender, KeyEventArgs e)
+        private void KeysDown(object sender, KeyEventArgs e)
         {
             switch (e.Key)
             {
@@ -1786,7 +1762,7 @@ namespace PicView
             }
         }
 
-        private void MainWindow_KeyUp(object sender, KeyEventArgs e)
+        private void KeysUp(object sender, KeyEventArgs e)
         {
             // FastPicUpdate()
             if (e.Key == Key.Left || e.Key == Key.A || e.Key == Key.Right || e.Key == Key.D)
@@ -2451,20 +2427,10 @@ namespace PicView
 
             // Update TitleBar width to fit new size
             var interfaceSize = 220; // logo and buttons width + extra padding
-            if (Properties.Settings.Default.ShowInterface)
-            {
-                if (xWidth - interfaceSize < interfaceSize)
-                    Bar.MaxWidth = interfaceSize;
-                else
-                    Bar.MaxWidth = xWidth - interfaceSize;
-            }
+            if (xWidth - interfaceSize < interfaceSize)
+                Bar.MaxWidth = interfaceSize;
             else
-            {
-                if (MonitorInfo.Width - interfaceSize < interfaceSize)
-                    Bar.MaxWidth = interfaceSize;
-                else
-                    Bar.MaxWidth = Width - interfaceSize;
-            }
+                Bar.MaxWidth = xWidth - interfaceSize;
 
             // Loses position gradually if not forced to center
             CenterWindowOnScreen();
@@ -3532,18 +3498,14 @@ namespace PicView
             if (Properties.Settings.Default.PicGallery == 1)
             {
                 var da = new DoubleAnimation { Duration = TimeSpan.FromSeconds(.5) };
-                if (!show)
-                {
-                    da.To = 0;
-                    da.Completed += delegate
-                    {
-                        picGallery.Visibility = Visibility.Collapsed;
-                        picGallery.open = false;
-                    };
-                }
-                else
+                if (show)
                 {
+                    da.To = 1;
+                    da.From = 0;
+
+                    picGallery.open = true;
                     picGallery.LoadLayout();
+                    picGallery.ScrollTo();
 
                     if (Application.Current.Windows.OfType<FakeWindow>().Any())
                     {
@@ -3553,14 +3515,19 @@ namespace PicView
                         if (!bg.Children.Contains(picGallery))
                             bg.Children.Add(picGallery);
                     }
-
-                    da.To = 1;
-                    picGallery.open = true;
-                    picGallery.ScrollTo();
+                }
+                else
+                {
+                    da.To = 0;
+                    da.From = 1;
+                    da.Completed += delegate
+                    {
+                        picGallery.Visibility = Visibility.Collapsed;
+                        picGallery.open = false;
+                    };
                 }
 
-                if (picGallery != null)
-                    picGallery.BeginAnimation(OpacityProperty, da);
+                picGallery.BeginAnimation(OpacityProperty, da);
             }
 
             else if (Properties.Settings.Default.PicGallery == 2)
@@ -3629,6 +3596,9 @@ namespace PicView
             Bar.Text = Loading;
             Pic(e.GetId());
 
+            if (Properties.Settings.Default.PicGallery == 1)
+                picGallery.Visibility = Visibility.Collapsed;
+
             /// Fix annoying bug
             ajaxLoading.Opacity = 0;
         }
@@ -3686,7 +3656,6 @@ namespace PicView
         /// <param name="show"></param>
         private async void FadeControlsAsync(bool show)
         {
-            // Hide/show Scrollbar
             var fadeTo = show ? 1 : 0;
 
             await Application.Current.Dispatcher.BeginInvoke((Action)(() =>
@@ -4330,7 +4299,9 @@ namespace PicView
 
                     // Change values
                     var menuItem = (MenuItem)RecentFilesMenuItem.Items[i];
-                    menuItem.Header = Path.GetFileName(item);
+                    var header = Path.GetFileName(item);
+                    header = header.Length > 30 ? Shorten(header, 30) : header;
+                    menuItem.Header = header;
                     menuItem.ToolTip = item;
                 }
                 return;
@@ -4343,10 +4314,12 @@ namespace PicView
                 if (i != 0 && fileNames[i - 1] == item)
                     continue;
 
+                var header = Path.GetFileName(item);
+                header = header.Length > 30 ? Shorten(header, 30) : header;
                 // Add items
                 var menuItem = new MenuItem()
                 {
-                    Header = Path.GetFileName(item),
+                    Header = header,
                     ToolTip = item
                 };
                 // Set tooltip as argument to avoid subscribing and unsubscribing to events
@@ -4378,23 +4351,20 @@ namespace PicView
             {
                 var paths = new System.Collections.Specialized.StringCollection { PicPath };
                 Clipboard.SetFileDropList(paths);
+                ToolTipStyle(FileCopy);
             }
-            ToolTipStyle(FileCopy);
         }
 
         private void CopyBitmap()
         {
             if (Preloader.Contains(PicPath))
-            {
                 Clipboard.SetImage(Preloader.Load(PicPath));
-            }
             else if (img.Source != null)
-            {
                 Clipboard.SetImage((BitmapSource)img.Source);
-            }
             else
                 return;
-            ToolTipStyle(ImageCopy);
+
+            ToolTipStyle("Copied Image to clipboard");
         }
 
         /// <summary>
@@ -4560,11 +4530,7 @@ namespace PicView
                 var filename = Path.GetFileName(file);
                 Pics.Remove(filename);
 
-                if (filename.Length >= 25)
-                {
-                    filename = filename.Substring(0, 21);
-                    filename += "...";
-                }
+                filename = filename.Length >= 25 ? Shorten(filename, 21) : filename;
                 ToolTipStyle(Recyclebin ? "Sent " + filename + " to the recyle bin" : "Deleted " + filename);
 
                 if (reverse)

+ 9 - 10
PicView/PicVIew.csproj

@@ -93,8 +93,8 @@
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="Magick.NET-Q16-HDRI-x64, Version=7.14.1.0, Culture=neutral, PublicKeyToken=2004825badfa91ec, processorArchitecture=AMD64">
-      <HintPath>..\packages\Magick.NET-Q16-HDRI-x64.7.14.1\lib\net40\Magick.NET-Q16-HDRI-x64.dll</HintPath>
+    <Reference Include="Magick.NET-Q16-HDRI-x64, Version=7.14.2.0, Culture=neutral, PublicKeyToken=2004825badfa91ec, processorArchitecture=AMD64">
+      <HintPath>..\packages\Magick.NET-Q16-HDRI-x64.7.14.2\lib\net40\Magick.NET-Q16-HDRI-x64.dll</HintPath>
     </Reference>
     <Reference Include="Microsoft.VisualBasic" />
     <Reference Include="Microsoft.WindowsAPICodePack.Shell">
@@ -115,9 +115,6 @@
     <Reference Include="WindowsBase" />
     <Reference Include="PresentationCore" />
     <Reference Include="PresentationFramework" />
-    <Reference Include="XamlAnimatedGif, Version=1.2.2.0, Culture=neutral, processorArchitecture=MSIL">
-      <HintPath>..\packages\XamlAnimatedGif.1.2.2-beta.1\lib\net45\XamlAnimatedGif.dll</HintPath>
-    </Reference>
   </ItemGroup>
   <ItemGroup>
     <ApplicationDefinition Include="App.xaml">
@@ -365,9 +362,7 @@
     <Resource Include="lib\fonts\texgyreheros-bolditalic.otf" />
     <Resource Include="lib\fonts\texgyreheros-italic.otf" />
     <Resource Include="lib\fonts\texgyreheros-regular.otf" />
-    <None Include="packages.config">
-      <SubType>Designer</SubType>
-    </None>
+    <None Include="packages.config" />
     <None Include="Properties\app.manifest" />
     <None Include="Properties\Settings.settings">
       <Generator>SettingsSingleFileGenerator</Generator>
@@ -420,12 +415,16 @@
     </FileAssociation>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <Import Project="..\packages\Magick.NET-Q16-HDRI-x64.7.14.1\build\net40\Magick.NET-Q16-HDRI-x64.targets" Condition="Exists('..\packages\Magick.NET-Q16-HDRI-x64.7.14.1\build\net40\Magick.NET-Q16-HDRI-x64.targets')" />
+  <PropertyGroup>
+    <PostBuildEvent>
+    </PostBuildEvent>
+  </PropertyGroup>
+  <Import Project="..\packages\Magick.NET-Q16-HDRI-x64.7.14.2\build\net40\Magick.NET-Q16-HDRI-x64.targets" Condition="Exists('..\packages\Magick.NET-Q16-HDRI-x64.7.14.2\build\net40\Magick.NET-Q16-HDRI-x64.targets')" />
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
     <PropertyGroup>
       <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
     </PropertyGroup>
-    <Error Condition="!Exists('..\packages\Magick.NET-Q16-HDRI-x64.7.14.1\build\net40\Magick.NET-Q16-HDRI-x64.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Magick.NET-Q16-HDRI-x64.7.14.1\build\net40\Magick.NET-Q16-HDRI-x64.targets'))" />
+    <Error Condition="!Exists('..\packages\Magick.NET-Q16-HDRI-x64.7.14.2\build\net40\Magick.NET-Q16-HDRI-x64.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Magick.NET-Q16-HDRI-x64.7.14.2\build\net40\Magick.NET-Q16-HDRI-x64.targets'))" />
   </Target>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.

+ 3 - 40
PicView/lib/ArchiveExtraction.cs

@@ -17,6 +17,9 @@ namespace PicView.lib
         /// <returns></returns>
         internal static bool Extract(string path)
         {
+            if (!string.IsNullOrWhiteSpace(TempZipPath))
+                DeleteTempFiles();
+
             var Winrar = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\WinRAR\\WinRAR.exe";
             if (!File.Exists(Winrar))
                 Winrar = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\WinRAR\\WinRAR.exe";
@@ -71,46 +74,6 @@ namespace PicView.lib
             });
 
             if (x == null) return;
-            x.EnableRaisingEvents = true;
-            x.Exited += (s, e) => 
-            {
-                Application.Current.Dispatcher.Invoke(() =>
-                {
-                    var mainWindow = Application.Current.MainWindow as MainWindow;
-                    if (!string.IsNullOrWhiteSpace(TempZipPath))
-                    {
-                        if (Directory.Exists(TempZipPath))
-                        {
-                            try
-                            {
-                                if (FolderIndex > 0)
-                                {
-                                    //Pics = FileList(TempZipPath);
-                                    //mainWindow.Focus();
-                                }
-                                else
-                                {
-                                    // If there are no pictures, but a folder when TempZipPath has a value,
-                                    // we should open the folder
-                                    var directory = Directory.GetDirectories(TempZipPath);
-                                    if (directory.Length > 0)
-                                        TempZipPath = directory[0];
-
-                                    Pics = FileList(TempZipPath);
-                                    mainWindow.Pic(Pics[0]);
-                                    mainWindow.Focus();
-                                }
-                            }
-                            catch (Exception)
-                            {
-                                mainWindow.Reload(true);
-                            }
-                        }
-                    }
-                    else
-                        mainWindow.Reload(true);
-                });
-            };
             x.WaitForExit(750);
         }
     }

+ 15 - 0
PicView/lib/Helper.cs

@@ -41,6 +41,11 @@ namespace PicView.lib
             prog.SetProgressState(TaskbarProgressBarState.NoProgress);
         }
 
+        /// <summary>
+        ///  Only preload every second entry
+        ///  and determine if going backwards or forwards
+        /// </summary>
+        /// <returns></returns>
         internal static bool? PreloadDirection()
         {
             if (PreloadCount > 1 || freshStartup)
@@ -91,6 +96,16 @@ namespace PicView.lib
                 bgBrush.Color = AnimationHelper.GetPrefferedColorOver();
             }
         }
+
+        internal static string Shorten(string name,int amount)
+        {
+            if (name.Length >= 25)
+            {
+                name = name.Substring(0, amount);
+                name += "...";
+            }
+            return name;
+        }
      
 
     }

+ 6 - 11
PicView/lib/Styles/Menu.xaml

@@ -120,7 +120,7 @@
     </Style>
 
     <!--  ScrollViewer for a MenuItem  -->
-    <Style
+    <!--<Style
         x:Key="MenuScrollViewer"
         BasedOn="{x:Null}"
         TargetType="{x:Type ScrollViewer}">
@@ -128,8 +128,8 @@
         <Setter Property="VerticalScrollBarVisibility" Value="Auto" />
         <Setter Property="Template">
             <Setter.Value>
-                <!--<SnippetMenuScrollViewer>-->
-                <!--  ScrollViewer for a MenuItem  -->
+                --><!--<SnippetMenuScrollViewer>-->
+                <!--  ScrollViewer for a MenuItem  --><!--
                 <ControlTemplate TargetType="{x:Type ScrollViewer}">
                     <Grid SnapsToDevicePixels="True">
                         <Grid.ColumnDefinitions>
@@ -185,10 +185,10 @@
                         </RepeatButton>
                     </Grid>
                 </ControlTemplate>
-                <!--</SnippetMenuScrollViewer>-->
+                --><!--</SnippetMenuScrollViewer>--><!--
             </Setter.Value>
         </Setter>
-    </Style>
+    </Style>-->
 
     <!--<SnippetMenuItem>-->
     <!--<Seperator>-->
@@ -418,12 +418,7 @@
                         BorderBrush="{StaticResource BorderBrush}"
                         BorderThickness="1"
                         SnapsToDevicePixels="True">
-                        <ScrollViewer
-                            CanContentScroll="True"
-                            Foreground="{StaticResource MainColorBrush}"
-                            Style="{StaticResource MenuScrollViewer}">
-                            <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
-                        </ScrollViewer>
+                        <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
                     </Border>
                 </Popup>
             </Grid>

+ 2 - 30
PicView/lib/UserControls/CustomControls/PicGallery.xaml

@@ -17,42 +17,14 @@
             <UserControls:X2
                 x:Name="x2"
                 HorizontalAlignment="Right"
-                VerticalAlignment="Top" />
+                VerticalAlignment="Top"
+                Panel.ZIndex="1" />
             <ScrollViewer
                 x:Name="Scroller"
                 FocusVisualStyle="{x:Null}"
                 Focusable="False"
                 HorizontalScrollBarVisibility="Visible"
                 VerticalScrollBarVisibility="Disabled">
-                                    <ScrollViewer.Style>
-                        <Style TargetType="{x:Type ScrollViewer}">
-                            <Setter Property="OverridesDefaultStyle" Value="True" />
-                            <Setter Property="Template">
-                                <Setter.Value>
-                                    <ControlTemplate TargetType="{x:Type ScrollViewer}">
-                                        <Grid>
-                                            <Grid.ColumnDefinitions>
-                                                <ColumnDefinition Width="*" />
-                                                <ColumnDefinition Width="Auto" />
-                                            </Grid.ColumnDefinitions>
-                                            <Grid.RowDefinitions>
-                                                <RowDefinition Height="*" />
-                                                <RowDefinition Height="Auto" />
-                                            </Grid.RowDefinitions>
-                                            <ScrollContentPresenter Grid.RowSpan="2" Grid.ColumnSpan="2" />
-                                            <ScrollBar
-                                                Name="PART_VerticalScrollBar"
-                                                Grid.Column="1"
-                                                Maximum="{TemplateBinding ScrollableHeight}"
-                                                ViewportSize="{TemplateBinding ViewportHeight}"
-                                                Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
-                                                Value="{TemplateBinding VerticalOffset}" />
-                                        </Grid>
-                                    </ControlTemplate>
-                                </Setter.Value>
-                            </Setter>
-                        </Style>
-                    </ScrollViewer.Style>
                 <WrapPanel
                     x:Name="Container"
                     VerticalAlignment="Center"

+ 56 - 62
PicView/lib/UserControls/CustomControls/PicGallery.xaml.cs

@@ -119,7 +119,7 @@ namespace PicView.lib.UserControls
                 }
 
                 HorizontalAlignment = HorizontalAlignment.Stretch;
-                Scroller.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
+                Scroller.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
                 Scroller.VerticalScrollBarVisibility = ScrollBarVisibility.Disabled;
                 x2.Visibility = Visibility.Visible;
             }
@@ -129,7 +129,7 @@ namespace PicView.lib.UserControls
                 Height = MonitorInfo.Height;
                 HorizontalAlignment = HorizontalAlignment.Right;
                 Scroller.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
-                Scroller.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
+                Scroller.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
                 x2.Visibility = Visibility.Collapsed;
             }
 
@@ -197,83 +197,77 @@ namespace PicView.lib.UserControls
         internal void Click(int id)
         {
             Application.Current.MainWindow.Focus();
-            var z = Container.Children[id] as PicGalleryItem;
-            var img = z.img.Source;
-            
-            PreviewItemClick(this, new MyEventArgs(id, img));
 
 
             if (Properties.Settings.Default.PicGallery == 1)
             {
-                //var img = new Image()
-                //{
-                //    Source = GetBitmapSourceThumb(Pics[id]),
-                //    Stretch = Stretch.Fill,
-                //    HorizontalAlignment = HorizontalAlignment.Center,
-                //    VerticalAlignment = VerticalAlignment.Center
-                //};
-                //var border = new Border()
-                //{
-                //    BorderThickness = new Thickness(1),
-                //    BorderBrush = (SolidColorBrush)Application.Current.Resources["BorderBrush"],
-                //    Background = (SolidColorBrush)Application.Current.Resources["BackgroundColorBrush"]
-                //};
-                //border.Child = img;
-                //grid.Children.Add(border);
-
-                //var from = PicGalleryItem.picGalleryItem_Size;
-                //var to = new double[] { Application.Current.MainWindow.ActualWidth - 15, Application.Current.MainWindow.ActualHeight - 95 };
-
-                //var da = new DoubleAnimation
-                //{
-                //    From = from,
-                //    To = to[0],
-                //    Duration = TimeSpan.FromSeconds(.3),
-                //    AccelerationRatio = 0.2,
-                //    DecelerationRatio = 0.4
-                //};
-
-                //var da0 = new DoubleAnimation
-                //{
-                //    From = from,
-                //    To = to[1],
-                //    Duration = TimeSpan.FromSeconds(.3),
-                //    AccelerationRatio = 0.2,
-                //    DecelerationRatio = 0.4
-                //};
-
-                //da.Completed += delegate
-                //{
-                //    ItemClick(this, new MyEventArgs(id, img.Source));
-                //    grid.Children.Remove(border);
-                //    Visibility = Visibility.Collapsed;
-                //    picGallery.open = false;
-                //};
-
-                //img.BeginAnimation(WidthProperty, da);
-                //img.BeginAnimation(HeightProperty, da0);
+                var z = Container.Children[id] as PicGalleryItem;
+                PreviewItemClick(this, new MyEventArgs(id, z.img.Source));
+                Width = xWidth;
+                Height = xHeight;
+
+                var img = new Image()
+                {
+                    Source = GetBitmapSourceThumb(Pics[id]),
+                    Stretch = Stretch.Fill,
+                    HorizontalAlignment = HorizontalAlignment.Center,
+                    VerticalAlignment = VerticalAlignment.Center
+                };
+                // Need to add border for background to pictures with transparent background
+                var border = new Border()
+                {
+                    Background = new SolidColorBrush(Properties.Settings.Default.BgColorWhite ? Colors.White : (Color)Application.Current.Resources["BackgroundColorBrush"])
+                };
+                border.Child = img;
+                grid.Children.Add(border);
+
+                var from = PicGalleryItem.picGalleryItem_Size;
+                var to = new double[] { xWidth, xHeight };
+                var acceleration = 0.2;
+                var deceleration = 0.4;
+                var duration = TimeSpan.FromSeconds(.3);
 
                 var da = new DoubleAnimation
                 {
-                    From = 1,
-                    To = 0,
-                    Duration = TimeSpan.FromSeconds(.3),
-                    AccelerationRatio = 0.2,
-                    DecelerationRatio = 0.4
+                    From = from,
+                    To = to[0],
+                    Duration = duration,
+                    AccelerationRatio = acceleration,
+                    DecelerationRatio = deceleration
+                };
+
+                var da0 = new DoubleAnimation
+                {
+                    From = from,
+                    To = to[1],
+                    Duration = duration,
+                    AccelerationRatio = acceleration,
+                    DecelerationRatio = deceleration
                 };
 
                 da.Completed += delegate
                 {
-                    ItemClick(this, new MyEventArgs(id, null));
-                    Visibility = Visibility.Collapsed;
+                    ItemClick(this, new MyEventArgs(id, img.Source));
+                    grid.Children.Remove(border);
                     picGallery.open = false;
                 };
 
-                BeginAnimation(OpacityProperty, da);
+                border.BeginAnimation(WidthProperty, da);
+                border.BeginAnimation(HeightProperty, da0);
             }
             else
             {
-                ItemClick(this, new MyEventArgs(id, img));
+                if (Preloader.Contains(Pics[id]))
+                {
+                    ItemClick(this, new MyEventArgs(id, null));
+                }
+                else
+                {
+                    var z = Container.Children[id] as PicGalleryItem;
+                    PreviewItemClick(this, new MyEventArgs(id, z.img.Source));
+                    ItemClick(this, new MyEventArgs(id, null));
+                }
+
             }
 
             picGallery.open = false;

+ 1 - 3
PicView/lib/UserControls/Menus/FileMenu.xaml

@@ -2,9 +2,7 @@
     x:Class="PicView.lib.UserControls.FileMenu"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-    Foreground="{StaticResource MainColorBrush}"
-    TextOptions.TextFormattingMode="Display"
-    TextOptions.TextRenderingMode="ClearType">
+    Foreground="{StaticResource MainColorBrush}">
     <StackPanel>
         <Border
             Width="292"

+ 1 - 3
PicView/lib/UserControls/Menus/FunctionsMenu.xaml

@@ -5,9 +5,7 @@
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:local="clr-namespace:PicView.lib.UserControls.Menus"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-    Foreground="{StaticResource MainColorBrush}"
-    TextOptions.TextFormattingMode="Display"
-    TextOptions.TextRenderingMode="ClearType">
+    Foreground="{StaticResource MainColorBrush}">
     <StackPanel>
         <Border
             Width="390"

+ 1 - 4
PicView/lib/UserControls/Menus/ImageSettings.xaml

@@ -2,10 +2,7 @@
     x:Class="PicView.lib.UserControls.ImageSettings"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-    xmlns:local="clr-namespace:PicView.lib.UserControls"
-    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-    TextOptions.TextFormattingMode="Display"
-    TextOptions.TextRenderingMode="ClearType">
+    xmlns:local="clr-namespace:PicView.lib.UserControls">
     <StackPanel>
         <Border
             Width="292"

+ 1 - 3
PicView/lib/UserControls/Menus/QuickSettingsMenu.xaml

@@ -2,9 +2,7 @@
     x:Class="PicView.lib.UserControls.QuickSettingsMenu"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-    Foreground="{StaticResource MainColorBrush}"
-    TextOptions.TextFormattingMode="Display"
-    TextOptions.TextRenderingMode="ClearType">
+    Foreground="{StaticResource MainColorBrush}">
     <StackPanel>
         <Border
             Width="360"

+ 0 - 2
PicView/lib/Windows/About.xaml

@@ -10,8 +10,6 @@
     Foreground="{StaticResource MainColorBrush}"
     ResizeMode="NoResize"
     ShowInTaskbar="False"
-    TextOptions.TextFormattingMode="Display"
-    TextOptions.TextRenderingMode="ClearType"
     WindowStartupLocation="CenterOwner"
     WindowStyle="None">
     <Window.Resources>

+ 0 - 2
PicView/lib/Windows/AllSettings.xaml

@@ -10,8 +10,6 @@
     ResizeMode="NoResize"
     ShowInTaskbar="False"
     SizeToContent="WidthAndHeight"
-    TextOptions.TextFormattingMode="Display"
-    TextOptions.TextRenderingMode="ClearType"
     WindowStartupLocation="CenterOwner"
     WindowStyle="None">
 

+ 12 - 14
PicView/lib/Windows/Help.xaml

@@ -15,8 +15,6 @@
     Foreground="{StaticResource MainColorBrush}"
     ResizeMode="NoResize"
     ShowInTaskbar="False"
-    TextOptions.TextFormattingMode="Display"
-    TextOptions.TextRenderingMode="ClearType"
     WindowStartupLocation="CenterOwner"
     WindowStyle="None"
     mc:Ignorable="d">
@@ -161,7 +159,7 @@
                             </BulletDecorator.Bullet>
                             <TextBlock Margin="5,0,0,0">
                                 <Bold>F1</Bold>
-                                to show help window (this).</TextBlock>
+                                to show help window.</TextBlock>
                         </BulletDecorator>
 
                         <BulletDecorator Margin="7,2">
@@ -223,8 +221,8 @@
                             </BulletDecorator.Bullet>
                             <TextBlock Margin="5,0,0,0">
                                 <Bold>Ctrl</Bold>
-                                +<Bold>0</Bold>
-                                or<Bold>0</Bold>
+                                + <Bold>0</Bold>
+                                or <Bold>0</Bold>
                                 to open a file.</TextBlock>
                         </BulletDecorator>
                         <BulletDecorator Margin="7,2">
@@ -236,9 +234,9 @@
                             </BulletDecorator.Bullet>
                             <TextBlock Margin="5,0,0,0">
                                 <Bold>Ctrl</Bold>
-                                +<Bold>Shift</Bold>
-                                +<Bold>C</Bold>
-                                to copy bitmap image to clipboard.</TextBlock>
+                                + <Bold>Shift</Bold>
+                                + <Bold>C</Bold>
+                                to copy image to clipboard.</TextBlock>
                         </BulletDecorator>
                         <BulletDecorator Margin="7,2">
                             <BulletDecorator.Bullet>
@@ -249,7 +247,7 @@
                             </BulletDecorator.Bullet>
                             <TextBlock Margin="5,0,0,0">
                                 <Bold>Ctrl</Bold>
-                                +<Bold>C</Bold>
+                                + <Bold>C</Bold>
                                 to copy image to clipboard.</TextBlock>
                         </BulletDecorator>
                         <BulletDecorator Margin="7,2">
@@ -261,7 +259,7 @@
                             </BulletDecorator.Bullet>
                             <TextBlock Margin="5,0,0,0">
                                 <Bold>Ctrl</Bold>
-                                +<Bold>V</Bold>
+                                + <Bold>V</Bold>
                                 to paste image from clipboard.</TextBlock>
                         </BulletDecorator>
                         <BulletDecorator Margin="7,2">
@@ -273,7 +271,7 @@
                             </BulletDecorator.Bullet>
                             <TextBlock Margin="5,0,0,0">
                                 <Bold>Ctrl</Bold>
-                                +<Bold>S</Bold>
+                                + <Bold>S</Bold>
                                 to save image.</TextBlock>
                         </BulletDecorator>
                         <BulletDecorator Margin="7,2">
@@ -285,7 +283,7 @@
                             </BulletDecorator.Bullet>
                             <TextBlock Margin="5,0,0,0">
                                 <Bold>Ctrl</Bold>
-                                +<Bold>I</Bold>
+                                + <Bold>I</Bold>
                                 to show file details.</TextBlock>
                         </BulletDecorator>
                         <BulletDecorator Margin="7,2">
@@ -297,7 +295,7 @@
                             </BulletDecorator.Bullet>
                             <TextBlock Margin="5,0,0,0">
                                 <Bold>Ctrl</Bold>
-                                +<Bold>R</Bold>
+                                + <Bold>R</Bold>
                                 to reload.</TextBlock>
                         </BulletDecorator>
                         <BulletDecorator Margin="7,2">
@@ -309,7 +307,7 @@
                             </BulletDecorator.Bullet>
                             <TextBlock Margin="5,0,0,0">
                                 <Bold>Shift</Bold>
-                                +<Bold>Del</Bold>
+                                + <Bold>Del</Bold>
                                 to premanently delete image.</TextBlock>
                         </BulletDecorator>
                         <BulletDecorator Margin="7,2">

+ 1 - 3
PicView/lib/Windows/Tools.xaml

@@ -10,9 +10,7 @@
     Foreground="{StaticResource MainColorBrush}"
     Icon="/lib/img/reflex-icon.png"
     SizeToContent="WidthAndHeight"
-    Style="{DynamicResource MyWindowStyle}"
-    TextOptions.TextFormattingMode="Display"
-    TextOptions.TextRenderingMode="ClearType">
+    Style="{DynamicResource MyWindowStyle}">
 
     <DockPanel LastChildFill="True">
         <DockPanel

+ 1 - 2
PicView/packages.config

@@ -1,5 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
-  <package id="Magick.NET-Q16-HDRI-x64" version="7.14.1" targetFramework="net472" />
-  <package id="XamlAnimatedGif" version="1.2.2-beta.1" targetFramework="net472" />
+  <package id="Magick.NET-Q16-HDRI-x64" version="7.14.2" targetFramework="net472" />
 </packages>