Keep state except when the filter changed.

(Used to be "except when filtering".)

Fixes: lp:1804293
* https://bugs.launchpad.net/kicad/+bug/1804293
This commit is contained in:
Jeff Young 2018-11-25 01:38:00 +00:00
parent ff668968f3
commit d2756bedf1
4 changed files with 7 additions and 7 deletions

View File

@ -182,12 +182,12 @@ void LIB_TREE::ExpandLibId( const LIB_ID& aLibId )
}
void LIB_TREE::Regenerate()
void LIB_TREE::Regenerate( bool aKeepState )
{
STATE current;
// Store the state
if( !m_filtering )
if( aKeepState )
m_unfilteredState = getState();
wxString filter = m_query_ctrl->GetValue();
@ -196,7 +196,7 @@ void LIB_TREE::Regenerate()
postPreselectEvent();
// Restore the state
if( !m_filtering )
if( aKeepState )
setState( m_unfilteredState );
}
@ -297,7 +297,7 @@ void LIB_TREE::setState( const STATE& aState )
void LIB_TREE::onQueryText( wxCommandEvent& aEvent )
{
Regenerate();
Regenerate( false );
// Required to avoid interaction with SetHint()
// See documentation for wxTextEntry::SetHint

View File

@ -111,7 +111,7 @@ public:
/**
* Regenerates the tree.
*/
void Regenerate();
void Regenerate( bool aKeepState );
void SetFocus() override;

View File

@ -119,7 +119,7 @@ SYMBOL_TREE_PANE::~SYMBOL_TREE_PANE()
void SYMBOL_TREE_PANE::Regenerate()
{
if( m_tree )
m_tree->Regenerate();
m_tree->Regenerate( true );
}

View File

@ -122,7 +122,7 @@ FOOTPRINT_TREE_PANE::~FOOTPRINT_TREE_PANE()
void FOOTPRINT_TREE_PANE::Regenerate()
{
if( m_tree )
m_tree->Regenerate();
m_tree->Regenerate( true );
}