cre: load document afer set font

Conflicts:
	cre.cpp
	crereader.lua
pull/2/merge
Qingping Hou 12 years ago
parent b4bad21535
commit 71514001b0

@ -44,12 +44,11 @@ static int initCache(lua_State *L) {
return 0;
}
static int openDocument(lua_State *L) {
const char *file_name = luaL_checkstring(L, 1);
const char *style_sheet = luaL_checkstring(L, 2);
int width = luaL_checkint(L, 3);
int height = luaL_checkint(L, 4);
LVDocViewMode view_mode = (LVDocViewMode)luaL_checkint(L, 5);
static int newDocView(lua_State *L) {
const char *style_sheet = luaL_checkstring(L, 1);
int width = luaL_checkint(L, 2);
int height = luaL_checkint(L, 3);
LVDocViewMode view_mode = (LVDocViewMode)luaL_checkint(L, 4);
lString8 css;
CreDocument *doc = (CreDocument*) lua_newuserdata(L, sizeof(CreDocument));
@ -66,11 +65,7 @@ static int openDocument(lua_State *L) {
}
doc->text_view->setViewMode(view_mode, -1);
doc->text_view->Resize(width, height);
doc->text_view->LoadDocument(file_name);
doc->text_view->setPageHeaderInfo(PGHDR_AUTHOR|PGHDR_TITLE|PGHDR_PAGE_NUMBER|PGHDR_PAGE_COUNT|PGHDR_CHAPTER_MARKS|PGHDR_CLOCK);
doc->text_view->setStatusFontFace(lString8("Droid Sans"));
doc->dom_doc = doc->text_view->getDocument();
doc->text_view->Render();
return 1;
}
@ -89,6 +84,17 @@ static int setGammaIndex(lua_State *L) {
return 0;
}
static int loadDocument(lua_State *L) {
CreDocument *doc = (CreDocument*) luaL_checkudata(L, 1, "credocument");
const char *file_name = luaL_checkstring(L, 2);
doc->text_view->LoadDocument(file_name);
doc->dom_doc = doc->text_view->getDocument();
doc->text_view->Render();
return 0;
}
static int closeDocument(lua_State *L) {
CreDocument *doc = (CreDocument*) luaL_checkudata(L, 1, "credocument");
@ -637,7 +643,7 @@ static int findText(lua_State *L) {
static const struct luaL_Reg cre_func[] = {
{"initCache", initCache},
{"openDocument", openDocument},
{"newDocView", newDocView},
{"getFontFaces", getFontFaces},
{"getGammaIndex", getGammaIndex},
{"setGammaIndex", setGammaIndex},
@ -646,6 +652,7 @@ static const struct luaL_Reg cre_func[] = {
};
static const struct luaL_Reg credocument_meth[] = {
{"loadDocument", loadDocument},
/*--- get methods ---*/
{"getPages", getNumberOfPages},
{"getCurrentPage", getCurrentPage},

Loading…
Cancel
Save