44 m_trackStartX( aParent, m_TrackStartXLabel, m_TrackStartXCtrl, nullptr ),
45 m_trackStartY( aParent, m_TrackStartYLabel, m_TrackStartYCtrl, m_TrackStartYUnit ),
46 m_trackEndX( aParent, m_TrackEndXLabel, m_TrackEndXCtrl, nullptr ),
47 m_trackEndY( aParent, m_TrackEndYLabel, m_TrackEndYCtrl, m_TrackEndYUnit ),
48 m_trackWidth( aParent, m_TrackWidthLabel, m_TrackWidthCtrl, m_TrackWidthUnit ),
49 m_trackMaskMargin( aParent, m_trackMaskMarginLabel, m_trackMaskMarginCtrl, m_trackMaskMarginUnit ),
50 m_viaX( aParent, m_ViaXLabel, m_ViaXCtrl, nullptr ),
51 m_viaY( aParent, m_ViaYLabel, m_ViaYCtrl, m_ViaYUnit ),
52 m_viaDiameter( aParent, m_ViaDiameterLabel, m_ViaDiameterCtrl, m_ViaDiameterUnit ),
53 m_viaDrill( aParent, m_ViaDrillLabel, m_ViaDrillCtrl, m_ViaDrillUnit ),
54 m_teardropHDPercent( aParent, m_stHDRatio, m_tcHDRatio, m_stHDRatioUnits ),
55 m_teardropLenPercent( aParent, m_stLenPercentLabel, m_tcLenPercent, nullptr ),
56 m_teardropMaxLen( aParent, m_stMaxLen, m_tcTdMaxLen, m_stMaxLenUnits ),
57 m_teardropWidthPercent( aParent, m_stWidthPercentLabel, m_tcWidthPercent, nullptr ),
58 m_teardropMaxWidth( aParent, m_stMaxWidthLabel, m_tcMaxWidth, m_stMaxWidthUnits ),
86 VIATYPE viaType = VIATYPE::NOT_DEFINED;
113 bool hasLocked =
false;
114 bool hasUnlocked =
false;
119 int selection_first_layer = -1;
120 int selection_last_layer = -1;
123 int track_selection_layer = -1;
125 auto getAnnularRingSelection =
128 switch(
via->Padstack().UnconnectedLayerMode() )
137 auto getTentingSelection =
140 std::optional<bool> tentingOverride =
via->Padstack().IsTented( aLayer );
142 if( tentingOverride.has_value() )
144 if( *tentingOverride )
166 switch( item->Type() )
180 track_selection_layer = t->
GetLayer();
207 if( track_selection_layer != t->
GetLayer() )
251 selection_first_layer = v->
TopLayer();
278 viaType = VIATYPE::NOT_DEFINED;
283 if( selection_first_layer != v->
TopLayer() )
393 int viaSelection = wxNOT_FOUND;
396 for(
unsigned ii = 1; ii < aParent->
GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
404 if( viaSelection == wxNOT_FOUND
408 viaSelection = ii - 1;
422 case VIATYPE::NOT_DEFINED:
m_ViaTypeChoice->SetSelection( wxNOT_FOUND );
break;
441 int widthSelection = wxNOT_FOUND;
444 for(
unsigned ii = 1; ii < aParent->
GetDesignSettings().m_TrackWidthList.size(); ii++ )
451 widthSelection = ii - 1;
457 wxCommandEvent event;
465 if( hasLocked && hasUnlocked )
543 if( changingPads.size() == 1 )
545 PAD*
pad = *changingPads.begin();
546 msg.Printf(
_(
"Changing the net will also update %s pad %s to %s." ),
547 pad->GetParentFootprint()->GetReference(),
551 else if( changingPads.size() == 2 )
553 PAD* pad1 = *changingPads.begin();
554 PAD* pad2 = *( ++changingPads.begin() );
555 msg.Printf(
_(
"Changing the net will also update %s pad %s and %s pad %s to %s." ),
564 msg.Printf(
_(
"Changing the net will also update %lu connected pads to %s." ),
565 static_cast<unsigned long>( changingPads.size() ),
569 KIDIALOG dlg(
this, msg,
_(
"Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
595 DisplayError( GetParent(),
_(
"Via hole size must be smaller than via diameter" ) );
604 DisplayError( GetParent(),
_(
"Via start layer and end layer cannot be the same" ) );
627 bool changeLock =
m_lockedCbox->Get3StateValue() != wxCHK_UNDETERMINED;
628 bool setLock =
m_lockedCbox->Get3StateValue() == wxCHK_CHECKED;
634 switch( item->Type() )
674 t->SetLocked( setLock );
690 if(
m_viaNotFree->Get3StateValue() != wxCHK_UNDETERMINED )
804 commit.Push(
_(
"Edit Track/Via Properties" ) );
809 auto connectivity = m_frame->GetBoard()->GetConnectivity();
810 int newNetCode = m_netSelector->GetSelectedNetcode();
811 bool updateNets =
false;
812 std::vector<PAD*> changingPads;
814 if ( !m_netSelector->IsIndeterminate() )
821 auto connectedItems = connectivity->GetConnectedItems( boardItem,
830 if(
pad->GetNetCode() != newNetCode && !
alg::contains( changingPads, citem ) )
831 changingPads.push_back(
pad );
837 if( changingPads.size() && !confirmPadChange( changingPads ) )
844 commit.Modify( item );
846 switch( item->Type() )
850 static_cast<PCB_TRACK*
>( item )->SetNetCode( newNetCode );
854 static_cast<PCB_VIA*
>( item )->SetNetCode( newNetCode );
863 for(
PAD*
pad : changingPads )
865 commit.Modify(
pad );
866 pad->SetNetCode( newNetCode );
869 commit.Push(
_(
"Update Nets" ) );
916 wxCHECK_MSG(
m_viaStack, ,
"Expected valid via stack in onPadstackModeChanged" );
932 wxCHECK_MSG(
m_viaStack, ,
"Expected valid via stack in onEditLayerChanged" );
981 wxCHECK_MSG(
m_viaStack, ,
"Expected valid via stack in afterPadstackModeChanged" );
1001 std::vector choices = {
1003 _(
"Inner Layers" ),
1058 if( startLayer < 0 || endLayer < 0 )
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
TEARDROP_PARAMETERS & GetTeardropParams()
std::vector< int > m_TrackWidthList
std::vector< VIA_DIMENSION > m_ViasDimensionsList
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual void SetLocked(bool aLocked)
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
FOOTPRINT * GetParentFootprint() const
virtual bool IsLocked() const
Information pertinent to a Pcbnew printed circuit board.
const NETINFO_LIST & GetNetInfo() const
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
int GetCopperLayerCount() const
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
int LayerDepth(PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer) const
bool LegacyTeardrops() const
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Create an undo entry for an item that has been already modified.
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...
Class DIALOG_TRACK_VIA_PROPERTIES_BASE.
wxChoice * m_tentingFrontCtrl
wxStaticText * m_annularRingsLabel
wxBoxSizer * m_legacyTeardropsWarning
wxStaticText * m_tentingBackLabel
PCB_LAYER_BOX_SELECTOR * m_ViaStartLayer
wxCheckBox * m_lockedCbox
wxChoice * m_tentingBackCtrl
wxCheckBox * m_curvedEdges
wxStaticText * m_trackMaskMarginUnit
wxStaticText * m_predefinedTrackWidthsUnits
PCB_LAYER_BOX_SELECTOR * m_ViaEndLayer
wxChoice * m_predefinedTrackWidthsCtrl
wxStaticText * m_trackMaskMarginLabel
wxStaticBoxSizer * m_sbTrackSizer
wxChoice * m_annularRingsCtrl
wxStaticBoxSizer * m_sbViaSizer
wxBitmapToggleButton * m_btnLinkTenting
wxCheckBox * m_trackHasSolderMask
PCB_LAYER_BOX_SELECTOR * m_TrackLayerCtrl
wxCheckBox * m_cbTeardrops
wxStaticText * m_minTrackWidthHint
wxChoice * m_cbPadstackMode
wxCheckBox * m_viaNotFree
wxChoice * m_ViaTypeChoice
wxTextCtrl * m_ViaDiameterCtrl
wxChoice * m_predefinedViaSizesCtrl
wxTextCtrl * m_trackMaskMarginCtrl
wxTextCtrl * m_ViaDrillCtrl
wxStaticText * m_netSelectorLabel
wxStaticBitmap * m_bitmapTeardrop
wxStaticText * m_techLayersLabel
wxStaticBitmap * m_legacyTeardropsIcon
wxTextCtrl * m_TrackWidthCtrl
wxStaticText * m_predefinedViaSizesUnits
wxCheckBox * m_cbTeardropsUseNextTrack
NET_SELECTOR * m_netSelector
void onWidthEdit(wxCommandEvent &aEvent) override
const PCB_SELECTION & m_items
bool TransferDataFromWindow() override
void onUnitsChanged(wxCommandEvent &aEvent)
UNIT_BINDER m_viaDiameter
void onNetSelector(wxCommandEvent &aEvent)
void onTentingLinkToggle(wxCommandEvent &event) override
UNIT_BINDER m_trackMaskMargin
void afterPadstackModeChanged()
void onWidthSelect(wxCommandEvent &aEvent) override
UNIT_BINDER m_teardropWidthPercent
UNIT_BINDER m_teardropLenPercent
UNIT_BINDER m_teardropMaxWidth
void onTeardropsUpdateUi(wxUpdateUIEvent &event) override
void onPadstackModeChanged(wxCommandEvent &aEvent) override
void onViaEdit(wxCommandEvent &aEvent) override
bool confirmPadChange(const std::vector< PAD * > &connectedPads)
std::map< int, PCB_LAYER_ID > m_editLayerCtrlMap
void onFrontTentingChanged(wxCommandEvent &event) override
PCB_LAYER_ID m_editLayer
The currently-shown copper layer of the edited via(s)
UNIT_BINDER m_trackStartY
void onViaSelect(wxCommandEvent &aEvent) override
void onEditLayerChanged(wxCommandEvent &aEvent) override
void onViaNotFreeClicked(wxCommandEvent &aEvent) override
std::unique_ptr< PADSTACK > m_viaStack
Temporary padstack of the edited via(s)
UNIT_BINDER m_teardropMaxLen
UNIT_BINDER m_trackStartX
UNIT_BINDER m_teardropHDPercent
DIALOG_TRACK_VIA_PROPERTIES(PCB_BASE_FRAME *aParent, const PCB_SELECTION &aItems)
~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)
Checks the 'do not show again' setting for the dialog.
bool SetOKCancelLabels(const ButtonLabel &ok, const ButtonLabel &cancel) override
Shows the 'do not show again' checkbox.
int GetLayerSelection() const
int SetLayerSelection(int layer)
bool SetLayersHotkeys(bool value)
LSET is a set of PCB_LAYER_IDs.
LSEQ UIOrder() const
Returns 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.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
void SetNetInfo(const NETINFO_LIST *aNetInfoList)
void SetBoard(BOARD *aBoard)
void SetIndeterminateString(const wxString &aString)
void SetSelectedNetcode(int aNetcode)
A PADSTACK defines the characteristics of a single or multi-layer pad, in the IPC sense of the word.
MASK_LAYER_PROPS & FrontOuterLayers()
void SetUnconnectedLayerMode(UNCONNECTED_LAYER_MODE aMode)
@ 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)
@ REMOVE_EXCEPT_START_AND_END
MASK_LAYER_PROPS & BackOuterLayers()
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
static constexpr PCB_LAYER_ID INNER_LAYERS
! The layer identifier to use for "inner layers" on top/inner/bottom padstacks
const wxString & GetNumber() const
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
void SetBoardFrame(PCB_BASE_FRAME *aFrame)
void SetNotAllowedLayerSet(LSET aMask)
void SetUndefinedLayerName(const wxString &aName)
void SetHasSolderMask(bool aVal)
void SetEnd(const VECTOR2I &aEnd)
bool HasSolderMask() const
void SetStart(const VECTOR2I &aStart)
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
std::optional< int > GetLocalSolderMaskMargin() const
const VECTOR2I & GetStart() const
const VECTOR2I & GetEnd() const
virtual void SetWidth(int aWidth)
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
void SetBottomLayer(PCB_LAYER_ID aLayer)
void SetDrill(int aDrill)
Set the drill value for vias.
void SetIsFree(bool aFree=true)
void SetTopLayer(PCB_LAYER_ID aLayer)
void SetPosition(const VECTOR2I &aPoint) override
void SanitizeLayers()
Check so that the layers are correct depending on the type of via, and so that the top actually is on...
int GetWidth() const override
void SetViaType(VIATYPE aViaType)
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
void SetPadstack(const PADSTACK &aPadstack)
bool Empty() const
Checks if there is anything selected.
TEARDROP_PARAMETARS is a helper class to handle parameters needed to build teardrops for a board thes...
int m_CurveSegCount
True if the teardrop should be curved.
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.
EDA_UNITS GetUserUnits() const
wxString StringFromValue(double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
Converts aValue in internal units into a united string.
virtual long long int GetValue()
Return the current value in Internal Units.
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()
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 bool Validate(double aMin, double aMax, EDA_UNITS aUnits=EDA_UNITS::UNSCALED)
Validate the control against the given range, informing the user of any errors found.
virtual void ChangeValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion WITHOUT trigger...
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
void SetCoordType(ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType)
Set the current origin transform mode.
bool IsNull() const
Return true if the control holds no value (ie: empty string, not 0).
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
This file is part of the common library.
This file is part of the common library.
PCB_LAYER_ID
A quick note on layer IDs:
PCB_LAYER_ID ToLAYER_ID(int aLayer)
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)
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
#define GEOMETRY_MIN_SIZE
std::optional< bool > has_solder_mask
True if this outer layer has mask (is not tented)
Container to handle a stock of specific vias each with unique diameter and drill sizes in the BOARD c...
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
@ 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_STATE
Used for holding indeterminate values, such as with multiple selections holding different values or c...