summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--platform/winrt/gsview/MainWindow.xaml.cs14
-rw-r--r--platform/winrt/gsview/ghostsharp.cs17
-rw-r--r--platform/winrt/gsview/gsOutput.xaml16
-rw-r--r--platform/winrt/gsview/gsOutput.xaml.cs6
-rw-r--r--platform/winrt/gsview/mudocument.cs5
5 files changed, 55 insertions, 3 deletions
diff --git a/platform/winrt/gsview/MainWindow.xaml.cs b/platform/winrt/gsview/MainWindow.xaml.cs
index 0e5bcfb8..472d031c 100644
--- a/platform/winrt/gsview/MainWindow.xaml.cs
+++ b/platform/winrt/gsview/MainWindow.xaml.cs
@@ -186,6 +186,10 @@ namespace gsview
{
m_init_done = false;
+ /* Collapse this stuff since it is going to be released */
+ xaml_ThumbGrid.Visibility = System.Windows.Visibility.Collapsed;
+ xaml_ContentGrid.Visibility = System.Windows.Visibility.Collapsed;
+
/* Clear out everything */
if (m_docPages != null && m_docPages.Count > 0)
m_docPages.Clear();
@@ -398,6 +402,14 @@ namespace gsview
if (m_password != null && m_password.IsActive)
m_password.Close();
+ /* Check if gs is currently busy. If it is then don't allow a new
+ * file to be opened. They can cancel gs with the cancel button if
+ * they want */
+ if (m_ghostscript.GetStatus() != gsStatus.GS_READY)
+ {
+ ShowMessage(NotifyType_t.MESS_STATUS, "GS busy. Cancel to open new file.");
+ return;
+ }
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "Document Files(*.ps;*.eps;*.pdf;*.xps;*.cbz)|*.ps;*.eps;*.pdf;*.xps;*.cbz|All files (*.*)|*.*";
dlg.FilterIndex = 1;
@@ -784,7 +796,7 @@ namespace gsview
if (asyncInformation.Completed)
{
xaml_DistillProgress.Value = 100;
- xaml_DistillProgress.Visibility = System.Windows.Visibility.Collapsed;
+ xaml_DistillGrid.Visibility = System.Windows.Visibility.Collapsed;
if (asyncInformation.Params.result == GS_Result_t.gsFAILED)
{
switch (asyncInformation.Params.task)
diff --git a/platform/winrt/gsview/ghostsharp.cs b/platform/winrt/gsview/ghostsharp.cs
index 905bf2b9..f945ee1f 100644
--- a/platform/winrt/gsview/ghostsharp.cs
+++ b/platform/winrt/gsview/ghostsharp.cs
@@ -133,7 +133,7 @@ namespace gsview
static class gsConstants
{
public const int E_QUIT = -101;
- public const int GS_READ_BUFFER = 2048;
+ public const int GS_READ_BUFFER = 32768;
}
@@ -409,6 +409,11 @@ namespace gsview
while ((count = fs.Read(Buffer, 0, gsConstants.GS_READ_BUFFER)) > 0)
{
gsapi_run_string_continue(gsInstance, FeedPtr, count, 0, ref exitcode);
+ if (exitcode < 0)
+ {
+ code = exitcode;
+ break;
+ }
total = total + count;
perc = 100.0 * (double) total / (double) len;
worker.ReportProgress((int)perc);
@@ -419,6 +424,8 @@ namespace gsview
}
}
gsapi_run_string_end(gsInstance, 0, ref exitcode);
+ if (code == 0)
+ code = exitcode;
}
/* All the pinned items need to be freed so the GC can do its job */
@@ -498,6 +505,14 @@ namespace gsview
return RunGhostscript(Params);
}
+ public gsStatus GetStatus()
+ {
+ if (m_worker != null && m_worker.IsBusy)
+ return gsStatus.GS_BUSY;
+ else
+ return gsStatus.GS_READY;
+ }
+
private gsStatus RunGhostscript(gsParams_t Params)
{
/* Create background task for rendering the thumbnails. Allow
diff --git a/platform/winrt/gsview/gsOutput.xaml b/platform/winrt/gsview/gsOutput.xaml
index 0be459a4..0c69461c 100644
--- a/platform/winrt/gsview/gsOutput.xaml
+++ b/platform/winrt/gsview/gsOutput.xaml
@@ -8,7 +8,23 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
+ <Button Grid.Row="0" Grid.Column="1" Width="50" Height="20" Click="ClearContents" Background="Transparent" BorderBrush="Transparent" Margin="5,0,15,0">
+ <Button.Template>
+ <ControlTemplate TargetType="{x:Type Button}">
+ <Grid>
+ <Rectangle Height="Auto" RadiusX="5" RadiusY="5">
+ <Rectangle.Fill >
+ <SolidColorBrush Color="LightSlateGray"></SolidColorBrush>
+ </Rectangle.Fill>
+ </Rectangle>
+ <ContentPresenter Content="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+ </Grid>
+ </ControlTemplate>
+ </Button.Template>
+ <TextBlock><Bold>Clear</Bold></TextBlock>
+ </Button>
<Button Grid.Row="0" Grid.Column="2" Width="50" Height="20" Click="HideWindow" Background="Transparent" BorderBrush="Transparent" Margin="5,0,15,0">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
diff --git a/platform/winrt/gsview/gsOutput.xaml.cs b/platform/winrt/gsview/gsOutput.xaml.cs
index 90bb2d55..aeaa727c 100644
--- a/platform/winrt/gsview/gsOutput.xaml.cs
+++ b/platform/winrt/gsview/gsOutput.xaml.cs
@@ -50,5 +50,11 @@ namespace gsview
m_gsIO.gsIOString += newstring.Substring(0, len);
m_gsIO.PageRefresh();
}
+
+ private void ClearContents(object sender, RoutedEventArgs e)
+ {
+ m_gsIO.gsIOString = null;
+ m_gsIO.PageRefresh();
+ }
}
}
diff --git a/platform/winrt/gsview/mudocument.cs b/platform/winrt/gsview/mudocument.cs
index f24defe0..0c1f0a6e 100644
--- a/platform/winrt/gsview/mudocument.cs
+++ b/platform/winrt/gsview/mudocument.cs
@@ -129,7 +129,10 @@ namespace gsview
public void CleanUp()
{
if (mu_object != null)
- mCleanUp(mu_object);
+ {
+ lock(m_lock)
+ mCleanUp(mu_object);
+ }
}
public int GetPageCount()