Hook up via size & drill constraints to editors.

This commit is contained in:
Jeff Young 2023-10-21 19:10:38 +01:00
parent df46521b25
commit 24a9245f81
11 changed files with 98 additions and 103 deletions

View File

@ -172,8 +172,8 @@ DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE
sbAction->Add( fgSizerTrackViaPopups, 0, wxBOTTOM|wxEXPAND|wxLEFT, 25 ); sbAction->Add( fgSizerTrackViaPopups, 0, wxBOTTOM|wxEXPAND|wxLEFT, 25 );
m_setToNetclassValues = new wxRadioButton( sbAction->GetStaticBox(), ID_SPECIFIED_NET_TO_NETCLASS_VALUES, _("Set to net class / custom rule values"), wxDefaultPosition, wxDefaultSize, 0 ); m_setToDesignRuleValues = new wxRadioButton( sbAction->GetStaticBox(), ID_SPECIFIED_NET_TO_NETCLASS_VALUES, _("Set to net class / custom rule values"), wxDefaultPosition, wxDefaultSize, 0 );
sbAction->Add( m_setToNetclassValues, 0, wxBOTTOM, 5 ); sbAction->Add( m_setToDesignRuleValues, 0, wxBOTTOM, 5 );
bMainSizer->Add( sbAction, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 ); bMainSizer->Add( sbAction, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
@ -198,7 +198,7 @@ DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE
m_trackWidthFilterCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnTrackWidthText ), NULL, this ); m_trackWidthFilterCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnTrackWidthText ), NULL, this );
m_viaSizeFilterCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnViaSizeText ), NULL, this ); m_viaSizeFilterCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnViaSizeText ), NULL, this );
m_setToSpecifiedValues->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::onActionButtonChange ), NULL, this ); m_setToSpecifiedValues->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::onActionButtonChange ), NULL, this );
m_setToNetclassValues->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::onActionButtonChange ), NULL, this ); m_setToDesignRuleValues->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::onActionButtonChange ), NULL, this );
} }
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE() DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE()
@ -209,6 +209,6 @@ DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BAS
m_trackWidthFilterCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnTrackWidthText ), NULL, this ); m_trackWidthFilterCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnTrackWidthText ), NULL, this );
m_viaSizeFilterCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnViaSizeText ), NULL, this ); m_viaSizeFilterCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnViaSizeText ), NULL, this );
m_setToSpecifiedValues->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::onActionButtonChange ), NULL, this ); m_setToSpecifiedValues->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::onActionButtonChange ), NULL, this );
m_setToNetclassValues->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::onActionButtonChange ), NULL, this ); m_setToDesignRuleValues->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::onActionButtonChange ), NULL, this );
} }

View File

@ -1658,7 +1658,7 @@
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">m_setToNetclassValues</property> <property name="name">m_setToDesignRuleValues</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
<property name="pane_position"></property> <property name="pane_position"></property>
<property name="pane_size"></property> <property name="pane_size"></property>

View File

@ -65,7 +65,7 @@ class DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE : public DIALOG_SHIM
wxChoice* m_trackWidthCtrl; wxChoice* m_trackWidthCtrl;
wxChoice* m_viaSizesCtrl; wxChoice* m_viaSizesCtrl;
PCB_LAYER_BOX_SELECTOR* m_layerCtrl; PCB_LAYER_BOX_SELECTOR* m_layerCtrl;
wxRadioButton* m_setToNetclassValues; wxRadioButton* m_setToDesignRuleValues;
wxStdDialogButtonSizer* m_sdbSizer; wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK; wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel; wxButton* m_sdbSizerCancel;

View File

@ -151,7 +151,7 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
m_trackEndX.SetValue( t->GetEnd().x ); m_trackEndX.SetValue( t->GetEnd().x );
m_trackEndY.SetValue( t->GetEnd().y ); m_trackEndY.SetValue( t->GetEnd().y );
m_trackWidth.SetValue( t->GetWidth() ); m_trackWidth.SetValue( t->GetWidth() );
m_trackNetclass->SetValue( false ); m_trackDesignRules->SetValue( false );
track_selection_layer = t->GetLayer(); track_selection_layer = t->GetLayer();
m_tracks = true; m_tracks = true;
} }
@ -597,13 +597,13 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow()
if( !m_trackEndY.IsIndeterminate() ) if( !m_trackEndY.IsIndeterminate() )
t->SetEnd( VECTOR2I( t->GetEnd().x, m_trackEndY.GetIntValue() ) ); t->SetEnd( VECTOR2I( t->GetEnd().x, m_trackEndY.GetIntValue() ) );
if( m_trackNetclass->IsChecked() ) if( m_trackDesignRules->IsChecked() )
{ {
MINOPTMAX<int> constraint = t->GetWidthConstraint(); MINOPTMAX<int> constraint = t->GetWidthConstraint();
if( constraint.HasOpt() ) if( constraint.HasOpt() )
t->SetWidth( constraint.Opt() ); t->SetWidth( constraint.Opt() );
else else if( constraint.Min() > 0 )
t->SetWidth( constraint.Min() ); t->SetWidth( constraint.Min() );
} }
else if( !m_trackWidth.IsIndeterminate() ) else if( !m_trackWidth.IsIndeterminate() )
@ -680,27 +680,21 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow()
v->SanitizeLayers(); v->SanitizeLayers();
if( m_viaNetclass->IsChecked() ) if( m_viaDesignRules->IsChecked() )
{ {
NETCLASS* netclass = v->GetEffectiveNetClass(); MINOPTMAX<int> constraint = v->GetWidthConstraint();
switch( v->GetViaType() ) if( constraint.HasOpt() )
{ v->SetWidth( constraint.Opt() );
default: else if( constraint.Min() > 0 )
wxFAIL_MSG( wxT( "Unhandled via type" ) ); v->SetWidth( constraint.Min() );
KI_FALLTHROUGH;
case VIATYPE::THROUGH: constraint = v->GetDrillConstraint();
case VIATYPE::BLIND_BURIED:
v->SetWidth( netclass->GetViaDiameter() );
v->SetDrill( netclass->GetViaDrill() );
break;
case VIATYPE::MICROVIA: if( constraint.HasOpt() )
v->SetWidth( netclass->GetuViaDiameter() ); v->SetDrill( constraint.Opt() );
v->SetDrill( netclass->GetuViaDrill() ); else if( constraint.Min() > 0 )
break; v->SetDrill( constraint.Min() );
}
} }
else else
{ {

View File

@ -117,9 +117,9 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa
gbSizer1->SetFlexibleDirection( wxBOTH ); gbSizer1->SetFlexibleDirection( wxBOTH );
gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_trackNetclass = new wxCheckBox( m_sbTrackSizer->GetStaticBox(), wxID_ANY, _("Use net class / custom rule widths"), wxDefaultPosition, wxDefaultSize, 0 ); m_trackDesignRules = new wxCheckBox( m_sbTrackSizer->GetStaticBox(), wxID_ANY, _("Use net class / custom rule widths"), wxDefaultPosition, wxDefaultSize, 0 );
m_trackNetclass->SetValue(true); m_trackDesignRules->SetValue(true);
gbSizer1->Add( m_trackNetclass, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxTOP, 1 ); gbSizer1->Add( m_trackDesignRules, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxTOP, 1 );
m_DesignRuleWidths = new wxStaticText( m_sbTrackSizer->GetStaticBox(), wxID_ANY, _("Pre-defined sizes:"), wxDefaultPosition, wxDefaultSize, 0 ); m_DesignRuleWidths = new wxStaticText( m_sbTrackSizer->GetStaticBox(), wxID_ANY, _("Pre-defined sizes:"), wxDefaultPosition, wxDefaultSize, 0 );
m_DesignRuleWidths->Wrap( -1 ); m_DesignRuleWidths->Wrap( -1 );
@ -219,8 +219,8 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa
gbSizer3->SetFlexibleDirection( wxBOTH ); gbSizer3->SetFlexibleDirection( wxBOTH );
gbSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); gbSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_viaNetclass = new wxCheckBox( m_sbViaSizer->GetStaticBox(), wxID_ANY, _("Use net class / custom rule sizes"), wxDefaultPosition, wxDefaultSize, 0 ); m_viaDesignRules = new wxCheckBox( m_sbViaSizer->GetStaticBox(), wxID_ANY, _("Use net class / custom rule sizes"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer3->Add( m_viaNetclass, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxTOP, 1 ); gbSizer3->Add( m_viaDesignRules, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxTOP, 1 );
m_DesignRuleVias = new wxStaticText( m_sbViaSizer->GetStaticBox(), wxID_ANY, _("Pre-defined sizes:"), wxDefaultPosition, wxDefaultSize, 0 ); m_DesignRuleVias = new wxStaticText( m_sbViaSizer->GetStaticBox(), wxID_ANY, _("Pre-defined sizes:"), wxDefaultPosition, wxDefaultSize, 0 );
m_DesignRuleVias->Wrap( -1 ); m_DesignRuleVias->Wrap( -1 );
@ -560,10 +560,10 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa
// Connect Events // Connect Events
m_viaNotFree->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaNotFreeClicked ), NULL, this ); m_viaNotFree->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaNotFreeClicked ), NULL, this );
m_trackNetclass->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onTrackNetclassCheck ), NULL, this ); m_trackDesignRules->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onTrackNetclassCheck ), NULL, this );
m_DesignRuleWidthsCtrl->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onWidthSelect ), NULL, this ); m_DesignRuleWidthsCtrl->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onWidthSelect ), NULL, this );
m_TrackWidthCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onWidthEdit ), NULL, this ); m_TrackWidthCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onWidthEdit ), NULL, this );
m_viaNetclass->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaNetclassCheck ), NULL, this ); m_viaDesignRules->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaNetclassCheck ), NULL, this );
m_DesignRuleViasCtrl->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaSelect ), NULL, this ); m_DesignRuleViasCtrl->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaSelect ), NULL, this );
m_ViaDiameterCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaEdit ), NULL, this ); m_ViaDiameterCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaEdit ), NULL, this );
m_ViaDrillCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaEdit ), NULL, this ); m_ViaDrillCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaEdit ), NULL, this );
@ -597,10 +597,10 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::~DIALOG_TRACK_VIA_PROPERTIES_BASE()
{ {
// Disconnect Events // Disconnect Events
m_viaNotFree->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaNotFreeClicked ), NULL, this ); m_viaNotFree->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaNotFreeClicked ), NULL, this );
m_trackNetclass->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onTrackNetclassCheck ), NULL, this ); m_trackDesignRules->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onTrackNetclassCheck ), NULL, this );
m_DesignRuleWidthsCtrl->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onWidthSelect ), NULL, this ); m_DesignRuleWidthsCtrl->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onWidthSelect ), NULL, this );
m_TrackWidthCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onWidthEdit ), NULL, this ); m_TrackWidthCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onWidthEdit ), NULL, this );
m_viaNetclass->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaNetclassCheck ), NULL, this ); m_viaDesignRules->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaNetclassCheck ), NULL, this );
m_DesignRuleViasCtrl->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaSelect ), NULL, this ); m_DesignRuleViasCtrl->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaSelect ), NULL, this );
m_ViaDiameterCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaEdit ), NULL, this ); m_ViaDiameterCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaEdit ), NULL, this );
m_ViaDrillCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaEdit ), NULL, this ); m_ViaDrillCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaEdit ), NULL, this );

View File

@ -1148,7 +1148,7 @@
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">m_trackNetclass</property> <property name="name">m_trackDesignRules</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
<property name="pane_position"></property> <property name="pane_position"></property>
<property name="pane_size"></property> <property name="pane_size"></property>
@ -2152,7 +2152,7 @@
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">m_viaNetclass</property> <property name="name">m_viaDesignRules</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
<property name="pane_position"></property> <property name="pane_position"></property>
<property name="pane_size"></property> <property name="pane_size"></property>

View File

@ -65,7 +65,7 @@ class DIALOG_TRACK_VIA_PROPERTIES_BASE : public DIALOG_SHIM
wxStaticText* m_TrackEndYLabel; wxStaticText* m_TrackEndYLabel;
wxTextCtrl* m_TrackEndYCtrl; wxTextCtrl* m_TrackEndYCtrl;
wxStaticText* m_TrackEndYUnit; wxStaticText* m_TrackEndYUnit;
wxCheckBox* m_trackNetclass; wxCheckBox* m_trackDesignRules;
wxStaticText* m_DesignRuleWidths; wxStaticText* m_DesignRuleWidths;
wxChoice* m_DesignRuleWidthsCtrl; wxChoice* m_DesignRuleWidthsCtrl;
wxStaticText* m_DesignRuleWidthsUnits; wxStaticText* m_DesignRuleWidthsUnits;
@ -80,7 +80,7 @@ class DIALOG_TRACK_VIA_PROPERTIES_BASE : public DIALOG_SHIM
wxStaticText* m_ViaYLabel; wxStaticText* m_ViaYLabel;
wxTextCtrl* m_ViaYCtrl; wxTextCtrl* m_ViaYCtrl;
wxStaticText* m_ViaYUnit; wxStaticText* m_ViaYUnit;
wxCheckBox* m_viaNetclass; wxCheckBox* m_viaDesignRules;
wxStaticText* m_DesignRuleVias; wxStaticText* m_DesignRuleVias;
wxChoice* m_DesignRuleViasCtrl; wxChoice* m_DesignRuleViasCtrl;
wxStaticText* m_DesignRuleViasUnit; wxStaticText* m_DesignRuleViasUnit;

View File

@ -30,82 +30,63 @@
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <wx/choice.h> #include <wx/choice.h>
void PCB_EDIT_FRAME::SetTrackSegmentWidth( PCB_TRACK* aTrackItem, void PCB_EDIT_FRAME::SetTrackSegmentWidth( PCB_TRACK* aItem, PICKED_ITEMS_LIST* aItemsListPicker,
PICKED_ITEMS_LIST* aItemsListPicker, bool aUseDesignRules )
bool aUseDesignRules )
{ {
int initial_width; PCB_VIA* via = dynamic_cast<PCB_VIA*>( aItem );
int new_width; int new_width = -1;
int initial_drill = -1; int new_drill = -1;
int new_drill = -1;
initial_width = aTrackItem->GetWidth();
if( aUseDesignRules ) if( aUseDesignRules )
{ {
MINOPTMAX<int> constraint = aTrackItem->GetWidthConstraint(); MINOPTMAX<int> constraint = aItem->GetWidthConstraint();
if( constraint.HasOpt() ) if( constraint.HasOpt() )
new_width = constraint.Opt(); new_width = constraint.Opt();
else else if( constraint.Min() > 0 )
new_width = constraint.Min(); new_width = constraint.Min();
if( via )
{
constraint = via->GetDrillConstraint();
if( constraint.HasOpt() )
new_drill = constraint.Opt();
else if( constraint.Min() > 0 )
new_drill = constraint.Min();
}
}
else if( via && via->GetViaType() == VIATYPE::MICROVIA )
{
new_width = aItem->GetEffectiveNetClass()->GetuViaDiameter();
new_drill = aItem->GetEffectiveNetClass()->GetuViaDrill();
}
else if( via )
{
new_width = GetDesignSettings().GetCurrentViaSize();
new_drill = GetDesignSettings().GetCurrentViaDrill();
} }
else else
{ {
new_width = GetDesignSettings().GetCurrentTrackWidth(); new_width = GetDesignSettings().GetCurrentTrackWidth();
} }
if( aTrackItem->Type() == PCB_VIA_T ) if( new_width <= 0 )
new_width = aItem->GetWidth();
if( via && new_drill <= 0 )
new_drill = via->GetDrillValue();
if( aItem->GetWidth() != new_width || ( via && via->GetDrillValue() != new_drill ) )
{ {
const PCB_VIA *via = static_cast<const PCB_VIA*>( aTrackItem ); ITEM_PICKER picker( nullptr, aItem, UNDO_REDO::CHANGED );
picker.SetLink( aItem->Clone() );
aItemsListPicker->PushItem( picker );
// Get the drill value, regardless it is default or specific aItem->SetWidth( new_width );
initial_drill = via->GetDrillValue();
if( via->GetViaType() == VIATYPE::MICROVIA ) if( via && new_drill > 0 )
{ via->SetDrill( new_drill );
new_width = aTrackItem->GetEffectiveNetClass()->GetuViaDiameter();
new_drill = aTrackItem->GetEffectiveNetClass()->GetuViaDrill();
}
else if( aUseDesignRules )
{
new_width = aTrackItem->GetEffectiveNetClass()->GetViaDiameter();
new_drill = aTrackItem->GetEffectiveNetClass()->GetViaDrill();
}
else
{
new_width = GetDesignSettings().GetCurrentViaSize();
new_drill = GetDesignSettings().GetCurrentViaDrill();
}
// Old versions set a drill value <= 0, when the default netclass it used but it could
// be better to set the drill value to the actual value to avoid issues for existing vias,
// if the default drill value is modified in the netclass, and not in current vias.
if( via->GetDrill() <= 0 ) // means default netclass drill value used
initial_drill = -1; // Force drill vias re-initialization
}
if( initial_width != new_width || initial_drill != new_drill )
{
if( aItemsListPicker )
{
aTrackItem->SetWidth( initial_width );
ITEM_PICKER picker( nullptr, aTrackItem, UNDO_REDO::CHANGED );
picker.SetLink( aTrackItem->Clone() );
aItemsListPicker->PushItem( picker );
aTrackItem->SetWidth( new_width );
if( aTrackItem->Type() == PCB_VIA_T )
{
// Set new drill value. Note: currently microvias have only a default drill value
PCB_VIA *via = static_cast<PCB_VIA*>( aTrackItem );
if( new_drill > 0 )
via->SetDrill( new_drill );
else
via->SetDrillDefault();
}
}
} }
} }

View File

@ -596,12 +596,12 @@ public:
* Note that casting this to boolean will allow you to determine whether any action * Note that casting this to boolean will allow you to determine whether any action
* happened. * happened.
* *
* @param aTrackItem the track segment or via to modify. * @param aItem the track segment or via to modify.
* @param aItemsListPicker the list picker to use for an undo command (can be NULL). * @param aItemsListPicker the list picker to use for an undo command (can be NULL).
* @param aUseDesignRules true to use NetClass value, false to use current designSettings * @param aUseDesignRules true to use design rules value, false to use current designSettings
* value. * value.
*/ */
void SetTrackSegmentWidth( PCB_TRACK* aTrackItem, PICKED_ITEMS_LIST* aItemsListPicker, void SetTrackSegmentWidth( PCB_TRACK* aItem, PICKED_ITEMS_LIST* aItemsListPicker,
bool aUseDesignRules ); bool aUseDesignRules );
@ -629,7 +629,7 @@ public:
* -2 if the schematic cannot be opened and 1 if OK. * -2 if the schematic cannot be opened and 1 if OK.
* If OK, opens Eeschema, and opens the schematic for this project * If OK, opens Eeschema, and opens the schematic for this project
*/ */
int TestStandalone( void ); int TestStandalone();
/** /**
* Read a netlist from a file into a #NETLIST object. * Read a netlist from a file into a #NETLIST object.

View File

@ -320,6 +320,24 @@ MINOPTMAX<int> PCB_TRACK::GetWidthConstraint( wxString* aSource ) const
} }
MINOPTMAX<int> PCB_VIA::GetDrillConstraint( wxString* aSource ) const
{
DRC_CONSTRAINT constraint;
if( GetBoard() && GetBoard()->GetDesignSettings().m_DRCEngine )
{
BOARD_DESIGN_SETTINGS& bds = GetBoard()->GetDesignSettings();
constraint = bds.m_DRCEngine->EvalRules( HOLE_SIZE_CONSTRAINT, this, nullptr, m_layer );
}
if( aSource )
*aSource = constraint.GetName();
return constraint.Value();
}
int PCB_VIA::GetMinAnnulus( PCB_LAYER_ID aLayer, wxString* aSource ) const int PCB_VIA::GetMinAnnulus( PCB_LAYER_ID aLayer, wxString* aSource ) const
{ {
if( !FlashLayer( aLayer ) ) if( !FlashLayer( aLayer ) )

View File

@ -417,6 +417,8 @@ public:
std::shared_ptr<SHAPE_SEGMENT> GetEffectiveHoleShape() const override; std::shared_ptr<SHAPE_SEGMENT> GetEffectiveHoleShape() const override;
MINOPTMAX<int> GetDrillConstraint( wxString* aSource = nullptr ) const;
bool IsTented() const override; bool IsTented() const override;
int GetSolderMaskExpansion() const; int GetSolderMaskExpansion() const;