]> www.fi.muni.cz Git - evince.git/blob - libview/ev-view-private.h
[dualscreen] fix crash on ctrl+w and fix control window closing
[evince.git] / libview / ev-view-private.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */
2 /* this file is part of evince, a gnome document viewer
3  *
4  *  Copyright (C) 2004 Red Hat, Inc
5  *
6  * Evince is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * Evince is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20
21 #if !defined (EVINCE_COMPILATION)
22 #error "This is a private header."
23 #endif
24
25 #ifndef __EV_VIEW_PRIVATE_H__
26 #define __EV_VIEW_PRIVATE_H__
27
28 #include "ev-view.h"
29 #include "ev-document-model.h"
30 #include "ev-pixbuf-cache.h"
31 #include "ev-page-cache.h"
32 #include "ev-jobs.h"
33 #include "ev-image.h"
34 #include "ev-form-field.h"
35 #include "ev-selection.h"
36 #include "ev-view-cursor.h"
37
38 #define DRAG_HISTORY 10
39
40 /* Information for middle clicking and moving around the doc */
41 typedef struct {
42         gboolean in_drag;
43         GdkPoint start;
44         gdouble hadj;
45         gdouble vadj;
46         guint drag_timeout_id;
47         guint release_timeout_id;
48         GdkPoint buffer[DRAG_HISTORY];
49         GdkPoint momentum;
50 } DragInfo;
51
52 /* Autoscrolling */
53 typedef struct {
54         gboolean autoscrolling;
55         guint last_y;
56         guint start_y;
57         guint timeout_id;       
58 } AutoScrollInfo;
59
60 /* Information for handling selection */
61 typedef struct {
62         gboolean in_drag;
63         GdkPoint start;
64         gboolean in_selection;
65         GList *selections;
66         EvSelectionStyle style;
67 } SelectionInfo;
68
69 /* Information for handling images DND */
70 typedef struct {
71         gboolean in_drag;
72         GdkPoint start;
73         EvImage *image;
74 } ImageDNDInfo;
75
76 /* Annotation popup windows */
77 typedef struct {
78         GtkWidget *window;
79         guint      page;
80
81         /* Current position */
82         gint       x;
83         gint       y;
84
85         /* EvView root position */
86         gint       parent_x;
87         gint       parent_y;
88
89         /* Document coords */
90         gdouble    orig_x;
91         gdouble    orig_y;
92
93         gboolean   visible;
94         gboolean   moved;
95 } EvViewWindowChild;
96
97 typedef enum {
98         SCROLL_TO_KEEP_POSITION,
99         SCROLL_TO_PAGE_POSITION,
100         SCROLL_TO_CENTER,
101         SCROLL_TO_FIND_LOCATION,
102 } PendingScroll;
103
104 typedef struct _EvHeightToPageCache {
105         gint rotation;
106         gdouble *height_to_page;
107         gdouble *dual_height_to_page;
108 } EvHeightToPageCache;
109
110 struct _EvView {
111         GtkLayout layout;
112
113         /* Container */
114         GList *children;
115
116         EvDocument *document;
117
118         /* Find */
119         GList **find_pages;
120         gint find_result;
121         gboolean jump_to_find_result;
122         gboolean highlight_find_results;
123
124         EvDocumentModel *model;
125         EvPixbufCache *pixbuf_cache;
126         gsize pixbuf_cache_size;
127         EvPageCache *page_cache;
128         EvHeightToPageCache *height_to_page_cache;
129         EvViewCursor cursor;
130         EvJobRender *current_job;
131
132         GtkRequisition requisition;
133         gboolean       internal_size_request;
134
135         /* Scrolling */
136         GtkAdjustment *hadjustment;
137         GtkAdjustment *vadjustment;
138         /* GtkScrollablePolicy needs to be checked when
139          * driving the scrollable adjustment values */
140         guint hscroll_policy : 1;
141         guint vscroll_policy : 1;
142
143         gint scroll_x;
144         gint scroll_y;  
145
146         PendingScroll pending_scroll;
147         gboolean      pending_resize;
148         EvPoint       pending_point;
149
150         /* Current geometry */
151     
152         gint start_page;
153         gint end_page;
154         gint current_page;
155
156         gint rotation;
157         gdouble scale;
158         gint spacing;
159
160         gboolean loading;
161         gboolean continuous;
162         gboolean dual_page;
163         gboolean fullscreen;
164         EvSizingMode sizing_mode;
165         GtkWidget *loading_window;
166         guint loading_timeout;
167
168         /* Common for button press handling */
169         int pressed_button;
170
171         /* Information for middle clicking and dragging around. */
172         DragInfo drag_info;
173         
174         /* Autoscrolling */
175         AutoScrollInfo scroll_info;
176
177         /* Selection */
178         GdkPoint motion;
179         guint selection_update_id;
180         guint selection_scroll_id;
181
182         EvViewSelectionMode selection_mode;
183         SelectionInfo selection_info;
184
185         /* Copy link address selection */
186         EvLinkAction *link_selected;
187
188         /* Image DND */
189         ImageDNDInfo image_dnd_info;
190
191         /* Annotations */
192         GList             *window_children;
193         EvViewWindowChild *window_child_focus;
194         EvMapping         *focus_annotation;
195         gboolean           adding_annot;
196         EvAnnotationType   adding_annot_type;
197
198         /* Synctex */
199         EvMapping *synctex_result;
200
201         /* Accessibility */
202         gboolean a11y_enabled;
203 };
204
205 struct _EvViewClass {
206         GtkLayoutClass parent_class;
207
208         void    (*binding_activated)      (EvView         *view,
209                                            GtkScrollType   scroll,
210                                            gboolean        horizontal);
211         void    (*handle_link)            (EvView         *view,
212                                            EvLink         *link);
213         void    (*external_link)          (EvView         *view,
214                                            EvLinkAction   *action);
215         void    (*popup_menu)             (EvView         *view,
216                                            GList          *items);
217         void    (*selection_changed)      (EvView         *view);
218         void    (*sync_source)            (EvView         *view,
219                                            EvSourceLink   *link);
220         void    (*annot_added)            (EvView         *view,
221                                            EvAnnotation   *annot);
222         void    (*layers_changed)         (EvView         *view);
223 };
224
225 void _get_page_size_for_scale_and_rotation (EvDocument *document,
226                                             gint        page,
227                                             gdouble     scale,
228                                             gint        rotation,
229                                             gint       *page_width,
230                                             gint       *page_height);
231
232 #endif  /* __EV_VIEW_PRIVATE_H__ */
233