KiCad PCB EDA Suite
LIB_DRAWING_TOOLS Class Reference

Class LIB_DRAWING_TOOLS. More...

#include <lib_drawing_tools.h>

Inheritance diagram for LIB_DRAWING_TOOLS:
EE_TOOL_BASE< LIB_EDIT_FRAME > TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 

Determines the reason of reset for a tool

More...
 

Public Member Functions

 LIB_DRAWING_TOOLS ()
 
 ~LIB_DRAWING_TOOLS ()
 
bool Init () override
 Function Init() Init() is called once upon a registration of the tool. More...
 
int PlacePin (const TOOL_EVENT &aEvent)
 
int PlaceText (const TOOL_EVENT &aEvent)
 
int DrawShape (const TOOL_EVENT &aEvent)
 
int PlaceAnchor (const TOOL_EVENT &aEvent)
 
int RepeatDrawItem (const TOOL_EVENT &aEvent)
 
void Reset (RESET_REASON aReason) override
 Function Reset() Brings the tool to a known, initial state. More...
 
TOOL_MENUGetToolMenu ()
 

Get the tool's top-level context menu

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

Protected Member Functions

void updateView (EDA_ITEM *aItem) const
 

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

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

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

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

Protected Attributes

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

Stores the type of the tool.

More...
 
TOOL_ID m_toolId
 

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

More...
 
std::string m_toolName
 

Name of the tool.

More...
 
TOOL_MANAGERm_toolMgr
 
TOOL_SETTINGS m_toolSettings
 

Private Member Functions

int doTwoClickPlace (KICAD_T aType)
 
void setTransitions () override
 

Sets up handlers for various events.

More...
 

Detailed Description

Class LIB_DRAWING_TOOLS.

Tool responsible for drawing/placing items (body outlines, pins, etc.)

Definition at line 39 of file lib_drawing_tools.h.

Member Enumeration Documentation

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determines the reason of reset for a tool

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 80 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ LIB_DRAWING_TOOLS()

LIB_DRAWING_TOOLS::LIB_DRAWING_TOOLS ( )

Definition at line 93 of file lib_drawing_tools.cpp.

93  :
94  EE_TOOL_BASE<LIB_EDIT_FRAME>( "libedit.InteractiveDrawing" )
95 {
96 }

◆ ~LIB_DRAWING_TOOLS()

LIB_DRAWING_TOOLS::~LIB_DRAWING_TOOLS ( )

Definition at line 99 of file lib_drawing_tools.cpp.

100 {
101 }

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Function Activate() Runs the tool.

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

Definition at line 49 of file tool_interactive.cpp.

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

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

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

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Function attachManager()

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

Definition at line 59 of file tool_base.cpp.

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

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

Referenced by TOOL_MANAGER::RegisterTool().

◆ doTwoClickPlace()

int LIB_DRAWING_TOOLS::doTwoClickPlace ( KICAD_T  aType)
private

Definition at line 133 of file lib_drawing_tools.cpp.

134 {
135  LIB_PIN_TOOL* pinTool = aType == LIB_PIN_T ? m_toolMgr->GetTool<LIB_PIN_TOOL>() : nullptr;
136  VECTOR2I cursorPos;
137  EDA_ITEM* item = nullptr;
138 
140  getViewControls()->ShowCursor( true );
141 
142  Activate();
143 
144  // Main loop: keep receiving events
145  while( OPT_TOOL_EVENT evt = Wait() )
146  {
147  cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
148 
149  if( TOOL_EVT_UTILS::IsCancelInteractive( evt.get() ) )
150  {
151  if( item )
152  {
154  m_view->ClearPreview();
155  delete item;
156  item = nullptr;
157 
158  if( !evt->IsActivate() )
159  continue;
160  }
161 
162  break;
163  }
164 
165  else if( evt->IsClick( BUT_LEFT ) )
166  {
167  LIB_PART* part = m_frame->GetCurPart();
168 
169  if( !part )
170  continue;
171 
172  // First click creates...
173  if( !item )
174  {
177 
178  switch( aType )
179  {
180  case LIB_PIN_T:
181  {
182  item = pinTool->CreatePin( wxPoint( cursorPos.x, -cursorPos.y), part );
183  g_lastPinWeakPtr = item;
184  break;
185  }
186  case LIB_TEXT_T:
187  {
188  LIB_TEXT* text = new LIB_TEXT( part );
189  text->SetPosition( wxPoint( cursorPos.x, -cursorPos.y) );
192 
193  DIALOG_LIB_EDIT_TEXT dlg( m_frame, text );
194 
195  if( dlg.ShowModal() != wxID_OK )
196  delete text;
197  else
198  item = text;
199 
200  break;
201  }
202  default:
203  wxFAIL_MSG( "doTwoClickPlace(): unknown type" );
204  }
205 
207 
208  // Restore cursor after dialog
210 
211  if( item )
212  {
213  item->SetFlags( IS_NEW | IS_MOVED );
214  m_view->ClearPreview();
215  m_view->AddToPreview( item->Clone() );
216  m_selectionTool->AddItemToSel( item );
217  }
218 
219  getViewControls()->SetCursorPosition( cursorPos, false );
220  }
221 
222  // ... and second click places:
223  else
224  {
225  m_frame->SaveCopyInUndoList( part );
226 
227  switch( item->Type() )
228  {
229  case LIB_PIN_T:
230  pinTool->PlacePin( (LIB_PIN*) item );
231  break;
232  case LIB_TEXT_T:
233  part->AddDrawItem( (LIB_TEXT*) item );
234  item->ClearEditFlags();
235  break;
236  default:
237  wxFAIL_MSG( "doTwoClickPlace(): unknown type" );
238  }
239 
240  item = nullptr;
241  m_view->ClearPreview();
242 
243  m_frame->RebuildView();
244  m_frame->OnModify();
245  }
246  }
247  else if( evt->IsClick( BUT_RIGHT ) )
248  {
249  // Warp after context menu only if dragging...
250  if( !item )
252 
254  }
255 
256  else if( item && ( evt->IsAction( &EE_ACTIONS::refreshPreview ) || evt->IsMotion() ) )
257  {
258  static_cast<LIB_ITEM*>( item )->SetPosition( wxPoint( cursorPos.x, -cursorPos.y) );
259  m_view->ClearPreview();
260  m_view->AddToPreview( item->Clone() );
261  }
262 
263  // Enable autopanning and cursor capture only when there is an item to be placed
264  getViewControls()->SetAutoPan( !!item );
265  getViewControls()->CaptureCursor( !!item );
266  }
267 
269 
270  return 0;
271 }
void SetTextAngle(double aAngle)
Definition: eda_text.h:173
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
void AddToPreview(EDA_ITEM *aItem, bool aTakeOwnership=true)
Definition: sch_view.cpp:145
void SetPosition(const wxPoint &aPosition)
Define a symbol library graphical text item.
Definition: lib_text.h:44
virtual void MoveCursorToCrossHair() override
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
static TOOL_ACTION refreshPreview
Definition: ee_actions.h:168
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
static void * g_lastPinWeakPtr
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:231
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
void AddDrawItem(LIB_ITEM *aItem)
Add a new draw aItem to the draw object list.
#define IS_NEW
New item, just created.
Definition: base_struct.h:114
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:259
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area.
static double g_LastTextAngle
SCH_DRAW_PANEL * GetCanvas() const override
void ClearPreview()
Definition: sch_view.cpp:133
Define a library symbol object.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:143
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:57
bool IsCancelInteractive(const TOOL_EVENT &aEvt)
Function IsCancelInteractive()
Definition: tool_event.cpp:177
TOOL_MENU m_menu
Menu model displayed by the tool.
Definition: ee_tool_base.h:147
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
virtual void SetNoToolSelected()
Select the ID_NO_TOOL_SELECTED id tool (Idle tool)
int AddItemToSel(const TOOL_EVENT &aEvent)
void SetIgnoreMouseEvents(bool aIgnore)
void VetoContextMenuMouseWarp()
Disables mouse warping after the current context menu is closed.
Definition: tool_manager.h:385
static int g_LastTextSize
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:157
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current symbol.
void Activate()
Function Activate() Runs the tool.
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: lib_text.cpp:78
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
LIB_PIN * CreatePin(const VECTOR2I &aPosition, LIB_PART *aPart)
void ClearEditFlags()
Definition: base_struct.h:276
bool PlacePin(LIB_PIN *aPin)
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
void SaveCopyInUndoList(EDA_ITEM *ItemToCopy, UNDO_REDO_T undoType=UR_LIBEDIT, bool aAppend=false)
Create a copy of the current component, and save it in the undo list.
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false)=0
Moves cursor to the requested position expressed in world coordinates.
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
OPT< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:486
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204
#define IS_MOVED
Item being moved.
Definition: base_struct.h:113

References TOOL_INTERACTIVE::Activate(), LIB_PART::AddDrawItem(), EE_SELECTION_TOOL::AddItemToSel(), KIGFX::SCH_VIEW::AddToPreview(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), EDA_ITEM::ClearEditFlags(), KIGFX::SCH_VIEW::ClearPreview(), EE_ACTIONS::clearSelection, EDA_ITEM::Clone(), LIB_PIN_TOOL::CreatePin(), g_lastPinWeakPtr, LIB_EDIT_FRAME::g_LastTextAngle, LIB_EDIT_FRAME::g_LastTextSize, SCH_BASE_FRAME::GetCanvas(), LIB_EDIT_FRAME::GetCurPart(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), TOOL_MANAGER::GetTool(), TOOL_BASE::getViewControls(), IS_MOVED, IS_NEW, TOOL_EVT_UTILS::IsCancelInteractive(), LIB_PIN_T, LIB_TEXT_T, EE_TOOL_BASE< LIB_EDIT_FRAME >::m_frame, EE_TOOL_BASE< LIB_EDIT_FRAME >::m_menu, EE_TOOL_BASE< LIB_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, EE_TOOL_BASE< LIB_EDIT_FRAME >::m_view, MD_ALT, SCH_DRAW_PANEL::MoveCursorToCrossHair(), LIB_EDIT_FRAME::OnModify(), LIB_PIN_TOOL::PlacePin(), LIB_EDIT_FRAME::RebuildView(), EE_ACTIONS::refreshPreview, TOOL_MANAGER::RunAction(), LIB_EDIT_FRAME::SaveCopyInUndoList(), KIGFX::VIEW_CONTROLS::SetAutoPan(), KIGFX::VIEW_CONTROLS::SetCursorPosition(), EDA_ITEM::SetFlags(), EDA_DRAW_PANEL::SetIgnoreMouseEvents(), EDA_DRAW_FRAME::SetNoToolSelected(), LIB_ITEM::SetPosition(), EDA_TEXT::SetTextAngle(), EDA_TEXT::SetTextSize(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), EDA_ITEM::Type(), TOOL_MANAGER::VetoContextMenuMouseWarp(), and TOOL_INTERACTIVE::Wait().

Referenced by PlacePin(), and PlaceText().

◆ DrawShape()

int LIB_DRAWING_TOOLS::DrawShape ( const TOOL_EVENT aEvent)

Definition at line 274 of file lib_drawing_tools.cpp.

275 {
276  // We might be running as the same shape in another co-routine. Make sure that one
277  // gets whacked.
279 
280  if( aEvent.IsAction( &EE_ACTIONS::drawSymbolArc ) )
281  m_frame->SetToolID( ID_LIBEDIT_BODY_ARC_BUTT, wxCURSOR_PENCIL, _( "Draw Arc" ) );
282  else if( aEvent.IsAction( &EE_ACTIONS::drawSymbolCircle ) )
283  m_frame->SetToolID( ID_LIBEDIT_BODY_CIRCLE_BUTT, wxCURSOR_PENCIL, _( "Draw Circle" ) );
284  else if( aEvent.IsAction( &EE_ACTIONS::drawSymbolLines ) )
285  m_frame->SetToolID( ID_LIBEDIT_BODY_LINE_BUTT, wxCURSOR_PENCIL, _( "Draw Lines" ) );
286  else if( aEvent.IsAction( &EE_ACTIONS::drawSymbolRectangle ) )
287  m_frame->SetToolID( ID_LIBEDIT_BODY_RECT_BUTT, wxCURSOR_PENCIL, _( "Draw Rectangle" ) );
288 
290  getViewControls()->ShowCursor( true );
291 
292  Activate();
293 
294  LIB_PART* part = m_frame->GetCurPart();
295  LIB_ITEM* item = nullptr;
296 
297  // Main loop: keep receiving events
298  while( auto evt = Wait() )
299  {
300  VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
301 
302  if( TOOL_EVT_UTILS::IsCancelInteractive( evt.get() ) )
303  {
305  m_view->ClearPreview();
306 
307  if( item )
308  {
309  delete item;
310  item = nullptr;
311 
312  if( !evt->IsActivate() )
313  continue;
314  }
315 
316  break;
317  }
318 
319  else if( evt->IsClick( BUT_LEFT ) && !item )
320  {
321  if( !part )
322  continue;
323 
325 
326  switch( m_frame->GetToolId() )
327  {
328  case ID_LIBEDIT_BODY_ARC_BUTT: item = new LIB_ARC( part ); break;
329  case ID_LIBEDIT_BODY_CIRCLE_BUTT: item = new LIB_CIRCLE( part ); break;
330  case ID_LIBEDIT_BODY_LINE_BUTT: item = new LIB_POLYLINE( part ); break;
331  case ID_LIBEDIT_BODY_RECT_BUTT: item = new LIB_RECTANGLE( part ); break;
332  default: wxFAIL_MSG( "LIB_DRAWING_TOOLS:DrawShape(): unknown tool" );
333  }
334 
337  item->BeginEdit( IS_NEW, wxPoint( cursorPos.x, -cursorPos.y ) );
338 
340  item->SetUnit( m_frame->GetUnit() );
341 
343  item->SetConvert( m_frame->GetConvert() );
344 
345  m_selectionTool->AddItemToSel( item );
346  }
347 
348  else if( item && ( evt->IsClick( BUT_LEFT )
349  || evt->IsDblClick( BUT_LEFT )
350  || evt->IsAction( &EE_ACTIONS::finishDrawing ) ) )
351  {
352  if( evt->IsDblClick( BUT_LEFT )
353  || evt->IsAction( &EE_ACTIONS::finishDrawing )
354  || !item->ContinueEdit( wxPoint( cursorPos.x, -cursorPos.y ) ) )
355  {
356  item->EndEdit( wxPoint( cursorPos.x, -cursorPos.y ) );
357  m_view->ClearPreview();
358 
359  m_frame->SaveCopyInUndoList( part );
360  part->AddDrawItem( item );
361  item = nullptr;
362 
363  m_frame->RebuildView();
364  m_frame->OnModify();
365  }
366  }
367 
368  else if( item && ( evt->IsAction( &EE_ACTIONS::refreshPreview )
369  || evt->IsMotion() ) )
370  {
371  item->CalcEdit( wxPoint( cursorPos.x, -cursorPos.y) );
372  m_view->ClearPreview();
373  m_view->AddToPreview( item->Clone() );
374  }
375 
376  else if( evt->IsDblClick( BUT_LEFT ) && !item )
377  {
379  }
380 
381  else if( evt->IsClick( BUT_RIGHT ) )
382  {
383  // Warp after context menu only if dragging...
384  if( !item )
386 
388  }
389 
390  // Enable autopanning and cursor capture only when there is a shape being drawn
391  getViewControls()->SetAutoPan( !!item );
392  getViewControls()->CaptureCursor( !!item );
393  }
394 
396 
397  return 0;
398 }
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
bool m_DrawSpecificUnit
Specify which component parts the current draw item applies to.
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
static TOOL_ACTION properties
Definition: ee_actions.h:124
static TOOL_ACTION drawSymbolLines
Definition: ee_actions.h:111
virtual void EndEdit(const wxPoint &aPosition)
End an object editing action.
void AddToPreview(EDA_ITEM *aItem, bool aTakeOwnership=true)
Definition: sch_view.cpp:145
virtual void SetWidth(int aWidth)=0
Set the width of the draw item to aWidth.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
static FILL_T g_LastFillStyle
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
static TOOL_ACTION refreshPreview
Definition: ee_actions.h:168
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
static int g_LastLineWidth
virtual void CalcEdit(const wxPoint &aPosition)
Calculates the attributes of an item at aPosition when it is being edited.
void DeactivateTool()
Function DeactivateTool() Deactivates the currently active tool.
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
The base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:54
bool m_DrawSpecificConvert
Convert of the item currently being drawn.
static TOOL_ACTION drawSymbolRectangle
Definition: ee_actions.h:108
void AddDrawItem(LIB_ITEM *aItem)
Add a new draw aItem to the draw object list.
#define IS_NEW
New item, just created.
Definition: base_struct.h:114
virtual bool ContinueEdit(const wxPoint aPosition)
Continue an edit in progress at aPosition.
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area.
void ClearPreview()
Definition: sch_view.cpp:133
static TOOL_ACTION drawSymbolCircle
Definition: ee_actions.h:109
Define a library symbol object.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:143
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:57
static TOOL_ACTION finishDrawing
Definition: ee_actions.h:113
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg)
Set the tool command ID to aId and sets the cursor to aCursor.
bool IsCancelInteractive(const TOOL_EVENT &aEvt)
Function IsCancelInteractive()
Definition: tool_event.cpp:177
TOOL_MENU m_menu
Menu model displayed by the tool.
Definition: ee_tool_base.h:147
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
void SetFillMode(FILL_T aFillMode)
void SetConvert(int aConvert)
virtual void BeginEdit(STATUS_FLAGS aEditMode, const wxPoint aPosition)
Begin an editing a component library draw item in aEditMode at aPosition.
virtual void SetNoToolSelected()
Select the ID_NO_TOOL_SELECTED id tool (Idle tool)
void SetUnit(int aUnit)
int AddItemToSel(const TOOL_EVENT &aEvent)
void VetoContextMenuMouseWarp()
Disables mouse warping after the current context menu is closed.
Definition: tool_manager.h:385
static TOOL_ACTION drawSymbolArc
Definition: ee_actions.h:110
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current symbol.
void Activate()
Function Activate() Runs the tool.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
void SaveCopyInUndoList(EDA_ITEM *ItemToCopy, UNDO_REDO_T undoType=UR_LIBEDIT, bool aAppend=false)
Create a copy of the current component, and save it in the undo list.
int GetToolId() const
Definition: draw_frame.h:524
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.

References TOOL_INTERACTIVE::Activate(), LIB_PART::AddDrawItem(), EE_SELECTION_TOOL::AddItemToSel(), KIGFX::SCH_VIEW::AddToPreview(), LIB_ITEM::BeginEdit(), BUT_LEFT, BUT_RIGHT, LIB_ITEM::CalcEdit(), KIGFX::VIEW_CONTROLS::CaptureCursor(), KIGFX::SCH_VIEW::ClearPreview(), EE_ACTIONS::clearSelection, EDA_ITEM::Clone(), LIB_ITEM::ContinueEdit(), TOOL_MANAGER::DeactivateTool(), EE_ACTIONS::drawSymbolArc, EE_ACTIONS::drawSymbolCircle, EE_ACTIONS::drawSymbolLines, EE_ACTIONS::drawSymbolRectangle, LIB_ITEM::EndEdit(), EE_ACTIONS::finishDrawing, LIB_EDIT_FRAME::g_LastFillStyle, LIB_EDIT_FRAME::g_LastLineWidth, LIB_EDIT_FRAME::GetConvert(), LIB_EDIT_FRAME::GetCurPart(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), EDA_DRAW_FRAME::GetToolId(), LIB_EDIT_FRAME::GetUnit(), TOOL_BASE::getViewControls(), ID_LIBEDIT_BODY_ARC_BUTT, ID_LIBEDIT_BODY_CIRCLE_BUTT, ID_LIBEDIT_BODY_LINE_BUTT, ID_LIBEDIT_BODY_RECT_BUTT, IS_NEW, TOOL_EVENT::IsAction(), TOOL_EVT_UTILS::IsCancelInteractive(), LIB_EDIT_FRAME::m_DrawSpecificConvert, LIB_EDIT_FRAME::m_DrawSpecificUnit, EE_TOOL_BASE< LIB_EDIT_FRAME >::m_frame, EE_TOOL_BASE< LIB_EDIT_FRAME >::m_menu, EE_TOOL_BASE< LIB_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, EE_TOOL_BASE< LIB_EDIT_FRAME >::m_view, MD_ALT, LIB_EDIT_FRAME::OnModify(), EE_ACTIONS::properties, LIB_EDIT_FRAME::RebuildView(), EE_ACTIONS::refreshPreview, TOOL_MANAGER::RunAction(), LIB_EDIT_FRAME::SaveCopyInUndoList(), KIGFX::VIEW_CONTROLS::SetAutoPan(), LIB_ITEM::SetConvert(), LIB_ITEM::SetFillMode(), EDA_DRAW_FRAME::SetNoToolSelected(), EDA_DRAW_FRAME::SetToolID(), LIB_ITEM::SetUnit(), LIB_ITEM::SetWidth(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), TOOL_MANAGER::VetoContextMenuMouseWarp(), TOOL_INTERACTIVE::Wait(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by setTransitions().

◆ evActivate()

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

functions below are not yet implemented - their interface may change

◆ evButtonDown()

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

◆ evButtonUp()

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

◆ evClick()

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

◆ evCommand() [1/2]

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

◆ evCommand() [2/2]

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

◆ evDrag()

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

◆ evMotion()

const TOOL_EVENT TOOL_INTERACTIVE::evMotion ( )
protectedinherited

◆ getEditFrame()

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

Function getEditFrame()

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

Definition at line 188 of file tool_base.h.

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

References TOOL_BASE::getEditFrameInt().

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

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

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

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 122 of file tool_base.h.

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

References TOOL_BASE::m_toolId.

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

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

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

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

Definition at line 144 of file tool_base.h.

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

References TOOL_BASE::m_toolMgr.

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

◆ getModel()

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

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 199 of file tool_base.h.

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

References TOOL_BASE::getModelInt().

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

◆ GetName()

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

Function GetName() Returns the name of the tool.

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

Returns
The name of the tool.

Definition at line 133 of file tool_base.h.

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

References TOOL_BASE::m_toolName.

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

◆ GetSettings()

TOOL_SETTINGS & TOOL_BASE::GetSettings ( )
inherited

Definition at line 77 of file tool_base.cpp.

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

References TOOL_BASE::m_toolSettings.

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

◆ GetToolMenu()

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

Get the tool's top-level context menu

Definition at line 103 of file ee_tool_base.h.

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

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 111 of file tool_base.h.

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

References TOOL_BASE::m_type.

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

◆ getView()

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

Function getView()

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

Returns
The instance of VIEW.

Definition at line 35 of file tool_base.cpp.

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

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

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

◆ getViewControls()

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

Function getViewControls()

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

Returns
The instance of VIEW_CONTROLS.

Definition at line 41 of file tool_base.cpp.

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

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

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

◆ Go()

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

Function Go()

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

Definition at line 135 of file tool_interactive.h.

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

References TOOL_INTERACTIVE::goInternal().

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

◆ Init()

bool LIB_DRAWING_TOOLS::Init ( )
overridevirtual

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

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

Reimplemented from TOOL_BASE.

Definition at line 104 of file lib_drawing_tools.cpp.

105 {
107 
108  auto isDrawingCondition = [] ( const SELECTION& aSel ) {
109  LIB_ITEM* item = (LIB_ITEM*) aSel.Front();
110  return item && item->IsNew();
111  };
112 
113  m_menu.GetMenu().AddItem( EE_ACTIONS::finishDrawing, isDrawingCondition, 2 );
114 
115  return true;
116 }
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
The base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
bool IsNew() const
Definition: base_struct.h:222
bool Init() override
Function Init() Init() is called once upon a registration of the tool.
Definition: ee_tool_base.h:69
static TOOL_ACTION finishDrawing
Definition: ee_actions.h:113
TOOL_MENU m_menu
Menu model displayed by the tool.
Definition: ee_tool_base.h:147
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Function AddItem()

References CONDITIONAL_MENU::AddItem(), EE_ACTIONS::finishDrawing, TOOL_MENU::GetMenu(), EE_TOOL_BASE< T >::Init(), EDA_ITEM::IsNew(), and EE_TOOL_BASE< LIB_EDIT_FRAME >::m_menu.

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 30 of file tool_base.cpp.

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

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

◆ PlaceAnchor()

int LIB_DRAWING_TOOLS::PlaceAnchor ( const TOOL_EVENT aEvent)

Definition at line 401 of file lib_drawing_tools.cpp.

402 {
403  m_frame->SetToolID( ID_LIBEDIT_ANCHOR_ITEM_BUTT, wxCURSOR_PENCIL, _( "Move symbol anchor" ) );
404 
405  getViewControls()->ShowCursor( true );
406  getViewControls()->SetSnapping( true );
407 
408  Activate();
409 
410  // Main loop: keep receiving events
411  while( OPT_TOOL_EVENT evt = Wait() )
412  {
413  if( TOOL_EVT_UTILS::IsCancelInteractive( evt.get() ) )
414  {
415  break;
416  }
417  else if( evt->IsClick( BUT_LEFT ) )
418  {
419  LIB_PART* part = m_frame->GetCurPart();
420 
421  if( !part )
422  continue;
423 
424  VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
425  wxPoint offset( -cursorPos.x, cursorPos.y );
426 
427  part->SetOffset( offset );
428 
429  // Refresh the view without changing the viewport
430  auto center = m_view->GetCenter();
431  center.x += offset.x;
432  center.y -= offset.y;
433  m_view->SetCenter( center );
435  m_frame->OnModify();
436  }
437  else if( evt->IsClick( BUT_RIGHT ) )
438  {
440  }
441  }
442 
444 
445  return 0;
446 }
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
const VECTOR2D & GetCenter() const
Function GetCenter() Returns the center point of this VIEW (in world space coordinates)
Definition: view.h:339
void RecacheAllItems()
Function RecacheAllItems() Rebuilds GAL display lists.
Definition: view.cpp:1401
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
virtual void SetSnapping(bool aEnabled)
Function SetSnapping() Enables/disables snapping cursor to grid.
void SetOffset(const wxPoint &aOffset)
Move the part aOffset.
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:601
Define a library symbol object.
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg)
Set the tool command ID to aId and sets the cursor to aCursor.
bool IsCancelInteractive(const TOOL_EVENT &aEvt)
Function IsCancelInteractive()
Definition: tool_event.cpp:177
TOOL_MENU m_menu
Menu model displayed by the tool.
Definition: ee_tool_base.h:147
virtual void SetNoToolSelected()
Select the ID_NO_TOOL_SELECTED id tool (Idle tool)
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current symbol.
void Activate()
Function Activate() Runs the tool.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
OPT< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:486

References TOOL_INTERACTIVE::Activate(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW::GetCenter(), LIB_EDIT_FRAME::GetCurPart(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), TOOL_BASE::getViewControls(), ID_LIBEDIT_ANCHOR_ITEM_BUTT, TOOL_EVT_UTILS::IsCancelInteractive(), EE_TOOL_BASE< LIB_EDIT_FRAME >::m_frame, EE_TOOL_BASE< LIB_EDIT_FRAME >::m_menu, EE_TOOL_BASE< LIB_EDIT_FRAME >::m_view, MD_ALT, LIB_EDIT_FRAME::OnModify(), KIGFX::VIEW::RecacheAllItems(), KIGFX::VIEW::SetCenter(), EDA_DRAW_FRAME::SetNoToolSelected(), LIB_PART::SetOffset(), KIGFX::VIEW_CONTROLS::SetSnapping(), EDA_DRAW_FRAME::SetToolID(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), TOOL_INTERACTIVE::Wait(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by setTransitions().

◆ PlacePin()

int LIB_DRAWING_TOOLS::PlacePin ( const TOOL_EVENT aEvent)

Definition at line 119 of file lib_drawing_tools.cpp.

120 {
121  m_frame->SetToolID( ID_LIBEDIT_PIN_BUTT, wxCURSOR_PENCIL, _( "Add pin" ) );
122  return doTwoClickPlace( LIB_PIN_T );
123 }
int doTwoClickPlace(KICAD_T aType)
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg)
Set the tool command ID to aId and sets the cursor to aCursor.

References doTwoClickPlace(), ID_LIBEDIT_PIN_BUTT, LIB_PIN_T, EE_TOOL_BASE< LIB_EDIT_FRAME >::m_frame, and EDA_DRAW_FRAME::SetToolID().

Referenced by setTransitions().

◆ PlaceText()

int LIB_DRAWING_TOOLS::PlaceText ( const TOOL_EVENT aEvent)

Definition at line 126 of file lib_drawing_tools.cpp.

127 {
128  m_frame->SetToolID( ID_LIBEDIT_BODY_TEXT_BUTT, wxCURSOR_PENCIL, _( "Add text" ) );
129  return doTwoClickPlace( LIB_TEXT_T );
130 }
int doTwoClickPlace(KICAD_T aType)
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg)
Set the tool command ID to aId and sets the cursor to aCursor.

References doTwoClickPlace(), ID_LIBEDIT_BODY_TEXT_BUTT, LIB_TEXT_T, EE_TOOL_BASE< LIB_EDIT_FRAME >::m_frame, and EDA_DRAW_FRAME::SetToolID().

Referenced by setTransitions().

◆ RepeatDrawItem()

int LIB_DRAWING_TOOLS::RepeatDrawItem ( const TOOL_EVENT aEvent)

Definition at line 449 of file lib_drawing_tools.cpp.

450 {
452  LIB_PART* part = m_frame->GetCurPart();
453  LIB_PIN* sourcePin = nullptr;
454 
455  if( !part )
456  return 0;
457 
458  // See if we have a pin matching our weak ptr
459  for( LIB_PIN* test = part->GetNextPin(); test; test = part->GetNextPin( test ) )
460  {
461  if( (void*) test == g_lastPinWeakPtr )
462  sourcePin = test;
463  }
464 
465  if( sourcePin )
466  {
467  LIB_PIN* pin = pinTool->RepeatPin( sourcePin );
468  g_lastPinWeakPtr = pin;
469 
471 
472  if( pin )
474  }
475 
476  return 0;
477 }
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
static void * g_lastPinWeakPtr
static TOOL_ACTION addItemToSel
Selects an item (specified as the event parameter).
Definition: ee_actions.h:60
Define a library symbol object.
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:57
LIB_PIN * RepeatPin(const LIB_PIN *aSourcePin)

References EE_ACTIONS::addItemToSel, EE_ACTIONS::clearSelection, g_lastPinWeakPtr, LIB_EDIT_FRAME::GetCurPart(), TOOL_MANAGER::GetTool(), EE_TOOL_BASE< LIB_EDIT_FRAME >::m_frame, TOOL_BASE::m_toolMgr, LIB_PIN_TOOL::RepeatPin(), and TOOL_MANAGER::RunAction().

Referenced by setTransitions().

◆ Reset()

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

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

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

Parameters
aReasoncontains information about the reason of tool reset.

Implements TOOL_BASE.

Definition at line 90 of file ee_tool_base.h.

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

◆ RunMainStack()

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

Function RunMainStack()

Calls a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 85 of file tool_interactive.cpp.

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

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

Referenced by DRAWING_TOOL::PlaceText().

◆ saveCopyInUndoList()

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

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

Definition at line 120 of file ee_tool_base.h.

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

◆ SetContextMenu()

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

Function SetContextMenu()

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

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

Definition at line 74 of file tool_interactive.cpp.

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

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

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

◆ setTransitions()

void LIB_DRAWING_TOOLS::setTransitions ( )
overrideprivatevirtual

Sets up handlers for various events.

Implements TOOL_INTERACTIVE.

Definition at line 480 of file lib_drawing_tools.cpp.

481 {
490 }
static TOOL_ACTION placeSymbolText
Definition: ee_actions.h:107
static TOOL_ACTION drawSymbolLines
Definition: ee_actions.h:111
int PlaceAnchor(const TOOL_EVENT &aEvent)
int DrawShape(const TOOL_EVENT &aEvent)
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
int PlacePin(const TOOL_EVENT &aEvent)
static TOOL_ACTION drawSymbolRectangle
Definition: ee_actions.h:108
static TOOL_ACTION placeSymbolPin
Definition: ee_actions.h:106
static TOOL_ACTION repeatDrawItem
Definition: ee_actions.h:119
static TOOL_ACTION drawSymbolCircle
Definition: ee_actions.h:109
int PlaceText(const TOOL_EVENT &aEvent)
int RepeatDrawItem(const TOOL_EVENT &aEvent)
static TOOL_ACTION drawSymbolArc
Definition: ee_actions.h:110
static TOOL_ACTION placeSymbolAnchor
Definition: ee_actions.h:112

References DrawShape(), EE_ACTIONS::drawSymbolArc, EE_ACTIONS::drawSymbolCircle, EE_ACTIONS::drawSymbolLines, EE_ACTIONS::drawSymbolRectangle, TOOL_INTERACTIVE::Go(), PlaceAnchor(), PlacePin(), EE_ACTIONS::placeSymbolAnchor, EE_ACTIONS::placeSymbolPin, EE_ACTIONS::placeSymbolText, PlaceText(), RepeatDrawItem(), and EE_ACTIONS::repeatDrawItem.

◆ updateView()

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

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

Definition at line 107 of file ee_tool_base.h.

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

◆ Wait()

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

Function Wait()

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

Definition at line 55 of file tool_interactive.cpp.

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

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

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

Member Data Documentation

◆ m_frame

LIB_EDIT_FRAME * EE_TOOL_BASE< LIB_EDIT_FRAME >::m_frame
protectedinherited

Definition at line 141 of file ee_tool_base.h.

◆ m_isLibEdit

bool EE_TOOL_BASE< LIB_EDIT_FRAME >::m_isLibEdit
protectedinherited

Definition at line 144 of file ee_tool_base.h.

◆ m_menu

TOOL_MENU EE_TOOL_BASE< LIB_EDIT_FRAME >::m_menu
protectedinherited

Menu model displayed by the tool.

Definition at line 147 of file ee_tool_base.h.

◆ m_selectionTool

EE_SELECTION_TOOL* EE_TOOL_BASE< LIB_EDIT_FRAME >::m_selectionTool
protectedinherited

Definition at line 143 of file ee_tool_base.h.

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

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

Definition at line 211 of file tool_base.h.

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

◆ m_toolMgr

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 216 of file tool_base.h.

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

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Name of the tool.

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

Definition at line 215 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_toolSettings

TOOL_SETTINGS TOOL_BASE::m_toolSettings
protectedinherited

Definition at line 217 of file tool_base.h.

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

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

Definition at line 208 of file tool_base.h.

Referenced by TOOL_BASE::GetType().

◆ m_view

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

Definition at line 142 of file ee_tool_base.h.


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