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 FILE_OUTPUTFORMATTER formatter( fn.GetFullPath() );
729
730 netlist.Format( "pcb_netlist", &formatter, 0, noh->GetNetlistOptions() );
731
732 return 0;
733}
734
735
737{
738 PCB_PLOT_PARAMS plotSettings = m_frame->GetPlotSettings();
739
740 plotSettings.SetFormat( PLOT_FORMAT::GERBER );
741
742 m_frame->SetPlotSettings( plotSettings );
743
744 DIALOG_PLOT dlg( m_frame );
745 dlg.ShowQuasiModal( );
746
747 return 0;
748}
749
750
752{
753 int errors = 0;
754 wxString details;
755 bool quiet = aEvent.Parameter<bool>();
756
757 int duplicates = board()->RepairDuplicateItemUuids();
758
759 if( duplicates )
760 {
761 errors += duplicates;
762 details += wxString::Format( _( "%d duplicate IDs replaced.\n" ), duplicates );
763 }
764
765 for( FOOTPRINT* footprint : board()->Footprints() )
766 {
767 for( PAD* pad : footprint->Pads() )
768 {
769 BOARD_CONNECTED_ITEM* cItem = pad;
770
771 if( cItem->GetNetCode() )
772 {
773 NETINFO_ITEM* netinfo = cItem->GetNet();
774
775 if( netinfo && !board()->FindNet( netinfo->GetNetname() ) )
776 {
777 board()->Add( netinfo );
778
779 details += wxString::Format( _( "Orphaned net %s re-parented.\n" ),
780 netinfo->GetNetname() );
781 errors++;
782 }
783 }
784 }
785 }
786
787 for( PCB_TRACK* track : board()->Tracks() )
788 {
789 BOARD_CONNECTED_ITEM* cItem = track;
790
791 if( cItem->GetNetCode() )
792 {
793 NETINFO_ITEM* netinfo = cItem->GetNet();
794
795 if( netinfo && !board()->FindNet( netinfo->GetNetname() ) )
796 {
797 board()->Add( netinfo );
798
799 details += wxString::Format( _( "Orphaned net %s re-parented.\n" ),
800 netinfo->GetNetname() );
801 errors++;
802 }
803 }
804 }
805
806 /*******************************
807 * Your test here
808 */
809
810 /*******************************
811 * Inform the user
812 */
813
814 if( errors )
815 {
816 m_frame->OnModify();
817
818 wxString msg = wxString::Format( _( "%d potential problems repaired." ), errors );
819
820 if( !quiet )
821 DisplayInfoMessage( m_frame, msg, details );
822 }
823 else if( !quiet )
824 {
825 DisplayInfoMessage( m_frame, _( "No board problems found." ) );
826 }
827
828 return 0;
829}
830
831
833{
835 bool fetched = false;
836
838 [&]()
839 {
840 fetched = m_frame->FetchNetlistFromSchematic(
841 netlist, _( "Updating PCB requires a fully annotated schematic." ) );
842 } );
843
844 if( fetched )
845 {
846 DIALOG_UPDATE_PCB updateDialog( m_frame, &netlist );
847 updateDialog.ShowModal();
848 }
849
850 return 0;
851}
852
854{
855 if( Kiface().IsSingle() )
856 {
857 DisplayErrorMessage( m_frame, _( "Cannot update schematic because Pcbnew is opened in "
858 "stand-alone mode. In order to create or update PCBs "
859 "from schematics, you must launch the KiCad project "
860 "manager and create a project." ) );
861 return 0;
862 }
863
866
867 KIWAY_PLAYER* frame = m_frame->Kiway().Player( FRAME_SCH, false );
868
869 if( frame )
870 {
871 std::string payload;
872
873 if( wxWindow* blocking_win = frame->Kiway().GetBlockingDialog() )
874 blocking_win->Close( true );
875
876 m_frame->Kiway().ExpressMail( FRAME_SCH, MAIL_SCH_UPDATE, payload, m_frame );
877 }
878 return 0;
879}
880
881
883{
884 wxString msg;
885 PCB_EDIT_FRAME* boardFrame = m_frame;
886 PROJECT& project = boardFrame->Prj();
887 wxFileName schematic( project.GetProjectPath(), project.GetProjectName(),
889
890 if( !schematic.FileExists() )
891 {
892 wxFileName legacySchematic( project.GetProjectPath(), project.GetProjectName(),
894
895 if( legacySchematic.FileExists() )
896 {
897 schematic = legacySchematic;
898 }
899 else
900 {
901 msg.Printf( _( "Schematic file '%s' not found." ), schematic.GetFullPath() );
903 return 0;
904 }
905 }
906
907 if( Kiface().IsSingle() )
908 {
909 ExecuteFile( EESCHEMA_EXE, schematic.GetFullPath() );
910 }
911 else
912 {
914 [&]()
915 {
916 KIWAY_PLAYER* frame = m_frame->Kiway().Player( FRAME_SCH, false );
917
918 // Please: note: DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers() calls
919 // Kiway.Player( FRAME_SCH, true )
920 // therefore, the schematic editor is sometimes running, but the schematic project
921 // is not loaded, if the library editor was called, and the dialog field editor was used.
922 // On Linux, it happens the first time the schematic editor is launched, if
923 // library editor was running, and the dialog field editor was open
924 // On Windows, it happens always after the library editor was called,
925 // and the dialog field editor was used
926 if( !frame )
927 {
928 try
929 {
930 frame = boardFrame->Kiway().Player( FRAME_SCH, true );
931 }
932 catch( const IO_ERROR& err )
933 {
934 DisplayErrorMessage( boardFrame,
935 _( "Eeschema failed to load." ) + wxS( "\n" ) + err.What() );
936 return;
937 }
938 }
939
940 wxEventBlocker blocker( boardFrame );
941
942 // If Kiway() cannot create the eeschema frame, it shows a error message, and
943 // frame is null
944 if( !frame )
945 return;
946
947 if( !frame->IsShownOnScreen() ) // the frame exists, (created by the dialog field editor)
948 // but no project loaded.
949 {
950 frame->OpenProjectFiles( std::vector<wxString>( 1, schematic.GetFullPath() ) );
951 frame->Show( true );
952 }
953
954 // On Windows, Raise() does not bring the window on screen, when iconized or not shown
955 // On Linux, Raise() brings the window on screen, but this code works fine
956 if( frame->IsIconized() )
957 {
958 frame->Iconize( false );
959
960 // If an iconized frame was created by Pcbnew, Iconize( false ) is not enough
961 // to show the frame at its normal size: Maximize should be called.
962 frame->Maximize( false );
963 }
964
965 frame->Raise();
966 } );
967 }
968
969 return 0;
970}
971
972
974{
975 getEditFrame<PCB_EDIT_FRAME>()->ToggleLayersManager();
976 return 0;
977}
978
979
981{
982 getEditFrame<PCB_EDIT_FRAME>()->ToggleProperties();
983 return 0;
984}
985
986
988{
989 getEditFrame<PCB_EDIT_FRAME>()->ToggleNetInspector();
990 return 0;
991}
992
993
995{
996 getEditFrame<PCB_EDIT_FRAME>()->ToggleLibraryTree();
997 return 0;
998}
999
1000
1002{
1003 getEditFrame<PCB_EDIT_FRAME>()->ToggleSearch();
1004 return 0;
1005}
1006
1007
1008// Track & via size control
1010{
1011 BOARD_DESIGN_SETTINGS& bds = getModel<BOARD>()->GetDesignSettings();
1012 PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1013
1014 if( m_frame->ToolStackIsEmpty()
1015 && SELECTION_CONDITIONS::OnlyTypes( { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T } )( selection ) )
1016 {
1017 BOARD_COMMIT commit( this );
1018
1019 for( EDA_ITEM* item : selection )
1020 {
1021 if( item->IsType( { PCB_TRACE_T, PCB_ARC_T } ) )
1022 {
1023 PCB_TRACK* track = static_cast<PCB_TRACK*>( item );
1024
1025 for( int i = 0; i < (int) bds.m_TrackWidthList.size(); ++i )
1026 {
1027 int candidate = bds.m_NetSettings->GetDefaultNetclass()->GetTrackWidth();
1028
1029 if( i > 0 )
1030 candidate = bds.m_TrackWidthList[ i ];
1031
1032 if( candidate > track->GetWidth() )
1033 {
1034 commit.Modify( track );
1035 track->SetWidth( candidate );
1036 break;
1037 }
1038 }
1039 }
1040 }
1041
1042 commit.Push( _( "Increase Track Width" ) );
1043 return 0;
1044 }
1045
1046 ROUTER_TOOL* routerTool = m_toolMgr->GetTool<ROUTER_TOOL>();
1047
1048 if( routerTool && routerTool->IsToolActive()
1049 && routerTool->Router()->Mode() == PNS::PNS_MODE_ROUTE_DIFF_PAIR )
1050 {
1051 int widthIndex = bds.GetDiffPairIndex() + 1;
1052
1053 // If we go past the last track width entry in the list, start over at the beginning
1054 if( widthIndex >= (int) bds.m_DiffPairDimensionsList.size() )
1055 widthIndex = 0;
1056
1057 bds.SetDiffPairIndex( widthIndex );
1058 bds.UseCustomDiffPairDimensions( false );
1059
1061 }
1062 else
1063 {
1064 int widthIndex = bds.GetTrackWidthIndex();
1065
1066 if( routerTool && routerTool->IsToolActive()
1069 {
1070 bds.m_TempOverrideTrackWidth = true;
1071 }
1072 else
1073 {
1074 widthIndex++;
1075 }
1076
1077 // If we go past the last track width entry in the list, start over at the beginning
1078 if( widthIndex >= (int) bds.m_TrackWidthList.size() )
1079 widthIndex = 0;
1080
1081 bds.SetTrackWidthIndex( widthIndex );
1082 bds.UseCustomTrackViaSize( false );
1083
1085 }
1086
1087 return 0;
1088}
1089
1090
1092{
1093 BOARD_DESIGN_SETTINGS& bds = getModel<BOARD>()->GetDesignSettings();
1094 PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1095
1096 if( m_frame->ToolStackIsEmpty()
1097 && SELECTION_CONDITIONS::OnlyTypes( { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T } )( selection ) )
1098 {
1099 BOARD_COMMIT commit( this );
1100
1101 for( EDA_ITEM* item : selection )
1102 {
1103 if( item->IsType( { PCB_TRACE_T, PCB_ARC_T } ) )
1104 {
1105 PCB_TRACK* track = static_cast<PCB_TRACK*>( item );
1106
1107 for( int i = (int) bds.m_TrackWidthList.size() - 1; i >= 0; --i )
1108 {
1109 int candidate = bds.m_NetSettings->GetDefaultNetclass()->GetTrackWidth();
1110
1111 if( i > 0 )
1112 candidate = bds.m_TrackWidthList[ i ];
1113
1114 if( candidate < track->GetWidth() )
1115 {
1116 commit.Modify( track );
1117 track->SetWidth( candidate );
1118 break;
1119 }
1120 }
1121 }
1122 }
1123
1124 commit.Push( _( "Decrease Track Width" ) );
1125 return 0;
1126 }
1127
1128 ROUTER_TOOL* routerTool = m_toolMgr->GetTool<ROUTER_TOOL>();
1129
1130 if( routerTool && routerTool->IsToolActive()
1131 && routerTool->Router()->Mode() == PNS::PNS_MODE_ROUTE_DIFF_PAIR )
1132 {
1133 int widthIndex = bds.GetDiffPairIndex() - 1;
1134
1135 // If we get to the lowest entry start over at the highest
1136 if( widthIndex < 0 )
1137 widthIndex = bds.m_DiffPairDimensionsList.size() - 1;
1138
1139 bds.SetDiffPairIndex( widthIndex );
1140 bds.UseCustomDiffPairDimensions( false );
1141
1143 }
1144 else
1145 {
1146 int widthIndex = bds.GetTrackWidthIndex();
1147
1148 if( routerTool && routerTool->IsToolActive()
1151 {
1152 bds.m_TempOverrideTrackWidth = true;
1153 }
1154 else
1155 {
1156 widthIndex--;
1157 }
1158
1159 // If we get to the lowest entry start over at the highest
1160 if( widthIndex < 0 )
1161 widthIndex = (int) bds.m_TrackWidthList.size() - 1;
1162
1163 bds.SetTrackWidthIndex( widthIndex );
1164 bds.UseCustomTrackViaSize( false );
1165
1167 }
1168
1169 return 0;
1170}
1171
1172
1174{
1175 BOARD_DESIGN_SETTINGS& bds = getModel<BOARD>()->GetDesignSettings();
1176 PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1177
1178 if( m_frame->ToolStackIsEmpty()
1179 && SELECTION_CONDITIONS::OnlyTypes( { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T } )( selection ) )
1180 {
1181 BOARD_COMMIT commit( this );
1182
1183 for( EDA_ITEM* item : selection )
1184 {
1185 if( item->Type() == PCB_VIA_T )
1186 {
1187 PCB_VIA* via = static_cast<PCB_VIA*>( item );
1188
1189 for( int i = 0; i < (int) bds.m_ViasDimensionsList.size(); ++i )
1190 {
1193
1194 if( i> 0 )
1195 dims = bds.m_ViasDimensionsList[ i ];
1196
1197 // TODO(JE) padstacks
1198 if( dims.m_Diameter > via->GetWidth( PADSTACK::ALL_LAYERS ) )
1199 {
1200 commit.Modify( via );
1201 via->SetWidth( PADSTACK::ALL_LAYERS, dims.m_Diameter );
1202 via->SetDrill( dims.m_Drill );
1203 break;
1204 }
1205 }
1206 }
1207 }
1208
1209 commit.Push( _( "Increase Via Size" ) );
1210 }
1211 else
1212 {
1213 int sizeIndex = bds.GetViaSizeIndex() + 1;
1214
1215 // If we go past the last via entry in the list, start over at the beginning
1216 if( sizeIndex >= (int) bds.m_ViasDimensionsList.size() )
1217 sizeIndex = 0;
1218
1219 bds.SetViaSizeIndex( sizeIndex );
1220 bds.UseCustomTrackViaSize( false );
1221
1223 }
1224
1225 return 0;
1226}
1227
1228
1230{
1231 BOARD_DESIGN_SETTINGS& bds = getModel<BOARD>()->GetDesignSettings();
1232 PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1233
1234 if( m_frame->ToolStackIsEmpty()
1235 && SELECTION_CONDITIONS::OnlyTypes( { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T } )( selection ) )
1236 {
1237 BOARD_COMMIT commit( this );
1238
1239 for( EDA_ITEM* item : selection )
1240 {
1241 if( item->Type() == PCB_VIA_T )
1242 {
1243 PCB_VIA* via = static_cast<PCB_VIA*>( item );
1244
1245 for( int i = (int) bds.m_ViasDimensionsList.size() - 1; i >= 0; --i )
1246 {
1249
1250 if( i > 0 )
1251 dims = bds.m_ViasDimensionsList[ i ];
1252
1253 // TODO(JE) padstacks
1254 if( dims.m_Diameter < via->GetWidth( PADSTACK::ALL_LAYERS ) )
1255 {
1256 commit.Modify( via );
1257 via->SetWidth( PADSTACK::ALL_LAYERS, dims.m_Diameter );
1258 via->SetDrill( dims.m_Drill );
1259 break;
1260 }
1261 }
1262 }
1263 }
1264
1265 commit.Push( "Decrease Via Size" );
1266 }
1267 else
1268 {
1269 int sizeIndex = 0; // Assume we only have a single via size entry
1270
1271 // If there are more, cycle through them backwards
1272 if( bds.m_ViasDimensionsList.size() > 0 )
1273 {
1274 sizeIndex = bds.GetViaSizeIndex() - 1;
1275
1276 // If we get to the lowest entry start over at the highest
1277 if( sizeIndex < 0 )
1278 sizeIndex = bds.m_ViasDimensionsList.size() - 1;
1279 }
1280
1281 bds.SetViaSizeIndex( sizeIndex );
1282 bds.UseCustomTrackViaSize( false );
1283
1285 }
1286
1287 return 0;
1288}
1289
1290
1292{
1293 BOARD_DESIGN_SETTINGS& bds = getModel<BOARD>()->GetDesignSettings();
1294
1295 if( bds.UseCustomTrackViaSize() )
1296 {
1297 bds.UseCustomTrackViaSize( false );
1298 bds.m_UseConnectedTrackWidth = true;
1299 }
1300 else
1301 {
1303 }
1304
1305 return 0;
1306}
1307
1308
1310{
1311 if( m_inPlaceFootprint )
1312 return 0;
1313
1315
1316 FOOTPRINT* fp = aEvent.Parameter<FOOTPRINT*>();
1317 bool fromOtherCommand = fp != nullptr;
1319 BOARD_COMMIT commit( m_frame );
1321 COMMON_SETTINGS* common_settings = Pgm().GetCommonSettings();
1322
1323 m_toolMgr->RunAction( ACTIONS::selectionClear );
1324
1325 TOOL_EVENT pushedEvent = aEvent;
1326 m_frame->PushTool( aEvent );
1327
1328 auto setCursor =
1329 [&]()
1330 {
1331 m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
1332 };
1333
1334 auto cleanup =
1335 [&] ()
1336 {
1337 m_toolMgr->RunAction( ACTIONS::selectionClear );
1338 commit.Revert();
1339
1340 if( fromOtherCommand )
1341 {
1342 PICKED_ITEMS_LIST* undo = m_frame->PopCommandFromUndoList();
1343
1344 if( undo )
1345 {
1346 m_frame->PutDataInPreviousState( undo );
1347 m_frame->ClearListAndDeleteItems( undo );
1348 delete undo;
1349 }
1350 }
1351
1352 fp = nullptr;
1353 m_placingFootprint = false;
1354 };
1355
1356 Activate();
1357 // Must be done after Activate() so that it gets set into the correct context
1358 controls->ShowCursor( true );
1359 // Set initial cursor
1360 setCursor();
1361
1362 VECTOR2I cursorPos = controls->GetCursorPosition();
1363 bool ignorePrimePosition = false;
1364 bool reselect = false;
1365
1366 // Prime the pump
1367 if( fp )
1368 {
1369 m_placingFootprint = true;
1370 fp->SetPosition( cursorPos );
1371 m_toolMgr->RunAction<EDA_ITEM*>( ACTIONS::selectItem, fp );
1372 m_toolMgr->PostAction( ACTIONS::refreshPreview );
1373 }
1374 else if( aEvent.HasPosition() )
1375 {
1376 m_toolMgr->PrimeTool( aEvent.Position() );
1377 }
1378 else if( common_settings->m_Input.immediate_actions && !aEvent.IsReactivate() )
1379 {
1380 m_toolMgr->PrimeTool( { 0, 0 } );
1381 ignorePrimePosition = true;
1382 }
1383
1384 // Main loop: keep receiving events
1385 while( TOOL_EVENT* evt = Wait() )
1386 {
1387 setCursor();
1388 cursorPos = controls->GetCursorPosition( !evt->DisableGridSnapping() );
1389
1390 if( reselect && fp )
1391 m_toolMgr->RunAction<EDA_ITEM*>( ACTIONS::selectItem, fp );
1392
1393 if( evt->IsCancelInteractive() || ( fp && evt->IsAction( &ACTIONS::undo ) ) )
1394 {
1395 if( fp )
1396 {
1397 cleanup();
1398 }
1399 else
1400 {
1401 m_frame->PopTool( pushedEvent );
1402 break;
1403 }
1404 }
1405 else if( evt->IsActivate() )
1406 {
1407 if( fp )
1408 cleanup();
1409
1410 if( evt->IsMoveTool() )
1411 {
1412 // leave ourselves on the stack so we come back after the move
1413 break;
1414 }
1415 else
1416 {
1417 frame()->PopTool( pushedEvent );
1418 break;
1419 }
1420 }
1421 else if( evt->IsClick( BUT_LEFT ) )
1422 {
1423 if( !fp )
1424 {
1425 // Pick the footprint to be placed
1426 fp = m_frame->SelectFootprintFromLibrary();
1427
1428 if( fp == nullptr )
1429 continue;
1430
1431 // If we started with a hotkey which has a position then warp back to that.
1432 // Otherwise update to the current mouse position pinned inside the autoscroll
1433 // boundaries.
1434 if( evt->IsPrime() && !ignorePrimePosition )
1435 {
1436 cursorPos = evt->Position();
1437 getViewControls()->WarpMouseCursor( cursorPos, true );
1438 }
1439 else
1440 {
1442 cursorPos = getViewControls()->GetMousePosition();
1443 }
1444
1445 m_placingFootprint = true;
1446
1447 fp->SetLink( niluuid );
1448
1449 fp->SetFlags( IS_NEW ); // whatever
1450
1451 // Set parent so that clearance can be loaded
1452 fp->SetParent( board );
1453 board->UpdateUserUnits( fp, m_frame->GetCanvas()->GetView() );
1454
1455 for( PAD* pad : fp->Pads() )
1456 {
1457 pad->SetLocalRatsnestVisible( m_frame->GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
1458
1459 // Pads in the library all have orphaned nets. Replace with Default.
1460 pad->SetNetCode( 0 );
1461 }
1462
1463 // Put it on FRONT layer,
1464 // (Can be stored flipped if the lib is an archive built from a board)
1465 if( fp->IsFlipped() )
1466 fp->Flip( fp->GetPosition(), m_frame->GetPcbNewSettings()->m_FlipDirection );
1467
1468 fp->SetOrientation( ANGLE_0 );
1469 fp->SetPosition( cursorPos );
1470
1471 commit.Add( fp );
1472 m_toolMgr->RunAction<EDA_ITEM*>( ACTIONS::selectItem, fp );
1473
1474 m_toolMgr->PostAction( ACTIONS::refreshPreview );
1475 }
1476 else
1477 {
1478 m_toolMgr->RunAction( ACTIONS::selectionClear );
1479 commit.Push( _( "Place Footprint" ) );
1480 fp = nullptr; // to indicate that there is no footprint that we currently modify
1481 m_placingFootprint = false;
1482 }
1483 }
1484 else if( evt->IsClick( BUT_RIGHT ) )
1485 {
1486 m_menu->ShowContextMenu( selection() );
1487 }
1488 else if( fp && ( evt->IsMotion() || evt->IsAction( &ACTIONS::refreshPreview ) ) )
1489 {
1490 fp->SetPosition( cursorPos );
1491 selection().SetReferencePoint( cursorPos );
1492 getView()->Update( &selection() );
1493 getView()->Update( fp );
1494 }
1495 else if( fp && evt->IsAction( &PCB_ACTIONS::properties ) )
1496 {
1497 // Calling 'Properties' action clears the selection, so we need to restore it
1498 reselect = true;
1499 }
1500 else if( fp && ( ZONE_FILLER_TOOL::IsZoneFillAction( evt )
1501 || evt->IsAction( &ACTIONS::redo ) ) )
1502 {
1503 wxBell();
1504 }
1505 else
1506 {
1507 evt->SetPassEvent();
1508 }
1509
1510 // Enable autopanning and cursor capture only when there is a footprint to be placed
1511 controls->SetAutoPan( fp != nullptr );
1512 controls->CaptureCursor( fp != nullptr );
1513 }
1514
1515 controls->SetAutoPan( false );
1516 controls->CaptureCursor( false );
1517 m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
1518
1519 return 0;
1520}
1521
1522
1524{
1525 return modifyLockSelected( TOGGLE );
1526}
1527
1528
1530{
1531 return modifyLockSelected( ON );
1532}
1533
1534
1536{
1537 return modifyLockSelected( OFF );
1538}
1539
1540
1542{
1543 PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
1544 const PCB_SELECTION& selection = selTool->GetSelection();
1545 BOARD_COMMIT commit( m_frame );
1546
1547 if( selection.Empty() )
1548 m_toolMgr->RunAction( ACTIONS::selectionCursor );
1549
1550 // Resolve TOGGLE mode
1551 if( aMode == TOGGLE )
1552 {
1553 aMode = ON;
1554
1555 for( EDA_ITEM* item : selection )
1556 {
1557 if( !item->IsBOARD_ITEM() )
1558 continue;
1559
1560 if( static_cast<BOARD_ITEM*>( item )->IsLocked() )
1561 {
1562 aMode = OFF;
1563 break;
1564 }
1565 }
1566 }
1567
1568 for( EDA_ITEM* item : selection )
1569 {
1570 if( !item->IsBOARD_ITEM() )
1571 continue;
1572
1573 BOARD_ITEM* const board_item = static_cast<BOARD_ITEM*>( item );
1574
1575 // Disallow locking free pads - it's confusing and not persisted
1576 // through save/load anyway.
1577 if( board_item->Type() == PCB_PAD_T )
1578 continue;
1579
1580 EDA_GROUP* parent_group = board_item->GetParentGroup();
1581
1582 if( parent_group && parent_group->AsEdaItem()->Type() == PCB_GENERATOR_T )
1583 {
1584 PCB_GENERATOR* generator = static_cast<PCB_GENERATOR*>( parent_group );
1585
1586 if( generator && commit.GetStatus( generator ) != CHT_MODIFY )
1587 {
1588 commit.Modify( generator );
1589
1590 if( aMode == ON )
1591 generator->SetLocked( true );
1592 else
1593 generator->SetLocked( false );
1594 }
1595 }
1596
1597 commit.Modify( board_item );
1598
1599 if( aMode == ON )
1600 board_item->SetLocked( true );
1601 else
1602 board_item->SetLocked( false );
1603 }
1604
1605 if( !commit.Empty() )
1606 {
1607 commit.Push( aMode == ON ? _( "Lock" ) : _( "Unlock" ), SKIP_TEARDROPS );
1608
1609 m_toolMgr->PostEvent( EVENTS::SelectedEvent );
1610 m_frame->OnModify();
1611 }
1612
1613 return 0;
1614}
1615
1616
1617static bool mergeZones( EDA_DRAW_FRAME* aFrame, BOARD_COMMIT& aCommit,
1618 std::vector<ZONE*>& aOriginZones, std::vector<ZONE*>& aMergedZones )
1619{
1620 aCommit.Modify( aOriginZones[0] );
1621
1622 aOriginZones[0]->Outline()->ClearArcs();
1623
1624 for( unsigned int i = 1; i < aOriginZones.size(); i++ )
1625 {
1626 SHAPE_POLY_SET otherOutline = aOriginZones[i]->Outline()->CloneDropTriangulation();
1627 otherOutline.ClearArcs();
1628 aOriginZones[0]->Outline()->BooleanAdd( otherOutline );
1629 }
1630
1631 aOriginZones[0]->Outline()->Simplify();
1632
1633 // We should have one polygon, possibly with holes. If we end up with two polygons (either
1634 // because the intersection was a single point or because the intersection was within one of
1635 // the zone's holes) then we can't merge.
1636 if( aOriginZones[0]->Outline()->IsSelfIntersecting() || aOriginZones[0]->Outline()->OutlineCount() > 1 )
1637 {
1638 DisplayErrorMessage( aFrame, _( "Zones have insufficient overlap for merging." ) );
1639 aCommit.Revert();
1640 return false;
1641 }
1642
1643 // Adopt the highest priority from all merged zones so the result maintains
1644 // the most aggressive fill ordering.
1645 unsigned highestPriority = aOriginZones[0]->GetAssignedPriority();
1646
1647 for( unsigned int i = 1; i < aOriginZones.size(); i++ )
1648 {
1649 highestPriority = std::max( highestPriority, aOriginZones[i]->GetAssignedPriority() );
1650 aCommit.Remove( aOriginZones[i] );
1651 }
1652
1653 aOriginZones[0]->SetAssignedPriority( highestPriority );
1654
1655 aMergedZones.push_back( aOriginZones[0] );
1656
1657 aOriginZones[0]->SetLocalFlags( 1 );
1658 aOriginZones[0]->HatchBorder();
1659 aOriginZones[0]->CacheTriangulation();
1660
1661 return true;
1662}
1663
1664
1666{
1667 const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1669 BOARD_COMMIT commit( m_frame );
1670
1671 if( selection.Size() < 2 )
1672 return 0;
1673
1674 int netcode = -1;
1675
1676 ZONE* firstZone = nullptr;
1677 std::vector<ZONE*> toMerge, merged;
1678
1679 for( EDA_ITEM* item : selection )
1680 {
1681 ZONE* curr_area = dynamic_cast<ZONE*>( item );
1682
1683 if( !curr_area )
1684 continue;
1685
1686 if( !firstZone )
1687 firstZone = curr_area;
1688
1689 netcode = curr_area->GetNetCode();
1690
1691 if( firstZone->GetNetCode() != netcode )
1692 {
1693 wxLogMessage( _( "Some zone netcodes did not match and were not merged." ) );
1694 continue;
1695 }
1696
1697 if( curr_area->GetIsRuleArea() != firstZone->GetIsRuleArea() )
1698 {
1699 wxLogMessage( _( "Some zones were rule areas and were not merged." ) );
1700 continue;
1701 }
1702
1703 if( curr_area->GetLayerSet() != firstZone->GetLayerSet() )
1704 {
1705 wxLogMessage( _( "Some zone layer sets did not match and were not merged." ) );
1706 continue;
1707 }
1708
1709 bool intersects = curr_area == firstZone;
1710
1711 for( ZONE* candidate : toMerge )
1712 {
1713 if( intersects )
1714 break;
1715
1716 if( board->TestZoneIntersection( curr_area, candidate ) )
1717 intersects = true;
1718 }
1719
1720 if( !intersects )
1721 {
1722 wxLogMessage( _( "Some zones did not intersect and were not merged." ) );
1723 continue;
1724 }
1725
1726 toMerge.push_back( curr_area );
1727 }
1728
1729 m_toolMgr->RunAction( ACTIONS::selectionClear );
1730
1731 if( !toMerge.empty() )
1732 {
1733 if( mergeZones( m_frame, commit, toMerge, merged ) )
1734 {
1735 commit.Push( _( "Merge Zones" ) );
1736
1737 for( EDA_ITEM* item : merged )
1738 m_toolMgr->RunAction( ACTIONS::selectItem, item );
1739 }
1740 }
1741
1742 return 0;
1743}
1744
1745
1747{
1748 PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
1749 const PCB_SELECTION& selection = selTool->GetSelection();
1750
1751 // because this pops up the zone editor, it would be confusing to handle multiple zones,
1752 // so just handle single selections containing exactly one zone
1753 if( selection.Size() != 1 )
1754 return 0;
1755
1756 ZONE* oldZone = dynamic_cast<ZONE*>( selection[0] );
1757
1758 if( !oldZone )
1759 return 0;
1760
1761 ZONE_SETTINGS zoneSettings;
1762 zoneSettings << *oldZone;
1763 int dialogResult;
1764
1765 if( oldZone->GetIsRuleArea() )
1766 dialogResult = InvokeRuleAreaEditor( m_frame, &zoneSettings, board() );
1767 else if( oldZone->IsOnCopperLayer() )
1768 dialogResult = InvokeCopperZonesEditor( m_frame, nullptr, &zoneSettings );
1769 else
1770 dialogResult = InvokeNonCopperZonesEditor( m_frame, &zoneSettings );
1771
1772 if( dialogResult != wxID_OK )
1773 return 0;
1774
1775 // duplicate the zone
1776 BOARD_COMMIT commit( m_frame );
1777
1778 std::unique_ptr<ZONE> newZone = std::make_unique<ZONE>( *oldZone );
1779 newZone->ClearSelected();
1780 newZone->UnFill();
1781 zoneSettings.ExportSetting( *newZone );
1782
1783 // If the new zone is on the same layer(s) as the initial zone,
1784 // offset it a bit so it can more easily be picked.
1785 if( oldZone->GetLayerSet() == zoneSettings.m_Layers )
1786 newZone->Move( VECTOR2I( pcbIUScale.IU_PER_MM, pcbIUScale.IU_PER_MM ) );
1787
1788 commit.Add( newZone.release() );
1789 commit.Push( _( "Duplicate Zone" ) );
1790
1791 return 0;
1792}
1793
1794
1796{
1797 const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1798
1799 if( selection.Size() != 1 )
1800 return 0;
1801
1802 ZONE* zone = dynamic_cast<ZONE*>( selection[0] );
1803
1804 if( !zone || zone->GetIsRuleArea() || zone->IsTeardropArea() )
1805 return 0;
1806
1807 std::vector<ZONE*> overlapping = getOverlappingZones( board(), zone );
1808
1809 unsigned maxOverlapping = zone->GetAssignedPriority();
1810
1811 for( ZONE* other : overlapping )
1812 maxOverlapping = std::max( maxOverlapping, other->GetAssignedPriority() );
1813
1814 if( zone->GetAssignedPriority() >= maxOverlapping )
1815 return 0;
1816
1817 // Two options to place our zone above all overlapping zones.
1818 // Pick whichever viable option displaces fewer other zones.
1819 ZonePriorityMap byPriority = buildPriorityMap( board(), zone );
1820
1821 // Option A: take maxOverlapping, cascade displaced zones down
1822 bool cascadeDownViable = false;
1823 std::vector<ZONE*> cascadeDown =
1824 findCascadeZones( byPriority, maxOverlapping, false, cascadeDownViable );
1825
1826 // Option B: take maxOverlapping + 1, cascade displaced zones up
1827 bool cascadeUpViable = false;
1828 std::vector<ZONE*> cascadeUp;
1829 bool canCascadeUp = ( maxOverlapping < UINT_MAX );
1830
1831 if( canCascadeUp )
1832 cascadeUp = findCascadeZones( byPriority, maxOverlapping + 1, true, cascadeUpViable );
1833
1834 if( !cascadeDownViable && !cascadeUpViable )
1835 return 0;
1836
1837 BOARD_COMMIT commit( m_frame );
1838 commit.Modify( zone );
1839
1840 bool useDown = cascadeDownViable
1841 && ( !cascadeUpViable || cascadeDown.size() <= cascadeUp.size() );
1842
1843 if( useDown )
1844 {
1845 zone->SetAssignedPriority( maxOverlapping );
1846
1847 for( ZONE* z : cascadeDown )
1848 {
1849 commit.Modify( z );
1851 z->SetNeedRefill( true );
1852 }
1853 }
1854 else
1855 {
1856 zone->SetAssignedPriority( maxOverlapping + 1 );
1857
1858 for( ZONE* z : cascadeUp )
1859 {
1860 commit.Modify( z );
1862 z->SetNeedRefill( true );
1863 }
1864 }
1865
1866 zone->SetNeedRefill( true );
1867 commit.Push( _( "Move Zone to Top Priority" ) );
1868
1869 return 0;
1870}
1871
1872
1874{
1875 const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1876
1877 if( selection.Size() != 1 )
1878 return 0;
1879
1880 ZONE* zone = dynamic_cast<ZONE*>( selection[0] );
1881
1882 if( !zone || zone->GetIsRuleArea() || zone->IsTeardropArea() )
1883 return 0;
1884
1885 std::vector<ZONE*> overlapping = getOverlappingZones( board(), zone );
1886
1887 // Find the overlapping zone with the lowest priority still above ours
1888 ZONE* target = nullptr;
1889 unsigned zonePriority = zone->GetAssignedPriority();
1890
1891 for( ZONE* other : overlapping )
1892 {
1893 if( other->GetAssignedPriority() > zonePriority )
1894 {
1895 if( !target || other->GetAssignedPriority() < target->GetAssignedPriority() )
1896 target = other;
1897 }
1898 }
1899
1900 if( !target )
1901 return 0;
1902
1903 BOARD_COMMIT commit( m_frame );
1904 commit.Modify( zone );
1905
1906 // Place our zone just above the target without modifying any other zone
1907 if( target->GetAssignedPriority() < UINT_MAX )
1908 {
1909 zone->SetAssignedPriority( target->GetAssignedPriority() + 1 );
1910 }
1911 else
1912 {
1913 // Can't go above UINT_MAX; swap as last resort
1914 commit.Modify( target );
1915 zone->SetAssignedPriority( UINT_MAX );
1916 target->SetAssignedPriority( zonePriority );
1917 target->SetNeedRefill( true );
1918 }
1919
1920 zone->SetNeedRefill( true );
1921 commit.Push( _( "Raise Zone Priority" ) );
1922
1923 return 0;
1924}
1925
1926
1928{
1929 const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1930
1931 if( selection.Size() != 1 )
1932 return 0;
1933
1934 ZONE* zone = dynamic_cast<ZONE*>( selection[0] );
1935
1936 if( !zone || zone->GetIsRuleArea() || zone->IsTeardropArea() )
1937 return 0;
1938
1939 std::vector<ZONE*> overlapping = getOverlappingZones( board(), zone );
1940
1941 // Find the overlapping zone with the highest priority still below ours
1942 ZONE* target = nullptr;
1943 unsigned zonePriority = zone->GetAssignedPriority();
1944
1945 for( ZONE* other : overlapping )
1946 {
1947 if( other->GetAssignedPriority() < zonePriority )
1948 {
1949 if( !target || other->GetAssignedPriority() > target->GetAssignedPriority() )
1950 target = other;
1951 }
1952 }
1953
1954 if( !target )
1955 return 0;
1956
1957 BOARD_COMMIT commit( m_frame );
1958 commit.Modify( zone );
1959
1960 // Place our zone just below the target without modifying any other zone
1961 if( target->GetAssignedPriority() > 0 )
1962 {
1963 zone->SetAssignedPriority( target->GetAssignedPriority() - 1 );
1964 }
1965 else
1966 {
1967 // Can't go below 0; swap as last resort
1968 commit.Modify( target );
1969 zone->SetAssignedPriority( 0 );
1970 target->SetAssignedPriority( zonePriority );
1971 target->SetNeedRefill( true );
1972 }
1973
1974 zone->SetNeedRefill( true );
1975 commit.Push( _( "Lower Zone Priority" ) );
1976
1977 return 0;
1978}
1979
1980
1982{
1983 const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1984
1985 if( selection.Size() != 1 )
1986 return 0;
1987
1988 ZONE* zone = dynamic_cast<ZONE*>( selection[0] );
1989
1990 if( !zone || zone->GetIsRuleArea() || zone->IsTeardropArea() )
1991 return 0;
1992
1993 std::vector<ZONE*> overlapping = getOverlappingZones( board(), zone );
1994
1995 unsigned minOverlapping = zone->GetAssignedPriority();
1996
1997 for( ZONE* other : overlapping )
1998 minOverlapping = std::min( minOverlapping, other->GetAssignedPriority() );
1999
2000 if( zone->GetAssignedPriority() <= minOverlapping )
2001 return 0;
2002
2003 // Two options to place our zone below all overlapping zones.
2004 // Pick whichever viable option displaces fewer other zones.
2005 ZonePriorityMap byPriority = buildPriorityMap( board(), zone );
2006
2007 // Option A: take minOverlapping, cascade displaced zones up
2008 bool cascadeUpViable = false;
2009 std::vector<ZONE*> cascadeUp =
2010 findCascadeZones( byPriority, minOverlapping, true, cascadeUpViable );
2011
2012 // Option B: take minOverlapping - 1, cascade displaced zones down
2013 bool cascadeDownViable = false;
2014 std::vector<ZONE*> cascadeDown;
2015 bool canCascadeDown = ( minOverlapping > 0 );
2016
2017 if( canCascadeDown )
2018 {
2019 cascadeDown =
2020 findCascadeZones( byPriority, minOverlapping - 1, false, cascadeDownViable );
2021 }
2022
2023 if( !cascadeUpViable && !cascadeDownViable )
2024 return 0;
2025
2026 BOARD_COMMIT commit( m_frame );
2027 commit.Modify( zone );
2028
2029 bool useUp = cascadeUpViable
2030 && ( !cascadeDownViable || cascadeUp.size() <= cascadeDown.size() );
2031
2032 if( useUp )
2033 {
2034 zone->SetAssignedPriority( minOverlapping );
2035
2036 for( ZONE* z : cascadeUp )
2037 {
2038 commit.Modify( z );
2040 z->SetNeedRefill( true );
2041 }
2042 }
2043 else
2044 {
2045 zone->SetAssignedPriority( minOverlapping - 1 );
2046
2047 for( ZONE* z : cascadeDown )
2048 {
2049 commit.Modify( z );
2051 z->SetNeedRefill( true );
2052 }
2053 }
2054
2055 zone->SetNeedRefill( true );
2056 commit.Push( _( "Move Zone to Bottom Priority" ) );
2057
2058 return 0;
2059}
2060
2061
2063{
2064 doCrossProbePcbToSch( aEvent, false );
2065 return 0;
2066}
2067
2068
2070{
2071 doCrossProbePcbToSch( aEvent, true );
2072 return 0;
2073}
2074
2075
2077{
2078 // Don't get in an infinite loop PCB -> SCH -> PCB -> SCH -> ...
2079 if( m_frame->m_ProbingSchToPcb )
2080 return;
2081
2082 PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
2083 const PCB_SELECTION& selection = selTool->GetSelection();
2084 EDA_ITEM* focusItem = nullptr;
2085
2086 if( aEvent.Matches( EVENTS::PointSelectedEvent ) )
2087 focusItem = selection.GetLastAddedItem();
2088
2089 m_frame->SendSelectItemsToSch( selection.GetItems(), focusItem, aForce );
2090
2091 // Update 3D viewer highlighting
2092 m_frame->Update3DView( false, frame()->GetPcbNewSettings()->m_Display.m_Live3DRefresh );
2093}
2094
2095
2097{
2098 PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
2099
2100 const PCB_SELECTION& selection = selectionTool->RequestSelection(
2101 []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
2102 {
2103 // Iterate from the back so we don't have to worry about removals.
2104 for( int i = aCollector.GetCount() - 1; i >= 0; --i )
2105 {
2106 if( !dynamic_cast<BOARD_CONNECTED_ITEM*>( aCollector[ i ] ) )
2107 aCollector.Remove( aCollector[ i ] );
2108 }
2109
2110 sTool->FilterCollectorForLockedItems( aCollector );
2111 } );
2112
2113 std::set<wxString> netNames;
2114 std::set<int> netCodes;
2115
2116 for( EDA_ITEM* item : selection )
2117 {
2118 const NETINFO_ITEM& net = *static_cast<BOARD_CONNECTED_ITEM*>( item )->GetNet();
2119
2120 if( !net.HasAutoGeneratedNetname() )
2121 {
2122 netNames.insert( net.GetNetname() );
2123 netCodes.insert( net.GetNetCode() );
2124 }
2125 }
2126
2127 if( netNames.empty() )
2128 {
2129 m_frame->ShowInfoBarError( _( "Selection contains no items with labeled nets." ) );
2130 return 0;
2131 }
2132
2133 selectionTool->ClearSelection();
2134 for( const int& code : netCodes )
2135 {
2136 m_toolMgr->RunAction( PCB_ACTIONS::selectNet, code );
2137 }
2138 canvas()->ForceRefresh();
2139
2140 DIALOG_ASSIGN_NETCLASS dlg( m_frame, netNames, board()->GetNetClassAssignmentCandidates(),
2141 [this]( const std::vector<wxString>& aNetNames )
2142 {
2143 PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
2144 selTool->ClearSelection();
2145
2146 for( const wxString& curr_netName : aNetNames )
2147 {
2148 int curr_netCode = board()->GetNetInfo().GetNetItem( curr_netName )->GetNetCode();
2149
2150 if( curr_netCode > 0 )
2151 selTool->SelectAllItemsOnNet( curr_netCode );
2152 }
2153
2154 canvas()->ForceRefresh();
2155 m_frame->UpdateMsgPanel();
2156 } );
2157
2158 if( dlg.ShowModal() == wxID_OK )
2159 {
2161 // Refresh UI that depends on netclasses, such as the properties panel
2163 }
2164
2165 return 0;
2166}
2167
2168
2170{
2171 PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
2172 const PCB_SELECTION& selection = selTool->RequestSelection( EDIT_TOOL::FootprintFilter );
2173
2174 if( selection.Empty() )
2175 {
2176 // Giant hack: by default we assign Edit Table to the same hotkey, so give the table
2177 // tool a chance to handle it if we can't.
2178 if( PCB_EDIT_TABLE_TOOL* tableTool = m_toolMgr->GetTool<PCB_EDIT_TABLE_TOOL>() )
2179 tableTool->EditTable( aEvent );
2180
2181 return 0;
2182 }
2183
2184 FOOTPRINT* fp = selection.FirstOfKind<FOOTPRINT>();
2185
2186 if( !fp )
2187 return 0;
2188
2190
2191 if( KIWAY_PLAYER* frame = editFrame->Kiway().Player( FRAME_FOOTPRINT_EDITOR, true ) )
2192 {
2193 FOOTPRINT_EDIT_FRAME* fp_editor = static_cast<FOOTPRINT_EDIT_FRAME*>( frame );
2194
2196 fp_editor->LoadFootprintFromBoard( fp );
2197 else if( aEvent.IsAction( &PCB_ACTIONS::editLibFpInFpEditor ) )
2198 fp_editor->LoadFootprintFromLibrary( fp->GetFPID() );
2199
2200 fp_editor->Show( true );
2201 fp_editor->Raise(); // Iconize( false );
2202 }
2203
2204 if( selection.IsHover() )
2205 m_toolMgr->RunAction( ACTIONS::selectionClear );
2206
2207 return 0;
2208}
2209
2210
2212 EDA_ITEM* originViewItem, const VECTOR2D& aPosition )
2213{
2214 aFrame->GetDesignSettings().SetAuxOrigin( VECTOR2I( aPosition ) );
2215 originViewItem->SetPosition( aPosition );
2216 aView->MarkDirty();
2217 aFrame->OnModify();
2218}
2219
2220
2222{
2224 {
2225 m_frame->SaveCopyInUndoList( m_placeOrigin.get(), UNDO_REDO::GRIDORIGIN );
2227 return 0;
2228 }
2229
2230 if( aEvent.IsAction( &PCB_ACTIONS::drillSetOrigin ) )
2231 {
2232 VECTOR2I origin = aEvent.Parameter<VECTOR2I>();
2233 m_frame->SaveCopyInUndoList( m_placeOrigin.get(), UNDO_REDO::GRIDORIGIN );
2234 DoSetDrillOrigin( getView(), m_frame, m_placeOrigin.get(), origin );
2235 return 0;
2236 }
2237
2238 PCB_PICKER_TOOL* picker = m_toolMgr->GetTool<PCB_PICKER_TOOL>();
2239
2240 // Deactivate other tools; particularly important if another PICKER is currently running
2241 Activate();
2242
2243 picker->SetCursor( KICURSOR::PLACE );
2244 picker->ClearHandlers();
2245
2246 picker->SetClickHandler(
2247 [this] ( const VECTOR2D& pt ) -> bool
2248 {
2249 m_frame->SaveCopyInUndoList( m_placeOrigin.get(), UNDO_REDO::DRILLORIGIN );
2251 return false; // drill origin is a one-shot; don't continue with tool
2252 } );
2253
2254 m_toolMgr->RunAction( ACTIONS::pickerTool, &aEvent );
2255
2256 return 0;
2257}
2258
2259
2261{
2270
2276
2283
2284 if( ADVANCED_CFG::GetCfg().m_ShowPcbnewExportNetlist && m_frame && m_frame->GetExportNetlistAction() )
2285 Go( &BOARD_EDITOR_CONTROL::ExportNetlist, m_frame->GetExportNetlistAction()->MakeEvent() );
2286
2295
2302
2303 // Track & via size control
2309
2310 // Zone actions
2317
2318 // Placing tools
2323
2326
2327 // Cross-select
2333
2334 // Other
2338
2340
2350 // Line modes: explicit, next, and notification
2355}
const char * name
constexpr EDA_IU_SCALE pcbIUScale
Definition base_units.h:112
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 selectionCursor
Select a single item under the cursor position.
Definition actions.h:217
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:1237
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:2887
int RepairDuplicateItemUuids()
Rebind duplicate attached-item UUIDs so each live board item has a unique ID.
Definition board.cpp:2038
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:280
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition eda_item.h:149
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:91
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:469
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:1094
void SetOrientation(const EDA_ANGLE &aNewAngle)
std::deque< PAD * > & Pads()
Definition footprint.h:326
bool IsFlipped() const
Definition footprint.h:544
const LIB_ID & GetFPID() const
Definition footprint.h:371
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
VECTOR2I GetPosition() const override
Definition footprint.h:347
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:301
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition view.cpp:405
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:1809
void MarkDirty()
Force redraw of view on the next rendering.
Definition view.h:676
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:103
int GetNetCode() const
Definition netinfo.h:97
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:55
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:154
RouterState GetState() const
Definition pns_router.h:156
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:198
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:220
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:297
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition zone.h:716
const BOX2I GetBoundingBox() const override
Definition zone.cpp:651
SHAPE_POLY_SET * Outline()
Definition zone.h:336
bool IsTeardropArea() const
Definition zone.h:691
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:543
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:230
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:202
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:146
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:47
@ 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:435
@ 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 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.