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 );
123 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
128 aCollector.
Remove( item );
143 commit = &localCommit;
145 std::vector<EDA_ITEM*> sorted =
selection.GetItemsSortedBySelectionOrder();
151 for(
size_t i = 0; i < sorted.size() - 1; i++ )
154 EDA_ITEM* edaItemB = sorted[( i + 1 ) % sorted.size()];
169 std::swap( aLayer, bLayer );
178 std::swap( aPos, bPos );
201 std::swap( aAngle, bAngle );
211 std::swap( aLayer, bLayer );
217 if( !localCommit.
Empty() )
218 localCommit.
Push(
_(
"Swap" ) );
241 std::vector<EDA_ITEM*> orderedPads =
selection.GetItemsSortedBySelectionOrder();
242 std::vector<PAD*> pads;
243 const size_t padsCount = orderedPads.size();
246 pads.push_back(
static_cast<PAD*
>(
static_cast<BOARD_ITEM*
>( it ) ) );
249 std::vector<int> originalNets( padsCount );
250 std::unordered_set<PAD*> selectedPads;
252 for(
size_t i = 0; i < padsCount; ++i )
254 originalNets[i] = pads[i]->GetNetCode();
255 selectedPads.insert( pads[i] );
261 for(
size_t i = 1; i < padsCount; ++i )
263 if( originalNets[i] != originalNets[0] )
274 auto newNetForIndex =
277 return originalNets[( i + 1 ) % padsCount];
285 commit = &localCommit;
288 std::shared_ptr<CONNECTIVITY_DATA> connectivity =
board()->GetConnectivity();
291 std::unordered_map<BOARD_CONNECTED_ITEM*, int> itemNewNets;
292 std::vector<PAD*> nonSelectedPadsToChange;
294 for(
size_t i = 0; i < padsCount; ++i )
297 int fromNet = originalNets[i];
298 int toNet = newNetForIndex( i );
315 if( ci->GetNetCode() != fromNet )
319 itemNewNets[ci] = toNet;
323 PAD* otherPad =
static_cast<PAD*
>( ci );
325 if( !selectedPads.count( otherPad ) )
326 nonSelectedPadsToChange.push_back( otherPad );
331 bool includeConnectedPads =
true;
338 for(
size_t i = 0; i < padsCount; ++i )
340 commit->
Modify( pads[i] );
341 pads[i]->SetNetCode( newNetForIndex( i ) );
345 for(
const auto& itemNewNet : itemNewNets )
348 int newNet = itemNewNet.second;
352 PAD* p =
static_cast<PAD*
>( item );
354 if( selectedPads.count( p ) )
357 if( !includeConnectedPads )
365 if( !localCommit.
Empty() )
366 localCommit.
Push(
_(
"Swap Pad Nets" ) );
387 frame()->ShowInfoBarError(
_(
"Gate swapping must be performed on pads within one multi-gate "
412 else if( fp && targetFp != fp )
419 if( fail || !targetFp || targetFp->
GetUnitInfo().size() < 2 )
429 std::vector<bool> unitHit( units.size(),
false );
430 std::vector<int> unitOrder;
432 std::vector<EDA_ITEM*> orderedPads =
selection.GetItemsSortedBySelectionOrder();
438 const wxString& padNum =
pad->GetNumber();
441 for(
size_t i = 0; i < units.size(); ++i )
443 for(
const auto& p : units[i].m_pins )
447 unitIdx =
static_cast<int>( i );
450 unitOrder.push_back( unitIdx );
463 std::vector<int> activeUnitIdx;
466 if( unitOrder.size() >= 2 )
468 activeUnitIdx = unitOrder;
469 sourceIdx = unitOrder.front();
472 else if( unitOrder.size() == 1 && aEvent.
HasParameter() )
474 sourceIdx = unitOrder.front();
475 wxString targetUnitByName = aEvent.
Parameter<wxString>();
479 for(
size_t i = 0; i < units.size(); ++i )
481 if(
static_cast<int>( i ) == sourceIdx )
484 if( units[i].m_pins.size() == units[sourceIdx].m_pins.size() && units[i].m_unitName == targetUnitByName )
485 targetIdx =
static_cast<int>( i );
494 activeUnitIdx.push_back( sourceIdx );
495 activeUnitIdx.push_back( targetIdx );
504 const size_t pinCount = units[activeUnitIdx.front()].m_pins.size();
506 for(
int idx : activeUnitIdx )
508 if( units[idx].m_pins.size() != pinCount )
510 frame()->ShowInfoBarError(
_(
"Gate swapping must be performed on gates with equal pin counts." ) );
516 const size_t unitCount = activeUnitIdx.size();
517 std::vector<std::vector<PAD*>> unitPads( unitCount );
518 std::vector<std::vector<int>> unitNets( unitCount );
520 for(
size_t ui = 0; ui < unitCount; ++ui )
522 int uidx = activeUnitIdx[ui];
523 const auto& pins = units[uidx].m_pins;
525 for(
size_t pi = 0; pi < pinCount; ++pi )
531 frame()->ShowInfoBarError(
_(
"Gate swapping failed: pad in unit missing from footprint." ) );
535 unitPads[ui].push_back( p );
543 for(
size_t pi = 0; pi < pinCount && allSame; ++pi )
545 int refNet = unitNets[0][pi];
547 for(
size_t ui = 1; ui < unitCount; ++ui )
549 if( unitNets[ui][pi] != refNet )
559 frame()->ShowInfoBarError(
_(
"Gate swapping has no effect: all selected gates have identical nets." ) );
568 commit = &localCommit;
570 std::shared_ptr<CONNECTIVITY_DATA> connectivity =
board()->GetConnectivity();
573 std::unordered_map<BOARD_CONNECTED_ITEM*, int> itemNewNets;
574 std::vector<PAD*> nonSelectedPadsToChange;
577 std::unordered_set<PAD*> swapPads;
579 for(
const auto& v : unitPads )
580 swapPads.insert( v.begin(), v.end() );
583 auto scheduleForPad = [&](
PAD*
pad,
int fromNet,
int toNet )
599 if( ci->GetNetCode() != fromNet )
602 itemNewNets[ ci ] = toNet;
606 PAD* other =
static_cast<PAD*
>( ci );
608 if( !swapPads.count( other ) )
609 nonSelectedPadsToChange.push_back( other );
615 for(
size_t pi = 0; pi < pinCount; ++pi )
617 for(
size_t ui = 0; ui < unitCount; ++ui )
620 size_t toIdx = ( ui + 1 ) % unitCount;
622 PAD* padFrom = unitPads[fromIdx][pi];
623 int fromNet = unitNets[fromIdx][pi];
624 int toNet = unitNets[toIdx][pi];
626 scheduleForPad( padFrom, fromNet, toNet );
630 bool includeConnectedPads =
true;
638 for(
size_t pi = 0; pi < pinCount; ++pi )
641 for(
size_t ui = 0; ui < unitCount; ++ui )
643 size_t toIdx = ( ui + 1 ) % unitCount;
644 PAD*
pad = unitPads[ui][pi];
645 int newNet = unitNets[toIdx][pi];
648 pad->SetNetCode( newNet );
653 for(
const auto&
kv : itemNewNets )
656 int newNet =
kv.second;
660 PAD* p =
static_cast<PAD*
>( item );
662 if( swapPads.count( p ) )
665 if( !includeConnectedPads )
673 if( !localCommit.
Empty() )
674 localCommit.
Push(
_(
"Swap Gate Nets" ) );
700 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
705 aCollector.
Remove( item );
713 std::vector<FOOTPRINT*> footprintsToPack;
716 footprintsToPack.push_back(
static_cast<FOOTPRINT*
>( item ) );
718 if( footprintsToPack.empty() )
721 BOX2I footprintsBbox;
727 footprintsBbox.
Merge( fp->GetBoundingBox(
false ) );
733 commit.
Push(
_(
"Pack Footprints" ) );
773 std::vector<PCB_SHAPE*> constraintShapes;
775 if(
doMoveSelection( aEvent, &localCommit,
false, &constraintShapes ) )
779 localCommit.
Push(
_(
"Move" ) );
784 constraintTool->DiagnoseAfterMove( constraintShapes );
805 typedef std::numeric_limits<int> coord_limits;
807 static const double max = coord_limits::max() - (int)
COORDS_PADDING;
808 static const double min = -max;
811 testBox.
Offset( aBBoxOffset );
820 testBox.
Offset( aMovement );
828 if( testBox.
GetTop() < min )
839 std::vector<PCB_SHAPE*>* aConstraintShapes )
850 std::unique_ptr<STATUS_TEXT_POPUP> statusPopup;
880 controls->ForceCursorPosition(
false );
882 auto displayConstraintsMessage =
890 msg =
_(
"Angle snap lines: 45°" );
894 msg =
_(
"Angle snap lines: 90°" );
905 auto updateStatusPopup =
906 [&](
EDA_ITEM* item,
size_t ii,
size_t count )
908 wxString popuptext =
_(
"Click to place %s (item %zu of %zu)\n"
909 "Press <esc> to cancel all; double-click to finish" );
921 msg = wxString::Format(
_(
"%s pad %s" ), fp->
GetReference(),
pad->GetNumber() );
929 statusPopup = std::make_unique<STATUS_TEXT_POPUP>(
frame() );
931 statusPopup->SetText( wxString::Format( popuptext, msg, ii, count ) );
934 std::vector<BOARD_ITEM*> sel_items;
935 std::vector<BOARD_ITEM*> orig_items;
939 std::unordered_set<EDA_ITEM*> moved_items;
948 orig_items.push_back( boardItem );
950 sel_items.push_back( boardItem );
951 moved_items.insert( boardItem );
959 sel_items.push_back(
pad );
969 if( aConstraintShapes )
974 if( moveWithReference && !
pickReferencePoint(
_(
"Select reference point for move..." ),
"",
"",
975 pickedReferencePoint ) )
985 if( moveIndividually )
992 orig_items.push_back(
static_cast<BOARD_ITEM*
>( item ) );
995 updateStatusPopup( orig_items[ itemIdx ], itemIdx + 1, orig_items.size() );
996 statusPopup->Popup();
998 canvas()->SetStatusPopup( statusPopup->GetPanel() );
1004 sel_items.push_back( orig_items[ itemIdx ] );
1006 moved_items.clear();
1007 moved_items.insert( orig_items[itemIdx] );
1010 bool restore_state =
false;
1011 VECTOR2I originalPos = originalCursorPos;
1014 bool updateBBox =
true;
1017 std::shared_ptr<BOARD_CONSTRAINT_MOVE_SESSION> constraintMoveSession;
1025 bool enableLocalRatsnest =
true;
1043 singleFp =
static_cast<FOOTPRINT*
>( it );
1053 if( it->Type() ==
PCB_PAD_T && it->GetParentFootprint() != singleFp )
1060 auto selectionHasFp =
1063 return std::any_of( sel_items.begin(), sel_items.end(),
1066 return it->Type() == PCB_FOOTPRINT_T;
1076 bool frameRotate = frameFp || selectionHasFp();
1084 auto applyMoveFrameOrientation =
1095 prevFrameAngle = newAngle;
1097 if(
delta.IsZero() )
1110 item->Rotate( pivot,
delta );
1116 bool eatFirstMouseUp =
true;
1120 const auto buildConstraintMoveSession =
1123 grid.SetFeasibilityCallback( {} );
1124 constraintMoveSession.reset();
1126 if( moveIndividually || !aConstraintShapes || aConstraintShapes->empty()
1127 || !boardHasConstraints )
1132 auto session = std::make_shared<BOARD_CONSTRAINT_MOVE_SESSION>();
1134 if( session->Build(
board, *aConstraintShapes, aReference ) )
1136 constraintMoveSession = session;
1137 grid.SetFeasibilityCallback(
1139 const std::vector<SNAP_CANDIDATE>& aCandidates )
1141 return session->ResolveCandidates( aContext, aCandidates );
1148 AXIS_LOCK axisLock = AXIS_LOCK::NONE;
1149 long lastArrowKeyAction = 0;
1153 std::shared_ptr<DRC_ENGINE> drcEngine = drcTool ? drcTool->
GetDRCEngine() :
nullptr;
1156 std::unique_ptr<DRC_INTERACTIVE_COURTYARD_CLEARANCE> drc_on_move =
nullptr;
1158 if( showCourtyardConflicts )
1161 drc_on_move->Init(
board );
1165 std::unique_ptr<CREEPAGE_OVERLAY> creepage_on_move = std::make_unique<CREEPAGE_OVERLAY>(
board, drcEngine,
1168 auto configureAngleSnap =
1171 std::vector<VECTOR2I> directions;
1187 grid.SetSnapLineDirections( directions );
1189 if( directions.empty() )
1190 grid.ClearSnapLine();
1192 grid.SetSnapLineOrigin( originalPos );
1195 configureAngleSnap( angleSnapMode );
1196 displayConstraintsMessage( angleSnapMode );
1212 eatFirstMouseUp =
false;
1225 bool redraw3D =
false;
1229 if(
controls->GetSettings().m_lastKeyboardCursorPositionValid )
1231 VECTOR2I keyboardPos(
controls->GetSettings().m_lastKeyboardCursorPosition );
1233 grid.SetSnap(
false );
1247 long action =
controls->GetSettings().m_lastKeyboardCursorCommand;
1251 if( axisLock == AXIS_LOCK::HORIZONTAL )
1257 axisLock = AXIS_LOCK::NONE;
1263 axisLock = AXIS_LOCK::HORIZONTAL;
1268 if( axisLock == AXIS_LOCK::VERTICAL )
1274 axisLock = AXIS_LOCK::NONE;
1280 axisLock = AXIS_LOCK::VERTICAL;
1284 lastArrowKeyAction = action;
1291 m_cursor =
grid.ResolveSnap( mousePos, layers, selectionGrid, sel_items, prevPos ).position;
1294 if( axisLock == AXIS_LOCK::HORIZONTAL )
1296 else if( axisLock == AXIS_LOCK::VERTICAL )
1304 originalBBox =
BOX2I();
1324 bboxMovement += movement;
1332 item->Move( movement );
1353 if( aConstraintShapes && !aConstraintShapes->empty() && movement !=
VECTOR2I()
1354 && boardHasConstraints )
1356 std::vector<PCB_SHAPE*> solved;
1357 std::vector<BOARD_ITEM*> dimensions;
1359 const auto beforeConstraintModify =
1362 aCommit->
Modify( aItem );
1367 dimensions.push_back( aItem );
1370 bool solvedConstraints =
1371 constraintMoveSession
1372 ? constraintMoveSession->Solve(
m_cursor, &solved, beforeConstraintModify )
1374 beforeConstraintModify );
1376 if( solvedConstraints )
1389 item->Move( -movement );
1393 prevPos = previousCursor;
1394 bboxMovement -= movement;
1398 grid.ClearSnapFeedback();
1402 applyMoveFrameOrientation();
1404 if( redraw3D && allowRedraw3D )
1407 if( showCourtyardConflicts && drc_on_move->m_FpInMove.size() )
1410 drc_on_move->UpdateConflicts(
m_toolMgr->GetView(),
true );
1413 creepage_on_move->Update();
1433 enableLocalRatsnest =
false;
1446 static_cast<PCB_SHAPE*
>( item )->UpdateHatching();
1448 item->RunOnChildren(
1454 static_cast<PCB_SHAPE*
>( child )->UpdateHatching();
1465 grid.SetAuxAxes(
false );
1466 buildConstraintMoveSession(
selection.GetReferencePoint() );
1481 boardItem->
Move( movement );
1489 applyMoveFrameOrientation();
1494 if( showCourtyardConflicts )
1496 std::vector<FOOTPRINT*>& FPs = drc_on_move->m_FpInMove;
1501 FPs.push_back(
static_cast<FOOTPRINT*
>( item ) );
1503 item->RunOnChildren(
1507 FPs.push_back(
static_cast<FOOTPRINT*
>( child ) );
1513 creepage_on_move->Start( sel_items );
1522 if( moveWithReference )
1524 selection.SetReferencePoint( pickedReferencePoint );
1529 controls->ForceCursorPosition(
true, pickedReferencePoint );
1536 selection.SetReferencePoint( dragOrigin );
1539 grid.SetSnapLineOrigin( dragOrigin );
1541 grid.SetAuxAxes(
true, dragOrigin );
1549 originalPos =
selection.GetReferencePoint();
1550 buildConstraintMoveSession( originalPos );
1566 if( enableLocalRatsnest )
1574 restore_state =
true;
1583 restore_state =
true;
1607 eatFirstMouseUp =
false;
1615 eatFirstMouseUp =
false;
1622 orig_items[itemIdx]->SetPosition( originalPos );
1624 view()->Update( orig_items[itemIdx] );
1627 if( ++itemIdx < orig_items.size() )
1635 selection.SetReferencePoint( originalPos );
1640 sel_items.push_back( nextItem );
1642 moved_items.clear();
1643 moved_items.insert( nextItem );
1644 updateStatusPopup( nextItem, itemIdx + 1, orig_items.size() );
1647 frameFp = findSingleFp();
1648 frameRotate = frameFp || selectionHasFp();
1674 if( moveIndividually )
1675 orig_items[itemIdx]->SetPosition( originalPos );
1682 configureAngleSnap( angleSnapMode );
1683 displayConstraintsMessage( angleSnapMode );
1707 }
while( ( evt =
Wait() ) );
1710 if( showCourtyardConflicts )
1711 drc_on_move->ClearConflicts(
m_toolMgr->GetView() );
1713 creepage_on_move->Stop();
1715 controls->ForceCursorPosition(
false );
1730 if( sel_items.size() == 1 && sel_items.back()->Type() ==
PCB_GENERATOR_T )
1738 if( sel_items.size() == 1 && sel_items.back()->Type() ==
PCB_GENERATOR_T )
1747 std::set<PCB_GENERATOR*> regenParents;
1759 regenParents.insert( gen );
1762 if( !regenParents.empty() )
1768 gen->EditStart( genTool,
board, aCommit );
1769 gen->Update( genTool,
board, aCommit );
1770 gen->EditFinish( genTool,
board, aCommit );
1774 EDA_ITEMS oItems( orig_items.begin(), orig_items.end() );
1784 return !restore_state;
bool BoardHasConstraints(BOARD *aBoard)
True if the board or any of its footprints carries at least one geometric constraint.
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 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)
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
virtual 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 DisplayConstraintsMsg(const wxString &msg)
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 items were moved, this can be very high frequency on the canvas, use with care.
static const TOOL_EVENT SelectedItemsMoved
Used to inform tools that the selection should temporarily be non-editable.
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)
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
@ 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