Work around GTK issue with wxSearchCtrl

Also remove redundant icons in LIB_TREE (recent GTK
search controls have an icon built-in)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/9019
This commit is contained in:
Jon Evans 2021-08-24 23:04:20 -04:00
parent 2b3477ca28
commit 5f2d238c93
3 changed files with 19 additions and 8 deletions

View File

@ -58,6 +58,12 @@ static wxSearchCtrl* CreateTextFilterBox( wxWindow* aParent, const wxString& aDe
search_widget->SetDescriptiveText( aDescriptiveText );
#ifdef __WXGTK__
// wxSearchCtrl vertical height is not calculated correctly on some GTK setups
// See https://gitlab.com/kicad/code/kicad/-/issues/9019
search_widget->SetMinSize( wxSize( -1, aParent->GetTextExtent( wxT( "qb" ) ).y + 10 ) );
#endif
return search_widget;
}

View File

@ -58,16 +58,14 @@ LIB_TREE::LIB_TREE( wxWindow* aParent, LIB_TABLE* aLibTable,
m_query_ctrl->ShowCancelButton( true );
#ifdef __WXGTK__
// wxSearchCtrl vertical height is not calculated correctly on some GTK setups
// See https://gitlab.com/kicad/code/kicad/-/issues/9019
m_query_ctrl->SetMinSize( wxSize( -1, GetTextExtent( wxT( "qb" ) ).y + 10 ) );
#endif
m_debounceTimer = new wxTimer( this );
// Additional visual cue for GTK, which hides the placeholder text on focus
#ifdef __WXGTK__
wxStaticBitmap* bitmap = new wxStaticBitmap( this, wxID_ANY,
wxArtProvider::GetBitmap( wxART_FIND,
wxART_FRAME_ICON ) );
search_sizer->Add( bitmap, 0, wxALIGN_CENTER | wxRIGHT, 5 );
#endif
search_sizer->Add( m_query_ctrl, 1, wxEXPAND, 5 );
sizer->Add( search_sizer, 0, wxEXPAND, 5 );

View File

@ -161,6 +161,13 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
"A term which is a number will also match against the pad count." ) );
fpSizer->Add( m_fpFilter, 0, wxEXPAND, 5 );
#ifdef __WXGTK__
// wxSearchCtrl vertical height is not calculated correctly on some GTK setups
// See https://gitlab.com/kicad/code/kicad/-/issues/9019
m_libFilter->SetMinSize( wxSize( -1, GetTextExtent( wxT( "qb" ) ).y + 10 ) );
m_fpFilter->SetMinSize( wxSize( -1, GetTextExtent( wxT( "qb" ) ).y + 10 ) );
#endif
m_fpList = new wxListBox( fpPanel, ID_MODVIEW_FOOTPRINT_LIST, wxDefaultPosition, wxDefaultSize,
0, nullptr, wxLB_HSCROLL | wxNO_BORDER );
fpSizer->Add( m_fpList, 1, wxEXPAND, 5 );