55 using namespace std::placeholders;
57 #include <wx/hyperlink.h> 70 m_selectionTool( nullptr ),
80 m_statusPopup = std::make_unique<STATUS_TEXT_POPUP>( getEditFrame<PCB_BASE_EDIT_FRAME>() );
105 auto propertiesCondition =
108 if( aSel.GetSize() == 0 )
122 if( aSel.GetSize() == 1 )
127 if( !dynamic_cast<PCB_TRACK*>( item ) )
134 auto inFootprintEditor =
143 auto noActiveToolCondition =
149 auto notMovingCondition =
156 auto noItemsCondition =
157 [ this ](
const SELECTION& aSelections ) ->
bool 166 && notMovingCondition );
189 auto specialToolsSubMenu = std::make_shared<SPECIAL_TOOLS_CONTEXT_MENU>(
this );
220 FOOTPRINT* fp = getEditFrame<PCB_BASE_FRAME>()->GetFootprintFromBoardByReference();
254 if(
theRouter->CanInlineDrag( aDragMode ) )
257 static_cast<intptr_t>( aDragMode ) );
294 if( aCollector.
GetCount() == 2 && dynamic_cast<PCB_TRACK*>( aCollector[0] ) )
298 PCB_TRACK* a = static_cast<PCB_TRACK*>( aCollector[0] );
299 PCB_TRACK* b = static_cast<PCB_TRACK*>( aCollector[1] );
300 const auto& c = aCollector[0]->GetBoard()->GetConnectivity();
303 auto connectedItems = c->GetConnectedItemsAtAnchor( a, aPt, types, dist );
337 double arcAngleDegrees = std::abs( theArc->
GetAngle() ) / 10.0;
354 bool restore_state =
false;
361 tanStart.
A = tanIntersect;
363 tanEnd.A = tanIntersect;
364 tanEnd.B = theArc->
GetEnd();
368 auto getUniqueTrackAtAnchorCollinear =
374 int allowedDeviation = theArc->
GetWidth();
376 std::vector<BOARD_CONNECTED_ITEM*> itemsOnAnchor;
378 for(
int i = 0; i < 3; i++ )
380 itemsOnAnchor = conn->GetConnectedItemsAtAnchor( theArc, aAnchor, track_types,
382 allowedDeviation /= 2;
384 if( itemsOnAnchor.size() == 1 )
390 if( itemsOnAnchor.size() == 1 && itemsOnAnchor.front()->Type() ==
PCB_TRACE_T )
392 retval = static_cast<PCB_TRACK*>( itemsOnAnchor.front() );
396 if( trackSeg.AngleDegrees( aCollinearSeg )
406 retval->
SetStart( (wxPoint) aAnchor );
407 retval->
SetEnd( (wxPoint) aAnchor );
419 PCB_TRACK* trackOnStart = getUniqueTrackAtAnchorCollinear( theArc->
GetStart(), tanStart);
420 PCB_TRACK* trackOnEnd = getUniqueTrackAtAnchorCollinear( theArc->
GetEnd(), tanEnd );
430 tanStart.
B = trackOnStart->
GetEnd();
433 if( trackOnEnd->GetLength() != 0 )
435 tanEnd.A = trackOnEnd->GetStart();
436 tanEnd.B = trackOnEnd->GetEnd();
442 auto isTrackStartClosestToArcStart =
448 return trackStartToArcStart < trackEndToArcStart;
451 bool isStartTrackOnStartPt = isTrackStartClosestToArcStart( trackOnStart );
452 bool isEndTrackOnStartPt = isTrackStartClosestToArcStart( trackOnEnd );
481 auto getFurthestPointToTanInterstect =
484 if( ( aPointA - tanIntersect ).EuclideanNorm()
496 VECTOR2I tanStartPoint = getFurthestPointToTanInterstect( tanStart.
A, tanStart.
B );
497 VECTOR2I tanEndPoint = getFurthestPointToTanInterstect( tanEnd.A, tanEnd.B );
498 VECTOR2I tempTangentPoint = tanEndPoint;
500 if( getFurthestPointToTanInterstect( tanStartPoint, tanEndPoint ) == tanEndPoint )
501 tempTangentPoint = tanStartPoint;
507 SEG cSegTanStart( maxTanPtStart, tanIntersect );
508 SEG cSegTanEnd( maxTanPtEnd, tanIntersect );
509 SEG cSegChord( maxTanPtStart, maxTanPtEnd );
511 int cSegTanStartSide = cSegTanStart.
Side( theArc->
GetMid() );
512 int cSegTanEndSide = cSegTanEnd.
Side( theArc->
GetMid() );
513 int cSegChordSide = cSegChord.
Side( theArc->
GetMid() );
515 bool eatFirstMouseUp =
true;
527 std::vector<VECTOR2I> possiblePoints;
534 for(
VECTOR2I candidate : possiblePoints )
536 if( ( candidate -
m_cursor ).SquaredEuclideanNorm()
537 < ( closest -
m_cursor ).SquaredEuclideanNorm() )
562 theArc->
SetStart( (wxPoint) newStart );
563 theArc->
SetEnd( (wxPoint) newEnd );
564 theArc->
SetMid( (wxPoint) newMid );
566 if( isStartTrackOnStartPt )
567 trackOnStart->
SetStart( (wxPoint) newStart );
569 trackOnStart->
SetEnd( (wxPoint) newStart );
571 if( isEndTrackOnStartPt )
572 trackOnEnd->SetStart( (wxPoint) newEnd );
574 trackOnEnd->SetEnd( (wxPoint) newEnd );
582 if( evt->IsMotion() || evt->IsDrag(
BUT_LEFT ) )
584 eatFirstMouseUp =
false;
586 else if( evt->IsCancelInteractive() || evt->IsActivate() )
588 restore_state =
true;
593 restore_state =
true;
602 eatFirstMouseUp =
false;
614 if( aTrack->
IsNew() )
618 if( aTrack->
GetLength() <= aMaxLengthIU )
623 aTrackCopy =
nullptr;
630 aTrackCopy =
nullptr;
634 else if( aTrack->
GetLength() <= aMaxLengthIU )
639 aTrackCopy =
nullptr;
644 m_commit->Modified( aTrack, aTrackCopy );
651 wxPoint newStart = trackOnStart->
GetStart();
652 wxPoint newEnd = trackOnEnd->GetStart();
654 if( isStartTrackOnStartPt )
655 newStart = trackOnStart->
GetEnd();
657 if( isEndTrackOnStartPt )
658 newEnd = trackOnEnd->GetEnd();
662 if( !processTrack( trackOnStart, trackOnStartCopy, maxLengthIU ) )
665 if( !processTrack( trackOnEnd, trackOnEndCopy, maxLengthIU ) )
668 processTrack( theArc, theArcCopy, 0 );
757 if( aPickReference && !
pickReferencePoint(
_(
"Select reference point for move..." ),
"",
"",
758 pickedReferencePoint ) )
767 std::vector<BOARD_ITEM*> sel_items;
768 std::vector<BOARD_ITEM*> orig_items;
772 BOARD_ITEM* boardItem = dynamic_cast<BOARD_ITEM*>( item );
777 orig_items.push_back( boardItem );
778 sel_items.push_back( boardItem );
784 sel_items.push_back(
pad );
792 bool restore_state =
false;
800 bool eatFirstMouseUp =
true;
801 bool hasRedrawn3D =
false;
813 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
815 if( evt->IsMotion() || evt->IsDrag(
BUT_LEFT ) )
816 eatFirstMouseUp =
false;
824 bool redraw3D =
false;
828 m_cursor =
grid.BestSnapAnchor( mousePos, item_layers, sel_items );
856 totalMovement += movement;
865 if( !item->GetParent() || !item->GetParent()->IsSelected() )
866 static_cast<BOARD_ITEM*>( item )->Move( movement );
872 if( redraw3D && allowRedraw3D )
906 if( item->GetParent() && item->GetParent()->IsSelected() )
929 grid.SetAuxAxes(
false );
943 if( item->GetParent() && item->GetParent()->IsSelected() )
946 static_cast<BOARD_ITEM*>( item )->Move( movement );
953 std::vector<BOARD_ITEM*> items;
956 items.push_back( static_cast<BOARD_ITEM*>( item ) );
958 m_cursor =
grid.BestDragOrigin( originalCursorPos, items );
992 else if( evt->IsCancelInteractive() || evt->IsActivate() )
994 if(
m_dragging && evt->IsCancelInteractive() )
995 evt->SetPassEvent(
false );
997 restore_state =
true;
1002 restore_state =
true;
1008 evt->SetPassEvent();
1013 evt->SetPassEvent();
1021 eatFirstMouseUp =
false;
1022 evt->SetPassEvent();
1029 BOARD_ITEM* i = static_cast<BOARD_ITEM*>( item );
1030 i->
Move( -totalMovement );
1040 eatFirstMouseUp =
false;
1049 evt->SetPassEvent(
false );
1053 evt->SetPassEvent();
1056 }
while( ( evt =
Wait() ) );
1065 if( hasRedrawn3D && restore_state )
1085 if( !is_hover && !restore_state )
1091 return restore_state ? -1 : 0;
1101 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
1105 if( !dynamic_cast<PCB_TRACK*>( item ) )
1106 aCollector.
Remove( item );
1115 PCB_VIA*
via = static_cast<PCB_VIA*>( item );
1135 via->SetDrill( new_drill );
1136 via->SetWidth( new_width );
1140 PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( item );
1142 wxCHECK( track, 0 );
1151 m_commit->Push(
_(
"Edit track width/via size") );
1168 static long long filletRadiusIU = 0;
1174 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
1178 if( !dynamic_cast<PCB_TRACK*>( item ) )
1179 aCollector.
Remove( item );
1193 if( dia.ShowModal() == wxID_CANCEL )
1198 if( filletRadiusIU == 0 )
1201 "The fillet operation was not performed." ) );
1210 bool t1Start =
true;
1211 bool t2Start =
true;
1214 std::vector<FILLET_OP> filletOperations;
1216 bool operationPerformedOnAtLeastOne =
false;
1217 bool didOneAttemptFail =
false;
1218 std::set<PCB_TRACK*> processedTracks;
1222 PCB_TRACK* track = dyn_cast<PCB_TRACK*>( *it );
1229 auto processFilletOp =
1230 [&](
bool aStartPoint )
1234 auto itemsOnAnchor = connectivity->GetConnectedItemsAtAnchor( track,
anchor,
1237 if( itemsOnAnchor.size() > 0
1241 PCB_TRACK* trackOther = dyn_cast<PCB_TRACK*>( itemsOnAnchor.at( 0 ) );
1244 if( processedTracks.find( trackOther ) == processedTracks.end() )
1246 if( itemsOnAnchor.size() == 1 )
1249 filletOp.t1 = track;
1250 filletOp.t2 = trackOther;
1251 filletOp.t1Start = aStartPoint;
1252 filletOp.t2Start = track->
IsPointOnEnds( filletOp.t2->GetStart() );
1253 filletOperations.push_back( filletOp );
1259 didOneAttemptFail =
true;
1265 processFilletOp(
true );
1266 processFilletOp(
false );
1268 processedTracks.insert( track );
1271 std::vector<BOARD_ITEM*> itemsToAddToSelection;
1273 for( FILLET_OP filletOp : filletOperations )
1281 if( trackOnStart && trackOnEnd )
1284 if( ( trackOnStart || trackOnEnd ) && track1->
GetLayer() == track2->
GetLayer() )
1289 if( t1Seg.ApproxCollinear( t2Seg ) )
1292 SHAPE_ARC sArc( t1Seg, t2Seg, filletRadiusIU );
1294 wxPoint t1newPoint, t2newPoint;
1296 auto setIfPointOnSeg =
1297 []( wxPoint& aPointToSet,
SEG aSegment,
VECTOR2I aVecToTest )
1299 VECTOR2I segToVec = aSegment.NearestPoint( aVecToTest ) - aVecToTest;
1304 aPointToSet.
x = aVecToTest.x;
1305 aPointToSet.y = aVecToTest.y;
1313 if( !setIfPointOnSeg( t1newPoint, t1Seg, sArc.
GetP0() )
1314 && !setIfPointOnSeg( t2newPoint, t2Seg, sArc.
GetP0() ) )
1316 didOneAttemptFail =
true;
1320 if( !setIfPointOnSeg( t1newPoint, t1Seg, sArc.
GetP1() )
1321 && !setIfPointOnSeg( t2newPoint, t2Seg, sArc.
GetP1() ) )
1323 didOneAttemptFail =
true;
1333 itemsToAddToSelection.push_back( tArc );
1338 if( filletOp.t1Start )
1341 track1->
SetEnd( t1newPoint );
1343 if( filletOp.t2Start )
1346 track2->
SetEnd( t2newPoint );
1348 operationPerformedOnAtLeastOne =
true;
1355 for(
BOARD_ITEM* item : itemsToAddToSelection )
1358 if( !operationPerformedOnAtLeastOne )
1360 else if( didOneAttemptFail )
1415 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( eda_item );
1494 static_cast<PCB_GROUP*>( item )->RunOnDescendants(
1502 static_cast<BOARD_ITEM*>( item )->Rotate( refPt, rotateAngle );
1530 static wxPoint
mirrorPointX(
const wxPoint& aPoint,
const wxPoint& aMirrorPoint )
1532 wxPoint mirrored = aPoint;
1534 mirrored.x -= aMirrorPoint.x;
1535 mirrored.x = -mirrored.x;
1536 mirrored.x += aMirrorPoint.x;
1589 wxPoint mirrorPoint( refPoint.x, refPoint.y );
1598 switch( item->Type() )
1614 switch( item->Type() )
1618 FP_SHAPE* shape = static_cast<FP_SHAPE*>( item );
1619 shape->
Mirror( mirrorPoint,
false );
1625 FP_ZONE* zone = static_cast<FP_ZONE*>( item );
1626 zone->
Mirror( mirrorPoint,
false );
1633 text->Mirror( mirrorPoint,
false );
1639 PAD*
pad = static_cast<PAD*>( item );
1720 static_cast<PCB_GROUP*>( item )->RunOnDescendants( [&](
BOARD_ITEM* bItem )
1726 static_cast<BOARD_ITEM*>( item )->Flip( refPt, leftRight );
1730 m_commit->Push(
_(
"Change Side / Flip" ) );
1759 std::vector<BOARD_ITEM*> lockedItems;
1820 for(
EDA_ITEM* item : selectionCopy )
1827 parentGroup->
RemoveItem( static_cast<BOARD_ITEM*>( item ) );
1830 switch( item->Type() )
1835 FOOTPRINT* parent = static_cast<FOOTPRINT*>( item->GetParent() );
1850 PAD*
pad = static_cast<PAD*>( item );
1851 FOOTPRINT* parent = static_cast<FOOTPRINT*>( item->GetParent() );
1862 FP_ZONE* zone = static_cast<FP_ZONE*>( item );
1863 FOOTPRINT* parent = static_cast<FOOTPRINT*>( item->GetParent() );
1876 if( !isCut && selectionCopy.GetSize() == 1 )
1879 ZONE* zone = static_cast<ZONE*>( item );
1881 int outlineIdx, holeIdx;
1915 if( bItem->GetParent() && bItem->GetParent()->Type() ==
PCB_FOOTPRINT_T )
1921 FP_TEXT* textItem = static_cast<FP_TEXT*>( bItem );
1932 m_commit->Modify( bItem->GetParent() );
1934 bItem->GetParent()->Remove( bItem );
1942 removeItem(
group );
1946 removeItem( aDescendant );
1960 if( enteredGroup && enteredGroup->
GetItems().empty() )
1991 wxPoint translation;
2000 int ret = dialog.ShowModal();
2002 if( ret == wxID_OK )
2005 wxPoint selCenter( rp.
x, rp.
y );
2008 selCenter += translation;
2010 if( !
frame()->GetDisplayOptions().m_DisplayInvertYAxis )
2019 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( selItem );
2037 item->
Move( translation );
2039 switch( rotationAnchor )
2045 item->
Rotate( selCenter, rotation );
2048 item->
Rotate( (wxPoint)
frame()->GetScreen()->m_LocalOrigin, rotation );
2051 item->
Rotate(
board()->GetDesignSettings().GetAuxOrigin(), rotation );
2101 std::vector<BOARD_ITEM*> new_items;
2109 BOARD_ITEM* orig_item = static_cast<BOARD_ITEM*>( item );
2117 && static_cast<PAD*>( dupe_item )->CanHaveNumber() )
2123 static_cast<PAD*>( dupe_item )->SetNumber( padNumber );
2130 m_commit->Modify( parentFootprint );
2131 dupe_item = parentFootprint->
DuplicateItem( orig_item,
true );
2135 switch( orig_item->
Type() )
2153 dupe_item = static_cast<PCB_GROUP*>( orig_item )->DeepDuplicate();
2158 orig_item->
Type() ) );
2167 static_cast<PCB_GROUP*>( dupe_item )->RunOnDescendants(
2178 new_items.push_back( dupe_item );
2193 (
int) new_items.size() ) );
2246 for(
int i = aCollector.
GetCount() - 1; i >= 0; i-- )
2248 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aCollector[i] );
2259 for(
int i = aCollector.
GetCount() - 1; i >= 0; i-- )
2261 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aCollector[i] );
2275 if( aSelection.
Empty() )
2279 if( aSelection.
Size() == 1 )
2281 auto item = static_cast<BOARD_ITEM*>( aSelection.
Front() );
2282 auto pos = item->GetPosition();
2297 const wxString& aCanceledMessage,
VECTOR2I& aReferencePoint )
2309 [&](
const VECTOR2D& aPoint ) ->
bool 2311 pickedPoint = aPoint;
2313 if( !aSuccessMessage.empty() )
2329 m_statusPopup->Move( wxGetMousePosition() + wxPoint( 20, -50 ) );
2335 if( !aCanceledMessage.empty() )
2347 [&](
const int& aFinalState )
2352 m_statusPopup->Move( wxGetMousePosition() + wxPoint( 20, -50 ) );
2355 std::string tool =
"";
2362 evt->SetPassEvent();
2370 if( pickedPoint.is_initialized() )
2371 aReferencePoint = pickedPoint.get();
2373 return pickedPoint.is_initialized();
2379 std::string tool =
"pcbnew.InteractiveEdit.selectReferencePoint";
2382 getEditFrame<PCB_BASE_EDIT_FRAME>()->GetMagneticItemsSettings() );
2390 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
2397 aCollector.
Remove( item );
2406 std::vector<BOARD_ITEM*> items;
2409 items.push_back( static_cast<BOARD_ITEM*>( item ) );
2416 _(
"Selection copied" ),
2417 _(
"Copy canceled" ),
2433 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.
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...
size_t CountType(KICAD_T aType) const
void SetOffset(const wxPoint &aOffset)
virtual wxPoint GetCenter() const override
This defaults to the center of the bounding box if not overridden.
VECTOR2< T > GetVectorSnapped45(const VECTOR2< T > &aVec, bool only45=false)
Snap a vector onto the nearest 0, 45 or 90 degree line.
static TOOL_ACTION move
move or drag an item
static TOOL_ACTION footprintProperties
static TOOL_ACTION deleteFull
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
virtual VECTOR2I GetCenter() const
Returns the center point of the selection area bounding box.
class PCB_DIM_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.
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
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.
const wxPoint & GetEnd() const
const VECTOR2I CalcArcMid(const VECTOR2I &aStart, const VECTOR2I &aEnd, const VECTOR2I &aCenter, bool aMinArcAngle=true)
Return the middle point of an arc, half-way between aStart and aEnd.
#define IS_NEW
New item, just created.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
static TOOL_ACTION doDelete
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
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
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Rotate this object.
void SetEnd(const wxPoint &aEnd)
NETINFO_ITEM * GetNet() const
Return #NET_INFO object for a given item.
static constexpr double IU_PER_MM
Mock up a conversion function.
A set of BOARD_ITEMs (i.e., without duplicates).
virtual double GetLength() const
Function GetLength returns the length of the track using the hypotenuse calculation.
static SELECTION_CONDITION OnlyTypes(const KICAD_T aTypes[])
Create a functor that tests if the selected items are only of given types.
static TOOL_ACTION routerUndoLastSegment
class PCB_DIM_CENTER, a center point marking (graphic item)
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.
void SetFlags(EDA_ITEM_FLAGS aMask)
class PCB_TEXT, text on a layer
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
static TOOL_ACTION selectConnection
Select tracks between junctions or expands an existing selection to pads or the entire connection.
class PCB_ARC, an arc track segment on a copper layer
static TOOL_ACTION getAndPlace
Find an item and start moving.
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)
static TOOL_ACTION updateFootprint
OPT_VECTOR2I IntersectLines(const SEG &aSeg) const
Compute the intersection point of lines passing through ends of (this) and aSeg.
virtual void SetLocked(bool aLocked)
Modify the 'lock' status for of the item.
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.
virtual bool IsLocked() const
void SetBoard(BOARD *aBoard)
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
std::unordered_set< BOARD_ITEM * > & GetItems()
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
static bool NotEmpty(const SELECTION &aSelection)
Test if there are any items selected.
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
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)
Construct this circle such that it is tangent to the given segments and passes through the given poin...
class PCB_TRACK, a track segment (segment on a copper layer)
const VC_SETTINGS & GetSettings() const
Apply VIEW_CONTROLS settings from an object.
static TOOL_ACTION moveExact
Activation of the exact move tool.
DS_PROXY_VIEW_ITEM * GetDrawingSheet() const
static TOOL_ACTION pickerTool
static TOOL_ACTION filletTracks
Fillet (i.e. adds an arc tangent to) all selected straight tracks by a user defined radius.
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, WX_INFOBAR::MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
bool HitTestCutout(const VECTOR2I &aRefPos, int *aOutlineIdx=nullptr, int *aHoleIdx=nullptr) const
Test 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.
FOOTPRINT * GetFirstFootprint() const
Get 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....
TRACK_DRAG_ACTION m_TrackDragAction
void HatchBorder()
Compute the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_bor...
TEXT_TYPE GetType() const
virtual void Move(const wxPoint &aMoveVector)
Move this object.
void SetMid(const wxPoint &aMid)
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.
void SetStart(const wxPoint &aStart)
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,...
PAD_SHAPE GetShape() const
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.
Handle a list of polygons defining a copper zone.
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.
Represent basic circle geometry with utility geometry functions.
int GetuViaDiameter() const
drawingsheet frame and titleblock
static TOOL_ACTION copyWithReference
copy command with manual reference point selection
static TOOL_ACTION routerInlineDrag
Activation of the Push and Shove router (inline dragging mode)
static TOOL_ACTION hideDynamicRatsnest
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
bool Empty() const
Checks if there is anything selected.
class PCB_TARGET, a target (graphic item)
class FOOTPRINT, a footprint
static TOOL_ACTION breakTrack
Break a single track into two segments at the cursor.
static TOOL_ACTION pasteSpecial
virtual unsigned int GetSize() const override
Return the number of stored items.
static TOOL_ACTION rotateCcw
const wxSize & GetDelta() const
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
static ROUTER * theRouter
static TOOL_ACTION flip
Flipping of selected objects.
void SetWidth(int aWidth)
static const KICAD_T DraggableItems[]
A scan list for items that can be dragged.
int GetCurrentViaSize() const
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
bool HasReferencePoint() const
void SetNet(NETINFO_ITEM *aNetInfo)
Set a NET_INFO object for the item.
double m_MaxTangentAngleDeviation
Maximum angle between the tangent line of an arc track and a connected straight track in order to com...
Common, abstract interface for edit frames.
wxPoint GetPosition() const override
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
long m_lastKeyboardCursorCommand
Position of the above event.
EDA_ITEM_FLAGS IsPointOnEnds(const wxPoint &point, int min_dist=0) const
Function IsPointOnEnds returns STARTPOINT if point if near (dist = min_dist) start point,...
Used when the right click button is pressed, or when the select tool is in effect.
bool m_Live3DRefresh
If true, 3D viewer will redraw on every modification operation.
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
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.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
PCBNEW_SETTINGS & Settings()
int Size() const
Returns the number of selected parts.
void Mirror(const wxPoint &aMirrorRef, bool aMirrorLeftRight)
Mirror the outlines relative to a given horizontal axis the layer is not changed.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
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.
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
class PCB_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.
static TOOL_ACTION updateLocalRatsnest
bool UnFill()
Removes the zone filling.
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()
virtual EDA_RECT GetBoundingBox() const
static TOOL_ACTION toggle45
const wxPoint & GetMid() const
const VECTOR2I & GetP1() const
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.
const wxPoint & GetStart() const
static TOOL_ACTION refreshPreview
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
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
virtual BOARD_ITEM * Duplicate() const
Create a copy of this BOARD_ITEM.
KICAD_T Type() const
Returns the type of object.
VECTOR2I NearestPoint(const VECTOR2I &aP) const
Compute the point on the circumference of the circle that is the closest to aP.
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.