Browse Source

Fix some cases where PCB_FP_ZONE_T was left out.

Fixes https://gitlab.com/kicad/code/kicad/issues/7615
6.0.7
Jeff Young 5 years ago
parent
commit
2bc10d58b5
  1. 5
      pcbnew/pcb_painter.cpp
  2. 48
      pcbnew/tools/pcb_point_editor.cpp
  3. 4
      pcbnew/tools/pcb_selection_tool.cpp
  4. 2
      pcbnew/tools/zone_filler_tool.cpp
  5. 2
      pcbnew/zone.cpp

5
pcbnew/pcb_painter.cpp

@ -250,8 +250,11 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons
} }
// Zones should pull from the copper layer // Zones should pull from the copper layer
if( item && item->Type() == PCB_ZONE_T && IsZoneLayer( aLayer ) )
if( item && ( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T ) )
{
if( IsZoneLayer( aLayer ) )
aLayer = aLayer - LAYER_ZONE_START; aLayer = aLayer - LAYER_ZONE_START;
}
// Hole walls should pull from the copper layer // Hole walls should pull from the copper layer
if( aLayer == LAYER_PAD_HOLEWALLS ) if( aLayer == LAYER_PAD_HOLEWALLS )

48
pcbnew/tools/pcb_point_editor.cpp

@ -1790,19 +1790,23 @@ void PCB_POINT_EDITOR::setAltConstraint( bool aEnabled )
if( aEnabled ) if( aEnabled )
{ {
EDIT_LINE* line = dynamic_cast<EDIT_LINE*>( m_editedPoint ); EDIT_LINE* line = dynamic_cast<EDIT_LINE*>( m_editedPoint );
bool isPoly = false;
bool isPoly;
if( m_editPoints->GetParent()->Type() == PCB_ZONE_T
|| m_editPoints->GetParent()->Type() == PCB_FP_ZONE_T )
switch( m_editPoints->GetParent()->Type() )
{ {
case PCB_ZONE_T:
case PCB_FP_ZONE_T:
isPoly = true; isPoly = true;
}
break;
else if( m_editPoints->GetParent()->Type() == PCB_SHAPE_T
|| m_editPoints->GetParent()->Type() == PCB_FP_SHAPE_T )
{
PCB_SHAPE* shape = static_cast<PCB_SHAPE*>( m_editPoints->GetParent() );
isPoly = shape->GetShape() == S_POLYGON;
case PCB_SHAPE_T:
case PCB_FP_SHAPE_T:
isPoly = static_cast<PCB_SHAPE*>( m_editPoints->GetParent() )->GetShape() == S_POLYGON;
break;
default:
isPoly = false;
break;
} }
if( line && isPoly ) if( line && isPoly )
@ -1930,24 +1934,30 @@ bool PCB_POINT_EDITOR::removeCornerCondition( const SELECTION& )
return false; return false;
EDA_ITEM* item = m_editPoints->GetParent(); EDA_ITEM* item = m_editPoints->GetParent();
SHAPE_POLY_SET* polyset = nullptr;
if( !item ) if( !item )
return false; return false;
if( !( item->Type() == PCB_ZONE_T
|| item->Type() == PCB_FP_ZONE_T
|| ( ( item->Type() == PCB_FP_SHAPE_T || item->Type() == PCB_SHAPE_T )
&& static_cast<PCB_SHAPE*>( item )->GetShape() == S_POLYGON ) ) )
switch( item->Type() )
{ {
case PCB_ZONE_T:
case PCB_FP_ZONE_T:
polyset = static_cast<ZONE*>( item )->Outline();
break;
case PCB_SHAPE_T:
case PCB_FP_SHAPE_T:
if( static_cast<PCB_SHAPE*>( item )->GetShape() == S_POLYGON )
polyset = &static_cast<PCB_SHAPE*>( item )->GetPolyShape();
else
return false; return false;
}
SHAPE_POLY_SET *polyset;
break;
if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T )
polyset = static_cast<ZONE*>( item )->Outline();
else
polyset = &static_cast<PCB_SHAPE*>( item )->GetPolyShape();
default:
return false;
}
auto vertex = findVertex( *polyset, *m_editedPoint ); auto vertex = findVertex( *polyset, *m_editedPoint );

4
pcbnew/tools/pcb_selection_tool.cpp

@ -378,7 +378,7 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
for( EDA_ITEM* item : aCollector ) for( EDA_ITEM* item : aCollector )
{ {
if( item->Type() == PCB_ZONE_T )
if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T )
{ {
ZONE* zone = static_cast<ZONE*>( item ); ZONE* zone = static_cast<ZONE*>( item );
@ -2419,7 +2419,7 @@ void PCB_SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector
BOARD_ITEM* item = aCollector[i]; BOARD_ITEM* item = aCollector[i];
double area; double area;
if( item->Type() == PCB_ZONE_T
if( ( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T )
&& static_cast<ZONE*>( item )->HitTestForEdge( where, MAX_SLOP * pixel / 2 ) ) && static_cast<ZONE*>( item )->HitTestForEdge( where, MAX_SLOP * pixel / 2 ) )
{ {
// Zone borders are very specific, so make them "small" // Zone borders are very specific, so make them "small"

2
pcbnew/tools/zone_filler_tool.cpp

@ -198,7 +198,7 @@ int ZONE_FILLER_TOOL::ZoneUnfill( const TOOL_EVENT& aEvent )
for( EDA_ITEM* item : selection() ) for( EDA_ITEM* item : selection() )
{ {
assert( item->Type() == PCB_ZONE_T );
assert( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T );
ZONE* zone = static_cast<ZONE*>( item ); ZONE* zone = static_cast<ZONE*>( item );

2
pcbnew/zone.cpp

@ -1095,7 +1095,7 @@ BITMAP_DEF ZONE::GetMenuImage() const
void ZONE::SwapData( BOARD_ITEM* aImage ) void ZONE::SwapData( BOARD_ITEM* aImage )
{ {
assert( aImage->Type() == PCB_ZONE_T );
assert( aImage->Type() == PCB_ZONE_T || aImage->Type() == PCB_FP_ZONE_T );
std::swap( *((ZONE*) this), *((ZONE*) aImage) ); std::swap( *((ZONE*) this), *((ZONE*) aImage) );
} }

Loading…
Cancel
Save