zathura.h 2.44 KB
Newer Older
Moritz Lipp's avatar
Moritz Lipp committed
1
2
3
4
5
6
7
8
/* See LICENSE file for license and copyright information */

#ifndef ZATHURA_H
#define ZATHURA_H

#include <stdbool.h>
#include <girara.h>

Moritz Lipp's avatar
Moritz Lipp committed
9
#include "render.h"
10
#include "document.h"
Moritz Lipp's avatar
Moritz Lipp committed
11

Moritz Lipp's avatar
Moritz Lipp committed
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN, BOTTOM, TOP, HIDE, HIGHLIGHT,
  DELETE_LAST_WORD, DELETE_LAST_CHAR, DEFAULT, ERROR, WARNING, NEXT_GROUP,
  PREVIOUS_GROUP, ZOOM_IN, ZOOM_OUT, ZOOM_ORIGINAL, ZOOM_SPECIFIC, FORWARD,
  BACKWARD, ADJUST_BESTFIT, ADJUST_WIDTH, ADJUST_NONE, CONTINUOUS, DELETE_LAST,
  ADD_MARKER, EVAL_MARKER, EXPAND, COLLAPSE, SELECT, GOTO_DEFAULT, GOTO_LABELS,
  GOTO_OFFSET, HALF_UP, HALF_DOWN, FULL_UP, FULL_DOWN, NEXT_CHAR, PREVIOUS_CHAR,
  DELETE_TO_LINE_START, APPEND_FILEPATH };

/* define modes */
#define ALL        (1 << 0)
#define FULLSCREEN (1 << 1)
#define INDEX      (1 << 2)
#define NORMAL     (1 << 3)
#define INSERT     (1 << 4)

Moritz Lipp's avatar
Moritz Lipp committed
27
28
struct
{
Moritz Lipp's avatar
Moritz Lipp committed
29
  struct
Moritz Lipp's avatar
Moritz Lipp committed
30
31
  {
    girara_session_t* session; /**> girara interface session */
Moritz Lipp's avatar
Moritz Lipp committed
32
33
34
35
36
37
38

    struct
    {
      girara_statusbar_item_t* buffer; /**> buffer statusbar entry */
      girara_statusbar_item_t* file; /**> file statusbar entry */
      girara_statusbar_item_t* page_number; /**> page number statusbar entry */
    } statusbar;
Moritz Lipp's avatar
Moritz Lipp committed
39

Moritz Lipp's avatar
Moritz Lipp committed
40
    GtkWidget *page_view; /**> Widget that contains all rendered pages */
41
    GtkWidget *index; /**> Widget to show the index of the document */
Moritz Lipp's avatar
Moritz Lipp committed
42
  } UI;
Moritz Lipp's avatar
Moritz Lipp committed
43

Moritz Lipp's avatar
Moritz Lipp committed
44
45
  struct
  {
Moritz Lipp's avatar
Moritz Lipp committed
46
    render_thread_t* render_thread; /**> The thread responsible for rendering the pages */
Moritz Lipp's avatar
Moritz Lipp committed
47
48
  } Sync;

Moritz Lipp's avatar
Moritz Lipp committed
49
  zathura_document_t* document; /**> The current document */
Moritz Lipp's avatar
Moritz Lipp committed
50
51
52
53
54
55
56
57
58
} Zathura;

/**
 * Initializes zathura
 *
 * @return If no error occured true, otherwise false, is returned.
 */
bool init_zathura();

Moritz Lipp's avatar
Moritz Lipp committed
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/**
 * Opens a file
 *
 * @param path The path to the file
 * @param password The password of the file
 *
 * @return If no error occured true, otherwise false, is returned.
 */
bool document_open(const char* path, const char* password);

/**
 * Closes the current opened document
 *
 * @return If no error occured true, otherwise false, is returned.
 */
bool document_close();

/**
 * Opens the page with the given number
 *
 * @return If no error occured true, otherwise false, is returned.
 */
bool page_set(unsigned int page_id);

83
84
85
86
87
88
89
90
91
/**
 * Builds the box structure to show the rendered pages
 *
 * @param pages_per_row Number of shown pages per row
 */
void page_view_set_mode(unsigned int pages_per_row);

/**
 * Create blank pages
92
93
 *
 * @return false if an error occured, otherwise true
94
 */
95
bool create_blank_pages();
96

Moritz Lipp's avatar
Moritz Lipp committed
97
#endif // ZATHURA_H