From: John L. <jr...@us...> - 2007-11-30 06:23:43
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6752/wxLua/modules/wxluadebug/src Modified Files: wxldebug.cpp wxlstack.cpp Log Message: Make the wxLuaStackDialog run a little faster Index: wxlstack.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxlstack.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** wxlstack.cpp 29 Nov 2007 23:35:53 -0000 1.18 --- wxlstack.cpp 30 Nov 2007 06:23:39 -0000 1.19 *************** *** 42,46 **** #define DUMMY_TREEITEM wxT(" ") - #define WXLUAARG_WXLUADATA (WXLUAARG__MIN - 100) --- 42,45 ---- *************** *** 90,93 **** --- 89,93 ---- m_show_dup_expand_msg = true; m_batch_count = 0; + m_skip_tree_event = false; } *************** *** 189,193 **** 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); --- 189,193 ---- 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); *************** *** 335,339 **** wxCHECK_MSG(dbgItem, IMG_UNKNOWN, wxT("Invalid wxLuaDebugItem")); - //int img = WXLUAARG_TO_POSINDEX(dbgItem->GetValueType()); int img = IMG_NONE; --- 335,338 ---- *************** *** 433,437 **** } ! if (debugData.GetCount() > 0) { m_stackChoice->SetSelection(0); --- 432,436 ---- } ! if (count > 0) { m_stackChoice->SetSelection(0); *************** *** 523,526 **** --- 522,526 ---- BeginBatch(); + m_skip_tree_event = true; size_t n, count = debugData.GetCount(); *************** *** 581,584 **** --- 581,587 ---- m_treeCtrl->Expand(treeId); #endif //!defined(WXLUA_STACK_MSWTREE) + + m_skip_tree_event = false; + } } *************** *** 683,687 **** { wxString msg; ! if (expand) msg.Printf(wxT("Expanding nodes : %ld"), counter); else --- 686,690 ---- { wxString msg; ! if (expand) msg.Printf(wxT("Expanding nodes : %ld"), counter); else *************** *** 690,694 **** if (!dlg->Pulse(msg)) { ! counter = -1; return; } --- 693,697 ---- if (!dlg->Pulse(msg)) { ! counter = -1; return; } *************** *** 730,734 **** caption = wxT("wxLua Stack Collapsing node"); ! wxProgressDialog dlg(caption, wxEmptyString, 100, this, wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT); --- 733,737 ---- caption = wxT("wxLua Stack Collapsing node"); ! wxProgressDialog dlg(caption, wxEmptyString, 100, this, wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT); *************** *** 799,803 **** if (wxTheClipboard->Open()) { ! // This data objects are held by the clipboard, // so do not delete them in the app. wxTheClipboard->SetData( new wxTextDataObject(li.GetText()) ); --- 802,806 ---- if (wxTheClipboard->Open()) { ! // This data objects are held by the clipboard, // so do not delete them in the app. wxTheClipboard->SetData( new wxTextDataObject(li.GetText()) ); *************** *** 832,837 **** if (!find_col[0] && !find_col[1] && !find_col[2] && !find_col[3] && !find_col[4]) { ! wxMessageBox(wxT("Please select the columns to search with the find options button"), ! wxT("wxLua Stack Find Error"), wxOK|wxICON_EXCLAMATION|wxCENTRE, this); return; --- 835,840 ---- if (!find_col[0] && !find_col[1] && !find_col[2] && !find_col[3] && !find_col[4]) { ! wxMessageBox(wxT("Please select at least one column to search with the find options button"), ! wxT("wxLua Stack Find Error"), wxOK|wxICON_EXCLAMATION|wxCENTRE, this); return; *************** *** 892,900 **** { 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))) --- 895,903 ---- { 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))) *************** *** 929,933 **** void wxLuaStackDialog::OnTreeItem(wxTreeEvent &event) { ! event.Skip(); wxTreeItemId id = event.GetItem(); wxLuaStackTreeData* stkTreeData = (wxLuaStackTreeData*)m_treeCtrl->GetItemData(id); --- 932,937 ---- void wxLuaStackDialog::OnTreeItem(wxTreeEvent &event) { ! if (m_skip_tree_event) return; ! wxTreeItemId id = event.GetItem(); wxLuaStackTreeData* stkTreeData = (wxLuaStackTreeData*)m_treeCtrl->GetItemData(id); *************** *** 942,949 **** --- 946,955 ---- if (evt_type == wxEVT_COMMAND_TREE_ITEM_EXPANDED) { + wxBusyCursor busy; ExpandItem(list_item); } else if (evt_type == wxEVT_COMMAND_TREE_ITEM_COLLAPSED) { + wxBusyCursor busy; CollapseItem(list_item); } *************** *** 1006,1010 **** wxT("Invalid list item to expand")); - wxBusyCursor busy; bool expanded = false; --- 1012,1015 ---- *************** *** 1066,1070 **** wxLuaDebugItem* debugItem_n = stkListData_n->GetDebugItem(); ! if (debugItem_n && (debugItem_n != debugItem) && debugItem_n->GetFlagBit(WXLUA_DEBUGITEM_EXPANDED) && (debugItem_n->GetValue() == val)) --- 1071,1075 ---- wxLuaDebugItem* debugItem_n = stkListData_n->GetDebugItem(); ! if (debugItem_n && (debugItem_n != debugItem) && debugItem_n->GetFlagBit(WXLUA_DEBUGITEM_EXPANDED) && (debugItem_n->GetValue() == val)) *************** *** 1143,1147 **** wxT("Invalid list item to expand")); - wxBusyCursor busy; bool collapsed = false; --- 1148,1151 ---- Index: wxldebug.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxldebug.cpp,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** wxldebug.cpp 28 Nov 2007 22:55:02 -0000 1.49 --- wxldebug.cpp 30 Nov 2007 06:23:39 -0000 1.50 *************** *** 125,129 **** int wxLuaDebugData::SortFunction(wxLuaDebugItem *elem1, wxLuaDebugItem *elem2 ) { ! int ret = elem1->GetKey().Cmp(elem2->GetKey()); if (ret == 0) // can be true for unnamed "(*temporary)" vars --- 125,129 ---- int wxLuaDebugData::SortFunction(wxLuaDebugItem *elem1, wxLuaDebugItem *elem2 ) { ! int ret = elem1->m_itemKey.Cmp(elem2->m_itemKey); // not GetKey() for speed if (ret == 0) // can be true for unnamed "(*temporary)" vars *************** *** 213,223 **** // but when you run wxluaT_insert() to store them they disappear // so that the next time wxluaT_insert() is run it reuses the same ! // index as your local table. ! // When using the stack dialog the next wxluaT_insert() is the // global table which is very confusing. int flag_type = 0; int nRef = LUA_NOREF; //RefTable(L, -1, &flag_type, references); ! lua_pop(L, 1); // remove variable value --- 213,223 ---- // but when you run wxluaT_insert() to store them they disappear // so that the next time wxluaT_insert() is run it reuses the same ! // index as your local table. ! // When using the stack dialog the next wxluaT_insert() is the // global table which is very confusing. int flag_type = 0; int nRef = LUA_NOREF; //RefTable(L, -1, &flag_type, references); ! lua_pop(L, 1); // remove variable value *************** *** 283,287 **** Add(new wxLuaDebugItem(wxT(" __metatable"), WXLUAARG_Table, value, wxl_valuetype, wxT(""), nRef, nIndex, flag_type)); count++; ! lua_pop(L, 1); // pop metatable } --- 283,287 ---- Add(new wxLuaDebugItem(wxT(" __metatable"), WXLUAARG_Table, value, wxl_valuetype, wxT(""), nRef, nIndex, flag_type)); count++; ! lua_pop(L, 1); // pop metatable } *************** *** 298,302 **** int flag_type = 0; int nRef = RefTable(L, -1, &flag_type, references); ! lua_pop(L, 1); --- 298,302 ---- int flag_type = 0; int nRef = RefTable(L, -1, &flag_type, references); ! lua_pop(L, 1); *************** *** 341,375 **** int wxl_type = wxlua_getwxluatype(l_type); switch (l_type) { case LUA_TNONE: value = wxEmptyString; break; ! case LUA_TNIL: value = wxT("nil"); break; ! case LUA_TBOOLEAN: ! value = MakeBoolean(lua_toboolean(L, stack_idx)); break; ! case LUA_TLIGHTUSERDATA: value = GetUserDataInfo(wxlState, stack_idx, false); break; ! case LUA_TNUMBER: ! value = MakeNumber(lua_tonumber(L, stack_idx)); ! break; case LUA_TSTRING: value = lua2wx(lua_tostring(L, stack_idx)); break; ! case LUA_TTABLE: value = GetTableInfo(wxlState, stack_idx); break; ! case LUA_TFUNCTION: if (lua_iscfunction(L, stack_idx)) { --- 341,391 ---- int wxl_type = wxlua_getwxluatype(l_type); + if (wxl_type_) *wxl_type_ = wxl_type; + switch (l_type) { case LUA_TNONE: + { value = wxEmptyString; break; ! } case LUA_TNIL: + { value = wxT("nil"); break; ! } case LUA_TBOOLEAN: ! { ! value = (lua_toboolean(L, stack_idx) != 0) ? wxT("true") : wxT("false"); break; ! } case LUA_TLIGHTUSERDATA: + { value = GetUserDataInfo(wxlState, stack_idx, false); break; ! } case LUA_TNUMBER: ! { ! double num = lua_tonumber(L, stack_idx); + if ((long)num == num) + value = wxString::Format(wxT("%ld (0x%lx)"), (long)num, (unsigned long)num); + else + value = wxString::Format(wxT("%g"), num); + + break; + } case LUA_TSTRING: + { value = lua2wx(lua_tostring(L, stack_idx)); break; ! } case LUA_TTABLE: + { value = GetTableInfo(wxlState, stack_idx); break; ! } case LUA_TFUNCTION: + { if (lua_iscfunction(L, stack_idx)) { *************** *** 382,418 **** } break; ! case LUA_TUSERDATA: value = GetUserDataInfo(wxlState, stack_idx, true); break; ! case LUA_TTHREAD: value.Printf(wxT("%p"), lua_topointer(L, stack_idx)); break; ! default : value = wxEmptyString; break; } - if (wxl_type_) *wxl_type_ = wxl_type; - return l_type; } - wxString wxLuaDebugData::MakeNumber(double dnum) - { - long num = (long) dnum; - if ((double) num == dnum) - return wxString::Format(wxT("%ld (0x%lx)"), num, (unsigned long)num); - - return wxString::Format(wxT("%g"), dnum); - } - - wxString wxLuaDebugData::MakeBoolean(int num) - { - return num != 0 ? wxT("true") : wxT("false"); - } - wxString wxLuaDebugData::GetTableInfo(const wxLuaState& wxlState, int stack_idx) { --- 398,422 ---- } break; ! } case LUA_TUSERDATA: + { value = GetUserDataInfo(wxlState, stack_idx, true); break; ! } case LUA_TTHREAD: + { value.Printf(wxT("%p"), lua_topointer(L, stack_idx)); break; ! } default : + { value = wxEmptyString; break; + } } return l_type; } wxString wxLuaDebugData::GetTableInfo(const wxLuaState& wxlState, int stack_idx) { *************** *** 424,428 **** const void *pItem = lua_topointer(L, stack_idx); ! wxString s = wxString::Format(wxT("%p"), pItem); if (nItems > 0) --- 428,432 ---- const void *pItem = lua_topointer(L, stack_idx); ! wxString s(wxString::Format(wxT("%p"), pItem)); if (nItems > 0) *************** *** 435,450 **** } ! wxString wxLuaDebugData::GetUserDataInfo(const wxLuaState& wxlState_, int stack_idx, bool full) { ! wxCHECK_MSG(wxlState_.Ok(), wxEmptyString, wxT("Invalid wxLuaState")); ! wxLuaState wxlState(wxlState_); // unconst wxLuaState lua_State* L = wxlState.GetLuaState(); ! wxString s = wxString::Format(wxT("%p"), lua_touserdata(L, stack_idx)); if (!full) { - void* udata = lua_touserdata(L, stack_idx); - // Convert our known keys to something more readable if (udata == &wxlua_lreg_references_key) --- 439,453 ---- } ! wxString wxLuaDebugData::GetUserDataInfo(const wxLuaState& wxlState, int stack_idx, bool full) { ! wxCHECK_MSG(wxlState.Ok(), wxEmptyString, wxT("Invalid wxLuaState")); lua_State* L = wxlState.GetLuaState(); ! void* udata = lua_touserdata(L, stack_idx); ! ! wxString s(wxString::Format(wxT("%p"), udata)); if (!full) { // Convert our known keys to something more readable if (udata == &wxlua_lreg_references_key) *************** *** 474,480 **** s += wxString::Format(wxT(" (tag %d)"), nTag); ! wxString pTagName = wxlState.GetLuaTagName(nTag); ! if (!pTagName.IsEmpty()) ! s += wxString::Format(wxT(" '%s'"), pTagName.c_str()); } } --- 477,483 ---- s += wxString::Format(wxT(" (tag %d)"), nTag); ! wxString tagName(wxlState.GetLuaTagName(nTag)); ! if (!tagName.IsEmpty()) ! s += wxString::Format(wxT(" '%s'"), tagName.c_str()); } } *************** *** 533,537 **** int l_type = wxLuaDebugData::GetTypeValue(wxlState, i, &wxl_type, value); ! str.Printf(wxT(" idx %d: l_type = %d, wxl_type = %d : '%s'='%s'\n"), i, l_type, wxl_type, wxlua_getwxluatypename(wxl_type).c_str(), value.c_str()); retStr += str; --- 536,540 ---- int l_type = wxLuaDebugData::GetTypeValue(wxlState, i, &wxl_type, value); ! str.Printf(wxT(" idx %d: l_type = %d, wxl_type = %d : '%s'='%s'\n"), i, l_type, wxl_type, wxlua_getwxluatypename(wxl_type).c_str(), value.c_str()); retStr += str; *************** *** 566,573 **** lua_pushstring(L, wx2lua(tname.BeforeFirst(wxT('.')))); lua_rawget(L, -2); ! if (lua_isnil(L, -1) || !lua_istable(L, -1)) { ! lua_pop(L, 2); // remove table and value s.Printf(wxT("wxLuaCheckStack::DumpTable(L=%p) Table: '%s' cannot be found!\n"), L, tablename.c_str()); --- 569,576 ---- lua_pushstring(L, wx2lua(tname.BeforeFirst(wxT('.')))); lua_rawget(L, -2); ! if (lua_isnil(L, -1) || !lua_istable(L, -1)) { ! lua_pop(L, 2); // remove table and value s.Printf(wxT("wxLuaCheckStack::DumpTable(L=%p) Table: '%s' cannot be found!\n"), L, tablename.c_str()); *************** *** 576,580 **** } ! lua_remove(L, -2); // remove previous table tname = tname.AfterFirst(wxT('.')); } while (tname.Len() > 0); --- 579,583 ---- } ! lua_remove(L, -2); // remove previous table tname = tname.AfterFirst(wxT('.')); } while (tname.Len() > 0); *************** *** 673,677 **** void wxLuaCheckStack::OutputMsg(const wxString& msg) const { ! if (m_print_to_console) { #if defined(__WXMSW__) --- 676,680 ---- void wxLuaCheckStack::OutputMsg(const wxString& msg) const { ! if (m_print_to_console) { #if defined(__WXMSW__) |