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 const PCB_SELECTION& selection = selTool->GetSelection();
1554 BOARD_COMMIT commit( m_frame );
1555
1556 if( selection.Empty() )
1557 m_toolMgr->RunAction( ACTIONS::selectionCursor );
1558
1559 // Resolve TOGGLE mode
1560 if( aMode == TOGGLE )
1561 {
1562 aMode = ON;
1563
1564 for( EDA_ITEM* item : selection )
1565 {
1566 if( !item->IsBOARD_ITEM() )
1567 continue;
1568
1569 if( static_cast<BOARD_ITEM*>( item )->IsLocked() )
1570 {
1571 aMode = OFF;
1572 break;
1573 }
1574 }
1575 }
1576
1577 for( EDA_ITEM* item : selection )
1578 {
1579 if( !item->IsBOARD_ITEM() )
1580 continue;
1581
1582 BOARD_ITEM* const board_item = static_cast<BOARD_ITEM*>( item );
1583
1584 // Disallow locking free pads - it's confusing and not persisted
1585 // through save/load anyway.
1586 if( board_item->Type() == PCB_PAD_T )
1587 continue;
1588
1589 EDA_GROUP* parent_group = board_item->GetParentGroup();
1590
1591 if( parent_group && parent_group->AsEdaItem()->Type() == PCB_GENERATOR_T )
1592 {
1593 PCB_GENERATOR* generator = static_cast<PCB_GENERATOR*>( parent_group );
1594
1595 if( generator && commit.GetStatus( generator ) != CHT_MODIFY )
1596 {
1597 commit.Modify( generator );
1598
1599 if( aMode == ON )
1600 generator->SetLocked( true );
1601 else
1602 generator->SetLocked( false );
1603 }
1604 }
1605
1606 commit.Modify( board_item );
1607
1608 if( aMode == ON )
1609 board_item->SetLocked( true );
1610 else
1611 board_item->SetLocked( false );
1612 }
1613
1614 if( !commit.Empty() )
1615 {
1616 commit.Push( aMode == ON ? _( "Lock" ) : _( "Unlock" ), SKIP_TEARDROPS );
1617
1618 m_toolMgr->PostEvent( EVENTS::SelectedEvent );
1619 m_frame->OnModify();
1620 }
1621
1622 return 0;
1623}
1624
1625
1626static bool mergeZones( EDA_DRAW_FRAME* aFrame, BOARD_COMMIT& aCommit,
1627 std::vector<ZONE*>& aOriginZones, std::vector<ZONE*>& aMergedZones )
1628{
1629 aCommit.Modify( aOriginZones[0] );
1630
1631 aOriginZones[0]->Outline()->ClearArcs();
1632
1633 for( unsigned int i = 1; i < aOriginZones.size(); i++ )
1634 {
1635 SHAPE_POLY_SET otherOutline = aOriginZones[i]->Outline()->CloneDropTriangulation();
1636 otherOutline.ClearArcs();
1637 aOriginZones[0]->Outline()->BooleanAdd( otherOutline );
1638 }
1639
1640 aOriginZones[0]->Outline()->Simplify();
1641
1642 // We should have one polygon, possibly with holes. If we end up with two polygons (either
1643 // because the intersection was a single point or because the intersection was within one of
1644 // the zone's holes) then we can't merge.
1645 if( aOriginZones[0]->Outline()->IsSelfIntersecting() || aOriginZones[0]->Outline()->OutlineCount() > 1 )
1646 {
1647 DisplayErrorMessage( aFrame, _( "Zones have insufficient overlap for merging." ) );
1648 aCommit.Revert();
1649 return false;
1650 }
1651
1652 // Adopt the highest priority from all merged zones so the result maintains
1653 // the most aggressive fill ordering.
1654 unsigned highestPriority = aOriginZones[0]->GetAssignedPriority();
1655
1656 for( unsigned int i = 1; i < aOriginZones.size(); i++ )
1657 {
1658 highestPriority = std::max( highestPriority, aOriginZones[i]->GetAssignedPriority() );
1659 aCommit.Remove( aOriginZones[i] );
1660 }
1661
1662 aOriginZones[0]->SetAssignedPriority( highestPriority );
1663
1664 aMergedZones.push_back( aOriginZones[0] );
1665
1666 aOriginZones[0]->SetLocalFlags( 1 );
1667 aOriginZones[0]->HatchBorder();
1668 aOriginZones[0]->CacheTriangulation();
1669
1670 return true;
1671}
1672
1673
1675{
1676 const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1678 BOARD_COMMIT commit( m_frame );
1679
1680 if( selection.Size() < 2 )
1681 return 0;
1682
1683 int netcode = -1;
1684
1685 ZONE* firstZone = nullptr;
1686 std::vector<ZONE*> toMerge, merged;
1687
1688 for( EDA_ITEM* item : selection )
1689 {
1690 ZONE* curr_area = dynamic_cast<ZONE*>( item );
1691
1692 if( !curr_area )
1693 continue;
1694
1695 if( !firstZone )
1696 firstZone = curr_area;
1697
1698 netcode = curr_area->GetNetCode();
1699
1700 if( firstZone->GetNetCode() != netcode )
1701 {
1702 wxLogMessage( _( "Some zone netcodes did not match and were not merged." ) );
1703 continue;
1704 }
1705
1706 if( curr_area->GetIsRuleArea() != firstZone->GetIsRuleArea() )
1707 {
1708 wxLogMessage( _( "Some zones were rule areas and were not merged." ) );
1709 continue;
1710 }
1711
1712 if( curr_area->GetLayerSet() != firstZone->GetLayerSet() )
1713 {
1714 wxLogMessage( _( "Some zone layer sets did not match and were not merged." ) );
1715 continue;
1716 }
1717
1718 bool intersects = curr_area == firstZone;
1719
1720 for( ZONE* candidate : toMerge )
1721 {
1722 if( intersects )
1723 break;
1724
1725 if( board->TestZoneIntersection( curr_area, candidate ) )
1726 intersects = true;
1727 }
1728
1729 if( !intersects )
1730 {
1731 wxLogMessage( _( "Some zones did not intersect and were not merged." ) );
1732 continue;
1733 }
1734
1735 toMerge.push_back( curr_area );
1736 }
1737
1738 m_toolMgr->RunAction( ACTIONS::selectionClear );
1739
1740 if( !toMerge.empty() )
1741 {
1742 if( mergeZones( m_frame, commit, toMerge, merged ) )
1743 {
1744 commit.Push( _( "Merge Zones" ) );
1745
1746 for( EDA_ITEM* item : merged )
1747 m_toolMgr->RunAction( ACTIONS::selectItem, item );
1748 }
1749 }
1750
1751 return 0;
1752}
1753
1754
1756{
1757 PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
1758 const PCB_SELECTION& selection = selTool->GetSelection();
1759
1760 // because this pops up the zone editor, it would be confusing to handle multiple zones,
1761 // so just handle single selections containing exactly one zone
1762 if( selection.Size() != 1 )
1763 return 0;
1764
1765 ZONE* oldZone = dynamic_cast<ZONE*>( selection[0] );
1766
1767 if( !oldZone )
1768 return 0;
1769
1770 ZONE_SETTINGS zoneSettings;
1771 zoneSettings << *oldZone;
1772 int dialogResult;
1773
1774 if( oldZone->GetIsRuleArea() )
1775 dialogResult = InvokeRuleAreaEditor( m_frame, &zoneSettings, board() );
1776 else if( oldZone->IsOnCopperLayer() )
1777 dialogResult = InvokeCopperZonesEditor( m_frame, nullptr, &zoneSettings );
1778 else
1779 dialogResult = InvokeNonCopperZonesEditor( m_frame, &zoneSettings );
1780
1781 if( dialogResult != wxID_OK )
1782 return 0;
1783
1784 // duplicate the zone
1785 BOARD_COMMIT commit( m_frame );
1786
1787 std::unique_ptr<ZONE> newZone = std::make_unique<ZONE>( *oldZone );
1788 newZone->ClearSelected();
1789 newZone->UnFill();
1790 zoneSettings.ExportSetting( *newZone );
1791
1792 // If the new zone is on the same layer(s) as the initial zone,
1793 // offset it a bit so it can more easily be picked.
1794 if( oldZone->GetLayerSet() == zoneSettings.m_Layers )
1795 newZone->Move( VECTOR2I( pcbIUScale.IU_PER_MM, pcbIUScale.IU_PER_MM ) );
1796
1797 commit.Add( newZone.release() );
1798 commit.Push( _( "Duplicate Zone" ) );
1799
1800 return 0;
1801}
1802
1803
1805{
1806 const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1807
1808 if( selection.Size() != 1 )
1809 return 0;
1810
1811 ZONE* zone = dynamic_cast<ZONE*>( selection[0] );
1812
1813 if( !zone || zone->GetIsRuleArea() || zone->IsTeardropArea() )
1814 return 0;
1815
1816 std::vector<ZONE*> overlapping = getOverlappingZones( board(), zone );
1817
1818 unsigned maxOverlapping = zone->GetAssignedPriority();
1819
1820 for( ZONE* other : overlapping )
1821 maxOverlapping = std::max( maxOverlapping, other->GetAssignedPriority() );
1822
1823 if( zone->GetAssignedPriority() >= maxOverlapping )
1824 return 0;
1825
1826 // Two options to place our zone above all overlapping zones.
1827 // Pick whichever viable option displaces fewer other zones.
1828 ZonePriorityMap byPriority = buildPriorityMap( board(), zone );
1829
1830 // Option A: take maxOverlapping, cascade displaced zones down
1831 bool cascadeDownViable = false;
1832 std::vector<ZONE*> cascadeDown =
1833 findCascadeZones( byPriority, maxOverlapping, false, cascadeDownViable );
1834
1835 // Option B: take maxOverlapping + 1, cascade displaced zones up
1836 bool cascadeUpViable = false;
1837 std::vector<ZONE*> cascadeUp;
1838 bool canCascadeUp = ( maxOverlapping < UINT_MAX );
1839
1840 if( canCascadeUp )
1841 cascadeUp = findCascadeZones( byPriority, maxOverlapping + 1, true, cascadeUpViable );
1842
1843 if( !cascadeDownViable && !cascadeUpViable )
1844 return 0;
1845
1846 BOARD_COMMIT commit( m_frame );
1847 commit.Modify( zone );
1848
1849 bool useDown = cascadeDownViable
1850 && ( !cascadeUpViable || cascadeDown.size() <= cascadeUp.size() );
1851
1852 if( useDown )
1853 {
1854 zone->SetAssignedPriority( maxOverlapping );
1855
1856 for( ZONE* z : cascadeDown )
1857 {
1858 commit.Modify( z );
1860 z->SetNeedRefill( true );
1861 }
1862 }
1863 else
1864 {
1865 zone->SetAssignedPriority( maxOverlapping + 1 );
1866
1867 for( ZONE* z : cascadeUp )
1868 {
1869 commit.Modify( z );
1871 z->SetNeedRefill( true );
1872 }
1873 }
1874
1875 zone->SetNeedRefill( true );
1876 commit.Push( _( "Move Zone to Top Priority" ) );
1877
1878 return 0;
1879}
1880
1881
1883{
1884 const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1885
1886 if( selection.Size() != 1 )
1887 return 0;
1888
1889 ZONE* zone = dynamic_cast<ZONE*>( selection[0] );
1890
1891 if( !zone || zone->GetIsRuleArea() || zone->IsTeardropArea() )
1892 return 0;
1893
1894 std::vector<ZONE*> overlapping = getOverlappingZones( board(), zone );
1895
1896 // Find the overlapping zone with the lowest priority still above ours
1897 ZONE* target = nullptr;
1898 unsigned zonePriority = zone->GetAssignedPriority();
1899
1900 for( ZONE* other : overlapping )
1901 {
1902 if( other->GetAssignedPriority() > zonePriority )
1903 {
1904 if( !target || other->GetAssignedPriority() < target->GetAssignedPriority() )
1905 target = other;
1906 }
1907 }
1908
1909 if( !target )
1910 return 0;
1911
1912 BOARD_COMMIT commit( m_frame );
1913 commit.Modify( zone );
1914
1915 // Place our zone just above the target without modifying any other zone
1916 if( target->GetAssignedPriority() < UINT_MAX )
1917 {
1918 zone->SetAssignedPriority( target->GetAssignedPriority() + 1 );
1919 }
1920 else
1921 {
1922 // Can't go above UINT_MAX; swap as last resort
1923 commit.Modify( target );
1924 zone->SetAssignedPriority( UINT_MAX );
1925 target->SetAssignedPriority( zonePriority );
1926 target->SetNeedRefill( true );
1927 }
1928
1929 zone->SetNeedRefill( true );
1930 commit.Push( _( "Raise Zone Priority" ) );
1931
1932 return 0;
1933}
1934
1935
1937{
1938 const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1939
1940 if( selection.Size() != 1 )
1941 return 0;
1942
1943 ZONE* zone = dynamic_cast<ZONE*>( selection[0] );
1944
1945 if( !zone || zone->GetIsRuleArea() || zone->IsTeardropArea() )
1946 return 0;
1947
1948 std::vector<ZONE*> overlapping = getOverlappingZones( board(), zone );
1949
1950 // Find the overlapping zone with the highest priority still below ours
1951 ZONE* target = nullptr;
1952 unsigned zonePriority = zone->GetAssignedPriority();
1953
1954 for( ZONE* other : overlapping )
1955 {
1956 if( other->GetAssignedPriority() < zonePriority )
1957 {
1958 if( !target || other->GetAssignedPriority() > target->GetAssignedPriority() )
1959 target = other;
1960 }
1961 }
1962
1963 if( !target )
1964 return 0;
1965
1966 BOARD_COMMIT commit( m_frame );
1967 commit.Modify( zone );
1968
1969 // Place our zone just below the target without modifying any other zone
1970 if( target->GetAssignedPriority() > 0 )
1971 {
1972 zone->SetAssignedPriority( target->GetAssignedPriority() - 1 );
1973 }
1974 else
1975 {
1976 // Can't go below 0; swap as last resort
1977 commit.Modify( target );
1978 zone->SetAssignedPriority( 0 );
1979 target->SetAssignedPriority( zonePriority );
1980 target->SetNeedRefill( true );
1981 }
1982
1983 zone->SetNeedRefill( true );
1984 commit.Push( _( "Lower Zone Priority" ) );
1985
1986 return 0;
1987}
1988
1989
1991{
1992 const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1993
1994 if( selection.Size() != 1 )
1995 return 0;
1996
1997 ZONE* zone = dynamic_cast<ZONE*>( selection[0] );
1998
1999 if( !zone || zone->GetIsRuleArea() || zone->IsTeardropArea() )
2000 return 0;
2001
2002 std::vector<ZONE*> overlapping = getOverlappingZones( board(), zone );
2003
2004 unsigned minOverlapping = zone->GetAssignedPriority();
2005
2006 for( ZONE* other : overlapping )
2007 minOverlapping = std::min( minOverlapping, other->GetAssignedPriority() );
2008
2009 if( zone->GetAssignedPriority() <= minOverlapping )
2010 return 0;
2011
2012 // Two options to place our zone below all overlapping zones.
2013 // Pick whichever viable option displaces fewer other zones.
2014 ZonePriorityMap byPriority = buildPriorityMap( board(), zone );
2015
2016 // Option A: take minOverlapping, cascade displaced zones up
2017 bool cascadeUpViable = false;
2018 std::vector<ZONE*> cascadeUp =
2019 findCascadeZones( byPriority, minOverlapping, true, cascadeUpViable );
2020
2021 // Option B: take minOverlapping - 1, cascade displaced zones down
2022 bool cascadeDownViable = false;
2023 std::vector<ZONE*> cascadeDown;
2024 bool canCascadeDown = ( minOverlapping > 0 );
2025
2026 if( canCascadeDown )
2027 {
2028 cascadeDown =
2029 findCascadeZones( byPriority, minOverlapping - 1, false, cascadeDownViable );
2030 }
2031
2032 if( !cascadeUpViable && !cascadeDownViable )
2033 return 0;
2034
2035 BOARD_COMMIT commit( m_frame );
2036 commit.Modify( zone );
2037
2038 bool useUp = cascadeUpViable
2039 && ( !cascadeDownViable || cascadeUp.size() <= cascadeDown.size() );
2040
2041 if( useUp )
2042 {
2043 zone->SetAssignedPriority( minOverlapping );
2044
2045 for( ZONE* z : cascadeUp )
2046 {
2047 commit.Modify( z );
2049 z->SetNeedRefill( true );
2050 }
2051 }
2052 else
2053 {
2054 zone->SetAssignedPriority( minOverlapping - 1 );
2055
2056 for( ZONE* z : cascadeDown )
2057 {
2058 commit.Modify( z );
2060 z->SetNeedRefill( true );
2061 }
2062 }
2063
2064 zone->SetNeedRefill( true );
2065 commit.Push( _( "Move Zone to Bottom Priority" ) );
2066
2067 return 0;
2068}
2069
2070
2072{
2073 doCrossProbePcbToSch( aEvent, false );
2074 return 0;
2075}
2076
2077
2079{
2080 doCrossProbePcbToSch( aEvent, true );
2081 return 0;
2082}
2083
2084
2086{
2087 // Don't get in an infinite loop PCB -> SCH -> PCB -> SCH -> ...
2088 if( m_frame->m_ProbingSchToPcb )
2089 return;
2090
2091 PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
2092 const PCB_SELECTION& selection = selTool->GetSelection();
2093 EDA_ITEM* focusItem = nullptr;
2094
2095 if( aEvent.Matches( EVENTS::PointSelectedEvent ) )
2096 focusItem = selection.GetLastAddedItem();
2097
2098 m_frame->SendSelectItemsToSch( selection.GetItems(), focusItem, aForce );
2099
2100 // Update 3D viewer highlighting
2101 m_frame->Update3DView( false, frame()->GetPcbNewSettings()->m_Display.m_Live3DRefresh );
2102}
2103
2104
2106{
2107 PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
2108
2109 const PCB_SELECTION& selection = selectionTool->RequestSelection(
2110 []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
2111 {
2112 // Iterate from the back so we don't have to worry about removals.
2113 for( int i = aCollector.GetCount() - 1; i >= 0; --i )
2114 {
2115 if( !dynamic_cast<BOARD_CONNECTED_ITEM*>( aCollector[ i ] ) )
2116 aCollector.Remove( aCollector[ i ] );
2117 }
2118
2119 sTool->FilterCollectorForLockedItems( aCollector );
2120 } );
2121
2122 std::set<wxString> netNames;
2123 std::set<int> netCodes;
2124
2125 for( EDA_ITEM* item : selection )
2126 {
2127 const NETINFO_ITEM& net = *static_cast<BOARD_CONNECTED_ITEM*>( item )->GetNet();
2128
2129 if( !net.HasAutoGeneratedNetname() )
2130 {
2131 netNames.insert( net.GetNetname() );
2132 netCodes.insert( net.GetNetCode() );
2133 }
2134 }
2135
2136 if( netNames.empty() )
2137 {
2138 m_frame->ShowInfoBarError( _( "Selection contains no items with labeled nets." ) );
2139 return 0;
2140 }
2141
2142 selectionTool->ClearSelection();
2143 for( const int& code : netCodes )
2144 {
2145 m_toolMgr->RunAction( PCB_ACTIONS::selectNet, code );
2146 }
2147 canvas()->ForceRefresh();
2148
2149 DIALOG_ASSIGN_NETCLASS dlg( m_frame, netNames, board()->GetNetClassAssignmentCandidates(),
2150 [this]( const std::vector<wxString>& aNetNames )
2151 {
2152 PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
2153 selTool->ClearSelection();
2154
2155 for( const wxString& curr_netName : aNetNames )
2156 {
2157 int curr_netCode = board()->GetNetInfo().GetNetItem( curr_netName )->GetNetCode();
2158
2159 if( curr_netCode > 0 )
2160 selTool->SelectAllItemsOnNet( curr_netCode );
2161 }
2162
2163 canvas()->ForceRefresh();
2164 m_frame->UpdateMsgPanel();
2165 } );
2166
2167 if( dlg.ShowModal() == wxID_OK )
2168 {
2170 // Refresh UI that depends on netclasses, such as the properties panel
2172 }
2173
2174 return 0;
2175}
2176
2177
2179{
2180 PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
2181 const PCB_SELECTION& selection = selTool->RequestSelection( EDIT_TOOL::FootprintFilter );
2182
2183 if( selection.Empty() )
2184 {
2185 // Giant hack: by default we assign Edit Table to the same hotkey, so give the table
2186 // tool a chance to handle it if we can't.
2187 if( PCB_EDIT_TABLE_TOOL* tableTool = m_toolMgr->GetTool<PCB_EDIT_TABLE_TOOL>() )
2188 tableTool->EditTable( aEvent );
2189
2190 return 0;
2191 }
2192
2193 FOOTPRINT* fp = selection.FirstOfKind<FOOTPRINT>();
2194
2195 if( !fp )
2196 return 0;
2197
2199
2200 if( KIWAY_PLAYER* frame = editFrame->Kiway().Player( FRAME_FOOTPRINT_EDITOR, true ) )
2201 {
2202 FOOTPRINT_EDIT_FRAME* fp_editor = static_cast<FOOTPRINT_EDIT_FRAME*>( frame );
2203
2205 fp_editor->LoadFootprintFromBoard( fp );
2206 else if( aEvent.IsAction( &PCB_ACTIONS::editLibFpInFpEditor ) )
2207 fp_editor->LoadFootprintFromLibrary( fp->GetFPID() );
2208
2209 fp_editor->Show( true );
2210 fp_editor->Raise(); // Iconize( false );
2211 }
2212
2213 if( selection.IsHover() )
2214 m_toolMgr->RunAction( ACTIONS::selectionClear );
2215
2216 return 0;
2217}
2218
2219
2221 EDA_ITEM* originViewItem, const VECTOR2D& aPosition )
2222{
2223 aFrame->GetDesignSettings().SetAuxOrigin( VECTOR2I( aPosition ) );
2224 originViewItem->SetPosition( aPosition );
2225 aView->MarkDirty();
2226 aFrame->OnModify();
2227}
2228
2229
2231{
2233 {
2234 m_frame->SaveCopyInUndoList( m_placeOrigin.get(), UNDO_REDO::GRIDORIGIN );
2236 return 0;
2237 }
2238
2239 if( aEvent.IsAction( &PCB_ACTIONS::drillSetOrigin ) )
2240 {
2241 VECTOR2I origin = aEvent.Parameter<VECTOR2I>();
2242 m_frame->SaveCopyInUndoList( m_placeOrigin.get(), UNDO_REDO::GRIDORIGIN );
2243 DoSetDrillOrigin( getView(), m_frame, m_placeOrigin.get(), origin );
2244 return 0;
2245 }
2246
2247 PCB_PICKER_TOOL* picker = m_toolMgr->GetTool<PCB_PICKER_TOOL>();
2248
2249 // Deactivate other tools; particularly important if another PICKER is currently running
2250 Activate();
2251
2252 picker->SetCursor( KICURSOR::PLACE );
2253 picker->ClearHandlers();
2254
2255 picker->SetClickHandler(
2256 [this] ( const VECTOR2D& pt ) -> bool
2257 {
2258 m_frame->SaveCopyInUndoList( m_placeOrigin.get(), UNDO_REDO::DRILLORIGIN );
2260 return false; // drill origin is a one-shot; don't continue with tool
2261 } );
2262
2263 m_toolMgr->RunAction( ACTIONS::pickerTool, &aEvent );
2264
2265 return 0;
2266}
2267
2268
2270{
2279
2285
2292
2293 if( ADVANCED_CFG::GetCfg().m_ShowPcbnewExportNetlist && m_frame && m_frame->GetExportNetlistAction() )
2294 Go( &BOARD_EDITOR_CONTROL::ExportNetlist, m_frame->GetExportNetlistAction()->MakeEvent() );
2295
2304
2311
2312 // Track & via size control
2318
2319 // Zone actions
2326
2327 // Placing tools
2332
2335
2336 // Cross-select
2342
2343 // Other
2347
2349
2359 // Line modes: explicit, next, and notification
2364}
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 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: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:2912
int RepairDuplicateItemUuids()
Rebind duplicate attached-item UUIDs so each live board item has a unique ID.
Definition board.cpp:2054
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: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:1152
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: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:650
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: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:147
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.