From: John L. <jr...@us...> - 2007-12-02 20:57:38
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv543/wxLua/modules/wxluadebug/src Modified Files: wxldebug.cpp wxlstack.cpp Log Message: Fix collapse bug in stack dialog Index: wxlstack.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxlstack.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** wxlstack.cpp 30 Nov 2007 23:00:08 -0000 1.20 --- wxlstack.cpp 2 Dec 2007 20:57:34 -0000 1.21 *************** *** 77,117 **** wxString wxLuaStackListCtrl::OnGetItemText(long item, long column) const { ! wxLuaStackListData* stkListData = (wxLuaStackListData*)m_stkDlg->m_listData[item]; ! wxCHECK_MSG(stkListData, wxEmptyString, wxT("Invalid wxLuaStackListData item")); ! wxLuaDebugItem* debugItem = stkListData->GetDebugItem(); ! wxCHECK_MSG(debugItem, wxEmptyString, wxT("Invalid wxLuaDebugItem item")); ! ! switch (column) ! { ! case 0: ! if (stkListData->m_level > 0) ! { ! wxString s(wxT("-->")); ! for (int i = 1; i < stkListData->m_level; ++i) s += wxT("-->"); ! return s + debugItem->GetKey(); ! } ! else ! return debugItem->GetKey(); ! case 1: ! return wxString::Format(wxT("%d:%d"), stkListData->m_level+1, stkListData->m_item_idx+1); ! case 2: ! return debugItem->GetKeyTypeString(); ! case 3: ! return debugItem->GetValueTypeString(); ! case 4: ! { ! wxString value(debugItem->GetValue()); ! if (value.Length() > 200) value = value.Mid(0, 200) + wxT("... <snip>"); ! value.Replace(wxT("\n"), wxT("\\n")); ! value.Replace(wxT("\r"), wxT("\\r")); ! return value; ! } ! } ! ! return wxEmptyString; } int wxLuaStackListCtrl::OnGetItemImage(long item) const { ! return -1; } int wxLuaStackListCtrl::OnGetItemColumnImage(long item, long column) const --- 77,85 ---- wxString wxLuaStackListCtrl::OnGetItemText(long item, long column) const { ! return m_stkDlg->GetItemText(item, column); } int wxLuaStackListCtrl::OnGetItemImage(long item) const { ! return -1; // use OnGetItemColumnImage() } int wxLuaStackListCtrl::OnGetItemColumnImage(long item, long column) const *************** *** 171,176 **** EVT_TREE_SEL_CHANGED( ID_WXLUA_STACK_TREECTRL, wxLuaStackDialog::OnTreeItem) ! EVT_LIST_ITEM_SELECTED( ID_WXLUA_STACK_LISTCTRL, wxLuaStackDialog::OnListItemActivated) ! EVT_LIST_ITEM_ACTIVATED( ID_WXLUA_STACK_LISTCTRL, wxLuaStackDialog::OnListItemActivated) EVT_LIST_ITEM_RIGHT_CLICK( ID_WXLUA_STACK_LISTCTRL, wxLuaStackDialog::OnListRightClick) END_EVENT_TABLE() --- 139,144 ---- EVT_TREE_SEL_CHANGED( ID_WXLUA_STACK_TREECTRL, wxLuaStackDialog::OnTreeItem) ! EVT_LIST_ITEM_SELECTED( ID_WXLUA_STACK_LISTCTRL, wxLuaStackDialog::OnListItem) ! EVT_LIST_ITEM_ACTIVATED( ID_WXLUA_STACK_LISTCTRL, wxLuaStackDialog::OnListItem) EVT_LIST_ITEM_RIGHT_CLICK( ID_WXLUA_STACK_LISTCTRL, wxLuaStackDialog::OnListRightClick) END_EVENT_TABLE() *************** *** 287,298 **** m_findMenu = new wxMenu(wxT("Find Options"), 0); ! m_findMenu->Append(ID_WXLUA_STACK_FINDMENU_CASE, wxT("&Case sensitive"), wxT("Case sensitive searching"), wxITEM_CHECK); m_findMenu->AppendSeparator(); ! m_findMenu->Append(ID_WXLUA_STACK_FINDMENU_ALL, wxT("Search everywhere"), wxT("Search in all columns"), wxITEM_CHECK); ! m_findMenu->Append(ID_WXLUA_STACK_FINDMENU_NAME, wxT("Search names"), wxT("Search in name column"), wxITEM_CHECK); ! m_findMenu->Append(ID_WXLUA_STACK_FINDMENU_LEVEL, wxT("Search level"), wxT("Search in level column"), wxITEM_CHECK); ! m_findMenu->Append(ID_WXLUA_STACK_FINDMENU_KEYTYPE, wxT("Search key type"), wxT("Search in key type column"), wxITEM_CHECK); ! m_findMenu->Append(ID_WXLUA_STACK_FINDMENU_VALUETYPE, wxT("Search value type"), wxT("Search in value type column"), wxITEM_CHECK); ! m_findMenu->Append(ID_WXLUA_STACK_FINDMENU_VALUE, wxT("Search values"), wxT("Search in value column"), wxITEM_CHECK); m_findMenu->Check(ID_WXLUA_STACK_FINDMENU_NAME, true); --- 255,267 ---- m_findMenu = new wxMenu(wxT("Find Options"), 0); ! m_findMenu->Append(ID_WXLUA_STACK_FINDMENU_CASE, wxT("&Case sensitive"), wxT("Case sensitive searching"), wxITEM_CHECK); ! m_findMenu->Append(ID_WXLUA_STACK_FINDMENU_WHOLE_STRING, wxT("Match whole string"), wxT("Search for a string with an exact match"), wxITEM_CHECK); m_findMenu->AppendSeparator(); ! m_findMenu->Append(ID_WXLUA_STACK_FINDMENU_ALL, wxT("Search &everywhere"), wxT("Search in all columns"), wxITEM_CHECK); ! m_findMenu->Append(ID_WXLUA_STACK_FINDMENU_NAME, wxT("Search &names"), wxT("Search in name column"), wxITEM_CHECK); ! m_findMenu->Append(ID_WXLUA_STACK_FINDMENU_LEVEL, wxT("Search &level"), wxT("Search in level column"), wxITEM_CHECK); ! m_findMenu->Append(ID_WXLUA_STACK_FINDMENU_KEYTYPE, wxT("Search &key type"), wxT("Search in key type column"), wxITEM_CHECK); ! m_findMenu->Append(ID_WXLUA_STACK_FINDMENU_VALUETYPE, wxT("Search v&alue type"), wxT("Search in value type column"), wxITEM_CHECK); ! m_findMenu->Append(ID_WXLUA_STACK_FINDMENU_VALUE, wxT("Search &values"), wxT("Search in value column"), wxITEM_CHECK); m_findMenu->Check(ID_WXLUA_STACK_FINDMENU_NAME, true); *************** *** 437,466 **** int img = IMG_NONE; ! switch (dbgItem->GetValueType()) ! { ! case WXLUAARG_None : img = IMG_NONE; break; ! case WXLUAARG_Unknown : img = IMG_UNKNOWN; break; ! case WXLUAARG_Nil : img = IMG_NIL; break; ! case WXLUAARG_Boolean : img = IMG_BOOLEAN; break; ! case WXLUAARG_LightUserData : img = IMG_LIGHTUSERDATA; break; ! case WXLUAARG_Number : img = IMG_NUMBER; break; ! case WXLUAARG_String : img = IMG_STRING; break; ! case WXLUAARG_Table : img = IMG_TABLE; break; ! case WXLUAARG_Function : img = IMG_LUAFUNCTION; break; ! case WXLUAARG_UserData : img = IMG_USERDATA; break; ! case WXLUAARG_Thread : img = IMG_THREAD; break; ! case WXLUAARG_Integer : img = IMG_INTEGER; break; ! case WXLUAARG_CFunction : img = IMG_CFUNCTION; break; ! } ! ! // now fix up the images for special cases if (dbgItem->GetFlagBit(WXLUA_DEBUGITEM_EXPANDED)) img = IMG_TABLE_OPEN; ! else if (dbgItem->GetValueType() == WXLUAARG_WXLUADATA) // our internal data structs ! img = IMG_TABLE; return img; } void wxLuaStackDialog::EnumerateStack() { --- 406,481 ---- int img = IMG_NONE; ! // Expanded nodes all use the open table icon if (dbgItem->GetFlagBit(WXLUA_DEBUGITEM_EXPANDED)) img = IMG_TABLE_OPEN; ! else ! { ! switch (dbgItem->GetValueType()) ! { ! case WXLUAARG_None : img = IMG_NONE; break; ! case WXLUAARG_Unknown : img = IMG_UNKNOWN; break; ! case WXLUAARG_Nil : img = IMG_NIL; break; ! case WXLUAARG_Boolean : img = IMG_BOOLEAN; break; ! case WXLUAARG_LightUserData : img = IMG_LIGHTUSERDATA; break; ! case WXLUAARG_Number : img = IMG_NUMBER; break; ! case WXLUAARG_String : img = IMG_STRING; break; ! case WXLUAARG_Table : img = IMG_TABLE; break; ! case WXLUAARG_Function : img = IMG_LUAFUNCTION; break; ! case WXLUAARG_UserData : img = IMG_USERDATA; break; ! case WXLUAARG_Thread : img = IMG_THREAD; break; ! case WXLUAARG_Integer : img = IMG_INTEGER; break; ! case WXLUAARG_CFunction : img = IMG_CFUNCTION; break; ! ! case WXLUAARG_WXLUADATA : img = IMG_TABLE; break; ! } ! } return img; } + wxString wxLuaStackDialog::GetItemText(long item, long column, bool exact_value) + { + wxLuaStackListData* stkListData = (wxLuaStackListData*)m_listData[item]; + wxCHECK_MSG(stkListData, wxEmptyString, wxT("Invalid wxLuaStackListData item")); + wxLuaDebugItem* debugItem = stkListData->GetDebugItem(); + wxCHECK_MSG(debugItem, wxEmptyString, wxT("Invalid wxLuaDebugItem item")); + + switch (column) + { + case 0: + if (exact_value) + return debugItem->GetKey(); + + if (stkListData->m_level > 0) + { + //wxString s(wxT("-->")); + //for (int i = 1; i < stkListData->m_level; ++i) s += wxT("-->"); + + return wxString(wxT(' '), stkListData->m_level*4) + debugItem->GetKey(); + } + else + return debugItem->GetKey(); + case 1: + return wxString::Format(wxT("%d:%d"), stkListData->m_level+1, stkListData->m_item_idx+1); + case 2: + return debugItem->GetKeyTypeString(); + case 3: + return debugItem->GetValueTypeString(); + case 4: + { + if (exact_value) + return debugItem->GetValue(); + + wxString value(debugItem->GetValue()); + if (value.Length() > 200) value = value.Mid(0, 200) + wxT("... <snip>"); + value.Replace(wxT("\n"), wxT("\\n")); + value.Replace(wxT("\r"), wxT("\\r")); + return value; + } + } + + return wxEmptyString; + } + void wxLuaStackDialog::EnumerateStack() { *************** *** 534,539 **** // Add the locals, fake a debug item to get it setup right ! wxLuaDebugItem* localItem = new wxLuaDebugItem(_("Locals"), WXLUAARG_Table, ! wxString::Format(wxT("Count %d"), (int)debugData.GetCount()), WXLUAARG_Table, wxT(""), LUA_NOREF, 0, WXLUA_DEBUGITEM_EXPANDED); wxLuaDebugData localData(true); // this deletes the items --- 549,554 ---- // Add the locals, fake a debug item to get it setup right ! wxLuaDebugItem* localItem = new wxLuaDebugItem(_("Locals"), WXLUAARG_None, ! wxString::Format(wxT("Count %d"), (int)debugData.GetCount()), WXLUAARG_None, wxT(""), LUA_NOREF, 0, WXLUA_DEBUGITEM_EXPANDED); wxLuaDebugData localData(true); // this deletes the items *************** *** 580,583 **** --- 595,599 ---- wxLuaStackListData* stkListData = (wxLuaStackListData*)m_listData[lc_item_]; wxCHECK_RET((stkListData != NULL), wxT("The wxLuaStackDialog does have stack data!")); + // sanity check, either add new children data or we're expanding using the old data wxCHECK_RET(!stkListData->m_childrenDebugData.Ok() || (stkListData->m_childrenDebugData == debugData), wxT("Replacing the child data?")); if (!stkListData->m_childrenDebugData.Ok()) *************** *** 676,680 **** } - void wxLuaStackDialog::BeginBatch() { --- 692,695 ---- *************** *** 700,704 **** } - wxTreeItemId wxLuaStackDialog::FindTreeItemId(const wxTreeItemId& id_, wxLuaStackListData* stkListData) const { --- 715,718 ---- *************** *** 748,800 **** if (start_item < 0) return; ! wxLuaStackListData* stkListData = (wxLuaStackListData*)m_listData[start_item]; ! ! bool expand = (event.GetId() == ID_WXLUA_STACK_EXPAND_BUTTON); ! ! wxString caption; ! if (expand) ! caption = wxT("wxLua Stack Expanding node"); else ! caption = wxT("wxLua Stack Collapsing node"); ! ! wxProgressDialog dlg(caption, wxEmptyString, 100, this, ! wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT); ! ! m_show_dup_expand_msg = false; ! BeginBatch(); ! ! // Note: Iterating through all of the listctrl items, even though most of ! // them are not expandable, is MUCH faster than using the far fewer ! // wxTreeCtrl items and calling Expand() on them. ! ! int counter = 0; ! int n = start_item, level = stkListData->m_level; ! while (n < (int)m_listData.GetCount()) ! { ! wxLuaStackListData* stkListData_n = (wxLuaStackListData*)m_listData[n]; ! ! if ((n > start_item) && (stkListData_n->m_level <= level)) break; ! ! if (counter % 20 == 0) ! { ! wxString msg; ! if (expand) ! msg.Printf(wxT("Expanding nodes : %d"), counter); ! else ! msg.Printf(wxT("Collapsing nodes : %d"), counter); ! ! if (!dlg.Pulse(msg)) ! break; ! } ! ! if (!stkListData_n->GetDebugItem()->GetFlagBit(WXLUA_DEBUGITEM_EXPANDED)) ! ExpandItem(n); ! ! counter++; ! n++; ! } ! ! EndBatch(); ! m_show_dup_expand_msg = true; } --- 762,769 ---- if (start_item < 0) return; ! if (event.GetId() == ID_WXLUA_STACK_EXPAND_BUTTON) ! ExpandItemChildren(start_item); else ! CollapseItem(start_item); } *************** *** 832,836 **** else if ((id >= ID_WXLUA_STACK_FINDMENU_NAME) && (id <= ID_WXLUA_STACK_FINDMENU_VALUE)) { ! bool are_checked = m_findMenu->IsChecked(ID_WXLUA_STACK_FINDMENU_NAME) && m_findMenu->IsChecked(ID_WXLUA_STACK_FINDMENU_LEVEL) && m_findMenu->IsChecked(ID_WXLUA_STACK_FINDMENU_KEYTYPE) && --- 801,805 ---- else if ((id >= ID_WXLUA_STACK_FINDMENU_NAME) && (id <= ID_WXLUA_STACK_FINDMENU_VALUE)) { ! bool all_checked = m_findMenu->IsChecked(ID_WXLUA_STACK_FINDMENU_NAME) && m_findMenu->IsChecked(ID_WXLUA_STACK_FINDMENU_LEVEL) && m_findMenu->IsChecked(ID_WXLUA_STACK_FINDMENU_KEYTYPE) && *************** *** 839,843 **** if (m_findMenu->IsChecked(ID_WXLUA_STACK_FINDMENU_ALL) != checked) ! m_findMenu->Check(ID_WXLUA_STACK_FINDMENU_ALL, are_checked); } else if ((id >= ID_WXLUA_STACK_LISTMENU_COPY0) && (id <= ID_WXLUA_STACK_LISTMENU_COPY4)) --- 808,812 ---- if (m_findMenu->IsChecked(ID_WXLUA_STACK_FINDMENU_ALL) != checked) ! m_findMenu->Check(ID_WXLUA_STACK_FINDMENU_ALL, all_checked); } else if ((id >= ID_WXLUA_STACK_LISTMENU_COPY0) && (id <= ID_WXLUA_STACK_LISTMENU_COPY4)) *************** *** 904,907 **** --- 873,878 ---- if (!match_case) findStr = findStr.Lower(); + bool whole_string = m_findMenu->IsChecked(ID_WXLUA_STACK_FINDMENU_WHOLE_STRING); + long direction = (event.GetId() == ID_WXLUA_STACK_FINDPREV_BUTTON) ? -1 : 1; *************** *** 912,915 **** --- 883,887 ---- bool found = false; + wxString txt; while ((wrap_count < 2) && !found) *************** *** 941,958 **** for ( ; (i >= 0) && (i < list_count) && !found; i = i + direction) { - wxListItem li; - li.SetId(i); - li.SetMask(wxLIST_MASK_TEXT); - for (int col = 0; (col < 5) && !found; col++) { if (!find_col[col]) continue; ! li.SetColumn(col); ! m_listCtrl->GetItem(li); ! wxString txt(li.GetText()); ! if ((match_case && (txt.Find(findStr) != wxNOT_FOUND)) || ! (!match_case && (txt.Lower().Find(findStr) != wxNOT_FOUND))) { m_listCtrl->SetItemState(i, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED); --- 913,925 ---- for ( ; (i >= 0) && (i < list_count) && !found; i = i + direction) { for (int col = 0; (col < 5) && !found; col++) { if (!find_col[col]) continue; ! txt = GetItemText(i, col, true); ! if (match_case) txt.MakeLower(); ! if ((whole_string && (txt == findStr)) || ! (!whole_string && (txt.Find(findStr) != wxNOT_FOUND))) { m_listCtrl->SetItemState(i, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED); *************** *** 1001,1004 **** --- 968,972 ---- wxBusyCursor busy; ExpandItem(list_item); + m_listCtrl->RefreshItem(list_item); } else if (evt_type == wxEVT_COMMAND_TREE_ITEM_COLLAPSED) *************** *** 1006,1009 **** --- 974,978 ---- wxBusyCursor busy; CollapseItem(list_item); + m_listCtrl->RefreshItem(list_item); } else if (evt_type == wxEVT_COMMAND_TREE_SEL_CHANGED) *************** *** 1015,1021 **** } ! void wxLuaStackDialog::OnListItemActivated(wxListEvent &event) { ! wxLuaStackListData* stkListData = (wxLuaStackListData*)m_listData[event.GetIndex()]; wxCHECK_RET(stkListData != NULL, wxT("Invalid wxLuaStack data")); wxLuaDebugItem* debugItem = stkListData->GetDebugItem(); --- 984,992 ---- } ! void wxLuaStackDialog::OnListItem(wxListEvent &event) { ! long list_item = event.GetIndex(); ! ! wxLuaStackListData* stkListData = (wxLuaStackListData*)m_listData[list_item]; wxCHECK_RET(stkListData != NULL, wxT("Invalid wxLuaStack data")); wxLuaDebugItem* debugItem = stkListData->GetDebugItem(); *************** *** 1034,1038 **** if (!debugItem->GetFlagBit(WXLUA_DEBUGITEM_EXPANDED)) { ! if (ExpandItem(event.GetIndex())) { // Hack for WXLUA_STACK_MSWTREE, need children to expand --- 1005,1009 ---- if (!debugItem->GetFlagBit(WXLUA_DEBUGITEM_EXPANDED)) { ! if (ExpandItem(list_item)) { // Hack for WXLUA_STACK_MSWTREE, need children to expand *************** *** 1047,1052 **** m_treeCtrl->Collapse(stkListData->m_treeId); ! CollapseItem(event.GetIndex()); } } } --- 1018,1026 ---- m_treeCtrl->Collapse(stkListData->m_treeId); ! CollapseItem(list_item); } + + // refresh here and not in Expand/CollapseItem() to make ExpandItemChildren() faster. + m_listCtrl->RefreshItem(list_item); } } *************** *** 1062,1066 **** bool wxLuaStackDialog::ExpandItem(long lc_item) { ! wxCHECK_MSG((lc_item >= 0) && (lc_item < m_listCtrl->GetItemCount()), false, wxT("Invalid list item to expand")); --- 1036,1040 ---- bool wxLuaStackDialog::ExpandItem(long lc_item) { ! wxCHECK_MSG((lc_item >= 0) && (lc_item < (long)m_listData.GetCount()), false, wxT("Invalid list item to expand")); *************** *** 1080,1089 **** { debugItem->SetFlagBit(WXLUA_DEBUGITEM_EXPANDED, true); - m_listCtrl->SetItemImage(lc_item, IMG_TABLE_OPEN); wxString val(debugItem->GetValue()); long vkey = 0; ! wxCHECK_MSG(val.BeforeFirst(wxT(' ')).ToLong(&vkey, 16), false, wxT("Invalid table item")); ! m_expandedItems[vkey] = (long)stkListData; FillTableEntry(lc_item, stkListData->m_childrenDebugData); --- 1054,1062 ---- { debugItem->SetFlagBit(WXLUA_DEBUGITEM_EXPANDED, true); wxString val(debugItem->GetValue()); long vkey = 0; ! if (val.BeforeFirst(wxT(' ')).ToLong(&vkey, 16)) ! m_expandedItems[vkey] = (long)stkListData; FillTableEntry(lc_item, stkListData->m_childrenDebugData); *************** *** 1118,1129 **** } - wxString key(debugItem->GetKey()); - // Check our special variables for the wxLuaState data ! if (m_wxlState.Ok() && ! ((key == _("Tracked User Data")) || ! (key == _("wxEvent Callbacks")) || ! (key == _("Top Level wxWindows")) || ! (key == _("wxWindow Destroy List")))) { wxLuaState wxlState(m_wxlState); --- 1091,1096 ---- } // Check our special variables for the wxLuaState data ! if (m_wxlState.Ok() && (debugItem->GetValueType() == WXLUAARG_WXLUADATA)) { wxLuaState wxlState(m_wxlState); *************** *** 1138,1144 **** else if (debugItem->GetKey() == _("wxWindow Destroy List")) strArr = wxlState.GetTrackedWinDestroyCallbackStrings(); debugItem->SetFlagBit(WXLUA_DEBUGITEM_EXPANDED, true); - m_listCtrl->SetItemImage(lc_item, IMG_TABLE_OPEN); wxLuaDebugData dataArr(true); --- 1105,1112 ---- else if (debugItem->GetKey() == _("wxWindow Destroy List")) strArr = wxlState.GetTrackedWinDestroyCallbackStrings(); + else + wxFAIL_MSG(wxT("Unknown key name with WXLUAARG_WXLUADATA")); debugItem->SetFlagBit(WXLUA_DEBUGITEM_EXPANDED, true); wxLuaDebugData dataArr(true); *************** *** 1146,1150 **** for (n = 0; n < count; n++) { ! wxLuaDebugItem *item = new wxLuaDebugItem(strArr[n].BeforeLast(wxT(' ')), WXLUAARG_None, wxT("Count ")+strArr[n].AfterLast(wxT(' ')), WXLUAARG_None, wxT(""), LUA_NOREF, debugItem->GetIndex() + 1); dataArr.Add(item); } --- 1114,1120 ---- for (n = 0; n < count; n++) { ! wxLuaDebugItem *item = new wxLuaDebugItem(strArr[n].BeforeLast(wxT(' ')), WXLUAARG_None, ! wxT("Count ")+strArr[n].AfterLast(wxT(' ')), WXLUAARG_None, ! wxT(""), LUA_NOREF, debugItem->GetIndex() + 1); dataArr.Add(item); } *************** *** 1171,1174 **** --- 1141,1190 ---- } + bool wxLuaStackDialog::ExpandItemChildren(long lc_item) + { + wxCHECK_MSG((lc_item >= 0) && (lc_item < (long)m_listData.GetCount()), false, + wxT("Invalid list item to expand")); + + bool expanded = false; + + wxProgressDialog dlg(wxT("wxLua Stack Expanding node"), wxEmptyString, 100, this, + wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT); + + m_show_dup_expand_msg = false; + BeginBatch(); + + // Note: Iterating through all of the listctrl items, even though most of + // them are not expandable, is MUCH faster than using the far fewer + // wxTreeCtrl items and calling Expand() on them. + + wxLuaStackListData* stkListData = (wxLuaStackListData*)m_listData[lc_item]; + + int counter = 0; + int n = lc_item, level = stkListData->m_level; + while (n < (int)m_listData.GetCount()) + { + wxLuaStackListData* stkListData_n = (wxLuaStackListData*)m_listData[n]; + + if ((n > lc_item) && (stkListData_n->m_level <= level)) break; + + if (counter % 20 == 0) + { + if (!dlg.Pulse(wxString::Format(wxT("Expanding nodes : %d"), counter))) + break; + } + + if (!stkListData_n->GetDebugItem()->GetFlagBit(WXLUA_DEBUGITEM_EXPANDED)) + expanded |= ExpandItem(n); + + counter++; + n++; + } + + EndBatch(); + m_show_dup_expand_msg = true; + + return expanded; + } + bool wxLuaStackDialog::CollapseItem(long lc_item) { *************** *** 1224,1228 **** delete stkListData_n; ! n--; count = m_listData.GetCount(); } } --- 1240,1244 ---- delete stkListData_n; ! n--; count = m_listData.GetCount(); } } *************** *** 1236,1240 **** debugItem->SetFlagBit(WXLUA_DEBUGITEM_EXPANDED, false); - m_listCtrl->SetItemImage(lc_item, IMG_TABLE); wxString val(debugItem->GetValue()); --- 1252,1255 ---- Index: wxldebug.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxldebug.cpp,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** wxldebug.cpp 30 Nov 2007 23:00:08 -0000 1.51 --- wxldebug.cpp 2 Dec 2007 20:57:34 -0000 1.52 *************** *** 171,177 **** if (luaDebug.name != NULL) ! name = wxString::Format(_("function %s line %u"), lua2wx(luaDebug.name).c_str(), currentLine); else ! name = wxString::Format(_("line %u"), currentLine); Add(new wxLuaDebugItem(name, WXLUAARG_None, wxT(""), WXLUAARG_None, source, LUA_NOREF, stack_frame, 0)); --- 171,177 ---- if (luaDebug.name != NULL) ! name = wxString::Format(_("function %s line %d"), lua2wx(luaDebug.name).c_str(), currentLine); else ! name = wxString::Format(_("line %d"), currentLine); Add(new wxLuaDebugItem(name, WXLUAARG_None, wxT(""), WXLUAARG_None, source, LUA_NOREF, stack_frame, 0)); |