KiCad PCB EDA Suite
SCH_LINE_WIRE_BUS_TOOL Class Reference

Tool responsible for drawing/placing items (symbols, wires, buses, labels, etc.) 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 , REDRAW }
 Determine the reason of reset for a tool. More...
 

Public Member Functions

 SCH_LINE_WIRE_BUS_TOOL ()
 
 ~SCH_LINE_WIRE_BUS_TOOL ()
 
bool Init () override
 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 (EE_SELECTION *aSelection)
 Handle the addition of junctions to a selection of objects. More...
 
int TrimOverLappingWires (EE_SELECTION *aSelection)
 Logic to remove wires when overlapping correct items. More...
 
void Reset (RESET_REASON aReason) override
 Bring the tool to a known, initial state. More...
 
void Activate ()
 Run the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Assign a context menu and tells when it should be activated. More...
 
void RunMainStack (std::function< void()> aFunc)
 Call a function using the main stack. More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Define which state (aStateFunc) to go when a certain event arrives (aConditions). More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Suspend execution of the tool until an event specified in aEventList arrives. More...
 
TOOL_TYPE GetType () const
 Return the type of the tool. More...
 
TOOL_ID GetId () const
 Return the unique identifier of the tool. More...
 
const std::string & GetName () const
 Return the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Return the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

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

Protected Attributes

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

Private Member Functions

int doDrawSegments (const TOOL_EVENT &aTool, int aType, bool aQuitOnDraw)
 
SCH_LINEstartSegments (int aType, const VECTOR2D &aPos, SCH_LINE *aSegment=nullptr)
 
SCH_LINEdoUnfoldBus (const wxString &aNet, const VECTOR2I &aPos=VECTOR2I(0, 0))
 
void finishSegments ()
 
void simplifyWireList ()
 Iterate over the wire list and removes the null segments and overlapping segments to create a simplified wire list. More...
 
void setTransitions () override
 This method is meant to be overridden in order to specify handlers for events. More...
 
const SCH_SHEET_PINgetSheetPin (const VECTOR2I &aPosition)
 Search for a sheet pin at a location. More...
 
void computeBreakPoint (const std::pair< SCH_LINE *, SCH_LINE * > &aSegments, VECTOR2I &aPosition, LINE_MODE mode, bool posture)
 Compute the middle coordinate for 2 segments from the start point to aPosition with the segments kept in the horizontal or vertical axis only. More...
 
void resetTransitions ()
 Clear the current transition map and restores the default one created by setTransitions(). More...
 
void goInternal (TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)
 
EDA_ITEMgetModelInt () const
 
TOOLS_HOLDERgetToolHolderInt () const
 

Private Attributes

bool m_inDrawingTool
 
BUS_UNFOLDING_T m_busUnfold
 
std::vector< SCH_LINE * > m_wires
 

Detailed Description

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

Definition at line 74 of file sch_line_wire_bus_tool.h.

Member Enumeration Documentation

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determine the reason of reset for a tool.

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

REDRAW 

Full drawing refresh.

Definition at line 77 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ SCH_LINE_WIRE_BUS_TOOL()

SCH_LINE_WIRE_BUS_TOOL::SCH_LINE_WIRE_BUS_TOOL ( )

Definition at line 157 of file sch_line_wire_bus_tool.cpp.

157 :
158 EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.InteractiveDrawingLineWireBus" ),
159 m_inDrawingTool( false )
160{
161 m_busUnfold = {};
162 m_wires.reserve( 16 );
163}
std::vector< SCH_LINE * > m_wires

References m_busUnfold, and m_wires.

◆ ~SCH_LINE_WIRE_BUS_TOOL()

SCH_LINE_WIRE_BUS_TOOL::~SCH_LINE_WIRE_BUS_TOOL ( )

Definition at line 166 of file sch_line_wire_bus_tool.cpp.

167{
168}

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Run the tool.

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

Definition at line 51 of file tool_interactive.cpp.

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

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

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

◆ AddJunctionsIfNeeded()

int SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded ( EE_SELECTION aSelection)

Handle the addition of junctions to a selection of objects.

Definition at line 1280 of file sch_line_wire_bus_tool.cpp.

1281{
1282 SCH_SCREEN* screen = m_frame->GetScreen();
1283
1284 for( const VECTOR2I& point : screen->GetNeededJunctions( aSelection->Items() ) )
1285 m_frame->AddJunction( m_frame->GetScreen(), point, true, false );
1286
1287 return 0;
1288}
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCH_JUNCTION * AddJunction(SCH_SCREEN *aScreen, const VECTOR2I &aPos, bool aAppendToUndo, bool aFinal=true)
std::vector< VECTOR2I > GetNeededJunctions(const std::deque< EDA_ITEM * > &aItems) const
Return the unique set of points belonging to aItems where a junction is needed.
std::deque< EDA_ITEM * > & Items()
Definition: selection.h:213

References SCH_EDIT_FRAME::AddJunction(), SCH_SCREEN::GetNeededJunctions(), SCH_EDIT_FRAME::GetScreen(), SELECTION::Items(), and EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame.

Referenced by SCH_MOVE_TOOL::AlignElements(), SCH_MOVE_TOOL::Main(), SCH_EDIT_TOOL::Mirror(), SCH_DRAWING_TOOLS::PlaceSymbol(), SCH_EDIT_TOOL::RepeatDrawItem(), and SCH_EDIT_TOOL::Rotate().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Set the TOOL_MANAGER the tool will belong to.

Called by TOOL_MANAGER::RegisterTool()

Definition at line 60 of file tool_base.cpp.

61{
62 m_toolMgr = aManager;
63}

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ computeBreakPoint()

void SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint ( const std::pair< SCH_LINE *, SCH_LINE * > &  aSegments,
VECTOR2I aPosition,
LINE_MODE  mode,
bool  posture 
)
private

Compute 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.
modeLINE_MODE specifying the way to break the line
postureToggles the posture of the line

Definition at line 431 of file sch_line_wire_bus_tool.cpp.

435{
436 wxCHECK_RET( aSegments.first && aSegments.second,
437 wxT( "Cannot compute break point of NULL line segment." ) );
438
439 VECTOR2I midPoint;
440 SCH_LINE* segment = aSegments.first;
441 SCH_LINE* nextSegment = aSegments.second;
442
443 VECTOR2I delta = aPosition - segment->GetStartPoint();
444 int xDir = delta.x > 0 ? 1 : -1;
445 int yDir = delta.y > 0 ? 1 : -1;
446
447
448 bool preferHorizontal;
449 bool preferVertical;
450
451 if( ( mode == LINE_MODE_45 ) && posture )
452 {
453 preferHorizontal = ( nextSegment->GetEndPoint().x - nextSegment->GetStartPoint().x ) != 0;
454 preferVertical = ( nextSegment->GetEndPoint().y - nextSegment->GetStartPoint().y ) != 0;
455 }
456 else
457 {
458 preferHorizontal = ( segment->GetEndPoint().x - segment->GetStartPoint().x ) != 0;
459 preferVertical = ( segment->GetEndPoint().y - segment->GetStartPoint().y ) != 0;
460 }
461
462 // Check for times we need to force horizontal sheet pin connections
463 const SCH_SHEET_PIN* connectedPin = getSheetPin( segment->GetStartPoint() );
464 SHEET_SIDE force = connectedPin ? connectedPin->GetSide() : SHEET_SIDE::UNDEFINED;
465
466 if( force == SHEET_SIDE::LEFT || force == SHEET_SIDE::RIGHT )
467 {
468 if( aPosition.x == connectedPin->GetPosition().x ) // push outside sheet boundary
469 {
470 int direction = ( force == SHEET_SIDE::LEFT ) ? -1 : 1;
471 aPosition.x += KiROUND( getView()->GetGAL()->GetGridSize().x * direction );
472 }
473
474 preferHorizontal = true;
475 preferVertical = false;
476 }
477
478
479 auto breakVertical = [&]() mutable
480 {
481 switch( mode )
482 {
483 case LINE_MODE_45:
484 if( !posture )
485 {
486 midPoint.x = segment->GetStartPoint().x;
487 midPoint.y = aPosition.y - yDir * abs( delta.x );
488 }
489 else
490 {
491 midPoint.x = aPosition.x;
492 midPoint.y = segment->GetStartPoint().y + yDir * abs( delta.x );
493 }
494 break;
495 default:
496 midPoint.x = segment->GetStartPoint().x;
497 midPoint.y = aPosition.y;
498 }
499 };
500
501
502 auto breakHorizontal = [&]() mutable
503 {
504 switch( mode )
505 {
506 case LINE_MODE_45:
507 if( !posture )
508 {
509 midPoint.x = aPosition.x - xDir * abs( delta.y );
510 midPoint.y = segment->GetStartPoint().y;
511 }
512 else
513 {
514 midPoint.x = segment->GetStartPoint().x + xDir * abs( delta.y );
515 midPoint.y = aPosition.y;
516 }
517 break;
518 default:
519 midPoint.x = aPosition.x;
520 midPoint.y = segment->GetStartPoint().y;
521 }
522 };
523
524
525 // Maintain current line shape if we can, e.g. if we were originally moving
526 // vertically keep the first segment vertical
527 if( preferVertical )
528 breakVertical();
529 else if( preferHorizontal )
530 breakHorizontal();
531
532 // Check if our 45 degree angle is one of these shapes
533 // /
534 // /
535 // /
536 // /__________
537 VECTOR2I deltaMidpoint = midPoint - segment->GetStartPoint();
538
539 if( mode == LINE_MODE::LINE_MODE_45 && !posture
540 && ( ( alg::signbit( deltaMidpoint.x ) != alg::signbit( delta.x ) )
541 || ( alg::signbit( deltaMidpoint.y ) != alg::signbit( delta.y ) ) ) )
542 {
543 preferVertical = false;
544 preferHorizontal = false;
545 }
546 else if( mode == LINE_MODE::LINE_MODE_45 && posture
547 && ( ( abs( deltaMidpoint.x ) > abs( delta.x ) )
548 || ( abs( deltaMidpoint.y ) > abs( delta.y ) ) ) )
549 {
550 preferVertical = false;
551 preferHorizontal = false;
552 }
553
554 if( !preferHorizontal && !preferVertical )
555 {
556 if( std::abs( delta.x ) < std::abs( delta.y ) )
557 breakVertical();
558 else
559 breakHorizontal();
560 }
561
562 segment->SetEndPoint( midPoint );
563 nextSegment->SetStartPoint( midPoint );
564 nextSegment->SetEndPoint( aPosition );
565}
const SCH_SHEET_PIN * getSheetPin(const VECTOR2I &aPosition)
Search for a sheet pin at a location.
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:40
void SetStartPoint(const VECTOR2I &aPosition)
Definition: sch_line.h:139
VECTOR2I GetEndPoint() const
Definition: sch_line.h:143
VECTOR2I GetStartPoint() const
Definition: sch_line.h:138
void SetEndPoint(const VECTOR2I &aPosition)
Definition: sch_line.h:144
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet_pin.h:66
SHEET_SIDE GetSide() const
VECTOR2I GetPosition() const override
Definition: sch_text.h:203
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
@ LINE_MODE_45
bool signbit(T v)
Integral version of std::signbit that works all compilers.
Definition: kicad_algo.h:197
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:412
SHEET_SIDE
Define the edge of the sheet that the sheet pin is positioned.
Definition: sch_sheet_pin.h:46
constexpr int delta
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:85

References std::abs(), delta, SCH_LINE::GetEndPoint(), SCH_TEXT::GetPosition(), getSheetPin(), SCH_SHEET_PIN::GetSide(), SCH_LINE::GetStartPoint(), TOOL_BASE::getView(), KiROUND(), LEFT, LINE_MODE_45, RIGHT, SCH_LINE::SetEndPoint(), SCH_LINE::SetStartPoint(), alg::signbit(), UNDEFINED, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by doDrawSegments().

◆ doDrawSegments()

int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments ( const TOOL_EVENT aTool,
int  aType,
bool  aQuitOnDraw 
)
private

Definition at line 568 of file sch_line_wire_bus_tool.cpp.

569{
570 SCH_SCREEN* screen = m_frame->GetScreen();
571 SCH_LINE* segment = nullptr;
574 int lastMode = m_frame->eeconfig()->m_Drawing.line_mode;
575 static bool posture = false;
576
577 auto setCursor =
578 [&]()
579 {
580 if( aType == LAYER_WIRE )
582 else if( aType == LAYER_BUS )
584 else if( aType == LAYER_NOTES )
586 else
588 };
589
590 auto cleanup =
591 [&] ()
592 {
594
595 for( SCH_LINE* wire : m_wires )
596 delete wire;
597
598 m_wires.clear();
599 segment = nullptr;
600
601 if( m_busUnfold.entry )
603
606
609
610 delete m_busUnfold.entry;
611 delete m_busUnfold.label;
612 m_busUnfold = {};
613
615 m_view->ShowPreview( false );
616 };
617
618 Activate();
619 // Must be done after Activate() so that it gets set into the correct context
620 controls->ShowCursor( true );
621 // Set initial cursor
622 setCursor();
623
624 // Add the new label to the selection so the rotate command operates on it
625 if( m_busUnfold.label )
627
628 // Continue the existing wires if we've started (usually by immediate action preference)
629 if( !m_wires.empty() )
630 segment = m_wires.back();
631
632 wxPoint contextMenuPos;
633
634 // Main loop: keep receiving events
635 while( TOOL_EVENT* evt = Wait() )
636 {
638 bool twoSegments = currentMode != LINE_MODE::LINE_MODE_FREE;
639
640 // The tool hotkey is interpreted as a click when drawing
641 bool isSyntheticClick = ( segment || m_busUnfold.in_progress ) && evt->IsActivate()
642 && evt->HasPosition() && evt->Matches( aTool );
643
644 setCursor();
645 grid.SetMask( GRID_HELPER::ALL );
646 grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
647 grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
648
649 if( segment )
650 {
651 if( segment->GetStartPoint().x == segment->GetEndPoint().x )
652 grid.ClearMaskFlag( GRID_HELPER::VERTICAL );
653
654 if( segment->GetStartPoint().y == segment->GetEndPoint().y )
655 grid.ClearMaskFlag( GRID_HELPER::HORIZONTAL );
656 }
657
658 VECTOR2D eventPosition = evt->HasPosition() ? evt->Position()
659 : controls->GetMousePosition();
660
661 VECTOR2I cursorPos = grid.BestSnapAnchor( eventPosition, LAYER_CONNECTABLE, segment );
662 controls->ForceCursorPosition( true, cursorPos );
663
664 // Need to handle change in H/V mode while drawing
665 if( currentMode != lastMode )
666 {
667 // Need to delete extra segment if we have one
668 if( segment && currentMode == LINE_MODE::LINE_MODE_FREE && m_wires.size() >= 2 )
669 {
670 m_wires.pop_back();
672 delete segment;
673
674 segment = m_wires.back();
675 segment->SetEndPoint( cursorPos );
676 }
677 // Add a segment so we can move orthogonally/45
678 else if( segment && lastMode == LINE_MODE::LINE_MODE_FREE )
679 {
680 segment->SetEndPoint( cursorPos );
681
682 // Create a new segment, and chain it after the current segment.
683 segment = static_cast<SCH_LINE*>( segment->Duplicate() );
684 segment->SetFlags( IS_NEW | IS_MOVING );
685 segment->SetStartPoint( cursorPos );
686 m_wires.push_back( segment );
687
688 m_selectionTool->AddItemToSel( segment, true /*quiet mode*/ );
689 }
690
691 lastMode = currentMode;
692 }
693
694 //------------------------------------------------------------------------
695 // Handle cancel:
696 //
697 if( evt->IsCancelInteractive() )
698 {
700
701 if( segment || m_busUnfold.in_progress )
702 {
703 cleanup();
704
705 if( aQuitOnDraw )
706 {
707 m_frame->PopTool( aTool );
708 break;
709 }
710 }
711 else
712 {
713 m_frame->PopTool( aTool );
714 break;
715 }
716 }
717 else if( evt->IsActivate() && !isSyntheticClick )
718 {
719 if( segment || m_busUnfold.in_progress )
720 {
721 m_frame->ShowInfoBarMsg( _( "Press <ESC> to cancel drawing." ) );
722 evt->SetPassEvent( false );
723 continue;
724 }
725
726 if( evt->IsMoveTool() )
727 {
728 // leave ourselves on the stack so we come back after the move
729 break;
730 }
731 else
732 {
733 m_frame->PopTool( aTool );
734 break;
735 }
736 }
737 //------------------------------------------------------------------------
738 // Handle finish:
739 //
740 else if( evt->IsAction( &EE_ACTIONS::finishLineWireOrBus )
741 || evt->IsAction( &EE_ACTIONS::finishWire )
742 || evt->IsAction( &EE_ACTIONS::finishBus )
743 || evt->IsAction( &EE_ACTIONS::finishLine ) )
744 {
745 if( segment || m_busUnfold.in_progress )
746 {
748 segment = nullptr;
749
750 if( aQuitOnDraw )
751 {
752 m_frame->PopTool( aTool );
753 break;
754 }
755 }
756 }
757 //------------------------------------------------------------------------
758 // Handle click:
759 //
760 else if( evt->IsClick( BUT_LEFT )
761 || ( segment && evt->IsDblClick( BUT_LEFT ) )
762 || isSyntheticClick )
763 {
764 // First click when unfolding places the label and wire-to-bus entry
766 {
767 wxASSERT( aType == LAYER_WIRE );
768
772 }
773
774 if( !segment )
775 {
776 segment = startSegments( aType, VECTOR2D( cursorPos ) );
777 }
778 // Create a new segment if we're out of previously-created ones
779 else if( !segment->IsNull()
780 || ( twoSegments && !m_wires[m_wires.size() - 2]->IsNull() ) )
781 {
782 // Terminate the command if the end point is on a pin, junction, label, or another
783 // wire or bus.
784 if( screen->IsTerminalPoint( cursorPos, segment->GetLayer() ) )
785 {
787 segment = nullptr;
788
789 if( aQuitOnDraw )
790 {
791 m_frame->PopTool( aTool );
792 break;
793 }
794 }
795 else
796 {
797 int placedSegments = 1;
798
799 // When placing lines with the forty-five degree end, the user is
800 // targetting the endpoint with the angled portion, so it's more
801 // intuitive to place both segments at the same time.
802 if( currentMode == LINE_MODE::LINE_MODE_45 )
803 placedSegments++;
804
805 segment->SetEndPoint( cursorPos );
806
807 for( int i = 0; i < placedSegments; i++ )
808 {
809 // Create a new segment, and chain it after the current segment.
810 segment = static_cast<SCH_LINE*>( segment->Duplicate() );
811 segment->SetFlags( IS_NEW | IS_MOVING );
812 segment->SetStartPoint( cursorPos );
813 m_wires.push_back( segment );
814
815 m_selectionTool->AddItemToSel( segment, true /*quiet mode*/ );
816 }
817 }
818 }
819
820 if( evt->IsDblClick( BUT_LEFT ) && segment )
821 {
822 if( twoSegments && m_wires.size() >= 2 )
823 computeBreakPoint( { m_wires[m_wires.size() - 2], segment }, cursorPos,
824 currentMode, posture );
825
827 segment = nullptr;
828
829 if( aQuitOnDraw )
830 {
831 m_frame->PopTool( aTool );
832 break;
833 }
834 }
835 }
836 //------------------------------------------------------------------------
837 // Handle motion:
838 //
839 else if( evt->IsMotion() || evt->IsAction( &ACTIONS::refreshPreview ) )
840 {
842
843 // Update the bus unfold posture based on the mouse movement
845 {
846 VECTOR2I cursor_delta = cursorPos - m_busUnfold.origin;
848
849 bool flipX = ( cursor_delta.x < 0 );
850 bool flipY = ( cursor_delta.y < 0 );
851
852 // Erase and redraw if necessary
853 if( flipX != m_busUnfold.flipX || flipY != m_busUnfold.flipY )
854 {
855 wxSize size = entry->GetSize();
856 int ySign = flipY ? -1 : 1;
857 int xSign = flipX ? -1 : 1;
858
859 size.x = std::abs( size.x ) * xSign;
860 size.y = std::abs( size.y ) * ySign;
861 entry->SetSize( size );
862
863 m_busUnfold.flipY = flipY;
864 m_busUnfold.flipX = flipX;
865
866 m_frame->UpdateItem( entry, false, true );
867 m_wires.front()->SetStartPoint( entry->GetEnd() );
868 }
869
870 // Update the label "ghost" position
871 m_busUnfold.label->SetPosition( cursorPos );
873
874 // Ensure segment is non-null at the start of bus unfold
875 if( !segment )
876 segment = m_wires.back();
877 }
878
879 if( segment )
880 {
881 // Coerce the line to vertical/horizontal/45 as necessary
882 if( twoSegments && m_wires.size() >= 2 )
883 {
884 computeBreakPoint( { m_wires[m_wires.size() - 2], segment }, cursorPos,
885 currentMode, posture );
886 }
887 else
888 {
889 segment->SetEndPoint( cursorPos );
890 }
891 }
892
893 for( SCH_LINE* wire : m_wires )
894 {
895 if( !wire->IsNull() )
896 m_view->AddToPreview( wire->Clone() );
897 }
898 }
899 else if( evt->IsAction( &EE_ACTIONS::undoLastSegment ) )
900 {
901 if( ( currentMode == LINE_MODE::LINE_MODE_FREE && m_wires.size() > 1 )
902 || ( LINE_MODE::LINE_MODE_90 && m_wires.size() > 2 ) )
903 {
905
906 m_wires.pop_back();
908 delete segment;
909
910 segment = m_wires.back();
911 segment->SetEndPoint( cursorPos );
912
913 // Find new bend point for current mode
914 if( twoSegments && m_wires.size() >= 2 )
915 {
916 computeBreakPoint( { m_wires[m_wires.size() - 2], segment }, cursorPos,
917 currentMode, posture );
918 }
919 else
920 {
921 segment->SetEndPoint( cursorPos );
922 }
923
924 for( SCH_LINE* wire : m_wires )
925 {
926 if( !wire->IsNull() )
927 m_view->AddToPreview( wire->Clone() );
928 }
929 }
930 else
931 {
932 wxBell();
933 }
934 }
935 else if( evt->IsAction( &EE_ACTIONS::switchSegmentPosture ) && m_wires.size() >= 2 )
936 {
937 posture = !posture;
938
939 // The 90 degree mode doesn't have a forced posture like
940 // the 45 degree mode and computeBreakPoint maintains existing 90s' postures.
941 // Instead, just swap the 90 angle here.
942 if( currentMode == LINE_MODE::LINE_MODE_90 )
943 {
945
946 SCH_LINE* line2 = m_wires[m_wires.size() - 1];
947 SCH_LINE* line1 = m_wires[m_wires.size() - 2];
948
949 VECTOR2I delta2 = line2->GetEndPoint() - line2->GetStartPoint();
950 VECTOR2I delta1 = line1->GetEndPoint() - line1->GetStartPoint();
951
952 line2->SetStartPoint(line2->GetEndPoint() - delta1);
953 line1->SetEndPoint(line1->GetStartPoint() + delta2);
954
955 for( SCH_LINE* wire : m_wires )
956 {
957 if( !wire->IsNull() )
958 m_view->AddToPreview( wire->Clone() );
959 }
960 }
961 else
962 {
963 computeBreakPoint( { m_wires[m_wires.size() - 2], segment }, cursorPos, currentMode,
964 posture );
965
967 }
968 }
969 //------------------------------------------------------------------------
970 // Handle context menu:
971 //
972 else if( evt->IsClick( BUT_RIGHT ) )
973 {
974 // Warp after context menu only if dragging...
975 if( !segment )
977
978 contextMenuPos = (wxPoint) cursorPos;
980 }
981 else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CHOICE_MENU_CHOICE )
982 {
983 if( *evt->GetCommandId() >= ID_POPUP_SCH_UNFOLD_BUS
984 && *evt->GetCommandId() <= ID_POPUP_SCH_UNFOLD_BUS_END )
985 {
986 wxASSERT_MSG( !segment, "Bus unfold event received when already drawing!" );
987
988 aType = LAYER_WIRE;
989 wxString net = *evt->Parameter<wxString*>();
990 segment = doUnfoldBus( net, contextMenuPos );
991 }
992 }
993 //------------------------------------------------------------------------
994 // Handle TOOL_ACTION special cases
995 //
996 else if( evt->IsAction( &EE_ACTIONS::rotateCW ) || evt->IsAction( &EE_ACTIONS::rotateCCW ) )
997 {
999 {
1000 m_busUnfold.label->Rotate90( evt->IsAction( &EE_ACTIONS::rotateCW ) );
1002 }
1003 else
1004 {
1005 wxBell();
1006 }
1007 }
1008 else if( evt->IsAction( &ACTIONS::doDelete ) && ( segment || m_busUnfold.in_progress ) )
1009 {
1010 cleanup();
1011 }
1012 else
1013 {
1014 evt->SetPassEvent();
1015 }
1016
1017 // Enable autopanning and cursor capture only when there is a segment to be placed
1018 controls->SetAutoPan( segment != nullptr );
1019 controls->CaptureCursor( segment != nullptr );
1020 }
1021
1022 controls->SetAutoPan( false );
1023 controls->CaptureCursor( false );
1025 controls->ForceCursorPosition( false );
1026 return 0;
1027}
static TOOL_ACTION doDelete
Definition: actions.h:73
static TOOL_ACTION refreshPreview
Definition: actions.h:109
void ShowInfoBarMsg(const wxString &aMsg, bool aShowCloseButton=false)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an info icon on the left of...
WX_INFOBAR * GetInfoBar()
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:139
static TOOL_ACTION finishLine
Definition: ee_actions.h:105
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
static TOOL_ACTION rotateCCW
Definition: ee_actions.h:124
static TOOL_ACTION finishWire
Definition: ee_actions.h:103
static TOOL_ACTION finishLineWireOrBus
Definition: ee_actions.h:102
static TOOL_ACTION rotateCW
Definition: ee_actions.h:123
static TOOL_ACTION undoLastSegment
Definition: ee_actions.h:100
static TOOL_ACTION switchSegmentPosture
Definition: ee_actions.h:101
static TOOL_ACTION finishBus
Definition: ee_actions.h:104
EE_SELECTION & GetSelection()
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:184
An interface for classes handling user events controlling the view behavior such as zooming,...
virtual void CaptureCursor(bool aEnabled)
Force the cursor to stay within the drawing panel area.
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Place the cursor immediately at a given point.
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
virtual VECTOR2D GetMousePosition(bool aWorldCoordinates=true) const =0
Return the current mouse pointer position.
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
void ShowPreview(bool aShow=true)
Definition: view.cpp:1649
void AddToPreview(EDA_ITEM *aItem, bool aTakeOwnership=true)
Definition: view.cpp:1635
void ClearPreview()
Definition: view.cpp:1613
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
EESCHEMA_SETTINGS * eeconfig() const
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,...
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,...
VECTOR2I GetEnd() const
wxSize GetSize() const
Definition: sch_bus_entry.h:71
void SetSize(const wxSize &aSize)
Definition: sch_bus_entry.h:72
Class for a wire to bus entry.
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false) override
Mark an item for refresh.
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:246
SCH_ITEM * Duplicate(bool doClone=false) const
Routine to create a new copy of given item.
Definition: sch_item.cpp:93
void Rotate90(bool aClockwise) override
Definition: sch_label.cpp:309
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_label.h:250
void computeBreakPoint(const std::pair< SCH_LINE *, SCH_LINE * > &aSegments, VECTOR2I &aPosition, LINE_MODE mode, bool posture)
Compute the middle coordinate for 2 segments from the start point to aPosition with the segments kept...
SCH_LINE * doUnfoldBus(const wxString &aNet, const VECTOR2I &aPos=VECTOR2I(0, 0))
SCH_LINE * startSegments(int aType, const VECTOR2D &aPos, SCH_LINE *aSegment=nullptr)
bool IsNull() const
Definition: sch_line.h:136
bool IsTerminalPoint(const VECTOR2I &aPosition, int aLayer) const
Test if aPosition is a connection point on aLayer.
Definition: sch_screen.cpp:817
void SetPosition(const VECTOR2I &aPosition) override
Definition: sch_text.h:204
int RemoveItemFromSel(const TOOL_EVENT &aEvent)
int AddItemToSel(const TOOL_EVENT &aEvent)
virtual void PopTool(const TOOL_EVENT &aEvent)
Pops a tool from the stack.
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
Generic, UI-independent tool event.
Definition: tool_event.h:156
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Suspend execution of the tool until an event specified in aEventList arrives.
void Activate()
Run the tool.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:142
void VetoContextMenuMouseWarp()
Disable mouse warping after the current context menu is closed.
Definition: tool_manager.h:424
void ShowContextMenu(SELECTION &aSelection)
Helper function to set and immediately show a CONDITIONAL_MENU in concert with the given SELECTION.
Definition: tool_menu.cpp:57
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: wx_infobar.cpp:175
#define _(s)
#define IS_NEW
New item, just created.
#define IS_MOVING
Item being moved.
@ LAYER_CONNECTABLE
@ ID_POPUP_SCH_UNFOLD_BUS_END
Definition: eeschema_id.h:91
@ ID_POPUP_SCH_UNFOLD_BUS
Definition: eeschema_id.h:90
LINE_MODE
@ LINE_MODE_90
@ LINE_MODE_FREE
@ LAYER_WIRE
Definition: layer_ids.h:344
@ LAYER_NOTES
Definition: layer_ids.h:358
@ LAYER_BUS
Definition: layer_ids.h:345
bool label_placed
True if user has placed the net label.
bool flipY
True if the bus entry should be flipped in the y-axis.
SCH_BUS_WIRE_ENTRY * entry
bool flipX
True if the bus entry should be flipped in the x-axis.
VECTOR2I origin
Origin (on the bus) of the unfold.
bool in_progress
True if bus unfold operation is running.
@ TA_CHOICE_MENU_CHOICE
Definition: tool_event.h:93
@ TC_COMMAND
Definition: tool_event.h:52
@ MD_SHIFT
Definition: tool_event.h:138
@ BUT_LEFT
Definition: tool_event.h:127
@ BUT_RIGHT
Definition: tool_event.h:128
VECTOR2< double > VECTOR2D
Definition: vector2d.h:617

References _, std::abs(), TOOL_INTERACTIVE::Activate(), SELECTION_TOOL::AddItemToSel(), KIGFX::VIEW::AddToPreview(), SCH_BASE_FRAME::AddToScreen(), GRID_HELPER::ALL, ARROW, BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), KIGFX::VIEW::ClearPreview(), EE_ACTIONS::clearSelection, SCH_LABEL::Clone(), computeBreakPoint(), WX_INFOBAR::Dismiss(), ACTIONS::doDelete, doUnfoldBus(), SCH_ITEM::Duplicate(), 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(), SCH_LINE::GetEndPoint(), EDA_BASE_FRAME::GetInfoBar(), SCH_ITEM::GetLayer(), KIGFX::VIEW_CONTROLS::GetMousePosition(), SCH_EDIT_FRAME::GetScreen(), EE_SELECTION_TOOL::GetSelection(), SCH_BUS_ENTRY_BASE::GetSize(), SCH_LINE::GetStartPoint(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), grid, GRID_HELPER::HORIZONTAL, ID_POPUP_SCH_UNFOLD_BUS, ID_POPUP_SCH_UNFOLD_BUS_END, BUS_UNFOLDING_T::in_progress, IS_MOVING, IS_NEW, SCH_LINE::IsNull(), SCH_SCREEN::IsTerminalPoint(), BUS_UNFOLDING_T::label, BUS_UNFOLDING_T::label_placed, LAYER_BUS, LAYER_CONNECTABLE, LAYER_NOTES, LAYER_WIRE, LINE_BUS, LINE_GRAPHIC, EESCHEMA_SETTINGS::DRAWING::line_mode, LINE_MODE_45, LINE_MODE_90, LINE_MODE_FREE, LINE_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(), SELECTION_TOOL::RemoveItemFromSel(), SCH_LABEL_BASE::Rotate90(), EE_ACTIONS::rotateCCW, EE_ACTIONS::rotateCW, TOOL_MANAGER::RunAction(), KIGFX::VIEW_CONTROLS::SetAutoPan(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), SCH_LINE::SetEndPoint(), EDA_ITEM::SetFlags(), SCH_TEXT::SetPosition(), SCH_BUS_ENTRY_BASE::SetSize(), SCH_LINE::SetStartPoint(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), EDA_BASE_FRAME::ShowInfoBarMsg(), KIGFX::VIEW::ShowPreview(), startSegments(), EE_ACTIONS::switchSegmentPosture, TA_CHOICE_MENU_CHOICE, TC_COMMAND, EE_ACTIONS::undoLastSegment, SCH_EDIT_FRAME::UpdateItem(), GRID_HELPER::VERTICAL, TOOL_MANAGER::VetoContextMenuMouseWarp(), TOOL_INTERACTIVE::Wait(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by DrawSegments(), and UnfoldBus().

◆ doUnfoldBus()

SCH_LINE * SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus ( const wxString &  aNet,
const VECTOR2I aPos = VECTOR2I( 0, 0 ) 
)
private

Definition at line 381 of file sch_line_wire_bus_tool.cpp.

382{
383 SCHEMATIC_SETTINGS& cfg = getModel<SCHEMATIC>()->Settings();
384
385 VECTOR2I pos = aPos;
386
387 if( aPos == VECTOR2I( 0, 0 ) )
388 pos = static_cast<VECTOR2I>( getViewControls()->GetCursorPosition() );
389
391
395
401
403 m_busUnfold.origin = pos;
404 m_busUnfold.net_name = aNet;
405
407
409}
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:100
void SetTextSize(const VECTOR2I &aNewSize)
Definition: eda_text.cpp:347
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Move the graphic crosshair cursor to the requested position expressed in world coordinates.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
These settings were stored in SCH_BASE_FRAME previously.
virtual void SetTextSpinStyle(TEXT_SPIN_STYLE aSpinStyle)
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
Definition: sch_text.cpp:188
wxString net_name
Net label for the unfolding operation.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:618

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_MOVING, 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, TEXT_SPIN_STYLE::RIGHT, TOOL_MANAGER::RunAction(), KIGFX::VIEW_CONTROLS::SetCrossHairCursorPosition(), EDA_ITEM::SetFlags(), EDA_ITEM::SetParent(), EDA_TEXT::SetTextSize(), SCH_TEXT::SetTextSpinStyle(), and startSegments().

Referenced by doDrawSegments(), and UnfoldBus().

◆ DrawSegments()

int SCH_LINE_WIRE_BUS_TOOL::DrawSegments ( const TOOL_EVENT aEvent)

Definition at line 289 of file sch_line_wire_bus_tool.cpp.

290{
291 if( m_inDrawingTool )
292 return 0;
293
295
297
298 m_frame->PushTool( aEvent );
300
301 if( aEvent.HasPosition() )
302 {
304 grid.SetSnap( !aEvent.Modifier( MD_SHIFT ) );
305 grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !aEvent.DisableGridSnapping() );
306
307 VECTOR2D cursorPos = grid.BestSnapAnchor( aEvent.Position(), LAYER_CONNECTABLE, nullptr );
308 startSegments( params->layer, cursorPos, params->sourceSegment );
309 }
310
311 return doDrawSegments( aEvent, params->layer, params->quitOnDraw );
312}
int doDrawSegments(const TOOL_EVENT &aTool, int aType, bool aQuitOnDraw)
virtual void PushTool(const TOOL_EVENT &aEvent)
NB: the definition of "tool" is different at the user level.
bool HasPosition() const
Definition: tool_event.h:243
bool DisableGridSnapping() const
Definition: tool_event.h:344
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:442
const VECTOR2D Position() const
Returns the point where dragging has started.
Definition: tool_event.h:266
int Modifier(int aMask=MD_MODIFIER_MASK) const
Definition: tool_event.h:339

References EE_ACTIONS::clearSelection, TOOL_EVENT::DisableGridSnapping(), doDrawSegments(), TOOL_BASE::getView(), grid, TOOL_EVENT::HasPosition(), DRAW_SEGMENT_EVENT_PARAMS::layer, LAYER_CONNECTABLE, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_inDrawingTool, TOOL_BASE::m_toolMgr, MD_SHIFT, TOOL_EVENT::Modifier(), TOOL_EVENT::Parameter(), TOOL_EVENT::Position(), TOOLS_HOLDER::PushTool(), DRAW_SEGMENT_EVENT_PARAMS::quitOnDraw, TOOL_MANAGER::RunAction(), DRAW_SEGMENT_EVENT_PARAMS::sourceSegment, and startSegments().

Referenced by setTransitions().

◆ finishSegments()

void SCH_LINE_WIRE_BUS_TOOL::finishSegments ( )
private

Definition at line 1120 of file sch_line_wire_bus_tool.cpp.

1121{
1122 // Clear selection when done so that a new wire can be started.
1123 // NOTE: this must be done before simplifyWireList is called or we might end up with
1124 // freed selected items.
1126
1127 SCH_SCREEN* screen = m_frame->GetScreen();
1128 PICKED_ITEMS_LIST itemList;
1129
1130 // Remove segments backtracking over others
1132
1133 // Collect the possible connection points for the new lines
1134 std::vector<VECTOR2I> connections = screen->GetConnections();
1135 std::vector<VECTOR2I> new_ends;
1136
1137 // Check each new segment for possible junctions and add/split if needed
1138 for( SCH_LINE* wire : m_wires )
1139 {
1140 if( wire->HasFlag( SKIP_STRUCT ) )
1141 continue;
1142
1143 std::vector<VECTOR2I> tmpends = wire->GetConnectionPoints();
1144
1145 new_ends.insert( new_ends.end(), tmpends.begin(), tmpends.end() );
1146
1147 for( const VECTOR2I& pt : connections )
1148 {
1149 if( IsPointOnSegment( wire->GetStartPoint(), wire->GetEndPoint(), pt ) )
1150 new_ends.push_back( pt );
1151 }
1152
1153 itemList.PushItem( ITEM_PICKER( screen, wire, UNDO_REDO::NEWITEM ) );
1154 }
1155
1157 {
1158 wxASSERT( m_busUnfold.entry && m_busUnfold.label );
1159
1162
1166 }
1167 else if( !m_wires.empty() )
1168 {
1170 }
1171
1172 for( size_t ii = 1; ii < m_wires.size(); ++ii )
1174
1175 // Get the last non-null wire (this is the last created segment).
1176 if( !m_wires.empty() )
1178
1179 // Add the new wires
1180 for( SCH_LINE* wire : m_wires )
1181 {
1182 wire->ClearFlags( IS_NEW | IS_MOVING );
1183 m_frame->AddToScreen( wire, screen );
1184 }
1185
1186 m_wires.clear();
1188 m_view->ShowPreview( false );
1189
1190 getViewControls()->CaptureCursor( false );
1191 getViewControls()->SetAutoPan( false );
1192
1193 m_frame->SaveCopyInUndoList( itemList, UNDO_REDO::NEWITEM, false );
1194
1195 // Correct and remove segments that need to be merged.
1197
1198 std::vector<SCH_ITEM*> symbols;
1199
1200 for( SCH_ITEM* symbol : m_frame->GetScreen()->Items().OfType( SCH_SYMBOL_T ) )
1201 symbols.push_back( symbol );
1202
1203 for( SCH_ITEM* symbol : symbols )
1204 {
1205 std::vector<VECTOR2I> pts = symbol->GetConnectionPoints();
1206
1207 if( pts.size() > 2 )
1208 continue;
1209
1210 for( auto pt = pts.begin(); pt != pts.end(); pt++ )
1211 {
1212 for( auto secondPt = pt + 1; secondPt != pts.end(); secondPt++ )
1213 m_frame->TrimWire( *pt, *secondPt );
1214 }
1215 }
1216
1217 for( const VECTOR2I& pt : new_ends )
1218 {
1220 m_frame->AddJunction( m_frame->GetScreen(), pt, true, false );
1221 }
1222
1224 m_busUnfold = {};
1225
1226 for( SCH_ITEM* item : m_frame->GetScreen()->Items() )
1227 item->ClearEditFlags();
1228
1231
1232 m_frame->OnModify();
1233}
void ClearEditFlags()
Definition: eda_item.h:158
EE_TYPE OfType(KICAD_T aType) const
Definition: sch_rtree.h:238
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:213
A holder to handle information on schematic or board items.
void PushItem(const ITEM_PICKER &aItem)
Push aItem to the top of the list.
bool SchematicCleanUp(SCH_SCREEN *aScreen=nullptr)
Perform routine schematic cleaning including breaking wire and buses and deleting identical objects s...
bool TrimWire(const VECTOR2I &aStart, const VECTOR2I &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 and update other data struc...
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, bool aDirtyConnectivity=true)
Create a copy of the current schematic item, and put it in the undo list.
void AddCopyForRepeatItem(const SCH_ITEM *aItem)
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
void SaveCopyForRepeatItem(const SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
void simplifyWireList()
Iterate over the wire list and removes the null segments and overlapping segments to create a simplif...
EE_RTREE & Items()
Gets the full RTree, usually for iterating.
Definition: sch_screen.h:109
bool IsExplicitJunctionNeeded(const VECTOR2I &aPosition) const
Indicates that a junction dot is necessary at the given location, and does not yet exist.
Definition: sch_screen.cpp:478
std::vector< VECTOR2I > GetConnections() const
Collect a unique list of all possible connection points in the schematic.
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
#define SKIP_STRUCT
flag indicating that the structure should be ignored
bool IsPointOnSegment(const VECTOR2I &aSegStart, const VECTOR2I &aSegEnd, const VECTOR2I &aTestPoint)
Test if aTestPoint is on line defined by aSegStart and aSegEnd.
Definition: trigo.cpp:42
@ SCH_SYMBOL_T
Definition: typeinfo.h:156

References SCH_EDIT_FRAME::AddCopyForRepeatItem(), 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_SCREEN::GetConnections(), SCH_EDIT_FRAME::GetScreen(), TOOL_BASE::getViewControls(), BUS_UNFOLDING_T::in_progress, IS_MOVING, IS_NEW, SCH_SCREEN::IsExplicitJunctionNeeded(), 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_SYMBOL_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

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

Definition at line 185 of file tool_base.h.

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

References TOOL_BASE::getToolHolderInt().

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

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Return the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 121 of file tool_base.h.

122 {
123 return m_toolId;
124 }

References TOOL_BASE::m_toolId.

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

◆ GetManager()

TOOL_MANAGER * TOOL_BASE::GetManager ( ) const
inlineinherited

◆ getModel()

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

Return the model object if it matches the requested type.

Store the type of the tool.

Definition at line 197 of file tool_base.h.

References TOOL_BASE::getModelInt().

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

◆ getModelInt()

EDA_ITEM * TOOL_BASE::getModelInt ( ) const
privateinherited

Definition at line 54 of file tool_base.cpp.

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

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

Referenced by TOOL_BASE::getModel().

◆ GetName()

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

Return the name of the tool.

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

Returns
The name of the tool.

Definition at line 134 of file tool_base.h.

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

References TOOL_BASE::m_toolName.

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

◆ getSheetPin()

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

Search 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 412 of file sch_line_wire_bus_tool.cpp.

413{
414 SCH_SCREEN* screen = m_frame->GetScreen();
415
416 for( SCH_ITEM* item : screen->Items().Overlapping( SCH_SHEET_T, aPosition ) )
417 {
418 SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
419
420 for( SCH_SHEET_PIN* pin : sheet->GetPins() )
421 {
422 if( pin->GetPosition() == aPosition )
423 return pin;
424 }
425 }
426
427 return nullptr;
428}
EE_TYPE Overlapping(const BOX2I &aRect) const
Definition: sch_rtree.h:243
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:57
std::vector< SCH_SHEET_PIN * > & GetPins()
Definition: sch_sheet.h:175
@ SCH_SHEET_T
Definition: typeinfo.h:158

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

Referenced by computeBreakPoint().

◆ getToolHolderInt()

TOOLS_HOLDER * TOOL_BASE::getToolHolderInt ( ) const
privateinherited

Definition at line 48 of file tool_base.cpp.

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

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

Referenced by TOOL_BASE::getEditFrame().

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Return the type of the tool.

Returns
The type of the tool.

Definition at line 109 of file tool_base.h.

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

References TOOL_BASE::m_type.

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

◆ getView()

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

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

It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

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

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

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

◆ getViewControls()

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

Return the instance of VIEW_CONTROLS object used in the application.

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

Returns
The instance of VIEW_CONTROLS.

Definition at line 42 of file tool_base.cpp.

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

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

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

◆ Go()

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

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

No conditions means any event.

Definition at line 147 of file tool_interactive.h.

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

References TOOL_INTERACTIVE::goInternal().

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

◆ goInternal()

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

Definition at line 70 of file tool_interactive.cpp.

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

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

Referenced by TOOL_INTERACTIVE::Go().

◆ Init()

bool SCH_LINE_WIRE_BUS_TOOL::Init ( )
overridevirtual

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

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

Reimplemented from TOOL_BASE.

Definition at line 171 of file sch_line_wire_bus_tool.cpp.

172{
174
175 std::shared_ptr<BUS_UNFOLD_MENU> busUnfoldMenu = std::make_shared<BUS_UNFOLD_MENU>();
176 busUnfoldMenu->SetTool( this );
177 m_menu.RegisterSubMenu( busUnfoldMenu );
178
179 std::shared_ptr<BUS_UNFOLD_MENU> selBusUnfoldMenu = std::make_shared<BUS_UNFOLD_MENU>();
180 selBusUnfoldMenu->SetTool( m_selectionTool );
181 m_selectionTool->GetToolMenu().RegisterSubMenu( selBusUnfoldMenu );
182
183 auto wireOrBusTool =
184 [this]( const SELECTION& aSel )
185 {
188 };
189
190 auto lineTool =
191 [this]( const SELECTION& aSel )
192 {
194 };
195
196 auto belowRootSheetCondition =
197 [&]( const SELECTION& aSel )
198 {
199 return m_frame->GetCurrentSheet().Last() != &m_frame->Schematic().Root();
200 };
201
202 auto busSelection = EE_CONDITIONS::MoreThan( 0 )
204
205 auto haveHighlight =
206 [&]( const SELECTION& sel )
207 {
208 SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
209
210 return editFrame && editFrame->GetHighlightedConnection() != nullptr;
211 };
212
213 auto& ctxMenu = m_menu.GetMenu();
214
215 // Build the tool menu
216 //
217 ctxMenu.AddItem( EE_ACTIONS::clearHighlight, haveHighlight && EE_CONDITIONS::Idle, 1 );
218 ctxMenu.AddSeparator( haveHighlight && EE_CONDITIONS::Idle, 1 );
219
220 ctxMenu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 2 );
221
222 ctxMenu.AddSeparator( 10 );
223 ctxMenu.AddItem( EE_ACTIONS::drawWire, wireOrBusTool && EE_CONDITIONS::Idle, 10 );
224 ctxMenu.AddItem( EE_ACTIONS::drawBus, wireOrBusTool && EE_CONDITIONS::Idle, 10 );
225 ctxMenu.AddItem( EE_ACTIONS::drawLines, lineTool && EE_CONDITIONS::Idle, 10 );
226
229
230 ctxMenu.AddItem( EE_ACTIONS::finishWire, IsDrawingWire, 10 );
231 ctxMenu.AddItem( EE_ACTIONS::finishBus, IsDrawingBus, 10 );
232 ctxMenu.AddItem( EE_ACTIONS::finishLine, IsDrawingLine, 10 );
233
234 ctxMenu.AddMenu( busUnfoldMenu.get(), EE_CONDITIONS::Idle, 10 );
235
236 ctxMenu.AddSeparator( 100 );
237 ctxMenu.AddItem( EE_ACTIONS::placeJunction, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
238 ctxMenu.AddItem( EE_ACTIONS::placeLabel, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
239 ctxMenu.AddItem( EE_ACTIONS::placeClassLabel, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
240 ctxMenu.AddItem( EE_ACTIONS::placeGlobalLabel, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
241 ctxMenu.AddItem( EE_ACTIONS::placeHierLabel, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
242 ctxMenu.AddItem( EE_ACTIONS::breakWire, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
243 ctxMenu.AddItem( EE_ACTIONS::slice, ( wireOrBusTool || lineTool )
244 && EE_CONDITIONS::Idle, 100 );
245 ctxMenu.AddSeparator( 200 );
246 ctxMenu.AddItem( EE_ACTIONS::selectNode, wireOrBusTool && EE_CONDITIONS::Idle, 200 );
247 ctxMenu.AddItem( EE_ACTIONS::selectConnection, wireOrBusTool && EE_CONDITIONS::Idle, 200 );
248
249 // Add bus unfolding to the selection tool
250 //
252
253 selToolMenu.AddMenu( selBusUnfoldMenu.get(), busSelection && EE_CONDITIONS::Idle, 100 );
254
255 return true;
256}
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Add a menu entry to run a TOOL_ACTION on selected items.
void AddMenu(ACTION_MENU *aMenu, const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Add a submenu to the menu.
static TOOL_ACTION clearHighlight
Definition: ee_actions.h:250
static TOOL_ACTION selectConnection
If current selection is a wire or bus, expand to entire connection.
Definition: ee_actions.h:53
static TOOL_ACTION slice
Definition: ee_actions.h:144
static TOOL_ACTION placeClassLabel
Definition: ee_actions.h:88
static TOOL_ACTION drawWire
Definition: ee_actions.h:81
static TOOL_ACTION drawBus
Definition: ee_actions.h:82
static TOOL_ACTION selectNode
Select the junction, wire or bus segment under the cursor.
Definition: ee_actions.h:49
static TOOL_ACTION breakWire
Definition: ee_actions.h:143
static TOOL_ACTION drawLines
Definition: ee_actions.h:98
static TOOL_ACTION leaveSheet
Definition: ee_actions.h:199
static TOOL_ACTION placeGlobalLabel
Definition: ee_actions.h:89
static TOOL_ACTION placeHierLabel
Definition: ee_actions.h:90
static TOOL_ACTION placeLabel
Definition: ee_actions.h:87
static TOOL_ACTION placeJunction
Definition: ee_actions.h:85
bool Init() override
Init() is called once upon a registration of the tool.
Definition: ee_tool_base.h:66
SCH_SHEET & Root() const
Definition: schematic.h:91
Schematic editor (Eeschema) main window.
const SCH_CONNECTION * GetHighlightedConnection() const
SCH_SHEET_PATH & GetCurrentSheet() const
SCHEMATIC & Schematic() const
static bool IsDrawingWire(const SELECTION &aSelection)
static bool IsDrawingBus(const SELECTION &aSelection)
static bool IsDrawingLine(const SELECTION &aSelection)
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
static SELECTION_CONDITION MoreThan(int aNumber)
Create a functor that tests if the number of selected items is greater than the value given as parame...
static bool Idle(const SELECTION &aSelection)
Test if there no items selected or being edited.
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
static SELECTION_CONDITION OnlyTypes(std::vector< KICAD_T > aTypes)
Create a functor that tests if the selected items are only of given types.
bool IsCurrentTool(const TOOL_ACTION &aAction) const
TOOL_MENU & GetToolMenu()
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:44
void RegisterSubMenu(std::shared_ptr< ACTION_MENU > aSubMenu)
Store a submenu of this menu model.
Definition: tool_menu.cpp:50
@ SCH_ITEM_LOCATE_BUS_T
Definition: typeinfo.h:171

References CONDITIONAL_MENU::AddItem(), CONDITIONAL_MENU::AddMenu(), EE_ACTIONS::breakWire, EE_ACTIONS::clearHighlight, EE_ACTIONS::drawBus, EE_ACTIONS::drawLines, EE_ACTIONS::drawWire, EE_ACTIONS::finishBus, EE_ACTIONS::finishLine, EE_ACTIONS::finishWire, SCH_EDIT_FRAME::GetCurrentSheet(), SCH_EDIT_FRAME::GetHighlightedConnection(), 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::OnlyTypes(), EE_ACTIONS::placeClassLabel, EE_ACTIONS::placeGlobalLabel, EE_ACTIONS::placeHierLabel, EE_ACTIONS::placeJunction, EE_ACTIONS::placeLabel, TOOL_MENU::RegisterSubMenu(), SCHEMATIC::Root(), SCH_ITEM_LOCATE_BUS_T, SCH_EDIT_FRAME::Schematic(), EE_ACTIONS::selectConnection, EE_ACTIONS::selectNode, SELECTION_CONDITIONS::ShowAlways(), EE_ACTIONS::slice, EE_ACTIONS::switchSegmentPosture, and EE_ACTIONS::undoLastSegment.

◆ IsDrawingBus()

bool SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus ( const SELECTION aSelection)
static

Definition at line 273 of file sch_line_wire_bus_tool.cpp.

274{
275 return IsDrawingLineWireOrBus( aSelection )
276 && aSelection.Front()->IsType( { SCH_ITEM_LOCATE_BUS_T } );
277}
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition: eda_item.h:181
static bool IsDrawingLineWireOrBus(const SELECTION &aSelection)
EDA_ITEM * Front() const
Definition: selection.h:208

References SELECTION::Front(), IsDrawingLineWireOrBus(), EDA_ITEM::IsType(), and SCH_ITEM_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 259 of file sch_line_wire_bus_tool.cpp.

260{
261 return IsDrawingLineWireOrBus( aSelection )
262 && aSelection.Front()->IsType( { SCH_ITEM_LOCATE_GRAPHIC_LINE_T } );
263}
@ SCH_ITEM_LOCATE_GRAPHIC_LINE_T
Definition: typeinfo.h:172

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

Referenced by Init().

◆ IsDrawingLineWireOrBus()

bool SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus ( const SELECTION aSelection)
static

Definition at line 280 of file sch_line_wire_bus_tool.cpp.

281{
282 // NOTE: for immediate hotkeys, it is NOT required that the line, wire or bus tool
283 // be selected
284 SCH_ITEM* item = (SCH_ITEM*) aSelection.Front();
285 return item && item->IsNew() && item->Type() == SCH_LINE_T;
286}
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
bool IsNew() const
Definition: eda_item.h:103
@ SCH_LINE_T
Definition: typeinfo.h:146

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 266 of file sch_line_wire_bus_tool.cpp.

267{
268 return IsDrawingLineWireOrBus( aSelection )
269 && aSelection.Front()->IsType( { SCH_ITEM_LOCATE_WIRE_T } );
270}
@ SCH_ITEM_LOCATE_WIRE_T
Definition: typeinfo.h:170

References SELECTION::Front(), IsDrawingLineWireOrBus(), EDA_ITEM::IsType(), and SCH_ITEM_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{
34}
bool IsToolActive(TOOL_ID aId) const
Return true if a tool with given id is active (executing)

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

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

◆ Reset()

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

Bring the tool to a known, initial state.

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

Parameters
aReasoncontains information about the reason of tool reset.

Implements TOOL_BASE.

Definition at line 86 of file ee_tool_base.h.

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

◆ resetTransitions()

void TOOL_INTERACTIVE::resetTransitions ( )
privateinherited

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

Definition at line 63 of file tool_interactive.cpp.

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

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

◆ RunMainStack()

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

Call a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 87 of file tool_interactive.cpp.

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

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

Referenced by DRAWING_TOOL::PlaceText().

◆ saveCopyInUndoList()

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

Definition at line 134 of file ee_tool_base.h.

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

◆ SetContextMenu()

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

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

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

Definition at line 76 of file tool_interactive.cpp.

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

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

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

◆ setTransitions()

void SCH_LINE_WIRE_BUS_TOOL::setTransitions ( )
overrideprivatevirtual

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

It is called every time tool is reset or finished.

Implements TOOL_INTERACTIVE.

Definition at line 1291 of file sch_line_wire_bus_tool.cpp.

1292{
1296
1298}
static TOOL_ACTION unfoldBus
Definition: ee_actions.h:83
int DrawSegments(const TOOL_EVENT &aEvent)
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))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).

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

◆ simplifyWireList()

void SCH_LINE_WIRE_BUS_TOOL::simplifyWireList ( )
private

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

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

Set up handlers for various events.

Example:

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

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

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

Definition at line 1086 of file sch_line_wire_bus_tool.cpp.

1087{
1088 for( auto it = m_wires.begin(); it != m_wires.end(); )
1089 {
1090 SCH_LINE* line = *it;
1091
1092 if( line->IsNull() )
1093 {
1094 delete line;
1095 it = m_wires.erase( it );
1096 continue;
1097 }
1098
1099 auto next_it = it;
1100 ++next_it;
1101
1102 if( next_it == m_wires.end() )
1103 break;
1104
1105 SCH_LINE* next_line = *next_it;
1106
1107 if( SCH_LINE* merged = line->MergeOverlap( m_frame->GetScreen(), next_line, false ) )
1108 {
1109 delete line;
1110 delete next_line;
1111 it = m_wires.erase( it );
1112 *it = merged;
1113 }
1114
1115 ++it;
1116 }
1117}
SCH_LINE * MergeOverlap(SCH_SCREEN *aScreen, SCH_LINE *aLine, bool aCheckJunctions)
Check line against aLine to see if it overlaps and merge if it does.
Definition: sch_line.cpp:440

References SCH_EDIT_FRAME::GetScreen(), SCH_LINE::IsNull(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_wires, and SCH_LINE::MergeOverlap().

Referenced by finishSegments().

◆ startSegments()

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

Definition at line 1030 of file sch_line_wire_bus_tool.cpp.

1032{
1033 // If a segment isn't provided to copy properties from, we need to create one
1034 if( aSegment == nullptr )
1035 {
1036 switch( aType )
1037 {
1038 default: aSegment = new SCH_LINE( aPos, LAYER_NOTES ); break;
1039 case LAYER_WIRE: aSegment = new SCH_LINE( aPos, LAYER_WIRE ); break;
1040 case LAYER_BUS: aSegment = new SCH_LINE( aPos, LAYER_BUS ); break;
1041 }
1042
1043 // Give segments a parent so they find the default line/wire/bus widths
1044 aSegment->SetParent( &m_frame->Schematic() );
1045 }
1046 else
1047 {
1048 aSegment = static_cast<SCH_LINE*>( aSegment->Duplicate() );
1049 aSegment->SetStartPoint( aPos );
1050 }
1051
1052
1053 aSegment->SetFlags( IS_NEW | IS_MOVING );
1054 m_wires.push_back( aSegment );
1055
1056 m_selectionTool->AddItemToSel( aSegment, true /*quiet mode*/ );
1057
1058 // We need 2 segments to go from a given start pin to an end point when the
1059 // horizontal and vertical lines only switch is on.
1061 {
1062 aSegment = static_cast<SCH_LINE*>( aSegment->Duplicate() );
1063 aSegment->SetFlags( IS_NEW | IS_MOVING );
1064 m_wires.push_back( aSegment );
1065
1066 m_selectionTool->AddItemToSel( aSegment, true /*quiet mode*/ );
1067 }
1068
1069 return aSegment;
1070}

References SELECTION_TOOL::AddItemToSel(), SCH_ITEM::Duplicate(), SCH_BASE_FRAME::eeconfig(), IS_MOVING, IS_NEW, LAYER_BUS, LAYER_NOTES, LAYER_WIRE, EESCHEMA_SETTINGS::DRAWING::line_mode, 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(), EDA_ITEM::SetParent(), and SCH_LINE::SetStartPoint().

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

◆ TrimOverLappingWires()

int SCH_LINE_WIRE_BUS_TOOL::TrimOverLappingWires ( EE_SELECTION aSelection)

Logic to remove wires when overlapping correct items.

If the line intersects with an item in the selection at only two points, then we can remove the line between the two points.

Definition at line 1236 of file sch_line_wire_bus_tool.cpp.

1237{
1238 SCHEMATIC* sch = getModel<SCHEMATIC>();
1239 SCH_SCREEN* screen = sch->CurrentSheet().LastScreen();
1240
1241 std::set<SCH_LINE*> lines;
1242 BOX2I bb = aSelection->GetBoundingBox();
1243
1244 for( EDA_ITEM* item : screen->Items().Overlapping( SCH_LINE_T, bb ) )
1245 lines.insert( static_cast<SCH_LINE*>( item ) );
1246
1247 for( unsigned ii = 0; ii < aSelection->GetSize(); ii++ )
1248 {
1249 SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aSelection->GetItem( ii ) );
1250
1251 if( !item || !item->IsConnectable() || ( item->Type() == SCH_LINE_T ) )
1252 continue;
1253
1254 std::vector<VECTOR2I> pts = item->GetConnectionPoints();
1255
1258 for( SCH_LINE* line : lines )
1259 {
1260 std::vector<VECTOR2I> conn_pts;
1261
1262 for( VECTOR2I pt : pts )
1263 {
1264 if( IsPointOnSegment( line->GetStartPoint(), line->GetEndPoint(), pt ) )
1265 conn_pts.push_back( pt );
1266
1267 if( conn_pts.size() > 2 )
1268 break;
1269 }
1270
1271 if( conn_pts.size() == 2 )
1272 m_frame->TrimWire( conn_pts[0], conn_pts[1] );
1273 }
1274 }
1275
1276 return 0;
1277}
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
BOX2I GetBoundingBox() const override
Holds all the data relating to one schematic.
Definition: schematic.h:61
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:122
virtual bool IsConnectable() const
Definition: sch_item.h:349
virtual std::vector< VECTOR2I > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
Definition: sch_item.h:364
SCH_SCREEN * LastScreen()
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
Definition: selection.cpp:75
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:99

References SCHEMATIC::CurrentSheet(), EE_SELECTION::GetBoundingBox(), SCH_ITEM::GetConnectionPoints(), SELECTION::GetItem(), SELECTION::GetSize(), SCH_ITEM::IsConnectable(), IsPointOnSegment(), SCH_SCREEN::Items(), SCH_SHEET_PATH::LastScreen(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_RTREE::Overlapping(), SCH_LINE_T, SCH_EDIT_FRAME::TrimWire(), and EDA_ITEM::Type().

Referenced by SCH_MOVE_TOOL::AlignElements(), SCH_MOVE_TOOL::Main(), SCH_EDIT_TOOL::Mirror(), SCH_DRAWING_TOOLS::PlaceSymbol(), SCH_EDIT_TOOL::RepeatDrawItem(), and SCH_EDIT_TOOL::Rotate().

◆ UnfoldBus()

int SCH_LINE_WIRE_BUS_TOOL::UnfoldBus ( const TOOL_EVENT aEvent)

Definition at line 315 of file sch_line_wire_bus_tool.cpp.

316{
317 if( m_inDrawingTool )
318 return 0;
319
321
322 wxString* netPtr = aEvent.Parameter<wxString*>();
323 wxString net;
324 SCH_LINE* segment = nullptr;
325
326 m_frame->PushTool( aEvent );
327 Activate();
328
329 if( netPtr )
330 {
331 net = *netPtr;
332 delete netPtr;
333 }
334 else
335 {
336 BUS_UNFOLD_MENU unfoldMenu;
337 unfoldMenu.SetTool( this );
338 unfoldMenu.SetShowTitle();
339
340 SetContextMenu( &unfoldMenu, CMENU_NOW );
341
342 while( TOOL_EVENT* evt = Wait() )
343 {
344 if( evt->Action() == TA_CHOICE_MENU_CHOICE )
345 {
346 std::optional<int> id = evt->GetCommandId();
347
348 if( id && ( *id > 0 ) )
349 net = *evt->Parameter<wxString*>();
350
351 break;
352 }
353 else if( evt->Action() == TA_CHOICE_MENU_CLOSED )
354 {
355 break;
356 }
357 else
358 {
359 evt->SetPassEvent();
360 }
361 }
362 }
363
364 // Break a wire for the given net out of the bus
365 if( !net.IsEmpty() )
366 segment = doUnfoldBus( net );
367
368 // If we have an unfolded wire to draw, then draw it
369 if( segment )
370 {
371 return doDrawSegments( aEvent, LAYER_WIRE, false );
372 }
373 else
374 {
375 m_frame->PopTool( aEvent );
376 return 0;
377 }
378}
void SetContextMenu(ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
Assign a context menu and tells when it should be activated.
@ CMENU_NOW
Definition: tool_event.h:148
@ TA_CHOICE_MENU_CLOSED
Definition: tool_event.h:96

References TOOL_INTERACTIVE::Activate(), CMENU_NOW, doDrawSegments(), doUnfoldBus(), LAYER_WIRE, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_inDrawingTool, 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().

◆ updateItem()

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

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

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

Definition at line 103 of file ee_tool_base.h.

◆ Wait()

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

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

No parameters means waiting for any event.

Definition at line 57 of file tool_interactive.cpp.

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

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

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

Member Data Documentation

◆ m_busUnfold

BUS_UNFOLDING_T SCH_LINE_WIRE_BUS_TOOL::m_busUnfold
private

◆ m_frame

SCH_EDIT_FRAME * EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame
protectedinherited

Definition at line 182 of file ee_tool_base.h.

◆ m_inDrawingTool

bool SCH_LINE_WIRE_BUS_TOOL::m_inDrawingTool
private

Definition at line 140 of file sch_line_wire_bus_tool.h.

Referenced by DrawSegments(), and UnfoldBus().

◆ m_isSymbolEditor

bool EE_TOOL_BASE< SCH_EDIT_FRAME >::m_isSymbolEditor
protectedinherited

Definition at line 185 of file ee_tool_base.h.

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

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

Definition at line 125 of file tool_interactive.h.

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

◆ m_selectionTool

EE_SELECTION_TOOL* EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool
protectedinherited

Definition at line 184 of file ee_tool_base.h.

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Name of the tool.

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

Definition at line 210 of file tool_base.h.

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

◆ m_toolMgr

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 215 of file tool_base.h.

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

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Definition at line 214 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

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

Definition at line 207 of file tool_base.h.

Referenced by TOOL_BASE::GetType().

◆ m_view

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

Definition at line 183 of file ee_tool_base.h.

◆ m_wires

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

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