Handle cancel when selecting copper layer.

Also changes the algorithm to ask only once, rather than one per
non-copper-layer object.

Fixes https://gitlab.com/kicad/code/kicad/issues/8767
This commit is contained in:
Jeff Young 2021-07-10 12:04:50 +01:00
parent 353dc95f06
commit e02bb80bf3
1 changed files with 12 additions and 4 deletions

View File

@ -550,10 +550,10 @@ int CONVERT_TOOL::PolyToLines( const TOOL_EVENT& aEvent )
return segs;
};
BOARD_COMMIT commit( m_frame );
BOARD_COMMIT commit( m_frame );
FOOTPRINT_EDIT_FRAME* fpEditor = dynamic_cast<FOOTPRINT_EDIT_FRAME*>( m_frame );
FOOTPRINT* footprint = nullptr;
FOOTPRINT* footprint = nullptr;
PCB_LAYER_ID copperLayer = UNSELECTED_LAYER;
if( fpEditor )
footprint = fpEditor->GetBoard()->GetFirstFootprint();
@ -597,7 +597,15 @@ int CONVERT_TOOL::PolyToLines( const TOOL_EVENT& aEvent )
BOARD_ITEM_CONTAINER* parent = frame->GetModel();
if( !IsCopperLayer( layer ) )
layer = frame->SelectOneLayer( F_Cu, LSET::AllNonCuMask() );
{
if( copperLayer == UNSELECTED_LAYER )
copperLayer = frame->SelectOneLayer( F_Cu, LSET::AllNonCuMask() );
if( copperLayer == UNDEFINED_LAYER ) // User cancelled
continue;
layer = copperLayer;
}
// I am really unsure converting a polygon to "tracks" (i.e. segments on
// copper layers) make sense for footprints, but anyway this code exists