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