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:
parent
01b61f5ff1
commit
661caf1de9
|
@ -110,6 +110,11 @@ void BOARD_COMMIT::dirtyIntersectingZones( BOARD_ITEM* item )
|
||||||
{
|
{
|
||||||
wxCHECK( item, /* void */ );
|
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 )
|
if( item->Type() == PCB_FOOTPRINT_T )
|
||||||
{
|
{
|
||||||
static_cast<FOOTPRINT*>( item )->RunOnChildren(
|
static_cast<FOOTPRINT*>( item )->RunOnChildren(
|
||||||
|
@ -128,23 +133,27 @@ void BOARD_COMMIT::dirtyIntersectingZones( BOARD_ITEM* item )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ZONE_FILLER_TOOL* zoneFillerTool = m_toolMgr->GetTool<ZONE_FILLER_TOOL>();
|
BOARD* board = static_cast<BOARD*>( m_toolMgr->GetModel() );
|
||||||
BOARD* board = static_cast<BOARD*>( m_toolMgr->GetModel() );
|
EDA_RECT bbox = item->GetBoundingBox();
|
||||||
EDA_RECT bbox = item->GetBoundingBox();
|
LSET layers = item->GetLayerSet();
|
||||||
LSET layers = item->GetLayerSet();
|
|
||||||
|
|
||||||
if( layers.test( Edge_Cuts ) || layers.test( Margin ) )
|
if( layers.test( Edge_Cuts ) || layers.test( Margin ) )
|
||||||
layers = LSET::PhysicalLayersMask();
|
layers = LSET::PhysicalLayersMask();
|
||||||
|
else
|
||||||
|
layers &= LSET::AllCuMask();
|
||||||
|
|
||||||
for( ZONE* zone : board->Zones() )
|
if( layers.any() )
|
||||||
{
|
{
|
||||||
if( zone->GetIsRuleArea() )
|
for( ZONE* zone : board->Zones() )
|
||||||
continue;
|
|
||||||
|
|
||||||
if( ( zone->GetLayerSet() & layers ).any()
|
|
||||||
&& zone->GetCachedBoundingBox().Intersects( bbox ) )
|
|
||||||
{
|
{
|
||||||
zoneFillerTool->DirtyZone( zone );
|
if( zone->GetIsRuleArea() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( ( zone->GetLayerSet() & layers ).any()
|
||||||
|
&& zone->GetCachedBoundingBox().Intersects( bbox ) )
|
||||||
|
{
|
||||||
|
zoneFillerTool->DirtyZone( zone );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,6 @@ private:
|
||||||
bool isAutoGenerated( const wxString& netName );
|
bool isAutoGenerated( const wxString& netName );
|
||||||
void updateCurrentNetSelection();
|
void updateCurrentNetSelection();
|
||||||
void updateInfoBar();
|
void updateInfoBar();
|
||||||
void handleRemoveIslandsSelection();
|
|
||||||
void storePersistentNetSortConfigurations();
|
void storePersistentNetSortConfigurations();
|
||||||
void loadPersistentNetSortConfigurations();
|
void loadPersistentNetSortConfigurations();
|
||||||
|
|
||||||
|
@ -254,11 +253,7 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS*
|
||||||
[&]( wxCommandEvent& )
|
[&]( wxCommandEvent& )
|
||||||
{
|
{
|
||||||
// Area mode is index 2
|
// Area mode is index 2
|
||||||
bool val = m_cbRemoveIslands->GetSelection() == 2;
|
m_islandThreshold.Enable( m_cbRemoveIslands->GetSelection() == 2 );
|
||||||
|
|
||||||
m_tcIslandThreshold->Enable( val );
|
|
||||||
m_islandThresholdLabel->Enable( val );
|
|
||||||
m_islandThresholdUnits->Enable( val );
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
SetupStandardButtons();
|
SetupStandardButtons();
|
||||||
|
@ -325,11 +320,7 @@ bool DIALOG_COPPER_ZONE::TransferDataToWindow()
|
||||||
|
|
||||||
m_cbRemoveIslands->SetSelection( static_cast<int>( m_settings.GetIslandRemovalMode() ) );
|
m_cbRemoveIslands->SetSelection( static_cast<int>( m_settings.GetIslandRemovalMode() ) );
|
||||||
|
|
||||||
bool val = m_settings.GetIslandRemovalMode() == ISLAND_REMOVAL_MODE::AREA;
|
m_islandThreshold.Enable( m_settings.GetIslandRemovalMode() == ISLAND_REMOVAL_MODE::AREA );
|
||||||
|
|
||||||
m_tcIslandThreshold->Enable( val );
|
|
||||||
m_islandThresholdLabel->Enable( val );
|
|
||||||
m_islandThresholdUnits->Enable( val );
|
|
||||||
|
|
||||||
loadPersistentNetSortConfigurations();
|
loadPersistentNetSortConfigurations();
|
||||||
|
|
||||||
|
@ -376,16 +367,12 @@ bool DIALOG_COPPER_ZONE::TransferDataToWindow()
|
||||||
|
|
||||||
m_tcZoneName->SetValue( m_settings.m_Name );
|
m_tcZoneName->SetValue( m_settings.m_Name );
|
||||||
|
|
||||||
updateInfoBar();
|
|
||||||
handleRemoveIslandsSelection();
|
|
||||||
|
|
||||||
updateDisplayedListOfNets();
|
|
||||||
|
|
||||||
SetInitialFocus( m_ShowNetNameFilter );
|
SetInitialFocus( m_ShowNetNameFilter );
|
||||||
|
|
||||||
// Enable/Disable some widgets
|
// Enable/Disable some widgets
|
||||||
wxCommandEvent event;
|
wxCommandEvent event;
|
||||||
OnStyleSelection( event );
|
OnStyleSelection( event );
|
||||||
|
OnNetSelectionUpdated( event );
|
||||||
|
|
||||||
Fit();
|
Fit();
|
||||||
|
|
||||||
|
@ -465,26 +452,28 @@ void DIALOG_COPPER_ZONE::OnNetSelectionUpdated( wxCommandEvent& event )
|
||||||
// correct selection
|
// correct selection
|
||||||
updateDisplayedListOfNets();
|
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 )
|
void DIALOG_COPPER_ZONE::OnRemoveIslandsSelection( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
handleRemoveIslandsSelection();
|
m_islandThreshold.Enable( m_cbRemoveIslands->GetSelection() == 2 );
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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_gap = Iu2Mils( m_settings.m_ThermalReliefGap );
|
||||||
cfg->m_Zones.thermal_relief_copper_width = Iu2Mils( m_settings.m_ThermalReliefSpokeWidth );
|
cfg->m_Zones.thermal_relief_copper_width = Iu2Mils( m_settings.m_ThermalReliefSpokeWidth );
|
||||||
|
|
||||||
m_settings.SetIslandRemovalMode(
|
m_settings.SetIslandRemovalMode( (ISLAND_REMOVAL_MODE) m_cbRemoveIslands->GetSelection() );
|
||||||
static_cast<ISLAND_REMOVAL_MODE>( m_cbRemoveIslands->GetSelection() ) );
|
|
||||||
m_settings.SetMinIslandArea( m_islandThreshold.GetValue() );
|
m_settings.SetMinIslandArea( m_islandThreshold.GetValue() );
|
||||||
|
|
||||||
// If we use only exportable to others zones parameters, exit here:
|
// 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() };
|
const int netSelection{ m_ListNetNameSelection->GetSelection() };
|
||||||
|
|
||||||
if( netSelection )
|
if( netSelection > 0 )
|
||||||
{
|
{
|
||||||
const wxString& selectedNetName = m_ListNetNameSelection->GetString( netSelection );
|
const wxString& selectedNetName = m_ListNetNameSelection->GetString( netSelection );
|
||||||
m_currentlySelectedNetcode = m_netNameToNetCode[selectedNetName];
|
m_currentlySelectedNetcode = m_netNameToNetCode[selectedNetName];
|
||||||
|
|
|
@ -53,9 +53,9 @@ enum class ZONE_BORDER_DISPLAY_STYLE
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Whether or not to remove isolated islands from a zone
|
/// Whether or not to remove isolated islands from a zone
|
||||||
enum class ISLAND_REMOVAL_MODE
|
enum ISLAND_REMOVAL_MODE
|
||||||
{
|
{
|
||||||
ALWAYS,
|
ALWAYS = 0,
|
||||||
NEVER,
|
NEVER,
|
||||||
AREA
|
AREA
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue