src/gui/luainstance.cpp add switch enableUTF8 to ComponentsText

Origin commit data
------------------
Branch: ni/coolstream
Commit: 644d96e42d
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2015-07-12 (Sun, 12 Jul 2015)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2015-07-12 21:13:22 +02:00
parent b8c4a64385
commit dad841f5c6
2 changed files with 20 additions and 0 deletions

View File

@@ -2072,6 +2072,7 @@ void CLuaInstance::ComponentsTextRegister(lua_State *L)
{ "setText", CLuaInstance::ComponentsTextSetText },
{ "scroll", CLuaInstance::ComponentsTextScroll },
{ "setCenterPos", CLuaInstance::ComponentsTextSetCenterPos },
{ "enableUTF8", CLuaInstance::ComponentsTextEnableUTF8 },
{ "__gc", CLuaInstance::ComponentsTextDelete },
{ NULL, NULL }
};
@@ -2258,6 +2259,24 @@ int CLuaInstance::ComponentsTextSetCenterPos(lua_State *L)
return 0;
}
int CLuaInstance::ComponentsTextEnableUTF8(lua_State *L)
{
lua_assert(lua_istable(L,1));
CLuaComponentsText *m = ComponentsTextCheck(L, 1);
if (!m) return 0;
bool utf8_encoded = true;
if (!tableLookup(L, "utf8_encoded", utf8_encoded))
{
std::string tmp = "true";
if (tableLookup(L, "utf8_encoded", tmp))
paramBoolDeprecated(L, tmp.c_str());
utf8_encoded = (tmp == "true" || tmp == "1" || tmp == "yes");
}
m->ct->enableUTF8(utf8_encoded);
return 0;
}
int CLuaInstance::ComponentsTextDelete(lua_State *L)
{
DBG("CLuaInstance::%s %d\n", __func__, lua_gettop(L));

View File

@@ -278,6 +278,7 @@ private:
static int ComponentsTextSetText(lua_State *L);
static int ComponentsTextScroll(lua_State *L);
static int ComponentsTextSetCenterPos(lua_State *L);
static int ComponentsTextEnableUTF8(lua_State *L);
static int ComponentsTextDelete(lua_State *L);
static CLuaPicture *CPictureCheck(lua_State *L, int n);