1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
//
// MainPage.xaml.h
// Declaration of the MainPage class.
//
#pragma once
#include "MainPage.g.h"
#include "fitz.h"
#include "fitz-internal.h"
#include "muxps.h"
#include "mupdf.h"
#include "ppl.h"
using namespace Platform;
using namespace Concurrency;
using namespace Windows::Storage;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Media::Imaging;
using namespace Windows::Storage::Streams;
using namespace Windows::Foundation;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Media;
using namespace Windows::UI::Xaml::Input;
typedef struct SearchResult_s
{
int box_count;
int page_num;
} SearchResult_t;
typedef struct RectSize_s
{
float width;
float height;
} RectSize;
namespace winapp
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public ref class MainPage sealed
{
public:
MainPage();
protected:
virtual void OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e) override;
/* added */
private:
bool m_file_open;
int m_currpage;
int m_searchpage;
int m_num_pages;
int m_slider_min;
int m_slider_max;
bool m_init_done;
bool m_first_time;
bool m_flip_from_search;
Point m_display_size;
cancellation_token_source m_searchcts;
long long m_memory_use;
double m_curr_zoom;
Point m_zoom_size;
fz_document *m_doc;
Point m_touchpoint;
Point m_canvas_translate;
Windows::UI::Input::ManipulationDelta m_changes;
ImageBrush^ m_renderedImage;
ImageBrush^ m_blankPage;
FlipView^ m_flipView;
Canvas^ m_renderedCanvas;
Canvas^ m_ZoomCanvas;
ImageBrush^ m_zoomedImage;
SolidColorBrush^ m_color_brush;
bool m_zoom_mode;
bool m_zoom_handled;
bool m_insearch;
void Picker(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void Searcher(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void OpenDocument(StorageFile^ file);
void RenderPage(fz_document *doc, fz_page *page, int *width, int *height, double scale);
void RenderRange(int curr_page, int *height, int *width);
void AddPage(int page_num);
void ReplacePage(int page_num);
void AddBlankPage(int page_num);
void CreateBlank(int width, int height);
void HandleFileNotFoundException(Platform::COMException^ e);
void NotifyUserFileNotExist();
void SetupZoomCanvas();
RectSize currPageSize(int page);
void Prepare_bmp(int width, int height, DataWriter ^dw);
void PixToMemStream(fz_pixmap *pix, DataWriter ^dw, Platform::Array<unsigned char> ^arr);
void Slider_ValueChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::Primitives::RangeBaseValueChangedEventArgs^ e);
void FlipView_SelectionChanged(Object^ sender, SelectionChangedEventArgs^ e);
void FlipView_Double(Object^ sender, DoubleTappedRoutedEventArgs^ e);
void Canvas_ManipulationDelta(Object^ sender, ManipulationDeltaRoutedEventArgs^ e);
void Canvas_ManipulationStarted(Object^ sender, ManipulationStartedRoutedEventArgs^ e);
void Canvas_ManipulationStarting(Object^ sender, ManipulationStartingRoutedEventArgs^ e);
void Canvas_Double(Object^ sender, DoubleTappedRoutedEventArgs^ e);
void SearchNext(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void SearchPrev(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void ResetSearch(void);
void CancelSearch(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void SearchInDirection(int dir, String^ textToFind);
void ShowSearchResults(SearchResult_t result);
};
}
|