zathura
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
zathura.h
Go to the documentation of this file.
1 /* See LICENSE file for license and copyright information */
2 
3 #ifndef ZATHURA_H
4 #define ZATHURA_H
5 
6 #include <stdbool.h>
7 #include <girara/types.h>
8 #include <gtk/gtk.h>
9 #include <gtk/gtkx.h>
10 #include "macros.h"
11 #include "types.h"
12 
13 enum {
18  UP,
21  TOP,
64 };
65 
66 /* unspecified page number */
67 enum {
69 };
70 
71 /* cache constants */
72 enum {
75 };
76 
77 /* forward declaration for types from database.h */
78 typedef struct _ZathuraDatabase zathura_database_t;
79 
83 typedef struct zathura_jump_s
84 {
85  unsigned int page;
86  double x;
87  double y;
89 
90 struct zathura_s
91 {
92  struct
93  {
94  girara_session_t* session;
96  struct
97  {
98  girara_statusbar_item_t* buffer;
99  girara_statusbar_item_t* file;
100  girara_statusbar_item_t* page_number;
101  } statusbar;
102 
103  struct
104  {
105  GdkRGBA highlight_color;
109  } colors;
110 
112  GtkWidget *page_widget;
113  GtkWidget *index;
114  } ui;
115 
116  struct
117  {
118  ZathuraRenderer* render_thread;
119  } sync;
120 
121  struct
122  {
123  void* manager;
124  } plugins;
125 
126  struct
127  {
128  gchar* config_dir;
129  gchar* data_dir;
130  } config;
131 
132  struct
133  {
134  bool enabled;
135  gchar* editor;
136  } synctex;
137 
138  struct
139  {
140  GtkPrintSettings* settings;
141  GtkPageSetup* page_setup;
142  } print;
143 
144  struct
145  {
147  girara_list_t* marks;
148  char** arguments;
149  } global;
150 
151  struct
152  {
153  girara_mode_t normal;
154  girara_mode_t fullscreen;
155  girara_mode_t index;
156  girara_mode_t insert;
157  girara_mode_t presentation;
158  } modes;
159 
160  struct
161  {
162  gchar* file;
163  girara_list_t* bookmarks;
164  } bookmarks;
165 
166  struct
167  {
168  girara_list_t* list;
169  girara_list_iterator_t *cur;
170  unsigned int size;
171  unsigned int max_size;
172  } jumplist;
173 
174  struct
175  {
177  } signals;
178 
179  struct
180  {
181  gchar* file;
182  } stdin_support;
183 
184  zathura_document_t* document;
185  GtkWidget** pages;
187  ZathuraDbus* dbus;
192  struct {
193  GFileMonitor* monitor;
194  GFile* file;
195  gchar* file_path;
196  gchar* password;
197  } file_monitor;
198 
202  struct {
203  unsigned int last_jump;
204  unsigned int start;
205  unsigned int end;
206  } bisect;
207 };
208 
214 zathura_t* zathura_create(void);
215 
222 bool zathura_init(zathura_t* zathura);
223 
229 void zathura_free(zathura_t* zathura);
230 
237 void zathura_set_xid(zathura_t* zathura, Window xid);
238 
245 void zathura_set_config_dir(zathura_t* zathura, const char* dir);
246 
253 void zathura_set_data_dir(zathura_t* zathura, const char* dir);
254 
261 void zathura_set_plugin_dir(zathura_t* zathura, const char* dir);
262 
269 void zathura_set_synctex_editor_command(zathura_t* zathura, const char* command);
270 
277 void zathura_set_synctex(zathura_t* zathura, bool value);
278 
285 void zathura_set_argv(zathura_t* zathura, char** argv);
286 
296 bool document_open(zathura_t* zathura, const char* path, const char* password,
297  int page_number);
298 
306 void document_open_idle(zathura_t* zathura, const char* path,
307  const char* password, int page_number,
308  const char* mode);
309 
319 bool document_save(zathura_t* zathura, const char* path, bool overwrite);
320 
328 bool document_close(zathura_t* zathura, bool keep_monitor);
329 
337 bool page_set(zathura_t* zathura, unsigned int page_id);
338 
347 bool position_set(zathura_t* zathura, double position_x, double position_y);
348 
354 void refresh_view(zathura_t* zathura);
355 
361 bool adjust_view(zathura_t* zathura);
362 
371 void page_widget_set_mode(zathura_t* zathura, unsigned int page_padding,
372  unsigned int pages_per_row, unsigned int first_page_column);
373 
380 void statusbar_page_number_update(zathura_t* zathura);
381 
388 bool zathura_jumplist_has_previous(zathura_t* zathura);
389 
396 bool zathura_jumplist_has_next(zathura_t* zathura);
397 
404 zathura_jump_t* zathura_jumplist_current(zathura_t* zathura);
405 
411 void zathura_jumplist_forward(zathura_t* zathura);
412 
418 void zathura_jumplist_backward(zathura_t* zathura);
419 
425 void zathura_jumplist_add(zathura_t* zathura);
426 
432 void zathura_jumplist_trim(zathura_t* zathura);
433 
442 bool zathura_jumplist_load(zathura_t* zathura, const char* file);
443 
444 #endif // ZATHURA_H