62#define QUIET_MODE true
67 switch( aItem->
Type() )
75 return static_cast<const SCH_LINE*
>( aItem )->IsGraphicLine();
84 if( !aNewLine || !aSource || !aFrame )
95 if( !sourceConnection )
103 newConnection->
Clone( *sourceConnection );
193 bool foundAttachment =
false;
194 bool foundJunction =
false;
195 bool foundPin =
false;
200 foundAttachment =
true;
204 switch( cItem->Type() )
220 if( !foundLine && cLine->
GetLength() == 0 )
226 foundJunction =
true;
236 if( pair.first->IsConnected( selectedEnd ) )
256 bool preferOriginalLine =
false;
260 && line->GetLength() == 0
261 &&
EDA_ANGLE( splitDelta ).IsParallelTo( line->GetStoredAngle() ) )
263 preferOriginalLine =
true;
269 else if( !foundLine && foundJunction && !foundPin )
272 foundLine =
new SCH_LINE( unselectedEnd, line->GetLayer() );
289 if( foundLine && !preferOriginalLine )
310 else if( foundLine->
GetEndPoint() == unselectedEnd )
311 foundLine->
MoveEnd( splitDelta );
343 if(
info.attachedLine == bendLine ||
info.attachedLine == foundLine )
344 info.attachedLine = line;
364 line->MoveEnd( splitDelta );
366 line->MoveStart( splitDelta );
371 else if( line->GetLength() == 0 )
381 else if( foundAttachment && line->IsOrthogonal() )
388 unsigned int xMoveBit = splitDelta.
x != 0;
389 unsigned int yMoveBit = splitDelta.
y != 0;
390 int xLength = abs( unselectedEnd.
x - selectedEnd.
x );
391 int yLength = abs( unselectedEnd.
y - selectedEnd.
y );
392 int xMove = ( xLength - ( xBendCount * lineGrid.
x ) )
393 *
sign( selectedEnd.
x - unselectedEnd.
x );
394 int yMove = ( yLength - ( yBendCount * lineGrid.
y ) )
395 *
sign( selectedEnd.
y - unselectedEnd.
y );
417 xBendCount += yMoveBit;
418 yBendCount += xMoveBit;
423 line->MoveEnd(
VECTOR2I( splitDelta.
x ? splitDelta.
x : xMove,
424 splitDelta.
y ? splitDelta.
y : yMove ) );
428 line->MoveStart(
VECTOR2I( splitDelta.
x ? splitDelta.
x : xMove,
429 splitDelta.
y ? splitDelta.
y : yMove ) );
450 else if( !foundAttachment )
453 line->MoveEnd( splitDelta );
455 line->MoveStart( splitDelta );
490 case MOVE: localCommit.
Push(
_(
"Move" ) );
break;
491 case DRAG: localCommit.
Push(
_(
"Drag" ) );
break;
492 case BREAK: localCommit.
Push(
_(
"Break Wire" ) );
break;
493 case SLICE: localCommit.
Push(
_(
"Slice Wire" ) );
break;
521 if( selection.
Empty() )
524 std::vector<SCH_LINE*> lines;
537 lines.push_back(
static_cast<SCH_LINE*
>( item ) );
548 bool useCursorForSingleLine =
false;
550 if( lines.size() == 1 )
551 useCursorForSingleLine =
true;
558 VECTOR2I breakPos = useCursorForSingleLine ? cursorPos : line->GetMidPoint();
565 lwbTool->
BreakSegment( aCommit, line, breakPos, &newLine, screen );
592 bool currentModeIsDragLike = (
m_mode !=
MOVE );
594 bool didAtLeastOneBreak =
false;
610 bool unselect =
false;
614 std::vector<DANGLING_END_ITEM> internalPoints;
617 bool selectionHasSheetPins =
false;
618 bool selectionHasGraphicItems =
false;
619 bool selectionHasNonGraphicItems =
false;
620 bool selectionIsGraphicsOnly =
false;
622 std::unique_ptr<SCH_DRAG_NET_COLLISION_MONITOR> netCollisionMonitor;
628 selectionHasNonGraphicItems, selectionIsGraphicsOnly );
633 if( !selection.
Empty() )
636 netCollisionMonitor = std::make_unique<SCH_DRAG_NET_COLLISION_MONITOR>(
m_frame,
m_view );
637 netCollisionMonitor->Initialize( selection );
640 bool lastCtrlDown =
false;
649 if( selection.
Empty() )
657 bool restore_state =
false;
668 AXIS_LOCK axisLock = AXIS_LOCK::NONE;
669 long lastArrowKeyAction = 0;
674 wxLogTrace(
traceSchMove,
"doMoveSelection: event loop iteration, evt=%s, action=%s",
680 m_frame->GetCanvas()->SetCurrentCursor( currentCursor );
685 lastCtrlDown = ctrlDown;
715 grid.SetSnap(
false );
721 if( axisLock == AXIS_LOCK::HORIZONTAL )
727 axisLock = AXIS_LOCK::NONE;
733 axisLock = AXIS_LOCK::HORIZONTAL;
738 if( axisLock == AXIS_LOCK::VERTICAL )
744 axisLock = AXIS_LOCK::NONE;
750 axisLock = AXIS_LOCK::VERTICAL;
754 lastArrowKeyAction = action;
761 if( axisLock == AXIS_LOCK::HORIZONTAL )
763 else if( axisLock == AXIS_LOCK::VERTICAL )
768 selectionIsGraphicsOnly, ctrlDown );
770 if( sheet != hoverSheet )
777 m_frame->UpdateItem( hoverSheet,
false );
783 if( netCollisionMonitor )
784 currentCursor = netCollisionMonitor->AdjustCursor( currentCursor );
796 std::vector<SCH_ITEM*> previewItems;
799 previewItems.push_back(
static_cast<SCH_ITEM*
>( it ) );
802 previewItems.push_back( line );
805 previewItems.push_back( line );
807 std::vector<SCH_JUNCTION*> previewJunctions =
810 if( netCollisionMonitor )
811 netCollisionMonitor->Update( previewJunctions, selection );
814 m_view->AddToPreview( jct,
true );
828 m_frame->GetInfoBar()->Dismiss();
845 case MOVE:
m_frame->ShowInfoBarMsg(
_(
"Press <ESC> to cancel move." ) );
break;
846 case DRAG:
m_frame->ShowInfoBarMsg(
_(
"Press <ESC> to cancel drag." ) );
break;
847 case BREAK:
m_frame->ShowInfoBarMsg(
_(
"Press <ESC> to cancel break." ) );
break;
848 case SLICE:
m_frame->ShowInfoBarMsg(
_(
"Press <ESC> to cancel slice." ) );
break;
856 restore_state =
true;
870 wxLogTrace(
traceSchMove,
"doMoveSelection: handleMoveToolActions returned false, exiting" );
889 didAtLeastOneBreak =
true;
928 wxLogTrace(
traceSchMove,
"doMoveSelection: event handled, not passing" );
937 }
while( ( evt =
Wait() ) );
941 if( selectionHasSheetPins || ( selectionIsGraphicsOnly && !lastCtrlDown ) )
942 targetSheet =
nullptr;
947 m_frame->UpdateItem( hoverSheet,
false );
977 return !restore_state;
989 if( aCurrentModeIsDragLike != aWasDragging )
993 if( sel && !sel->
IsNew() )
1022 if( userSelection.
GetSize() == 1 )
1041 aUnselect = selection.
IsHover();
1048 bool& aHasGraphicItems,
bool& aHasNonGraphicItems,
1049 bool& aIsGraphicsOnly )
1051 aHasSheetPins =
false;
1052 aHasGraphicItems =
false;
1053 aHasNonGraphicItems =
false;
1055 for(
EDA_ITEM* edaItem : aSelection )
1060 aHasSheetPins =
true;
1063 aHasGraphicItems =
true;
1065 aHasNonGraphicItems =
true;
1068 aIsGraphicsOnly = aHasGraphicItems && !aHasNonGraphicItems;
1084 std::vector<SCH_ITEM*> stageTwo;
1086 for(
EDA_ITEM* edaItem : aSelection )
1089 std::vector<VECTOR2I> connections;
1091 switch( item->
Type() )
1097 stageTwo.emplace_back( item );
1101 static_cast<SCH_LINE*
>( item )->GetSelectedPoints( connections );
1108 for(
const VECTOR2I& point : connections )
1116 for(
const VECTOR2I& point : item->GetConnectionPoints() )
1120 for(
EDA_ITEM* item : connectedDragItems )
1128 for(
EDA_ITEM* edaItem : aSelection )
1151 static_cast<SCH_ITEM*
>( item )->GetEndPoints( aInternalPoints );
1153 std::vector<DANGLING_END_ITEM> endPointsByType = aInternalPoints;
1154 std::vector<DANGLING_END_ITEM> endPointsByPos = endPointsByType;
1158 static_cast<SCH_ITEM*
>( item )->UpdateDanglingState( endPointsByType, endPointsByPos );
1163 std::vector<DANGLING_END_ITEM>& aInternalPoints,
1169 bool placingNewItems = sch_item && sch_item->
IsNew();
1177 aInternalPoints.clear();
1184 if( !it->IsSelected() )
1197 for(
EDA_ITEM* edaItem : aSelection )
1214 if( !
info.isJunction )
1228 aSnapLayer =
grid.GetSelectionGrid( aSelection );
1234 if( schItem->
IsNew() )
1245 enteredGroup->AddItem( schItem );
1262 shape->SetHatchingDirty();
1263 shape->UpdateHatching();
1290 wxASSERT_MSG(
m_anchorPos,
"Should be already set from previous cmd" );
1292 else if( placingNewItems )
1300 bool isPasted =
false;
1306 if( item->GetParent() && item->GetParent()->IsSelected() )
1312 isPasted |= ( item->GetFlags() &
IS_PASTED ) != 0;
1319 aSelection.SetReferencePoint(
m_cursor );
1332 if(
m_frame->GetMoveWarpsCursor() )
1352 bool aHasSheetPins,
bool aIsGraphicsOnly,
bool aCtrlDown )
1368 selBBox.
Merge( schIt->GetBoundingBox() );
1396 bool dropAllowedBySelection = !aHasSheetPins;
1397 bool dropAllowedByModifiers = !aIsGraphicsOnly || aCtrlDown;
1399 if( sheet && !( dropAllowedBySelection && dropAllowedByModifiers ) )
1407 SCH_COMMIT* aCommit,
int& aXBendCount,
int& aYBendCount,
1410 wxLogTrace(
traceSchMove,
"performItemMove: delta=(%d,%d), moveOffset=(%d,%d), selection size=%u",
1417 std::vector<VECTOR2I> splitMoves;
1426 splitMoves.emplace_back(
VECTOR2I( aDelta.
x, 0 ) );
1436 splitMoves.emplace_back(
VECTOR2I( 0, aDelta.
y ) );
1442 for(
const VECTOR2I& splitDelta : splitMoves )
1445 if( splitDelta ==
VECTOR2I( 0, 0 ) )
1449 ( aDelta.
y >= 0 ) ) )
1452 if( item->GetParent() && item->GetParent()->IsSelected() )
1456 bool isLineModeConstrained =
false;
1462 if( (
m_mode ==
DRAG ) && isLineModeConstrained && line
1465 orthoLineDrag( aCommit, line, splitDelta, aXBendCount, aYBendCount, aGrid );
1478 if( lineEnd.second && lineEnd.first->HasFlag(
STARTPOINT ) )
1479 lineEnd.first->SetStartPoint(
pin->GetPosition() );
1480 else if( !lineEnd.second && lineEnd.first->HasFlag(
ENDPOINT ) )
1481 lineEnd.first->SetEndPoint(
pin->GetPosition() );
1494 wxLogTrace(
traceSchMove,
"handleMoveToolActions: received event, action=%s",
1495 aEvent->
Format().c_str() );
1499 wxLogTrace(
traceSchMove,
"handleMoveToolActions: doDelete, exiting move" );
1500 const_cast<TOOL_EVENT*
>( aEvent )->SetPassEvent();
1511 wxLogTrace(
traceSchMove,
"handleMoveToolActions: rotateCW event received, selection size=%u",
1514 wxLogTrace(
traceSchMove,
"handleMoveToolActions: rotateCW RunSynchronousAction completed" );
1516 wxLogTrace(
traceSchMove,
"handleMoveToolActions: rotateCW updateStoredPositions completed" );
1521 wxLogTrace(
traceSchMove,
"handleMoveToolActions: rotateCCW event received, selection size=%u",
1524 wxLogTrace(
traceSchMove,
"handleMoveToolActions: rotateCCW RunSynchronousAction completed" );
1526 wxLogTrace(
traceSchMove,
"handleMoveToolActions: rotateCCW updateStoredPositions completed" );
1585 m_frame->SelectUnit( symbol, unit );
1597 m_frame->SelectBodyStyle( symbol, bodyStyle );
1618 wxLogTrace(
traceSchMove,
"updateStoredPositions: start, selection size=%u",
1637 wxLogTrace(
traceSchMove,
" item[%d] type=%d: stored pos updated (%d,%d) -> (%d,%d)",
1638 itemCount++, (
int) schItem->
Type(), oldPos.
x, oldPos.
y, newPos.
x, newPos.
y );
1648 pin->SetStoredPos( pinNewPos );
1649 wxLogTrace(
traceSchMove,
" sheet pin: stored pos updated (%d,%d) -> (%d,%d)",
1650 pinOldPos.
x, pinOldPos.
y, pinNewPos.
x, pinNewPos.
y );
1655 wxLogTrace(
traceSchMove,
"updateStoredPositions: complete, updated %d items", itemCount );
1660 const std::vector<DANGLING_END_ITEM>& aInternalPoints )
1669 newLine->ClearEditFlags();
1676 oldLine->ClearEditFlags();
1691 sch_item->SetConnectivityDirty(
true );
1705 if(
m_frame->GetScreen()->IsExplicitJunctionNeeded( it.GetPosition() ) )
1715 selectionCopy.
Add( line );
1718 selectionCopy.
Add( line );
1725 if( isDragLike && !isSlice )
1732 m_frame->Schematic().CleanUp( aCommit );
1735 item->ClearEditFlags();
1739 for(
EDA_ITEM* item : selectionCopy )
1740 item->ClearEditFlags();
1761 bbox.
Merge(
static_cast<SCH_ITEM*
>( item )->GetBoundingBox() );
1765 bool overlap =
false;
1770 moved.Move( offset );
1775 if(
moved.Intersects( existing->GetBoundingBox() ) )
1791 m_frame->RemoveFromScreen( schItem, srcScreen );
1794 schItem->
Move( offset );
1797 destScreen->
Append( schItem );
1811 std::set<SCH_ITEM*> danglers;
1813 std::function<void(
SCH_ITEM* )> changeHandler =
1814 [&](
SCH_ITEM* aChangedItem ) ->
void
1821 if( aChangedItem->HasFlag(
IS_BROKEN) && aChangedItem->IsDangling()
1822 && !aChangedItem->IsSelected() )
1824 danglers.insert( aChangedItem );
1828 m_frame->GetScreen()->TestDanglingEnds(
nullptr, &changeHandler );
1852 for(
SCH_ITEM* item : itemsOverlapping )
1854 if( item != aOriginalItem && item->
IsConnected( aPoint ) )
1857 foundJunction = item;
1863 if( foundSymbol && foundJunction )
1865 aList.push_back( foundSymbol );
1871 aList.push_back( foundJunction );
1878 if(
test == aOriginalItem || !
test->CanConnect( aOriginalItem ) )
1881 switch(
test->Type() )
1897 if(
test->IsConnected( aPoint ) )
1898 aList.push_back(
test );
1903 if(
static_cast<SCH_LINE*
>(
test )->HitTest( label->GetPosition(), 1 ) )
1904 aList.push_back(
test );
1917 if(
pin->IsConnected( aPoint ) )
1919 if(
pin->IsSelected() )
1922 aList.push_back(
pin );
1932 if(
test->IsConnected( aPoint ) )
1933 aList.push_back(
test );
1948 aList.push_back( label );
1960 if( line->
HitTest( aPoint, 1 ) )
1961 aList.push_back( label );
1978 std::vector<SCH_ITEM*> itemsConnectable;
1979 bool ptHasUnselectedJunction =
false;
2010 else if( fixedLine )
2023 auto makeNewJunction =
2040 for(
SCH_ITEM* item : itemsOverlappingRTree )
2048 if( !
pin->IsSelected()
2049 &&
pin->GetPosition() == aPoint
2050 &&
pin->CanConnect( aSelectedItem ) )
2052 itemsConnectable.push_back(
pin );
2061 if( item == aSelectedItem
2062 || ( item->Type() !=
SCH_LINE_T && item->IsSelected() )
2068 itemsConnectable.push_back( item );
2071 for(
SCH_ITEM* item : itemsConnectable )
2073 if( item->Type() ==
SCH_JUNCTION_T && item->IsConnected( aPoint ) && !item->IsSelected() )
2075 ptHasUnselectedJunction =
true;
2092 if( ptHasUnselectedJunction )
2112 aList.push_back( line );
2126 aList.push_back( line );
2131 switch( aSelectedItem->
Type() )
2145 newWire = makeNewWire( aCommit, line, aSelectedItem, aPoint, aPoint );
2148 aList.push_back( newWire );
2158 makeNewWire( aCommit, line, line, aPoint, oldEnd );
2159 makeNewJunction( aCommit, line, aPoint );
2191 aList.push_back( label );
2194 info.attachedLine = line;
2206 if(
pin->IsConnected( aPoint ) )
2217 newWire = makeNewWire( aCommit,
pin, aSelectedItem, aPoint, aPoint );
2219 aList.push_back( newWire );
2228 if(
test->IsConnected( aPoint ) )
2233 aList.push_back(
test );
2239 newWire = makeNewWire( aCommit,
test, aSelectedItem, aPoint, aPoint );
2241 aList.push_back( newWire );
2251 aList.push_back(
test );
2286 aList.push_back( label );
2291 info.attachedLine = line;
2298 else if(
test->IsConnected( aPoint ) && !newWire )
2302 newWire = makeNewWire( aCommit,
test, aSelectedItem, aPoint, aPoint );
2304 aList.push_back( newWire );
2330 if( line->
HitTest( point, 1 ) )
2333 aList.push_back(
test );
2336 std::vector<VECTOR2I> ends =
test->GetConnectionPoints();
2339 if( ends[0] == point )
2363 static int moveCallCount = 0;
2364 wxLogTrace(
traceSchMove,
"moveItem[%d]: type=%d, delta=(%d,%d)",
2365 ++moveCallCount, aItem->
Type(), aDelta.
x, aDelta.
y );
2367 switch( aItem->
Type() )
2409 pin->SetStoredPos(
pin->GetStoredPos() + aDelta );
2410 pin->ConstrainOnEdge(
pin->GetStoredPos(),
true );
2424 SEG currentLine(
info.attachedLine->GetStartPoint(),
info.attachedLine->GetEndPoint() );
2429 label->
Move( aDelta );
2436 static_cast<SCH_ITEM*
>( aItem )->Move( aDelta );
2469 if( !it->IsSelected() )
2472 if( !selection.
IsHover() && it->IsSelected() )
2475 it->SetStoredPos( it->GetPosition() );
2480 pin->SetStoredPos(
pin->GetPosition() );
2492 for(
int ii = 0; ii < 2; ++ii )
2499 std::set<EDA_ITEM*> unique_items( drag_items.begin(), drag_items.end() );
2505 for(
EDA_ITEM* dragItem : unique_items )
2507 if( dragItem->GetParent() && dragItem->GetParent()->IsSelected() )
2510 doMoveItem( dragItem,
delta );
2520 doMoveItem( item,
delta );
2527 VECTOR2I tl_delta =
grid.AlignGrid( topLeft, selectionGrid ) - topLeft;
2528 VECTOR2I br_delta =
grid.AlignGrid( bottomRight, selectionGrid ) - bottomRight;
2532 doMoveItem( sheet, tl_delta );
2544 newPos =
pin->GetPosition() + tl_delta;
2546 newPos =
pin->GetPosition() + br_delta;
2558 for(
EDA_ITEM* dragItem : drag_items )
2560 if( dragItem->GetParent() && dragItem->GetParent()->IsSelected() )
2563 doMoveItem( dragItem,
delta );
2574 for(
const VECTOR2I& point : connections )
2577 std::map<VECTOR2I, int> shifts;
2581 for(
const VECTOR2I& conn : connections )
2583 VECTOR2I gridpt =
grid.AlignGrid( conn, selectionGrid ) - conn;
2587 if( shifts[gridpt] > max_count )
2589 most_common = gridpt;
2590 max_count = shifts[most_common];
2594 if( most_common !=
VECTOR2I( 0, 0 ) )
2596 doMoveItem( item, most_common );
2598 for(
EDA_ITEM* dragItem : drag_items )
2600 if( dragItem->GetParent() && dragItem->GetParent()->IsSelected() )
2603 doMoveItem( dragItem, most_common );
2615 m_frame->Schematic().CleanUp( &commit );
2616 commit.
Push(
_(
"Align Items to Grid" ) );
constexpr EDA_IU_SCALE schIUScale
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
constexpr const Vec & GetPosition() const
constexpr coord_type GetY() const
constexpr size_type GetWidth() const
constexpr coord_type GetX() const
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
constexpr size_type GetHeight() const
constexpr bool Contains(const Vec &aPoint) const
COMMIT & Added(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been added.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
COMMIT & Removed(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
static void sort_dangling_end_items(std::vector< DANGLING_END_ITEM > &aItemListByType, std::vector< DANGLING_END_ITEM > &aItemListByPos)
Both contain the same information.
Helper class used to store the state of schematic items that can be connected to other schematic item...
A base class for most all the KiCad significant classes used in schematics and boards.
virtual VECTOR2I GetPosition() const
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
void SetFlags(EDA_ITEM_FLAGS aMask)
virtual EDA_GROUP * GetParentGroup() const
KICAD_T Type() const
Returns the type of object.
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
EDA_ITEM * GetParent() const
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
const VECTOR2I & GetTextPos() const
Implement an R-tree for fast spatial and type indexing of schematic items.
EE_TYPE Overlapping(const BOX2I &aRect) const
static const TOOL_EVENT SelectedItemsMoved
Used to inform tools that the selection should temporarily be non-editable.
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.
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
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.
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
const VC_SETTINGS & GetSettings() const
Return the current VIEW_CONTROLS settings.
static TOOL_ACTION rotateCCW
static TOOL_ACTION breakWire
static TOOL_ACTION toText
static TOOL_ACTION restartMove
static TOOL_ACTION toHLabel
static TOOL_ACTION rotateCW
static TOOL_ACTION toLabel
static TOOL_ACTION alignToGrid
static TOOL_ACTION toDLabel
static TOOL_ACTION toTextBox
static TOOL_ACTION highlightNet
static TOOL_ACTION repeatDrawItem
static TOOL_ACTION toGLabel
static TOOL_ACTION selectOnPCB
static const std::vector< KICAD_T > MovableItems
COMMIT & Stage(EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE) override
Add a change of the item aItem of type aChangeType to the change list.
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Execute the changes.
virtual void Revert() override
Revert the commit by restoring the modified items state.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
void Clone(const SCH_CONNECTION &aOther)
Copies connectivity information (but not parent) from another connection.
Schematic editor (Eeschema) main window.
SCH_SHEET_PATH & GetCurrentSheet() const
A set of SCH_ITEMs (i.e., without duplicates).
Base class for any item which can be embedded within the SCHEMATIC container class,...
void SetStoredPos(const VECTOR2I &aPos)
virtual bool CanConnect(const SCH_ITEM *aItem) const
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode)
SCH_CONNECTION * InitializeConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
Create a new connection object associated with this object.
virtual void Move(const VECTOR2I &aMoveVector)
Move the item by aMoveVector to a new position.
void SetLayer(SCH_LAYER_ID aLayer)
void SetConnectivityDirty(bool aDirty=true)
void SetFieldsAutoplaced(AUTOPLACE_ALGO aAlgo)
bool IsConnected(const VECTOR2I &aPoint) const
Test the item to see if it is connected to aPoint.
virtual bool IsMovableFromAnchorPoint() const
Check if object is movable from the anchor point.
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
VECTOR2I & GetStoredPos()
bool IsGroupableType() const
virtual std::vector< VECTOR2I > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
void SetLastResolvedState(const SCH_ITEM *aItem) override
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
void SetPosition(const VECTOR2I &aPosition) override
bool CanConnect(const SCH_ITEM *aItem) const override
Segment description base class to describe items which have 2 end points (track, wire,...
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
void StoreAngle()
Save the current line angle.
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
EDA_ANGLE Angle() const
Get the angle between the start and end lines.
VECTOR2I GetEndPoint() const
VECTOR2I GetStartPoint() const
void MoveEnd(const VECTOR2I &aMoveVector)
void SetLastResolvedState(const SCH_ITEM *aItem) override
void MoveStart(const VECTOR2I &aMoveVector)
void SetEndPoint(const VECTOR2I &aPosition)
void Append(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
EE_RTREE & Items()
Get the full RTree, usually for iterating.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
void SetSize(const VECTOR2I &aSize)
bool IsTopLevelSheet() const
Check if this sheet is a top-level sheet.
SCH_SCREEN * GetScreen() const
VECTOR2I GetPosition() const override
const BOX2I GetBodyBoundingBox() const
Return a bounding box for the sheet body but not the fields.
std::vector< SCH_SHEET_PIN * > & GetPins()
VECTOR2I GetPosition() const override
const VECTOR2I NearestPoint(const VECTOR2I &aP) const
Compute a point on the segment (this) that is closest to point aP.
static SELECTION_CONDITION OnlyTypes(std::vector< KICAD_T > aTypes)
Create a functor that tests if the selected items are only of given types.
virtual void Add(EDA_ITEM *aItem)
VECTOR2I GetReferencePoint() const
virtual unsigned int GetSize() const override
Return the number of stored items.
int Size() const
Returns the number of selected parts.
void SetReferencePoint(const VECTOR2I &aP)
bool Empty() const
Checks if there is anything selected.
std::vector< EDA_ITEM * > GetItemsSortedByTypeAndXY(bool leftBeforeRight=true, bool topBeforeBottom=true) const
Returns a copy of this selection of items sorted by their X then Y position.
bool HasReferencePoint() const
const TRANSFORM & GetTransform() const
@ CHT_DONE
Flag to indicate the change is already applied.
static constexpr EDA_ANGLE ANGLE_90
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_CHANGED
Item was edited, and modified.
#define BRIGHTENED
item is drawn with a bright contour
#define IS_NEW
New item, just created.
#define SELECTED
Item was manually selected by the user.
#define SELECTED_BY_DRAG
Item was algorithmically selected as a dragged item.
#define IS_BROKEN
Is a segment just broken by BreakSegment.
#define STRUCT_DELETED
flag indication structures to be erased
#define ENDPOINT
ends. (Used to support dragging.)
#define IS_MOVING
Item being moved.
#define STARTPOINT
When a line is selected, these flags indicate which.
@ ID_POPUP_SCH_SELECT_UNIT
@ ID_POPUP_SCH_SELECT_BODY_STYLE
@ ID_POPUP_SCH_SELECT_BODY_STYLE_END
@ ID_POPUP_SCH_SELECT_UNIT_END
const wxChar *const traceSchMove
Flag to watch how schematic move tool actions are handled.
std::vector< SCH_JUNCTION * > PreviewJunctions(const class SCH_SCREEN *aScreen, const std::vector< class SCH_ITEM * > &aItems)
Determine the points where explicit junctions would be required if the given temporary items were com...
POINT_INFO AnalyzePoint(const EE_RTREE &aItem, const VECTOR2I &aPosition, bool aBreakCrossings)
Check a tree of items for a confluence at a given point and work out what kind of junction it is,...
@ REPAINT
Item needs to be redrawn.
bool signbit(T v)
Integral version of std::signbit that works all compilers.
Class to handle a set of SCH_ITEMs.
T * GetAppSettings(const char *aFilename)
The EE_TYPE struct provides a type-specific auto-range iterator to the RTree.
A selection of information about a point in the schematic that might be eligible for turning into a j...
VECTOR2D m_lastKeyboardCursorPosition
Position of the above event.
bool m_lastKeyboardCursorPositionValid
Is last cursor motion event coming from keyboard arrow cursor motion action.
long m_lastKeyboardCursorCommand
ACTIONS::CURSOR_UP, ACTIONS::CURSOR_DOWN, etc.
wxLogTrace helper definitions.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
constexpr int sign(T val)
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D