55 using namespace std::placeholders;
57 #include <wx/hyperlink.h> 70 m_selectionTool(
NULL ),
80 m_statusPopup = std::make_unique<STATUS_TEXT_POPUP>( getEditFrame<PCB_BASE_EDIT_FRAME>() );
105 auto inFootprintEditor =
114 auto noActiveToolCondition =
120 auto notMovingCondition =
127 auto noItemsCondition =
128 [ this ](
const SELECTION& aSelections ) ->
bool 160 auto specialToolsSubMenu = std::make_shared<SPECIAL_TOOLS_CONTEXT_MENU>(
this );
184 FOOTPRINT* fp = getEditFrame<PCB_BASE_FRAME>()->GetFootprintFromBoardByReference();
217 if(
theRouter->CanInlineDrag( aDragMode ) )
254 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
262 aCollector.
Remove( item );
306 bool restore_state =
false;
317 tanStart.
A = tanIntersect;
319 tanEnd.A = tanIntersect;
320 tanEnd.B = theArc->
GetEnd();
324 auto getUniqueTrackAtAnchorCollinear =
328 auto itemsOnAnchor = conn->GetConnectedItemsAtAnchor( theArc, aAnchor, track_types );
329 TRACK* retval =
nullptr;
331 if( itemsOnAnchor.size() == 1 && itemsOnAnchor.front()->Type() ==
PCB_TRACE_T )
333 retval = static_cast<TRACK*>( itemsOnAnchor.front() );
337 if( !trackSeg.ApproxCollinear( aCollinearSeg ) )
344 retval->
SetStart( (wxPoint) aAnchor );
345 retval->
SetEnd( (wxPoint) aAnchor );
356 TRACK* trackOnStart = getUniqueTrackAtAnchorCollinear( theArc->
GetStart(), tanStart);
357 TRACK* trackOnEnd = getUniqueTrackAtAnchorCollinear( theArc->
GetEnd(), tanEnd );
360 ARC* theArcCopy =
new ARC( *theArc );
361 TRACK* trackOnStartCopy =
new TRACK( *trackOnStart );
362 TRACK* trackOnEndCopy =
new TRACK( *trackOnEnd );
367 tanStart.
B = trackOnStart->
GetEnd();
370 if( trackOnEnd->GetLength() > tanEnd.Length() )
372 tanEnd.A = trackOnEnd->GetStart();
373 tanEnd.B = trackOnEnd->GetEnd();
376 auto isTrackStartClosestToArcStart =
377 [&](
TRACK* aPointA ) ->
bool 383 bool isStartTrackOnStartPt = isTrackStartClosestToArcStart( trackOnStart );
384 bool isEndTrackOnStartPt = isTrackStartClosestToArcStart( trackOnEnd );
413 auto getFurthestPointToTanInterstect =
416 if( ( aPointA - tanIntersect ).EuclideanNorm()
429 VECTOR2I tanStartPoint = getFurthestPointToTanInterstect( tanStart.
A, tanStart.
B );
430 VECTOR2I tanEndPoint = getFurthestPointToTanInterstect( tanEnd.A, tanEnd.B );
431 VECTOR2I tempTangentPoint = tanEndPoint;
433 if( getFurthestPointToTanInterstect( tanStartPoint, tanEndPoint ) == tanEndPoint )
434 tempTangentPoint = tanStartPoint;
440 SEG cSegTanStart( maxTanPtStart, tanIntersect );
441 SEG cSegTanEnd( maxTanPtEnd, tanIntersect );
442 SEG cSegChord( maxTanPtStart, maxTanPtEnd );
444 int cSegTanStartSide = cSegTanStart.
Side( theArc->
GetMid() );
445 int cSegTanEndSide = cSegTanEnd.
Side( theArc->
GetMid() );
446 int cSegChordSide = cSegChord.
Side( theArc->
GetMid() );
459 std::vector<VECTOR2I> possiblePoints;
466 for(
VECTOR2I candidate : possiblePoints )
494 theArc->
SetStart( (wxPoint) newStart );
495 theArc->
SetEnd( (wxPoint) newEnd );
496 theArc->
SetMid( (wxPoint) newMid );
498 if( isStartTrackOnStartPt )
499 trackOnStart->
SetStart( (wxPoint) newStart );
501 trackOnStart->
SetEnd( (wxPoint) newStart );
503 if( isEndTrackOnStartPt )
504 trackOnEnd->SetStart( (wxPoint) newEnd );
506 trackOnEnd->SetEnd( (wxPoint) newEnd );
514 if( evt->IsCancelInteractive() || evt->IsActivate() )
516 restore_state =
true;
521 restore_state =
true;
535 if( aTrack->
IsNew() )
544 aTrackCopy =
nullptr;
550 aTrackCopy =
nullptr;
558 aTrackCopy =
nullptr;
562 m_commit->Modified( aTrack, aTrackCopy );
566 processTrack( trackOnStart, trackOnStartCopy );
567 processTrack( trackOnEnd, trackOnEndCopy );
568 processTrack( theArc, theArcCopy );
618 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
623 aCollector.
Remove( item );
640 std::set<BOARD_ITEM*> to_add;
643 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
648 aCollector.
Remove( item );
657 aCollector.
Remove( item );
662 aCollector.
Append( item );
675 if( aPickReference && !
pickReferencePoint(
_(
"Select reference point for move..." ),
"",
"",
676 pickedReferencePoint ) )
685 std::vector<BOARD_ITEM*> sel_items;
689 BOARD_ITEM* boardItem = dynamic_cast<BOARD_ITEM*>( item );
693 sel_items.push_back( boardItem );
698 sel_items.push_back( pad );
702 bool restore_state =
false;
705 TOOL_EVENT* evt = const_cast<TOOL_EVENT*>( &aEvent );
716 grid.SetSnap( !evt->Modifier(
MD_SHIFT ) );
717 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->Modifier(
MD_ALT ) );
727 m_cursor = grid.BestSnapAnchor( mousePos, item_layers, sel_items );
746 totalMovement += movement;
755 if( !item->GetParent() || !item->GetParent()->IsSelected() )
756 static_cast<BOARD_ITEM*>( item )->Move( movement );
787 if( item->GetParent() && item->GetParent()->IsSelected() )
795 PCB_GROUP* group = static_cast<PCB_GROUP*>( item );
810 grid.SetAuxAxes(
false );
818 if( item->GetParent() && item->GetParent()->IsSelected() )
821 static_cast<BOARD_ITEM*>( item )->Move( movement );
828 std::vector<BOARD_ITEM*> items;
831 items.push_back( static_cast<BOARD_ITEM*>( item ) );
833 m_cursor = grid.BestDragOrigin( originalCursorPos, items );
865 else if( evt->IsCancelInteractive() || evt->IsActivate() )
867 if(
m_dragging && evt->IsCancelInteractive() )
868 evt->SetPassEvent(
false );
870 restore_state =
true;
876 restore_state =
true;
894 BOARD_ITEM* i = static_cast<BOARD_ITEM*>( item );
895 i->
Move( -totalMovement );
909 }
while( ( evt =
Wait() ) );
945 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
949 if( !dynamic_cast<TRACK*>( item ) )
950 aCollector.
Remove( item );
959 VIA* via = static_cast<VIA*>( item );
984 TRACK* track = dynamic_cast<TRACK*>( item );
995 m_commit->Push(
_(
"Edit track width/via size") );
1012 static long long filletRadiusIU = 0;
1018 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
1022 if( !dynamic_cast<TRACK*>( item ) )
1023 aCollector.
Remove( item );
1037 if( dia.ShowModal() == wxID_CANCEL )
1042 if( filletRadiusIU == 0 )
1045 "The fillet operation was not performed." ) );
1055 bool t1Start =
true;
1056 bool t2Start =
true;
1059 std::vector<FILLET_OP> filletOperations;
1061 bool operationPerformedOnAtLeastOne =
false;
1062 bool didOneAttemptFail =
false;
1063 std::set<TRACK*> processedTracks;
1067 TRACK* track = dyn_cast<TRACK*>( *it );
1075 auto processFilletOp =
1076 [&](
bool aStartPoint )
1078 wxPoint anchor = ( aStartPoint ) ? track->
GetStart() : track->
GetEnd();
1080 auto itemsOnAnchor = connectivity->GetConnectedItemsAtAnchor( track, anchor,
1083 if( itemsOnAnchor.size() > 0
1087 TRACK* trackOther = dyn_cast<TRACK*>( itemsOnAnchor.at( 0 ) );
1090 if( processedTracks.find( trackOther ) == processedTracks.end() )
1092 if( itemsOnAnchor.size() == 1 )
1095 filletOp.t1 = track;
1096 filletOp.t2 = trackOther;
1097 filletOp.t1Start = aStartPoint;
1098 filletOp.t2Start = track->
IsPointOnEnds( filletOp.t2->GetStart() );
1099 filletOperations.push_back( filletOp );
1105 didOneAttemptFail =
true;
1111 processFilletOp(
true );
1112 processFilletOp(
false );
1114 processedTracks.insert( track );
1117 std::vector<BOARD_ITEM*> itemsToAddToSelection;
1119 for( FILLET_OP filletOp : filletOperations )
1121 TRACK* track1 = filletOp.t1;
1122 TRACK* track2 = filletOp.t2;
1127 if( trackOnStart && trackOnEnd )
1130 if( ( trackOnStart || trackOnEnd ) && track1->
GetLayer() == track2->
GetLayer() )
1135 if( t1Seg.ApproxCollinear( t2Seg ) )
1138 SHAPE_ARC sArc( t1Seg, t2Seg, filletRadiusIU );
1140 wxPoint t1newPoint, t2newPoint;
1142 auto setIfPointOnSeg =
1143 []( wxPoint& aPointToSet,
SEG aSegment,
VECTOR2I aVecToTest )
1145 VECTOR2I segToVec = aSegment.NearestPoint( aVecToTest ) - aVecToTest;
1150 aPointToSet.
x = aVecToTest.x;
1151 aPointToSet.y = aVecToTest.y;
1159 if( !setIfPointOnSeg( t1newPoint, t1Seg, sArc.
GetP0() )
1160 && !setIfPointOnSeg( t2newPoint, t2Seg, sArc.
GetP0() ) )
1162 didOneAttemptFail =
true;
1166 if( !setIfPointOnSeg( t1newPoint, t1Seg, sArc.
GetP1() )
1167 && !setIfPointOnSeg( t2newPoint, t2Seg, sArc.
GetP1() ) )
1169 didOneAttemptFail =
true;
1178 itemsToAddToSelection.push_back( tArc );
1183 if( filletOp.t1Start )
1186 track1->
SetEnd( t1newPoint );
1188 if( filletOp.t2Start )
1191 track2->
SetEnd( t2newPoint );
1193 operationPerformedOnAtLeastOne =
true;
1200 for(
BOARD_ITEM* item : itemsToAddToSelection )
1203 if( !operationPerformedOnAtLeastOne )
1205 else if( didOneAttemptFail )
1271 std::set<BOARD_ITEM*> added_items;
1274 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
1282 aCollector.
Remove( item );
1285 added_items.insert( item->
GetParent() );
1291 aCollector.
Remove( item );
1295 aCollector.
Append( item );
1327 static_cast<PCB_GROUP*>( item )->RunOnDescendants(
1335 static_cast<BOARD_ITEM*>( item )->Rotate( refPt, rotateAngle );
1363 static wxPoint
mirrorPointX(
const wxPoint& aPoint,
const wxPoint& aMirrorPoint )
1365 wxPoint mirrored = aPoint;
1367 mirrored.x -= aMirrorPoint.x;
1368 mirrored.x = -mirrored.x;
1369 mirrored.x += aMirrorPoint.x;
1411 std::set<BOARD_ITEM*> added_items;
1414 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
1422 aCollector.
Remove( item );
1425 added_items.insert( item->
GetParent() );
1430 aCollector.
Append( item );
1441 wxPoint mirrorPoint( refPoint.x, refPoint.y );
1450 switch( item->Type() )
1466 switch( item->Type() )
1470 FP_SHAPE* shape = static_cast<FP_SHAPE*>( item );
1471 shape->
Mirror( mirrorPoint,
false );
1477 FP_ZONE* zone = static_cast<FP_ZONE*>( item );
1478 zone->
Mirror( mirrorPoint,
false );
1484 FP_TEXT* text = static_cast<FP_TEXT*>( item );
1485 text->
Mirror( mirrorPoint,
false );
1491 PAD* pad = static_cast<PAD*>( item );
1530 std::set<BOARD_ITEM*> added_items;
1533 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
1541 aCollector.
Remove( item );
1544 added_items.insert( item->
GetParent() );
1550 aCollector.
Remove( item );
1554 aCollector.
Append( item );
1596 static_cast<PCB_GROUP*>( item )->RunOnDescendants( [&](
BOARD_ITEM* bItem )
1602 static_cast<BOARD_ITEM*>( item )->Flip( refPt, leftRight );
1606 m_commit->Push(
_(
"Change Side / Flip" ) );
1635 std::vector<BOARD_ITEM*> lockedItems;
1659 bool isHover = selectionCopy.
IsHover();
1663 if( isAlt && isHover
1669 if( selectionCopy.
Empty() )
1675 for(
EDA_ITEM* item : selectionCopy )
1682 parentGroup->
RemoveItem( static_cast<BOARD_ITEM*>( item ) );
1685 switch( item->Type() )
1689 FP_TEXT* text = static_cast<FP_TEXT*>( item );
1690 FOOTPRINT* parent = static_cast<FOOTPRINT*>( item->GetParent() );
1703 PAD* pad = static_cast<PAD*>( item );
1704 FOOTPRINT* parent = static_cast<FOOTPRINT*>( item->GetParent() );
1714 FP_ZONE* zone = static_cast<FP_ZONE*>( item );
1715 FOOTPRINT* parent = static_cast<FOOTPRINT*>( item->GetParent() );
1728 if( !isCut && selectionCopy.GetSize() == 1 )
1731 ZONE* zone = static_cast<ZONE*>( item );
1733 int outlineIdx, holeIdx;
1741 std::vector<ZONE*> toFill;
1742 toFill.emplace_back( zone );
1748 if( !filler.Fill( toFill ) )
1772 PCB_GROUP* group = static_cast<PCB_GROUP*>( item );
1776 if( bItem->GetParent() && bItem->GetParent()->Type() ==
PCB_FOOTPRINT_T )
1786 m_commit->Modify( bItem->GetParent() );
1788 bItem->GetParent()->Remove( bItem );
1796 removeItem( group );
1800 removeItem( aDescendant );
1814 if( enteredGroup && enteredGroup->
GetItems().empty() )
1837 std::set<BOARD_ITEM*> added_items;
1840 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
1845 aCollector.
Remove( item );
1851 aCollector.
Remove( item );
1854 added_items.insert( item->
GetParent() );
1859 aCollector.
Append( item );
1868 wxPoint translation;
1877 int ret = dialog.ShowModal();
1879 if( ret == wxID_OK )
1882 wxPoint selCenter( rp.
x, rp.
y );
1885 selCenter += translation;
1893 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( selItem );
1901 PCB_GROUP* group = static_cast<PCB_GROUP*>( item );
1910 item->
Move( translation );
1912 switch( rotationAnchor )
1918 item->
Rotate( selCenter, rotation );
1921 item->
Rotate( (wxPoint)
frame()->GetScreen()->m_LocalOrigin, rotation );
1924 item->
Rotate(
board()->GetDesignSettings().m_AuxOrigin, rotation );
1961 std::set<BOARD_ITEM*> added_items;
1964 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
1972 aCollector.
Remove( item );
1975 added_items.insert( item->
GetParent() );
1980 aCollector.
Append( item );
1994 std::vector<BOARD_ITEM*> new_items;
2003 BOARD_ITEM* orig_item = static_cast<BOARD_ITEM*>( item );
2010 if( increment && item->Type() ==
PCB_PAD_T 2017 static_cast<PAD*>( dupe_item )->SetName( padName );
2024 m_commit->Modify( parentFootprint );
2025 dupe_item = parentFootprint->
DuplicateItem( orig_item,
true );
2029 switch( orig_item->
Type() )
2046 dupe_item = static_cast<PCB_GROUP*>( orig_item )->DeepDuplicate();
2059 static_cast<PCB_GROUP*>( dupe_item )->RunOnDescendants(
2070 new_items.push_back( dupe_item );
2085 (
int) new_items.size() ) );
2115 std::set<BOARD_ITEM*> added_items;
2118 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
2126 aCollector.
Remove( item );
2129 added_items.insert( item->
GetParent() );
2134 aCollector.
Append( item );
2154 for(
int i = aCollector.
GetCount() - 1; i >= 0; i-- )
2156 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aCollector[i] );
2167 for(
int i = aCollector.
GetCount() - 1; i >= 0; i-- )
2169 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aCollector[i] );
2183 if( aSelection.
Size() == 1 )
2185 auto item = static_cast<BOARD_ITEM*>( aSelection.
Front() );
2186 auto pos = item->GetPosition();
2201 const wxString& aCanceledMessage,
VECTOR2I& aReferencePoint )
2210 [&](
const VECTOR2D& aPoint ) ->
bool 2212 pickedPoint = aPoint;
2214 if( !aSuccessMessage.empty() )
2230 m_statusPopup->Move( wxGetMousePosition() + wxPoint( 20, -50 ) );
2236 if( !aCanceledMessage.empty() )
2248 [&](
const int& aFinalState )
2253 m_statusPopup->Move( wxGetMousePosition() + wxPoint( 20, -50 ) );
2256 std::string tool =
"";
2263 evt->SetPassEvent();
2271 if( pickedPoint.is_initialized() )
2272 aReferencePoint = pickedPoint.get();
2274 return pickedPoint.is_initialized();
2280 std::string tool =
"pcbnew.InteractiveEdit.selectReferencePoint";
2290 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
2297 aCollector.
Remove( item );
2304 std::vector<BOARD_ITEM*> items;
2307 items.push_back( static_cast<BOARD_ITEM*>( item ) );
2314 _(
"Selection copied" ),
2315 _(
"Copy cancelled" ),
2328 frame()->SetStatusText(
_(
"Selection copied" ) );
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
static TOOL_ACTION selectItems
Select a list of items (specified as the event parameter)
long long GetValue()
Returns the value in internal units.
int Length() const
Return the length (this).
static TOOL_ACTION selectionClear
Clear the current selection.
VECTOR2I GetReferencePoint() const
PCB_GROUP * GetParentGroup() const
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
void ClearReferencePoint()
void FlipPrimitives(bool aFlipLeftRight)
Flip (mirror) the primitives left to right or top to bottom, around the anchor position in custom pad...
void SetOffset(const wxPoint &aOffset)
virtual wxPoint GetCenter() const override
This defaults to the center of the bounding box if not overridden.
static TOOL_ACTION move
move or drag an item
static TOOL_ACTION deleteFull
class ALIGNED_DIMENSION, a linear dimension (graphic item)
class LEADER, a leader dimension (graphic item)
void RemoveCutout(int aOutlineIdx, int aHoleIdx)
Remove a cutout from the zone.
double GetLineLength(const wxPoint &aPointA, const wxPoint &aPointB)
Return the length of a line segment defined by aPointA and aPointB.
class FP_TEXT, text in a footprint
static const KICAD_T Tracks[]
A scan list for only TRACKs.
virtual VECTOR2D GetMousePosition(bool aWorldCoordinates=true) const =0
Return the current mouse pointer position.
static TOOL_ACTION editFpInFpEditor
int GetCurrentViaDrill() const
static TOOL_ACTION pageSettings
int GetCurrentTrackWidth() const
static TOOL_ACTION changeTrackWidth
Update selected tracks & vias to the current track & via dimensions.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
This file is part of the common library.
static TOOL_ACTION doDelete
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
void SetEnd(const wxPoint &aEnd)
bool HasType(KICAD_T aType) const
Checks if there is at least one item of requested kind.
class PCB_GROUP, a set of BOARD_ITEMs
NETINFO_ITEM * GetNet() const
Return #NET_INFO object for a given item.
const wxPoint & GetStart() const
A set of BOARD_ITEMs (i.e., without duplicates).
static SELECTION_CONDITION OnlyTypes(const KICAD_T aTypes[])
Create a functor that tests if the selected items are only of given types.
class CENTER_DIMENSION, a center point marking (graphic item)
virtual NETCLASS * GetNetClass() const
Return the NETCLASS for this item.
virtual VECTOR2I GetCenter() const
Returns the center point of the selection area bounding box.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
static TOOL_ACTION dragFreeAngle
virtual void OnEditItemRequest(BOARD_ITEM *aItem)=0
Install the corresponding dialog editor for the given item.
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
static TOOL_ACTION properties
Activation of the edit tool.
class PCB_TEXT, text on a layer
static TOOL_ACTION selectConnection
Select tracks between junctions or expands an existing selection to pads or the entire connection.
class ARC, an arc track segment on a copper layer
static TOOL_ACTION getAndPlace
Find an item and start moving.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
static TOOL_ACTION drag45Degree
static TOOL_ACTION mirror
Mirroring of selected items.
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false, long aArrowCommand=0)=0
Move cursor to the requested position expressed in world coordinates.
static TOOL_ACTION changeFootprint
class FP_SHAPE, a footprint edge
class PAD, a pad in a footprint
bool HitTestDrawingSheetItems(KIGFX::VIEW *aView, const wxPoint &aPosition)
PAD_SHAPE_T GetShape() const
static TOOL_ACTION updateFootprint
OPT_VECTOR2I IntersectLines(const SEG &aSeg) const
Compute the intersection point of lines passing through ends of (this) and aSeg.
void UndoRedoBlock(bool aBlock=true)
Enable/disable undo and redo operations.
virtual MAGNETIC_SETTINGS * GetMagneticItemsSettings()
virtual wxPoint GetPosition() const
void SetDelta(const wxSize &aSize)
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.
void SetBoard(BOARD *aBoard)
std::unordered_set< BOARD_ITEM * > & GetItems()
static bool NotEmpty(const SELECTION &aSelection)
Test if there are any items selected.
void Mirror(const wxPoint &aCentre, bool aMirrorAroundXAxis)
Mirror text position in footprint editing the text itself is not mirrored, and the layer not modified...
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
void SetCurrentCursor(KICURSOR cursor)
Set the current cursor shape for this panel.
search types array terminator (End Of Types)
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
CIRCLE & ConstructFromTanTanPt(const SEG &aLineA, const SEG &aLineB, const VECTOR2I &aP)
Constructs this circle such that it is tangent to the given segmetns and passes through the given poi...
class TRACK, a track segment (segment on a copper layer)
void InstallNewProgressReporter(wxWindow *aParent, const wxString &aTitle, int aNumPhases)
const VC_SETTINGS & GetSettings() const
Apply VIEW_CONTROLS settings from an object.
void SetWidth(int aWidth)
static TOOL_ACTION moveExact
Activation of the exact move tool.
DS_PROXY_VIEW_ITEM * GetDrawingSheet() const
static TOOL_ACTION pickerTool
void Append(EDA_ITEM *item)
Add an item to the end of the list.
static TOOL_ACTION filletTracks
Fillet (i.e. adds an arc tangent to) all selected straight tracks by a user defined radius.
bool HitTestCutout(const VECTOR2I &aRefPos, int *aOutlineIdx=nullptr, int *aHoleIdx=nullptr) const
Tests if the given point is contained within a cutout of the zone.
void ShowInfoBarMsg(const wxString &aMsg, bool aShowCloseButton=false)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an info icon on the left of...
int GetCount() const
Return the number of objects in the list.
void SetReferencePoint(const VECTOR2I &aP)
static TOOL_ACTION duplicateIncrement
Activation of the duplication tool with incrementing (e.g. pad number)
const wxPoint & GetOffset() const
VECTOR2I LineProject(const VECTOR2I &aP) const
Compute the perpendicular projection point of aP on a line passing through ends of the segment.
static TOOL_ACTION rotateCw
Rotation of selected objects.
LSET is a set of PCB_LAYER_IDs.
const wxPoint & GetMid() const
void SetFlags(STATUS_FLAGS aMask)
FOOTPRINT * GetFirstFootprint() const
Gets the first footprint on the board or nullptr.
double GetOrientation() const
Return the rotation angle of the pad in a variety of units (the basic call returns tenths of degrees)...
An extension of WX_TEXT_ENTRY_DIALOG that uses UNIT_BINDER to request a dimension (e....
const VECTOR2I GetArcMid(const VECTOR2I &aStart, const VECTOR2I &aEnd, const VECTOR2I &aCenter, bool aMinArcAngle=true)
Returns the middle point of an arc, half-way between aStart and aEnd.
bool ApproxParallel(const SEG &aSeg) const
virtual EDA_RECT GetBoundingBox() const
void HatchBorder()
Function HatchBorder computes the hatch lines depending on the hatch parameters and stores it in the ...
TEXT_TYPE GetType() const
virtual void Move(const wxPoint &aMoveVector)
Move this object.
bool PadCanHaveName(const PAD &aPad)
Check if a pad should be named.
const VECTOR2I & GetP0() const
A collection of nets and the parameters used to route or test these nets.
static TOOL_ACTION createArray
Tool for creating an array of objects.
static const int MIN_PRECISION_IU
This is the minimum precision for all the points in a shape.
bool Contains(EDA_ITEM *aItem) const
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
bool HasItem(const EDA_ITEM *aItem) const
Tests if aItem has already been collected.
const VECTOR2I NearestPoint(const VECTOR2I &aP) const
Compute a point on the segment (this) that is closest to point aP.
An interface for classes handling user events controlling the view behavior such as zooming,...
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Place the cursor immediately at a given point.
bool RemoveItem(BOARD_ITEM *aItem)
Remove item from group.
ZONE handles a list of polygons defining a copper zone.
VECTOR2I BestDragOrigin(const VECTOR2I &aMousePos, std::vector< BOARD_ITEM * > &aItem)
int Radius
Public to make access simpler.
class ZONE, a copper pour area
static const TOOL_EVENT SelectedItemsMoved
Used to inform tools that the selection should temporarily be non-editable.
Class Circle Represents basic circle geometry with utility geometry functions.
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Rotate this object.
int GetuViaDiameter() const
void RunOnDescendants(const std::function< void(BOARD_ITEM *)> &aFunction) const
Invoke a function on all descendants of the group.
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
static TOOL_ACTION copyWithReference
copy command with manual reference point selection
void SetMid(const wxPoint &aMid)
static TOOL_ACTION routerInlineDrag
Activation of the Push and Shove router (inline dragging mode)
static TOOL_ACTION hideDynamicRatsnest
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
bool Empty() const
Checks if there is anything selected.
class PCB_TARGET, a target (graphic item)
static TOOL_ACTION inlineBreakTrack
Breaks track when router is not activated.
class FOOTPRINT, a footprint
virtual unsigned int GetSize() const override
Return the number of stored items.
static TOOL_ACTION rotateCcw
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
const wxSize & GetDelta() const
static ROUTER * theRouter
static TOOL_ACTION flip
Flipping of selected objects.
static const KICAD_T DraggableItems[]
A scan list for items that can be dragged.
int GetCurrentViaSize() const
virtual bool IsLocked() const
bool HasReferencePoint() const
class MARKER_PCB, a marker used to show something
void SetNet(NETINFO_ITEM *aNetInfo)
Set a NET_INFO object for the item.
STATUS_FLAGS IsPointOnEnds(const wxPoint &point, int min_dist=0) const
Function IsPointOnEnds returns STARTPOINT if point if near (dist = min_dist) start point,...
Common, abstract interface for edit frames.
wxPoint GetPosition() const override
long m_lastKeyboardCursorCommand
Position of the above event.
Used when the right click button is pressed, or when the select tool is in effect.
bool m_lastKeyboardCursorPositionValid
ACTIONS::CURSOR_UP, ACTIONS::CURSOR_DOWN, etc.
void SetPosition(const wxPoint &aPos) override
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
void Mirror(const wxPoint &aCentre, bool aMirrorAroundXAxis)
Mirror an edge of the footprint.
class ZONE, managed by a footprint
static SELECTION_CONDITION OnlyType(KICAD_T aType)
Create a functor that tests if the selected items are only of given type.
VECTOR2I Center
Public to make access simpler.
void SetDrill(int aDrill)
Function SetDrill sets the drill value for vias.
PCBNEW_SETTINGS & Settings()
int Size() const
Returns the number of selected parts.
VIATYPE GetViaType() const
void Mirror(const wxPoint &aMirrorRef, bool aMirrorLeftRight)
Function Mirror Mirror the outlines , relative to a given horizontal axis the layer is not changed.
A base class for most all the KiCad significant classes used in schematics and boards.
static TOOL_ACTION positionRelative
Activation of the position relative tool.
const wxPoint & GetEnd() const
virtual double GetLength() const
Function GetLength returns the length of the track using the hypotenuse calculation.
void SetStart(const wxPoint &aStart)
virtual BOARD_ITEM * Duplicate() const
Create a copy of a of this BOARD_ITEM.
class ORTHOGONAL_DIMENSION, a linear dimension constrained to x/y
class VIA, a via (like a track segment on a copper layer)
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
drawingsheet frame and titleblock
static TOOL_ACTION updateLocalRatsnest
bool InlineDragEnabled() const
void SaveSelection(const PCB_SELECTION &selected, bool isFootprintEditor)
BOARD_ITEM_CONTAINER * GetParent() const
static TOOL_ACTION moveWithReference
move with a reference point
class PCB_SHAPE, a segment not on copper layers
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
static TOOL_ACTION selectAll
const LSET GetSelectionLayers()
ROUTING_SETTINGS & Settings()
#define IS_NEW
New item, just created.
const VECTOR2I & GetP1() const
FP_ZONE is a specialization of ZONE for use in footprints.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
static TOOL_ACTION duplicate
void SetOrientation(double aAngle)
Set the rotation angle of the pad.
static TOOL_ACTION refreshPreview
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
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...
int Side(const VECTOR2I &aP) const
Determine on which side of directed line passing via segment ends point aP lies.
void DisplayToolMsg(const wxString &msg) override
KICAD_T Type() const
Returns the type of object.
VECTOR2I NearestPoint(const VECTOR2I &aP) const
Function NearestPoint()
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.