Browse Source

Footprint Editor: Focus search field when window is first opened

The search field on the Symbol Editor is focused when its window 
is first opened. Similar behavior has been implemented in the search
field of the Footprint Editor with this change.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/13100
7.0
Tanay Gupta 3 years ago
committed by Seth Hillbrand
parent
commit
b0cbab5c4b
  1. 9
      common/widgets/lib_tree.cpp
  2. 5
      include/widgets/lib_tree.h
  3. 12
      pcbnew/footprint_edit_frame.cpp
  4. 9
      pcbnew/footprint_tree_pane.cpp
  5. 5
      pcbnew/footprint_tree_pane.h

9
common/widgets/lib_tree.cpp

@ -325,6 +325,15 @@ wxWindow* LIB_TREE::GetFocusTarget()
}
void LIB_TREE::FocusSearchFieldIfExists()
{
if( m_query_ctrl )
{
m_query_ctrl->SetFocus();
}
}
void LIB_TREE::toggleExpand( const wxDataViewItem& aTreeId )
{
if( !aTreeId.IsOk() )

5
include/widgets/lib_tree.h

@ -139,6 +139,11 @@ public:
wxWindow* GetFocusTarget();
/**
* Focus the search widget if it exists
*/
void FocusSearchFieldIfExists();
protected:
/**
* Expand or collapse a node, switching it to the opposite state.

12
pcbnew/footprint_edit_frame.cpp

@ -309,11 +309,13 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// Register a call to update the toolbar sizes. It can't be done immediately because
// it seems to require some sizes calculated that aren't yet (at least on GTK).
CallAfter( [&]()
{
// Ensure the controls on the toolbars all are correctly sized
UpdateToolbarControlSizes();
} );
CallAfter(
[&]()
{
// Ensure the controls on the toolbars all are correctly sized
UpdateToolbarControlSizes();
m_treePane->FocusSearchFieldIfExists();
} );
}

9
pcbnew/footprint_tree_pane.cpp

@ -50,6 +50,15 @@ FOOTPRINT_TREE_PANE::FOOTPRINT_TREE_PANE( FOOTPRINT_EDIT_FRAME* aParent )
}
void FOOTPRINT_TREE_PANE::FocusSearchFieldIfExists()
{
if( m_tree )
{
m_tree->FocusSearchFieldIfExists();
}
}
FOOTPRINT_TREE_PANE::~FOOTPRINT_TREE_PANE()
{
m_tree->Destroy();

5
pcbnew/footprint_tree_pane.h

@ -47,6 +47,11 @@ public:
return m_tree;
}
/**
* Focus the search widget if it exists
*/
void FocusSearchFieldIfExists();
protected:
void onComponentSelected( wxCommandEvent& aEvent );
void onUpdateUI( wxUpdateUIEvent& aEvent );

Loading…
Cancel
Save