63#define QUIET_MODE true
68 switch( aItem->
Type() )
76 return static_cast<const SCH_LINE*
>( aItem )->IsGraphicLine();
85 if( !aNewLine || !aSource || !aFrame )
96 if( !sourceConnection )
104 newConnection->
Clone( *sourceConnection );
194 bool foundAttachment =
false;
195 bool foundJunction =
false;
196 bool foundPin =
false;
201 foundAttachment =
true;
205 switch( cItem->Type() )
221 if( !foundLine && cLine->
GetLength() == 0 )
227 foundJunction =
true;
237 if( pair.first->IsConnected( selectedEnd ) )
257 bool preferOriginalLine =
false;
261 && line->GetLength() == 0
262 &&
EDA_ANGLE( splitDelta ).IsParallelTo( line->GetStoredAngle() ) )
264 preferOriginalLine =
true;
270 else if( !foundLine && foundJunction && !foundPin )
273 foundLine =
new SCH_LINE( unselectedEnd, line->GetLayer() );
290 if( foundLine && !preferOriginalLine )
311 else if( foundLine->
GetEndPoint() == unselectedEnd )
312 foundLine->
MoveEnd( splitDelta );
344 if(
info.attachedLine == bendLine ||
info.attachedLine == foundLine )
346 info.attachedLine = line;
347 info.originalLineStart = line->GetStartPoint();
348 info.originalLineEnd = line->GetEndPoint();
369 line->MoveEnd( splitDelta );
371 line->MoveStart( splitDelta );
376 else if( line->GetLength() == 0 )
386 else if( foundAttachment && line->IsOrthogonal() )
393 unsigned int xMoveBit = splitDelta.
x != 0;
394 unsigned int yMoveBit = splitDelta.
y != 0;
395 int xLength = abs( unselectedEnd.
x - selectedEnd.
x );
396 int yLength = abs( unselectedEnd.
y - selectedEnd.
y );
397 int xMove = ( xLength - ( xBendCount * lineGrid.
x ) )
398 *
sign( selectedEnd.
x - unselectedEnd.
x );
399 int yMove = ( yLength - ( yBendCount * lineGrid.
y ) )
400 *
sign( selectedEnd.
y - unselectedEnd.
y );
422 xBendCount += yMoveBit;
423 yBendCount += xMoveBit;
428 line->MoveEnd(
VECTOR2I( splitDelta.
x ? splitDelta.
x : xMove,
429 splitDelta.
y ? splitDelta.
y : yMove ) );
433 line->MoveStart(
VECTOR2I( splitDelta.
x ? splitDelta.
x : xMove,
434 splitDelta.
y ? splitDelta.
y : yMove ) );
466 else if( !foundAttachment )
469 line->MoveEnd( splitDelta );
471 line->MoveStart( splitDelta );
506 case MOVE: localCommit.
Push(
_(
"Move" ) );
break;
507 case DRAG: localCommit.
Push(
_(
"Drag" ) );
break;
508 case BREAK: localCommit.
Push(
_(
"Break Wire" ) );
break;
509 case SLICE: localCommit.
Push(
_(
"Slice Wire" ) );
break;
537 if( selection.
Empty() )
540 std::vector<SCH_LINE*> lines;
553 lines.push_back(
static_cast<SCH_LINE*
>( item ) );
564 bool useCursorForSingleLine =
false;
566 if( lines.size() == 1 )
567 useCursorForSingleLine =
true;
574 VECTOR2I breakPos = useCursorForSingleLine ? cursorPos : line->GetMidPoint();
581 lwbTool->
BreakSegment( aCommit, line, breakPos, &newLine, screen );
608 bool currentModeIsDragLike = (
m_mode !=
MOVE );
610 bool didAtLeastOneBreak =
false;
626 bool unselect =
false;
630 std::vector<DANGLING_END_ITEM> internalPoints;
633 bool selectionHasSheetPins =
false;
634 bool selectionHasGraphicItems =
false;
635 bool selectionHasNonGraphicItems =
false;
636 bool selectionIsGraphicsOnly =
false;
638 std::unique_ptr<SCH_DRAG_NET_COLLISION_MONITOR> netCollisionMonitor;
644 selectionHasNonGraphicItems, selectionIsGraphicsOnly );
649 if( !selection.
Empty() )
652 netCollisionMonitor = std::make_unique<SCH_DRAG_NET_COLLISION_MONITOR>(
m_frame,
m_view );
653 netCollisionMonitor->Initialize( selection );
656 bool lastCtrlDown =
false;
662 bool pasteHoldingCtrl =
false;
668 pasteHoldingCtrl = wxGetKeyState( WXK_CONTROL );
680 if( selection.
Empty() )
688 bool restore_state =
false;
699 AXIS_LOCK axisLock = AXIS_LOCK::NONE;
700 long lastArrowKeyAction = 0;
705 wxLogTrace(
traceSchMove,
"doMoveSelection: event loop iteration, evt=%s, action=%s",
711 m_frame->GetCanvas()->SetCurrentCursor( currentCursor );
719 if( pasteHoldingCtrl && hasModifierState && !ctrlDown )
720 pasteHoldingCtrl =
false;
724 bool gridSnapDisabled = ctrlDown && !pasteHoldingCtrl;
726 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !gridSnapDisabled );
728 lastCtrlDown = ctrlDown;
758 grid.SetSnap(
false );
764 if( axisLock == AXIS_LOCK::HORIZONTAL )
770 axisLock = AXIS_LOCK::NONE;
776 axisLock = AXIS_LOCK::HORIZONTAL;
781 if( axisLock == AXIS_LOCK::VERTICAL )
787 axisLock = AXIS_LOCK::NONE;
793 axisLock = AXIS_LOCK::VERTICAL;
797 lastArrowKeyAction = action;
804 if( axisLock == AXIS_LOCK::HORIZONTAL )
806 else if( axisLock == AXIS_LOCK::VERTICAL )
818 if( sheet != hoverSheet )
825 m_frame->UpdateItem( hoverSheet,
false );
831 if( netCollisionMonitor )
832 currentCursor = netCollisionMonitor->AdjustCursor( currentCursor );
844 std::vector<SCH_ITEM*> previewItems;
847 previewItems.push_back(
static_cast<SCH_ITEM*
>( it ) );
850 previewItems.push_back( line );
853 previewItems.push_back( line );
855 std::vector<SCH_JUNCTION*> previewJunctions =
858 if( netCollisionMonitor )
859 netCollisionMonitor->Update( previewJunctions, selection );
862 m_view->AddToPreview( jct,
true );
876 m_frame->GetInfoBar()->Dismiss();
893 case MOVE:
m_frame->ShowInfoBarMsg(
_(
"Press <ESC> to cancel move." ) );
break;
894 case DRAG:
m_frame->ShowInfoBarMsg(
_(
"Press <ESC> to cancel drag." ) );
break;
895 case BREAK:
m_frame->ShowInfoBarMsg(
_(
"Press <ESC> to cancel break." ) );
break;
896 case SLICE:
m_frame->ShowInfoBarMsg(
_(
"Press <ESC> to cancel slice." ) );
break;
904 restore_state =
true;
914 restore_state =
true;
928 wxLogTrace(
traceSchMove,
"doMoveSelection: handleMoveToolActions returned false, exiting" );
947 didAtLeastOneBreak =
true;
986 wxLogTrace(
traceSchMove,
"doMoveSelection: event handled, not passing" );
995 }
while( ( evt =
Wait() ) );
999 if( selectionHasSheetPins || ( selectionIsGraphicsOnly && !lastCtrlDown ) )
1000 targetSheet =
nullptr;
1005 m_frame->UpdateItem( hoverSheet,
false );
1042 return !restore_state;
1054 if( aCurrentModeIsDragLike != aWasDragging )
1058 if( sel && !sel->
IsNew() )
1087 if( userSelection.
GetSize() == 1 )
1106 aUnselect = selection.
IsHover();
1115 bool& aHasGraphicItems,
bool& aHasNonGraphicItems,
1116 bool& aIsGraphicsOnly )
1118 aHasSheetPins =
false;
1119 aHasGraphicItems =
false;
1120 aHasNonGraphicItems =
false;
1122 for(
EDA_ITEM* edaItem : aSelection )
1127 aHasSheetPins =
true;
1130 aHasGraphicItems =
true;
1132 aHasNonGraphicItems =
true;
1135 aIsGraphicsOnly = aHasGraphicItems && !aHasNonGraphicItems;
1151 std::vector<SCH_ITEM*> stageTwo;
1153 for(
EDA_ITEM* edaItem : aSelection )
1156 std::vector<VECTOR2I> connections;
1158 switch( item->
Type() )
1164 stageTwo.emplace_back( item );
1168 static_cast<SCH_LINE*
>( item )->GetSelectedPoints( connections );
1175 for(
const VECTOR2I& point : connections )
1183 for(
const VECTOR2I& point : item->GetConnectionPoints() )
1187 for(
EDA_ITEM* item : connectedDragItems )
1195 for(
EDA_ITEM* edaItem : aSelection )
1218 static_cast<SCH_ITEM*
>( item )->GetEndPoints( aInternalPoints );
1220 std::vector<DANGLING_END_ITEM> endPointsByType = aInternalPoints;
1221 std::vector<DANGLING_END_ITEM> endPointsByPos = endPointsByType;
1225 static_cast<SCH_ITEM*
>( item )->UpdateDanglingState( endPointsByType, endPointsByPos );
1230 std::vector<DANGLING_END_ITEM>& aInternalPoints,
1236 bool placingNewItems = sch_item && sch_item->
IsNew();
1244 aInternalPoints.clear();
1251 if( !it->IsSelected() )
1264 for(
EDA_ITEM* edaItem : aSelection )
1281 if( !
info.isJunction )
1295 aSnapLayer =
grid.GetSelectionGrid( aSelection );
1301 if( schItem->
IsNew() )
1312 enteredGroup->AddItem( schItem );
1329 shape->SetHatchingDirty();
1330 shape->UpdateHatching();
1357 wxASSERT_MSG(
m_anchorPos,
"Should be already set from previous cmd" );
1359 else if( placingNewItems )
1367 bool isPasted =
false;
1373 if( item->GetParent() && item->GetParent()->IsSelected() )
1379 isPasted |= ( item->GetFlags() &
IS_PASTED ) != 0;
1386 aSelection.SetReferencePoint(
m_cursor );
1399 if(
m_frame->GetMoveWarpsCursor() )
1419 bool aHasSheetPins,
bool aIsGraphicsOnly,
bool aCtrlDown )
1442 selBBox.
Merge( schIt->GetBoundingBox() );
1483 if( sheet->
GetPin( pt ) )
1495 bool dropAllowedBySelection = !aHasSheetPins;
1496 bool dropAllowedByModifiers = !aIsGraphicsOnly || aCtrlDown;
1498 if( sheet && !( dropAllowedBySelection && dropAllowedByModifiers ) )
1506 SCH_COMMIT* aCommit,
int& aXBendCount,
int& aYBendCount,
1509 wxLogTrace(
traceSchMove,
"performItemMove: delta=(%d,%d), moveOffset=(%d,%d), selection size=%u",
1516 std::vector<VECTOR2I> splitMoves;
1525 splitMoves.emplace_back(
VECTOR2I( aDelta.
x, 0 ) );
1535 splitMoves.emplace_back(
VECTOR2I( 0, aDelta.
y ) );
1541 for(
const VECTOR2I& splitDelta : splitMoves )
1544 if( splitDelta ==
VECTOR2I( 0, 0 ) )
1548 ( aDelta.
y >= 0 ) ) )
1551 if( item->GetParent() && item->GetParent()->IsSelected() )
1555 bool isLineModeConstrained =
false;
1564 if( (
m_mode ==
DRAG ) && isLineModeConstrained && line
1568 orthoLineDrag( aCommit, line, splitDelta, aXBendCount, aYBendCount, aGrid );
1581 if( lineEnd.second && lineEnd.first->HasFlag(
STARTPOINT ) )
1582 lineEnd.first->SetStartPoint(
pin->GetPosition() );
1583 else if( !lineEnd.second && lineEnd.first->HasFlag(
ENDPOINT ) )
1584 lineEnd.first->SetEndPoint(
pin->GetPosition() );
1594 if( !label || !
info.attachedLine )
1597 if(
info.trackMovingEnd )
1599 label->Move( splitDelta );
1604 if(
info.attachedLine->GetLength() > 0
1605 &&
info.attachedLine->HitTest(
info.originalLabelPos, 1 )
1606 &&
info.originalLabelPos != start
1607 &&
info.originalLabelPos !=
end )
1609 info.trackMovingEnd =
false;
1610 label->SetPosition(
info.originalLabelPos );
1611 info.originalLineStart = start;
1629 if( deltaStart == deltaEnd )
1631 label->SetPosition(
info.originalLabelPos + deltaStart );
1636 VECTOR2I fixedEndDelta = startDrags ? deltaEnd : deltaStart;
1638 label->SetPosition(
info.originalLabelPos + fixedEndDelta );
1642 if( !
info.attachedLine->HitTest( label->GetPosition(), 1 ) )
1645 label->SetPosition( seg.
NearestPoint( label->GetPosition() ) );
1649 if( label->GetPosition() == movingEnd )
1650 info.trackMovingEnd =
true;
1666 wxLogTrace(
traceSchMove,
"handleMoveToolActions: received event, action=%s",
1667 aEvent->
Format().c_str() );
1671 wxLogTrace(
traceSchMove,
"handleMoveToolActions: doDelete, exiting move" );
1672 const_cast<TOOL_EVENT*
>( aEvent )->SetPassEvent();
1683 wxLogTrace(
traceSchMove,
"handleMoveToolActions: rotateCW event received, selection size=%u",
1686 wxLogTrace(
traceSchMove,
"handleMoveToolActions: rotateCW RunSynchronousAction completed" );
1688 wxLogTrace(
traceSchMove,
"handleMoveToolActions: rotateCW updateStoredPositions completed" );
1693 wxLogTrace(
traceSchMove,
"handleMoveToolActions: rotateCCW event received, selection size=%u",
1696 wxLogTrace(
traceSchMove,
"handleMoveToolActions: rotateCCW RunSynchronousAction completed" );
1698 wxLogTrace(
traceSchMove,
"handleMoveToolActions: rotateCCW updateStoredPositions completed" );
1757 m_frame->SelectUnit( symbol, unit );
1769 m_frame->SelectBodyStyle( symbol, bodyStyle );
1790 wxLogTrace(
traceSchMove,
"updateStoredPositions: start, selection size=%u",
1809 wxLogTrace(
traceSchMove,
" item[%d] type=%d: stored pos updated (%d,%d) -> (%d,%d)",
1810 itemCount++, (
int) schItem->
Type(), oldPos.
x, oldPos.
y, newPos.
x, newPos.
y );
1820 pin->SetStoredPos( pinNewPos );
1821 wxLogTrace(
traceSchMove,
" sheet pin: stored pos updated (%d,%d) -> (%d,%d)",
1822 pinOldPos.
x, pinOldPos.
y, pinNewPos.
x, pinNewPos.
y );
1827 wxLogTrace(
traceSchMove,
"updateStoredPositions: complete, updated %d items", itemCount );
1832 const std::vector<DANGLING_END_ITEM>& aInternalPoints )
1841 newLine->ClearEditFlags();
1848 oldLine->ClearEditFlags();
1863 sch_item->SetConnectivityDirty(
true );
1877 if(
m_frame->GetScreen()->IsExplicitJunctionNeeded( it.GetPosition() ) )
1887 selectionCopy.
Add( line );
1890 selectionCopy.
Add( line );
1897 if( isDragLike && !isSlice )
1907 item->ClearTempFlags();
1909 for(
EDA_ITEM* item : selectionCopy )
1910 item->ClearTempFlags();
1912 m_frame->Schematic().CleanUp( aCommit );
1916 auto clearChildEditFlags =
1919 aItem->RunOnChildren(
1929 item->ClearEditFlags();
1932 clearChildEditFlags( schItem );
1937 for(
EDA_ITEM* item : selectionCopy )
1939 item->ClearEditFlags();
1942 clearChildEditFlags( schItem );
1964 bbox.
Merge(
static_cast<SCH_ITEM*
>( item )->GetBoundingBox() );
1968 bool overlap =
false;
1973 moved.Move( offset );
1978 if(
moved.Intersects( existing->GetBoundingBox() ) )
1994 m_frame->RemoveFromScreen( schItem, srcScreen );
1997 schItem->
Move( offset );
2000 destScreen->
Append( schItem );
2014 std::set<SCH_ITEM*> danglers;
2016 std::function<void(
SCH_ITEM* )> changeHandler =
2017 [&](
SCH_ITEM* aChangedItem ) ->
void
2021 if( aChangedItem->IsSelected() )
2033 danglers.insert( aChangedItem );
2041 danglers.insert( aChangedItem );
2045 m_frame->GetScreen()->TestDanglingEnds(
nullptr, &changeHandler );
2069 for(
SCH_ITEM* item : itemsOverlapping )
2071 if( item != aOriginalItem && item->
IsConnected( aPoint ) )
2074 foundJunction = item;
2080 if( foundSymbol && foundJunction )
2082 aList.push_back( foundSymbol );
2088 aList.push_back( foundJunction );
2095 if(
test == aOriginalItem || !
test->CanConnect( aOriginalItem ) )
2098 switch(
test->Type() )
2114 if(
test->IsConnected( aPoint ) )
2115 aList.push_back(
test );
2120 if(
static_cast<SCH_LINE*
>(
test )->HitTest( label->GetPosition(), 1 ) )
2121 aList.push_back(
test );
2134 if(
pin->IsConnected( aPoint ) )
2136 if(
pin->IsSelected() )
2139 aList.push_back(
pin );
2149 if(
test->IsConnected( aPoint ) )
2150 aList.push_back(
test );
2165 aList.push_back( label );
2177 if( line->
HitTest( aPoint, 1 ) )
2178 aList.push_back( label );
2194 std::set<SCH_ITEM*> connectableCandidates;
2195 std::vector<SCH_ITEM*> itemsConnectable;
2196 bool ptHasUnselectedJunction =
false;
2199 connectableCandidates.insert( item );
2206 connectableCandidates.insert( item );
2214 bool isBusLabel =
false;
2225 || selected->GetLayer() ==
LAYER_BUS || isBusLabel )
2245 else if( fixedLine )
2258 auto makeNewJunction =
2275 for(
SCH_ITEM* item : connectableCandidates )
2288 if( !
pin->IsSelected()
2289 &&
pin->GetPosition() == aPoint
2290 &&
pin->CanConnect( aSelectedItem ) )
2292 itemsConnectable.push_back(
pin );
2303 if( item == aSelectedItem
2304 || ( item->Type() !=
SCH_LINE_T && ( item->IsSelected() || item->HasSelectedAncestorGroup() ) )
2310 itemsConnectable.push_back( item );
2313 for(
SCH_ITEM* item : itemsConnectable )
2315 if( item->Type() ==
SCH_JUNCTION_T && item->IsConnected( aPoint ) && !item->IsSelected() )
2317 ptHasUnselectedJunction =
true;
2334 if( ptHasUnselectedJunction )
2349 if( !lineInSelectedGroup )
2353 || lineInSelectedGroup )
2360 aList.push_back( line );
2365 if( !lineInSelectedGroup )
2369 || lineInSelectedGroup )
2376 aList.push_back( line );
2381 switch( aSelectedItem->
Type() )
2395 newWire = makeNewWire( aCommit, line, aSelectedItem, aPoint, aPoint );
2398 aList.push_back( newWire );
2408 makeNewWire( aCommit, line, line, aPoint, oldEnd );
2409 makeNewJunction( aCommit, line, aPoint );
2441 aList.push_back( label );
2444 info.attachedLine = line;
2458 if(
pin->IsConnected( aPoint ) )
2469 newWire = makeNewWire( aCommit,
pin, aSelectedItem, aPoint, aPoint );
2471 aList.push_back( newWire );
2480 if(
test->IsConnected( aPoint ) && !newWire )
2484 newWire = makeNewWire( aCommit,
test, aSelectedItem, aPoint, aPoint );
2486 aList.push_back( newWire );
2495 aList.push_back(
test );
2530 aList.push_back( label );
2535 info.attachedLine = line;
2544 else if(
test->IsConnected( aPoint ) && !newWire )
2548 newWire = makeNewWire( aCommit,
test, aSelectedItem, aPoint, aPoint );
2550 aList.push_back( newWire );
2576 if( line->
HitTest( point, 1 ) )
2579 aList.push_back(
test );
2582 std::vector<VECTOR2I> ends =
test->GetConnectionPoints();
2585 if( ends[0] == point )
2609 static int moveCallCount = 0;
2610 wxLogTrace(
traceSchMove,
"moveItem[%d]: type=%d, delta=(%d,%d)",
2611 ++moveCallCount, aItem->
Type(), aDelta.
x, aDelta.
y );
2613 switch( aItem->
Type() )
2619 static_cast<SCH_LINE*
>( aItem )->Move( aDelta );
2664 label->
Move( aDelta );
2670 static_cast<SCH_ITEM*
>( aItem )->Move( aDelta );
2706 if( !it->IsSelected() )
2709 if( !selection.
IsHover() && it->IsSelected() )
2712 it->SetStoredPos( it->GetPosition() );
2717 pin->SetStoredPos(
pin->GetPosition() );
2737 std::vector<EDA_ITEM*> items( selection.
begin(), selection.
end() );
2746 m_frame->Schematic().CleanUp( &commit );
2747 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 void ClearEditFlags()
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 HasSelectedAncestorGroup() const
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
virtual 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.
bool IsStartDangling() const
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
bool IsEndDangling() const
void MoveEnd(const VECTOR2I &aMoveVector)
void SetLastResolvedState(const SCH_ITEM *aItem) override
void MoveStart(const VECTOR2I &aMoveVector)
void SetEndPoint(const VECTOR2I &aPosition)
bool IsDangling() const override
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
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
#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