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 }
 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 PlaceComponent (const TOOL_EVENT &aEvent)
 
int SingleClickPlace (const TOOL_EVENT &aEvent)
 
int TwoClickPlace (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)
 
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)
 
void sizeSheet (SCH_SHEET *aSheet, 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...
 

Private Attributes

std::vector< PICKED_SYMBOLm_symbolHistoryList
 
std::vector< PICKED_SYMBOLm_powerHistoryList
 
PINSHEETLABEL_SHAPE m_lastSheetPinType
 
PINSHEETLABEL_SHAPE m_lastGlobalLabelShape
 
LABEL_SPIN_STYLE m_lastTextOrientation
 
bool m_lastTextBold
 
bool m_lastTextItalic
 Re-entrancy guards. More...
 
bool m_inPlaceComponent
 
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 44 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.

Definition at line 78 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ SCH_DRAWING_TOOLS()

SCH_DRAWING_TOOLS::SCH_DRAWING_TOOLS ( )

Definition at line 55 of file sch_drawing_tools.cpp.

55  :
56  EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.InteractiveDrawing" ),
60  m_lastTextBold( false ),
61  m_lastTextItalic( false ),
62  m_inPlaceComponent( false ),
63  m_inPlaceImage( false ),
64  m_inSingleClickPlace( false ),
65  m_inTwoClickPlace( false ),
66  m_inDrawSheet( false )
67 {
68 }
PINSHEETLABEL_SHAPE m_lastGlobalLabelShape
bool m_lastTextItalic
Re-entrancy guards.
PINSHEETLABEL_SHAPE m_lastSheetPinType
LABEL_SPIN_STYLE m_lastTextOrientation

References LEFT, and PS_INPUT.

◆ ~SCH_DRAWING_TOOLS()

SCH_DRAWING_TOOLS::~SCH_DRAWING_TOOLS ( )
inlineoverride

Definition at line 48 of file sch_drawing_tools.h.

48 { }

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Run the tool.

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

Definition at line 51 of file tool_interactive.cpp.

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

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

Referenced by AUTOPLACE_TOOL::autoplace(), EDIT_TOOL::copyToClipboard(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCB_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), BOARD_INSPECTION_TOOL::HighlightNetTool(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), LIB_TREE::onContextMenu(), PCB_POINT_EDITOR::OnSelectionChange(), GROUP_TOOL::PickNewMember(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), PlaceComponent(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC_TOOL::ShowDRCDialog(), SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), 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 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215

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 791 of file sch_drawing_tools.cpp.

792 {
793  SCHEMATIC* schematic = getModel<SCHEMATIC>();
794  SCHEMATIC_SETTINGS& settings = schematic->Settings();
795  SCH_TEXT* textItem = nullptr;
796 
797  switch( aType )
798  {
799  case LAYER_NOTES:
800  textItem = new SCH_TEXT( (wxPoint) aPosition );
801  break;
802 
803  case LAYER_LOCLABEL:
804  textItem = new SCH_LABEL( (wxPoint) aPosition );
805  break;
806 
807  case LAYER_HIERLABEL:
808  textItem = new SCH_HIERLABEL( (wxPoint) aPosition );
809  textItem->SetShape( m_lastGlobalLabelShape );
810  break;
811 
812  case LAYER_GLOBLABEL:
813  textItem = new SCH_GLOBALLABEL( (wxPoint) aPosition );
814  textItem->SetShape( m_lastGlobalLabelShape );
815  break;
816 
817  default:
818  wxFAIL_MSG( "SCH_EDIT_FRAME::CreateNewText() unknown layer type" );
819  return nullptr;
820  }
821 
822  textItem->SetParent( schematic );
823  textItem->SetBold( m_lastTextBold );
824  textItem->SetItalic( m_lastTextItalic );
826  textItem->SetTextSize( wxSize( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) );
827  textItem->SetFlags( IS_NEW | IS_MOVED );
828 
829  DIALOG_LABEL_EDITOR dlg( m_frame, textItem );
830 
831  // Must be quasi modal for syntax help
832  if( dlg.ShowQuasiModal() != wxID_OK || NoPrintableChars( textItem->GetText() ) )
833  {
834  delete textItem;
835  return nullptr;
836  }
837 
838  m_lastTextBold = textItem->IsBold();
839  m_lastTextItalic = textItem->IsItalic();
841 
842  if( textItem->Type() == SCH_GLOBAL_LABEL_T || textItem->Type() == SCH_HIER_LABEL_T )
843  m_lastGlobalLabelShape = textItem->GetShape();
844 
845  return textItem;
846 }
bool IsBold() const
Definition: eda_text.h:190
void SetShape(PINSHEETLABEL_SHAPE aShape)
Definition: sch_text.h:237
PINSHEETLABEL_SHAPE m_lastGlobalLabelShape
Holds all the data relating to one schematic A schematic may consist of one or more sheets (and one r...
Definition: schematic.h:58
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:125
void SetItalic(bool isItalic)
Definition: eda_text.h:186
bool m_lastTextItalic
Re-entrancy guards.
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:244
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:165
bool IsItalic() const
Definition: eda_text.h:187
void SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:202
LABEL_SPIN_STYLE GetLabelSpinStyle() const
Definition: sch_text.h:233
#define IS_MOVED
Item being moved.
Definition: eda_item.h:105
These settings were stored in SCH_BASE_FRAME previously.
LABEL_SPIN_STYLE m_lastTextOrientation
virtual void SetLabelSpinStyle(LABEL_SPIN_STYLE aSpinStyle)
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
Definition: sch_text.cpp:248
bool NoPrintableChars(wxString aString)
Return true if the string is empty or contains only whitespace.
Definition: string.cpp:370
void SetBold(bool aBold)
Definition: eda_text.h:189
#define IS_NEW
New item, just created.
Definition: eda_item.h:106
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:133
PINSHEETLABEL_SHAPE GetShape() const
Definition: sch_text.h:235
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162

References SCH_TEXT::GetLabelSpinStyle(), SCH_TEXT::GetShape(), EDA_TEXT::GetText(), IS_MOVED, IS_NEW, EDA_TEXT::IsBold(), EDA_TEXT::IsItalic(), LAYER_GLOBLABEL, LAYER_HIERLABEL, LAYER_LOCLABEL, LAYER_NOTES, SCHEMATIC_SETTINGS::m_DefaultTextSize, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_lastGlobalLabelShape, m_lastTextBold, m_lastTextItalic, m_lastTextOrientation, NoPrintableChars(), SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, EDA_TEXT::SetBold(), EDA_ITEM::SetFlags(), EDA_TEXT::SetItalic(), SCH_TEXT::SetLabelSpinStyle(), EDA_ITEM::SetParent(), SCH_TEXT::SetShape(), EDA_TEXT::SetTextSize(), SCHEMATIC::Settings(), DIALOG_SHIM::ShowQuasiModal(), and EDA_ITEM::Type().

Referenced by TwoClickPlace().

◆ createSheetPin()

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

Definition at line 867 of file sch_drawing_tools.cpp.

868 {
869  SCHEMATIC_SETTINGS& settings = aSheet->Schematic()->Settings();
870  wxString text;
871  SCH_SHEET_PIN* sheetPin;
872 
873  if( aLabel )
874  {
875  text = aLabel->GetText();
876  m_lastSheetPinType = aLabel->GetShape();
877  }
878 
879  sheetPin = new SCH_SHEET_PIN( aSheet, wxPoint( 0, 0 ), text );
880  sheetPin->SetFlags( IS_NEW );
881  sheetPin->SetTextSize( wxSize( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) );
882  sheetPin->SetShape( m_lastSheetPinType );
883 
884  if( !aLabel )
885  {
886  DIALOG_SHEET_PIN_PROPERTIES dlg( m_frame, sheetPin );
887 
888  if( dlg.ShowModal() != wxID_OK || NoPrintableChars( sheetPin->GetText() ) )
889  {
890  delete sheetPin;
891  return nullptr;
892  }
893  }
894 
895  m_lastSheetPinType = sheetPin->GetShape();
896 
897  sheetPin->SetPosition( (wxPoint) getViewControls()->GetCursorPosition() );
898 
899  return sheetPin;
900 }
void SetShape(PINSHEETLABEL_SHAPE aShape)
Definition: sch_text.h:237
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:125
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:97
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:244
void SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:202
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:85
void SetPosition(const wxPoint &aPosition) override
Definition: sch_sheet.h:206
These settings were stored in SCH_BASE_FRAME previously.
PINSHEETLABEL_SHAPE m_lastSheetPinType
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
bool NoPrintableChars(wxString aString)
Return true if the string is empty or contains only whitespace.
Definition: string.cpp:370
#define IS_NEW
New item, just created.
Definition: eda_item.h:106
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:133
PINSHEETLABEL_SHAPE GetShape() const
Definition: sch_text.h:235

References SCH_TEXT::GetShape(), EDA_TEXT::GetText(), TOOL_BASE::getViewControls(), 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_TEXT::SetShape(), EDA_TEXT::SetTextSize(), and SCHEMATIC::Settings().

Referenced by SingleClickPlace(), and TwoClickPlace().

◆ DrawSheet()

int SCH_DRAWING_TOOLS::DrawSheet ( const TOOL_EVENT aEvent)

Definition at line 1148 of file sch_drawing_tools.cpp.

1149 {
1150  SCH_SHEET* sheet = nullptr;
1151 
1152  if( m_inDrawSheet )
1153  return 0;
1154  else
1155  m_inDrawSheet = true;
1156 
1158  getViewControls()->ShowCursor( true );
1159 
1160  std::string tool = aEvent.GetCommandStr().get();
1161  m_frame->PushTool( tool );
1162  Activate();
1163 
1164  // Prime the pump
1165  if( aEvent.HasPosition() )
1167 
1168  auto setCursor =
1169  [&]()
1170  {
1172  };
1173 
1174  // Set initial cursor
1175  setCursor();
1176 
1177  // Main loop: keep receiving events
1178  while( TOOL_EVENT* evt = Wait() )
1179  {
1180  setCursor();
1181 
1182  VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
1183 
1184  auto cleanup =
1185  [&] ()
1186  {
1188  m_view->ClearPreview();
1189  delete sheet;
1190  sheet = nullptr;
1191  };
1192 
1193  if( evt->IsCancelInteractive() )
1194  {
1195  if( sheet )
1196  {
1197  cleanup();
1198  }
1199  else
1200  {
1201  m_frame->PopTool( tool );
1202  break;
1203  }
1204  }
1205  else if( evt->IsActivate() )
1206  {
1207  if( sheet && evt->IsMoveTool() )
1208  {
1209  // we're already drawing our own item; ignore the move tool
1210  evt->SetPassEvent( false );
1211  continue;
1212  }
1213 
1214  if( sheet )
1215  cleanup();
1216 
1217  if( evt->IsPointEditor() )
1218  {
1219  // don't exit (the point editor runs in the background)
1220  }
1221  else if( evt->IsMoveTool() )
1222  {
1223  // leave ourselves on the stack so we come back after the move
1224  break;
1225  }
1226  else
1227  {
1228  m_frame->PopTool( tool );
1229  break;
1230  }
1231  }
1232  else if( !sheet && ( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) ) )
1233  {
1235 
1237 
1238  sheet = new SCH_SHEET( m_frame->GetCurrentSheet().Last(),
1239  static_cast<wxPoint>( cursorPos ) );
1240  sheet->SetFlags( IS_NEW | IS_RESIZED );
1241  sheet->SetScreen( NULL );
1245  sheet->GetFields()[ SHEETNAME ].SetText( "Untitled Sheet" );
1246  sheet->GetFields()[ SHEETFILENAME ].SetText( "untitled." + KiCadSchematicFileExtension );
1247  sizeSheet( sheet, cursorPos );
1248 
1249  m_view->ClearPreview();
1250  m_view->AddToPreview( sheet->Clone() );
1251  }
1252  else if( sheet && ( evt->IsClick( BUT_LEFT )
1253  || evt->IsDblClick( BUT_LEFT )
1254  || evt->IsAction( &EE_ACTIONS::finishSheet ) ) )
1255  {
1256  m_view->ClearPreview();
1257  getViewControls()->SetAutoPan( false );
1258  getViewControls()->CaptureCursor( false );
1259 
1260  if( m_frame->EditSheetProperties( static_cast<SCH_SHEET*>( sheet ),
1261  &m_frame->GetCurrentSheet(), nullptr ) )
1262  {
1263  sheet->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );
1264 
1265  m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), sheet, false );
1267  m_selectionTool->AddItemToSel( sheet );
1268  }
1269  else
1270  {
1271  delete sheet;
1272  }
1273 
1274  sheet = nullptr;
1275  }
1276  else if( sheet && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
1277  {
1278  sizeSheet( sheet, cursorPos );
1279  m_view->ClearPreview();
1280  m_view->AddToPreview( sheet->Clone() );
1281  }
1282  else if( evt->IsClick( BUT_RIGHT ) )
1283  {
1284  // Warp after context menu only if dragging...
1285  if( !sheet )
1287 
1289  }
1290  else
1291  {
1292  evt->SetPassEvent();
1293  }
1294 
1295  // Enable autopanning and cursor capture only when there is a sheet to be placed
1296  getViewControls()->SetAutoPan( sheet != nullptr );
1297  getViewControls()->CaptureCursor( sheet != nullptr );
1298  }
1299 
1301  m_inDrawSheet = false;
1302  return 0;
1303 }
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
static TOOL_ACTION finishSheet
Definition: ee_actions.h:95
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.
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
void AddToPreview(EDA_ITEM *aItem, bool aTakeOwnership=true)
Definition: view.cpp:1552
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
Definition: sch_sheet.cpp:154
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
#define IS_RESIZED
Item being resized.
Definition: eda_item.h:107
void SetCurrentCursor(KICURSOR cursor)
Set the current cursor shape for this panel.
void SetBorderWidth(int aWidth)
Definition: sch_sheet.h:291
EE_SELECTION & GetSelection()
Return the set of currently selected items.
EESCHEMA_SETTINGS * eeconfig() const
std::vector< SCH_FIELD > & GetFields()
Definition: sch_sheet.h:270
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SetBackgroundColor(KIGFX::COLOR4D aColor)
Definition: sch_sheet.h:297
void SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:202
#define NULL
virtual void PopTool(const std::string &actionName)
virtual void CaptureCursor(bool aEnabled)
Force the cursor to stay within the drawing panel area.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Generic, UI-independent tool event.
Definition: tool_event.h:173
void ClearPreview()
Definition: view.cpp:1530
void UpdateHierarchyNavigator(bool aForceUpdate=false)
Run the Hierarchy Navigator dialog.
void SetBorderColor(KIGFX::COLOR4D aColor)
Definition: sch_sheet.h:294
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:54
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:219
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:471
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_sheet.cpp:148
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.
int AddItemToSel(const TOOL_EVENT &aEvent)
void VetoContextMenuMouseWarp()
Disable mouse warping after the current context menu is closed.
Definition: tool_manager.h:428
const std::string KiCadSchematicFileExtension
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:465
void Activate()
Run the tool.
SCH_SHEET_PATH & GetCurrentSheet() const
bool HasPosition() const
Definition: tool_event.h:261
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Definition: sch_sheet.cpp:516
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
void ShowContextMenu(SELECTION &aSelection)
Helper function to set and immediately show a CONDITIONAL_MENU in concert with the given SELECTION.
Definition: tool_menu.cpp:59
#define IS_NEW
New item, just created.
Definition: eda_item.h:106
static TOOL_ACTION refreshPreview
Definition: actions.h:109
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
static TOOL_ACTION cursorClick
Definition: actions.h:126
void sizeSheet(SCH_SHEET *aSheet, VECTOR2I aPos)
Set up handlers for various events.

References TOOL_INTERACTIVE::Activate(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), EE_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(), ACTIONS::cursorClick, EESCHEMA_SETTINGS::DRAWING::default_line_thickness, EESCHEMA_SETTINGS::DRAWING::default_sheet_background_color, EESCHEMA_SETTINGS::DRAWING::default_sheet_border_color, SCH_EDIT_FRAME::EditSheetProperties(), SCH_BASE_FRAME::eeconfig(), EE_ACTIONS::finishSheet, SCH_BASE_FRAME::GetCanvas(), TOOL_EVENT::GetCommandStr(), SCH_EDIT_FRAME::GetCurrentSheet(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), SCH_SHEET::GetFields(), SCH_EDIT_FRAME::GetScreen(), EE_SELECTION_TOOL::GetSelection(), TOOL_BASE::getViewControls(), TOOL_EVENT::HasPosition(), IS_NEW, IS_RESIZED, 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, MD_ALT, NULL, PENCIL, TOOLS_HOLDER::PopTool(), TOOLS_HOLDER::PushTool(), ACTIONS::refreshPreview, TOOL_MANAGER::RunAction(), KIGFX::VIEW_CONTROLS::SetAutoPan(), SCH_SHEET::SetBackgroundColor(), SCH_SHEET::SetBorderColor(), SCH_SHEET::SetBorderWidth(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), EDA_ITEM::SetFlags(), SCH_SHEET::SetScreen(), SHEETFILENAME, SHEETNAME, TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), sizeSheet(), 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 siezure in the test framework
188  wxASSERT( dynamic_cast<T*>( getToolHolderInt() ) );
189 #endif
190  return static_cast<T*>( getToolHolderInt() );
191  }
TOOLS_HOLDER * getToolHolderInt() const
Definition: tool_base.cpp:48

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Return the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 121 of file tool_base.h.

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

References TOOL_BASE::m_toolId.

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

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

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

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

Definition at line 144 of file tool_base.h.

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

References TOOL_BASE::m_toolMgr.

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

◆ getModel()

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

Return the model object if it matches the requested type.

Store the type of the tool.

Definition at line 197 of file tool_base.h.

References TOOL_BASE::getModelInt().

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

◆ GetName()

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

Return the name of the tool.

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

Returns
The name of the tool.

Definition at line 134 of file tool_base.h.

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

References TOOL_BASE::m_toolName.

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

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Return the type of the tool.

Returns
The type of the tool.

Definition at line 109 of file tool_base.h.

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

References TOOL_BASE::m_type.

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

◆ getView()

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

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

It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

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

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

Referenced by EE_POINT_EDITOR::addCornerCondition(), ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), COMMON_TOOLS::CenterContents(), SCH_EDIT_TOOL::ChangeTextType(), EE_INSPECTION_TOOL::CheckSymbol(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::CollectHits(), SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint(), COMMON_TOOLS::CursorControl(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), COMMON_TOOLS::doZoomFit(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_EDITOR_CONTROL::FindComponentAndItem(), ROUTER_TOOL::getStartLayer(), PCB_CONTROL::GridResetOrigin(), PCB_CONTROL::GridSetOrigin(), ROUTER_TOOL::handleCommonEvents(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), PCB_SELECTION_TOOL::hitTestDistance(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), PL_EDIT_TOOL::moveItem(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), PL_EDIT_TOOL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PNS::TOOL_BASE::pickSingleItem(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), BOARD_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCB_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), PCB_SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), PCB_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::SelectAll(), PL_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), DRAWING_TOOL::SetAnchor(), SingleClickPlace(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), TwoClickPlace(), PL_SELECTION_TOOL::unhighlight(), EE_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), SCH_EDITOR_CONTROL::UpdateFind(), PL_POINT_EDITOR::updateItem(), PCB_POINT_EDITOR::updateItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updateParentItem(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), PCB_POINT_EDITOR::updatePoints(), PCB_SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), PCB_VIEWER_TOOLS::view(), PCB_TOOL_BASE::view(), PCB_SELECTION_TOOL::zoomFitSelection(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and PCB_SELECTION_TOOL::~PCB_SELECTION_TOOL().

◆ getViewControls()

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

Return the instance of VIEW_CONTROLS object used in the application.

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

Returns
The instance of VIEW_CONTROLS.

Definition at line 42 of file tool_base.cpp.

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

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

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

◆ Go()

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

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

No conditions means any event.

Definition at line 128 of file tool_interactive.h.

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

References TOOL_INTERACTIVE::goInternal().

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

◆ importHierLabel()

SCH_HIERLABEL * SCH_DRAWING_TOOLS::importHierLabel ( SCH_SHEET aSheet)
private

Definition at line 849 of file sch_drawing_tools.cpp.

850 {
851  if( !aSheet->GetScreen() )
852  return nullptr;
853 
854  for( EDA_ITEM* item : aSheet->GetScreen()->Items().OfType( SCH_HIER_LABEL_T ) )
855  {
856  SCH_HIERLABEL* label = static_cast<SCH_HIERLABEL*>( item );
857 
858  /* A global label has been found: check if there a corresponding sheet label. */
859  if( !aSheet->HasPin( label->GetText() ) )
860  return label;
861  }
862 
863  return nullptr;
864 }
EE_TYPE OfType(KICAD_T aType) const
Definition: sch_rtree.h:219
SCH_SCREEN * GetScreen() const
Definition: sch_sheet.h:285
EE_RTREE & Items()
Definition: sch_screen.h:162
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:149
bool HasPin(const wxString &aName) const
Checks if the sheet already has a sheet pin named aName.
Definition: sch_sheet.cpp:325
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:133

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

Referenced by SingleClickPlace(), and 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 71 of file sch_drawing_tools.cpp.

72 {
74 
75  auto belowRootSheetCondition =
76  [&]( const SELECTION& aSel )
77  {
78  return m_frame->GetCurrentSheet().Last() != &m_frame->Schematic().Root();
79  };
80 
81  CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
82  ctxMenu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 2 );
83 
84  return true;
85 }
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:46
static TOOL_ACTION leaveSheet
Definition: ee_actions.h:182
bool Init() override
Init() is called once upon a registration of the tool.
Definition: ee_tool_base.h:65
SCHEMATIC & Schematic() const
SCH_SHEET & Root() const
Definition: schematic.h:116
SCH_SHEET_PATH & GetCurrentSheet() const
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Add a menu entry to run a TOOL_ACTION on selected items.

References CONDITIONAL_MENU::AddItem(), 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 {
33  return m_toolMgr->IsToolActive( m_toolId );
34 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:210
bool IsToolActive(TOOL_ID aId) const
Return true if a tool with given id is active (executing)

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

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

◆ PlaceComponent()

int SCH_DRAWING_TOOLS::PlaceComponent ( const TOOL_EVENT aEvent)

Definition at line 88 of file sch_drawing_tools.cpp.

89 {
90  SCH_COMPONENT* component = aEvent.Parameter<SCH_COMPONENT*>();
91  SCHLIB_FILTER filter;
92  std::vector<PICKED_SYMBOL>* historyList = nullptr;
93 
94  if( m_inPlaceComponent )
95  return 0;
96  else
97  m_inPlaceComponent = true;
98 
99  if( aEvent.IsAction( &EE_ACTIONS::placeSymbol ) )
100  {
101  historyList = &m_symbolHistoryList;
102  }
103  else if (aEvent.IsAction( &EE_ACTIONS::placePower ) )
104  {
105  historyList = &m_powerHistoryList;
106  filter.FilterPowerParts( true );
107  }
108  else
109  {
110  wxFAIL_MSG( "PlaceCompontent(): unexpected request" );
111  }
112 
113  getViewControls()->ShowCursor( true );
114 
115  // If a component was passed in get it ready for placement.
116  if( component )
117  {
118  component->SetFlags( IS_NEW | IS_MOVED );
119 
121  m_selectionTool->AddItemToSel( component );
122  }
123 
124  std::string tool = aEvent.GetCommandStr().get();
125  m_frame->PushTool( tool );
126  Activate();
127 
128  // Prime the pump
129  if( component )
130  {
131  getViewControls()->WarpCursor( getViewControls()->GetMousePosition( false ) );
133  }
134  else if( !aEvent.IsReactivate() )
135  {
137  }
138 
139  auto setCursor =
140  [&]()
141  {
144  };
145 
146  // Set initial cursor
147  setCursor();
148 
149  // Main loop: keep receiving events
150  while( TOOL_EVENT* evt = Wait() )
151  {
152  setCursor();
153  VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
154 
155  auto cleanup =
156  [&] ()
157  {
159  m_view->ClearPreview();
160  delete component;
161  component = nullptr;
162  };
163 
164  if( evt->IsCancelInteractive() )
165  {
166  if( component )
167  {
168  cleanup();
169  }
170  else
171  {
172  m_frame->PopTool( tool );
173  break;
174  }
175  }
176  else if( evt->IsActivate() )
177  {
178  if( component && evt->IsMoveTool() )
179  {
180  // we're already moving our own item; ignore the move tool
181  evt->SetPassEvent( false );
182  continue;
183  }
184 
185  if( component )
186  cleanup();
187 
188  if( evt->IsMoveTool() )
189  {
190  // leave ourselves on the stack so we come back after the move
191  break;
192  }
193  else
194  {
195  m_frame->PopTool( tool );
196  break;
197  }
198  }
199  else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) )
200  {
201  if( !component )
202  {
204 
205  // Pick the footprint to be placed
206  bool footprintPreviews = m_frame->eeconfig()->m_Appearance.footprint_preview;
207  PICKED_SYMBOL sel = m_frame->PickSymbolFromLibTree( &filter, *historyList, true,
208  1, 1, footprintPreviews );
209 
210  // Restore cursor after dialog
211  getViewControls()->WarpCursor( getViewControls()->GetCursorPosition(), true );
212 
213  LIB_PART* part = sel.LibId.IsValid() ? m_frame->GetLibPart( sel.LibId ) : nullptr;
214 
215  if( !part )
216  continue;
217 
218  component = new SCH_COMPONENT( *part, &m_frame->GetCurrentSheet(), sel,
219  (wxPoint) cursorPos );
220  component->SetParent( m_frame->GetCurrentSheet().LastScreen() );
221  component->SetFlags( IS_NEW | IS_MOVED );
222 
224  component->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );
225 
226  m_frame->SaveCopyForRepeatItem( component );
227 
228  m_view->ClearPreview();
229  m_view->AddToPreview( component->Clone() );
230  m_selectionTool->AddItemToSel( component );
231 
232  // Update cursor now that we have a component
233  setCursor();
234  }
235  else
236  {
237  SCH_COMPONENT* next_comp = nullptr;
238 
239  m_view->ClearPreview();
240  m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), component, false );
241 
242  EE_SELECTION new_sel;
243  new_sel.Add( component );
244 
246  m_frame->OnModify();
247 
250  {
251  int new_unit = component->GetUnit();
252 
254  && component->GetUnit() < component->GetUnitCount() )
255  {
256  new_unit++;
257  }
258  else
259  {
260  new_unit = 1;
261  }
262 
263  // We are either stepping to the next unit or next component
264  if( m_frame->eeconfig()->m_SymChooserPanel.keep_symbol || new_unit > 1 )
265  {
266  // Deselect the last placed symbol: obviously we do not want to
267  // apply some changes (like rotation, mirror...) to previously placed
268  // symbols.
270 
271  next_comp = static_cast<SCH_COMPONENT*>( component->Duplicate() );
272  next_comp->SetFlags( IS_NEW | IS_MOVED );
273  next_comp->SetUnit( new_unit );
274  next_comp->SetUnitSelection( new_unit );
275 
277  component->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );
278 
279  m_frame->SaveCopyForRepeatItem( next_comp );
280  m_view->AddToPreview( next_comp->Clone() );
281  m_selectionTool->AddItemToSel( next_comp );
282  }
283  }
284 
285  component = next_comp;
286  }
287  }
288  else if( evt->IsClick( BUT_RIGHT ) )
289  {
290  // Warp after context menu only if dragging...
291  if( !component )
293 
295  }
296  else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CHOICE_MENU_CHOICE )
297  {
298  if( evt->GetCommandId().get() >= ID_POPUP_SCH_SELECT_UNIT_CMP
299  && evt->GetCommandId().get() <= ID_POPUP_SCH_SELECT_UNIT_CMP_MAX )
300  {
301  int unit = evt->GetCommandId().get() - ID_POPUP_SCH_SELECT_UNIT_CMP;
302 
303  if( component )
304  {
305  m_frame->SelectUnit( component, unit );
307  }
308  }
309  }
310  else if( component && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
311  {
312  component->SetPosition( (wxPoint)cursorPos );
313  m_view->ClearPreview();
314  m_view->AddToPreview( component->Clone() );
315  }
316  else
317  {
318  evt->SetPassEvent();
319  }
320 
321  // Enable autopanning and cursor capture only when there is a footprint to be placed
322  getViewControls()->SetAutoPan( component != nullptr );
323  getViewControls()->CaptureCursor( component != nullptr );
324  }
325 
327  m_inPlaceComponent = false;
328  return 0;
329 }
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
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 AddToPreview(EDA_ITEM *aItem, bool aTakeOwnership=true)
Definition: view.cpp:1552
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
int GetUnitCount() const
Return the number of units per package of the symbol.
Definition: sch_symbol.cpp:355
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
void SetPosition(const wxPoint &aPosition) override
Definition: sch_symbol.h:682
LIB_PART * GetLibPart(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
Load symbol from symbol library table.
bool IsValid() const
Check if this LID_ID is valid.
Definition: lib_id.h:168
PANEL_SYM_CHOOSER m_SymChooserPanel
std::vector< PICKED_SYMBOL > m_symbolHistoryList
void SetCurrentCursor(KICURSOR cursor)
Set the current cursor shape for this panel.
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:165
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:77
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:70
EE_SELECTION & GetSelection()
Return the set of currently selected items.
EESCHEMA_SETTINGS * eeconfig() const
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual void WarpCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
If enabled (.
int GetUnit() const
Definition: sch_symbol.h:237
AUTOPLACE_FIELDS m_AutoplaceFields
static TOOL_ACTION placePower
Definition: ee_actions.h:76
void SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:202
SCH_ITEM * Duplicate(bool doClone=false) const
Routine to create a new copy of given item.
Definition: sch_item.cpp:78
#define NULL
virtual void PopTool(const std::string &actionName)
virtual void CaptureCursor(bool aEnabled)
Force the cursor to stay within the drawing panel area.
PICKED_SYMBOL PickSymbolFromLibTree(const SCHLIB_FILTER *aFilter, std::vector< PICKED_SYMBOL > &aHistoryList, bool aUseLibBrowser, int aUnit, int aConvert, bool aShowFootprints, const LIB_ID *aHighlight=nullptr, bool aAllowFields=true)
Function PickSymbolFromLibTree Calls the library viewer to select component to import into schematic.
Definition: getpart.cpp:89
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:443
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_symbol.cpp:208
Generic, UI-independent tool event.
Definition: tool_event.h:173
void ClearPreview()
Definition: view.cpp:1530
Define a library symbol object.
Definition: lib_symbol.h:93
void SaveCopyForRepeatItem(SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
void SetUnit(int aUnit)
Change the unit number to aUnit.
Definition: sch_symbol.cpp:316
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:54
static TOOL_ACTION placeSymbol
Definition: ee_actions.h:75
static TOOL_ACTION addNeededJunctions
Definition: ee_actions.h:73
#define IS_MOVED
Item being moved.
Definition: eda_item.h:105
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
void SelectUnit(SCH_COMPONENT *aComponent, int aUnit)
Definition: getpart.cpp:198
std::vector< PICKED_SYMBOL > m_powerHistoryList
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:471
void SetUnitSelection(const SCH_SHEET_PATH *aSheet, int aUnitSelection)
Definition: sch_symbol.cpp:561
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.
int AddItemToSel(const TOOL_EVENT &aEvent)
SCH_SCREEN * LastScreen()
int ClearSelection(const TOOL_EVENT &aEvent)
Select all visible items in sheet.
void VetoContextMenuMouseWarp()
Disable mouse warping after the current context menu is closed.
Definition: tool_manager.h:428
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Automatically orient all the fields in the component.
Schematic symbol object.
Definition: sch_symbol.h:79
bool IsReactivate() const
Definition: tool_event.h:273
void Activate()
Run the tool.
SCH_SHEET_PATH & GetCurrentSheet() const
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
LIB_ID LibId
Definition: sch_screen.h:82
void ShowContextMenu(SELECTION &aSelection)
Helper function to set and immediately show a CONDITIONAL_MENU in concert with the given SELECTION.
Definition: tool_menu.cpp:59
#define IS_NEW
New item, just created.
Definition: eda_item.h:106
static TOOL_ACTION refreshPreview
Definition: actions.h:109
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
static TOOL_ACTION cursorClick
Definition: actions.h:126

References TOOL_INTERACTIVE::Activate(), SELECTION::Add(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), EE_SELECTION_TOOL::AddItemToSel(), EE_ACTIONS::addNeededJunctions, KIGFX::VIEW::AddToPreview(), ARROW, SCH_COMPONENT::AutoplaceFields(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), KIGFX::VIEW::ClearPreview(), EE_ACTIONS::clearSelection, EE_SELECTION_TOOL::ClearSelection(), SCH_COMPONENT::Clone(), COMPONENT, ACTIONS::cursorClick, SCH_ITEM::Duplicate(), SCH_BASE_FRAME::eeconfig(), EESCHEMA_SETTINGS::AUTOPLACE_FIELDS::enable, EESCHEMA_SETTINGS::APPEARANCE::footprint_preview, SCH_BASE_FRAME::GetCanvas(), TOOL_EVENT::GetCommandStr(), SCH_EDIT_FRAME::GetCurrentSheet(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), SCH_BASE_FRAME::GetLibPart(), SCH_EDIT_FRAME::GetScreen(), EE_SELECTION_TOOL::GetSelection(), SCH_COMPONENT::GetUnit(), SCH_COMPONENT::GetUnitCount(), TOOL_BASE::getViewControls(), ID_POPUP_SCH_SELECT_UNIT_CMP, ID_POPUP_SCH_SELECT_UNIT_CMP_MAX, IS_MOVED, 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_Appearance, EESCHEMA_SETTINGS::m_AutoplaceFields, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_inPlaceComponent, 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, MD_ALT, MOVING, NULL, SCH_EDIT_FRAME::OnModify(), TOOL_EVENT::Parameter(), SCH_BASE_FRAME::PickSymbolFromLibTree(), EESCHEMA_SETTINGS::PANEL_SYM_CHOOSER::place_all_units, EE_ACTIONS::placePower, EE_ACTIONS::placeSymbol, TOOLS_HOLDER::PopTool(), TOOLS_HOLDER::PushTool(), ACTIONS::refreshPreview, TOOL_MANAGER::RunAction(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), SCH_EDIT_FRAME::SelectUnit(), KIGFX::VIEW_CONTROLS::SetAutoPan(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), EDA_ITEM::SetFlags(), EDA_ITEM::SetParent(), SCH_COMPONENT::SetPosition(), SCH_COMPONENT::SetUnit(), SCH_COMPONENT::SetUnitSelection(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), TA_CHOICE_MENU_CHOICE, TC_COMMAND, TOOL_MANAGER::VetoContextMenuMouseWarp(), TOOL_INTERACTIVE::Wait(), and KIGFX::VIEW_CONTROLS::WarpCursor().

Referenced by setTransitions().

◆ PlaceImage()

int SCH_DRAWING_TOOLS::PlaceImage ( const TOOL_EVENT aEvent)

Definition at line 332 of file sch_drawing_tools.cpp.

333 {
334  SCH_BITMAP* image = aEvent.Parameter<SCH_BITMAP*>();
335  bool immediateMode = image;
336  VECTOR2I cursorPos = getViewControls()->GetCursorPosition();
337 
338  if( m_inPlaceImage )
339  return 0;
340  else
341  m_inPlaceImage = true;
342 
344  getViewControls()->ShowCursor( true );
345 
346  // Add all the drawable parts to preview
347  if( image )
348  {
349  image->SetPosition( (wxPoint)cursorPos );
350  m_view->ClearPreview();
351  m_view->AddToPreview( image->Clone() );
352  }
353 
354  std::string tool = aEvent.GetCommandStr().get();
355  m_frame->PushTool( tool );
356  Activate();
357 
358  // Prime the pump
359  if( image )
361  else if( !aEvent.IsReactivate() )
363 
364  auto setCursor =
365  [&]()
366  {
367  if( image )
369  else
371  };
372 
373  // Set initial cursor
374  setCursor();
375 
376  // Main loop: keep receiving events
377  while( TOOL_EVENT* evt = Wait() )
378  {
379  setCursor();
380  cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
381 
382  auto cleanup =
383  [&] ()
384  {
386  m_view->ClearPreview();
387  delete image;
388  image = nullptr;
389  };
390 
391  if( evt->IsCancelInteractive() )
392  {
393  if( image )
394  {
395  cleanup();
396  }
397  else
398  {
399  m_frame->PopTool( tool );
400  break;
401  }
402 
403  if( immediateMode )
404  {
405  m_frame->PopTool( tool );
406  break;
407  }
408  }
409  else if( evt->IsActivate() )
410  {
411  if( image && evt->IsMoveTool() )
412  {
413  // we're already moving our own item; ignore the move tool
414  evt->SetPassEvent( false );
415  continue;
416  }
417 
418  if( image )
419  cleanup();
420 
421  if( evt->IsMoveTool() )
422  {
423  // leave ourselves on the stack so we come back after the move
424  break;
425  }
426  else
427  {
428  m_frame->PopTool( tool );
429  break;
430  }
431  }
432  else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) )
433  {
434  if( !image )
435  {
437  wxFileDialog dlg( m_frame, _( "Choose Image" ), wxEmptyString, wxEmptyString,
438  _( "Image Files" ) + wxS( " " ) + wxImage::GetImageExtWildcard(),
439  wxFD_OPEN );
440 
441  if( dlg.ShowModal() != wxID_OK )
442  continue;
443 
444  // Restore cursor after dialog
445  getViewControls()->WarpCursor( getViewControls()->GetCursorPosition(), true );
446 
447  wxString fullFilename = dlg.GetPath();
448 
449  if( wxFileExists( fullFilename ) )
450  image = new SCH_BITMAP( (wxPoint)cursorPos );
451 
452  if( !image || !image->ReadImageFile( fullFilename ) )
453  {
454  wxMessageBox( _( "Couldn't load image from \"%s\"" ), fullFilename );
455  delete image;
456  image = nullptr;
457  continue;
458  }
459 
460  image->SetFlags( IS_NEW | IS_MOVED );
461 
462  m_frame->SaveCopyForRepeatItem( image );
463 
464  m_view->ClearPreview();
465  m_view->AddToPreview( image->Clone() );
466  m_view->RecacheAllItems(); // Bitmaps are cached in Opengl
467 
468  m_selectionTool->AddItemToSel( image );
469 
470  getViewControls()->SetCursorPosition( cursorPos, false );
471  setCursor();
472  }
473  else
474  {
476  image = nullptr;
478 
479  m_view->ClearPreview();
480 
481  if( immediateMode )
482  {
483  m_frame->PopTool( tool );
484  break;
485  }
486  }
487  }
488  else if( evt->IsClick( BUT_RIGHT ) )
489  {
490  // Warp after context menu only if dragging...
491  if( !image )
493 
495  }
496  else if( image && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
497  {
498  image->SetPosition( (wxPoint)cursorPos );
499  m_view->ClearPreview();
500  m_view->AddToPreview( image->Clone() );
501  m_view->RecacheAllItems(); // Bitmaps are cached in Opengl
502  }
503  else
504  {
505  evt->SetPassEvent();
506  }
507 
508  // Enable autopanning and cursor capture only when there is a footprint to be placed
509  getViewControls()->SetAutoPan( image != nullptr );
510  getViewControls()->CaptureCursor( image != nullptr );
511  }
512 
514  m_inPlaceImage = false;
515  return 0;
516 }
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
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.
static TOOL_ACTION activatePointEditor
Definition: actions.h:171
void AddToPreview(EDA_ITEM *aItem, bool aTakeOwnership=true)
Definition: view.cpp:1552
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void RecacheAllItems()
Rebuild GAL display lists.
Definition: view.cpp:1372
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
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.
void SetCurrentCursor(KICURSOR cursor)
Set the current cursor shape for this panel.
EE_SELECTION & GetSelection()
Return the set of currently selected items.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual void WarpCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
If enabled (.
void SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:202
virtual void PopTool(const std::string &actionName)
virtual void CaptureCursor(bool aEnabled)
Force the cursor to stay within the drawing panel area.
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:443
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Generic, UI-independent tool event.
Definition: tool_event.h:173
void ClearPreview()
Definition: view.cpp:1530
void SaveCopyForRepeatItem(SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:54
#define IS_MOVED
Item being moved.
Definition: eda_item.h:105
Object to handle a bitmap image that can be inserted in a schematic.
Definition: sch_bitmap.h:42
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:471
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.
int AddItemToSel(const TOOL_EVENT &aEvent)
#define _(s)
Definition: 3d_actions.cpp:33
void VetoContextMenuMouseWarp()
Disable mouse warping after the current context menu is closed.
Definition: tool_manager.h:428
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_bitmap.cpp:89
bool IsReactivate() const
Definition: tool_event.h:273
void Activate()
Run the tool.
bool ReadImageFile(const wxString &aFullFilename)
Reads and stores an image file.
Definition: sch_bitmap.cpp:83
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
void ShowContextMenu(SELECTION &aSelection)
Helper function to set and immediately show a CONDITIONAL_MENU in concert with the given SELECTION.
Definition: tool_menu.cpp:59
void SetPosition(const wxPoint &aPosition) override
Definition: sch_bitmap.h:141
#define IS_NEW
New item, just created.
Definition: eda_item.h:106
static TOOL_ACTION refreshPreview
Definition: actions.h:109
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
static TOOL_ACTION cursorClick
Definition: actions.h:126

References _, TOOL_INTERACTIVE::Activate(), ACTIONS::activatePointEditor, SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), EE_SELECTION_TOOL::AddItemToSel(), KIGFX::VIEW::AddToPreview(), ARROW, BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), KIGFX::VIEW::ClearPreview(), EE_ACTIONS::clearSelection, SCH_BITMAP::Clone(), ACTIONS::cursorClick, SCH_BASE_FRAME::GetCanvas(), TOOL_EVENT::GetCommandStr(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), SCH_EDIT_FRAME::GetScreen(), EE_SELECTION_TOOL::GetSelection(), TOOL_BASE::getViewControls(), IS_MOVED, IS_NEW, TOOL_EVENT::IsReactivate(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_inPlaceImage, TOOL_INTERACTIVE::m_menu, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_view, MD_ALT, MOVING, TOOL_EVENT::Parameter(), PENCIL, TOOLS_HOLDER::PopTool(), TOOLS_HOLDER::PushTool(), SCH_BITMAP::ReadImageFile(), 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_ITEM::SetFlags(), SCH_BITMAP::SetPosition(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), TOOL_MANAGER::VetoContextMenuMouseWarp(), TOOL_INTERACTIVE::Wait(), and KIGFX::VIEW_CONTROLS::WarpCursor().

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 85 of file ee_tool_base.h.

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

◆ RunMainStack()

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

Call a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 87 of file tool_interactive.cpp.

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

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

Referenced by DRAWING_TOOL::PlaceText().

◆ saveCopyInUndoList()

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

Definition at line 133 of file ee_tool_base.h.

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

◆ SetContextMenu()

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

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

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

Definition at line 76 of file tool_interactive.cpp.

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

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

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

◆ setTransitions()

void SCH_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 1319 of file sch_drawing_tools.cpp.

1320 {
1334 }
int TwoClickPlace(const TOOL_EVENT &aEvent)
int PlaceComponent(const TOOL_EVENT &aEvent)
static TOOL_ACTION placeHierLabel
Definition: ee_actions.h:85
static TOOL_ACTION placeJunction
Definition: ee_actions.h:81
static TOOL_ACTION placeBusWireEntry
Definition: ee_actions.h:82
static TOOL_ACTION importSingleSheetPin
Definition: ee_actions.h:185
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).
static TOOL_ACTION drawSheet
Definition: ee_actions.h:86
static TOOL_ACTION placePower
Definition: ee_actions.h:76
int SingleClickPlace(const TOOL_EVENT &aEvent)
static TOOL_ACTION placeSchematicText
Definition: ee_actions.h:88
static TOOL_ACTION placeImage
Definition: ee_actions.h:90
static TOOL_ACTION importSheetPin
Definition: ee_actions.h:87
static TOOL_ACTION placeSymbol
Definition: ee_actions.h:75
static TOOL_ACTION placeLabel
Definition: ee_actions.h:83
static TOOL_ACTION placeNoConnect
Definition: ee_actions.h:80
static TOOL_ACTION placeGlobalLabel
Definition: ee_actions.h:84
int DrawSheet(const TOOL_EVENT &aEvent)

References DrawSheet(), EE_ACTIONS::drawSheet, TOOL_INTERACTIVE::Go(), EE_ACTIONS::importSheetPin, EE_ACTIONS::importSingleSheetPin, EE_ACTIONS::placeBusWireEntry, PlaceComponent(), EE_ACTIONS::placeGlobalLabel, EE_ACTIONS::placeHierLabel, PlaceImage(), EE_ACTIONS::placeImage, EE_ACTIONS::placeJunction, EE_ACTIONS::placeLabel, EE_ACTIONS::placeNoConnect, EE_ACTIONS::placePower, EE_ACTIONS::placeSchematicText, EE_ACTIONS::placeSymbol, SingleClickPlace(), and TwoClickPlace().

◆ SingleClickPlace()

int SCH_DRAWING_TOOLS::SingleClickPlace ( const TOOL_EVENT aEvent)

Definition at line 519 of file sch_drawing_tools.cpp.

520 {
521  wxPoint cursorPos;
522  KICAD_T type = aEvent.Parameter<KICAD_T>();
523  EE_GRID_HELPER grid( m_toolMgr );
525  SCH_ITEM* previewItem;
526  bool loggedInfoBarError = false;
527 
529  return 0;
530 
531  if( type == SCH_JUNCTION_T && aEvent.HasPosition() )
532  {
533  EE_SELECTION& selection = m_selectionTool->GetSelection();
534  SCH_LINE* wire = dynamic_cast<SCH_LINE*>( selection.Front() );
535 
536  if( wire )
537  {
538  SEG seg( wire->GetStartPoint(), wire->GetEndPoint() );
539  VECTOR2I nearest = seg.NearestPoint( getViewControls()->GetCursorPosition() );
540  getViewControls()->SetCrossHairCursorPosition( nearest, false );
541  getViewControls()->WarpCursor( getViewControls()->GetCursorPosition(), true );
542  }
543  }
544 
545  switch( type )
546  {
547  case SCH_NO_CONNECT_T:
548  previewItem = new SCH_NO_CONNECT( cursorPos );
549  previewItem->SetParent( m_frame->GetScreen() );
550  break;
551 
552  case SCH_JUNCTION_T:
553  previewItem = new SCH_JUNCTION( cursorPos );
554  previewItem->SetParent( m_frame->GetScreen() );
555  break;
556 
558  previewItem = new SCH_BUS_WIRE_ENTRY( cursorPos );
559  previewItem->SetParent( m_frame->GetScreen() );
560  break;
561 
562  case SCH_SHEET_PIN_T:
563  {
564  EE_SELECTION& selection = m_selectionTool->GetSelection();
565  SCH_SHEET* sheet = dynamic_cast<SCH_SHEET*>( selection.Front() );
566 
567  if( !sheet )
568  return 0;
569 
570  SCH_HIERLABEL* label = importHierLabel( sheet );
571 
572  if( !label )
573  {
574  m_statusPopup.reset( new STATUS_TEXT_POPUP( m_frame ) );
575  m_statusPopup->SetText( _( "No new hierarchical labels found." ) );
576  m_statusPopup->Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
577  m_statusPopup->PopupFor( 2000 );
578  return 0;
579  }
580 
581  previewItem = createSheetPin( sheet, label );
582  }
583  break;
584 
585  default:
586  wxASSERT_MSG( false, "Unknown item type in SCH_DRAWING_TOOLS::SingleClickPlace" );
587  return 0;
588  }
589 
590  m_inSingleClickPlace = true;
591 
593  getViewControls()->ShowCursor( true );
594 
595  cursorPos = static_cast<wxPoint>( aEvent.HasPosition() ?
596  aEvent.Position() :
597  controls->GetMousePosition() );
598 
599  std::string tool = aEvent.GetCommandStr().get();
600  m_frame->PushTool( tool );
601  Activate();
602 
603  m_view->ClearPreview();
604  m_view->AddToPreview( previewItem->Clone() );
605 
606  // Prime the pump
607  if( aEvent.HasPosition() && type != SCH_SHEET_PIN_T )
609  else
611 
612  auto setCursor =
613  [&]()
614  {
616  };
617 
618  // Set initial cursor
619  setCursor();
620 
621  // Main loop: keep receiving events
622  while( TOOL_EVENT* evt = Wait() )
623  {
624  setCursor();
625  grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
626  grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->Modifier( MD_ALT ) );
627 
628  cursorPos = evt->IsPrime() ? (wxPoint) evt->Position()
629  : (wxPoint) controls->GetMousePosition();
630 
631  cursorPos = wxPoint( grid.BestSnapAnchor( cursorPos, LAYER_CONNECTABLE, nullptr ) );
632  controls->ForceCursorPosition( true, cursorPos );
633 
634  if( evt->IsCancelInteractive() )
635  {
636  m_frame->PopTool( tool );
637  break;
638  }
639  else if( evt->IsActivate() )
640  {
641  if( evt->IsMoveTool() )
642  {
643  // leave ourselves on the stack so we come back after the move
644  break;
645  }
646  else
647  {
648  m_frame->PopTool( tool );
649  break;
650  }
651  }
652  else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) )
653  {
654  if( !m_frame->GetScreen()->GetItem( cursorPos, 0, type ) )
655  {
656  if( type == SCH_JUNCTION_T )
657  {
658  if( !m_frame->GetScreen()->IsJunctionNeeded( cursorPos ) )
659  {
660  m_frame->ShowInfoBarError( _( "Junction location contains no joinable "
661  "wires and/or pins." ) );
662  loggedInfoBarError = true;
663  continue;
664  }
665  else if( loggedInfoBarError )
666  {
667  m_frame->GetInfoBar()->Dismiss();
668  }
669  }
670 
671  SCH_ITEM* newItem = static_cast<SCH_ITEM*>( previewItem->Clone() );
672  newItem->SetPosition( cursorPos );
673  newItem->SetFlags( IS_NEW );
674 
675  m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), newItem, false );
676 
677  if( type == SCH_JUNCTION_T )
679  else
681 
682  m_frame->OnModify();
683  }
684 
685  if( evt->IsDblClick( BUT_LEFT ) || type == SCH_SHEET_PIN_T ) // Finish tool.
686  {
687  m_frame->PopTool( tool );
688  break;
689  }
690  }
691  else if( evt->IsClick( BUT_RIGHT ) )
692  {
694  }
695  else if( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() )
696  {
697  previewItem->SetPosition( (wxPoint)cursorPos );
698  m_view->ClearPreview();
699  m_view->AddToPreview( previewItem->Clone() );
700  }
701  else if( evt->Category() == TC_COMMAND )
702  {
703  if( ( type == SCH_BUS_WIRE_ENTRY_T )
704  && ( evt->IsAction( &EE_ACTIONS::rotateCW )
705  || evt->IsAction( &EE_ACTIONS::rotateCCW )
706  || evt->IsAction( &EE_ACTIONS::mirrorV )
707  || evt->IsAction( &EE_ACTIONS::mirrorH ) ) )
708  {
709  SCH_BUS_ENTRY_BASE* busItem = static_cast<SCH_BUS_ENTRY_BASE*>( previewItem );
710 
711  // The bus entries only rotate in one direction
712  if( evt->IsAction( &EE_ACTIONS::rotateCW )
713  || evt->IsAction( &EE_ACTIONS::rotateCCW ) )
714  {
715  busItem->Rotate( busItem->GetPosition() );
716  }
717  else if( evt->IsAction( &EE_ACTIONS::mirrorV ) )
718  {
719  busItem->MirrorVertically( busItem->GetPosition().x );
720  }
721  else if( evt->IsAction( &EE_ACTIONS::mirrorH ) )
722  {
723  busItem->MirrorHorizontally( busItem->GetPosition().y );
724  }
725 
726  m_view->ClearPreview();
727  m_view->AddToPreview( previewItem->Clone() );
728  }
729  else if( evt->IsAction( &EE_ACTIONS::properties ) )
730  {
731  switch( type )
732  {
734  {
735  std::deque<SCH_ITEM*> strokeItems;
736  strokeItems.push_back( previewItem );
737 
738  DIALOG_EDIT_LINE_STYLE dlg( m_frame, strokeItems );
739 
740  if( dlg.ShowModal() == wxID_OK )
741  {
743  m_frame->OnModify();
744  }
745  }
746  break;
747 
748  case SCH_JUNCTION_T:
749  {
750  std::deque<SCH_JUNCTION*> junctions;
751  junctions.push_back( static_cast<SCH_JUNCTION*>( previewItem ) );
752 
753  DIALOG_JUNCTION_PROPS dlg( m_frame, junctions );
754 
755  if( dlg.ShowModal() == wxID_OK )
756  {
758  m_frame->OnModify();
759  }
760  }
761  break;
762  default:
763  // Do nothing
764  break;
765  }
766 
767  m_view->ClearPreview();
768  m_view->AddToPreview( previewItem->Clone() );
769  }
770  else
771  {
772  evt->SetPassEvent();
773  }
774  }
775  else
776  {
777  evt->SetPassEvent();
778  }
779  }
780 
781  delete previewItem;
782  m_view->ClearPreview();
783 
785  controls->ForceCursorPosition( false );
786  m_inSingleClickPlace = false;
787  return 0;
788 }
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
static TOOL_ACTION properties
Definition: ee_actions.h:118
bool SchematicCleanUp(SCH_SCREEN *aScreen=nullptr)
Performs routine schematic cleaning including breaking wire and buses and deleting identical objects ...
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Suspend execution of the tool until an event specified in aEventList arrives.
virtual VECTOR2D GetMousePosition(bool aWorldCoordinates=true) const =0
Return the current mouse pointer position.
SCH_SHEET_PIN * createSheetPin(SCH_SHEET *aSheet, SCH_HIERLABEL *aLabel)
wxPoint GetStartPoint() const
Definition: sch_line.h:94
virtual void SetPosition(const wxPoint &aPos)
Definition: eda_item.h:302
bool IsJunctionNeeded(const wxPoint &aPosition, bool aNew=false)
Test if a junction is required for the items at aPosition on the screen.
Definition: sch_screen.cpp:369
void AddToPreview(EDA_ITEM *aItem, bool aTakeOwnership=true)
Definition: view.cpp:1552
Extension of STATUS_POPUP for displaying a single line text.
Definition: status_popup.h:79
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
void Rotate(wxPoint aPosition) override
Rotate the item around aPosition 90 degrees in the clockwise direction.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
static TOOL_ACTION mirrorH
Definition: ee_actions.h:117
void SetCurrentCursor(KICURSOR cursor)
Set the current cursor shape for this panel.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
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
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:165
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:97
static TOOL_ACTION mirrorV
Definition: ee_actions.h:116
static TOOL_ACTION rotateCW
Definition: ee_actions.h:114
Base class for a bus or wire entry.
Definition: sch_bus_entry.h:42
EE_SELECTION & GetSelection()
Return the set of currently selected items.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual void WarpCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
If enabled (.
static TOOL_ACTION rotateCCW
Definition: ee_actions.h:115
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: infobar.cpp:166
void SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:202
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
virtual void PopTool(const std::string &actionName)
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:443
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Generic, UI-independent tool event.
Definition: tool_event.h:173
void ClearPreview()
Definition: view.cpp:1530
An interface for classes handling user events controlling the view behavior such as zooming,...
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Place the cursor immediately at a given point.
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:54
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Move the graphic crosshair cursor to the requested position expressed in world coordinates.
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:219
Definition: seg.h:41
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:471
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.
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
SCH_HIERLABEL * importHierLabel(SCH_SHEET *aSheet)
#define _(s)
Definition: 3d_actions.cpp:33
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
Class for a wire to bus entry.
void Activate()
Run the tool.
WX_INFOBAR * GetInfoBar()
SCH_ITEM * GetItem(const wxPoint &aPosition, int aAccuracy=0, KICAD_T aType=SCH_LOCATE_ANY_T)
Check aPosition within a distance of aAccuracy for items of type aFilter.
Definition: sch_screen.cpp:308
bool HasPosition() const
Definition: tool_event.h:261
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
Definition: tool_manager.h:267
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:196
void ShowContextMenu(SELECTION &aSelection)
Helper function to set and immediately show a CONDITIONAL_MENU in concert with the given SELECTION.
Definition: tool_menu.cpp:59
#define IS_NEW
New item, just created.
Definition: eda_item.h:106
const VECTOR2D Position() const
Returns the point where dragging has started.
Definition: tool_event.h:284
static TOOL_ACTION refreshPreview
Definition: actions.h:109
EDA_ITEM * Front() const
Definition: selection.h:203
static TOOL_ACTION cursorClick
Definition: actions.h:126
wxPoint GetPosition() const override
wxPoint GetEndPoint() const
Definition: sch_line.h:97
std::unique_ptr< STATUS_TEXT_POPUP > m_statusPopup

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(), createSheetPin(), ACTIONS::cursorClick, WX_INFOBAR::Dismiss(), KIGFX::VIEW_CONTROLS::ForceCursorPosition(), SELECTION::Front(), SCH_BASE_FRAME::GetCanvas(), TOOL_EVENT::GetCommandStr(), 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(), TOOL_EVENT::HasPosition(), importHierLabel(), IS_NEW, SCH_SCREEN::IsJunctionNeeded(), LAYER_CONNECTABLE, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_inSingleClickPlace, 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, MD_ALT, MD_SHIFT, EE_ACTIONS::mirrorH, SCH_BUS_ENTRY_BASE::MirrorHorizontally(), EE_ACTIONS::mirrorV, SCH_BUS_ENTRY_BASE::MirrorVertically(), SCH_EDIT_FRAME::OnModify(), TOOL_EVENT::Parameter(), PLACE, TOOLS_HOLDER::PopTool(), TOOL_EVENT::Position(), TOOL_MANAGER::PostEvent(), 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_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(), and KIGFX::VIEW_CONTROLS::WarpCursor().

Referenced by setTransitions().

◆ sizeSheet()

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

Set up handlers for various events.

Definition at line 1306 of file sch_drawing_tools.cpp.

1307 {
1308  wxPoint pos = aSheet->GetPosition();
1309  wxPoint size = (wxPoint) aPos - pos;
1310 
1311  size.x = std::max( size.x, MIN_SHEET_WIDTH );
1312  size.y = std::max( size.y, MIN_SHEET_HEIGHT );
1313 
1314  wxPoint grid = m_frame->GetNearestGridPosition( pos + size );
1315  aSheet->Resize( wxSize( grid.x - pos.x, grid.y - pos.y ) );
1316 }
wxPoint GetNearestGridPosition(const wxPoint &aPosition) const
Return the nearest aGridSize location to aPosition.
#define MIN_SHEET_WIDTH
Definition: sch_sheet.h:43
wxPoint GetPosition() const override
Definition: sch_sheet.h:572
#define MIN_SHEET_HEIGHT
Definition: sch_sheet.h:44
void Resize(const wxSize &aSize)
Resize this sheet to aSize and adjust all of the labels accordingly.
Definition: sch_sheet.cpp:792

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

Referenced by DrawSheet().

◆ TwoClickPlace()

int SCH_DRAWING_TOOLS::TwoClickPlace ( const TOOL_EVENT aEvent)

Definition at line 903 of file sch_drawing_tools.cpp.

904 {
905  SCH_ITEM* item = nullptr;
907  EE_GRID_HELPER grid( m_toolMgr );
908  if( m_inTwoClickPlace )
909  return 0;
910  else
911  m_inTwoClickPlace = true;
912 
913  bool isText = aEvent.IsAction( &EE_ACTIONS::placeSchematicText );
914  bool isGlobalLabel = aEvent.IsAction( &EE_ACTIONS::placeGlobalLabel );
915  bool isHierLabel = aEvent.IsAction( &EE_ACTIONS::placeHierLabel );
916  bool isNetLabel = aEvent.IsAction( &EE_ACTIONS::placeLabel );
917  bool isSheetPin = aEvent.IsAction( &EE_ACTIONS::importSheetPin );
918  int snapLayer = isText ? LAYER_GRAPHICS : LAYER_CONNECTABLE;
919 
921  controls->ShowCursor( true );
922 
923  std::string tool = aEvent.GetCommandStr().get();
924  m_frame->PushTool( tool );
925  Activate();
926 
927  // Prime the pump
928  // If the tool isn't being re-activated
929  if( aEvent.HasPosition() || ( !aEvent.IsReactivate()
930  && ( isText || isGlobalLabel || isHierLabel || isNetLabel ) ) )
931  {
933  }
934 
935  auto setCursor =
936  [&]()
937  {
938  if( item )
940  else if( isText )
942  else if( isGlobalLabel )
944  else if( isNetLabel )
946  else if( isHierLabel )
948  else
950  };
951 
952  // Set initial cursor
953  setCursor();
954 
955  // Main loop: keep receiving events
956  while( TOOL_EVENT* evt = Wait() )
957  {
958  setCursor();
959  grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
960  grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->Modifier( MD_ALT ) );
961 
962  VECTOR2I cursorPos = evt->IsPrime() ? evt->Position() : controls->GetMousePosition();
963  cursorPos = grid.BestSnapAnchor( cursorPos, snapLayer, item );
964  controls->ForceCursorPosition( true, cursorPos );
965 
966  auto cleanup =
967  [&] ()
968  {
970  m_view->ClearPreview();
971  delete item;
972  item = nullptr;
973  };
974 
975  if( evt->IsCancelInteractive() )
976  {
977  if( item )
978  {
979  cleanup();
980  }
981  else
982  {
983  m_frame->PopTool( tool );
984  break;
985  }
986  }
987  else if( evt->IsActivate() )
988  {
989  if( item && evt->IsMoveTool() )
990  {
991  // we're already moving our own item; ignore the move tool
992  evt->SetPassEvent( false );
993  continue;
994  }
995 
996  if( item )
997  cleanup();
998 
999  if( evt->IsPointEditor() )
1000  {
1001  // don't exit (the point editor runs in the background)
1002  }
1003  else if( evt->IsMoveTool() )
1004  {
1005  break;
1006  }
1007  else
1008  {
1009  m_frame->PopTool( tool );
1010  break;
1011  }
1012  }
1013  else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) )
1014  {
1015  // First click creates...
1016  if( !item )
1017  {
1019 
1020  if( isText )
1021  {
1022  item = createNewText( cursorPos, LAYER_NOTES );
1023  }
1024  else if( isGlobalLabel )
1025  {
1026  item = createNewText( cursorPos, LAYER_GLOBLABEL );
1027  }
1028  else if( isHierLabel )
1029  {
1030  item = createNewText( cursorPos, LAYER_HIERLABEL );
1031  }
1032  else if( isNetLabel )
1033  {
1034  item = createNewText( cursorPos, LAYER_LOCLABEL );
1035  }
1036  else if( isSheetPin )
1037  {
1038  EDA_ITEM* i;
1039  SCH_HIERLABEL* label = nullptr;
1040  SCH_SHEET* sheet = nullptr;
1041 
1042  if( m_selectionTool->SelectPoint( cursorPos, EE_COLLECTOR::SheetsOnly, &i ) )
1043  sheet = dynamic_cast<SCH_SHEET*>( i );
1044 
1045  if( !sheet )
1046  {
1047  m_statusPopup.reset( new STATUS_TEXT_POPUP( m_frame ) );
1048  m_statusPopup->SetText( _( "Click over a sheet." ) );
1049  m_statusPopup->Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
1050  m_statusPopup->PopupFor( 2000 );
1051  item = nullptr;
1052  }
1053  else
1054  {
1055  label = importHierLabel( sheet );
1056 
1057  if( !label )
1058  {
1059  m_statusPopup.reset( new STATUS_TEXT_POPUP( m_frame ) );
1060  m_statusPopup->SetText( _( "No new hierarchical labels found." ) );
1061  m_statusPopup->Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
1062  m_statusPopup->PopupFor( 2000 );
1063  item = nullptr;
1064  }
1065  else
1066  {
1067  item = createSheetPin( sheet, label );
1068  }
1069  }
1070  }
1071 
1072  // Restore cursor after dialog
1073  controls->WarpCursor( controls->GetCursorPosition(), true );
1074 
1075  if( item )
1076  {
1077  item->SetFlags( IS_NEW | IS_MOVED );
1078  m_view->ClearPreview();
1079  m_view->AddToPreview( item->Clone() );
1080  m_selectionTool->AddItemToSel( item );
1081 
1082  // update the cursor so it looks correct before another event
1083  setCursor();
1084  }
1085 
1086  controls->SetCursorPosition( cursorPos, false );
1087  }
1088 
1089  // ... and second click places:
1090  else
1091  {
1092  item->ClearFlags( IS_MOVED );
1093  item->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
1094 
1096  item = nullptr;
1097 
1098  m_view->ClearPreview();
1099  }
1100  }
1101  else if( evt->IsClick( BUT_RIGHT ) )
1102  {
1103  // Warp after context menu only if dragging...
1104  if( !item )
1106 
1108  }
1109  else if( item && evt->IsSelectionEvent() )
1110  {
1111  // This happens if our text was replaced out from under us by ConvertTextType()
1112  EE_SELECTION& selection = m_selectionTool->GetSelection();
1113 
1114  if( selection.GetSize() == 1 )
1115  {
1116  item = (SCH_ITEM*) selection.Front();
1117  m_view->ClearPreview();
1118  m_view->AddToPreview( item->Clone() );
1119  }
1120  else
1121  {
1122  item = nullptr;
1123  }
1124  }
1125  else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
1126  {
1127  static_cast<SCH_ITEM*>( item )->SetPosition( (wxPoint) cursorPos );
1128  m_view->ClearPreview();
1129  m_view->AddToPreview( item->Clone() );
1130  }
1131  else
1132  {
1133  evt->SetPassEvent();
1134  }
1135 
1136  // Enable autopanning and cursor capture only when there is a footprint to be placed
1137  controls->SetAutoPan( item != nullptr );
1138  controls->CaptureCursor( item != nullptr );
1139  }
1140 
1142  controls->ForceCursorPosition( false );
1143  m_inTwoClickPlace = false;
1144  return 0;
1145 }
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
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.
virtual VECTOR2D GetMousePosition(bool aWorldCoordinates=true) const =0
Return the current mouse pointer position.
SCH_SHEET_PIN * createSheetPin(SCH_SHEET *aSheet, SCH_HIERLABEL *aLabel)
virtual void SetPosition(const wxPoint &aPos)
Definition: eda_item.h:302
void AddToPreview(EDA_ITEM *aItem, bool aTakeOwnership=true)
Definition: view.cpp:1552
Extension of STATUS_POPUP for displaying a single line text.
Definition: status_popup.h:79
static TOOL_ACTION placeHierLabel
Definition: ee_actions.h:85
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
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.
static const KICAD_T SheetsOnly[]
Definition: ee_collectors.h:49
void SetCurrentCursor(KICURSOR cursor)
Set the current cursor shape for this panel.
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:97
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:70
EE_SELECTION & GetSelection()
Return the set of currently selected items.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual void WarpCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
If enabled (.
void SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:202
virtual void PopTool(const std::string &actionName)
virtual void CaptureCursor(bool aEnabled)
Force the cursor to stay within the drawing panel area.
virtual void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual)
Definition: sch_item.h:466
static TOOL_ACTION placeSchematicText
Definition: ee_actions.h:88
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Generic, UI-independent tool event.
Definition: tool_event.h:173
void ClearPreview()
Definition: view.cpp:1530
An interface for classes handling user events controlling the view behavior such as zooming,...
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:176
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Place the cursor immediately at a given point.
static TOOL_ACTION importSheetPin
Definition: ee_actions.h:87
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:54
#define IS_MOVED
Item being moved.
Definition: eda_item.h:105
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:219
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:101
static TOOL_ACTION placeLabel
Definition: ee_actions.h:83
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:471
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.
int AddItemToSel(const TOOL_EVENT &aEvent)
bool SelectPoint(const VECTOR2I &aWhere, const KICAD_T *aFilterList=EE_COLLECTOR::AllItems, EDA_ITEM **aItem=nullptr, bool *aSelectionCancelledFlag=nullptr, bool aCheckLocked=false, bool aAdd=false, bool aSubtract=false, bool aExclusiveOr=false)
This overload of SelectPoint will create an EE_COLLECTOR and collect hits at location aWhere before c...
SCH_HIERLABEL * importHierLabel(SCH_SHEET *aSheet)
#define _(s)
Definition: 3d_actions.cpp:33
void VetoContextMenuMouseWarp()
Disable mouse warping after the current context menu is closed.
Definition: tool_manager.h:428
SCH_TEXT * createNewText(const VECTOR2I &aPosition, int aType)
Get the next queued text item.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:149
bool IsReactivate() const
Definition: tool_event.h:273
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:203
void Activate()
Run the tool.
bool HasPosition() const
Definition: tool_event.h:261
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
static TOOL_ACTION placeGlobalLabel
Definition: ee_actions.h:84
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:196
void ShowContextMenu(SELECTION &aSelection)
Helper function to set and immediately show a CONDITIONAL_MENU in concert with the given SELECTION.
Definition: tool_menu.cpp:59
#define IS_NEW
New item, just created.
Definition: eda_item.h:106
static TOOL_ACTION refreshPreview
Definition: actions.h:109
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
EDA_ITEM * Front() const
Definition: selection.h:203
static TOOL_ACTION cursorClick
Definition: actions.h:126
std::unique_ptr< STATUS_TEXT_POPUP > m_statusPopup

References _, TOOL_INTERACTIVE::Activate(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), EE_SELECTION_TOOL::AddItemToSel(), KIGFX::VIEW::AddToPreview(), ARROW, SCH_ITEM::AutoplaceFields(), EE_GRID_HELPER::BestSnapAnchor(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), EDA_ITEM::ClearFlags(), KIGFX::VIEW::ClearPreview(), EE_ACTIONS::clearSelection, EDA_ITEM::Clone(), createNewText(), createSheetPin(), ACTIONS::cursorClick, KIGFX::VIEW_CONTROLS::ForceCursorPosition(), SELECTION::Front(), SCH_BASE_FRAME::GetCanvas(), TOOL_EVENT::GetCommandStr(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), KIGFX::VIEW_CONTROLS::GetMousePosition(), SCH_EDIT_FRAME::GetScreen(), EE_SELECTION_TOOL::GetSelection(), SELECTION::GetSize(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_EVENT::HasPosition(), importHierLabel(), EE_ACTIONS::importSheetPin, IS_MOVED, IS_NEW, TOOL_EVENT::IsAction(), TOOL_EVENT::IsReactivate(), LABEL_GLOBAL, LABEL_HIER, LABEL_NET, LAYER_CONNECTABLE, LAYER_GLOBLABEL, LAYER_GRAPHICS, LAYER_HIERLABEL, LAYER_LOCLABEL, LAYER_NOTES, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_inTwoClickPlace, 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, MD_ALT, MD_SHIFT, PENCIL, PLACE, EE_ACTIONS::placeGlobalLabel, EE_ACTIONS::placeHierLabel, EE_ACTIONS::placeLabel, EE_ACTIONS::placeSchematicText, TOOLS_HOLDER::PopTool(), TOOLS_HOLDER::PushTool(), ACTIONS::refreshPreview, TOOL_MANAGER::RunAction(), EE_SELECTION_TOOL::SelectPoint(), KIGFX::VIEW_CONTROLS::SetAutoPan(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), KIGFX::VIEW_CONTROLS::SetCursorPosition(), EDA_ITEM::SetFlags(), EDA_ITEM::SetPosition(), GRID_HELPER::SetSnap(), GRID_HELPER::SetUseGrid(), EE_COLLECTOR::SheetsOnly, TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), TEXT, TOOL_MANAGER::VetoContextMenuMouseWarp(), TOOL_INTERACTIVE::Wait(), and KIGFX::VIEW_CONTROLS::WarpCursor().

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 102 of file ee_tool_base.h.

◆ Wait()

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

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

No parameters means waiting for any event.

Definition at line 57 of file tool_interactive.cpp.

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

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

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PL_POINT_EDITOR::Main(), CVPCB_CONTROL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), EDA_3D_CONTROLLER::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), PCB_POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), PlaceComponent(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), PCB_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), 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 174 of file ee_tool_base.h.

◆ m_inDrawSheet

bool SCH_DRAWING_TOOLS::m_inDrawSheet
private

Definition at line 90 of file sch_drawing_tools.h.

Referenced by DrawSheet().

◆ m_inPlaceComponent

bool SCH_DRAWING_TOOLS::m_inPlaceComponent
private

Definition at line 86 of file sch_drawing_tools.h.

Referenced by PlaceComponent().

◆ m_inPlaceImage

bool SCH_DRAWING_TOOLS::m_inPlaceImage
private

Definition at line 87 of file sch_drawing_tools.h.

Referenced by PlaceImage().

◆ m_inSingleClickPlace

bool SCH_DRAWING_TOOLS::m_inSingleClickPlace
private

Definition at line 88 of file sch_drawing_tools.h.

Referenced by SingleClickPlace().

◆ m_inTwoClickPlace

bool SCH_DRAWING_TOOLS::m_inTwoClickPlace
private

Definition at line 89 of file sch_drawing_tools.h.

Referenced by TwoClickPlace().

◆ m_isSymbolEditor

bool EE_TOOL_BASE< SCH_EDIT_FRAME >::m_isSymbolEditor
protectedinherited

Definition at line 177 of file ee_tool_base.h.

◆ m_lastGlobalLabelShape

PINSHEETLABEL_SHAPE SCH_DRAWING_TOOLS::m_lastGlobalLabelShape
private

Definition at line 80 of file sch_drawing_tools.h.

Referenced by createNewText().

◆ m_lastSheetPinType

PINSHEETLABEL_SHAPE SCH_DRAWING_TOOLS::m_lastSheetPinType
private

Definition at line 79 of file sch_drawing_tools.h.

Referenced by createSheetPin().

◆ m_lastTextBold

bool SCH_DRAWING_TOOLS::m_lastTextBold
private

Definition at line 82 of file sch_drawing_tools.h.

Referenced by createNewText().

◆ m_lastTextItalic

bool SCH_DRAWING_TOOLS::m_lastTextItalic
private

Re-entrancy guards.

Definition at line 83 of file sch_drawing_tools.h.

Referenced by createNewText().

◆ m_lastTextOrientation

LABEL_SPIN_STYLE SCH_DRAWING_TOOLS::m_lastTextOrientation
private

Definition at line 81 of file sch_drawing_tools.h.

Referenced by createNewText().

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

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

Definition at line 106 of file tool_interactive.h.

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

◆ m_powerHistoryList

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

Definition at line 77 of file sch_drawing_tools.h.

Referenced by PlaceComponent().

◆ m_selectionTool

EE_SELECTION_TOOL* EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool
protectedinherited

Definition at line 176 of file ee_tool_base.h.

◆ m_statusPopup

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

Definition at line 92 of file sch_drawing_tools.h.

Referenced by SingleClickPlace(), and TwoClickPlace().

◆ m_symbolHistoryList

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

Definition at line 76 of file sch_drawing_tools.h.

Referenced by PlaceComponent().

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Name of the tool.

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

Definition at line 210 of file tool_base.h.

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

◆ m_toolMgr

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 215 of file tool_base.h.

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

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Definition at line 214 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

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

Definition at line 207 of file tool_base.h.

Referenced by TOOL_BASE::GetType(), and BOARD_COMMIT::Push().

◆ m_view

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

Definition at line 175 of file ee_tool_base.h.


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