KiCad PCB EDA Suite
board_editor_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 CERN
5  * Copyright (C) 2014-2021 KiCad Developers, see AUTHORS.txt for contributors.
6  * @author Maciej Suminski <[email protected]>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 #include <functional>
27 #include <memory>
28 
29 #include <advanced_config.h>
30 #include "board_editor_control.h"
31 #include <bitmaps.h>
32 #include <board.h>
33 #include <board_commit.h>
34 #include <board_design_settings.h>
35 #include <pcb_group.h>
36 #include <footprint.h>
37 #include <pad.h>
38 #include <pcb_target.h>
39 #include <pcb_track.h>
40 #include <zone.h>
41 #include <pcb_marker.h>
42 #include <confirm.h>
45 #include <kiface_base.h>
46 #include <kiway.h>
48 #include <origin_viewitem.h>
49 #include <pcb_edit_frame.h>
50 #include <pcbnew_id.h>
51 #include <pcbnew_settings.h>
52 #include <project.h>
53 #include <project/project_file.h> // LAST_PATH_TYPE
54 #include <tool/tool_manager.h>
55 #include <tool/tool_event.h>
56 #include <tools/drawing_tool.h>
57 #include <tools/pcb_actions.h>
58 #include <tools/pcb_picker_tool.h>
60 #include <tools/edit_tool.h>
61 #include <tools/tool_event_utils.h>
62 #include <router/router_tool.h>
63 #include <view/view_controls.h>
64 #include <view/view_group.h>
67 #include <footprint_edit_frame.h>
68 #include <wx/filedlg.h>
69 #include <wx/log.h>
70 
71 using namespace std::placeholders;
72 
73 
75 {
76 public:
78  ACTION_MENU( true )
79  {
80  SetIcon( BITMAPS::add_zone );
81  SetTitle( _( "Zones" ) );
82 
83  Add( PCB_ACTIONS::zoneFill );
87 
88  AppendSeparator();
89 
94  }
95 
96 
97 protected:
98  ACTION_MENU* create() const override
99  {
100  return new ZONE_CONTEXT_MENU();
101  }
102 };
103 
104 
106 {
107 public:
109  ACTION_MENU( true )
110  {
111  SetIcon( BITMAPS::locked );
112  SetTitle( _( "Locking" ) );
113 
114  Add( PCB_ACTIONS::lock );
115  Add( PCB_ACTIONS::unlock );
117  }
118 
119  ACTION_MENU* create() const override
120  {
121  return new LOCK_CONTEXT_MENU();
122  }
123 };
124 
125 
129 class NETLIST_OPTIONS_HELPER : public wxPanel
130 {
131 public:
132  NETLIST_OPTIONS_HELPER( wxWindow* aParent )
133  : wxPanel( aParent )
134  {
135  m_cbOmitExtras = new wxCheckBox( this, wxID_ANY, _( "Omit extra information" ) );
136  m_cbOmitNets = new wxCheckBox( this, wxID_ANY, _( "Omit nets" ) );
137  m_cbOmitFpUuids = new wxCheckBox( this, wxID_ANY,
138  _( "Do not prefix path with footprint UUID." ) );
139 
140  wxBoxSizer* sizer = new wxBoxSizer( wxHORIZONTAL );
141  sizer->Add( m_cbOmitExtras, 0, wxALL, 5 );
142  sizer->Add( m_cbOmitNets, 0, wxALL, 5 );
143  sizer->Add( m_cbOmitFpUuids, 0, wxALL, 5 );
144 
145  SetSizerAndFit( sizer );
146  }
147 
148  int GetNetlistOptions() const
149  {
150  int options = 0;
151 
152  if( m_cbOmitExtras->GetValue() )
153  options |= CTL_OMIT_EXTRA;
154 
155  if( m_cbOmitNets->GetValue() )
156  options |= CTL_OMIT_NETS;
157 
158  if( m_cbOmitFpUuids->GetValue() )
159  options |= CTL_OMIT_FP_UUID;
160 
161  return options;
162  }
163 
164  static wxWindow* Create( wxWindow* aParent )
165  {
166  return new NETLIST_OPTIONS_HELPER( aParent );
167  }
168 
169 protected:
170  wxCheckBox* m_cbOmitExtras;
171  wxCheckBox* m_cbOmitNets;
172  wxCheckBox* m_cbOmitFpUuids;
173 };
174 
175 
177  PCB_TOOL_BASE( "pcbnew.EditorControl" ),
178  m_frame( nullptr ),
179  m_inPlaceFootprint( false ),
180  m_placingFootprint( false ),
181  m_inPlaceTarget( false )
182 {
183  m_placeOrigin = std::make_unique<KIGFX::ORIGIN_VIEWITEM>( KIGFX::COLOR4D( 0.8, 0.0, 0.0, 1.0 ),
185 }
186 
187 
189 {
190 }
191 
192 
194 {
195  m_frame = getEditFrame<PCB_EDIT_FRAME>();
196 
197  if( aReason == MODEL_RELOAD || aReason == GAL_SWITCH )
198  {
199  m_placeOrigin->SetPosition( getModel<BOARD>()->GetDesignSettings().GetAuxOrigin() );
200  getView()->Remove( m_placeOrigin.get() );
201  getView()->Add( m_placeOrigin.get() );
202  }
203 }
204 
205 
207 {
208  auto activeToolCondition =
209  [this]( const SELECTION& aSel )
210  {
211  return ( !m_frame->ToolStackIsEmpty() );
212  };
213 
214  auto inactiveStateCondition =
215  [this]( const SELECTION& aSel )
216  {
217  return ( m_frame->ToolStackIsEmpty() && aSel.Size() == 0 );
218  };
219 
220  auto placeModuleCondition =
221  [this]( const SELECTION& aSel )
222  {
223  return m_frame->IsCurrentTool( PCB_ACTIONS::placeFootprint ) && aSel.GetSize() == 0;
224  };
225 
226  auto& ctxMenu = m_menu.GetMenu();
227 
228  // "Cancel" goes at the top of the context menu when a tool is active
229  ctxMenu.AddItem( ACTIONS::cancelInteractive, activeToolCondition, 1 );
230  ctxMenu.AddSeparator( 1 );
231 
232  // "Get and Place Footprint" should be available for Place Footprint tool
233  ctxMenu.AddItem( PCB_ACTIONS::getAndPlace, placeModuleCondition, 1000 );
234  ctxMenu.AddSeparator( 1000 );
235 
236  // Finally, add the standard zoom & grid items
237  getEditFrame<PCB_BASE_FRAME>()->AddStandardSubMenus( m_menu );
238 
239  auto zoneMenu = std::make_shared<ZONE_CONTEXT_MENU>();
240  zoneMenu->SetTool( this );
241 
242  auto lockMenu = std::make_shared<LOCK_CONTEXT_MENU>();
243  lockMenu->SetTool( this );
244 
245  // Add the PCB control menus to relevant other tools
246 
248 
249  if( selTool )
250  {
251  auto& toolMenu = selTool->GetToolMenu();
252  auto& menu = toolMenu.GetMenu();
253 
254  // Add "Get and Place Footprint" when Selection tool is in an inactive state
255  menu.AddItem( PCB_ACTIONS::getAndPlace, inactiveStateCondition );
256  menu.AddSeparator();
257 
258  toolMenu.AddSubMenu( zoneMenu );
259  toolMenu.AddSubMenu( lockMenu );
260 
261  menu.AddMenu( lockMenu.get(), SELECTION_CONDITIONS::NotEmpty, 100 );
262 
263  menu.AddMenu( zoneMenu.get(), SELECTION_CONDITIONS::OnlyType( PCB_ZONE_T ), 200 );
264  }
265 
266  DRAWING_TOOL* drawingTool = m_toolMgr->GetTool<DRAWING_TOOL>();
267 
268  if( drawingTool )
269  {
270  auto& toolMenu = drawingTool->GetToolMenu();
271  auto& menu = toolMenu.GetMenu();
272 
273  toolMenu.AddSubMenu( zoneMenu );
274 
275  // Functor to say if the PCB_EDIT_FRAME is in a given mode
276  // Capture the tool pointer and tool mode by value
277  auto toolActiveFunctor =
278  [=]( DRAWING_TOOL::MODE aMode )
279  {
280  return [=]( const SELECTION& sel )
281  {
282  return drawingTool->GetDrawingMode() == aMode;
283  };
284  };
285 
286  menu.AddMenu( zoneMenu.get(), toolActiveFunctor( DRAWING_TOOL::MODE::ZONE ), 200 );
287  }
288 
289  return true;
290 }
291 
292 
294 {
296  return 0;
297 }
298 
299 
301 {
303  return 0;
304 }
305 
306 
308 {
310  return 0;
311 }
312 
313 
315 {
317  return 0;
318 }
319 
320 
322 {
324  return 0;
325 }
326 
327 
329 {
330  PICKED_ITEMS_LIST undoCmd;
331  DS_PROXY_UNDO_ITEM* undoItem = new DS_PROXY_UNDO_ITEM( m_frame );
332  ITEM_PICKER wrapper( nullptr, undoItem, UNDO_REDO::PAGESETTINGS );
333 
334  undoCmd.PushItem( wrapper );
336 
340 
341  if( dlg.ShowModal() == wxID_OK )
342  {
344  [&]( KIGFX::VIEW_ITEM* aItem ) -> bool
345  {
346  BOARD_ITEM* item = dynamic_cast<BOARD_ITEM*>( aItem );
347 
348  if( !item )
349  return false;
350 
351  switch( item->Type() )
352  {
353  case PCB_TEXT_T:
354  case PCB_FP_TEXT_T:
355  return true; // text variables
356 
357  default:
358  return false;
359  }
360  } );
361 
362  m_frame->OnModify();
363  }
364  else
365  {
367  }
368 
369  return 0;
370 }
371 
372 
374 {
376  return 0;
377 }
378 
379 
381 {
383  return 0;
384 }
385 
386 
388 {
389  m_frame->FindNext();
390  return 0;
391 }
392 
393 
395 {
396  getEditFrame<PCB_EDIT_FRAME>()->ShowBoardSetupDialog();
397  return 0;
398 }
399 
400 
402 {
403  getEditFrame<PCB_EDIT_FRAME>()->InstallNetlistFrame();
404  return 0;
405 }
406 
407 
409 {
410  wxString fullFileName = frame()->GetBoard()->GetFileName();
411  wxString path;
412  wxString name;
413  wxString ext;
414 
415  wxFileName::SplitPath( fullFileName, &path, &name, &ext );
416  name += wxT( "." ) + SpecctraSessionFileExtension;
417 
418  fullFileName = wxFileSelector( _( "Specctra Session File" ), path, name,
419  wxT( "." ) + SpecctraSessionFileExtension,
420  SpecctraSessionFileWildcard(), wxFD_OPEN | wxFD_CHANGE_DIR,
421  frame() );
422 
423  if( !fullFileName.IsEmpty() )
424  getEditFrame<PCB_EDIT_FRAME>()->ImportSpecctraSession( fullFileName );
425 
426  return 0;
427 }
428 
429 
431 {
432  wxString fullFileName = m_frame->GetLastPath( LAST_PATH_SPECCTRADSN );
433  wxFileName fn;
434 
435  if( fullFileName.IsEmpty() )
436  {
437  fn = m_frame->GetBoard()->GetFileName();
438  fn.SetExt( SpecctraDsnFileExtension );
439  }
440  else
441  {
442  fn = fullFileName;
443  }
444 
445  fullFileName = wxFileSelector( _( "Specctra DSN File" ), fn.GetPath(), fn.GetFullName(),
447  wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxFD_CHANGE_DIR, frame() );
448 
449  if( !fullFileName.IsEmpty() )
450  {
451  m_frame->SetLastPath( LAST_PATH_SPECCTRADSN, fullFileName );
452  getEditFrame<PCB_EDIT_FRAME>()->ExportSpecctraFile( fullFileName );
453  }
454 
455  return 0;
456 }
457 
458 
460 {
461  wxCHECK( m_frame, 0 );
462 
463  wxFileName fn = m_frame->Prj().GetProjectFullName();
464 
465  // Use a different file extension for the board netlist so the schematic netlist file
466  // is accidentally overwritten.
467  fn.SetExt( wxT( "pcb_net" ) );
468 
469  wxFileDialog dlg( m_frame, _( "Export Board Netlist" ), fn.GetPath(), fn.GetFullName(),
470  _( "KiCad board netlist files" ) + AddFileExtListToFilter( { "pcb_net" } ),
471  wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
472 
473  dlg.SetExtraControlCreator( &NETLIST_OPTIONS_HELPER::Create );
474 
475  if( dlg.ShowModal() == wxID_CANCEL )
476  return 0;
477 
478  fn = dlg.GetPath();
479 
480  if( !fn.IsDirWritable() )
481  {
482  wxString msg;
483 
484  msg.Printf( _( "Path `%s` is read only." ), fn.GetPath() );
485  wxMessageDialog( m_frame, msg, _( "I/O Error" ), wxOK | wxCENTER | wxICON_EXCLAMATION );
486  return 0;
487  }
488 
489  const NETLIST_OPTIONS_HELPER* noh =
490  dynamic_cast<const NETLIST_OPTIONS_HELPER*>( dlg.GetExtraControl() );
491  wxCHECK( noh, 0 );
492 
494 
495  for( const FOOTPRINT* footprint : board()->Footprints() )
496  {
497  COMPONENT* component = new COMPONENT( footprint->GetFPID(), footprint->GetReference(),
499  { footprint->m_Uuid } );
500 
501  for( const PAD* pad : footprint->Pads() )
502  {
503  const wxString& netname = pad->GetShortNetname();
504 
505  if( !netname.IsEmpty() )
506  {
507  component->AddNet( pad->GetNumber(), netname, pad->GetPinFunction(),
508  pad->GetPinType() );
509  }
510  }
511 
512  netlist.AddComponent( component );
513  }
514 
515  FILE_OUTPUTFORMATTER formatter( fn.GetFullPath() );
516 
517  netlist.Format( "pcb_netlist", &formatter, 0, noh->GetNetlistOptions() );
518 
519  return 0;
520 }
521 
522 
524 {
525  wxCommandEvent dummy;
526 
527  if( aEvent.IsAction( &PCB_ACTIONS::generateGerbers ) )
529  else if( aEvent.IsAction( &PCB_ACTIONS::generateReportFile ) )
531  else if( aEvent.IsAction( &PCB_ACTIONS::generateD356File ) )
533  else if( aEvent.IsAction( &PCB_ACTIONS::generateBOM ) )
535  else
536  wxFAIL_MSG( wxT( "GenerateFabFiles(): unexpected request" ) );
537 
538  return 0;
539 }
540 
541 
543 {
544  int errors = 0;
545  wxString details;
546  bool quiet = aEvent.Parameter<bool>();
547 
548  // Repair duplicate IDs and missing nets.
549  std::set<KIID> ids;
550  int duplicates = 0;
551 
552  auto processItem =
553  [&]( EDA_ITEM* aItem )
554  {
555  if( ids.count( aItem->m_Uuid ) )
556  {
557  duplicates++;
558  const_cast<KIID&>( aItem->m_Uuid ) = KIID();
559  }
560 
561  ids.insert( aItem->m_Uuid );
562 
563  BOARD_CONNECTED_ITEM* cItem = dynamic_cast<BOARD_CONNECTED_ITEM*>( aItem );
564 
565  if( cItem && cItem->GetNetCode() )
566  {
567  NETINFO_ITEM* netinfo = cItem->GetNet();
568 
569  if( netinfo && !board()->FindNet( netinfo->GetNetname() ) )
570  {
571  board()->Add( netinfo );
572 
573  details += wxString::Format( _( "Orphaned net %s re-parented.\n" ),
574  netinfo->GetNetname() );
575  errors++;
576  }
577  }
578  };
579 
580  // Footprint IDs are the most important, so give them the first crack at "claiming" a
581  // particular KIID.
582 
583  for( FOOTPRINT* footprint : board()->Footprints() )
584  processItem( footprint );
585 
586  // After that the principal use is for DRC marker pointers, which are most likely to pads
587  // or tracks.
588 
589  for( FOOTPRINT* footprint : board()->Footprints() )
590  {
591  for( PAD* pad : footprint->Pads() )
592  processItem( pad );
593  }
594 
595  for( PCB_TRACK* track : board()->Tracks() )
596  processItem( track );
597 
598  // From here out I don't think order matters much.
599 
600  for( FOOTPRINT* footprint : board()->Footprints() )
601  {
602  processItem( &footprint->Reference() );
603  processItem( &footprint->Value() );
604 
605  for( BOARD_ITEM* item : footprint->GraphicalItems() )
606  processItem( item );
607 
608  for( ZONE* zone : footprint->Zones() )
609  processItem( zone );
610 
611  for( PCB_GROUP* group : footprint->Groups() )
612  processItem( group );
613  }
614 
615  for( BOARD_ITEM* drawing : board()->Drawings() )
616  processItem( drawing );
617 
618  for( ZONE* zone : board()->Zones() )
619  processItem( zone );
620 
621  for( PCB_MARKER* marker : board()->Markers() )
622  processItem( marker );
623 
624  for( PCB_GROUP* group : board()->Groups() )
625  processItem( group );
626 
627  if( duplicates )
628  {
629  errors += duplicates;
630  details += wxString::Format( _( "%d duplicate IDs replaced.\n" ), duplicates );
631  }
632 
633  /*******************************
634  * Your test here
635  */
636 
637  /*******************************
638  * Inform the user
639  */
640 
641  if( errors )
642  {
643  m_frame->OnModify();
644 
645  wxString msg = wxString::Format( _( "%d potential problems repaired." ), errors );
646 
647  if( !quiet )
648  DisplayInfoMessage( m_frame, msg, details );
649  }
650  else if( !quiet )
651  {
652  DisplayInfoMessage( m_frame, _( "No board problems found." ) );
653  }
654 
655  return 0;
656 }
657 
658 
660 {
662 
663  if( m_frame->FetchNetlistFromSchematic( netlist, _( "Updating PCB requires a fully annotated "
664  "schematic." ) ) )
665  {
666  DIALOG_UPDATE_PCB updateDialog( m_frame, &netlist );
667  updateDialog.ShowModal();
668  }
669 
670  return 0;
671 }
672 
674 {
675  if( Kiface().IsSingle() )
676  {
677  DisplayErrorMessage( m_frame, _( "Cannot update schematic because Pcbnew is opened in "
678  "stand-alone mode. In order to create or update PCBs "
679  "from schematics, you must launch the KiCad project "
680  "manager and create a project." ) );
681  return 0;
682  }
683 
684  m_frame->RunEeschema();
686 
687  if( frame )
688  {
689  std::string payload;
691  }
692  return 0;
693 }
694 
695 
697 {
698  m_frame->RunEeschema();
699  return 0;
700 }
701 
702 
704 {
705  getEditFrame<PCB_EDIT_FRAME>()->ToggleLayersManager();
706  return 0;
707 }
708 
709 
711 {
713  return 0;
714 }
715 
716 
717 // Track & via size control
719 {
720  BOARD_DESIGN_SETTINGS& designSettings = getModel<BOARD>()->GetDesignSettings();
721  constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, EOT };
723 
725  {
726  BOARD_COMMIT commit( this );
727 
728  for( EDA_ITEM* item : selection )
729  {
730  if( item->Type() == PCB_TRACE_T )
731  {
732  PCB_TRACK* track = static_cast<PCB_TRACK*>( item );
733 
734  // Note: skip first entry which is the current netclass value
735  for( int i = 1; i < (int) designSettings.m_TrackWidthList.size(); ++i )
736  {
737  int candidate = designSettings.m_TrackWidthList[ i ];
738 
739  if( candidate > track->GetWidth() )
740  {
741  commit.Modify( track );
742  track->SetWidth( candidate );
743  break;
744  }
745  }
746  }
747  }
748 
749  commit.Push( wxT( "Increase Track Width" ) );
750  return 0;
751  }
752 
753  ROUTER_TOOL* routerTool = m_toolMgr->GetTool<ROUTER_TOOL>();
754 
755  if( routerTool && routerTool->IsToolActive()
756  && routerTool->Router()->Mode() == PNS::PNS_MODE_ROUTE_DIFF_PAIR )
757  {
758  int widthIndex = designSettings.GetDiffPairIndex() + 1;
759 
760  // If we go past the last track width entry in the list, start over at the beginning
761  if( widthIndex >= (int) designSettings.m_DiffPairDimensionsList.size() )
762  widthIndex = 0;
763 
764  designSettings.SetDiffPairIndex( widthIndex );
765  designSettings.UseCustomDiffPairDimensions( false );
766 
768  }
769  else
770  {
771  int widthIndex = designSettings.GetTrackWidthIndex();
772 
773  if( routerTool && routerTool->IsToolActive()
774  && routerTool->Router()->GetState() == PNS::ROUTER::RouterState::ROUTE_TRACK
775  && designSettings.m_UseConnectedTrackWidth && !designSettings.m_TempOverrideTrackWidth )
776  {
777  designSettings.m_TempOverrideTrackWidth = true;
778  }
779  else
780  {
781  widthIndex++;
782  }
783 
784  // If we go past the last track width entry in the list, start over at the beginning
785  if( widthIndex >= (int) designSettings.m_TrackWidthList.size() )
786  widthIndex = 0;
787 
788  designSettings.SetTrackWidthIndex( widthIndex );
789  designSettings.UseCustomTrackViaSize( false );
790 
792  }
793 
794  return 0;
795 }
796 
797 
799 {
800  BOARD_DESIGN_SETTINGS& designSettings = getModel<BOARD>()->GetDesignSettings();
801  constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, EOT };
803 
805  {
806  BOARD_COMMIT commit( this );
807 
808  for( EDA_ITEM* item : selection )
809  {
810  if( item->Type() == PCB_TRACE_T )
811  {
812  PCB_TRACK* track = static_cast<PCB_TRACK*>( item );
813 
814  // Note: skip first entry which is the current netclass value
815  for( int i = designSettings.m_TrackWidthList.size() - 1; i >= 1; --i )
816  {
817  int candidate = designSettings.m_TrackWidthList[ i ];
818 
819  if( candidate < track->GetWidth() )
820  {
821  commit.Modify( track );
822  track->SetWidth( candidate );
823  break;
824  }
825  }
826  }
827  }
828 
829  commit.Push( wxT( "Decrease Track Width" ) );
830  return 0;
831  }
832 
833  ROUTER_TOOL* routerTool = m_toolMgr->GetTool<ROUTER_TOOL>();
834 
835  if( routerTool && routerTool->IsToolActive()
836  && routerTool->Router()->Mode() == PNS::PNS_MODE_ROUTE_DIFF_PAIR )
837  {
838  int widthIndex = designSettings.GetDiffPairIndex() - 1;
839 
840  // If we get to the lowest entry start over at the highest
841  if( widthIndex < 0 )
842  widthIndex = designSettings.m_DiffPairDimensionsList.size() - 1;
843 
844  designSettings.SetDiffPairIndex( widthIndex );
845  designSettings.UseCustomDiffPairDimensions( false );
846 
848  }
849  else
850  {
851  int widthIndex = designSettings.GetTrackWidthIndex();
852 
853  if( routerTool && routerTool->IsToolActive()
854  && routerTool->Router()->GetState() == PNS::ROUTER::RouterState::ROUTE_TRACK
855  && designSettings.m_UseConnectedTrackWidth && !designSettings.m_TempOverrideTrackWidth )
856  {
857  designSettings.m_TempOverrideTrackWidth = true;
858  }
859  else
860  {
861  widthIndex--;
862  }
863 
864  // If we get to the lowest entry start over at the highest
865  if( widthIndex < 0 )
866  widthIndex = designSettings.m_TrackWidthList.size() - 1;
867 
868  designSettings.SetTrackWidthIndex( widthIndex );
869  designSettings.UseCustomTrackViaSize( false );
870 
872  }
873 
874  return 0;
875 }
876 
877 
879 {
880  BOARD_DESIGN_SETTINGS& designSettings = getModel<BOARD>()->GetDesignSettings();
881  constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, EOT };
883 
885  {
886  BOARD_COMMIT commit( this );
887 
888  for( EDA_ITEM* item : selection )
889  {
890  if( item->Type() == PCB_VIA_T )
891  {
892  PCB_VIA* via = static_cast<PCB_VIA*>( item );
893 
894  for( VIA_DIMENSION candidate : designSettings.m_ViasDimensionsList )
895  {
896  if( candidate.m_Diameter > via->GetWidth() )
897  {
898  commit.Modify( via );
899  via->SetWidth( candidate.m_Diameter );
900  via->SetDrill( candidate.m_Drill );
901  break;
902  }
903  }
904  }
905  }
906 
907  commit.Push( wxT( "Increase Via Size" ) );
908  }
909  else
910  {
911  int sizeIndex = designSettings.GetViaSizeIndex() + 1;
912 
913  // If we go past the last via entry in the list, start over at the beginning
914  if( sizeIndex >= (int) designSettings.m_ViasDimensionsList.size() )
915  sizeIndex = 0;
916 
917  designSettings.SetViaSizeIndex( sizeIndex );
918  designSettings.UseCustomTrackViaSize( false );
919 
921  }
922 
923  return 0;
924 }
925 
926 
928 {
929  BOARD_DESIGN_SETTINGS& designSettings = getModel<BOARD>()->GetDesignSettings();
930  constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, EOT };
932 
934  {
935  BOARD_COMMIT commit( this );
936 
937  for( EDA_ITEM* item : selection )
938  {
939  if( item->Type() == PCB_VIA_T )
940  {
941  PCB_VIA* via = static_cast<PCB_VIA*>( item );
942 
943  for( int i = designSettings.m_ViasDimensionsList.size() - 1; i >= 0; --i )
944  {
945  VIA_DIMENSION candidate = designSettings.m_ViasDimensionsList[ i ];
946 
947  if( candidate.m_Diameter < via->GetWidth() )
948  {
949  commit.Modify( via );
950  via->SetWidth( candidate.m_Diameter );
951  via->SetDrill( candidate.m_Drill );
952  break;
953  }
954  }
955  }
956  }
957 
958  commit.Push( "Decrease Via Size" );
959  }
960  else
961  {
962  int sizeIndex = 0; // Assume we only have a single via size entry
963 
964  // If there are more, cycle through them backwards
965  if( designSettings.m_ViasDimensionsList.size() > 0 )
966  {
967  sizeIndex = designSettings.GetViaSizeIndex() - 1;
968 
969  // If we get to the lowest entry start over at the highest
970  if( sizeIndex < 0 )
971  sizeIndex = designSettings.m_ViasDimensionsList.size() - 1;
972  }
973 
974  designSettings.SetViaSizeIndex( sizeIndex );
975  designSettings.UseCustomTrackViaSize( false );
976 
978  }
979 
980  return 0;
981 }
982 
983 
985 {
986  if( m_inPlaceFootprint )
987  return 0;
988 
990 
991  FOOTPRINT* fp = aEvent.Parameter<FOOTPRINT*>();
993  BOARD_COMMIT commit( m_frame );
994  BOARD* board = getModel<BOARD>();
995 
997 
998  std::string tool = aEvent.GetCommandStr().get();
999  m_frame->PushTool( tool );
1000 
1001  auto setCursor =
1002  [&]()
1003  {
1005  };
1006 
1007  Activate();
1008  // Must be done after Activate() so that it gets set into the correct context
1009  controls->ShowCursor( true );
1010  // Set initial cursor
1011  setCursor();
1012 
1013  VECTOR2I cursorPos = controls->GetCursorPosition();
1014  bool reselect = false;
1015  bool fromOtherCommand = fp != nullptr;
1016  bool resetCursor = aEvent.HasPosition(); // Detect if activated from a hotkey.
1017 
1018  // Prime the pump
1019  if( fp )
1020  {
1021  m_placingFootprint = true;
1022  fp->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
1025  }
1026  else if( !aEvent.IsReactivate() )
1027  {
1029  }
1030 
1031  // Main loop: keep receiving events
1032  while( TOOL_EVENT* evt = Wait() )
1033  {
1034  setCursor();
1035  cursorPos = controls->GetCursorPosition( !evt->DisableGridSnapping() );
1036 
1037  if( reselect && fp )
1039 
1040  auto cleanup =
1041  [&] ()
1042  {
1044  commit.Revert();
1045 
1046  if( fromOtherCommand )
1047  {
1049 
1050  if( undo )
1051  {
1053  undo->ClearListAndDeleteItems();
1054  delete undo;
1055  }
1056  }
1057 
1058  fp = nullptr;
1059  m_placingFootprint = false;
1060  };
1061 
1062  if( evt->IsCancelInteractive() )
1063  {
1064  if( fp )
1065  {
1066  cleanup();
1067  }
1068  else
1069  {
1070  m_frame->PopTool( tool );
1071  break;
1072  }
1073  }
1074  else if( evt->IsActivate() )
1075  {
1076  if( fp )
1077  cleanup();
1078 
1079  if( evt->IsMoveTool() )
1080  {
1081  // leave ourselves on the stack so we come back after the move
1082  break;
1083  }
1084  else
1085  {
1086  frame()->PopTool( tool );
1087  break;
1088  }
1089  }
1090  else if( evt->IsClick( BUT_LEFT ) )
1091  {
1092  if( !fp )
1093  {
1094  // Pick the footprint to be placed
1096 
1097  if( fp == nullptr )
1098  continue;
1099 
1100  m_placingFootprint = true;
1101 
1102  fp->SetLink( niluuid );
1103 
1104  fp->SetFlags(IS_NEW ); // whatever
1105 
1106  // Set parent so that clearance can be loaded
1107  fp->SetParent( board );
1108 
1109  for( PAD* pad : fp->Pads() )
1110  {
1111  pad->SetLocalRatsnestVisible( m_frame->GetDisplayOptions().m_ShowGlobalRatsnest );
1112 
1113  // Pads in the library all have orphaned nets. Replace with Default.
1114  pad->SetNetCode( 0 );
1115  }
1116 
1117  // Put it on FRONT layer,
1118  // (Can be stored flipped if the lib is an archive built from a board)
1119  if( fp->IsFlipped() )
1120  fp->Flip( fp->GetPosition(), m_frame->Settings().m_FlipLeftRight );
1121 
1122  fp->SetOrientation( 0 );
1123  fp->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
1124 
1125  commit.Add( fp );
1127 
1128  // Reset cursor to the position before the dialog opened if activated from hotkey
1129  if( resetCursor )
1130  controls->SetCursorPosition( cursorPos, false );
1131 
1132  // Other events must be from hotkeys or mouse clicks, so always reset cursor
1133  resetCursor = true;
1134 
1136  }
1137  else
1138  {
1140  commit.Push( _( "Place a footprint" ) );
1141  fp = nullptr; // to indicate that there is no footprint that we currently modify
1142  m_placingFootprint = false;
1143  }
1144  }
1145  else if( evt->IsClick( BUT_RIGHT ) )
1146  {
1148  }
1149  else if( fp && ( evt->IsMotion() || evt->IsAction( &ACTIONS::refreshPreview ) ) )
1150  {
1151  fp->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
1152  selection().SetReferencePoint( cursorPos );
1153  getView()->Update( &selection() );
1154  getView()->Update( fp );
1155  }
1156  else if( fp && evt->IsAction( &PCB_ACTIONS::properties ) )
1157  {
1158  // Calling 'Properties' action clears the selection, so we need to restore it
1159  reselect = true;
1160  }
1161  else
1162  {
1163  evt->SetPassEvent();
1164  }
1165 
1166  // Enable autopanning and cursor capture only when there is a footprint to be placed
1167  controls->SetAutoPan( fp != nullptr );
1168  controls->CaptureCursor( fp != nullptr );
1169  }
1170 
1171  controls->SetAutoPan( false );
1172  controls->CaptureCursor( false );
1174 
1175  return 0;
1176 }
1177 
1178 
1180 {
1181  return modifyLockSelected( TOGGLE );
1182 }
1183 
1184 
1186 {
1187  return modifyLockSelected( ON );
1188 }
1189 
1190 
1192 {
1193  return modifyLockSelected( OFF );
1194 }
1195 
1196 
1198 {
1200  const PCB_SELECTION& selection = selTool->GetSelection();
1201  BOARD_COMMIT commit( m_frame );
1202 
1203  if( selection.Empty() )
1205 
1206  // Resolve TOGGLE mode
1207  if( aMode == TOGGLE )
1208  {
1209  aMode = ON;
1210 
1211  for( EDA_ITEM* item : selection )
1212  {
1213  BOARD_ITEM* board_item = static_cast<BOARD_ITEM*>( item );
1214 
1215  if( board_item->IsLocked() )
1216  {
1217  aMode = OFF;
1218  break;
1219  }
1220  }
1221  }
1222 
1223  bool modified = false;
1224 
1225  for( EDA_ITEM* item : selection )
1226  {
1227  BOARD_ITEM* board_item = static_cast<BOARD_ITEM*>( item );
1228 
1229  commit.Modify( board_item );
1230 
1231  if( aMode == ON )
1232  {
1233  modified |= !board_item->IsLocked();
1234  board_item->SetLocked( true );
1235  }
1236  else
1237  {
1238  modified |= board_item->IsLocked();
1239  board_item->SetLocked( false );
1240  }
1241  }
1242 
1243  if( modified )
1244  {
1245  commit.Push( aMode == ON ? _( "Lock" ) : _( "Unlock" ) );
1246 
1249  m_frame->OnModify();
1250  }
1251 
1252  return 0;
1253 }
1254 
1255 
1257 {
1258  if( m_inPlaceTarget )
1259  return 0;
1260 
1262 
1263  KIGFX::VIEW* view = getView();
1265  BOARD* board = getModel<BOARD>();
1266  PCB_TARGET* target = new PCB_TARGET( board );
1267 
1268  // Init the new item attributes
1269  target->SetLayer( Edge_Cuts );
1271  target->SetSize( Millimeter2iu( 5 ) );
1272  VECTOR2I cursorPos = controls->GetCursorPosition();
1273  target->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
1274 
1275  // Add a VIEW_GROUP that serves as a preview for the new item
1276  KIGFX::VIEW_GROUP preview( view );
1277  preview.Add( target );
1278  view->Add( &preview );
1279 
1281 
1282  std::string tool = aEvent.GetCommandStr().get();
1283  m_frame->PushTool( tool );
1284  Activate();
1285 
1286  auto setCursor =
1287  [&]()
1288  {
1290  };
1291 
1292  // Set initial cursor
1293  setCursor();
1294 
1295  // Main loop: keep receiving events
1296  while( TOOL_EVENT* evt = Wait() )
1297  {
1298  setCursor();
1299  cursorPos = controls->GetCursorPosition( !evt->DisableGridSnapping() );
1300 
1301  if( evt->IsCancelInteractive() )
1302  {
1303  frame()->PopTool( tool );
1304  break;
1305  }
1306  else if( evt->IsActivate() )
1307  {
1308  if( evt->IsMoveTool() )
1309  {
1310  // leave ourselves on the stack so we come back after the move
1311  break;
1312  }
1313  else
1314  {
1315  frame()->PopTool( tool );
1316  break;
1317  }
1318  }
1319  else if( evt->IsAction( &PCB_ACTIONS::incWidth ) )
1320  {
1321  target->SetWidth( target->GetWidth() + WIDTH_STEP );
1322  view->Update( &preview );
1323  }
1324  else if( evt->IsAction( &PCB_ACTIONS::decWidth ) )
1325  {
1326  int width = target->GetWidth();
1327 
1328  if( width > WIDTH_STEP )
1329  {
1330  target->SetWidth( width - WIDTH_STEP );
1331  view->Update( &preview );
1332  }
1333  }
1334  else if( evt->IsClick( BUT_LEFT ) )
1335  {
1336  assert( target->GetSize() > 0 );
1337  assert( target->GetWidth() > 0 );
1338 
1339  BOARD_COMMIT commit( m_frame );
1340  commit.Add( target );
1341  commit.Push( wxT( "Place a layer alignment target" ) );
1342 
1343  preview.Remove( target );
1344 
1345  // Create next PCB_TARGET
1346  target = new PCB_TARGET( *target );
1347  preview.Add( target );
1348  }
1349  else if( evt->IsClick( BUT_RIGHT ) )
1350  {
1352  }
1353  else if( evt->IsMotion() )
1354  {
1355  target->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
1356  view->Update( &preview );
1357  }
1358  else
1359  {
1360  evt->SetPassEvent();
1361  }
1362  }
1363 
1364  preview.Clear();
1365  delete target;
1366  view->Remove( &preview );
1367 
1369 
1370  return 0;
1371 }
1372 
1373 
1374 static bool mergeZones( EDA_DRAW_FRAME* aFrame, BOARD_COMMIT& aCommit,
1375  std::vector<ZONE*>& aOriginZones, std::vector<ZONE*>& aMergedZones )
1376 {
1377  aCommit.Modify( aOriginZones[0] );
1378 
1379  for( unsigned int i = 1; i < aOriginZones.size(); i++ )
1380  {
1381  aOriginZones[0]->Outline()->BooleanAdd( *aOriginZones[i]->Outline(),
1383  }
1384 
1385  aOriginZones[0]->Outline()->Simplify( SHAPE_POLY_SET::PM_FAST );
1386 
1387  // We should have one polygon, possibly with holes. If we end up with two polygons (either
1388  // because the intersection was a single point or because the intersection was within one of
1389  // the zone's holes) then we can't merge.
1390  if( aOriginZones[0]->Outline()->IsSelfIntersecting()
1391  || aOriginZones[0]->Outline()->OutlineCount() > 1 )
1392  {
1393  DisplayErrorMessage( aFrame, _( "Zones have insufficient overlap for merging." ) );
1394  aCommit.Revert();
1395  return false;
1396  }
1397 
1398  for( unsigned int i = 1; i < aOriginZones.size(); i++ )
1399  aCommit.Remove( aOriginZones[i] );
1400 
1401  aMergedZones.push_back( aOriginZones[0] );
1402 
1403  aOriginZones[0]->SetLocalFlags( 1 );
1404  aOriginZones[0]->HatchBorder();
1405  aOriginZones[0]->CacheTriangulation();
1406 
1407  return true;
1408 }
1409 
1410 
1412 {
1413  const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1414  BOARD* board = getModel<BOARD>();
1415  BOARD_COMMIT commit( m_frame );
1416 
1417  if( selection.Size() < 2 )
1418  return 0;
1419 
1420  int netcode = -1;
1421 
1422  ZONE* firstZone = nullptr;
1423  std::vector<ZONE*> toMerge, merged;
1424 
1425  for( EDA_ITEM* item : selection )
1426  {
1427  ZONE* curr_area = dynamic_cast<ZONE*>( item );
1428 
1429  if( !curr_area )
1430  continue;
1431 
1432  if( !firstZone )
1433  firstZone = curr_area;
1434 
1435  netcode = curr_area->GetNetCode();
1436 
1437  if( firstZone->GetNetCode() != netcode )
1438  {
1439  wxLogMessage( _( "Some zone netcodes did not match and were not merged." ) );
1440  continue;
1441  }
1442 
1443  if( curr_area->GetPriority() != firstZone->GetPriority() )
1444  {
1445  wxLogMessage( _( "Some zone priorities did not match and were not merged." ) );
1446  continue;
1447  }
1448 
1449  if( curr_area->GetIsRuleArea() != firstZone->GetIsRuleArea() )
1450  {
1451  wxLogMessage( _( "Some zones were rule areas and were not merged." ) );
1452  continue;
1453  }
1454 
1455  if( curr_area->GetLayer() != firstZone->GetLayer() )
1456  {
1457  wxLogMessage( _( "Some zone layer sets did not match and were not merged." ) );
1458  continue;
1459  }
1460 
1461  if( !board->TestZoneIntersection( curr_area, firstZone ) )
1462  {
1463  wxLogMessage( _( "Some zones did not intersect and were not merged." ) );
1464  continue;
1465  }
1466 
1467  toMerge.push_back( curr_area );
1468  }
1469 
1471 
1472  if( mergeZones( m_frame, commit, toMerge, merged ) )
1473  {
1474  commit.Push( wxT( "Merge zones" ) );
1475 
1476  for( EDA_ITEM* item : merged )
1478  }
1479 
1480  return 0;
1481 }
1482 
1483 
1485 {
1487  const PCB_SELECTION& selection = selTool->GetSelection();
1488 
1489  // because this pops up the zone editor, it would be confusing to handle multiple zones,
1490  // so just handle single selections containing exactly one zone
1491  if( selection.Size() != 1 )
1492  return 0;
1493 
1494  ZONE* oldZone = dyn_cast<ZONE*>( selection[0] );
1495 
1496  if( !oldZone )
1497  return 0;
1498 
1499  ZONE_SETTINGS zoneSettings;
1500  zoneSettings << *oldZone;
1501  int dialogResult;
1502 
1503  if( oldZone->GetIsRuleArea() )
1504  dialogResult = InvokeRuleAreaEditor( m_frame, &zoneSettings );
1505  else if( oldZone->IsOnCopperLayer() )
1506  dialogResult = InvokeCopperZonesEditor( m_frame, &zoneSettings );
1507  else
1508  dialogResult = InvokeNonCopperZonesEditor( m_frame, &zoneSettings );
1509 
1510  if( dialogResult != wxID_OK )
1511  return 0;
1512 
1513  // duplicate the zone
1514  BOARD_COMMIT commit( m_frame );
1515 
1516  std::unique_ptr<ZONE> newZone = std::make_unique<ZONE>( *oldZone );
1517  newZone->ClearSelected();
1518  newZone->UnFill();
1519  zoneSettings.ExportSetting( *newZone );
1520 
1521  // If the new zone is on the same layer(s) as the initial zone,
1522  // offset it a bit so it can more easily be picked.
1523  if( oldZone->GetIsRuleArea() && ( oldZone->GetLayerSet() == zoneSettings.m_Layers ) )
1524  newZone->Move( wxPoint( IU_PER_MM, IU_PER_MM ) );
1525  else if( !oldZone->GetIsRuleArea() && zoneSettings.m_Layers.test( oldZone->GetLayer() ) )
1526  newZone->Move( wxPoint( IU_PER_MM, IU_PER_MM ) );
1527 
1528  commit.Add( newZone.release() );
1529  commit.Push( _( "Duplicate zone" ) );
1530 
1531  return 0;
1532 }
1533 
1534 
1536 {
1539 
1540  if( selection.Empty() )
1541  return 0;
1542 
1544 
1545  if( !fp )
1546  return 0;
1547 
1548  PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
1549 
1550  auto editor = (FOOTPRINT_EDIT_FRAME*) editFrame->Kiway().Player( FRAME_FOOTPRINT_EDITOR, true );
1551 
1552  if( aEvent.IsAction( &PCB_ACTIONS::editFpInFpEditor ) )
1553  editor->LoadFootprintFromBoard( fp );
1554  else if( aEvent.IsAction( &PCB_ACTIONS::editLibFpInFpEditor ) )
1555  editor->LoadFootprintFromLibrary( fp->GetFPID() );
1556 
1557  editor->Show( true );
1558  editor->Raise(); // Iconize( false );
1559 
1560  if( selection.IsHover() )
1562 
1563  return 0;
1564 }
1565 
1566 
1568  EDA_ITEM* originViewItem, const VECTOR2D& aPosition )
1569 {
1570  aFrame->GetDesignSettings().SetAuxOrigin( wxPoint( aPosition ) );
1571  originViewItem->SetPosition( (wxPoint) aPosition );
1572  aView->MarkDirty();
1573  aFrame->OnModify();
1574 }
1575 
1576 
1578 {
1579  std::string tool = aEvent.GetCommandStr().get();
1581 
1582  // Deactivate other tools; particularly important if another PICKER is currently running
1583  Activate();
1584 
1585  picker->SetClickHandler(
1586  [this] ( const VECTOR2D& pt ) -> bool
1587  {
1589  DoSetDrillOrigin( getView(), m_frame, m_placeOrigin.get(), pt );
1590  return false; // drill origin is a one-shot; don't continue with tool
1591  } );
1592 
1593  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
1594 
1595  return 0;
1596 }
1597 
1598 
1600 {
1601  Go( &BOARD_EDITOR_CONTROL::New, ACTIONS::doNew.MakeEvent() );
1602  Go( &BOARD_EDITOR_CONTROL::Open, ACTIONS::open.MakeEvent() );
1603  Go( &BOARD_EDITOR_CONTROL::Save, ACTIONS::save.MakeEvent() );
1607  Go( &BOARD_EDITOR_CONTROL::Plot, ACTIONS::plot.MakeEvent() );
1608 
1609  Go( &BOARD_EDITOR_CONTROL::Find, ACTIONS::find.MakeEvent() );
1611 
1615  PCB_ACTIONS::importSpecctraSession.MakeEvent() );
1617 
1618  if( ADVANCED_CFG::GetCfg().m_ShowPcbnewExportNetlist && m_frame &&
1621 
1623  PCB_ACTIONS::generateDrillFiles.MakeEvent() );
1627  PCB_ACTIONS::generateReportFile.MakeEvent() );
1630 
1631  // Track & via size control
1636 
1637  // Zone actions
1640 
1641  // Placing tools
1645 
1648 
1649  // Other
1653 
1655  ACTIONS::updatePcbFromSchematic.MakeEvent() );
1657  ACTIONS::updateSchematicFromPcb.MakeEvent() );
1662 }
1663 
1664 
1665 const int BOARD_EDITOR_CONTROL::WIDTH_STEP = 100000;
int Open(const TOOL_EVENT &aEvent)
int LockSelected(const TOOL_EVENT &aEvent)
Unlock selected items.
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: pcb_actions.h:59
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
static TOOL_ACTION toggleLock
Definition: pcb_actions.h:423
void RollbackFromUndo()
Perform an undo of the last edit without logging a corresponding redo.
Definition: undo_redo.cpp:576
Container to handle a stock of specific vias each with unique diameter and drill sizes in the BOARD c...
void OnModify() override
Must be called after a board change to set the modified flag.
int Find(const TOOL_EVENT &aEvent)
bool IsCurrentTool(const TOOL_ACTION &aAction) const
#define CTL_OMIT_FP_UUID
Don't prefix the footprint UUID to the sheet path.
Definition: pcb_netlist.h:283
COMMIT & Modify(EDA_ITEM *aItem)
Create an undo entry for an item that has been already modified.
Definition: commit.h:103
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:64
static const TOOL_EVENT SelectedEvent
Definition: actions.h:200
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
void SetTrackWidthIndex(unsigned aIndex)
Set the current track width list index to aIndex.
int New(const TOOL_EVENT &aEvent)
static TOOL_ACTION unlock
Definition: pcb_actions.h:425
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
KIID niluuid(0)
bool IsHover() const
Definition: selection.h:74
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
NETLIST_OPTIONS_HELPER(wxWindow *aParent)
void SaveCopyInUndoList(EDA_ITEM *aItemToCopy, UNDO_REDO aTypeCommand) override
Create a new entry in undo list of commands.
Definition: undo_redo.cpp:179
void UpdateAllItemsConditionally(int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
Update items in the view according to the given flags and condition.
Definition: view.cpp:1492
static TOOL_ACTION generateGerbers
Definition: pcb_actions.h:334
ZONES & Zones()
Definition: board.h:240
int ExportSpecctraDSN(const TOOL_EVENT &aEvent)
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Suspend execution of the tool until an event specified in aEventList arrives.
const wxString & GetValue() const
Definition: footprint.h:485
BOARD * board() const
static TOOL_ACTION editFpInFpEditor
Definition: pcb_actions.h:344
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:292
static TOOL_ACTION pageSettings
Definition: actions.h:56
int TrackWidthInc(const TOOL_EVENT &aEvent)
static TOOL_ACTION incWidth
Increase width of currently drawn line.
Definition: pcb_actions.h:164
const KIID_PATH & GetPath() const
Definition: footprint.h:204
Model changes (required full reload)
Definition: tool_base.h:80
unsigned GetPriority() const
Definition: zone.h:122
static TOOL_ACTION drawSimilarZone
Definition: pcb_actions.h:153
#define IS_NEW
New item, just created.
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:735
static TOOL_ACTION drillOrigin
Definition: pcb_actions.h:438
bool Init() override
Init() is called once upon a registration of the tool.
FOOTPRINT * SelectFootprintFromLibTree(LIB_ID aPreselect=LIB_ID())
Open a dialog to select a footprint.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:164
static TOOL_ACTION lock
Definition: pcb_actions.h:424
Defines the structure of a menu based on ACTIONs.
Definition: action_menu.h:48
This file is part of the common library.
virtual void SetPosition(const wxPoint &aPos)
Definition: eda_item.h:252
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
static TOOL_ACTION zoneFillAll
Definition: pcb_actions.h:303
static TOOL_ACTION viaSizeInc
Definition: pcb_actions.h:296
std::vector< int > m_TrackWidthList
void ToPlotter(int aID)
Open a dialog frame to create plot and drill files relative to the current board.
static void DoSetDrillOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, EDA_ITEM *aItem, const VECTOR2D &aPoint)
void SetSize(int aSize)
Definition: pcb_target.h:61
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
COMMIT & Add(EDA_ITEM *aItem)
Notify observers that aItem has been added.
Definition: commit.h:78
NETINFO_ITEM * GetNet() const
Return #NET_INFO object for a given item.
static constexpr double IU_PER_MM
Mock up a conversion function.
GROUPS & Groups()
The groups must maintain the following invariants.
Definition: board.h:254
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:50
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
int GetSize() const
Definition: pcb_target.h:62
static SELECTION_CONDITION OnlyTypes(const KICAD_T aTypes[])
Create a functor that tests if the selected items are only of given types.
#define CTL_OMIT_NETS
Definition: pcb_netlist.h:281
int InvokeNonCopperZonesEditor(PCB_BASE_FRAME *aParent, ZONE_SETTINGS *aSettings)
Function InvokeNonCopperZonesEditor invokes up a modal dialog window for non-copper zone editing.
int Plot(const TOOL_EVENT &aEvent)
virtual void Revert() override
MARKERS & Markers()
Definition: board.h:243
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:46
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
void UseCustomDiffPairDimensions(bool aEnabled)
Enables/disables custom differential pair dimensions.
static bool mergeZones(EDA_DRAW_FRAME *aFrame, BOARD_COMMIT &aCommit, std::vector< ZONE * > &aOriginZones, std::vector< ZONE * > &aMergedZones)
static TOOL_ACTION cancelInteractive
Definition: actions.h:62
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:350
static TOOL_ACTION properties
Activation of the edit tool.
Definition: pcb_actions.h:117
void SetWksFileName(const wxString &aFilename)
int GeneratePosFile(const TOOL_EVENT &aEvent)
void RecreateBOMFileFromBoard(wxCommandEvent &aEvent)
Create a BOM file from the current loaded board.
static TOOL_ACTION trackWidthDec
Definition: pcb_actions.h:295
void setTransitions() override
This method is meant to be overridden in order to specify handlers for events.
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:152
TOOL_MENU & GetToolMenu()
class PCB_TEXT, text on a layer
Definition: typeinfo.h:91
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
static TOOL_ACTION getAndPlace
Find an item and start moving.
Definition: pcb_actions.h:468
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:299
static TOOL_ACTION showPythonConsole
Definition: pcb_actions.h:348
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:393
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
Definition: kiway.cpp:487
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false, long aArrowCommand=0)=0
Move cursor to the requested position expressed in world coordinates.
void PushItem(const ITEM_PICKER &aItem)
Push aItem to the top of the list.
static TOOL_ACTION showLayersManager
Definition: pcb_actions.h:347
static TOOL_ACTION updatePcbFromSchematic
Definition: actions.h:163
virtual void Clear()
Remove all the stored items from the group.
Definition: view_group.cpp:69
bool FetchNetlistFromSchematic(NETLIST &aNetlist, const wxString &aAnnotateMessage)
virtual void SetLocked(bool aLocked)
Modify the 'lock' status for of the item.
Definition: board_item.h:218
int GetWidth() const
Definition: pcb_track.h:102
int ImportNetlist(const TOOL_EVENT &aEvent)
void ScriptingConsoleEnableDisable()
Toggles the scripting console visibility.
An abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:76
static TOOL_ACTION find
Definition: actions.h:76
The base class for create windows for drawing purpose.
void PutDataInPreviousState(PICKED_ITEMS_LIST *aList)
Used in undo or redo command.
Definition: undo_redo.cpp:373
virtual bool IsLocked() const
Definition: board_item.cpp:64
const wxString & GetFileName() const
Definition: board.h:229
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
bool TestZoneIntersection(ZONE *aZone1, ZONE *aZone2)
Test for intersection of 2 copper areas.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
static bool NotEmpty(const SELECTION &aSelection)
Test if there are any items selected.
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).
static TOOL_ACTION generateReportFile
Definition: pcb_actions.h:337
static TOOL_ACTION zoneFill
Definition: pcb_actions.h:302
wxString GetLastPath(LAST_PATH_TYPE aType)
Get the last path for a particular type.
virtual void Remove(VIEW_ITEM *aItem) override
Remove a VIEW_ITEM from the view.
Definition: pcb_view.cpp:75
int PageSettings(const TOOL_EVENT &aEvent)
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:115
static TOOL_ACTION generateD356File
Definition: pcb_actions.h:338
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
PADS & Pads()
Definition: footprint.h:169
static TOOL_ACTION decWidth
Decrease width of currently drawn line.
Definition: pcb_actions.h:167
static TOOL_ACTION saveCopyAs
Definition: actions.h:53
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:88
FP_TEXT & Value()
read/write accessors:
Definition: footprint.h:499
int modifyLockSelected(MODIFY_MODE aMode)
Set up handlers for various events.
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_placeOrigin
static TOOL_ACTION pickerTool
Definition: actions.h:155
FP_TEXT & Reference()
Definition: footprint.h:500
PCB_BASE_EDIT_FRAME * frame() const
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:72
int GetLineThickness(PCB_LAYER_ID aLayer) const
Return the default graphic segment thickness from the layer class for the given layer.
void SetViaSizeIndex(unsigned aIndex)
Set the current via size list index to aIndex.
PCB_SELECTION & GetSelection()
Return the set of currently selected items.
FP_ZONES & Zones()
Definition: footprint.h:175
static TOOL_ACTION trackWidthInc
Definition: pcb_actions.h:294
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Adds an item to the container.
Definition: board.cpp:608
Definition: kiid.h:44
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:192
int GetWidth() const
Definition: pcb_target.h:65
int DrillOrigin(const TOOL_EVENT &aEvent)
Low-level access (below undo) to setting the drill origin.
int ZoneDuplicate(const TOOL_EVENT &aEvent)
void GenFootprintsReport(wxCommandEvent &event)
Call DoGenFootprintsReport to create a footprint report file.
static TOOL_ACTION updateSchematicFromPcb
Definition: actions.h:164
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: pcb_view.cpp:92
wxString SpecctraSessionFileWildcard()
int EditFpInFpEditor(const TOOL_EVENT &aEvent)
Item needs to be redrawn.
Definition: view_item.h:52
void SetAuxOrigin(const wxPoint &aOrigin)
const PCB_SELECTION & selection() const
int ViaSizeInc(const TOOL_EVENT &aEvent)
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
Definition: pcb_netlist.h:206
int UpdatePCBFromSchematic(const TOOL_EVENT &aEvent)
static TOOL_ACTION importNetlist
Definition: pcb_actions.h:329
#define MAX_PAGE_SIZE_PCBNEW_MILS
Definition: page_info.h:40
int UnlockSelected(const TOOL_EVENT &aEvent)
Run the drill origin tool for setting the origin for drill and pick-and-place files.
void ExportSetting(ZONE &aTarget, bool aFullExport=true) const
Function ExportSetting copy settings to a given zone.
Tool responsible for drawing graphical elements like lines, arcs, circles, etc.
Definition: drawing_tool.h:50
unsigned GetViaSizeIndex() const
virtual void PopTool(const std::string &actionName)
virtual void CaptureCursor(bool aEnabled)
Force the cursor to stay within the drawing panel area.
virtual PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: zone.cpp:222
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
static TOOL_ACTION open
Definition: actions.h:50
static const int WIDTH_STEP
How does line width change after one -/+ key press.
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
void SetOrientation(double aNewAngle)
Definition: footprint.cpp:1681
static TOOL_ACTION save
Definition: actions.h:51
static TOOL_ACTION doNew
Definition: actions.h:44
FOOTPRINTS & Footprints()
Definition: board.h:234
void SetPosition(const wxPoint &aPos) override
Definition: pcb_target.h:55
Generic, UI-independent tool event.
Definition: tool_event.h:152
int BoardSetup(const TOOL_EVENT &aEvent)
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:1491
static TOOL_ACTION zoneMerge
Definition: pcb_actions.h:306
FOOTPRINT * footprint() const
unsigned GetTrackWidthIndex() const
KIGFX::PCB_VIEW * view() const
Definition of file extensions used in Kicad.
bool ToolStackIsEmpty()
Definition: tools_holder.h:116
const wxString & GetNetname() const
Definition: netinfo.h:126
virtual PICKED_ITEMS_LIST * PopCommandFromUndoList()
Return the last command to undo and remove it from list, nothing is deleted.
Extend VIEW_ITEM by possibility of grouping items into a single object.
Definition: view_group.h:46
An interface for classes handling user events controlling the view behavior such as zooming,...
int SaveAs(const TOOL_EVENT &aEvent)
const wxString & GetReference() const
Definition: footprint.h:463
#define _(s)
virtual void Remove(VIEW_ITEM *aItem)
Remove an item from the group.
Definition: view_group.cpp:63
DRAWINGS & GraphicalItems()
Definition: footprint.h:172
int Save(const TOOL_EVENT &aEvent)
static TOOL_ACTION plot
Definition: actions.h:58
const LIB_ID & GetFPID() const
Definition: footprint.h:195
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
class ZONE, a copper pour area
Definition: typeinfo.h:105
COMMIT & Remove(EDA_ITEM *aItem)
Notify observers that aItem has been removed.
Definition: commit.h:90
int RepairBoard(const TOOL_EVENT &aEvent)
void SetDiffPairIndex(unsigned aIndex)
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
Definition: project.cpp:116
A holder to handle information on schematic or board items.
static TOOL_ACTION showEeschema
Definition: pcb_actions.h:441
virtual void Add(VIEW_ITEM *aItem)
Add an item to the group.
Definition: view_group.cpp:57
int FindNext(const TOOL_EVENT &aEvent)
static TOOL_ACTION generatePosFile
Definition: pcb_actions.h:336
static TOOL_ACTION drawZoneCutout
Definition: pcb_actions.h:152
MODIFY_MODE
< How to modify a property for selected items.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
static TOOL_ACTION placeTarget
Definition: pcb_actions.h:155
int ShowEeschema(const TOOL_EVENT &aEvent)
const std::string SpecctraSessionFileExtension
const std::string SpecctraDsnFileExtension
static TOOL_ACTION zoneUnfillAll
Definition: pcb_actions.h:305
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
int InvokeRuleAreaEditor(PCB_BASE_FRAME *aCaller, ZONE_SETTINGS *aSettings)
Function InvokeRuleAreaEditor invokes up a modal dialog window for copper zone editing.
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
static TOOL_ACTION boardSetup
Definition: pcb_actions.h:316
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:98
Generic tool for picking an item.
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:84
static TOOL_ACTION zoneUnfill
Definition: pcb_actions.h:304
ZONE_SETTINGS handles zones parameters.
Definition: zone_settings.h:67
const KIID m_Uuid
Definition: eda_item.h:474
void SetClickHandler(CLICK_HANDLER aHandler)
Set a handler for mouse click event.
Definition: picker_tool.h:71
static TOOL_ACTION importSpecctraSession
Definition: pcb_actions.h:331
int ExportNetlist(const TOOL_EVENT &aEvent)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:460
static TOOL_ACTION zoneDuplicate
Duplicate zone onto another layer.
Definition: pcb_actions.h:309
bool IsFlipped() const
Definition: footprint.h:278
TOOL_ACTION * GetExportNetlistAction()
FP_GROUPS & Groups()
Definition: footprint.h:178
int ImportSpecctraSession(const TOOL_EVENT &aEvent)
void SetWidth(int aWidth)
Definition: pcb_track.h:101
static TOOL_ACTION generateBOM
Definition: pcb_actions.h:339
void SetLink(const KIID &aLink)
Definition: footprint.h:576
void Reset(RESET_REASON aReason) override
Bring the tool to a known, initial state.
virtual void OnModify()
Must be called after a change in order to set the "modify" flag of the current screen and update the ...
Handle the data for a net.
Definition: netinfo.h:66
int ZoneMerge(const TOOL_EVENT &aEvent)
Duplicate a zone onto a layer (prompts for new layer)
static TOOL_ACTION placeFootprint
Definition: pcb_actions.h:157
static TOOL_ACTION exportSpecctraDSN
Definition: pcb_actions.h:332
PCB_SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter, bool aConfirmLockedItems=false)
Return the current selection set, filtered according to aFlags and aClientFilter.
KIGFX::VIEW_CONTROLS * controls() const
const char * name
Definition: DXF_plotter.cpp:56
Common, abstract interface for edit frames.
static TOOL_ACTION saveAs
Definition: actions.h:52
void GenD356File(wxCommandEvent &event)
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
static wxString m_DrawingSheetFileName
the name of the drawing sheet file, or empty to use the default drawing sheet
Definition: base_screen.h:85
static TOOL_ACTION repairBoard
Definition: pcb_actions.h:444
bool IsToolActive() const
Definition: tool_base.cpp:31
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
Definition: pcb_actions.h:62
int PlaceFootprint(const TOOL_EVENT &aEvent)
Display a dialog to select a footprint to be added and allows the user to set its position.
static SELECTION_CONDITION OnlyType(KICAD_T aType)
Create a functor that tests if the selected items are only of given type.
int ToggleLockSelected(const TOOL_EVENT &aEvent)
Lock selected items.
PCBNEW_SETTINGS & Settings()
TOOL_EVENT MakeEvent() const
Return the event associated with the action (i.e.
Definition: tool_action.cpp:72
int Size() const
Returns the number of selected parts.
Definition: selection.h:104
The selection tool: currently supports:
#define IU_PER_MILS
Definition: plotter.cpp:130
int TogglePythonConsole(const TOOL_EVENT &aEvent)
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
void AddNet(const wxString &aPinName, const wxString &aNetName, const wxString &aPinFunction, const wxString &aPinType)
Definition: pcb_netlist.h:103
virtual void Push(const wxString &aMessage=wxT("A commit"), bool aCreateUndoEntry=true, bool aSetDirtyBit=true) override
Revert the commit by restoring the modified items state.
wxPoint GetPosition() const override
Definition: footprint.h:187
static TOOL_ACTION editLibFpInFpEditor
Definition: pcb_actions.h:345
RESET_REASON
Determine the reason of reset for a tool.
Definition: tool_base.h:77
std::vector< VIA_DIMENSION > m_ViasDimensionsList
Used for text file output.
Definition: richio.h:456
T * FirstOfKind() const
Definition: selection.h:156
bool IsReactivate() const
Definition: tool_event.h:252
void SetWidth(int aWidth)
Definition: pcb_target.h:64
void ShowFindDialog()
Show the Find dialog.
int InvokeCopperZonesEditor(PCB_BASE_FRAME *aCaller, ZONE_SETTINGS *aSettings)
Function InvokeCopperZonesEditor invokes up a modal dialog window for copper zone editing.
bool Files_io_from_id(int aId)
Read and write board files according to aId.
void Activate()
Run the tool.
Definition: id.h:96
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
void FindNext()
Find the next item using our existing search parameters.
wxString SpecctraDsnFileWildcard()
ACTION_MENU * create() const override
< Return an instance of this class. It has to be overridden in inheriting classes.
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
unsigned GetDiffPairIndex() const
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Add a VIEW_ITEM to the view.
Definition: pcb_view.cpp:58
bool HasPosition() const
Definition: tool_event.h:240
int GenerateDrillFiles(const TOOL_EVENT &aEvent)
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:320
int ToggleLayersManager(const TOOL_EVENT &aEvent)
ACTION_MENU * create() const override
< Return an instance of this class. It has to be overridden in inheriting classes.
int ViaSizeDec(const TOOL_EVENT &aEvent)
static wxWindow * Create(wxWindow *aParent)
static void FootprintFilter(const VECTOR2I &, GENERAL_COLLECTOR &aCollector, PCB_SELECTION_TOOL *sTool)
A selection filter which prunes the selection to contain only items of type #PCB_MODULE_T.
Definition: edit_tool.cpp:2256
BOARD * GetBoard() const
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
ROUTER * Router() const
Definition: pad.h:57
void SetPosition(const wxPoint &aPos) override
Definition: footprint.cpp:1562
MODE GetDrawingMode() const
Return the current drawing mode of the DRAWING_TOOL or #MODE::NONE if not currently in any drawing mo...
int GenerateFabFiles(const TOOL_EVENT &aEvent)
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:307
ROUTER_MODE Mode() const
Definition: pns_router.h:132
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
int TrackWidthDec(const TOOL_EVENT &aEvent)
static constexpr int Millimeter2iu(double mm)
Rendering engine changes.
Definition: tool_base.h:81
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Add a menu entry to run a TOOL_ACTION on selected items.
static TOOL_ACTION findNext
Definition: actions.h:78
int UpdateSchematicFromPCB(const TOOL_EVENT &aEvent)
void ShowContextMenu(SELECTION &aSelection)
Helper function to set and immediately show a CONDITIONAL_MENU in concert with the given SELECTION.
Definition: tool_menu.cpp:59
static TOOL_ACTION viaSizeDec
Definition: pcb_actions.h:297
DRAWINGS & Drawings()
Definition: board.h:237
RouterState GetState() const
Definition: pns_router.h:134
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
TRACKS & Tracks()
Definition: board.h:231
static TOOL_ACTION selectionCursor
Select a single item under the cursor position.
Definition: pcb_actions.h:56
void MarkDirty()
Force redraw of view on the next rendering.
Definition: view.h:633
int PlaceTarget(const TOOL_EVENT &aEvent)
Allow user to place a layer alignment target.
Helper widget to add controls to a wxFileDialog to set netlist configuration options.
static TOOL_ACTION refreshPreview
Definition: actions.h:106
void UseCustomTrackViaSize(bool aEnabled)
Enables/disables custom track/via size settings.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
static TOOL_ACTION cursorClick
Definition: actions.h:123
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1570
void SetLastPath(LAST_PATH_TYPE aType, const wxString &aLastPath)
Set the path of the last file successfully read.
static TOOL_ACTION generateDrillFiles
Definition: pcb_actions.h:335
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
int SaveCopyAs(const TOOL_EVENT &aEvent)
virtual void UpdateMsgPanel()
Redraw the message panel.
wxString AddFileExtListToFilter(const std::vector< std::string > &aExts)
Build the wildcard extension file dialog wildcard filter to add to the base message dialog.
#define CTL_OMIT_EXTRA
Definition: pcb_netlist.h:280
Container for design settings for a BOARD object.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103