KiCad PCB EDA Suite
PL_EDIT_TOOL Class Reference

#include <pl_edit_tool.h>

Inheritance diagram for PL_EDIT_TOOL:
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

 PL_EDIT_TOOL ()
 
 ~PL_EDIT_TOOL ()
 
bool Init () override
 Init() is called once upon a registration of the tool. More...
 
void Reset (RESET_REASON aReason) override
 Bring the tool to a known, initial state. More...
 
int Main (const TOOL_EVENT &aEvent)
 The "move" event loop. More...
 
int Undo (const TOOL_EVENT &aEvent)
 
int Redo (const TOOL_EVENT &aEvent)
 
int Cut (const TOOL_EVENT &aEvent)
 
int Copy (const TOOL_EVENT &aEvent)
 
int Paste (const TOOL_EVENT &aEvent)
 
int ImportDrawingSheetContent (const TOOL_EVENT &aEvent)
 
int DoDelete (const TOOL_EVENT &aEvent)
 Delete the selected items, or the item under the cursor. More...
 
int DeleteItemCursor (const TOOL_EVENT &aEvent)
 
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 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

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

void moveItem (DS_DATA_ITEM *aItem, const VECTOR2I &aDelta)
 Return the right modification point (e.g. More...
 
bool updateModificationPoint (PL_SELECTION &aSelection)
 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

PL_EDITOR_FRAMEm_frame
 
PL_SELECTION_TOOLm_selectionTool
 Flag determining if anything is being dragged right now. More...
 
bool m_moveInProgress
 Used for chaining commands. More...
 
VECTOR2I m_moveOffset
 Last cursor position (needed for getModificationPoint() to avoid changes of edit reference point). More...
 
VECTOR2I m_cursor
 
EDA_ITEMm_pickerItem
 

Detailed Description

Definition at line 36 of file pl_edit_tool.h.

Member Enumeration Documentation

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determine the reason of reset for a tool.

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 77 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ PL_EDIT_TOOL()

PL_EDIT_TOOL::PL_EDIT_TOOL ( )

Definition at line 44 of file pl_edit_tool.cpp.

44  :
45  TOOL_INTERACTIVE( "plEditor.InteractiveEdit" ),
46  m_frame( nullptr ),
47  m_selectionTool( nullptr ),
48  m_moveInProgress( false ),
49  m_moveOffset( 0, 0 ),
50  m_cursor( 0, 0 ),
51  m_pickerItem( nullptr )
52 {
53 }
PL_SELECTION_TOOL * m_selectionTool
Flag determining if anything is being dragged right now.
Definition: pl_edit_tool.h:80
TOOL_INTERACTIVE(TOOL_ID aId, const std::string &aName)
Create a tool with given id & name.
VECTOR2I m_cursor
Definition: pl_edit_tool.h:90
EDA_ITEM * m_pickerItem
Definition: pl_edit_tool.h:92
VECTOR2I m_moveOffset
Last cursor position (needed for getModificationPoint() to avoid changes of edit reference point).
Definition: pl_edit_tool.h:86
PL_EDITOR_FRAME * m_frame
Definition: pl_edit_tool.h:79
bool m_moveInProgress
Used for chaining commands.
Definition: pl_edit_tool.h:83

◆ ~PL_EDIT_TOOL()

PL_EDIT_TOOL::~PL_EDIT_TOOL ( )
inline

Definition at line 40 of file pl_edit_tool.h.

40 {}

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:214
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:209
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(), 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(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCB_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), PCB_PICKER_TOOL::Main(), Main(), EE_POINT_EDITOR::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(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Set the TOOL_MANAGER the tool will belong to.

Called by TOOL_MANAGER::RegisterTool()

Definition at line 60 of file tool_base.cpp.

61 {
62  m_toolMgr = aManager;
63 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ Copy()

int PL_EDIT_TOOL::Copy ( const TOOL_EVENT aEvent)

Definition at line 456 of file pl_edit_tool.cpp.

457 {
459  std::vector<DS_DATA_ITEM*> items;
461  wxString sexpr;
462 
463  if( selection.GetSize() == 0 )
464  return 0;
465 
466  for( EDA_ITEM* item : selection.GetItems() )
467  items.push_back( static_cast<DS_DRAW_ITEM_BASE*>( item )->GetPeer() );
468 
469  try
470  {
471  model.SaveInString( items, &sexpr );
472  }
473  catch( const IO_ERROR& ioe )
474  {
475  wxMessageBox( ioe.What(), _( "Error writing objects to clipboard" ) );
476  }
477 
478  if( m_toolMgr->SaveClipboard( TO_UTF8( sexpr ) ) )
479  return 0;
480  else
481  return -1;
482 }
Handle the graphic items list to draw/plot the frame and title block.
Definition: ds_data_model.h:38
PL_SELECTION_TOOL * m_selectionTool
Flag determining if anything is being dragged right now.
Definition: pl_edit_tool.h:80
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
const std::deque< EDA_ITEM * > GetItems() const
Definition: selection.h:108
#define _(s)
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:87
bool SaveClipboard(const std::string &aTextUTF8)
Store information to the system clipboard.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
void SaveInString(wxString *aOutputString)
Save the description in a buffer.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75
PL_SELECTION & RequestSelection()
Return either an existing selection (filtered), or the selection at the current cursor if the existin...

References _, SELECTION::GetItems(), SELECTION::GetSize(), DS_DATA_MODEL::GetTheInstance(), m_selectionTool, TOOL_BASE::m_toolMgr, PL_SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::SaveClipboard(), DS_DATA_MODEL::SaveInString(), TO_UTF8, and IO_ERROR::What().

Referenced by Cut(), and setTransitions().

◆ Cut()

int PL_EDIT_TOOL::Cut ( const TOOL_EVENT aEvent)

Definition at line 445 of file pl_edit_tool.cpp.

446 {
447  int retVal = Copy( aEvent );
448 
449  if( retVal == 0 )
450  retVal = DoDelete( aEvent );
451 
452  return retVal;
453 }
int Copy(const TOOL_EVENT &aEvent)
int DoDelete(const TOOL_EVENT &aEvent)
Delete the selected items, or the item under the cursor.

References Copy(), and DoDelete().

Referenced by setTransitions().

◆ DeleteItemCursor()

int PL_EDIT_TOOL::DeleteItemCursor ( const TOOL_EVENT aEvent)

Definition at line 357 of file pl_edit_tool.cpp.

358 {
359  std::string tool = aEvent.GetCommandStr().get();
361 
362  // Deactivate other tools; particularly important if another PICKER is currently running
363  Activate();
364 
365  picker->SetCursor( KICURSOR::REMOVE );
366  m_pickerItem = nullptr;
367 
368  picker->SetClickHandler(
369  [this] ( const VECTOR2D& aPosition ) -> bool
370  {
371  if( m_pickerItem )
372  {
374  selectionTool->UnbrightenItem( m_pickerItem );
375  selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
377  m_pickerItem = nullptr;
378  }
379 
380  return true;
381  } );
382 
383  picker->SetMotionHandler(
384  [this] ( const VECTOR2D& aPos )
385  {
386  int threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
387  EDA_ITEM* item = nullptr;
388 
389  for( DS_DATA_ITEM* dataItem : DS_DATA_MODEL::GetTheInstance().GetItems() )
390  {
391  for( DS_DRAW_ITEM_BASE* drawItem : dataItem->GetDrawItems() )
392  {
393  if( drawItem->HitTest( (wxPoint) aPos, threshold ) )
394  {
395  item = drawItem;
396  break;
397  }
398  }
399  }
400 
401  if( m_pickerItem != item )
402  {
404 
405  if( m_pickerItem )
406  selectionTool->UnbrightenItem( m_pickerItem );
407 
408  m_pickerItem = item;
409 
410  if( m_pickerItem )
411  selectionTool->BrightenItem( m_pickerItem );
412  }
413  } );
414 
415  picker->SetFinalizeHandler(
416  [this] ( const int& aFinalState )
417  {
418  if( m_pickerItem )
420 
421  // Wake the selection tool after exiting to ensure the cursor gets updated
423  } );
424 
425  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
426 
427  return 0;
428 }
static TOOL_ACTION doDelete
Definition: actions.h:72
void BrightenItem(EDA_ITEM *aItem)
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
void SetFinalizeHandler(FINALIZE_HANDLER aHandler)
Set a handler for the finalize event.
Definition: picker_tool.h:102
int AddItemToSel(const TOOL_EVENT &aEvent)
EDA_ITEM * m_pickerItem
Definition: pl_edit_tool.h:92
static TOOL_ACTION pickerTool
Definition: actions.h:155
Base class to handle basic graphic items.
Definition: ds_draw_item.h:58
static TOOL_ACTION selectionActivate
Activation of the selection tool.
Definition: pl_actions.h:40
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
void SetMotionHandler(MOTION_HANDLER aHandler)
Set a handler for mouse motion.
Definition: picker_tool.h:82
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
void SetCursor(KICURSOR aCursor)
Definition: picker_tool.h:62
#define HITTEST_THRESHOLD_PIXELS
void SetClickHandler(CLICK_HANDLER aHandler)
Set a handler for mouse click event.
Definition: picker_tool.h:71
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:460
Drawing sheet structure type definitions.
Definition: ds_data_item.h:95
void UnbrightenItem(EDA_ITEM *aItem)
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
void Activate()
Run the tool.

References TOOL_INTERACTIVE::Activate(), PL_SELECTION_TOOL::AddItemToSel(), PL_SELECTION_TOOL::BrightenItem(), ACTIONS::doDelete, TOOL_EVENT::GetCommandStr(), DS_DATA_MODEL::GetTheInstance(), TOOL_MANAGER::GetTool(), TOOL_BASE::getView(), HITTEST_THRESHOLD_PIXELS, KiROUND(), m_pickerItem, TOOL_BASE::m_toolMgr, ACTIONS::pickerTool, REMOVE, TOOL_MANAGER::RunAction(), PL_ACTIONS::selectionActivate, PICKER_TOOL_BASE::SetClickHandler(), PICKER_TOOL_BASE::SetCursor(), PICKER_TOOL_BASE::SetFinalizeHandler(), PICKER_TOOL_BASE::SetMotionHandler(), and PL_SELECTION_TOOL::UnbrightenItem().

Referenced by setTransitions().

◆ DoDelete()

int PL_EDIT_TOOL::DoDelete ( const TOOL_EVENT aEvent)

Delete the selected items, or the item under the cursor.

Run the deletion tool.

Definition at line 320 of file pl_edit_tool.cpp.

321 {
323 
324  if( selection.Size() == 0 )
325  return 0;
326 
328 
329  while( selection.Front() )
330  {
331  DS_DRAW_ITEM_BASE* drawItem = static_cast<DS_DRAW_ITEM_BASE*>( selection.Front() );
332  DS_DATA_ITEM* dataItem = drawItem->GetPeer();
334 
335  for( DS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
336  {
337  // Note: repeat items won't be selected but must be removed & deleted
338 
339  if( item->IsSelected() )
341 
342  getView()->Remove( item );
343  }
344 
345  delete dataItem;
346  }
347 
348  m_frame->OnModify();
349 
350  return 0;
351 }
int RemoveItemFromSel(const TOOL_EVENT &aEvent)
PL_SELECTION_TOOL * m_selectionTool
Flag determining if anything is being dragged right now.
Definition: pl_edit_tool.h:80
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:353
void OnModify()
Must be called after a change in order to set the "modify" flag.
Base class to handle basic graphic items.
Definition: ds_draw_item.h:58
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
PL_EDITOR_FRAME * m_frame
Definition: pl_edit_tool.h:79
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
DS_DATA_ITEM * GetPeer() const
Definition: ds_draw_item.h:63
Drawing sheet structure type definitions.
Definition: ds_data_item.h:95
int Size() const
Returns the number of selected parts.
Definition: selection.h:103
void SaveCopyInUndoList()
Save a copy of the description (in a S expr string) for Undo/redo commands.
void Remove(DS_DATA_ITEM *aItem)
PL_SELECTION & RequestSelection()
Return either an existing selection (filtered), or the selection at the current cursor if the existin...
EDA_ITEM * Front() const
Definition: selection.h:144

References SELECTION::Front(), DS_DRAW_ITEM_BASE::GetPeer(), DS_DATA_MODEL::GetTheInstance(), TOOL_BASE::getView(), m_frame, m_selectionTool, PL_EDITOR_FRAME::OnModify(), KIGFX::VIEW::Remove(), DS_DATA_MODEL::Remove(), PL_SELECTION_TOOL::RemoveItemFromSel(), PL_SELECTION_TOOL::RequestSelection(), PL_EDITOR_FRAME::SaveCopyInUndoList(), and SELECTION::Size().

Referenced by Cut(), and setTransitions().

◆ getEditFrame()

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

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

Definition at line 184 of file tool_base.h.

185  {
186 #if !defined( QA_TEST ) // Dynamic casts give the linker a seizure in the test framework
187  wxASSERT( dynamic_cast<T*>( getToolHolderInt() ) );
188 #endif
189  return static_cast<T*>( getToolHolderInt() );
190  }
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 120 of file tool_base.h.

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

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 143 of file tool_base.h.

144  {
145  return m_toolMgr;
146  }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214

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 196 of file tool_base.h.

References TOOL_BASE::getModelInt().

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

◆ 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 133 of file tool_base.h.

134  {
135  return m_toolName;
136  }
std::string m_toolName
Definition: tool_base.h:213

References TOOL_BASE::m_toolName.

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

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Return the type of the tool.

Returns
The type of the tool.

Definition at line 108 of file tool_base.h.

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

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:283
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214

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

Referenced by EE_POINT_EDITOR::addCornerCondition(), ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), COMMON_TOOLS::CenterContents(), SCH_EDIT_TOOL::ChangeTextType(), EE_INSPECTION_TOOL::CheckSymbol(), GERBVIEW_CONTROL::ClearAllLayers(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::CollectHits(), SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint(), COMMON_TOOLS::CursorControl(), DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), DoDelete(), 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(), 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::FindSymbolAndItem(), EE_SELECTION_TOOL::GetNode(), 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(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineDrag(), 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(), moveItem(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), Paste(), SCH_EDITOR_CONTROL::Paste(), ROUTER_TOOL::performRouting(), PNS::TOOL_BASE::pickSingleItem(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceTarget(), ROUTER_TOOL::prepareInteractive(), 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(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), SCH_DRAWING_TOOLS::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:214
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:285

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(), SCH_DRAWING_TOOLS::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(), SCH_DRAWING_TOOLS::DrawSheet(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), SCH_DRAWING_TOOLS::GetCanvasFreeAreaPixels(), BOARD_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), 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(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), 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(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateItem(), updateModificationPoint(), and COMMON_TOOLS::ZoomCenter().

◆ Go()

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

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

No conditions means any event.

Definition at line 147 of file tool_interactive.h.

149 {
150  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
151 
152  goInternal( sptr, aConditions );
153 }
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:58
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(), SCRIPTING_TOOL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), COMMON_CONTROL::setTransitions(), CONVERT_TOOL::setTransitions(), SYMBOL_EDITOR_DRAWING_TOOLS::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), MICROWAVE_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PAD_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_CONTROL::setTransitions(), SYMBOL_EDITOR_EDIT_TOOL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), FOOTPRINT_EDITOR_CONTROL::setTransitions(), SCH_EDIT_TOOL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), PCB_CONTROL::setTransitions(), DRC_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), BOARD_INSPECTION_TOOL::setTransitions(), BOARD_EDITOR_CONTROL::setTransitions(), PICKER_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), PCB_SELECTION_TOOL::setTransitions(), PL_SELECTION_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), DRAWING_TOOL::setTransitions(), and EE_SELECTION_TOOL::setTransitions().

◆ ImportDrawingSheetContent()

int PL_EDIT_TOOL::ImportDrawingSheetContent ( const TOOL_EVENT aEvent)

Definition at line 309 of file pl_edit_tool.cpp.

310 {
312 
313  wxCommandEvent evt( wxEVT_NULL, ID_APPEND_DESCR_FILE );
314  m_frame->Files_io( evt );
315 
316  return 0;
317 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
static TOOL_ACTION cancelInteractive
Definition: actions.h:62
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
PL_EDITOR_FRAME * m_frame
Definition: pl_edit_tool.h:79
void Files_io(wxCommandEvent &event)

References ACTIONS::cancelInteractive, PL_EDITOR_FRAME::Files_io(), ID_APPEND_DESCR_FILE, m_frame, TOOL_BASE::m_toolMgr, and TOOL_MANAGER::RunAction().

Referenced by setTransitions().

◆ Init()

bool PL_EDIT_TOOL::Init ( )
overridevirtual

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

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

Reimplemented from TOOL_BASE.

Definition at line 56 of file pl_edit_tool.cpp.

57 {
58  m_frame = getEditFrame<PL_EDITOR_FRAME>();
60 
61  wxASSERT_MSG( m_selectionTool, "plEditor.InteractiveSelection tool is not available" );
62 
63  CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
64 
65  // cancel current tool goes in main context menu at the top if present
67 
68  ctxMenu.AddSeparator( 200 );
70 
71  // Finally, add the standard zoom/grid items
73 
74  //
75  // Add editing actions to the selection tool menu
76  //
78 
80 
81  selToolMenu.AddSeparator( 250 );
86 
87  return true;
88 }
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
void AddStandardSubMenus(TOOL_MENU &aMenu)
Construct a "basic" menu for a tool, containing only items that apply to all tools (e....
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
static TOOL_ACTION doDelete
Definition: actions.h:72
PL_SELECTION_TOOL * m_selectionTool
Flag determining if anything is being dragged right now.
Definition: pl_edit_tool.h:80
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:46
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
static TOOL_ACTION cancelInteractive
Definition: actions.h:62
TOOL_MENU & GetToolMenu()
static TOOL_ACTION move
Definition: pl_actions.h:65
static bool NotEmpty(const SELECTION &aSelection)
Test if there are any items selected.
static TOOL_ACTION copy
Definition: actions.h:67
PL_EDITOR_FRAME * m_frame
Definition: pl_edit_tool.h:79
static TOOL_ACTION cut
Definition: actions.h:66
void AddSeparator(int aOrder=ANY_ORDER)
Add a separator to the menu.
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Add a menu entry to run a TOOL_ACTION on selected items.
static TOOL_ACTION paste
Definition: actions.h:68

References CONDITIONAL_MENU::AddItem(), CONDITIONAL_MENU::AddSeparator(), EDA_DRAW_FRAME::AddStandardSubMenus(), ACTIONS::cancelInteractive, ACTIONS::copy, ACTIONS::cut, ACTIONS::doDelete, TOOL_MENU::GetMenu(), TOOL_MANAGER::GetTool(), TOOL_INTERACTIVE::GetToolMenu(), m_frame, TOOL_INTERACTIVE::m_menu, m_selectionTool, TOOL_BASE::m_toolMgr, PL_ACTIONS::move, SELECTION_CONDITIONS::NotEmpty(), ACTIONS::paste, and SELECTION_CONDITIONS::ShowAlways().

◆ 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:214
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:209
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().

◆ Main()

int PL_EDIT_TOOL::Main ( const TOOL_EVENT aEvent)

The "move" event loop.

Definition at line 98 of file pl_edit_tool.cpp.

99 {
101 
102  VECTOR2I originalCursorPos = controls->GetCursorPosition();
103 
104  // Be sure that there is at least one item that we can move. If there's no selection try
105  // looking for the stuff under mouse cursor (i.e. Kicad old-style hover selection).
107  bool unselect = selection.IsHover();
108 
109  if( selection.Empty() || m_moveInProgress )
110  return 0;
111 
112  std::set<DS_DATA_ITEM*> unique_peers;
113 
114  for( EDA_ITEM* item : selection )
115  {
116  DS_DRAW_ITEM_BASE* drawItem = static_cast<DS_DRAW_ITEM_BASE*>( item );
117  unique_peers.insert( drawItem->GetPeer() );
118  }
119 
120  std::string tool = aEvent.GetCommandStr().get();
121  m_frame->PushTool( tool );
122 
123  Activate();
124  // Must be done after Activate() so that it gets set into the correct context
125  controls->ShowCursor( true );
126  controls->SetAutoPan( true );
127 
128  bool restore_state = false;
129  bool chain_commands = false;
130  TOOL_EVENT* evt = const_cast<TOOL_EVENT*>( &aEvent );
131  VECTOR2I prevPos;
132 
133  if( !selection.Front()->IsNew() )
135 
136  // Main loop: keep receiving events
137  do
138  {
140 
141  if( evt->IsAction( &PL_ACTIONS::move ) || evt->IsMotion() || evt->IsDrag( BUT_LEFT )
142  || evt->IsAction( &ACTIONS::refreshPreview ) )
143  {
144  //------------------------------------------------------------------------
145  // Start a move operation
146  //
147  if( !m_moveInProgress )
148  {
149  // Apply any initial offset in case we're coming from a previous command.
150  //
151  for( DS_DATA_ITEM* item : unique_peers )
152  moveItem( item, m_moveOffset );
153 
154  // Set up the starting position and move/drag offset
155  //
156  m_cursor = controls->GetCursorPosition();
157 
158  if( selection.HasReferencePoint() )
159  {
160  VECTOR2I delta = m_cursor - selection.GetReferencePoint();
161 
162  // Drag items to the current cursor position
163  for( DS_DATA_ITEM* item : unique_peers )
164  moveItem( item, delta );
165 
166  selection.SetReferencePoint( m_cursor );
167  }
168  else if( selection.Size() == 1 )
169  {
170  // Set the current cursor position to the first dragged item origin,
171  // so the movement vector can be computed later
172  updateModificationPoint( selection );
173  m_cursor = originalCursorPos;
174  }
175  else
176  {
177  updateModificationPoint( selection );
178  }
179 
180  controls->SetCursorPosition( m_cursor, false );
181 
182  prevPos = m_cursor;
183  controls->SetAutoPan( true );
184  m_moveInProgress = true;
185  }
186 
187  //------------------------------------------------------------------------
188  // Follow the mouse
189  //
190  m_cursor = controls->GetCursorPosition();
191  VECTOR2I delta( m_cursor - prevPos );
192  selection.SetReferencePoint( m_cursor );
193 
194  m_moveOffset += delta;
195  prevPos = m_cursor;
196 
197  for( DS_DATA_ITEM* item : unique_peers )
198  moveItem( item, delta );
199 
201  }
202  //------------------------------------------------------------------------
203  // Handle cancel
204  //
205  else if( evt->IsCancelInteractive() || evt->IsActivate() )
206  {
207  if( m_moveInProgress )
208  {
209  evt->SetPassEvent( false );
210  restore_state = true;
211  }
212 
213  break;
214  }
215  //------------------------------------------------------------------------
216  // Handle TOOL_ACTION special cases
217  //
218  else if( evt->Action() == TA_UNDO_REDO_PRE )
219  {
220  unselect = true;
221  break;
222  }
223  else if( evt->Category() == TC_COMMAND )
224  {
225  if( evt->IsAction( &ACTIONS::doDelete ) )
226  {
227  // Exit on a remove operation; there is no further processing for removed items.
228  break;
229  }
230  }
231  //------------------------------------------------------------------------
232  // Handle context menu
233  //
234  else if( evt->IsClick( BUT_RIGHT ) )
235  {
237  }
238  //------------------------------------------------------------------------
239  // Handle drop
240  //
241  else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
242  {
243  break; // Finish
244  }
245  else
246  evt->SetPassEvent();
247 
248  } while( ( evt = Wait() ) ); //Should be assignment not equality test
249 
250  controls->ForceCursorPosition( false );
251  controls->ShowCursor( false );
252  controls->SetAutoPan( false );
253 
254  if( !chain_commands )
255  m_moveOffset = { 0, 0 };
256 
257  selection.ClearReferencePoint();
258 
259  for( EDA_ITEM* item : selection )
260  item->ClearEditFlags();
261 
262  if( unselect )
264 
265  if( restore_state )
267  else
268  m_frame->OnModify();
269 
270  m_moveInProgress = false;
271  m_frame->PopTool( tool );
272  return 0;
273 }
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.
bool IsHover() const
Definition: selection.h:73
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
PL_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void SetPassEvent(bool aPass=true)
Returns if it this event has a valid position (true for mouse events and context-menu or hotkey-based...
Definition: tool_event.h:236
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.
bool updateModificationPoint(PL_SELECTION &aSelection)
Set up handlers for various events.
static TOOL_ACTION doDelete
Definition: actions.h:72
PL_SELECTION_TOOL * m_selectionTool
Flag determining if anything is being dragged right now.
Definition: pl_edit_tool.h:80
TOOL_ACTIONS Action() const
These give a tool a method of informing the TOOL_MANAGER that a particular event should be passed on ...
Definition: tool_event.h:230
bool IsClick(int aButtonMask=BUT_ANY) const
Definition: tool_event.cpp:199
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
bool IsMotion() const
Definition: tool_event.h:300
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
VECTOR2I m_cursor
Definition: pl_edit_tool.h:90
static TOOL_ACTION move
Definition: pl_actions.h:65
TOOL_EVENT_CATEGORY Category() const
Returns more specific information about the type of an event.
Definition: tool_event.h:227
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.
PL_SELECTION & GetSelection()
Return the set of currently selected items.
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:204
bool IsCancelInteractive() const
Indicate the event should restart/end an ongoing interactive tool's event loop (eg esc key,...
Definition: tool_event.cpp:211
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:88
void OnModify()
Must be called after a change in order to set the "modify" flag.
Base class to handle basic graphic items.
Definition: ds_draw_item.h:58
bool IsDrag(int aButtonMask=BUT_ANY) const
Definition: tool_event.h:285
virtual void PopTool(const std::string &actionName)
VECTOR2I m_moveOffset
Last cursor position (needed for getModificationPoint() to avoid changes of edit reference point).
Definition: pl_edit_tool.h:86
Generic, UI-independent tool event.
Definition: tool_event.h:152
PL_EDITOR_FRAME * m_frame
Definition: pl_edit_tool.h:79
An interface for classes handling user events controlling the view behavior such as zooming,...
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Place the cursor immediately at a given point.
bool m_moveInProgress
Used for chaining commands.
Definition: pl_edit_tool.h:83
bool IsMouseUp(int aButtonMask=BUT_ANY) const
Definition: tool_event.h:295
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:97
static TOOL_ACTION clearSelection
Clear the current selection.
Definition: pl_actions.h:43
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:460
DS_DATA_ITEM * GetPeer() const
Definition: ds_draw_item.h:63
bool IsActivate() const
Definition: tool_event.h:315
Drawing sheet structure type definitions.
Definition: ds_data_item.h:95
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
void SaveCopyInUndoList()
Save a copy of the description (in a S expr string) for Undo/redo commands.
void Activate()
Run the tool.
constexpr int delta
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
void RollbackFromUndo()
Apply the last command in Undo List without stacking a Redo.
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
void moveItem(DS_DATA_ITEM *aItem, const VECTOR2I &aDelta)
Return the right modification point (e.g.
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
PL_SELECTION & RequestSelection()
Return either an existing selection (filtered), or the selection at the current cursor if the existin...
static TOOL_ACTION refreshPreview
Definition: actions.h:106
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.

References TOOL_EVENT::Action(), TOOL_INTERACTIVE::Activate(), BUT_LEFT, BUT_RIGHT, TOOL_EVENT::Category(), PL_ACTIONS::clearSelection, delta, ACTIONS::doDelete, SELECTION::Empty(), KIGFX::VIEW_CONTROLS::ForceCursorPosition(), PL_EDITOR_FRAME::GetCanvas(), TOOL_EVENT::GetCommandStr(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), DS_DRAW_ITEM_BASE::GetPeer(), PL_SELECTION_TOOL::GetSelection(), TOOL_BASE::getViewControls(), TOOL_EVENT::IsAction(), TOOL_EVENT::IsActivate(), TOOL_EVENT::IsCancelInteractive(), TOOL_EVENT::IsClick(), TOOL_EVENT::IsDrag(), SELECTION::IsHover(), TOOL_EVENT::IsMotion(), TOOL_EVENT::IsMouseUp(), m_cursor, m_frame, TOOL_INTERACTIVE::m_menu, m_moveInProgress, m_moveOffset, m_selectionTool, TOOL_BASE::m_toolMgr, PL_ACTIONS::move, moveItem(), MOVING, PL_EDITOR_FRAME::OnModify(), TOOLS_HOLDER::PopTool(), TOOL_MANAGER::PostEvent(), TOOLS_HOLDER::PushTool(), ACTIONS::refreshPreview, PL_SELECTION_TOOL::RequestSelection(), PL_EDITOR_FRAME::RollbackFromUndo(), TOOL_MANAGER::RunAction(), PL_EDITOR_FRAME::SaveCopyInUndoList(), EVENTS::SelectedItemsModified, KIGFX::VIEW_CONTROLS::SetAutoPan(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), KIGFX::VIEW_CONTROLS::SetCursorPosition(), TOOL_EVENT::SetPassEvent(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), TA_UNDO_REDO_PRE, TC_COMMAND, updateModificationPoint(), and TOOL_INTERACTIVE::Wait().

Referenced by setTransitions().

◆ moveItem()

void PL_EDIT_TOOL::moveItem ( DS_DATA_ITEM aItem,
const VECTOR2I aDelta 
)
private

Return the right modification point (e.g.

for rotation), depending on the number of selected items.

Definition at line 276 of file pl_edit_tool.cpp.

277 {
278  aItem->MoveToUi( aItem->GetStartPosUi() + (wxPoint) aDelta );
279 
280  for( DS_DRAW_ITEM_BASE* item : aItem->GetDrawItems() )
281  {
282  getView()->Update( item );
283  item->SetFlags( IS_MOVING );
284  }
285 }
Base class to handle basic graphic items.
Definition: ds_draw_item.h:58
#define IS_MOVING
Item being moved.
const std::vector< DS_DRAW_ITEM_BASE * > & GetDrawItems() const
Definition: ds_data_item.h:110
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
void MoveToUi(const wxPoint &aPosition)
Move item to a new position.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1518
const wxPoint GetStartPosUi(int ii=0) const

References DS_DATA_ITEM::GetDrawItems(), DS_DATA_ITEM::GetStartPosUi(), TOOL_BASE::getView(), IS_MOVING, DS_DATA_ITEM::MoveToUi(), and KIGFX::VIEW::Update().

Referenced by Main().

◆ Paste()

int PL_EDIT_TOOL::Paste ( const TOOL_EVENT aEvent)

Definition at line 485 of file pl_edit_tool.cpp.

486 {
487  PL_SELECTION& selection = m_selectionTool->GetSelection();
489  std::string sexpr = m_toolMgr->GetClipboardUTF8();
490 
492 
493  model.SetPageLayout( sexpr.c_str(), true, wxT( "clipboard" ) );
494 
495  // Build out draw items and select the first of each data item
496  for( DS_DATA_ITEM* dataItem : model.GetItems() )
497  {
498  if( dataItem->GetDrawItems().empty() )
499  {
500  dataItem->SyncDrawItems( nullptr, getView() );
501  dataItem->GetDrawItems().front()->SetSelected();
502  }
503  }
504 
506 
507  if( !selection.Empty() )
508  {
509  selection.SetReferencePoint( selection.GetTopLeftItem()->GetPosition() );
511  }
512 
513  return 0;
514 }
Handle the graphic items list to draw/plot the frame and title block.
Definition: ds_data_model.h:38
void RebuildSelection()
Rebuild the selection from the flags in the view items.
PL_SELECTION_TOOL * m_selectionTool
Flag determining if anything is being dragged right now.
Definition: pl_edit_tool.h:80
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
int ClearSelection(const TOOL_EVENT &aEvent)
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
std::vector< DS_DATA_ITEM * > & GetItems()
static TOOL_ACTION move
Definition: pl_actions.h:65
virtual wxPoint GetPosition() const
Definition: eda_item.h:252
PL_SELECTION & GetSelection()
Return the set of currently selected items.
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:186
EDA_ITEM * GetTopLeftItem(bool onlyModules=false) const override
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
std::string GetClipboardUTF8() const
Return the information currently stored in the system clipboard.
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:97
void SetPageLayout(const char *aPageLayout, bool aAppend=false, const wxString &aSource=wxT("Sexpr_string"))
Populate the list from a S expr description stored in a string.
Drawing sheet structure type definitions.
Definition: ds_data_item.h:95

References PL_SELECTION_TOOL::ClearSelection(), SELECTION::Empty(), TOOL_MANAGER::GetClipboardUTF8(), DS_DATA_MODEL::GetItems(), EDA_ITEM::GetPosition(), PL_SELECTION_TOOL::GetSelection(), DS_DATA_MODEL::GetTheInstance(), PL_SELECTION::GetTopLeftItem(), TOOL_BASE::getView(), m_selectionTool, TOOL_BASE::m_toolMgr, PL_ACTIONS::move, PL_SELECTION_TOOL::RebuildSelection(), TOOL_MANAGER::RunAction(), DS_DATA_MODEL::SetPageLayout(), and SELECTION::SetReferencePoint().

Referenced by setTransitions().

◆ Redo()

int PL_EDIT_TOOL::Redo ( const TOOL_EVENT aEvent)

Definition at line 438 of file pl_edit_tool.cpp.

439 {
441  return 0;
442 }
void GetLayoutFromRedoList()
Redo the last edit:
PL_EDITOR_FRAME * m_frame
Definition: pl_edit_tool.h:79

References PL_EDITOR_FRAME::GetLayoutFromRedoList(), and m_frame.

Referenced by setTransitions().

◆ Reset()

void PL_EDIT_TOOL::Reset ( RESET_REASON  aReason)
overridevirtual

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 91 of file pl_edit_tool.cpp.

92 {
93  if( aReason == MODEL_RELOAD )
94  m_frame = getEditFrame<PL_EDITOR_FRAME>();
95 }
Model changes (required full reload)
Definition: tool_base.h:80
PL_EDITOR_FRAME * m_frame
Definition: pl_edit_tool.h:79

References m_frame, and TOOL_BASE::MODEL_RELOAD.

◆ 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:214
void RunMainStack(TOOL_BASE *aTool, std::function< void()> aFunc)

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

Referenced by DRAWING_TOOL::PlaceText().

◆ 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:214
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 PL_EDIT_TOOL::setTransitions ( )
overrideprivatevirtual

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

It is called every time tool is reset or finished.

Implements TOOL_INTERACTIVE.

Definition at line 517 of file pl_edit_tool.cpp.

518 {
519  Go( &PL_EDIT_TOOL::Main, PL_ACTIONS::move.MakeEvent() );
520 
522 
523  Go( &PL_EDIT_TOOL::Undo, ACTIONS::undo.MakeEvent() );
524  Go( &PL_EDIT_TOOL::Redo, ACTIONS::redo.MakeEvent() );
525 
526  Go( &PL_EDIT_TOOL::Cut, ACTIONS::cut.MakeEvent() );
527  Go( &PL_EDIT_TOOL::Copy, ACTIONS::copy.MakeEvent() );
528  Go( &PL_EDIT_TOOL::Paste, ACTIONS::paste.MakeEvent() );
530 
532 }
int DeleteItemCursor(const TOOL_EVENT &aEvent)
static TOOL_ACTION doDelete
Definition: actions.h:72
int Paste(const TOOL_EVENT &aEvent)
int Cut(const TOOL_EVENT &aEvent)
static TOOL_ACTION move
Definition: pl_actions.h:65
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).
int Main(const TOOL_EVENT &aEvent)
The "move" event loop.
int ImportDrawingSheetContent(const TOOL_EVENT &aEvent)
static TOOL_ACTION copy
Definition: actions.h:67
int Undo(const TOOL_EVENT &aEvent)
static TOOL_ACTION cut
Definition: actions.h:66
int Copy(const TOOL_EVENT &aEvent)
static TOOL_ACTION redo
Definition: actions.h:65
int DoDelete(const TOOL_EVENT &aEvent)
Delete the selected items, or the item under the cursor.
static TOOL_ACTION appendImportedDrawingSheet
Definition: pl_actions.h:62
static TOOL_ACTION deleteTool
Definition: actions.h:73
static TOOL_ACTION undo
Definition: actions.h:64
static TOOL_ACTION paste
Definition: actions.h:68
int Redo(const TOOL_EVENT &aEvent)

References PL_ACTIONS::appendImportedDrawingSheet, Copy(), ACTIONS::copy, Cut(), ACTIONS::cut, DeleteItemCursor(), ACTIONS::deleteTool, DoDelete(), ACTIONS::doDelete, TOOL_INTERACTIVE::Go(), ImportDrawingSheetContent(), Main(), PL_ACTIONS::move, Paste(), ACTIONS::paste, Redo(), ACTIONS::redo, Undo(), and ACTIONS::undo.

◆ Undo()

int PL_EDIT_TOOL::Undo ( const TOOL_EVENT aEvent)

Definition at line 431 of file pl_edit_tool.cpp.

432 {
434  return 0;
435 }
PL_EDITOR_FRAME * m_frame
Definition: pl_edit_tool.h:79
void GetLayoutFromUndoList()
Undo the last edit:

References PL_EDITOR_FRAME::GetLayoutFromUndoList(), and m_frame.

Referenced by setTransitions().

◆ updateModificationPoint()

bool PL_EDIT_TOOL::updateModificationPoint ( PL_SELECTION aSelection)
private

Set up handlers for various events.

Definition at line 288 of file pl_edit_tool.cpp.

289 {
290  if( m_moveInProgress && aSelection.HasReferencePoint() )
291  return false;
292 
293  // When there is only one item selected, the reference point is its position...
294  if( aSelection.Size() == 1 )
295  {
296  aSelection.SetReferencePoint( aSelection.Front()->GetPosition() );
297  }
298  // ...otherwise modify items with regard to the grid-snapped cursor position
299  else
300  {
302  aSelection.SetReferencePoint( m_cursor );
303  }
304 
305  return true;
306 }
VECTOR2I m_cursor
Definition: pl_edit_tool.h:90
virtual wxPoint GetPosition() const
Definition: eda_item.h:252
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:186
bool m_moveInProgress
Used for chaining commands.
Definition: pl_edit_tool.h:83
bool HasReferencePoint() const
Definition: selection.h:176
int Size() const
Returns the number of selected parts.
Definition: selection.h:103
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
EDA_ITEM * Front() const
Definition: selection.h:144

References SELECTION::Front(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), EDA_ITEM::GetPosition(), TOOL_BASE::getViewControls(), SELECTION::HasReferencePoint(), m_cursor, m_moveInProgress, SELECTION::SetReferencePoint(), and SELECTION::Size().

Referenced by Main().

◆ 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:214
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(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), ZOOM_TOOL::Main(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), CVPCB_CONTROL::Main(), PL_POINT_EDITOR::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(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), 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(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

Member Data Documentation

◆ m_cursor

VECTOR2I PL_EDIT_TOOL::m_cursor
private

Definition at line 90 of file pl_edit_tool.h.

Referenced by Main(), and updateModificationPoint().

◆ m_frame

PL_EDITOR_FRAME* PL_EDIT_TOOL::m_frame
private

Definition at line 79 of file pl_edit_tool.h.

Referenced by DoDelete(), ImportDrawingSheetContent(), Init(), Main(), Redo(), Reset(), and Undo().

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

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

Definition at line 125 of file tool_interactive.h.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), ROUTER_TOOL::Init(), LENGTH_TUNER_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), Init(), SCH_EDIT_TOOL::Init(), PAD_TOOL::Init(), PL_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_CONTROL::Init(), PCB_VIEWER_TOOLS::Init(), FOOTPRINT_EDITOR_CONTROL::Init(), PL_SELECTION_TOOL::Init(), SCH_DRAWING_TOOLS::Init(), BOARD_EDITOR_CONTROL::Init(), GERBVIEW_SELECTION_TOOL::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(), DRAWING_TOOL::InteractivePlaceWithPreview(), PCB_PICKER_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PL_SELECTION_TOOL::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(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ m_moveInProgress

bool PL_EDIT_TOOL::m_moveInProgress
private

Used for chaining commands.

Definition at line 83 of file pl_edit_tool.h.

Referenced by Main(), and updateModificationPoint().

◆ m_moveOffset

VECTOR2I PL_EDIT_TOOL::m_moveOffset
private

Last cursor position (needed for getModificationPoint() to avoid changes of edit reference point).

Definition at line 86 of file pl_edit_tool.h.

Referenced by Main().

◆ m_pickerItem

EDA_ITEM* PL_EDIT_TOOL::m_pickerItem
private

Definition at line 92 of file pl_edit_tool.h.

Referenced by DeleteItemCursor().

◆ m_selectionTool

PL_SELECTION_TOOL* PL_EDIT_TOOL::m_selectionTool
private

Flag determining if anything is being dragged right now.

Definition at line 80 of file pl_edit_tool.h.

Referenced by Copy(), DoDelete(), Init(), Main(), and Paste().

◆ 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 209 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 214 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(), 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(), DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), PL_SELECTION_TOOL::disambiguateCursor(), EE_SELECTION_TOOL::disambiguateCursor(), PCB_SELECTION_TOOL::disambiguateCursor(), 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(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), 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(), EE_INSPECTION_TOOL::ExcludeMarker(), PCB_SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), PCB_SELECTION_TOOL::filterSelection(), PCB_SELECTION_TOOL::FindItem(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), EDIT_TOOL::GetAndPlace(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getToolHolderInt(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), COMMON_TOOLS::GridNext(), COMMON_TOOLS::GridPreset(), COMMON_TOOLS::GridPrev(), PCB_CONTROL::GridSetOrigin(), GROUP_TOOL::Group(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::HighlightItem(), BOARD_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), ImportDrawingSheetContent(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), BOARD_REANNOTATE_TOOL::Init(), SYMBOL_EDITOR_EDIT_TOOL::Init(), 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(), BOARD_INSPECTION_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), PCB_POINT_EDITOR::Init(), BOARD_EDITOR_CONTROL::Init(), POSITION_RELATIVE_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(), DRAWING_TOOL::InteractivePlaceWithPreview(), 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(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), 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(), PL_SELECTION_TOOL::onDisambiguationExpire(), EE_SELECTION_TOOL::onDisambiguationExpire(), PCB_SELECTION_TOOL::onDisambiguationExpire(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), 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(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), 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::Selectable(), 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(), SCH_DRAWING_TOOLS::SingleClickPlace(), EDA_3D_CONTROLLER::ToggleVisibility(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::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(), EDIT_TOOL::updateModificationPoint(), 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 213 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 206 of file tool_base.h.

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


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