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) 1992-2016 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 <wxPcbStruct.h>
41 
42 #include <pcbnew_id.h>
43 #include <pcbnew.h>
44 #include <module_editor_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 <modview_frame.h>
53 #include <dialog_drc.h>
55 #include <invoke_pcb_dialog.h>
56 #include <array_creator.h>
57 
58 #include <dialog_move_exact.h>
59 
60 #include <tool/tool_manager.h>
61 #include <tools/pcb_actions.h>
62 
63 // Handles the selection of command events.
64 void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
65 {
66  int id = event.GetId();
67 
69  MODULE* module;
71 
72  m_canvas->CrossHairOff( &dc );
73 
74  switch( id ) // Some (not all ) edit commands must be finished or aborted
75  {
76  case wxID_CUT:
77  case wxID_COPY:
146  case ID_POPUP_ZOOM_BLOCK:
147  case ID_POPUP_FLIP_BLOCK:
149  case ID_POPUP_COPY_BLOCK:
157  break;
158 
160  if( m_canvas->IsMouseCaptured() )
161  {
163  }
164 
165  // Should not be executed, just in case
166  if( GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE )
167  {
171  }
172 
173  if( GetToolId() == ID_NO_TOOL_SELECTED )
175  else
176  SetCursor( (wxStockCursor) m_canvas->GetDefaultCursor() );
177 
178  break;
179 
180  default: // Finish (abort) the command
181  if( m_canvas->IsMouseCaptured() )
183 
184  if( GetToolId() != id )
185  {
186  if( m_lastDrawToolId != GetToolId() )
188 
190  }
191  break;
192  }
193 
194  switch( id ) // Execute command
195  {
196  case 0:
197  break;
198 
200  {
202 
203  if( !editor )
204  {
206  editor->Zoom_Automatique( false );
207  }
208  else
209  {
210  // Needed on Windows, other platforms do not use it,
211  // but it creates no issue
212  if( editor->IsIconized() )
213  editor->Iconize( false );
214 
215  editor->Raise();
216 
217  // Raising the window does not set the focus on Linux. This should work on
218  // any platform.
219  if( wxWindow::FindFocus() != editor )
220  editor->SetFocus();
221  }
222 
223  editor->PushPreferences( m_canvas );
224  }
225  break;
226 
228  {
230 
231  if( !viewer )
232  {
234  viewer->Zoom_Automatique( false );
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 
265  case ID_POPUP_COPY_BLOCK:
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 edition
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  DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS dlg( this, GetBoard()->GetHighLightNetCode() );
342  dlg.ShowModal();
343  }
344  break;
345 
347  if( GetCurItem() == NULL )
348  break;
349  {
350  int type = GetCurItem()->Type();
351 
352  if( type == PCB_TRACE_T || type == PCB_VIA_T )
353  {
355  DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS dlg( this, item->GetNetCode() );
356  dlg.ShowModal();
357  }
358 
359  }
361  break;
362 
365  OnHotkeyBeginRoute( &dc );
366  break;
367 
370  End_Route( (TRACK*) GetCurItem(), &dc );
371  break;
372 
375 
376  if( GetCurItem()->IsDragging() )
377  {
379  }
380 
381  break;
382 
384  /* change the position of initial segment when creating new tracks
385  * switch from _/ to -\ .
386  * If a track is in progress, it will be redrawn
387  */
388  if( m_canvas->IsMouseCaptured() )
389  m_canvas->CallMouseCapture( &dc, wxDefaultPosition, false );
390 
392 
393  if( m_canvas->IsMouseCaptured() )
394  m_canvas->CallMouseCapture( &dc, wxDefaultPosition, false );
395 
396  break;
397 
399  if( !IsMicroViaAcceptable() )
400  break;
401  // fall through
407 
408  if( GetCurItem()->IsDragging() )
409  {
411  }
412  else
413  {
415  VIATYPE_T v_type = settings.m_CurrentViaType;
416  switch( id )
417  {
421  break;
422 
424  settings.m_CurrentViaType = VIA_MICROVIA;
425  break;
426 
427  default:
428  settings.m_CurrentViaType = VIA_THROUGH;
429  break;
430  }
431 
432  // place via and switch layer.
435  {
437 
438  wxPoint dlgPosition;
439 
440  wxGetMousePosition( &dlgPosition.x, &dlgPosition.y );
441 
442  PCB_LAYER_ID layer = SelectLayer( GetActiveLayer(), LSET::AllNonCuMask(), dlgPosition );
443 
444  m_canvas->SetIgnoreMouseEvents( false );
446 
447  if( GetActiveLayer() != layer )
448  {
450  GetScreen()->m_Route_Layer_BOTTOM = layer;
451  Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
452  }
453  }
454 
455  else
456  Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
457 
458  settings.m_CurrentViaType = v_type;
459 
460  if( displ_opts->m_ContrastModeDisplay )
461  m_canvas->Refresh();
462  }
463  break;
464 
466  if( GetCurItem() == NULL )
467  break;
468 
470  SetCurItem( Delete_Segment( &dc, (TRACK*) GetCurItem() ) );
471  OnModify();
472  break;
473 
475  if( GetCurItem() == NULL )
476  break;
478  Delete_Track( &dc, (TRACK*) GetCurItem() );
479  SetCurItem( NULL );
480  OnModify();
481  break;
482 
485  Delete_net( &dc, (TRACK*) GetCurItem() );
486  SetCurItem( NULL );
487  OnModify();
488  break;
489 
491  Attribut_Segment( (TRACK*) GetCurItem(), &dc, true );
492  break;
493 
495  Attribut_Segment( (TRACK*) GetCurItem(), &dc, false );
496  break;
497 
499  Attribut_Track( (TRACK*) GetCurItem(), &dc, true );
500  break;
501 
503  Attribut_Track( (TRACK*) GetCurItem(), &dc, false );
504  break;
505 
507  Attribut_net( &dc, ( (TRACK*) GetCurItem() )->GetNetCode(), true );
508  break;
509 
511  Attribut_net( &dc, ( (TRACK*) GetCurItem() )->GetNetCode(), false );
512  break;
513 
515  break;
516 
519 
520  if( GetCurItem() == NULL )
521  break;
522 
523  {
524  SEGZONE* zsegm = (SEGZONE*) GetCurItem();
525  int netcode = zsegm->GetNetCode();
526  Delete_OldZone_Fill( zsegm );
527  SetCurItem( NULL );
528  TestNetConnection( NULL, netcode );
529  OnModify();
530  SetMsgPanel( GetBoard() );
531  }
532  break;
533 
536  SetCurItem( NULL ); // Outlines can have changed
537  break;
538 
540  {
542  duplicateZone( &dc, zone );
543  }
544  break;
545 
548  m_canvas->SetAutoPanRequest( true );
550  break;
551 
554  m_canvas->SetAutoPanRequest( true );
556  break;
557 
559  // Force the main contour selection, to remove the entire zone:
560  ((ZONE_CONTAINER*) GetCurItem())->SetSelectedCorner( 0 );
561  // Fall through
564  {
565  int netcode = ( (ZONE_CONTAINER*) GetCurItem() )->GetNetCode();
567  SetCurItem( NULL );
568  TestNetConnection( NULL, netcode );
569  SetMsgPanel( GetBoard() );
570  }
571  break;
572 
575  SetCurItem( NULL );
576  break;
577 
579  {
581  ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
582  m_canvas->SetAutoPanRequest( true );
583  Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->GetSelectedCorner(), false );
584  }
585  break;
586 
588  {
590  ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
591  m_canvas->SetAutoPanRequest( true );
592  Start_Move_Zone_Drag_Outline_Edge( &dc, zone_cont, zone_cont->GetSelectedCorner() );
593  }
594  break;
595 
597  {
599  ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
600  m_canvas->SetAutoPanRequest( true );
601  Start_Move_Zone_Outlines( &dc, zone_cont );
602  }
603  break;
604 
606  {
608  ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
610 
611  /* add corner between zone_cont->m_CornerSelection
612  * and zone_cont->m_CornerSelection+1
613  * and start move the new corner
614  */
615  zone_cont->Draw( m_canvas, &dc, GR_XOR );
616  zone_cont->Outline()->InsertVertex( zone_cont->GetSelectedCorner(), pos );
617  zone_cont->SetSelectedCorner( zone_cont->GetSelectedCorner() + 1 );
618  zone_cont->Draw( m_canvas, &dc, GR_XOR );
619  m_canvas->SetAutoPanRequest( true );
620  Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->GetSelectedCorner(), true );
621  }
622  break;
623 
627  {
629  ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
630  End_Move_Zone_Corner_Or_Outlines( &dc, zone_cont );
631  m_canvas->SetAutoPanRequest( false );
632  }
633  break;
634 
637  Fill_All_Zones( this );
638  m_canvas->Refresh();
639  SetMsgPanel( GetBoard() );
640  break;
641 
643  if( ( GetCurItem() )->Type() == PCB_ZONE_AREA_T )
644  {
645  ZONE_CONTAINER* zone_container = (ZONE_CONTAINER*) GetCurItem();
646  zone_container->UnFill();
647  TestNetConnection( NULL, zone_container->GetNetCode() );
648  OnModify();
649  SetMsgPanel( GetBoard() );
650  m_canvas->Refresh();
651  }
652  SetCurItem( NULL );
653  break;
654 
655  case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES: // Remove all zones :
656  GetBoard()->m_Zone.DeleteAll(); // remove zone segments used to fill zones.
657 
658  for( int ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
659  {
660  // Remove filled areas in zone
661  ZONE_CONTAINER* zone_container = GetBoard()->GetArea( ii );
662  zone_container->UnFill();
663  }
664 
665  SetCurItem( NULL ); // CurItem might be deleted by this command, clear the pointer
666  TestConnections();
667  TestForActiveLinksInRatsnest( 0 ); // Recalculate the active ratsnest, i.e. the unconnected links
668  OnModify();
669  SetMsgPanel( GetBoard() );
670  m_canvas->Refresh();
671  break;
672 
676  TestNetConnection( NULL, ( (ZONE_CONTAINER*) GetCurItem() )->GetNetCode() );
677  SetMsgPanel( GetBoard() );
678  m_canvas->Refresh();
679  break;
680 
683  m_canvas->SetAutoPanRequest( true );
684  break;
685 
688  if( GetCurItem() == NULL )
689  break;
690 
691  // If the current Item is a pad, text module ...: Get its parent
692  if( GetCurItem()->Type() != PCB_MODULE_T )
693  SetCurItem( GetCurItem()->GetParent() );
694 
695  if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
696  break;
697 
698  module = (MODULE*) GetCurItem();
699 
700  if( module->IsLocked() )
701  {
702  wxString msg;
703  msg.Printf( _( "Footprint %s found, but it is locked" ),
704  module->GetReference().GetData() );
705  DisplayInfoMessage( this, msg );
706  break;
707  }
708 
709  SendMessageToEESCHEMA( module );
710  SetCrossHairPosition( module->GetPosition() );
713  break;
714 
715  case ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST: // get module by name and move it
717  module = (MODULE*) GetCurItem();
718 
719  if( module == NULL )
720  break;
721 
722  if( module->IsLocked() )
723  {
724  wxString msg = wxString::Format(
725  _( "Footprint %s found, but it is locked" ),
726  module->GetReference().GetData() );
727  DisplayInfoMessage( this, msg );
728  break;
729  }
730 
731  SendMessageToEESCHEMA( module );
733  StartMoveModule( module, &dc, false );
734  break;
735 
738 
739  // If the current Item is a pad, text module ...: Get its parent
740  if( GetCurItem()->Type() != PCB_MODULE_T )
741  SetCurItem( GetCurItem()->GetParent() );
742 
743  if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
744  break;
745 
746  module = (MODULE*) GetCurItem();
747 
748  if( module->IsLocked() )
749  {
750  wxString msg;
751  msg.Printf( _( "Footprint %s found, but it is locked" ),
752  module->GetReference().GetData() );
753  DisplayInfoMessage( this, msg );
754  break;
755  }
756 
757  if( Delete_Module( (MODULE*) GetCurItem(), &dc ) )
758  {
759  SetCurItem( NULL );
760  }
761 
762  break;
763 
766 
767  // If the current Item is a pad, text module ...: Get its parent
768  if( GetCurItem()->Type() != PCB_MODULE_T )
769  SetCurItem( GetCurItem()->GetParent() );
770 
771  if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
772  break;
773 
774  module = (MODULE*) GetCurItem();
775 
776  if( module->IsLocked() )
777  {
778  wxString msg;
779  msg.Printf( _( "Footprint %s found, but it is locked" ),
780  module->GetReference().GetData() );
781  DisplayInfoMessage( this, msg );
782  break;
783  }
784 
785  // This is a simple rotation, no other editing in progress
786  if( !GetCurItem()->IsMoving() )
787  SaveCopyInUndoList( GetCurItem(), UR_CHANGED, ((MODULE*)GetCurItem())->GetPosition() );
788 
789  Rotate_Module( &dc, (MODULE*) GetCurItem(), m_rotationAngle, true );
790  break;
791 
794 
795  // If the current Item is a pad, text module ...: Get its parent
796  if( GetCurItem()->Type() != PCB_MODULE_T )
797  SetCurItem( GetCurItem()->GetParent() );
798 
799  if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
800  break;
801 
802  module = (MODULE*) GetCurItem();
803 
804  if( module->IsLocked() )
805  {
806  wxString msg;
807  msg.Printf( _( "Footprint %s found, but it is locked" ),
808  module->GetReference().GetData() );
809  DisplayInfoMessage( this, msg );
810  break;
811  }
812 
813  // This is a simple rotation, no other editing in progress
814  if( !GetCurItem()->IsMoving() )
815  SaveCopyInUndoList( GetCurItem(), UR_CHANGED, ((MODULE*)GetCurItem())->GetPosition() );
816 
817  Rotate_Module( &dc, (MODULE*) GetCurItem(), -m_rotationAngle, true );
818  break;
819 
822 
823  // If the current Item is a pad, text module ...: Get its parent
824  if( GetCurItem()->Type() != PCB_MODULE_T )
825  SetCurItem( GetCurItem()->GetParent() );
826 
827  if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
828  break;
829 
830  module = (MODULE*) GetCurItem();
831 
832  if( module->IsLocked() )
833  {
834  wxString msg;
835  msg.Printf( _( "Footprint %s found, but it is locked" ),
836  module->GetReference().GetData() );
837  DisplayInfoMessage( this, msg );
838  break;
839  }
840 
841  // This is a simple flip, no other editing in progress
842  if( !GetCurItem()->IsMoving() )
843  SaveCopyInUndoList( GetCurItem(), UR_FLIPPED, ((MODULE*)GetCurItem())->GetPosition() );
844 
845  Change_Side_Module( (MODULE*) GetCurItem(), &dc );
846  break;
847 
849  if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
850  break;
851 
853  // Warning: the current item can be deleted by exchange module
854  SetCurItem( NULL );
856  break;
857 
859  // If the current Item is a pad, text module ...: Get its parent
860  if( GetCurItem()->Type() != PCB_MODULE_T )
861  SetCurItem( GetCurItem()->GetParent() );
862 
863  if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
864  break;
865 
868  break;
869 
871 
872  // If we don't have a current item, there's nothing we can do here
873  if( !GetCurItem() )
874  break;
875 
876  // If the current Item is a pad, text module ...: Get its parent
877  if( GetCurItem()->Type() != PCB_MODULE_T )
878  SetCurItem( GetCurItem()->GetParent() );
879 
880  if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
881  break;
882 
883  if( GetCurItem()->GetTimeStamp() == 0 ) // Module Editor needs a non null timestamp
884  {
886  OnModify();
887  }
888 
889  {
891 
893  SetCurItem( NULL ); // the current module could be deleted by
894  }
896  break;
897 
899  module = (MODULE*) GetCurItem()->GetParent();
900 
901  if( !module || module->Type() != PCB_MODULE_T )
902  break;
903 
904  if( module->IsLocked() )
905  {
906  wxString msg;
907  msg.Printf( _( "The parent (%s) of the pad is locked" ),
908  module->GetReference().GetData() );
909  DisplayInfoMessage( this, msg );
910  break;
911  }
912 
914  StartMovePad( (D_PAD*) GetCurItem(), &dc, true );
915  break;
916 
918  module = (MODULE*) GetCurItem()->GetParent();
919 
920  if( !module || module->Type() != PCB_MODULE_T )
921  break;
922 
923  if( module->IsLocked() )
924  {
925  wxString msg;
926  msg.Printf( _( "The parent (%s) of the pad is locked" ),
927  module->GetReference().GetData() );
928  DisplayInfoMessage( this, msg );
929  break;
930  }
931 
933  StartMovePad( (D_PAD*) GetCurItem(), &dc, false );
934  break;
935 
939  break;
940 
943  SaveCopyInUndoList( GetCurItem()->GetParent(), UR_CHANGED );
944  Import_Pad_Settings( (D_PAD*) GetCurItem(), true );
945  break;
946 
950  break;
951 
955  break;
956 
958  SaveCopyInUndoList( GetCurItem()->GetParent(), UR_CHANGED );
959  DeletePad( (D_PAD*) GetCurItem() );
960  SetCurItem( NULL );
962  break;
963 
965  InstallTextModOptionsFrame( static_cast<TEXTE_MODULE*>( GetCurItem() ), &dc );
967  break;
968 
970  ResetTextSize( GetCurItem(), &dc );
971  break;
972 
975  StartMoveTexteModule( static_cast<TEXTE_MODULE*>( GetCurItem() ), &dc );
976  break;
977 
979  RotateTextModule( static_cast<TEXTE_MODULE*>( GetCurItem() ), &dc );
981  break;
982 
984  DeleteTextModule( static_cast<TEXTE_MODULE*>( GetCurItem() ) );
985  SetCurItem( NULL );
987  break;
988 
990  {
992 
993  if( itmp >= 0 )
994  {
995  // if user changed colors and we are in high contrast mode, then redraw
996  // because the PAD_ATTRIB_SMD pads may change color.
997  if( displ_opts->m_ContrastModeDisplay && GetActiveLayer() != itmp )
998  {
999  m_canvas->Refresh();
1000  }
1001  SetActiveLayer( itmp );
1002  }
1003 
1005  }
1006  break;
1007 
1010  break;
1011 
1013  {
1015 
1016  if( itmp >= 0 )
1017  SetActiveLayer( itmp );
1018 
1020  }
1021  break;
1022 
1024  {
1026 
1027  if( itmp >= 0 )
1028  SetActiveLayer( itmp );
1029  }
1030  break;
1031 
1035  break;
1036 
1039 
1040  if( displ_opts->m_ContrastModeDisplay )
1041  m_canvas->Refresh( true );
1042  break;
1043 
1047  break;
1048 
1050  Rotate_Texte_Pcb( (TEXTE_PCB*) GetCurItem(), &dc );
1052  break;
1053 
1055  CreateTextePcb( &dc, (TEXTE_PCB*) GetCurItem() );
1057  m_canvas->SetAutoPanRequest( true );
1058  break;
1059 
1061  FlipTextePcb( (TEXTE_PCB*) GetCurItem(), &dc );
1063  break;
1064 
1066  Delete_Texte_Pcb( (TEXTE_PCB*) GetCurItem(), &dc );
1068  break;
1069 
1071  BeginMoveTarget( (PCB_TARGET*) GetCurItem(), &dc );
1073  break;
1074 
1078  break;
1079 
1082  DeleteTarget( (PCB_TARGET*) GetCurItem(), &dc );
1083  SetCurItem( NULL );
1084  break;
1085 
1088  DeleteDimension( (DIMENSION*) GetCurItem(), &dc );
1089  SetCurItem( NULL );
1090  break;
1091 
1095  break;
1096 
1099  break;
1100 
1104  break;
1105 
1107  RemoveStruct( GetCurItem(), &dc );
1109  break;
1110 
1112  if( GetCurItem() && GetCurItem()->Type() == PCB_MARKER_T )
1113  ( (MARKER_PCB*) GetCurItem() )->DisplayMarkerInfo( this );
1114 
1116  break;
1117 
1119  if( GetCurItem()->GetFlags() != 0 )
1120  break;
1121 
1123  SetCurItem( NULL );
1125  m_canvas->Refresh();
1126  break;
1127 
1129 #ifndef USE_WX_OVERLAY
1131 #else
1132  // #1277772 - Draw into dialog converted in refresh request
1134  m_canvas->Refresh();
1135 #endif
1137  break;
1138 
1142  break;
1143 
1146 
1147  if( GetCurItem() && (GetCurItem()->IsNew()) )
1148  {
1149  End_Edge( (DRAWSEGMENT*) GetCurItem(), &dc );
1150  SetCurItem( NULL );
1151  }
1152 
1153  break;
1154 
1157 
1158  if( GetCurItem() && (GetCurItem()->IsNew()) )
1159  {
1160  if( End_Zone( &dc ) )
1161  SetCurItem( NULL );
1162  }
1163 
1164  m_canvas->SetAutoPanRequest( false );
1165  break;
1166 
1169 
1170  if( GetCurItem() && (GetCurItem()->IsNew()) )
1171  {
1172  if( Delete_LastCreatedCorner( &dc ) == 0 ) // No more segment in outline,
1173  SetCurItem( NULL );
1174  }
1175 
1176  break;
1177 
1178 
1182  break;
1183 
1188  break;
1189 
1193  break;
1194 
1197  {
1198  TRACK* track = (TRACK*) GetScreen()->GetCurItem();
1199  wxPoint pos = GetCrossHairPosition();
1200 
1201  track->Draw( m_canvas, &dc, GR_XOR );
1202  PICKED_ITEMS_LIST itemsListPicker;
1203 
1204  TRACK* newtrack = GetBoard()->CreateLockPoint( pos, track, &itemsListPicker );
1205 
1206  SaveCopyInUndoList( itemsListPicker, UR_UNSPECIFIED );
1207  track->Draw( m_canvas, &dc, GR_XOR );
1208  newtrack->Draw( m_canvas, &dc, GR_XOR );
1209 
1210  // compute the new ratsnest, because connectivity could change
1211  TestNetConnection( &dc, track->GetNetCode() );
1212  }
1213  break;
1214 
1216  moveExact();
1217  break;
1218 
1222  break;
1223 
1225  createArray();
1226  break;
1227 
1228  case ID_MENU_PCB_CLEAN:
1229  Clean_Pcb();
1230  break;
1231 
1233  Swap_Layers( event );
1234  break;
1235 
1237  InvokeDialogGrid();
1238  break;
1239 
1241  {
1242  wxConfigBase* cfg = Pgm().CommonSettings();
1243  cfg->Read( wxT( "module_doc_file" ), g_DocModulesFileName );
1244  GetAssociatedDocument( this, g_DocModulesFileName, &Kiface().KifaceSearch() );
1245  }
1246  break;
1247 
1249  ArchiveModulesOnBoard( false );
1250  break;
1251 
1253  ArchiveModulesOnBoard( true );
1254  break;
1255 
1258  m_canvas->Refresh();
1259  break;
1260 
1261  default:
1262  wxString msg;
1263  msg.Printf( wxT( "PCB_EDIT_FRAME::Process_Special_Functions() unknown event id %d" ), id );
1264  DisplayError( this, msg );
1265  break;
1266  }
1267 
1268  m_canvas->CrossHairOn( &dc );
1269  m_canvas->SetIgnoreMouseEvents( false );
1270 }
1271 
1272 
1274 {
1275  if( Item == NULL )
1276  return;
1277 
1278  switch( Item->Type() )
1279  {
1280  case PCB_MODULE_T:
1281  Delete_Module( (MODULE*) Item, DC );
1282  break;
1283 
1284  case PCB_DIMENSION_T:
1285  DeleteDimension( (DIMENSION*) Item, DC );
1286  break;
1287 
1288  case PCB_TARGET_T:
1289  DeleteTarget( (PCB_TARGET*) Item, DC );
1290  break;
1291 
1292  case PCB_LINE_T:
1293  Delete_Segment_Edge( (DRAWSEGMENT*) Item, DC );
1294  break;
1295 
1296  case PCB_TEXT_T:
1297  Delete_Texte_Pcb( (TEXTE_PCB*) Item, DC );
1298  break;
1299 
1300  case PCB_TRACE_T:
1301  Delete_Track( DC, (TRACK*) Item );
1302  break;
1303 
1304  case PCB_VIA_T:
1305  Delete_Segment( DC, (TRACK*) Item );
1306  break;
1307 
1308  case PCB_ZONE_T:
1309  Delete_OldZone_Fill( (SEGZONE*) Item );
1310  break;
1311 
1312  case PCB_ZONE_AREA_T:
1313  {
1314  SetCurItem( NULL );
1315  int netcode = ( (ZONE_CONTAINER*) Item )->GetNetCode();
1316  Delete_Zone_Contour( DC, (ZONE_CONTAINER*) Item );
1317  TestNetConnection( NULL, netcode );
1318  SetMsgPanel( GetBoard() );
1319  }
1320  break;
1321 
1322  case PCB_MARKER_T:
1323  if( Item == GetCurItem() )
1324  SetCurItem( NULL );
1325 
1326  ( (MARKER_PCB*) Item )->Draw( m_canvas, DC, GR_XOR );
1327 
1328  // delete the marker, and free memory. Don't use undo stack.
1329  GetBoard()->Delete( Item );
1330  break;
1331 
1332  case PCB_PAD_T:
1333  case PCB_MODULE_TEXT_T:
1334  case PCB_MODULE_EDGE_T:
1335  break;
1336 
1337  case TYPE_NOT_INIT:
1338  case PCB_T:
1339  default:
1340  {
1341  wxString msg = wxString::Format(
1342  wxT( "Remove: item type %d unknown." ), Item->Type() );
1343  DisplayError( this, msg );
1344  }
1345  break;
1346  }
1347 }
1348 
1349 
1351 {
1352  PCB_LAYER_ID curLayer = GetActiveLayer();
1354 
1355  // Check if the specified layer matches the present layer
1356  if( layer == curLayer )
1357  return;
1358 
1359  // Copper layers cannot be selected unconditionally; how many
1360  // of those layers are currently enabled needs to be checked.
1361  if( IsCopperLayer( layer ) )
1362  {
1363  // If only one copper layer is enabled, the only such layer
1364  // that can be selected to is the "Back" layer (so the
1365  // selection of any other copper layer is disregarded).
1366  if( GetBoard()->GetCopperLayerCount() < 2 )
1367  {
1368  if( layer != B_Cu )
1369  return;
1370  }
1371  // If more than one copper layer is enabled, the "Copper"
1372  // and "Component" layers can be selected, but the total
1373  // number of copper layers determines which internal
1374  // layers are also capable of being selected.
1375  else
1376  {
1377  if( layer != B_Cu && layer != F_Cu && layer >= GetBoard()->GetCopperLayerCount() - 1 )
1378  return;
1379  }
1380 
1381  EDA_ITEM* current = GetScreen()->GetCurItem();
1382 
1383  // See if we are drawing a segment; if so, add a via?
1384  if( GetToolId() == ID_TRACK_BUTT && current )
1385  {
1386  if( current->Type() == PCB_TRACE_T && current->IsNew() )
1387  {
1388  // Want to set the routing layers so that it switches properly -
1389  // see the implementation of Other_Layer_Route - the working
1390  // layer is used to 'start' the via and set the layer masks appropriately.
1391  GetScreen()->m_Route_Layer_TOP = curLayer;
1392  GetScreen()->m_Route_Layer_BOTTOM = layer;
1393 
1394  SetActiveLayer( curLayer );
1395 
1396  if( Other_Layer_Route( (TRACK*) GetScreen()->GetCurItem(), DC ) )
1397  {
1398  if( displ_opts->m_ContrastModeDisplay )
1399  m_canvas->Refresh();
1400  }
1401 
1402  // if the via was allowed by DRC, then the layer swap has already
1403  // been done by Other_Layer_Route(). if via not allowed, then
1404  // return now so assignment to setActiveLayer() below doesn't happen.
1405  return;
1406  }
1407  }
1408  }
1409 
1410  // Is yet more checking required? E.g. when the layer to be selected
1411  // is a non-copper layer, or when switching between a copper layer
1412  // and a non-copper layer, or vice-versa?
1413  // ...
1414 
1415  SetActiveLayer( layer );
1416 
1417  if( displ_opts->m_ContrastModeDisplay )
1418  m_canvas->Refresh();
1419 }
1420 
1421 
1422 void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
1423 {
1424  int id = aEvent.GetId();
1425 
1426  if( GetToolId() == id )
1427  return;
1428 
1431 
1432  // Stop the current command and deselect the current tool.
1434 
1435  switch( id )
1436  {
1437  case ID_NO_TOOL_SELECTED:
1438  SetToolID( id, m_canvas->GetDefaultCursor(), wxEmptyString );
1439  break;
1440 
1441  case ID_ZOOM_SELECTION:
1442  SetToolID( id, wxCURSOR_MAGNIFIER, _( "Zoom to selection" ) );
1443  break;
1444 
1445  case ID_TRACK_BUTT:
1446  if( g_Drc_On )
1447  SetToolID( id, wxCURSOR_PENCIL, _( "Add tracks" ) );
1448  else
1449  SetToolID( id, wxCURSOR_QUESTION_ARROW, _( "Add tracks" ) );
1450 
1451  if( (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
1452  {
1453  Compile_Ratsnest( &dc, true );
1454  }
1455 
1456  break;
1457 
1458  case ID_PCB_MODULE_BUTT:
1459  SetToolID( id, wxCURSOR_PENCIL, _( "Add footprint" ) );
1460  break;
1461 
1462  case ID_PCB_ZONES_BUTT:
1463  SetToolID( id, wxCURSOR_PENCIL, _( "Add zones" ) );
1464 
1465  if( displ_opts->m_DisplayZonesMode != 0 )
1466  DisplayInfoMessage( this, _( "Warning: zone display is OFF!!!" ) );
1467 
1468  if( !GetBoard()->IsHighLightNetON() && (GetBoard()->GetHighLightNetCode() > 0 ) )
1469  HighLight( &dc );
1470 
1471  break;
1472 
1474  SetToolID( id, wxCURSOR_PENCIL, _( "Add keepout" ) );
1475  break;
1476 
1477  case ID_PCB_MIRE_BUTT:
1478  SetToolID( id, wxCURSOR_PENCIL, _( "Add layer alignment target" ) );
1479  break;
1480 
1482  SetToolID( id, wxCURSOR_PENCIL, _( "Adjust zero" ) );
1483  break;
1484 
1486  SetToolID( id, wxCURSOR_PENCIL, _( "Adjust grid origin" ) );
1487  break;
1488 
1489  case ID_PCB_ADD_LINE_BUTT:
1490  SetToolID( id, wxCURSOR_PENCIL, _( "Add graphic line" ) );
1491  break;
1492 
1493  case ID_PCB_ARC_BUTT:
1494  SetToolID( id, wxCURSOR_PENCIL, _( "Add graphic arc" ) );
1495  break;
1496 
1497  case ID_PCB_CIRCLE_BUTT:
1498  SetToolID( id, wxCURSOR_PENCIL, _( "Add graphic circle" ) );
1499  break;
1500 
1501  case ID_PCB_ADD_TEXT_BUTT:
1502  SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
1503  break;
1504 
1505  case ID_COMPONENT_BUTT:
1506  SetToolID( id, wxCURSOR_HAND, _( "Add footprint" ) );
1507  break;
1508 
1509  case ID_PCB_DIMENSION_BUTT:
1510  SetToolID( id, wxCURSOR_PENCIL, _( "Add dimension" ) );
1511  break;
1512 
1514  SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
1515  break;
1516 
1517  case ID_PCB_HIGHLIGHT_BUTT:
1518  SetToolID( id, wxCURSOR_HAND, _( "Highlight net" ) );
1519  break;
1520 
1522  SetToolID( id, wxCURSOR_HAND, _( "Select rats nest" ) );
1523 
1524  if( ( GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK ) == 0 )
1525  Compile_Ratsnest( &dc, true );
1526 
1527  break;
1528 
1529  // collect GAL-only tools here
1531  SetToolID( id, wxCURSOR_DEFAULT, _( "Unsupported tool in this canvas" ) );
1532  break;
1533  }
1534 }
1535 
1536 
1538 {
1539  wxPoint translation;
1540  double rotation = 0;
1541 
1542  DIALOG_MOVE_EXACT dialog( this, translation, rotation );
1543  int ret = dialog.ShowModal();
1544 
1545  if( ret == wxID_OK )
1546  {
1547  if( BOARD_ITEM* item = GetScreen()->GetCurItem() )
1548  {
1549  // When a pad is modified, the full footprint is saved
1550  BOARD_ITEM* itemToSave = item;
1551 
1552  if( item->Type() == PCB_PAD_T )
1553  itemToSave = item->GetParent();
1554 
1555  // Could be moved or rotated
1556  SaveCopyInUndoList( itemToSave, UR_CHANGED );
1557 
1558  item->Move( translation );
1559  item->Rotate( item->GetPosition(), rotation );
1560  m_canvas->Refresh();
1561  }
1562  }
1563 
1565 }
1566 
1567 
1568 void PCB_EDIT_FRAME::duplicateItems( bool aIncrement )
1569 {
1570  BOARD_ITEM* item = GetScreen()->GetCurItem();
1571 
1572  if( !item )
1573  return;
1574 
1575  // In the board editor, the pads or fp texts can be edited
1576  // but cannot be duplicated (only the fp editor can do that).
1577  // only the footprint can be duplicated
1578  if( item->Type() == PCB_PAD_T || item->Type() == PCB_MODULE_TEXT_T )
1579  item = static_cast<MODULE*>( item )->GetParent();
1580 
1581  PCB_BASE_EDIT_FRAME::duplicateItem( item, aIncrement );
1582 }
1583 
1584 
1585 void PCB_BASE_EDIT_FRAME::duplicateItem( BOARD_ITEM* aItem, bool aIncrement )
1586 {
1587  if( !aItem )
1588  return;
1589 
1590  // The easiest way to handle a duplicate item command
1591  // is to simulate a block copy command, which gives us the undo management
1592  // for free
1593  if( GetScreen()->m_BlockLocate.GetState() == STATE_NO_BLOCK )
1594  {
1596 
1598 
1599  wxPoint crossHairPos = GetCrossHairPosition();
1600 
1601  const BLOCK_COMMAND_T blockType = aIncrement ? BLOCK_COPY_AND_INCREMENT : BLOCK_COPY;
1602 
1603  if( !HandleBlockBegin( &dc, blockType, crossHairPos ) )
1604  return;
1605 
1606  // Add the item to the block copy pick list:
1608  ITEM_PICKER picker( NULL, UR_UNSPECIFIED );
1609 
1610  picker.SetItem ( aItem );
1611  itemsList.PushItem( picker );
1612 
1613  // Set 2 coordinates updated by the mouse, because our simulation
1614  // does not use the mouse to call HandleBlockEnd()
1615  GetScreen()->m_BlockLocate.SetLastCursorPosition( crossHairPos );
1616  GetScreen()->m_BlockLocate.SetEnd( crossHairPos );
1617  HandleBlockEnd( &dc );
1618  }
1619 }
1620 
1621 
1623 {
1624 public:
1625 
1627  ARRAY_CREATOR( editFrame ),
1628  m_item( m_parent.GetScreen()->GetCurItem() )
1629  {}
1630 
1631 private:
1632 
1633  int getNumberOfItemsToArray() const override
1634  {
1635  // only handle single items
1636  return (m_item != NULL) ? 1 : 0;
1637  }
1638 
1639  BOARD_ITEM* getNthItemToArray( int n ) const override
1640  {
1641  wxASSERT_MSG( n == 0, "Legacy array tool can only handle a single item" );
1642  return m_item;
1643  }
1644 
1645  BOARD* getBoard() const override
1646  {
1647  return m_parent.GetBoard();
1648  }
1649 
1650  MODULE* getModule() const override
1651  {
1652  return dynamic_cast<MODULE*>( m_item->GetParent() );
1653  }
1654 
1655  wxPoint getRotationCentre() const override
1656  {
1657  return m_item->GetCenter();
1658  }
1659 
1660  void finalise() override
1661  {
1662  m_parent.GetCanvas()->Refresh();
1663  }
1664 
1665  BOARD_ITEM* m_item; // only have the one
1666 };
1667 
1668 
1670 {
1671  LEGACY_ARRAY_CREATOR array_creator( *this );
1672 
1673  array_creator.Invoke();
1674 }
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:639
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:198
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:179
virtual void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
Definition: pcbframe.cpp:996
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:78
bool Other_Layer_Route(TRACK *track, wxDC *DC)
Function Other_Layer_Route operates in one of two ways.
bool g_Drc_On
Definition: pcbnew.cpp:70
Definition of class FOOTPRINT_EDIT_FRAME.
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 type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA)
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
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:97
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
Function SetToolID sets 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 TestForActiveLinksInRatsnest(int aNetCode)
Function TestForActiveLinksInRatsnest Explores the full rats nest list (which must exist) to determin...
Definition: ratsnest.cpp:469
void DeleteDimension(DIMENSION *aDimension, wxDC *aDC)
Definition: dimension.cpp:363
TEXTE_PCB class definition.
int getNumberOfItemsToArray() const override
Definition: edit.cpp:1633
bool g_Alternate_Track_Posture
Definition: pcbnew.cpp:73
bool End_Zone(wxDC *DC)
Function End_Zone terminates (if no DRC error ) the zone edge creation process.
void InstallTextPCBOptionsFrame(TEXTE_PCB *TextPCB, wxDC *DC)
Routine for main window class to launch text properties dialog.
int InstallExchangeModuleFrame(MODULE *ExchangeModuleModule)
Definition: pcbframe.cpp:1189
void InstallPcbGlobalDeleteFrame(const wxPoint &pos)
This file is part of the common library TODO brief description.
PCB_EDIT_FRAME::OnResetModuleTextSizes PCB_EDIT_FRAME::OnSelectOptionToolbar PCB_EDIT_FRAME::OnSelectOptionToolbar PCB_EDIT_FRAME::OnSelectOptionToolbar PCB_EDIT_FRAME::OnSelectOptionToolbar ID_PCB_MEASUREMENT_TOOL
Definition: pcbframe.cpp:262
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
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...
Definition: modules.cpp:258
This file is part of the common library.
bool IsNew() const
Definition: base_struct.h:216
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
int Fill_All_Zones(wxWindow *aActiveWindow, bool aVerbose=true)
Function Fill_All_Zones Fill all zones on the board The old fillings are removed. ...
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:299
void TestNetConnection(wxDC *aDC, int aNetCode)
Function TestNetConnection tests the connections relative to aNetCode.
Definition: connect.cpp:786
wxPoint getRotationCentre() const override
Definition: edit.cpp:1655
This file is part of the common library.
void FlipTextePcb(TEXTE_PCB *aTextePcb, wxDC *aDC)
Class BOARD to handle a board.
const wxPoint & GetPosition() const override
Definition: class_module.h:143
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 InstallGraphicItemPropertiesDialog(DRAWSEGMENT *aItem, wxDC *aDC)
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.
Definition: modview_frame.h:44
static LSET AllNonCuMask()
Function AllNonCuMask returns a mask holding all layer minus CU layers.
Definition: lset.cpp:662
void BeginMoveDimensionText(DIMENSION *aItem, wxDC *DC)
Definition: dimension.cpp:381
void ShowDimensionPropertyDialog(DIMENSION *aDimension, wxDC *aDC)
Definition: dimension.cpp:353
PCB_BASE_FRAME & m_parent
Definition: array_creator.h:61
int GetCopperLayerCount() const
Function GetCopperLayerCount.
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:114
void SetCurItem(BOARD_ITEM *aItem, bool aDisplayInfo=true)
Function SetCurItem sets the currently selected item and displays it in the MsgPanel.
time_t GetNewTimeStamp()
Definition: common.cpp:166
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:247
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:104
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:86
Classes to handle copper zones.
void Rotate_Module(wxDC *DC, MODULE *module, double angle, bool incremental)
Definition: modules.cpp:430
DLIST< SEGZONE > m_Zone
Definition: class_board.h:245
void Delete_Texte_Pcb(TEXTE_PCB *TextePcb, wxDC *DC)
void OnSelectTool(wxCommandEvent &aEvent)
Definition: edit.cpp:1422
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
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:102
void duplicateItem(BOARD_ITEM *aItem, bool aIncrement)
Function duplicateItem Duplicate the specified item This function is shared between pcbnew and modedi...
Definition: edit.cpp:1585
void RotateTextModule(TEXTE_MODULE *Text, wxDC *DC)
Definition: edtxtmod.cpp:108
DRC * m_drc
the DRC controller, see drc.cpp
Definition: wxPcbStruct.h:96
void DeleteAll()
Function DeleteAll deletes all items on the list and leaves the list empty.
Definition: dlist.cpp:41
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:49
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:348
int GetState(int type) const
Definition: base_struct.h:237
void PushPreferences(const EDA_DRAW_PANEL *aParentCanvas)
Function PushPreferences Pushes a few preferences from a parent window to a child window...
Definition: draw_frame.cpp:787
void finalise() override
Definition: edit.cpp:1660
Class BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected an...
void RemoveStruct(BOARD_ITEM *Item, wxDC *DC)
Definition: edit.cpp:1273
bool End_Route(TRACK *aTrack, wxDC *aDC)
Function End_Route Terminates a track currently being created.
Definition: editrack.cpp:415
BOARD_ITEM * getNthItemToArray(int n) const override
Definition: edit.cpp:1639
void Start_Move_DrawItem(DRAWSEGMENT *drawitem, wxDC *DC)
Definition: editedge.cpp:56
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:106
void CallEndMouseCapture(wxDC *aDC)
Function CallEndMouseCapture calls the end mouse capture callback.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
Class DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS.
void SetTimeStamp(time_t aNewTimeStamp)
Definition: base_struct.h:203
Functions relatives to tracks, vias and segments used to fill zones.
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:107
void * GetDisplayOptions() override
Function GetDisplayOptions returns the display options current in use Display options are relative to...
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 moveExact()
Function moveExact Move the selected item exactly.
Definition: edit.cpp:1537
void Export_Pad_Settings(D_PAD *aPad)
virtual const wxPoint GetCenter() const
Function GetCenter()
void SetState(BLOCK_STATE_T aState)
virtual bool HandleBlockBegin(wxDC *aDC, EDA_KEY aKey, const wxPoint &aPosition, int aExplicitCommand=0)
Function HandleBlockBegin initializes the block command including the command type, initial position, and other variables.
Definition: draw_frame.cpp:804
void Zoom_Automatique(bool aWarpPointer)
Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows a...
Definition: zoom.cpp:77
class MODULE, a footprint
Definition: typeinfo.h:101
void TestConnections()
Function TestConnections tests the connections relative to all nets.
Definition: connect.cpp:733
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:302
void Attribut_Track(TRACK *track, wxDC *DC, bool Flag_On)
Definition: attribut.cpp:68
PCB_LAYER_ID
A quick note on layer IDs:
void StartMoveTextePcb(TEXTE_PCB *aTextePcb, wxDC *aDC, bool aErase=true)
VTBL_ENTRY KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, KIWAY_PLAYER *aParent=NULL)
Function Player returns the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:302
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().
TEXTE_PCB * CreateTextePcb(wxDC *aDC, TEXTE_PCB *aText=NULL)
void InstallTextModOptionsFrame(TEXTE_MODULE *TextMod, wxDC *DC)
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Function SetMsgPanel clears the message panel and populates it with the contents of aList...
Definition: draw_frame.cpp:754
bool IsMouseCaptured() const
BOARD_ITEM * m_item
Definition: edit.cpp:1665
void Rotate_Texte_Pcb(TEXTE_PCB *TextePcb, wxDC *DC)
void SetEnd(int x, int y)
void InstallModuleOptionsFrame(MODULE *Module, wxDC *DC)
Definition: editmod.cpp:49
void DlgGlobalChange_PadSettings(D_PAD *aPad, bool aRedraw)
Function DlgGlobalChange_PadSettings Function to change pad caracteristics for the given footprint or...
void Delete_OldZone_Fill(SEGZONE *aZone, time_t aTimestamp=0)
Function Delete_OldZone_Fill (obsolete) Used for compatibility with old boards Remove the zone fillin...
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.
void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
bool m_ContrastModeDisplay
Definition: pcbstruct.h:85
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:154
void Delete_Segment_Edge(DRAWSEGMENT *Segment, wxDC *DC)
Definition: editedge.cpp:113
void HighLight(wxDC *DC)
Function HighLight.
Definition: highlight.cpp:101
PCB_LAYER_ID m_Route_Layer_BOTTOM
bool Load_Module_From_BOARD(MODULE *Module)
Function Load_Module_From_BOARD load in Modedit a footprint from the main board.
Definition: loadcmp.cpp:75
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:1669
void Start_DragTrackSegmentAndKeepSlope(TRACK *track, wxDC *DC)
int m_DisplayZonesMode
Definition: pcbstruct.h:77
wxString g_DocModulesFileName
Definition: pcbnew.cpp:90
class SEGZONE, a segment used to fill a zone area (segment on a copper layer)
Definition: typeinfo.h:109
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:1051
void SetAutoPanRequest(bool aEnable)
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
int Fill_Zone(ZONE_CONTAINER *aZone)
Function Fill_Zone Calculate the zone filling for the outline zone_container The zone outline is a fr...
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:172
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...
void CrossHairOff(wxDC *DC)
Definition: draw_panel.cpp:253
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:112
bool IsLocked() const override
Function IsLocked.
Definition: class_module.h:223
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:221
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:113
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:165
Class DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
Definition: pcbstruct.h:62
virtual bool HandleBlockEnd(wxDC *DC)
Function HandleBlockEnd( ) Handle the "end" of a block command, i.e.
Definition: draw_frame.cpp:644
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:105
void DeleteTextModule(TEXTE_MODULE *Text)
Definition: edtxtmod.cpp:139
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.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
void Delete_Track(wxDC *DC, TRACK *Track)
Definition: deltrack.cpp:140
void SendMessageToEESCHEMA(BOARD_ITEM *objectToSync)
Function SendMessageToEESCHEMA sends a message to the schematic editor so that it may move its cursor...
void DisplayInfoMessage(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayInfoMessage displays an informational message box with aMessage.
Definition: confirm.cpp:89
BOARD * getBoard() const override
Definition: edit.cpp:1645
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...
void CrossHairOn(wxDC *DC)
Definition: draw_panel.cpp:260
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:111
void ShowDRCDialog(wxWindow *aParent=NULL)
Function ShowDRCDialog opens a dialog and prompts the user, then if a test run button is clicked...
Definition: drc.cpp:56
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:1022
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:64
void duplicateZone(wxDC *aDC, ZONE_CONTAINER *aZone)
Function duplicateZone duplicates the given zone.
void ArchiveModulesOnBoard(bool aStoreInNewLib)
Function ArchiveModulesOnBoard Save modules in a library:
Definition: librairi.cpp:564
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:166
const wxString & GetReference() const
Function GetReference.
Definition: class_module.h:411
void StartMoveModule(MODULE *aModule, wxDC *aDC, bool aDragConnectedTracks)
Function StartMoveModule Initialize a drag or move pad command.
Definition: modules.cpp:98
#define INSTALL_UNBUFFERED_DC(name, parent)
int GetToolId() const
Definition: draw_frame.h:406
VTBL_ENTRY wxConfigBase * CommonSettings() const
Definition: pgm_base.h:145
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:151
PCB_SCREEN * GetScreen() const override
Function GetScreen returns 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)
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
int GetSelectedCorner() const
Definition: class_zone.h:212
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 Delete_net(wxDC *DC, TRACK *Track)
Definition: deltrack.cpp:152
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:108
bool IsMicroViaAcceptable(void)
Function IsMicroViaAcceptable return true if a microvia can be placed on the board.
Definition: pcbframe.cpp:864
void InstallPadOptionsFrame(D_PAD *pad)
MODULE * GetFootprintFromBoardByReference()
Function GetFootprintFromBoardByReference.
Definition: modules.cpp:60
void StartMoveTexteModule(TEXTE_MODULE *Text, wxDC *DC)
Definition: edtxtmod.cpp:199
Module description (excepted pads)
PCB_LAYER_BOX_SELECTOR * m_SelLayerBox
Definition: wxPcbStruct.h:238
void SelectCopperLayerPair()
Definition: sel_layer.cpp:285
void Change_Side_Module(MODULE *Module, wxDC *DC)
Function Change_Side_Module Flip a footprint (switch layer from component or component to copper) The...
Definition: modules.cpp:285
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:103
void SetLastCursorPosition(const wxPoint &aPosition)
Function SetLastCursorPosition sets the last cursor position to aPosition.
int GetDefaultCursor() const
Function GetDefaultCursor return the default cursor shape.
BOARD_ITEM * GetCurItem()
void SwitchLayer(wxDC *DC, PCB_LAYER_ID layer) override
Definition: edit.cpp:1350
void duplicateItems(bool aIncrement) override
Function duplicateItems Duplicate selected item if possible and start a move.
Definition: edit.cpp:1568
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:69
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition 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:220
virtual void SetActiveLayer(PCB_LAYER_ID aLayer) override
Function SetActiveLayer will change the currently active layer to aLayer and also update the PCB_LAYE...
Definition: pcbframe.cpp:885
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:767
int m_lastDrawToolId
Tool ID of previously active draw tool bar button.
Definition: draw_frame.h:99
void Clean_Pcb()
Function Clean_Pcb Clean up the board (remove redundant vias, not connected tracks and merges colline...
Definition: clean.cpp:129
void Delete_Drawings_All_Layer(PCB_LAYER_ID aLayer)
Definition: editedge.cpp:148
Class DIMENSION.
PCB_LAYER_ID m_Route_Layer_TOP
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:1626
void SetCommand(BLOCK_COMMAND_T aCommand)
void End_Edge(DRAWSEGMENT *Segment, wxDC *DC)
Definition: editedge.cpp:308
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
MODULE * getModule() const override
Definition: edit.cpp:1650