diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index c65dfb870a..a14fd101d0 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -135,6 +135,8 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, PAD* aPad m_spokeWidth( aParent, m_spokeWidthLabel, m_spokeWidthCtrl, m_spokeWidthUnits, true ), m_thermalGap( aParent, m_thermalGapLabel, m_thermalGapCtrl, m_thermalGapUnits, true ) { + SetName( PAD_PROPERTIES_DLG_NAME ); + m_currentPad = aPad; // aPad can be NULL, if the dialog is called // from the footprint editor to set default pad setup diff --git a/pcbnew/dialogs/dialog_pad_properties.h b/pcbnew/dialogs/dialog_pad_properties.h index 09034173fd..df2ce6d93a 100644 --- a/pcbnew/dialogs/dialog_pad_properties.h +++ b/pcbnew/dialogs/dialog_pad_properties.h @@ -44,6 +44,9 @@ * DIALOG_PAD_PROPERTIES, derived from DIALOG_PAD_PROPERTIES_BASE, * created by wxFormBuilder */ +// The wxWidgets window name. Used to retrieve the dialog by window name +#define PAD_PROPERTIES_DLG_NAME "pad_properties_dlg_name" + class DIALOG_PAD_PROPERTIES : public DIALOG_PAD_PROPERTIES_BASE { public: diff --git a/pcbnew/load_select_footprint.cpp b/pcbnew/load_select_footprint.cpp index df155666cd..e68a3a30a4 100644 --- a/pcbnew/load_select_footprint.cpp +++ b/pcbnew/load_select_footprint.cpp @@ -51,6 +51,7 @@ using namespace std::placeholders; #include #include #include +#include #include "fp_tree_model_adapter.h" @@ -98,6 +99,12 @@ bool FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard( FOOTPRINT* aFootprint ) if( aFootprint == NULL ) return false; + // Ensure we do not have the pad editor open (that is apseudo modal dlg). + // LoadFootprintFromBoard() can be called from the board editor, and we must ensure + // no footprint item is currently in edit + if( wxWindow::FindWindowByName( PAD_PROPERTIES_DLG_NAME ) ) + wxWindow::FindWindowByName( PAD_PROPERTIES_DLG_NAME )->Close(); + if( !Clear_Pcb( true ) ) return false;