From: John L. <jr...@us...> - 2006-05-14 17:45:10
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv21439/wxLua/modules/wxluadebug/src Modified Files: staktree.cpp Log Message: init all image handlers in luamodule to make things easy simplify wxLuaSmartXXX by adding operator type*() so it can be used as is fix lua callback to clear the correct wxluastate and some formatting add destroy handler list to things shown in the stacktree and show items for them Index: staktree.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/staktree.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** staktree.cpp 14 May 2006 07:48:09 -0000 1.23 --- staktree.cpp 14 May 2006 17:45:05 -0000 1.24 *************** *** 30,33 **** --- 30,34 ---- #include "wxlua/include/internal.h" #include "wxlua/include/wxlua.h" + #include "wxlua/include/wxlcallb.h" #include "wxluadebug/include/wxldebug.h" *************** *** 375,395 **** wxCHECK_RET(wxlState.Ok(), wxT("Invalid wxLuaState")); ! int derivedCount = wxlState.GetLuaStateData()->m_pDerivedList.size(); ! int trackedCount = wxlState.GetLuaStateData()->m_pTrackedList.size(); ! int eventHandlerCount = wxlState.GetLuaStateData()->m_eventHandlerList.GetCount(); ! int windowCount = wxlState.GetLuaStateData()->m_windowList.GetCount(); ! wxLuaDebugDataItem* derivedItem = new wxLuaDebugDataItem(_("Derived List"), wxT("wxLuaData"), wxString::Format(wxT("%d"), derivedCount), wxT(""), LUA_NOREF, 0); ! wxLuaDebugDataItem* trackedItem = new wxLuaDebugDataItem(_("Tracked List"), wxT("wxLuaData"), wxString::Format(wxT("%d"), trackedCount), wxT(""), LUA_NOREF, 0); ! wxLuaDebugDataItem* eventHandlerItem = new wxLuaDebugDataItem(_("Event Handler List"), wxT("wxLuaData"), wxString::Format(wxT("%d"), eventHandlerCount), wxT(""), LUA_NOREF, 0); ! wxLuaDebugDataItem* windowItem = new wxLuaDebugDataItem(_("wxWindow List"), wxT("wxLuaData"), wxString::Format(wxT("%d"), windowCount), wxT(""), LUA_NOREF, 0); treeControl->AppendItem(rootItem, wxT("Derived List"), 1, 1, derivedItem); ! wxTreeItemId treeNode = treeControl->AppendItem(rootItem, wxT("Tracked List"), 1, 1, trackedItem); if (trackedCount > 0) m_treeControl->SetItemHasChildren(treeNode); ! ! treeControl->AppendItem(rootItem, wxT("Event Handler List"), 1, 1, eventHandlerItem); ! treeControl->AppendItem(rootItem, wxT("wxWindow List"), 1, 1, windowItem); } --- 376,402 ---- wxCHECK_RET(wxlState.Ok(), wxT("Invalid wxLuaState")); ! int derivedCount = wxlState.GetLuaStateData()->m_pDerivedList.size(); ! int trackedCount = wxlState.GetLuaStateData()->m_pTrackedList.size(); ! int evtHandlerCount = wxlState.GetTrackedEventHandlerList()->GetCount(); ! int windowCount = wxlState.GetLuaStateData()->m_windowList.GetCount(); ! int destroyCount = wxlState.GetLuaStateData()->m_destroyHandlerList.GetCount(); ! wxLuaDebugDataItem* derivedItem = new wxLuaDebugDataItem(_("Derived List"), wxT("wxLuaData"), wxString::Format(wxT("%d"), derivedCount), wxT(""), LUA_NOREF, 0); ! wxLuaDebugDataItem* trackedItem = new wxLuaDebugDataItem(_("Tracked List"), wxT("wxLuaData"), wxString::Format(wxT("%d"), trackedCount), wxT(""), LUA_NOREF, 0); ! wxLuaDebugDataItem* evtHandlerItem = new wxLuaDebugDataItem(_("Event Handler List"), wxT("wxLuaData"), wxString::Format(wxT("%d"), evtHandlerCount), wxT(""), LUA_NOREF, 0); ! wxLuaDebugDataItem* windowItem = new wxLuaDebugDataItem(_("wxWindow List"), wxT("wxLuaData"), wxString::Format(wxT("%d"), windowCount), wxT(""), LUA_NOREF, 0); ! wxLuaDebugDataItem* destroyItem = new wxLuaDebugDataItem(_("wxWindow Destroy List"), wxT("wxLuaData"), wxString::Format(wxT("%d"), destroyCount), wxT(""), LUA_NOREF, 0); ! ! wxTreeItemId treeNode; treeControl->AppendItem(rootItem, wxT("Derived List"), 1, 1, derivedItem); ! treeNode = treeControl->AppendItem(rootItem, wxT("Tracked List"), 1, 1, trackedItem); if (trackedCount > 0) m_treeControl->SetItemHasChildren(treeNode); ! treeNode = treeControl->AppendItem(rootItem, wxT("Event Handler List"), 1, 1, evtHandlerItem); ! if (evtHandlerCount > 0) m_treeControl->SetItemHasChildren(treeNode); ! treeNode = treeControl->AppendItem(rootItem, wxT("wxWindow List"), 1, 1, windowItem); ! if (windowCount > 0) m_treeControl->SetItemHasChildren(treeNode); ! treeNode = treeControl->AppendItem(rootItem, wxT("wxWindow Destroy List"), 1, 1, destroyItem); } *************** *** 428,446 **** } } ! else if (m_luaInterface->GetwxLuaState().Ok() && ! (pDebugData->GetName() == _("Tracked List"))) { wxLuaState wxlState(m_luaInterface->GetwxLuaState()); ! ! wxLongToLongHashMap::iterator it; ! wxLongToLongHashMap* hashMap = &wxlState.GetLuaStateRefData()->m_wxlStateData->m_pTrackedList; wxArrayString names; wxArrayInt counts; ! for (it = hashMap->begin(); it != hashMap->end(); ++it) { ! wxObject* obj = (wxObject*)it->second; ! if (obj && obj->GetClassInfo() && obj->GetClassInfo()->GetClassName()) { ! wxString name(obj->GetClassInfo()->GetClassName()); int idx = names.Index(name); if (idx == wxNOT_FOUND) --- 435,478 ---- } } ! else if (m_luaInterface->GetwxLuaState().Ok() && ! ((pDebugData->GetName() == _("Tracked List")) || ! (pDebugData->GetName() == _("Event Handler List")) || ! (pDebugData->GetName() == _("wxWindow List")))) { wxLuaState wxlState(m_luaInterface->GetwxLuaState()); ! wxArrayString names; wxArrayInt counts; ! ! if (pDebugData->GetName() == _("Tracked List")) { ! wxLongToLongHashMap::iterator it; ! wxLongToLongHashMap* hashMap = &wxlState.GetLuaStateRefData()->m_wxlStateData->m_pTrackedList; ! ! for (it = hashMap->begin(); it != hashMap->end(); ++it) { ! wxObject* obj = (wxObject*)it->second; ! if (obj && obj->GetClassInfo() && obj->GetClassInfo()->GetClassName()) ! { ! wxString name(obj->GetClassInfo()->GetClassName()); ! int idx = names.Index(name); ! if (idx == wxNOT_FOUND) ! { ! names.Add(name); ! counts.Add(1); ! } ! else ! counts[idx]++; ! } ! } ! } ! else if (pDebugData->GetName() == _("Event Handler List")) ! { ! wxNode* node = wxlState.GetTrackedEventHandlerList()->GetFirst(); ! while (node) ! { ! wxLuaCallback *pCallback = (wxLuaCallback *) node->GetData(); ! wxCHECK_RET(pCallback, wxT("Invalid wxLuaCallback")); ! wxString name = wxString::Format(wxT("Evt type %d"), (int)pCallback->GetEventType()); int idx = names.Index(name); if (idx == wxNOT_FOUND) *************** *** 451,457 **** else counts[idx]++; } } ! wxLuaDebugData* dataArr = new wxLuaDebugData; size_t n, count = names.GetCount(); --- 483,514 ---- else counts[idx]++; + + node = node->GetNext(); } } ! else ! { ! wxNode* node = wxlState.GetLuaStateData()->m_windowList.GetFirst(); ! while (node) ! { ! wxWindow *win= (wxWindow*)node->GetData(); ! wxCHECK_RET(win, wxT("Invalid wxLuaCallback")); ! if (win && win->GetClassInfo() && win->GetClassInfo()->GetClassName()) ! { ! wxString name(win->GetClassInfo()->GetClassName()); ! int idx = names.Index(name); ! if (idx == wxNOT_FOUND) ! { ! names.Add(name); ! counts.Add(1); ! } ! else ! counts[idx]++; ! } ! ! node = node->GetNext(); ! } ! } ! wxLuaDebugData* dataArr = new wxLuaDebugData; size_t n, count = names.GetCount(); *************** *** 461,468 **** dataArr->Add(item); } ! FillTableEntry(itemNode, dataArr); delete dataArr; ! } } } --- 518,525 ---- dataArr->Add(item); } ! FillTableEntry(itemNode, dataArr); delete dataArr; ! } } } |