From: John L. <jr...@us...> - 2007-12-05 00:34:50
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv21421/wxLua/modules/wxlua/include Modified Files: wxlbind.h wxlstate.h Log Message: Removed the rest of "UnregisterBinding" functions since they did nothing useful Moved binding base class linking code to wxLuaBinding::InitAllBindings from wxLuaState::RegisterBindings Removed wxLuaStateData::m_winDestroyCallbackList and wxLuaStateData::m_callbackList and added two registry tables for their values. Should be faster and easier to verify operation. Fix searching in the wxLuaStackDialog. Index: wxlbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlbind.h,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** wxlbind.h 4 Dec 2007 05:20:28 -0000 1.66 --- wxlbind.h 5 Dec 2007 00:34:46 -0000 1.67 *************** *** 393,398 **** // Binds C Functions/Defines/Object/Events to namespace Lua Table virtual bool RegisterBinding(const wxLuaState& wxlState); - // Unbinds C Functions/Defines/Object/Events by clearing namespace Lua table - virtual void UnRegisterBinding(const wxLuaState& wxlState); // ----------------------------------------------------------------------- --- 393,396 ---- *************** *** 427,431 **** // Is this tag defined as something in this binding? ! bool IsTag(int tag) { return (tag >= m_start_tag) && (tag <= m_last_tag); } // Look for the base class of the input wxLuaBindClass in this binding using the --- 425,429 ---- // Is this tag defined as something in this binding? ! bool HasTag(int tag) const { return (tag >= m_start_tag) && (tag <= m_last_tag); } // Look for the base class of the input wxLuaBindClass in this binding using the *************** *** 472,475 **** --- 470,479 ---- static wxLuaBindingList* GetBindingList() { return &sm_bindingList; } + + // Initialize all of the bindings by iterating the GetBindingList() and + // setting the base classes and base class functions. This function + // is automatically run by the wxLuaState and should not ever need to be called. + static void InitAllBindings(bool force_update = false); + protected: void InitBinding(); // must called after subclassed version is created *************** *** 508,511 **** --- 512,516 ---- static wxLuaBindingList sm_bindingList; + static bool sm_bindingList_initialized; DECLARE_ABSTRACT_CLASS(wxLuaBinding) Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -d -r1.98 -r1.99 *** wxlstate.h 4 Dec 2007 05:20:28 -0000 1.98 --- wxlstate.h 5 Dec 2007 00:34:46 -0000 1.99 *************** *** 100,105 **** extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_wxluastate_key; // The key in the LUA_REGISTRYINDEX table that is table of all ! // objects that we've pushed into Lua using t[lightuserdata] = [weak valued full userdata] extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_objects_key; // The key in the LUA_REGISTRYINDEX table that is a boolean value // of whether the Lua code has prepended a '_' to function name to indicate --- 100,114 ---- extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_wxluastate_key; // The key in the LUA_REGISTRYINDEX table that is table of all ! // objects that we've pushed into Lua. t[lightuserdata] = [weak valued full userdata] extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_objects_key; + // The key in the LUA_REGISTRYINDEX table that is table of all + // wxLuaCallbacks that we've created. + // t[lightuserdata wxLuaCallback] = lightuserdata wxEvtHandler + extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_evtcallbacks_key; + // The key in the LUA_REGISTRYINDEX table that is table of all + // wxLuaWinDestroyCallbacks that we've created. + // t[lightuserdata wxLuaWinDestroyCallback] = 1 (the number 1) + // t[lightuserdata wxWindow] = lightuserdata wxLuaWinDestroyCallback + extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_windestroycallbacks_key; // The key in the LUA_REGISTRYINDEX table that is a boolean value // of whether the Lua code has prepended a '_' to function name to indicate *************** *** 107,110 **** --- 116,120 ---- extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_callbaseclassfunc_key; + // Light user data used as keys in the metatables created for the class userdata objects. // Note that even though these have values, they're not used, just the memory address. *************** *** 325,329 **** bool m_bindings_registered; // Are the bindings registered into the lua_State ! wxEventType m_inEventType; // wxEventType set when in event, else wxEVT_NULL wxLongToLongHashMap m_trackedObjects; // tracked wxObjects that we will delete when the --- 335,339 ---- bool m_bindings_registered; // Are the bindings registered into the lua_State ! wxEventType m_inEventType; // wxEventType set when in event, else wxEVT_NULL wxLongToLongHashMap m_trackedObjects; // tracked wxObjects that we will delete when the *************** *** 333,338 **** // wxLUA_DECLARE_ENCAPSULATION so the key is the object pointer // and the value is the wxObject encapsulation. - wxList m_callbackList; // installed wxLuaCallbacks - wxList m_winDestroyCallbackList; // installed wxLuaWinDestroyCallbacks wxWindowList m_windowList; // all wxWindow objects, wxWidgets will delete these // but for an embedded program they must be deleted before --- 343,346 ---- *************** *** 374,379 **** // clear all wxLuaCallbacks on destruction void ClearCallbacks(); - // remove all the bindings - void UnRegisterBindings(); // ------------------------------------------------------------------------ --- 382,385 ---- *************** *** 675,679 **** void AddTrackedCallback(wxLuaCallback* callback); bool RemoveTrackedCallback(wxLuaCallback* callback); - wxList* GetTrackedCallbackList(); // Get an array of strings "wxEVT_XXX (wxEventType #) count#" wxArrayString GetTrackedCallbackStrings(); --- 681,684 ---- *************** *** 682,686 **** void AddTrackedWinDestroyCallback(wxLuaWinDestroyCallback* callback); bool RemoveTrackedWinDestroyCallback(wxLuaWinDestroyCallback* callback); - wxList* GetTrackedWinDestroyCallbackList(); // Get an array of strings "wxWindow_classname count#" wxArrayString GetTrackedWinDestroyCallbackStrings(); --- 687,690 ---- |