dark theme for ImageViewer

This commit is contained in:
Paddy Xu
2017-11-04 16:30:56 +02:00
parent 49e9ccd0ca
commit edc073a0ea
7 changed files with 19 additions and 8 deletions

View File

@@ -11,14 +11,14 @@
<Grid>
<Rectangle Visibility="{Binding BackgroundVisibility, ElementName=imagePanel}">
<Rectangle.Fill>
<ImageBrush x:Name="backgroundBrush" ImageSource="Resources/background.png" AlignmentY="Top"
<ImageBrush x:Name="backgroundBrush" ImageSource="Resources/background-b.png" AlignmentY="Top"
Viewport="0,0,32,32"
ViewportUnits="Absolute" Stretch="UniformToFill" TileMode="Tile" />
</Rectangle.Fill>
</Rectangle>
<ScrollViewer x:Name="viewPanel" BorderThickness="0" HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto" Focusable="False" IsManipulationEnabled="True">
<animatedImage:AnimatedImage x:Name="viewPanelImage" Stretch="None"
<animatedImage:AnimatedImage x:Name="viewPanelImage" Stretch="None" Margin="0,32,0,0"
RenderOptions.BitmapScalingMode="{Binding RenderMode, ElementName=imagePanel}"
AnimationUri="{Binding ImageUriSource, ElementName=imagePanel}" />
</ScrollViewer>

View File

@@ -58,15 +58,18 @@ namespace QuickLook.Plugin.ImageViewer
_imageSize = ImageFileHelper.GetImageSize(path) ?? Size.Empty;
if (!_imageSize.IsEmpty)
context.SetPreferredSizeFit(_imageSize, 0.8);
context.SetPreferredSizeFit(_imageSize, 0.6);
else
context.PreferredSize = new Size(1024, 768);
context.PreferredSize = new Size(800, 600);
context.PreferredSize = new Size(context.PreferredSize.Width, context.PreferredSize.Height + 32);
Directory.SetCurrentDirectory(App.AppPath);
context.TitlebarBlurVisibility = false;
context.TitlebarOverlap = false;
context.TitlebarBlurVisibility = true;
context.TitlebarOverlap = true;
context.TitlebarAutoHide = false;
context.UseDarkTheme = true;
}
public void View(string path, ContextObject context)

View File

@@ -112,6 +112,7 @@
<Content Include="dcraw.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Resource Include="Resources\background-b.png" />
<Resource Include="Resources\background.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -27,6 +27,7 @@
VirtualizingPanel.IsVirtualizing="True" Width="150"
SelectedIndex="0"
Focusable="False"
Margin="0,32,0,0"
Background="#00FFFFFF"
ItemsSource="{Binding PageIds, ElementName=thisPdfViewer}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled" BorderThickness="0,0,1,0"

View File

@@ -19,6 +19,7 @@ using System;
using System.IO;
using System.Runtime.ExceptionServices;
using System.Text;
using System.Windows;
using System.Windows.Threading;
namespace QuickLook.Plugin.PDFViewer
@@ -56,7 +57,12 @@ namespace QuickLook.Plugin.PDFViewer
var desiredSize = PdfViewerControl.GetDesiredControlSizeByFirstPage(path);
context.SetPreferredSizeFit(desiredSize, 0.8);
context.SetPreferredSizeFit(desiredSize, 0.6);
context.PreferredSize = new Size(context.PreferredSize.Width, context.PreferredSize.Height + 32);
context.TitlebarBlurVisibility = true;
context.TitlebarOverlap = true;
}
public void View(string path, ContextObject context)

View File

@@ -273,7 +273,7 @@ namespace QuickLook
// otherwise, resize it and place it to the old window center.
var oldCenterX = Left + Width / 2;
var oldCenterY = Visibility == Visibility.Visible ? Top + Height / 2 : screen.Top + screen.Height / 2;
var oldCenterY = Top + Height / 2;
var newLeft = oldCenterX - size.Width / 2;
var newTop = oldCenterY - size.Height / 2;