]> www.fi.muni.cz Git - evince.git/blob - shell/ev-view-private.h
Rework the jobs system in order to make it simpler and more extensible. It
[evince.git] / shell / 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 #ifndef __EV_VIEW_PRIVATE_H__
22 #define __EV_VIEW_PRIVATE_H__
23
24 #include "ev-view.h"
25 #include "ev-pixbuf-cache.h"
26 #include "ev-page-cache.h"
27 #include "ev-jobs.h"
28 #include "ev-image.h"
29 #include "ev-form-field.h"
30 #include "ev-selection.h"
31 #include "ev-transition-animation.h"
32
33 #define DRAG_HISTORY 10
34
35 /* Information for middle clicking and moving around the doc */
36 typedef struct {
37         gboolean in_drag;
38         GdkPoint start;
39         gdouble hadj;
40         gdouble vadj;
41         guint drag_timeout_id;
42         guint release_timeout_id;
43         GdkPoint buffer[DRAG_HISTORY];
44         GdkPoint momentum;
45 } DragInfo;
46
47 /* Autoscrolling */
48 typedef struct {
49         gboolean autoscrolling;
50         guint last_y;
51         guint start_y;
52         guint timeout_id;       
53 } AutoScrollInfo;
54
55 /* Information for handling selection */
56 typedef struct {
57         gboolean in_drag;
58         GdkPoint start;
59         gboolean in_selection;
60         GList *selections;
61         EvSelectionStyle style;
62 } SelectionInfo;
63
64 /* Information for handling images DND */
65 typedef struct {
66         gboolean in_drag;
67         GdkPoint start;
68         EvImage *image;
69 } ImageDNDInfo;
70
71 typedef enum {
72         SCROLL_TO_KEEP_POSITION,
73         SCROLL_TO_PAGE_POSITION,
74         SCROLL_TO_CENTER,
75         SCROLL_TO_FIND_LOCATION,
76 } PendingScroll;
77
78 typedef enum {
79         EV_VIEW_CURSOR_NORMAL,
80         EV_VIEW_CURSOR_IBEAM,
81         EV_VIEW_CURSOR_LINK,
82         EV_VIEW_CURSOR_WAIT,
83         EV_VIEW_CURSOR_HIDDEN,
84         EV_VIEW_CURSOR_DRAG,
85         EV_VIEW_CURSOR_AUTOSCROLL,
86 } EvViewCursor;
87
88 typedef enum {
89         EV_PRESENTATION_NORMAL,
90         EV_PRESENTATION_BLACK,
91         EV_PRESENTATION_WHITE,
92         EV_PRESENTATION_END
93 } EvPresentationState;
94
95 struct _EvView {
96         GtkLayout layout;
97
98         EvDocument *document;
99
100         char *find_status;
101         int find_result;
102         gboolean jump_to_find_result;
103         gboolean highlight_find_results;
104         
105         EvPageCache *page_cache;
106         EvPixbufCache *pixbuf_cache;
107         EvViewCursor cursor;
108         EvJobRender *current_job;
109
110         /* Scrolling */
111         GtkAdjustment *hadjustment;
112         GtkAdjustment *vadjustment;
113
114         gint scroll_x;
115         gint scroll_y;  
116
117         PendingScroll pending_scroll;
118         gboolean      pending_resize;
119         EvPoint       pending_point;
120
121         /* Current geometry */
122     
123         gint start_page;
124         gint end_page;
125         gint current_page;
126
127         gint rotation;
128         gdouble scale;
129         gint spacing;
130         gdouble dpi;
131         gdouble max_scale;
132         gdouble min_scale;
133
134         gboolean loading;
135         gboolean continuous;
136         gboolean dual_page;
137         gboolean fullscreen;
138         gboolean presentation;
139         EvSizingMode sizing_mode;
140         cairo_surface_t *loading_text;
141
142         /* Presentation */
143         EvPresentationState presentation_state;
144         EvSizingMode sizing_mode_saved;
145         double scale_saved;
146         guint  trans_timeout_id;
147
148         /* Common for button press handling */
149         int pressed_button;
150
151         /* Information for middle clicking and dragging around. */
152         DragInfo drag_info;
153         
154         /* Autoscrolling */
155         AutoScrollInfo scroll_info;
156
157         /* Selection */
158         GdkPoint motion;
159         guint selection_update_id;
160         guint selection_scroll_id;
161
162         EvViewSelectionMode selection_mode;
163         SelectionInfo selection_info;
164
165         /* Copy link address selection */
166         EvLinkAction *link_selected;
167
168         /* Image DND */
169         ImageDNDInfo image_dnd_info;
170
171 #if !GTK_CHECK_VERSION (2, 11, 7)
172         /* Links */
173         GtkWidget *link_tooltip;
174         EvLink *hovered_link;
175 #endif
176
177         /* Goto Popup */
178         GtkWidget *goto_window;
179         GtkWidget *goto_entry;
180
181         EvTransitionAnimation *animation;
182 };
183
184 struct _EvViewClass {
185         GtkLayoutClass parent_class;
186
187         void    (*binding_activated)      (EvView         *view,
188                                            EvScrollType   scroll,
189                                            gboolean        horizontal);
190         void    (*zoom_invalid)           (EvView         *view);
191         void    (*handle_link)            (EvView         *view,
192                                            EvLink         *link);
193         void    (*external_link)          (EvView         *view,
194                                            EvLinkAction   *action);
195         void    (*popup_menu)             (EvView         *view,
196                                            EvLink         *link);
197 };
198
199 #endif  /* __EV_VIEW_PRIVATE_H__ */
200