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 The 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, see <https://www.gnu.org/licenses/>.
20 */
21
23
24#include <algorithm>
25#include <climits>
26#include <functional>
27#include <memory>
28
29#include <pgm_base.h>
30#include <executable_names.h>
31#include <advanced_config.h>
32#include <bitmaps.h>
33#include <gestfich.h>
34#include <pcb_painter.h>
35#include <board.h>
36#include <board_commit.h>
38#include <collectors.h>
40#include <pcb_generator.h>
41#include <footprint.h>
42#include <pad.h>
43#include <pcb_target.h>
44#include <pcb_track.h>
45#include <zone.h>
46#include <pcb_marker.h>
47#include <confirm.h>
51#include <dialog_plot.h>
54#include <kiface_base.h>
55#include <kiway.h>
57#include <origin_viewitem.h>
58#include <pcb_edit_frame.h>
59#include <pcbnew_id.h>
60#include <project.h>
61#include <project/project_file.h> // LAST_PATH_TYPE
63#include <kiplatform/ui.h>
64#include <pcbnew_settings.h>
65#include <tool/tool_manager.h>
66#include <tool/tool_event.h>
67#include <tools/drawing_tool.h>
68#include <tools/pcb_actions.h>
73#include <tools/edit_tool.h>
76#include <richio.h>
77#include <router/router_tool.h>
78#include <view/view_controls.h>
79#include <view/view_group.h>
83#include <wx/filedlg.h>
84#include <wx/msgdlg.h>
85#include <wx/log.h>
86
88
89using namespace std::placeholders;
90
91
92namespace
93{
94
95using ZonePriorityMap = std::map<unsigned, std::vector<ZONE*>>;
96
97
98std::vector<ZONE*> getOverlappingZones( BOARD* aBoard, ZONE* aZone )
99{
100 std::vector<ZONE*> overlapping;
101 BOX2I bbox = aZone->GetBoundingBox();
102
103 for( ZONE* candidate : aBoard->Zones() )
104 {
105 if( candidate == aZone )
106 continue;
107
108 if( candidate->GetIsRuleArea() || candidate->IsTeardropArea() )
109 continue;
110
111 if( !( candidate->GetLayerSet() & aZone->GetLayerSet() ).any() )
112 continue;
113
114 if( !candidate->GetBoundingBox().Intersects( bbox ) )
115 continue;
116
117 // Check edge collision and containment (one zone entirely inside another)
118 SHAPE_POLY_SET aOutline = aZone->GetBoardOutline();
119 SHAPE_POLY_SET candidateOutline = candidate->GetBoardOutline();
120
121 if( aOutline.Collide( &candidateOutline )
122 || ( candidateOutline.TotalVertices() > 0 && aOutline.Contains( candidateOutline.CVertex( 0 ) ) )
123 || ( aOutline.TotalVertices() > 0 && candidateOutline.Contains( aOutline.CVertex( 0 ) ) ) )
124 {
125 overlapping.push_back( candidate );
126 }
127 }
128
129 return overlapping;
130}
131
132
133ZonePriorityMap buildPriorityMap( BOARD* aBoard, ZONE* aExclude )
134{
135 ZonePriorityMap byPriority;
136
137 for( ZONE* z : aBoard->Zones() )
138 {
139 if( z == aExclude || z->GetIsRuleArea() || z->IsTeardropArea() )
140 continue;
141
142 byPriority[z->GetAssignedPriority()].push_back( z );
143 }
144
145 return byPriority;
146}
147
148
161std::vector<ZONE*> findCascadeZones( const ZonePriorityMap& aByPriority,
162 unsigned aFromPriority, bool aCascadeUp,
163 bool& aViable )
164{
165 std::vector<ZONE*> result;
166 unsigned p = aFromPriority;
167 aViable = true;
168
169 for( auto it = aByPriority.find( p ); it != aByPriority.end();
170 it = aByPriority.find( p ) )
171 {
172 for( ZONE* z : it->second )
173 result.push_back( z );
174
175 if( aCascadeUp )
176 {
177 if( p == UINT_MAX )
178 {
179 aViable = false;
180 break;
181 }
182
183 p++;
184 }
185 else
186 {
187 if( p == 0 )
188 {
189 aViable = false;
190 break;
191 }
192
193 p--;
194 }
195 }
196
197 return result;
198}
199
200} // anonymous namespace
201
202
204{
205public:
217
218protected:
219 ACTION_MENU* create() const override
220 {
221 return new ZONE_PRIORITY_CONTEXT_MENU();
222 }
223
224 void update() override
225 {
227
228 if( !selTool )
229 return;
230
231 const PCB_SELECTION& selection = selTool->GetSelection();
232 bool canRaise = false;
233 bool canLower = false;
234
235 if( selection.Size() == 1 )
236 {
237 ZONE* zone = dynamic_cast<ZONE*>( selection[0] );
238
239 if( zone && !zone->GetIsRuleArea() && !zone->IsTeardropArea() )
240 {
241 BOARD* board = zone->GetBoard();
242 std::vector<ZONE*> overlapping = getOverlappingZones( board, zone );
243
244 for( ZONE* other : overlapping )
245 {
246 if( other->GetAssignedPriority() > zone->GetAssignedPriority() )
247 canRaise = true;
248
249 if( other->GetAssignedPriority() < zone->GetAssignedPriority() )
250 canLower = true;
251 }
252 }
253 }
254
255 Enable( PCB_ACTIONS::zonePriorityMoveToTop.GetUIId(), canRaise );
256 Enable( PCB_ACTIONS::zonePriorityRaise.GetUIId(), canRaise );
257 Enable( PCB_ACTIONS::zonePriorityLower.GetUIId(), canLower );
258 Enable( PCB_ACTIONS::zonePriorityMoveToBottom.GetUIId(), canLower );
259 }
260};
261
262
264{
265public:
267 ACTION_MENU( true )
268 {
270 SetTitle( _( "Zones" ) );
271
276
277 AppendSeparator();
278
283
284 AppendSeparator();
285
287
288 AppendSeparator();
289
291 }
292
293protected:
294 ACTION_MENU* create() const override
295 {
296 return new ZONE_CONTEXT_MENU();
297 }
298};
299
300
302{
303public:
314
315 ACTION_MENU* create() const override
316 {
317 return new LOCK_CONTEXT_MENU( this->m_tool );
318 }
319};
320
321
323 PCB_TOOL_BASE( "pcbnew.EditorControl" ),
324 m_frame( nullptr ),
325 m_inPlaceFootprint( false ),
326 m_placingFootprint( false )
327{
328 m_placeOrigin = std::make_unique<KIGFX::ORIGIN_VIEWITEM>( KIGFX::COLOR4D( 0.8, 0.0, 0.0, 1.0 ),
330}
331
332
336
337
339{
341
342 if( aReason == MODEL_RELOAD || aReason == GAL_SWITCH || aReason == REDRAW )
343 {
344 m_placeOrigin->SetPosition( getModel<BOARD>()->GetDesignSettings().GetAuxOrigin() );
345 getView()->Remove( m_placeOrigin.get() );
346 getView()->Add( m_placeOrigin.get() );
347 }
348}
349
350// Update left-toolbar Line modes group icon based on current settings
352{
354
355 if( !f )
356 return 0;
357
358 LEADER_MODE mode = GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" )->m_AngleSnapMode;
359
360 switch( mode )
361 {
364 default:
366 }
367
368 return 0;
369}
370
372{
373 LEADER_MODE mode = aEvent.Parameter<LEADER_MODE>();
374 GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" )->m_AngleSnapMode = mode;
375 m_toolMgr->PostAction( ACTIONS::refreshPreview );
377 return 0;
378}
379
380
382{
383 auto activeToolCondition =
384 [this]( const SELECTION& aSel )
385 {
386 return ( !m_frame->ToolStackIsEmpty() );
387 };
388
389 auto inactiveStateCondition =
390 [this]( const SELECTION& aSel )
391 {
392 return ( m_frame->ToolStackIsEmpty() && aSel.Size() == 0 );
393 };
394
395 auto placeModuleCondition =
396 [this]( const SELECTION& aSel )
397 {
398 return m_frame->IsCurrentTool( PCB_ACTIONS::placeFootprint ) && aSel.GetSize() == 0;
399 };
400
401 auto& ctxMenu = m_menu->GetMenu();
402
403 // "Cancel" goes at the top of the context menu when a tool is active
404 ctxMenu.AddItem( ACTIONS::cancelInteractive, activeToolCondition, 1 );
405 ctxMenu.AddSeparator( 1 );
406
407 // "Get and Place Footprint" should be available for Place Footprint tool
408 ctxMenu.AddItem( PCB_ACTIONS::getAndPlace, placeModuleCondition, 1000 );
409 ctxMenu.AddSeparator( 1000 );
410
411 // Finally, add the standard zoom & grid items
412 getEditFrame<PCB_BASE_FRAME>()->AddStandardSubMenus( *m_menu.get() );
413
414 std::shared_ptr<ZONE_CONTEXT_MENU> zoneMenu = std::make_shared<ZONE_CONTEXT_MENU>();
415 zoneMenu->SetTool( this );
416
417 std::shared_ptr<LOCK_CONTEXT_MENU> lockMenu = std::make_shared<LOCK_CONTEXT_MENU>( this );
418
419 // Add the PCB control menus to relevant other tools
420
421 PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
422
423 if( selTool )
424 {
425 TOOL_MENU& toolMenu = selTool->GetToolMenu();
426 CONDITIONAL_MENU& menu = toolMenu.GetMenu();
427
428 // Add "Get and Place Footprint" when Selection tool is in an inactive state
429 menu.AddItem( PCB_ACTIONS::getAndPlace, inactiveStateCondition );
430 menu.AddSeparator();
431
432 toolMenu.RegisterSubMenu( zoneMenu );
433 toolMenu.RegisterSubMenu( lockMenu );
434
435 menu.AddMenu( lockMenu.get(), SELECTION_CONDITIONS::NotEmpty, 100 );
436
437 menu.AddMenu( zoneMenu.get(), SELECTION_CONDITIONS::OnlyTypes( { PCB_ZONE_T } ), 100 );
438 }
439
440 DRAWING_TOOL* drawingTool = m_toolMgr->GetTool<DRAWING_TOOL>();
441
442 if( drawingTool )
443 {
444 TOOL_MENU& toolMenu = drawingTool->GetToolMenu();
445 CONDITIONAL_MENU& menu = toolMenu.GetMenu();
446
447 toolMenu.RegisterSubMenu( zoneMenu );
448
449 // Functor to say if the PCB_EDIT_FRAME is in a given mode
450 // Capture the tool pointer and tool mode by value
451 auto toolActiveFunctor =
452 [=]( DRAWING_TOOL::MODE aMode )
453 {
454 return [=]( const SELECTION& sel )
455 {
456 return drawingTool->GetDrawingMode() == aMode;
457 };
458 };
459
460 menu.AddMenu( zoneMenu.get(), toolActiveFunctor( DRAWING_TOOL::MODE::ZONE ), 300 );
461 }
462
463 // Ensure the left toolbar's Line modes group reflects the current setting at startup
464 if( m_toolMgr )
466
467 return true;
468}
469
470
472{
473 wxWindow* focus = wxWindow::FindFocus();
474
475 if( focus )
476 {
477 wxWindow* topLevel = focus;
478
479 while( topLevel && !topLevel->IsTopLevel() )
480 topLevel = topLevel->GetParent();
481
482 RULE_EDITOR_DIALOG_BASE* reDlg = dynamic_cast<RULE_EDITOR_DIALOG_BASE*>( topLevel );
483
484 if( reDlg )
485 {
486 wxCommandEvent evt;
487 reDlg->OnSave( evt );
488 return 0;
489 }
490 }
491
492 m_frame->SaveBoard();
493 return 0;
494}
495
496
498{
499 m_frame->SaveBoard( true );
500 return 0;
501}
502
503
505{
506 m_frame->SaveBoard( true, true );
507 return 0;
508}
509
510
512{
513 m_frame->ExportFootprintsToLibrary( false );
514 return 0;
515}
516
517
519{
520 PICKED_ITEMS_LIST undoCmd;
522 ITEM_PICKER wrapper( nullptr, undoItem, UNDO_REDO::PAGESETTINGS );
523
524 undoCmd.PushItem( wrapper );
525 undoCmd.SetDescription( _( "Page Settings" ) );
526 m_frame->SaveCopyInUndoList( undoCmd, UNDO_REDO::PAGESETTINGS );
527
528 DIALOG_PAGES_SETTINGS dlg( m_frame, m_frame->GetBoard()->GetEmbeddedFiles(), pcbIUScale.IU_PER_MILS,
531
532 if( dlg.ShowModal() == wxID_OK )
533 {
534 m_frame->GetCanvas()->GetView()->UpdateAllItemsConditionally(
535 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
536 {
537 EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem );
538
539 if( text && text->HasTextVars() )
540 {
541 text->ClearRenderCache();
542 text->ClearBoundingBoxCache();
544 }
545
546 return 0;
547 } );
548
549 m_frame->OnModify();
550 }
551 else
552 {
553 m_frame->RollbackFromUndo();
554 }
555
556 return 0;
557}
558
559
561{
562 DIALOG_PLOT dlg( m_frame );
563 dlg.ShowQuasiModal();
564 return 0;
565}
566
567
569{
570 m_frame->ToggleSearch();
571 return 0;
572}
573
574
576{
577 m_frame->ShowFindDialog();
578 return 0;
579}
580
581
583{
584 m_frame->FindNext( aEvent.IsAction( &ACTIONS::findPrevious ) );
585 return 0;
586}
587
588
590{
591 m_frame->ShowFindByPropertiesDialog();
592 return 0;
593}
594
595
597{
598 getEditFrame<PCB_EDIT_FRAME>()->ShowBoardSetupDialog();
599 return 0;
600}
601
602
604{
605 getEditFrame<PCB_EDIT_FRAME>()->InstallNetlistFrame();
606 return 0;
607}
608
609
611{
612 wxString fullFileName = frame()->GetBoard()->GetFileName();
613 wxString path;
614 wxString name;
615 wxString ext;
616
617 wxFileName::SplitPath( fullFileName, &path, &name, &ext );
618 name += wxT( "." ) + wxString( FILEEXT::SpecctraSessionFileExtension );
619
620 fullFileName = wxFileSelector( _( "Specctra Session File" ), path, name,
621 wxT( "." ) + wxString( FILEEXT::SpecctraSessionFileExtension ),
622 FILEEXT::SpecctraSessionFileWildcard(), wxFD_OPEN | wxFD_CHANGE_DIR,
623 frame() );
624
625 if( !fullFileName.IsEmpty() )
626 getEditFrame<PCB_EDIT_FRAME>()->ImportSpecctraSession( fullFileName );
627
628 return 0;
629}
630
631
633{
634 wxString fullFileName = m_frame->GetLastPath( LAST_PATH_SPECCTRADSN );
635 wxFileName fn;
636
637 if( fullFileName.IsEmpty() )
638 {
639 fn = m_frame->GetBoard()->GetFileName();
641 }
642 else
643 {
644 fn = fullFileName;
645 }
646
647 fullFileName = wxFileSelector( _( "Specctra DSN File" ), fn.GetPath(), fn.GetFullName(),
649 wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxFD_CHANGE_DIR, frame() );
650
651 if( !fullFileName.IsEmpty() )
652 {
653 m_frame->SetLastPath( LAST_PATH_SPECCTRADSN, fullFileName );
654 getEditFrame<PCB_EDIT_FRAME>()->ExportSpecctraFile( fullFileName );
655 }
656
657 return 0;
658}
659
660
662{
663 wxCHECK( m_frame, 0 );
664
665 wxFileName fn = m_frame->Prj().GetProjectFullName();
666
667 // Use a different file extension for the board netlist so the schematic netlist file
668 // is accidentally overwritten.
669 fn.SetExt( wxT( "pcb_net" ) );
670
671 wxFileDialog dlg( m_frame, _( "Export Board Netlist" ), fn.GetPath(), fn.GetFullName(),
672 _( "KiCad board netlist files" ) + AddFileExtListToFilter( { "pcb_net" } ),
673 wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
674
675 dlg.SetExtraControlCreator( &LEGACYFILEDLG_NETLIST_OPTIONS::Create );
676
678
679 if( dlg.ShowModal() == wxID_CANCEL )
680 return 0;
681
682 fn = dlg.GetPath();
683
684 if( !fn.IsDirWritable() )
685 {
686 DisplayErrorMessage( m_frame, wxString::Format( _( "Insufficient permissions to folder '%s'." ),
687 fn.GetPath() ) );
688 return 0;
689 }
690
692 dynamic_cast<const LEGACYFILEDLG_NETLIST_OPTIONS*>( dlg.GetExtraControl() );
693 wxCHECK( noh, 0 );
694
696
697 for( const FOOTPRINT* footprint : board()->Footprints() )
698 {
699 COMPONENT* component = new COMPONENT( footprint->GetFPID(), footprint->GetReference(),
700 footprint->GetValue(), footprint->GetPath(),
701 { footprint->m_Uuid } );
702
703 for( const PAD* pad : footprint->Pads() )
704 {
705 const wxString& netname = pad->GetShortNetname();
706
707 if( !netname.IsEmpty() )
708 component->AddNet( pad->GetNumber(), netname, pad->GetPinFunction(), pad->GetPinType() );
709 }
710
711 nlohmann::ordered_map<wxString, wxString> fields;
712
713 for( PCB_FIELD* field : footprint->GetFields() )
714 {
715 wxCHECK2( field, continue );
716
717 fields[field->GetCanonicalName()] = field->GetText();
718 }
719
720 component->SetFields( fields );
721
722 netlist.AddComponent( component );
723 }
724
725 try
726 {
727 FILE_OUTPUTFORMATTER formatter( fn.GetFullPath() );
728
729 netlist.Format( "pcb_netlist", &formatter, 0, noh->GetNetlistOptions() );
730 formatter.Finish();
731 }
732 catch( const IO_ERROR& ioe )
733 {
734 DisplayErrorMessage( m_frame, wxString::Format( _( "Failed to export netlist to '%s': %s" ),
735 fn.GetFullPath(), ioe.What() ) );
736 }
737
738 return 0;
739}
740
741
743{
744 PCB_PLOT_PARAMS plotSettings = m_frame->GetPlotSettings();
745
746 plotSettings.SetFormat( PLOT_FORMAT::GERBER );
747
748 m_frame->SetPlotSettings( plotSettings );
749
750 DIALOG_PLOT dlg( m_frame );
751 dlg.ShowQuasiModal( );
752
753 return 0;
754}
755
756
758{
759 int errors = 0;
760 wxString details;
761 bool quiet = aEvent.Parameter<bool>();
762
763 int duplicates = board()->RepairDuplicateItemUuids();
764
765 if( duplicates )
766 {
767 errors += duplicates;
768 details += wxString::Format( _( "%d duplicate IDs replaced.\n" ), duplicates );
769 }
770
771 for( FOOTPRINT* footprint : board()->Footprints() )
772 {
773 for( PAD* pad : footprint->Pads() )
774 {
775 BOARD_CONNECTED_ITEM* cItem = pad;
776
777 if( cItem->GetNetCode() )
778 {
779 NETINFO_ITEM* netinfo = cItem->GetNet();
780
781 if( netinfo && !board()->FindNet( netinfo->GetNetname() ) )
782 {
783 board()->Add( netinfo );
784
785 details += wxString::Format( _( "Orphaned net %s re-parented.\n" ),
786 netinfo->GetNetname() );
787 errors++;
788 }
789 }
790 }
791 }
792
793 for( PCB_TRACK* track : board()->Tracks() )
794 {
795 BOARD_CONNECTED_ITEM* cItem = track;
796
797 if( cItem->GetNetCode() )
798 {
799 NETINFO_ITEM* netinfo = cItem->GetNet();
800
801 if( netinfo && !board()->FindNet( netinfo->GetNetname() ) )
802 {
803 board()->Add( netinfo );
804
805 details += wxString::Format( _( "Orphaned net %s re-parented.\n" ),
806 netinfo->GetNetname() );
807 errors++;
808 }
809 }
810 }
811
812 /*******************************
813 * Your test here
814 */
815
816 /*******************************
817 * Inform the user
818 */
819
820 if( errors )
821 {
822 m_frame->OnModify();
823
824 wxString msg = wxString::Format( _( "%d potential problems repaired." ), errors );
825
826 if( !quiet )
827 DisplayInfoMessage( m_frame, msg, details );
828 }
829 else if( !quiet )
830 {
831 DisplayInfoMessage( m_frame, _( "No board problems found." ) );
832 }
833
834 return 0;
835}
836
837
839{
841 bool fetched = false;
842
844 [&]()
845 {
846 fetched = m_frame->FetchNetlistFromSchematic(
847 netlist, _( "Updating PCB requires a fully annotated schematic." ) );
848 } );
849
850 if( fetched )
851 {
852 DIALOG_UPDATE_PCB updateDialog( m_frame, &netlist );
853 updateDialog.ShowModal();
854 }
855
856 return 0;
857}
858
860{
861 if( Kiface().IsSingle() )
862 {
863 DisplayErrorMessage( m_frame, _( "Cannot update schematic because Pcbnew is opened in "
864 "stand-alone mode. In order to create or update PCBs "
865 "from schematics, you must launch the KiCad project "
866 "manager and create a project." ) );
867 return 0;
868 }
869
872
873 KIWAY_PLAYER* frame = m_frame->Kiway().Player( FRAME_SCH, false );
874
875 if( frame )
876 {
877 std::string payload;
878
879 if( wxWindow* blocking_win = frame->Kiway().GetBlockingDialog() )
880 blocking_win->Close( true );
881
882 m_frame->Kiway().ExpressMail( FRAME_SCH, MAIL_SCH_UPDATE, payload, m_frame );
883 }
884 return 0;
885}
886
887
889{
890 wxString msg;
891 PCB_EDIT_FRAME* boardFrame = m_frame;
892 PROJECT& project = boardFrame->Prj();
893 wxFileName schematic( project.GetProjectPath(), project.GetProjectName(),
895
896 if( !schematic.FileExists() )
897 {
898 wxFileName legacySchematic( project.GetProjectPath(), project.GetProjectName(),
900
901 if( legacySchematic.FileExists() )
902 {
903 schematic = legacySchematic;
904 }
905 else
906 {
907 msg.Printf( _( "Schematic file '%s' not found." ), schematic.GetFullPath() );
909 return 0;
910 }
911 }
912
913 if( Kiface().IsSingle() )
914 {
915 ExecuteFile( EESCHEMA_EXE, schematic.GetFullPath() );
916 }
917 else
918 {
920 [&]()
921 {
922 KIWAY_PLAYER* frame = m_frame->Kiway().Player( FRAME_SCH, false );
923
924 // Please: note: DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers() calls
925 // Kiway.Player( FRAME_SCH, true )
926 // therefore, the schematic editor is sometimes running, but the schematic project
927 // is not loaded, if the library editor was called, and the dialog field editor was used.
928 // On Linux, it happens the first time the schematic editor is launched, if
929 // library editor was running, and the dialog field editor was open
930 // On Windows, it happens always after the library editor was called,
931 // and the dialog field editor was used
932 if( !frame )
933 {
934 try
935 {
936 frame = boardFrame->Kiway().Player( FRAME_SCH, true );
937 }
938 catch( const IO_ERROR& err )
939 {
940 DisplayErrorMessage( boardFrame,
941 _( "Eeschema failed to load." ) + wxS( "\n" ) + err.What() );
942 return;
943 }
944 }
945
946 wxEventBlocker blocker( boardFrame );
947
948 // If Kiway() cannot create the eeschema frame, it shows a error message, and
949 // frame is null
950 if( !frame )
951 return;
952
953 if( !frame->IsShownOnScreen() ) // the frame exists, (created by the dialog field editor)
954 // but no project loaded.
955 {
956 frame->OpenProjectFiles( std::vector<wxString>( 1, schematic.GetFullPath() ) );
957 frame->Show( true );
958 }
959
960 // On Windows, Raise() does not bring the window on screen, when iconized or not shown
961 // On Linux, Raise() brings the window on screen, but this code works fine
962 if( frame->IsIconized() )
963 {
964 frame->Iconize( false );
965
966 // If an iconized frame was created by Pcbnew, Iconize( false ) is not enough
967 // to show the frame at its normal size: Maximize should be called.
968 frame->Maximize( false );
969 }
970
971 frame->Raise();
972 } );
973 }
974
975 return 0;
976}
977
978
980{
981 getEditFrame<PCB_EDIT_FRAME>()->ToggleLayersManager();
982 return 0;
983}
984
985
987{
988 getEditFrame<PCB_EDIT_FRAME>()->ToggleProperties();
989 return 0;
990}
991
992
994{
995 getEditFrame<PCB_EDIT_FRAME>()->ToggleNetInspector();
996 return 0;
997}
998
999
1001{
1002 getEditFrame<PCB_EDIT_FRAME>()->ToggleLibraryTree();
1003 return 0;
1004}
1005
1006
1008{
1009 getEditFrame<PCB_EDIT_FRAME>()->ToggleSearch();
1010 return 0;
1011}
1012
1013
1015{
1016 getEditFrame<PCB_EDIT_FRAME>()->ToggleConstraintsPanel();
1017 return 0;
1018}
1019
1020
1021// Track & via size control
1023{
1024 BOARD_DESIGN_SETTINGS& bds = getModel<BOARD>()->GetDesignSettings();
1025 PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1026
1027 if( m_frame->ToolStackIsEmpty()
1028 && SELECTION_CONDITIONS::OnlyTypes( { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T } )( selection ) )
1029 {
1030 BOARD_COMMIT commit( this );
1031
1032 for( EDA_ITEM* item : selection )
1033 {
1034 if( item->IsType( { PCB_TRACE_T, PCB_ARC_T } ) )
1035 {
1036 PCB_TRACK* track = static_cast<PCB_TRACK*>( item );
1037
1038 for( int i = 0; i < (int) bds.m_TrackWidthList.size(); ++i )
1039 {
1040 int candidate = bds.m_NetSettings->GetDefaultNetclass()->GetTrackWidth();
1041
1042 if( i > 0 )
1043 candidate = bds.m_TrackWidthList[ i ];
1044
1045 if( candidate > track->GetWidth() )
1046 {
1047 commit.Modify( track );
1048 track->SetWidth( candidate );
1049 break;
1050 }
1051 }
1052 }
1053 }
1054
1055 commit.Push( _( "Increase Track Width" ) );
1056 return 0;
1057 }
1058
1059 ROUTER_TOOL* routerTool = m_toolMgr->GetTool<ROUTER_TOOL>();
1060
1061 if( routerTool && routerTool->IsToolActive()
1062 && routerTool->Router()->Mode() == PNS::PNS_MODE_ROUTE_DIFF_PAIR )
1063 {
1064 int widthIndex = bds.GetNextDiffPairIndex( bds.GetDiffPairIndex(), true );
1065
1066 bds.SetDiffPairIndex( widthIndex );
1067 bds.UseCustomDiffPairDimensions( false );
1068
1070 }
1071 else
1072 {
1073 // Issue #24644: stepping the index unconditionally lets the first press both enter the
1074 // connected-width override and advance into the list, instead of no-op'ing.
1075 if( routerTool && routerTool->IsToolActive()
1078 {
1079 bds.m_TempOverrideTrackWidth = true;
1080 }
1081
1083 bds.UseCustomTrackViaSize( false );
1084
1086 }
1087
1088 return 0;
1089}
1090
1091
1093{
1094 BOARD_DESIGN_SETTINGS& bds = getModel<BOARD>()->GetDesignSettings();
1095 PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1096
1097 if( m_frame->ToolStackIsEmpty()
1098 && SELECTION_CONDITIONS::OnlyTypes( { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T } )( selection ) )
1099 {
1100 BOARD_COMMIT commit( this );
1101
1102 for( EDA_ITEM* item : selection )
1103 {
1104 if( item->IsType( { PCB_TRACE_T, PCB_ARC_T } ) )
1105 {
1106 PCB_TRACK* track = static_cast<PCB_TRACK*>( item );
1107
1108 for( int i = (int) bds.m_TrackWidthList.size() - 1; i >= 0; --i )
1109 {
1110 int candidate = bds.m_NetSettings->GetDefaultNetclass()->GetTrackWidth();
1111
1112 if( i > 0 )
1113 candidate = bds.m_TrackWidthList[ i ];
1114
1115 if( candidate < track->GetWidth() )
1116 {
1117 commit.Modify( track );
1118 track->SetWidth( candidate );
1119 break;
1120 }
1121 }
1122 }
1123 }
1124
1125 commit.Push( _( "Decrease Track Width" ) );
1126 return 0;
1127 }
1128
1129 ROUTER_TOOL* routerTool = m_toolMgr->GetTool<ROUTER_TOOL>();
1130
1131 if( routerTool && routerTool->IsToolActive()
1132 && routerTool->Router()->Mode() == PNS::PNS_MODE_ROUTE_DIFF_PAIR )
1133 {
1134 int widthIndex = bds.GetNextDiffPairIndex( bds.GetDiffPairIndex(), false );
1135
1136 bds.SetDiffPairIndex( widthIndex );
1137 bds.UseCustomDiffPairDimensions( false );
1138
1140 }
1141 else
1142 {
1143 // Issue #24644: mirror TrackWidthInc so the first invocation also advances into the
1144 // predefined list instead of merely flipping the override flag.
1145 if( routerTool && routerTool->IsToolActive()
1148 {
1149 bds.m_TempOverrideTrackWidth = true;
1150 }
1151
1153 bds.UseCustomTrackViaSize( false );
1154
1156 }
1157
1158 return 0;
1159}
1160
1161
1163{
1164 BOARD_DESIGN_SETTINGS& bds = getModel<BOARD>()->GetDesignSettings();
1165 PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1166
1167 if( m_frame->ToolStackIsEmpty()
1168 && SELECTION_CONDITIONS::OnlyTypes( { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T } )( selection ) )
1169 {
1170 BOARD_COMMIT commit( this );
1171
1172 for( EDA_ITEM* item : selection )
1173 {
1174 if( item->Type() == PCB_VIA_T )
1175 {
1176 PCB_VIA* via = static_cast<PCB_VIA*>( item );
1177
1178 for( int i = 0; i < (int) bds.m_ViasDimensionsList.size(); ++i )
1179 {
1182
1183 if( i> 0 )
1184 dims = bds.m_ViasDimensionsList[ i ];
1185
1186 // TODO(JE) padstacks
1187 if( dims.m_Diameter > via->GetWidth( PADSTACK::ALL_LAYERS ) )
1188 {
1189 commit.Modify( via );
1190 via->SetWidth( PADSTACK::ALL_LAYERS, dims.m_Diameter );
1191 via->SetDrill( dims.m_Drill );
1192 break;
1193 }
1194 }
1195 }
1196 }
1197
1198 commit.Push( _( "Increase Via Size" ) );
1199 }
1200 else
1201 {
1202 int sizeIndex = bds.GetNextViaSizeIndex( bds.GetViaSizeIndex(), true );
1203
1204 bds.SetViaSizeIndex( sizeIndex );
1205 bds.UseCustomTrackViaSize( false );
1206
1208 }
1209
1210 return 0;
1211}
1212
1213
1215{
1216 BOARD_DESIGN_SETTINGS& bds = getModel<BOARD>()->GetDesignSettings();
1217 PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1218
1219 if( m_frame->ToolStackIsEmpty()
1220 && SELECTION_CONDITIONS::OnlyTypes( { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T } )( selection ) )
1221 {
1222 BOARD_COMMIT commit( this );
1223
1224 for( EDA_ITEM* item : selection )
1225 {
1226 if( item->Type() == PCB_VIA_T )
1227 {
1228 PCB_VIA* via = static_cast<PCB_VIA*>( item );
1229
1230 for( int i = (int) bds.m_ViasDimensionsList.size() - 1; i >= 0; --i )
1231 {
1234
1235 if( i > 0 )
1236 dims = bds.m_ViasDimensionsList[ i ];
1237
1238 // TODO(JE) padstacks
1239 if( dims.m_Diameter < via->GetWidth( PADSTACK::ALL_LAYERS ) )
1240 {
1241 commit.Modify( via );
1242 via->SetWidth( PADSTACK::ALL_LAYERS, dims.m_Diameter );
1243 via->SetDrill( dims.m_Drill );
1244 break;
1245 }
1246 }
1247 }
1248 }
1249
1250 commit.Push( "Decrease Via Size" );
1251 }
1252 else
1253 {
1254 int sizeIndex = 0; // Assume we only have a single via size entry
1255
1256 // If there are more, cycle through them backwards
1257 if( bds.m_ViasDimensionsList.size() > 0 )
1258 sizeIndex = bds.GetNextViaSizeIndex( bds.GetViaSizeIndex(), false );
1259
1260 bds.SetViaSizeIndex( sizeIndex );
1261 bds.UseCustomTrackViaSize( false );
1262
1264 }
1265
1266 return 0;
1267}
1268
1269
1271{
1272 BOARD_DESIGN_SETTINGS& bds = getModel<BOARD>()->GetDesignSettings();
1273
1274 if( bds.UseCustomTrackViaSize() )
1275 {
1276 bds.UseCustomTrackViaSize( false );
1277 bds.m_UseConnectedTrackWidth = true;
1278 }
1279 else
1280 {
1282 }
1283
1284 return 0;
1285}
1286
1287
1289{
1290 if( m_inPlaceFootprint )
1291 return 0;
1292
1294
1295 FOOTPRINT* fp = aEvent.Parameter<FOOTPRINT*>();
1296 bool fromOtherCommand = fp != nullptr;
1298 BOARD_COMMIT commit( m_frame );
1300 COMMON_SETTINGS* common_settings = Pgm().GetCommonSettings();
1301
1302 m_toolMgr->RunAction( ACTIONS::selectionClear );
1303
1304 TOOL_EVENT pushedEvent = aEvent;
1305 m_frame->PushTool( aEvent );
1306
1307 auto setCursor =
1308 [&]()
1309 {
1310 m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
1311 };
1312
1313 auto cleanup =
1314 [&] ()
1315 {
1316 m_toolMgr->RunAction( ACTIONS::selectionClear );
1317 commit.Revert();
1318
1319 if( fromOtherCommand )
1320 {
1321 PICKED_ITEMS_LIST* undo = m_frame->PopCommandFromUndoList();
1322
1323 if( undo )
1324 {
1325 m_frame->PutDataInPreviousState( undo );
1326 m_frame->ClearListAndDeleteItems( undo );
1327 delete undo;
1328 }
1329 }
1330
1331 fp = nullptr;
1332 m_placingFootprint = false;
1333 };
1334
1335 Activate();
1336 // Must be done after Activate() so that it gets set into the correct context
1337 controls->ShowCursor( true );
1338 // Set initial cursor
1339 setCursor();
1340
1341 VECTOR2I cursorPos = controls->GetCursorPosition();
1342 bool ignorePrimePosition = false;
1343 bool reselect = false;
1344
1345 // Prime the pump
1346 if( fp )
1347 {
1348 m_placingFootprint = true;
1349 fp->SetPosition( cursorPos );
1350 m_toolMgr->RunAction<EDA_ITEM*>( ACTIONS::selectItem, fp );
1351 m_toolMgr->PostAction( ACTIONS::refreshPreview );
1352 }
1353 else if( aEvent.HasPosition() )
1354 {
1355 m_toolMgr->PrimeTool( aEvent.Position() );
1356 }
1357 else if( common_settings->m_Input.immediate_actions && !aEvent.IsReactivate() )
1358 {
1359 m_toolMgr->PrimeTool( { 0, 0 } );
1360 ignorePrimePosition = true;
1361 }
1362
1363 // Main loop: keep receiving events
1364 while( TOOL_EVENT* evt = Wait() )
1365 {
1366 setCursor();
1367 cursorPos = controls->GetCursorPosition( !evt->DisableGridSnapping() );
1368
1369 if( reselect && fp )
1370 m_toolMgr->RunAction<EDA_ITEM*>( ACTIONS::selectItem, fp );
1371
1372 if( evt->IsCancelInteractive() || ( fp && evt->IsAction( &ACTIONS::undo ) ) )
1373 {
1374 if( fp )
1375 {
1376 cleanup();
1377 }
1378 else
1379 {
1380 m_frame->PopTool( pushedEvent );
1381 break;
1382 }
1383 }
1384 else if( evt->IsActivate() )
1385 {
1386 if( fp )
1387 cleanup();
1388
1389 if( evt->IsMoveTool() )
1390 {
1391 // leave ourselves on the stack so we come back after the move
1392 break;
1393 }
1394 else
1395 {
1396 frame()->PopTool( pushedEvent );
1397 break;
1398 }
1399 }
1400 else if( evt->IsClick( BUT_LEFT ) )
1401 {
1402 if( !fp )
1403 {
1404 // Pick the footprint to be placed
1405 fp = m_frame->SelectFootprintFromLibrary();
1406
1407 if( fp == nullptr )
1408 continue;
1409
1410 // If we started with a hotkey which has a position then warp back to that.
1411 // Otherwise update to the current mouse position pinned inside the autoscroll
1412 // boundaries.
1413 if( evt->IsPrime() && !ignorePrimePosition )
1414 {
1415 cursorPos = evt->Position();
1416 getViewControls()->WarpMouseCursor( cursorPos, true );
1417 }
1418 else
1419 {
1421 cursorPos = getViewControls()->GetMousePosition();
1422 }
1423
1424 m_placingFootprint = true;
1425
1426 fp->SetLink( niluuid );
1427
1428 fp->SetFlags( IS_NEW ); // whatever
1429
1430 // Set parent so that clearance can be loaded
1431 fp->SetParent( board );
1432 board->UpdateUserUnits( fp, m_frame->GetCanvas()->GetView() );
1433
1434 for( PAD* pad : fp->Pads() )
1435 {
1436 pad->SetLocalRatsnestVisible( m_frame->GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
1437
1438 // Pads in the library all have orphaned nets. Replace with Default.
1439 pad->SetNetCode( 0 );
1440 }
1441
1442 // Put it on FRONT layer,
1443 // (Can be stored flipped if the lib is an archive built from a board)
1444 if( fp->IsFlipped() )
1445 fp->Flip( fp->GetPosition(), m_frame->GetPcbNewSettings()->m_FlipDirection );
1446
1447 fp->SetOrientation( ANGLE_0 );
1448 fp->SetPosition( cursorPos );
1449
1450 commit.Add( fp );
1451 m_toolMgr->RunAction<EDA_ITEM*>( ACTIONS::selectItem, fp );
1452
1453 m_toolMgr->PostAction( ACTIONS::refreshPreview );
1454 }
1455 else
1456 {
1457 m_toolMgr->RunAction( ACTIONS::selectionClear );
1458 commit.Push( _( "Place Footprint" ) );
1459 fp = nullptr; // to indicate that there is no footprint that we currently modify
1460 m_placingFootprint = false;
1461 }
1462 }
1463 else if( evt->IsClick( BUT_RIGHT ) )
1464 {
1465 m_menu->ShowContextMenu( selection() );
1466 }
1467 else if( fp && ( evt->IsMotion() || evt->IsAction( &ACTIONS::refreshPreview ) ) )
1468 {
1469 fp->SetPosition( cursorPos );
1470 selection().SetReferencePoint( cursorPos );
1471 getView()->Update( &selection() );
1472 getView()->Update( fp );
1473 }
1474 else if( fp && evt->IsAction( &PCB_ACTIONS::properties ) )
1475 {
1476 // Calling 'Properties' action clears the selection, so we need to restore it
1477 reselect = true;
1478 }
1479 else if( fp && ( ZONE_FILLER_TOOL::IsZoneFillAction( evt )
1480 || evt->IsAction( &ACTIONS::redo ) ) )
1481 {
1482 wxBell();
1483 }
1484 else
1485 {
1486 evt->SetPassEvent();
1487 }
1488
1489 // Enable autopanning and cursor capture only when there is a footprint to be placed
1490 controls->SetAutoPan( fp != nullptr );
1491 controls->CaptureCursor( fp != nullptr );
1492 }
1493
1494 controls->SetAutoPan( false );
1495 controls->CaptureCursor( false );
1496 m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
1497
1498 return 0;
1499}
1500
1501
1503{
1504 return modifyLockSelected( TOGGLE );
1505}
1506
1507
1509{
1510 return modifyLockSelected( ON );
1511}
1512
1513
1515{
1516 return modifyLockSelected( OFF );
1517}
1518
1519
1521{
1522 PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
1523
1524 // RequestSelection populates from the cursor when empty and marks it IsHover(), letting us
1525 // clear it afterwards without disturbing a pre-existing selection.
1526 const PCB_SELECTION& selection = selTool->RequestSelection( nullptr );
1527
1528 BOARD_COMMIT commit( m_frame );
1529
1530 if( selection.Empty() )
1531 return 0;
1532
1533 const bool isHover = selection.IsHover();
1534
1535 // Resolve TOGGLE mode
1536 if( aMode == TOGGLE )
1537 {
1538 aMode = ON;
1539
1540 for( EDA_ITEM* item : selection )
1541 {
1542 if( !item->IsBOARD_ITEM() )
1543 continue;
1544
1545 if( static_cast<BOARD_ITEM*>( item )->IsLocked() )
1546 {
1547 aMode = OFF;
1548 break;
1549 }
1550 }
1551 }
1552
1553 for( EDA_ITEM* item : selection )
1554 {
1555 if( !item->IsBOARD_ITEM() )
1556 continue;
1557
1558 BOARD_ITEM* const board_item = static_cast<BOARD_ITEM*>( item );
1559
1560 // Disallow locking free pads - it's confusing and not persisted
1561 // through save/load anyway.
1562 if( board_item->Type() == PCB_PAD_T )
1563 continue;
1564
1565 EDA_GROUP* parent_group = board_item->GetParentGroup();
1566
1567 if( parent_group && parent_group->AsEdaItem()->Type() == PCB_GENERATOR_T )
1568 {
1569 PCB_GENERATOR* generator = static_cast<PCB_GENERATOR*>( parent_group );
1570
1571 if( generator && commit.GetStatus( generator ) != CHT_MODIFY )
1572 {
1573 commit.Modify( generator );
1574
1575 if( aMode == ON )
1576 generator->SetLocked( true );
1577 else
1578 generator->SetLocked( false );
1579 }
1580 }
1581
1582 commit.Modify( board_item );
1583
1584 if( aMode == ON )
1585 board_item->SetLocked( true );
1586 else
1587 board_item->SetLocked( false );
1588
1589 if( aMode == OFF && board_item->Type() == PCB_FOOTPRINT_T )
1590 {
1591 board_item->RunOnChildren(
1592 []( BOARD_ITEM* child )
1593 {
1594 child->SetLocked( false );
1595 },
1597 }
1598 }
1599
1600 if( !commit.Empty() )
1601 {
1602 commit.Push( aMode == ON ? _( "Lock" ) : _( "Unlock" ), SKIP_TEARDROPS );
1603
1604 m_toolMgr->PostEvent( EVENTS::SelectedEvent );
1605 m_frame->OnModify();
1606 }
1607
1608 if( isHover )
1609 m_toolMgr->RunAction( ACTIONS::selectionClear );
1610
1611 return 0;
1612}
1613
1614
1615static bool mergeZones( EDA_DRAW_FRAME* aFrame, BOARD_COMMIT& aCommit,
1616 std::vector<ZONE*>& aOriginZones, std::vector<ZONE*>& aMergedZones )
1617{
1618 aCommit.Modify( aOriginZones[0] );
1619
1620 aOriginZones[0]->Outline()->ClearArcs();
1621
1622 for( unsigned int i = 1; i < aOriginZones.size(); i++ )
1623 {
1624 SHAPE_POLY_SET otherOutline = aOriginZones[i]->Outline()->CloneDropTriangulation();
1625 otherOutline.ClearArcs();
1626 aOriginZones[0]->Outline()->BooleanAdd( otherOutline );
1627 }
1628
1629 aOriginZones[0]->Outline()->Simplify();
1630
1631 // We should have one polygon, possibly with holes. If we end up with two polygons (either
1632 // because the intersection was a single point or because the intersection was within one of
1633 // the zone's holes) then we can't merge.
1634 if( aOriginZones[0]->Outline()->IsSelfIntersecting() || aOriginZones[0]->Outline()->OutlineCount() > 1 )
1635 {
1636 DisplayErrorMessage( aFrame, _( "Zones have insufficient overlap for merging." ) );
1637 aCommit.Revert();
1638 return false;
1639 }
1640
1641 // Adopt the highest priority from all merged zones so the result maintains
1642 // the most aggressive fill ordering.
1643 unsigned highestPriority = aOriginZones[0]->GetAssignedPriority();
1644
1645 for( unsigned int i = 1; i < aOriginZones.size(); i++ )
1646 {
1647 highestPriority = std::max( highestPriority, aOriginZones[i]->GetAssignedPriority() );
1648 aCommit.Remove( aOriginZones[i] );
1649 }
1650
1651 aOriginZones[0]->SetAssignedPriority( highestPriority );
1652
1653 aMergedZones.push_back( aOriginZones[0] );
1654
1655 aOriginZones[0]->SetLocalFlags( 1 );
1656 aOriginZones[0]->HatchBorder();
1657 aOriginZones[0]->CacheTriangulation();
1658
1659 return true;
1660}
1661
1662
1664{
1665 const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1667 BOARD_COMMIT commit( m_frame );
1668
1669 if( selection.Size() < 2 )
1670 return 0;
1671
1672 int netcode = -1;
1673
1674 ZONE* firstZone = nullptr;
1675 std::vector<ZONE*> toMerge, merged;
1676
1677 for( EDA_ITEM* item : selection )
1678 {
1679 ZONE* curr_area = dynamic_cast<ZONE*>( item );
1680
1681 if( !curr_area )
1682 continue;
1683
1684 if( !firstZone )
1685 firstZone = curr_area;
1686
1687 netcode = curr_area->GetNetCode();
1688
1689 if( firstZone->GetNetCode() != netcode )
1690 {
1691 wxLogMessage( _( "Some zone netcodes did not match and were not merged." ) );
1692 continue;
1693 }
1694
1695 if( curr_area->GetIsRuleArea() != firstZone->GetIsRuleArea() )
1696 {
1697 wxLogMessage( _( "Some zones were rule areas and were not merged." ) );
1698 continue;
1699 }
1700
1701 if( curr_area->GetLayerSet() != firstZone->GetLayerSet() )
1702 {
1703 wxLogMessage( _( "Some zone layer sets did not match and were not merged." ) );
1704 continue;
1705 }
1706
1707 bool intersects = curr_area == firstZone;
1708
1709 for( ZONE* candidate : toMerge )
1710 {
1711 if( intersects )
1712 break;
1713
1714 if( board->TestZoneIntersection( curr_area, candidate ) )
1715 intersects = true;
1716 }
1717
1718 if( !intersects )
1719 {
1720 wxLogMessage( _( "Some zones did not intersect and were not merged." ) );
1721 continue;
1722 }
1723
1724 toMerge.push_back( curr_area );
1725 }
1726
1727 m_toolMgr->RunAction( ACTIONS::selectionClear );
1728
1729 if( !toMerge.empty() )
1730 {
1731 if( mergeZones( m_frame, commit, toMerge, merged ) )
1732 {
1733 commit.Push( _( "Merge Zones" ) );
1734
1735 for( EDA_ITEM* item : merged )
1736 m_toolMgr->RunAction( ACTIONS::selectItem, item );
1737 }
1738 }
1739
1740 return 0;
1741}
1742
1743
1745{
1746 PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
1747 const PCB_SELECTION& selection = selTool->GetSelection();
1748
1749 // because this pops up the zone editor, it would be confusing to handle multiple zones,
1750 // so just handle single selections containing exactly one zone
1751 if( selection.Size() != 1 )
1752 return 0;
1753
1754 ZONE* oldZone = dynamic_cast<ZONE*>( selection[0] );
1755
1756 if( !oldZone )
1757 return 0;
1758
1759 ZONE_SETTINGS zoneSettings;
1760 zoneSettings << *oldZone;
1761 int dialogResult;
1762
1763 if( oldZone->GetIsRuleArea() )
1764 dialogResult = InvokeRuleAreaEditor( m_frame, &zoneSettings, board() );
1765 else if( oldZone->IsOnCopperLayer() )
1766 dialogResult = InvokeCopperZonesEditor( m_frame, nullptr, &zoneSettings );
1767 else
1768 dialogResult = InvokeNonCopperZonesEditor( m_frame, &zoneSettings );
1769
1770 if( dialogResult != wxID_OK )
1771 return 0;
1772
1773 // duplicate the zone
1774 BOARD_COMMIT commit( m_frame );
1775
1776 std::unique_ptr<ZONE> newZone = std::make_unique<ZONE>( *oldZone );
1777 newZone->ClearSelected();
1778 newZone->UnFill();
1779 zoneSettings.ExportSetting( *newZone );
1780
1781 if( !newZone->GetZoneName().IsEmpty() )
1782 newZone->SetZoneName( board()->GetUniqueZoneName( newZone->GetZoneName() ) );
1783
1784 // If the new zone is on the same layer(s) as the initial zone,
1785 // offset it a bit so it can more easily be picked.
1786 if( oldZone->GetLayerSet() == zoneSettings.m_Layers )
1787 newZone->Move( VECTOR2I( pcbIUScale.IU_PER_MM, pcbIUScale.IU_PER_MM ) );
1788
1789 commit.Add( newZone.release() );
1790 commit.Push( _( "Duplicate Zone" ) );
1791
1792 return 0;
1793}
1794
1795
1797{
1798 const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1799
1800 if( selection.Size() != 1 )
1801 return 0;
1802
1803 ZONE* zone = dynamic_cast<ZONE*>( selection[0] );
1804
1805 if( !zone || zone->GetIsRuleArea() || zone->IsTeardropArea() )
1806 return 0;
1807
1808 std::vector<ZONE*> overlapping = getOverlappingZones( board(), zone );
1809
1810 unsigned maxOverlapping = zone->GetAssignedPriority();
1811
1812 for( ZONE* other : overlapping )
1813 maxOverlapping = std::max( maxOverlapping, other->GetAssignedPriority() );
1814
1815 if( zone->GetAssignedPriority() >= maxOverlapping )
1816 return 0;
1817
1818 // Two options to place our zone above all overlapping zones.
1819 // Pick whichever viable option displaces fewer other zones.
1820 ZonePriorityMap byPriority = buildPriorityMap( board(), zone );
1821
1822 // Option A: take maxOverlapping, cascade displaced zones down
1823 bool cascadeDownViable = false;
1824 std::vector<ZONE*> cascadeDown =
1825 findCascadeZones( byPriority, maxOverlapping, false, cascadeDownViable );
1826
1827 // Option B: take maxOverlapping + 1, cascade displaced zones up
1828 bool cascadeUpViable = false;
1829 std::vector<ZONE*> cascadeUp;
1830 bool canCascadeUp = ( maxOverlapping < UINT_MAX );
1831
1832 if( canCascadeUp )
1833 cascadeUp = findCascadeZones( byPriority, maxOverlapping + 1, true, cascadeUpViable );
1834
1835 if( !cascadeDownViable && !cascadeUpViable )
1836 return 0;
1837
1838 BOARD_COMMIT commit( m_frame );
1839 commit.Modify( zone );
1840
1841 bool useDown = cascadeDownViable
1842 && ( !cascadeUpViable || cascadeDown.size() <= cascadeUp.size() );
1843
1844 if( useDown )
1845 {
1846 zone->SetAssignedPriority( maxOverlapping );
1847
1848 for( ZONE* z : cascadeDown )
1849 {
1850 commit.Modify( z );
1852 z->SetNeedRefill( true );
1853 }
1854 }
1855 else
1856 {
1857 zone->SetAssignedPriority( maxOverlapping + 1 );
1858
1859 for( ZONE* z : cascadeUp )
1860 {
1861 commit.Modify( z );
1863 z->SetNeedRefill( true );
1864 }
1865 }
1866
1867 zone->SetNeedRefill( true );
1868 commit.Push( _( "Move Zone to Top Priority" ) );
1869
1870 return 0;
1871}
1872
1873
1875{
1876 const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1877
1878 if( selection.Size() != 1 )
1879 return 0;
1880
1881 ZONE* zone = dynamic_cast<ZONE*>( selection[0] );
1882
1883 if( !zone || zone->GetIsRuleArea() || zone->IsTeardropArea() )
1884 return 0;
1885
1886 std::vector<ZONE*> overlapping = getOverlappingZones( board(), zone );
1887
1888 // Find the overlapping zone with the lowest priority still above ours
1889 ZONE* target = nullptr;
1890 unsigned zonePriority = zone->GetAssignedPriority();
1891
1892 for( ZONE* other : overlapping )
1893 {
1894 if( other->GetAssignedPriority() > zonePriority )
1895 {
1896 if( !target || other->GetAssignedPriority() < target->GetAssignedPriority() )
1897 target = other;
1898 }
1899 }
1900
1901 if( !target )
1902 return 0;
1903
1904 BOARD_COMMIT commit( m_frame );
1905 commit.Modify( zone );
1906
1907 // Place our zone just above the target without modifying any other zone
1908 if( target->GetAssignedPriority() < UINT_MAX )
1909 {
1910 zone->SetAssignedPriority( target->GetAssignedPriority() + 1 );
1911 }
1912 else
1913 {
1914 // Can't go above UINT_MAX; swap as last resort
1915 commit.Modify( target );
1916 zone->SetAssignedPriority( UINT_MAX );
1917 target->SetAssignedPriority( zonePriority );
1918 target->SetNeedRefill( true );
1919 }
1920
1921 zone->SetNeedRefill( true );
1922 commit.Push( _( "Raise Zone Priority" ) );
1923
1924 return 0;
1925}
1926
1927
1929{
1930 const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1931
1932 if( selection.Size() != 1 )
1933 return 0;
1934
1935 ZONE* zone = dynamic_cast<ZONE*>( selection[0] );
1936
1937 if( !zone || zone->GetIsRuleArea() || zone->IsTeardropArea() )
1938 return 0;
1939
1940 std::vector<ZONE*> overlapping = getOverlappingZones( board(), zone );
1941
1942 // Find the overlapping zone with the highest priority still below ours
1943 ZONE* target = nullptr;
1944 unsigned zonePriority = zone->GetAssignedPriority();
1945
1946 for( ZONE* other : overlapping )
1947 {
1948 if( other->GetAssignedPriority() < zonePriority )
1949 {
1950 if( !target || other->GetAssignedPriority() > target->GetAssignedPriority() )
1951 target = other;
1952 }
1953 }
1954
1955 if( !target )
1956 return 0;
1957
1958 BOARD_COMMIT commit( m_frame );
1959 commit.Modify( zone );
1960
1961 // Place our zone just below the target without modifying any other zone
1962 if( target->GetAssignedPriority() > 0 )
1963 {
1964 zone->SetAssignedPriority( target->GetAssignedPriority() - 1 );
1965 }
1966 else
1967 {
1968 // Can't go below 0; swap as last resort
1969 commit.Modify( target );
1970 zone->SetAssignedPriority( 0 );
1971 target->SetAssignedPriority( zonePriority );
1972 target->SetNeedRefill( true );
1973 }
1974
1975 zone->SetNeedRefill( true );
1976 commit.Push( _( "Lower Zone Priority" ) );
1977
1978 return 0;
1979}
1980
1981
1983{
1984 const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1985
1986 if( selection.Size() != 1 )
1987 return 0;
1988
1989 ZONE* zone = dynamic_cast<ZONE*>( selection[0] );
1990
1991 if( !zone || zone->GetIsRuleArea() || zone->IsTeardropArea() )
1992 return 0;
1993
1994 std::vector<ZONE*> overlapping = getOverlappingZones( board(), zone );
1995
1996 unsigned minOverlapping = zone->GetAssignedPriority();
1997
1998 for( ZONE* other : overlapping )
1999 minOverlapping = std::min( minOverlapping, other->GetAssignedPriority() );
2000
2001 if( zone->GetAssignedPriority() <= minOverlapping )
2002 return 0;
2003
2004 // Two options to place our zone below all overlapping zones.
2005 // Pick whichever viable option displaces fewer other zones.
2006 ZonePriorityMap byPriority = buildPriorityMap( board(), zone );
2007
2008 // Option A: take minOverlapping, cascade displaced zones up
2009 bool cascadeUpViable = false;
2010 std::vector<ZONE*> cascadeUp =
2011 findCascadeZones( byPriority, minOverlapping, true, cascadeUpViable );
2012
2013 // Option B: take minOverlapping - 1, cascade displaced zones down
2014 bool cascadeDownViable = false;
2015 std::vector<ZONE*> cascadeDown;
2016 bool canCascadeDown = ( minOverlapping > 0 );
2017
2018 if( canCascadeDown )
2019 {
2020 cascadeDown =
2021 findCascadeZones( byPriority, minOverlapping - 1, false, cascadeDownViable );
2022 }
2023
2024 if( !cascadeUpViable && !cascadeDownViable )
2025 return 0;
2026
2027 BOARD_COMMIT commit( m_frame );
2028 commit.Modify( zone );
2029
2030 bool useUp = cascadeUpViable
2031 && ( !cascadeDownViable || cascadeUp.size() <= cascadeDown.size() );
2032
2033 if( useUp )
2034 {
2035 zone->SetAssignedPriority( minOverlapping );
2036
2037 for( ZONE* z : cascadeUp )
2038 {
2039 commit.Modify( z );
2041 z->SetNeedRefill( true );
2042 }
2043 }
2044 else
2045 {
2046 zone->SetAssignedPriority( minOverlapping - 1 );
2047
2048 for( ZONE* z : cascadeDown )
2049 {
2050 commit.Modify( z );
2052 z->SetNeedRefill( true );
2053 }
2054 }
2055
2056 zone->SetNeedRefill( true );
2057 commit.Push( _( "Move Zone to Bottom Priority" ) );
2058
2059 return 0;
2060}
2061
2062
2064{
2065 doCrossProbePcbToSch( aEvent, false );
2066 return 0;
2067}
2068
2069
2071{
2072 doCrossProbePcbToSch( aEvent, true );
2073 return 0;
2074}
2075
2076
2078{
2079 // Don't get in an infinite loop PCB -> SCH -> PCB -> SCH -> ...
2080 if( m_frame->m_ProbingSchToPcb )
2081 return;
2082
2083 PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
2084 const PCB_SELECTION& selection = selTool->GetSelection();
2085 EDA_ITEM* focusItem = nullptr;
2086
2087 if( aEvent.Matches( EVENTS::PointSelectedEvent ) )
2088 focusItem = selection.GetLastAddedItem();
2089
2090 m_frame->SendSelectItemsToSch( selection.GetItems(), focusItem, aForce );
2091
2092 // Update 3D viewer highlighting
2093 m_frame->Update3DView( false, frame()->GetPcbNewSettings()->m_Display.m_Live3DRefresh );
2094}
2095
2096
2098{
2099 PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
2100
2101 const PCB_SELECTION& selection = selectionTool->RequestSelection(
2102 []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
2103 {
2104 // Iterate from the back so we don't have to worry about removals.
2105 for( int i = aCollector.GetCount() - 1; i >= 0; --i )
2106 {
2107 if( !dynamic_cast<BOARD_CONNECTED_ITEM*>( aCollector[ i ] ) )
2108 aCollector.Remove( aCollector[ i ] );
2109 }
2110
2111 sTool->FilterCollectorForLockedItems( aCollector );
2112 } );
2113
2114 if( selectionTool->ReportFilteredLockedItems() )
2115 return 0;
2116
2117 std::set<wxString> netNames;
2118 std::set<int> netCodes;
2119
2120 for( EDA_ITEM* item : selection )
2121 {
2122 const NETINFO_ITEM& net = *static_cast<BOARD_CONNECTED_ITEM*>( item )->GetNet();
2123
2124 if( !net.HasAutoGeneratedNetname() )
2125 {
2126 netNames.insert( net.GetNetname() );
2127 netCodes.insert( net.GetNetCode() );
2128 }
2129 }
2130
2131 if( netNames.empty() )
2132 {
2133 m_frame->ShowInfoBarError( _( "Selection contains no items with labeled nets." ) );
2134 return 0;
2135 }
2136
2137 selectionTool->ClearSelection();
2138 for( const int& code : netCodes )
2139 {
2140 m_toolMgr->RunAction( PCB_ACTIONS::selectNet, code );
2141 }
2142 canvas()->ForceRefresh();
2143
2144 DIALOG_ASSIGN_NETCLASS dlg( m_frame, netNames, board()->GetNetClassAssignmentCandidates(),
2145 [this]( const std::vector<wxString>& aNetNames )
2146 {
2147 PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
2148 selTool->ClearSelection();
2149
2150 for( const wxString& curr_netName : aNetNames )
2151 {
2152 int curr_netCode = board()->GetNetInfo().GetNetItem( curr_netName )->GetNetCode();
2153
2154 if( curr_netCode > 0 )
2155 selTool->SelectAllItemsOnNet( curr_netCode );
2156 }
2157
2158 canvas()->ForceRefresh();
2159 m_frame->UpdateMsgPanel();
2160 } );
2161
2162 if( dlg.ShowModal() == wxID_OK )
2163 {
2165 // Refresh UI that depends on netclasses, such as the properties panel
2167 }
2168
2169 return 0;
2170}
2171
2172
2174{
2175 PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
2176 const PCB_SELECTION& selection = selTool->RequestSelection( EDIT_TOOL::FootprintFilter );
2177
2178 if( selection.Empty() )
2179 {
2180 // Giant hack: by default we assign Edit Table to the same hotkey, so give the table
2181 // tool a chance to handle it if we can't.
2182 if( PCB_EDIT_TABLE_TOOL* tableTool = m_toolMgr->GetTool<PCB_EDIT_TABLE_TOOL>() )
2183 tableTool->EditTable( aEvent );
2184
2185 return 0;
2186 }
2187
2188 FOOTPRINT* fp = selection.FirstOfKind<FOOTPRINT>();
2189
2190 if( !fp )
2191 return 0;
2192
2194
2195 if( KIWAY_PLAYER* frame = editFrame->Kiway().Player( FRAME_FOOTPRINT_EDITOR, true ) )
2196 {
2197 FOOTPRINT_EDIT_FRAME* fp_editor = static_cast<FOOTPRINT_EDIT_FRAME*>( frame );
2198
2200 fp_editor->LoadFootprintFromBoard( fp );
2201 else if( aEvent.IsAction( &PCB_ACTIONS::editLibFpInFpEditor ) )
2202 fp_editor->LoadFootprintFromLibrary( fp->GetFPID() );
2203
2204 fp_editor->Show( true );
2205 fp_editor->Raise(); // Iconize( false );
2206 }
2207
2208 if( selection.IsHover() )
2209 m_toolMgr->RunAction( ACTIONS::selectionClear );
2210
2211 return 0;
2212}
2213
2214
2216 EDA_ITEM* originViewItem, const VECTOR2D& aPosition )
2217{
2218 aFrame->GetDesignSettings().SetAuxOrigin( VECTOR2I( aPosition ) );
2219 originViewItem->SetPosition( aPosition );
2220 aView->MarkDirty();
2221 aFrame->OnModify();
2222}
2223
2224
2226{
2228 {
2229 m_frame->SaveCopyInUndoList( m_placeOrigin.get(), UNDO_REDO::GRIDORIGIN );
2231 return 0;
2232 }
2233
2234 if( aEvent.IsAction( &PCB_ACTIONS::drillSetOrigin ) )
2235 {
2236 VECTOR2I origin = aEvent.Parameter<VECTOR2I>();
2237 m_frame->SaveCopyInUndoList( m_placeOrigin.get(), UNDO_REDO::GRIDORIGIN );
2238 DoSetDrillOrigin( getView(), m_frame, m_placeOrigin.get(), origin );
2239 return 0;
2240 }
2241
2242 PCB_PICKER_TOOL* picker = m_toolMgr->GetTool<PCB_PICKER_TOOL>();
2243
2244 // Deactivate other tools; particularly important if another PICKER is currently running
2245 Activate();
2246
2247 picker->SetCursor( KICURSOR::PLACE );
2248 picker->ClearHandlers();
2249
2250 picker->SetClickHandler(
2251 [this] ( const VECTOR2D& pt ) -> bool
2252 {
2253 m_frame->SaveCopyInUndoList( m_placeOrigin.get(), UNDO_REDO::DRILLORIGIN );
2255 return false; // drill origin is a one-shot; don't continue with tool
2256 } );
2257
2258 m_toolMgr->RunAction( ACTIONS::pickerTool, &aEvent );
2259
2260 return 0;
2261}
2262
2263
2265{
2274
2280
2287
2288 if( ADVANCED_CFG::GetCfg().m_ShowPcbnewExportNetlist && m_frame && m_frame->GetExportNetlistAction() )
2289 Go( &BOARD_EDITOR_CONTROL::ExportNetlist, m_frame->GetExportNetlistAction()->MakeEvent() );
2290
2299
2306
2307 // Track & via size control
2313
2314 // Zone actions
2321
2322 // Placing tools
2327
2330
2331 // Cross-select
2337
2338 // Other
2342
2344
2355 // Line modes: explicit, next, and notification
2360}
const char * name
constexpr EDA_IU_SCALE pcbIUScale
Definition base_units.h:121
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
#define SKIP_TEARDROPS
static bool mergeZones(EDA_DRAW_FRAME *aFrame, BOARD_COMMIT &aCommit, std::vector< ZONE * > &aOriginZones, std::vector< ZONE * > &aMergedZones)
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
static TOOL_ACTION updatePcbFromSchematic
Definition actions.h:260
static TOOL_ACTION cancelInteractive
Definition actions.h:68
static TOOL_ACTION revert
Definition actions.h:58
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
Definition actions.h:223
static TOOL_ACTION saveAs
Definition actions.h:55
static TOOL_ACTION pickerTool
Definition actions.h:249
static TOOL_ACTION findPrevious
Definition actions.h:116
static TOOL_ACTION plot
Definition actions.h:61
static TOOL_ACTION open
Definition actions.h:53
static TOOL_ACTION findNext
Definition actions.h:115
static TOOL_ACTION pageSettings
Definition actions.h:59
static TOOL_ACTION showSearch
Definition actions.h:112
static TOOL_ACTION undo
Definition actions.h:71
static TOOL_ACTION save
Definition actions.h:54
static TOOL_ACTION redo
Definition actions.h:72
static TOOL_ACTION updateSchematicFromPcb
Definition actions.h:261
static TOOL_ACTION selectionClear
Clear the current selection.
Definition actions.h:220
static TOOL_ACTION showProperties
Definition actions.h:262
static TOOL_ACTION doNew
Definition actions.h:50
static TOOL_ACTION saveCopy
Definition actions.h:56
static TOOL_ACTION refreshPreview
Definition actions.h:155
static TOOL_ACTION find
Definition actions.h:113
ACTION_MENU(bool isContextMenu, TOOL_INTERACTIVE *aTool=nullptr)
Default constructor.
TOOL_MANAGER * getToolManager() const
Return an instance of TOOL_MANAGER class.
void SetTitle(const wxString &aTitle) override
Set title for the menu.
void SetIcon(BITMAPS aIcon)
Assign an icon for the entry.
wxMenuItem * Add(const wxString &aLabel, int aId, BITMAPS aIcon)
Add a wxWidgets-style entry to the menu.
friend class TOOL_INTERACTIVE
TOOL_INTERACTIVE * m_tool
Creator of the menu.
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:81
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
virtual void Revert() 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.
std::shared_ptr< NET_SETTINGS > m_NetSettings
int GetNextDiffPairIndex(int aIndex, bool aForward) const
Compute the next diff pair dimensions list index when cycling predefined sizes, skipping the index-0 ...
void SetViaSizeIndex(int aIndex)
Set the current via size list index to aIndex.
int GetNextTrackWidthIndex(int aIndex, bool aForward) const
Compute the next track width list index when cycling predefined sizes, skipping the index-0 netclass ...
void SetAuxOrigin(const VECTOR2I &aOrigin)
void SetTrackWidthIndex(int aIndex)
Set the current track width list index to aIndex.
void UseCustomDiffPairDimensions(bool aEnabled)
Enables/disables custom differential pair dimensions.
int GetNextViaSizeIndex(int aIndex, bool aForward) const
Compute the next via size list index when cycling predefined sizes, skipping the index-0 netclass pla...
std::vector< int > m_TrackWidthList
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 ZonePriorityMoveToTop(const TOOL_EVENT &aEvent)
int GenBOMFileFromBoard(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 ExportFootprints(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 ZonePriorityRaise(const TOOL_EVENT &aEvent)
int ExplicitCrossProbeToSch(const TOOL_EVENT &aEvent)
Assign a netclass to a labelled net.
int ExportHyperlynx(const TOOL_EVENT &aEvent)
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 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 ZonePriorityLower(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)
int GenerateODBPPFiles(const TOOL_EVENT &aEvent)
int ToggleLockSelected(const TOOL_EVENT &aEvent)
Lock selected items.
int ToggleConstraintsPanel(const TOOL_EVENT &aEvent)
int AutoTrackWidth(const TOOL_EVENT &aEvent)
int LockSelected(const TOOL_EVENT &aEvent)
Unlock selected items.
int PageSettings(const TOOL_EVENT &aEvent)
int ExportSpecctraDSN(const TOOL_EVENT &aEvent)
int FindByProperties(const TOOL_EVENT &aEvent)
int FindNext(const TOOL_EVENT &aEvent)
int ToggleLibraryTree(const TOOL_EVENT &aEvent)
int ExportGenCAD(const TOOL_EVENT &aEvent)
Export GenCAD 1.4 format.
int ViaSizeInc(const TOOL_EVENT &aEvent)
int New(const TOOL_EVENT &aEvent)
int OnAngleSnapModeChanged(const TOOL_EVENT &aEvent)
int ExportCmpFile(const TOOL_EVENT &aEvent)
int Find(const TOOL_EVENT &aEvent)
int GenFootprintsReport(const TOOL_EVENT &aEvent)
void doCrossProbePcbToSch(const TOOL_EVENT &aEvent, bool aForce)
int GenD356File(const TOOL_EVENT &aEvent)
int Plot(const TOOL_EVENT &aEvent)
int ExportIDF(const TOOL_EVENT &aEvent)
int TrackWidthDec(const TOOL_EVENT &aEvent)
int Revert(const TOOL_EVENT &aEvent)
int Search(const TOOL_EVENT &aEvent)
int GenIPC2581File(const TOOL_EVENT &aEvent)
int ExportVRML(const TOOL_EVENT &aEvent)
int Open(const TOOL_EVENT &aEvent)
int SaveCopy(const TOOL_EVENT &aEvent)
int ChangeLineMode(const TOOL_EVENT &aEvent)
int GeneratePosFile(const TOOL_EVENT &aEvent)
int EditFpInFpEditor(const TOOL_EVENT &aEvent)
Notify Eeschema about selected items.
int ZonePriorityMoveToBottom(const TOOL_EVENT &aEvent)
int GenerateGerbers(const TOOL_EVENT &aEvent)
int ToggleProperties(const TOOL_EVENT &aEvent)
int OpenNonKicadBoard(const TOOL_EVENT &aEvent)
int ExportSTEP(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:83
void SetLocked(bool aLocked) override
Definition board_item.h:386
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
virtual void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction, RECURSE_MODE aMode) const
Invoke a function on all children.
Definition board_item.h:233
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:373
const NETINFO_LIST & GetNetInfo() const
Definition board.h:1098
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition board.cpp:1355
const ZONES & Zones() const
Definition board.h:425
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
Definition board.cpp:3164
int RepairDuplicateItemUuids()
Rebind duplicate attached-item UUIDs so each live board item has a unique ID.
Definition board.cpp:2222
int GetCount() const
Return the number of objects in the list.
Definition collector.h:79
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
Definition collector.h:107
COMMIT & Remove(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Remove a new item from the model.
Definition commit.h:86
bool Empty() const
Definition commit.h:134
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
Definition commit.h:102
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Add a new item to the model.
Definition commit.h:74
int GetStatus(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Returns status of an item.
Definition commit.cpp:191
Store all of the related component information found in a netlist.
void AddNet(const wxString &aPinName, const wxString &aNetName, const wxString &aPinFunction, const wxString &aPinType)
void SetFields(nlohmann::ordered_map< wxString, wxString > aFields)
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.
CONDITIONAL_MENU(TOOL_INTERACTIVE *aTool)
void SetWksFileName(const wxString &aFilename)
A dialog to set the plot options and create plot files in various formats.
Definition dialog_plot.h:37
int ShowModal() override
Tool responsible for drawing graphical elements like lines, arcs, circles, etc.
MODE GetDrawingMode() const
Return the current drawing mode of the DRAWING_TOOL or MODE::NONE if not currently in any drawing mod...
void SelectToolbarAction(const TOOL_ACTION &aAction)
Select the given action in the toolbar group which contains it, if any.
The base class for create windows for drawing purpose.
void ForceRefresh()
Force a redraw.
A set of EDA_ITEMs (i.e., without duplicates).
Definition eda_group.h:42
virtual EDA_ITEM * AsEdaItem()=0
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:96
virtual void SetPosition(const VECTOR2I &aPos)
Definition eda_item.h:283
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition eda_item.h:152
virtual EDA_GROUP * GetParentGroup() const
Definition eda_item.h:114
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:108
virtual void SetParent(EDA_ITEM *aParent)
Definition eda_item.cpp:89
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition eda_text.h:89
static const TOOL_EVENT ClearedEvent
Definition actions.h:345
static const TOOL_EVENT SelectedEvent
Definition actions.h:343
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition actions.h:350
static const TOOL_EVENT PointSelectedEvent
Definition actions.h:342
static const TOOL_EVENT UnselectedEvent
Definition actions.h:344
Used for text file output.
Definition richio.h:470
bool Finish() override
Flushes the temp file to disk and atomically renames it over the final target path.
Definition richio.cpp:636
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
void SetLink(const KIID &aLink)
Definition footprint.h:1192
void SetOrientation(const EDA_ANGLE &aNewAngle)
std::deque< PAD * > & Pads()
Definition footprint.h:375
bool IsFlipped() const
Definition footprint.h:617
const LIB_ID & GetFPID() const
Definition footprint.h:444
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
VECTOR2I GetPosition() const override
Definition footprint.h:406
Used when the right click button is pressed, or when the select tool is in effect.
Definition collectors.h:203
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
An interface for classes handling user events controlling the view behavior such as zooming,...
virtual void WarpMouseCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
If enabled (.
virtual VECTOR2D GetMousePosition(bool aWorldCoordinates=true) const =0
Return the current mouse pointer position.
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:82
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:63
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition view.cpp:300
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition view.cpp:404
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:1835
void MarkDirty()
Force redraw of view on the next rendering.
Definition view.h:677
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.
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition kiway.cpp:388
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)
int GetViaDiameter() const
Definition netclass.h:139
int GetViaDrill() const
Definition netclass.h:147
int GetTrackWidth() const
Definition netclass.h:131
Handle the data for a net.
Definition netinfo.h:46
const wxString & GetNetname() const
Definition netinfo.h:100
int GetNetCode() const
Definition netinfo.h:94
bool HasAutoGeneratedNetname() const
NETINFO_ITEM * GetNetItem(int aNetCode) const
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
std::shared_ptr< NETCLASS > GetDefaultNetclass() const
Gets the default netclass for the project.
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
Definition padstack.h:177
Definition pad.h:61
static TOOL_ACTION lineModeFree
Unconstrained angle mode (icon lines_any)
static TOOL_ACTION showConstraintsPanel
Toggle the docked constraints pane (board editor).
static TOOL_ACTION zonesManager
static TOOL_ACTION generateBOM
static TOOL_ACTION exportGenCAD
static TOOL_ACTION zoneFillAll
static TOOL_ACTION showLayersManager
static TOOL_ACTION trackWidthDec
static TOOL_ACTION generateDrillFiles
static TOOL_ACTION exportVRML
static TOOL_ACTION generateD356File
static TOOL_ACTION exportCmpFile
static TOOL_ACTION trackViaSizeChanged
static TOOL_ACTION exportSpecctraDSN
static TOOL_ACTION trackWidthInc
static TOOL_ACTION autoTrackWidth
static TOOL_ACTION generateIPC2581File
static TOOL_ACTION getAndPlace
Find an item and start moving.
static TOOL_ACTION generateODBPPFile
static TOOL_ACTION drawZoneCutout
static TOOL_ACTION openNonKicadBoard
static TOOL_ACTION viaSizeDec
static TOOL_ACTION zoneFill
static TOOL_ACTION properties
Activation of the edit tool.
static TOOL_ACTION editFpInFpEditor
static TOOL_ACTION toggleLock
static TOOL_ACTION drillResetOrigin
static TOOL_ACTION lineMode45
45-degree-or-orthogonal mode (icon hv45mode)
static TOOL_ACTION zonePriorityMoveToBottom
static TOOL_ACTION zonePriorityMoveToTop
static TOOL_ACTION viaSizeInc
static TOOL_ACTION angleSnapModeChanged
Notification event when angle mode changes.
static TOOL_ACTION zoneUnfill
static TOOL_ACTION generatePosFile
static TOOL_ACTION drillOrigin
static TOOL_ACTION assignNetClass
static TOOL_ACTION repairBoard
static TOOL_ACTION exportSTEP
static TOOL_ACTION showNetInspector
static TOOL_ACTION findByProperties
Find items by property criteria or expression.
static TOOL_ACTION generateGerbers
static TOOL_ACTION generateReportFile
static TOOL_ACTION exportHyperlynx
static TOOL_ACTION zonePriorityLower
static TOOL_ACTION exportIDF
static TOOL_ACTION zoneDuplicate
Duplicate zone onto another layer.
static TOOL_ACTION importNetlist
static TOOL_ACTION drawSimilarZone
static TOOL_ACTION boardSetup
static TOOL_ACTION showEeschema
static TOOL_ACTION showDesignBlockPanel
static TOOL_ACTION zoneUnfillAll
static TOOL_ACTION selectNet
Select all connections belonging to a single net.
Definition pcb_actions.h:80
static TOOL_ACTION lineMode90
90-degree-only mode (icon lines90)
static TOOL_ACTION editLibFpInFpEditor
static TOOL_ACTION zoneMerge
static TOOL_ACTION drillSetOrigin
static TOOL_ACTION unlock
static TOOL_ACTION exportFootprints
static TOOL_ACTION placeFootprint
static TOOL_ACTION zonePriorityRaise
static TOOL_ACTION importSpecctraSession
static TOOL_ACTION selectOnSchematic
Select symbols/pins on schematic corresponding to selected footprints/pads.
static TOOL_ACTION lock
Common, abstract interface for edit frames.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
void OnModify() override
Must be called after a change in order to set the "modify" flag and update other data structures and ...
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Return the BOARD_DESIGN_SETTINGS for the open project.
The main frame for Pcbnew.
void SetLocked(bool aLocked) override
Generic tool for picking an item.
Parameters and options when plotting/printing a board.
void SetFormat(PLOT_FORMAT aFormat)
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)
Return the current selection, filtered according to aClientFilter.
bool ReportFilteredLockedItems()
If the most recent FilterCollectorForLockedItems call filtered a locked item, show an InfoBar warning...
int ClearSelection(const TOOL_EVENT &aEvent)
PCB_SELECTION & GetSelection()
void FilterCollectorForLockedItems(GENERAL_COLLECTOR &aCollector)
In the PCB editor strip out any locked items unless the OverrideLocks checkbox is set.
void SelectAllItemsOnNet(int aNetCode, bool aSelect=true)
Select all items with the given net code.
T * frame() const
KIGFX::VIEW_CONTROLS * controls() const
PCB_TOOL_BASE(TOOL_ID aId, const std::string &aName)
Constructor.
BOARD * board() const
PCB_DRAW_PANEL_GAL * canvas() const
const PCB_SELECTION & selection() const
FOOTPRINT * footprint() const
virtual void SetWidth(int aWidth)
Definition pcb_track.h:86
virtual int GetWidth() const
Definition pcb_track.h:87
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition pgm_base.cpp:562
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:77
void SetCursor(KICURSOR aCursor)
Definition picker_tool.h:60
ROUTER_MODE Mode() const
Definition pns_router.h:158
RouterState GetState() const
Definition pns_router.h:160
ROUTER * Router() const
Container for project specific data.
Definition project.h:63
virtual void OnSave(wxCommandEvent &aEvent)=0
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.
int Size() const
Returns the number of selected parts.
Definition selection.h:120
void SetReferencePoint(const VECTOR2I &aP)
Represent a set of closed polygons.
void ClearArcs()
Removes all arc references from all the outlines and holes in the polyset.
bool Collide(const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance,...
int TotalVertices() const
Return total number of vertices stored in the set.
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the index-th vertex in a given hole outline within a given outline.
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1, int aAccuracy=0, bool aUseBBoxCaches=false) const
Return true if a given subpolygon contains the point aP.
T * getEditFrame() const
Return the application window object, casted to requested user type.
Definition tool_base.h:182
T * getModel() const
Return the model object if it matches the requested type.
Definition tool_base.h:195
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition tool_base.cpp:40
TOOL_MANAGER * m_toolMgr
Definition tool_base.h:220
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition tool_base.cpp:34
bool IsToolActive() const
Definition tool_base.cpp:28
RESET_REASON
Determine the reason of reset for a tool.
Definition tool_base.h:74
@ REDRAW
Full drawing refresh.
Definition tool_base.h:79
@ MODEL_RELOAD
Model changes (the sheet for a schematic)
Definition tool_base.h:76
@ GAL_SWITCH
Rendering engine changes.
Definition tool_base.h:78
Generic, UI-independent tool event.
Definition tool_event.h:167
bool HasPosition() const
Returns if it this event has a valid position (true for mouse events and context-menu or hotkey-based...
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:388
const VECTOR2D Position() const
Return mouse cursor position in world coordinates.
Definition tool_event.h:289
bool IsReactivate() const
Control whether the tool is first being pushed to the stack or being reactivated after a pause.
Definition tool_event.h:269
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
T Parameter() const
Return a parameter assigned to the event.
Definition tool_event.h:469
void RunMainStack(std::function< void()> aFunc)
Call a function using the main stack.
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()
std::unique_ptr< 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.
Manage a CONDITIONAL_MENU and some number of CONTEXT_MENUs as sub-menus.
Definition tool_menu.h:39
CONDITIONAL_MENU & GetMenu()
Definition tool_menu.cpp:40
void RegisterSubMenu(std::shared_ptr< ACTION_MENU > aSubMenu)
Store a submenu of this menu model.
Definition tool_menu.cpp:46
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)
ACTION_MENU * create() const override
Return an instance of this class. It has to be overridden in inheriting classes.
void update() override
Update menu state stub.
ZONE_SETTINGS handles zones parameters.
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:70
void SetNeedRefill(bool aNeedRefill)
Definition zone.h:310
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition zone.h:813
const BOX2I GetBoundingBox() const override
Definition zone.cpp:766
SHAPE_POLY_SET GetBoardOutline() const
Definition zone.cpp:874
bool IsTeardropArea() const
Definition zone.h:788
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition zone.h:133
bool IsOnCopperLayer() const override
Definition zone.cpp:594
void SetAssignedPriority(unsigned aPriority)
Definition zone.h:117
unsigned GetAssignedPriority() const
Definition zone.h:122
@ CHT_MODIFY
Definition commit.h:40
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition confirm.cpp:245
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:217
This file is part of the common library.
@ PLACE
Definition cursors.h:94
@ ARROW
Definition cursors.h:42
@ PENCIL
Definition cursors.h:48
int InvokeCopperZonesEditor(PCB_BASE_FRAME *aCaller, ZONE *aZone, 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, BOARD *aBoard, 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:411
@ RECURSE
Definition eda_item.h:49
#define IS_NEW
New item, just created.
KiCad executable names.
const wxString EESCHEMA_EXE
@ FRAME_SCH
Definition frame_type.h:30
@ FRAME_FOOTPRINT_EDITOR
Definition frame_type.h:39
LEADER_MODE
The kind of the leader line.
@ DEG45
45 Degree only
@ DIRECT
Unconstrained point-to-point.
@ DEG90
90 Degree only
int ExecuteFile(const wxString &aEditorName, const wxString &aFileName, wxProcess *aCallback, bool aFileForKicad)
Call the executable file aEditorName with the parameter aFileName.
Definition gestfich.cpp:161
static const std::string LegacySchematicFileExtension
static const std::string KiCadSchematicFileExtension
static const std::string SpecctraDsnFileExtension
static const std::string SpecctraSessionFileExtension
static wxString SpecctraSessionFileWildcard()
static wxString SpecctraDsnFileWildcard()
KIID niluuid(0)
@ MAIL_SCH_UPDATE
Definition mail_type.h:44
@ REPAINT
Item needs to be redrawn.
Definition view_item.h:54
@ GEOMETRY
Position or shape has changed.
Definition view_item.h:51
void AllowNetworkFileSystems(wxDialog *aDialog)
Configure a file dialog to show network and virtual file systems.
Definition wxgtk/ui.cpp:521
@ PNS_MODE_ROUTE_DIFF_PAIR
Definition pns_router.h:69
#define MAX_PAGE_SIZE_PCBNEW_MILS
Definition page_info.h:31
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE
@ LAST_PATH_SPECCTRADSN
T * GetAppSettings(const char *aFilename)
std::vector< FAB_LAYER_COLOR > dummy
Container to handle a stock of specific vias each with unique diameter and drill sizes in the BOARD c...
std::string netlist
std::string path
wxString result
Test unit parsing edge cases and error handling.
@ BUT_LEFT
Definition tool_event.h:128
@ BUT_RIGHT
Definition tool_event.h:129
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
Definition typeinfo.h:84
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition typeinfo.h:90
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition typeinfo.h:79
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition typeinfo.h:80
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683
VECTOR2< double > VECTOR2D
Definition vector2d.h:682
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.