Hide meta icon in Pdf viewing

This commit is contained in:
Paddy Xu
2018-01-08 20:35:50 +02:00
parent c791add587
commit 0914b264f4
3 changed files with 34 additions and 23 deletions

View File

@@ -52,7 +52,7 @@
</Border> </Border>
<Button x:Name="buttonMeta" Style="{StaticResource CaptionButtonStyle}" Width="24" Height="24" <Button x:Name="buttonMeta" Style="{StaticResource CaptionButtonStyle}" Width="24" Height="24"
HorizontalAlignment="Right" VerticalAlignment="Top" HorizontalAlignment="Right" VerticalAlignment="Top" Visibility="{Binding ElementName=imagePanel, Path=MetaIconVisibility}"
Margin="0,8,8,0" Content="&#xE946;" /> Margin="0,8,8,0" Content="&#xE946;" />
<TextBlock x:Name="textMeta" IsHitTestVisible="False" Visibility="Collapsed" HorizontalAlignment="Right" <TextBlock x:Name="textMeta" IsHitTestVisible="False" Visibility="Collapsed" HorizontalAlignment="Right"

View File

@@ -48,6 +48,7 @@ namespace QuickLook.Plugin.ImageViewer
private DateTime _lastZoomTime = DateTime.MinValue; private DateTime _lastZoomTime = DateTime.MinValue;
private double _maxZoomFactor = 3d; private double _maxZoomFactor = 3d;
private Meta _meta; private Meta _meta;
private Visibility _metaIconVisibility = Visibility.Visible;
private double _minZoomFactor = 0.1d; private double _minZoomFactor = 0.1d;
private BitmapScalingMode _renderMode = BitmapScalingMode.HighQuality; private BitmapScalingMode _renderMode = BitmapScalingMode.HighQuality;
private bool _showZoomLevelInfo = true; private bool _showZoomLevelInfo = true;
@@ -91,26 +92,6 @@ namespace QuickLook.Plugin.ImageViewer
ShowMeta(); ShowMeta();
} }
private void ShowMeta()
{
textMeta.Inlines.Clear();
Meta.GetSummary().ForEach(m =>
{
if (string.IsNullOrWhiteSpace(m.Key) || string.IsNullOrWhiteSpace(m.Value))
return;
if (m.Key == "File name" || m.Key == "File size" || m.Key == "MIME type" || m.Key == "Exif comment"
|| m.Key == "Thumbnail" || m.Key == "Exif comment")
return;
textMeta.Inlines.Add(new Run(m.Key) {FontWeight = FontWeights.SemiBold});
textMeta.Inlines.Add(": ");
textMeta.Inlines.Add(m.Value);
textMeta.Inlines.Add("\r\n");
});
textMeta.Inlines.Remove(textMeta.Inlines.LastInline);
}
public bool ShowZoomLevelInfo public bool ShowZoomLevelInfo
{ {
get => _showZoomLevelInfo; get => _showZoomLevelInfo;
@@ -142,6 +123,16 @@ namespace QuickLook.Plugin.ImageViewer
} }
} }
public Visibility MetaIconVisibility
{
get => _metaIconVisibility;
set
{
_metaIconVisibility = value;
OnPropertyChanged();
}
}
public Visibility BackgroundVisibility public Visibility BackgroundVisibility
{ {
get => _backgroundVisibility; get => _backgroundVisibility;
@@ -242,6 +233,26 @@ namespace QuickLook.Plugin.ImageViewer
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
private void ShowMeta()
{
textMeta.Inlines.Clear();
Meta.GetSummary().ForEach(m =>
{
if (string.IsNullOrWhiteSpace(m.Key) || string.IsNullOrWhiteSpace(m.Value))
return;
if (m.Key == "File name" || m.Key == "File size" || m.Key == "MIME type" || m.Key == "Exif comment"
|| m.Key == "Thumbnail" || m.Key == "Exif comment")
return;
textMeta.Inlines.Add(new Run(m.Key) {FontWeight = FontWeights.SemiBold});
textMeta.Inlines.Add(": ");
textMeta.Inlines.Add(m.Value);
textMeta.Inlines.Add("\r\n");
});
textMeta.Inlines.Remove(textMeta.Inlines.LastInline);
}
public event EventHandler<int> ImageScrolled; public event EventHandler<int> ImageScrolled;
public event EventHandler DelayedReRender; public event EventHandler DelayedReRender;

View File

@@ -63,7 +63,7 @@
</ListBox> </ListBox>
<Grid Grid.Column="1" Background="#00EFEFEF"> <Grid Grid.Column="1" Background="#00EFEFEF">
<imageViewer:ImagePanel x:Name="pagePanel" RenderMode="NearestNeighbor" ShowZoomLevelInfo="False" <imageViewer:ImagePanel x:Name="pagePanel" RenderMode="NearestNeighbor" ShowZoomLevelInfo="False"
BackgroundVisibility="Collapsed" /> BackgroundVisibility="Collapsed" MetaIconVisibility="Collapsed" />
</Grid> </Grid>
</Grid> </Grid>
</UserControl> </UserControl>