Don't use lib tree target if lib tree isn't shown.

Fixes https://gitlab.com/kicad/code/kicad/issues/9913
This commit is contained in:
Jeff Young 2021-12-10 00:27:03 +00:00
parent 3cb7ca1db4
commit 4f60d7ac78
4 changed files with 15 additions and 9 deletions

View File

@ -586,9 +586,9 @@ void SYMBOL_EDIT_FRAME::OnToggleSymbolTree( wxCommandEvent& event )
}
bool SYMBOL_EDIT_FRAME::IsSymbolTreeShown()
bool SYMBOL_EDIT_FRAME::IsSymbolTreeShown() const
{
return m_auimgr.GetPane( m_treePane ).IsShown();
return const_cast<wxAuiManager&>( m_auimgr ).GetPane( m_treePane ).IsShown();
}
@ -882,7 +882,10 @@ LIB_SYMBOL* SYMBOL_EDIT_FRAME::getTargetSymbol() const
LIB_ID SYMBOL_EDIT_FRAME::GetTargetLibId() const
{
LIB_ID id = GetTreeLIBID();
LIB_ID id;
if( IsSymbolTreeShown() )
id = GetTreeLIBID();
if( id.GetLibNickname().empty() && m_symbol )
id = m_symbol->GetLibId();

View File

@ -172,7 +172,7 @@ public:
void OnToggleSymbolTree( wxCommandEvent& event );
bool IsSymbolTreeShown();
bool IsSymbolTreeShown() const;
void FreezeLibraryTree();
void ThawLibraryTree();

View File

@ -391,9 +391,9 @@ void FOOTPRINT_EDIT_FRAME::ToggleLayersManager()
}
bool FOOTPRINT_EDIT_FRAME::IsSearchTreeShown()
bool FOOTPRINT_EDIT_FRAME::IsSearchTreeShown() const
{
return m_auimgr.GetPane( m_treePane ).IsShown();
return const_cast<wxAuiManager&>( m_auimgr ).GetPane( m_treePane ).IsShown();
}
@ -417,10 +417,13 @@ LIB_TREE_NODE* FOOTPRINT_EDIT_FRAME::GetCurrentTreeNode() const
LIB_ID FOOTPRINT_EDIT_FRAME::GetTargetFPID() const
{
LIB_ID id = GetTreeFPID();
LIB_ID id;
if( IsSearchTreeShown() )
id = GetTreeFPID();
if( id.GetLibNickname().empty() )
return GetLoadedFPID();
id = GetLoadedFPID();
return id;
}

View File

@ -133,7 +133,7 @@ public:
void OnSaveFootprintAsPng( wxCommandEvent& event );
bool IsSearchTreeShown();
bool IsSearchTreeShown() const;
void ToggleSearchTree();
void ToggleLayersManager();