Fix minor issues in DIALOG_KEEPOUT_AREA_PROPERTIES.

Fix keepout zone creation in legacy canvas.
Add a comment in lset.cpp
This commit is contained in:
jean-pierre charras 2017-09-27 09:59:12 +02:00
parent 42be6bb966
commit b4a59eb96d
3 changed files with 268 additions and 275 deletions

View File

@ -554,25 +554,26 @@ LSET FlipLayerMask( LSET aMask, int aCopperLayersCount )
if( aCopperLayersCount >= 4 ) // Internal layers exist if( aCopperLayersCount >= 4 ) // Internal layers exist
{ {
LSET internalMask = aMask & LSET::InternalCuMask(); LSET internalMask = aMask & LSET::InternalCuMask();
if( internalMask != LSET::InternalCuMask() ) if( internalMask != LSET::InternalCuMask() )
{ {
// the mask does not include all internal layers. Therefore // the mask does not include all internal layers. Therefore
// the flipped mask for internal copper layers must be built // the flipped mask for internal copper layers must be built
int innerLayerCnt = aCopperLayersCount -2; int innerLayerCnt = aCopperLayersCount -2;
// the flipped mask is the innerLayerCnt bits rewritten in reverse order
// ( bits innerLayerCnt to 1 rewritten in bits 1 to innerLayerCnt )
for( int ii = 0; ii < innerLayerCnt; ii++ ) for( int ii = 0; ii < innerLayerCnt; ii++ )
{ {
if( internalMask[innerLayerCnt - ii] ) if( internalMask[innerLayerCnt - ii] )
{ {
newMask.set( ii + In1_Cu ); newMask.set( ii + In1_Cu );
} }
else else
{ {
newMask.reset( ii + In1_Cu ); newMask.reset( ii + In1_Cu );
} }
} }
} }
} }

View File

@ -1,206 +1,205 @@
/** /**
* @file dialog_keepout_area_properties.cpp * @file dialog_keepout_area_properties.cpp
*/ */
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here: * along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license, * or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc., * or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <wx/wx.h> #include <wx/wx.h>
#include <fctsys.h> #include <fctsys.h>
#include <kiface_i.h> #include <kiface_i.h>
#include <confirm.h> #include <confirm.h>
#include <pcbnew.h> #include <pcbnew.h>
#include <wxPcbStruct.h> #include <wxPcbStruct.h>
#include <class_zone.h> #include <class_zone.h>
#include <zones.h> #include <zones.h>
#include <base_units.h> #include <base_units.h>
#include <class_zone_settings.h> #include <class_zone_settings.h>
#include <class_board.h> #include <class_board.h>
#include <dialog_keepout_area_properties_base.h> #include <dialog_keepout_area_properties_base.h>
#include <wx/imaglist.h> // needed for wx/listctrl.h, in wxGTK 2.8.12 #include <wx/imaglist.h> // needed for wx/listctrl.h, in wxGTK 2.8.12
#include <wx/listctrl.h> #include <wx/listctrl.h>
/** /**
* Class DIALOG_KEEPOUT_AREA_PROPERTIES * Class DIALOG_KEEPOUT_AREA_PROPERTIES
* is the derived class from dialog_copper_zone_frame created by wxFormBuilder * is the derived class from dialog_copper_zone_frame created by wxFormBuilder
*/ */
class DIALOG_KEEPOUT_AREA_PROPERTIES : public DIALOG_KEEPOUT_AREA_PROPERTIES_BASE class DIALOG_KEEPOUT_AREA_PROPERTIES : public DIALOG_KEEPOUT_AREA_PROPERTIES_BASE
{ {
public: public:
DIALOG_KEEPOUT_AREA_PROPERTIES( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings ); DIALOG_KEEPOUT_AREA_PROPERTIES( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings );
private: private:
PCB_BASE_FRAME* m_parent; PCB_BASE_FRAME* m_parent;
wxConfigBase* m_config; ///< Current config wxConfigBase* m_config; ///< Current config
ZONE_SETTINGS m_zonesettings; ZONE_SETTINGS m_zonesettings;
ZONE_SETTINGS* m_ptr; ZONE_SETTINGS* m_ptr;
/** /**
* Function initDialog * Function initDialog
* fills in the dialog controls using the current settings. * fills in the dialog controls using the current settings.
*/ */
void initDialog(); void initDialog();
virtual void OnOkClick( wxCommandEvent& event ) override; virtual void OnOkClick( wxCommandEvent& event ) override;
virtual void OnLayerSelection( wxDataViewEvent& event ) override; virtual void OnLayerSelection( wxDataViewEvent& event ) override;
/** /**
* Function AcceptOptionsForKeepOut * Function AcceptOptionsForKeepOut
* Test validity of options, and copy options in m_zonesettings, for keepout zones * Test validity of options, and copy options in m_zonesettings, for keepout zones
* @return bool - false if incorrect options, true if ok. * @return bool - false if incorrect options, true if ok.
*/ */
bool AcceptOptionsForKeepOut(); bool AcceptOptionsForKeepOut();
/** /**
* Function makeLayerIcon * Function makeLayerIcon
* creates the colored rectangle icons used in the layer selection widget. * creates the colored rectangle icons used in the layer selection widget.
* @param aColor is the color to fill the rectangle with. * @param aColor is the color to fill the rectangle with.
*/ */
wxIcon makeLayerIcon( COLOR4D aColor ); wxIcon makeLayerIcon( COLOR4D aColor );
}; };
#define LAYER_BITMAP_SIZE_X 25 #define LAYER_BITMAP_SIZE_X 25
#define LAYER_BITMAP_SIZE_Y 15 #define LAYER_BITMAP_SIZE_Y 15
ZONE_EDIT_T InvokeKeepoutAreaEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings ) ZONE_EDIT_T InvokeKeepoutAreaEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings )
{ {
DIALOG_KEEPOUT_AREA_PROPERTIES dlg( aCaller, aSettings ); DIALOG_KEEPOUT_AREA_PROPERTIES dlg( aCaller, aSettings );
ZONE_EDIT_T result = ZONE_ABORT; ZONE_EDIT_T result = ZONE_ABORT;
if( dlg.ShowModal() == wxID_OK ) if( dlg.ShowModal() == wxID_OK )
result = ZONE_OK; result = ZONE_OK;
return result; return result;
} }
DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES( PCB_BASE_FRAME* aParent, DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES( PCB_BASE_FRAME* aParent,
ZONE_SETTINGS* aSettings ) : ZONE_SETTINGS* aSettings ) :
DIALOG_KEEPOUT_AREA_PROPERTIES_BASE( aParent ) DIALOG_KEEPOUT_AREA_PROPERTIES_BASE( aParent )
{ {
m_parent = aParent; m_parent = aParent;
m_config = Kiface().KifaceSettings(); m_config = Kiface().KifaceSettings();
m_ptr = aSettings; m_ptr = aSettings;
m_zonesettings = *aSettings; m_zonesettings = *aSettings;
initDialog(); initDialog();
m_sdbSizerButtonsOK->SetDefault(); m_sdbSizerButtonsOK->SetDefault();
FinishDialogSettings(); FinishDialogSettings();
} }
void DIALOG_KEEPOUT_AREA_PROPERTIES::initDialog() void DIALOG_KEEPOUT_AREA_PROPERTIES::initDialog()
{ {
BOARD* board = m_parent->GetBoard(); BOARD* board = m_parent->GetBoard();
wxString msg; wxString msg;
if( m_zonesettings.m_Zone_45_Only ) if( m_zonesettings.m_Zone_45_Only )
m_OrientEdgesOpt->SetSelection( 1 ); m_OrientEdgesOpt->SetSelection( 1 );
switch( m_zonesettings.m_Zone_HatchingStyle ) switch( m_zonesettings.m_Zone_HatchingStyle )
{ {
case ZONE_CONTAINER::NO_HATCH: case ZONE_CONTAINER::NO_HATCH:
m_OutlineAppearanceCtrl->SetSelection( 0 ); m_OutlineAppearanceCtrl->SetSelection( 0 );
break; break;
case ZONE_CONTAINER::DIAGONAL_EDGE: case ZONE_CONTAINER::DIAGONAL_EDGE:
m_OutlineAppearanceCtrl->SetSelection( 1 ); m_OutlineAppearanceCtrl->SetSelection( 1 );
break; break;
case ZONE_CONTAINER::DIAGONAL_FULL: case ZONE_CONTAINER::DIAGONAL_FULL:
m_OutlineAppearanceCtrl->SetSelection( 2 ); m_OutlineAppearanceCtrl->SetSelection( 2 );
break; break;
} }
// Build copper layer list and append to layer widget // Build copper layer list and append to layer widget
LSET show = LSET::AllCuMask( board->GetCopperLayerCount() ); LSET show = LSET::AllCuMask( board->GetCopperLayerCount() );
auto* checkColumn = m_layers->AppendToggleColumn( wxEmptyString ); auto* checkColumn = m_layers->AppendToggleColumn( wxEmptyString );
auto* layerColumn = m_layers->AppendIconTextColumn( wxEmptyString ); auto* layerColumn = m_layers->AppendIconTextColumn( wxEmptyString );
wxVector<wxVariant> row; wxVector<wxVariant> row;
int imgIdx = 0; int imgIdx = 0;
for( LSEQ cu_stack = show.UIOrder(); cu_stack; ++cu_stack, imgIdx++ )
{
PCB_LAYER_ID layer = *cu_stack;
msg = board->GetLayerName( layer );
COLOR4D layerColor = m_parent->Settings().Colors().GetLayerColor( layer );
row.clear();
row.push_back( m_zonesettings.m_Layers.test( layer ) );
auto iconItem = wxDataViewIconText( msg, makeLayerIcon( layerColor ) );
for( LSEQ cu_stack = show.UIOrder(); cu_stack; ++cu_stack, imgIdx++ )
{
PCB_LAYER_ID layer = *cu_stack;
msg = board->GetLayerName( layer );
COLOR4D layerColor = m_parent->Settings().Colors().GetLayerColor( layer );
row.clear();
row.push_back( m_zonesettings.m_Layers.test( layer ) );
auto iconItem = wxDataViewIconText( msg, makeLayerIcon( layerColor ) );
row.push_back( wxVariant( iconItem ) ); row.push_back( wxVariant( iconItem ) );
m_layers->AppendItem( row ); m_layers->AppendItem( row );
} }
// Init keepout parameters: // Init keepout parameters:
m_cbTracksCtrl->SetValue( m_zonesettings.GetDoNotAllowTracks() ); m_cbTracksCtrl->SetValue( m_zonesettings.GetDoNotAllowTracks() );
m_cbViasCtrl->SetValue( m_zonesettings.GetDoNotAllowVias() ); m_cbViasCtrl->SetValue( m_zonesettings.GetDoNotAllowVias() );
m_cbCopperPourCtrl->SetValue( m_zonesettings.GetDoNotAllowCopperPour() ); m_cbCopperPourCtrl->SetValue( m_zonesettings.GetDoNotAllowCopperPour() );
checkColumn->SetWidth( wxCOL_WIDTH_AUTOSIZE ); checkColumn->SetWidth( wxCOL_WIDTH_AUTOSIZE );
checkColumn->SetMinWidth( 50 ); layerColumn->SetWidth( wxCOL_WIDTH_AUTOSIZE );
layerColumn->SetMinWidth( 350 );
m_layers->SetExpanderColumn( layerColumn ); m_layers->SetExpanderColumn( layerColumn );
m_layers->SetMinSize( wxSize( 300, -1 ) );
m_layers->Update(); m_layers->Update();
Update(); Update();
}
m_sdbSizerButtonsOK->Enable( m_zonesettings.m_Layers.count() > 0 );
}
void DIALOG_KEEPOUT_AREA_PROPERTIES::OnOkClick( wxCommandEvent& event )
{
if( AcceptOptionsForKeepOut() ) void DIALOG_KEEPOUT_AREA_PROPERTIES::OnOkClick( wxCommandEvent& event )
{ {
*m_ptr = m_zonesettings; if( AcceptOptionsForKeepOut() )
event.Skip(); // ends returning wxID_OK (default behavior) {
} *m_ptr = m_zonesettings;
} event.Skip(); // ends returning wxID_OK (default behavior)
}
}
void DIALOG_KEEPOUT_AREA_PROPERTIES::OnLayerSelection( wxDataViewEvent& event ) void DIALOG_KEEPOUT_AREA_PROPERTIES::OnLayerSelection( wxDataViewEvent& event )
{ {
if( event.GetColumn() != 0 ) if( event.GetColumn() != 0 )
@ -217,7 +216,7 @@ void DIALOG_KEEPOUT_AREA_PROPERTIES::OnLayerSelection( wxDataViewEvent& event )
BOARD* board = m_parent->GetBoard(); BOARD* board = m_parent->GetBoard();
LSEQ cu_stack = LSET::AllCuMask( board->GetCopperLayerCount() ).UIOrder(); LSEQ cu_stack = LSET::AllCuMask( board->GetCopperLayerCount() ).UIOrder();
if( row < cu_stack.size() ) if( row < (int)cu_stack.size() )
{ {
m_zonesettings.m_Layers.set( cu_stack[ row ], selected ); m_zonesettings.m_Layers.set( cu_stack[ row ], selected );
} }
@ -226,78 +225,76 @@ void DIALOG_KEEPOUT_AREA_PROPERTIES::OnLayerSelection( wxDataViewEvent& event )
} }
bool DIALOG_KEEPOUT_AREA_PROPERTIES::AcceptOptionsForKeepOut() bool DIALOG_KEEPOUT_AREA_PROPERTIES::AcceptOptionsForKeepOut()
{ {
// Init keepout parameters: // Init keepout parameters:
m_zonesettings.SetIsKeepout( true ); m_zonesettings.SetIsKeepout( true );
m_zonesettings.SetDoNotAllowTracks( m_cbTracksCtrl->GetValue() ); m_zonesettings.SetDoNotAllowTracks( m_cbTracksCtrl->GetValue() );
m_zonesettings.SetDoNotAllowVias( m_cbViasCtrl->GetValue() ); m_zonesettings.SetDoNotAllowVias( m_cbViasCtrl->GetValue() );
m_zonesettings.SetDoNotAllowCopperPour( m_cbCopperPourCtrl->GetValue() ); m_zonesettings.SetDoNotAllowCopperPour( m_cbCopperPourCtrl->GetValue() );
// Test for not allowed items: should have at least one item not allowed: // Test for not allowed items: should have at least one item not allowed:
if( ! m_zonesettings.GetDoNotAllowTracks() && if( ! m_zonesettings.GetDoNotAllowTracks() &&
! m_zonesettings.GetDoNotAllowVias() && ! m_zonesettings.GetDoNotAllowVias() &&
! m_zonesettings.GetDoNotAllowCopperPour() ) ! m_zonesettings.GetDoNotAllowCopperPour() )
{ {
DisplayError( NULL, DisplayError( NULL,
_("Tracks, vias, and pads are allowed. The keepout is useless" ) ); _("Tracks, vias, and pads are allowed. The keepout is useless" ) );
return false; return false;
} }
if( m_zonesettings.m_Layers.count() == 0 ) if( m_zonesettings.m_Layers.count() == 0 )
{ {
DisplayError( NULL, _( "No layers selected." ) ); DisplayError( NULL, _( "No layers selected." ) );
return false; return false;
} }
switch( m_OutlineAppearanceCtrl->GetSelection() ) switch( m_OutlineAppearanceCtrl->GetSelection() )
{ {
case 0: case 0:
m_zonesettings.m_Zone_HatchingStyle = ZONE_CONTAINER::NO_HATCH; m_zonesettings.m_Zone_HatchingStyle = ZONE_CONTAINER::NO_HATCH;
break; break;
case 1: case 1:
m_zonesettings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_EDGE; m_zonesettings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_EDGE;
break; break;
case 2: case 2:
m_zonesettings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_FULL; m_zonesettings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_FULL;
break; break;
} }
if( m_config ) if( m_config )
{ {
m_config->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY, m_config->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY,
(long) m_zonesettings.m_Zone_HatchingStyle ); (long) m_zonesettings.m_Zone_HatchingStyle );
} }
if( m_OrientEdgesOpt->GetSelection() == 0 ) if( m_OrientEdgesOpt->GetSelection() == 0 )
m_zonesettings.m_Zone_45_Only = false; m_zonesettings.m_Zone_45_Only = false;
else else
m_zonesettings.m_Zone_45_Only = true; m_zonesettings.m_Zone_45_Only = true;
m_zonesettings.m_ZonePriority = 0; //m_PriorityLevelCtrl->GetValue(); m_zonesettings.m_ZonePriority = 0; //m_PriorityLevelCtrl->GetValue();
return true; return true;
} }
wxIcon DIALOG_KEEPOUT_AREA_PROPERTIES::makeLayerIcon( COLOR4D aColor ) wxIcon DIALOG_KEEPOUT_AREA_PROPERTIES::makeLayerIcon( COLOR4D aColor )
{ {
wxBitmap bitmap( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y ); wxBitmap bitmap( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
wxBrush brush; wxBrush brush;
wxMemoryDC iconDC; wxMemoryDC iconDC;
iconDC.SelectObject( bitmap ); iconDC.SelectObject( bitmap );
brush.SetColour( aColor.ToColour() ); brush.SetColour( aColor.ToColour() );
brush.SetStyle( wxBRUSHSTYLE_SOLID ); brush.SetStyle( wxBRUSHSTYLE_SOLID );
iconDC.SetBrush( brush ); iconDC.SetBrush( brush );
iconDC.DrawRectangle( 0, 0, LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y ); iconDC.DrawRectangle( 0, 0, LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
wxIcon icon; wxIcon icon;
icon.CopyFromBitmap( bitmap ); icon.CopyFromBitmap( bitmap );
return icon; return icon;
} }

View File

@ -4,7 +4,7 @@
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -127,20 +127,20 @@ void PCB_EDIT_FRAME::duplicateZone( wxDC* aDC, ZONE_CONTAINER* aZone )
// If the new zone is on the same layer as the the initial zone, // If the new zone is on the same layer as the the initial zone,
// do nothing // do nothing
if( success ) if( success )
{ {
if( aZone->GetIsKeepout() && ( aZone->GetLayerSet() == zoneSettings.m_Layers ) ) if( aZone->GetIsKeepout() && ( aZone->GetLayerSet() == zoneSettings.m_Layers ) )
{ {
DisplayErrorMessage( DisplayErrorMessage(
this, _( "The duplicated zone cannot be on the same layers as the original zone." ) ); this, _( "The duplicated zone cannot be on the same layers as the original zone." ) );
success = false; success = false;
} }
else if( !aZone->GetIsKeepout() && ( aZone->GetLayer() == zoneSettings.m_CurrentZone_Layer ) ) else if( !aZone->GetIsKeepout() && ( aZone->GetLayer() == zoneSettings.m_CurrentZone_Layer ) )
{ {
DisplayErrorMessage( DisplayErrorMessage(
this, _( "The duplicated zone cannot be on the same layer as the original zone." ) ); this, _( "The duplicated zone cannot be on the same layer as the original zone." ) );
success = false; success = false;
} }
} }
if( success ) if( success )
@ -561,13 +561,10 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
{ {
ZONE_EDIT_T edited; ZONE_EDIT_T edited;
// Init zone params to reasonable values
zone->SetLayer( GetActiveLayer() );
// Prompt user for parameters: // Prompt user for parameters:
m_canvas->SetIgnoreMouseEvents( true ); m_canvas->SetIgnoreMouseEvents( true );
if( zone->IsOnCopperLayer() ) if( IsCopperLayer( GetActiveLayer() ) )
{ {
// Put a zone on a copper layer // Put a zone on a copper layer
if( GetBoard()->GetHighLightNetCode() > 0 ) if( GetBoard()->GetHighLightNetCode() > 0 )
@ -594,8 +591,6 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
cfg->Read( ZONE_MIN_THICKNESS_WIDTH_STRING_KEY, &tmp ); cfg->Read( ZONE_MIN_THICKNESS_WIDTH_STRING_KEY, &tmp );
zoneInfo.m_ZoneMinThickness = KiROUND( tmp * IU_PER_MILS ); zoneInfo.m_ZoneMinThickness = KiROUND( tmp * IU_PER_MILS );
zoneInfo.m_CurrentZone_Layer = zone->GetLayer();
if( GetToolId() == ID_PCB_KEEPOUT_AREA_BUTT ) if( GetToolId() == ID_PCB_KEEPOUT_AREA_BUTT )
{ {
zoneInfo.SetIsKeepout( true ); zoneInfo.SetIsKeepout( true );
@ -609,14 +604,16 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
} }
else else
{ {
zoneInfo.m_CurrentZone_Layer = GetActiveLayer(); // Preselect a layer
zoneInfo.SetIsKeepout( false ); zoneInfo.SetIsKeepout( false );
edited = InvokeCopperZonesEditor( this, &zoneInfo ); edited = InvokeCopperZonesEditor( this, &zoneInfo );
} }
} }
else // Put a zone on a non copper layer (technical layer) else // Put a zone on a non copper layer (technical layer)
{ {
zone->SetLayer( GetActiveLayer() ); // Preselect a layer
zoneInfo.SetIsKeepout( false ); zoneInfo.SetIsKeepout( false );
zoneInfo.m_NetcodeSelection = 0; // No net for non copper zones zoneInfo.m_NetcodeSelection = 0; // No net for non copper zones
edited = InvokeNonCopperZonesEditor( this, zone, &zoneInfo ); edited = InvokeNonCopperZonesEditor( this, zone, &zoneInfo );
} }
@ -675,8 +672,6 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
{ {
zoneInfo.ExportSetting( *zone ); zoneInfo.ExportSetting( *zone );
zone->SetLayer( zoneInfo.m_CurrentZone_Layer );
// A duplicated corner is needed; null segments are removed when the zone is finished. // A duplicated corner is needed; null segments are removed when the zone is finished.
zone->AppendCorner( GetCrossHairPosition(), -1 ); zone->AppendCorner( GetCrossHairPosition(), -1 );
// Add the duplicate corner: // Add the duplicate corner: