Browse Source

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
pull/15/head
jean-pierre charras 6 years ago
parent
commit
9ceca583b1
  1. 16
      cvpcb/cvpcb_mainframe.cpp
  2. 2
      cvpcb/cvpcb_mainframe.h

16
cvpcb/cvpcb_mainframe.cpp

@ -48,8 +48,8 @@
#include <tools/cvpcb_association_tool.h> #include <tools/cvpcb_association_tool.h>
#include <tools/cvpcb_control.h> #include <tools/cvpcb_control.h>
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 /// \ingroup config
@ -255,7 +255,8 @@ void CVPCB_MAINFRAME::setupEventHandlers()
Bind( wxEVT_BUTTON, Bind( wxEVT_BUTTON,
[this]( wxCommandEvent& ) [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 ); Close( true );
}, wxID_OK ); }, wxID_OK );
Bind( wxEVT_BUTTON, Bind( wxEVT_BUTTON,
@ -318,6 +319,13 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
// clear highlight symbol in schematic: // clear highlight symbol in schematic:
SendMessageToEESCHEMA( true ); 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 // Delete window
Destroy(); Destroy();
} }
@ -948,7 +956,7 @@ std::vector<unsigned int> CVPCB_MAINFRAME::GetComponentIndices(
} }
break; break;
case CVPCB_MAINFRAME::ASOC_COMPONENTS:
case CVPCB_MAINFRAME::ASSOC_COMPONENTS:
for( unsigned int i = 0; i < m_netlist.GetCount(); i++ ) for( unsigned int i = 0; i < m_netlist.GetCount(); i++ )
{ {
if( !m_netlist.GetComponent( i )->GetFPID().empty() ) if( !m_netlist.GetComponent( i )->GetFPID().empty() )

2
cvpcb/cvpcb_mainframe.h

@ -361,7 +361,7 @@ public:
ALL_COMPONENTS, ///< All components ALL_COMPONENTS, ///< All components
SEL_COMPONENTS, ///< Selected components SEL_COMPONENTS, ///< Selected components
NA_COMPONENTS, ///< Not associated components NA_COMPONENTS, ///< Not associated components
ASOC_COMPONENTS ///< Associated components
ASSOC_COMPONENTS ///< Associated components
}; };
/** /**

Loading…
Cancel
Save