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