From: John L. <jr...@us...> - 2009-11-17 06:11:13
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/src In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv2334/wxLua/modules/wxluadebug/src Modified Files: wxldebug.cpp wxlstack.cpp Log Message: Make collapsing in the wxLuaStackDialog MUCH faster by not recursively calling Collapse(). Tabs to spaces in wxluacan. Index: wxlstack.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxlstack.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** wxlstack.cpp 15 Nov 2009 17:56:04 -0000 1.32 --- wxlstack.cpp 17 Nov 2009 06:11:04 -0000 1.33 *************** *** 92,115 **** wxCHECK_MSG(debugItem, -1, wxT("Invalid wxLuaDebugItem item")); ! if (column == wxLuaStackDialog::LIST_COL_KEY) ! return m_stkDlg->GetItemImage(debugItem); ! else if (column == wxLuaStackDialog::LIST_COL_KEY_TYPE) { ! if (debugItem->GetFlagBit(WXLUA_DEBUGITEM_KEY_REF)) { ! if (debugItem->GetFlagBit(WXLUA_DEBUGITEM_EXPANDED)) ! return wxLuaStackDialog::IMG_TABLE_OPEN; ! else ! return wxLuaStackDialog::IMG_TABLE; } ! } ! else if (column == wxLuaStackDialog::LIST_COL_VALUE_TYPE) ! { ! if (debugItem->GetFlagBit(WXLUA_DEBUGITEM_VALUE_REF)) { ! if (debugItem->GetFlagBit(WXLUA_DEBUGITEM_EXPANDED)) ! return wxLuaStackDialog::IMG_TABLE_OPEN; ! else ! return wxLuaStackDialog::IMG_TABLE; } } --- 92,120 ---- wxCHECK_MSG(debugItem, -1, wxT("Invalid wxLuaDebugItem item")); ! switch (column) { ! case wxLuaStackDialog::LIST_COL_KEY : { ! return m_stkDlg->GetItemImage(debugItem); } ! case wxLuaStackDialog::LIST_COL_KEY_TYPE : { ! if (debugItem->GetFlagBit(WXLUA_DEBUGITEM_KEY_REF)) ! { ! if (debugItem->GetFlagBit(WXLUA_DEBUGITEM_EXPANDED)) ! return wxLuaStackDialog::IMG_TABLE_OPEN; ! else ! return wxLuaStackDialog::IMG_TABLE; ! } ! } ! case wxLuaStackDialog::LIST_COL_VALUE_TYPE : ! { ! if (debugItem->GetFlagBit(WXLUA_DEBUGITEM_VALUE_REF)) ! { ! if (debugItem->GetFlagBit(WXLUA_DEBUGITEM_EXPANDED)) ! return wxLuaStackDialog::IMG_TABLE_OPEN; ! else ! return wxLuaStackDialog::IMG_TABLE; ! } } } *************** *** 545,549 **** wxString name(item->GetKey()); if (n == count - 1) name += wxT(" (Globals)"); ! m_stackChoice->Append(name); } --- 550,554 ---- wxString name(item->GetKey()); if (n == count - 1) name += wxT(" (Globals)"); ! m_stackChoice->Append(name); } *************** *** 950,953 **** --- 955,960 ---- void wxLuaStackDialog::OnListItem(wxListEvent &event) { + if (m_batch_count > 0) return; + long list_item = event.GetIndex(); *************** *** 1010,1015 **** wxCHECK_MSG(debugItem != NULL, false, wxT("Invalid debug item")); - int nRef = debugItem->GetRef(); - if (!debugItem->GetFlagBit(WXLUA_DEBUGITEM_EXPANDED)) { --- 1017,1020 ---- *************** *** 1024,1029 **** FillTableEntry(lc_item, stkListData->m_childrenDebugData); ! expanded = true; ! return true; } --- 1029,1034 ---- FillTableEntry(lc_item, stkListData->m_childrenDebugData); ! ! return true; // expanded = true } *************** *** 1034,1040 **** wxCHECK_MSG(debugItem->GetRefPtr(long_key), false, wxT("Invalid table item")); ! if (m_expandedItems[long_key]) { ! if (m_show_dup_expand_msg) { wxMessageBox(wxT("Cannot expand linked tables,\nplease see the already expanded table."), --- 1039,1045 ---- wxCHECK_MSG(debugItem->GetRefPtr(long_key), false, wxT("Invalid table item")); ! if (m_expandedItems[long_key]) // linked tables { ! if (m_show_dup_expand_msg) // don't bother when expanding all children { wxMessageBox(wxT("Cannot expand linked tables,\nplease see the already expanded table."), *************** *** 1048,1067 **** m_listCtrl->EnsureVisible(n); } - - return false; } ! } ! ! if (nRef != LUA_NOREF) ! { ! debugItem->SetFlagBit(WXLUA_DEBUGITEM_EXPANDED, true); ! long long_key = 0; ! wxCHECK_MSG(debugItem->GetRefPtr(long_key), false, wxT("Invalid table item")); ! m_expandedItems[long_key] = (long)stkListData; ! int nIndex = debugItem->GetIndex() + 1; ! EnumerateTable(nRef, nIndex, lc_item); ! expanded = true; } } --- 1053,1066 ---- m_listCtrl->EnsureVisible(n); } } ! else ! { ! debugItem->SetFlagBit(WXLUA_DEBUGITEM_EXPANDED, true); ! m_expandedItems[long_key] = (long)stkListData; ! EnumerateTable(debugItem->GetRef(), debugItem->GetIndex() + 1, lc_item); ! expanded = true; ! } } } *************** *** 1098,1102 **** wxLuaStackListData* stkListData_n = (wxLuaStackListData*)m_listData[n]; ! if ((n > lc_item) && (stkListData_n->m_level <= level)) break; if (counter % 50 == 0) --- 1097,1102 ---- wxLuaStackListData* stkListData_n = (wxLuaStackListData*)m_listData[n]; ! if ((n > lc_item) && (stkListData_n->m_level <= level)) ! break; if (counter % 50 == 0) *************** *** 1136,1144 **** if (debugItem->GetFlagBit(WXLUA_DEBUGITEM_EXPANDED)) { ! BeginBatch(); ! wxLuaDebugData childData = stkListData->m_childrenDebugData; if (childData.Ok()) { long n, count = m_listCtrl->GetItemCount(); --- 1136,1145 ---- if (debugItem->GetFlagBit(WXLUA_DEBUGITEM_EXPANDED)) { ! BeginBatch(); ! wxLuaDebugData childData = stkListData->m_childrenDebugData; if (childData.Ok()) { + int level = stkListData->m_level; long n, count = m_listCtrl->GetItemCount(); *************** *** 1148,1180 **** wxCHECK_MSG(stkListData_n != NULL, false, wxT("Invalid wxLuaStack data")); ! if (stkListData_n->m_parentDebugData == childData) ! { ! if (stkListData_n->m_childrenDebugData.Ok() && ! stkListData_n->GetDebugItem()->GetFlagBit(WXLUA_DEBUGITEM_EXPANDED)) ! { ! long long_key = 0; ! if (stkListData_n->GetDebugItem()->GetRefPtr(long_key)) ! m_expandedItems.erase(long_key); ! CollapseItem(n); ! n--; count = m_listData.GetCount(); ! continue; ! } ! collapsed = true; // only if we removed anything ! if (stkListData_n->m_treeId) ! m_treeCtrl->Delete(stkListData_n->m_treeId); ! m_listData.RemoveAt(n); ! if (stkListData_n != NULL) ! delete stkListData_n; ! n--; count = m_listData.GetCount(); ! } ! } ! } // don't call collapse here, let MSW do it if this is called from OnTreeItem --- 1149,1186 ---- wxCHECK_MSG(stkListData_n != NULL, false, wxT("Invalid wxLuaStack data")); ! // are we finished with the original expanded item ! if (stkListData_n->m_level <= level) ! break; ! collapsed = true; // only if we removed anything ! // remove all expanded children items ! if (stkListData_n->m_childrenDebugData.Ok() && ! stkListData_n->GetDebugItem()->GetFlagBit(WXLUA_DEBUGITEM_EXPANDED)) ! { ! long long_key = 0; ! if (stkListData_n->GetDebugItem()->GetRefPtr(long_key)) ! m_expandedItems.erase(long_key); ! } ! ! // note that the debug item is a member of the parent debug data array ! stkListData_n->GetDebugItem()->SetFlagBit(WXLUA_DEBUGITEM_EXPANDED, false); ! //m_listData.RemoveAt(n); // we remove them all at once for speed, see below ! //n--; ! //count = m_listData.GetCount(); ! delete stkListData_n; ! } ! m_listData.RemoveAt(lc_item+1, n-lc_item-1); ! } ! long long_key = 0; ! if (debugItem->GetRefPtr(long_key)) ! m_expandedItems.erase(long_key); ! debugItem->SetFlagBit(WXLUA_DEBUGITEM_EXPANDED, false); ! m_listCtrl->SetItemCount(m_listData.GetCount()); // don't call collapse here, let MSW do it if this is called from OnTreeItem *************** *** 1184,1196 **** m_treeCtrl->AppendItem(stkListData->m_treeId, DUMMY_TREEITEM); - debugItem->SetFlagBit(WXLUA_DEBUGITEM_EXPANDED, false); - - long long_key = 0; - if (debugItem->GetRefPtr(long_key)) - m_expandedItems.erase(long_key); - - m_listCtrl->SetItemCount(m_listData.GetCount()); EndBatch(); ! } return collapsed; --- 1190,1195 ---- m_treeCtrl->AppendItem(stkListData->m_treeId, DUMMY_TREEITEM); EndBatch(); ! } return collapsed; *************** *** 1207,1212 **** wxLuaStackListData* stkListData = (wxLuaStackListData*)m_listData[i]; ! if (stkListData != NULL) ! delete stkListData; } --- 1206,1210 ---- wxLuaStackListData* stkListData = (wxLuaStackListData*)m_listData[i]; ! delete stkListData; } *************** *** 1263,1267 **** // Sanity check to make sure that we've cleared all the references // There should be only one of us created at any time. ! if (0) { //wxLuaCheckStack cs(L, wxT("wxLuaStackDialog::RemoveAllLuaReferences")); lua_pushlightuserdata(L, &wxlua_lreg_debug_refs_key); // push name of table to get as key --- 1261,1265 ---- // Sanity check to make sure that we've cleared all the references // There should be only one of us created at any time. ! if (1) { //wxLuaCheckStack cs(L, wxT("wxLuaStackDialog::RemoveAllLuaReferences")); lua_pushlightuserdata(L, &wxlua_lreg_debug_refs_key); // push name of table to get as key *************** *** 1281,1285 **** lua_pop(L, 1); // pop ref table ! } // Clear out the old numeric references since it should be "empty" // though full of dead table[idx]=next_idx, where table[0] = 1; --- 1279,1283 ---- lua_pop(L, 1); // pop ref table ! } // Clear out the old numeric references since it should be "empty" // though full of dead table[idx]=next_idx, where table[0] = 1; Index: wxldebug.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxldebug.cpp,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** wxldebug.cpp 15 Nov 2009 17:56:04 -0000 1.70 --- wxldebug.cpp 17 Nov 2009 06:11:03 -0000 1.71 *************** *** 139,142 **** --- 139,143 ---- long l1 = 0, l2 = 0; + // Don't sort numbers by their string representation, but by their value if ((elem1->m_itemKeyType == WXLUA_TNUMBER) && (elem2->m_itemKeyType == WXLUA_TNUMBER) && *************** *** 222,225 **** --- 223,227 ---- int stack_idx = 1; wxString name(lua2wx(lua_getlocal(L, &luaDebug, stack_idx))); + while (!name.IsEmpty()) { *************** *** 540,545 **** int wxl_type = wxlua_luatowxluatype(l_type); - if (wxl_type_) *wxl_type_ = wxl_type; - switch (l_type) { --- 542,545 ---- *************** *** 611,614 **** --- 611,616 ---- } + if (wxl_type_) *wxl_type_ = wxl_type; + return l_type; } |