From c61931996a1da72c45b1665a966fbb93c80bb567 Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Fri, 16 Jun 2023 17:42:15 +0300 Subject: [PATCH] PAGED_DIALOG: allow setting initial size in ctor. (cherry picked from commit f5da58e17d4f75238fb70b666aa6d2414d9d1ba7) --- common/eda_base_frame.cpp | 6 +----- common/widgets/paged_dialog.cpp | 4 ++-- eeschema/dialogs/dialog_schematic_setup.cpp | 6 +----- include/widgets/paged_dialog.h | 3 ++- pcbnew/dialogs/dialog_board_setup.cpp | 6 +----- 5 files changed, 7 insertions(+), 18 deletions(-) diff --git a/common/eda_base_frame.cpp b/common/eda_base_frame.cpp index 5bb39f57fd..e84c32ecaa 100644 --- a/common/eda_base_frame.cpp +++ b/common/eda_base_frame.cpp @@ -1021,7 +1021,7 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent { wxBeginBusyCursor( wxHOURGLASS_CURSOR ); - PAGED_DIALOG dlg( this, _( "Preferences" ), true ); + PAGED_DIALOG dlg( this, _( "Preferences" ), true, wxEmptyString, wxSize( 980, 560 ) ); dlg.SetEvtHandlerEnabled( false ); @@ -1182,10 +1182,6 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent if( !aStartPage.IsEmpty() ) dlg.SetInitialPage( aStartPage, aStartParentPage ); - // This is unfortunate, but it's the cost of lazy-loading the panels - book->SetMinSize( wxSize( 980, 560 ) ); - book->SetInitialSize( wxSize( 980, 560 ) ); - dlg.SetEvtHandlerEnabled( true ); wxEndBusyCursor(); diff --git a/common/widgets/paged_dialog.cpp b/common/widgets/paged_dialog.cpp index f9ad4c005a..d5f3b5cf9b 100644 --- a/common/widgets/paged_dialog.cpp +++ b/common/widgets/paged_dialog.cpp @@ -41,8 +41,8 @@ std::map g_lastParentPage; PAGED_DIALOG::PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle, bool aShowReset, - const wxString& aAuxiliaryAction ) : - DIALOG_SHIM( aParent, wxID_ANY, aTitle, wxDefaultPosition, wxDefaultSize, + const wxString& aAuxiliaryAction, const wxSize& aInitialSize ) : + DIALOG_SHIM( aParent, wxID_ANY, aTitle, wxDefaultPosition, aInitialSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ), m_auxiliaryButton( nullptr ), m_resetButton( nullptr ), diff --git a/eeschema/dialogs/dialog_schematic_setup.cpp b/eeschema/dialogs/dialog_schematic_setup.cpp index a7fa200c9d..3fabd75c7e 100644 --- a/eeschema/dialogs/dialog_schematic_setup.cpp +++ b/eeschema/dialogs/dialog_schematic_setup.cpp @@ -38,7 +38,7 @@ DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) : PAGED_DIALOG( aFrame, _( "Schematic Setup" ), true, - _( "Import Settings from Another Project..." ) ), + _( "Import Settings from Another Project..." ), wxSize( 920, 460 ) ), m_frame( aFrame ) { SetEvtHandlerEnabled( false ); @@ -112,10 +112,6 @@ DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) : for( size_t i = 0; i < m_treebook->GetPageCount(); ++i ) m_treebook->ExpandNode( i ); - // This is unfortunate, but it's the cost of lazy-loading the panels - m_treebook->SetMinSize( wxSize( 920, 460 ) ); - m_treebook->SetInitialSize( wxSize( 920, 460 ) ); - SetEvtHandlerEnabled( true ); finishDialogSettings(); diff --git a/include/widgets/paged_dialog.h b/include/widgets/paged_dialog.h index ecdcb786de..005d380594 100644 --- a/include/widgets/paged_dialog.h +++ b/include/widgets/paged_dialog.h @@ -32,7 +32,8 @@ class PAGED_DIALOG : public DIALOG_SHIM { public: PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle, bool aShowReset, - const wxString& aAuxiliaryAction = wxEmptyString ); + const wxString& aAuxiliaryAction = wxEmptyString, + const wxSize& aInitialSize = wxDefaultSize ); ~PAGED_DIALOG() override; WX_TREEBOOK* GetTreebook() { return m_treebook; } diff --git a/pcbnew/dialogs/dialog_board_setup.cpp b/pcbnew/dialogs/dialog_board_setup.cpp index 1ec16c2f34..c55f0ff241 100644 --- a/pcbnew/dialogs/dialog_board_setup.cpp +++ b/pcbnew/dialogs/dialog_board_setup.cpp @@ -51,7 +51,7 @@ std::mutex DIALOG_BOARD_SETUP::g_Mutex; DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) : PAGED_DIALOG( aFrame, _( "Board Setup" ), false, - _( "Import Settings from Another Board..." ) ), + _( "Import Settings from Another Board..." ), wxSize( 980, 600 ) ), m_frame( aFrame ), m_layers( nullptr ), m_physicalStackup( nullptr ), @@ -178,10 +178,6 @@ DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) : for( size_t i = 0; i < m_treebook->GetPageCount(); ++i ) m_treebook->ExpandNode( i ); - // This is unfortunate, but it's the cost of lazy-loading the panels - m_treebook->SetMinSize( wxSize( 980, 600 ) ); - m_treebook->SetInitialSize( wxSize( 980, 600 ) ); - SetEvtHandlerEnabled( true ); finishDialogSettings();