KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 The 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
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
23#include <algorithm>
24#include <type_traits>
25#include <unordered_map>
26#include <unordered_set>
27#include <vector>
28
29#include <wx/log.h>
30#include <wx/filename.h>
31#include <wx/filedlg.h>
32#include <wx/hyperlink.h>
33#include <wx/socket.h>
34#include <wx/wupdlock.h>
35
36#include <advanced_config.h>
38#include <kiface_base.h>
39#include <kiway.h>
42#include <pgm_base.h>
43#include <pcb_edit_frame.h>
47#include <api/api_handler_pcb.h>
49#include <api/api_server.h>
50#include <api/api_utils.h>
52#include <bitmaps.h>
53#include <confirm.h>
54#include <footprint.h>
55#include <footprint_utils.h>
57#include <project_pcb.h>
58#include <lset.h>
59#include <trace_helpers.h>
60#include <pcbnew_id.h>
61#include <pcbnew_settings.h>
64#include <dialog_find.h>
70#include <dialog_board_setup.h>
73#include <pcb_drill_chart.h>
74#include <pcb_drill_map.h>
79#include <pad.h>
80#include <pcb_target.h>
81#include <pcb_point.h>
82#include <pcb_track.h>
83#include <layer_pairs.h>
86#include <text_var_dependency.h>
87#include <view/view.h>
89#include <functional>
90#include <pcb_barcode.h>
91#include <pcb_grid_item.h>
92#include <pcb_painter.h>
97#include <local_history.h>
98#include <tool/tool_manager.h>
100#include <tool/action_toolbar.h>
101#include <tool/common_control.h>
102#include <tool/common_tools.h>
103#include <tool/embed_tool.h>
104#include <tool/properties_tool.h>
105#include <tool/selection.h>
106#include <tool/zoom_tool.h>
107#include <tools/array_tool.h>
112#include <tools/edit_tool.h>
114#include <tools/pcb_group_tool.h>
115#include <tools/generator_tool.h>
118#include <tools/drc_tool.h>
120#include <tools/convert_tool.h>
122#include <tools/drawing_tool.h>
123#include <tools/pcb_control.h>
131#include <tools/pad_tool.h>
133#include <properties/property.h>
140#include <router/router_tool.h>
143#include <dialog_drc.h> // for DIALOG_DRC_WINDOW_NAME definition
149#include <widgets/wx_infobar.h>
154#include <widgets/wx_aui_utils.h>
155#include <kiplatform/app.h>
156#include <kiplatform/ui.h>
157#include <core/profile.h>
158#include <math/box2_minmax.h>
162#include <toolbars_pcb_editor.h>
163
164#include <richio.h>
165
166using namespace std::placeholders;
167
168wxDEFINE_EVENT( EDA_EVT_PCB_LAST_SCH_SHEET_CHANGED, wxCommandEvent );
169
170
171#define INSPECT_DRC_ERROR_DIALOG_NAME wxT( "InspectDrcErrorDialog" )
172#define INSPECT_CLEARANCE_DIALOG_NAME wxT( "InspectClearanceDialog" )
173#define INSPECT_CONSTRAINTS_DIALOG_NAME wxT( "InspectConstraintsDialog" )
174#define FOOTPRINT_DIFF_DIALOG_NAME wxT( "FootprintDiffDialog" )
175
176
177BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
180
183
184 EVT_SIZE( PCB_EDIT_FRAME::OnSize )
185
186 // Menu Files:
189
190 EVT_MENU( wxID_EXIT, PCB_EDIT_FRAME::OnQuit )
191 EVT_MENU( wxID_CLOSE, PCB_EDIT_FRAME::OnQuit )
192
193 // Horizontal toolbar
198
199 // Tracks and vias sizes general options
201 PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event )
202
203 // User interface update event handlers.
204 EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, PCB_EDIT_FRAME::OnUpdateSelectTrackWidth )
205 EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_VIA_SIZE, PCB_EDIT_FRAME::OnUpdateSelectViaSize )
207 PCB_EDIT_FRAME::OnUpdateSelectTrackWidth )
209 PCB_EDIT_FRAME::OnUpdateSelectViaSize )
210 // Drop files event
211 EVT_DROP_FILES( PCB_EDIT_FRAME::OnDropFiles )
212END_EVENT_TABLE()
213
214
215PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
216 PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB_EDITOR, _( "PCB Editor" ), wxDefaultPosition, wxDefaultSize,
218 m_exportNetlistAction( nullptr ),
219 m_findDialog( nullptr ),
220 m_findByPropertiesDialog( nullptr ),
221 m_inspectDrcErrorDlg( nullptr ),
222 m_inspectClearanceDlg( nullptr ),
223 m_inspectConstraintsDlg( nullptr ),
224 m_footprintDiffDlg( nullptr ),
225 m_boardSetupDlg( nullptr ),
226 m_footprintFieldsTableDialog( nullptr ),
227 m_designBlocksPane( nullptr ),
228 m_importProperties( nullptr ),
229 m_eventCounterTimer( nullptr )
230{
231 m_maximizeByDefault = true;
232 m_showBorderAndTitleBlock = true; // true to display sheet references
233 m_SelTrackWidthBox = nullptr;
234 m_SelViaSizeBox = nullptr;
235 m_SelViaStackBox = nullptr;
236 m_CurrentVariantCtrl = nullptr;
237 m_ShowLayerManagerTools = true;
238 m_supportsAutoSave = true;
239 m_ProbingSchToPcb = false;
240 m_ShowSearch = false;
241 m_ShowNetInspector = false;
242 // Ensure timer has an owner before binding so it generates events.
243 m_crossProbeFlashTimer.SetOwner( this );
244 Bind( wxEVT_TIMER, &PCB_EDIT_FRAME::OnCrossProbeFlashTimer, this, m_crossProbeFlashTimer.GetId() );
245
246 // We don't know what state board was in when it was last saved, so we have to
247 // assume dirty
248 m_ZoneFillsDirty = true;
249
250 m_aboutTitle = _HKI( "KiCad PCB Editor" );
251
252 // Must be created before the menus are created.
253 if( ADVANCED_CFG::GetCfg().m_ShowPcbnewExportNetlist )
254 {
255 m_exportNetlistAction = new TOOL_ACTION( "pcbnew.EditorControl.exportNetlist",
256 AS_GLOBAL, 0, "", _( "Netlist..." ),
257 _( "Export netlist used to update schematics" ) );
258 }
259
260 // Create GAL canvas
261 PCB_DRAW_PANEL_GAL* canvas = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize,
262 GetGalDisplayOptions(),
264
265 SetCanvas( canvas );
266 SetBoard( new BOARD() );
267
268 wxIcon icon;
269 wxIconBundle icon_bundle;
270
271 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew, 48 ) );
272 icon_bundle.AddIcon( icon );
273 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew, 128 ) );
274 icon_bundle.AddIcon( icon );
275 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew, 256 ) );
276 icon_bundle.AddIcon( icon );
277 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew_32 ) );
278 icon_bundle.AddIcon( icon );
279 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew_16 ) );
280 icon_bundle.AddIcon( icon );
281
282 SetIcons( icon_bundle );
283
284 // LoadSettings() *after* creating m_LayersManager, because LoadSettings()
285 // initialize parameters in m_LayersManager
286 LoadSettings( config() );
287
288 SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU( pcbIUScale.IU_PER_MILS ) ) );
289
290 // PCB drawings start in the upper left corner.
291 GetScreen()->m_Center = false;
292
293 setupTools();
294 setupUIConditions();
295
296 m_toolbarSettings = GetToolbarSettings<PCB_EDIT_TOOLBAR_SETTINGS>( "pcbnew-toolbars" );
297 configureToolbars();
298 RecreateToolbars();
299 PrepareLayerIndicator( true );
300
301 ReCreateMenuBar();
302
305
306 // Fetch a COPY of the config as a lot of these initializations are going to overwrite our
307 // data.
308 PCBNEW_SETTINGS::AUI_PANELS aui_cfg = GetPcbNewSettings()->m_AuiPanels;
309
310 m_propertiesPanel = new PCB_PROPERTIES_PANEL( this, this );
311 m_propertiesPanel->SetSplitterProportion( aui_cfg.properties_splitter );
312
313 m_selectionFilterPanel = new PANEL_SELECTION_FILTER( this );
314
315 m_appearancePanel = new APPEARANCE_CONTROLS( this, GetCanvas() );
316 m_searchPane = new PCB_SEARCH_PANE( this );
317 m_netInspectorPanel = new PCB_NET_INSPECTOR_PANEL( this, this );
318 m_designBlocksPane = new PCB_DESIGN_BLOCK_PANE( this, nullptr, m_designBlockHistoryList );
319 m_constraintsPanel = new PANEL_CONSTRAINTS( this );
320 m_gitCommitPane = new GIT_COMMIT_PANE( this );
321
322 m_auimgr.SetManagedWindow( this );
323
324 CreateInfoBar();
325
326 // Secondary infobar stacked above the main one. Load-time notices (such as
327 // the WRL -> STEP migration prompt) belong here so they aren't clobbered by
328 // the main infobar's read-only warnings, DRC rule errors, etc.
329 m_loadNoticeInfoBar = new WX_INFOBAR( GetToolCanvas(), wxID_ANY, true );
330
331 unsigned int auiFlags = wxAUI_MGR_DEFAULT;
332#if !defined( _WIN32 )
333 // Windows cannot redraw the UI fast enough during a live resize and may lead to all kinds
334 // of graphical glitches.
335 auiFlags |= wxAUI_MGR_LIVE_RESIZE;
336#endif
337 m_auimgr.SetFlags( auiFlags );
338
339 // Rows; layers 4 - 6
340 m_auimgr.AddPane( m_tbTopMain, EDA_PANE().HToolbar().Name( wxS( "TopMainToolbar" ) )
341 .Top().Layer( 6 ) );
342 m_auimgr.AddPane( m_tbTopAux, EDA_PANE().HToolbar().Name( wxS( "TopAuxToolbar" ) )
343 .Top().Layer( 5 ) );
344 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( wxS( "MsgPanel" ) )
345 .Bottom().Layer( 6 ) );
346
347 // Columns; layers 1 - 3
348 m_auimgr.AddPane( m_tbLeft, EDA_PANE().VToolbar().Name( wxS( "LeftToolbar" ) )
349 .Left().Layer( 3 ) );
350
351 m_auimgr.AddPane( m_tbRight, EDA_PANE().VToolbar().Name( wxS( "RightToolbar" ) )
352 .Right().Layer( 3 ) );
353
354 m_auimgr.AddPane( m_appearancePanel, EDA_PANE().Name( wxS( "LayersManager" ) )
355 .Right().Layer( 4 )
356 .Caption( _( "Appearance" ) ).PaneBorder( false )
357 // Don't use -1 for don't-change-height on a growable panel; it has side-effects.
358 .MinSize( m_appearancePanel->GetMinSize().x, FromDIP( 60 ) )
359#ifdef __WXMAC__
360 // Best size for this pane is calculated larger than necessary on wxMac
361 .BestSize( m_appearancePanel->GetMinSize().x, -1 )
362#else
363 .BestSize( m_appearancePanel->GetBestSize().x, -1 )
364#endif
365 .FloatingSize( m_appearancePanel->GetBestSize() )
366 .CloseButton( false ) );
367
368 m_auimgr.AddPane( m_selectionFilterPanel, EDA_PANE().Name( wxS( "SelectionFilter" ) )
369 .Right().Layer( 4 ).Position( 2 )
370 .Caption( _( "Selection Filter" ) ).PaneBorder( false )
371 // Fixed-size pane; -1 for MinSize height is required
372 .MinSize( m_selectionFilterPanel->GetMinSize().x, -1 )
373 .BestSize( m_selectionFilterPanel->GetBestSize().x, -1 )
374 .FloatingSize( m_selectionFilterPanel->GetBestSize() )
375 .CloseButton( false ) );
376
377 m_auimgr.AddPane( m_designBlocksPane, EDA_PANE().Name( DesignBlocksPaneName() )
378 .Right().Layer( 5 )
379 .Caption( _( "Design Blocks" ) )
380 .CaptionVisible( true )
381 .PaneBorder( true )
382 .TopDockable( false )
383 .BottomDockable( false )
384 .CloseButton( true )
385 .MinSize( FromDIP( wxSize( 240, 60 ) ) )
386 .BestSize( FromDIP( wxSize( 300, 200 ) ) )
387 .FloatingSize( FromDIP( wxSize( 800, 600 ) ) )
388 .FloatingPosition( FromDIP( wxPoint( 50, 200 ) ) )
389 .Show( true ) );
390
391 m_auimgr.AddPane( m_propertiesPanel, EDA_PANE().Name( PropertiesPaneName() )
392 .Left().Layer( 5 )
393 .Caption( _( "Properties" ) ).PaneBorder( false )
394 .MinSize( FromDIP( wxSize( 240, 60 ) ) )
395 .BestSize( FromDIP( wxSize( 300, 200 ) ) )
396 .FloatingSize( wxSize( 300, 200 ) )
397 .CloseButton( true ) );
398
399 // Center
400 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( wxS( "DrawFrame" ) )
401 .Center() );
402
403 m_auimgr.AddPane( m_netInspectorPanel, EDA_PANE().Name( NetInspectorPanelName() )
404 .Bottom()
405 .Caption( _( "Net Inspector" ) )
406 .PaneBorder( false )
407 .MinSize( FromDIP( wxSize( 240, 60 ) ) )
408 .BestSize( FromDIP( wxSize( 300, 200 ) ) )
409 .FloatingSize( wxSize( 300, 200 ) )
410 .CloseButton( true ) );
411
412 m_auimgr.AddPane( m_searchPane, EDA_PANE().Name( SearchPaneName() )
413 .Bottom()
414 .Caption( _( "Search" ) ).PaneBorder( false )
415 .MinSize( FromDIP( wxSize ( 180, 60 ) ) )
416 .BestSize( FromDIP( wxSize ( 180, 100 ) ) )
417 .FloatingSize( FromDIP( wxSize( 480, 200 ) ) )
418 .DestroyOnClose( false )
419 .CloseButton( true ) );
420
421 m_auimgr.AddPane( m_constraintsPanel, EDA_PANE().Name( ConstraintsPaneName() )
422 .Bottom().Layer( 1 )
423 .Caption( _( "Geometric Constraints" ) ).PaneBorder( false )
424 .MinSize( FromDIP( wxSize( 360, 120 ) ) )
425 .BestSize( FromDIP( wxSize( 600, 200 ) ) )
426 .FloatingSize( FromDIP( wxSize( 600, 240 ) ) )
427 .DestroyOnClose( false )
428 .CloseButton( true )
429 .Hide() );
430
431 m_auimgr.AddPane( m_gitCommitPane,
432 EDA_PANE()
433 .Name( GitCommitPaneName() )
434 .Right()
435 .Layer( 5 )
436 .Caption( _( "Version Control" ) )
437 .PaneBorder( false )
438 .MinSize( wxSize( m_gitCommitPane->GetMinDockWidth(), FromDIP( 120 ) ) )
439 .BestSize( wxSize( std::max( m_gitCommitPane->GetMinDockWidth(), FromDIP( 300 ) ),
440 FromDIP( 300 ) ) )
441 .FloatingSize( FromDIP( wxSize( 300, 400 ) ) )
442 .DestroyOnClose( false )
443 .CloseButton( true )
444 .Hide() );
445
446 RestoreAuiLayout();
447
448 // A saved layout brings its own minimum, so the one the panel needs is set again.
449 m_auimgr.GetPane( GitCommitPaneName() ).min_size.x = m_gitCommitPane->GetMinDockWidth();
450
451 m_auimgr.GetPane( "LayersManager" ).Show( m_ShowLayerManagerTools );
452 m_auimgr.GetPane( "SelectionFilter" ).Show( m_ShowLayerManagerTools );
453 m_auimgr.GetPane( PropertiesPaneName() ).Show( GetPcbNewSettings()->m_AuiPanels.show_properties );
454 m_auimgr.GetPane( NetInspectorPanelName() ).Show( m_ShowNetInspector );
455 m_auimgr.GetPane( SearchPaneName() ).Show( m_ShowSearch );
456 m_auimgr.GetPane( DesignBlocksPaneName() ).Show( GetPcbNewSettings()->m_AuiPanels.design_blocks_show );
457 m_auimgr.GetPane( GitCommitPaneName() ).Show( GetPcbNewSettings()->m_AuiPanels.show_git_commit_pane );
458
459 wxAuiPaneInfo& selectionFilterPane = m_auimgr.GetPane( wxS( "SelectionFilter" ) );
460
461 // The selection filter doesn't need to grow in the vertical direction when docked
462 selectionFilterPane.dock_proportion = 0;
463
464 // wx 3.3.3 turns a -1 min height into 1, and a legacy perspective restores one
465 selectionFilterPane.min_size.y = m_selectionFilterPanel->GetBestSize().y;
466 FinishAUIInitialization();
467
468 if( aui_cfg.right_panel_width > 0 )
469 {
470 wxAuiPaneInfo& layersManager = m_auimgr.GetPane( wxS( "LayersManager" ) );
471 SetAuiPaneSize( m_auimgr, layersManager, aui_cfg.right_panel_width, -1 );
472
473 wxAuiPaneInfo& designBlocksPane = m_auimgr.GetPane( DesignBlocksPaneName() );
474 SetAuiPaneSize( m_auimgr, designBlocksPane, aui_cfg.design_blocks_panel_docked_width, -1 );
475 }
476
477 if( aui_cfg.properties_panel_width > 0 && m_propertiesPanel )
478 {
479 wxAuiPaneInfo& propertiesPanel = m_auimgr.GetPane( PropertiesPaneName() );
480 SetAuiPaneSize( m_auimgr, propertiesPanel, aui_cfg.properties_panel_width, -1 );
481 }
482
483 if( aui_cfg.search_panel_height > 0
484 && ( aui_cfg.search_panel_dock_direction == wxAUI_DOCK_TOP
485 || aui_cfg.search_panel_dock_direction == wxAUI_DOCK_BOTTOM ) )
486 {
487 wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
488 searchPane.Direction( aui_cfg.search_panel_dock_direction );
489 SetAuiPaneSize( m_auimgr, searchPane, -1, aui_cfg.search_panel_height );
490 }
491 else if( aui_cfg.search_panel_width > 0
492 && ( aui_cfg.search_panel_dock_direction == wxAUI_DOCK_LEFT
493 || aui_cfg.search_panel_dock_direction == wxAUI_DOCK_RIGHT ) )
494 {
495 wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
496 searchPane.Direction( aui_cfg.search_panel_dock_direction );
497 SetAuiPaneSize( m_auimgr, searchPane, aui_cfg.search_panel_width, -1 );
498 }
499
500 m_appearancePanel->SetTabIndex( aui_cfg.appearance_panel_tab );
501
502 m_layerPairSettings = std::make_unique<LAYER_PAIR_SETTINGS>();
503
504 m_layerPairSettings->Bind( PCB_LAYER_PAIR_PRESETS_CHANGED,
505 [&]( wxCommandEvent& aEvt )
506 {
507 // Update the project file list
508 std::span<const LAYER_PAIR_INFO> newPairInfos = m_layerPairSettings->GetLayerPairs();
509 Prj().GetProjectFile().m_LayerPairInfos = std::vector<LAYER_PAIR_INFO>{ newPairInfos.begin(),
510 newPairInfos.end() };
511 } );
512
513 m_layerPairSettings->Bind( PCB_CURRENT_LAYER_PAIR_CHANGED,
514 [&]( wxCommandEvent& aEvt )
515 {
516 const LAYER_PAIR& layerPair = m_layerPairSettings->GetCurrentLayerPair();
517 PCB_SCREEN& screen = *GetScreen();
518
519 screen.m_Route_Layer_TOP = layerPair.GetLayerA();
520 screen.m_Route_Layer_BOTTOM = layerPair.GetLayerB();
521
522 // Update the toolbar icon
523 PrepareLayerIndicator();
524 } );
525
526 GetToolManager()->PostAction( ACTIONS::zoomFitScreen );
527
528 Bind( wxEVT_IDLE,
529 [this]( wxIdleEvent& aEvent )
530 {
531 BOX2D viewport = GetCanvas()->GetView()->GetViewport();
532
533 if( viewport != m_lastNetnamesViewport )
534 {
535 redrawNetnames();
536 m_lastNetnamesViewport = viewport;
537 m_lastNetnamesScale = GetCanvas()->GetView()->GetScale();
538 }
539
540 // Do not forget to pass the Idle event to other clients:
541 aEvent.Skip();
542 } );
543
544 setupUnits( config() );
545
546 // Ensure the DRC engine is initialized so that constraints can be resolved even before a
547 // board is loaded or saved
548 try
549 {
550 m_toolManager->GetTool<DRC_TOOL>()->GetDRCEngine()->InitEngine( wxFileName() );
551 }
552 catch( PARSE_ERROR& )
553 {
554 }
555
556 // Sync action plugins in case they changed since the last time the frame opened
557 GetToolManager()->RunAction( ACTIONS::pluginsReload );
558
559 m_apiHandler = std::make_unique<API_HANDLER_PCB>( this );
560 Pgm().GetApiServer().RegisterHandler( m_apiHandler.get() );
561
562 if( Kiface().IsSingle() )
563 {
564 m_apiHandlerCommon = std::make_unique<API_HANDLER_COMMON>();
565 Pgm().GetApiServer().RegisterHandler( m_apiHandlerCommon.get() );
566 m_apiLibrariesHandler = std::make_unique<API_HANDLER_LIBRARIES>( LIBRARY_TABLE_TYPE::DESIGN_BLOCK );
567 Pgm().GetApiServer().RegisterHandler( m_apiLibrariesHandler.get() );
568 }
569
570 resolveCanvasType();
571 ActivateGalCanvas();
572
573 // Default shutdown reason until a file is loaded
574 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "New PCB file is unsaved" ) );
575
576 // disable Export STEP item if kicad2step does not exist
577 wxString strK2S = Pgm().GetExecutablePath();
578
579#ifdef __WXMAC__
580 if( strK2S.Find( wxT( "pcbnew.app" ) ) != wxNOT_FOUND )
581 {
582 // On macOS, we have standalone applications inside the main bundle, so we handle that here:
583 strK2S += wxT( "../../" );
584 }
585
586 strK2S += wxT( "Contents/MacOS/" );
587#endif
588
589 wxFileName appK2S( strK2S, wxT( "kicad2step" ) );
590
591#ifdef _WIN32
592 appK2S.SetExt( wxT( "exe" ) );
593#endif
594
595 // Ensure the window is on top
596 Raise();
597
598// if( !appK2S.FileExists() )
599 // GetMenuBar()->FindItem( ID_GEN_EXPORT_FILE_STEP )->Enable( false );
600
601 // AUI doesn't refresh properly on wxMac after changes in eb7dc6dd, so force it to
602#ifdef __WXMAC__
603 if( Kiface().IsSingle() )
604 {
605 CallAfter( [this]()
606 {
607 m_appearancePanel->OnBoardChanged();
608 } );
609 }
610#endif
611
612 // Register a call to update the toolbar sizes. It can't be done immediately because
613 // it seems to require some sizes calculated that aren't yet (at least on GTK).
614 CallAfter( [this]()
615 {
616 // Ensure the controls on the toolbars all are correctly sized
617 UpdateToolbarControlSizes();
618
619 // Update the angle snap mode toolbar button to reflect the current preference
620 GetToolManager()->RunAction( PCB_ACTIONS::angleSnapModeChanged );
621 } );
622
623 if( ADVANCED_CFG::GetCfg().m_ShowEventCounters )
624 {
625 m_eventCounterTimer = new wxTimer( this );
626
627 Bind( wxEVT_TIMER,
628 [&]( wxTimerEvent& aEvent )
629 {
630 GetCanvas()->m_PaintEventCounter->Show();
631 GetCanvas()->m_PaintEventCounter->Reset();
632
634 static_cast<KIGFX::WX_VIEW_CONTROLS*>( GetCanvas()->GetViewControls() );
637
638 },
639 m_eventCounterTimer->GetId() );
640
641 m_eventCounterTimer->Start( 1000 );
642 }
643
646 m_acceptedExts.emplace( wxS( "dxf" ), &PCB_ACTIONS::ddImportGraphics );
650 m_acceptedExts.emplace( wxS( "jpeg" ), &PCB_ACTIONS::ddPlaceReferenceImage );
651 DragAcceptFiles( true );
652
653 Bind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &PCB_EDIT_FRAME::onCloseModelessBookReporterDialogs, this );
654 Bind( EDA_EVT_CLOSE_DIALOG_FOOTPRINT_FIELDS_TABLE, &PCB_EDIT_FRAME::onCloseFootprintFieldsTableDialog, this );
655}
656
657
658void PCB_EDIT_FRAME::StartCrossProbeFlash( const std::vector<BOARD_ITEM*>& aItems )
659{
660 if( !GetPcbNewSettings()->m_CrossProbing.flash_selection )
661 {
662 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash(PCB): aborted (setting disabled) items=%zu",
663 aItems.size() );
664 return;
665 }
666
667 if( aItems.empty() )
668 {
669 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash(PCB): aborted (no items)" );
670 return;
671 }
672
673 // Don't start flashing if any of the items are being moved. The flash timer toggles
674 // selection hide/show which corrupts the VIEW overlay state during an active move.
675 for( const BOARD_ITEM* item : aItems )
676 {
677 if( item->IsMoving() )
678 {
679 wxLogTrace( traceCrossProbeFlash,
680 "StartCrossProbeFlash(PCB): aborted (items are moving)" );
681 return;
682 }
683 }
684
686 {
687 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash(PCB): restarting existing flash (phase=%d)",
690 }
691
692 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash(PCB): starting with %zu items", aItems.size() );
693
694 // Store uuids
696 for( BOARD_ITEM* it : aItems )
697 m_crossProbeFlashItems.push_back( it->m_Uuid );
698
701
702 if( !m_crossProbeFlashTimer.GetOwner() )
703 m_crossProbeFlashTimer.SetOwner( this );
704
705 // 0.5s intervals -> 3s total for 6 phases
706 [[maybe_unused]] bool started = m_crossProbeFlashTimer.Start( 500, wxTIMER_CONTINUOUS );
707 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash(PCB): timer start=%d id=%d",
708 (int) started, m_crossProbeFlashTimer.GetId() );
709}
710
711
712void PCB_EDIT_FRAME::OnCrossProbeFlashTimer( wxTimerEvent& aEvent )
713{
714 wxLogTrace( traceCrossProbeFlash, "Timer(PCB) fired: phase=%d running=%d items=%zu",
716
718 {
719 wxLogTrace( traceCrossProbeFlash, "Timer(PCB) fired but not flashing (ignored)" );
720 return;
721 }
722
724
725 if( !selTool )
726 return;
727
728 // Don't manipulate the selection while items are being moved. The move tool holds a
729 // live reference to the selection and toggling hide/show on selected items corrupts
730 // the VIEW overlay state, causing crashes.
731 for( const KIID& id : m_crossProbeFlashItems )
732 {
733 if( EDA_ITEM* item = GetBoard()->ResolveItem( id, true ) )
734 {
735 if( item->IsMoving() )
736 {
737 wxLogTrace( traceCrossProbeFlash, "Timer(PCB) phase=%d: items are moving, stopping flash",
739 m_crossProbeFlashing = false;
741 return;
742 }
743 }
744 }
745
746 // Prevent recursion / IPC during flashing
747 bool prevGuard = m_ProbingSchToPcb;
748 m_ProbingSchToPcb = true;
749
750 if( m_crossProbeFlashPhase % 2 == 0 )
751 {
752 // Hide selection
753 selTool->ClearSelection( true );
754 wxLogTrace( traceCrossProbeFlash, "Phase %d (PCB): cleared selection", m_crossProbeFlashPhase );
755 }
756 else
757 {
758 // Restore selection
759 for( const KIID& id : m_crossProbeFlashItems )
760 {
761 if( EDA_ITEM* item = GetBoard()->ResolveItem( id, true ) )
762 selTool->AddItemToSel( item, true );
763 }
764
765 wxLogTrace( traceCrossProbeFlash, "Phase %d (PCB): restored %zu items",
767 }
768
769 // Force a redraw even if the canvas / frame does not currently have focus (mouse elsewhere)
770 if( GetCanvas() )
771 {
773 wxLogTrace( traceCrossProbeFlash, "Phase %d (PCB): forced canvas refresh", m_crossProbeFlashPhase );
774 }
775
776 m_ProbingSchToPcb = prevGuard;
777
779
780 if( m_crossProbeFlashPhase > 6 )
781 {
782 // Ensure final state (selected)
783 for( const KIID& id : m_crossProbeFlashItems )
784 {
785 if( EDA_ITEM* item = GetBoard()->ResolveItem( id, true ) )
786 selTool->AddItemToSel( item, true );
787 }
788
789 m_crossProbeFlashing = false;
791
792 wxLogTrace( traceCrossProbeFlash, "Flashing complete (PCB). Final selection size=%zu",
793 m_crossProbeFlashItems.size() );
794 }
795}
796
797
799{
800 // Always ensure that we are unregistered even in a close without graceful doCloseWindow()
801 if( GetBoard() )
803
804 // PCB_BASE_FRAME's dtor deletes m_pcb; canvas children outlive it. Drop
805 // every cached TEXT_VAR_TRACKER* before the tracker is freed.
807
808 if( Kiface().IsSingle() )
809 {
812 }
813
814 if( ADVANCED_CFG::GetCfg().m_ShowEventCounters )
815 {
816 // Stop the timer during destruction early to avoid potential event race conditions (that
817 // do happen on windows)
818 m_eventCounterTimer->Stop();
819 delete m_eventCounterTimer;
820 }
821
822 // Close modeless dialogs
823 wxWindow* drcDlg = wxWindow::FindWindowByName( DIALOG_DRC_WINDOW_NAME );
824
825 if( drcDlg )
826 drcDlg->Close( true );
827
828 // Shutdown all running tools
829 if( m_toolManager )
830 m_toolManager->ShutdownAllTools();
831
832 if( GetBoard() )
834
835 // We passed ownership of these to wxAuiManager.
836 // delete m_selectionFilterPanel;
837 // delete m_appearancePanel;
838 // delete m_propertiesPanel;
839 // delete m_netInspectorPanel;
840
842}
843
844
846{
847 wxAuiPaneInfo& pane = m_auimgr.GetPane( ConstraintsPaneName() );
848
849 if( !pane.IsOk() )
850 return;
851
852 bool show = !pane.IsShown();
853 pane.Show( show );
854
855 if( show && m_constraintsPanel )
856 m_constraintsPanel->RefreshList();
857
858 m_auimgr.Update();
859}
860
861
863{
864 if( GetCanvas() )
865 {
866 if( DS_PROXY_VIEW_ITEM* sheet = GetCanvas()->GetDrawingSheet() )
867 sheet->AttachToTracker( nullptr );
868 }
869
871 {
872 m_textVarListenerTracker->RemoveInvalidateListener( m_textVarListenerHandle );
874 m_textVarListenerTracker = nullptr;
875 }
876}
877
878
879void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard, bool aBuildConnectivity, PROGRESS_REPORTER* aReporter )
880{
881 // PCB_BASE_FRAME::SetBoard() deletes m_pcb; detach tracker consumers first.
882 if( m_pcb )
883 {
885 m_pcb->ClearProject();
887 }
888
889 PCB_BASE_EDIT_FRAME::SetBoard( aBoard, aReporter );
890
891 aBoard->AddListener( this );
892 aBoard->SetProject( &Prj() );
893
894 if( aBuildConnectivity )
895 aBoard->BuildConnectivity();
896
897 // reload the drawing-sheet
898 SetPageSettings( aBoard->GetPageSettings() );
899
901}
902
903
908
909
910std::unique_ptr<GRID_HELPER> PCB_EDIT_FRAME::MakeGridHelper()
911{
912 return std::make_unique<PCB_GRID_HELPER>( m_toolManager, GetMagneticItemsSettings() );
913}
914
915
917{
918 /*
919 * While new items being scrolled into the view will get painted, they will only get
920 * annotated with netname instances currently within the view. Subsequent panning will not
921 * draw newly-visible netname instances because the item has already been drawn.
922 *
923 * This routine, fired on idle if the viewport has changed, looks for visible items that
924 * might have multiple netname instances and redraws them. (It does not need to handle pads
925 * and vias because they only ever have a single netname instance drawn on them.)
926 */
927 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( Kiface().KifaceSettings() );
928
929 if( !cfg || cfg->m_Display.m_NetNames < 2 )
930 return;
931
932 KIGFX::VIEW* view = GetCanvas()->GetView();
933 BOX2D viewport = view->GetViewport();
934
935 view->SyncLayerVisibilityCache(); // Required for ViewGetLOD() calls.
936
937 if( view->GetGAL()->HasRetainedScene() )
938 {
939 // Labels sit on the visible part of their track. A track wholly inside both the old and new
940 // view keeps its label, so only the others are repainted, and only on net name layers.
941 const BOX2I before = BOX2ISafe( m_lastNetnamesViewport );
942 const BOX2I now = BOX2ISafe( viewport );
943 BOX2D reach = viewport;
944
945 view->RepaintLayers(
946 BOX2ISafe( reach.Inflate( pcbIUScale.mmToIU( 2.0 ) ) ),
947 []( int aLayer )
948 {
949 return IsNetnameLayer( aLayer );
950 },
951 [&]( KIGFX::VIEW_ITEM* aItem, int aLayer )
952 {
953 PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( aItem );
954
955 if( !track || track->Type() == PCB_VIA_T )
956 return false;
957
958 const double lod = track->ViewGetLOD( aLayer, view );
959
960 const BOX2I bbox = track->GetBoundingBox();
961
962 if( lod < m_lastNetnamesScale && before.Contains( bbox ) && now.Contains( bbox ) )
963 return false;
964
965 return lod < view->GetScale();
966 } );
967
968 // Labels are laid out on idle after a zoom's last paint and would otherwise wait for
969 // whatever paints next
970 GetCanvas()->Refresh();
971 return;
972 }
973
974 // Inflate to catch most of the track width
975 BOX2I_MINMAX clipbox( BOX2ISafe( viewport.Inflate( pcbIUScale.mmToIU( 2.0 ) ) ) );
976
977 for( PCB_TRACK* track : GetBoard()->Tracks() )
978 {
979 // Don't need to update vias
980 if( track->Type() == PCB_VIA_T )
981 continue;
982
983 // Don't update invisible tracks
984 if( !clipbox.Intersects( BOX2I_MINMAX( track->GetStart(), track->GetEnd() ) ) )
985 continue;
986
987 if( track->ViewGetLOD( GetNetnameLayer( track->GetLayer() ), view ) < view->GetScale() )
988 view->Update( track, KIGFX::REPAINT );
989 }
990}
991
992
993void PCB_EDIT_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
994{
995 PCB_BASE_FRAME::SetPageSettings( aPageSettings );
996
997 // Prepare drawing-sheet template
999 &m_pcb->GetPageSettings(),
1000 m_pcb->GetProject(),
1001 &m_pcb->GetTitleBlock(),
1002 &m_pcb->GetProperties() );
1003
1004 drawingSheet->SetSheetName( std::string( GetScreenDesc().mb_str() ) );
1005 drawingSheet->SetSheetPath( std::string( GetFullScreenDesc().mb_str() ) );
1006
1007 // A board is not like a schematic having a main page and sub sheets.
1008 // So for the drawing sheet, use only the first page option to display items
1009 drawingSheet->SetIsFirstPage( true );
1010
1011 BASE_SCREEN* screen = GetScreen();
1012
1013 if( screen != nullptr )
1014 {
1015 drawingSheet->SetPageNumber(TO_UTF8( screen->GetPageNumber() ) );
1016 drawingSheet->SetSheetCount( screen->GetPageCount() );
1017 }
1018
1019 if( BOARD* board = GetBoard() )
1020 {
1021 drawingSheet->SetFileName( TO_UTF8( board->GetFileName() ) );
1022 wxString currentVariant = board->GetCurrentVariant();
1023 wxString variantDesc = board->GetVariantDescription( currentVariant );
1024 drawingSheet->SetVariantName( TO_UTF8( currentVariant ) );
1025 drawingSheet->SetVariantDesc( TO_UTF8( variantDesc ) );
1026 }
1027
1028 // PCB_DRAW_PANEL_GAL takes ownership of the drawing-sheet
1029 GetCanvas()->SetDrawingSheet( drawingSheet );
1030
1031 // Reactive title-block repaint: register the proxy with the BOARD's
1032 // text-var tracker so source changes fan out to a repaint. The one-time
1033 // listener installation is idempotent; calling AddInvalidateListener
1034 // here each time would accumulate stale listeners across SetPageSettings
1035 // calls, which is why the listener check below is guarded.
1036 if( BOARD* board = GetBoard() )
1037 {
1038 if( BOARD_TEXT_VAR_ADAPTER* adapter = board->GetTextVarAdapter() )
1039 {
1040 TEXT_VAR_TRACKER* tracker = &adapter->Tracker();
1041
1042 drawingSheet->AttachToTracker( tracker );
1043
1044 // Project reload / board swap can point GetBoard() at a new
1045 // tracker; detach from the previous one first so we don't leak
1046 // a stale lambda that still captures `this`.
1047 if( m_textVarListenerTracker != tracker
1049 {
1050 m_textVarListenerTracker->RemoveInvalidateListener( m_textVarListenerHandle );
1052 m_textVarListenerTracker = nullptr;
1053 }
1054
1056 {
1057 KIGFX::VIEW* view = GetCanvas()->GetView();
1058 m_textVarListenerTracker = tracker;
1060 [this, view]( EDA_ITEM* aDep, const TEXT_VAR_REF_KEY& )
1061 {
1062 if( !aDep )
1063 return;
1064
1066
1067 if( aDep == current )
1068 {
1069 view->Update( current, KIGFX::REPAINT );
1070 return;
1071 }
1072
1073 if( aDep->IsBOARD_ITEM() )
1074 {
1075 if( PCB_TEXT* text = dynamic_cast<PCB_TEXT*>( aDep ) )
1076 {
1077 text->ClearRenderCache();
1078 text->ClearBoundingBoxCache();
1079 }
1080
1081 view->Update( aDep, KIGFX::GEOMETRY | KIGFX::REPAINT );
1082 }
1083 } );
1084 }
1085 }
1086 }
1087}
1088
1089
1091{
1092 return GetScreen() && GetScreen()->IsContentModified();
1093}
1094
1095
1097{
1098 return m_toolManager->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1099}
1100
1101
1103{
1104 // Create the manager and dispatcher & route draw panel events to the dispatcher
1106 m_toolManager->SetEnvironment( m_pcb, GetCanvas()->GetView(),
1107 GetCanvas()->GetViewControls(), config(), this );
1108 m_actions = new PCB_ACTIONS();
1110
1111 // Register tools
1112 m_toolManager->RegisterTool( new COMMON_CONTROL );
1113 m_toolManager->RegisterTool( new COMMON_TOOLS );
1114 m_toolManager->RegisterTool( new PCB_SELECTION_TOOL );
1115 m_toolManager->RegisterTool( new ZOOM_TOOL );
1116 m_toolManager->RegisterTool( new PCB_PICKER_TOOL );
1117 m_toolManager->RegisterTool( new ROUTER_TOOL );
1118 m_toolManager->RegisterTool( new EDIT_TOOL );
1119 m_toolManager->RegisterTool( new PCB_EDIT_TABLE_TOOL );
1120 m_toolManager->RegisterTool( new GLOBAL_EDIT_TOOL );
1121 m_toolManager->RegisterTool( new PAD_TOOL );
1122 m_toolManager->RegisterTool( new DRAWING_TOOL );
1123 m_toolManager->RegisterTool( new PCB_POINT_EDITOR );
1124 m_toolManager->RegisterTool( new PCB_CONTROL );
1125 m_toolManager->RegisterTool( new PCB_DESIGN_BLOCK_CONTROL );
1126 m_toolManager->RegisterTool( new BOARD_EDITOR_CONTROL );
1127 m_toolManager->RegisterTool( new BOARD_INSPECTION_TOOL );
1128 m_toolManager->RegisterTool( new BOARD_REANNOTATE_TOOL );
1129 m_toolManager->RegisterTool( new ALIGN_DISTRIBUTE_TOOL );
1130 m_toolManager->RegisterTool( new MICROWAVE_TOOL );
1131 m_toolManager->RegisterTool( new POSITION_RELATIVE_TOOL );
1132 m_toolManager->RegisterTool( new ARRAY_TOOL );
1133 m_toolManager->RegisterTool( new ZONE_FILLER_TOOL );
1134 m_toolManager->RegisterTool( new AUTOPLACE_TOOL );
1135 m_toolManager->RegisterTool( new DRC_TOOL );
1136 m_toolManager->RegisterTool( new PCB_VIEWER_TOOLS );
1137 m_toolManager->RegisterTool( new CONVERT_TOOL );
1138 m_toolManager->RegisterTool( new PCB_GROUP_TOOL );
1139 m_toolManager->RegisterTool( new CONSTRAINT_EDIT_TOOL );
1140 m_toolManager->RegisterTool( new GENERATOR_TOOL );
1141 m_toolManager->RegisterTool( new VIA_STITCH_TOOL );
1142 m_toolManager->RegisterTool( new PROPERTIES_TOOL );
1143 m_toolManager->RegisterTool( new MULTICHANNEL_TOOL );
1144 m_toolManager->RegisterTool( new MATCH_PROPERTIES_TOOL );
1145 m_toolManager->RegisterTool( new GRAPHIC_EDIT_TOOL );
1146 m_toolManager->RegisterTool( new EMBED_TOOL );
1147 m_toolManager->RegisterTool( new DIFF_PHASE_SKEW_TOOL );
1148 m_toolManager->InitTools();
1149
1150 for( TOOL_BASE* tool : m_toolManager->Tools() )
1151 {
1152 if( PCB_TOOL_BASE* pcbTool = dynamic_cast<PCB_TOOL_BASE*>( tool ) )
1153 pcbTool->SetIsBoardEditor( true );
1154 }
1155
1156 // Run the selection tool, it is supposed to be always active
1157 m_toolManager->InvokeTool( "common.InteractiveSelection" );
1158}
1159
1160
1162{
1164
1165 ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
1166 PCB_EDITOR_CONDITIONS cond( this );
1167
1168 auto undoCond =
1169 [ this ] (const SELECTION& aSel )
1170 {
1171 DRAWING_TOOL* drawingTool = m_toolManager->GetTool<DRAWING_TOOL>();
1172
1173 if( drawingTool && drawingTool->GetDrawingMode() != DRAWING_TOOL::MODE::NONE )
1174 return true;
1175
1176 ROUTER_TOOL* routerTool = m_toolManager->GetTool<ROUTER_TOOL>();
1177
1178 if( routerTool && routerTool->RoutingInProgress() )
1179 return true;
1180
1181 return GetUndoCommandCount() > 0;
1182 };
1183
1184 auto groupWithDesignBlockLink =
1185 [] ( const SELECTION& aSel )
1186 {
1187 if( aSel.Size() != 1 )
1188 return false;
1189
1190 if( aSel[0]->Type() != PCB_GROUP_T )
1191 return false;
1192
1193 PCB_GROUP* group = static_cast<PCB_GROUP*>( aSel.GetItem( 0 ) );
1194
1195 return group->HasDesignBlockLink();
1196 };
1197
1198 wxASSERT( mgr );
1199
1200#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
1201#define CHECK( x ) ACTION_CONDITIONS().Check( x )
1202// clang-format off
1203
1205 mgr->SetConditions( ACTIONS::undo, ENABLE( undoCond ) );
1207
1211
1212 mgr->SetConditions( ACTIONS::cut, ENABLE( cond.HasItems() ) );
1213 mgr->SetConditions( ACTIONS::copy, ENABLE( cond.HasItems() ) );
1220
1221 // Keep immediate-mode dispatch alive while a tool is mid-edit on an empty board, where
1222 // HasItems() is still false but an item is under construction under the cursor.
1223 auto hasElements =
1224 [ this ] ( const SELECTION& aSel )
1225 {
1226 return GetBoard() &&
1227 ( !GetBoard()->IsEmpty() || !SELECTION_CONDITIONS::Idle( aSel ) );
1228 };
1229
1231 ENABLE( SELECTION_CONDITIONS::NotEmpty ).HotkeyEnable( hasElements ) );
1233 ENABLE( SELECTION_CONDITIONS::NotEmpty ).HotkeyEnable( hasElements ) );
1235 ENABLE( SELECTION_CONDITIONS::NotEmpty ).HotkeyEnable( hasElements ) );
1237 ENABLE( SELECTION_CONDITIONS::NotEmpty ).HotkeyEnable( hasElements ) );
1239 ENABLE( SELECTION_CONDITIONS::NotEmpty ).HotkeyEnable( hasElements ) );
1240
1241 static const std::vector<KICAD_T> groupTypes = { PCB_GROUP_T, PCB_GENERATOR_T };
1242
1247
1248 mgr->SetConditions( PCB_ACTIONS::placeLinkedDesignBlock, ENABLE( groupWithDesignBlockLink) );
1249 mgr->SetConditions( PCB_ACTIONS::saveToLinkedDesignBlock, ENABLE( groupWithDesignBlockLink) );
1250
1256
1257 auto enableZoneControlCondition =
1258 [this] ( const SELECTION& )
1259 {
1262 };
1263
1265 ENABLE( enableZoneControlCondition )
1268 ENABLE( enableZoneControlCondition )
1271 ENABLE( enableZoneControlCondition )
1274 ENABLE( enableZoneControlCondition )
1276
1278
1279 auto autoConstraintsCond =
1280 []( const SELECTION& )
1281 {
1283 return cfg && cfg->m_AutoConstraints;
1284 };
1285
1286 mgr->SetConditions( PCB_ACTIONS::toggleAutoConstraints, CHECK( autoConstraintsCond ) );
1287
1288 auto boardFlippedCond =
1289 [this]( const SELECTION& )
1290 {
1292 };
1293
1294 auto layerManagerCond =
1295 [this] ( const SELECTION& )
1296 {
1297 return LayerManagerShown();
1298 };
1299
1300 auto propertiesCond =
1301 [this] ( const SELECTION& )
1302 {
1303 return PropertiesShown();
1304 };
1305
1306 auto netInspectorCond =
1307 [this] ( const SELECTION& )
1308 {
1309 return NetInspectorShown();
1310 };
1311
1312 auto searchPaneCond =
1313 [this] ( const SELECTION& )
1314 {
1315 return m_auimgr.GetPane( SearchPaneName() ).IsShown();
1316 };
1317
1318 auto constraintsPaneCond =
1319 [this] ( const SELECTION& )
1320 {
1321 return m_auimgr.GetPane( ConstraintsPaneName() ).IsShown();
1322 };
1323
1324 auto designBlockCond =
1325 [ this ] (const SELECTION& aSel )
1326 {
1327 return m_auimgr.GetPane( DesignBlocksPaneName() ).IsShown();
1328 };
1329
1330 auto gitCommitPaneCond =
1331 [this] ( const SELECTION& )
1332 {
1333 return IsGitCommitPaneShown();
1334 };
1335
1336 auto highContrastCond =
1337 [this] ( const SELECTION& )
1338 {
1340 };
1341
1342 auto globalRatsnestCond =
1343 [this] (const SELECTION& )
1344 {
1346 return cfg && cfg->m_Display.m_ShowGlobalRatsnest;
1347 };
1348
1349 auto curvedRatsnestCond =
1350 [this] (const SELECTION& )
1351 {
1353 return cfg && cfg->m_Display.m_DisplayRatsnestLinesCurved;
1354 };
1355
1356 auto netHighlightCond =
1357 [this]( const SELECTION& )
1358 {
1359 if( PCB_DRAW_PANEL_GAL* canvas = GetCanvas() )
1360 {
1361 if( KIGFX::PCB_VIEW* view = canvas->GetView() )
1362 {
1363 if( KIGFX::PAINTER* painter = view->GetPainter() )
1364 {
1365 if( RENDER_SETTINGS* settings = painter->GetSettings() )
1366 return !settings->GetHighlightNetCodes().empty();
1367 }
1368 }
1369 }
1370
1371 return false;
1372 };
1373
1374 auto enableNetHighlightCond =
1375 [this]( const SELECTION& )
1376 {
1378 return tool && tool->IsNetHighlightSet();
1379 };
1380
1381 mgr->SetConditions( ACTIONS::highContrastMode, CHECK( highContrastCond ) );
1382 mgr->SetConditions( PCB_ACTIONS::flipBoard, CHECK( boardFlippedCond ) );
1383 mgr->SetConditions( PCB_ACTIONS::showLayersManager, CHECK( layerManagerCond ) );
1384 mgr->SetConditions( PCB_ACTIONS::showRatsnest, CHECK( globalRatsnestCond ) );
1385 mgr->SetConditions( PCB_ACTIONS::ratsnestLineMode, CHECK( curvedRatsnestCond ) );
1386 mgr->SetConditions( PCB_ACTIONS::toggleNetHighlight, CHECK( netHighlightCond )
1387 .Enable( enableNetHighlightCond ) );
1388 mgr->SetConditions( ACTIONS::showProperties, CHECK( propertiesCond ) );
1389 mgr->SetConditions( PCB_ACTIONS::showNetInspector, CHECK( netInspectorCond ) );
1390 mgr->SetConditions( PCB_ACTIONS::showSearch, CHECK( searchPaneCond ) );
1391 mgr->SetConditions( PCB_ACTIONS::showConstraintsPanel, CHECK( constraintsPaneCond ) );
1392 mgr->SetConditions( PCB_ACTIONS::showDesignBlockPanel, CHECK( designBlockCond ) );
1393 mgr->SetConditions( ACTIONS::showGitCommitPane, CHECK( gitCommitPaneCond ) );
1394
1397
1398 const auto isArcKeepCenterMode =
1399 [this]( const SELECTION& )
1400 {
1403 };
1404
1405 const auto isArcKeepEndpointMode =
1406 [this]( const SELECTION& )
1407 {
1410 };
1411
1412 const auto isArcKeepRadiusMode =
1413 [this]( const SELECTION& )
1414 {
1417 };
1418
1419 mgr->SetConditions( ACTIONS::pointEditorArcKeepCenter, CHECK( isArcKeepCenterMode ) );
1420 mgr->SetConditions( ACTIONS::pointEditorArcKeepEndpoint, CHECK( isArcKeepEndpointMode ) );
1421 mgr->SetConditions( ACTIONS::pointEditorArcKeepRadius, CHECK( isArcKeepRadiusMode ) );
1422
1423 auto isHighlightMode =
1424 [this]( const SELECTION& )
1425 {
1426 ROUTER_TOOL* tool = m_toolManager->GetTool<ROUTER_TOOL>();
1427 return tool && tool->GetRouterMode() == PNS::RM_MarkObstacles;
1428 };
1429
1430 auto isShoveMode =
1431 [this]( const SELECTION& )
1432 {
1433 ROUTER_TOOL* tool = m_toolManager->GetTool<ROUTER_TOOL>();
1434 return tool && tool->GetRouterMode() == PNS::RM_Shove;
1435 };
1436
1437 auto isWalkaroundMode =
1438 [this]( const SELECTION& )
1439 {
1440 ROUTER_TOOL* tool = m_toolManager->GetTool<ROUTER_TOOL>();
1441 return tool && tool->GetRouterMode() == PNS::RM_Walkaround;
1442 };
1443
1444 mgr->SetConditions( PCB_ACTIONS::routerHighlightMode, CHECK( isHighlightMode ) );
1445 mgr->SetConditions( PCB_ACTIONS::routerShoveMode, CHECK( isShoveMode ) );
1446 mgr->SetConditions( PCB_ACTIONS::routerWalkaroundMode, CHECK( isWalkaroundMode ) );
1447
1448 auto isAutoTrackWidth =
1449 [this]( const SELECTION& )
1450 {
1452 };
1453
1454 mgr->SetConditions( PCB_ACTIONS::autoTrackWidth, CHECK( isAutoTrackWidth ) );
1455
1456 auto haveNetCond =
1457 [] ( const SELECTION& aSel )
1458 {
1459 for( EDA_ITEM* item : aSel )
1460 {
1461 if( BOARD_CONNECTED_ITEM* bci = dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) )
1462 {
1463 if( bci->GetNetCode() > 0 )
1464 return true;
1465 }
1466 }
1467
1468 return false;
1469 };
1470
1471 auto connectedOrFootprintCond =
1472 [] ( const SELECTION& aSel )
1473 {
1474 if( aSel.Empty() )
1475 return false;
1476
1477 for( EDA_ITEM* item : aSel )
1478 {
1479 if( item->Type() == PCB_FOOTPRINT_T )
1480 continue;
1481
1482 if( !dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) )
1483 return false;
1484 }
1485
1486 return true;
1487 };
1488
1489 mgr->SetConditions( PCB_ACTIONS::showNetInRatsnest, ENABLE( haveNetCond ) );
1490 mgr->SetConditions( PCB_ACTIONS::hideNetInRatsnest, ENABLE( haveNetCond ) );
1493
1494 static const std::vector<KICAD_T> trackTypes = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T };
1495 static const std::vector<KICAD_T> padOwnerTypes = { PCB_FOOTPRINT_T, PCB_PAD_T };
1496 static const std::vector<KICAD_T> footprintTypes = { PCB_FOOTPRINT_T };
1497 static const std::vector<KICAD_T> crossProbeTypes = { PCB_PAD_T, PCB_FOOTPRINT_T, PCB_GROUP_T };
1498 static const std::vector<KICAD_T> zoneTypes = { PCB_ZONE_T };
1499
1503 mgr->SetConditions( PCB_ACTIONS::grabUnconnected, ENABLE( connectedOrFootprintCond ) );
1506
1507
1509 && SELECTION_CONDITIONS::OnlyTypes( zoneTypes );
1510
1512 && SELECTION_CONDITIONS::OnlyTypes( zoneTypes );
1513
1514 mgr->SetConditions( PCB_ACTIONS::zoneDuplicate, ENABLE( singleZoneCond ) );
1515 mgr->SetConditions( PCB_ACTIONS::drawZoneCutout, ENABLE( singleZoneCond ) );
1516 mgr->SetConditions( PCB_ACTIONS::drawSimilarZone, ENABLE( singleZoneCond ) );
1517 mgr->SetConditions( PCB_ACTIONS::zoneMerge, ENABLE( zoneMergeCond ) );
1518
1521
1522#define CURRENT_TOOL( action ) mgr->SetConditions( action, CHECK( cond.CurrentTool( action ) ) )
1523
1524 // These tools can be used at any time to inspect the board
1529
1530 auto isDRCIdle =
1531 [this] ( const SELECTION& )
1532 {
1533 DRC_TOOL* tool = m_toolManager->GetTool<DRC_TOOL>();
1534 return !( tool && tool->IsDRCRunning() );
1535 };
1536
1537#define CURRENT_EDIT_TOOL( action ) \
1538 mgr->SetConditions( action, ACTION_CONDITIONS().Check( cond.CurrentTool( action ) ) \
1539 .Enable( isDRCIdle ) )
1540
1541 // These tools edit the board, so they must be disabled during some operations
1579
1598
1604
1605#undef CURRENT_TOOL
1606#undef CURRENT_EDIT_TOOL
1607#undef ENABLE
1608#undef CHECK
1609// clang-format on
1610}
1611
1612
1613void PCB_EDIT_FRAME::OnQuit( wxCommandEvent& event )
1614{
1615 if( event.GetId() == wxID_EXIT )
1616 Kiway().OnKiCadExit();
1617
1618 if( event.GetId() == wxID_CLOSE || Kiface().IsSingle() )
1619 Close( false );
1620}
1621
1622
1623void PCB_EDIT_FRAME::ResolveDRCExclusions( bool aCreateMarkers )
1624{
1625 addExclusionMarkers( GetBoard()->ResolveDRCExclusions( aCreateMarkers ) );
1626}
1627
1628
1629void PCB_EDIT_FRAME::addExclusionMarkers( const std::vector<PCB_MARKER*>& aMarkers )
1630{
1631 BOARD_COMMIT commit( this );
1632
1633 for( PCB_MARKER* marker : aMarkers )
1634 {
1635 if( marker->GetMarkerType() == MARKER_BASE::MARKER_DRAWING_SHEET )
1636 marker->GetRCItem()->SetItems( GetCanvas()->GetDrawingSheet() );
1637
1638 commit.Add( marker );
1639 }
1640
1641 commit.Push( wxEmptyString, SKIP_UNDO | SKIP_SET_DIRTY );
1642
1643 for( PCB_MARKER* marker : GetBoard()->Markers() )
1644 {
1645 if( marker->GetSeverity() == RPT_SEVERITY_EXCLUSION )
1646 GetCanvas()->GetView()->Update( marker );
1647 }
1648
1650}
1651
1652
1653bool PCB_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
1654{
1655 // Shutdown blocks must be determined and vetoed as early as possible
1657 return false;
1658
1659 ZONE_FILLER_TOOL* zoneFillerTool = m_toolManager->GetTool<ZONE_FILLER_TOOL>();
1660
1661 if( zoneFillerTool->IsBusy() )
1662 {
1663 wxBell();
1664
1665 if( wxWindow* reporter = dynamic_cast<wxWindow*>( zoneFillerTool->GetProgressReporter() ) )
1666 reporter->ShowWithEffect( wxSHOW_EFFECT_EXPAND );
1667
1668 return false;
1669 }
1670
1671 // Don't allow closing while the modal footprint chooser is open
1672 // Use C-style cast due to Mac's inability to dynamic cast between compile modules
1674
1675 if( chooser && chooser->IsModal() ) // Can close footprint chooser?
1676 return false;
1677
1678 if( Kiface().IsSingle() )
1679 {
1680 // Use C-style cast due to Mac's inability to dynamic cast between compile modules
1682
1683 if( fpEditor )
1684 {
1685 bool cancel = !fpEditor->Close(); // Can close footprint editor?
1686
1687 // If fp editor had unsaved changes it will have been fronted. Bring board editor back to front.
1688 Raise();
1689
1690 if( cancel )
1691 return false;
1692 }
1693
1694 // Use C-style cast due to Mac's inability to dynamic cast between compile modules
1696
1697 if( fpViewer && !fpViewer->Close() ) // Can close footprint viewer?
1698 return false;
1699 }
1700 else
1701 {
1702 // Use C-style cast due to Mac's inability to dynamic cast between compile modules
1704
1705 if( fpEditor )
1706 {
1707 bool cancel = !fpEditor->HandleUnsavedChanges( true );
1708
1709 // If fp editor had unsaved changes it will have been fronted. Bring board editor back to front.
1710 Raise();
1711
1712 if( cancel )
1713 return false;
1714 }
1715 }
1716
1718 return false;
1719
1720 if( IsContentModified() )
1721 {
1722 wxFileName fileName = GetBoard()->GetFileName();
1723 wxString msg = _( "Save changes to '%s' before closing?" );
1724
1725 wxSafeYield( this, true ); // Allow frame to come to front before showing "Save Changes?"
1726
1727 if( !HandleUnsavedChanges( this, wxString::Format( msg, fileName.GetFullName() ),
1728 [&]() -> bool
1729 {
1730 return SaveBoard();
1731 } ) )
1732 {
1733 return false;
1734 }
1735
1736 // If user discarded changes, create a duplicate commit of last saved PCB state and
1737 // advance Last_Save_pcb tag for explicit history event.
1738 if( GetLastUnsavedChangesResponse() == wxID_NO )
1739 {
1740 wxString projPath = Prj().GetProjectPath();
1741
1742 if( !projPath.IsEmpty() && Kiway().LocalHistory().HistoryExists( projPath ) )
1743 {
1744 Kiway().LocalHistory().CommitDuplicateOfLastSave( projPath, wxS( "pcb" ),
1745 wxS( "Discard unsaved pcb changes" ) );
1746 }
1747 }
1748 }
1749
1750 return PCB_BASE_EDIT_FRAME::canCloseWindow( aEvent );
1751}
1752
1753
1755{
1756 // Unregister the autosave saver before any cleanup that might invalidate the board
1757 if( GetBoard() )
1759
1760 // On Windows 7 / 32 bits, on OpenGL mode only, Pcbnew crashes
1761 // when closing this frame if a footprint was selected, and the footprint editor called
1762 // to edit this footprint, and when closing pcbnew if this footprint is still selected
1763 // See https://bugs.launchpad.net/kicad/+bug/1655858
1764 // I think this is certainly a OpenGL event fired after frame deletion, so this workaround
1765 // avoid the crash (JPC)
1766 GetCanvas()->SetEvtHandlerEnabled( false );
1767
1769
1772
1773 // Clean up mode-less dialogs.
1774 Unbind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &PCB_EDIT_FRAME::onCloseModelessBookReporterDialogs, this );
1775 Unbind( EDA_EVT_CLOSE_DIALOG_FOOTPRINT_FIELDS_TABLE, &PCB_EDIT_FRAME::onCloseFootprintFieldsTableDialog, this );
1776
1777 wxWindow* drcDlg = wxWindow::FindWindowByName( DIALOG_DRC_WINDOW_NAME );
1778
1779 if( drcDlg )
1780 drcDlg->Close( true );
1781
1782 if( m_findDialog )
1783 {
1784 m_findDialog->Destroy();
1785 m_findDialog = nullptr;
1786 }
1787
1789 {
1790 m_findByPropertiesDialog->Destroy();
1791 m_findByPropertiesDialog = nullptr;
1792 }
1793
1795 {
1796 m_inspectDrcErrorDlg->Destroy();
1797 m_inspectDrcErrorDlg = nullptr;
1798 }
1799
1801 {
1802 m_inspectClearanceDlg->Destroy();
1803 m_inspectClearanceDlg = nullptr;
1804 }
1805
1807 {
1808 m_inspectConstraintsDlg->Destroy();
1809 m_inspectConstraintsDlg = nullptr;
1810 }
1811
1812 if( m_footprintDiffDlg )
1813 {
1814 m_footprintDiffDlg->Destroy();
1815 m_footprintDiffDlg = nullptr;
1816 }
1817
1819 {
1822 }
1823
1824 // Delete the auto save file if it exists. Only sweep when the board was actually dirtied in this session;
1825 // otherwise an existing autosave is a previous-session leftover the user explicitly deferred in the recovery
1826 // dialog.
1827 if( !Prj().IsNullProject() && GetBoard() && IsContentModified() )
1828 {
1829 Kiway().LocalHistory().RemoveAutosaveFiles( Prj().GetProjectPath(), { GetBoard()->GetFileName() } );
1830 }
1831
1832 // Make sure local settings are persisted
1833 if( Prj().GetLocalSettings().ShouldAutoSave() )
1834 {
1835 m_netInspectorPanel->SaveSettings();
1837 }
1838 else
1839 {
1840 wxLogTrace( traceAutoSave, wxT( "Skipping auto-save of migrated local settings" ) );
1841 }
1842
1843 // Do not show the layer manager during closing to avoid flicker on some platforms (Windows) that
1844 // generate useless redraw of items in the Layer Manager
1846 {
1847 m_auimgr.GetPane( wxS( "LayersManager" ) ).Show( false );
1848 m_auimgr.GetPane( wxS( "TabbedPanel" ) ).Show( false );
1849 }
1850
1851 // Unlink the old project if needed
1853
1854 // Delete board structs and undo/redo lists, to avoid crash on exit when deleting some structs
1855 // (mainly in undo/redo lists) too late
1856 Clear_Pcb( false, true );
1857
1858 // do not show the window because ScreenPcb will be deleted and we do not want any paint event
1859 Show( false );
1860
1862}
1863
1864
1871
1872
1874{
1875 BOARD* board = GetBoard();
1876 KIGFX::VIEW* view = GetCanvas()->GetView();
1877
1878 board->RefreshDrillSymbolLayers();
1879
1880 for( PCB_TRACK* track : board->Tracks() )
1881 {
1882 if( track->Type() == PCB_VIA_T )
1883 view->Update( track, aUpdateFlags );
1884 }
1885
1886 for( FOOTPRINT* footprint : board->Footprints() )
1887 {
1888 for( PAD* pad : footprint->Pads() )
1889 {
1890 if( pad->HasHole() )
1891 view->Update( pad, aUpdateFlags );
1892 }
1893 }
1894
1895 GetCanvas()->Refresh();
1896}
1897
1898
1899void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage, wxWindow* aParent )
1900{
1901 static std::mutex dialogMutex; // Local static mutex
1902
1903 std::unique_lock<std::mutex> dialogLock( dialogMutex, std::try_to_lock );
1904
1905 // One dialog at a time.
1906 if( !dialogLock.owns_lock() )
1907 {
1908 if( m_boardSetupDlg && m_boardSetupDlg->IsShown() )
1909 {
1910 m_boardSetupDlg->Raise(); // Brings the existing dialog to the front
1911 }
1912
1913 return;
1914 }
1915
1916 // Make sure everything's up-to-date
1918
1919 DIALOG_BOARD_SETUP dlg( this, aParent );
1920
1921 if( !aInitialPage.IsEmpty() )
1922 dlg.SetInitialPage( aInitialPage, wxEmptyString );
1923
1924 // Assign dlg to the m_boardSetupDlg pointer to track its status.
1925 m_boardSetupDlg = &dlg;
1926
1927 // QuasiModal required for Scintilla auto-complete
1928 if( dlg.ShowQuasiModal() == wxID_OK )
1929 {
1930 // We don't know if anything was modified, so err on the side of requiring a save
1931 OnModify();
1932
1935 }
1936
1937 GetCanvas()->SetFocus();
1938
1939 // Reset m_boardSetupDlg after the dialog is closed
1940 m_boardSetupDlg = nullptr;
1941}
1942
1943
1945{
1946 // Note: We must synchronise time domain properties before nets and classes, otherwise the updates
1947 // called by the board listener events are using stale data
1950
1951 if( !GetBoard()->SynchronizeComponentClasses( std::unordered_set<wxString>() ) )
1952 {
1953 m_infoBar->RemoveAllButtons();
1954 m_infoBar->AddCloseButton();
1955 m_infoBar->ShowMessage( _( "Could not load component class assignment rules" ), wxICON_WARNING,
1956 WX_INFOBAR::MESSAGE_TYPE::GENERIC );
1957 }
1958
1959 // Text variables resolve through the board's own copy of them before the project's
1961
1964
1965 // CROSS_REF keys deliberately excluded — those are driven by per-item
1966 // BOARD_COMMIT changes.
1967 if( BOARD_TEXT_VAR_ADAPTER* adapter = GetBoard()->GetTextVarAdapter() )
1968 adapter->Tracker().InvalidateProjectScoped();
1969
1970 PCBNEW_SETTINGS* settings = GetPcbNewSettings();
1971 static LSET maskAndPasteLayers = LSET( { F_Mask, F_Paste, B_Mask, B_Paste } );
1972
1974 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
1975 {
1976 int flags = 0;
1977
1978 if( !aItem->IsBOARD_ITEM() )
1979 return flags;
1980
1981 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aItem );
1982
1983 if( item->Type() == PCB_VIA_T || item->Type() == PCB_PAD_T )
1984 {
1985 // Note: KIGFX::REPAINT isn't enough for things that go from invisible
1986 // to visible as they won't be found in the view layer's itemset for
1987 // re-painting.
1988 if( ( GetBoard()->GetVisibleLayers() & maskAndPasteLayers ).any() )
1989 flags |= KIGFX::ALL;
1990 }
1991
1992 if( item->Type() == PCB_TRACE_T || item->Type() == PCB_ARC_T || item->Type() == PCB_VIA_T )
1993 {
1995 flags |= KIGFX::REPAINT;
1996 }
1997
1998 if( item->Type() == PCB_PAD_T )
1999 {
2000 if( settings->m_Display.m_PadClearance )
2001 flags |= KIGFX::REPAINT;
2002 }
2003
2004 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem ) )
2005 {
2006 if( text->HasTextVars() )
2007 {
2008 text->ClearRenderCache();
2009 text->ClearBoundingBoxCache();
2011 }
2012 }
2013
2014 return flags;
2015 } );
2016
2017 GetCanvas()->Refresh();
2018
2021 // Before the model change, which makes the router reload its rules from the engine
2024
2025 //this event causes the routing tool to reload its design rules information
2027 toolEvent.SetHasPosition( false );
2028 m_toolManager->ProcessEvent( toolEvent );
2029}
2030
2031
2033{
2034 // Everything this frame copied from the project file and would write back on save or close
2037
2038 LAYER_PAIR current = m_layerPairSettings->GetCurrentLayerPair();
2039 m_layerPairSettings->SetLayerPairs( Prj().GetProjectFile().m_LayerPairInfos );
2040 m_layerPairSettings->SetCurrentLayerPair( current );
2041
2043 viewer->ApplyProjectFileSettings();
2044
2045 std::vector<PCB_MARKER*> stale;
2046 std::vector<PCB_MARKER*> created = GetBoard()->ReloadDRCExclusions( stale );
2047
2048 if( !stale.empty() )
2049 {
2051
2052 std::unordered_set<const EDA_ITEM*> freed( stale.begin(), stale.end() );
2053 m_undoList.ForgetItems( freed );
2054 m_redoList.ForgetItems( freed );
2055 }
2056
2057 for( PCB_MARKER* marker : stale )
2058 {
2059 GetCanvas()->GetView()->Remove( marker );
2060 GetBoard()->Delete( marker );
2061 }
2062
2063 addExclusionMarkers( created );
2064
2065 // The dialog lists marker pointers, some of which were just deleted
2066 if( DIALOG_DRC* drcDialog = m_toolManager->GetTool<DRC_TOOL>()->GetDRCDialog() )
2067 drcDialog->UpdateData();
2068
2070
2071 // Net colors and the drawing sheet reach every item, not just the ones the refresh picks
2073 GetCanvas()->Refresh();
2074}
2075
2076
2078{
2079 m_searchPane->FocusSearch();
2080}
2081
2082
2084{
2086
2087 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
2088 wxASSERT( cfg );
2089
2090 if( cfg )
2091 {
2095 }
2096}
2097
2098
2100{
2102
2103 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
2104 wxASSERT( cfg );
2105
2106 if( cfg )
2107 {
2108 wxAuiPaneInfo& apperancePane = m_auimgr.GetPane( AppearancePanelName() );
2109 cfg->m_AuiPanels.show_layer_manager = apperancePane.IsShown();
2110
2111 if( m_propertiesPanel )
2112 {
2113 cfg->m_AuiPanels.show_properties = m_propertiesPanel->IsShownOnScreen();
2115 cfg->m_AuiPanels.properties_splitter = m_propertiesPanel->SplitterProportion();
2116 }
2117
2118 // ensure m_ShowSearch is up to date (the pane can be closed)
2119 wxAuiPaneInfo& searchPaneInfo = m_auimgr.GetPane( SearchPaneName() );
2120 m_ShowSearch = searchPaneInfo.IsShown();
2122 cfg->m_AuiPanels.search_panel_height = m_searchPane->GetSize().y;
2123 cfg->m_AuiPanels.search_panel_width = m_searchPane->GetSize().x;
2124 cfg->m_AuiPanels.search_panel_dock_direction = searchPaneInfo.dock_direction;
2125
2126 cfg->m_AuiPanels.show_git_commit_pane = m_auimgr.GetPane( GitCommitPaneName() ).IsShown();
2127
2129 {
2130 wxAuiPaneInfo& netInspectorhPaneInfo = m_auimgr.GetPane( NetInspectorPanelName() );
2131 m_ShowNetInspector = netInspectorhPaneInfo.IsShown();
2133 }
2134
2135 if( m_appearancePanel )
2136 {
2139 cfg->m_AuiPanels.appearance_expand_layer_display = m_appearancePanel->IsLayerOptionsExpanded();
2140 cfg->m_AuiPanels.appearance_expand_net_display = m_appearancePanel->IsNetOptionsExpanded();
2141 }
2142
2143 wxAuiPaneInfo& designBlocksPane = m_auimgr.GetPane( DesignBlocksPaneName() );
2144 cfg->m_AuiPanels.design_blocks_show = designBlocksPane.IsShown();
2145
2146 if( designBlocksPane.IsDocked() )
2147 {
2149 }
2150 else
2151 {
2152 cfg->m_AuiPanels.design_blocks_panel_float_height = designBlocksPane.floating_size.y;
2153 cfg->m_AuiPanels.design_blocks_panel_float_width = designBlocksPane.floating_size.x;
2154 }
2155
2156 m_designBlocksPane->SaveSettings();
2157 }
2158}
2159
2160
2162{
2163 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( config() );
2164
2165 return cfg ? cfg->m_RotationAngle : ANGLE_90;
2166}
2167
2168
2173
2174
2176{
2177
2178 GetColorSettings()->SetColor( LAYER_GRID, aColor );
2179 GetCanvas()->GetGAL()->SetGridColor( aColor );
2180}
2181
2182
2183void PCB_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer, bool aForceRedraw )
2184{
2185 const PCB_LAYER_ID oldLayer = GetActiveLayer();
2186
2187 if( oldLayer == aLayer && !aForceRedraw )
2188 return;
2189
2191
2192 m_appearancePanel->OnLayerChanged();
2193
2194 m_toolManager->PostAction( PCB_ACTIONS::layerChanged ); // notify other tools
2195 GetCanvas()->SetFocus(); // allow capture of hotkeys
2196
2197 if( aForceRedraw )
2198 GetCanvas()->SetHighContrastLayer( aLayer );
2199 else
2201
2202 /*
2203 * Only show pad, via and track clearances when a copper layer is active
2204 * and then only show the clearance layer for that copper layer. For
2205 * front/back non-copper layers, show the clearance layer for the outer
2206 * layer on that side.
2207 *
2208 * For pads/vias, this is to avoid clutter when there are pad/via layers
2209 * that vary in flash (i.e. clearance from the hole or pad edge), padstack
2210 * shape on each layer or clearances on each layer.
2211 *
2212 * For tracks, this follows the same logic as pads/vias, but in theory could
2213 * have their own set of independent clearance layers to allow track clearance
2214 * to be shown for more layers.
2215 */
2216 const auto getClearanceLayerForActive =
2217 []( PCB_LAYER_ID aActiveLayer ) -> std::optional<int>
2218 {
2219 if( IsCopperLayer( aActiveLayer ) )
2220 return CLEARANCE_LAYER_FOR( aActiveLayer );
2221
2222 return std::nullopt;
2223 };
2224
2225 if( std::optional<int> oldClearanceLayer = getClearanceLayerForActive( oldLayer ) )
2226 GetCanvas()->GetView()->SetLayerVisible( *oldClearanceLayer, false );
2227
2228 if( std::optional<int> newClearanceLayer = getClearanceLayerForActive( aLayer ) )
2229 GetCanvas()->GetView()->SetLayerVisible( *newClearanceLayer, true );
2230
2231 // per-layer view groups already hold each layer geometry so an active-layer change needs no
2232 // re-tessellation just clearance visibility above and the recolour in SetHighContrastLayer
2233
2234 // idle refresh coalesces mashed hotkeys into one repaint forced redraws stay immediate
2235 if( aForceRedraw )
2236 GetCanvas()->Refresh();
2237 else
2239}
2240
2241
2243{
2244 wxFileName fn( GetBoard()->GetFileName() );
2245
2247
2248 layerEnum.Choices().Clear();
2249 layerEnum.Undefined( UNDEFINED_LAYER );
2250
2251 for( PCB_LAYER_ID layer : LSET::AllLayersMask() )
2252 {
2253 // Canonical name
2254 layerEnum.Map( layer, LSET::Name( layer ) );
2255
2256 // User name
2257 layerEnum.Map( layer, GetBoard()->GetLayerName( layer ) );
2258 }
2259
2260 DRC_TOOL* drcTool = m_toolManager->GetTool<DRC_TOOL>();
2261
2262 try
2263 {
2264 drcTool->GetDRCEngine()->InitEngine( GetBoard()->GetDesignRulesPath() );
2265 }
2266 catch( PARSE_ERROR& )
2267 {
2268 // Not sure this is the best place to tell the user their rules are buggy, so
2269 // we'll stay quiet for now. Feel free to revisit this decision....
2270 }
2271
2273
2274 // Migrate obsolete WRL 3D model references to current STEP models. Only
2275 // runs in the GUI: CLI and scripting load paths must not mutate board
2276 // state on load. The STEP exporter does its own WRL->STEP substitution at
2277 // export time via the --subst-models flag, and the 3D cache quietly falls
2278 // back to sibling STEP files for missing WRLs in headless contexts.
2279 if( Pgm().IsGUI() )
2280 {
2281 // Silently replace references whose filename uniquely identifies a
2282 // STEP sibling. Leaves ambiguous cases for the infobar below.
2284
2285 if( int unresolved = DIALOG_MIGRATE_3D_MODELS::CountUnresolvedWrlReferences( this ) )
2286 {
2287 wxString msg = _( "WRL 3D model could not be matched to equivalent STEP model." );
2288
2289 if( unresolved > 1 )
2290 {
2291 msg = wxString::Format( _( "%d WRL 3D models could not be matched to equivalent STEP models." ),
2292 unresolved );
2293 }
2294
2295 m_loadNoticeInfoBar->RemoveAllButtons();
2296 m_loadNoticeInfoBar->AddLink( _( "Show options" ),
2297 [this]( wxHyperlinkEvent& )
2298 {
2299 DIALOG_MIGRATE_3D_MODELS dlg( this );
2300 dlg.ShowModal();
2301
2302 // Dismiss the infobar if nothing remains to resolve;
2303 // otherwise leave it so the user can try again.
2305 m_loadNoticeInfoBar->Dismiss();
2306 } );
2307 m_loadNoticeInfoBar->AddCloseButton();
2308 m_loadNoticeInfoBar->ShowMessageFor( msg, 10000, wxICON_INFORMATION );
2309 }
2310 }
2311
2312 UpdateTitle();
2313
2314 // Display a warning that the file is read only
2315 if( fn.FileExists() && !fn.IsFileWritable() )
2316 {
2317 m_infoBar->RemoveAllButtons();
2318 m_infoBar->AddCloseButton();
2319 m_infoBar->ShowMessage( _( "Board file is read only." ), wxICON_WARNING,
2320 WX_INFOBAR::MESSAGE_TYPE::OUTDATED_SAVE );
2321 }
2322
2324
2325 // Sync layer and item visibility
2327
2328 SetElementVisibility( LAYER_RATSNEST, GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
2329
2330 m_appearancePanel->OnBoardChanged();
2331
2332 // Apply saved display state to the appearance panel after it has been set up
2333 PROJECT_LOCAL_SETTINGS& localSettings = Prj().GetLocalSettings();
2334
2335 m_appearancePanel->ApplyLayerPreset( localSettings.m_ActiveLayerPreset );
2336
2337 if( GetBoard()->GetDesignSettings().IsLayerEnabled( localSettings.m_ActiveLayer ) )
2338 SetActiveLayer( localSettings.m_ActiveLayer, true );
2339 else
2340 SetActiveLayer( GetActiveLayer(), true ); // Make sure to repaint even if not switching
2341
2342 PROJECT_FILE& projectFile = Prj().GetProjectFile();
2343
2344 m_layerPairSettings->SetLayerPairs( projectFile.m_LayerPairInfos );
2345 m_layerPairSettings->SetCurrentLayerPair( LAYER_PAIR{ F_Cu, B_Cu } );
2346
2347 // Updates any auto dimensions and the auxiliary toolbar tracks/via sizes
2349
2350 // Sync the net inspector now we have connectivity calculated
2352 m_netInspectorPanel->OnBoardChanged();
2353
2354 // Display the loaded board:
2355 Zoom_Automatique( false );
2356
2357 // The DRC engine above makes clearances computable, so only the items that draw a
2358 // clearance outline are stale; marking every item re-tessellates the whole board
2359 {
2360 KIGFX::VIEW* view = GetCanvas()->GetView();
2361 const auto& opts = GetPcbNewSettings()->m_Display;
2362
2363 for( FOOTPRINT* footprint : GetBoard()->Footprints() )
2364 {
2365 for( PAD* pad : footprint->Pads() )
2366 view->Update( pad, KIGFX::REPAINT );
2367 }
2368
2369 if( opts.m_TrackClearance == SHOW_WITH_VIA_ALWAYS )
2370 {
2371 for( PCB_TRACK* track : GetBoard()->Tracks() )
2372 view->Update( track, KIGFX::REPAINT );
2373 }
2374 }
2375
2376 Refresh();
2377
2378 SetMsgPanel( GetBoard() );
2379 SetStatusText( wxEmptyString );
2380
2381 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "PCB file changes are unsaved" ) );
2382}
2383
2384
2386{
2387 m_appearancePanel->UpdateDisplayOptions();
2388}
2389
2390
2392{
2393 return GetBoard()->IsElementVisible( aElement );
2394}
2395
2396
2398{
2399 // Force the RATSNEST visible
2400 if( aElement == LAYER_RATSNEST )
2401 GetCanvas()->GetView()->SetLayerVisible( aElement, true );
2402 else
2403 GetCanvas()->GetView()->SetLayerVisible( aElement , aNewState );
2404
2405 GetBoard()->SetElementVisibility( aElement, aNewState );
2406}
2407
2408
2410{
2411 // call my base class
2413
2414 m_auimgr.GetPane( m_appearancePanel ).Caption( _( "Appearance" ) );
2415 m_auimgr.GetPane( m_selectionFilterPanel ).Caption( _( "Selection Filter" ) );
2416 m_auimgr.GetPane( m_propertiesPanel ).Caption( _( "Properties" ) );
2417 m_auimgr.GetPane( m_netInspectorPanel ).Caption( _( "Net Inspector" ) );
2418 m_auimgr.Update();
2419
2420 UpdateTitle();
2421}
2422
2423
2425{
2427
2428 if( project.m_PcbLastPath[ aType ].IsEmpty() )
2429 return wxEmptyString;
2430
2431 wxFileName absoluteFileName = project.m_PcbLastPath[ aType ];
2432 wxFileName pcbFileName = GetBoard()->GetFileName();
2433
2434 absoluteFileName.MakeAbsolute( pcbFileName.GetPath() );
2435 return absoluteFileName.GetFullPath();
2436}
2437
2438
2439void PCB_EDIT_FRAME::SetLastPath( LAST_PATH_TYPE aType, const wxString& aLastPath )
2440{
2442
2443 wxFileName relativeFileName = aLastPath;
2444 wxFileName pcbFileName = GetBoard()->GetFileName();
2445
2446 relativeFileName.MakeRelativeTo( pcbFileName.GetPath() );
2447
2448 if( relativeFileName.GetFullPath() != project.m_PcbLastPath[ aType ] )
2449 {
2450 project.m_PcbLastPath[ aType ] = relativeFileName.GetFullPath();
2451 OnModify();
2452 }
2453}
2454
2455
2457{
2459 Kiway().LocalHistory().NoteFileChange( GetBoard()->GetFileName() );
2460 m_ZoneFillsDirty = true;
2461
2462 if( m_isClosing )
2463 return;
2464
2465 // A generated table reports the board, so any edit may already have made it wrong
2466 // A drill chart compares a counter but a stackup table regenerates its text, ~100 us at 32 layers
2468
2469 Update3DView( true, GetPcbNewSettings()->m_Display.m_Live3DRefresh );
2470
2471 if( !GetTitle().StartsWith( wxT( "*" ) ) )
2472 UpdateTitle();
2473}
2474
2475
2476void PCB_EDIT_FRAME::OnBoardItemsChanged( BOARD& aBoard, std::vector<BOARD_ITEM*>& aItems )
2477{
2478 bool rebuilt = false;
2479
2480 for( BOARD_ITEM* item : aItems )
2481 {
2482 if( !IsGeneratedTableType( item->Type() ) )
2483 continue;
2484
2485 rebuilt = true;
2486
2487 if( GetCanvas() )
2488 GetCanvas()->GetView()->Update( item );
2489 }
2490
2491 // The rebuild may have freed selected cells, which can no longer be asked what they were
2492 PCB_SELECTION_TOOL* selTool = m_toolManager ? m_toolManager->GetTool<PCB_SELECTION_TOOL>() : nullptr;
2493
2494 if( rebuilt && selTool && !selTool->GetSelection().Empty() )
2495 selTool->RebuildSelection();
2496}
2497
2498
2500{
2501 // The libraries were read once and then cached. A refresh is where they need to be refreshed
2503
2504 Update3DView( true, true );
2505
2506 std::shared_ptr<CONNECTIVITY_DATA> connectivity = GetBoard()->GetConnectivity();
2507 connectivity->RecalculateRatsnest( nullptr );
2509
2510 std::vector<MSG_PANEL_ITEM> msg_list;
2511 GetBoard()->GetMsgPanelInfo( this, msg_list );
2512 SetMsgPanel( msg_list );
2513}
2514
2515
2517{
2518 wxFileName fn = GetBoard()->GetFileName();
2519 bool readOnly = false;
2520 bool unsaved = false;
2521
2522 if( fn.IsOk() && fn.FileExists() )
2523 readOnly = !fn.IsFileWritable();
2524 else
2525 unsaved = true;
2526
2527 wxString title;
2528
2529 if( IsContentModified() )
2530 title = wxT( "*" );
2531
2532 title += fn.GetName();
2533
2534 if( readOnly )
2535 title += wxS( " " ) + _( "[Read Only]" );
2536
2537 if( unsaved )
2538 title += wxS( " " ) + _( "[Unsaved]" );
2539
2540 title += wxT( " \u2014 " ) + _( "PCB Editor" );
2541
2542 SetTitle( title );
2543}
2544
2545
2547{
2548 // Update the layer manager and other widgets from the board setup
2549 // (layer and items visibility, colors ...)
2550
2551 // Rebuild list of nets (full ratsnest rebuild)
2553
2554 // Update info shown by the horizontal toolbars
2556
2557 LSET activeLayers = GetBoard()->GetEnabledLayers();
2558
2559 if( !activeLayers.test( GetActiveLayer() ) )
2560 SetActiveLayer( activeLayers.Seq().front() );
2561
2562 // The layer selector lives on the top auxiliary toolbar. Users can remove every
2563 // entry from that toolbar via Preferences, in which case the control is destroyed
2564 // and m_SelLayerBox is null. Avoid dereferencing it here.
2565 if( m_SelLayerBox )
2566 m_SelLayerBox->SetLayerSelection( GetActiveLayer() );
2567
2569
2570 layerEnum.Choices().Clear();
2571 layerEnum.Undefined( UNDEFINED_LAYER );
2572
2573 for( PCB_LAYER_ID layer : LSET::AllLayersMask() )
2574 {
2575 // Canonical name
2576 layerEnum.Map( layer, LSET::Name( layer ) );
2577
2578 // User name
2579 layerEnum.Map( layer, GetBoard()->GetLayerName( layer ) );
2580 }
2581
2583
2584 // Sync visibility with canvas
2585 for( PCB_LAYER_ID layer : LSET::AllLayersMask() )
2586 GetCanvas()->GetView()->SetLayerVisible( layer, GetBoard()->IsLayerVisible( layer ) );
2587
2588 // Stackup and/or color theme may have changed
2589 m_appearancePanel->OnBoardChanged();
2590 m_netInspectorPanel->OnParentSetupChanged();
2591}
2592
2593
2595{
2596 // switches currently used canvas (Cairo / OpenGL).
2597 PCB_BASE_FRAME::SwitchCanvas( aCanvasType );
2598}
2599
2600
2602{
2603 if( !m_findDialog )
2604 {
2605 m_findDialog = new DIALOG_FIND( this );
2606 m_findDialog->SetCallback( std::bind( &PCB_SELECTION_TOOL::FindItem,
2607 m_toolManager->GetTool<PCB_SELECTION_TOOL>(), _1 ) );
2608 }
2609
2610 wxString findString;
2611
2612 PCB_SELECTION& selection = m_toolManager->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
2613
2614 if( selection.Size() == 1 && selection.Front() != m_findDialog->GetItem() )
2615 {
2616 EDA_ITEM* front = selection.Front();
2617
2618 switch( front->Type() )
2619 {
2620 case PCB_FOOTPRINT_T:
2621 findString = UnescapeString( static_cast<FOOTPRINT*>( front )->GetValue() );
2622 break;
2623
2624 case PCB_FIELD_T:
2625 case PCB_TEXT_T:
2626 findString = UnescapeString( static_cast<PCB_TEXT*>( front )->GetText() );
2627
2628 if( findString.Contains( wxT( "\n" ) ) )
2629 findString = findString.Before( '\n' );
2630
2631 break;
2632
2633 default:
2634 break;
2635 }
2636 }
2637
2638 m_findDialog->Preload( findString );
2639
2640 m_findDialog->Show( true );
2641}
2642
2643
2652
2653
2659
2660
2666
2667
2668void PCB_EDIT_FRAME::FindNext( bool reverse )
2669{
2670 if( !m_findDialog )
2672
2673 m_findDialog->FindNext( reverse );
2674}
2675
2676
2678{
2679 if( Kiface().IsSingle() )
2680 return 0;
2681
2682 // Update PCB requires a netlist. Therefore the schematic editor must be running
2683 // If this is not the case, open the schematic editor
2684 KIWAY_PLAYER* frame = Kiway().Player( FRAME_SCH, true );
2685
2686 // If Kiway() cannot create the eeschema frame, it shows a error message, and
2687 // frame is null
2688 if( !frame )
2689 return -1;
2690
2691 if( !frame->IsShownOnScreen() )
2692 {
2693 wxEventBlocker blocker( this );
2694 wxFileName fn( Prj().GetProjectPath(), Prj().GetProjectName(), FILEEXT::KiCadSchematicFileExtension );
2695
2696 // Maybe the file hasn't been converted to the new s-expression file format so
2697 // see if the legacy schematic file is still in play.
2698 if( !fn.FileExists() )
2699 {
2701
2702 if( !fn.FileExists() )
2703 {
2704 DisplayErrorMessage( this, _( "The schematic for this board cannot be found." ) );
2705 return -2;
2706 }
2707 }
2708
2709 frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
2710
2711 // we show the schematic editor frame, because do not show is seen as
2712 // a not yet opened schematic by Kicad manager, which is not the case
2713 frame->Show( true );
2714
2715 // bring ourselves back to the front
2716 Raise();
2717 }
2718
2719 return 1; //Success!
2720}
2721
2722
2723bool PCB_EDIT_FRAME::FetchNetlistFromSchematic( NETLIST& aNetlist, const wxString& aAnnotateMessage )
2724{
2725 int standalone = TestStandalone();
2726
2727 if( standalone == 0 )
2728 {
2729 DisplayErrorMessage( this, _( "Cannot update the PCB because PCB editor is opened in stand-alone mode. "
2730 "In order to create or update PCBs from schematics, you must launch the "
2731 "KiCad project manager and create a project." ) );
2732 return false; // Not in standalone mode
2733 }
2734
2735 if( standalone < 0 ) // Problem with Eeschema or the schematic
2736 return false;
2737
2738 Raise(); // Show
2739
2740 std::string payload( aAnnotateMessage );
2741
2742 Kiway().ExpressMail( FRAME_SCH, MAIL_SCH_GET_NETLIST, payload, this );
2743
2744 // Sentinel reply means the user explicitly aborted; silently cancel and return focus to
2745 // the schematic rather than re-showing the annotation error
2746 if( payload == MAIL_SCH_GET_NETLIST_CANCELLED )
2747 {
2748 if( KIWAY_PLAYER* schFrame = Kiway().Player( FRAME_SCH, false ) )
2749 {
2750 if( schFrame->IsIconized() )
2751 schFrame->Iconize( false );
2752
2753 schFrame->Raise();
2754
2755 // Raising the window does not set the focus on Linux. This should work on
2756 // any platform.
2757 if( wxWindow::FindFocus() != schFrame )
2758 schFrame->SetFocus();
2759 }
2760
2761 return false;
2762 }
2763
2764 if( payload == aAnnotateMessage )
2765 {
2766 Raise();
2767 DisplayErrorMessage( this, aAnnotateMessage );
2768 return false;
2769 }
2770
2771 try
2772 {
2773 STRING_LINE_READER* lineReader = new STRING_LINE_READER( payload, _( "Eeschema netlist" ) );
2774 KICAD_NETLIST_READER netlistReader( lineReader, &aNetlist );
2775 netlistReader.LoadNetlist();
2776 }
2777 catch( const IO_ERROR& e )
2778 {
2779 Raise();
2780
2781 // Do not translate extra_info strings. These are for developers
2782 wxString extra_info = e.Problem() + wxT( " : " ) + e.What() + wxT( " at " ) + e.Where();
2783
2784 DisplayErrorMessage( this, _( "Received an error while reading netlist. Please report this issue to "
2785 "the KiCad team using the menu Help->Report Bug." ),
2786 extra_info );
2787 return false;
2788 }
2789
2790 return true;
2791}
2792
2793
2795{
2796 if( aFootprint == nullptr )
2797 return;
2798
2800
2801 /*
2802 * Make sure dlg is destroyed before GetCanvas->Refresh is called
2803 * later or the refresh will try to modify its properties since
2804 * they share a GL context.
2805 */
2806 {
2807 DIALOG_FOOTPRINT_PROPERTIES dlg( this, aFootprint );
2808
2809 dlg.ShowQuasiModal();
2810 retvalue = dlg.GetReturnValue();
2811 }
2812
2813 /*
2814 * retvalue =
2815 * FP_PROPS_UPDATE_FP to show Update Footprints dialog
2816 * FP_PROPS_CHANGE_FP to show Change Footprints dialog
2817 * FP_PROPS_OK for normal edit
2818 * FP_PROPS_CANCEL if aborted
2819 * FP_PROPS_EDIT_BOARD_FP to load board footprint into Footprint Editor
2820 * FP_PROPS_EDIT_LIBRARY_FP to load library footprint into Footprint Editor
2821 */
2822
2824 {
2825 // If something edited, push a refresh request
2826 GetCanvas()->Refresh();
2827 }
2829 {
2830 if( KIWAY_PLAYER* frame = Kiway().Player( FRAME_FOOTPRINT_EDITOR, true ) )
2831 {
2832 FOOTPRINT_EDIT_FRAME* fp_editor = static_cast<FOOTPRINT_EDIT_FRAME*>( frame );
2833
2834 fp_editor->LoadFootprintFromBoard( aFootprint );
2835 fp_editor->Show( true );
2836 fp_editor->Raise(); // Iconize( false );
2837 }
2838 }
2840 {
2841 if( KIWAY_PLAYER* frame = Kiway().Player( FRAME_FOOTPRINT_EDITOR, true ) )
2842 {
2843 FOOTPRINT_EDIT_FRAME* fp_editor = static_cast<FOOTPRINT_EDIT_FRAME*>( frame );
2844
2845 fp_editor->LoadFootprintFromLibrary( aFootprint->GetFPID() );
2846 fp_editor->Show( true );
2847 fp_editor->Raise(); // Iconize( false );
2848 }
2849 }
2851 {
2852 ShowExchangeFootprintsDialog( aFootprint, true, true );
2853 }
2855 {
2856 ShowExchangeFootprintsDialog( aFootprint, false, true );
2857 }
2858}
2859
2860
2862 bool aSelectedMode )
2863{
2864 DIALOG_EXCHANGE_FOOTPRINTS dialog( this, aFootprint, aUpdateMode, aSelectedMode );
2865
2866 return dialog.ShowQuasiModal();
2867}
2868
2869
2871{
2873 m_appearancePanel->CommonSettingsChanged( aFlags );
2874
2876
2878
2879 SetElementVisibility( LAYER_RATSNEST, GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
2880
2882
2883 // Netclass definitions could have changed, either by us or by Eeschema, so we need to
2884 // recompile the implicit rules
2886
2889
2890 Layout();
2891 SendSizeEvent();
2892}
2893
2894
2896{
2897 DRC_TOOL* drcTool = m_toolManager->GetTool<DRC_TOOL>();
2898 WX_INFOBAR* infobar = GetInfoBar();
2899
2900 try
2901 {
2902 drcTool->GetDRCEngine()->InitEngine( GetBoard()->GetDesignRulesPath() );
2903
2904 if( infobar->GetMessageType() == WX_INFOBAR::MESSAGE_TYPE::DRC_RULES_ERROR )
2905 infobar->Dismiss();
2906 }
2907 catch( PARSE_ERROR& )
2908 {
2909 infobar->RemoveAllButtons();
2910 infobar->AddLink( _( "Edit design rules" ),
2911 [&]( wxHyperlinkEvent& aEvent )
2912 {
2913 ShowBoardSetupDialog( _( "Custom Rules" ) );
2914 } );
2915 infobar->AddCloseButton();
2916 infobar->ShowMessage( _( "Could not compile custom design rules." ), wxICON_ERROR,
2917 WX_INFOBAR::MESSAGE_TYPE::DRC_RULES_ERROR );
2918 }
2919}
2920
2921
2926
2927
2929{
2930 // Register autosave history saver for the board.
2931 // Saver serializes the in-memory BOARD into HISTORY_FILE_DATA. Prettify and
2932 // file I/O happen on a background thread to avoid blocking the UI.
2933 if( GetBoard() )
2934 {
2936 GetBoard(),
2937 [this]( const wxString& aProjectPath, std::vector<HISTORY_FILE_DATA>& aFileData )
2938 {
2939 // See SCHEMATIC::SaveToHistory: the dirty check is only valid in ZIP
2940 // mode. In INCREMENTAL mode the manual-save flow clears the dirty
2941 // flag before the saver runs, so filtering would drop the snapshot.
2942 bool filterClean = !Pgm().GetCommonSettings()->AutosaveUsesLocalHistory();
2943
2944 if( filterClean && !IsContentModified() )
2945 return;
2946
2947 GetBoard()->SaveToHistory( aProjectPath, aFileData );
2948 },
2950 }
2951
2952 // A standalone editor has no project manager to record the project's own files
2954}
2955
2956
2958{
2960
2961 if( !mgr )
2962 return false;
2963
2964 TOOL_BASE* currentTool = mgr->GetCurrentTool();
2965
2966 // When a single item that can be point-edited is selected, the point editor
2967 // tool will be active instead of the selection tool. It blocks undo/redo
2968 // while the user is actually dragging points around, though, so we can use
2969 // this as an initial check.
2970 if( UndoRedoBlocked() )
2971 return true;
2972
2973 // A tool other than passive selection or point editing is actively modifying
2974 // the model (drawing, dragging, routing, etc.).
2975 if( currentTool != mgr->GetTool<PCB_SELECTION_TOOL>()
2976 && currentTool != mgr->GetTool<PCB_POINT_EDITOR>() )
2977 {
2978 return true;
2979 }
2980
2981 if( ZONE_FILLER_TOOL* zoneFillerTool = mgr->GetTool<ZONE_FILLER_TOOL>();
2982 zoneFillerTool && zoneFillerTool->IsBusy() )
2983 {
2984 return true;
2985 }
2986
2987 if( ROUTER_TOOL* routerTool = mgr->GetTool<ROUTER_TOOL>();
2988 routerTool && routerTool->RoutingInProgress() )
2989 {
2990 return true;
2991 }
2992
2993 return false;
2994}
2995
2996
2998{
3000 return false;
3001
3003}
3004
3005
3007{
3008 // Serializing a large board on the UI thread freezes the editor; never do it while the
3009 // user is mid-operation or the deferred input gets misinterpreted (e.g. a routed track
3010 // ending where the cursor lands once the editor unfreezes).
3012}
3013
3014
3020
3021
3022bool PCB_EDIT_FRAME::GetPluginActionButtonVisible( const wxString& aPluginPath, bool aPluginDefault )
3023{
3024 if( PCBNEW_SETTINGS* cfg = GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" ) )
3025 {
3026 for( const auto& [identifier, visible] : cfg->m_Plugins.actions )
3027 {
3028 if( identifier == aPluginPath )
3029 return visible;
3030 }
3031 }
3032
3033 // Plugin is not in settings, return default.
3034 return aPluginDefault;
3035}
3036
3037
3039{
3040 return GetBoard()->GetFileName();
3041}
3042
3043
3045{
3046 return m_auimgr.GetPane( wxS( "LayersManager" ) ).IsShown();
3047}
3048
3049
3051{
3052 return m_auimgr.GetPane( PropertiesPaneName() ).IsShown();
3053}
3054
3055
3057{
3058 return m_auimgr.GetPane( NetInspectorPanelName() ).IsShown();
3059}
3060
3061
3072
3073
3084
3085
3096
3097
3099{
3100 if( !m_footprintDiffDlg )
3101 {
3103 _( "Compare Footprint with Library" ) );
3104
3105 m_footprintDiffDlg->m_sdbSizerApply->SetLabel( _( "Update Footprint from Library..." ) );
3106 m_footprintDiffDlg->m_sdbSizerApply->PostSizeEventToParent();
3107 m_footprintDiffDlg->m_sdbSizerApply->Show();
3108 }
3109
3110 return m_footprintDiffDlg;
3111}
3112
3113
3115{
3117 {
3118 auto* dlg = new DIALOG_FOOTPRINT_FIELDS_TABLE( this );
3119
3120 if( dlg->WasAborted() )
3121 {
3122 dlg->Destroy();
3123 return nullptr;
3124 }
3125
3127 }
3128
3130}
3131
3132
3134{
3135 if( m_inspectDrcErrorDlg && aEvent.GetString() == INSPECT_DRC_ERROR_DIALOG_NAME )
3136 {
3137 m_inspectDrcErrorDlg->Destroy();
3138 m_inspectDrcErrorDlg = nullptr;
3139 }
3140 else if( m_inspectClearanceDlg && aEvent.GetString() == INSPECT_CLEARANCE_DIALOG_NAME )
3141 {
3142 m_inspectClearanceDlg->Destroy();
3143 m_inspectClearanceDlg = nullptr;
3144 }
3145 else if( m_inspectConstraintsDlg && aEvent.GetString() == INSPECT_CONSTRAINTS_DIALOG_NAME )
3146 {
3147 m_inspectConstraintsDlg->Destroy();
3148 m_inspectConstraintsDlg = nullptr;
3149 }
3150 else if( m_footprintDiffDlg && aEvent.GetString() == FOOTPRINT_DIFF_DIALOG_NAME )
3151 {
3152 if( aEvent.GetId() == wxID_APPLY )
3153 {
3154 KIID fpUUID = m_footprintDiffDlg->GetUserItemID();
3155
3156 CallAfter(
3157 [this, fpUUID]()
3158 {
3159 BOARD_ITEM* item = m_pcb->ResolveItem( fpUUID );
3160
3161 if( FOOTPRINT* footprint = dynamic_cast<FOOTPRINT*>( item ) )
3162 {
3163 m_toolManager->RunAction<EDA_ITEM*>( ACTIONS::selectItem, footprint );
3164
3165 DIALOG_EXCHANGE_FOOTPRINTS dialog( this, footprint, true, true );
3166 dialog.ShowQuasiModal();
3167 }
3168 } );
3169 }
3170
3171 m_footprintDiffDlg->Destroy();
3172 m_footprintDiffDlg = nullptr;
3173 }
3174}
3175
3176
3178{
3180 return true;
3181
3183
3184 if( !dlg->Close( false ) )
3185 return false;
3186
3187 if( m_footprintFieldsTableDialog == dlg )
3188 {
3189 dlg->Destroy();
3191 }
3192
3193 return true;
3194}
3195
3196
3198{
3200 {
3203 }
3204}
3205
3206
3208{
3209 wxLogTrace( traceApi, "PCB frame: EDA_EVT_PLUGIN_AVAILABILITY_CHANGED" );
3212 aEvt.Skip();
3213}
3214
3215
3217{
3218 PCB_LAYER_ID curLayer = GetActiveLayer();
3219 const PCB_DISPLAY_OPTIONS& displ_opts = GetDisplayOptions();
3220
3221 // Check if the specified layer matches the present layer
3222 if( layer == curLayer )
3223 return;
3224
3225 // Copper layers cannot be selected unconditionally; how many of those layers are currently
3226 // enabled needs to be checked.
3227 if( IsCopperLayer( layer ) )
3228 {
3229 if( layer > GetBoard()->GetCopperLayerStackMaxId() )
3230 return;
3231 }
3232
3233 // Is yet more checking required? E.g. when the layer to be selected is a non-copper layer,
3234 // or when switching between a copper layer and a non-copper layer, or vice-versa?
3235
3236 SetActiveLayer( layer );
3237
3239 GetCanvas()->Refresh();
3240}
3241
3242
3244{
3245 switch( aItem->Type() )
3246 {
3249 break;
3250
3251 case PCB_BARCODE_T:
3252 ShowBarcodePropertiesDialog( static_cast<PCB_BARCODE*>( aItem ) );
3253 break;
3254
3255 case PCB_FIELD_T:
3256 case PCB_TEXT_T:
3257 ShowTextPropertiesDialog( static_cast<PCB_TEXT*>( aItem ) );
3258 break;
3259
3260 case PCB_TEXTBOX_T:
3261 ShowTextBoxPropertiesDialog( static_cast<PCB_TEXTBOX*>( aItem ) );
3262 break;
3263
3264 case PCB_TABLE_T:
3265 {
3266 DIALOG_TABLE_PROPERTIES dlg( this, static_cast<PCB_TABLE*>( aItem ) );
3267
3268 //QuasiModal required for Scintilla auto-complete
3269 dlg.ShowQuasiModal();
3270 break;
3271 }
3272
3273 case PCB_DRILL_CHART_T:
3274 {
3275 // Not the generic table dialog, which would offer copper layers and direct editing of
3276 // cells that the next rebuild discards
3277 DIALOG_GENERATED_TABLE_PROPERTIES dlg( this, static_cast<PCB_DRILL_CHART*>( aItem ),
3278 []( wxWindow* aParent )
3279 {
3280 return new PANEL_DRILL_CHART_OPTIONS( aParent );
3281 } );
3282 dlg.ShowModal();
3283 break;
3284 }
3285
3287 {
3288 DIALOG_GENERATED_TABLE_PROPERTIES dlg( this, static_cast<PCB_GENERATED_TABLE*>( aItem ), {} );
3289 dlg.ShowModal();
3290 break;
3291 }
3292
3293 case PCB_PAD_T:
3294 ShowPadPropertiesDialog( static_cast<PAD&>( *aItem ) );
3295 break;
3296
3297 case PCB_FOOTPRINT_T:
3298 ShowFootprintPropertiesDialog( static_cast<FOOTPRINT*>( aItem ) );
3299 break;
3300
3301 case PCB_TARGET_T:
3302 ShowTargetOptionsDialog( static_cast<PCB_TARGET*>( aItem ) );
3303 break;
3304
3305 case PCB_DIM_ALIGNED_T:
3306 case PCB_DIM_CENTER_T:
3307 case PCB_DIM_RADIAL_T:
3309 case PCB_DIM_LEADER_T:
3310 {
3311 DIALOG_DIMENSION_PROPERTIES dlg( this, static_cast<PCB_DIMENSION_BASE*>( aItem ) );
3312
3313 dlg.ShowModal();
3314 break;
3315 }
3316
3317 case PCB_SHAPE_T:
3318 ShowGraphicItemPropertiesDialog( static_cast<PCB_SHAPE*>( aItem ) );
3319 break;
3320
3321 case PCB_GRID_ITEM_T:
3322 ShowGridItemPropertiesDialog( static_cast<PCB_GRID_ITEM*>( aItem ) );
3323 break;
3324
3325 case PCB_ZONE_T:
3326 Edit_Zone_Params( static_cast<ZONE*>( aItem ) );
3327 break;
3328
3329 case PCB_GROUP_T:
3331 static_cast<EDA_GROUP*>( static_cast<PCB_GROUP*>( aItem ) ) );
3332 break;
3333
3334 case PCB_GENERATOR_T:
3335 static_cast<PCB_GENERATOR*>( aItem )->ShowPropertiesDialog( this );
3336 break;
3337
3338 case PCB_MARKER_T:
3339 m_toolManager->GetTool<DRC_TOOL>()->CrossProbe( static_cast<PCB_MARKER*>( aItem ) );
3340 break;
3341
3342 case PCB_POINT_T:
3343 break;
3344
3345 default:
3346 break;
3347 }
3348}
3349
3350
3352{
3353 // For now we just delegate to the base implementation which commits any pending
3354 // local history snapshots. If PCB-specific preconditions are later needed (e.g.
3355 // flushing zone fills or router state) they can be added here before calling the
3356 // base class method.
3358}
const KICOMMON_API wxEventTypeTag< wxCommandEvent > EDA_EVT_PLUGIN_AVAILABILITY_CHANGED
Notifies other parts of KiCad when plugin availability changes.
@ KEEP_ENDPOINTS_OR_START_DIRECTION
Whe editing endpoints, the other end remains in place.
@ KEEP_CENTER_ENDS_ADJUST_ANGLE
When editing endpoints, only the angle is adjusted.
@ KEEP_CENTER_ADJUST_ANGLE_RADIUS
When editing endpoints, the angle and radius are adjusted.
constexpr EDA_IU_SCALE pcbIUScale
Definition base_units.h:128
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:100
@ NORMAL
Inactive layers are shown normally (no high-contrast mode)
constexpr BOX2I BOX2ISafe(const BOX2D &aInput)
Definition box2.h:924
BOX2< VECTOR2I > BOX2I
Definition box2.h:917
BOX2< VECTOR2D > BOX2D
Definition box2.h:918
static TOOL_ACTION toggleGrid
Definition actions.h:195
static TOOL_ACTION paste
Definition actions.h:77
static TOOL_ACTION unselectAll
Definition actions.h:80
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
Definition actions.h:224
static TOOL_ACTION togglePolarCoords
Definition actions.h:206
static TOOL_ACTION copy
Definition actions.h:75
static TOOL_ACTION pluginsReload
Definition actions.h:295
static TOOL_ACTION selectSetLasso
Definition actions.h:218
static TOOL_ACTION selectSetRect
Set lasso selection mode.
Definition actions.h:217
static TOOL_ACTION group
Definition actions.h:236
static TOOL_ACTION pasteSpecial
Definition actions.h:78
static TOOL_ACTION groupProperties
Definition actions.h:244
static TOOL_ACTION pointEditorArcKeepCenter
Definition actions.h:274
static TOOL_ACTION ungroup
Definition actions.h:237
static TOOL_ACTION toggleBoundingBoxes
Definition actions.h:154
static TOOL_ACTION pointEditorArcKeepRadius
Definition actions.h:276
static TOOL_ACTION showSearch
Definition actions.h:113
static TOOL_ACTION undo
Definition actions.h:72
static TOOL_ACTION duplicate
Definition actions.h:81
static TOOL_ACTION showGitCommitPane
Definition actions.h:264
static TOOL_ACTION highContrastMode
Definition actions.h:152
static TOOL_ACTION embeddedFiles
Definition actions.h:299
static TOOL_ACTION measureTool
Definition actions.h:249
static TOOL_ACTION doDelete
Definition actions.h:82
static TOOL_ACTION selectionTool
Definition actions.h:248
static TOOL_ACTION save
Definition actions.h:54
static TOOL_ACTION zoomFitScreen
Definition actions.h:139
static TOOL_ACTION redo
Definition actions.h:73
static TOOL_ACTION deleteTool
Definition actions.h:83
static TOOL_ACTION zoomTool
Definition actions.h:143
static TOOL_ACTION selectionClear
Clear the current selection.
Definition actions.h:221
static TOOL_ACTION showProperties
Definition actions.h:263
static TOOL_ACTION cut
Definition actions.h:74
static TOOL_ACTION gridSetOrigin
Definition actions.h:192
static TOOL_ACTION toggleGridOverrides
Definition actions.h:196
static TOOL_ACTION selectAll
Definition actions.h:79
static TOOL_ACTION pointEditorArcKeepEndpoint
Definition actions.h:275
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...
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
void OnColorThemeChanged()
Update the colors on all the widgets from the new chosen color theme.
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
The array tool.
Definition array_tool.h:44
Tool responsible for automagic placement of footprints.
Handles how to draw a screen (a board, a schematic ...)
Definition base_screen.h:37
int GetPageCount() const
Definition base_screen.h:68
bool IsContentModified() const
Definition base_screen.h:56
const wxString & GetPageNumber() const
void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
Handle actions specific to the board editor in PcbNew.
Tool for pcb inspection.
Abstract interface for BOARD_ITEMs capable of storing other items inside.
virtual void Delete(BOARD_ITEM *aItem)
Removes an item from the container and deletes it.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:99
Bridges BOARD's listener stream into the generic TEXT_VAR_TRACKER.
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:411
void BuildListOfNets()
Definition board.h:1189
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition board.cpp:1269
void RemoveAllListeners()
Remove all listeners.
Definition board.cpp:3877
void AddListener(BOARD_LISTENER *aListener)
Add a listener to the board to receive calls whenever something on the board has been modified.
Definition board.cpp:3858
const PAGE_INFO & GetPageSettings() const
Definition board.h:1029
std::vector< PCB_MARKER * > ReloadDRCExclusions(std::vector< PCB_MARKER * > &aStale)
Resolve exclusions again after the project file was reread.
Definition board.cpp:653
GAL_SET GetVisibleElements() const
Return a set of all the element categories that are visible.
Definition board.cpp:1263
void InitializeClearanceCache()
Initialize the clearance cache for all board items.
Definition board.cpp:1346
void SaveToHistory(const wxString &aProjectPath, std::vector< HISTORY_FILE_DATA > &aFileData)
Serialize board into HISTORY_FILE_DATA for non-blocking history commit.
Definition board.cpp:4395
bool BuildConnectivity(PROGRESS_REPORTER *aReporter=nullptr)
Build or rebuild the board connectivity database for the board, especially the list of connected item...
Definition board.cpp:369
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
Definition board.cpp:3268
std::weak_ptr< void > GetHistoryLifetimeToken() const
Liveness token handed to LOCAL_HISTORY::RegisterSaver so a shared autosave timer skips this board's s...
Definition board.h:1727
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
Definition board.cpp:379
const wxString & GetFileName() const
Definition board.h:454
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Change the visibility of an element category.
Definition board.cpp:1275
void ClearProject()
Definition board.cpp:420
bool IsEmpty() const
Definition board.cpp:826
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition board.cpp:2642
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition board.cpp:1202
void UpdateRatsnestExclusions()
Update the visibility flags on the current unconnected ratsnest lines.
Definition board.cpp:538
void SynchronizeProperties()
Copy the current project's text variables into the boards property cache.
Definition board.cpp:2996
void SynchronizeTuningProfileProperties()
Ensure that all time domain properties providers are in sync with current settings.
Definition board.cpp:3222
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition board.h:758
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition box2.h:556
void SetColor(int aLayer, const COLOR4D &aColor)
COLOR4D GetColor(int aLayer) const
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Add a new item to the model.
Definition commit.h:74
Handle actions that are shared between different applications.
bool AutosaveUsesLocalHistory() const
The backup format is the single switch that selects the autosave mechanism: the incremental format re...
Handles action that are shared between different applications.
Interactive authoring of geometric constraints (issue #2329).
enum FP_PROPS_RETVALUE GetReturnValue()
Dialog that offers to migrate obsolete WRL 3D model references on a loaded board to current STEP mode...
static int AutoMigrateByFilename(PCB_EDIT_FRAME *aFrame)
Silently rewrite unresolvable .wrl/.wrz references to STEP files whose filename stem matches in the s...
static int CountUnresolvedWrlReferences(PCB_EDIT_FRAME *aFrame)
Count of unique unresolvable .wrl/.wrz references on the board (deduplicated by filename).
int ShowModal() override
Tool responsible for displaying an overlay of incremental phase difference between differential pair ...
Tool responsible for drawing graphical elements like lines, arcs, circles, etc.
MODE GetDrawingMode() const
Return the current drawing mode of the DRAWING_TOOL or NONE if not currently in any drawing mode.
void InitEngine(const wxFileName &aRulePath)
Initialize the DRC engine.
std::shared_ptr< DRC_ENGINE > GetDRCEngine()
Definition drc_tool.h:79
DIALOG_DRC * GetDRCDialog()
Definition drc_tool.h:62
bool IsDRCRunning() const
Check to see if the DRC engine is running the tests.
Definition drc_tool.h:72
void SetSheetPath(const std::string &aSheetPath)
Set the sheet path displayed in the title block.
void SetSheetCount(int aSheetCount)
Change the sheet-count number displayed in the title block.
void SetVariantName(const std::string &aVariant)
Set the current variant name and description to be shown on the drawing sheet.
void SetVariantDesc(const std::string &aVariantDesc)
void SetPageNumber(const std::string &aPageNumber)
Change 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 AttachToTracker(TEXT_VAR_TRACKER *aTracker)
Register this proxy with aTracker as a dependent on every title-block source variable its current tem...
void SetFileName(const std::string &aFileName)
Set the file name displayed in the title block.
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard.
virtual bool doAutoSave()
This should be overridden by the derived class to handle the auto save feature.
void CommonSettingsChanged(int aFlags) override
Notification event that some of the common (suite-wide) settings have changed.
UNDO_REDO_CONTAINER m_undoList
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
static const wxString GitCommitPaneName()
Named here rather than beside the editors' other panes, because the project manager docks this one to...
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
bool isBlockableSessionEnd() const
Return true when the session is ending on a platform that shows a shutdown block reason.
virtual void ThemeChanged()
Process light/dark theme change.
WX_INFOBAR * m_infoBar
wxAuiManager m_auimgr
virtual bool CanAcceptApiCommands()
Check if this frame is ready to accept API commands.
virtual void RecreateToolbars()
UNDO_REDO_CONTAINER m_redoList
virtual void OnSize(wxSizeEvent &aEvent)
virtual bool canCloseWindow(wxCloseEvent &aCloseEvent)
virtual int GetUndoCommandCount() const
bool m_isClosing
Set by the close window event handler after frames are asked if they can close.
void ReCreateMenuBar()
Recreate the menu bar.
WX_INFOBAR * GetInfoBar()
static std::vector< const PLUGIN_ACTION * > GetOrderedPluginActions(PLUGIN_ACTION_SCOPE aScope, APP_SETTINGS_BASE *aCfg)
Return ordered list of plugin actions for display in the toolbar.
static const wxString AppearancePanelName()
virtual wxString GetFullScreenDesc() const
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.
void setArcModeConditions(const TOOL_ACTION &aDrawArc, const std::function< bool(const SELECTION &)> &aEnable)
Check each arc mode's tool action while the arc tool runs in that mode.
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Change the current rendering backend.
virtual void OnSelectZoom(wxCommandEvent &event)
Set the zoom factor when selected by the zoom list box in the main tool bar.
GAL_DISPLAY_OPTIONS_IMPL & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
virtual wxString GetScreenDesc() const
static const wxString PropertiesPaneName()
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.
NET_INSPECTOR_PANEL * m_netInspectorPanel
static const wxString NetInspectorPanelName()
SEARCH_PANE * m_searchPane
static const wxString DesignBlocksPaneName()
PROPERTIES_PANEL * m_propertiesPanel
virtual void UpdateProperties()
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
@ GAL_TYPE_MODERN
RHI implementation, Vulkan or Metal on macOS.
KIGFX::GAL * GetGAL() const
Return a pointer to the GAL instance used in the panel.
void SetFocus() override
void RequestRefresh()
Make sure a refresh gets done on the next idle event if it hasn't already.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
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:94
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 CurrentTool(const TOOL_ACTION &aTool)
Create a functor testing if the specified tool is the current active tool in the frame.
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 GridOverrides()
Create a functor testing if the grid overrides wires is enabled in a frame.
The interactive edit tool.
Definition edit_tool.h:54
ENUM_MAP & Map(T aValue, const wxString &aName)
Definition property.h:817
static ENUM_MAP< T > & Instance()
Definition property.h:811
ENUM_MAP & Undefined(T aValue)
Definition property.h:824
wxPGChoices & Choices()
Definition property.h:862
void LoadFootprintFromLibrary(LIB_ID aFPID)
bool HandleUnsavedChanges(bool aFromBoardOnly)
Prompt to save each dirty tab that meets the requirements.
bool LoadFootprintFromBoard(FOOTPRINT *aFootprint)
Load a footprint from the main board into the Footprint Editor.
Component library viewer main window.
const LIB_ID & GetFPID() const
Definition footprint.h:417
void ReadWindowSettings(WINDOW_SETTINGS &aCfg)
Read GAL config options from application-level config.
bool Contains(GAL_LAYER_ID aPos)
Definition layer_ids.h:468
Handle actions specific to filling copper zones.
Docked panel for committing: the branch to commit to, a summary and description, the commit options,...
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
virtual const wxString Problem() const
what was the problem?
virtual const wxString Where() const
where did the Problem() occur?
void RegisterHandler(API_HANDLER *aHandler)
Adds a new request handler to the server.
void DeregisterHandler(API_HANDLER *aHandler)
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:92
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
void SetGridColor(const COLOR4D &aGridColor)
Set the grid color.
virtual bool HasRetainedScene() const
Return true if the backend keeps cached groups in a persistent scene that it patches in place,...
Contains all the knowledge about how to draw graphical object onto any particular output device.
Definition painter.h:55
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition pcb_view.cpp:87
virtual void Remove(VIEW_ITEM *aItem) override
Remove a VIEW_ITEM from the view.
Definition pcb_view.cpp:70
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
An abstract base class for deriving all objects that can be added to a VIEW.
Definition view_item.h:82
bool IsBOARD_ITEM() const
Definition view_item.h:98
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:68
double GetScale() const
Definition view.h:298
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
Definition view.cpp:860
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:2630
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
Definition view.h:431
GAL * GetGAL() const
Return the GAL this view is using to draw graphical primitives.
Definition view.h:224
void SyncLayerVisibilityCache()
Definition view.cpp:2760
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition view.cpp:2474
void RepaintLayers(const BOX2I &aRect, const std::function< bool(int)> &aLayerFilter, const std::function< bool(VIEW_ITEM *, int)> &aItemFilter)
Re-cache only some layers of the items in aRect.
Definition view.cpp:2655
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition view.h:729
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:2491
An implementation of class VIEW_CONTROLS for wxWidgets library.
std::unique_ptr< PROF_COUNTER > m_MotionEventCounter
Definition kiid.h:46
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
virtual bool OpenProjectFiles(const std::vector< wxString > &aFileList, int aCtl=0)
Open a project or set of files given by aFileList.
void OnSockRequestServer(wxSocketEvent &evt)
void OnSockRequest(wxSocketEvent &evt)
bool IsModal() const override
Return true if the frame is shown in our modal mode and false if the frame is shown as an usual frame...
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:348
void OnKiCadExit()
Definition kiway.cpp:826
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition kiway.cpp:407
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr, bool aFromOtherThread=false)
Send aPayload to aDestination from aSource.
Definition kiway.cpp:511
LOCAL_HISTORY & LocalHistory()
Return the LOCAL_HISTORY associated with this KIWAY.
Definition kiway.h:460
virtual void CommonSettingsChanged(int aFlags=0)
Call CommonSettingsChanged() on all KIWAY_PLAYERs.
Definition kiway.cpp:605
PCB_LAYER_ID GetLayerA() const
PCB_LAYER_ID GetLayerB() const
void RegisterProjectSaver(PROJECT *aProject)
Register aProject's own files (project, rules and library tables) for history snapshots.
bool CommitDuplicateOfLastSave(const wxString &aProjectPath, const wxString &aFileType, const wxString &aMessage)
Create a new commit duplicating the tree pointed to by Last_Save_<fileType> and move the Last_Save_<f...
void NoteFileChange(const wxString &aFile)
Record that a file has been modified and should be included in the next snapshot.
void RegisterSaver(const void *aSaverObject, const std::function< void(const wxString &, std::vector< HISTORY_FILE_DATA > &)> &aSaver, const std::weak_ptr< void > &aLifetime={})
Register a saver callback invoked during autosave history commits.
void UnregisterSaver(const void *aSaverObject)
Unregister a previously registered saver callback.
void RemoveAutosaveFiles(const wxString &aProjectPath) const
Remove every autosave file under the project at aProjectPath regardless of which source it shadowed.
LSET is a set of PCB_LAYER_IDs.
Definition lset.h:37
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition lset.cpp:309
static const LSET & AllLayersMask()
Definition lset.cpp:637
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
Definition lset.cpp:184
@ MARKER_DRAWING_SHEET
Definition marker_base.h:51
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 pad.h:61
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:75
Dockable panel listing the board's geometric constraints (issue #2329).
DISPLAY_OPTIONS m_Display
EDA_ANGLE m_RotationAngle
ARC_EDIT_MODE m_ArcEditMode
AUI_PANELS m_AuiPanels
Gather all the actions that are shared by tools.
Definition pcb_actions.h:51
static TOOL_ACTION showConstraintsPanel
Toggle the docked constraints pane (board editor).
static TOOL_ACTION drawRuleArea
static TOOL_ACTION microwaveCreateGap
static TOOL_ACTION drawBezier
static TOOL_ACTION placeText
static TOOL_ACTION drawOrthogonalDimension
static TOOL_ACTION drawRectangle
static TOOL_ACTION padDisplayMode
static TOOL_ACTION placeReferenceImage
static TOOL_ACTION showRatsnest
static TOOL_ACTION showLayersManager
static TOOL_ACTION toggleNetHighlight
static TOOL_ACTION addConstraintVertical
static TOOL_ACTION saveSelectionAsDesignBlock
static TOOL_ACTION drawCircle
static TOOL_ACTION mirrorH
Mirroring of selected items.
static TOOL_ACTION routeDiffPair
Activation of the Push and Shove router (differential pair mode)
static TOOL_ACTION tuneDiffPair
static TOOL_ACTION saveToLinkedDesignBlock
static TOOL_ACTION layerChanged
static TOOL_ACTION grabUnconnected
Select and move nearest unconnected footprint from ratsnest of selection.
Definition pcb_actions.h:94
static TOOL_ACTION ddAppendBoard
Drag and drop.
static TOOL_ACTION drawEllipseArc
static TOOL_ACTION highlightNet
static TOOL_ACTION autoTrackWidth
static TOOL_ACTION drawTable
static TOOL_ACTION drawTextBox
static TOOL_ACTION addConstraintPerpendicular
static TOOL_ACTION routerHighlightMode
Actions to enable switching modes via hotkey assignments.
static TOOL_ACTION routerWalkaroundMode
static TOOL_ACTION routerShoveMode
static TOOL_ACTION drawZoneCutout
static TOOL_ACTION drawPolygon
static TOOL_ACTION hideNetInRatsnest
static TOOL_ACTION zoneDisplayFilled
static TOOL_ACTION showNetInRatsnest
static TOOL_ACTION drawRadialDimension
static TOOL_ACTION tuneSingleTrack
static TOOL_ACTION viaDisplayMode
static TOOL_ACTION drawLeader
static TOOL_ACTION addConstraintAngular
static TOOL_ACTION addConstraintArcAngle
static TOOL_ACTION angleSnapModeChanged
Notification event when angle mode changes.
static TOOL_ACTION saveBoardAsDesignBlock
static TOOL_ACTION drillOrigin
static TOOL_ACTION tuneSkew
static TOOL_ACTION addConstraintHorizontal
static TOOL_ACTION trackDisplayMode
static TOOL_ACTION showNetInspector
static TOOL_ACTION microwaveCreateStubArc
static TOOL_ACTION drawEllipse
static TOOL_ACTION placeSubGrid
Grid Item.
static TOOL_ACTION zoneDisplayTriangulated
static TOOL_ACTION placeDesignBlock
static TOOL_ACTION selectUnconnected
Select unconnected footprints from ratsnest of selection.
Definition pcb_actions.h:91
static TOOL_ACTION zoneDisplayFractured
static TOOL_ACTION addConstraintCollinear
static TOOL_ACTION drawVia
static TOOL_ACTION drawArc
static TOOL_ACTION zoneDuplicate
Duplicate zone onto another layer.
static TOOL_ACTION graphicsOutlines
Display footprint graphics as outlines.
static TOOL_ACTION addConstraintEqualRadius
static TOOL_ACTION addConstraintTangent
static TOOL_ACTION drawSimilarZone
static TOOL_ACTION showDesignBlockPanel
static TOOL_ACTION drawCenterDimension
static TOOL_ACTION mirrorInteractive
static TOOL_ACTION selectSameSheet
Select all components on the same sheet as the selected footprint.
static TOOL_ACTION microwaveCreateStub
static TOOL_ACTION selectNet
Select all connections belonging to a single net.
Definition pcb_actions.h:82
static TOOL_ACTION ddImportGraphics
static TOOL_ACTION microwaveCreateLine
static TOOL_ACTION addConstraintFixedLength
static TOOL_ACTION flipBoard
static TOOL_ACTION zoneDisplayOutline
static TOOL_ACTION ratsnestLineMode
static TOOL_ACTION toggleAutoConstraints
Toggle authoring constraints automatically while drawing.
static TOOL_ACTION textOutlines
Display texts as lines.
static TOOL_ACTION highlightNetSelection
static TOOL_ACTION microwaveCreateFunctionShape
static TOOL_ACTION placePoint
static TOOL_ACTION zoneMerge
static TOOL_ACTION addConstraintSymmetric
static TOOL_ACTION addConstraintFixedPosition
Ground a point, and the cluster holding it.
static TOOL_ACTION mirrorV
static TOOL_ACTION unlock
static TOOL_ACTION addConstraintPointOnLine
static TOOL_ACTION placeFootprint
static TOOL_ACTION routeSingleTrack
Activation of the Push and Shove router.
static TOOL_ACTION ddPlaceReferenceImage
static TOOL_ACTION createArray
Tool for creating an array of objects.
static TOOL_ACTION showDiffPhaseSkew
Display of phase skew between differential pair tracks.
static TOOL_ACTION deselectNet
Remove all connections belonging to a single net from the active selection.
Definition pcb_actions.h:85
static TOOL_ACTION addConstraintCoincident
static TOOL_ACTION drawLine
static TOOL_ACTION placeLinkedDesignBlock
static TOOL_ACTION localRatsnestTool
static TOOL_ACTION placeViaStack
static TOOL_ACTION rotateCw
Rotation of selected objects.
static TOOL_ACTION rotateCcw
static TOOL_ACTION addConstraintParallel
static TOOL_ACTION drawAlignedDimension
static TOOL_ACTION addConstraintFixedRadius
static TOOL_ACTION addConstraintEqualLength
static TOOL_ACTION drawZone
static TOOL_ACTION selectOnSchematic
Select symbols/pins on schematic corresponding to selected footprints/pads.
static TOOL_ACTION addConstraintMidpoint
static TOOL_ACTION lock
static TOOL_ACTION addConstraintConcentric
Common, abstract interface for edit frames.
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
int ShowTextBoxPropertiesDialog(PCB_TEXTBOX *aTextBox)
void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
bool UndoRedoBlocked() const
Check if the undo and redo operations are currently blocked.
PCB_LAYER_BOX_SELECTOR * m_SelLayerBox
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.
std::unique_ptr< LAYER_PAIR_SETTINGS > m_layerPairSettings
APPEARANCE_CONTROLS * GetAppearancePanel()
APPEARANCE_CONTROLS * m_appearancePanel
void ShowReferenceImagePropertiesDialog(BOARD_ITEM *aBitmap)
PANEL_SELECTION_FILTER * m_selectionFilterPanel
void ShowBarcodePropertiesDialog(PCB_BARCODE *aText)
void ShowGridItemPropertiesDialog(PCB_GRID_ITEM *aGridItem)
void ShowGraphicItemPropertiesDialog(PCB_SHAPE *aShape)
void ActivateGalCanvas() override
Use to start up the GAL drawing canvas.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
void ShowPadPropertiesDialog(PAD &aPad)
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 void SetActiveLayer(PCB_LAYER_ID aLayer)
void OnModify() override
Must be called after a change in order to set the "modify" flag and update other data structures and ...
virtual MAGNETIC_SETTINGS * GetMagneticItemsSettings()
EDA_ITEM * ResolveItem(const KIID &aId, bool aAllowNullptrReturn=false) const override
Fetch an item by KIID.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual PCB_LAYER_ID GetActiveLayer() const
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
Return the BOARD_DESIGN_SETTINGS for the open project.
EDA_3D_VIEWER_FRAME * GetOur3DViewerFrame()
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
Handle design block actions in the PCB editor.
bool m_FlipBoardView
true if the board is flipped to show the mirrored view
double m_ZoneOpacity
Opacity override for filled zone areas.
HIGH_CONTRAST_MODE m_ContrastModeDisplay
How inactive layers are displayed.
void ChangeHighContrastLayer(PCB_LAYER_ID aLayer)
Follow an active layer change when nothing else that colours items has changed.
void UpdateColors()
Update the color settings in the painter and GAL.
DS_PROXY_VIEW_ITEM * GetDrawingSheet() const
void SetDrawingSheet(DS_PROXY_VIEW_ITEM *aDrawingSheet)
Set or update drawing-sheet used by the draw panel.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the KIGFX::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
Take care of display settings for the given layer to be displayed in high contrast mode.
void RedrawRatsnest()
Force refresh of the ratsnest visual representation.
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 GraphicsFillDisplay()
Create a functor that tests if the frame fills graphics items.
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 TextFillDisplay()
Create a functor that tests if the frame fills text items.
The main frame for Pcbnew.
void HardRedraw() override
Rebuild the GAL and redraws the screen.
void OnDisplayOptionsChanged() override
std::size_t m_textVarListenerHandle
Reactive text-var invalidation listener state.
static bool GetPluginActionButtonVisible(const wxString &aPluginPath, bool aPluginDefault)
Return true if button visibility action plugin setting was set to true or it is unset and plugin defa...
void OnEditItemRequest(BOARD_ITEM *aItem) override
Install the corresponding dialog editor for the given item.
Definition edit.cpp:95
void SelectViaStack_Event(wxCommandEvent &event)
Handle the via stack preset selector on the auxiliary toolbar.
void SetLastPath(LAST_PATH_TYPE aType, const wxString &aLastPath)
Set the path of the last file successfully read.
bool interactiveOperationInProgress() const
Return true when an interactive tool operation (routing, dragging, point editing, zone filling,...
int m_crossProbeFlashPhase
Phase counter.
void FindNext(bool reverse=false)
Find the next item using our existing search parameters.
void LoadDrawingSheet()
Load the drawing sheet file.
void ResolveDRCExclusions(bool aCreateMarkers)
If aCreateMarkers then create DRC exclusion markers from the serialized data.
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 addExclusionMarkers(const std::vector< PCB_MARKER * > &aMarkers)
Add the markers a resolve created for exclusions and redraw every excluded marker.
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 SwitchLayer(PCB_LAYER_ID layer) override
Change the active layer in the editor.
Definition edit.cpp:68
wxTimer m_crossProbeFlashTimer
Timer to toggle selection visibility for flash.
void StartCrossProbeFlash(const std::vector< BOARD_ITEM * > &aItems)
void OnCrossProbeFlashTimer(wxTimerEvent &aEvent)
std::unique_ptr< API_HANDLER_PCB > m_apiHandler
bool CloseFootprintFieldsTableDialog()
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
DIALOG_FOOTPRINT_FIELDS_TABLE * m_footprintFieldsTableDialog
void UpdateVariantSelectionCtrl()
Update the variant selection dropdown with the current board's variant names.
bool DoAutoSave()
Perform auto save when the board has been modified and not saved within the auto save interval.
void SetElementVisibility(GAL_LAYER_ID aElement, bool aNewState)
Change the visibility of an element category.
DIALOG_BOOK_REPORTER * m_inspectDrcErrorDlg
void OnClearFileHistory(wxCommandEvent &aEvent)
std::unique_ptr< GRID_HELPER > MakeGridHelper() override
virtual ~PCB_EDIT_FRAME()
void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType) override
Switch currently used canvas (Cairo / OpenGL).
void RefreshProjectSettings()
Update what depends on the board's project settings after they changed in memory.
void CommonSettingsChanged(int aFlags) override
Called after the preferences dialog is run.
void ShowFindByPropertiesDialog()
Show the Find by Properties dialog.
BOARD_ITEM_CONTAINER * GetModel() const override
DIALOG_BOOK_REPORTER * GetInspectDrcErrorDialog()
void ShowTargetOptionsDialog(PCB_TARGET *aTarget)
void ShowBoardSetupDialog(const wxString &aInitialPage=wxEmptyString, wxWindow *aParent=nullptr)
void ApplyProjectFileSettings()
Apply what the project file sets and this frame caches, leaving the local settings alone.
std::unique_ptr< API_HANDLER_COMMON > m_apiHandlerCommon
DIALOG_FOOTPRINT_FIELDS_TABLE * GetFootprintFieldsTableDialog()
DIALOG_FIND * m_findDialog
DIALOG_BOOK_REPORTER * m_inspectConstraintsDlg
void SetPageSettings(const PAGE_INFO &aPageSettings) override
void onCloseFootprintFieldsTableDialog(wxCommandEvent &aEvent)
bool IsElementVisible(GAL_LAYER_ID aElement) const
Test whether a given element category is visible.
bool CanAcceptApiCommands() override
Check if this frame is ready to accept API commands.
void UpdateUserInterface()
Update the layer manager and other widgets from the board setup (layer and items visibility,...
void SetGridColor(const COLOR4D &aColor) override
void ProjectChanged() override
Notification event that the project has changed.
static const wxString ConstraintsPaneName()
wxString GetLastPath(LAST_PATH_TYPE aType)
Get the last path for a particular type.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
void doCloseWindow() override
WX_INFOBAR * m_loadNoticeInfoBar
Secondary infobar that stacks above the main one; reserved for load-time notices (currently the WRL -...
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 SaveProjectLocalSettings() override
Save changes to the project local settings.
static std::vector< const PLUGIN_ACTION * > GetOrderedPluginActions()
Return ordered list of plugins in sequence in which they should appear on toolbar or in settings.
void detachTextVarTracker()
Drop every cached reference into the current BOARD's text-var tracker.
void onPluginAvailabilityChanged(wxCommandEvent &aEvt)
void PrepareLayerIndicator(bool aForceRebuild=false)
void ShowFindDialog()
Show the Find dialog.
int ShowExchangeFootprintsDialog(FOOTPRINT *aFootprint, bool aUpdateMode, bool aSelectedMode)
int TestStandalone()
Test if standalone mode.
void ShowFootprintPropertiesDialog(FOOTPRINT *aFootprint)
void UpdateProperties() override
bool canRunAutoSave() const override
Return true when it is safe to run an autosave snapshot right now.
PANEL_CONSTRAINTS * m_constraintsPanel
Dockable geometric-constraint list (#2329).
bool IsContentModified() const override
Get if the current board has been modified but not saved.
bool Clear_Pcb(bool doAskAboutUnsavedChanges, bool aFinal=false)
Delete all and reinitialize the current board.
Definition initpcb.cpp:38
std::unique_ptr< API_HANDLER_LIBRARIES > m_apiLibrariesHandler
bool m_crossProbeFlashing
Currently flashing guard.
TOOL_ACTION * m_exportNetlistAction
The export board netlist tool action object.
BOX2D m_lastNetnamesViewport
Keep track of viewport so that track net labels can be adjusted when it changes.
void OnBoardLoaded()
Update the state of the GUI after a new board is loaded or created.
void ReCreateAuxiliaryToolbar() override
void Edit_Zone_Params(ZONE *zone_container)
Edit params (layer, clearance, ...) for a zone outline.
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 OnBoardItemsChanged(BOARD &aBoard, std::vector< BOARD_ITEM * > &aItems) override
Keep the selection and view in step with generated tables rebuilt outside a commit.
DIALOG_BOOK_REPORTER * GetFootprintDiffDialog()
EDA_ANGLE GetRotationAngle() const override
Return the angle used for rotate operations.
void ToggleConstraintsPanel()
Show/hide the dockable geometric-constraint list pane, refreshing it when shown (#2329).
COLOR4D GetGridColor() override
std::vector< KIID > m_crossProbeFlashItems
Items to flash (by UUID)
void UpdateTitle()
Set the main window title bar text.
void RefreshDrillSymbols(int aUpdateFlags) override
Tell every hole to redraw its drill symbol.
DIALOG_BOOK_REPORTER * m_footprintDiffDlg
void ActivateGalCanvas() override
Use to start up the GAL drawing canvas.
void recompileDesignRules()
Recompile the design rules, reporting a parse error in the infobar.
void onVariantSelected(wxCommandEvent &aEvent)
Event handler for variant selection changes in the toolbar.
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
void OnQuit(wxCommandEvent &event)
void NotifyFindByPropertiesDialog()
Notify the Find by Properties dialog that the selection has changed.
void onCloseModelessBookReporterDialogs(wxCommandEvent &aEvent)
PCB_DESIGN_BLOCK_PANE * m_designBlocksPane
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
void ReloadProjectFileSettings()
Bring the frame in line with a project file that was reread from disk.
DIALOG_BOARD_SETUP * m_boardSetupDlg
DIALOG_BOOK_REPORTER * GetInspectClearanceDialog()
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.
static const wxString SearchPaneName()
DIALOG_FIND_BY_PROPERTIES * m_findByPropertiesDialog
DIALOG_BOOK_REPORTER * m_inspectClearanceDlg
void OnFileHistory(wxCommandEvent &event)
DIALOG_BOOK_REPORTER * GetInspectConstraintsDialog()
class TEXT_VAR_TRACKER * m_textVarListenerTracker
A set of BOARD_ITEMs (i.e., without duplicates).
Definition pcb_group.h:51
PCB net inspection panel.
Generic tool for picking an item.
Tool that displays edit points allowing to modify items by dragging the points.
PCB_LAYER_ID m_Route_Layer_TOP
Definition pcb_screen.h:39
PCB_LAYER_ID m_Route_Layer_BOTTOM
Definition pcb_screen.h:40
static bool HasUnlockedItems(const SELECTION &aSelection)
Test if any selected items are unlocked.
static bool HasLockedItems(const SELECTION &aSelection)
Test if any selected items are locked.
The selection tool: currently supports:
int ClearSelection(const TOOL_EVENT &aEvent)
Clear current selection event handler.
PCB_SELECTION & GetSelection()
void RebuildSelection()
Rebuild the selection from the EDA_ITEMs' selection flags.
void FindItem(BOARD_ITEM *aItem)
Take necessary actions to mark an item as found.
Tool useful for viewing footprints.
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition pgm_base.cpp:600
KICAD_API_SERVER & GetApiServer()
Definition pgm_base.h:142
virtual const wxString & GetExecutablePath() const
Definition pgm_base.cpp:926
The interactive edit tool.
void Show(std::ostream &aStream=std::cerr)
Definition profile.h:291
void Reset()
Definition profile.h:281
A progress reporter interface for use in multi-threaded environments.
The backing store for a PROJECT, in JSON format.
std::vector< LAYER_PAIR_INFO > m_LayerPairInfos
List of stored 3D viewports (view matrixes)
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.
static FOOTPRINT_LIBRARY_ADAPTER * FootprintLibAdapter(PROJECT *aProject)
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition project.cpp:277
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
Definition project.h:207
void IncrementNetclassesTicker()
Definition project.h:115
virtual PROJECT_FILE & GetProjectFile() const
Definition project.h:201
void IncrementTextVarsTicker()
Definition project.h:112
Action handler for the Properties panel.
PNS::PNS_MODE GetRouterMode()
bool RoutingInProgress()
Returns whether routing is currently active.
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 bool NotEmpty(const SELECTION &aSelection)
Test if there are any items selected.
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.
int AddItemToSel(const TOOL_EVENT &aEvent)
EDA_ITEM * Front() const
Definition selection.h:176
int Size() const
Returns the number of selected parts.
Definition selection.h:120
bool Empty() const
Checks if there is anything selected.
Definition selection.h:114
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition richio.h:225
Coordinates the dependency index with change notifications.
ListenerHandle AddInvalidateListener(InvalidateCallback aCallback)
Register a listener that fires for every invalidation.
static constexpr ListenerHandle INVALID_LISTENER
TOOL_MANAGER * m_toolManager
TOOL_DISPATCHER * m_toolDispatcher
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
ACTIONS * m_actions
Represent a single user action.
Base abstract interface for all kinds of tools.
Definition tool_base.h:62
@ MODEL_RELOAD
Model changes (the sheet for a schematic)
Definition tool_base.h:76
Generic, UI-independent tool event.
Definition tool_event.h:167
void SetHasPosition(bool aHasPosition)
Definition tool_event.h:257
Master controller class:
T * GetTool()
Return the tool of given type or nullptr if there is no such tool registered.
bool RunAction(const std::string &aActionName, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
TOOL_BASE * GetCurrentTool() const
Return the tool that is on the top of the active tools stack (was invoked the most recently).
Tool that owns actions specific to via-stitch generators.
A modified version of the wxInfoBar class that allows us to:
Definition wx_infobar.h:77
Handle actions specific to filling copper zones.
PROGRESS_REPORTER * GetProgressReporter()
A type-safe container of any type.
Definition ki_any.h:92
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:146
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:217
int GetLastUnsavedChangesResponse()
Return the result code from the last call to HandleUnsavedChanges(): wxID_YES, wxID_NO or wxID_CANCEL...
Definition confirm.cpp:159
This file is part of the common library.
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
Definition cvpcb.cpp:178
#define CHECK(x)
#define ENABLE(x)
#define DIALOG_DRC_WINDOW_NAME
Definition dialog_drc.h:40
#define _(s)
Declaration of the eda_3d_viewer class.
static constexpr EDA_ANGLE ANGLE_90
Definition eda_angle.h:474
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define PCB_EDIT_FRAME_NAME
static const std::vector< KICAD_T > footprintTypes
static const std::vector< KICAD_T > groupTypes
static const std::vector< KICAD_T > trackTypes
EVT_MENU_RANGE(ID_GERBVIEW_DRILL_FILE1, ID_GERBVIEW_DRILL_FILEMAX, GERBVIEW_FRAME::OnDrlFileHistory) EVT_MENU_RANGE(ID_GERBVIEW_ZIP_FILE1
#define CURRENT_EDIT_TOOL(action)
Collection of reusable/testable functions for footprint manipulation and validation.
@ FRAME_PCB_EDITOR
Definition frame_type.h:38
@ FRAME_FOOTPRINT_VIEWER
Definition frame_type.h:41
@ FRAME_SCH
Definition frame_type.h:30
@ FRAME_FOOTPRINT_CHOOSER
Definition frame_type.h:40
@ FRAME_FOOTPRINT_EDITOR
Definition frame_type.h:39
int RefreshGeneratedTables(BOARD &aBoard)
Bring every generated table on the board up to date and return how many were rebuilt.
a few functions useful in geometry calculations.
static const std::string LegacySchematicFileExtension
static const std::string JpegFileExtension
static const std::string PngFileExtension
static const std::string LegacyPcbFileExtension
static const std::string KiCadSchematicFileExtension
static const std::string SVGFileExtension
static const std::string KiCadPcbFileExtension
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
const wxChar *const traceCrossProbeFlash
Flag to enable debug output for cross-probe flash operations.
const wxChar *const traceApi
Flag to enable debug output related to the IPC API and its plugin system.
Definition api_utils.cpp:33
@ ID_ON_GRID_SELECT
Definition id.h:113
@ ID_FILE_LIST_CLEAR
Definition id.h:58
@ ID_EDA_SOCKET_EVENT
Definition id.h:133
@ ID_EDA_SOCKET_EVENT_SERV
Definition id.h:132
@ ID_ON_ZOOM_SELECT
Definition id.h:112
@ ID_FILEMAX
Definition id.h:56
@ ID_FILE1
Definition id.h:55
PROJECT & Prj()
Definition kicad.cpp:730
EVT_MENU(ID_COMPARE_PROJECT_BRANCHES, KICAD_MANAGER_FRAME::OnCompareProjectBranches) KICAD_MANAGER_FRAME
int GetNetnameLayer(int aLayer)
Return a netname layer corresponding to the given layer.
Definition layer_ids.h:921
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
Definition layer_ids.h:744
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
Definition layer_ids.h:224
@ LAYER_GRID
Definition layer_ids.h:250
@ LAYER_ZONES
Control for copper zone opacity/visibility (color ignored).
Definition layer_ids.h:291
@ LAYER_RATSNEST
Definition layer_ids.h:249
#define CLEARANCE_LAYER_FOR(boardLayer)
Definition layer_ids.h:399
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
@ F_Paste
Definition layer_ids.h:100
@ B_Mask
Definition layer_ids.h:94
@ B_Cu
Definition layer_ids.h:61
@ F_Mask
Definition layer_ids.h:93
@ B_Paste
Definition layer_ids.h:101
@ UNDEFINED_LAYER
Definition layer_ids.h:57
@ F_Cu
Definition layer_ids.h:60
@ MAIL_SCH_GET_NETLIST
Definition mail_type.h:45
#define MAIL_SCH_GET_NETLIST_CANCELLED
Reply payload for MAIL_SCH_GET_NETLIST when the user deliberately aborts netlist generation (for exam...
Definition mail_type.h:79
@ REPAINT
Item needs to be redrawn.
Definition view_item.h:54
@ GEOMETRY
Position or shape has changed.
Definition view_item.h:51
@ ALL
All except INITIAL_ADD.
Definition view_item.h:55
@ TARGET_NONCACHED
Auxiliary rendering target (noncached)
Definition definitions.h:34
void SetShutdownBlockReason(wxWindow *aWindow, const wxString &aReason)
Sets the block reason why the window/application is preventing OS shutdown.
Definition unix/app.cpp:108
@ RM_MarkObstacles
Ignore collisions, mark obstacles.
@ RM_Walkaround
Only walk around.
@ RM_Shove
Only shove.
#define _HKI(x)
Definition page_info.cpp:40
BARCODE class definition.
wxDEFINE_EVENT(EDA_EVT_PCB_LAST_SCH_SHEET_CHANGED, wxCommandEvent)
#define FOOTPRINT_DIFF_DIALOG_NAME
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
#define INSPECT_CLEARANCE_DIALOG_NAME
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
#define INSPECT_DRC_ERROR_DIALOG_NAME
#define INSPECT_CONSTRAINTS_DIALOG_NAME
@ ID_POPUP_PCB_SELECT_WIDTH_START_RANGE
Definition pcbnew_id.h:21
@ ID_POPUP_PCB_SELECT_WIDTH1
Definition pcbnew_id.h:25
@ ID_POPUP_PCB_SELECT_VIASIZE8
Definition pcbnew_id.h:48
@ ID_AUX_TOOLBAR_PCB_VARIANT_SELECT
Definition pcbnew_id.h:20
@ ID_AUX_TOOLBAR_PCB_VIA_SIZE
Definition pcbnew_id.h:17
@ ID_POPUP_PCB_SELECT_WIDTH_END_RANGE
Definition pcbnew_id.h:78
@ ID_POPUP_PCB_SELECT_VIASIZE1
Definition pcbnew_id.h:41
@ ID_AUX_TOOLBAR_PCB_VIA_STACK
Definition pcbnew_id.h:19
@ ID_AUX_TOOLBAR_PCB_TRACK_WIDTH
Definition pcbnew_id.h:18
@ SHOW_WITH_VIA_ALWAYS
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE
LAST_PATH_TYPE
For storing PcbNew MRU paths of various types.
@ RPT_SEVERITY_EXCLUSION
#define SKIP_SET_DIRTY
Definition sch_commit.h:40
#define SKIP_UNDO
Definition sch_commit.h:38
#define CURRENT_TOOL(action)
std::function< bool(const SELECTION &)> SELECTION_CONDITION
Functor type that checks a specific condition for selected items.
T * GetToolbarSettings(const wxString &aFilename)
T * GetAppSettings(const char *aFilename)
KIWAY Kiway(KFCTL_STANDALONE)
wxString UnescapeString(const wxString &aSource)
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
A min-max version of BOX2 for fast intersection checking.
Definition box2_minmax.h:33
bool Intersects(const BOX2I_MINMAX &aOther) const
Definition box2_minmax.h:69
A filename or source description, a problem input line, a line number, a byte offset,...
TRACK_CLEARANCE_MODE m_TrackClearance
Identifies a single resolvable source that a text item's ${...} reference depends on.
else
IbisParser parser & reporter
@ 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
Model has changed (partial update).
Definition tool_event.h:117
@ TC_COMMAND
Definition tool_event.h:53
#define TEXTVARS_CHANGED
wxLogTrace helper definitions.
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition typeinfo.h:80
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition typeinfo.h:98
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition typeinfo.h:95
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
Definition typeinfo.h:83
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition typeinfo.h:89
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition typeinfo.h:96
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition typeinfo.h:103
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
Definition typeinfo.h:85
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition typeinfo.h:100
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition typeinfo.h:84
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
Definition typeinfo.h:81
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
Definition typeinfo.h:82
@ PCB_MARKER_T
class PCB_MARKER, a marker used to show something
Definition typeinfo.h:91
@ PCB_BARCODE_T
class PCB_BARCODE, a barcode (graphic item)
Definition typeinfo.h:93
@ PCB_TARGET_T
class PCB_TARGET, a target (graphic item)
Definition typeinfo.h:99
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition typeinfo.h:78
@ PCB_GRID_ITEM_T
a subgrid placed on a board
Definition typeinfo.h:238
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition typeinfo.h:94
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition typeinfo.h:79
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition typeinfo.h:90
@ PCB_TABLE_T
class PCB_TABLE, table of PCB_TABLECELLs
Definition typeinfo.h:86
@ PCB_STACKUP_TABLE_T
class PCB_STACKUP_TABLE, a live stackup table derived from PCB_TABLE
Definition typeinfo.h:242
@ PCB_POINT_T
class PCB_POINT, a 0-dimensional point
Definition typeinfo.h:105
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition typeinfo.h:88
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
Definition typeinfo.h:97
@ PCB_DRILL_CHART_T
class PCB_DRILL_CHART, a live drill chart derived from PCB_TABLE
Definition typeinfo.h:239
constexpr bool IsGeneratedTableType(const KICAD_T aType)
A PCB_TABLE subclass whose cells are generated from the board rather than typed by the user.
Definition typeinfo.h:328
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.