Skip to content

Commit

Permalink
Merge pull request #92 from Ruben2776/dev
Browse files Browse the repository at this point in the history
Update stable
  • Loading branch information
Ruben2776 authored Mar 7, 2023
2 parents 3fe78ef + 0009411 commit d238236
Show file tree
Hide file tree
Showing 232 changed files with 5,844 additions and 6,355 deletions.
353 changes: 45 additions & 308 deletions PicView/Animations/AnimationHelper.cs

Large diffs are not rendered by default.

18 changes: 8 additions & 10 deletions PicView/Animations/FadeControls.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using PicView.PicGallery;
using PicView.Properties;
using PicView.UILogic;
using PicView.UILogic.TransformImage;
using System;
using System.Threading.Tasks;
using System.Timers;
using System.Windows.Controls.Primitives;
using System.Windows.Threading;
using static PicView.UILogic.UC;

namespace PicView.Animations
Expand All @@ -13,28 +13,27 @@ internal static class FadeControls
/// <summary>
/// Timer used to hide interface and/or scrollbar
/// </summary>
internal static Timer? ActivityTimer { get; set; }
internal static System.Timers.Timer? ActivityTimer { get; set; }

/// <summary>
/// Hides/shows interface elements with a fade animation
/// </summary>
/// <param name="show"></param>
internal static async Task FadeAsync(bool show)
{
if (Properties.Settings.Default.ShowInterface && Properties.Settings.Default.Fullscreen == false
if (Settings.Default.ShowInterface && Settings.Default.Fullscreen == false
|| GetClickArrowRight == null
|| GetClickArrowLeft == null
|| Getx2 == null
|| GetGalleryShortcut == null
|| Scroll.IsAutoScrolling
|| GalleryFunctions.IsVerticalFullscreenOpen
|| GalleryFunctions.IsHorizontalFullscreenOpen
|| GalleryFunctions.IsHorizontalOpen)
{
return;
}

await ConfigureWindows.GetMainWindow.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, (Action)(() =>
await ConfigureWindows.GetMainWindow.Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action)(() =>
{
if (GetCropppingTool != null)
{
Expand All @@ -44,7 +43,7 @@ await ConfigureWindows.GetMainWindow.Dispatcher.BeginInvoke(System.Windows.Threa
}
}

if (Properties.Settings.Default.ScrollEnabled && ConfigureWindows.GetMainWindow?.Scroller?.ScrollableHeight > 0)
if (Settings.Default.ScrollEnabled && ConfigureWindows.GetMainWindow?.Scroller?.ScrollableHeight > 0)
{
ScrollbarFade(show);
}
Expand Down Expand Up @@ -75,7 +74,6 @@ await ConfigureWindows.GetMainWindow.Dispatcher.BeginInvoke(System.Windows.Threa
AnimationHelper.Fade(Getx2, opacity, timespan);
AnimationHelper.Fade(GetMinus, opacity, timespan);
AnimationHelper.Fade(GetRestorebutton, opacity, timespan);

}));
}

Expand All @@ -85,7 +83,7 @@ await ConfigureWindows.GetMainWindow.Dispatcher.BeginInvoke(System.Windows.Threa
/// <param name="show"></param>
internal static void ScrollbarFade(bool show)
{
var s = ConfigureWindows.GetMainWindow?.Scroller?.Template?.FindName("PART_VerticalScrollBar", ConfigureWindows.GetMainWindow?.Scroller) as System.Windows.Controls.Primitives.ScrollBar;
var s = ConfigureWindows.GetMainWindow?.Scroller?.Template?.FindName("PART_VerticalScrollBar", ConfigureWindows.GetMainWindow?.Scroller) as ScrollBar;

if (show)
{
Expand Down
34 changes: 3 additions & 31 deletions PicView/Animations/MouseOverAnimations.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Windows;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Animation;

Expand All @@ -24,19 +23,10 @@ Changes color depending on the users settings.
private static readonly ColorAnimation ccAnim2 = new ColorAnimation { Duration = TimeSpan.FromSeconds(.2) };
private static readonly SolidColorBrush borderBrush = (SolidColorBrush)Application.Current.Resources["BorderBrush"];

internal static void AltInterfacePreviewMouseOver(Brush foreground, Brush border)
{
var alpha = AnimationHelper.GetPrefferedColorOver();
ccAnim.From = alpha;
ccAnim.To = AnimationHelper.GetPrefferedColorDown();
foreground.BeginAnimation(SolidColorBrush.ColorProperty, ccAnim);
AnimationHelper.MouseOverColorEvent(alpha.A, alpha.R, alpha.G, alpha.B, border, true);
}

internal static void AltInterfaceMouseOver(Brush foreground, Brush background, Brush border)
{
ccAnim.From = (Color)Application.Current.Resources["IconColor"];
ccAnim.To = AnimationHelper.GetPrefferedColorOver();
ccAnim.To = AnimationHelper.GetPrefferedColor();

foreground.BeginAnimation(SolidColorBrush.ColorProperty, ccAnim);

Expand All @@ -55,7 +45,7 @@ internal static void AltInterfaceMouseOver(Brush foreground, Brush background, B

internal static void AltInterfaceMouseLeave(Brush foreground, Brush background, Brush border)
{
ccAnim.From = AnimationHelper.GetPrefferedColorOver();
ccAnim.From = AnimationHelper.GetPrefferedColor();
ccAnim.To = (Color)Application.Current.Resources["IconColor"];

foreground.BeginAnimation(SolidColorBrush.ColorProperty, ccAnim);
Expand All @@ -77,11 +67,6 @@ internal static void AltInterfaceMouseLeave(Brush foreground, Brush background,

#region 1x

internal static void PreviewMouseButtonDownAnim(Brush brush, bool alpha = false)
{
AnimationHelper.PreviewMouseLeftButtonDownColorEvent(brush, alpha);
}

internal static void ButtonMouseOverAnim(Brush brush, bool transparent = false, bool alpha = false)
{
if (transparent)
Expand Down Expand Up @@ -136,12 +121,6 @@ internal static void ButtonMouseLeaveAnimBgColor(Brush brush, bool alpha = false

#region 2x

internal static void PreviewMouseButtonDownAnim(Brush brush, Brush brush2, bool alpha = false)
{
AnimationHelper.PreviewMouseLeftButtonDownColorEvent(brush, alpha);
AnimationHelper.PreviewMouseLeftButtonDownColorEvent(brush2, alpha);
}

internal static void ButtonMouseOverAnim(Brush brush, Brush brush2, bool transparent = false, bool alpha = false)
{
ButtonMouseOverAnim(brush, transparent, alpha);
Expand All @@ -158,13 +137,6 @@ internal static void ButtonMouseLeaveAnim(Brush brush, Brush brush2, bool transp

#region 3x

internal static void PreviewMouseButtonDownAnim(Brush brush, Brush brush2, Brush brush3, bool alpha = false)
{
AnimationHelper.PreviewMouseLeftButtonDownColorEvent(brush, alpha);
AnimationHelper.PreviewMouseLeftButtonDownColorEvent(brush2, alpha);
AnimationHelper.PreviewMouseLeftButtonDownColorEvent(brush3, alpha);
}

internal static void ButtonMouseOverAnim(Brush brush, Brush brush2, Brush brush3, bool transparent = false, bool alpha = false)
{
ButtonMouseOverAnim(brush, transparent, alpha);
Expand Down
9 changes: 0 additions & 9 deletions PicView/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
<setting name="Looping" serializeAs="String">
<value>False</value>
</setting>
<setting name="WindowBorderColorEnabled" serializeAs="String">
<value>False</value>
</setting>
<setting name="BgColorChoice" serializeAs="String">
<value>0</value>
</setting>
Expand Down Expand Up @@ -82,12 +79,6 @@
<setting name="CtrlZoom" serializeAs="String">
<value>True</value>
</setting>
<setting name="FullscreenGalleryVertical" serializeAs="String">
<value>False</value>
</setting>
<setting name="StartInFullscreenGallery" serializeAs="String">
<value>False</value>
</setting>
<setting name="Maximized" serializeAs="String">
<value>False</value>
</setting>
Expand Down
8 changes: 5 additions & 3 deletions PicView/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Windows;
using PicView.FileHandling;
using System.Runtime;
using System.Windows;

namespace PicView
{
Expand All @@ -9,8 +11,8 @@ public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
System.Runtime.ProfileOptimization.SetProfileRoot(FileHandling.FileFunctions.GetWritingPath());
System.Runtime.ProfileOptimization.StartProfile("ProfileOptimization");
ProfileOptimization.SetProfileRoot(FileFunctions.GetWritingPath());
ProfileOptimization.StartProfile("ProfileOptimization");
}
}
}
Loading

0 comments on commit d238236

Please sign in to comment.