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 ImportWorksheetContent (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, 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 78 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ 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:215
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:210
bool InvokeTool(TOOL_ID aToolId)
Call a tool by sending a tool activation event to tool of given ID.

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

Referenced by AUTOPLACE_TOOL::autoplace(), EDIT_TOOL::copyToClipboard(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), 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(), BOARD_INSPECTION_TOOL::HighlightNetTool(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), 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:215

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ Copy()

int PL_EDIT_TOOL::Copy ( const TOOL_EVENT aEvent)

Definition at line 455 of file pl_edit_tool.cpp.

456 {
458  std::vector<DS_DATA_ITEM*> items;
460  wxString sexpr;
461 
462  if( selection.GetSize() == 0 )
463  return 0;
464 
465  for( EDA_ITEM* item : selection.GetItems() )
466  items.push_back( static_cast<DS_DRAW_ITEM_BASE*>( item )->GetPeer() );
467 
468  try
469  {
470  model.SaveInString( items, sexpr );
471  }
472  catch( const IO_ERROR& ioe )
473  {
474  wxMessageBox( ioe.What(), _( "Error writing objects to clipboard" ) );
475  }
476 
477  if( m_toolMgr->SaveClipboard( TO_UTF8( sexpr ) ) )
478  return 0;
479  else
480  return -1;
481 }
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:215
#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:29
const std::deque< EDA_ITEM * > GetItems() const
Definition: selection.h:133
void SaveInString(wxString &aOutputString)
Save the description in a buffer.
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:101
bool SaveClipboard(const std::string &aTextUTF8)
Store information to the system clipboard.
#define _(s)
Definition: 3d_actions.cpp:33
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
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 444 of file pl_edit_tool.cpp.

445 {
446  int retVal = Copy( aEvent );
447 
448  if( retVal == 0 )
449  retVal = DoDelete( aEvent );
450 
451  return retVal;
452 }
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 356 of file pl_edit_tool.cpp.

357 {
358  std::string tool = aEvent.GetCommandStr().get();
360 
361  // Deactivate other tools; particularly important if another PICKER is currently running
362  Activate();
363 
364  picker->SetCursor( KICURSOR::REMOVE );
365  m_pickerItem = nullptr;
366 
367  picker->SetClickHandler(
368  [this] ( const VECTOR2D& aPosition ) -> bool
369  {
370  if( m_pickerItem )
371  {
373  selectionTool->UnbrightenItem( m_pickerItem );
374  selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
376  m_pickerItem = nullptr;
377  }
378 
379  return true;
380  } );
381 
382  picker->SetMotionHandler(
383  [this] ( const VECTOR2D& aPos )
384  {
385  int threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
386  EDA_ITEM* item = nullptr;
387 
388  for( DS_DATA_ITEM* dataItem : DS_DATA_MODEL::GetTheInstance().GetItems() )
389  {
390  for( DS_DRAW_ITEM_BASE* drawItem : dataItem->GetDrawItems() )
391  {
392  if( drawItem->HitTest( (wxPoint) aPos, threshold ) )
393  {
394  item = drawItem;
395  break;
396  }
397  }
398  }
399 
400  if( m_pickerItem != item )
401  {
403 
404  if( m_pickerItem )
405  selectionTool->UnbrightenItem( m_pickerItem );
406 
407  m_pickerItem = item;
408 
409  if( m_pickerItem )
410  selectionTool->BrightenItem( m_pickerItem );
411  }
412  } );
413 
414  picker->SetFinalizeHandler(
415  [this] ( const int& aFinalState )
416  {
417  if( m_pickerItem )
419 
420  // Wake the selection tool after exiting to ensure the cursor gets updated
422  } );
423 
424  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
425 
426  return 0;
427 }
static TOOL_ACTION doDelete
Definition: actions.h:75
void BrightenItem(EDA_ITEM *aItem)
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
void SetFinalizeHandler(FINALIZE_HANDLER aHandler)
Set a handler for the finalize event.
Definition: picker_tool.h:100
int AddItemToSel(const TOOL_EVENT &aEvent)
EDA_ITEM * m_pickerItem
Definition: pl_edit_tool.h:92
static TOOL_ACTION pickerTool
Definition: actions.h:158
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:44
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:80
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:60
#define HITTEST_THRESHOLD_PIXELS
void SetClickHandler(CLICK_HANDLER aHandler)
Set a handler for mouse click event.
Definition: picker_tool.h:69
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:471
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:68
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
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 319 of file pl_edit_tool.cpp.

320 {
322 
323  if( selection.Size() == 0 )
324  return 0;
325 
327 
328  while( selection.Front() )
329  {
330  DS_DRAW_ITEM_BASE* drawItem = static_cast<DS_DRAW_ITEM_BASE*>( selection.Front() );
331  DS_DATA_ITEM* dataItem = drawItem->GetPeer();
333 
334  for( DS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
335  {
336  // Note: repeat items won't be selected but must be removed & deleted
337 
338  if( item->IsSelected() )
340 
341  getView()->Remove( item );
342  }
343 
344  delete dataItem;
345  }
346 
347  m_frame->OnModify();
348 
349  return 0;
350 }
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:352
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:128
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:203

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

186  {
187 #if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
188  wxASSERT( dynamic_cast<T*>( getToolHolderInt() ) );
189 #endif
190  return static_cast<T*>( getToolHolderInt() );
191  }
TOOLS_HOLDER * getToolHolderInt() const
Definition: tool_base.cpp:48

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Return the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 121 of file tool_base.h.

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

References TOOL_BASE::m_toolId.

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

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

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

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

Definition at line 144 of file tool_base.h.

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

References TOOL_BASE::m_toolMgr.

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

◆ getModel()

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

Return the model object if it matches the requested type.

Store the type of the tool.

Definition at line 197 of file tool_base.h.

References TOOL_BASE::getModelInt().

Referenced by ZONE_CREATE_HELPER::commitZone(), 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 134 of file tool_base.h.

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

References TOOL_BASE::m_toolName.

Referenced by TOOL_MANAGER::dispatchInternal(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::invokeTool(), TOOL_MANAGER::RegisterTool(), 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 109 of file tool_base.h.

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

References TOOL_BASE::m_type.

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

◆ getView()

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

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

It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

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

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

Referenced by EE_POINT_EDITOR::addCornerCondition(), ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), COMMON_TOOLS::CenterContents(), SCH_EDIT_TOOL::ChangeTextType(), EE_INSPECTION_TOOL::CheckSymbol(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::CollectHits(), SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint(), COMMON_TOOLS::CursorControl(), DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), COMMON_TOOLS::doZoomFit(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_EDITOR_CONTROL::FindComponentAndItem(), ROUTER_TOOL::getStartLayer(), PCB_CONTROL::GridResetOrigin(), PCB_CONTROL::GridSetOrigin(), ROUTER_TOOL::handleCommonEvents(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), PCB_SELECTION_TOOL::hitTestDistance(), 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(), PNS::TOOL_BASE::pickSingleItem(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), BOARD_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCB_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), PCB_SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), PCB_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::SelectAll(), PL_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), DRAWING_TOOL::SetAnchor(), 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:215
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:291

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

Referenced by EE_POINT_EDITOR::addCorner(), PCB_POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDITOR_CONTROL::AssignNetclass(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), EDIT_TOOL::copyToClipboard(), 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(), BOARD_INSPECTION_TOOL::HighlightNetTool(), 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(), EDIT_TOOL::updateModificationPoint(), and COMMON_TOOLS::ZoomCenter().

◆ Go()

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

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

No conditions means any event.

Definition at line 128 of file tool_interactive.h.

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

References TOOL_INTERACTIVE::goInternal().

Referenced by AUTOPLACE_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), BOARD_REANNOTATE_TOOL::setTransitions(), GERBVIEW_INSPECTION_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), PCB_PICKER_TOOL::setTransitions(), SCH_NAVIGATE_TOOL::setTransitions(), SYMBOL_EDITOR_PIN_TOOL::setTransitions(), SYMBOL_EDITOR_MOVE_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), EE_POINT_EDITOR::setTransitions(), PL_POINT_EDITOR::setTransitions(), COMMON_CONTROL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), CONVERT_TOOL::setTransitions(), SYMBOL_EDITOR_DRAWING_TOOLS::setTransitions(), MICROWAVE_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), PAD_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PCB_POINT_EDITOR::setTransitions(), GERBVIEW_CONTROL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GROUP_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_EDIT_TOOL::setTransitions(), SYMBOL_EDITOR_CONTROL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), setTransitions(), 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(), PCB_CONTROL::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), DRC_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), BOARD_EDITOR_CONTROL::setTransitions(), BOARD_INSPECTION_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), PCB_SELECTION_TOOL::setTransitions(), PL_SELECTION_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), DRAWING_TOOL::setTransitions(), and EE_SELECTION_TOOL::setTransitions().

◆ ImportWorksheetContent()

int PL_EDIT_TOOL::ImportWorksheetContent ( const TOOL_EVENT aEvent)

Definition at line 308 of file pl_edit_tool.cpp.

309 {
311 
312  wxCommandEvent evt( wxEVT_NULL, ID_APPEND_DESCR_FILE );
313  m_frame->Files_io( evt );
314 
315  return 0;
316 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
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:75
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:215
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
TOOL_MENU & GetToolMenu()
static TOOL_ACTION move
Definition: pl_actions.h:69
static bool NotEmpty(const SELECTION &aSelection)
Test if there are any items selected.
static TOOL_ACTION copy
Definition: actions.h:70
PL_EDITOR_FRAME * m_frame
Definition: pl_edit_tool.h:79
static TOOL_ACTION cut
Definition: actions.h:69
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:71

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:215
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:210
bool IsToolActive(TOOL_ID aId) const
Return true if a tool with given id is active (executing)

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

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

◆ 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  Activate();
123 
124  controls->ShowCursor( true );
125  controls->SetAutoPan( true );
126 
127  bool restore_state = false;
128  bool chain_commands = false;
129  TOOL_EVENT* evt = const_cast<TOOL_EVENT*>( &aEvent );
130  VECTOR2I prevPos;
131 
132  if( !selection.Front()->IsNew() )
134 
135  // Main loop: keep receiving events
136  do
137  {
139 
140  if( evt->IsAction( &PL_ACTIONS::move ) || evt->IsMotion() || evt->IsDrag( BUT_LEFT )
141  || evt->IsAction( &ACTIONS::refreshPreview ) )
142  {
143  //------------------------------------------------------------------------
144  // Start a move operation
145  //
146  if( !m_moveInProgress )
147  {
148  // Apply any initial offset in case we're coming from a previous command.
149  //
150  for( DS_DATA_ITEM* item : unique_peers )
151  moveItem( item, m_moveOffset );
152 
153  // Set up the starting position and move/drag offset
154  //
155  m_cursor = controls->GetCursorPosition();
156 
157  if( selection.HasReferencePoint() )
158  {
159  VECTOR2I delta = m_cursor - selection.GetReferencePoint();
160 
161  // Drag items to the current cursor position
162  for( DS_DATA_ITEM* item : unique_peers )
163  moveItem( item, delta );
164 
165  selection.SetReferencePoint( m_cursor );
166  }
167  else if( selection.Size() == 1 )
168  {
169  // Set the current cursor position to the first dragged item origin,
170  // so the movement vector can be computed later
171  updateModificationPoint( selection );
172  m_cursor = originalCursorPos;
173  }
174  else
175  {
176  updateModificationPoint( selection );
177  }
178 
179  controls->SetCursorPosition( m_cursor, false );
180 
181  prevPos = m_cursor;
182  controls->SetAutoPan( true );
183  m_moveInProgress = true;
184  }
185 
186  //------------------------------------------------------------------------
187  // Follow the mouse
188  //
189  m_cursor = controls->GetCursorPosition();
190  VECTOR2I delta( m_cursor - prevPos );
191  selection.SetReferencePoint( m_cursor );
192 
193  m_moveOffset += delta;
194  prevPos = m_cursor;
195 
196  for( DS_DATA_ITEM* item : unique_peers )
197  moveItem( item, delta );
198 
200  }
201  //------------------------------------------------------------------------
202  // Handle cancel
203  //
204  else if( evt->IsCancelInteractive() || evt->IsActivate() )
205  {
206  if( m_moveInProgress )
207  {
208  evt->SetPassEvent( false );
209  restore_state = true;
210  }
211 
212  break;
213  }
214  //------------------------------------------------------------------------
215  // Handle TOOL_ACTION special cases
216  //
217  else if( evt->Action() == TA_UNDO_REDO_PRE )
218  {
219  unselect = true;
220  break;
221  }
222  else if( evt->Category() == TC_COMMAND )
223  {
224  if( evt->IsAction( &ACTIONS::doDelete ) )
225  {
226  // Exit on a remove operation; there is no further processing for removed items.
227  break;
228  }
229  }
230  //------------------------------------------------------------------------
231  // Handle context menu
232  //
233  else if( evt->IsClick( BUT_RIGHT ) )
234  {
236  }
237  //------------------------------------------------------------------------
238  // Handle drop
239  //
240  else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
241  {
242  break; // Finish
243  }
244  else
245  evt->SetPassEvent();
246 
247  } while( ( evt = Wait() ) ); //Should be assignment not equality test
248 
249  controls->ForceCursorPosition( false );
250  controls->ShowCursor( false );
251  controls->SetAutoPan( false );
252 
253  if( !chain_commands )
254  m_moveOffset = { 0, 0 };
255 
256  selection.ClearReferencePoint();
257 
258  for( auto item : selection )
259  item->ClearEditFlags();
260 
261  if( unselect )
263 
264  if( restore_state )
266  else
267  m_frame->OnModify();
268 
269  m_moveInProgress = false;
270  m_frame->PopTool( tool );
271  return 0;
272 }
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:72
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:257
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:75
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:251
bool IsClick(int aButtonMask=BUT_ANY) const
Definition: tool_event.cpp:181
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
bool IsMotion() const
Definition: tool_event.h:316
void moveItem(DS_DATA_ITEM *aItem, VECTOR2I aDelta)
Return the right modification point (e.g.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
VECTOR2I m_cursor
Definition: pl_edit_tool.h:90
static TOOL_ACTION move
Definition: pl_actions.h:69
TOOL_EVENT_CATEGORY Category() const
Returns more specific information about the type of an event.
Definition: tool_event.h:248
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:206
bool IsCancelInteractive() const
Indicate the event should restart/end an ongoing interactive tool's event loop (eg esc key,...
Definition: tool_event.cpp:193
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:70
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:306
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:173
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:311
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:122
static TOOL_ACTION clearSelection
Clear the current selection.
Definition: pl_actions.h:47
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:471
DS_DATA_ITEM * GetPeer() const
Definition: ds_draw_item.h:63
bool IsActivate() const
Definition: tool_event.h:331
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:150
void SaveCopyInUndoList()
Save a copy of the description (in a S expr string) for Undo/redo commands.
void Activate()
Run the tool.
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.
Definition: tool_manager.h:267
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:109
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, 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,
VECTOR2I  aDelta 
)
private

Return the right modification point (e.g.

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

Definition at line 275 of file pl_edit_tool.cpp.

276 {
277  aItem->MoveToUi( aItem->GetStartPosUi() + (wxPoint) aDelta );
278 
279  for( DS_DRAW_ITEM_BASE* item : aItem->GetDrawItems() )
280  {
281  getView()->Update( item );
282  item->SetFlags( IS_MOVED );
283  }
284 }
Base class to handle basic graphic items.
Definition: ds_draw_item.h:58
const std::vector< DS_DRAW_ITEM_BASE * > & GetDrawItems() const
Definition: ds_data_item.h:111
#define IS_MOVED
Item being moved.
Definition: eda_item.h:106
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
void MoveToUi(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:1503
const wxPoint GetStartPosUi(int ii=0) const

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

Referenced by Main().

◆ Paste()

int PL_EDIT_TOOL::Paste ( const TOOL_EVENT aEvent)

Definition at line 484 of file pl_edit_tool.cpp.

485 {
486  PL_SELECTION& selection = m_selectionTool->GetSelection();
488  std::string sexpr = m_toolMgr->GetClipboardUTF8();
489 
491 
492  model.SetPageLayout( sexpr.c_str(), true, wxT( "clipboard" ) );
493 
494  // Build out draw items and select the first of each data item
495  for( DS_DATA_ITEM* dataItem : model.GetItems() )
496  {
497  if( dataItem->GetDrawItems().empty() )
498  {
499  dataItem->SyncDrawItems( nullptr, getView() );
500  dataItem->GetDrawItems().front()->SetSelected();
501  }
502  }
503 
505 
506  if( !selection.Empty() )
507  {
508  selection.SetReferencePoint( selection.GetTopLeftItem()->GetPosition() );
510  }
511 
512  return 0;
513 }
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:215
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:141
std::vector< DS_DATA_ITEM * > & GetItems()
static TOOL_ACTION move
Definition: pl_actions.h:69
virtual wxPoint GetPosition() const
Definition: eda_item.h:302
PL_SELECTION & GetSelection()
Return the set of currently selected items.
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:264
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:122
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 437 of file pl_edit_tool.cpp.

438 {
440  return 0;
441 }
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:81
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:215
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:215
void SetTool(TOOL_INTERACTIVE *aTool)
Set a tool that is the creator of the menu.
void ScheduleContextMenu(TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Set behavior of the tool's context popup menu.

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

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

◆ setTransitions()

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

517 {
518  Go( &PL_EDIT_TOOL::Main, PL_ACTIONS::move.MakeEvent() );
519 
521 
522  Go( &PL_EDIT_TOOL::Undo, ACTIONS::undo.MakeEvent() );
523  Go( &PL_EDIT_TOOL::Redo, ACTIONS::redo.MakeEvent() );
524 
525  Go( &PL_EDIT_TOOL::Cut, ACTIONS::cut.MakeEvent() );
526  Go( &PL_EDIT_TOOL::Copy, ACTIONS::copy.MakeEvent() );
527  Go( &PL_EDIT_TOOL::Paste, ACTIONS::paste.MakeEvent() );
529 
531 }
int DeleteItemCursor(const TOOL_EVENT &aEvent)
static TOOL_ACTION doDelete
Definition: actions.h:75
int Paste(const TOOL_EVENT &aEvent)
int Cut(const TOOL_EVENT &aEvent)
static TOOL_ACTION move
Definition: pl_actions.h:69
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.
static TOOL_ACTION copy
Definition: actions.h:70
int Undo(const TOOL_EVENT &aEvent)
static TOOL_ACTION cut
Definition: actions.h:69
int Copy(const TOOL_EVENT &aEvent)
static TOOL_ACTION redo
Definition: actions.h:68
int DoDelete(const TOOL_EVENT &aEvent)
Delete the selected items, or the item under the cursor.
int ImportWorksheetContent(const TOOL_EVENT &aEvent)
static TOOL_ACTION appendImportedWorksheet
Definition: pl_actions.h:66
static TOOL_ACTION deleteTool
Definition: actions.h:76
static TOOL_ACTION undo
Definition: actions.h:67
static TOOL_ACTION paste
Definition: actions.h:71
int Redo(const TOOL_EVENT &aEvent)

References PL_ACTIONS::appendImportedWorksheet, Copy(), ACTIONS::copy, Cut(), ACTIONS::cut, DeleteItemCursor(), ACTIONS::deleteTool, DoDelete(), ACTIONS::doDelete, TOOL_INTERACTIVE::Go(), ImportWorksheetContent(), 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 430 of file pl_edit_tool.cpp.

431 {
433  return 0;
434 }
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 287 of file pl_edit_tool.cpp.

288 {
289  if( m_moveInProgress && aSelection.HasReferencePoint() )
290  return false;
291 
292  // When there is only one item selected, the reference point is its position...
293  if( aSelection.Size() == 1 )
294  {
295  aSelection.SetReferencePoint( aSelection.Front()->GetPosition() );
296  }
297  // ...otherwise modify items with regard to the grid-snapped cursor position
298  else
299  {
301  aSelection.SetReferencePoint( m_cursor );
302  }
303 
304  return true;
305 }
VECTOR2I m_cursor
Definition: pl_edit_tool.h:90
virtual wxPoint GetPosition() const
Definition: eda_item.h:302
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:264
bool m_moveInProgress
Used for chaining commands.
Definition: pl_edit_tool.h:83
bool HasReferencePoint() const
Definition: selection.h:254
int Size() const
Returns the number of selected parts.
Definition: selection.h:128
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:203

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:215
TOOL_EVENT * ScheduleWait(TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions)
Pause execution of a given tool until one or more events matching aConditions arrives.

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

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), 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(), ImportWorksheetContent(), 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 106 of file tool_interactive.h.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), 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(), GERBVIEW_SELECTION_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), EDA_3D_CONTROLLER::Init(), DRAWING_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), PCB_SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), PCB_TOOL_BASE::Init(), PICKER_TOOL::Init(), DRAWING_TOOL::InteractivePlaceWithPreview(), PCB_PICKER_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), EDA_3D_CONTROLLER::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), 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 210 of file tool_base.h.

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

◆ m_toolMgr

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 215 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), PL_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemsToSel(), PL_SELECTION_TOOL::AddItemToSel(), PCB_SELECTION_TOOL::AddItemToSel(), EE_SELECTION_TOOL::AddItemToSel(), SCH_MOVE_TOOL::AlignElements(), SCH_EDITOR_CONTROL::AssignNetclass(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), SCH_EDIT_TOOL::BreakWire(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), GERBVIEW_CONTROL::ClearAllLayers(), BOARD_INSPECTION_TOOL::ClearHighlight(), SCH_EDITOR_CONTROL::ClearHighlight(), PL_SELECTION_TOOL::ClearSelection(), PCB_SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), 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(), 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(), SCH_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), SYMBOL_EDITOR_EDIT_TOOL::editGraphicProperties(), PAD_TOOL::EditPad(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), GROUP_TOOL::EnterGroup(), SCH_NAVIGATE_TOOL::EnterSheet(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), EE_INSPECTION_TOOL::ExcludeMarker(), PCB_SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), PCB_SELECTION_TOOL::filterSelection(), PCB_SELECTION_TOOL::findCallback(), SCH_EDITOR_CONTROL::FindComponentAndItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), EDIT_TOOL::GetAndPlace(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), EE_SELECTION_TOOL::GetNode(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getToolHolderInt(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), COMMON_TOOLS::GridNext(), COMMON_TOOLS::GridPreset(), COMMON_TOOLS::GridPrev(), PCB_CONTROL::GridSetOrigin(), GROUP_TOOL::Group(), EE_SELECTION_TOOL::GuessSelectionCandidates(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::HighlightItem(), BOARD_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), BOARD_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), ImportWorksheetContent(), SYMBOL_EDITOR_EDIT_TOOL::Init(), Init(), SCH_EDIT_TOOL::Init(), PAD_TOOL::Init(), GROUP_TOOL::Init(), CONVERT_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), PL_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_CONTROL::Init(), PL_POINT_EDITOR::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), PCB_POINT_EDITOR::Init(), POSITION_RELATIVE_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), BOARD_INSPECTION_TOOL::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(), Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), CVPCB_CONTROL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), BOARD_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), SYMBOL_EDITOR_CONTROL::OnDeMorgan(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), 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::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(), BOARD_INSPECTION_TOOL::UpdateSelectionRatsnest(), PNS::TOOL_BASE::updateStartItem(), BOARD_EDITOR_CONTROL::ViaSizeDec(), BOARD_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), BOARD_EDITOR_CONTROL::ZoneDuplicate(), and BOARD_EDITOR_CONTROL::ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Definition at line 214 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

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

Definition at line 207 of file tool_base.h.

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


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