Fix SetColumnWidth() assertion in TWO_COLUMN_TREE_LIST

Fixes: lp:1665982
* https://bugs.launchpad.net/kicad/+bug/1665982
This commit is contained in:
Chris Pavlina 2017-02-19 06:38:07 -05:00
parent 1e242f3710
commit fb6bf0c861
3 changed files with 21 additions and 4 deletions

View File

@ -45,6 +45,14 @@ TWO_COLUMN_TREE_LIST::TWO_COLUMN_TREE_LIST( wxWindow* aParent, wxWindowID aID,
GetDataView()->SetIndent( 10 );
}
void TWO_COLUMN_TREE_LIST::AutosizeColumns()
{
wxSizeEvent dummy;
OnSize( dummy );
}
void TWO_COLUMN_TREE_LIST::OnSize( wxSizeEvent& aEvent )
{
wxDataViewCtrl* view = GetDataView();
@ -104,7 +112,10 @@ void TWO_COLUMN_TREE_LIST::OnSize( wxSizeEvent& aEvent )
wxASSERT( m_rubber_band_column == 0 || m_rubber_band_column == 1 );
SetColumnWidth( m_rubber_band_column, rubber_width );
SetColumnWidth( clamped_column, clamped_column_width );
if( GetColumnCount() >= 2 )
{
SetColumnWidth( m_rubber_band_column, rubber_width );
SetColumnWidth( clamped_column, clamped_column_width );
}
}

View File

@ -515,8 +515,7 @@ void COMPONENT_TREE_SEARCH_CONTAINER::UpdateSearchTerm( const wxString& aSearch
//m_tree->EnsureVisible( preselected_node->TreeId );
}
wxSizeEvent dummy;
m_tree->OnSize( dummy );
m_tree->AutosizeColumns();
m_tree->Thaw();
#ifdef SHOW_CALC_TIME

View File

@ -66,6 +66,13 @@ class TWO_COLUMN_TREE_LIST : public wxTreeListCtrl
m_clamped_min_width = aClampedMinWidth;
}
/**
* Recompute column sizes. This should be called after adding columns.
* There is no need to call this in an OnSize handler - this CALLS the
* OnSize handler.
*/
void AutosizeColumns();
/**
* Override buggy wxTreeListCtrl size handler.
*/