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_generator.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>
64#include <tools/edit_tool.h>
67#include <router/router_tool.h>
68#include <view/view_controls.h>
69#include <view/view_group.h>
73#include <wx/filedlg.h>
74#include <wx/msgdlg.h>
75#include <wx/log.h>
76
78
79using namespace std::placeholders;
80
81
83{
84public:
86 ACTION_MENU( true )
87 {
88 SetIcon( BITMAPS::add_zone );
89 SetTitle( _( "Zones" ) );
90
95
96 AppendSeparator();
97
102 }
103
104protected:
105 ACTION_MENU* create() const override
106 {
107 return new ZONE_CONTEXT_MENU();
108 }
109};
110
111
113{
114public:
116 CONDITIONAL_MENU( aTool )
117 {
118 SetIcon( BITMAPS::locked );
119 SetTitle( _( "Locking" ) );
120
124 }
125
126 ACTION_MENU* create() const override
127 {
128 return new LOCK_CONTEXT_MENU( this->m_tool );
129 }
130};
131
132
134 PCB_TOOL_BASE( "pcbnew.EditorControl" ),
135 m_frame( nullptr ),
136 m_inPlaceFootprint( false ),
137 m_placingFootprint( false ),
138 m_inPlaceTarget( false )
139{
140 m_placeOrigin = std::make_unique<KIGFX::ORIGIN_VIEWITEM>( KIGFX::COLOR4D( 0.8, 0.0, 0.0, 1.0 ),
142}
143
144
146{
147}
148
149
151{
152 m_frame = getEditFrame<PCB_EDIT_FRAME>();
153
154 if( aReason == MODEL_RELOAD || aReason == GAL_SWITCH || aReason == REDRAW )
155 {
156 m_placeOrigin->SetPosition( getModel<BOARD>()->GetDesignSettings().GetAuxOrigin() );
157 getView()->Remove( m_placeOrigin.get() );
158 getView()->Add( m_placeOrigin.get() );
159 }
160}
161
162
164{
165 auto activeToolCondition =
166 [this]( const SELECTION& aSel )
167 {
168 return ( !m_frame->ToolStackIsEmpty() );
169 };
170
171 auto inactiveStateCondition =
172 [this]( const SELECTION& aSel )
173 {
174 return ( m_frame->ToolStackIsEmpty() && aSel.Size() == 0 );
175 };
176
177 auto placeModuleCondition =
178 [this]( const SELECTION& aSel )
179 {
180 return m_frame->IsCurrentTool( PCB_ACTIONS::placeFootprint ) && aSel.GetSize() == 0;
181 };
182
183 auto& ctxMenu = m_menu.GetMenu();
184
185 // "Cancel" goes at the top of the context menu when a tool is active
186 ctxMenu.AddItem( ACTIONS::cancelInteractive, activeToolCondition, 1 );
187 ctxMenu.AddSeparator( 1 );
188
189 // "Get and Place Footprint" should be available for Place Footprint tool
190 ctxMenu.AddItem( PCB_ACTIONS::getAndPlace, placeModuleCondition, 1000 );
191 ctxMenu.AddSeparator( 1000 );
192
193 // Finally, add the standard zoom & grid items
194 getEditFrame<PCB_BASE_FRAME>()->AddStandardSubMenus( m_menu );
195
196 std::shared_ptr<ZONE_CONTEXT_MENU> zoneMenu = std::make_shared<ZONE_CONTEXT_MENU>();
197 zoneMenu->SetTool( this );
198
199 std::shared_ptr<LOCK_CONTEXT_MENU> lockMenu = std::make_shared<LOCK_CONTEXT_MENU>( this );
200
201 // Add the PCB control menus to relevant other tools
202
204
205 if( selTool )
206 {
207 TOOL_MENU& toolMenu = selTool->GetToolMenu();
208 CONDITIONAL_MENU& menu = toolMenu.GetMenu();
209
210 // Add "Get and Place Footprint" when Selection tool is in an inactive state
211 menu.AddItem( PCB_ACTIONS::getAndPlace, inactiveStateCondition );
212 menu.AddSeparator();
213
214 toolMenu.RegisterSubMenu( zoneMenu );
215 toolMenu.RegisterSubMenu( lockMenu );
216
217 menu.AddMenu( lockMenu.get(), SELECTION_CONDITIONS::NotEmpty, 100 );
218
219 menu.AddMenu( zoneMenu.get(), SELECTION_CONDITIONS::OnlyTypes( { PCB_ZONE_T } ), 100 );
220 }
221
222 DRAWING_TOOL* drawingTool = m_toolMgr->GetTool<DRAWING_TOOL>();
223
224 if( drawingTool )
225 {
226 TOOL_MENU& toolMenu = drawingTool->GetToolMenu();
227 CONDITIONAL_MENU& menu = toolMenu.GetMenu();
228
229 toolMenu.RegisterSubMenu( zoneMenu );
230
231 // Functor to say if the PCB_EDIT_FRAME is in a given mode
232 // Capture the tool pointer and tool mode by value
233 auto toolActiveFunctor =
234 [=]( DRAWING_TOOL::MODE aMode )
235 {
236 return [=]( const SELECTION& sel )
237 {
238 return drawingTool->GetDrawingMode() == aMode;
239 };
240 };
241
242 menu.AddMenu( zoneMenu.get(), toolActiveFunctor( DRAWING_TOOL::MODE::ZONE ), 300 );
243 }
244
245 return true;
246}
247
248
250{
252 return 0;
253}
254
255
257{
259 return 0;
260}
261
262
264{
266 return 0;
267}
268
269
271{
273 return 0;
274}
275
276
278{
280 return 0;
281}
282
283
285{
287 return 0;
288}
289
290
292{
293 PICKED_ITEMS_LIST undoCmd;
295 ITEM_PICKER wrapper( nullptr, undoItem, UNDO_REDO::PAGESETTINGS );
296
297 undoCmd.PushItem( wrapper );
298 undoCmd.SetDescription( _( "Page Settings" ) );
299 m_frame->SaveCopyInUndoList( undoCmd, UNDO_REDO::PAGESETTINGS );
300
304
305 if( dlg.ShowModal() == wxID_OK )
306 {
308 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
309 {
310 EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem );
311
312 if( text && text->HasTextVars() )
313 {
314 text->ClearRenderCache();
315 text->ClearBoundingBoxCache();
317 }
318
319 return 0;
320 } );
321
322 m_frame->OnModify();
323 }
324 else
325 {
327 }
328
329 return 0;
330}
331
332
334{
336 return 0;
337}
338
339
341{
343 return 0;
344}
345
346
348{
350 return 0;
351}
352
353
355{
357 return 0;
358}
359
360
362{
363 getEditFrame<PCB_EDIT_FRAME>()->ShowBoardSetupDialog();
364 return 0;
365}
366
367
369{
370 getEditFrame<PCB_EDIT_FRAME>()->InstallNetlistFrame();
371 return 0;
372}
373
374
376{
377 wxString fullFileName = frame()->GetBoard()->GetFileName();
378 wxString path;
379 wxString name;
380 wxString ext;
381
382 wxFileName::SplitPath( fullFileName, &path, &name, &ext );
383 name += wxT( "." ) + wxString( FILEEXT::SpecctraSessionFileExtension );
384
385 fullFileName = wxFileSelector( _( "Specctra Session File" ), path, name,
386 wxT( "." ) + wxString( FILEEXT::SpecctraSessionFileExtension ),
387 FILEEXT::SpecctraSessionFileWildcard(), wxFD_OPEN | wxFD_CHANGE_DIR,
388 frame() );
389
390 if( !fullFileName.IsEmpty() )
391 getEditFrame<PCB_EDIT_FRAME>()->ImportSpecctraSession( fullFileName );
392
393 return 0;
394}
395
396
398{
399 wxString fullFileName = m_frame->GetLastPath( LAST_PATH_SPECCTRADSN );
400 wxFileName fn;
401
402 if( fullFileName.IsEmpty() )
403 {
404 fn = m_frame->GetBoard()->GetFileName();
406 }
407 else
408 {
409 fn = fullFileName;
410 }
411
412 fullFileName = wxFileSelector( _( "Specctra DSN File" ), fn.GetPath(), fn.GetFullName(),
414 wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxFD_CHANGE_DIR, frame() );
415
416 if( !fullFileName.IsEmpty() )
417 {
418 m_frame->SetLastPath( LAST_PATH_SPECCTRADSN, fullFileName );
419 getEditFrame<PCB_EDIT_FRAME>()->ExportSpecctraFile( fullFileName );
420 }
421
422 return 0;
423}
424
425
427{
428 wxCHECK( m_frame, 0 );
429
430 wxFileName fn = m_frame->Prj().GetProjectFullName();
431
432 // Use a different file extension for the board netlist so the schematic netlist file
433 // is accidentally overwritten.
434 fn.SetExt( wxT( "pcb_net" ) );
435
436 wxFileDialog dlg( m_frame, _( "Export Board Netlist" ), fn.GetPath(), fn.GetFullName(),
437 _( "KiCad board netlist files" ) + AddFileExtListToFilter( { "pcb_net" } ),
438 wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
439
440 dlg.SetExtraControlCreator( &LEGACYFILEDLG_NETLIST_OPTIONS::Create );
441
442 if( dlg.ShowModal() == wxID_CANCEL )
443 return 0;
444
445 fn = dlg.GetPath();
446
447 if( !fn.IsDirWritable() )
448 {
449 wxString msg;
450
451 msg.Printf( _( "Path `%s` is read only." ), fn.GetPath() );
452 wxMessageDialog( m_frame, msg, _( "I/O Error" ), wxOK | wxCENTER | wxICON_EXCLAMATION );
453 return 0;
454 }
455
457 dynamic_cast<const LEGACYFILEDLG_NETLIST_OPTIONS*>( dlg.GetExtraControl() );
458 wxCHECK( noh, 0 );
459
461
462 for( const FOOTPRINT* footprint : board()->Footprints() )
463 {
466 { footprint->m_Uuid } );
467
468 for( const PAD* pad : footprint->Pads() )
469 {
470 const wxString& netname = pad->GetShortNetname();
471
472 if( !netname.IsEmpty() )
473 {
474 component->AddNet( pad->GetNumber(), netname, pad->GetPinFunction(),
475 pad->GetPinType() );
476 }
477 }
478
479 nlohmann::ordered_map<wxString, wxString> fields;
480 for( PCB_FIELD* field : footprint->Fields() )
481 fields[field->GetCanonicalName()] = field->GetText();
482
483 component->SetFields( fields );
484
485 netlist.AddComponent( component );
486 }
487
488 FILE_OUTPUTFORMATTER formatter( fn.GetFullPath() );
489
490 netlist.Format( "pcb_netlist", &formatter, 0, noh->GetNetlistOptions() );
491
492 return 0;
493}
494
495
497{
498 wxCommandEvent dummy;
499
502 else if( aEvent.IsAction( &PCB_ACTIONS::generateReportFile ) )
504 else if( aEvent.IsAction( &PCB_ACTIONS::generateD356File ) )
506 else if( aEvent.IsAction( &PCB_ACTIONS::generateBOM ) )
508 else if( aEvent.IsAction( &PCB_ACTIONS::generateIPC2581File ) )
510 else
511 wxFAIL_MSG( wxT( "GenerateFabFiles(): unexpected request" ) );
512
513 return 0;
514}
515
516
518{
519 int errors = 0;
520 wxString details;
521 bool quiet = aEvent.Parameter<bool>();
522
523 // Repair duplicate IDs and missing nets.
524 std::set<KIID> ids;
525 int duplicates = 0;
526
527 auto processItem =
528 [&]( EDA_ITEM* aItem )
529 {
530 if( ids.count( aItem->m_Uuid ) )
531 {
532 duplicates++;
533 const_cast<KIID&>( aItem->m_Uuid ) = KIID();
534 }
535
536 ids.insert( aItem->m_Uuid );
537
538 BOARD_CONNECTED_ITEM* cItem = dynamic_cast<BOARD_CONNECTED_ITEM*>( aItem );
539
540 if( cItem && cItem->GetNetCode() )
541 {
542 NETINFO_ITEM* netinfo = cItem->GetNet();
543
544 if( netinfo && !board()->FindNet( netinfo->GetNetname() ) )
545 {
546 board()->Add( netinfo );
547
548 details += wxString::Format( _( "Orphaned net %s re-parented.\n" ),
549 netinfo->GetNetname() );
550 errors++;
551 }
552 }
553 };
554
555 // Footprint IDs are the most important, so give them the first crack at "claiming" a
556 // particular KIID.
557
558 for( FOOTPRINT* footprint : board()->Footprints() )
559 processItem( footprint );
560
561 // After that the principal use is for DRC marker pointers, which are most likely to pads
562 // or tracks.
563
564 for( FOOTPRINT* footprint : board()->Footprints() )
565 {
566 for( PAD* pad : footprint->Pads() )
567 processItem( pad );
568 }
569
570 for( PCB_TRACK* track : board()->Tracks() )
571 processItem( track );
572
573 // From here out I don't think order matters much.
574
575 for( FOOTPRINT* footprint : board()->Footprints() )
576 {
577 processItem( &footprint->Reference() );
578 processItem( &footprint->Value() );
579
580 for( BOARD_ITEM* item : footprint->GraphicalItems() )
581 processItem( item );
582
583 for( ZONE* zone : footprint->Zones() )
584 processItem( zone );
585
586 for( PCB_GROUP* group : footprint->Groups() )
587 processItem( group );
588 }
589
590 for( BOARD_ITEM* drawing : board()->Drawings() )
591 processItem( drawing );
592
593 for( ZONE* zone : board()->Zones() )
594 processItem( zone );
595
596 for( PCB_MARKER* marker : board()->Markers() )
597 processItem( marker );
598
599 for( PCB_GROUP* group : board()->Groups() )
600 processItem( group );
601
602 if( duplicates )
603 {
604 errors += duplicates;
605 details += wxString::Format( _( "%d duplicate IDs replaced.\n" ), duplicates );
606 }
607
608 /*******************************
609 * Your test here
610 */
611
612 /*******************************
613 * Inform the user
614 */
615
616 if( errors )
617 {
618 m_frame->OnModify();
619
620 wxString msg = wxString::Format( _( "%d potential problems repaired." ), errors );
621
622 if( !quiet )
623 DisplayInfoMessage( m_frame, msg, details );
624 }
625 else if( !quiet )
626 {
627 DisplayInfoMessage( m_frame, _( "No board problems found." ) );
628 }
629
630 return 0;
631}
632
633
635{
637
638 if( m_frame->FetchNetlistFromSchematic( netlist, _( "Updating PCB requires a fully annotated "
639 "schematic." ) ) )
640 {
641 DIALOG_UPDATE_PCB updateDialog( m_frame, &netlist );
642 updateDialog.ShowModal();
643 }
644
645 return 0;
646}
647
649{
650 if( Kiface().IsSingle() )
651 {
652 DisplayErrorMessage( m_frame, _( "Cannot update schematic because Pcbnew is opened in "
653 "stand-alone mode. In order to create or update PCBs "
654 "from schematics, you must launch the KiCad project "
655 "manager and create a project." ) );
656 return 0;
657 }
658
661
662 if( frame )
663 {
664 std::string payload;
665
666 if( wxWindow* blocking_win = frame->Kiway().GetBlockingDialog() )
667 blocking_win->Close( true );
668
670 }
671 return 0;
672}
673
674
676{
678 return 0;
679}
680
681
683{
684 getEditFrame<PCB_EDIT_FRAME>()->ToggleLayersManager();
685 return 0;
686}
687
688
690{
691 getEditFrame<PCB_EDIT_FRAME>()->ToggleProperties();
692 return 0;
693}
694
695
697{
698 getEditFrame<PCB_EDIT_FRAME>()->ToggleNetInspector();
699 return 0;
700}
701
702
704{
705 getEditFrame<PCB_EDIT_FRAME>()->ToggleSearch();
706 return 0;
707}
708
709
711{
713 return 0;
714}
715
716
717// Track & via size control
719{
720 BOARD_DESIGN_SETTINGS& bds = getModel<BOARD>()->GetDesignSettings();
722
724 && SELECTION_CONDITIONS::OnlyTypes( { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T } )( selection ) )
725 {
726 BOARD_COMMIT commit( this );
727
728 for( EDA_ITEM* item : selection )
729 {
730 if( item->IsType( { PCB_TRACE_T, PCB_ARC_T } ) )
731 {
732 PCB_TRACK* track = static_cast<PCB_TRACK*>( item );
733
734 for( int i = 0; i < (int) bds.m_TrackWidthList.size(); ++i )
735 {
736 int candidate = bds.m_NetSettings->m_DefaultNetClass->GetTrackWidth();
737
738 if( i > 0 )
739 candidate = bds.m_TrackWidthList[ i ];
740
741 if( candidate > track->GetWidth() )
742 {
743 commit.Modify( track );
744 track->SetWidth( candidate );
745 break;
746 }
747 }
748 }
749 }
750
751 commit.Push( wxT( "Increase Track Width" ) );
752 return 0;
753 }
754
755 ROUTER_TOOL* routerTool = m_toolMgr->GetTool<ROUTER_TOOL>();
756
757 if( routerTool && routerTool->IsToolActive()
758 && routerTool->Router()->Mode() == PNS::PNS_MODE_ROUTE_DIFF_PAIR )
759 {
760 int widthIndex = (int) bds.GetDiffPairIndex() + 1;
761
762 // If we go past the last track width entry in the list, start over at the beginning
763 if( widthIndex >= (int) bds.m_DiffPairDimensionsList.size() )
764 widthIndex = 0;
765
766 bds.SetDiffPairIndex( widthIndex );
767 bds.UseCustomDiffPairDimensions( false );
768
770 }
771 else
772 {
773 int widthIndex = (int) bds.GetTrackWidthIndex();
774
775 if( routerTool && routerTool->IsToolActive()
778 {
779 bds.m_TempOverrideTrackWidth = true;
780 }
781 else
782 {
783 widthIndex++;
784 }
785
786 // If we go past the last track width entry in the list, start over at the beginning
787 if( widthIndex >= (int) bds.m_TrackWidthList.size() )
788 widthIndex = 0;
789
790 bds.SetTrackWidthIndex( widthIndex );
791 bds.UseCustomTrackViaSize( false );
792
794 }
795
796 return 0;
797}
798
799
801{
802 BOARD_DESIGN_SETTINGS& bds = getModel<BOARD>()->GetDesignSettings();
804
806 && SELECTION_CONDITIONS::OnlyTypes( { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T } )( selection ) )
807 {
808 BOARD_COMMIT commit( this );
809
810 for( EDA_ITEM* item : selection )
811 {
812 if( item->IsType( { PCB_TRACE_T, PCB_ARC_T } ) )
813 {
814 PCB_TRACK* track = static_cast<PCB_TRACK*>( item );
815
816 for( int i = (int) bds.m_TrackWidthList.size() - 1; i >= 0; --i )
817 {
818 int candidate = bds.m_NetSettings->m_DefaultNetClass->GetTrackWidth();
819
820 if( i > 0 )
821 candidate = bds.m_TrackWidthList[ i ];
822
823 if( candidate < track->GetWidth() )
824 {
825 commit.Modify( track );
826 track->SetWidth( candidate );
827 break;
828 }
829 }
830 }
831 }
832
833 commit.Push( wxT( "Decrease Track Width" ) );
834 return 0;
835 }
836
837 ROUTER_TOOL* routerTool = m_toolMgr->GetTool<ROUTER_TOOL>();
838
839 if( routerTool && routerTool->IsToolActive()
840 && routerTool->Router()->Mode() == PNS::PNS_MODE_ROUTE_DIFF_PAIR )
841 {
842 int widthIndex = (int) bds.GetDiffPairIndex() - 1;
843
844 // If we get to the lowest entry start over at the highest
845 if( widthIndex < 0 )
846 widthIndex = (int) bds.m_DiffPairDimensionsList.size() - 1;
847
848 bds.SetDiffPairIndex( widthIndex );
849 bds.UseCustomDiffPairDimensions( false );
850
852 }
853 else
854 {
855 int widthIndex = (int) bds.GetTrackWidthIndex();
856
857 if( routerTool && routerTool->IsToolActive()
860 {
861 bds.m_TempOverrideTrackWidth = true;
862 }
863 else
864 {
865 widthIndex--;
866 }
867
868 // If we get to the lowest entry start over at the highest
869 if( widthIndex < 0 )
870 widthIndex = (int) bds.m_TrackWidthList.size() - 1;
871
872 bds.SetTrackWidthIndex( widthIndex );
873 bds.UseCustomTrackViaSize( false );
874
876 }
877
878 return 0;
879}
880
881
883{
884 BOARD_DESIGN_SETTINGS& bds = getModel<BOARD>()->GetDesignSettings();
886
888 && SELECTION_CONDITIONS::OnlyTypes( { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T } )( selection ) )
889 {
890 BOARD_COMMIT commit( this );
891
892 for( EDA_ITEM* item : selection )
893 {
894 if( item->Type() == PCB_VIA_T )
895 {
896 PCB_VIA* via = static_cast<PCB_VIA*>( item );
897
898 for( int i = 0; i < (int) bds.m_ViasDimensionsList.size(); ++i )
899 {
900 VIA_DIMENSION dims( bds.m_NetSettings->m_DefaultNetClass->GetViaDiameter(),
901 bds.m_NetSettings->m_DefaultNetClass->GetViaDrill() );
902
903 if( i> 0 )
904 dims = bds.m_ViasDimensionsList[ i ];
905
906 if( dims.m_Diameter > via->GetWidth() )
907 {
908 commit.Modify( via );
909 via->SetWidth( dims.m_Diameter );
910 via->SetDrill( dims.m_Drill );
911 break;
912 }
913 }
914 }
915 }
916
917 commit.Push( wxT( "Increase Via Size" ) );
918 }
919 else
920 {
921 int sizeIndex = (int) bds.GetViaSizeIndex() + 1;
922
923 // If we go past the last via entry in the list, start over at the beginning
924 if( sizeIndex >= (int) bds.m_ViasDimensionsList.size() )
925 sizeIndex = 0;
926
927 bds.SetViaSizeIndex( sizeIndex );
928 bds.UseCustomTrackViaSize( false );
929
931 }
932
933 return 0;
934}
935
936
938{
939 BOARD_DESIGN_SETTINGS& bds = getModel<BOARD>()->GetDesignSettings();
941
943 && SELECTION_CONDITIONS::OnlyTypes( { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T } )( selection ) )
944 {
945 BOARD_COMMIT commit( this );
946
947 for( EDA_ITEM* item : selection )
948 {
949 if( item->Type() == PCB_VIA_T )
950 {
951 PCB_VIA* via = static_cast<PCB_VIA*>( item );
952
953 for( int i = (int) bds.m_ViasDimensionsList.size() - 1; i >= 0; --i )
954 {
955 VIA_DIMENSION dims( bds.m_NetSettings->m_DefaultNetClass->GetViaDiameter(),
956 bds.m_NetSettings->m_DefaultNetClass->GetViaDrill() );
957
958 if( i > 0 )
959 dims = bds.m_ViasDimensionsList[ i ];
960
961 if( dims.m_Diameter < via->GetWidth() )
962 {
963 commit.Modify( via );
964 via->SetWidth( dims.m_Diameter );
965 via->SetDrill( dims.m_Drill );
966 break;
967 }
968 }
969 }
970 }
971
972 commit.Push( "Decrease Via Size" );
973 }
974 else
975 {
976 int sizeIndex = 0; // Assume we only have a single via size entry
977
978 // If there are more, cycle through them backwards
979 if( bds.m_ViasDimensionsList.size() > 0 )
980 {
981 sizeIndex = (int) bds.GetViaSizeIndex() - 1;
982
983 // If we get to the lowest entry start over at the highest
984 if( sizeIndex < 0 )
985 sizeIndex = (int) bds.m_ViasDimensionsList.size() - 1;
986 }
987
988 bds.SetViaSizeIndex( sizeIndex );
989 bds.UseCustomTrackViaSize( false );
990
992 }
993
994 return 0;
995}
996
997
999{
1000 if( m_inPlaceFootprint )
1001 return 0;
1002
1004
1005 FOOTPRINT* fp = aEvent.Parameter<FOOTPRINT*>();
1006 bool fromOtherCommand = fp != nullptr;
1008 BOARD_COMMIT commit( m_frame );
1009 BOARD* board = getModel<BOARD>();
1010 COMMON_SETTINGS* common_settings = Pgm().GetCommonSettings();
1011
1013
1014 m_frame->PushTool( aEvent );
1015
1016 auto setCursor =
1017 [&]()
1018 {
1019 m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
1020 };
1021
1022 auto cleanup =
1023 [&] ()
1024 {
1026 commit.Revert();
1027
1028 if( fromOtherCommand )
1029 {
1031
1032 if( undo )
1033 {
1036 delete undo;
1037 }
1038 }
1039
1040 fp = nullptr;
1041 m_placingFootprint = false;
1042 };
1043
1044 Activate();
1045 // Must be done after Activate() so that it gets set into the correct context
1046 controls->ShowCursor( true );
1047 // Set initial cursor
1048 setCursor();
1049
1050 VECTOR2I cursorPos = controls->GetCursorPosition();
1051 bool ignorePrimePosition = false;
1052 bool reselect = false;
1053
1054 // Prime the pump
1055 if( fp )
1056 {
1057 m_placingFootprint = true;
1058 fp->SetPosition( cursorPos );
1061 }
1062 else if( aEvent.HasPosition() )
1063 {
1064 m_toolMgr->PrimeTool( aEvent.Position() );
1065 }
1066 else if( common_settings->m_Input.immediate_actions && !aEvent.IsReactivate() )
1067 {
1068 m_toolMgr->PrimeTool( { 0, 0 } );
1069 ignorePrimePosition = true;
1070 }
1071
1072 // Main loop: keep receiving events
1073 while( TOOL_EVENT* evt = Wait() )
1074 {
1075 setCursor();
1076 cursorPos = controls->GetCursorPosition( !evt->DisableGridSnapping() );
1077
1078 if( reselect && fp )
1080
1081 if( evt->IsCancelInteractive() || ( fp && evt->IsAction( &ACTIONS::undo ) ) )
1082 {
1083 if( fp )
1084 {
1085 cleanup();
1086 }
1087 else
1088 {
1089 m_frame->PopTool( aEvent );
1090 break;
1091 }
1092 }
1093 else if( evt->IsActivate() )
1094 {
1095 if( fp )
1096 cleanup();
1097
1098 if( evt->IsMoveTool() )
1099 {
1100 // leave ourselves on the stack so we come back after the move
1101 break;
1102 }
1103 else
1104 {
1105 frame()->PopTool( aEvent );
1106 break;
1107 }
1108 }
1109 else if( evt->IsClick( BUT_LEFT ) )
1110 {
1111 if( !fp )
1112 {
1113 // Pick the footprint to be placed
1115
1116 if( fp == nullptr )
1117 continue;
1118
1119 // If we started with a hotkey which has a position then warp back to that.
1120 // Otherwise update to the current mouse position pinned inside the autoscroll
1121 // boundaries.
1122 if( evt->IsPrime() && !ignorePrimePosition )
1123 {
1124 cursorPos = evt->Position();
1125 getViewControls()->WarpMouseCursor( cursorPos, true );
1126 }
1127 else
1128 {
1130 cursorPos = getViewControls()->GetMousePosition();
1131 }
1132
1133 m_placingFootprint = true;
1134
1135 fp->SetLink( niluuid );
1136
1137 fp->SetFlags( IS_NEW ); // whatever
1138
1139 // Set parent so that clearance can be loaded
1140 fp->SetParent( board );
1142
1143 for( PAD* pad : fp->Pads() )
1144 {
1145 pad->SetLocalRatsnestVisible( m_frame->GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
1146
1147 // Pads in the library all have orphaned nets. Replace with Default.
1148 pad->SetNetCode( 0 );
1149 }
1150
1151 // Put it on FRONT layer,
1152 // (Can be stored flipped if the lib is an archive built from a board)
1153 if( fp->IsFlipped() )
1155
1156 fp->SetOrientation( ANGLE_0 );
1157 fp->SetPosition( cursorPos );
1158
1159 // Fill this in since it won't be synced from a symbol
1161
1162 commit.Add( fp );
1164
1166 }
1167 else
1168 {
1170 commit.Push( _( "Place a Footprint" ) );
1171 fp = nullptr; // to indicate that there is no footprint that we currently modify
1172 m_placingFootprint = false;
1173 }
1174 }
1175 else if( evt->IsClick( BUT_RIGHT ) )
1176 {
1178 }
1179 else if( fp && ( evt->IsMotion() || evt->IsAction( &ACTIONS::refreshPreview ) ) )
1180 {
1181 fp->SetPosition( cursorPos );
1182 selection().SetReferencePoint( cursorPos );
1183 getView()->Update( &selection() );
1184 getView()->Update( fp );
1185 }
1186 else if( fp && evt->IsAction( &PCB_ACTIONS::properties ) )
1187 {
1188 // Calling 'Properties' action clears the selection, so we need to restore it
1189 reselect = true;
1190 }
1191 else if( fp && ( ZONE_FILLER_TOOL::IsZoneFillAction( evt )
1192 || evt->IsAction( &ACTIONS::redo ) ) )
1193 {
1194 wxBell();
1195 }
1196 else
1197 {
1198 evt->SetPassEvent();
1199 }
1200
1201 // Enable autopanning and cursor capture only when there is a footprint to be placed
1202 controls->SetAutoPan( fp != nullptr );
1203 controls->CaptureCursor( fp != nullptr );
1204 }
1205
1206 controls->SetAutoPan( false );
1207 controls->CaptureCursor( false );
1208 m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
1209
1210 return 0;
1211}
1212
1213
1215{
1216 return modifyLockSelected( TOGGLE );
1217}
1218
1219
1221{
1222 return modifyLockSelected( ON );
1223}
1224
1225
1227{
1228 return modifyLockSelected( OFF );
1229}
1230
1231
1233{
1235 const PCB_SELECTION& selection = selTool->GetSelection();
1236 BOARD_COMMIT commit( m_frame );
1237
1238 if( selection.Empty() )
1240
1241 // Resolve TOGGLE mode
1242 if( aMode == TOGGLE )
1243 {
1244 aMode = ON;
1245
1246 for( EDA_ITEM* item : selection )
1247 {
1248 BOARD_ITEM* board_item = dynamic_cast<BOARD_ITEM*>( item );
1249
1250 if( board_item && board_item->IsLocked() )
1251 {
1252 aMode = OFF;
1253 break;
1254 }
1255 }
1256 }
1257
1258 for( EDA_ITEM* item : selection )
1259 {
1260 BOARD_ITEM* board_item = dynamic_cast<BOARD_ITEM*>( item );
1261 wxCHECK2( board_item, continue );
1262
1263 PCB_GENERATOR* generator = dynamic_cast<PCB_GENERATOR*>( board_item->GetParentGroup() );
1264
1265 if( generator && commit.GetStatus( generator ) != CHT_MODIFY )
1266 {
1267 commit.Modify( generator );
1268
1269 if( aMode == ON )
1270 generator->SetLocked( true );
1271 else
1272 generator->SetLocked( false );
1273 }
1274
1275 commit.Modify( board_item );
1276
1277 if( aMode == ON )
1278 board_item->SetLocked( true );
1279 else
1280 board_item->SetLocked( false );
1281 }
1282
1283 if( !commit.Empty() )
1284 {
1285 commit.Push( aMode == ON ? _( "Lock" ) : _( "Unlock" ) );
1286
1288 m_frame->OnModify();
1289 }
1290
1291 return 0;
1292}
1293
1294
1295static bool mergeZones( EDA_DRAW_FRAME* aFrame, BOARD_COMMIT& aCommit,
1296 std::vector<ZONE*>& aOriginZones, std::vector<ZONE*>& aMergedZones )
1297{
1298 aCommit.Modify( aOriginZones[0] );
1299
1300 for( unsigned int i = 1; i < aOriginZones.size(); i++ )
1301 {
1302 aOriginZones[0]->Outline()->BooleanAdd( *aOriginZones[i]->Outline(),
1304 }
1305
1306 aOriginZones[0]->Outline()->Simplify( SHAPE_POLY_SET::PM_FAST );
1307
1308 // We should have one polygon, possibly with holes. If we end up with two polygons (either
1309 // because the intersection was a single point or because the intersection was within one of
1310 // the zone's holes) then we can't merge.
1311 if( aOriginZones[0]->Outline()->IsSelfIntersecting()
1312 || aOriginZones[0]->Outline()->OutlineCount() > 1 )
1313 {
1314 DisplayErrorMessage( aFrame, _( "Zones have insufficient overlap for merging." ) );
1315 aCommit.Revert();
1316 return false;
1317 }
1318
1319 for( unsigned int i = 1; i < aOriginZones.size(); i++ )
1320 aCommit.Remove( aOriginZones[i] );
1321
1322 aMergedZones.push_back( aOriginZones[0] );
1323
1324 aOriginZones[0]->SetLocalFlags( 1 );
1325 aOriginZones[0]->HatchBorder();
1326 aOriginZones[0]->CacheTriangulation();
1327
1328 return true;
1329}
1330
1331
1333{
1334 const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1335 BOARD* board = getModel<BOARD>();
1336 BOARD_COMMIT commit( m_frame );
1337
1338 if( selection.Size() < 2 )
1339 return 0;
1340
1341 int netcode = -1;
1342
1343 ZONE* firstZone = nullptr;
1344 std::vector<ZONE*> toMerge, merged;
1345
1346 for( EDA_ITEM* item : selection )
1347 {
1348 ZONE* curr_area = dynamic_cast<ZONE*>( item );
1349
1350 if( !curr_area )
1351 continue;
1352
1353 if( !firstZone )
1354 firstZone = curr_area;
1355
1356 netcode = curr_area->GetNetCode();
1357
1358 if( firstZone->GetNetCode() != netcode )
1359 {
1360 wxLogMessage( _( "Some zone netcodes did not match and were not merged." ) );
1361 continue;
1362 }
1363
1364 if( curr_area->GetAssignedPriority() != firstZone->GetAssignedPriority() )
1365 {
1366 wxLogMessage( _( "Some zone priorities did not match and were not merged." ) );
1367 continue;
1368 }
1369
1370 if( curr_area->GetIsRuleArea() != firstZone->GetIsRuleArea() )
1371 {
1372 wxLogMessage( _( "Some zones were rule areas and were not merged." ) );
1373 continue;
1374 }
1375
1376 if( curr_area->GetLayerSet() != firstZone->GetLayerSet() )
1377 {
1378 wxLogMessage( _( "Some zone layer sets did not match and were not merged." ) );
1379 continue;
1380 }
1381
1382 bool intersects = curr_area == firstZone;
1383
1384 for( ZONE* candidate : toMerge )
1385 {
1386 if( intersects )
1387 break;
1388
1389 if( board->TestZoneIntersection( curr_area, candidate ) )
1390 intersects = true;
1391 }
1392
1393 if( !intersects )
1394 {
1395 wxLogMessage( _( "Some zones did not intersect and were not merged." ) );
1396 continue;
1397 }
1398
1399 toMerge.push_back( curr_area );
1400 }
1401
1403
1404 if( !toMerge.empty() )
1405 {
1406 if( mergeZones( m_frame, commit, toMerge, merged ) )
1407 {
1408 commit.Push( wxT( "Merge Zones" ) );
1409
1410 for( EDA_ITEM* item : merged )
1412 }
1413 }
1414
1415 return 0;
1416}
1417
1418
1420{
1422 const PCB_SELECTION& selection = selTool->GetSelection();
1423
1424 // because this pops up the zone editor, it would be confusing to handle multiple zones,
1425 // so just handle single selections containing exactly one zone
1426 if( selection.Size() != 1 )
1427 return 0;
1428
1429 ZONE* oldZone = dynamic_cast<ZONE*>( selection[0] );
1430
1431 if( !oldZone )
1432 return 0;
1433
1434 ZONE_SETTINGS zoneSettings;
1435 zoneSettings << *oldZone;
1436 int dialogResult;
1437
1438 if( oldZone->GetIsRuleArea() )
1439 dialogResult = InvokeRuleAreaEditor( m_frame, &zoneSettings );
1440 else if( oldZone->IsOnCopperLayer() )
1441 dialogResult = InvokeCopperZonesEditor( m_frame, &zoneSettings );
1442 else
1443 dialogResult = InvokeNonCopperZonesEditor( m_frame, &zoneSettings );
1444
1445 if( dialogResult != wxID_OK )
1446 return 0;
1447
1448 // duplicate the zone
1449 BOARD_COMMIT commit( m_frame );
1450
1451 std::unique_ptr<ZONE> newZone = std::make_unique<ZONE>( *oldZone );
1452 newZone->ClearSelected();
1453 newZone->UnFill();
1454 zoneSettings.ExportSetting( *newZone );
1455
1456 // If the new zone is on the same layer(s) as the initial zone,
1457 // offset it a bit so it can more easily be picked.
1458 if( oldZone->GetLayerSet() == zoneSettings.m_Layers )
1459 newZone->Move( VECTOR2I( pcbIUScale.IU_PER_MM, pcbIUScale.IU_PER_MM ) );
1460
1461 commit.Add( newZone.release() );
1462 commit.Push( _( "Duplicate Zone" ) );
1463
1464 return 0;
1465}
1466
1467
1469{
1470 doCrossProbePcbToSch( aEvent, false );
1471 return 0;
1472}
1473
1474
1476{
1477 doCrossProbePcbToSch( aEvent, true );
1478 return 0;
1479}
1480
1481
1483{
1484 // Don't get in an infinite loop PCB -> SCH -> PCB -> SCH -> ...
1486 return;
1487
1489 const PCB_SELECTION& selection = selTool->GetSelection();
1490 EDA_ITEM* focusItem = nullptr;
1491
1492 if( aEvent.Matches( EVENTS::PointSelectedEvent ) )
1493 focusItem = selection.GetLastAddedItem();
1494
1495 m_frame->SendSelectItemsToSch( selection.GetItems(), focusItem, aForce );
1496
1497 // Update 3D viewer highlighting
1499}
1500
1501
1503{
1505
1506 const PCB_SELECTION& selection = selectionTool->RequestSelection(
1507 []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
1508 {
1509 // Iterate from the back so we don't have to worry about removals.
1510 for( int i = aCollector.GetCount() - 1; i >= 0; --i )
1511 {
1512 if( !dynamic_cast<BOARD_CONNECTED_ITEM*>( aCollector[ i ] ) )
1513 aCollector.Remove( aCollector[ i ] );
1514 }
1515 },
1516 true /* prompt user regarding locked items */ );
1517
1518 int netCode = -1;
1519 wxString netName;
1520
1521 for( EDA_ITEM* item : selection )
1522 {
1523 NETINFO_ITEM* net = static_cast<BOARD_CONNECTED_ITEM*>( item )->GetNet();
1524
1525 if( !net->HasAutoGeneratedNetname() )
1526 {
1527 netCode = net->GetNetCode();
1528 netName = net->GetNetname();
1529 break;
1530 }
1531 }
1532
1533 if( netName.IsEmpty() )
1534 {
1535 m_frame->ShowInfoBarError( _( "Selection contains no items with labeled nets." ) );
1536 return 0;
1537 }
1538
1539 selectionTool->ClearSelection();
1541 canvas()->ForceRefresh();
1542
1543 DIALOG_ASSIGN_NETCLASS dlg( m_frame, netName, board()->GetNetClassAssignmentCandidates(),
1544 [this]( const std::vector<wxString>& aNetNames )
1545 {
1547 selTool->ClearSelection();
1548
1549 for( const wxString& curr_netName : aNetNames )
1550 {
1551 int curr_netCode = board()->GetNetInfo().GetNetItem( curr_netName )->GetNetCode();
1552
1553 if( curr_netCode > 0 )
1554 selTool->SelectAllItemsOnNet( curr_netCode );
1555 }
1556
1557 canvas()->ForceRefresh();
1559 } );
1560
1561 if( dlg.ShowModal() == wxID_OK )
1562 {
1564 // Refresh UI that depends on netclasses, such as the properties panel
1566 }
1567
1568 return 0;
1569}
1570
1571
1573{
1576
1577 if( selection.Empty() )
1578 {
1579 // Giant hack: by default we assign Edit Table to the same hotkey, so give the table
1580 // tool a chance to handle it if we can't.
1582 tableTool->EditTable( aEvent );
1583
1584 return 0;
1585 }
1586
1588
1589 if( !fp )
1590 return 0;
1591
1592 PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
1593
1594 if( KIWAY_PLAYER* frame = editFrame->Kiway().Player( FRAME_FOOTPRINT_EDITOR, true ) )
1595 {
1596 FOOTPRINT_EDIT_FRAME* fp_editor = static_cast<FOOTPRINT_EDIT_FRAME*>( frame );
1597
1599 fp_editor->LoadFootprintFromBoard( fp );
1600 else if( aEvent.IsAction( &PCB_ACTIONS::editLibFpInFpEditor ) )
1601 fp_editor->LoadFootprintFromLibrary( fp->GetFPID() );
1602
1603 fp_editor->Show( true );
1604 fp_editor->Raise(); // Iconize( false );
1605 }
1606
1607 if( selection.IsHover() )
1609
1610 return 0;
1611}
1612
1613
1615 EDA_ITEM* originViewItem, const VECTOR2D& aPosition )
1616{
1617 aFrame->GetDesignSettings().SetAuxOrigin( VECTOR2I( aPosition ) );
1618 originViewItem->SetPosition( aPosition );
1619 aView->MarkDirty();
1620 aFrame->OnModify();
1621}
1622
1623
1625{
1627 {
1628 m_frame->SaveCopyInUndoList( m_placeOrigin.get(), UNDO_REDO::GRIDORIGIN );
1630 return 0;
1631 }
1632
1634
1635 // Deactivate other tools; particularly important if another PICKER is currently running
1636 Activate();
1637
1638 picker->SetClickHandler(
1639 [this] ( const VECTOR2D& pt ) -> bool
1640 {
1641 m_frame->SaveCopyInUndoList( m_placeOrigin.get(), UNDO_REDO::DRILLORIGIN );
1643 return false; // drill origin is a one-shot; don't continue with tool
1644 } );
1645
1647
1648 return 0;
1649}
1650
1651
1653{
1662
1667
1672
1673 if( ADVANCED_CFG::GetCfg().m_ShowPcbnewExportNetlist && m_frame &&
1676
1684
1685 // Track & via size control
1690
1691 // Zone actions
1694
1695 // Placing tools
1699
1702
1703 // Cross-select
1709
1710 // Other
1714
1716
1726}
1727
1728
1729const int BOARD_EDITOR_CONTROL::WIDTH_STEP = 100000;
const char * name
Definition: DXF_plotter.cpp:57
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:108
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:199
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:189
static TOOL_ACTION findPrevious
Definition: actions.h:102
static TOOL_ACTION plot
Definition: actions.h:58
static TOOL_ACTION open
Definition: actions.h:50
static TOOL_ACTION findNext
Definition: actions.h:101
static TOOL_ACTION pageSettings
Definition: actions.h:56
static TOOL_ACTION showSearch
Definition: actions.h:98
static TOOL_ACTION undo
Definition: actions.h:66
static TOOL_ACTION save
Definition: actions.h:51
static TOOL_ACTION redo
Definition: actions.h:67
static TOOL_ACTION updateSchematicFromPcb
Definition: actions.h:200
static TOOL_ACTION showProperties
Definition: actions.h:201
static TOOL_ACTION doNew
Definition: actions.h:47
static TOOL_ACTION saveCopy
Definition: actions.h:53
static TOOL_ACTION refreshPreview
Definition: actions.h:137
static TOOL_ACTION find
Definition: actions.h:99
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:92
void SetIcon(BITMAPS aIcon)
Assign an icon for the entry.
Definition: action_menu.cpp:78
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:278
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 Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
virtual void Revert() override
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::shared_ptr< NET_SETTINGS > m_NetSettings
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 ToggleNetInspector(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:77
virtual void SetLocked(bool aLocked)
Definition: board_item.h:300
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:91
virtual bool IsLocked() const
Definition: board_item.cpp:74
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:282
const NETINFO_LIST & GetNetInfo() const
Definition: board.h:853
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: board.cpp:882
void UpdateUserUnits(BOARD_ITEM *aItem, KIGFX::VIEW *aView)
Update any references within aItem (or its descendants) to the user units.
Definition: board.cpp:1213
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1803
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
Definition: board.cpp:1936
const wxString & GetFileName() const
Definition: board.h:319
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:92
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Create an undo entry for an item that has been already modified.
Definition: commit.h:105
bool Empty() const
Returns status of an item.
Definition: commit.h:144
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been added.
Definition: commit.h:80
int GetStatus(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Definition: commit.cpp:129
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:86
void SetFields(nlohmann::ordered_map< wxString, wxString > &aFields)
Definition: pcb_netlist.h:132
void AddNet(const wxString &aPinName, const wxString &aNetName, const wxString &aPinFunction, const wxString &aPinType)
Definition: pcb_netlist.h:104
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:55
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:88
virtual void SetPosition(const VECTOR2I &aPos)
Definition: eda_item.h:243
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:126
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:103
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:83
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:181
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:2929
static const TOOL_EVENT ClearedEvent
Definition: actions.h:262
static const TOOL_EVENT SelectedEvent
Definition: actions.h:260
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:267
static const TOOL_EVENT PointSelectedEvent
Definition: actions.h:259
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:261
Used for text file output.
Definition: richio.h:475
void LoadFootprintFromLibrary(LIB_ID aFPID)
bool LoadFootprintFromBoard(FOOTPRINT *aFootprint)
Load a footprint from the main board into the Footprint Editor.
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:2315
void SetLink(const KIID &aLink)
Definition: footprint.h:839
ZONES & Zones()
Definition: footprint.h:197
void SetOrientation(const EDA_ANGLE &aNewAngle)
Definition: footprint.cpp:2387
PCB_FIELD & Value()
read/write accessors:
Definition: footprint.h:624
wxString GetFPIDAsString() const
Definition: footprint.h:240
bool IsFlipped() const
Definition: footprint.h:377
PADS & Pads()
Definition: footprint.h:191
const LIB_ID & GetFPID() const
Definition: footprint.h:233
PCB_FIELD & Reference()
Definition: footprint.h:625
GROUPS & Groups()
Definition: footprint.h:200
PCB_FIELDS & Fields()
Definition: footprint.h:188
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:2256
const wxString & GetValue() const
Definition: footprint.h:610
const wxString & GetReference() const
Definition: footprint.h:588
PCB_FIELD * GetField(MANDATORY_FIELD_T aFieldType)
Return a mandatory field in this symbol.
Definition: footprint.cpp:504
const KIID_PATH & GetPath() const
Definition: footprint.h:249
VECTOR2I GetPosition() const override
Definition: footprint.h:209
DRAWINGS & GraphicalItems()
Definition: footprint.h:194
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:206
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
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:84
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:315
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:354
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:1631
void MarkDirty()
Force redraw of view on the next rendering.
Definition: view.h:643
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:1523
Definition: kiid.h:49
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:55
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:65
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:406
wxWindow * GetBlockingDialog()
Gets the window pointer to the blocking dialog (to send it signals)
Definition: kiway.cpp:669
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
Definition: kiway.cpp:527
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:56
bool HasAutoGeneratedNetname()
Definition: netinfo.h:129
const wxString & GetNetname() const
Definition: netinfo.h:114
int GetNetCode() const
Definition: netinfo.h:108
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:223
Definition: pad.h:53
DISPLAY_OPTIONS m_Display
static TOOL_ACTION generateBOM
Definition: pcb_actions.h:435
static TOOL_ACTION zoneFillAll
Definition: pcb_actions.h:397
static TOOL_ACTION showLayersManager
Definition: pcb_actions.h:442
static TOOL_ACTION trackWidthDec
Definition: pcb_actions.h:387
static TOOL_ACTION generateDrillFiles
Definition: pcb_actions.h:430
static TOOL_ACTION selectionCursor
Select a single item under the cursor position.
Definition: pcb_actions.h:65
static TOOL_ACTION generateD356File
Definition: pcb_actions.h:434
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:391
static TOOL_ACTION exportSpecctraDSN
Definition: pcb_actions.h:427
static TOOL_ACTION trackWidthInc
Definition: pcb_actions.h:386
static TOOL_ACTION generateIPC2581File
Definition: pcb_actions.h:433
static TOOL_ACTION getAndPlace
Find an item and start moving.
Definition: pcb_actions.h:568
static TOOL_ACTION drawZoneCutout
Definition: pcb_actions.h:219
static TOOL_ACTION viaSizeDec
Definition: pcb_actions.h:389
static TOOL_ACTION zoneFill
Definition: pcb_actions.h:396
static TOOL_ACTION properties
Activation of the edit tool.
Definition: pcb_actions.h:176
static TOOL_ACTION editFpInFpEditor
Definition: pcb_actions.h:439
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: pcb_actions.h:68
static TOOL_ACTION toggleLock
Definition: pcb_actions.h:520
static TOOL_ACTION drillResetOrigin
Definition: pcb_actions.h:536
static TOOL_ACTION viaSizeInc
Definition: pcb_actions.h:388
static TOOL_ACTION zoneUnfill
Definition: pcb_actions.h:399
static TOOL_ACTION generatePosFile
Definition: pcb_actions.h:431
static TOOL_ACTION drillOrigin
Definition: pcb_actions.h:535
static TOOL_ACTION assignNetClass
Definition: pcb_actions.h:393
static TOOL_ACTION repairBoard
Definition: pcb_actions.h:542
static TOOL_ACTION showNetInspector
Definition: pcb_actions.h:443
static TOOL_ACTION generateGerbers
Definition: pcb_actions.h:429
static TOOL_ACTION generateReportFile
Definition: pcb_actions.h:432
static TOOL_ACTION zoneDuplicate
Duplicate zone onto another layer.
Definition: pcb_actions.h:404
static TOOL_ACTION importNetlist
Definition: pcb_actions.h:424
static TOOL_ACTION drawSimilarZone
Definition: pcb_actions.h:220
static TOOL_ACTION boardSetup
Definition: pcb_actions.h:410
static TOOL_ACTION showEeschema
Definition: pcb_actions.h:539
static TOOL_ACTION zoneUnfillAll
Definition: pcb_actions.h:400
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
Definition: pcb_actions.h:71
static TOOL_ACTION selectNet
Select all connections belonging to a single net.
Definition: pcb_actions.h:96
static TOOL_ACTION editLibFpInFpEditor
Definition: pcb_actions.h:440
static TOOL_ACTION zoneMerge
Definition: pcb_actions.h:401
static TOOL_ACTION unlock
Definition: pcb_actions.h:522
static TOOL_ACTION placeFootprint
Definition: pcb_actions.h:223
static TOOL_ACTION showPythonConsole
Definition: pcb_actions.h:444
static TOOL_ACTION importSpecctraSession
Definition: pcb_actions.h:426
static TOOL_ACTION selectOnSchematic
Select symbols/pins on schematic corresponding to selected footprints/pads.
Definition: pcb_actions.h:114
static TOOL_ACTION lock
Definition: pcb_actions.h:521
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:162
void ClearListAndDeleteItems(PICKED_ITEMS_LIST *aList)
Definition: undo_redo.cpp:645
void RollbackFromUndo()
Perform an undo of the last edit without logging a corresponding redo.
Definition: undo_redo.cpp:661
void PutDataInPreviousState(PICKED_ITEMS_LIST *aList)
Used in undo or redo command.
Definition: undo_redo.cpp:257
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
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 ...
FOOTPRINT * SelectFootprintFromLibrary(LIB_ID aPreselect=LIB_ID())
Open a dialog to select a footprint.
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 GenIPC2581File(wxCommandEvent &event)
Create and IPC2581 output file.
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
void SetLocked(bool aLocked) override
Definition: pcb_group.cpp:183
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:107
int GetWidth() const
Definition: pcb_track.h:108
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition: pgm_base.cpp:678
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 SetDescription(const wxString &aDescription)
void SetClickHandler(CLICK_HANDLER aHandler)
Set a handler for mouse click event.
Definition: picker_tool.h:72
ROUTER_MODE Mode() const
Definition: pns_router.h:136
RouterState GetState() const
Definition: pns_router.h:138
ROUTER * Router() const
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
Definition: project.cpp:129
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:188
const std::deque< EDA_ITEM * > GetItems() const
Definition: selection.h:121
EDA_ITEM * GetLastAddedItem() const
Definition: selection.h:126
bool IsHover() const
Definition: selection.h:84
int Size() const
Returns the number of selected parts.
Definition: selection.h:116
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.cpp:179
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:110
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:125
bool IsCurrentTool(const TOOL_ACTION &aAction) const
TOOL_EVENT MakeEvent() const
Return the event associated with the action (i.e.
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:217
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:167
bool HasPosition() const
Definition: tool_event.h:256
bool Matches(const TOOL_EVENT &aEvent) const
Test whether two events match in terms of category & action or command.
Definition: tool_event.h:384
const VECTOR2D Position() const
Returns the point where dragging has started.
Definition: tool_event.h:285
bool IsReactivate() const
Definition: tool_event.h:268
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:82
T Parameter() const
Return a parameter assigned to the event.
Definition: tool_event.h:460
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, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
Definition: tool_manager.h:150
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...
bool PostAction(const std::string &aActionName, T aParam)
Run the specified action after the current action (coroutine) ends.
Definition: tool_manager.h:235
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:71
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 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:255
unsigned GetAssignedPriority() const
Definition: zone.h:119
@ CHT_MODIFY
Definition: commit.h:44
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:213
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:186
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:435
#define IS_NEW
New item, just created.
@ FRAME_SCH
Definition: frame_type.h:34
@ FRAME_FOOTPRINT_EDITOR
Definition: frame_type.h:43
static const std::string SpecctraDsnFileExtension
static const std::string SpecctraSessionFileExtension
static wxString SpecctraSessionFileWildcard()
static wxString SpecctraDsnFileWildcard()
@ 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:57
@ GEOMETRY
Position or shape has changed.
Definition: view_item.h:54
@ PNS_MODE_ROUTE_DIFF_PAIR
Definition: pns_router.h:64
#define MAX_PAGE_SIZE_PCBNEW_MILS
Definition: page_info.h:39
@ ID_REVERT_BOARD
Definition: pcbnew_id.h:18
@ ID_COPY_BOARD_AS
Definition: pcbnew_id.h:17
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1059
see class PGM_BASE
@ LAST_PATH_SPECCTRADSN
Definition: project_file.h:53
std::vector< FAB_LAYER_COLOR > dummy
wxString UnescapeString(const wxString &aSource)
const double IU_PER_MM
Definition: base_units.h:76
const double IU_PER_MILS
Definition: base_units.h:77
Container to handle a stock of specific vias each with unique diameter and drill sizes in the BOARD c...
@ FOOTPRINT_FIELD
Field Name Module PCB, i.e. "16DIP300".
@ BUT_LEFT
Definition: tool_event.h:131
@ BUT_RIGHT
Definition: tool_event.h:132
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition: typeinfo.h:107
VECTOR2< int > VECTOR2I
Definition: vector2d.h:602
wxString AddFileExtListToFilter(const std::vector< std::string > &aExts)
Build the wildcard extension file dialog wildcard filter to add to the base message dialog.
Definition of file extensions used in Kicad.