KiCad PCB EDA Suite
SCH_LINE_WIRE_BUS_TOOL Class Reference

SCH_LINE_DRAWING_TOOL. More...

#include <sch_line_wire_bus_tool.h>

Inheritance diagram for SCH_LINE_WIRE_BUS_TOOL:
EE_TOOL_BASE< SCH_EDIT_FRAME > TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 

Determines the reason of reset for a tool

More...
 

Public Member Functions

 SCH_LINE_WIRE_BUS_TOOL ()
 
 ~SCH_LINE_WIRE_BUS_TOOL ()
 
bool Init () override
 Function Init() Init() is called once upon a registration of the tool. More...
 
int DrawSegments (const TOOL_EVENT &aEvent)
 
int UnfoldBus (const TOOL_EVENT &aEvent)
 
int AddJunctionsIfNeeded (const TOOL_EVENT &aEvent)
 Handle the addition of junctions to a selection of objects. More...
 
void Reset (RESET_REASON aReason) override
 Function Reset() Brings the tool to a known, initial state. More...
 
void Activate ()
 Function Activate() Runs the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Function SetContextMenu() More...
 
void RunMainStack (std::function< void()> aFunc)
 Function RunMainStack() More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Go() More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Wait() More...
 
TOOL_TYPE GetType () const
 Function GetType() Returns the type of the tool. More...
 
TOOL_ID GetId () const
 Function GetId() Returns the unique identifier of the tool. More...
 
const std::string & GetName () const
 Function GetName() Returns the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

Static Public Member Functions

static bool IsDrawingLine (const SELECTION &aSelection)
 
static bool IsDrawingWire (const SELECTION &aSelection)
 
static bool IsDrawingBus (const SELECTION &aSelection)
 
static bool IsDrawingLineWireOrBus (const SELECTION &aSelection)
 

Protected Member Functions

void updateView (EDA_ITEM *aItem) const
 

Similar to getView()->Update(), but handles items that are redrawn by their parents.

More...
 
void saveCopyInUndoList (EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
 

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

More...
 
void attachManager (TOOL_MANAGER *aManager)
 Function attachManager() More...
 
KIGFX::VIEWgetView () const
 Function getView() More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Function getViewControls() More...
 
template<typename T >
T * getEditFrame () const
 Function getEditFrame() More...
 
template<typename T >
T * getModel () const
 Function getModel() More...
 

Protected Attributes

SCH_EDIT_FRAMEm_frame
 
KIGFX::SCH_VIEWm_view
 
EE_SELECTION_TOOLm_selectionTool
 
bool m_isLibEdit
 
TOOL_MENU m_menu
 functions below are not yet implemented - their interface may change More...
 
TOOL_TYPE m_type
 

Stores the type of the tool.

More...
 
TOOL_ID m_toolId
 

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

More...
 
std::string m_toolName
 

Name of the tool.

More...
 
TOOL_MANAGERm_toolMgr
 

Private Member Functions

int doDrawSegments (const std::string &aTool, int aType)
 
SCH_LINEstartSegments (int aType, const VECTOR2D &aPos)
 
SCH_LINEdoUnfoldBus (const wxString &aNet)
 
void finishSegments ()
 
void simplifyWireList ()
 Iterates over the wire list and removes the null segments and overlapping segments to create a simplified wirelist. More...
 
void setTransitions () override
 

Sets up handlers for various events.

More...
 
const SCH_SHEET_PINgetSheetPin (const wxPoint &aPosition)
 Searches for a sheet pin at a location. More...
 
void computeBreakPoint (const std::pair< SCH_LINE *, SCH_LINE * > &aSegments, wxPoint &aPosition)
 Function ComputeBreakPoint computes the middle coordinate for 2 segments from the start point to aPosition with the segments kept in the horizontal or vertical axis only. More...
 

Private Attributes

BUS_UNFOLDING_T m_busUnfold
 Data related to bus unfolding tool. More...
 
std::vector< SCH_LINE * > m_wires
 Storage for the line segments while drawing. More...
 

Detailed Description

SCH_LINE_DRAWING_TOOL.

Tool responsible for drawing/placing items (symbols, wires, buses, labels, etc.)

Definition at line 69 of file sch_line_wire_bus_tool.h.

Member Enumeration Documentation

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determines 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 79 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ SCH_LINE_WIRE_BUS_TOOL()

SCH_LINE_WIRE_BUS_TOOL::SCH_LINE_WIRE_BUS_TOOL ( )

Definition at line 168 of file sch_line_wire_bus_tool.cpp.

168  :
169  EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.InteractiveDrawingLineWireBus" )
170 {
171  m_busUnfold = {};
172  m_wires.reserve( 16 );
173 }
std::vector< SCH_LINE * > m_wires
Storage for the line segments while drawing.
BUS_UNFOLDING_T m_busUnfold
Data related to bus unfolding tool.

References m_busUnfold, and m_wires.

◆ ~SCH_LINE_WIRE_BUS_TOOL()

SCH_LINE_WIRE_BUS_TOOL::~SCH_LINE_WIRE_BUS_TOOL ( )

Definition at line 176 of file sch_line_wire_bus_tool.cpp.

177 {
178 }

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Function Activate() Runs 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:219
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls 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(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), LIB_TREE::onContextMenu(), POINT_EDITOR::OnSelectionChange(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and UnfoldBus().

◆ AddJunctionsIfNeeded()

int SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded ( const TOOL_EVENT aEvent)

Handle the addition of junctions to a selection of objects.

Definition at line 899 of file sch_line_wire_bus_tool.cpp.

900 {
901  EE_SELECTION* aSelection = aEvent.Parameter<EE_SELECTION*>();
902 
903  std::vector<wxPoint> pts;
904  std::vector<wxPoint> connections = m_frame->GetSchematicConnections();
905 
906  for( unsigned ii = 0; ii < aSelection->GetSize(); ii++ )
907  {
908  SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aSelection->GetItem( ii ) );
909 
910  if( !item || !item->IsConnectable() )
911  continue;
912 
913  std::vector<wxPoint> new_pts = item->GetConnectionPoints();
914  pts.insert( pts.end(), new_pts.begin(), new_pts.end() );
915 
916  // If the item is a line, we also add any connection points from the rest of the schematic
917  // that terminate on the line after it is moved.
918  if( item->Type() == SCH_LINE_T )
919  {
920  SCH_LINE* line = (SCH_LINE*) item;
921  for( auto i : connections )
922  {
923  if( IsPointOnSegment( line->GetStartPoint(), line->GetEndPoint(), i ) )
924  pts.push_back( i );
925  }
926  }
927  else
928  {
929  // Clean up any wires that short non-wire connections in the list
930  for( auto point = new_pts.begin(); point != new_pts.end(); point++ )
931  {
932  for( auto second_point = point + 1; second_point != new_pts.end(); second_point++ )
933  m_frame->TrimWire( *point, *second_point );
934  }
935  }
936  }
937 
938  // We always have some overlapping connection points. Drop duplicates here
939  std::sort( pts.begin(), pts.end(), []( const wxPoint& a, const wxPoint& b ) -> bool {
940  return a.x < b.x || ( a.x == b.x && a.y < b.y );
941  } );
942 
943  pts.erase( unique( pts.begin(), pts.end() ), pts.end() );
944 
945  for( auto point : pts )
946  {
947  if( m_frame->GetScreen()->IsJunctionNeeded( point, true ) )
948  m_frame->AddJunction( m_frame->GetScreen(), point, true, false );
949  }
950 
951  return 0;
952 }
virtual bool IsConnectable() const
Definition: sch_item.h:377
virtual std::vector< wxPoint > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
Definition: sch_item.h:386
wxPoint GetStartPoint() const
Definition: sch_line.h:94
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:373
bool IsPointOnSegment(const wxPoint &aSegStart, const wxPoint &aSegEnd, const wxPoint &aTestPoint)
Test if aTestPoint is on line defined by aSegStart and aSegEnd.
Definition: trigo.cpp:42
SCH_JUNCTION * AddJunction(SCH_SCREEN *aScreen, const wxPoint &aPos, bool aAppendToUndo, bool aFinal=true)
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
std::vector< wxPoint > GetSchematicConnections()
Collects a unique list of all possible connection points in the schematic.
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
Definition: selection.h:105
virtual unsigned int GetSize() const override
Function GetSize() Returns the number of stored items.
Definition: selection.h:100
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
bool TrimWire(const wxPoint &aStart, const wxPoint &aEnd)
If any single wire passes through both points, remove the portion between the two points,...
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:194
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193
wxPoint GetEndPoint() const
Definition: sch_line.h:97

References SCH_EDIT_FRAME::AddJunction(), SCH_ITEM::GetConnectionPoints(), SCH_LINE::GetEndPoint(), SELECTION::GetItem(), SCH_EDIT_FRAME::GetSchematicConnections(), SCH_EDIT_FRAME::GetScreen(), SELECTION::GetSize(), SCH_LINE::GetStartPoint(), SCH_ITEM::IsConnectable(), SCH_SCREEN::IsJunctionNeeded(), IsPointOnSegment(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_EVENT::Parameter(), SCH_LINE_T, SCH_EDIT_FRAME::TrimWire(), EDA_ITEM::Type(), wxPoint::x, and wxPoint::y.

Referenced by setTransitions().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Function attachManager()

Sets 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:219

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ computeBreakPoint()

void SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint ( const std::pair< SCH_LINE *, SCH_LINE * > &  aSegments,
wxPoint aPosition 
)
private

Function ComputeBreakPoint computes the middle coordinate for 2 segments from the start point to aPosition with the segments kept in the horizontal or vertical axis only.

Parameters
aSegmentsA pair of pointers to a SCH_LINE objects containing the first line break point to compute.
aPositionA reference to a wxPoint object containing the coordinates of the position used to calculate the line break point.

Definition at line 403 of file sch_line_wire_bus_tool.cpp.

405 {
406  wxCHECK_RET( aSegments.first && aSegments.second,
407  wxT( "Cannot compute break point of NULL line segment." ) );
408 
409  SCH_LINE* segment = aSegments.first;
410  SCH_LINE* next_segment = aSegments.second;
411 
412  wxPoint midPoint;
413  int iDx = segment->GetEndPoint().x - segment->GetStartPoint().x;
414  int iDy = segment->GetEndPoint().y - segment->GetStartPoint().y;
415 
416  const SCH_SHEET_PIN* connectedPin = getSheetPin( segment->GetStartPoint() );
417  auto force = connectedPin ? connectedPin->GetEdge() : SHEET_UNDEFINED_SIDE;
418 
419  if( force == SHEET_LEFT_SIDE || force == SHEET_RIGHT_SIDE )
420  {
421  if( aPosition.x == connectedPin->GetPosition().x ) // push outside sheet boundary
422  {
423  int direction = ( force == SHEET_LEFT_SIDE ) ? -1 : 1;
424  aPosition.x += KiROUND( getView()->GetGAL()->GetGridSize().x * direction );
425  }
426 
427  midPoint.x = aPosition.x;
428  midPoint.y = segment->GetStartPoint().y; // force horizontal
429  }
430  else if( iDy != 0 ) // keep the first segment orientation (vertical)
431  {
432  midPoint.x = segment->GetStartPoint().x;
433  midPoint.y = aPosition.y;
434  }
435  else if( iDx != 0 ) // keep the first segment orientation (horizontal)
436  {
437  midPoint.x = aPosition.x;
438  midPoint.y = segment->GetStartPoint().y;
439  }
440  else
441  {
442  if( std::abs( aPosition.x - segment->GetStartPoint().x ) <
443  std::abs( aPosition.y - segment->GetStartPoint().y ) )
444  {
445  midPoint.x = segment->GetStartPoint().x;
446  midPoint.y = aPosition.y;
447  }
448  else
449  {
450  midPoint.x = aPosition.x;
451  midPoint.y = segment->GetStartPoint().y;
452  }
453  }
454 
455  segment->SetEndPoint( midPoint );
456  next_segment->SetStartPoint( midPoint );
457  next_segment->SetEndPoint( aPosition );
458 }
wxPoint GetStartPoint() const
Definition: sch_line.h:94
SHEET_SIDE GetEdge() const
void SetEndPoint(const wxPoint &aPosition)
Definition: sch_line.h:98
const SCH_SHEET_PIN * getSheetPin(const wxPoint &aPosition)
Searches for a sheet pin at a location.
void SetStartPoint(const wxPoint &aPosition)
Definition: sch_line.h:95
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:84
wxPoint GetPosition() const override
Definition: sch_text.h:313
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68
wxPoint GetEndPoint() const
Definition: sch_line.h:97

References SCH_SHEET_PIN::GetEdge(), SCH_LINE::GetEndPoint(), SCH_TEXT::GetPosition(), getSheetPin(), SCH_LINE::GetStartPoint(), TOOL_BASE::getView(), KiROUND(), SCH_LINE::SetEndPoint(), SCH_LINE::SetStartPoint(), SHEET_LEFT_SIDE, SHEET_RIGHT_SIDE, SHEET_UNDEFINED_SIDE, wxPoint::x, and wxPoint::y.

Referenced by doDrawSegments().

◆ doDrawSegments()

int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments ( const std::string &  aTool,
int  aType 
)
private

Definition at line 461 of file sch_line_wire_bus_tool.cpp.

462 {
463  SCH_SCREEN* screen = m_frame->GetScreen();
465  SCH_LINE* segment = nullptr;
466  EE_GRID_HELPER grid( m_toolMgr );
467 
469 
471  controls->ShowCursor( true );
472 
473 
474  Activate();
475 
476  // Add the new label to the selection so the rotate command operates on it
477  if( m_busUnfold.label )
479 
480  // Continue the existing wires if we've started (usually by immediate action preference)
481  if( !m_wires.empty() )
482  segment = m_wires.back();
483 
484  // Main loop: keep receiving events
485  while( TOOL_EVENT* evt = Wait() )
486  {
487  if( !pointEditor->HasPoint() ) // Set wxCursor shape when starting the tool
488  m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
489 
490  grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
491  wxPoint cursorPos = wxPoint( grid.BestSnapAnchor(
492  evt->IsPrime() ? evt->Position() : controls->GetMousePosition(), nullptr ) );
493  controls->ForceCursorPosition( true, cursorPos );
494 
495  bool forceHV = m_frame->eeconfig()->m_Drawing.hv_lines_only;
496 
497  //------------------------------------------------------------------------
498  // Handle cancel:
499  //
500  auto cleanup = [&] () {
502 
503  for( auto wire : m_wires )
504  delete wire;
505 
506  m_wires.clear();
507  segment = nullptr;
508 
509  if( m_busUnfold.entry )
511 
514 
517 
518  delete m_busUnfold.entry;
519  delete m_busUnfold.label;
520  m_busUnfold = {};
521 
522  m_view->ClearPreview();
523  m_view->ShowPreview( false );
524  };
525 
526  if( evt->IsCancelInteractive() )
527  {
528  if( segment || m_busUnfold.in_progress )
529  cleanup();
530  else
531  {
532  m_frame->PopTool( aTool );
533  break;
534  }
535  }
536  else if( evt->IsActivate() )
537  {
538  if( segment || m_busUnfold.in_progress )
539  cleanup();
540 
541  if( evt->IsMoveTool() )
542  {
543  // leave ourselves on the stack so we come back after the move
544  break;
545  }
546  else
547  {
548  m_frame->PopTool( aTool );
549  break;
550  }
551  }
552  //------------------------------------------------------------------------
553  // Handle finish:
554  //
555  else if( evt->IsAction( &EE_ACTIONS::finishLineWireOrBus )
556  || evt->IsAction( &EE_ACTIONS::finishWire )
557  || evt->IsAction( &EE_ACTIONS::finishBus )
558  || evt->IsAction( &EE_ACTIONS::finishLine ) )
559  {
560  if( segment || m_busUnfold.in_progress )
561  {
562  finishSegments();
563  segment = nullptr;
564  }
565  }
566  //------------------------------------------------------------------------
567  // Handle click:
568  //
569  else if( evt->IsClick( BUT_LEFT ) || ( segment && evt->IsDblClick( BUT_LEFT ) ) )
570  {
571  // First click when unfolding places the label and wire-to-bus entry
573  {
574  wxASSERT( aType == LAYER_WIRE );
575 
576  m_frame->AddToScreen( m_busUnfold.label, screen );
578  m_busUnfold.label_placed = true;
579  }
580 
581  if( !segment )
582  {
583  segment = startSegments( aType, VECTOR2D( cursorPos ) );
584  }
585  // Create a new segment if we're out of previously-created ones
586  else if( !segment->IsNull() || ( forceHV && !m_wires[ m_wires.size() - 2 ]->IsNull() ) )
587  {
588  // Terminate the command if the end point is on a pin, junction, or another
589  // wire or bus.
591  && screen->IsTerminalPoint( cursorPos, segment->GetLayer() ) )
592  {
593  finishSegments();
594  segment = nullptr;
595  }
596  else
597  {
598  segment->SetEndPoint( cursorPos );
599 
600  // Create a new segment, and chain it after the current segment.
601  segment = new SCH_LINE( *segment );
602  segment->SetFlags( IS_NEW | IS_MOVED );
603  segment->SetStartPoint( cursorPos );
604  m_wires.push_back( segment );
605 
606  m_selectionTool->AddItemToSel( segment, true /*quiet mode*/ );
607  }
608  }
609 
610  if( evt->IsDblClick( BUT_LEFT ) && segment )
611  {
612  if( forceHV && m_wires.size() >= 2 )
613  computeBreakPoint( { m_wires[ m_wires.size() - 2 ], segment }, cursorPos );
614 
615  finishSegments();
616  segment = nullptr;
617  }
618  }
619  //------------------------------------------------------------------------
620  // Handle motion:
621  //
622  else if( evt->IsMotion() || evt->IsAction( &ACTIONS::refreshPreview ) )
623  {
624  m_view->ClearPreview();
625 
626  // Update the bus unfold posture based on the mouse movement
628  {
629  wxPoint cursor_delta = cursorPos - m_busUnfold.origin;
631 
632  bool flipX = ( cursor_delta.x < 0 );
633  bool flipY = ( cursor_delta.y < 0 );
634 
635  // Erase and redraw if necessary
636  if( flipX != m_busUnfold.flipX || flipY != m_busUnfold.flipY )
637  {
638  wxSize size = entry->GetSize();
639  int ySign = flipY ? -1 : 1;
640  int xSign = flipX ? -1 : 1;
641 
642  size.x = std::abs( size.x ) * xSign;
643  size.y = std::abs( size.y ) * ySign;
644  entry->SetSize( size );
645 
646  m_busUnfold.flipY = flipY;
647  m_busUnfold.flipX = flipX;
648 
649  m_frame->UpdateItem( entry );
650  m_wires.front()->SetStartPoint( entry->GetEnd() );
651  }
652 
653  // Update the label "ghost" position
654  m_busUnfold.label->SetPosition( cursorPos );
656 
657  // Ensure segment is non-null at the start of bus unfold
658  if( !segment )
659  segment = m_wires.back();
660  }
661 
662  if( segment )
663  {
664  // Coerce the line to vertical or horizontal if necessary
665  if( forceHV && m_wires.size() >= 2 )
666  computeBreakPoint( { m_wires[ m_wires.size() - 2 ], segment }, cursorPos );
667  else
668  segment->SetEndPoint( cursorPos );
669  }
670 
671  for( auto wire : m_wires )
672  {
673  if( !wire->IsNull() )
674  m_view->AddToPreview( wire->Clone() );
675  }
676  }
677  //------------------------------------------------------------------------
678  // Handle context menu:
679  //
680  else if( evt->IsClick( BUT_RIGHT ) )
681  {
682  // Warp after context menu only if dragging...
683  if( !segment )
685 
687  }
688  else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CHOICE_MENU_CHOICE )
689  {
690  if( evt->GetCommandId().get() >= ID_POPUP_SCH_UNFOLD_BUS
691  && evt->GetCommandId().get() <= ID_POPUP_SCH_UNFOLD_BUS_END )
692  {
693  wxASSERT_MSG( !segment, "Bus unfold event received when already drawing!" );
694 
695  aType = LAYER_WIRE;
696  wxString net = *evt->Parameter<wxString*>();
697  segment = doUnfoldBus( net );
698  }
699  }
700  else
701  evt->SetPassEvent();
702 
703  // Enable autopanning and cursor capture only when there is a segment to be placed
704  controls->SetAutoPan( segment != nullptr );
705  controls->CaptureCursor( segment != nullptr );
706  }
707 
708  controls->ForceCursorPosition( false );
709  return 0;
710 }
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
bool flipY
True if the bus entry should be flipped in the y-axis.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
virtual VECTOR2D GetMousePosition(bool aWorldCoordinates=true) const =0
Function GetMousePosition() Returns the current mouse pointer position.
void SetSize(const wxSize &aSize)
Definition: sch_bus_entry.h:73
void SetCurrentCursor(wxStockCursor aStockCursorID)
Function SetCurrentCursor Set the current cursor shape for this panel.
void AddToPreview(EDA_ITEM *aItem, bool aTakeOwnership=true)
Definition: view.cpp:1572
SCH_LINE * doUnfoldBus(const wxString &aNet)
std::vector< SCH_LINE * > m_wires
Storage for the line segments while drawing.
bool HasPoint()
Indicates the cursor is over an edit point.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
SCH_LINE * startSegments(int aType, const VECTOR2D &aPos)
static TOOL_ACTION finishLineWireOrBus
Definition: ee_actions.h:94
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
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,...
static TOOL_ACTION finishLine
Definition: ee_actions.h:97
void ShowPreview(bool aShow=true)
Definition: view.cpp:1586
EE_SELECTION & GetSelection()
Function GetSelection()
#define IS_NEW
New item, just created.
Definition: base_struct.h:117
EESCHEMA_SETTINGS * eeconfig() const
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: sch_text.cpp:718
wxPoint origin
Origin (on the bus) of the unfold.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:593
virtual void PopTool(const std::string &actionName)
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
TOOL_EVENT.
Definition: tool_event.h:171
void ClearPreview()
Definition: view.cpp:1553
VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (such a...
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Function ForceCursorPosition() Places the cursor immediately at a given point.
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
void computeBreakPoint(const std::pair< SCH_LINE *, SCH_LINE * > &aSegments, wxPoint &aPosition)
Function ComputeBreakPoint computes the middle coordinate for 2 segments from the start point to aPos...
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
SCH_BUS_WIRE_ENTRY * entry
int RemoveItemFromSel(const TOOL_EVENT &aEvent)
wxSize GetSize() const
Definition: sch_bus_entry.h:71
bool IsTerminalPoint(const wxPoint &aPosition, int aLayer)
Test if aPosition is a connection point on aLayer.
Definition: sch_screen.cpp:483
int AddItemToSel(const TOOL_EVENT &aEvent)
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_POINT_EDITOR.
void VetoContextMenuMouseWarp()
Disables mouse warping after the current context menu is closed.
Definition: tool_manager.h:413
Class for a wire to bus entry.
void Activate()
Function Activate() Runs the tool.
bool label_placed
True if user has placed the net label.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
static TOOL_ACTION finishBus
Definition: ee_actions.h:96
void SetPosition(const wxPoint &aPosition) override
Definition: sch_text.h:314
bool flipX
True if the bus entry should be flipped in the x-axis.
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
static TOOL_ACTION finishWire
Definition: ee_actions.h:95
BUS_UNFOLDING_T m_busUnfold
Data related to bus unfolding tool.
static TOOL_ACTION refreshPreview
Definition: actions.h:104
bool in_progress
True if bus unfold operation is running.
wxPoint GetEnd() const
#define IS_MOVED
Item being moved.
Definition: base_struct.h:116

References TOOL_INTERACTIVE::Activate(), EE_SELECTION_TOOL::AddItemToSel(), KIGFX::VIEW::AddToPreview(), SCH_BASE_FRAME::AddToScreen(), EE_GRID_HELPER::BestSnapAnchor(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), KIGFX::VIEW::ClearPreview(), EE_ACTIONS::clearSelection, SCH_LABEL::Clone(), computeBreakPoint(), doUnfoldBus(), SCH_BASE_FRAME::eeconfig(), BUS_UNFOLDING_T::entry, EE_ACTIONS::finishBus, EE_ACTIONS::finishLine, EE_ACTIONS::finishLineWireOrBus, finishSegments(), EE_ACTIONS::finishWire, BUS_UNFOLDING_T::flipX, BUS_UNFOLDING_T::flipY, KIGFX::VIEW_CONTROLS::ForceCursorPosition(), SCH_BASE_FRAME::GetCanvas(), SCH_BUS_ENTRY_BASE::GetEnd(), KIGFX::VIEW_CONTROLS::GetMousePosition(), SCH_EDIT_FRAME::GetScreen(), EE_SELECTION_TOOL::GetSelection(), SCH_BUS_ENTRY_BASE::GetSize(), TOOL_MANAGER::GetTool(), TOOL_BASE::getViewControls(), EE_POINT_EDITOR::HasPoint(), EESCHEMA_SETTINGS::DRAWING::hv_lines_only, ID_POPUP_SCH_UNFOLD_BUS, ID_POPUP_SCH_UNFOLD_BUS_END, BUS_UNFOLDING_T::in_progress, IS_MOVED, IS_NEW, SCH_SCREEN::IsTerminalPoint(), BUS_UNFOLDING_T::label, BUS_UNFOLDING_T::label_placed, LAYER_WIRE, m_busUnfold, EESCHEMA_SETTINGS::m_Drawing, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_INTERACTIVE::m_menu, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_view, m_wires, MD_SHIFT, BUS_UNFOLDING_T::origin, TOOLS_HOLDER::PopTool(), ACTIONS::refreshPreview, SCH_BASE_FRAME::RemoveFromScreen(), EE_SELECTION_TOOL::RemoveItemFromSel(), TOOL_MANAGER::RunAction(), KIGFX::VIEW_CONTROLS::SetAutoPan(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), SCH_TEXT::SetPosition(), SCH_BUS_ENTRY_BASE::SetSize(), EE_GRID_HELPER::SetSnap(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), KIGFX::VIEW::ShowPreview(), startSegments(), TA_CHOICE_MENU_CHOICE, TC_COMMAND, SCH_BASE_FRAME::UpdateItem(), TOOL_MANAGER::VetoContextMenuMouseWarp(), TOOL_INTERACTIVE::Wait(), wxPoint::x, and wxPoint::y.

Referenced by DrawSegments(), and UnfoldBus().

◆ doUnfoldBus()

SCH_LINE * SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus ( const wxString &  aNet)
private

Definition at line 357 of file sch_line_wire_bus_tool.cpp.

358 {
359  SCHEMATIC_SETTINGS& cfg = getModel<SCHEMATIC>()->Settings();
361 
363 
364  m_busUnfold.entry = new SCH_BUS_WIRE_ENTRY( pos );
367 
373 
374  m_busUnfold.in_progress = true;
375  m_busUnfold.origin = pos;
376  m_busUnfold.net_name = aNet;
377 
379 
381 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
SCH_LINE * startSegments(int aType, const VECTOR2D &aPos)
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:238
virtual void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:196
#define IS_NEW
New item, just created.
Definition: base_struct.h:117
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
wxPoint origin
Origin (on the bus) of the unfold.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:232
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Moves the graphic crosshair cursor to the requested position expressed in world coordinates.
wxString net_name
Net label for the unfolding operation.
SCH_BUS_WIRE_ENTRY * entry
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,...
These settings were stored in SCH_BASE_FRAME previously.
Class for a wire to bus entry.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
virtual void SetLabelSpinStyle(LABEL_SPIN_STYLE aSpinStyle)
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
Definition: sch_text.cpp:229
BUS_UNFOLDING_T m_busUnfold
Data related to bus unfolding tool.
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
bool in_progress
True if bus unfold operation is running.
wxPoint GetEnd() const
#define IS_MOVED
Item being moved.
Definition: base_struct.h:116

References SCH_BASE_FRAME::AddToScreen(), EE_ACTIONS::clearSelection, BUS_UNFOLDING_T::entry, KIGFX::VIEW_CONTROLS::GetCursorPosition(), SCH_BUS_ENTRY_BASE::GetEnd(), SCH_EDIT_FRAME::GetScreen(), TOOL_BASE::getViewControls(), BUS_UNFOLDING_T::in_progress, IS_MOVED, IS_NEW, BUS_UNFOLDING_T::label, LAYER_WIRE, m_busUnfold, SCHEMATIC_SETTINGS::m_DefaultTextSize, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_BASE::m_toolMgr, BUS_UNFOLDING_T::net_name, BUS_UNFOLDING_T::origin, LABEL_SPIN_STYLE::RIGHT, TOOL_MANAGER::RunAction(), KIGFX::VIEW_CONTROLS::SetCrossHairCursorPosition(), EDA_ITEM::SetFlags(), SCH_TEXT::SetLabelSpinStyle(), EDA_ITEM::SetParent(), EDA_TEXT::SetTextSize(), and startSegments().

Referenced by doDrawSegments(), and UnfoldBus().

◆ DrawSegments()

int SCH_LINE_WIRE_BUS_TOOL::DrawSegments ( const TOOL_EVENT aEvent)

Definition at line 277 of file sch_line_wire_bus_tool.cpp.

278 {
279  SCH_LAYER_ID layer = aEvent.Parameter<SCH_LAYER_ID>();
280 
281  if( aEvent.HasPosition() )
282  getViewControls()->WarpCursor( aEvent.Position(), true );
283 
284  std::string tool = aEvent.GetCommandStr().get();
285  m_frame->PushTool( tool );
286 
287  if( aEvent.HasPosition() )
288  {
289  VECTOR2D cursorPos = getViewControls()->GetCursorPosition( !aEvent.Modifier( MD_ALT ) );
290  startSegments( layer, cursorPos );
291  }
292 
293  return doDrawSegments( tool, layer );
294 }
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
SCH_LINE * startSegments(int aType, const VECTOR2D &aPos)
virtual void WarpCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
Function WarpCursor() If enabled (.
int doDrawSegments(const std::string &aTool, int aType)
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
SCH_LAYER_ID
Eeschema drawing layers.
int Modifier(int aMask=MD_MODIFIER_MASK) const
Returns information about key modifiers state (Ctrl, Alt, etc.)
Definition: tool_event.h:342
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
bool HasPosition() const
Returns if it this event has a valid position (true for mouse events and context-menu or hotkey-based...
Definition: tool_event.h:260
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
const VECTOR2D Position() const
Returns mouse cursor position in world coordinates.
Definition: tool_event.h:274
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.

References doDrawSegments(), TOOL_EVENT::GetCommandStr(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), TOOL_BASE::getViewControls(), TOOL_EVENT::HasPosition(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, MD_ALT, TOOL_EVENT::Modifier(), TOOL_EVENT::Parameter(), TOOL_EVENT::Position(), TOOLS_HOLDER::PushTool(), startSegments(), and KIGFX::VIEW_CONTROLS::WarpCursor().

Referenced by setTransitions().

◆ finishSegments()

void SCH_LINE_WIRE_BUS_TOOL::finishSegments ( )
private

Definition at line 802 of file sch_line_wire_bus_tool.cpp.

803 {
804  // Clear selection when done so that a new wire can be started.
805  // NOTE: this must be done before simplifyWireList is called or we might end up with
806  // freed selected items.
808 
809  SCH_SCREEN* screen = m_frame->GetScreen();
810  PICKED_ITEMS_LIST itemList;
811 
812  // Remove segments backtracking over others
814 
815  // Collect the possible connection points for the new lines
816  std::vector< wxPoint > connections = m_frame->GetSchematicConnections();
817  std::vector< wxPoint > new_ends;
818 
819  // Check each new segment for possible junctions and add/split if needed
820  for( auto wire : m_wires )
821  {
822  if( wire->HasFlag( SKIP_STRUCT ) )
823  continue;
824 
825  std::vector<wxPoint> tmpends = wire->GetConnectionPoints();
826 
827  new_ends.insert( new_ends.end(), tmpends.begin(), tmpends.end() );
828 
829  for( auto i : connections )
830  {
831  if( IsPointOnSegment( wire->GetStartPoint(), wire->GetEndPoint(), i ) )
832  new_ends.push_back( i );
833  }
834  itemList.PushItem( ITEM_PICKER( screen, wire, UNDO_REDO::NEWITEM ) );
835  }
836 
838  {
839  wxASSERT( m_busUnfold.entry && m_busUnfold.label );
840 
841  itemList.PushItem( ITEM_PICKER( screen, m_busUnfold.entry, UNDO_REDO::NEWITEM ) );
842  itemList.PushItem( ITEM_PICKER( screen, m_busUnfold.label, UNDO_REDO::NEWITEM ) );
844  }
845 
846  // Get the last non-null wire (this is the last created segment).
847  if( !m_wires.empty() )
849 
850  // Add the new wires
851  for( auto wire : m_wires )
852  {
853  wire->ClearFlags( IS_NEW | IS_MOVED );
854  m_frame->AddToScreen( wire, screen );
855  }
856 
857  m_wires.clear();
858  m_view->ClearPreview();
859  m_view->ShowPreview( false );
860 
861  getViewControls()->CaptureCursor( false );
862  getViewControls()->SetAutoPan( false );
863 
864  m_frame->SaveCopyInUndoList( itemList, UNDO_REDO::NEWITEM, false );
865 
866  // Correct and remove segments that need to be merged.
868 
869  for( auto item : m_frame->GetScreen()->Items().OfType( SCH_COMPONENT_T ) )
870  {
871  std::vector< wxPoint > pts = item->GetConnectionPoints();
872 
873  if( pts.size() > 2 )
874  continue;
875 
876  for( auto i = pts.begin(); i != pts.end(); i++ )
877  {
878  for( auto j = i + 1; j != pts.end(); j++ )
879  m_frame->TrimWire( *i, *j );
880  }
881  }
882 
883  for( auto i : new_ends )
884  {
885  if( m_frame->GetScreen()->IsJunctionNeeded( i, true ) )
886  m_frame->AddJunction( m_frame->GetScreen(), i, true, false );
887  }
888 
890  m_busUnfold = {};
891 
894 
895  m_frame->OnModify();
896 }
bool SchematicCleanUp(SCH_SCREEN *aScreen=nullptr)
Performs routine schematic cleaning including breaking wire and buses and deleting identical objects ...
void simplifyWireList()
Iterates over the wire list and removes the null segments and overlapping segments to create a simpli...
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:373
std::vector< SCH_LINE * > m_wires
Storage for the line segments while drawing.
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:128
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
EE_TYPE OfType(KICAD_T aType)
Definition: sch_rtree.h:219
bool IsPointOnSegment(const wxPoint &aSegStart, const wxPoint &aSegEnd, const wxPoint &aTestPoint)
Test if aTestPoint is on line defined by aSegStart and aSegEnd.
Definition: trigo.cpp:42
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
static const TOOL_EVENT SelectedItemsModified
Definition: actions.h:211
SCH_JUNCTION * AddJunction(SCH_SCREEN *aScreen, const wxPoint &aPos, bool aAppendToUndo, bool aFinal=true)
void ShowPreview(bool aShow=true)
Definition: view.cpp:1586
#define IS_NEW
New item, just created.
Definition: base_struct.h:117
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area.
void ClearPreview()
Definition: view.cpp:1553
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.
void SaveCopyForRepeatItem(SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
std::vector< wxPoint > GetSchematicConnections()
Collects a unique list of all possible connection points in the schematic.
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
SCH_BUS_WIRE_ENTRY * entry
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,...
EE_RTREE & Items()
Definition: sch_screen.h:158
bool TrimWire(const wxPoint &aStart, const wxPoint &aEnd)
If any single wire passes through both points, remove the portion between the two points,...
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
bool label_placed
True if user has placed the net label.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
void ClearEditFlags()
Definition: base_struct.h:251
void PostEvent(const TOOL_EVENT &aEvent)
Puts an event to the event queue to be processed at the end of event processing cycle.
Definition: tool_manager.h:273
BUS_UNFOLDING_T m_busUnfold
Data related to bus unfolding tool.
bool in_progress
True if bus unfold operation is running.
#define IS_MOVED
Item being moved.
Definition: base_struct.h:116

References SCH_EDIT_FRAME::AddJunction(), SCH_BASE_FRAME::AddToScreen(), KIGFX::VIEW_CONTROLS::CaptureCursor(), EDA_ITEM::ClearEditFlags(), KIGFX::VIEW::ClearPreview(), EE_ACTIONS::clearSelection, BUS_UNFOLDING_T::entry, SCH_EDIT_FRAME::GetSchematicConnections(), SCH_EDIT_FRAME::GetScreen(), TOOL_BASE::getViewControls(), BUS_UNFOLDING_T::in_progress, IS_MOVED, IS_NEW, SCH_SCREEN::IsJunctionNeeded(), IsPointOnSegment(), SCH_SCREEN::Items(), BUS_UNFOLDING_T::label, BUS_UNFOLDING_T::label_placed, m_busUnfold, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_BASE::m_toolMgr, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_view, m_wires, NEWITEM, EE_RTREE::OfType(), SCH_EDIT_FRAME::OnModify(), TOOL_MANAGER::PostEvent(), PICKED_ITEMS_LIST::PushItem(), TOOL_MANAGER::RunAction(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), SCH_EDIT_FRAME::SaveCopyInUndoList(), SCH_COMPONENT_T, SCH_EDIT_FRAME::SchematicCleanUp(), EVENTS::SelectedItemsModified, KIGFX::VIEW_CONTROLS::SetAutoPan(), KIGFX::VIEW::ShowPreview(), simplifyWireList(), SKIP_STRUCT, SCH_EDIT_FRAME::TestDanglingEnds(), and SCH_EDIT_FRAME::TrimWire().

Referenced by doDrawSegments().

◆ getEditFrame()

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

Function getEditFrame()

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

Definition at line 187 of file tool_base.h.

188  {
189 #if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
190  wxASSERT( dynamic_cast<T*>( getToolHolderInt() ) );
191 #endif
192  return static_cast<T*>( getToolHolderInt() );
193  }
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

Function GetId() Returns 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
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214

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

Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool.

Returns
Instance of the TOOL_MANAGER. If there is no TOOL_MANAGER associated, it returns NULL.

Definition at line 143 of file tool_base.h.

144  {
145  return m_toolMgr;
146  }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219

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

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 201 of file tool_base.h.

202  {
203  EDA_ITEM* m = getModelInt();
204 #if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
205  wxASSERT( dynamic_cast<T*>( m ) );
206 #endif
207  return static_cast<T*>( m );
208  }
EDA_ITEM * getModelInt() const
Definition: tool_base.cpp:54
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159

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

Function GetName() Returns 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 132 of file tool_base.h.

133  {
134  return m_toolName;
135  }
std::string m_toolName
Name of the tool.
Definition: tool_base.h:218

References TOOL_BASE::m_toolName.

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

◆ getSheetPin()

const SCH_SHEET_PIN * SCH_LINE_WIRE_BUS_TOOL::getSheetPin ( const wxPoint aPosition)
private

Searches for a sheet pin at a location.

Parameters
aPositiongrid point to search for existing sheet pin
Returns
Pointer to sheet pin or nullptr on failure

Definition at line 384 of file sch_line_wire_bus_tool.cpp.

385 {
386  SCH_SCREEN* screen = m_frame->GetScreen();
387 
388  for( auto item : screen->Items().Overlapping( SCH_SHEET_T, aPosition ) )
389  {
390  auto sheet = static_cast<SCH_SHEET*>( item );
391 
392  for( SCH_SHEET_PIN* pin : sheet->GetPins() )
393  {
394  if( pin->GetPosition() == aPosition )
395  return pin;
396  }
397  }
398 
399  return nullptr;
400 }
EE_TYPE Overlapping(const EDA_RECT &aRect)
Definition: sch_rtree.h:224
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:84
EE_RTREE & Items()
Definition: sch_screen.h:158

References SCH_EDIT_FRAME::GetScreen(), SCH_SCREEN::Items(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_RTREE::Overlapping(), and SCH_SHEET_T.

Referenced by computeBreakPoint().

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 110 of file tool_base.h.

111  {
112  return m_type;
113  }
TOOL_TYPE m_type
Stores the type of the tool.
Definition: tool_base.h:211

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

Function getView()

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

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::checkPart(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), computeBreakPoint(), COMMON_TOOLS::CursorControl(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_EDIT_TOOL::DoDelete(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), COMMON_TOOLS::doZoomFit(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), MICROWAVE_TOOL::drawMicrowaveInductor(), PL_DRAWING_TOOLS::DrawShape(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_EDITOR_CONTROL::FindComponentAndItem(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), PCBNEW_CONTROL::GridResetOrigin(), PCBNEW_CONTROL::GridSetOrigin(), SELECTION_TOOL::GuessSelectionCandidates(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), PCB_INSPECTION_TOOL::highlightNet(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), PL_EDIT_TOOL::moveItem(), COMMON_TOOLS::OnGridChanged(), POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), LIB_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PNS::TOOL_BASE::pickSingleItem(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), PCB_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), SELECTION_TOOL::Selectable(), SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::SelectAll(), PL_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), EE_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), PL_SELECTION_TOOL::unhighlight(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), SCH_EDITOR_CONTROL::UpdateFind(), EE_POINT_EDITOR::updateItem(), PL_POINT_EDITOR::updateItem(), POINT_EDITOR::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateView(), PCB_VIEWER_TOOLS::view(), PCB_TOOL_BASE::view(), SELECTION_TOOL::zoomFitSelection(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and SELECTION_TOOL::~SELECTION_TOOL().

◆ getViewControls()

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

Function getViewControls()

Returns 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:219
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:291

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

Referenced by EE_POINT_EDITOR::addCorner(), POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDITOR_CONTROL::AssignNetclass(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), EDIT_TOOL::copyToClipboard(), COMMON_TOOLS::CursorControl(), doDrawSegments(), EDIT_TOOL::doMoveSelection(), doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), DrawSegments(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), finishSegments(), PCB_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), COMMON_TOOLS::OnGridChanged(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), LENGTH_TUNER_TOOL::performTuning(), LIB_DRAWING_TOOLS::PlaceAnchor(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_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(), POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), SELECTION_TOOL::selectCursor(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PICKER_TOOL::setControls(), PCBNEW_PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateItem(), LIB_MOVE_TOOL::updateModificationPoint(), 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

Function Go()

Defines which state (aStateFunc) to go when a certain event arrives (aConditions). No conditions means any event.

Definition at line 129 of file tool_interactive.h.

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

References TOOL_INTERACTIVE::goInternal().

Referenced by LENGTH_TUNER_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), AUTOPLACE_TOOL::setTransitions(), PCB_REANNOTATE_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), LIB_PIN_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), EE_POINT_EDITOR::setTransitions(), PL_POINT_EDITOR::setTransitions(), COMMON_CONTROL::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), LIB_MOVE_TOOL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), CONVERT_TOOL::setTransitions(), DRC_TOOL::setTransitions(), POINT_EDITOR::setTransitions(), LIB_DRAWING_TOOLS::setTransitions(), MICROWAVE_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GERBVIEW_CONTROL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), SCH_MOVE_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), LIB_CONTROL::setTransitions(), LIB_EDIT_TOOL::setTransitions(), PL_EDIT_TOOL::setTransitions(), PAD_TOOL::setTransitions(), FOOTPRINT_EDITOR_TOOLS::setTransitions(), SCH_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), PCBNEW_CONTROL::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), setTransitions(), CVPCB_CONTROL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), PCB_INSPECTION_TOOL::setTransitions(), PCBNEW_PICKER_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), PCB_EDITOR_CONTROL::setTransitions(), DRAWING_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), SELECTION_TOOL::setTransitions(), PL_SELECTION_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), and EE_SELECTION_TOOL::setTransitions().

◆ Init()

bool SCH_LINE_WIRE_BUS_TOOL::Init ( )
overridevirtual

Function Init() 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 181 of file sch_line_wire_bus_tool.cpp.

182 {
184 
185  auto wireOrBusTool = [ this ] ( const SELECTION& aSel ) {
188  };
189 
190  auto lineTool = [ this ] ( const SELECTION& aSel ) {
192  };
193 
194  auto belowRootSheetCondition =
195  [&]( const SELECTION& aSel )
196  {
197  return m_frame->GetCurrentSheet().Last() != &m_frame->Schematic().Root();
198  };
199 
200  auto busSelection = EE_CONDITIONS::MoreThan( 0 )
202 
203  auto& ctxMenu = m_menu.GetMenu();
204 
205  // Build the tool menu
206  //
207  ctxMenu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 2 );
208 
209  ctxMenu.AddSeparator( 10 );
210  ctxMenu.AddItem( EE_ACTIONS::drawWire, wireOrBusTool && EE_CONDITIONS::Idle, 10 );
211  ctxMenu.AddItem( EE_ACTIONS::drawBus, wireOrBusTool && EE_CONDITIONS::Idle, 10 );
212  ctxMenu.AddItem( EE_ACTIONS::drawLines, lineTool && EE_CONDITIONS::Idle, 10 );
213  ctxMenu.AddItem( EE_ACTIONS::finishWire, IsDrawingWire, 10 );
214  ctxMenu.AddItem( EE_ACTIONS::finishBus, IsDrawingBus, 10 );
215  ctxMenu.AddItem( EE_ACTIONS::finishLine, IsDrawingLine, 10 );
216 
217  std::shared_ptr<BUS_UNFOLD_MENU> busUnfoldMenu = std::make_shared<BUS_UNFOLD_MENU>();
218  busUnfoldMenu->SetTool( this );
219  m_menu.AddSubMenu( busUnfoldMenu );
220  ctxMenu.AddMenu( busUnfoldMenu.get(), EE_CONDITIONS::Idle, 10 );
221 
222  ctxMenu.AddSeparator( 100 );
223  ctxMenu.AddItem( EE_ACTIONS::placeJunction, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
224  ctxMenu.AddItem( EE_ACTIONS::placeLabel, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
225  ctxMenu.AddItem( EE_ACTIONS::placeGlobalLabel, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
226  ctxMenu.AddItem( EE_ACTIONS::placeHierLabel, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
227  ctxMenu.AddItem( EE_ACTIONS::breakWire, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
228  ctxMenu.AddItem( EE_ACTIONS::breakBus, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
229 
230  ctxMenu.AddSeparator( 200 );
231  ctxMenu.AddItem( EE_ACTIONS::selectNode, wireOrBusTool && EE_CONDITIONS::Idle, 200 );
232  ctxMenu.AddItem( EE_ACTIONS::selectConnection, wireOrBusTool && EE_CONDITIONS::Idle, 200 );
233 
234  // Add bus unfolding to the selection tool
235  //
237 
238  std::shared_ptr<BUS_UNFOLD_MENU> selBusUnfoldMenu = std::make_shared<BUS_UNFOLD_MENU>();
239  selBusUnfoldMenu->SetTool( m_selectionTool );
240  m_selectionTool->GetToolMenu().AddSubMenu( selBusUnfoldMenu );
241  selToolMenu.AddMenu( selBusUnfoldMenu.get(), busSelection && EE_CONDITIONS::Idle, 100 );
242 
243  return true;
244 }
void AddMenu(ACTION_MENU *aMenu, const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Adds a submenu to the menu.
bool IsCurrentTool(const TOOL_ACTION &aAction) const
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
static bool IsDrawingWire(const SELECTION &aSelection)
static TOOL_ACTION breakBus
Definition: ee_actions.h:135
SCH_SHEET * Last() const
Function Last returns a pointer to the last sheet of the list One can see the others sheet as the "pa...
static SELECTION_CONDITION MoreThan(int aNumber)
Creates a functor that tests if the number of selected items is greater than the value given as param...
static bool Idle(const SELECTION &aSelection)
Tests if there no items selected or being edited.
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
static TOOL_ACTION placeHierLabel
Definition: ee_actions.h:87
static TOOL_ACTION placeJunction
Definition: ee_actions.h:83
static TOOL_ACTION selectConnection
If current selection is a wire or bus, expand to entire connection.
Definition: ee_actions.h:53
TOOL_MENU & GetToolMenu()
static bool IsDrawingLine(const SELECTION &aSelection)
static TOOL_ACTION breakWire
Definition: ee_actions.h:134
static TOOL_ACTION finishLine
Definition: ee_actions.h:97
static TOOL_ACTION leaveSheet
Definition: ee_actions.h:185
bool Init() override
Function Init() Init() is called once upon a registration of the tool.
Definition: ee_tool_base.h:69
static TOOL_ACTION drawWire
Definition: ee_actions.h:79
SCHEMATIC & Schematic() const
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
static bool IsDrawingBus(const SELECTION &aSelection)
static TOOL_ACTION drawBus
Definition: ee_actions.h:80
static TOOL_ACTION placeLabel
Definition: ee_actions.h:85
SCH_SHEET & Root() const
Definition: schematic.h:94
void AddSubMenu(std::shared_ptr< ACTION_MENU > aSubMenu)
Function CreateSubMenu.
Definition: tool_menu.cpp:52
static SELECTION_CONDITION OnlyType(KICAD_T aType)
Creates a functor that tests if the selected items are only of given type.
static TOOL_ACTION selectNode
Select the junction, wire or bus segment under the cursor.
Definition: ee_actions.h:49
SCH_SHEET_PATH & GetCurrentSheet() const
static TOOL_ACTION drawLines
Definition: ee_actions.h:92
static TOOL_ACTION placeGlobalLabel
Definition: ee_actions.h:86
static TOOL_ACTION finishBus
Definition: ee_actions.h:96
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Adds a menu entry to run a TOOL_ACTION on selected items.
static TOOL_ACTION finishWire
Definition: ee_actions.h:95

References CONDITIONAL_MENU::AddItem(), CONDITIONAL_MENU::AddMenu(), TOOL_MENU::AddSubMenu(), EE_ACTIONS::breakBus, EE_ACTIONS::breakWire, EE_ACTIONS::drawBus, EE_ACTIONS::drawLines, EE_ACTIONS::drawWire, EE_ACTIONS::finishBus, EE_ACTIONS::finishLine, EE_ACTIONS::finishWire, SCH_EDIT_FRAME::GetCurrentSheet(), TOOL_MENU::GetMenu(), TOOL_INTERACTIVE::GetToolMenu(), SELECTION_CONDITIONS::Idle(), EE_TOOL_BASE< T >::Init(), TOOLS_HOLDER::IsCurrentTool(), IsDrawingBus(), IsDrawingLine(), IsDrawingWire(), SCH_SHEET_PATH::Last(), EE_ACTIONS::leaveSheet, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_INTERACTIVE::m_menu, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, SELECTION_CONDITIONS::MoreThan(), SELECTION_CONDITIONS::OnlyType(), EE_ACTIONS::placeGlobalLabel, EE_ACTIONS::placeHierLabel, EE_ACTIONS::placeJunction, EE_ACTIONS::placeLabel, SCHEMATIC::Root(), SCH_LINE_LOCATE_BUS_T, SCH_EDIT_FRAME::Schematic(), EE_ACTIONS::selectConnection, and EE_ACTIONS::selectNode.

◆ IsDrawingBus()

bool SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus ( const SELECTION aSelection)
static

Definition at line 261 of file sch_line_wire_bus_tool.cpp.

262 {
263  static KICAD_T busType[] = { SCH_LINE_LOCATE_BUS_T, EOT };
264  return IsDrawingLineWireOrBus( aSelection ) && aSelection.Front()->IsType( busType );
265 }
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
virtual bool IsType(const KICAD_T aScanTypes[]) const
Function IsType Checks whether the item is one of the listed types.
Definition: base_struct.h:262
static bool IsDrawingLineWireOrBus(const SELECTION &aSelection)
EDA_ITEM * Front() const
Definition: selection.h:184

References EOT, SELECTION::Front(), IsDrawingLineWireOrBus(), EDA_ITEM::IsType(), and SCH_LINE_LOCATE_BUS_T.

Referenced by EE_SELECTION_TOOL::Init(), and Init().

◆ IsDrawingLine()

bool SCH_LINE_WIRE_BUS_TOOL::IsDrawingLine ( const SELECTION aSelection)
static

Definition at line 247 of file sch_line_wire_bus_tool.cpp.

248 {
249  static KICAD_T graphicLineType[] = { SCH_LINE_LOCATE_GRAPHIC_LINE_T, EOT };
250  return IsDrawingLineWireOrBus( aSelection ) && aSelection.Front()->IsType( graphicLineType );
251 }
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
virtual bool IsType(const KICAD_T aScanTypes[]) const
Function IsType Checks whether the item is one of the listed types.
Definition: base_struct.h:262
static bool IsDrawingLineWireOrBus(const SELECTION &aSelection)
EDA_ITEM * Front() const
Definition: selection.h:184

References EOT, SELECTION::Front(), IsDrawingLineWireOrBus(), EDA_ITEM::IsType(), and SCH_LINE_LOCATE_GRAPHIC_LINE_T.

Referenced by Init().

◆ IsDrawingLineWireOrBus()

bool SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus ( const SELECTION aSelection)
static

Definition at line 268 of file sch_line_wire_bus_tool.cpp.

269 {
270  // NOTE: for immediate hotkeys, it is NOT required that the line, wire or bus tool
271  // be selected
272  SCH_ITEM* item = (SCH_ITEM*) aSelection.Front();
273  return item && item->IsNew() && item->Type() == SCH_LINE_T;
274 }
bool IsNew() const
Definition: base_struct.h:199
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:194
EDA_ITEM * Front() const
Definition: selection.h:184
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References SELECTION::Front(), EDA_ITEM::IsNew(), SCH_LINE_T, and EDA_ITEM::Type().

Referenced by SCH_EDIT_TOOL::Init(), SCH_MOVE_TOOL::Init(), IsDrawingBus(), IsDrawingLine(), and IsDrawingWire().

◆ IsDrawingWire()

bool SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire ( const SELECTION aSelection)
static

Definition at line 254 of file sch_line_wire_bus_tool.cpp.

255 {
256  static KICAD_T wireType[] = { SCH_LINE_LOCATE_WIRE_T, EOT };
257  return IsDrawingLineWireOrBus( aSelection ) && aSelection.Front()->IsType( wireType );
258 }
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
virtual bool IsType(const KICAD_T aScanTypes[]) const
Function IsType Checks whether the item is one of the listed types.
Definition: base_struct.h:262
static bool IsDrawingLineWireOrBus(const SELECTION &aSelection)
EDA_ITEM * Front() const
Definition: selection.h:184

References EOT, SELECTION::Front(), IsDrawingLineWireOrBus(), EDA_ITEM::IsType(), and SCH_LINE_LOCATE_WIRE_T.

Referenced by EE_SELECTION_TOOL::Init(), and Init().

◆ 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:219
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214
bool IsToolActive(TOOL_ID aId) const
Function IsToolActive() Returns 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::isRouterActive(), and ROUTER_TOOL::onViaCommand().

◆ Reset()

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

Function Reset() Brings 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 90 of file ee_tool_base.h.

91  {
92  if( aReason == MODEL_RELOAD )
93  {
94  // Init variables used by every drawing tool
95  m_frame = getEditFrame<T>();
96  m_isLibEdit = dynamic_cast<LIB_EDIT_FRAME*>( m_frame ) != nullptr;
97  }
98 
99  m_view = static_cast<KIGFX::SCH_VIEW*>( getView() );
100  }
Model changes (required full reload)
Definition: tool_base.h:82
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36

◆ RunMainStack()

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

Function RunMainStack()

Calls 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:219
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

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

Definition at line 117 of file ee_tool_base.h.

118  {
119  KICAD_T itemType = aItem->Type();
120  bool selected = aItem->IsSelected();
121 
122  // IS_SELECTED flag should not be set on undo items which were added for
123  // a drag operation.
124  if( selected && aItem->HasFlag( TEMP_SELECTED ))
125  aItem->ClearSelected();
126 
127  if( m_isLibEdit )
128  {
129  LIB_EDIT_FRAME* editFrame = dynamic_cast<LIB_EDIT_FRAME*>( m_frame );
130  wxASSERT( editFrame );
131 
132  editFrame->SaveCopyInUndoList( static_cast<LIB_ITEM*>( aItem ), aType, aAppend );
133  }
134  else
135  {
136  SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
137  wxASSERT( editFrame );
138 
139  if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
140  {
141  editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
142  static_cast<SCH_ITEM*>( aItem->GetParent() ),
143  UNDO_REDO::CHANGED, aAppend );
144  }
145  else
146  {
147  editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
148  static_cast<SCH_ITEM*>( aItem ),
149  aType, aAppend );
150  }
151  }
152 
153  if( selected && aItem->HasFlag( TEMP_SELECTED ) )
154  aItem->SetSelected();
155  }
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: base_struct.h:125
bool IsSelected() const
Definition: base_struct.h:203
void ClearSelected()
Definition: base_struct.h:211
void SaveCopyInUndoList(EDA_ITEM *ItemToCopy, UNDO_REDO undoType=UNDO_REDO::LIBEDIT, bool aAppend=false)
Create a copy of the current component, and save it in the undo list.
Schematic editor (Eeschema) main window.
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SetSelected()
Definition: base_struct.h:208
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: base_struct.h:195
The symbol library editor main window.
bool HasFlag(STATUS_FLAGS aFlag)
Definition: base_struct.h:235
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

◆ SetContextMenu()

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

Function SetContextMenu()

Assigns 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:219
void SetTool(TOOL_INTERACTIVE *aTool)
Sets a tool that is the creator of the menu.
void ScheduleContextMenu(TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Sets behaviour 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(), SELECTION_TOOL::doSelectionMenu(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), TOOL_MENU::ShowContextMenu(), and UnfoldBus().

◆ setTransitions()

void SCH_LINE_WIRE_BUS_TOOL::setTransitions ( )
overrideprivatevirtual

Sets up handlers for various events.

Implements TOOL_INTERACTIVE.

Definition at line 955 of file sch_line_wire_bus_tool.cpp.

956 {
961 
963 }
int AddJunctionsIfNeeded(const TOOL_EVENT &aEvent)
Handle the addition of junctions to a selection of objects.
static TOOL_ACTION unfoldBus
Definition: ee_actions.h:81
int UnfoldBus(const TOOL_EVENT &aEvent)
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
static TOOL_ACTION drawWire
Definition: ee_actions.h:79
static TOOL_ACTION addNeededJunctions
Definition: ee_actions.h:75
static TOOL_ACTION drawBus
Definition: ee_actions.h:80
static TOOL_ACTION drawLines
Definition: ee_actions.h:92
int DrawSegments(const TOOL_EVENT &aEvent)

References AddJunctionsIfNeeded(), EE_ACTIONS::addNeededJunctions, EE_ACTIONS::drawBus, EE_ACTIONS::drawLines, DrawSegments(), EE_ACTIONS::drawWire, TOOL_INTERACTIVE::Go(), UnfoldBus(), and EE_ACTIONS::unfoldBus.

◆ simplifyWireList()

void SCH_LINE_WIRE_BUS_TOOL::simplifyWireList ( )
private

Iterates over the wire list and removes the null segments and overlapping segments to create a simplified wirelist.

In a contiguous list of wires, remove wires that backtrack over the previous wire.

Example:

Wire is added: -------------------------------------—>

A second wire backtracks over it: ----------------—<====================>

simplifyWireList is called: ----------------—>

Definition at line 765 of file sch_line_wire_bus_tool.cpp.

766 {
767  for( auto it = m_wires.begin(); it != m_wires.end(); )
768  {
769  SCH_LINE* line = *it;
770 
771  if( line->IsNull() )
772  {
773  delete line;
774  it = m_wires.erase( it );
775  continue;
776  }
777 
778  auto next_it = it;
779  ++next_it;
780 
781  if( next_it == m_wires.end() )
782  break;
783 
784  SCH_LINE* next_line = *next_it;
785 
786  if( line->IsParallel( next_line ) )
787  {
788  if( SCH_LINE* merged = line->MergeOverlap( next_line ) )
789  {
790  delete line;
791  delete next_line;
792  it = m_wires.erase( it );
793  *it = merged;
794  }
795  }
796 
797  ++it;
798  }
799 }
SCH_LINE * MergeOverlap(SCH_LINE *aLine)
Check line against aLine to see if it overlaps and merge if it does.
Definition: sch_line.cpp:403
std::vector< SCH_LINE * > m_wires
Storage for the line segments while drawing.
bool IsParallel(SCH_LINE *aLine)
Definition: sch_line.cpp:390
bool IsNull() const
Definition: sch_line.h:92
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37

References SCH_LINE::IsNull(), SCH_LINE::IsParallel(), m_wires, and SCH_LINE::MergeOverlap().

Referenced by finishSegments().

◆ startSegments()

SCH_LINE * SCH_LINE_WIRE_BUS_TOOL::startSegments ( int  aType,
const VECTOR2D aPos 
)
private

Definition at line 713 of file sch_line_wire_bus_tool.cpp.

714 {
715  SCH_LINE* segment = nullptr;
716 
717  switch ( aType )
718  {
719  default:
720  segment = new SCH_LINE( aPos, LAYER_NOTES );
721  break;
722  case LAYER_WIRE:
723  segment = new SCH_LINE( aPos, LAYER_WIRE );
724  break;
725  case LAYER_BUS:
726  segment = new SCH_LINE( aPos, LAYER_BUS );
727  break;
728  }
729 
730  // Give segments a parent so they find the default line/wire/bus widths
731  segment->SetParent( &m_frame->Schematic() );
732  segment->SetFlags( IS_NEW | IS_MOVED );
733  m_wires.push_back( segment );
734 
735  m_selectionTool->AddItemToSel( segment, true /*quiet mode*/ );
736 
737  // We need 2 segments to go from a given start pin to an end point when the
738  // horizontal and vertical lines only switch is on.
740  {
741  segment = new SCH_LINE( *segment );
742  segment->SetFlags( IS_NEW | IS_MOVED );
743  m_wires.push_back( segment );
744 
745  m_selectionTool->AddItemToSel( segment, true /*quiet mode*/ );
746  }
747 
748  return segment;
749 }
std::vector< SCH_LINE * > m_wires
Storage for the line segments while drawing.
virtual void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:196
#define IS_NEW
New item, just created.
Definition: base_struct.h:117
EESCHEMA_SETTINGS * eeconfig() const
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:232
SCHEMATIC & Schematic() const
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
int AddItemToSel(const TOOL_EVENT &aEvent)
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
#define IS_MOVED
Item being moved.
Definition: base_struct.h:116

References EE_SELECTION_TOOL::AddItemToSel(), SCH_BASE_FRAME::eeconfig(), EESCHEMA_SETTINGS::DRAWING::hv_lines_only, IS_MOVED, IS_NEW, LAYER_BUS, LAYER_NOTES, LAYER_WIRE, EESCHEMA_SETTINGS::m_Drawing, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, m_wires, SCH_EDIT_FRAME::Schematic(), EDA_ITEM::SetFlags(), and EDA_ITEM::SetParent().

Referenced by doDrawSegments(), doUnfoldBus(), and DrawSegments().

◆ UnfoldBus()

int SCH_LINE_WIRE_BUS_TOOL::UnfoldBus ( const TOOL_EVENT aEvent)

Definition at line 297 of file sch_line_wire_bus_tool.cpp.

298 {
299  wxString* netPtr = aEvent.Parameter<wxString*>();
300  wxString net;
301  SCH_LINE* segment = nullptr;
302 
303  std::string tool = aEvent.GetCommandStr().get();
304  m_frame->PushTool( tool );
305  Activate();
306 
307  if( netPtr )
308  {
309  net = *netPtr;
310  delete netPtr;
311  }
312  else
313  {
314  BUS_UNFOLD_MENU unfoldMenu;
315  unfoldMenu.SetTool( this );
316  unfoldMenu.SetShowTitle();
317 
318  SetContextMenu( &unfoldMenu, CMENU_NOW );
319 
320  while( TOOL_EVENT* evt = Wait() )
321  {
322  if( evt->Action() == TA_CHOICE_MENU_CHOICE )
323  {
324  OPT<int> id = evt->GetCommandId();
325 
326  if( id && ( *id > 0 ) )
327  net = *evt->Parameter<wxString*>();
328 
329  break;
330  }
331  else if( evt->Action() == TA_CHOICE_MENU_CLOSED )
332  {
333  break;
334  }
335  else
336  {
337  evt->SetPassEvent();
338  }
339  }
340  }
341 
342  // Break a wire for the given net out of the bus
343  if( !net.IsEmpty() )
344  segment = doUnfoldBus( net );
345 
346  // If we have an unfolded wire to draw, then draw it
347  if( segment )
348  return doDrawSegments( tool, LAYER_WIRE );
349  else
350  {
351  m_frame->PopTool( tool );
352  return 0;
353  }
354 }
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
SCH_LINE * doUnfoldBus(const wxString &aNet)
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
void SetContextMenu(ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
Function SetContextMenu()
void SetTool(TOOL_INTERACTIVE *aTool)
Sets a tool that is the creator of the menu.
int doDrawSegments(const std::string &aTool, int aType)
virtual void PopTool(const std::string &actionName)
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
TOOL_EVENT.
Definition: tool_event.h:171
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
boost::optional< T > OPT
Definition: optional.h:7
void Activate()
Function Activate() Runs the tool.

References TOOL_INTERACTIVE::Activate(), CMENU_NOW, doDrawSegments(), doUnfoldBus(), TOOL_EVENT::GetCommandStr(), LAYER_WIRE, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_EVENT::Parameter(), TOOLS_HOLDER::PopTool(), TOOLS_HOLDER::PushTool(), TOOL_INTERACTIVE::SetContextMenu(), BUS_UNFOLD_MENU::SetShowTitle(), ACTION_MENU::SetTool(), TA_CHOICE_MENU_CHOICE, TA_CHOICE_MENU_CLOSED, and TOOL_INTERACTIVE::Wait().

Referenced by setTransitions().

◆ updateView()

void EE_TOOL_BASE< SCH_EDIT_FRAME >::updateView ( EDA_ITEM aItem) const
inlineprotectedinherited

Similar to getView()->Update(), but handles items that are redrawn by their parents.

Definition at line 104 of file ee_tool_base.h.

105  {
106  KICAD_T itemType = aItem->Type();
107 
108  if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
109  getView()->Update( aItem->GetParent() );
110 
111  getView()->Update( aItem );
112  }
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
EDA_ITEM * GetParent() const
Definition: base_struct.h:195
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1531
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

◆ Wait()

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

Function Wait()

Suspends 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:219
TOOL_EVENT * ScheduleWait(TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions)
Pauses 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(), doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), PL_EDIT_TOOL::Main(), CVPCB_CONTROL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickReferencePoint(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and UnfoldBus().

Member Data Documentation

◆ m_busUnfold

BUS_UNFOLDING_T SCH_LINE_WIRE_BUS_TOOL::m_busUnfold
private

Data related to bus unfolding tool.

Definition at line 128 of file sch_line_wire_bus_tool.h.

Referenced by doDrawSegments(), doUnfoldBus(), finishSegments(), and SCH_LINE_WIRE_BUS_TOOL().

◆ m_frame

SCH_EDIT_FRAME * EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame
protectedinherited

Definition at line 158 of file ee_tool_base.h.

◆ m_isLibEdit

bool EE_TOOL_BASE< SCH_EDIT_FRAME >::m_isLibEdit
protectedinherited

Definition at line 161 of file ee_tool_base.h.

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

functions below are not yet implemented - their interface may change

Definition at line 108 of file tool_interactive.h.

Referenced by doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), PICKER_TOOL::Init(), SCH_EDIT_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), PL_EDIT_TOOL::Init(), LIB_CONTROL::Init(), LIB_DRAWING_TOOLS::Init(), PCB_VIEWER_TOOLS::Init(), FOOTPRINT_EDITOR_TOOLS::Init(), PL_DRAWING_TOOLS::Init(), PCB_EDITOR_CONTROL::Init(), SCH_DRAWING_TOOLS::Init(), EDA_3D_CONTROLLER::Init(), GERBVIEW_SELECTION_TOOL::Init(), PL_SELECTION_TOOL::Init(), DRAWING_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), SELECTION_TOOL::Init(), Init(), PCB_TOOL_BASE::Init(), PL_EDIT_TOOL::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ m_selectionTool

EE_SELECTION_TOOL* EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool
protectedinherited

Definition at line 160 of file ee_tool_base.h.

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

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

Definition at line 214 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 219 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), PL_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemsToSel(), PL_SELECTION_TOOL::AddItemToSel(), EE_SELECTION_TOOL::AddItemToSel(), SELECTION_TOOL::AddItemToSel(), SCH_MOVE_TOOL::AlignElements(), SCH_EDITOR_CONTROL::AssignNetclass(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), PCB_INSPECTION_TOOL::ClearHighlight(), SCH_EDITOR_CONTROL::ClearHighlight(), SELECTION_TOOL::ClearSelection(), PL_SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), LIB_EDIT_TOOL::Copy(), PL_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), MICROWAVE_TOOL::createInductorBetween(), PCB_INSPECTION_TOOL::CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), SCH_EDITOR_CONTROL::Cut(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), LIB_EDIT_TOOL::DoDelete(), SCH_EDIT_TOOL::DoDelete(), doDrawSegments(), PCB_INSPECTION_TOOL::doHideNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), 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(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), PCB_EDITOR_CONTROL::EditFpInFpEditor(), LIB_EDIT_TOOL::editGraphicProperties(), PAD_TOOL::EditPad(), LIB_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithLibEdit(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), SELECTION_TOOL::filterSelection(), SELECTION_TOOL::findCallback(), SCH_EDITOR_CONTROL::FindComponentAndItem(), POINT_EDITOR::finishItem(), 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(), PCBNEW_CONTROL::GridSetOrigin(), PCB_EDITOR_CONTROL::GroupEnterSelected(), PCB_EDITOR_CONTROL::GroupFlattenSelected(), PCB_EDITOR_CONTROL::GroupLeave(), PCB_EDITOR_CONTROL::GroupMergeSelected(), PCB_EDITOR_CONTROL::GroupRemoveItemsSelected(), PCB_EDITOR_CONTROL::GroupSelected(), GERBVIEW_CONTROL::HighlightControl(), PCB_INSPECTION_TOOL::HighlightItem(), PCB_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), PL_EDIT_TOOL::ImportWorksheetContent(), LIB_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), CONVERT_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), LIB_CONTROL::Init(), PAD_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), PCB_INSPECTION_TOOL::Init(), PL_DRAWING_TOOLS::Init(), PL_POINT_EDITOR::Init(), POINT_EDITOR::Init(), PCB_EDITOR_CONTROL::Init(), POSITION_RELATIVE_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCB_INSPECTION_TOOL::InspectClearance(), PCB_INSPECTION_TOOL::InspectConstraints(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), EDIT_TOOL::isRouterActive(), TOOL_BASE::IsToolActive(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PL_EDIT_TOOL::Main(), CVPCB_CONTROL::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), LIB_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), LIB_CONTROL::OnDeMorgan(), COMMON_TOOLS::OnGridChanged(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), EDIT_TOOL::pickReferencePoint(), LIB_EDIT_TOOL::PinTable(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCBNEW_CONTROL::Print(), GERBVIEW_CONTROL::Print(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EE_SELECTION_TOOL::RebuildSelection(), LIB_EDIT_TOOL::Redo(), SCH_EDITOR_CONTROL::Redo(), SCH_EDIT_TOOL::RefreshSymbolFromLibrary(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), PL_SELECTION_TOOL::RemoveItemFromSel(), EE_SELECTION_TOOL::RemoveItemFromSel(), SELECTION_TOOL::RemoveItemFromSel(), PL_SELECTION_TOOL::RemoveItemsFromSel(), EE_SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_DRAWING_TOOLS::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), SELECTION_TOOL::RequestSelection(), COMMON_TOOLS::Reset(), PNS::TOOL_BASE::Reset(), EDA_3D_CONTROLLER::Reset(), COMMON_TOOLS::ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), LIB_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(), SELECTION_TOOL::SelectItems(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectNet(), PL_SELECTION_TOOL::SelectPoint(), GERBVIEW_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::SelectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), SELECTION_TOOL::selectSameSheet(), SELECTION_TOOL::selectSheetContents(), DRAWING_TOOL::SetAnchor(), TOOL_INTERACTIVE::SetContextMenu(), EDA_3D_CONTROLLER::SetMaterial(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), EDA_3D_CONTROLLER::ToggleVisibility(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), LIB_EDIT_TOOL::Undo(), SCH_EDITOR_CONTROL::Undo(), PCB_EDITOR_CONTROL::UngroupSelected(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), SELECTION_TOOL::UnselectItems(), PNS::TOOL_BASE::updateEndItem(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCBNEW_CONTROL::UpdateMessagePanel(), PCB_INSPECTION_TOOL::UpdateSelectionRatsnest(), PNS::TOOL_BASE::updateStartItem(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), PCB_EDITOR_CONTROL::ZoneDuplicate(), and PCB_EDITOR_CONTROL::ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Name of the tool.

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

Definition at line 218 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

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

◆ m_wires

std::vector<SCH_LINE*> SCH_LINE_WIRE_BUS_TOOL::m_wires
private

Storage for the line segments while drawing.

Definition at line 131 of file sch_line_wire_bus_tool.h.

Referenced by doDrawSegments(), finishSegments(), SCH_LINE_WIRE_BUS_TOOL(), simplifyWireList(), and startSegments().


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