From 9ceca583b1edcba2198c0dbd1a07caf69d62f93e Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 18 Sep 2019 09:57:26 +0200 Subject: [PATCH] Cvpcb: fix minor issues: - Config not saved - Confirmation dialog show after clicking on the OK button. Fixes: lp:1844457 https://bugs.launchpad.net/kicad/+bug/1844457 --- cvpcb/cvpcb_mainframe.cpp | 16 ++++++++++++---- cvpcb/cvpcb_mainframe.h | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/cvpcb/cvpcb_mainframe.cpp b/cvpcb/cvpcb_mainframe.cpp index 923a943daf..83c42df09e 100644 --- a/cvpcb/cvpcb_mainframe.cpp +++ b/cvpcb/cvpcb_mainframe.cpp @@ -48,8 +48,8 @@ #include #include -wxSize const FRAME_MIN_SIZE_DU( 350, 250 ); -wxSize const FRAME_DEFAULT_SIZE_DU( 450, 300 ); +wxSize const FRAME_MIN_SIZE_DU( 400, 300 ); +wxSize const FRAME_DEFAULT_SIZE_DU( 500, 400 ); ///@{ /// \ingroup config @@ -255,7 +255,8 @@ void CVPCB_MAINFRAME::setupEventHandlers() Bind( wxEVT_BUTTON, [this]( wxCommandEvent& ) { - this->GetToolManager()->RunAction( CVPCB_ACTIONS::saveAssociations ); + // saveAssociations must be run immediatley, before running Close( true ) + this->GetToolManager()->RunAction( CVPCB_ACTIONS::saveAssociations, true ); Close( true ); }, wxID_OK ); Bind( wxEVT_BUTTON, @@ -318,6 +319,13 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event ) // clear highlight symbol in schematic: SendMessageToEESCHEMA( true ); + // Save config. Because the wxCloseEvent is captured, + // the EDA_BASE_FRAME will not see the event and will not save the config. + wxConfigBase* cfg = config(); + + if( cfg ) + SaveSettings( cfg ); + // Delete window Destroy(); } @@ -948,7 +956,7 @@ std::vector CVPCB_MAINFRAME::GetComponentIndices( } break; - case CVPCB_MAINFRAME::ASOC_COMPONENTS: + case CVPCB_MAINFRAME::ASSOC_COMPONENTS: for( unsigned int i = 0; i < m_netlist.GetCount(); i++ ) { if( !m_netlist.GetComponent( i )->GetFPID().empty() ) diff --git a/cvpcb/cvpcb_mainframe.h b/cvpcb/cvpcb_mainframe.h index 6c821d9743..b6d38aadec 100644 --- a/cvpcb/cvpcb_mainframe.h +++ b/cvpcb/cvpcb_mainframe.h @@ -361,7 +361,7 @@ public: ALL_COMPONENTS, ///< All components SEL_COMPONENTS, ///< Selected components NA_COMPONENTS, ///< Not associated components - ASOC_COMPONENTS ///< Associated components + ASSOC_COMPONENTS ///< Associated components }; /**