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