Update library trees when their items change.
Fixes https://gitlab.com/kicad/code/kicad/issues/4019
This commit is contained in:
parent
3e34c1783f
commit
d875d5850e
|
@ -386,6 +386,21 @@ unsigned int LIB_TREE_MODEL_ADAPTER::GetChildren( wxDataViewItem const& aItem,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LIB_TREE_MODEL_ADAPTER::RefreshTree( LIB_TREE_NODE* aNode )
|
||||||
|
{
|
||||||
|
if( !aNode )
|
||||||
|
aNode = &m_tree;
|
||||||
|
|
||||||
|
for( auto const& child: aNode->m_Children )
|
||||||
|
{
|
||||||
|
if( child->m_Score > 0 )
|
||||||
|
RefreshTree( child.get() );
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemChanged( ToItem( aNode ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LIB_TREE_MODEL_ADAPTER::HasContainerColumns( wxDataViewItem const& aItem ) const
|
bool LIB_TREE_MODEL_ADAPTER::HasContainerColumns( wxDataViewItem const& aItem ) const
|
||||||
{
|
{
|
||||||
return IsContainer( aItem );
|
return IsContainer( aItem );
|
||||||
|
|
|
@ -268,6 +268,8 @@ public:
|
||||||
void Thaw() { m_freeze--; }
|
void Thaw() { m_freeze--; }
|
||||||
bool IsFrozen() const { return m_freeze; }
|
bool IsFrozen() const { return m_freeze; }
|
||||||
|
|
||||||
|
void RefreshTree( LIB_TREE_NODE* aNode = nullptr );
|
||||||
|
|
||||||
// Allows subclasses to nominate a context menu handler.
|
// Allows subclasses to nominate a context menu handler.
|
||||||
virtual TOOL_INTERACTIVE* GetContextMenuTool() { return nullptr; }
|
virtual TOOL_INTERACTIVE* GetContextMenuTool() { return nullptr; }
|
||||||
|
|
||||||
|
|
|
@ -216,14 +216,7 @@ void LIB_TREE::Regenerate( bool aKeepState )
|
||||||
|
|
||||||
void LIB_TREE::RefreshLibTree()
|
void LIB_TREE::RefreshLibTree()
|
||||||
{
|
{
|
||||||
#ifdef __WXOSX__
|
m_adapter->RefreshTree();
|
||||||
// Yes, this is an enormous hack. It should be replaced if anyone can figure out a better
|
|
||||||
// way to get the OSX version to re-fetch the text and attributes from the dataModel for
|
|
||||||
// each visible item.
|
|
||||||
int width = m_tree_ctrl->GetColumn( 0 )->GetWidth();
|
|
||||||
m_tree_ctrl->GetColumn( 0 )->SetWidth( width + 1 );
|
|
||||||
m_tree_ctrl->GetColumn( 0 )->SetWidth( width );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue