mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-14 14:09:35 +00:00
Make target length sticky within a session.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18109
This commit is contained in:
parent
a7d493a6a5
commit
937854c577
pcbnew
@ -24,6 +24,10 @@
|
||||
#include <drc/drc_engine.h>
|
||||
|
||||
|
||||
long long int g_lastTargetLength = PNS::MEANDER_SETTINGS::LENGTH_UNCONSTRAINED;
|
||||
int g_lastTargetSkew = 0;
|
||||
|
||||
|
||||
DIALOG_TUNING_PATTERN_PROPERTIES::DIALOG_TUNING_PATTERN_PROPERTIES( PCB_BASE_EDIT_FRAME* aFrame,
|
||||
PNS::MEANDER_SETTINGS& aSettings,
|
||||
PNS::ROUTER_MODE aMeanderType,
|
||||
@ -63,6 +67,8 @@ DIALOG_TUNING_PATTERN_PROPERTIES::DIALOG_TUNING_PATTERN_PROPERTIES( PCB_BASE_EDI
|
||||
GetSizer()->SetSizeHints( this );
|
||||
SetupStandardButtons();
|
||||
|
||||
SetInitialFocus( m_targetLengthCtrl );
|
||||
|
||||
GetSizer()->SetSizeHints( this );
|
||||
Centre();
|
||||
}
|
||||
@ -71,12 +77,25 @@ DIALOG_TUNING_PATTERN_PROPERTIES::DIALOG_TUNING_PATTERN_PROPERTIES( PCB_BASE_EDI
|
||||
bool DIALOG_TUNING_PATTERN_PROPERTIES::TransferDataToWindow()
|
||||
{
|
||||
if( m_mode == PNS::PNS_MODE_TUNE_DIFF_PAIR_SKEW )
|
||||
{
|
||||
m_targetLength.SetValue( m_settings.m_targetSkew.Opt() );
|
||||
|
||||
if( m_targetLength.GetValue() == PNS::MEANDER_SETTINGS::SKEW_UNCONSTRAINED )
|
||||
m_targetLength.SetValue( g_lastTargetSkew );
|
||||
|
||||
if( m_targetLength.GetValue() == PNS::MEANDER_SETTINGS::SKEW_UNCONSTRAINED )
|
||||
m_targetLengthCtrl->SetValue( wxEmptyString );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_targetLength.SetValue( m_settings.m_targetLength.Opt() );
|
||||
|
||||
if( m_targetLength.GetValue() == std::numeric_limits<int>::max() )
|
||||
m_targetLengthCtrl->SetValue( wxEmptyString );
|
||||
if( m_targetLength.GetValue() == PNS::MEANDER_SETTINGS::LENGTH_UNCONSTRAINED )
|
||||
m_targetLength.SetValue( g_lastTargetLength );
|
||||
|
||||
if( m_targetLength.GetValue() == PNS::MEANDER_SETTINGS::LENGTH_UNCONSTRAINED )
|
||||
m_targetLength.SetValue( wxEmptyString );
|
||||
}
|
||||
|
||||
m_overrideCustomRules->SetValue( m_settings.m_overrideCustomRules );
|
||||
|
||||
@ -100,22 +119,29 @@ bool DIALOG_TUNING_PATTERN_PROPERTIES::TransferDataToWindow()
|
||||
|
||||
bool DIALOG_TUNING_PATTERN_PROPERTIES::TransferDataFromWindow()
|
||||
{
|
||||
if(! m_targetLengthCtrl->GetValue().IsEmpty() )
|
||||
if( m_mode == PNS::PNS_MODE_TUNE_DIFF_PAIR_SKEW )
|
||||
{
|
||||
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();
|
||||
}
|
||||
if( m_targetLengthCtrl->GetValue().IsEmpty() )
|
||||
g_lastTargetSkew = PNS::MEANDER_SETTINGS::SKEW_UNCONSTRAINED;
|
||||
else
|
||||
{
|
||||
if( m_targetLength.GetValue() != m_constraint.GetValue().Opt() )
|
||||
m_settings.SetTargetLength( m_targetLength.GetValue() );
|
||||
else
|
||||
m_settings.SetTargetLength( m_constraint.GetValue() );
|
||||
}
|
||||
g_lastTargetSkew = m_targetLength.GetIntValue();
|
||||
|
||||
if( g_lastTargetSkew != m_constraint.GetValue().Opt() )
|
||||
m_settings.SetTargetSkew( g_lastTargetSkew );
|
||||
else
|
||||
m_settings.m_targetSkew = m_constraint.GetValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_targetLengthCtrl->GetValue().IsEmpty() )
|
||||
g_lastTargetLength = PNS::MEANDER_SETTINGS::LENGTH_UNCONSTRAINED;
|
||||
else
|
||||
g_lastTargetLength = m_targetLength.GetIntValue();
|
||||
|
||||
if( g_lastTargetLength != m_constraint.GetValue().Opt() )
|
||||
m_settings.SetTargetLength( g_lastTargetLength );
|
||||
else
|
||||
m_settings.SetTargetLength( m_constraint.GetValue() );
|
||||
}
|
||||
|
||||
m_settings.m_overrideCustomRules = m_overrideCustomRules->GetValue();
|
||||
|
@ -30,6 +30,7 @@ namespace PNS {
|
||||
|
||||
const long long int MEANDER_SETTINGS::DEFAULT_TOLERANCE( pcbIUScale.mmToIU( 0.1 ) );
|
||||
const long long int MEANDER_SETTINGS::LENGTH_UNCONSTRAINED( 1000000 * pcbIUScale.IU_PER_MM );
|
||||
const int MEANDER_SETTINGS::SKEW_UNCONSTRAINED( std::numeric_limits<int>::max() );
|
||||
|
||||
|
||||
MEANDER_SETTINGS::MEANDER_SETTINGS()
|
||||
@ -55,7 +56,7 @@ void MEANDER_SETTINGS::SetTargetLength( long long int aOpt )
|
||||
{
|
||||
m_targetLength.SetOpt( aOpt );
|
||||
|
||||
if( aOpt == std::numeric_limits<long long int>::max() )
|
||||
if( aOpt == PNS::MEANDER_SETTINGS::LENGTH_UNCONSTRAINED )
|
||||
{
|
||||
m_targetLength.SetMin( 0 );
|
||||
m_targetLength.SetMax( aOpt );
|
||||
@ -84,7 +85,7 @@ void MEANDER_SETTINGS::SetTargetSkew( int aOpt )
|
||||
{
|
||||
m_targetSkew.SetOpt( aOpt );
|
||||
|
||||
if( aOpt == std::numeric_limits<int>::max() )
|
||||
if( aOpt == PNS::MEANDER_SETTINGS::SKEW_UNCONSTRAINED )
|
||||
{
|
||||
m_targetSkew.SetMin( 0 );
|
||||
m_targetSkew.SetMax( aOpt );
|
||||
|
@ -69,6 +69,7 @@ class MEANDER_SETTINGS
|
||||
public:
|
||||
static const long long int DEFAULT_TOLERANCE;
|
||||
static const long long int LENGTH_UNCONSTRAINED;
|
||||
static const int SKEW_UNCONSTRAINED;
|
||||
|
||||
MEANDER_SETTINGS();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user