diff --git a/common/preview_items/polygon_geom_manager.cpp b/common/preview_items/polygon_geom_manager.cpp index 2117974d26..82276ae3ec 100644 --- a/common/preview_items/polygon_geom_manager.cpp +++ b/common/preview_items/polygon_geom_manager.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KICAD, a free EDA CAD application. * - * Copyright (C) 2017 Kicad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2017-2019 Kicad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index b85cbeedf2..728ff16e0a 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2014-2017 CERN - * Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2018-2019 KiCad Developers, see AUTHORS.txt for contributors. * @author Maciej Suminski * * This program is free software; you can redistribute it and/or @@ -1431,7 +1431,6 @@ int DRAWING_TOOL::drawZone( bool aKeepout, ZONE_MODE aMode ) polyGeomMgr.SetFinished(); polyGeomMgr.Reset(); - // ready to start again started = false; m_controls->SetAutoPan( false ); m_controls->CaptureCursor( false ); diff --git a/pcbnew/tools/zone_create_helper.cpp b/pcbnew/tools/zone_create_helper.cpp index a7e3fc2dfb..189f7bd953 100644 --- a/pcbnew/tools/zone_create_helper.cpp +++ b/pcbnew/tools/zone_create_helper.cpp @@ -1,6 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. - * Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors. + * + * Copyright (C) 2017-2019 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -36,7 +37,7 @@ #include -ZONE_CREATE_HELPER::ZONE_CREATE_HELPER( DRAWING_TOOL& aTool, const PARAMS& aParams ): +ZONE_CREATE_HELPER::ZONE_CREATE_HELPER( DRAWING_TOOL& aTool, PARAMS& aParams ): m_tool( aTool ), m_params( aParams ), m_parentView( *aTool.getView() ) @@ -119,6 +120,10 @@ void ZONE_CREATE_HELPER::performZoneCutout( ZONE_CONTAINER& aZone, ZONE_CONTAINE BOARD* board = m_tool.getModel(); std::vector newZones; + // Clear the selection before removing the old zone + auto toolMgr = m_tool.GetManager(); + toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); + SHAPE_POLY_SET originalOutline( *aZone.Outline() ); originalOutline.BooleanSubtract( *aCutout.Outline(), SHAPE_POLY_SET::PM_FAST ); @@ -146,10 +151,10 @@ void ZONE_CREATE_HELPER::performZoneCutout( ZONE_CONTAINER& aZone, ZONE_CONTAINE ZONE_FILLER filler( board ); filler.Fill( newZones ); - auto toolMgr = m_tool.GetManager(); - - toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); + // Select the new zone and set it as the source for the next cutout toolMgr->RunAction( PCB_ACTIONS::selectItem, true, newZones[0] ); + m_params.m_sourceZone = newZones[0]; + } @@ -295,6 +300,7 @@ void ZONE_CREATE_HELPER::OnComplete( const POLYGON_GEOM_MANAGER& aMgr ) // hand the zone over to the committer commitZone( std::move( m_zone ) ); + m_zone = nullptr; } m_parentView.SetVisible( &m_previewItem, false ); diff --git a/pcbnew/tools/zone_create_helper.h b/pcbnew/tools/zone_create_helper.h index 838fdf3857..3b56abecb0 100644 --- a/pcbnew/tools/zone_create_helper.h +++ b/pcbnew/tools/zone_create_helper.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2017 Kicad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2017-2019 Kicad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -66,7 +66,7 @@ public: * @param aTool the DRAWING_TOOL to provide the zone tool to * @param aParams the parameters to use to guide the zone creation */ - ZONE_CREATE_HELPER( DRAWING_TOOL& aTool, const PARAMS& aParams ); + ZONE_CREATE_HELPER( DRAWING_TOOL& aTool, PARAMS& aParams ); ~ZONE_CREATE_HELPER(); @@ -126,7 +126,7 @@ private: DRAWING_TOOL& m_tool; ///> Parameters of the zone to be drawn - const PARAMS& m_params; + PARAMS& m_params; ///> The preview item to display KIGFX::PREVIEW::POLYGON_ITEM m_previewItem;