37#include <magic_enum.hpp>
148 wxASSERT( aStandaloneVia );
216 [
this]( wxCommandEvent& )
221 for(
auto& preset : magic_enum::enum_values<IPC4761_PRESET>() )
228 wxString
name =
_(
"Unknown choice" );
231 name = name_it->second;
253 bool hasLocked =
false;
254 bool hasUnlocked =
false;
261 bool selection_first_layer_mixed =
false;
263 bool selection_last_layer_mixed =
false;
267 bool track_selection_layer_mixed =
false;
271 bool secondary_drill_end_layer_mixed =
false;
272 int secondary_drill_size = 0;
273 bool secondary_drill_size_mixed =
false;
276 bool tertiary_drill_end_layer_mixed =
false;
277 int tertiary_drill_size = 0;
278 bool tertiary_drill_size_mixed =
false;
281 bool backdrill_dir_mixed =
false;
283 std::optional<PAD_DRILL_POST_MACHINING_MODE> primary_post_machining_value;
284 bool primary_post_machining_mixed =
false;
285 int primary_post_machining_size = 0;
286 bool primary_post_machining_size_mixed =
false;
287 int primary_post_machining_depth = 0;
288 bool primary_post_machining_depth_mixed =
false;
289 int primary_post_machining_angle = 0;
290 bool primary_post_machining_angle_mixed =
false;
292 std::optional<PAD_DRILL_POST_MACHINING_MODE> secondary_post_machining_value;
293 bool secondary_post_machining_mixed =
false;
294 int secondary_post_machining_size = 0;
295 bool secondary_post_machining_size_mixed =
false;
296 int secondary_post_machining_depth = 0;
297 bool secondary_post_machining_depth_mixed =
false;
298 int secondary_post_machining_angle = 0;
299 bool secondary_post_machining_angle_mixed =
false;
305 auto getAnnularRingSelection =
308 switch(
via->Padstack().UnconnectedLayerMode() )
318 auto getBackdrillDrills =
351 switch( item->Type() )
365 track_selection_layer = t->
GetLayer();
392 if( track_selection_layer != t->
GetLayer() )
393 track_selection_layer_mixed =
true;
438 getBackdrillDrills( v, topDrill, bottomDrill );
441 secondary_drill_end_layer = topDrill.
end;
442 tertiary_drill_end_layer = bottomDrill.
end;
444 secondary_drill_size = topDrill.
size.
x;
445 tertiary_drill_size = bottomDrill.
size.
x;
459 selection_first_layer = v->
TopLayer();
498 if( selection_first_layer != v->
TopLayer() )
499 selection_first_layer_mixed =
true;
502 selection_last_layer_mixed =
true;
537 primary_post_machining_mixed =
true;
540 primary_post_machining_size_mixed =
true;
543 primary_post_machining_depth_mixed =
true;
546 primary_post_machining_angle_mixed =
true;
549 secondary_post_machining_mixed =
true;
552 secondary_post_machining_size_mixed =
true;
555 secondary_post_machining_depth_mixed =
true;
558 secondary_post_machining_angle_mixed =
true;
562 getBackdrillDrills( v, topDrill, bottomDrill );
578 if( secondary_drill_end_layer != topDrill.
end )
579 secondary_drill_end_layer_mixed =
true;
581 if( tertiary_drill_end_layer != bottomDrill.
end )
582 tertiary_drill_end_layer_mixed =
true;
584 if( backdrill_dir != new_backdrill_dir )
585 backdrill_dir_mixed =
true;
587 if( bottomDrill.
size.
x != tertiary_drill_size )
588 tertiary_drill_size_mixed =
true;
590 if( topDrill.
size.
x != secondary_drill_size )
591 secondary_drill_size_mixed =
true;
613 if( track_selection_layer_mixed )
628 if( selection_first_layer_mixed )
639 if( selection_last_layer_mixed )
653 if( backdrill_dir_mixed )
657 if( tertiary_drill_size_mixed )
662 if( secondary_drill_size_mixed )
673 if( tertiary_drill_size_mixed )
685 if( secondary_drill_size_mixed )
700 if( secondary_drill_end_layer_mixed )
716 if( tertiary_drill_end_layer_mixed )
730 if( primary_post_machining_mixed )
737 else if( primary_post_machining_value.has_value() )
739 switch( primary_post_machining_value.value() )
744 if( primary_post_machining_size_mixed )
751 if( primary_post_machining_depth_mixed )
761 if( primary_post_machining_size_mixed )
768 if( primary_post_machining_angle_mixed )
791 if( secondary_post_machining_mixed )
798 else if( secondary_post_machining_value.has_value() )
800 switch( secondary_post_machining_value.value() )
805 if( secondary_post_machining_size_mixed )
812 if( secondary_post_machining_depth_mixed )
822 if( secondary_post_machining_size_mixed )
829 if( secondary_post_machining_angle_mixed )
878 int viaSelection = wxNOT_FOUND;
881 for(
unsigned ii = 1; ii <
m_frame->GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
889 if( viaSelection == wxNOT_FOUND
893 viaSelection = ii - 1;
928 int widthSelection = wxNOT_FOUND;
931 for(
unsigned ii = 1; ii <
m_frame->GetDesignSettings().m_TrackWidthList.size(); ii++ )
933 int width =
m_frame->GetDesignSettings().m_TrackWidthList[ii];
934 wxString msg =
m_frame->StringFromValue( width );
937 if( widthSelection == wxNOT_FOUND &&
m_trackWidth.GetValue() == width )
938 widthSelection = ii - 1;
944 wxCommandEvent event;
952 if( hasLocked && hasUnlocked )
984 for(
unsigned ii = 1; ii <
m_frame->GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
1004 for(
unsigned ii = 1; ii <
m_frame->GetDesignSettings().m_TrackWidthList.size(); ii++ )
1006 int width =
m_frame->GetDesignSettings().m_TrackWidthList[ii];
1007 wxString msg =
m_frame->StringFromValue( width );
1023 if( shortingNets.size() == 1 )
1025 msg.Printf(
_(
"Applying these changes will short net %s with %s." ),
1027 m_frame->GetBoard()->FindNet( *shortingNets.begin() )->GetNetname() );
1031 msg.Printf(
_(
"Applying these changes will short net %s with other nets." ),
1035 KIDIALOG dlg(
this, msg,
_(
"Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
1047 if( changingPads.size() == 1 )
1049 PAD*
pad = *changingPads.begin();
1050 msg.Printf(
_(
"Changing the net will also update %s pad %s to %s." ),
1051 pad->GetParentFootprint()->GetReference(),
1055 else if( changingPads.size() == 2 )
1057 PAD* pad1 = *changingPads.begin();
1058 PAD* pad2 = *( ++changingPads.begin() );
1059 msg.Printf(
_(
"Changing the net will also update %s pad %s and %s pad %s to %s." ),
1068 msg.Printf(
_(
"Changing the net will also update %lu connected pads to %s." ),
1069 static_cast<unsigned long>( changingPads.size() ),
1073 KIDIALOG dlg(
this, msg,
_(
"Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
1083 std::shared_ptr<CONNECTIVITY_DATA> connectivity =
m_frame->GetBoard()->GetConnectivity();
1084 std::vector<PCB_TRACK*> selected_tracks;
1085 std::set<PCB_TRACK*> connected_tracks;
1090 selected_tracks.push_back( track );
1093 for(
PCB_TRACK* selected_track : selected_tracks )
1095 connected_tracks.insert( selected_track );
1100 connectivity->GetConnectedItems( selected_track,
EXCLUDE_ZONES ) )
1103 connected_tracks.insert( track );
1114 std::optional<int> viaDiameter;
1119 std::optional<int> viaDrill;
1124 std::optional<PCB_LAYER_ID> startLayer;
1129 std::optional<PCB_LAYER_ID> endLayer;
1134 std::optional<int> secondaryDrill;
1135 std::optional<int> tertiaryDrill;
1136 std::optional<PCB_LAYER_ID> secondaryStartLayer;
1137 std::optional<PCB_LAYER_ID> secondaryEndLayer;
1138 std::optional<PCB_LAYER_ID> tertiaryStartLayer;
1139 std::optional<PCB_LAYER_ID> tertiaryEndLayer;
1149 tertiaryStartLayer =
B_Cu;
1160 secondaryStartLayer =
F_Cu;
1171 secondaryStartLayer =
F_Cu;
1179 tertiaryStartLayer =
B_Cu;
1192 std::optional<PADSTACK::POST_MACHINING_PROPS> frontPostMachining;
1193 std::optional<PADSTACK::POST_MACHINING_PROPS> backPostMachining;
1217 frontPostMachining = props;
1242 backPostMachining = props;
1245 int copperLayerCount =
m_frame->GetBoard() ?
m_frame->GetBoard()->GetCopperLayerCount() : 0;
1247 if( std::optional<PCB_VIA::VIA_PARAMETER_ERROR> error =
1249 secondaryDrill, secondaryStartLayer,
1250 secondaryEndLayer, tertiaryDrill, tertiaryStartLayer,
1251 tertiaryEndLayer, copperLayerCount ) )
1255 if( error->m_Field == PCB_VIA::VIA_PARAMETER_ERROR::FIELD::DRILL )
1260 else if( error->m_Field == PCB_VIA::VIA_PARAMETER_ERROR::FIELD::DIAMETER )
1284 bool changeLock =
m_lockedCbox->Get3StateValue() != wxCHK_UNDETERMINED;
1285 bool setLock =
m_lockedCbox->Get3StateValue() == wxCHK_CHECKED;
1287 for(
PCB_TRACK* track : selected_tracks )
1293 switch( track->Type() )
1324 track->SetLocalSolderMaskMargin( {} );
1330 track->SetLocked( setLock );
1344 if( !
m_viaX.IsIndeterminate() )
1347 if( !
m_viaY.IsIndeterminate() )
1350 if(
m_viaNotFree->Get3StateValue() != wxCHK_UNDETERMINED )
1358 if( currentSize.
x != newDiameter || currentSize.
y != newDiameter )
1361 updatePadstack =
true;
1466 if(
via->Padstack().SecondaryDrill() != secondaryDrill )
1467 updatePadstack =
true;
1471 if(
via->Padstack().TertiaryDrill() != tertiaryDrill )
1472 updatePadstack =
true;
1499 if(
via->Padstack().FrontPostMachining() != props )
1500 updatePadstack =
true;
1527 if(
via->Padstack().BackPostMachining() != props )
1528 updatePadstack =
true;
1547 if(
via->Padstack().Drill().start != startLayer )
1548 updatePadstack =
true;
1550 via->SetTopLayer( startLayer );
1557 if(
via->Padstack().Drill().end != endLayer )
1558 updatePadstack =
true;
1560 via->SetBottomLayer( endLayer );
1563 if( updatePadstack )
1565 via->SetPadstack( viaStack );
1566 via->SanitizeLayers();
1618 via->SetLocked( setLock );
1630 std::set<int> shortingNets;
1632 std::set<PAD*> changingPads;
1649 for(
PCB_TRACK* track : connected_tracks )
1653 if( other->GetNetCode() == track->GetNetCode() || other->GetNetCode() == newNetCode )
1657 shortingNets.insert( other->GetNetCode() );
1662 for(
PAD*
pad : footprint->Pads() )
1664 if(
pad->GetNetCode() == newNetCode )
1669 if(
pad->GetNetCode() == track->GetNetCode() )
1670 changingPads.insert(
pad );
1672 shortingNets.insert(
pad->GetNetCode() );
1688 for(
PCB_TRACK* track : connected_tracks )
1693 track->SetNetCode( newNetCode );
1696 for(
PAD*
pad : changingPads )
1699 pad->SetNetCode( newNetCode );
1705 commit.
Push(
_(
"Edit Track/Via Properties" ) );
1751 wxCHECK_MSG(
m_viaStack, ,
"Expected valid via stack in onPadstackModeChanged" );
1769 wxCHECK_MSG(
m_viaStack, ,
"Expected valid via stack in onEditLayerChanged" );
1777 if( currentSize.
x != diameter || currentSize.
y != diameter )
1824 wxCHECK_MSG(
m_viaStack, ,
"Expected valid via stack in afterPadstackModeChanged" );
1844 std::vector choices = {
1846 _(
"Inner Layers" ),
1896 return m_frame->GetBoard()->GetCopperLayerCount() - 1;
1901 if( startLayer < 0 || endLayer < 0 )
1902 return m_frame->GetBoard()->GetCopperLayerCount() - 1;
1968 event.Enable( !
m_frame->GetBoard()->LegacyTeardrops() );
1988 if( aFromUserEvent )
2042 const int selection = ctrls.
m_Mode->GetSelection();
2107 if( aLayer ==
B_Cu )
2108 return m_frame->GetBoard()->GetCopperLayerCount() - 1;
2119 if( aOrdinal >=
m_frame->GetBoard()->GetCopperLayerCount() - 1 )
2128 const int last =
m_frame->GetBoard()->GetCopperLayerCount() - 1;
2134 if( span.m_Through )
2146 span.m_Top = std::min( a, b );
2147 span.m_Bottom = std::max( a, b );
2148 span.m_ReachesFront = span.m_Top == 0;
2149 span.m_ReachesBack = span.m_Bottom == last;
2179 aRatio = (double) aSize.
GetIntValue() / drillSize;
2201 std::shared_ptr<CONNECTIVITY_DATA> connectivity = board->
GetConnectivity();
2203 for(
int ordinal = 0; ordinal < copperLayers; ordinal++ )
2205 bool startEnd = ordinal == span.
m_Top || ordinal == span.
m_Bottom;
2206 bool connected = connectivity->IsConnectedOnLayer(
via,
copperLayer( ordinal ),
2213 default: state.
m_RingLayers.push_back( startEnd );
break;
2221 std::optional<PADSTACK> stack;
2226 stack.emplace(
nullptr );
2253 return std::nullopt;
2257 return aFromFront ? ordinal + 1 : copperLayers - ordinal;
2261 const int backdrill =
2264 if( backdrill == wxNOT_FOUND )
2286 auto postMachining = [&](
bool aFront )
2291 switch( ctrls.
m_Mode->GetSelection() )
2296 default:
cut.m_Mode.reset();
break;
2299 ratioToDrill( ctrls.
m_Size,
cut.m_WidthRatio );
2309 depth = drillSize * (
cut.m_WidthRatio - 1 ) / 2 / std::tan( angle *
M_PI / 360.0 );
2316 cut.m_DepthFraction = depth / boardThickness;
2351 ctrl->Enable(
false );
2355 for(
bool front : {
true,
false } )
2361 ctrls.
m_Mode->Enable( reaches );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
void Revert() override
Revert the commit by restoring the modified items state.
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
TEARDROP_PARAMETERS & GetTeardropParams()
Container for design settings for a BOARD object.
bool IsLocked() const override
FOOTPRINT * GetParentFootprint() const
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT, DRC_CONSTRAINT_T aUsage=NULL_CONSTRAINT) const
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
Information pertinent to a Pcbnew printed circuit board.
BOARD_STACKUP GetStackupOrDefault() const
int GetCopperLayerCount() const
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
BOARD_DESIGN_SETTINGS & GetDesignSettings()
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
wxStaticText * m_annularRingsLabel
wxChoice * m_protectionFeatures
wxBoxSizer * m_legacyTeardropsWarning
wxStaticText * m_stMaxWidthLabel
wxTextCtrl * m_topPostMachineSize2Ctrl
wxStaticText * m_TrackEndYLabel
wxStaticText * m_ViaYLabel
wxStaticText * m_topPostMachineSize1Units
wxStaticText * m_bottomPostMachineSize2Label
wxStaticText * m_backdrillBackLayerLabel
PCB_LAYER_BOX_SELECTOR * m_ViaStartLayer
wxCheckBox * m_lockedCbox
wxStaticText * m_backdrillBackSizeLabel
wxStaticText * m_backdrillBackSizeUnits
wxCheckBox * m_curvedEdges
wxStaticText * m_trackMaskMarginUnit
wxStaticText * m_TrackStartYUnit
wxStaticText * m_TrackEndXLabel
wxTextCtrl * m_TrackStartXCtrl
wxStaticText * m_topPostMachineSize1Label
wxStaticText * m_predefinedTrackWidthsUnits
wxStaticText * m_backdrillFrontSizeUnits
wxStaticText * m_TrackWidthLabel
DIALOG_TRACK_VIA_PROPERTIES_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Track & Via Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU)
PCB_LAYER_BOX_SELECTOR * m_backdrillBackLayer
PCB_LAYER_BOX_SELECTOR * m_backdrillFrontLayer
wxTextCtrl * m_topPostMachineSize1Ctrl
wxStaticText * m_stMaxLenUnits
PCB_LAYER_BOX_SELECTOR * m_ViaEndLayer
wxChoice * m_predefinedTrackWidthsCtrl
wxStaticText * m_trackMaskMarginLabel
wxStaticText * m_topPostMachineSize2Label
wxStaticBoxSizer * m_sbTrackSizer
wxChoice * m_annularRingsCtrl
wxStaticBoxSizer * m_sbViaSizer
wxTextCtrl * m_bottomPostMachineSize1Ctrl
wxStaticText * m_ViaDrillUnit
wxStaticText * m_TrackStartXLabel
wxTextCtrl * m_bottomPostMachineSize2Ctrl
wxStaticText * m_stWidthPercentLabel
wxTextCtrl * m_backdrillBackSizeCtrl
wxStaticText * m_backdrillFrontSizeLabel
wxCheckBox * m_trackHasSolderMask
PCB_LAYER_BOX_SELECTOR * m_TrackLayerCtrl
wxStaticText * m_TrackStartYLabel
wxStaticText * m_stMaxLen
wxStaticText * m_bottomPostMachineLabel
wxStaticText * m_topPostMachineLabel
wxStaticText * m_ViaDiameterUnit
wxTextCtrl * m_TrackEndXCtrl
wxCheckBox * m_cbTeardrops
wxTextCtrl * m_tcLenPercent
wxStaticText * m_minTrackWidthHint
wxStaticText * m_ViaDrillLabel
wxStaticText * m_ViaYUnit
wxStaticText * m_topPostMachineSize2Units
wxStaticText * m_stLenPercentLabel
wxChoice * m_cbPadstackMode
wxCheckBox * m_viaNotFree
wxStaticText * m_TrackWidthUnit
wxStaticText * m_bottomPostMachineSize1Units
wxTextCtrl * m_tcWidthPercent
wxChoice * m_bottomPostMachine
wxChoice * m_ViaTypeChoice
wxStaticText * m_postMachineSectionLabel
wxStaticText * m_stHDRatio
wxTextCtrl * m_ViaDiameterCtrl
wxChoice * m_predefinedViaSizesCtrl
wxStaticText * m_ViaXLabel
wxTextCtrl * m_trackMaskMarginCtrl
wxTextCtrl * m_backdrillFrontSizeCtrl
wxStaticText * m_bottomPostMachineSize1Label
wxChoice * m_topPostMachine
wxStaticText * m_backdrillLabel
wxTextCtrl * m_ViaDrillCtrl
wxStaticText * m_TrackEndYUnit
wxStaticText * m_stMaxWidthUnits
wxStaticText * m_netSelectorLabel
wxStaticBitmap * m_bitmapTeardrop
wxTextCtrl * m_TrackEndYCtrl
wxStaticText * m_techLayersLabel
wxStaticText * m_backdrillFrontLayerLabel
wxTextCtrl * m_tcTdMaxLen
wxStaticText * m_bottomPostMachineSize2Units
wxTextCtrl * m_TrackStartYCtrl
wxChoice * m_backdrillChoice
wxStaticText * m_ViaDiameterLabel
wxStaticText * m_stHDRatioUnits
wxStaticBitmap * m_legacyTeardropsIcon
wxTextCtrl * m_TrackWidthCtrl
wxStaticText * m_predefinedViaSizesUnits
wxCheckBox * m_cbTeardropsUseNextTrack
wxTextCtrl * m_tcMaxWidth
NET_SELECTOR * m_netSelector
VIA_CROSS_SECTION_PREVIEW * m_viaPreview
UNIT_BINDER m_bottomPostMachineSize1
void onWidthEdit(wxCommandEvent &aEvent) override
const PCB_SELECTION & m_items
UNIT_BINDER m_bottomPostMachineSize2
bool TransferDataFromWindow() override
void onUnitsChanged(wxCommandEvent &aEvent)
UNIT_BINDER m_viaDiameter
void onNetSelector(wxCommandEvent &aEvent)
UNIT_BINDER m_trackMaskMargin
void afterPadstackModeChanged()
void onWidthSelect(wxCommandEvent &aEvent) override
UNIT_BINDER m_teardropWidthPercent
bool confirmShortingNets(int aNet, const std::set< int > &shortingNets)
UNIT_BINDER m_teardropLenPercent
UNIT_BINDER m_teardropMaxWidth
int copperOrdinal(PCB_LAYER_ID aLayer) const
Copper layers as ordinals, 0 for the front and the copper count minus one for the back.
void syncBackdrillControls(bool aFromUserEvent)
Enable the fields that depend on a choice, without touching the preview.
bool m_standalone
Dialog was constructed for a standalone via (via stitching.
void syncPostMachineControls(bool aFront, bool aFromUserEvent)
UNIT_BINDER m_topPostMachineSize1
bool m_backdrillFrontLayerMixed
A layer selector cannot hold a mixed state in its value, so the dialog remembers it.
void onTeardropsUpdateUi(wxUpdateUIEvent &event) override
void onPadstackModeChanged(wxCommandEvent &aEvent) override
void onBackdrillChange(wxCommandEvent &aEvent) override
void onViaEdit(wxCommandEvent &aEvent) override
std::map< int, PCB_LAYER_ID > m_editLayerCtrlMap
PCB_LAYER_ID copperLayer(int aOrdinal) const
void onProtectionFeaturesChange(wxCommandEvent &aEvent) override
UNIT_BINDER m_backdrillBackSize
PCB_LAYER_ID m_editLayer
The currently-shown copper layer of the edited via(s)
bool m_backdrillBackLayerMixed
UNIT_BINDER m_trackStartY
void onViaSelect(wxCommandEvent &aEvent) override
bool TransferDataToWindow() override
Get data from the PCB board and display it to dialog.
void updateViaMachiningControls()
void onBottomPostMachineChange(wxCommandEvent &aEvent) override
void onEditLayerChanged(wxCommandEvent &aEvent) override
void onTopPostMachineChange(wxCommandEvent &aEvent) override
PCB_BASE_EDIT_FRAME * m_frame
void onViaNotFreeClicked(wxCommandEvent &aEvent) override
void commonInit(PCB_BASE_EDIT_FRAME *aParent)
DIALOG_TRACK_VIA_PROPERTIES(PCB_BASE_EDIT_FRAME *aParent, const PCB_SELECTION &aItems)
std::unique_ptr< PADSTACK > m_viaStack
Temporary padstack of the edited via(s)
UNIT_BINDER m_backdrillFrontSize
UNIT_BINDER m_teardropMaxLen
UNIT_BINDER m_trackStartX
PCB_SELECTION m_viaStandaloneSelection
Used for standalone via mode to flow through the normal update logic.
UNIT_BINDER m_teardropHDPercent
bool confirmPadChange(const std::set< PAD * > &connectedPads)
POST_MACHINE_CONTROLS postMachineControls(bool aFront)
UNIT_BINDER m_topPostMachineSize2
void onMachiningEdit(wxCommandEvent &aEvent) override
~DIALOG_TRACK_VIA_PROPERTIES()
void onTrackEdit(wxCommandEvent &aEvent) override
A base class for most all the KiCad significant classes used in schematics and boards.
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
void DoNotShowCheckbox(wxString file, int line)
Shows the 'do not show again' checkbox.
bool SetOKCancelLabels(const ButtonLabel &ok, const ButtonLabel &cancel) override
int GetLayerSelection() const
LSET is a set of PCB_LAYER_IDs.
static const LSET & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
LSEQ UIOrder() const
Return the copper, technical and user layers in the order shown in layer widget.
static LSET AllNonCuMask()
Return a mask holding all layer minus CU layers.
A PADSTACK defines the characteristics of a single or multi-layer pad, in the IPC sense of the word.
POST_MACHINING_PROPS & FrontPostMachining()
DRILL_PROPS & TertiaryDrill()
@ NORMAL
Shape is the same on all layers.
@ CUSTOM
Shapes can be defined on arbitrary layers.
@ FRONT_INNER_BACK
Up to three shapes can be defined (F_Cu, inner copper layers, B_Cu)
DRILL_PROPS & SecondaryDrill()
POST_MACHINING_PROPS & BackPostMachining()
void SetSize(const VECTOR2I &aSize, PCB_LAYER_ID aLayer)
static constexpr PCB_LAYER_ID ALL_LAYERS
! The layer identifier to use for the single defintion on normal padstacks
static constexpr PCB_LAYER_ID INNER_LAYERS
! The layer identifier to use for "inner layers" on top/inner/bottom padstacks
const wxString & GetNumber() const
Common, abstract interface for edit frames.
Class to display a pcb layer list in a wxBitmapComboBox.
bool HasSolderMask() const
std::optional< int > GetLocalSolderMaskMargin() const
virtual int GetWidth() const
bool GetIsFree() const
Check if the via is a free via (as opposed to one created on a track by the router).
PCB_LAYER_ID BottomLayer() const
VECTOR2I GetPosition() const override
const PADSTACK & Padstack() const
static std::optional< VIA_PARAMETER_ERROR > ValidateViaParameters(std::optional< int > aDiameter, std::optional< int > aPrimaryDrill, std::optional< PCB_LAYER_ID > aPrimaryStartLayer=std::nullopt, std::optional< PCB_LAYER_ID > aPrimaryEndLayer=std::nullopt, std::optional< int > aSecondaryDrill=std::nullopt, std::optional< PCB_LAYER_ID > aSecondaryStartLayer=std::nullopt, std::optional< PCB_LAYER_ID > aSecondaryEndLayer=std::nullopt, std::optional< int > aTertiaryDrill=std::nullopt, std::optional< PCB_LAYER_ID > aTertiaryStartLayer=std::nullopt, std::optional< PCB_LAYER_ID > aTertiaryEndLayer=std::nullopt, int aCopperLayerCount=0)
int GetWidth() const override
PCB_LAYER_ID TopLayer() const
int GetDrillValue() const
Calculate the drill value for vias (m_drill if > 0, or default drill value for the board).
VIATYPE GetViaType() const
virtual bool Collide(const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const
Check if the boundary of shape (this) lies closer to the point aP than aClearance,...
TEARDROP_PARAMETARS is a helper class to handle parameters needed to build teardrops for a board thes...
double m_BestWidthRatio
The height of a teardrop as ratio between height and size of pad/via.
int m_TdMaxLen
max allowed length for teardrops in IU. <= 0 to disable
bool m_AllowUseTwoTracks
True to create teardrops using 2 track segments if the first in too small.
int m_TdMaxWidth
max allowed height for teardrops in IU. <= 0 to disable
double m_BestLengthRatio
The length of a teardrop as ratio between length and size of pad/via.
double m_WidthtoSizeFilterRatio
The ratio (H/D) between the via/pad size and the track width max value to create a teardrop 1....
bool m_Enabled
Flag to enable teardrops.
bool m_CurvedEdges
True if the teardrop should be curved.
void Enable(bool aEnable)
Enable/disable the label, widget and units label.
EDA_UNITS GetUnits() const
virtual void SetUnits(EDA_UNITS aUnits)
Normally not needed (as the UNIT_BINDER inherits from the parent frame), but can be used to set to DE...
virtual double GetDoubleValue() const
Return the current value in Internal Units.
bool IsIndeterminate() const
Return true if the control holds the indeterminate value (for instance, if it represents a multiple s...
virtual void SetDoubleValue(double aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
bool IsNull() const
Return true if the control holds no value (ie: empty string, not 0).
static int SetLayersFromStackup(STATE &aState, const BOARD_STACKUP &aStackup, int aCopperLayerCount)
Fill the layer depths and thicknesses from a stackup, or leave them empty when it does not match the ...
VIA_CROSS_SECTION_GEOMETRY::STATE STATE
VIA_CROSS_SECTION_GEOMETRY::POST_MACHINING POST_MACHINING
IPC4761_PRESET getViaConfiguration(const PCB_VIA *aVia)
const std::map< IPC4761_PRESET, wxString > m_IPC4761Names
void setViaConfiguration(PADSTACK &aStack, const IPC4761_PRESET &aPreset)
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
This file is part of the common library.
@ ANNULAR_RINGS_CONNECTED
@ ANNULAR_RINGS_START_END
@ ANNULAR_RINGS_START_END_CONNECTED
@ POST_MACHINE_COUNTERSINK
@ POST_MACHINE_COUNTERBORE
size_t CopperLayerToOrdinal(PCB_LAYER_ID aLayer)
Converts KiCad copper layer enum to an ordinal between the front and back layers.
PCB_LAYER_ID
A quick note on layer IDs:
PCB_LAYER_ID ToLAYER_ID(int aLayer)
This file contains miscellaneous commonly used macros and functions.
#define UNIMPLEMENTED_FOR(type)
KICOMMON_API wxString GetLabel(EDA_UNITS aUnits, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Get the units string for a given units type.
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
KICOMMON_API wxFont GetSmallInfoFont(wxWindow *aWindow)
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
@ REMOVE_EXCEPT_START_AND_END
#define GEOMETRY_MIN_SIZE
bool collide(T aObject, U aAnotherObject, int aLayer, int aMinDistance)
Used by SHAPE_INDEX to implement Query().
The controls of one post machining side.
wxStaticText * m_AngleOrDepthUnits
wxStaticText * m_SizeLabel
UNIT_BINDER & m_AngleOrDepth
wxStaticText * m_ModeLabel
wxStaticText * m_AngleOrDepthLabel
The copper layers the edited via spans, as read from the type and layer controls.
bool m_Through
the type control says through, or is mixed
int m_Top
ordinal of the first copper layer
int m_Bottom
ordinal of the last copper layer
bool m_ReachesBack
the span ends on the back copper
bool m_ReachesFront
the span starts on the front copper
The properties of a padstack drill.
VECTOR2I size
Drill diameter (x == y) or slot dimensions (x != y)
std::optional< PAD_DRILL_POST_MACHINING_MODE > mode
std::optional< bool > m_CoverBack
std::optional< bool > m_Capped
std::optional< bool > m_PlugFront
std::optional< bool > m_PlugBack
std::optional< bool > m_CoverFront
POST_MACHINING m_PostMachiningBack
double m_BackdrillFrontWidthRatio
std::optional< bool > m_TentFront
std::vector< bool > m_RingLayers
Which spanned copper layers keep an annular ring. Empty means all of them.
double m_BackdrillBackWidthRatio
int m_TopLayer
Copper layers the via spans, as ordinals where 0 is the front layer and the inner count plus one is t...
std::optional< bool > m_Filled
std::optional< int > m_BackdrillFrontLayers
Copper layers removed from that side by the backdrill, 0 for no backdrill, and the backdrill diameter...
std::optional< int > m_BackdrillBackLayers
std::optional< bool > m_TentBack
POST_MACHINING m_PostMachiningFront
double m_PadRatio
Pad diameter over hole diameter.
std::optional< int > m_BottomLayer
Container to handle a stock of specific vias each with unique diameter and drill sizes in the BOARD c...
KIBIS top(path, &reporter)
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_PAD_T
class PAD, a pad in a footprint
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
#define INDETERMINATE_ACTION
#define INDETERMINATE_STATE
Used for holding indeterminate values, such as with multiple selections holding different values or c...
VECTOR2< int32_t > VECTOR2I