Minor cleanup and removal of stale comments.

(cherry picked from commit c48084bbbf)
This commit is contained in:
Jeff Young 2023-08-27 10:21:47 +01:00
parent 75daa1afec
commit 7673f220a9
1 changed files with 10 additions and 23 deletions

View File

@ -120,8 +120,6 @@ std::unique_ptr<ZONE> ZONE_CREATE_HELPER::createNewZone( bool aKeepout )
if( m_params.m_mode != ZONE_MODE::GRAPHIC_POLYGON )
{
// Get the current default settings for zones
// Show options dialog
int dialogResult;
@ -184,16 +182,15 @@ void ZONE_CREATE_HELPER::performZoneCutout( ZONE& aZone, const ZONE& aCutout )
SHAPE_POLY_SET originalOutline( *aZone.Outline() );
originalOutline.BooleanSubtract( *aCutout.Outline(), SHAPE_POLY_SET::PM_FAST );
// After substracting the hole, originalOutline can have more than one
// main outline.
// But a zone can have only one main outline, so create as many zones as
// originalOutline contains main outlines:
// After substracting the hole, originalOutline can have more than one main outline.
// But a zone can have only one main outline, so create as many zones as originalOutline
// contains main outlines:
for( int outline = 0; outline < originalOutline.OutlineCount(); outline++ )
{
auto newZoneOutline = new SHAPE_POLY_SET;
newZoneOutline->AddOutline( originalOutline.Outline( outline ) );
// Add holes (if any) to thez new zone outline:
// Add holes (if any) to the new zone outline:
for (int hole = 0; hole < originalOutline.HoleCount( outline ) ; hole++ )
newZoneOutline->AddHole( originalOutline.CHole( outline, hole ) );
@ -207,9 +204,6 @@ void ZONE_CREATE_HELPER::performZoneCutout( ZONE& aZone, const ZONE& aCutout )
}
commit.Remove( &aZone );
// TODO Refill zones when KiCad supports auto re-fill
commit.Push( _( "Add a zone cutout" ) );
// Select the new zone and set it as the source for the next cutout
@ -262,11 +256,7 @@ void ZONE_CREATE_HELPER::commitZone( std::unique_ptr<ZONE> aZone )
poly = new PCB_SHAPE();
poly->SetShape( SHAPE_T::POLY );
if( layer == Edge_Cuts || layer == F_CrtYd || layer == B_CrtYd )
poly->SetFilled( false );
else
poly->SetFilled( true );
poly->SetFilled( layer != Edge_Cuts && layer != F_CrtYd && layer != B_CrtYd );
poly->SetStroke( STROKE_PARAMS( board->GetDesignSettings().GetLineThickness( layer ),
PLOT_DASH_TYPE::SOLID ) );
@ -274,10 +264,9 @@ void ZONE_CREATE_HELPER::commitZone( std::unique_ptr<ZONE> aZone )
poly->SetPolyShape( *aZone->Outline() );
commit.Add( poly );
m_tool.GetManager()->RunAction( PCB_ACTIONS::selectItem, true, poly );
commit.Push( _( "Add a graphical polygon" ) );
m_tool.GetManager()->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, poly );
break;
}
}
@ -287,7 +276,6 @@ void ZONE_CREATE_HELPER::commitZone( std::unique_ptr<ZONE> aZone )
bool ZONE_CREATE_HELPER::OnFirstPoint( POLYGON_GEOM_MANAGER& aMgr )
{
// if we don't have a zone, create one
// the user's choice here can affect things like the colour of the preview
if( !m_zone )
{
if( m_params.m_sourceZone )
@ -337,17 +325,16 @@ void ZONE_CREATE_HELPER::OnComplete( const POLYGON_GEOM_MANAGER& aMgr )
}
else
{
// if m_params.m_mode == DRAWING_TOOL::ZONE_MODE::CUTOUT, m_zone
// will be merged to the existing zone as a new hole.
// if m_params.m_mode == DRAWING_TOOL::ZONE_MODE::CUTOUT, m_zone will be merged to the
// existing zone as a new hole.
m_zone->Outline()->NewOutline();
auto* outline = m_zone->Outline();
for( int i = 0; i < finalPoints.PointCount(); ++i )
outline->Append( finalPoints.CPoint( i ) );
// In DEG45 mode, we may have intermediate points in the leader that should be
// included as they are shown in the preview. These typically maintain the
// 45 constraint
// In DEG45 mode, we may have intermediate points in the leader that should be included
// as they are shown in the preview. These typically maintain the 45 constraint
if( aMgr.GetLeaderMode() == POLYGON_GEOM_MANAGER::LEADER_MODE::DEG45 )
{
const SHAPE_LINE_CHAIN leaderPts = aMgr.GetLeaderLinePoints();