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