Update of /cvsroot/wxlua/wxLua/modules/wxlua/src
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv9909/wxLua/modules/wxlua/src
Modified Files:
wxlbind.cpp wxlcallb.cpp wxlstate.cpp
Log Message:
Move GetEvent function that searches to bindings to the wxLuaBinding class from wxLuaState
Index: wxlstate.cpp
===================================================================
RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v
retrieving revision 1.89
retrieving revision 1.90
diff -C2 -d -r1.89 -r1.90
*** wxlstate.cpp 15 Mar 2007 00:01:25 -0000 1.89
--- wxlstate.cpp 16 Mar 2007 21:23:47 -0000 1.90
***************
*** 1799,1805 ****
{
wxCHECK_MSG(Ok(), NULL, wxT("Invalid wxLuaState"));
- WXLUAEVENT eventItem;
- int eventType = eventType_;
- eventItem.eventType = &eventType;
wxLuaBindingList::Node *node;
--- 1799,1802 ----
***************
*** 1807,1816 ****
{
wxLuaBinding* binding = node->GetData();
- WXLUAEVENT *pLuaEvent = (WXLUAEVENT *) bsearch(&eventItem,
- binding->GetLuaEventList(),
- binding->GetLuaEventCount(),
- sizeof(WXLUAEVENT),
- wxLuaEventListCompareFn);
if (pLuaEvent)
return pLuaEvent;
--- 1804,1809 ----
{
wxLuaBinding* binding = node->GetData();
+ const WXLUAEVENT *pLuaEvent = binding->GetEvent(eventType_);
if (pLuaEvent)
return pLuaEvent;
Index: wxlbind.cpp
===================================================================
RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -d -r1.53 -r1.54
*** wxlbind.cpp 15 Mar 2007 00:01:25 -0000 1.53
--- wxlbind.cpp 16 Mar 2007 21:23:47 -0000 1.54
***************
*** 714,727 ****
}
! wxString wxLuaBinding::GetEventTypeName(wxEventType e_type)
{
! for (size_t n = 0; n < m_eventCount; ++n)
! {
! WXLUAEVENT *pEvent = m_eventList + n;
! if (*pEvent->eventType == (int)e_type)
! return lua2wx(pEvent->name);
! }
! return wxEmptyString;
}
--- 714,733 ----
}
! const WXLUAEVENT* wxLuaBinding::GetEvent(wxEventType eventType_) const
{
! const int eventType = eventType_;
! WXLUAEVENT eventItem = { &eventType, "" };
! const WXLUAEVENT *pLuaEvent = (WXLUAEVENT *)bsearch(&eventItem,
! m_eventList,
! m_eventCount,
! sizeof(WXLUAEVENT),
! wxLuaEventListCompareFn);
! return pLuaEvent;
! }
! wxString wxLuaBinding::GetEventTypeName(wxEventType eventType) const
! {
! const WXLUAEVENT* luaEvent = GetEvent(eventType);
! return (luaEvent != NULL) ? lua2wx(luaEvent->name) : wxString();
}
Index: wxlcallb.cpp
===================================================================
RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlcallb.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** wxlcallb.cpp 26 Feb 2007 01:57:06 -0000 1.25
--- wxlcallb.cpp 16 Mar 2007 21:23:47 -0000 1.26
***************
*** 113,116 ****
--- 113,117 ----
// ref the state in case this generates a wxEVT_DESTROY which clears us
+ // this is why we don't get a pointer to the lua_Sstate but check it with GetLuaState()
wxLuaState wxlState(m_wxlState);
***************
*** 132,139 ****
}
else
! wxlState.terror("wxLua: CallFunction: function is not a Lua function.");
}
else
! wxlState.terror("wxLua: CallFunction: function has been garbage collected.");
lua_settop(wxlState.GetLuaState(), oldTop);
--- 133,140 ----
}
else
! wxlState.terror("wxLua: wxEvtHandler::Connect in wxLuaCallback::CallFunction: function is not a Lua function.");
}
else
! wxlState.terror("wxLua: wxEvtHandler::Connect in wxLuaCallback::CallFunction: function has been garbage collected.");
lua_settop(wxlState.GetLuaState(), oldTop);
|