Browse Source

Save search & design block panel heights/widths.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19845
9.0
Jeff Young 9 months ago
parent
commit
bf4c10923f
  1. 11
      common/widgets/search_pane.cpp
  2. 21
      eeschema/widgets/design_block_pane.cpp
  3. 2
      eeschema/widgets/design_block_pane.h
  4. 7
      include/widgets/search_pane.h

11
common/widgets/search_pane.cpp

@ -157,10 +157,8 @@ void SEARCH_PANE::RefreshSearch()
void SEARCH_PANE::ClearAllResults() void SEARCH_PANE::ClearAllResults()
{ {
for( SEARCH_PANE_TAB* tab : m_tabs ) for( SEARCH_PANE_TAB* tab : m_tabs )
{
tab->Clear(); tab->Clear();
} }
}
void SEARCH_PANE::OnSearchTextEntry( wxCommandEvent& aEvent ) void SEARCH_PANE::OnSearchTextEntry( wxCommandEvent& aEvent )
@ -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 SEARCH_PANE_TAB* SEARCH_PANE::GetCurrentTab() const
{ {
return dynamic_cast<SEARCH_PANE_TAB*>( m_notebook->GetCurrentPage() ); return dynamic_cast<SEARCH_PANE_TAB*>( m_notebook->GetCurrentPage() );

21
eeschema/widgets/design_block_pane.cpp

@ -24,7 +24,6 @@
#include <design_block.h> #include <design_block.h>
#include <widgets/design_block_pane.h> #include <widgets/design_block_pane.h>
#include <widgets/panel_design_block_chooser.h> #include <widgets/panel_design_block_chooser.h>
#include <eeschema_settings.h>
#include <kiface_base.h> #include <kiface_base.h>
#include <sch_edit_frame.h> #include <sch_edit_frame.h>
#include <core/kicad_algo.h> #include <core/kicad_algo.h>
@ -32,8 +31,6 @@
#include <wx/button.h> #include <wx/button.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <confirm.h>
#include <wildcards_and_files_ext.h>
#include <ee_actions.h> #include <ee_actions.h>
#include <tool/tool_manager.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 ) m_frame( aParent )
{ {
wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
m_chooserPanel = new PANEL_DESIGN_BLOCK_CHOOSER( aParent, this, aHistoryList, m_chooserPanel = new PANEL_DESIGN_BLOCK_CHOOSER( aParent, this, aHistoryList,
[aParent]()
// Accept handler
[this]()
{ {
aParent->GetToolManager()->RunAction(
EE_ACTIONS::placeDesignBlock );
m_frame->GetToolManager()->RunAction( EE_ACTIONS::placeDesignBlock );
} ); } );
sizer->Add( m_chooserPanel, 1, wxEXPAND, 5 ); sizer->Add( m_chooserPanel, 1, wxEXPAND, 5 );
if( aPreselect && aPreselect->IsValid() ) if( aPreselect && aPreselect->IsValid() )
@ -86,6 +85,7 @@ DESIGN_BLOCK_PANE::DESIGN_BLOCK_PANE( SCH_EDIT_FRAME* aParent, const LIB_ID* aPr
Layout(); Layout();
Bind( wxEVT_CHAR_HOOK, &PANEL_DESIGN_BLOCK_CHOOSER::OnChar, m_chooserPanel ); 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 ); 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() void DESIGN_BLOCK_PANE::setLabelsAndTooltips()
{ {
if( m_repeatedPlacement ) if( m_repeatedPlacement )

2
eeschema/widgets/design_block_pane.h

@ -80,6 +80,8 @@ public:
void OnDeleteLibrary( wxCommandEvent& aEvent ); void OnDeleteLibrary( wxCommandEvent& aEvent );
void OnDeleteDesignBlock( wxCommandEvent& aEvent ); void OnDeleteDesignBlock( wxCommandEvent& aEvent );
void OnSize( wxSizeEvent& aEvent );
PANEL_DESIGN_BLOCK_CHOOSER* GetDesignBlockPanel() const { return m_chooserPanel; } PANEL_DESIGN_BLOCK_CHOOSER* GetDesignBlockPanel() const { return m_chooserPanel; }
protected: protected:

7
include/widgets/search_pane.h

@ -61,12 +61,6 @@ protected:
}; };
struct SEARCH_SETTINGS
{
bool m_ZoomToSelection = false;
};
class SEARCH_PANE : public SEARCH_PANE_BASE class SEARCH_PANE : public SEARCH_PANE_BASE
{ {
public: public:
@ -76,6 +70,7 @@ public:
void AddSearcher( SEARCH_HANDLER* aHandler ); void AddSearcher( SEARCH_HANDLER* aHandler );
void OnSearchTextEntry( wxCommandEvent& aEvent ) override; void OnSearchTextEntry( wxCommandEvent& aEvent ) override;
void OnNotebookPageChanged( wxBookCtrlEvent& aEvent ) override; void OnNotebookPageChanged( wxBookCtrlEvent& aEvent ) override;
void OnSize( wxSizeEvent& aEvent ) override;
void RefreshSearch(); void RefreshSearch();
void FocusSearch(); void FocusSearch();

Loading…
Cancel
Save