Allow duplicating a zone onto the same layer in a GAL canvas.

Duplicate already works, so there's little reason to disallow
using the zone dialog to do it.

The legacy canvas can't be fixed because we'll immediately
union the two zones, resulting in a no-op.

Fixes: lp:1464677
* https://bugs.launchpad.net/kicad/+bug/1464677
This commit is contained in:
Jeff Young 2018-04-29 20:26:56 +01:00
parent ae711d9994
commit c8a784058e
2 changed files with 7 additions and 20 deletions

View File

@ -796,30 +796,17 @@ int PCB_EDITOR_CONTROL::ZoneDuplicate( const TOOL_EVENT& aEvent )
else
success = InvokeNonCopperZonesEditor( m_frame, oldZone, &zoneSettings );
// If the new zone is on the same layer as the the initial zone,
// do nothing
if( success )
{
if( oldZone->GetIsKeepout() && ( oldZone->GetLayerSet() == zoneSettings.m_Layers ) )
{
DisplayError(
m_frame, _( "The duplicated keepout zone cannot be on the same layers as the original zone." ) );
success = false;
}
else if( !oldZone->GetIsKeepout() && ( oldZone->GetLayer() == zoneSettings.m_CurrentZone_Layer ) )
{
DisplayError(
m_frame, _( "The duplicated zone cannot be on the same layer as the original zone." ) );
success = false;
}
}
// duplicate the zone
if( success )
{
BOARD_COMMIT commit( m_frame );
zoneSettings.ExportSetting( *newZone );
// If the new zone is on the same layer(s) as the the initial zone,
// offset it a bit so it can more easily be picked.
if( oldZone->GetLayerSet() == zoneSettings.m_Layers )
newZone->Move( wxPoint( IU_PER_MM, IU_PER_MM ) );
commit.Add( newZone.release() );
commit.Push( _( "Duplicate zone" ) );
}

View File

@ -129,8 +129,8 @@ void PCB_EDIT_FRAME::duplicateZone( wxDC* aDC, ZONE_CONTAINER* aZone )
else
success = InvokeNonCopperZonesEditor( this, aZone, &zoneSettings );
// If the new zone is on the same layer as the the initial zone,
// do nothing
// If the new zone is on the same layer as the the initial zone we'll end up combining
// them which will result in a no-op. Might as well exit here.
if( success )
{
if( aZone->GetIsKeepout() && ( aZone->GetLayerSet() == zoneSettings.m_Layers ) )