diff --git a/common/widgets/search_pane.cpp b/common/widgets/search_pane.cpp index c06d49d930..0be4a47345 100644 --- a/common/widgets/search_pane.cpp +++ b/common/widgets/search_pane.cpp @@ -157,9 +157,7 @@ void SEARCH_PANE::RefreshSearch() void SEARCH_PANE::ClearAllResults() { for( SEARCH_PANE_TAB* tab : m_tabs ) - { tab->Clear(); - } } @@ -187,6 +185,15 @@ void SEARCH_PANE::OnNotebookPageChanged( wxBookCtrlEvent& aEvent ) } +void SEARCH_PANE::OnSize( wxSizeEvent& aEvent ) +{ + if( APP_SETTINGS_BASE* cfg = m_frame->config() ) + m_frame->SaveSettings( cfg ); + + aEvent.Skip(); +} + + SEARCH_PANE_TAB* SEARCH_PANE::GetCurrentTab() const { return dynamic_cast<SEARCH_PANE_TAB*>( m_notebook->GetCurrentPage() ); diff --git a/eeschema/widgets/design_block_pane.cpp b/eeschema/widgets/design_block_pane.cpp index 24e7d52c65..6254ac8254 100644 --- a/eeschema/widgets/design_block_pane.cpp +++ b/eeschema/widgets/design_block_pane.cpp @@ -24,7 +24,6 @@ #include <design_block.h> #include <widgets/design_block_pane.h> #include <widgets/panel_design_block_chooser.h> -#include <eeschema_settings.h> #include <kiface_base.h> #include <sch_edit_frame.h> #include <core/kicad_algo.h> @@ -32,8 +31,6 @@ #include <wx/button.h> #include <wx/checkbox.h> #include <wx/sizer.h> -#include <confirm.h> -#include <wildcards_and_files_ext.h> #include <ee_actions.h> #include <tool/tool_manager.h> @@ -49,12 +46,14 @@ DESIGN_BLOCK_PANE::DESIGN_BLOCK_PANE( SCH_EDIT_FRAME* aParent, const LIB_ID* aPr m_frame( aParent ) { wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL ); + m_chooserPanel = new PANEL_DESIGN_BLOCK_CHOOSER( aParent, this, aHistoryList, - [aParent]() - { - aParent->GetToolManager()->RunAction( - EE_ACTIONS::placeDesignBlock ); - } ); + // Accept handler + [this]() + { + m_frame->GetToolManager()->RunAction( EE_ACTIONS::placeDesignBlock ); + } ); + sizer->Add( m_chooserPanel, 1, wxEXPAND, 5 ); if( aPreselect && aPreselect->IsValid() ) @@ -86,6 +85,7 @@ DESIGN_BLOCK_PANE::DESIGN_BLOCK_PANE( SCH_EDIT_FRAME* aParent, const LIB_ID* aPr Layout(); Bind( wxEVT_CHAR_HOOK, &PANEL_DESIGN_BLOCK_CHOOSER::OnChar, m_chooserPanel ); + Bind( wxEVT_SIZE, &DESIGN_BLOCK_PANE::OnSize, this ); m_frame->Bind( EDA_LANG_CHANGED, &DESIGN_BLOCK_PANE::OnLanguageChanged, this ); } @@ -96,6 +96,15 @@ DESIGN_BLOCK_PANE::~DESIGN_BLOCK_PANE() } +void DESIGN_BLOCK_PANE::OnSize( wxSizeEvent &aEvent ) +{ + if( APP_SETTINGS_BASE* cfg = m_frame->config() ) + m_frame->SaveSettings( cfg ); + + aEvent.Skip(); +} + + void DESIGN_BLOCK_PANE::setLabelsAndTooltips() { if( m_repeatedPlacement ) diff --git a/eeschema/widgets/design_block_pane.h b/eeschema/widgets/design_block_pane.h index aed566e7a9..f0fe621065 100644 --- a/eeschema/widgets/design_block_pane.h +++ b/eeschema/widgets/design_block_pane.h @@ -80,6 +80,8 @@ public: void OnDeleteLibrary( wxCommandEvent& aEvent ); void OnDeleteDesignBlock( wxCommandEvent& aEvent ); + void OnSize( wxSizeEvent& aEvent ); + PANEL_DESIGN_BLOCK_CHOOSER* GetDesignBlockPanel() const { return m_chooserPanel; } protected: diff --git a/include/widgets/search_pane.h b/include/widgets/search_pane.h index 46330f8724..0fb289b47d 100644 --- a/include/widgets/search_pane.h +++ b/include/widgets/search_pane.h @@ -61,12 +61,6 @@ protected: }; -struct SEARCH_SETTINGS -{ - bool m_ZoomToSelection = false; -}; - - class SEARCH_PANE : public SEARCH_PANE_BASE { public: @@ -76,6 +70,7 @@ public: void AddSearcher( SEARCH_HANDLER* aHandler ); void OnSearchTextEntry( wxCommandEvent& aEvent ) override; void OnNotebookPageChanged( wxBookCtrlEvent& aEvent ) override; + void OnSize( wxSizeEvent& aEvent ) override; void RefreshSearch(); void FocusSearch();