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 "picker_tool.h"
31 #include "grid_helper.h"
32 
33 #include <class_board.h>
34 #include <class_module.h>
35 #include <class_track.h>
36 #include <class_zone.h>
37 #include <class_pcb_screen.h>
38 
39 #include <confirm.h>
40 #include <hotkeys.h>
41 #include <properties.h>
42 #include <io_mgr.h>
43 
44 #include <pcbnew_id.h>
45 #include <wxPcbStruct.h>
46 #include <pcb_draw_panel_gal.h>
47 #include <ratsnest_data.h>
48 #include <tool/tool_manager.h>
50 #include <view/view_controls.h>
51 #include <pcb_painter.h>
52 #include <origin_viewitem.h>
53 #include <board_commit.h>
54 
55 #include <functional>
56 using namespace std::placeholders;
57 
58 
59 // files.cpp
60 extern bool AskLoadBoardFileName( wxWindow* aParent, int* aCtl, wxString* aFileName,
61  bool aKicadFilesOnly = false );
62 extern IO_MGR::PCB_FILE_T plugin_type( const wxString& aFileName, int aCtl );
63 
64 
65 // Display modes
66 TOOL_ACTION PCB_ACTIONS::trackDisplayMode( "pcbnew.Control.trackDisplayMode",
68  "", "" );
69 
70 TOOL_ACTION PCB_ACTIONS::padDisplayMode( "pcbnew.Control.padDisplayMode",
71  AS_GLOBAL, 0,
72  "", "" );
73 
74 TOOL_ACTION PCB_ACTIONS::viaDisplayMode( "pcbnew.Control.viaDisplayMode",
75  AS_GLOBAL, 0,
76  "", "" );
77 
78 TOOL_ACTION PCB_ACTIONS::zoneDisplayEnable( "pcbnew.Control.zoneDisplayEnable",
79  AS_GLOBAL, 0,
80  "", "" );
81 
82 TOOL_ACTION PCB_ACTIONS::zoneDisplayDisable( "pcbnew.Control.zoneDisplayDisable",
83  AS_GLOBAL, 0,
84  "", "" );
85 
86 TOOL_ACTION PCB_ACTIONS::zoneDisplayOutlines( "pcbnew.Control.zoneDisplayOutlines",
87  AS_GLOBAL, 0,
88  "", "" );
89 
90 TOOL_ACTION PCB_ACTIONS::highContrastMode( "pcbnew.Control.highContrastMode",
92  "", "" );
93 
94 TOOL_ACTION PCB_ACTIONS::highContrastInc( "pcbnew.Control.highContrastInc",
95  AS_GLOBAL, '>',
96  "", "" );
97 
98 TOOL_ACTION PCB_ACTIONS::highContrastDec( "pcbnew.Control.highContrastDec",
99  AS_GLOBAL, '<',
100  "", "" );
101 
102 
103 // Layer control
104 TOOL_ACTION PCB_ACTIONS::layerTop( "pcbnew.Control.layerTop",
106  "", "", NULL, AF_NONE, (void*) F_Cu );
107 
108 TOOL_ACTION PCB_ACTIONS::layerInner1( "pcbnew.Control.layerInner1",
110  "", "", NULL, AF_NONE, (void*) In1_Cu );
111 
112 TOOL_ACTION PCB_ACTIONS::layerInner2( "pcbnew.Control.layerInner2",
114  "", "", NULL, AF_NONE, (void*) In2_Cu );
115 
116 TOOL_ACTION PCB_ACTIONS::layerInner3( "pcbnew.Control.layerInner3",
118  "", "", NULL, AF_NONE, (void*) In3_Cu );
119 
120 TOOL_ACTION PCB_ACTIONS::layerInner4( "pcbnew.Control.layerInner4",
122  "", "", NULL, AF_NONE, (void*) In4_Cu );
123 
124 TOOL_ACTION PCB_ACTIONS::layerInner5( "pcbnew.Control.layerInner5",
126  "", "", NULL, AF_NONE, (void*) In5_Cu );
127 
128 TOOL_ACTION PCB_ACTIONS::layerInner6( "pcbnew.Control.layerInner6",
130  "", "", NULL, AF_NONE, (void*) In6_Cu );
131 
132 TOOL_ACTION PCB_ACTIONS::layerBottom( "pcbnew.Control.layerBottom",
134  "", "", NULL, AF_NONE, (void*) B_Cu );
135 
136 TOOL_ACTION PCB_ACTIONS::layerNext( "pcbnew.Control.layerNext",
138  "", "" );
139 
140 TOOL_ACTION PCB_ACTIONS::layerPrev( "pcbnew.Control.layerPrev",
142  "", "" );
143 
144 TOOL_ACTION PCB_ACTIONS::layerToggle( "pcbnew.Control.layerToggle",
146  "", "" );
147 
148 TOOL_ACTION PCB_ACTIONS::layerAlphaInc( "pcbnew.Control.layerAlphaInc",
149  AS_GLOBAL, '}',
150  "", "" );
151 
152 TOOL_ACTION PCB_ACTIONS::layerAlphaDec( "pcbnew.Control.layerAlphaDec",
153  AS_GLOBAL, '{',
154  "", "" );
155 
156 TOOL_ACTION PCB_ACTIONS::layerChanged( "pcbnew.Control.layerChanged",
157  AS_GLOBAL, 0,
158  "", "", NULL, AF_NOTIFY );
159 
160 // Cursor control
161 TOOL_ACTION PCB_ACTIONS::cursorUp( "pcbnew.Control.cursorUp",
162  AS_GLOBAL, WXK_UP, "", "", NULL, AF_NONE, (void*) CURSOR_UP );
163 TOOL_ACTION PCB_ACTIONS::cursorDown( "pcbnew.Control.cursorDown",
164  AS_GLOBAL, WXK_DOWN, "", "" , NULL, AF_NONE, (void*) CURSOR_DOWN );
165 TOOL_ACTION PCB_ACTIONS::cursorLeft( "pcbnew.Control.cursorLeft",
166  AS_GLOBAL, WXK_LEFT, "", "" , NULL, AF_NONE, (void*) CURSOR_LEFT );
167 TOOL_ACTION PCB_ACTIONS::cursorRight( "pcbnew.Control.cursorRight",
168  AS_GLOBAL, WXK_RIGHT, "", "" , NULL, AF_NONE, (void*) CURSOR_RIGHT );
169 
170 TOOL_ACTION PCB_ACTIONS::cursorUpFast( "pcbnew.Control.cursorUpFast",
171  AS_GLOBAL, MD_CTRL + WXK_UP, "", "", NULL, AF_NONE, (void*) ( CURSOR_UP | CURSOR_FAST_MOVE ) );
172 TOOL_ACTION PCB_ACTIONS::cursorDownFast( "pcbnew.Control.cursorDownFast",
173  AS_GLOBAL, MD_CTRL + WXK_DOWN, "", "" , NULL, AF_NONE, (void*) ( CURSOR_DOWN | CURSOR_FAST_MOVE ) );
174 TOOL_ACTION PCB_ACTIONS::cursorLeftFast( "pcbnew.Control.cursorLeftFast",
175  AS_GLOBAL, MD_CTRL + WXK_LEFT, "", "" , NULL, AF_NONE, (void*) ( CURSOR_LEFT | CURSOR_FAST_MOVE ) );
176 TOOL_ACTION PCB_ACTIONS::cursorRightFast( "pcbnew.Control.cursorRightFast",
177  AS_GLOBAL, MD_CTRL + WXK_RIGHT, "", "" , NULL, AF_NONE, (void*) ( CURSOR_RIGHT | CURSOR_FAST_MOVE ) );
178 
179 TOOL_ACTION PCB_ACTIONS::cursorClick( "pcbnew.Control.cursorClick",
181  "", "", NULL, AF_NONE, (void*) CURSOR_CLICK );
182 TOOL_ACTION PCB_ACTIONS::cursorDblClick( "pcbnew.Control.cursorDblClick",
184  "", "", NULL, AF_NONE, (void*) CURSOR_DBL_CLICK );
185 
186 TOOL_ACTION PCB_ACTIONS::panUp( "pcbnew.Control.panUp",
187  AS_GLOBAL, MD_SHIFT + WXK_UP, "", "", NULL, AF_NONE, (void*) CURSOR_UP );
188 TOOL_ACTION PCB_ACTIONS::panDown( "pcbnew.Control.panDown",
189  AS_GLOBAL, MD_SHIFT + WXK_DOWN, "", "" , NULL, AF_NONE, (void*) CURSOR_DOWN );
190 TOOL_ACTION PCB_ACTIONS::panLeft( "pcbnew.Control.panLeft",
191  AS_GLOBAL, MD_SHIFT + WXK_LEFT, "", "" , NULL, AF_NONE, (void*) CURSOR_LEFT );
192 TOOL_ACTION PCB_ACTIONS::panRight( "pcbnew.Control.panRight",
193  AS_GLOBAL, MD_SHIFT + WXK_RIGHT, "", "" , NULL, AF_NONE, (void*) CURSOR_RIGHT );
194 
195 // Miscellaneous
196 TOOL_ACTION PCB_ACTIONS::selectionTool( "pcbnew.Control.selectionTool",
197  AS_GLOBAL, 0,
198  "", "", NULL, AF_ACTIVATE );
199 
200 TOOL_ACTION PCB_ACTIONS::zoomTool( "pcbnew.Control.zoomTool",
202  _( "Zoom to Selection" ), "", NULL, AF_ACTIVATE );
203 
204 TOOL_ACTION PCB_ACTIONS::resetCoords( "pcbnew.Control.resetCoords",
205  AS_GLOBAL, ' ',
206  "", "" );
207 
208 TOOL_ACTION PCB_ACTIONS::switchCursor( "pcbnew.Control.switchCursor",
209  AS_GLOBAL, 0,
210  "", "" );
211 
212 TOOL_ACTION PCB_ACTIONS::switchUnits( "pcbnew.Control.switchUnits",
214  "", "" );
215 
216 TOOL_ACTION PCB_ACTIONS::deleteItemCursor( "pcbnew.Control.deleteItemCursor",
217  AS_GLOBAL, 0,
218  "", "" );
219 
220 TOOL_ACTION PCB_ACTIONS::showHelp( "pcbnew.Control.showHelp",
222  "", "" );
223 
224 TOOL_ACTION PCB_ACTIONS::toBeDone( "pcbnew.Control.toBeDone",
225  AS_GLOBAL, 0, // dialog saying it is not implemented yet
226  "", "" ); // so users are aware of that
227 
228 
230  TOOL_INTERACTIVE( "pcbnew.Control" ), m_frame( NULL )
231 {
232  m_gridOrigin.reset( new KIGFX::ORIGIN_VIEWITEM() );
233 }
234 
235 
237 {
238 }
239 
240 
242 {
243  m_frame = getEditFrame<PCB_BASE_FRAME>();
244 
245  if( aReason == MODEL_RELOAD || aReason == GAL_SWITCH )
246  {
247  m_gridOrigin->SetPosition( getModel<BOARD>()->GetGridOrigin() );
248  getView()->Remove( m_gridOrigin.get() );
249  getView()->Add( m_gridOrigin.get() );
250  }
251 }
252 
253 
255 {
256  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
257  auto settings = painter->GetSettings();
258 
259  // Apply new display options to the GAL canvas
261  displ_opts->m_DisplayPcbTrackFill = !displ_opts->m_DisplayPcbTrackFill;
262  settings->LoadDisplayOptions( displ_opts );
263 
264  for( TRACK* track = getModel<BOARD>()->m_Track; track; track = track->Next() )
265  {
266  if( track->Type() == PCB_TRACE_T )
267  getView()->Update( track, KIGFX::GEOMETRY );
268  }
269 
271 
272  return 0;
273 }
274 
275 
277 {
278  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
279  auto settings = painter->GetSettings();
280 
282 
283  // Apply new display options to the GAL canvas
284  displ_opts->m_DisplayPadFill = !displ_opts->m_DisplayPadFill;
285  settings->LoadDisplayOptions( displ_opts );
286 
287  for( MODULE* module = getModel<BOARD>()->m_Modules; module; module = module->Next() )
288  {
289  for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() )
290  getView()->Update( pad, KIGFX::GEOMETRY );
291  }
292 
294 
295  return 0;
296 }
297 
298 
300 {
301  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
302  auto settings = painter->GetSettings();
304 
305  // Apply new display options to the GAL canvas
306  displ_opts->m_DisplayViaFill = !displ_opts->m_DisplayViaFill;
307  settings->LoadDisplayOptions( displ_opts );
308 
309  for( TRACK* track = getModel<BOARD>()->m_Track; track; track = track->Next() )
310  {
311  if( track->Type() == PCB_TRACE_T || track->Type() == PCB_VIA_T )
312  getView()->Update( track, KIGFX::GEOMETRY );
313  }
314 
316 
317  return 0;
318 }
319 
320 
322 {
323  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
324  auto settings = painter->GetSettings();
326 
327  // Apply new display options to the GAL canvas
329  displ_opts->m_DisplayZonesMode = 0;
330  else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayDisable ) )
331  displ_opts->m_DisplayZonesMode = 1;
332  else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayOutlines ) )
333  displ_opts->m_DisplayZonesMode = 2;
334  else
335  assert( false );
336 
337  settings->LoadDisplayOptions( displ_opts );
338 
339  BOARD* board = getModel<BOARD>();
340  for( int i = 0; i < board->GetAreaCount(); ++i )
341  getView()->Update( board->GetArea( i ), KIGFX::GEOMETRY );
342 
344 
345  return 0;
346 }
347 
348 
350 {
351  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
352  auto settings = painter->GetSettings();
354 
355  displ_opts->m_ContrastModeDisplay = !displ_opts->m_ContrastModeDisplay;
356  settings->LoadDisplayOptions( displ_opts );
358 
359  return 0;
360 }
361 
362 
364 {
365  return 0;
366 }
367 
368 
370 {
371  return 0;
372 }
373 
374 
375 // Layer control
377 {
378  m_frame->SwitchLayer( NULL, (PCB_LAYER_ID) aEvent.Parameter<intptr_t>() );
379 
380  return 0;
381 }
382 
383 
385 {
386  PCB_BASE_FRAME* editFrame = m_frame;
387  LAYER_NUM layer = editFrame->GetActiveLayer();
388 
389  if( layer < F_Cu || layer > B_Cu )
390  return 0;
391 
392  int layerCount = getModel<BOARD>()->GetCopperLayerCount();
393 
394  if( layer == layerCount - 2 || layerCount < 2 )
395  layer = B_Cu;
396  else if( layer == B_Cu )
397  layer = F_Cu;
398  else
399  ++layer;
400 
401  assert( IsCopperLayer( layer ) );
402  editFrame->SwitchLayer( NULL, ToLAYER_ID( layer ) );
403 
404  return 0;
405 }
406 
407 
409 {
410  PCB_BASE_FRAME* editFrame = m_frame;
411  LAYER_NUM layer = editFrame->GetActiveLayer();
412 
413  if( layer < F_Cu || layer > B_Cu )
414  return 0;
415 
416  int layerCount = getModel<BOARD>()->GetCopperLayerCount();
417 
418  if( layer == F_Cu || layerCount < 2 )
419  layer = B_Cu;
420  else if( layer == B_Cu )
421  layer = layerCount - 2;
422  else
423  --layer;
424 
425  assert( IsCopperLayer( layer ) );
426  editFrame->SwitchLayer( NULL, ToLAYER_ID( layer ) );
427 
428  return 0;
429 }
430 
431 
433 {
434  LAYER_NUM currentLayer = m_frame->GetActiveLayer();
435  PCB_SCREEN* screen = m_frame->GetScreen();
436 
437  if( currentLayer == screen->m_Route_Layer_TOP )
438  m_frame->SwitchLayer( NULL, screen->m_Route_Layer_BOTTOM );
439  else
440  m_frame->SwitchLayer( NULL, screen->m_Route_Layer_TOP );
441 
442  return 0;
443 }
444 
445 
447 {
448  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
449  auto settings = painter->GetSettings();
450 
451  LAYER_NUM currentLayer = m_frame->GetActiveLayer();
452  KIGFX::COLOR4D currentColor = settings->GetLayerColor( currentLayer );
453 
454  if( currentColor.a <= 0.95 )
455  {
456  currentColor.a += 0.05;
457  settings->SetLayerColor( currentLayer, currentColor );
458  m_frame->GetGalCanvas()->GetView()->UpdateLayerColor( currentLayer );
459  }
460 
461  return 0;
462 }
463 
464 
466 {
467  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
468  auto settings = painter->GetSettings();
469 
470  LAYER_NUM currentLayer = m_frame->GetActiveLayer();
471  KIGFX::COLOR4D currentColor = settings->GetLayerColor( currentLayer );
472 
473  if( currentColor.a >= 0.05 )
474  {
475  currentColor.a -= 0.05;
476  settings->SetLayerColor( currentLayer, currentColor );
477  m_frame->GetGalCanvas()->GetView()->UpdateLayerColor( currentLayer );
478  }
479 
480  return 0;
481 }
482 
483 
484 // Cursor control
486 {
487  long type = aEvent.Parameter<intptr_t>();
488  bool fastMove = type & PCB_ACTIONS::CURSOR_FAST_MOVE;
489  type &= ~PCB_ACTIONS::CURSOR_FAST_MOVE;
490  bool mirroredX = getView()->IsMirroredX();
491 
492  GRID_HELPER gridHelper( m_frame );
494  VECTOR2I gridSize = gridHelper.GetGrid();
495  VECTOR2D newCursor = gridHelper.Align( cursor );
496 
497  if( fastMove )
498  gridSize = gridSize * 10;
499 
500  switch( type )
501  {
503  newCursor -= VECTOR2D( 0, gridSize.y );
504  break;
505 
507  newCursor += VECTOR2D( 0, gridSize.y );
508  break;
509 
511  newCursor -= VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
512  break;
513 
515  newCursor += VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
516  break;
517 
518  case PCB_ACTIONS::CURSOR_CLICK: // fall through
520  {
521  TOOL_ACTIONS action = TA_NONE;
522  int modifiers = 0;
523 
524  modifiers |= wxGetKeyState( WXK_SHIFT ) ? MD_SHIFT : 0;
525  modifiers |= wxGetKeyState( WXK_CONTROL ) ? MD_CTRL : 0;
526  modifiers |= wxGetKeyState( WXK_ALT ) ? MD_ALT : 0;
527 
528  if( type == PCB_ACTIONS::CURSOR_CLICK )
529  action = TA_MOUSE_CLICK;
530  else if( type == PCB_ACTIONS::CURSOR_DBL_CLICK )
531  action = TA_MOUSE_DBLCLICK;
532  else
533  assert( false );
534 
535  TOOL_EVENT evt( TC_MOUSE, action, BUT_LEFT | modifiers );
536  evt.SetMousePosition( getViewControls()->GetCursorPosition() );
537  m_toolMgr->ProcessEvent( evt );
538 
539  return 0;
540  }
541  break;
542  }
543 
544  // Handler cursor movement
545  KIGFX::VIEW* view = getView();
546  newCursor = view->ToScreen( newCursor );
547  newCursor.x = KiROUND( newCursor.x );
548  newCursor.y = KiROUND( newCursor.y );
549 
550  // Pan the screen if required
551  const VECTOR2I& screenSize = view->GetGAL()->GetScreenPixelSize();
552  BOX2I screenBox( VECTOR2I( 0, 0 ), screenSize );
553 
554  if( !screenBox.Contains( newCursor ) )
555  {
556  VECTOR2D delta( 0, 0 );
557 
558  if( newCursor.x < screenBox.GetLeft() )
559  {
560  delta.x = newCursor.x - screenBox.GetLeft();
561  newCursor.x = screenBox.GetLeft();
562  }
563  else if( newCursor.x > screenBox.GetRight() )
564  {
565  delta.x = newCursor.x - screenBox.GetRight();
566  // -1 is to keep the cursor within the drawing area,
567  // so the cursor coordinates are still updated
568  newCursor.x = screenBox.GetRight() - 1;
569  }
570 
571  if( newCursor.y < screenBox.GetTop() )
572  {
573  delta.y = newCursor.y - screenBox.GetTop();
574  newCursor.y = screenBox.GetTop();
575  }
576  else if( newCursor.y > screenBox.GetBottom() )
577  {
578  delta.y = newCursor.y - screenBox.GetBottom();
579  // -1 is to keep the cursor within the drawing area,
580  // so the cursor coordinates are still updated
581  newCursor.y = screenBox.GetBottom() - 1;
582  }
583 
584  view->SetCenter( view->GetCenter() + view->ToWorld( delta, false ) );
585  }
586 
587  m_frame->GetGalCanvas()->WarpPointer( newCursor.x, newCursor.y );
588 
589  return 0;
590 }
591 
592 
594 {
595  long type = aEvent.Parameter<intptr_t>();
596  KIGFX::VIEW* view = getView();
597  GRID_HELPER gridHelper( m_frame );
598  VECTOR2D center = view->GetCenter();
599  VECTOR2I gridSize = gridHelper.GetGrid() * 10;
600  bool mirroredX = view->IsMirroredX();
601 
602  switch( type )
603  {
605  center -= VECTOR2D( 0, gridSize.y );
606  break;
607 
609  center += VECTOR2D( 0, gridSize.y );
610  break;
611 
613  center -= VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
614  break;
615 
617  center += VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
618  break;
619 
620  default:
621  assert( false );
622  break;
623  }
624 
625  view->SetCenter( center );
626 
627  return 0;
628 }
629 
630 
631 // Grid control
633 {
635  updateGrid();
636 
637  return 0;
638 }
639 
640 
642 {
644  updateGrid();
645 
646  return 0;
647 }
648 
649 
650 static bool setOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
651  KIGFX::ORIGIN_VIEWITEM* aItem, const VECTOR2D& aPoint )
652 {
653  aFrame->SetGridOrigin( wxPoint( aPoint.x, aPoint.y ) );
654  aView->GetGAL()->SetGridOrigin( aPoint );
655  aItem->SetPosition( aPoint );
656  aView->MarkDirty();
657 
658  return true;
659 }
660 
661 
663 {
664  VECTOR2D* origin = aEvent.Parameter<VECTOR2D*>();
665 
666  if( origin )
667  {
668  setOrigin( getView(), m_frame, m_gridOrigin.get(), *origin );
669  delete origin;
670  }
671  else
672  {
673  Activate();
674 
676  assert( picker );
677 
678  // TODO it will not check the toolbar button in module editor, as it uses a different ID..
679  m_frame->SetToolID( ID_PCB_PLACE_GRID_COORD_BUTT, wxCURSOR_PENCIL, _( "Adjust grid origin" ) );
680  picker->SetClickHandler( std::bind( setOrigin, getView(), m_frame, m_gridOrigin.get(), _1 ) );
681  picker->Activate();
682  Wait();
683  }
684 
685  return 0;
686 }
687 
688 
690 {
691  getModel<BOARD>()->SetGridOrigin( wxPoint( 0, 0 ) );
692  m_gridOrigin->SetPosition( VECTOR2D( 0, 0 ) );
693 
694  return 0;
695 }
696 
697 
698 // Miscellaneous
700 {
701  VECTOR2I cursorPos = getViewControls()->GetCursorPosition();
702 
703  m_frame->GetScreen()->m_O_Curseur = wxPoint( cursorPos.x, cursorPos.y );
705 
706  return 0;
707 }
708 
709 
711 {
712  auto& galOpts = m_frame->GetGalDisplayOptions();
713 
714  galOpts.m_fullscreenCursor = !galOpts.m_fullscreenCursor;
715  galOpts.NotifyChanged();
716 
717  return 0;
718 }
719 
720 
722 {
723  // TODO should not it be refactored to pcb_frame member function?
724  wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED );
725 
726  if( g_UserUnit == INCHES )
727  evt.SetId( ID_TB_OPTIONS_SELECT_UNIT_MM );
728  else
729  evt.SetId( ID_TB_OPTIONS_SELECT_UNIT_INCH );
730 
731  m_frame->ProcessEvent( evt );
732 
733  return 0;
734 }
735 
736 
737 static bool deleteItem( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition )
738 {
739  SELECTION_TOOL* selectionTool = aToolMgr->GetTool<SELECTION_TOOL>();
740  assert( selectionTool );
741 
742  aToolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
743  aToolMgr->RunAction( PCB_ACTIONS::selectionCursor, true );
744  selectionTool->SanitizeSelection();
745 
746  const SELECTION& selection = selectionTool->GetSelection();
747 
748  if( selection.Empty() )
749  return true;
750 
751  bool canBeRemoved = ( selection.Front()->Type() != PCB_MODULE_T );
752 
753  if( canBeRemoved || IsOK( aToolMgr->GetEditFrame(), _( "Are you sure you want to delete item?" ) ) )
754  aToolMgr->RunAction( PCB_ACTIONS::remove, true );
755  else
756  aToolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
757 
758  return true;
759 }
760 
761 
763 {
764  Activate();
765 
767  assert( picker );
768 
769  // TODO it will not check the toolbar button in the module editor, as it uses a different ID..
770  m_frame->SetToolID( ID_PCB_DELETE_ITEM_BUTT, wxCURSOR_PENCIL, _( "Delete item" ) );
771  picker->SetSnapping( false );
772  picker->SetClickHandler( std::bind( deleteItem, m_toolMgr, _1 ) );
773  picker->Activate();
774  Wait();
775 
776  return 0;
777 }
778 
779 
781 {
782  int open_ctl;
783  wxString fileName;
784 
785  PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
786 
787  if( !editFrame )
788  return 0;
789 
790  // Pick a file to append
791  if( !AskLoadBoardFileName( editFrame, &open_ctl, &fileName, true ) )
792  return 0;
793 
794  IO_MGR::PCB_FILE_T pluginType = plugin_type( fileName, open_ctl );
795  PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) );
796 
797  // Mark existing tracks, in order to know what are the new tracks
798  // Tracks are inserted, not appended, so mark existing tracks to be
799  // able to select the new tracks only later
800  BOARD* board = getModel<BOARD>();
801 
802  for( TRACK* track = board->m_Track; track; track = track->Next() )
803  track->SetFlags( FLAG0 );
804 
805  // Other items are appended to the item list, so keep trace to the last existing item is enough
806  MODULE* module = board->m_Modules.GetLast();
807  BOARD_ITEM* drawing = board->m_Drawings.GetLast();
808  int zonescount = board->GetAreaCount();
809 
810  // Keep also the count of copper layers, to adjust if necessary
811  int initialCopperLayerCount = board->GetCopperLayerCount();
812  LSET initialEnabledLayers = board->GetEnabledLayers();
813 
814  // Load the data
815  try
816  {
817  PROPERTIES props;
818  char xbuf[30];
819  char ybuf[30];
820 
821  // EAGLE_PLUGIN can use this info to center the BOARD, but it does not yet.
822  sprintf( xbuf, "%d", editFrame->GetPageSizeIU().x );
823  sprintf( ybuf, "%d", editFrame->GetPageSizeIU().y );
824 
825  props["page_width"] = xbuf;
826  props["page_height"] = ybuf;
827 
828  editFrame->GetDesignSettings().m_NetClasses.Clear();
829  pi->Load( fileName, board, &props );
830  }
831  catch( const IO_ERROR& ioe )
832  {
833  wxString msg = wxString::Format( _( "Error loading board.\n%s" ), GetChars( ioe.What() ));
834  DisplayError( editFrame, msg );
835 
836  return 0;
837  }
838 
839  // rebuild nets and ratsnest before any use of nets
840  board->BuildListOfNets();
842  board->GetRatsnest()->ProcessBoard();
843 
845 
846  SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
847  SELECTION& selection = selectionTool->GetSelection();
848  BOARD_COMMIT commit( editFrame );
849 
850  // Process the new items
851  for( TRACK* track = board->m_Track; track; track = track->Next() )
852  {
853  if( track->GetFlags() & FLAG0 )
854  {
855  track->ClearFlags( FLAG0 );
856  continue;
857  }
858 
859  commit.Added( track );
860  selection.Add( track );
861  }
862 
863  module = module ? module->Next() : board->m_Modules;
864 
865  for( ; module; module = module->Next() )
866  {
867  commit.Added( module );
868  selection.Add( module );
869  }
870 
871  drawing = drawing ? drawing->Next() : board->m_Drawings;
872 
873  for( ; drawing; drawing = drawing->Next() )
874  {
875  commit.Added( drawing );
876  selection.Add( drawing );
877  }
878 
879  for( ZONE_CONTAINER* zone = board->GetArea( zonescount ); zone;
880  zone = board->GetArea( zonescount ) )
881  {
882  ++zonescount;
883  commit.Added( zone );
884  selection.Add( zone );
885  }
886 
887  if( commit.Empty() )
888  return 0;
889 
890  commit.Push( _( "Append a board" ) );
891 
892  // Synchronize layers
893  // we should not ask PLUGINs to do these items:
894  int copperLayerCount = board->GetCopperLayerCount();
895 
896  if( copperLayerCount > initialCopperLayerCount )
897  board->SetCopperLayerCount( copperLayerCount );
898 
899  // Enable all used layers, and make them visible:
900  LSET enabledLayers = board->GetEnabledLayers();
901  enabledLayers |= initialEnabledLayers;
902  board->SetEnabledLayers( enabledLayers );
903  board->SetVisibleLayers( enabledLayers );
904  editFrame->ReCreateLayerBox();
905  editFrame->ReFillLayerWidget();
906  static_cast<PCB_DRAW_PANEL_GAL*>( editFrame->GetGalCanvas() )->SyncLayersVisibility( board );
907 
908  // Start dragging the appended board
909  if( selection.Size() ) // be sure at least one item is loaded
910  {
911  // Inform other potentially interested tools
913 
914  VECTOR2D v( static_cast<BOARD_ITEM*>( selection.Front() )->GetPosition() );
915  getViewControls()->WarpCursor( v, true, true );
916  m_toolMgr->InvokeTool( "pcbnew.InteractiveEdit" );
917  }
918 
919  return 0;
920 }
921 
922 
924 {
926 
927  return 0;
928 }
929 
930 
932 {
933  DisplayInfoMessage( m_frame, _( "Not available in OpenGL/Cairo canvases." ) );
934 
935  return 0;
936 }
937 
938 
940 {
941  // Display modes
951 
952  // Layer control
966 
967  // Cursor control
978 
979  // Pan control
984 
985  // Grid control
990 
991  // Miscellaneous
999 }
1000 
1001 
1003 {
1004  BASE_SCREEN* screen = m_frame->GetScreen();
1005  //GRID_TYPE grid = screen->GetGrid( idx );
1006  getView()->GetGAL()->SetGridSize( VECTOR2D( screen->GetGridSize() ) );
1008 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
static TOOL_ACTION layerBottom
Definition: pcb_actions.h:238
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
void BuildListOfNets()
Definition: class_board.h:764
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:106
const VECTOR2D & GetCenter() const
Function GetCenter() Returns the center point of this VIEW (in world space coordinates) ...
Definition: view.h:316
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:78
void SetSnapping(bool aEnable)
Function SetSnapping() Sets cursor snapping to grid for the period when the tool is active...
Definition: picker_tool.h:54
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:314
virtual void SetHighContrastLayer(int aLayer)
Function SetHighContrastLayer Takes care of display settings for the given layer to be displayed in h...
COMMIT & Added(EDA_ITEM *aItem)
Notifies observers that aItem has been added
Definition: commit.h:84
static TOOL_ACTION layerNext
Definition: pcb_actions.h:239
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:233
static TOOL_ACTION cursorDblClick
Definition: pcb_actions.h:320
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for render...
Definition: draw_frame.h:824
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
static TOOL_ACTION layerInner5
Definition: pcb_actions.h:236
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:237
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:95
COMMIT & Add(EDA_ITEM *aItem)
Adds a new item to the model
Definition: commit.h:78
static TOOL_ACTION showHelp
Definition: pcb_actions.h:347
bool IsMirroredX() const
Function IsMirroredX() Returns true if view is flipped across the X axis.
Definition: view.h:227
VECTOR2I Align(const VECTOR2I &aPoint) const
Definition: grid_helper.cpp:95
VIEW_CONTROLS class definition.
static TOOL_ACTION layerAlphaDec
Definition: pcb_actions.h:242
static TOOL_ACTION gridResetOrigin
Definition: actions.h:65
int LayerAlphaInc(const TOOL_EVENT &aEvent)
static TOOL_ACTION zoneDisplayOutlines
Definition: pcb_actions.h:225
Class SELECTION_TOOL.
wxWindow * GetEditFrame() const
Definition: tool_manager.h:258
TOOL_ACTIONS
Definition: tool_event.h:55
Class BOARD to handle a board.
void SetFastGrid2()
Function SetFastGrid2()
Class that computes missing connections on a PCB.
bool Contains(const Vec &aPoint) const
Function Contains.
Definition: box2.h:139
EDA_ITEM * Front() const
Definition: selection.h:137
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:220
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Function ToWorld() Converts a screen space point/vector to a point/vector in world space coordinates...
Definition: view.cpp:440
static TOOL_ACTION layerAlphaInc
Definition: pcb_actions.h:241
MODULE * Next() const
Definition: class_module.h:99
int GetCopperLayerCount() const
Function GetCopperLayerCount.
void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:341
static TOOL_ACTION zoneDisplayDisable
Definition: pcb_actions.h:224
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)
coord_type GetRight() const
Definition: box2.h:187
EDA_HOTKEY_CONFIG * GetHotkeyConfig() const
Function GetHotkeyConfig() Returns a structure containing currently used hotkey mapping.
Definition: draw_frame.h:345
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
void ReCreateLayerBox(bool aForceResizeToolbar=true)
Re create the layer Box by clearing the old list, and building le new one, from the new layers names ...
Definition: tool_pcb.cpp:709
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:60
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:309
VECTOR2I GetGrid() const
Definition: grid_helper.cpp:68
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
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:163
static TOOL_ACTION switchUnits
Definition: pcb_actions.h:340
static TOOL_ACTION layerInner3
Definition: pcb_actions.h:234
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:341
wxPoint m_O_Curseur
Relative Screen cursor coordinate (on grid) in user units.
bool Empty() const
Definition: commit.h:135
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
coord_type GetTop() const
Definition: box2.h:192
static const int delta[8][2]
Definition: solve.cpp:112
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls a tool by sending a tool activation event to tool of given ID...
virtual void Push(const wxString &aMessage=wxT("A commit"), bool aCreateUndoEntry=true) override
Executes the changes.
static TOOL_ACTION resetCoords
Definition: pcb_actions.h:337
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:121
Auxiliary rendering target (noncached)
Definition: definitions.h:42
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
static TOOL_ACTION layerTop
Definition: pcb_actions.h:231
Generic tool for picking a point.
Definition: picker_tool.h:35
void SetFastGrid1()
Function SetFastGrid1()
BOARD_ITEM * Next() const
Class RELEASER releases a PLUGIN in the context of a potential thrown exception, through its destruct...
Definition: io_mgr.h:476
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:226
static TOOL_ACTION zoomTool
Definition: pcb_actions.h:335
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:346
virtual void WarpCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false) const =0
Function WarpCursor() If enabled (.
PCB_LAYER_ID
A quick note on layer IDs:
double a
Alpha component.
Definition: color4d.h:284
static TOOL_ACTION gridFast2
Definition: actions.h:61
Class LSET is a set of PCB_LAYER_IDs.
static TOOL_ACTION cursorRightFast
Definition: pcb_actions.h:317
static bool deleteItem(TOOL_MANAGER *aToolMgr, const VECTOR2D &aPosition)
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:564
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
static TOOL_ACTION layerPrev
Definition: pcb_actions.h:240
static TOOL_ACTION toBeDone
Definition: pcb_actions.h:348
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:175
virtual VECTOR2D GetCursorPosition() const =0
Function GetCursorPosition() Returns the current cursor position in world coordinates.
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:575
void SetPosition(const VECTOR2D &aPosition)
T * GetLast() const
Function GetLast returns the last T* in the list without removing it, or NULL if the list is empty...
Definition: dlist.h:170
static TOOL_ACTION panRight
Definition: pcb_actions.h:326
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
Class TOOL_EVENT.
Definition: tool_event.h:162
static TOOL_ACTION cursorClick
Definition: pcb_actions.h:319
void ProcessBoard()
Function ProcessBoard() Prepares data for computing (computes a list of current nodes and connections...
bool m_ContrastModeDisplay
Definition: pcbstruct.h:85
coord_type GetBottom() const
Definition: box2.h:188
D_PAD * Next() const
Definition: class_pad.h:106
SELECTION & GetSelection()
Function GetSelection()
DLIST< BOARD_ITEM > m_Drawings
Definition: class_board.h:242
int LayerToggle(const TOOL_EVENT &aEvent)
PCB_LAYER_ID m_Route_Layer_BOTTOM
static TOOL_ACTION panUp
Definition: pcb_actions.h:323
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
int ZoneDisplayMode(const TOOL_EVENT &aEvent)
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:1051
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:312
void Update(VIEW_ITEM *aItem)
Function Update() For dynamic VIEWs, informs the associated VIEW that the graphical representation of...
Definition: view.cpp:1379
void SetGridSize(const VECTOR2D &aGridSize)
Set the grid size.
#define FLAG0
Pcbnew: flag used in local computations.
Definition: base_struct.h:131
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_gridOrigin
Grid origin marker.
RN_DATA * GetRatsnest() const
Function GetRatsnest() returns list of missing connections between components/tracks.
Definition: class_board.h:287
static TOOL_ACTION selectionTool
Definition: pcb_actions.h:334
void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:36
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:325
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)
int AppendBoard(const TOOL_EVENT &aEvent)
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:30
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:221
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
const VECTOR2I & GetScreenPixelSize() const
Returns GAL canvas size in pixels.
static TOOL_ACTION viaDisplayMode
Definition: pcb_actions.h:222
void UpdateLayerColor(int aLayer)
Function UpdateLayerColor() Applies the new coloring scheme held by RENDER_SETTINGS in case that it h...
Definition: view.cpp:656
int ShowHelp(const TOOL_EVENT &aEvent)
void DisplayInfoMessage(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayInfoMessage displays an informational message box with aMessage.
Definition: confirm.cpp:89
bool m_DisplayPadFill
Definition: pcbstruct.h:65
static TOOL_ACTION cursorLeft
Definition: pcb_actions.h:311
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:245
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:227
TRACK * Next() const
Definition: class_track.h:98
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.
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:1022
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:339
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:166
DLIST< MODULE > m_Modules
Definition: class_board.h:243
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 TOOL_ACTION.
Definition: tool_action.h:46
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
VECTOR2D ToScreen(const VECTOR2D &aCoord, bool aAbsolute=true) const
Function ToScreen() Converts a world space point/vector to a point/vector in screen space coordinates...
Definition: view.cpp:459
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:803
static TOOL_ACTION layerInner4
Definition: pcb_actions.h:235
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:108
int GridFast2(const TOOL_EVENT &aEvent)
static TOOL_ACTION cursorDown
Definition: pcb_actions.h:310
void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:311
DLIST< TRACK > m_Track
Definition: class_board.h:244
coord_type GetLeft() const
Definition: box2.h:191
Module description (excepted pads)
void ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
static TOOL_ACTION gridSetOrigin
Definition: actions.h:64
Class VIEW.
Definition: view.h:58
void ReFillLayerWidget()
Function ReFillLayerWidget changes out all the layers in m_Layers and may be called upon loading a ne...
Definition: pcbframe.cpp:581
static TOOL_ACTION remove
Deleting a BOARD_ITEM.
Definition: pcb_actions.h:114
static TOOL_ACTION cursorLeftFast
Definition: pcb_actions.h:316
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:232
void SetTransitions() override
Sets up handlers for various events.
Rendering engine changes.
Definition: tool_base.h:84
static TOOL_ACTION panDown
Definition: pcb_actions.h:324
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:69
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:111
static TOOL_ACTION highContrastDec
Definition: pcb_actions.h:228
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:767
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...
bool ProcessEvent(wxEvent &aEvent) override
Function ProcessEvent overrides the default process event handler to implement the auto save feature...
Definition: basicframe.cpp:166
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:601
static TOOL_ACTION trackDisplayMode
Definition: pcb_actions.h:220
PCB_LAYER_ID m_Route_Layer_TOP
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:243
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:223
int HighContrastDec(const TOOL_EVENT &aEvent)
static TOOL_ACTION cursorDownFast
Definition: pcb_actions.h:315