Browse Source

Keep state except when the filter changed.

(Used to be "except when filtering".)

Fixes: lp:1804293
* https://bugs.launchpad.net/kicad/+bug/1804293
pull/13/head
Jeff Young 7 years ago
parent
commit
d2756bedf1
  1. 8
      common/widgets/lib_tree.cpp
  2. 2
      common/widgets/lib_tree.h
  3. 2
      eeschema/widgets/symbol_tree_pane.cpp
  4. 2
      pcbnew/footprint_tree_pane.cpp

8
common/widgets/lib_tree.cpp

@ -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

2
common/widgets/lib_tree.h

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

2
eeschema/widgets/symbol_tree_pane.cpp

@ -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 );
}

2
pcbnew/footprint_tree_pane.cpp

@ -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 );
}

Loading…
Cancel
Save