Skip to content

Commit

Permalink
bump crengine: minor fixes (ruby, a crash, non-linear flows) (#1792)
Browse files Browse the repository at this point in the history
Includes:
- html5.css: really ensure ruby centering
- getRenderedWidths(): fix possible crash with 0-width images
- Page splitting: ignore empty non-linear flows
- LvDocView header: allow overriding "page/total %"
cre.cpp: add setPageInfoOverride() to allow tweaking
top status bar display of page number/count/%.
  • Loading branch information
poire-z committed May 20, 2024
1 parent 61c05b6 commit 99a6bd1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion cre.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1351,7 +1351,10 @@ static int getPageMapCurrentPageLabel(lua_State *L) {
else if (idx >= nb)
idx = nb - 1;
lua_pushstring(L, UnicodeToLocal(pagemap->getChild(idx)->getLabel()).c_str());
return 1;
// Push index and count as we have them, they might be of use to compute "pages left"
lua_pushinteger(L, idx+1);
lua_pushinteger(L, nb);
return 3;
}

static int getPageMapXPointerPageLabel(lua_State *L) {
Expand Down Expand Up @@ -1577,6 +1580,14 @@ static int setHeaderInfo(lua_State *L) {
return 0;
}

static int setPageInfoOverride(lua_State *L) {
CreDocument *doc = (CreDocument*) luaL_checkudata(L, 1, "credocument");
const char *pageinfo = luaL_checkstring(L, 2);

doc->text_view->setPageInfoOverride(lString32(pageinfo));
return 0;
}

static int setHeaderProgressMarks(lua_State *L) {
CreDocument *doc = (CreDocument*) luaL_checkudata(L, 1, "credocument");
int pages = luaL_checkint(L, 2);
Expand Down Expand Up @@ -4194,6 +4205,7 @@ static const struct luaL_Reg credocument_meth[] = {
{"setViewMode", setViewMode},
{"setViewDimen", setViewDimen},
{"setHeaderInfo", setHeaderInfo},
{"setPageInfoOverride", setPageInfoOverride},
{"setHeaderFont", setHeaderFont},
{"setHeaderProgressMarks", setHeaderProgressMarks},
{"setFontFace", setFontFace},
Expand Down

0 comments on commit 99a6bd1

Please sign in to comment.