Symbol editor: fix missing initialization in LIB_TREE_MODEL_ADAPTER::ColWidth().

The text size (in pixels) was never initialized (always 0) for the Column id 0.
This commit is contained in:
jean-pierre charras 2019-02-16 10:25:34 +01:00
parent 813578eba6
commit f364e81a91
1 changed files with 11 additions and 0 deletions

View File

@ -377,7 +377,13 @@ int LIB_TREE_MODEL_ADAPTER::ColWidth( LIB_TREE_NODE& aTree, int aCol, wxString c
continue;
if( node->Score > 0 )
{
// Ensure the text size is up to date:
if( node->VisLen == 0 )
node->VisLen = m_widget->GetTextExtent( node->Name ).x;
longest = std::max( longest, node->VisLen + padding + indent );
}
if( !m_widget->IsExpanded( item ) )
continue;
@ -385,7 +391,12 @@ int LIB_TREE_MODEL_ADAPTER::ColWidth( LIB_TREE_NODE& aTree, int aCol, wxString c
for( auto& childNode : node->Children )
{
if( childNode->Score > 0 )
{
if( childNode->VisLen == 0 )
childNode->VisLen = m_widget->GetTextExtent( childNode->Name ).x;
longest = std::max( longest, childNode->VisLen + padding + 2 * indent );
}
}
}