summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vrhel <michael.vrhel@artifex.com>2015-02-09 12:11:39 -0800
committerMichael Vrhel <michael.vrhel@artifex.com>2015-02-10 10:56:34 -0800
commitd9dc4846ef05ec0adccbdacf9ab49592f0e0b4c8 (patch)
tree2ca0c215b6f4f9f6eb2902fceaf7c78deec5c6fd
parente45282fd963026b6f1a93325466a696927ad09fc (diff)
downloadmupdf-d9dc4846ef05ec0adccbdacf9ab49592f0e0b4c8.tar.xz
Disable options that are not currently possible to do when the source is an image.
Currently if the source was a png, jpeg or cbz file we can't do conversions with ghostscript and also we can't print. So I will disable the controls for now and we can look into adding that functionality later if we want. Disable printing capability for image based formats. Currently printing is all XPS based. If the source document is JPG, PNG or CBZ we don't currently have a method for creating the XPS content for these. We could do a bitmap print or possibly wrap up the images in a XPS file or just do a direct bitmap print via some C# magic. I need to investigate. For the short time, though it is simply disabled.
-rw-r--r--platform/windows/gsview/MainWindow.xaml2
-rw-r--r--platform/windows/gsview/MainWindow.xaml.cs28
2 files changed, 24 insertions, 6 deletions
diff --git a/platform/windows/gsview/MainWindow.xaml b/platform/windows/gsview/MainWindow.xaml
index 10d126bb..37ae3e1e 100644
--- a/platform/windows/gsview/MainWindow.xaml
+++ b/platform/windows/gsview/MainWindow.xaml
@@ -192,7 +192,7 @@
<MenuItem Header="Page Conversions..." Click="ConvertClick" x:Name="xaml_conversions">
</MenuItem>
<Separator />
- <MenuItem Header="Print..." Command="Print" InputGestureText="Ctrl+P" x:Name="xaml_print">
+ <MenuItem Header="Print..." Command="Print" InputGestureText="Ctrl+P" x:Name="xaml_print_menu">
<MenuItem.Icon>
<Image Source="Resources/printer.ico" />
</MenuItem.Icon>
diff --git a/platform/windows/gsview/MainWindow.xaml.cs b/platform/windows/gsview/MainWindow.xaml.cs
index c6979231..d29ef907 100644
--- a/platform/windows/gsview/MainWindow.xaml.cs
+++ b/platform/windows/gsview/MainWindow.xaml.cs
@@ -318,6 +318,7 @@ namespace gsview
String m_origfile;
private gsprint m_ghostprint = null;
bool m_isXPS;
+ bool m_isImage;
gsOutput m_gsoutput;
Convert m_convertwin;
PageExtractSave m_extractwin;
@@ -514,7 +515,7 @@ namespace gsview
xaml_extractselection.IsEnabled = false;
xaml_conversions.IsEnabled = false;
xaml_gsmessage.IsEnabled = false;
- xaml_print.IsEnabled = false;
+ xaml_print_menu.IsEnabled = false;
xaml_view.IsEnabled = false;
xaml_edit.IsEnabled = false;
}
@@ -579,6 +580,7 @@ namespace gsview
m_links_on = false;
m_doczoom = 1.0;
m_isXPS = false;
+ m_isImage = false;
//xaml_CancelThumb.IsEnabled = true;
m_currpage = 0;
m_ignorescrollchange = false;
@@ -833,6 +835,9 @@ namespace gsview
/* Set if this is already xps for printing */
if (extension.ToUpper() == ".XPS" || extension.ToUpper() == ".OXPS")
m_isXPS = true;
+ if (extension.ToUpper() == ".CBZ" || extension.ToUpper() == ".PNG" ||
+ extension.ToUpper() == ".JPG")
+ m_isImage = true;
OpenFile2(FileName);
}
@@ -1019,11 +1024,25 @@ namespace gsview
xaml_extractselection.IsEnabled = true;
xaml_conversions.IsEnabled = true;
xaml_gsmessage.IsEnabled = true;
- xaml_print.IsEnabled = true;
+ xaml_print_menu.IsEnabled = true;
xaml_view.IsEnabled = true;
xaml_edit.IsEnabled = true;
- if (m_isXPS)
+ if (m_isXPS || m_isImage)
DisabletoPDF();
+ if (m_isImage)
+ {
+ xaml_Print.IsEnabled = false;
+ xaml_print_menu.IsEnabled = false;
+ xaml_Print.Opacity = 0.5;
+ xaml_print_menu.Opacity = 0.5;
+ }
+ else
+ {
+ xaml_Print.IsEnabled = true;
+ xaml_print_menu.IsEnabled = true;
+ xaml_Print.Opacity = 1.0;
+ xaml_print_menu.Opacity = 1.0;
+ }
xaml_OpenProgressGrid.Visibility = System.Windows.Visibility.Collapsed;
xaml_VerticalScroll.Visibility = System.Windows.Visibility.Visible;
xaml_VerticalScroll.Value = 0;
@@ -1995,7 +2014,7 @@ namespace gsview
private void ExtractPages(object sender, RoutedEventArgs e)
{
- if (!m_init_done || m_isXPS)
+ if (!m_init_done || m_isXPS || m_isImage)
return;
if (m_extractwin == null || !m_extractwin.IsActive)
@@ -5014,7 +5033,6 @@ namespace gsview
private void PrintDiagPrint(object PrintDiag)
{
-
/* If file is already xps then gs need not do this */
if (!m_isXPS)
{