From: John L. <jr...@us...> - 2005-11-29 05:45:18
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21610/wxLua/modules/wxlua/src Modified Files: internal.cpp wxlbind.cpp wxlcallb.cpp wxlintrp.cpp wxlstate.cpp Log Message: Makefile - lib order is important cleanup in lconsole, wxlua app all static int s_wxXXX lua tags now s_wxluatag_wxXXX to make them easier to find functions to get the structs with the bindings are prepended with wxLuaXXX DECLARE/IMPLEMENT_CLASS replaced with either XXX_ABSTRACT/DYNAMIC_CLASS window ids for the stacktree now ID_WXLUA_XXX Index: internal.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/internal.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** internal.cpp 28 Nov 2005 06:05:08 -0000 1.15 --- internal.cpp 29 Nov 2005 05:45:09 -0000 1.16 *************** *** 37,62 **** #include "wxlua/include/internal.h" #include "wxlua/include/wxlcallb.h" - #include "wxbind/include/wxbind.h" #include "wxlua/include/wxlintrp.h" ! class wxStyledTextCtrlDocument; // for void* wxStyledTextCtrl::GetDocPointer() ! ! #ifdef FindText ! # undef FindText ! #endif ! ! // always defined in wxLuaWrap.cpp ! extern int s_wxIcon; ! extern int s_wxWindow; ! extern int s_wxEvtHandler; ! extern int s_wxEvent; ! extern int s_wxBitmap; ! ! //#if defined(__WXGTK__) || defined(__WXMAC__) || defined(__WXMOTIF__) ! // #include "../../../art/wxlua.xpm" //#endif extern int wxLuaEventListCompareFn(const void *p1, const void *p2); // in wxlbind.cpp // lua registry table const char wxLuaReferences[] = "wxLuaReferences"; --- 37,53 ---- #include "wxlua/include/internal.h" #include "wxlua/include/wxlcallb.h" #include "wxlua/include/wxlintrp.h" ! //#ifdef FindText ! //# undef FindText //#endif + extern wxLuaInterpreter *wxFindLuaInterpreter(lua_State *L); + extern int wxLuaEventListCompareFn(const void *p1, const void *p2); // in wxlbind.cpp + extern int s_wxluatag_wxBitmap; + extern int s_wxluatag_wxEvtHandler; + // lua registry table const char wxLuaReferences[] = "wxLuaReferences"; *************** *** 1070,1076 **** lua_State * LUACALL getDerivedMethod(void *pObject, const char *method, lua_State *L) { ! wxLuaState lS(L); ! wxCHECK_MSG(lS.Ok(), NULL, wxT("Invalid wxLuaState")); ! return lS.getDerivedMethod(pObject, method); /* --- 1061,1069 ---- lua_State * LUACALL getDerivedMethod(void *pObject, const char *method, lua_State *L) { ! wxLuaState wxlState(wxLuaState::getDerivedMethod(pObject, method)); ! if (!wxlState.Ok()) ! return NULL; ! ! return wxlState.GetLuaState(); /* *************** *** 1145,1149 **** else { ! if (wxlState.getDerivedMethod(pObject, cpIndex, L) != NULL) { fFound = true; --- 1138,1142 ---- else { ! if (wxlState.getDerivedMethod(pObject, cpIndex, L).Ok()) { fFound = true; *************** *** 1294,1298 **** int nParams = lua_gettop(L); ! wxEvtHandler *evtHandler = (wxEvtHandler *)wxlState.getuserdatatype(1, s_wxEvtHandler); switch (nParams) --- 1287,1291 ---- int nParams = lua_gettop(L); ! wxEvtHandler *evtHandler = (wxEvtHandler *)wxlState.getuserdatatype(1, s_wxluatag_wxEvtHandler); switch (nParams) *************** *** 1421,1425 **** #include "../art/help.xpm" ! wxCHECK_MSG(s_wxBitmap != -1, 1, wxT("wxBitmap is not wrapped by wxLua")); wxLuaState wxlState(L); --- 1414,1418 ---- #include "../art/help.xpm" ! wxCHECK_MSG(s_wxluatag_wxBitmap != -1, 1, wxT("wxBitmap is not wrapped by wxLua")); wxLuaState wxlState(L); *************** *** 1430,1469 **** returns = new wxBitmap(new_xpm); wxlState.addToTrackedMemoryList(returns); ! wxlState.pushuserdatatype(s_wxBitmap, returns ); lua_setglobal(L, "newBitmap"); returns = new wxBitmap(open_xpm); wxlState.addToTrackedMemoryList(returns); ! wxlState.pushuserdatatype(s_wxBitmap, returns ); lua_setglobal(L, "openBitmap"); returns = new wxBitmap(save_xpm); wxlState.addToTrackedMemoryList(returns); ! wxlState.pushuserdatatype(s_wxBitmap, returns ); lua_setglobal(L, "saveBitmap"); returns = new wxBitmap(saveall_xpm); wxlState.addToTrackedMemoryList(returns); ! wxlState.pushuserdatatype(s_wxBitmap, returns ); lua_setglobal(L, "saveAllBitmap"); returns = new wxBitmap(cut_xpm); wxlState.addToTrackedMemoryList(returns); ! wxlState.pushuserdatatype(s_wxBitmap, returns ); lua_setglobal(L, "cutBitmap"); returns = new wxBitmap(copy_xpm); wxlState.addToTrackedMemoryList(returns); ! wxlState.pushuserdatatype(s_wxBitmap, returns ); lua_setglobal(L, "copyBitmap"); returns = new wxBitmap(paste_xpm); wxlState.addToTrackedMemoryList(returns); ! wxlState.pushuserdatatype(s_wxBitmap, returns ); lua_setglobal(L, "pasteBitmap"); returns = new wxBitmap(help_xpm); wxlState.addToTrackedMemoryList(returns); ! wxlState.pushuserdatatype(s_wxBitmap, returns ); lua_setglobal(L, "helpBitmap"); --- 1423,1462 ---- returns = new wxBitmap(new_xpm); wxlState.addToTrackedMemoryList(returns); ! wxlState.pushuserdatatype(s_wxluatag_wxBitmap, returns ); lua_setglobal(L, "newBitmap"); returns = new wxBitmap(open_xpm); wxlState.addToTrackedMemoryList(returns); ! wxlState.pushuserdatatype(s_wxluatag_wxBitmap, returns ); lua_setglobal(L, "openBitmap"); returns = new wxBitmap(save_xpm); wxlState.addToTrackedMemoryList(returns); ! wxlState.pushuserdatatype(s_wxluatag_wxBitmap, returns ); lua_setglobal(L, "saveBitmap"); returns = new wxBitmap(saveall_xpm); wxlState.addToTrackedMemoryList(returns); ! wxlState.pushuserdatatype(s_wxluatag_wxBitmap, returns ); lua_setglobal(L, "saveAllBitmap"); returns = new wxBitmap(cut_xpm); wxlState.addToTrackedMemoryList(returns); ! wxlState.pushuserdatatype(s_wxluatag_wxBitmap, returns ); lua_setglobal(L, "cutBitmap"); returns = new wxBitmap(copy_xpm); wxlState.addToTrackedMemoryList(returns); ! wxlState.pushuserdatatype(s_wxluatag_wxBitmap, returns ); lua_setglobal(L, "copyBitmap"); returns = new wxBitmap(paste_xpm); wxlState.addToTrackedMemoryList(returns); ! wxlState.pushuserdatatype(s_wxluatag_wxBitmap, returns ); lua_setglobal(L, "pasteBitmap"); returns = new wxBitmap(help_xpm); wxlState.addToTrackedMemoryList(returns); ! wxlState.pushuserdatatype(s_wxluatag_wxBitmap, returns ); lua_setglobal(L, "helpBitmap"); Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** wxlstate.cpp 28 Nov 2005 06:05:08 -0000 1.8 --- wxlstate.cpp 29 Nov 2005 05:45:09 -0000 1.9 *************** *** 42,47 **** #include "wxlua/include/wxlstate.h" #include "wxlua/include/wxlcallb.h" ! #include "wxbind/include/wxbind.h" #include "wxlua/include/wxlintrp.h" extern int wxLuaEventListCompareFn(const void *p1, const void *p2); // wxlbind.cpp --- 42,48 ---- #include "wxlua/include/wxlstate.h" #include "wxlua/include/wxlcallb.h" ! //#include "wxbind/include/wxbind.h" #include "wxlua/include/wxlintrp.h" + #include "wxlua/include/internal.h" extern int wxLuaEventListCompareFn(const void *p1, const void *p2); // wxlbind.cpp *************** *** 50,53 **** --- 51,58 ---- const char *wxLuaNull; // in internal.cpp + extern int s_wxluatag_wxWindow; + + wxLuaState wxNullLuaState; + // ---------------------------------------------------------------------------- // wxFindWindowByPointer - find a window by it's pointer *************** *** 206,211 **** // always add wxWidgets binding ! m_bindings.Append(new wx_Binding()); ! m_bindings.DeleteContents(true); } --- 211,225 ---- // always add wxWidgets binding ! //m_bindings.Append(new wx_Binding()); // FIXME remove this ! //m_bindings.DeleteContents(true); ! ! m_bindings.DeleteContents(false); ! ! wxLuaBindingList::Node *node; ! for (node = wxLuaBinding::GetBindingsList()->GetFirst(); node; node = node->GetNext() ) ! { ! wxLuaBinding* binding = node->GetData(); ! m_bindings.Append(binding); ! } } *************** *** 1113,1117 **** { // if the object we are referencing is derived from wxWindow ! if (IsDerivedClass(iTag, s_wxWindow)) { wxWindow *win = wxDynamicCast(data, wxWindow); --- 1127,1131 ---- { // if the object we are referencing is derived from wxWindow ! if (IsDerivedClass(iTag, s_wxluatag_wxWindow)) { wxWindow *win = wxDynamicCast(data, wxWindow); *************** *** 1492,1496 **** // If the method can be found, push it on to the Lua stack and return 1 // otherwise return 0 and nothing is pushed. ! lua_State* wxLuaState::getDerivedMethod(void *pObject, const char *method, lua_State *L) { if (L) --- 1506,1510 ---- // If the method can be found, push it on to the Lua stack and return 1 // otherwise return 0 and nothing is pushed. ! wxLuaState wxLuaState::getDerivedMethod(void *pObject, const char *method, lua_State *L) { if (L) *************** *** 1504,1508 **** wxLuaObject *pLuaObject = (wxLuaObject *) pHashTable->Get(lua2wx(method)); if ((pLuaObject != NULL) && pLuaObject->GetObject()) ! return pLuaObject->GetLuaState(); } } --- 1518,1522 ---- wxLuaObject *pLuaObject = (wxLuaObject *) pHashTable->Get(lua2wx(method)); if ((pLuaObject != NULL) && pLuaObject->GetObject()) ! return pLuaObject->GetwxLuaState(); } } *************** *** 1522,1526 **** wxLuaObject *pLuaObject = (wxLuaObject *) pHashTable->Get(lua2wx(method)); if ((pLuaObject != NULL) && pLuaObject->GetObject()) ! return pLuaObject->GetLuaState(); } } --- 1536,1540 ---- wxLuaObject *pLuaObject = (wxLuaObject *) pHashTable->Get(lua2wx(method)); if ((pLuaObject != NULL) && pLuaObject->GetObject()) ! return pLuaObject->GetwxLuaState(); } } *************** *** 1528,1532 **** } ! return NULL; } --- 1542,1547 ---- } ! wxLuaState wxlState; ! return wxlState; } Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxlbind.cpp 28 Nov 2005 06:05:08 -0000 1.4 --- wxlbind.cpp 29 Nov 2005 05:45:09 -0000 1.5 *************** *** 49,53 **** // ---------------------------------------------------------------------------- ! IMPLEMENT_CLASS(wxLuaBinding, wxObject) wxLuaBinding::wxLuaBinding() : wxObject(), --- 49,55 ---- // ---------------------------------------------------------------------------- ! IMPLEMENT_DYNAMIC_CLASS(wxLuaBinding, wxObject) ! ! wxLuaBindingList wxLuaBinding::sm_bindings; wxLuaBinding::wxLuaBinding() : wxObject(), Index: wxlintrp.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlintrp.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxlintrp.cpp 28 Nov 2005 06:05:08 -0000 1.4 --- wxlintrp.cpp 29 Nov 2005 05:45:09 -0000 1.5 *************** *** 30,34 **** #include "wxlua/include/internal.h" - extern int s_wxLuaInterpreter; extern bool wxLuaCleanupWindows(wxList *list, bool only_check); // in wxlstate.cpp --- 30,33 ---- Index: wxlcallb.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlcallb.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** wxlcallb.cpp 28 Nov 2005 06:05:08 -0000 1.5 --- wxlcallb.cpp 29 Nov 2005 05:45:09 -0000 1.6 *************** *** 26,30 **** #include "wxlua/include/wxlcallb.h" ! extern int s_wxEvent; //----------------------------------------------------------------------------- --- 26,30 ---- #include "wxlua/include/wxlcallb.h" ! extern int s_wxluatag_wxEvent; //----------------------------------------------------------------------------- *************** *** 32,36 **** //----------------------------------------------------------------------------- ! IMPLEMENT_CLASS(wxLuaCallback, wxEvtHandler); // Encapsulate a lua function reference for use by a event callback --- 32,36 ---- //----------------------------------------------------------------------------- ! IMPLEMENT_ABSTRACT_CLASS(wxLuaCallback, wxEvtHandler); // Encapsulate a lua function reference for use by a event callback *************** *** 133,137 **** return; ! int eventClassTag = s_wxEvent; const WXLUAEVENT *pLuaEvent = m_wxlState.GetLuaEvent(pEvent); --- 133,137 ---- return; ! int eventClassTag = s_wxluatag_wxEvent; const WXLUAEVENT *pLuaEvent = m_wxlState.GetLuaEvent(pEvent); *************** *** 162,166 **** // ---------------------------------------------------------------------------- ! IMPLEMENT_CLASS(wxLuaDestroyCallback, wxEvtHandler); wxLuaDestroyCallback::wxLuaDestroyCallback(const wxLuaState& state, int id, --- 162,166 ---- // ---------------------------------------------------------------------------- ! IMPLEMENT_ABSTRACT_CLASS(wxLuaDestroyCallback, wxEvtHandler); wxLuaDestroyCallback::wxLuaDestroyCallback(const wxLuaState& state, int id, |