Fix SetColumnWidth() assertion in TWO_COLUMN_TREE_LIST
Fixes: lp:1665982 * https://bugs.launchpad.net/kicad/+bug/1665982
This commit is contained in:
parent
1e242f3710
commit
fb6bf0c861
|
@ -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 );
|
||||
|
||||
if( GetColumnCount() >= 2 )
|
||||
{
|
||||
SetColumnWidth( m_rubber_band_column, rubber_width );
|
||||
SetColumnWidth( clamped_column, clamped_column_width );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue