KiCad PCB EDA Suite
SCH_WIRE_BUS_TOOL Class Reference

Class SCH_LINE_DRAWING_TOOL. More...

#include <sch_wire_bus_tool.h>

Inheritance diagram for SCH_WIRE_BUS_TOOL:
EE_TOOL_BASE< SCH_EDIT_FRAME > TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 

Determines the reason of reset for a tool

More...
 

Public Member Functions

 SCH_WIRE_BUS_TOOL ()
 
 ~SCH_WIRE_BUS_TOOL ()
 
bool Init () override
 Function Init() Init() is called once upon a registration of the tool. More...
 
int StartWire (const TOOL_EVENT &aEvent)
 
int StartBus (const TOOL_EVENT &aEvent)
 
int StartLine (const TOOL_EVENT &aEvent)
 
int DrawWires (const TOOL_EVENT &aEvent)
 
int DrawBusses (const TOOL_EVENT &aEvent)
 
int DrawLines (const TOOL_EVENT &aEvent)
 
int UnfoldBus (const TOOL_EVENT &aEvent)
 
void Reset (RESET_REASON aReason) override
 Function Reset() Brings the tool to a known, initial state. More...
 
TOOL_MENUGetToolMenu ()
 

Get the tool's top-level context menu

More...
 
void Activate ()
 Function Activate() Runs the tool. More...
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Function SetContextMenu() More...
 
void RunMainStack (std::function< void()> aFunc)
 Function RunMainStack() More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Go() More...
 
OPT_TOOL_EVENT Wait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Wait() More...
 
TOOL_TYPE GetType () const
 Function GetType() Returns the type of the tool. More...
 
TOOL_ID GetId () const
 Function GetId() Returns the unique identifier of the tool. More...
 
const std::string & GetName () const
 Function GetName() Returns the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool. More...
 
TOOL_SETTINGSGetSettings ()
 
bool IsToolActive () const
 

Static Public Member Functions

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

Protected Member Functions

void updateView (EDA_ITEM *aItem) const
 

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

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

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

More...
 
const TOOL_EVENT evActivate (std::string aToolName="")
 functions below are not yet implemented - their interface may change More...
 
const TOOL_EVENT evCommand (int aCommandId=-1)
 
const TOOL_EVENT evCommand (std::string aCommandStr="")
 
const TOOL_EVENT evMotion ()
 
const TOOL_EVENT evClick (int aButton=BUT_ANY)
 
const TOOL_EVENT evDrag (int aButton=BUT_ANY)
 
const TOOL_EVENT evButtonUp (int aButton=BUT_ANY)
 
const TOOL_EVENT evButtonDown (int aButton=BUT_ANY)
 
void attachManager (TOOL_MANAGER *aManager)
 Function attachManager() More...
 
KIGFX::VIEWgetView () const
 Function getView() More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Function getViewControls() More...
 
template<typename T >
T * getEditFrame () const
 Function getEditFrame() More...
 
template<typename T >
T * getModel () const
 Function getModel() More...
 

Protected Attributes

SCH_EDIT_FRAMEm_frame
 
KIGFX::SCH_VIEWm_view
 
EE_SELECTION_TOOLm_selectionTool
 
bool m_isLibEdit
 
TOOL_MENU m_menu
 Menu model displayed by the tool. More...
 
TOOL_TYPE m_type
 

Stores the type of the tool.

More...
 
TOOL_ID m_toolId
 

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

More...
 
std::string m_toolName
 

Name of the tool.

More...
 
TOOL_MANAGERm_toolMgr
 
TOOL_SETTINGS m_toolSettings
 

Private Member Functions

int doDrawSegments (int aType, SCH_LINE *aSegment)
 
SCH_LINEstartSegments (int aType, const wxPoint &aPos)
 
SCH_LINEdoUnfoldBus (const wxString &aNet)
 
void finishSegments ()
 
void setTransitions () override
 

Sets up handlers for various events.

More...
 

Private Attributes

BUS_UNFOLDING_T m_busUnfold
 Data related to bus unfolding tool. More...
 

Detailed Description

Class SCH_LINE_DRAWING_TOOL.

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

Definition at line 59 of file sch_wire_bus_tool.h.

Member Enumeration Documentation

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determines the reason of reset for a tool

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 80 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ SCH_WIRE_BUS_TOOL()

SCH_WIRE_BUS_TOOL::SCH_WIRE_BUS_TOOL ( )

Definition at line 189 of file sch_wire_bus_tool.cpp.

189  :
190  EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.WireBusDrawing" )
191 {
192  m_busUnfold = {};
193 }
BUS_UNFOLDING_T m_busUnfold
Data related to bus unfolding tool.

References m_busUnfold.

◆ ~SCH_WIRE_BUS_TOOL()

SCH_WIRE_BUS_TOOL::~SCH_WIRE_BUS_TOOL ( )

Definition at line 196 of file sch_wire_bus_tool.cpp.

197 {
198 }

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Function Activate() Runs the tool.

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

Definition at line 49 of file tool_interactive.cpp.

50 {
52 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:211
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls a tool by sending a tool activation event to tool of given ID.

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

Referenced by AUTOPLACE_TOOL::autoplace(), LIB_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), EDIT_TOOL::doCopyToClipboard(), doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), SCH_DRAWING_TOOLS::doPlaceComponent(), SCH_DRAWING_TOOLS::doSingleClickPlace(), LIB_DRAWING_TOOLS::doTwoClickPlace(), SCH_DRAWING_TOOLS::doTwoClickPlace(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::drawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), EDIT_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), EDIT_TOOL::pickCopyReferencePoint(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), PCB_EDITOR_CONTROL::ShowLocalRatsnest(), StartBus(), StartWire(), and UnfoldBus().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Function attachManager()

Sets the TOOL_MANAGER the tool will belong to. Called by TOOL_MANAGER::RegisterTool()

Definition at line 59 of file tool_base.cpp.

60 {
61  m_toolMgr = aManager;
62  m_toolSettings = TOOL_SETTINGS( this );
63 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:217
friend class TOOL_SETTINGS
Definition: tool_base.h:155

References TOOL_BASE::m_toolMgr, TOOL_BASE::m_toolSettings, and TOOL_BASE::TOOL_SETTINGS.

Referenced by TOOL_MANAGER::RegisterTool().

◆ doDrawSegments()

int SCH_WIRE_BUS_TOOL::doDrawSegments ( int  aType,
SCH_LINE aSegment 
)
private

Definition at line 569 of file sch_wire_bus_tool.cpp.

570 {
571  bool forceHV = m_frame->GetForceHVLines();
572  SCH_SCREEN* screen = m_frame->GetScreen();
573  wxPoint cursorPos;
574 
575  getViewControls()->ShowCursor( true );
576 
577  if( aSegment == nullptr )
578  Activate();
579 
580  // Main loop: keep receiving events
581  while( OPT_TOOL_EVENT evt = Wait() )
582  {
583  cursorPos = (wxPoint)getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
584 
585  //------------------------------------------------------------------------
586  // Handle cancel:
587  //
588  if( TOOL_EVT_UTILS::IsCancelInteractive( evt.get() ) )
589  {
590  if( aSegment || m_busUnfold.in_progress )
591  {
593 
594  aSegment = nullptr;
595  s_wires.DeleteAll();
596 
597  if( m_busUnfold.entry )
599 
602 
603  delete m_busUnfold.entry;
604  delete m_busUnfold.label;
605  m_busUnfold = {};
606 
607  m_view->ClearPreview();
608  m_view->ShowPreview( false );
609 
610  if( !evt->IsActivate() )
611  continue;
612  }
613 
614  if( ( evt->IsAction( &EE_ACTIONS::drawWire ) && aType == LAYER_WIRE )
615  || ( evt->IsAction( &EE_ACTIONS::drawBus ) && aType == LAYER_BUS )
616  || ( evt->IsAction( &EE_ACTIONS::unfoldBus ) && aType == LAYER_WIRE ) )
617  {
618  // Don't reset tool. If we do the next command will think it needs to
619  // re-select the tool rather than start a wire or bus.
620  }
621  else
622  {
624  }
625 
626  break;
627  }
628  //------------------------------------------------------------------------
629  // Handle finish:
630  //
631  else if( evt->IsAction( &EE_ACTIONS::finishLineWireOrBus )
632  || evt->IsAction( &EE_ACTIONS::finishWire )
633  || evt->IsAction( &EE_ACTIONS::finishBus )
634  || evt->IsAction( &EE_ACTIONS::finishLine ) )
635  {
636  if( aSegment || m_busUnfold.in_progress )
637  {
638  finishSegments();
639  aSegment = nullptr;
640  }
641 
643  break;
644  }
645  //------------------------------------------------------------------------
646  // Handle click:
647  //
648  else if( evt->IsClick( BUT_LEFT ) || ( aSegment && evt->IsDblClick( BUT_LEFT ) ) )
649  {
650  // First click when unfolding places the label and wire-to-bus entry
652  {
653  wxASSERT( aType == LAYER_WIRE );
654 
656  m_busUnfold.label_placed = true;
657  }
658 
659  if( !aSegment )
660  {
661  aSegment = startSegments( aType, cursorPos );
662  }
663  // Create a new segment if we're out of previously-created ones
664  else if( !aSegment->IsNull() || ( forceHV && !aSegment->Back()->IsNull() ) )
665  {
666  // Terminate the command if the end point is on a pin, junction, or another
667  // wire or bus.
669  && screen->IsTerminalPoint( cursorPos, aSegment->GetLayer() ) )
670  {
671  finishSegments();
672  aSegment = nullptr;
673 
675  break;
676  }
677  else
678  {
679  aSegment->SetEndPoint( cursorPos );
680 
681  // Create a new segment, and chain it after the current segment.
682  aSegment = new SCH_LINE( *aSegment );
683  aSegment->SetFlags( IS_NEW | IS_MOVED );
684  aSegment->SetStartPoint( cursorPos );
685  s_wires.PushBack( aSegment );
686 
687  m_selectionTool->AddItemToSel( aSegment, true /*quiet mode*/ );
688  }
689  }
690 
691  if( evt->IsDblClick( BUT_LEFT ) && aSegment )
692  {
693  if( forceHV )
694  computeBreakPoint( screen, aSegment->Back(), cursorPos );
695 
696  finishSegments();
697  aSegment = nullptr;
698 
700  break;
701  }
702  }
703  //------------------------------------------------------------------------
704  // Handle motion:
705  //
706  else if( evt->IsMotion() )
707  {
708  m_view->ClearPreview();
709 
710  // Update the bus unfold posture based on the mouse movement
712  {
713  wxPoint cursor_delta = cursorPos - m_busUnfold.origin;
715 
716  bool offset = ( cursor_delta.x < 0 );
717  char shape = ( offset ? ( ( cursor_delta.y >= 0 ) ? '/' : '\\' )
718  : ( ( cursor_delta.y >= 0 ) ? '\\' : '/' ) );
719 
720  // Erase and redraw if necessary
721  if( shape != entry->GetBusEntryShape() || offset != m_busUnfold.offset )
722  {
723  entry->SetBusEntryShape( shape );
724  wxPoint entry_pos = m_busUnfold.origin;
725 
726  if( offset )
727  entry_pos -= entry->GetSize();
728 
729  entry->SetPosition( entry_pos );
730  m_busUnfold.offset = offset;
731 
732  m_frame->RefreshItem( entry );
733 
734  wxPoint wire_start = offset ? entry->GetPosition() : entry->m_End();
735  s_wires.begin()->SetStartPoint( wire_start );
736  }
737 
738  // Update the label "ghost" position
739  m_busUnfold.label->SetPosition( cursorPos );
741  }
742 
743  if( aSegment )
744  {
745  // Coerce the line to vertical or horizontal if necessary
746  if( forceHV )
747  computeBreakPoint( screen, aSegment->Back(), cursorPos );
748  else
749  aSegment->SetEndPoint( cursorPos );
750  }
751 
752  for( auto seg = s_wires.begin(); seg; seg = seg->Next() )
753  {
754  if( !seg->IsNull() ) // Add to preview if segment length != 0
755  m_view->AddToPreview( seg->Clone() );
756  }
757  }
758  //------------------------------------------------------------------------
759  // Handle context menu:
760  //
761  else if( evt->IsClick( BUT_RIGHT ) )
762  {
763  // Warp after context menu only if dragging...
764  if( !aSegment )
766 
768  }
769  else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CONTEXT_MENU_CHOICE )
770  {
771  if( evt->GetCommandId().get() >= ID_POPUP_SCH_UNFOLD_BUS
772  && evt->GetCommandId().get() <= ID_POPUP_SCH_UNFOLD_BUS_END )
773  {
774  wxASSERT_MSG( !aSegment, "Bus unfold event recieved when already drawing!" );
775 
776  aType = LAYER_WIRE;
777  wxString net = *evt->Parameter<wxString*>();
778  aSegment = doUnfoldBus( net );
779  }
780  }
781 
782  // Enable autopanning and cursor capture only when there is a segment to be placed
783  getViewControls()->SetAutoPan( !!aSegment );
784  getViewControls()->CaptureCursor( !!aSegment );
785  }
786 
787  return 0;
788 }
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
void AddToPreview(EDA_ITEM *aItem, bool aTakeOwnership=true)
Definition: sch_view.cpp:145
void AddToScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen=nullptr)
Add an item to the screen (and view) aScreen is the screen the item is located on,...
SCH_LINE * startSegments(int aType, const wxPoint &aPos)
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
SCH_LINE * doUnfoldBus(const wxString &aNet)
void SetPosition(const wxPoint &aPosition) override
Function SetPosition set the schematic item position to aPosition.
static TOOL_ACTION unfoldBus
Definition: ee_actions.h:84
static TOOL_ACTION finishLineWireOrBus
Definition: ee_actions.h:99
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
void RemoveFromScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen=nullptr)
Remove an item from the screen (and view) aScreen is the screen the item is located on,...
static TOOL_ACTION finishLine
Definition: ee_actions.h:102
void SetEndPoint(const wxPoint &aPosition)
Definition: sch_line.h:94
static void computeBreakPoint(SCH_SCREEN *aScreen, SCH_LINE *aSegment, wxPoint &aPosition)
Function ComputeBreakPoint computes the middle coordinate for 2 segments from the start point to aPos...
#define IS_NEW
New item, just created.
Definition: base_struct.h:114
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: sch_text.cpp:678
wxPoint origin
Origin (on the bus) of the unfold.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:259
static TOOL_ACTION drawWire
Definition: ee_actions.h:81
bool GetForceHVLines() const
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area.
bool IsNull() const
Definition: sch_line.h:88
void ShowPreview(bool aShow=true)
Definition: sch_view.cpp:173
void SetStartPoint(const wxPoint &aPosition)
Definition: sch_line.h:91
void ClearPreview()
Definition: sch_view.cpp:133
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:143
char GetBusEntryShape() const
function GetBusEntryShape
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:57
void SetBusEntryShape(char aShape)
function SetBusEntryShape
wxPoint m_End() const
bool IsCancelInteractive(const TOOL_EVENT &aEvt)
Function IsCancelInteractive()
Definition: tool_event.cpp:177
TOOL_MENU m_menu
Menu model displayed by the tool.
Definition: ee_tool_base.h:147
static DLIST< SCH_LINE > s_wires
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
SCH_BUS_WIRE_ENTRY * entry
static TOOL_ACTION drawBus
Definition: ee_actions.h:83
bool offset
True if the bus entry should be offset from origin.
SCH_LAYER_ID GetLayer() const
Function GetLayer returns the layer this item is on.
Definition: sch_item.h:193
virtual void SetNoToolSelected()
Select the ID_NO_TOOL_SELECTED id tool (Idle tool)
wxSize GetSize() const
Definition: sch_bus_entry.h:80
bool IsTerminalPoint(const wxPoint &aPosition, int aLayer)
Test if aPosition is a connection point on aLayer.
Definition: sch_screen.cpp:430
SCH_LINE * Back() const
Definition: sch_line.h:58
int AddItemToSel(const TOOL_EVENT &aEvent)
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
void RefreshItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
void VetoContextMenuMouseWarp()
Disables mouse warping after the current context menu is closed.
Definition: tool_manager.h:385
BUS_UNFOLDING_T m_busUnfold
Data related to bus unfolding tool.
Class for a wire to bus entry.
void Activate()
Function Activate() Runs the tool.
bool label_placed
True if user has placed the net label.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
static TOOL_ACTION finishBus
Definition: ee_actions.h:101
void SetPosition(const wxPoint &aPosition) override
Function SetPosition set the schematic item position to aPosition.
Definition: sch_text.h:191
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
static TOOL_ACTION finishWire
Definition: ee_actions.h:100
int GetToolId() const
Definition: draw_frame.h:524
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
bool in_progress
True if bus unfold operation is running.
OPT< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:486
wxPoint GetPosition() const override
Function GetPosition.
#define IS_MOVED
Item being moved.
Definition: base_struct.h:113

References TOOL_INTERACTIVE::Activate(), EE_SELECTION_TOOL::AddItemToSel(), KIGFX::SCH_VIEW::AddToPreview(), SCH_BASE_FRAME::AddToScreen(), SCH_LINE::Back(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), KIGFX::SCH_VIEW::ClearPreview(), EE_ACTIONS::clearSelection, SCH_LABEL::Clone(), computeBreakPoint(), doUnfoldBus(), EE_ACTIONS::drawBus, EE_ACTIONS::drawWire, BUS_UNFOLDING_T::entry, EE_ACTIONS::finishBus, EE_ACTIONS::finishLine, EE_ACTIONS::finishLineWireOrBus, finishSegments(), EE_ACTIONS::finishWire, SCH_BUS_ENTRY_BASE::GetBusEntryShape(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), SCH_EDIT_FRAME::GetForceHVLines(), SCH_ITEM::GetLayer(), SCH_BUS_ENTRY_BASE::GetPosition(), SCH_EDIT_FRAME::GetScreen(), SCH_BUS_ENTRY_BASE::GetSize(), EDA_DRAW_FRAME::GetToolId(), TOOL_BASE::getViewControls(), ID_NO_TOOL_SELECTED, ID_POPUP_SCH_UNFOLD_BUS, ID_POPUP_SCH_UNFOLD_BUS_END, BUS_UNFOLDING_T::in_progress, IS_MOVED, IS_NEW, TOOL_EVT_UTILS::IsCancelInteractive(), SCH_LINE::IsNull(), SCH_SCREEN::IsTerminalPoint(), BUS_UNFOLDING_T::label, BUS_UNFOLDING_T::label_placed, LAYER_BUS, LAYER_WIRE, m_busUnfold, SCH_BUS_ENTRY_BASE::m_End(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_menu, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_view, MD_ALT, BUS_UNFOLDING_T::offset, BUS_UNFOLDING_T::origin, SCH_BASE_FRAME::RefreshItem(), SCH_BASE_FRAME::RemoveFromScreen(), TOOL_MANAGER::RunAction(), s_wires, KIGFX::VIEW_CONTROLS::SetAutoPan(), SCH_BUS_ENTRY_BASE::SetBusEntryShape(), SCH_LINE::SetEndPoint(), EDA_ITEM::SetFlags(), EDA_DRAW_FRAME::SetNoToolSelected(), SCH_BUS_ENTRY_BASE::SetPosition(), SCH_TEXT::SetPosition(), SCH_LINE::SetStartPoint(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), KIGFX::SCH_VIEW::ShowPreview(), startSegments(), TA_CONTEXT_MENU_CHOICE, TC_COMMAND, EE_ACTIONS::unfoldBus, TOOL_MANAGER::VetoContextMenuMouseWarp(), and TOOL_INTERACTIVE::Wait().

Referenced by DrawBusses(), DrawLines(), DrawWires(), StartBus(), StartLine(), StartWire(), and UnfoldBus().

◆ doUnfoldBus()

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

Definition at line 424 of file sch_wire_bus_tool.cpp.

425 {
426  wxPoint pos = m_frame->GetCrossHairPosition();
427 
428  m_busUnfold.entry = new SCH_BUS_WIRE_ENTRY( pos, '\\' );
431 
432  m_busUnfold.label = new SCH_LABEL( m_busUnfold.entry->m_End(), aNet );
436 
437  m_busUnfold.in_progress = true;
438  m_busUnfold.origin = pos;
439  m_busUnfold.net_name = aNet;
440 
442 
444 }
void AddToScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen=nullptr)
Add an item to the screen (and view) aScreen is the screen the item is located on,...
SCH_LINE * startSegments(int aType, const wxPoint &aPos)
virtual void SetLabelSpinStyle(int aSpinStyle)
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
Definition: sch_text.cpp:248
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:231
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
wxPoint origin
Origin (on the bus) of the unfold.
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:219
wxPoint m_End() const
wxString net_name
Net label for the unfolding operation.
SCH_BUS_WIRE_ENTRY * entry
BUS_UNFOLDING_T m_busUnfold
Data related to bus unfolding tool.
Class for a wire to bus entry.
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Set the screen cross hair position to aPosition in logical (drawing) units.
int GetDefaultTextSize()
Default size for text in general.
bool in_progress
True if bus unfold operation is running.
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.

References SCH_BASE_FRAME::AddToScreen(), BUS_UNFOLDING_T::entry, EDA_DRAW_FRAME::GetCrossHairPosition(), GetDefaultTextSize(), SCH_EDIT_FRAME::GetScreen(), BUS_UNFOLDING_T::in_progress, BUS_UNFOLDING_T::label, LAYER_WIRE, m_busUnfold, SCH_BUS_ENTRY_BASE::m_End(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, BUS_UNFOLDING_T::net_name, BUS_UNFOLDING_T::origin, EDA_DRAW_FRAME::SetCrossHairPosition(), SCH_TEXT::SetLabelSpinStyle(), EDA_ITEM::SetParent(), EDA_TEXT::SetTextSize(), and startSegments().

Referenced by doDrawSegments(), and UnfoldBus().

◆ DrawBusses()

int SCH_WIRE_BUS_TOOL::DrawBusses ( const TOOL_EVENT aEvent)

Definition at line 352 of file sch_wire_bus_tool.cpp.

353 {
354  if( m_frame->GetToolId() == ID_BUS_TOOL )
355  return StartBus( aEvent );
356  else
357  {
358  m_frame->SetToolID( ID_BUS_TOOL, wxCURSOR_PENCIL, _( "Add bus" ) );
360 
361  return doDrawSegments( LAYER_BUS, nullptr );
362  }
363 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
int StartBus(const TOOL_EVENT &aEvent)
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:57
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg)
Set the tool command ID to aId and sets the cursor to aCursor.
int doDrawSegments(int aType, SCH_LINE *aSegment)
int GetToolId() const
Definition: draw_frame.h:524

References EE_ACTIONS::clearSelection, doDrawSegments(), EDA_DRAW_FRAME::GetToolId(), ID_BUS_TOOL, LAYER_BUS, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_BASE::m_toolMgr, TOOL_MANAGER::RunAction(), EDA_DRAW_FRAME::SetToolID(), and StartBus().

Referenced by setTransitions().

◆ DrawLines()

int SCH_WIRE_BUS_TOOL::DrawLines ( const TOOL_EVENT aEvent)

Definition at line 463 of file sch_wire_bus_tool.cpp.

464 {
466  return StartLine( aEvent );
467  else
468  {
469  m_frame->SetToolID( ID_SCHEMATIC_LINE_TOOL, wxCURSOR_PENCIL, _( "Add lines" ) );
471 
472  return doDrawSegments( LAYER_NOTES, nullptr );
473  }
474 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
int StartLine(const TOOL_EVENT &aEvent)
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:57
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg)
Set the tool command ID to aId and sets the cursor to aCursor.
int doDrawSegments(int aType, SCH_LINE *aSegment)
int GetToolId() const
Definition: draw_frame.h:524

References EE_ACTIONS::clearSelection, doDrawSegments(), EDA_DRAW_FRAME::GetToolId(), ID_SCHEMATIC_LINE_TOOL, LAYER_NOTES, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_BASE::m_toolMgr, TOOL_MANAGER::RunAction(), EDA_DRAW_FRAME::SetToolID(), and StartLine().

Referenced by setTransitions().

◆ DrawWires()

int SCH_WIRE_BUS_TOOL::DrawWires ( const TOOL_EVENT aEvent)

Definition at line 320 of file sch_wire_bus_tool.cpp.

321 {
322  if( m_frame->GetToolId() == ID_WIRE_TOOL )
323  return StartWire( aEvent );
324  else
325  {
326  m_frame->SetToolID( ID_WIRE_TOOL, wxCURSOR_PENCIL, _( "Add wire" ) );
328 
329  return doDrawSegments( LAYER_WIRE, nullptr );
330  }
331 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:57
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg)
Set the tool command ID to aId and sets the cursor to aCursor.
int doDrawSegments(int aType, SCH_LINE *aSegment)
int StartWire(const TOOL_EVENT &aEvent)
int GetToolId() const
Definition: draw_frame.h:524

References EE_ACTIONS::clearSelection, doDrawSegments(), EDA_DRAW_FRAME::GetToolId(), ID_WIRE_TOOL, LAYER_WIRE, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_BASE::m_toolMgr, TOOL_MANAGER::RunAction(), EDA_DRAW_FRAME::SetToolID(), and StartWire().

Referenced by setTransitions().

◆ evActivate()

const TOOL_EVENT TOOL_INTERACTIVE::evActivate ( std::string  aToolName = "")
protectedinherited

functions below are not yet implemented - their interface may change

◆ evButtonDown()

const TOOL_EVENT TOOL_INTERACTIVE::evButtonDown ( int  aButton = BUT_ANY)
protectedinherited

◆ evButtonUp()

const TOOL_EVENT TOOL_INTERACTIVE::evButtonUp ( int  aButton = BUT_ANY)
protectedinherited

◆ evClick()

const TOOL_EVENT TOOL_INTERACTIVE::evClick ( int  aButton = BUT_ANY)
protectedinherited

◆ evCommand() [1/2]

const TOOL_EVENT TOOL_INTERACTIVE::evCommand ( int  aCommandId = -1)
protectedinherited

◆ evCommand() [2/2]

const TOOL_EVENT TOOL_INTERACTIVE::evCommand ( std::string  aCommandStr = "")
protectedinherited

◆ evDrag()

const TOOL_EVENT TOOL_INTERACTIVE::evDrag ( int  aButton = BUT_ANY)
protectedinherited

◆ evMotion()

const TOOL_EVENT TOOL_INTERACTIVE::evMotion ( )
protectedinherited

◆ finishSegments()

void SCH_WIRE_BUS_TOOL::finishSegments ( )
private

Definition at line 886 of file sch_wire_bus_tool.cpp.

887 {
888  // Clear selection when done so that a new wire can be started.
889  // NOTE: this must be done before RemoveBacktracks is called or we might end up with
890  // freed selected items.
892 
893  PICKED_ITEMS_LIST itemList;
894 
895  // Remove segments backtracking over others
897 
898  // Collect the possible connection points for the new lines
899  std::vector< wxPoint > connections;
900  std::vector< wxPoint > new_ends;
901  m_frame->GetSchematicConnections( connections );
902 
903  // Check each new segment for possible junctions and add/split if needed
904  for( SCH_LINE* wire = s_wires.GetFirst(); wire; wire = wire->Next() )
905  {
906  if( wire->GetFlags() & SKIP_STRUCT )
907  continue;
908 
909  wire->GetConnectionPoints( new_ends );
910 
911  for( auto i : connections )
912  {
913  if( IsPointOnSegment( wire->GetStartPoint(), wire->GetEndPoint(), i ) )
914  new_ends.push_back( i );
915  }
916  itemList.PushItem( ITEM_PICKER( wire, UR_NEW ) );
917  }
918 
920  {
921  wxASSERT( m_busUnfold.entry && m_busUnfold.label );
922 
923  itemList.PushItem( ITEM_PICKER( m_busUnfold.entry, UR_NEW ) );
924  itemList.PushItem( ITEM_PICKER( m_busUnfold.label, UR_NEW ) );
925  }
926 
927  // Get the last non-null wire (this is the last created segment).
929 
930  // Add the new wires
931  while( s_wires.GetFirst() )
932  {
933  s_wires.GetFirst()->ClearFlags( IS_NEW | IS_MOVED );
934  m_frame->AddToScreen( s_wires.PopFront() );
935  }
936 
937  m_view->ClearPreview();
938  m_view->ShowPreview( false );
939 
940  getViewControls()->CaptureCursor( false );
941  getViewControls()->SetAutoPan( false );
942 
943  m_frame->SaveCopyInUndoList( itemList, UR_NEW );
944 
945  // Correct and remove segments that need to be merged.
947 
948  for( auto item = m_frame->GetScreen()->GetDrawItems(); item; item = item->Next() )
949  {
950  if( item->Type() != SCH_COMPONENT_T )
951  continue;
952 
953  std::vector< wxPoint > pts;
954  item->GetConnectionPoints( pts );
955 
956  if( pts.size() > 2 )
957  continue;
958 
959  for( auto i = pts.begin(); i != pts.end(); i++ )
960  {
961  for( auto j = i + 1; j != pts.end(); j++ )
962  m_frame->TrimWire( *i, *j );
963  }
964  }
965 
966  for( auto i : new_ends )
967  {
968  if( m_frame->GetScreen()->IsJunctionNeeded( i, true ) )
969  m_frame->AddJunction( i, true, false );
970  }
971 
973  m_busUnfold = {};
974 
977 
978  m_frame->OnModify();
979 }
bool IsPointOnSegment(const wxPoint &aSegStart, const wxPoint &aSegEnd, const wxPoint &aTestPoint)
Function IsPointOnSegment.
Definition: trigo.cpp:39
bool SchematicCleanUp(SCH_SCREEN *aScreen=nullptr)
Performs routine schematic cleaning including breaking wire and buses and deleting identical objects ...
void GetSchematicConnections(std::vector< wxPoint > &aConnections)
Collects a unique list of all possible connection points in the schematic.
void AddToScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen=nullptr)
Add an item to the screen (and view) aScreen is the screen the item is located on,...
bool IsJunctionNeeded(const wxPoint &aPosition, bool aNew=false)
Test if a junction is required for the items at aPosition on the screen.
Definition: sch_screen.cpp:350
SCH_ITEM * Next() const
Definition: sch_item.h:153
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:125
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
static const TOOL_EVENT SelectedItemsModified
Definition: actions.h:136
#define IS_NEW
New item, just created.
Definition: base_struct.h:114
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area.
void ShowPreview(bool aShow=true)
Definition: sch_view.cpp:173
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
void ClearPreview()
Definition: sch_view.cpp:133
void SaveCopyForRepeatItem(SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
SCH_JUNCTION * AddJunction(const wxPoint &aPos, bool aAppendToUndo=false, bool aFinal=true)
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:57
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
static DLIST< SCH_LINE > s_wires
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
SCH_BUS_WIRE_ENTRY * entry
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
static void removeBacktracks(DLIST< SCH_LINE > &aWires)
In a contiguous list of wires, remove wires that backtrack over the previous wire.
size_t i
Definition: json11.cpp:597
BUS_UNFOLDING_T m_busUnfold
Data related to bus unfolding tool.
bool TrimWire(const wxPoint &aStart, const wxPoint &aEnd)
If any single wire passes through both points, remove the portion between the two points,...
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
bool label_placed
True if user has placed the net label.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
void PostEvent(const TOOL_EVENT &aEvent)
Puts an event to the event queue to be processed at the end of event processing cycle.
Definition: tool_manager.h:238
bool in_progress
True if bus unfold operation is running.
#define IS_MOVED
Item being moved.
Definition: base_struct.h:113
SCH_ITEM * GetDrawItems() const
Definition: sch_screen.h:153

References SCH_EDIT_FRAME::AddJunction(), SCH_BASE_FRAME::AddToScreen(), KIGFX::VIEW_CONTROLS::CaptureCursor(), KIGFX::SCH_VIEW::ClearPreview(), EE_ACTIONS::clearSelection, BUS_UNFOLDING_T::entry, SCH_SCREEN::GetDrawItems(), SCH_EDIT_FRAME::GetSchematicConnections(), SCH_EDIT_FRAME::GetScreen(), TOOL_BASE::getViewControls(), i, BUS_UNFOLDING_T::in_progress, IS_MOVED, IS_NEW, SCH_SCREEN::IsJunctionNeeded(), IsPointOnSegment(), 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, SCH_ITEM::Next(), SCH_EDIT_FRAME::OnModify(), TOOL_MANAGER::PostEvent(), PICKED_ITEMS_LIST::PushItem(), removeBacktracks(), TOOL_MANAGER::RunAction(), s_wires, SCH_EDIT_FRAME::SaveCopyForRepeatItem(), SCH_EDIT_FRAME::SaveCopyInUndoList(), SCH_COMPONENT_T, SCH_EDIT_FRAME::SchematicCleanUp(), EVENTS::SelectedItemsModified, KIGFX::VIEW_CONTROLS::SetAutoPan(), KIGFX::SCH_VIEW::ShowPreview(), SKIP_STRUCT, SCH_EDIT_FRAME::TestDanglingEnds(), SCH_EDIT_FRAME::TrimWire(), and UR_NEW.

Referenced by doDrawSegments().

◆ getEditFrame()

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

Function getEditFrame()

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

Definition at line 188 of file tool_base.h.

189  {
190  return static_cast<T*>( getEditFrameInt() );
191  }
wxWindow * getEditFrameInt() const
Definition: tool_base.cpp:47

References TOOL_BASE::getEditFrameInt().

Referenced by ZONE_CREATE_HELPER::commitZone(), ZONE_CREATE_HELPER::createNewZone(), and TOOL_SETTINGS::getConfigBase().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Function GetId() Returns the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 122 of file tool_base.h.

123  {
124  return m_toolId;
125  }
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:211

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(), and TOOL_MANAGER::saveViewControls().

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

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

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

Definition at line 144 of file tool_base.h.

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

References TOOL_BASE::m_toolMgr.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), ZONE_CREATE_HELPER::createNewZone(), PCB_TOOL_BASE::doInteractiveItemPlacement(), ACTION_MENU::getToolManager(), ACTION_MENU::onMenuEvent(), and ZONE_CREATE_HELPER::performZoneCutout().

◆ getModel()

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

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 199 of file tool_base.h.

200  {
201  EDA_ITEM* m = getModelInt();
202  wxASSERT( dynamic_cast<T*>( m ) );
203 
204  return static_cast<T*>( m );
205  }
EDA_ITEM * getModelInt() const
Definition: tool_base.cpp:53
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:157

References TOOL_BASE::getModelInt().

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

◆ GetName()

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

Function GetName() Returns the name of the tool.

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

Returns
The name of the tool.

Definition at line 133 of file tool_base.h.

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

References TOOL_BASE::m_toolName.

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

◆ GetSettings()

TOOL_SETTINGS & TOOL_BASE::GetSettings ( )
inherited

Definition at line 77 of file tool_base.cpp.

78 {
79  return m_toolSettings;
80 }
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:217

References TOOL_BASE::m_toolSettings.

Referenced by ROUTER_TOOL::Init(), GERBVIEW_SELECTION_TOOL::selectable(), and ROUTER_TOOL::~ROUTER_TOOL().

◆ GetToolMenu()

TOOL_MENU& EE_TOOL_BASE< SCH_EDIT_FRAME >::GetToolMenu ( )
inlineinherited

Get the tool's top-level context menu

Definition at line 103 of file ee_tool_base.h.

103 { return m_menu; }
TOOL_MENU m_menu
Menu model displayed by the tool.
Definition: ee_tool_base.h:147

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 111 of file tool_base.h.

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

References TOOL_BASE::m_type.

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

◆ getView()

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

Function getView()

Returns the instance of VIEW object used in the application. It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 35 of file tool_base.cpp.

36 {
37  return m_toolMgr->GetView();
38 }
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:252
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216

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(), EE_SELECTION_TOOL::clearSelection(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), COMMON_TOOLS::CursorControl(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), COMMON_TOOLS::doGridPreset(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), MICROWAVE_TOOL::drawMicrowaveInductor(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), MODULE_EDITOR_TOOLS::EnumeratePads(), SELECTION_TOOL::findCallback(), ROUTER_TOOL::getStartLayer(), PCBNEW_CONTROL::GridResetOrigin(), PCBNEW_CONTROL::GridSetOrigin(), SELECTION_TOOL::guessSelectionCandidates(), EE_SELECTION_TOOL::highlight(), SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), EE_POINT_EDITOR::Main(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), LIB_EDIT_TOOL::Paste(), PNS::TOOL_BASE::pickSingleItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), PCB_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), SELECTION_TOOL::selectable(), GERBVIEW_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), SELECTION_TOOL::selectionContains(), GERBVIEW_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), COMMON_TOOLS::ToggleGrid(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), PCBNEW_CONTROL::updateGrid(), EE_POINT_EDITOR::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateView(), PCB_TOOL_BASE::view(), COMMON_TOOLS::ZoomFitScreen(), GERBVIEW_SELECTION_TOOL::zoomFitSelection(), SELECTION_TOOL::zoomFitSelection(), CVPCB_SELECTION_TOOL::~CVPCB_SELECTION_TOOL(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and SELECTION_TOOL::~SELECTION_TOOL().

◆ getViewControls()

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

Function getViewControls()

Returns the instance of VIEW_CONTROLS object used in the application. It allows tools to read & modify user input and its settings (eg. show cursor, enable snapping to grid, etc.)

Returns
The instance of VIEW_CONTROLS.

Definition at line 41 of file tool_base.cpp.

42 {
43  return m_toolMgr->GetViewControls();
44 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:257

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

Referenced by EE_POINT_EDITOR::addCorner(), POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), COMMON_TOOLS::CursorControl(), doDrawSegments(), SCH_DRAWING_TOOLS::doPlaceComponent(), SCH_DRAWING_TOOLS::doSingleClickPlace(), LIB_DRAWING_TOOLS::doTwoClickPlace(), SCH_DRAWING_TOOLS::doTwoClickPlace(), COMMON_TOOLS::doZoomToPreset(), MICROWAVE_TOOL::drawMicrowaveInductor(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), MODULE_EDITOR_TOOLS::EnumeratePads(), SELECTION_TOOL::findMove(), finishSegments(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_EDITOR_CONTROL::HighlightNet(), PCB_EDITOR_CONTROL::HighlightNetCursor(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), EE_PICKER_TOOL::Main(), PICKER_TOOL::Main(), CVPCB_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EDIT_TOOL::Main(), ROUTER_TOOL::mainLoop(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceImage(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), CVPCB_CONTROL::ResetCoords(), GERBVIEW_CONTROL::ResetCoords(), PCBNEW_CONTROL::ResetCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), SELECTION_TOOL::selectCursor(), GERBVIEW_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), EE_PICKER_TOOL::setControls(), PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), POINT_EDITOR::setEditedPoint(), LIB_MOVE_TOOL::updateModificationPoint(), SCH_MOVE_TOOL::updateModificationPoint(), EDIT_TOOL::updateModificationPoint(), and COMMON_TOOLS::ZoomCenter().

◆ Go()

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

Function Go()

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

Definition at line 135 of file tool_interactive.h.

137 {
138  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
139 
140  goInternal( sptr, aConditions );
141 }
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:59
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)

References TOOL_INTERACTIVE::goInternal().

Referenced by ZOOM_TOOL::setTransitions(), AUTOPLACE_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), MICROWAVE_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), PAD_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), EE_POINT_EDITOR::setTransitions(), LIB_CONTROL::setTransitions(), LIB_PIN_TOOL::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), LIB_DRAWING_TOOLS::setTransitions(), LIB_MOVE_TOOL::setTransitions(), POINT_EDITOR::setTransitions(), GERBVIEW_CONTROL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), LIB_EDIT_TOOL::setTransitions(), SCH_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), CVPCB_SELECTION_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), MODULE_EDITOR_TOOLS::setTransitions(), setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), PCBNEW_CONTROL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), EE_PICKER_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), PCB_EDITOR_CONTROL::setTransitions(), SELECTION_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), DRAWING_TOOL::setTransitions(), and EE_SELECTION_TOOL::setTransitions().

◆ Init()

bool SCH_WIRE_BUS_TOOL::Init ( )
overridevirtual

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

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

Reimplemented from TOOL_BASE.

Definition at line 201 of file sch_wire_bus_tool.cpp.

202 {
204 
205  auto wireOrBusTool = [ this ] ( const SELECTION& aSel ) {
206  return ( m_frame->GetToolId() == ID_WIRE_TOOL || m_frame->GetToolId() == ID_BUS_TOOL );
207  };
208 
209  auto lineTool = [ this ] ( const SELECTION& aSel ) {
210  return ( m_frame->GetToolId() == ID_SCHEMATIC_LINE_TOOL );
211  };
212 
213  auto belowRootSheetCondition = [] ( const SELECTION& aSel ) {
214  return g_CurrentSheet->Last() != g_RootSheet;
215  };
216 
217  auto busSelection = EE_CONDITIONS::MoreThan( 0 )
219 
220  auto& ctxMenu = m_menu.GetMenu();
221 
222  //
223  // Build the tool menu
224  //
225  ctxMenu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 2 );
226 
227  ctxMenu.AddSeparator( EE_CONDITIONS::ShowAlways, 10 );
228  ctxMenu.AddItem( EE_ACTIONS::startWire, wireOrBusTool && EE_CONDITIONS::Idle, 10 );
229  ctxMenu.AddItem( EE_ACTIONS::startBus, wireOrBusTool && EE_CONDITIONS::Idle, 10 );
230  ctxMenu.AddItem( EE_ACTIONS::startLines, lineTool && EE_CONDITIONS::Idle, 10 );
231  ctxMenu.AddItem( EE_ACTIONS::finishWire, IsDrawingWire, 10 );
232  ctxMenu.AddItem( EE_ACTIONS::finishBus, IsDrawingBus, 10 );
233  ctxMenu.AddItem( EE_ACTIONS::finishLine, IsDrawingLine, 10 );
234 
235  std::shared_ptr<BUS_UNFOLD_MENU> busUnfoldMenu = std::make_shared<BUS_UNFOLD_MENU>();
236  busUnfoldMenu->SetTool( this );
237  m_menu.AddSubMenu( busUnfoldMenu );
238  ctxMenu.AddMenu( busUnfoldMenu.get(), EE_CONDITIONS::Idle, 10 );
239 
240  ctxMenu.AddSeparator( wireOrBusTool && EE_CONDITIONS::Idle, 100 );
241  ctxMenu.AddItem( EE_ACTIONS::addJunction, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
242  ctxMenu.AddItem( EE_ACTIONS::addLabel, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
243  ctxMenu.AddItem( EE_ACTIONS::addGlobalLabel, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
244  ctxMenu.AddItem( EE_ACTIONS::addHierLabel, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
245  ctxMenu.AddItem( EE_ACTIONS::breakWire, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
246  ctxMenu.AddItem( EE_ACTIONS::breakBus, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
247 
248  ctxMenu.AddSeparator( wireOrBusTool && EE_CONDITIONS::Idle, 200 );
249  ctxMenu.AddItem( EE_ACTIONS::selectNode, wireOrBusTool && EE_CONDITIONS::Idle, 200 );
250  ctxMenu.AddItem( EE_ACTIONS::selectConnection, wireOrBusTool && EE_CONDITIONS::Idle, 200 );
251 
252  //
253  // Add bus unfolding to the selection tool
254  //
256 
257  std::shared_ptr<BUS_UNFOLD_MENU> selBusUnfoldMenu = std::make_shared<BUS_UNFOLD_MENU>();
258  selBusUnfoldMenu->SetTool( m_selectionTool );
259  m_selectionTool->GetToolMenu().AddSubMenu( selBusUnfoldMenu );
260  selToolMenu.AddMenu( selBusUnfoldMenu.get(), busSelection && EE_CONDITIONS::Idle, 100 );
261 
262  return true;
263 }
static bool ShowAlways(const SELECTION &aSelection)
Function ShowAlways The default condition function (always returns true).
void AddMenu(ACTION_MENU *aMenu, const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Function AddMenu()
static TOOL_ACTION addHierLabel
Definition: ee_actions.h:135
static TOOL_ACTION breakBus
Definition: ee_actions.h:143
SCH_SHEET * Last() const
Function Last returns a pointer to the last sheet of the list One can see the others sheet as the "pa...
TOOL_MENU & GetToolMenu()
static SELECTION_CONDITION MoreThan(int aNumber)
Function MoreThan Creates a functor that tests if the number of selected items is greater than the va...
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
static TOOL_ACTION selectConnection
If current selection is a wire or bus, expand to entire connection.
Definition: ee_actions.h:54
static SELECTION_CONDITION Idle
static bool IsDrawingLine(const SELECTION &aSelection)
static TOOL_ACTION breakWire
Definition: ee_actions.h:142
static TOOL_ACTION finishLine
Definition: ee_actions.h:102
static TOOL_ACTION leaveSheet
Definition: ee_actions.h:161
bool Init() override
Function Init() Init() is called once upon a registration of the tool.
Definition: ee_tool_base.h:69
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:56
SCH_SHEET_PATH * g_CurrentSheet
With the new connectivity algorithm, many more places than before want to know what the current sheet...
static TOOL_ACTION startLines
Definition: ee_actions.h:96
static TOOL_ACTION addJunction
Definition: ee_actions.h:132
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:143
static bool IsDrawingBus(const SELECTION &aSelection)
TOOL_MENU m_menu
Menu model displayed by the tool.
Definition: ee_tool_base.h:147
void AddSubMenu(std::shared_ptr< ACTION_MENU > aSubMenu)
Function CreateSubMenu.
Definition: tool_menu.cpp:52
static SELECTION_CONDITION OnlyType(KICAD_T aType)
Function OnlyType Creates a functor that tests if the selected items are only of given type.
static TOOL_ACTION selectNode
Select the junction, wire or bus segment under the cursor.
Definition: ee_actions.h:50
static TOOL_ACTION startWire
Definition: ee_actions.h:80
static TOOL_ACTION startBus
Definition: ee_actions.h:82
static TOOL_ACTION addLabel
Definition: ee_actions.h:133
static TOOL_ACTION addGlobalLabel
Definition: ee_actions.h:134
static TOOL_ACTION finishBus
Definition: ee_actions.h:101
static bool IsDrawingWire(const SELECTION &aSelection)
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Function AddItem()
static TOOL_ACTION finishWire
Definition: ee_actions.h:100
int GetToolId() const
Definition: draw_frame.h:524

References EE_ACTIONS::addGlobalLabel, EE_ACTIONS::addHierLabel, CONDITIONAL_MENU::AddItem(), EE_ACTIONS::addJunction, EE_ACTIONS::addLabel, CONDITIONAL_MENU::AddMenu(), TOOL_MENU::AddSubMenu(), EE_ACTIONS::breakBus, EE_ACTIONS::breakWire, EE_ACTIONS::finishBus, EE_ACTIONS::finishLine, EE_ACTIONS::finishWire, g_CurrentSheet, g_RootSheet, TOOL_MENU::GetMenu(), EDA_DRAW_FRAME::GetToolId(), EE_SELECTION_TOOL::GetToolMenu(), ID_BUS_TOOL, ID_SCHEMATIC_LINE_TOOL, ID_WIRE_TOOL, EE_CONDITIONS::Idle, EE_TOOL_BASE< T >::Init(), IsDrawingBus(), IsDrawingLine(), IsDrawingWire(), SCH_SHEET_PATH::Last(), EE_ACTIONS::leaveSheet, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_menu, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, SELECTION_CONDITIONS::MoreThan(), SELECTION_CONDITIONS::OnlyType(), SCH_LINE_LOCATE_BUS_T, EE_ACTIONS::selectConnection, EE_ACTIONS::selectNode, SELECTION_CONDITIONS::ShowAlways(), EE_ACTIONS::startBus, EE_ACTIONS::startLines, and EE_ACTIONS::startWire.

◆ IsDrawingBus()

bool SCH_WIRE_BUS_TOOL::IsDrawingBus ( const SELECTION aSelection)
static

Definition at line 286 of file sch_wire_bus_tool.cpp.

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

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

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

◆ IsDrawingLine()

bool SCH_WIRE_BUS_TOOL::IsDrawingLine ( const SELECTION aSelection)
static

Definition at line 272 of file sch_wire_bus_tool.cpp.

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

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

Referenced by Init().

◆ IsDrawingLineWireOrBus()

bool SCH_WIRE_BUS_TOOL::IsDrawingLineWireOrBus ( const SELECTION aSelection)
static

Definition at line 293 of file sch_wire_bus_tool.cpp.

294 {
295  // NOTE: for immediate hotkeys, it is NOT required that the line, wire or bus tool
296  // be selected
297  SCH_ITEM* item = (SCH_ITEM*) aSelection.Front();
298  return isNewSegment( item );
299 }
static bool isNewSegment(SCH_ITEM *aItem)
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
Definition: sch_item.h:114
EDA_ITEM * Front() const
Definition: selection.h:155

References SELECTION::Front(), and isNewSegment().

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

◆ IsDrawingWire()

bool SCH_WIRE_BUS_TOOL::IsDrawingWire ( const SELECTION aSelection)
static

Definition at line 279 of file sch_wire_bus_tool.cpp.

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

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

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

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 30 of file tool_base.cpp.

31 {
32  return m_toolMgr->IsToolActive( m_toolId );
33 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:211
bool IsToolActive(TOOL_ID aId) const
Function IsToolActive() Returns true if a tool with given id is active (executing)

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

◆ Reset()

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

Function Reset() Brings the tool to a known, initial state.

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

Parameters
aReasoncontains information about the reason of tool reset.

Implements TOOL_BASE.

Definition at line 90 of file ee_tool_base.h.

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

◆ RunMainStack()

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

Function RunMainStack()

Calls a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 85 of file tool_interactive.cpp.

86 {
87  m_toolMgr->RunMainStack( this, std::move( aFunc ) );
88 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
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_T  aType,
bool  aAppend = false 
)
inlineprotectedinherited

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

Definition at line 120 of file ee_tool_base.h.

121  {
122  KICAD_T itemType = aItem->Type();
123 
124  if( m_isLibEdit )
125  {
126  LIB_EDIT_FRAME* editFrame = dynamic_cast<LIB_EDIT_FRAME*>( m_frame );
127  editFrame->SaveCopyInUndoList( (LIB_ITEM*) aItem, aType, aAppend );
128  }
129  else
130  {
131  SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
132 
133  if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
134  editFrame->SaveCopyInUndoList( (SCH_ITEM*) aItem->GetParent(), UR_CHANGED, aAppend );
135  else
136  editFrame->SaveCopyInUndoList( (SCH_ITEM*) aItem, aType, aAppend );
137  }
138  }
Schematic editor (Eeschema) main window.
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
The base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
EDA_ITEM * GetParent() const
Definition: base_struct.h:214
The symbol library editor main window.
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
Definition: sch_item.h:114
void SaveCopyInUndoList(EDA_ITEM *ItemToCopy, UNDO_REDO_T undoType=UR_LIBEDIT, bool aAppend=false)
Create a copy of the current component, and save it in the undo list.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204

◆ SetContextMenu()

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

Function SetContextMenu()

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

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

Definition at line 74 of file tool_interactive.cpp.

75 {
76  if( aMenu )
77  aMenu->SetTool( this );
78  else
79  aTrigger = CMENU_OFF;
80 
81  m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger );
82 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
void SetTool(TOOL_INTERACTIVE *aTool)
Function SetTool() Sets a tool that is the creator of the menu.
void ScheduleContextMenu(TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Sets behaviour of the tool's context popup menu.

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

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), TOOL_MENU::ShowContextMenu(), and UnfoldBus().

◆ setTransitions()

void SCH_WIRE_BUS_TOOL::setTransitions ( )
overrideprivatevirtual

Sets up handlers for various events.

Implements TOOL_INTERACTIVE.

Definition at line 982 of file sch_wire_bus_tool.cpp.

983 {
987 
991 
993 }
int UnfoldBus(const TOOL_EVENT &aEvent)
int DrawWires(const TOOL_EVENT &aEvent)
int StartBus(const TOOL_EVENT &aEvent)
static TOOL_ACTION unfoldBus
Definition: ee_actions.h:84
int DrawBusses(const TOOL_EVENT &aEvent)
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
int StartLine(const TOOL_EVENT &aEvent)
static TOOL_ACTION startLines
Definition: ee_actions.h:96
static TOOL_ACTION drawWire
Definition: ee_actions.h:81
static TOOL_ACTION drawBus
Definition: ee_actions.h:83
static TOOL_ACTION startWire
Definition: ee_actions.h:80
int DrawLines(const TOOL_EVENT &aEvent)
static TOOL_ACTION startBus
Definition: ee_actions.h:82
static TOOL_ACTION drawLines
Definition: ee_actions.h:97
int StartWire(const TOOL_EVENT &aEvent)

References EE_ACTIONS::drawBus, DrawBusses(), DrawLines(), EE_ACTIONS::drawLines, EE_ACTIONS::drawWire, DrawWires(), TOOL_INTERACTIVE::Go(), StartBus(), EE_ACTIONS::startBus, StartLine(), EE_ACTIONS::startLines, StartWire(), EE_ACTIONS::startWire, UnfoldBus(), and EE_ACTIONS::unfoldBus.

◆ StartBus()

int SCH_WIRE_BUS_TOOL::StartBus ( const TOOL_EVENT aEvent)

Definition at line 337 of file sch_wire_bus_tool.cpp.

338 {
340 
341  Activate();
342 
345  return doDrawSegments( LAYER_BUS, segment );
346 }
virtual void MoveCursorToCrossHair() override
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
SCH_LINE * startSegments(int aType, const wxPoint &aPos)
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
SCH_DRAW_PANEL * GetCanvas() const override
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:57
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
int doDrawSegments(int aType, SCH_LINE *aSegment)
void Activate()
Function Activate() Runs the tool.
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.

References TOOL_INTERACTIVE::Activate(), EE_ACTIONS::clearSelection, doDrawSegments(), SCH_BASE_FRAME::GetCanvas(), EDA_DRAW_FRAME::GetCrossHairPosition(), LAYER_BUS, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_BASE::m_toolMgr, SCH_DRAW_PANEL::MoveCursorToCrossHair(), TOOL_MANAGER::RunAction(), and startSegments().

Referenced by DrawBusses(), and setTransitions().

◆ StartLine()

int SCH_WIRE_BUS_TOOL::StartLine ( const TOOL_EVENT aEvent)

Definition at line 450 of file sch_wire_bus_tool.cpp.

451 {
453 
456  return doDrawSegments( LAYER_BUS, segment );
457 }
virtual void MoveCursorToCrossHair() override
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
SCH_LINE * startSegments(int aType, const wxPoint &aPos)
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
SCH_DRAW_PANEL * GetCanvas() const override
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:57
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
int doDrawSegments(int aType, SCH_LINE *aSegment)
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.

References EE_ACTIONS::clearSelection, doDrawSegments(), SCH_BASE_FRAME::GetCanvas(), EDA_DRAW_FRAME::GetCrossHairPosition(), LAYER_BUS, LAYER_NOTES, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_BASE::m_toolMgr, SCH_DRAW_PANEL::MoveCursorToCrossHair(), TOOL_MANAGER::RunAction(), and startSegments().

Referenced by DrawLines(), and setTransitions().

◆ startSegments()

SCH_LINE * SCH_WIRE_BUS_TOOL::startSegments ( int  aType,
const wxPoint &  aPos 
)
private

Definition at line 791 of file sch_wire_bus_tool.cpp.

792 {
793  SCH_LINE* segment = nullptr;
794  bool forceHV = m_frame->GetForceHVLines();
795 
796  switch( aType )
797  {
798  default: segment = new SCH_LINE( aPos, LAYER_NOTES ); break;
799  case LAYER_WIRE: segment = new SCH_LINE( aPos, LAYER_WIRE ); break;
800  case LAYER_BUS: segment = new SCH_LINE( aPos, LAYER_BUS ); break;
801  }
802 
803  segment->SetFlags( IS_NEW | IS_MOVED );
804  s_wires.PushBack( segment );
805 
806  m_selectionTool->AddItemToSel( segment, true /*quiet mode*/ );
807 
808  // We need 2 segments to go from a given start pin to an end point when the
809  // horizontal and vertical lines only switch is on.
810  if( forceHV )
811  {
812  segment = new SCH_LINE( *segment );
813  segment->SetFlags( IS_NEW | IS_MOVED );
814  s_wires.PushBack( segment );
815 
816  m_selectionTool->AddItemToSel( segment, true /*quiet mode*/ );
817  }
818 
819  return segment;
820 }
#define IS_NEW
New item, just created.
Definition: base_struct.h:114
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:259
bool GetForceHVLines() const
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:143
static DLIST< SCH_LINE > s_wires
int AddItemToSel(const TOOL_EVENT &aEvent)
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
#define IS_MOVED
Item being moved.
Definition: base_struct.h:113

References EE_SELECTION_TOOL::AddItemToSel(), SCH_EDIT_FRAME::GetForceHVLines(), IS_MOVED, IS_NEW, LAYER_BUS, LAYER_NOTES, LAYER_WIRE, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, s_wires, and EDA_ITEM::SetFlags().

Referenced by doDrawSegments(), doUnfoldBus(), StartBus(), StartLine(), and StartWire().

◆ StartWire()

int SCH_WIRE_BUS_TOOL::StartWire ( const TOOL_EVENT aEvent)

Definition at line 305 of file sch_wire_bus_tool.cpp.

306 {
308 
309  Activate();
310 
313  return doDrawSegments( LAYER_WIRE, segment );
314 }
virtual void MoveCursorToCrossHair() override
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
SCH_LINE * startSegments(int aType, const wxPoint &aPos)
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
SCH_DRAW_PANEL * GetCanvas() const override
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:57
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
int doDrawSegments(int aType, SCH_LINE *aSegment)
void Activate()
Function Activate() Runs the tool.
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.

References TOOL_INTERACTIVE::Activate(), EE_ACTIONS::clearSelection, doDrawSegments(), SCH_BASE_FRAME::GetCanvas(), EDA_DRAW_FRAME::GetCrossHairPosition(), LAYER_WIRE, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_BASE::m_toolMgr, SCH_DRAW_PANEL::MoveCursorToCrossHair(), TOOL_MANAGER::RunAction(), and startSegments().

Referenced by DrawWires(), and setTransitions().

◆ UnfoldBus()

int SCH_WIRE_BUS_TOOL::UnfoldBus ( const TOOL_EVENT aEvent)

Definition at line 366 of file sch_wire_bus_tool.cpp.

367 {
368  wxString* netPtr = aEvent.Parameter<wxString*>();
369  wxString net;
370  SCH_LINE* segment = nullptr;
371 
373 
374  Activate();
375 
376  if( netPtr )
377  {
378  net = *netPtr;
379  delete netPtr;
380  }
381  else
382  {
383  BUS_UNFOLD_MENU unfoldMenu;
384  unfoldMenu.SetTool( this );
385  unfoldMenu.SetShowTitle();
386 
387  SetContextMenu( &unfoldMenu, CMENU_NOW );
388 
389  while( OPT_TOOL_EVENT evt = Wait() )
390  {
391  if( evt->Action() == TA_CONTEXT_MENU_CHOICE )
392  {
393  OPT<int> id = evt->GetCommandId();
394 
395  if( id && ( *id > 0 ) )
396  net = *evt->Parameter<wxString*>();
397 
398  break;
399  }
400  }
401  }
402 
403  if( !net.IsEmpty() )
404  {
405  // Break a wire for the given net out of the bus
406  segment = doUnfoldBus( net );
407  }
408 
409  // If we have an unfolded wire to draw, then draw it
410  if( segment )
411  return doDrawSegments( LAYER_WIRE, segment );
412 
413  // If we came from one of our tools then re-enter it in the idle state
414  if( m_frame->GetToolId() == ID_WIRE_TOOL )
415  return doDrawSegments( LAYER_WIRE, nullptr );
416  else if( m_frame->GetToolId() == ID_BUS_TOOL )
417  return doDrawSegments( LAYER_BUS, nullptr );
418 
420  return 0;
421 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
SCH_LINE * doUnfoldBus(const wxString &aNet)
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
void SetContextMenu(ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
Function SetContextMenu()
void SetTool(TOOL_INTERACTIVE *aTool)
Function SetTool() Sets a tool that is the creator of the menu.
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:378
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:57
virtual void SetNoToolSelected()
Select the ID_NO_TOOL_SELECTED id tool (Idle tool)
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
int doDrawSegments(int aType, SCH_LINE *aSegment)
boost::optional< T > OPT
Definition: optional.h:7
void Activate()
Function Activate() Runs the tool.
int GetToolId() const
Definition: draw_frame.h:524
OPT< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:486

References TOOL_INTERACTIVE::Activate(), EE_ACTIONS::clearSelection, CMENU_NOW, doDrawSegments(), doUnfoldBus(), EDA_DRAW_FRAME::GetToolId(), ID_BUS_TOOL, ID_WIRE_TOOL, LAYER_BUS, LAYER_WIRE, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_BASE::m_toolMgr, TOOL_EVENT::Parameter(), TOOL_MANAGER::RunAction(), TOOL_INTERACTIVE::SetContextMenu(), EDA_DRAW_FRAME::SetNoToolSelected(), BUS_UNFOLD_MENU::SetShowTitle(), ACTION_MENU::SetTool(), TA_CONTEXT_MENU_CHOICE, and TOOL_INTERACTIVE::Wait().

Referenced by setTransitions().

◆ updateView()

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

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

Definition at line 107 of file ee_tool_base.h.

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

◆ Wait()

OPT_TOOL_EVENT TOOL_INTERACTIVE::Wait ( const TOOL_EVENT_LIST aEventList = TOOL_EVENTTC_ANYTA_ANY ))
inherited

Function Wait()

Suspends execution of the tool until an event specified in aEventList arrives. No parameters means waiting for any event.

Definition at line 55 of file tool_interactive.cpp.

56 {
57  return m_toolMgr->ScheduleWait( this, aEventList );
58 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
OPT< TOOL_EVENT > ScheduleWait(TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions)
Pauses execution of a given tool until one or more events matching aConditions arrives.

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

Referenced by LIB_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), SCH_DRAWING_TOOLS::doPlaceComponent(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), SCH_DRAWING_TOOLS::doSingleClickPlace(), LIB_DRAWING_TOOLS::doTwoClickPlace(), SCH_DRAWING_TOOLS::doTwoClickPlace(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::drawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), EE_PICKER_TOOL::Main(), PICKER_TOOL::Main(), CVPCB_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), EDIT_TOOL::Main(), SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickCopyReferencePoint(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), GERBVIEW_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), PCB_EDITOR_CONTROL::ShowLocalRatsnest(), and UnfoldBus().

Member Data Documentation

◆ m_busUnfold

BUS_UNFOLDING_T SCH_WIRE_BUS_TOOL::m_busUnfold
private

Data related to bus unfolding tool.

Definition at line 103 of file sch_wire_bus_tool.h.

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

◆ m_frame

SCH_EDIT_FRAME * EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame
protectedinherited

Definition at line 141 of file ee_tool_base.h.

◆ m_isLibEdit

bool EE_TOOL_BASE< SCH_EDIT_FRAME >::m_isLibEdit
protectedinherited

Definition at line 144 of file ee_tool_base.h.

◆ m_menu

TOOL_MENU EE_TOOL_BASE< SCH_EDIT_FRAME >::m_menu
protectedinherited

Menu model displayed by the tool.

Definition at line 147 of file ee_tool_base.h.

◆ m_selectionTool

EE_SELECTION_TOOL* EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool
protectedinherited

Definition at line 143 of file ee_tool_base.h.

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

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

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

Referenced by TOOL_INTERACTIVE::Activate(), EE_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemToSel(), SCH_DRAWING_TOOLS::AddJunction(), SCH_DRAWING_TOOLS::AddLabel(), TOOL_BASE::attachManager(), PCB_EDITOR_CONTROL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDITOR_CONTROL::ClearHighlight(), PCB_EDITOR_CONTROL::ClearHighlight(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::clearSelection(), SELECTION_TOOL::clearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), LIB_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), PCB_EDITOR_CONTROL::CrossProbePcbToSch(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), COMMON_TOOLS::CursorControl(), ROUTER_TOOL::CustomTrackWidthDialog(), SCH_EDITOR_CONTROL::Cut(), LIB_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), LIB_EDIT_TOOL::DoDelete(), SCH_EDIT_TOOL::DoDelete(), doDrawSegments(), SCH_DRAWING_TOOLS::doPlaceComponent(), SCH_DRAWING_TOOLS::doSingleClickPlace(), LIB_DRAWING_TOOLS::doTwoClickPlace(), SCH_DRAWING_TOOLS::doTwoClickPlace(), DRAWING_TOOL::drawArc(), DrawBusses(), DRAWING_TOOL::DrawDimension(), DrawLines(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DrawWires(), DRAWING_TOOL::drawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), EDIT_TOOL::editFootprintInFpEditor(), LIB_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), SCH_EDITOR_CONTROL::EnterSheet(), MODULE_EDITOR_TOOLS::EnumeratePads(), EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandConnection(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::findCallback(), SELECTION_TOOL::findMove(), finishSegments(), EDIT_TOOL::Flip(), TOOL_BASE::getEditFrameInt(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), PCBNEW_CONTROL::GridSetOrigin(), GERBVIEW_CONTROL::HighlightControl(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_EDITOR_CONTROL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_EDITOR_CONTROL::HighlightNetCursor(), LIB_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PAD_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), PCB_EDITOR_CONTROL::Init(), POINT_EDITOR::Init(), POSITION_RELATIVE_TOOL::Init(), EDIT_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), TOOL_BASE::IsToolActive(), ZOOM_TOOL::Main(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), EE_PICKER_TOOL::Main(), PICKER_TOOL::Main(), EDIT_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), LIB_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), EDIT_TOOL::pickCopyReferencePoint(), LIB_EDIT_TOOL::PinTable(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), SCH_EDITOR_CONTROL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), EE_SELECTION_TOOL::RemoveItemFromSel(), EE_SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_DRAWING_TOOLS::RepeatDrawItem(), SELECTION_TOOL::RequestSelection(), CVPCB_CONTROL::ResetCoords(), PCBNEW_CONTROL::ResetCoords(), TOOL_INTERACTIVE::resetTransitions(), LIB_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), EE_SELECTION_TOOL::SelectConnection(), SELECTION_TOOL::selectCopper(), PCB_TOOL_BASE::selection(), GERBVIEW_SELECTION_TOOL::SelectItem(), SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), SELECTION_TOOL::SelectItems(), GERBVIEW_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectNet(), EE_SELECTION_TOOL::SelectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), SELECTION_TOOL::selectSameSheet(), SELECTION_TOOL::selectSheetContents(), TOOL_INTERACTIVE::SetContextMenu(), PCB_EDITOR_CONTROL::ShowLocalRatsnest(), StartBus(), StartLine(), StartWire(), GERBVIEW_SELECTION_TOOL::toggleSelection(), EE_SELECTION_TOOL::toggleSelection(), SELECTION_TOOL::toggleSelection(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), SCH_EDITOR_CONTROL::Undo(), UnfoldBus(), GERBVIEW_SELECTION_TOOL::UnselectItem(), SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), SELECTION_TOOL::UnselectItems(), EE_INSPECTION_TOOL::UpdateMessagePanel(), PCB_EDITOR_CONTROL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), PCB_EDITOR_CONTROL::ZoneDuplicate(), and PCB_EDITOR_CONTROL::ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Name of the tool.

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

Definition at line 215 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_toolSettings

TOOL_SETTINGS TOOL_BASE::m_toolSettings
protectedinherited

Definition at line 217 of file tool_base.h.

Referenced by TOOL_BASE::attachManager(), and TOOL_BASE::GetSettings().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

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


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