mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-25 19:48:04 +00:00
finish LastResort
This commit is contained in:
@@ -6,12 +6,24 @@ namespace QuickLook.Plugin.PDFViewer
|
||||
{
|
||||
internal static class DpiHelper
|
||||
{
|
||||
public enum DeviceCap
|
||||
{
|
||||
/// <summary>
|
||||
/// Logical pixels inch in X
|
||||
/// </summary>
|
||||
LOGPIXELSX = 88,
|
||||
/// <summary>
|
||||
/// Logical pixels inch in Y
|
||||
/// </summary>
|
||||
LOGPIXELSY = 90
|
||||
}
|
||||
|
||||
public const float DEFAULT_DPI = 96;
|
||||
|
||||
public static Dpi GetCurrentDpi()
|
||||
{
|
||||
Graphics g = Graphics.FromHwnd(IntPtr.Zero);
|
||||
IntPtr desktop = g.GetHdc();
|
||||
var g = Graphics.FromHwnd(IntPtr.Zero);
|
||||
var desktop = g.GetHdc();
|
||||
|
||||
var dpi = new Dpi
|
||||
{
|
||||
@@ -24,18 +36,6 @@ namespace QuickLook.Plugin.PDFViewer
|
||||
|
||||
[DllImport("gdi32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
|
||||
public static extern int GetDeviceCaps(IntPtr hDC, int nIndex);
|
||||
|
||||
public enum DeviceCap
|
||||
{
|
||||
/// <summary>
|
||||
/// Logical pixels inch in X
|
||||
/// </summary>
|
||||
LOGPIXELSX = 88,
|
||||
/// <summary>
|
||||
/// Logical pixels inch in Y
|
||||
/// </summary>
|
||||
LOGPIXELSY = 90
|
||||
}
|
||||
}
|
||||
|
||||
internal class Dpi
|
||||
|
@@ -26,8 +26,8 @@ namespace QuickLook.Plugin.PDFViewer
|
||||
var height = (int) (pageBound.Height * zoomY);
|
||||
|
||||
// sets the matrix as a scaling matrix (zoomX,0,0,zoomY,0,0)
|
||||
ctm.A = (float)zoomX;
|
||||
ctm.D = (float)zoomY;
|
||||
ctm.A = (float) zoomX;
|
||||
ctm.D = (float) zoomY;
|
||||
|
||||
// creates a pixmap the same size as the width and height of the page
|
||||
pix = NativeMethods.NewPixmap(context, NativeMethods.LookupDeviceColorSpace(context, "DeviceRGB"), width,
|
||||
|
@@ -13,7 +13,7 @@
|
||||
<ResourceDictionary>
|
||||
<local:PageIdToImageConverter x:Key="PageIdToImageConverter" />
|
||||
<Style x:Key="ListBoxItemStyleNoFocusedBorder" TargetType="{x:Type ListBoxItem}">
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
@@ -26,13 +26,13 @@
|
||||
ScrollViewer.IsDeferredScrollingEnabled="False"
|
||||
SelectedIndex="0"
|
||||
Focusable="False"
|
||||
Background="#9FFFFFFF"
|
||||
Background="#00FFFFFF"
|
||||
ItemsSource="{Binding PageIds, ElementName=thisPdfViewer}"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled" BorderThickness="0,0,1,0"
|
||||
ItemContainerStyle="{Binding Mode=OneWay, Source={StaticResource ListBoxItemStyleNoFocusedBorder}}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid MaxHeight="150"
|
||||
<Grid MaxHeight="150"
|
||||
MaxWidth="{Binding ViewportWidth, Mode=Default, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ScrollViewer}}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="10" />
|
||||
@@ -61,10 +61,10 @@
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<Grid Grid.Column="1" Background="#DFEFEFEF">
|
||||
<ScrollViewer x:Name="pageViewPanel" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Focusable="False">
|
||||
<Image x:Name="pageViewPanelImage" Stretch="None" RenderOptions.BitmapScalingMode="NearestNeighbor">
|
||||
</Image>
|
||||
<Grid Grid.Column="1" Background="#00EFEFEF">
|
||||
<ScrollViewer x:Name="pageViewPanel" HorizontalScrollBarVisibility="Auto"
|
||||
VerticalScrollBarVisibility="Auto" Focusable="False">
|
||||
<Image x:Name="pageViewPanelImage" Stretch="None" RenderOptions.BitmapScalingMode="NearestNeighbor" />
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
Reference in New Issue
Block a user