]> www.fi.muni.cz Git - evince.git/blob - libview/ev-view-private.h
abef629074cd6b098f99a2f0461338d08470c2e5
[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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, 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-pixbuf-cache.h"
30 #include "ev-page-cache.h"
31 #include "ev-jobs.h"
32 #include "ev-image.h"
33 #include "ev-form-field.h"
34 #include "ev-selection.h"
35 #include "ev-transition-animation.h"
36
37 #define DRAG_HISTORY 10
38
39 /* Information for middle clicking and moving around the doc */
40 typedef struct {
41         gboolean in_drag;
42         GdkPoint start;
43         gdouble hadj;
44         gdouble vadj;
45         guint drag_timeout_id;
46         guint release_timeout_id;
47         GdkPoint buffer[DRAG_HISTORY];
48         GdkPoint momentum;
49 } DragInfo;
50
51 /* Autoscrolling */
52 typedef struct {
53         gboolean autoscrolling;
54         guint last_y;
55         guint start_y;
56         guint timeout_id;       
57 } AutoScrollInfo;
58
59 /* Information for handling selection */
60 typedef struct {
61         gboolean in_drag;
62         GdkPoint start;
63         gboolean in_selection;
64         GList *selections;
65         EvSelectionStyle style;
66 } SelectionInfo;
67
68 /* Information for handling images DND */
69 typedef struct {
70         gboolean in_drag;
71         GdkPoint start;
72         EvImage *image;
73 } ImageDNDInfo;
74
75 /* Annotation popup windows */
76 typedef struct {
77         GtkWidget *window;
78         guint      page;
79
80         /* Current position */
81         gint       x;
82         gint       y;
83
84         /* EvView root position */
85         gint       parent_x;
86         gint       parent_y;
87
88         /* Document coords */
89         gdouble    orig_x;
90         gdouble    orig_y;
91
92         gboolean   visible;
93         gboolean   moved;
94 } EvViewWindowChild;
95
96 typedef enum {
97         SCROLL_TO_KEEP_POSITION,
98         SCROLL_TO_PAGE_POSITION,
99         SCROLL_TO_CENTER,
100         SCROLL_TO_FIND_LOCATION,
101 } PendingScroll;
102
103 typedef enum {
104         EV_VIEW_CURSOR_NORMAL,
105         EV_VIEW_CURSOR_IBEAM,
106         EV_VIEW_CURSOR_LINK,
107         EV_VIEW_CURSOR_WAIT,
108         EV_VIEW_CURSOR_HIDDEN,
109         EV_VIEW_CURSOR_DRAG,
110         EV_VIEW_CURSOR_AUTOSCROLL,
111 } EvViewCursor;
112
113 typedef enum {
114         EV_PRESENTATION_NORMAL,
115         EV_PRESENTATION_BLACK,
116         EV_PRESENTATION_WHITE,
117         EV_PRESENTATION_END
118 } EvPresentationState;
119
120 typedef struct _EvHeightToPageCache {
121         gint rotation;
122         gdouble *height_to_page;
123         gdouble *dual_height_to_page;
124 } EvHeightToPageCache;
125
126 struct _EvView {
127         GtkLayout layout;
128
129         EvDocument *document;
130
131         /* Find */
132         GList **find_pages;
133         gint find_result;
134         gboolean jump_to_find_result;
135         gboolean highlight_find_results;
136         
137         EvPageCache *page_cache;
138         EvPixbufCache *pixbuf_cache;
139         EvHeightToPageCache *height_to_page_cache;
140         EvViewCursor cursor;
141         EvJobRender *current_job;
142
143         /* Scrolling */
144         GtkAdjustment *hadjustment;
145         GtkAdjustment *vadjustment;
146
147         gint scroll_x;
148         gint scroll_y;  
149
150         PendingScroll pending_scroll;
151         gboolean      pending_resize;
152         EvPoint       pending_point;
153
154         /* Current geometry */
155     
156         gint start_page;
157         gint end_page;
158         gint current_page;
159
160         gint rotation;
161         gdouble scale;
162         gint spacing;
163         gdouble dpi;
164         gdouble max_scale;
165         gdouble min_scale;
166
167         gboolean loading;
168         gboolean continuous;
169         gboolean dual_page;
170         gboolean fullscreen;
171         gboolean presentation;
172         EvSizingMode sizing_mode;
173         cairo_surface_t *loading_text;
174
175         /* Presentation */
176         EvPresentationState presentation_state;
177         EvSizingMode sizing_mode_saved;
178         double scale_saved;
179         guint  trans_timeout_id;
180
181         /* Common for button press handling */
182         int pressed_button;
183
184         /* Information for middle clicking and dragging around. */
185         DragInfo drag_info;
186         
187         /* Autoscrolling */
188         AutoScrollInfo scroll_info;
189
190         /* Selection */
191         GdkPoint motion;
192         guint selection_update_id;
193         guint selection_scroll_id;
194
195         EvViewSelectionMode selection_mode;
196         SelectionInfo selection_info;
197
198         /* Copy link address selection */
199         EvLinkAction *link_selected;
200
201         /* Image DND */
202         ImageDNDInfo image_dnd_info;
203
204         /* Goto Popup */
205         GtkWidget *goto_window;
206         GtkWidget *goto_entry;
207
208         EvTransitionAnimation *animation;
209
210         /* Annotations */
211         GList             *window_children;
212         EvViewWindowChild *window_child_focus;
213 };
214
215 struct _EvViewClass {
216         GtkLayoutClass parent_class;
217
218         void    (*binding_activated)      (EvView         *view,
219                                            GtkScrollType   scroll,
220                                            gboolean        horizontal);
221         void    (*zoom_invalid)           (EvView         *view);
222         void    (*handle_link)            (EvView         *view,
223                                            EvLink         *link);
224         void    (*external_link)          (EvView         *view,
225                                            EvLinkAction   *action);
226         void    (*popup_menu)             (EvView         *view,
227                                            EvLink         *link);
228 };
229
230 void _get_page_size_for_scale_and_rotation (EvDocument *document,
231                                             gint        page,
232                                             gdouble     scale,
233                                             gint        rotation,
234                                             gint       *page_width,
235                                             gint       *page_height);
236
237 #endif  /* __EV_VIEW_PRIVATE_H__ */
238