KiCad PCB EDA Suite
edit_tool.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2013-2017 CERN
5  * @author Maciej Suminski <maciej.suminski@cern.ch>
6  * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
7  * Copyright (C) 2017 KiCad Developers, see CHANGELOG.TXT for contributors.
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, you may find one here:
21  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22  * or you may search the http://www.gnu.org website for the version 2 license,
23  * or you may write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25  */
26 
27 #include <limits>
28 
29 #include <class_board.h>
30 #include <class_module.h>
31 #include <class_edge_mod.h>
32 #include <class_zone.h>
33 #include <collectors.h>
34 #include <pcb_edit_frame.h>
35 #include <kiway.h>
36 #include <class_draw_panel_gal.h>
37 #include <footprint_edit_frame.h>
38 #include <array_creator.h>
39 #include <pcbnew_id.h>
40 #include <status_popup.h>
41 #include <tool/tool_manager.h>
42 #include <view/view_controls.h>
43 #include <view/view.h>
46 #include <confirm.h>
47 #include <bitmaps.h>
48 #include <hotkeys.h>
49 
50 #include <cassert>
51 #include <functional>
52 using namespace std::placeholders;
53 
54 #include "pcb_actions.h"
55 #include "selection_tool.h"
56 #include "edit_tool.h"
57 #include "picker_tool.h"
58 #include "grid_helper.h"
59 #include "kicad_clipboard.h"
60 #include "pcbnew_control.h"
61 
62 #include <router/router_tool.h>
63 
67 
68 #include <tools/tool_event_utils.h>
69 
71 
72 #include <board_commit.h>
73 
74 
75 // Edit tool actions
76 TOOL_ACTION PCB_ACTIONS::editFootprintInFpEditor( "pcbnew.InteractiveEdit.editFootprintInFpEditor",
78  _( "Open in Footprint Editor" ),
79  _( "Opens the selected footprint in the Footprint Editor" ),
80  module_editor_xpm );
81 
82 TOOL_ACTION PCB_ACTIONS::editActivate( "pcbnew.InteractiveEdit",
83  AS_GLOBAL, 0,
84  _( "Edit Activate" ), "", move_xpm, AF_ACTIVATE );
85 
86 TOOL_ACTION PCB_ACTIONS::move( "pcbnew.InteractiveEdit.move",
88  _( "Move" ), _( "Moves the selected item(s)" ), move_xpm, AF_ACTIVATE );
89 
90 TOOL_ACTION PCB_ACTIONS::duplicate( "pcbnew.InteractiveEdit.duplicate",
92  _( "Duplicate" ), _( "Duplicates the selected item(s)" ), duplicate_xpm );
93 
94 TOOL_ACTION PCB_ACTIONS::duplicateIncrement( "pcbnew.InteractiveEdit.duplicateIncrementPads",
96  _( "Duplicate" ), _( "Duplicates the selected item(s), incrementing pad numbers" ) );
97 
98 TOOL_ACTION PCB_ACTIONS::moveExact( "pcbnew.InteractiveEdit.moveExact",
100  _( "Move Exactly..." ), _( "Moves the selected item(s) by an exact amount" ),
101  move_exactly_xpm );
102 
103 TOOL_ACTION PCB_ACTIONS::createArray( "pcbnew.InteractiveEdit.createArray",
105  _( "Create Array..." ), _( "Create array" ), array_xpm, AF_ACTIVATE );
106 
107 TOOL_ACTION PCB_ACTIONS::rotateCw( "pcbnew.InteractiveEdit.rotateCw",
109  _( "Rotate Clockwise" ), _( "Rotates selected item(s) clockwise" ),
110  rotate_cw_xpm, AF_NONE, (void*) -1 );
111 
112 TOOL_ACTION PCB_ACTIONS::rotateCcw( "pcbnew.InteractiveEdit.rotateCcw",
114  _( "Rotate Counterclockwise" ), _( "Rotates selected item(s) counterclockwise" ),
115  rotate_ccw_xpm, AF_NONE, (void*) 1 );
116 
117 TOOL_ACTION PCB_ACTIONS::flip( "pcbnew.InteractiveEdit.flip",
119  _( "Flip" ), _( "Flips selected item(s)" ), swap_layer_xpm );
120 
121 TOOL_ACTION PCB_ACTIONS::mirror( "pcbnew.InteractiveEdit.mirror",
122  AS_GLOBAL, 0,
123  _( "Mirror" ), _( "Mirrors selected item" ), mirror_h_xpm );
124 
125 TOOL_ACTION PCB_ACTIONS::remove( "pcbnew.InteractiveEdit.remove",
127  _( "Delete" ), _( "Deletes selected item(s)" ), delete_xpm,
128  AF_NONE, (void*) REMOVE_FLAGS::NORMAL );
129 
130 TOOL_ACTION PCB_ACTIONS::removeAlt( "pcbnew.InteractiveEdit.removeAlt",
132  _( "Delete Full Track" ), _( "Deletes selected item(s) and copper connections" ),
133  delete_xpm, AF_NONE, (void*) REMOVE_FLAGS::ALT );
134 
135 TOOL_ACTION PCB_ACTIONS::updateFootprints( "pcbnew.InteractiveEdit.updateFootprints",
136  AS_GLOBAL, 0,
137  _( "Update Footprint..." ), _( "Update the footprint from the library" ),
138  reload_xpm );
139 
140 TOOL_ACTION PCB_ACTIONS::exchangeFootprints( "pcbnew.InteractiveEdit.ExchangeFootprints",
141  AS_GLOBAL, 0,
142  _( "Change Footprint..." ), _( "Assign a different footprint from the library" ),
143  exchange_xpm );
144 
145 TOOL_ACTION PCB_ACTIONS::properties( "pcbnew.InteractiveEdit.properties",
147  _( "Properties..." ), _( "Displays item properties dialog" ), config_xpm );
148 
149 TOOL_ACTION PCB_ACTIONS::selectionModified( "pcbnew.InteractiveEdit.ModifiedSelection",
150  AS_GLOBAL, 0,
151  "", "", nullptr, AF_NOTIFY );
152 
153 TOOL_ACTION PCB_ACTIONS::measureTool( "pcbnew.InteractiveEdit.measureTool",
155  _( "Measuring Tool" ), _( "Interactively measure distance between points" ),
156  nullptr, AF_ACTIVATE );
157 
158 TOOL_ACTION PCB_ACTIONS::copyToClipboard( "pcbnew.InteractiveEdit.CopyToClipboard",
159  AS_GLOBAL, 0, // do not define a hotkey and let TranslateLegacyId() handle the event
160  _( "Copy" ), _( "Copy selected content to clipboard" ),
161  copy_xpm );
162 
163 TOOL_ACTION PCB_ACTIONS::cutToClipboard( "pcbnew.InteractiveEdit.CutToClipboard",
164  AS_GLOBAL, 0, // do not define a hotkey and let TranslateLegacyId() handle the event
165  _( "Cut" ), _( "Cut selected content to clipboard" ),
166  cut_xpm );
167 
168 TOOL_ACTION PCB_ACTIONS::updateUnits( "pcbnew.InteractiveEdit.updateUnits",
169  AS_GLOBAL, 0,
170  "", "" );
171 
172 
173 void EditToolSelectionFilter( GENERAL_COLLECTOR& aCollector, int aFlags )
174 {
175  // Iterate from the back so we don't have to worry about removals.
176  for( int i = aCollector.GetCount() - 1; i >= 0; --i )
177  {
178  BOARD_ITEM* item = aCollector[ i ];
179 
180  if( ( aFlags & EXCLUDE_LOCKED ) && item->IsLocked() )
181  {
182  aCollector.Remove( item );
183  }
184  else if( item->Type() == PCB_PAD_T )
185  {
186  MODULE* mod = static_cast<MODULE*>( item->GetParent() );
187 
188  // case 1: handle locking
189  if( ( aFlags & EXCLUDE_LOCKED ) && mod && mod->IsLocked() )
190  {
191  aCollector.Remove( item );
192  }
193  else if( ( aFlags & EXCLUDE_LOCKED_PADS ) && mod && mod->PadsLocked() )
194  {
195  // Pad locking is considerably "softer" than item locking
196  aCollector.Remove( item );
197 
198  if( !mod->IsLocked() && !aCollector.HasItem( mod ) )
199  aCollector.Append( mod );
200  }
201 
202  // case 2: selection contains both the module and its pads - remove the pads
203  if( mod && aCollector.HasItem( mod ) )
204  aCollector.Remove( item );
205  }
206  else if( ( aFlags & EXCLUDE_TRANSIENTS ) && item->Type() == PCB_MARKER_T )
207  {
208  aCollector.Remove( item );
209  }
210  }
211 }
212 
213 
215  PCB_TOOL( "pcbnew.InteractiveEdit" ), m_selectionTool( NULL ),
216  m_dragging( false ), m_lockedSelected( false )
217 {
218 }
219 
220 
222 {
223  m_dragging = false;
224 
225  if( aReason != RUN )
226  m_commit.reset( new BOARD_COMMIT( this ) );
227 }
228 
229 
231 {
232  // Find the selection tool, so they can cooperate
233  m_selectionTool = static_cast<SELECTION_TOOL*>( m_toolMgr->FindTool( "pcbnew.InteractiveSelection" ) );
234 
235  if( !m_selectionTool )
236  {
237  DisplayError( NULL, _( "pcbnew.InteractiveSelection tool is not available" ) );
238  return false;
239  }
240 
241  auto editingModuleCondition = [ this ] ( const SELECTION& aSelection ) {
242  return m_editModules;
243  };
244 
245  auto singleModuleCondition = SELECTION_CONDITIONS::OnlyType( PCB_MODULE_T )
247 
248  auto noActiveToolCondition = [ this ] ( const SELECTION& aSelection ) {
249  return ( frame()->GetToolId() == ID_NO_TOOL_SELECTED );
250  };
251 
252  // Add context menu entries that are displayed when selection tool is active
254 
266 
267 
272 
273 
277  // Selection tool handles the context menu for some other tools, such as the Picker.
278  // Don't add things like Paste when another tool is active.
279  menu.AddItem( PCB_ACTIONS::pasteFromClipboard, noActiveToolCondition );
280 
281  // Mirror only available in modedit
282  menu.AddSeparator( editingModuleCondition && SELECTION_CONDITIONS::NotEmpty );
283  menu.AddItem( PCB_ACTIONS::mirror, editingModuleCondition && SELECTION_CONDITIONS::NotEmpty );
286 
287  // Footprint actions
288  menu.AddSeparator( singleModuleCondition );
289  menu.AddItem( PCB_ACTIONS::editFootprintInFpEditor, singleModuleCondition );
290  menu.AddItem( PCB_ACTIONS::updateFootprints, singleModuleCondition );
291  menu.AddItem( PCB_ACTIONS::exchangeFootprints, singleModuleCondition );
292 
293  return true;
294 }
295 
296 
297 bool EDIT_TOOL::invokeInlineRouter( int aDragMode )
298 {
299  auto theRouter = static_cast<ROUTER_TOOL*>( m_toolMgr->FindTool( "pcbnew.InteractiveRouter" ) );
300 
301  if( !theRouter )
302  return false;
303 
304  // make sure we don't accidentally invoke inline routing mode while the router is already active!
305  if( theRouter->IsToolActive() )
306  return false;
307 
308  if( theRouter->CanInlineDrag() )
309  {
311  return true;
312  }
313 
314  return false;
315 }
316 
317 
319 {
320  auto theRouter = static_cast<ROUTER_TOOL*>( m_toolMgr->FindTool( "pcbnew.InteractiveRouter" ) );
321 
322  return theRouter ? theRouter->Router()->Settings().InlineDragEnabled() : false;
323 }
324 
325 
326 int EDIT_TOOL::Drag( const TOOL_EVENT& aEvent )
327 {
328  int mode = PNS::DM_ANY;
329 
330  if( aEvent.IsAction( &PCB_ACTIONS::dragFreeAngle ) )
331  mode |= PNS::DM_FREE_ANGLE;
332 
333  invokeInlineRouter( mode );
334 
335  return 0;
336 }
337 
338 int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
339 {
341  PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
342  VECTOR2I originalCursorPos = controls->GetCursorPosition();
343 
344  // Be sure that there is at least one item that we can modify. If nothing was selected before,
345  // try looking for the stuff under mouse cursor (i.e. Kicad old-style hover selection)
347  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
348  { EditToolSelectionFilter( aCollector, EXCLUDE_TRANSIENTS ); } );
349 
350  if( m_dragging || selection.Empty() )
351  return 0;
352 
353  LSET item_layers = static_cast<BOARD_ITEM*>( selection.Front() )->GetLayerSet();
354  bool unselect = selection.IsHover(); //N.B. This must be saved before the re-selection below
355 
356  // Filter out locked pads here
357  // We cannot do this in the selection filter as we need the pad layers
358  // when it is the curr_item.
360  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
361  { EditToolSelectionFilter( aCollector, EXCLUDE_LOCKED_PADS ); } );
362 
363  if( selection.Empty() )
364  return 0;
365 
366  Activate();
367  controls->ShowCursor( true );
368  controls->SetAutoPan( true );
369 
370  auto curr_item = static_cast<BOARD_ITEM*>( selection.Front() );
371  std::vector<BOARD_ITEM*> sel_items;
372 
373  for( auto it : selection )
374  {
375  auto item = dynamic_cast<BOARD_ITEM*>( it );
376 
377  if( item )
378  sel_items.push_back( item );
379  }
380 
381  bool restore_state = false;
382  VECTOR2I totalMovement;
383  GRID_HELPER grid( editFrame );
384  OPT_TOOL_EVENT evt = aEvent;
385  VECTOR2I prevPos;
386 
387  // Main loop: keep receiving events
388  do
389  {
390  grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
391  grid.SetUseGrid( !evt->Modifier( MD_ALT ) );
392  controls->SetSnapping( !evt->Modifier( MD_ALT ) );
393 
394  if( evt->IsAction( &PCB_ACTIONS::editActivate ) ||
395  evt->IsAction( &PCB_ACTIONS::move ) ||
396  evt->IsMotion() || evt->IsDrag( BUT_LEFT ) )
397  {
398  if( m_dragging && evt->Category() == TC_MOUSE )
399  {
401  item_layers, sel_items );
403  VECTOR2I movement( m_cursor - prevPos );
405 
406  totalMovement += movement;
407  prevPos = m_cursor;
408 
409  // Drag items to the current cursor position
410  for( auto item : selection )
411  {
412  // Don't double move footprint pads, fields, etc.
413  if( item->GetParent() && item->GetParent()->IsSelected() )
414  continue;
415 
416  static_cast<BOARD_ITEM*>( item )->Move( movement );
417  }
418 
419  frame()->UpdateMsgPanel();
420  }
421  else if( !m_dragging ) // Prepare to start dragging
422  {
423  bool invokedRouter = false;
424 
425  if ( !evt->IsAction( &PCB_ACTIONS::move ) && isInteractiveDragEnabled() )
426  invokedRouter = invokeInlineRouter( PNS::DM_ANY );
427 
428  if( !invokedRouter )
429  {
430  // deal with locked items (override lock or abort the operation)
432 
433  if( lockFlags == SELECTION_LOCKED )
434  break;
435 
436  // When editing modules, all items have the same parent
437  if( EditingModules() )
438  {
439  m_commit->Modify( selection.Front() );
440  }
441  else
442  {
443  // Save items, so changes can be undone
444  for( auto item : selection )
445  {
446  // Don't double move footprint pads, fields, etc.
447  if( item->GetParent() && item->GetParent()->IsSelected() )
448  continue;
449 
450  m_commit->Modify( item );
451  }
452  }
453 
454  editFrame->UndoRedoBlock( true );
456 
458  {
459  // start moving with the reference point attached to the cursor
460  grid.SetAuxAxes( false );
461 
463 
464  // Drag items to the current cursor position
465  for( auto item : selection )
466  {
467  // Don't double move footprint pads, fields, etc.
468  if( item->GetParent() && item->GetParent()->IsSelected() )
469  continue;
470 
471  static_cast<BOARD_ITEM*>( item )->Move( delta );
472  }
473 
475  }
476  else if( selection.Size() == 1 )
477  {
478  // Set the current cursor position to the first dragged item origin, so the
479  // movement vector could be computed later
481  m_cursor = grid.BestDragOrigin( originalCursorPos, curr_item );
482  grid.SetAuxAxes( true, m_cursor );
483  }
484  else
485  {
487  m_cursor = grid.Align( m_cursor );
488  }
489 
491 
492  prevPos = m_cursor;
493  controls->SetAutoPan( true );
494  m_dragging = true;
495  }
496  }
497 
500 
501  }
502 
503  else if( evt->IsCancel() || evt->IsActivate() )
504  {
505  restore_state = true; // Canceling the tool means that items have to be restored
506  break; // Finish
507  }
508 
509  else if( evt->Action() == TA_UNDO_REDO_PRE )
510  {
511  unselect = true;
512  break;
513  }
514 
515  // Dispatch TOOL_ACTIONs
516  else if( evt->Category() == TC_COMMAND )
517  {
518  if( evt->IsAction( &PCB_ACTIONS::remove ) )
519  {
520  // exit the loop, as there is no further processing for removed items
521  break;
522  }
523  else if( evt->IsAction( &PCB_ACTIONS::duplicate ) )
524  {
525  // On duplicate, stop moving this item
526  // The duplicate tool should then select the new item and start
527  // a new move procedure
528  break;
529  }
530  else if( evt->IsAction( &PCB_ACTIONS::moveExact ) )
531  {
532  // Can't do this, because the selection will then contain
533  // stale pointers and it will all go horribly wrong...
534  //editFrame->RestoreCopyFromUndoList( dummy );
535  //
536  // So, instead, reset the position manually
537  for( auto item : selection )
538  {
539  BOARD_ITEM* i = static_cast<BOARD_ITEM*>( item );
540  auto delta = VECTOR2I( i->GetPosition() ) - totalMovement;
541  i->SetPosition( wxPoint( delta.x, delta.y ) );
542 
543  // And what about flipping and rotation?
544  // for now, they won't be undone, but maybe that is how
545  // it should be, so you can flip and move exact in the
546  // same action?
547  }
548 
549  // This causes a double event, so we will get the dialogue
550  // correctly, somehow - why does Rotate not?
551  //MoveExact( aEvent );
552  break; // exit the loop - we move exactly, so we have finished moving
553  }
554  }
555 
556  else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
557  {
558  break; // Finish
559  }
560 
561  } while( ( evt = Wait() ) ); //Should be assignment not equality test
562 
563  m_lockedSelected = false;
564  controls->ForceCursorPosition( false );
565  controls->ShowCursor( false );
566  controls->SetSnapping( false );
567  controls->SetAutoPan( false );
568 
569  m_dragging = false;
570  editFrame->UndoRedoBlock( false );
571 
572  // Discard reference point when selection is "dropped" onto the board (ie: not dragging anymore)
574 
575  if( unselect || restore_state )
577 
578  if( restore_state )
579  m_commit->Revert();
580  else
581  m_commit->Push( _( "Drag" ) );
582 
583  return 0;
584 }
585 
587 {
589  {
590  auto item = static_cast<BOARD_ITEM *>( selection[0] );
591 
592  m_commit->Modify( item );
593 
594  if( auto via = dyn_cast<VIA*>( item ) )
595  {
596  int new_width, new_drill;
597 
598  if( via->GetViaType() == VIA_MICROVIA )
599  {
600  auto net = via->GetNet();
601 
602  new_width = net->GetMicroViaSize();
603  new_drill = net->GetMicroViaDrillSize();
604  }
605  else
606  {
607  new_width = board()->GetDesignSettings().GetCurrentViaSize();
608  new_drill = board()->GetDesignSettings().GetCurrentViaDrill();
609  }
610 
611  via->SetDrill( new_drill );
612  via->SetWidth( new_width );
613  }
614  else if ( auto track = dyn_cast<TRACK*>( item ) )
615  {
616  int new_width = board()->GetDesignSettings().GetCurrentTrackWidth();
617  track->SetWidth( new_width );
618  }
619 
620  m_commit->Push( _("Edit track width/via size") );
621  return true;
622  }
623 
624  return false;
625 }
626 
627 int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
628 {
629  PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
630 
632  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
633  { EditToolSelectionFilter( aCollector, EXCLUDE_TRANSIENTS ); } );
634 
635  // Tracks & vias are treated in a special way:
637  {
639  {
640  DIALOG_TRACK_VIA_PROPERTIES dlg( editFrame, selection, *m_commit );
641  dlg.ShowQuasiModal(); // QuasiModal required for NET_SELECTOR
642  }
643  }
644  else if( selection.Size() == 1 ) // Properties are displayed when there is only one item selected
645  {
646  // Display properties dialog
647  BOARD_ITEM* item = static_cast<BOARD_ITEM*>( selection.Front() );
648 
649  // Do not handle undo buffer, it is done by the properties dialogs @todo LEGACY
650  // Display properties dialog provided by the legacy canvas frame
651  editFrame->OnEditItemRequest( NULL, item );
652 
653  // Notify other tools of the changes
655  }
656 
657  if( selection.IsHover() )
658  {
660 
661  // Notify other tools of the changes -- This updates the visual ratsnest
663  }
664 
665  return 0;
666 }
667 
668 
669 int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
670 {
671  PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
672 
674  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
675  { EditToolSelectionFilter( aCollector, EXCLUDE_LOCKED_PADS | EXCLUDE_TRANSIENTS ); }, nullptr, ! m_dragging );
676 
677  if( selection.Empty() )
678  return 0;
679 
681  const int rotateAngle = TOOL_EVT_UTILS::GetEventRotationAngle( *editFrame, aEvent );
682 
683  // When editing modules, all items have the same parent
684  if( EditingModules() )
685  {
686  m_commit->Modify( selection.Front() );
687  }
688 
689  for( auto item : selection )
690  {
691  if( !item->IsNew() && !EditingModules() )
692  m_commit->Modify( item );
693 
694  static_cast<BOARD_ITEM*>( item )->Rotate( selection.GetReferencePoint(), rotateAngle );
695  }
696 
697  if( !m_dragging )
698  m_commit->Push( _( "Rotate" ) );
699 
700  if( selection.IsHover() && !m_dragging )
702 
704 
705  if( m_dragging )
707 
708  return 0;
709 }
710 
711 
715 static wxPoint mirrorPointX( const wxPoint& aPoint, const wxPoint& aMirrorPoint )
716 {
717  wxPoint mirrored = aPoint;
718 
719  mirrored.x -= aMirrorPoint.x;
720  mirrored.x = -mirrored.x;
721  mirrored.x += aMirrorPoint.x;
722 
723  return mirrored;
724 }
725 
726 
730 static void mirrorPadX( D_PAD& aPad, const wxPoint& aMirrorPoint )
731 {
732  wxPoint tmpPt = mirrorPointX( aPad.GetPosition(), aMirrorPoint );
733 
734  if( aPad.GetShape() == PAD_SHAPE_CUSTOM )
735  aPad.MirrorXPrimitives( tmpPt.x );
736 
737  aPad.SetPosition( tmpPt );
738 
739  aPad.SetX0( aPad.GetPosition().x );
740 
741  tmpPt = aPad.GetOffset();
742  tmpPt.x = -tmpPt.x;
743  aPad.SetOffset( tmpPt );
744 
745  auto tmpz = aPad.GetDelta();
746  tmpz.x = -tmpz.x;
747  aPad.SetDelta( tmpz );
748 
749  aPad.SetOrientation( -aPad.GetOrientation() );
750 }
751 
752 
753 int EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
754 {
756  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
757  { EditToolSelectionFilter( aCollector, EXCLUDE_LOCKED_PADS | EXCLUDE_TRANSIENTS ); }, nullptr, ! m_dragging );
758 
759  if( selection.Empty() )
760  return 0;
761 
763  auto refPoint = selection.GetReferencePoint();
764  wxPoint mirrorPoint( refPoint.x, refPoint.y );
765 
766  // When editing modules, all items have the same parent
767  if( EditingModules() )
768  {
769  m_commit->Modify( selection.Front() );
770  }
771 
772  for( auto item : selection )
773  {
774  // only modify items we can mirror
775  switch( item->Type() )
776  {
777  case PCB_MODULE_EDGE_T:
778  case PCB_MODULE_TEXT_T:
779  case PCB_PAD_T:
780  // Only create undo entry for items on the board
781  if( !item->IsNew() && !EditingModules() )
782  m_commit->Modify( item );
783 
784  break;
785  default:
786  continue;
787  }
788 
789  // modify each object as necessary
790  switch( item->Type() )
791  {
792  case PCB_MODULE_EDGE_T:
793  {
794  auto& edge = static_cast<EDGE_MODULE&>( *item );
795  edge.Mirror( mirrorPoint, false );
796  break;
797  }
798 
799  case PCB_MODULE_TEXT_T:
800  {
801  auto& modText = static_cast<TEXTE_MODULE&>( *item );
802  modText.Mirror( mirrorPoint, false );
803  break;
804  }
805 
806  case PCB_PAD_T:
807  {
808  auto& pad = static_cast<D_PAD&>( *item );
809  mirrorPadX( pad, mirrorPoint );
810  break;
811  }
812 
813  default:
814  // it's likely the commit object is wrong if you get here
815  assert( false );
816  break;
817  }
818  }
819 
820  if( !m_dragging )
821  m_commit->Push( _( "Mirror" ) );
822 
823  if( selection.IsHover() && !m_dragging )
825 
827 
828  if( m_dragging )
830 
831  return 0;
832 }
833 
834 
835 int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
836 {
838  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
839  { EditToolSelectionFilter( aCollector, EXCLUDE_LOCKED_PADS | EXCLUDE_TRANSIENTS ); }, nullptr, ! m_dragging );
840 
841  if( selection.Empty() )
842  return 0;
843 
845  auto modPoint = selection.GetReferencePoint();
846 
847  // When editing modules, all items have the same parent
848  if( EditingModules() )
849  {
850  m_commit->Modify( selection.Front() );
851  }
852 
853  for( auto item : selection )
854  {
855  if( !item->IsNew() && !EditingModules() )
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  if( m_dragging )
871 
872  return 0;
873 }
874 
875 
876 int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
877 {
878  ROUTER_TOOL* routerTool = static_cast<ROUTER_TOOL*>
879  ( m_toolMgr->FindTool( "pcbnew.InteractiveRouter" ) );
880 
881  // Do not delete items while actively routing.
882  if( routerTool && routerTool->Router() && routerTool->Router()->RoutingInProgress() )
883  return 1;
884 
885  std::vector<BOARD_ITEM*> lockedItems;
886 
887  // get a copy instead of reference (as we're going to clear the selection before removing items)
888  SELECTION selectionCopy;
889  bool isCut = aEvent.Parameter<intptr_t>() == static_cast<intptr_t>( PCB_ACTIONS::REMOVE_FLAGS::CUT );
890  bool isAlt = aEvent.Parameter<intptr_t>() == static_cast<intptr_t>( PCB_ACTIONS::REMOVE_FLAGS::ALT );
891 
892  // If we are in a "Cut" operation, then the copied selection exists already
893  if( isCut )
894  selectionCopy = m_selectionTool->GetSelection();
895  else
896  selectionCopy = m_selectionTool->RequestSelection(
897  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
899 
900  bool isHover = selectionCopy.IsHover();
901 
902  // in "alternative" mode, deletion is not just a simple list of selected items,
903  // it removes whole tracks, not just segments
904  if( isAlt && isHover
905  && ( selectionCopy.HasType( PCB_TRACE_T ) || selectionCopy.HasType( PCB_VIA_T ) ) )
906  {
908  }
909 
910  if( selectionCopy.Empty() )
911  return 0;
912 
913  // N.B. Setting the CUT flag prevents lock filtering as we only want to delete the items that
914  // were copied to the clipboard, no more, no fewer. Filtering for locked item, if any will be done
915  // in the copyToClipboard() routine
916  if( !m_lockedSelected && !isCut )
917  {
918  // Second RequestSelection removes locked items but keeps a copy of their pointers
919  selectionCopy = m_selectionTool->RequestSelection(
920  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
921  { EditToolSelectionFilter( aCollector, EXCLUDE_LOCKED ); }, &lockedItems );
922  }
923 
924 
925  // As we are about to remove items, they have to be removed from the selection first
927 
928  for( auto item : selectionCopy )
929  {
930  if( m_editModules )
931  {
932  m_commit->Remove( item );
933  continue;
934  }
935 
936  switch( item->Type() )
937  {
938  case PCB_MODULE_TEXT_T:
939  {
940  auto text = static_cast<TEXTE_MODULE*>( item );
941  auto parent = static_cast<MODULE*>( item->GetParent() );
942 
943  if( text->GetType() == TEXTE_MODULE::TEXT_is_DIVERS )
944  {
945  m_commit->Modify( text );
946  getView()->Remove( text );
947  parent->Remove( text );
948  }
949  }
950  break;
951 
952  default:
953  m_commit->Remove( item );
954  break;
955  }
956  }
957 
958  if( isCut )
959  m_commit->Push( _( "Cut" ) );
960  else
961  m_commit->Push( _( "Delete" ) );
962 
963  if( !m_lockedSelected && lockedItems.size() > 0 )
964  {
966  STATUS_TEXT_POPUP statusPopup( frame() );
967 
968  m_lockedSelected = true;
969  m_toolMgr->RunAction( PCB_ACTIONS::selectItems, true, &lockedItems );
970  statusPopup.SetText( _( "Delete again to remove locked items" ) );
971  statusPopup.Expire( 2000 );
972  statusPopup.Popup();
973  statusPopup.Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
974 
975  Activate();
976 
977  while( m_lockedSelected && statusPopup.IsShown() )
978  {
979  statusPopup.Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
980  Wait();
981  }
982  }
983 
984  m_lockedSelected = false;
985 
986  return 0;
987 }
988 
989 
990 int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent )
991 {
993  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
995 
996  if( selection.Empty() )
997  return 0;
998 
999  PCB_BASE_FRAME* editFrame = getEditFrame<PCB_BASE_FRAME>();
1000  wxPoint translation;
1001  double rotation;
1002  ROTATION_ANCHOR rotationAnchor = selection.Size() > 1 ? ROTATE_AROUND_SEL_CENTER
1004 
1005  DIALOG_MOVE_EXACT dialog( editFrame, translation, rotation, rotationAnchor );
1006  int ret = dialog.ShowModal();
1007 
1008  if( ret == wxID_OK )
1009  {
1010  VECTOR2I rp = selection.GetCenter();
1011  wxPoint selCenter( rp.x, rp.y );
1012 
1013  // Make sure the rotation is from the right reference point
1014  selCenter += translation;
1015 
1016  // When editing modules, all items have the same parent
1017  if( EditingModules() )
1018  {
1019  m_commit->Modify( selection.Front() );
1020  }
1021 
1022  for( auto selItem : selection )
1023  {
1024  BOARD_ITEM* item = dynamic_cast<BOARD_ITEM*>( selItem );
1025 
1026  if( !item->IsNew() && !EditingModules() )
1027  m_commit->Modify( item );
1028 
1029  item->Move( translation );
1030 
1031  switch( rotationAnchor )
1032  {
1034  item->Rotate( item->GetPosition(), rotation );
1035  break;
1037  item->Rotate( selCenter, rotation );
1038  break;
1040  item->Rotate( editFrame->GetScreen()->m_O_Curseur, rotation );
1041  break;
1043  item->Rotate( editFrame->GetAuxOrigin(), rotation );
1044  break;
1045  }
1046 
1047  if( !m_dragging )
1048  getView()->Update( item );
1049  }
1050 
1051  m_commit->Push( _( "Move exact" ) );
1052 
1053  if( selection.IsHover() )
1055 
1057 
1058  if( m_dragging )
1060  }
1061 
1062  return 0;
1063 }
1064 
1065 
1066 int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
1067 {
1068  bool increment = aEvent.IsAction( &PCB_ACTIONS::duplicateIncrement );
1069 
1070  // Be sure that there is at least one item that we can modify
1072  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
1074 
1075  if( selection.Empty() )
1076  return 0;
1077 
1078  // we have a selection to work on now, so start the tool process
1079  PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
1080 
1081  std::vector<BOARD_ITEM*> new_items;
1082  new_items.reserve( selection.Size() );
1083 
1084  BOARD_ITEM* orig_item = nullptr;
1085  BOARD_ITEM* dupe_item = nullptr;
1086 
1087  // Each selected item is duplicated and pushed to new_items list
1088  // Old selection is cleared, and new items are then selected.
1089  for( auto item : selection )
1090  {
1091  if( !item )
1092  continue;
1093 
1094  orig_item = static_cast<BOARD_ITEM*>( item );
1095 
1096  if( m_editModules )
1097  {
1098  dupe_item = editFrame->GetBoard()->m_Modules->Duplicate( orig_item, increment );
1099  }
1100  else
1101  {
1102 #if 0
1103  // @TODO: see if we allow zone duplication here
1104  // Duplicate zones is especially tricky (overlaping zones must be merged)
1105  // so zones are not duplicated
1106  if( item->Type() != PCB_ZONE_AREA_T )
1107 #endif
1108  dupe_item = editFrame->GetBoard()->Duplicate( orig_item );
1109  }
1110 
1111  if( dupe_item )
1112  {
1113  // Clear the selection flag here, otherwise the SELECTION_TOOL
1114  // will not properly select it later on
1115  dupe_item->ClearSelected();
1116 
1117  new_items.push_back( dupe_item );
1118  m_commit->Add( dupe_item );
1119  }
1120  }
1121 
1122  // Clear the old selection first
1124 
1125  // Select the new items
1126  m_toolMgr->RunAction( PCB_ACTIONS::selectItems, true, &new_items );
1127 
1128  // record the new items as added
1129  if( !selection.Empty() )
1130  {
1131  editFrame->DisplayToolMsg( wxString::Format( _( "Duplicated %d item(s)" ),
1132  (int) new_items.size() ) );
1133 
1134 
1135  // If items were duplicated, pick them up
1136  // this works well for "dropping" copies around and pushes the commit
1138  Main( evt );
1139  }
1140 
1141  return 0;
1142 }
1143 
1144 
1146 {
1147 public:
1148 
1149  GAL_ARRAY_CREATOR( PCB_BASE_FRAME& editFrame, bool editModules,
1150  const SELECTION& selection ):
1151  ARRAY_CREATOR( editFrame ),
1152  m_editModules( editModules ),
1153  m_selection( selection )
1154  {}
1155 
1156 private:
1157 
1158  int getNumberOfItemsToArray() const override
1159  {
1160  // only handle single items
1161  return m_selection.Size();
1162  }
1163 
1164  BOARD_ITEM* getNthItemToArray( int n ) const override
1165  {
1166  return static_cast<BOARD_ITEM*>( m_selection[n] );
1167  }
1168 
1169  BOARD* getBoard() const override
1170  {
1171  return m_parent.GetBoard();
1172  }
1173 
1174  MODULE* getModule() const override
1175  {
1176  // Remember this is valid and used only in the module editor.
1177  // in board editor, the parent of items is usually the board.
1178  return m_editModules ? m_parent.GetBoard()->m_Modules.GetFirst() : NULL;
1179  }
1180 
1181  wxPoint getRotationCentre() const override
1182  {
1183  const VECTOR2I rp = m_selection.GetCenter();
1184  return wxPoint( rp.x, rp.y );
1185  }
1186 
1187  void prePushAction( BOARD_ITEM* aItem ) override
1188  {
1189  // Because aItem is/can be created from a selected item, and inherits from
1190  // it this state, reset the selected stated of aItem:
1191  aItem->ClearSelected();
1192 
1193  if( aItem->Type() == PCB_MODULE_T )
1194  {
1195  static_cast<MODULE*>( aItem )->RunOnChildren( [&] ( BOARD_ITEM* item )
1196  {
1197  item->ClearSelected();
1198  }
1199  );
1200  }
1201  }
1202 
1203  void postPushAction( BOARD_ITEM* new_item ) override
1204  {
1205  }
1206 
1207  void finalise() override
1208  {
1209  }
1210 
1213 };
1214 
1215 
1217 {
1219  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
1221 
1222  if( selection.Empty() )
1223  return 0;
1224 
1225  // we have a selection to work on now, so start the tool process
1226  PCB_BASE_FRAME* editFrame = getEditFrame<PCB_BASE_FRAME>();
1227  GAL_ARRAY_CREATOR array_creator( *editFrame, m_editModules, selection );
1228  array_creator.Invoke();
1229 
1230  return 0;
1231 }
1232 
1233 
1235 {
1236  for( int i = aCollector.GetCount() - 1; i >= 0; i-- )
1237  {
1238  BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aCollector[i] );
1239 
1240  if( item->Type() != PCB_PAD_T )
1241  aCollector.Remove( i );
1242  }
1243 }
1244 
1245 
1247 {
1248  for( int i = aCollector.GetCount() - 1; i >= 0; i-- )
1249  {
1250  BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aCollector[i] );
1251 
1252  if( item->Type() != PCB_MODULE_T )
1253  aCollector.Remove( i );
1254  }
1255 }
1256 
1257 
1259 {
1261 
1262  bool updateMode = aEvent.IsAction( &PCB_ACTIONS::updateFootprints );
1263 
1264  MODULE* mod = (selection.Empty() ? nullptr : selection.FirstOfKind<MODULE> () );
1265 
1266  frame()->SetCurItem( mod );
1267 
1268  // Footprint exchange could remove modules, so they have to be
1269  // removed from the selection first
1271 
1272  // invoke the exchange dialog process
1273  {
1274  DIALOG_EXCHANGE_FOOTPRINTS dialog( frame(), mod, updateMode, mod != nullptr );
1275  dialog.ShowQuasiModal();
1276  }
1277 
1278  return 0;
1279 }
1280 
1281 
1283 {
1284  if( EditingModules() && !frame()->GetModel())
1285  return 0;
1286 
1287  auto& view = *getView();
1288  auto& controls = *getViewControls();
1290 
1291  Activate();
1292  frame()->SetToolID( toolID, wxCURSOR_PENCIL, _( "Measure distance" ) );
1293 
1294  EDA_UNITS_T units = frame()->GetUserUnits();
1296  KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr, units );
1297 
1298  view.Add( &ruler );
1299  view.SetVisible( &ruler, false );
1300 
1301  GRID_HELPER grid( frame() );
1302 
1303  bool originSet = false;
1304 
1305  controls.ShowCursor( true );
1306  controls.SetAutoPan( false );
1307  controls.CaptureCursor( false );
1308 
1309  while( auto evt = Wait() )
1310  {
1311  grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
1312  grid.SetUseGrid( !evt->Modifier( MD_ALT ) );
1313  controls.SetSnapping( !evt->Modifier( MD_ALT ) );
1314  const VECTOR2I cursorPos = grid.BestSnapAnchor( controls.GetMousePosition(), nullptr );
1315  controls.ForceCursorPosition(true, cursorPos );
1316 
1318  {
1319  break;
1320  }
1321 
1322  // click or drag starts
1323  else if( !originSet && ( evt->IsDrag( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) ) )
1324  {
1325  twoPtMgr.SetOrigin( cursorPos );
1326  twoPtMgr.SetEnd( cursorPos );
1327 
1328  controls.CaptureCursor( true );
1329  controls.SetAutoPan( true );
1330 
1331  originSet = true;
1332  }
1333 
1334  // second click or mouse up after drag ends
1335  else if( originSet && ( evt->IsClick( BUT_LEFT ) || evt->IsMouseUp( BUT_LEFT ) ) )
1336  {
1337  originSet = false;
1338 
1339  controls.SetAutoPan( false );
1340  controls.CaptureCursor( false );
1341  }
1342 
1343  // move or drag when origin set updates rules
1344  else if( originSet && ( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) )
1345  {
1346  twoPtMgr.SetAngleSnap( evt->Modifier( MD_CTRL ) );
1347  twoPtMgr.SetEnd( cursorPos );
1348 
1349  view.SetVisible( &ruler, true );
1350  view.Update( &ruler, KIGFX::GEOMETRY );
1351  }
1352 
1353  else if( evt->IsAction( &PCB_ACTIONS::switchUnits )
1354  || evt->IsAction( &PCB_ACTIONS::updateUnits ) )
1355  {
1356  if( frame()->GetUserUnits() != units )
1357  {
1358  units = frame()->GetUserUnits();
1359  ruler.SwitchUnits();
1360  view.Update( &ruler, KIGFX::GEOMETRY );
1361  }
1362  }
1363 
1364  else if( evt->IsClick( BUT_RIGHT ) )
1365  {
1367  }
1368  }
1369 
1370  view.SetVisible( &ruler, false );
1371  view.Remove( &ruler );
1372 
1373  frame()->SetNoToolSelected();
1374 
1375  return 0;
1376 }
1377 
1378 
1380 {
1381  Go( &EDIT_TOOL::Main, PCB_ACTIONS::editActivate.MakeEvent() );
1382  Go( &EDIT_TOOL::Main, PCB_ACTIONS::move.MakeEvent() );
1383  Go( &EDIT_TOOL::Drag, PCB_ACTIONS::drag45Degree.MakeEvent() );
1385  Go( &EDIT_TOOL::Rotate, PCB_ACTIONS::rotateCw.MakeEvent() );
1386  Go( &EDIT_TOOL::Rotate, PCB_ACTIONS::rotateCcw.MakeEvent() );
1387  Go( &EDIT_TOOL::Flip, PCB_ACTIONS::flip.MakeEvent() );
1388  Go( &EDIT_TOOL::Remove, PCB_ACTIONS::remove.MakeEvent() );
1389  Go( &EDIT_TOOL::Remove, PCB_ACTIONS::removeAlt.MakeEvent() );
1395  Go( &EDIT_TOOL::Mirror, PCB_ACTIONS::mirror.MakeEvent() );
1396 
1403 }
1404 
1405 
1407 {
1408  if( m_dragging && aSelection.HasReferencePoint() )
1409  return false;
1410 
1411  // When there is only one item selected, the reference point is its position...
1412  if( aSelection.Size() == 1 )
1413  {
1414  auto item = static_cast<BOARD_ITEM*>( aSelection.Front() );
1415  auto pos = item->GetPosition();
1416  aSelection.SetReferencePoint( VECTOR2I( pos.x, pos.y ) );
1417  }
1418  // ...otherwise modify items with regard to the cursor position
1419  else
1420  {
1422  aSelection.SetReferencePoint( m_cursor );
1423  }
1424 
1425  return true;
1426 }
1427 
1428 
1430 {
1432 
1433  if( selection.Empty() )
1434  return 0;
1435 
1437 
1438  if( !mod )
1439  return 0;
1440 
1441  PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
1442 
1443  editFrame->SetCurItem( mod );
1444 
1445  if( editFrame->GetCurItem()->GetTimeStamp() == 0 ) // Module Editor needs a non null timestamp
1446  {
1447  editFrame->GetCurItem()->SetTimeStamp( GetNewTimeStamp() );
1448  editFrame->OnModify();
1449  }
1450 
1452 
1453  editor->Load_Module_From_BOARD( (MODULE*) editFrame->GetCurItem() );
1454  editFrame->SetCurItem( NULL ); // the current module could be deleted by
1455 
1456  editor->Show( true );
1457  editor->Raise(); // Iconize( false );
1458 
1459  if( selection.IsHover() )
1461 
1462  return 0;
1463 }
1464 
1465 
1467 {
1468  STATUS_TEXT_POPUP statusPopup( frame() );
1469  PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
1470  bool picking = true;
1471  bool retVal = true;
1472 
1473  statusPopup.SetText( _( "Select reference point for the copy..." ) );
1474  picker->Activate();
1475  picker->SetClickHandler( [&]( const VECTOR2D& aPoint ) -> bool
1476  {
1477  aP = aPoint;
1478  statusPopup.SetText( _( "Selection copied." ) );
1479  statusPopup.Expire( 800 );
1480  picking = false;
1481  return false; // we don't need any more points
1482  } );
1483  picker->SetCancelHandler( [&]()
1484  {
1485  statusPopup.SetText( _( "Copy cancelled." ) );
1486  statusPopup.Expire( 800 );
1487  picking = false;
1488  retVal = false;
1489  } );
1490 
1491  statusPopup.Move( wxGetMousePosition() + wxPoint( 20, -50 ) );
1492  statusPopup.Popup();
1493 
1494  while( picking )
1495  {
1496  statusPopup.Move( wxGetMousePosition() + wxPoint( 20, -50 ) );
1497  Wait();
1498  }
1499 
1500  statusPopup.Hide();
1501  return retVal;
1502 }
1503 
1504 
1505 int EDIT_TOOL::doCopyToClipboard( bool withAnchor )
1506 {
1507  CLIPBOARD_IO io;
1508 
1509  Activate();
1510 
1512  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
1514 
1515  if( selection.Empty() )
1516  return 1;
1517 
1518  if( withAnchor )
1519  {
1520  VECTOR2I refPoint;
1521  bool rv = pickCopyReferencePoint( refPoint );
1522  frame()->SetMsgPanel( board() );
1523 
1524  if( !rv )
1525  return 1;
1526 
1527  selection.SetReferencePoint( refPoint );
1528  }
1529 
1530  io.SetBoard( board() );
1531  io.SaveSelection( selection );
1532 
1533  return 0;
1534 }
1535 
1536 
1538 {
1539  return doCopyToClipboard( true );
1540 }
1541 
1542 
1544 {
1545  return doCopyToClipboard( true );
1546 }
1547 
1548 
1550 {
1551  if( !copyToClipboard( aEvent ) )
1552  {
1553  // N.B. Setting the CUT flag prevents lock filtering as we only want to delete the items that
1554  // were copied to the clipboard, no more, no fewer. Filtering for locked item, if any will be done
1555  // in the copyToClipboard() routine
1556  TOOL_EVENT evt = aEvent;
1558  Remove( evt );
1559  }
1560 
1561  return 0;
1562 }
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
VECTOR2I GetReferencePoint() const
Definition: selection.h:200
VECTOR2I BestDragOrigin(const VECTOR2I &aMousePos, BOARD_ITEM *aItem)
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
void setTransitions() override
Sets up handlers for various events.
Definition: edit_tool.cpp:1379
VECTOR2I m_cursor
Last cursor position (needed for getModificationPoint() to avoid changes of edit reference point)...
Definition: edit_tool.h:209
void ClearReferencePoint()
Definition: selection.h:210
int Main(const TOOL_EVENT &aEvent)
Function Main()
Definition: edit_tool.cpp:338
int Properties(const TOOL_EVENT &aEvent)
Function Edit()
Definition: edit_tool.cpp:627
int Rotate(const TOOL_EVENT &aEvent)
Function Rotate()
Definition: edit_tool.cpp:669
static TOOL_ACTION move
move an item
Definition: pcb_actions.h:96
KIGFX::VIEW_CONTROLS * controls() const
Definition: pcb_tool.h:138
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
VECTOR2I GetCenter() const
Returns the center point of the selection area bounding box.
Definition: selection.cpp:67
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg) override
Set the tool command ID to aId and sets the cursor to aCursor.
bool IsHover() const
Definition: selection.h:69
int ExchangeFootprints(const TOOL_EVENT &aEvent)
Function ExchangeFootprints()
Definition: edit_tool.cpp:1258
static TOOL_ACTION editActivate
Activation of the edit tool.
Definition: pcb_actions.h:93
static const KICAD_T Tracks[]
A scan list for only TRACKS.
Definition: collectors.h:318
virtual VECTOR2D GetMousePosition(bool aWorldCoordinates=true) const =0
Function GetMousePosition() Returns the current mouse pointer position.
int GetCurrentViaDrill() const
Function GetCurrentViaDrill.
int GetCurrentTrackWidth() const
Function GetCurrentTrackWidth.
TOOL_MENU m_menu
Menu model displayed by the tool.
Definition: pcb_tool.h:148
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:91
This file is part of the common library.
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
bool HasType(KICAD_T aType) const
Checks if there is at least one item of requested kind.
Definition: selection.h:182
void SetClickHandler(CLICK_HANDLER aHandler)
Function SetClickHandler() Sets a handler for mouse click event.
Definition: picker_tool.h:95
std::unique_ptr< BOARD_COMMIT > m_commit
Definition: edit_tool.h:223
void ClearSelected()
Definition: base_struct.h:234
int doCopyToClipboard(bool withAnchor)
Definition: edit_tool.cpp:1505
void AddSeparator(const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Function AddSeparator()
VIEW_CONTROLS class definition.
Class SELECTION_TOOL.
Class TWO_POINT_GEOMETRY_MANAGER.
virtual void OnEditItemRequest(wxDC *aDC, BOARD_ITEM *aItem)=0
Function OnEditItemRequest Install the corresponding dialog editor for the given item.
Class BOARD to handle a board.
SELECTION_LOCK_FLAGS CheckLock()
Checks if the user has agreed to modify locked items for the given selection.
Class STATUS_TEXT_POPUP.
Definition: status_popup.h:79
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:49
bool updateModificationPoint(SELECTION &aSelection)
Returns the right modification point (e.g.
Definition: edit_tool.cpp:1406
static TOOL_ACTION dragFreeAngle
Definition: pcb_actions.h:142
const SELECTION & selection() const
Definition: pcb_tool.cpp:245
Tool is invoked after being inactive.
Definition: tool_base.h:82
KIGFX::PCB_VIEW * view() const
Definition: pcb_tool.h:137
static TOOL_ACTION explodePadToShapes
Definition: pcb_actions.h:317
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...
PCB_BASE_FRAME & m_parent
Definition: array_creator.h:61
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:376
static TOOL_ACTION properties
Activation of the edit tool.
Definition: pcb_actions.h:111
void SetCurItem(BOARD_ITEM *aItem, bool aDisplayInfo=true)
Function SetCurItem sets the currently selected item and displays it in the MsgPanel.
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
Action activates a tool
Definition: tool_event.h:152
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
static int LegacyHotKey(int aHotKey)
Creates a hot key code that refers to a legacy hot key setting, instead of a particular key...
Definition: tool_action.h:174
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:219
static TOOL_ACTION removeAlt
Definition: pcb_actions.h:133
Classes to handle copper zones.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:539
static TOOL_ACTION drag45Degree
Definition: pcb_actions.h:141
static TOOL_ACTION mirror
Mirroring of selected items.
Definition: pcb_actions.h:108
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
VECTOR2I BestSnapAnchor(const VECTOR2I &aOrigin, BOARD_ITEM *aDraggedItem)
static TOOL_ACTION updateUnits
Definition: pcb_actions.h:373
void UndoRedoBlock(bool aBlock=true)
Function UndoRedoBlock Enables/disable undo and redo operations.
TOOL_BASE * FindTool(int aId) const
Function FindTool() Searches for a tool with given ID.
SELECTION_TOOL * m_selectionTool
Selection tool used for obtaining selected items
Definition: edit_tool.h:199
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...
void SaveSelection(const SELECTION &selected)
static TOOL_ACTION pasteFromClipboard
Paste from clipboard.
Definition: pcb_actions.h:329
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
static TOOL_ACTION switchUnits
Definition: pcb_actions.h:372
void SetBoard(BOARD *aBoard)
Definition of class FOOTPRINT_EDIT_FRAME.
static bool NotEmpty(const SELECTION &aSelection)
Function NotEmpty Tests if there are any items selected.
wxPoint m_O_Curseur
Relative Screen cursor coordinate (on grid) in user units.
Definition: base_screen.h:185
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
static const int delta[8][2]
Definition: solve.cpp:112
void Remove(int aIndex)
Function Remove removes the item at aIndex (first position is 0);.
Definition: collector.h:143
virtual void Remove(VIEW_ITEM *aItem) override
Function Remove() Removes a VIEW_ITEM from the view.
Definition: pcb_view.cpp:74
const wxPoint & GetAuxOrigin() const override
Return the origin of the axis used for plotting and various exports.
MODULE * getModule() const override
Definition: edit_tool.cpp:1174
static TOOL_ACTION selectionModified
Modified selection notification.
Definition: pcb_actions.h:114
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
int Mirror(const TOOL_EVENT &aEvent)
Function Mirror.
Definition: edit_tool.cpp:753
Pcbnew hotkeys.
BOARD_ITEM * getNthItemToArray(int n) const override
Definition: edit_tool.cpp:1164
bool IsNew() const
Definition: base_struct.h:219
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
static TOOL_ACTION moveExact
Activation of the exact move tool.
Definition: pcb_actions.h:117
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:1549
Generic tool for picking a point.
Definition: picker_tool.h:34
void Append(EDA_ITEM *item)
Function Append adds an item to the end of the list.
Definition: collector.h:133
void finalise() override
Definition: edit_tool.cpp:1207
bool m_lockedSelected
Flag determining whether we are prompting for locked removal
Definition: edit_tool.h:205
void SetParameter(T aParam)
Function SetParameter() Sets a non-standard parameter assigned to the event.
Definition: tool_event.h:399
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:114
static TOOL_ACTION duplicate
Activation of the duplication tool.
Definition: pcb_actions.h:120
void Mirror(const wxPoint aCentre, bool aMirrorAroundXAxis)
Mirror an edge of the footprint.
class MODULE, a footprint
Definition: typeinfo.h:89
int Flip(const TOOL_EVENT &aEvent)
Function Flip()
Definition: edit_tool.cpp:835
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:205
static TOOL_ACTION duplicateIncrement
Activation of the duplication tool with incrementing (e.g. pad number)
Definition: pcb_actions.h:123
timestamp_t GetNewTimeStamp()
Definition: common.cpp:216
bool isInteractiveDragEnabled() const
Definition: edit_tool.cpp:318
static TOOL_ACTION rotateCw
Rotation of selected objects clockwise.
Definition: pcb_actions.h:99
Class LSET is a set of PCB_LAYER_IDs.
int getNumberOfItemsToArray() const override
Definition: edit_tool.cpp:1158
wxPoint getRotationCentre() const override
Definition: edit_tool.cpp:1181
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
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
bool m_dragging
Flag determining if anything is being dragged right now
Definition: edit_tool.h:202
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area. ...
PCB_GENERAL_SETTINGS & Settings()
BOARD * board() const
Definition: pcb_tool.h:140
int ShowQuasiModal()
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...
EDA_UNITS_T GetUserUnits() const override
Return the user units currently in use.
Definition: draw_frame.h:290
SELECTION_LOCK_FLAGS
Definition: selection.h:229
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:387
const wxPoint & GetOffset() const
Definition: class_pad.h:278
Class TOOL_EVENT.
Definition: tool_event.h:168
static TOOL_ACTION createArray
Tool for creating an array of objects.
Definition: pcb_actions.h:323
void SetOrigin(const VECTOR2I &aOrigin)
Set the origin of the ruler (the fixed end)
GAL_ARRAY_CREATOR(PCB_BASE_FRAME &editFrame, bool editModules, const SELECTION &selection)
Definition: edit_tool.cpp:1149
timestamp_t GetTimeStamp() const
Definition: base_struct.h:207
SELECTION & GetSelection()
Function GetSelection()
bool HasItem(const EDA_ITEM *aItem) const
Function HasItem tests if aItem has already been collected.
Definition: collector.h:197
bool Init() override
Function Init() Init() is called once upon a registration of the tool.
Definition: edit_tool.cpp:230
Class VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (...
bool Load_Module_From_BOARD(MODULE *Module)
Load in Modedit a footprint from the main board.
virtual void Popup(wxWindow *aFocus=nullptr)
int Drag(const TOOL_EVENT &aEvent)
Function Drag()
Definition: edit_tool.cpp:326
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 Rotate(const wxPoint &aRotCentre, double aAngle)
Function Rotate Rotate this object.
static TOOL_ACTION exchangeFootprints
Exchange footprints of modules.
Definition: pcb_actions.h:129
virtual void Move(const wxPoint &aWhere)
const wxSize & GetDelta() const
Definition: class_pad.h:272
bool IsCancelInteractive(const TOOL_EVENT &aEvt)
Function IsCancelInteractive()
All active tools
Definition: tool_event.h:144
static TOOL_ACTION cutToClipboard
Paste from clipboard.
Definition: pcb_actions.h:332
T * GetFirst() const
Function GetFirst returns the first T* in the list without removing it, or NULL if the list is empty...
Definition: dlist.h:163
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:1539
BOARD * getBoard() const override
Definition: edit_tool.cpp:1169
void Expire(int aMsecs)
Hides the popup after a specified time.
const SELECTION & m_selection
Definition: edit_tool.cpp:1212
ROTATION_ANCHOR
static TOOL_ACTION copyToClipboard
Copy selected items to clipboard.
Definition: pcb_actions.h:326
static TOOL_ACTION routerInlineDrag
Activation of the Push and Shove router (inline dragging mode)
Definition: pcb_actions.h:223
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg...
#define EXCLUDE_TRANSIENTS
Definition: edit_tool.h:48
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:116
static TOOL_ACTION inlineBreakTrack
Breaks track when router is not activated.
Definition: pcb_actions.h:139
void SetCancelHandler(CANCEL_HANDLER aHandler)
Function SetCancelHandler() Sets a handler for cancel events (ESC or context-menu Cancel)...
Definition: picker_tool.h:105
virtual const wxPoint GetPosition() const =0
bool m_editModules
Definition: pcb_tool.h:150
void SetSnap(bool aSnap)
Definition: grid_helper.h:72
void Reset(RESET_REASON aReason) override
Function Reset() Brings the tool to a known, initial state.
Definition: edit_tool.cpp:221
static TOOL_ACTION expandSelectedConnection
Expands the current selection to select a connection between two junctions.
Definition: pcb_actions.h:74
static TOOL_ACTION updateFootprints
Update footprints to reflect any changes in the library.
Definition: pcb_actions.h:126
static TOOL_ACTION rotateCcw
Rotation of selected objects counter-clockwise.
Definition: pcb_actions.h:102
static void PadFilter(const VECTOR2I &, GENERAL_COLLECTOR &aCollector)
Function PadFilter()
Definition: edit_tool.cpp:1234
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
int MoveExact(const TOOL_EVENT &aEvent)
Function MoveExact()
Definition: edit_tool.cpp:990
ID_MODEDIT_MEASUREMENT_TOOL
VECTOR2I Align(const VECTOR2I &aPoint) const
int Remove(const TOOL_EVENT &aEvent)
Function Remove()
Definition: edit_tool.cpp:876
static ROUTER * theRouter
Definition: pns_router.cpp:59
static TOOL_ACTION createPadFromShapes
Definition: pcb_actions.h:316
static TOOL_ACTION flip
Flipping of selected objects.
Definition: pcb_actions.h:105
virtual void SetNoToolSelected()
Select the ID_NO_TOOL_SELECTED id tool (Idle tool)
virtual void OnModify()
Function OnModify Virtual Must be called after a change in order to set the "modify" flag of the curr...
int GetCurrentViaSize() const
Function GetCurrentViaSize.
virtual bool IsLocked() const
Function IsLocked.
bool invokeInlineRouter(int aDragMode)
Definition: edit_tool.cpp:297
bool HasReferencePoint() const
Definition: selection.h:195
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:99
bool pickCopyReferencePoint(VECTOR2I &aP)
Definition: edit_tool.cpp:1466
void DisplayToolMsg(const wxString &msg)
int CreateArray(const TOOL_EVENT &aEvent)
Function CreateArray()
Definition: edit_tool.cpp:1216
bool changeTrackWidthOnClick(const SELECTION &selection)
Definition: edit_tool.cpp:586
Common, abstract interface for edit frames.
int MeasureTool(const TOOL_EVENT &aEvent)
Launches a tool to measure between points
Definition: edit_tool.cpp:1282
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
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:171
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:396
DLIST< MODULE > m_Modules
Definition: class_board.h:249
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees, but soon degrees.
Definition: class_pad.h:389
SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter, std::vector< BOARD_ITEM *> *aFiltered=NULL, bool aConfirmLockedItems=false)
Function RequestSelection()
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:245
Class TOOL_ACTION.
Definition: tool_action.h:46
size_t i
Definition: json11.cpp:597
static SELECTION_CONDITION OnlyType(KICAD_T aType)
Function OnlyType Creates a functor that tests if the selected items are only of given type...
TOOL_EVENT MakeEvent() const
Function HasHotKey() Checks if the action has a hot key assigned.
Definition: tool_action.h:104
int Size() const
Returns the number of selected parts.
Definition: selection.h:122
void SetAuxAxes(bool aEnable, const VECTOR2I &aOrigin=VECTOR2I(0, 0), bool aEnableDiagonal=false)
static wxPoint mirrorPointX(const wxPoint &aPoint, const wxPoint &aMirrorPoint)
Definition: edit_tool.cpp:715
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:139
static TOOL_ACTION positionRelative
Activation of the position relative tool.
Definition: pcb_actions.h:259
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:80
void Mirror(const wxPoint &aCentre, bool aMirrorAroundXAxis)
Mirror text position in footprint editing the text itself is not mirrored, and the layer not modified...
int editFootprintInFpEditor(const TOOL_EVENT &aEvent)
Definition: edit_tool.cpp:1429
T * FirstOfKind() const
Definition: selection.h:163
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:417
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Sets the item visibility.
Definition: view.cpp:1485
void Activate()
Function Activate() Runs the tool.
bool EditingModules() const
Definition: pcb_tool.h:102
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Function Add() Adds a VIEW_ITEM to the view.
Definition: pcb_view.cpp:58
void SetUseGrid(bool aGrid=true)
Definition: grid_helper.h:77
void SetX0(int x)
Definition: class_pad.h:266
#define EXCLUDE_LOCKED
Function EditToolSelectionFilter.
Definition: edit_tool.h:46
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:1537
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:216
static TOOL_ACTION updateLocalRatsnest
Definition: pcb_actions.h:388
int copyToClipboardWithAnchor(const TOOL_EVENT &aEvent)
Definition: edit_tool.cpp:1543
Module description (excepted pads)
static void FootprintFilter(const VECTOR2I &, GENERAL_COLLECTOR &aCollector)
Function FootprintFilter()
Definition: edit_tool.cpp:1246
BOARD * GetBoard() const
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
bool RoutingInProgress() const
Definition: pns_router.cpp:112
SGLIB_API S3DMODEL * GetModel(SCENEGRAPH *aNode)
Function GetModel creates an S3DMODEL representation of aNode (raw data, no transforms) ...
Definition: ifsg_api.cpp:471
static TOOL_ACTION remove
Deleting a BOARD_ITEM.
Definition: pcb_actions.h:132
void UpdateMsgPanel() override
>
ROUTER * Router() const
const wxPoint GetPosition() const override
Definition: class_pad.h:220
#define EXCLUDE_LOCKED_PADS
Definition: edit_tool.h:47
EDGE_MODULE class definition.
void postPushAction(BOARD_ITEM *new_item) override
Definition: edit_tool.cpp:1203
BOARD_ITEM_CONTAINER * GetParent() const
int GetEventRotationAngle(const PCB_BASE_EDIT_FRAME &aFrame, const TOOL_EVENT &aEvt)
Function getEventRotationAngle()
BOARD_ITEM * GetCurItem()
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:277
void EditToolSelectionFilter(GENERAL_COLLECTOR &aCollector, int aFlags)
Definition: edit_tool.cpp:173
int Duplicate(const TOOL_EVENT &aEvent)
Function Duplicate()
Definition: edit_tool.cpp:1066
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:245
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:62
ROUTING_SETTINGS & Settings()
Definition: pns_router.h:187
static void mirrorPadX(D_PAD &aPad, const wxPoint &aMirrorPoint)
Mirror a pad in the vertical axis passing through a point.
Definition: edit_tool.cpp:730
void MirrorXPrimitives(int aX)
Mirror the primitives about a coordinate.
Definition: class_pad.cpp:484
#define mod(a, n)
Definition: greymap.cpp:24
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
static TOOL_ACTION measureTool
Definition: pcb_actions.h:370
EDA_UNITS_T
Definition: common.h:160
void SetText(const wxString &aText)
Display a text.
int GetToolId() const
Definition: draw_frame.h:525
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:271
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false)=0
Moves cursor to the requested position expressed in world coordinates.
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
EDA_ITEM * Front() const
Definition: selection.h:152
void prePushAction(BOARD_ITEM *aItem) override
Definition: edit_tool.cpp:1187
void SetEnd(const VECTOR2I &aEnd)
Set the current end of the rectangle (the end that moves with the cursor.
OPT< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:495
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:206
Color has changed.
Definition: view_item.h:57
BOARD_ITEM * Duplicate(const BOARD_ITEM *aItem, bool aAddToBoard=false)