summaryrefslogtreecommitdiff
path: root/platform/winrt
diff options
context:
space:
mode:
authorMichael Vrhel <michael.vrhel@artifex.com>2013-11-22 04:56:55 -0800
committerMichael Vrhel <michael.vrhel@artifex.com>2014-09-09 16:39:28 -0700
commit2027d34834d09f30622e208f5058886eaca58f34 (patch)
tree1c7097d6b9fa0965921d517cd1372816f0fe5f2a /platform/winrt
parent395e23375d34098dd7e9946a22f67bd8772060e5 (diff)
downloadmupdf-2027d34834d09f30622e208f5058886eaca58f34.tar.xz
A bit more work on gsview. Slowly adding parts.
Diffstat (limited to 'platform/winrt')
-rw-r--r--platform/winrt/gsview/MainWindow.xaml.cs177
-rw-r--r--platform/winrt/gsview/gsview.csproj11
2 files changed, 171 insertions, 17 deletions
diff --git a/platform/winrt/gsview/MainWindow.xaml.cs b/platform/winrt/gsview/MainWindow.xaml.cs
index cd552238..ddb54771 100644
--- a/platform/winrt/gsview/MainWindow.xaml.cs
+++ b/platform/winrt/gsview/MainWindow.xaml.cs
@@ -12,6 +12,87 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
+using System.Windows.Forms;
+using mupdfwinrt;
+using System.Threading.Tasks;
+using System.Runtime.InteropServices.WindowsRuntime;
+using System.
+
+
+enum AppBar_t
+{
+ TEXT_SEARCH,
+ STANDARD
+}
+
+enum NotifyType_t
+{
+ MESS_STATUS,
+ MESS_ERROR
+};
+
+enum RenderingStatus_t
+{
+ REN_AVAILABLE,
+ REN_THUMBS,
+ REN_UPDATE_THUMB_CANVAS,
+ REN_PAGE /* Used to ignore value when source based setting */
+};
+
+enum status_t
+{
+ S_ISOK,
+ E_FAILURE,
+ E_OUTOFMEM,
+ E_NEEDPASSWORD
+};
+
+enum view_t
+{
+ VIEW_WEB,
+ VIEW_CONTENT,
+ VIEW_PAGE,
+ VIEW_PASSWORD,
+ VIEW_TEXTSEARCH
+};
+
+public enum Page_Content_t
+{
+ FULL_RESOLUTION = 0,
+ THUMBNAIL,
+ DUMMY,
+ OLD_RESOLUTION,
+ NOTSET
+};
+
+public struct spatial_info_t
+{
+ public Point size;
+ public double scale_factor;
+} ;
+
+/* C# has no defines.... */
+static class Constants
+{
+ public const int LOOK_AHEAD = 2; /* A +/- count on the pages to pre-render */
+ public const int THUMB_PREADD = 10;
+ public const double MIN_SCALE = 0.5;
+ public const double SCALE_THUMB = 0.05;
+ public const int BLANK_WIDTH = 17;
+ public const int BLANK_HEIGHT = 22;
+ public const double KEYBOARD_ZOOM_STEP = 0.25;
+ public const int ZOOM_MAX = 4;
+ public const double ZOOM_MIN = 0.25;
+ public const int KEY_PLUS = 0xbb;
+ public const int KEY_MINUS = 0xbd;
+ public const int ZOOM_IN = 0;
+ public const int ZOOM_OUT = 1;
+ public const double screenScale = 1;
+ public const int HEADER_SIZE = 54;
+ public const int SEARCH_FORWARD = 1;
+ public const int SEARCH_BACKWARD = -1;
+ public const int TEXT_NOT_FOUND = -1;
+}
namespace gsview
{
@@ -20,31 +101,93 @@ namespace gsview
/// </summary>
public partial class MainWindow : Window
{
+ public Pages m_docPages;
+ List<DocPage> m_thumbnails;
+ List<List<RectList>> m_page_link_list;
+ int m_contents_size;
+ int m_content_item;
+ List<bool> m_linkset;
+ List<RectList> m_text_list;
+ private int m_rectlist_page;
+ private List<ContentEntry> m_content_list;
+ mudocument mu_doc;
+ private bool m_file_open;
+ private int m_currpage;
+ private int m_searchpage;
+ private int m_num_pages;
+ private int m_slider_min;
+ private int m_slider_max;
+ private bool m_init_done;
+ private bool m_flip_from_searchlink;
+ private bool m_links_on;
+ private int m_search_rect_count;
+ private bool m_page_update;
+ WriteableBitmap m_BlankBmp;
+ String m_textcolor;
+ String m_linkcolor;
+ RenderingStatus_t m_ren_status;
+ private bool m_insearch; /* Used for UI display */
+ private bool m_search_active; /* Used to avoid multiple UI clicks */
+ private bool m_sliderchange;
+ private double m_Progress;
+ int m_width;
+ int m_height;
+ private bool m_handlingzoom;
+ private double m_panX;
+ private double m_panY;
+ private bool m_have_thumbs;
+
public MainWindow()
{
InitializeComponent();
+ m_file_open = false;
}
+ private void CloseDoc()
+ {
+
+
+
+ }
private void OpenFile(object sender, RoutedEventArgs e)
{
+ OpenFileDialog dlg = new OpenFileDialog();
+ dlg.Filter = "Xps Documents (*.xps)|*.xps";
+ dlg.FilterIndex = 1;
+ if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+ {
+ if (m_file_open)
+ {
+ CloseDoc();
+ }
+ try
+ {
+
+
+ }
+ catch (UnauthorizedAccessException)
+ {
+ System.Windows.MessageBox.Show(
+ String.Format("Unable to access {0}", dlg.FileName));
+ return;
+ }
+ }
+ }
+
+ private async void OpenDocument(String filename)
+ {
+ /* Open document and when open, push on */
+ int result = await mu_doc.OpenFileAsync(file, extension);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ /* Check if we need password */
+ if (mu_doc.RequiresPassword())
+ {
+ //SetView(view_t.VIEW_PASSWORD);
+ return;
+ }
+ else
+ InitialRender();
}
@@ -53,5 +196,7 @@ namespace gsview
+
+
}
}
diff --git a/platform/winrt/gsview/gsview.csproj b/platform/winrt/gsview/gsview.csproj
index fc7f9a25..9dc00a35 100644
--- a/platform/winrt/gsview/gsview.csproj
+++ b/platform/winrt/gsview/gsview.csproj
@@ -37,6 +37,7 @@
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
+ <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
@@ -54,6 +55,9 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
+ <Compile Include="ContentEntry.cs" />
+ <Compile Include="DocPage.cs" />
+ <Compile Include="RectList.cs" />
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -94,7 +98,12 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
- <ItemGroup />
+ <ItemGroup>
+ <ProjectReference Include="..\mupdfwinrt\mupdfwinrt.vcxproj">
+ <Project>{9e6ab41d-09a7-45a6-a53b-1e4bf3ac5b33}</Project>
+ <Name>mupdfwinrt</Name>
+ </ProjectReference>
+ </ItemGroup>
<ItemGroup>
<Resource Include="Resources\Close.ico" />
<Resource Include="Resources\info.png" />