diff --git a/pcbnew/initpcb.cpp b/pcbnew/initpcb.cpp index d0c64bb7dc..b91fdc1cbc 100644 --- a/pcbnew/initpcb.cpp +++ b/pcbnew/initpcb.cpp @@ -34,6 +34,8 @@ #include #include +#include +#include "tools/pcb_actions.h" bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery ) @@ -41,6 +43,10 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery ) if( GetBoard() == NULL ) return false; + // Gal canvas: Ensure there are no selected items in selection list. + // (all items will be deleted): + GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true ); + if( aQuery && !GetBoard()->IsEmpty() ) { if( !IsOK( this, @@ -99,6 +105,10 @@ bool FOOTPRINT_EDIT_FRAME::Clear_Pcb( bool aQuery ) if( GetBoard() == NULL ) return false; + // Gal canvas: Ensure there are no selected items in selection list. + // (all items will be deleted): + GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true ); + if( aQuery && GetScreen()->IsModify() && !GetBoard()->IsEmpty() ) { wxSafeYield( this, true ); // Allow frame to come to front before showing warning.