From 6347cb043ed918f1ea6806f44dd545ea165e8637 Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Fri, 16 Feb 2024 23:18:11 +0300 Subject: [PATCH] Add bottom panel to have correct background in fp/sym chooser frames. See https://gitlab.com/kicad/code/kicad/-/issues/15810 (cherry picked from commit 97ff48b426ad7f383e685e39b890225e79ff1664) --- eeschema/symbol_chooser_frame.cpp | 19 +++++++++++++------ pcbnew/footprint_chooser_frame.cpp | 26 +++++++++++++++++--------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/eeschema/symbol_chooser_frame.cpp b/eeschema/symbol_chooser_frame.cpp index e4c9607041..456121969b 100644 --- a/eeschema/symbol_chooser_frame.cpp +++ b/eeschema/symbol_chooser_frame.cpp @@ -73,7 +73,7 @@ SYMBOL_CHOOSER_FRAME::SYMBOL_CHOOSER_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_messagePanel->Hide(); - wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* frameSizer = new wxBoxSizer( wxVERTICAL ); std::vector dummyAlreadyPlaced; m_chooserPanel = @@ -90,17 +90,24 @@ SYMBOL_CHOOSER_FRAME::SYMBOL_CHOOSER_FRAME( KIWAY* aKiway, wxWindow* aParent ) : } ); - sizer->Add( m_chooserPanel, 1, wxEXPAND, 5 ); + frameSizer->Add( m_chooserPanel, 1, wxEXPAND ); + + wxPanel* bottomPanel = new wxPanel( this ); + wxBoxSizer* bottomSizer = new wxBoxSizer( wxVERTICAL ); wxStdDialogButtonSizer* sdbSizer = new wxStdDialogButtonSizer(); - wxButton* okButton = new wxButton( this, wxID_OK ); - wxButton* cancelButton = new wxButton( this, wxID_CANCEL ); + wxButton* okButton = new wxButton( bottomPanel, wxID_OK ); + wxButton* cancelButton = new wxButton( bottomPanel, wxID_CANCEL ); sdbSizer->AddButton( okButton ); sdbSizer->AddButton( cancelButton ); sdbSizer->Realize(); - sizer->Add( sdbSizer, 0, wxEXPAND | wxALL, 5 ); - SetSizer( sizer ); + bottomSizer->Add( sdbSizer, 1, wxEXPAND | wxALL, 5 ); + + bottomPanel->SetSizer( bottomSizer ); + frameSizer->Add( bottomPanel, 0, wxEXPAND ); + + SetSizer( frameSizer ); SetTitle( GetTitle() + wxString::Format( _( " (%d items loaded)" ), m_chooserPanel->GetItemCount() ) ); diff --git a/pcbnew/footprint_chooser_frame.cpp b/pcbnew/footprint_chooser_frame.cpp index 923ee9b856..10516c9e4c 100644 --- a/pcbnew/footprint_chooser_frame.cpp +++ b/pcbnew/footprint_chooser_frame.cpp @@ -82,8 +82,11 @@ FOOTPRINT_CHOOSER_FRAME::FOOTPRINT_CHOOSER_FRAME( KIWAY* aKiway, wxWindow* aPare m_messagePanel->Hide(); - m_filterByFPFilters = new wxCheckBox( this, wxID_ANY, _( "Apply footprint filters" ) ); - m_filterByPinCount = new wxCheckBox( this, wxID_ANY, _( "Filter by pin count" ) ); + wxPanel* bottomPanel = new wxPanel( this ); + wxBoxSizer* bottomSizer = new wxBoxSizer( wxVERTICAL ); + + m_filterByFPFilters = new wxCheckBox( bottomPanel, wxID_ANY, _( "Apply footprint filters" ) ); + m_filterByPinCount = new wxCheckBox( bottomPanel, wxID_ANY, _( "Filter by pin count" ) ); m_filterByFPFilters->Show( false ); m_filterByPinCount->Show( false ); @@ -94,7 +97,8 @@ FOOTPRINT_CHOOSER_FRAME::FOOTPRINT_CHOOSER_FRAME( KIWAY* aKiway, wxWindow* aPare m_filterByPinCount->SetValue( cfg->m_FootprintChooser.filter_on_pin_count ); } - wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* frameSizer = new wxBoxSizer( wxVERTICAL ); + m_chooserPanel = new PANEL_FOOTPRINT_CHOOSER( this, this, s_FootprintHistoryList, // Filter [this]( LIB_TREE_NODE& aNode ) -> bool @@ -113,18 +117,18 @@ FOOTPRINT_CHOOSER_FRAME::FOOTPRINT_CHOOSER_FRAME( KIWAY* aKiway, wxWindow* aPare DismissModal( false ); } ); - sizer->Add( m_chooserPanel, 1, wxEXPAND | wxBOTTOM, 2 ); + frameSizer->Add( m_chooserPanel, 1, wxEXPAND ); wxBoxSizer* fpFilterSizer = new wxBoxSizer( wxVERTICAL ); fpFilterSizer->Add( m_filterByFPFilters, 0, wxTOP | wxEXPAND, 5 ); - sizer->Add( fpFilterSizer, 0, wxEXPAND | wxLEFT, 10 ); + bottomSizer->Add( fpFilterSizer, 0, wxEXPAND | wxLEFT, 10 ); wxBoxSizer* buttonsSizer = new wxBoxSizer( wxHORIZONTAL ); buttonsSizer->Add( m_filterByPinCount, 0, wxLEFT | wxTOP | wxALIGN_TOP, 5 ); wxStdDialogButtonSizer* sdbSizer = new wxStdDialogButtonSizer(); - wxButton* okButton = new wxButton( this, wxID_OK ); - wxButton* cancelButton = new wxButton( this, wxID_CANCEL ); + wxButton* okButton = new wxButton( bottomPanel, wxID_OK ); + wxButton* cancelButton = new wxButton( bottomPanel, wxID_CANCEL ); sdbSizer->AddButton( okButton ); sdbSizer->AddButton( cancelButton ); @@ -132,8 +136,12 @@ FOOTPRINT_CHOOSER_FRAME::FOOTPRINT_CHOOSER_FRAME( KIWAY* aKiway, wxWindow* aPare buttonsSizer->Add( sdbSizer, 1, wxALL, 5 ); - sizer->Add( buttonsSizer, 0, wxEXPAND | wxLEFT, 5 ); - SetSizer( sizer ); + bottomSizer->Add( buttonsSizer, 0, wxEXPAND | wxLEFT, 5 ); + + bottomPanel->SetSizer( bottomSizer ); + frameSizer->Add( bottomPanel, 0, wxEXPAND ); + + SetSizer( frameSizer ); SetTitle( GetTitle() + wxString::Format( _( " (%d items loaded)" ), m_chooserPanel->GetItemCount() ) );