//-------------------
//---------------
//-------------
+
+void
+_edje_lua2_script_func_shutdown(Edje *ed)
+{
+ int err;
+
+ lua_getglobal(ed->L, "shutdown");
+ if (!lua_isnil(ed->L, -1))
+ {
+ if ((err = lua_pcall(ed->L, 0, 0, 0)))
+ _edje_lua2_error(ed->L, err);
+ }
+ else
+ lua_pop(ed->L, 1);
+ _edje_lua2_script_shutdown(ed);
+}
+
+void
+_edje_lua2_script_func_show(Edje *ed)
+{
+ int err;
+
+ lua_getglobal(ed->L, "show");
+ if (!lua_isnil(ed->L, -1))
+ {
+ if ((err = lua_pcall(ed->L, 0, 0, 0)))
+ _edje_lua2_error(ed->L, err);
+ }
+ else
+ lua_pop(ed->L, 1);
+}
+
+void
+_edje_lua2_script_func_hide(Edje *ed)
+{
+ int err;
+
+ lua_getglobal(ed->L, "hide");
+ if (!lua_isnil(ed->L, -1))
+ {
+ if ((err = lua_pcall(ed->L, 0, 0, 0)))
+ _edje_lua2_error(ed->L, err);
+ }
+ else
+ lua_pop(ed->L, 1);
+}
+
+void
+_edje_lua2_script_func_move(Edje *ed)
+{
+ int err;
+
+ lua_getglobal(ed->L, "move");
+ if (!lua_isnil(ed->L, -1))
+ {
+ lua_pushinteger(ed->L, ed->x);
+ lua_pushinteger(ed->L, ed->y);
+ if ((err = lua_pcall(ed->L, 2, 0, 0)))
+ _edje_lua2_error(ed->L, err);
+ }
+ else
+ lua_pop(ed->L, 1);
+}
+
+void
+_edje_lua2_script_func_resize(Edje *ed)
+{
+ int err;
+
+ lua_getglobal(ed->L, "resize");
+ if (!lua_isnil(ed->L, -1))
+ {
+ lua_pushinteger(ed->L, ed->w);
+ lua_pushinteger(ed->L, ed->h);
+ if ((err = lua_pcall(ed->L, 2, 0, 0)))
+ _edje_lua2_error(ed->L, err);
+ }
+ else
+ lua_pop(ed->L, 1);
+}
+
+void
+_edje_lua2_script_func_message(Edje *ed, Edje_Message *em)
+{
+ int err;
+
+ lua_getglobal(ed->L, "message");
+ if (!lua_isnil(ed->L, -1))
+ {
+ lua_pushinteger(ed->L, em->id);
+ switch (em->type)
+ {
+ case EDJE_MESSAGE_NONE:
+ lua_pushstring(ed->L, "none");
+ break;
+ case EDJE_MESSAGE_SIGNAL:
+ printf("sig msg\n");
+ break;
+ case EDJE_MESSAGE_STRING:
+ lua_pushstring(ed->L, "str");
+ break;
+ case EDJE_MESSAGE_INT:
+ lua_pushstring(ed->L, "int");
+ break;
+ case EDJE_MESSAGE_FLOAT:
+ lua_pushstring(ed->L, "float");
+ break;
+ case EDJE_MESSAGE_STRING_SET:
+ lua_pushstring(ed->L, "strset");
+ break;
+ case EDJE_MESSAGE_INT_SET:
+ lua_pushstring(ed->L, "intset");
+ break;
+ case EDJE_MESSAGE_FLOAT_SET:
+ lua_pushstring(ed->L, "floatset");
+ break;
+ case EDJE_MESSAGE_STRING_INT:
+ lua_pushstring(ed->L, "strint");
+ break;
+ case EDJE_MESSAGE_STRING_FLOAT:
+ lua_pushstring(ed->L, "strfloat");
+ break;
+ case EDJE_MESSAGE_STRING_INT_SET:
+ lua_pushstring(ed->L, "strintset");
+ break;
+ case EDJE_MESSAGE_STRING_FLOAT_SET:
+ lua_pushstring(ed->L, "strfloatset");
+ break;
+ default:
+ break;
+ }
+ if ((err = lua_pcall(ed->L, 2, 0, 0)))
+ _edje_lua2_error(ed->L, err);
+ }
+ else
+ lua_pop(ed->L, 1);
+}
+
+void
+_edje_lua2_script_func_signal(Edje *ed, const char *sig, const char *src)
+{
+ int err;
+
+ lua_getglobal(ed->L, "signal");
+ if (!lua_isnil(ed->L, -1))
+ {
+ lua_pushstring(ed->L, sig);
+ lua_pushstring(ed->L, src);
+ if ((err = lua_pcall(ed->L, 2, 0, 0)))
+ _edje_lua2_error(ed->L, err);
+ }
+ else
+ lua_pop(ed->L, 1);
+}
+
+//-------------
+//-------------
+//-------------
static int
_elua_echo(lua_State *L)
{
if (ed->collection && ed->L)
{
#ifdef LUA2
- int err;
-
- if (ed->L)
- {
- lua_getglobal(ed->L, "shutdown");
- if (!lua_isnil(ed->L, -1))
- {
- if ((err = lua_pcall(ed->L, 0, 0, 0)))
- _edje_lua2_error(ed->L, err);
- }
- else
- lua_pop(ed->L, 1);
- }
- _edje_lua2_script_shutdown(ed);
+ _edje_lua2_script_func_shutdown(ed);
#else
lua_State *L = ed->L;
lua_getglobal(L, "shutdown");
void
_edje_lua_script_only_show(Edje * ed)
{
-#ifdef LUA2
-#else
if (ed->collection && ed->L)
{
+#ifdef LUA2
+ _edje_lua2_script_func_show(ed);
+#else
lua_State *L = ed->L;
lua_getglobal(L, "show");
if (!lua_isnil (L, -1))
}
else
lua_pop (L, 1);
- }
#endif
+ }
}
void
_edje_lua_script_only_hide(Edje * ed)
{
-#ifdef LUA2
-#else
if (ed->collection && ed->L)
{
+#ifdef LUA2
+ _edje_lua2_script_func_hide(ed);
+#else
lua_State *L = ed->L;
lua_getglobal(L, "hide");
if (!lua_isnil (L, -1))
}
else
lua_pop (L, 1);
- }
#endif
+ }
}
void
_edje_lua_script_only_move(Edje * ed)
{
-#ifdef LUA2
-#else
if (ed->collection && ed->L)
{
+#ifdef LUA2
+ _edje_lua2_script_func_move(ed);
+#else
lua_State *L = ed->L;
lua_getglobal(L, "move");
if (!lua_isnil (L, -1))
}
else
lua_pop (L, 1);
- }
#endif
+ }
}
void
_edje_lua_script_only_resize(Edje * ed)
{
-#ifdef LUA2
-#else
if (ed->collection && ed->L)
{
+#ifdef LUA2
+ _edje_lua2_script_func_resize(ed);
+#else
lua_State *L = ed->L;
lua_getglobal(L, "resize");
if (!lua_isnil (L, -1))
}
else
lua_pop (L, 1);
- }
#endif
+ }
}
void
_edje_lua_script_only_message(Edje * ed, Edje_Message * em)
{
-#ifdef LUA2
-#else
if (ed->collection && ed->L)
{
+#ifdef LUA2
+ _edje_lua2_script_func_message(ed, em);
+#else
lua_State *L = ed->L;
lua_getglobal(L, "message");
if (!lua_isnil (L, -1))
}
else
lua_pop (L, 1);
- }
#endif
+ }
}
// new lua stuff - supercedes the old
-//#define LUA2 1
+#define LUA2 1
#ifdef LUA2
void _edje_lua2_error_full(const char *file, const char *fnc, int line, lua_State *L, int err_code);
void _edje_lua2_script_shutdown(Edje *ed);
void _edje_lua2_script_load(Edje_Part_Collection *edc, void *data, int size);
void _edje_lua2_script_unload(Edje_Part_Collection *edc);
+
+void _edje_lua2_script_func_shutdown(Edje *ed);
+void _edje_lua2_script_func_show(Edje *ed);
+void _edje_lua2_script_func_hide(Edje *ed);
+void _edje_lua2_script_func_move(Edje *ed);
+void _edje_lua2_script_func_resize(Edje *ed);
+void _edje_lua2_script_func_message(Edje *ed, Edje_Message *em);
+void _edje_lua2_script_func_signal(Edje *ed, const char *sig, const char *src);
+
#endif
#include "edje_convert.h"