Library Editor: fixed dynamic updates
Duplicate entries were caused by multiple model assignment done by CMP_TREE_MODEL_ADAPTER_BASE::AttachTo().
This commit is contained in:
parent
891cf783fb
commit
db4bd0c2db
|
@ -158,7 +158,6 @@ void CMP_TREE_MODEL_ADAPTER_BASE::UpdateSearchString( wxString const& aSearch )
|
|||
|
||||
m_tree.SortNodes();
|
||||
Cleared();
|
||||
AttachTo( m_widget );
|
||||
|
||||
ShowResults() || ShowPreselect() || ShowSingleLibrary();
|
||||
}
|
||||
|
@ -289,7 +288,8 @@ unsigned int CMP_TREE_MODEL_ADAPTER_BASE::GetChildren(
|
|||
{
|
||||
auto node = ( aItem.IsOk() ? ToNode( aItem ) : &m_tree );
|
||||
|
||||
if( node->Type != CMP_TREE_NODE::TYPE::LIBID || m_show_units )
|
||||
if( node->Type != CMP_TREE_NODE::TYPE::LIBID
|
||||
|| ( m_show_units && node->Type == CMP_TREE_NODE::TYPE::UNIT ) )
|
||||
return IntoArray( *node, aChildren );
|
||||
else
|
||||
return 0;
|
||||
|
|
|
@ -76,7 +76,7 @@ void LIB_MANAGER_ADAPTER::AddAliasList( const wxString& aNodeName,
|
|||
bool LIB_MANAGER_ADAPTER::IsContainer( const wxDataViewItem& aItem ) const
|
||||
{
|
||||
const CMP_TREE_NODE* node = ToNode( aItem );
|
||||
return node && node->Type == CMP_TREE_NODE::LIB;
|
||||
return node ? node->Type == CMP_TREE_NODE::LIB : true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -194,12 +194,7 @@ void LIB_MANAGER_ADAPTER::addAliases( CMP_TREE_NODE_LIB& aLibNode )
|
|||
void LIB_MANAGER_ADAPTER::finishUpdate()
|
||||
{
|
||||
m_tree.AssignIntrinsicRanks();
|
||||
#ifdef __WINDOWS__
|
||||
// Normally one would call Item{Added,Changed,Deleted}() to notify the view
|
||||
// about changes, but ItemAdded() causes duplicate entries on Windows.
|
||||
// The only sensible way is to call Cleared() that rebuilds the model.
|
||||
Cleared();
|
||||
#endif /* __WINDOWS__ */
|
||||
m_tree.SortNodes();
|
||||
Resort();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue