mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-12-21 02:00:34 +08:00
remove transparent window
This commit is contained in:
@@ -30,7 +30,6 @@ namespace QuickLook.Plugin.ArchiveViewer
|
|||||||
private ArchiveInfoPanel _panel;
|
private ArchiveInfoPanel _panel;
|
||||||
|
|
||||||
public int Priority => 0;
|
public int Priority => 0;
|
||||||
public bool AllowsTransparency => true;
|
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ namespace QuickLook.Plugin.CsvViewer
|
|||||||
private CsvViewerPanel _panel;
|
private CsvViewerPanel _panel;
|
||||||
|
|
||||||
public int Priority => int.MaxValue;
|
public int Priority => int.MaxValue;
|
||||||
public bool AllowsTransparency => true;
|
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ namespace QuickLook.Plugin.HtmlViewer
|
|||||||
private WebpagePanel _panel;
|
private WebpagePanel _panel;
|
||||||
|
|
||||||
public int Priority => int.MaxValue;
|
public int Priority => int.MaxValue;
|
||||||
public bool AllowsTransparency => false;
|
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ namespace QuickLook.Plugin.IPreviewHandlers
|
|||||||
private PreviewPanel _panel;
|
private PreviewPanel _panel;
|
||||||
|
|
||||||
public int Priority => int.MaxValue;
|
public int Priority => int.MaxValue;
|
||||||
public bool AllowsTransparency => false;
|
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ namespace QuickLook.Plugin.ImageViewer
|
|||||||
private ImagePanel _ip;
|
private ImagePanel _ip;
|
||||||
|
|
||||||
public int Priority => int.MaxValue;
|
public int Priority => int.MaxValue;
|
||||||
public bool AllowsTransparency => true;
|
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ namespace QuickLook.Plugin.MailViewer
|
|||||||
private string _tmpDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
|
private string _tmpDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
|
||||||
|
|
||||||
public int Priority => int.MaxValue;
|
public int Priority => int.MaxValue;
|
||||||
public bool AllowsTransparency => false;
|
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ namespace QuickLook.Plugin.MarkdownViewer
|
|||||||
private WebpagePanel _panel;
|
private WebpagePanel _panel;
|
||||||
|
|
||||||
public int Priority => int.MaxValue;
|
public int Priority => int.MaxValue;
|
||||||
public bool AllowsTransparency => false;
|
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ namespace QuickLook.Plugin.PDFViewer
|
|||||||
private PdfViewerControl _pdfControl;
|
private PdfViewerControl _pdfControl;
|
||||||
|
|
||||||
public int Priority => int.MaxValue;
|
public int Priority => int.MaxValue;
|
||||||
public bool AllowsTransparency => true;
|
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ namespace QuickLook.Plugin.TextViewer
|
|||||||
private TextViewerPanel _tvp;
|
private TextViewerPanel _tvp;
|
||||||
|
|
||||||
public int Priority => 0;
|
public int Priority => 0;
|
||||||
public bool AllowsTransparency => true;
|
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ namespace QuickLook.Plugin.VideoViewer
|
|||||||
private FFprobe probe;
|
private FFprobe probe;
|
||||||
|
|
||||||
public int Priority => 0 - 10; // make it lower than TextViewer
|
public int Priority => 0 - 10; // make it lower than TextViewer
|
||||||
public bool AllowsTransparency => false;
|
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ namespace QuickLook.Controls
|
|||||||
public MainWindowBase()
|
public MainWindowBase()
|
||||||
{
|
{
|
||||||
WindowStyle = WindowStyle.None;
|
WindowStyle = WindowStyle.None;
|
||||||
AllowsTransparency = true;
|
|
||||||
|
|
||||||
SourceInitialized += SourceInitializedHandler;
|
SourceInitialized += SourceInitializedHandler;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +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.Windows;
|
|
||||||
|
|
||||||
namespace QuickLook
|
|
||||||
{
|
|
||||||
internal class MainWindowNoTransparent : MainWindowTransparent
|
|
||||||
{
|
|
||||||
public MainWindowNoTransparent()
|
|
||||||
{
|
|
||||||
AllowsTransparency = false;
|
|
||||||
windowFrameContainer.Margin = new Thickness(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,204 +0,0 @@
|
|||||||
<controls:MainWindowBase
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
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:busyDecorator="clr-namespace:QuickLook.Controls.BusyDecorator"
|
|
||||||
xmlns:glassLayer="clr-namespace:QuickLook.Controls.GlassLayer"
|
|
||||||
xmlns:converters="clr-namespace:QuickLook.Converters"
|
|
||||||
xmlns:controls="clr-namespace:QuickLook.Controls"
|
|
||||||
mc:Ignorable="d" x:Class="QuickLook.MainWindowTransparent" x:Name="mainWindow"
|
|
||||||
UseLayoutRounding="True"
|
|
||||||
d:DesignWidth="624" d:DesignHeight="700"
|
|
||||||
MinWidth="400" MinHeight="200"
|
|
||||||
WindowStartupLocation="CenterScreen"
|
|
||||||
Focusable="False" WindowStyle="None"
|
|
||||||
AllowsTransparency="True"
|
|
||||||
Background="Transparent"
|
|
||||||
ShowActivated="False" ShowInTaskbar="False">
|
|
||||||
<controls:MainWindowBase.Resources>
|
|
||||||
<ResourceDictionary>
|
|
||||||
<ResourceDictionary.MergedDictionaries>
|
|
||||||
<ResourceDictionary Source="Styles/MainWindowStyles.xaml" />
|
|
||||||
</ResourceDictionary.MergedDictionaries>
|
|
||||||
<converters:BooleanToResizeModeConverter x:Key="BooleanToResizeModeConverter" />
|
|
||||||
<converters:WindowStateToThicknessConverter x:Key="WindowStateToThicknessConverter" />
|
|
||||||
<converters:BooleanToResizeBorderThicknessConverter x:Key="BooleanToResizeBorderThicknessConverter" />
|
|
||||||
<converters:BooleanToVisibilityCollapsedConverter x:Key="BooleanToVisibilityCollapsedConverter" />
|
|
||||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
|
||||||
</ResourceDictionary>
|
|
||||||
</controls:MainWindowBase.Resources>
|
|
||||||
<controls:MainWindowBase.Style>
|
|
||||||
<Style TargetType="controls:MainWindowBase">
|
|
||||||
<Setter Property="Foreground" Value="{DynamicResource WindowTextForeground}" />
|
|
||||||
<Setter Property="ResizeMode"
|
|
||||||
Value="{Binding ContextObject.CanResize, ElementName=mainWindow, Converter={StaticResource BooleanToResizeModeConverter}}" />
|
|
||||||
<Setter Property="WindowChrome.WindowChrome">
|
|
||||||
<Setter.Value>
|
|
||||||
<WindowChrome CaptionHeight="0" CornerRadius="0"
|
|
||||||
ResizeBorderThickness="{Binding ContextObject.CanResize, Converter={StaticResource BooleanToResizeBorderThicknessConverter}, ElementName=mainWindow}"
|
|
||||||
UseAeroCaptionButtons="False" />
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
<Style.Triggers>
|
|
||||||
<Trigger Property="WindowState" Value="Maximized">
|
|
||||||
<Setter Property="WindowChrome.WindowChrome">
|
|
||||||
<Setter.Value>
|
|
||||||
<WindowChrome CaptionHeight="0" CornerRadius="0" ResizeBorderThickness="0" UseAeroCaptionButtons="False" />
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
</Trigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</controls:MainWindowBase.Style>
|
|
||||||
<Border>
|
|
||||||
<Border.Effect>
|
|
||||||
<DropShadowEffect BlurRadius="{StaticResource MainWindowShadowBlurRadius}" ShadowDepth="0" Opacity="0.6"
|
|
||||||
Color="{DynamicResource MainWindowShadowColor}" />
|
|
||||||
</Border.Effect>
|
|
||||||
<Grid x:Name="windowFrameContainer" Background="{DynamicResource MainWindowBackground}"
|
|
||||||
Margin="{Binding WindowState, ElementName=mainWindow, Converter={StaticResource WindowStateToThicknessConverter}, ConverterParameter={StaticResource MainWindowShadowPaddingThinkness}}">
|
|
||||||
<Grid x:Name="viewerRootContainer" ZIndex="190">
|
|
||||||
<Grid x:Name="windowCaptionContainer" Height="{StaticResource MainWindowCaptionHeight}"
|
|
||||||
VerticalAlignment="Top"
|
|
||||||
ZIndex="100">
|
|
||||||
<Grid.Resources>
|
|
||||||
<Storyboard x:Key="ShowCaptionContainerStoryboard" Completed="AutoHideCaptionContainer">
|
|
||||||
<DoubleAnimation
|
|
||||||
Storyboard.Target="{Binding Source={x:Reference windowCaptionContainer}}"
|
|
||||||
Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.05" />
|
|
||||||
</Storyboard>
|
|
||||||
<Storyboard x:Key="HideCaptionContainerStoryboard">
|
|
||||||
<DoubleAnimationUsingKeyFrames
|
|
||||||
Storyboard.Target="{Binding Source={x:Reference windowCaptionContainer}}"
|
|
||||||
Storyboard.TargetProperty="Opacity">
|
|
||||||
<DoubleAnimationUsingKeyFrames.KeyFrames>
|
|
||||||
<LinearDoubleKeyFrame Value="1" KeyTime="0:0:0" />
|
|
||||||
<LinearDoubleKeyFrame Value="1" KeyTime="0:0:1" />
|
|
||||||
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:1.05" />
|
|
||||||
</DoubleAnimationUsingKeyFrames.KeyFrames>
|
|
||||||
</DoubleAnimationUsingKeyFrames>
|
|
||||||
</Storyboard>
|
|
||||||
</Grid.Resources>
|
|
||||||
<glassLayer:GlassLayer OverlayColor="{DynamicResource CaptionBackground}"
|
|
||||||
BlurredElement="{Binding ElementName=containerPanel}"
|
|
||||||
ColorOverlayVisibility="{Binding ContextObject.TitlebarColourVisibility, ElementName=mainWindow, Converter={StaticResource BooleanToVisibilityConverter}}"
|
|
||||||
GlassVisibility="{Binding ContextObject.TitlebarBlurVisibility, ElementName=mainWindow, Converter={StaticResource BooleanToVisibilityConverter}}"
|
|
||||||
NoiseVisibility="{Binding ContextObject.TitlebarBlurVisibility, ElementName=mainWindow, Converter={StaticResource BooleanToVisibilityConverter}}" />
|
|
||||||
<DockPanel>
|
|
||||||
<Button DockPanel.Dock="Right" x:Name="buttonCloseWindow"
|
|
||||||
Style="{StaticResource CaptionCloseButtonStyle}" Content="" />
|
|
||||||
<Button DockPanel.Dock="Right" x:Name="buttonWindowStatus"
|
|
||||||
Visibility="{Binding ContextObject.CanResize, ElementName=mainWindow, Converter={StaticResource BooleanToVisibilityConverter}}">
|
|
||||||
<Button.Style>
|
|
||||||
<Style TargetType="Button" BasedOn="{StaticResource CaptionButtonStyle}">
|
|
||||||
<Setter Property="Content" Value="" />
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding WindowState, ElementName=mainWindow}"
|
|
||||||
Value="Maximized">
|
|
||||||
<Setter Property="Content" Value="" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Button.Style>
|
|
||||||
</Button>
|
|
||||||
<Button x:Name="buttonOpenWith" DockPanel.Dock="Right"
|
|
||||||
Style="{StaticResource CaptionTextButtonStyle}">
|
|
||||||
<Button.Content>
|
|
||||||
<TextBlock x:Name="buttonOpenWithText" VerticalAlignment="Center">
|
|
||||||
Open with <Bold>AppName</Bold>
|
|
||||||
</TextBlock>
|
|
||||||
</Button.Content>
|
|
||||||
</Button>
|
|
||||||
<Button DockPanel.Dock="Left" x:Name="buttonTop" Tag="Auto">
|
|
||||||
<Button.Resources>
|
|
||||||
<Grid x:Key="ContentTop">
|
|
||||||
<TextBlock></TextBlock>
|
|
||||||
<TextBlock></TextBlock>
|
|
||||||
</Grid>
|
|
||||||
</Button.Resources>
|
|
||||||
<Button.Style>
|
|
||||||
<Style TargetType="Button" BasedOn="{StaticResource CaptionButtonStyle}">
|
|
||||||
<Setter Property="Content" Value="" />
|
|
||||||
<Style.Triggers>
|
|
||||||
<Trigger Property="Tag" Value="Auto">
|
|
||||||
<Setter Property="Content" Value="" />
|
|
||||||
</Trigger>
|
|
||||||
<Trigger Property="Tag" Value="Top">
|
|
||||||
<Setter Property="Content" Value="{StaticResource ContentTop}" />
|
|
||||||
</Trigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Button.Style>
|
|
||||||
</Button>
|
|
||||||
<Button DockPanel.Dock="Left" x:Name="buttonPin" Tag="Auto">
|
|
||||||
<Button.Resources>
|
|
||||||
<Grid x:Key="ContentPin">
|
|
||||||
<TextBlock></TextBlock>
|
|
||||||
<TextBlock></TextBlock>
|
|
||||||
</Grid>
|
|
||||||
</Button.Resources>
|
|
||||||
<Button.Style>
|
|
||||||
<Style TargetType="Button" BasedOn="{StaticResource CaptionButtonStyle}">
|
|
||||||
<Setter Property="Content" Value="" />
|
|
||||||
<Style.Triggers>
|
|
||||||
<Trigger Property="Tag" Value="Auto">
|
|
||||||
<Setter Property="Content" Value="" />
|
|
||||||
</Trigger>
|
|
||||||
<Trigger Property="Tag" Value="Pin">
|
|
||||||
<Setter Property="Content" Value="{StaticResource ContentPin}" />
|
|
||||||
</Trigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Button.Style>
|
|
||||||
</Button>
|
|
||||||
<Button DockPanel.Dock="Left" x:Name="buttonShare" Style="{StaticResource CaptionButtonStyle}"
|
|
||||||
Content="" />
|
|
||||||
<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="{DynamicResource MainWindowBackground}" ZIndex="80">
|
|
||||||
<Grid DockPanel.Dock="Top" Height="{StaticResource MainWindowCaptionHeight}"
|
|
||||||
Visibility="{Binding ContextObject.TitlebarOverlap, ElementName=mainWindow, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}" />
|
|
||||||
<ContentControl x:Name="container"
|
|
||||||
Foreground="{DynamicResource WindowTextForeground}"
|
|
||||||
Content="{Binding ContextObject.ViewerContent, ElementName=mainWindow}" />
|
|
||||||
<DockPanel.Style>
|
|
||||||
<Style TargetType="{x:Type DockPanel}">
|
|
||||||
<Setter Property="Visibility" Value="Visible" />
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger
|
|
||||||
Binding="{Binding ContextObject.IsBusy, ElementName=mainWindow}"
|
|
||||||
Value="True">
|
|
||||||
<Setter Property="Visibility" Value="Hidden" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</DockPanel.Style>
|
|
||||||
</DockPanel>
|
|
||||||
</Grid>
|
|
||||||
<Grid x:Name="busyIndicatorLayer" Background="{DynamicResource MainWindowBackground}" ZIndex="200">
|
|
||||||
<Grid.Style>
|
|
||||||
<Style TargetType="{x:Type Grid}">
|
|
||||||
<Setter Property="Visibility" Value="Collapsed" />
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger
|
|
||||||
Binding="{Binding ContextObject.IsBusy, ElementName=mainWindow}"
|
|
||||||
Value="True">
|
|
||||||
<Setter Property="Visibility" Value="Visible" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Grid.Style>
|
|
||||||
<busyDecorator:BusyDecorator x:Name="busyDecorator"
|
|
||||||
IsBusyIndicatorShowing="True"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
HorizontalAlignment="Center" />
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</Border>
|
|
||||||
</controls:MainWindowBase>
|
|
||||||
@@ -45,7 +45,7 @@ namespace QuickLook.Plugin
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the viewer window.
|
/// Get the viewer window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public MainWindowTransparent ViewerWindow { get; internal set; }
|
public ViewerWindow ViewerWindow { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get or set the title of Viewer window.
|
/// Get or set the title of Viewer window.
|
||||||
|
|||||||
@@ -28,11 +28,6 @@ namespace QuickLook.Plugin
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
int Priority { get; }
|
int Priority { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Set whether the viewer window has blur effect.
|
|
||||||
/// </summary>
|
|
||||||
bool AllowsTransparency { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Do ont-time job when application starts. You may extract nessessary resource here.
|
/// Do ont-time job when application starts. You may extract nessessary resource here.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ namespace QuickLook.Plugin.InfoPanel
|
|||||||
private InfoPanel _ip;
|
private InfoPanel _ip;
|
||||||
|
|
||||||
public int Priority => int.MinValue;
|
public int Priority => int.MinValue;
|
||||||
public bool AllowsTransparency => true;
|
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -136,7 +136,6 @@
|
|||||||
<Compile Include="Helpers\FileHelper.cs" />
|
<Compile Include="Helpers\FileHelper.cs" />
|
||||||
<Compile Include="Helpers\ProcessHelper.cs" />
|
<Compile Include="Helpers\ProcessHelper.cs" />
|
||||||
<Compile Include="Helpers\TranslationHelper.cs" />
|
<Compile Include="Helpers\TranslationHelper.cs" />
|
||||||
<Compile Include="MainWindowNoTransparent.cs" />
|
|
||||||
<Compile Include="PipeServerManager.cs" />
|
<Compile Include="PipeServerManager.cs" />
|
||||||
<Compile Include="PluginManager.cs" />
|
<Compile Include="PluginManager.cs" />
|
||||||
<Compile Include="Plugin\InfoPanel\FileHelper.cs" />
|
<Compile Include="Plugin\InfoPanel\FileHelper.cs" />
|
||||||
@@ -175,7 +174,7 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="MainWindowTransparent.xaml">
|
<Page Include="ViewerWindow.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
@@ -189,8 +188,8 @@
|
|||||||
<Compile Include="NativeMethods\User32.cs" />
|
<Compile Include="NativeMethods\User32.cs" />
|
||||||
<Compile Include="Properties\Annotations.cs" />
|
<Compile Include="Properties\Annotations.cs" />
|
||||||
<Compile Include="GlobalKeyboardHook.cs" />
|
<Compile Include="GlobalKeyboardHook.cs" />
|
||||||
<Compile Include="MainWindowTransparent.xaml.cs">
|
<Compile Include="ViewerWindow.xaml.cs">
|
||||||
<DependentUpon>MainWindowTransparent.xaml</DependentUpon>
|
<DependentUpon>ViewerWindow.xaml</DependentUpon>
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Page Include="Controls\BusyDecorator\BusyDecorator.xaml">
|
<Page Include="Controls\BusyDecorator\BusyDecorator.xaml">
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
<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"
|
||||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||||
<system:Double x:Key="MainWindowShadowBlurRadius">6</system:Double>
|
|
||||||
<Thickness x:Key="MainWindowShadowPaddingThinkness">6</Thickness>
|
|
||||||
<system:Double x:Key="MainWindowCaptionHeight">32</system:Double>
|
<system:Double x:Key="MainWindowCaptionHeight">32</system:Double>
|
||||||
<Color x:Key="MainWindowShadowColor">Gray</Color>
|
<Color x:Key="MainWindowShadowColor">Gray</Color>
|
||||||
<SolidColorBrush x:Key="MainWindowBackground" Color="#FFFAFAFA" />
|
<SolidColorBrush x:Key="MainWindowBackground" Color="#FFFAFAFA" />
|
||||||
|
|||||||
@@ -28,19 +28,13 @@ namespace QuickLook
|
|||||||
internal class ViewWindowManager : IDisposable
|
internal class ViewWindowManager : IDisposable
|
||||||
{
|
{
|
||||||
private static ViewWindowManager _instance;
|
private static ViewWindowManager _instance;
|
||||||
private MainWindowTransparent _currentMainWindow;
|
private ViewerWindow _viewerWindow;
|
||||||
|
|
||||||
private string _invokedPath = string.Empty;
|
private string _invokedPath = string.Empty;
|
||||||
|
|
||||||
private MainWindowNoTransparent _viewWindowNoTransparent;
|
|
||||||
private MainWindowTransparent _viewWindowTransparent;
|
|
||||||
|
|
||||||
internal ViewWindowManager()
|
internal ViewWindowManager()
|
||||||
{
|
{
|
||||||
_viewWindowTransparent = new MainWindowTransparent();
|
_viewerWindow = new ViewerWindow();
|
||||||
_viewWindowNoTransparent = new MainWindowNoTransparent();
|
|
||||||
|
|
||||||
_currentMainWindow = _viewWindowTransparent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
@@ -51,7 +45,7 @@ namespace QuickLook
|
|||||||
|
|
||||||
public void RunAndClosePreview()
|
public void RunAndClosePreview()
|
||||||
{
|
{
|
||||||
if (_currentMainWindow.Visibility != Visibility.Visible)
|
if (_viewerWindow.Visibility != Visibility.Visible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// if the current focus is in Desktop or explorer windows, just close the preview window and leave the task to System.
|
// if the current focus is in Desktop or explorer windows, just close the preview window and leave the task to System.
|
||||||
@@ -59,7 +53,7 @@ namespace QuickLook
|
|||||||
if (focus != NativeMethods.QuickLook.FocusedWindowType.Invalid)
|
if (focus != NativeMethods.QuickLook.FocusedWindowType.Invalid)
|
||||||
{
|
{
|
||||||
StopFocusMonitor();
|
StopFocusMonitor();
|
||||||
_currentMainWindow.BeginHide();
|
_viewerWindow.BeginHide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,21 +62,21 @@ namespace QuickLook
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
StopFocusMonitor();
|
StopFocusMonitor();
|
||||||
_currentMainWindow.RunAndHide();
|
_viewerWindow.RunAndHide();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClosePreview()
|
public void ClosePreview()
|
||||||
{
|
{
|
||||||
if (_currentMainWindow.Visibility != Visibility.Visible)
|
if (_viewerWindow.Visibility != Visibility.Visible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
StopFocusMonitor();
|
StopFocusMonitor();
|
||||||
_currentMainWindow.BeginHide();
|
_viewerWindow.BeginHide();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TogglePreview(string path)
|
public void TogglePreview(string path)
|
||||||
{
|
{
|
||||||
if (_currentMainWindow.Visibility == Visibility.Visible)
|
if (_viewerWindow.Visibility == Visibility.Visible)
|
||||||
ClosePreview();
|
ClosePreview();
|
||||||
else
|
else
|
||||||
InvokePreview(path);
|
InvokePreview(path);
|
||||||
@@ -102,12 +96,7 @@ namespace QuickLook
|
|||||||
{
|
{
|
||||||
StopFocusMonitor();
|
StopFocusMonitor();
|
||||||
|
|
||||||
if (ReferenceEquals(_currentMainWindow, _viewWindowTransparent))
|
_viewerWindow = new ViewerWindow();
|
||||||
_viewWindowTransparent = new MainWindowTransparent();
|
|
||||||
else
|
|
||||||
_viewWindowNoTransparent = new MainWindowNoTransparent();
|
|
||||||
|
|
||||||
_currentMainWindow = _viewWindowTransparent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SwitchPreview(string path)
|
public void SwitchPreview(string path)
|
||||||
@@ -115,7 +104,7 @@ namespace QuickLook
|
|||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_currentMainWindow.Visibility != Visibility.Visible)
|
if (_viewerWindow.Visibility != Visibility.Visible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
InvokePreview(path);
|
InvokePreview(path);
|
||||||
@@ -126,7 +115,7 @@ namespace QuickLook
|
|||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_currentMainWindow.Visibility == Visibility.Visible && path == _invokedPath)
|
if (_viewerWindow.Visibility == Visibility.Visible && path == _invokedPath)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!Directory.Exists(path) && !File.Exists(path))
|
if (!Directory.Exists(path) && !File.Exists(path))
|
||||||
@@ -143,24 +132,16 @@ namespace QuickLook
|
|||||||
|
|
||||||
private void BeginShowNewWindow(string path, IViewer matchedPlugin)
|
private void BeginShowNewWindow(string path, IViewer matchedPlugin)
|
||||||
{
|
{
|
||||||
_currentMainWindow.UnloadPlugin();
|
_viewerWindow.UnloadPlugin();
|
||||||
|
|
||||||
// switch window
|
_viewerWindow.BeginShow(matchedPlugin, path, CurrentPluginFailed);
|
||||||
var oldWindow = _currentMainWindow;
|
|
||||||
_currentMainWindow = matchedPlugin.AllowsTransparency
|
|
||||||
? _viewWindowTransparent
|
|
||||||
: _viewWindowNoTransparent;
|
|
||||||
if (!ReferenceEquals(oldWindow, _currentMainWindow))
|
|
||||||
oldWindow.BeginHide();
|
|
||||||
|
|
||||||
_currentMainWindow.BeginShow(matchedPlugin, path, CurrentPluginFailed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CurrentPluginFailed(string path, ExceptionDispatchInfo e)
|
private void CurrentPluginFailed(string path, ExceptionDispatchInfo e)
|
||||||
{
|
{
|
||||||
var plugin = _currentMainWindow.Plugin.GetType();
|
var plugin = _viewerWindow.Plugin.GetType();
|
||||||
|
|
||||||
_currentMainWindow.BeginHide();
|
_viewerWindow.BeginHide();
|
||||||
|
|
||||||
TrayIconManager.ShowNotification("", $"Failed to preview {Path.GetFileName(path)}", true);
|
TrayIconManager.ShowNotification("", $"Failed to preview {Path.GetFileName(path)}", true);
|
||||||
|
|
||||||
|
|||||||
185
QuickLook/ViewerWindow.xaml
Normal file
185
QuickLook/ViewerWindow.xaml
Normal file
@@ -0,0 +1,185 @@
|
|||||||
|
<controls:MainWindowBase
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
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:busyDecorator="clr-namespace:QuickLook.Controls.BusyDecorator"
|
||||||
|
xmlns:glassLayer="clr-namespace:QuickLook.Controls.GlassLayer"
|
||||||
|
xmlns:converters="clr-namespace:QuickLook.Converters"
|
||||||
|
xmlns:controls="clr-namespace:QuickLook.Controls"
|
||||||
|
mc:Ignorable="d" x:Class="QuickLook.ViewerWindow" x:Name="mainWindow"
|
||||||
|
UseLayoutRounding="True"
|
||||||
|
d:DesignWidth="624" d:DesignHeight="700"
|
||||||
|
MinWidth="400" MinHeight="200"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
Focusable="False" WindowStyle="None"
|
||||||
|
Background="Transparent"
|
||||||
|
ShowActivated="False" ShowInTaskbar="False">
|
||||||
|
<controls:MainWindowBase.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="Styles/MainWindowStyles.xaml" />
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
<converters:BooleanToResizeModeConverter x:Key="BooleanToResizeModeConverter" />
|
||||||
|
<converters:WindowStateToThicknessConverter x:Key="WindowStateToThicknessConverter" />
|
||||||
|
<converters:BooleanToResizeBorderThicknessConverter x:Key="BooleanToResizeBorderThicknessConverter" />
|
||||||
|
<converters:BooleanToVisibilityCollapsedConverter x:Key="BooleanToVisibilityCollapsedConverter" />
|
||||||
|
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||||
|
</ResourceDictionary>
|
||||||
|
</controls:MainWindowBase.Resources>
|
||||||
|
<controls:MainWindowBase.Style>
|
||||||
|
<Style TargetType="controls:MainWindowBase">
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource WindowTextForeground}" />
|
||||||
|
<Setter Property="WindowChrome.WindowChrome">
|
||||||
|
<Setter.Value>
|
||||||
|
<WindowChrome CaptionHeight="0" CornerRadius="0" GlassFrameThickness="0,0,0,1"
|
||||||
|
ResizeBorderThickness="{Binding ContextObject.CanResize, Converter={StaticResource BooleanToResizeBorderThicknessConverter}, ElementName=mainWindow}"
|
||||||
|
UseAeroCaptionButtons="False" />
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</controls:MainWindowBase.Style>
|
||||||
|
<Grid x:Name="windowFrameContainer" Background="{DynamicResource MainWindowBackground}">
|
||||||
|
<Grid x:Name="viewerRootContainer" ZIndex="190">
|
||||||
|
<Grid x:Name="windowCaptionContainer" Height="{StaticResource MainWindowCaptionHeight}"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
ZIndex="100">
|
||||||
|
<Grid.Resources>
|
||||||
|
<Storyboard x:Key="ShowCaptionContainerStoryboard" Completed="AutoHideCaptionContainer">
|
||||||
|
<DoubleAnimation
|
||||||
|
Storyboard.Target="{Binding Source={x:Reference windowCaptionContainer}}"
|
||||||
|
Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.05" />
|
||||||
|
</Storyboard>
|
||||||
|
<Storyboard x:Key="HideCaptionContainerStoryboard">
|
||||||
|
<DoubleAnimationUsingKeyFrames
|
||||||
|
Storyboard.Target="{Binding Source={x:Reference windowCaptionContainer}}"
|
||||||
|
Storyboard.TargetProperty="Opacity">
|
||||||
|
<DoubleAnimationUsingKeyFrames.KeyFrames>
|
||||||
|
<LinearDoubleKeyFrame Value="1" KeyTime="0:0:0" />
|
||||||
|
<LinearDoubleKeyFrame Value="1" KeyTime="0:0:1" />
|
||||||
|
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:1.05" />
|
||||||
|
</DoubleAnimationUsingKeyFrames.KeyFrames>
|
||||||
|
</DoubleAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</Grid.Resources>
|
||||||
|
<glassLayer:GlassLayer OverlayColor="{DynamicResource CaptionBackground}"
|
||||||
|
BlurredElement="{Binding ElementName=containerPanel}"
|
||||||
|
ColorOverlayVisibility="{Binding ContextObject.TitlebarColourVisibility, ElementName=mainWindow, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||||
|
GlassVisibility="{Binding ContextObject.TitlebarBlurVisibility, ElementName=mainWindow, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||||
|
NoiseVisibility="{Binding ContextObject.TitlebarBlurVisibility, ElementName=mainWindow, Converter={StaticResource BooleanToVisibilityConverter}}" />
|
||||||
|
<DockPanel>
|
||||||
|
<Button DockPanel.Dock="Right" x:Name="buttonCloseWindow"
|
||||||
|
Style="{StaticResource CaptionCloseButtonStyle}" Content="" />
|
||||||
|
<Button DockPanel.Dock="Right" x:Name="buttonWindowStatus"
|
||||||
|
Visibility="{Binding ContextObject.CanResize, ElementName=mainWindow, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||||
|
<Button.Style>
|
||||||
|
<Style TargetType="Button" BasedOn="{StaticResource CaptionButtonStyle}">
|
||||||
|
<Setter Property="Content" Value="" />
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding WindowState, ElementName=mainWindow}"
|
||||||
|
Value="Maximized">
|
||||||
|
<Setter Property="Content" Value="" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Button.Style>
|
||||||
|
</Button>
|
||||||
|
<Button x:Name="buttonOpenWith" DockPanel.Dock="Right"
|
||||||
|
Style="{StaticResource CaptionTextButtonStyle}">
|
||||||
|
<Button.Content>
|
||||||
|
<TextBlock x:Name="buttonOpenWithText" VerticalAlignment="Center">
|
||||||
|
Open with <Bold>AppName</Bold>
|
||||||
|
</TextBlock>
|
||||||
|
</Button.Content>
|
||||||
|
</Button>
|
||||||
|
<Button DockPanel.Dock="Left" x:Name="buttonTop" Tag="Auto">
|
||||||
|
<Button.Resources>
|
||||||
|
<Grid x:Key="ContentTop">
|
||||||
|
<TextBlock></TextBlock>
|
||||||
|
<TextBlock></TextBlock>
|
||||||
|
</Grid>
|
||||||
|
</Button.Resources>
|
||||||
|
<Button.Style>
|
||||||
|
<Style TargetType="Button" BasedOn="{StaticResource CaptionButtonStyle}">
|
||||||
|
<Setter Property="Content" Value="" />
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="Tag" Value="Auto">
|
||||||
|
<Setter Property="Content" Value="" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="Tag" Value="Top">
|
||||||
|
<Setter Property="Content" Value="{StaticResource ContentTop}" />
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Button.Style>
|
||||||
|
</Button>
|
||||||
|
<Button DockPanel.Dock="Left" x:Name="buttonPin" Tag="Auto">
|
||||||
|
<Button.Resources>
|
||||||
|
<Grid x:Key="ContentPin">
|
||||||
|
<TextBlock></TextBlock>
|
||||||
|
<TextBlock></TextBlock>
|
||||||
|
</Grid>
|
||||||
|
</Button.Resources>
|
||||||
|
<Button.Style>
|
||||||
|
<Style TargetType="Button" BasedOn="{StaticResource CaptionButtonStyle}">
|
||||||
|
<Setter Property="Content" Value="" />
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="Tag" Value="Auto">
|
||||||
|
<Setter Property="Content" Value="" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="Tag" Value="Pin">
|
||||||
|
<Setter Property="Content" Value="{StaticResource ContentPin}" />
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Button.Style>
|
||||||
|
</Button>
|
||||||
|
<Button DockPanel.Dock="Left" x:Name="buttonShare" Style="{StaticResource CaptionButtonStyle}"
|
||||||
|
Content="" />
|
||||||
|
<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="{DynamicResource MainWindowBackground}" ZIndex="80">
|
||||||
|
<Grid DockPanel.Dock="Top" Height="{StaticResource MainWindowCaptionHeight}"
|
||||||
|
Visibility="{Binding ContextObject.TitlebarOverlap, ElementName=mainWindow, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}" />
|
||||||
|
<ContentControl x:Name="container"
|
||||||
|
Foreground="{DynamicResource WindowTextForeground}"
|
||||||
|
Content="{Binding ContextObject.ViewerContent, ElementName=mainWindow}" />
|
||||||
|
<DockPanel.Style>
|
||||||
|
<Style TargetType="{x:Type DockPanel}">
|
||||||
|
<Setter Property="Visibility" Value="Visible" />
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger
|
||||||
|
Binding="{Binding ContextObject.IsBusy, ElementName=mainWindow}"
|
||||||
|
Value="True">
|
||||||
|
<Setter Property="Visibility" Value="Hidden" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DockPanel.Style>
|
||||||
|
</DockPanel>
|
||||||
|
</Grid>
|
||||||
|
<Grid x:Name="busyIndicatorLayer" Background="{DynamicResource MainWindowBackground}" ZIndex="200">
|
||||||
|
<Grid.Style>
|
||||||
|
<Style TargetType="{x:Type Grid}">
|
||||||
|
<Setter Property="Visibility" Value="Collapsed" />
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger
|
||||||
|
Binding="{Binding ContextObject.IsBusy, ElementName=mainWindow}"
|
||||||
|
Value="True">
|
||||||
|
<Setter Property="Visibility" Value="Visible" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Grid.Style>
|
||||||
|
<busyDecorator:BusyDecorator x:Name="busyDecorator"
|
||||||
|
IsBusyIndicatorShowing="True"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Center" />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</controls:MainWindowBase>
|
||||||
@@ -36,9 +36,9 @@ using QuickLook.Plugin;
|
|||||||
namespace QuickLook
|
namespace QuickLook
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for MainWindowTransparent.xaml
|
/// Interaction logic for ViewerWindow.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class MainWindowTransparent : MainWindowBase, INotifyPropertyChanged
|
public partial class ViewerWindow : MainWindowBase, INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
private readonly ResourceDictionary _darkDict = new ResourceDictionary
|
private readonly ResourceDictionary _darkDict = new ResourceDictionary
|
||||||
{
|
{
|
||||||
@@ -48,7 +48,7 @@ namespace QuickLook
|
|||||||
private bool _pinned;
|
private bool _pinned;
|
||||||
private bool _restoreForDragMove;
|
private bool _restoreForDragMove;
|
||||||
|
|
||||||
internal MainWindowTransparent()
|
internal ViewerWindow()
|
||||||
{
|
{
|
||||||
// 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();
|
||||||
Reference in New Issue
Block a user