45 m_trackStartX( aParent, m_TrackStartXLabel, m_TrackStartXCtrl, nullptr ),
46 m_trackStartY( aParent, m_TrackStartYLabel, m_TrackStartYCtrl, m_TrackStartYUnit ),
47 m_trackEndX( aParent, m_TrackEndXLabel, m_TrackEndXCtrl, nullptr ),
48 m_trackEndY( aParent, m_TrackEndYLabel, m_TrackEndYCtrl, m_TrackEndYUnit ),
49 m_trackWidth( aParent, m_TrackWidthLabel, m_TrackWidthCtrl, m_TrackWidthUnit ),
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, m_stLenPercentUnits ),
56 m_teardropMaxLen( aParent, m_stMaxLen, m_tcTdMaxLen, m_stMaxLenUnits ),
57 m_teardropHeightPercent( aParent, m_stHeightPercentLabel, m_tcHeightPercent, m_stHeightPercentUnits ),
58 m_teardropMaxHeight( aParent, m_stMaxHeight, m_tcMaxHeight, m_stMaxHeightUnits ),
85 VIATYPE viaType = VIATYPE::NOT_DEFINED;
104 bool tracksMatchNetclassValues =
true;
105 bool viasMatchNetclassValues =
true;
106 bool hasLocked =
false;
107 bool hasUnlocked =
false;
112 int selection_first_layer = -1;
113 int selection_last_layer = -1;
116 int track_selection_layer = -1;
118 auto getAnnularRingSelection =
121 if( !
via->GetRemoveUnconnected() )
123 else if(
via->GetKeepStartEnd() )
142 switch( item->Type() )
157 track_selection_layer = t->
GetLayer();
177 if( track_selection_layer != t->
GetLayer() )
181 if( tracksMatchNetclassValues )
186 tracksMatchNetclassValues &= constraint.
Opt() == t->
GetWidth();
187 else if( constraint.
Min() > 0 )
188 tracksMatchNetclassValues &= constraint.
Min() == t->
GetWidth();
213 selection_first_layer = v->
TopLayer();
241 viaType = VIATYPE::NOT_DEFINED;
246 if( selection_first_layer != v->
TopLayer() )
288 if( viasMatchNetclassValues )
293 viasMatchNetclassValues &= constraint.
Opt() == v->
GetWidth();
294 else if( constraint.
Min() > 0 )
295 viasMatchNetclassValues &= constraint.
Min() == v->
GetWidth();
301 else if( constraint.
Min() > 0 )
381 if( viasMatchNetclassValues )
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 if( tracksMatchNetclassValues )
452 int widthSelection = wxNOT_FOUND;
455 for(
unsigned ii = 1; ii < aParent->
GetDesignSettings().m_TrackWidthList.size(); ii++ )
462 widthSelection = ii - 1;
473 if( hasLocked && hasUnlocked )
551 if( changingPads.size() == 1 )
553 PAD*
pad = *changingPads.begin();
554 msg.Printf(
_(
"Changing the net will also update %s pad %s to %s." ),
555 pad->GetParentFootprint()->GetReference(),
559 else if( changingPads.size() == 2 )
561 PAD* pad1 = *changingPads.begin();
562 PAD* pad2 = *( ++changingPads.begin() );
563 msg.Printf(
_(
"Changing the net will also update %s pad %s and %s pad %s to %s." ),
572 msg.Printf(
_(
"Changing the net will also update %lu connected pads to %s." ),
573 static_cast<unsigned long>( changingPads.size() ),
577 KIDIALOG dlg(
this, msg,
_(
"Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
601 DisplayError( GetParent(),
_(
"Via hole size must be smaller than via diameter" ) );
610 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() )
660 else if( constraint.
Min() > 0 )
690 if(
m_viaNotFree->Get3StateValue() != wxCHK_UNDETERMINED )
743 else if( constraint.
Min() > 0 )
750 else if( constraint.
Min() > 0 )
805 commit.
Push(
_(
"Edit track/via properties" ) );
812 bool updateNets =
false;
813 std::vector<PAD*> changingPads;
822 auto connectedItems = connectivity->GetConnectedItems( boardItem,
831 if(
pad->GetNetCode() != newNetCode && !
alg::contains( changingPads, citem ) )
832 changingPads.push_back(
pad );
847 switch( item->Type() )
851 static_cast<PCB_TRACK*
>( item )->SetNetCode( newNetCode );
855 static_cast<PCB_VIA*
>( item )->SetNetCode( newNetCode );
864 for(
PAD*
pad : changingPads )
867 pad->SetNetCode( newNetCode );
870 commit.
Push(
_(
"Updating nets" ) );
895 bool enableNC = aEvent.IsChecked();
920 bool enableNC = aEvent.IsChecked();
950 if( startLayer < 0 || endLayer < 0 )
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) 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,...
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
const NETINFO_LIST & GetNetInfo() const
int GetCopperLayerCount() const
int LayerDepth(PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer) const
bool LegacyTeardrops() const
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)
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.
wxStaticText * m_annularRingsLabel
wxBoxSizer * m_legacyTeardropsWarning
PCB_LAYER_BOX_SELECTOR * m_ViaStartLayer
wxCheckBox * m_lockedCbox
wxCheckBox * m_curvedEdges
wxChoice * m_DesignRuleViasCtrl
wxCheckBox * m_viaDesignRules
wxStaticText * m_DesignRuleVias
PCB_LAYER_BOX_SELECTOR * m_ViaEndLayer
wxStaticBoxSizer * m_sbTrackSizer
wxChoice * m_annularRingsCtrl
wxStaticBoxSizer * m_sbViaSizer
PCB_LAYER_BOX_SELECTOR * m_TrackLayerCtrl
wxCheckBox * m_trackDesignRules
wxSpinCtrl * m_curvePointsCtrl
wxStaticText * m_DesignRuleViasUnit
wxCheckBox * m_cbTeardrops
wxStaticText * m_minTrackWidthHint
wxCheckBox * m_viaNotFree
wxChoice * m_ViaTypeChoice
wxTextCtrl * m_ViaDiameterCtrl
wxStaticText * m_DesignRuleWidths
wxTextCtrl * m_ViaDrillCtrl
wxStaticText * m_netSelectorLabel
wxStaticBitmap * m_bitmapTeardrop
wxChoice * m_DesignRuleWidthsCtrl
wxStaticBitmap * m_legacyTeardropsIcon
wxTextCtrl * m_TrackWidthCtrl
wxCheckBox * m_cbTeardropsUseNextTrack
wxStaticText * m_DesignRuleWidthsUnits
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
UNIT_BINDER m_teardropHeightPercent
void onNetSelector(wxCommandEvent &aEvent)
void onWidthSelect(wxCommandEvent &aEvent) override
UNIT_BINDER m_teardropLenPercent
void onTeardropsUpdateUi(wxUpdateUIEvent &event) override
void onViaEdit(wxCommandEvent &aEvent) override
bool confirmPadChange(const std::vector< PAD * > &connectedPads)
UNIT_BINDER m_teardropMaxHeight
void onCurvedEdgesUpdateUi(wxUpdateUIEvent &event) override
UNIT_BINDER m_trackStartY
void onViaSelect(wxCommandEvent &aEvent) override
void onViaNotFreeClicked(wxCommandEvent &aEvent) override
void onTrackNetclassCheck(wxCommandEvent &aEvent) override
UNIT_BINDER m_teardropMaxLen
UNIT_BINDER m_trackStartX
UNIT_BINDER m_teardropHDPercent
void onViaNetclassCheck(wxCommandEvent &aEvent) override
DIALOG_TRACK_VIA_PROPERTIES(PCB_BASE_FRAME *aParent, const PCB_SELECTION &aItems)
~DIALOG_TRACK_VIA_PROPERTIES()
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)
static LSET AllNonCuMask()
Return a mask holding all layer minus CU layers.
void SetNetInfo(const NETINFO_LIST *aNetInfoList)
void SetBoard(BOARD *aBoard)
void SetIndeterminateString(const wxString &aString)
void SetSelectedNetcode(int aNetcode)
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 SetWidth(int aWidth)
void SetEnd(const VECTOR2I &aEnd)
void SetStart(const VECTOR2I &aStart)
const VECTOR2I & GetStart() const
const VECTOR2I & GetEnd() const
virtual MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const
void SetRemoveUnconnected(bool aSet)
Sets the unconnected removal property.
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
void SetKeepStartEnd(bool aSet)
Sets whether we keep the start and end annular rings even if they are not connected.
void SetBottomLayer(PCB_LAYER_ID aLayer)
void SetDrill(int aDrill)
Set the drill value for vias.
MINOPTMAX< int > GetDrillConstraint(wxString *aSource=nullptr) const
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...
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
MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const override
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
number of segments to build the curved sides of a teardrop area must be > 2.
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....
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.
void Enable(bool aEnable)
Enable/disable the label, widget and units label.
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.
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.
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.
KICOMMON_API wxString GetLabel(EDA_UNITS aUnits, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Get the units string for a given units type.
wxFont GetInfoFont(wxWindow *aWindow)
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
#define GEOMETRY_MIN_SIZE
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...