From a2aebf5ed9356abdbd341bf112f2c4b0933fbe3c Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Sat, 2 Jan 2016 16:22:17 +0000 Subject: MirLua: time to break backward compatibility git-svn-id: http://svn.miranda-ng.org/main/trunk@15994 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MirLua/src/m_msg_buttonsbar.cpp | 77 --------------------------------- 1 file changed, 77 deletions(-) (limited to 'plugins/MirLua/src/m_msg_buttonsbar.cpp') diff --git a/plugins/MirLua/src/m_msg_buttonsbar.cpp b/plugins/MirLua/src/m_msg_buttonsbar.cpp index b4b4e42800..103b0d6624 100644 --- a/plugins/MirLua/src/m_msg_buttonsbar.cpp +++ b/plugins/MirLua/src/m_msg_buttonsbar.cpp @@ -124,89 +124,12 @@ static int lua_RemoveButton(lua_State *L) return 1; } -int ButtonPressedHookEventObjParam(void *obj, WPARAM wParam, LPARAM lParam, LPARAM param) -{ - lua_State *L = (lua_State*)obj; - - int ref = param; - lua_rawgeti(L, LUA_REGISTRYINDEX, ref); - - lua_pushnumber(L, wParam); - - CustomButtonClickData *bcd = (CustomButtonClickData*)lParam; - - lua_newtable(L); - lua_pushliteral(L, "Module"); - lua_pushstring(L, ptrA(mir_utf8encode(bcd->pszModule))); - lua_settable(L, -3); - lua_pushliteral(L, "ButtonID"); - lua_pushinteger(L, bcd->dwButtonId); - lua_settable(L, -3); - lua_pushliteral(L, "hContact"); - lua_pushinteger(L, bcd->hContact); - lua_settable(L, -3); - lua_pushliteral(L, "Flags"); - lua_pushinteger(L, bcd->flags); - lua_settable(L, -3); - - luaM_pcall(L, 2, 1); - - int res = (int)lua_tointeger(L, 1); - - return res; -} - -static int lua_OnMsgToolBarButtonPressed(lua_State *L) -{ - ObsoleteMethod(L, "Use m.HookEvent instead"); - - if (!lua_isfunction(L, 1)) - { - lua_pushlightuserdata(L, NULL); - return 1; - } - - lua_pushvalue(L, 1); - int ref = luaL_ref(L, LUA_REGISTRYINDEX); - - HANDLE res = ::HookEventObjParam(ME_MSG_BUTTONPRESSED, ButtonPressedHookEventObjParam, L, ref); - lua_pushlightuserdata(L, res); - - CMLua::HookRefs.insert(new HandleRefParam(L, res, ref)); - - return 1; -} - -static int lua_DecodeCustomButtonClickData(lua_State *L) -{ - CustomButtonClickData *bcd = (CustomButtonClickData*)lua_tointeger(L, 1); - - lua_newtable(L); - lua_pushliteral(L, "Module"); - lua_pushstring(L, ptrA(mir_utf8encode(bcd->pszModule))); - lua_settable(L, -3); - lua_pushliteral(L, "ButtonID"); - lua_pushinteger(L, bcd->dwButtonId); - lua_settable(L, -3); - lua_pushliteral(L, "hContact"); - lua_pushinteger(L, bcd->hContact); - lua_settable(L, -3); - lua_pushliteral(L, "Flags"); - lua_pushinteger(L, bcd->flags); - lua_settable(L, -3); - - return 1; -} - static luaL_Reg msgbuttinsbarApi[] = { { "AddButton", lua_AddButton }, { "ModifyButton", lua_ModifyButton }, { "RemoveButton", lua_RemoveButton }, - { "OnMsgToolBarButtonPressed", lua_OnMsgToolBarButtonPressed }, - { "DecodeCustomButtonClickData", lua_DecodeCustomButtonClickData }, - { NULL, NULL } }; -- cgit v1.2.3