Make length-tuning rollover layer-specific.

Also don't show target length in diaog when it hasn't been
set.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16379
This commit is contained in:
Jeff Young 2023-12-30 20:27:03 +00:00
parent b94c941217
commit 2e02ca9d14
2 changed files with 35 additions and 18 deletions

View File

@ -75,6 +75,9 @@ bool DIALOG_TUNING_PATTERN_PROPERTIES::TransferDataToWindow()
else
m_targetLength.SetValue( m_settings.m_targetLength.Opt() );
if( m_targetLength.GetValue() == std::numeric_limits<int>::max() )
m_targetLengthCtrl->SetValue( wxEmptyString );
m_overrideCustomRules->SetValue( m_settings.m_overrideCustomRules );
m_targetLength.Enable( m_constraint.IsNull() || m_settings.m_overrideCustomRules );
@ -97,19 +100,22 @@ bool DIALOG_TUNING_PATTERN_PROPERTIES::TransferDataToWindow()
bool DIALOG_TUNING_PATTERN_PROPERTIES::TransferDataFromWindow()
{
if( m_mode == PNS::PNS_MODE_TUNE_DIFF_PAIR_SKEW )
if(! m_targetLengthCtrl->GetValue().IsEmpty() )
{
if( m_targetLength.GetValue() != m_constraint.GetValue().Opt() )
m_settings.SetTargetSkew( m_targetLength.GetValue() );
if( m_mode == PNS::PNS_MODE_TUNE_DIFF_PAIR_SKEW )
{
if( m_targetLength.GetValue() != m_constraint.GetValue().Opt() )
m_settings.SetTargetSkew( m_targetLength.GetValue() );
else
m_settings.m_targetSkew = m_constraint.GetValue();
}
else
m_settings.m_targetSkew = m_constraint.GetValue();
}
else
{
if( m_targetLength.GetValue() != m_constraint.GetValue().Opt() )
m_settings.SetTargetLength( m_targetLength.GetValue() );
else
m_settings.SetTargetLength( m_constraint.GetValue() );
{
if( m_targetLength.GetValue() != m_constraint.GetValue().Opt() )
m_settings.SetTargetLength( m_targetLength.GetValue() );
else
m_settings.SetTargetLength( m_constraint.GetValue() );
}
}
m_settings.m_overrideCustomRules = m_overrideCustomRules->GetValue();

View File

@ -479,24 +479,35 @@ bool TOPOLOGY::AssembleDiffPair( ITEM* aStart, DIFF_PAIR& aPair )
LINE lp = m_world->AssembleLine( startItem );
std::set<ITEM*> coupledItems;
std::vector<ITEM*> pItems;
std::vector<ITEM*> nItems;
for( ITEM* item : lp.Links() )
{
if( item->OfKind( ITEM::SEGMENT_T | ITEM::ARC_T ) && item->Layers() == startItem->Layers() )
pItems.push_back( item );
}
std::set<ITEM*> coupledItems;
m_world->AllItemsInNet( coupledNet, coupledItems );
for( ITEM* item : coupledItems )
{
if( item->OfKind( ITEM::SEGMENT_T | ITEM::ARC_T ) && item->Layers() == startItem->Layers() )
nItems.push_back( item );
}
LINKED_ITEM* refItem = nullptr;
LINKED_ITEM* coupledItem = nullptr;
SEG::ecoord minDist_sq = std::numeric_limits<SEG::ecoord>::max();
for( ITEM* p_item : lp.Links() )
for( ITEM* p_item : pItems )
{
if( !p_item->OfKind( ITEM::SEGMENT_T | ITEM::ARC_T ) )
continue;
for( ITEM* n_item : coupledItems )
for( ITEM* n_item : nItems )
{
SEG::ecoord dist_sq = std::numeric_limits<SEG::ecoord>::max();
if( n_item->Kind() != p_item->Kind() || n_item->Layers() == p_item->Layers() )
if( n_item->Kind() != p_item->Kind() )
continue;
if( p_item->Kind() == ITEM::SEGMENT_T )