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 }
 

Determines the reason of reset for a tool

More...
 

Public Member Functions

 PL_EDIT_TOOL ()
 
 ~PL_EDIT_TOOL ()
 
bool Init () override
 Function Init() Init() is called once upon a registration of the tool. More...
 
void Reset (RESET_REASON aReason) override
 Function Reset() Brings 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)
 Function DoDelete() More...
 
int DeleteItemCursor (const TOOL_EVENT &aEvent)
 

Runs the deletion tool.

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

Protected Member Functions

void attachManager (TOOL_MANAGER *aManager)
 Function attachManager() More...
 
KIGFX::VIEWgetView () const
 Function getView() More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Function getViewControls() More...
 
template<typename T >
T * getEditFrame () const
 Function getEditFrame() More...
 
template<typename T >
T * getModel () const
 Function getModel() More...
 

Protected Attributes

TOOL_MENU m_menu
 functions below are not yet implemented - their interface may change More...
 
TOOL_TYPE m_type
 

Stores the type of the tool.

More...
 
TOOL_ID m_toolId
 

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

More...
 
std::string m_toolName
 

Name of the tool.

More...
 
TOOL_MANAGERm_toolMgr
 
TOOL_SETTINGS m_toolSettings
 

Private Member Functions

void moveItem (EDA_ITEM *aItem, VECTOR2I aDelta)
 
bool updateModificationPoint (PL_SELECTION &aSelection)
 

Returns the right modification point (e.g.

More...
 
void setTransitions () override
 

Sets up handlers for various events.

More...
 

Private Attributes

PL_EDITOR_FRAMEm_frame
 
PL_SELECTION_TOOLm_selectionTool
 
bool m_moveInProgress
 

Flag determining if anything is being dragged right now

More...
 
VECTOR2I m_moveOffset
 

Used for chaining commands

More...
 
VECTOR2I m_cursor
 

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

More...
 
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

Determines the reason of reset for a tool

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 79 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ PL_EDIT_TOOL()

PL_EDIT_TOOL::PL_EDIT_TOOL ( )

Definition at line 39 of file pl_edit_tool.cpp.

39  :
40  TOOL_INTERACTIVE( "plEditor.InteractiveEdit" ),
41  m_frame( nullptr ),
42  m_selectionTool( nullptr )
43 {
44 }
PL_SELECTION_TOOL * m_selectionTool
Definition: pl_edit_tool.h:82
TOOL_INTERACTIVE(TOOL_ID aId, const std::string &aName)
Constructor.
PL_EDITOR_FRAME * m_frame
Definition: pl_edit_tool.h:81

◆ ~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

Function Activate() Runs 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:219
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls a tool by sending a tool activation event to tool of given ID.

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

Referenced by AUTOPLACE_TOOL::autoplace(), EDIT_TOOL::copyToClipboard(), LIB_EDIT_TOOL::DeleteItemCursor(), DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), Main(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::Move(), LIB_TREE::onContextMenu(), POINT_EDITOR::OnSelectionChange(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Function attachManager()

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

Definition at line 60 of file tool_base.cpp.

61 {
62  m_toolMgr = aManager;
63  m_toolSettings = TOOL_SETTINGS( this );
64 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:220
friend class TOOL_SETTINGS
Definition: tool_base.h:154

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

Referenced by TOOL_MANAGER::RegisterTool().

◆ Copy()

int PL_EDIT_TOOL::Copy ( const TOOL_EVENT aEvent)

Definition at line 438 of file pl_edit_tool.cpp.

439 {
441  std::vector<WS_DATA_ITEM*> items;
443  wxString sexpr;
444 
445  if( selection.GetSize() == 0 )
446  return 0;
447 
448  for( EDA_ITEM* item : selection.GetItems() )
449  items.push_back( static_cast<WS_DRAW_ITEM_BASE*>( item )->GetPeer() );
450 
451  try
452  {
453  model.SaveInString( items, sexpr );
454  }
455  catch( const IO_ERROR& ioe )
456  {
457  wxMessageBox( ioe.What(), _( "Error writing objects to clipboard" ) );
458  }
459 
460  if( m_toolMgr->SaveClipboard( TO_UTF8( sexpr ) ) )
461  return 0;
462  else
463  return -1;
464 }
WS_DATA_MODEL handles the graphic items list to draw/plot the frame and title block.
Definition: ws_data_model.h:39
PL_SELECTION_TOOL * m_selectionTool
Definition: pl_edit_tool.h:82
bool SaveClipboard(const std::string &aText)
Stores an information to the system clipboard.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
static WS_DATA_MODEL & GetTheInstance()
static function: returns the instance of WS_DATA_MODEL used in the application
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:48
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
const std::deque< EDA_ITEM * > GetItems() const
Definition: selection.h:130
#define _(s)
virtual unsigned int GetSize() const override
Function GetSize() Returns the number of stored items.
Definition: selection.h:98
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
PL_SELECTION & RequestSelection()
Function RequestSelection()
void SaveInString(wxString &aOutputString)
Save the description in a buffer.

References _, SELECTION::GetItems(), SELECTION::GetSize(), WS_DATA_MODEL::GetTheInstance(), m_selectionTool, TOOL_BASE::m_toolMgr, PL_SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::SaveClipboard(), WS_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 427 of file pl_edit_tool.cpp.

428 {
429  int retVal = Copy( aEvent );
430 
431  if( retVal == 0 )
432  retVal = DoDelete( aEvent );
433 
434  return retVal;
435 }
int Copy(const TOOL_EVENT &aEvent)
int DoDelete(const TOOL_EVENT &aEvent)
Function DoDelete()

References Copy(), and DoDelete().

Referenced by setTransitions().

◆ DeleteItemCursor()

int PL_EDIT_TOOL::DeleteItemCursor ( const TOOL_EVENT aEvent)

Runs the deletion tool.

Definition at line 342 of file pl_edit_tool.cpp.

343 {
344  std::string tool = aEvent.GetCommandStr().get();
346 
347  // Deactivate other tools; particularly important if another PICKER is currently running
348  Activate();
349 
350  picker->SetCursor( wxStockCursor( wxCURSOR_BULLSEYE ) );
351  m_pickerItem = nullptr;
352 
353  picker->SetClickHandler(
354  [this] ( const VECTOR2D& aPosition ) -> bool
355  {
356  if( m_pickerItem )
357  {
359  selectionTool->UnbrightenItem( m_pickerItem );
360  selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
362  m_pickerItem = nullptr;
363  }
364 
365  return true;
366  } );
367 
368  picker->SetMotionHandler(
369  [this] ( const VECTOR2D& aPos )
370  {
371  int threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
372  EDA_ITEM* item = nullptr;
373 
374  for( WS_DATA_ITEM* dataItem : WS_DATA_MODEL::GetTheInstance().GetItems() )
375  {
376  for( WS_DRAW_ITEM_BASE* drawItem : dataItem->GetDrawItems() )
377  {
378  if( drawItem->HitTest( (wxPoint) aPos, threshold ) )
379  {
380  item = drawItem;
381  break;
382  }
383  }
384  }
385 
386  if( m_pickerItem != item )
387  {
389 
390  if( m_pickerItem )
391  selectionTool->UnbrightenItem( m_pickerItem );
392 
393  m_pickerItem = item;
394 
395  if( m_pickerItem )
396  selectionTool->BrightenItem( m_pickerItem );
397  }
398  } );
399 
400  picker->SetFinalizeHandler(
401  [this] ( const int& aFinalState )
402  {
403  if( m_pickerItem )
405  } );
406 
407  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
408 
409  return 0;
410 }
void SetCursor(const wxCursor &aCursor)
Definition: picker_tool.h:65
void SetMotionHandler(MOTION_HANDLER aHandler)
Function SetMotionHandler() Sets a handler for mouse motion.
Definition: picker_tool.h:82
Work sheet structure type definitions.
Definition: ws_data_item.h:93
static TOOL_ACTION doDelete
Definition: actions.h:74
void SetClickHandler(CLICK_HANDLER aHandler)
Function SetClickHandler() Sets a handler for mouse click event.
Definition: picker_tool.h:72
void BrightenItem(EDA_ITEM *aItem)
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
int AddItemToSel(const TOOL_EVENT &aEvent)
EDA_ITEM * m_pickerItem
Definition: pl_edit_tool.h:94
static WS_DATA_MODEL & GetTheInstance()
static function: returns the instance of WS_DATA_MODEL used in the application
static TOOL_ACTION pickerTool
Definition: actions.h:145
void SetFinalizeHandler(FINALIZE_HANDLER aHandler)
Function SetFinalizeHandler() Sets a handler for the finalize event.
Definition: picker_tool.h:102
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
#define HITTEST_THRESHOLD_PIXELS
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
void UnbrightenItem(EDA_ITEM *aItem)
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
void Activate()
Function Activate() Runs the tool.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:114

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

Referenced by setTransitions().

◆ DoDelete()

int PL_EDIT_TOOL::DoDelete ( const TOOL_EVENT aEvent)

Function DoDelete()

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

Definition at line 304 of file pl_edit_tool.cpp.

305 {
307 
308  if( selection.Size() == 0 )
309  return 0;
310 
312 
313  while( selection.Front() )
314  {
315  WS_DRAW_ITEM_BASE* drawItem = static_cast<WS_DRAW_ITEM_BASE*>( selection.Front() );
316  WS_DATA_ITEM* dataItem = drawItem->GetPeer();
318 
319  for( WS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
320  {
321  // Note: repeat items won't be selected but must be removed & deleted
322 
323  if( item->IsSelected() )
325 
326  getView()->Remove( item );
327  delete item;
328  }
329 
330  delete dataItem;
331  }
332 
333  m_frame->OnModify();
334 
335  return 0;
336 }
WS_DATA_ITEM * GetPeer() const
Definition: ws_draw_item.h:66
void SaveCopyInUndoList(bool aSavePageSettingsAndTitleBlock=false)
Save a copy of the description (in a S expr string) for Undo/redo commands.
int RemoveItemFromSel(const TOOL_EVENT &aEvent)
Work sheet structure type definitions.
Definition: ws_data_item.h:93
PL_SELECTION_TOOL * m_selectionTool
Definition: pl_edit_tool.h:82
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:376
static WS_DATA_MODEL & GetTheInstance()
static function: returns the instance of WS_DATA_MODEL used in the application
void OnModify()
Must be called after a change in order to set the "modify" flag.
PL_EDITOR_FRAME * m_frame
Definition: pl_edit_tool.h:81
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
void Remove(WS_DATA_ITEM *aItem)
int Size() const
Returns the number of selected parts.
Definition: selection.h:125
PL_SELECTION & RequestSelection()
Function RequestSelection()
EDA_ITEM * Front() const
Definition: selection.h:182

References SELECTION::Front(), WS_DRAW_ITEM_BASE::GetPeer(), WS_DATA_MODEL::GetTheInstance(), TOOL_BASE::getView(), m_frame, m_selectionTool, PL_EDITOR_FRAME::OnModify(), KIGFX::VIEW::Remove(), WS_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

Function getEditFrame()

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

Definition at line 187 of file tool_base.h.

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

References TOOL_BASE::getEditFrameInt().

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

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

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

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 121 of file tool_base.h.

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

References TOOL_BASE::m_toolId.

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

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

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

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

Definition at line 143 of file tool_base.h.

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

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

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 201 of file tool_base.h.

202  {
203  EDA_ITEM* m = getModelInt();
204 #if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
205  wxASSERT( dynamic_cast<T*>( m ) );
206 #endif
207  return static_cast<T*>( m );
208  }
EDA_ITEM * getModelInt() const
Definition: tool_base.cpp:54
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163

References TOOL_BASE::getModelInt().

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

◆ GetName()

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

Function GetName() Returns the name of the tool.

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

Returns
The name of the tool.

Definition at line 132 of file tool_base.h.

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

References TOOL_BASE::m_toolName.

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

◆ GetSettings()

TOOL_SETTINGS & TOOL_BASE::GetSettings ( )
inherited

Definition at line 78 of file tool_base.cpp.

79 {
80  return m_toolSettings;
81 }
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:220

References TOOL_BASE::m_toolSettings.

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

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 110 of file tool_base.h.

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

References TOOL_BASE::m_type.

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

◆ getView()

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

Function getView()

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

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

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

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(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), COMMON_TOOLS::CursorControl(), LIB_EDIT_TOOL::DeleteItemCursor(), DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), DoDelete(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), MICROWAVE_TOOL::drawMicrowaveInductor(), PL_DRAWING_TOOLS::DrawShape(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), COMMON_TOOLS::GridPreset(), PCBNEW_CONTROL::GridResetOrigin(), PCBNEW_CONTROL::GridSetOrigin(), SELECTION_TOOL::GuessSelectionCandidates(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), PCB_INSPECTION_TOOL::highlightNet(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), moveItem(), POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), LIB_EDIT_TOOL::Paste(), Paste(), SCH_EDITOR_CONTROL::Paste(), PNS::TOOL_BASE::pickSingleItem(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), PCB_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), SELECTION_TOOL::Selectable(), PL_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), EE_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), PL_EDITOR_CONTROL::ToggleBackgroundColor(), COMMON_TOOLS::ToggleGrid(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), PL_SELECTION_TOOL::unhighlight(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), SCH_EDITOR_CONTROL::UpdateFind(), PCBNEW_CONTROL::updateGrid(), EE_POINT_EDITOR::updateItem(), PL_POINT_EDITOR::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateView(), PCB_TOOL_BASE::view(), COMMON_TOOLS::ZoomFitScreen(), SELECTION_TOOL::zoomFitSelection(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and SELECTION_TOOL::~SELECTION_TOOL().

◆ getViewControls()

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

Function getViewControls()

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

Returns
The instance of VIEW_CONTROLS.

Definition at line 42 of file tool_base.cpp.

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

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

Referenced by EE_POINT_EDITOR::addCorner(), POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), COMMON_TOOLS::CursorControl(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), COMMON_TOOLS::GridPreset(), PCB_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_INSPECTION_TOOL::HighlightNetTool(), MODULE_EDITOR_TOOLS::ImportFootprint(), Main(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::Move(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), LIB_DRAWING_TOOLS::PlaceAnchor(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::RepeatDrawItem(), PL_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), SELECTION_TOOL::selectCursor(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PICKER_TOOL::setControls(), PCBNEW_PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), LIB_MOVE_TOOL::updateModificationPoint(), updateModificationPoint(), EDIT_TOOL::updateModificationPoint(), and COMMON_TOOLS::ZoomCenter().

◆ Go()

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

Function Go()

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

Definition at line 129 of file tool_interactive.h.

131 {
132  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
133 
134  goInternal( sptr, aConditions );
135 }
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 LENGTH_TUNER_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), AUTOPLACE_TOOL::setTransitions(), MICROWAVE_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_CONTROL::setTransitions(), LIB_PIN_TOOL::setTransitions(), PAD_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), COMMON_CONTROL::setTransitions(), LIB_DRAWING_TOOLS::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), EE_POINT_EDITOR::setTransitions(), SCH_MOVE_TOOL::setTransitions(), PL_POINT_EDITOR::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), LIB_MOVE_TOOL::setTransitions(), GERBVIEW_CONTROL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), POINT_EDITOR::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), LIB_CONTROL::setTransitions(), LIB_EDIT_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), SCH_EDIT_TOOL::setTransitions(), setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), PCB_INSPECTION_TOOL::setTransitions(), PCBNEW_CONTROL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), MODULE_EDITOR_TOOLS::setTransitions(), CVPCB_CONTROL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), PCBNEW_PICKER_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), PCB_EDITOR_CONTROL::setTransitions(), DRAWING_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), SELECTION_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), PL_SELECTION_TOOL::setTransitions(), EE_SELECTION_TOOL::setTransitions(), and DRC::setTransitions().

◆ ImportWorksheetContent()

int PL_EDIT_TOOL::ImportWorksheetContent ( const TOOL_EVENT aEvent)

Definition at line 293 of file pl_edit_tool.cpp.

294 {
296 
297  wxCommandEvent evt( wxEVT_NULL, ID_APPEND_DESCR_FILE );
298  m_frame->Files_io( evt );
299 
300  return 0;
301 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
PL_EDITOR_FRAME * m_frame
Definition: pl_edit_tool.h:81
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

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

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

Reimplemented from TOOL_BASE.

Definition at line 47 of file pl_edit_tool.cpp.

48 {
49  m_frame = getEditFrame<PL_EDITOR_FRAME>();
51 
52  wxASSERT_MSG( m_selectionTool, "plEditor.InteractiveSelection tool is not available" );
53 
54  CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
55 
56  // cancel current tool goes in main context menu at the top if present
58 
59  ctxMenu.AddSeparator( 200 );
61 
62  // Finally, add the standard zoom/grid items
64 
65  //
66  // Add editing actions to the selection tool menu
67  //
69 
75 
76  return true;
77 }
static bool ShowAlways(const SELECTION &aSelection)
Function ShowAlways The default condition function (always returns true).
void AddStandardSubMenus(TOOL_MENU &aMenu)
Function CreateBasicMenu.
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
static TOOL_ACTION doDelete
Definition: actions.h:74
PL_SELECTION_TOOL * m_selectionTool
Definition: pl_edit_tool.h:82
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
TOOL_MENU & GetToolMenu()
static TOOL_ACTION move
Definition: pl_actions.h:71
static bool NotEmpty(const SELECTION &aSelection)
Function NotEmpty Tests if there are any items selected.
static TOOL_ACTION copy
Definition: actions.h:70
PL_EDITOR_FRAME * m_frame
Definition: pl_edit_tool.h:81
static TOOL_ACTION cut
Definition: actions.h:69
void AddSeparator(int aOrder=ANY_ORDER)
Function AddSeparator()
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Function AddItem()
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:219
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214
bool IsToolActive(TOOL_ID aId) const
Function IsToolActive() Returns true if a tool with given id is active (executing)

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

◆ Main()

int PL_EDIT_TOOL::Main ( const TOOL_EVENT aEvent)

The "move" event loop.

Definition at line 87 of file pl_edit_tool.cpp.

88 {
90 
91  controls->SetSnapping( true );
92  VECTOR2I originalCursorPos = controls->GetCursorPosition();
93 
94  // Be sure that there is at least one item that we can move. If there's no selection try
95  // looking for the stuff under mouse cursor (i.e. Kicad old-style hover selection).
97  bool unselect = selection.IsHover();
98 
99  if( selection.Empty() || m_moveInProgress )
100  return 0;
101 
102  std::string tool = aEvent.GetCommandStr().get();
103  m_frame->PushTool( tool );
104  Activate();
105 
106  controls->ShowCursor( true );
107  controls->SetAutoPan( true );
108 
109  bool restore_state = false;
110  bool chain_commands = false;
111  TOOL_EVENT* evt = const_cast<TOOL_EVENT*>( &aEvent );
112  VECTOR2I prevPos;
113 
114  if( !selection.Front()->IsNew() )
116 
117  // Main loop: keep receiving events
118  do
119  {
120  m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
121  controls->SetSnapping( !evt->Modifier( MD_ALT ) );
122 
123  if( evt->IsAction( &PL_ACTIONS::move ) || evt->IsMotion() || evt->IsDrag( BUT_LEFT )
124  || evt->IsAction( &ACTIONS::refreshPreview ) )
125  {
126  //------------------------------------------------------------------------
127  // Start a move operation
128  //
129  if( !m_moveInProgress )
130  {
131  // Apply any initial offset in case we're coming from a previous command.
132  //
133  for( EDA_ITEM* item : selection )
134  moveItem( item, m_moveOffset );
135 
136  // Set up the starting position and move/drag offset
137  //
138  m_cursor = controls->GetCursorPosition();
139 
140  if( selection.HasReferencePoint() )
141  {
142  VECTOR2I delta = m_cursor - selection.GetReferencePoint();
143 
144  // Drag items to the current cursor position
145  for( EDA_ITEM* item : selection )
146  moveItem( item, delta );
147 
148  selection.SetReferencePoint( m_cursor );
149  }
150  else if( selection.Size() == 1 )
151  {
152  // Set the current cursor position to the first dragged item origin,
153  // so the movement vector can be computed later
154  updateModificationPoint( selection );
155  m_cursor = originalCursorPos;
156  }
157  else
158  {
159  updateModificationPoint( selection );
160  }
161 
162  controls->SetCursorPosition( m_cursor, false );
163 
164  prevPos = m_cursor;
165  controls->SetAutoPan( true );
166  m_moveInProgress = true;
167  }
168 
169  //------------------------------------------------------------------------
170  // Follow the mouse
171  //
172  m_cursor = controls->GetCursorPosition();
173  VECTOR2I delta( m_cursor - prevPos );
174  selection.SetReferencePoint( m_cursor );
175 
176  m_moveOffset += delta;
177  prevPos = m_cursor;
178 
179  for( EDA_ITEM* item : selection )
180  moveItem( item, delta );
181 
183  }
184  //------------------------------------------------------------------------
185  // Handle cancel
186  //
187  else if( evt->IsCancelInteractive() || evt->IsActivate() )
188  {
189  if( m_moveInProgress )
190  restore_state = true;
191 
192  break;
193  }
194  //------------------------------------------------------------------------
195  // Handle TOOL_ACTION special cases
196  //
197  else if( evt->Action() == TA_UNDO_REDO_PRE )
198  {
199  unselect = true;
200  break;
201  }
202  else if( evt->Category() == TC_COMMAND )
203  {
204  if( evt->IsAction( &ACTIONS::doDelete ) )
205  {
206  // Exit on a remove operation; there is no further processing for removed items.
207  break;
208  }
209  }
210  //------------------------------------------------------------------------
211  // Handle context menu
212  //
213  else if( evt->IsClick( BUT_RIGHT ) )
214  {
216  }
217  //------------------------------------------------------------------------
218  // Handle drop
219  //
220  else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
221  {
222  break; // Finish
223  }
224  else
225  evt->SetPassEvent();
226 
227  } while( ( evt = Wait() ) ); //Should be assignment not equality test
228 
229  controls->ForceCursorPosition( false );
230  controls->ShowCursor( false );
231  controls->SetSnapping( false );
232  controls->SetAutoPan( false );
233 
234  if( !chain_commands )
235  m_moveOffset = { 0, 0 };
236 
237  selection.ClearReferencePoint();
238 
239  for( auto item : selection )
240  item->ClearEditFlags();
241 
242  if( unselect )
244 
245  if( restore_state )
247  else
248  m_frame->OnModify();
249 
250  m_moveInProgress = false;
251  m_frame->PopTool( tool );
252  return 0;
253 }
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
void SaveCopyInUndoList(bool aSavePageSettingsAndTitleBlock=false)
Save a copy of the description (in a S expr string) for Undo/redo commands.
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
bool IsHover() const
Definition: selection.h:69
PL_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
bool updateModificationPoint(PL_SELECTION &aSelection)
Returns the right modification point (e.g.
static TOOL_ACTION doDelete
Definition: actions.h:74
PL_SELECTION_TOOL * m_selectionTool
Definition: pl_edit_tool.h:82
void SetCurrentCursor(wxStockCursor aStockCursorID)
Function SetCurrentCursor Set the current cursor shape for this panel.
TOOL_ACTIONS Action() const
Returns more specific information about the type of an event.
Definition: tool_event.h:250
bool IsClick(int aButtonMask=BUT_ANY) const
Definition: tool_event.cpp:178
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool IsMotion() const
Definition: tool_event.h:306
virtual void SetSnapping(bool aEnabled)
Function SetSnapping() Enables/disables snapping cursor to grid.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
VECTOR2I m_cursor
Last cursor position (needed for getModificationPoint() to avoid changes of edit reference point).
Definition: pl_edit_tool.h:92
static TOOL_ACTION move
Definition: pl_actions.h:71
TOOL_EVENT_CATEGORY Category() const
Returns the category (eg. mouse/keyboard/action) of an event..
Definition: tool_event.h:247
PL_SELECTION & GetSelection()
Function GetSelection()
static const TOOL_EVENT SelectedItemsModified
Definition: actions.h:201
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:67
bool IsNew() const
Definition: base_struct.h:228
void OnModify()
Must be called after a change in order to set the "modify" flag.
bool IsDrag(int aButtonMask=BUT_ANY) const
Definition: tool_event.h:296
VECTOR2I m_moveOffset
Used for chaining commands
Definition: pl_edit_tool.h:88
Class TOOL_EVENT.
Definition: tool_event.h:171
PL_EDITOR_FRAME * m_frame
Definition: pl_edit_tool.h:81
void SetPassEvent()
Definition: tool_event.h:256
Class VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (...
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Function ForceCursorPosition() Places the cursor immediately at a given point.
bool m_moveInProgress
Flag determining if anything is being dragged right now
Definition: pl_edit_tool.h:85
bool IsMouseUp(int aButtonMask=BUT_ANY) const
Definition: tool_event.h:301
void moveItem(EDA_ITEM *aItem, VECTOR2I aDelta)
bool IsCancelInteractive()
Function IsCancelInteractive()
Definition: tool_event.cpp:190
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns 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:119
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: pl_actions.h:49
int Modifier(int aMask=MD_MODIFIER_MASK) const
Returns information about key modifiers state (Ctrl, Alt, etc.)
Definition: tool_event.h:342
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
bool IsActivate() const
Definition: tool_event.h:321
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
virtual void PopTool(const std::string &actionName)
void Activate()
Function Activate() Runs the tool.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
void RollbackFromUndo()
Apply the last command in Undo List without stacking a Redo.
void PostEvent(const TOOL_EVENT &aEvent)
Puts an event to the event queue to be processed at the end of event processing cycle.
Definition: tool_manager.h:237
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
PL_SELECTION & RequestSelection()
Function RequestSelection()
static TOOL_ACTION refreshPreview
Definition: actions.h:101
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false)=0
Moves cursor to the requested position expressed in world coordinates.
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
EDA_ITEM * Front() const
Definition: selection.h:182

References TOOL_EVENT::Action(), TOOL_INTERACTIVE::Activate(), BUT_LEFT, BUT_RIGHT, TOOL_EVENT::Category(), SELECTION::ClearReferencePoint(), PL_ACTIONS::clearSelection, ACTIONS::doDelete, SELECTION::Empty(), KIGFX::VIEW_CONTROLS::ForceCursorPosition(), SELECTION::Front(), PL_EDITOR_FRAME::GetCanvas(), TOOL_EVENT::GetCommandStr(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), 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(), EDA_ITEM::IsNew(), m_cursor, m_frame, TOOL_INTERACTIVE::m_menu, m_moveInProgress, m_moveOffset, m_selectionTool, TOOL_BASE::m_toolMgr, MD_ALT, TOOL_EVENT::Modifier(), PL_ACTIONS::move, moveItem(), PL_EDITOR_FRAME::OnModify(), EDA_BASE_FRAME::PopTool(), TOOL_MANAGER::PostEvent(), EDA_BASE_FRAME::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(), SELECTION::SetReferencePoint(), KIGFX::VIEW_CONTROLS::SetSnapping(), 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 ( EDA_ITEM aItem,
VECTOR2I  aDelta 
)
private

Definition at line 256 of file pl_edit_tool.cpp.

257 {
258  WS_DRAW_ITEM_BASE* drawItem = static_cast<WS_DRAW_ITEM_BASE*>( aItem );
259  WS_DATA_ITEM* dataItem = drawItem->GetPeer();
260 
261  dataItem->MoveToUi( dataItem->GetStartPosUi() + (wxPoint) aDelta );
262 
263  for( WS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
264  {
265  getView()->Update( item );
266  item->SetFlags( IS_MOVED );
267  }
268 }
WS_DATA_ITEM * GetPeer() const
Definition: ws_draw_item.h:66
void MoveToUi(wxPoint aPosition)
move item to a new position
Work sheet structure type definitions.
Definition: ws_data_item.h:93
const wxPoint GetStartPosUi(int ii=0) const
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
const std::vector< WS_DRAW_ITEM_BASE * > & GetDrawItems() const
Definition: ws_data_item.h:128
#define IS_MOVED
Item being moved.
Definition: base_struct.h:119

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

Referenced by Main().

◆ Paste()

int PL_EDIT_TOOL::Paste ( const TOOL_EVENT aEvent)

Definition at line 467 of file pl_edit_tool.cpp.

468 {
469  PL_SELECTION& selection = m_selectionTool->GetSelection();
471  std::string sexpr = m_toolMgr->GetClipboard();
472 
474 
475  model.SetPageLayout( sexpr.c_str(), true, wxT( "clipboard" ) );
476 
477  // Build out draw items and select the first of each data item
479  {
480  if( dataItem->GetDrawItems().empty() )
481  {
482  dataItem->SyncDrawItems( nullptr, getView() );
483  dataItem->GetDrawItems().front()->SetSelected();
484  }
485  }
486 
488 
489  if( !selection.Empty() )
490  {
491  WS_DRAW_ITEM_BASE* item = (WS_DRAW_ITEM_BASE*) selection.GetTopLeftItem();
492 
493  selection.SetReferencePoint( item->GetPosition() );
495  }
496 
497  return 0;
498 }
WS_DATA_MODEL handles the graphic items list to draw/plot the frame and title block.
Definition: ws_data_model.h:39
void RebuildSelection()
Rebuild the selection from the flags in the view items.
Work sheet structure type definitions.
Definition: ws_data_item.h:93
PL_SELECTION_TOOL * m_selectionTool
Definition: pl_edit_tool.h:82
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
int ClearSelection(const TOOL_EVENT &aEvent)
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
static TOOL_ACTION move
Definition: pl_actions.h:71
void SetPageLayout(const wxString &aFullFileName=wxEmptyString, bool Append=false)
Populates the list with a custom layout, or the default layout, if no custom layout available.
std::vector< WS_DATA_ITEM * > & GetItems()
PL_SELECTION & GetSelection()
Function GetSelection()
static WS_DATA_MODEL & GetTheInstance()
static function: returns the instance of WS_DATA_MODEL used in the application
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:243
EDA_ITEM * GetTopLeftItem(bool onlyModules=false) const override
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:119
virtual const wxPoint GetPosition() const =0
std::string GetClipboard() const
Returns the information currently stored in the system clipboard.

References PL_SELECTION_TOOL::ClearSelection(), SELECTION::Empty(), TOOL_MANAGER::GetClipboard(), WS_DATA_MODEL::GetItems(), WS_DRAW_ITEM_BASE::GetPosition(), PL_SELECTION_TOOL::GetSelection(), WS_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(), WS_DATA_MODEL::SetPageLayout(), and SELECTION::SetReferencePoint().

Referenced by setTransitions().

◆ Redo()

int PL_EDIT_TOOL::Redo ( const TOOL_EVENT aEvent)

Definition at line 420 of file pl_edit_tool.cpp.

421 {
423  return 0;
424 }
void GetLayoutFromRedoList()
Redo the last edit:
PL_EDITOR_FRAME * m_frame
Definition: pl_edit_tool.h:81

References PL_EDITOR_FRAME::GetLayoutFromRedoList(), and m_frame.

Referenced by setTransitions().

◆ Reset()

void PL_EDIT_TOOL::Reset ( RESET_REASON  aReason)
overridevirtual

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

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

Parameters
aReasoncontains information about the reason of tool reset.

Implements TOOL_BASE.

Definition at line 80 of file pl_edit_tool.cpp.

81 {
82  if( aReason == MODEL_RELOAD )
83  m_frame = getEditFrame<PL_EDITOR_FRAME>();
84 }
Model changes (required full reload)
Definition: tool_base.h:82
PL_EDITOR_FRAME * m_frame
Definition: pl_edit_tool.h:81

References m_frame, and TOOL_BASE::MODEL_RELOAD.

◆ RunMainStack()

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

Function RunMainStack()

Calls a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 87 of file tool_interactive.cpp.

88 {
89  m_toolMgr->RunMainStack( this, std::move( aFunc ) );
90 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
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

Function SetContextMenu()

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

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

Definition at line 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:219
void SetTool(TOOL_INTERACTIVE *aTool)
Function SetTool() Sets a tool that is the creator of the menu.
void ScheduleContextMenu(TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Sets behaviour of the tool's context popup menu.

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

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ setTransitions()

void PL_EDIT_TOOL::setTransitions ( )
overrideprivatevirtual

Sets up handlers for various events.

Implements TOOL_INTERACTIVE.

Definition at line 501 of file pl_edit_tool.cpp.

502 {
503  Go( &PL_EDIT_TOOL::Main, PL_ACTIONS::move.MakeEvent() );
504 
506 
507  Go( &PL_EDIT_TOOL::Undo, ACTIONS::undo.MakeEvent() );
508  Go( &PL_EDIT_TOOL::Redo, ACTIONS::redo.MakeEvent() );
509 
510  Go( &PL_EDIT_TOOL::Cut, ACTIONS::cut.MakeEvent() );
511  Go( &PL_EDIT_TOOL::Copy, ACTIONS::copy.MakeEvent() );
512  Go( &PL_EDIT_TOOL::Paste, ACTIONS::paste.MakeEvent() );
514 
516 }
int DeleteItemCursor(const TOOL_EVENT &aEvent)
Runs the deletion tool.
static TOOL_ACTION doDelete
Definition: actions.h:74
int Paste(const TOOL_EVENT &aEvent)
int Cut(const TOOL_EVENT &aEvent)
static TOOL_ACTION move
Definition: pl_actions.h:71
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
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)
Function DoDelete()
int ImportWorksheetContent(const TOOL_EVENT &aEvent)
static TOOL_ACTION appendImportedWorksheet
Definition: pl_actions.h:68
static TOOL_ACTION deleteTool
Definition: actions.h:75
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 413 of file pl_edit_tool.cpp.

414 {
416  return 0;
417 }
PL_EDITOR_FRAME * m_frame
Definition: pl_edit_tool.h:81
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

Returns the right modification point (e.g.

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

Definition at line 271 of file pl_edit_tool.cpp.

272 {
273  if( m_moveInProgress && aSelection.HasReferencePoint() )
274  return false;
275 
276  // When there is only one item selected, the reference point is its position...
277  if( aSelection.Size() == 1 )
278  {
279  WS_DRAW_ITEM_BASE* item = static_cast<WS_DRAW_ITEM_BASE*>( aSelection.Front() );
280  aSelection.SetReferencePoint( item->GetPosition() );
281  }
282  // ...otherwise modify items with regard to the grid-snapped cursor position
283  else
284  {
286  aSelection.SetReferencePoint( m_cursor );
287  }
288 
289  return true;
290 }
VECTOR2I m_cursor
Last cursor position (needed for getModificationPoint() to avoid changes of edit reference point).
Definition: pl_edit_tool.h:92
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:243
bool m_moveInProgress
Flag determining if anything is being dragged right now
Definition: pl_edit_tool.h:85
bool HasReferencePoint() const
Definition: selection.h:233
virtual const wxPoint GetPosition() const =0
int Size() const
Returns the number of selected parts.
Definition: selection.h:125
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
EDA_ITEM * Front() const
Definition: selection.h:182

References SELECTION::Front(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), WS_DRAW_ITEM_BASE::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

Function Wait()

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

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

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), Main(), CVPCB_CONTROL::Main(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::Move(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickCopyReferencePoint(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_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

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

Definition at line 92 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 81 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

functions below are not yet implemented - their interface may change

Definition at line 108 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(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), PICKER_TOOL::Init(), SCH_EDIT_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), Init(), LIB_DRAWING_TOOLS::Init(), MODULE_EDITOR_TOOLS::Init(), PL_DRAWING_TOOLS::Init(), LIB_CONTROL::Init(), PCB_EDITOR_CONTROL::Init(), SCH_DRAWING_TOOLS::Init(), GERBVIEW_SELECTION_TOOL::Init(), DRAWING_TOOL::Init(), PL_SELECTION_TOOL::Init(), EE_SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), SELECTION_TOOL::Init(), EDIT_TOOL::Init(), PCB_TOOL_BASE::Init(), Main(), SCH_MOVE_TOOL::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ m_moveInProgress

bool PL_EDIT_TOOL::m_moveInProgress
private

Flag determining if anything is being dragged right now

Definition at line 85 of file pl_edit_tool.h.

Referenced by Main(), and updateModificationPoint().

◆ m_moveOffset

VECTOR2I PL_EDIT_TOOL::m_moveOffset
private

Used for chaining commands

Definition at line 88 of file pl_edit_tool.h.

Referenced by Main().

◆ m_pickerItem

EDA_ITEM* PL_EDIT_TOOL::m_pickerItem
private

Definition at line 94 of file pl_edit_tool.h.

Referenced by DeleteItemCursor().

◆ m_selectionTool

PL_SELECTION_TOOL* PL_EDIT_TOOL::m_selectionTool
private

Definition at line 82 of file pl_edit_tool.h.

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

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

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

Definition at line 214 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 219 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), PL_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemsToSel(), PL_SELECTION_TOOL::AddItemToSel(), EE_SELECTION_TOOL::AddItemToSel(), SELECTION_TOOL::AddItemToSel(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), EDIT_TOOL::ChangeTrackWidth(), PCB_INSPECTION_TOOL::ClearHighlight(), SCH_EDITOR_CONTROL::ClearHighlight(), SELECTION_TOOL::ClearSelection(), PL_SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), LIB_EDIT_TOOL::Copy(), Copy(), PAD_TOOL::copyPadSettings(), MICROWAVE_TOOL::createInductorBetween(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), PCB_INSPECTION_TOOL::CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), ROUTER_TOOL::CustomTrackWidthDialog(), SCH_EDITOR_CONTROL::Cut(), LIB_EDIT_TOOL::DeleteItemCursor(), DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), LIB_EDIT_TOOL::DoDelete(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::editComponentFieldText(), EDIT_TOOL::EditFpInFpEditor(), LIB_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithLibEdit(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandConnection(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::filterSelection(), SELECTION_TOOL::findCallback(), SCH_EDITOR_CONTROL::FindComponentAndItem(), POINT_EDITOR::finishItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), EDIT_TOOL::GetAndPlace(), TOOL_BASE::getEditFrameInt(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), PCBNEW_CONTROL::GridSetOrigin(), GERBVIEW_CONTROL::HighlightControl(), PCB_INSPECTION_TOOL::HighlightItem(), PCB_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), MODULE_EDITOR_TOOLS::ImportFootprint(), ImportWorksheetContent(), LIB_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), Init(), PAD_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), LIB_CONTROL::Init(), PL_DRAWING_TOOLS::Init(), PL_POINT_EDITOR::Init(), POINT_EDITOR::Init(), PCB_EDITOR_CONTROL::Init(), POSITION_RELATIVE_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), TOOL_BASE::IsToolActive(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), Main(), SCH_MOVE_TOOL::Main(), CVPCB_CONTROL::Main(), LIB_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), LIB_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::Move(), EDIT_TOOL::MoveExact(), LIB_CONTROL::OnDeMorgan(), LIB_EDIT_TOOL::Paste(), Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), EDIT_TOOL::pickCopyReferencePoint(), LIB_EDIT_TOOL::PinTable(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCBNEW_CONTROL::Print(), GERBVIEW_CONTROL::Print(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EE_SELECTION_TOOL::RebuildSelection(), LIB_EDIT_TOOL::Redo(), SCH_EDITOR_CONTROL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), PL_SELECTION_TOOL::RemoveItemFromSel(), EE_SELECTION_TOOL::RemoveItemFromSel(), SELECTION_TOOL::RemoveItemFromSel(), PL_SELECTION_TOOL::RemoveItemsFromSel(), EE_SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_DRAWING_TOOLS::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), SELECTION_TOOL::RequestSelection(), COMMON_TOOLS::ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), LIB_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), DRC::RunTests(), EE_SELECTION_TOOL::SelectConnection(), SELECTION_TOOL::selectCopper(), PCB_TOOL_BASE::selection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), SELECTION_TOOL::SelectItems(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectNet(), PL_SELECTION_TOOL::SelectPoint(), GERBVIEW_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::SelectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), SELECTION_TOOL::selectSameSheet(), SELECTION_TOOL::selectSheetContents(), DRAWING_TOOL::SetAnchor(), TOOL_INTERACTIVE::SetContextMenu(), DRC::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), LIB_EDIT_TOOL::Undo(), SCH_EDITOR_CONTROL::Undo(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), SELECTION_TOOL::UnselectItems(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCBNEW_CONTROL::UpdateMessagePanel(), PCB_INSPECTION_TOOL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), PCB_EDITOR_CONTROL::ZoneDuplicate(), and PCB_EDITOR_CONTROL::ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Name of the tool.

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

Definition at line 218 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_toolSettings

TOOL_SETTINGS TOOL_BASE::m_toolSettings
protectedinherited

Definition at line 220 of file tool_base.h.

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

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

Definition at line 211 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: