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