mirror of
https://github.com/QL-Win/QuickLook.git
synced 2026-02-27 01:00:11 +08:00
WIP: more new styles
This commit is contained in:
@@ -55,8 +55,6 @@ namespace QuickLook.Plugin.HtmlViewer
|
||||
public void Prepare(string path, ContextObject context)
|
||||
{
|
||||
context.PreferredSize = new Size(1000, 600);
|
||||
|
||||
context.CanFocus = true;
|
||||
}
|
||||
|
||||
public void View(string path, ContextObject context)
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
xmlns:local="clr-namespace:QuickLook.Plugin.ImageViewer"
|
||||
xmlns:animatedImage="clr-namespace:QuickLook.Plugin.ImageViewer.AnimatedImage"
|
||||
mc:Ignorable="d"
|
||||
Background="White"
|
||||
x:Name="imagePanel"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<Grid>
|
||||
@@ -14,7 +13,7 @@
|
||||
VerticalScrollBarVisibility="Auto" Focusable="False" IsManipulationEnabled="True">
|
||||
<animatedImage:AnimatedImage x:Name="viewPanelImage" Stretch="None"
|
||||
RenderOptions.BitmapScalingMode="{Binding RenderMode, ElementName=imagePanel}"
|
||||
AnimationUri="{Binding ImageUriSource, ElementName=imagePanel}" Margin="0,28,0,0" />
|
||||
AnimationUri="{Binding ImageUriSource, ElementName=imagePanel}" />
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -67,6 +67,9 @@ namespace QuickLook.Plugin.ImageViewer
|
||||
context.PreferredSize = new Size(1024, 768);
|
||||
|
||||
Directory.SetCurrentDirectory(App.AppPath);
|
||||
|
||||
context.AutoHideTitlebar = true;
|
||||
context.TitlebarOverlap = true;
|
||||
}
|
||||
|
||||
public void View(string path, ContextObject context)
|
||||
|
||||
@@ -55,8 +55,6 @@ namespace QuickLook.Plugin.MarkdownViewer
|
||||
public void Prepare(string path, ContextObject context)
|
||||
{
|
||||
context.PreferredSize = new Size(1000, 600);
|
||||
|
||||
context.CanFocus = true;
|
||||
}
|
||||
|
||||
public void View(string path, ContextObject context)
|
||||
|
||||
@@ -60,7 +60,6 @@ namespace QuickLook.Plugin.TextViewer
|
||||
public void Prepare(string path, ContextObject context)
|
||||
{
|
||||
context.PreferredSize = new Size {Width = 800, Height = 600};
|
||||
context.CanFocus = true;
|
||||
}
|
||||
|
||||
public void View(string path, ContextObject context)
|
||||
|
||||
@@ -2,8 +2,11 @@
|
||||
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="QuickLook.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<sectionGroup name="userSettings"
|
||||
type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<section name="QuickLook.Properties.Settings"
|
||||
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
|
||||
@@ -29,21 +29,18 @@ namespace QuickLook.Controls.GlassLayer
|
||||
public static readonly DependencyProperty DirectionProperty =
|
||||
DependencyProperty.Register("Direction", typeof(Point), typeof(GaussianBlurEffect),
|
||||
new UIPropertyMetadata(new Point(0, 1), PixelShaderConstantCallback(0)));
|
||||
public static DependencyProperty ShaderProperty =
|
||||
DependencyProperty.Register("Shader", typeof(Uri), typeof(GaussianBlurEffect),
|
||||
new PropertyMetadata(null, UpdateShader()));
|
||||
|
||||
public GaussianBlurEffect()
|
||||
public Uri Shader
|
||||
{
|
||||
var pixelShader = new PixelShader
|
||||
{
|
||||
UriSource = new Uri("pack://application:,,,/QuickLook;component/Controls/GlassLayer/GaussianBlur.ps",
|
||||
UriKind.Absolute)
|
||||
};
|
||||
PixelShader = pixelShader;
|
||||
get => (Uri) GetValue(ShaderProperty);
|
||||
|
||||
DdxUvDdyUvRegisterIndex = 1;
|
||||
UpdateShaderValue(InputProperty);
|
||||
UpdateShaderValue(DirectionProperty);
|
||||
set => SetValue(ShaderProperty, value);
|
||||
}
|
||||
|
||||
|
||||
public Brush Input
|
||||
{
|
||||
get => (Brush) GetValue(InputProperty);
|
||||
@@ -55,5 +52,20 @@ namespace QuickLook.Controls.GlassLayer
|
||||
get => (Point) GetValue(DirectionProperty);
|
||||
set => SetValue(DirectionProperty, value);
|
||||
}
|
||||
|
||||
private static PropertyChangedCallback UpdateShader()
|
||||
{
|
||||
return (obj, ea) =>
|
||||
{
|
||||
if (obj is GaussianBlurEffect instance)
|
||||
{
|
||||
instance.PixelShader = new PixelShader {UriSource = ea.NewValue as Uri};
|
||||
|
||||
instance.UpdateShaderValue(InputProperty); // S0
|
||||
instance.UpdateShaderValue(DirectionProperty); // C0
|
||||
instance.DdxUvDdyUvRegisterIndex = 1; // C1
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,14 +15,17 @@
|
||||
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">
|
||||
<Rectangle Panel.ZIndex="50" Fill="#FFDADADA" Opacity="0.8"
|
||||
Visibility="{Binding ElementName=glassLayer,Path=GrayOverlayVisibility}" />
|
||||
<Grid Panel.ZIndex="0" Visibility="{Binding ElementName=glassLayer,Path=GlassVisibility}">
|
||||
<Grid.Effect>
|
||||
<local:GaussianBlurEffect Direction="0,1" />
|
||||
<local:GaussianBlurEffect Direction="0,1"
|
||||
Shader="pack://application:,,,/QuickLook;component/Controls/GlassLayer/GaussianBlur.ps" />
|
||||
</Grid.Effect>
|
||||
<Grid>
|
||||
<Grid.Effect>
|
||||
<local:GaussianBlurEffect Direction="1,0" />
|
||||
<local:GaussianBlurEffect Direction="1,0"
|
||||
Shader="pack://application:,,,/QuickLook;component/Controls/GlassLayer/GaussianBlur.ps" />
|
||||
</Grid.Effect>
|
||||
<Grid.Background>
|
||||
<VisualBrush Visual="{Binding ElementName=glassLayer, Path=BlurredElement}" AlignmentX="Left"
|
||||
|
||||
@@ -50,25 +50,25 @@ namespace QuickLook.Controls.GlassLayer
|
||||
|
||||
#endregion public Visual BlurredElement
|
||||
|
||||
#region public double GlassOpacity
|
||||
#region public Visibility GrayOverlayVisibility
|
||||
|
||||
/// <summary>
|
||||
/// Identifies the GlassOpacity dependency property.
|
||||
/// Identifies the GrayOverlayVisibility dependency property.
|
||||
/// </summary>
|
||||
public static DependencyProperty GlassOpacityProperty =
|
||||
DependencyProperty.Register("GlassOpacity", typeof(double), typeof(GlassLayer),
|
||||
new UIPropertyMetadata(0.6));
|
||||
public static DependencyProperty GrayOverlayVisibilityProperty =
|
||||
DependencyProperty.Register("GrayOverlayVisibility", typeof(Visibility), typeof(GlassLayer),
|
||||
new UIPropertyMetadata(Visibility.Visible));
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public double GlassOpacity
|
||||
public Visibility GrayOverlayVisibility
|
||||
{
|
||||
get => (double) GetValue(GlassOpacityProperty);
|
||||
get => (Visibility) GetValue(GrayOverlayVisibilityProperty);
|
||||
|
||||
set => SetValue(GlassOpacityProperty, value);
|
||||
set => SetValue(GrayOverlayVisibilityProperty, value);
|
||||
}
|
||||
|
||||
#endregion public double GlassOpacity
|
||||
#endregion public Visibility GrayOverlayVisibility
|
||||
|
||||
#region public Visibility NoiseVisibility
|
||||
|
||||
@@ -89,5 +89,25 @@ namespace QuickLook.Controls.GlassLayer
|
||||
}
|
||||
|
||||
#endregion public Visibility NoiseVisibility
|
||||
|
||||
#region public Visibility GlassVisibility
|
||||
|
||||
/// <summary>
|
||||
/// Identifies the GlassVisibility dependency property.
|
||||
/// </summary>
|
||||
public static DependencyProperty GlassVisibilityProperty =
|
||||
DependencyProperty.Register("GlassVisibility", typeof(Visibility), typeof(GlassLayer),
|
||||
new UIPropertyMetadata(Visibility.Visible));
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public Visibility GlassVisibility
|
||||
{
|
||||
get => (Visibility) GetValue(GlassVisibilityProperty);
|
||||
|
||||
set => SetValue(GlassVisibilityProperty, value);
|
||||
}
|
||||
|
||||
#endregion public Visibility GlassVisibility
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// 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.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace QuickLook.Converters
|
||||
{
|
||||
public sealed class BooleanToVisibilityCollapsedConverter : DependencyObject, IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
return Visibility.Collapsed;
|
||||
|
||||
var v = (bool) value;
|
||||
|
||||
return v ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
|
||||
object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,12 @@
|
||||
<Window
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:fa="http://schemas.fontawesome.io/icons/"
|
||||
xmlns:local="clr-namespace:QuickLook"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
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"
|
||||
xmlns:converters="clr-namespace:QuickLook.Converters"
|
||||
mc:Ignorable="d" x:Class="QuickLook.MainWindowTransparent" x:Name="mainWindow"
|
||||
UseLayoutRounding="True"
|
||||
d:DesignWidth="624" d:DesignHeight="700"
|
||||
@@ -19,10 +17,16 @@
|
||||
Background="Transparent"
|
||||
ShowActivated="False" ShowInTaskbar="False">
|
||||
<Window.Resources>
|
||||
<converters:BooleanToResizeModeConverter x:Key="BooleanToResizeModeConverter" />
|
||||
<converters:BooleanToResizeBorderThicknessConverter x:Key="BooleanToResizeBorderThicknessConverter" />
|
||||
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||
<converters:ScaledValueConverter x:Key="ScaledValueConverter" />
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Styles/MainWindowStyles.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<converters:BooleanToResizeModeConverter x:Key="BooleanToResizeModeConverter" />
|
||||
<converters:BooleanToResizeBorderThicknessConverter x:Key="BooleanToResizeBorderThicknessConverter" />
|
||||
<converters:BooleanToVisibilityCollapsedConverter x:Key="BooleanToVisibilityCollapsedConverter" />
|
||||
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||
<converters:ScaledValueConverter x:Key="ScaledValueConverter" />
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome x:Name="chrome"
|
||||
@@ -31,49 +35,61 @@
|
||||
</WindowChrome.WindowChrome>
|
||||
<Border>
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="5" ShadowDepth="0" Opacity="0.6" Color="Gray" />
|
||||
<DropShadowEffect BlurRadius="{StaticResource MainWindowShadowBlurRadius}" ShadowDepth="0" Opacity="0.6"
|
||||
Color="Gray" />
|
||||
</Border.Effect>
|
||||
<Grid Background="#FFF8F8FB" Margin="5">
|
||||
<Grid>
|
||||
<Grid x:Name="windowPanel">
|
||||
<Grid Background="{StaticResource MainWindowBackground}"
|
||||
Margin="{StaticResource MainWindowShadowPaddingThinkness}">
|
||||
<Grid x:Name="viewerRootContainer" ZIndex="190">
|
||||
<Grid x:Name="windowCaptionContainer" Height="{StaticResource MainWindowCaptionHeight}"
|
||||
VerticalAlignment="Top"
|
||||
ZIndex="100">
|
||||
<Grid.Resources>
|
||||
<Storyboard x:Key="HideTitlebarStoryboard">
|
||||
<DoubleAnimation
|
||||
Storyboard.Target="{Binding Source={x:Reference windowCaptionContainer}}"
|
||||
Storyboard.TargetProperty="Opacity" To="0" BeginTime="0:0:3"
|
||||
Duration="0:0:0.05" Completed="RemoveWindowChromeCaption" />
|
||||
</Storyboard>
|
||||
<Storyboard x:Key="ShowTitlebarStoryboard">
|
||||
<DoubleAnimation
|
||||
Storyboard.Target="{Binding Source={x:Reference windowCaptionContainer}}"
|
||||
Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.05"
|
||||
Completed="RestoreWindowChromeCaption" />
|
||||
</Storyboard>
|
||||
</Grid.Resources>
|
||||
<Grid.Style>
|
||||
<Style TargetType="{x:Type Grid}">
|
||||
<Style TargetType="Grid">
|
||||
<Style.Triggers>
|
||||
<DataTrigger
|
||||
Binding="{Binding ContextObject.IsBusy, ElementName=mainWindow, Mode=OneWay}"
|
||||
Value="False">
|
||||
<DataTrigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" To="1"
|
||||
BeginTime="0:0:0" Duration="0:0:0" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</DataTrigger.EnterActions>
|
||||
<DataTrigger.ExitActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation Storyboard.TargetProperty="Opacity" From="1" To="0"
|
||||
BeginTime="0:0:0" Duration="0:0:0" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</DataTrigger.ExitActions>
|
||||
</DataTrigger>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition
|
||||
Binding="{Binding IsMouseOver, ElementName=windowCaptionContainer}"
|
||||
Value="False" />
|
||||
<Condition
|
||||
Binding="{Binding ContextObject.AutoHideTitlebar, ElementName=mainWindow}"
|
||||
Value="True" />
|
||||
</MultiDataTrigger.Conditions>
|
||||
<MultiDataTrigger.EnterActions>
|
||||
<BeginStoryboard Storyboard="{StaticResource HideTitlebarStoryboard}" />
|
||||
</MultiDataTrigger.EnterActions>
|
||||
<MultiDataTrigger.ExitActions>
|
||||
<BeginStoryboard Storyboard="{StaticResource ShowTitlebarStoryboard}" />
|
||||
</MultiDataTrigger.ExitActions>
|
||||
</MultiDataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Grid.Style>
|
||||
<Grid VerticalAlignment="Top" Panel.ZIndex="9999">
|
||||
<glassLayer:GlassLayer BlurredElement="{Binding ElementName=container}" />
|
||||
<DockPanel x:Name="titlebar" Height="28">
|
||||
<fa:ImageAwesome DockPanel.Dock="Right" x:Name="buttonCloseWindow" Icon="TimesCircle"
|
||||
WindowChrome.IsHitTestVisibleInChrome="True"
|
||||
Width="15" Height="15" Margin="5,0,10,0" Foreground="#E5868686"
|
||||
Cursor="Hand" />
|
||||
<fa:ImageAwesome DockPanel.Dock="Right" x:Name="buttonWindowStatus"
|
||||
WindowChrome.IsHitTestVisibleInChrome="True"
|
||||
Width="14" Height="14" Margin="5,0,5,0" Foreground="#E5868686"
|
||||
Visibility="{Binding ContextObject.CanResize,ElementName=mainWindow,Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
Cursor="Hand">
|
||||
<glassLayer:GlassLayer BlurredElement="{Binding ElementName=containerPanel}" />
|
||||
<DockPanel>
|
||||
<Grid x:Name="buttonCloseWindow" Style="{StaticResource CaptionButtonStyle}"
|
||||
DockPanel.Dock="Right">
|
||||
<fa:ImageAwesome Icon="TimesCircle"
|
||||
Foreground="{StaticResource CaptionButtonIconForeground}" />
|
||||
</Grid>
|
||||
<Grid x:Name="buttonWindowStatus" Style="{StaticResource CaptionButtonStyle}"
|
||||
DockPanel.Dock="Right">
|
||||
<fa:ImageAwesome Foreground="{StaticResource CaptionButtonIconForeground}">
|
||||
<fa:ImageAwesome.Style>
|
||||
<Style TargetType="{x:Type fa:ImageAwesome}">
|
||||
<Setter Property="Icon" Value="WindowMaximize" />
|
||||
@@ -90,152 +106,56 @@
|
||||
</Style>
|
||||
</fa:ImageAwesome.Style>
|
||||
</fa:ImageAwesome>
|
||||
<fa:ImageAwesome DockPanel.Dock="Right" x:Name="buttonShare" Icon="ShareAlt"
|
||||
WindowChrome.IsHitTestVisibleInChrome="True"
|
||||
Width="14" Height="14" Margin="10,0,5,0" Foreground="#E5868686"
|
||||
Cursor="Hand" />
|
||||
<Button x:Name="buttonOpenWith" DockPanel.Dock="Right" Content="Open with..." Height="20"
|
||||
Margin="10,0,0,0" Padding="5,0"
|
||||
MaxWidth="{Binding Width, ElementName=mainWindow, Converter={StaticResource ScaledValueConverter}, ConverterParameter='0.25'}"
|
||||
Focusable="False" Cursor="Hand"
|
||||
Background="#E5EEEEEE" BorderBrush="#E59A9A9A"
|
||||
WindowChrome.IsHitTestVisibleInChrome="True" Foreground="#FF404040">
|
||||
<Button.ContentTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock TextTrimming="CharacterEllipsis" Text="{Binding}" />
|
||||
</DataTemplate>
|
||||
</Button.ContentTemplate>
|
||||
</Button>
|
||||
<Grid DockPanel.Dock="Left" Width="20" Margin="5,0">
|
||||
<fa:ImageAwesome x:Name="buttonPin"
|
||||
WindowChrome.IsHitTestVisibleInChrome="True"
|
||||
Width="14" Height="14"
|
||||
Cursor="Hand">
|
||||
<fa:ImageAwesome.Style>
|
||||
<Style TargetType="{x:Type fa:ImageAwesome}">
|
||||
<Setter Property="Icon" Value="ThumbTack" />
|
||||
<Setter Property="Foreground" Value="#E5868686" />
|
||||
<Setter Property="LayoutTransform">
|
||||
<Setter.Value>
|
||||
<RotateTransform Angle="-45" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition
|
||||
Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource Self}}"
|
||||
Value="True" />
|
||||
<Condition Binding="{Binding Pinned, ElementName=mainWindow}"
|
||||
Value="True" />
|
||||
<Condition
|
||||
Binding="{Binding Path=LayoutTransform.(RotateTransform.Angle), RelativeSource={RelativeSource Self}}"
|
||||
Value="0" />
|
||||
</MultiDataTrigger.Conditions>
|
||||
<MultiDataTrigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames
|
||||
Storyboard.TargetProperty="Icon">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0.2"
|
||||
Value="{x:Static fa:FontAwesomeIcon.TimesCircle}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</MultiDataTrigger.EnterActions>
|
||||
<MultiDataTrigger.ExitActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames
|
||||
Storyboard.TargetProperty="Icon">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0"
|
||||
Value="{x:Static fa:FontAwesomeIcon.ThumbTack}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</MultiDataTrigger.ExitActions>
|
||||
</MultiDataTrigger>
|
||||
<DataTrigger Binding="{Binding Pinned, ElementName=mainWindow}"
|
||||
Value="True">
|
||||
<DataTrigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ParallelTimeline>
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetProperty="LayoutTransform.(RotateTransform.Angle)"
|
||||
To="0" Duration="0:0:0.05" />
|
||||
<ColorAnimation
|
||||
Storyboard.TargetProperty="Foreground.(SolidColorBrush.Color)"
|
||||
To="#E53C3C3C" Duration="0:0:0.05" />
|
||||
</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>
|
||||
<Button x:Name="buttonOpenWith" DockPanel.Dock="Right" Content="Open with..." Height="20"
|
||||
Margin="10,0,0,0" Padding="5,0"
|
||||
MaxWidth="{Binding Width, ElementName=mainWindow, Converter={StaticResource ScaledValueConverter}, ConverterParameter='0.25'}"
|
||||
Focusable="False" Cursor="Hand"
|
||||
Background="#E5EEEEEE" BorderBrush="#E59A9A9A"
|
||||
WindowChrome.IsHitTestVisibleInChrome="True" Foreground="#FF404040">
|
||||
<Button.ContentTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock TextTrimming="CharacterEllipsis" Text="{Binding}" />
|
||||
</DataTemplate>
|
||||
</Button.ContentTemplate>
|
||||
</Button>
|
||||
<Grid DockPanel.Dock="Left" x:Name="buttonPin" Style="{StaticResource CaptionButtonStyle}">
|
||||
<fa:ImageAwesome Icon="ThumbTack" Foreground="{StaticResource CaptionButtonIconForeground}" />
|
||||
</Grid>
|
||||
<Grid x:Name="buttonShare" Style="{StaticResource CaptionButtonStyle}" DockPanel.Dock="Left">
|
||||
<fa:ImageAwesome Icon="ShareAlt" Foreground="{StaticResource CaptionButtonIconForeground}" />
|
||||
</Grid>
|
||||
<Grid x:Name="titleArea" Background="Transparent">
|
||||
<TextBlock Text="{Binding ContextObject.Title, ElementName=mainWindow}" FontSize="12"
|
||||
HorizontalAlignment="Left" TextTrimming="CharacterEllipsis"
|
||||
VerticalAlignment="Center" Margin="5,0" />
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
<DockPanel x:Name="containerPanel" Background="#FFF8F8FB" ZIndex="80">
|
||||
<Grid DockPanel.Dock="Top" Height="{StaticResource MainWindowCaptionHeight}"
|
||||
Visibility="{Binding ContextObject.TitlebarOverlap, ElementName=mainWindow, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}" />
|
||||
<ContentControl x:Name="container"
|
||||
Content="{Binding ContextObject.ViewerContent, ElementName=mainWindow}" />
|
||||
</Grid>
|
||||
<Grid x:Name="busyIndicatorLayer">
|
||||
<Grid.Style>
|
||||
<Style TargetType="{x:Type Grid}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger
|
||||
Binding="{Binding ContextObject.IsBusy, ElementName=mainWindow, Mode=OneWay}"
|
||||
Value="False">
|
||||
<DataTrigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ParallelTimeline>
|
||||
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="0"
|
||||
Duration="0:0:0.05" />
|
||||
<ObjectAnimationUsingKeyFrames
|
||||
Storyboard.TargetProperty="(UIElement.Visibility)">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0.05"
|
||||
Value="{x:Static Visibility.Hidden}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</ParallelTimeline>
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</DataTrigger.EnterActions>
|
||||
<DataTrigger.ExitActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ParallelTimeline>
|
||||
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1"
|
||||
Duration="0:0:0" />
|
||||
<ObjectAnimationUsingKeyFrames
|
||||
Storyboard.TargetProperty="(UIElement.Visibility)">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0"
|
||||
Value="{x:Static Visibility.Visible}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</ParallelTimeline>
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</DataTrigger.ExitActions>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Grid.Style>
|
||||
<!--IsBusyIndicatorShowing="{Binding IsVisible, ElementName=busyIndicatorLayer}"-->
|
||||
<busyDecorator:BusyDecorator x:Name="busyDecorator"
|
||||
IsBusyIndicatorShowing="True"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center" />
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
<Grid x:Name="busyIndicatorLayer" Background="{StaticResource MainWindowBackground}" ZIndex="200">
|
||||
<Grid.Style>
|
||||
<Style TargetType="{x:Type Grid}">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger
|
||||
Binding="{Binding ContextObject.IsBusy, ElementName=mainWindow, Mode=OneWay}"
|
||||
Value="False">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Grid.Style>
|
||||
<busyDecorator:BusyDecorator x:Name="busyDecorator"
|
||||
IsBusyIndicatorShowing="True"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
@@ -27,7 +27,6 @@ using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
using QuickLook.Annotations;
|
||||
using QuickLook.Helpers;
|
||||
using QuickLook.Helpers.BlurLibrary;
|
||||
using QuickLook.Plugin;
|
||||
|
||||
namespace QuickLook
|
||||
@@ -234,12 +233,13 @@ namespace QuickLook
|
||||
// revert UI changes
|
||||
ContextObject.IsBusy = true;
|
||||
|
||||
var newHeight = ContextObject.PreferredSize.Height + titlebar.Height;
|
||||
var newWidth = ContextObject.PreferredSize.Width;
|
||||
var newHeight = ContextObject.PreferredSize.Height + 10 +
|
||||
(ContextObject.TitlebarOverlap ? 0 : windowCaptionContainer.Height);
|
||||
var newWidth = ContextObject.PreferredSize.Width + 10;
|
||||
|
||||
ResizeAndCenter(new Size(newWidth, newHeight));
|
||||
|
||||
chrome.CaptionHeight = ContextObject.FullWindowDragging ? Height : titlebar.Height - 5;
|
||||
chrome.CaptionHeight = ContextObject.FullWindowDragging ? Height : windowCaptionContainer.Height - 5;
|
||||
|
||||
if (Visibility != Visibility.Visible)
|
||||
Show();
|
||||
@@ -301,5 +301,15 @@ namespace QuickLook
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
private void RemoveWindowChromeCaption(object sender, EventArgs e)
|
||||
{
|
||||
chrome.CaptionHeight = 0;
|
||||
}
|
||||
|
||||
private void RestoreWindowChromeCaption(object sender, EventArgs e)
|
||||
{
|
||||
chrome.CaptionHeight = ContextObject.FullWindowDragging ? Height : windowCaptionContainer.Height - 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,11 +31,12 @@ namespace QuickLook.Plugin
|
||||
/// </summary>
|
||||
public class ContextObject : INotifyPropertyChanged
|
||||
{
|
||||
private bool _canFocus;
|
||||
private bool _autoHideTitlebar;
|
||||
private bool _canResize = true;
|
||||
private bool _fullWindowDragging;
|
||||
private bool _isBusy = true;
|
||||
private string _title = "";
|
||||
private bool _titlebarOverlap;
|
||||
private object _viewerContent;
|
||||
|
||||
/// <summary>
|
||||
@@ -114,14 +115,27 @@ namespace QuickLook.Plugin
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set whether user are allowed to set focus at the viewer window.
|
||||
/// Set whether the viewer content is overlapped by the title bar
|
||||
/// </summary>
|
||||
public bool CanFocus
|
||||
public bool TitlebarOverlap
|
||||
{
|
||||
get => _canFocus;
|
||||
get => _titlebarOverlap;
|
||||
set
|
||||
{
|
||||
_canFocus = value;
|
||||
_titlebarOverlap = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set whether the title bar of viewer window should be auto-hidden.
|
||||
/// </summary>
|
||||
public bool AutoHideTitlebar
|
||||
{
|
||||
get => _autoHideTitlebar;
|
||||
set
|
||||
{
|
||||
_autoHideTitlebar = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
@@ -189,7 +203,8 @@ namespace QuickLook.Plugin
|
||||
PreferredSize = new Size();
|
||||
CanResize = true;
|
||||
FullWindowDragging = false;
|
||||
CanFocus = false;
|
||||
AutoHideTitlebar = false;
|
||||
TitlebarOverlap = false;
|
||||
}
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
<ColumnDefinition Width="150" />
|
||||
<ColumnDefinition Width="65*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image x:Name="image" Grid.Row="1" 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>
|
||||
<Style TargetType="{x:Type Image}">
|
||||
<Style.Triggers>
|
||||
|
||||
@@ -116,6 +116,7 @@
|
||||
<DependentUpon>GlassLayer.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Converters\BooleanToResizeModeConverter.cs" />
|
||||
<Compile Include="Converters\BooleanToVisibilityCollapsedConverter.cs" />
|
||||
<Compile Include="Converters\BooleanToVisibilityConverter.cs" />
|
||||
<Compile Include="Converters\BooleanToResizeBorderThicknessConverter.cs" />
|
||||
<Compile Include="Converters\ScaledValueConverter.cs" />
|
||||
@@ -175,6 +176,10 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Styles\MainWindowStyles.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Styles\ScrollBarStyleDictionary.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -226,7 +231,9 @@
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="app.manifest" />
|
||||
<Resource Include="Controls\GlassLayer\GaussianBlur.ps" />
|
||||
<Resource Include="Controls\GlassLayer\GaussianBlur.ps">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<None Include="key.snk" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
|
||||
26
QuickLook/Styles/MainWindowStyles.xaml
Normal file
26
QuickLook/Styles/MainWindowStyles.xaml
Normal file
@@ -0,0 +1,26 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:fa="http://schemas.fontawesome.io/icons/">
|
||||
<system:Double x:Key="MainWindowShadowBlurRadius">5</system:Double>
|
||||
<Thickness x:Key="MainWindowShadowPaddingThinkness">5</Thickness>
|
||||
<system:Double x:Key="MainWindowCaptionHeight">32</system:Double>
|
||||
<SolidColorBrush x:Key="CaptionButtonIconForeground" Color="#E5868686" />
|
||||
<SolidColorBrush x:Key="MainWindowBackground" Color="#FFF8F8FB" />
|
||||
|
||||
<Style x:Key="CaptionButtonStyle" TargetType="Grid">
|
||||
<Setter Property="Width" Value="20" />
|
||||
<Setter Property="Height" Value="20" />
|
||||
<Setter Property="Margin" Value="5,0,5,0" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#22FFFFFF" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
Reference in New Issue
Block a user