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 along
20 * with this program. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23#include <advanced_config.h>
25#include <kiface_base.h>
26#include <kiway.h>
29#include <pgm_base.h>
30#include <pcb_edit_frame.h>
34#include <bitmaps.h>
35#include <confirm.h>
36#include <lset.h>
37#include <trace_helpers.h>
38#include <algorithm>
39#include <type_traits>
40#include <unordered_map>
41#include <unordered_set>
42#include <vector>
43#include <pcbnew_id.h>
44#include <pcbnew_settings.h>
47#include <dialog_find.h>
50#include <dialog_board_setup.h>
54#include <pcb_target.h>
55#include <pcb_point.h>
56#include <layer_pairs.h>
59#include <wx/filename.h>
60#include <functional>
61#include <pcb_barcode.h>
62#include <pcb_painter.h>
65#include <python_scripting.h>
68#include <local_history.h>
69#include <tool/tool_manager.h>
71#include <tool/action_toolbar.h>
72#include <tool/common_control.h>
73#include <tool/common_tools.h>
74#include <tool/embed_tool.h>
76#include <tool/selection.h>
77#include <tool/zoom_tool.h>
78#include <tools/array_tool.h>
83#include <tools/edit_tool.h>
87#include <tools/drc_tool.h>
90#include <tools/convert_tool.h>
91#include <tools/drawing_tool.h>
92#include <tools/pcb_control.h>
100#include <tools/pad_tool.h>
102#include <properties/property.h>
107#include <router/router_tool.h>
111#include <wx/socket.h>
112#include <wx/wupdlock.h>
113#include <dialog_drc.h> // for DIALOG_DRC_WINDOW_NAME definition
118#include <widgets/wx_infobar.h>
122#include <widgets/wx_aui_utils.h>
123#include <kiplatform/app.h>
124#include <kiplatform/ui.h>
125#include <core/profile.h>
126#include <math/box2_minmax.h>
130#include <toolbars_pcb_editor.h>
131#include <wx/log.h>
133
134#ifdef KICAD_IPC_API
135#include <api/api_server.h>
136#include <api/api_handler_pcb.h>
138#include <api/api_utils.h>
139#endif
140
141#include <action_plugin.h>
143#include <richio.h>
144
145#include "../scripting/python_scripting.h"
146
147#include <wx/filedlg.h>
148
149using namespace std::placeholders;
150
151
152#define INSPECT_DRC_ERROR_DIALOG_NAME wxT( "InspectDrcErrorDialog" )
153#define INSPECT_CLEARANCE_DIALOG_NAME wxT( "InspectClearanceDialog" )
154#define INSPECT_CONSTRAINTS_DIALOG_NAME wxT( "InspectConstraintsDialog" )
155#define FOOTPRINT_DIFF_DIALOG_NAME wxT( "FootprintDiffDialog" )
156
157
158BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
161
164
165 EVT_SIZE( PCB_EDIT_FRAME::OnSize )
166
167 // Menu Files:
170
171 EVT_MENU( wxID_EXIT, PCB_EDIT_FRAME::OnQuit )
172 EVT_MENU( wxID_CLOSE, PCB_EDIT_FRAME::OnQuit )
173
174 // Horizontal toolbar
178
179 // Tracks and vias sizes general options
181 PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event )
182
183 // User interface update event handlers.
184 EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, PCB_EDIT_FRAME::OnUpdateSelectTrackWidth )
185 EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_VIA_SIZE, PCB_EDIT_FRAME::OnUpdateSelectViaSize )
187 PCB_EDIT_FRAME::OnUpdateSelectTrackWidth )
189 PCB_EDIT_FRAME::OnUpdateSelectViaSize )
190 // Drop files event
191 EVT_DROP_FILES( PCB_EDIT_FRAME::OnDropFiles )
192END_EVENT_TABLE()
193
194
195PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
196 PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB_EDITOR, _( "PCB Editor" ),
197 wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE,
199 m_exportNetlistAction( nullptr ),
200 m_findDialog( nullptr ),
201 m_inspectDrcErrorDlg( nullptr ),
202 m_inspectClearanceDlg( nullptr ),
203 m_inspectConstraintsDlg( nullptr ),
204 m_footprintDiffDlg( nullptr ),
205 m_boardSetupDlg( nullptr ),
206 m_designBlocksPane( nullptr ),
207 m_importProperties( nullptr ),
208 m_eventCounterTimer( nullptr )
209{
210 m_maximizeByDefault = true;
211 m_showBorderAndTitleBlock = true; // true to display sheet references
212 m_SelTrackWidthBox = nullptr;
213 m_SelViaSizeBox = nullptr;
214 m_CurrentVariantCtrl = nullptr;
215 m_ShowLayerManagerTools = true;
216 m_supportsAutoSave = true;
217 m_ProbingSchToPcb = false;
218 m_ShowSearch = false;
219 m_ShowNetInspector = false;
220 // Ensure timer has an owner before binding so it generates events.
221 m_crossProbeFlashTimer.SetOwner( this );
222 Bind( wxEVT_TIMER, &PCB_EDIT_FRAME::OnCrossProbeFlashTimer, this, m_crossProbeFlashTimer.GetId() );
223
224 // We don't know what state board was in when it was last saved, so we have to
225 // assume dirty
226 m_ZoneFillsDirty = true;
227
228 m_aboutTitle = _HKI( "KiCad PCB Editor" );
229
230 // Must be created before the menus are created.
231 if( ADVANCED_CFG::GetCfg().m_ShowPcbnewExportNetlist )
232 {
233 m_exportNetlistAction = new TOOL_ACTION( "pcbnew.EditorControl.exportNetlist",
234 AS_GLOBAL, 0, "", _( "Netlist..." ),
235 _( "Export netlist used to update schematics" ) );
236 }
237
238 // Create GAL canvas
239 auto canvas = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize,
240 GetGalDisplayOptions(),
242
243 SetCanvas( canvas );
244 SetBoard( new BOARD() );
245
246 wxIcon icon;
247 wxIconBundle icon_bundle;
248
249 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew, 48 ) );
250 icon_bundle.AddIcon( icon );
251 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew, 128 ) );
252 icon_bundle.AddIcon( icon );
253 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew, 256 ) );
254 icon_bundle.AddIcon( icon );
255 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew_32 ) );
256 icon_bundle.AddIcon( icon );
257 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew_16 ) );
258 icon_bundle.AddIcon( icon );
259
260 SetIcons( icon_bundle );
261
262 // LoadSettings() *after* creating m_LayersManager, because LoadSettings()
263 // initialize parameters in m_LayersManager
264 LoadSettings( config() );
265
266 SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU( pcbIUScale.IU_PER_MILS ) ) );
267
268 // PCB drawings start in the upper left corner.
269 GetScreen()->m_Center = false;
270
271 setupTools();
272 setupUIConditions();
273
274 m_toolbarSettings = GetToolbarSettings<PCB_EDIT_TOOLBAR_SETTINGS>( "pcbnew-toolbars" );
275 configureToolbars();
276 RecreateToolbars();
277 PrepareLayerIndicator( true );
278
279 ReCreateMenuBar();
280
281#ifdef KICAD_IPC_API
283 &PCB_EDIT_FRAME::onPluginAvailabilityChanged, this );
284#endif
285
286 // Fetch a COPY of the config as a lot of these initializations are going to overwrite our
287 // data.
288 PCBNEW_SETTINGS::AUI_PANELS aui_cfg = GetPcbNewSettings()->m_AuiPanels;
289
290 m_propertiesPanel = new PCB_PROPERTIES_PANEL( this, this );
291 m_propertiesPanel->SetSplitterProportion( aui_cfg.properties_splitter );
292
293 m_selectionFilterPanel = new PANEL_SELECTION_FILTER( this );
294
295 m_appearancePanel = new APPEARANCE_CONTROLS( this, GetCanvas() );
296 m_searchPane = new PCB_SEARCH_PANE( this );
297 m_netInspectorPanel = new PCB_NET_INSPECTOR_PANEL( this, this );
298 m_designBlocksPane = new PCB_DESIGN_BLOCK_PANE( this, nullptr, m_designBlockHistoryList );
299
300 m_auimgr.SetManagedWindow( this );
301
302 CreateInfoBar();
303
304 unsigned int auiFlags = wxAUI_MGR_DEFAULT;
305#if !defined( _WIN32 )
306 // Windows cannot redraw the UI fast enough during a live resize and may lead to all kinds
307 // of graphical glitches.
308 auiFlags |= wxAUI_MGR_LIVE_RESIZE;
309#endif
310 m_auimgr.SetFlags( auiFlags );
311
312 // Rows; layers 4 - 6
313 m_auimgr.AddPane( m_tbTopMain, EDA_PANE().HToolbar().Name( wxS( "TopMainToolbar" ) )
314 .Top().Layer( 6 ) );
315 m_auimgr.AddPane( m_tbTopAux, EDA_PANE().HToolbar().Name( wxS( "TopAuxToolbar" ) )
316 .Top().Layer( 5 ) );
317 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( wxS( "MsgPanel" ) )
318 .Bottom().Layer( 6 ) );
319
320 // Columns; layers 1 - 3
321 m_auimgr.AddPane( m_tbLeft, EDA_PANE().VToolbar().Name( wxS( "LeftToolbar" ) )
322 .Left().Layer( 3 ) );
323
324 m_auimgr.AddPane( m_tbRight, EDA_PANE().VToolbar().Name( wxS( "RightToolbar" ) )
325 .Right().Layer( 3 ) );
326
327 m_auimgr.AddPane( m_appearancePanel, EDA_PANE().Name( wxS( "LayersManager" ) )
328 .Right().Layer( 4 )
329 .Caption( _( "Appearance" ) ).PaneBorder( false )
330 // Don't use -1 for don't-change-height on a growable panel; it has side-effects.
331 .MinSize( m_appearancePanel->GetMinSize().x, FromDIP( 60 ) )
332#ifdef __WXMAC__
333 // Best size for this pane is calculated larger than necessary on wxMac
334 .BestSize( m_appearancePanel->GetMinSize().x, -1 )
335#else
336 .BestSize( m_appearancePanel->GetBestSize().x, -1 )
337#endif
338 .FloatingSize( m_appearancePanel->GetBestSize() )
339 .CloseButton( false ) );
340
341 m_auimgr.AddPane( m_selectionFilterPanel, EDA_PANE().Name( wxS( "SelectionFilter" ) )
342 .Right().Layer( 4 ).Position( 2 )
343 .Caption( _( "Selection Filter" ) ).PaneBorder( false )
344 // Fixed-size pane; -1 for MinSize height is required
345 .MinSize( m_selectionFilterPanel->GetMinSize().x, -1 )
346 .BestSize( m_selectionFilterPanel->GetBestSize().x, -1 )
347 .FloatingSize( m_selectionFilterPanel->GetBestSize() )
348 .CloseButton( false ) );
349
350 m_auimgr.AddPane( m_designBlocksPane, EDA_PANE().Name( DesignBlocksPaneName() )
351 .Right().Layer( 5 )
352 .Caption( _( "Design Blocks" ) )
353 .CaptionVisible( true )
354 .PaneBorder( true )
355 .TopDockable( false )
356 .BottomDockable( false )
357 .CloseButton( true )
358 .MinSize( FromDIP( wxSize( 240, 60 ) ) )
359 .BestSize( FromDIP( wxSize( 300, 200 ) ) )
360 .FloatingSize( FromDIP( wxSize( 800, 600 ) ) )
361 .FloatingPosition( FromDIP( wxPoint( 50, 200 ) ) )
362 .Show( true ) );
363
364 m_auimgr.AddPane( m_propertiesPanel, EDA_PANE().Name( PropertiesPaneName() )
365 .Left().Layer( 5 )
366 .Caption( _( "Properties" ) ).PaneBorder( false )
367 .MinSize( FromDIP( wxSize( 240, 60 ) ) )
368 .BestSize( FromDIP( wxSize( 300, 200 ) ) )
369 .FloatingSize( wxSize( 300, 200 ) )
370 .CloseButton( true ) );
371
372 // Center
373 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( wxS( "DrawFrame" ) )
374 .Center() );
375
376 m_auimgr.AddPane( m_netInspectorPanel, EDA_PANE().Name( NetInspectorPanelName() )
377 .Bottom()
378 .Caption( _( "Net Inspector" ) )
379 .PaneBorder( false )
380 .MinSize( FromDIP( wxSize( 240, 60 ) ) )
381 .BestSize( FromDIP( wxSize( 300, 200 ) ) )
382 .FloatingSize( wxSize( 300, 200 ) )
383 .CloseButton( true ) );
384
385 m_auimgr.AddPane( m_searchPane, EDA_PANE().Name( SearchPaneName() )
386 .Bottom()
387 .Caption( _( "Search" ) ).PaneBorder( false )
388 .MinSize( FromDIP( wxSize ( 180, 60 ) ) )
389 .BestSize( FromDIP( wxSize ( 180, 100 ) ) )
390 .FloatingSize( FromDIP( wxSize( 480, 200 ) ) )
391 .DestroyOnClose( false )
392 .CloseButton( true ) );
393
394 RestoreAuiLayout();
395
396 m_auimgr.GetPane( "LayersManager" ).Show( m_ShowLayerManagerTools );
397 m_auimgr.GetPane( "SelectionFilter" ).Show( m_ShowLayerManagerTools );
398 m_auimgr.GetPane( PropertiesPaneName() ).Show( GetPcbNewSettings()->m_AuiPanels.show_properties );
399 m_auimgr.GetPane( NetInspectorPanelName() ).Show( m_ShowNetInspector );
400 m_auimgr.GetPane( SearchPaneName() ).Show( m_ShowSearch );
401 m_auimgr.GetPane( DesignBlocksPaneName() ).Show( GetPcbNewSettings()->m_AuiPanels.design_blocks_show );
402
403 // The selection filter doesn't need to grow in the vertical direction when docked
404 m_auimgr.GetPane( "SelectionFilter" ).dock_proportion = 0;
405 FinishAUIInitialization();
406
407 if( aui_cfg.right_panel_width > 0 )
408 {
409 wxAuiPaneInfo& layersManager = m_auimgr.GetPane( wxS( "LayersManager" ) );
410 SetAuiPaneSize( m_auimgr, layersManager, aui_cfg.right_panel_width, -1 );
411
412 wxAuiPaneInfo& designBlocksPane = m_auimgr.GetPane( DesignBlocksPaneName() );
413 SetAuiPaneSize( m_auimgr, designBlocksPane, aui_cfg.design_blocks_panel_docked_width, -1 );
414 }
415
416 if( aui_cfg.properties_panel_width > 0 && m_propertiesPanel )
417 {
418 wxAuiPaneInfo& propertiesPanel = m_auimgr.GetPane( PropertiesPaneName() );
419 SetAuiPaneSize( m_auimgr, propertiesPanel, aui_cfg.properties_panel_width, -1 );
420 }
421
422 if( aui_cfg.search_panel_height > 0
423 && ( aui_cfg.search_panel_dock_direction == wxAUI_DOCK_TOP
424 || aui_cfg.search_panel_dock_direction == wxAUI_DOCK_BOTTOM ) )
425 {
426 wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
427 searchPane.Direction( aui_cfg.search_panel_dock_direction );
428 SetAuiPaneSize( m_auimgr, searchPane, -1, aui_cfg.search_panel_height );
429 }
430 else if( aui_cfg.search_panel_width > 0
431 && ( aui_cfg.search_panel_dock_direction == wxAUI_DOCK_LEFT
432 || aui_cfg.search_panel_dock_direction == wxAUI_DOCK_RIGHT ) )
433 {
434 wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
435 searchPane.Direction( aui_cfg.search_panel_dock_direction );
436 SetAuiPaneSize( m_auimgr, searchPane, aui_cfg.search_panel_width, -1 );
437 }
438
439 m_appearancePanel->SetTabIndex( aui_cfg.appearance_panel_tab );
440
441 {
442 m_layerPairSettings = std::make_unique<LAYER_PAIR_SETTINGS>();
443
444 m_layerPairSettings->Bind( PCB_LAYER_PAIR_PRESETS_CHANGED, [&]( wxCommandEvent& aEvt )
445 {
446 // Update the project file list
447 std::span<const LAYER_PAIR_INFO> newPairInfos = m_layerPairSettings->GetLayerPairs();
449 std::vector<LAYER_PAIR_INFO>{ newPairInfos.begin(), newPairInfos.end() };
450 });
451
452 m_layerPairSettings->Bind( PCB_CURRENT_LAYER_PAIR_CHANGED, [&]( wxCommandEvent& aEvt )
453 {
454 const LAYER_PAIR& layerPair = m_layerPairSettings->GetCurrentLayerPair();
455 PCB_SCREEN& screen = *GetScreen();
456
457 screen.m_Route_Layer_TOP = layerPair.GetLayerA();
458 screen.m_Route_Layer_BOTTOM = layerPair.GetLayerB();
459
460 // Update the toolbar icon
461 PrepareLayerIndicator();
462 });
463 }
464
465 GetToolManager()->PostAction( ACTIONS::zoomFitScreen );
466
467 // This is used temporarily to fix a client size issue on GTK that causes zoom to fit
468 // to calculate the wrong zoom size. See PCB_EDIT_FRAME::onSize().
469 Bind( wxEVT_SIZE, &PCB_EDIT_FRAME::onSize, this );
470
471 Bind( wxEVT_IDLE,
472 [this]( wxIdleEvent& aEvent )
473 {
474 BOX2D viewport = GetCanvas()->GetView()->GetViewport();
475
476 if( viewport != m_lastNetnamesViewport )
477 {
478 redrawNetnames();
479 m_lastNetnamesViewport = viewport;
480 }
481
482 // Do not forget to pass the Idle event to other clients:
483 aEvent.Skip();
484 } );
485
486 resolveCanvasType();
487
488 setupUnits( config() );
489
490 // Ensure the DRC engine is initialized so that constraints can be resolved even before a
491 // board is loaded or saved
492 try
493 {
494 m_toolManager->GetTool<DRC_TOOL>()->GetDRCEngine()->InitEngine( wxFileName() );
495 }
496 catch( PARSE_ERROR& )
497 {
498 }
499
500 // Ensure the Python interpreter is up to date with its environment variables
501 PythonSyncEnvironmentVariables();
502 PythonSyncProjectName();
503
504 // Sync action plugins in case they changed since the last time the frame opened
505 GetToolManager()->RunAction( ACTIONS::pluginsReload );
506
507#ifdef KICAD_IPC_API
508 m_apiHandler = std::make_unique<API_HANDLER_PCB>( this );
509 Pgm().GetApiServer().RegisterHandler( m_apiHandler.get() );
510
511 if( Kiface().IsSingle() )
512 {
513 m_apiHandlerCommon = std::make_unique<API_HANDLER_COMMON>();
514 Pgm().GetApiServer().RegisterHandler( m_apiHandlerCommon.get() );
515 }
516#endif
517
518 GetCanvas()->SwitchBackend( m_canvasType );
519 ActivateGalCanvas();
520
521 // Default shutdown reason until a file is loaded
522 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "New PCB file is unsaved" ) );
523
524 // disable Export STEP item if kicad2step does not exist
525 wxString strK2S = Pgm().GetExecutablePath();
526
527#ifdef __WXMAC__
528 if( strK2S.Find( wxT( "pcbnew.app" ) ) != wxNOT_FOUND )
529 {
530 // On macOS, we have standalone applications inside the main bundle, so we handle that here:
531 strK2S += wxT( "../../" );
532 }
533
534 strK2S += wxT( "Contents/MacOS/" );
535#endif
536
537 wxFileName appK2S( strK2S, wxT( "kicad2step" ) );
538
539#ifdef _WIN32
540 appK2S.SetExt( wxT( "exe" ) );
541#endif
542
543 // Ensure the window is on top
544 Raise();
545
546// if( !appK2S.FileExists() )
547 // GetMenuBar()->FindItem( ID_GEN_EXPORT_FILE_STEP )->Enable( false );
548
549 // AUI doesn't refresh properly on wxMac after changes in eb7dc6dd, so force it to
550#ifdef __WXMAC__
551 if( Kiface().IsSingle() )
552 {
553 CallAfter( [this]()
554 {
555 m_appearancePanel->OnBoardChanged();
556 } );
557 }
558#endif
559
560 // Register a call to update the toolbar sizes. It can't be done immediately because
561 // it seems to require some sizes calculated that aren't yet (at least on GTK).
562 CallAfter( [this]()
563 {
564 // Ensure the controls on the toolbars all are correctly sized
565 UpdateToolbarControlSizes();
566
567 // Update the angle snap mode toolbar button to reflect the current preference
568 GetToolManager()->RunAction( PCB_ACTIONS::angleSnapModeChanged );
569 } );
570
571 if( ADVANCED_CFG::GetCfg().m_ShowEventCounters )
572 {
573 m_eventCounterTimer = new wxTimer( this );
574
575 Bind( wxEVT_TIMER,
576 [&]( wxTimerEvent& aEvent )
577 {
578 GetCanvas()->m_PaintEventCounter->Show();
579 GetCanvas()->m_PaintEventCounter->Reset();
580
582 static_cast<KIGFX::WX_VIEW_CONTROLS*>( GetCanvas()->GetViewControls() );
585
586 },
587 m_eventCounterTimer->GetId() );
588
589 m_eventCounterTimer->Start( 1000 );
590 }
591
594 m_acceptedExts.emplace( wxS( "dxf" ), &PCB_ACTIONS::ddImportGraphics );
596 DragAcceptFiles( true );
597
598 Bind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &PCB_EDIT_FRAME::onCloseModelessBookReporterDialogs, this );
599}
600
601
602void PCB_EDIT_FRAME::StartCrossProbeFlash( const std::vector<BOARD_ITEM*>& aItems )
603{
604 if( !GetPcbNewSettings()->m_CrossProbing.flash_selection )
605 {
606 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash(PCB): aborted (setting disabled) items=%zu",
607 aItems.size() );
608 return;
609 }
610
611 if( aItems.empty() )
612 {
613 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash(PCB): aborted (no items)" );
614 return;
615 }
616
617 // Don't start flashing if any of the items are being moved. The flash timer toggles
618 // selection hide/show which corrupts the VIEW overlay state during an active move.
619 for( const BOARD_ITEM* item : aItems )
620 {
621 if( item->IsMoving() )
622 {
623 wxLogTrace( traceCrossProbeFlash,
624 "StartCrossProbeFlash(PCB): aborted (items are moving)" );
625 return;
626 }
627 }
628
630 {
631 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash(PCB): restarting existing flash (phase=%d)",
634 }
635
636 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash(PCB): starting with %zu items", aItems.size() );
637
638 // Store uuids
640 for( BOARD_ITEM* it : aItems )
641 m_crossProbeFlashItems.push_back( it->m_Uuid );
642
645
646 if( !m_crossProbeFlashTimer.GetOwner() )
647 m_crossProbeFlashTimer.SetOwner( this );
648
649 bool started = m_crossProbeFlashTimer.Start( 500, wxTIMER_CONTINUOUS ); // 0.5s intervals -> 3s total for 6 phases
650 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash(PCB): timer start=%d id=%d",
651 (int) started, m_crossProbeFlashTimer.GetId() );
652}
653
654
655void PCB_EDIT_FRAME::OnCrossProbeFlashTimer( wxTimerEvent& aEvent )
656{
657 wxLogTrace( traceCrossProbeFlash, "Timer(PCB) fired: phase=%d running=%d items=%zu",
659
661 {
662 wxLogTrace( traceCrossProbeFlash, "Timer(PCB) fired but not flashing (ignored)" );
663 return;
664 }
665
667
668 if( !selTool )
669 return;
670
671 // Don't manipulate the selection while items are being moved. The move tool holds a
672 // live reference to the selection and toggling hide/show on selected items corrupts
673 // the VIEW overlay state, causing crashes.
674 for( const KIID& id : m_crossProbeFlashItems )
675 {
676 if( EDA_ITEM* item = GetBoard()->ResolveItem( id, true ) )
677 {
678 if( item->IsMoving() )
679 {
680 wxLogTrace( traceCrossProbeFlash,
681 "Timer(PCB) phase=%d: items are moving, stopping flash",
683 m_crossProbeFlashing = false;
685 return;
686 }
687 }
688 }
689
690 // Prevent recursion / IPC during flashing
691 bool prevGuard = m_ProbingSchToPcb;
692 m_ProbingSchToPcb = true;
693
694 if( m_crossProbeFlashPhase % 2 == 0 )
695 {
696 // Hide selection
697 selTool->ClearSelection( true );
698 wxLogTrace( traceCrossProbeFlash, "Phase %d (PCB): cleared selection", m_crossProbeFlashPhase );
699 }
700 else
701 {
702 // Restore selection
703 for( const KIID& id : m_crossProbeFlashItems )
704 {
705 if( EDA_ITEM* item = GetBoard()->ResolveItem( id, true ) )
706 selTool->AddItemToSel( item, true );
707 }
708
709 wxLogTrace( traceCrossProbeFlash, "Phase %d (PCB): restored %zu items",
711 }
712
713 // Force a redraw even if the canvas / frame does not currently have focus (mouse elsewhere)
714 if( GetCanvas() )
715 {
717 wxLogTrace( traceCrossProbeFlash, "Phase %d (PCB): forced canvas refresh",
719 }
720
721 m_ProbingSchToPcb = prevGuard;
722
724
725 if( m_crossProbeFlashPhase > 6 )
726 {
727 // Ensure final state (selected)
728 for( const KIID& id : m_crossProbeFlashItems )
729 {
730 if( EDA_ITEM* item = GetBoard()->ResolveItem( id, true ) )
731 selTool->AddItemToSel( item, true );
732 }
733
734 m_crossProbeFlashing = false;
736
737 wxLogTrace( traceCrossProbeFlash, "Flashing complete (PCB). Final selection size=%zu",
738 m_crossProbeFlashItems.size() );
739 }
740}
741
742
744{
746
747 if( ADVANCED_CFG::GetCfg().m_ShowEventCounters )
748 {
749 // Stop the timer during destruction early to avoid potential event race conditions (that
750 // do happen on windows)
751 m_eventCounterTimer->Stop();
752 delete m_eventCounterTimer;
753 }
754
755 // Close modeless dialogs
756 wxWindow* drcDlg = wxWindow::FindWindowByName( DIALOG_DRC_WINDOW_NAME );
757
758 if( drcDlg )
759 drcDlg->Close( true );
760
761 wxWindow* ruleEditorDlg = wxWindow::FindWindowByName( DIALOG_DRC_RULE_EDITOR_WINDOW_NAME );
762
763 if( ruleEditorDlg )
764 ruleEditorDlg->Close( true );
765
766 // Shutdown all running tools
767 if( m_toolManager )
768 m_toolManager->ShutdownAllTools();
769
770 if( GetBoard() )
772
773 // We passed ownership of these to wxAuiManager.
774 // delete m_selectionFilterPanel;
775 // delete m_appearancePanel;
776 // delete m_propertiesPanel;
777 // delete m_netInspectorPanel;
778
780}
781
782
783void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard, bool aBuildConnectivity,
784 PROGRESS_REPORTER* aReporter )
785{
786 if( m_pcb )
787 m_pcb->ClearProject();
788
789 PCB_BASE_EDIT_FRAME::SetBoard( aBoard, aReporter );
790
791 aBoard->SetProject( &Prj() );
792
793 if( aBuildConnectivity )
794 aBoard->BuildConnectivity();
795
796 // reload the drawing-sheet
797 SetPageSettings( aBoard->GetPageSettings() );
798
800}
801
802
807
808
809std::unique_ptr<GRID_HELPER> PCB_EDIT_FRAME::MakeGridHelper()
810{
811 return std::make_unique<PCB_GRID_HELPER>( m_toolManager, GetMagneticItemsSettings() );
812}
813
814
816{
817 /*
818 * While new items being scrolled into the view will get painted, they will only get
819 * annotated with netname instances currently within the view. Subsequent panning will not
820 * draw newly-visible netname instances because the item has already been drawn.
821 *
822 * This routine, fired on idle if the viewport has changed, looks for visible items that
823 * might have multiple netname instances and redraws them. (It does not need to handle pads
824 * and vias because they only ever have a single netname instance drawn on them.)
825 */
826 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( Kiface().KifaceSettings() );
827
828 if( !cfg || cfg->m_Display.m_NetNames < 2 )
829 return;
830
831 KIGFX::VIEW* view = GetCanvas()->GetView();
832 BOX2D viewport = view->GetViewport();
833
834 // Inflate to catch most of the track width
835 BOX2I_MINMAX clipbox( BOX2ISafe( viewport.Inflate( pcbIUScale.mmToIU( 2.0 ) ) ) );
836
837 for( PCB_TRACK* track : GetBoard()->Tracks() )
838 {
839 // Don't need to update vias
840 if( track->Type() == PCB_VIA_T )
841 continue;
842
843 // Don't update invisible tracks
844 if( !clipbox.Intersects( BOX2I_MINMAX( track->GetStart(), track->GetEnd() ) ) )
845 continue;
846
847 if( track->ViewGetLOD( GetNetnameLayer( track->GetLayer() ), view ) < view->GetScale() )
848 view->Update( track, KIGFX::REPAINT );
849 }
850}
851
852
853void PCB_EDIT_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
854{
855 PCB_BASE_FRAME::SetPageSettings( aPageSettings );
856
857 // Prepare drawing-sheet template
859 &m_pcb->GetPageSettings(),
860 m_pcb->GetProject(),
861 &m_pcb->GetTitleBlock(),
862 &m_pcb->GetProperties() );
863
864 drawingSheet->SetSheetName( std::string( GetScreenDesc().mb_str() ) );
865 drawingSheet->SetSheetPath( std::string( GetFullScreenDesc().mb_str() ) );
866
867 // A board is not like a schematic having a main page and sub sheets.
868 // So for the drawing sheet, use only the first page option to display items
869 drawingSheet->SetIsFirstPage( true );
870
871 BASE_SCREEN* screen = GetScreen();
872
873 if( screen != nullptr )
874 {
875 drawingSheet->SetPageNumber(TO_UTF8( screen->GetPageNumber() ) );
876 drawingSheet->SetSheetCount( screen->GetPageCount() );
877 }
878
879 if( BOARD* board = GetBoard() )
880 drawingSheet->SetFileName( TO_UTF8( board->GetFileName() ) );
881
882 // PCB_DRAW_PANEL_GAL takes ownership of the drawing-sheet
883 GetCanvas()->SetDrawingSheet( drawingSheet );
884}
885
886
888{
889 return GetScreen() && GetScreen()->IsContentModified();
890}
891
892
894{
895 return m_toolManager->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
896}
897
898
900{
901 // Create the manager and dispatcher & route draw panel events to the dispatcher
903 m_toolManager->SetEnvironment( m_pcb, GetCanvas()->GetView(),
904 GetCanvas()->GetViewControls(), config(), this );
905 m_actions = new PCB_ACTIONS();
907
908 // Register tools
909 m_toolManager->RegisterTool( new COMMON_CONTROL );
910 m_toolManager->RegisterTool( new COMMON_TOOLS );
911 m_toolManager->RegisterTool( new PCB_SELECTION_TOOL );
912 m_toolManager->RegisterTool( new ZOOM_TOOL );
913 m_toolManager->RegisterTool( new PCB_PICKER_TOOL );
914 m_toolManager->RegisterTool( new ROUTER_TOOL );
915 m_toolManager->RegisterTool( new EDIT_TOOL );
916 m_toolManager->RegisterTool( new PCB_EDIT_TABLE_TOOL );
917 m_toolManager->RegisterTool( new GLOBAL_EDIT_TOOL );
918 m_toolManager->RegisterTool( new PAD_TOOL );
919 m_toolManager->RegisterTool( new DRAWING_TOOL );
920 m_toolManager->RegisterTool( new PCB_POINT_EDITOR );
921 m_toolManager->RegisterTool( new PCB_CONTROL );
922 m_toolManager->RegisterTool( new PCB_DESIGN_BLOCK_CONTROL );
923 m_toolManager->RegisterTool( new BOARD_EDITOR_CONTROL );
924 m_toolManager->RegisterTool( new BOARD_INSPECTION_TOOL );
925 m_toolManager->RegisterTool( new BOARD_REANNOTATE_TOOL );
926 m_toolManager->RegisterTool( new ALIGN_DISTRIBUTE_TOOL );
927 m_toolManager->RegisterTool( new MICROWAVE_TOOL );
928 m_toolManager->RegisterTool( new POSITION_RELATIVE_TOOL );
929 m_toolManager->RegisterTool( new ARRAY_TOOL );
930 m_toolManager->RegisterTool( new ZONE_FILLER_TOOL );
931 m_toolManager->RegisterTool( new AUTOPLACE_TOOL );
932 m_toolManager->RegisterTool( new DRC_TOOL );
933 m_toolManager->RegisterTool( new PCB_VIEWER_TOOLS );
934 m_toolManager->RegisterTool( new CONVERT_TOOL );
935 m_toolManager->RegisterTool( new PCB_GROUP_TOOL );
936 m_toolManager->RegisterTool( new GENERATOR_TOOL );
937 m_toolManager->RegisterTool( new SCRIPTING_TOOL );
938 m_toolManager->RegisterTool( new PROPERTIES_TOOL );
939 m_toolManager->RegisterTool( new MULTICHANNEL_TOOL );
940 m_toolManager->RegisterTool( new EMBED_TOOL );
941 m_toolManager->RegisterTool( new DRC_RULE_EDITOR_TOOL );
942 m_toolManager->InitTools();
943
944 for( TOOL_BASE* tool : m_toolManager->Tools() )
945 {
946 if( PCB_TOOL_BASE* pcbTool = dynamic_cast<PCB_TOOL_BASE*>( tool ) )
947 pcbTool->SetIsBoardEditor( true );
948 }
949
950 // Run the selection tool, it is supposed to be always active
951 m_toolManager->InvokeTool( "common.InteractiveSelection" );
952}
953
954
956{
958
959 ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
960 PCB_EDITOR_CONDITIONS cond( this );
961
962 auto undoCond =
963 [ this ] (const SELECTION& aSel )
964 {
965 DRAWING_TOOL* drawingTool = m_toolManager->GetTool<DRAWING_TOOL>();
966
967 if( drawingTool && drawingTool->GetDrawingMode() != DRAWING_TOOL::MODE::NONE )
968 return true;
969
970 ROUTER_TOOL* routerTool = m_toolManager->GetTool<ROUTER_TOOL>();
971
972 if( routerTool && routerTool->RoutingInProgress() )
973 return true;
974
975 return GetUndoCommandCount() > 0;
976 };
977
978 auto groupWithDesignBlockLink =
979 [] ( const SELECTION& aSel )
980 {
981 if( aSel.Size() != 1 )
982 return false;
983
984 if( aSel[0]->Type() != PCB_GROUP_T )
985 return false;
986
987 PCB_GROUP* group = static_cast<PCB_GROUP*>( aSel.GetItem( 0 ) );
988
989 return group->HasDesignBlockLink();
990 };
991
992 wxASSERT( mgr );
993
994#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
995#define CHECK( x ) ACTION_CONDITIONS().Check( x )
996// clang-format off
997
999 mgr->SetConditions( ACTIONS::undo, ENABLE( undoCond ) );
1001
1005
1006 mgr->SetConditions( ACTIONS::cut, ENABLE( cond.HasItems() ) );
1007 mgr->SetConditions( ACTIONS::copy, ENABLE( cond.HasItems() ) );
1014
1015 static const std::vector<KICAD_T> groupTypes = { PCB_GROUP_T, PCB_GENERATOR_T };
1016
1021
1022 mgr->SetConditions( PCB_ACTIONS::placeLinkedDesignBlock, ENABLE( groupWithDesignBlockLink) );
1023 mgr->SetConditions( PCB_ACTIONS::saveToLinkedDesignBlock, ENABLE( groupWithDesignBlockLink) );
1024
1030
1031 if( SCRIPTING::IsWxAvailable() )
1033
1034 auto enableZoneControlCondition =
1035 [this] ( const SELECTION& )
1036 {
1039 };
1040
1042 ENABLE( enableZoneControlCondition )
1045 ENABLE( enableZoneControlCondition )
1048 ENABLE( enableZoneControlCondition )
1051 ENABLE( enableZoneControlCondition )
1053
1055
1056 auto hasElements =
1057 [ this ] ( const SELECTION& aSel )
1058 {
1059 return GetBoard() &&
1060 ( !GetBoard()->IsEmpty() || !SELECTION_CONDITIONS::Idle( aSel ) );
1061 };
1062
1063 auto boardFlippedCond =
1064 [this]( const SELECTION& )
1065 {
1066 return GetCanvas() && GetCanvas()->GetView()->IsMirroredX();
1067 };
1068
1069 auto layerManagerCond =
1070 [this] ( const SELECTION& )
1071 {
1072 return LayerManagerShown();
1073 };
1074
1075 auto propertiesCond =
1076 [this] ( const SELECTION& )
1077 {
1078 return PropertiesShown();
1079 };
1080
1081 auto netInspectorCond =
1082 [this] ( const SELECTION& )
1083 {
1084 return NetInspectorShown();
1085 };
1086
1087 auto searchPaneCond =
1088 [this] ( const SELECTION& )
1089 {
1090 return m_auimgr.GetPane( SearchPaneName() ).IsShown();
1091 };
1092
1093 auto designBlockCond =
1094 [ this ] (const SELECTION& aSel )
1095 {
1096 return m_auimgr.GetPane( DesignBlocksPaneName() ).IsShown();
1097 };
1098
1099 auto highContrastCond =
1100 [this] ( const SELECTION& )
1101 {
1103 };
1104
1105 auto globalRatsnestCond =
1106 [this] (const SELECTION& )
1107 {
1109 };
1110
1111 auto curvedRatsnestCond =
1112 [this] (const SELECTION& )
1113 {
1115 };
1116
1117 auto netHighlightCond =
1118 [this]( const SELECTION& )
1119 {
1121 return !settings->GetHighlightNetCodes().empty();
1122 };
1123
1124 auto enableNetHighlightCond =
1125 [this]( const SELECTION& )
1126 {
1128 return tool && tool->IsNetHighlightSet();
1129 };
1130
1131 mgr->SetConditions( ACTIONS::highContrastMode, CHECK( highContrastCond ) );
1132 mgr->SetConditions( PCB_ACTIONS::flipBoard, CHECK( boardFlippedCond ) );
1133 mgr->SetConditions( PCB_ACTIONS::showLayersManager, CHECK( layerManagerCond ) );
1134 mgr->SetConditions( PCB_ACTIONS::showRatsnest, CHECK( globalRatsnestCond ) );
1135 mgr->SetConditions( PCB_ACTIONS::ratsnestLineMode, CHECK( curvedRatsnestCond ) );
1136 mgr->SetConditions( PCB_ACTIONS::toggleNetHighlight, CHECK( netHighlightCond )
1137 .Enable( enableNetHighlightCond ) );
1138 mgr->SetConditions( ACTIONS::showProperties, CHECK( propertiesCond ) );
1139 mgr->SetConditions( PCB_ACTIONS::showNetInspector, CHECK( netInspectorCond ) );
1140 mgr->SetConditions( PCB_ACTIONS::showSearch, CHECK( searchPaneCond ) );
1141 mgr->SetConditions( PCB_ACTIONS::showDesignBlockPanel, CHECK( designBlockCond ) );
1142
1145
1146 const auto isArcKeepCenterMode =
1147 [this]( const SELECTION& )
1148 {
1150 };
1151
1152 const auto isArcKeepEndpointMode =
1153 [this]( const SELECTION& )
1154 {
1156 };
1157
1158 const auto isArcKeepRadiusMode =
1159 [this]( const SELECTION& )
1160 {
1162 };
1163
1164 mgr->SetConditions( ACTIONS::pointEditorArcKeepCenter, CHECK( isArcKeepCenterMode ) );
1165 mgr->SetConditions( ACTIONS::pointEditorArcKeepEndpoint, CHECK( isArcKeepEndpointMode ) );
1166 mgr->SetConditions( ACTIONS::pointEditorArcKeepRadius, CHECK( isArcKeepRadiusMode ) );
1167
1168 auto isHighlightMode =
1169 [this]( const SELECTION& )
1170 {
1171 ROUTER_TOOL* tool = m_toolManager->GetTool<ROUTER_TOOL>();
1172 return tool && tool->GetRouterMode() == PNS::RM_MarkObstacles;
1173 };
1174
1175 auto isShoveMode =
1176 [this]( const SELECTION& )
1177 {
1178 ROUTER_TOOL* tool = m_toolManager->GetTool<ROUTER_TOOL>();
1179 return tool && tool->GetRouterMode() == PNS::RM_Shove;
1180 };
1181
1182 auto isWalkaroundMode =
1183 [this]( const SELECTION& )
1184 {
1185 ROUTER_TOOL* tool = m_toolManager->GetTool<ROUTER_TOOL>();
1186 return tool && tool->GetRouterMode() == PNS::RM_Walkaround;
1187 };
1188
1189 mgr->SetConditions( PCB_ACTIONS::routerHighlightMode, CHECK( isHighlightMode ) );
1190 mgr->SetConditions( PCB_ACTIONS::routerShoveMode, CHECK( isShoveMode ) );
1191 mgr->SetConditions( PCB_ACTIONS::routerWalkaroundMode, CHECK( isWalkaroundMode ) );
1192
1193 auto isAutoTrackWidth =
1194 [this]( const SELECTION& )
1195 {
1197 };
1198
1199 mgr->SetConditions( PCB_ACTIONS::autoTrackWidth, CHECK( isAutoTrackWidth ) );
1200
1201 auto haveNetCond =
1202 [] ( const SELECTION& aSel )
1203 {
1204 for( EDA_ITEM* item : aSel )
1205 {
1206 if( BOARD_CONNECTED_ITEM* bci = dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) )
1207 {
1208 if( bci->GetNetCode() > 0 )
1209 return true;
1210 }
1211 }
1212
1213 return false;
1214 };
1215
1216 mgr->SetConditions( PCB_ACTIONS::showNetInRatsnest, ENABLE( haveNetCond ) );
1217 mgr->SetConditions( PCB_ACTIONS::hideNetInRatsnest, ENABLE( haveNetCond ) );
1220
1221 static const std::vector<KICAD_T> trackTypes = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T };
1222 static const std::vector<KICAD_T> padOwnerTypes = { PCB_FOOTPRINT_T, PCB_PAD_T };
1223 static const std::vector<KICAD_T> footprintTypes = { PCB_FOOTPRINT_T };
1224 static const std::vector<KICAD_T> crossProbeTypes = { PCB_PAD_T, PCB_FOOTPRINT_T, PCB_GROUP_T };
1225 static const std::vector<KICAD_T> zoneTypes = { PCB_ZONE_T };
1226
1232
1233
1235 && SELECTION_CONDITIONS::OnlyTypes( zoneTypes );
1236
1238 && SELECTION_CONDITIONS::OnlyTypes( zoneTypes );
1239
1240 mgr->SetConditions( PCB_ACTIONS::zoneDuplicate, ENABLE( singleZoneCond ) );
1241 mgr->SetConditions( PCB_ACTIONS::drawZoneCutout, ENABLE( singleZoneCond ) );
1242 mgr->SetConditions( PCB_ACTIONS::drawSimilarZone, ENABLE( singleZoneCond ) );
1243 mgr->SetConditions( PCB_ACTIONS::zoneMerge, ENABLE( zoneMergeCond ) );
1244
1245#define CURRENT_TOOL( action ) mgr->SetConditions( action, CHECK( cond.CurrentTool( action ) ) )
1246
1247 // These tools can be used at any time to inspect the board
1252
1253 auto isDRCIdle =
1254 [this] ( const SELECTION& )
1255 {
1256 DRC_TOOL* tool = m_toolManager->GetTool<DRC_TOOL>();
1257 return !( tool && tool->IsDRCRunning() );
1258 };
1259
1260#define CURRENT_EDIT_TOOL( action ) \
1261 mgr->SetConditions( action, ACTION_CONDITIONS().Check( cond.CurrentTool( action ) ) \
1262 .Enable( isDRCIdle ) )
1263
1264 // These tools edit the board, so they must be disabled during some operations
1296
1302
1303#undef CURRENT_TOOL
1304#undef CURRENT_EDIT_TOOL
1305#undef ENABLE
1306#undef CHECK
1307// clang-format on
1308}
1309
1310
1311void PCB_EDIT_FRAME::OnQuit( wxCommandEvent& event )
1312{
1313 if( event.GetId() == wxID_EXIT )
1314 Kiway().OnKiCadExit();
1315
1316 if( event.GetId() == wxID_CLOSE || Kiface().IsSingle() )
1317 Close( false );
1318}
1319
1320
1321void PCB_EDIT_FRAME::ResolveDRCExclusions( bool aCreateMarkers )
1322{
1323 BOARD_COMMIT commit( this );
1324
1325 for( PCB_MARKER* marker : GetBoard()->ResolveDRCExclusions( aCreateMarkers ) )
1326 {
1327 if( marker->GetMarkerType() == MARKER_BASE::MARKER_DRAWING_SHEET )
1328 marker->GetRCItem()->SetItems( GetCanvas()->GetDrawingSheet() );
1329
1330 commit.Add( marker );
1331 }
1332
1333 commit.Push( wxEmptyString, SKIP_UNDO | SKIP_SET_DIRTY );
1334
1335 for( PCB_MARKER* marker : GetBoard()->Markers() )
1336 {
1337 if( marker->GetSeverity() == RPT_SEVERITY_EXCLUSION )
1338 GetCanvas()->GetView()->Update( marker );
1339 }
1340
1342}
1343
1344
1345bool PCB_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
1346{
1347 // Shutdown blocks must be determined and vetoed as early as possible
1348 if( KIPLATFORM::APP::SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION
1349 && IsContentModified() )
1350 {
1351 return false;
1352 }
1353
1354 ZONE_FILLER_TOOL* zoneFillerTool = m_toolManager->GetTool<ZONE_FILLER_TOOL>();
1355
1356 if( zoneFillerTool->IsBusy() )
1357 {
1358 wxBell();
1359
1360 if( wxWindow* reporter = dynamic_cast<wxWindow*>( zoneFillerTool->GetProgressReporter() ) )
1361 reporter->ShowWithEffect( wxSHOW_EFFECT_EXPAND );
1362
1363 return false;
1364 }
1365
1366 // Don't allow closing while the modal footprint chooser is open
1367 auto* chooser = (FOOTPRINT_CHOOSER_FRAME*) Kiway().Player( FRAME_FOOTPRINT_CHOOSER, false );
1368
1369 if( chooser && chooser->IsModal() ) // Can close footprint chooser?
1370 return false;
1371
1372 if( Kiface().IsSingle() )
1373 {
1374 auto* fpEditor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_FOOTPRINT_EDITOR, false );
1375
1376 if( fpEditor && !fpEditor->Close() ) // Can close footprint editor?
1377 return false;
1378
1379 auto* fpViewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_FOOTPRINT_VIEWER, false );
1380
1381 if( fpViewer && !fpViewer->Close() ) // Can close footprint viewer?
1382 return false;
1383 }
1384 else
1385 {
1386 auto* fpEditor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_FOOTPRINT_EDITOR, false );
1387
1388 if( fpEditor && fpEditor->IsCurrentFPFromBoard() )
1389 {
1390 if( !fpEditor->CanCloseFPFromBoard( true ) )
1391 return false;
1392 }
1393 }
1394
1395 if( IsContentModified() )
1396 {
1397 wxFileName fileName = GetBoard()->GetFileName();
1398 wxString msg = _( "Save changes to '%s' before closing?" );
1399
1400 if( !HandleUnsavedChanges( this, wxString::Format( msg, fileName.GetFullName() ),
1401 [&]() -> bool
1402 {
1403 return SaveBoard();
1404 } ) )
1405 {
1406 return false;
1407 }
1408
1409 // If user discarded changes, create a duplicate commit of last saved PCB state and
1410 // advance Last_Save_pcb tag for explicit history event.
1411 if( GetLastUnsavedChangesResponse() == wxID_NO )
1412 {
1413 wxString projPath = Prj().GetProjectPath();
1414
1415 if( !projPath.IsEmpty() && Kiway().LocalHistory().HistoryExists( projPath ) )
1416 {
1417 Kiway().LocalHistory().CommitDuplicateOfLastSave( projPath, wxS("pcb"),
1418 wxS("Discard unsaved pcb changes") );
1419 }
1420 }
1421 }
1422
1423 return PCB_BASE_EDIT_FRAME::canCloseWindow( aEvent );
1424}
1425
1426
1428{
1429 // Unregister the autosave saver before any cleanup that might invalidate the board
1430 if( GetBoard() )
1432
1433 // On Windows 7 / 32 bits, on OpenGL mode only, Pcbnew crashes
1434 // when closing this frame if a footprint was selected, and the footprint editor called
1435 // to edit this footprint, and when closing pcbnew if this footprint is still selected
1436 // See https://bugs.launchpad.net/kicad/+bug/1655858
1437 // I think this is certainly a OpenGL event fired after frame deletion, so this workaround
1438 // avoid the crash (JPC)
1439 GetCanvas()->SetEvtHandlerEnabled( false );
1440
1442
1443#ifdef KICAD_IPC_API
1444 Pgm().GetApiServer().DeregisterHandler( m_apiHandler.get() );
1445 wxTheApp->Unbind( EDA_EVT_PLUGIN_AVAILABILITY_CHANGED,
1446 &PCB_EDIT_FRAME::onPluginAvailabilityChanged, this );
1447#endif
1448
1449 // Clean up mode-less dialogs.
1450 Unbind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &PCB_EDIT_FRAME::onCloseModelessBookReporterDialogs,
1451 this );
1452
1453 wxWindow* drcDlg = wxWindow::FindWindowByName( DIALOG_DRC_WINDOW_NAME );
1454
1455 if( drcDlg )
1456 drcDlg->Close( true );
1457
1458 wxWindow* ruleEditorDlg = wxWindow::FindWindowByName( DIALOG_DRC_RULE_EDITOR_WINDOW_NAME );
1459
1460 if( ruleEditorDlg )
1461 ruleEditorDlg->Close( true );
1462
1463
1464 if( m_findDialog )
1465 {
1466 m_findDialog->Destroy();
1467 m_findDialog = nullptr;
1468 }
1469
1471 {
1472 m_inspectDrcErrorDlg->Destroy();
1473 m_inspectDrcErrorDlg = nullptr;
1474 }
1475
1477 {
1478 m_inspectClearanceDlg->Destroy();
1479 m_inspectClearanceDlg = nullptr;
1480 }
1481
1483 {
1484 m_inspectConstraintsDlg->Destroy();
1485 m_inspectConstraintsDlg = nullptr;
1486 }
1487
1488 if( m_footprintDiffDlg )
1489 {
1490 m_footprintDiffDlg->Destroy();
1491 m_footprintDiffDlg = nullptr;
1492 }
1493
1494 // Delete the auto save file if it exists.
1495 wxFileName fn = GetBoard()->GetFileName();
1496
1497 // Make sure local settings are persisted
1498 if( Prj().GetLocalSettings().ShouldAutoSave() )
1499 {
1500 m_netInspectorPanel->SaveSettings();
1502 }
1503 else
1504 {
1505 wxLogTrace( traceAutoSave, wxT( "Skipping auto-save of migrated local settings" ) );
1506 }
1507
1508 // Do not show the layer manager during closing to avoid flicker
1509 // on some platforms (Windows) that generate useless redraw of items in
1510 // the Layer Manager
1512 {
1513 m_auimgr.GetPane( wxS( "LayersManager" ) ).Show( false );
1514 m_auimgr.GetPane( wxS( "TabbedPanel" ) ).Show( false );
1515 }
1516
1517 // Unlink the old project if needed
1519
1520 // Delete board structs and undo/redo lists, to avoid crash on exit
1521 // when deleting some structs (mainly in undo/redo lists) too late
1522 Clear_Pcb( false, true );
1523
1524 // do not show the window because ScreenPcb will be deleted and we do not
1525 // want any paint event
1526 Show( false );
1527
1529}
1530
1531
1538
1539
1540void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage, wxWindow* aParent )
1541{
1542 static std::mutex dialogMutex; // Local static mutex
1543
1544 std::unique_lock<std::mutex> dialogLock( dialogMutex, std::try_to_lock );
1545
1546 // One dialog at a time.
1547 if( !dialogLock.owns_lock() )
1548 {
1549 if( m_boardSetupDlg && m_boardSetupDlg->IsShown() )
1550 {
1551 m_boardSetupDlg->Raise(); // Brings the existing dialog to the front
1552 }
1553
1554 return;
1555 }
1556
1557 // Make sure everything's up-to-date
1559
1560 DIALOG_BOARD_SETUP dlg( this, aParent );
1561
1562 if( !aInitialPage.IsEmpty() )
1563 dlg.SetInitialPage( aInitialPage, wxEmptyString );
1564
1565 // Assign dlg to the m_boardSetupDlg pointer to track its status.
1566 m_boardSetupDlg = &dlg;
1567
1568 // QuasiModal required for Scintilla auto-complete
1569 if( dlg.ShowQuasiModal() == wxID_OK )
1570 {
1571 // Note: We must synchronise time domain properties before nets and classes, otherwise the updates
1572 // called by the board listener events are using stale data
1575
1576 if( !GetBoard()->SynchronizeComponentClasses( std::unordered_set<wxString>() ) )
1577 {
1578 m_infoBar->RemoveAllButtons();
1579 m_infoBar->AddCloseButton();
1580 m_infoBar->ShowMessage( _( "Could not load component class assignment rules" ),
1581 wxICON_WARNING, WX_INFOBAR::MESSAGE_TYPE::GENERIC );
1582 }
1583
1584 // We don't know if anything was modified, so err on the side of requiring a save
1585 OnModify();
1586
1588
1591
1592 PCBNEW_SETTINGS* settings = GetPcbNewSettings();
1593 static LSET maskAndPasteLayers = LSET( { F_Mask, F_Paste, B_Mask, B_Paste } );
1594
1596 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
1597 {
1598 int flags = 0;
1599
1600 if( !aItem->IsBOARD_ITEM() )
1601 return flags;
1602
1603 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aItem );
1604
1605 if( item->Type() == PCB_VIA_T || item->Type() == PCB_PAD_T )
1606 {
1607 // Note: KIGFX::REPAINT isn't enough for things that go from invisible
1608 // to visible as they won't be found in the view layer's itemset for
1609 // re-painting.
1610 if( ( GetBoard()->GetVisibleLayers() & maskAndPasteLayers ).any() )
1611 flags |= KIGFX::ALL;
1612 }
1613
1614 if( item->Type() == PCB_TRACE_T || item->Type() == PCB_ARC_T || item->Type() == PCB_VIA_T )
1615 {
1617 flags |= KIGFX::REPAINT;
1618 }
1619
1620 if( item->Type() == PCB_PAD_T )
1621 {
1622 if( settings->m_Display.m_PadClearance )
1623 flags |= KIGFX::REPAINT;
1624 }
1625
1626 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem ) )
1627 {
1628 if( text->HasTextVars() )
1629 {
1630 text->ClearRenderCache();
1631 text->ClearBoundingBoxCache();
1633 }
1634 }
1635
1636 return flags;
1637 } );
1638
1639 GetCanvas()->Refresh();
1640
1644
1645 //this event causes the routing tool to reload its design rules information
1647 toolEvent.SetHasPosition( false );
1648 m_toolManager->ProcessEvent( toolEvent );
1649 }
1650
1651 GetCanvas()->SetFocus();
1652
1653 // Reset m_boardSetupDlg after the dialog is closed
1654 m_boardSetupDlg = nullptr;
1655}
1656
1657
1659{
1660 m_searchPane->FocusSearch();
1661}
1662
1663
1665{
1667
1668 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
1669 wxASSERT( cfg );
1670
1671 if( cfg )
1672 {
1676 }
1677}
1678
1679
1681{
1683
1684 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
1685 wxASSERT( cfg );
1686
1687 if( cfg )
1688 {
1689 wxAuiPaneInfo& apperancePane = m_auimgr.GetPane( AppearancePanelName() );
1690 cfg->m_AuiPanels.show_layer_manager = apperancePane.IsShown();
1691
1692 if( m_propertiesPanel )
1693 {
1694 cfg->m_AuiPanels.show_properties = m_propertiesPanel->IsShownOnScreen();
1696 cfg->m_AuiPanels.properties_splitter = m_propertiesPanel->SplitterProportion();
1697 }
1698
1699 // ensure m_ShowSearch is up to date (the pane can be closed)
1700 wxAuiPaneInfo& searchPaneInfo = m_auimgr.GetPane( SearchPaneName() );
1701 m_ShowSearch = searchPaneInfo.IsShown();
1703 cfg->m_AuiPanels.search_panel_height = m_searchPane->GetSize().y;
1704 cfg->m_AuiPanels.search_panel_width = m_searchPane->GetSize().x;
1705 cfg->m_AuiPanels.search_panel_dock_direction = searchPaneInfo.dock_direction;
1706
1708 {
1709 wxAuiPaneInfo& netInspectorhPaneInfo = m_auimgr.GetPane( NetInspectorPanelName() );
1710 m_ShowNetInspector = netInspectorhPaneInfo.IsShown();
1712 }
1713
1714 if( m_appearancePanel )
1715 {
1718 cfg->m_AuiPanels.appearance_expand_layer_display = m_appearancePanel->IsLayerOptionsExpanded();
1719 cfg->m_AuiPanels.appearance_expand_net_display = m_appearancePanel->IsNetOptionsExpanded();
1720 }
1721
1722 wxAuiPaneInfo& designBlocksPane = m_auimgr.GetPane( DesignBlocksPaneName() );
1723 cfg->m_AuiPanels.design_blocks_show = designBlocksPane.IsShown();
1724
1725 if( designBlocksPane.IsDocked() )
1727 else
1728 {
1729 cfg->m_AuiPanels.design_blocks_panel_float_height = designBlocksPane.floating_size.y;
1730 cfg->m_AuiPanels.design_blocks_panel_float_width = designBlocksPane.floating_size.x;
1731 }
1732
1733 m_designBlocksPane->SaveSettings();
1734 }
1735}
1736
1737
1739{
1740 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( config() );
1741
1742 return cfg ? cfg->m_RotationAngle : ANGLE_90;
1743}
1744
1745
1750
1751
1753{
1754
1755 GetColorSettings()->SetColor( LAYER_GRID, aColor );
1756 GetCanvas()->GetGAL()->SetGridColor( aColor );
1757}
1758
1759
1760void PCB_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer, bool aForceRedraw )
1761{
1762 const PCB_LAYER_ID oldLayer = GetActiveLayer();
1763
1764 if( oldLayer == aLayer && !aForceRedraw )
1765 return;
1766
1768
1769 m_appearancePanel->OnLayerChanged();
1770
1771 m_toolManager->PostAction( PCB_ACTIONS::layerChanged ); // notify other tools
1772 GetCanvas()->SetFocus(); // allow capture of hotkeys
1773 GetCanvas()->SetHighContrastLayer( aLayer );
1774
1775 /*
1776 * Only show pad, via and track clearances when a copper layer is active
1777 * and then only show the clearance layer for that copper layer. For
1778 * front/back non-copper layers, show the clearance layer for the outer
1779 * layer on that side.
1780 *
1781 * For pads/vias, this is to avoid clutter when there are pad/via layers
1782 * that vary in flash (i.e. clearance from the hole or pad edge), padstack
1783 * shape on each layer or clearances on each layer.
1784 *
1785 * For tracks, this follows the same logic as pads/vias, but in theory could
1786 * have their own set of independent clearance layers to allow track clearance
1787 * to be shown for more layers.
1788 */
1789 const auto getClearanceLayerForActive = []( PCB_LAYER_ID aActiveLayer ) -> std::optional<int>
1790 {
1791 if( IsCopperLayer( aActiveLayer ) )
1792 return CLEARANCE_LAYER_FOR( aActiveLayer );
1793
1794 return std::nullopt;
1795 };
1796
1797 if( std::optional<int> oldClearanceLayer = getClearanceLayerForActive( oldLayer ) )
1798 GetCanvas()->GetView()->SetLayerVisible( *oldClearanceLayer, false );
1799
1800 if( std::optional<int> newClearanceLayer = getClearanceLayerForActive( aLayer ) )
1801 GetCanvas()->GetView()->SetLayerVisible( *newClearanceLayer, true );
1802
1804 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
1805 {
1806 if( !aItem->IsBOARD_ITEM() )
1807 return 0;
1808
1809 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aItem );
1810
1811 // Note: KIGFX::REPAINT isn't enough for things that go from invisible to visible
1812 // as they won't be found in the view layer's itemset for re-painting.
1813 if( GetDisplayOptions().m_ContrastModeDisplay == HIGH_CONTRAST_MODE::HIDDEN )
1814 {
1815 if( item->IsOnLayer( oldLayer ) || item->IsOnLayer( aLayer ) )
1816 return KIGFX::ALL;
1817 }
1818
1819 if( item->Type() == PCB_VIA_T )
1820 {
1821 PCB_VIA* via = static_cast<PCB_VIA*>( item );
1822
1823 // Vias on a restricted layer set must be redrawn when the active layer
1824 // is changed
1825 if( via->GetViaType() == VIATYPE::BLIND
1826 || via->GetViaType() == VIATYPE::BURIED
1827 || via->GetViaType() == VIATYPE::MICROVIA )
1828 {
1829 return KIGFX::REPAINT;
1830 }
1831
1832 if( via->GetRemoveUnconnected() )
1833 return KIGFX::ALL;
1834 }
1835 else if( item->Type() == PCB_PAD_T )
1836 {
1837 PAD* pad = static_cast<PAD*>( item );
1838
1839 if( pad->GetRemoveUnconnected() )
1840 return KIGFX::ALL;
1841 }
1842
1843 return 0;
1844 } );
1845
1846 GetCanvas()->Refresh();
1847}
1848
1849
1851{
1852 wxFileName fn( GetBoard()->GetFileName() );
1853 Kiway().LocalHistory().Init( fn.GetPath() );
1855
1856 layerEnum.Choices().Clear();
1857 layerEnum.Undefined( UNDEFINED_LAYER );
1858
1859 for( PCB_LAYER_ID layer : LSET::AllLayersMask() )
1860 {
1861 // Canonical name
1862 layerEnum.Map( layer, LSET::Name( layer ) );
1863
1864 // User name
1865 layerEnum.Map( layer, GetBoard()->GetLayerName( layer ) );
1866 }
1867
1868 DRC_TOOL* drcTool = m_toolManager->GetTool<DRC_TOOL>();
1869
1870 try
1871 {
1873 }
1874 catch( PARSE_ERROR& )
1875 {
1876 // Not sure this is the best place to tell the user their rules are buggy, so
1877 // we'll stay quiet for now. Feel free to revisit this decision....
1878 }
1879
1881
1882 UpdateTitle();
1883
1884 // Display a warning that the file is read only
1885 if( fn.FileExists() && !fn.IsFileWritable() )
1886 {
1887 m_infoBar->RemoveAllButtons();
1888 m_infoBar->AddCloseButton();
1889 m_infoBar->ShowMessage( _( "Board file is read only." ),
1890 wxICON_WARNING, WX_INFOBAR::MESSAGE_TYPE::OUTDATED_SAVE );
1891 }
1892
1894
1895 // Sync layer and item visibility
1897
1898 SetElementVisibility( LAYER_RATSNEST, GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
1899
1900 m_appearancePanel->OnBoardChanged();
1901
1902 // Apply saved display state to the appearance panel after it has been set up
1903 PROJECT_LOCAL_SETTINGS& localSettings = Prj().GetLocalSettings();
1904
1905 m_appearancePanel->ApplyLayerPreset( localSettings.m_ActiveLayerPreset );
1906
1907 if( GetBoard()->GetDesignSettings().IsLayerEnabled( localSettings.m_ActiveLayer ) )
1908 SetActiveLayer( localSettings.m_ActiveLayer, true );
1909 else
1910 SetActiveLayer( GetActiveLayer(), true ); // Make sure to repaint even if not switching
1911
1912 PROJECT_FILE& projectFile = Prj().GetProjectFile();
1913
1914 m_layerPairSettings->SetLayerPairs( projectFile.m_LayerPairInfos );
1915 m_layerPairSettings->SetCurrentLayerPair( LAYER_PAIR{ F_Cu, B_Cu } );
1916
1917 // Updates any auto dimensions and the auxiliary toolbar tracks/via sizes
1919
1920 // Sync the net inspector now we have connectivity calculated
1922 m_netInspectorPanel->OnBoardChanged();
1923
1924 // Display the loaded board:
1925 Zoom_Automatique( false );
1926
1927 // Invalidate painting as loading the DRC engine will cause clearances to become valid
1929
1930 Refresh();
1931
1932 SetMsgPanel( GetBoard() );
1933 SetStatusText( wxEmptyString );
1934
1935 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "PCB file changes are unsaved" ) );
1936}
1937
1938
1940{
1941 m_appearancePanel->UpdateDisplayOptions();
1942}
1943
1944
1946{
1947 return GetBoard()->IsElementVisible( aElement );
1948}
1949
1950
1952{
1953 // Force the RATSNEST visible
1954 if( aElement == LAYER_RATSNEST )
1955 GetCanvas()->GetView()->SetLayerVisible( aElement, true );
1956 else
1957 GetCanvas()->GetView()->SetLayerVisible( aElement , aNewState );
1958
1959 GetBoard()->SetElementVisibility( aElement, aNewState );
1960}
1961
1962
1964{
1965 // call my base class
1967
1968 m_auimgr.GetPane( m_appearancePanel ).Caption( _( "Appearance" ) );
1969 m_auimgr.GetPane( m_selectionFilterPanel ).Caption( _( "Selection Filter" ) );
1970 m_auimgr.GetPane( m_propertiesPanel ).Caption( _( "Properties" ) );
1971 m_auimgr.GetPane( m_netInspectorPanel ).Caption( _( "Net Inspector" ) );
1972 m_auimgr.Update();
1973
1974 UpdateTitle();
1975}
1976
1977
1979{
1981
1982 if( project.m_PcbLastPath[ aType ].IsEmpty() )
1983 return wxEmptyString;
1984
1985 wxFileName absoluteFileName = project.m_PcbLastPath[ aType ];
1986 wxFileName pcbFileName = GetBoard()->GetFileName();
1987
1988 absoluteFileName.MakeAbsolute( pcbFileName.GetPath() );
1989 return absoluteFileName.GetFullPath();
1990}
1991
1992
1993void PCB_EDIT_FRAME::SetLastPath( LAST_PATH_TYPE aType, const wxString& aLastPath )
1994{
1996
1997 wxFileName relativeFileName = aLastPath;
1998 wxFileName pcbFileName = GetBoard()->GetFileName();
1999
2000 relativeFileName.MakeRelativeTo( pcbFileName.GetPath() );
2001
2002 if( relativeFileName.GetFullPath() != project.m_PcbLastPath[ aType ] )
2003 {
2004 project.m_PcbLastPath[ aType ] = relativeFileName.GetFullPath();
2005 OnModify();
2006 }
2007}
2008
2009
2011{
2013 Kiway().LocalHistory().NoteFileChange( GetBoard()->GetFileName() );
2014 m_ZoneFillsDirty = true;
2015
2016 if( m_isClosing )
2017 return;
2018
2019 Update3DView( true, GetPcbNewSettings()->m_Display.m_Live3DRefresh );
2020
2021 if( !GetTitle().StartsWith( wxT( "*" ) ) )
2022 UpdateTitle();
2023
2024}
2025
2026
2028{
2029 Update3DView( true, true );
2030
2031 std::shared_ptr<CONNECTIVITY_DATA> connectivity = GetBoard()->GetConnectivity();
2032 connectivity->RecalculateRatsnest( nullptr );
2034
2035 std::vector<MSG_PANEL_ITEM> msg_list;
2036 GetBoard()->GetMsgPanelInfo( this, msg_list );
2037 SetMsgPanel( msg_list );
2038}
2039
2040
2042{
2043 wxFileName fn = GetBoard()->GetFileName();
2044 bool readOnly = false;
2045 bool unsaved = false;
2046
2047 if( fn.IsOk() && fn.FileExists() )
2048 readOnly = !fn.IsFileWritable();
2049 else
2050 unsaved = true;
2051
2052 wxString title;
2053
2054 if( IsContentModified() )
2055 title = wxT( "*" );
2056
2057 title += fn.GetName();
2058
2059 if( readOnly )
2060 title += wxS( " " ) + _( "[Read Only]" );
2061
2062 if( unsaved )
2063 title += wxS( " " ) + _( "[Unsaved]" );
2064
2065 title += wxT( " \u2014 " ) + _( "PCB Editor" );
2066
2067 SetTitle( title );
2068}
2069
2070
2072{
2073 // Update the layer manager and other widgets from the board setup
2074 // (layer and items visibility, colors ...)
2075
2076 // Rebuild list of nets (full ratsnest rebuild)
2078
2079 // Update info shown by the horizontal toolbars
2081
2082 LSET activeLayers = GetBoard()->GetEnabledLayers();
2083
2084 if( !activeLayers.test( GetActiveLayer() ) )
2085 SetActiveLayer( activeLayers.Seq().front() );
2086
2087 m_SelLayerBox->SetLayerSelection( GetActiveLayer() );
2088
2090
2091 layerEnum.Choices().Clear();
2092 layerEnum.Undefined( UNDEFINED_LAYER );
2093
2094 for( PCB_LAYER_ID layer : LSET::AllLayersMask() )
2095 {
2096 // Canonical name
2097 layerEnum.Map( layer, LSET::Name( layer ) );
2098
2099 // User name
2100 layerEnum.Map( layer, GetBoard()->GetLayerName( layer ) );
2101 }
2102
2104
2105 // Sync visibility with canvas
2106 for( PCB_LAYER_ID layer : LSET::AllLayersMask() )
2107 GetCanvas()->GetView()->SetLayerVisible( layer, GetBoard()->IsLayerVisible( layer ) );
2108
2109 // Stackup and/or color theme may have changed
2110 m_appearancePanel->OnBoardChanged();
2111 m_netInspectorPanel->OnParentSetupChanged();
2112}
2113
2114
2116{
2117 // switches currently used canvas (Cairo / OpenGL).
2118 PCB_BASE_FRAME::SwitchCanvas( aCanvasType );
2119}
2120
2121
2123{
2124 if( !m_findDialog )
2125 {
2126 m_findDialog = new DIALOG_FIND( this );
2127 m_findDialog->SetCallback( std::bind( &PCB_SELECTION_TOOL::FindItem,
2128 m_toolManager->GetTool<PCB_SELECTION_TOOL>(), _1 ) );
2129 }
2130
2131 wxString findString;
2132
2133 PCB_SELECTION& selection = m_toolManager->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
2134
2135 if( selection.Size() == 1 )
2136 {
2137 EDA_ITEM* front = selection.Front();
2138
2139 switch( front->Type() )
2140 {
2141 case PCB_FOOTPRINT_T:
2142 findString = UnescapeString( static_cast<FOOTPRINT*>( front )->GetValue() );
2143 break;
2144
2145 case PCB_FIELD_T:
2146 case PCB_TEXT_T:
2147 findString = UnescapeString( static_cast<PCB_TEXT*>( front )->GetText() );
2148
2149 if( findString.Contains( wxT( "\n" ) ) )
2150 findString = findString.Before( '\n' );
2151
2152 break;
2153
2154 default:
2155 break;
2156 }
2157 }
2158
2159 m_findDialog->Preload( findString );
2160
2161 m_findDialog->Show( true );
2162}
2163
2164
2165void PCB_EDIT_FRAME::FindNext( bool reverse )
2166{
2167 if( !m_findDialog )
2169
2170 m_findDialog->FindNext( reverse );
2171}
2172
2173
2175{
2176 if( Kiface().IsSingle() )
2177 return 0;
2178
2179 // Update PCB requires a netlist. Therefore the schematic editor must be running
2180 // If this is not the case, open the schematic editor
2181 KIWAY_PLAYER* frame = Kiway().Player( FRAME_SCH, true );
2182
2183 // If Kiway() cannot create the eeschema frame, it shows a error message, and
2184 // frame is null
2185 if( !frame )
2186 return -1;
2187
2188 if( !frame->IsShownOnScreen() )
2189 {
2190 wxEventBlocker blocker( this );
2191 wxFileName fn( Prj().GetProjectPath(), Prj().GetProjectName(),
2193
2194 // Maybe the file hasn't been converted to the new s-expression file format so
2195 // see if the legacy schematic file is still in play.
2196 if( !fn.FileExists() )
2197 {
2199
2200 if( !fn.FileExists() )
2201 {
2202 DisplayErrorMessage( this, _( "The schematic for this board cannot be found." ) );
2203 return -2;
2204 }
2205 }
2206
2207 frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
2208
2209 // we show the schematic editor frame, because do not show is seen as
2210 // a not yet opened schematic by Kicad manager, which is not the case
2211 frame->Show( true );
2212
2213 // bring ourselves back to the front
2214 Raise();
2215 }
2216
2217 return 1; //Success!
2218}
2219
2220
2222 const wxString& aAnnotateMessage )
2223{
2224 int standalone = TestStandalone();
2225
2226 if( standalone == 0 )
2227 {
2228 DisplayErrorMessage( this, _( "Cannot update the PCB because PCB editor is opened in "
2229 "stand-alone mode. In order to create or update PCBs from "
2230 "schematics, you must launch the KiCad project manager and "
2231 "create a project." ) );
2232 return false; // Not in standalone mode
2233 }
2234
2235 if( standalone < 0 ) // Problem with Eeschema or the schematic
2236 return false;
2237
2238 Raise(); // Show
2239
2240 std::string payload( aAnnotateMessage );
2241
2242 Kiway().ExpressMail( FRAME_SCH, MAIL_SCH_GET_NETLIST, payload, this );
2243
2244 if( payload == aAnnotateMessage )
2245 {
2246 Raise();
2247 DisplayErrorMessage( this, aAnnotateMessage );
2248 return false;
2249 }
2250
2251 try
2252 {
2253 auto lineReader = new STRING_LINE_READER( payload, _( "Eeschema netlist" ) );
2254 KICAD_NETLIST_READER netlistReader( lineReader, &aNetlist );
2255 netlistReader.LoadNetlist();
2256 }
2257 catch( const IO_ERROR& e )
2258 {
2259 Raise();
2260
2261 // Do not translate extra_info strings. These are for developers
2262 wxString extra_info = e.Problem() + wxT( " : " ) + e.What() + wxT( " at " ) + e.Where();
2263
2264 DisplayErrorMessage( this, _( "Received an error while reading netlist. Please "
2265 "report this issue to the KiCad team using the menu "
2266 "Help->Report Bug."), extra_info );
2267 return false;
2268 }
2269
2270 return true;
2271}
2272
2273
2275{
2276 const ENV_VAR_MAP& vars = Pgm().GetLocalEnvVariables();
2277
2278 // Set the environment variables for python scripts
2279 // note: the string will be encoded UTF8 for python env
2280 for( const std::pair<const wxString, ENV_VAR_ITEM>& var : vars )
2281 UpdatePythonEnvVar( var.first, var.second.GetValue() );
2282
2283 // Because the env vars can be modified by the python scripts (rewritten in UTF8),
2284 // regenerate them (in Unicode) for our normal environment
2285 for( const std::pair<const wxString, ENV_VAR_ITEM>& var : vars )
2286 wxSetEnv( var.first, var.second.GetValue() );
2287}
2288
2289
2291{
2292 wxString evValue;
2293 wxGetEnv( PROJECT_VAR_NAME, &evValue );
2294 UpdatePythonEnvVar( wxString( PROJECT_VAR_NAME ).ToStdString(), evValue );
2295
2296 // Because PROJECT_VAR_NAME can be modified by the python scripts (rewritten in UTF8),
2297 // regenerate it (in Unicode) for our normal environment
2298 wxSetEnv( PROJECT_VAR_NAME, evValue );
2299}
2300
2301
2303{
2304 if( aFootprint == nullptr )
2305 return;
2306
2308
2309 /*
2310 * Make sure dlg is destroyed before GetCanvas->Refresh is called
2311 * later or the refresh will try to modify its properties since
2312 * they share a GL context.
2313 */
2314 {
2315 DIALOG_FOOTPRINT_PROPERTIES dlg( this, aFootprint );
2316
2317 dlg.ShowQuasiModal();
2318 retvalue = dlg.GetReturnValue();
2319 }
2320
2321 /*
2322 * retvalue =
2323 * FP_PROPS_UPDATE_FP to show Update Footprints dialog
2324 * FP_PROPS_CHANGE_FP to show Change Footprints dialog
2325 * FP_PROPS_OK for normal edit
2326 * FP_PROPS_CANCEL if aborted
2327 * FP_PROPS_EDIT_BOARD_FP to load board footprint into Footprint Editor
2328 * FP_PROPS_EDIT_LIBRARY_FP to load library footprint into Footprint Editor
2329 */
2330
2332 {
2333 // If something edited, push a refresh request
2334 GetCanvas()->Refresh();
2335 }
2337 {
2338 if( KIWAY_PLAYER* frame = Kiway().Player( FRAME_FOOTPRINT_EDITOR, true ) )
2339 {
2340 FOOTPRINT_EDIT_FRAME* fp_editor = static_cast<FOOTPRINT_EDIT_FRAME*>( frame );
2341
2342 fp_editor->LoadFootprintFromBoard( aFootprint );
2343 fp_editor->Show( true );
2344 fp_editor->Raise(); // Iconize( false );
2345 }
2346 }
2348 {
2349 if( KIWAY_PLAYER* frame = Kiway().Player( FRAME_FOOTPRINT_EDITOR, true ) )
2350 {
2351 FOOTPRINT_EDIT_FRAME* fp_editor = static_cast<FOOTPRINT_EDIT_FRAME*>( frame );
2352
2353 fp_editor->LoadFootprintFromLibrary( aFootprint->GetFPID() );
2354 fp_editor->Show( true );
2355 fp_editor->Raise(); // Iconize( false );
2356 }
2357 }
2359 {
2360 ShowExchangeFootprintsDialog( aFootprint, true, true );
2361 }
2363 {
2364 ShowExchangeFootprintsDialog( aFootprint, false, true );
2365 }
2366}
2367
2368
2370 bool aSelectedMode )
2371{
2372 DIALOG_EXCHANGE_FOOTPRINTS dialog( this, aFootprint, aUpdateMode, aSelectedMode );
2373
2374 return dialog.ShowQuasiModal();
2375}
2376
2377
2389static void processTextItem( const PCB_TEXT& aSrc, PCB_TEXT& aDest,
2390 bool aResetText, bool aResetTextLayers, bool aResetTextEffects,
2391 bool aResetTextPositions, bool* aUpdated )
2392{
2393 if( aResetText )
2394 *aUpdated |= aSrc.GetText() != aDest.GetText();
2395 else
2396 aDest.SetText( aSrc.GetText() );
2397
2398 if( aResetTextLayers )
2399 {
2400 *aUpdated |= aSrc.GetLayer() != aDest.GetLayer();
2401 *aUpdated |= aSrc.IsVisible() != aDest.IsVisible();
2402 }
2403 else
2404 {
2405 aDest.SetLayer( aSrc.GetLayer() );
2406 aDest.SetVisible( aSrc.IsVisible() );
2407 }
2408
2409 VECTOR2I origPos = aDest.GetFPRelativePosition();
2410
2411 if( aResetTextEffects )
2412 {
2413 *aUpdated |= aSrc.GetHorizJustify() != aDest.GetHorizJustify();
2414 *aUpdated |= aSrc.GetVertJustify() != aDest.GetVertJustify();
2415 *aUpdated |= aSrc.GetTextSize() != aDest.GetTextSize();
2416 *aUpdated |= aSrc.GetTextThickness() != aDest.GetTextThickness();
2417 *aUpdated |= aSrc.GetTextAngle() != aDest.GetTextAngle();
2418 }
2419 else
2420 {
2421 aDest.SetAttributes( aSrc );
2422 }
2423
2424 if( aResetTextPositions )
2425 {
2426 *aUpdated |= aSrc.GetFPRelativePosition() != origPos;
2427 aDest.SetFPRelativePosition( origPos );
2428 }
2429 else
2430 {
2432 }
2433
2434 aDest.SetLocked( aSrc.IsLocked() );
2435 const_cast<KIID&>( aDest.m_Uuid ) = aSrc.m_Uuid;
2436}
2437
2438
2439template<typename T>
2440static std::vector<std::pair<T*, T*>> matchItemsBySimilarity( const std::vector<T*>& aExisting,
2441 const std::vector<T*>& aNew )
2442{
2443 struct MATCH_CANDIDATE
2444 {
2445 T* existing;
2446 T* updated;
2447 double score;
2448 };
2449
2450 std::vector<MATCH_CANDIDATE> candidates;
2451
2452 for( T* existing : aExisting )
2453 {
2454 for( T* updated : aNew )
2455 {
2456 if( existing->Type() != updated->Type() )
2457 continue;
2458
2459 double similarity = existing->Similarity( *updated );
2460
2461 if constexpr( std::is_same_v<T, PAD> )
2462 {
2463 if( existing->GetNumber() == updated->GetNumber() )
2464 similarity += 2.0;
2465 }
2466
2467 if( similarity <= 0.0 )
2468 continue;
2469
2470 candidates.push_back( { existing, updated, similarity } );
2471 }
2472 }
2473
2474 std::sort( candidates.begin(), candidates.end(),
2475 []( const MATCH_CANDIDATE& a, const MATCH_CANDIDATE& b )
2476 {
2477 if( a.score != b.score )
2478 return a.score > b.score;
2479
2480 if( a.existing != b.existing )
2481 return a.existing < b.existing;
2482
2483 return a.updated < b.updated;
2484 } );
2485
2486 std::vector<std::pair<T*, T*>> matches;
2487 matches.reserve( candidates.size() );
2488
2489 std::unordered_set<T*> matchedExisting;
2490 std::unordered_set<T*> matchedNew;
2491
2492 for( const MATCH_CANDIDATE& candidate : candidates )
2493 {
2494 if( matchedExisting.find( candidate.existing ) != matchedExisting.end() )
2495 continue;
2496
2497 if( matchedNew.find( candidate.updated ) != matchedNew.end() )
2498 continue;
2499
2500 matchedExisting.insert( candidate.existing );
2501 matchedNew.insert( candidate.updated );
2502 matches.emplace_back( candidate.existing, candidate.updated );
2503 }
2504
2505 return matches;
2506}
2507
2508
2510 BOARD_COMMIT& aCommit,
2511 bool deleteExtraTexts,
2512 bool resetTextLayers,
2513 bool resetTextEffects,
2514 bool resetTextPositions,
2515 bool resetTextContent,
2516 bool resetFabricationAttrs,
2517 bool resetClearanceOverrides,
2518 bool reset3DModels,
2519 bool* aUpdated )
2520{
2521 EDA_GROUP* parentGroup = aExisting->GetParentGroup();
2522 bool dummyBool = false;
2523
2524 if( !aUpdated )
2525 aUpdated = &dummyBool;
2526
2527 if( parentGroup )
2528 {
2529 aCommit.Modify( parentGroup->AsEdaItem(), nullptr, RECURSE_MODE::NO_RECURSE );
2530 parentGroup->RemoveItem( aExisting );
2531 parentGroup->AddItem( aNew );
2532 }
2533
2534 aNew->SetParent( GetBoard() );
2535
2536 PlaceFootprint( aNew, false, aExisting->GetPosition() );
2537
2538 if( aNew->GetLayer() != aExisting->GetLayer() )
2539 aNew->Flip( aNew->GetPosition(), GetPcbNewSettings()->m_FlipDirection );
2540
2541 if( aNew->GetOrientation() != aExisting->GetOrientation() )
2542 aNew->SetOrientation( aExisting->GetOrientation() );
2543
2544 aNew->SetLocked( aExisting->IsLocked() );
2545
2546 const_cast<KIID&>( aNew->m_Uuid ) = aExisting->m_Uuid;
2547 const_cast<KIID&>( aNew->Reference().m_Uuid ) = aExisting->Reference().m_Uuid;
2548 const_cast<KIID&>( aNew->Value().m_Uuid ) = aExisting->Value().m_Uuid;
2549
2550 std::vector<PAD*> oldPads;
2551 oldPads.reserve( aExisting->Pads().size() );
2552
2553 for( PAD* pad : aExisting->Pads() )
2554 oldPads.push_back( pad );
2555
2556 std::vector<PAD*> newPads;
2557 newPads.reserve( aNew->Pads().size() );
2558
2559 for( PAD* pad : aNew->Pads() )
2560 newPads.push_back( pad );
2561
2562 auto padMatches = matchItemsBySimilarity<PAD>( oldPads, newPads );
2563 std::unordered_set<PAD*> matchedNewPads;
2564
2565 for( const auto& match : padMatches )
2566 {
2567 PAD* oldPad = match.first;
2568 PAD* newPad = match.second;
2569
2570 matchedNewPads.insert( newPad );
2571 const_cast<KIID&>( newPad->m_Uuid ) = oldPad->m_Uuid;
2573 newPad->SetPinFunction( oldPad->GetPinFunction() );
2574 newPad->SetPinType( oldPad->GetPinType() );
2575
2576 if( newPad->IsOnCopperLayer() )
2577 newPad->SetNetCode( oldPad->GetNetCode() );
2578 else
2580 }
2581
2582 for( PAD* newPad : aNew->Pads() )
2583 {
2584 if( matchedNewPads.find( newPad ) != matchedNewPads.end() )
2585 continue;
2586
2587 const_cast<KIID&>( newPad->m_Uuid ) = KIID();
2588 newPad->SetNetCode( NETINFO_LIST::UNCONNECTED );
2589 }
2590
2591 std::vector<BOARD_ITEM*> oldDrawings;
2592 oldDrawings.reserve( aExisting->GraphicalItems().size() );
2593
2594 for( BOARD_ITEM* item : aExisting->GraphicalItems() )
2595 oldDrawings.push_back( item );
2596
2597 std::vector<BOARD_ITEM*> newDrawings;
2598 newDrawings.reserve( aNew->GraphicalItems().size() );
2599
2600 for( BOARD_ITEM* item : aNew->GraphicalItems() )
2601 newDrawings.push_back( item );
2602
2603 auto drawingMatches = matchItemsBySimilarity<BOARD_ITEM>( oldDrawings, newDrawings );
2604 std::unordered_map<BOARD_ITEM*, BOARD_ITEM*> oldToNewDrawings;
2605 std::unordered_set<BOARD_ITEM*> matchedNewDrawings;
2606
2607 for( const auto& match : drawingMatches )
2608 {
2609 BOARD_ITEM* oldItem = match.first;
2610 BOARD_ITEM* newItem = match.second;
2611
2612 oldToNewDrawings[ oldItem ] = newItem;
2613 matchedNewDrawings.insert( newItem );
2614 const_cast<KIID&>( newItem->m_Uuid ) = oldItem->m_Uuid;
2615 }
2616
2617 for( BOARD_ITEM* newItem : newDrawings )
2618 {
2619 if( matchedNewDrawings.find( newItem ) == matchedNewDrawings.end() )
2620 const_cast<KIID&>( newItem->m_Uuid ) = KIID();
2621 }
2622
2623 std::vector<ZONE*> oldZones;
2624 oldZones.reserve( aExisting->Zones().size() );
2625
2626 for( ZONE* zone : aExisting->Zones() )
2627 oldZones.push_back( zone );
2628
2629 std::vector<ZONE*> newZones;
2630 newZones.reserve( aNew->Zones().size() );
2631
2632 for( ZONE* zone : aNew->Zones() )
2633 newZones.push_back( zone );
2634
2635 auto zoneMatches = matchItemsBySimilarity<ZONE>( oldZones, newZones );
2636 std::unordered_set<ZONE*> matchedNewZones;
2637
2638 for( const auto& match : zoneMatches )
2639 {
2640 ZONE* oldZone = match.first;
2641 ZONE* newZone = match.second;
2642
2643 matchedNewZones.insert( newZone );
2644 const_cast<KIID&>( newZone->m_Uuid ) = oldZone->m_Uuid;
2645 }
2646
2647 for( ZONE* newZone : newZones )
2648 {
2649 if( matchedNewZones.find( newZone ) == matchedNewZones.end() )
2650 const_cast<KIID&>( newZone->m_Uuid ) = KIID();
2651 }
2652
2653 std::vector<PCB_POINT*> oldPoints;
2654 oldPoints.reserve( aExisting->Points().size() );
2655
2656 for( PCB_POINT* point : aExisting->Points() )
2657 oldPoints.push_back( point );
2658
2659 std::vector<PCB_POINT*> newPoints;
2660 newPoints.reserve( aNew->Points().size() );
2661
2662 for( PCB_POINT* point : aNew->Points() )
2663 newPoints.push_back( point );
2664
2665 auto pointMatches = matchItemsBySimilarity<PCB_POINT>( oldPoints, newPoints );
2666 std::unordered_set<PCB_POINT*> matchedNewPoints;
2667
2668 for( const auto& match : pointMatches )
2669 {
2670 PCB_POINT* oldPoint = match.first;
2671 PCB_POINT* newPoint = match.second;
2672
2673 matchedNewPoints.insert( newPoint );
2674 const_cast<KIID&>( newPoint->m_Uuid ) = oldPoint->m_Uuid;
2675 }
2676
2677 for( PCB_POINT* newPoint : newPoints )
2678 {
2679 if( matchedNewPoints.find( newPoint ) == matchedNewPoints.end() )
2680 const_cast<KIID&>( newPoint->m_Uuid ) = KIID();
2681 }
2682
2683 std::vector<PCB_GROUP*> oldGroups;
2684 oldGroups.reserve( aExisting->Groups().size() );
2685
2686 for( PCB_GROUP* group : aExisting->Groups() )
2687 oldGroups.push_back( group );
2688
2689 std::vector<PCB_GROUP*> newGroups;
2690 newGroups.reserve( aNew->Groups().size() );
2691
2692 for( PCB_GROUP* group : aNew->Groups() )
2693 newGroups.push_back( group );
2694
2695 auto groupMatches = matchItemsBySimilarity<PCB_GROUP>( oldGroups, newGroups );
2696 std::unordered_set<PCB_GROUP*> matchedNewGroups;
2697
2698 for( const auto& match : groupMatches )
2699 {
2700 PCB_GROUP* oldGroup = match.first;
2701 PCB_GROUP* newGroup = match.second;
2702
2703 matchedNewGroups.insert( newGroup );
2704 const_cast<KIID&>( newGroup->m_Uuid ) = oldGroup->m_Uuid;
2705 }
2706
2707 for( PCB_GROUP* newGroup : newGroups )
2708 {
2709 if( matchedNewGroups.find( newGroup ) == matchedNewGroups.end() )
2710 const_cast<KIID&>( newGroup->m_Uuid ) = KIID();
2711 }
2712
2713 std::vector<PCB_FIELD*> oldFieldsVec;
2714 std::vector<PCB_FIELD*> newFieldsVec;
2715
2716 oldFieldsVec.reserve( aExisting->GetFields().size() );
2717
2718 for( PCB_FIELD* field : aExisting->GetFields() )
2719 {
2720 wxCHECK2( field, continue );
2721
2722 if( field->IsReference() || field->IsValue() )
2723 continue;
2724
2725 oldFieldsVec.push_back( field );
2726 }
2727
2728 newFieldsVec.reserve( aNew->GetFields().size() );
2729
2730 for( PCB_FIELD* field : aNew->GetFields() )
2731 {
2732 wxCHECK2( field, continue );
2733
2734 if( field->IsReference() || field->IsValue() )
2735 continue;
2736
2737 newFieldsVec.push_back( field );
2738 }
2739
2740 auto fieldMatches = matchItemsBySimilarity<PCB_FIELD>( oldFieldsVec, newFieldsVec );
2741 std::unordered_map<PCB_FIELD*, PCB_FIELD*> oldToNewFields;
2742 std::unordered_set<PCB_FIELD*> matchedNewFields;
2743
2744 for( const auto& match : fieldMatches )
2745 {
2746 PCB_FIELD* oldField = match.first;
2747 PCB_FIELD* newField = match.second;
2748
2749 oldToNewFields[ oldField ] = newField;
2750 matchedNewFields.insert( newField );
2751 const_cast<KIID&>( newField->m_Uuid ) = oldField->m_Uuid;
2752 }
2753
2754 for( PCB_FIELD* newField : newFieldsVec )
2755 {
2756 if( matchedNewFields.find( newField ) == matchedNewFields.end() )
2757 const_cast<KIID&>( newField->m_Uuid ) = KIID();
2758 }
2759
2760 std::unordered_map<PCB_TEXT*, PCB_TEXT*> oldToNewTexts;
2761
2762 for( const auto& match : drawingMatches )
2763 {
2764 PCB_TEXT* oldText = dynamic_cast<PCB_TEXT*>( match.first );
2765 PCB_TEXT* newText = dynamic_cast<PCB_TEXT*>( match.second );
2766
2767 if( oldText && newText )
2768 oldToNewTexts[ oldText ] = newText;
2769 }
2770
2771 std::set<PCB_TEXT*> handledTextItems;
2772
2773 for( BOARD_ITEM* oldItem : aExisting->GraphicalItems() )
2774 {
2775 PCB_TEXT* oldTextItem = dynamic_cast<PCB_TEXT*>( oldItem );
2776
2777 if( oldTextItem )
2778 {
2779 // Dimensions have PCB_TEXT base but are not treated like texts in the updater
2780 if( dynamic_cast<PCB_DIMENSION_BASE*>( oldTextItem ) )
2781 continue;
2782
2783 PCB_TEXT* newTextItem = nullptr;
2784
2785 auto textMatchIt = oldToNewTexts.find( oldTextItem );
2786
2787 if( textMatchIt != oldToNewTexts.end() )
2788 newTextItem = textMatchIt->second;
2789
2790 if( newTextItem )
2791 {
2792 handledTextItems.insert( newTextItem );
2793 processTextItem( *oldTextItem, *newTextItem, resetTextContent, resetTextLayers,
2794 resetTextEffects, resetTextPositions, aUpdated );
2795 }
2796 else if( deleteExtraTexts )
2797 {
2798 *aUpdated = true;
2799 }
2800 else
2801 {
2802 newTextItem = static_cast<PCB_TEXT*>( oldTextItem->Clone() );
2803 handledTextItems.insert( newTextItem );
2804 aNew->Add( newTextItem );
2805 }
2806 }
2807 }
2808
2809 // Check for any newly-added text items and set the update flag as appropriate
2810 for( BOARD_ITEM* newItem : aNew->GraphicalItems() )
2811 {
2812 PCB_TEXT* newTextItem = dynamic_cast<PCB_TEXT*>( newItem );
2813
2814 if( newTextItem )
2815 {
2816 // Dimensions have PCB_TEXT base but are not treated like texts in the updater
2817 if( dynamic_cast<PCB_DIMENSION_BASE*>( newTextItem ) )
2818 continue;
2819
2820 if( !handledTextItems.contains( newTextItem ) )
2821 {
2822 *aUpdated = true;
2823 break;
2824 }
2825 }
2826 }
2827
2828 // Copy reference. The initial text is always used, never resetted
2829 processTextItem( aExisting->Reference(), aNew->Reference(), false, resetTextLayers,
2830 resetTextEffects, resetTextPositions, aUpdated );
2831
2832 // Copy value
2833 processTextItem( aExisting->Value(), aNew->Value(),
2834 // reset value text only when it is a proxy for the footprint ID
2835 // (cf replacing value "MountingHole-2.5mm" with "MountingHole-4.0mm")
2836 aExisting->GetValue() == aExisting->GetFPID().GetLibItemName().wx_str(),
2837 resetTextLayers, resetTextEffects, resetTextPositions, aUpdated );
2838
2839 std::set<PCB_FIELD*> handledFields;
2840
2841 // Copy fields in accordance with the reset* flags
2842 for( PCB_FIELD* oldField : aExisting->GetFields() )
2843 {
2844 wxCHECK2( oldField, continue );
2845
2846 // Reference and value are already handled
2847 if( oldField->IsReference() || oldField->IsValue() )
2848 continue;
2849
2850 PCB_FIELD* newField = nullptr;
2851
2852 auto fieldMatchIt = oldToNewFields.find( oldField );
2853
2854 if( fieldMatchIt != oldToNewFields.end() )
2855 newField = fieldMatchIt->second;
2856
2857 if( newField )
2858 {
2859 handledFields.insert( newField );
2860 processTextItem( *oldField, *newField, resetTextContent, resetTextLayers,
2861 resetTextEffects, resetTextPositions, aUpdated );
2862 }
2863 else if( deleteExtraTexts )
2864 {
2865 *aUpdated = true;
2866 }
2867 else
2868 {
2869 newField = new PCB_FIELD( *oldField );
2870 handledFields.insert( newField );
2871 aNew->Add( newField );
2872 }
2873 }
2874
2875 // Check for any newly-added fields and set the update flag as appropriate
2876 for( PCB_FIELD* newField : aNew->GetFields() )
2877 {
2878 wxCHECK2( newField, continue );
2879
2880 // Reference and value are already handled
2881 if( newField->IsReference() || newField->IsValue() )
2882 continue;
2883
2884 if( !handledFields.contains( newField ) )
2885 {
2886 *aUpdated = true;
2887 break;
2888 }
2889 }
2890
2891 if( resetFabricationAttrs )
2892 {
2893 // We've replaced the existing footprint with the library one, so the fabrication attrs
2894 // are already reset. Just set the aUpdated flag if appropriate.
2895 if( aNew->GetAttributes() != aExisting->GetAttributes() )
2896 *aUpdated = true;
2897 }
2898 else
2899 {
2900 aNew->SetAttributes( aExisting->GetAttributes() );
2901 }
2902
2903 if( resetClearanceOverrides )
2904 {
2905 if( aExisting->AllowSolderMaskBridges() != aNew->AllowSolderMaskBridges() )
2906 *aUpdated = true;
2907
2908 if( ( aExisting->GetLocalClearance() != aNew->GetLocalClearance() )
2909 || ( aExisting->GetLocalSolderMaskMargin() != aNew->GetLocalSolderMaskMargin() )
2910 || ( aExisting->GetLocalSolderPasteMargin() != aNew->GetLocalSolderPasteMargin() )
2912 || ( aExisting->GetLocalZoneConnection() != aNew->GetLocalZoneConnection() ) )
2913 {
2914 *aUpdated = true;
2915 }
2916 }
2917 else
2918 {
2919 aNew->SetLocalClearance( aExisting->GetLocalClearance() );
2923 aNew->SetLocalZoneConnection( aExisting->GetLocalZoneConnection() );
2925 }
2926
2927 if( reset3DModels )
2928 {
2929 // We've replaced the existing footprint with the library one, so the 3D models are
2930 // already reset. Just set the aUpdated flag if appropriate.
2931 if( aNew->Models().size() != aExisting->Models().size() )
2932 {
2933 *aUpdated = true;
2934 }
2935 else
2936 {
2937 for( size_t ii = 0; ii < aNew->Models().size(); ++ii )
2938 {
2939 if( aNew->Models()[ii] != aExisting->Models()[ii] )
2940 {
2941 *aUpdated = true;
2942 break;
2943 }
2944 }
2945 }
2946 }
2947 else
2948 {
2949 aNew->Models() = aExisting->Models(); // Linked list of 3D models.
2950 }
2951
2952 // Updating other parameters
2953 aNew->SetPath( aExisting->GetPath() );
2954 aNew->SetSheetfile( aExisting->GetSheetfile() );
2955 aNew->SetSheetname( aExisting->GetSheetname() );
2956 aNew->SetFilters( aExisting->GetFilters() );
2957 aNew->SetStaticComponentClass( aExisting->GetComponentClass() );
2958
2959 if( *aUpdated == false )
2960 {
2961 // Check pad shapes, graphics, zones, etc. for changes
2963 *aUpdated = true;
2964 }
2965
2966 aCommit.Remove( aExisting );
2967 aCommit.Add( aNew );
2968
2969 aNew->ClearFlags();
2970}
2971
2972
2974{
2976
2978
2980
2981 SetElementVisibility( LAYER_RATSNEST, GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
2982
2984
2985 // Netclass definitions could have changed, either by us or by Eeschema, so we need to
2986 // recompile the implicit rules
2987 DRC_TOOL* drcTool = m_toolManager->GetTool<DRC_TOOL>();
2988 WX_INFOBAR* infobar = GetInfoBar();
2989
2990 try
2991 {
2993
2994 if( infobar->GetMessageType() == WX_INFOBAR::MESSAGE_TYPE::DRC_RULES_ERROR )
2995 infobar->Dismiss();
2996 }
2997 catch( PARSE_ERROR& )
2998 {
2999 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, _( "Edit design rules" ),
3000 wxEmptyString );
3001
3002 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
3003 [&]( wxHyperlinkEvent& aEvent )
3004 {
3005 ShowBoardSetupDialog( _( "Custom Rules" ) );
3006 } ) );
3007
3008 infobar->RemoveAllButtons();
3009 infobar->AddButton( button );
3010 infobar->AddCloseButton();
3011 infobar->ShowMessage( _( "Could not compile custom design rules." ), wxICON_ERROR,
3012 WX_INFOBAR::MESSAGE_TYPE::DRC_RULES_ERROR );
3013 }
3014
3017
3018 // Update the environment variables in the Python interpreter
3019 if( aFlags & ENVVARS_CHANGED )
3021
3022 Layout();
3023 SendSizeEvent();
3024}
3025
3026
3031
3032
3034{
3036
3037 // Register autosave history saver for the board.
3038 // Saver exports the in-memory BOARD into the history mirror preserving the original
3039 // relative path and file name (reparented under .history) without touching dirty flags.
3040 if( GetBoard() )
3041 {
3043 [this]( const wxString& aProjectPath, std::vector<wxString>& aFiles )
3044 {
3045 GetBoard()->SaveToHistory( aProjectPath, aFiles );
3046 } );
3047 }
3048}
3049
3050
3052{
3053 TOOL_BASE* currentTool = GetToolManager()->GetCurrentTool();
3054
3055 // When a single item that can be point-edited is selected, the point editor
3056 // tool will be active instead of the selection tool. It blocks undo/redo
3057 // while the user is actually dragging points around, though, so we can use
3058 // this as an initial check to prevent API actions when points are being edited.
3059 if( UndoRedoBlocked() )
3060 return false;
3061
3062 // Don't allow any API use while the user is using a tool that could
3063 // modify the model in the middle of the message stream
3064 if( currentTool != GetToolManager()->GetTool<PCB_SELECTION_TOOL>() &&
3065 currentTool != GetToolManager()->GetTool<PCB_POINT_EDITOR>() )
3066 {
3067 return false;
3068 }
3069
3070 ZONE_FILLER_TOOL* zoneFillerTool = m_toolManager->GetTool<ZONE_FILLER_TOOL>();
3071
3072 if( zoneFillerTool->IsBusy() )
3073 return false;
3074
3075 ROUTER_TOOL* routerTool = m_toolManager->GetTool<ROUTER_TOOL>();
3076
3077 if( routerTool && routerTool->RoutingInProgress() )
3078 return false;
3079
3081}
3082
3083
3084
3086{
3087 return GetBoard()->GetFileName();
3088}
3089
3090
3092{
3093 return m_auimgr.GetPane( wxS( "LayersManager" ) ).IsShown();
3094}
3095
3096
3098{
3099 return m_auimgr.GetPane( PropertiesPaneName() ).IsShown();
3100}
3101
3102
3104{
3105 return m_auimgr.GetPane( NetInspectorPanelName() ).IsShown();
3106}
3107
3108
3109void PCB_EDIT_FRAME::onSize( wxSizeEvent& aEvent )
3110{
3111 if( IsShownOnScreen() )
3112 {
3113 // We only need this until the frame is done resizing and the final client size is
3114 // established.
3115 Unbind( wxEVT_SIZE, &PCB_EDIT_FRAME::onSize, this );
3117 }
3118
3119 // Skip() is called in the base class.
3120 EDA_DRAW_FRAME::OnSize( aEvent );
3121}
3122
3123
3134
3135
3146
3147
3158
3159
3161{
3162 if( !m_footprintDiffDlg )
3163 {
3165 _( "Compare Footprint with Library" ) );
3166
3167 m_footprintDiffDlg->m_sdbSizerApply->SetLabel( _( "Update Footprint from Library..." ) );
3168 m_footprintDiffDlg->m_sdbSizerApply->PostSizeEventToParent();
3169 m_footprintDiffDlg->m_sdbSizerApply->Show();
3170 }
3171
3172 return m_footprintDiffDlg;
3173}
3174
3175
3177{
3178 if( m_inspectDrcErrorDlg && aEvent.GetString() == INSPECT_DRC_ERROR_DIALOG_NAME )
3179 {
3180 m_inspectDrcErrorDlg->Destroy();
3181 m_inspectDrcErrorDlg = nullptr;
3182 }
3183 else if( m_inspectClearanceDlg && aEvent.GetString() == INSPECT_CLEARANCE_DIALOG_NAME )
3184 {
3185 m_inspectClearanceDlg->Destroy();
3186 m_inspectClearanceDlg = nullptr;
3187 }
3188 else if( m_inspectConstraintsDlg && aEvent.GetString() == INSPECT_CONSTRAINTS_DIALOG_NAME )
3189 {
3190 m_inspectConstraintsDlg->Destroy();
3191 m_inspectConstraintsDlg = nullptr;
3192 }
3193 else if( m_footprintDiffDlg && aEvent.GetString() == FOOTPRINT_DIFF_DIALOG_NAME )
3194 {
3195 if( aEvent.GetId() == wxID_APPLY )
3196 {
3197 KIID fpUUID = m_footprintDiffDlg->GetUserItemID();
3198
3199 CallAfter(
3200 [this, fpUUID]()
3201 {
3202 BOARD_ITEM* item = m_pcb->ResolveItem( fpUUID );
3203
3204 if( FOOTPRINT* footprint = dynamic_cast<FOOTPRINT*>( item ) )
3205 {
3206 m_toolManager->RunAction<EDA_ITEM*>( ACTIONS::selectItem, footprint );
3207
3208 DIALOG_EXCHANGE_FOOTPRINTS dialog( this, footprint, true, true );
3209 dialog.ShowQuasiModal();
3210 }
3211 } );
3212 }
3213
3214 m_footprintDiffDlg->Destroy();
3215 m_footprintDiffDlg = nullptr;
3216 }
3217}
3218
3219
3220#ifdef KICAD_IPC_API
3221void PCB_EDIT_FRAME::onPluginAvailabilityChanged( wxCommandEvent& aEvt )
3222{
3223 wxLogTrace( traceApi, "PCB frame: EDA_EVT_PLUGIN_AVAILABILITY_CHANGED" );
3225 aEvt.Skip();
3226}
3227#endif
3228
3229
3231{
3232 PCB_LAYER_ID curLayer = GetActiveLayer();
3233 const PCB_DISPLAY_OPTIONS& displ_opts = GetDisplayOptions();
3234
3235 // Check if the specified layer matches the present layer
3236 if( layer == curLayer )
3237 return;
3238
3239 // Copper layers cannot be selected unconditionally; how many of those layers are currently
3240 // enabled needs to be checked.
3241 if( IsCopperLayer( layer ) )
3242 {
3243 if( layer > GetBoard()->GetCopperLayerStackMaxId() )
3244 return;
3245 }
3246
3247 // Is yet more checking required? E.g. when the layer to be selected is a non-copper layer,
3248 // or when switching between a copper layer and a non-copper layer, or vice-versa?
3249
3250 SetActiveLayer( layer );
3251
3253 GetCanvas()->Refresh();
3254}
3255
3256
3258{
3259 switch( aItem->Type() )
3260 {
3263 break;
3264
3265 case PCB_BARCODE_T:
3266 ShowBarcodePropertiesDialog( static_cast<PCB_BARCODE*>( aItem ) );
3267 break;
3268
3269 case PCB_FIELD_T:
3270 case PCB_TEXT_T:
3271 ShowTextPropertiesDialog( static_cast<PCB_TEXT*>( aItem ) );
3272 break;
3273
3274 case PCB_TEXTBOX_T:
3275 ShowTextBoxPropertiesDialog( static_cast<PCB_TEXTBOX*>( aItem ) );
3276 break;
3277
3278 case PCB_TABLE_T:
3279 {
3280 DIALOG_TABLE_PROPERTIES dlg( this, static_cast<PCB_TABLE*>( aItem ) );
3281
3282 //QuasiModal required for Scintilla auto-complete
3283 dlg.ShowQuasiModal();
3284 break;
3285 }
3286
3287 case PCB_PAD_T:
3288 ShowPadPropertiesDialog( static_cast<PAD*>( aItem ) );
3289 break;
3290
3291 case PCB_FOOTPRINT_T:
3292 ShowFootprintPropertiesDialog( static_cast<FOOTPRINT*>( aItem ) );
3293 break;
3294
3295 case PCB_TARGET_T:
3296 ShowTargetOptionsDialog( static_cast<PCB_TARGET*>( aItem ) );
3297 break;
3298
3299 case PCB_DIM_ALIGNED_T:
3300 case PCB_DIM_CENTER_T:
3301 case PCB_DIM_RADIAL_T:
3303 case PCB_DIM_LEADER_T:
3304 {
3305 DIALOG_DIMENSION_PROPERTIES dlg( this, static_cast<PCB_DIMENSION_BASE*>( aItem ) );
3306
3307 dlg.ShowModal();
3308 break;
3309 }
3310
3311 case PCB_SHAPE_T:
3312 ShowGraphicItemPropertiesDialog( static_cast<PCB_SHAPE*>( aItem ) );
3313 break;
3314
3315 case PCB_ZONE_T:
3316 Edit_Zone_Params( static_cast<ZONE*>( aItem ) );
3317 break;
3318
3319 case PCB_GROUP_T:
3321 static_cast<EDA_GROUP*>( static_cast<PCB_GROUP*>( aItem ) ) );
3322 break;
3323
3324 case PCB_GENERATOR_T:
3325 static_cast<PCB_GENERATOR*>( aItem )->ShowPropertiesDialog( this );
3326 break;
3327
3328 case PCB_MARKER_T:
3329 m_toolManager->GetTool<DRC_TOOL>()->CrossProbe( static_cast<PCB_MARKER*>( aItem ) );
3330 break;
3331
3332 case PCB_POINT_T:
3333 break;
3334
3335 default:
3336 break;
3337 }
3338}
3339
3340
3342{
3343 // For now we just delegate to the base implementation which commits any pending
3344 // local history snapshots. If PCB-specific preconditions are later needed (e.g.
3345 // flushing zone fills or router state) they can be added here before calling the
3346 // base class method.
3348}
Class PCBNEW_ACTION_PLUGINS.
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:112
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition bitmap.cpp:104
@ NORMAL
Inactive layers are shown normally (no high-contrast mode)
@ HIDDEN
Inactive layers are hidden.
constexpr BOX2I BOX2ISafe(const BOX2D &aInput)
Definition box2.h:929
BOX2< VECTOR2D > BOX2D
Definition box2.h:923
static TOOL_ACTION toggleGrid
Definition actions.h:198
static TOOL_ACTION paste
Definition actions.h:80
static TOOL_ACTION unselectAll
Definition actions.h:83
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
Definition actions.h:227
static TOOL_ACTION togglePolarCoords
Definition actions.h:209
static TOOL_ACTION copy
Definition actions.h:78
static TOOL_ACTION pluginsReload
Definition actions.h:294
static TOOL_ACTION group
Definition actions.h:239
static TOOL_ACTION pasteSpecial
Definition actions.h:81
static TOOL_ACTION groupProperties
Definition actions.h:247
static TOOL_ACTION pointEditorArcKeepCenter
Definition actions.h:273
static TOOL_ACTION ungroup
Definition actions.h:240
static TOOL_ACTION toggleBoundingBoxes
Definition actions.h:157
static TOOL_ACTION pointEditorArcKeepRadius
Definition actions.h:275
static TOOL_ACTION showSearch
Definition actions.h:116
static TOOL_ACTION undo
Definition actions.h:75
static TOOL_ACTION duplicate
Definition actions.h:84
static TOOL_ACTION highContrastMode
Definition actions.h:155
static TOOL_ACTION embeddedFiles
Definition actions.h:297
static TOOL_ACTION measureTool
Definition actions.h:252
static TOOL_ACTION doDelete
Definition actions.h:85
static TOOL_ACTION selectionTool
Definition actions.h:251
static TOOL_ACTION save
Definition actions.h:58
static TOOL_ACTION zoomFitScreen
Definition actions.h:142
static TOOL_ACTION redo
Definition actions.h:76
static TOOL_ACTION deleteTool
Definition actions.h:86
static TOOL_ACTION zoomTool
Definition actions.h:146
static TOOL_ACTION showProperties
Definition actions.h:266
static TOOL_ACTION cut
Definition actions.h:77
static TOOL_ACTION gridSetOrigin
Definition actions.h:195
static TOOL_ACTION toggleGridOverrides
Definition actions.h:199
static TOOL_ACTION selectAll
Definition actions.h:82
static TOOL_ACTION pointEditorArcKeepEndpoint
Definition actions.h:274
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()
Respond to change in OS's DarkMode.
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
The array tool.
Definition array_tool.h:48
Tool responsible for automagic placement of components.
Handles how to draw a screen (a board, a schematic ...)
Definition base_screen.h:41
int GetPageCount() const
Definition base_screen.h:72
bool IsContentModified() const
Definition base_screen.h:60
const wxString & GetPageNumber() const
virtual 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,...
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
void SetLocalRatsnestVisible(bool aVisible)
Handle actions specific to the board editor in PcbNew.
Tool for pcb inspection.
Abstract interface for BOARD_ITEMs capable of storing other items inside.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:84
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition board_item.h:237
void SetLocked(bool aLocked) override
Definition board_item.h:328
bool IsLocked() const override
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Test to see if this object is on the given layer.
Definition board_item.h:319
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition board_item.h:285
VECTOR2I GetFPRelativePosition() const
@ INSTANCE_TO_INSTANCE
Definition board_item.h:447
void SetFPRelativePosition(const VECTOR2I &aPos)
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:322
void BuildListOfNets()
Definition board.h:959
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition board.cpp:1033
void RemoveAllListeners()
Remove all listeners.
Definition board.cpp:3237
const PAGE_INFO & GetPageSettings() const
Definition board.h:799
GAL_SET GetVisibleElements() const
Return a set of all the element categories that are visible.
Definition board.cpp:1027
void InitializeClearanceCache()
Initialize the clearance cache for all board items.
Definition board.cpp:1101
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:190
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
Definition board.cpp:2677
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
Definition board.cpp:200
const wxString & GetFileName() const
Definition board.h:359
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Change the visibility of an element category.
Definition board.cpp:1039
void ClearProject()
Definition board.cpp:238
bool IsEmpty() const
Definition board.cpp:597
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:2182
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition board.cpp:967
void UpdateRatsnestExclusions()
Update the visibility flags on the current unconnected ratsnest lines.
Definition board.cpp:298
void SynchronizeTuningProfileProperties()
Ensure that all time domain properties providers are in sync with current settings.
Definition board.cpp:2671
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition board.h:563
void SaveToHistory(const wxString &aProjectPath, std::vector< wxString > &aFiles)
Save board file to the .history directory.
Definition board.cpp:3689
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition box2.h:558
void SetColor(int aLayer, const COLOR4D &aColor)
COLOR4D GetColor(int aLayer) const
COMMIT & Remove(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Remove a new item from the model.
Definition commit.h:90
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
Definition commit.h:106
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Add a new item to the model.
Definition commit.h:78
Handle actions that are shared between different applications.
Handles action that are shared between different applications.
enum FP_PROPS_RETVALUE GetReturnValue()
Tool responsible for drawing graphical elements like lines, arcs, circles, etc.
MODE GetDrawingMode() const
Return the current drawing mode of the DRAWING_TOOL or MODE::NONE if not currently in any drawing mod...
void InitEngine(const wxFileName &aRulePath)
Initialize the DRC engine.
std::shared_ptr< DRC_ENGINE > GetDRCEngine()
Definition drc_tool.h:87
bool IsDRCRunning() const
Check to see if the DRC engine is running the tests.
Definition drc_tool.h:74
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 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 SetFileName(const std::string &aFileName)
Set the file name displayed in the title block.
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.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
virtual void ThemeChanged()
Process light/dark theme change.
WX_INFOBAR * m_infoBar
wxAuiManager m_auimgr
virtual bool CanAcceptApiCommands()
Check if this frame is ready to accept API commands.
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.
WX_INFOBAR * GetInfoBar()
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.
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Change the current rendering backend.
virtual void OnSize(wxSizeEvent &event) override
Recalculate the size of toolbars and display panel when the frame size changes.
virtual void OnSelectZoom(wxCommandEvent &event)
Set the zoom factor when selected by the zoom list box in the main tool bar.
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 ReCreateAuxiliaryToolbar()
virtual void ReCreateHToolbar()
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
static constexpr GAL_TYPE GAL_FALLBACK
void StopDrawing()
Prevent the GAL canvas from further drawing until it is recreated or StartDrawing() is called.
void ForceRefresh()
Force a redraw.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
KIGFX::GAL * GetGAL() const
Return a pointer to the GAL instance used in the panel.
void SetFocus() override
A set of EDA_ITEMs (i.e., without duplicates).
Definition eda_group.h:46
void RemoveItem(EDA_ITEM *aItem)
Remove item from group.
Definition eda_group.cpp:40
void AddItem(EDA_ITEM *aItem)
Add item to group.
Definition eda_group.cpp:27
virtual EDA_ITEM * AsEdaItem()=0
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:99
const KIID m_Uuid
Definition eda_item.h:522
virtual EDA_GROUP * GetParentGroup() const
Definition eda_item.h:117
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:111
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition eda_item.h:150
virtual void SetParent(EDA_ITEM *aParent)
Definition eda_item.cpp:93
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:80
const EDA_ANGLE & GetTextAngle() const
Definition eda_text.h:147
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition eda_text.h:98
virtual bool IsVisible() const
Definition eda_text.h:187
void SetAttributes(const EDA_TEXT &aSrc, bool aSetPosition=true)
Set the text attributes from another instance.
Definition eda_text.cpp:447
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition eda_text.h:200
virtual void SetVisible(bool aVisible)
Definition eda_text.cpp:400
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition eda_text.h:203
virtual void SetText(const wxString &aText)
Definition eda_text.cpp:284
int GetTextThickness() const
Definition eda_text.h:128
VECTOR2I GetTextSize() const
Definition eda_text.h:261
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 ScriptingConsoleVisible()
Create a functor testing if the python scripting console window is visible.
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:56
ENUM_MAP & Map(T aValue, const wxString &aName)
Definition property.h:727
static ENUM_MAP< T > & Instance()
Definition property.h:721
ENUM_MAP & Undefined(T aValue)
Definition property.h:734
wxPGChoices & Choices()
Definition property.h:770
void LoadFootprintFromLibrary(LIB_ID aFPID)
bool LoadFootprintFromBoard(FOOTPRINT *aFootprint)
Load a footprint from the main board into the Footprint Editor.
Component library viewer main window.
bool AllowSolderMaskBridges() const
Definition footprint.h:423
ZONE_CONNECTION GetLocalZoneConnection() const
Definition footprint.h:399
void SetLocked(bool isLocked) override
Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition footprint.h:554
EDA_ANGLE GetOrientation() const
Definition footprint.h:330
ZONES & Zones()
Definition footprint.h:312
PCB_POINTS & Points()
Definition footprint.h:318
void SetOrientation(const EDA_ANGLE &aNewAngle)
void SetAllowSolderMaskBridges(bool aAllow)
Definition footprint.h:424
void SetLocalSolderPasteMarginRatio(std::optional< double > aRatio)
Definition footprint.h:396
wxString GetSheetname() const
Definition footprint.h:377
void SetPath(const KIID_PATH &aPath)
Definition footprint.h:375
void SetFilters(const wxString &aFilters)
Definition footprint.h:384
void SetStaticComponentClass(const COMPONENT_CLASS *aClass) const
Sets the component class object pointer for this footprint.
bool FootprintNeedsUpdate(const FOOTPRINT *aLibFP, int aCompareFlags=0, REPORTER *aReporter=nullptr)
Return true if a board footprint differs from the library version.
void SetAttributes(int aAttributes)
Definition footprint.h:418
void SetSheetfile(const wxString &aSheetfile)
Definition footprint.h:381
std::optional< int > GetLocalSolderPasteMargin() const
Definition footprint.h:392
PCB_FIELD & Value()
read/write accessors:
Definition footprint.h:787
std::optional< int > GetLocalClearance() const
Definition footprint.h:386
std::deque< PAD * > & Pads()
Definition footprint.h:306
int GetAttributes() const
Definition footprint.h:417
const COMPONENT_CLASS * GetComponentClass() const
Returns the component class for this footprint.
void SetLocalZoneConnection(ZONE_CONNECTION aType)
Definition footprint.h:398
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition footprint.h:339
wxString GetSheetfile() const
Definition footprint.h:380
const LIB_ID & GetFPID() const
Definition footprint.h:351
bool IsLocked() const override
Definition footprint.h:544
PCB_FIELD & Reference()
Definition footprint.h:788
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
std::optional< double > GetLocalSolderPasteMarginRatio() const
Definition footprint.h:395
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
GROUPS & Groups()
Definition footprint.h:315
wxString GetFilters() const
Definition footprint.h:383
void SetSheetname(const wxString &aSheetname)
Definition footprint.h:378
void GetFields(std::vector< PCB_FIELD * > &aVector, bool aVisibleOnly) const
Populate a std::vector with PCB_TEXTs.
std::vector< FP_3DMODEL > & Models()
Definition footprint.h:323
const wxString & GetValue() const
Definition footprint.h:773
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
Definition footprint.h:390
void SetLocalClearance(std::optional< int > aClearance)
Definition footprint.h:387
const KIID_PATH & GetPath() const
Definition footprint.h:374
std::optional< int > GetLocalSolderMaskMargin() const
Definition footprint.h:389
void SetLocalSolderPasteMargin(std::optional< int > aMargin)
Definition footprint.h:393
VECTOR2I GetPosition() const override
Definition footprint.h:327
DRAWINGS & GraphicalItems()
Definition footprint.h:309
void ReadWindowSettings(WINDOW_SETTINGS &aCfg)
Read GAL config options from application-level config.
bool Contains(GAL_LAYER_ID aPos)
Definition layer_ids.h:437
Handle actions specific to filling copper zones.
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?
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:95
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:105
void SetGridColor(const COLOR4D &aGridColor)
Set the grid color.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
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:91
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
const std::set< int > & GetHighlightNetCodes() const
Return the netcode of currently highlighted net.
An abstract base class for deriving all objects that can be added to a VIEW.
Definition view_item.h:86
bool IsBOARD_ITEM() const
Definition view_item.h:102
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:67
double GetScale() const
Definition view.h:277
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
Definition view.cpp:535
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:1700
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
Definition view.h:401
bool IsMirroredX() const
Return true if view is flipped across the X axis.
Definition view.h:251
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition view.cpp:1576
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition view.h:221
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition view.h:640
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:1586
An implementation of class VIEW_CONTROLS for wxWidgets library.
std::unique_ptr< PROF_COUNTER > m_MotionEventCounter
Definition kiid.h:49
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)
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:295
void OnKiCadExit()
Definition kiway.cpp:760
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:505
LOCAL_HISTORY & LocalHistory()
Return the LOCAL_HISTORY associated with this KIWAY.
Definition kiway.h:407
virtual void CommonSettingsChanged(int aFlags=0)
Call CommonSettingsChanged() on all KIWAY_PLAYERs.
Definition kiway.cpp:599
PCB_LAYER_ID GetLayerA() const
PCB_LAYER_ID GetLayerB() const
const UTF8 & GetLibItemName() const
Definition lib_id.h:102
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...
bool Init(const wxString &aProjectPath)
Initialize the local history repository for the given project path.
void NoteFileChange(const wxString &aFile)
Record that a file has been modified and should be included in the next snapshot.
void UnregisterSaver(const void *aSaverObject)
Unregister a previously registered saver callback.
void RegisterSaver(const void *aSaverObject, const std::function< void(const wxString &, std::vector< wxString > &)> &aSaver)
Register a saver callback invoked during autosave history commits.
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:313
static const LSET & AllLayersMask()
Definition lset.cpp:641
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
Definition lset.cpp:188
@ MARKER_DRAWING_SHEET
Definition marker_base.h:56
Tool responsible for adding microwave features to PCBs.
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
Definition netinfo.h:247
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
Definition pad.h:55
void SetPinType(const wxString &aType)
Set the pad electrical type.
Definition pad.h:153
const wxString & GetPinType() const
Definition pad.h:154
const wxString & GetPinFunction() const
Definition pad.h:148
bool IsOnCopperLayer() const override
Definition pad.cpp:1551
void SetPinFunction(const wxString &aName)
Set the pad function (pin name in schematic)
Definition pad.h:147
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:79
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 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 saveSelectionAsDesignBlock
static TOOL_ACTION drawCircle
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 ddAppendBoard
Drag and drop.
static TOOL_ACTION highlightNet
static TOOL_ACTION autoTrackWidth
static TOOL_ACTION drawTable
static TOOL_ACTION drawTextBox
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 angleSnapModeChanged
Notification event when angle mode changes.
static TOOL_ACTION saveBoardAsDesignBlock
static TOOL_ACTION drillOrigin
static TOOL_ACTION tuneSkew
static TOOL_ACTION trackDisplayMode
static TOOL_ACTION showNetInspector
static TOOL_ACTION microwaveCreateStubArc
static TOOL_ACTION zoneDisplayTriangulated
static TOOL_ACTION placeDesignBlock
static TOOL_ACTION selectUnconnected
Select unconnected footprints from ratsnest of selection.
Definition pcb_actions.h:88
static TOOL_ACTION zoneDisplayFractured
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 drawSimilarZone
static TOOL_ACTION showDesignBlockPanel
static TOOL_ACTION drawCenterDimension
static TOOL_ACTION selectSameSheet
Select all components on the same sheet as the selected footprint.
Definition pcb_actions.h:97
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 flipBoard
static TOOL_ACTION zoneDisplayOutline
static TOOL_ACTION ratsnestLineMode
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 unlock
static TOOL_ACTION placeFootprint
static TOOL_ACTION routeSingleTrack
Activation of the Push and Shove router.
static TOOL_ACTION createArray
Tool for creating an array of objects.
static TOOL_ACTION deselectNet
Remove all connections belonging to a single net from the active selection.
Definition pcb_actions.h:85
static TOOL_ACTION showPythonConsole
static TOOL_ACTION drawLine
static TOOL_ACTION placeLinkedDesignBlock
static TOOL_ACTION localRatsnestTool
static TOOL_ACTION drawAlignedDimension
static TOOL_ACTION drawZone
static TOOL_ACTION selectOnSchematic
Select symbols/pins on schematic corresponding to selected footprints/pads.
static TOOL_ACTION lock
Common, abstract interface for edit frames.
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
wxString GetDesignRulesPath()
Return the absolute path to the design rules file for the currently-loaded board.
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 ShowGraphicItemPropertiesDialog(PCB_SHAPE *aShape)
void ActivateGalCanvas() override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
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.
void PlaceFootprint(FOOTPRINT *aFootprint, bool aRecreateRatsnest=true, std::optional< VECTOR2I > aPosition=std::nullopt)
Place aFootprint at the current cursor position (or provided one) and updates footprint coordinates w...
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.
Abstract dimension API.
double m_ZoneOpacity
Opacity override for filled zone areas.
HIGH_CONTRAST_MODE m_ContrastModeDisplay
How inactive layers are displayed.
void UpdateColors()
Update the color settings in the painter and GAL.
void SetDrawingSheet(DS_PROXY_VIEW_ITEM *aDrawingSheet)
Sets (or updates) drawing-sheet used by the draw panel.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void SyncLayersVisibility(const BOARD *aBoard)
Update "visibility" property of each layer of a given BOARD.
virtual void SetHighContrastLayer(int aLayer) override
SetHighContrastLayer(), with some extra smarts for PCB.
void RedrawRatsnest()
Return the bounding box of the view that should be used if model is not valid.
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
void OnEditItemRequest(BOARD_ITEM *aItem) override
Install the corresponding dialog editor for the given item.
Definition edit.cpp:99
void SetLastPath(LAST_PATH_TYPE aType, const wxString &aLastPath)
Set the path of the last file successfully read.
int m_crossProbeFlashPhase
Phase counter.
void FindNext(bool reverse=false)
Find the next item using our existing search parameters.
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 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:72
wxTimer m_crossProbeFlashTimer
Timer to toggle selection visibility for flash.
void StartCrossProbeFlash(const std::vector< BOARD_ITEM * > &aItems)
void OnCrossProbeFlashTimer(wxTimerEvent &aEvent)
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
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 CommonSettingsChanged(int aFlags) override
Called after the preferences dialog is run.
BOARD_ITEM_CONTAINER * GetModel() const override
DIALOG_BOOK_REPORTER * GetInspectDrcErrorDialog()
void ShowTargetOptionsDialog(PCB_TARGET *aTarget)
void ShowBoardSetupDialog(const wxString &aInitialPage=wxEmptyString, wxWindow *aParent=nullptr)
DIALOG_FIND * m_findDialog
DIALOG_BOOK_REPORTER * m_inspectConstraintsDlg
void SetPageSettings(const PAGE_INFO &aPageSettings) override
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.
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
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.
void PythonSyncProjectName()
Synchronize the project name from KiCad's environment into the Python interpreter.
void PrepareLayerIndicator(bool aForceRebuild=false)
void ShowFindDialog()
Show the Find dialog.
void onSize(wxSizeEvent &aEvent)
int ShowExchangeFootprintsDialog(FOOTPRINT *aFootprint, bool aUpdateMode, bool aSelectedMode)
int TestStandalone()
Test if standalone mode.
void ShowFootprintPropertiesDialog(FOOTPRINT *aFootprint)
bool IsContentModified() const override
Get if the current board has been modified but not saved.
void PythonSyncEnvironmentVariables()
Synchronize the environment variables from KiCad's environment into the Python interpreter.
bool Clear_Pcb(bool doAskAboutUnsavedChanges, bool aFinal=false)
Delete all and reinitialize the current board.
Definition initpcb.cpp:42
bool m_crossProbeFlashing
Currently flashing guard.
TOOL_ACTION * m_exportNetlistAction
The export board netlist tool action object.
void OnBoardLoaded()
Update the state of the GUI after a new board is loaded or created.
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.
DIALOG_BOOK_REPORTER * GetFootprintDiffDialog()
EDA_ANGLE GetRotationAngle() const override
Return the angle used for rotate operations.
COLOR4D GetGridColor() override
std::vector< KIID > m_crossProbeFlashItems
Items to flash (by UUID)
void UpdateTitle()
Set the main window title bar text.
void ExchangeFootprint(FOOTPRINT *aExisting, FOOTPRINT *aNew, BOARD_COMMIT &aCommit, bool deleteExtraTexts=true, bool resetTextLayers=true, bool resetTextEffects=true, bool resetTextPositions=true, bool resetTextContent=true, bool resetFabricationAttrs=true, bool resetClearanceOverrides=true, bool reset3DModels=true, bool *aUpdated=nullptr)
Replace aExisting footprint by aNew footprint using the Existing footprint settings (position,...
DIALOG_BOOK_REPORTER * m_footprintDiffDlg
void ActivateGalCanvas() override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
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 onCloseModelessBookReporterDialogs(wxCommandEvent &aEvent)
PCB_DESIGN_BLOCK_PANE * m_designBlocksPane
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
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_BOOK_REPORTER * m_inspectClearanceDlg
void OnFileHistory(wxCommandEvent &event)
DIALOG_BOOK_REPORTER * GetInspectConstraintsDialog()
A set of BOARD_ITEMs (i.e., without duplicates).
Definition pcb_group.h:53
PCB net inspection panel.
Generic tool for picking an item.
Tool that displays edit points allowing to modify items by dragging the points.
A PCB_POINT is a 0-dimensional point that is used to mark a position on a PCB, or more usually a foot...
Definition pcb_point.h:43
PCB_LAYER_ID m_Route_Layer_TOP
Definition pcb_screen.h:43
PCB_LAYER_ID m_Route_Layer_BOTTOM
Definition pcb_screen.h:44
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)
void FindItem(BOARD_ITEM *aItem)
Take necessary actions to mark an item as found.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition pcb_text.cpp:483
Tool useful for viewing footprints.
virtual ENV_VAR_MAP & GetLocalEnvVariables() const
Definition pgm_base.cpp:787
virtual const wxString & GetExecutablePath() const
Definition pgm_base.cpp:867
The interactive edit tool.
void Show(std::ostream &aStream=std::cerr)
Definition profile.h:277
void Reset()
Definition profile.h:267
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.
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition project.cpp:177
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
Definition project.h:209
void IncrementNetclassesTicker()
Definition project.h:117
virtual PROJECT_FILE & GetProjectFile() const
Definition project.h:203
void IncrementTextVarsTicker()
Definition project.h:114
Action handler for the Properties panel.
PNS::PNS_MODE GetRouterMode()
bool RoutingInProgress()
Returns whether routing is currently active.
Tool relating to pads and pad settings.
static SELECTION_CONDITION HasTypes(std::vector< KICAD_T > aTypes)
Create a functor that tests if among the selected items there is at least one of a given types.
static 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:177
int Size() const
Returns the number of selected parts.
Definition selection.h:121
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition richio.h:226
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:66
@ MODEL_RELOAD
Model changes (the sheet for a schematic)
Definition tool_base.h:80
Generic, UI-independent tool event.
Definition tool_event.h:171
void SetHasPosition(bool aHasPosition)
Definition tool_event.h:261
Master controller class:
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).
wxString wx_str() const
Definition utf8.cpp:45
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()
Handle a list of polygons defining a copper zone.
Definition zone.h:73
A type-safe container of any type.
Definition ki_any.h:93
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:131
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:202
int GetLastUnsavedChangesResponse()
Return the result code from the last call to HandleUnsavedChanges(): wxID_YES, wxID_NO or wxID_CANCEL...
Definition confirm.cpp:144
This file is part of the common library.
#define CHECK(x)
#define ENABLE(x)
#define DIALOG_DRC_WINDOW_NAME
Definition dialog_drc.h:41
#define DIALOG_DRC_RULE_EDITOR_WINDOW_NAME
#define _(s)
Declaration of the eda_3d_viewer class.
static constexpr EDA_ANGLE ANGLE_90
Definition eda_angle.h:413
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define PCB_EDIT_FRAME_NAME
@ NO_RECURSE
Definition eda_item.h:53
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)
@ FRAME_PCB_EDITOR
Definition frame_type.h:42
@ FRAME_FOOTPRINT_VIEWER
Definition frame_type.h:45
@ FRAME_SCH
Definition frame_type.h:34
@ FRAME_FOOTPRINT_CHOOSER
Definition frame_type.h:44
@ FRAME_FOOTPRINT_EDITOR
Definition frame_type.h:43
a few functions useful in geometry calculations.
static const std::string LegacySchematicFileExtension
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:27
@ ID_ON_GRID_SELECT
Definition id.h:113
@ ID_FILE_LIST_CLEAR
Definition id.h:62
@ 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:60
@ ID_FILE1
Definition id.h:59
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
PROJECT & Prj()
Definition kicad.cpp:642
int GetNetnameLayer(int aLayer)
Return a netname layer corresponding to the given layer.
Definition layer_ids.h:854
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
Definition layer_ids.h:677
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
Definition layer_ids.h:228
@ LAYER_GRID
Definition layer_ids.h:254
@ LAYER_ZONES
Control for copper zone opacity/visibility (color ignored).
Definition layer_ids.h:295
@ LAYER_RATSNEST
Definition layer_ids.h:253
#define CLEARANCE_LAYER_FOR(boardLayer)
Definition layer_ids.h:371
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:60
@ F_Paste
Definition layer_ids.h:104
@ B_Mask
Definition layer_ids.h:98
@ B_Cu
Definition layer_ids.h:65
@ F_Mask
Definition layer_ids.h:97
@ B_Paste
Definition layer_ids.h:105
@ UNDEFINED_LAYER
Definition layer_ids.h:61
@ F_Cu
Definition layer_ids.h:64
@ MAIL_SCH_GET_NETLIST
Definition mail_type.h:49
@ REPAINT
Item needs to be redrawn.
Definition view_item.h:58
@ GEOMETRY
Position or shape has changed.
Definition view_item.h:55
@ ALL
All except INITIAL_ADD.
Definition view_item.h:59
@ TARGET_NONCACHED
Auxiliary rendering target (noncached)
Definition definitions.h:38
void SetShutdownBlockReason(wxWindow *aWindow, const wxString &aReason)
Sets the block reason why the window/application is preventing OS shutdown.
Definition unix/app.cpp:90
bool SupportsShutdownBlockReason()
Whether or not the window supports setting a shutdown block reason.
Definition unix/app.cpp:79
@ RM_MarkObstacles
Ignore collisions, mark obstacles.
@ RM_Walkaround
Only walk around.
@ RM_Shove
Only shove.
#define _HKI(x)
Definition page_info.cpp:44
BARCODE class definition.
static void processTextItem(const PCB_TEXT &aSrc, PCB_TEXT &aDest, bool aResetText, bool aResetTextLayers, bool aResetTextEffects, bool aResetTextPositions, bool *aUpdated)
copy text settings from aSrc to aDest
static std::vector< std::pair< T *, T * > > matchItemsBySimilarity(const std::vector< T * > &aExisting, const std::vector< T * > &aNew)
#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
@ MICROVIA
Definition pcb_track.h:71
@ ID_POPUP_PCB_SELECT_WIDTH_START_RANGE
Definition pcbnew_id.h:20
@ ID_POPUP_PCB_SELECT_WIDTH1
Definition pcbnew_id.h:24
@ ID_POPUP_PCB_SELECT_VIASIZE8
Definition pcbnew_id.h:47
@ ID_AUX_TOOLBAR_PCB_VARIANT_SELECT
Definition pcbnew_id.h:19
@ ID_AUX_TOOLBAR_PCB_VIA_SIZE
Definition pcbnew_id.h:17
@ ID_POPUP_PCB_SELECT_WIDTH_END_RANGE
Definition pcbnew_id.h:77
@ ID_POPUP_PCB_SELECT_VIASIZE1
Definition pcbnew_id.h:40
@ ID_AUX_TOOLBAR_PCB_TRACK_WIDTH
Definition pcbnew_id.h:18
void ScriptingOnDestructPcbEditFrame(PCB_EDIT_FRAME *aPcbEditFrame)
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
@ SHOW_WITH_VIA_ALWAYS
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE
#define PROJECT_VAR_NAME
A variable name whose value holds the current project directory.
Definition project.h:41
LAST_PATH_TYPE
For storing PcbNew MRU paths of various types.
@ RPT_SEVERITY_EXCLUSION
#define SKIP_SET_DIRTY
Definition sch_commit.h:42
#define SKIP_UNDO
Definition sch_commit.h:40
#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)
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:37
bool Intersects(const BOX2I_MINMAX &aOther) const
Definition box2_minmax.h:73
A filename or source description, a problem input line, a line number, a byte offset,...
TRACK_CLEARANCE_MODE m_TrackClearance
@ AS_GLOBAL
Global action (toolbar/main menu event, global shortcut)
Definition tool_action.h:49
@ AS_ACTIVE
All active tools.
Definition tool_action.h:48
@ TA_MODEL_CHANGE
Model has changed (partial update).
Definition tool_event.h:121
@ TC_COMMAND
Definition tool_event.h:57
#define TEXTVARS_CHANGED
#define ENVVARS_CHANGED
wxLogTrace helper definitions.
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition typeinfo.h:88
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition typeinfo.h:106
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition typeinfo.h:103
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
Definition typeinfo.h:91
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition typeinfo.h:97
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition typeinfo.h:104
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition typeinfo.h:111
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
Definition typeinfo.h:93
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition typeinfo.h:108
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition typeinfo.h:92
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
Definition typeinfo.h:89
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
Definition typeinfo.h:90
@ PCB_MARKER_T
class PCB_MARKER, a marker used to show something
Definition typeinfo.h:99
@ PCB_BARCODE_T
class PCB_BARCODE, a barcode (graphic item)
Definition typeinfo.h:101
@ PCB_TARGET_T
class PCB_TARGET, a target (graphic item)
Definition typeinfo.h:107
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition typeinfo.h:86
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition typeinfo.h:102
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition typeinfo.h:87
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition typeinfo.h:98
@ PCB_TABLE_T
class PCB_TABLE, table of PCB_TABLECELLs
Definition typeinfo.h:94
@ PCB_POINT_T
class PCB_POINT, a 0-dimensional point
Definition typeinfo.h:113
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition typeinfo.h:96
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
Definition typeinfo.h:105
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:695
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.