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)
 
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 getConnectedDragItems (SCH_ITEM *aOriginalItem, wxPoint aPoint, EDA_ITEMS &aList)
 Set up handlers for various events. More...
 
void setTransitions () override
 This method is meant to be overridden in order to specify handlers for events. More...
 

Private Attributes

bool m_moveInProgress
 < Flag determining if anything is being dragged right now More...
 
bool m_isDragOperation
 Items (such as wires) which were added to the selection for a drag. More...
 
EDA_ITEMS m_dragAdditions
 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
 
boost::optional< VECTOR2Im_anchorPos
 
std::map< SCH_TEXT *, 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 78 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ SCH_MOVE_TOOL()

SCH_MOVE_TOOL::SCH_MOVE_TOOL ( )

Definition at line 47 of file sch_move_tool.cpp.

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

◆ ~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:215
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:210
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(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_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(), 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(), BOARD_INSPECTION_TOOL::HighlightNetTool(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), PL_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), Main(), PCB_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), LIB_TREE::onContextMenu(), PCB_POINT_EDITOR::OnSelectionChange(), GROUP_TOOL::PickNewMember(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_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 751 of file sch_move_tool.cpp.

752 {
753  EE_GRID_HELPER grid( m_toolMgr);
755  bool append_undo = false;
756 
757  for( SCH_ITEM* it : m_frame->GetScreen()->Items() )
758  {
759  if( !it->IsSelected() )
760  it->ClearFlags( STARTPOINT | ENDPOINT );
761 
762  if( !selection.IsHover() && it->IsSelected() )
763  it->SetFlags( STARTPOINT | ENDPOINT );
764 
765  it->SetStoredPos( it->GetPosition() );
766 
767  if( it->Type() == SCH_SHEET_T )
768  {
769  for( SCH_SHEET_PIN* pin : static_cast<SCH_SHEET*>( it )->GetPins() )
770  pin->SetStoredPos( pin->GetPosition() );
771  }
772  }
773 
774  for( EDA_ITEM* item : selection )
775  {
776  if( item->Type() == SCH_LINE_T )
777  {
778  SCH_LINE* line = static_cast<SCH_LINE*>( item );
779  std::vector<int> flags{ STARTPOINT, ENDPOINT };
780  std::vector<wxPoint> pts{ line->GetStartPoint(), line->GetEndPoint() };
781 
782  for( int ii = 0; ii < 2; ++ii )
783  {
784  EDA_ITEMS drag_items{ item };
785  line->ClearFlags();
786  line->SetFlags( flags[ii] );
787  getConnectedDragItems( line, pts[ii], drag_items );
788  std::set<EDA_ITEM*> unique_items( drag_items.begin(), drag_items.end() );
789 
790  VECTOR2I gridpt = grid.AlignGrid( pts[ii] ) - pts[ii];
791 
792  if( gridpt != VECTOR2I( 0, 0 ) )
793  {
794  for( EDA_ITEM* dragItem : unique_items )
795  {
796  if( dragItem->GetParent() && dragItem->GetParent()->IsSelected() )
797  continue;
798 
799  saveCopyInUndoList( dragItem, UNDO_REDO::CHANGED, append_undo );
800  append_undo = true;
801 
802  moveItem( dragItem, gridpt );
803  updateItem( dragItem, true );
804  }
805  }
806  }
807  }
808  else if( item->Type() == SCH_FIELD_T )
809  {
810  VECTOR2I gridpt = grid.AlignGrid( item->GetPosition() ) - item->GetPosition();
811 
812  if( gridpt != VECTOR2I( 0, 0 ) )
813  {
814  saveCopyInUndoList( item, UNDO_REDO::CHANGED, append_undo );
815  append_undo = true;
816 
817  moveItem( item, gridpt );
818  updateItem( item, true );
819  }
820  }
821  else
822  {
823  std::vector<wxPoint> connections;
824  EDA_ITEMS drag_items{ item };
825  connections = static_cast<SCH_ITEM*>( item )->GetConnectionPoints();
826 
827  for( const wxPoint& point : connections )
828  getConnectedDragItems( static_cast<SCH_ITEM*>( item ), point, drag_items );
829 
830  std::map<VECTOR2I, int> shifts;
831  VECTOR2I most_common( 0, 0 );
832  int max_count = 0;
833 
834  for( const wxPoint& conn : connections )
835  {
836  VECTOR2I gridpt = grid.AlignGrid( conn ) - conn;
837 
838  shifts[gridpt]++;
839 
840  if( shifts[gridpt] > max_count )
841  {
842  most_common = gridpt;
843  max_count = shifts[most_common];
844  }
845  }
846 
847  if( most_common != VECTOR2I( 0, 0 ) )
848  {
849  for( EDA_ITEM* dragItem : drag_items )
850  {
851  if( dragItem->GetParent() && dragItem->GetParent()->IsSelected() )
852  continue;
853 
854  saveCopyInUndoList( dragItem, UNDO_REDO::CHANGED, append_undo );
855  append_undo = true;
856 
857  moveItem( dragItem, most_common );
858  updateItem( dragItem, true );
859  }
860  }
861  }
862  }
863 
865  m_toolMgr->RunAction( EE_ACTIONS::addNeededJunctions, true, &selection );
866 
869 
870  m_frame->OnModify();
871  return 0;
872 }
bool SchematicCleanUp(SCH_SCREEN *aScreen=nullptr)
Performs routine schematic cleaning including breaking wire and buses and deleting identical objects ...
bool IsHover() const
Definition: selection.h:72
void getConnectedDragItems(SCH_ITEM *aOriginalItem, wxPoint aPoint, EDA_ITEMS &aList)
Set up handlers for various events.
wxPoint GetStartPoint() const
Definition: sch_line.h:94
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Return either an existing selection (filtered), or the selection at the current cursor if the existin...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:202
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
Definition: ee_tool_base.h:133
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
static const TOOL_EVENT SelectedItemsMoved
Used to inform tools that the selection should temporarily be non-editable.
Definition: actions.h:219
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:85
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Definition: eda_item.h:556
static TOOL_ACTION addNeededJunctions
Definition: ee_actions.h:73
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:102
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: eda_item.h:111
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
void moveItem(EDA_ITEM *aItem, const VECTOR2I &aDelta)
Find additional items for a drag operation.
EE_RTREE & Items()
Definition: sch_screen.h:159
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:149
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:203
#define ENDPOINT
ends. (Used to support dragging.)
Definition: eda_item.h:112
static const KICAD_T movableItems[]
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
Definition: tool_manager.h:267
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:194
wxPoint GetEndPoint() const
Definition: sch_line.h:97

References EE_ACTIONS::addNeededJunctions, GRID_HELPER::AlignGrid(), CHANGED, EDA_ITEM::ClearFlags(), ENDPOINT, getConnectedDragItems(), SCH_LINE::GetEndPoint(), SCH_EDIT_FRAME::GetScreen(), SCH_LINE::GetStartPoint(), SELECTION::IsHover(), SCH_SCREEN::Items(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, movableItems, moveItem(), SCH_EDIT_FRAME::OnModify(), TOOL_MANAGER::PostEvent(), EE_SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), EE_TOOL_BASE< SCH_EDIT_FRAME >::saveCopyInUndoList(), SCH_FIELD_T, SCH_LINE_T, SCH_SHEET_T, SCH_EDIT_FRAME::SchematicCleanUp(), EVENTS::SelectedItemsMoved, EDA_ITEM::SetFlags(), STARTPOINT, SCH_EDIT_FRAME::TestDanglingEnds(), and EE_TOOL_BASE< SCH_EDIT_FRAME >::updateItem().

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 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ getConnectedDragItems()

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

Set up handlers for various events.

Definition at line 512 of file sch_move_tool.cpp.

514 {
515  EE_RTREE& items = m_frame->GetScreen()->Items();
516  EE_RTREE::EE_TYPE itemsOverlapping = items.Overlapping( aOriginalItem->GetBoundingBox() );
517  bool ptHasUnselectedJunction = false;
518 
519  for( SCH_ITEM* item : itemsOverlapping )
520  {
521  if( item->Type() == SCH_JUNCTION_T && item->IsConnected( aPoint ) && !item->IsSelected() )
522  {
523  ptHasUnselectedJunction = true;
524  break;
525  }
526  }
527 
528  for( SCH_ITEM *test : itemsOverlapping )
529  {
530  if( test == aOriginalItem || test->IsSelected() || !test->CanConnect( aOriginalItem ) )
531  continue;
532 
533  KICAD_T testType = test->Type();
534 
535  switch( testType )
536  {
537  case SCH_LINE_T:
538  {
539  // Select the connected end of wires/bus connections that don't have an unselected
540  // junction isolating them from the drag
541  if( ptHasUnselectedJunction )
542  break;
543 
544  SCH_LINE* testLine = static_cast<SCH_LINE*>( test );
545 
546  if( testLine->GetStartPoint() == aPoint )
547  {
548  if( !testLine->HasFlag( TEMP_SELECTED ) )
549  aList.push_back( testLine );
550 
551  testLine->SetFlags( STARTPOINT | TEMP_SELECTED );
552  }
553  else if( testLine->GetEndPoint() == aPoint )
554  {
555  if( !testLine->HasFlag( TEMP_SELECTED ) )
556  aList.push_back( testLine );
557 
558  testLine->SetFlags( ENDPOINT | TEMP_SELECTED );
559  }
560  else
561  {
562  break;
563  }
564 
565  // Since only one end is going to move, the movement vector of any labels attached
566  // to it is scaled by the proportion of the line length the label is from the moving
567  // end.
568  for( SCH_ITEM* item : itemsOverlapping )
569  {
570  if( item->Type() == SCH_LABEL_T )
571  {
572  SCH_TEXT* label = static_cast<SCH_TEXT*>( item );
573 
574  if( label->IsSelected() )
575  continue; // These will be moved on their own because they're selected
576 
577  if( label->CanConnect( testLine )
578  && testLine->HitTest( label->GetPosition(), 1 ) )
579  {
580  if( !label->HasFlag( TEMP_SELECTED ) )
581  aList.push_back( label );
582 
584  info.attachedLine = testLine;
585  info.originalLabelPos = label->GetPosition();
586  m_specialCaseLabels[label] = info;
587  }
588  }
589  }
590 
591  break;
592  }
593 
594  case SCH_SHEET_T:
595  // Dragging a sheet just because it's connected to something else feels a bit like
596  // the tail wagging the dog, but this could be moved down to the next case.
597  break;
598 
599  case SCH_COMPONENT_T:
600  case SCH_JUNCTION_T:
601  if( test->IsConnected( aPoint ) )
602  {
603  // Add a new wire between the component or junction and the selected item so
604  // the selected item can be dragged.
605  SCH_LINE* newWire = nullptr;
606 
607  if( test->GetLayer() == LAYER_BUS_JUNCTION )
608  newWire = new SCH_LINE( aPoint, LAYER_BUS );
609  else
610  newWire = new SCH_LINE( aPoint, LAYER_WIRE );
611 
612  newWire->SetFlags( IS_NEW );
613  m_frame->AddToScreen( newWire, m_frame->GetScreen() );
614 
615  newWire->SetFlags( TEMP_SELECTED | STARTPOINT );
616  aList.push_back( newWire );
617  }
618  break;
619 
620  case SCH_NO_CONNECT_T:
621  // Select no-connects that are connected to items being moved.
622  if( !test->HasFlag( TEMP_SELECTED ) && test->IsConnected( aPoint ) )
623  {
624  aList.push_back( test );
625  test->SetFlags( TEMP_SELECTED );
626  }
627 
628  break;
629 
630  case SCH_LABEL_T:
631  case SCH_GLOBAL_LABEL_T:
632  case SCH_HIER_LABEL_T:
634  case SCH_BUS_BUS_ENTRY_T:
635  // Performance optimization:
636  if( test->HasFlag( TEMP_SELECTED ) )
637  break;
638 
639  // Select labels and bus entries that are connected to a wire being moved.
640  if( aOriginalItem->Type() == SCH_LINE_T )
641  {
642  std::vector<wxPoint> connections = test->GetConnectionPoints();
643 
644  for( wxPoint& point : connections )
645  {
646  if( aOriginalItem->HitTest( point, 1 ) )
647  {
648  test->SetFlags( TEMP_SELECTED );
649  aList.push_back( test );
650 
651  // A bus entry needs its wire & label as well
652  if( testType == SCH_BUS_WIRE_ENTRY_T || testType == SCH_BUS_BUS_ENTRY_T )
653  {
654  std::vector<wxPoint> ends = test->GetConnectionPoints();
655  wxPoint otherEnd;
656 
657  if( ends[0] == point )
658  otherEnd = ends[1];
659  else
660  otherEnd = ends[0];
661 
662  getConnectedDragItems( test, otherEnd, aList );
663  }
664  break;
665  }
666  }
667  }
668 
669  break;
670 
671  default:
672  break;
673  }
674  }
675 }
void getConnectedDragItems(SCH_ITEM *aOriginalItem, wxPoint aPoint, EDA_ITEMS &aList)
Set up handlers for various events.
wxPoint GetStartPoint() const
Definition: sch_line.h:94
bool IsSelected() const
Definition: eda_item.h:172
EE_TYPE Overlapping(const EDA_RECT &aRect)
Definition: sch_rtree.h:224
EE_RTREE - Implements an R-tree for fast spatial and type indexing of schematic items.
Definition: sch_rtree.h:41
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: eda_item.h:114
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is contained within or on the bounding box of an item.
Definition: sch_line.cpp:717
virtual bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const
Test if aPosition is contained within or on the bounding box of an item.
Definition: eda_item.h:274
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual bool CanConnect(const SCH_ITEM *aItem) const
Definition: sch_item.h:378
void SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:202
std::map< SCH_TEXT *, SPECIAL_CASE_LABEL_INFO > m_specialCaseLabels
Definition: sch_move_tool.h:95
wxPoint GetPosition() const override
Definition: sch_text.h:312
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: eda_item.h:111
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,...
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
EE_RTREE & Items()
Definition: sch_screen.h:159
The EE_TYPE struct provides a type-specific auto-range iterator to the RTree.
Definition: sch_rtree.h:181
#define ENDPOINT
ends. (Used to support dragging.)
Definition: eda_item.h:112
virtual const EDA_RECT GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:89
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:194
#define IS_NEW
New item, just created.
Definition: eda_item.h:106
bool HasFlag(STATUS_FLAGS aFlag) const
Definition: eda_item.h:205
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162
wxPoint GetEndPoint() const
Definition: sch_line.h:97

References SCH_BASE_FRAME::AddToScreen(), SPECIAL_CASE_LABEL_INFO::attachedLine, SCH_ITEM::CanConnect(), ENDPOINT, EDA_ITEM::GetBoundingBox(), SCH_LINE::GetEndPoint(), SCH_TEXT::GetPosition(), SCH_EDIT_FRAME::GetScreen(), SCH_LINE::GetStartPoint(), EDA_ITEM::HasFlag(), SCH_LINE::HitTest(), EDA_ITEM::HitTest(), IS_NEW, EDA_ITEM::IsSelected(), SCH_SCREEN::Items(), LAYER_BUS, LAYER_BUS_JUNCTION, LAYER_WIRE, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_specialCaseLabels, SPECIAL_CASE_LABEL_INFO::originalLabelPos, EE_RTREE::Overlapping(), SCH_BUS_BUS_ENTRY_T, SCH_BUS_WIRE_ENTRY_T, SCH_COMPONENT_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, EDA_ITEM::SetFlags(), STARTPOINT, TEMP_SELECTED, and EDA_ITEM::Type().

Referenced by AlignElements(), and Main().

◆ getEditFrame()

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

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

Definition at line 185 of file tool_base.h.

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

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone().

◆ 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 121 of file tool_base.h.

122  {
123  return m_toolId;
124  }
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:210

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

Return the instance of TOOL_MANAGER that takes care of the tool.

Returns
Instance of the TOOL_MANAGER or NULL if there is no associated tool manager.

Definition at line 144 of file tool_base.h.

145  {
146  return m_toolMgr;
147  }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215

References TOOL_BASE::m_toolMgr.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), ZONE_CREATE_HELPER::commitZone(), ZONE_CREATE_HELPER::createNewZone(), PCB_TOOL_BASE::doInteractiveItemPlacement(), ACTION_MENU::getToolManager(), LIB_TREE::onContextMenu(), ZONE_CREATE_HELPER::OnFirstPoint(), ACTION_MENU::OnMenuEvent(), and ZONE_CREATE_HELPER::performZoneCutout().

◆ 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 197 of file tool_base.h.

References TOOL_BASE::getModelInt().

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

◆ 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 134 of file tool_base.h.

135  {
136  return m_toolName;
137  }
std::string m_toolName
Definition: tool_base.h:214

References TOOL_BASE::m_toolName.

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

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Return the type of the tool.

Returns
The type of the tool.

Definition at line 109 of file tool_base.h.

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

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:284
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215

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(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::CollectHits(), SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint(), COMMON_TOOLS::CursorControl(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), COMMON_TOOLS::doZoomFit(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_EDITOR_CONTROL::FindComponentAndItem(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), PCB_CONTROL::GridResetOrigin(), PCB_CONTROL::GridSetOrigin(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), PCB_SELECTION_TOOL::hitTestDistance(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), PCB_PICKER_TOOL::Main(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), moveItem(), PL_EDIT_TOOL::moveItem(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PNS::TOOL_BASE::pickSingleItem(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), BOARD_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCB_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), PCB_SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), PCB_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::SelectAll(), PL_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), DRAWING_TOOL::SetAnchor(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), SCH_DRAWING_TOOLS::TwoClickPlace(), PL_SELECTION_TOOL::unhighlight(), EE_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< SCH_BASE_FRAME >::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updateParentItem(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), PCB_POINT_EDITOR::updatePoints(), PCB_SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), PCB_VIEWER_TOOLS::view(), PCB_TOOL_BASE::view(), 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 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:286

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(), SCH_EDIT_TOOL::BreakWire(), 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_LINE_WIRE_BUS_TOOL::DrawSegments(), 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(), BOARD_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), Main(), PCB_PICKER_TOOL::Main(), 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(), SCH_DRAWING_TOOLS::PlaceComponent(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), PL_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), PCB_POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), PCB_SELECTION_TOOL::selectCursor(), PL_SELECTION_TOOL::selectMultiple(), EE_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(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateItem(), PL_EDIT_TOOL::updateModificationPoint(), 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 128 of file tool_interactive.h.

130 {
131  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
132 
133  goInternal( sptr, aConditions );
134 }
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:59
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)

References TOOL_INTERACTIVE::goInternal().

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

◆ 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 56 of file sch_move_tool.cpp.

57 {
59 
60  auto moveCondition =
61  []( const SELECTION& aSel )
62  {
63  if( aSel.Empty() )
64  return false;
65 
67  return false;
68 
69  return true;
70  };
71 
72  // Add move actions to the selection tool menu
73  //
75 
76  selToolMenu.AddItem( EE_ACTIONS::move, moveCondition, 150 );
77  selToolMenu.AddItem( EE_ACTIONS::drag, moveCondition, 150 );
78  selToolMenu.AddItem( EE_ACTIONS::alignToGrid, moveCondition, 150 );
79 
80  return true;
81 }
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:46
TOOL_MENU & GetToolMenu()
static TOOL_ACTION alignToGrid
Definition: ee_actions.h:109
bool Init() override
Init() is called once upon a registration of the tool.
Definition: ee_tool_base.h:65
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
static bool IsDrawingLineWireOrBus(const SELECTION &aSelection)
static TOOL_ACTION drag
Definition: ee_actions.h:113
static TOOL_ACTION move
Definition: ee_actions.h:112
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.

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, and EE_ACTIONS::move.

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 31 of file tool_base.cpp.

32 {
33  return m_toolMgr->IsToolActive( m_toolId );
34 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:210
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 ROUTER_TOOL::handleLayerSwitch(), EDIT_TOOL::isRouterActive(), 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 112 of file sch_move_tool.cpp.

113 {
114  EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
116  EE_GRID_HELPER grid( m_toolMgr );
117 
118  m_anchorPos.reset();
119 
120  if( aEvent.IsAction( &EE_ACTIONS::move ) )
121  m_isDragOperation = false;
122  else if( aEvent.IsAction( &EE_ACTIONS::drag ) )
123  m_isDragOperation = true;
124  else if( aEvent.IsAction( &EE_ACTIONS::moveActivate ) )
126  else
127  return 0;
128 
129  if( m_moveInProgress )
130  {
131  auto sel = m_selectionTool->GetSelection().Front();
132 
133  if( sel && !sel->IsNew() )
134  {
135  // User must have switched from move to drag or vice-versa. Reset the selected
136  // items so we can start again with the current m_isDragOperation.
140  m_moveInProgress = false;
141  controls->SetAutoPan( false );
142 
143  // And give it a kick so it doesn't have to wait for the first mouse movement to
144  // refresh.
146  }
147 
148  return 0;
149  }
150 
151  // Be sure that there is at least one item that we can move. If there's no selection try
152  // looking for the stuff under mouse cursor (i.e. Kicad old-style hover selection).
154  bool unselect = selection.IsHover();
155 
156  // Keep an original copy of the starting points for cleanup after the move
157  std::vector<DANGLING_END_ITEM> internalPoints;
158 
159  Activate();
160  controls->ShowCursor( true );
161 
162  std::string tool = aEvent.GetCommandStr().get();
163  m_frame->PushTool( tool );
164 
165  if( selection.Empty() )
166  {
167  // Note that it's important to go through push/pop even when the selection is empty.
168  // This keeps other tools from having to special-case an empty move.
169  m_frame->PopTool( tool );
170  return 0;
171  }
172 
173  bool restore_state = false;
174  bool chain_commands = false;
175  TOOL_EVENT* evt = const_cast<TOOL_EVENT*>( &aEvent );
176  VECTOR2I prevPos;
177  int snapLayer = UNDEFINED_LAYER;
178 
179  m_cursor = controls->GetCursorPosition();
180 
181  // Main loop: keep receiving events
182  do
183  {
185  grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
186  grid.SetUseGrid( !evt->Modifier( MD_ALT ) );
187 
190  || evt->IsAction( &EE_ACTIONS::move )
191  || evt->IsAction( &EE_ACTIONS::drag )
192  || evt->IsMotion()
193  || evt->IsDrag( BUT_LEFT )
194  || evt->IsAction( &ACTIONS::refreshPreview ) )
195  {
196  if( !m_moveInProgress ) // Prepare to start moving/dragging
197  {
198  SCH_ITEM* sch_item = (SCH_ITEM*) selection.Front();
199  bool appendUndo = sch_item && sch_item->IsNew();
200  bool placingNewItems = sch_item && sch_item->IsNew();
201 
202  //------------------------------------------------------------------------
203  // Setup a drag or a move
204  //
205  m_dragAdditions.clear();
206  m_specialCaseLabels.clear();
207  internalPoints.clear();
208 
209  for( SCH_ITEM* it : m_frame->GetScreen()->Items() )
210  {
211  it->ClearFlags( TEMP_SELECTED );
212 
213  if( !it->IsSelected() )
214  it->ClearFlags( STARTPOINT | ENDPOINT );
215 
216  if( !selection.IsHover() && it->IsSelected() )
217  it->SetFlags( STARTPOINT | ENDPOINT );
218  }
219 
220  if( m_isDragOperation )
221  {
222  // Add connections to the selection for a drag.
223  //
224  for( EDA_ITEM* edaItem : selection )
225  {
226  SCH_ITEM* item = static_cast<SCH_ITEM*>( edaItem );
227  std::vector<wxPoint> connections;
228 
229  if( item->Type() == SCH_LINE_T )
230  static_cast<SCH_LINE*>( item )->GetSelectedPoints( connections );
231  else
232  connections = item->GetConnectionPoints();
233 
234  for( wxPoint point : connections )
235  getConnectedDragItems( item, point, m_dragAdditions );
236  }
237 
239  }
240  else
241  {
242  // Mark the edges of the block with dangling flags for a move.
243  for( EDA_ITEM* item : selection )
244  static_cast<SCH_ITEM*>( item )->GetEndPoints( internalPoints );
245 
246  for( EDA_ITEM* item : selection )
247  static_cast<SCH_ITEM*>( item )->UpdateDanglingState( internalPoints );
248  }
249  // Generic setup
250  //
251  for( EDA_ITEM* item : selection )
252  {
253  if( static_cast<SCH_ITEM*>( item )->IsConnectable() )
254  {
255  if( snapLayer == LAYER_GRAPHICS )
256  snapLayer = LAYER_ANY;
257  else
258  snapLayer = LAYER_CONNECTABLE;
259  }
260  else
261  {
262  if( snapLayer == LAYER_CONNECTABLE )
263  snapLayer = LAYER_ANY;
264  else
265  snapLayer = LAYER_GRAPHICS;
266  }
267 
268  if( item->IsNew() )
269  {
270  if( item->HasFlag( TEMP_SELECTED ) && m_isDragOperation )
271  {
272  // Item was added in getConnectedDragItems
273  saveCopyInUndoList( (SCH_ITEM*) item, UNDO_REDO::NEWITEM, appendUndo );
274  appendUndo = true;
275  }
276  else
277  {
278  // Item was added in a previous command (and saved to undo by
279  // that command)
280  }
281  }
282  else if( item->GetParent() && item->GetParent()->IsSelected() )
283  {
284  // Item will be (or has been) saved to undo by parent
285  }
286  else
287  {
288  saveCopyInUndoList( (SCH_ITEM*) item, UNDO_REDO::CHANGED, appendUndo );
289  appendUndo = true;
290  }
291 
292  SCH_ITEM* schItem = (SCH_ITEM*) item;
293  schItem->SetStoredPos( schItem->GetPosition() );
294  }
295 
296  // Set up the starting position and move/drag offset
297  //
298  m_cursor = controls->GetCursorPosition();
299 
300  if( evt->IsAction( &EE_ACTIONS::restartMove ) )
301  {
302  wxASSERT_MSG( m_anchorPos, "Should be already set from previous cmd" );
303  }
304  else if( placingNewItems )
305  {
306  m_anchorPos = selection.GetReferencePoint();
307  }
308 
309  if( m_anchorPos )
310  {
311  VECTOR2I delta = m_cursor - (*m_anchorPos);
312 
313  // Drag items to the current cursor position
314  for( EDA_ITEM* item : selection )
315  {
316  // Don't double move pins, fields, etc.
317  if( item->GetParent() && item->GetParent()->IsSelected() )
318  continue;
319 
320  moveItem( item, delta );
321  updateItem( item, false );
322  }
323 
325  }
326  // For some items, moving the cursor to anchor is not good (for instance large
327  // hierarchical sheets or components can have the anchor outside the view)
328  else if( selection.Size() == 1 && !sch_item->IsMovableFromAnchorPoint() )
329  {
332  }
333  else
334  {
335  if( m_frame->GetMoveWarpsCursor() )
336  {
337  // User wants to warp the mouse
338  m_cursor = grid.BestDragOrigin( m_cursor, snapLayer, selection );
339  }
340  else
341  {
342  // User does not want to warp the mouse
344  }
345  }
346 
347  controls->SetCursorPosition( m_cursor, false );
349 
350  prevPos = m_cursor;
351  controls->SetAutoPan( true );
352  m_moveInProgress = true;
353  }
354 
355  //------------------------------------------------------------------------
356  // Follow the mouse
357  //
358  m_cursor = grid.BestSnapAnchor( controls->GetCursorPosition( false ),
359  snapLayer, selection );
360 
361  VECTOR2I delta( m_cursor - prevPos );
363 
364  m_moveOffset += delta;
365  prevPos = m_cursor;
366 
367  for( EDA_ITEM* item : selection )
368  {
369  // Don't double move pins, fields, etc.
370  if( item->GetParent() && item->GetParent()->IsSelected() )
371  continue;
372 
373  moveItem( item, delta );
374  updateItem( item, false );
375  }
376 
378  }
379  //------------------------------------------------------------------------
380  // Handle cancel
381  //
382  else if( evt->IsCancelInteractive() || evt->IsActivate() )
383  {
384  if( m_moveInProgress && evt->IsCancelInteractive() )
385  evt->SetPassEvent( false );
386 
387  if( m_moveInProgress )
388  restore_state = true;
389 
390  break;
391  }
392  //------------------------------------------------------------------------
393  // Handle TOOL_ACTION special cases
394  //
395  else if( evt->Action() == TA_UNDO_REDO_PRE )
396  {
397  unselect = true;
398  break;
399  }
400  else if( evt->IsAction( &ACTIONS::doDelete ) )
401  {
402  // Exit on a remove operation; there is no further processing for removed items.
403  break;
404  }
405  else if( evt->IsAction( &ACTIONS::duplicate ) )
406  {
407  if( selection.Front()->IsNew() )
408  {
409  // This doesn't really make sense; we'll just end up dragging a stack of
410  // objects so Duplicate() is going to ignore this and we'll just carry on.
411  continue;
412  }
413 
414  // Move original back and exit. The duplicate will run in its own loop.
415  restore_state = true;
416  unselect = false;
417  chain_commands = true;
418  break;
419  }
420  else if( evt->Action() == TA_CHOICE_MENU_CHOICE )
421  {
422  if( evt->GetCommandId().get() >= ID_POPUP_SCH_SELECT_UNIT_CMP
424  {
425  SCH_COMPONENT* component = dynamic_cast<SCH_COMPONENT*>( selection.Front() );
426  int unit = evt->GetCommandId().get() - ID_POPUP_SCH_SELECT_UNIT_CMP;
427 
428  if( component )
429  {
430  m_frame->SelectUnit( component, unit );
432  }
433  }
434  }
435  //------------------------------------------------------------------------
436  // Handle context menu
437  //
438  else if( evt->IsClick( BUT_RIGHT ) )
439  {
441  }
442  //------------------------------------------------------------------------
443  // Handle drop
444  //
445  else if( evt->IsMouseUp( BUT_LEFT )
446  || evt->IsClick( BUT_LEFT )
447  || evt->IsDblClick( BUT_LEFT ) )
448  {
449  break; // Finish
450  }
451  else
452  evt->SetPassEvent();
453 
454  controls->SetAutoPan( m_moveInProgress );
455 
456  } while( ( evt = Wait() ) ); //Should be assignment not equality test
457 
458  controls->ForceCursorPosition( false );
459  controls->ShowCursor( false );
460  controls->SetAutoPan( false );
461 
462  if( !chain_commands )
463  m_moveOffset = { 0, 0 };
464 
465  m_anchorPos.reset();
466 
467  for( EDA_ITEM* item : selection )
468  item->ClearEditFlags();
469 
470  if( restore_state )
471  {
474  }
475  else
476  {
477  // One last update after exiting loop (for slower stuff, such as updating SCREEN's RTree).
478  for( EDA_ITEM* item : selection )
479  updateItem( item, true );
480 
481  EE_SELECTION selectionCopy( selection );
483 
484  // If we move items away from a junction, we _may_ want to add a junction there
485  // to denote the state.
486  for( const DANGLING_END_ITEM& it : internalPoints )
487  {
488  if( m_frame->GetScreen()->IsJunctionNeeded( it.GetPosition(), true ) )
489  m_frame->AddJunction( m_frame->GetScreen(), it.GetPosition(), true, false );
490  }
491 
492  m_toolMgr->RunAction( EE_ACTIONS::addNeededJunctions, true, &selectionCopy );
493 
496 
497  m_frame->OnModify();
498  }
499 
500  if( unselect )
502  else
503  m_selectionTool->RebuildSelection(); // Schematic cleanup might have merged lines, etc.
504 
505  m_dragAdditions.clear();
506  m_moveInProgress = false;
507  m_frame->PopTool( tool );
508  return 0;
509 }
static TOOL_ACTION moveActivate
Definition: ee_actions.h:111
OPT< int > GetCommandId() const
Definition: tool_event.h:449
bool SchematicCleanUp(SCH_SCREEN *aScreen=nullptr)
Performs routine schematic cleaning including breaking wire and buses and deleting identical objects ...
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
bool IsHover() const
Definition: selection.h:72
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:254
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.
virtual std::vector< wxPoint > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
Definition: sch_item.h:397
void getConnectedDragItems(SCH_ITEM *aOriginalItem, wxPoint aPoint, EDA_ITEMS &aList)
Set up handlers for various events.
bool IsSelected() const
Definition: eda_item.h:172
static TOOL_ACTION doDelete
Definition: actions.h:75
bool IsJunctionNeeded(const wxPoint &aPosition, bool aNew=false)
Test if a junction is required for the items at aPosition on the screen.
Definition: sch_screen.cpp:371
VECTOR2I m_cursor
Definition: sch_move_tool.h:89
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:248
bool IsClick(int aButtonMask=BUT_ANY) const
Definition: tool_event.cpp:178
VECTOR2I m_moveOffset
Last cursor position (needed for getModificationPoint() to avoid changes of edit reference point).
Definition: sch_move_tool.h:85
static TOOL_ACTION restartMove
Definition: ee_actions.h:197
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
bool IsMotion() const
Definition: tool_event.h:304
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
int AddItemsToSel(const TOOL_EVENT &aEvent)
bool m_moveInProgress
< Flag determining if anything is being dragged right now
Definition: sch_move_tool.h:78
virtual wxPoint GetPosition() const
Definition: eda_item.h:301
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: eda_item.h:114
EDA_ITEMS m_dragAdditions
Used for chaining commands.
Definition: sch_move_tool.h:82
void SetCurrentCursor(KICURSOR cursor)
Set the current cursor shape for this panel.
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:216
bool IsCancelInteractive() const
Indicate the event should restart/end an ongoing interactive tool's event loop (eg esc key,...
Definition: tool_event.cpp:190
bool IsNew() const
Definition: eda_item.h:168
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:67
SCH_JUNCTION * AddJunction(SCH_SCREEN *aScreen, const wxPoint &aPos, bool aAppendToUndo, bool aFinal=true)
EE_SELECTION & GetSelection()
Return the set of currently selected items.
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Return either an existing selection (filtered), or the selection at the current cursor if the existin...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
bool IsDrag(int aButtonMask=BUT_ANY) const
Definition: tool_event.h:294
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
virtual bool IsMovableFromAnchorPoint() const
Definition: sch_item.h:247
std::map< SCH_TEXT *, SPECIAL_CASE_LABEL_INFO > m_specialCaseLabels
Definition: sch_move_tool.h:95
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
Definition: ee_tool_base.h:133
bool IsDblClick(int aButtonMask=BUT_ANY) const
Definition: tool_event.cpp:184
virtual void PopTool(const std::string &actionName)
boost::optional< VECTOR2I > m_anchorPos
Definition: sch_move_tool.h:91
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Generic, UI-independent tool event.
Definition: tool_event.h:170
EDA_ITEM * GetParent() const
Definition: eda_item.h:164
An interface for classes handling user events controlling the view behavior such as zooming,...
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
static const TOOL_EVENT SelectedItemsMoved
Used to inform tools that the selection should temporarily be non-editable.
Definition: actions.h:219
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:54
bool m_isDragOperation
Items (such as wires) which were added to the selection for a drag.
Definition: sch_move_tool.h:79
static TOOL_ACTION addNeededJunctions
Definition: ee_actions.h:73
bool IsMouseUp(int aButtonMask=BUT_ANY) const
Definition: tool_event.h:299
void SelectUnit(SCH_COMPONENT *aComponent, int aUnit)
Definition: getpart.cpp:198
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:122
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:102
int Modifier(int aMask=MD_MODIFIER_MASK) const
Definition: tool_event.h:340
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: eda_item.h:111
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:454
bool IsActivate() const
Definition: tool_event.h:319
void moveItem(EDA_ITEM *aItem, const VECTOR2I &aDelta)
Find additional items for a drag operation.
static TOOL_ACTION drag
Definition: ee_actions.h:113
void RollbackSchematicFromUndo()
Performs an undo of the last edit WITHOUT logging a corresponding redo.
EE_RTREE & Items()
Definition: sch_screen.h:159
void RebuildSelection()
Rebuild the selection from the EDA_ITEMs' selection flags.
Schematic symbol object.
Definition: sch_component.h:79
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:149
bool GetMoveWarpsCursor() const
Indicate that a move operation should warp the mouse pointer to the origin of the move object.
Definition: tools_holder.h:140
void Activate()
Run the tool.
static TOOL_ACTION move
Definition: ee_actions.h:112
#define ENDPOINT
ends. (Used to support dragging.)
Definition: eda_item.h:112
static const KICAD_T movableItems[]
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
Helper class used to store the state of schematic items that can be connected to other schematic item...
Definition: sch_item.h:85
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
#define QUIET_MODE
void ClearEditFlags()
Definition: eda_item.h:221
int RemoveItemsFromSel(const TOOL_EVENT &aEvent)
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
Definition: tool_manager.h:267
void SetStoredPos(wxPoint aPos)
Definition: sch_item.h:250
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:194
void ShowContextMenu(SELECTION &aSelection)
Helper function to set and immediately show a CONDITIONAL_MENU in concert with the given SELECTION.
Definition: tool_menu.cpp:59
static TOOL_ACTION duplicate
Definition: actions.h:74
bool HasFlag(STATUS_FLAGS aFlag) const
Definition: eda_item.h:205
static TOOL_ACTION refreshPreview
Definition: actions.h:109
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
EDA_ITEM * Front() const
Definition: selection.h:203
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162

References TOOL_EVENT::Action(), TOOL_INTERACTIVE::Activate(), EE_SELECTION_TOOL::AddItemsToSel(), SCH_EDIT_FRAME::AddJunction(), EE_ACTIONS::addNeededJunctions, EE_GRID_HELPER::BestDragOrigin(), EE_GRID_HELPER::BestSnapAnchor(), BUT_LEFT, BUT_RIGHT, CHANGED, EE_ACTIONS::clearSelection, 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(), TOOL_EVENT::GetCommandStr(), getConnectedDragItems(), SCH_ITEM::GetConnectionPoints(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), TOOLS_HOLDER::GetMoveWarpsCursor(), EDA_ITEM::GetPosition(), SCH_EDIT_FRAME::GetScreen(), EE_SELECTION_TOOL::GetSelection(), TOOL_BASE::getViewControls(), ID_POPUP_SCH_SELECT_UNIT_CMP, ID_POPUP_SCH_SELECT_UNIT_CMP_MAX, TOOL_EVENT::IsAction(), TOOL_EVENT::IsActivate(), TOOL_EVENT::IsCancelInteractive(), TOOL_EVENT::IsClick(), TOOL_EVENT::IsDblClick(), TOOL_EVENT::IsDrag(), SELECTION::IsHover(), SCH_SCREEN::IsJunctionNeeded(), TOOL_EVENT::IsMotion(), TOOL_EVENT::IsMouseUp(), SCH_ITEM::IsMovableFromAnchorPoint(), EDA_ITEM::IsNew(), SCH_SCREEN::Items(), LAYER_ANY, LAYER_CONNECTABLE, LAYER_GRAPHICS, m_anchorPos, m_cursor, m_dragAdditions, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EESCHEMA_SETTINGS::m_Input, m_isDragOperation, TOOL_INTERACTIVE::m_menu, m_moveInProgress, m_moveOffset, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, m_specialCaseLabels, TOOL_BASE::m_toolMgr, MD_ALT, MD_SHIFT, TOOL_EVENT::Modifier(), movableItems, EE_ACTIONS::move, EE_ACTIONS::moveActivate, moveItem(), MOVING, NEWITEM, SCH_EDIT_FRAME::OnModify(), Pgm(), TOOLS_HOLDER::PopTool(), TOOL_MANAGER::PostEvent(), TOOLS_HOLDER::PushTool(), QUIET_MODE, EE_SELECTION_TOOL::RebuildSelection(), ACTIONS::refreshPreview, EE_SELECTION_TOOL::RemoveItemsFromSel(), EE_SELECTION_TOOL::RequestSelection(), EE_ACTIONS::restartMove, SCH_EDIT_FRAME::RollbackSchematicFromUndo(), TOOL_MANAGER::RunAction(), EE_TOOL_BASE< SCH_EDIT_FRAME >::saveCopyInUndoList(), SCH_LINE_T, SCH_EDIT_FRAME::SchematicCleanUp(), EVENTS::SelectedItemsModified, EVENTS::SelectedItemsMoved, SCH_EDIT_FRAME::SelectUnit(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), TOOL_EVENT::SetPassEvent(), GRID_HELPER::SetSnap(), SCH_ITEM::SetStoredPos(), GRID_HELPER::SetUseGrid(), TOOL_MENU::ShowContextMenu(), STARTPOINT, TA_CHOICE_MENU_CHOICE, TA_UNDO_REDO_PRE, TEMP_SELECTED, SCH_EDIT_FRAME::TestDanglingEnds(), EDA_ITEM::Type(), UNDEFINED_LAYER, EE_TOOL_BASE< SCH_EDIT_FRAME >::updateItem(), and TOOL_INTERACTIVE::Wait().

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 678 of file sch_move_tool.cpp.

679 {
680  switch( aItem->Type() )
681  {
682  case SCH_LINE_T:
683  {
684  SCH_LINE* line = static_cast<SCH_LINE*>( aItem );
685 
686  if( aItem->HasFlag( STARTPOINT ) )
687  line->MoveStart( (wxPoint) aDelta );
688 
689  if( aItem->HasFlag( ENDPOINT ) )
690  line->MoveEnd( (wxPoint) aDelta );
691 
692  }
693  break;
694 
695  case SCH_PIN_T:
696  case SCH_FIELD_T:
697  {
698  SCH_ITEM* parent = (SCH_ITEM*) aItem->GetParent();
699  wxPoint delta( aDelta );
700 
701  if( parent && parent->Type() == SCH_COMPONENT_T )
702  {
703  SCH_COMPONENT* component = (SCH_COMPONENT*) aItem->GetParent();
704  TRANSFORM transform = component->GetTransform().InverseTransform();
705 
706  delta = transform.TransformCoordinate( delta );
707  }
708 
709  static_cast<SCH_ITEM*>( aItem )->Move( delta );
710 
711  // If we're moving a field with respect to its parent then it's no longer auto-placed
712  if( aItem->Type() == SCH_FIELD_T && parent && !parent->IsSelected() )
713  parent->ClearFieldsAutoplaced();
714 
715  break;
716  }
717  case SCH_SHEET_PIN_T:
718  {
719  SCH_SHEET_PIN* pin = (SCH_SHEET_PIN*) aItem;
720  pin->SetStoredPos( pin->GetStoredPos() + (wxPoint) aDelta );
721  pin->ConstrainOnEdge( pin->GetStoredPos() );
722  break;
723  }
724  case SCH_LABEL_T:
725  {
726  SCH_TEXT* label = static_cast<SCH_TEXT*>( aItem );
727 
728  if( m_specialCaseLabels.count( label ) )
729  {
731  SEG currentLine( info.attachedLine->GetStartPoint(), info.attachedLine->GetEndPoint() );
732  label->SetPosition( (wxPoint) currentLine.NearestPoint( info.originalLabelPos ) );
733  }
734  else
735  {
736  label->Move( (wxPoint) aDelta );
737  }
738 
739  break;
740  }
741  default:
742  static_cast<SCH_ITEM*>( aItem )->Move( (wxPoint) aDelta );
743  break;
744  }
745 
746  getView()->Hide( aItem, false );
747  aItem->SetFlags( IS_MOVED );
748 }
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hide the item in the view (e.g.
Definition: view.cpp:1475
wxPoint GetStartPoint() const
Definition: sch_line.h:94
bool IsSelected() const
Definition: eda_item.h:172
void MoveStart(const wxPoint &aMoveVector)
Definition: sch_line.cpp:120
TRANSFORM InverseTransform() const
Calculate the Inverse mirror/rotation transform.
Definition: transform.cpp:59
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:42
wxPoint & GetStoredPos()
Definition: sch_item.h:249
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
void Move(const wxPoint &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_text.h:274
void SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:202
std::map< SCH_TEXT *, SPECIAL_CASE_LABEL_INFO > m_specialCaseLabels
Definition: sch_move_tool.h:95
void ClearFieldsAutoplaced()
Set fields automatically placed flag false.
Definition: sch_item.h:458
EDA_ITEM * GetParent() const
Definition: eda_item.h:164
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:85
TRANSFORM & GetTransform()
void ConstrainOnEdge(wxPoint Pos)
Adjust label position to edge based on proximity to vertical or horizontal edge of the parent sheet.
#define IS_MOVED
Item being moved.
Definition: eda_item.h:105
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
Definition: seg.h:41
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: eda_item.h:111
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
void MoveEnd(const wxPoint &aMoveVector)
Definition: sch_line.cpp:130
Schematic symbol object.
Definition: sch_component.h:79
#define ENDPOINT
ends. (Used to support dragging.)
Definition: eda_item.h:112
void SetPosition(const wxPoint &aPosition) override
Definition: sch_text.h:313
void SetStoredPos(wxPoint aPos)
Definition: sch_item.h:250
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:194
bool HasFlag(STATUS_FLAGS aFlag) const
Definition: eda_item.h:205
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162
wxPoint GetEndPoint() const
Definition: sch_line.h:97

References SPECIAL_CASE_LABEL_INFO::attachedLine, SCH_ITEM::ClearFieldsAutoplaced(), SCH_SHEET_PIN::ConstrainOnEdge(), ENDPOINT, SCH_LINE::GetEndPoint(), EDA_ITEM::GetParent(), SCH_LINE::GetStartPoint(), SCH_ITEM::GetStoredPos(), SCH_COMPONENT::GetTransform(), TOOL_BASE::getView(), EDA_ITEM::HasFlag(), KIGFX::VIEW::Hide(), TRANSFORM::InverseTransform(), IS_MOVED, EDA_ITEM::IsSelected(), m_specialCaseLabels, SCH_TEXT::Move(), SCH_LINE::MoveEnd(), SCH_LINE::MoveStart(), SPECIAL_CASE_LABEL_INFO::originalLabelPos, SCH_COMPONENT_T, SCH_FIELD_T, SCH_LABEL_T, SCH_LINE_T, SCH_PIN_T, SCH_SHEET_PIN_T, EDA_ITEM::SetFlags(), SCH_TEXT::SetPosition(), SCH_ITEM::SetStoredPos(), 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 85 of file ee_tool_base.h.

86  {
87  if( aReason == MODEL_RELOAD )
88  {
89  // Init variables used by every drawing tool
90  m_frame = getEditFrame<T>();
91  m_isSymbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) != nullptr;
92  }
93 
94  m_view = static_cast<KIGFX::SCH_VIEW*>( getView() );
95  }
Model changes (required full reload)
Definition: tool_base.h:81
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36

◆ 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 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
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 
)
inlineprotectedinherited

Definition at line 133 of file ee_tool_base.h.

134  {
135  KICAD_T itemType = aItem->Type();
136  bool selected = aItem->IsSelected();
137 
138  // IS_SELECTED flag should not be set on undo items which were added for
139  // a drag operation.
140  if( selected && aItem->HasFlag( TEMP_SELECTED ) )
141  aItem->ClearSelected();
142 
143  if( m_isSymbolEditor )
144  {
145  SYMBOL_EDIT_FRAME* editFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
146  wxASSERT( editFrame );
147 
148  editFrame->SaveCopyInUndoList( static_cast<LIB_ITEM*>( aItem ), aType, aAppend );
149  }
150  else
151  {
152  SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
153  wxASSERT( editFrame );
154 
155  if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
156  {
157  editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
158  static_cast<SCH_ITEM*>( aItem->GetParent() ),
159  UNDO_REDO::CHANGED, aAppend );
160  }
161  else
162  {
163  editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
164  static_cast<SCH_ITEM*>( aItem ),
165  aType, aAppend );
166  }
167  }
168 
169  if( selected && aItem->HasFlag( TEMP_SELECTED ) )
170  aItem->SetSelected();
171  }
bool IsSelected() const
Definition: eda_item.h:172
void ClearSelected()
Definition: eda_item.h:181
Schematic editor (Eeschema) main window.
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: eda_item.h:114
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SetSelected()
Definition: eda_item.h:178
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.
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
EDA_ITEM * GetParent() const
Definition: eda_item.h:164
bool HasFlag(STATUS_FLAGS aFlag) const
Definition: eda_item.h:205
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162
The symbol library editor main window.

◆ 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 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
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.

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

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ setTransitions()

void SCH_MOVE_TOOL::setTransitions ( )
overrideprivatevirtual

This method is meant to be overridden in order to specify handlers for events.

It is called every time tool is reset or finished.

Implements TOOL_INTERACTIVE.

Definition at line 875 of file sch_move_tool.cpp.

876 {
878  Go( &SCH_MOVE_TOOL::Main, EE_ACTIONS::move.MakeEvent() );
879  Go( &SCH_MOVE_TOOL::Main, EE_ACTIONS::drag.MakeEvent() );
881 }
static TOOL_ACTION moveActivate
Definition: ee_actions.h:111
int Main(const TOOL_EVENT &aEvent)
Run an interactive move of the selected items, or the item under the cursor.
static TOOL_ACTION alignToGrid
Definition: ee_actions.h:109
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).
int AlignElements(const TOOL_EVENT &aEvent)
Align selected elements to the grid.
static TOOL_ACTION drag
Definition: ee_actions.h:113
static TOOL_ACTION move
Definition: ee_actions.h:112

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 102 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_MANAGER * m_toolMgr
Definition: tool_base.h:215
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 GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PL_POINT_EDITOR::Main(), CVPCB_CONTROL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), Main(), PL_SELECTION_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PCB_PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_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(), SCH_DRAWING_TOOLS::PlaceComponent(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), PCB_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

Member Data Documentation

◆ m_anchorPos

boost::optional<VECTOR2I> SCH_MOVE_TOOL::m_anchorPos
private

Definition at line 91 of file sch_move_tool.h.

Referenced by Main().

◆ m_cursor

VECTOR2I SCH_MOVE_TOOL::m_cursor
private

Definition at line 89 of file sch_move_tool.h.

Referenced by Main().

◆ m_dragAdditions

EDA_ITEMS SCH_MOVE_TOOL::m_dragAdditions
private

Used for chaining commands.

Definition at line 82 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 174 of file ee_tool_base.h.

◆ m_isDragOperation

bool SCH_MOVE_TOOL::m_isDragOperation
private

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

Definition at line 79 of file sch_move_tool.h.

Referenced by Main().

◆ m_isSymbolEditor

bool EE_TOOL_BASE< SCH_EDIT_FRAME >::m_isSymbolEditor
protectedinherited

Definition at line 177 of file ee_tool_base.h.

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

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

Definition at line 106 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(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), ROUTER_TOOL::Init(), LENGTH_TUNER_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), PICKER_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PAD_TOOL::Init(), PL_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_CONTROL::Init(), SYMBOL_EDITOR_DRAWING_TOOLS::Init(), PCB_VIEWER_TOOLS::Init(), FOOTPRINT_EDITOR_CONTROL::Init(), PL_SELECTION_TOOL::Init(), SCH_DRAWING_TOOLS::Init(), GERBVIEW_SELECTION_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), EDA_3D_CONTROLLER::Init(), DRAWING_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), PCB_SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), PCB_TOOL_BASE::Init(), PL_EDIT_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), Main(), PL_SELECTION_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PCB_PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_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(), SCH_DRAWING_TOOLS::PlaceComponent(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ m_moveInProgress

bool SCH_MOVE_TOOL::m_moveInProgress
private

< Flag determining if anything is being dragged right now

Definition at line 78 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 85 of file sch_move_tool.h.

Referenced by Main().

◆ m_selectionTool

EE_SELECTION_TOOL* EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool
protectedinherited

Definition at line 176 of file ee_tool_base.h.

◆ m_specialCaseLabels

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

Definition at line 95 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 210 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 215 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), PL_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemsToSel(), PL_SELECTION_TOOL::AddItemToSel(), PCB_SELECTION_TOOL::AddItemToSel(), EE_SELECTION_TOOL::AddItemToSel(), AlignElements(), SCH_EDITOR_CONTROL::AssignNetclass(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), GERBVIEW_CONTROL::ClearAllLayers(), BOARD_INSPECTION_TOOL::ClearHighlight(), SCH_EDITOR_CONTROL::ClearHighlight(), PL_SELECTION_TOOL::ClearSelection(), PCB_SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), PL_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), MICROWAVE_TOOL::createInductorBetween(), BOARD_INSPECTION_TOOL::CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), SCH_EDITOR_CONTROL::Cut(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), SYMBOL_EDITOR_EDIT_TOOL::DoDelete(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), BOARD_INSPECTION_TOOL::doHideNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawRectangle(), DRAWING_TOOL::drawSegment(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), SYMBOL_EDITOR_EDIT_TOOL::editGraphicProperties(), PAD_TOOL::EditPad(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithLibEdit(), GROUP_TOOL::EnterGroup(), SCH_NAVIGATE_TOOL::EnterSheet(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), PCB_SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), PCB_SELECTION_TOOL::filterSelection(), PCB_SELECTION_TOOL::findCallback(), SCH_EDITOR_CONTROL::FindComponentAndItem(), PCB_POINT_EDITOR::finishItem(), 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(), COMMON_TOOLS::GridNext(), COMMON_TOOLS::GridPreset(), COMMON_TOOLS::GridPrev(), PCB_CONTROL::GridSetOrigin(), GROUP_TOOL::Group(), EE_SELECTION_TOOL::GuessSelectionCandidates(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::HighlightItem(), BOARD_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), BOARD_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), PL_EDIT_TOOL::ImportWorksheetContent(), SYMBOL_EDITOR_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PAD_TOOL::Init(), GROUP_TOOL::Init(), CONVERT_TOOL::Init(), PL_DRAWING_TOOLS::Init(), GLOBAL_EDIT_TOOL::Init(), SYMBOL_EDITOR_CONTROL::Init(), PL_POINT_EDITOR::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), PCB_POINT_EDITOR::Init(), POSITION_RELATIVE_TOOL::Init(), BOARD_INSPECTION_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), EDIT_TOOL::isRouterActive(), TOOL_BASE::IsToolActive(), GROUP_TOOL::LeaveGroup(), SCH_NAVIGATE_TOOL::LeaveSheet(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), PL_EDIT_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), CVPCB_CONTROL::Main(), Main(), PL_SELECTION_TOOL::Main(), PCB_PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), BOARD_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), SYMBOL_EDITOR_CONTROL::OnDeMorgan(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performRouting(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_EDIT_TOOL::PinTable(), PCB_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCB_CONTROL::Print(), GERBVIEW_CONTROL::Print(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EE_SELECTION_TOOL::RebuildSelection(), SYMBOL_EDITOR_EDIT_TOOL::Redo(), SCH_EDITOR_CONTROL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), GERBVIEW_CONTROL::ReloadAllLayers(), EDIT_TOOL::Remove(), PCB_POINT_EDITOR::removeCorner(), GROUP_TOOL::RemoveFromGroup(), PL_SELECTION_TOOL::RemoveItemFromSel(), EE_SELECTION_TOOL::RemoveItemFromSel(), PCB_SELECTION_TOOL::RemoveItemFromSel(), PL_SELECTION_TOOL::RemoveItemsFromSel(), EE_SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), PCB_SELECTION_TOOL::RequestSelection(), COMMON_TOOLS::Reset(), PNS::TOOL_BASE::Reset(), EDA_3D_CONTROLLER::Reset(), COMMON_TOOLS::ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), SYMBOL_EDITOR_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), DRC_TOOL::RunTests(), EE_SELECTION_TOOL::SelectConnection(), PCB_TOOL_BASE::selection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), PCB_SELECTION_TOOL::SelectItems(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectNet(), PL_SELECTION_TOOL::SelectPoint(), GERBVIEW_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::selectPoint(), PCB_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(), EDA_3D_CONTROLLER::ToggleVisibility(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_EDIT_TOOL::Undo(), SCH_EDITOR_CONTROL::Undo(), GROUP_TOOL::Ungroup(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), PCB_SELECTION_TOOL::UnselectItems(), PNS::TOOL_BASE::updateEndItem(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCB_CONTROL::UpdateMessagePanel(), BOARD_INSPECTION_TOOL::UpdateSelectionRatsnest(), 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 214 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 207 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 175 of file ee_tool_base.h.


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