mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-28 22:16:00 +01:00
Pass document/page data to plugin functions
This commit is contained in:
parent
2f4076ccca
commit
61d7a6a436
3 changed files with 31 additions and 29 deletions
12
document.c
12
document.c
|
@ -223,7 +223,7 @@ zathura_document_free(zathura_document_t* document)
|
|||
girara_error("%s not implemented", __FUNCTION__);
|
||||
error = ZATHURA_ERROR_NOT_IMPLEMENTED;
|
||||
} else {
|
||||
error = document->plugin->functions.document_free(document);
|
||||
error = document->plugin->functions.document_free(document, document->data);
|
||||
}
|
||||
|
||||
if (document->file_path != NULL) {
|
||||
|
@ -249,7 +249,7 @@ zathura_document_save_as(zathura_document_t* document, const char* path)
|
|||
return ZATHURA_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
return document->plugin->functions.document_save_as(document, path);
|
||||
return document->plugin->functions.document_save_as(document, document->data, path);
|
||||
}
|
||||
|
||||
girara_tree_node_t*
|
||||
|
@ -272,7 +272,7 @@ zathura_document_index_generate(zathura_document_t* document, zathura_error_t* e
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return document->plugin->functions.document_index_generate(document, error);
|
||||
return document->plugin->functions.document_index_generate(document, document->data, error);
|
||||
}
|
||||
|
||||
girara_list_t*
|
||||
|
@ -295,7 +295,7 @@ zathura_document_attachments_get(zathura_document_t* document, zathura_error_t*
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return document->plugin->functions.document_attachments_get(document, error);
|
||||
return document->plugin->functions.document_attachments_get(document, document->data, error);
|
||||
}
|
||||
|
||||
zathura_error_t
|
||||
|
@ -312,7 +312,7 @@ zathura_document_attachment_save(zathura_document_t* document, const char* attac
|
|||
return ZATHURA_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
return document->plugin->functions.document_attachment_save(document, attachment, file);
|
||||
return document->plugin->functions.document_attachment_save(document, document->data, attachment, file);
|
||||
}
|
||||
|
||||
char*
|
||||
|
@ -334,7 +334,7 @@ zathura_document_meta_get(zathura_document_t* document, zathura_document_meta_t
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return document->plugin->functions.document_meta_get(document, meta, error);
|
||||
return document->plugin->functions.document_meta_get(document, document->data, meta, error);
|
||||
}
|
||||
|
||||
static const gchar*
|
||||
|
|
16
page.c
16
page.c
|
@ -103,7 +103,7 @@ zathura_page_free(zathura_page_t* page)
|
|||
return ZATHURA_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
zathura_error_t error = page->document->plugin->functions.page_clear(page);
|
||||
zathura_error_t error = page->document->plugin->functions.page_clear(page, page->data);
|
||||
|
||||
g_free(page);
|
||||
|
||||
|
@ -240,7 +240,7 @@ zathura_page_search_text(zathura_page_t* page, const char* text, zathura_error_t
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return page->document->plugin->functions.page_search_text(page, text, error);
|
||||
return page->document->plugin->functions.page_search_text(page, page->data, text, error);
|
||||
}
|
||||
|
||||
girara_list_t*
|
||||
|
@ -263,7 +263,7 @@ zathura_page_links_get(zathura_page_t* page, zathura_error_t* error)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return page->document->plugin->functions.page_links_get(page, error);
|
||||
return page->document->plugin->functions.page_links_get(page, page->data, error);
|
||||
}
|
||||
|
||||
zathura_error_t
|
||||
|
@ -292,7 +292,7 @@ zathura_page_form_fields_get(zathura_page_t* page, zathura_error_t* error)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return page->document->plugin->functions.page_form_fields_get(page, error);
|
||||
return page->document->plugin->functions.page_form_fields_get(page, page->data, error);
|
||||
}
|
||||
|
||||
zathura_error_t
|
||||
|
@ -321,7 +321,7 @@ zathura_page_images_get(zathura_page_t* page, zathura_error_t* error)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return page->document->plugin->functions.page_images_get(page, error);
|
||||
return page->document->plugin->functions.page_images_get(page, page->data, error);
|
||||
}
|
||||
|
||||
cairo_surface_t*
|
||||
|
@ -345,7 +345,7 @@ zathura_page_image_get_cairo(zathura_page_t* page, zathura_image_t* image, zathu
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return page->document->plugin->functions.page_image_get_cairo(page, image, error);
|
||||
return page->document->plugin->functions.page_image_get_cairo(page, page->data, image, error);
|
||||
}
|
||||
|
||||
char* zathura_page_get_text(zathura_page_t* page, zathura_rectangle_t rectangle, zathura_error_t* error)
|
||||
|
@ -368,7 +368,7 @@ char* zathura_page_get_text(zathura_page_t* page, zathura_rectangle_t rectangle,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return page->document->plugin->functions.page_get_text(page, rectangle, error);
|
||||
return page->document->plugin->functions.page_get_text(page, page->data, rectangle, error);
|
||||
}
|
||||
|
||||
zathura_error_t
|
||||
|
@ -386,5 +386,5 @@ zathura_page_render(zathura_page_t* page, cairo_t* cairo, bool printing)
|
|||
return ZATHURA_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
return page->document->plugin->functions.page_render_cairo(page, cairo, printing);
|
||||
return page->document->plugin->functions.page_render_cairo(page, page->data, cairo, printing);
|
||||
}
|
||||
|
|
32
plugin-api.h
32
plugin-api.h
|
@ -8,6 +8,8 @@
|
|||
#include "version.h"
|
||||
|
||||
typedef struct zathura_document_functions_s zathura_document_functions_t;
|
||||
typedef struct zathura_document_data_s zathura_document_data_t;
|
||||
typedef struct zathura_page_data_s zathura_page_data_t;
|
||||
|
||||
/**
|
||||
* Functions register function
|
||||
|
@ -71,32 +73,32 @@ struct zathura_document_functions_s
|
|||
/**
|
||||
* Frees the document
|
||||
*/
|
||||
zathura_error_t (*document_free)(zathura_document_t* document);
|
||||
zathura_error_t (*document_free)(zathura_document_t* document, zathura_document_data_t* data);
|
||||
|
||||
/**
|
||||
* Generates the document index
|
||||
*/
|
||||
girara_tree_node_t* (*document_index_generate)(zathura_document_t* document, zathura_error_t* error);
|
||||
girara_tree_node_t* (*document_index_generate)(zathura_document_t* document, zathura_document_data_t* data, zathura_error_t* error);
|
||||
|
||||
/**
|
||||
* Save the document
|
||||
*/
|
||||
zathura_error_t (*document_save_as)(zathura_document_t* document, const char* path);
|
||||
zathura_error_t (*document_save_as)(zathura_document_t* document, zathura_document_data_t* data, const char* path);
|
||||
|
||||
/**
|
||||
* Get list of attachments
|
||||
*/
|
||||
girara_list_t* (*document_attachments_get)(zathura_document_t* document, zathura_error_t* error);
|
||||
girara_list_t* (*document_attachments_get)(zathura_document_t* document, zathura_document_data_t* data, zathura_error_t* error);
|
||||
|
||||
/**
|
||||
* Save attachment to a file
|
||||
*/
|
||||
zathura_error_t (*document_attachment_save)(zathura_document_t* document, const char* attachment, const char* file);
|
||||
zathura_error_t (*document_attachment_save)(zathura_document_t* document, zathura_document_data_t* data, const char* attachment, const char* file);
|
||||
|
||||
/**
|
||||
* Get document information
|
||||
*/
|
||||
char* (*document_meta_get)(zathura_document_t* document, zathura_document_meta_t info, zathura_error_t* error);
|
||||
char* (*document_meta_get)(zathura_document_t* document, zathura_document_data_t* data, zathura_document_meta_t info, zathura_error_t* error);
|
||||
|
||||
/**
|
||||
* Gets the page object
|
||||
|
@ -106,47 +108,47 @@ struct zathura_document_functions_s
|
|||
/**
|
||||
* Free page
|
||||
*/
|
||||
zathura_error_t (*page_clear)(zathura_page_t* page);
|
||||
zathura_error_t (*page_clear)(zathura_page_t* page, zathura_page_data_t* data);
|
||||
|
||||
/**
|
||||
* Search text
|
||||
*/
|
||||
girara_list_t* (*page_search_text)(zathura_page_t* page, const char* text, zathura_error_t* error);
|
||||
girara_list_t* (*page_search_text)(zathura_page_t* page, zathura_page_data_t* data, const char* text, zathura_error_t* error);
|
||||
|
||||
/**
|
||||
* Get links on a page
|
||||
*/
|
||||
girara_list_t* (*page_links_get)(zathura_page_t* page, zathura_error_t* error);
|
||||
girara_list_t* (*page_links_get)(zathura_page_t* page, zathura_page_data_t* data, zathura_error_t* error);
|
||||
|
||||
/**
|
||||
* Get form fields
|
||||
*/
|
||||
girara_list_t* (*page_form_fields_get)(zathura_page_t* page, zathura_error_t* error);
|
||||
girara_list_t* (*page_form_fields_get)(zathura_page_t* page, zathura_page_data_t* data, zathura_error_t* error);
|
||||
|
||||
/**
|
||||
* Get list of images
|
||||
*/
|
||||
girara_list_t* (*page_images_get)(zathura_page_t* page, zathura_error_t* error);
|
||||
girara_list_t* (*page_images_get)(zathura_page_t* page, zathura_page_data_t* data, zathura_error_t* error);
|
||||
|
||||
/**
|
||||
* Get the image
|
||||
*/
|
||||
cairo_surface_t* (*page_image_get_cairo)(zathura_page_t* page, zathura_image_t* image, zathura_error_t* error);
|
||||
cairo_surface_t* (*page_image_get_cairo)(zathura_page_t* page, zathura_page_data_t* data, zathura_image_t* image, zathura_error_t* error);
|
||||
|
||||
/**
|
||||
* Get text for selection
|
||||
*/
|
||||
char* (*page_get_text)(zathura_page_t* page, zathura_rectangle_t rectangle, zathura_error_t* error);
|
||||
char* (*page_get_text)(zathura_page_t* page, zathura_page_data_t* data, zathura_rectangle_t rectangle, zathura_error_t* error);
|
||||
|
||||
/**
|
||||
* Renders the page
|
||||
*/
|
||||
zathura_image_buffer_t* (*page_render)(zathura_page_t* page, zathura_error_t* error);
|
||||
zathura_image_buffer_t* (*page_render)(zathura_page_t* page, zathura_page_data_t* data, zathura_error_t* error);
|
||||
|
||||
/**
|
||||
* Renders the page
|
||||
*/
|
||||
zathura_error_t (*page_render_cairo)(zathura_page_t* page, cairo_t* cairo, bool printing);
|
||||
zathura_error_t (*page_render_cairo)(zathura_page_t* page, zathura_page_data_t* data, cairo_t* cairo, bool printing);
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue