KiCad PCB EDA Suite
SCH_MOVE_TOOL Class Reference

#include <sch_move_tool.h>

Inheritance diagram for SCH_MOVE_TOOL:
EE_TOOL_BASE< SCH_EDIT_FRAME > TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN , MODEL_RELOAD , GAL_SWITCH }
 Determine the reason of reset for a tool. More...
 

Public Member Functions

 SCH_MOVE_TOOL ()
 
 ~SCH_MOVE_TOOL () override
 
bool Init () override
 Init() is called once upon a registration of the tool. More...
 
int Main (const TOOL_EVENT &aEvent)
 Run an interactive move of the selected items, or the item under the cursor. More...
 
int AlignElements (const TOOL_EVENT &aEvent)
 Align selected elements to the grid. More...
 
void Reset (RESET_REASON aReason) override
 Bring the tool to a known, initial state. More...
 
void Activate ()
 Run the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Assign a context menu and tells when it should be activated. More...
 
void RunMainStack (std::function< void()> aFunc)
 Call a function using the main stack. More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Define which state (aStateFunc) to go when a certain event arrives (aConditions). More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Suspend execution of the tool until an event specified in aEventList arrives. More...
 
TOOL_TYPE GetType () const
 Return the type of the tool. More...
 
TOOL_ID GetId () const
 Return the unique identifier of the tool. More...
 
const std::string & GetName () const
 Return the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Return the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

Protected Member Functions

void updateItem (EDA_ITEM *aItem, bool aUpdateRTree) const
 Similar to getView()->Update(), but handles items that are redrawn by their parents and updating the SCH_SCREEN's RTree. More...
 
void saveCopyInUndoList (EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false, bool aDirtyConnectivity=true)
 
void attachManager (TOOL_MANAGER *aManager)
 Set the TOOL_MANAGER the tool will belong to. More...
 
KIGFX::VIEWgetView () const
 Returns the instance of #VIEW object used in the application. More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Return the instance of VIEW_CONTROLS object used in the application. More...
 
template<typename T >
T * getEditFrame () const
 Return the application window object, casted to requested user type. More...
 
template<typename T >
T * getModel () const
 Return the model object if it matches the requested type. More...
 

Protected Attributes

SCH_EDIT_FRAMEm_frame
 
KIGFX::SCH_VIEWm_view
 
EE_SELECTION_TOOLm_selectionTool
 
bool m_isSymbolEditor
 
TOOL_MENU m_menu
 The functions below are not yet implemented - their interface may change. More...
 
TOOL_TYPE m_type
 Unique identifier for the tool, assigned by a TOOL_MANAGER instance. More...
 
TOOL_ID m_toolId
 Name of the tool. More...
 
std::string m_toolName
 
TOOL_MANAGERm_toolMgr
 

Private Member Functions

void moveItem (EDA_ITEM *aItem, const VECTOR2I &aDelta)
 Find additional items for a drag operation. More...
 
void getConnectedItems (SCH_ITEM *aOriginalItem, const VECTOR2I &aPoint, EDA_ITEMS &aList)
 
void getConnectedDragItems (SCH_ITEM *aOriginalItem, const VECTOR2I &aPoint, EDA_ITEMS &aList)
 Set up handlers for various events. More...
 
void setTransitions () override
 Saves the new drag lines to the undo list. More...
 
void commitDragLines ()
 Clears the new drag lines and removes them from the screen. More...
 
void clearNewDragLines ()
 
void resetTransitions ()
 Clear the current transition map and restores the default one created by setTransitions(). More...
 
void goInternal (TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)
 
EDA_ITEMgetModelInt () const
 
TOOLS_HOLDERgetToolHolderInt () const
 

Private Attributes

bool m_moveInProgress
 < Flag determining if anything is being dragged right now More...
 
bool m_isDrag
 Items (such as wires) which were added to the selection for a drag. More...
 
std::vector< KIIDm_dragAdditions
 Cache of the line's original connections before dragging started. More...
 
std::map< SCH_LINE *, EDA_ITEMSm_lineConnectionCache
 Lines added at bend points dynamically during the move. More...
 
std::unordered_set< SCH_LINE * > m_newDragLines
 Lines changed by drag algorithm that weren't selected. More...
 
std::unordered_set< SCH_LINE * > m_changedDragLines
 Used for chaining commands. More...
 
VECTOR2I m_moveOffset
 Last cursor position (needed for getModificationPoint() to avoid changes of edit reference point). More...
 
VECTOR2I m_cursor
 
OPT_VECTOR2I m_anchorPos
 
std::map< SCH_LABEL_BASE *, SPECIAL_CASE_LABEL_INFOm_specialCaseLabels
 

Detailed Description

Definition at line 43 of file sch_move_tool.h.

Member Enumeration Documentation

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determine the reason of reset for a tool.

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 77 of file tool_base.h.

78 {
79 RUN,
82 };
@ MODEL_RELOAD
Model changes (required full reload)
Definition: tool_base.h:80
@ GAL_SWITCH
Rendering engine changes.
Definition: tool_base.h:81
@ RUN
Tool is invoked after being inactive.
Definition: tool_base.h:79

Constructor & Destructor Documentation

◆ SCH_MOVE_TOOL()

SCH_MOVE_TOOL::SCH_MOVE_TOOL ( )

Definition at line 50 of file sch_move_tool.cpp.

50 :
51 EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.InteractiveMove" ),
52 m_moveInProgress( false ),
53 m_isDrag( false ),
54 m_moveOffset( 0, 0 )
55{
56}
bool m_isDrag
Items (such as wires) which were added to the selection for a drag.
Definition: sch_move_tool.h:86
bool m_moveInProgress
< Flag determining if anything is being dragged right now
Definition: sch_move_tool.h:85
VECTOR2I m_moveOffset
Last cursor position (needed for getModificationPoint() to avoid changes of edit reference point).
Definition: sch_move_tool.h:98

◆ ~SCH_MOVE_TOOL()

SCH_MOVE_TOOL::~SCH_MOVE_TOOL ( )
inlineoverride

Definition at line 47 of file sch_move_tool.h.

47{ }

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Run the tool.

After activation, the tool starts receiving events until it is finished.

Definition at line 51 of file tool_interactive.cpp.

52{
54}
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:209
bool InvokeTool(TOOL_ID aToolId)
Call a tool by sending a tool activation event to tool of given ID.

References TOOL_MANAGER::InvokeTool(), TOOL_BASE::m_toolId, and TOOL_BASE::m_toolMgr.

Referenced by AUTOPLACE_TOOL::autoplace(), EDIT_TOOL::copyToClipboard(), SCH_EDIT_TOOL::DeleteItemCursor(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCB_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), EE_POINT_EDITOR::Main(), Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_POINT_EDITOR::Main(), PCB_PICKER_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), PCB_POINT_EDITOR::OnSelectionChange(), GROUP_TOOL::PickNewMember(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), ROUTER_TOOL::RouteSelected(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ AlignElements()

int SCH_MOVE_TOOL::AlignElements ( const TOOL_EVENT aEvent)

Align selected elements to the grid.

Parameters
aEventcurrent event that activated the tool
Returns
0

Definition at line 1431 of file sch_move_tool.cpp.

1432{
1435 bool append_undo = false;
1436
1437 auto doMoveItem =
1438 [&]( EDA_ITEM* item, const VECTOR2I& delta )
1439 {
1440 saveCopyInUndoList( item, UNDO_REDO::CHANGED, append_undo );
1441 append_undo = true;
1442
1443 moveItem( item, delta );
1444 item->ClearFlags( IS_MOVING );
1445 updateItem( item, true );
1446 };
1447
1448 for( SCH_ITEM* it : m_frame->GetScreen()->Items() )
1449 {
1450 if( !it->IsSelected() )
1451 it->ClearFlags( STARTPOINT | ENDPOINT );
1452
1453 if( !selection.IsHover() && it->IsSelected() )
1454 it->SetFlags( STARTPOINT | ENDPOINT );
1455
1456 it->SetStoredPos( it->GetPosition() );
1457
1458 if( it->Type() == SCH_SHEET_T )
1459 {
1460 for( SCH_SHEET_PIN* pin : static_cast<SCH_SHEET*>( it )->GetPins() )
1461 pin->SetStoredPos( pin->GetPosition() );
1462 }
1463 }
1464
1465 for( EDA_ITEM* item : selection )
1466 {
1467 if( item->Type() == SCH_LINE_T )
1468 {
1469 SCH_LINE* line = static_cast<SCH_LINE*>( item );
1470 std::vector<int> flags{ STARTPOINT, ENDPOINT };
1471 std::vector<VECTOR2I> pts{ line->GetStartPoint(), line->GetEndPoint() };
1472
1473 for( int ii = 0; ii < 2; ++ii )
1474 {
1475 EDA_ITEMS drag_items{ item };
1476 line->ClearFlags();
1477 line->SetFlags( SELECTED );
1478 line->SetFlags( flags[ii] );
1479 getConnectedDragItems( line, pts[ii], drag_items );
1480 std::set<EDA_ITEM*> unique_items( drag_items.begin(), drag_items.end() );
1481
1482 VECTOR2I gridpt = grid.AlignGrid( pts[ii] ) - pts[ii];
1483
1484 if( gridpt != VECTOR2I( 0, 0 ) )
1485 {
1486 for( EDA_ITEM* dragItem : unique_items )
1487 {
1488 if( dragItem->GetParent() && dragItem->GetParent()->IsSelected() )
1489 continue;
1490
1491 doMoveItem( dragItem, gridpt );
1492 }
1493 }
1494 }
1495 }
1496 else if( item->Type() == SCH_FIELD_T )
1497 {
1498 VECTOR2I gridpt = grid.AlignGrid( item->GetPosition() ) - item->GetPosition();
1499
1500 if( gridpt != VECTOR2I( 0, 0 ) )
1501 doMoveItem( item, gridpt );
1502 }
1503 else if( item->Type() == SCH_SHEET_T )
1504 {
1505 SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
1506 VECTOR2I topLeft = sheet->GetPosition();
1507 VECTOR2I bottomRight = topLeft + sheet->GetSize();
1508 VECTOR2I tl_gridpt = grid.AlignGrid( topLeft ) - topLeft;
1509 VECTOR2I br_gridpt = grid.AlignGrid( bottomRight ) - bottomRight;
1510
1511 if( tl_gridpt != VECTOR2I( 0, 0 ) || br_gridpt != VECTOR2I( 0, 0 ) )
1512 {
1513 doMoveItem( sheet, tl_gridpt );
1514
1515 VECTOR2I newSize = (VECTOR2I) sheet->GetSize() - tl_gridpt + br_gridpt;
1516 sheet->SetSize( wxSize( newSize.x, newSize.y ) );
1517 updateItem( sheet, true );
1518
1519 for( SCH_SHEET_PIN* pin : sheet->GetPins() )
1520 {
1521 VECTOR2I gridpt;
1522
1523 if( pin->GetSide() == SHEET_SIDE::TOP || pin->GetSide() == SHEET_SIDE::LEFT )
1524 gridpt = tl_gridpt;
1525 else
1526 gridpt = br_gridpt;
1527
1528 if( gridpt != VECTOR2I( 0, 0 ) )
1529 {
1530 EDA_ITEMS drag_items;
1531 getConnectedDragItems( pin, pin->GetConnectionPoints()[0], drag_items );
1532
1533 doMoveItem( pin, gridpt );
1534
1535 for( EDA_ITEM* dragItem : drag_items )
1536 {
1537 if( dragItem->GetParent() && dragItem->GetParent()->IsSelected() )
1538 continue;
1539
1540 doMoveItem( dragItem, gridpt );
1541 }
1542 }
1543 }
1544 }
1545 }
1546 else
1547 {
1548 std::vector<VECTOR2I> connections;
1549 EDA_ITEMS drag_items{ item };
1550 connections = static_cast<SCH_ITEM*>( item )->GetConnectionPoints();
1551
1552 for( const VECTOR2I& point : connections )
1553 getConnectedDragItems( static_cast<SCH_ITEM*>( item ), point, drag_items );
1554
1555 std::map<VECTOR2I, int> shifts;
1556 VECTOR2I most_common( 0, 0 );
1557 int max_count = 0;
1558
1559 for( const VECTOR2I& conn : connections )
1560 {
1561 VECTOR2I gridpt = grid.AlignGrid( conn ) - conn;
1562
1563 shifts[gridpt]++;
1564
1565 if( shifts[gridpt] > max_count )
1566 {
1567 most_common = gridpt;
1568 max_count = shifts[most_common];
1569 }
1570 }
1571
1572 if( most_common != VECTOR2I( 0, 0 ) )
1573 {
1574 for( EDA_ITEM* dragItem : drag_items )
1575 {
1576 if( dragItem->GetParent() && dragItem->GetParent()->IsSelected() )
1577 continue;
1578
1579 doMoveItem( dragItem, most_common );
1580 }
1581 }
1582 }
1583 }
1584
1588
1591
1592 m_frame->OnModify();
1593 return 0;
1594}
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:249
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:142
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:143
static TOOL_ACTION trimOverlappingWires
Definition: ee_actions.h:79
static TOOL_ACTION addNeededJunctions
Definition: ee_actions.h:78
static const std::vector< KICAD_T > MovableItems
Definition: ee_collectors.h:43
EE_SELECTION & RequestSelection(const std::vector< KICAD_T > &aScanTypes={ SCH_LOCATE_ANY_T })
Return either an existing selection (filtered), or the selection at the current cursor position if th...
void updateItem(EDA_ITEM *aItem, bool aUpdateRTree) const
Similar to getView()->Update(), but handles items that are redrawn by their parents and updating the ...
Definition: ee_tool_base.h:103
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false, bool aDirtyConnectivity=true)
Definition: ee_tool_base.h:134
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:184
static const TOOL_EVENT SelectedItemsMoved
Used to inform tools that the selection should temporarily be non-editable.
Definition: actions.h:213
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void RecalculateConnections(SCH_CLEANUP_FLAGS aCleanupFlags)
Generate the connection data for the entire schematic hierarchy.
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:40
VECTOR2I GetEndPoint() const
Definition: sch_line.h:137
VECTOR2I GetStartPoint() const
Definition: sch_line.h:132
void moveItem(EDA_ITEM *aItem, const VECTOR2I &aDelta)
Find additional items for a drag operation.
void getConnectedDragItems(SCH_ITEM *aOriginalItem, const VECTOR2I &aPoint, EDA_ITEMS &aList)
Set up handlers for various events.
EE_RTREE & Items()
Gets the full RTree, usually for iterating.
Definition: sch_screen.h:108
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet_pin.h:66
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:55
void SetSize(const wxSize &aSize)
Definition: sch_sheet.h:106
VECTOR2I GetPosition() const override
Definition: sch_sheet.h:365
wxSize GetSize() const
Definition: sch_sheet.h:105
std::vector< SCH_SHEET_PIN * > & GetPins()
Definition: sch_sheet.h:172
bool IsHover() const
Definition: selection.h:81
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:142
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Definition: eda_item.h:524
#define SELECTED
Item was manually selected by the user.
#define ENDPOINT
ends. (Used to support dragging.)
#define IS_MOVING
Item being moved.
#define STARTPOINT
When a line is selected, these flags indicate which.
@ LOCAL_CLEANUP
constexpr int delta
@ SCH_LINE_T
Definition: typeinfo.h:145
@ SCH_FIELD_T
Definition: typeinfo.h:154
@ SCH_SHEET_T
Definition: typeinfo.h:157
VECTOR2< int > VECTOR2I
Definition: vector2d.h:618

References EE_ACTIONS::addNeededJunctions, CHANGED, EDA_ITEM::ClearFlags(), delta, ENDPOINT, getConnectedDragItems(), SCH_LINE::GetEndPoint(), SCH_SHEET::GetPins(), EDA_ITEM::GetPosition(), SCH_SHEET::GetPosition(), SCH_EDIT_FRAME::GetScreen(), SCH_SHEET::GetSize(), SCH_LINE::GetStartPoint(), grid, IS_MOVING, SELECTION::IsHover(), SCH_SCREEN::Items(), LEFT, LOCAL_CLEANUP, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, EE_COLLECTOR::MovableItems, moveItem(), SCH_EDIT_FRAME::OnModify(), pin, TOOL_MANAGER::PostEvent(), SCH_EDIT_FRAME::RecalculateConnections(), EE_SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), EE_TOOL_BASE< SCH_EDIT_FRAME >::saveCopyInUndoList(), SCH_FIELD_T, SCH_LINE_T, SCH_SHEET_T, SELECTED, EVENTS::SelectedItemsMoved, EDA_ITEM::SetFlags(), SCH_SHEET::SetSize(), STARTPOINT, SCH_EDIT_FRAME::TestDanglingEnds(), TOP, EE_ACTIONS::trimOverlappingWires, EDA_ITEM::Type(), EE_TOOL_BASE< SCH_EDIT_FRAME >::updateItem(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by setTransitions().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Set the TOOL_MANAGER the tool will belong to.

Called by TOOL_MANAGER::RegisterTool()

Definition at line 60 of file tool_base.cpp.

61{
62 m_toolMgr = aManager;
63}

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ clearNewDragLines()

void SCH_MOVE_TOOL::clearNewDragLines ( )
private

Definition at line 1626 of file sch_move_tool.cpp.

1627{
1628 // Remove new bend lines added during the drag
1629 for( auto newLine : m_newDragLines )
1630 {
1631 m_frame->RemoveFromScreen( newLine, m_frame->GetScreen() );
1632 delete newLine;
1633 }
1634
1635 m_newDragLines.clear();
1636}
void RemoveFromScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen)
Remove an item from the screen (and view) aScreen is the screen the item is located on,...
std::unordered_set< SCH_LINE * > m_newDragLines
Lines changed by drag algorithm that weren't selected.
Definition: sch_move_tool.h:93

References SCH_EDIT_FRAME::GetScreen(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_newDragLines, and SCH_BASE_FRAME::RemoveFromScreen().

Referenced by Main().

◆ commitDragLines()

void SCH_MOVE_TOOL::commitDragLines ( )
private

Clears the new drag lines and removes them from the screen.

Definition at line 1606 of file sch_move_tool.cpp.

1607{
1608 for( SCH_LINE* newLine : m_newDragLines )
1609 {
1610 newLine->ClearEditFlags();
1611 saveCopyInUndoList( newLine, UNDO_REDO::NEWITEM, true );
1612 }
1613
1614 // These lines have been changed, but aren't selected. We need
1615 // to manually clear these edit flags or they'll stick around.
1616 for( SCH_LINE* oldLine : m_changedDragLines )
1617 {
1618 oldLine->ClearEditFlags();
1619 }
1620
1621 m_newDragLines.clear();
1622 m_changedDragLines.clear();
1623}
std::unordered_set< SCH_LINE * > m_changedDragLines
Used for chaining commands.
Definition: sch_move_tool.h:95

References m_changedDragLines, m_newDragLines, NEWITEM, and EE_TOOL_BASE< SCH_EDIT_FRAME >::saveCopyInUndoList().

Referenced by Main().

◆ getConnectedDragItems()

void SCH_MOVE_TOOL::getConnectedDragItems ( SCH_ITEM aOriginalItem,
const VECTOR2I aPoint,
EDA_ITEMS aList 
)
private

Set up handlers for various events.

Definition at line 1044 of file sch_move_tool.cpp.

1046{
1047 EE_RTREE& items = m_frame->GetScreen()->Items();
1048 EE_RTREE::EE_TYPE itemsOverlappingRTree = items.Overlapping( aOriginalItem->GetBoundingBox() );
1049 std::vector<SCH_ITEM*> itemsConnectable;
1050 bool ptHasUnselectedJunction = false;
1051 SCH_LINE* newWire = nullptr;
1052
1053 for( SCH_ITEM* item : itemsOverlappingRTree )
1054 {
1055 // Skip ourselves, skip already selected items (but not lines, they need both ends tested)
1056 // and skip unconnectable items
1057 if( item == aOriginalItem || ( item->Type() != SCH_LINE_T && item->IsSelected() )
1058 || !item->CanConnect( aOriginalItem ) )
1059 {
1060 continue;
1061 }
1062
1063 itemsConnectable.push_back( item );
1064 }
1065
1066 for( SCH_ITEM* item : itemsConnectable )
1067 {
1068 if( item->Type() == SCH_JUNCTION_T && item->IsConnected( aPoint ) && !item->IsSelected() )
1069 {
1070 ptHasUnselectedJunction = true;
1071 break;
1072 }
1073 }
1074
1075 for( SCH_ITEM* test : itemsConnectable )
1076 {
1077 KICAD_T testType = test->Type();
1078
1079 switch( testType )
1080 {
1081 case SCH_LINE_T:
1082 {
1083 // Select the connected end of wires/bus connections that don't have an unselected
1084 // junction isolating them from the drag
1085 if( ptHasUnselectedJunction )
1086 break;
1087
1088 SCH_LINE* line = static_cast<SCH_LINE*>( test );
1089
1090 if( line->GetStartPoint() == aPoint )
1091 {
1092 // It's possible to manually select one end of a line and get a drag
1093 // connected other end, so we set the flag and then early exit the loop
1094 // later if the other drag items like labels attached to the line have
1095 // already been grabbed during the partial selection process.
1096 line->SetFlags( STARTPOINT );
1097
1098 if( line->HasFlag( SELECTED ) || line->HasFlag( SELECTED_BY_DRAG ) )
1099 continue;
1100 else
1101 {
1102 line->SetFlags( SELECTED_BY_DRAG );
1103 aList.push_back( line );
1104 }
1105 }
1106 else if( line->GetEndPoint() == aPoint )
1107 {
1108 line->SetFlags( ENDPOINT );
1109
1110 if( line->HasFlag( SELECTED ) || line->HasFlag( SELECTED_BY_DRAG ) )
1111 continue;
1112 else
1113 {
1114 line->SetFlags( SELECTED_BY_DRAG );
1115 aList.push_back( line );
1116 }
1117 }
1118 else
1119 {
1120 switch( aOriginalItem->Type() )
1121 {
1122 // These items can connect anywhere along a line
1125 case SCH_LABEL_T:
1126 case SCH_HIER_LABEL_T:
1127 case SCH_GLOBAL_LABEL_T:
1129 // Only add a line if this line is unselected,
1130 // if the label and line are both selected they'll move together
1131 if( line->HitTest( aPoint, 1 ) && !line->HasFlag( SELECTED ) )
1132 {
1133 // Add a new line so we have something to drag
1134 newWire = new SCH_LINE( aPoint, line->GetLayer() );
1135 newWire->SetFlags( IS_NEW );
1136 newWire->SetConnectivityDirty( true );
1137 newWire->SetLastResolvedState( line );
1138 m_frame->AddToScreen( newWire, m_frame->GetScreen() );
1139
1140 newWire->SetFlags( SELECTED_BY_DRAG | STARTPOINT );
1141 aList.push_back( newWire );
1142
1143 //We need to add a connection reference here because the normal
1144 //algorithm won't find a new line with a point in the middle of an
1145 //existing line
1146 m_lineConnectionCache[newWire] = { line };
1147 }
1148 break;
1149 default: break;
1150 }
1151
1152 break;
1153 }
1154
1155 // Since only one end is going to move, the movement vector of any labels attached
1156 // to it is scaled by the proportion of the line length the label is from the moving
1157 // end.
1158 for( SCH_ITEM* item : items.Overlapping( line->GetBoundingBox() ) )
1159 {
1160 switch( item->Type() )
1161 {
1162 case SCH_LABEL_T:
1163 case SCH_HIER_LABEL_T:
1164 case SCH_GLOBAL_LABEL_T:
1166 {
1167 SCH_LABEL_BASE* label = static_cast<SCH_LABEL_BASE*>( item );
1168
1169 if( label->IsSelected() )
1170 continue; // These will be moved on their own because they're selected
1171
1172 if( label->HasFlag( SELECTED_BY_DRAG ) )
1173 continue;
1174
1175 if( label->CanConnect( line ) && line->HitTest( label->GetPosition(), 1 ) )
1176 {
1177 label->SetFlags( SELECTED_BY_DRAG );
1178 aList.push_back( label );
1179
1181 info.attachedLine = line;
1182 info.originalLabelPos = label->GetPosition();
1183 m_specialCaseLabels[label] = info;
1184 }
1185
1186 break;
1187 }
1188 default: break;
1189 }
1190 }
1191
1192 break;
1193 }
1194
1195 case SCH_SHEET_T:
1196 case SCH_SYMBOL_T:
1197 case SCH_JUNCTION_T:
1198 if( test->IsConnected( aPoint ) && !newWire )
1199 {
1200 // Add a new wire between the symbol or junction and the selected item so
1201 // the selected item can be dragged.
1202 if( test->GetLayer() == LAYER_BUS_JUNCTION
1203 || aOriginalItem->GetLayer() == LAYER_BUS )
1204 {
1205 newWire = new SCH_LINE( aPoint, LAYER_BUS );
1206 }
1207 else
1208 {
1209 newWire = new SCH_LINE( aPoint, LAYER_WIRE );
1210 }
1211
1212 newWire->SetFlags( IS_NEW );
1213 newWire->SetConnectivityDirty( true );
1214 newWire->SetLastResolvedState( aOriginalItem );
1215 m_frame->AddToScreen( newWire, m_frame->GetScreen() );
1216
1217 newWire->SetFlags( SELECTED_BY_DRAG | STARTPOINT );
1218 aList.push_back( newWire );
1219 }
1220 break;
1221
1222 case SCH_NO_CONNECT_T:
1223 // Select no-connects that are connected to items being moved.
1224 if( !test->HasFlag( SELECTED_BY_DRAG ) && test->IsConnected( aPoint ) )
1225 {
1226 aList.push_back( test );
1227 test->SetFlags( SELECTED_BY_DRAG );
1228 }
1229
1230 break;
1231
1232 case SCH_LABEL_T:
1233 case SCH_GLOBAL_LABEL_T:
1234 case SCH_HIER_LABEL_T:
1236 // Performance optimization:
1237 if( test->HasFlag( SELECTED_BY_DRAG ) )
1238 break;
1239
1240 // Select labels that are connected to a wire (or bus) being moved.
1241 if( aOriginalItem->Type() == SCH_LINE_T && test->CanConnect( aOriginalItem ) )
1242 {
1243 SCH_LABEL_BASE* label = static_cast<SCH_LABEL_BASE*>( test );
1244 SCH_LINE* line = static_cast<SCH_LINE*>( aOriginalItem );
1245
1246 bool oneEndFixed = !line->HasFlag( STARTPOINT ) || !line->HasFlag( ENDPOINT );
1247
1248 if( line->HitTest( label->GetTextPos(), 1 ) )
1249 {
1250 if( ( !line->HasFlag( STARTPOINT )
1251 && label->GetPosition() == line->GetStartPoint() )
1252 || ( !line->HasFlag( ENDPOINT )
1253 && label->GetPosition() == line->GetEndPoint() ) )
1254 {
1255 //If we have a line selected at only one end, don't grab labels
1256 //connected directly to the unselected endpoint
1257 break;
1258 }
1259 else
1260 {
1261 label->SetFlags( SELECTED_BY_DRAG );
1262 aList.push_back( label );
1263
1264 if( oneEndFixed )
1265 {
1267 info.attachedLine = line;
1268 info.originalLabelPos = label->GetPosition();
1269 m_specialCaseLabels[label] = info;
1270 }
1271 }
1272 }
1273 }
1274 else if( test->IsConnected( aPoint ) && !newWire )
1275 {
1276 // Add a new wire between the label and the selected item so the selected item
1277 // can be dragged.
1278 if( test->GetLayer() == LAYER_BUS_JUNCTION
1279 || aOriginalItem->GetLayer() == LAYER_BUS )
1280 {
1281 newWire = new SCH_LINE( aPoint, LAYER_BUS );
1282 }
1283 else
1284 {
1285 newWire = new SCH_LINE( aPoint, LAYER_WIRE );
1286 }
1287
1288 newWire->SetFlags( IS_NEW );
1289 newWire->SetConnectivityDirty( true );
1290 newWire->SetLastResolvedState( aOriginalItem );
1291 m_frame->AddToScreen( newWire, m_frame->GetScreen() );
1292
1293 newWire->SetFlags( SELECTED_BY_DRAG | STARTPOINT );
1294 aList.push_back( newWire );
1295 }
1296
1297 break;
1298
1301 // Performance optimization:
1302 if( test->HasFlag( SELECTED_BY_DRAG ) )
1303 break;
1304
1305 // Select bus entries that are connected to a bus being moved.
1306 if( aOriginalItem->Type() == SCH_LINE_T && test->CanConnect( aOriginalItem ) )
1307 {
1308 SCH_LINE* line = static_cast<SCH_LINE*>( aOriginalItem );
1309
1310 if( ( !line->HasFlag( STARTPOINT ) && test->IsConnected( line->GetStartPoint() ) )
1311 || ( !line->HasFlag( ENDPOINT ) && test->IsConnected( line->GetEndPoint() ) ) )
1312 {
1313 //If we have a line selected at only one end, don't grab bus entries
1314 //connected directly to the unselected endpoint
1315 continue;
1316 }
1317
1318 for( VECTOR2I& point : test->GetConnectionPoints() )
1319 {
1320 if( line->HitTest( point, 1 ) )
1321 {
1322 test->SetFlags( SELECTED_BY_DRAG );
1323 aList.push_back( test );
1324
1325 // A bus entry needs its wire & label as well
1326 std::vector<VECTOR2I> ends = test->GetConnectionPoints();
1327 VECTOR2I otherEnd;
1328
1329 if( ends[0] == point )
1330 otherEnd = ends[1];
1331 else
1332 otherEnd = ends[0];
1333
1334 getConnectedDragItems( test, otherEnd, aList );
1335
1336 // No need to test the other end of the bus entry
1337 break;
1338 }
1339 }
1340 }
1341
1342 break;
1343
1344 default:
1345 break;
1346 }
1347 }
1348}
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:74
bool IsSelected() const
Definition: eda_item.h:107
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
Definition: eda_item.h:145
const VECTOR2I & GetTextPos() const
Definition: eda_text.h:198
Implements an R-tree for fast spatial and type indexing of schematic items.
Definition: sch_rtree.h:40
EE_TYPE Overlapping(const BOX2I &aRect) const
Definition: sch_rtree.h:243
void AddToScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen)
Add an item to the screen (and view) aScreen is the screen the item is located on,...
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:246
void SetConnectivityDirty(bool aDirty=true)
Definition: sch_item.h:406
bool CanConnect(const SCH_ITEM *aItem) const override
Definition: sch_label.h:48
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition: sch_line.cpp:765
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: sch_line.cpp:191
void SetLastResolvedState(const SCH_ITEM *aItem) override
Definition: sch_line.h:140
std::map< SCH_LINE *, EDA_ITEMS > m_lineConnectionCache
Lines added at bend points dynamically during the move.
Definition: sch_move_tool.h:91
std::map< SCH_LABEL_BASE *, SPECIAL_CASE_LABEL_INFO > m_specialCaseLabels
VECTOR2I GetPosition() const override
Definition: sch_text.h:205
#define IS_NEW
New item, just created.
#define SELECTED_BY_DRAG
Item was algorithmically selected as a dragged item.
@ LAYER_WIRE
Definition: layer_ids.h:344
@ LAYER_BUS
Definition: layer_ids.h:345
@ LAYER_BUS_JUNCTION
Definition: layer_ids.h:384
The EE_TYPE struct provides a type-specific auto-range iterator to the RTree.
Definition: sch_rtree.h:192
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ SCH_NO_CONNECT_T
Definition: typeinfo.h:142
@ SCH_SYMBOL_T
Definition: typeinfo.h:155
@ SCH_DIRECTIVE_LABEL_T
Definition: typeinfo.h:153
@ SCH_LABEL_T
Definition: typeinfo.h:150
@ SCH_HIER_LABEL_T
Definition: typeinfo.h:152
@ SCH_BUS_BUS_ENTRY_T
Definition: typeinfo.h:144
@ SCH_BUS_WIRE_ENTRY_T
Definition: typeinfo.h:143
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:151
@ SCH_JUNCTION_T
Definition: typeinfo.h:141

References SCH_BASE_FRAME::AddToScreen(), SCH_ITEM::CanConnect(), SCH_LABEL_BASE::CanConnect(), ENDPOINT, EDA_ITEM::GetBoundingBox(), SCH_LINE::GetBoundingBox(), getConnectedDragItems(), SCH_LINE::GetEndPoint(), SCH_ITEM::GetLayer(), SCH_TEXT::GetPosition(), SCH_EDIT_FRAME::GetScreen(), SCH_LINE::GetStartPoint(), EDA_TEXT::GetTextPos(), EDA_ITEM::HasFlag(), SCH_LINE::HitTest(), info, IS_NEW, EDA_ITEM::IsSelected(), SCH_SCREEN::Items(), LAYER_BUS, LAYER_BUS_JUNCTION, LAYER_WIRE, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_lineConnectionCache, m_specialCaseLabels, EE_RTREE::Overlapping(), SCH_BUS_BUS_ENTRY_T, SCH_BUS_WIRE_ENTRY_T, SCH_DIRECTIVE_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_JUNCTION_T, SCH_LABEL_T, SCH_LINE_T, SCH_NO_CONNECT_T, SCH_SHEET_T, SCH_SYMBOL_T, SELECTED, SELECTED_BY_DRAG, SCH_ITEM::SetConnectivityDirty(), EDA_ITEM::SetFlags(), SCH_LINE::SetLastResolvedState(), STARTPOINT, and EDA_ITEM::Type().

Referenced by AlignElements(), getConnectedDragItems(), and Main().

◆ getConnectedItems()

void SCH_MOVE_TOOL::getConnectedItems ( SCH_ITEM aOriginalItem,
const VECTOR2I aPoint,
EDA_ITEMS aList 
)
private

Definition at line 929 of file sch_move_tool.cpp.

931{
932 EE_RTREE& items = m_frame->GetScreen()->Items();
933 EE_RTREE::EE_TYPE itemsOverlapping = items.Overlapping( aOriginalItem->GetBoundingBox() );
934 SCH_ITEM* foundJunction = nullptr;
935 SCH_ITEM* foundSymbol = nullptr;
936
937 // If you're connected to a junction, you're only connected to the junction.
938 //
939 // But, if you're connected to a junction on a pin, you're only connected to the pin. This
940 // is because junctions and pins have different logic for how bend lines are generated
941 // and we need to prioritize the pin version in some cases.
942 for( SCH_ITEM* item : itemsOverlapping )
943 {
944 if( item != aOriginalItem && item->IsConnected( aPoint ) )
945 {
946 if( item->Type() == SCH_JUNCTION_T )
947 foundJunction = item;
948 else if( item->Type() == SCH_SYMBOL_T )
949 foundSymbol = item;
950 }
951 }
952
953 if( foundSymbol && foundJunction )
954 {
955 aList.push_back( foundSymbol );
956 return;
957 }
958
959 if( foundJunction )
960 {
961 aList.push_back( foundJunction );
962 return;
963 }
964
965
966 for( SCH_ITEM* test : itemsOverlapping )
967 {
968 if( test == aOriginalItem || !test->CanConnect( aOriginalItem ) )
969 continue;
970
971 switch( test->Type() )
972 {
973 case SCH_LINE_T:
974 {
975 SCH_LINE* line = static_cast<SCH_LINE*>( test );
976
977 //When getting lines for the connection cache, it's important that
978 //we only add items at the unselected end, since that is the only
979 //end that is handled specially. Fully selected lines, and the selected
980 //end of a partially selected line, are moved around normally and
981 //don't care about their connections.
982 if( ( line->HasFlag( STARTPOINT ) && aPoint == line->GetStartPoint() )
983 || ( line->HasFlag( ENDPOINT ) && aPoint == line->GetEndPoint() ) )
984 continue;
985
986 if( test->IsConnected( aPoint ) )
987 aList.push_back( test );
988
989 // Labels can connect to a wire (or bus) anywhere along the length
990 switch( aOriginalItem->Type() )
991 {
992 case SCH_LABEL_T:
994 case SCH_HIER_LABEL_T:
995 if( static_cast<SCH_LINE*>( test )->HitTest(
996 static_cast<SCH_LABEL*>( aOriginalItem )->GetTextPos(), 1 ) )
997 aList.push_back( test );
998 break;
999 default: break;
1000 }
1001
1002 break;
1003 }
1004 case SCH_SHEET_T:
1005 case SCH_SYMBOL_T:
1006 case SCH_JUNCTION_T:
1007 case SCH_NO_CONNECT_T:
1008 if( test->IsConnected( aPoint ) )
1009 aList.push_back( test );
1010
1011 break;
1012
1013 case SCH_LABEL_T:
1014 case SCH_GLOBAL_LABEL_T:
1015 case SCH_HIER_LABEL_T:
1016 // Labels can connect to a wire (or bus) anywhere along the length
1017 if( aOriginalItem->Type() == SCH_LINE_T && test->CanConnect( aOriginalItem ) )
1018 {
1019 SCH_TEXT* label = static_cast<SCH_TEXT*>( test );
1020 SCH_LINE* line = static_cast<SCH_LINE*>( aOriginalItem );
1021
1022 if( line->HitTest( label->GetTextPos(), 1 ) )
1023 aList.push_back( label );
1024 }
1025 break;
1028 if( aOriginalItem->Type() == SCH_LINE_T && test->CanConnect( aOriginalItem ) )
1029 {
1030 SCH_TEXT* label = static_cast<SCH_TEXT*>( test );
1031 SCH_LINE* line = static_cast<SCH_LINE*>( aOriginalItem );
1032
1033 if( line->HitTest( aPoint, 1 ) )
1034 aList.push_back( label );
1035 }
1036 break;
1037
1038 default: break;
1039 }
1040 }
1041}

References ENDPOINT, EDA_ITEM::GetBoundingBox(), SCH_LINE::GetEndPoint(), SCH_EDIT_FRAME::GetScreen(), SCH_LINE::GetStartPoint(), EDA_TEXT::GetTextPos(), EDA_ITEM::HasFlag(), SCH_LINE::HitTest(), SCH_ITEM::IsConnected(), SCH_SCREEN::Items(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_RTREE::Overlapping(), SCH_BUS_BUS_ENTRY_T, SCH_BUS_WIRE_ENTRY_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_JUNCTION_T, SCH_LABEL_T, SCH_LINE_T, SCH_NO_CONNECT_T, SCH_SHEET_T, SCH_SYMBOL_T, STARTPOINT, and EDA_ITEM::Type().

Referenced by Main().

◆ getEditFrame()

template<typename T >
T * TOOL_BASE::getEditFrame ( ) const
inlineprotectedinherited

Return the application window object, casted to requested user type.

Definition at line 184 of file tool_base.h.

185 {
186#if !defined( QA_TEST ) // Dynamic casts give the linker a seizure in the test framework
187 wxASSERT( dynamic_cast<T*>( getToolHolderInt() ) );
188#endif
189 return static_cast<T*>( getToolHolderInt() );
190 }
TOOLS_HOLDER * getToolHolderInt() const
Definition: tool_base.cpp:48

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone(), and ZONE_CREATE_HELPER::setUniquePriority().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Return the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 120 of file tool_base.h.

121 {
122 return m_toolId;
123 }

References TOOL_BASE::m_toolId.

Referenced by TOOL_MANAGER::finishTool(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::isActive(), TOOL_MANAGER::RegisterTool(), ACTION_MANAGER::RunHotKey(), TOOL_MANAGER::runTool(), TOOL_MANAGER::saveViewControls(), and TOOL_MANAGER::ShutdownTool().

◆ GetManager()

TOOL_MANAGER * TOOL_BASE::GetManager ( ) const
inlineinherited

◆ getModel()

template<typename T >
T * TOOL_BASE::getModel ( ) const
inlineprotectedinherited

Return the model object if it matches the requested type.

Store the type of the tool.

Definition at line 196 of file tool_base.h.

References TOOL_BASE::getModelInt().

Referenced by ZONE_CREATE_HELPER::commitZone(), and ZONE_CREATE_HELPER::createZoneFromExisting().

◆ getModelInt()

EDA_ITEM * TOOL_BASE::getModelInt ( ) const
privateinherited

Definition at line 54 of file tool_base.cpp.

55{
56 return m_toolMgr->GetModel();
57}
EDA_ITEM * GetModel() const
Definition: tool_manager.h:292

References TOOL_MANAGER::GetModel(), and TOOL_BASE::m_toolMgr.

Referenced by TOOL_BASE::getModel().

◆ GetName()

const std::string & TOOL_BASE::GetName ( void  ) const
inlineinherited

Return the name of the tool.

Tool names are expected to obey the format: application.ToolName (eg. pcbnew.InteractiveSelection).

Returns
The name of the tool.

Definition at line 133 of file tool_base.h.

134 {
135 return m_toolName;
136 }
std::string m_toolName
Definition: tool_base.h:213

References TOOL_BASE::m_toolName.

Referenced by TOOL_MANAGER::dispatchInternal(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::invokeTool(), TOOL_MANAGER::RegisterTool(), TOOL_MANAGER::runTool(), and TOOL_MANAGER::ShutdownTool().

◆ getToolHolderInt()

TOOLS_HOLDER * TOOL_BASE::getToolHolderInt ( ) const
privateinherited

Definition at line 48 of file tool_base.cpp.

49{
50 return m_toolMgr->GetToolHolder();
51}
TOOLS_HOLDER * GetToolHolder() const
Definition: tool_manager.h:296

References TOOL_MANAGER::GetToolHolder(), and TOOL_BASE::m_toolMgr.

Referenced by TOOL_BASE::getEditFrame().

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Return the type of the tool.

Returns
The type of the tool.

Definition at line 108 of file tool_base.h.

109 {
110 return m_type;
111 }
TOOL_TYPE m_type
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:206

References TOOL_BASE::m_type.

Referenced by TOOL_MANAGER::finishTool(), TOOL_MANAGER::InvokeTool(), TOOL_MANAGER::ResetTools(), TOOL_MANAGER::runTool(), and TOOL_MANAGER::ShutdownTool().

◆ getView()

KIGFX::VIEW * TOOL_BASE::getView ( ) const
protectedinherited

Returns the instance of #VIEW object used in the application.

It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

37{
38 return m_toolMgr->GetView();
39}
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:285

References TOOL_MANAGER::GetView(), and TOOL_BASE::m_toolMgr.

Referenced by EE_POINT_EDITOR::addCornerCondition(), ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), COMMON_TOOLS::CenterContents(), SCH_EDIT_TOOL::ChangeTextType(), EE_INSPECTION_TOOL::CheckSymbol(), GERBVIEW_CONTROL::ClearAllLayers(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::CollectHits(), SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint(), COMMON_TOOLS::CursorControl(), SCH_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), PL_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SELECTION_TOOL::doSelectionMenu(), COMMON_TOOLS::doZoomFit(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), PCB_CONTROL::GridResetOrigin(), PCB_CONTROL::GridSetOrigin(), EE_SELECTION_TOOL::GuessSelectionCandidates(), ROUTER_TOOL::handleCommonEvents(), EE_SELECTION_TOOL::highlight(), PL_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), PCB_SELECTION_TOOL::hitTestDistance(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineDrag(), EE_POINT_EDITOR::Main(), Main(), PL_POINT_EDITOR::Main(), PCB_PICKER_TOOL::Main(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), PL_EDIT_TOOL::moveItem(), moveItem(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), ROUTER_TOOL::performRouting(), PNS::TOOL_BASE::pickSingleItem(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), ROUTER_TOOL::prepareInteractive(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), EE_SELECTION_TOOL::Reset(), EE_TOOL_BASE< T >::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), PNS::TOOL_BASE::Reset(), BOARD_EDITOR_CONTROL::Reset(), DRAWING_TOOL::Reset(), PCB_CONTROL::Reset(), PCB_SELECTION_TOOL::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::SelectAll(), PCB_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_EDITOR_CONTROL::ToggleERCErrors(), SCH_EDITOR_CONTROL::ToggleERCExclusions(), SCH_EDITOR_CONTROL::ToggleERCWarnings(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), EE_SELECTION_TOOL::unhighlight(), PL_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), SCH_EDITOR_CONTROL::UpdateFind(), PL_POINT_EDITOR::updateItem(), PCB_POINT_EDITOR::updateItem(), EE_TOOL_BASE< T >::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), PCB_POINT_EDITOR::updatePoints(), PCB_SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), PCB_SELECTION_TOOL::view(), PCB_TOOL_BASE::view(), PCB_VIEWER_TOOLS::view(), EE_SELECTION_TOOL::ZoomFitCrossProbeBBox(), PCB_SELECTION_TOOL::ZoomFitCrossProbeBBox(), PCB_SELECTION_TOOL::zoomFitSelection(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and PCB_SELECTION_TOOL::~PCB_SELECTION_TOOL().

◆ getViewControls()

KIGFX::VIEW_CONTROLS * TOOL_BASE::getViewControls ( ) const
protectedinherited

Return the instance of VIEW_CONTROLS object used in the application.

It allows tools to read & modify user input and its settings (eg. show cursor, enable snapping to grid, etc.).

Returns
The instance of VIEW_CONTROLS.

Definition at line 42 of file tool_base.cpp.

43{
44 return m_toolMgr->GetViewControls();
45}
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:287

References TOOL_MANAGER::GetViewControls(), and TOOL_BASE::m_toolMgr.

Referenced by EE_POINT_EDITOR::addCorner(), PCB_POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDITOR_CONTROL::AssignNetclass(), EE_SELECTION_TOOL::autostartEvent(), SCH_EDIT_TOOL::BreakWire(), PCB_SELECTION_TOOL::controls(), PCB_TOOL_BASE::controls(), EDIT_TOOL::copyToClipboard(), SCH_DRAWING_TOOLS::createSheetPin(), COMMON_TOOLS::CursorControl(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::HighlightNet(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), EE_POINT_EDITOR::Main(), EE_SELECTION_TOOL::Main(), Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_POINT_EDITOR::Main(), PCB_PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), LENGTH_TUNER_TOOL::performTuning(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), PL_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), DRAWING_TOOL::Reset(), PCB_POINT_EDITOR::Reset(), COMMON_TOOLS::ResetLocalCoords(), ROUTER_TOOL::RouteSelected(), PCB_SELECTION_TOOL::selectCursor(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PICKER_TOOL::setControls(), PCB_PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), PCB_POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateItem(), PL_EDIT_TOOL::updateModificationPoint(), and COMMON_TOOLS::ZoomCenter().

◆ Go()

template<class T >
void TOOL_INTERACTIVE::Go ( int(T::*)(const TOOL_EVENT &)  aStateFunc,
const TOOL_EVENT_LIST aConditions = TOOL_EVENTTC_ANYTA_ANY ) 
)
inherited

Define which state (aStateFunc) to go when a certain event arrives (aConditions).

No conditions means any event.

Definition at line 147 of file tool_interactive.h.

149{
150 TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
151
152 goInternal( sptr, aConditions );
153}
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:58

References TOOL_INTERACTIVE::goInternal().

Referenced by EDA_3D_CONTROLLER::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), EE_POINT_EDITOR::setTransitions(), EE_SELECTION_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), SCH_EDIT_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), setTransitions(), SCH_NAVIGATE_TOOL::setTransitions(), SYMBOL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_DRAWING_TOOLS::setTransitions(), SYMBOL_EDITOR_EDIT_TOOL::setTransitions(), SYMBOL_EDITOR_MOVE_TOOL::setTransitions(), SYMBOL_EDITOR_PIN_TOOL::setTransitions(), GERBVIEW_CONTROL::setTransitions(), GERBVIEW_INSPECTION_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), COMMON_CONTROL::setTransitions(), COMMON_TOOLS::setTransitions(), PICKER_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), PL_EDIT_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), PL_POINT_EDITOR::setTransitions(), PL_SELECTION_TOOL::setTransitions(), AUTOPLACE_TOOL::setTransitions(), MICROWAVE_TOOL::setTransitions(), SCRIPTING_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), BOARD_EDITOR_CONTROL::setTransitions(), BOARD_INSPECTION_TOOL::setTransitions(), BOARD_REANNOTATE_TOOL::setTransitions(), CONVERT_TOOL::setTransitions(), DRAWING_TOOL::setTransitions(), DRC_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), FOOTPRINT_EDITOR_CONTROL::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GROUP_TOOL::setTransitions(), PAD_TOOL::setTransitions(), PCB_CONTROL::setTransitions(), PCB_PICKER_TOOL::setTransitions(), PCB_POINT_EDITOR::setTransitions(), PCB_SELECTION_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), PROPERTIES_TOOL::setTransitions(), and ZONE_FILLER_TOOL::setTransitions().

◆ goInternal()

void TOOL_INTERACTIVE::goInternal ( TOOL_STATE_FUNC aState,
const TOOL_EVENT_LIST aConditions 
)
privateinherited

Definition at line 70 of file tool_interactive.cpp.

71{
72 m_toolMgr->ScheduleNextState( this, aState, aConditions );
73}
void ScheduleNextState(TOOL_BASE *aTool, TOOL_STATE_FUNC &aHandler, const TOOL_EVENT_LIST &aConditions)
Define a state transition.

References TOOL_BASE::m_toolMgr, and TOOL_MANAGER::ScheduleNextState().

Referenced by TOOL_INTERACTIVE::Go().

◆ Init()

bool SCH_MOVE_TOOL::Init ( )
overridevirtual

Init() is called once upon a registration of the tool.

Returns
True if the initialization went fine, false - otherwise.

Reimplemented from TOOL_BASE.

Definition at line 59 of file sch_move_tool.cpp.

60{
62
63 auto moveCondition =
64 []( const SELECTION& aSel )
65 {
66 if( aSel.Empty() || SELECTION_CONDITIONS::OnlyTypes( { SCH_MARKER_T } )( aSel ) )
67 return false;
68
70 return false;
71
72 return true;
73 };
74
75 // Add move actions to the selection tool menu
76 //
78
79 selToolMenu.AddItem( EE_ACTIONS::move, moveCondition, 150 );
80 selToolMenu.AddItem( EE_ACTIONS::drag, moveCondition, 150 );
81 selToolMenu.AddItem( EE_ACTIONS::alignToGrid, moveCondition, 150 );
82
83 return true;
84}
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Add a menu entry to run a TOOL_ACTION on selected items.
static TOOL_ACTION alignToGrid
Definition: ee_actions.h:120
static TOOL_ACTION move
Definition: ee_actions.h:123
static TOOL_ACTION drag
Definition: ee_actions.h:124
bool Init() override
Init() is called once upon a registration of the tool.
Definition: ee_tool_base.h:66
static bool IsDrawingLineWireOrBus(const SELECTION &aSelection)
static SELECTION_CONDITION OnlyTypes(std::vector< KICAD_T > aTypes)
Create a functor that tests if the selected items are only of given types.
TOOL_MENU & GetToolMenu()
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:44
@ SCH_MARKER_T
Definition: typeinfo.h:140

References CONDITIONAL_MENU::AddItem(), EE_ACTIONS::alignToGrid, EE_ACTIONS::drag, TOOL_MENU::GetMenu(), TOOL_INTERACTIVE::GetToolMenu(), EE_TOOL_BASE< T >::Init(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, EE_ACTIONS::move, SELECTION_CONDITIONS::OnlyTypes(), and SCH_MARKER_T.

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 31 of file tool_base.cpp.

32{
34}
bool IsToolActive(TOOL_ID aId) const
Return true if a tool with given id is active (executing)

References TOOL_MANAGER::IsToolActive(), TOOL_BASE::m_toolId, and TOOL_BASE::m_toolMgr.

Referenced by EDIT_TOOL::Drag(), ROUTER_TOOL::handleLayerSwitch(), PCB_SELECTION_TOOL::Main(), BOARD_EDITOR_CONTROL::TrackWidthDec(), and BOARD_EDITOR_CONTROL::TrackWidthInc().

◆ Main()

int SCH_MOVE_TOOL::Main ( const TOOL_EVENT aEvent)

Run an interactive move of the selected items, or the item under the cursor.

Definition at line 87 of file sch_move_tool.cpp.

88{
89 EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
92 bool wasDragging = m_moveInProgress && m_isDrag;
93
94 m_anchorPos.reset();
95
96 if( aEvent.IsAction( &EE_ACTIONS::move ) )
97 m_isDrag = false;
98 else if( aEvent.IsAction( &EE_ACTIONS::drag ) )
99 m_isDrag = true;
100 else if( aEvent.IsAction( &EE_ACTIONS::moveActivate ) )
102 else
103 return 0;
104
105 if( m_moveInProgress )
106 {
107 if( m_isDrag != wasDragging )
108 {
110
111 if( sel && !sel->IsNew() )
112 {
113 // Reset the selected items so we can start again with the current m_isDrag
114 // state.
118 m_moveInProgress = false;
119 controls->SetAutoPan( false );
120
121 // And give it a kick so it doesn't have to wait for the first mouse movement
122 // to refresh.
124 }
125 }
126 else
127 {
128 // The tool hotkey is interpreted as a click when already dragging/moving
130 }
131
132 return 0;
133 }
134
135 // Be sure that there is at least one item that we can move. If there's no selection try
136 // looking for the stuff under mouse cursor (i.e. Kicad old-style hover selection).
138 bool unselect = selection.IsHover();
139
140 // Keep an original copy of the starting points for cleanup after the move
141 std::vector<DANGLING_END_ITEM> internalPoints;
142
143 Activate();
144 // Must be done after Activate() so that it gets set into the correct context
145 controls->ShowCursor( true );
146
147 m_frame->PushTool( aEvent );
148
149 if( selection.Empty() )
150 {
151 // Note that it's important to go through push/pop even when the selection is empty.
152 // This keeps other tools from having to special-case an empty move.
153 m_frame->PopTool( aEvent );
154 return 0;
155 }
156
157 bool restore_state = false;
158 bool chain_commands = false;
159 TOOL_EVENT copy = aEvent;
160 TOOL_EVENT* evt = &copy;
161 VECTOR2I prevPos;
162 int snapLayer = UNDEFINED_LAYER;
163
164 m_cursor = controls->GetCursorPosition();
165
166 // Main loop: keep receiving events
167 do
168 {
170 grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
171 grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
172
175 || evt->IsAction( &EE_ACTIONS::move )
176 || evt->IsAction( &EE_ACTIONS::drag )
177 || evt->IsMotion()
178 || evt->IsDrag( BUT_LEFT )
180 {
181 if( !m_moveInProgress ) // Prepare to start moving/dragging
182 {
183 SCH_ITEM* sch_item = (SCH_ITEM*) selection.Front();
184 bool appendUndo = sch_item && sch_item->IsNew();
185 bool placingNewItems = sch_item && sch_item->IsNew();
186
187 //------------------------------------------------------------------------
188 // Setup a drag or a move
189 //
190 m_dragAdditions.clear();
191 m_specialCaseLabels.clear();
192 internalPoints.clear();
194
195 for( SCH_ITEM* it : m_frame->GetScreen()->Items() )
196 {
197 it->ClearFlags( SELECTED_BY_DRAG );
198
199 if( !it->IsSelected() )
200 it->ClearFlags( STARTPOINT | ENDPOINT );
201 }
202
203 if( m_isDrag )
204 {
205 EDA_ITEMS connectedDragItems;
206
207 // Add connections to the selection for a drag.
208 //
209 for( EDA_ITEM* edaItem : selection )
210 {
211 SCH_ITEM* item = static_cast<SCH_ITEM*>( edaItem );
212 std::vector<VECTOR2I> connections;
213
214 if( item->Type() == SCH_LINE_T )
215 static_cast<SCH_LINE*>( item )->GetSelectedPoints( connections );
216 else
217 connections = item->GetConnectionPoints();
218
219 for( VECTOR2I point : connections )
220 getConnectedDragItems( item, point, connectedDragItems );
221 }
222
223 for( EDA_ITEM* item : connectedDragItems )
224 {
225 m_dragAdditions.push_back( item->m_Uuid );
227 }
228
229 // Pre-cache all connections of our selected objects so we can keep track of what
230 // they were originally connected to as we drag them around
231 for( EDA_ITEM* edaItem : selection )
232 {
233 SCH_ITEM* schItem = static_cast<SCH_ITEM*>( edaItem );
234
235 if( schItem->Type() == SCH_LINE_T )
236 {
237 SCH_LINE* line = static_cast<SCH_LINE*>( schItem );
238 //Also store the original angle of the line, is needed later to decide
239 //which segment to extend when they've become zero length
240 line->StoreAngle();
241 for( VECTOR2I point : line->GetConnectionPoints() )
242 getConnectedItems( line, point, m_lineConnectionCache[line] );
243 }
244 }
245 }
246 else
247 {
248 // Mark the edges of the block with dangling flags for a move.
249 for( EDA_ITEM* item : selection )
250 static_cast<SCH_ITEM*>( item )->GetEndPoints( internalPoints );
251
252 for( EDA_ITEM* item : selection )
253 static_cast<SCH_ITEM*>( item )->UpdateDanglingState( internalPoints );
254 }
255 // Generic setup
256 //
257 for( EDA_ITEM* item : selection )
258 {
259 if( static_cast<SCH_ITEM*>( item )->IsConnectable() )
260 {
261 if( snapLayer == LAYER_GRAPHICS )
262 snapLayer = LAYER_ANY;
263 else
264 snapLayer = LAYER_CONNECTABLE;
265 }
266 else
267 {
268 if( snapLayer == LAYER_CONNECTABLE )
269 snapLayer = LAYER_ANY;
270 else
271 snapLayer = LAYER_GRAPHICS;
272 }
273
274 if( item->IsNew() )
275 {
276 if( item->HasFlag( SELECTED_BY_DRAG ) && m_isDrag )
277 {
278 // Item was added in getConnectedDragItems
279 saveCopyInUndoList( (SCH_ITEM*) item, UNDO_REDO::NEWITEM, appendUndo );
280 appendUndo = true;
281 }
282 else
283 {
284 // Item was added in a previous command (and saved to undo by
285 // that command)
286 }
287 }
288 else if( item->GetParent() && item->GetParent()->IsSelected() )
289 {
290 // Item will be (or has been) saved to undo by parent
291 }
292 else
293 {
294 saveCopyInUndoList( (SCH_ITEM*) item, UNDO_REDO::CHANGED, appendUndo );
295 appendUndo = true;
296 }
297
298 SCH_ITEM* schItem = (SCH_ITEM*) item;
299 schItem->SetStoredPos( schItem->GetPosition() );
300 }
301
302 // Set up the starting position and move/drag offset
303 //
304 m_cursor = controls->GetCursorPosition();
305
306 if( evt->IsAction( &EE_ACTIONS::restartMove ) )
307 {
308 wxASSERT_MSG( m_anchorPos, "Should be already set from previous cmd" );
309 }
310 else if( placingNewItems )
311 {
312 m_anchorPos = selection.GetReferencePoint();
313 }
314
315 if( m_anchorPos )
316 {
317 VECTOR2I delta = m_cursor - (*m_anchorPos);
318 bool isPasted = false;
319
320 // Drag items to the current cursor position
321 for( EDA_ITEM* item : selection )
322 {
323 // Don't double move pins, fields, etc.
324 if( item->GetParent() && item->GetParent()->IsSelected() )
325 continue;
326
327 moveItem( item, delta );
328 updateItem( item, false );
329
330 isPasted |= ( item->GetFlags() & IS_PASTED ) != 0;
331 item->ClearFlags( IS_PASTED );
332 }
333
334 // The first time pasted items are moved we need to store
335 // the position of the cursor so that rotate while moving
336 // works as expected (instead of around the original anchor
337 // point
338 if( isPasted )
339 selection.SetReferencePoint( m_cursor );
340
342 }
343 // For some items, moving the cursor to anchor is not good (for instance large
344 // hierarchical sheets or symbols can have the anchor outside the view)
345 else if( selection.Size() == 1 && !sch_item->IsMovableFromAnchorPoint() )
346 {
349 }
350 else
351 {
353 {
354 // User wants to warp the mouse
355 m_cursor = grid.BestDragOrigin( m_cursor, snapLayer, selection );
356 selection.SetReferencePoint( m_cursor );
357 }
358 else
359 {
360 // User does not want to warp the mouse
362 }
363 }
364
365 controls->SetCursorPosition( m_cursor, false );
367
368 prevPos = m_cursor;
369 controls->SetAutoPan( true );
370 m_moveInProgress = true;
371 }
372
373 //------------------------------------------------------------------------
374 // Follow the mouse
375 //
376 m_cursor = grid.BestSnapAnchor( controls->GetCursorPosition( false ),
377 snapLayer, selection );
378
379 VECTOR2I delta( m_cursor - prevPos );
381
382 // We need to check if the movement will change the net offset direction on the
383 // X an Y axes. This is because we remerge added bend lines in realtime, and we
384 // also account for the direction of the move when adding bend lines. So, if the
385 // move direction changes, we need to split it into a move that gets us back to
386 // zero, then the rest of the move.
387 std::vector<VECTOR2I> splitMoves;
388
390 {
391 splitMoves.emplace_back( VECTOR2I( -1 * m_moveOffset.x, 0 ) );
392 splitMoves.emplace_back( VECTOR2I( delta.x + m_moveOffset.x, 0 ) );
393 }
394 else
395 {
396 splitMoves.emplace_back( VECTOR2I( delta.x, 0 ) );
397 }
398
400 {
401 splitMoves.emplace_back( VECTOR2I( 0, -1 * m_moveOffset.y ) );
402 splitMoves.emplace_back( VECTOR2I( 0, delta.y + m_moveOffset.y ) );
403 }
404 else
405 {
406 splitMoves.emplace_back( VECTOR2I( 0, delta.y ) );
407 }
408
409
411 prevPos = m_cursor;
412
413 // Used for tracking how far off a drag end should have its 90 degree elbow added
414 int xBendCount = 1;
415 int yBendCount = 1;
416
417 // Split the move into X and Y moves so we can correctly drag orthogonal lines
418 for( VECTOR2I splitDelta : splitMoves )
419 {
420 // Skip non-moves
421 if( splitDelta == VECTOR2I( 0, 0 ) )
422 continue;
423
424 for( EDA_ITEM* item : selection.GetItemsSortedByTypeAndXY( ( delta.x >= 0 ),
425 ( delta.y >= 0 ) ) )
426 {
427 // Don't double move pins, fields, etc.
428 if( item->GetParent() && item->GetParent()->IsSelected() )
429 continue;
430
431 SCH_LINE* line = item->Type() == SCH_LINE_T ? static_cast<SCH_LINE*>( item )
432 : nullptr;
433
434 // Only partially selected drag lines in orthogonal line mode need special handling
435 if( m_isDrag
437 && line
438 && line->HasFlag( STARTPOINT ) != line->HasFlag( ENDPOINT ) )
439 {
440 // If the move is not the same angle as this move, then we need to do something
441 // special with the unselected end to maintain orthogonality. Either drag some
442 // connected line that is the same angle as the move or add two lines to make
443 // a 90 degree connection
444 if( !( EDA_ANGLE( splitDelta ).IsParallelTo( line->Angle() ) )
445 || ( line->GetLength() == 0 ) )
446 {
447 VECTOR2I unselectedEnd = line->HasFlag( STARTPOINT )
448 ? line->GetEndPoint()
449 : line->GetStartPoint();
450 VECTOR2I selectedEnd = line->HasFlag( STARTPOINT )
451 ? line->GetStartPoint()
452 : line->GetEndPoint();
453
454 // Look for pre-existing lines we can drag with us instead of creating new ones
455 bool foundAttachment = false;
456 bool foundJunction = false;
457 bool foundPin = false;
458 SCH_LINE* foundLine = nullptr;
459 for( EDA_ITEM* cItem : m_lineConnectionCache[line] )
460 {
461 foundAttachment = true;
462
463 // If the move is the same angle as a connected line,
464 // we can shrink/extend that line endpoint
465 switch( cItem->Type() )
466 {
467 case SCH_LINE_T:
468 {
469 SCH_LINE* cLine = static_cast<SCH_LINE*>( cItem );
470
471 // A matching angle on a non-zero-length line means lengthen/shorten will work
472 if( ( EDA_ANGLE( splitDelta ).IsParallelTo( cLine->Angle() ) )
473 && cLine->GetLength() != 0 )
474 foundLine = cLine;
475
476 // Zero length lines are lines that this algorithm has shortened to 0 so they
477 // also work but we should prefer using a segment with length and angle matching
478 // when we can (otherwise the zero length line will draw overlapping segments on them)
479 if( foundLine == nullptr && cLine->GetLength() == 0 )
480 foundLine = cLine;
481
482 break;
483 }
484 case SCH_JUNCTION_T:
485 foundJunction = true;
486 break;
487
488 case SCH_PIN_T:
489 foundPin = true;
490 break;
491
492 default: break;
493 }
494 }
495
496 // Ok... what if our original line is length zero from moving in its direction,
497 // and the last added segment of the 90 bend we are connected to is zero from moving
498 // it its direction after it was added?
499 //
500 // If we are moving in original direction, we should lengthen the original
501 // drag wire. Otherwise we should lengthen the new wire.
502 bool preferOriginalLine = false;
503
504 if( foundLine && ( foundLine->GetLength() == 0 )
505 && ( line->GetLength() == 0 )
506 && ( EDA_ANGLE( splitDelta )
507 .IsParallelTo( line->GetStoredAngle() ) ) )
508 {
509 preferOriginalLine = true;
510 }
511 // If we have found an attachment, but not a line, we want to check if it's
512 // a junction. These are special-cased and get a single line added instead of a
513 // 90-degree bend. Except when we're on a pin, because pins always need bends,
514 // and junctions are just added to pins for visual clarity.
515 else if( !foundLine && foundJunction && !foundPin )
516 {
517 // Create a new wire ending at the unselected end
518 foundLine = new SCH_LINE( unselectedEnd, line->GetLayer() );
519 foundLine->SetFlags( IS_NEW );
520 foundLine->SetLastResolvedState( line );
521 m_frame->AddToScreen( foundLine, m_frame->GetScreen() );
522 m_newDragLines.insert( foundLine );
523
524 // We just broke off of the existing items, so replace all of them with our new
525 // end connection.
527 m_lineConnectionCache[line].clear();
528 m_lineConnectionCache[line].emplace_back( foundLine );
529 }
530
531 // We want to drag our found line if it's in the same angle as the move or zero length,
532 // but if the original drag line is also zero and the same original angle we should extend
533 // that one first
534 if( foundLine && !preferOriginalLine )
535 {
536 // Move the connected line found oriented in the direction of our move.
537 //
538 // Make sure we grab the right endpoint, it's not always STARTPOINT since
539 // the user can draw a box of lines. We need to only move one though,
540 // and preferably the start point, in case we have a zero length line
541 // that we are extending (we want the foundLine start point to be attached
542 // to the unselected end of our drag line).
543 //
544 // Also, new lines are added already so they'll be in the undo list, skip
545 // adding them.
546 if( !foundLine->HasFlag( IS_CHANGED )
547 && !foundLine->HasFlag( IS_NEW ) )
548 {
550 true );
551
552 if( !foundLine->IsSelected() )
553 m_changedDragLines.insert( foundLine );
554 }
555
556 if( foundLine->GetStartPoint() == unselectedEnd )
557 foundLine->MoveStart( splitDelta );
558 else if( foundLine->GetEndPoint() == unselectedEnd )
559 foundLine->MoveEnd( splitDelta );
560
561 updateItem( foundLine, true );
562
563
564 SCH_LINE* bendLine = nullptr;
565
566 if( ( m_lineConnectionCache.count( foundLine ) == 1 )
567 && ( m_lineConnectionCache[foundLine][0]->Type()
568 == SCH_LINE_T ) )
569 {
570 bendLine = static_cast<SCH_LINE*>(
571 m_lineConnectionCache[foundLine][0] );
572 }
573
574 // Remerge segments we've created if this is a segment that we've added
575 // whose only other connection is also an added segment
576 //
577 // bendLine is first added segment at the original attachment point,
578 // foundLine is the orthogonal line between bendLine and this line
579 if( foundLine->HasFlag( IS_NEW ) && ( foundLine->GetLength() == 0 )
580 && ( bendLine != nullptr ) && bendLine->HasFlag( IS_NEW ) )
581 {
582 if( line->HasFlag( STARTPOINT ) )
583 line->SetEndPoint( bendLine->GetEndPoint() );
584 else
585 line->SetStartPoint( bendLine->GetEndPoint() );
586
587 // Update our cache of the connected items.
588
589 // First, re-attach our drag labels to the original line being re-merged.
590 for( EDA_ITEM* possibleLabel : m_lineConnectionCache[bendLine] )
591 {
592 switch( possibleLabel->Type() )
593 {
594 case SCH_LABEL_T:
596 case SCH_HIER_LABEL_T:
597 {
598 SCH_LABEL* label =
599 static_cast<SCH_LABEL*>( possibleLabel );
600 if( m_specialCaseLabels.count( label ) )
601 m_specialCaseLabels[label].attachedLine = line;
602 break;
603 }
604 default: break;
605 }
606 }
607
609 m_lineConnectionCache[bendLine].clear();
610 m_lineConnectionCache[foundLine].clear();
611
612
613 m_frame->RemoveFromScreen( bendLine, m_frame->GetScreen() );
614 m_frame->RemoveFromScreen( foundLine, m_frame->GetScreen() );
615
616 m_newDragLines.erase( bendLine );
617 m_newDragLines.erase( foundLine );
618
619 delete bendLine;
620 delete foundLine;
621 }
622 //Ok, move the unselected end of our item
623 else
624 {
625 if( line->HasFlag( STARTPOINT ) )
626 line->MoveEnd( splitDelta );
627 else
628 line->MoveStart( splitDelta );
629 }
630
631 updateItem( line, true );
632 }
633 else if( line->GetLength() == 0 )
634 {
635 // We didn't find another line to shorten/lengthen, (or we did but it's also zero)
636 // so now is a good time to use our existing zero-length original line
637 }
638 // Either no line was at the "right" angle, or this was a junction, pin, sheet, etc.
639 // We need to add segments to keep the soon-to-move unselected end connected to these
640 // items.
641 //
642 // To keep our drag selections all the same, we'll move our unselected end point and
643 // then put wires between it and its original endpoint.
644 else if( foundAttachment && line->IsOrthogonal() )
645 {
646 // The bend counter handles a group of wires all needing their offset one
647 // grid movement further out from each other to not overlap.
648 // The absolute value stuff finds the direction of the line and hence
649 // the the bend increment on that axis
650 unsigned int xMoveBit = splitDelta.x != 0;
651 unsigned int yMoveBit = splitDelta.y != 0;
652 int xLength = abs( unselectedEnd.x - selectedEnd.x );
653 int yLength = abs( unselectedEnd.y - selectedEnd.y );
654 int xMove = ( xLength - ( xBendCount * grid.GetGrid().x ) )
655 * sign( selectedEnd.x - unselectedEnd.x );
656 int yMove = ( yLength - ( yBendCount * grid.GetGrid().y ) )
657 * sign( selectedEnd.y - unselectedEnd.y );
658
659 // Create a new wire ending at the unselected end, we'll
660 // move the new wire's start point to the unselected end
661 SCH_LINE* a = new SCH_LINE( unselectedEnd, line->GetLayer() );
662 a->MoveStart( VECTOR2I( xMove, yMove ) );
663 a->SetFlags( IS_NEW );
664 a->SetConnectivityDirty( true );
665 a->SetLastResolvedState( line );
667 m_newDragLines.insert( a );
668
669 SCH_LINE* b = new SCH_LINE( a->GetStartPoint(), line->GetLayer() );
670 b->MoveStart( VECTOR2I( splitDelta.x, splitDelta.y ) );
671 b->SetFlags( IS_NEW | STARTPOINT );
672 b->SetConnectivityDirty( true );
673 b->SetLastResolvedState( line );
675 m_newDragLines.insert( b );
676
677 xBendCount += yMoveBit;
678 yBendCount += xMoveBit;
679
680 // Ok move the unselected end of our item
681 if( line->HasFlag( STARTPOINT ) )
682 {
683 line->MoveEnd(
684 VECTOR2I( splitDelta.x ? splitDelta.x : xMove,
685 splitDelta.y ? splitDelta.y : yMove ) );
686 }
687 else
688 {
689 line->MoveStart(
690 VECTOR2I( splitDelta.x ? splitDelta.x : xMove,
691 splitDelta.y ? splitDelta.y : yMove ) );
692 }
693
694 updateItem( line, true );
695
696 // Update our cache of the connected items.
697 // First, attach our drag labels to the line left behind.
698 for( EDA_ITEM* possibleLabel : m_lineConnectionCache[line] )
699 {
700 switch( possibleLabel->Type() )
701 {
702 case SCH_LABEL_T:
704 case SCH_HIER_LABEL_T:
705 {
706 SCH_LABEL* label = static_cast<SCH_LABEL*>( possibleLabel );
707 if( m_specialCaseLabels.count( label ) )
708 m_specialCaseLabels[label].attachedLine = a;
709 break;
710 }
711 default: break;
712 }
713 }
714
715 // We just broke off of the existing items, so replace all of them with our new
716 // end connection.
718 m_lineConnectionCache[b].emplace_back( a );
719 m_lineConnectionCache[line].clear();
720 m_lineConnectionCache[line].emplace_back( b );
721 }
722 // Original line has no attachments, just move the unselected end
723 else if( !foundAttachment )
724 {
725 if( line->HasFlag( STARTPOINT ) )
726 line->MoveEnd( splitDelta );
727 else
728 line->MoveStart( splitDelta );
729 }
730 }
731 }
732
733 // Move all other items normally, including the selected end of
734 // partially selected lines
735 moveItem( item, splitDelta );
736 updateItem( item, false );
737 }
738 }
739
740 if( selection.HasReferencePoint() )
741 selection.SetReferencePoint( selection.GetReferencePoint() + delta );
742
744 }
745
746 //------------------------------------------------------------------------
747 // Handle cancel
748 //
749 else if( evt->IsCancelInteractive() || evt->IsActivate() )
750 {
751 if( evt->IsCancelInteractive() )
753
754 if( m_moveInProgress )
755 {
756 if( evt->IsActivate() )
757 {
758 // Allowing other tools to activate during a move runs the risk of race
759 // conditions in which we try to spool up both event loops at once.
760
761 if( m_isDrag )
762 m_frame->ShowInfoBarMsg( _( "Press <ESC> to cancel drag." ) );
763 else
764 m_frame->ShowInfoBarMsg( _( "Press <ESC> to cancel move." ) );
765
766 evt->SetPassEvent( false );
767 continue;
768 }
769
770 evt->SetPassEvent( false );
771 restore_state = true;
772 }
773
775
776 break;
777 }
778 //------------------------------------------------------------------------
779 // Handle TOOL_ACTION special cases
780 //
781 else if( evt->Action() == TA_UNDO_REDO_PRE )
782 {
783 unselect = true;
784 break;
785 }
786 else if( evt->IsAction( &ACTIONS::doDelete ) )
787 {
788 evt->SetPassEvent();
789 // Exit on a delete; there will no longer be anything to drag.
790 break;
791 }
792 else if( evt->IsAction( &ACTIONS::duplicate ) )
793 {
794 if( selection.Front()->IsNew() )
795 {
796 // This doesn't really make sense; we'll just end up dragging a stack of
797 // objects so we ignore the duplicate and just carry on.
798 continue;
799 }
800
801 // Move original back and exit. The duplicate will run in its own loop.
802 restore_state = true;
803 unselect = false;
804 chain_commands = true;
805 break;
806 }
807 else if( evt->IsAction( &EE_ACTIONS::rotateCW ) )
808 {
810 }
811 else if( evt->IsAction( &EE_ACTIONS::rotateCCW ) )
812 {
814 }
815 else if( evt->Action() == TA_CHOICE_MENU_CHOICE )
816 {
819 {
820 SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( selection.Front() );
821 int unit = *evt->GetCommandId() - ID_POPUP_SCH_SELECT_UNIT_CMP;
822
823 if( symbol )
824 {
825 m_frame->SelectUnit( symbol, unit );
827 }
828 }
829 }
830 else if( evt->IsAction( &EE_ACTIONS::highlightNet )
832 {
833 // These don't make any sense during a move. Eat them.
834 }
835 //------------------------------------------------------------------------
836 // Handle context menu
837 //
838 else if( evt->IsClick( BUT_RIGHT ) )
839 {
841 }
842 //------------------------------------------------------------------------
843 // Handle drop
844 //
845 else if( evt->IsMouseUp( BUT_LEFT )
846 || evt->IsClick( BUT_LEFT )
847 || evt->IsDblClick( BUT_LEFT ) )
848 {
849 break; // Finish
850 }
851 else
852 {
853 evt->SetPassEvent();
854 }
855
856 controls->SetAutoPan( m_moveInProgress );
857
858 } while( ( evt = Wait() ) ); //Should be assignment not equality test
859
860 // Create a selection of original selection, drag selected/changed items, and new
861 // bend lines for later before we clear them in the commit. We'll need these
862 // to check for new junctions needed, etc.
863 EE_SELECTION selectionCopy( selection );
864
865 for( SCH_LINE* line : m_newDragLines )
866 selectionCopy.Add( line );
867
868 for( SCH_LINE* line : m_changedDragLines )
869 selectionCopy.Add( line );
870
871 // Save whatever new bend lines and changed lines survived the drag
873
874 controls->ForceCursorPosition( false );
875 controls->ShowCursor( false );
876 controls->SetAutoPan( false );
877
878 if( !chain_commands )
879 m_moveOffset = { 0, 0 };
880
881 m_anchorPos.reset();
882
883 for( EDA_ITEM* item : selection )
884 item->ClearEditFlags();
885
886 if( restore_state )
887 {
890 }
891 else
892 {
893 // One last update after exiting loop (for slower stuff, such as updating SCREEN's RTree).
894 for( EDA_ITEM* item : selection )
895 updateItem( item, true );
896
898
899 // If we move items away from a junction, we _may_ want to add a junction there
900 // to denote the state.
901 for( const DANGLING_END_ITEM& it : internalPoints )
902 {
903 if( m_frame->GetScreen()->IsExplicitJunctionNeeded( it.GetPosition()) )
904 m_frame->AddJunction( m_frame->GetScreen(), it.GetPosition(), true, false );
905 }
906
907 m_toolMgr->RunAction( EE_ACTIONS::trimOverlappingWires, true, &selectionCopy );
908 m_toolMgr->RunAction( EE_ACTIONS::addNeededJunctions, true, &selectionCopy );
909
912
913 m_frame->OnModify();
914 }
915
916 if( unselect )
918 else
919 m_selectionTool->RebuildSelection(); // Schematic cleanup might have merged lines, etc.
920
921 m_dragAdditions.clear();
922 m_lineConnectionCache.clear();
923 m_moveInProgress = false;
924 m_frame->PopTool( aEvent );
925 return 0;
926}
static TOOL_ACTION duplicate
Definition: actions.h:72
static TOOL_ACTION doDelete
Definition: actions.h:73
static TOOL_ACTION cursorClick
Definition: actions.h:126
static TOOL_ACTION refreshPreview
Definition: actions.h:109
Helper class used to store the state of schematic items that can be connected to other schematic item...
Definition: sch_item.h:82
bool IsParallelTo(EDA_ANGLE aAngle) const
Definition: eda_angle.h:184
void ShowInfoBarMsg(const wxString &aMsg, bool aShowCloseButton=false)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an info icon on the left of...
WX_INFOBAR * GetInfoBar()
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
const KIID m_Uuid
Definition: eda_item.h:492
EDA_ITEM * GetParent() const
Definition: eda_item.h:99
void ClearEditFlags()
Definition: eda_item.h:160
EDA_ITEM_FLAGS GetFlags() const
Definition: eda_item.h:144
bool IsNew() const
Definition: eda_item.h:103
static TOOL_ACTION highlightNet
Definition: ee_actions.h:252
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
static TOOL_ACTION moveActivate
Definition: ee_actions.h:122
static TOOL_ACTION rotateCCW
Definition: ee_actions.h:127
static TOOL_ACTION restartMove
Definition: ee_actions.h:222
static TOOL_ACTION rotateCW
Definition: ee_actions.h:126
static TOOL_ACTION selectOnPCB
Definition: ee_actions.h:223
void RebuildSelection()
Rebuild the selection from the EDA_ITEMs' selection flags.
EE_SELECTION & GetSelection()
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:210
An interface for classes handling user events controlling the view behavior such as zooming,...
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void RollbackSchematicFromUndo()
Perform an undo of the last edit WITHOUT logging a corresponding redo.
void SelectUnit(SCH_SYMBOL *aSymbol, int aUnit)
Definition: picksymbol.cpp:236
SCH_JUNCTION * AddJunction(SCH_SCREEN *aScreen, const VECTOR2I &aPos, bool aAppendToUndo, bool aFinal=true)
void SetStoredPos(const VECTOR2I &aPos)
Definition: sch_item.h:210
virtual bool IsConnectable() const
Definition: sch_item.h:340
virtual bool IsMovableFromAnchorPoint() const
Definition: sch_item.h:207
virtual std::vector< VECTOR2I > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
Definition: sch_item.h:355
void StoreAngle()
Saves the current line angle.
Definition: sch_line.h:114
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
Definition: sch_line.cpp:665
void GetSelectedPoints(std::vector< VECTOR2I > &aPoints) const
Definition: sch_line.cpp:684
EDA_ANGLE Angle() const
Gets the angle between the start and end lines.
Definition: sch_line.h:105
void MoveEnd(const VECTOR2I &aMoveVector)
Definition: sch_line.cpp:155
void MoveStart(const VECTOR2I &aMoveVector)
Definition: sch_line.cpp:145
double GetLength() const
Definition: sch_line.cpp:208
void SetEndPoint(const VECTOR2I &aPosition)
Definition: sch_line.h:138
VECTOR2I m_cursor
void commitDragLines()
Clears the new drag lines and removes them from the screen.
OPT_VECTOR2I m_anchorPos
std::vector< KIID > m_dragAdditions
Cache of the line's original connections before dragging started.
Definition: sch_move_tool.h:89
void getConnectedItems(SCH_ITEM *aOriginalItem, const VECTOR2I &aPoint, EDA_ITEMS &aList)
void clearNewDragLines()
bool IsExplicitJunctionNeeded(const VECTOR2I &aPosition) const
Indicates that a junction dot is necessary at the given location, and does not yet exist.
Definition: sch_screen.cpp:437
Schematic symbol object.
Definition: sch_symbol.h:79
int AddItemToSel(const TOOL_EVENT &aEvent)
int RemoveItemsFromSel(const TOOL_EVENT &aEvent)
EDA_ITEM * Front() const
Definition: selection.h:200
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:107
virtual void PopTool(const TOOL_EVENT &aEvent)
Pops a tool from the stack.
bool GetMoveWarpsCursor() const
Indicate that a move operation should warp the mouse pointer to the origin of the move object.
Definition: tools_holder.h:153
virtual void PushTool(const TOOL_EVENT &aEvent)
NB: the definition of "tool" is different at the user level.
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
Generic, UI-independent tool event.
Definition: tool_event.h:156
bool DisableGridSnapping() const
Definition: tool_event.h:344
bool IsCancelInteractive() const
Indicate the event should restart/end an ongoing interactive tool's event loop (eg esc key,...
Definition: tool_event.cpp:212
TOOL_ACTIONS Action() const
These give a tool a method of informing the TOOL_MANAGER that a particular event should be passed on ...
Definition: tool_event.h:233
bool IsActivate() const
Definition: tool_event.h:318
bool IsClick(int aButtonMask=BUT_ANY) const
Definition: tool_event.cpp:200
bool IsDrag(int aButtonMask=BUT_ANY) const
Definition: tool_event.h:288
int Modifier(int aMask=MD_MODIFIER_MASK) const
Definition: tool_event.h:339
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:88
bool IsDblClick(int aButtonMask=BUT_ANY) const
Definition: tool_event.cpp:206
std::optional< int > GetCommandId() const
Definition: tool_event.h:465
void SetPassEvent(bool aPass=true)
Returns if it this event has a valid position (true for mouse events and context-menu or hotkey-based...
Definition: tool_event.h:239
bool IsMouseUp(int aButtonMask=BUT_ANY) const
Definition: tool_event.h:298
bool IsMotion() const
Definition: tool_event.h:303
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Suspend execution of the tool until an event specified in aEventList arrives.
void Activate()
Run the tool.
void ShowContextMenu(SELECTION &aSelection)
Helper function to set and immediately show a CONDITIONAL_MENU in concert with the given SELECTION.
Definition: tool_menu.cpp:57
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: infobar.cpp:175
#define _(s)
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_CHANGED
Item was edited, and modified.
@ LAYER_ANY
@ LAYER_CONNECTABLE
@ LAYER_GRAPHICS
@ ID_POPUP_SCH_SELECT_UNIT_CMP
Definition: eeschema_id.h:94
@ ID_POPUP_SCH_SELECT_UNIT_SYM_MAX
Definition: eeschema_id.h:98
@ LINE_MODE_FREE
@ UNDEFINED_LAYER
Definition: layer_ids.h:60
bool signbit(T v)
Integral version of std::signbit that works all compilers.
Definition: kicad_algo.h:197
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:401
#define QUIET_MODE
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111
@ TA_CHOICE_MENU_CHOICE
Definition: tool_event.h:93
@ TA_UNDO_REDO_PRE
Definition: tool_event.h:101
@ MD_SHIFT
Definition: tool_event.h:138
@ BUT_LEFT
Definition: tool_event.h:127
@ BUT_RIGHT
Definition: tool_event.h:128
@ SCH_PIN_T
Definition: typeinfo.h:158
int sign(T val)
Definition: util.h:111

References _, std::abs(), TOOL_EVENT::Action(), TOOL_INTERACTIVE::Activate(), SELECTION::Add(), SELECTION_TOOL::AddItemToSel(), SCH_EDIT_FRAME::AddJunction(), EE_ACTIONS::addNeededJunctions, SCH_BASE_FRAME::AddToScreen(), SCH_LINE::Angle(), BUT_LEFT, BUT_RIGHT, CHANGED, clearNewDragLines(), EE_ACTIONS::clearSelection, commitDragLines(), copy, ACTIONS::cursorClick, delta, TOOL_EVENT::DisableGridSnapping(), WX_INFOBAR::Dismiss(), ACTIONS::doDelete, EE_ACTIONS::drag, EESCHEMA_SETTINGS::INPUT::drag_is_move, ACTIONS::duplicate, SELECTION::Empty(), ENDPOINT, SELECTION::Front(), SCH_BASE_FRAME::GetCanvas(), TOOL_EVENT::GetCommandId(), getConnectedDragItems(), getConnectedItems(), SCH_ITEM::GetConnectionPoints(), SCH_LINE::GetConnectionPoints(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), SCH_LINE::GetEndPoint(), EDA_BASE_FRAME::GetInfoBar(), SELECTION::GetItemsSortedByTypeAndXY(), SCH_LINE::GetLength(), TOOLS_HOLDER::GetMoveWarpsCursor(), EDA_ITEM::GetPosition(), SELECTION::GetReferencePoint(), SCH_EDIT_FRAME::GetScreen(), SCH_LINE::GetSelectedPoints(), EE_SELECTION_TOOL::GetSelection(), SCH_LINE::GetStartPoint(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), grid, EDA_ITEM::HasFlag(), SELECTION::HasReferencePoint(), EE_ACTIONS::highlightNet, ID_POPUP_SCH_SELECT_UNIT_CMP, ID_POPUP_SCH_SELECT_UNIT_SYM_MAX, IS_CHANGED, IS_NEW, IS_PASTED, TOOL_EVENT::IsAction(), TOOL_EVENT::IsActivate(), TOOL_EVENT::IsCancelInteractive(), TOOL_EVENT::IsClick(), SCH_ITEM::IsConnectable(), TOOL_EVENT::IsDblClick(), TOOL_EVENT::IsDrag(), SCH_SCREEN::IsExplicitJunctionNeeded(), SELECTION::IsHover(), TOOL_EVENT::IsMotion(), TOOL_EVENT::IsMouseUp(), SCH_ITEM::IsMovableFromAnchorPoint(), EDA_ITEM::IsNew(), EDA_ANGLE::IsParallelTo(), EDA_ITEM::IsSelected(), SCH_SCREEN::Items(), LAYER_ANY, LAYER_CONNECTABLE, LAYER_GRAPHICS, EESCHEMA_SETTINGS::DRAWING::line_mode, LINE_MODE_FREE, LOCAL_CLEANUP, m_anchorPos, m_changedDragLines, m_cursor, m_dragAdditions, EESCHEMA_SETTINGS::m_Drawing, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EESCHEMA_SETTINGS::m_Input, m_isDrag, m_lineConnectionCache, TOOL_INTERACTIVE::m_menu, m_moveInProgress, m_moveOffset, m_newDragLines, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, m_specialCaseLabels, TOOL_BASE::m_toolMgr, MD_SHIFT, TOOL_EVENT::Modifier(), EE_COLLECTOR::MovableItems, EE_ACTIONS::move, EE_ACTIONS::moveActivate, SCH_LINE::MoveEnd(), moveItem(), SCH_LINE::MoveStart(), MOVING, NEWITEM, SCH_EDIT_FRAME::OnModify(), Pgm(), TOOLS_HOLDER::PopTool(), TOOL_MANAGER::PostEvent(), TOOLS_HOLDER::PushTool(), QUIET_MODE, EE_SELECTION_TOOL::RebuildSelection(), SCH_EDIT_FRAME::RecalculateConnections(), ACTIONS::refreshPreview, SCH_BASE_FRAME::RemoveFromScreen(), SELECTION_TOOL::RemoveItemsFromSel(), EE_SELECTION_TOOL::RequestSelection(), EE_ACTIONS::restartMove, SCH_EDIT_FRAME::RollbackSchematicFromUndo(), EE_ACTIONS::rotateCCW, EE_ACTIONS::rotateCW, TOOL_MANAGER::RunAction(), EE_TOOL_BASE< SCH_EDIT_FRAME >::saveCopyInUndoList(), SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_JUNCTION_T, SCH_LABEL_T, SCH_LINE_T, SCH_PIN_T, SELECTED_BY_DRAG, EVENTS::SelectedItemsModified, EVENTS::SelectedItemsMoved, EE_ACTIONS::selectOnPCB, SCH_EDIT_FRAME::SelectUnit(), SCH_ITEM::SetConnectivityDirty(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), SCH_LINE::SetEndPoint(), EDA_ITEM::SetFlags(), SCH_LINE::SetLastResolvedState(), TOOL_EVENT::SetPassEvent(), SELECTION::SetReferencePoint(), SCH_ITEM::SetStoredPos(), TOOL_MENU::ShowContextMenu(), EDA_BASE_FRAME::ShowInfoBarMsg(), sign(), alg::signbit(), STARTPOINT, SCH_LINE::StoreAngle(), TA_CHOICE_MENU_CHOICE, TA_UNDO_REDO_PRE, SCH_EDIT_FRAME::TestDanglingEnds(), EE_ACTIONS::trimOverlappingWires, EDA_ITEM::Type(), UNDEFINED_LAYER, EE_TOOL_BASE< SCH_EDIT_FRAME >::updateItem(), TOOL_INTERACTIVE::Wait(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by setTransitions().

◆ moveItem()

void SCH_MOVE_TOOL::moveItem ( EDA_ITEM aItem,
const VECTOR2I aDelta 
)
private

Find additional items for a drag operation.

Connected items with no wire are included (as there is no wire to adjust for the drag). Connected wires are included with any un-connected ends flagged (STARTPOINT or ENDPOINT).

Definition at line 1351 of file sch_move_tool.cpp.

1352{
1353 switch( aItem->Type() )
1354 {
1355 case SCH_LINE_T:
1356 {
1357 SCH_LINE* line = static_cast<SCH_LINE*>( aItem );
1358
1359 if( aItem->HasFlag( STARTPOINT ) )
1360 line->MoveStart( aDelta );
1361
1362 if( aItem->HasFlag( ENDPOINT ) )
1363 line->MoveEnd( aDelta );
1364
1365 break;
1366 }
1367
1368 case SCH_PIN_T:
1369 case SCH_FIELD_T:
1370 {
1371 SCH_ITEM* parent = (SCH_ITEM*) aItem->GetParent();
1372 VECTOR2I delta( aDelta );
1373
1374 if( parent && parent->Type() == SCH_SYMBOL_T )
1375 {
1376 SCH_SYMBOL* symbol = (SCH_SYMBOL*) aItem->GetParent();
1377 TRANSFORM transform = symbol->GetTransform().InverseTransform();
1378
1379 delta = transform.TransformCoordinate( delta );
1380 }
1381
1382 static_cast<SCH_ITEM*>( aItem )->Move( delta );
1383
1384 // If we're moving a field with respect to its parent then it's no longer auto-placed
1385 if( aItem->Type() == SCH_FIELD_T && parent && !parent->IsSelected() )
1386 parent->ClearFieldsAutoplaced();
1387
1388 break;
1389 }
1390
1391 case SCH_SHEET_PIN_T:
1392 {
1393 SCH_SHEET_PIN* pin = (SCH_SHEET_PIN*) aItem;
1394
1395 pin->SetStoredPos( pin->GetStoredPos() + aDelta );
1396 pin->ConstrainOnEdge( pin->GetStoredPos() );
1397 break;
1398 }
1399
1400 case SCH_LABEL_T:
1402 case SCH_GLOBAL_LABEL_T:
1403 case SCH_HIER_LABEL_T:
1404 {
1405 SCH_LABEL_BASE* label = static_cast<SCH_LABEL_BASE*>( aItem );
1406
1407 if( m_specialCaseLabels.count( label ) )
1408 {
1410 SEG currentLine( info.attachedLine->GetStartPoint(), info.attachedLine->GetEndPoint() );
1411 label->SetPosition( currentLine.NearestPoint( info.originalLabelPos ) );
1412 }
1413 else
1414 {
1415 label->Move( aDelta );
1416 }
1417
1418 break;
1419 }
1420
1421 default:
1422 static_cast<SCH_ITEM*>( aItem )->Move( aDelta );
1423 break;
1424 }
1425
1426 getView()->Hide( aItem, false );
1427 aItem->SetFlags( IS_MOVING );
1428}
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hide the item in the view (e.g.
Definition: view.cpp:1533
void ClearFieldsAutoplaced()
Definition: sch_item.h:418
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_label.h:110
TRANSFORM & GetTransform()
Definition: sch_symbol.h:275
void SetPosition(const VECTOR2I &aPosition) override
Definition: sch_text.h:206
Definition: seg.h:42
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:47
TRANSFORM InverseTransform() const
Calculate the Inverse mirror/rotation transform.
Definition: transform.cpp:56
VECTOR2I TransformCoordinate(const VECTOR2I &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
@ SCH_SHEET_PIN_T
Definition: typeinfo.h:156

References SCH_ITEM::ClearFieldsAutoplaced(), delta, ENDPOINT, EDA_ITEM::GetParent(), SCH_SYMBOL::GetTransform(), TOOL_BASE::getView(), EDA_ITEM::HasFlag(), KIGFX::VIEW::Hide(), info, TRANSFORM::InverseTransform(), IS_MOVING, EDA_ITEM::IsSelected(), m_specialCaseLabels, SCH_LABEL_BASE::Move(), SCH_LINE::MoveEnd(), SCH_LINE::MoveStart(), SEG::NearestPoint(), pin, SCH_DIRECTIVE_LABEL_T, SCH_FIELD_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_LABEL_T, SCH_LINE_T, SCH_PIN_T, SCH_SHEET_PIN_T, SCH_SYMBOL_T, EDA_ITEM::SetFlags(), SCH_TEXT::SetPosition(), STARTPOINT, TRANSFORM::TransformCoordinate(), and EDA_ITEM::Type().

Referenced by AlignElements(), and Main().

◆ Reset()

void EE_TOOL_BASE< SCH_EDIT_FRAME >::Reset ( RESET_REASON  aReason)
inlineoverridevirtualinherited

Bring the tool to a known, initial state.

If the tool claimed anything from the model or the view, it must release it when its reset.

Parameters
aReasoncontains information about the reason of tool reset.

Implements TOOL_BASE.

Definition at line 86 of file ee_tool_base.h.

87 {
88 if( aReason == MODEL_RELOAD )
89 {
90 // Init variables used by every drawing tool
91 m_frame = getEditFrame<T>();
92 m_isSymbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) != nullptr;
93 }
94
95 m_view = static_cast<KIGFX::SCH_VIEW*>( getView() );
96 }
The symbol library editor main window.

◆ resetTransitions()

void TOOL_INTERACTIVE::resetTransitions ( )
privateinherited

Clear the current transition map and restores the default one created by setTransitions().

Definition at line 63 of file tool_interactive.cpp.

64{
67}
virtual void setTransitions()=0
This method is meant to be overridden in order to specify handlers for events.
void ClearTransitions(TOOL_BASE *aTool)
Clear the state transition map for a tool.

References TOOL_MANAGER::ClearTransitions(), TOOL_BASE::m_toolMgr, and TOOL_INTERACTIVE::setTransitions().

◆ RunMainStack()

void TOOL_INTERACTIVE::RunMainStack ( std::function< void()>  aFunc)
inherited

Call a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 87 of file tool_interactive.cpp.

88{
89 m_toolMgr->RunMainStack( this, std::move( aFunc ) );
90}
void RunMainStack(TOOL_BASE *aTool, std::function< void()> aFunc)

References TOOL_BASE::m_toolMgr, and TOOL_MANAGER::RunMainStack().

Referenced by DRAWING_TOOL::PlaceText().

◆ saveCopyInUndoList()

void EE_TOOL_BASE< SCH_EDIT_FRAME >::saveCopyInUndoList ( EDA_ITEM aItem,
UNDO_REDO  aType,
bool  aAppend = false,
bool  aDirtyConnectivity = true 
)
inlineprotectedinherited

Definition at line 134 of file ee_tool_base.h.

136 {
137 wxASSERT( aItem );
138
139 KICAD_T itemType = aItem->Type();
140 bool selected = aItem->IsSelected();
141
142 // IS_SELECTED flag should not be set on undo items which were added for
143 // a drag operation.
144 if( selected && aItem->HasFlag( SELECTED_BY_DRAG ) )
145 aItem->ClearSelected();
146
147 if( m_isSymbolEditor )
148 {
149 SYMBOL_EDIT_FRAME* editFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
150 wxCHECK_RET( editFrame, wxT( "editFrame is null" ) );
151
152 editFrame->SaveCopyInUndoList( static_cast<LIB_ITEM*>( aItem ), aType, aAppend );
153 }
154 else
155 {
156 SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
157 wxASSERT( editFrame );
158
159 if( editFrame )
160 {
161 if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
162 {
163 editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
164 static_cast<SCH_ITEM*>( aItem->GetParent() ),
165 UNDO_REDO::CHANGED, aAppend,
166 aDirtyConnectivity );
167 }
168 else
169 {
170 editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
171 static_cast<SCH_ITEM*>( aItem ), aType,
172 aAppend, aDirtyConnectivity );
173 }
174 }
175 }
176
177 if( selected && aItem->HasFlag( SELECTED_BY_DRAG ) )
178 aItem->SetSelected();
179 }
void ClearSelected()
Definition: eda_item.h:121
void SetSelected()
Definition: eda_item.h:118
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
Schematic editor (Eeschema) main window.
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, bool aDirtyConnectivity=true)
Create a copy of the current schematic item, and put it in the undo list.
void SaveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aUndoType=UNDO_REDO::LIBEDIT, bool aAppend=false)
Create a copy of the current symbol, and save it in the undo list.

◆ SetContextMenu()

void TOOL_INTERACTIVE::SetContextMenu ( ACTION_MENU aMenu,
CONTEXT_MENU_TRIGGER  aTrigger = CMENU_BUTTON 
)
inherited

Assign a context menu and tells when it should be activated.

Parameters
aMenuis the menu to be assigned.
aTriggerdetermines conditions upon which the context menu is activated.

Definition at line 76 of file tool_interactive.cpp.

77{
78 if( aMenu )
79 aMenu->SetTool( this );
80 else
81 aTrigger = CMENU_OFF;
82
83 m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger );
84}
void SetTool(TOOL_INTERACTIVE *aTool)
Set a tool that is the creator of the menu.
void ScheduleContextMenu(TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Set behavior of the tool's context popup menu.
@ CMENU_OFF
Definition: tool_event.h:149

References CMENU_OFF, TOOL_BASE::m_toolMgr, TOOL_MANAGER::ScheduleContextMenu(), and ACTION_MENU::SetTool().

Referenced by SELECTION_TOOL::doSelectionMenu(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ setTransitions()

void SCH_MOVE_TOOL::setTransitions ( )
overrideprivatevirtual

Saves the new drag lines to the undo list.

Implements TOOL_INTERACTIVE.

Definition at line 1597 of file sch_move_tool.cpp.

1598{
1600 Go( &SCH_MOVE_TOOL::Main, EE_ACTIONS::move.MakeEvent() );
1601 Go( &SCH_MOVE_TOOL::Main, EE_ACTIONS::drag.MakeEvent() );
1603}
int Main(const TOOL_EVENT &aEvent)
Run an interactive move of the selected items, or the item under the cursor.
int AlignElements(const TOOL_EVENT &aEvent)
Align selected elements to the grid.
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).

References AlignElements(), EE_ACTIONS::alignToGrid, EE_ACTIONS::drag, TOOL_INTERACTIVE::Go(), Main(), EE_ACTIONS::move, and EE_ACTIONS::moveActivate.

◆ updateItem()

void EE_TOOL_BASE< SCH_EDIT_FRAME >::updateItem ( EDA_ITEM aItem,
bool  aUpdateRTree 
) const
inlineprotectedinherited

Similar to getView()->Update(), but handles items that are redrawn by their parents and updating the SCH_SCREEN's RTree.

Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.

Definition at line 103 of file ee_tool_base.h.

◆ Wait()

TOOL_EVENT * TOOL_INTERACTIVE::Wait ( const TOOL_EVENT_LIST aEventList = TOOL_EVENTTC_ANYTA_ANY ))
inherited

Suspend execution of the tool until an event specified in aEventList arrives.

No parameters means waiting for any event.

Definition at line 57 of file tool_interactive.cpp.

58{
59 return m_toolMgr->ScheduleWait( this, aEventList );
60}
TOOL_EVENT * ScheduleWait(TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions)
Pause execution of a given tool until one or more events matching aConditions arrives.

References TOOL_BASE::m_toolMgr, and TOOL_MANAGER::ScheduleWait().

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SELECTION_TOOL::doSelectionMenu(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDA_3D_CONTROLLER::Main(), CVPCB_CONTROL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), EE_POINT_EDITOR::Main(), EE_SELECTION_TOOL::Main(), Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ZOOM_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_POINT_EDITOR::Main(), PL_SELECTION_TOOL::Main(), PCB_PICKER_TOOL::Main(), PCB_SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), PCB_POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

Member Data Documentation

◆ m_anchorPos

OPT_VECTOR2I SCH_MOVE_TOOL::m_anchorPos
private

Definition at line 104 of file sch_move_tool.h.

Referenced by Main().

◆ m_changedDragLines

std::unordered_set<SCH_LINE*> SCH_MOVE_TOOL::m_changedDragLines
private

Used for chaining commands.

Definition at line 95 of file sch_move_tool.h.

Referenced by commitDragLines(), and Main().

◆ m_cursor

VECTOR2I SCH_MOVE_TOOL::m_cursor
private

Definition at line 102 of file sch_move_tool.h.

Referenced by Main().

◆ m_dragAdditions

std::vector<KIID> SCH_MOVE_TOOL::m_dragAdditions
private

Cache of the line's original connections before dragging started.

Definition at line 89 of file sch_move_tool.h.

Referenced by Main().

◆ m_frame

SCH_EDIT_FRAME * EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame
protectedinherited

Definition at line 182 of file ee_tool_base.h.

◆ m_isDrag

bool SCH_MOVE_TOOL::m_isDrag
private

Items (such as wires) which were added to the selection for a drag.

Definition at line 86 of file sch_move_tool.h.

Referenced by Main().

◆ m_isSymbolEditor

bool EE_TOOL_BASE< SCH_EDIT_FRAME >::m_isSymbolEditor
protectedinherited

Definition at line 185 of file ee_tool_base.h.

◆ m_lineConnectionCache

std::map<SCH_LINE*, EDA_ITEMS> SCH_MOVE_TOOL::m_lineConnectionCache
private

Lines added at bend points dynamically during the move.

Definition at line 91 of file sch_move_tool.h.

Referenced by getConnectedDragItems(), and Main().

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

The functions below are not yet implemented - their interface may change.

Definition at line 125 of file tool_interactive.h.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), EDA_3D_CONTROLLER::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< T >::Init(), SCH_DRAWING_TOOLS::Init(), SCH_EDIT_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), SYMBOL_EDITOR_CONTROL::Init(), SYMBOL_EDITOR_DRAWING_TOOLS::Init(), GERBVIEW_SELECTION_TOOL::Init(), PICKER_TOOL::Init(), ZOOM_TOOL::Init(), PL_DRAWING_TOOLS::Init(), PL_EDIT_TOOL::Init(), PL_SELECTION_TOOL::Init(), LENGTH_TUNER_TOOL::Init(), ROUTER_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), DRAWING_TOOL::Init(), FOOTPRINT_EDITOR_CONTROL::Init(), PAD_TOOL::Init(), PCB_SELECTION_TOOL::Init(), PCB_TOOL_BASE::Init(), PCB_VIEWER_TOOLS::Init(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDA_3D_CONTROLLER::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ZOOM_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_SELECTION_TOOL::Main(), PCB_PICKER_TOOL::Main(), PCB_SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace().

◆ m_moveInProgress

bool SCH_MOVE_TOOL::m_moveInProgress
private

< Flag determining if anything is being dragged right now

Definition at line 85 of file sch_move_tool.h.

Referenced by Main().

◆ m_moveOffset

VECTOR2I SCH_MOVE_TOOL::m_moveOffset
private

Last cursor position (needed for getModificationPoint() to avoid changes of edit reference point).

Definition at line 98 of file sch_move_tool.h.

Referenced by Main().

◆ m_newDragLines

std::unordered_set<SCH_LINE*> SCH_MOVE_TOOL::m_newDragLines
private

Lines changed by drag algorithm that weren't selected.

Definition at line 93 of file sch_move_tool.h.

Referenced by clearNewDragLines(), commitDragLines(), and Main().

◆ m_selectionTool

EE_SELECTION_TOOL* EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool
protectedinherited

Definition at line 184 of file ee_tool_base.h.

◆ m_specialCaseLabels

std::map<SCH_LABEL_BASE*, SPECIAL_CASE_LABEL_INFO> SCH_MOVE_TOOL::m_specialCaseLabels
private

Definition at line 108 of file sch_move_tool.h.

Referenced by getConnectedDragItems(), Main(), and moveItem().

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Name of the tool.

Names are expected to obey the format application.ToolName (eg. pcbnew.InteractiveSelection).

Definition at line 209 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), TOOL_BASE::GetId(), and TOOL_BASE::IsToolActive().

◆ m_toolMgr

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 214 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), SELECTION_TOOL::AddItemsToSel(), SELECTION_TOOL::AddItemToSel(), AlignElements(), SCH_EDITOR_CONTROL::AssignNetclass(), BOARD_EDITOR_CONTROL::AssignNetclass(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), EE_SELECTION_TOOL::autostartEvent(), SCH_EDIT_TOOL::BreakWire(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDITOR_CONTROL::ChangeLineMode(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), GERBVIEW_CONTROL::ClearAllLayers(), SCH_EDITOR_CONTROL::ClearHighlight(), BOARD_INSPECTION_TOOL::ClearHighlight(), GERBVIEW_SELECTION_TOOL::clearSelection(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), PCB_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), PL_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), MICROWAVE_TOOL::createInductorBetween(), EE_INSPECTION_TOOL::CrossProbe(), DRC_TOOL::CrossProbe(), COMMON_TOOLS::CursorControl(), SCH_EDITOR_CONTROL::Cut(), SCH_EDIT_TOOL::DeleteItemCursor(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), SCH_EDITOR_CONTROL::doCopy(), BOARD_EDITOR_CONTROL::doCrossProbePcbToSch(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), SCH_EDIT_TOOL::DoDelete(), SYMBOL_EDITOR_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), BOARD_INSPECTION_TOOL::doHideRatsnestNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PCB_SELECTION_TOOL::doSyncSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::Drag(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawRectangle(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), PAD_TOOL::EditPad(), SYMBOL_EDITOR_EDIT_TOOL::editShapeProperties(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), GROUP_TOOL::EnterGroup(), SCH_NAVIGATE_TOOL::EnterSheet(), PAD_TOOL::EnumeratePads(), EE_INSPECTION_TOOL::ExcludeMarker(), PCB_SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), PCB_SELECTION_TOOL::filterSelection(), PCB_SELECTION_TOOL::FindItem(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), EDIT_TOOL::GetAndPlace(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getToolHolderInt(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), PCB_SELECTION_TOOL::grabUnconnected(), COMMON_TOOLS::GridNext(), COMMON_TOOLS::GridPreset(), COMMON_TOOLS::GridPrev(), PCB_CONTROL::GridSetOrigin(), GROUP_TOOL::Group(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::HighlightItem(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::HighlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PL_EDIT_TOOL::ImportDrawingSheetContent(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), EE_TOOL_BASE< T >::Init(), SCH_EDIT_TOOL::Init(), SYMBOL_EDITOR_CONTROL::Init(), SYMBOL_EDITOR_EDIT_TOOL::Init(), PL_DRAWING_TOOLS::Init(), PL_EDIT_TOOL::Init(), PL_POINT_EDITOR::Init(), ROUTER_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), BOARD_INSPECTION_TOOL::Init(), BOARD_REANNOTATE_TOOL::Init(), CONVERT_TOOL::Init(), DRAWING_TOOL::Init(), EDIT_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), GROUP_TOOL::Init(), PAD_TOOL::Init(), PCB_POINT_EDITOR::Init(), PCB_SELECTION_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), POSITION_RELATIVE_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isRouterActive(), TOOL_BASE::IsToolActive(), GROUP_TOOL::LeaveGroup(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), EDA_3D_CONTROLLER::Main(), CVPCB_CONTROL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_SELECTION_TOOL::Main(), PCB_PICKER_TOOL::Main(), PCB_SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), SCH_EDIT_TOOL::Mirror(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), BOARD_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), EDIT_TOOL::MoveIndividually(), SCH_EDITOR_CONTROL::NextLineMode(), SYMBOL_EDITOR_CONTROL::OnDeMorgan(), SELECTION_TOOL::onDisambiguationExpire(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_EDIT_TOOL::PinTable(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), GERBVIEW_CONTROL::Print(), PCB_CONTROL::Print(), SCH_EDIT_TOOL::Properties(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EE_SELECTION_TOOL::RebuildSelection(), PAD_TOOL::RecombinePad(), SCH_EDITOR_CONTROL::Redo(), SYMBOL_EDITOR_EDIT_TOOL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), PCB_POINT_EDITOR::removeCorner(), GROUP_TOOL::RemoveFromGroup(), SELECTION_TOOL::RemoveItemFromSel(), SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem(), PCB_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), EDA_3D_CONTROLLER::Reset(), COMMON_TOOLS::Reset(), PNS::TOOL_BASE::Reset(), PAD_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), SCH_EDITOR_CONTROL::Revert(), SCH_EDIT_TOOL::Rotate(), SYMBOL_EDITOR_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), ROUTER_TOOL::RouteSelected(), TOOL_INTERACTIVE::RunMainStack(), DRC_TOOL::RunTests(), EE_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::SelectConnection(), PCB_TOOL_BASE::selection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectNet(), GERBVIEW_SELECTION_TOOL::selectPoint(), PL_SELECTION_TOOL::SelectPoint(), PCB_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), PCB_SELECTION_TOOL::selectSameSheet(), PCB_SELECTION_TOOL::selectSheetContents(), DRAWING_TOOL::SetAnchor(), TOOL_INTERACTIVE::SetContextMenu(), EDA_3D_CONTROLLER::SetMaterial(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_EDIT_TOOL::Swap(), EDIT_TOOL::Swap(), EE_SELECTION_TOOL::SyncSelection(), COMMON_TOOLS::ToggleCursor(), COMMON_TOOLS::ToggleCursorStyle(), EDA_3D_CONTROLLER::ToggleVisibility(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_EDITOR_CONTROL::Undo(), SYMBOL_EDITOR_EDIT_TOOL::Undo(), GROUP_TOOL::Ungroup(), PCB_SELECTION_TOOL::unrouteSelected(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), PNS::TOOL_BASE::updateEndItem(), BOARD_INSPECTION_TOOL::UpdateLocalRatsnest(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCB_CONTROL::UpdateMessagePanel(), EDIT_TOOL::updateModificationPoint(), EE_POINT_EDITOR::updateParentItem(), PNS::TOOL_BASE::updateStartItem(), BOARD_EDITOR_CONTROL::ViaSizeDec(), BOARD_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), BOARD_EDITOR_CONTROL::ZoneDuplicate(), and BOARD_EDITOR_CONTROL::ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Definition at line 213 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Unique identifier for the tool, assigned by a TOOL_MANAGER instance.

Definition at line 206 of file tool_base.h.

Referenced by TOOL_BASE::GetType(), and BOARD_COMMIT::Push().

◆ m_view

KIGFX::SCH_VIEW* EE_TOOL_BASE< SCH_EDIT_FRAME >::m_view
protectedinherited

Definition at line 183 of file ee_tool_base.h.


The documentation for this class was generated from the following files: