ADDED: support for editing target length in Meander Properties dialog.

Also supports overriding the custom rules.
This commit is contained in:
Jeff Young 2023-10-11 11:48:43 +01:00
parent e3c491424b
commit d04641c868
8 changed files with 816 additions and 504 deletions

View File

@ -18,15 +18,20 @@
*/
#include "dialog_meander_properties.h"
#include <router/pns_meander_placer.h>
#include <widgets/text_ctrl_eval.h>
#include <bitmaps.h>
#include <eda_draw_frame.h>
#include <pcb_base_edit_frame.h>
#include <board_design_settings.h>
#include <drc/drc_engine.h>
DIALOG_MEANDER_PROPERTIES::DIALOG_MEANDER_PROPERTIES( EDA_DRAW_FRAME* aFrame,
DIALOG_MEANDER_PROPERTIES::DIALOG_MEANDER_PROPERTIES( PCB_BASE_EDIT_FRAME* aFrame,
PNS::MEANDER_SETTINGS& aSettings,
PNS::ROUTER_MODE aMeanderType ) :
PNS::ROUTER_MODE aMeanderType,
const DRC_CONSTRAINT& aConstraint ) :
DIALOG_MEANDER_PROPERTIES_BASE( aFrame ),
m_frame( aFrame ),
m_constraint( aConstraint ),
m_targetLength( aFrame, m_targetLengthLabel, m_targetLengthCtrl, m_targetLengthUnits ),
m_minA( aFrame, m_track_minALabel, m_minACtrl, m_minAUnits ),
m_maxA( aFrame, m_maxALabel, m_maxACtrl, m_maxAUnits ),
m_spacing( aFrame, m_spacingLabel, m_spacingCtrl, m_spacingUnits ),
@ -55,16 +60,26 @@ DIALOG_MEANDER_PROPERTIES::DIALOG_MEANDER_PROPERTIES( EDA_DRAW_FRAME* aFrame,
}
// Bitmap has a new size, so recalculate sizes
GetSizer()->SetSizeHints(this);
GetSizer()->SetSizeHints( this );
SetupStandardButtons();
GetSizer()->SetSizeHints(this);
GetSizer()->SetSizeHints( this );
Centre();
}
bool DIALOG_MEANDER_PROPERTIES::TransferDataToWindow()
{
m_targetLength.SetValue( m_settings.m_targetLength );
m_overrideCustomRules->SetValue( m_settings.m_overrideCustomRules );
m_targetLength.Enable( m_constraint.IsNull() || m_settings.m_overrideCustomRules );
if( !m_constraint.IsNull() )
m_sourceInfo->SetLabel( wxString::Format( _( "(from %s)" ), m_constraint.GetName() ) );
m_sourceInfo->Show( !m_constraint.IsNull() && !m_settings.m_overrideCustomRules );
m_minA.SetValue( m_settings.m_minAmplitude );
m_maxA.SetValue( m_settings.m_maxAmplitude );
m_spacing.SetValue( m_settings.m_spacing );
@ -78,13 +93,32 @@ bool DIALOG_MEANDER_PROPERTIES::TransferDataToWindow()
bool DIALOG_MEANDER_PROPERTIES::TransferDataFromWindow()
{
m_settings.m_targetLength = m_targetLength.GetValue();
m_settings.m_overrideCustomRules = m_overrideCustomRules->GetValue();
m_settings.m_minAmplitude = m_minA.GetIntValue();
m_settings.m_maxAmplitude = m_maxA.GetIntValue();
m_settings.m_spacing = m_spacing.GetIntValue();
m_settings.m_cornerStyle = m_cornerCtrl->GetSelection() ? PNS::MEANDER_STYLE_ROUND
: PNS::MEANDER_STYLE_CHAMFER;
m_settings.m_cornerRadiusPercentage = m_r.GetValue();
m_settings.m_cornerRadiusPercentage = m_r.GetIntValue();
m_settings.m_singleSided = m_singleSided->GetValue();
return true;
}
void DIALOG_MEANDER_PROPERTIES::onOverrideCustomRules( wxCommandEvent& event )
{
m_targetLength.Enable( event.IsChecked() || m_constraint.IsNull() );
if( !event.IsChecked() && !m_constraint.IsNull() )
{
m_targetLength.SetValue( m_constraint.GetValue().Opt() );
m_sourceInfo->Show( true );
}
else
{
m_sourceInfo->Show( false );
}
}

View File

@ -32,17 +32,27 @@ class MEANDER_SETTINGS;
}
class PCB_BASE_EDIT_FRAME;
class DRC_CONSTRAINT;
class DIALOG_MEANDER_PROPERTIES : public DIALOG_MEANDER_PROPERTIES_BASE
{
public:
DIALOG_MEANDER_PROPERTIES( EDA_DRAW_FRAME* aParent, PNS::MEANDER_SETTINGS& aSettings,
PNS::ROUTER_MODE aMeanderType );
DIALOG_MEANDER_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, PNS::MEANDER_SETTINGS& aSettings,
PNS::ROUTER_MODE aMeanderType, const DRC_CONSTRAINT& aConstraint );
private:
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
void onOverrideCustomRules( wxCommandEvent& event ) override;
private:
PCB_BASE_EDIT_FRAME* m_frame;
const DRC_CONSTRAINT& m_constraint;
UNIT_BINDER m_targetLength;
UNIT_BINDER m_minA;
UNIT_BINDER m_maxA;
UNIT_BINDER m_spacing;

View File

@ -5,8 +5,6 @@
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "widgets/text_ctrl_eval.h"
#include "dialog_meander_properties_base.h"
///////////////////////////////////////////////////////////////////////////
@ -24,115 +22,94 @@ DIALOG_MEANDER_PROPERTIES_BASE::DIALOG_MEANDER_PROPERTIES_BASE( wxWindow* parent
m_legend = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
singleTrackSizer->Add( m_legend, 0, wxEXPAND|wxRIGHT|wxLEFT, 15 );
wxFlexGridSizer* fgSizer31;
fgSizer31 = new wxFlexGridSizer( 0, 5, 5, 5 );
fgSizer31->AddGrowableCol( 1 );
fgSizer31->SetFlexibleDirection( wxBOTH );
fgSizer31->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
wxGridBagSizer* gbSizer1;
gbSizer1 = new wxGridBagSizer( 4, 4 );
gbSizer1->SetFlexibleDirection( wxBOTH );
gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
gbSizer1->SetEmptyCellSize( wxSize( 10,8 ) );
m_targetLengthLabel = new wxStaticText( this, wxID_ANY, _("Target length:"), wxDefaultPosition, wxDefaultSize, 0 );
m_targetLengthLabel->Wrap( -1 );
gbSizer1->Add( m_targetLengthLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_targetLengthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_targetLengthCtrl, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_targetLengthUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_targetLengthUnits->Wrap( -1 );
gbSizer1->Add( m_targetLengthUnits, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_overrideCustomRules = new wxCheckBox( this, wxID_ANY, _("Override custom rules"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_overrideCustomRules, wxGBPosition( 0, 4 ), wxGBSpan( 1, 3 ), wxALIGN_CENTER_VERTICAL, 5 );
m_sourceInfo = new wxStaticText( this, wxID_ANY, _("(from 'rule name')"), wxDefaultPosition, wxDefaultSize, 0 );
m_sourceInfo->Wrap( -1 );
gbSizer1->Add( m_sourceInfo, wxGBPosition( 1, 1 ), wxGBSpan( 1, 6 ), wxALIGN_CENTER_VERTICAL, 5 );
m_track_minALabel = new wxStaticText( this, wxID_ANY, _("Amplitude (A) min:"), wxDefaultPosition, wxDefaultSize, 0 );
m_track_minALabel->Wrap( -1 );
fgSizer31->Add( m_track_minALabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bSizer8;
bSizer8 = new wxBoxSizer( wxHORIZONTAL );
gbSizer1->Add( m_track_minALabel, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_minACtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizer8->Add( m_minACtrl, 1, 0, 5 );
gbSizer1->Add( m_minACtrl, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_minAUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_minAUnits->Wrap( -1 );
bSizer8->Add( m_minAUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
fgSizer31->Add( bSizer8, 1, wxEXPAND, 5 );
gbSizer1->Add( m_minAUnits, wxGBPosition( 4, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_maxALabel = new wxStaticText( this, wxID_ANY, _("Max:"), wxDefaultPosition, wxDefaultSize, 0 );
m_maxALabel->Wrap( -1 );
fgSizer31->Add( m_maxALabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 15 );
gbSizer1->Add( m_maxALabel, wxGBPosition( 4, 4 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_maxACtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer31->Add( m_maxACtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
gbSizer1->Add( m_maxACtrl, wxGBPosition( 4, 5 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_maxAUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_maxAUnits->Wrap( -1 );
fgSizer31->Add( m_maxAUnits, 0, wxALIGN_CENTER_VERTICAL, 5 );
gbSizer1->Add( m_maxAUnits, wxGBPosition( 4, 6 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_spacingLabel = new wxStaticText( this, wxID_ANY, _("Spacing (s):"), wxDefaultPosition, wxDefaultSize, 0 );
m_spacingLabel->Wrap( -1 );
fgSizer31->Add( m_spacingLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bSizer9;
bSizer9 = new wxBoxSizer( wxHORIZONTAL );
gbSizer1->Add( m_spacingLabel, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_spacingCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_spacingCtrl->SetToolTip( _("Minimum spacing between adjacent meander segments. The resulting spacing may be greater based on design rules.") );
bSizer9->Add( m_spacingCtrl, 1, wxALIGN_CENTER_VERTICAL, 5 );
gbSizer1->Add( m_spacingCtrl, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_spacingUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_spacingUnits->Wrap( -1 );
bSizer9->Add( m_spacingUnits, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
fgSizer31->Add( bSizer9, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
fgSizer31->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizer31->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizer31->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizer31->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizer31->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizer31->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizer31->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizer31->Add( 0, 5, 1, wxEXPAND, 5 );
gbSizer1->Add( m_spacingUnits, wxGBPosition( 5, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_cornerLabel = new wxStaticText( this, wxID_ANY, _("Corner style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_cornerLabel->Wrap( -1 );
fgSizer31->Add( m_cornerLabel, 1, wxALIGN_CENTER_VERTICAL, 5 );
gbSizer1->Add( m_cornerLabel, wxGBPosition( 7, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
wxString m_cornerCtrlChoices[] = { _("Chamfer"), _("Fillet") };
int m_cornerCtrlNChoices = sizeof( m_cornerCtrlChoices ) / sizeof( wxString );
m_cornerCtrl = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cornerCtrlNChoices, m_cornerCtrlChoices, 0 );
m_cornerCtrl->SetSelection( 0 );
fgSizer31->Add( m_cornerCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
gbSizer1->Add( m_cornerCtrl, wxGBPosition( 7, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
m_rLabel = new wxStaticText( this, wxID_ANY, _("Radius (r):"), wxDefaultPosition, wxDefaultSize, 0 );
m_rLabel->Wrap( -1 );
fgSizer31->Add( m_rLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 15 );
gbSizer1->Add( m_rLabel, wxGBPosition( 7, 4 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_rCtrl = new TEXT_CTRL_EVAL( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer31->Add( m_rCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
m_rCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_rCtrl, wxGBPosition( 7, 5 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_rUnits = new wxStaticText( this, wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 );
m_rUnits->Wrap( -1 );
fgSizer31->Add( m_rUnits, 0, wxALIGN_CENTER_VERTICAL, 5 );
fgSizer31->Add( 0, 0, 1, wxEXPAND, 5 );
gbSizer1->Add( m_rUnits, wxGBPosition( 7, 6 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_singleSided = new wxCheckBox( this, wxID_ANY, _("Single-sided"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer31->Add( m_singleSided, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
gbSizer1->Add( m_singleSided, wxGBPosition( 8, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL, 5 );
fgSizer31->Add( 0, 0, 1, wxEXPAND, 5 );
gbSizer1->AddGrowableCol( 1 );
gbSizer1->AddGrowableCol( 4 );
singleTrackSizer->Add( fgSizer31, 0, wxEXPAND|wxLEFT, 5 );
singleTrackSizer->Add( gbSizer1, 1, wxEXPAND, 5 );
bMainSizer->Add( singleTrackSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
@ -150,8 +127,14 @@ DIALOG_MEANDER_PROPERTIES_BASE::DIALOG_MEANDER_PROPERTIES_BASE( wxWindow* parent
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
// Connect Events
m_overrideCustomRules->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_MEANDER_PROPERTIES_BASE::onOverrideCustomRules ), NULL, this );
}
DIALOG_MEANDER_PROPERTIES_BASE::~DIALOG_MEANDER_PROPERTIES_BASE()
{
// Disconnect Events
m_overrideCustomRules->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_MEANDER_PROPERTIES_BASE::onOverrideCustomRules ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -10,8 +10,6 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class TEXT_CTRL_EVAL;
#include "dialog_shim.h"
#include <wx/bitmap.h>
#include <wx/image.h>
@ -24,9 +22,10 @@ class TEXT_CTRL_EVAL;
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/choice.h>
#include <wx/checkbox.h>
#include <wx/choice.h>
#include <wx/gbsizer.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/dialog.h>
@ -42,6 +41,11 @@ class DIALOG_MEANDER_PROPERTIES_BASE : public DIALOG_SHIM
protected:
wxStaticBitmap* m_legend;
wxStaticText* m_targetLengthLabel;
wxTextCtrl* m_targetLengthCtrl;
wxStaticText* m_targetLengthUnits;
wxCheckBox* m_overrideCustomRules;
wxStaticText* m_sourceInfo;
wxStaticText* m_track_minALabel;
wxTextCtrl* m_minACtrl;
wxStaticText* m_minAUnits;
@ -54,13 +58,17 @@ class DIALOG_MEANDER_PROPERTIES_BASE : public DIALOG_SHIM
wxStaticText* m_cornerLabel;
wxChoice* m_cornerCtrl;
wxStaticText* m_rLabel;
TEXT_CTRL_EVAL* m_rCtrl;
wxTextCtrl* m_rCtrl;
wxStaticText* m_rUnits;
wxCheckBox* m_singleSided;
wxStdDialogButtonSizer* m_stdButtons;
wxButton* m_stdButtonsOK;
wxButton* m_stdButtonsCancel;
// Virtual event handlers, override them in your derived class
virtual void onOverrideCustomRules( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_MEANDER_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Meander Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020-2022 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2020-2023 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -21,8 +21,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef DRC_RULE_PROTO_H
#define DRC_RULE_PROTO_H
#ifndef DRC_RULE_H
#define DRC_RULE_H
#include <kiid.h>
#include <core/typeinfo.h>
@ -153,7 +153,7 @@ class DRC_CONSTRAINT
if( m_parentRule->m_Implicit )
return m_parentRule->m_Name;
else
return wxString::Format( _( "rule %s" ), m_parentRule->m_Name );
return wxString::Format( _( "rule '%s'" ), m_parentRule->m_Name );
}
return m_name;

View File

@ -241,10 +241,12 @@ public:
return nullptr;
meander->m_targetLength = dlg.GetValue();
meander->m_overrideCustomRules = true;
}
else
{
meander->m_targetLength = constraint.GetValue().Opt();
meander->m_overrideCustomRules = false;
}
meander->SetFlags( IS_NEW );
@ -536,6 +538,7 @@ public:
settings.m_spacing = m_spacing;
settings.m_targetLength = m_targetLength;
settings.m_targetSkew = m_targetSkew;
settings.m_overrideCustomRules = m_overrideCustomRules;
settings.m_singleSided = m_singleSide;
settings.m_segmentSide = m_initialSide;
settings.m_cornerRadiusPercentage = m_cornerRadiusPercentage;
@ -551,6 +554,7 @@ public:
m_spacing = aSettings.m_spacing;
m_targetLength = aSettings.m_targetLength;
m_targetSkew = aSettings.m_targetSkew;
m_overrideCustomRules = aSettings.m_overrideCustomRules;
m_singleSide = aSettings.m_singleSided;
m_initialSide = aSettings.m_segmentSide;
m_cornerRadiusPercentage = aSettings.m_cornerRadiusPercentage;
@ -560,13 +564,10 @@ public:
{
switch( m_tuningMode )
{
case LENGTH_TUNING_MODE::SINGLE: return PNS::PNS_MODE_TUNE_SINGLE;
case LENGTH_TUNING_MODE::DIFF_PAIR: return PNS::PNS_MODE_TUNE_DIFF_PAIR;
case LENGTH_TUNING_MODE::SINGLE: return PNS::PNS_MODE_TUNE_SINGLE;
case LENGTH_TUNING_MODE::DIFF_PAIR: return PNS::PNS_MODE_TUNE_DIFF_PAIR;
case LENGTH_TUNING_MODE::DIFF_PAIR_SKEW: return PNS::PNS_MODE_TUNE_DIFF_PAIR_SKEW;
default: return PNS::PNS_MODE_TUNE_SINGLE;
default: return PNS::PNS_MODE_TUNE_SINGLE;
}
}
@ -965,6 +966,9 @@ public:
int GetTargetSkew() const { return m_targetSkew; }
void SetTargetSkew( int aValue ) { m_targetSkew = aValue; }
bool GetOverrideCustomRules() const { return m_overrideCustomRules; }
void SetOverrideCustomRules( bool aOverride ) { m_overrideCustomRules = aOverride; }
int GetCornerRadiusPercentage() const { return m_cornerRadiusPercentage; }
void SetCornerRadiusPercentage( int aValue ) { m_cornerRadiusPercentage = aValue; }
@ -1002,6 +1006,7 @@ public:
props.set( "last_netname", m_lastNetName );
props.set( "last_tuning", m_tuningInfo );
props.set( "override_custom_rules", m_overrideCustomRules );
if( m_baseLine )
props.set( "base_line", wxAny( *m_baseLine ) );
@ -1035,6 +1040,7 @@ public:
aProps.get_to_iu( "min_spacing", m_spacing );
aProps.get_to_iu( "target_length", m_targetLength );
aProps.get_to_iu( "target_skew", m_targetSkew );
aProps.get_to( "override_custom_rules", m_overrideCustomRules );
aProps.get_to( "last_netname", m_lastNetName );
aProps.get_to( "last_tuning", m_tuningInfo );
@ -1046,8 +1052,20 @@ public:
void ShowPropertiesDialog( PCB_BASE_EDIT_FRAME* aEditFrame ) override
{
PNS::MEANDER_SETTINGS settings = ToMeanderSettings();
DRC_CONSTRAINT constraint;
DIALOG_MEANDER_PROPERTIES dlg( aEditFrame, settings, ToPNSMode() );
if( !m_items.empty() )
{
BOARD_ITEM* startItem = *m_items.begin();
std::shared_ptr<DRC_ENGINE>& drcEngine = GetBoard()->GetDesignSettings().m_DRCEngine;
constraint = drcEngine->EvalRules( LENGTH_CONSTRAINT, startItem, nullptr, GetLayer() );
if( !constraint.IsNull() && !settings.m_overrideCustomRules )
settings.m_targetLength = constraint.GetValue().Opt();
}
DIALOG_MEANDER_PROPERTIES dlg( aEditFrame, settings, ToPNSMode(), constraint );
if( dlg.ShowModal() == wxID_OK )
{
@ -1107,16 +1125,17 @@ public:
}
protected:
VECTOR2I m_end;
VECTOR2I m_end;
int m_minAmplitude;
int m_maxAmplitude;
int m_spacing;
int m_targetLength;
int m_targetSkew;
int m_cornerRadiusPercentage;
int m_minAmplitude;
int m_maxAmplitude;
int m_spacing;
int m_targetLength;
int m_targetSkew;
bool m_overrideCustomRules;
int m_cornerRadiusPercentage;
PNS::MEANDER_SIDE m_initialSide;
PNS::MEANDER_SIDE m_initialSide;
std::optional<SHAPE_LINE_CHAIN> m_baseLine;
@ -1371,6 +1390,12 @@ static struct PCB_GENERATOR_MEANDERS_DESC
PROPERTY_DISPLAY::PT_SIZE, ORIGIN_TRANSFORMS::ABS_X_COORD ),
groupTab );
propMgr.AddProperty( new PROPERTY<PCB_GENERATOR_MEANDERS, bool>(
_HKI( "Override custom rules" ),
&PCB_GENERATOR_MEANDERS::SetOverrideCustomRules,
&PCB_GENERATOR_MEANDERS::GetOverrideCustomRules ),
groupTab );
propMgr.AddProperty( new PROPERTY<PCB_GENERATOR_MEANDERS, bool>(
_HKI( "Single-sided" ),
&PCB_GENERATOR_MEANDERS::SetSingleSided,

View File

@ -76,6 +76,7 @@ public:
m_spacing = 600000;
m_targetLength = 100000000;
m_targetSkew = 0;
m_overrideCustomRules = false;
m_cornerStyle = MEANDER_STYLE_ROUND;
m_cornerRadiusPercentage = 100;
m_singleSided = false;
@ -101,6 +102,11 @@ public:
///< Desired length of the tuned line/diff pair (this is in nm, so allow more than board width).
long long int m_targetLength;
///< Target skew value for diff pair de-skewing.
int m_targetSkew;
bool m_overrideCustomRules;
///< Type of corners for the meandered line.
MEANDER_STYLE m_cornerStyle;
@ -115,9 +121,6 @@ public:
///< Allowable tuning error.
int m_lengthTolerance;
///< Target skew value for diff pair de-skewing.
int m_targetSkew;
};
/**