From ea094f2393d616e57656e7ea540fcae88548d114 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Wed, 24 Feb 2016 23:56:32 +0100 Subject: [PATCH] Split off jumplist function declarations --- zathura/jumplist.c | 2 ++ zathura/jumplist.h | 78 ++++++++++++++++++++++++++++++++++++++++++++ zathura/types.h | 10 ++++++ zathura/zathura.h | 81 ++-------------------------------------------- 4 files changed, 92 insertions(+), 79 deletions(-) create mode 100644 zathura/jumplist.h diff --git a/zathura/jumplist.c b/zathura/jumplist.c index fedfb98..f1bb531 100644 --- a/zathura/jumplist.c +++ b/zathura/jumplist.c @@ -1,3 +1,5 @@ +#include "jumplist.h" + #include "zathura.h" #include "document.h" #include "database.h" diff --git a/zathura/jumplist.h b/zathura/jumplist.h new file mode 100644 index 0000000..2f5a401 --- /dev/null +++ b/zathura/jumplist.h @@ -0,0 +1,78 @@ +#ifndef ZATHURA_JUMPLIST_H +#define ZATHURA_JUMPLIST_H + +#include +#include "types.h" + +typedef struct zathura_jumplist_s +{ + girara_list_t* list; + girara_list_iterator_t *cur; + unsigned int size; + unsigned int max_size; +} zathura_jumplist_t; + +/** + * Checks whether current jump has a previous jump + * + * @param zathura The zathura session + * @return true if current jump has a previous jump + */ +bool zathura_jumplist_has_previous(zathura_t* jumplzathura); + +/** + * Checks whether current jump has a next jump + * + * @param zathura The zathura session + * @return true if current jump has a next jump + */ +bool zathura_jumplist_has_next(zathura_t* zathura); + +/** + * Return current jump in the jumplist + * + * @param zathura The zathura session + * @return current jump + */ +zathura_jump_t* zathura_jumplist_current(zathura_t* zathura); + +/** + * Move forward in the jumplist + * + * @param zathura The zathura session + */ +void zathura_jumplist_forward(zathura_t* zathura); + +/** + * Move backward in the jumplist + * + * @param zathura The zathura session + */ +void zathura_jumplist_backward(zathura_t* zathura); + +/** + * Add current page as a new item to the jumplist after current position + * + * @param zathura The zathura session + */ +void zathura_jumplist_add(zathura_t* zathura); + +/** + * Trim entries from the beginning of the jumplist to maintain it's maximum size constraint. + * + * @param zathura The zathura session + */ +void zathura_jumplist_trim(zathura_t* zathura); + +/** + * Load the jumplist of the specified file + * + * @param zathura The zathura session + * @param file The file whose jumplist is to be loaded + * + * return A linked list of zathura_jump_t structures constituting the jumplist of the specified file, or NULL. + */ +bool zathura_jumplist_load(zathura_t* zathura, const char* file); + + +#endif diff --git a/zathura/types.h b/zathura/types.h index de87eaa..16189ee 100644 --- a/zathura/types.h +++ b/zathura/types.h @@ -213,6 +213,16 @@ typedef struct zathura_form_s zathura_form_type_t type; /**< Type */ } zathura_form_t; +/** + * Jump + */ +typedef struct zathura_jump_s +{ + unsigned int page; + double x; + double y; +} zathura_jump_t; + /** * Create new index element * diff --git a/zathura/zathura.h b/zathura/zathura.h index 904b938..ffb5d80 100644 --- a/zathura/zathura.h +++ b/zathura/zathura.h @@ -11,6 +11,7 @@ #endif #include "macros.h" #include "types.h" +#include "jumplist.h" enum { NEXT, @@ -82,16 +83,6 @@ enum { /* forward declaration for types from database.h */ typedef struct _ZathuraDatabase zathura_database_t; -/** - * Jump - */ -typedef struct zathura_jump_s -{ - unsigned int page; - double x; - double y; -} zathura_jump_t; - struct zathura_s { struct @@ -162,13 +153,7 @@ struct zathura_s girara_list_t* bookmarks; /**< bookmarks */ } bookmarks; - struct - { - girara_list_t* list; - girara_list_iterator_t *cur; - unsigned int size; - unsigned int max_size; - } jumplist; + zathura_jumplist_t jumplist; struct { @@ -415,68 +400,6 @@ void page_widget_set_mode(zathura_t* zathura, unsigned int page_padding, */ void statusbar_page_number_update(zathura_t* zathura); -/** - * Checks whether current jump has a previous jump - * - * @param zathura The zathura session - * @return true if current jump has a previous jump - */ -bool zathura_jumplist_has_previous(zathura_t* zathura); - -/** - * Checks whether current jump has a next jump - * - * @param zathura The zathura session - * @return true if current jump has a next jump - */ -bool zathura_jumplist_has_next(zathura_t* zathura); - -/** - * Return current jump in the jumplist - * - * @param zathura The zathura session - * @return current jump - */ -zathura_jump_t* zathura_jumplist_current(zathura_t* zathura); - -/** - * Move forward in the jumplist - * - * @param zathura The zathura session - */ -void zathura_jumplist_forward(zathura_t* zathura); - -/** - * Move backward in the jumplist - * - * @param zathura The zathura session - */ -void zathura_jumplist_backward(zathura_t* zathura); - -/** - * Add current page as a new item to the jumplist after current position - * - * @param zathura The zathura session - */ -void zathura_jumplist_add(zathura_t* zathura); - -/** - * Trim entries from the beginning of the jumplist to maintain it's maximum size constraint. - * - * @param zathura The zathura session - */ -void zathura_jumplist_trim(zathura_t* zathura); - -/** - * Load the jumplist of the specified file - * - * @param zathura The zathura session - * @param file The file whose jumplist is to be loaded - * - * return A linked list of zathura_jump_t structures constituting the jumplist of the specified file, or NULL. - */ -bool zathura_jumplist_load(zathura_t* zathura, const char* file); - /** * Gets the nicely formatted filename of the loaded document according to settings *