static int setStyleSheet(lua_State *L) { CreDocument *doc = (CreDocument*) luaL_checkudata(L, 1, "credocument"); const char* style_sheet = luaL_checkstring(L, 2); lString8 css; if (LVLoadStylesheetFile(lString16(style_sheet), css)){ doc->text_view->setStyleSheet(css); } else { doc->text_view->setStyleSheet(lString8()); } return 0; }
bool V3DocViewWin::loadCSS( lString16 filename ) { lString8 css; if ( LVLoadStylesheetFile( filename, css ) ) { if ( !css.empty() ) { CRLog::info( "Using style sheet from %s", UnicodeToUtf8(filename).c_str() ); _cssDir = LVExtractPath(filename); LVAppendPathDelimiter(_cssDir); _docview->setStyleSheet( css ); _css = css; //CRLog::debug("Stylesheet found:\n%s", css.c_str() ); return true; } } else { //CRLog::debug("Stylesheet file not found %s", UnicodeToUtf8(filename).c_str() ); } return false; }