mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-11 17:59:17 +00:00
dark theme; wip videopleyer
This commit is contained in:
@@ -69,6 +69,8 @@ namespace QuickLook.Plugin.VideoViewer
|
|||||||
windowSize.Height = Math.Max(def.Height, windowSize.Height);
|
windowSize.Height = Math.Max(def.Height, windowSize.Height);
|
||||||
|
|
||||||
context.SetPreferredSizeFit(windowSize, 0.6);
|
context.SetPreferredSizeFit(windowSize, 0.6);
|
||||||
|
context.UseDarkTheme = true;
|
||||||
|
context.TitlebarOverlap = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void View(string path, ContextObject context)
|
public void View(string path, ContextObject context)
|
||||||
|
@@ -1,31 +1,51 @@
|
|||||||
<!--
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
This file is a part of unosquare/ffmediaelement project: <https://github.com/unosquare/ffmediaelement>
|
|
||||||
-->
|
|
||||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
<Style x:Key="ControlButtonStyle" TargetType="Grid">
|
<SolidColorBrush x:Key="CaptionButtonIconForeground" Color="#E5EFEFEF" />
|
||||||
<Setter Property="Height" Value="35" />
|
<SolidColorBrush x:Key="CaptionButtonHoverBackground" Color="#22FFFFFF" />
|
||||||
<Setter Property="Width" Value="35" />
|
<SolidColorBrush x:Key="CaptionButtonPressBackground" Color="#44FFFFFF" />
|
||||||
|
|
||||||
|
<Style x:Key="CaptionButtonBaseStyle" TargetType="Button">
|
||||||
|
<Setter Property="Focusable" Value="False" />
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
<Setter Property="Cursor" Value="Hand" />
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource CaptionButtonIconForeground}" />
|
||||||
<Setter Property="VerticalAlignment" Value="Center" />
|
<Setter Property="VerticalAlignment" Value="Center" />
|
||||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||||
<Setter Property="Background" Value="Transparent" />
|
<Setter Property="Background" Value="Transparent" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="CaptionButtonStyle" TargetType="Button" BasedOn="{StaticResource CaptionButtonBaseStyle}">
|
||||||
|
<Setter Property="Width" Value="32" />
|
||||||
|
<Setter Property="Height" Value="32" />
|
||||||
|
<Setter Property="Padding" Value="9,9,9,9" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="{x:Type Button}">
|
||||||
|
<Border Background="{TemplateBinding Background}" BorderThickness="0"
|
||||||
|
Padding="{TemplateBinding Padding}">
|
||||||
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
<Trigger Property="IsMouseOver" Value="True">
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
<Setter Property="Background" Value="#22FFFFFF" />
|
<Setter Property="Background" Value="{DynamicResource CaptionButtonHoverBackground}" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsPressed" Value="True">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource CaptionButtonPressBackground}" />
|
||||||
</Trigger>
|
</Trigger>
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<SolidColorBrush x:Key="CustomSliderForegroundBrush" Color="#FFEFEFEF" />
|
<SolidColorBrush x:Key="CustomSliderForegroundBrush" Color="#FFEFEFEF" />
|
||||||
<SolidColorBrush x:Key="CustomSliderBackgroundBrush" Color="#55ffffff" />
|
<SolidColorBrush x:Key="CustomSliderBackgroundBrush" Color="#EE000000" />
|
||||||
<SolidColorBrush x:Key="CustomSliderHighlightBrush" Color="#FFEFEFEF" />
|
<SolidColorBrush x:Key="CustomSliderHighlightBrush" Color="#FFEFEFEF" />
|
||||||
|
|
||||||
<!-- Postion Slider Control -->
|
<!-- Postion Slider Control -->
|
||||||
<ControlTemplate x:Key="PositionSliderThumbTemplate" TargetType="{x:Type Thumb}">
|
<ControlTemplate x:Key="PositionSliderThumbTemplate" TargetType="{x:Type Thumb}">
|
||||||
<Grid HorizontalAlignment="Center" UseLayoutRounding="True" VerticalAlignment="Center">
|
<Grid HorizontalAlignment="Center" UseLayoutRounding="True" VerticalAlignment="Center">
|
||||||
<Path x:Name="grip" Data="M 0,0 A 180,180 180 1 1 1,1 Z" Fill="Transparent" Stretch="Fill"
|
<Path x:Name="grip" Data="M 0,0 A 180,180 180 1 1 1,1 Z" Fill="Transparent" Stretch="Fill"
|
||||||
Stroke="{StaticResource CustomSliderForegroundBrush}" StrokeThickness="2.5" UseLayoutRounding="True"
|
Stroke="{StaticResource CustomSliderForegroundBrush}" StrokeThickness="1" UseLayoutRounding="True"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Margin="-1,-1" />
|
Margin="-1,-1" />
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -49,12 +69,12 @@
|
|||||||
<RowDefinition Height="{TemplateBinding MinHeight}" />
|
<RowDefinition Height="{TemplateBinding MinHeight}" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<DockPanel LastChildFill="True">
|
<DockPanel LastChildFill="True">
|
||||||
<Border ClipToBounds="True" x:Name="PART_SelectionRange" Height="3" Visibility="Visible">
|
<Border ClipToBounds="True" x:Name="PART_SelectionRange" Height="1" Visibility="Visible">
|
||||||
<Rectangle RadiusX="1" RadiusY="1" Margin="10,0,-10,0"
|
<Rectangle RadiusX="1" RadiusY="1" Margin="10,0,-10,0"
|
||||||
Fill="{StaticResource CustomSliderForegroundBrush}" />
|
Fill="{StaticResource CustomSliderForegroundBrush}" />
|
||||||
</Border>
|
</Border>
|
||||||
<Border ClipToBounds="True" Height="3" Visibility="Visible">
|
<Border ClipToBounds="True" Height="1" Visibility="Visible">
|
||||||
<Rectangle RadiusX="1" RadiusY="1" Margin="20,0,10,0"
|
<Rectangle RadiusX="1" RadiusY="1" Margin="10,0,10,0"
|
||||||
Fill="{StaticResource CustomSliderBackgroundBrush}" />
|
Fill="{StaticResource CustomSliderBackgroundBrush}" />
|
||||||
</Border>
|
</Border>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
@@ -73,10 +93,11 @@
|
|||||||
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false" />
|
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false" />
|
||||||
<Setter Property="Background" Value="Transparent" />
|
<Setter Property="Background" Value="Transparent" />
|
||||||
<Setter Property="BorderBrush" Value="Transparent" />
|
<Setter Property="BorderBrush" Value="Transparent" />
|
||||||
<Setter Property="MinHeight" Value="20" />
|
<Setter Property="MinHeight" Value="10" />
|
||||||
<Setter Property="MaxHeight" Value="20" />
|
<Setter Property="MaxHeight" Value="10" />
|
||||||
<Setter Property="Height" Value="20" />
|
<Setter Property="Height" Value="10" />
|
||||||
<Setter Property="Minimum" Value="0" />
|
<Setter Property="Minimum" Value="0" />
|
||||||
|
<Setter Property="Focusable" Value="False" />
|
||||||
<Setter Property="AutoToolTipPlacement" Value="None" />
|
<Setter Property="AutoToolTipPlacement" Value="None" />
|
||||||
<Setter Property="IsMoveToPointEnabled" Value="True" />
|
<Setter Property="IsMoveToPointEnabled" Value="True" />
|
||||||
<Setter Property="VerticalAlignment" Value="Center" />
|
<Setter Property="VerticalAlignment" Value="Center" />
|
||||||
|
@@ -6,9 +6,9 @@
|
|||||||
xmlns:fa="http://schemas.fontawesome.io/icons/"
|
xmlns:fa="http://schemas.fontawesome.io/icons/"
|
||||||
xmlns:vlc="clr-namespace:Meta.Vlc.Wpf;assembly=Meta.Vlc.Wpf"
|
xmlns:vlc="clr-namespace:Meta.Vlc.Wpf;assembly=Meta.Vlc.Wpf"
|
||||||
xmlns:local="clr-namespace:QuickLook.Plugin.VideoViewer"
|
xmlns:local="clr-namespace:QuickLook.Plugin.VideoViewer"
|
||||||
|
xmlns:glassLayer="clr-namespace:QuickLook.Controls.GlassLayer;assembly=QuickLook"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
x:Name="viewerPanel"
|
x:Name="viewerPanel"
|
||||||
Background="#CC4E4E4E"
|
|
||||||
d:DesignHeight="450" d:DesignWidth="450">
|
d:DesignHeight="450" d:DesignWidth="450">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.Resources>
|
<Grid.Resources>
|
||||||
@@ -43,128 +43,48 @@
|
|||||||
</Image.Style>
|
</Image.Style>
|
||||||
</Image>
|
</Image>
|
||||||
|
|
||||||
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Height="100">
|
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Height="32">
|
||||||
<Grid.Background>
|
<glassLayer:GlassLayer BlurredElement="{Binding ElementName=mediaElement}" OverlayColor="#FF3B3B3B" />
|
||||||
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
|
<DockPanel>
|
||||||
<GradientStop Offset="0.0" Color="#00000000" />
|
<Button x:Name="buttonPlayPause" Style="{StaticResource CaptionButtonStyle}" DockPanel.Dock="Left">
|
||||||
<GradientStop Offset="0.25" Color="#66000000" />
|
<fa:ImageAwesome Foreground="{DynamicResource CaptionButtonIconForeground}">
|
||||||
<GradientStop Offset="1" Color="#D6000000" />
|
<fa:ImageAwesome.Style>
|
||||||
</LinearGradientBrush>
|
<Style>
|
||||||
</Grid.Background>
|
<Setter Property="fa:ImageAwesome.Icon" Value="Pause" />
|
||||||
<Grid.RowDefinitions>
|
<Style.Triggers>
|
||||||
<RowDefinition Height="*" />
|
<DataTrigger Binding="{Binding IsPlaying, ElementName=viewerPanel}"
|
||||||
<RowDefinition Height="30" />
|
Value="False">
|
||||||
<RowDefinition Height="75" />
|
<Setter Property="fa:ImageAwesome.Icon" Value="Play" />
|
||||||
</Grid.RowDefinitions>
|
</DataTrigger>
|
||||||
<Grid.Style>
|
</Style.Triggers>
|
||||||
<Style TargetType="{x:Type Grid}">
|
</Style>
|
||||||
<Style.Triggers>
|
</fa:ImageAwesome.Style>
|
||||||
<MultiDataTrigger>
|
</fa:ImageAwesome>
|
||||||
<MultiDataTrigger.Conditions>
|
</Button>
|
||||||
<Condition Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource Self}}"
|
<Button x:Name="buttonMute" Style="{StaticResource CaptionButtonStyle}" DockPanel.Dock="Right">
|
||||||
Value="True" />
|
<fa:ImageAwesome Icon="VolumeUp" Foreground="{DynamicResource CaptionButtonIconForeground}">
|
||||||
<Condition Binding="{Binding HasVideo, ElementName=viewerPanel}" Value="True" />
|
<fa:ImageAwesome.Style>
|
||||||
</MultiDataTrigger.Conditions>
|
<Style TargetType="fa:ImageAwesome">
|
||||||
<MultiDataTrigger.EnterActions>
|
<Setter Property="Icon" Value="VolumeOff" />
|
||||||
<BeginStoryboard>
|
<Style.Triggers>
|
||||||
<Storyboard>
|
<DataTrigger Binding="{Binding IsMuted, ElementName=viewerPanel}"
|
||||||
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1"
|
Value="False">
|
||||||
Duration="0:0:0.2" />
|
<Setter Property="Icon" Value="VolumeUp" />
|
||||||
</Storyboard>
|
</DataTrigger>
|
||||||
</BeginStoryboard>
|
</Style.Triggers>
|
||||||
</MultiDataTrigger.EnterActions>
|
</Style>
|
||||||
<MultiDataTrigger.ExitActions>
|
</fa:ImageAwesome.Style>
|
||||||
<BeginStoryboard>
|
</fa:ImageAwesome>
|
||||||
<Storyboard>
|
</Button>
|
||||||
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="0"
|
<Button Width="Auto" Style="{StaticResource CaptionButtonStyle}" DockPanel.Dock="Right">
|
||||||
Duration="0:0:0.2" />
|
<TextBlock DockPanel.Dock="Right" VerticalAlignment="Center" FontSize="11"
|
||||||
</Storyboard>
|
Foreground="{DynamicResource CaptionButtonIconForeground}"
|
||||||
</BeginStoryboard>
|
Text="{Binding Time, StringFormat=hh\\:mm\\:ss, ElementName=mediaElement}"/>
|
||||||
</MultiDataTrigger.ExitActions>
|
</Button>
|
||||||
</MultiDataTrigger>
|
<Slider x:Name="sliderProgress" Style="{StaticResource PositionSliderStyle}"
|
||||||
</Style.Triggers>
|
SmallChange="0.00001" LargeChange="0.01" Maximum="1"
|
||||||
</Style>
|
Value="{Binding Position, ElementName=mediaElement}" />
|
||||||
</Grid.Style>
|
</DockPanel>
|
||||||
|
|
||||||
<Slider Grid.Row="1" x:Name="sliderProgress" Style="{StaticResource PositionSliderStyle}"
|
|
||||||
SmallChange="0.00001" LargeChange="0.01" Maximum="1"
|
|
||||||
Value="{Binding Position, ElementName=mediaElement}" />
|
|
||||||
|
|
||||||
<Grid Grid.Row="2">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="149" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<StackPanel Grid.Column="0" VerticalAlignment="Center" Orientation="Horizontal" Margin="10,0,0,0">
|
|
||||||
<StackPanel.Style>
|
|
||||||
<Style TargetType="StackPanel">
|
|
||||||
<Setter Property="Visibility" Value="Visible" />
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding HasAudio, ElementName=viewerPanel}" Value="False">
|
|
||||||
<Setter Property="Visibility" Value="Hidden" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</StackPanel.Style>
|
|
||||||
<Grid x:Name="buttonMute" Style="{StaticResource ControlButtonStyle}">
|
|
||||||
<fa:ImageAwesome Height="23" Width="23" Foreground="#FFEFEFEF">
|
|
||||||
<fa:ImageAwesome.Style>
|
|
||||||
<Style TargetType="fa:ImageAwesome">
|
|
||||||
<Setter Property="Icon" Value="VolumeOff" />
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding IsMuted, ElementName=viewerPanel}"
|
|
||||||
Value="False">
|
|
||||||
<Setter Property="Icon" Value="VolumeUp" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</fa:ImageAwesome.Style>
|
|
||||||
</fa:ImageAwesome>
|
|
||||||
</Grid>
|
|
||||||
<Slider Style="{StaticResource CustomSliderStyle}" Width="75" Maximum="100"
|
|
||||||
Value="{Binding Volume, ElementName=mediaElement}"
|
|
||||||
Visibility="{Binding IsMuted, ElementName=viewerPanel, Converter={StaticResource BooleanToVisibilityHiddenConverter}}"
|
|
||||||
BorderThickness="0,0,5,0" />
|
|
||||||
</StackPanel>
|
|
||||||
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center">
|
|
||||||
<Grid x:Name="buttonBackward" Style="{StaticResource ControlButtonStyle}">
|
|
||||||
<fa:ImageAwesome Icon="Backward" Height="23" Width="23" Foreground="#FFEFEFEF" />
|
|
||||||
</Grid>
|
|
||||||
<Grid Width="3" />
|
|
||||||
<Grid x:Name="buttonPlayPause" Style="{StaticResource ControlButtonStyle}">
|
|
||||||
<fa:ImageAwesome Height="23" Width="23" Foreground="#FFEFEFEF">
|
|
||||||
<fa:ImageAwesome.Style>
|
|
||||||
<Style>
|
|
||||||
<Setter Property="fa:ImageAwesome.Icon" Value="Pause" />
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding IsPlaying, ElementName=viewerPanel}"
|
|
||||||
Value="False">
|
|
||||||
<Setter Property="fa:ImageAwesome.Icon" Value="Play" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</fa:ImageAwesome.Style>
|
|
||||||
</fa:ImageAwesome>
|
|
||||||
</Grid>
|
|
||||||
<Grid Width="3" />
|
|
||||||
<Grid x:Name="buttonStop" Style="{StaticResource ControlButtonStyle}">
|
|
||||||
<fa:ImageAwesome Icon="Stop" Height="21" Width="21" Foreground="#FFEFEFEF" />
|
|
||||||
</Grid>
|
|
||||||
<Grid Width="3" />
|
|
||||||
<Grid x:Name="buttonForward" Style="{StaticResource ControlButtonStyle}">
|
|
||||||
<fa:ImageAwesome Icon="Forward" Height="23" Width="23" Foreground="#FFEFEFEF" />
|
|
||||||
</Grid>
|
|
||||||
</StackPanel>
|
|
||||||
<StackPanel Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Center"
|
|
||||||
Orientation="Horizontal" Margin="0,0,10,0">
|
|
||||||
<TextBlock FontSize="14" Foreground="#FFEFEFEF"
|
|
||||||
Text="{Binding Time, StringFormat=hh\\:mm\\:ss, ElementName=mediaElement}" />
|
|
||||||
<TextBlock FontSize="14" Text=" / " Foreground="#FFEFEFEF" />
|
|
||||||
<TextBlock FontSize="14" Foreground="#FFEFEFEF"
|
|
||||||
Text="{Binding Length, StringFormat=hh\\:mm\\:ss, ElementName=mediaElement}" />
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
@@ -60,9 +60,6 @@ namespace QuickLook.Plugin.VideoViewer
|
|||||||
// buttonMute.Visibility = Visibility.Collapsed;
|
// buttonMute.Visibility = Visibility.Collapsed;
|
||||||
//};
|
//};
|
||||||
buttonMute.MouseLeftButtonUp += (sender, e) => IsMuted = !IsMuted;
|
buttonMute.MouseLeftButtonUp += (sender, e) => IsMuted = !IsMuted;
|
||||||
buttonStop.MouseLeftButtonUp += PlayerStop;
|
|
||||||
buttonBackward.MouseLeftButtonUp += (sender, e) => Seek(TimeSpan.FromSeconds(-10));
|
|
||||||
buttonForward.MouseLeftButtonUp += (sender, e) => Seek(TimeSpan.FromSeconds(10));
|
|
||||||
|
|
||||||
sliderProgress.PreviewMouseDown += (sender, e) =>
|
sliderProgress.PreviewMouseDown += (sender, e) =>
|
||||||
{
|
{
|
||||||
|
@@ -1,103 +0,0 @@
|
|||||||
// 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.Collections.Generic;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Markup;
|
|
||||||
|
|
||||||
namespace QuickLook.Actions
|
|
||||||
{
|
|
||||||
[ContentProperty("Actions")]
|
|
||||||
public class ConditionalEventTrigger : FrameworkContentElement
|
|
||||||
{
|
|
||||||
public static readonly DependencyProperty ConditionProperty =
|
|
||||||
DependencyProperty.Register("Condition", typeof(bool), typeof(ConditionalEventTrigger));
|
|
||||||
|
|
||||||
public static readonly DependencyProperty TriggersProperty = DependencyProperty.RegisterAttached("Triggers",
|
|
||||||
typeof(ConditionalEventTriggerCollection), typeof(ConditionalEventTrigger), new PropertyMetadata
|
|
||||||
{
|
|
||||||
PropertyChangedCallback = (obj, e) =>
|
|
||||||
{
|
|
||||||
// When "Triggers" is set, register handlers for each trigger in the list
|
|
||||||
var element = (FrameworkElement) obj;
|
|
||||||
var triggers = (List<ConditionalEventTrigger>) e.NewValue;
|
|
||||||
foreach (var trigger in triggers)
|
|
||||||
element.AddHandler(trigger.RoutedEvent, new RoutedEventHandler((obj2, e2) =>
|
|
||||||
trigger.OnRoutedEvent(element)));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
private static readonly RoutedEvent TriggerActionsEvent = EventManager.RegisterRoutedEvent("",
|
|
||||||
RoutingStrategy.Direct,
|
|
||||||
typeof(EventHandler), typeof(ConditionalEventTrigger));
|
|
||||||
|
|
||||||
public ConditionalEventTrigger()
|
|
||||||
{
|
|
||||||
Actions = new List<TriggerAction>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public RoutedEvent RoutedEvent { get; set; }
|
|
||||||
public List<TriggerAction> Actions { get; set; }
|
|
||||||
|
|
||||||
// Condition
|
|
||||||
public bool Condition
|
|
||||||
{
|
|
||||||
get => (bool) GetValue(ConditionProperty);
|
|
||||||
set => SetValue(ConditionProperty, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// "Triggers" attached property
|
|
||||||
public static ConditionalEventTriggerCollection GetTriggers(DependencyObject obj)
|
|
||||||
{
|
|
||||||
return (ConditionalEventTriggerCollection) obj.GetValue(TriggersProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SetTriggers(DependencyObject obj, ConditionalEventTriggerCollection value)
|
|
||||||
{
|
|
||||||
obj.SetValue(TriggersProperty, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// When an event fires, check the condition and if it is true fire the actions
|
|
||||||
private void OnRoutedEvent(FrameworkElement element)
|
|
||||||
{
|
|
||||||
DataContext = element.DataContext; // Allow data binding to access element properties
|
|
||||||
if (Condition)
|
|
||||||
{
|
|
||||||
// Construct an EventTrigger containing the actions, then trigger it
|
|
||||||
var dummyTrigger = new EventTrigger {RoutedEvent = TriggerActionsEvent};
|
|
||||||
foreach (var action in Actions)
|
|
||||||
dummyTrigger.Actions.Add(action);
|
|
||||||
|
|
||||||
element.Triggers.Add(dummyTrigger);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
element.RaiseEvent(new RoutedEventArgs(TriggerActionsEvent));
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
element.Triggers.Remove(dummyTrigger);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create collection type visible to XAML - since it is attached we cannot construct it in code
|
|
||||||
public class ConditionalEventTriggerCollection : List<ConditionalEventTrigger>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@@ -15,8 +15,8 @@
|
|||||||
Viewport="0,0,100,100" TileMode="FlipY" Stretch="UniformToFill" />
|
Viewport="0,0,100,100" TileMode="FlipY" Stretch="UniformToFill" />
|
||||||
</Rectangle.Fill>
|
</Rectangle.Fill>
|
||||||
</Rectangle>
|
</Rectangle>
|
||||||
<Rectangle Panel.ZIndex="50" Fill="#FFDADADA" Opacity="0.8"
|
<Rectangle Panel.ZIndex="50" Fill="{Binding ElementName=glassLayer, Path=OverlayColor}" Opacity="0.7"
|
||||||
Visibility="{Binding ElementName=glassLayer,Path=GrayOverlayVisibility}" />
|
Visibility="{Binding ElementName=glassLayer,Path=ColorOverlayVisibility}" />
|
||||||
<Grid Panel.ZIndex="0" Visibility="{Binding ElementName=glassLayer,Path=GlassVisibility}">
|
<Grid Panel.ZIndex="0" Visibility="{Binding ElementName=glassLayer,Path=GlassVisibility}">
|
||||||
<Grid.Effect>
|
<Grid.Effect>
|
||||||
<local:GaussianBlurEffect Direction="0,1"
|
<local:GaussianBlurEffect Direction="0,1"
|
||||||
|
@@ -15,10 +15,13 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
using System.Drawing;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using QuickLook.Helpers;
|
using QuickLook.Helpers;
|
||||||
|
using Color = System.Windows.Media.Color;
|
||||||
|
using Size = System.Windows.Size;
|
||||||
|
|
||||||
namespace QuickLook.Controls.GlassLayer
|
namespace QuickLook.Controls.GlassLayer
|
||||||
{
|
{
|
||||||
@@ -56,25 +59,44 @@ namespace QuickLook.Controls.GlassLayer
|
|||||||
|
|
||||||
#endregion public Visual BlurredElement
|
#endregion public Visual BlurredElement
|
||||||
|
|
||||||
#region public Visibility GrayOverlayVisibility
|
#region public SolidColorBrush OverlayColor
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Identifies the GrayOverlayVisibility dependency property.
|
/// Identifies the OverlayColor dependency property.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static DependencyProperty GrayOverlayVisibilityProperty =
|
public static DependencyProperty OverlayColorProperty =
|
||||||
DependencyProperty.Register("GrayOverlayVisibility", typeof(Visibility), typeof(GlassLayer),
|
DependencyProperty.Register("OverlayColor", typeof(SolidColorBrush), typeof(GlassLayer),
|
||||||
new UIPropertyMetadata(Visibility.Visible));
|
new UIPropertyMetadata(new SolidColorBrush(Color.FromRgb(0xDA, 0xDA, 0xDA))));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Visibility GrayOverlayVisibility
|
public SolidColorBrush OverlayColor
|
||||||
{
|
{
|
||||||
get => (Visibility) GetValue(GrayOverlayVisibilityProperty);
|
|
||||||
|
get => (SolidColorBrush) GetValue(OverlayColorProperty);
|
||||||
|
|
||||||
set => SetValue(GrayOverlayVisibilityProperty, value);
|
set => SetValue(OverlayColorProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion public Visibility GrayOverlayVisibility
|
#endregion public SolidColorBrush OverlayColor
|
||||||
|
|
||||||
|
#region public Visibility ColorOverlayVisibility
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies the ColorOverlayVisibilityProperty dependency property.
|
||||||
|
/// </summary>
|
||||||
|
public static DependencyProperty ColorOverlayVisibilityProperty =
|
||||||
|
DependencyProperty.Register("ColorOverlayVisibility", typeof(Visibility), typeof(GlassLayer),
|
||||||
|
new UIPropertyMetadata(Visibility.Visible));
|
||||||
|
|
||||||
|
public Visibility ColorOverlayVisibility
|
||||||
|
{
|
||||||
|
get => (Visibility) GetValue(ColorOverlayVisibilityProperty);
|
||||||
|
|
||||||
|
set => SetValue(ColorOverlayVisibilityProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion public Visibility ColorOverlayVisibility
|
||||||
|
|
||||||
#region public Visibility NoiseVisibility
|
#region public Visibility NoiseVisibility
|
||||||
|
|
||||||
|
@@ -29,7 +29,7 @@ namespace QuickLook.Helpers
|
|||||||
public static void PerformAggressiveGC()
|
public static void PerformAggressiveGC()
|
||||||
{
|
{
|
||||||
// delay some time to make sure that all windows are closed
|
// delay some time to make sure that all windows are closed
|
||||||
Task.Delay(1000).ContinueWith(t => GC.Collect(GC.MaxGeneration));
|
Task.Delay(2000).ContinueWith(t => GC.Collect(GC.MaxGeneration));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsRunningAsUWP()
|
public static bool IsRunningAsUWP()
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
xmlns:glassLayer="clr-namespace:QuickLook.Controls.GlassLayer"
|
xmlns:glassLayer="clr-namespace:QuickLook.Controls.GlassLayer"
|
||||||
xmlns:converters="clr-namespace:QuickLook.Converters"
|
xmlns:converters="clr-namespace:QuickLook.Converters"
|
||||||
xmlns:controls="clr-namespace:QuickLook.Controls"
|
xmlns:controls="clr-namespace:QuickLook.Controls"
|
||||||
xmlns:actions="clr-namespace:QuickLook.Actions"
|
|
||||||
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"
|
||||||
@@ -34,6 +33,9 @@
|
|||||||
</controls:MainWindowBase.Resources>
|
</controls:MainWindowBase.Resources>
|
||||||
<controls:MainWindowBase.Style>
|
<controls:MainWindowBase.Style>
|
||||||
<Style TargetType="controls:MainWindowBase">
|
<Style TargetType="controls:MainWindowBase">
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource MainWindowForeground}" />
|
||||||
|
<Setter Property="ResizeMode"
|
||||||
|
Value="{Binding ContextObject.CanResize, ElementName=mainWindow, Converter={StaticResource BooleanToResizeModeConverter}}" />
|
||||||
<Setter Property="WindowChrome.WindowChrome">
|
<Setter Property="WindowChrome.WindowChrome">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<WindowChrome CaptionHeight="0"
|
<WindowChrome CaptionHeight="0"
|
||||||
@@ -52,16 +54,12 @@
|
|||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
</controls:MainWindowBase.Style>
|
</controls:MainWindowBase.Style>
|
||||||
<controls:MainWindowBase.ResizeMode>
|
|
||||||
<Binding ElementName="mainWindow" Path="ContextObject.CanResize"
|
|
||||||
Converter="{StaticResource BooleanToResizeModeConverter}" />
|
|
||||||
</controls:MainWindowBase.ResizeMode>
|
|
||||||
<Border>
|
<Border>
|
||||||
<Border.Effect>
|
<Border.Effect>
|
||||||
<DropShadowEffect BlurRadius="{StaticResource MainWindowShadowBlurRadius}" ShadowDepth="0" Opacity="0.6"
|
<DropShadowEffect BlurRadius="{StaticResource MainWindowShadowBlurRadius}" ShadowDepth="0" Opacity="0.6"
|
||||||
Color="Gray" />
|
Color="{DynamicResource MainWindowShadowColor}" />
|
||||||
</Border.Effect>
|
</Border.Effect>
|
||||||
<Grid x:Name="windowFrameContainer" Background="{StaticResource MainWindowBackground}"
|
<Grid x:Name="windowFrameContainer" Background="{DynamicResource MainWindowBackground}"
|
||||||
Margin="{Binding WindowState, ElementName=mainWindow, Converter={StaticResource WindowStateToThicknessConverter}, ConverterParameter={StaticResource MainWindowShadowPaddingThinkness}}">
|
Margin="{Binding WindowState, ElementName=mainWindow, Converter={StaticResource WindowStateToThicknessConverter}, ConverterParameter={StaticResource MainWindowShadowPaddingThinkness}}">
|
||||||
<Grid.Resources>
|
<Grid.Resources>
|
||||||
<Storyboard x:Key="ShowCaptionStoryboard">
|
<Storyboard x:Key="ShowCaptionStoryboard">
|
||||||
@@ -86,17 +84,17 @@
|
|||||||
<Grid x:Name="windowCaptionContainer" Height="{StaticResource MainWindowCaptionHeight}"
|
<Grid x:Name="windowCaptionContainer" Height="{StaticResource MainWindowCaptionHeight}"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
ZIndex="100">
|
ZIndex="100">
|
||||||
<glassLayer:GlassLayer BlurredElement="{Binding ElementName=containerPanel}" />
|
<glassLayer:GlassLayer OverlayColor="{DynamicResource CaptionBackground}" BlurredElement="{Binding ElementName=containerPanel}" />
|
||||||
<DockPanel>
|
<DockPanel>
|
||||||
<Button x:Name="buttonCloseWindow" Style="{StaticResource CaptionCloseButtonStyle}"
|
<Button x:Name="buttonCloseWindow" Style="{StaticResource CaptionCloseButtonStyle}"
|
||||||
DockPanel.Dock="Right">
|
DockPanel.Dock="Right">
|
||||||
<fa:ImageAwesome Icon="TimesCircle"
|
<fa:ImageAwesome Icon="TimesCircle"
|
||||||
Foreground="{StaticResource CaptionButtonIconForeground}" />
|
Foreground="{DynamicResource CaptionButtonIconForeground}" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button x:Name="buttonWindowStatus" Style="{StaticResource CaptionButtonStyle}"
|
<Button x:Name="buttonWindowStatus" Style="{StaticResource CaptionButtonStyle}"
|
||||||
Visibility="{Binding ContextObject.CanResize, ElementName=mainWindow, Converter={StaticResource BooleanToVisibilityConverter}}"
|
Visibility="{Binding ContextObject.CanResize, ElementName=mainWindow, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||||
DockPanel.Dock="Right">
|
DockPanel.Dock="Right">
|
||||||
<fa:ImageAwesome Foreground="{StaticResource CaptionButtonIconForeground}">
|
<fa:ImageAwesome Foreground="{DynamicResource CaptionButtonIconForeground}">
|
||||||
<fa:ImageAwesome.Style>
|
<fa:ImageAwesome.Style>
|
||||||
<Style TargetType="{x:Type fa:ImageAwesome}">
|
<Style TargetType="{x:Type fa:ImageAwesome}">
|
||||||
<Setter Property="Icon" Value="WindowMaximize" />
|
<Setter Property="Icon" Value="WindowMaximize" />
|
||||||
@@ -123,10 +121,10 @@
|
|||||||
</Button.Content>
|
</Button.Content>
|
||||||
</Button>
|
</Button>
|
||||||
<Button DockPanel.Dock="Left" x:Name="buttonPin" Style="{StaticResource CaptionButtonStyle}">
|
<Button DockPanel.Dock="Left" x:Name="buttonPin" Style="{StaticResource CaptionButtonStyle}">
|
||||||
<fa:ImageAwesome Icon="ThumbTack" Foreground="{StaticResource CaptionButtonIconForeground}" />
|
<fa:ImageAwesome Icon="ThumbTack" Foreground="{DynamicResource CaptionButtonIconForeground}" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button x:Name="buttonShare" Style="{StaticResource CaptionButtonStyle}" DockPanel.Dock="Left">
|
<Button x:Name="buttonShare" Style="{StaticResource CaptionButtonStyle}" DockPanel.Dock="Left">
|
||||||
<fa:ImageAwesome Icon="ShareAlt" Foreground="{StaticResource CaptionButtonIconForeground}" />
|
<fa:ImageAwesome Icon="ShareAlt" Foreground="{DynamicResource CaptionButtonIconForeground}" />
|
||||||
</Button>
|
</Button>
|
||||||
<Grid x:Name="titleArea" Background="Transparent">
|
<Grid x:Name="titleArea" Background="Transparent">
|
||||||
<TextBlock Text="{Binding ContextObject.Title, ElementName=mainWindow}" FontSize="12"
|
<TextBlock Text="{Binding ContextObject.Title, ElementName=mainWindow}" FontSize="12"
|
||||||
@@ -135,10 +133,11 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
<DockPanel x:Name="containerPanel" Background="#FFF8F8FB" ZIndex="80">
|
<DockPanel x:Name="containerPanel" Background="{DynamicResource MainWindowBackground}" ZIndex="80">
|
||||||
<Grid DockPanel.Dock="Top" Height="{StaticResource MainWindowCaptionHeight}"
|
<Grid DockPanel.Dock="Top" Height="{StaticResource MainWindowCaptionHeight}"
|
||||||
Visibility="{Binding ContextObject.TitlebarOverlap, ElementName=mainWindow, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}" />
|
Visibility="{Binding ContextObject.TitlebarOverlap, ElementName=mainWindow, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}" />
|
||||||
<ContentControl x:Name="container"
|
<ContentControl x:Name="container"
|
||||||
|
Foreground="{DynamicResource CaptionButtonIconForeground}"
|
||||||
Content="{Binding ContextObject.ViewerContent, ElementName=mainWindow}" />
|
Content="{Binding ContextObject.ViewerContent, ElementName=mainWindow}" />
|
||||||
<DockPanel.Style>
|
<DockPanel.Style>
|
||||||
<Style TargetType="{x:Type DockPanel}">
|
<Style TargetType="{x:Type DockPanel}">
|
||||||
@@ -154,7 +153,7 @@
|
|||||||
</DockPanel.Style>
|
</DockPanel.Style>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid x:Name="busyIndicatorLayer" Background="{StaticResource MainWindowBackground}" ZIndex="200">
|
<Grid x:Name="busyIndicatorLayer" Background="{DynamicResource MainWindowBackground}" ZIndex="200">
|
||||||
<Grid.Style>
|
<Grid.Style>
|
||||||
<Style TargetType="{x:Type Grid}">
|
<Style TargetType="{x:Type Grid}">
|
||||||
<Setter Property="Visibility" Value="Collapsed" />
|
<Setter Property="Visibility" Value="Collapsed" />
|
||||||
|
@@ -40,10 +40,15 @@ namespace QuickLook
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class MainWindowTransparent : MainWindowBase, INotifyPropertyChanged
|
public partial class MainWindowTransparent : MainWindowBase, INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
|
private string _path;
|
||||||
private bool _pinned;
|
private bool _pinned;
|
||||||
private bool _restoreForDragMove;
|
private bool _restoreForDragMove;
|
||||||
|
private readonly ResourceDictionary _darkDict = new ResourceDictionary
|
||||||
|
{
|
||||||
|
Source = new Uri("pack://application:,,,/QuickLook;component/Styles/MainWindowStyles.Dark.xaml")
|
||||||
|
};
|
||||||
|
|
||||||
internal MainWindowTransparent()
|
internal MainWindowTransparent()
|
||||||
{
|
{
|
||||||
// this object should be initialized before loading UI components, because many of which are binding to it.
|
// this object should be initialized before loading UI components, because many of which are binding to it.
|
||||||
ContextObject = new ContextObject();
|
ContextObject = new ContextObject();
|
||||||
@@ -93,17 +98,21 @@ namespace QuickLook
|
|||||||
WindowState = WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized;
|
WindowState = WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized;
|
||||||
|
|
||||||
buttonShare.Click +=
|
buttonShare.Click +=
|
||||||
(sender, e) => RunWith("rundll32.exe", $"shell32.dll,OpenAs_RunDLL {Path}");
|
(sender, e) => RunWith("rundll32.exe", $"shell32.dll,OpenAs_RunDLL {_path}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowWindowCaptionContainer(object sender, MouseEventArgs e)
|
private void ShowWindowCaptionContainer(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
if (!ContextObject.TitlebarOverlap)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var show = (Storyboard) windowFrameContainer.FindResource("ShowCaptionStoryboard");
|
var show = (Storyboard) windowFrameContainer.FindResource("ShowCaptionStoryboard");
|
||||||
var showAndHide = (Storyboard) windowFrameContainer.FindResource("ShowAndHideTitlebarStoryboard");
|
var showAndHide = (Storyboard) windowFrameContainer.FindResource("ShowAndHideTitlebarStoryboard");
|
||||||
|
|
||||||
|
if (!ContextObject.TitlebarOverlap)
|
||||||
|
{
|
||||||
|
show.Begin();
|
||||||
|
showAndHide.Stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (windowCaptionContainer.IsMouseOver)
|
if (windowCaptionContainer.IsMouseOver)
|
||||||
show.Begin();
|
show.Begin();
|
||||||
else
|
else
|
||||||
@@ -120,7 +129,6 @@ namespace QuickLook
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Path { get; private set; }
|
|
||||||
public IViewer Plugin { get; private set; }
|
public IViewer Plugin { get; private set; }
|
||||||
|
|
||||||
public ContextObject ContextObject { get; private set; }
|
public ContextObject ContextObject { get; private set; }
|
||||||
@@ -178,7 +186,7 @@ namespace QuickLook
|
|||||||
|
|
||||||
internal void RunWith(string with, string arg)
|
internal void RunWith(string with, string arg)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(Path))
|
if (string.IsNullOrEmpty(_path))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -186,7 +194,7 @@ namespace QuickLook
|
|||||||
Process.Start(new ProcessStartInfo(with)
|
Process.Start(new ProcessStartInfo(with)
|
||||||
{
|
{
|
||||||
Arguments = arg,
|
Arguments = arg,
|
||||||
WorkingDirectory = System.IO.Path.GetDirectoryName(Path)
|
WorkingDirectory = System.IO.Path.GetDirectoryName(_path)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -197,14 +205,14 @@ namespace QuickLook
|
|||||||
|
|
||||||
internal void Run()
|
internal void Run()
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(Path))
|
if (string.IsNullOrEmpty(_path))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Process.Start(new ProcessStartInfo(Path)
|
Process.Start(new ProcessStartInfo(_path)
|
||||||
{
|
{
|
||||||
WorkingDirectory = System.IO.Path.GetDirectoryName(Path)
|
WorkingDirectory = System.IO.Path.GetDirectoryName(_path)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -283,12 +291,12 @@ namespace QuickLook
|
|||||||
}
|
}
|
||||||
Plugin = null;
|
Plugin = null;
|
||||||
|
|
||||||
Path = string.Empty;
|
_path = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void BeginShow(IViewer matchedPlugin, string path, Action<ExceptionDispatchInfo> exceptionHandler)
|
internal void BeginShow(IViewer matchedPlugin, string path, Action<ExceptionDispatchInfo> exceptionHandler)
|
||||||
{
|
{
|
||||||
Path = path;
|
_path = path;
|
||||||
Plugin = matchedPlugin;
|
Plugin = matchedPlugin;
|
||||||
|
|
||||||
ContextObject.ViewerWindow = this;
|
ContextObject.ViewerWindow = this;
|
||||||
@@ -312,6 +320,7 @@ namespace QuickLook
|
|||||||
if (Visibility != Visibility.Visible)
|
if (Visibility != Visibility.Visible)
|
||||||
Show();
|
Show();
|
||||||
|
|
||||||
|
ShowWindowCaptionContainer(null, null);
|
||||||
//WindowHelper.SetActivate(new WindowInteropHelper(this), ContextObject.CanFocus);
|
//WindowHelper.SetActivate(new WindowInteropHelper(this), ContextObject.CanFocus);
|
||||||
|
|
||||||
// load plugin, do not block UI
|
// load plugin, do not block UI
|
||||||
@@ -333,26 +342,26 @@ namespace QuickLook
|
|||||||
{
|
{
|
||||||
buttonOpenWithText.Inlines.Clear();
|
buttonOpenWithText.Inlines.Clear();
|
||||||
|
|
||||||
if (Directory.Exists(Path))
|
if (Directory.Exists(_path))
|
||||||
{
|
{
|
||||||
AddToInlines("MW_BrowseFolder", System.IO.Path.GetFileName(Path));
|
AddToInlines("MW_BrowseFolder", System.IO.Path.GetFileName(_path));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var isExe = FileHelper.IsExecutable(Path, out string appFriendlyName);
|
var isExe = FileHelper.IsExecutable(_path, out string appFriendlyName);
|
||||||
if (isExe)
|
if (isExe)
|
||||||
{
|
{
|
||||||
AddToInlines("MW_Run", appFriendlyName);
|
AddToInlines("MW_Run", appFriendlyName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// not an exe
|
// not an exe
|
||||||
var found = FileHelper.GetAssocApplication(Path, out appFriendlyName);
|
var found = FileHelper.GetAssocApplication(_path, out appFriendlyName);
|
||||||
if (found)
|
if (found)
|
||||||
{
|
{
|
||||||
AddToInlines("MW_OpenWith", appFriendlyName);
|
AddToInlines("MW_OpenWith", appFriendlyName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// assoc not found
|
// assoc not found
|
||||||
AddToInlines("MW_Open", System.IO.Path.GetFileName(Path));
|
AddToInlines("MW_Open", System.IO.Path.GetFileName(_path));
|
||||||
|
|
||||||
void AddToInlines(string str, string replaceWith)
|
void AddToInlines(string str, string replaceWith)
|
||||||
{
|
{
|
||||||
@@ -407,5 +416,19 @@ namespace QuickLook
|
|||||||
{
|
{
|
||||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SwitchTheme(bool dark)
|
||||||
|
{
|
||||||
|
if (dark)
|
||||||
|
{
|
||||||
|
if (!Resources.MergedDictionaries.Contains(_darkDict))
|
||||||
|
Resources.MergedDictionaries.Add(_darkDict);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Resources.MergedDictionaries.Contains(_darkDict))
|
||||||
|
Resources.MergedDictionaries.Remove(_darkDict);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -31,13 +31,13 @@ namespace QuickLook.Plugin
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ContextObject : INotifyPropertyChanged
|
public class ContextObject : INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
private bool _autoHideTitlebar;
|
|
||||||
private bool _canResize = true;
|
private bool _canResize = true;
|
||||||
private bool _fullWindowDragging;
|
private bool _fullWindowDragging;
|
||||||
private bool _isBusy = true;
|
private bool _isBusy = true;
|
||||||
private string _title = "";
|
private string _title = "";
|
||||||
private bool _titlebarOverlap;
|
private bool _titlebarOverlap;
|
||||||
private object _viewerContent;
|
private object _viewerContent;
|
||||||
|
private bool _useDarkTheme;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the viewer window.
|
/// Get the viewer window.
|
||||||
@@ -127,6 +127,21 @@ namespace QuickLook.Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool UseDarkTheme
|
||||||
|
{
|
||||||
|
get { return _useDarkTheme; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_useDarkTheme = value;
|
||||||
|
ApplyViewerWindowTheme();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ApplyViewerWindowTheme()
|
||||||
|
{
|
||||||
|
ViewerWindow?.SwitchTheme(UseDarkTheme);
|
||||||
|
}
|
||||||
|
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -175,14 +190,16 @@ namespace QuickLook.Plugin
|
|||||||
|
|
||||||
internal void Reset()
|
internal void Reset()
|
||||||
{
|
{
|
||||||
ViewerWindow = null;
|
|
||||||
Title = "";
|
Title = "";
|
||||||
ViewerContent = null;
|
|
||||||
IsBusy = true;
|
IsBusy = true;
|
||||||
PreferredSize = new Size();
|
PreferredSize = new Size();
|
||||||
CanResize = true;
|
CanResize = true;
|
||||||
FullWindowDragging = false;
|
FullWindowDragging = false;
|
||||||
TitlebarOverlap = false;
|
TitlebarOverlap = false;
|
||||||
|
UseDarkTheme = false;
|
||||||
|
|
||||||
|
ViewerContent = null;
|
||||||
|
ViewerWindow = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
[NotifyPropertyChangedInvocator]
|
[NotifyPropertyChangedInvocator]
|
||||||
|
@@ -5,7 +5,6 @@
|
|||||||
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"
|
||||||
Background="#FFF8F8FB"
|
|
||||||
mc:Ignorable="d" Width="453" Height="172" UseLayoutRounding="True" TextOptions.TextHintingMode="Animated">
|
mc:Ignorable="d" Width="453" Height="172" UseLayoutRounding="True" TextOptions.TextHintingMode="Animated">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
@@ -50,7 +50,7 @@ namespace QuickLook.Plugin.InfoPanel
|
|||||||
context.ViewerContent = _ip;
|
context.ViewerContent = _ip;
|
||||||
|
|
||||||
_ip.DisplayInfo(path);
|
_ip.DisplayInfo(path);
|
||||||
|
context.UseDarkTheme = true;
|
||||||
context.IsBusy = false;
|
context.IsBusy = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -111,7 +111,6 @@
|
|||||||
<Compile Include="..\GitVersion.cs">
|
<Compile Include="..\GitVersion.cs">
|
||||||
<Link>Properties\GitVersion.cs</Link>
|
<Link>Properties\GitVersion.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Actions\ConditionalEventTrigger.cs" />
|
|
||||||
<Compile Include="Controls\GlassLayer\GaussianBlurEffect.cs" />
|
<Compile Include="Controls\GlassLayer\GaussianBlurEffect.cs" />
|
||||||
<Compile Include="Controls\GlassLayer\GlassLayer.xaml.cs">
|
<Compile Include="Controls\GlassLayer\GlassLayer.xaml.cs">
|
||||||
<DependentUpon>GlassLayer.xaml</DependentUpon>
|
<DependentUpon>GlassLayer.xaml</DependentUpon>
|
||||||
@@ -181,6 +180,10 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Styles\MainWindowStyles.Dark.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="Styles\MainWindowStyles.xaml">
|
<Page Include="Styles\MainWindowStyles.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
15
QuickLook/Styles/MainWindowStyles.Dark.xaml
Normal file
15
QuickLook/Styles/MainWindowStyles.Dark.xaml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<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/">
|
||||||
|
<Color x:Key="MainWindowShadowColor">Gray</Color>
|
||||||
|
<SolidColorBrush x:Key="MainWindowBackground" Color="#FF565656" />
|
||||||
|
<SolidColorBrush x:Key="MainWindowForeground" Color="#E5EFEFEF" />
|
||||||
|
<SolidColorBrush x:Key="CaptionTextHoverBorder" Color="#FFB9B9B9" />
|
||||||
|
<SolidColorBrush x:Key="CaptionButtonIconForeground" Color="#E5EFEFEF" />
|
||||||
|
<SolidColorBrush x:Key="CaptionButtonHoverBackground" Color="#22FFFFFF" />
|
||||||
|
<SolidColorBrush x:Key="CaptionButtonPressBackground" Color="#44FFFFFF" />
|
||||||
|
<SolidColorBrush x:Key="CaptionCloseButtonHoverBackground" Color="#FFE81123" />
|
||||||
|
<SolidColorBrush x:Key="CaptionCloseButtonPressBackground" Color="#FFB5394B" />
|
||||||
|
<SolidColorBrush x:Key="CaptionBackground" Color="#FF3B3B3B" />
|
||||||
|
</ResourceDictionary>
|
@@ -5,13 +5,21 @@
|
|||||||
<system:Double x:Key="MainWindowShadowBlurRadius">6</system:Double>
|
<system:Double x:Key="MainWindowShadowBlurRadius">6</system:Double>
|
||||||
<Thickness x:Key="MainWindowShadowPaddingThinkness">6</Thickness>
|
<Thickness x:Key="MainWindowShadowPaddingThinkness">6</Thickness>
|
||||||
<system:Double x:Key="MainWindowCaptionHeight">32</system:Double>
|
<system:Double x:Key="MainWindowCaptionHeight">32</system:Double>
|
||||||
<SolidColorBrush x:Key="CaptionButtonIconForeground" Color="#E5868686" />
|
<Color x:Key="MainWindowShadowColor">Gray</Color>
|
||||||
<SolidColorBrush x:Key="MainWindowBackground" Color="#FFF8F8FB" />
|
<SolidColorBrush x:Key="MainWindowBackground" Color="#FFF8F8FB" />
|
||||||
|
<SolidColorBrush x:Key="MainWindowForeground" Color="#E50E0E0E" />
|
||||||
|
<SolidColorBrush x:Key="CaptionTextHoverBorder" Color="#FF3D3D3D" />
|
||||||
|
<SolidColorBrush x:Key="CaptionButtonIconForeground" Color="#E5868686" />
|
||||||
|
<SolidColorBrush x:Key="CaptionButtonHoverBackground" Color="#44FFFFFF" />
|
||||||
|
<SolidColorBrush x:Key="CaptionButtonPressBackground" Color="#88FFFFFF" />
|
||||||
|
<SolidColorBrush x:Key="CaptionCloseButtonHoverBackground" Color="#FFE81123" />
|
||||||
|
<SolidColorBrush x:Key="CaptionCloseButtonPressBackground" Color="#FFB5394B" />
|
||||||
|
<SolidColorBrush x:Key="CaptionBackground" Color="#FFDADADA" />
|
||||||
|
|
||||||
<Style x:Key="CaptionButtonBaseStyle" TargetType="Button">
|
<Style x:Key="CaptionButtonBaseStyle" TargetType="Button">
|
||||||
<Setter Property="Focusable" Value="False" />
|
<Setter Property="Focusable" Value="False" />
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
<Setter Property="Cursor" Value="Hand" />
|
||||||
<Setter Property="Foreground" Value="#E50E0E0E" />
|
<Setter Property="Foreground" Value="{DynamicResource MainWindowForeground}" />
|
||||||
<Setter Property="VerticalAlignment" Value="Center" />
|
<Setter Property="VerticalAlignment" Value="Center" />
|
||||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||||
<Setter Property="Background" Value="Transparent" />
|
<Setter Property="Background" Value="Transparent" />
|
||||||
@@ -35,11 +43,11 @@
|
|||||||
</Setter>
|
</Setter>
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
<Trigger Property="IsMouseOver" Value="True">
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
<Setter Property="BorderBrush" Value="#FF3D3D3D" />
|
<Setter Property="BorderBrush" Value="{DynamicResource CaptionTextHoverBorder}" />
|
||||||
<Setter Property="Background" Value="#44FFFFFF" />
|
<Setter Property="Background" Value="{DynamicResource CaptionButtonHoverBackground}" />
|
||||||
</Trigger>
|
</Trigger>
|
||||||
<Trigger Property="IsPressed" Value="True">
|
<Trigger Property="IsPressed" Value="True">
|
||||||
<Setter Property="Background" Value="#88FFFFFF" />
|
<Setter Property="Background" Value="{DynamicResource CaptionButtonPressBackground}" />
|
||||||
</Trigger>
|
</Trigger>
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
@@ -60,10 +68,10 @@
|
|||||||
</Setter>
|
</Setter>
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
<Trigger Property="IsMouseOver" Value="True">
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
<Setter Property="Background" Value="#44FFFFFF" />
|
<Setter Property="Background" Value="{DynamicResource CaptionButtonHoverBackground}" />
|
||||||
</Trigger>
|
</Trigger>
|
||||||
<Trigger Property="IsPressed" Value="True">
|
<Trigger Property="IsPressed" Value="True">
|
||||||
<Setter Property="Background" Value="#88FFFFFF" />
|
<Setter Property="Background" Value="{DynamicResource CaptionButtonPressBackground}" />
|
||||||
</Trigger>
|
</Trigger>
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
@@ -71,10 +79,10 @@
|
|||||||
<Style x:Key="CaptionCloseButtonStyle" TargetType="Button" BasedOn="{StaticResource CaptionButtonStyle}">
|
<Style x:Key="CaptionCloseButtonStyle" TargetType="Button" BasedOn="{StaticResource CaptionButtonStyle}">
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
<Trigger Property="IsMouseOver" Value="True">
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
<Setter Property="Background" Value="#FFE81123" />
|
<Setter Property="Background" Value="{DynamicResource CaptionCloseButtonHoverBackground}" />
|
||||||
</Trigger>
|
</Trigger>
|
||||||
<Trigger Property="IsPressed" Value="True">
|
<Trigger Property="IsPressed" Value="True">
|
||||||
<Setter Property="Background" Value="#FFB5394B" />
|
<Setter Property="Background" Value="{DynamicResource CaptionCloseButtonPressBackground}" />
|
||||||
</Trigger>
|
</Trigger>
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
|
Reference in New Issue
Block a user