mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-31 01:11:12 +02:00
CLuaInstance: Add function checkMagicMask() for use the color constants
- Use checkMagicMask() for colors in CComponents-Lua functions
This commit is contained in:
@@ -347,6 +347,14 @@ void CLuaInstance::functionDeprecated(lua_State *L, const char* oldFunc, const c
|
|||||||
ar.short_src, ar.currentline);
|
ar.short_src, ar.currentline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lua_Unsigned CLuaInstance::checkMagicMask(lua_Unsigned &col)
|
||||||
|
{
|
||||||
|
if ((col & MAGIC_MASK) == MAGIC_COLOR)
|
||||||
|
/* use the color constants */
|
||||||
|
col = CFrameBuffer::getInstance()->realcolor[col & 0x000000ff];
|
||||||
|
return col;
|
||||||
|
}
|
||||||
|
|
||||||
#define SET_VAR1(NAME) \
|
#define SET_VAR1(NAME) \
|
||||||
lua_pushinteger(lua, NAME); \
|
lua_pushinteger(lua, NAME); \
|
||||||
lua_setglobal(lua, #NAME);
|
lua_setglobal(lua, #NAME);
|
||||||
@@ -550,9 +558,7 @@ int CLuaInstance::PaintBox(lua_State *L)
|
|||||||
w = W->fbwin->dx - x;
|
w = W->fbwin->dx - x;
|
||||||
if (h < 0 || y + h > W->fbwin->dy)
|
if (h < 0 || y + h > W->fbwin->dy)
|
||||||
h = W->fbwin->dy - y;
|
h = W->fbwin->dy - y;
|
||||||
/* use the color constants */
|
checkMagicMask(c);
|
||||||
if ((c & MAGIC_MASK) == MAGIC_COLOR)
|
|
||||||
c = CFrameBuffer::getInstance()->realcolor[c & 0x000000ff];
|
|
||||||
W->fbwin->paintBoxRel(x, y, w, h, c, radius, corner);
|
W->fbwin->paintBoxRel(x, y, w, h, c, radius, corner);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -666,8 +672,7 @@ int CLuaInstance::RenderString(lua_State *L)
|
|||||||
if (rwidth < w)
|
if (rwidth < w)
|
||||||
x += (w - rwidth) / 2;
|
x += (w - rwidth) / 2;
|
||||||
}
|
}
|
||||||
if ((c & MAGIC_MASK) == MAGIC_COLOR)
|
checkMagicMask(c);
|
||||||
c = CFrameBuffer::getInstance()->realcolor[c & 0x000000ff];
|
|
||||||
if (boxh > -1) /* if boxh < 0, don't paint string */
|
if (boxh > -1) /* if boxh < 0, don't paint string */
|
||||||
W->fbwin->RenderString(g_Font[f], x, y, w, text, c, boxh);
|
W->fbwin->RenderString(g_Font[f], x, y, w, text, c, boxh);
|
||||||
lua_pushinteger(L, rwidth); /* return renderwidth */
|
lua_pushinteger(L, rwidth); /* return renderwidth */
|
||||||
@@ -1500,6 +1505,10 @@ int CLuaInstance::CWindowNew(lua_State *L)
|
|||||||
tableLookup(L, "btnYellow", btnYellow);
|
tableLookup(L, "btnYellow", btnYellow);
|
||||||
tableLookup(L, "btnBlue", btnBlue);
|
tableLookup(L, "btnBlue", btnBlue);
|
||||||
|
|
||||||
|
checkMagicMask(color_frame);
|
||||||
|
checkMagicMask(color_body);
|
||||||
|
checkMagicMask(color_shadow);
|
||||||
|
|
||||||
tmp1 = "true";
|
tmp1 = "true";
|
||||||
tableLookup(L, "show_header" , tmp1);
|
tableLookup(L, "show_header" , tmp1);
|
||||||
bool show_header = (tmp1 == "true" || tmp1 == "show" || tmp1 == "yes");
|
bool show_header = (tmp1 == "true" || tmp1 == "show" || tmp1 == "yes");
|
||||||
@@ -1793,6 +1802,11 @@ int CLuaInstance::ComponentsTextNew(lua_State *L)
|
|||||||
tableLookup(L, "color_body" , color_body);
|
tableLookup(L, "color_body" , color_body);
|
||||||
tableLookup(L, "color_shadow", color_shadow);
|
tableLookup(L, "color_shadow", color_shadow);
|
||||||
|
|
||||||
|
checkMagicMask(color_text);
|
||||||
|
checkMagicMask(color_frame);
|
||||||
|
checkMagicMask(color_body);
|
||||||
|
checkMagicMask(color_shadow);
|
||||||
|
|
||||||
if (!tmpMode.empty()) {
|
if (!tmpMode.empty()) {
|
||||||
table_key txt_align[] = {
|
table_key txt_align[] = {
|
||||||
{ "ALIGN_AUTO_WIDTH", CTextBox::AUTO_WIDTH },
|
{ "ALIGN_AUTO_WIDTH", CTextBox::AUTO_WIDTH },
|
||||||
@@ -1974,6 +1988,10 @@ int CLuaInstance::CPictureNew(lua_State *L)
|
|||||||
tableLookup(L, "color_shadow" , color_shadow);
|
tableLookup(L, "color_shadow" , color_shadow);
|
||||||
tableLookup(L, "transparency" , transparency);
|
tableLookup(L, "transparency" , transparency);
|
||||||
|
|
||||||
|
checkMagicMask(color_frame);
|
||||||
|
checkMagicMask(color_background);
|
||||||
|
checkMagicMask(color_shadow);
|
||||||
|
|
||||||
CComponentsForm* pw = (parent && parent->w) ? parent->w->getBodyObject() : NULL;
|
CComponentsForm* pw = (parent && parent->w) ? parent->w->getBodyObject() : NULL;
|
||||||
|
|
||||||
CLuaPicture **udata = (CLuaPicture **) lua_newuserdata(L, sizeof(CLuaPicture *));
|
CLuaPicture **udata = (CLuaPicture **) lua_newuserdata(L, sizeof(CLuaPicture *));
|
||||||
|
@@ -178,6 +178,7 @@ private:
|
|||||||
void registerFunctions();
|
void registerFunctions();
|
||||||
|
|
||||||
static void functionDeprecated(lua_State *L, const char* oldFunc, const char* newFunc);
|
static void functionDeprecated(lua_State *L, const char* oldFunc, const char* newFunc);
|
||||||
|
static lua_Unsigned checkMagicMask(lua_Unsigned &col);
|
||||||
|
|
||||||
static int NewWindow(lua_State *L);
|
static int NewWindow(lua_State *L);
|
||||||
static int PaintBox(lua_State *L);
|
static int PaintBox(lua_State *L);
|
||||||
|
Reference in New Issue
Block a user