2010-11-10 19:18:01 +01:00
|
|
|
/* See LICENSE file for license and copyright information */
|
|
|
|
|
|
|
|
#ifndef ZATHURA_H
|
|
|
|
#define ZATHURA_H
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
2011-10-23 17:01:15 +02:00
|
|
|
#include <girara/types.h>
|
|
|
|
#include <gtk/gtk.h>
|
2012-03-16 15:56:37 +01:00
|
|
|
#include "macros.h"
|
2012-04-03 18:39:00 +02:00
|
|
|
#include "types.h"
|
2011-09-21 00:46:03 +02:00
|
|
|
|
2010-11-13 10:05:28 +01:00
|
|
|
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,
|
2012-04-21 04:59:58 +02:00
|
|
|
BACKWARD, CONTINUOUS, DELETE_LAST, EXPAND, EXPAND_ALL, COLLAPSE_ALL, COLLAPSE,
|
|
|
|
SELECT, GOTO_DEFAULT, GOTO_LABELS, GOTO_OFFSET, HALF_UP, HALF_DOWN, FULL_UP,
|
|
|
|
FULL_DOWN, HALF_LEFT, HALF_RIGHT, FULL_LEFT, FULL_RIGHT, NEXT_CHAR,
|
|
|
|
PREVIOUS_CHAR, DELETE_TO_LINE_START, APPEND_FILEPATH, ROTATE_CW, ROTATE_CCW };
|
2010-11-13 10:05:28 +01:00
|
|
|
|
2011-09-02 20:46:16 +02:00
|
|
|
/* forward declaration for types form database.h */
|
2012-03-04 15:56:54 +01:00
|
|
|
typedef struct _ZathuraDatabase zathura_database_t;
|
2011-09-02 20:46:16 +02:00
|
|
|
|
2011-04-18 18:19:41 +02:00
|
|
|
/* forward declaration for types from render.h */
|
|
|
|
struct render_thread_s;
|
|
|
|
typedef struct render_thread_s render_thread_t;
|
|
|
|
|
2012-04-03 18:39:00 +02:00
|
|
|
struct zathura_s
|
2010-11-10 19:18:01 +01:00
|
|
|
{
|
2010-12-12 22:04:42 +01:00
|
|
|
struct
|
2010-11-10 19:18:01 +01:00
|
|
|
{
|
2012-01-22 21:57:18 +01:00
|
|
|
girara_session_t* session; /**< girara interface session */
|
2010-11-18 21:22:43 +01:00
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
2012-01-22 21:57:18 +01:00
|
|
|
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 */
|
2010-11-18 21:22:43 +01:00
|
|
|
} statusbar;
|
2010-12-26 01:52:17 +01:00
|
|
|
|
2011-04-30 13:27:27 +02:00
|
|
|
struct
|
|
|
|
{
|
2012-01-22 21:57:18 +01:00
|
|
|
GdkColor recolor_dark_color; /**< Dark color for recoloring */
|
|
|
|
GdkColor recolor_light_color; /**< Light color for recoloring */
|
|
|
|
GdkColor highlight_color; /**< Color for highlighting */
|
2012-02-14 14:46:19 +01:00
|
|
|
GdkColor highlight_color_active; /** Color for highlighting */
|
2011-04-30 13:27:27 +02:00
|
|
|
} colors;
|
|
|
|
|
2012-02-07 18:30:46 +01:00
|
|
|
GtkWidget *page_widget_alignment;
|
|
|
|
GtkWidget *page_widget; /**< Widget that contains all rendered pages */
|
2012-01-22 21:57:18 +01:00
|
|
|
GtkWidget *index; /**< Widget to show the index of the document */
|
2011-04-18 17:27:49 +02:00
|
|
|
} ui;
|
2010-12-12 22:04:42 +01:00
|
|
|
|
2011-01-24 12:43:39 +01:00
|
|
|
struct
|
|
|
|
{
|
2012-01-22 21:57:18 +01:00
|
|
|
render_thread_t* render_thread; /**< The thread responsible for rendering the pages */
|
2011-04-18 17:27:49 +02:00
|
|
|
} sync;
|
2011-01-24 12:43:39 +01:00
|
|
|
|
2011-04-18 18:19:41 +02:00
|
|
|
struct
|
|
|
|
{
|
2012-04-01 18:32:16 +02:00
|
|
|
void* manager; /**< Plugin manager */
|
2011-04-18 18:19:41 +02:00
|
|
|
} plugins;
|
|
|
|
|
2011-04-19 00:36:56 +02:00
|
|
|
struct
|
|
|
|
{
|
2012-01-22 21:57:18 +01:00
|
|
|
gchar* config_dir; /**< Path to the configuration directory */
|
|
|
|
gchar* data_dir; /**< Path to the data directory */
|
2011-04-19 00:36:56 +02:00
|
|
|
} config;
|
|
|
|
|
2011-04-29 00:28:19 +02:00
|
|
|
struct
|
|
|
|
{
|
2012-01-22 21:57:18 +01:00
|
|
|
GtkPrintSettings* settings; /**< Print settings */
|
|
|
|
GtkPageSetup* page_setup; /**< Saved page setup */
|
2011-04-29 00:28:19 +02:00
|
|
|
} print;
|
|
|
|
|
2011-04-19 19:24:03 +02:00
|
|
|
struct
|
|
|
|
{
|
2012-01-22 21:57:18 +01:00
|
|
|
bool recolor; /**< Recoloring mode switch */
|
2012-02-21 20:39:42 +01:00
|
|
|
bool update_page_number; /**< Update current page number */
|
2012-04-21 04:59:58 +02:00
|
|
|
girara_list_t* marks; /**< Marker */
|
2011-04-19 19:24:03 +02:00
|
|
|
} global;
|
|
|
|
|
2011-09-21 09:22:12 +02:00
|
|
|
struct
|
|
|
|
{
|
2012-01-22 21:57:18 +01:00
|
|
|
girara_mode_t normal; /**< Normal mode */
|
|
|
|
girara_mode_t fullscreen; /**< Fullscreen mode */
|
|
|
|
girara_mode_t index; /**< Index mode */
|
|
|
|
girara_mode_t insert; /**< Insert mode */
|
2011-09-21 09:22:12 +02:00
|
|
|
} modes;
|
2011-05-07 22:00:52 +02:00
|
|
|
|
2011-09-01 15:43:34 +02:00
|
|
|
struct
|
|
|
|
{
|
2012-01-22 21:57:18 +01:00
|
|
|
gchar* file; /**< bookmarks file */
|
|
|
|
girara_list_t* bookmarks; /**< bookmarks */
|
2011-09-01 15:43:34 +02:00
|
|
|
} bookmarks;
|
|
|
|
|
2011-10-21 15:00:57 +02:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
gchar* file;
|
|
|
|
} stdin_support;
|
|
|
|
|
2012-01-22 21:57:18 +01:00
|
|
|
zathura_document_t* document; /**< The current document */
|
2012-04-03 09:02:45 +02:00
|
|
|
GtkWidget** pages; /**< The page widgets */
|
2012-01-22 21:57:18 +01:00
|
|
|
zathura_database_t* database; /**< The database */
|
2012-02-20 20:07:24 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* File monitor
|
|
|
|
*/
|
|
|
|
struct {
|
|
|
|
GFileMonitor* monitor; /**< File monitor */
|
|
|
|
GFile* file; /**< File for file monitor */
|
|
|
|
gchar* file_path; /**< Save file path */
|
|
|
|
gchar* password; /**< Save password */
|
|
|
|
} file_monitor;
|
2012-04-03 18:39:00 +02:00
|
|
|
};
|
2010-11-10 19:18:01 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes zathura
|
|
|
|
*
|
2011-04-18 17:27:49 +02:00
|
|
|
* @param argc Number of arguments
|
|
|
|
* @param argv Values of arguments
|
2011-04-27 19:57:49 +02:00
|
|
|
* @return zathura session object or NULL if zathura could not been initialized
|
2011-04-18 17:27:49 +02:00
|
|
|
*/
|
|
|
|
zathura_t* zathura_init(int argc, char* argv[]);
|
|
|
|
|
|
|
|
/**
|
2011-04-27 19:57:49 +02:00
|
|
|
* Free zathura session
|
2011-04-18 17:27:49 +02:00
|
|
|
*
|
2011-04-27 19:57:49 +02:00
|
|
|
* @param zathura The zathura session
|
2010-11-10 19:18:01 +01:00
|
|
|
*/
|
2011-04-18 17:27:49 +02:00
|
|
|
void zathura_free(zathura_t* zathura);
|
2010-11-10 19:18:01 +01:00
|
|
|
|
2010-12-12 22:04:42 +01:00
|
|
|
/**
|
|
|
|
* Opens a file
|
|
|
|
*
|
2011-04-27 19:57:49 +02:00
|
|
|
* @param zathura The zathura session
|
2010-12-12 22:04:42 +01:00
|
|
|
* @param path The path to the file
|
|
|
|
* @param password The password of the file
|
|
|
|
*
|
|
|
|
* @return If no error occured true, otherwise false, is returned.
|
|
|
|
*/
|
2011-04-18 17:27:49 +02:00
|
|
|
bool document_open(zathura_t* zathura, const char* path, const char* password);
|
2010-12-12 22:04:42 +01:00
|
|
|
|
2011-09-01 11:51:49 +02:00
|
|
|
/**
|
|
|
|
* Save a open file
|
|
|
|
*
|
|
|
|
* @param zathura The zathura session
|
|
|
|
* @param path The path
|
|
|
|
* @param overwrite Overwrite existing file
|
|
|
|
*
|
|
|
|
* @return If no error occured true, otherwise false, is returned.
|
|
|
|
*/
|
|
|
|
bool document_save(zathura_t* zathura, const char* path, bool overwrite);
|
|
|
|
|
2010-12-12 22:04:42 +01:00
|
|
|
/**
|
|
|
|
* Closes the current opened document
|
|
|
|
*
|
2011-04-27 19:57:49 +02:00
|
|
|
* @param zathura The zathura session
|
2012-02-20 20:07:24 +01:00
|
|
|
* @param keep_monitor Set to true if monitor should be kept (sc_reload)
|
2010-12-12 22:04:42 +01:00
|
|
|
* @return If no error occured true, otherwise false, is returned.
|
|
|
|
*/
|
2012-02-20 20:07:24 +01:00
|
|
|
bool document_close(zathura_t* zathura, bool keep_monitor);
|
2010-12-12 22:04:42 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Opens the page with the given number
|
|
|
|
*
|
2011-04-27 19:57:49 +02:00
|
|
|
* @param zathura The zathura session
|
2012-02-08 15:30:13 +01:00
|
|
|
* @param page_id The id of the page that should be set
|
2010-12-12 22:04:42 +01:00
|
|
|
* @return If no error occured true, otherwise false, is returned.
|
|
|
|
*/
|
2011-04-18 17:27:49 +02:00
|
|
|
bool page_set(zathura_t* zathura, unsigned int page_id);
|
2010-12-12 22:04:42 +01:00
|
|
|
|
2011-10-06 17:48:17 +02:00
|
|
|
/**
|
|
|
|
* Opens the page with the given number (delayed)
|
|
|
|
*
|
|
|
|
* @param zathura The zathura session
|
2012-02-08 15:30:13 +01:00
|
|
|
* @param page_id The id of the page that should be set
|
2011-10-06 17:48:17 +02:00
|
|
|
* @return If no error occured true, otherwise false, is returned.
|
|
|
|
*/
|
|
|
|
bool page_set_delayed(zathura_t* zathura, unsigned int page_id);
|
|
|
|
|
2012-04-21 04:59:58 +02:00
|
|
|
/**
|
|
|
|
* Moves to the given position
|
|
|
|
*
|
|
|
|
* @param zathura Zathura session
|
|
|
|
* @param position_x X coordinate
|
|
|
|
* @param position_y Y coordinate
|
|
|
|
* @return If no error occured true, otherwise false, is returned.
|
|
|
|
*/
|
|
|
|
bool position_set_delayed(zathura_t* zathura, double position_x, double position_y);
|
|
|
|
|
2011-03-18 18:40:20 +01:00
|
|
|
/**
|
|
|
|
* Builds the box structure to show the rendered pages
|
|
|
|
*
|
2011-04-27 19:57:49 +02:00
|
|
|
* @param zathura The zathura session
|
2011-03-18 18:40:20 +01:00
|
|
|
* @param pages_per_row Number of shown pages per row
|
|
|
|
*/
|
2012-02-07 18:30:46 +01:00
|
|
|
void page_widget_set_mode(zathura_t* zathura, unsigned int pages_per_row);
|
2011-03-18 18:40:20 +01:00
|
|
|
|
2011-04-27 19:57:49 +02:00
|
|
|
/**
|
|
|
|
* Updates the page number in the statusbar. Note that 1 will be added to the
|
|
|
|
* displayed number
|
|
|
|
*
|
|
|
|
* @param zathura The zathura session
|
|
|
|
*/
|
|
|
|
void statusbar_page_number_update(zathura_t* zathura);
|
|
|
|
|
2010-11-10 19:18:01 +01:00
|
|
|
#endif // ZATHURA_H
|