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 , REDRAW }
 Determine the reason of reset for a tool. More...
 

Public Member Functions

 PL_EDIT_TOOL ()
 
 ~PL_EDIT_TOOL ()
 
bool Init () override
 Init() is called once upon a registration of the tool. More...
 
void Reset (RESET_REASON aReason) override
 Bring the tool to a known, initial state. More...
 
int Main (const TOOL_EVENT &aEvent)
 The "move" event loop. More...
 
int Undo (const TOOL_EVENT &aEvent)
 
int Redo (const TOOL_EVENT &aEvent)
 
int Cut (const TOOL_EVENT &aEvent)
 
int Copy (const TOOL_EVENT &aEvent)
 
int Paste (const TOOL_EVENT &aEvent)
 
int ImportDrawingSheetContent (const TOOL_EVENT &aEvent)
 
int DoDelete (const TOOL_EVENT &aEvent)
 Delete the selected items, or the item under the cursor. More...
 
int DeleteItemCursor (const TOOL_EVENT &aEvent)
 
void Activate ()
 Run the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Assign a context menu and tells when it should be activated. More...
 
void RunMainStack (std::function< void()> aFunc)
 Call a function using the main stack. More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Define which state (aStateFunc) to go when a certain event arrives (aConditions). More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Suspend execution of the tool until an event specified in aEventList arrives. More...
 
TOOL_TYPE GetType () const
 Return the type of the tool. More...
 
TOOL_ID GetId () const
 Return the unique identifier of the tool. More...
 
const std::string & GetName () const
 Return the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Return the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

Protected Member Functions

void attachManager (TOOL_MANAGER *aManager)
 Set the TOOL_MANAGER the tool will belong to. More...
 
KIGFX::VIEWgetView () const
 Returns the instance of #VIEW object used in the application. More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Return the instance of VIEW_CONTROLS object used in the application. More...
 
template<typename T >
T * getEditFrame () const
 Return the application window object, casted to requested user type. More...
 
template<typename T >
T * getModel () const
 Return the model object if it matches the requested type. More...
 

Protected Attributes

TOOL_MENU m_menu
 The functions below are not yet implemented - their interface may change. More...
 
TOOL_TYPE m_type
 Unique identifier for the tool, assigned by a TOOL_MANAGER instance. More...
 
TOOL_ID m_toolId
 Name of the tool. More...
 
std::string m_toolName
 
TOOL_MANAGERm_toolMgr
 

Private Member Functions

void moveItem (DS_DATA_ITEM *aItem, const VECTOR2I &aDelta)
 Return the right modification point (e.g. More...
 
bool updateModificationPoint (PL_SELECTION &aSelection)
 Set up handlers for various events. More...
 
void setTransitions () override
 This method is meant to be overridden in order to specify handlers for events. More...
 
void resetTransitions ()
 Clear the current transition map and restores the default one created by setTransitions(). More...
 
void goInternal (TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)
 
EDA_ITEMgetModelInt () const
 
TOOLS_HOLDERgetToolHolderInt () const
 

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.

REDRAW 

Full drawing refresh.

Definition at line 77 of file tool_base.h.

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

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}
bool m_moveInProgress
Used for chaining commands.
Definition: pl_edit_tool.h:83
PL_SELECTION_TOOL * m_selectionTool
Flag determining if anything is being dragged right now.
Definition: pl_edit_tool.h:80
VECTOR2I m_moveOffset
Last cursor position (needed for getModificationPoint() to avoid changes of edit reference point).
Definition: pl_edit_tool.h:86
VECTOR2I m_cursor
Definition: pl_edit_tool.h:90
EDA_ITEM * m_pickerItem
Definition: pl_edit_tool.h:92
PL_EDITOR_FRAME * m_frame
Definition: pl_edit_tool.h:79
TOOL_INTERACTIVE(TOOL_ID aId, const std::string &aName)
Create a tool with given id & name.

◆ ~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(), SCH_EDIT_TOOL::DeleteItemCursor(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), 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(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCB_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), EE_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PICKER_TOOL::Main(), Main(), PL_POINT_EDITOR::Main(), PCB_PICKER_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), PCB_POINT_EDITOR::OnSelectionChange(), GROUP_TOOL::PickNewMember(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), ROUTER_TOOL::RouteSelected(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_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}

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ Copy()

int PL_EDIT_TOOL::Copy ( const TOOL_EVENT aEvent)

Definition at line 496 of file pl_edit_tool.cpp.

497{
499 std::vector<DS_DATA_ITEM*> items;
501 wxString sexpr;
502
503 if( selection.GetSize() == 0 )
504 return 0;
505
506 for( EDA_ITEM* item : selection.GetItems() )
507 items.push_back( static_cast<DS_DRAW_ITEM_BASE*>( item )->GetPeer() );
508
509 try
510 {
511 model.SaveInString( items, &sexpr );
512 }
513 catch( const IO_ERROR& ioe )
514 {
515 wxMessageBox( ioe.What(), _( "Error writing objects to clipboard" ) );
516 }
517
518 if( m_toolMgr->SaveClipboard( TO_UTF8( sexpr ) ) )
519 return 0;
520 else
521 return -1;
522}
Handle the graphic items list to draw/plot the frame and title block.
Definition: ds_data_model.h:39
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
void SaveInString(wxString *aOutputString)
Save the description in a buffer.
Base class to handle basic graphic items.
Definition: ds_draw_item.h:59
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
PL_SELECTION & RequestSelection()
Return either an existing selection (filtered), or the selection at the current cursor if the existin...
const std::deque< EDA_ITEM * > GetItems() const
Definition: selection.h:120
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:99
bool SaveClipboard(const std::string &aTextUTF8)
Store information to the system clipboard.
#define _(s)
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96

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

486{
487 int retVal = Copy( aEvent );
488
489 if( retVal == 0 )
490 retVal = DoDelete( aEvent );
491
492 return retVal;
493}
int DoDelete(const TOOL_EVENT &aEvent)
Delete the selected items, or the item under the cursor.
int Copy(const TOOL_EVENT &aEvent)

References Copy(), and DoDelete().

Referenced by setTransitions().

◆ DeleteItemCursor()

int PL_EDIT_TOOL::DeleteItemCursor ( const TOOL_EVENT aEvent)

Definition at line 398 of file pl_edit_tool.cpp.

399{
401
402 // Deactivate other tools; particularly important if another PICKER is currently running
403 Activate();
404
405 picker->SetCursor( KICURSOR::REMOVE );
406 m_pickerItem = nullptr;
407
408 picker->SetClickHandler(
409 [this] ( const VECTOR2D& aPosition ) -> bool
410 {
411 if( m_pickerItem )
412 {
414 selectionTool->UnbrightenItem( m_pickerItem );
415 selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
417 m_pickerItem = nullptr;
418 }
419
420 return true;
421 } );
422
423 picker->SetMotionHandler(
424 [this] ( const VECTOR2D& aPos )
425 {
426 int threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
427 EDA_ITEM* item = nullptr;
428
429 for( DS_DATA_ITEM* dataItem : DS_DATA_MODEL::GetTheInstance().GetItems() )
430 {
431 for( DS_DRAW_ITEM_BASE* drawItem : dataItem->GetDrawItems() )
432 {
433 if( drawItem->HitTest( aPos, threshold ) )
434 {
435 item = drawItem;
436 break;
437 }
438 }
439 }
440
441 if( m_pickerItem != item )
442 {
444
445 if( m_pickerItem )
446 selectionTool->UnbrightenItem( m_pickerItem );
447
448 m_pickerItem = item;
449
450 if( m_pickerItem )
451 selectionTool->BrightenItem( m_pickerItem );
452 }
453 } );
454
455 picker->SetFinalizeHandler(
456 [this] ( const int& aFinalState )
457 {
458 if( m_pickerItem )
459 m_toolMgr->GetTool<PL_SELECTION_TOOL>()->UnbrightenItem( m_pickerItem );
460
461 // Wake the selection tool after exiting to ensure the cursor gets updated
463 } );
464
466
467 return 0;
468}
static TOOL_ACTION pickerTool
Definition: actions.h:159
static TOOL_ACTION doDelete
Definition: actions.h:73
Drawing sheet structure type definitions.
Definition: ds_data_item.h:96
void SetMotionHandler(MOTION_HANDLER aHandler)
Set a handler for mouse motion.
Definition: picker_tool.h:82
void SetClickHandler(CLICK_HANDLER aHandler)
Set a handler for mouse click event.
Definition: picker_tool.h:71
void SetCursor(KICURSOR aCursor)
Definition: picker_tool.h:62
void SetFinalizeHandler(FINALIZE_HANDLER aHandler)
Set a handler for the finalize event.
Definition: picker_tool.h:102
static TOOL_ACTION selectionActivate
Activation of the selection tool.
Definition: pl_actions.h:40
void BrightenItem(EDA_ITEM *aItem)
int AddItemToSel(const TOOL_EVENT &aEvent)
void UnbrightenItem(EDA_ITEM *aItem)
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
void Activate()
Run the tool.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:142
#define HITTEST_THRESHOLD_PIXELS
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:85

References TOOL_INTERACTIVE::Activate(), SELECTION_TOOL::AddItemToSel(), SELECTION_TOOL::BrightenItem(), ACTIONS::doDelete, 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 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 353 of file pl_edit_tool.cpp.

354{
356
357 if( selection.Size() == 0 )
358 return 0;
359
360
361 // Do not delete an item if it is currently a new item being created to avoid a crash
362 // In this case the selection contains only one item.
363 DS_DRAW_ITEM_BASE* currItem = static_cast<DS_DRAW_ITEM_BASE*>( selection.Front() );
364
365 if( currItem->GetFlags() & ( IS_NEW ) )
366 return 0;
367
369
370 while( selection.Front() )
371 {
372 DS_DRAW_ITEM_BASE* drawItem = static_cast<DS_DRAW_ITEM_BASE*>( selection.Front() );
373 DS_DATA_ITEM* dataItem = drawItem->GetPeer();
375
376 for( DS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
377 {
378 // Note: repeat items won't be selected but must be removed & deleted
379
380 if( item->IsSelected() )
382
383 getView()->Remove( item );
384 }
385
386 delete dataItem;
387 }
388
389 m_frame->OnModify();
390
391 return 0;
392}
const std::vector< DS_DRAW_ITEM_BASE * > & GetDrawItems() const
Definition: ds_data_item.h:110
void Remove(DS_DATA_ITEM *aItem)
DS_DATA_ITEM * GetPeer() const
Definition: ds_draw_item.h:63
EDA_ITEM_FLAGS GetFlags() const
Definition: eda_item.h:142
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:349
void OnModify() override
Must be called after a change in order to set the "modify" flag.
void SaveCopyInUndoList()
Save a copy of the description (in a S expr string) for Undo/redo commands.
int RemoveItemFromSel(const TOOL_EVENT &aEvent)
EDA_ITEM * Front() const
Definition: selection.h:208
int Size() const
Returns the number of selected parts.
Definition: selection.h:115
#define IS_NEW
New item, just created.

References SELECTION::Front(), DS_DATA_ITEM::GetDrawItems(), EDA_ITEM::GetFlags(), DS_DRAW_ITEM_BASE::GetPeer(), DS_DATA_MODEL::GetTheInstance(), TOOL_BASE::getView(), IS_NEW, m_frame, m_selectionTool, PL_EDITOR_FRAME::OnModify(), DS_DATA_MODEL::Remove(), KIGFX::VIEW::Remove(), 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 seizure 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(), and ZONE_CREATE_HELPER::setUniquePriority().

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

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

◆ 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().

◆ getModelInt()

EDA_ITEM * TOOL_BASE::getModelInt ( ) const
privateinherited

Definition at line 54 of file tool_base.cpp.

55{
56 return m_toolMgr->GetModel();
57}
EDA_ITEM * GetModel() const
Definition: tool_manager.h:292

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

Referenced by TOOL_BASE::getModel().

◆ 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(), TOOL_MANAGER::runTool(), and TOOL_MANAGER::ShutdownTool().

◆ getToolHolderInt()

TOOLS_HOLDER * TOOL_BASE::getToolHolderInt ( ) const
privateinherited

Definition at line 48 of file tool_base.cpp.

49{
50 return m_toolMgr->GetToolHolder();
51}
TOOLS_HOLDER * GetToolHolder() const
Definition: tool_manager.h:296

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

Referenced by TOOL_BASE::getEditFrame().

◆ 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:285

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

Referenced by EE_POINT_EDITOR::addCornerCondition(), ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), COMMON_TOOLS::CenterContents(), SCH_EDIT_TOOL::ChangeTextType(), EE_INSPECTION_TOOL::CheckSymbol(), GERBVIEW_CONTROL::ClearAllLayers(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::CollectHits(), SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint(), COMMON_TOOLS::CursorControl(), SCH_EDIT_TOOL::DeleteItemCursor(), DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), EDIT_TOOL::DeleteItems(), DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SELECTION_TOOL::doSelectionMenu(), COMMON_TOOLS::doZoomFit(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), PCB_CONTROL::GridResetOrigin(), PCB_CONTROL::GridSetOrigin(), EE_SELECTION_TOOL::GuessSelectionCandidates(), PCB_SELECTION_TOOL::GuessSelectionCandidates(), ROUTER_TOOL::handleCommonEvents(), EE_SELECTION_TOOL::highlight(), PL_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::highlightNet(), PNS::TOOL_BASE::highlightNets(), PCB_SELECTION_TOOL::hitTestDistance(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineDrag(), EE_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), PCB_PICKER_TOOL::Main(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), moveItem(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), Paste(), ROUTER_TOOL::performRouting(), PNS::TOOL_BASE::pickSingleItem(), BOARD_EDITOR_CONTROL::PlaceFootprint(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EE_SELECTION_TOOL::Reset(), EE_TOOL_BASE< T >::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), PNS::TOOL_BASE::Reset(), BOARD_EDITOR_CONTROL::Reset(), DRAWING_TOOL::Reset(), PCB_CONTROL::Reset(), PCB_SELECTION_TOOL::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::SelectAll(), PCB_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectionContains(), PCB_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), EE_SELECTION_TOOL::selectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_EDITOR_CONTROL::ToggleERCErrors(), SCH_EDITOR_CONTROL::ToggleERCExclusions(), SCH_EDITOR_CONTROL::ToggleERCWarnings(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), SCH_EDITOR_CONTROL::ToggleOPCurrents(), SCH_EDITOR_CONTROL::ToggleOPVoltages(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), EE_SELECTION_TOOL::unhighlight(), PL_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_FIND_REPLACE_TOOL::UpdateFind(), PL_POINT_EDITOR::updateItem(), PCB_POINT_EDITOR::updateItem(), EE_TOOL_BASE< T >::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), PCB_POINT_EDITOR::updatePoints(), PCB_SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), PCB_SELECTION_TOOL::view(), PCB_TOOL_BASE::view(), PCB_VIEWER_TOOLS::view(), EE_SELECTION_TOOL::ZoomFitCrossProbeBBox(), PCB_SELECTION_TOOL::ZoomFitCrossProbeBBox(), 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}
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:287

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

Referenced by EE_POINT_EDITOR::addCorner(), PCB_POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), EE_SELECTION_TOOL::autostartEvent(), SCH_EDIT_TOOL::BreakWire(), PCB_SELECTION_TOOL::controls(), PCB_TOOL_BASE::controls(), EDIT_TOOL::copyToClipboard(), COMMON_TOOLS::CursorControl(), EDIT_TOOL::DeleteItems(), 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(), SCH_DRAWING_TOOLS::DrawShape(), 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_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::HighlightNet(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), EE_POINT_EDITOR::Main(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PICKER_TOOL::Main(), Main(), PL_POINT_EDITOR::Main(), PCB_PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), SCH_EDITOR_CONTROL::Paste(), 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(), DRAWING_TOOL::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), SCH_EDIT_TOOL::RepeatDrawItem(), PL_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), DRAWING_TOOL::Reset(), PCB_POINT_EDITOR::Reset(), COMMON_TOOLS::ResetLocalCoords(), ROUTER_TOOL::RouteSelected(), PCB_SELECTION_TOOL::selectCursor(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PICKER_TOOL::setControls(), PCB_PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), PCB_POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateItem(), updateModificationPoint(), and COMMON_TOOLS::ZoomCenter().

◆ Go()

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

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

No conditions means any event.

Definition at line 147 of file tool_interactive.h.

149{
150 TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
151
152 goInternal( sptr, aConditions );
153}
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:58

References TOOL_INTERACTIVE::goInternal().

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

◆ goInternal()

void TOOL_INTERACTIVE::goInternal ( TOOL_STATE_FUNC aState,
const TOOL_EVENT_LIST aConditions 
)
privateinherited

Definition at line 70 of file tool_interactive.cpp.

71{
72 m_toolMgr->ScheduleNextState( this, aState, aConditions );
73}
void ScheduleNextState(TOOL_BASE *aTool, TOOL_STATE_FUNC &aHandler, const TOOL_EVENT_LIST &aConditions)
Define a state transition.

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

Referenced by TOOL_INTERACTIVE::Go().

◆ ImportDrawingSheetContent()

int PL_EDIT_TOOL::ImportDrawingSheetContent ( const TOOL_EVENT aEvent)

Definition at line 342 of file pl_edit_tool.cpp.

343{
345
346 wxCommandEvent evt( wxEVT_NULL, ID_APPEND_DESCR_FILE );
347 m_frame->Files_io( evt );
348
349 return 0;
350}
static TOOL_ACTION cancelInteractive
Definition: actions.h:63
void Files_io(wxCommandEvent &event)
@ ID_APPEND_DESCR_FILE
Definition: pl_editor_id.h:41

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 TOOL_ACTION paste
Definition: actions.h:69
static TOOL_ACTION copy
Definition: actions.h:68
static TOOL_ACTION cut
Definition: actions.h:67
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.
void AddSeparator(int aOrder=ANY_ORDER)
Add a separator to the menu.
void AddStandardSubMenus(TOOL_MENU &aMenu)
Construct a "basic" menu for a tool, containing only items that apply to all tools (e....
static TOOL_ACTION move
Definition: pl_actions.h:65
static bool NotEmpty(const SELECTION &aSelection)
Test if there are any items selected.
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
TOOL_MENU & GetToolMenu()
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:44

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{
34}
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 EDIT_TOOL::Drag(), ROUTER_TOOL::handleLayerSwitch(), 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 m_frame->PushTool( aEvent );
121
122 Activate();
123 // Must be done after Activate() so that it gets set into the correct context
124 controls->ShowCursor( true );
125 controls->SetAutoPan( true );
126
127 bool restore_state = false;
128 bool chain_commands = false;
129 TOOL_EVENT copy = aEvent;
130 TOOL_EVENT* evt = &copy;
131 VECTOR2I prevPos;
132
133 if( !selection.Front()->IsNew() )
135
136 // Main loop: keep receiving events
137 do
138 {
140
141 if( evt->IsAction( &PL_ACTIONS::move ) || evt->IsMotion() || evt->IsDrag( BUT_LEFT )
143 {
144 //------------------------------------------------------------------------
145 // Start a move operation
146 //
147 if( !m_moveInProgress )
148 {
149 // Apply any initial offset in case we're coming from a previous command.
150 //
151 for( DS_DATA_ITEM* item : unique_peers )
152 moveItem( item, m_moveOffset );
153
154 // Set up the starting position and move/drag offset
155 //
156 m_cursor = controls->GetCursorPosition();
157
158 if( selection.HasReferencePoint() )
159 {
160 VECTOR2I delta = m_cursor - selection.GetReferencePoint();
161
162 // Drag items to the current cursor position
163 for( DS_DATA_ITEM* item : unique_peers )
164 moveItem( item, delta );
165
166 selection.SetReferencePoint( m_cursor );
167 }
168 else if( selection.Size() == 1 )
169 {
170 // Set the current cursor position to the first dragged item origin,
171 // so the movement vector can be computed later
172 updateModificationPoint( selection );
173 m_cursor = originalCursorPos;
174 }
175 else
176 {
177 updateModificationPoint( selection );
178 }
179
180 controls->SetCursorPosition( m_cursor, false );
181
182 prevPos = m_cursor;
183 controls->SetAutoPan( true );
184 m_moveInProgress = true;
185 }
186
187 //------------------------------------------------------------------------
188 // Follow the mouse
189 //
190 m_cursor = controls->GetCursorPosition();
191 VECTOR2I delta( m_cursor - prevPos );
192 selection.SetReferencePoint( m_cursor );
193
195 prevPos = m_cursor;
196
197 for( DS_DATA_ITEM* item : unique_peers )
198 moveItem( item, delta );
199
201 }
202 //------------------------------------------------------------------------
203 // Handle cancel
204 //
205 else if( evt->IsCancelInteractive() || evt->IsActivate() )
206 {
207 if( evt->IsCancelInteractive() )
209
210 if( m_moveInProgress )
211 {
212 if( evt->IsActivate() )
213 {
214 // Allowing other tools to activate during a move runs the risk of race
215 // conditions in which we try to spool up both event loops at once.
216
217 m_frame->ShowInfoBarMsg( _( "Press <ESC> to cancel move." ) );
218
219 evt->SetPassEvent( false );
220 continue;
221 }
222
223 evt->SetPassEvent( false );
224 restore_state = true;
225 }
226
227 break;
228 }
229 //------------------------------------------------------------------------
230 // Handle TOOL_ACTION special cases
231 //
232 else if( evt->Action() == TA_UNDO_REDO_PRE )
233 {
234 unselect = true;
235 break;
236 }
237 else if( evt->IsAction( &ACTIONS::doDelete ) )
238 {
239 evt->SetPassEvent();
240 // Exit on a delete; there will no longer be anything to drag.
241 break;
242 }
243 else if( evt->IsAction( &ACTIONS::duplicate ) )
244 {
245 if( selection.Front()->IsNew() )
246 {
247 // This doesn't really make sense; we'll just end up dragging a stack of
248 // objects so we ignore the duplicate and just carry on.
249 continue;
250 }
251
252 // Move original back and exit. The duplicate will run in its own loop.
253 restore_state = true;
254 unselect = false;
255 chain_commands = true;
256 break;
257 }
258 //------------------------------------------------------------------------
259 // Handle context menu
260 //
261 else if( evt->IsClick( BUT_RIGHT ) )
262 {
264 }
265 //------------------------------------------------------------------------
266 // Handle drop
267 //
268 else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
269 {
270 break; // Finish
271 }
272 else
273 {
274 evt->SetPassEvent();
275 }
276
277 controls->SetAutoPan( m_moveInProgress );
278
279 } while( ( evt = Wait() ) ); //Should be assignment not equality test
280
281 controls->ForceCursorPosition( false );
282 controls->ShowCursor( false );
283 controls->SetAutoPan( false );
284
285 if( !chain_commands )
286 m_moveOffset = { 0, 0 };
287
288 selection.ClearReferencePoint();
289
290 for( EDA_ITEM* item : selection )
291 item->ClearEditFlags();
292
293 if( restore_state )
295 else
296 m_frame->OnModify();
297
298 if( unselect )
300 else
302
303 m_moveInProgress = false;
304 m_frame->PopTool( aEvent );
305 return 0;
306}
static TOOL_ACTION duplicate
Definition: actions.h:72
static TOOL_ACTION refreshPreview
Definition: actions.h:110
void ShowInfoBarMsg(const wxString &aMsg, bool aShowCloseButton=false)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an info icon on the left of...
WX_INFOBAR * GetInfoBar()
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
static const TOOL_EVENT SelectedEvent
Definition: actions.h:207
static const TOOL_EVENT SelectedItemsMoved
Used to inform tools that the selection should temporarily be non-editable.
Definition: actions.h:217
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.
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
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.
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
static TOOL_ACTION clearSelection
Clear the current selection.
Definition: pl_actions.h:43
void RollbackFromUndo()
Apply the last command in Undo List without stacking a Redo.
PL_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
bool updateModificationPoint(PL_SELECTION &aSelection)
Set up handlers for various events.
void moveItem(DS_DATA_ITEM *aItem, const VECTOR2I &aDelta)
Return the right modification point (e.g.
PL_SELECTION & GetSelection()
Return the set of currently selected items.
bool IsHover() const
Definition: selection.h:83
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:109
virtual void PopTool(const TOOL_EVENT &aEvent)
Pops a tool from the stack.
virtual void PushTool(const TOOL_EVENT &aEvent)
NB: the definition of "tool" is different at the user level.
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
Generic, UI-independent tool event.
Definition: tool_event.h:156
bool IsCancelInteractive() const
Indicate the event should restart/end an ongoing interactive tool's event loop (eg esc key,...
Definition: tool_event.cpp:205
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:233
bool IsActivate() const
Definition: tool_event.h:318
bool IsClick(int aButtonMask=BUT_ANY) const
Definition: tool_event.cpp:193
bool IsDrag(int aButtonMask=BUT_ANY) const
Definition: tool_event.h:288
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:81
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:239
bool IsMouseUp(int aButtonMask=BUT_ANY) const
Definition: tool_event.h:298
bool IsMotion() const
Definition: tool_event.h:303
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Suspend execution of the tool until an event specified in aEventList arrives.
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
void ShowContextMenu(SELECTION &aSelection)
Helper function to set and immediately show a CONDITIONAL_MENU in concert with the given SELECTION.
Definition: tool_menu.cpp:57
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: wx_infobar.cpp:175
constexpr int delta
@ TA_UNDO_REDO_PRE
Definition: tool_event.h:101
@ BUT_LEFT
Definition: tool_event.h:127
@ BUT_RIGHT
Definition: tool_event.h:128

References _, TOOL_EVENT::Action(), TOOL_INTERACTIVE::Activate(), BUT_LEFT, BUT_RIGHT, SELECTION::ClearReferencePoint(), PL_ACTIONS::clearSelection, copy, delta, WX_INFOBAR::Dismiss(), ACTIONS::doDelete, ACTIONS::duplicate, SELECTION::Empty(), KIGFX::VIEW_CONTROLS::ForceCursorPosition(), SELECTION::Front(), PL_EDITOR_FRAME::GetCanvas(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), EDA_BASE_FRAME::GetInfoBar(), DS_DRAW_ITEM_BASE::GetPeer(), SELECTION::GetReferencePoint(), PL_SELECTION_TOOL::GetSelection(), TOOL_BASE::getViewControls(), SELECTION::HasReferencePoint(), 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, 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::SelectedEvent, EVENTS::SelectedItemsMoved, KIGFX::VIEW_CONTROLS::SetAutoPan(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), KIGFX::VIEW_CONTROLS::SetCursorPosition(), TOOL_EVENT::SetPassEvent(), SELECTION::SetReferencePoint(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), EDA_BASE_FRAME::ShowInfoBarMsg(), SELECTION::Size(), TA_UNDO_REDO_PRE, updateModificationPoint(), and TOOL_INTERACTIVE::Wait().

Referenced by setTransitions().

◆ moveItem()

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

Return the right modification point (e.g.

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

Definition at line 309 of file pl_edit_tool.cpp.

310{
311 aItem->MoveToUi( aItem->GetStartPosUi() + aDelta );
312
313 for( DS_DRAW_ITEM_BASE* item : aItem->GetDrawItems() )
314 {
315 getView()->Update( item );
316 item->SetFlags( IS_MOVING );
317 }
318}
void MoveToUi(const VECTOR2I &aPosition)
Move item to a new position.
const VECTOR2I GetStartPosUi(int ii=0) const
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:1591
#define IS_MOVING
Item being moved.

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

Referenced by Main().

◆ Paste()

int PL_EDIT_TOOL::Paste ( const TOOL_EVENT aEvent)

Definition at line 525 of file pl_edit_tool.cpp.

526{
529 std::string sexpr = m_toolMgr->GetClipboardUTF8();
530
532
533 model.SetPageLayout( sexpr.c_str(), true, wxT( "clipboard" ) );
534
535 // Build out draw items and select the first of each data item
536 for( DS_DATA_ITEM* dataItem : model.GetItems() )
537 {
538 if( dataItem->GetDrawItems().empty() )
539 {
540 dataItem->SyncDrawItems( nullptr, getView() );
541 dataItem->GetDrawItems().front()->SetSelected();
542 }
543 }
544
546
547 if( !selection.Empty() )
548 {
549 selection.SetReferencePoint( selection.GetTopLeftItem()->GetPosition() );
551 }
552
553 return 0;
554}
std::vector< DS_DATA_ITEM * > & GetItems()
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.
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:249
int ClearSelection(const TOOL_EVENT &aEvent)
void RebuildSelection()
Rebuild the selection from the flags in the view items.
EDA_ITEM * GetTopLeftItem(bool onlyModules=false) const override
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:260
std::string GetClipboardUTF8() const
Return the information currently stored in the system clipboard.

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

479{
481 return 0;
482}
void GetLayoutFromRedoList()
Redo the last edit:

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}

References m_frame, and TOOL_BASE::MODEL_RELOAD.

◆ resetTransitions()

void TOOL_INTERACTIVE::resetTransitions ( )
privateinherited

Clear the current transition map and restores the default one created by setTransitions().

Definition at line 63 of file tool_interactive.cpp.

64{
67}
virtual void setTransitions()=0
This method is meant to be overridden in order to specify handlers for events.
void ClearTransitions(TOOL_BASE *aTool)
Clear the state transition map for a tool.

References TOOL_MANAGER::ClearTransitions(), TOOL_BASE::m_toolMgr, and TOOL_INTERACTIVE::setTransitions().

◆ 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}
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}
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.
@ CMENU_OFF
Definition: tool_event.h:149

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

Referenced by 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 557 of file pl_edit_tool.cpp.

558{
559 Go( &PL_EDIT_TOOL::Main, PL_ACTIONS::move.MakeEvent() );
560
562
563 Go( &PL_EDIT_TOOL::Undo, ACTIONS::undo.MakeEvent() );
564 Go( &PL_EDIT_TOOL::Redo, ACTIONS::redo.MakeEvent() );
565
566 Go( &PL_EDIT_TOOL::Cut, ACTIONS::cut.MakeEvent() );
567 Go( &PL_EDIT_TOOL::Copy, ACTIONS::copy.MakeEvent() );
568 Go( &PL_EDIT_TOOL::Paste, ACTIONS::paste.MakeEvent() );
570
572}
static TOOL_ACTION undo
Definition: actions.h:65
static TOOL_ACTION redo
Definition: actions.h:66
static TOOL_ACTION deleteTool
Definition: actions.h:74
static TOOL_ACTION appendImportedDrawingSheet
Definition: pl_actions.h:62
int Redo(const TOOL_EVENT &aEvent)
int DeleteItemCursor(const TOOL_EVENT &aEvent)
int ImportDrawingSheetContent(const TOOL_EVENT &aEvent)
int Main(const TOOL_EVENT &aEvent)
The "move" event loop.
int Cut(const TOOL_EVENT &aEvent)
int Paste(const TOOL_EVENT &aEvent)
int Undo(const TOOL_EVENT &aEvent)
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).

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

◆ Undo()

int PL_EDIT_TOOL::Undo ( const TOOL_EVENT aEvent)

Definition at line 471 of file pl_edit_tool.cpp.

472{
474 return 0;
475}
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 321 of file pl_edit_tool.cpp.

322{
323 if( m_moveInProgress && aSelection.HasReferencePoint() )
324 return false;
325
326 // When there is only one item selected, the reference point is its position...
327 if( aSelection.Size() == 1 )
328 {
329 aSelection.SetReferencePoint( aSelection.Front()->GetPosition() );
330 }
331 // ...otherwise modify items with regard to the grid-snapped cursor position
332 else
333 {
335 aSelection.SetReferencePoint( m_cursor );
336 }
337
338 return true;
339}
bool HasReferencePoint() const
Definition: selection.h:247

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_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 SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SELECTION_TOOL::doSelectionMenu(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDA_3D_CONTROLLER::Main(), CVPCB_CONTROL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), EE_POINT_EDITOR::Main(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ZOOM_TOOL::Main(), Main(), PL_POINT_EDITOR::Main(), PL_SELECTION_TOOL::Main(), PCB_PICKER_TOOL::Main(), PCB_SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), PCB_POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

Member Data Documentation

◆ m_cursor

VECTOR2I PL_EDIT_TOOL::m_cursor
private

Definition at line 90 of file pl_edit_tool.h.

Referenced by Main(), and updateModificationPoint().

◆ m_frame

PL_EDITOR_FRAME* PL_EDIT_TOOL::m_frame
private

Definition at line 79 of file pl_edit_tool.h.

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

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

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

Definition at line 125 of file tool_interactive.h.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), EDA_3D_CONTROLLER::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< T >::Init(), SCH_DRAWING_TOOLS::Init(), SCH_EDIT_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), SYMBOL_EDITOR_CONTROL::Init(), SYMBOL_EDITOR_DRAWING_TOOLS::Init(), GERBVIEW_SELECTION_TOOL::Init(), PICKER_TOOL::Init(), ZOOM_TOOL::Init(), PL_DRAWING_TOOLS::Init(), Init(), PL_SELECTION_TOOL::Init(), LENGTH_TUNER_TOOL::Init(), ROUTER_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), DRAWING_TOOL::Init(), FOOTPRINT_EDITOR_CONTROL::Init(), PAD_TOOL::Init(), PCB_SELECTION_TOOL::Init(), PCB_TOOL_BASE::Init(), PCB_VIEWER_TOOLS::Init(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDA_3D_CONTROLLER::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ZOOM_TOOL::Main(), Main(), PL_SELECTION_TOOL::Main(), PCB_PICKER_TOOL::Main(), PCB_SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_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::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SYMBOL_EDITOR_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(), SELECTION_TOOL::AddItemsToSel(), SELECTION_TOOL::AddItemToSel(), SCH_MOVE_TOOL::AlignElements(), SCH_EDITOR_CONTROL::AssignNetclass(), BOARD_EDITOR_CONTROL::AssignNetclass(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), EE_SELECTION_TOOL::autostartEvent(), SCH_EDIT_TOOL::BreakWire(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDITOR_CONTROL::ChangeLineMode(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), GERBVIEW_CONTROL::ClearAllLayers(), SCH_EDITOR_CONTROL::ClearHighlight(), BOARD_INSPECTION_TOOL::ClearHighlight(), GERBVIEW_SELECTION_TOOL::clearSelection(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), PCB_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), Copy(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), MICROWAVE_TOOL::createInductorBetween(), EE_INSPECTION_TOOL::CrossProbe(), DRC_TOOL::CrossProbe(), COMMON_TOOLS::CursorControl(), SCH_EDITOR_CONTROL::Cut(), SCH_EDIT_TOOL::DeleteItemCursor(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), EDIT_TOOL::DeleteItems(), SCH_EDITOR_CONTROL::doCopy(), BOARD_EDITOR_CONTROL::doCrossProbePcbToSch(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), SCH_EDIT_TOOL::DoDelete(), SYMBOL_EDITOR_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), BOARD_INSPECTION_TOOL::doHideRatsnestNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PCB_SELECTION_TOOL::doSyncSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::Drag(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawRectangle(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), PAD_TOOL::EditPad(), SYMBOL_EDITOR_EDIT_TOOL::editShapeProperties(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), PCB_SELECTION_TOOL::EnterGroup(), GROUP_TOOL::EnterGroup(), SCH_NAVIGATE_TOOL::EnterSheet(), PAD_TOOL::EnumeratePads(), EE_INSPECTION_TOOL::ExcludeMarker(), PCB_SELECTION_TOOL::ExitGroup(), PCB_SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), PCB_SELECTION_TOOL::filterSelection(), PCB_SELECTION_TOOL::FindItem(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), EDIT_TOOL::GetAndPlace(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getToolHolderInt(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), PCB_SELECTION_TOOL::grabUnconnected(), COMMON_TOOLS::GridNext(), COMMON_TOOLS::GridPreset(), COMMON_TOOLS::GridPrev(), PCB_CONTROL::GridSetOrigin(), GROUP_TOOL::Group(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::HighlightItem(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::HighlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), ImportDrawingSheetContent(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), EE_TOOL_BASE< T >::Init(), SCH_EDIT_TOOL::Init(), SYMBOL_EDITOR_CONTROL::Init(), SYMBOL_EDITOR_EDIT_TOOL::Init(), PL_DRAWING_TOOLS::Init(), Init(), PL_POINT_EDITOR::Init(), ROUTER_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), BOARD_INSPECTION_TOOL::Init(), BOARD_REANNOTATE_TOOL::Init(), CONVERT_TOOL::Init(), DRAWING_TOOL::Init(), EDIT_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), GROUP_TOOL::Init(), PAD_TOOL::Init(), PCB_POINT_EDITOR::Init(), PCB_SELECTION_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), POSITION_RELATIVE_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isRouterActive(), TOOL_BASE::IsToolActive(), GROUP_TOOL::LeaveGroup(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), EDA_3D_CONTROLLER::Main(), CVPCB_CONTROL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), Main(), PL_SELECTION_TOOL::Main(), PCB_PICKER_TOOL::Main(), PCB_SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), SCH_EDIT_TOOL::Mirror(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), BOARD_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), SCH_EDITOR_CONTROL::NextLineMode(), SYMBOL_EDITOR_CONTROL::OnDeMorgan(), SELECTION_TOOL::onDisambiguationExpire(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), 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::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), GERBVIEW_CONTROL::Print(), PCB_CONTROL::Print(), SCH_EDIT_TOOL::Properties(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EDIT_TOOL::rebuildConnectivity(), ZONE_FILLER_TOOL::rebuildConnectivity(), EE_SELECTION_TOOL::RebuildSelection(), PAD_TOOL::RecombinePad(), SCH_EDITOR_CONTROL::Redo(), SYMBOL_EDITOR_EDIT_TOOL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), PCB_POINT_EDITOR::removeCorner(), GROUP_TOOL::RemoveFromGroup(), SELECTION_TOOL::RemoveItemFromSel(), SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem(), PCB_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), EDA_3D_CONTROLLER::Reset(), COMMON_TOOLS::Reset(), PNS::TOOL_BASE::Reset(), PAD_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), SCH_EDITOR_CONTROL::Revert(), SCH_EDIT_TOOL::Rotate(), SYMBOL_EDITOR_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), ROUTER_TOOL::RouteSelected(), TOOL_INTERACTIVE::RunMainStack(), DRC_TOOL::RunTests(), EE_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::SelectAll(), PCB_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::SelectConnection(), PCB_TOOL_BASE::selection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectNet(), GERBVIEW_SELECTION_TOOL::selectPoint(), PL_SELECTION_TOOL::SelectPoint(), PCB_SELECTION_TOOL::selectPoint(), EE_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(), SCH_EDIT_TOOL::Swap(), EE_SELECTION_TOOL::SyncSelection(), COMMON_TOOLS::ToggleCursor(), COMMON_TOOLS::ToggleCursorStyle(), EDA_3D_CONTROLLER::ToggleVisibility(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), SCH_MOVE_TOOL::trimDanglingLines(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_EDITOR_CONTROL::Undo(), SYMBOL_EDITOR_EDIT_TOOL::Undo(), GROUP_TOOL::Ungroup(), PCB_SELECTION_TOOL::unrouteSelected(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), PNS::TOOL_BASE::updateEndItem(), BOARD_INSPECTION_TOOL::UpdateLocalRatsnest(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCB_CONTROL::UpdateMessagePanel(), EDIT_TOOL::updateModificationPoint(), EE_POINT_EDITOR::updateParentItem(), 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().


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