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 <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 <pcb_edit_frame.h>
50 #include <pcb_draw_panel_gal.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::graphicDisplayMode( "pcbnew.Control.graphicDisplayMode",
84  AS_GLOBAL, 0,
85  "", "" );
86 
87 TOOL_ACTION PCB_ACTIONS::moduleEdgeOutlines( "pcbnew.Control.graphicOutlines",
88  AS_GLOBAL, 0,
89  "", "" );
90 
91 TOOL_ACTION PCB_ACTIONS::moduleTextOutlines( "pcbnew.Control.textOutlines",
92  AS_GLOBAL, 0,
93  "", "" );
94 
95 TOOL_ACTION PCB_ACTIONS::zoneDisplayEnable( "pcbnew.Control.zoneDisplayEnable",
96  AS_GLOBAL, 0,
97  "", "" );
98 
99 TOOL_ACTION PCB_ACTIONS::zoneDisplayDisable( "pcbnew.Control.zoneDisplayDisable",
100  AS_GLOBAL, 0,
101  "", "" );
102 
103 TOOL_ACTION PCB_ACTIONS::zoneDisplayOutlines( "pcbnew.Control.zoneDisplayOutlines",
104  AS_GLOBAL, 0,
105  "", "" );
106 
107 TOOL_ACTION PCB_ACTIONS::highContrastMode( "pcbnew.Control.highContrastMode",
109  "", "" );
110 
111 TOOL_ACTION PCB_ACTIONS::highContrastInc( "pcbnew.Control.highContrastInc",
113  "", "" );
114 
115 TOOL_ACTION PCB_ACTIONS::highContrastDec( "pcbnew.Control.highContrastDec",
117  "", "" );
118 
119 
120 // Layer control
121 TOOL_ACTION PCB_ACTIONS::layerTop( "pcbnew.Control.layerTop",
123  "", "", NULL, AF_NONE, (void*) F_Cu );
124 
125 TOOL_ACTION PCB_ACTIONS::layerInner1( "pcbnew.Control.layerInner1",
127  "", "", NULL, AF_NONE, (void*) In1_Cu );
128 
129 TOOL_ACTION PCB_ACTIONS::layerInner2( "pcbnew.Control.layerInner2",
131  "", "", NULL, AF_NONE, (void*) In2_Cu );
132 
133 TOOL_ACTION PCB_ACTIONS::layerInner3( "pcbnew.Control.layerInner3",
135  "", "", NULL, AF_NONE, (void*) In3_Cu );
136 
137 TOOL_ACTION PCB_ACTIONS::layerInner4( "pcbnew.Control.layerInner4",
139  "", "", NULL, AF_NONE, (void*) In4_Cu );
140 
141 TOOL_ACTION PCB_ACTIONS::layerInner5( "pcbnew.Control.layerInner5",
143  "", "", NULL, AF_NONE, (void*) In5_Cu );
144 
145 TOOL_ACTION PCB_ACTIONS::layerInner6( "pcbnew.Control.layerInner6",
147  "", "", NULL, AF_NONE, (void*) In6_Cu );
148 
149 TOOL_ACTION PCB_ACTIONS::layerBottom( "pcbnew.Control.layerBottom",
151  "", "", NULL, AF_NONE, (void*) B_Cu );
152 
153 TOOL_ACTION PCB_ACTIONS::layerNext( "pcbnew.Control.layerNext",
155  "", "" );
156 
157 TOOL_ACTION PCB_ACTIONS::layerPrev( "pcbnew.Control.layerPrev",
159  "", "" );
160 
161 TOOL_ACTION PCB_ACTIONS::layerToggle( "pcbnew.Control.layerToggle",
163  "", "" );
164 
165 TOOL_ACTION PCB_ACTIONS::layerAlphaInc( "pcbnew.Control.layerAlphaInc",
167  "", "" );
168 
169 TOOL_ACTION PCB_ACTIONS::layerAlphaDec( "pcbnew.Control.layerAlphaDec",
171  "", "" );
172 
173 TOOL_ACTION PCB_ACTIONS::layerChanged( "pcbnew.Control.layerChanged",
174  AS_GLOBAL, 0,
175  "", "", NULL, AF_NOTIFY );
176 
177 // Miscellaneous
178 TOOL_ACTION PCB_ACTIONS::selectionTool( "pcbnew.Control.selectionTool",
179  AS_GLOBAL, 0,
180  "", "", NULL, AF_ACTIVATE );
181 
182 TOOL_ACTION PCB_ACTIONS::resetCoords( "pcbnew.Control.resetCoords",
184  "", "" );
185 
186 TOOL_ACTION PCB_ACTIONS::switchCursor( "pcbnew.Control.switchCursor",
187  AS_GLOBAL, 0,
188  "", "" );
189 
190 TOOL_ACTION PCB_ACTIONS::switchUnits( "pcbnew.Control.switchUnits",
192  "", "" );
193 
194 TOOL_ACTION PCB_ACTIONS::deleteItemCursor( "pcbnew.Control.deleteItemCursor",
195  AS_GLOBAL, 0,
196  "", "" );
197 
198 TOOL_ACTION PCB_ACTIONS::showHelp( "pcbnew.Control.showHelp",
200  "", "" );
201 
202 TOOL_ACTION PCB_ACTIONS::toBeDone( "pcbnew.Control.toBeDone",
203  AS_GLOBAL, 0, // dialog saying it is not implemented yet
204  "", "" ); // so users are aware of that
205 
206 TOOL_ACTION PCB_ACTIONS::pasteFromClipboard( "pcbnew.InteractiveEdit.pasteFromClipboard",
207  AS_GLOBAL, 0, // do not define a hotkey and let TranslateLegacyId() handle the event
208  _( "Paste" ), _( "Paste content from clipboard" ),
209  paste_xpm );
210 
211 
213  PCB_TOOL( "pcbnew.Control" ), m_frame( NULL )
214 {
215  m_gridOrigin.reset( new KIGFX::ORIGIN_VIEWITEM() );
216 }
217 
218 
220 {
221 }
222 
223 
225 {
226  m_frame = getEditFrame<PCB_BASE_FRAME>();
227 
228  if( aReason == MODEL_RELOAD || aReason == GAL_SWITCH )
229  {
230  m_gridOrigin->SetPosition( board()->GetGridOrigin() );
231  m_gridOrigin->SetColor( m_frame->GetGridColor() );
232  getView()->Remove( m_gridOrigin.get() );
233  getView()->Add( m_gridOrigin.get() );
234  }
235 }
236 
237 template<class T> void Flip( T& aValue )
238 {
239  aValue = !aValue;
240 }
241 
243 {
244  auto opts = displayOptions();
245 
246  Flip( opts->m_DisplayPcbTrackFill );
247  view()->UpdateDisplayOptions( opts );
248 
249  for( auto track : board()->Tracks() )
250  {
251  if( track->Type() == PCB_TRACE_T )
252  view()->Update( track, KIGFX::GEOMETRY );
253  }
254 
255  canvas()->Refresh();
256 
257  return 0;
258 }
259 
261 {
262  auto opts = displayOptions();
263 
264  Flip( opts->m_DisplayPadFill );
265  view()->UpdateDisplayOptions( opts );
266 
267  for( auto module : board()->Modules() ) // fixme: move to PCB_VIEW
268  {
269  for( auto pad : module->Pads() )
270  view()->Update( pad, KIGFX::GEOMETRY );
271  }
272 
273  canvas()->Refresh();
274 
275  return 0;
276 }
277 
278 
280 {
281  auto opts = displayOptions();
282 
283  Flip( opts->m_DisplayViaFill );
284  view()->UpdateDisplayOptions( opts );
285 
286  for( auto track : board()->Tracks() )
287  {
288  if( track->Type() == PCB_TRACE_T || track->Type() == PCB_VIA_T )
289  view()->Update( track, KIGFX::GEOMETRY );
290  }
291 
292  canvas()->Refresh();
293 
294  return 0;
295 }
296 
297 
299 {
300  auto opts = displayOptions();
301 
302  Flip( opts->m_DisplayDrawItemsFill );
303  view()->UpdateDisplayOptions( opts );
304 
305  for( auto item : board()->Drawings() )
306  {
307  view()->Update( item, KIGFX::GEOMETRY );
308  }
309 
310  canvas()->Refresh();
311 
312  return 0;
313 }
314 
315 
317 {
318  auto opts = displayOptions();
319 
320  Flip( opts->m_DisplayModEdgeFill );
321  view()->UpdateDisplayOptions( opts );
322 
323  for( auto module : board()->Modules() )
324  {
325  for( auto item : module->GraphicalItems() )
326  {
327  if( item->Type() == PCB_MODULE_EDGE_T )
328  view()->Update( item, KIGFX::GEOMETRY );
329  }
330  }
331 
332  canvas()->Refresh();
333 
334  return 0;
335 }
336 
337 
339 {
340  auto opts = displayOptions();
341 
342  Flip( opts->m_DisplayModTextFill );
343  view()->UpdateDisplayOptions( opts );
344 
345  for( auto module : board()->Modules() )
346  {
347  for( auto item : module->GraphicalItems() )
348  {
349  if( item->Type() == PCB_MODULE_TEXT_T )
350  view()->Update( item, KIGFX::GEOMETRY );
351  }
352 
355  }
356 
357  canvas()->Refresh();
358 
359  return 0;
360 }
361 
362 
364 {
365  auto opts = displayOptions();
366 
367  // Apply new display options to the GAL canvas
369  opts->m_DisplayZonesMode = 0;
370  else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayDisable ) )
371  opts->m_DisplayZonesMode = 1;
372  else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayOutlines ) )
373  opts->m_DisplayZonesMode = 2;
374  else
375  wxFAIL;
376 
377  view()->UpdateDisplayOptions( opts );
378 
379  for( int i = 0; i < board()->GetAreaCount(); ++i )
380  view()->Update( board()->GetArea( i ), KIGFX::GEOMETRY );
381 
382  canvas()->Refresh();
383 
384  return 0;
385 }
386 
387 
389 {
390  auto opts = displayOptions();
391 
392  Flip( opts->m_ContrastModeDisplay );
393  view()->UpdateDisplayOptions( opts );
395 
396  return 0;
397 }
398 
399 
401 {
402  return 0;
403 }
404 
405 
407 {
408  return 0;
409 }
410 
411 
412 // Layer control
414 {
415  m_frame->SwitchLayer( NULL, (PCB_LAYER_ID) aEvent.Parameter<intptr_t>() );
416 
417  return 0;
418 }
419 
420 
422 {
423  PCB_BASE_FRAME* editFrame = m_frame;
424  LAYER_NUM layer = editFrame->GetActiveLayer();
425 
426  if( layer < F_Cu || layer > B_Cu )
427  return 0;
428 
429  int layerCount = board()->GetCopperLayerCount();
430 
431  if( layer == layerCount - 2 || layerCount < 2 )
432  layer = B_Cu;
433  else if( layer == B_Cu )
434  layer = F_Cu;
435  else
436  ++layer;
437 
438  wxCHECK( IsCopperLayer( layer ), 0 );
439  editFrame->SwitchLayer( NULL, ToLAYER_ID( layer ) );
440 
441  return 0;
442 }
443 
444 
446 {
447  PCB_BASE_FRAME* editFrame = m_frame;
448  LAYER_NUM layer = editFrame->GetActiveLayer();
449 
450  if( layer < F_Cu || layer > B_Cu )
451  return 0;
452 
453  int layerCount = board()->GetCopperLayerCount();
454 
455  if( layer == F_Cu || layerCount < 2 )
456  layer = B_Cu;
457  else if( layer == B_Cu )
458  layer = layerCount - 2;
459  else
460  --layer;
461 
462  wxCHECK( IsCopperLayer( layer ), 0 );
463  editFrame->SwitchLayer( NULL, ToLAYER_ID( layer ) );
464 
465  return 0;
466 }
467 
468 
470 {
471  LAYER_NUM currentLayer = m_frame->GetActiveLayer();
472  PCB_SCREEN* screen = m_frame->GetScreen();
473 
474  if( currentLayer == screen->m_Route_Layer_TOP )
475  m_frame->SwitchLayer( NULL, screen->m_Route_Layer_BOTTOM );
476  else
477  m_frame->SwitchLayer( NULL, screen->m_Route_Layer_TOP );
478 
479  return 0;
480 }
481 
482 
483 // It'd be nice to share the min/max with the DIALOG_COLOR_PICKER, but those are
484 // set in wxFormBuilder.
485 #define ALPHA_MIN 0.20
486 #define ALPHA_MAX 1.00
487 #define ALPHA_STEP 0.05
488 
490 {
491  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
492  auto settings = painter->GetSettings();
493 
494  LAYER_NUM currentLayer = m_frame->GetActiveLayer();
495  KIGFX::COLOR4D currentColor = settings->GetLayerColor( currentLayer );
496 
497  if( currentColor.a <= ALPHA_MAX - ALPHA_STEP )
498  {
499  currentColor.a += ALPHA_STEP;
500  settings->SetLayerColor( currentLayer, currentColor );
501  m_frame->GetGalCanvas()->GetView()->UpdateLayerColor( currentLayer );
502 
503  wxUpdateUIEvent dummy;
504  static_cast<PCB_EDIT_FRAME*>( m_frame )->OnUpdateLayerAlpha( dummy );
505  }
506  else
507  wxBell();
508 
509  return 0;
510 }
511 
512 
514 {
515  auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
516  auto settings = painter->GetSettings();
517 
518  LAYER_NUM currentLayer = m_frame->GetActiveLayer();
519  KIGFX::COLOR4D currentColor = settings->GetLayerColor( currentLayer );
520 
521  if( currentColor.a >= ALPHA_MIN + ALPHA_STEP )
522  {
523  currentColor.a -= ALPHA_STEP;
524  settings->SetLayerColor( currentLayer, currentColor );
525  m_frame->GetGalCanvas()->GetView()->UpdateLayerColor( currentLayer );
526 
527  wxUpdateUIEvent dummy;
528  static_cast<PCB_BASE_FRAME*>( m_frame )->OnUpdateLayerAlpha( dummy );
529  }
530  else
531  wxBell();
532 
533  return 0;
534 }
535 
536 
537 // Grid control
539 {
541  updateGrid();
542 
543  return 0;
544 }
545 
546 
548 {
550  updateGrid();
551 
552  return 0;
553 }
554 
555 
557  BOARD_ITEM* originViewItem, const VECTOR2D& aPoint )
558 {
559  aFrame->SetGridOrigin( wxPoint( aPoint.x, aPoint.y ) );
560  aView->GetGAL()->SetGridOrigin( aPoint );
561  originViewItem->SetPosition( wxPoint( aPoint.x, aPoint.y ) );
562  aView->MarkDirty();
563  aFrame->OnModify();
564  return true;
565 }
566 
567 
569  BOARD_ITEM* originViewItem, const VECTOR2D& aPoint )
570 {
571  aFrame->SaveCopyInUndoList( originViewItem, UR_GRIDORIGIN );
572  return DoSetGridOrigin( aView, aFrame, originViewItem, aPoint );
573 }
574 
575 
577 {
578  VECTOR2D* origin = aEvent.Parameter<VECTOR2D*>();
579 
580  if( origin )
581  {
582  // We can't undo the other grid dialog settings, so no sense undoing just the origin
583 
584  DoSetGridOrigin( getView(), m_frame, m_gridOrigin.get(), *origin );
585  delete origin;
586  }
587  else
588  {
589  Activate();
590 
592  wxCHECK( picker, 0 );
593 
594  // TODO it will not check the toolbar button in module editor, as it uses a different ID..
595  m_frame->SetToolID( ID_PCB_PLACE_GRID_COORD_BUTT, wxCURSOR_PENCIL, _( "Adjust grid origin" ) );
596  picker->SetClickHandler( std::bind( SetGridOrigin, getView(), m_frame, m_gridOrigin.get(), _1 ) );
597  picker->Activate();
598  Wait();
599  }
600 
601  return 0;
602 }
603 
604 
606 {
607  SetGridOrigin( getView(), m_frame, m_gridOrigin.get(), VECTOR2D( 0, 0 ) );
608 
609  return 0;
610 }
611 
612 
613 // Miscellaneous
615 {
616  auto vcSettings = m_toolMgr->GetCurrentToolVC();
617 
618  // Use either the active tool forced cursor position or the general settings
619  VECTOR2I cursorPos = vcSettings.m_forceCursorPosition ? vcSettings.m_forcedPosition :
621 
622  m_frame->GetScreen()->m_O_Curseur = wxPoint( cursorPos.x, cursorPos.y );
624 
625  return 0;
626 }
627 
628 
630 {
631  auto& galOpts = m_frame->GetGalDisplayOptions();
632 
633  galOpts.m_fullscreenCursor = !galOpts.m_fullscreenCursor;
634  galOpts.NotifyChanged();
635 
636  return 0;
637 }
638 
639 
641 {
642  // TODO should not it be refactored to pcb_frame member function?
643  wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED );
644 
645  if( m_frame->GetUserUnits() == INCHES )
646  evt.SetId( ID_TB_OPTIONS_SELECT_UNIT_MM );
647  else
648  evt.SetId( ID_TB_OPTIONS_SELECT_UNIT_INCH );
649 
650  m_frame->ProcessEvent( evt );
651 
652  return 0;
653 }
654 
655 
656 static bool deleteItem( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition )
657 {
658  SELECTION_TOOL* selectionTool = aToolMgr->GetTool<SELECTION_TOOL>();
659  wxCHECK( selectionTool, false );
660 
661  aToolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
662 
663  const SELECTION& selection = selectionTool->RequestSelection(
664  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
665  { EditToolSelectionFilter( aCollector, EXCLUDE_LOCKED ); } );
666 
667  if( selection.Empty() )
668  return true;
669 
670  aToolMgr->RunAction( PCB_ACTIONS::remove, true );
671 
672  return true;
673 }
674 
675 
677 {
678  Activate();
679 
681  wxCHECK( picker, 0 );
682 
684  wxCURSOR_BULLSEYE, _( "Delete item" ) );
685  picker->SetSnapping( false );
686  picker->SetClickHandler( std::bind( deleteItem, m_toolMgr, _1 ) );
687  picker->Activate();
688  Wait();
689 
690  return 0;
691 }
692 
693 
695 {
696  CLIPBOARD_IO pi;
697  BOARD_ITEM* clipItem = pi.Parse();
698 
699  if( !clipItem )
700  return 0;
701 
702  if( clipItem->Type() == PCB_T )
703  static_cast<BOARD*>( clipItem )->ClearAllNetCodes();
704 
705  bool editModules = m_editModules || frame()->IsType( FRAME_PCB_MODULE_EDITOR );
706 
707  // The clipboard can contain two different things, an entire kicad_pcb
708  // or a single module
709 
710  if( editModules && ( !board() || !module() ) )
711  {
712  wxLogDebug( wxT( "Attempting to paste to empty module editor window\n") );
713  return 0;
714  }
715 
716  switch( clipItem->Type() )
717  {
718  case PCB_T:
719  {
720  if( editModules )
721  {
722  wxLogDebug( wxT( "attempting to paste a pcb in the footprint editor\n") );
723  return 0;
724  }
725 
726  placeBoardItems( static_cast<BOARD*>( clipItem ) );
727  break;
728  }
729 
730  case PCB_MODULE_T:
731  {
732  std::vector<BOARD_ITEM*> items;
733 
734  clipItem->SetParent( board() );
735 
736  if( editModules )
737  {
738  auto oldModule = static_cast<MODULE*>( clipItem );
739  auto newModule = board()->m_Modules.GetFirst();
740 
741  for( D_PAD* pad = oldModule->PadsList(), *next = nullptr; pad; pad = next )
742  {
743  next = pad->Next();
744  oldModule->Remove( pad );
745  pad->SetParent( newModule );
746  items.push_back( pad );
747  }
748 
749  for( BOARD_ITEM* item = oldModule->GraphicalItemsList(), *next = nullptr;
750  item; item = next )
751  {
752  next = item->Next();
753  oldModule->Remove( item );
754  item->SetParent( newModule );
755  items.push_back( item );
756  }
757  }
758  else
759  {
760  items.push_back( clipItem );
761  }
762 
763  placeBoardItems( items, true );
764  break;
765  }
766 
767  default:
768  m_frame->DisplayToolMsg( _( "Invalid clipboard contents" ) );
769  break;
770  }
771 
772  return 1;
773 }
774 
775 
777 {
778  int open_ctl;
779  wxString fileName;
780 
781  PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
782 
783  if( !editFrame )
784  return 1;
785 
786  // Pick a file to append
787  if( !AskLoadBoardFileName( editFrame, &open_ctl, &fileName, true ) )
788  return 1;
789 
790  IO_MGR::PCB_FILE_T pluginType = plugin_type( fileName, open_ctl );
791  PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) );
792 
793  return AppendBoard( *pi, fileName );
794 }
795 
796 
797 // Helper function for PCBNEW_CONTROL::placeBoardItems()
798 template<typename T>
799 static void moveNoFlagToVector( DLIST<T>& aList, std::vector<BOARD_ITEM*>& aTarget, bool aIsNew )
800 {
801  for( auto obj = aIsNew ? aList.PopFront() : aList.GetFirst(); obj;
802  obj = aIsNew ? aList.PopFront() : obj->Next() )
803  {
804  if( obj->GetFlags() & FLAG0 )
805  obj->ClearFlags( FLAG0 );
806  else
807  aTarget.push_back( obj );
808  }
809 }
810 
811 static void moveNoFlagToVector( ZONE_CONTAINERS& aList, std::vector<BOARD_ITEM*>& aTarget, bool aIsNew )
812 {
813  if( aList.size() == 0 )
814  return;
815 
816  auto obj = aList.front();
817  int idx = 0;
818 
819  if( aIsNew )
820  {
821  obj = aList.back();
822  aList.pop_back();
823  }
824 
825  for( ; obj ; )
826  {
827  if( obj->GetFlags() & FLAG0 )
828  obj->ClearFlags( FLAG0 );
829  else
830  aTarget.push_back( obj );
831 
832  if( aIsNew )
833  {
834  if( aList.size() )
835  {
836  obj = aList.back();
837  aList.pop_back();
838  }
839  else
840  obj = nullptr;
841  }
842  else
843  obj = idx < int(aList.size()-1) ? aList[++idx] : nullptr;
844  }
845 }
846 
847 
848 
850 {
851  // items are new if the current board is not the board source
852  bool isNew = board() != aBoard;
853  std::vector<BOARD_ITEM*> items;
854 
855  moveNoFlagToVector( aBoard->m_Track, items, isNew );
856  moveNoFlagToVector( aBoard->m_Modules, items, isNew );
857  moveNoFlagToVector( aBoard->DrawingsList(), items, isNew );
858  moveNoFlagToVector( aBoard->Zones(), items, isNew );
859 
860  return placeBoardItems( items, isNew );
861 }
862 
863 
864 int PCBNEW_CONTROL::placeBoardItems( std::vector<BOARD_ITEM*>& aItems, bool aIsNew )
865 {
867 
868  auto selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
869  auto editTool = m_toolMgr->GetTool<EDIT_TOOL>();
870 
871  SELECTION& selection = selectionTool->GetSelection();
872 
873  for( auto item : aItems )
874  {
875  item->SetSelected();
876  selection.Add( item );
877 
878  // Add or just select items for the move/place command
879  if( aIsNew )
880  editTool->GetCurrentCommit()->Add( item );
881  else
882  editTool->GetCurrentCommit()->Added( item );
883  }
884 
885  selection.SetReferencePoint( VECTOR2I( 0, 0 ) );
886 
889 
890  return 0;
891 }
892 
893 
894 int PCBNEW_CONTROL::AppendBoard( PLUGIN& pi, wxString& fileName )
895 {
896  PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
897 
898  if( !editFrame )
899  return 1;
900 
901  BOARD* brd = board();
902 
903  if( !brd )
904  return 1;
905 
906  // Mark existing items, in order to know what are the new items
907  // to be ble to select only the new items after loadind
908  for( auto track : brd->Tracks() )
909  {
910  track->SetFlags( FLAG0 );
911  }
912 
913  for( auto module : brd->Modules() )
914  {
915  module->SetFlags( FLAG0 );
916  }
917 
918  for( auto drawing : brd->Drawings() )
919  {
920  drawing->SetFlags( FLAG0 );
921  }
922 
923  for( auto zone : brd->Zones() )
924  {
925  zone->SetFlags( FLAG0 );
926  }
927 
928  // Keep also the count of copper layers, to adjust if necessary
929  int initialCopperLayerCount = brd->GetCopperLayerCount();
930  LSET initialEnabledLayers = brd->GetEnabledLayers();
931 
932  // Load the data
933  try
934  {
935  PROPERTIES props;
936  char xbuf[30];
937  char ybuf[30];
938 
939  // EAGLE_PLUGIN can use this info to center the BOARD, but it does not yet.
940  sprintf( xbuf, "%d", editFrame->GetPageSizeIU().x );
941  sprintf( ybuf, "%d", editFrame->GetPageSizeIU().y );
942 
943  props["page_width"] = xbuf;
944  props["page_height"] = ybuf;
945 
946  editFrame->GetDesignSettings().m_NetClasses.Clear();
947  pi.Load( fileName, brd, &props );
948  }
949  catch( const IO_ERROR& ioe )
950  {
951  wxString msg = wxString::Format( _( "Error loading board.\n%s" ), GetChars( ioe.What() ));
952  DisplayError( editFrame, msg );
953 
954  return 0;
955  }
956 
957  // rebuild nets and ratsnest before any use of nets
958  brd->BuildListOfNets();
960  brd->BuildConnectivity();
961 
962  // Synchronize layers
963  // we should not ask PLUGINs to do these items:
964  int copperLayerCount = brd->GetCopperLayerCount();
965 
966  if( copperLayerCount > initialCopperLayerCount )
967  brd->SetCopperLayerCount( copperLayerCount );
968 
969  // Enable all used layers, and make them visible:
970  LSET enabledLayers = brd->GetEnabledLayers();
971  enabledLayers |= initialEnabledLayers;
972  brd->SetEnabledLayers( enabledLayers );
973  brd->SetVisibleLayers( enabledLayers );
974 
975  return placeBoardItems( brd );
976 }
977 
978 
980 {
982 
983  return 0;
984 }
985 
986 
988 {
989  DisplayInfoMessage( m_frame, _( "Not available in OpenGL/Cairo canvases." ) );
990 
991  return 0;
992 }
993 
994 
996 {
997  // Display modes
1010 
1011  // Layer control
1025 
1026  // Grid control
1031 
1032  // Miscellaneous
1039 
1040  // Append control
1042 
1044 }
1045 
1046 
1048 {
1049  BASE_SCREEN* screen = m_frame->GetScreen();
1050  //GRID_TYPE grid = screen->GetGrid( idx );
1051  getView()->GetGAL()->SetGridSize( VECTOR2D( screen->GetGridSize() ) );
1053 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
static TOOL_ACTION layerBottom
Definition: pcb_actions.h:279
CITER next(CITER it)
Definition: ptree.cpp:130
BOARD_ITEM * Parse()
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
const KIGFX::VC_SETTINGS & GetCurrentToolVC() const
Returns the view controls settings for the current tool or the general settings if there is no active...
void BuildListOfNets()
Definition: class_board.h:729
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:116
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 PadDisplayMode(const TOOL_EVENT &aEvent)
TEXTE_MODULE & Reference()
Definition: class_module.h:513
static TOOL_ACTION move
move an item
Definition: pcb_actions.h:96
static TOOL_ACTION layerNext
Definition: pcb_actions.h:280
Definition: typeinfo.h:85
int HighContrastInc(const TOOL_EVENT &aEvent)
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg) override
Set the tool command ID to aId and sets the cursor to aCursor.
static TOOL_ACTION layerInner2
Definition: pcb_actions.h:274
SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter)
Function RequestSelection()
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
Definition: draw_frame.h:946
static TOOL_ACTION layerInner5
Definition: pcb_actions.h:277
virtual void SetPosition(const wxPoint &aPos)=0
void SetGridOrigin(const wxPoint &aPoint) override
Model changes (required full reload)
Definition: tool_base.h:83
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.
static TOOL_ACTION layerInner6
Definition: pcb_actions.h:278
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:85
static TOOL_ACTION showHelp
Definition: pcb_actions.h:377
VIEW_CONTROLS class definition.
static TOOL_ACTION layerAlphaDec
Definition: pcb_actions.h:283
static TOOL_ACTION gridResetOrigin
Definition: actions.h:87
int LayerAlphaInc(const TOOL_EVENT &aEvent)
DLIST< BOARD_ITEM > & DrawingsList()
Definition: class_board.h:260
static TOOL_ACTION zoneDisplayOutlines
Definition: pcb_actions.h:266
Class SELECTION_TOOL.
Class BOARD to handle a board.
void SetFastGrid2()
Function SetFastGrid2()
#define ALPHA_MIN
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
static TOOL_ACTION layerAlphaInc
Definition: pcb_actions.h:282
int GetCopperLayerCount() const
Function GetCopperLayerCount.
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:374
static TOOL_ACTION zoneDisplayDisable
Definition: pcb_actions.h:265
DLIST_ITERATOR_WRAPPER< D_PAD > Pads()
Definition: class_module.h:169
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
int HighContrastMode(const TOOL_EVENT &aEvent)
EDA_HOTKEY_CONFIG * GetHotkeyConfig() const
Return a structure containing currently used hotkey mapping.
Definition: draw_frame.h:431
void SetCopperLayerCount(int aCount)
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
int ModuleEdgeOutlines(const TOOL_EVENT &aEvent)
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:82
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)
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
Class DLIST is the head of a doubly linked list.
Definition: dlist.h:142
static TOOL_ACTION pasteFromClipboard
Paste from clipboard.
Definition: pcb_actions.h:324
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:587
Class PCB_PAINTER Contains methods for drawing PCB-specific items.
Definition: pcb_painter.h:211
static TOOL_ACTION switchUnits
Definition: pcb_actions.h:367
void setTransitions() override
Sets up handlers for various events.
static TOOL_ACTION layerInner3
Definition: pcb_actions.h:275
LSET GetEnabledLayers() const
Function GetEnabledLayers is a proxy function that calls the corresponding function in m_BoardSetting...
int LayerNext(const TOOL_EVENT &aEvent)
static TOOL_ACTION deleteItemCursor
Definition: pcb_actions.h:369
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 TOOL_ACTION resetCoords
Definition: pcb_actions.h:364
Functions relatives to tracks, vias and segments used to fill zones.
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
Pcbnew hotkeys.
Auxiliary rendering target (noncached)
Definition: definitions.h:42
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:74
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
static TOOL_ACTION layerTop
Definition: pcb_actions.h:272
Generic tool for picking a point.
Definition: picker_tool.h:34
void SetFastGrid1()
Function SetFastGrid1()
PCB_DRAW_PANEL_GAL * canvas() const
Definition: pcb_tool.cpp:240
Class RELEASER releases a PLUGIN in the context of a potential thrown exception, through its destruct...
Definition: io_mgr.h:563
PCB_DISPLAY_OPTIONS * displayOptions() const
Definition: pcb_tool.cpp:235
Class TOOL_MANAGER.
Definition: tool_manager.h:49
void SynchronizeNetsAndNetClasses()
Function SynchronizeNetsAndNetClasses copies NETCLASS info to each NET, based on NET membership in a ...
Definition: netclass.cpp:160
static TOOL_ACTION highContrastMode
Definition: pcb_actions.h:267
DLIST_ITERATOR_WRAPPER< BOARD_ITEM > GraphicalItems()
Definition: class_module.h:174
class MODULE, a footprint
Definition: typeinfo.h:89
void DisplayHotkeyList(EDA_BASE_FRAME *aFrame, struct EDA_HOTKEY_CONFIG *aDescList)
Function DisplayHotkeyList Displays the current hotkey list.
static TOOL_ACTION appendBoard
Definition: pcb_actions.h:376
PCB_LAYER_ID
A quick note on layer IDs:
double a
Alpha component.
Definition: color4d.h:290
static TOOL_ACTION gridFast2
Definition: actions.h:83
Class LSET is a set of PCB_LAYER_IDs.
#define ALPHA_STEP
static bool deleteItem(TOOL_MANAGER *aToolMgr, const VECTOR2D &aPosition)
EDA_DRAW_FRAME::OnSelectGrid ID_TB_OPTIONS_SELECT_UNIT_INCH
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:256
static TOOL_ACTION layerPrev
Definition: pcb_actions.h:281
static TOOL_ACTION toBeDone
Definition: pcb_actions.h:379
DLIST_ITERATOR_WRAPPER< MODULE > Modules()
Definition: class_board.h:254
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
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:223
GAL * GetGAL() const
Function GetGAL() Returns the GAL this view is using to draw graphical primitives.
Definition: view.h:180
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target &#39;dirty&#39; flag.
Definition: view.h:596
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:216
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
TEXTE_MODULE & Value()
read/write accessors:
Definition: class_module.h:512
void SetVisibleLayers(LSET aLayerMask)
Function SetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
int GraphicDisplayMode(const TOOL_EVENT &aEvent)
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
EDA_UNITS_T GetUserUnits() const override
Return the user units currently in use.
Definition: draw_frame.h:284
Definition: common.h:160
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:139
Class TOOL_EVENT.
Definition: tool_event.h:168
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
int LayerToggle(const TOOL_EVENT &aEvent)
PCB_LAYER_ID m_Route_Layer_BOTTOM
Definition: pcb_screen.h:46
MODULE * module() const
Definition: pcb_tool.h:141
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
int ZoneDisplayMode(const TOOL_EVENT &aEvent)
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:1020
const SELECTION & selection() const
Definition: pcb_tool.cpp:245
void BuildConnectivity()
Builds or rebuilds the board connectivity database for the board, especially the list of connected it...
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:199
void UpdateDisplayOptions(PCB_DISPLAY_OPTIONS *aOptions)
Definition: pcb_view.cpp:113
All active tools
Definition: tool_event.h:144
virtual COLOR4D GetGridColor()
Definition: draw_frame.h:545
Class EDIT_TOOL.
Definition: edit_tool.h:59
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:132
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_gridOrigin
Grid origin marker.
int ModuleTextOutlines(const TOOL_EVENT &aEvent)
int AppendBoardFromFile(const TOOL_EVENT &aEvent)
static TOOL_ACTION selectionTool
Definition: pcb_actions.h:362
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
static TOOL_ACTION moduleEdgeOutlines
Display module edges as outlines.
Definition: pcb_actions.h:330
static const TOOL_EVENT SelectedEvent
Event sent after an item is selected.
virtual void SetHighContrastLayer(int aLayer) override
>
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
bool m_editModules
Definition: pcb_tool.h:150
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:261
bool AskLoadBoardFileName(wxWindow *aParent, int *aCtl, wxString *aFileName, bool aKicadFilesOnly=false)
Function AskLoadBoardFileName puts up a wxFileDialog asking for a BOARD filename to open...
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
static TOOL_ACTION viaDisplayMode
Definition: pcb_actions.h:262
void UpdateLayerColor(int aLayer)
Function UpdateLayerColor() Applies the new coloring scheme held by RENDER_SETTINGS in case that it h...
Definition: view.cpp:774
static bool DoSetGridOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, BOARD_ITEM *originViewItem, const VECTOR2D &aPoint)
static TOOL_ACTION moduleTextOutlines
Display module texts as outlines.
Definition: pcb_actions.h:333
static void moveNoFlagToVector(DLIST< T > &aList, std::vector< BOARD_ITEM * > &aTarget, bool aIsNew)
#define ALPHA_MAX
int ShowHelp(const TOOL_EVENT &aEvent)
virtual void OnModify()
Function OnModify Virtual Must be called after a change in order to set the "modify" flag of the curr...
virtual void UpdateStatusBar() override
Update 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:286
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:387
static TOOL_ACTION highContrastInc
Definition: pcb_actions.h:268
ZONE_CONTAINERS & Zones()
Definition: class_board.h:256
void DisplayToolMsg(const wxString &msg)
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.
Definition: netclass.h:242
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:366
IO_MGR::PCB_FILE_T plugin_type(const wxString &aFileName, int aCtl)
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
KIGFX::PCB_VIEW * view() const
Definition: pcb_tool.h:137
DLIST< MODULE > m_Modules
Definition: class_board.h:248
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)
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:245
Class PLUGIN is a base class that BOARD loading and saving plugins should derive from.
Definition: io_mgr.h:266
Class TOOL_ACTION.
Definition: tool_action.h:46
size_t i
Definition: json11.cpp:597
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
Definition: base_screen.h:410
Class PCB_EDIT_FRAME is the main frame for Pcbnew.
static bool SetGridOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, BOARD_ITEM *originViewItem, const VECTOR2D &aPoint)
virtual void SaveCopyInUndoList(BOARD_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))=0
Function SaveCopyInUndoList (virtual pure) Creates a new entry in undo list of commands.
int TrackDisplayMode(const TOOL_EVENT &aEvent)
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
static TOOL_ACTION graphicDisplayMode
Definition: pcb_actions.h:263
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
Works off of GetPageSettings() to return the size of the paper page in the internal units of this par...
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)
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:928
static TOOL_ACTION layerInner4
Definition: pcb_actions.h:276
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
int GridFast2(const TOOL_EVENT &aEvent)
DLIST_ITERATOR_WRAPPER< TRACK > Tracks()
Definition: class_board.h:253
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:344
bool IsType(FRAME_T aType) const
#define EXCLUDE_LOCKED
Function EditToolSelectionFilter.
Definition: edit_tool.h:45
DLIST< TRACK > m_Track
Definition: class_board.h:249
Module description (excepted pads)
static TOOL_ACTION gridSetOrigin
Definition: actions.h:86
Class VIEW.
Definition: view.h:61
static TOOL_ACTION remove
Deleting a BOARD_ITEM.
Definition: pcb_actions.h:132
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:52
static TOOL_ACTION layerInner1
Definition: pcb_actions.h:273
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Function DisplayInfoMessage displays an informational message box with aMessage.
Definition: confirm.cpp:277
void EditToolSelectionFilter(GENERAL_COLLECTOR &aCollector, int aFlags)
Definition: edit_tool.cpp:173
int AppendBoard(PLUGIN &pi, wxString &fileName)
Rendering engine changes.
Definition: tool_base.h:84
void Flip(T &aValue)
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:245
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:76
static TOOL_ACTION highContrastDec
Definition: pcb_actions.h:269
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:810
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...
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
void MarkDirty()
Function MarkDirty() Forces redraw of view on the next rendering.
Definition: view.h:621
static TOOL_ACTION trackDisplayMode
Definition: pcb_actions.h:260
PCB_LAYER_ID m_Route_Layer_TOP
Definition: pcb_screen.h:45
DLIST_ITERATOR_WRAPPER< BOARD_ITEM > Drawings()
Definition: class_board.h:255
T * PopFront()
Definition: dlist.h:221
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:46
static TOOL_ACTION layerToggle
Definition: pcb_actions.h:284
BOARD * board() const
Definition: pcb_tool.h:140
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:264
int HighContrastDec(const TOOL_EVENT &aEvent)