66#define QUIET_MODE true
71 switch( aItem->
Type() )
79 return static_cast<const SCH_LINE*
>( aItem )->IsGraphicLine();
88 if( !aNewLine || !aSource || !aFrame )
99 if( !sourceConnection )
107 newConnection->
Clone( *sourceConnection );
197 bool foundAttachment =
false;
198 bool foundJunction =
false;
199 bool foundPin =
false;
204 foundAttachment =
true;
208 switch( cItem->Type() )
224 if( !foundLine && cLine->
GetLength() == 0 )
230 foundJunction =
true;
240 if( pair.first->IsConnected( selectedEnd ) )
260 bool preferOriginalLine =
false;
264 && line->GetLength() == 0
265 &&
EDA_ANGLE( splitDelta ).IsParallelTo( line->GetStoredAngle() ) )
267 preferOriginalLine =
true;
273 else if( !foundLine && foundJunction && !foundPin )
276 foundLine =
new SCH_LINE( unselectedEnd, line->GetLayer() );
293 if( foundLine && !preferOriginalLine )
314 else if( foundLine->
GetEndPoint() == unselectedEnd )
315 foundLine->
MoveEnd( splitDelta );
347 if(
info.attachedLine == bendLine ||
info.attachedLine == foundLine )
348 info.attachedLine = line;
368 line->MoveEnd( splitDelta );
370 line->MoveStart( splitDelta );
375 else if( line->GetLength() == 0 )
385 else if( foundAttachment && line->IsOrthogonal() )
392 unsigned int xMoveBit = splitDelta.
x != 0;
393 unsigned int yMoveBit = splitDelta.
y != 0;
394 int xLength = abs( unselectedEnd.
x - selectedEnd.
x );
395 int yLength = abs( unselectedEnd.
y - selectedEnd.
y );
396 int xMove = ( xLength - ( xBendCount * lineGrid.
x ) )
397 *
sign( selectedEnd.
x - unselectedEnd.
x );
398 int yMove = ( yLength - ( yBendCount * lineGrid.
y ) )
399 *
sign( selectedEnd.
y - unselectedEnd.
y );
421 xBendCount += yMoveBit;
422 yBendCount += xMoveBit;
427 line->MoveEnd(
VECTOR2I( splitDelta.
x ? splitDelta.
x : xMove,
428 splitDelta.
y ? splitDelta.
y : yMove ) );
432 line->MoveStart(
VECTOR2I( splitDelta.
x ? splitDelta.
x : xMove,
433 splitDelta.
y ? splitDelta.
y : yMove ) );
454 else if( !foundAttachment )
457 line->MoveEnd( splitDelta );
459 line->MoveStart( splitDelta );
494 case MOVE: localCommit.
Push(
_(
"Move" ) );
break;
495 case DRAG: localCommit.
Push(
_(
"Drag" ) );
break;
496 case BREAK: localCommit.
Push(
_(
"Break Wire" ) );
break;
497 case SLICE: localCommit.
Push(
_(
"Slice Wire" ) );
break;
525 if( selection.
Empty() )
528 std::vector<SCH_LINE*> lines;
541 lines.push_back(
static_cast<SCH_LINE*
>( item ) );
552 bool useCursorForSingleLine =
false;
554 if( lines.size() == 1 )
555 useCursorForSingleLine =
true;
562 VECTOR2I breakPos = useCursorForSingleLine ? cursorPos : line->GetMidPoint();
569 lwbTool->
BreakSegment( aCommit, line, breakPos, &newLine, screen );
596 bool currentModeIsDragLike = (
m_mode !=
MOVE );
598 bool didAtLeastOneBreak =
false;
614 bool unselect =
false;
618 std::vector<DANGLING_END_ITEM> internalPoints;
621 bool selectionHasSheetPins =
false;
622 bool selectionHasGraphicItems =
false;
623 bool selectionHasNonGraphicItems =
false;
624 bool selectionIsGraphicsOnly =
false;
626 std::unique_ptr<SCH_DRAG_NET_COLLISION_MONITOR> netCollisionMonitor;
632 selectionHasNonGraphicItems, selectionIsGraphicsOnly );
637 if( !selection.
Empty() )
640 netCollisionMonitor = std::make_unique<SCH_DRAG_NET_COLLISION_MONITOR>(
m_frame,
m_view );
641 netCollisionMonitor->Initialize( selection );
644 bool lastCtrlDown =
false;
653 if( selection.
Empty() )
661 bool restore_state =
false;
672 AXIS_LOCK axisLock = AXIS_LOCK::NONE;
673 long lastArrowKeyAction = 0;
678 wxLogTrace(
traceSchMove,
"doMoveSelection: event loop iteration, evt=%s, action=%s",
684 m_frame->GetCanvas()->SetCurrentCursor( currentCursor );
689 lastCtrlDown = ctrlDown;
719 grid.SetSnap(
false );
725 if( axisLock == AXIS_LOCK::HORIZONTAL )
731 axisLock = AXIS_LOCK::NONE;
737 axisLock = AXIS_LOCK::HORIZONTAL;
742 if( axisLock == AXIS_LOCK::VERTICAL )
748 axisLock = AXIS_LOCK::NONE;
754 axisLock = AXIS_LOCK::VERTICAL;
758 lastArrowKeyAction = action;
765 if( axisLock == AXIS_LOCK::HORIZONTAL )
767 else if( axisLock == AXIS_LOCK::VERTICAL )
772 selectionIsGraphicsOnly, ctrlDown );
774 if( sheet != hoverSheet )
781 m_frame->UpdateItem( hoverSheet,
false );
787 if( netCollisionMonitor )
788 currentCursor = netCollisionMonitor->AdjustCursor( currentCursor );
800 std::vector<SCH_ITEM*> previewItems;
803 previewItems.push_back(
static_cast<SCH_ITEM*
>( it ) );
806 previewItems.push_back( line );
809 previewItems.push_back( line );
811 std::vector<SCH_JUNCTION*> previewJunctions =
814 if( netCollisionMonitor )
815 netCollisionMonitor->Update( previewJunctions, selection );
818 m_view->AddToPreview( jct,
true );
832 m_frame->GetInfoBar()->Dismiss();
849 case MOVE:
m_frame->ShowInfoBarMsg(
_(
"Press <ESC> to cancel move." ) );
break;
850 case DRAG:
m_frame->ShowInfoBarMsg(
_(
"Press <ESC> to cancel drag." ) );
break;
851 case BREAK:
m_frame->ShowInfoBarMsg(
_(
"Press <ESC> to cancel break." ) );
break;
852 case SLICE:
m_frame->ShowInfoBarMsg(
_(
"Press <ESC> to cancel slice." ) );
break;
860 restore_state =
true;
874 wxLogTrace(
traceSchMove,
"doMoveSelection: handleMoveToolActions returned false, exiting" );
893 didAtLeastOneBreak =
true;
932 wxLogTrace(
traceSchMove,
"doMoveSelection: event handled, not passing" );
941 }
while( ( evt =
Wait() ) );
945 if( selectionHasSheetPins || ( selectionIsGraphicsOnly && !lastCtrlDown ) )
946 targetSheet =
nullptr;
951 m_frame->UpdateItem( hoverSheet,
false );
981 return !restore_state;
993 if( aCurrentModeIsDragLike != aWasDragging )
997 if( sel && !sel->
IsNew() )
1026 if( userSelection.
GetSize() == 1 )
1045 aUnselect = selection.
IsHover();
1052 bool& aHasGraphicItems,
bool& aHasNonGraphicItems,
1053 bool& aIsGraphicsOnly )
1055 aHasSheetPins =
false;
1056 aHasGraphicItems =
false;
1057 aHasNonGraphicItems =
false;
1059 for(
EDA_ITEM* edaItem : aSelection )
1064 aHasSheetPins =
true;
1067 aHasGraphicItems =
true;
1069 aHasNonGraphicItems =
true;
1072 aIsGraphicsOnly = aHasGraphicItems && !aHasNonGraphicItems;
1088 std::vector<SCH_ITEM*> stageTwo;
1090 for(
EDA_ITEM* edaItem : aSelection )
1093 std::vector<VECTOR2I> connections;
1095 switch( item->
Type() )
1101 stageTwo.emplace_back( item );
1105 static_cast<SCH_LINE*
>( item )->GetSelectedPoints( connections );
1112 for(
const VECTOR2I& point : connections )
1120 for(
const VECTOR2I& point : item->GetConnectionPoints() )
1124 for(
EDA_ITEM* item : connectedDragItems )
1132 for(
EDA_ITEM* edaItem : aSelection )
1155 static_cast<SCH_ITEM*
>( item )->GetEndPoints( aInternalPoints );
1157 std::vector<DANGLING_END_ITEM> endPointsByType = aInternalPoints;
1158 std::vector<DANGLING_END_ITEM> endPointsByPos = endPointsByType;
1162 static_cast<SCH_ITEM*
>( item )->UpdateDanglingState( endPointsByType, endPointsByPos );
1167 std::vector<DANGLING_END_ITEM>& aInternalPoints,
1173 bool placingNewItems = sch_item && sch_item->
IsNew();
1181 aInternalPoints.clear();
1188 if( !it->IsSelected() )
1201 for(
EDA_ITEM* edaItem : aSelection )
1218 if( !
info.isJunction )
1232 aSnapLayer =
grid.GetSelectionGrid( aSelection );
1238 if( schItem->
IsNew() )
1249 enteredGroup->AddItem( schItem );
1266 shape->SetHatchingDirty();
1267 shape->UpdateHatching();
1294 wxASSERT_MSG(
m_anchorPos,
"Should be already set from previous cmd" );
1296 else if( placingNewItems )
1304 bool isPasted =
false;
1310 if( item->GetParent() && item->GetParent()->IsSelected() )
1316 isPasted |= ( item->GetFlags() &
IS_PASTED ) != 0;
1323 aSelection.SetReferencePoint(
m_cursor );
1336 if(
m_frame->GetMoveWarpsCursor() )
1356 bool aHasSheetPins,
bool aIsGraphicsOnly,
bool aCtrlDown )
1372 selBBox.
Merge( schIt->GetBoundingBox() );
1413 if( sheet->
GetPin( pt ) )
1425 bool dropAllowedBySelection = !aHasSheetPins;
1426 bool dropAllowedByModifiers = !aIsGraphicsOnly || aCtrlDown;
1428 if( sheet && !( dropAllowedBySelection && dropAllowedByModifiers ) )
1436 SCH_COMMIT* aCommit,
int& aXBendCount,
int& aYBendCount,
1439 wxLogTrace(
traceSchMove,
"performItemMove: delta=(%d,%d), moveOffset=(%d,%d), selection size=%u",
1446 std::vector<VECTOR2I> splitMoves;
1455 splitMoves.emplace_back(
VECTOR2I( aDelta.
x, 0 ) );
1465 splitMoves.emplace_back(
VECTOR2I( 0, aDelta.
y ) );
1471 for(
const VECTOR2I& splitDelta : splitMoves )
1474 if( splitDelta ==
VECTOR2I( 0, 0 ) )
1478 ( aDelta.
y >= 0 ) ) )
1481 if( item->GetParent() && item->GetParent()->IsSelected() )
1485 bool isLineModeConstrained =
false;
1491 if( (
m_mode ==
DRAG ) && isLineModeConstrained && line
1494 orthoLineDrag( aCommit, line, splitDelta, aXBendCount, aYBendCount, aGrid );
1507 if( lineEnd.second && lineEnd.first->HasFlag(
STARTPOINT ) )
1508 lineEnd.first->SetStartPoint(
pin->GetPosition() );
1509 else if( !lineEnd.second && lineEnd.first->HasFlag(
ENDPOINT ) )
1510 lineEnd.first->SetEndPoint(
pin->GetPosition() );
1520 if( !label || !
info.attachedLine )
1534 if( deltaStart == deltaEnd )
1536 label->SetPosition(
info.originalLabelPos + deltaStart );
1540 label->Move( splitDelta );
1544 if( !
info.attachedLine->HitTest( label->GetPosition(), 1 ) &&
info.attachedLine->IsOrthogonal() )
1546 VECTOR2I pos = label->GetPosition();
1548 if( start.
x ==
end.x )
1550 int minY = std::min( start.
y,
end.y );
1551 int maxY = std::max( start.
y,
end.y );
1553 pos.
y = std::clamp( pos.
y, minY, maxY );
1555 else if( start.
y ==
end.y )
1557 int minX = std::min( start.
x,
end.x );
1558 int maxX = std::max( start.
x,
end.x );
1560 pos.
x = std::clamp( pos.
x, minX, maxX );
1563 label->SetPosition( pos );
1579 wxLogTrace(
traceSchMove,
"handleMoveToolActions: received event, action=%s",
1580 aEvent->
Format().c_str() );
1584 wxLogTrace(
traceSchMove,
"handleMoveToolActions: doDelete, exiting move" );
1585 const_cast<TOOL_EVENT*
>( aEvent )->SetPassEvent();
1596 wxLogTrace(
traceSchMove,
"handleMoveToolActions: rotateCW event received, selection size=%u",
1599 wxLogTrace(
traceSchMove,
"handleMoveToolActions: rotateCW RunSynchronousAction completed" );
1601 wxLogTrace(
traceSchMove,
"handleMoveToolActions: rotateCW updateStoredPositions completed" );
1606 wxLogTrace(
traceSchMove,
"handleMoveToolActions: rotateCCW event received, selection size=%u",
1609 wxLogTrace(
traceSchMove,
"handleMoveToolActions: rotateCCW RunSynchronousAction completed" );
1611 wxLogTrace(
traceSchMove,
"handleMoveToolActions: rotateCCW updateStoredPositions completed" );
1670 m_frame->SelectUnit( symbol, unit );
1682 m_frame->SelectBodyStyle( symbol, bodyStyle );
1703 wxLogTrace(
traceSchMove,
"updateStoredPositions: start, selection size=%u",
1722 wxLogTrace(
traceSchMove,
" item[%d] type=%d: stored pos updated (%d,%d) -> (%d,%d)",
1723 itemCount++, (
int) schItem->
Type(), oldPos.
x, oldPos.
y, newPos.
x, newPos.
y );
1733 pin->SetStoredPos( pinNewPos );
1734 wxLogTrace(
traceSchMove,
" sheet pin: stored pos updated (%d,%d) -> (%d,%d)",
1735 pinOldPos.
x, pinOldPos.
y, pinNewPos.
x, pinNewPos.
y );
1740 wxLogTrace(
traceSchMove,
"updateStoredPositions: complete, updated %d items", itemCount );
1745 const std::vector<DANGLING_END_ITEM>& aInternalPoints )
1754 newLine->ClearEditFlags();
1761 oldLine->ClearEditFlags();
1776 sch_item->SetConnectivityDirty(
true );
1790 if(
m_frame->GetScreen()->IsExplicitJunctionNeeded( it.GetPosition() ) )
1800 selectionCopy.
Add( line );
1803 selectionCopy.
Add( line );
1810 if( isDragLike && !isSlice )
1820 item->ClearTempFlags();
1822 for(
EDA_ITEM* item : selectionCopy )
1823 item->ClearTempFlags();
1825 m_frame->Schematic().CleanUp( aCommit );
1828 item->ClearEditFlags();
1832 for(
EDA_ITEM* item : selectionCopy )
1833 item->ClearEditFlags();
1854 bbox.
Merge(
static_cast<SCH_ITEM*
>( item )->GetBoundingBox() );
1858 bool overlap =
false;
1863 moved.Move( offset );
1868 if(
moved.Intersects( existing->GetBoundingBox() ) )
1884 m_frame->RemoveFromScreen( schItem, srcScreen );
1887 schItem->
Move( offset );
1890 destScreen->
Append( schItem );
1904 std::set<SCH_ITEM*> danglers;
1906 std::function<void(
SCH_ITEM* )> changeHandler =
1907 [&](
SCH_ITEM* aChangedItem ) ->
void
1915 if( ( aChangedItem->HasFlag(
IS_BROKEN ) || aChangedItem->HasFlag(
IS_NEW ) )
1916 && aChangedItem->IsDangling() && !aChangedItem->IsSelected() )
1918 danglers.insert( aChangedItem );
1922 m_frame->GetScreen()->TestDanglingEnds(
nullptr, &changeHandler );
1946 for(
SCH_ITEM* item : itemsOverlapping )
1948 if( item != aOriginalItem && item->
IsConnected( aPoint ) )
1951 foundJunction = item;
1957 if( foundSymbol && foundJunction )
1959 aList.push_back( foundSymbol );
1965 aList.push_back( foundJunction );
1972 if(
test == aOriginalItem || !
test->CanConnect( aOriginalItem ) )
1975 switch(
test->Type() )
1991 if(
test->IsConnected( aPoint ) )
1992 aList.push_back(
test );
1997 if(
static_cast<SCH_LINE*
>(
test )->HitTest( label->GetPosition(), 1 ) )
1998 aList.push_back(
test );
2011 if(
pin->IsConnected( aPoint ) )
2013 if(
pin->IsSelected() )
2016 aList.push_back(
pin );
2026 if(
test->IsConnected( aPoint ) )
2027 aList.push_back(
test );
2042 aList.push_back( label );
2054 if( line->
HitTest( aPoint, 1 ) )
2055 aList.push_back( label );
2071 std::set<SCH_ITEM*> connectableCandidates;
2072 std::vector<SCH_ITEM*> itemsConnectable;
2073 bool ptHasUnselectedJunction =
false;
2076 connectableCandidates.insert( item );
2083 connectableCandidates.insert( item );
2091 bool isBusLabel =
false;
2102 || selected->GetLayer() ==
LAYER_BUS || isBusLabel )
2122 else if( fixedLine )
2135 auto makeNewJunction =
2152 for(
SCH_ITEM* item : connectableCandidates )
2160 if( !
pin->IsSelected()
2161 &&
pin->GetPosition() == aPoint
2162 &&
pin->CanConnect( aSelectedItem ) )
2164 itemsConnectable.push_back(
pin );
2173 if( item == aSelectedItem
2174 || ( item->Type() !=
SCH_LINE_T && item->IsSelected() )
2180 itemsConnectable.push_back( item );
2183 for(
SCH_ITEM* item : itemsConnectable )
2185 if( item->Type() ==
SCH_JUNCTION_T && item->IsConnected( aPoint ) && !item->IsSelected() )
2187 ptHasUnselectedJunction =
true;
2204 if( ptHasUnselectedJunction )
2224 aList.push_back( line );
2238 aList.push_back( line );
2243 switch( aSelectedItem->
Type() )
2257 newWire = makeNewWire( aCommit, line, aSelectedItem, aPoint, aPoint );
2260 aList.push_back( newWire );
2270 makeNewWire( aCommit, line, line, aPoint, oldEnd );
2271 makeNewJunction( aCommit, line, aPoint );
2303 aList.push_back( label );
2306 info.attachedLine = line;
2320 if(
pin->IsConnected( aPoint ) )
2331 newWire = makeNewWire( aCommit,
pin, aSelectedItem, aPoint, aPoint );
2333 aList.push_back( newWire );
2342 if(
test->IsConnected( aPoint ) && !newWire )
2346 newWire = makeNewWire( aCommit,
test, aSelectedItem, aPoint, aPoint );
2348 aList.push_back( newWire );
2357 aList.push_back(
test );
2392 aList.push_back( label );
2397 info.attachedLine = line;
2406 else if(
test->IsConnected( aPoint ) && !newWire )
2410 newWire = makeNewWire( aCommit,
test, aSelectedItem, aPoint, aPoint );
2412 aList.push_back( newWire );
2438 if( line->
HitTest( point, 1 ) )
2441 aList.push_back(
test );
2444 std::vector<VECTOR2I> ends =
test->GetConnectionPoints();
2447 if( ends[0] == point )
2471 static int moveCallCount = 0;
2472 wxLogTrace(
traceSchMove,
"moveItem[%d]: type=%d, delta=(%d,%d)",
2473 ++moveCallCount, aItem->
Type(), aDelta.
x, aDelta.
y );
2475 switch( aItem->
Type() )
2481 static_cast<SCH_LINE*
>( aItem )->Move( aDelta );
2526 label->
Move( aDelta );
2532 static_cast<SCH_ITEM*
>( aItem )->Move( aDelta );
2565 if( !it->IsSelected() )
2568 if( !selection.
IsHover() && it->IsSelected() )
2571 it->SetStoredPos( it->GetPosition() );
2576 pin->SetStoredPos(
pin->GetPosition() );
2596 std::vector<EDA_ITEM*> items( selection.
begin(), selection.
end() );
2605 m_frame->Schematic().CleanUp( &commit );
2606 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.
static bool IsBusLabel(const wxString &aLabel)
Test if aLabel has a bus notation.
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.
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.
bool IsTopLevelSheet() const
Check if this sheet is a top-level sheet.
SCH_SHEET_PIN * GetPin(const VECTOR2I &aPosition)
Return the sheet pin item found at aPosition in the sheet.
SCH_SCREEN * GetScreen() const
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
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
#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.
void MoveSchematicItem(EDA_ITEM *aItem, const VECTOR2I &aDelta)
Move a schematic item by a delta.
void AlignSchematicItemsToGrid(SCH_SCREEN *aScreen, const std::vector< EDA_ITEM * > &aItems, EE_GRID_HELPER &aGrid, GRID_HELPER_GRIDS aSelectionGrid, const SCH_ALIGNMENT_CALLBACKS &aCallbacks)
Align a set of schematic items to the grid.
std::vector< EDA_ITEM * > EDA_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.
Callbacks for alignment operations.
std::function< void(SCH_ITEM *aItem, const VECTOR2I &aPoint, EDA_ITEMS &aList)> m_getConnectedDragItems
Callback to get items connected to a given item at a specific point.
std::function< void(EDA_ITEM *aItem, const VECTOR2I &aDelta)> m_doMoveItem
Callback to move an item by a delta.
std::function< void(EDA_ITEM *aItem)> m_updateItem
Optional callback to update an item's display after modification.
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