Make sure new zones are filled when auto-fill is on.

Also fixes some issues with enablement of the Remove Islands stuff.

Fixes https://gitlab.com/kicad/code/kicad/issues/12123
This commit is contained in:
Jeff Young 2022-07-30 17:30:22 +01:00
parent 01b61f5ff1
commit 661caf1de9
3 changed files with 44 additions and 47 deletions

View File

@ -110,6 +110,11 @@ void BOARD_COMMIT::dirtyIntersectingZones( BOARD_ITEM* item )
{
wxCHECK( item, /* void */ );
ZONE_FILLER_TOOL* zoneFillerTool = m_toolMgr->GetTool<ZONE_FILLER_TOOL>();
if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T )
zoneFillerTool->DirtyZone( static_cast<ZONE*>( item ) );
if( item->Type() == PCB_FOOTPRINT_T )
{
static_cast<FOOTPRINT*>( item )->RunOnChildren(
@ -128,14 +133,17 @@ void BOARD_COMMIT::dirtyIntersectingZones( BOARD_ITEM* item )
}
else
{
ZONE_FILLER_TOOL* zoneFillerTool = m_toolMgr->GetTool<ZONE_FILLER_TOOL>();
BOARD* board = static_cast<BOARD*>( m_toolMgr->GetModel() );
EDA_RECT bbox = item->GetBoundingBox();
LSET layers = item->GetLayerSet();
if( layers.test( Edge_Cuts ) || layers.test( Margin ) )
layers = LSET::PhysicalLayersMask();
else
layers &= LSET::AllCuMask();
if( layers.any() )
{
for( ZONE* zone : board->Zones() )
{
if( zone->GetIsRuleArea() )
@ -148,6 +156,7 @@ void BOARD_COMMIT::dirtyIntersectingZones( BOARD_ITEM* item )
}
}
}
}
}

View File

@ -94,7 +94,6 @@ private:
bool isAutoGenerated( const wxString& netName );
void updateCurrentNetSelection();
void updateInfoBar();
void handleRemoveIslandsSelection();
void storePersistentNetSortConfigurations();
void loadPersistentNetSortConfigurations();
@ -254,11 +253,7 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS*
[&]( wxCommandEvent& )
{
// Area mode is index 2
bool val = m_cbRemoveIslands->GetSelection() == 2;
m_tcIslandThreshold->Enable( val );
m_islandThresholdLabel->Enable( val );
m_islandThresholdUnits->Enable( val );
m_islandThreshold.Enable( m_cbRemoveIslands->GetSelection() == 2 );
} );
SetupStandardButtons();
@ -325,11 +320,7 @@ bool DIALOG_COPPER_ZONE::TransferDataToWindow()
m_cbRemoveIslands->SetSelection( static_cast<int>( m_settings.GetIslandRemovalMode() ) );
bool val = m_settings.GetIslandRemovalMode() == ISLAND_REMOVAL_MODE::AREA;
m_tcIslandThreshold->Enable( val );
m_islandThresholdLabel->Enable( val );
m_islandThresholdUnits->Enable( val );
m_islandThreshold.Enable( m_settings.GetIslandRemovalMode() == ISLAND_REMOVAL_MODE::AREA );
loadPersistentNetSortConfigurations();
@ -376,16 +367,12 @@ bool DIALOG_COPPER_ZONE::TransferDataToWindow()
m_tcZoneName->SetValue( m_settings.m_Name );
updateInfoBar();
handleRemoveIslandsSelection();
updateDisplayedListOfNets();
SetInitialFocus( m_ShowNetNameFilter );
// Enable/Disable some widgets
wxCommandEvent event;
OnStyleSelection( event );
OnNetSelectionUpdated( event );
Fit();
@ -465,26 +452,28 @@ void DIALOG_COPPER_ZONE::OnNetSelectionUpdated( wxCommandEvent& event )
// correct selection
updateDisplayedListOfNets();
handleRemoveIslandsSelection();
// Zones with no net never have islands removed
if( m_currentlySelectedNetcode == INVALID_NET_CODE )
{
if( m_cbRemoveIslands->IsEnabled() )
m_settings.SetIslandRemovalMode( (ISLAND_REMOVAL_MODE) m_cbRemoveIslands->GetSelection() );
m_cbRemoveIslands->SetSelection( 1 );
m_staticText40->Enable( false );
m_cbRemoveIslands->Enable( false );
}
else if( !m_cbRemoveIslands->IsEnabled() )
{
m_cbRemoveIslands->SetSelection( static_cast<int>( m_settings.GetIslandRemovalMode() ) );
m_staticText40->Enable( true );
m_cbRemoveIslands->Enable( true );
}
}
void DIALOG_COPPER_ZONE::OnRemoveIslandsSelection( wxCommandEvent& event )
{
handleRemoveIslandsSelection();
}
void DIALOG_COPPER_ZONE::handleRemoveIslandsSelection()
{
bool noNetSelected = m_currentlySelectedNetcode == INVALID_NET_CODE;
bool enableSize = !noNetSelected && ( m_cbRemoveIslands->GetSelection() == 2 );
// Zones with no net never have islands removed
m_cbRemoveIslands->Enable( !noNetSelected );
m_islandThresholdLabel->Enable( enableSize );
m_islandThresholdUnits->Enable( enableSize );
m_tcIslandThreshold->Enable( enableSize );
m_islandThreshold.Enable( m_cbRemoveIslands->GetSelection() == 2 );
}
@ -601,8 +590,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly )
cfg->m_Zones.thermal_relief_gap = Iu2Mils( m_settings.m_ThermalReliefGap );
cfg->m_Zones.thermal_relief_copper_width = Iu2Mils( m_settings.m_ThermalReliefSpokeWidth );
m_settings.SetIslandRemovalMode(
static_cast<ISLAND_REMOVAL_MODE>( m_cbRemoveIslands->GetSelection() ) );
m_settings.SetIslandRemovalMode( (ISLAND_REMOVAL_MODE) m_cbRemoveIslands->GetSelection() );
m_settings.SetMinIslandArea( m_islandThreshold.GetValue() );
// If we use only exportable to others zones parameters, exit here:
@ -636,7 +624,7 @@ void DIALOG_COPPER_ZONE::updateCurrentNetSelection()
{
const int netSelection{ m_ListNetNameSelection->GetSelection() };
if( netSelection )
if( netSelection > 0 )
{
const wxString& selectedNetName = m_ListNetNameSelection->GetString( netSelection );
m_currentlySelectedNetcode = m_netNameToNetCode[selectedNetName];

View File

@ -53,9 +53,9 @@ enum class ZONE_BORDER_DISPLAY_STYLE
};
/// Whether or not to remove isolated islands from a zone
enum class ISLAND_REMOVAL_MODE
enum ISLAND_REMOVAL_MODE
{
ALWAYS,
ALWAYS = 0,
NEVER,
AREA
};