From b632efe0d6c20859df77653dd3c62f25c0e493bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sat, 27 Aug 2011 13:24:07 +0000 Subject: [PATCH] No real change, use more descriptive variable names in wxDataViewMainWindow::ItemDeleted(). Call the node object corresponding to 'parent' 'parentNode' instead of just the more vague 'node'. Also, 'nodes' instead of 'nds'. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68912 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/datavgen.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 8fbfa5a75f..9aee86a620 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -2042,68 +2042,68 @@ bool wxDataViewMainWindow::ItemDeleted(const wxDataViewItem& parent, } else // general case { - wxDataViewTreeNode * node = FindNode(parent); + wxDataViewTreeNode * parentNode = FindNode(parent); // Notice that it is possible that the item being deleted is not in the // tree at all, for example we could be deleting a never shown (because // collapsed) item in a tree model. So it's not an error if we don't know // about this item, just return without doing anything then. - if ( !node ) + if ( !parentNode ) return false; - int itemPosInNode = node->GetChildren().Index(item.GetID()); + int itemPosInNode = parentNode->GetChildren().Index(item.GetID()); if ( itemPosInNode == wxNOT_FOUND ) return false; bool isContainer = false; wxDataViewTreeNode *itemNode = NULL; - const wxDataViewTreeNodes nds = node->GetNodes(); - for (size_t i = 0; i < nds.GetCount(); i ++) + const wxDataViewTreeNodes nodes = parentNode->GetNodes(); + for (size_t i = 0; i < nodes.GetCount(); i ++) { - if (nds[i]->GetItem() == item) + if (nodes[i]->GetItem() == item) { isContainer = true; - itemNode = nds[i]; + itemNode = nodes[i]; break; } } // Delete the item from wxDataViewTreeNode representation: int itemsDeleted = 1; - node->GetChildren().Remove( item.GetID() ); + parentNode->GetChildren().Remove( item.GetID() ); if( isContainer ) { - wxDataViewTreeNode *n = node->FindItemAsNode(item); + wxDataViewTreeNode *n = parentNode->FindItemAsNode(item); wxCHECK_MSG( n != NULL, false, "item not found" ); - node->GetNodes().Remove( n ); + parentNode->GetNodes().Remove( n ); itemsDeleted += n->GetSubTreeCount(); ::DestroyTreeHelper(n); } // Make the row number invalid and get a new valid one when user call GetRowCount m_count = -1; - node->ChangeSubTreeCount(-itemsDeleted); + parentNode->ChangeSubTreeCount(-itemsDeleted); // Update selection by removing 'item' and its entire children tree from the selection. if ( !m_selection.empty() ) { // we can't call GetRowByItem() on 'item', as it's already deleted, so compute it from - // the parent ('node') and position in its list of children + // the parent ('parentNode') and position in its list of children int itemRow; if ( itemPosInNode == 0 ) { - // 1st child, row number is that of the parent node + 1 - itemRow = GetRowByItem(node->GetItem()) + 1; + // 1st child, row number is that of the parent parentNode + 1 + itemRow = GetRowByItem(parentNode->GetItem()) + 1; } else { // row number is that of the sibling above 'item' + its subtree if any + 1 - const wxDataViewItem sibling = wxDataViewItem(node->GetChildren()[itemPosInNode - 1]); - const wxDataViewTreeNode *siblingNode = node->FindItemAsNode(sibling); + const wxDataViewItem sibling = wxDataViewItem(parentNode->GetChildren()[itemPosInNode - 1]); + const wxDataViewTreeNode *siblingNode = parentNode->FindItemAsNode(sibling); itemRow = GetRowByItem(sibling); if ( siblingNode )