Do not auto-refill zones when added or edited
The only exception is when using the Zone Properties Dialog and user preference is enabled
This commit is contained in:
parent
7a255edc5f
commit
50aafb9d2a
|
@ -106,6 +106,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( ZONE* aZone )
|
|||
|
||||
UpdateCopyOfZonesList( pickedList, deletedList, GetBoard() );
|
||||
|
||||
// Only auto-refill zones here if in user preferences
|
||||
if( Settings().m_AutoRefillZones )
|
||||
{
|
||||
// refill zones with the new properties applied
|
||||
|
|
|
@ -1737,22 +1737,8 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
|
|||
// Remove the cutout
|
||||
m_commit->Modify( zone );
|
||||
zone->RemoveCutout( outlineIdx, holeIdx );
|
||||
|
||||
// Re-fill the zone if it was filled before the edit
|
||||
if( zone->IsFilled() || frame()->Settings().m_AutoRefillZones )
|
||||
{
|
||||
std::vector<ZONE*> toFill;
|
||||
toFill.emplace_back( zone );
|
||||
|
||||
ZONE_FILLER filler( board(), m_commit.get() );
|
||||
filler.InstallNewProgressReporter( frame(), _( "Fill Zone" ), 4 );
|
||||
|
||||
if( !filler.Fill( toFill ) )
|
||||
{
|
||||
m_commit->Revert();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
zone->UnFill();
|
||||
// TODO Refill zone when KiCad supports auto re-fill
|
||||
|
||||
// Update the display
|
||||
zone->HatchBorder();
|
||||
|
|
|
@ -1312,6 +1312,7 @@ void PCB_POINT_EDITOR::updateItem() const
|
|||
|
||||
validatePolygon( outline );
|
||||
zone->HatchBorder();
|
||||
// TODO Refill zone when KiCad supports auto re-fill
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1515,13 +1516,7 @@ void PCB_POINT_EDITOR::finishItem()
|
|||
if( !item )
|
||||
return;
|
||||
|
||||
if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T )
|
||||
{
|
||||
ZONE* zone = static_cast<ZONE*>( item );
|
||||
|
||||
if( zone->IsFilled() && m_refill && zone->NeedRefill() )
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::zoneFill, true, zone );
|
||||
}
|
||||
// TODO Refill edited zones when KiCad supports auto re-fill
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -138,7 +138,6 @@ void ZONE_CREATE_HELPER::performZoneCutout( ZONE& aZone, const ZONE& aCutout )
|
|||
BOARD_COMMIT commit( &m_tool );
|
||||
BOARD* board = m_tool.getModel<BOARD>();
|
||||
std::vector<ZONE*> newZones;
|
||||
bool wereZonesFilled = aZone.IsFilled() || aCutout.IsFilled();
|
||||
|
||||
// Clear the selection before removing the old zone
|
||||
auto toolMgr = m_tool.GetManager();
|
||||
|
@ -164,25 +163,14 @@ void ZONE_CREATE_HELPER::performZoneCutout( ZONE& aZone, const ZONE& aCutout )
|
|||
newZone->SetOutline( newZoneOutline );
|
||||
newZone->SetLocalFlags( 1 );
|
||||
newZone->HatchBorder();
|
||||
newZone->UnFill();
|
||||
newZones.push_back( newZone );
|
||||
commit.Add( newZone );
|
||||
}
|
||||
|
||||
commit.Remove( &aZone );
|
||||
|
||||
// Refill zone depending on settings or if one of the zones was filled
|
||||
if( wereZonesFilled || m_tool.frame()->Settings().m_AutoRefillZones )
|
||||
{
|
||||
ZONE_FILLER filler( board, &commit );
|
||||
|
||||
std::lock_guard<KISPINLOCK> lock( board->GetConnectivity()->GetLock() );
|
||||
|
||||
if( !filler.Fill( newZones ) )
|
||||
{
|
||||
commit.Revert();
|
||||
return;
|
||||
}
|
||||
}
|
||||
// TODO Refill zones when KiCad supports auto re-fill
|
||||
|
||||
commit.Push( _( "Add a zone cutout" ) );
|
||||
|
||||
|
@ -216,28 +204,13 @@ void ZONE_CREATE_HELPER::commitZone( std::unique_ptr<ZONE> aZone )
|
|||
BOARD* board = m_tool.getModel<BOARD>();
|
||||
|
||||
aZone->HatchBorder();
|
||||
|
||||
// TODO Refill zones when KiCad supports auto re-fill
|
||||
|
||||
commit.Add( aZone.get() );
|
||||
|
||||
std::lock_guard<KISPINLOCK> lock( board->GetConnectivity()->GetLock() );
|
||||
|
||||
// Only refill based on settings or if the zone we are copying was filled
|
||||
bool refill = m_tool.frame()->Settings().m_AutoRefillZones;
|
||||
|
||||
if( m_params.m_mode == ZONE_MODE::SIMILAR && aZone->IsFilled() )
|
||||
refill = true;
|
||||
|
||||
if( !m_params.m_keepout && refill )
|
||||
{
|
||||
ZONE_FILLER filler( board, &commit );
|
||||
std::vector<ZONE*> toFill = { aZone.get() };
|
||||
|
||||
if( !filler.Fill( toFill ) )
|
||||
{
|
||||
commit.Revert();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
commit.Push( _( "Add a zone" ) );
|
||||
m_tool.GetManager()->RunAction( PCB_ACTIONS::selectItem, true, aZone.release() );
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue