From f90ae38cb5dbf0e1374a41480c4b2afdc1799767 Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Wed, 4 Apr 2012 17:25:18 +0800 Subject: [PATCH] mod: load css in crereader --- cre.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cre.cpp b/cre.cpp index 29337a2db..54df5b830 100644 --- a/cre.cpp +++ b/cre.cpp @@ -36,19 +36,26 @@ typedef struct CreDocument { 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); + lString8 css; CreDocument *doc = (CreDocument*) lua_newuserdata(L, sizeof(CreDocument)); luaL_getmetatable(L, "credocument"); lua_setmetatable(L, -2); doc->text_view = new LVDocView(); - doc->text_view->setStyleSheet(lString8(style_sheet)); doc->text_view->setBackgroundColor(0x000000); - doc->text_view->LoadDocument(file_name); + if (LVLoadStylesheetFile(lString16(style_sheet), css)){ + if (!css.empty()){ + doc->text_view->setStyleSheet(css); + } + } doc->text_view->setViewMode(DVM_SCROLL, -1); doc->text_view->Resize(width, height); + + doc->text_view->LoadDocument(file_name); doc->text_view->Render(); return 1;