KiCad PCB EDA Suite
edit.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) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
6  * Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
7  * Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, you may find one here:
21  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22  * or you may search the http://www.gnu.org website for the version 2 license,
23  * or you may write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25  */
26 
32 #include <fctsys.h>
33 #include <pgm_base.h>
34 #include <kiface_i.h>
35 #include <class_drawpanel.h>
36 #include <confirm.h>
37 #include <eda_doc.h>
38 #include <gestfich.h>
39 #include <kicad_device_context.h>
40 #include <pcb_edit_frame.h>
41 
42 #include <pcbnew_id.h>
43 #include <pcbnew.h>
44 #include <footprint_edit_frame.h>
45 
46 #include <class_board.h>
47 #include <class_module.h>
48 #include <class_track.h>
49 #include <class_zone.h>
50 #include <class_pcb_text.h>
51 #include <footprint_viewer_frame.h>
52 #include <pcb_layer_box_selector.h>
53 #include <dialog_drc.h>
54 #include <invoke_pcb_dialog.h>
55 #include <array_creator.h>
57 
58 #include <zone_filler.h>
59 
60 #include <dialog_move_exact.h>
61 
62 #include <tool/tool_manager.h>
63 #include <tools/pcb_actions.h>
64 
65 // Handles the selection of command events.
66 void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
67 {
68  int id = event.GetId();
69 
71  MODULE* module;
72  auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
73 
74  m_canvas->CrossHairOff( &dc );
75 
76  switch( id ) // Some (not all ) edit commands must be finished or aborted
77  {
78  case wxID_CUT:
79  case wxID_COPY:
147  case ID_POPUP_ZOOM_BLOCK:
148  case ID_POPUP_FLIP_BLOCK:
158  break;
159 
161  if( m_canvas->IsMouseCaptured() )
162  {
164  }
165 
166  // Should not be executed, just in case
167  if( GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE )
168  {
172  }
173 
174  if( GetToolId() == ID_NO_TOOL_SELECTED )
176  else
177  SetCursor( (wxStockCursor) m_canvas->GetDefaultCursor() );
178 
179  break;
180 
181  default: // Finish (abort) the command
182  if( m_canvas->IsMouseCaptured() )
184 
185  if( GetToolId() != id )
186  {
187  if( m_lastDrawToolId != GetToolId() )
189 
191  }
192  break;
193  }
194 
195  switch( id ) // Execute command
196  {
197  case 0:
198  break;
199 
201  {
203 
204  if( !editor )
205  {
207  editor->Zoom_Automatique( false );
208  }
209  else
210  {
211  // Needed on Windows, other platforms do not use it,
212  // but it creates no issue
213  if( editor->IsIconized() )
214  editor->Iconize( false );
215 
216  editor->Raise();
217 
218  // Raising the window does not set the focus on Linux. This should work on
219  // any platform.
220  if( wxWindow::FindFocus() != editor )
221  editor->SetFocus();
222  }
223 
224  editor->PushPreferences( m_canvas );
225  }
226  break;
227 
229  {
231 
232  if( !viewer )
233  {
235  }
236  else
237  {
238  // Needed on Windows, other platforms do not use it,
239  // but it creates no issue
240  if( viewer->IsIconized() )
241  viewer->Iconize( false );
242 
243  viewer->Raise();
244 
245  // Raising the window does not set the focus on Linux. This should work on
246  // any platform.
247  if( wxWindow::FindFocus() != viewer )
248  viewer->SetFocus();
249  }
250 
251  viewer->PushPreferences( m_canvas );
252  }
253  break;
254 
256  InstallPcbGlobalDeleteFrame( wxDefaultPosition );
257  break;
258 
261  m_canvas->SetAutoPanRequest( false );
262  HandleBlockPlace( &dc );
263  break;
264 
268  m_canvas->SetAutoPanRequest( false );
269  HandleBlockPlace( &dc );
270  break;
271 
272  case ID_POPUP_ZOOM_BLOCK:
275  HandleBlockEnd( &dc );
276  break;
277 
281  HandleBlockEnd( &dc );
282  break;
283 
287  HandleBlockEnd( &dc );
288  break;
289 
290  case ID_POPUP_FLIP_BLOCK:
293  HandleBlockEnd( &dc );
294  break;
295 
296  case ID_DRC_CONTROL:
297  // Shows the DRC dialog in non modal mode, to allows board editing
298  // with the DRC dialog opened and showing errors.
299  m_drc->ShowDRCDialog();
300  break;
301 
302  case ID_GET_NETLIST:
303  InstallNetlistFrame( &dc );
304  break;
305 
306  case ID_FIND_ITEMS:
308  break;
309 
312  break;
313 
315  break;
316 
319 
320  // EndSegment(&dc);
321  break;
322 
324  if( GetCurItem() == NULL )
325  break;
326  Edit_Track_Width( &dc, (TRACK*) GetCurItem() );
328  OnModify();
329  break;
330 
332  if( GetCurItem() == NULL )
333  break;
336  OnModify();
337  break;
338 
340  {
341  wxCommandEvent dummy;
342  OnEditTracksAndVias( dummy );
343  }
345  break;
346 
349  OnHotkeyBeginRoute( &dc );
350  break;
351 
354  End_Route( (TRACK*) GetCurItem(), &dc );
355  break;
356 
359 
360  if( GetCurItem()->IsDragging() )
361  {
363  }
364 
365  break;
366 
368  /* change the position of initial segment when creating new tracks
369  * switch from _/ to -\ .
370  * If a track is in progress, it will be redrawn
371  */
372  if( m_canvas->IsMouseCaptured() )
373  m_canvas->CallMouseCapture( &dc, wxDefaultPosition, false );
374 
376 
377  if( m_canvas->IsMouseCaptured() )
378  m_canvas->CallMouseCapture( &dc, wxDefaultPosition, false );
379 
380  break;
381 
383  if( !IsMicroViaAcceptable() )
384  break;
385  // fall through
391 
392  if( GetCurItem()->IsDragging() )
393  {
395  }
396  else
397  {
399  VIATYPE_T v_type = settings.m_CurrentViaType;
400  switch( id )
401  {
405  break;
406 
408  settings.m_CurrentViaType = VIA_MICROVIA;
409  break;
410 
411  default:
412  settings.m_CurrentViaType = VIA_THROUGH;
413  break;
414  }
415 
416  // place via and switch layer.
419  {
421 
422  wxPoint dlgPosition;
423 
424  wxGetMousePosition( &dlgPosition.x, &dlgPosition.y );
425 
426  PCB_LAYER_ID layer = SelectLayer( GetActiveLayer(), LSET::AllNonCuMask(), dlgPosition );
427 
428  m_canvas->SetIgnoreMouseEvents( false );
430 
431  if( GetActiveLayer() != layer )
432  {
434  GetScreen()->m_Route_Layer_BOTTOM = layer;
435  Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
436  }
437  }
438 
439  else
440  Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
441 
442  settings.m_CurrentViaType = v_type;
443 
444  if( displ_opts->m_ContrastModeDisplay )
445  m_canvas->Refresh();
446  }
447  break;
448 
450  if( GetCurItem() )
451  {
453  SetCurItem( Delete_Segment( &dc, (TRACK*) GetCurItem() ) );
454  OnModify();
455  }
456  break;
457 
459  if( GetCurItem() )
460  {
462  Delete_Track( &dc, (TRACK*) GetCurItem() );
463  SetCurItem( NULL );
464  OnModify();
465  }
466  break;
467 
470  Delete_net( &dc, (TRACK*) GetCurItem() );
471  SetCurItem( NULL );
472  OnModify();
473  break;
474 
476  Attribut_Segment( (TRACK*) GetCurItem(), &dc, true );
477  break;
478 
480  Attribut_Segment( (TRACK*) GetCurItem(), &dc, false );
481  break;
482 
484  Attribut_Track( (TRACK*) GetCurItem(), &dc, true );
485  break;
486 
488  Attribut_Track( (TRACK*) GetCurItem(), &dc, false );
489  break;
490 
492  Attribut_net( &dc, ( (TRACK*) GetCurItem() )->GetNetCode(), true );
493  break;
494 
496  Attribut_net( &dc, ( (TRACK*) GetCurItem() )->GetNetCode(), false );
497  break;
498 
500  break;
501 
504 
505  if( GetCurItem() )
506  {
507  SEGZONE* zsegm = (SEGZONE*) GetCurItem();
508  int netcode = zsegm->GetNetCode();
509  Delete_OldZone_Fill( zsegm );
510  SetCurItem( NULL );
511  TestNetConnection( NULL, netcode );
512  OnModify();
513  SetMsgPanel( GetBoard() );
514  }
515  break;
516 
519  SetCurItem( NULL ); // Outlines can have changed
520  break;
521 
523  {
525  duplicateZone( &dc, zone );
526  }
527  break;
528 
531  m_canvas->SetAutoPanRequest( true );
533  break;
534 
537  m_canvas->SetAutoPanRequest( true );
539  break;
540 
542  // Force the main contour selection, to remove the entire zone:
543  ((ZONE_CONTAINER*) GetCurItem())->SetSelectedCorner( 0 );
544  // Fall through
547  {
548  int netcode = ( (ZONE_CONTAINER*) GetCurItem() )->GetNetCode();
550  SetCurItem( NULL );
551  TestNetConnection( NULL, netcode );
552  SetMsgPanel( GetBoard() );
553  }
554  break;
555 
558  SetCurItem( NULL );
559  break;
560 
562  {
564  ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
565  m_canvas->SetAutoPanRequest( true );
566  Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->GetSelectedCorner(), false );
567  }
568  break;
569 
571  {
573  ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
574  m_canvas->SetAutoPanRequest( true );
575  Start_Move_Zone_Drag_Outline_Edge( &dc, zone_cont, zone_cont->GetSelectedCorner() );
576  }
577  break;
578 
580  {
582  ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
583  m_canvas->SetAutoPanRequest( true );
584  Start_Move_Zone_Outlines( &dc, zone_cont );
585  }
586  break;
587 
589  {
591  ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
593 
594  /* add corner between zone_cont->m_CornerSelection
595  * and zone_cont->m_CornerSelection+1
596  * and start move the new corner
597  */
598  zone_cont->Draw( m_canvas, &dc, GR_XOR );
599  zone_cont->Outline()->InsertVertex( zone_cont->GetSelectedCorner(), pos );
600  zone_cont->SetSelectedCorner( zone_cont->GetSelectedCorner() + 1 );
601  zone_cont->Draw( m_canvas, &dc, GR_XOR );
602  m_canvas->SetAutoPanRequest( true );
603  Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->GetSelectedCorner(), true );
604  }
605  break;
606 
610  {
612  ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
613  End_Move_Zone_Corner_Or_Outlines( &dc, zone_cont );
614  m_canvas->SetAutoPanRequest( false );
615  }
616  break;
617 
620  Fill_All_Zones( this );
621  m_canvas->Refresh();
622  SetMsgPanel( GetBoard() );
623  break;
624 
626  if( ( GetCurItem() )->Type() == PCB_ZONE_AREA_T )
627  {
628  ZONE_CONTAINER* zone_container = (ZONE_CONTAINER*) GetCurItem();
629  zone_container->UnFill();
630  GetBoard()->GetConnectivity()->Update( zone_container );
631  OnModify();
632  SetMsgPanel( GetBoard() );
633  m_canvas->Refresh();
634  }
635 
636  Compile_Ratsnest( &dc, false );
637  SetCurItem( NULL );
638  break;
639 
640  case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES: // Remove all zones :
641  GetBoard()->m_SegZoneDeprecated.DeleteAll(); // remove deprecated zone segments used
642  // to fill zones in very old boards.
643 
644  for( int ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
645  {
646  // Remove filled areas in zone
647  ZONE_CONTAINER* zone_container = GetBoard()->GetArea( ii );
648  zone_container->UnFill();
649  GetBoard()->GetConnectivity()->Update( zone_container );
650  }
651 
652  Compile_Ratsnest( &dc, false );
653  SetCurItem( NULL ); // CurItem might be deleted by this command, clear the pointer
654  OnModify();
655  SetMsgPanel( GetBoard() );
656  m_canvas->Refresh();
657  break;
658 
660  {
662  ZONE_FILLER filler( GetBoard() );
663  filler.Fill( { (ZONE_CONTAINER*) GetCurItem() } );
664  SetMsgPanel( GetBoard() );
665  m_canvas->Refresh();
666  break;
667  }
668 
671  m_canvas->SetAutoPanRequest( true );
672  break;
673 
676  if( GetCurItem() == NULL )
677  break;
678 
679  // If the current Item is a pad, text module ...: Get its parent
680  if( GetCurItem()->Type() != PCB_MODULE_T )
681  SetCurItem( GetCurItem()->GetParent() );
682 
683  if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
684  break;
685 
686  module = (MODULE*) GetCurItem();
687 
688  if( module->IsLocked() )
689  {
690  wxString msg;
691  msg.Printf( _( "Footprint %s found, but it is locked" ),
692  module->GetReference().GetData() );
693  DisplayInfoMessage( this, msg );
694  break;
695  }
696 
697  SendMessageToEESCHEMA( module );
698  SetCrossHairPosition( module->GetPosition() );
701  break;
702 
703  case ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST: // get module by name and move it
705  module = (MODULE*) GetCurItem();
706 
707  if( module == NULL )
708  break;
709 
710  if( module->IsLocked() )
711  {
712  wxString msg = wxString::Format(
713  _( "Footprint %s found, but it is locked" ),
714  module->GetReference().GetData() );
715  DisplayInfoMessage( this, msg );
716  break;
717  }
718 
719  SendMessageToEESCHEMA( module );
721  StartMoveModule( module, &dc, false );
722  break;
723 
726 
727  // If the current Item is a pad, text module ...: Get its parent
728  if( GetCurItem()->Type() != PCB_MODULE_T )
729  SetCurItem( GetCurItem()->GetParent() );
730 
731  if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
732  break;
733 
734  module = (MODULE*) GetCurItem();
735 
736  if( module->IsLocked() )
737  {
738  wxString msg;
739  msg.Printf( _( "Footprint %s found, but it is locked" ),
740  module->GetReference().GetData() );
741  DisplayInfoMessage( this, msg );
742  break;
743  }
744 
745  if( Delete_Module( (MODULE*) GetCurItem(), &dc ) )
746  {
747  SetCurItem( NULL );
748  }
749 
750  break;
751 
754 
755  // If the current Item is a pad, text module ...: Get its parent
756  if( GetCurItem()->Type() != PCB_MODULE_T )
757  SetCurItem( GetCurItem()->GetParent() );
758 
759  if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
760  break;
761 
762  module = (MODULE*) GetCurItem();
763 
764  if( module->IsLocked() )
765  {
766  wxString msg;
767  msg.Printf( _( "Footprint %s found, but it is locked" ),
768  module->GetReference().GetData() );
769  DisplayInfoMessage( this, msg );
770  break;
771  }
772 
773  // This is a simple rotation, no other editing in progress
774  if( !GetCurItem()->IsMoving() )
775  SaveCopyInUndoList( GetCurItem(), UR_CHANGED, ((MODULE*)GetCurItem())->GetPosition() );
776 
777  Rotate_Module( &dc, (MODULE*) GetCurItem(), m_rotationAngle, true );
778  break;
779 
782 
783  // If the current Item is a pad, text module ...: Get its parent
784  if( GetCurItem()->Type() != PCB_MODULE_T )
785  SetCurItem( GetCurItem()->GetParent() );
786 
787  if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
788  break;
789 
790  module = (MODULE*) GetCurItem();
791 
792  if( module->IsLocked() )
793  {
794  wxString msg;
795  msg.Printf( _( "Footprint %s found, but it is locked" ),
796  module->GetReference().GetData() );
797  DisplayInfoMessage( this, msg );
798  break;
799  }
800 
801  // This is a simple rotation, no other editing in progress
802  if( !GetCurItem()->IsMoving() )
803  SaveCopyInUndoList( GetCurItem(), UR_CHANGED, ((MODULE*)GetCurItem())->GetPosition() );
804 
805  Rotate_Module( &dc, (MODULE*) GetCurItem(), -m_rotationAngle, true );
806  break;
807 
810 
811  // If the current Item is a pad, text module ...: Get its parent
812  if( GetCurItem()->Type() != PCB_MODULE_T )
813  SetCurItem( GetCurItem()->GetParent() );
814 
815  if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
816  break;
817 
818  module = (MODULE*) GetCurItem();
819 
820  if( module->IsLocked() )
821  {
822  wxString msg;
823  msg.Printf( _( "Footprint %s found, but it is locked" ),
824  module->GetReference().GetData() );
825  DisplayInfoMessage( this, msg );
826  break;
827  }
828 
829  // This is a simple flip, no other editing in progress
830  if( !GetCurItem()->IsMoving() )
831  SaveCopyInUndoList( GetCurItem(), UR_FLIPPED, ((MODULE*)GetCurItem())->GetPosition() );
832 
833  Change_Side_Module( (MODULE*) GetCurItem(), &dc );
834  break;
835 
837  if( GetCurItem() && GetCurItem()->Type() == PCB_MODULE_T )
838  {
839  InstallExchangeModuleFrame( dynamic_cast<MODULE*>( GetCurItem() ), true, true );
841  }
842  break;
843 
845  if( GetCurItem() && GetCurItem()->Type() == PCB_MODULE_T )
846  {
847  InstallExchangeModuleFrame( dynamic_cast<MODULE*>( GetCurItem() ), false, true );
849  }
850  break;
851 
853  // If the current Item is a pad, text module ...: Get its parent
854  if( GetCurItem()->Type() != PCB_MODULE_T )
855  SetCurItem( GetCurItem()->GetParent() );
856 
857  if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
858  break;
859 
862  break;
863 
865 
866  // If we don't have a current item, there's nothing we can do here
867  if( !GetCurItem() )
868  break;
869 
870  // If the current Item is a pad, text module ...: Get its parent
871  if( GetCurItem()->Type() != PCB_MODULE_T )
872  SetCurItem( GetCurItem()->GetParent() );
873 
874  if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
875  break;
876 
877  if( GetCurItem()->GetTimeStamp() == 0 ) // Module Editor needs a non null timestamp
878  {
880  OnModify();
881  }
882 
883  {
885 
887  SetCurItem( NULL ); // the current module could be deleted by
888  }
890  break;
891 
893  module = (MODULE*) GetCurItem()->GetParent();
894 
895  if( !module || module->Type() != PCB_MODULE_T )
896  break;
897 
898  if( module->IsLocked() )
899  {
900  wxString msg;
901  msg.Printf( _( "The parent (%s) of the pad is locked" ),
902  module->GetReference().GetData() );
903  DisplayInfoMessage( this, msg );
904  break;
905  }
906 
908  StartMovePad( (D_PAD*) GetCurItem(), &dc, true );
909  break;
910 
912  module = (MODULE*) GetCurItem()->GetParent();
913 
914  if( !module || module->Type() != PCB_MODULE_T )
915  break;
916 
917  if( module->IsLocked() )
918  {
919  wxString msg;
920  msg.Printf( _( "The parent (%s) of the pad is locked" ),
921  module->GetReference().GetData() );
922  DisplayInfoMessage( this, msg );
923  break;
924  }
925 
927  StartMovePad( (D_PAD*) GetCurItem(), &dc, false );
928  break;
929 
933  break;
934 
937  SaveCopyInUndoList( GetCurItem()->GetParent(), UR_CHANGED );
938  Import_Pad_Settings( (D_PAD*) GetCurItem(), true );
939  break;
940 
944  break;
945 
949  break;
950 
952  SaveCopyInUndoList( GetCurItem()->GetParent(), UR_CHANGED );
953  DeletePad( (D_PAD*) GetCurItem() );
954  SetCurItem( NULL );
956  break;
957 
960  break;
961 
963  ResetTextSize( GetCurItem(), &dc );
964  break;
965 
968  StartMoveTexteModule( static_cast<TEXTE_MODULE*>( GetCurItem() ), &dc );
969  break;
970 
972  RotateTextModule( static_cast<TEXTE_MODULE*>( GetCurItem() ), &dc );
974  break;
975 
977  DeleteTextModule( static_cast<TEXTE_MODULE*>( GetCurItem() ) );
978  SetCurItem( NULL );
980  break;
981 
983  {
985 
986  if( itmp >= 0 )
987  {
988  // if user changed colors and we are in high contrast mode, then redraw
989  // because the PAD_ATTRIB_SMD pads may change color.
990  if( displ_opts->m_ContrastModeDisplay && GetActiveLayer() != itmp )
991  {
992  m_canvas->Refresh();
993  }
994  SetActiveLayer( itmp );
995  }
996 
998  }
999  break;
1000 
1003  break;
1004 
1006  {
1008 
1009  if( itmp >= 0 )
1010  SetActiveLayer( itmp );
1011 
1013  }
1014  break;
1015 
1017  {
1019 
1020  if( itmp >= 0 )
1021  SetActiveLayer( itmp );
1022  }
1023  break;
1024 
1028  break;
1029 
1032 
1033  if( displ_opts->m_ContrastModeDisplay )
1034  m_canvas->Refresh( true );
1035  break;
1036 
1039  break;
1040 
1042  Rotate_Texte_Pcb( (TEXTE_PCB*) GetCurItem(), &dc );
1044  break;
1045 
1047  CreateTextePcb( &dc, (TEXTE_PCB*) GetCurItem() );
1049  m_canvas->SetAutoPanRequest( true );
1050  break;
1051 
1053  FlipTextePcb( (TEXTE_PCB*) GetCurItem(), &dc );
1055  break;
1056 
1058  Delete_Texte_Pcb( (TEXTE_PCB*) GetCurItem(), &dc );
1060  break;
1061 
1063  BeginMoveTarget( (PCB_TARGET*) GetCurItem(), &dc );
1065  break;
1066 
1070  break;
1071 
1074  DeleteTarget( (PCB_TARGET*) GetCurItem(), &dc );
1075  SetCurItem( NULL );
1076  break;
1077 
1080  DeleteDimension( (DIMENSION*) GetCurItem(), &dc );
1081  SetCurItem( NULL );
1082  break;
1083 
1087  break;
1088 
1091  break;
1092 
1096  break;
1097 
1099  RemoveStruct( GetCurItem(), &dc );
1101  break;
1102 
1104  if( GetCurItem() && GetCurItem()->Type() == PCB_MARKER_T )
1105  ( (MARKER_PCB*) GetCurItem() )->DisplayMarkerInfo( this );
1106 
1108  break;
1109 
1111  if( GetCurItem()->GetFlags() != 0 )
1112  break;
1113 
1115  SetCurItem( NULL );
1117  m_canvas->Refresh();
1118  break;
1119 
1122  break;
1123 
1127  break;
1128 
1131 
1132  if( GetCurItem() && (GetCurItem()->IsNew()) )
1133  {
1134  End_Edge( (DRAWSEGMENT*) GetCurItem(), &dc );
1135  SetCurItem( NULL );
1136  }
1137 
1138  break;
1139 
1142 
1143  if( GetCurItem() && (GetCurItem()->IsNew()) )
1144  {
1145  if( End_Zone( &dc ) )
1146  SetCurItem( NULL );
1147  }
1148 
1149  m_canvas->SetAutoPanRequest( false );
1150  break;
1151 
1154 
1155  if( GetCurItem() && (GetCurItem()->IsNew()) )
1156  {
1157  if( Delete_LastCreatedCorner( &dc ) == 0 ) // No more segment in outline,
1158  SetCurItem( NULL );
1159  }
1160 
1161  break;
1162 
1163 
1167  break;
1168 
1173  break;
1174 
1178  break;
1179 
1182  {
1183  TRACK* track = (TRACK*) GetScreen()->GetCurItem();
1184  wxPoint pos = GetCrossHairPosition();
1185 
1186  track->Draw( m_canvas, &dc, GR_XOR );
1187  PICKED_ITEMS_LIST itemsListPicker;
1188 
1189  TRACK* newtrack = GetBoard()->CreateLockPoint( pos, track, &itemsListPicker );
1190 
1191  SaveCopyInUndoList( itemsListPicker, UR_UNSPECIFIED );
1192  track->Draw( m_canvas, &dc, GR_XOR );
1193  newtrack->Draw( m_canvas, &dc, GR_XOR );
1194 
1195  // compute the new ratsnest, because connectivity could change
1196  TestNetConnection( &dc, track->GetNetCode() );
1197  }
1198  break;
1199 
1201  moveExact();
1202  break;
1203 
1207  break;
1208 
1210  createArray();
1211  break;
1212 
1213  case ID_MENU_PCB_CLEAN:
1214  Clean_Pcb();
1215  break;
1216 
1218  InstallExchangeModuleFrame( dynamic_cast<MODULE*>( GetCurItem() ), true, false );
1219  break;
1220 
1222  InstallExchangeModuleFrame( dynamic_cast<MODULE*>( GetCurItem() ), false, false );
1223  break;
1224 
1226  Swap_Layers( event );
1227  break;
1228 
1230  {
1231  wxConfigBase* cfg = Pgm().CommonSettings();
1232  cfg->Read( wxT( "module_doc_file" ), g_DocModulesFileName );
1233  GetAssociatedDocument( this, g_DocModulesFileName, &Kiface().KifaceSearch() );
1234  }
1235  break;
1236 
1238  ArchiveModulesOnBoard( false );
1239  break;
1240 
1242  ArchiveModulesOnBoard( true );
1243  break;
1244 
1247  m_canvas->Refresh();
1248  break;
1249 
1250 
1251  default:
1252  wxString msg;
1253  msg.Printf( wxT( "PCB_EDIT_FRAME::Process_Special_Functions() unknown event id %d" ), id );
1254  DisplayError( this, msg );
1255  break;
1256  }
1257 
1258  m_canvas->CrossHairOn( &dc );
1259  m_canvas->SetIgnoreMouseEvents( false );
1260 }
1261 
1262 
1264 {
1265  if( Item == NULL )
1266  return;
1267 
1268  switch( Item->Type() )
1269  {
1270  case PCB_MODULE_T:
1271  Delete_Module( (MODULE*) Item, DC );
1272  break;
1273 
1274  case PCB_DIMENSION_T:
1275  DeleteDimension( (DIMENSION*) Item, DC );
1276  break;
1277 
1278  case PCB_TARGET_T:
1279  DeleteTarget( (PCB_TARGET*) Item, DC );
1280  break;
1281 
1282  case PCB_LINE_T:
1283  Delete_Segment_Edge( (DRAWSEGMENT*) Item, DC );
1284  break;
1285 
1286  case PCB_TEXT_T:
1287  Delete_Texte_Pcb( (TEXTE_PCB*) Item, DC );
1288  break;
1289 
1290  case PCB_TRACE_T:
1291  Delete_Track( DC, (TRACK*) Item );
1292  break;
1293 
1294  case PCB_VIA_T:
1295  Delete_Segment( DC, (TRACK*) Item );
1296  break;
1297 
1298  case PCB_SEGZONE_T:
1299  Delete_OldZone_Fill( (SEGZONE*) Item );
1300  break;
1301 
1302  case PCB_ZONE_AREA_T:
1303  {
1304  SetCurItem( NULL );
1305  int netcode = ( (ZONE_CONTAINER*) Item )->GetNetCode();
1306  Delete_Zone_Contour( DC, (ZONE_CONTAINER*) Item );
1307  TestNetConnection( NULL, netcode );
1308  SetMsgPanel( GetBoard() );
1309  }
1310  break;
1311 
1312  case PCB_MARKER_T:
1313  if( Item == GetCurItem() )
1314  SetCurItem( NULL );
1315 
1316  ( (MARKER_PCB*) Item )->Draw( m_canvas, DC, GR_XOR );
1317 
1318  // delete the marker, and free memory. Don't use undo stack.
1319  GetBoard()->Delete( Item );
1320  break;
1321 
1322  case PCB_PAD_T:
1323  case PCB_MODULE_TEXT_T:
1324  case PCB_MODULE_EDGE_T:
1325  break;
1326 
1327  case TYPE_NOT_INIT:
1328  case PCB_T:
1329  default:
1330  {
1331  wxString msg = wxString::Format(
1332  wxT( "Remove: item type %d unknown." ), Item->Type() );
1333  DisplayError( this, msg );
1334  }
1335  break;
1336  }
1337 }
1338 
1339 
1341 {
1342  PCB_LAYER_ID curLayer = GetActiveLayer();
1343  auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
1344 
1345  // Check if the specified layer matches the present layer
1346  if( layer == curLayer )
1347  return;
1348 
1349  // Copper layers cannot be selected unconditionally; how many
1350  // of those layers are currently enabled needs to be checked.
1351  if( IsCopperLayer( layer ) )
1352  {
1353  // If only one copper layer is enabled, the only such layer
1354  // that can be selected to is the "Back" layer (so the
1355  // selection of any other copper layer is disregarded).
1356  if( GetBoard()->GetCopperLayerCount() < 2 )
1357  {
1358  if( layer != B_Cu )
1359  return;
1360  }
1361  // If more than one copper layer is enabled, the "Copper"
1362  // and "Component" layers can be selected, but the total
1363  // number of copper layers determines which internal
1364  // layers are also capable of being selected.
1365  else
1366  {
1367  if( layer != B_Cu && layer != F_Cu && layer >= GetBoard()->GetCopperLayerCount() - 1 )
1368  return;
1369  }
1370 
1371  EDA_ITEM* current = GetScreen()->GetCurItem();
1372 
1373  // See if we are drawing a segment; if so, add a via?
1374  if( GetToolId() == ID_TRACK_BUTT && current )
1375  {
1376  if( current->Type() == PCB_TRACE_T && current->IsNew() )
1377  {
1378  // Want to set the routing layers so that it switches properly -
1379  // see the implementation of Other_Layer_Route - the working
1380  // layer is used to 'start' the via and set the layer masks appropriately.
1381  GetScreen()->m_Route_Layer_TOP = curLayer;
1382  GetScreen()->m_Route_Layer_BOTTOM = layer;
1383 
1384  SetActiveLayer( curLayer );
1385 
1386  if( Other_Layer_Route( (TRACK*) GetScreen()->GetCurItem(), DC ) )
1387  {
1388  if( displ_opts->m_ContrastModeDisplay )
1389  m_canvas->Refresh();
1390  }
1391 
1392  // if the via was allowed by DRC, then the layer swap has already
1393  // been done by Other_Layer_Route(). if via not allowed, then
1394  // return now so assignment to setActiveLayer() below doesn't happen.
1395  return;
1396  }
1397  }
1398  }
1399 
1400  // Is yet more checking required? E.g. when the layer to be selected
1401  // is a non-copper layer, or when switching between a copper layer
1402  // and a non-copper layer, or vice-versa?
1403  // ...
1404 
1405  SetActiveLayer( layer );
1406 
1407  if( displ_opts->m_ContrastModeDisplay )
1408  m_canvas->Refresh();
1409 }
1410 
1411 
1412 void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
1413 {
1414  int id = aEvent.GetId();
1415  int lastToolID = GetToolId();
1416 
1418  auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
1419 
1420  // Stop the current command and deselect the current tool.
1422 
1423  switch( id )
1424  {
1425  case ID_NO_TOOL_SELECTED:
1427  break;
1428 
1429  case ID_ZOOM_SELECTION:
1430  // This tool is located on the main toolbar: switch it on or off on click on it
1431  if( lastToolID != ID_ZOOM_SELECTION )
1432  SetToolID( ID_ZOOM_SELECTION, wxCURSOR_MAGNIFIER, _( "Zoom to selection" ) );
1433  else
1435  break;
1436 
1437  case ID_TRACK_BUTT:
1438  if( Settings().m_legacyDrcOn )
1439  SetToolID( id, wxCURSOR_PENCIL, _( "Add tracks" ) );
1440  else
1441  SetToolID( id, wxCURSOR_QUESTION_ARROW, _( "Add tracks" ) );
1442 
1443  Compile_Ratsnest( &dc, true );
1444  break;
1445 
1446  case ID_PCB_MODULE_BUTT:
1447  SetToolID( id, wxCURSOR_PENCIL, _( "Add footprint" ) );
1448  break;
1449 
1450  case ID_PCB_ZONES_BUTT:
1451  SetToolID( id, wxCURSOR_PENCIL, _( "Add zones" ) );
1452 
1453  if( displ_opts->m_DisplayZonesMode != 0 )
1454  DisplayInfoMessage( this, _( "Warning: zone display is OFF!!!" ) );
1455 
1456  if( !GetBoard()->IsHighLightNetON() && (GetBoard()->GetHighLightNetCode() > 0 ) )
1457  HighLight( &dc );
1458 
1459  break;
1460 
1462  SetToolID( id, wxCURSOR_PENCIL, _( "Add keepout" ) );
1463  break;
1464 
1465  case ID_PCB_TARGET_BUTT:
1466  SetToolID( id, wxCURSOR_PENCIL, _( "Add layer alignment target" ) );
1467  break;
1468 
1470  SetToolID( id, wxCURSOR_PENCIL, _( "Adjust zero" ) );
1471  break;
1472 
1474  SetToolID( id, wxCURSOR_PENCIL, _( "Adjust grid origin" ) );
1475  break;
1476 
1477  case ID_PCB_ADD_LINE_BUTT:
1478  SetToolID( id, wxCURSOR_PENCIL, _( "Add graphic line" ) );
1479  break;
1480 
1481  case ID_PCB_ARC_BUTT:
1482  SetToolID( id, wxCURSOR_PENCIL, _( "Add graphic arc" ) );
1483  break;
1484 
1485  case ID_PCB_CIRCLE_BUTT:
1486  SetToolID( id, wxCURSOR_PENCIL, _( "Add graphic circle" ) );
1487  break;
1488 
1489  case ID_PCB_ADD_TEXT_BUTT:
1490  SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
1491  break;
1492 
1493  case ID_COMPONENT_BUTT:
1494  SetToolID( id, wxCURSOR_HAND, _( "Add footprint" ) );
1495  break;
1496 
1497  case ID_PCB_DIMENSION_BUTT:
1498  SetToolID( id, wxCURSOR_PENCIL, _( "Add dimension" ) );
1499  break;
1500 
1502  SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
1503  break;
1504 
1505  case ID_PCB_HIGHLIGHT_BUTT:
1506  SetToolID( id, wxCURSOR_HAND, _( "Highlight net" ) );
1507  break;
1508 
1510  SetToolID( id, wxCURSOR_HAND, _( "Select rats nest" ) );
1511 
1512  Compile_Ratsnest( &dc, true );
1513 
1514  break;
1515 
1516  // collect GAL-only tools here
1517  case ID_PCB_DRAW_VIA_BUTT:
1519  SetToolID( id, wxCURSOR_DEFAULT, _( "Unsupported tool in this canvas" ) );
1520  break;
1521  }
1522 }
1523 
1524 
1526 {
1527  wxPoint translation;
1528  double rotation;
1529  ROTATION_ANCHOR rotationAnchor = ROTATE_AROUND_ITEM_ANCHOR;
1530 
1531  DIALOG_MOVE_EXACT dialog( this, translation, rotation, rotationAnchor );
1532  int ret = dialog.ShowModal();
1533 
1534  if( ret == wxID_OK )
1535  {
1536  if( BOARD_ITEM* item = GetScreen()->GetCurItem() )
1537  {
1538  // When a pad is modified, the full footprint is saved
1539  BOARD_ITEM* itemToSave = item;
1540 
1541  if( item->Type() == PCB_PAD_T )
1542  itemToSave = item->GetParent();
1543 
1544  // Could be moved or rotated
1545  SaveCopyInUndoList( itemToSave, UR_CHANGED );
1546 
1547  item->Move( translation );
1548 
1549  switch( rotationAnchor )
1550  {
1552  item->Rotate( item->GetPosition(), rotation );
1553  break;
1555  item->Rotate( GetScreen()->m_O_Curseur, rotation );
1556  break;
1558  item->Rotate( GetAuxOrigin(), rotation );
1559  break;
1560  default:
1561  wxFAIL_MSG( "Rotation choice shouldn't have been available in this context." );
1562  }
1563 
1564  m_canvas->Refresh();
1565  }
1566  }
1567 
1569 }
1570 
1571 
1572 void PCB_EDIT_FRAME::duplicateItems( bool aIncrement )
1573 {
1574  BOARD_ITEM* item = GetScreen()->GetCurItem();
1575 
1576  if( !item )
1577  return;
1578 
1579  // In the board editor, the pads or fp texts can be edited
1580  // but cannot be duplicated (only the fp editor can do that).
1581  // only the footprint can be duplicated
1582  if( item->Type() == PCB_PAD_T || item->Type() == PCB_MODULE_TEXT_T )
1583  item = static_cast<MODULE*>( item )->GetParent();
1584 
1585  PCB_BASE_EDIT_FRAME::duplicateItem( item, aIncrement );
1586 }
1587 
1588 
1589 void PCB_BASE_EDIT_FRAME::duplicateItem( BOARD_ITEM* aItem, bool aIncrement )
1590 {
1591  if( !aItem )
1592  return;
1593 
1594  // The easiest way to handle a duplicate item command
1595  // is to simulate a block copy command, which gives us the undo management
1596  // for free
1597  if( GetScreen()->m_BlockLocate.GetState() == STATE_NO_BLOCK )
1598  {
1600 
1602 
1603  wxPoint crossHairPos = GetCrossHairPosition();
1604 
1605  const BLOCK_COMMAND_T blockType = aIncrement ? BLOCK_DUPLICATE_AND_INCREMENT : BLOCK_DUPLICATE;
1606 
1607  if( !HandleBlockBegin( &dc, blockType, crossHairPos ) )
1608  return;
1609 
1610  // Add the item to the block copy pick list:
1612  ITEM_PICKER picker( NULL, UR_UNSPECIFIED );
1613 
1614  picker.SetItem ( aItem );
1615  itemsList.PushItem( picker );
1616 
1617  // Set 2 coordinates updated by the mouse, because our simulation
1618  // does not use the mouse to call HandleBlockEnd()
1619  GetScreen()->m_BlockLocate.SetLastCursorPosition( crossHairPos );
1620  GetScreen()->m_BlockLocate.SetEnd( crossHairPos );
1621  HandleBlockEnd( &dc );
1622  }
1623 }
1624 
1625 
1627 {
1628 public:
1629 
1631  ARRAY_CREATOR( editFrame ),
1632  m_item( m_parent.GetScreen()->GetCurItem() )
1633  {}
1634 
1635 private:
1636 
1637  int getNumberOfItemsToArray() const override
1638  {
1639  // only handle single items
1640  return (m_item != NULL) ? 1 : 0;
1641  }
1642 
1643  BOARD_ITEM* getNthItemToArray( int n ) const override
1644  {
1645  wxASSERT_MSG( n == 0, "Legacy array tool can only handle a single item" );
1646  return m_item;
1647  }
1648 
1649  BOARD* getBoard() const override
1650  {
1651  return m_parent.GetBoard();
1652  }
1653 
1654  MODULE* getModule() const override
1655  {
1656  return dynamic_cast<MODULE*>( m_item->GetParent() );
1657  }
1658 
1659  wxPoint getRotationCentre() const override
1660  {
1661  return m_item->GetCenter();
1662  }
1663 
1664  void finalise() override
1665  {
1666  m_parent.GetCanvas()->Refresh();
1667  }
1668 
1669  BOARD_ITEM* m_item; // only have the one
1670 };
1671 
1672 
1674 {
1675  LEGACY_ARRAY_CREATOR array_creator( *this );
1676 
1677  array_creator.Invoke();
1678 }
void BeginMoveTarget(PCB_TARGET *aTarget, wxDC *DC)
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:673
void Edit_Track_Width(wxDC *aDC, TRACK *aTrackSegment)
Function Edit_Track_Width Modify a full track width (using DRC control).
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
BOARD_ITEM_CONTAINER * GetParent() const
void Draw(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint &offset=ZeroOffset) override
Function Draw Draws the zone outline.
Definition: class_zone.cpp:276
virtual void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
bool Other_Layer_Route(TRACK *track, wxDC *DC)
Function Other_Layer_Route operates in one of two ways.
TRACK * CreateLockPoint(wxPoint &aPosition, TRACK *aSegment, PICKED_ITEMS_LIST *aList)
Function CreateLockPoint creates an intermediate point on aSegment and break it into two segments at ...
void DeleteTarget(PCB_TARGET *aTarget, wxDC *DC)
void Start_Move_Zone_Corner(wxDC *DC, ZONE_CONTAINER *zone_container, int corner_id, bool IsNewCorner)
Function Start_Move_Zone_Corner Prepares a move corner in a zone outline, called from a move corner c...
VIATYPE_T m_CurrentViaType
(VIA_BLIND_BURIED, VIA_THROUGH, VIA_MICROVIA)
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
void Start_Move_Zone_Drag_Outline_Edge(wxDC *DC, ZONE_CONTAINER *zone_container, int corner_id)
Function Start_Move_Zone_Corner Prepares a drag edge in an existing zone outline,.
Definition: typeinfo.h:85
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg) override
Set the tool command ID to aId and sets the cursor to aCursor.
TRACK * Delete_Segment(wxDC *DC, TRACK *Track)
Function Delete_Segment removes a track segment.
Definition: deltrack.cpp:45
void DeleteDimension(DIMENSION *aDimension, wxDC *aDC)
Definition: dimension.cpp:196
TEXTE_PCB class definition.
int getNumberOfItemsToArray() const override
Definition: edit.cpp:1637
bool g_Alternate_Track_Posture
Definition: pcbnew.cpp:72
bool End_Zone(wxDC *DC)
Function End_Zone terminates (if no DRC error ) the zone edge creation process.
void InstallPcbGlobalDeleteFrame(const wxPoint &pos)
This file is part of the common library TODO brief description.
bool Delete_Module(MODULE *aModule, wxDC *aDC)
Function Delete Module Remove a footprint from m_Modules linked list and put it in undelete buffer Th...
This file is part of the common library.
bool IsNew() const
Definition: base_struct.h:219
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
void TestNetConnection(wxDC *aDC, int aNetCode)
Function TestNetConnection tests the connections relative to aNetCode.
Definition: connect.cpp:40
wxPoint getRotationCentre() const override
Definition: edit.cpp:1659
This file is part of the common library.
void FlipTextePcb(TEXTE_PCB *aTextePcb, wxDC *aDC)
Class BOARD to handle a board.
bool InvokeDXFDialogBoardImport(PCB_BASE_FRAME *aCaller)
Function InvokeDXFDialogBoardImport shows the modal DIALOG_DXF_IMPORT for importing a DXF file to a b...
void InstallFindFrame()
void SetMessageBlock(EDA_DRAW_FRAME *frame)
Function SetMessageBlock Displays the type of block command in the status bar of the window...
Component library viewer main window.
static LSET AllNonCuMask()
Function AllNonCuMask returns a mask holding all layer minus CU layers.
Definition: lset.cpp:696
void BeginMoveDimensionText(DIMENSION *aItem, wxDC *DC)
Definition: dimension.cpp:214
void ShowDimensionPropertyDialog(DIMENSION *aDimension, wxDC *aDC)
Definition: dimension.cpp:186
void InstallGraphicItemPropertiesDialog(BOARD_ITEM *aItem)
int GetCopperLayerCount() const
Function GetCopperLayerCount.
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
void SetCurItem(BOARD_ITEM *aItem, bool aDisplayInfo=true)
Function SetCurItem sets the currently selected item and displays it in the MsgPanel.
void Start_Move_Zone_Outlines(wxDC *DC, ZONE_CONTAINER *zone_container)
Function Start_Move_Zone_Outlines Initialize parameters to move an existing zone outlines.
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:242
virtual void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
BLOCK_COMMAND_T
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:92
BOARD * GetBoard() const
bool GetAssociatedDocument(wxWindow *aParent, const wxString &aDocName, const wxPathList *aPaths)
Function GetAssociatedDocument open a document (file) with the suitable browser.
Definition: eda_doc.cpp:87
Classes to handle copper zones.
void Rotate_Module(wxDC *DC, MODULE *module, double angle, bool incremental)
void Delete_Texte_Pcb(TEXTE_PCB *TextePcb, wxDC *DC)
void OnSelectTool(wxCommandEvent &aEvent)
Definition: edit.cpp:1412
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
void duplicateItem(BOARD_ITEM *aItem, bool aIncrement)
Function duplicateItem Duplicate the specified item This function is shared between pcbnew and modedi...
Definition: edit.cpp:1589
void RotateTextModule(TEXTE_MODULE *Text, wxDC *DC)
Definition: edtxtmod.cpp:98
DRC * m_drc
the DRC controller, see drc.cpp
void DeleteAll()
Function DeleteAll deletes all items on the list and leaves the list empty.
Definition: dlist.cpp:44
void Swap_Layers(wxCommandEvent &event)
void Remove_Zone_Corner(wxDC *DC, ZONE_CONTAINER *zone_container)
Function End_Move_Zone_Corner_Or_Outlines Remove the currently selected corner in a zone outline the ...
VIATYPE_T
Definition: class_track.h:50
virtual void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
int GetState(int type) const
Definition: base_struct.h:240
void PushPreferences(const EDA_DRAW_PANEL *aParentCanvas)
Push preferences from a parent window to a child window.
void finalise() override
Definition: edit.cpp:1664
void InstallTextOptionsFrame(BOARD_ITEM *aText, wxDC *aDC)
Routine for main window class to launch text properties dialog.
Definition of class FOOTPRINT_EDIT_FRAME.
void RemoveStruct(BOARD_ITEM *Item, wxDC *DC)
Definition: edit.cpp:1263
bool End_Route(TRACK *aTrack, wxDC *aDC)
Function End_Route Terminates a track currently being created.
Definition: editrack.cpp:413
BOARD_ITEM * getNthItemToArray(int n) const override
Definition: edit.cpp:1643
void Start_Move_DrawItem(DRAWSEGMENT *drawitem, wxDC *DC)
Definition: editedge.cpp:56
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
virtual void CallEndMouseCapture(wxDC *aDC)
Function CallEndMouseCapture calls the end mouse capture callback.
const wxPoint & GetAuxOrigin() const override
Return the origin of the axis used for plotting and various exports.
int InstallExchangeModuleFrame(MODULE *aModule, bool updateMode, bool selectedMode)
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
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
void * GetDisplayOptions() override
Function GetDisplayOptions returns the display options current in use Display options are relative to...
void StartMovePad(D_PAD *aPad, wxDC *aDC, bool aDragConnectedTracks)
Function StartMovePad Initialize a drag or move pad command.
void ClearItemsList()
Function ClearItemsList clear only the list of EDA_ITEM pointers, it does NOT delete the EDA_ITEM obj...
void DeletePad(D_PAD *aPad, bool aQuery=true)
Function DeletePad Delete the pad aPad.
void InstallFootprintPropertiesDialog(MODULE *Module, wxDC *DC)
void moveExact()
Function moveExact Move the selected item exactly.
Definition: edit.cpp:1525
void Export_Pad_Settings(D_PAD *aPad)
void SetState(BLOCK_STATE_T aState)
virtual bool HandleBlockBegin(wxDC *aDC, EDA_KEY aKey, const wxPoint &aPosition, int aExplicitCommand=0)
Initialize a block command.
virtual void Zoom_Automatique(bool aWarpPointer)
Redraw the screen with best zoom level and the best centering that shows all the page or the board...
class MODULE, a footprint
Definition: typeinfo.h:89
timestamp_t GetNewTimeStamp()
Definition: common.cpp:212
void ResetTextSize(BOARD_ITEM *aItem, wxDC *aDC)
Function ResetTextSize resets given field text size and width to current settings in Preferences->Dim...
Definition: edtxtmod.cpp:289
void Attribut_Track(TRACK *track, wxDC *DC, bool Flag_On)
Definition: attribut.cpp:68
Class PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings...
PCB_LAYER_ID
A quick note on layer IDs:
void StartMoveTextePcb(TEXTE_PCB *aTextePcb, wxDC *aDC, bool aErase=true)
void OnEditTracksAndVias(wxCommandEvent &event)
Function OnEditTracksAndVias Dialog for editing the properties of tracks and vias, selected by net, netclass, and/or layer.
a helper to handle the real device context used in KiCad
BOARD_ITEM * GetCurItem() const
Function GetCurItem returns the currently selected BOARD_ITEM, overriding BASE_SCREEN::GetCurItem().
Definition: pcb_screen.h:72
TEXTE_PCB * CreateTextePcb(wxDC *aDC, TEXTE_PCB *aText=NULL)
VTBL_ENTRY KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=NULL)
Function Player returns the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:300
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
BOARD_ITEM * m_item
Definition: edit.cpp:1669
virtual void CrossHairOn(wxDC *DC=nullptr)
void Rotate_Texte_Pcb(TEXTE_PCB *TextePcb, wxDC *DC)
PCB_GENERAL_SETTINGS & Settings()
void SetEnd(int x, int y)
Definition: eda_rect.h:134
DLIST< SEGZONE > m_SegZoneDeprecated
Definition: class_board.h:250
bool Fill(std::vector< ZONE_CONTAINER * > aZones, bool aCheck=false)
Definition: zone_filler.cpp:83
void End_Move_Zone_Corner_Or_Outlines(wxDC *DC, ZONE_CONTAINER *zone_container)
Function End_Move_Zone_Corner_Or_Outlines Terminates a move corner in a zone outline, or a move zone outlines.
virtual void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
TRACK * OnHotkeyBeginRoute(wxDC *aDC)
Function OnHotkeyBeginRoute If the current active layer is a copper layer, and if no item currently e...
virtual bool HandleBlockEnd(wxDC *DC) override
Function HandleBlockEnd() Handle the "end" of a block command, i.e.
bool UnFill()
Function UnFill Removes the zone filling.
Definition: class_zone.cpp:156
void Delete_Segment_Edge(DRAWSEGMENT *Segment, wxDC *DC)
Definition: editedge.cpp:112
void HighLight(wxDC *DC)
Function HighLight.
Definition: highlight.cpp:105
PCB_LAYER_ID m_Route_Layer_BOTTOM
Definition: pcb_screen.h:46
bool Load_Module_From_BOARD(MODULE *Module)
Load in Modedit a footprint from the main board.
virtual void CrossHairOff(wxDC *DC=nullptr)
void StartMoveOneNodeOrSegment(TRACK *aTrack, wxDC *aDC, int aCommand)
Function StartMoveOneNodeOrSegment initializes the parameters to move one via or/and a terminal point...
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
void createArray()
Function createArray Create an array of the selected item (invokes the dialogue) This function is sha...
Definition: edit.cpp:1673
void Start_DragTrackSegmentAndKeepSlope(TRACK *track, wxDC *DC)
wxString g_DocModulesFileName
Definition: pcbnew.cpp:82
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:1020
void SetAutoPanRequest(bool aEnable)
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
void SaveCopyInUndoList(BOARD_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0)) override
Function SaveCopyInUndoList Creates a new entry in undo list of commands.
Definition: undo_redo.cpp:202
bool PlaceDraggedOrMovedTrackSegment(TRACK *Track, wxDC *DC)
void SetItem(EDA_ITEM *aItem)
int Delete_LastCreatedCorner(wxDC *DC)
Function Delete_LastCreatedCorner Used only while creating a new zone outline Remove and delete the c...
ROTATION_ANCHOR
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:100
bool IsLocked() const override
Function IsLocked.
Definition: class_module.h:268
void Add_Similar_Zone(wxDC *DC, ZONE_CONTAINER *zone_container)
Function Add_Similar_Zone Add a zone to a given zone outline.
void SetSelectedCorner(int aCorner)
Definition: class_zone.h:216
void Add_Zone_Cutout(wxDC *DC, ZONE_CONTAINER *zone_container)
Function Add_Zone_Cutout Add a cutout zone to a given zone outline.
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:101
void Edit_Zone_Params(wxDC *DC, ZONE_CONTAINER *zone_container)
Function Edit_Zone_Params Edit params (layer, clearance, ...) for a zone outline. ...
void Compile_Ratsnest(wxDC *aDC, bool aDisplayStatus)
Function Compile_Ratsnest Create the entire board ratsnest.
Definition: ratsnest.cpp:53
void Attribut_net(wxDC *DC, int net_code, bool Flag_On)
Definition: attribut.cpp:97
int m_rotationAngle
User defined rotation angle (in tenths of a degree).
int GetNetCode() const
Function GetNetCode.
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
void DeleteTextModule(TEXTE_MODULE *Text)
Definition: edtxtmod.cpp:126
void Attribut_Segment(TRACK *track, wxDC *DC, bool Flag_On)
Definition: attribut.cpp:50
void Draw(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
Function Draw BOARD_ITEMs have their own color information.
virtual void SetNoToolSelected()
Select the ID_NO_TOOL_SELECTED id tool (Idle tool)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
void Delete_Track(wxDC *DC, TRACK *Track)
Definition: deltrack.cpp:146
void SendMessageToEESCHEMA(BOARD_ITEM *objectToSync)
Function SendMessageToEESCHEMA sends a message to the schematic editor so that it may move its cursor...
BOARD * getBoard() const override
Definition: edit.cpp:1649
void ShowTargetOptionsDialog(PCB_TARGET *aTarget, wxDC *DC)
Definition: target_edit.cpp:83
virtual void HandleBlockPlace(wxDC *DC) override
Function HandleBlockPlace() Called after HandleBlockEnd, when a block command needs to be executed af...
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:99
void ShowDRCDialog(wxWindow *aParent=NULL)
Open a dialog and prompts the user, then if a test run button is clicked, runs the test(s) and create...
Definition: drc.cpp:61
see class PGM_BASE
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:991
Common, abstract interface for edit frames.
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
void Process_Special_Functions(wxCommandEvent &event)
Definition: edit.cpp:66
void ArchiveModulesOnBoard(bool aStoreInNewLib, const wxString &aLibName=wxEmptyString, wxString *aLibPath=NULL)
Function ArchiveModulesOnBoard Save modules in a library:
void duplicateZone(wxDC *aDC, ZONE_CONTAINER *aZone)
Function duplicateZone duplicates the given zone.
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
const wxString & GetReference() const
Function GetReference.
Definition: class_module.h:463
void StartMoveModule(MODULE *aModule, wxDC *aDC, bool aDragConnectedTracks)
Function StartMoveModule Initialize a drag or move pad command.
#define INSTALL_UNBUFFERED_DC(name, parent)
int GetToolId() const
Definition: draw_frame.h:519
VTBL_ENTRY wxConfigBase * CommonSettings() const
Definition: pgm_base.h:187
void SetIgnoreMouseEvents(bool aIgnore)
LAYER_NUM GetLayerSelection() const
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:154
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
PICKED_ITEMS_LIST & GetItems()
static bool GetLayer(MODEL_VRML &aModel, LAYER_NUM layer, VRML_LAYER **vlayer)
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
int GetSelectedCorner() const
Definition: class_zone.h:207
bool IsMicroViaAcceptable()
Function IsMicroViaAcceptable return true if a microvia can be placed on the board.
virtual void Delete(BOARD_ITEM *aItem)
Removes an item from the containter and deletes it.
void InsertVertex(int aGlobalIndex, VECTOR2I aNewVertex)
Function InsertVertex Adds a vertex in the globally indexed position aGlobalIndex.
void Delete_Zone_Contour(wxDC *DC, ZONE_CONTAINER *zone_container)
Function Delete_Zone Remove the zone which include the segment aZone, or the zone which have the give...
void PushPadProperties(D_PAD *aPad)
Function PushPadProperties Function to change pad caracteristics for the given footprint or all footp...
void Delete_net(wxDC *DC, TRACK *Track)
Definition: deltrack.cpp:156
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
void InstallPadOptionsFrame(D_PAD *pad)
int Fill_All_Zones(wxWindow *aActiveWindow)
Function Fill_All_Zones Fill all zones on the board The old fillings are removed. ...
MODULE * GetFootprintFromBoardByReference()
Function GetFootprintFromBoardByReference.
void StartMoveTexteModule(TEXTE_MODULE *Text, wxDC *DC)
Definition: edtxtmod.cpp:187
Module description (excepted pads)
PCB_LAYER_BOX_SELECTOR * m_SelLayerBox
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL)
void SelectCopperLayerPair()
Definition: sel_layer.cpp:260
void Change_Side_Module(MODULE *Module, wxDC *DC)
Function Change_Side_Module Flip a footprint (switch layer from component or component to copper) The...
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Set the screen cross hair position to aPosition in logical (drawing) units.
void Delete_OldZone_Fill(SEGZONE *aZone, timestamp_t aTimestamp=0)
Function Delete_OldZone_Fill (obsolete) Used for compatibility with old boards Remove the zone fillin...
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91
void SetLastCursorPosition(const wxPoint &aPosition)
Function SetLastCursorPosition sets the last cursor position to aPosition.
class SEGZONE, a segment used to fill a zone area (segment on a
Definition: typeinfo.h:97
int GetDefaultCursor() const
Function GetDefaultCursor.
BOARD_ITEM * GetCurItem()
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Function DisplayInfoMessage displays an informational message box with aMessage.
Definition: confirm.cpp:277
void SwitchLayer(wxDC *DC, PCB_LAYER_ID layer) override
Definition: edit.cpp:1340
void duplicateItems(bool aIncrement) override
Function duplicateItems Duplicate selected item if possible and start a move.
Definition: edit.cpp:1572
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:245
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
PCB_LAYER_ID SelectLayer(PCB_LAYER_ID aDefaultLayer, LSET aNotAllowedLayersMask=LSET(), wxPoint aDlgPosition=wxDefaultPosition)
Install the dialog box for layer selection.
Definition: sel_layer.cpp:205
const wxPoint GetPosition() const override
Definition: class_module.h:184
virtual void SetActiveLayer(PCB_LAYER_ID aLayer) override
Function SetActiveLayer will change the currently active layer to aLayer and also update the PCB_LAYE...
void Import_Pad_Settings(D_PAD *aPad, bool aDraw)
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:810
int m_lastDrawToolId
Tool ID of previously active draw tool bar button.
Definition: draw_frame.h:130
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:296
void Clean_Pcb()
Function Clean_Pcb Clean up the board (remove redundant vias, not connected tracks and merges colline...
void Delete_Drawings_All_Layer(PCB_LAYER_ID aLayer)
Definition: editedge.cpp:142
Class DIMENSION.
PCB_LAYER_ID m_Route_Layer_TOP
Definition: pcb_screen.h:45
void Edit_TrackSegm_Width(wxDC *aDC, TRACK *aTrackItem)
Function Edit_TrackSegm_Width Modify one track segment width or one via diameter (using DRC control)...
LEGACY_ARRAY_CREATOR(PCB_BASE_EDIT_FRAME &editFrame)
Definition: edit.cpp:1630
void SetCommand(BLOCK_COMMAND_T aCommand)
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:206
void End_Edge(DRAWSEGMENT *Segment, wxDC *DC)
Definition: editedge.cpp:304
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
MODULE * getModule() const override
Definition: edit.cpp:1654