WIP #56: adjust shadows; add Gaussian blur, try out the new InfoPanel

This commit is contained in:
Paddy Xu
2017-08-04 22:02:32 +03:00
parent 15d94d2c4b
commit 8d59e7138c
17 changed files with 491 additions and 222 deletions

View File

@@ -6,6 +6,7 @@
xmlns:local="clr-namespace:QuickLook.Plugin.ImageViewer" xmlns:local="clr-namespace:QuickLook.Plugin.ImageViewer"
xmlns:animatedImage="clr-namespace:QuickLook.Plugin.ImageViewer.AnimatedImage" xmlns:animatedImage="clr-namespace:QuickLook.Plugin.ImageViewer.AnimatedImage"
mc:Ignorable="d" mc:Ignorable="d"
Background="White"
x:Name="imagePanel" x:Name="imagePanel"
d:DesignHeight="300" d:DesignWidth="300"> d:DesignHeight="300" d:DesignWidth="300">
<Grid> <Grid>
@@ -13,7 +14,7 @@
VerticalScrollBarVisibility="Auto" Focusable="False" IsManipulationEnabled="True"> VerticalScrollBarVisibility="Auto" Focusable="False" IsManipulationEnabled="True">
<animatedImage:AnimatedImage x:Name="viewPanelImage" Stretch="None" <animatedImage:AnimatedImage x:Name="viewPanelImage" Stretch="None"
RenderOptions.BitmapScalingMode="{Binding RenderMode, ElementName=imagePanel}" RenderOptions.BitmapScalingMode="{Binding RenderMode, ElementName=imagePanel}"
AnimationUri="{Binding ImageUriSource, ElementName=imagePanel}" /> AnimationUri="{Binding ImageUriSource, ElementName=imagePanel}" Margin="0,28,0,0" />
</ScrollViewer> </ScrollViewer>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@@ -22,7 +22,7 @@ using System.Windows;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Threading; using System.Windows.Threading;
namespace QuickLook.Controls namespace QuickLook.Controls.BusyDecorator
{ {
public delegate Visual CreateContentFunction(); public delegate Visual CreateContentFunction();

View File

@@ -22,7 +22,7 @@ using System.Windows.Controls;
using System.Windows.Data; using System.Windows.Data;
using System.Windows.Media; using System.Windows.Media;
namespace QuickLook.Controls namespace QuickLook.Controls.BusyDecorator
{ {
[StyleTypedProperty(Property = "BusyStyle", StyleTargetType = typeof(Control))] [StyleTypedProperty(Property = "BusyStyle", StyleTargetType = typeof(Control))]
public class BusyDecorator : Decorator, IDisposable public class BusyDecorator : Decorator, IDisposable

View File

@@ -18,7 +18,7 @@
using System.Windows; using System.Windows;
using System.Windows.Media; using System.Windows.Media;
namespace QuickLook.Controls namespace QuickLook.Controls.BusyDecorator
{ {
public class VisualTargetPresentationSource : PresentationSource public class VisualTargetPresentationSource : PresentationSource
{ {

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,48 @@
sampler2D Texture1Sampler : register(S0);
float2 Direction : register(C0);
float4 DdxDdy : register(C1);
// http://dev.theomader.com/gaussian-kernel-calculator/
static const float HalfWidth = 80;
static const float poisson[161] =
{
0.004411,0.004466,0.004521,0.004576,0.004631,0.004686,0.004741,0.004796,0.004851,0.004905,
0.004959,0.005014,0.005067,0.005121,0.005175,0.005228,0.005281,0.005334,0.005386,0.005438,
0.00549,0.005541,0.005592,0.005642,0.005692,0.005742,0.005791,0.005839,0.005888,0.005935,
0.005982,0.006029,0.006074,0.00612,0.006164,0.006208,0.006252,0.006294,0.006336,0.006377,
0.006418,0.006458,0.006497,0.006535,0.006572,0.006609,0.006644,0.006679,0.006713,0.006746,
0.006779,0.00681,0.00684,0.00687,0.006898,0.006926,0.006952,0.006978,0.007003,0.007026,
0.007049,0.00707,0.007091,0.00711,0.007128,0.007146,0.007162,0.007177,0.007191,0.007204,
0.007216,0.007227,0.007236,0.007245,0.007252,0.007258,0.007263,0.007267,0.00727,0.007272,
0.007272,
0.007272,0.00727,0.007267,0.007263,0.007258,0.007252,0.007245,0.007236,0.007227,0.007216,
0.007204,0.007191,0.007177,0.007162,0.007146,0.007128,0.00711,0.007091,0.00707,0.007049,
0.007026,0.007003,0.006978,0.006952,0.006926,0.006898,0.00687,0.00684,0.00681,0.006779,
0.006746,0.006713,0.006679,0.006644,0.006609,0.006572,0.006535,0.006497,0.006458,0.006418,
0.006377,0.006336,0.006294,0.006252,0.006208,0.006164,0.00612,0.006074,0.006029,0.005982,
0.005935,0.005888,0.005839,0.005791,0.005742,0.005692,0.005642,0.005592,0.005541,0.00549,
0.005438,0.005386,0.005334,0.005281,0.005228,0.005175,0.005121,0.005067,0.005014,0.004959,
0.004905,0.004851,0.004796,0.004741,0.004686,0.004631,0.004576,0.004521,0.004466,0.004411
};
float4 main(float2 uv : TEXCOORD) : COLOR
{
float4 color = { 0, 0, 0, 1 };
for (int delta = -HalfWidth; delta <= HalfWidth; delta++)
{
float2 coord;
coord.x = uv.x + delta * DdxDdy.x * Direction.x;
coord.y = uv.y + delta * DdxDdy.w * Direction.y;
coord = saturate(coord);
// Sample pixel
color += tex2D(Texture1Sampler, coord) * poisson[delta + HalfWidth];
}
return(color);
}

Binary file not shown.

View File

@@ -0,0 +1,59 @@
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Effects;
namespace QuickLook.Controls.GlassLayer
{
public class GaussianBlurEffect : ShaderEffect
{
public static readonly DependencyProperty InputProperty =
RegisterPixelShaderSamplerProperty("Input", typeof(GaussianBlurEffect), 0);
public static readonly DependencyProperty DirectionProperty =
DependencyProperty.Register("Direction", typeof(Point), typeof(GaussianBlurEffect),
new UIPropertyMetadata(new Point(0, 1), PixelShaderConstantCallback(0)));
public GaussianBlurEffect()
{
var pixelShader = new PixelShader
{
UriSource = new Uri("pack://application:,,,/QuickLook;component/Controls/GlassLayer/GaussianBlur.ps",
UriKind.Absolute)
};
PixelShader = pixelShader;
DdxUvDdyUvRegisterIndex = 1;
UpdateShaderValue(InputProperty);
UpdateShaderValue(DirectionProperty);
}
public Brush Input
{
get => (Brush) GetValue(InputProperty);
set => SetValue(InputProperty, value);
}
public Point Direction
{
get => (Point) GetValue(DirectionProperty);
set => SetValue(DirectionProperty, value);
}
}
}

View File

@@ -0,0 +1,36 @@
<UserControl x:Class="QuickLook.Controls.GlassLayer.GlassLayer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:QuickLook.Controls.GlassLayer"
mc:Ignorable="d"
x:Name="glassLayer"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<Rectangle Panel.ZIndex="100" Visibility="{Binding ElementName=glassLayer, Path=NoiseVisibility}">
<Rectangle.Fill>
<ImageBrush ImageSource="100-50-5-monochrome.png" AlignmentY="Top" ViewportUnits="Absolute"
Opacity="0.5"
Viewport="0,0,100,100" TileMode="FlipY" Stretch="UniformToFill" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Panel.ZIndex="50" Fill="#FFDADADA" Opacity="{Binding ElementName=glassLayer,Path=GlassOpacity}" />
<Grid Panel.ZIndex="0">
<Grid.Effect>
<local:GaussianBlurEffect Direction="0,1" />
</Grid.Effect>
<Grid>
<Grid.Effect>
<local:GaussianBlurEffect Direction="1,0" />
</Grid.Effect>
<Grid.Background>
<VisualBrush Visual="{Binding ElementName=glassLayer, Path=BlurredElement}" AlignmentX="Left"
AlignmentY="Top"
Stretch="None" />
</Grid.Background>
<StackPanel />
</Grid>
</Grid>
</Grid>
</UserControl>

View File

@@ -0,0 +1,93 @@
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace QuickLook.Controls.GlassLayer
{
/// <summary>
/// Interaction logic for GlassLayer.xaml
/// </summary>
public partial class GlassLayer : UserControl
{
public GlassLayer()
{
InitializeComponent();
}
#region public Visual BlurredElement
/// <summary>
/// Identifies the BlurredElement dependency property.
/// </summary>
public static DependencyProperty BlurredElementProperty =
DependencyProperty.Register("BlurredElement", typeof(Visual), typeof(GlassLayer), null);
/// <summary>
/// </summary>
public Visual BlurredElement
{
get => (Visual) GetValue(BlurredElementProperty);
set => SetValue(BlurredElementProperty, value);
}
#endregion public Visual BlurredElement
#region public double GlassOpacity
/// <summary>
/// Identifies the GlassOpacity dependency property.
/// </summary>
public static DependencyProperty GlassOpacityProperty =
DependencyProperty.Register("GlassOpacity", typeof(double), typeof(GlassLayer),
new UIPropertyMetadata(0.6));
/// <summary>
/// </summary>
public double GlassOpacity
{
get => (double) GetValue(GlassOpacityProperty);
set => SetValue(GlassOpacityProperty, value);
}
#endregion public double GlassOpacity
#region public Visibility NoiseVisibility
/// <summary>
/// Identifies the NoiseVisibility dependency property.
/// </summary>
public static DependencyProperty NoiseVisibilityProperty =
DependencyProperty.Register("NoiseVisibility", typeof(Visibility), typeof(GlassLayer),
new UIPropertyMetadata(Visibility.Visible));
/// <summary>
/// </summary>
public Visibility NoiseVisibility
{
get => (Visibility) GetValue(NoiseVisibilityProperty);
set => SetValue(NoiseVisibilityProperty, value);
}
#endregion public Visibility NoiseVisibility
}
}

View File

@@ -3,17 +3,20 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:fa="http://schemas.fontawesome.io/icons/" xmlns:fa="http://schemas.fontawesome.io/icons/"
xmlns:local="clr-namespace:QuickLook" xmlns:local="clr-namespace:QuickLook"
xmlns:control="clr-namespace:QuickLook.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:converters="clr-namespace:QuickLook.Converters" xmlns:converters="clr-namespace:QuickLook.Converters"
xmlns:controls="clr-namespace:QuickLook.Controls"
xmlns:busyDecorator="clr-namespace:QuickLook.Controls.BusyDecorator"
xmlns:glassLayer="clr-namespace:QuickLook.Controls.GlassLayer"
mc:Ignorable="d" x:Class="QuickLook.MainWindowTransparent" x:Name="mainWindow" mc:Ignorable="d" x:Class="QuickLook.MainWindowTransparent" x:Name="mainWindow"
UseLayoutRounding="True" UseLayoutRounding="True"
d:DesignWidth="624" d:DesignHeight="700" d:DesignWidth="624" d:DesignHeight="700"
MinWidth="275" MinHeight="150" MinWidth="275" MinHeight="150"
WindowStartupLocation="CenterScreen" WindowStartupLocation="CenterScreen"
Focusable="False" WindowStyle="None" Focusable="False" WindowStyle="None"
Background="#E5FAFAFA" AllowsTransparency="True" AllowsTransparency="True"
Background="Transparent"
ShowActivated="False" ShowInTaskbar="False"> ShowActivated="False" ShowInTaskbar="False">
<Window.Resources> <Window.Resources>
<converters:BooleanToResizeModeConverter x:Key="BooleanToResizeModeConverter" /> <converters:BooleanToResizeModeConverter x:Key="BooleanToResizeModeConverter" />
@@ -21,213 +24,218 @@
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
<converters:ScaledValueConverter x:Key="ScaledValueConverter" /> <converters:ScaledValueConverter x:Key="ScaledValueConverter" />
</Window.Resources> </Window.Resources>
<Window.ResizeMode>
<Binding Converter="{StaticResource BooleanToResizeModeConverter}" ElementName="mainWindow"
Path="ContextObject.CanResize" />
</Window.ResizeMode>
<WindowChrome.WindowChrome> <WindowChrome.WindowChrome>
<WindowChrome x:Name="chrome" <WindowChrome x:Name="chrome"
ResizeBorderThickness="{Binding ContextObject.CanResize, Converter={StaticResource BooleanToResizeBorderThicknessConverter}, ElementName=mainWindow}" ResizeBorderThickness="{Binding ContextObject.CanResize, Converter={StaticResource BooleanToResizeBorderThicknessConverter}, ElementName=mainWindow}"
UseAeroCaptionButtons="False" /> UseAeroCaptionButtons="False" />
</WindowChrome.WindowChrome> </WindowChrome.WindowChrome>
<Border x:Name="windowBorder" BorderThickness="1" BorderBrush="#FF7B7B7B"> <Border>
<Grid> <Border.Effect>
<DockPanel x:Name="windowPanel"> <DropShadowEffect BlurRadius="5" ShadowDepth="0" Opacity="0.6" Color="Gray" />
<DockPanel.Style> </Border.Effect>
<Style TargetType="{x:Type DockPanel}"> <Grid Background="#FFF8F8FB" Margin="5">
<Style.Triggers> <Grid>
<DataTrigger Binding="{Binding ContextObject.IsBusy, ElementName=mainWindow, Mode=OneWay}" <Grid x:Name="windowPanel">
Value="False"> <Grid.Style>
<DataTrigger.EnterActions> <Style TargetType="{x:Type Grid}">
<BeginStoryboard> <Style.Triggers>
<Storyboard> <DataTrigger
<DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" To="1" Binding="{Binding ContextObject.IsBusy, ElementName=mainWindow, Mode=OneWay}"
BeginTime="0:0:0" Duration="0:0:0" /> Value="False">
</Storyboard> <DataTrigger.EnterActions>
</BeginStoryboard> <BeginStoryboard>
</DataTrigger.EnterActions> <Storyboard>
<DataTrigger.ExitActions> <DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" To="1"
<BeginStoryboard> BeginTime="0:0:0" Duration="0:0:0" />
<Storyboard> </Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" From="1" To="0" </BeginStoryboard>
BeginTime="0:0:0" Duration="0:0:0" /> </DataTrigger.EnterActions>
</Storyboard> <DataTrigger.ExitActions>
</BeginStoryboard> <BeginStoryboard>
</DataTrigger.ExitActions> <Storyboard>
</DataTrigger> <DoubleAnimation Storyboard.TargetProperty="Opacity" From="1" To="0"
</Style.Triggers> BeginTime="0:0:0" Duration="0:0:0" />
</Style> </Storyboard>
</DockPanel.Style> </BeginStoryboard>
<DockPanel x:Name="titlebar" Height="28" Dock="Top"> </DataTrigger.ExitActions>
<fa:ImageAwesome DockPanel.Dock="Right" x:Name="buttonCloseWindow" Icon="TimesCircle" </DataTrigger>
WindowChrome.IsHitTestVisibleInChrome="True" </Style.Triggers>
Width="15" Height="15" Margin="5,0,10,0" Foreground="#E5868686" </Style>
Cursor="Hand" /> </Grid.Style>
<fa:ImageAwesome DockPanel.Dock="Right" x:Name="buttonWindowStatus" <Grid VerticalAlignment="Top" Panel.ZIndex="9999">
WindowChrome.IsHitTestVisibleInChrome="True" <glassLayer:GlassLayer BlurredElement="{Binding ElementName=container}" />
Width="14" Height="14" Margin="5,0,5,0" Foreground="#E5868686" <DockPanel x:Name="titlebar" Height="28">
Visibility="{Binding ContextObject.CanResize,ElementName=mainWindow,Converter={StaticResource BooleanToVisibilityConverter}}" <fa:ImageAwesome DockPanel.Dock="Right" x:Name="buttonCloseWindow" Icon="TimesCircle"
Cursor="Hand"> WindowChrome.IsHitTestVisibleInChrome="True"
<fa:ImageAwesome.Style> Width="15" Height="15" Margin="5,0,10,0" Foreground="#E5868686"
<Style TargetType="{x:Type fa:ImageAwesome}"> Cursor="Hand" />
<Setter Property="Icon" Value="WindowMaximize" /> <fa:ImageAwesome DockPanel.Dock="Right" x:Name="buttonWindowStatus"
<Style.Triggers> WindowChrome.IsHitTestVisibleInChrome="True"
<DataTrigger Binding="{Binding WindowState, ElementName=mainWindow}" Width="14" Height="14" Margin="5,0,5,0" Foreground="#E5868686"
Value="Maximized"> Visibility="{Binding ContextObject.CanResize,ElementName=mainWindow,Converter={StaticResource BooleanToVisibilityConverter}}"
<Setter Property="Icon" Value="WindowRestore" /> Cursor="Hand">
</DataTrigger> <fa:ImageAwesome.Style>
<DataTrigger Binding="{Binding WindowState, ElementName=mainWindow}" <Style TargetType="{x:Type fa:ImageAwesome}">
Value="Normal">
<Setter Property="Icon" Value="WindowMaximize" /> <Setter Property="Icon" Value="WindowMaximize" />
</DataTrigger> <Style.Triggers>
</Style.Triggers> <DataTrigger Binding="{Binding WindowState, ElementName=mainWindow}"
</Style> Value="Maximized">
</fa:ImageAwesome.Style> <Setter Property="Icon" Value="WindowRestore" />
</fa:ImageAwesome> </DataTrigger>
<fa:ImageAwesome DockPanel.Dock="Right" x:Name="buttonShare" Icon="ShareAlt" <DataTrigger Binding="{Binding WindowState, ElementName=mainWindow}"
WindowChrome.IsHitTestVisibleInChrome="True" Value="Normal">
Width="14" Height="14" Margin="10,0,5,0" Foreground="#E5868686" <Setter Property="Icon" Value="WindowMaximize" />
Cursor="Hand" /> </DataTrigger>
<Button x:Name="buttonOpenWith" DockPanel.Dock="Right" Content="Open with..." Height="20" </Style.Triggers>
Margin="10,0,0,0" Padding="5,0" </Style>
MaxWidth="{Binding Width, ElementName=mainWindow, Converter={StaticResource ScaledValueConverter}, ConverterParameter='0.25'}" </fa:ImageAwesome.Style>
Focusable="False" Cursor="Hand" </fa:ImageAwesome>
Background="#E5EEEEEE" BorderBrush="#E59A9A9A" <fa:ImageAwesome DockPanel.Dock="Right" x:Name="buttonShare" Icon="ShareAlt"
WindowChrome.IsHitTestVisibleInChrome="True" Foreground="#FF404040"> WindowChrome.IsHitTestVisibleInChrome="True"
<Button.ContentTemplate> Width="14" Height="14" Margin="10,0,5,0" Foreground="#E5868686"
<DataTemplate> Cursor="Hand" />
<TextBlock TextTrimming="CharacterEllipsis" Text="{Binding}" /> <Button x:Name="buttonOpenWith" DockPanel.Dock="Right" Content="Open with..." Height="20"
</DataTemplate> Margin="10,0,0,0" Padding="5,0"
</Button.ContentTemplate> MaxWidth="{Binding Width, ElementName=mainWindow, Converter={StaticResource ScaledValueConverter}, ConverterParameter='0.25'}"
</Button> Focusable="False" Cursor="Hand"
<Grid DockPanel.Dock="Left" Width="20" Margin="5,0"> Background="#E5EEEEEE" BorderBrush="#E59A9A9A"
<fa:ImageAwesome x:Name="buttonPin" WindowChrome.IsHitTestVisibleInChrome="True" Foreground="#FF404040">
WindowChrome.IsHitTestVisibleInChrome="True" <Button.ContentTemplate>
Width="14" Height="14" <DataTemplate>
Cursor="Hand"> <TextBlock TextTrimming="CharacterEllipsis" Text="{Binding}" />
<fa:ImageAwesome.Style> </DataTemplate>
<Style TargetType="{x:Type fa:ImageAwesome}"> </Button.ContentTemplate>
<Setter Property="Icon" Value="ThumbTack" /> </Button>
<Setter Property="Foreground" Value="#E5868686" /> <Grid DockPanel.Dock="Left" Width="20" Margin="5,0">
<Setter Property="LayoutTransform"> <fa:ImageAwesome x:Name="buttonPin"
<Setter.Value> WindowChrome.IsHitTestVisibleInChrome="True"
<RotateTransform Angle="-45" /> Width="14" Height="14"
</Setter.Value> Cursor="Hand">
</Setter> <fa:ImageAwesome.Style>
<Style.Triggers> <Style TargetType="{x:Type fa:ImageAwesome}">
<MultiDataTrigger> <Setter Property="Icon" Value="ThumbTack" />
<MultiDataTrigger.Conditions> <Setter Property="Foreground" Value="#E5868686" />
<Condition <Setter Property="LayoutTransform">
Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource Self}}" <Setter.Value>
Value="True" /> <RotateTransform Angle="-45" />
<Condition Binding="{Binding Pinned, ElementName=mainWindow}" </Setter.Value>
Value="True" /> </Setter>
<Condition <Style.Triggers>
Binding="{Binding Path=LayoutTransform.(RotateTransform.Angle), RelativeSource={RelativeSource Self}}" <MultiDataTrigger>
Value="0" /> <MultiDataTrigger.Conditions>
</MultiDataTrigger.Conditions> <Condition
<MultiDataTrigger.EnterActions> Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource Self}}"
<BeginStoryboard> Value="True" />
<Storyboard> <Condition Binding="{Binding Pinned, ElementName=mainWindow}"
<ObjectAnimationUsingKeyFrames Value="True" />
Storyboard.TargetProperty="Icon"> <Condition
<DiscreteObjectKeyFrame KeyTime="0:0:0.2" Binding="{Binding Path=LayoutTransform.(RotateTransform.Angle), RelativeSource={RelativeSource Self}}"
Value="{x:Static fa:FontAwesomeIcon.TimesCircle}" /> Value="0" />
</ObjectAnimationUsingKeyFrames> </MultiDataTrigger.Conditions>
</Storyboard> <MultiDataTrigger.EnterActions>
</BeginStoryboard> <BeginStoryboard>
</MultiDataTrigger.EnterActions> <Storyboard>
<MultiDataTrigger.ExitActions> <ObjectAnimationUsingKeyFrames
<BeginStoryboard> Storyboard.TargetProperty="Icon">
<Storyboard> <DiscreteObjectKeyFrame KeyTime="0:0:0.2"
<ObjectAnimationUsingKeyFrames Value="{x:Static fa:FontAwesomeIcon.TimesCircle}" />
Storyboard.TargetProperty="Icon"> </ObjectAnimationUsingKeyFrames>
<DiscreteObjectKeyFrame KeyTime="0:0:0" </Storyboard>
Value="{x:Static fa:FontAwesomeIcon.ThumbTack}" /> </BeginStoryboard>
</ObjectAnimationUsingKeyFrames> </MultiDataTrigger.EnterActions>
</Storyboard> <MultiDataTrigger.ExitActions>
</BeginStoryboard> <BeginStoryboard>
</MultiDataTrigger.ExitActions> <Storyboard>
</MultiDataTrigger> <ObjectAnimationUsingKeyFrames
<DataTrigger Binding="{Binding Pinned, ElementName=mainWindow}" Value="True"> Storyboard.TargetProperty="Icon">
<DataTrigger.EnterActions> <DiscreteObjectKeyFrame KeyTime="0:0:0"
<BeginStoryboard> Value="{x:Static fa:FontAwesomeIcon.ThumbTack}" />
<Storyboard> </ObjectAnimationUsingKeyFrames>
<ParallelTimeline> </Storyboard>
<DoubleAnimation </BeginStoryboard>
Storyboard.TargetProperty="LayoutTransform.(RotateTransform.Angle)" </MultiDataTrigger.ExitActions>
To="0" Duration="0:0:0.05" /> </MultiDataTrigger>
<ColorAnimation <DataTrigger Binding="{Binding Pinned, ElementName=mainWindow}"
Storyboard.TargetProperty="Foreground.(SolidColorBrush.Color)" Value="True">
To="#E53C3C3C" Duration="0:0:0.05" /> <DataTrigger.EnterActions>
</ParallelTimeline> <BeginStoryboard>
</Storyboard> <Storyboard>
</BeginStoryboard> <ParallelTimeline>
</DataTrigger.EnterActions> <DoubleAnimation
<Setter Property="Foreground" Value="#E53C3C3C" /> Storyboard.TargetProperty="LayoutTransform.(RotateTransform.Angle)"
</DataTrigger> To="0" Duration="0:0:0.05" />
</Style.Triggers> <ColorAnimation
</Style> Storyboard.TargetProperty="Foreground.(SolidColorBrush.Color)"
</fa:ImageAwesome.Style> To="#E53C3C3C" Duration="0:0:0.05" />
</fa:ImageAwesome> </ParallelTimeline>
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<Setter Property="Foreground" Value="#E53C3C3C" />
</DataTrigger>
</Style.Triggers>
</Style>
</fa:ImageAwesome.Style>
</fa:ImageAwesome>
</Grid>
<!-- set grid.background colour makes it clickable -->
<Grid x:Name="titleArea" Background="Transparent">
<TextBlock Text="{Binding ContextObject.Title, ElementName=mainWindow}" FontSize="14"
HorizontalAlignment="Center" TextTrimming="CharacterEllipsis"
VerticalAlignment="Center" Margin="5,0" />
</Grid>
</DockPanel>
</Grid> </Grid>
<!-- set grid.background colour makes it clickable -->
<Grid x:Name="titleArea" Background="Transparent">
<TextBlock Text="{Binding ContextObject.Title, ElementName=mainWindow}" FontSize="14"
HorizontalAlignment="Center" TextTrimming="CharacterEllipsis"
VerticalAlignment="Center" Margin="5,0" />
</Grid>
</DockPanel>
<Grid>
<ContentControl x:Name="container" <ContentControl x:Name="container"
Content="{Binding ContextObject.ViewerContent, ElementName=mainWindow}" /> Content="{Binding ContextObject.ViewerContent, ElementName=mainWindow}" />
</Grid> </Grid>
</DockPanel> <Grid x:Name="busyIndicatorLayer">
<Grid x:Name="busyIndicatorLayer"> <Grid.Style>
<Grid.Style> <Style TargetType="{x:Type Grid}">
<Style TargetType="{x:Type Grid}"> <Style.Triggers>
<Style.Triggers> <DataTrigger
<DataTrigger Binding="{Binding ContextObject.IsBusy, ElementName=mainWindow, Mode=OneWay}" Binding="{Binding ContextObject.IsBusy, ElementName=mainWindow, Mode=OneWay}"
Value="False"> Value="False">
<DataTrigger.EnterActions> <DataTrigger.EnterActions>
<BeginStoryboard> <BeginStoryboard>
<Storyboard> <Storyboard>
<ParallelTimeline> <ParallelTimeline>
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="0" <DoubleAnimation Storyboard.TargetProperty="Opacity" To="0"
Duration="0:0:0.05" /> Duration="0:0:0.05" />
<ObjectAnimationUsingKeyFrames <ObjectAnimationUsingKeyFrames
Storyboard.TargetProperty="(UIElement.Visibility)"> Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="0:0:0.05" <DiscreteObjectKeyFrame KeyTime="0:0:0.05"
Value="{x:Static Visibility.Hidden}" /> Value="{x:Static Visibility.Hidden}" />
</ObjectAnimationUsingKeyFrames> </ObjectAnimationUsingKeyFrames>
</ParallelTimeline> </ParallelTimeline>
</Storyboard> </Storyboard>
</BeginStoryboard> </BeginStoryboard>
</DataTrigger.EnterActions> </DataTrigger.EnterActions>
<DataTrigger.ExitActions> <DataTrigger.ExitActions>
<BeginStoryboard> <BeginStoryboard>
<Storyboard> <Storyboard>
<ParallelTimeline> <ParallelTimeline>
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" <DoubleAnimation Storyboard.TargetProperty="Opacity" To="1"
Duration="0:0:0" /> Duration="0:0:0" />
<ObjectAnimationUsingKeyFrames <ObjectAnimationUsingKeyFrames
Storyboard.TargetProperty="(UIElement.Visibility)"> Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="0:0:0" <DiscreteObjectKeyFrame KeyTime="0:0:0"
Value="{x:Static Visibility.Visible}" /> Value="{x:Static Visibility.Visible}" />
</ObjectAnimationUsingKeyFrames> </ObjectAnimationUsingKeyFrames>
</ParallelTimeline> </ParallelTimeline>
</Storyboard> </Storyboard>
</BeginStoryboard> </BeginStoryboard>
</DataTrigger.ExitActions> </DataTrigger.ExitActions>
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</Grid.Style> </Grid.Style>
<!--IsBusyIndicatorShowing="{Binding IsVisible, ElementName=busyIndicatorLayer}"--> <!--IsBusyIndicatorShowing="{Binding IsVisible, ElementName=busyIndicatorLayer}"-->
<control:BusyDecorator x:Name="busyDecorator" <busyDecorator:BusyDecorator x:Name="busyDecorator"
IsBusyIndicatorShowing="True" IsBusyIndicatorShowing="True"
VerticalAlignment="Center" VerticalAlignment="Center"
HorizontalAlignment="Center" /> HorizontalAlignment="Center" />
</Grid>
</Grid> </Grid>
</Grid> </Grid>
</Border> </Border>

View File

@@ -50,8 +50,8 @@ namespace QuickLook
SourceInitialized += (sender, e) => SourceInitialized += (sender, e) =>
{ {
if (AllowsTransparency) //if (AllowsTransparency)
BlurWindow.EnableWindowBlur(this); // BlurWindow.EnableWindowBlur(this);
}; };
buttonPin.MouseLeftButtonUp += (sender, e) => buttonPin.MouseLeftButtonUp += (sender, e) =>
@@ -234,10 +234,8 @@ namespace QuickLook
// revert UI changes // revert UI changes
ContextObject.IsBusy = true; ContextObject.IsBusy = true;
var newHeight = ContextObject.PreferredSize.Height + titlebar.Height + windowBorder.BorderThickness.Top + var newHeight = ContextObject.PreferredSize.Height + titlebar.Height;
windowBorder.BorderThickness.Bottom; var newWidth = ContextObject.PreferredSize.Width;
var newWidth = ContextObject.PreferredSize.Width + windowBorder.BorderThickness.Left +
windowBorder.BorderThickness.Right;
ResizeAndCenter(new Size(newWidth, newHeight)); ResizeAndCenter(new Size(newWidth, newHeight));

View File

@@ -5,13 +5,18 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:QuickLook.Plugin.InfoPanel" xmlns:local="clr-namespace:QuickLook.Plugin.InfoPanel"
FontSize="14" FontSize="14"
mc:Ignorable="d" Width="453" Height="172" UseLayoutRounding="True"> Background="#FFF8F8FB"
mc:Ignorable="d" Width="453" Height="172" UseLayoutRounding="True" TextOptions.TextHintingMode="Animated">
<Grid> <Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="150" /> <ColumnDefinition Width="150" />
<ColumnDefinition Width="65*" /> <ColumnDefinition Width="65*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Image x:Name="image" Grid.Column="0" Height="128" Width="128" Stretch="Fill" Opacity="0" Margin="0,-20,0,0"> <Image x:Name="image" Grid.Row="1" Grid.Column="0" Height="128" Width="128" Stretch="Fill" Opacity="0" Margin="0,-20,0,0">
<Image.Style> <Image.Style>
<Style TargetType="{x:Type Image}"> <Style TargetType="{x:Type Image}">
<Style.Triggers> <Style.Triggers>
@@ -29,7 +34,7 @@
</Style> </Style>
</Image.Style> </Image.Style>
</Image> </Image>
<Grid Grid.Column="1"> <Grid Grid.Column="1" Grid.Row="1">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="5" /> <ColumnDefinition Width="5" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
@@ -43,13 +48,19 @@
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock x:Name="filename" Grid.Row="1" Grid.Column="1" FontSize="19" FontWeight="SemiBold" Padding="3" <TextBlock x:Name="filename" Grid.Row="1" Grid.Column="1" FontSize="19" Padding="3"
TextWrapping="Wrap" TextWrapping="Wrap"
LineHeight="25" MaxHeight="60" TextTrimming="CharacterEllipsis"> LineHeight="25" MaxHeight="60" TextTrimming="CharacterEllipsis" FontWeight="Normal">
FilenameFilenameFilenameFilenameFilenameFilenameFilenameFilenameFilenameFilename.ext FilenameFilenameFilenameFilenameFilenameFilenameFilenameFilenameFilenameFilename.ext
</TextBlock> </TextBlock>
<TextBlock x:Name="modDate" Grid.Row="3" Grid.Column="1" Padding="3">Last modified at 01/01/2017 00:00:00</TextBlock> <TextBlock x:Name="modDate" Grid.Row="3" Grid.Column="1" Padding="3" FontWeight="Light"
<TextBlock x:Name="totalSize" Grid.Row="4" Grid.Column="1" Padding="3">Calculating size...</TextBlock> Foreground="DimGray">
Last modified at 01/01/2017 00:00:00
</TextBlock>
<TextBlock x:Name="totalSize" Grid.Row="4" Grid.Column="1" Padding="3" FontWeight="Light"
Foreground="DimGray">
Calculating size...
</TextBlock>
</Grid> </Grid>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@@ -111,15 +111,19 @@
<Compile Include="..\GitVersion.cs"> <Compile Include="..\GitVersion.cs">
<Link>Properties\GitVersion.cs</Link> <Link>Properties\GitVersion.cs</Link>
</Compile> </Compile>
<Compile Include="Controls\GlassLayer\GaussianBlurEffect.cs" />
<Compile Include="Controls\GlassLayer\GlassLayer.xaml.cs">
<DependentUpon>GlassLayer.xaml</DependentUpon>
</Compile>
<Compile Include="Converters\BooleanToResizeModeConverter.cs" /> <Compile Include="Converters\BooleanToResizeModeConverter.cs" />
<Compile Include="Converters\BooleanToVisibilityConverter.cs" /> <Compile Include="Converters\BooleanToVisibilityConverter.cs" />
<Compile Include="Converters\BooleanToResizeBorderThicknessConverter.cs" /> <Compile Include="Converters\BooleanToResizeBorderThicknessConverter.cs" />
<Compile Include="Converters\ScaledValueConverter.cs" /> <Compile Include="Converters\ScaledValueConverter.cs" />
<Compile Include="FocusMonitor.cs" /> <Compile Include="FocusMonitor.cs" />
<Compile Include="Helpers\AutoStartupHelper.cs" /> <Compile Include="Helpers\AutoStartupHelper.cs" />
<Compile Include="Controls\BackgroundVisualHost.cs" /> <Compile Include="Controls\BusyDecorator\BackgroundVisualHost.cs" />
<Compile Include="Controls\BusyDecorator.cs" /> <Compile Include="Controls\BusyDecorator\BusyDecorator.cs" />
<Compile Include="Controls\VisualTargetPresentationSource.cs" /> <Compile Include="Controls\BusyDecorator\VisualTargetPresentationSource.cs" />
<Compile Include="ExtensionMethods\TypeExtensions.cs" /> <Compile Include="ExtensionMethods\TypeExtensions.cs" />
<Compile Include="Helpers\BlurLibrary\BlurWindow.cs" /> <Compile Include="Helpers\BlurLibrary\BlurWindow.cs" />
<Compile Include="Helpers\BlurLibrary\Helpers.cs" /> <Compile Include="Helpers\BlurLibrary\Helpers.cs" />
@@ -163,6 +167,10 @@
<Compile Include="Controls\WebClientEx.cs"> <Compile Include="Controls\WebClientEx.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
<Page Include="Controls\GlassLayer\GlassLayer.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Plugin\InfoPanel\InfoPanel.xaml"> <Page Include="Plugin\InfoPanel\InfoPanel.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
@@ -218,6 +226,7 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
<None Include="app.manifest" /> <None Include="app.manifest" />
<Resource Include="Controls\GlassLayer\GaussianBlur.ps" />
<None Include="key.snk" /> <None Include="key.snk" />
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
@@ -269,6 +278,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Resource Include="Controls\GlassLayer\100-50-5-monochrome.png" />
<None Include="Controls\GlassLayer\GaussianBlur.fx" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>
<PreBuildEvent>powershell -file "$(SolutionDir)Scripts\update-version.ps1" <PreBuildEvent>powershell -file "$(SolutionDir)Scripts\update-version.ps1"

View File

@@ -3,9 +3,10 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:fa="http://schemas.fontawesome.io/icons/" xmlns:fa="http://schemas.fontawesome.io/icons/"
xmlns:local="clr-namespace:QuickLook" xmlns:local="clr-namespace:QuickLook"
xmlns:controls="clr-namespace:QuickLook.Controls"> xmlns:controls="clr-namespace:QuickLook.Controls"
xmlns:busyDecorator="clr-namespace:QuickLook.Controls.BusyDecorator">
<Style TargetType="{x:Type controls:BusyDecorator}"> <Style TargetType="{x:Type busyDecorator:BusyDecorator}">
<Setter Property="BusyStyle"> <Setter Property="BusyStyle">
<Setter.Value> <Setter.Value>
<Style TargetType="{x:Type Control}"> <Style TargetType="{x:Type Control}">

View File

@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net452" /> <package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net452" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net462" /> <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net462" />