Make sure Use-Netclasses checkbox gets set when loading dialog.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16110
This commit is contained in:
parent
b108e7058b
commit
21d53d0b86
|
@ -101,6 +101,8 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
|||
|
||||
bool nets = false;
|
||||
int net = 0;
|
||||
bool tracksMatchNetclassValues = true;
|
||||
bool viasMatchNetclassValues = true;
|
||||
bool hasLocked = false;
|
||||
bool hasUnlocked = false;
|
||||
|
||||
|
@ -176,6 +178,16 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
|||
track_selection_layer = UNDEFINED_LAYER;
|
||||
}
|
||||
|
||||
if( tracksMatchNetclassValues )
|
||||
{
|
||||
MINOPTMAX<int> constraint = t->GetWidthConstraint();
|
||||
|
||||
if( constraint.HasOpt() )
|
||||
tracksMatchNetclassValues &= constraint.Opt() == t->GetWidth();
|
||||
else if( constraint.Min() > 0 )
|
||||
tracksMatchNetclassValues &= constraint.Min() == t->GetWidth();
|
||||
}
|
||||
|
||||
if( t->IsLocked() )
|
||||
hasLocked = true;
|
||||
else
|
||||
|
@ -273,6 +285,23 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
|||
}
|
||||
}
|
||||
|
||||
if( viasMatchNetclassValues )
|
||||
{
|
||||
MINOPTMAX<int> constraint = v->GetWidthConstraint();
|
||||
|
||||
if( constraint.HasOpt() )
|
||||
viasMatchNetclassValues &= constraint.Opt() == v->GetWidth();
|
||||
else if( constraint.Min() > 0 )
|
||||
viasMatchNetclassValues &= constraint.Min() == v->GetWidth();
|
||||
|
||||
constraint = v->GetDrillConstraint();
|
||||
|
||||
if( constraint.HasOpt() )
|
||||
viasMatchNetclassValues &= constraint.Opt() == v->GetDrillValue();
|
||||
else if( constraint.Min() > 0 )
|
||||
viasMatchNetclassValues &= constraint.Min() == v->GetDrillValue();
|
||||
}
|
||||
|
||||
if( v->IsLocked() )
|
||||
hasLocked = true;
|
||||
else
|
||||
|
@ -349,26 +378,39 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
|||
|
||||
m_DesignRuleViasUnit->SetLabel( EDA_UNIT_UTILS::GetLabel( m_frame->GetUserUnits() ) );
|
||||
|
||||
int viaSelection = wxNOT_FOUND;
|
||||
|
||||
// 0 is the netclass place-holder
|
||||
for( unsigned ii = 1; ii < aParent->GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
|
||||
if( viasMatchNetclassValues )
|
||||
{
|
||||
VIA_DIMENSION* viaDimension = &aParent->GetDesignSettings().m_ViasDimensionsList[ii];
|
||||
wxString msg = m_frame->StringFromValue( viaDimension->m_Diameter )
|
||||
+ wxT( " / " )
|
||||
+ m_frame->StringFromValue( viaDimension->m_Drill );
|
||||
m_DesignRuleViasCtrl->Append( msg, viaDimension );
|
||||
m_viaDesignRules->SetValue( true );
|
||||
|
||||
if( viaSelection == wxNOT_FOUND
|
||||
&& m_viaDiameter.GetValue() == viaDimension->m_Diameter
|
||||
&& m_viaDrill.GetValue() == viaDimension->m_Drill )
|
||||
{
|
||||
viaSelection = ii - 1;
|
||||
}
|
||||
m_DesignRuleVias->Enable( false );
|
||||
m_DesignRuleViasCtrl->Enable( false );
|
||||
m_DesignRuleViasUnit->Enable( false );
|
||||
m_viaDiameter.Enable( false );
|
||||
m_viaDrill.Enable( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
int viaSelection = wxNOT_FOUND;
|
||||
|
||||
m_DesignRuleViasCtrl->SetSelection( viaSelection );
|
||||
// 0 is the netclass place-holder
|
||||
for( unsigned ii = 1; ii < aParent->GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
|
||||
{
|
||||
VIA_DIMENSION* viaDimension = &aParent->GetDesignSettings().m_ViasDimensionsList[ii];
|
||||
wxString msg = m_frame->StringFromValue( viaDimension->m_Diameter )
|
||||
+ wxT( " / " )
|
||||
+ m_frame->StringFromValue( viaDimension->m_Drill );
|
||||
m_DesignRuleViasCtrl->Append( msg, viaDimension );
|
||||
|
||||
if( viaSelection == wxNOT_FOUND
|
||||
&& m_viaDiameter.GetValue() == viaDimension->m_Diameter
|
||||
&& m_viaDrill.GetValue() == viaDimension->m_Drill )
|
||||
{
|
||||
viaSelection = ii - 1;
|
||||
}
|
||||
}
|
||||
|
||||
m_DesignRuleViasCtrl->SetSelection( viaSelection );
|
||||
}
|
||||
|
||||
m_ViaTypeChoice->Enable();
|
||||
|
||||
|
@ -396,20 +438,32 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
|||
{
|
||||
m_DesignRuleWidthsUnits->SetLabel( EDA_UNIT_UTILS::GetLabel( m_frame->GetUserUnits() ) );
|
||||
|
||||
int widthSelection = wxNOT_FOUND;
|
||||
|
||||
// 0 is the netclass place-holder
|
||||
for( unsigned ii = 1; ii < aParent->GetDesignSettings().m_TrackWidthList.size(); ii++ )
|
||||
if( tracksMatchNetclassValues )
|
||||
{
|
||||
int width = aParent->GetDesignSettings().m_TrackWidthList[ii];
|
||||
wxString msg = m_frame->StringFromValue( width );
|
||||
m_DesignRuleWidthsCtrl->Append( msg );
|
||||
m_trackDesignRules->SetValue( true );
|
||||
|
||||
if( widthSelection == wxNOT_FOUND && m_trackWidth.GetValue() == width )
|
||||
widthSelection = ii - 1;
|
||||
m_DesignRuleWidths->Enable( false );
|
||||
m_DesignRuleWidthsCtrl->Enable( false );
|
||||
m_DesignRuleWidthsUnits->Enable( false );
|
||||
m_trackWidth.Enable( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
int widthSelection = wxNOT_FOUND;
|
||||
|
||||
m_DesignRuleWidthsCtrl->SetSelection( widthSelection );
|
||||
// 0 is the netclass place-holder
|
||||
for( unsigned ii = 1; ii < aParent->GetDesignSettings().m_TrackWidthList.size(); ii++ )
|
||||
{
|
||||
int width = aParent->GetDesignSettings().m_TrackWidthList[ii];
|
||||
wxString msg = m_frame->StringFromValue( width );
|
||||
m_DesignRuleWidthsCtrl->Append( msg );
|
||||
|
||||
if( widthSelection == wxNOT_FOUND && m_trackWidth.GetValue() == width )
|
||||
widthSelection = ii - 1;
|
||||
}
|
||||
|
||||
m_DesignRuleWidthsCtrl->SetSelection( widthSelection );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -320,6 +320,24 @@ MINOPTMAX<int> PCB_TRACK::GetWidthConstraint( wxString* aSource ) const
|
|||
}
|
||||
|
||||
|
||||
MINOPTMAX<int> PCB_VIA::GetWidthConstraint( wxString* aSource ) const
|
||||
{
|
||||
DRC_CONSTRAINT constraint;
|
||||
|
||||
if( GetBoard() && GetBoard()->GetDesignSettings().m_DRCEngine )
|
||||
{
|
||||
BOARD_DESIGN_SETTINGS& bds = GetBoard()->GetDesignSettings();
|
||||
|
||||
constraint = bds.m_DRCEngine->EvalRules( VIA_DIAMETER_CONSTRAINT, this, nullptr, m_layer );
|
||||
}
|
||||
|
||||
if( aSource )
|
||||
*aSource = constraint.GetName();
|
||||
|
||||
return constraint.Value();
|
||||
}
|
||||
|
||||
|
||||
MINOPTMAX<int> PCB_VIA::GetDrillConstraint( wxString* aSource ) const
|
||||
{
|
||||
DRC_CONSTRAINT constraint;
|
||||
|
|
|
@ -197,7 +197,7 @@ public:
|
|||
*/
|
||||
int GetLocalClearance( wxString* aSource ) const override;
|
||||
|
||||
MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const;
|
||||
virtual MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const;
|
||||
|
||||
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
|
@ -417,6 +417,7 @@ public:
|
|||
|
||||
std::shared_ptr<SHAPE_SEGMENT> GetEffectiveHoleShape() const override;
|
||||
|
||||
MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const override;
|
||||
MINOPTMAX<int> GetDrillConstraint( wxString* aSource = nullptr ) const;
|
||||
|
||||
bool IsTented() const override;
|
||||
|
@ -556,7 +557,7 @@ public:
|
|||
int GetDrill() const { return m_drill; }
|
||||
|
||||
/**
|
||||
* Calculate the drill value for vias (m-Drill if > 0, or default drill value for the board.
|
||||
* Calculate the drill value for vias (m_drill if > 0, or default drill value for the board).
|
||||
*
|
||||
* @return the calculated drill value.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue