58#include <wx/richmsgdlg.h>
59#include <wx/choicdlg.h>
60#include <unordered_set>
61#include <unordered_map>
65 const wxString& aDialogTitle,
bool& aIncludeConnectedPads )
69 aIncludeConnectedPads =
true;
73 std::unordered_set<PAD*> uniquePads( aPads.begin(), aPads.end() );
76 msg.Printf(
_(
"%zu unselected pad(s) are connected to these nets. How do you want to proceed?" ),
80 details <<
_(
"Connected tracks, vias, and other non-zone copper items will still swap nets"
81 " even if you ignore the unselected pads." )
83 <<
_(
"Unselected pads:" ) <<
'\n';
85 for(
PAD*
pad : uniquePads )
88 details << wxS(
" • " ) << ( fp ? fp->
GetReference() :
_(
"<no reference designator>" ) ) << wxS(
":" )
89 <<
pad->GetNumber() <<
'\n';
93 wxRichMessageDialog dlg( aFrame, msg, aDialogTitle, wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxICON_WARNING );
94 dlg.SetYesNoLabels(
_(
"Ignore Unselected Pads" ),
_(
"Swap All Connected Pads" ) );
95 dlg.SetExtendedMessage( details );
97 int ret = dlg.ShowModal();
99 if( ret == wxID_CANCEL )
102 aIncludeConnectedPads = ( ret == wxID_NO );
110 std::unordered_map<BOARD_CONNECTED_ITEM*, int>& aItemNewNets,
113 auto [it, inserted] = aItemNewNets.emplace( aItem, aNewNet );
115 if( !inserted && it->second != aNewNet )
117 aError =
_(
"Cannot swap nets: connected items would receive conflicting nets." );
127 const std::unordered_map<BOARD_CONNECTED_ITEM*, int>& aItemNewNets,
128 const std::unordered_set<PAD*>& aSwapPads,
bool aIncludeConnectedPads )
133 for(
const auto& [item, newNet] : aItemNewNets )
135 if( item->GetNetCode() == newNet )
138 if( item->Type() ==
PCB_PAD_T && !aIncludeConnectedPads
139 && !aSwapPads.count(
static_cast<PAD*
>( item ) ) )
142 if( item->IsLocked() )
144 aFrame->
ShowInfoBarError(
_(
"Cannot swap nets of locked pads or connected copper unless "
145 "Override Locks is enabled." ) );
170 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
175 aCollector.
Remove( item );
191 commit = &localCommit;
193 std::vector<EDA_ITEM*> sorted =
selection.GetItemsSortedBySelectionOrder();
199 for(
size_t i = 0; i < sorted.size() - 1; i++ )
202 EDA_ITEM* edaItemB = sorted[( i + 1 ) % sorted.size()];
217 std::swap( aLayer, bLayer );
226 std::swap( aPos, bPos );
249 std::swap( aAngle, bAngle );
259 std::swap( aLayer, bLayer );
265 if( !localCommit.
Empty() )
266 localCommit.
Push(
_(
"Swap" ) );
289 std::vector<EDA_ITEM*> orderedPads =
selection.GetItemsSortedBySelectionOrder();
290 std::vector<PAD*> pads;
291 const size_t padsCount = orderedPads.size();
294 pads.push_back(
static_cast<PAD*
>(
static_cast<BOARD_ITEM*
>( it ) ) );
297 std::vector<int> originalNets( padsCount );
298 std::unordered_set<PAD*> selectedPads;
300 for(
size_t i = 0; i < padsCount; ++i )
302 originalNets[i] = pads[i]->GetNetCode();
303 selectedPads.insert( pads[i] );
306 if( std::ranges::all_of( originalNets,
309 return net == originalNets.front();
314 auto newNetForIndex =
317 return originalNets[( i + 1 ) % padsCount];
325 commit = &localCommit;
328 std::shared_ptr<CONNECTIVITY_DATA> connectivity =
board()->GetConnectivity();
331 std::unordered_map<BOARD_CONNECTED_ITEM*, int> itemNewNets;
332 std::vector<PAD*> nonSelectedPadsToChange;
336 for(
size_t i = 0; i < padsCount; ++i )
338 if( !
ScheduleNetSwap( pads[i], newNetForIndex( i ), itemNewNets, error ) )
340 frame()->ShowInfoBarError( error );
345 for(
size_t i = 0; i < padsCount; ++i )
348 int fromNet = originalNets[i];
349 int toNet = newNetForIndex( i );
367 if( ci->GetNetCode() != fromNet )
372 frame()->ShowInfoBarError( error );
378 PAD* otherPad =
static_cast<PAD*
>( ci );
380 if( !selectedPads.count( otherPad ) )
381 nonSelectedPadsToChange.push_back( otherPad );
386 bool includeConnectedPads =
true;
396 for(
size_t i = 0; i < padsCount; ++i )
398 if( pads[i]->GetNetCode() == newNetForIndex( i ) )
401 commit->
Modify( pads[i] );
402 pads[i]->SetNetCode( newNetForIndex( i ) );
406 for(
const auto& itemNewNet : itemNewNets )
409 int newNet = itemNewNet.second;
413 PAD* p =
static_cast<PAD*
>( item );
415 if( selectedPads.count( p ) )
418 if( !includeConnectedPads )
429 if( !localCommit.
Empty() )
430 localCommit.
Push(
_(
"Swap Pad Nets" ) );
451 frame()->ShowInfoBarError(
_(
"Gate swapping must be performed on pads within one multi-gate "
476 else if( fp && targetFp != fp )
483 if( fail || !targetFp || targetFp->
GetUnitInfo().size() < 2 )
493 std::vector<bool> unitHit( units.size(),
false );
494 std::vector<int> unitOrder;
496 std::vector<EDA_ITEM*> orderedPads =
selection.GetItemsSortedBySelectionOrder();
502 const wxString& padNum =
pad->GetNumber();
505 for(
size_t i = 0; i < units.size(); ++i )
507 for(
const auto& p : units[i].m_pins )
511 unitIdx =
static_cast<int>( i );
514 unitOrder.push_back( unitIdx );
527 std::vector<int> activeUnitIdx;
530 if( unitOrder.size() >= 2 )
532 activeUnitIdx = unitOrder;
533 sourceIdx = unitOrder.front();
536 else if( unitOrder.size() == 1 && aEvent.
HasParameter() )
538 sourceIdx = unitOrder.front();
539 wxString targetUnitByName = aEvent.
Parameter<wxString>();
543 for(
size_t i = 0; i < units.size(); ++i )
545 if(
static_cast<int>( i ) == sourceIdx )
548 if( units[i].m_pins.size() == units[sourceIdx].m_pins.size() && units[i].m_unitName == targetUnitByName )
549 targetIdx =
static_cast<int>( i );
558 activeUnitIdx.push_back( sourceIdx );
559 activeUnitIdx.push_back( targetIdx );
568 const size_t pinCount = units[activeUnitIdx.front()].m_pins.size();
570 for(
int idx : activeUnitIdx )
572 if( units[idx].m_pins.size() != pinCount )
574 frame()->ShowInfoBarError(
_(
"Gate swapping must be performed on gates with equal pin counts." ) );
580 const size_t unitCount = activeUnitIdx.size();
581 std::vector<std::vector<PAD*>> unitPads( unitCount );
582 std::vector<std::vector<int>> unitNets( unitCount );
584 for(
size_t ui = 0; ui < unitCount; ++ui )
586 int uidx = activeUnitIdx[ui];
587 const auto& pins = units[uidx].m_pins;
589 for(
size_t pi = 0; pi < pinCount; ++pi )
595 frame()->ShowInfoBarError(
_(
"Gate swapping failed: pad in unit missing from footprint." ) );
599 unitPads[ui].push_back( p );
604 if( std::ranges::all_of( unitNets,
605 [&](
const auto& nets )
607 return nets == unitNets.front();
610 frame()->ShowInfoBarError(
_(
"Gate swapping has no effect: all selected gates have identical nets." ) );
619 commit = &localCommit;
621 std::shared_ptr<CONNECTIVITY_DATA> connectivity =
board()->GetConnectivity();
624 std::unordered_map<BOARD_CONNECTED_ITEM*, int> itemNewNets;
625 std::vector<PAD*> nonSelectedPadsToChange;
629 std::unordered_set<PAD*> swapPads;
631 for(
const auto& v : unitPads )
632 swapPads.insert( v.begin(), v.end() );
634 for(
size_t pi = 0; pi < pinCount; ++pi )
636 for(
size_t ui = 0; ui < unitCount; ++ui )
638 size_t toIdx = ( ui + 1 ) % unitCount;
640 if( !
ScheduleNetSwap( unitPads[ui][pi], unitNets[toIdx][pi], itemNewNets, error ) )
642 frame()->ShowInfoBarError( error );
649 auto scheduleForPad = [&](
PAD*
pad,
int fromNet,
int toNet ) ->
bool
666 if( ci->GetNetCode() != fromNet )
674 PAD* other =
static_cast<PAD*
>( ci );
676 if( !swapPads.count( other ) )
677 nonSelectedPadsToChange.push_back( other );
685 for(
size_t pi = 0; pi < pinCount; ++pi )
687 for(
size_t ui = 0; ui < unitCount; ++ui )
690 size_t toIdx = ( ui + 1 ) % unitCount;
692 PAD* padFrom = unitPads[fromIdx][pi];
693 int fromNet = unitNets[fromIdx][pi];
694 int toNet = unitNets[toIdx][pi];
696 if( !scheduleForPad( padFrom, fromNet, toNet ) )
698 frame()->ShowInfoBarError( error );
704 bool includeConnectedPads =
true;
715 for(
size_t pi = 0; pi < pinCount; ++pi )
718 for(
size_t ui = 0; ui < unitCount; ++ui )
720 size_t toIdx = ( ui + 1 ) % unitCount;
721 PAD*
pad = unitPads[ui][pi];
722 int newNet = unitNets[toIdx][pi];
724 if(
pad->GetNetCode() == newNet )
728 pad->SetNetCode( newNet );
733 for(
const auto&
kv : itemNewNets )
736 int newNet =
kv.second;
740 PAD* p =
static_cast<PAD*
>( item );
742 if( swapPads.count( p ) )
745 if( !includeConnectedPads )
756 if( !localCommit.
Empty() )
757 localCommit.
Push(
_(
"Swap Gate Nets" ) );
783 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
788 aCollector.
Remove( item );
796 std::vector<FOOTPRINT*> footprintsToPack;
799 footprintsToPack.push_back(
static_cast<FOOTPRINT*
>( item ) );
801 if( footprintsToPack.empty() )
804 BOX2I footprintsBbox;
810 footprintsBbox.
Merge( fp->GetBoundingBox(
false ) );
816 commit.
Push(
_(
"Pack Footprints" ) );
856 std::vector<PCB_SHAPE*> constraintShapes;
858 if(
doMoveSelection( aEvent, &localCommit,
false, &constraintShapes ) )
862 localCommit.
Push(
_(
"Move" ) );
867 constraintTool->DiagnoseAfterMove( constraintShapes );
888 typedef std::numeric_limits<int> coord_limits;
890 static const double max = coord_limits::max() - (int)
COORDS_PADDING;
891 static const double min = -max;
894 testBox.
Offset( aBBoxOffset );
903 testBox.
Offset( aMovement );
911 if( testBox.
GetTop() < min )
922 std::vector<PCB_SHAPE*>* aConstraintShapes )
933 std::unique_ptr<STATUS_TEXT_POPUP> statusPopup;
963 controls->ForceCursorPosition(
false );
965 auto displayConstraintsMessage =
973 msg =
_(
"Angle snap lines: 45°" );
977 msg =
_(
"Angle snap lines: 90°" );
988 auto updateStatusPopup =
989 [&](
EDA_ITEM* item,
size_t ii,
size_t count )
991 wxString popuptext =
_(
"Click to place %s (item %zu of %zu)\n"
992 "Press <esc> to cancel all; double-click to finish" );
1006 msg = wxString::Format(
_(
"%s pad %s" ), fp->
GetReference(),
pad->GetNumber() );
1008 msg =
pad->GetItemDescription( editFrame,
false );
1016 statusPopup = std::make_unique<STATUS_TEXT_POPUP>(
frame() );
1018 statusPopup->SetText( wxString::Format( popuptext, msg, ii, count ) );
1021 std::vector<BOARD_ITEM*> sel_items;
1022 std::vector<BOARD_ITEM*> orig_items;
1026 std::unordered_set<EDA_ITEM*> moved_items;
1035 orig_items.push_back( boardItem );
1037 sel_items.push_back( boardItem );
1038 moved_items.insert( boardItem );
1046 sel_items.push_back(
pad );
1056 if( aConstraintShapes )
1061 if( moveWithReference && !
pickReferencePoint(
_(
"Select reference point for move..." ),
"",
"",
1062 pickedReferencePoint ) )
1072 if( moveIndividually )
1079 orig_items.push_back(
static_cast<BOARD_ITEM*
>( item ) );
1082 updateStatusPopup( orig_items[ itemIdx ], itemIdx + 1, orig_items.size() );
1083 statusPopup->Popup();
1085 canvas()->SetStatusPopup( statusPopup->GetPanel() );
1091 sel_items.push_back( orig_items[ itemIdx ] );
1093 moved_items.clear();
1094 moved_items.insert( orig_items[itemIdx] );
1097 bool restore_state =
false;
1098 VECTOR2I originalPos = originalCursorPos;
1101 bool updateBBox =
true;
1104 std::shared_ptr<BOARD_CONSTRAINT_MOVE_SESSION> constraintMoveSession;
1112 bool enableLocalRatsnest =
true;
1130 singleFp =
static_cast<FOOTPRINT*
>( it );
1140 if( it->Type() ==
PCB_PAD_T && it->GetParentFootprint() != singleFp )
1147 auto selectionHasFp =
1150 return std::any_of( sel_items.begin(), sel_items.end(),
1153 return it->Type() == PCB_FOOTPRINT_T;
1163 bool frameRotate = frameFp || selectionHasFp();
1171 auto applyMoveFrameOrientation =
1182 prevFrameAngle = newAngle;
1184 if(
delta.IsZero() )
1197 item->Rotate( pivot,
delta );
1203 bool eatFirstMouseUp =
true;
1207 const auto buildConstraintMoveSession =
1210 grid.SetFeasibilityCallback( {} );
1211 constraintMoveSession.reset();
1213 if( moveIndividually || !aConstraintShapes || aConstraintShapes->empty()
1214 || !boardHasConstraints )
1219 auto session = std::make_shared<BOARD_CONSTRAINT_MOVE_SESSION>();
1221 if( session->Build(
board, *aConstraintShapes, aReference ) )
1223 constraintMoveSession = session;
1224 grid.SetFeasibilityCallback(
1226 const std::vector<SNAP_CANDIDATE>& aCandidates )
1228 return session->ResolveCandidates( aContext, aCandidates );
1235 AXIS_LOCK axisLock = AXIS_LOCK::NONE;
1236 long lastArrowKeyAction = 0;
1240 std::shared_ptr<DRC_ENGINE> drcEngine = drcTool ? drcTool->
GetDRCEngine() :
nullptr;
1243 std::unique_ptr<DRC_INTERACTIVE_COURTYARD_CLEARANCE> drc_on_move =
nullptr;
1245 if( showCourtyardConflicts )
1248 drc_on_move->Init(
board );
1252 std::unique_ptr<CREEPAGE_OVERLAY> creepage_on_move = std::make_unique<CREEPAGE_OVERLAY>(
board, drcEngine,
1255 auto configureAngleSnap =
1258 std::vector<VECTOR2I> directions;
1274 grid.SetSnapLineDirections( directions );
1276 if( directions.empty() )
1277 grid.ClearSnapLine();
1279 grid.SetSnapLineOrigin( originalPos );
1282 configureAngleSnap( angleSnapMode );
1283 displayConstraintsMessage( angleSnapMode );
1299 eatFirstMouseUp =
false;
1312 bool redraw3D =
false;
1316 if(
controls->GetSettings().m_lastKeyboardCursorPositionValid )
1318 VECTOR2I keyboardPos(
controls->GetSettings().m_lastKeyboardCursorPosition );
1320 grid.SetSnap(
false );
1334 long action =
controls->GetSettings().m_lastKeyboardCursorCommand;
1338 if( axisLock == AXIS_LOCK::HORIZONTAL )
1344 axisLock = AXIS_LOCK::NONE;
1350 axisLock = AXIS_LOCK::HORIZONTAL;
1355 if( axisLock == AXIS_LOCK::VERTICAL )
1361 axisLock = AXIS_LOCK::NONE;
1367 axisLock = AXIS_LOCK::VERTICAL;
1371 lastArrowKeyAction = action;
1378 m_cursor =
grid.ResolveSnap( mousePos, layers, selectionGrid, sel_items, prevPos ).position;
1381 if( axisLock == AXIS_LOCK::HORIZONTAL )
1383 else if( axisLock == AXIS_LOCK::VERTICAL )
1391 originalBBox =
BOX2I();
1411 bboxMovement += movement;
1419 item->Move( movement );
1440 if( aConstraintShapes && !aConstraintShapes->empty() && movement !=
VECTOR2I()
1441 && boardHasConstraints )
1443 std::vector<PCB_SHAPE*> solved;
1444 std::vector<BOARD_ITEM*> dimensions;
1446 const auto beforeConstraintModify =
1449 aCommit->
Modify( aItem );
1454 dimensions.push_back( aItem );
1457 bool solvedConstraints =
1458 constraintMoveSession
1459 ? constraintMoveSession->Solve(
m_cursor, &solved, beforeConstraintModify )
1461 beforeConstraintModify );
1463 if( solvedConstraints )
1476 item->Move( -movement );
1480 prevPos = previousCursor;
1481 bboxMovement -= movement;
1485 grid.ClearSnapFeedback();
1489 applyMoveFrameOrientation();
1491 if( redraw3D && allowRedraw3D )
1494 if( showCourtyardConflicts && drc_on_move->m_FpInMove.size() )
1497 drc_on_move->UpdateConflicts(
m_toolMgr->GetView(),
true );
1500 creepage_on_move->Update();
1520 enableLocalRatsnest =
false;
1533 static_cast<PCB_SHAPE*
>( item )->UpdateHatching();
1535 item->RunOnChildren(
1541 static_cast<PCB_SHAPE*
>( child )->UpdateHatching();
1552 grid.SetAuxAxes(
false );
1553 buildConstraintMoveSession(
selection.GetReferencePoint() );
1568 boardItem->
Move( movement );
1576 applyMoveFrameOrientation();
1581 if( showCourtyardConflicts )
1583 std::vector<FOOTPRINT*>& FPs = drc_on_move->m_FpInMove;
1588 FPs.push_back(
static_cast<FOOTPRINT*
>( item ) );
1590 item->RunOnChildren(
1594 FPs.push_back(
static_cast<FOOTPRINT*
>( child ) );
1600 creepage_on_move->Start( sel_items );
1609 if( moveWithReference )
1611 selection.SetReferencePoint( pickedReferencePoint );
1616 controls->ForceCursorPosition(
true, pickedReferencePoint );
1623 selection.SetReferencePoint( dragOrigin );
1626 grid.SetSnapLineOrigin( dragOrigin );
1628 grid.SetAuxAxes(
true, dragOrigin );
1636 originalPos =
selection.GetReferencePoint();
1637 buildConstraintMoveSession( originalPos );
1653 if( enableLocalRatsnest )
1661 restore_state =
true;
1670 restore_state =
true;
1694 eatFirstMouseUp =
false;
1702 eatFirstMouseUp =
false;
1709 orig_items[itemIdx]->SetPosition( originalPos );
1711 view()->Update( orig_items[itemIdx] );
1714 if( ++itemIdx < orig_items.size() )
1722 selection.SetReferencePoint( originalPos );
1728 sel_items.push_back( nextItem );
1730 moved_items.clear();
1731 moved_items.insert( nextItem );
1732 updateStatusPopup( nextItem, itemIdx + 1, orig_items.size() );
1735 frameFp = findSingleFp();
1736 frameRotate = frameFp || selectionHasFp();
1762 if( moveIndividually )
1763 orig_items[itemIdx]->SetPosition( originalPos );
1770 configureAngleSnap( angleSnapMode );
1771 displayConstraintsMessage( angleSnapMode );
1799 }
while( ( evt =
Wait() ) );
1803 restore_state =
true;
1806 if( showCourtyardConflicts )
1807 drc_on_move->ClearConflicts(
m_toolMgr->GetView() );
1809 creepage_on_move->Stop();
1811 controls->ForceCursorPosition(
false );
1826 if( sel_items.size() == 1 && sel_items.back()->Type() ==
PCB_GENERATOR_T )
1834 if( sel_items.size() == 1 && sel_items.back()->Type() ==
PCB_GENERATOR_T )
1843 std::set<PCB_GENERATOR*> regenParents;
1855 regenParents.insert( gen );
1858 if( !regenParents.empty() )
1864 gen->EditStart( genTool,
board, aCommit );
1865 gen->Update( genTool,
board, aCommit );
1866 gen->EditFinish( genTool,
board, aCommit );
1870 EDA_ITEMS oItems( orig_items.begin(), orig_items.end() );
1880 return !restore_state;
bool BoardHasConstraints(BOARD *aBoard)
True if aBoard resolves at least one geometric constraint (see CollectResolvedConstraints()).
bool ReSolveShapeClustersHoldingEdited(BOARD *aBoard, const std::vector< PCB_SHAPE * > &aEditedShapes, std::vector< PCB_SHAPE * > *aModified, const std::function< void(BOARD_ITEM *)> &aBeforeModify)
Re-solve clusters whose new geometry is authoritative holding every edited shape fully fixed so only ...
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
static TOOL_ACTION findPrevious
static TOOL_ACTION findNext
static TOOL_ACTION cursorDblClick
static TOOL_ACTION duplicate
static TOOL_ACTION doDelete
static TOOL_ACTION cursorClick
static TOOL_ACTION increment
static TOOL_ACTION selectionClear
Clear the current selection.
static TOOL_ACTION refreshPreview
static TOOL_ACTION selectItems
Select a list of items (specified as the event parameter)
void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
void Revert() 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,...
virtual bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual void Move(const VECTOR2I &aMoveVector)
Move this object.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Information pertinent to a Pcbnew printed circuit board.
constexpr const Vec & GetPosition() const
constexpr BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
constexpr coord_type GetLeft() const
constexpr const Vec & GetOrigin() const
constexpr coord_type GetRight() const
constexpr const SizeVec & GetSize() const
constexpr coord_type GetTop() const
constexpr void Offset(coord_type dx, coord_type dy)
constexpr coord_type GetBottom() const
int GetCount() const
Return the number of objects in the list.
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, INFOBAR_MESSAGE_TYPE aType=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...
void DisplayConstraintsMsg(const wxString &msg)
bool GetOverrideLocks() const
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
A set of EDA_ITEMs (i.e., without duplicates).
virtual EDA_ITEM * AsEdaItem()=0
A base class for most all the KiCad significant classes used in schematics and boards.
virtual VECTOR2I GetPosition() const
virtual void SetPosition(const VECTOR2I &aPos)
wxString GetTypeDesc() const
Return a translated description of the type for this EDA_ITEM for display in user facing messages.
void SetFlags(EDA_ITEM_FLAGS aMask)
virtual EDA_GROUP * GetParentGroup() const
KICAD_T Type() const
Returns the type of object.
EDA_ITEM * GetParent() const
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
static const TOOL_EVENT SelectedEvent
static const TOOL_EVENT SelectedItemsModified
Selected item had a property changed (except movement)
static const TOOL_EVENT SelectedItemsMoved
Selected items were moved, this can be very high frequency on the canvas, use with care.
Used when the right click button is pressed, or when the select tool is in effect.
An interface for classes handling user events controlling the view behavior such as zooming,...
bool IsBOARD_ITEM() const
LSET is a set of PCB_LAYER_IDs.
static void SwapShapePositions(PAD *aLhs, PAD *aRhs, PCB_LAYER_ID aActiveLayer)
Swap the visible shape positions of two pads, preserving each pad's own shape offset.
DISPLAY_OPTIONS m_Display
bool m_ShowCourtyardCollisions
static TOOL_ACTION mirrorH
Mirroring of selected items.
static TOOL_ACTION genFinishEdit
static TOOL_ACTION hideLocalRatsnest
static TOOL_ACTION genStartEdit
static TOOL_ACTION moveWithReference
move with a reference point
static TOOL_ACTION angleSnapModeChanged
Notification event when angle mode changes.
static TOOL_ACTION moveExact
Activation of the exact move tool.
static TOOL_ACTION copyWithReference
copy command with manual reference point selection
static TOOL_ACTION genCancelEdit
static TOOL_ACTION genUpdateEdit
static TOOL_ACTION updateLocalRatsnest
static TOOL_ACTION moveIndividually
move items one-by-one
static TOOL_ACTION interactiveOffsetTool
static TOOL_ACTION positionRelative
static TOOL_ACTION move
move or drag an item
static TOOL_ACTION mirrorV
static TOOL_ACTION flip
Flipping of selected objects.
static TOOL_ACTION rotateCw
Rotation of selected objects.
static TOOL_ACTION rotateCcw
Common, abstract interface for edit frames.
virtual EDA_ANGLE GetRotationAngle() const
Return the angle used for rotate operations.
PCBNEW_SETTINGS * GetPcbNewSettings() const
virtual MAGNETIC_SETTINGS * GetMagneticItemsSettings()
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual PCB_LAYER_ID GetActiveLayer() const
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
virtual bool ChildrenAreIndividuallySelectable() const
static constexpr EDA_ANGLE ANGLE_0
#define IS_MOVING
Item being moved.
a few functions useful in geometry calculations.
LEADER_MODE
The kind of the leader line.
@ DIRECT
Unconstrained point-to-point.
PCB_LAYER_ID
A quick note on layer IDs:
@ TOP_BOTTOM
Flip top to bottom (around the X axis)
@ GEOMETRY
Position or shape has changed.
@ VERTICAL
A segment (or two points) is vertical.
@ HORIZONTAL
A segment (or two points) is horizontal.
EDA_ANGLE GridFrameAngleAt(const BOARD &aBoard, const VECTOR2I &aPos, PCB_GRID_ROLE aRole)
World frame angle of the grid active for aRole at aPos; ANGLE_0 when no grid applies.
EDA_ANGLE GridFrameRotationDelta(const EDA_ANGLE &aFrom, const EDA_ANGLE &aTo, const EDA_ANGLE &aRotationStep)
Minimal rotation that re-aligns an item from frame angle aFrom to aTo, reduced modulo min( aRotationS...
Class to handle a set of BOARD_ITEMs.
std::vector< EDA_ITEM * > EDA_ITEMS
Increment event parameters.
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_DRILL_MAP_T
class PCB_DRILL_MAP, drill symbols drawn at the holes
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
@ PCB_GRID_ITEM_T
a subgrid placed on a board
@ 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)
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D