Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zathura
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
109
Issues
109
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pwmt
zathura
Commits
bba265cc
Commit
bba265cc
authored
Feb 03, 2018
by
Sebastian Ramacher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add function to get page labels
Signed-off-by:
Sebastian Ramacher
<
sebastian+dev@ramacher.at
>
parent
c4ef771c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
2 deletions
+54
-2
zathura/page.c
zathura/page.c
+31
-0
zathura/page.h
zathura/page.h
+11
-0
zathura/plugin-api.h
zathura/plugin-api.h
+12
-2
No files found.
zathura/page.c
View file @
bba265cc
...
@@ -359,3 +359,34 @@ zathura_page_render(zathura_page_t* page, cairo_t* cairo, bool printing)
...
@@ -359,3 +359,34 @@ zathura_page_render(zathura_page_t* page, cairo_t* cairo, bool printing)
return
functions
->
page_render_cairo
(
page
,
page
->
data
,
cairo
,
printing
);
return
functions
->
page_render_cairo
(
page
,
page
->
data
,
cairo
,
printing
);
}
}
char
*
zathura_page_get_label
(
zathura_page_t
*
page
,
zathura_error_t
*
error
)
{
if
(
page
==
NULL
||
page
->
document
==
NULL
)
{
if
(
error
)
{
*
error
=
ZATHURA_ERROR_INVALID_ARGUMENTS
;
}
return
NULL
;
}
zathura_plugin_t
*
plugin
=
zathura_document_get_plugin
(
page
->
document
);
zathura_plugin_functions_t
*
functions
=
zathura_plugin_get_functions
(
plugin
);
if
(
functions
->
page_get_label
==
NULL
)
{
if
(
error
)
{
*
error
=
ZATHURA_ERROR_NOT_IMPLEMENTED
;
}
return
NULL
;
}
char
*
ret
=
NULL
;
zathura_error_t
e
=
functions
->
page_get_label
(
page
,
page
->
data
,
&
ret
);
if
(
e
!=
ZATHURA_ERROR_OK
)
{
if
(
error
)
{
*
error
=
e
;
}
return
NULL
;
}
return
ret
;
}
zathura/page.h
View file @
bba265cc
...
@@ -203,4 +203,15 @@ char* zathura_page_get_text(zathura_page_t* page, zathura_rectangle_t rectangle,
...
@@ -203,4 +203,15 @@ char* zathura_page_get_text(zathura_page_t* page, zathura_rectangle_t rectangle,
*/
*/
zathura_error_t
zathura_page_render
(
zathura_page_t
*
page
,
cairo_t
*
cairo
,
bool
printing
);
zathura_error_t
zathura_page_render
(
zathura_page_t
*
page
,
cairo_t
*
cairo
,
bool
printing
);
/**
* Get page label. Note that the page label might not exist, in this case NULL
* is returned.
*
* @param page Page
* @param error Set to an error value (see \ref zathura_Error_t) if an error
* occurred.
* @return Page label
*/
char
*
zathura_page_get_label
(
zathura_page_t
*
page
,
zathura_error_t
*
error
);
#endif // PAGE_H
#endif // PAGE_H
zathura/plugin-api.h
View file @
bba265cc
...
@@ -91,10 +91,15 @@ typedef char* (*zathura_plugin_page_get_text_t)(zathura_page_t* page, void* data
...
@@ -91,10 +91,15 @@ typedef char* (*zathura_plugin_page_get_text_t)(zathura_page_t* page, void* data
typedef
zathura_image_buffer_t
*
(
*
zathura_plugin_page_render_t
)(
zathura_page_t
*
page
,
void
*
data
,
zathura_error_t
*
error
);
typedef
zathura_image_buffer_t
*
(
*
zathura_plugin_page_render_t
)(
zathura_page_t
*
page
,
void
*
data
,
zathura_error_t
*
error
);
/**
/**
* Renders the page
* Renders the page
to a cairo surface.
*/
*/
typedef
zathura_error_t
(
*
zathura_plugin_page_render_cairo_t
)(
zathura_page_t
*
page
,
void
*
data
,
cairo_t
*
cairo
,
bool
printing
);
typedef
zathura_error_t
(
*
zathura_plugin_page_render_cairo_t
)(
zathura_page_t
*
page
,
void
*
data
,
cairo_t
*
cairo
,
bool
printing
);
/**
* Get page label.
*/
typedef
zathura_error_t
(
*
zathura_plugin_page_get_label_t
)(
zathura_page_t
*
page
,
void
*
data
,
char
**
label
);
struct
zathura_plugin_functions_s
struct
zathura_plugin_functions_s
{
{
...
@@ -179,9 +184,14 @@ struct zathura_plugin_functions_s
...
@@ -179,9 +184,14 @@ struct zathura_plugin_functions_s
zathura_plugin_page_render_t
page_render
;
zathura_plugin_page_render_t
page_render
;
/**
/**
* Renders the page
* Renders the page
to a cairo surface.
*/
*/
zathura_plugin_page_render_cairo_t
page_render_cairo
;
zathura_plugin_page_render_cairo_t
page_render_cairo
;
/**
* Get page label.
*/
zathura_plugin_page_get_label_t
page_get_label
;
};
};
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment