KiCad PCB EDA Suite
pcbnew_control.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) 2014-2016 CERN
5  * @author Maciej Suminski <maciej.suminski@cern.ch>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #include <cstdint>
26 
27 #include "pcbnew_control.h"
28 #include "pcb_actions.h"
29 #include "selection_tool.h"
30 #include "edit_tool.h"
31 #include "picker_tool.h"
32 #include "pcb_editor_control.h"
33 #include "grid_helper.h"
34 
35 #include <class_board.h>
36 #include <class_module.h>
37 #include <class_track.h>
38 #include <class_zone.h>
39 #include <class_pcb_screen.h>
40 
41 #include <confirm.h>
42 #include <hotkeys.h>
43 #include <properties.h>
44 #include <io_mgr.h>
45 #include <kicad_plugin.h>
46 #include <kicad_clipboard.h>
47 
48 #include <pcbnew_id.h>
49 #include <wxPcbStruct.h>
50 #include <pcb_draw_panel_gal.h>
51 #include <connectivity.h>
52 #include <tool/tool_manager.h>
54 #include <view/view_controls.h>
55 #include <pcb_painter.h>
56 #include <origin_viewitem.h>
57 #include <board_commit.h>
58 #include <bitmaps.h>
59 
60 #include <functional>
61 using namespace std::placeholders;
62 
63 
64 // files.cpp
65 extern bool AskLoadBoardFileName( wxWindow* aParent, int* aCtl, wxString* aFileName,
66  bool aKicadFilesOnly = false );
67 extern IO_MGR::PCB_FILE_T plugin_type( const wxString& aFileName, int aCtl );
68 
69 
70 // Display modes
71 TOOL_ACTION PCB_ACTIONS::trackDisplayMode( "pcbnew.Control.trackDisplayMode",
73  "", "" );
74 
75 TOOL_ACTION PCB_ACTIONS::padDisplayMode( "pcbnew.Control.padDisplayMode",
76  AS_GLOBAL, 0,
77  "", "" );
78 
79 TOOL_ACTION PCB_ACTIONS::viaDisplayMode( "pcbnew.Control.viaDisplayMode",
80  AS_GLOBAL, 0,
81  "", "" );
82 
83 TOOL_ACTION PCB_ACTIONS::zoneDisplayEnable( "pcbnew.Control.zoneDisplayEnable",
84  AS_GLOBAL, 0,
85  "", "" );
86 
87 TOOL_ACTION PCB_ACTIONS::zoneDisplayDisable( "pcbnew.Control.zoneDisplayDisable",
88  AS_GLOBAL, 0,
89  "", "" );
90 
91 TOOL_ACTION PCB_ACTIONS::zoneDisplayOutlines( "pcbnew.Control.zoneDisplayOutlines",
92  AS_GLOBAL, 0,
93  "", "" );
94 
95 TOOL_ACTION PCB_ACTIONS::highContrastMode( "pcbnew.Control.highContrastMode",
97  "", "" );
98 
99 TOOL_ACTION PCB_ACTIONS::highContrastInc( "pcbnew.Control.highContrastInc",
100  AS_GLOBAL, '>',
101  "", "" );
102 
103 TOOL_ACTION PCB_ACTIONS::highContrastDec( "pcbnew.Control.highContrastDec",
104  AS_GLOBAL, '<',
105  "", "" );
106 
107 
108 // Layer control
109 TOOL_ACTION PCB_ACTIONS::layerTop( "pcbnew.Control.layerTop",
111  "", "", NULL, AF_NONE, (void*) F_Cu );
112 
113 TOOL_ACTION PCB_ACTIONS::layerInner1( "pcbnew.Control.layerInner1",
115  "", "", NULL, AF_NONE, (void*) In1_Cu );
116 
117 TOOL_ACTION PCB_ACTIONS::layerInner2( "pcbnew.Control.layerInner2",
119  "", "", NULL, AF_NONE, (void*) In2_Cu );
120 
121 TOOL_ACTION PCB_ACTIONS::layerInner3( "pcbnew.Control.layerInner3",
123  "", "", NULL, AF_NONE, (void*) In3_Cu );
124 
125 TOOL_ACTION PCB_ACTIONS::layerInner4( "pcbnew.Control.layerInner4",
127  "", "", NULL, AF_NONE, (void*) In4_Cu );
128 
129 TOOL_ACTION PCB_ACTIONS::layerInner5( "pcbnew.Control.layerInner5",
131  "", "", NULL, AF_NONE, (void*) In5_Cu );
132 
133 TOOL_ACTION PCB_ACTIONS::layerInner6( "pcbnew.Control.layerInner6",
135  "", "", NULL, AF_NONE, (void*) In6_Cu );
136 
137 TOOL_ACTION PCB_ACTIONS::layerBottom( "pcbnew.Control.layerBottom",
139  "", "", NULL, AF_NONE, (void*) B_Cu );
140 
141 TOOL_ACTION PCB_ACTIONS::layerNext( "pcbnew.Control.layerNext",
143  "", "" );
144 
145 TOOL_ACTION PCB_ACTIONS::layerPrev( "pcbnew.Control.layerPrev",
147  "", "" );
148 
149 TOOL_ACTION PCB_ACTIONS::layerToggle( "pcbnew.Control.layerToggle",
151  "", "" );
152 
153 TOOL_ACTION PCB_ACTIONS::layerAlphaInc( "pcbnew.Control.layerAlphaInc",
155  "", "" );
156 
157 TOOL_ACTION PCB_ACTIONS::layerAlphaDec( "pcbnew.Control.layerAlphaDec",
159  "", "" );
160 
161 TOOL_ACTION PCB_ACTIONS::layerChanged( "pcbnew.Control.layerChanged",
162  AS_GLOBAL, 0,
163  "", "", NULL, AF_NOTIFY );
164 
165 // Cursor control
166 TOOL_ACTION PCB_ACTIONS::cursorUp( "pcbnew.Control.cursorUp",
167  AS_GLOBAL, WXK_UP, "", "", NULL, AF_NONE, (void*) CURSOR_UP );
168 TOOL_ACTION PCB_ACTIONS::cursorDown( "pcbnew.Control.cursorDown",
169  AS_GLOBAL, WXK_DOWN, "", "" , NULL, AF_NONE, (void*) CURSOR_DOWN );
170 TOOL_ACTION PCB_ACTIONS::cursorLeft( "pcbnew.Control.cursorLeft",
171  AS_GLOBAL, WXK_LEFT, "", "" , NULL, AF_NONE, (void*) CURSOR_LEFT );
172 TOOL_ACTION PCB_ACTIONS::cursorRight( "pcbnew.Control.cursorRight",
173  AS_GLOBAL, WXK_RIGHT, "", "" , NULL, AF_NONE, (void*) CURSOR_RIGHT );
174 
175 TOOL_ACTION PCB_ACTIONS::cursorUpFast( "pcbnew.Control.cursorUpFast",
176  AS_GLOBAL, MD_CTRL + WXK_UP, "", "", NULL, AF_NONE, (void*) ( CURSOR_UP | CURSOR_FAST_MOVE ) );
177 TOOL_ACTION PCB_ACTIONS::cursorDownFast( "pcbnew.Control.cursorDownFast",
178  AS_GLOBAL, MD_CTRL + WXK_DOWN, "", "" , NULL, AF_NONE, (void*) ( CURSOR_DOWN | CURSOR_FAST_MOVE ) );
179 TOOL_ACTION PCB_ACTIONS::cursorLeftFast( "pcbnew.Control.cursorLeftFast",
180  AS_GLOBAL, MD_CTRL + WXK_LEFT, "", "" , NULL, AF_NONE, (void*) ( CURSOR_LEFT | CURSOR_FAST_MOVE ) );
181 TOOL_ACTION PCB_ACTIONS::cursorRightFast( "pcbnew.Control.cursorRightFast",
182  AS_GLOBAL, MD_CTRL + WXK_RIGHT, "", "" , NULL, AF_NONE, (void*) ( CURSOR_RIGHT | CURSOR_FAST_MOVE ) );
183 
184 TOOL_ACTION PCB_ACTIONS::cursorClick( "pcbnew.Control.cursorClick",
186  "", "", NULL, AF_NONE, (void*) CURSOR_CLICK );
187 TOOL_ACTION PCB_ACTIONS::cursorDblClick( "pcbnew.Control.cursorDblClick",
189  "", "", NULL, AF_NONE, (void*) CURSOR_DBL_CLICK );
190 
191 TOOL_ACTION PCB_ACTIONS::panUp( "pcbnew.Control.panUp",
192  AS_GLOBAL, MD_SHIFT + WXK_UP, "", "", NULL, AF_NONE, (void*) CURSOR_UP );
193 TOOL_ACTION PCB_ACTIONS::panDown( "pcbnew.Control.panDown",
194  AS_GLOBAL, MD_SHIFT + WXK_DOWN, "", "" , NULL, AF_NONE, (void*) CURSOR_DOWN );
195 TOOL_ACTION PCB_ACTIONS::panLeft( "pcbnew.Control.panLeft",
196  AS_GLOBAL, MD_SHIFT + WXK_LEFT, "", "" , NULL, AF_NONE, (void*) CURSOR_LEFT );
197 TOOL_ACTION PCB_ACTIONS::panRight( "pcbnew.Control.panRight",
198  AS_GLOBAL, MD_SHIFT + WXK_RIGHT, "", "" , NULL, AF_NONE, (void*) CURSOR_RIGHT );
199 
200 // Miscellaneous
201 TOOL_ACTION PCB_ACTIONS::selectionTool( "pcbnew.Control.selectionTool",
202  AS_GLOBAL, 0,
203  "", "", NULL, AF_ACTIVATE );
204 
205 TOOL_ACTION PCB_ACTIONS::resetCoords( "pcbnew.Control.resetCoords",
207  "", "" );
208 
209 TOOL_ACTION PCB_ACTIONS::switchCursor( "pcbnew.Control.switchCursor",
210  AS_GLOBAL, 0,
211  "", "" );
212 
213 TOOL_ACTION PCB_ACTIONS::switchUnits( "pcbnew.Control.switchUnits",
215  "", "" );
216 
217 TOOL_ACTION PCB_ACTIONS::deleteItemCursor( "pcbnew.Control.deleteItemCursor",
218  AS_GLOBAL, 0,
219  "", "" );
220 
221 TOOL_ACTION PCB_ACTIONS::showHelp( "pcbnew.Control.showHelp",
223  "", "" );
224 
225 TOOL_ACTION PCB_ACTIONS::toBeDone( "pcbnew.Control.toBeDone",
226  AS_GLOBAL, 0, // dialog saying it is not implemented yet
227  "", "" ); // so users are aware of that
228 
229 TOOL_ACTION PCB_ACTIONS::pasteFromClipboard( "pcbnew.InteractiveEdit.pasteFromClipboard",
230  AS_GLOBAL, MD_CTRL + int( 'V' ),
231  _( "Paste" ), _( "Paste content from clipboard" ),
232  paste_xpm );
233 
234 
236  PCB_TOOL( "pcbnew.Control" ), m_frame( NULL )
237 {
238  m_gridOrigin.reset( new KIGFX::ORIGIN_VIEWITEM() );
239 }
240 
241 
243 {
244 }
245 
246 
248 {
249  m_frame = getEditFrame<PCB_BASE_FRAME>();
250 
251  if( aReason == MODEL_RELOAD || aReason == GAL_SWITCH )
252  {
253  m_gridOrigin->SetPosition( board()->GetGridOrigin() );
254  getView()->Remove( m_gridOrigin.get() );
255  getView()->Add( m_gridOrigin.get() );
256  }
257 }
258 
259 
261 {
262  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
263  auto settings = painter->GetSettings();
264 
265  // Apply new display options to the GAL canvas
267  displ_opts->m_DisplayPcbTrackFill = !displ_opts->m_DisplayPcbTrackFill;
268  settings->LoadDisplayOptions( displ_opts );
269 
270  for( auto track : board()->Tracks() )
271  {
272  if( track->Type() == PCB_TRACE_T )
273  view()->Update( track, KIGFX::GEOMETRY );
274  }
275 
277 
278  return 0;
279 }
280 
281 
283 {
284  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
285  auto settings = painter->GetSettings();
286 
288 
289  // Apply new display options to the GAL canvas
290  displ_opts->m_DisplayPadFill = !displ_opts->m_DisplayPadFill;
291  settings->LoadDisplayOptions( displ_opts );
292 
293  for( auto module : board()->Modules() )
294  {
295  for( auto pad : module->Pads() )
296  getView()->Update( pad, KIGFX::GEOMETRY );
297  }
298 
300 
301  return 0;
302 }
303 
304 
306 {
307  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
308  auto settings = painter->GetSettings();
310 
311  // Apply new display options to the GAL canvas
312  displ_opts->m_DisplayViaFill = !displ_opts->m_DisplayViaFill;
313  settings->LoadDisplayOptions( displ_opts );
314 
315  for( auto track : board()->Tracks() )
316  {
317  if( track->Type() == PCB_TRACE_T || track->Type() == PCB_VIA_T )
318  getView()->Update( track, KIGFX::GEOMETRY );
319  }
320 
322 
323  return 0;
324 }
325 
326 
328 {
329  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
330  auto settings = painter->GetSettings();
332 
333  // Apply new display options to the GAL canvas
335  displ_opts->m_DisplayZonesMode = 0;
336  else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayDisable ) )
337  displ_opts->m_DisplayZonesMode = 1;
338  else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayOutlines ) )
339  displ_opts->m_DisplayZonesMode = 2;
340  else
341  assert( false );
342 
343  settings->LoadDisplayOptions( displ_opts );
344 
345  for( int i = 0; i < board()->GetAreaCount(); ++i )
346  view()->Update( board()->GetArea( i ), KIGFX::GEOMETRY );
347 
349 
350  return 0;
351 }
352 
353 
355 {
356  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
357  auto settings = painter->GetSettings();
359 
360  displ_opts->m_ContrastModeDisplay = !displ_opts->m_ContrastModeDisplay;
361  settings->LoadDisplayOptions( displ_opts );
363 
364  return 0;
365 }
366 
367 
369 {
370  return 0;
371 }
372 
373 
375 {
376  return 0;
377 }
378 
379 
380 // Layer control
382 {
383  m_frame->SwitchLayer( NULL, (PCB_LAYER_ID) aEvent.Parameter<intptr_t>() );
384 
385  return 0;
386 }
387 
388 
390 {
391  PCB_BASE_FRAME* editFrame = m_frame;
392  LAYER_NUM layer = editFrame->GetActiveLayer();
393 
394  if( layer < F_Cu || layer > B_Cu )
395  return 0;
396 
397  int layerCount = board()->GetCopperLayerCount();
398 
399  if( layer == layerCount - 2 || layerCount < 2 )
400  layer = B_Cu;
401  else if( layer == B_Cu )
402  layer = F_Cu;
403  else
404  ++layer;
405 
406  assert( IsCopperLayer( layer ) );
407  editFrame->SwitchLayer( NULL, ToLAYER_ID( layer ) );
408 
409  return 0;
410 }
411 
412 
414 {
415  PCB_BASE_FRAME* editFrame = m_frame;
416  LAYER_NUM layer = editFrame->GetActiveLayer();
417 
418  if( layer < F_Cu || layer > B_Cu )
419  return 0;
420 
421  int layerCount = board()->GetCopperLayerCount();
422 
423  if( layer == F_Cu || layerCount < 2 )
424  layer = B_Cu;
425  else if( layer == B_Cu )
426  layer = layerCount - 2;
427  else
428  --layer;
429 
430  assert( IsCopperLayer( layer ) );
431  editFrame->SwitchLayer( NULL, ToLAYER_ID( layer ) );
432 
433  return 0;
434 }
435 
436 
438 {
439  LAYER_NUM currentLayer = m_frame->GetActiveLayer();
440  PCB_SCREEN* screen = m_frame->GetScreen();
441 
442  if( currentLayer == screen->m_Route_Layer_TOP )
443  m_frame->SwitchLayer( NULL, screen->m_Route_Layer_BOTTOM );
444  else
445  m_frame->SwitchLayer( NULL, screen->m_Route_Layer_TOP );
446 
447  return 0;
448 }
449 
450 
452 {
453  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
454  auto settings = painter->GetSettings();
455 
456  LAYER_NUM currentLayer = m_frame->GetActiveLayer();
457  KIGFX::COLOR4D currentColor = settings->GetLayerColor( currentLayer );
458 
459  if( currentColor.a <= 0.95 )
460  {
461  currentColor.a += 0.05;
462  settings->SetLayerColor( currentLayer, currentColor );
463  m_frame->GetGalCanvas()->GetView()->UpdateLayerColor( currentLayer );
464  }
465 
466  return 0;
467 }
468 
469 
471 {
472  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
473  auto settings = painter->GetSettings();
474 
475  LAYER_NUM currentLayer = m_frame->GetActiveLayer();
476  KIGFX::COLOR4D currentColor = settings->GetLayerColor( currentLayer );
477 
478  if( currentColor.a >= 0.05 )
479  {
480  currentColor.a -= 0.05;
481  settings->SetLayerColor( currentLayer, currentColor );
482  m_frame->GetGalCanvas()->GetView()->UpdateLayerColor( currentLayer );
483  }
484 
485  return 0;
486 }
487 
488 
489 // Cursor control
491 {
492  long type = aEvent.Parameter<intptr_t>();
493  bool fastMove = type & PCB_ACTIONS::CURSOR_FAST_MOVE;
494  type &= ~PCB_ACTIONS::CURSOR_FAST_MOVE;
495  bool mirroredX = getView()->IsMirroredX();
496 
497  GRID_HELPER gridHelper( m_frame );
499  VECTOR2I gridSize = gridHelper.GetGrid();
500 
501  if( fastMove )
502  gridSize = gridSize * 10;
503 
504  switch( type )
505  {
507  cursor -= VECTOR2D( 0, gridSize.y );
508  break;
509 
511  cursor += VECTOR2D( 0, gridSize.y );
512  break;
513 
515  cursor -= VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
516  break;
517 
519  cursor += VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
520  break;
521 
522  case PCB_ACTIONS::CURSOR_CLICK: // fall through
524  {
525  TOOL_ACTIONS action = TA_NONE;
526  int modifiers = 0;
527 
528  modifiers |= wxGetKeyState( WXK_SHIFT ) ? MD_SHIFT : 0;
529  modifiers |= wxGetKeyState( WXK_CONTROL ) ? MD_CTRL : 0;
530  modifiers |= wxGetKeyState( WXK_ALT ) ? MD_ALT : 0;
531 
532  if( type == PCB_ACTIONS::CURSOR_CLICK )
533  action = TA_MOUSE_CLICK;
534  else if( type == PCB_ACTIONS::CURSOR_DBL_CLICK )
535  action = TA_MOUSE_DBLCLICK;
536  else
537  assert( false );
538 
539  TOOL_EVENT evt( TC_MOUSE, action, BUT_LEFT | modifiers );
540  evt.SetMousePosition( getViewControls()->GetCursorPosition() );
541  m_toolMgr->ProcessEvent( evt );
542 
543  return 0;
544  }
545  break;
546  }
547 
548  getViewControls()->SetCursorPosition( cursor );
549 
550  return 0;
551 }
552 
553 
555 {
556  long type = aEvent.Parameter<intptr_t>();
557  KIGFX::VIEW* view = getView();
558  GRID_HELPER gridHelper( m_frame );
559  VECTOR2D center = view->GetCenter();
560  VECTOR2I gridSize = gridHelper.GetGrid() * 10;
561  bool mirroredX = view->IsMirroredX();
562 
563  switch( type )
564  {
566  center -= VECTOR2D( 0, gridSize.y );
567  break;
568 
570  center += VECTOR2D( 0, gridSize.y );
571  break;
572 
574  center -= VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
575  break;
576 
578  center += VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
579  break;
580 
581  default:
582  assert( false );
583  break;
584  }
585 
586  view->SetCenter( center );
587 
588  return 0;
589 }
590 
591 
592 // Grid control
594 {
596  updateGrid();
597 
598  return 0;
599 }
600 
601 
603 {
605  updateGrid();
606 
607  return 0;
608 }
609 
610 
611 static bool setOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
612  KIGFX::ORIGIN_VIEWITEM* aItem, const VECTOR2D& aPoint )
613 {
614  aFrame->SetGridOrigin( wxPoint( aPoint.x, aPoint.y ) );
615  aView->GetGAL()->SetGridOrigin( aPoint );
616  aItem->SetPosition( aPoint );
617  aView->MarkDirty();
618 
619  return true;
620 }
621 
622 
624 {
625  VECTOR2D* origin = aEvent.Parameter<VECTOR2D*>();
626 
627  if( origin )
628  {
629  setOrigin( getView(), m_frame, m_gridOrigin.get(), *origin );
630  delete origin;
631  }
632  else
633  {
634  Activate();
635 
637  assert( picker );
638 
639  // TODO it will not check the toolbar button in module editor, as it uses a different ID..
640  m_frame->SetToolID( ID_PCB_PLACE_GRID_COORD_BUTT, wxCURSOR_PENCIL, _( "Adjust grid origin" ) );
641  picker->SetClickHandler( std::bind( setOrigin, getView(), m_frame, m_gridOrigin.get(), _1 ) );
642  picker->Activate();
643  Wait();
644  }
645 
646  return 0;
647 }
648 
649 
651 {
652  board()->SetGridOrigin( wxPoint( 0, 0 ) );
653  m_gridOrigin->SetPosition( VECTOR2D( 0, 0 ) );
654 
655  return 0;
656 }
657 
658 
659 // Miscellaneous
661 {
662  VECTOR2I cursorPos = getViewControls()->GetCursorPosition();
663 
664  m_frame->GetScreen()->m_O_Curseur = wxPoint( cursorPos.x, cursorPos.y );
666 
667  return 0;
668 }
669 
670 
672 {
673  auto& galOpts = m_frame->GetGalDisplayOptions();
674 
675  galOpts.m_fullscreenCursor = !galOpts.m_fullscreenCursor;
676  galOpts.NotifyChanged();
677 
678  return 0;
679 }
680 
681 
683 {
684  // TODO should not it be refactored to pcb_frame member function?
685  wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED );
686 
687  if( g_UserUnit == INCHES )
688  evt.SetId( ID_TB_OPTIONS_SELECT_UNIT_MM );
689  else
690  evt.SetId( ID_TB_OPTIONS_SELECT_UNIT_INCH );
691 
692  m_frame->ProcessEvent( evt );
693 
694  return 0;
695 }
696 
697 
698 static bool deleteItem( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition )
699 {
700  SELECTION_TOOL* selectionTool = aToolMgr->GetTool<SELECTION_TOOL>();
701  assert( selectionTool );
702 
703  aToolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
704  aToolMgr->RunAction( PCB_ACTIONS::selectionCursor, true );
705  selectionTool->SanitizeSelection();
706 
707  const SELECTION& selection = selectionTool->GetSelection();
708 
709  if( selection.Empty() )
710  return true;
711 
712  bool canBeRemoved = ( selection.Front()->Type() != PCB_MODULE_T );
713 
714  if( canBeRemoved || IsOK( aToolMgr->GetEditFrame(), _( "Are you sure you want to delete item?" ) ) )
715  aToolMgr->RunAction( PCB_ACTIONS::remove, true );
716  else
717  aToolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
718 
719  return true;
720 }
721 
722 
724 {
725  Activate();
726 
728  assert( picker );
729 
730  // TODO it will not check the toolbar button in the module editor, as it uses a different ID..
731  m_frame->SetToolID( ID_PCB_DELETE_ITEM_BUTT, wxCURSOR_BULLSEYE, _( "Delete item" ) );
732  picker->SetSnapping( false );
733  picker->SetClickHandler( std::bind( deleteItem, m_toolMgr, _1 ) );
734  picker->Activate();
735  Wait();
736 
737  return 0;
738 }
739 
741 {
742  CLIPBOARD_IO pi;
743  BOARD tmpBoard;
744  BOARD_ITEM* clipItem = pi.Parse();
745 
746  if( !clipItem )
747  {
748  return 0;
749  }
750 
751  if( clipItem->Type() == PCB_T )
752  static_cast<BOARD*>(clipItem)->ClearAllNetCodes();
753 
754  bool editModules = m_editModules || frame()->IsType( FRAME_PCB_MODULE_EDITOR );
755 
756  // The clipboard can contain two different things, an entire kicad_pcb
757  // or a single module
758 
759  if( editModules && ( !board() || !module() ) )
760  {
761  wxLogDebug( wxT( "Attempting to paste to empty module editor window\n") );
762  return 0;
763  }
764 
765 
766  switch( clipItem->Type() )
767  {
768  case PCB_T:
769  {
770  if( editModules )
771  {
772  wxLogDebug( wxT( "attempting to paste a pcb in the footprint editor\n") );
773  return 0;
774  }
775 
776  placeBoardItems( static_cast<BOARD*>( clipItem ) );
777  break;
778  }
779 
780  case PCB_MODULE_T:
781  {
782  std::vector<BOARD_ITEM *> items;
783 
784  clipItem->SetParent( board() );
785 
786  if( editModules )
787  {
788  auto mod = static_cast<MODULE *>( clipItem );
789 
790  for( auto pad : mod->Pads() )
791  {
792  pad->SetParent ( board()->m_Modules.GetFirst() );
793  items.push_back( pad );
794  }
795  for( auto item : mod->GraphicalItems() )
796  {
797  item->SetParent ( board()->m_Modules.GetFirst() );
798  items.push_back( item );
799  }
800  }
801  else
802  {
803  items.push_back( clipItem );
804  }
805 
806  placeBoardItems( items );
807  break;
808  }
809  default:
810  m_frame->DisplayToolMsg( _( "Invalid clipboard contents" ) );
811  // FAILED
812  break;
813  }
814  return 1;
815 }
816 
818 {
819  int open_ctl;
820  wxString fileName;
821 
822  PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
823 
824  if( !editFrame )
825  return 1;
826 
827  // Pick a file to append
828  if( !AskLoadBoardFileName( editFrame, &open_ctl, &fileName, true ) )
829  return 1;
830 
831  IO_MGR::PCB_FILE_T pluginType = plugin_type( fileName, open_ctl );
832  PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) );
833 
834  return AppendBoard( *pi, fileName );
835 }
836 
838 {
839  std::vector<BOARD_ITEM*> items;
840 
841  for( auto track : aBoard->Tracks() )
842  {
843  items.push_back( track );
844  }
845 
846  for( auto module : aBoard->Modules() )
847  {
848  items.push_back( module );
849  }
850 
851  for( auto drawing : aBoard->Drawings() )
852  {
853  items.push_back( drawing );
854  }
855 
856  for( auto zone : aBoard->Zones() )
857  {
858  items.push_back( zone );
859  }
860 
861  return placeBoardItems( items );
862 }
863 
864 
865 int PCBNEW_CONTROL::placeBoardItems( std::vector<BOARD_ITEM*>& aItems )
866 {
868 
869  auto selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
870  auto editTool = m_toolMgr->GetTool<EDIT_TOOL>();
871 
872  SELECTION& selection = selectionTool->GetSelection();
873 
874  for( auto item : aItems )
875  {
876  item->SetSelected();
877  selection.Add( item );
878  editTool->GetCurrentCommit()->Add( item );
879  }
880 
881  selection.SetReferencePoint( VECTOR2I( 0, 0 ) );
882 
885 
886  return 0;
887 }
888 
889 int PCBNEW_CONTROL::AppendBoard( PLUGIN& pi, wxString& fileName )
890 {
891  PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
892  if( !editFrame )
893  return 1;
894 
895  // Mark existing tracks, in order to know what are the new tracks
896  // Tracks are inserted, not appended, so mark existing tracks to be
897  // able to select the new tracks only later
898  BOARD* brd = board();
899  if( !brd )
900  return 1;
901 
902  for( auto track : brd->Tracks() )
903  track->SetFlags( FLAG0 );
904 
905  // Keep also the count of copper layers, to adjust if necessary
906  int initialCopperLayerCount = brd->GetCopperLayerCount();
907  LSET initialEnabledLayers = brd->GetEnabledLayers();
908 
909  // Load the data
910  try
911  {
912  PROPERTIES props;
913  char xbuf[30];
914  char ybuf[30];
915 
916  // EAGLE_PLUGIN can use this info to center the BOARD, but it does not yet.
917  sprintf( xbuf, "%d", editFrame->GetPageSizeIU().x );
918  sprintf( ybuf, "%d", editFrame->GetPageSizeIU().y );
919 
920  props["page_width"] = xbuf;
921  props["page_height"] = ybuf;
922 
923  editFrame->GetDesignSettings().m_NetClasses.Clear();
924  pi.Load( fileName, brd, &props );
925  }
926  catch( const IO_ERROR& ioe )
927  {
928  wxString msg = wxString::Format( _( "Error loading board.\n%s" ), GetChars( ioe.What() ));
929  DisplayError( editFrame, msg );
930 
931  return 0;
932  }
933 
934  // rebuild nets and ratsnest before any use of nets
935  brd->BuildListOfNets();
937 
938 
939  // Synchronize layers
940  // we should not ask PLUGINs to do these items:
941  int copperLayerCount = brd->GetCopperLayerCount();
942 
943  if( copperLayerCount > initialCopperLayerCount )
944  brd->SetCopperLayerCount( copperLayerCount );
945 
946  // Enable all used layers, and make them visible:
947  LSET enabledLayers = brd->GetEnabledLayers();
948  enabledLayers |= initialEnabledLayers;
949  brd->SetEnabledLayers( enabledLayers );
950  brd->SetVisibleLayers( enabledLayers );
951 
952 
953  return placeBoardItems( brd );
954 }
955 
956 
958 {
960 
961  return 0;
962 }
963 
964 
966 {
967  DisplayInfoMessage( m_frame, _( "Not available in OpenGL/Cairo canvases." ) );
968 
969  return 0;
970 }
971 
972 
974 {
975  // Display modes
985 
986  // Layer control
1000 
1001  // Cursor control
1012 
1013  // Pan control
1018 
1019  // Grid control
1024 
1025  // Miscellaneous
1032 
1033  // Append control
1035  PCB_ACTIONS::appendBoard.MakeEvent() );
1036 
1038  PCB_ACTIONS::pasteFromClipboard.MakeEvent() );
1039 }
1040 
1041 
1043 {
1044  BASE_SCREEN* screen = m_frame->GetScreen();
1045  //GRID_TYPE grid = screen->GetGrid( idx );
1046  getView()->GetGAL()->SetGridSize( VECTOR2D( screen->GetGridSize() ) );
1048 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
static TOOL_ACTION layerBottom
Definition: pcb_actions.h:260
BOARD_ITEM * Parse()
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
void BuildListOfNets()
Definition: class_board.h:722
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:106
KIGFX::VIEW * view() const
Definition: pcb_tool.h:123
void SetSnapping(bool aEnable)
Function SetSnapping() Sets cursor snapping to grid for the period when the tool is active...
Definition: picker_tool.h:53
int SwitchCursor(const TOOL_EVENT &aEvent)
int PanControl(const TOOL_EVENT &aEvent)
int PadDisplayMode(const TOOL_EVENT &aEvent)
static TOOL_ACTION cursorUpFast
Definition: pcb_actions.h:339
virtual void SetHighContrastLayer(int aLayer)
Function SetHighContrastLayer Takes care of display settings for the given layer to be displayed in h...
static TOOL_ACTION move
move an item
Definition: pcb_actions.h:90
static TOOL_ACTION layerNext
Definition: pcb_actions.h:261
Definition: typeinfo.h:97
int HighContrastInc(const TOOL_EVENT &aEvent)
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.
static TOOL_ACTION layerInner2
Definition: pcb_actions.h:255
void SetGridOrigin(const wxPoint &aPoint)
Function SetGridOrigin sets the origin point of the grid.
Definition: class_board.h:349
static TOOL_ACTION cursorDblClick
Definition: pcb_actions.h:345
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for render...
Definition: draw_frame.h:891
static TOOL_ACTION layerInner5
Definition: pcb_actions.h:258
void SetGridOrigin(const wxPoint &aPoint) override
Model changes (required full reload)
Definition: tool_base.h:83
This file is part of the common library.
static TOOL_ACTION layerInner6
Definition: pcb_actions.h:259
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
void SetClickHandler(CLICK_HANDLER aHandler)
Function SetClickHandler() Sets a handler for mouse click event.
Definition: picker_tool.h:94
static TOOL_ACTION showHelp
Definition: pcb_actions.h:371
bool IsMirroredX() const
Function IsMirroredX() Returns true if view is flipped across the X axis.
Definition: view.h:227
VIEW_CONTROLS class definition.
static TOOL_ACTION layerAlphaDec
Definition: pcb_actions.h:264
static TOOL_ACTION gridResetOrigin
Definition: actions.h:66
int LayerAlphaInc(const TOOL_EVENT &aEvent)
static TOOL_ACTION zoneDisplayOutlines
Definition: pcb_actions.h:247
Class SELECTION_TOOL.
wxWindow * GetEditFrame() const
Definition: tool_manager.h:267
TOOL_ACTIONS
Definition: tool_event.h:55
Class BOARD to handle a board.
void SetFastGrid2()
Function SetFastGrid2()
EDA_ITEM * Front() const
Definition: selection.h:144
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
static TOOL_ACTION layerAlphaInc
Definition: pcb_actions.h:263
int GetCopperLayerCount() const
Function GetCopperLayerCount.
void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:342
static TOOL_ACTION zoneDisplayDisable
Definition: pcb_actions.h:246
DLIST_ITERATOR_WRAPPER< D_PAD > Pads()
Definition: class_module.h:140
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:146
int HighContrastMode(const TOOL_EVENT &aEvent)
EDA_HOTKEY_CONFIG * GetHotkeyConfig() const
Function GetHotkeyConfig() Returns a structure containing currently used hotkey mapping.
Definition: draw_frame.h:383
void SetCopperLayerCount(int aCount)
static bool setOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, KIGFX::ORIGIN_VIEWITEM *aItem, const VECTOR2D &aPoint)
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
int LayerPrev(const TOOL_EVENT &aEvent)
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
static TOOL_ACTION gridFast1
Definition: actions.h:61
Classes to handle copper zones.
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
int GridSetOrigin(const TOOL_EVENT &aEvent)
static TOOL_ACTION cursorUp
Cursor control with keyboard.
Definition: pcb_actions.h:334
VECTOR2I GetGrid() const
Definition: grid_helper.cpp:83
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
static TOOL_ACTION pasteFromClipboard
Paste from clipboard.
Definition: pcb_actions.h:301
void SetGridOrigin(const VECTOR2D &aGridOrigin)
Set the origin point for the grid.
Class PROPERTIES is a name/value tuple with unique names and optional values.
Definition: properties.h:34
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590
Class PCB_PAINTER Contains methods for drawing PCB-specific items.
Definition: pcb_painter.h:176
static TOOL_ACTION switchUnits
Definition: pcb_actions.h:364
void setTransitions() override
Sets up handlers for various events.
static TOOL_ACTION layerInner3
Definition: pcb_actions.h:256
LSET GetEnabledLayers() const
Function GetEnabledLayers is a proxy function that calls the corresponding function in m_BoardSetting...
void SetMousePosition(const VECTOR2D &aP)
Definition: tool_event.h:400
int LayerNext(const TOOL_EVENT &aEvent)
static TOOL_ACTION deleteItemCursor
Definition: pcb_actions.h:365
wxPoint m_O_Curseur
Relative Screen cursor coordinate (on grid) in user units.
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
static TOOL_ACTION resetCoords
Definition: pcb_actions.h:361
Functions relatives to tracks, vias and segments used to fill zones.
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:107
void * GetDisplayOptions() override
Function GetDisplayOptions returns the display options current in use Display options are relative to...
Pcbnew hotkeys.
EDA_DRAW_FRAME::OnSelectGrid ID_TB_OPTIONS_SELECT_UNIT_INCH
Definition: draw_frame.cpp:124
Auxiliary rendering target (noncached)
Definition: definitions.h:42
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:71
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
static TOOL_ACTION layerTop
Definition: pcb_actions.h:253
Generic tool for picking a point.
Definition: picker_tool.h:34
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Moves cursor to the requested position expressed in world coordinates.
void SetFastGrid1()
Function SetFastGrid1()
Class RELEASER releases a PLUGIN in the context of a potential thrown exception, through its destruct...
Definition: io_mgr.h:474
Class TOOL_MANAGER.
Definition: tool_manager.h:49
void SynchronizeNetsAndNetClasses()
Function SynchronizeNetsAndNetClasses copies NETCLASS info to each NET, based on NET membership in a ...
static TOOL_ACTION highContrastMode
Definition: pcb_actions.h:248
class MODULE, a footprint
Definition: typeinfo.h:101
void DisplayHotkeyList(EDA_BASE_FRAME *aFrame, struct EDA_HOTKEY_CONFIG *aDescList)
Function DisplayHotkeyList Displays the current hotkey list.
bool m_DisplayPcbTrackFill
Definition: pcbstruct.h:71
static TOOL_ACTION appendBoard
Definition: pcb_actions.h:370
PCB_LAYER_ID
A quick note on layer IDs:
double a
Alpha component.
Definition: color4d.h:289
static TOOL_ACTION gridFast2
Definition: actions.h:62
Class LSET is a set of PCB_LAYER_IDs.
static TOOL_ACTION cursorRightFast
Definition: pcb_actions.h:342
static bool deleteItem(TOOL_MANAGER *aToolMgr, const VECTOR2D &aPosition)
static TOOL_ACTION layerPrev
Definition: pcb_actions.h:262
static TOOL_ACTION toBeDone
Definition: pcb_actions.h:373
DLIST_ITERATOR_WRAPPER< MODULE > Modules()
Definition: class_board.h:250
VECTOR2< double > VECTOR2D
Definition: vector2d.h:589
int GridResetOrigin(const TOOL_EVENT &aEvent)
virtual PCB_RENDER_SETTINGS * GetSettings() override
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
Definition: pcb_painter.h:188
GAL * GetGAL() const
Function GetGAL() Returns the GAL this view is using to draw graphical primitives.
Definition: view.h:177
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:568
void SetPosition(const VECTOR2D &aPosition)
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:227
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
static TOOL_ACTION panRight
Definition: pcb_actions.h:351
void SetVisibleLayers(LSET aLayerMask)
Function SetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: common.h:145
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:125
Class TOOL_EVENT.
Definition: tool_event.h:162
static TOOL_ACTION cursorClick
Definition: pcb_actions.h:344
bool m_ContrastModeDisplay
Definition: pcbstruct.h:85
SELECTION & GetSelection()
Function GetSelection()
int LayerToggle(const TOOL_EVENT &aEvent)
PCB_LAYER_ID m_Route_Layer_BOTTOM
static TOOL_ACTION panUp
Definition: pcb_actions.h:348
MODULE * module() const
Definition: pcb_tool.h:127
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
int m_DisplayZonesMode
Definition: pcbstruct.h:77
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString aExtraInfo)
Function DisplayInfoMessage displays an informational message box with aMessage.
Definition: confirm.cpp:102
int ZoneDisplayMode(const TOOL_EVENT &aEvent)
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:1011
int GridFast1(const TOOL_EVENT &aEvent)
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:196
All active tools
Definition: tool_event.h:138
static TOOL_ACTION cursorRight
Definition: pcb_actions.h:337
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:1385
Class EDIT_TOOL.
Definition: edit_tool.h:45
int placeBoardItems(BOARD *aBoard)
void SetGridSize(const VECTOR2D &aGridSize)
Set the grid size.
#define FLAG0
Pcbnew: flag used in local computations.
Definition: base_struct.h:145
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_gridOrigin
Grid origin marker.
int AppendBoardFromFile(const TOOL_EVENT &aEvent)
static TOOL_ACTION selectionTool
Definition: pcb_actions.h:359
void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
static const TOOL_EVENT SelectedEvent
Event sent after an item is selected.
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
static TOOL_ACTION panLeft
Definition: pcb_actions.h:350
bool m_editModules
Definition: pcb_tool.h:129
Class DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
Definition: pcbstruct.h:62
virtual void SwitchLayer(wxDC *DC, PCB_LAYER_ID layer)
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
void Reset(RESET_REASON aReason) override
Function Reset() Brings the tool to a known, initial state.
int ResetCoords(const TOOL_EVENT &aEvent)
static TOOL_ACTION padDisplayMode
Definition: pcb_actions.h:243
bool AskLoadBoardFileName(wxWindow *aParent, int *aCtl, wxString *aFileName, bool aKicadFilesOnly=false)
Function AskLoadBoardFileName puts up a wxFileDialog asking for a BOARD filename to open...
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
static TOOL_ACTION viaDisplayMode
Definition: pcb_actions.h:244
void UpdateLayerColor(int aLayer)
Function UpdateLayerColor() Applies the new coloring scheme held by RENDER_SETTINGS in case that it h...
Definition: view.cpp:657
int ShowHelp(const TOOL_EVENT &aEvent)
bool m_DisplayPadFill
Definition: pcbstruct.h:65
static TOOL_ACTION cursorLeft
Definition: pcb_actions.h:336
virtual void UpdateStatusBar() override
Function UpdateStatusBar updates the status bar information.
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
int LayerAlphaDec(const TOOL_EVENT &aEvent)
static TOOL_ACTION layerChanged
Definition: pcb_actions.h:267
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:373
Class PCB_ACTIONS.
Definition: pcb_actions.h:42
static TOOL_ACTION highContrastInc
Definition: pcb_actions.h:249
ZONE_CONTAINERS & Zones()
Definition: class_board.h:252
void DisplayToolMsg(const wxString &msg)
Definition: draw_frame.cpp:508
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void Clear()
Function Clear destroys any contained NETCLASS instances except the Default one.
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
static TOOL_ACTION switchCursor
Definition: pcb_actions.h:363
IO_MGR::PCB_FILE_T plugin_type(const wxString &aFileName, int aCtl)
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
static PLUGIN * PluginFind(PCB_FILE_T aFileType)
Function PluginFind returns a PLUGIN which the caller can use to import, export, save, or load design documents.
Definition: io_mgr.cpp:58
int ViaDisplayMode(const TOOL_EVENT &aEvent)
Class PLUGIN is a base class that BOARD loading and saving plugins should derive from.
Definition: io_mgr.h:193
Class TOOL_ACTION.
Definition: tool_action.h:46
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
int TrackDisplayMode(const TOOL_EVENT &aEvent)
PCB_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:80
int SwitchUnits(const TOOL_EVENT &aEvent)
const wxSize GetPageSizeIU() const override
Function GetPageSizeIU works off of GetPageSettings() to return the size of the paper page in the int...
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
void Activate()
Function Activate() Runs the tool.
int DeleteItemCursor(const TOOL_EVENT &aEvent)
int CursorControl(const TOOL_EVENT &aEvent)
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:870
static TOOL_ACTION layerInner4
Definition: pcb_actions.h:257
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:108
int GridFast2(const TOOL_EVENT &aEvent)
DLIST_ITERATOR_WRAPPER< TRACK > Tracks()
Definition: class_board.h:249
static TOOL_ACTION cursorDown
Definition: pcb_actions.h:335
void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:312
bool IsType(FRAME_T aType) const
Definition: wxstruct.h:229
Module description (excepted pads)
static TOOL_ACTION gridSetOrigin
Definition: actions.h:65
Class VIEW.
Definition: view.h:58
static TOOL_ACTION remove
Deleting a BOARD_ITEM.
Definition: pcb_actions.h:123
static TOOL_ACTION cursorLeftFast
Definition: pcb_actions.h:341
bool SanitizeSelection()
Makes sure a group selection does not contain items that would cause conflicts when moving/rotating t...
int ToBeDone(const TOOL_EVENT &aEvent)
int LayerSwitch(const TOOL_EVENT &aEvent)
void updateGrid()
Applies the legacy canvas grid settings for GAL.
PCB_FILE_T
Enum PCB_FILE_T is a set of file types that the IO_MGR knows about, and for which there has been a pl...
Definition: io_mgr.h:51
bool m_DisplayViaFill
Definition: pcbstruct.h:66
static TOOL_ACTION layerInner1
Definition: pcb_actions.h:254
int AppendBoard(PLUGIN &pi, wxString &fileName)
Rendering engine changes.
Definition: tool_base.h:84
static TOOL_ACTION panDown
Definition: pcb_actions.h:349
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:71
int PasteItemsFromClipboard(const TOOL_EVENT &aEvent)
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:129
static TOOL_ACTION highContrastDec
Definition: pcb_actions.h:250
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:774
bool m_fullscreenCursor
Fullscreen crosshair or small cross
void SetEnabledLayers(LSET aLayerMask)
Function SetEnabledLayers is a proxy function that calls the correspondent function in m_BoardSetting...
#define mod(a, n)
Definition: greymap.cpp:24
bool ProcessEvent(wxEvent &aEvent) override
Function ProcessEvent overrides the default process event handler to implement the auto save feature...
Definition: basicframe.cpp:185
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
static TOOL_ACTION selectionCursor
Select a single item under the cursor position.
Definition: pcb_actions.h:50
void MarkDirty()
Function MarkDirty() Forces redraw of view on the next rendering.
Definition: view.h:594
static TOOL_ACTION trackDisplayMode
Definition: pcb_actions.h:242
PCB_LAYER_ID m_Route_Layer_TOP
DLIST_ITERATOR_WRAPPER< BOARD_ITEM > Drawings()
Definition: class_board.h:251
NETCLASSES m_NetClasses
List of current netclasses. There is always the default netclass.
Color has changed.
Definition: view_item.h:57
virtual BOARD * Load(const wxString &aFileName, BOARD *aAppendToMe, const PROPERTIES *aProperties=NULL)
Function Load loads information from some input file format that this PLUGIN implementation knows abo...
Definition: plugin.cpp:47
static TOOL_ACTION layerToggle
Definition: pcb_actions.h:265
BOARD * board() const
Definition: pcb_tool.h:126
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
static TOOL_ACTION zoneDisplayEnable
Definition: pcb_actions.h:245
int HighContrastDec(const TOOL_EVENT &aEvent)
static TOOL_ACTION cursorDownFast
Definition: pcb_actions.h:340