Fix typo, thanks wwp!
[claws.git] / src / plugins / pdf_viewer / poppler_viewer.h
1 /*
2  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2007 the Claws Mail Team
4  * This file Copyright (C) 2007 Salvatore De Paolis 
5  * <iwkse@claws-mail.org> 
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  */
21 #ifndef POPPLER_VIEWER_H
22 #define POPPLER_VIEWER_H
23
24 #ifdef HAVE_CONFIG_H
25 #  include "config.h"
26 #endif
27
28 //#include <unistd.h>
29 #include <stdio.h>
30 #include <gtk/gtk.h>
31 #include <gdk/gdkx.h>
32 #include <gdk/gdkkeysyms.h>
33 #include <poppler.h>
34 #include <version.h>
35 #include <plugin.h>
36 #include <messageview.h>
37 #include <mimeview.h>
38 #include <alertpanel.h>
39 #include <mimeview.h>
40
41 /*#ifdef USE_PTHREAD
42  *#include <pthread.h>
43  * #endif*/
44
45 #define ZOOM_FACTOR 0.25
46 #define ROTATION 90 
47 #define ALPHA_CHANNEL 60
48 #define SELECTION_COLOR 0xFF00FF
49
50 static gchar *msg = NULL;
51
52 struct _PageResult
53 {
54         GList *results;
55         gint page_num;
56 };
57
58 typedef struct _PageResult PageResult;
59
60 struct _PdfViewer
61 {
62         MimeViewer                      mimeviewer;
63         GtkWidget                       *widgets_table;
64         GtkWidget                       *vbox;
65         GtkWidget                       *hbox;
66         GtkWidget                       *frame_index;
67         GtkWidget                       *pdf_view;
68         GtkWidget                       *scrollwin;
69         GtkWidget                       *scrollwin_index;
70         GtkWidget                       *pdf_view_ebox;
71         GtkWidget                       *icon_type_ebox;
72         GtkWidget                       *icon_type;
73         GdkPixbuf                       *icon_pixbuf;
74         GtkWidget                       *doc_label;
75         GtkWidget                       *cur_page;
76         GtkWidget                       *doc_index_pane;
77         GtkWidget                       *index_list;
78         /* begin GtkButtons */
79         GtkWidget                       *first_page;
80         GtkWidget                       *last_page;
81         GtkWidget                       *prev_page;
82         GtkWidget                       *next_page;
83         GtkWidget                       *zoom_in;
84         GtkWidget                       *zoom_out;
85         GtkWidget                       *zoom_scroll;
86         GtkWidget                       *zoom_fit;
87         GtkWidget                       *zoom_width;
88         GtkWidget                       *rotate_left;
89         GtkWidget                       *rotate_right;
90         GtkWidget                       *doc_info;
91         GtkWidget                       *doc_index;
92         /* end GtkButtons */
93         GtkTable                        *table_doc_info;
94 #if !GTK_CHECK_VERSION(2,12,0)
95         GtkTooltips                     *button_bar_tips;
96 #endif
97         PopplerDocument         *pdf_doc;
98         PopplerPage                     *pdf_page;
99         PopplerIndexIter        *pdf_index;
100         PopplerRectangle        *last_rect;
101         PopplerAction           *link_action;
102         PageResult                      *last_page_result;
103         GtkAdjustment           *pdf_view_vadj;
104         GtkAdjustment           *pdf_view_hadj;
105         GtkTreeModel            *index_model;
106
107         GList                           *link_map;
108         GList                           *page_results;
109         GList                           *text_found; /* GList of PageResults */
110         gchar                           *last_search;
111         gint                             last_match;
112         gint                             num_matches;
113
114         gchar                           *target_filename;
115         gchar                           *filename;
116         gchar                           *fsname;
117         gchar                           *doc_info_text;
118
119         gint                            res_cnt;
120         gint                            rotate;
121         gint                            num_pages;
122         gdouble                         zoom;
123         gdouble                         width;
124         gdouble                         height;
125         gdouble                         last_x;
126         gdouble                         last_y;
127         gint                            last_dir_x;
128         gint                            last_dir_y;
129         gboolean                        pdf_view_scroll;
130         gboolean                        in_link;
131         MimeInfo                        *mimeinfo;
132         MimeInfo                        *to_load;
133         
134 };
135 static gchar *content_types[] =
136         {"application/pdf", 
137          "application/postscript", 
138          NULL};
139 typedef enum {
140         TYPE_UNKNOWN,
141         TYPE_PDF,
142         TYPE_PS
143 } FileType;
144
145 enum {
146         INDEX_NAME,
147         INDEX_PAGE,
148         INDEX_TOP,
149         N_INDEX_COLUMNS
150 };
151
152 typedef struct _PdfViewer PdfViewer;
153
154 #endif /* POPPLER_VIEWER_H */