100 auto explodeCondition =
106 auto recombineCondition =
130 ctxMenu.AddSeparator( 1 );
140 getEditFrame<PCB_BASE_FRAME>()->AddStandardSubMenus(
m_menu );
164 commit.
Push(
_(
"Paste Pad Properties" ) );
185 const PAD& selPad =
static_cast<const PAD&
>( *item );
195 bool aSameFootprints,
bool aPadShapeFilter,
bool aPadOrientFilter,
196 bool aPadLayerFilter,
bool aPadTypeFilter )
204 if( !aSameFootprints && ( footprint != refFootprint ) )
207 if( footprint->GetFPID() != refFootprint->
GetFPID() )
210 for(
PAD*
pad : footprint->Pads() )
212 if( aPadShapeFilter && (
pad->GetShape() != aSrcPad.
GetShape() ) )
215 EDA_ANGLE padAngle =
pad->GetOrientation() - footprint->GetOrientation();
217 if( aPadOrientFilter && ( padAngle != srcPadAngle ) )
220 if( aPadLayerFilter && (
pad->GetLayerSet() != aSrcPad.
GetLayerSet() ) )
223 if( aPadTypeFilter && (
pad->GetAttribute() != aSrcPad.
GetAttribute() ) )
236 pad->ImportSettingsFrom( aSrcPad );
256 int dialogRet = dlg.ShowModal();
258 if( dialogRet == wxID_CANCEL )
261 const bool edit_Same_Modules = (dialogRet == 1);
271 commit.
Push(
_(
"Push Pad Settings" ) );
288static std::optional<SEQUENTIAL_PAD_ENUMERATION_PARAMS>
296 if( settingsDlg.ShowModal() != wxID_OK )
299 return s_lastUsedParams;
308 if( !
board()->GetFirstFootprint() ||
board()->GetFirstFootprint()->Pads().
empty() )
319 const std::optional<SEQUENTIAL_PAD_ENUMERATION_PARAMS> params =
326 int seqPadNum = params->m_start_number;
328 std::deque<int> storedPadNumbers;
329 std::map<wxString, std::pair<int, wxString>> oldNumbers;
336 std::list<PAD*> selectedPads;
338 bool isFirstPoint =
true;
343 mag_settings.
tracks = MAGNETIC_OPTIONS::NO_EFFECT;
344 mag_settings.
pads = MAGNETIC_OPTIONS::CAPTURE_ALWAYS;
347 grid.SetSnap(
true );
348 grid.SetUseGrid(
false );
366 const auto constructPadNumber =
369 return wxString::Format( wxT(
"%s%d" ), params->m_prefix.value_or(
"" ), aValue );
373 const auto setPopupTextForValue =
376 const wxString msg =
_(
"Click on pad %s\n"
377 "Press <esc> to cancel all; double-click to finish" );
378 statusPopup.
SetText( wxString::Format( msg, constructPadNumber( aValue ) ) );
381 setPopupTextForValue( seqPadNum );
393 if( evt->IsCancelInteractive() )
401 else if( evt->IsActivate() )
403 commit.
Push(
_(
"Renumber Pads" ) );
410 selectedPads.clear();
415 oldCursorPos = cursorPos;
416 isFirstPoint =
false;
422 int distance = ( cursorPos - oldCursorPos ).EuclideanNorm();
425 const VECTOR2I line_step( ( cursorPos - oldCursorPos ) / segments );
429 for(
int j = 0; j < segments; ++j )
431 VECTOR2I testpoint( cursorPos.
x - j * line_step.
x, cursorPos.
y - j * line_step.
y );
434 for(
int i = 0; i < collector.
GetCount(); ++i )
436 PAD*
pad =
static_cast<PAD*
>( collector[i] );
438 if( !
pad->IsAperturePad() )
439 selectedPads.push_back(
pad );
443 selectedPads.unique();
445 for(
PAD*
pad : selectedPads )
448 if( !
pad->IsSelected() )
455 if( storedPadNumbers.size() > 0 )
457 newval = storedPadNumbers.front();
458 storedPadNumbers.pop_front();
463 seqPadNum += params->m_step;
466 const wxString newNumber = constructPadNumber( newval );
467 oldNumbers[newNumber] = { newval,
pad->GetNumber() };
468 pad->SetNumber( newNumber );
474 if( storedPadNumbers.size() > 0 )
475 newval = storedPadNumbers.front();
479 setPopupTextForValue( newval );
483 else if(
pad->IsSelected() && evt->IsClick(
BUT_LEFT ) )
485 auto it = oldNumbers.find(
pad->GetNumber() );
486 wxASSERT( it != oldNumbers.end() );
488 if( it != oldNumbers.end() )
490 storedPadNumbers.push_back( it->second.first );
491 pad->SetNumber( it->second.second );
493 oldNumbers.erase( it );
495 const int newval = storedPadNumbers.front();
496 setPopupTextForValue( newval );
499 pad->ClearSelected();
504 else if( evt->IsDblClick(
BUT_LEFT ) )
506 commit.
Push(
_(
"Renumber Pads" ) );
525 for(
PAD* p :
board()->GetFirstFootprint()->Pads() )
546 static bool neednewPadNumber;
551 if( !
board()->GetFirstFootprint() )
558 neednewPadNumber =
true;
559 m_padTool = aPadTool;
562 virtual ~PAD_PLACER()
566 std::unique_ptr<BOARD_ITEM> CreateItem()
override
568 PAD*
pad =
new PAD( m_board->GetFirstFootprint() );
569 PAD* master = m_frame->GetDesignSettings().m_Pad_Master.get();
571 pad->ImportSettingsFrom( *master );
576 if( ( m_board->GetFirstFootprint()->GetAttributes() &
FP_SMD )
579 if(
pad->GetProperty() != PAD_PROP::HEATSINK )
581 pad->SetAttribute( PAD_ATTRIB::SMD );
582 pad->SetShape( PAD_SHAPE::ROUNDRECT );
583 pad->SetSizeX( 1.5 *
pad->GetSizeY() );
587 else if( ( m_board->GetFirstFootprint()->GetAttributes() &
FP_THROUGH_HOLE )
590 pad->SetAttribute( PAD_ATTRIB::PTH );
591 pad->SetShape( PAD_SHAPE::CIRCLE );
596 pad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE );
597 int hole_size =
pad->GetSizeX() / 2;
598 pad->SetDrillSize(
VECTOR2I( hole_size, hole_size ) );
603 if(
pad->CanHaveNumber() )
605 wxString padNumber = m_padTool->GetLastPadNumber();
609 if( neednewPadNumber )
610 padNumber = m_board->GetFirstFootprint()->GetNextPadNumber( padNumber );
612 pad->SetNumber( padNumber );
613 m_padTool->SetLastPadNumber( padNumber );
617 neednewPadNumber =
false;
620 return std::unique_ptr<BOARD_ITEM>(
pad );
628 neednewPadNumber =
true;
633 aCommit.
Add( aItem );
643 PAD_PLACER placer(
this );
677 commit.
Push(
_(
"Edit Pad" ) );
690 commit.
Push(
_(
"Edit Pad" ) );
708 PAD* flaggedPad =
nullptr;
713 for(
PAD*
pad : fp->Pads() )
715 if(
pad->IsEntered() )
718 flaggedPadId =
pad->m_Uuid;
751 return dynamic_cast<PAD*
>( aItem ) !=
nullptr;
764 msg.Printf(
_(
"Pad Edit Mode. Press %s again to exit." ),
769 msg.Printf(
_(
"Pad Edit Mode. Press %s to exit." ),
797 return dynamic_cast<PAD*
>( aItem ) !=
nullptr;
817 if( aPad->
GetShape() == PAD_SHAPE::CUSTOM )
819 for(
const std::shared_ptr<PCB_SHAPE>& primitive : aPad->
GetPrimitives() )
836 aCommit.
Add( shape );
855 return aPad->
Recombine( aIsDryRun, maxError );
@ NORMAL
Use all material properties from model file.
constexpr EDA_IU_SCALE pcbIUScale
HIGH_CONTRAST_MODE
Determine how inactive layers should be displayed.
static TOOL_ACTION cancelInteractive
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
virtual void Revert() override
std::unique_ptr< PAD > m_Pad_Master
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
FOOTPRINT * GetParentFootprint() const
Information pertinent to a Pcbnew printed circuit board.
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
const FOOTPRINTS & Footprints() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
void Empty()
Clear the list.
int GetCount() const
Return the number of objects in the list.
COMMIT & Remove(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been removed.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Create an undo entry for an item that has been already modified.
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been added.
static DELETED_BOARD_ITEM * GetInstance()
Dialog for enumerating pads.
static bool m_Pad_Shape_Filter
static bool m_Pad_Type_Filter
static bool m_Pad_Layer_Filter
static bool m_Pad_Orient_Filter
WX_INFOBAR * GetInfoBar()
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
void ForceRefresh()
Force a redraw.
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
void SetStatusPopup(wxWindow *aPopup)
A base class for most all the KiCad significant classes used in schematics and boards.
void SetFlags(EDA_ITEM_FLAGS aMask)
KICAD_T Type() const
Returns the type of object.
virtual void SetParent(EDA_ITEM *aParent)
void SetWidth(int aWidth)
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
static const TOOL_EVENT UndoRedoPostEvent
A general implementation of a COLLECTORS_GUIDE.
void SetIgnoreMTextsMarkedNoShow(bool ignore)
void SetIgnoreModulesRefs(bool ignore)
void SetIgnoreModulesVals(bool ignore)
void SetIgnoreMTextsOnFront(bool ignore)
void SetIgnoreMTextsOnBack(bool ignore)
Used when the right click button is pressed, or when the select tool is in effect.
void Collect(BOARD_ITEM *aItem, const std::vector< KICAD_T > &aScanList, const VECTOR2I &aRefPos, const COLLECTORS_GUIDE &aGuide)
Scan a BOARD_ITEM using this class's Inspector method, which does the collection.
Contains methods for drawing PCB-specific items.
virtual PCB_RENDER_SETTINGS * GetSettings() override
Return a pointer to current settings that are going to be used when drawing items.
PCB specific render settings.
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Place the cursor immediately at a given point.
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
An abstract base class for deriving all objects that can be added to a VIEW.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
void UpdateAllItemsConditionally(int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
Update items in the view according to the given flags and condition.
bool IsAperturePad() const
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
PAD_ATTRIB GetAttribute() const
static LSET PTHMask()
layer set for a through hole pad
void DeletePrimitivesList()
Clear the basic shapes list.
const std::vector< std::shared_ptr< PCB_SHAPE > > & GetPrimitives() const
Accessor to the basic shape list for custom-shaped pads.
std::vector< PCB_SHAPE * > Recombine(bool aIsDryRun, int aMaxError)
Recombines the pad with other graphical shapes in the footprint.
VECTOR2I ShapePos() const
void ImportSettingsFrom(const PAD &aMasterPad)
Import the pad settings from aMasterPad.
PAD_SHAPE GetShape() const
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
static LSET SMDMask()
layer set for a SMD pad on Front layer
void SetShape(PAD_SHAPE aShape)
Set the new shape of this pad.
int GetThermalSpokeWidth() const
PAD_SHAPE GetAnchorPadShape() const
static TOOL_ACTION recombinePad
static TOOL_ACTION enumeratePads
Tool for quick pad enumeration.
static TOOL_ACTION pushPadSettings
Copy the current pad's settings to other pads in the footprint or on the board.
static TOOL_ACTION mirrorH
Mirroring of selected items.
static TOOL_ACTION copyPadSettings
Copy the selected pad's settings to the board design settings.
static TOOL_ACTION placePad
Activation of the drawing tool (placing a PAD)
static TOOL_ACTION properties
Activation of the edit tool.
static TOOL_ACTION selectionClear
Clear the current selection.
static TOOL_ACTION explodePad
static TOOL_ACTION applyPadSettings
Copy the default pad settings to the selected pad.
static TOOL_ACTION mirrorV
static TOOL_ACTION flip
Flipping of selected objects.
static TOOL_ACTION rotateCw
Rotation of selected objects.
static TOOL_ACTION rotateCcw
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
EDA_ITEM * GetItem(const KIID &aId) const override
Fetch an item by KIID.
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions, bool aRefresh=true)
Updates the current display options from the given options struct.
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide()
virtual void SetActiveLayer(PCB_LAYER_ID aLayer)
HIGH_CONTRAST_MODE m_ContrastModeDisplay
How inactive layers are displayed.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
bool IsProxyItem() const override
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
void Move(const VECTOR2I &aMoveVector) override
Move this object.
static SELECTION_CONDITION HasType(KICAD_T aType)
Create a functor that tests if among the selected items there is at least one of a given type.
static SELECTION_CONDITION Count(int aNumber)
Create a functor that tests if the number of selected items is equal to the value given as parameter.
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
static SELECTION_CONDITION OnlyTypes(std::vector< KICAD_T > aTypes)
Create a functor that tests if the selected items are only of given types.
int Size() const
Returns the number of selected parts.
A modified version of the wxInfoBar class that allows us to:
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
static bool empty(const wxTextEntryBase *aCtrl)
#define ENTERED
indicates a group has been entered
wxString KeyNameFromKeyCode(int aKeycode, bool *aIsFound)
Return the key name from the key code.
PCB_LAYER_ID
A quick note on layer IDs:
This file contains miscellaneous commonly used macros and functions.
@ REPAINT
Item needs to be redrawn.
@ ALL
All except INITIAL_ADD.
@ CONN
Like smd, does not appear on the solder paste layer (default) Note: also has a special attribute in G...
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)
std::function< bool(const SELECTION &)> SELECTION_CONDITION
Functor type that checks a specific condition for selected items.
constexpr int mmToIU(double mm) const
Parameters for sequential pad numbering.
@ PCB_PAD_T
class PAD, a pad in a footprint
VECTOR2< int32_t > VECTOR2I
#define ZONE_THERMAL_RELIEF_COPPER_WIDTH_MM