2012-06-08 11:56:42 +02:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2018-02-18 10:09:13 +01:00
|
|
|
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2012-06-08 11:56:42 +02:00
|
|
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
2025-01-01 13:30:11 -08:00
|
|
|
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
|
2012-06-08 11:56:42 +02:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
2008-10-23 10:26:06 +00:00
|
|
|
|
2019-04-02 01:42:24 -07:00
|
|
|
#include <zone_settings.h>
|
|
|
|
|
2018-05-25 15:56:04 +01:00
|
|
|
#include <pcb_base_frame.h>
|
2020-11-12 20:19:22 +00:00
|
|
|
#include <board.h>
|
2024-07-08 20:58:47 -07:00
|
|
|
#include <lset.h>
|
2020-01-12 20:44:19 -05:00
|
|
|
#include <settings/color_settings.h>
|
2012-01-22 22:33:36 -06:00
|
|
|
#include <zones.h>
|
2011-09-23 09:57:12 -04:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
#include <zone.h>
|
2018-05-25 15:56:04 +01:00
|
|
|
#include <wx/dataview.h>
|
|
|
|
#include <widgets/color_swatch.h>
|
2008-10-23 10:26:06 +00:00
|
|
|
|
2025-03-02 20:31:04 +00:00
|
|
|
bool ZONE_LAYER_PROPERTIES::operator==( const ZONE_LAYER_PROPERTIES& aOther ) const
|
|
|
|
{
|
|
|
|
return hatching_offset == aOther.hatching_offset;
|
|
|
|
}
|
|
|
|
|
2012-02-05 23:44:19 -06:00
|
|
|
ZONE_SETTINGS::ZONE_SETTINGS()
|
2008-10-23 10:26:06 +00:00
|
|
|
{
|
2012-01-29 20:29:19 +01:00
|
|
|
m_ZonePriority = 0;
|
2019-12-20 14:11:39 +00:00
|
|
|
m_FillMode = ZONE_FILL_MODE::POLYGONS; // Mode for filling zone
|
2017-08-22 12:02:07 +02:00
|
|
|
// Zone clearance value
|
2023-02-10 21:54:40 -05:00
|
|
|
m_ZoneClearance = pcbIUScale.mmToIU( ZONE_CLEARANCE_MM );
|
2012-06-25 22:59:19 +02:00
|
|
|
// Min thickness value in filled areas (this is the minimum width of copper to fill solid areas) :
|
2023-02-10 21:54:40 -05:00
|
|
|
m_ZoneMinThickness = pcbIUScale.mmToIU( ZONE_THICKNESS_MM );
|
|
|
|
// Arbitrary defaults for the hatch settings
|
|
|
|
m_HatchThickness = std::max( m_ZoneMinThickness * 4, pcbIUScale.mmToIU( 1.0 ) );
|
|
|
|
m_HatchGap = std::max( m_ZoneMinThickness * 6, pcbIUScale.mmToIU( 1.5 ) );
|
2022-01-19 00:22:40 +00:00
|
|
|
m_HatchOrientation = ANGLE_0; // Grid style: orientation of grid lines
|
|
|
|
m_HatchSmoothingLevel = 0; // Grid pattern smoothing type. 0 = no smoothing
|
|
|
|
m_HatchSmoothingValue = 0.1; // Grid pattern chamfer value relative to the gap value
|
2025-04-04 22:27:47 +01:00
|
|
|
m_HatchHoleMinArea = 0.15; // Min size before holes are dropped (ratio of hole size)
|
2022-01-19 00:22:40 +00:00
|
|
|
m_HatchBorderAlgorithm = 1; // 0 = use zone min thickness; 1 = use hatch width
|
|
|
|
m_NetcodeSelection = 0; // Net code selection for the current zone
|
2020-08-07 15:04:34 +01:00
|
|
|
m_ZoneBorderDisplayStyle = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE; // Option to show the zone
|
|
|
|
// outlines only, short
|
|
|
|
// hatches or full hatches
|
2023-02-10 21:54:40 -05:00
|
|
|
m_BorderHatchPitch = pcbIUScale.mmToIU( ZONE_BORDER_HATCH_DIST_MM );
|
2012-02-05 23:44:19 -06:00
|
|
|
|
2020-06-23 22:19:08 -04:00
|
|
|
m_Layers.reset().set( F_Cu );
|
2020-06-25 22:19:51 -04:00
|
|
|
m_Name = wxEmptyString;
|
2020-06-23 22:19:08 -04:00
|
|
|
|
2013-03-20 10:50:12 -04:00
|
|
|
// thickness of the gap in thermal reliefs:
|
2023-02-10 21:54:40 -05:00
|
|
|
m_ThermalReliefGap = pcbIUScale.mmToIU( ZONE_THERMAL_RELIEF_GAP_MM );
|
2013-03-20 10:50:12 -04:00
|
|
|
// thickness of the copper bridge in thermal reliefs:
|
2023-02-10 21:54:40 -05:00
|
|
|
m_ThermalReliefSpokeWidth = pcbIUScale.mmToIU( ZONE_THERMAL_RELIEF_COPPER_WIDTH_MM );
|
2008-10-23 10:26:06 +00:00
|
|
|
|
2020-09-17 14:14:45 +01:00
|
|
|
m_padConnection = ZONE_CONNECTION::THERMAL; // How pads are covered by copper in zone
|
2012-02-05 23:44:19 -06:00
|
|
|
|
2021-05-08 10:11:32 +01:00
|
|
|
m_Locked = false;
|
2011-02-21 21:43:59 +02:00
|
|
|
|
2012-07-13 20:55:29 +02:00
|
|
|
m_cornerSmoothingType = SMOOTHING_NONE;
|
|
|
|
m_cornerRadius = 0;
|
|
|
|
|
2023-01-27 08:57:18 -05:00
|
|
|
m_removeIslands = ISLAND_REMOVAL_MODE::ALWAYS;
|
2022-09-16 20:45:14 -04:00
|
|
|
m_minIslandArea = 10 * pcbIUScale.IU_PER_MM * pcbIUScale.IU_PER_MM;
|
2020-06-23 22:19:08 -04:00
|
|
|
|
2020-09-21 19:32:07 -04:00
|
|
|
SetIsRuleArea( false );
|
2024-10-09 22:43:40 +01:00
|
|
|
SetRuleAreaPlacementSourceType( RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME );
|
2025-03-25 12:02:25 +00:00
|
|
|
SetDoNotAllowZoneFills( false );
|
2012-07-13 20:55:29 +02:00
|
|
|
SetDoNotAllowVias( true );
|
|
|
|
SetDoNotAllowTracks( true );
|
2020-05-07 01:30:46 +01:00
|
|
|
SetDoNotAllowPads( true );
|
|
|
|
SetDoNotAllowFootprints( false );
|
2022-03-06 09:48:33 +01:00
|
|
|
|
|
|
|
m_TeardropType = TEARDROP_TYPE::TD_NONE;
|
2024-10-09 22:43:40 +01:00
|
|
|
m_ruleAreaPlacementEnabled = false;
|
2008-10-23 10:26:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-01-01 13:37:31 -05:00
|
|
|
bool ZONE_SETTINGS::operator==( const ZONE_SETTINGS& aOther ) const
|
|
|
|
{
|
|
|
|
if( m_ZonePriority != aOther.m_ZonePriority ) return false;
|
|
|
|
if( m_FillMode != aOther.m_FillMode ) return false;
|
|
|
|
if( m_ZoneClearance != aOther.m_ZoneClearance ) return false;
|
|
|
|
if( m_ZoneMinThickness != aOther.m_ZoneMinThickness ) return false;
|
|
|
|
if( m_HatchThickness != aOther.m_HatchThickness ) return false;
|
|
|
|
if( m_HatchGap != aOther.m_HatchGap ) return false;
|
|
|
|
if( m_HatchOrientation != aOther.m_HatchOrientation ) return false;
|
|
|
|
if( m_HatchSmoothingLevel != aOther.m_HatchSmoothingLevel ) return false;
|
|
|
|
if( m_HatchSmoothingValue != aOther.m_HatchSmoothingValue ) return false;
|
|
|
|
if( m_HatchBorderAlgorithm != aOther.m_HatchBorderAlgorithm ) return false;
|
|
|
|
if( m_HatchHoleMinArea != aOther.m_HatchHoleMinArea ) return false;
|
|
|
|
if( m_NetcodeSelection != aOther.m_NetcodeSelection ) return false;
|
|
|
|
if( m_Name != aOther.m_Name ) return false;
|
|
|
|
if( m_ZoneBorderDisplayStyle != aOther.m_ZoneBorderDisplayStyle ) return false;
|
|
|
|
if( m_BorderHatchPitch != aOther.m_BorderHatchPitch ) return false;
|
|
|
|
if( m_ThermalReliefGap != aOther.m_ThermalReliefGap ) return false;
|
|
|
|
if( m_ThermalReliefSpokeWidth != aOther.m_ThermalReliefSpokeWidth ) return false;
|
|
|
|
if( m_padConnection != aOther.m_padConnection ) return false;
|
|
|
|
if( m_cornerSmoothingType != aOther.m_cornerSmoothingType ) return false;
|
|
|
|
if( m_cornerRadius != aOther.m_cornerRadius ) return false;
|
|
|
|
if( m_isRuleArea != aOther.m_isRuleArea ) return false;
|
2025-03-25 12:02:25 +00:00
|
|
|
if( m_ruleAreaPlacementEnabled != aOther.m_ruleAreaPlacementEnabled ) return false;
|
2024-10-09 01:06:11 +01:00
|
|
|
if( m_ruleAreaPlacementSourceType != aOther.m_ruleAreaPlacementSourceType ) return false;
|
2024-10-10 12:28:54 +08:00
|
|
|
if( m_ruleAreaPlacementSource != aOther.m_ruleAreaPlacementSource ) return false;
|
2025-03-25 12:02:25 +00:00
|
|
|
if( m_keepoutDoNotAllowZoneFills != aOther.m_keepoutDoNotAllowZoneFills ) return false;
|
2024-01-01 13:37:31 -05:00
|
|
|
if( m_keepoutDoNotAllowVias != aOther.m_keepoutDoNotAllowVias ) return false;
|
|
|
|
if( m_keepoutDoNotAllowTracks != aOther.m_keepoutDoNotAllowTracks ) return false;
|
|
|
|
if( m_keepoutDoNotAllowPads != aOther.m_keepoutDoNotAllowPads ) return false;
|
|
|
|
if( m_keepoutDoNotAllowFootprints != aOther.m_keepoutDoNotAllowFootprints ) return false;
|
|
|
|
if( m_Locked != aOther.m_Locked ) return false;
|
|
|
|
if( m_removeIslands != aOther.m_removeIslands ) return false;
|
|
|
|
if( m_minIslandArea != aOther.m_minIslandArea ) return false;
|
|
|
|
|
2025-03-02 20:31:04 +00:00
|
|
|
if( !std::equal( std::begin( m_layerProperties ), std::end( m_layerProperties ),
|
|
|
|
std::begin( aOther.m_layerProperties ) ) )
|
|
|
|
return false;
|
|
|
|
|
2024-01-01 13:37:31 -05:00
|
|
|
// Currently, the teardrop area type is not really a ZONE_SETTINGS parameter,
|
|
|
|
// but a ZONE parameter only.
|
|
|
|
// However it can be used in dialogs
|
|
|
|
if( m_TeardropType != aOther.m_TeardropType ) return false;
|
|
|
|
|
|
|
|
if( m_Layers != aOther.m_Layers ) return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
ZONE_SETTINGS& ZONE_SETTINGS::operator << ( const ZONE& aSource )
|
2008-10-23 10:26:06 +00:00
|
|
|
{
|
2022-03-01 14:53:35 +00:00
|
|
|
m_ZonePriority = aSource.GetAssignedPriority();
|
2020-06-25 22:19:51 -04:00
|
|
|
m_FillMode = aSource.GetFillMode();
|
2024-01-10 11:28:29 +00:00
|
|
|
m_ZoneClearance = aSource.GetLocalClearance().value();
|
2020-06-25 22:19:51 -04:00
|
|
|
m_ZoneMinThickness = aSource.GetMinThickness();
|
2020-08-07 15:04:34 +01:00
|
|
|
m_HatchThickness = aSource.GetHatchThickness();
|
|
|
|
m_HatchGap = aSource.GetHatchGap();
|
|
|
|
m_HatchOrientation = aSource.GetHatchOrientation();
|
|
|
|
m_HatchSmoothingLevel = aSource.GetHatchSmoothingLevel();
|
|
|
|
m_HatchSmoothingValue = aSource.GetHatchSmoothingValue();
|
|
|
|
m_HatchBorderAlgorithm = aSource.GetHatchBorderAlgorithm();
|
|
|
|
m_HatchHoleMinArea = aSource.GetHatchHoleMinArea();
|
2020-06-25 22:19:51 -04:00
|
|
|
m_NetcodeSelection = aSource.GetNetCode();
|
|
|
|
m_Name = aSource.GetZoneName();
|
2020-09-17 14:14:45 +01:00
|
|
|
m_ZoneBorderDisplayStyle = aSource.GetHatchStyle();
|
2022-02-12 17:37:27 +01:00
|
|
|
m_BorderHatchPitch = aSource.GetBorderHatchPitch();
|
2020-06-25 22:19:51 -04:00
|
|
|
m_ThermalReliefGap = aSource.GetThermalReliefGap();
|
2021-08-08 14:37:14 +01:00
|
|
|
m_ThermalReliefSpokeWidth = aSource.GetThermalReliefSpokeWidth();
|
2020-09-17 14:14:45 +01:00
|
|
|
m_padConnection = aSource.GetPadConnection();
|
2020-06-25 22:19:51 -04:00
|
|
|
m_cornerSmoothingType = aSource.GetCornerSmoothingType();
|
|
|
|
m_cornerRadius = aSource.GetCornerRadius();
|
2020-09-21 19:32:07 -04:00
|
|
|
m_isRuleArea = aSource.GetIsRuleArea();
|
2025-03-25 12:02:25 +00:00
|
|
|
m_ruleAreaPlacementEnabled = aSource.GetRuleAreaPlacementEnabled();
|
2024-10-09 01:06:11 +01:00
|
|
|
m_ruleAreaPlacementSourceType = aSource.GetRuleAreaPlacementSourceType();
|
2024-10-10 12:28:54 +08:00
|
|
|
m_ruleAreaPlacementSource = aSource.GetRuleAreaPlacementSource();
|
2025-03-25 12:02:25 +00:00
|
|
|
m_keepoutDoNotAllowZoneFills = aSource.GetDoNotAllowZoneFills();
|
2020-06-25 22:19:51 -04:00
|
|
|
m_keepoutDoNotAllowVias = aSource.GetDoNotAllowVias();
|
|
|
|
m_keepoutDoNotAllowTracks = aSource.GetDoNotAllowTracks();
|
|
|
|
m_keepoutDoNotAllowPads = aSource.GetDoNotAllowPads();
|
2020-05-07 01:30:46 +01:00
|
|
|
m_keepoutDoNotAllowFootprints = aSource.GetDoNotAllowFootprints();
|
2021-05-06 22:49:07 +01:00
|
|
|
m_Locked = aSource.IsLocked();
|
2020-06-25 22:19:51 -04:00
|
|
|
m_removeIslands = aSource.GetIslandRemovalMode();
|
|
|
|
m_minIslandArea = aSource.GetMinIslandArea();
|
2012-02-05 23:44:19 -06:00
|
|
|
|
2025-03-02 20:31:04 +00:00
|
|
|
m_layerProperties.clear();
|
|
|
|
|
|
|
|
std::ranges::copy( aSource.LayerProperties(),
|
|
|
|
std::inserter( m_layerProperties, std::end( m_layerProperties ) ) );
|
|
|
|
|
2022-03-05 17:18:42 +01:00
|
|
|
// Currently, the teardrop area type is not really a ZONE_SETTINGS parameter,
|
|
|
|
// but a ZONE parameter only.
|
|
|
|
// However it can be used in dialogs
|
|
|
|
m_TeardropType = aSource.GetTeardropAreaType();
|
|
|
|
|
2018-01-30 13:55:02 +01:00
|
|
|
m_Layers = aSource.GetLayerSet();
|
|
|
|
|
2012-02-05 23:44:19 -06:00
|
|
|
return *this;
|
2008-10-23 10:26:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void ZONE_SETTINGS::ExportSetting( ZONE& aTarget, bool aFullExport ) const
|
2008-10-23 10:26:06 +00:00
|
|
|
{
|
2013-03-18 15:36:07 -04:00
|
|
|
aTarget.SetFillMode( m_FillMode );
|
2020-09-05 17:00:29 +01:00
|
|
|
aTarget.SetLocalClearance( m_ZoneClearance );
|
2013-03-18 15:36:07 -04:00
|
|
|
aTarget.SetMinThickness( m_ZoneMinThickness );
|
2020-08-07 15:04:34 +01:00
|
|
|
aTarget.SetHatchThickness( m_HatchThickness );
|
|
|
|
aTarget.SetHatchGap( m_HatchGap );
|
|
|
|
aTarget.SetHatchOrientation( m_HatchOrientation );
|
|
|
|
aTarget.SetHatchSmoothingLevel( m_HatchSmoothingLevel );
|
|
|
|
aTarget.SetHatchSmoothingValue( m_HatchSmoothingValue );
|
|
|
|
aTarget.SetHatchBorderAlgorithm( m_HatchBorderAlgorithm );
|
|
|
|
aTarget.SetHatchHoleMinArea( m_HatchHoleMinArea );
|
2013-03-18 15:36:07 -04:00
|
|
|
aTarget.SetThermalReliefGap( m_ThermalReliefGap );
|
2020-09-17 14:14:45 +01:00
|
|
|
aTarget.SetThermalReliefSpokeWidth( m_ThermalReliefSpokeWidth );
|
|
|
|
aTarget.SetPadConnection( m_padConnection );
|
2012-07-13 20:55:29 +02:00
|
|
|
aTarget.SetCornerSmoothingType( m_cornerSmoothingType );
|
|
|
|
aTarget.SetCornerRadius( m_cornerRadius );
|
2020-09-21 19:32:07 -04:00
|
|
|
aTarget.SetIsRuleArea( GetIsRuleArea() );
|
2024-10-09 22:43:40 +01:00
|
|
|
aTarget.SetRuleAreaPlacementEnabled( GetRuleAreaPlacementEnabled() );
|
2024-10-09 01:06:11 +01:00
|
|
|
aTarget.SetRuleAreaPlacementSourceType( GetRuleAreaPlacementSourceType() );
|
|
|
|
aTarget.SetRuleAreaPlacementSource( GetRuleAreaPlacementSource() );
|
2025-03-25 12:02:25 +00:00
|
|
|
aTarget.SetDoNotAllowZoneFills( GetDoNotAllowZoneFills() );
|
2012-07-13 20:55:29 +02:00
|
|
|
aTarget.SetDoNotAllowVias( GetDoNotAllowVias() );
|
|
|
|
aTarget.SetDoNotAllowTracks( GetDoNotAllowTracks() );
|
2020-05-07 01:30:46 +01:00
|
|
|
aTarget.SetDoNotAllowPads( GetDoNotAllowPads() );
|
|
|
|
aTarget.SetDoNotAllowFootprints( GetDoNotAllowFootprints() );
|
2021-05-06 22:49:07 +01:00
|
|
|
aTarget.SetLocked( m_Locked );
|
2020-06-25 22:19:51 -04:00
|
|
|
aTarget.SetIslandRemovalMode( GetIslandRemovalMode() );
|
|
|
|
aTarget.SetMinIslandArea( GetMinIslandArea() );
|
2022-03-05 17:18:42 +01:00
|
|
|
// Currently, the teardrop area type is not imported from a ZONE_SETTINGS, because
|
|
|
|
// it is not really a ZONE_SETTINGS parameter, but a ZONE parameter only
|
|
|
|
#if 0
|
|
|
|
aTarget.SetTeardropAreaType( m_TeardropType );
|
|
|
|
#endif
|
|
|
|
|
2012-02-05 23:44:19 -06:00
|
|
|
|
2008-12-12 21:30:07 +00:00
|
|
|
if( aFullExport )
|
2008-12-03 10:32:53 +00:00
|
|
|
{
|
2022-03-01 14:53:35 +00:00
|
|
|
aTarget.SetAssignedPriority( m_ZonePriority );
|
2025-03-02 20:31:04 +00:00
|
|
|
|
|
|
|
aTarget.SetLayerProperties( m_layerProperties );
|
2020-06-23 22:19:08 -04:00
|
|
|
aTarget.SetLayerSet( m_Layers );
|
2025-03-02 20:31:04 +00:00
|
|
|
|
2020-06-25 22:19:51 -04:00
|
|
|
aTarget.SetZoneName( m_Name );
|
2018-01-30 13:55:02 +01:00
|
|
|
|
2020-09-21 19:32:07 -04:00
|
|
|
if( !m_isRuleArea )
|
2019-10-29 11:09:54 +01:00
|
|
|
aTarget.SetNetCode( m_NetcodeSelection );
|
2008-12-03 10:32:53 +00:00
|
|
|
}
|
2012-07-30 09:40:25 +02:00
|
|
|
|
2020-08-07 15:04:34 +01:00
|
|
|
// call SetBorderDisplayStyle last, because hatch lines will be rebuilt,
|
2012-07-30 09:40:25 +02:00
|
|
|
// using new parameters values
|
2022-02-12 17:37:27 +01:00
|
|
|
aTarget.SetBorderDisplayStyle( m_ZoneBorderDisplayStyle,
|
|
|
|
m_BorderHatchPitch, true );
|
2008-10-23 10:26:06 +00:00
|
|
|
}
|
2015-05-15 14:49:11 +02:00
|
|
|
|
2025-03-02 20:31:04 +00:00
|
|
|
void ZONE_SETTINGS::CopyFrom( const ZONE_SETTINGS& aOther, bool aCopyFull )
|
|
|
|
{
|
|
|
|
// clang-format off
|
|
|
|
m_ZonePriority = aOther.m_ZonePriority;
|
|
|
|
m_FillMode = aOther.m_FillMode;
|
|
|
|
m_ZoneClearance = aOther.m_ZoneClearance;
|
|
|
|
m_ZoneMinThickness = aOther.m_ZoneMinThickness;
|
|
|
|
m_HatchThickness = aOther.m_HatchThickness;
|
|
|
|
m_HatchGap = aOther.m_HatchGap;
|
|
|
|
m_HatchOrientation = aOther.m_HatchOrientation;
|
|
|
|
m_HatchSmoothingLevel = aOther.m_HatchSmoothingLevel;
|
|
|
|
m_HatchSmoothingValue = aOther.m_HatchSmoothingValue;
|
|
|
|
m_HatchBorderAlgorithm = aOther.m_HatchBorderAlgorithm;
|
|
|
|
m_HatchHoleMinArea = aOther.m_HatchHoleMinArea;
|
|
|
|
m_NetcodeSelection = aOther.m_NetcodeSelection;
|
|
|
|
m_Name = aOther.m_Name;
|
|
|
|
m_ZoneBorderDisplayStyle = aOther.m_ZoneBorderDisplayStyle;
|
|
|
|
m_BorderHatchPitch = aOther.m_BorderHatchPitch;
|
|
|
|
m_ThermalReliefGap = aOther.m_ThermalReliefGap;
|
|
|
|
m_ThermalReliefSpokeWidth = aOther.m_ThermalReliefSpokeWidth;
|
|
|
|
m_padConnection = aOther.m_padConnection;
|
|
|
|
m_cornerSmoothingType = aOther.m_cornerSmoothingType;
|
|
|
|
m_cornerRadius = aOther.m_cornerRadius;
|
|
|
|
m_isRuleArea = aOther.m_isRuleArea;
|
|
|
|
m_ruleAreaPlacementEnabled = aOther.m_ruleAreaPlacementEnabled;
|
|
|
|
m_ruleAreaPlacementSourceType = aOther.m_ruleAreaPlacementSourceType;
|
|
|
|
m_ruleAreaPlacementSource = aOther.m_ruleAreaPlacementSource;
|
2025-03-25 12:02:25 +00:00
|
|
|
m_keepoutDoNotAllowZoneFills = aOther.m_keepoutDoNotAllowZoneFills;
|
2025-03-02 20:31:04 +00:00
|
|
|
m_keepoutDoNotAllowVias = aOther.m_keepoutDoNotAllowVias;
|
|
|
|
m_keepoutDoNotAllowTracks = aOther.m_keepoutDoNotAllowTracks;
|
|
|
|
m_keepoutDoNotAllowPads = aOther.m_keepoutDoNotAllowPads;
|
|
|
|
m_keepoutDoNotAllowFootprints = aOther.m_keepoutDoNotAllowFootprints;
|
|
|
|
m_Locked = aOther.m_Locked;
|
|
|
|
m_removeIslands = aOther.m_removeIslands;
|
|
|
|
m_minIslandArea = aOther.m_minIslandArea;
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
if( aCopyFull )
|
|
|
|
{
|
|
|
|
m_layerProperties.clear();
|
|
|
|
|
|
|
|
std::ranges::copy( aOther.m_layerProperties,
|
|
|
|
std::inserter( m_layerProperties, std::end( m_layerProperties ) ) );
|
|
|
|
|
|
|
|
m_TeardropType = aOther.m_TeardropType;
|
|
|
|
|
|
|
|
m_Layers = aOther.m_Layers;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-15 14:49:11 +02:00
|
|
|
|
|
|
|
void ZONE_SETTINGS::SetCornerRadius( int aRadius )
|
|
|
|
{
|
2018-10-06 22:00:19 -07:00
|
|
|
if( aRadius < 0 )
|
2015-05-15 14:49:11 +02:00
|
|
|
m_cornerRadius = 0;
|
|
|
|
else
|
|
|
|
m_cornerRadius = aRadius;
|
2017-11-02 21:41:29 +01:00
|
|
|
}
|
2018-05-25 15:56:04 +01:00
|
|
|
|
|
|
|
|
2018-07-20 22:21:05 +01:00
|
|
|
#ifdef __WXOSX_MAC__
|
|
|
|
const static wxSize LAYER_BITMAP_SIZE( 28, 28 ); // wxCocoa impl unhappy if this isn't square...
|
|
|
|
#else
|
2018-07-22 11:17:35 +01:00
|
|
|
const static wxSize LAYER_BITMAP_SIZE( 24, 16 );
|
2018-07-20 22:21:05 +01:00
|
|
|
#endif
|
2018-05-25 15:56:04 +01:00
|
|
|
|
2020-08-17 13:55:56 +01:00
|
|
|
const static wxSize CHECKERBOARD_SIZE( 8, 8 );
|
|
|
|
|
2020-08-09 12:22:09 +01:00
|
|
|
|
2023-06-10 14:20:59 +02:00
|
|
|
const ZONE_SETTINGS& ZONE_SETTINGS::GetDefaultSettings()
|
2023-06-10 12:03:18 +02:00
|
|
|
{
|
|
|
|
static ZONE_SETTINGS defaultSettings;
|
|
|
|
|
|
|
|
return defaultSettings;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-05-25 15:56:04 +01:00
|
|
|
// A helper for setting up a dialog list for specifying zone layers. Used by all three
|
|
|
|
// zone settings dialogs.
|
|
|
|
void ZONE_SETTINGS::SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME* aFrame,
|
2022-02-17 23:54:15 +00:00
|
|
|
LSET aLayers, bool aFpEditorMode )
|
2018-05-25 15:56:04 +01:00
|
|
|
{
|
|
|
|
BOARD* board = aFrame->GetBoard();
|
2020-05-16 13:15:43 -04:00
|
|
|
COLOR4D backgroundColor = aFrame->GetColorSettings()->GetColor( LAYER_PCB_BACKGROUND );
|
2018-05-25 15:56:04 +01:00
|
|
|
|
2020-08-09 12:22:09 +01:00
|
|
|
// In the Footprint Editor In1_Cu is used as a proxy for "all inner layers"
|
2020-08-09 00:23:11 +01:00
|
|
|
if( aFpEditorMode )
|
2022-02-17 23:54:15 +00:00
|
|
|
aLayers.set( In1_Cu );
|
2020-08-09 00:23:11 +01:00
|
|
|
|
2024-05-27 01:00:51 +03:00
|
|
|
wxDataViewColumn* checkColumn = aList->AppendToggleColumn(
|
|
|
|
wxEmptyString, wxDATAVIEW_CELL_ACTIVATABLE, wxCOL_WIDTH_DEFAULT, wxALIGN_CENTER );
|
|
|
|
|
2018-05-25 15:56:04 +01:00
|
|
|
wxDataViewColumn* layerColumn = aList->AppendIconTextColumn( wxEmptyString );
|
2018-07-19 11:09:53 +02:00
|
|
|
wxDataViewColumn* layerIDColumn = aList->AppendTextColumn( wxEmptyString );
|
2018-05-25 15:56:04 +01:00
|
|
|
layerIDColumn->SetHidden( true );
|
|
|
|
|
2018-07-21 23:17:46 +01:00
|
|
|
int textWidth = 0;
|
2018-05-25 15:56:04 +01:00
|
|
|
|
2024-07-08 18:16:39 -07:00
|
|
|
for( PCB_LAYER_ID layerID : aLayers.UIOrder() )
|
2018-05-25 15:56:04 +01:00
|
|
|
{
|
2019-10-28 10:15:03 +01:00
|
|
|
wxString layerName = board->GetLayerName( layerID );
|
2020-08-09 00:23:11 +01:00
|
|
|
|
2019-10-28 10:15:03 +01:00
|
|
|
if( aFpEditorMode && layerID == In1_Cu )
|
|
|
|
layerName = _( "Inner layers" );
|
2018-05-25 15:56:04 +01:00
|
|
|
|
|
|
|
// wxCOL_WIDTH_AUTOSIZE doesn't work on all platforms, so we calculate width here
|
2020-10-25 12:41:38 -04:00
|
|
|
textWidth = std::max( textWidth, KIUI::GetTextSize( layerName, aList ).x );
|
2018-05-25 15:56:04 +01:00
|
|
|
|
2020-05-16 13:15:43 -04:00
|
|
|
COLOR4D layerColor = aFrame->GetColorSettings()->GetColor( layerID );
|
2020-08-17 13:55:56 +01:00
|
|
|
auto bitmap = COLOR_SWATCH::MakeBitmap( layerColor, backgroundColor, LAYER_BITMAP_SIZE,
|
2020-08-18 13:03:03 +01:00
|
|
|
CHECKERBOARD_SIZE, aList->GetBackgroundColour() );
|
2018-05-25 15:56:04 +01:00
|
|
|
wxIcon icon;
|
|
|
|
icon.CopyFromBitmap( bitmap );
|
|
|
|
|
|
|
|
wxVector<wxVariant> row;
|
|
|
|
row.push_back( wxVariant( m_Layers.test( layerID ) ) );
|
|
|
|
row.push_back( wxVariant( wxDataViewIconText( layerName, icon ) ) );
|
2022-02-04 22:44:59 +00:00
|
|
|
row.push_back( wxVariant( wxString::Format( wxT( "%i" ), layerID ) ) );
|
2018-05-25 15:56:04 +01:00
|
|
|
aList->AppendItem( row );
|
|
|
|
|
2020-06-23 22:19:08 -04:00
|
|
|
if( m_Layers.test( layerID ) )
|
2018-05-25 15:56:04 +01:00
|
|
|
aList->SetToggleValue( true, (unsigned) aList->GetItemCount() - 1, 0 );
|
|
|
|
}
|
|
|
|
|
2024-05-27 01:00:51 +03:00
|
|
|
int checkColSize = aList->FromDIP( 22 );
|
|
|
|
int layerColSize = textWidth + LAYER_BITMAP_SIZE.x + aList->FromDIP( 15 );
|
2022-07-08 11:16:14 -06:00
|
|
|
|
2018-05-25 15:56:04 +01:00
|
|
|
// You'd think the fact that m_layers is a list would encourage wxWidgets not to save room
|
|
|
|
// for the tree expanders... but you'd be wrong. Force indent to 0.
|
|
|
|
aList->SetIndent( 0 );
|
2024-05-27 01:00:51 +03:00
|
|
|
aList->SetMinClientSize( wxSize( checkColSize + layerColSize,
|
2022-07-08 11:16:14 -06:00
|
|
|
aList->GetMinClientSize().y ) );
|
2018-07-21 23:17:46 +01:00
|
|
|
|
2018-07-22 11:17:35 +01:00
|
|
|
checkColumn->SetWidth( checkColSize );
|
|
|
|
layerColumn->SetWidth( layerColSize );
|
2018-05-25 15:56:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|