KiCad PCB EDA Suite
EDIT_TOOL Class Reference

Class EDIT_TOOL. More...

#include <edit_tool.h>

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

 EDIT_TOOL ()
 
void Reset (RESET_REASON aReason) override
 Function Reset() Brings the tool to a known, initial state. More...
 
bool Init () override
 Function Init() Init() is called once upon a registration of the tool. More...
 
int Main (const TOOL_EVENT &aEvent)
 Function Main() More...
 
int Drag (const TOOL_EVENT &aEvent)
 Function Drag() More...
 
int Properties (const TOOL_EVENT &aEvent)
 Function Edit() More...
 
int Rotate (const TOOL_EVENT &aEvent)
 Function Rotate() More...
 
int Flip (const TOOL_EVENT &aEvent)
 Function Flip() More...
 
int Mirror (const TOOL_EVENT &aEvent)
 Function Mirror. More...
 
int Remove (const TOOL_EVENT &aEvent)
 Function Remove() More...
 
int Duplicate (const TOOL_EVENT &aEvent)
 Function Duplicate() More...
 
int MoveExact (const TOOL_EVENT &aEvent)
 Function MoveExact() More...
 
int CreateArray (const TOOL_EVENT &aEvent)
 Function CreateArray() More...
 
int ExchangeFootprints (const TOOL_EVENT &aEvent)
 Function ExchangeFootprints() More...
 
int MeasureTool (const TOOL_EVENT &aEvent)
 

Launches a tool to measure between points

More...
 
void setTransitions () override
 

Sets up handlers for various events.

More...
 
int copyToClipboard (const TOOL_EVENT &aEvent)
 Function copyToClipboard() Sends the current selection to the clipboard by formatting it as a fake pcb see AppendBoardFromClipboard for importing. More...
 
int cutToClipboard (const TOOL_EVENT &aEvent)
 Function cutToClipboard() Cuts the current selection to the clipboard by formatting it as a fake pcb see AppendBoardFromClipboard for importing. More...
 
BOARD_COMMITGetCurrentCommit () const
 
void SetEditModules (bool aEnabled)
 Function SetEditModules() More...
 
bool EditingModules () const
 
void Activate ()
 Function Activate() Runs the tool. More...
 
void SetContextMenu (CONTEXT_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Function SetContextMenu() More...
 
void RunMainStack (std::function< void()> aFunc)
 Function RunMainStack() More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Go() More...
 
OPT_TOOL_EVENT Wait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Wait() More...
 
TOOL_TYPE GetType () const
 Function GetType() Returns the type of the tool. More...
 
TOOL_ID GetId () const
 Function GetId() Returns the unique identifier of the tool. More...
 
const std::string & GetName () const
 Function GetName() Returns the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool. More...
 
TOOL_SETTINGSGetSettings ()
 
bool IsToolActive () const
 

Static Public Member Functions

static void FootprintFilter (const VECTOR2I &, GENERAL_COLLECTOR &aCollector)
 Function FootprintFilter() More...
 

Protected Types

enum  INTERACTIVE_PLACEMENT_OPTIONS {
  IPO_ROTATE = 1, IPO_FLIP = 2, IPO_PROPERTIES = 4, IPO_SINGLE_CLICK = 8,
  IPO_REPEAT = 16
}
 

Protected Member Functions

void doInteractiveItemPlacement (INTERACTIVE_PLACER_BASE *aPlacer, const wxString &aCommitMessage, int aOptions=IPO_ROTATE|IPO_FLIP|IPO_REPEAT)
 Helper function for performing a common interactive idiom: wait for a left click, place an item there (perhaps with a dialog or other user interaction), then have it move with the mouse and respond to rotate/flip, etc. More...
 
KIGFX::PCB_VIEWview () const
 
KIGFX::VIEW_CONTROLScontrols () const
 
PCB_EDIT_FRAMEframe () const
 
BOARDboard () const
 
MODULEmodule () const
 
PCB_DISPLAY_OPTIONSdisplayOptions () const
 
PCB_DRAW_PANEL_GALcanvas () const
 
const SELECTIONselection () const
 
SELECTIONselection ()
 
const TOOL_EVENT evActivate (std::string aToolName="")
 functions below are not yet implemented - their interface may change More...
 
const TOOL_EVENT evCommand (int aCommandId=-1)
 
const TOOL_EVENT evCommand (std::string aCommandStr="")
 
const TOOL_EVENT evMotion ()
 
const TOOL_EVENT evClick (int aButton=BUT_ANY)
 
const TOOL_EVENT evDrag (int aButton=BUT_ANY)
 
const TOOL_EVENT evButtonUp (int aButton=BUT_ANY)
 
const TOOL_EVENT evButtonDown (int aButton=BUT_ANY)
 
void attachManager (TOOL_MANAGER *aManager)
 Function attachManager() More...
 
KIGFX::VIEWgetView () const
 Function getView() More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Function getViewControls() More...
 
template<typename T >
T * getEditFrame () const
 Function getEditFrame() More...
 
template<typename T >
T * getModel () const
 Function getModel() More...
 

Protected Attributes

bool m_editModules
 
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

bool updateModificationPoint (SELECTION &aSelection)
 

Returns the right modification point (e.g.

More...
 
int editFootprintInFpEditor (const TOOL_EVENT &aEvent)
 
bool invokeInlineRouter (int aDragMode)
 
bool isInteractiveDragEnabled () const
 
bool changeTrackWidthOnClick (const SELECTION &selection)
 
bool pickCopyReferencePoint (VECTOR2I &aP)
 
bool hoverSelection (bool aSanitize=true)
 Function hoverSelection() More...
 

Private Attributes

SELECTION_TOOLm_selectionTool
 

Selection tool used for obtaining selected items

More...
 
bool m_dragging
 

Flag determining if anything is being dragged right now

More...
 
VECTOR2I m_cursor
 

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

More...
 
std::unique_ptr< BOARD_COMMITm_commit
 

Detailed Description

Class EDIT_TOOL.

The interactive edit tool. Allows one to move, rotate, flip and change properties of items selected using the pcbnew.InteractiveSelection tool.

Definition at line 45 of file edit_tool.h.

Member Enumeration Documentation

enum PCB_TOOL::INTERACTIVE_PLACEMENT_OPTIONS
protectedinherited
Enumerator
IPO_ROTATE 
IPO_FLIP 
IPO_PROPERTIES 
IPO_SINGLE_CLICK 
IPO_REPEAT 

Definition at line 106 of file pcb_tool.h.

enum TOOL_BASE::RESET_REASON
inherited

Determines the reason of reset for a tool

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 80 of file tool_base.h.

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

Constructor & Destructor Documentation

EDIT_TOOL::EDIT_TOOL ( )

Definition at line 262 of file edit_tool.cpp.

262  :
263  PCB_TOOL( "pcbnew.InteractiveEdit" ), m_selectionTool( NULL ),
264  m_dragging( false )
265 {
266 }
SELECTION_TOOL * m_selectionTool
Selection tool used for obtaining selected items
Definition: edit_tool.h:173
bool m_dragging
Flag determining if anything is being dragged right now
Definition: edit_tool.h:176
PCB_TOOL(TOOL_ID aId, const std::string &aName)
Constructor.
Definition: pcb_tool.h:71

Member Function Documentation

void TOOL_INTERACTIVE::Activate ( )
inherited

Function Activate() Runs the tool.

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

Definition at line 49 of file tool_interactive.cpp.

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

Referenced by copyToClipboard(), PCBNEW_CONTROL::DeleteItemCursor(), PCB_TOOL::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::drawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), PCB_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineDrag(), Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), GERBVIEW_SELECTION_TOOL::MeasureTool(), MeasureTool(), POINT_EDITOR::OnSelectionChange(), pickCopyReferencePoint(), DRAWING_TOOL::PlaceDXF(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), and PCB_EDITOR_CONTROL::ShowLocalRatsnest().

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

Function attachManager()

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

Definition at line 59 of file tool_base.cpp.

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

Referenced by TOOL_MANAGER::RegisterTool().

60 {
61  m_toolMgr = aManager;
62  m_toolSettings = TOOL_SETTINGS( this );
63 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:216
friend class TOOL_SETTINGS
Definition: tool_base.h:155
BOARD* PCB_TOOL::board ( ) const
inlineprotectedinherited

Definition at line 137 of file pcb_tool.h.

Referenced by PCBNEW_CONTROL::AppendBoard(), PCB_EDITOR_CONTROL::calculateSelectionRatsnest(), changeTrackWidthOnClick(), copyToClipboard(), MICROWAVE_TOOL::createInductorBetween(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), ROUTER_TOOL::CustomTrackWidthDialog(), PCB_TOOL::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), MODULE_EDITOR_TOOLS::EnumeratePads(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::filterSelection(), POINT_EDITOR::finishItem(), SELECTION_TOOL::getCollectorsGuide(), ROUTER_TOOL::getNetclassDimensions(), PCBNEW_CONTROL::GraphicDisplayMode(), PAD_TOOL::haveFootprints(), highlightNet(), PCBNEW_CONTROL::LayerNext(), PCBNEW_CONTROL::LayerPrev(), ROUTER_TOOL::mainLoop(), PCBNEW_CONTROL::ModuleEdgeOutlines(), PCBNEW_CONTROL::ModuleTextOutlines(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::onTrackViaSizeChanged(), ROUTER_TOOL::onViaCommand(), PCBNEW_CONTROL::PadDisplayMode(), PCBNEW_CONTROL::PasteItemsFromClipboard(), PCBNEW_CONTROL::placeBoardItems(), MODULE_EDITOR_TOOLS::PlacePad(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), SELECTION_TOOL::selectable(), SELECTION_TOOL::selectAllItemsConnectedToItem(), SELECTION_TOOL::selectAllItemsConnectedToTrack(), SELECTION_TOOL::selectAllItemsOnNet(), SELECTION_TOOL::selectAllItemsOnSheet(), SELECTION_TOOL::selectPoint(), PCB_EDITOR_CONTROL::ShowLocalRatsnest(), PCBNEW_CONTROL::TrackDisplayMode(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), PCBNEW_CONTROL::ViaDisplayMode(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), PCBNEW_CONTROL::ZoneDisplayMode(), ZONE_FILLER_TOOL::ZoneFill(), ZONE_FILLER_TOOL::ZoneFillAll(), PCB_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfillAll().

137 { return getModel<BOARD>(); }
PCB_DRAW_PANEL_GAL * PCB_TOOL::canvas ( ) const
protectedinherited
bool EDIT_TOOL::changeTrackWidthOnClick ( const SELECTION selection)
private

Definition at line 601 of file edit_tool.cpp.

References PCB_TOOL::board(), PCB_TOOL::frame(), BOARD_DESIGN_SETTINGS::GetCurrentTrackWidth(), BOARD_DESIGN_SETTINGS::GetCurrentViaDrill(), BOARD_DESIGN_SETTINGS::GetCurrentViaSize(), BOARD::GetDesignSettings(), m_commit, PCB_GENERAL_SETTINGS::m_editActionChangesTrackWidth, PCB_BASE_FRAME::Settings(), SELECTION::Size(), and VIA_MICROVIA.

Referenced by Properties().

602 {
603  if ( selection.Size() == 1 && frame()->Settings().m_editActionChangesTrackWidth )
604  {
605  auto item = static_cast<BOARD_ITEM *>( selection[0] );
606 
607  m_commit->Modify( item );
608 
609  if( auto via = dyn_cast<VIA*>( item ) )
610  {
611  int new_width, new_drill;
612 
613  if( via->GetViaType() == VIA_MICROVIA )
614  {
615  auto net = via->GetNet();
616 
617  new_width = net->GetMicroViaSize();
618  new_drill = net->GetMicroViaDrillSize();
619  }
620  else
621  {
622  new_width = board()->GetDesignSettings().GetCurrentViaSize();
623  new_drill = board()->GetDesignSettings().GetCurrentViaDrill();
624  }
625 
626  via->SetDrill( new_drill );
627  via->SetWidth( new_width );
628  }
629  else if ( auto track = dyn_cast<TRACK*>( item ) )
630  {
631  int new_width = board()->GetDesignSettings().GetCurrentTrackWidth();
632  track->SetWidth( new_width );
633  }
634 
635  m_commit->Push( _("Edit track width/via size") );
636  return true;
637  }
638 
639  return false;
640 }
int GetCurrentViaDrill() const
Function GetCurrentViaDrill.
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
std::unique_ptr< BOARD_COMMIT > m_commit
Definition: edit_tool.h:209
int GetCurrentViaSize() const
Function GetCurrentViaSize.
PCB_GENERAL_SETTINGS & Settings()
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:136
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:535
int Size() const
Returns the number of selected parts.
Definition: selection.h:115
int GetCurrentTrackWidth() const
Function GetCurrentTrackWidth.
BOARD * board() const
Definition: pcb_tool.h:137
int EDIT_TOOL::copyToClipboard ( const TOOL_EVENT aEvent)

Function copyToClipboard() Sends the current selection to the clipboard by formatting it as a fake pcb see AppendBoardFromClipboard for importing.

Returns
True if it was sent succesfully

Definition at line 1384 of file edit_tool.cpp.

References TOOL_INTERACTIVE::Activate(), BLACK, PCB_TOOL::board(), SELECTION::Empty(), PCB_TOOL::frame(), m_selectionTool, pickCopyReferencePoint(), SELECTION_TOOL::RequestSelection(), CLIPBOARD_IO::SaveSelection(), PCB_TOOL::selection(), CLIPBOARD_IO::SetBoard(), EDA_DRAW_FRAME::SetMsgPanel(), and SELECTION::SetReferencePoint().

Referenced by cutToClipboard(), and setTransitions().

1385 {
1386  CLIPBOARD_IO io;
1387  VECTOR2I refPoint;
1388 
1389  Activate();
1390 
1391  auto item1 = MSG_PANEL_ITEM( "", _( "Select reference point for the block being copied..." ),
1392  COLOR4D::BLACK );
1393 
1394  std::vector<MSG_PANEL_ITEM> msgItems = { item1 };
1395 
1397 
1398  if( selection.Empty() )
1399  return 1;
1400 
1401  frame()->SetMsgPanel( msgItems );
1402  bool rv = pickCopyReferencePoint( refPoint );
1403  frame()->SetMsgPanel( board() );
1404 
1405  if( !rv )
1406  return 1;
1407 
1408  selection.SetReferencePoint( refPoint );
1409  io.SetBoard( board() );
1410  io.SaveSelection( selection );
1411 
1412  return 0;
1413 }
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:109
SELECTION_TOOL * m_selectionTool
Selection tool used for obtaining selected items
Definition: edit_tool.h:173
void SaveSelection(const SELECTION &selected)
void SetBoard(BOARD *aBoard)
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:203
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Function SetMsgPanel clears the message panel and populates it with the contents of aList...
Definition: draw_frame.cpp:831
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:136
SELECTION & RequestSelection(int aFlags=SELECTION_DEFAULT, CLIENT_SELECTION_FILTER aClientFilter=NULL)
Function RequestSelection()
const SELECTION & selection() const
Definition: pcb_tool.cpp:221
bool pickCopyReferencePoint(VECTOR2I &aP)
Definition: edit_tool.cpp:1366
void Activate()
Function Activate() Runs the tool.
Definition: colors.h:45
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
BOARD * board() const
Definition: pcb_tool.h:137
int EDIT_TOOL::CreateArray ( const TOOL_EVENT aEvent)

Function CreateArray()

Creates an array of the selected items, invoking the array editor dialog to set the array options

Definition at line 1117 of file edit_tool.cpp.

References SELECTION::Empty(), PCB_TOOL::m_editModules, m_selectionTool, SELECTION_TOOL::RequestSelection(), and PCB_TOOL::selection().

Referenced by setTransitions().

1118 {
1119  const auto& selection = m_selectionTool->RequestSelection();
1120 
1121  if( selection.Empty() )
1122  return 0;
1123 
1124  // we have a selection to work on now, so start the tool process
1125  PCB_BASE_FRAME* editFrame = getEditFrame<PCB_BASE_FRAME>();
1126  GAL_ARRAY_CREATOR array_creator( *editFrame, m_editModules, selection );
1127  array_creator.Invoke();
1128 
1129  return 0;
1130 }
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:109
SELECTION_TOOL * m_selectionTool
Selection tool used for obtaining selected items
Definition: edit_tool.h:173
SELECTION & RequestSelection(int aFlags=SELECTION_DEFAULT, CLIENT_SELECTION_FILTER aClientFilter=NULL)
Function RequestSelection()
const SELECTION & selection() const
Definition: pcb_tool.cpp:221
bool m_editModules
Definition: pcb_tool.h:144
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
int EDIT_TOOL::cutToClipboard ( const TOOL_EVENT aEvent)

Function cutToClipboard() Cuts the current selection to the clipboard by formatting it as a fake pcb see AppendBoardFromClipboard for importing.

Returns
True if it was sent succesfully

Definition at line 1416 of file edit_tool.cpp.

References copyToClipboard(), and Remove().

Referenced by setTransitions().

1417 {
1418  if( !copyToClipboard( aEvent ) )
1419  Remove( aEvent );
1420 
1421  return 0;
1422 }
int Remove(const TOOL_EVENT &aEvent)
Function Remove()
Definition: edit_tool.cpp:873
int copyToClipboard(const TOOL_EVENT &aEvent)
Function copyToClipboard() Sends the current selection to the clipboard by formatting it as a fake pc...
Definition: edit_tool.cpp:1384
PCB_DISPLAY_OPTIONS * PCB_TOOL::displayOptions ( ) const
protectedinherited

Definition at line 211 of file pcb_tool.cpp.

References PCB_TOOL::frame(), and PCB_BASE_FRAME::GetDisplayOptions().

Referenced by PCBNEW_CONTROL::GraphicDisplayMode(), PCBNEW_CONTROL::HighContrastMode(), PCBNEW_CONTROL::ModuleEdgeOutlines(), PCBNEW_CONTROL::ModuleTextOutlines(), PCBNEW_CONTROL::PadDisplayMode(), PNS::TOOL_BASE::pickSingleItem(), PCBNEW_CONTROL::TrackDisplayMode(), PCBNEW_CONTROL::ViaDisplayMode(), and PCBNEW_CONTROL::ZoneDisplayMode().

212 {
213  return static_cast<PCB_DISPLAY_OPTIONS*>( frame()->GetDisplayOptions() );
214 }
void * GetDisplayOptions() override
Function GetDisplayOptions returns the display options current in use Display options are relative to...
Class PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings...
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:136
void PCB_TOOL::doInteractiveItemPlacement ( INTERACTIVE_PLACER_BASE aPlacer,
const wxString &  aCommitMessage,
int  aOptions = IPO_ROTATE | IPO_FLIP | IPO_REPEAT 
)
protectedinherited

Helper function for performing a common interactive idiom: wait for a left click, place an item there (perhaps with a dialog or other user interaction), then have it move with the mouse and respond to rotate/flip, etc.

More complex interactive processes are not supported here, you should implement a customised event loop for those.

Parameters
aItemCreatorthe callable that will attempt to create the item
aCommitMessagethe message used on a successful commit

Definition at line 39 of file pcb_tool.cpp.

References TOOL_INTERACTIVE::Activate(), KIGFX::PCB_VIEW::Add(), KIGFX::VIEW_GROUP::Add(), SELECTION::Add(), PCB_TOOL::board(), BUT_LEFT, KIGFX::VIEW_CONTROLS::CaptureCursor(), SELECTION::Clear(), PCB_TOOL::controls(), INTERACTIVE_PLACER_BASE::CreateItem(), dyn_cast(), PCB_ACTIONS::flip, PCB_TOOL::frame(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), TOOL_EVT_UTILS::GetEventRotationAngle(), TOOL_BASE::GetManager(), PCB_TOOL::IPO_FLIP, PCB_TOOL::IPO_REPEAT, PCB_TOOL::IPO_ROTATE, PCB_TOOL::IPO_SINGLE_CLICK, TOOL_EVT_UTILS::IsCancelInteractive(), TOOL_EVT_UTILS::IsRotateToolEvt(), INTERACTIVE_PLACER_BASE::m_board, INTERACTIVE_PLACER_BASE::m_frame, INTERACTIVE_PLACER_BASE::m_modifiers, PCB_TOOL::module(), PCB_MODULE_T, INTERACTIVE_PLACER_BASE::PlaceItem(), BOARD_COMMIT::Push(), KIGFX::PCB_VIEW::Remove(), KIGFX::VIEW_GROUP::Remove(), SELECTION::Remove(), TOOL_MANAGER::RunAction(), MODULE::RunOnChildren(), PCB_ACTIONS::selectionClear, KIGFX::VIEW_CONTROLS::SetAutoPan(), KIGFX::VIEW_CONTROLS::SetSnapping(), KIGFX::VIEW_CONTROLS::ShowCursor(), INTERACTIVE_PLACER_BASE::SnapItem(), TC_COMMAND, KIGFX::PCB_VIEW::Update(), PCB_TOOL::view(), TOOL_INTERACTIVE::Wait(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by MICROWAVE_TOOL::addMicrowaveFootprint(), DRAWING_TOOL::DrawVia(), and MODULE_EDITOR_TOOLS::PlacePad().

42 {
43  using namespace std::placeholders;
44  std::unique_ptr<BOARD_ITEM> newItem;
45 
46  Activate();
47 
48  BOARD_COMMIT commit( frame() );
49 
51 
52  // do not capture or auto-pan until we start placing an item
53  controls()->ShowCursor( true );
54  controls()->SetSnapping( true );
55 
56  // Add a VIEW_GROUP that serves as a preview for the new item
57  SELECTION preview;
58  view()->Add( &preview );
59 
60  aPlacer->m_board = board();
61  aPlacer->m_frame = frame();
62  aPlacer->m_modifiers = 0;
63 
64  if( aOptions & IPO_SINGLE_CLICK )
65  {
66  VECTOR2I cursorPos = controls()->GetCursorPosition();
67 
68  newItem = aPlacer->CreateItem();
69  newItem->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
70 
71  preview.Add( newItem.get() );
72  }
73 
74  // Main loop: keep receiving events
75  while( OPT_TOOL_EVENT evt = Wait() )
76  {
77  VECTOR2I cursorPos = controls()->GetCursorPosition();
78  aPlacer->m_modifiers = evt->Modifier();
79 
81  {
82  if( newItem )
83  {
84  // Delete the old item and have another try
85  newItem = nullptr;
86 
87  preview.Clear();
88 
89  if( aOptions & IPO_SINGLE_CLICK )
90  break;
91 
92  controls()->SetAutoPan( false );
93  controls()->CaptureCursor( false );
94  controls()->ShowCursor( true );
95  }
96  else
97  {
98  break;
99  }
100 
101  if( evt->IsActivate() ) // now finish unconditionally
102  break;
103  }
104 
105  else if( evt->IsClick( BUT_LEFT ) )
106  {
107  if( !newItem )
108  {
109  // create the item if possible
110  newItem = aPlacer->CreateItem();
111 
112  // no item created, so wait for another click
113  if( !newItem )
114  continue;
115 
116  controls()->CaptureCursor( true );
117  controls()->SetAutoPan( true );
118 
119  newItem->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
120 
121  preview.Add( newItem.get() );
122 
123  if( newItem->Type() == PCB_MODULE_T )
124  {
125  auto module = dyn_cast<MODULE*>( newItem.get() );
126 
127  // modules have more drawable parts
128  module->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) );
129  }
130  }
131  else
132  {
133  newItem->ClearFlags();
134  preview.Remove( newItem.get() );
135 
136  aPlacer->PlaceItem( newItem.get(), commit );
137 
138  if( newItem->Type() == PCB_MODULE_T )
139  {
140  auto module = dyn_cast<MODULE*>( newItem.get() );
141  module->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Remove, &preview, _1 ) );
142  }
143 
144  newItem.release();
145  commit.Push( aCommitMessage );
146 
147  controls()->CaptureCursor( false );
148  controls()->SetAutoPan( false );
149  controls()->ShowCursor( true );
150 
151  if( !( aOptions & IPO_REPEAT ) )
152  break;
153 
154  if( aOptions & IPO_SINGLE_CLICK )
155  {
157 
158  newItem = aPlacer->CreateItem();
159  newItem->SetPosition( wxPoint( pos.x, pos.y ) );
160 
161  preview.Add( newItem.get() );
162  }
163  }
164  }
165 
166  else if( newItem && evt->Category() == TC_COMMAND )
167  {
168  /*
169  * Handle any events that can affect the item as we move
170  * it around, eg rotate and flip
171  */
172 
173  if( TOOL_EVT_UTILS::IsRotateToolEvt( *evt ) && ( aOptions & IPO_ROTATE ) )
174  {
175  const auto rotationAngle = TOOL_EVT_UTILS::GetEventRotationAngle(
176  *frame(), *evt );
177  newItem->Rotate( newItem->GetPosition(), rotationAngle );
178  view()->Update( &preview );
179  }
180  else if( evt->IsAction( &PCB_ACTIONS::flip ) && ( aOptions & IPO_FLIP ) )
181  {
182  newItem->Flip( newItem->GetPosition() );
183  view()->Update( &preview );
184  }
185  }
186 
187  else if( newItem && evt->IsMotion() )
188  {
189  // track the cursor
190  newItem->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
191  aPlacer->SnapItem( newItem.get() );
192 
193  // Show a preview of the item
194  view()->Update( &preview );
195  }
196  }
197 
198  view()->Remove( &preview );
199 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
virtual void PlaceItem(BOARD_ITEM *aItem, BOARD_COMMIT &aCommit)
Definition: pcb_tool.cpp:241
virtual void Clear() override
Function Clear() Removes all the stored items from the group.
Definition: selection.h:84
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction)
Function RunOnChildren.
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:81
virtual std::unique_ptr< BOARD_ITEM > CreateItem()=0
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
virtual void SetSnapping(bool aEnabled)
Function SetSnapping() Enables/disables snapping cursor to grid.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
PCB_EDIT_FRAME * m_frame
Definition: pcb_tool.h:58
bool IsRotateToolEvt(const TOOL_EVENT &aEvt)
Function isRotateToolEvt()
Casted dyn_cast(From aObject)
Function dyn_cast()
Definition: typeinfo.h:61
virtual void Remove(VIEW_ITEM *aItem) override
Function Remove() Removes a VIEW_ITEM from the view.
Definition: pcb_view.cpp:64
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:74
virtual void SnapItem(BOARD_ITEM *aItem)
Definition: pcb_tool.cpp:236
KIGFX::VIEW_CONTROLS * controls() const
Definition: pcb_tool.h:135
class MODULE, a footprint
Definition: typeinfo.h:89
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area. ...
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:136
MODULE * module() const
Definition: pcb_tool.h:138
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes an item from the group.
Definition: view_group.cpp:61
bool IsCancelInteractive(const TOOL_EVENT &aEvt)
Function IsCancelInteractive()
virtual void Add(VIEW_ITEM *aItem)
Function Add() Adds an item to the group.
Definition: view_group.cpp:55
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg...
static TOOL_ACTION flip
Flipping of selected objects.
Definition: pcb_actions.h:102
KIGFX::PCB_VIEW * view() const
Definition: pcb_tool.h:134
TOOL_MANAGER * GetManager() const
Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool...
Definition: tool_base.h:144
void Activate()
Function Activate() Runs the tool.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Function Add() Adds a VIEW_ITEM to the view.
Definition: pcb_view.cpp:48
int GetEventRotationAngle(const PCB_BASE_EDIT_FRAME &aFrame, const TOOL_EVENT &aEvt)
Function getEventRotationAngle()
OPT< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:465
BOARD * board() const
Definition: pcb_tool.h:137
virtual void Remove(EDA_ITEM *aItem)
Definition: selection.h:79
int EDIT_TOOL::Drag ( const TOOL_EVENT aEvent)

Function Drag()

todo

Definition at line 370 of file edit_tool.cpp.

References PNS::DM_ANY, PNS::DM_FREE_ANGLE, PCB_ACTIONS::dragFreeAngle, invokeInlineRouter(), and TOOL_EVENT::IsAction().

Referenced by setTransitions().

371 {
372  int mode = PNS::DM_ANY;
373 
374  if( aEvent.IsAction( &PCB_ACTIONS::dragFreeAngle ) )
375  mode |= PNS::DM_FREE_ANGLE;
376 
377  invokeInlineRouter( mode );
378 
379  return 0;
380 }
static TOOL_ACTION dragFreeAngle
Definition: pcb_actions.h:134
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:54
bool invokeInlineRouter(int aDragMode)
Definition: edit_tool.cpp:341
int EDIT_TOOL::Duplicate ( const TOOL_EVENT aEvent)

Function Duplicate()

Duplicates the current selection and starts a move action.

Definition at line 969 of file edit_tool.cpp.

References EDA_ITEM::ClearSelected(), EDA_DRAW_FRAME::DisplayToolMsg(), BOARD::Duplicate(), MODULE::Duplicate(), PCB_ACTIONS::duplicateIncrement, SELECTION::Empty(), Format(), PCB_BASE_FRAME::GetBoard(), TOOL_EVENT::IsAction(), m_commit, PCB_TOOL::m_editModules, BOARD::m_Modules, m_selectionTool, TOOL_BASE::m_toolMgr, Main(), TOOL_ACTION::MakeEvent(), PCB_ACTIONS::move, PCB_ZONE_AREA_T, SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), PCB_TOOL::selection(), SELECTION_DELETABLE, SELECTION_SANITIZE_PADS, PCB_ACTIONS::selectionClear, PCB_ACTIONS::selectItems, and SELECTION::Size().

Referenced by setTransitions().

970 {
971  bool increment = aEvent.IsAction( &PCB_ACTIONS::duplicateIncrement );
972 
973  // Be sure that there is at least one item that we can modify
975 
976  if( selection.Empty() )
977  return 0;
978 
979  // we have a selection to work on now, so start the tool process
980  PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
981 
982  std::vector<BOARD_ITEM*> new_items;
983  new_items.reserve( selection.Size() );
984 
985  BOARD_ITEM* orig_item = nullptr;
986  BOARD_ITEM* dupe_item = nullptr;
987 
988  // Each selected item is duplicated and pushed to new_items list
989  // Old selection is cleared, and new items are then selected.
990  for( auto item : selection )
991  {
992  if( !item )
993  continue;
994 
995  orig_item = static_cast<BOARD_ITEM*>( item );
996 
997  if( m_editModules )
998  {
999  dupe_item = editFrame->GetBoard()->m_Modules->Duplicate( orig_item, increment );
1000  }
1001  else
1002  {
1003 #if 0
1004  // @TODO: see if we allow zone duplication here
1005  // Duplicate zones is especially tricky (overlaping zones must be merged)
1006  // so zones are not duplicated
1007  if( item->Type() != PCB_ZONE_AREA_T )
1008 #endif
1009  dupe_item = editFrame->GetBoard()->Duplicate( orig_item );
1010  }
1011 
1012  if( dupe_item )
1013  {
1014  // Clear the selection flag here, otherwise the SELECTION_TOOL
1015  // will not properly select it later on
1016  dupe_item->ClearSelected();
1017 
1018  new_items.push_back( dupe_item );
1019  m_commit->Add( dupe_item );
1020  }
1021  }
1022 
1023  // Clear the old selection first
1025 
1026  // Select the new items
1027  m_toolMgr->RunAction( PCB_ACTIONS::selectItems, true, &new_items );
1028 
1029  // record the new items as added
1030  if( !selection.Empty() )
1031  {
1032  editFrame->DisplayToolMsg( wxString::Format( _( "Duplicated %d item(s)" ),
1033  (int) new_items.size() ) );
1034 
1035 
1036  // If items were duplicated, pick them up
1037  // this works well for "dropping" copies around and pushes the commit
1039  Main( evt );
1040  }
1041 
1042  return 0;
1043 }
static TOOL_ACTION selectItems
Selects a list of items (specified as the event parameter)
Definition: pcb_actions.h:59
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:109
int Main(const TOOL_EVENT &aEvent)
Function Main()
Definition: edit_tool.cpp:382
static TOOL_ACTION move
move an item
Definition: pcb_actions.h:93
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
std::unique_ptr< BOARD_COMMIT > m_commit
Definition: edit_tool.h:209
void ClearSelected()
Definition: base_struct.h:242
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
BOARD_ITEM * Duplicate(const BOARD_ITEM *aItem, bool aIncrementPadNumbers, bool aAddToModule=false)
Function Duplicate Duplicate a given item within the module, without adding to the board...
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
BOARD * GetBoard() const
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:54
SELECTION_TOOL * m_selectionTool
Selection tool used for obtaining selected items
Definition: edit_tool.h:173
static TOOL_ACTION duplicateIncrement
Activation of the duplication tool with incrementing (e.g. pad number)
Definition: pcb_actions.h:120
Class TOOL_EVENT.
Definition: tool_event.h:162
SELECTION & RequestSelection(int aFlags=SELECTION_DEFAULT, CLIENT_SELECTION_FILTER aClientFilter=NULL)
Function RequestSelection()
const SELECTION & selection() const
Definition: pcb_tool.cpp:221
bool m_editModules
Definition: pcb_tool.h:144
TOOL_EVENT MakeEvent() const
Function HasHotKey() Checks if the action has a hot key assigned.
Definition: tool_action.h:104
void DisplayToolMsg(const wxString &msg)
Definition: draw_frame.cpp:552
Common, abstract interface for edit frames.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
DLIST< MODULE > m_Modules
Definition: class_board.h:247
int Size() const
Returns the number of selected parts.
Definition: selection.h:115
BOARD_ITEM * Duplicate(const BOARD_ITEM *aItem, bool aAddToBoard=false)
int EDIT_TOOL::editFootprintInFpEditor ( const TOOL_EVENT aEvent)
private

Definition at line 1329 of file edit_tool.cpp.

References SELECTION::Empty(), SELECTION::FirstOfKind(), FootprintFilter(), FRAME_PCB_MODULE_EDITOR, PCB_BASE_FRAME::GetCurItem(), GetNewTimeStamp(), EDA_ITEM::GetTimeStamp(), SELECTION::IsHover(), KIWAY_HOLDER::Kiway(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), m_selectionTool, TOOL_BASE::m_toolMgr, mod, PCB_BASE_FRAME::OnModify(), KIWAY::Player(), SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), PCB_TOOL::selection(), PCB_ACTIONS::selectionClear, PCB_BASE_FRAME::SetCurItem(), and EDA_ITEM::SetTimeStamp().

Referenced by setTransitions().

1330 {
1332 
1333  if( selection.Empty() )
1334  return 0;
1335 
1337 
1338  if( !mod )
1339  return 0;
1340 
1341  PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
1342 
1343  editFrame->SetCurItem( mod );
1344 
1345  if( editFrame->GetCurItem()->GetTimeStamp() == 0 ) // Module Editor needs a non null timestamp
1346  {
1347  editFrame->GetCurItem()->SetTimeStamp( GetNewTimeStamp() );
1348  editFrame->OnModify();
1349  }
1350 
1352 
1353  editor->Load_Module_From_BOARD( (MODULE*) editFrame->GetCurItem() );
1354  editFrame->SetCurItem( NULL ); // the current module could be deleted by
1355 
1356  editor->Show( true );
1357  editor->Raise(); // Iconize( false );
1358 
1359  if( selection.IsHover() )
1361 
1362  return 0;
1363 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:109
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void SetCurItem(BOARD_ITEM *aItem, bool aDisplayInfo=true)
Function SetCurItem sets the currently selected item and displays it in the MsgPanel.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
SELECTION_TOOL * m_selectionTool
Selection tool used for obtaining selected items
Definition: edit_tool.h:173
timestamp_t GetNewTimeStamp()
Definition: common.cpp:160
VTBL_ENTRY KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=NULL)
Function Player returns the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:300
SELECTION & RequestSelection(int aFlags=SELECTION_DEFAULT, CLIENT_SELECTION_FILTER aClientFilter=NULL)
Function RequestSelection()
bool Load_Module_From_BOARD(MODULE *Module)
Function Load_Module_From_BOARD load in Modedit a footprint from the main board.
const SELECTION & selection() const
Definition: pcb_tool.cpp:221
T * FirstOfKind() const
Definition: selection.h:161
virtual void OnModify()
Function OnModify Virtual Must be called after a change in order to set the "modify" flag of the curr...
Common, abstract interface for edit frames.
bool IsHover() const
Definition: selection.h:69
static void FootprintFilter(const VECTOR2I &, GENERAL_COLLECTOR &aCollector)
Function FootprintFilter()
Definition: edit_tool.cpp:1133
BOARD_ITEM * GetCurItem()
#define mod(a, n)
Definition: greymap.cpp:24
timestamp_t GetTimeStamp() const
Definition: base_struct.h:215
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:214
bool PCB_TOOL::EditingModules ( ) const
inlineinherited

Definition at line 99 of file pcb_tool.h.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), PAD_TOOL::Init(), and MeasureTool().

100  {
101  return m_editModules;
102  }
bool m_editModules
Definition: pcb_tool.h:144
const TOOL_EVENT TOOL_INTERACTIVE::evActivate ( std::string  aToolName = "")
protectedinherited

functions below are not yet implemented - their interface may change

const TOOL_EVENT TOOL_INTERACTIVE::evButtonDown ( int  aButton = BUT_ANY)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evButtonUp ( int  aButton = BUT_ANY)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evClick ( int  aButton = BUT_ANY)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evCommand ( int  aCommandId = -1)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evCommand ( std::string  aCommandStr = "")
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evDrag ( int  aButton = BUT_ANY)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evMotion ( )
protectedinherited
int EDIT_TOOL::ExchangeFootprints ( const TOOL_EVENT aEvent)

Function ExchangeFootprints()

Invoke the dialog used to update or exchange the footprints used for modules. The mode depends on the PCB_ACTIONS held by the TOOL_EVENT.

Definition at line 1145 of file edit_tool.cpp.

References SELECTION::Empty(), SELECTION::FirstOfKind(), FootprintFilter(), PCB_TOOL::frame(), TOOL_EVENT::IsAction(), m_selectionTool, TOOL_BASE::m_toolMgr, mod, SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), PCB_TOOL::selection(), PCB_ACTIONS::selectionClear, PCB_BASE_FRAME::SetCurItem(), DIALOG_SHIM::ShowQuasiModal(), and PCB_ACTIONS::updateFootprints.

Referenced by setTransitions().

1146 {
1148 
1149  bool updateMode = aEvent.IsAction( &PCB_ACTIONS::updateFootprints );
1150 
1151  MODULE* mod = (selection.Empty() ? nullptr : selection.FirstOfKind<MODULE> () );
1152 
1153  frame()->SetCurItem( mod );
1154 
1155  // Footprint exchange could remove modules, so they have to be
1156  // removed from the selection first
1158 
1159  // invoke the exchange dialog process
1160  {
1161  DIALOG_EXCHANGE_FOOTPRINTS dialog( frame(), mod, updateMode );
1162  dialog.ShowQuasiModal();
1163  }
1164 
1165  return 0;
1166 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:109
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void SetCurItem(BOARD_ITEM *aItem, bool aDisplayInfo=true)
Function SetCurItem sets the currently selected item and displays it in the MsgPanel.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:54
SELECTION_TOOL * m_selectionTool
Selection tool used for obtaining selected items
Definition: edit_tool.h:173
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:136
SELECTION & RequestSelection(int aFlags=SELECTION_DEFAULT, CLIENT_SELECTION_FILTER aClientFilter=NULL)
Function RequestSelection()
const SELECTION & selection() const
Definition: pcb_tool.cpp:221
T * FirstOfKind() const
Definition: selection.h:161
static TOOL_ACTION updateFootprints
Update footprints to reflect any changes in the library.
Definition: pcb_actions.h:123
static void FootprintFilter(const VECTOR2I &, GENERAL_COLLECTOR &aCollector)
Function FootprintFilter()
Definition: edit_tool.cpp:1133
#define mod(a, n)
Definition: greymap.cpp:24
int EDIT_TOOL::Flip ( const TOOL_EVENT aEvent)

Function Flip()

Rotates currently selected items. The rotation point is the current cursor position.

Definition at line 840 of file edit_tool.cpp.

References SELECTION_TOOL::CheckLock(), SELECTION::Empty(), SELECTION::GetReferencePoint(), m_commit, m_dragging, m_selectionTool, TOOL_BASE::m_toolMgr, SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), PCB_TOOL::selection(), SELECTION_LOCKED, PCB_ACTIONS::selectionClear, PCB_ACTIONS::selectionModified, and updateModificationPoint().

Referenced by setTransitions().

841 {
843 
845  return 0;
846 
847  if( selection.Empty() )
848  return 0;
849 
851  auto modPoint = selection.GetReferencePoint();
852 
853  for( auto item : selection )
854  {
855  if( !item->IsNew() )
856  m_commit->Modify( item );
857 
858  static_cast<BOARD_ITEM*>( item )->Flip( modPoint );
859  }
860 
861  if( !m_dragging )
862  m_commit->Push( _( "Flip" ) );
863 
864  if( selection.IsHover() && !m_dragging )
866 
868 
869  return 0;
870 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:109
VECTOR2I GetReferencePoint() const
Definition: selection.h:198
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
std::unique_ptr< BOARD_COMMIT > m_commit
Definition: edit_tool.h:209
SELECTION_LOCK_FLAGS CheckLock()
Checks if the user has agreed to modify locked items for the given selection.
bool updateModificationPoint(SELECTION &aSelection)
Returns the right modification point (e.g.
Definition: edit_tool.cpp:1306
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
SELECTION_TOOL * m_selectionTool
Selection tool used for obtaining selected items
Definition: edit_tool.h:173
static TOOL_ACTION selectionModified
Modified selection notification.
Definition: pcb_actions.h:111
int Flip(const TOOL_EVENT &aEvent)
Function Flip()
Definition: edit_tool.cpp:840
bool m_dragging
Flag determining if anything is being dragged right now
Definition: edit_tool.h:176
SELECTION & RequestSelection(int aFlags=SELECTION_DEFAULT, CLIENT_SELECTION_FILTER aClientFilter=NULL)
Function RequestSelection()
const SELECTION & selection() const
Definition: pcb_tool.cpp:221
void EDIT_TOOL::FootprintFilter ( const VECTOR2I ,
GENERAL_COLLECTOR aCollector 
)
static

Function FootprintFilter()

A selection filter which prunes the selection to contain only items of type PCB_MODULE_T

Definition at line 1133 of file edit_tool.cpp.

References COLLECTOR::GetCount(), i, PCB_MODULE_T, COLLECTOR::Remove(), and EDA_ITEM::Type().

Referenced by editFootprintInFpEditor(), ExchangeFootprints(), and showLocalRatsnest().

1134 {
1135  for( int i = aCollector.GetCount() - 1; i >= 0; i-- )
1136  {
1137  BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aCollector[i] );
1138 
1139  if( item->Type() != PCB_MODULE_T )
1140  aCollector.Remove( i );
1141  }
1142 }
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:106
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
void Remove(int aIndex)
Function Remove removes the item at aIndex (first position is 0);.
Definition: collector.h:135
class MODULE, a footprint
Definition: typeinfo.h:89
size_t i
Definition: json11.cpp:597
PCB_EDIT_FRAME* PCB_TOOL::frame ( ) const
inlineprotectedinherited

Definition at line 136 of file pcb_tool.h.

Referenced by POINT_EDITOR::addCorner(), MICROWAVE_TOOL::addMicrowaveFootprint(), PAD_TOOL::applyPadSettings(), PCB_TOOL::canvas(), changeTrackWidthOnClick(), PNS::TOOL_BASE::checkSnap(), PAD_TOOL::copyPadSettings(), copyToClipboard(), MICROWAVE_TOOL::createInductorBetween(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), ROUTER_TOOL::CustomTrackWidthDialog(), PCB_TOOL::displayOptions(), PCB_TOOL::doInteractiveItemPlacement(), ROUTER_TOOL::DpDimensionsDialog(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawVia(), MODULE_EDITOR_TOOLS::EnumeratePads(), ExchangeFootprints(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), ROUTER_TOOL::finishInteractive(), getMicrowaveItemCreator(), highlightNet(), PICKER_TOOL::Init(), PAD_TOOL::Init(), Init(), SELECTION_TOOL::Init(), ROUTER_TOOL::InlineDrag(), PICKER_TOOL::Main(), Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), LENGTH_TUNER_TOOL::meanderSettingsDialog(), MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::onViaCommand(), PCBNEW_CONTROL::PasteItemsFromClipboard(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), MODULE_EDITOR_TOOLS::PlacePad(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), PAD_TOOL::pushPadSettings(), POINT_EDITOR::removeCorner(), PNS::TOOL_BASE::Reset(), ROUTER_TOOL::RouteDiffPair(), ROUTER_TOOL::RouteSingleTrace(), ROUTER_TOOL::SettingsDialog(), ROUTER_TOOL::switchLayerOnViaPlacement(), LENGTH_TUNER_TOOL::TuneDiffPair(), LENGTH_TUNER_TOOL::TuneDiffPairSkew(), LENGTH_TUNER_TOOL::TuneSingleTrace(), POINT_EDITOR::updateItem(), ZONE_FILLER_TOOL::ZoneFill(), and ZONE_FILLER_TOOL::ZoneFillAll().

136 { return getEditFrame<PCB_EDIT_FRAME>(); }
BOARD_COMMIT* EDIT_TOOL::GetCurrentCommit ( ) const
inline

Definition at line 166 of file edit_tool.h.

References m_commit.

167  {
168  return m_commit.get();
169  }
std::unique_ptr< BOARD_COMMIT > m_commit
Definition: edit_tool.h:209
template<typename T >
T* TOOL_BASE::getEditFrame ( ) const
inlineprotectedinherited

Function getEditFrame()

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

Definition at line 188 of file tool_base.h.

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

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

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

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 122 of file tool_base.h.

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

123  {
124  return m_toolId;
125  }
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:210
TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

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

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

Definition at line 144 of file tool_base.h.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), PCB_TOOL::doInteractiveItemPlacement(), CONTEXT_MENU::getToolManager(), MeasureTool(), and CONTEXT_MENU::onMenuEvent().

145  {
146  return m_toolMgr;
147  }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
template<typename T >
T* TOOL_BASE::getModel ( ) const
inlineprotectedinherited

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 199 of file tool_base.h.

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

200  {
201  EDA_ITEM* m = getModelInt();
202 
203  return static_cast<T*>( m );
204  }
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:162
EDA_ITEM * getModelInt() const
Definition: tool_base.cpp:53
const std::string& TOOL_BASE::GetName ( void  ) const
inlineinherited

Function GetName() Returns the name of the tool.

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

Returns
The name of the tool.

Definition at line 133 of file tool_base.h.

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

134  {
135  return m_toolName;
136  }
std::string m_toolName
Name of the tool.
Definition: tool_base.h:214
TOOL_SETTINGS & TOOL_BASE::GetSettings ( )
inherited

Definition at line 77 of file tool_base.cpp.

Referenced by GERBVIEW_CONTROL::HighlightControl(), ROUTER_TOOL::Init(), SELECTION_TOOL::selectable(), and ROUTER_TOOL::~ROUTER_TOOL().

78 {
79  return m_toolSettings;
80 }
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:216
TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 111 of file tool_base.h.

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

112  {
113  return m_type;
114  }
TOOL_TYPE m_type
Stores the type of the tool.
Definition: tool_base.h:207
KIGFX::VIEW * TOOL_BASE::getView ( ) const
protectedinherited

Function getView()

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

Returns
The instance of VIEW.

Definition at line 35 of file tool_base.cpp.

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

Referenced by ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), PCBNEW_CONTROL::CursorControl(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SELECTION_TOOL::disambiguationMenu(), MICROWAVE_TOOL::drawMicrowaveInductor(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), SELECTION_TOOL::findCallback(), ROUTER_TOOL::getStartLayer(), PCBNEW_CONTROL::GridResetOrigin(), PCBNEW_CONTROL::GridSetOrigin(), SELECTION_TOOL::guessSelectionCandidates(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), GERBVIEW_SELECTION_TOOL::MeasureTool(), MeasureTool(), MoveExact(), POINT_EDITOR::OnSelectionChange(), PCBNEW_CONTROL::PanControl(), PNS::TOOL_BASE::pickSingleItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), PCB_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), SELECTION_TOOL::Reset(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), SELECTION_TOOL::selectable(), GERBVIEW_SELECTION_TOOL::selectionContains(), SELECTION_TOOL::selectionContains(), GERBVIEW_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), POINT_EDITOR::updateEditedPoint(), COMMON_TOOLS::updateGrid(), PCBNEW_CONTROL::updateGrid(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), COMMON_TOOLS::ZoomFitScreen(), GERBVIEW_SELECTION_TOOL::zoomFitSelection(), SELECTION_TOOL::zoomFitSelection(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and SELECTION_TOOL::~SELECTION_TOOL().

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

Function getViewControls()

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

Returns
The instance of VIEW_CONTROLS.

Definition at line 41 of file tool_base.cpp.

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

Referenced by POINT_EDITOR::addCorner(), PCBNEW_CONTROL::CursorControl(), COMMON_TOOLS::doZoomToPreset(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawZone(), MODULE_EDITOR_TOOLS::EnumeratePads(), SELECTION_TOOL::findMove(), PCB_EDITOR_CONTROL::HighlightNet(), PCB_EDITOR_CONTROL::HighlightNetCursor(), PICKER_TOOL::Main(), Main(), GERBVIEW_SELECTION_TOOL::Main(), ROUTER_TOOL::mainLoop(), GERBVIEW_SELECTION_TOOL::MeasureTool(), MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), GERBVIEW_CONTROL::ResetCoords(), PCBNEW_CONTROL::ResetCoords(), DRAWING_TOOL::runPolygonEventLoop(), GERBVIEW_SELECTION_TOOL::selectCursor(), SELECTION_TOOL::selectCursor(), GERBVIEW_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), ZOOM_TOOL::selectRegion(), PICKER_TOOL::setControls(), POINT_EDITOR::setEditedPoint(), updateModificationPoint(), and COMMON_TOOLS::ZoomCenter().

42 {
43  return m_toolMgr->GetViewControls();
44 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:257
template<class T >
void TOOL_INTERACTIVE::Go ( int(T::*)(const TOOL_EVENT &)  aStateFunc,
const TOOL_EVENT_LIST aConditions = TOOL_EVENTTC_ANYTA_ANY ) 
)
inherited

Function Go()

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

Definition at line 135 of file tool_interactive.h.

References TOOL_INTERACTIVE::goInternal().

Referenced by ZOOM_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), PAD_TOOL::setTransitions(), MICROWAVE_TOOL::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), POINT_EDITOR::setTransitions(), COMMON_TOOLS::setTransitions(), GERBVIEW_CONTROL::setTransitions(), MODULE_EDITOR_TOOLS::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), PCBNEW_CONTROL::setTransitions(), PICKER_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), PCB_EDITOR_CONTROL::setTransitions(), SELECTION_TOOL::setTransitions(), setTransitions(), and DRAWING_TOOL::setTransitions().

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

Function hoverSelection()

If there are no items currently selected, it tries to choose the item that is under he cursor or displays a disambiguation menu if there are multiple items.

Parameters
aSanitizesanitize selection using SanitizeSelection()
Returns
true if the eventual selection contains any items, or false if it fails to select any items.
bool 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 278 of file edit_tool.cpp.

References CONDITIONAL_MENU::AddItem(), CONDITIONAL_MENU::AddSeparator(), PCB_ACTIONS::copyToClipboard, SELECTION_CONDITIONS::Count(), PCB_ACTIONS::createArray, PCB_ACTIONS::createPadFromShapes, PCB_ACTIONS::cutToClipboard, DisplayError(), PCB_ACTIONS::drag45Degree, PCB_ACTIONS::dragFreeAngle, PCB_ACTIONS::duplicate, PCB_ACTIONS::editFootprintInFpEditor, PCB_ACTIONS::exchangeFootprints, PCB_ACTIONS::explodePadToShapes, TOOL_MANAGER::FindTool(), PCB_ACTIONS::flip, PCB_TOOL::frame(), TOOL_MENU::GetMenu(), EDA_DRAW_FRAME::GetToolId(), SELECTION_TOOL::GetToolMenu(), ID_NO_TOOL_SELECTED, PCB_TOOL::m_editModules, m_selectionTool, TOOL_BASE::m_toolMgr, PCB_ACTIONS::mirror, PCB_ACTIONS::move, PCB_ACTIONS::moveExact, SELECTION_CONDITIONS::NotEmpty(), SELECTION_CONDITIONS::OnlyType(), SELECTION_CONDITIONS::OnlyTypes(), PCB_ACTIONS::pasteFromClipboard, PCB_MODULE_T, PCB_ACTIONS::positionRelative, PCB_ACTIONS::properties, PCB_ACTIONS::remove, PCB_ACTIONS::rotateCcw, PCB_ACTIONS::rotateCw, GENERAL_COLLECTOR::Tracks, and PCB_ACTIONS::updateFootprints.

279 {
280  // Find the selection tool, so they can cooperate
281  m_selectionTool = static_cast<SELECTION_TOOL*>( m_toolMgr->FindTool( "pcbnew.InteractiveSelection" ) );
282 
283  if( !m_selectionTool )
284  {
285  DisplayError( NULL, wxT( "pcbnew.InteractiveSelection tool is not available" ) );
286  return false;
287  }
288 
289  auto editingModuleCondition = [ this ] ( const SELECTION& aSelection ) {
290  return m_editModules;
291  };
292 
293  auto singleModuleCondition = SELECTION_CONDITIONS::OnlyType( PCB_MODULE_T )
295 
296  auto noActiveToolCondition = [ this ] ( const SELECTION& aSelection ) {
297  return ( frame()->GetToolId() == ID_NO_TOOL_SELECTED );
298  };
299 
300  // Add context menu entries that are displayed when selection tool is active
302 
312 
313 
318 
319 
322  // Selection tool handles the context menu for some other tools, such as the Picker.
323  // Don't add things like Paste when another tool is active.
324  menu.AddItem( PCB_ACTIONS::pasteFromClipboard, noActiveToolCondition );
325  menu.AddSeparator( noActiveToolCondition );
326 
327  // Mirror only available in modedit
328  menu.AddItem( PCB_ACTIONS::mirror, editingModuleCondition && SELECTION_CONDITIONS::NotEmpty );
331 
332  // Footprint actions
333  menu.AddItem( PCB_ACTIONS::editFootprintInFpEditor, singleModuleCondition );
334  menu.AddItem( PCB_ACTIONS::updateFootprints, singleModuleCondition );
335  menu.AddItem( PCB_ACTIONS::exchangeFootprints, singleModuleCondition );
336 
337  return true;
338 }
TOOL_BASE * FindTool(int aId) const
Function FindTool() Searches for a tool with given ID.
static TOOL_ACTION move
move an item
Definition: pcb_actions.h:93
static const KICAD_T Tracks[]
A scan list for only TRACKS.
Definition: collectors.h:305
void AddSeparator(const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Function AddSeparator()
Class SELECTION_TOOL.
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:49
static TOOL_ACTION dragFreeAngle
Definition: pcb_actions.h:134
static TOOL_ACTION explodePadToShapes
Definition: pcb_actions.h:308
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
static TOOL_ACTION properties
Activation of the edit tool.
Definition: pcb_actions.h:108
static TOOL_ACTION drag45Degree
Definition: pcb_actions.h:133
static TOOL_ACTION mirror
Mirroring of selected items.
Definition: pcb_actions.h:105
SELECTION_TOOL * m_selectionTool
Selection tool used for obtaining selected items
Definition: edit_tool.h:173
static SELECTION_CONDITION Count(int aNumber)
Function Count Creates a functor that tests if the number of selected items is equal to the value giv...
static TOOL_ACTION pasteFromClipboard
Paste from clipboard.
Definition: pcb_actions.h:320
static bool NotEmpty(const SELECTION &aSelection)
Function NotEmpty Tests if there are any items selected.
static TOOL_ACTION moveExact
Activation of the exact move tool.
Definition: pcb_actions.h:114
static TOOL_ACTION duplicate
Activation of the duplication tool.
Definition: pcb_actions.h:117
class MODULE, a footprint
Definition: typeinfo.h:89
static TOOL_ACTION rotateCw
Rotation of selected objects clockwise.
Definition: pcb_actions.h:96
static SELECTION_CONDITION OnlyTypes(const std::vector< KICAD_T > &aTypes)
Function OnlyTypes Creates a functor that tests if the selected items are only of given types...
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:136
static TOOL_ACTION createArray
Tool for creating an array of objects.
Definition: pcb_actions.h:314
static TOOL_ACTION exchangeFootprints
Exchange footprints of modules.
Definition: pcb_actions.h:126
static TOOL_ACTION cutToClipboard
Paste from clipboard.
Definition: pcb_actions.h:323
static TOOL_ACTION copyToClipboard
Copy selected items to clipboard.
Definition: pcb_actions.h:317
bool m_editModules
Definition: pcb_tool.h:144
static TOOL_ACTION updateFootprints
Update footprints to reflect any changes in the library.
Definition: pcb_actions.h:123
static TOOL_ACTION rotateCcw
Rotation of selected objects counter-clockwise.
Definition: pcb_actions.h:99
static TOOL_ACTION createPadFromShapes
Definition: pcb_actions.h:307
static TOOL_ACTION flip
Flipping of selected objects.
Definition: pcb_actions.h:102
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Function AddItem()
static TOOL_ACTION editFootprintInFpEditor
Definition: pcb_actions.h:401
int GetToolId() const
Definition: draw_frame.h:496
static SELECTION_CONDITION OnlyType(KICAD_T aType)
Function OnlyType Creates a functor that tests if the selected items are only of given type...
static TOOL_ACTION positionRelative
Activation of the position relative tool.
Definition: pcb_actions.h:251
static TOOL_ACTION remove
Deleting a BOARD_ITEM.
Definition: pcb_actions.h:129
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:185
bool EDIT_TOOL::invokeInlineRouter ( int  aDragMode)
private

Definition at line 341 of file edit_tool.cpp.

References TOOL_MANAGER::FindTool(), TOOL_BASE::m_toolMgr, PCB_ACTIONS::routerInlineDrag, TOOL_MANAGER::RunAction(), and PNS::theRouter.

Referenced by Drag(), and Main().

342 {
343  auto theRouter = static_cast<ROUTER_TOOL*>( m_toolMgr->FindTool( "pcbnew.InteractiveRouter" ) );
344 
345  if( !theRouter )
346  return false;
347 
348  // make sure we don't accidentally invoke inline routing mode while the router is already active!
349  if( theRouter->IsToolActive() )
350  return false;
351 
352  if( theRouter->CanInlineDrag() )
353  {
355  return true;
356  }
357 
358  return false;
359 }
TOOL_BASE * FindTool(int aId) const
Function FindTool() Searches for a tool with given ID.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
static TOOL_ACTION routerInlineDrag
Activation of the Push and Shove router (inline dragging mode)
Definition: pcb_actions.h:215
static ROUTER * theRouter
Definition: pns_router.cpp:59
bool EDIT_TOOL::isInteractiveDragEnabled ( ) const
private

Definition at line 362 of file edit_tool.cpp.

References TOOL_MANAGER::FindTool(), PNS::ROUTING_SETTINGS::InlineDragEnabled(), TOOL_BASE::m_toolMgr, PNS::ROUTER::Settings(), and PNS::theRouter.

Referenced by Main().

363 {
364  auto theRouter = static_cast<ROUTER_TOOL*>( m_toolMgr->FindTool( "pcbnew.InteractiveRouter" ) );
365 
366  return theRouter ? theRouter->Router()->Settings().InlineDragEnabled() : false;
367 }
TOOL_BASE * FindTool(int aId) const
Function FindTool() Searches for a tool with given ID.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
static ROUTER * theRouter
Definition: pns_router.cpp:59
ROUTING_SETTINGS & Settings()
Definition: pns_router.h:187
bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 30 of file tool_base.cpp.

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

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

Function Main()

Main loop in which events are handled.

Parameters
aEventis the handled event.

Definition at line 382 of file edit_tool.cpp.

References TOOL_INTERACTIVE::Activate(), GRID_HELPER::Align(), GRID_HELPER::BestDragOrigin(), GRID_HELPER::BestSnapAnchor(), BUT_LEFT, SELECTION_TOOL::CheckLock(), SELECTION::ClearReferencePoint(), PCB_TOOL::controls(), delta, PNS::DM_ANY, PCB_ACTIONS::duplicate, PCB_ACTIONS::editActivate, SELECTION::Empty(), KIGFX::VIEW_CONTROLS::ForceCursorPosition(), PCB_TOOL::frame(), SELECTION::Front(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), BOARD_ITEM::GetPosition(), TOOL_BASE::getViewControls(), i, invokeInlineRouter(), SELECTION::IsHover(), isInteractiveDragEnabled(), m_commit, m_cursor, m_dragging, m_selectionTool, TOOL_BASE::m_toolMgr, PCB_ACTIONS::move, PCB_ACTIONS::moveExact, PCB_ACTIONS::remove, SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), PCB_TOOL::selection(), SELECTION_DEFAULT, SELECTION_LOCKED, PCB_ACTIONS::selectionClear, PCB_ACTIONS::selectionModified, KIGFX::VIEW_CONTROLS::SetAutoPan(), GRID_HELPER::SetAuxAxes(), KIGFX::VIEW_CONTROLS::SetCursorPosition(), BOARD_ITEM::SetPosition(), SELECTION::SetReferencePoint(), KIGFX::VIEW_CONTROLS::SetSnapping(), KIGFX::VIEW_CONTROLS::ShowCursor(), TA_UNDO_REDO_PRE, TC_COMMAND, TC_MOUSE, updateModificationPoint(), PCB_BASE_FRAME::UpdateMsgPanel(), and TOOL_INTERACTIVE::Wait().

Referenced by Duplicate(), and setTransitions().

383 {
385  PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
386 
387  VECTOR2I originalCursorPos = controls->GetCursorPosition();
388 
389  // Be sure that there is at least one item that we can modify. If nothing was selected before,
390  // try looking for the stuff under mouse cursor (i.e. Kicad old-style hover selection)
392 
393  if( selection.Empty() )
394  return 0;
395 
396  bool unselect = selection.IsHover();
397 
398  if( m_dragging )
399  return 0;
400 
401  Activate();
402 
403  m_dragging = false; // Are selected items being dragged?
404  bool restore = false; // Should items' state be restored when finishing the tool?
405 
406  controls->ShowCursor( true );
407  controls->SetSnapping( true );
408  controls->SetAutoPan( true );
409 
410  // cumulative translation
411  VECTOR2I totalMovement;
412  GRID_HELPER grid( editFrame );
413  OPT_TOOL_EVENT evt = aEvent;
414  VECTOR2I prevPos;
415 
416  // Main loop: keep receiving events
417  do
418  {
419  if( evt->IsAction( &PCB_ACTIONS::editActivate ) ||
420  evt->IsAction( &PCB_ACTIONS::move ) ||
421  evt->IsMotion() || evt->IsDrag( BUT_LEFT ) )
422  {
423  if( selection.Empty() )
424  break;
425 
426  auto curr_item = static_cast<BOARD_ITEM*>( selection.Front() );
427 
428  if( m_dragging && evt->Category() == TC_MOUSE )
429  {
430  m_cursor = grid.BestSnapAnchor( evt->Position(), curr_item );
431  controls->ForceCursorPosition( true, m_cursor );
432 
433  VECTOR2I movement( m_cursor - prevPos );
435 
436  totalMovement += movement;
437  prevPos = m_cursor;
438 
439  // Drag items to the current cursor position
440  for( auto item : selection )
441  {
442  // Don't double move footprint pads, fields, etc.
443  if( item->GetParent() && item->GetParent()->IsSelected() )
444  continue;
445 
446  static_cast<BOARD_ITEM*>( item )->Move( movement );
447  }
448 
449  frame()->UpdateMsgPanel();
450  }
451  else if( !m_dragging ) // Prepare to start dragging
452  {
453  bool invokedRouter = false;
454 
455  if ( !evt->IsAction( &PCB_ACTIONS::move ) && isInteractiveDragEnabled() )
456  invokedRouter = invokeInlineRouter( PNS::DM_ANY );
457 
458  if( !invokedRouter )
459  {
460  // deal with locked items (override lock or abort the operation)
462 
463  if( lockFlags == SELECTION_LOCKED )
464  break;
465 
466  // Save items, so changes can be undone
467  for( auto item : selection )
468  {
469  // Don't double move footprint pads, fields, etc.
470  if( item->GetParent() && item->GetParent()->IsSelected() )
471  continue;
472 
473  m_commit->Modify( item );
474  }
475 
476  m_cursor = controls->GetCursorPosition();
477 
478  if ( selection.HasReferencePoint() )
479  {
480  // start moving with the reference point attached to the cursor
481  grid.SetAuxAxes( false );
482 
483  auto delta = m_cursor - selection.GetReferencePoint();
484 
485  // Drag items to the current cursor position
486  for( auto item : selection )
487  {
488  // Don't double move footprint pads, fields, etc.
489  if( item->GetParent() && item->GetParent()->IsSelected() )
490  continue;
491 
492  static_cast<BOARD_ITEM*>( item )->Move( delta );
493  }
494 
495  selection.SetReferencePoint( m_cursor );
496  }
497  else if( selection.Size() == 1 )
498  {
499  // Set the current cursor position to the first dragged item origin, so the
500  // movement vector could be computed later
501  updateModificationPoint( selection );
502  m_cursor = grid.BestDragOrigin( originalCursorPos, curr_item );
503  grid.SetAuxAxes( true, m_cursor );
504  }
505  else
506  {
507  updateModificationPoint( selection );
508  m_cursor = grid.Align( m_cursor );
509  }
510 
511  controls->SetCursorPosition( m_cursor, false );
512 
513  prevPos = m_cursor;
514  controls->SetAutoPan( true );
515  m_dragging = true;
516  }
517  }
518 
520  }
521 
522  else if( evt->IsCancel() || evt->IsActivate() )
523  {
524  restore = true; // Cancelling the tool means that items have to be restored
525  break; // Finish
526  }
527 
528  else if( evt->Action() == TA_UNDO_REDO_PRE )
529  {
530  unselect = true;
531  break;
532  }
533 
534  // Dispatch TOOL_ACTIONs
535  else if( evt->Category() == TC_COMMAND )
536  {
537  if( evt->IsAction( &PCB_ACTIONS::remove ) )
538  {
539  // exit the loop, as there is no further processing for removed items
540  break;
541  }
542  else if( evt->IsAction( &PCB_ACTIONS::duplicate ) )
543  {
544  // On duplicate, stop moving this item
545  // The duplicate tool should then select the new item and start
546  // a new move procedure
547  break;
548  }
549  else if( evt->IsAction( &PCB_ACTIONS::moveExact ) )
550  {
551  // Can't do this, because the selection will then contain
552  // stale pointers and it will all go horribly wrong...
553  //editFrame->RestoreCopyFromUndoList( dummy );
554  //
555  // So, instead, reset the position manually
556  for( auto item : selection )
557  {
558  BOARD_ITEM* i = static_cast<BOARD_ITEM*>( item );
559  auto delta = VECTOR2I( i->GetPosition() ) - totalMovement;
560  i->SetPosition( wxPoint( delta.x, delta.y ) );
561 
562  // And what about flipping and rotation?
563  // for now, they won't be undone, but maybe that is how
564  // it should be, so you can flip and move exact in the
565  // same action?
566  }
567 
568  // This causes a double event, so we will get the dialogue
569  // correctly, somehow - why does Rotate not?
570  //MoveExact( aEvent );
571  break; // exit the loop - we move exactly, so we have finished moving
572  }
573  }
574 
575  else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
576  {
577  break; // Finish
578  }
579  } while( ( evt = Wait() ) ); //Should be assignment not equality test
580 
581  controls->ForceCursorPosition( false );
582  controls->ShowCursor( false );
583  controls->SetSnapping( false );
584  controls->SetAutoPan( false );
585 
586  m_dragging = false;
587  // Discard reference point when selection is "dropped" onto the board (ie: not dragging anymore)
588  selection.ClearReferencePoint();
589 
590  if( unselect || restore )
592 
593  if( restore )
594  m_commit->Revert();
595  else
596  m_commit->Push( _( "Drag" ) );
597 
598  return 0;
599 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
VECTOR2I m_cursor
Last cursor position (needed for getModificationPoint() to avoid changes of edit reference point)...
Definition: edit_tool.h:180
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:109
static TOOL_ACTION move
move an item
Definition: pcb_actions.h:93
static TOOL_ACTION editActivate
Activation of the edit tool.
Definition: pcb_actions.h:90
virtual void SetPosition(const wxPoint &aPos)=0
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
std::unique_ptr< BOARD_COMMIT > m_commit
Definition: edit_tool.h:209
SELECTION_LOCK_FLAGS CheckLock()
Checks if the user has agreed to modify locked items for the given selection.
bool updateModificationPoint(SELECTION &aSelection)
Returns the right modification point (e.g.
Definition: edit_tool.cpp:1306
EDA_ITEM * Front() const
Definition: selection.h:147
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
virtual void SetSnapping(bool aEnabled)
Function SetSnapping() Enables/disables snapping cursor to grid.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
SELECTION_TOOL * m_selectionTool
Selection tool used for obtaining selected items
Definition: edit_tool.h:173
VECTOR2< int > VECTOR2I
Definition: vector2d.h:589
static const int delta[8][2]
Definition: solve.cpp:112
static TOOL_ACTION selectionModified
Modified selection notification.
Definition: pcb_actions.h:111
static TOOL_ACTION moveExact
Activation of the exact move tool.
Definition: pcb_actions.h:114
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Moves cursor to the requested position expressed in world coordinates.
KIGFX::VIEW_CONTROLS * controls() const
Definition: pcb_tool.h:135
static TOOL_ACTION duplicate
Activation of the duplication tool.
Definition: pcb_actions.h:117
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:203
bool m_dragging
Flag determining if anything is being dragged right now
Definition: edit_tool.h:176
SELECTION_LOCK_FLAGS
Definition: selection.h:227
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:136
SELECTION & RequestSelection(int aFlags=SELECTION_DEFAULT, CLIENT_SELECTION_FILTER aClientFilter=NULL)
Function RequestSelection()
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.
const SELECTION & selection() const
Definition: pcb_tool.cpp:221
bool isInteractiveDragEnabled() const
Definition: edit_tool.cpp:362
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg...
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
virtual const wxPoint GetPosition() const =0
bool invokeInlineRouter(int aDragMode)
Definition: edit_tool.cpp:341
Common, abstract interface for edit frames.
size_t i
Definition: json11.cpp:597
bool IsHover() const
Definition: selection.h:69
void Activate()
Function Activate() Runs the tool.
static TOOL_ACTION remove
Deleting a BOARD_ITEM.
Definition: pcb_actions.h:129
void UpdateMsgPanel() override
>
OPT< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:465
int EDIT_TOOL::MeasureTool ( const TOOL_EVENT aEvent)

Launches a tool to measure between points

Definition at line 1169 of file edit_tool.cpp.

References TOOL_INTERACTIVE::Activate(), KIGFX::PCB_VIEW::Add(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), PCB_TOOL::controls(), PCB_TOOL::EditingModules(), KIGFX::VIEW_CONTROLS::ForceCursorPosition(), PCB_TOOL::frame(), KIGFX::GEOMETRY, KIGFX::VIEW_CONTROLS::GetCursorPosition(), BASE_SCREEN::GetGridSize(), TOOL_BASE::GetManager(), S3D::GetModel(), KIGFX::VIEW_CONTROLS::GetMousePosition(), PCB_BASE_FRAME::GetScreen(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), ID_MODEDIT_MEASUREMENT_TOOL, ID_PCB_MEASUREMENT_TOOL, KiROUND(), Magnetize(), MD_CTRL, TOOL_MANAGER::PassEvent(), KIGFX::PCB_VIEW::Remove(), KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::SetAngleSnap(), KIGFX::VIEW_CONTROLS::SetAutoPan(), KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::SetEnd(), EDA_DRAW_FRAME::SetMousePosition(), EDA_DRAW_FRAME::SetNoToolSelected(), KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::SetOrigin(), KIGFX::VIEW_CONTROLS::SetSnapping(), PCB_BASE_FRAME::SetToolID(), KIGFX::VIEW::SetVisible(), KIGFX::VIEW_CONTROLS::ShowCursor(), KIGFX::PCB_VIEW::Update(), PCB_TOOL::view(), TOOL_INTERACTIVE::Wait(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by setTransitions().

1170 {
1171  if( EditingModules() && !frame()->GetModel())
1172  return 0;
1173 
1174  auto& view = *getView();
1175  auto& controls = *getViewControls();
1177 
1178  Activate();
1179  frame()->SetToolID( toolID, wxCURSOR_PENCIL, _( "Measure distance" ) );
1180 
1182 
1183  KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr );
1184 
1185  view.Add( &ruler );
1186  view.SetVisible( &ruler, false );
1187 
1188  bool originSet = false;
1189 
1190  controls.ShowCursor( true );
1191  controls.SetSnapping( true );
1192  controls.SetAutoPan( false );
1193 
1194  while( auto evt = Wait() )
1195  {
1196  // TODO: magnetic pad & track processing needs to move to VIEW_CONTROLS.
1198  frame()->SetMousePosition( pos );
1199 
1200  wxRealPoint gridSize = frame()->GetScreen()->GetGridSize();
1201  wxSize igridsize;
1202  igridsize.x = KiROUND( gridSize.x );
1203  igridsize.y = KiROUND( gridSize.y );
1204 
1205  if( Magnetize( frame(), toolID, igridsize, pos, &pos ) )
1206  controls.ForceCursorPosition( true, pos );
1207  else
1208  controls.ForceCursorPosition( false );
1209 
1210  const VECTOR2I cursorPos = controls.GetCursorPosition();
1211 
1212  if( evt->IsCancel() || evt->IsActivate() )
1213  {
1214  break;
1215  }
1216 
1217  // click or drag starts
1218  else if( !originSet &&
1219  ( evt->IsDrag( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) ) )
1220  {
1221  if( !evt->IsDrag( BUT_LEFT ) )
1222  {
1223  twoPtMgr.SetOrigin( cursorPos );
1224  twoPtMgr.SetEnd( cursorPos );
1225  }
1226 
1227  controls.CaptureCursor( true );
1228  controls.SetAutoPan( true );
1229 
1230  originSet = true;
1231  }
1232 
1233  else if( !originSet && evt->IsMotion() )
1234  {
1235  // make sure the origin is set before a drag starts
1236  // otherwise you can miss a step
1237  twoPtMgr.SetOrigin( cursorPos );
1238  twoPtMgr.SetEnd( cursorPos );
1239  }
1240 
1241  // second click or mouse up after drag ends
1242  else if( originSet &&
1243  ( evt->IsClick( BUT_LEFT ) || evt->IsMouseUp( BUT_LEFT ) ) )
1244  {
1245  originSet = false;
1246 
1247  controls.SetAutoPan( false );
1248  controls.CaptureCursor( false );
1249 
1250  view.SetVisible( &ruler, false );
1251  }
1252 
1253  // move or drag when origin set updates rules
1254  else if( originSet &&
1255  ( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) )
1256  {
1257  twoPtMgr.SetAngleSnap( evt->Modifier( MD_CTRL ) );
1258  twoPtMgr.SetEnd( cursorPos );
1259 
1260  view.SetVisible( &ruler, true );
1261  view.Update( &ruler, KIGFX::GEOMETRY );
1262  }
1263 
1264  else if( evt->IsClick( BUT_RIGHT ) )
1265  {
1266  GetManager()->PassEvent();
1267  }
1268  }
1269 
1270  view.SetVisible( &ruler, false );
1271  view.Remove( &ruler );
1272 
1273  frame()->SetNoToolSelected();
1274 
1275  return 0;
1276 }
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg) override
Function SetToolID sets the tool command ID to aId and sets the cursor to aCursor.
virtual VECTOR2D GetMousePosition(bool aWorldCoordinates=true) const =0
Function GetMousePosition() Returns the current mouse pointer position.
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:106
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:81
Class TWO_POINT_GEOMETRY_MANAGER.
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
virtual void SetSnapping(bool aEnabled)
Function SetSnapping() Enables/disables snapping cursor to grid.
virtual void Remove(VIEW_ITEM *aItem) override
Function Remove() Removes a VIEW_ITEM from the view.
Definition: pcb_view.cpp:64
FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard ID_MODEDIT_MEASUREMENT_TOOL
void PassEvent()
Allows a tool to pass the already handled event to the next tool on the stack.
Definition: tool_manager.h:351
KIGFX::VIEW_CONTROLS * controls() const
Definition: pcb_tool.h:135
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area. ...
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:136
void SetOrigin(const VECTOR2I &aOrigin)
Set the origin of the ruler (the fixed end)
Class RULER_ITEM.
Definition: ruler_item.h:43
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Function ForceCursorPosition() Places the cursor immediately at a given point.
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg...
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
bool EditingModules() const
Definition: pcb_tool.h:99
virtual void SetNoToolSelected()
Select the ID_NO_TOOL_SELECTED id tool (Idle tool)
Definition: draw_frame.cpp:615
void SetMousePosition(const wxPoint &aPosition)
KIGFX::PCB_VIEW * view() const
Definition: pcb_tool.h:134
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
Definition: base_screen.h:410
PCB_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
TOOL_MANAGER * GetManager() const
Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool...
Definition: tool_base.h:144
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Sets the item visibility.
Definition: view.cpp:1445
void Activate()
Function Activate() Runs the tool.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Function Add() Adds a VIEW_ITEM to the view.
Definition: pcb_view.cpp:48
SGLIB_API S3DMODEL * GetModel(SCENEGRAPH *aNode)
Function GetModel creates an S3DMODEL representation of aNode (raw data, no transforms) ...
Definition: ifsg_api.cpp:471
bool Magnetize(PCB_BASE_EDIT_FRAME *frame, int aCurrentTool, wxSize aGridSize, wxPoint on_grid, wxPoint *curpos)
Function Magnetize tests to see if there are any magnetic items within near reach of the given "curpo...
void SetEnd(const VECTOR2I &aEnd)
Set the current end of the rectangle (the end that moves with the cursor.
Color has changed.
Definition: view_item.h:57
int EDIT_TOOL::Mirror ( const TOOL_EVENT aEvent)

Function Mirror.

Mirrors the current selection. The mirror axis passes through the current point.

Definition at line 766 of file edit_tool.cpp.

References SELECTION_TOOL::CheckLock(), SELECTION::Empty(), SELECTION::GetReferencePoint(), m_commit, m_dragging, m_selectionTool, TOOL_BASE::m_toolMgr, EDGE_MODULE::Mirror(), TEXTE_MODULE::Mirror(), mirrorPadX(), PCB_MODULE_EDGE_T, PCB_MODULE_TEXT_T, PCB_PAD_T, SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), PCB_TOOL::selection(), SELECTION_LOCKED, PCB_ACTIONS::selectionClear, PCB_ACTIONS::selectionModified, and updateModificationPoint().

Referenced by setTransitions().

767 {
769 
771  return 0;
772 
773  if( selection.Empty() )
774  return 0;
775 
777  auto refPoint = selection.GetReferencePoint();
778  wxPoint mirrorPoint( refPoint.x, refPoint.y );
779 
780  for( auto item : selection )
781  {
782  // only modify items we can mirror
783  switch( item->Type() )
784  {
785  case PCB_MODULE_EDGE_T:
786  case PCB_MODULE_TEXT_T:
787  case PCB_PAD_T:
788  // Only create undo entry for items on the board
789  if( !item->IsNew() )
790  m_commit->Modify( item );
791 
792  break;
793  default:
794  continue;
795  }
796 
797  // modify each object as necessary
798  switch( item->Type() )
799  {
800  case PCB_MODULE_EDGE_T:
801  {
802  auto& edge = static_cast<EDGE_MODULE&>( *item );
803  edge.Mirror( mirrorPoint, false );
804  break;
805  }
806 
807  case PCB_MODULE_TEXT_T:
808  {
809  auto& modText = static_cast<TEXTE_MODULE&>( *item );
810  modText.Mirror( mirrorPoint, false );
811  break;
812  }
813 
814  case PCB_PAD_T:
815  {
816  auto& pad = static_cast<D_PAD&>( *item );
817  mirrorPadX( pad, mirrorPoint );
818  break;
819  }
820 
821  default:
822  // it's likely the commit object is wrong if you get here
823  assert( false );
824  break;
825  }
826  }
827 
828  if( !m_dragging )
829  m_commit->Push( _( "Mirror" ) );
830 
831  if( selection.IsHover() && !m_dragging )
833 
835 
836  return 0;
837 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:109
VECTOR2I GetReferencePoint() const
Definition: selection.h:198
std::unique_ptr< BOARD_COMMIT > m_commit
Definition: edit_tool.h:209
SELECTION_LOCK_FLAGS CheckLock()
Checks if the user has agreed to modify locked items for the given selection.
bool updateModificationPoint(SELECTION &aSelection)
Returns the right modification point (e.g.
Definition: edit_tool.cpp:1306
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
SELECTION_TOOL * m_selectionTool
Selection tool used for obtaining selected items
Definition: edit_tool.h:173
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
static TOOL_ACTION selectionModified
Modified selection notification.
Definition: pcb_actions.h:111
void Mirror(const wxPoint aCentre, bool aMirrorAroundXAxis)
Mirror an edge of the footprint.
bool m_dragging
Flag determining if anything is being dragged right now
Definition: edit_tool.h:176
SELECTION & RequestSelection(int aFlags=SELECTION_DEFAULT, CLIENT_SELECTION_FILTER aClientFilter=NULL)
Function RequestSelection()
const SELECTION & selection() const
Definition: pcb_tool.cpp:221
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
void Mirror(const wxPoint &aCentre, bool aMirrorAroundXAxis)
Mirror text position in footprint edition the text itself is not mirrored, and the layer not modified...
static void mirrorPadX(D_PAD &aPad, const wxPoint &aMirrorPoint)
Mirror a pad in the vertical axis passing through a point.
Definition: edit_tool.cpp:746
int EDIT_TOOL::MoveExact ( const TOOL_EVENT aEvent)

Function MoveExact()

Invokes a dialog box to allow moving of the item by an exact amount.

Definition at line 915 of file edit_tool.cpp.

References SELECTION_TOOL::CheckLock(), MOVE_PARAMETERS::editingFootprint, SELECTION::Empty(), getAnchorPoint(), SELECTION::GetCenter(), TOOL_BASE::getView(), m_commit, m_dragging, PCB_TOOL::m_editModules, m_selectionTool, TOOL_BASE::m_toolMgr, SELECTION_TOOL::RequestSelection(), Rotate(), TOOL_MANAGER::RunAction(), PCB_TOOL::selection(), SELECTION_LOCKED, PCB_ACTIONS::selectionClear, PCB_ACTIONS::selectionModified, KIGFX::VIEW::Update(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by setTransitions().

916 {
917  const auto& selection = m_selectionTool->RequestSelection();
918 
920  return 0;
921 
922  if( selection.Empty() )
923  return 0;
924 
925  PCB_BASE_FRAME* editFrame = getEditFrame<PCB_BASE_FRAME>();
926 
927  MOVE_PARAMETERS params;
929 
930  DIALOG_MOVE_EXACT dialog( editFrame, params );
931  int ret = dialog.ShowModal();
932 
933  if( ret == wxID_OK )
934  {
936  wxPoint rotPoint( rp.x, rp.y );
937 
938  wxPoint anchorPoint = getAnchorPoint( selection, params );
939 
940  wxPoint finalMoveVector = params.translation - anchorPoint;
941 
942  // Make sure the rotation is from the right reference point
943  rotPoint += finalMoveVector;
944 
945  for( auto item : selection )
946  {
947  if( !item->IsNew() )
948  m_commit->Modify( item );
949 
950  static_cast<BOARD_ITEM*>( item )->Move( finalMoveVector );
951  static_cast<BOARD_ITEM*>( item )->Rotate( rotPoint, params.rotation );
952 
953  if( !m_dragging )
954  getView()->Update( item );
955  }
956 
957  m_commit->Push( _( "Move exact" ) );
958 
959  if( selection.IsHover() )
961 
963  }
964 
965  return 0;
966 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:109
static wxPoint getAnchorPoint(const SELECTION &selection, const MOVE_PARAMETERS &params)
Definition: edit_tool.cpp:188
int Rotate(const TOOL_EVENT &aEvent)
Function Rotate()
Definition: edit_tool.cpp:693
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
std::unique_ptr< BOARD_COMMIT > m_commit
Definition: edit_tool.h:209
SELECTION_LOCK_FLAGS CheckLock()
Checks if the user has agreed to modify locked items for the given selection.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
SELECTION_TOOL * m_selectionTool
Selection tool used for obtaining selected items
Definition: edit_tool.h:173
static TOOL_ACTION selectionModified
Modified selection notification.
Definition: pcb_actions.h:111
bool m_dragging
Flag determining if anything is being dragged right now
Definition: edit_tool.h:176
SELECTION & RequestSelection(int aFlags=SELECTION_DEFAULT, CLIENT_SELECTION_FILTER aClientFilter=NULL)
Function RequestSelection()
const SELECTION & selection() const
Definition: pcb_tool.cpp:221
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:1499
bool m_editModules
Definition: pcb_tool.h:144
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
VECTOR2I GetCenter() const
Returns the center point of the selection area bounding box.
Definition: selection.cpp:67
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
bool EDIT_TOOL::pickCopyReferencePoint ( VECTOR2I aP)
private

Definition at line 1366 of file edit_tool.cpp.

References TOOL_INTERACTIVE::Activate(), PICKER_TOOL::GetPoint(), TOOL_MANAGER::GetTool(), PICKER_TOOL::IsPicking(), TOOL_BASE::m_toolMgr, and TOOL_INTERACTIVE::Wait().

Referenced by copyToClipboard().

1367 {
1368  PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
1369  assert( picker );
1370 
1371  picker->Activate();
1372 
1373  while ( picker->IsPicking() )
1374  Wait();
1375 
1376  if( !picker->GetPoint() )
1377  return false;
1378 
1379  aP = *picker->GetPoint();
1380  return true;
1381 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
Generic tool for picking a point.
Definition: picker_tool.h:34
bool IsPicking() const
Function IsPicking() Returns information whether the tool is still active.
Definition: picker_tool.h:90
OPT< VECTOR2D > GetPoint() const
Function GetPoint() Returns picked point.
Definition: picker_tool.h:80
void Activate()
Function Activate() Runs the tool.
int EDIT_TOOL::Properties ( const TOOL_EVENT aEvent)

Function Edit()

Displays properties window for the selected object.

Definition at line 642 of file edit_tool.cpp.

References DIALOG_TRACK_VIA_PROPERTIES::Apply(), changeTrackWidthOnClick(), EDA_ITEM::ClearFlags(), EDA_ITEM::GetFlags(), m_commit, m_selectionTool, TOOL_BASE::m_toolMgr, PCB_BASE_EDIT_FRAME::OnEditItemRequest(), SELECTION_CONDITIONS::OnlyTypes(), SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), PCB_TOOL::selection(), SELECTION_DELETABLE, SELECTION_EDITABLE, SELECTION_FORCE_UNLOCK, PCB_ACTIONS::selectionClear, PCB_ACTIONS::selectionModified, EDA_ITEM::SetFlags(), and GENERAL_COLLECTOR::Tracks.

Referenced by setTransitions().

643 {
644  PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
645 
648 
649  if( selection.Empty() )
650  return 0;
651 
652  // Tracks & vias are treated in a special way:
654  {
655  if ( !changeTrackWidthOnClick( selection ) )
656  {
657  DIALOG_TRACK_VIA_PROPERTIES dlg( editFrame, selection );
658 
659  if( dlg.ShowModal() )
660  {
661  dlg.Apply( *m_commit );
662  m_commit->Push( _( "Edit track/via properties" ) );
663  }
664  }
665  }
666  else if( selection.Size() == 1 ) // Properties are displayed when there is only one item selected
667  {
668  // Display properties dialog
669  BOARD_ITEM* item = static_cast<BOARD_ITEM*>( selection.Front() );
670 
671  // Some of properties dialogs alter pointers, so we should deselect them
673 
674  // Store flags, so they can be restored later
675  STATUS_FLAGS flags = item->GetFlags();
676  item->ClearFlags();
677 
678  // Do not handle undo buffer, it is done by the properties dialogs @todo LEGACY
679  // Display properties dialog provided by the legacy canvas frame
680  editFrame->OnEditItemRequest( NULL, item );
681 
683  item->SetFlags( flags );
684  }
685 
686  if( selection.IsHover() )
688 
689  return 0;
690 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
static const KICAD_T Tracks[]
A scan list for only TRACKS.
Definition: collectors.h:305
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
std::unique_ptr< BOARD_COMMIT > m_commit
Definition: edit_tool.h:209
virtual void OnEditItemRequest(wxDC *aDC, BOARD_ITEM *aItem)=0
Function OnEditItemRequest Install the corresponding dialog editor for the given item.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
SELECTION_TOOL * m_selectionTool
Selection tool used for obtaining selected items
Definition: edit_tool.h:173
static TOOL_ACTION selectionModified
Modified selection notification.
Definition: pcb_actions.h:111
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:264
static SELECTION_CONDITION OnlyTypes(const std::vector< KICAD_T > &aTypes)
Function OnlyTypes Creates a functor that tests if the selected items are only of given types...
SELECTION & RequestSelection(int aFlags=SELECTION_DEFAULT, CLIENT_SELECTION_FILTER aClientFilter=NULL)
Function RequestSelection()
unsigned STATUS_FLAGS
Definition: base_struct.h:142
const SELECTION & selection() const
Definition: pcb_tool.cpp:221
bool changeTrackWidthOnClick(const SELECTION &selection)
Definition: edit_tool.cpp:601
Common, abstract interface for edit frames.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:265
int EDIT_TOOL::Remove ( const TOOL_EVENT aEvent)

Function Remove()

Deletes currently selected items. The rotation point is the current cursor position.

Definition at line 873 of file edit_tool.cpp.

References ACTIONS::ALT, SELECTION_TOOL::CheckLock(), SELECTION::Empty(), PCB_ACTIONS::expandSelectedConnection, TOOL_MANAGER::FindTool(), SELECTION_TOOL::GetSelection(), SELECTION::HasType(), SELECTION::IsHover(), m_commit, m_selectionTool, TOOL_BASE::m_toolMgr, TOOL_EVENT::Parameter(), PCB_TRACE_T, PCB_VIA_T, SELECTION_TOOL::RequestSelection(), PNS::TOOL_BASE::Router(), PNS::ROUTER::RoutingInProgress(), TOOL_MANAGER::RunAction(), PCB_TOOL::selection(), SELECTION_DELETABLE, SELECTION_LOCKED, SELECTION_SANITIZE_PADS, and PCB_ACTIONS::selectionClear.

Referenced by cutToClipboard(), and setTransitions().

874 {
875  ROUTER_TOOL* routerTool = static_cast<ROUTER_TOOL*>
876  ( m_toolMgr->FindTool( "pcbnew.InteractiveRouter" ) );
877 
878  // Do not delete items while actively routing.
879  if( routerTool && routerTool->Router() && routerTool->Router()->RoutingInProgress() )
880  return 0;
881 
882  // get a copy instead of reference (as we're going to clear the selectio before removing items)
884 
886  return 0;
887 
888  // is this "alternative" remove?
889  const bool isAlt = aEvent.Parameter<intptr_t>() == (int) PCB_ACTIONS::REMOVE_FLAGS::ALT;
890 
891  // in "alternative" mode, deletion is not just a simple list of selected items,
892  // it removes whole tracks, not just segments
893  if( isAlt && selection.IsHover()
894  && ( selection.HasType( PCB_TRACE_T ) || selection.HasType( PCB_VIA_T ) ) )
895  {
898  }
899 
900  if( selection.Empty() )
901  return 0;
902 
903  // As we are about to remove items, they have to be removed from the selection first
905 
906  for( auto item : selection )
907  m_commit->Remove( item );
908 
909  m_commit->Push( _( "Delete" ) );
910 
911  return 0;
912 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:109
TOOL_BASE * FindTool(int aId) const
Function FindTool() Searches for a tool with given ID.
if(dlg.ShowModal()==wxID_OK)
Definition: selcolor.cpp:75
std::unique_ptr< BOARD_COMMIT > m_commit
Definition: edit_tool.h:209
SELECTION_LOCK_FLAGS CheckLock()
Checks if the user has agreed to modify locked items for the given selection.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
SELECTION_TOOL * m_selectionTool
Selection tool used for obtaining selected items
Definition: edit_tool.h:173
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
bool RoutingInProgress() const
Definition: pns_router.cpp:112
SELECTION & RequestSelection(int aFlags=SELECTION_DEFAULT, CLIENT_SELECTION_FILTER aClientFilter=NULL)
Function RequestSelection()
SELECTION & GetSelection()
Function GetSelection()
const SELECTION & selection() const
Definition: pcb_tool.cpp:221
static TOOL_ACTION expandSelectedConnection
Expands the current selection to select a connection between two junctions.
Definition: pcb_actions.h:71
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:378
Class PCB_ACTIONS.
Definition: pcb_actions.h:42
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
ROUTER * Router() const
void 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.

Reimplemented from PCB_TOOL.

Definition at line 269 of file edit_tool.cpp.

References m_commit, m_dragging, and TOOL_BASE::RUN.

270 {
271  m_dragging = false;
272 
273  if( aReason != RUN )
274  m_commit.reset( new BOARD_COMMIT( this ) );
275 }
std::unique_ptr< BOARD_COMMIT > m_commit
Definition: edit_tool.h:209
Tool is invoked after being inactive.
Definition: tool_base.h:82
bool m_dragging
Flag determining if anything is being dragged right now
Definition: edit_tool.h:176
int EDIT_TOOL::Rotate ( const TOOL_EVENT aEvent)

Function Rotate()

Rotates currently selected items.

Definition at line 693 of file edit_tool.cpp.

References SELECTION_TOOL::CheckLock(), TOOL_EVT_UTILS::GetEventRotationAngle(), m_commit, m_dragging, m_selectionTool, TOOL_BASE::m_toolMgr, SELECTION_TOOL::RequestSelection(), TOOL_MANAGER::RunAction(), PCB_TOOL::selection(), SELECTION_LOCKED, PCB_ACTIONS::selectionClear, PCB_ACTIONS::selectionModified, and updateModificationPoint().

Referenced by MoveExact(), and setTransitions().

694 {
695  PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
696 
698 
699  if( selection.Empty() )
700  return 0;
701 
703  return 0;
704 
705  updateModificationPoint( selection );
706  const int rotateAngle = TOOL_EVT_UTILS::GetEventRotationAngle( *editFrame, aEvent );
707 
708  for( auto item : selection )
709  {
710  if( !item->IsNew() )
711  m_commit->Modify( item );
712 
713  static_cast<BOARD_ITEM*>( item )->Rotate( selection.GetReferencePoint(), rotateAngle );
714  }
715 
716  if( !m_dragging )
717  m_commit->Push( _( "Rotate" ) );
718 
719  if( selection.IsHover() && !m_dragging )
721 
723 
724  return 0;
725 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
int Rotate(const TOOL_EVENT &aEvent)
Function Rotate()
Definition: edit_tool.cpp:693
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
std::unique_ptr< BOARD_COMMIT > m_commit
Definition: edit_tool.h:209
SELECTION_LOCK_FLAGS CheckLock()
Checks if the user has agreed to modify locked items for the given selection.
bool updateModificationPoint(SELECTION &aSelection)
Returns the right modification point (e.g.
Definition: edit_tool.cpp:1306
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
SELECTION_TOOL * m_selectionTool
Selection tool used for obtaining selected items
Definition: edit_tool.h:173
static TOOL_ACTION selectionModified
Modified selection notification.
Definition: pcb_actions.h:111
bool m_dragging
Flag determining if anything is being dragged right now
Definition: edit_tool.h:176
SELECTION & RequestSelection(int aFlags=SELECTION_DEFAULT, CLIENT_SELECTION_FILTER aClientFilter=NULL)
Function RequestSelection()
const SELECTION & selection() const
Definition: pcb_tool.cpp:221
Common, abstract interface for edit frames.
int GetEventRotationAngle(const PCB_BASE_EDIT_FRAME &aFrame, const TOOL_EVENT &aEvt)
Function getEventRotationAngle()
void TOOL_INTERACTIVE::RunMainStack ( std::function< void()>  aFunc)
inherited

Function RunMainStack()

Calls a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 85 of file tool_interactive.cpp.

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

Referenced by DRAWING_TOOL::PlaceText().

86 {
87  m_toolMgr->RunMainStack( this, std::move( aFunc ) );
88 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void RunMainStack(TOOL_BASE *aTool, std::function< void()> aFunc)
const SELECTION & PCB_TOOL::selection ( ) const
protectedinherited

Definition at line 221 of file pcb_tool.cpp.

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

Referenced by PAD_TOOL::applyPadSettings(), PCB_EDITOR_CONTROL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), PAD_TOOL::copyPadSettings(), copyToClipboard(), CreateArray(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), PCB_EDITOR_CONTROL::CrossProbePcbToSch(), deleteItem(), Duplicate(), editFootprintInFpEditor(), ExchangeFootprints(), SELECTION_TOOL::expandSelectedConnection(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::filterSelection(), Flip(), DRAWING_TOOL::getSourceZoneForAction(), highlightNet(), ROUTER_TOOL::InlineDrag(), Main(), Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), MoveExact(), POINT_EDITOR::OnSelectionChange(), PCBNEW_CONTROL::placeBoardItems(), PCB_EDITOR_CONTROL::PlaceModule(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::PositionRelative(), Properties(), PAD_TOOL::pushPadSettings(), Remove(), Rotate(), SELECTION_TOOL::selectCopper(), PCB_TOOL::selection(), SELECTION_TOOL::selectNet(), selectPRitem(), showLocalRatsnest(), PCB_EDITOR_CONTROL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ZoneDuplicate(), ZONE_FILLER_TOOL::ZoneFill(), PCB_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfill().

222 {
223  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
224  const auto& selection = selTool->GetSelection();
225  return selection;
226 }
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
const SELECTION & selection() const
Definition: pcb_tool.cpp:221
SELECTION & PCB_TOOL::selection ( )
protectedinherited

Definition at line 228 of file pcb_tool.cpp.

References TOOL_MANAGER::GetTool(), TOOL_BASE::m_toolMgr, and PCB_TOOL::selection().

229 {
230  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
231  auto& selection = selTool->GetSelection();
232  return selection;
233 }
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
const SELECTION & selection() const
Definition: pcb_tool.cpp:221
void TOOL_INTERACTIVE::SetContextMenu ( CONTEXT_MENU aMenu,
CONTEXT_MENU_TRIGGER  aTrigger = CMENU_BUTTON 
)
inherited

Function SetContextMenu()

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

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

Definition at line 74 of file tool_interactive.cpp.

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

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

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

Function SetEditModules()

Toggles edit module mode. When enabled, one may select parts of modules individually (graphics, pads, etc.), so they can be modified.

Parameters
aEnableddecides if the mode should be enabled.

Definition at line 94 of file pcb_tool.h.

95  {
96  m_editModules = aEnabled;
97  }
bool m_editModules
Definition: pcb_tool.h:144
void EDIT_TOOL::setTransitions ( )
overridevirtual

Sets up handlers for various events.

Reimplemented from PCB_TOOL.

Definition at line 1279 of file edit_tool.cpp.

References copyToClipboard(), PCB_ACTIONS::copyToClipboard, CreateArray(), PCB_ACTIONS::createArray, cutToClipboard(), PCB_ACTIONS::cutToClipboard, Drag(), PCB_ACTIONS::drag45Degree, PCB_ACTIONS::dragFreeAngle, Duplicate(), PCB_ACTIONS::duplicate, PCB_ACTIONS::duplicateIncrement, PCB_ACTIONS::editActivate, editFootprintInFpEditor(), PCB_ACTIONS::editFootprintInFpEditor, PCB_ACTIONS::exchangeFootprints, ExchangeFootprints(), Flip(), PCB_ACTIONS::flip, TOOL_INTERACTIVE::Go(), Main(), MeasureTool(), PCB_ACTIONS::measureTool, Mirror(), PCB_ACTIONS::mirror, PCB_ACTIONS::move, PCB_ACTIONS::moveExact, MoveExact(), Properties(), PCB_ACTIONS::properties, Remove(), PCB_ACTIONS::remove, PCB_ACTIONS::removeAlt, Rotate(), PCB_ACTIONS::rotateCcw, PCB_ACTIONS::rotateCw, and PCB_ACTIONS::updateFootprints.

1280 {
1281  Go( &EDIT_TOOL::Main, PCB_ACTIONS::editActivate.MakeEvent() );
1282  Go( &EDIT_TOOL::Main, PCB_ACTIONS::move.MakeEvent() );
1283  Go( &EDIT_TOOL::Drag, PCB_ACTIONS::drag45Degree.MakeEvent() );
1285  Go( &EDIT_TOOL::Rotate, PCB_ACTIONS::rotateCw.MakeEvent() );
1286  Go( &EDIT_TOOL::Rotate, PCB_ACTIONS::rotateCcw.MakeEvent() );
1287  Go( &EDIT_TOOL::Flip, PCB_ACTIONS::flip.MakeEvent() );
1288  Go( &EDIT_TOOL::Remove, PCB_ACTIONS::remove.MakeEvent() );
1289  Go( &EDIT_TOOL::Remove, PCB_ACTIONS::removeAlt.MakeEvent() );
1295  Go( &EDIT_TOOL::Mirror, PCB_ACTIONS::mirror.MakeEvent() );
1296 
1303 }
int Main(const TOOL_EVENT &aEvent)
Function Main()
Definition: edit_tool.cpp:382
int Properties(const TOOL_EVENT &aEvent)
Function Edit()
Definition: edit_tool.cpp:642
int Rotate(const TOOL_EVENT &aEvent)
Function Rotate()
Definition: edit_tool.cpp:693
static TOOL_ACTION move
move an item
Definition: pcb_actions.h:93
int ExchangeFootprints(const TOOL_EVENT &aEvent)
Function ExchangeFootprints()
Definition: edit_tool.cpp:1145
static TOOL_ACTION editActivate
Activation of the edit tool.
Definition: pcb_actions.h:90
static TOOL_ACTION dragFreeAngle
Definition: pcb_actions.h:134
static TOOL_ACTION properties
Activation of the edit tool.
Definition: pcb_actions.h:108
static TOOL_ACTION removeAlt
Definition: pcb_actions.h:130
static TOOL_ACTION drag45Degree
Definition: pcb_actions.h:133
static TOOL_ACTION mirror
Mirroring of selected items.
Definition: pcb_actions.h:105
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
int Mirror(const TOOL_EVENT &aEvent)
Function Mirror.
Definition: edit_tool.cpp:766
static TOOL_ACTION moveExact
Activation of the exact move tool.
Definition: pcb_actions.h:114
int cutToClipboard(const TOOL_EVENT &aEvent)
Function cutToClipboard() Cuts the current selection to the clipboard by formatting it as a fake pcb ...
Definition: edit_tool.cpp:1416
static TOOL_ACTION duplicate
Activation of the duplication tool.
Definition: pcb_actions.h:117
int Flip(const TOOL_EVENT &aEvent)
Function Flip()
Definition: edit_tool.cpp:840
static TOOL_ACTION duplicateIncrement
Activation of the duplication tool with incrementing (e.g. pad number)
Definition: pcb_actions.h:120
static TOOL_ACTION rotateCw
Rotation of selected objects clockwise.
Definition: pcb_actions.h:96
static TOOL_ACTION createArray
Tool for creating an array of objects.
Definition: pcb_actions.h:314
int Drag(const TOOL_EVENT &aEvent)
Function Drag()
Definition: edit_tool.cpp:370
static TOOL_ACTION exchangeFootprints
Exchange footprints of modules.
Definition: pcb_actions.h:126
static TOOL_ACTION cutToClipboard
Paste from clipboard.
Definition: pcb_actions.h:323
static TOOL_ACTION copyToClipboard
Copy selected items to clipboard.
Definition: pcb_actions.h:317
static TOOL_ACTION updateFootprints
Update footprints to reflect any changes in the library.
Definition: pcb_actions.h:123
static TOOL_ACTION rotateCcw
Rotation of selected objects counter-clockwise.
Definition: pcb_actions.h:99
int MoveExact(const TOOL_EVENT &aEvent)
Function MoveExact()
Definition: edit_tool.cpp:915
int Remove(const TOOL_EVENT &aEvent)
Function Remove()
Definition: edit_tool.cpp:873
static TOOL_ACTION flip
Flipping of selected objects.
Definition: pcb_actions.h:102
int CreateArray(const TOOL_EVENT &aEvent)
Function CreateArray()
Definition: edit_tool.cpp:1117
int MeasureTool(const TOOL_EVENT &aEvent)
Launches a tool to measure between points
Definition: edit_tool.cpp:1169
static TOOL_ACTION editFootprintInFpEditor
Definition: pcb_actions.h:401
int editFootprintInFpEditor(const TOOL_EVENT &aEvent)
Definition: edit_tool.cpp:1329
int copyToClipboard(const TOOL_EVENT &aEvent)
Function copyToClipboard() Sends the current selection to the clipboard by formatting it as a fake pc...
Definition: edit_tool.cpp:1384
static TOOL_ACTION remove
Deleting a BOARD_ITEM.
Definition: pcb_actions.h:129
int Duplicate(const TOOL_EVENT &aEvent)
Function Duplicate()
Definition: edit_tool.cpp:969
static TOOL_ACTION measureTool
Definition: pcb_actions.h:381
bool EDIT_TOOL::updateModificationPoint ( SELECTION aSelection)
private

Returns the right modification point (e.g.

for rotation), depending on the number of

selected items.

Definition at line 1306 of file edit_tool.cpp.

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

Referenced by Flip(), Main(), Mirror(), and Rotate().

1307 {
1308  if( m_dragging && aSelection.HasReferencePoint() )
1309  return false;
1310 
1311  // When there is only one item selected, the reference point is its position...
1312  if( aSelection.Size() == 1 )
1313  {
1314  auto item = static_cast<BOARD_ITEM*>( aSelection.Front() );
1315  auto pos = item->GetPosition();
1316  aSelection.SetReferencePoint( VECTOR2I( pos.x, pos.y ) );
1317  }
1318  // ...otherwise modify items with regard to the cursor position
1319  else
1320  {
1322  aSelection.SetReferencePoint( m_cursor );
1323  }
1324 
1325  return true;
1326 }
VECTOR2I m_cursor
Last cursor position (needed for getModificationPoint() to avoid changes of edit reference point)...
Definition: edit_tool.h:180
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
EDA_ITEM * Front() const
Definition: selection.h:147
VECTOR2< int > VECTOR2I
Definition: vector2d.h:589
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:203
bool m_dragging
Flag determining if anything is being dragged right now
Definition: edit_tool.h:176
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
virtual const wxPoint GetPosition() const =0
int Size() const
Returns the number of selected parts.
Definition: selection.h:115
bool HasReferencePoint() const
Definition: selection.h:193
OPT_TOOL_EVENT TOOL_INTERACTIVE::Wait ( const TOOL_EVENT_LIST aEventList = TOOL_EVENTTC_ANYTA_ANY ))
inherited

Function Wait()

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

Definition at line 55 of file tool_interactive.cpp.

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

Referenced by PCBNEW_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SELECTION_TOOL::disambiguationMenu(), PCB_TOOL::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), PCB_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), PICKER_TOOL::Main(), Main(), GERBVIEW_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), GERBVIEW_SELECTION_TOOL::MeasureTool(), MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), pickCopyReferencePoint(), DRAWING_TOOL::PlaceDXF(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::runPolygonEventLoop(), GERBVIEW_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), and PCB_EDITOR_CONTROL::ShowLocalRatsnest().

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

Member Data Documentation

std::unique_ptr<BOARD_COMMIT> EDIT_TOOL::m_commit
private
VECTOR2I EDIT_TOOL::m_cursor
private

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

Definition at line 180 of file edit_tool.h.

Referenced by Main(), and updateModificationPoint().

bool EDIT_TOOL::m_dragging
private

Flag determining if anything is being dragged right now

Definition at line 176 of file edit_tool.h.

Referenced by Flip(), Main(), Mirror(), MoveExact(), Reset(), Rotate(), and updateModificationPoint().

SELECTION_TOOL* EDIT_TOOL::m_selectionTool
private

Selection tool used for obtaining selected items

Definition at line 173 of file edit_tool.h.

Referenced by copyToClipboard(), CreateArray(), Duplicate(), editFootprintInFpEditor(), ExchangeFootprints(), Flip(), Init(), Main(), Mirror(), MoveExact(), Properties(), Remove(), and Rotate().

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

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

Definition at line 210 of file tool_base.h.

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

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 215 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), PAD_TOOL::applyPadSettings(), TOOL_BASE::attachManager(), PCB_EDITOR_CONTROL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), GERBVIEW_SELECTION_TOOL::clearSelection(), SELECTION_TOOL::clearSelection(), PAD_TOOL::copyPadSettings(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), PCB_EDITOR_CONTROL::CrossProbePcbToSch(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), PCBNEW_CONTROL::CursorControl(), ROUTER_TOOL::CustomTrackWidthDialog(), PCBNEW_CONTROL::DeleteItemCursor(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::drawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), Duplicate(), editFootprintInFpEditor(), MODULE_EDITOR_TOOLS::EnumeratePads(), ExchangeFootprints(), SELECTION_TOOL::expandSelectedConnection(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::findCallback(), SELECTION_TOOL::findMove(), Flip(), TOOL_BASE::getEditFrameInt(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), PCBNEW_CONTROL::GridSetOrigin(), GERBVIEW_CONTROL::HighlightControl(), PCB_EDITOR_CONTROL::HighlightNet(), PCB_EDITOR_CONTROL::HighlightNetCursor(), PICKER_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), PAD_TOOL::Init(), POINT_EDITOR::Init(), PCB_EDITOR_CONTROL::Init(), POSITION_RELATIVE_TOOL::Init(), Init(), ROUTER_TOOL::InlineDrag(), invokeInlineRouter(), isInteractiveDragEnabled(), TOOL_BASE::IsToolActive(), ZOOM_TOOL::Main(), PICKER_TOOL::Main(), Main(), SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), MoveExact(), POINT_EDITOR::OnSelectionChange(), pickCopyReferencePoint(), PCBNEW_CONTROL::placeBoardItems(), DRAWING_TOOL::PlaceDXF(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::PositionRelative(), Properties(), PAD_TOOL::pushPadSettings(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), Remove(), POINT_EDITOR::removeCorner(), GERBVIEW_SELECTION_TOOL::RequestSelection(), SELECTION_TOOL::RequestSelection(), PCBNEW_CONTROL::ResetCoords(), TOOL_INTERACTIVE::resetTransitions(), Rotate(), TOOL_INTERACTIVE::RunMainStack(), SELECTION_TOOL::SanitizeSelection(), SELECTION_TOOL::selectCopper(), PCB_TOOL::selection(), GERBVIEW_SELECTION_TOOL::SelectItem(), SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), SELECTION_TOOL::SelectItems(), GERBVIEW_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectNet(), SELECTION_TOOL::selectOnSheetFromEeschema(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), SELECTION_TOOL::selectSameSheet(), TOOL_INTERACTIVE::SetContextMenu(), PCB_EDITOR_CONTROL::ShowLocalRatsnest(), GERBVIEW_SELECTION_TOOL::toggleSelection(), SELECTION_TOOL::toggleSelection(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), GERBVIEW_SELECTION_TOOL::UnselectItem(), SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), SELECTION_TOOL::UnselectItems(), PCB_EDITOR_CONTROL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), PCB_EDITOR_CONTROL::ZoneDuplicate(), and PCB_EDITOR_CONTROL::ZoneMerge().

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

TOOL_SETTINGS TOOL_BASE::m_toolSettings
protectedinherited

Definition at line 216 of file tool_base.h.

Referenced by TOOL_BASE::attachManager().

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

Definition at line 207 of file tool_base.h.


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