Skip to content

Commit

Permalink
Bump crengine: support for EPUB non-linear flows
Browse files Browse the repository at this point in the history
  • Loading branch information
Jellby authored and poire-z committed Nov 18, 2020
1 parent 59f8e51 commit 514ac80
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions cre.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,23 @@ static int getCurrentPage(lua_State *L) {
return 1;
}

static int getPageFlow(lua_State *L) {
CreDocument *doc = (CreDocument*) luaL_checkudata(L, 1, "credocument");
int pageno = luaL_checkint(L, 2);

lua_pushinteger(L, doc->text_view->getPageFlow(pageno-1));

return 1;
}

static int hasNonLinearFlows(lua_State *L) {
CreDocument *doc = (CreDocument*) luaL_checkudata(L, 1, "credocument");

lua_pushboolean(L, doc->text_view->hasNonLinearFlows());

return 1;
}

static int getPageFromXPointer(lua_State *L) {
CreDocument *doc = (CreDocument*) luaL_checkudata(L, 1, "credocument");
const char *xpointer_str = luaL_checkstring(L, 2);
Expand Down Expand Up @@ -3425,6 +3442,7 @@ static const struct luaL_Reg credocument_meth[] = {
{"getDocumentProps", getDocumentProps},
{"getPages", getNumberOfPages},
{"getCurrentPage", getCurrentPage},
{"getPageFlow", getPageFlow},
{"getPageFromXPointer", getPageFromXPointer},
{"getPosFromXPointer", getPosFromXPointer},
{"getCurrentPos", getCurrentPos},
Expand Down Expand Up @@ -3518,6 +3536,7 @@ static const struct luaL_Reg credocument_meth[] = {
{"getPageMapCurrentPageLabel", getPageMapCurrentPageLabel},
{"getPageMapXPointerPageLabel", getPageMapXPointerPageLabel},
{"getPageMapVisiblePageLabels", getPageMapVisiblePageLabels},
{"hasNonLinearFlows", hasNonLinearFlows},
{"readDefaults", readDefaults},
{"saveDefaults", saveDefaults},
{"close", closeDocument},
Expand Down

0 comments on commit 514ac80

Please sign in to comment.