Pcbnew: bug fix: sometimes (depending on a previous command) pcbnew could create an usual zone instead of a keepout zone when the" create keepout zone" tool is activated
This commit is contained in:
parent
4e18b14f14
commit
4426d4c539
|
@ -137,11 +137,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
||||||
}
|
}
|
||||||
|
|
||||||
item = GetCurItem();
|
item = GetCurItem();
|
||||||
|
flags = item ? item->GetFlags() : 0;
|
||||||
if( item )
|
|
||||||
flags = item->GetFlags();
|
|
||||||
else
|
|
||||||
flags = 0;
|
|
||||||
|
|
||||||
// Add the context menu, which depends on the picked item:
|
// Add the context menu, which depends on the picked item:
|
||||||
if( item )
|
if( item )
|
||||||
|
|
|
@ -206,8 +206,14 @@ static void Abort_Zone_Create_Outline( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
||||||
if( zone )
|
if( zone )
|
||||||
{
|
{
|
||||||
zone->DrawWhileCreateOutline( Panel, DC, GR_XOR );
|
zone->DrawWhileCreateOutline( Panel, DC, GR_XOR );
|
||||||
zone->ClearFlags();
|
|
||||||
zone->RemoveAllContours();
|
zone->RemoveAllContours();
|
||||||
|
if( zone->IsNew() )
|
||||||
|
{
|
||||||
|
delete zone;
|
||||||
|
pcbframe->GetBoard()->m_CurrentZoneContour = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
zone->ClearFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
pcbframe->SetCurItem( NULL );
|
pcbframe->SetCurItem( NULL );
|
||||||
|
@ -512,21 +518,26 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
|
||||||
s_CurrentZone = NULL;
|
s_CurrentZone = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no zone contour in progress, a new zone is being created:
|
ZONE_CONTAINER* zone = GetBoard()->m_CurrentZoneContour;
|
||||||
if( !GetBoard()->m_CurrentZoneContour )
|
|
||||||
|
// Verify if a new zone is allowed on this layer:
|
||||||
|
if( zone == NULL )
|
||||||
{
|
{
|
||||||
if( GetToolId() == ID_PCB_KEEPOUT_AREA_BUTT &&
|
if( GetToolId() == ID_PCB_KEEPOUT_AREA_BUTT && !IsCopperLayer( getActiveLayer() ) )
|
||||||
getActiveLayer() >= FIRST_NON_COPPER_LAYER )
|
|
||||||
{
|
{
|
||||||
DisplayError( this,
|
DisplayError( this,
|
||||||
_( "Error: a keepout area is allowed only on copper layers" ) );
|
_( "Error: a keepout area is allowed only on copper layers" ) );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
GetBoard()->m_CurrentZoneContour = new ZONE_CONTAINER( GetBoard() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ZONE_CONTAINER* zone = GetBoard()->m_CurrentZoneContour;
|
// If no zone contour in progress, a new zone is being created,
|
||||||
|
if( zone == NULL )
|
||||||
|
{
|
||||||
|
zone = GetBoard()->m_CurrentZoneContour = new ZONE_CONTAINER( GetBoard() );
|
||||||
|
zone->SetFlags( IS_NEW );
|
||||||
|
zone->SetTimeStamp( GetNewTimeStamp() );
|
||||||
|
}
|
||||||
|
|
||||||
if( zone->GetNumCorners() == 0 ) // Start a new contour: init zone params (net, layer ...)
|
if( zone->GetNumCorners() == 0 ) // Start a new contour: init zone params (net, layer ...)
|
||||||
{
|
{
|
||||||
|
@ -546,30 +557,25 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
|
||||||
if( GetBoard()->GetHighLightNetCode() > 0 )
|
if( GetBoard()->GetHighLightNetCode() > 0 )
|
||||||
{
|
{
|
||||||
zoneInfo.m_NetcodeSelection = GetBoard()->GetHighLightNetCode();
|
zoneInfo.m_NetcodeSelection = GetBoard()->GetHighLightNetCode();
|
||||||
|
|
||||||
zone->SetNetCode( zoneInfo.m_NetcodeSelection );
|
zone->SetNetCode( zoneInfo.m_NetcodeSelection );
|
||||||
}
|
}
|
||||||
|
|
||||||
double tmp = ZONE_THERMAL_RELIEF_GAP_MIL;
|
double tmp = ZONE_THERMAL_RELIEF_GAP_MIL;
|
||||||
|
|
||||||
wxConfigBase* cfg = Kiface().KifaceSettings();
|
wxConfigBase* cfg = Kiface().KifaceSettings();
|
||||||
|
|
||||||
cfg->Read( ZONE_THERMAL_RELIEF_GAP_STRING_KEY, &tmp );
|
cfg->Read( ZONE_THERMAL_RELIEF_GAP_STRING_KEY, &tmp );
|
||||||
|
|
||||||
zoneInfo.m_ThermalReliefGap = KiROUND( tmp * IU_PER_MILS);
|
zoneInfo.m_ThermalReliefGap = KiROUND( tmp * IU_PER_MILS);
|
||||||
|
|
||||||
tmp = ZONE_THERMAL_RELIEF_COPPER_WIDTH_MIL;
|
tmp = ZONE_THERMAL_RELIEF_COPPER_WIDTH_MIL;
|
||||||
cfg->Read( ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY,
|
cfg->Read( ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY, &tmp );
|
||||||
&tmp );
|
|
||||||
zoneInfo.m_ThermalReliefCopperBridge = KiROUND( tmp * IU_PER_MILS );
|
zoneInfo.m_ThermalReliefCopperBridge = KiROUND( tmp * IU_PER_MILS );
|
||||||
|
|
||||||
tmp = ZONE_CLEARANCE_MIL;
|
tmp = ZONE_CLEARANCE_MIL;
|
||||||
cfg->Read( ZONE_CLEARANCE_WIDTH_STRING_KEY,
|
cfg->Read( ZONE_CLEARANCE_WIDTH_STRING_KEY, &tmp );
|
||||||
&tmp );
|
|
||||||
zoneInfo.m_ZoneClearance = KiROUND( tmp * IU_PER_MILS );
|
zoneInfo.m_ZoneClearance = KiROUND( tmp * IU_PER_MILS );
|
||||||
|
|
||||||
tmp = ZONE_THICKNESS_MIL;
|
tmp = ZONE_THICKNESS_MIL;
|
||||||
cfg->Read( ZONE_MIN_THICKNESS_WIDTH_STRING_KEY,
|
cfg->Read( ZONE_MIN_THICKNESS_WIDTH_STRING_KEY, &tmp );
|
||||||
&tmp );
|
|
||||||
zoneInfo.m_ZoneMinThickness = KiROUND( tmp * IU_PER_MILS );
|
zoneInfo.m_ZoneMinThickness = KiROUND( tmp * IU_PER_MILS );
|
||||||
|
|
||||||
zoneInfo.m_CurrentZone_Layer = zone->GetLayer();
|
zoneInfo.m_CurrentZone_Layer = zone->GetLayer();
|
||||||
|
@ -599,11 +605,14 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
|
||||||
m_canvas->SetIgnoreMouseEvents( false );
|
m_canvas->SetIgnoreMouseEvents( false );
|
||||||
|
|
||||||
if( edited == ZONE_ABORT )
|
if( edited == ZONE_ABORT )
|
||||||
|
{
|
||||||
|
GetBoard()->m_CurrentZoneContour = NULL;
|
||||||
|
delete zone;
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Switch active layer to the selected zone layer
|
// Switch active layer to the selected zone layer
|
||||||
setActiveLayer( zoneInfo.m_CurrentZone_Layer );
|
setActiveLayer( zoneInfo.m_CurrentZone_Layer );
|
||||||
|
|
||||||
SetZoneSettings( zoneInfo );
|
SetZoneSettings( zoneInfo );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -620,8 +629,8 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show the Net for zones on copper layers
|
// Show the Net for zones on copper layers
|
||||||
if( zoneInfo.m_CurrentZone_Layer < FIRST_NON_COPPER_LAYER &&
|
if( IsCopperLayer( zoneInfo.m_CurrentZone_Layer ) &&
|
||||||
! zoneInfo.GetIsKeepout() )
|
!zoneInfo.GetIsKeepout() )
|
||||||
{
|
{
|
||||||
if( s_CurrentZone )
|
if( s_CurrentZone )
|
||||||
{
|
{
|
||||||
|
@ -645,9 +654,6 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
|
||||||
// if first segment
|
// if first segment
|
||||||
if( zone->GetNumCorners() == 0 )
|
if( zone->GetNumCorners() == 0 )
|
||||||
{
|
{
|
||||||
zone->SetFlags( IS_NEW );
|
|
||||||
zone->SetTimeStamp( GetNewTimeStamp() );
|
|
||||||
|
|
||||||
zoneInfo.ExportSetting( *zone );
|
zoneInfo.ExportSetting( *zone );
|
||||||
|
|
||||||
zone->Outline()->Start( zoneInfo.m_CurrentZone_Layer,
|
zone->Outline()->Start( zoneInfo.m_CurrentZone_Layer,
|
||||||
|
|
Loading…
Reference in New Issue