KiCad PCB EDA Suite
SCH_DRAWING_TOOLS Class Reference

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

#include <sch_drawing_tools.h>

Inheritance diagram for SCH_DRAWING_TOOLS:
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_DRAWING_TOOLS ()
 
 ~SCH_DRAWING_TOOLS () override
 
bool Init () override
 Init() is called once upon a registration of the tool. More...
 
int PlaceSymbol (const TOOL_EVENT &aEvent)
 
int SingleClickPlace (const TOOL_EVENT &aEvent)
 
int TwoClickPlace (const TOOL_EVENT &aEvent)
 
int DrawShape (const TOOL_EVENT &aEvent)
 
int DrawSheet (const TOOL_EVENT &aEvent)
 
int PlaceImage (const TOOL_EVENT &aEvent)
 
void Reset (RESET_REASON aReason) override
 Bring the tool to a known, initial state. More...
 
void Activate ()
 Run the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Assign a context menu and tells when it should be activated. More...
 
void RunMainStack (std::function< void()> aFunc)
 Call a function using the main stack. More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Define which state (aStateFunc) to go when a certain event arrives (aConditions). More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Suspend execution of the tool until an event specified in aEventList arrives. More...
 
TOOL_TYPE GetType () const
 Return the type of the tool. More...
 
TOOL_ID GetId () const
 Return the unique identifier of the tool. More...
 
const std::string & GetName () const
 Return the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Return the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

Protected Member Functions

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

Protected Attributes

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

Private Member Functions

SCH_TEXTcreateNewText (const VECTOR2I &aPosition, int aType)
 Get the next queued text item. More...
 
SCH_HIERLABELimportHierLabel (SCH_SHEET *aSheet)
 
SCH_SHEET_PINcreateSheetPin (SCH_SHEET *aSheet, SCH_HIERLABEL *aLabel, const VECTOR2I &aPosition)
 
void sizeSheet (SCH_SHEET *aSheet, const VECTOR2I &aPos)
 Set up handlers for various events. More...
 
void setTransitions () override
 This method is meant to be overridden in order to specify handlers for events. More...
 
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

std::vector< PICKED_SYMBOLm_symbolHistoryList
 
std::vector< PICKED_SYMBOLm_powerHistoryList
 
LABEL_FLAG_SHAPE m_lastSheetPinType
 
LABEL_FLAG_SHAPE m_lastGlobalLabelShape
 
LABEL_FLAG_SHAPE m_lastNetClassFlagShape
 
TEXT_SPIN_STYLE m_lastTextOrientation
 
bool m_lastTextBold
 
bool m_lastTextItalic
 
EDA_ANGLE m_lastTextAngle
 
GR_TEXT_H_ALIGN_T m_lastTextJust
 
FILL_T m_lastFillStyle
 
FILL_T m_lastTextboxFillStyle
 
COLOR4D m_lastFillColor
 
COLOR4D m_lastTextboxFillColor
 
STROKE_PARAMS m_lastStroke
 
STROKE_PARAMS m_lastTextboxStroke
 
wxString m_mruPath
 
bool m_lastAutoLabelRotateOnPlacement
 Re-entrancy guards. More...
 
bool m_inPlaceSymbol
 
bool m_inDrawShape
 
bool m_inPlaceImage
 
bool m_inSingleClickPlace
 
bool m_inTwoClickPlace
 
bool m_inDrawSheet
 
std::unique_ptr< STATUS_TEXT_POPUPm_statusPopup
 

Detailed Description

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

Definition at line 43 of file sch_drawing_tools.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_DRAWING_TOOLS()

SCH_DRAWING_TOOLS::SCH_DRAWING_TOOLS ( )

Definition at line 61 of file sch_drawing_tools.cpp.

61 :
62 EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.InteractiveDrawing" ),
67 m_lastTextBold( false ),
68 m_lastTextItalic( false ),
73 m_lastFillColor( COLOR4D::UNSPECIFIED ),
74 m_lastTextboxFillColor( COLOR4D::UNSPECIFIED ),
75 m_lastStroke( 0, PLOT_DASH_TYPE::DEFAULT, COLOR4D::UNSPECIFIED ),
76 m_lastTextboxStroke( 0, PLOT_DASH_TYPE::DEFAULT, COLOR4D::UNSPECIFIED ),
77 m_mruPath( wxEmptyString ),
79 m_inPlaceSymbol( false ),
80 m_inDrawShape( false ),
81 m_inPlaceImage( false ),
82 m_inSingleClickPlace( false ),
83 m_inTwoClickPlace( false ),
84 m_inDrawSheet( false )
85{
86}
STROKE_PARAMS m_lastTextboxStroke
STROKE_PARAMS m_lastStroke
GR_TEXT_H_ALIGN_T m_lastTextJust
bool m_lastAutoLabelRotateOnPlacement
Re-entrancy guards.
LABEL_FLAG_SHAPE m_lastGlobalLabelShape
LABEL_FLAG_SHAPE m_lastNetClassFlagShape
COLOR4D m_lastTextboxFillColor
LABEL_FLAG_SHAPE m_lastSheetPinType
TEXT_SPIN_STYLE m_lastTextOrientation
static constexpr EDA_ANGLE & ANGLE_0
Definition: eda_angle.h:429
@ F_ROUND
Definition: sch_text.h:105
@ L_INPUT
Definition: sch_text.h:97
@ GR_TEXT_H_ALIGN_LEFT

References DEFAULT, NO_FILL, RIGHT, and UNSPECIFIED.

◆ ~SCH_DRAWING_TOOLS()

SCH_DRAWING_TOOLS::~SCH_DRAWING_TOOLS ( )
inlineoverride

Definition at line 47 of file sch_drawing_tools.h.

47{ }

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Run the tool.

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

Definition at line 51 of file tool_interactive.cpp.

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

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

Referenced by AUTOPLACE_TOOL::autoplace(), EDIT_TOOL::copyToClipboard(), SCH_EDIT_TOOL::DeleteItemCursor(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), 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(), PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PlaceSymbol(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), ROUTER_TOOL::RouteSelected(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC_TOOL::ShowDRCDialog(), SingleClickPlace(), TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ 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().

◆ createNewText()

SCH_TEXT * SCH_DRAWING_TOOLS::createNewText ( const VECTOR2I aPosition,
int  aType 
)
private

Get the next queued text item.

Returns
next SCH_TEXT* or nullptr if empty

Definition at line 944 of file sch_drawing_tools.cpp.

945{
946 SCHEMATIC* schematic = getModel<SCHEMATIC>();
947 SCHEMATIC_SETTINGS& settings = schematic->Settings();
948 SCH_TEXT* textItem = nullptr;
949 SCH_LABEL_BASE* labelItem = nullptr;
950
951 switch( aType )
952 {
953 case LAYER_NOTES:
954 textItem = new SCH_TEXT( aPosition );
955 break;
956
957 case LAYER_LOCLABEL:
958 labelItem = new SCH_LABEL( aPosition );
959 textItem = labelItem;
960 break;
961
963 labelItem = new SCH_DIRECTIVE_LABEL( aPosition );
964 labelItem->SetShape( m_lastNetClassFlagShape );
965 labelItem->GetFields().emplace_back( SCH_FIELD( {0,0}, 0, labelItem, wxT( "Netclass" ) ) );
966 labelItem->GetFields().back().SetItalic( true );
967 labelItem->GetFields().back().SetVisible( true );
968 textItem = labelItem;
969 break;
970
971 case LAYER_HIERLABEL:
972 labelItem = new SCH_HIERLABEL( aPosition );
973 labelItem->SetShape( m_lastGlobalLabelShape );
975 textItem = labelItem;
976 break;
977
978 case LAYER_GLOBLABEL:
979 labelItem = new SCH_GLOBALLABEL( aPosition );
980 labelItem->SetShape( m_lastGlobalLabelShape );
981 labelItem->GetFields()[0].SetVisible( settings.m_IntersheetRefsShow );
983 textItem = labelItem;
984 break;
985
986 default:
987 wxFAIL_MSG( "SCH_EDIT_FRAME::CreateNewText() unknown layer type" );
988 return nullptr;
989 }
990
991 textItem->SetParent( schematic );
992
993 if( aType != LAYER_NETCLASS_REFS )
994 {
995 textItem->SetBold( m_lastTextBold );
996 textItem->SetItalic( m_lastTextItalic );
997 }
998
1000 textItem->SetTextSize( VECTOR2I( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) );
1001 textItem->SetFlags( IS_NEW | IS_MOVING );
1002
1003 if( !labelItem )
1004 {
1005 DIALOG_TEXT_PROPERTIES dlg( m_frame, textItem );
1006
1007 // Must be quasi modal for syntax help
1008 if( dlg.ShowQuasiModal() != wxID_OK )
1009 {
1010 delete textItem;
1011 return nullptr;
1012 }
1013 }
1014 else
1015 {
1016 DIALOG_LABEL_PROPERTIES dlg( m_frame, static_cast<SCH_LABEL_BASE*>( textItem ) );
1017
1018 // Must be quasi modal for syntax help
1019 if( dlg.ShowQuasiModal() != wxID_OK )
1020 {
1021 delete labelItem;
1022 return nullptr;
1023 }
1024 }
1025
1026 wxString text = textItem->GetText();
1027
1028 if( textItem->Type() != SCH_DIRECTIVE_LABEL_T && NoPrintableChars( text ) )
1029 {
1030 delete textItem;
1031 return nullptr;
1032 }
1033
1034 if( aType != LAYER_NETCLASS_REFS )
1035 {
1036 m_lastTextBold = textItem->IsBold();
1037 m_lastTextItalic = textItem->IsItalic();
1038 }
1039
1041
1042 if( aType == LAYER_GLOBLABEL || aType == LAYER_HIERLABEL )
1043 {
1044 m_lastGlobalLabelShape = labelItem->GetShape();
1046 }
1047 else if( aType == LAYER_NETCLASS_REFS )
1048 {
1049 m_lastNetClassFlagShape = labelItem->GetShape();
1050 }
1051
1052 return textItem;
1053}
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:139
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:100
bool IsItalic() const
Definition: eda_text.h:130
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:87
void SetBold(bool aBold)
Definition: eda_text.cpp:211
bool IsBold() const
Definition: eda_text.h:133
void SetTextSize(const VECTOR2I &aNewSize)
Definition: eda_text.cpp:349
void SetItalic(bool aItalic)
Definition: eda_text.cpp:203
These settings were stored in SCH_BASE_FRAME previously.
Holds all the data relating to one schematic.
Definition: schematic.h:61
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:205
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:51
bool AutoRotateOnPlacement() const
autoRotateOnPlacement
Definition: sch_label.cpp:1043
void SetAutoRotateOnPlacement(bool autoRotate=true)
setAutoRotateOnPlacement
Definition: sch_label.cpp:1048
void SetShape(LABEL_FLAG_SHAPE aShape) override
Definition: sch_label.h:74
LABEL_FLAG_SHAPE GetShape() const override
Definition: sch_label.h:73
std::vector< SCH_FIELD > & GetFields()
Definition: sch_label.h:90
TEXT_SPIN_STYLE GetTextSpinStyle() const
Definition: sch_text.h:148
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
#define IS_NEW
New item, just created.
#define IS_MOVING
Item being moved.
@ LAYER_HIERLABEL
Definition: layer_ids.h:349
@ LAYER_GLOBLABEL
Definition: layer_ids.h:348
@ LAYER_NOTES
Definition: layer_ids.h:358
@ LAYER_LOCLABEL
Definition: layer_ids.h:347
@ LAYER_NETCLASS_REFS
Definition: layer_ids.h:356
bool NoPrintableChars(const wxString &aString)
Return true if the string is empty or contains only whitespace.
@ SCH_DIRECTIVE_LABEL_T
Definition: typeinfo.h:154
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590

References SCH_LABEL_BASE::AutoRotateOnPlacement(), SCH_LABEL_BASE::GetFields(), SCH_LABEL_BASE::GetShape(), EDA_TEXT::GetText(), SCH_TEXT::GetTextSpinStyle(), IS_MOVING, IS_NEW, EDA_TEXT::IsBold(), EDA_TEXT::IsItalic(), LAYER_GLOBLABEL, LAYER_HIERLABEL, LAYER_LOCLABEL, LAYER_NETCLASS_REFS, LAYER_NOTES, SCHEMATIC_SETTINGS::m_DefaultTextSize, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, SCHEMATIC_SETTINGS::m_IntersheetRefsShow, m_lastAutoLabelRotateOnPlacement, m_lastGlobalLabelShape, m_lastNetClassFlagShape, m_lastTextBold, m_lastTextItalic, m_lastTextOrientation, NoPrintableChars(), SCH_DIRECTIVE_LABEL_T, SCH_LABEL_BASE::SetAutoRotateOnPlacement(), EDA_TEXT::SetBold(), EDA_ITEM::SetFlags(), EDA_TEXT::SetItalic(), EDA_ITEM::SetParent(), SCH_LABEL_BASE::SetShape(), EDA_TEXT::SetTextSize(), SCH_TEXT::SetTextSpinStyle(), SCHEMATIC::Settings(), DIALOG_SHIM::ShowQuasiModal(), text, and EDA_ITEM::Type().

Referenced by TwoClickPlace().

◆ createSheetPin()

SCH_SHEET_PIN * SCH_DRAWING_TOOLS::createSheetPin ( SCH_SHEET aSheet,
SCH_HIERLABEL aLabel,
const VECTOR2I aPosition 
)
private

Definition at line 1074 of file sch_drawing_tools.cpp.

1076{
1077 SCHEMATIC_SETTINGS& settings = aSheet->Schematic()->Settings();
1078 wxString text;
1079 SCH_SHEET_PIN* sheetPin;
1080
1081 if( aLabel )
1082 {
1083 text = aLabel->GetText();
1084 m_lastSheetPinType = aLabel->GetShape();
1085 }
1086
1087 sheetPin = new SCH_SHEET_PIN( aSheet, VECTOR2I( 0, 0 ), text );
1088 sheetPin->SetFlags( IS_NEW );
1089 sheetPin->SetTextSize( VECTOR2I( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) );
1090 sheetPin->SetShape( m_lastSheetPinType );
1091
1092 if( !aLabel )
1093 {
1094 DIALOG_SHEET_PIN_PROPERTIES dlg( m_frame, sheetPin );
1095
1096 if( dlg.ShowModal() != wxID_OK || NoPrintableChars( sheetPin->GetText() ) )
1097 {
1098 delete sheetPin;
1099 return nullptr;
1100 }
1101 }
1102
1103 m_lastSheetPinType = sheetPin->GetShape();
1104
1105 sheetPin->SetPosition( aPosition );
1106
1107 return sheetPin;
1108}
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:112
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet_pin.h:66
void SetPosition(const VECTOR2I &aPosition) override

References SCH_LABEL_BASE::GetShape(), EDA_TEXT::GetText(), IS_NEW, SCHEMATIC_SETTINGS::m_DefaultTextSize, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_lastSheetPinType, NoPrintableChars(), SCH_ITEM::Schematic(), EDA_ITEM::SetFlags(), SCH_SHEET_PIN::SetPosition(), SCH_LABEL_BASE::SetShape(), EDA_TEXT::SetTextSize(), SCHEMATIC::Settings(), and text.

Referenced by TwoClickPlace().

◆ DrawShape()

int SCH_DRAWING_TOOLS::DrawShape ( const TOOL_EVENT aEvent)

Definition at line 1498 of file sch_drawing_tools.cpp.

1499{
1500 SCHEMATIC* schematic = getModel<SCHEMATIC>();
1501 SCHEMATIC_SETTINGS& sch_settings = schematic->Settings();
1502 SCH_SHAPE* item = nullptr;
1503 bool isTextBox = aEvent.IsAction( &EE_ACTIONS::drawTextBox );
1504 SHAPE_T type = aEvent.Parameter<SHAPE_T>();
1505
1506 if( m_inDrawShape )
1507 return 0;
1508
1510
1511 // We might be running as the same shape in another co-routine. Make sure that one
1512 // gets whacked.
1514
1516
1517 m_frame->PushTool( aEvent );
1518
1519 auto setCursor =
1520 [&]()
1521 {
1523 };
1524
1525 auto cleanup =
1526 [&] ()
1527 {
1530 delete item;
1531 item = nullptr;
1532 };
1533
1534 Activate();
1535
1536 // Must be done after Activate() so that it gets set into the correct context
1537 getViewControls()->ShowCursor( true );
1538
1539 // Set initial cursor
1540 setCursor();
1541
1542 if( aEvent.HasPosition() )
1543 m_toolMgr->PrimeTool( aEvent.Position() );
1544
1545 // Main loop: keep receiving events
1546 while( TOOL_EVENT* evt = Wait() )
1547 {
1548 setCursor();
1549
1550 VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->DisableGridSnapping() );
1551
1552 // The tool hotkey is interpreted as a click when drawing
1553 bool isSyntheticClick = item && evt->IsActivate() && evt->HasPosition()
1554 && evt->Matches( aEvent );
1555
1556 if( evt->IsCancelInteractive() )
1557 {
1558 if( item )
1559 {
1560 cleanup();
1561 }
1562 else
1563 {
1564 m_frame->PopTool( aEvent );
1565 break;
1566 }
1567 }
1568 else if( evt->IsActivate() && !isSyntheticClick )
1569 {
1570 if( item && evt->IsMoveTool() )
1571 {
1572 // we're already drawing our own item; ignore the move tool
1573 evt->SetPassEvent( false );
1574 continue;
1575 }
1576
1577 if( item )
1578 cleanup();
1579
1580 if( evt->IsPointEditor() )
1581 {
1582 // don't exit (the point editor runs in the background)
1583 }
1584 else if( evt->IsMoveTool() )
1585 {
1586 // leave ourselves on the stack so we come back after the move
1587 break;
1588 }
1589 else
1590 {
1591 m_frame->PopTool( aEvent );
1592 break;
1593 }
1594 }
1595 else if( evt->IsClick( BUT_LEFT ) && !item )
1596 {
1598
1599 if( isTextBox )
1600 {
1601 SCH_TEXTBOX* textbox = new SCH_TEXTBOX( 0, m_lastTextboxFillStyle );
1602
1603 textbox->SetBold( m_lastTextBold );
1604 textbox->SetItalic( m_lastTextItalic );
1605 textbox->SetTextSize( VECTOR2I( sch_settings.m_DefaultTextSize,
1606 sch_settings.m_DefaultTextSize ) );
1607 textbox->SetTextAngle( m_lastTextAngle );
1608 textbox->SetHorizJustify( m_lastTextJust );
1609 textbox->SetStroke( m_lastTextboxStroke );
1611
1612 item = textbox;
1613 }
1614 else
1615 {
1616 item = new SCH_SHAPE( type, 0, m_lastFillStyle );
1617
1618 item->SetStroke( m_lastStroke );
1620 }
1621
1622 item->SetFlags( IS_NEW );
1623 item->BeginEdit( cursorPos );
1624
1626 m_view->AddToPreview( item->Clone() );
1627 }
1628 else if( item && ( evt->IsClick( BUT_LEFT )
1629 || evt->IsDblClick( BUT_LEFT )
1630 || isSyntheticClick
1631 || evt->IsAction( &EE_ACTIONS::finishDrawing ) ) )
1632 {
1633 if( evt->IsDblClick( BUT_LEFT )
1634 || evt->IsAction( &EE_ACTIONS::finishDrawing )
1635 || !item->ContinueEdit( cursorPos ) )
1636 {
1637 item->EndEdit();
1638 item->ClearEditFlags();
1639 item->SetFlags( IS_NEW );
1640
1641 if( isTextBox )
1642 {
1643 SCH_TEXTBOX* textbox = static_cast<SCH_TEXTBOX*>( item );
1644 DIALOG_TEXT_PROPERTIES dlg( m_frame, textbox );
1645
1646 // This is modal not quasi to protect against place symbol calls starting
1647 // TwoClickPlace wait routines in the middle
1648 if( dlg.ShowModal() != wxID_OK )
1649 {
1650 cleanup();
1651 continue;
1652 }
1653
1654 m_lastTextBold = textbox->IsBold();
1655 m_lastTextItalic = textbox->IsItalic();
1656 m_lastTextAngle = textbox->GetTextAngle();
1657 m_lastTextJust = textbox->GetHorizJustify();
1658 m_lastTextboxStroke = textbox->GetStroke();
1661 }
1662 else
1663 {
1664 m_lastStroke = item->GetStroke();
1665 m_lastFillStyle = item->GetFillMode();
1666 m_lastFillColor = item->GetFillColor();
1667 }
1668
1671 item = nullptr;
1672
1675 }
1676 }
1677 else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
1678 {
1679 item->CalcEdit( cursorPos );
1681 m_view->AddToPreview( item->Clone() );
1682 m_frame->SetMsgPanel( item );
1683 }
1684 else if( evt->IsDblClick( BUT_LEFT ) && !item )
1685 {
1687 }
1688 else if( evt->IsClick( BUT_RIGHT ) )
1689 {
1690 // Warp after context menu only if dragging...
1691 if( !item )
1693
1695 }
1696 else
1697 {
1698 evt->SetPassEvent();
1699 }
1700
1701 // Enable autopanning and cursor capture only when there is a shape being drawn
1702 getViewControls()->SetAutoPan( item != nullptr );
1703 getViewControls()->CaptureCursor( item != nullptr );
1704 }
1705
1706 getViewControls()->SetAutoPan( false );
1707 getViewControls()->CaptureCursor( false );
1709 return 0;
1710}
static TOOL_ACTION activatePointEditor
Definition: actions.h:173
static TOOL_ACTION refreshPreview
Definition: actions.h:110
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
virtual bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
Definition: eda_item.h:382
void ClearEditFlags()
Definition: eda_item.h:158
FILL_T GetFillMode() const
Definition: eda_shape.h:101
void SetFillColor(const COLOR4D &aColor)
Definition: eda_shape.h:106
COLOR4D GetFillColor() const
Definition: eda_shape.h:105
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:120
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:149
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition: eda_text.cpp:195
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
Definition: eda_text.cpp:242
static TOOL_ACTION properties
Definition: ee_actions.h:128
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
static TOOL_ACTION drawTextBox
Definition: ee_actions.h:94
static TOOL_ACTION finishDrawing
Definition: ee_actions.h:114
EE_SELECTION & GetSelection()
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:191
virtual void CaptureCursor(bool aEnabled)
Force the cursor to stay within the drawing panel area.
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
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.
void AddItemToScreenAndUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItem, bool aUndoAppend)
Add an item to the schematic and adds the changes to the undo/redo container.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void CalcEdit(const VECTOR2I &aPosition)
Definition: sch_shape.h:84
bool ContinueEdit(const VECTOR2I &aPosition)
Definition: sch_shape.h:83
void BeginEdit(const VECTOR2I &aStartPoint)
Definition: sch_shape.h:82
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_shape.cpp:46
void SetStroke(const STROKE_PARAMS &aStroke) override
Definition: sch_shape.cpp:61
void EndEdit()
Definition: sch_shape.h:85
STROKE_PARAMS GetStroke() const override
Definition: sch_shape.h:64
int AddItemToSel(const TOOL_EVENT &aEvent)
virtual void PopTool(const TOOL_EVENT &aEvent)
Pops a tool from the stack.
virtual void PushTool(const TOOL_EVENT &aEvent)
NB: the definition of "tool" is different at the user level.
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
Generic, UI-independent tool event.
Definition: tool_event.h:156
bool HasPosition() const
Definition: tool_event.h:243
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
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:81
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 DeactivateTool()
Deactivate the currently active tool.
void PrimeTool(const VECTOR2D &aPosition)
"Prime" a tool by sending a cursor left-click event with the mouse position set to the passed in posi...
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
SHAPE_T
Definition: eda_shape.h:41
@ BUT_LEFT
Definition: tool_event.h:127
@ BUT_RIGHT
Definition: tool_event.h:128

References TOOL_INTERACTIVE::Activate(), ACTIONS::activatePointEditor, SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SELECTION_TOOL::AddItemToSel(), KIGFX::VIEW::AddToPreview(), ARROW, SCH_SHAPE::BeginEdit(), BUT_LEFT, BUT_RIGHT, SCH_SHAPE::CalcEdit(), KIGFX::VIEW_CONTROLS::CaptureCursor(), EDA_ITEM::ClearEditFlags(), KIGFX::VIEW::ClearPreview(), EE_ACTIONS::clearSelection, SCH_SHAPE::Clone(), SCH_SHAPE::ContinueEdit(), TOOL_MANAGER::DeactivateTool(), EE_ACTIONS::drawTextBox, SCH_SHAPE::EndEdit(), EE_ACTIONS::finishDrawing, SCH_BASE_FRAME::GetCanvas(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), EDA_SHAPE::GetFillColor(), EDA_SHAPE::GetFillMode(), EDA_TEXT::GetHorizJustify(), SCH_EDIT_FRAME::GetScreen(), EE_SELECTION_TOOL::GetSelection(), SCH_SHAPE::GetStroke(), EDA_TEXT::GetTextAngle(), TOOL_BASE::getViewControls(), TOOL_EVENT::HasPosition(), IS_NEW, TOOL_EVENT::IsAction(), EDA_TEXT::IsBold(), EDA_TEXT::IsItalic(), SCHEMATIC_SETTINGS::m_DefaultTextSize, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_inDrawShape, m_lastFillColor, m_lastFillStyle, m_lastStroke, m_lastTextAngle, m_lastTextBold, m_lastTextboxFillColor, m_lastTextboxFillStyle, m_lastTextboxStroke, m_lastTextItalic, m_lastTextJust, TOOL_INTERACTIVE::m_menu, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_view, EDA_ITEM::Matches(), TOOL_EVENT::Parameter(), PENCIL, TOOLS_HOLDER::PopTool(), TOOL_EVENT::Position(), TOOL_MANAGER::PrimeTool(), EE_ACTIONS::properties, TOOLS_HOLDER::PushTool(), ACTIONS::refreshPreview, TOOL_MANAGER::RunAction(), KIGFX::VIEW_CONTROLS::SetAutoPan(), EDA_TEXT::SetBold(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), EDA_SHAPE::SetFillColor(), EDA_ITEM::SetFlags(), EDA_TEXT::SetHorizJustify(), EDA_TEXT::SetItalic(), EDA_DRAW_FRAME::SetMsgPanel(), SCH_SHAPE::SetStroke(), EDA_TEXT::SetTextAngle(), EDA_TEXT::SetTextSize(), SCHEMATIC::Settings(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), TOOL_MANAGER::VetoContextMenuMouseWarp(), and TOOL_INTERACTIVE::Wait().

Referenced by setTransitions().

◆ DrawSheet()

int SCH_DRAWING_TOOLS::DrawSheet ( const TOOL_EVENT aEvent)

Definition at line 1713 of file sch_drawing_tools.cpp.

1714{
1715 SCH_SHEET* sheet = nullptr;
1716
1717 if( m_inDrawSheet )
1718 return 0;
1719
1721
1723
1724 m_frame->PushTool( aEvent );
1725
1726 auto setCursor =
1727 [&]()
1728 {
1730 };
1731
1732 auto cleanup =
1733 [&] ()
1734 {
1737 delete sheet;
1738 sheet = nullptr;
1739 };
1740
1741 Activate();
1742
1743 // Must be done after Activate() so that it gets set into the correct context
1744 getViewControls()->ShowCursor( true );
1745
1746 // Set initial cursor
1747 setCursor();
1748
1749 if( aEvent.HasPosition() )
1750 m_toolMgr->PrimeTool( aEvent.Position() );
1751
1752 // Main loop: keep receiving events
1753 while( TOOL_EVENT* evt = Wait() )
1754 {
1755 setCursor();
1756
1757 VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->DisableGridSnapping() );
1758
1759 // The tool hotkey is interpreted as a click when drawing
1760 bool isSyntheticClick = sheet && evt->IsActivate() && evt->HasPosition()
1761 && evt->Matches( aEvent );
1762
1763 if( evt->IsCancelInteractive() )
1764 {
1766
1767 if( sheet )
1768 {
1769 cleanup();
1770 }
1771 else
1772 {
1773 m_frame->PopTool( aEvent );
1774 break;
1775 }
1776 }
1777 else if( evt->IsActivate() && !isSyntheticClick )
1778 {
1779 if( sheet && evt->IsMoveTool() )
1780 {
1781 // we're already drawing our own item; ignore the move tool
1782 evt->SetPassEvent( false );
1783 continue;
1784 }
1785
1786 if( sheet )
1787 {
1788 m_frame->ShowInfoBarMsg( _( "Press <ESC> to cancel sheet creation." ) );
1789 evt->SetPassEvent( false );
1790 continue;
1791 }
1792
1793 if( evt->IsPointEditor() )
1794 {
1795 // don't exit (the point editor runs in the background)
1796 }
1797 else if( evt->IsMoveTool() )
1798 {
1799 // leave ourselves on the stack so we come back after the move
1800 break;
1801 }
1802 else
1803 {
1804 m_frame->PopTool( aEvent );
1805 break;
1806 }
1807 }
1808 else if( !sheet && ( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) ) )
1809 {
1812
1813 if( selection.Size() == 1
1814 && selection.Front()->Type() == SCH_SHEET_T
1815 && selection.Front()->GetBoundingBox().Contains( cursorPos ) )
1816 {
1817 if( evt->IsClick( BUT_LEFT ) )
1818 {
1819 // sheet already selected
1820 continue;
1821 }
1822 else if( evt->IsDblClick( BUT_LEFT ) )
1823 {
1825 break;
1826 }
1827 }
1828
1830
1831 sheet = new SCH_SHEET( m_frame->GetCurrentSheet().Last(), cursorPos );
1832 sheet->SetFlags( IS_NEW | IS_MOVING );
1833 sheet->SetScreen( nullptr );
1837 sheet->GetFields()[ SHEETNAME ].SetText( "Untitled Sheet" );
1838 sheet->GetFields()[ SHEETFILENAME ].SetText( "untitled." + KiCadSchematicFileExtension );
1839 sizeSheet( sheet, cursorPos );
1840
1842 m_view->AddToPreview( sheet->Clone() );
1843 }
1844 else if( sheet && ( evt->IsClick( BUT_LEFT )
1845 || evt->IsDblClick( BUT_LEFT )
1846 || isSyntheticClick
1847 || evt->IsAction( &EE_ACTIONS::finishSheet ) ) )
1848 {
1850 getViewControls()->SetAutoPan( false );
1851 getViewControls()->CaptureCursor( false );
1852
1853 if( m_frame->EditSheetProperties( static_cast<SCH_SHEET*>( sheet ),
1854 &m_frame->GetCurrentSheet(), nullptr ) )
1855 {
1856 sheet->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
1857
1860 m_selectionTool->AddItemToSel( sheet );
1861 }
1862 else
1863 {
1864 delete sheet;
1865 }
1866
1867 sheet = nullptr;
1868 }
1869 else if( sheet && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
1870 {
1871 sizeSheet( sheet, cursorPos );
1873 m_view->AddToPreview( sheet->Clone() );
1874 m_frame->SetMsgPanel( sheet );
1875 }
1876 else if( evt->IsClick( BUT_RIGHT ) )
1877 {
1878 // Warp after context menu only if dragging...
1879 if( !sheet )
1881
1883 }
1884 else
1885 {
1886 evt->SetPassEvent();
1887 }
1888
1889 // Enable autopanning and cursor capture only when there is a sheet to be placed
1890 getViewControls()->SetAutoPan( sheet != nullptr );
1891 getViewControls()->CaptureCursor( sheet != nullptr );
1892 }
1893
1894 getViewControls()->SetAutoPan( false );
1895 getViewControls()->CaptureCursor( false );
1897
1898 return 0;
1899}
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
bool Contains(const Vec &aPoint) const
Definition: box2.h:141
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()
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:74
static TOOL_ACTION enterSheet
Definition: ee_actions.h:199
static TOOL_ACTION finishSheet
Definition: ee_actions.h:106
EESCHEMA_SETTINGS * eeconfig() const
void sizeSheet(SCH_SHEET *aSheet, const VECTOR2I &aPos)
Set up handlers for various events.
SCH_SHEET_PATH & GetCurrentSheet() const
bool EditSheetProperties(SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy, bool *aClearAnnotationNewItems)
Edit an existing sheet or add a new sheet to the schematic.
Definition: sheet.cpp:528
void UpdateHierarchyNavigator()
Update the hierarchy navigation tree and history.
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:57
void SetBorderColor(KIGFX::COLOR4D aColor)
Definition: sch_sheet.h:115
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_sheet.cpp:156
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
Definition: sch_sheet.cpp:932
std::vector< SCH_FIELD > & GetFields()
Definition: sch_sheet.h:93
void SetBackgroundColor(KIGFX::COLOR4D aColor)
Definition: sch_sheet.h:118
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
Definition: sch_sheet.cpp:162
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Definition: sch_sheet.cpp:606
void SetBorderWidth(int aWidth)
Definition: sch_sheet.h:112
EDA_ITEM * Front() const
Definition: selection.h:208
int Size() const
Returns the number of selected parts.
Definition: selection.h:115
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)
const std::string KiCadSchematicFileExtension
@ SHEETNAME
Definition: sch_sheet.h:45
@ SHEETFILENAME
Definition: sch_sheet.h:46
constexpr int MilsToIU(int mils) const
Definition: base_units.h:94
@ SCH_SHEET_T
Definition: typeinfo.h:158

References _, TOOL_INTERACTIVE::Activate(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SELECTION_TOOL::AddItemToSel(), KIGFX::VIEW::AddToPreview(), ARROW, SCH_SHEET::AutoplaceFields(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), KIGFX::VIEW::ClearPreview(), EE_ACTIONS::clearSelection, SCH_SHEET::Clone(), BOX2< Vec >::Contains(), EESCHEMA_SETTINGS::DRAWING::default_line_thickness, EESCHEMA_SETTINGS::DRAWING::default_sheet_background_color, EESCHEMA_SETTINGS::DRAWING::default_sheet_border_color, WX_INFOBAR::Dismiss(), SCH_EDIT_FRAME::EditSheetProperties(), SCH_BASE_FRAME::eeconfig(), EE_ACTIONS::enterSheet, EE_ACTIONS::finishSheet, SELECTION::Front(), EDA_ITEM::GetBoundingBox(), SCH_BASE_FRAME::GetCanvas(), SCH_EDIT_FRAME::GetCurrentSheet(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), SCH_SHEET::GetFields(), EDA_BASE_FRAME::GetInfoBar(), SCH_EDIT_FRAME::GetScreen(), EE_SELECTION_TOOL::GetSelection(), TOOL_BASE::getViewControls(), TOOL_EVENT::HasPosition(), IS_MOVING, IS_NEW, KiCadSchematicFileExtension, SCH_SHEET_PATH::Last(), EESCHEMA_SETTINGS::m_Drawing, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_inDrawSheet, TOOL_INTERACTIVE::m_menu, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_view, SCH_SHEET::Matches(), EDA_IU_SCALE::MilsToIU(), PENCIL, TOOLS_HOLDER::PopTool(), TOOL_EVENT::Position(), TOOL_MANAGER::PrimeTool(), TOOLS_HOLDER::PushTool(), ACTIONS::refreshPreview, TOOL_MANAGER::RunAction(), SCH_SHEET_T, schIUScale, KIGFX::VIEW_CONTROLS::SetAutoPan(), SCH_SHEET::SetBackgroundColor(), SCH_SHEET::SetBorderColor(), SCH_SHEET::SetBorderWidth(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), EDA_ITEM::SetFlags(), EDA_DRAW_FRAME::SetMsgPanel(), SCH_SHEET::SetScreen(), SHEETFILENAME, SHEETNAME, TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), EDA_BASE_FRAME::ShowInfoBarMsg(), SELECTION::Size(), sizeSheet(), EDA_ITEM::Type(), SCH_EDIT_FRAME::UpdateHierarchyNavigator(), TOOL_MANAGER::VetoContextMenuMouseWarp(), and TOOL_INTERACTIVE::Wait().

Referenced by setTransitions().

◆ 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().

◆ 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(), SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint(), COMMON_TOOLS::CursorControl(), SCH_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), EDIT_TOOL::DeleteItems(), PL_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SELECTION_TOOL::doSelectionMenu(), COMMON_TOOLS::doZoomFit(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), PCB_CONTROL::GridResetOrigin(), PCB_CONTROL::GridSetOrigin(), EE_SELECTION_TOOL::GuessSelectionCandidates(), PCB_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(), 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(), 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(), SingleClickPlace(), SCH_EDITOR_CONTROL::ToggleERCErrors(), SCH_EDITOR_CONTROL::ToggleERCExclusions(), SCH_EDITOR_CONTROL::ToggleERCWarnings(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), SCH_EDITOR_CONTROL::ToggleOPCurrents(), SCH_EDITOR_CONTROL::ToggleOPVoltages(), 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(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DrawSheet(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::HighlightNet(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), EE_POINT_EDITOR::Main(), EE_SELECTION_TOOL::Main(), 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(), PlaceImage(), DRAWING_TOOL::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), 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(), SingleClickPlace(), 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(), setTransitions(), SCH_EDIT_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), SCH_FIND_REPLACE_TOOL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), SCH_NAVIGATE_TOOL::setTransitions(), SIMULATOR_CONTROL::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().

◆ importHierLabel()

SCH_HIERLABEL * SCH_DRAWING_TOOLS::importHierLabel ( SCH_SHEET aSheet)
private

Definition at line 1056 of file sch_drawing_tools.cpp.

1057{
1058 if( !aSheet->GetScreen() )
1059 return nullptr;
1060
1061 for( EDA_ITEM* item : aSheet->GetScreen()->Items().OfType( SCH_HIER_LABEL_T ) )
1062 {
1063 SCH_HIERLABEL* label = static_cast<SCH_HIERLABEL*>( item );
1064
1065 /* A global label has been found: check if there a corresponding sheet label. */
1066 if( !aSheet->HasPin( label->GetText() ) )
1067 return label;
1068 }
1069
1070 return nullptr;
1071}
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
EE_TYPE OfType(KICAD_T aType) const
Definition: sch_rtree.h:238
EE_RTREE & Items()
Gets the full RTree, usually for iterating.
Definition: sch_screen.h:109
SCH_SCREEN * GetScreen() const
Definition: sch_sheet.h:106
bool HasPin(const wxString &aName) const
Checks if the sheet already has a sheet pin named aName.
Definition: sch_sheet.cpp:397
@ SCH_HIER_LABEL_T
Definition: typeinfo.h:153

References SCH_SHEET::GetScreen(), EDA_TEXT::GetText(), SCH_SHEET::HasPin(), SCH_SCREEN::Items(), EE_RTREE::OfType(), and SCH_HIER_LABEL_T.

Referenced by TwoClickPlace().

◆ Init()

bool SCH_DRAWING_TOOLS::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 89 of file sch_drawing_tools.cpp.

90{
92
93 auto belowRootSheetCondition =
94 [&]( const SELECTION& aSel )
95 {
96 return m_frame->GetCurrentSheet().Last() != &m_frame->Schematic().Root();
97 };
98
99 CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
100 ctxMenu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 2 );
101
102 return true;
103}
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Add a menu entry to run a TOOL_ACTION on selected items.
static TOOL_ACTION leaveSheet
Definition: ee_actions.h:200
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 & Schematic() const
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:44

References CONDITIONAL_MENU::AddItem(), SCH_EDIT_FRAME::GetCurrentSheet(), TOOL_MENU::GetMenu(), EE_TOOL_BASE< T >::Init(), SCH_SHEET_PATH::Last(), EE_ACTIONS::leaveSheet, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_INTERACTIVE::m_menu, SCHEMATIC::Root(), and SCH_EDIT_FRAME::Schematic().

◆ 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().

◆ PlaceImage()

int SCH_DRAWING_TOOLS::PlaceImage ( const TOOL_EVENT aEvent)

Definition at line 465 of file sch_drawing_tools.cpp.

466{
467 SCH_BITMAP* image = aEvent.Parameter<SCH_BITMAP*>();
468 bool immediateMode = image != nullptr;
470 bool ignorePrimePosition = false;
471 COMMON_SETTINGS* common_settings = Pgm().GetCommonSettings();
472
473 if( m_inPlaceImage )
474 return 0;
475
477
479
480 // Add all the drawable symbols to preview
481 if( image )
482 {
483 image->SetPosition( getViewControls()->GetCursorPosition() );
485 m_view->AddToPreview( image, false ); // Add, but not give ownership
486 }
487
488 m_frame->PushTool( aEvent );
489
490 auto setCursor =
491 [&]()
492 {
493 if( image )
495 else
497 };
498
499 auto cleanup =
500 [&] ()
501 {
505 delete image;
506 image = nullptr;
507 };
508
509 Activate();
510
511 // Must be done after Activate() so that it gets set into the correct context
512 getViewControls()->ShowCursor( true );
513
514 // Set initial cursor
515 setCursor();
516
517 // Prime the pump
518 if( image )
519 {
521 }
522 else if( aEvent.HasPosition() )
523 {
524 m_toolMgr->PrimeTool( aEvent.Position() );
525 }
526 else if( common_settings->m_Input.immediate_actions && !aEvent.IsReactivate() )
527 {
528 m_toolMgr->PrimeTool( { 0, 0 } );
529 ignorePrimePosition = true;
530 }
531
532 // Main loop: keep receiving events
533 while( TOOL_EVENT* evt = Wait() )
534 {
535 setCursor();
536 VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->DisableGridSnapping() );
537
538 // The tool hotkey is interpreted as a click when drawing
539 bool isSyntheticClick = image && evt->IsActivate() && evt->HasPosition()
540 && evt->Matches( aEvent );
541
542 if( evt->IsCancelInteractive() )
543 {
545
546 if( image )
547 {
548 cleanup();
549 }
550 else
551 {
552 m_frame->PopTool( aEvent );
553 break;
554 }
555
556 if( immediateMode )
557 {
558 m_frame->PopTool( aEvent );
559 break;
560 }
561 }
562 else if( evt->IsActivate() && !isSyntheticClick )
563 {
564 if( image && evt->IsMoveTool() )
565 {
566 // we're already moving our own item; ignore the move tool
567 evt->SetPassEvent( false );
568 continue;
569 }
570
571 if( image )
572 {
573 m_frame->ShowInfoBarMsg( _( "Press <ESC> to cancel image creation." ) );
574 evt->SetPassEvent( false );
575 continue;
576 }
577
578 if( evt->IsMoveTool() )
579 {
580 // leave ourselves on the stack so we come back after the move
581 break;
582 }
583 else
584 {
585 m_frame->PopTool( aEvent );
586 break;
587 }
588 }
589 else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) || isSyntheticClick )
590 {
591 if( !image )
592 {
594
595 wxFileDialog dlg( m_frame, _( "Choose Image" ), m_mruPath, wxEmptyString,
596 _( "Image Files" ) + wxS( " " ) + wxImage::GetImageExtWildcard(),
597 wxFD_OPEN );
598
599 if( dlg.ShowModal() != wxID_OK )
600 continue;
601
602 // If we started with a hotkey which has a position then warp back to that.
603 // Otherwise update to the current mouse position pinned inside the autoscroll
604 // boundaries.
605 if( evt->IsPrime() && !ignorePrimePosition )
606 {
607 cursorPos = grid.Align( evt->Position() );
608 getViewControls()->WarpMouseCursor( cursorPos, true );
609 }
610 else
611 {
613 cursorPos = getViewControls()->GetMousePosition();
614 }
615
616 wxString fullFilename = dlg.GetPath();
617 m_mruPath = wxPathOnly( fullFilename );
618
619 if( wxFileExists( fullFilename ) )
620 image = new SCH_BITMAP( cursorPos );
621
622 if( !image || !image->ReadImageFile( fullFilename ) )
623 {
624 wxMessageBox( _( "Could not load image from '%s'." ), fullFilename );
625 delete image;
626 image = nullptr;
627 continue;
628 }
629
630 image->SetFlags( IS_NEW | IS_MOVING );
631
633
635 m_view->AddToPreview( image, false ); // Add, but not give ownership
636 m_view->RecacheAllItems(); // Bitmaps are cached in Opengl
637
639
640 getViewControls()->SetCursorPosition( cursorPos, false );
641 setCursor();
642 }
643 else
644 {
646 image = nullptr;
648
650
651 if( immediateMode )
652 {
653 m_frame->PopTool( aEvent );
654 break;
655 }
656 }
657 }
658 else if( evt->IsClick( BUT_RIGHT ) )
659 {
660 // Warp after context menu only if dragging...
661 if( !image )
663
665 }
666 else if( image && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
667 {
668 image->SetPosition( cursorPos );
670 m_view->AddToPreview( image, false ); // Add, but not give ownership
671 m_view->RecacheAllItems(); // Bitmaps are cached in Opengl
673 }
674 else if( image && evt->IsAction( &ACTIONS::doDelete ) )
675 {
676 cleanup();
677 }
678 else
679 {
680 evt->SetPassEvent();
681 }
682
683 // Enable autopanning and cursor capture only when there is an image to be placed
684 getViewControls()->SetAutoPan( image != nullptr );
685 getViewControls()->CaptureCursor( image != nullptr );
686 }
687
688 getViewControls()->SetAutoPan( false );
689 getViewControls()->CaptureCursor( false );
691
692 return 0;
693}
static TOOL_ACTION doDelete
Definition: actions.h:73
virtual void WarpMouseCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
If enabled (.
virtual VECTOR2D GetMousePosition(bool aWorldCoordinates=true) const =0
Return the current mouse pointer position.
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false, long aArrowCommand=0)=0
Move cursor to the requested position expressed in world coordinates.
virtual void PinCursorInsideNonAutoscrollArea(bool aWarpMouseCursor)=0
void RecacheAllItems()
Rebuild GAL display lists.
Definition: view.cpp:1384
Object to handle a bitmap image that can be inserted in a schematic.
Definition: sch_bitmap.h:41
void SaveCopyForRepeatItem(const SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
bool IsReactivate() const
Definition: tool_event.h:255
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111

References _, TOOL_INTERACTIVE::Activate(), ACTIONS::activatePointEditor, SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SELECTION_TOOL::AddItemToSel(), KIGFX::VIEW::AddToPreview(), ARROW, BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), KIGFX::VIEW::ClearPreview(), EE_ACTIONS::clearSelection, WX_INFOBAR::Dismiss(), ACTIONS::doDelete, SCH_BASE_FRAME::GetCanvas(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), EDA_BASE_FRAME::GetInfoBar(), KIGFX::VIEW_CONTROLS::GetMousePosition(), SCH_EDIT_FRAME::GetScreen(), EE_SELECTION_TOOL::GetSelection(), TOOL_BASE::getViewControls(), grid, TOOL_EVENT::HasPosition(), image, COMMON_SETTINGS::INPUT::immediate_actions, IS_MOVING, IS_NEW, TOOL_EVENT::IsReactivate(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_inPlaceImage, COMMON_SETTINGS::m_Input, TOOL_INTERACTIVE::m_menu, m_mruPath, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_view, MOVING, TOOL_EVENT::Parameter(), PENCIL, Pgm(), KIGFX::VIEW_CONTROLS::PinCursorInsideNonAutoscrollArea(), TOOLS_HOLDER::PopTool(), TOOL_EVENT::Position(), TOOL_MANAGER::PrimeTool(), TOOLS_HOLDER::PushTool(), KIGFX::VIEW::RecacheAllItems(), ACTIONS::refreshPreview, TOOL_MANAGER::RunAction(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), KIGFX::VIEW_CONTROLS::SetAutoPan(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), KIGFX::VIEW_CONTROLS::SetCursorPosition(), EDA_DRAW_FRAME::SetMsgPanel(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), EDA_BASE_FRAME::ShowInfoBarMsg(), TOOL_MANAGER::VetoContextMenuMouseWarp(), TOOL_INTERACTIVE::Wait(), and KIGFX::VIEW_CONTROLS::WarpMouseCursor().

Referenced by setTransitions().

◆ PlaceSymbol()

int SCH_DRAWING_TOOLS::PlaceSymbol ( const TOOL_EVENT aEvent)

Definition at line 106 of file sch_drawing_tools.cpp.

107{
108 SCH_SYMBOL* symbol = aEvent.Parameter<SCH_SYMBOL*>();
110 std::vector<PICKED_SYMBOL>* historyList = nullptr;
111 bool ignorePrimePosition = false;
112 COMMON_SETTINGS* common_settings = Pgm().GetCommonSettings();
114
115 if( m_inPlaceSymbol )
116 return 0;
117
119
120 // First we need to get all instances of this sheet so we can annotate
121 // whatever symbols we place on all copies
122 SCH_SHEET_LIST hierarchy = m_frame->Schematic().GetSheets();
123 SCH_SHEET_LIST newInstances =
125 newInstances.SortByPageNumbers();
126
127 // Get a list of all references in the schematic to avoid duplicates wherever
128 // they're placed
129 SCH_REFERENCE_LIST existingRefs;
130 hierarchy.GetSymbols( existingRefs );
131 existingRefs.SortByReferenceOnly();
132
133 if( aEvent.IsAction( &EE_ACTIONS::placeSymbol ) )
134 {
135 historyList = &m_symbolHistoryList;
136 }
137 else if (aEvent.IsAction( &EE_ACTIONS::placePower ) )
138 {
139 historyList = &m_powerHistoryList;
140 filter.FilterPowerSymbols( true );
141 }
142 else
143 {
144 wxFAIL_MSG( "PlaceSymbol(): unexpected request" );
145 }
146
147 m_frame->PushTool( aEvent );
148
149 auto addSymbol =
150 [&]( SCH_SYMBOL* aSymbol )
151 {
152 m_frame->SaveCopyForRepeatItem( aSymbol );
153
155 m_selectionTool->AddItemToSel( aSymbol );
156
157 aSymbol->SetParent( m_frame->GetScreen() );
158 aSymbol->SetFlags( IS_NEW | IS_MOVING );
160
161 // Set IS_MOVING again, as AddItemToScreenAndUndoList() will have cleared it.
162 aSymbol->SetFlags( IS_MOVING );
164 };
165
166 auto setCursor =
167 [&]()
168 {
171 };
172
173 auto cleanup =
174 [&]()
175 {
178 existingRefs.Clear();
179 hierarchy.GetSymbols( existingRefs );
180 existingRefs.SortByReferenceOnly();
181 symbol = nullptr;
182 };
183
184 auto annotate =
185 [&]()
186 {
188
189 // Then we need to annotate all instances by sheet
190 for( SCH_SHEET_PATH& instance : newInstances )
191 {
192 SCH_REFERENCE newReference( symbol, symbol->GetLibSymbolRef().get(), instance );
194 refs.AddItem( newReference );
195
196 if( cfg->m_AnnotatePanel.automatic || newReference.AlwaysAnnotate() )
197 {
201 m_frame->Schematic().Settings().m_AnnotateStartNum, existingRefs,
202 false, &hierarchy );
203
204 refs.UpdateAnnotation();
205
206 // Update existing refs for next iteration
207 for( size_t i = 0; i < refs.GetCount(); i++ )
208 existingRefs.AddItem( refs[i] );
209 }
210 }
211
213 };
214
215 Activate();
216
217 // Must be done after Activate() so that it gets set into the correct context
218 getViewControls()->ShowCursor( true );
219
220 // Set initial cursor
221 setCursor();
222
223 // Prime the pump
224 if( symbol )
225 {
226 addSymbol( symbol );
227 annotate();
228 getViewControls()->WarpMouseCursor( getViewControls()->GetMousePosition( false ) );
229 }
230 else if( aEvent.HasPosition() )
231 {
232 m_toolMgr->PrimeTool( aEvent.Position() );
233 }
234 else if( common_settings->m_Input.immediate_actions && !aEvent.IsReactivate() )
235 {
236 m_toolMgr->PrimeTool( { 0, 0 } );
237 ignorePrimePosition = true;
238 }
239
240 // Main loop: keep receiving events
241 while( TOOL_EVENT* evt = Wait() )
242 {
243 setCursor();
244 grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
245 grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
246
247 VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->DisableGridSnapping() );
248
249 // The tool hotkey is interpreted as a click when drawing
250 bool isSyntheticClick = symbol && evt->IsActivate() && evt->HasPosition()
251 && evt->Matches( aEvent );
252
253 if( evt->IsCancelInteractive() )
254 {
256
257 if( symbol )
258 {
259 cleanup();
260 }
261 else
262 {
263 m_frame->PopTool( aEvent );
264 break;
265 }
266 }
267 else if( evt->IsActivate() && !isSyntheticClick )
268 {
269 if( symbol && evt->IsMoveTool() )
270 {
271 // we're already moving our own item; ignore the move tool
272 evt->SetPassEvent( false );
273 continue;
274 }
275
276 if( symbol )
277 {
278 m_frame->ShowInfoBarMsg( _( "Press <ESC> to cancel symbol creation." ) );
279 evt->SetPassEvent( false );
280 continue;
281 }
282
283 if( evt->IsMoveTool() )
284 {
285 // leave ourselves on the stack so we come back after the move
286 break;
287 }
288 else
289 {
290 m_frame->PopTool( aEvent );
291 break;
292 }
293 }
294 else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) || isSyntheticClick )
295 {
296 if( !symbol )
297 {
299
300 // Pick the symbol to be placed
301 bool footprintPreviews = m_frame->eeconfig()->m_Appearance.footprint_preview;
302 PICKED_SYMBOL sel = m_frame->PickSymbolFromLibTree( &filter, *historyList, true,
303 1, 1, footprintPreviews );
304
305 LIB_SYMBOL* libSymbol = sel.LibId.IsValid() ? m_frame->GetLibSymbol( sel.LibId )
306 : nullptr;
307
308 if( !libSymbol )
309 continue;
310
311 // If we started with a hotkey which has a position then warp back to that.
312 // Otherwise update to the current mouse position pinned inside the autoscroll
313 // boundaries.
314 if( evt->IsPrime() && !ignorePrimePosition )
315 {
316 cursorPos = grid.Align( evt->Position() );
317 getViewControls()->WarpMouseCursor( cursorPos, true );
318 }
319 else
320 {
322 cursorPos = getViewControls()->GetMousePosition();
323 }
324
325 symbol = new SCH_SYMBOL( *libSymbol, &m_frame->GetCurrentSheet(), sel, cursorPos,
326 &m_frame->Schematic() );
327 addSymbol( symbol );
328 annotate();
329
330 // Update the list of references for the next symbol placement.
331 SCH_REFERENCE placedSymbolReference( symbol, symbol->GetLibSymbolRef().get(),
333 existingRefs.AddItem( placedSymbolReference );
334 existingRefs.SortByReferenceOnly();
335
337 symbol->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
338
339 // Update cursor now that we have a symbol
340 setCursor();
341 }
342 else
343 {
345 symbol->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
346
347 symbol->ClearEditFlags();
348 m_view->Update( symbol );
349 m_frame->GetScreen()->Update( symbol );
350
354
355 m_frame->OnModify();
356
357 SCH_SYMBOL* nextSymbol = nullptr;
358
361 {
362 int new_unit = symbol->GetUnit();
363
365 && symbol->GetUnit() < symbol->GetUnitCount() )
366 {
367 new_unit++;
368 }
369 else
370 {
371 new_unit = 1;
372 }
373
374 // We are either stepping to the next unit or next symbol
375 if( m_frame->eeconfig()->m_SymChooserPanel.keep_symbol || new_unit > 1 )
376 {
377 nextSymbol = static_cast<SCH_SYMBOL*>( symbol->Duplicate() );
378 nextSymbol->SetUnit( new_unit );
379 nextSymbol->SetUnitSelection( new_unit );
380
381 // Start new annotation sequence at first unit
382 if( new_unit == 1 )
383 nextSymbol->ClearAnnotation( nullptr, false );
384
385 addSymbol( nextSymbol );
386 symbol = nextSymbol; // annotate() looks at symbol, update it
387 annotate();
388
389 // Update the list of references for the next symbol placement.
390 SCH_REFERENCE placedSymbolReference( symbol,
391 symbol->GetLibSymbolRef().get(),
393 existingRefs.AddItem( placedSymbolReference );
394 existingRefs.SortByReferenceOnly();
395 }
396 }
397
398 symbol = nextSymbol;
399 }
400 }
401 else if( evt->IsClick( BUT_RIGHT ) )
402 {
403 // Warp after context menu only if dragging...
404 if( !symbol )
406
408 }
409 else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CHOICE_MENU_CHOICE )
410 {
411 if( *evt->GetCommandId() >= ID_POPUP_SCH_SELECT_UNIT_CMP
412 && *evt->GetCommandId() <= ID_POPUP_SCH_SELECT_UNIT_SYM_MAX )
413 {
414 int unit = *evt->GetCommandId() - ID_POPUP_SCH_SELECT_UNIT_CMP;
415
416 if( symbol )
417 {
418 m_frame->SelectUnit( symbol, unit );
420 }
421 }
422 }
423 else if( evt->IsAction( &ACTIONS::duplicate ) )
424 {
425 if( symbol )
426 {
427 // This doesn't really make sense; we'll just end up dragging a stack of
428 // objects so we ignore the duplicate and just carry on.
429 wxBell();
430 continue;
431 }
432
433 // Exit. The duplicate will run in its own loop.
434 m_frame->PopTool( aEvent );
435 break;
436 }
437 else if( symbol && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
438 {
439 symbol->SetPosition( cursorPos );
440 m_view->Update( symbol );
441 m_frame->SetMsgPanel( symbol );
442 }
443 else if( symbol && evt->IsAction( &ACTIONS::doDelete ) )
444 {
445 cleanup();
446 }
447 else
448 {
449 evt->SetPassEvent();
450 }
451
452 // Enable autopanning and cursor capture only when there is a symbol to be placed
453 getViewControls()->SetAutoPan( symbol != nullptr );
454 getViewControls()->CaptureCursor( symbol != nullptr );
455 }
456
457 getViewControls()->SetAutoPan( false );
458 getViewControls()->CaptureCursor( false );
460
461 return 0;
462}
static TOOL_ACTION duplicate
Definition: actions.h:72
PANEL_ANNOTATE m_AnnotatePanel
PANEL_SYM_CHOOSER m_SymChooserPanel
AUTOPLACE_FIELDS m_AutoplaceFields
static TOOL_ACTION placeSymbol
Definition: ee_actions.h:79
static TOOL_ACTION placePower
Definition: ee_actions.h:80
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1591
bool IsValid() const
Check if this LID_ID is valid.
Definition: lib_id.h:172
Define a library symbol object.
Definition: lib_symbol.h:99
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:86
PICKED_SYMBOL PickSymbolFromLibTree(const SYMBOL_LIBRARY_FILTER *aFilter, std::vector< PICKED_SYMBOL > &aHistoryList, bool aUseLibBrowser, int aUnit, int aConvert, bool aShowFootprints, const LIB_ID *aHighlight=nullptr, bool aAllowFields=true)
Call the library viewer to select symbol to import into schematic.
Definition: picksymbol.cpp:93
LIB_SYMBOL * GetLibSymbol(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
Load symbol from symbol library table.
std::vector< PICKED_SYMBOL > m_powerHistoryList
std::vector< PICKED_SYMBOL > m_symbolHistoryList
void RollbackSchematicFromUndo()
Perform an undo of the last edit WITHOUT logging a corresponding redo.
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag and update other data struc...
void SelectUnit(SCH_SYMBOL *aSymbol, int aUnit)
Definition: picksymbol.cpp:241
SCH_ITEM * Duplicate(bool doClone=false) const
Routine to create a new copy of given item.
Definition: sch_item.cpp:93
Tool responsible for drawing/placing items (symbols, wires, buses, labels, etc.)
int AddJunctionsIfNeeded(EE_SELECTION *aSelection)
Handle the addition of junctions to a selection of objects.
int TrimOverLappingWires(EE_SELECTION *aSelection)
Logic to remove wires when overlapping correct items.
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
void SortByReferenceOnly()
Sort the list of references by reference.
void ReannotateByOptions(ANNOTATE_ORDER_T aSortOption, ANNOTATE_ALGO_T aAlgoOption, int aStartNumber, const SCH_REFERENCE_LIST &aAdditionalRefs, bool aStartAtCurrent, SCH_SHEET_LIST *aHierarchy)
Forces reannotation of the provided references.
size_t GetCount() const
void AddItem(const SCH_REFERENCE &aItem)
void UpdateAnnotation()
Update the symbol references for the schematic project (or the current sheet).
A helper to define a symbol's reference designator in a schematic.
void Update(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Update aItem's bounding box in the tree.
Definition: sch_screen.cpp:300
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
void SortByPageNumbers(bool aUpdateVirtualPageNums=true)
Sort the list of sheets by page number.
SCH_SHEET_LIST FindAllSheetsForScreen(const SCH_SCREEN *aScreen) const
Return a SCH_SHEET_LIST with a copy of all the SCH_SHEET_PATH using a particular screen.
void GetSymbols(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanSymbols=false) const
Add a SCH_REFERENCE object to aReferences for each symbol in the list of sheets.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
void UpdateAllScreenReferences() const
Update all the symbol references for this sheet path.
SCH_SCREEN * LastScreen()
Schematic symbol object.
Definition: sch_symbol.h:81
int GetUnitCount() const
Return the number of units per package of the symbol.
Definition: sch_symbol.cpp:427
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Automatically orient all the fields in the symbol.
void SetPosition(const VECTOR2I &aPosition) override
Definition: sch_symbol.h:713
int GetUnit() const
Definition: sch_symbol.h:228
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath, bool aResetPrefix)
Clear exiting symbol annotation.
void SetUnit(int aUnit)
Change the unit number to aUnit.
Definition: sch_symbol.cpp:388
void SetUnitSelection(const SCH_SHEET_PATH *aSheet, int aUnitSelection)
Set the selected unit of this symbol on one sheet.
Definition: sch_symbol.cpp:809
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition: sch_symbol.h:192
Helper object to filter a list of libraries.
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
@ ID_POPUP_SCH_SELECT_UNIT_CMP
Definition: eeschema_id.h:94
@ ID_POPUP_SCH_SELECT_UNIT_SYM_MAX
Definition: eeschema_id.h:98
ANNOTATE_ORDER_T
Schematic annotation order options.
ANNOTATE_ALGO_T
Schematic annotation type options.
LIB_ID LibId
Definition: sch_screen.h:80
@ TA_CHOICE_MENU_CHOICE
Definition: tool_event.h:93
@ TC_COMMAND
Definition: tool_event.h:52
@ MD_SHIFT
Definition: tool_event.h:138

References _, TOOL_INTERACTIVE::Activate(), SCH_REFERENCE_LIST::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SELECTION_TOOL::AddItemToSel(), SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded(), SCH_REFERENCE::AlwaysAnnotate(), annotate, ARROW, EESCHEMA_SETTINGS::PANEL_ANNOTATE::automatic, SCH_SYMBOL::AutoplaceFields(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), SCH_REFERENCE_LIST::Clear(), SCH_SYMBOL::ClearAnnotation(), EDA_ITEM::ClearEditFlags(), EE_ACTIONS::clearSelection, COMPONENT, WX_INFOBAR::Dismiss(), ACTIONS::doDelete, SCH_ITEM::Duplicate(), ACTIONS::duplicate, SCH_BASE_FRAME::eeconfig(), EESCHEMA_SETTINGS::AUTOPLACE_FIELDS::enable, filter, SCH_SHEET_LIST::FindAllSheetsForScreen(), EESCHEMA_SETTINGS::APPEARANCE::footprint_preview, SCH_BASE_FRAME::GetCanvas(), SCH_REFERENCE_LIST::GetCount(), SCH_EDIT_FRAME::GetCurrentSheet(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), EDA_BASE_FRAME::GetInfoBar(), SCH_BASE_FRAME::GetLibSymbol(), SCH_SYMBOL::GetLibSymbolRef(), KIGFX::VIEW_CONTROLS::GetMousePosition(), SCH_EDIT_FRAME::GetScreen(), EE_SELECTION_TOOL::GetSelection(), SCHEMATIC::GetSheets(), SCH_SHEET_LIST::GetSymbols(), TOOL_MANAGER::GetTool(), SCH_SYMBOL::GetUnit(), SCH_SYMBOL::GetUnitCount(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), grid, TOOL_EVENT::HasPosition(), ID_POPUP_SCH_SELECT_UNIT_CMP, ID_POPUP_SCH_SELECT_UNIT_SYM_MAX, COMMON_SETTINGS::INPUT::immediate_actions, IS_MOVING, IS_NEW, TOOL_EVENT::IsAction(), TOOL_EVENT::IsReactivate(), LIB_ID::IsValid(), EESCHEMA_SETTINGS::PANEL_SYM_CHOOSER::keep_symbol, SCH_SHEET_PATH::LastScreen(), PICKED_SYMBOL::LibId, EESCHEMA_SETTINGS::m_AnnotatePanel, SCHEMATIC_SETTINGS::m_AnnotateStartNum, EESCHEMA_SETTINGS::m_Appearance, EESCHEMA_SETTINGS::m_AutoplaceFields, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_inPlaceSymbol, COMMON_SETTINGS::m_Input, TOOL_INTERACTIVE::m_menu, m_powerHistoryList, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, m_symbolHistoryList, EESCHEMA_SETTINGS::m_SymChooserPanel, TOOL_BASE::m_toolMgr, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_view, SCH_SYMBOL::Matches(), MD_SHIFT, EESCHEMA_SETTINGS::PANEL_ANNOTATE::method, MOVING, SCH_EDIT_FRAME::OnModify(), TOOL_EVENT::Parameter(), Pgm(), SCH_BASE_FRAME::PickSymbolFromLibTree(), KIGFX::VIEW_CONTROLS::PinCursorInsideNonAutoscrollArea(), EESCHEMA_SETTINGS::PANEL_SYM_CHOOSER::place_all_units, EE_ACTIONS::placePower, EE_ACTIONS::placeSymbol, TOOLS_HOLDER::PopTool(), TOOL_EVENT::Position(), TOOL_MANAGER::PrimeTool(), TOOLS_HOLDER::PushTool(), SCH_REFERENCE_LIST::ReannotateByOptions(), ACTIONS::refreshPreview, SCH_EDIT_FRAME::RollbackSchematicFromUndo(), TOOL_MANAGER::RunAction(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), SCH_EDIT_FRAME::Schematic(), SCH_EDIT_FRAME::SelectUnit(), KIGFX::VIEW_CONTROLS::SetAutoPan(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), EDA_DRAW_FRAME::SetMsgPanel(), SCH_SYMBOL::SetPosition(), SCHEMATIC::Settings(), SCH_SYMBOL::SetUnit(), SCH_SYMBOL::SetUnitSelection(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), EDA_BASE_FRAME::ShowInfoBarMsg(), EESCHEMA_SETTINGS::PANEL_ANNOTATE::sort_order, SCH_SHEET_LIST::SortByPageNumbers(), SCH_REFERENCE_LIST::SortByReferenceOnly(), TA_CHOICE_MENU_CHOICE, TC_COMMAND, SCH_LINE_WIRE_BUS_TOOL::TrimOverLappingWires(), KIGFX::VIEW::Update(), SCH_SCREEN::Update(), SCH_SHEET_PATH::UpdateAllScreenReferences(), SCH_REFERENCE_LIST::UpdateAnnotation(), TOOL_MANAGER::VetoContextMenuMouseWarp(), TOOL_INTERACTIVE::Wait(), and KIGFX::VIEW_CONTROLS::WarpMouseCursor().

Referenced by setTransitions().

◆ 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_FIELD_T )
162 {
163 editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
164 static_cast<SCH_ITEM*>( aItem->GetParent() ),
165 UNDO_REDO::CHANGED, aAppend,
166 false );
167 }
168 else if( itemType == SCH_PIN_T || itemType == SCH_SHEET_PIN_T )
169 {
170 editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
171 static_cast<SCH_ITEM*>( aItem->GetParent() ),
172 UNDO_REDO::CHANGED, aAppend,
173 aDirtyConnectivity );
174 }
175 else
176 {
177 editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
178 static_cast<SCH_ITEM*>( aItem ), aType,
179 aAppend, aDirtyConnectivity );
180 }
181 }
182 }
183
184 if( selected && aItem->HasFlag( SELECTED_BY_DRAG ) )
185 aItem->SetSelected();
186 }
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
Schematic editor (Eeschema) main window.
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, bool aDirtyConnectivity=true)
Create a copy of the current schematic item, and put it in the undo list.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
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 SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ setTransitions()

void SCH_DRAWING_TOOLS::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 1915 of file sch_drawing_tools.cpp.

1916{
1934}
static TOOL_ACTION placeClassLabel
Definition: ee_actions.h:88
static TOOL_ACTION drawCircle
Definition: ee_actions.h:96
static TOOL_ACTION importSheetPin
Definition: ee_actions.h:92
static TOOL_ACTION placeGlobalLabel
Definition: ee_actions.h:89
static TOOL_ACTION placeHierLabel
Definition: ee_actions.h:90
static TOOL_ACTION drawRectangle
Definition: ee_actions.h:95
static TOOL_ACTION placeImage
Definition: ee_actions.h:99
static TOOL_ACTION placeSchematicText
Definition: ee_actions.h:93
static TOOL_ACTION drawArc
Definition: ee_actions.h:97
static TOOL_ACTION drawSheet
Definition: ee_actions.h:91
static TOOL_ACTION placeLabel
Definition: ee_actions.h:87
static TOOL_ACTION placeBusWireEntry
Definition: ee_actions.h:86
static TOOL_ACTION placeJunction
Definition: ee_actions.h:85
static TOOL_ACTION placeNoConnect
Definition: ee_actions.h:84
int DrawSheet(const TOOL_EVENT &aEvent)
int SingleClickPlace(const TOOL_EVENT &aEvent)
int TwoClickPlace(const TOOL_EVENT &aEvent)
int DrawShape(const TOOL_EVENT &aEvent)
int PlaceSymbol(const TOOL_EVENT &aEvent)
int PlaceImage(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::drawArc, EE_ACTIONS::drawCircle, EE_ACTIONS::drawRectangle, DrawShape(), EE_ACTIONS::drawSheet, DrawSheet(), EE_ACTIONS::drawTextBox, TOOL_INTERACTIVE::Go(), EE_ACTIONS::importSheetPin, EE_ACTIONS::placeBusWireEntry, EE_ACTIONS::placeClassLabel, EE_ACTIONS::placeGlobalLabel, EE_ACTIONS::placeHierLabel, EE_ACTIONS::placeImage, PlaceImage(), EE_ACTIONS::placeJunction, EE_ACTIONS::placeLabel, EE_ACTIONS::placeNoConnect, EE_ACTIONS::placePower, EE_ACTIONS::placeSchematicText, EE_ACTIONS::placeSymbol, PlaceSymbol(), SingleClickPlace(), and TwoClickPlace().

◆ SingleClickPlace()

int SCH_DRAWING_TOOLS::SingleClickPlace ( const TOOL_EVENT aEvent)

Definition at line 696 of file sch_drawing_tools.cpp.

697{
698 VECTOR2I cursorPos;
699 KICAD_T type = aEvent.Parameter<KICAD_T>();
702 SCH_ITEM* previewItem;
703 bool loggedInfoBarError = false;
704
706 return 0;
707
709
710 if( type == SCH_JUNCTION_T && aEvent.HasPosition() )
711 {
713 SCH_LINE* wire = dynamic_cast<SCH_LINE*>( selection.Front() );
714
715 if( wire )
716 {
717 SEG seg( wire->GetStartPoint(), wire->GetEndPoint() );
718 VECTOR2I nearest = seg.NearestPoint( getViewControls()->GetCursorPosition() );
719 getViewControls()->SetCrossHairCursorPosition( nearest, false );
720 getViewControls()->WarpMouseCursor( getViewControls()->GetCursorPosition(), true );
721 }
722 }
723
724 switch( type )
725 {
726 case SCH_NO_CONNECT_T:
727 previewItem = new SCH_NO_CONNECT( cursorPos );
728 previewItem->SetParent( m_frame->GetScreen() );
729 break;
730
731 case SCH_JUNCTION_T:
732 previewItem = new SCH_JUNCTION( cursorPos );
733 previewItem->SetParent( m_frame->GetScreen() );
734 break;
735
737 previewItem = new SCH_BUS_WIRE_ENTRY( cursorPos );
738 previewItem->SetParent( m_frame->GetScreen() );
739 break;
740
741 default:
742 wxASSERT_MSG( false, "Unknown item type in SCH_DRAWING_TOOLS::SingleClickPlace" );
743 return 0;
744 }
745
747
748 cursorPos = aEvent.HasPosition() ? aEvent.Position() : controls->GetMousePosition();
749
750 m_frame->PushTool( aEvent );
751
752 auto setCursor =
753 [&]()
754 {
756 };
757
758 Activate();
759
760 // Must be done after Activate() so that it gets set into the correct context
761 getViewControls()->ShowCursor( true );
762
763 // Set initial cursor
764 setCursor();
765
767 m_view->AddToPreview( previewItem->Clone() );
768
769 // Prime the pump
770 if( aEvent.HasPosition() && type != SCH_SHEET_PIN_T )
771 m_toolMgr->PrimeTool( aEvent.Position() );
772 else
774
775 // Main loop: keep receiving events
776 while( TOOL_EVENT* evt = Wait() )
777 {
778 setCursor();
779 grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
780 grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
781
782 cursorPos = evt->IsPrime() ? evt->Position() : controls->GetMousePosition();
783 cursorPos = grid.BestSnapAnchor( cursorPos, LAYER_CONNECTABLE, nullptr );
784 controls->ForceCursorPosition( true, cursorPos );
785
786 if( evt->IsCancelInteractive() )
787 {
788 m_frame->PopTool( aEvent );
789 break;
790 }
791 else if( evt->IsActivate() )
792 {
793 if( evt->IsMoveTool() )
794 {
795 // leave ourselves on the stack so we come back after the move
796 break;
797 }
798 else
799 {
800 m_frame->PopTool( aEvent );
801 break;
802 }
803 }
804 else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) )
805 {
806 if( !m_frame->GetScreen()->GetItem( cursorPos, 0, type ) )
807 {
808 if( type == SCH_JUNCTION_T )
809 {
810 if( !m_frame->GetScreen()->IsExplicitJunctionAllowed( cursorPos ) )
811 {
812 m_frame->ShowInfoBarError( _( "Junction location contains no joinable "
813 "wires and/or pins." ) );
814 loggedInfoBarError = true;
815 continue;
816 }
817 else if( loggedInfoBarError )
818 {
820 }
821 }
822
823 SCH_ITEM* newItem = static_cast<SCH_ITEM*>( previewItem->Clone() );
824 const_cast<KIID&>( newItem->m_Uuid ) = KIID();
825 newItem->SetPosition( cursorPos );
826 newItem->SetFlags( IS_NEW );
827
829
830 if( type == SCH_JUNCTION_T )
832 else
834
835 m_frame->OnModify();
836 }
837
838 if( evt->IsDblClick( BUT_LEFT ) || type == SCH_SHEET_PIN_T ) // Finish tool.
839 {
840 m_frame->PopTool( aEvent );
841 break;
842 }
843 }
844 else if( evt->IsClick( BUT_RIGHT ) )
845 {
847 }
848 else if( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() )
849 {
850 previewItem->SetPosition( cursorPos );
852 m_view->AddToPreview( previewItem->Clone() );
853 m_frame->SetMsgPanel( previewItem );
854 }
855 else if( evt->Category() == TC_COMMAND )
856 {
857 if( ( type == SCH_BUS_WIRE_ENTRY_T ) && ( evt->IsAction( &EE_ACTIONS::rotateCW )
858 || evt->IsAction( &EE_ACTIONS::rotateCCW )
859 || evt->IsAction( &EE_ACTIONS::mirrorV )
860 || evt->IsAction( &EE_ACTIONS::mirrorH ) ) )
861 {
862 SCH_BUS_ENTRY_BASE* busItem = static_cast<SCH_BUS_ENTRY_BASE*>( previewItem );
863
864 // The bus entries only rotate in one direction
865 if( evt->IsAction( &EE_ACTIONS::rotateCW )
866 || evt->IsAction( &EE_ACTIONS::rotateCCW ) )
867 {
868 busItem->Rotate( busItem->GetPosition() );
869 }
870 else if( evt->IsAction( &EE_ACTIONS::mirrorV ) )
871 {
872 busItem->MirrorVertically( busItem->GetPosition().x );
873 }
874 else if( evt->IsAction( &EE_ACTIONS::mirrorH ) )
875 {
876 busItem->MirrorHorizontally( busItem->GetPosition().y );
877 }
878
880 m_view->AddToPreview( previewItem->Clone() );
881 }
882 else if( evt->IsAction( &EE_ACTIONS::properties ) )
883 {
884 switch( type )
885 {
887 {
888 std::deque<SCH_ITEM*> strokeItems;
889 strokeItems.push_back( previewItem );
890
891 DIALOG_WIRE_BUS_PROPERTIES dlg( m_frame, strokeItems );
892
893 if( dlg.ShowModal() == wxID_OK )
894 {
896 m_frame->OnModify();
897 }
898 }
899 break;
900
901 case SCH_JUNCTION_T:
902 {
903 std::deque<SCH_JUNCTION*> junctions;
904 junctions.push_back( static_cast<SCH_JUNCTION*>( previewItem ) );
905
906 DIALOG_JUNCTION_PROPS dlg( m_frame, junctions );
907
908 if( dlg.ShowModal() == wxID_OK )
909 {
911 m_frame->OnModify();
912 }
913 }
914 break;
915 default:
916 // Do nothing
917 break;
918 }
919
921 m_view->AddToPreview( previewItem->Clone() );
922 }
923 else
924 {
925 evt->SetPassEvent();
926 }
927 }
928 else
929 {
930 evt->SetPassEvent();
931 }
932 }
933
934 delete previewItem;
936
938 controls->ForceCursorPosition( false );
939
940 return 0;
941}
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, WX_INFOBAR::MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
virtual void SetPosition(const VECTOR2I &aPos)
Definition: eda_item.h:250
const KIID m_Uuid
Definition: eda_item.h:492
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:82
static TOOL_ACTION mirrorV
Definition: ee_actions.h:125
static TOOL_ACTION rotateCCW
Definition: ee_actions.h:124
static TOOL_ACTION mirrorH
Definition: ee_actions.h:126
static TOOL_ACTION rotateCW
Definition: ee_actions.h:123
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:214
An interface for classes handling user events controlling the view behavior such as zooming,...
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Place the cursor immediately at a given point.
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Move the graphic crosshair cursor to the requested position expressed in world coordinates.
Definition: kiid.h:48
Base class for a bus or wire entry.
Definition: sch_bus_entry.h:38
VECTOR2I GetPosition() const override
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
void Rotate(const VECTOR2I &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
Class for a wire to bus entry.
bool SchematicCleanUp(SCH_SCREEN *aScreen=nullptr)
Perform routine schematic cleaning including breaking wire and buses and deleting identical objects s...
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:40
VECTOR2I GetEndPoint() const
Definition: sch_line.h:143
VECTOR2I GetStartPoint() const
Definition: sch_line.h:138
SCH_ITEM * GetItem(const VECTOR2I &aPosition, int aAccuracy=0, KICAD_T aType=SCH_LOCATE_ANY_T) const
Check aPosition within a distance of aAccuracy for items of type aFilter.
Definition: sch_screen.cpp:376
bool IsExplicitJunctionAllowed(const VECTOR2I &aPosition) const
Indicates that a juction dot may be placed at the given location.
Definition: sch_screen.cpp:705
Definition: seg.h:42
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
@ LAYER_CONNECTABLE
@ SCH_NO_CONNECT_T
Definition: typeinfo.h:143
@ SCH_BUS_WIRE_ENTRY_T
Definition: typeinfo.h:144
@ SCH_JUNCTION_T
Definition: typeinfo.h:142

References _, TOOL_INTERACTIVE::Activate(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), KIGFX::VIEW::AddToPreview(), ARROW, BUT_LEFT, BUT_RIGHT, KIGFX::VIEW::ClearPreview(), EE_ACTIONS::clearSelection, EDA_ITEM::Clone(), WX_INFOBAR::Dismiss(), KIGFX::VIEW_CONTROLS::ForceCursorPosition(), SELECTION::Front(), SCH_BASE_FRAME::GetCanvas(), SCH_LINE::GetEndPoint(), EDA_BASE_FRAME::GetInfoBar(), SCH_SCREEN::GetItem(), KIGFX::VIEW_CONTROLS::GetMousePosition(), SCH_BUS_ENTRY_BASE::GetPosition(), SCH_EDIT_FRAME::GetScreen(), EE_SELECTION_TOOL::GetSelection(), SCH_LINE::GetStartPoint(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), grid, TOOL_EVENT::HasPosition(), IS_NEW, SCH_SCREEN::IsExplicitJunctionAllowed(), LAYER_CONNECTABLE, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_inSingleClickPlace, TOOL_INTERACTIVE::m_menu, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, EDA_ITEM::m_Uuid, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_view, MD_SHIFT, EE_ACTIONS::mirrorH, SCH_BUS_ENTRY_BASE::MirrorHorizontally(), EE_ACTIONS::mirrorV, SCH_BUS_ENTRY_BASE::MirrorVertically(), SEG::NearestPoint(), SCH_EDIT_FRAME::OnModify(), TOOL_EVENT::Parameter(), PLACE, TOOLS_HOLDER::PopTool(), TOOL_EVENT::Position(), TOOL_MANAGER::PostEvent(), TOOL_MANAGER::PrimeTool(), EE_ACTIONS::properties, TOOLS_HOLDER::PushTool(), ACTIONS::refreshPreview, SCH_BUS_ENTRY_BASE::Rotate(), EE_ACTIONS::rotateCCW, EE_ACTIONS::rotateCW, TOOL_MANAGER::RunAction(), SCH_BUS_WIRE_ENTRY_T, SCH_JUNCTION_T, SCH_NO_CONNECT_T, SCH_SHEET_PIN_T, SCH_EDIT_FRAME::SchematicCleanUp(), EVENTS::SelectedItemsModified, KIGFX::VIEW_CONTROLS::SetCrossHairCursorPosition(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), EDA_ITEM::SetFlags(), EDA_DRAW_FRAME::SetMsgPanel(), EDA_ITEM::SetParent(), EDA_ITEM::SetPosition(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), EDA_BASE_FRAME::ShowInfoBarError(), TC_COMMAND, SCH_EDIT_FRAME::TestDanglingEnds(), TOOL_INTERACTIVE::Wait(), KIGFX::VIEW_CONTROLS::WarpMouseCursor(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by setTransitions().

◆ sizeSheet()

void SCH_DRAWING_TOOLS::sizeSheet ( SCH_SHEET aSheet,
const VECTOR2I aPos 
)
private

Set up handlers for various events.

Definition at line 1902 of file sch_drawing_tools.cpp.

1903{
1904 VECTOR2I pos = aSheet->GetPosition();
1905 VECTOR2I size = aPos - pos;
1906
1907 size.x = std::max( size.x, schIUScale.MilsToIU( MIN_SHEET_WIDTH ) );
1908 size.y = std::max( size.y, schIUScale.MilsToIU( MIN_SHEET_HEIGHT ) );
1909
1911 aSheet->Resize( VECTOR2I( grid.x - pos.x, grid.y - pos.y ) );
1912}
VECTOR2I GetNearestGridPosition(const VECTOR2I &aPosition) const
Return the nearest aGridSize location to aPosition.
VECTOR2I GetPosition() const override
Definition: sch_sheet.h:368
void Resize(const VECTOR2I &aSize)
Resize this sheet to aSize and adjust all of the labels accordingly.
Definition: sch_sheet.cpp:915
#define MIN_SHEET_HEIGHT
Definition: sch_sheet.h:40
#define MIN_SHEET_WIDTH
Definition: sch_sheet.h:39

References EDA_DRAW_FRAME::GetNearestGridPosition(), SCH_SHEET::GetPosition(), grid, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, EDA_IU_SCALE::MilsToIU(), MIN_SHEET_HEIGHT, MIN_SHEET_WIDTH, SCH_SHEET::Resize(), schIUScale, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by DrawSheet().

◆ TwoClickPlace()

int SCH_DRAWING_TOOLS::TwoClickPlace ( const TOOL_EVENT aEvent)

Definition at line 1111 of file sch_drawing_tools.cpp.

1112{
1113 SCH_ITEM* item = nullptr;
1116 bool ignorePrimePosition = false;
1117 COMMON_SETTINGS* common_settings = Pgm().GetCommonSettings();
1118 SCH_SHEET* sheet = nullptr;
1119
1120 if( m_inTwoClickPlace )
1121 return 0;
1122
1124
1125 bool isText = aEvent.IsAction( &EE_ACTIONS::placeSchematicText );
1126 bool isGlobalLabel = aEvent.IsAction( &EE_ACTIONS::placeGlobalLabel );
1127 bool isHierLabel = aEvent.IsAction( &EE_ACTIONS::placeHierLabel );
1128 bool isClassLabel = aEvent.IsAction( &EE_ACTIONS::placeClassLabel );
1129 bool isNetLabel = aEvent.IsAction( &EE_ACTIONS::placeLabel );
1130 bool isSheetPin = aEvent.IsAction( &EE_ACTIONS::importSheetPin );
1131 int snapLayer = isText ? LAYER_GRAPHICS : LAYER_CONNECTABLE;
1132
1133 // If we have a selected sheet use it, otherwise try to get one under the cursor
1134 if( isSheetPin )
1135 sheet = dynamic_cast<SCH_SHEET*>( m_selectionTool->GetSelection().Front() );
1136
1138
1139 m_frame->PushTool( aEvent );
1140
1141 auto setCursor =
1142 [&]()
1143 {
1144 if( item )
1146 else if( isText )
1148 else if( isGlobalLabel )
1150 else if( isNetLabel )
1152 else if( isClassLabel )
1153 m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::LABEL_NET ); // JEY TODO: netclass directive cursor
1154 else if( isHierLabel )
1156 else
1158 };
1159
1160 auto updatePreview =
1161 [&]()
1162 {
1164 m_view->AddToPreview( item->Clone() );
1165 item->RunOnChildren( [&]( SCH_ITEM* aChild )
1166 {
1167 m_view->AddToPreview( aChild->Clone() );
1168 } );
1169 m_frame->SetMsgPanel( item );
1170 };
1171
1172 auto cleanup =
1173 [&]()
1174 {
1177 delete item;
1178 item = nullptr;
1179 };
1180
1181 Activate();
1182
1183 // Must be done after Activate() so that it gets set into the correct context
1184 controls->ShowCursor( true );
1185
1186 // Set initial cursor
1187 setCursor();
1188
1189 if( aEvent.HasPosition() )
1190 {
1191 m_toolMgr->PrimeTool( aEvent.Position() );
1192 }
1193 else if( common_settings->m_Input.immediate_actions && !aEvent.IsReactivate()
1194 && ( isText || isGlobalLabel || isHierLabel || isClassLabel || isNetLabel ) )
1195 {
1196 m_toolMgr->PrimeTool( { 0, 0 } );
1197 ignorePrimePosition = true;
1198 }
1199
1200 // Main loop: keep receiving events
1201 while( TOOL_EVENT* evt = Wait() )
1202 {
1203 setCursor();
1204 grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
1205 grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
1206
1207 VECTOR2I cursorPos = controls->GetMousePosition();
1208 cursorPos = grid.BestSnapAnchor( cursorPos, snapLayer, item );
1209 controls->ForceCursorPosition( true, cursorPos );
1210
1211 // The tool hotkey is interpreted as a click when drawing
1212 bool isSyntheticClick = item && evt->IsActivate() && evt->HasPosition()
1213 && evt->Matches( aEvent );
1214
1215 auto createNextSheetPin =
1216 [&]()
1217 {
1218 if( !sheet )
1219 return;
1220
1221 SCH_HIERLABEL* label = importHierLabel( sheet );
1222
1223 if( !label )
1224 {
1225 m_statusPopup = std::make_unique<STATUS_TEXT_POPUP>( m_frame );
1226 m_statusPopup->SetText( _( "No new hierarchical labels found." ) );
1227 m_statusPopup->Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
1228 m_statusPopup->PopupFor( 2000 );
1229 item = nullptr;
1230 }
1231 else
1232 {
1233 item = createSheetPin( sheet, label, cursorPos );
1234
1235 if( item->Type() == SCH_SHEET_PIN_T )
1236 {
1237 item->ClearSelected();
1238 }
1239 }
1240 };
1241
1242 if( evt->IsCancelInteractive() )
1243 {
1245
1246 if( item )
1247 {
1248 cleanup();
1249 }
1250 else
1251 {
1252 m_frame->PopTool( aEvent );
1253 break;
1254 }
1255 }
1256 else if( evt->IsActivate() && !isSyntheticClick )
1257 {
1258 if( item && evt->IsMoveTool() )
1259 {
1260 // we're already moving our own item; ignore the move tool
1261 evt->SetPassEvent( false );
1262 continue;
1263 }
1264
1265 if( item )
1266 {
1267 m_frame->ShowInfoBarMsg( _( "Press <ESC> to cancel item creation." ) );
1268 evt->SetPassEvent( false );
1269 continue;
1270 }
1271
1272 if( evt->IsPointEditor() )
1273 {
1274 // don't exit (the point editor runs in the background)
1275 }
1276 else if( evt->IsMoveTool() )
1277 {
1278 // leave ourselves on the stack so we come back after the move
1279 break;
1280 }
1281 else
1282 {
1283 m_frame->PopTool( aEvent );
1284 break;
1285 }
1286 }
1287 else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) || isSyntheticClick )
1288 {
1289 // First click creates...
1290 if( !item )
1291 {
1293
1294 if( isText )
1295 {
1296 item = createNewText( cursorPos, LAYER_NOTES );
1297 }
1298 else if( isHierLabel )
1299 {
1300 item = createNewText( cursorPos, LAYER_HIERLABEL );
1301 }
1302 else if( isNetLabel || isGlobalLabel )
1303 {
1304 wxString netName;
1305
1306 for( SCH_ITEM* overlapItem :
1307 m_frame->GetScreen()->Items().Overlapping( cursorPos ) )
1308 {
1309 if( overlapItem->GetEditFlags() & STRUCT_DELETED )
1310 continue;
1311
1312 if( overlapItem->Type() == SCH_LINE_T )
1313 {
1314 SCH_LINE* line = static_cast<SCH_LINE*>( overlapItem );
1315 if( line->IsWire() )
1316 {
1317 netName = line->GetNetname(m_frame->GetCurrentSheet());
1318 break;
1319 }
1320 }
1321 }
1322
1323 if( netName.IsEmpty() )
1324 {
1325 // no connected net label found -> open up the new label dialog
1326 if( isGlobalLabel )
1327 item = createNewText( cursorPos, LAYER_GLOBLABEL );
1328 else
1329 item = createNewText( cursorPos, LAYER_LOCLABEL );
1330 }
1331 else
1332 {
1333 // connected net label found -> create the label immediately
1334 SCHEMATIC* schematic = getModel<SCHEMATIC>();
1335 SCHEMATIC_SETTINGS& sch_settings = schematic->Settings();
1336 SCH_LABEL_BASE* labelItem = nullptr;
1337
1338 if( isGlobalLabel )
1339 {
1340 labelItem = new SCH_GLOBALLABEL( cursorPos );
1341 labelItem->SetShape( m_lastGlobalLabelShape );
1342 // make intersheets reference visible based on settings
1343 labelItem->GetFields()[0].SetVisible( sch_settings.m_IntersheetRefsShow );
1344 }
1345 else
1346 {
1347 labelItem = new SCH_LABEL( cursorPos );
1348 }
1349
1350 labelItem->SetParent( getModel<SCHEMATIC>() );
1351 labelItem->SetBold( m_lastTextBold );
1352 labelItem->SetItalic( m_lastTextItalic );
1354 labelItem->SetTextSize( VECTOR2I( sch_settings.m_DefaultTextSize,
1355 sch_settings.m_DefaultTextSize ) );
1356 labelItem->SetFlags( IS_NEW | IS_MOVING );
1357 labelItem->SetText( netName );
1358 item = labelItem;
1359 }
1360 }
1361 else if( isClassLabel )
1362 {
1363 item = createNewText( cursorPos, LAYER_NETCLASS_REFS );
1364 }
1365 else if( isSheetPin )
1366 {
1367 EDA_ITEM* i;
1368
1369 // If we didn't have a sheet selected, try to find one under the cursor
1370 if( !sheet && m_selectionTool->SelectPoint( cursorPos, { SCH_SHEET_T }, &i ) )
1371 sheet = dynamic_cast<SCH_SHEET*>( i );
1372
1373 if( !sheet )
1374 {
1375 m_statusPopup = std::make_unique<STATUS_TEXT_POPUP>( m_frame );
1376 m_statusPopup->SetText( _( "Click over a sheet." ) );
1377 m_statusPopup->Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
1378 m_statusPopup->PopupFor( 2000 );
1379 item = nullptr;
1380 }
1381 else
1382 {
1383 createNextSheetPin();
1384
1385 if( !item )
1386 {
1387 m_frame->PopTool( aEvent );
1388 break;
1389 }
1390 }
1391 }
1392
1393 // If we started with a hotkey which has a position then warp back to that.
1394 // Otherwise update to the current mouse position pinned inside the autoscroll
1395 // boundaries.
1396 if( evt->IsPrime() && !ignorePrimePosition )
1397 {
1398 cursorPos = grid.Align( evt->Position() );
1399 getViewControls()->WarpMouseCursor( cursorPos, true );
1400 }
1401 else
1402 {
1404 cursorPos = getViewControls()->GetMousePosition();
1405 }
1406
1407 if( item )
1408 {
1409 item->SetPosition( cursorPos );
1410
1411 item->SetFlags( IS_NEW | IS_MOVING );
1412 item->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
1413 updatePreview();
1414
1415 if( item->Type() != SCH_SHEET_PIN_T )
1417
1419
1420 // update the cursor so it looks correct before another event
1421 setCursor();
1422 }
1423
1424 controls->SetCursorPosition( cursorPos, false );
1425 }
1426 else // ... and second click places:
1427 {
1428 item->ClearFlags( IS_MOVING );
1430 item = nullptr;
1431
1433
1434 // Exit the tool when this sheet runs out of pins for convenience
1435 if( isSheetPin )
1436 {
1437 createNextSheetPin();
1438
1439 if( !item )
1440 {
1441 m_frame->PopTool( aEvent );
1442 break;
1443 }
1444 }
1445 }
1446 }
1447 else if( evt->IsClick( BUT_RIGHT ) )
1448 {
1449 // Warp after context menu only if dragging...
1450 if( !item )
1452
1454 }
1455 else if( item && evt->IsSelectionEvent() )
1456 {
1457 // This happens if our text was replaced out from under us by ConvertTextType()
1459
1460 if( selection.GetSize() == 1 )
1461 {
1462 item = (SCH_ITEM*) selection.Front();
1463 updatePreview();
1464 }
1465 else
1466 {
1467 item = nullptr;
1468 }
1469 }
1470 else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
1471 {
1472 item->SetPosition( cursorPos );
1473 item->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
1474 updatePreview();
1475 }
1476 else if( item && evt->IsAction( &ACTIONS::doDelete ) )
1477 {
1478 cleanup();
1479 }
1480 else
1481 {
1482 evt->SetPassEvent();
1483 }
1484
1485 // Enable autopanning and cursor capture only when there is an item to be placed
1486 controls->SetAutoPan( item != nullptr );
1487 controls->CaptureCursor( item != nullptr );
1488 }
1489
1490 controls->SetAutoPan( false );
1491 controls->CaptureCursor( false );
1492 controls->ForceCursorPosition( false );
1494 return 0;
1495}
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:141
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:165
EE_TYPE Overlapping(const BOX2I &aRect) const
Definition: sch_rtree.h:243
bool SelectPoint(const VECTOR2I &aWhere, const std::vector< KICAD_T > &aScanTypes={ SCH_LOCATE_ANY_T }, EDA_ITEM **aItem=nullptr, bool *aSelectionCancelledFlag=nullptr, bool aCheckLocked=false, bool aAdd=false, bool aSubtract=false, bool aExclusiveOr=false)
Perform a click-type selection at a point (usually the cursor position).
SCH_TEXT * createNewText(const VECTOR2I &aPosition, int aType)
Get the next queued text item.
std::unique_ptr< STATUS_TEXT_POPUP > m_statusPopup
SCH_HIERLABEL * importHierLabel(SCH_SHEET *aSheet)
SCH_SHEET_PIN * createSheetPin(SCH_SHEET *aSheet, SCH_HIERLABEL *aLabel, const VECTOR2I &aPosition)
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction)
Definition: sch_item.h:444
virtual void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual)
Definition: sch_item.h:442
bool IsWire() const
Return true if the line is a wire.
Definition: sch_line.cpp:968
wxString GetNetname(const SCH_SHEET_PATH &aSheet)
This function travel though all the connected wire segments to look for connected labels.
Definition: sch_line.cpp:93
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:99
#define STRUCT_DELETED
flag indication structures to be erased
@ LAYER_GRAPHICS
@ SCH_LINE_T
Definition: typeinfo.h:146

References _, TOOL_INTERACTIVE::Activate(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SELECTION_TOOL::AddItemToSel(), KIGFX::VIEW::AddToPreview(), ARROW, SCH_ITEM::AutoplaceFields(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), EDA_ITEM::ClearFlags(), KIGFX::VIEW::ClearPreview(), EDA_ITEM::ClearSelected(), EE_ACTIONS::clearSelection, EDA_ITEM::Clone(), createNewText(), createSheetPin(), WX_INFOBAR::Dismiss(), ACTIONS::doDelete, KIGFX::VIEW_CONTROLS::ForceCursorPosition(), SELECTION::Front(), SCH_BASE_FRAME::GetCanvas(), SCH_EDIT_FRAME::GetCurrentSheet(), SCH_LABEL_BASE::GetFields(), EDA_BASE_FRAME::GetInfoBar(), KIGFX::VIEW_CONTROLS::GetMousePosition(), SCH_LINE::GetNetname(), SCH_EDIT_FRAME::GetScreen(), EE_SELECTION_TOOL::GetSelection(), SELECTION::GetSize(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), grid, TOOL_EVENT::HasPosition(), COMMON_SETTINGS::INPUT::immediate_actions, importHierLabel(), EE_ACTIONS::importSheetPin, IS_MOVING, IS_NEW, TOOL_EVENT::IsAction(), TOOL_EVENT::IsReactivate(), SCH_LINE::IsWire(), SCH_SCREEN::Items(), LABEL_GLOBAL, LABEL_HIER, LABEL_NET, LAYER_CONNECTABLE, LAYER_GLOBLABEL, LAYER_GRAPHICS, LAYER_HIERLABEL, LAYER_LOCLABEL, LAYER_NETCLASS_REFS, LAYER_NOTES, SCHEMATIC_SETTINGS::m_DefaultTextSize, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, COMMON_SETTINGS::m_Input, SCHEMATIC_SETTINGS::m_IntersheetRefsShow, m_inTwoClickPlace, m_lastGlobalLabelShape, m_lastTextBold, m_lastTextItalic, m_lastTextOrientation, TOOL_INTERACTIVE::m_menu, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, m_statusPopup, TOOL_BASE::m_toolMgr, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_view, EDA_ITEM::Matches(), MD_SHIFT, EE_RTREE::Overlapping(), PENCIL, Pgm(), KIGFX::VIEW_CONTROLS::PinCursorInsideNonAutoscrollArea(), PLACE, EE_ACTIONS::placeClassLabel, EE_ACTIONS::placeGlobalLabel, EE_ACTIONS::placeHierLabel, EE_ACTIONS::placeLabel, EE_ACTIONS::placeSchematicText, TOOLS_HOLDER::PopTool(), TOOL_EVENT::Position(), TOOL_MANAGER::PrimeTool(), TOOLS_HOLDER::PushTool(), ACTIONS::refreshPreview, TOOL_MANAGER::RunAction(), SCH_ITEM::RunOnChildren(), SCH_LINE_T, SCH_SHEET_PIN_T, EE_SELECTION_TOOL::SelectPoint(), KIGFX::VIEW_CONTROLS::SetAutoPan(), EDA_TEXT::SetBold(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), KIGFX::VIEW_CONTROLS::SetCursorPosition(), EDA_ITEM::SetFlags(), EDA_TEXT::SetItalic(), EDA_DRAW_FRAME::SetMsgPanel(), EDA_ITEM::SetParent(), EDA_ITEM::SetPosition(), SCH_LABEL_BASE::SetShape(), EDA_TEXT::SetText(), EDA_TEXT::SetTextSize(), SCH_TEXT::SetTextSpinStyle(), SCHEMATIC::Settings(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), EDA_BASE_FRAME::ShowInfoBarMsg(), STRUCT_DELETED, TEXT, EDA_ITEM::Type(), TOOL_MANAGER::VetoContextMenuMouseWarp(), TOOL_INTERACTIVE::Wait(), and KIGFX::VIEW_CONTROLS::WarpMouseCursor().

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 SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SELECTION_TOOL::doSelectionMenu(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), 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(), PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), 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(), SingleClickPlace(), TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

Member Data Documentation

◆ m_frame

SCH_EDIT_FRAME * EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame
protectedinherited

Definition at line 189 of file ee_tool_base.h.

◆ m_inDrawShape

bool SCH_DRAWING_TOOLS::m_inDrawShape
private

Definition at line 99 of file sch_drawing_tools.h.

Referenced by DrawShape().

◆ m_inDrawSheet

bool SCH_DRAWING_TOOLS::m_inDrawSheet
private

Definition at line 103 of file sch_drawing_tools.h.

Referenced by DrawSheet().

◆ m_inPlaceImage

bool SCH_DRAWING_TOOLS::m_inPlaceImage
private

Definition at line 100 of file sch_drawing_tools.h.

Referenced by PlaceImage().

◆ m_inPlaceSymbol

bool SCH_DRAWING_TOOLS::m_inPlaceSymbol
private

Definition at line 98 of file sch_drawing_tools.h.

Referenced by PlaceSymbol().

◆ m_inSingleClickPlace

bool SCH_DRAWING_TOOLS::m_inSingleClickPlace
private

Definition at line 101 of file sch_drawing_tools.h.

Referenced by SingleClickPlace().

◆ m_inTwoClickPlace

bool SCH_DRAWING_TOOLS::m_inTwoClickPlace
private

Definition at line 102 of file sch_drawing_tools.h.

Referenced by TwoClickPlace().

◆ m_isSymbolEditor

bool EE_TOOL_BASE< SCH_EDIT_FRAME >::m_isSymbolEditor
protectedinherited

Definition at line 192 of file ee_tool_base.h.

◆ m_lastAutoLabelRotateOnPlacement

bool SCH_DRAWING_TOOLS::m_lastAutoLabelRotateOnPlacement
private

Re-entrancy guards.

Definition at line 95 of file sch_drawing_tools.h.

Referenced by createNewText().

◆ m_lastFillColor

COLOR4D SCH_DRAWING_TOOLS::m_lastFillColor
private

Definition at line 90 of file sch_drawing_tools.h.

Referenced by DrawShape().

◆ m_lastFillStyle

FILL_T SCH_DRAWING_TOOLS::m_lastFillStyle
private

Definition at line 88 of file sch_drawing_tools.h.

Referenced by DrawShape().

◆ m_lastGlobalLabelShape

LABEL_FLAG_SHAPE SCH_DRAWING_TOOLS::m_lastGlobalLabelShape
private

Definition at line 81 of file sch_drawing_tools.h.

Referenced by createNewText(), and TwoClickPlace().

◆ m_lastNetClassFlagShape

LABEL_FLAG_SHAPE SCH_DRAWING_TOOLS::m_lastNetClassFlagShape
private

Definition at line 82 of file sch_drawing_tools.h.

Referenced by createNewText().

◆ m_lastSheetPinType

LABEL_FLAG_SHAPE SCH_DRAWING_TOOLS::m_lastSheetPinType
private

Definition at line 80 of file sch_drawing_tools.h.

Referenced by createSheetPin().

◆ m_lastStroke

STROKE_PARAMS SCH_DRAWING_TOOLS::m_lastStroke
private

Definition at line 92 of file sch_drawing_tools.h.

Referenced by DrawShape().

◆ m_lastTextAngle

EDA_ANGLE SCH_DRAWING_TOOLS::m_lastTextAngle
private

Definition at line 86 of file sch_drawing_tools.h.

Referenced by DrawShape().

◆ m_lastTextBold

bool SCH_DRAWING_TOOLS::m_lastTextBold
private

Definition at line 84 of file sch_drawing_tools.h.

Referenced by createNewText(), DrawShape(), and TwoClickPlace().

◆ m_lastTextboxFillColor

COLOR4D SCH_DRAWING_TOOLS::m_lastTextboxFillColor
private

Definition at line 91 of file sch_drawing_tools.h.

Referenced by DrawShape().

◆ m_lastTextboxFillStyle

FILL_T SCH_DRAWING_TOOLS::m_lastTextboxFillStyle
private

Definition at line 89 of file sch_drawing_tools.h.

Referenced by DrawShape().

◆ m_lastTextboxStroke

STROKE_PARAMS SCH_DRAWING_TOOLS::m_lastTextboxStroke
private

Definition at line 93 of file sch_drawing_tools.h.

Referenced by DrawShape().

◆ m_lastTextItalic

bool SCH_DRAWING_TOOLS::m_lastTextItalic
private

Definition at line 85 of file sch_drawing_tools.h.

Referenced by createNewText(), DrawShape(), and TwoClickPlace().

◆ m_lastTextJust

GR_TEXT_H_ALIGN_T SCH_DRAWING_TOOLS::m_lastTextJust
private

Definition at line 87 of file sch_drawing_tools.h.

Referenced by DrawShape().

◆ m_lastTextOrientation

TEXT_SPIN_STYLE SCH_DRAWING_TOOLS::m_lastTextOrientation
private

Definition at line 83 of file sch_drawing_tools.h.

Referenced by createNewText(), and TwoClickPlace().

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

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

Definition at line 125 of file tool_interactive.h.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), 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(), Init(), SCH_EDIT_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), SYMBOL_EDITOR_CONTROL::Init(), SYMBOL_EDITOR_DRAWING_TOOLS::Init(), GERBVIEW_SELECTION_TOOL::Init(), PICKER_TOOL::Init(), ZOOM_TOOL::Init(), PL_DRAWING_TOOLS::Init(), PL_EDIT_TOOL::Init(), PL_SELECTION_TOOL::Init(), LENGTH_TUNER_TOOL::Init(), ROUTER_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), DRAWING_TOOL::Init(), FOOTPRINT_EDITOR_CONTROL::Init(), PAD_TOOL::Init(), PCB_SELECTION_TOOL::Init(), PCB_TOOL_BASE::Init(), PCB_VIEWER_TOOLS::Init(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDA_3D_CONTROLLER::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), 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(), PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PlaceSymbol(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SingleClickPlace(), TwoClickPlace(), and SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace().

◆ m_mruPath

wxString SCH_DRAWING_TOOLS::m_mruPath
private

Definition at line 94 of file sch_drawing_tools.h.

Referenced by PlaceImage().

◆ m_powerHistoryList

std::vector<PICKED_SYMBOL> SCH_DRAWING_TOOLS::m_powerHistoryList
private

Definition at line 78 of file sch_drawing_tools.h.

Referenced by PlaceSymbol().

◆ m_selectionTool

EE_SELECTION_TOOL* EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool
protectedinherited

Definition at line 191 of file ee_tool_base.h.

◆ m_statusPopup

std::unique_ptr<STATUS_TEXT_POPUP> SCH_DRAWING_TOOLS::m_statusPopup
private

Definition at line 105 of file sch_drawing_tools.h.

Referenced by TwoClickPlace().

◆ m_symbolHistoryList

std::vector<PICKED_SYMBOL> SCH_DRAWING_TOOLS::m_symbolHistoryList
private

Definition at line 77 of file sch_drawing_tools.h.

Referenced by PlaceSymbol().

◆ 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(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), BOARD_INSPECTION_TOOL::doHideRatsnestNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PCB_SELECTION_TOOL::doSyncSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::Drag(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawRectangle(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), 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(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), EDIT_TOOL::GetAndPlace(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getToolHolderInt(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), PCB_SELECTION_TOOL::grabUnconnected(), COMMON_TOOLS::GridNext(), COMMON_TOOLS::GridPreset(), COMMON_TOOLS::GridPrev(), PCB_CONTROL::GridSetOrigin(), GROUP_TOOL::Group(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::HighlightItem(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::HighlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PL_EDIT_TOOL::ImportDrawingSheetContent(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), EE_TOOL_BASE< T >::Init(), SCH_EDIT_TOOL::Init(), SYMBOL_EDITOR_CONTROL::Init(), SYMBOL_EDITOR_EDIT_TOOL::Init(), PL_DRAWING_TOOLS::Init(), PL_EDIT_TOOL::Init(), PL_POINT_EDITOR::Init(), ROUTER_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), BOARD_INSPECTION_TOOL::Init(), BOARD_REANNOTATE_TOOL::Init(), CONVERT_TOOL::Init(), DRAWING_TOOL::Init(), EDIT_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), GROUP_TOOL::Init(), PAD_TOOL::Init(), PCB_POINT_EDITOR::Init(), PCB_SELECTION_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), POSITION_RELATIVE_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isRouterActive(), TOOL_BASE::IsToolActive(), GROUP_TOOL::LeaveGroup(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), EDA_3D_CONTROLLER::Main(), CVPCB_CONTROL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), 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(), PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), 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(), 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(), 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 190 of file ee_tool_base.h.


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