libtree: Fixing indent size for MSW

The indent size was estimated by the width of characters.  But MSW
indent is substantially different from OSX and Linux.  It also cuts off
the middle characters rather than the end leading to poor display if the
width does not fit.  This uses the system setting for indent to account
for the indent spacing + 'M' to account for the arrow inset.

Fixes: lp:1815401
* https://bugs.launchpad.net/kicad/+bug/1815401
This commit is contained in:
Seth Hillbrand 2019-02-15 10:41:05 -08:00
parent 227d6e3f9b
commit 409ad04ab3
1 changed files with 4 additions and 3 deletions

View File

@ -365,7 +365,8 @@ int LIB_TREE_MODEL_ADAPTER::ColWidth( LIB_TREE_NODE& aTree, int aCol, wxString c
{
if( aCol == 0 )
{
int padding = m_widget->GetTextExtent( "MM" ).x;
int padding = m_widget->GetTextExtent( "M" ).x;
int indent = m_widget->GetIndent();
int longest = m_widget->GetTextExtent( aHeading ).x;
for( auto& node : aTree.Children )
@ -376,7 +377,7 @@ int LIB_TREE_MODEL_ADAPTER::ColWidth( LIB_TREE_NODE& aTree, int aCol, wxString c
continue;
if( node->Score > 0 )
longest = std::max( longest, node->VisLen + padding );
longest = std::max( longest, node->VisLen + padding + indent );
if( !m_widget->IsExpanded( item ) )
continue;
@ -384,7 +385,7 @@ int LIB_TREE_MODEL_ADAPTER::ColWidth( LIB_TREE_NODE& aTree, int aCol, wxString c
for( auto& childNode : node->Children )
{
if( childNode->Score > 0 )
longest = std::max( longest, childNode->VisLen + 2 * padding );
longest = std::max( longest, childNode->VisLen + padding + 2 * indent );
}
}