Treat canvas item as current when tree view contains no selection.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12702
This commit is contained in:
parent
039f23eba8
commit
1528f4700c
|
@ -417,6 +417,12 @@ wxDataViewItem LIB_TREE_MODEL_ADAPTER::FindItem( const LIB_ID& aLibId )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxDataViewItem LIB_TREE_MODEL_ADAPTER::GetCurrentDataViewItem()
|
||||||
|
{
|
||||||
|
return FindItem( m_preselect_lib_id );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned int LIB_TREE_MODEL_ADAPTER::GetChildren( const wxDataViewItem& aItem,
|
unsigned int LIB_TREE_MODEL_ADAPTER::GetChildren( const wxDataViewItem& aItem,
|
||||||
wxDataViewItemArray& aChildren ) const
|
wxDataViewItemArray& aChildren ) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -529,7 +529,11 @@ void LIB_TREE::onDebounceTimer( wxTimerEvent& aEvent )
|
||||||
|
|
||||||
void LIB_TREE::onQueryCharHook( wxKeyEvent& aKeyStroke )
|
void LIB_TREE::onQueryCharHook( wxKeyEvent& aKeyStroke )
|
||||||
{
|
{
|
||||||
const wxDataViewItem sel = m_tree_ctrl->GetSelection();
|
wxDataViewItem sel = m_tree_ctrl->GetSelection();
|
||||||
|
|
||||||
|
if( !sel.IsOk() )
|
||||||
|
sel = m_adapter->GetCurrentDataViewItem();
|
||||||
|
|
||||||
LIB_TREE_NODE::TYPE type = sel.IsOk() ? m_adapter->GetTypeFor( sel ) : LIB_TREE_NODE::INVALID;
|
LIB_TREE_NODE::TYPE type = sel.IsOk() ? m_adapter->GetTypeFor( sel ) : LIB_TREE_NODE::INVALID;
|
||||||
|
|
||||||
switch( aKeyStroke.GetKeyCode() )
|
switch( aKeyStroke.GetKeyCode() )
|
||||||
|
|
|
@ -208,6 +208,15 @@ SYMBOL_TREE_SYNCHRONIZING_ADAPTER::deleteLibrary( LIB_TREE_NODE::PTR_VECTOR::ite
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxDataViewItem SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetCurrentDataViewItem()
|
||||||
|
{
|
||||||
|
if( m_frame->GetCurSymbol() )
|
||||||
|
return FindItem( m_frame->GetCurSymbol()->GetLibId() );
|
||||||
|
|
||||||
|
return wxDataViewItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataViewItem const& aItem,
|
void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataViewItem const& aItem,
|
||||||
unsigned int aCol ) const
|
unsigned int aCol ) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,6 +48,8 @@ public:
|
||||||
|
|
||||||
TOOL_INTERACTIVE* GetContextMenuTool() override;
|
TOOL_INTERACTIVE* GetContextMenuTool() override;
|
||||||
|
|
||||||
|
wxDataViewItem GetCurrentDataViewItem() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void updateLibrary( LIB_TREE_NODE_LIB& aLibNode );
|
void updateLibrary( LIB_TREE_NODE_LIB& aLibNode );
|
||||||
|
|
||||||
|
|
|
@ -283,6 +283,8 @@ public:
|
||||||
*/
|
*/
|
||||||
wxDataViewItem FindItem( const LIB_ID& aLibId );
|
wxDataViewItem FindItem( const LIB_ID& aLibId );
|
||||||
|
|
||||||
|
virtual wxDataViewItem GetCurrentDataViewItem();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populate a list of all the children of an item
|
* Populate a list of all the children of an item
|
||||||
*
|
*
|
||||||
|
|
|
@ -230,7 +230,6 @@ protected:
|
||||||
wxTimer* m_debounceTimer;
|
wxTimer* m_debounceTimer;
|
||||||
bool m_inTimerEvent;
|
bool m_inTimerEvent;
|
||||||
|
|
||||||
LIB_ID m_last_libid;
|
|
||||||
wxString m_recentSearchesKey;
|
wxString m_recentSearchesKey;
|
||||||
|
|
||||||
bool m_skipNextRightClick;
|
bool m_skipNextRightClick;
|
||||||
|
|
|
@ -169,6 +169,12 @@ FP_TREE_SYNCHRONIZING_ADAPTER::deleteLibrary( LIB_TREE_NODE::PTR_VECTOR::iterato
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxDataViewItem FP_TREE_SYNCHRONIZING_ADAPTER::GetCurrentDataViewItem()
|
||||||
|
{
|
||||||
|
return FindItem( m_frame->GetLoadedFPID() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void FP_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataViewItem const& aItem,
|
void FP_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataViewItem const& aItem,
|
||||||
unsigned int aCol ) const
|
unsigned int aCol ) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,6 +44,8 @@ public:
|
||||||
|
|
||||||
TOOL_INTERACTIVE* GetContextMenuTool() override;
|
TOOL_INTERACTIVE* GetContextMenuTool() override;
|
||||||
|
|
||||||
|
wxDataViewItem GetCurrentDataViewItem() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FP_TREE_SYNCHRONIZING_ADAPTER( FOOTPRINT_EDIT_FRAME* aFrame, FP_LIB_TABLE* aLibs );
|
FP_TREE_SYNCHRONIZING_ADAPTER( FOOTPRINT_EDIT_FRAME* aFrame, FP_LIB_TABLE* aLibs );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue