Be more responsive to cancel when filling zones.
Fixes https://gitlab.com/kicad/code/kicad/issues/6077
This commit is contained in:
parent
09af6c78bb
commit
397f3d07db
|
@ -226,7 +226,9 @@ void CN_CONNECTIVITY_ALGO::searchConnections()
|
|||
if( m_progressReporter )
|
||||
{
|
||||
m_progressReporter->SetMaxProgress( dirtyItems.size() );
|
||||
m_progressReporter->KeepRefreshing();
|
||||
|
||||
if( !m_progressReporter->KeepRefreshing() )
|
||||
return;
|
||||
}
|
||||
|
||||
if( m_itemList.IsDirty() )
|
||||
|
@ -247,7 +249,12 @@ void CN_CONNECTIVITY_ALGO::searchConnections()
|
|||
aItemList->FindNearby( dirtyItems[i], visitor );
|
||||
|
||||
if( aReporter )
|
||||
aReporter->AdvanceProgress();
|
||||
{
|
||||
if( aReporter->IsCancelled() )
|
||||
break;
|
||||
else
|
||||
aReporter->AdvanceProgress();
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -350,6 +357,9 @@ const CN_CONNECTIVITY_ALGO::CLUSTERS CN_CONNECTIVITY_ALGO::SearchClusters( CLUST
|
|||
|
||||
std::for_each( m_itemList.begin(), m_itemList.end(), addToSearchList );
|
||||
|
||||
if( m_progressReporter && m_progressReporter->IsCancelled() )
|
||||
return CLUSTERS();
|
||||
|
||||
while( !item_set.empty() )
|
||||
{
|
||||
CN_CLUSTER_PTR cluster ( new CN_CLUSTER() );
|
||||
|
@ -391,6 +401,8 @@ const CN_CONNECTIVITY_ALGO::CLUSTERS CN_CONNECTIVITY_ALGO::SearchClusters( CLUST
|
|||
clusters.push_back( cluster );
|
||||
}
|
||||
|
||||
if( m_progressReporter && m_progressReporter->IsCancelled() )
|
||||
return CLUSTERS();
|
||||
|
||||
std::sort( clusters.begin(), clusters.end(),
|
||||
[]( CN_CLUSTER_PTR a, CN_CLUSTER_PTR b )
|
||||
|
|
|
@ -696,6 +696,14 @@ void ZONE_FILLER::knockoutThermalReliefs( const ZONE_CONTAINER* aZone, PCB_LAYER
|
|||
void ZONE_FILLER::buildCopperItemClearances( const ZONE_CONTAINER* aZone, PCB_LAYER_ID aLayer,
|
||||
SHAPE_POLY_SET& aHoles )
|
||||
{
|
||||
long ticker = 0;
|
||||
|
||||
auto checkForCancel =
|
||||
[&ticker]( PROGRESS_REPORTER* aReporter ) -> bool
|
||||
{
|
||||
return aReporter && ( ticker++ % 50 ) == 0 && aReporter->IsCancelled();
|
||||
};
|
||||
|
||||
static PCB_SHAPE dummyEdge;
|
||||
dummyEdge.SetParent( m_board );
|
||||
dummyEdge.SetLayer( Edge_Cuts );
|
||||
|
@ -758,6 +766,9 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE_CONTAINER* aZone, PCB_LA
|
|||
{
|
||||
for( D_PAD* pad : module->Pads() )
|
||||
{
|
||||
if( checkForCancel( m_progressReporter ) )
|
||||
return;
|
||||
|
||||
if( !pad->FlashLayer( aLayer ) )
|
||||
{
|
||||
if( pad->GetDrillSize().x == 0 && pad->GetDrillSize().y == 0 )
|
||||
|
@ -819,6 +830,9 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE_CONTAINER* aZone, PCB_LA
|
|||
if( track->GetNetCode() == aZone->GetNetCode() && ( aZone->GetNetCode() != 0) )
|
||||
continue;
|
||||
|
||||
if( checkForCancel( m_progressReporter ) )
|
||||
return;
|
||||
|
||||
knockoutTrack( track );
|
||||
}
|
||||
|
||||
|
@ -853,11 +867,21 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE_CONTAINER* aZone, PCB_LA
|
|||
knockoutGraphic( &module->Value() );
|
||||
|
||||
for( BOARD_ITEM* item : module->GraphicalItems() )
|
||||
{
|
||||
if( checkForCancel( m_progressReporter ) )
|
||||
return;
|
||||
|
||||
knockoutGraphic( item );
|
||||
}
|
||||
}
|
||||
|
||||
for( BOARD_ITEM* item : m_board->Drawings() )
|
||||
{
|
||||
if( checkForCancel( m_progressReporter ) )
|
||||
return;
|
||||
|
||||
knockoutGraphic( item );
|
||||
}
|
||||
|
||||
// Add non-connected zone clearances
|
||||
//
|
||||
|
@ -900,6 +924,9 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE_CONTAINER* aZone, PCB_LA
|
|||
|
||||
for( ZONE_CONTAINER* otherZone : m_board->Zones() )
|
||||
{
|
||||
if( checkForCancel( m_progressReporter ) )
|
||||
return;
|
||||
|
||||
if( otherZone->GetNetCode() != aZone->GetNetCode()
|
||||
&& otherZone->GetPriority() > aZone->GetPriority() )
|
||||
{
|
||||
|
@ -915,6 +942,9 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE_CONTAINER* aZone, PCB_LA
|
|||
{
|
||||
for( ZONE_CONTAINER* otherZone : module->Zones() )
|
||||
{
|
||||
if( checkForCancel( m_progressReporter ) )
|
||||
return;
|
||||
|
||||
if( otherZone->GetNetCode() != aZone->GetNetCode()
|
||||
&& otherZone->GetPriority() > aZone->GetPriority() )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue