KiCad PCB EDA Suite
pcb_edit_frame.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) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
6 * Copyright (C) 2013 Wayne Stambaugh <[email protected]>
7 * Copyright (C) 2013-2022 KiCad Developers, see AUTHORS.txt for contributors.
8 *
9 * This program is free software: you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation, either version 3 of the License, or (at your
12 * option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23#include <advanced_config.h>
24#include <kiface_base.h>
25#include <kiway.h>
26#include <pgm_base.h>
27#include <pcb_edit_frame.h>
29#include <fp_lib_table.h>
30#include <bitmaps.h>
31#include <confirm.h>
32#include <trace_helpers.h>
33#include <pcbnew_id.h>
34#include <pcbnew_settings.h>
37#include <dialog_plot.h>
38#include <dialog_find.h>
42#include <dialog_board_setup.h>
43#include <invoke_pcb_dialog.h>
44#include <board.h>
46#include <footprint.h>
50#include <pcb_draw_panel_gal.h>
51#include <functional>
52#include <pcb_painter.h>
55#include <python_scripting.h>
58#include <tool/tool_manager.h>
60#include <tool/action_toolbar.h>
61#include <tool/common_control.h>
62#include <tool/common_tools.h>
63#include <tool/selection.h>
64#include <tool/zoom_tool.h>
68#include <tools/edit_tool.h>
69#include <tools/group_tool.h>
70#include <tools/drc_tool.h>
72#include <tools/convert_tool.h>
73#include <tools/drawing_tool.h>
74#include <tools/pcb_control.h>
81#include <tools/pad_tool.h>
86#include <tools/pcb_actions.h>
87#include <router/router_tool.h>
91#include <gestfich.h>
92#include <executable_names.h>
94#include <wx/socket.h>
95#include <wx/wupdlock.h>
96#include <dialog_drc.h> // for DIALOG_DRC_WINDOW_NAME definition
100#include <widgets/infobar.h>
102#include <widgets/wx_aui_utils.h>
103#include <kiplatform/app.h>
104#include <profile.h>
107
108#include <action_plugin.h>
109#include "../scripting/python_scripting.h"
110
111#include <wx/filedlg.h>
112
113using namespace std::placeholders;
114
115
116BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
119
120
123
124 EVT_SIZE( PCB_EDIT_FRAME::OnSize )
125
127
128 // Menu Files:
130
134
140
143
146
147 EVT_MENU( wxID_EXIT, PCB_EDIT_FRAME::OnQuit )
148 EVT_MENU( wxID_CLOSE, PCB_EDIT_FRAME::OnQuit )
149
150 // menu Config
152
153 // menu Postprocess
155
156 // Horizontal toolbar
162
163 // Tracks and vias sizes general options
165 PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event )
166
167 // User interface update event handlers.
173 PCB_EDIT_FRAME::OnUpdateSelectTrackWidth )
175 PCB_EDIT_FRAME::OnUpdateSelectViaSize )
176 // Drop files event
177 EVT_DROP_FILES( PCB_EDIT_FRAME::OnDropFiles )
178END_EVENT_TABLE()
179
180
181PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
182 PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB_EDITOR, _( "PCB Editor" ),
183 wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE,
185 m_exportNetlistAction( nullptr ), m_findDialog( nullptr )
186{
187 m_maximizeByDefault = true;
188 m_showBorderAndTitleBlock = true; // true to display sheet references
189 m_SelTrackWidthBox = nullptr;
190 m_SelViaSizeBox = nullptr;
191 m_SelLayerBox = nullptr;
192 m_show_layer_manager_tools = true;
193 m_supportsAutoSave = true;
194 m_probingSchToPcb = false;
195 m_show_properties = true;
196 m_show_search = false;
197
198 // We don't know what state board was in when it was last saved, so we have to
199 // assume dirty
200 m_ZoneFillsDirty = true;
201
202 m_aboutTitle = _( "KiCad PCB Editor" );
203
204 // Must be created before the menus are created.
205 if( ADVANCED_CFG::GetCfg().m_ShowPcbnewExportNetlist )
206 m_exportNetlistAction = new TOOL_ACTION( "pcbnew.EditorControl.exportNetlist",
207 AS_GLOBAL, 0, "", _( "Netlist..." ),
208 _( "Export netlist used to update schematics" ) );
209
210 // Create GAL canvas
211 auto canvas = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize,
212 GetGalDisplayOptions(),
214
215 SetCanvas( canvas );
216 SetBoard( new BOARD() );
217
218 wxIcon icon;
219 wxIconBundle icon_bundle;
220
221 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew ) );
222 icon_bundle.AddIcon( icon );
223 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew_32 ) );
224 icon_bundle.AddIcon( icon );
225 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew_16 ) );
226 icon_bundle.AddIcon( icon );
227
228 SetIcons( icon_bundle );
229
230 // LoadSettings() *after* creating m_LayersManager, because LoadSettings()
231 // initialize parameters in m_LayersManager
232 LoadSettings( config() );
233
234 SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU( pcbIUScale.IU_PER_MILS ) ) );
235
236 // PCB drawings start in the upper left corner.
237 GetScreen()->m_Center = false;
238
239 setupTools();
240 setupUIConditions();
241
242 ReCreateMenuBar();
243 ReCreateHToolbar();
244 ReCreateAuxiliaryToolbar();
245 ReCreateVToolbar();
246 ReCreateOptToolbar();
247
248 if( ADVANCED_CFG::GetCfg().m_ShowPropertiesPanel )
249 m_propertiesPanel = new PCB_PROPERTIES_PANEL( this, this );
250
251 m_selectionFilterPanel = new PANEL_SELECTION_FILTER( this );
252
253 m_appearancePanel = new APPEARANCE_CONTROLS( this, GetCanvas() );
254 m_searchPane = new PCB_SEARCH_PANE( this );
255
256 m_auimgr.SetManagedWindow( this );
257
258 CreateInfoBar();
259
260 unsigned int auiFlags = wxAUI_MGR_DEFAULT;
261#if !defined( _WIN32 )
262 // Windows cannot redraw the UI fast enough during a live resize and may lead to all kinds
263 // of graphical glitches.
264 auiFlags |= wxAUI_MGR_LIVE_RESIZE;
265#endif
266 m_auimgr.SetFlags( auiFlags );
267
268 // Rows; layers 4 - 6
269 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" )
270 .Top().Layer( 6 ) );
271 m_auimgr.AddPane( m_auxiliaryToolBar, EDA_PANE().HToolbar().Name( "AuxToolbar" )
272 .Top().Layer( 5 ) );
273 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" )
274 .Bottom().Layer( 6 ) );
275
276 // Columns; layers 1 - 3
277 m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" )
278 .Left().Layer( 3 ) );
279
280 m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" )
281 .Right().Layer( 3 ) );
282
283 m_auimgr.AddPane( m_appearancePanel, EDA_PANE().Name( "LayersManager" )
284 .Right().Layer( 4 )
285 .Caption( _( "Appearance" ) ).PaneBorder( false )
286 .MinSize( 180, -1 ).BestSize( 180, -1 ) );
287
288 m_auimgr.AddPane( m_selectionFilterPanel, EDA_PANE().Name( "SelectionFilter" )
289 .Right().Layer( 4 ).Position( 2 )
290 .Caption( _( "Selection Filter" ) ).PaneBorder( false )
291 .MinSize( 180, -1 ).BestSize( 180, -1 ) );
292
293 if( ADVANCED_CFG::GetCfg().m_ShowPropertiesPanel )
294 {
295 m_auimgr.AddPane( m_propertiesPanel, EDA_PANE().Name( "PropertiesManager" )
296 .Left().Layer( 5 ).Caption( _( "Properties" ) )
297 .PaneBorder( false ).MinSize( 240, -1 ).BestSize( 300, -1 ) );
298 }
299
300 // Center
301 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" )
302 .Center() );
303
304
305 m_auimgr.AddPane( m_searchPane, EDA_PANE()
306 .Name( SearchPaneName() )
307 .Bottom()
308 .Caption( _( "Search" ) )
309 .PaneBorder( false )
310 .MinSize( 180, -1 )
311 .BestSize( 180, -1 )
312 .FloatingSize( 480, 200 )
313 .CloseButton( true )
314 .DestroyOnClose( false ) );
315
316
317 m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
318 m_auimgr.GetPane( "SelectionFilter" ).Show( m_show_layer_manager_tools );
319
320 bool showProperties = ADVANCED_CFG::GetCfg().m_ShowPropertiesPanel && m_show_properties;
321 m_auimgr.GetPane( "PropertiesManager" ).Show( showProperties );
322
323 m_auimgr.GetPane( SearchPaneName() ).Show( m_show_search );
324
325 // The selection filter doesn't need to grow in the vertical direction when docked
326 m_auimgr.GetPane( "SelectionFilter" ).dock_proportion = 0;
327
328 FinishAUIInitialization();
329
330 if( PCBNEW_SETTINGS* settings = dynamic_cast<PCBNEW_SETTINGS*>( config() ) )
331 {
332 if( settings->m_AuiPanels.right_panel_width > 0 )
333 {
334 wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
335 SetAuiPaneSize( m_auimgr, layersManager, settings->m_AuiPanels.right_panel_width, -1 );
336 }
337
338 m_appearancePanel->SetTabIndex( settings->m_AuiPanels.appearance_panel_tab );
339 }
340
341 GetToolManager()->RunAction( ACTIONS::zoomFitScreen, false );
342
343 // This is used temporarily to fix a client size issue on GTK that causes zoom to fit
344 // to calculate the wrong zoom size. See PCB_EDIT_FRAME::onSize().
345 Bind( wxEVT_SIZE, &PCB_EDIT_FRAME::onSize, this );
346
347 // Redraw netnames (so that they fall within the current viewport) after the viewport
348 // has stopped changing. Redrawing them without the timer moves them smoothly with scrolling,
349 // making it look like the tracks are being dragged -- which we don't want.
350 m_redrawNetnamesTimer.SetOwner( this );
351 Connect( wxEVT_TIMER, wxTimerEventHandler( PCB_EDIT_FRAME::redrawNetnames ), nullptr, this );
352
353 Bind( wxEVT_IDLE,
354 [this]( wxIdleEvent& aEvent )
355 {
356 if( GetCanvas()->GetView()->GetViewport() != m_lastViewport )
357 {
358 m_lastViewport = GetCanvas()->GetView()->GetViewport();
359 m_redrawNetnamesTimer.StartOnce( 500 );
360 }
361
362 // Do not forget to pass the Idle event to other clients:
363 aEvent.Skip();
364 } );
365
366 resolveCanvasType();
367
368 setupUnits( config() );
369
370 // Ensure the Python interpreter is up to date with its environment variables
371 PythonSyncEnvironmentVariables();
372 PythonSyncProjectName();
373
374 // Sync action plugins in case they changed since the last time the frame opened
375 GetToolManager()->RunAction( PCB_ACTIONS::pluginsReload, true );
376
377 GetCanvas()->SwitchBackend( m_canvasType );
378 ActivateGalCanvas();
379
380 // Default shutdown reason until a file is loaded
381 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "New PCB file is unsaved" ) );
382
383 // disable Export STEP item if kicad2step does not exist
384 wxString strK2S = Pgm().GetExecutablePath();
385
386#ifdef __WXMAC__
387 if( strK2S.Find( wxT( "pcbnew.app" ) ) != wxNOT_FOUND )
388 {
389 // On macOS, we have standalone applications inside the main bundle, so we handle that here:
390 strK2S += wxT( "../../" );
391 }
392
393 strK2S += wxT( "Contents/MacOS/" );
394#endif
395
396 wxFileName appK2S( strK2S, wxT( "kicad2step" ) );
397
398 #ifdef _WIN32
399 appK2S.SetExt( wxT( "exe" ) );
400 #endif
401
402 // Ensure the window is on top
403 Raise();
404
405// if( !appK2S.FileExists() )
406 // GetMenuBar()->FindItem( ID_GEN_EXPORT_FILE_STEP )->Enable( false );
407
408 // AUI doesn't refresh properly on wxMac after changes in eb7dc6dd, so force it to
409#ifdef __WXMAC__
410 if( Kiface().IsSingle() )
411 {
412 CallAfter( [&]()
413 {
414 m_appearancePanel->OnBoardChanged();
415 } );
416 }
417#endif
418
419 // Register a call to update the toolbar sizes. It can't be done immediately because
420 // it seems to require some sizes calculated that aren't yet (at least on GTK).
421 CallAfter( [&]()
422 {
423 // Ensure the controls on the toolbars all are correctly sized
424 UpdateToolbarControlSizes();
425 } );
426
428 {
429 m_eventCounterTimer = new wxTimer( this );
430
431 Bind( wxEVT_TIMER,
432 [&]( wxTimerEvent& aEvent )
433 {
434 GetCanvas()->m_PaintEventCounter->Show();
435 GetCanvas()->m_PaintEventCounter->Reset();
436
438 static_cast<KIGFX::WX_VIEW_CONTROLS*>( GetCanvas()->GetViewControls() );
439 vc->m_MotionEventCounter->Show();
440 vc->m_MotionEventCounter->Reset();
441
442 },
443 m_eventCounterTimer->GetId() );
444
445 m_eventCounterTimer->Start( 1000 );
446 }
447
448 m_acceptedExts.emplace( KiCadPcbFileExtension, &PCB_ACTIONS::ddAppendBoard );
449 m_acceptedExts.emplace( LegacyPcbFileExtension, &PCB_ACTIONS::ddAppendBoard );
450 DragAcceptFiles( true );
451}
452
453
455{
456 if( ADVANCED_CFG::GetCfg().m_ShowEventCounters )
457 {
458 // Stop the timer during destruction early to avoid potential event race conditions (that do happen on windows)
459 m_eventCounterTimer->Stop();
460 delete m_eventCounterTimer;
461 }
462
463 // Close modeless dialogs
464 wxWindow* open_dlg = wxWindow::FindWindowByName( DIALOG_DRC_WINDOW_NAME );
465
466 if( open_dlg )
467 open_dlg->Close( true );
468
469 // Shutdown all running tools
470 if( m_toolManager )
472
473 if( GetBoard() )
475
477 delete m_appearancePanel;
479 delete m_propertiesPanel;
480}
481
482
483void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard, bool aBuildConnectivity,
484 PROGRESS_REPORTER* aReporter )
485{
486 if( m_pcb )
488
489 PCB_BASE_EDIT_FRAME::SetBoard( aBoard, aReporter );
490
491 aBoard->SetProject( &Prj() );
492
493 if( aBuildConnectivity )
494 aBoard->BuildConnectivity();
495
496 // reload the drawing-sheet
497 SetPageSettings( aBoard->GetPageSettings() );
498}
499
500
502{
503 return m_pcb;
504}
505
506
507void PCB_EDIT_FRAME::redrawNetnames( wxTimerEvent& aEvent )
508{
509 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( Kiface().KifaceSettings() );
510
511 if( !cfg || cfg->m_Display.m_NetNames < 2 )
512 return;
513
514 KIGFX::VIEW* view = GetCanvas()->GetView();
515
516 for( PCB_TRACK* track : GetBoard()->Tracks() )
517 {
518 if( track->ViewGetLOD( GetNetnameLayer( track->GetLayer() ), view ) < view->GetScale() )
519 view->Update( track, KIGFX::REPAINT );
520 }
521
522 GetCanvas()->Refresh();
523}
524
525
526void PCB_EDIT_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
527{
528 PCB_BASE_FRAME::SetPageSettings( aPageSettings );
529
530 // Prepare drawing-sheet template
533 m_pcb->GetProject(),
535 &m_pcb->GetProperties() );
536
537 drawingSheet->SetSheetName( std::string( GetScreenDesc().mb_str() ) );
538
539 // A board is not like a schematic having a main page and sub sheets.
540 // So for the drawing sheet, use only the first page option to display items
541 drawingSheet->SetIsFirstPage( true );
542
543 BASE_SCREEN* screen = GetScreen();
544
545 if( screen != nullptr )
546 {
547 drawingSheet->SetPageNumber(TO_UTF8( screen->GetPageNumber() ) );
548 drawingSheet->SetSheetCount( screen->GetPageCount() );
549 }
550
551 if( BOARD* board = GetBoard() )
552 drawingSheet->SetFileName( TO_UTF8( board->GetFileName() ) );
553
554 // PCB_DRAW_PANEL_GAL takes ownership of the drawing-sheet
555 GetCanvas()->SetDrawingSheet( drawingSheet );
556}
557
558
560{
561 return GetScreen() && GetScreen()->IsContentModified();
562}
563
564
566{
567 if( GetScreen() )
568 return GetScreen()->IsContentModified();
569
570 return false;
571}
572
573
575{
576 return m_toolManager->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
577}
578
579
581{
582 // Create the manager and dispatcher & route draw panel events to the dispatcher
585 GetCanvas()->GetViewControls(), config(), this );
586 m_actions = new PCB_ACTIONS();
588
589 // Register tools
618
619 for( TOOL_BASE* tool : m_toolManager->Tools() )
620 {
621 if( PCB_TOOL_BASE* pcbTool = dynamic_cast<PCB_TOOL_BASE*>( tool ) )
622 pcbTool->SetIsBoardEditor( true );
623 }
624
625 // Run the selection tool, it is supposed to be always active
626 m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
627}
628
629
631{
633
635 PCB_EDITOR_CONDITIONS cond( this );
636
637 wxASSERT( mgr );
638
639#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
640#define CHECK( x ) ACTION_CONDITIONS().Check( x )
641
645
652
653 mgr->SetConditions( ACTIONS::cut, ENABLE( cond.HasItems() ) );
654 mgr->SetConditions( ACTIONS::copy, ENABLE( cond.HasItems() ) );
662
663 auto haveAtLeastOneGroupCond =
664 []( const SELECTION& aSel )
665 {
666 for( EDA_ITEM* item : aSel )
667 {
668 if( item->Type() == PCB_GROUP_T )
669 return true;
670 }
671
672 return false;
673 };
674
676 mgr->SetConditions( PCB_ACTIONS::ungroup, ENABLE( haveAtLeastOneGroupCond ) );
679
683
684 if( SCRIPTING::IsWxAvailable() )
686
687 auto enableZoneControlConition =
688 [this] ( const SELECTION& )
689 {
692 };
693
695 ENABLE( enableZoneControlConition )
698 ENABLE( enableZoneControlConition )
701 ENABLE( enableZoneControlConition )
704 ENABLE( enableZoneControlConition )
706
708
709 auto constrainedDrawingModeCond =
710 [this]( const SELECTION& )
711 {
713 };
714
715 auto enableBoardSetupCondition =
716 [this] ( const SELECTION& )
717 {
718 if( DRC_TOOL* tool = m_toolManager->GetTool<DRC_TOOL>() )
719 return !tool->IsDRCDialogShown();
720
721 return true;
722 };
723
724 auto boardFlippedCond =
725 [this]( const SELECTION& )
726 {
727 return GetCanvas()->GetView()->IsMirroredX();
728 };
729
730 auto layerManagerCond =
731 [this] ( const SELECTION& )
732 {
733 return LayerManagerShown();
734 };
735
736 auto propertiesCond =
737 [this] ( const SELECTION& )
738 {
739 return PropertiesShown();
740 };
741
742 auto searchPaneCond =
743 [this] ( const SELECTION& )
744 {
745 return m_auimgr.GetPane( SearchPaneName() ).IsShown();
746 };
747
748 auto highContrastCond =
749 [this] ( const SELECTION& )
750 {
752 };
753
754 auto globalRatsnestCond =
755 [this] (const SELECTION& )
756 {
758 };
759
760 auto curvedRatsnestCond =
761 [this] (const SELECTION& )
762 {
764 };
765
766 auto netHighlightCond =
767 [this]( const SELECTION& )
768 {
770 return !settings->GetHighlightNetCodes().empty();
771 };
772
773 auto enableNetHighlightCond =
774 [this]( const SELECTION& )
775 {
777 return tool->IsNetHighlightSet();
778 };
779
780 mgr->SetConditions( PCB_ACTIONS::toggleHV45Mode, CHECK( constrainedDrawingModeCond ) );
781 mgr->SetConditions( ACTIONS::highContrastMode, CHECK( highContrastCond ) );
782 mgr->SetConditions( PCB_ACTIONS::flipBoard, CHECK( boardFlippedCond ) );
783 mgr->SetConditions( PCB_ACTIONS::showLayersManager, CHECK( layerManagerCond ) );
784 mgr->SetConditions( PCB_ACTIONS::showRatsnest, CHECK( globalRatsnestCond ) );
785 mgr->SetConditions( PCB_ACTIONS::ratsnestLineMode, CHECK( curvedRatsnestCond ) );
786 mgr->SetConditions( PCB_ACTIONS::toggleNetHighlight, CHECK( netHighlightCond )
787 .Enable( enableNetHighlightCond ) );
788 mgr->SetConditions( PCB_ACTIONS::boardSetup, ENABLE( enableBoardSetupCondition ) );
789 mgr->SetConditions( PCB_ACTIONS::showProperties, CHECK( propertiesCond ) );
790 mgr->SetConditions( PCB_ACTIONS::showSearch, CHECK( searchPaneCond ) );
791
792 auto isHighlightMode =
793 [this]( const SELECTION& )
794 {
796 return tool->GetRouterMode() == PNS::RM_MarkObstacles;
797 };
798
799 auto isShoveMode =
800 [this]( const SELECTION& )
801 {
803 return tool->GetRouterMode() == PNS::RM_Shove;
804 };
805
806 auto isWalkaroundMode =
807 [this]( const SELECTION& )
808 {
810 return tool->GetRouterMode() == PNS::RM_Walkaround;
811 };
812
813 mgr->SetConditions( PCB_ACTIONS::routerHighlightMode, CHECK( isHighlightMode ) );
814 mgr->SetConditions( PCB_ACTIONS::routerShoveMode, CHECK( isShoveMode ) );
815 mgr->SetConditions( PCB_ACTIONS::routerWalkaroundMode, CHECK( isWalkaroundMode ) );
816
817 auto haveNetCond =
818 [] ( const SELECTION& aSel )
819 {
820 for( EDA_ITEM* item : aSel )
821 {
822 if( BOARD_CONNECTED_ITEM* bci = dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) )
823 {
824 if( bci->GetNetCode() > 0 )
825 return true;
826 }
827 }
828
829 return false;
830 };
831
836
847
848
851
854
855 mgr->SetConditions( PCB_ACTIONS::zoneDuplicate, ENABLE( singleZoneCond ) );
856 mgr->SetConditions( PCB_ACTIONS::drawZoneCutout, ENABLE( singleZoneCond ) );
857 mgr->SetConditions( PCB_ACTIONS::drawSimilarZone, ENABLE( singleZoneCond ) );
858 mgr->SetConditions( PCB_ACTIONS::zoneMerge, ENABLE( zoneMergeCond ) );
861
863
864#define CURRENT_TOOL( action ) mgr->SetConditions( action, CHECK( cond.CurrentTool( action ) ) )
865
866 // These tools can be used at any time to inspect the board
871
872
873 auto isDrcRunning =
874 [this] ( const SELECTION& )
875 {
877 return !tool->IsDRCRunning();
878 };
879
880#define CURRENT_EDIT_TOOL( action ) mgr->SetConditions( action, ACTION_CONDITIONS().Check( cond.CurrentTool( action ) ).Enable( isDrcRunning ) )
881
882 // These tools edit the board, so they must be disabled during some operations
908
914
915#undef CURRENT_TOOL
916#undef CURRENT_EDIT_TOOL
917#undef ENABLE
918#undef CHECK
919}
920
921
922void PCB_EDIT_FRAME::OnQuit( wxCommandEvent& event )
923{
924 if( event.GetId() == wxID_EXIT )
925 Kiway().OnKiCadExit();
926
927 if( event.GetId() == wxID_CLOSE || Kiface().IsSingle() )
928 Close( false );
929}
930
931
933{
935 bds.m_DrcExclusions.clear();
936
937 for( PCB_MARKER* marker : GetBoard()->Markers() )
938 {
939 if( marker->GetSeverity() == RPT_SEVERITY_EXCLUSION )
940 bds.m_DrcExclusions.insert( marker->Serialize() );
941 }
942}
943
944
946{
947 BOARD_COMMIT commit( this );
948
949 for( PCB_MARKER* marker : GetBoard()->ResolveDRCExclusions() )
950 {
951 if( marker->GetMarkerType() == MARKER_BASE::MARKER_DRAWING_SHEET )
952 marker->GetRCItem()->SetItems( GetCanvas()->GetDrawingSheet() );
953
954 commit.Add( marker );
955 }
956
957 commit.Push( wxEmptyString, SKIP_UNDO | SKIP_SET_DIRTY | SKIP_CONNECTIVITY );
958
959 for( PCB_MARKER* marker : GetBoard()->Markers() )
960 {
961 if( marker->GetSeverity() == RPT_SEVERITY_EXCLUSION )
962 {
963 GetCanvas()->GetView()->Remove( marker );
964 GetCanvas()->GetView()->Add( marker );
965 }
966 }
967
969}
970
971
972bool PCB_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
973{
974 // Shutdown blocks must be determined and vetoed as early as possible
975 if( KIPLATFORM::APP::SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION
976 && IsContentModified() )
977 {
978 return false;
979 }
980
981 if( Kiface().IsSingle() )
982 {
983 auto* fpEditor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_FOOTPRINT_EDITOR, false );
984
985 if( fpEditor && !fpEditor->Close() ) // Can close footprint editor?
986 return false;
987
988 auto* fpViewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_FOOTPRINT_VIEWER, false );
989
990 if( fpViewer && !fpViewer->Close() ) // Can close footprint viewer?
991 return false;
992
994
995 if( fpViewer && !fpViewer->Close() ) // Can close modal footprint viewer?
996 return false;
997 }
998 else
999 {
1000 auto* fpEditor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_FOOTPRINT_EDITOR, false );
1001
1002 if( fpEditor && fpEditor->IsCurrentFPFromBoard() )
1003 {
1004 if( !fpEditor->CanCloseFPFromBoard( true ) )
1005 return false;
1006 }
1007 }
1008
1009 if( IsContentModified() )
1010 {
1011 wxFileName fileName = GetBoard()->GetFileName();
1012 wxString msg = _( "Save changes to '%s' before closing?" );
1013
1014 if( !HandleUnsavedChanges( this, wxString::Format( msg, fileName.GetFullName() ),
1015 [&]() -> bool
1016 {
1017 return Files_io_from_id( ID_SAVE_BOARD );
1018 } ) )
1019 {
1020 return false;
1021 }
1022 }
1023
1024 // Close modeless dialogs. They're trouble when they get destroyed after the frame and/or
1025 // board.
1026 wxWindow* open_dlg = wxWindow::FindWindowByName( DIALOG_DRC_WINDOW_NAME );
1027
1028 if( open_dlg )
1029 open_dlg->Close( true );
1030
1031 return PCB_BASE_EDIT_FRAME::canCloseWindow( aEvent );
1032}
1033
1034
1036{
1037 // On Windows 7 / 32 bits, on OpenGL mode only, Pcbnew crashes
1038 // when closing this frame if a footprint was selected, and the footprint editor called
1039 // to edit this footprint, and when closing pcbnew if this footprint is still selected
1040 // See https://bugs.launchpad.net/kicad/+bug/1655858
1041 // I think this is certainly a OpenGL event fired after frame deletion, so this workaround
1042 // avoid the crash (JPC)
1043 GetCanvas()->SetEvtHandlerEnabled( false );
1044
1046
1047 // Delete the auto save file if it exists.
1048 wxFileName fn = GetBoard()->GetFileName();
1049
1050 // Auto save file name is the normal file name prefixed with 'GetAutoSaveFilePrefix()'.
1051 fn.SetName( GetAutoSaveFilePrefix() + fn.GetName() );
1052
1053 // When the auto save feature does not have write access to the board file path, it falls
1054 // back to a platform specific user temporary file path.
1055 if( !fn.IsOk() || !fn.IsDirWritable() )
1056 fn.SetPath( wxFileName::GetTempDir() );
1057
1058 wxLogTrace( traceAutoSave, wxT( "Deleting auto save file <" ) + fn.GetFullPath() + wxT( ">" ) );
1059
1060 // Remove the auto save file on a normal close of Pcbnew.
1061 if( fn.FileExists() && !wxRemoveFile( fn.GetFullPath() ) )
1062 {
1063 wxString msg = wxString::Format( _( "The auto save file '%s' could not be removed!" ),
1064 fn.GetFullPath() );
1065 wxMessageBox( msg, Pgm().App().GetAppName(), wxOK | wxICON_ERROR, this );
1066 }
1067
1068 // Make sure local settings are persisted
1070
1071 // Do not show the layer manager during closing to avoid flicker
1072 // on some platforms (Windows) that generate useless redraw of items in
1073 // the Layer Manager
1075 {
1076 m_auimgr.GetPane( "LayersManager" ).Show( false );
1077 m_auimgr.GetPane( "TabbedPanel" ).Show( false );
1078 }
1079
1080 // Unlink the old project if needed
1082
1083 // Delete board structs and undo/redo lists, to avoid crash on exit
1084 // when deleting some structs (mainly in undo/redo lists) too late
1085 Clear_Pcb( false, true );
1086
1087 // do not show the window because ScreenPcb will be deleted and we do not
1088 // want any paint event
1089 Show( false );
1090
1092}
1093
1094
1096{
1099 GetCanvas()->Refresh();
1100}
1101
1102
1103void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage )
1104{
1105 // Make sure everything's up-to-date
1107
1108 DIALOG_BOARD_SETUP dlg( this );
1109
1110 if( !aInitialPage.IsEmpty() )
1111 dlg.SetInitialPage( aInitialPage, wxEmptyString );
1112
1113 if( dlg.ShowQuasiModal() == wxID_OK )
1114 {
1117
1118 Kiway().CommonSettingsChanged( false, true );
1119
1120 PCBNEW_SETTINGS* settings = GetPcbNewSettings();
1121 static LSET maskAndPasteLayers = LSET( 4, F_Mask, F_Paste, B_Mask, B_Paste );
1122
1123 bool maskOrPasteVisible = ( GetBoard()->GetVisibleLayers() & maskAndPasteLayers ).any();
1124
1126 [&]( KIGFX::VIEW_ITEM* aItem ) -> bool
1127 {
1128 if( dynamic_cast<PCB_TRACK*>( aItem ) )
1129 {
1131 }
1132 else if( dynamic_cast<PAD*>( aItem ) )
1133 {
1134 return settings->m_Display.m_PadClearance || maskOrPasteVisible;
1135 }
1136 else if( dynamic_cast<EDA_TEXT*>( aItem ) )
1137 {
1138 EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem );
1139
1140 return text->HasTextVars();
1141 }
1142
1143 return false;
1144 } );
1145
1146 GetCanvas()->Refresh();
1147
1151
1152 //this event causes the routing tool to reload its design rules information
1154 toolEvent.SetHasPosition( false );
1155 m_toolManager->ProcessEvent( toolEvent );
1156 }
1157
1158 GetCanvas()->SetFocus();
1159}
1160
1161
1163{
1165
1166 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
1167 wxASSERT( cfg );
1168
1169 if( cfg )
1170 {
1174 }
1175}
1176
1177
1179{
1181
1182 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
1183 wxASSERT( cfg );
1184
1185 if( cfg )
1186 {
1191 // ensure m_show_search is up to date (the pane can be closed)
1192 m_show_search = m_auimgr.GetPane( SearchPaneName() ).IsShown();
1194 }
1195}
1196
1197
1199{
1200 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( config() );
1201
1202 return cfg ? cfg->m_RotationAngle : ANGLE_90;
1203}
1204
1205
1207{
1209}
1210
1211
1213{
1214
1215 GetColorSettings()->SetColor( LAYER_GRID, aColor );
1216 GetCanvas()->GetGAL()->SetGridColor( aColor );
1217}
1218
1219
1221{
1222 PCB_LAYER_ID oldLayer = GetActiveLayer();
1223
1224 if( oldLayer == aLayer )
1225 return;
1226
1228
1230
1231 m_toolManager->RunAction( PCB_ACTIONS::layerChanged ); // notify other tools
1232 GetCanvas()->SetFocus(); // allow capture of hotkeys
1233 GetCanvas()->SetHighContrastLayer( aLayer );
1234
1236 [&]( KIGFX::VIEW_ITEM* aItem ) -> bool
1237 {
1238 if( PCB_VIA* via = dynamic_cast<PCB_VIA*>( aItem ) )
1239 {
1240 // Vias on a restricted layer set must be redrawn when the active layer
1241 // is changed
1242 return ( via->GetViaType() == VIATYPE::BLIND_BURIED ||
1243 via->GetViaType() == VIATYPE::MICROVIA );
1244 }
1245 else if( PAD* pad = dynamic_cast<PAD*>( aItem ) )
1246 {
1247 // Clearances could be layer-dependent so redraw them when the active layer
1248 // is changed
1249 if( GetPcbNewSettings()->m_Display.m_PadClearance )
1250 {
1251 // Round-corner rects are expensive to draw, but are mostly found on
1252 // SMD pads which only need redrawing on an active-to-not-active
1253 // switch.
1254 if( pad->GetAttribute() == PAD_ATTRIB::SMD )
1255 {
1256 if( ( oldLayer == F_Cu || aLayer == F_Cu ) && pad->IsOnLayer( F_Cu ) )
1257 return true;
1258
1259 if( ( oldLayer == B_Cu || aLayer == B_Cu ) && pad->IsOnLayer( B_Cu ) )
1260 return true;
1261 }
1262
1263 return true;
1264 }
1265 }
1266 else if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( aItem ) )
1267 {
1268 // Clearances could be layer-dependent so redraw them when the active layer
1269 // is changed
1270 if( GetPcbNewSettings()->m_Display.m_TrackClearance )
1271 {
1272 // Tracks aren't particularly expensive to draw, but it's an easy check.
1273 return track->IsOnLayer( oldLayer ) || track->IsOnLayer( aLayer );
1274 }
1275 }
1276
1277 return false;
1278 } );
1279
1280 GetCanvas()->Refresh();
1281}
1282
1283
1285{
1286 // JEY TODO: move this global to the board
1288
1289 layerEnum.Choices().Clear();
1290 layerEnum.Undefined( UNDEFINED_LAYER );
1291
1292 for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
1293 {
1294 // Canonical name
1295 layerEnum.Map( *seq, LSET::Name( *seq ) );
1296
1297 // User name
1298 layerEnum.Map( *seq, GetBoard()->GetLayerName( *seq ) );
1299 }
1300
1301 DRC_TOOL* drcTool = m_toolManager->GetTool<DRC_TOOL>();
1302
1303 try
1304 {
1305 drcTool->GetDRCEngine()->InitEngine( GetDesignRulesPath() );
1306 }
1307 catch( PARSE_ERROR& )
1308 {
1309 // Not sure this is the best place to tell the user their rules are buggy, so
1310 // we'll stay quiet for now. Feel free to revisit this decision....
1311 }
1312
1313 UpdateTitle();
1314
1315 wxFileName fn = GetBoard()->GetFileName();
1316
1317 // Display a warning that the file is read only
1318 if( fn.FileExists() && !fn.IsFileWritable() )
1319 {
1322 m_infoBar->ShowMessage( _( "Board file is read only." ),
1324 }
1325
1327
1328 // Sync layer and item visibility
1330
1331 SetElementVisibility( LAYER_RATSNEST, GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
1332
1334
1335 // Apply saved display state to the appearance panel after it has been set up
1336 PROJECT_LOCAL_SETTINGS& localSettings = Prj().GetLocalSettings();
1337
1339
1340 if( GetBoard()->GetDesignSettings().IsLayerEnabled( localSettings.m_ActiveLayer ) )
1341 SetActiveLayer( localSettings.m_ActiveLayer );
1342
1343 // Updates any auto dimensions and the auxiliary toolbar tracks/via sizes
1345
1346 // Display the loaded board:
1347 Zoom_Automatique( false );
1348
1349 // Invalidate painting as loading the DRC engine will cause clearances to become valid
1351
1352 Refresh();
1353
1354 SetMsgPanel( GetBoard() );
1355 SetStatusText( wxEmptyString );
1356
1357 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "PCB file changes are unsaved" ) );
1358}
1359
1360
1362{
1364}
1365
1366
1368{
1369 return GetBoard()->IsElementVisible( aElement );
1370}
1371
1372
1374{
1375 // Force the RATSNEST visible
1376 if( aElement == LAYER_RATSNEST )
1377 GetCanvas()->GetView()->SetLayerVisible( aElement, true );
1378 else
1379 GetCanvas()->GetView()->SetLayerVisible( aElement , aNewState );
1380
1381 GetBoard()->SetElementVisibility( aElement, aNewState );
1382}
1383
1384
1386{
1387 // call my base class
1389
1390 m_auimgr.GetPane( m_appearancePanel ).Caption( _( "Appearance" ) );
1391 m_auimgr.GetPane( m_selectionFilterPanel ).Caption( _( "Selection Filter" ) );
1392 m_auimgr.GetPane( m_propertiesPanel ).Caption( _( "Properties" ) );
1393 m_auimgr.Update();
1394
1397
1398 UpdateTitle();
1399}
1400
1401
1403{
1405
1406 if( project.m_PcbLastPath[ aType ].IsEmpty() )
1407 return wxEmptyString;
1408
1409 wxFileName absoluteFileName = project.m_PcbLastPath[ aType ];
1410 wxFileName pcbFileName = GetBoard()->GetFileName();
1411
1412 absoluteFileName.MakeAbsolute( pcbFileName.GetPath() );
1413 return absoluteFileName.GetFullPath();
1414}
1415
1416
1417void PCB_EDIT_FRAME::SetLastPath( LAST_PATH_TYPE aType, const wxString& aLastPath )
1418{
1420
1421 wxFileName relativeFileName = aLastPath;
1422 wxFileName pcbFileName = GetBoard()->GetFileName();
1423
1424 relativeFileName.MakeRelativeTo( pcbFileName.GetPath() );
1425
1426 if( relativeFileName.GetFullPath() != project.m_PcbLastPath[ aType ] )
1427 {
1428 project.m_PcbLastPath[ aType ] = relativeFileName.GetFullPath();
1430 }
1431}
1432
1433
1435{
1437
1438 Update3DView( true, GetPcbNewSettings()->m_Display.m_Live3DRefresh );
1439
1440 if( !GetTitle().StartsWith( wxT( "*" ) ) )
1441 UpdateTitle();
1442
1443 m_ZoneFillsDirty = true;
1444}
1445
1446
1448{
1449 Update3DView( true, true );
1450}
1451
1452
1453void PCB_EDIT_FRAME::ExportSVG( wxCommandEvent& event )
1454{
1455 InvokeExportSVG( this, GetBoard() );
1456}
1457
1458
1460{
1461 wxFileName fn = GetBoard()->GetFileName();
1462 bool readOnly = false;
1463 bool unsaved = false;
1464
1465 if( fn.IsOk() && fn.FileExists() )
1466 readOnly = !fn.IsFileWritable();
1467 else
1468 unsaved = true;
1469
1470 wxString title;
1471
1472 if( IsContentModified() )
1473 title = wxT( "*" );
1474
1475 title += fn.GetName();
1476
1477 if( readOnly )
1478 title += wxS( " " ) + _( "[Read Only]" );
1479
1480 if( unsaved )
1481 title += wxS( " " ) + _( "[Unsaved]" );
1482
1483 title += wxT( " \u2014 " ) + _( "PCB Editor" );
1484
1485 SetTitle( title );
1486}
1487
1488
1490{
1491 // Update the layer manager and other widgets from the board setup
1492 // (layer and items visibility, colors ...)
1493
1494 // Rebuild list of nets (full ratsnest rebuild)
1496
1497 // Update info shown by the horizontal toolbars
1499
1500 LSET activeLayers = GetBoard()->GetEnabledLayers();
1501
1502 if( !activeLayers.test( GetActiveLayer() ) )
1503 SetActiveLayer( activeLayers.Seq().front() );
1504
1506
1508
1509 layerEnum.Choices().Clear();
1510 layerEnum.Undefined( UNDEFINED_LAYER );
1511
1512 for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
1513 {
1514 // Canonical name
1515 layerEnum.Map( *seq, LSET::Name( *seq ) );
1516
1517 // User name
1518 layerEnum.Map( *seq, GetBoard()->GetLayerName( *seq ) );
1519 }
1520
1521 // Sync visibility with canvas
1522 KIGFX::VIEW* view = GetCanvas()->GetView();
1523 LSET visible = GetBoard()->GetVisibleLayers();
1524
1525 for( PCB_LAYER_ID layer : LSET::AllLayersMask().Seq() )
1526 view->SetLayerVisible( layer, visible.Contains( layer ) );
1527
1528 // Stackup and/or color theme may have changed
1530}
1531
1532
1534{
1535 // switches currently used canvas (Cairo / OpenGL).
1536 PCB_BASE_FRAME::SwitchCanvas( aCanvasType );
1537}
1538
1539
1541{
1542 if( !m_findDialog )
1543 {
1544 m_findDialog = new DIALOG_FIND( this );
1547 }
1548
1549 wxString findString;
1550
1551 PCB_SELECTION& selection = m_toolManager->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1552
1553 if( selection.Size() == 1 )
1554 {
1555 EDA_ITEM* front = selection.Front();
1556
1557 switch( front->Type() )
1558 {
1559 case PCB_FOOTPRINT_T:
1560 findString = static_cast<FOOTPRINT*>( front )->GetValue();
1561 break;
1562
1563 case PCB_FP_TEXT_T:
1564 findString = static_cast<FP_TEXT*>( front )->GetShownText();
1565 break;
1566
1567 case PCB_TEXT_T:
1568 findString = static_cast<PCB_TEXT*>( front )->GetShownText();
1569
1570 if( findString.Contains( wxT( "\n" ) ) )
1571 findString = findString.Before( '\n' );
1572
1573 break;
1574
1575 default:
1576 break;
1577 }
1578 }
1579
1580 m_findDialog->Preload( findString );
1581
1582 m_findDialog->Show( true );
1583}
1584
1585
1587{
1588 if( !m_findDialog )
1590
1592}
1593
1594
1596{
1597 PCB_PLOT_PARAMS plotSettings = GetPlotSettings();
1598
1599 switch( aID )
1600 {
1601 case ID_GEN_PLOT_GERBER:
1602 plotSettings.SetFormat( PLOT_FORMAT::GERBER );
1603 break;
1604 case ID_GEN_PLOT_DXF:
1605 plotSettings.SetFormat( PLOT_FORMAT::DXF );
1606 break;
1607 case ID_GEN_PLOT_HPGL:
1608 plotSettings.SetFormat( PLOT_FORMAT::HPGL );
1609 break;
1610 case ID_GEN_PLOT_PDF:
1611 plotSettings.SetFormat( PLOT_FORMAT::PDF );
1612 break;
1613 case ID_GEN_PLOT_PS:
1614 plotSettings.SetFormat( PLOT_FORMAT::POST );
1615 break;
1616 case ID_GEN_PLOT:
1617 /* keep the previous setup */
1618 break;
1619 default:
1620 wxFAIL_MSG( wxT( "ToPlotter(): unexpected plot type" ) ); break;
1621 break;
1622 }
1623
1624 SetPlotSettings( plotSettings );
1625
1626 DIALOG_PLOT dlg( this );
1627 dlg.ShowQuasiModal( );
1628}
1629
1630
1632{
1633 if( Kiface().IsSingle() )
1634 return 0;
1635
1636 // Update PCB requires a netlist. Therefore the schematic editor must be running
1637 // If this is not the case, open the schematic editor
1638 KIWAY_PLAYER* frame = Kiway().Player( FRAME_SCH, true );
1639
1640 // If Kiway() cannot create the eeschema frame, it shows a error message, and
1641 // frame is null
1642 if( !frame )
1643 return -1;
1644
1645 if( !frame->IsShown() )
1646 {
1647 wxFileName fn( Prj().GetProjectPath(), Prj().GetProjectName(),
1649
1650 // Maybe the file hasn't been converted to the new s-expression file format so
1651 // see if the legacy schematic file is still in play.
1652 if( !fn.FileExists() )
1653 {
1654 fn.SetExt( LegacySchematicFileExtension );
1655
1656 if( !fn.FileExists() )
1657 {
1658 DisplayError( this, _( "The schematic for this board cannot be found." ) );
1659 return -2;
1660 }
1661 }
1662
1663 frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
1664
1665 // we show the schematic editor frame, because do not show is seen as
1666 // a not yet opened schematic by Kicad manager, which is not the case
1667 frame->Show( true );
1668
1669 // bring ourselves back to the front
1670 Raise();
1671 }
1672
1673 return 1; //Success!
1674}
1675
1676
1678 const wxString& aAnnotateMessage )
1679{
1680 if( TestStandalone() == 0 )
1681 {
1682 DisplayErrorMessage( this, _( "Cannot update the PCB because PCB editor is opened in "
1683 "stand-alone mode. In order to create or update PCBs from "
1684 "schematics, you must launch the KiCad project manager and "
1685 "create a project." ) );
1686 return false; // Not in standalone mode
1687 }
1688
1689 if( TestStandalone() < 0 ) // Problem with Eeschema or the schematic
1690 return false;
1691
1692 Raise(); // Show
1693
1694 std::string payload( aAnnotateMessage );
1695
1696 Kiway().ExpressMail( FRAME_SCH, MAIL_SCH_GET_NETLIST, payload, this );
1697
1698 if( payload == aAnnotateMessage )
1699 {
1700 Raise();
1701 DisplayErrorMessage( this, aAnnotateMessage );
1702 return false;
1703 }
1704
1705 try
1706 {
1707 auto lineReader = new STRING_LINE_READER( payload, _( "Eeschema netlist" ) );
1708 KICAD_NETLIST_READER netlistReader( lineReader, &aNetlist );
1709 netlistReader.LoadNetlist();
1710 }
1711 catch( const IO_ERROR& e )
1712 {
1713 Raise();
1714
1715 // Do not translate extra_info strings. These are for developers
1716 wxString extra_info = e.Problem() + wxT( " : " ) + e.What() + wxT( " at " ) + e.Where();
1717
1718 DisplayErrorMessage( this, _( "Received an error while reading netlist. Please "
1719 "report this issue to the KiCad team using the menu "
1720 "Help->Report Bug."), extra_info );
1721 return false;
1722 }
1723
1724 return true;
1725}
1726
1727
1729{
1730 wxString msg;
1731 wxFileName schematic( Prj().GetProjectPath(), Prj().GetProjectName(),
1733
1734 if( !schematic.FileExists() )
1735 {
1736 wxFileName legacySchematic( Prj().GetProjectPath(), Prj().GetProjectName(),
1738
1739 if( legacySchematic.FileExists() )
1740 {
1741 schematic = legacySchematic;
1742 }
1743 else
1744 {
1745 msg.Printf( _( "Schematic file '%s' not found." ), schematic.GetFullPath() );
1746 wxMessageBox( msg, _( "KiCad Error" ), wxOK | wxICON_ERROR, this );
1747 return;
1748 }
1749 }
1750
1751 if( Kiface().IsSingle() )
1752 {
1753 ExecuteFile( EESCHEMA_EXE, schematic.GetFullPath() );
1754 }
1755 else
1756 {
1757 KIWAY_PLAYER* frame = Kiway().Player( FRAME_SCH, false );
1758
1759 // Please: note: DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers() calls
1760 // Kiway.Player( FRAME_SCH, true )
1761 // therefore, the schematic editor is sometimes running, but the schematic project
1762 // is not loaded, if the library editor was called, and the dialog field editor was used.
1763 // On Linux, it happens the first time the schematic editor is launched, if
1764 // library editor was running, and the dialog field editor was open
1765 // On Windows, it happens always after the library editor was called,
1766 // and the dialog field editor was used
1767 if( !frame )
1768 {
1769 try
1770 {
1771 frame = Kiway().Player( FRAME_SCH, true );
1772 }
1773 catch( const IO_ERROR& err )
1774 {
1775 wxMessageBox( _( "Eeschema failed to load." ) + wxS( "\n" ) + err.What(),
1776 _( "KiCad Error" ), wxOK | wxICON_ERROR, this );
1777 return;
1778 }
1779 }
1780
1781 // If Kiway() cannot create the eeschema frame, it shows a error message, and
1782 // frame is null
1783 if( !frame )
1784 return;
1785
1786 if( !frame->IsShown() ) // the frame exists, (created by the dialog field editor)
1787 // but no project loaded.
1788 {
1789 frame->OpenProjectFiles( std::vector<wxString>( 1, schematic.GetFullPath() ) );
1790 frame->Show( true );
1791 }
1792
1793 // On Windows, Raise() does not bring the window on screen, when iconized or not shown
1794 // On Linux, Raise() brings the window on screen, but this code works fine
1795 if( frame->IsIconized() )
1796 {
1797 frame->Iconize( false );
1798 // If an iconized frame was created by Pcbnew, Iconize( false ) is not enough
1799 // to show the frame at its normal size: Maximize should be called.
1800 frame->Maximize( false );
1801 }
1802
1803 frame->Raise();
1804 }
1805}
1806
1807
1809{
1810 const ENV_VAR_MAP& vars = Pgm().GetLocalEnvVariables();
1811
1812 // Set the environment variables for python scripts
1813 // note: the string will be encoded UTF8 for python env
1814 for( const std::pair<const wxString, ENV_VAR_ITEM>& var : vars )
1815 UpdatePythonEnvVar( var.first, var.second.GetValue() );
1816
1817 // Because the env vars can be modified by the python scripts (rewritten in UTF8),
1818 // regenerate them (in Unicode) for our normal environment
1819 for( const std::pair<const wxString, ENV_VAR_ITEM>& var : vars )
1820 wxSetEnv( var.first, var.second.GetValue() );
1821}
1822
1823
1825{
1826 wxString evValue;
1827 wxGetEnv( PROJECT_VAR_NAME, &evValue );
1828 UpdatePythonEnvVar( wxString( PROJECT_VAR_NAME ).ToStdString(), evValue );
1829
1830 // Because PROJECT_VAR_NAME can be modified by the python scripts (rewritten in UTF8),
1831 // regenerate it (in Unicode) for our normal environment
1832 wxSetEnv( PROJECT_VAR_NAME, evValue );
1833}
1834
1835
1837{
1838 if( aFootprint == nullptr )
1839 return;
1840
1842
1843 /*
1844 * Make sure dlg is destroyed before GetCanvas->Refresh is called
1845 * later or the refresh will try to modify its properties since
1846 * they share a GL context.
1847 */
1848 {
1849 DIALOG_FOOTPRINT_PROPERTIES dlg( this, aFootprint );
1850
1851 dlg.ShowModal();
1852 retvalue = dlg.GetReturnValue();
1853 }
1854
1855 /*
1856 * retvalue =
1857 * FP_PROPS_UPDATE_FP to show Update Footprints dialog
1858 * FP_PROPS_CHANGE_FP to show Change Footprints dialog
1859 * FP_PROPS_OK for normal edit
1860 * FP_PROPS_CANCEL if aborted
1861 * FP_PROPS_EDIT_BOARD_FP to load board footprint into Footprint Editor
1862 * FP_PROPS_EDIT_LIBRARY_FP to load library footprint into Footprint Editor
1863 */
1864
1866 {
1867 // If something edited, push a refresh request
1868 GetCanvas()->Refresh();
1869 }
1871 {
1873
1874 editor->LoadFootprintFromBoard( aFootprint );
1875
1876 editor->Show( true );
1877 editor->Raise(); // Iconize( false );
1878 }
1879
1881 {
1883
1884 editor->LoadFootprintFromLibrary( aFootprint->GetFPID() );
1885
1886 editor->Show( true );
1887 editor->Raise(); // Iconize( false );
1888 }
1889
1891 {
1892 ShowExchangeFootprintsDialog( aFootprint, true, true );
1893 }
1894
1896 {
1897 ShowExchangeFootprintsDialog( aFootprint, false, true );
1898 }
1899}
1900
1901
1903 bool aSelectedMode )
1904{
1905 DIALOG_EXCHANGE_FOOTPRINTS dialog( this, aFootprint, aUpdateMode, aSelectedMode );
1906
1907 return dialog.ShowQuasiModal();
1908}
1909
1910
1911void PCB_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
1912{
1913 PCB_BASE_EDIT_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
1914
1916
1917 KIGFX::PCB_VIEW* view = GetCanvas()->GetView();
1918 KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view->GetPainter() );
1919 KIGFX::PCB_RENDER_SETTINGS* renderSettings = painter->GetSettings();
1920
1921 renderSettings->LoadDisplayOptions( GetDisplayOptions() );
1922
1923 SetElementVisibility( LAYER_RATSNEST, GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
1924
1926
1927 // Netclass definitions could have changed, either by us or by Eeschema, so we need to
1928 // recompile the implicit rules
1929 DRC_TOOL* drcTool = m_toolManager->GetTool<DRC_TOOL>();
1930 WX_INFOBAR* infobar = GetInfoBar();
1931
1932 try
1933 {
1934 drcTool->GetDRCEngine()->InitEngine( GetDesignRulesPath() );
1935
1936 if( infobar->GetMessageType() == WX_INFOBAR::MESSAGE_TYPE::DRC_RULES_ERROR )
1937 infobar->Dismiss();
1938 }
1939 catch( PARSE_ERROR& )
1940 {
1941 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, _( "Edit design rules" ),
1942 wxEmptyString );
1943
1944 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
1945 [&]( wxHyperlinkEvent& aEvent )
1946 {
1947 ShowBoardSetupDialog( _( "Custom Rules" ) );
1948 } ) );
1949
1950 infobar->RemoveAllButtons();
1951 infobar->AddButton( button );
1952 infobar->AddCloseButton();
1953 infobar->ShowMessage( _( "Could not compile custom design rules." ), wxICON_ERROR,
1955 }
1956
1959
1960 // Update the environment variables in the Python interpreter
1961 if( aEnvVarsChanged )
1963
1964 Layout();
1965 SendSizeEvent();
1966}
1967
1968
1970{
1972}
1973
1974
1976{
1978}
1979
1980
1981bool ExportBoardToHyperlynx( BOARD* aBoard, const wxFileName& aPath );
1982
1983
1984void PCB_EDIT_FRAME::OnExportHyperlynx( wxCommandEvent& event )
1985{
1986 wxString wildcard = wxT( "*.hyp" );
1987 wxFileName fn = GetBoard()->GetFileName();
1988
1989 fn.SetExt( wxT("hyp") );
1990
1991 wxFileDialog dlg( this, _( "Export Hyperlynx Layout" ), fn.GetPath(), fn.GetFullName(),
1992 wildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
1993
1994 if( dlg.ShowModal() != wxID_OK )
1995 return;
1996
1997 fn = dlg.GetPath();
1998
1999 // always enforce filename extension, user may not have entered it.
2000 fn.SetExt( wxT( "hyp" ) );
2001
2003}
2004
2005
2007{
2008 return GetBoard()->GetFileName();
2009}
2010
2011
2013{
2014 return m_auimgr.GetPane( "LayersManager" ).IsShown();
2015}
2016
2017
2019{
2020 return m_auimgr.GetPane( "PropertiesManager" ).IsShown();
2021}
2022
2023
2024void PCB_EDIT_FRAME::onSize( wxSizeEvent& aEvent )
2025{
2026 if( IsShown() )
2027 {
2028 // We only need this until the frame is done resizing and the final client size is
2029 // established.
2030 Unbind( wxEVT_SIZE, &PCB_EDIT_FRAME::onSize, this );
2032 }
2033
2034 // Skip() is called in the base class.
2035 EDA_DRAW_FRAME::OnSize( aEvent );
2036}
Class PCBNEW_ACTION_PLUGINS.
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:105
@ icon_pcbnew_32
@ icon_pcbnew_16
#define SKIP_CONNECTIVITY
Definition: board_commit.h:42
#define SKIP_SET_DIRTY
Definition: board_commit.h:41
#define SKIP_UNDO
Definition: board_commit.h:39
@ NORMAL
Inactive layers are shown normally (no high-contrast mode)
static TOOL_ACTION toggleGrid
Definition: actions.h:143
static TOOL_ACTION paste
Definition: actions.h:69
static TOOL_ACTION millimetersUnits
Definition: actions.h:149
static TOOL_ACTION togglePolarCoords
Definition: actions.h:152
static TOOL_ACTION copy
Definition: actions.h:68
static TOOL_ACTION pasteSpecial
Definition: actions.h:70
static TOOL_ACTION milsUnits
Definition: actions.h:148
static TOOL_ACTION toggleBoundingBoxes
Definition: actions.h:107
static TOOL_ACTION showSearch
Definition: actions.h:77
static TOOL_ACTION undo
Definition: actions.h:65
static TOOL_ACTION duplicate
Definition: actions.h:72
static TOOL_ACTION inchesUnits
Definition: actions.h:147
static TOOL_ACTION highContrastMode
Definition: actions.h:105
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:104
static TOOL_ACTION measureTool
Definition: actions.h:157
static TOOL_ACTION doDelete
Definition: actions.h:73
static TOOL_ACTION selectionTool
Definition: actions.h:156
static TOOL_ACTION save
Definition: actions.h:51
static TOOL_ACTION zoomFitScreen
Definition: actions.h:98
static TOOL_ACTION redo
Definition: actions.h:66
static TOOL_ACTION deleteTool
Definition: actions.h:74
static TOOL_ACTION zoomTool
Definition: actions.h:101
static TOOL_ACTION cut
Definition: actions.h:67
static TOOL_ACTION gridSetOrigin
Definition: actions.h:140
static TOOL_ACTION selectAll
Definition: actions.h:71
Manage TOOL_ACTION objects.
void SetConditions(const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
Set the conditions the UI elements for activating a specific tool action should use for determining t...
bool m_ShowPropertiesPanel
Show the properties panel in PcbNew.
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
bool m_ShowEventCounters
Shows debugging event counters in various places.
void ApplyLayerPreset(const wxString &aPresetName)
int GetTabIndex() const
Set the current notebook tab.
void UpdateDisplayOptions()
Return a list of the layer presets created by the user.
void OnColorThemeChanged()
Update the widget when the active board layer is changed.
void OnLanguageChanged()
Update the panel contents from the application and board models.
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:101
Tool responsible for automagic placement of components.
Handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:41
int GetPageCount() const
Definition: base_screen.h:72
bool IsContentModified() const
Definition: base_screen.h:60
const wxString & GetPageNumber() const
Definition: base_screen.cpp:71
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) 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,...
Container for design settings for a BOARD object.
std::set< wxString > m_DrcExclusions
Handle actions specific to the board editor in PcbNew.
Tool for pcb inspection.
Abstract interface for BOARD_ITEMs capable of storing other items inside.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:501
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:515
void BuildListOfNets()
Definition: board.h:742
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition: board.cpp:567
void RemoveAllListeners()
Remove all listeners.
Definition: board.cpp:1985
const PAGE_INFO & GetPageSettings() const
Definition: board.h:624
GAL_SET GetVisibleElements() const
Return a set of all the element categories that are visible.
Definition: board.cpp:561
void SynchronizeNetsAndNetClasses()
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
Definition: board.cpp:1460
TITLE_BLOCK & GetTitleBlock()
Definition: board.h:630
const std::map< wxString, wxString > & GetProperties() const
Definition: board.h:332
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
Definition: board.cpp:162
const wxString & GetFileName() const
Definition: board.h:302
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Change the visibility of an element category.
Definition: board.cpp:573
void ClearProject()
Definition: board.cpp:196
PROJECT * GetProject() const
Definition: board.h:440
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:618
void UpdateRatsnestExclusions()
Update the visibility flags on the current unconnected ratsnest lines.
Definition: board.cpp:240
void BuildConnectivity(PROGRESS_REPORTER *aReporter=nullptr)
Build or rebuild the board connectivity database for the board, especially the list of connected item...
Definition: board.cpp:155
void SetColor(int aLayer, const COLOR4D &aColor)
COLOR4D GetColor(int aLayer) const
COMMIT & Add(EDA_ITEM *aItem)
Notify observers that aItem has been added.
Definition: commit.h:78
Handle actions that are shared between different applications.
Handles action that are shared between different applications.
Definition: common_tools.h:38
void SetCallback(std::function< void(BOARD_ITEM *)> aCallback)
Function to be called on each found event.
Definition: dialog_find.h:63
bool Show(bool show=true) override
The Show method is overridden to make the search combobox focused by default.
void Preload(const wxString &aFindString)
Definition: dialog_find.cpp:99
void FindNext()
Finds the next item.
Definition: dialog_find.h:71
enum FP_PROPS_RETVALUE GetReturnValue()
A dialog to set the plot options and create plot files in various formats.
Definition: dialog_plot.h:40
int ShowQuasiModal()
Tool responsible for drawing graphical elements like lines, arcs, circles, etc.
Definition: drawing_tool.h:51
std::shared_ptr< DRC_ENGINE > GetDRCEngine()
Definition: drc_tool.h:78
bool IsDRCRunning() const
Check to see if the DRC engine is running the tests.
Definition: drc_tool.h:71
void SetSheetCount(int aSheetCount)
Changes the sheet-count number displayed in the title block.
void SetPageNumber(const std::string &aPageNumber)
Changes the page number displayed in the title block.
void SetSheetName(const std::string &aSheetName)
Set the sheet name displayed in the title block.
void SetIsFirstPage(bool aIsFirstPage)
Change if this is first page.
void SetFileName(const std::string &aFileName)
Set the file name displayed in the title block.
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
virtual void ThemeChanged()
Process light/dark theme change.
WX_INFOBAR * m_infoBar
wxAuiManager m_auimgr
static wxString GetAutoSaveFilePrefix()
WX_INFOBAR * GetInfoBar()
void OnSelectGrid(wxCommandEvent &event)
Command event handler for selecting grid sizes.
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Changes the current rendering backend.
virtual void OnSize(wxSizeEvent &event) override
Recalculate the size of toolbars and display panel when the frame size changes.
virtual void OnSelectZoom(wxCommandEvent &event)
Set the zoom factor when selected by the zoom list box in the main tool bar.
virtual wxString GetScreenDesc() const
virtual void Zoom_Automatique(bool aWarpPointer)
Redraw the screen with best zoom level and the best centering that shows all the page or the board.
void OnGridSettings(wxCommandEvent &event)
static constexpr GAL_TYPE GAL_FALLBACK
void StopDrawing()
Prevent the GAL canvas from further drawing until it is recreated or StartDrawing() is called.
void ForceRefresh()
Force a redraw.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
KIGFX::GAL * GetGAL() const
Return a pointer to the GAL instance used in the panel.
void SetFocus() override
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
Specialization of the wxAuiPaneInfo class for KiCad panels.
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:72
SELECTION_CONDITION NoActiveTool()
Create a functor testing if there are no tools active in the frame.
SELECTION_CONDITION BoundingBoxes()
SELECTION_CONDITION RedoAvailable()
Create a functor that tests if there are any items in the redo queue.
SELECTION_CONDITION UndoAvailable()
Create a functor that tests if there are any items in the undo queue.
SELECTION_CONDITION ScriptingConsoleVisible()
Create a functor testing if the python scripting console window is visible.
SELECTION_CONDITION Units(EDA_UNITS aUnit)
Create a functor that tests if the frame has the specified units.
SELECTION_CONDITION GridVisible()
Create a functor testing if the grid is visible in a frame.
SELECTION_CONDITION PolarCoordinates()
Create a functor testing if polar coordinates are current being used.
SELECTION_CONDITION FullscreenCursor()
Create a functor testing if the cursor is full screen in a frame.
The interactive edit tool.
Definition: edit_tool.h:65
ENUM_MAP & Map(T aValue, const wxString &aName)
Definition: property.h:518
static ENUM_MAP< T > & Instance()
Definition: property.h:512
ENUM_MAP & Undefined(T aValue)
Definition: property.h:525
wxPGChoices & Choices()
Definition: property.h:561
Component library viewer main window.
const LIB_ID & GetFPID() const
Definition: footprint.h:207
bool Contains(GAL_LAYER_ID aPos)
Definition: layer_ids.h:329
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
virtual const wxString Problem() const
what was the problem?
Definition: exceptions.cpp:46
virtual const wxString Where() const
where did the Problem() occur?
Definition: exceptions.cpp:40
Read the new s-expression based KiCad netlist format.
virtual void LoadNetlist() override
Load the contents of the netlist file into aNetlist.
APP_SETTINGS_BASE * KifaceSettings() const
Definition: kiface_base.h:93
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
void ReadWindowSettings(WINDOW_SETTINGS &aCfg)
Read GAL config options from application-level config.
void SetGridColor(const COLOR4D &aGridColor)
Set the grid color.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
Contains methods for drawing PCB-specific items.
Definition: pcb_painter.h:156
virtual PCB_RENDER_SETTINGS * GetSettings() override
Return a pointer to current settings that are going to be used when drawing items.
Definition: pcb_painter.h:161
PCB specific render settings.
Definition: pcb_painter.h:71
void LoadDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
Load settings related to display options (high-contrast mode, full or outline modes for vias/pads/tra...
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Add a VIEW_ITEM to the view.
Definition: pcb_view.cpp:58
virtual void Remove(VIEW_ITEM *aItem) override
Remove a VIEW_ITEM from the view.
Definition: pcb_view.cpp:75
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
const std::set< int > & GetHighlightNetCodes() const
Return the netcode of currently highlighted net.
An abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:77
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:69
double GetScale() const
Definition: view.h:269
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:1574
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
Definition: view.h:393
bool IsMirroredX() const
Return true if view is flipped across the X axis.
Definition: view.h:243
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1478
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:213
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition: view.h:617
void UpdateAllItemsConditionally(int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
Update items in the view according to the given flags and condition.
Definition: view.cpp:1488
An implementation of class VIEW_CONTROLS for wxWidgets library.
std::unique_ptr< PROF_COUNTER > m_MotionEventCounter
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:66
virtual bool OpenProjectFiles(const std::vector< wxString > &aFileList, int aCtl=0)
Open a project or set of files given by aFileList.
Definition: kiway_player.h:118
void OnSockRequestServer(wxSocketEvent &evt)
Definition: eda_dde.cpp:99
void OnSockRequest(wxSocketEvent &evt)
Definition: eda_dde.cpp:69
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:267
void OnKiCadExit()
Definition: kiway.cpp:657
virtual void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged)
Call CommonSettingsChanged() on all KIWAY_PLAYERs.
Definition: kiway.cpp:572
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:394
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
Definition: kiway.cpp:488
int SetLayerSelection(int layer)
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition: layer_ids.h:491
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:530
static LSET AllLayersMask()
Definition: lset.cpp:808
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:411
bool Contains(PCB_LAYER_ID aLayer)
See if the layer set contains a PCB layer.
Definition: layer_ids.h:600
static const wxChar * Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
Definition: lset.cpp:82
@ MARKER_DRAWING_SHEET
Definition: marker_base.h:55
Tool responsible for adding microwave features to PCBs.
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
Definition: pcb_netlist.h:213
Tool relating to pads and pad settings.
Definition: pad_tool.h:37
Definition: pad.h:58
void SetInitialPage(const wxString &aPage, const wxString &aParentPage=wxEmptyString)
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
DISPLAY_OPTIONS m_Display
EDA_ANGLE m_RotationAngle
AUI_PANELS m_AuiPanels
Gather all the actions that are shared by tools.
Definition: pcb_actions.h:49
static TOOL_ACTION toggleHV45Mode
Definition: pcb_actions.h:458
static TOOL_ACTION drawRuleArea
Definition: pcb_actions.h:181
static TOOL_ACTION microwaveCreateGap
Definition: pcb_actions.h:447
static TOOL_ACTION placeText
Definition: pcb_actions.h:172
static TOOL_ACTION drawOrthogonalDimension
Definition: pcb_actions.h:177
static TOOL_ACTION drawRectangle
Definition: pcb_actions.h:168
static TOOL_ACTION padDisplayMode
Definition: pcb_actions.h:272
static TOOL_ACTION showRatsnest
Definition: pcb_actions.h:267
static TOOL_ACTION showLayersManager
Definition: pcb_actions.h:381
static TOOL_ACTION toggleNetHighlight
Definition: pcb_actions.h:491
static TOOL_ACTION drawCircle
Definition: pcb_actions.h:169
static TOOL_ACTION routeDiffPair
Activation of the Push and Shove router (differential pair mode)
Definition: pcb_actions.h:207
static TOOL_ACTION placeImage
Definition: pcb_actions.h:171
static TOOL_ACTION layerChanged
Definition: pcb_actions.h:320
static TOOL_ACTION ddAppendBoard
Drag and drop.
Definition: pcb_actions.h:520
static TOOL_ACTION highlightNet
Definition: pcb_actions.h:489
static TOOL_ACTION routerTuneDiffPair
Activation of the Push and Shove router (diff pair tuning mode)
Definition: pcb_actions.h:213
static TOOL_ACTION drawTextBox
Definition: pcb_actions.h:173
static TOOL_ACTION routerHighlightMode
Actions to enable switching modes via hotkey assignments.
Definition: pcb_actions.h:232
static TOOL_ACTION routerWalkaroundMode
Definition: pcb_actions.h:234
static TOOL_ACTION routerShoveMode
Definition: pcb_actions.h:233
static TOOL_ACTION drawZoneCutout
Definition: pcb_actions.h:182
static TOOL_ACTION drawPolygon
Definition: pcb_actions.h:167
static TOOL_ACTION hideNetInRatsnest
Definition: pcb_actions.h:496
static TOOL_ACTION group
Definition: pcb_actions.h:466
static TOOL_ACTION zoneDisplayFilled
Definition: pcb_actions.h:274
static TOOL_ACTION showNetInRatsnest
Definition: pcb_actions.h:497
static TOOL_ACTION drawRadialDimension
Definition: pcb_actions.h:176
static TOOL_ACTION showProperties
Definition: pcb_actions.h:382
static TOOL_ACTION routerTuneDiffPairSkew
Activation of the Push and Shove router (skew tuning mode)
Definition: pcb_actions.h:216
static TOOL_ACTION zoneFill
Definition: pcb_actions.h:335
static TOOL_ACTION viaDisplayMode
Definition: pcb_actions.h:273
static TOOL_ACTION drawLeader
Definition: pcb_actions.h:178
static TOOL_ACTION zoneUnfill
Definition: pcb_actions.h:338
static TOOL_ACTION drillOrigin
Definition: pcb_actions.h:476
static TOOL_ACTION routerTuneSingleTrace
Activation of the Push and Shove router (tune single line mode)
Definition: pcb_actions.h:210
static TOOL_ACTION trackDisplayMode
Definition: pcb_actions.h:271
static TOOL_ACTION microwaveCreateStubArc
Definition: pcb_actions.h:451
static TOOL_ACTION zoneDisplayTriangulated
Definition: pcb_actions.h:277
static TOOL_ACTION ungroup
Definition: pcb_actions.h:467
static TOOL_ACTION selectUnconnected
Select unconnected footprints from ratsnest of selection.
Definition: pcb_actions.h:92
static TOOL_ACTION zoneDisplayFractured
Definition: pcb_actions.h:276
static TOOL_ACTION drawVia
Definition: pcb_actions.h:180
static TOOL_ACTION drawArc
Definition: pcb_actions.h:170
static TOOL_ACTION zoneDuplicate
Duplicate zone onto another layer.
Definition: pcb_actions.h:343
static TOOL_ACTION pluginsReload
Scripting Actions.
Definition: pcb_actions.h:346
static TOOL_ACTION drawSimilarZone
Definition: pcb_actions.h:183
static TOOL_ACTION boardSetup
Definition: pcb_actions.h:350
static TOOL_ACTION drawCenterDimension
Definition: pcb_actions.h:175
static TOOL_ACTION selectSameSheet
Select all components on the same sheet as the selected footprint.
Definition: pcb_actions.h:101
static TOOL_ACTION microwaveCreateStub
Definition: pcb_actions.h:449
static TOOL_ACTION selectNet
Select all connections belonging to a single net.
Definition: pcb_actions.h:86
static TOOL_ACTION microwaveCreateLine
Definition: pcb_actions.h:455
static TOOL_ACTION flipBoard
Definition: pcb_actions.h:322
static TOOL_ACTION zoneDisplayOutline
Definition: pcb_actions.h:275
static TOOL_ACTION ratsnestLineMode
Definition: pcb_actions.h:268
static TOOL_ACTION highlightNetSelection
Definition: pcb_actions.h:492
static TOOL_ACTION microwaveCreateFunctionShape
Definition: pcb_actions.h:453
static TOOL_ACTION zoneMerge
Definition: pcb_actions.h:340
static TOOL_ACTION unlock
Definition: pcb_actions.h:463
static TOOL_ACTION placeFootprint
Definition: pcb_actions.h:186
static TOOL_ACTION routeSingleTrack
Activation of the Push and Shove router.
Definition: pcb_actions.h:204
static TOOL_ACTION deselectNet
Remove all connections belonging to a single net from the active selection.
Definition: pcb_actions.h:89
static TOOL_ACTION showPythonConsole
Definition: pcb_actions.h:383
static TOOL_ACTION drawLine
Definition: pcb_actions.h:166
static TOOL_ACTION localRatsnestTool
Definition: pcb_actions.h:498
static TOOL_ACTION drawAlignedDimension
Definition: pcb_actions.h:174
static TOOL_ACTION drawZone
Definition: pcb_actions.h:179
static TOOL_ACTION selectOnSchematic
Select symbols/pins on schematic corresponding to selected footprints/pads.
Definition: pcb_actions.h:104
static TOOL_ACTION lock
Definition: pcb_actions.h:462
Common, abstract interface for edit frames.
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
wxString GetDesignRulesPath()
Return the absolute path to the design rules file for the currently-loaded board.
void doCloseWindow() override
void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
virtual void SetBoard(BOARD *aBoard, PROGRESS_REPORTER *aReporter=nullptr) override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
APPEARANCE_CONTROLS * GetAppearancePanel()
APPEARANCE_CONTROLS * m_appearancePanel
PANEL_SELECTION_FILTER * m_selectionFilterPanel
PROPERTIES_PANEL * m_propertiesPanel
void ActivateGalCanvas() override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
virtual const PCB_PLOT_PARAMS & GetPlotSettings() const
Return the PCB_PLOT_PARAMS for the BOARD owned by this frame.
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
PCBNEW_SETTINGS * GetPcbNewSettings() const
virtual PCB_LAYER_ID GetActiveLayer() const
virtual void OnModify()
Must be called after a change in order to set the "modify" flag of the current screen and update the ...
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual void SetPageSettings(const PAGE_INFO &aPageSettings) override
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
BOARD * GetBoard() const
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
virtual void ShowChangedLanguage() override
Redraw the menus and what not in current language.
virtual void SetPlotSettings(const PCB_PLOT_PARAMS &aSettings)
virtual void SetActiveLayer(PCB_LAYER_ID aLayer)
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
Handle actions that are shared between different frames in PcbNew.
Definition: pcb_control.h:47
double m_ZoneOpacity
Opacity override for filled zone areas.
HIGH_CONTRAST_MODE m_ContrastModeDisplay
How inactive layers are displayed.
void UpdateColors()
Update the color settings in the painter and GAL.
void SetDrawingSheet(DS_PROXY_VIEW_ITEM *aDrawingSheet)
Sets (or updates) drawing-sheet used by the draw panel.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void SyncLayersVisibility(const BOARD *aBoard)
Update "visibility" property of each layer of a given BOARD.
virtual void SetHighContrastLayer(int aLayer) override
SetHighContrastLayer(), with some extra smarts for PCB.
Group generic conditions for PCB editor states.
SELECTION_CONDITION PadFillDisplay()
Create a functor that tests if the frame fills the pads.
SELECTION_CONDITION TrackFillDisplay()
Create a functor that tests if the frame fills tracks.
SELECTION_CONDITION HasItems()
Create a functor that tests if there are items in the board.
SELECTION_CONDITION ZoneDisplayMode(ZONE_DISPLAY_MODE aMode)
Create a functor that tests the current zone display mode in the frame.
SELECTION_CONDITION ViaFillDisplay()
Create a functor that tests if the frame fills vias.
SELECTION_CONDITION Get45degMode()
Create a functor that tests whether only 45 degree lines should be allowed.
The main frame for Pcbnew.
void HardRedraw() override
Rebuild the GAL and redraws the screen.
void OnDisplayOptionsChanged() override
int TestStandalone(void)
Test if standalone mode.
void ShowBoardSetupDialog(const wxString &aInitialPage=wxEmptyString)
void SetLastPath(LAST_PATH_TYPE aType, const wxString &aLastPath)
Set the path of the last file successfully read.
void SetBoard(BOARD *aBoard, PROGRESS_REPORTER *aReporter=nullptr) override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
void SetActiveLayer(PCB_LAYER_ID aLayer) override
Change the currently active layer to aLayer and also update the APPEARANCE_CONTROLS.
void OnModify() override
Must be called after a board change to set the modified flag.
void ThemeChanged() override
Called when light/dark theme is changed.
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
void SaveProjectSettings() override
Save changes to the project settings to the project (.pro) file.
void RecordDRCExclusions()
Scan existing markers and record data from any that are Excluded.
void SetElementVisibility(GAL_LAYER_ID aElement, bool aNewState)
Change the visibility of an element category.
void OnClearFileHistory(wxCommandEvent &aEvent)
virtual ~PCB_EDIT_FRAME()
void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType) override
Switch currently used canvas (Cairo / OpenGL).
void FindNext()
Find the next item using our existing search parameters.
BOARD_ITEM_CONTAINER * GetModel() const override
void OnExportSTEP(wxCommandEvent &event)
Export the current BOARD to a STEP assembly.
DIALOG_FIND * m_findDialog
void SetPageSettings(const PAGE_INFO &aPageSettings) override
bool IsElementVisible(GAL_LAYER_ID aElement) const
Test whether a given element category is visible.
void UpdateUserInterface()
Update the layer manager and other widgets from the board setup (layer and items visibility,...
void onBoardLoaded()
Update the state of the GUI after a new board is loaded or created.
void SetGridColor(const COLOR4D &aColor) override
void ProjectChanged() override
Notification event that the project has changed.
bool Clear_Pcb(bool aQuery, bool aFinal=false)
Delete all and reinitialize the current board.
Definition: initpcb.cpp:43
wxString GetLastPath(LAST_PATH_TYPE aType)
Get the last path for a particular type.
void OnExportIDF3(wxCommandEvent &event)
Export the current BOARD to a IDFv3 board and lib files.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
void doCloseWindow() override
void ReCreateLayerBox(bool aForceResizeToolbar=true)
Recreate the layer box by clearing the old list and building a new one from the new layer names and c...
void PythonSyncProjectName()
Synchronize the project name from KiCad's environment into the Python interpreter.
bool m_show_layer_manager_tools
void OnExportVRML(wxCommandEvent &event)
Export the current BOARD to a VRML file.
void ShowFindDialog()
Show the Find dialog.
void onSize(wxSizeEvent &aEvent)
int ShowExchangeFootprintsDialog(FOOTPRINT *aFootprint, bool aUpdateMode, bool aSelectedMode)
void ShowFootprintPropertiesDialog(FOOTPRINT *aFootprint)
void OnExportHyperlynx(wxCommandEvent &event)
Export the current BOARD to a Hyperlynx HYP file.
bool IsContentModified() const override
Get if the current board has been modified but not saved.
void PythonSyncEnvironmentVariables()
Synchronize the environment variables from KiCad's environment into the Python interpreter.
void OnRunTeardropTool(wxCommandEvent &event)
run teardrop tool
TOOL_ACTION * m_exportNetlistAction
The export board netlist tool action object.
void ReCreateAuxiliaryToolbar() override
bool FetchNetlistFromSchematic(NETLIST &aNetlist, const wxString &aAnnotateMessage)
wxString GetCurrentFileName() const override
Get the full filename + path of the currently opened file in the frame.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void ExportSVG(wxCommandEvent &event)
Show the Export to SVG file dialog.
void RecreateCmpFileFromBoard(wxCommandEvent &aEvent)
Recreates a .cmp file from the current loaded board.
void OnRemoveTeardropTool(wxCommandEvent &event)
Remove all teardrops.
EDA_ANGLE GetRotationAngle() const override
Return the angle used for rotate operations.
COLOR4D GetGridColor() override
void Files_io(wxCommandEvent &event)
Call Files_io_from_id with the wxCommandEvent id.
void UpdateTitle()
Set the main window title bar text.
PCB_LAYER_BOX_SELECTOR * m_SelLayerBox
void ExportToGenCAD(wxCommandEvent &event)
Create a file in GenCAD 1.4 format from the current board.
void ActivateGalCanvas() override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Called after the preferences dialog is run.
void Process_Special_Functions(wxCommandEvent &event)
Definition: edit.cpp:47
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
void OnQuit(wxCommandEvent &event)
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
void ResolveDRCExclusions()
Update markers to match recorded exclusions.
wxTimer * m_eventCounterTimer
void Tracks_and_Vias_Size_Event(wxCommandEvent &event)
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
bool isAutoSaveRequired() const override
Return true if the board has been modified.
void redrawNetnames(wxTimerEvent &aEvent)
static const wxString SearchPaneName()
void OnFileHistory(wxCommandEvent &event)
void ToPlotter(int aID)
Open a dialog frame to create plot and drill files relative to the current board.
Generic tool for picking an item.
Parameters and options when plotting/printing a board.
void SetFormat(PLOT_FORMAT aFormat)
Tool that displays edit points allowing to modify items by dragging the points.
The selection tool: currently supports:
void FindItem(BOARD_ITEM *aItem)
Take necessary actions to mark an item as found.
Tool useful for viewing footprints.
The interactive edit tool.
A progress reporter interface for use in multi-threaded environments.
The backing store for a PROJECT, in JSON format.
Definition: project_file.h:65
The project local settings are things that are attached to a particular project, but also might be pa...
wxString m_ActiveLayerPreset
The name of a LAYER_PRESET that is currently activated (or blank if none)
PCB_LAYER_ID m_ActiveLayer
The current (active) board layer for editing.
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
Definition: project.h:154
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:148
Action handler for the Properties panel.
PNS::PNS_MODE GetRouterMode()
Tool relating to pads and pad settings.
static SELECTION_CONDITION HasTypes(std::vector< KICAD_T > aTypes)
Create a functor that tests if among the selected items there is at least one of a given types.
static SELECTION_CONDITION MoreThan(int aNumber)
Create a functor that tests if the number of selected items is greater than the value given as parame...
static bool Idle(const SELECTION &aSelection)
Test if there no items selected or being edited.
static SELECTION_CONDITION Count(int aNumber)
Create a functor that tests if the number of selected items is equal to the value given as parameter.
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.
EDA_ITEM * Front() const
Definition: selection.h:200
int Size() const
Returns the number of selected parts.
Definition: selection.h:113
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition: richio.h:241
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:170
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:172
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:54
ACTIONS * m_actions
Definition: tools_holder.h:171
Represent a single user action.
Definition: tool_action.h:68
Base abstract interface for all kinds of tools.
Definition: tool_base.h:66
@ MODEL_RELOAD
Model changes (required full reload)
Definition: tool_base.h:80
Generic, UI-independent tool event.
Definition: tool_event.h:156
void SetHasPosition(bool aHasPosition)
Returns if the action associated with this event should be treated as immediate regardless of the cur...
Definition: tool_event.h:244
Master controller class:
Definition: tool_manager.h:55
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:142
bool InvokeTool(TOOL_ID aToolId)
Call a tool by sending a tool activation event to tool of given ID.
ACTION_MANAGER * GetActionManager() const
Definition: tool_manager.h:196
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Reset all tools (i.e.
std::vector< TOOL_BASE * > Tools()
Definition: tool_manager.h:231
void RegisterTool(TOOL_BASE *aTool)
Add a tool to the manager set and sets it up.
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, APP_SETTINGS_BASE *aSettings, TOOLS_HOLDER *aFrame)
Set the work environment (model, view, view controls and the parent window).
void InitTools()
Initializes all registered tools.
void ShutdownAllTools()
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with...
A modified version of the wxInfoBar class that allows us to:
Definition: infobar.h:75
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
Definition: infobar.cpp:286
@ OUTDATED_SAVE
OUTDATED_SAVE Messages that should be cleared on save.
void AddCloseButton(const wxString &aTooltip=_("Hide this message."))
Add the default close button to the infobar on the right side.
Definition: infobar.cpp:276
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
Definition: infobar.cpp:142
Handle actions specific to filling copper zones.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:280
bool HandleUnsavedChanges(wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
Display a dialog with Save, Cancel and Discard Changes buttons.
Definition: confirm.cpp:240
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:299
This file is part of the common library.
#define DIALOG_DRC_WINDOW_NAME
Definition: dialog_drc.h:41
bool InvokeExportSVG(PCB_EDIT_FRAME *aCaller, BOARD *aBoard)
Function InvokeExportSVG shows the Export SVG dialog.
#define _(s)
static constexpr EDA_ANGLE & ANGLE_90
Definition: eda_angle.h:414
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define PCB_EDIT_FRAME_NAME
GERBVIEW_FRAME::OnZipFileHistory GERBVIEW_FRAME::OnSelectDisplayMode EVT_CHOICE(ID_GBR_AUX_TOOLBAR_PCB_APERATTRIBUTES_CHOICE, GERBVIEW_FRAME::OnSelectHighlightChoice) EVT_UPDATE_UI(ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER
KiCad executable names.
const wxString EESCHEMA_EXE
EVT_UPDATE_UI(ID_LOAD_FOOTPRINT_FROM_BOARD, FOOTPRINT_EDIT_FRAME::OnUpdateLoadFootprintFromBoard) EVT_UPDATE_UI(ID_ADD_FOOTPRINT_TO_BOARD
@ FRAME_PCB_EDITOR
Definition: frame_type.h:40
@ FRAME_FOOTPRINT_VIEWER_MODAL
Definition: frame_type.h:43
@ FRAME_FOOTPRINT_VIEWER
Definition: frame_type.h:42
@ FRAME_SCH
Definition: frame_type.h:34
@ FRAME_FOOTPRINT_EDITOR
Definition: frame_type.h:41
@ ID_MAIN_MENUBAR
Definition: gerbview_id.h:38
int ExecuteFile(const wxString &aEditorName, const wxString &aFileName, wxProcess *aCallback)
Call the executable file aEditorName with the parameter aFileName.
Definition: gestfich.cpp:115
const std::string LegacyPcbFileExtension
const std::string LegacySchematicFileExtension
const std::string KiCadPcbFileExtension
const std::string KiCadSchematicFileExtension
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
@ ID_ON_GRID_SELECT
Definition: id.h:145
@ ID_GEN_PLOT_DXF
Definition: id.h:96
@ ID_FILE_LIST_CLEAR
Definition: id.h:87
@ ID_EDA_SOCKET_EVENT
Definition: id.h:164
@ ID_GEN_PLOT_PS
Definition: id.h:92
@ ID_EDA_SOCKET_EVENT_SERV
Definition: id.h:163
@ ID_GEN_PLOT_GERBER
Definition: id.h:94
@ ID_ON_ZOOM_SELECT
Definition: id.h:143
@ ID_GEN_PLOT
Definition: id.h:91
@ ID_GEN_PLOT_SVG
Definition: id.h:95
@ ID_GEN_PLOT_HPGL
Definition: id.h:93
@ ID_FILEMAX
Definition: id.h:85
@ ID_FILE1
Definition: id.h:84
@ ID_GRID_SETTINGS
Definition: id.h:146
@ ID_GEN_PLOT_PDF
Definition: id.h:97
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
int GetNetnameLayer(int aLayer)
Returns a netname layer corresponding to the given layer.
Definition: layer_ids.h:966
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
Definition: layer_ids.h:190
@ LAYER_GRID
Definition: layer_ids.h:205
@ LAYER_ZONES
Control for copper zone opacity/visibility (color ignored)
Definition: layer_ids.h:231
@ LAYER_RATSNEST
Definition: layer_ids.h:204
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
@ F_Paste
Definition: layer_ids.h:101
@ B_Mask
Definition: layer_ids.h:106
@ F_Mask
Definition: layer_ids.h:107
@ B_Paste
Definition: layer_ids.h:100
@ UNDEFINED_LAYER
Definition: layer_ids.h:60
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96
@ MAIL_SCH_GET_NETLIST
Definition: mail_type.h:49
@ REPAINT
Item needs to be redrawn.
Definition: view_item.h:52
@ ALL
All except INITIAL_ADD.
Definition: view_item.h:53
@ TARGET_NONCACHED
Auxiliary rendering target (noncached)
Definition: definitions.h:49
void SetShutdownBlockReason(wxWindow *aWindow, const wxString &aReason)
Sets the block reason why the window/application is preventing OS shutdown.
Definition: gtk/app.cpp:83
bool SupportsShutdownBlockReason()
Whether or not the window supports setting a shutdown block reason.
Definition: gtk/app.cpp:72
@ RM_MarkObstacles
Ignore collisions, mark obstacles.
@ RM_Walkaround
Only walk around.
@ RM_Shove
Only shove.
#define CHECK(x)
#define CURRENT_TOOL(action)
EVT_MENU_RANGE(ID_POPUP_PCB_SELECT_WIDTH_START_RANGE, ID_POPUP_PCB_SELECT_WIDTH_END_RANGE, PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event) EVT_UPDATE_UI_RANGE(ID_POPUP_PCB_SELECT_WIDTH1
ID_POPUP_PCB_SELECT_WIDTH8
bool ExportBoardToHyperlynx(BOARD *aBoard, const wxFileName &aPath)
#define ENABLE(x)
#define CURRENT_EDIT_TOOL(action)
PCB_EDIT_FRAME::OnUpdateSelectTrackWidth EVT_UPDATE_UI_RANGE(ID_POPUP_PCB_SELECT_VIASIZE1, ID_POPUP_PCB_SELECT_VIASIZE8, PCB_EDIT_FRAME::OnUpdateSelectViaSize) PCB_EDIT_FRAME
@ BLIND_BURIED
@ ID_POPUP_PCB_SELECT_WIDTH_START_RANGE
Definition: pcbnew_id.h:25
@ ID_POPUP_PCB_SELECT_WIDTH1
Definition: pcbnew_id.h:29
@ ID_POPUP_PCB_SELECT_VIASIZE8
Definition: pcbnew_id.h:52
@ ID_GEN_EXPORT_FILE_HYPERLYNX
Definition: pcbnew_id.h:88
@ ID_IMPORT_NON_KICAD_BOARD
Definition: pcbnew_id.h:19
@ ID_MENU_RECOVER_BOARD_AUTOSAVE
Definition: pcbnew_id.h:81
@ ID_RUN_TEARDROP_TOOL
Definition: pcbnew_id.h:119
@ ID_AUX_TOOLBAR_PCB_VIA_SIZE
Definition: pcbnew_id.h:22
@ ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH
Definition: pcbnew_id.h:24
@ ID_PCB_GEN_CMP_FILE
Definition: pcbnew_id.h:93
@ ID_MENU_EXPORT_FOOTPRINTS_TO_NEW_LIBRARY
Definition: pcbnew_id.h:83
@ ID_POPUP_PCB_SELECT_WIDTH_END_RANGE
Definition: pcbnew_id.h:79
@ ID_MENU_EXPORT_FOOTPRINTS_TO_LIBRARY
Definition: pcbnew_id.h:82
@ ID_GEN_EXPORT_FILE_VRML
Definition: pcbnew_id.h:86
@ ID_POPUP_PCB_SELECT_VIASIZE1
Definition: pcbnew_id.h:45
@ ID_REMOVE_TEARDROP_TOOL
Definition: pcbnew_id.h:120
@ ID_GEN_EXPORT_FILE_STEP
Definition: pcbnew_id.h:87
@ ID_TOOLBARH_PCB_SELECT_LAYER
Definition: pcbnew_id.h:96
@ ID_GEN_EXPORT_FILE_IDF3
Definition: pcbnew_id.h:85
@ ID_AUX_TOOLBAR_PCB_TRACK_WIDTH
Definition: pcbnew_id.h:23
@ ID_GEN_EXPORT_FILE_GENCADFORMAT
Definition: pcbnew_id.h:89
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
@ SHOW_WITH_VIA_ALWAYS
see class PGM_BASE
#define PROJECT_VAR_NAME
A variable name whose value holds the current project directory.
Definition: project.h:38
LAST_PATH_TYPE
For storing PcbNew MRU paths of various types.
Definition: project_file.h:47
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
@ RPT_SEVERITY_EXCLUSION
std::function< bool(const SELECTION &)> SELECTION_CONDITION
< Functor type that checks a specific condition for selected items.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111
const double IU_PER_MILS
Definition: base_units.h:78
A filename or source description, a problem input line, a line number, a byte offset,...
Definition: ki_exception.h:119
TRACK_CLEARANCE_MODE m_TrackClearance
@ AS_GLOBAL
Global action (toolbar/main menu event, global shortcut)
Definition: tool_action.h:45
@ AS_ACTIVE
All active tools.
Definition: tool_action.h:44
@ TA_MODEL_CHANGE
Definition: tool_event.h:116
@ TC_COMMAND
Definition: tool_event.h:52
wxLogTrace helper definitions.
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:102
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:115
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition: typeinfo.h:112
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition: typeinfo.h:90
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition: typeinfo.h:86
@ PCB_FP_ZONE_T
class ZONE, managed by a footprint
Definition: typeinfo.h:100
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition: typeinfo.h:87
@ PCB_FP_TEXT_T
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:103
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:101
Definition of file extensions used in Kicad.
void SetAuiPaneSize(wxAuiManager &aManager, wxAuiPaneInfo &aPane, int aWidth, int aHeight)
Sets the size of an AUI pane, working around http://trac.wxwidgets.org/ticket/13180.
WX_VIEW_CONTROLS class definition.