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>
24#include <kiface_base.h>
25#include <kiway.h>
26#include <pgm_base.h>
27#include <pcb_edit_frame.h>
30#include <fp_lib_table.h>
31#include <bitmaps.h>
32#include <confirm.h>
33#include <lset.h>
34#include <trace_helpers.h>
35#include <pcbnew_id.h>
36#include <pcbnew_settings.h>
39#include <dialog_plot.h>
40#include <dialog_find.h>
43#include <dialog_board_setup.h>
44#include <invoke_pcb_dialog.h>
46#include <board.h>
48#include <footprint.h>
49#include <layer_pairs.h>
53#include <pcb_draw_panel_gal.h>
54#include <functional>
55#include <pcb_painter.h>
58#include <python_scripting.h>
61#include <tool/tool_manager.h>
63#include <tool/action_toolbar.h>
64#include <tool/common_control.h>
65#include <tool/common_tools.h>
66#include <tool/embed_tool.h>
68#include <tool/selection.h>
69#include <tool/zoom_tool.h>
70#include <tools/array_tool.h>
75#include <tools/edit_tool.h>
79#include <tools/drc_tool.h>
81#include <tools/convert_tool.h>
82#include <tools/drawing_tool.h>
83#include <tools/pcb_control.h>
91#include <tools/pad_tool.h>
95#include <tools/pcb_actions.h>
97#include <router/router_tool.h>
100#include <gestfich.h>
101#include <executable_names.h>
103#include <wx/socket.h>
104#include <wx/wupdlock.h>
105#include <dialog_drc.h> // for DIALOG_DRC_WINDOW_NAME definition
110#include <widgets/wx_infobar.h>
114#include <widgets/wx_aui_utils.h>
115#include <kiplatform/app.h>
116#include <core/profile.h>
117#include <math/box2_minmax.h>
121#include <toolbars_pcb_editor.h>
122
123#ifdef KICAD_IPC_API
124#include <api/api_server.h>
125#include <api/api_handler_pcb.h>
127#include <api/api_utils.h>
128#endif
129
130#include <action_plugin.h>
132#include "../scripting/python_scripting.h"
133
134#include <wx/filedlg.h>
135
136using namespace std::placeholders;
137
138
139#define INSPECT_DRC_ERROR_DIALOG_NAME wxT( "InspectDrcErrorDialog" )
140#define INSPECT_CLEARANCE_DIALOG_NAME wxT( "InspectClearanceDialog" )
141#define INSPECT_CONSTRAINTS_DIALOG_NAME wxT( "InspectConstraintsDialog" )
142#define FOOTPRINT_DIFF_DIALOG_NAME wxT( "FootprintDiffDialog" )
143
144
145BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
148
149
152
153 EVT_SIZE( PCB_EDIT_FRAME::OnSize )
154
156
157 // Menu Files:
159
163
169
172
173 EVT_MENU( wxID_EXIT, PCB_EDIT_FRAME::OnQuit )
174 EVT_MENU( wxID_CLOSE, PCB_EDIT_FRAME::OnQuit )
175
176 // menu Postprocess
178
179 // Horizontal toolbar
182
183 // Tracks and vias sizes general options
185 PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event )
186
187 // User interface update event handlers.
188 EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, PCB_EDIT_FRAME::OnUpdateSelectTrackWidth )
189 EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_VIA_SIZE, PCB_EDIT_FRAME::OnUpdateSelectViaSize )
191 PCB_EDIT_FRAME::OnUpdateSelectTrackWidth )
193 PCB_EDIT_FRAME::OnUpdateSelectViaSize )
194 // Drop files event
195 EVT_DROP_FILES( PCB_EDIT_FRAME::OnDropFiles )
196END_EVENT_TABLE()
197
198
199PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
200 PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB_EDITOR, _( "PCB Editor" ),
201 wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE,
203 m_exportNetlistAction( nullptr ),
204 m_findDialog( nullptr ),
205 m_inspectDrcErrorDlg( nullptr ),
206 m_inspectClearanceDlg( nullptr ),
207 m_inspectConstraintsDlg( nullptr ),
208 m_footprintDiffDlg( nullptr ),
209 m_boardSetupDlg( nullptr ),
210 m_designBlocksPane( nullptr ),
211 m_importProperties( nullptr ),
212 m_eventCounterTimer( nullptr )
213{
214 m_maximizeByDefault = true;
215 m_showBorderAndTitleBlock = true; // true to display sheet references
216 m_SelTrackWidthBox = nullptr;
217 m_SelViaSizeBox = nullptr;
218 m_show_layer_manager_tools = true;
219 m_supportsAutoSave = true;
220 m_probingSchToPcb = false;
221 m_show_search = false;
222 m_show_net_inspector = false;
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 = Pgm().GetSettingsManager().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 .MinSize( m_appearancePanel->GetMinSize().x, -1 )
331#ifdef __WXMAC__
332 // Best size for this pane is calculated larger than necessary on wxMac
333 .BestSize( m_appearancePanel->GetMinSize().x, -1 )
334#else
335 .BestSize( m_appearancePanel->GetBestSize().x, -1 )
336#endif
337 .FloatingSize( m_appearancePanel->GetBestSize() )
338 .CloseButton( false ) );
339
340 m_auimgr.AddPane( m_selectionFilterPanel, EDA_PANE().Name( wxS( "SelectionFilter" ) )
341 .Right().Layer( 4 ).Position( 2 )
342 .Caption( _( "Selection Filter" ) ).PaneBorder( false )
343 .MinSize( m_selectionFilterPanel->GetMinSize().x, -1 )
344 .BestSize( m_selectionFilterPanel->GetBestSize().x, -1 )
345 .FloatingSize( m_selectionFilterPanel->GetBestSize() )
346 .CloseButton( false ) );
347
348 m_auimgr.AddPane( m_designBlocksPane, EDA_PANE().Name( DesignBlocksPaneName() )
349 .Right().Layer( 5 )
350 .Caption( _( "Design Blocks" ) )
351 .CaptionVisible( true )
352 .PaneBorder( true )
353 .TopDockable( false )
354 .BottomDockable( false )
355 .CloseButton( true )
356 .MinSize( FromDIP( wxSize( 240, 60 ) ) )
357 .BestSize( FromDIP( wxSize( 300, 200 ) ) )
358 .FloatingSize( FromDIP( wxSize( 800, 600 ) ) )
359 .FloatingPosition( FromDIP( wxPoint( 50, 200 ) ) )
360 .Show( true ) );
361
362 m_auimgr.AddPane( m_propertiesPanel, EDA_PANE().Name( PropertiesPaneName() )
363 .Left().Layer( 5 )
364 .Caption( _( "Properties" ) ).PaneBorder( false )
365 .MinSize( FromDIP( wxSize( 240, 60 ) ) )
366 .BestSize( FromDIP( wxSize( 300, 200 ) ) )
367 .FloatingSize( wxSize( 300, 200 ) )
368 .CloseButton( true ) );
369
370 // Center
371 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( wxS( "DrawFrame" ) )
372 .Center() );
373
374 m_auimgr.AddPane( m_netInspectorPanel, EDA_PANE()
375 .Name( NetInspectorPanelName() )
376 .Bottom()
377 .Caption( _( "Net Inspector" ) )
378 .PaneBorder( false )
379 .MinSize( FromDIP( wxSize( 240, 60 ) ) )
380 .BestSize( FromDIP( wxSize( 300, 200 ) ) )
381 .FloatingSize( wxSize( 300, 200 ) )
382 .CloseButton( true ) );
383
384 m_auimgr.AddPane( m_searchPane, EDA_PANE().Name( SearchPaneName() )
385 .Bottom()
386 .Caption( _( "Search" ) ).PaneBorder( false )
387 .MinSize( FromDIP( wxSize ( 180, 60 ) ) )
388 .BestSize( FromDIP( wxSize ( 180, 100 ) ) )
389 .FloatingSize( FromDIP( wxSize( 480, 200 ) ) )
390 .DestroyOnClose( false )
391 .CloseButton( true ) );
392
393
394 m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
395 m_auimgr.GetPane( "SelectionFilter" ).Show( m_show_layer_manager_tools );
396 m_auimgr.GetPane( PropertiesPaneName() ).Show( GetPcbNewSettings()->m_AuiPanels.show_properties );
397 m_auimgr.GetPane( NetInspectorPanelName() ).Show( m_show_net_inspector );
398 m_auimgr.GetPane( SearchPaneName() ).Show( m_show_search );
399 m_auimgr.GetPane( DesignBlocksPaneName() ).Show( GetPcbNewSettings()->m_AuiPanels.design_blocks_show );
400
401 // The selection filter doesn't need to grow in the vertical direction when docked
402 m_auimgr.GetPane( "SelectionFilter" ).dock_proportion = 0;
403
404 FinishAUIInitialization();
405
406 if( aui_cfg.right_panel_width > 0 )
407 {
408 wxAuiPaneInfo& layersManager = m_auimgr.GetPane( wxS( "LayersManager" ) );
409 SetAuiPaneSize( m_auimgr, layersManager, aui_cfg.right_panel_width, -1 );
410
411 wxAuiPaneInfo& designBlocksPane = m_auimgr.GetPane( DesignBlocksPaneName() );
412 SetAuiPaneSize( m_auimgr, designBlocksPane, aui_cfg.design_blocks_panel_docked_width, -1 );
413 }
414
415 if( aui_cfg.properties_panel_width > 0 && m_propertiesPanel )
416 {
417 wxAuiPaneInfo& propertiesPanel = m_auimgr.GetPane( PropertiesPaneName() );
418 SetAuiPaneSize( m_auimgr, propertiesPanel, aui_cfg.properties_panel_width, -1 );
419 }
420
421 if( aui_cfg.search_panel_height > 0
422 && ( aui_cfg.search_panel_dock_direction == wxAUI_DOCK_TOP
423 || aui_cfg.search_panel_dock_direction == wxAUI_DOCK_BOTTOM ) )
424 {
425 wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
426 searchPane.Direction( aui_cfg.search_panel_dock_direction );
427 SetAuiPaneSize( m_auimgr, searchPane, -1, aui_cfg.search_panel_height );
428 }
429 else if( aui_cfg.search_panel_width > 0
430 && ( aui_cfg.search_panel_dock_direction == wxAUI_DOCK_LEFT
431 || aui_cfg.search_panel_dock_direction == wxAUI_DOCK_RIGHT ) )
432 {
433 wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
434 searchPane.Direction( aui_cfg.search_panel_dock_direction );
435 SetAuiPaneSize( m_auimgr, searchPane, aui_cfg.search_panel_width, -1 );
436 }
437
438 m_appearancePanel->SetTabIndex( aui_cfg.appearance_panel_tab );
439
440 {
441 m_layerPairSettings = std::make_unique<LAYER_PAIR_SETTINGS>();
442
443 m_layerPairSettings->Bind( PCB_LAYER_PAIR_PRESETS_CHANGED, [&]( wxCommandEvent& aEvt )
444 {
445 // Update the project file list
446 std::span<const LAYER_PAIR_INFO> newPairInfos = m_layerPairSettings->GetLayerPairs();
448 std::vector<LAYER_PAIR_INFO>{ newPairInfos.begin(), newPairInfos.end() };
449 });
450
451 m_layerPairSettings->Bind( PCB_CURRENT_LAYER_PAIR_CHANGED, [&]( wxCommandEvent& aEvt )
452 {
453 const LAYER_PAIR& layerPair = m_layerPairSettings->GetCurrentLayerPair();
454 PCB_SCREEN& screen = *GetScreen();
455
456 screen.m_Route_Layer_TOP = layerPair.GetLayerA();
457 screen.m_Route_Layer_BOTTOM = layerPair.GetLayerB();
458
459 // Update the toolbar icon
460 PrepareLayerIndicator();
461 });
462 }
463
464 GetToolManager()->PostAction( ACTIONS::zoomFitScreen );
465
466 // This is used temporarily to fix a client size issue on GTK that causes zoom to fit
467 // to calculate the wrong zoom size. See PCB_EDIT_FRAME::onSize().
468 Bind( wxEVT_SIZE, &PCB_EDIT_FRAME::onSize, this );
469
470 Bind( wxEVT_IDLE,
471 [this]( wxIdleEvent& aEvent )
472 {
473 BOX2D viewport = GetCanvas()->GetView()->GetViewport();
474
475 if( viewport != m_lastNetnamesViewport )
476 {
477 redrawNetnames();
478 m_lastNetnamesViewport = viewport;
479 }
480
481 // Do not forget to pass the Idle event to other clients:
482 aEvent.Skip();
483 } );
484
485 resolveCanvasType();
486
487 setupUnits( config() );
488
489 // Ensure the DRC engine is initialized so that constraints can be resolved even before a
490 // board is loaded or saved
491 try
492 {
493 m_toolManager->GetTool<DRC_TOOL>()->GetDRCEngine()->InitEngine( wxFileName() );
494 }
495 catch( PARSE_ERROR& )
496 {
497 }
498
499 // Ensure the Python interpreter is up to date with its environment variables
500 PythonSyncEnvironmentVariables();
501 PythonSyncProjectName();
502
503 // Sync action plugins in case they changed since the last time the frame opened
504 GetToolManager()->RunAction( ACTIONS::pluginsReload );
505
506#ifdef KICAD_IPC_API
507 m_apiHandler = std::make_unique<API_HANDLER_PCB>( this );
508 Pgm().GetApiServer().RegisterHandler( m_apiHandler.get() );
509
510 if( Kiface().IsSingle() )
511 {
512 m_apiHandlerCommon = std::make_unique<API_HANDLER_COMMON>();
513 Pgm().GetApiServer().RegisterHandler( m_apiHandlerCommon.get() );
514 }
515#endif
516
517 GetCanvas()->SwitchBackend( m_canvasType );
518 ActivateGalCanvas();
519
520 // Default shutdown reason until a file is loaded
521 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "New PCB file is unsaved" ) );
522
523 // disable Export STEP item if kicad2step does not exist
524 wxString strK2S = Pgm().GetExecutablePath();
525
526#ifdef __WXMAC__
527 if( strK2S.Find( wxT( "pcbnew.app" ) ) != wxNOT_FOUND )
528 {
529 // On macOS, we have standalone applications inside the main bundle, so we handle that here:
530 strK2S += wxT( "../../" );
531 }
532
533 strK2S += wxT( "Contents/MacOS/" );
534#endif
535
536 wxFileName appK2S( strK2S, wxT( "kicad2step" ) );
537
538#ifdef _WIN32
539 appK2S.SetExt( wxT( "exe" ) );
540#endif
541
542 // Ensure the window is on top
543 Raise();
544
545// if( !appK2S.FileExists() )
546 // GetMenuBar()->FindItem( ID_GEN_EXPORT_FILE_STEP )->Enable( false );
547
548 // AUI doesn't refresh properly on wxMac after changes in eb7dc6dd, so force it to
549#ifdef __WXMAC__
550 if( Kiface().IsSingle() )
551 {
552 CallAfter( [this]()
553 {
554 m_appearancePanel->OnBoardChanged();
555 } );
556 }
557#endif
558
559 // Register a call to update the toolbar sizes. It can't be done immediately because
560 // it seems to require some sizes calculated that aren't yet (at least on GTK).
561 CallAfter( [this]()
562 {
563 // Ensure the controls on the toolbars all are correctly sized
564 UpdateToolbarControlSizes();
565 } );
566
568 {
569 m_eventCounterTimer = new wxTimer( this );
570
571 Bind( wxEVT_TIMER,
572 [&]( wxTimerEvent& aEvent )
573 {
574 GetCanvas()->m_PaintEventCounter->Show();
575 GetCanvas()->m_PaintEventCounter->Reset();
576
578 static_cast<KIGFX::WX_VIEW_CONTROLS*>( GetCanvas()->GetViewControls() );
579 vc->m_MotionEventCounter->Show();
580 vc->m_MotionEventCounter->Reset();
581
582 },
583 m_eventCounterTimer->GetId() );
584
585 m_eventCounterTimer->Start( 1000 );
586 }
587
590 DragAcceptFiles( true );
591
592 Bind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &PCB_EDIT_FRAME::onCloseModelessBookReporterDialogs, this );
593}
594
595
597{
599
600 if( ADVANCED_CFG::GetCfg().m_ShowEventCounters )
601 {
602 // Stop the timer during destruction early to avoid potential event race conditions (that
603 // do happen on windows)
604 m_eventCounterTimer->Stop();
605 delete m_eventCounterTimer;
606 }
607
608 // Close modeless dialogs
609 wxWindow* open_dlg = wxWindow::FindWindowByName( DIALOG_DRC_WINDOW_NAME );
610
611 if( open_dlg )
612 open_dlg->Close( true );
613
614 // Shutdown all running tools
615 if( m_toolManager )
617
618 if( GetBoard() )
620
622 delete m_appearancePanel;
624 delete m_propertiesPanel;
625 delete m_netInspectorPanel;
626}
627
628
629void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard, bool aBuildConnectivity,
630 PROGRESS_REPORTER* aReporter )
631{
632 if( m_pcb )
634
635 PCB_BASE_EDIT_FRAME::SetBoard( aBoard, aReporter );
636
637 aBoard->SetProject( &Prj() );
638
639 if( aBuildConnectivity )
640 aBoard->BuildConnectivity();
641
642 // reload the drawing-sheet
643 SetPageSettings( aBoard->GetPageSettings() );
644}
645
646
648{
649 return m_pcb;
650}
651
652
653std::unique_ptr<GRID_HELPER> PCB_EDIT_FRAME::MakeGridHelper()
654{
655 return std::make_unique<PCB_GRID_HELPER>( m_toolManager, GetMagneticItemsSettings() );
656}
657
658
660{
661 /*
662 * While new items being scrolled into the view will get painted, they will only get
663 * annotated with netname instances currently within the view. Subsequent panning will not
664 * draw newly-visible netname instances because the item has already been drawn.
665 *
666 * This routine, fired on idle if the viewport has changed, looks for visible items that
667 * might have multiple netname instances and redraws them. (It does not need to handle pads
668 * and vias because they only ever have a single netname instance drawn on them.)
669 */
670 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( Kiface().KifaceSettings() );
671
672 if( !cfg || cfg->m_Display.m_NetNames < 2 )
673 return;
674
675 KIGFX::VIEW* view = GetCanvas()->GetView();
676 BOX2D viewport = view->GetViewport();
677
678 // Inflate to catch most of the track width
679 BOX2I_MINMAX clipbox( BOX2ISafe( viewport.Inflate( pcbIUScale.mmToIU( 2.0 ) ) ) );
680
681 for( PCB_TRACK* track : GetBoard()->Tracks() )
682 {
683 // Don't need to update vias
684 if( track->Type() == PCB_VIA_T )
685 continue;
686
687 // Don't update invisible tracks
688 if( !clipbox.Intersects( BOX2I_MINMAX( track->GetStart(), track->GetEnd() ) ) )
689 continue;
690
691 if( track->ViewGetLOD( GetNetnameLayer( track->GetLayer() ), view ) < view->GetScale() )
692 view->Update( track, KIGFX::REPAINT );
693 }
694}
695
696
697void PCB_EDIT_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
698{
699 PCB_BASE_FRAME::SetPageSettings( aPageSettings );
700
701 // Prepare drawing-sheet template
704 m_pcb->GetProject(),
706 &m_pcb->GetProperties() );
707
708 drawingSheet->SetSheetName( std::string( GetScreenDesc().mb_str() ) );
709 drawingSheet->SetSheetPath( std::string( GetFullScreenDesc().mb_str() ) );
710
711 // A board is not like a schematic having a main page and sub sheets.
712 // So for the drawing sheet, use only the first page option to display items
713 drawingSheet->SetIsFirstPage( true );
714
715 BASE_SCREEN* screen = GetScreen();
716
717 if( screen != nullptr )
718 {
719 drawingSheet->SetPageNumber(TO_UTF8( screen->GetPageNumber() ) );
720 drawingSheet->SetSheetCount( screen->GetPageCount() );
721 }
722
723 if( BOARD* board = GetBoard() )
724 drawingSheet->SetFileName( TO_UTF8( board->GetFileName() ) );
725
726 // PCB_DRAW_PANEL_GAL takes ownership of the drawing-sheet
727 GetCanvas()->SetDrawingSheet( drawingSheet );
728}
729
730
732{
733 return GetScreen() && GetScreen()->IsContentModified();
734}
735
736
738{
739 return m_toolManager->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
740}
741
742
744{
745 // Create the manager and dispatcher & route draw panel events to the dispatcher
748 GetCanvas()->GetViewControls(), config(), this );
749 m_actions = new PCB_ACTIONS();
751
752 // Register tools
786
787 for( TOOL_BASE* tool : m_toolManager->Tools() )
788 {
789 if( PCB_TOOL_BASE* pcbTool = dynamic_cast<PCB_TOOL_BASE*>( tool ) )
790 pcbTool->SetIsBoardEditor( true );
791 }
792
793 // Run the selection tool, it is supposed to be always active
794 m_toolManager->InvokeTool( "common.InteractiveSelection" );
795}
796
797
799{
801
803 PCB_EDITOR_CONDITIONS cond( this );
804
805 auto undoCond =
806 [ this ] (const SELECTION& aSel )
807 {
809
810 if( drawingTool && drawingTool->GetDrawingMode() != DRAWING_TOOL::MODE::NONE )
811 return true;
812
814
815 if( routerTool && routerTool->RoutingInProgress() )
816 return true;
817
818 return GetUndoCommandCount() > 0;
819 };
820
821 wxASSERT( mgr );
822
823#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
824#define CHECK( x ) ACTION_CONDITIONS().Check( x )
825// clang-format off
826
828 mgr->SetConditions( ACTIONS::undo, ENABLE( undoCond ) );
830
835 mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
836 mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCH ) ) );
837 mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
838
839 mgr->SetConditions( ACTIONS::cut, ENABLE( cond.HasItems() ) );
840 mgr->SetConditions( ACTIONS::copy, ENABLE( cond.HasItems() ) );
847
848 static const std::vector<KICAD_T> groupTypes = { PCB_GROUP_T, PCB_GENERATOR_T };
849
854
860
861 if( SCRIPTING::IsWxAvailable() )
863
864 auto enableZoneControlCondition =
865 [this] ( const SELECTION& )
866 {
869 };
870
872 ENABLE( enableZoneControlCondition )
873 .Check( cond.ZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_FILLED ) ) );
875 ENABLE( enableZoneControlCondition )
876 .Check( cond.ZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_ZONE_OUTLINE ) ) );
878 ENABLE( enableZoneControlCondition )
879 .Check( cond.ZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_FRACTURE_BORDERS ) ) );
881 ENABLE( enableZoneControlCondition )
882 .Check( cond.ZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_TRIANGULATION ) ) );
883
885
886 auto hasElements =
887 [ this ] ( const SELECTION& aSel )
888 {
889 return GetBoard() &&
890 ( !GetBoard()->IsEmpty() || !SELECTION_CONDITIONS::Idle( aSel ) );
891 };
892
893 auto constrainedDrawingModeCond =
894 [this]( const SELECTION& )
895 {
897 };
898
899 auto boardFlippedCond =
900 [this]( const SELECTION& )
901 {
902 return GetCanvas() && GetCanvas()->GetView()->IsMirroredX();
903 };
904
905 auto layerManagerCond =
906 [this] ( const SELECTION& )
907 {
908 return LayerManagerShown();
909 };
910
911 auto propertiesCond =
912 [this] ( const SELECTION& )
913 {
914 return PropertiesShown();
915 };
916
917 auto netInspectorCond =
918 [this] ( const SELECTION& )
919 {
920 return NetInspectorShown();
921 };
922
923 auto searchPaneCond =
924 [this] ( const SELECTION& )
925 {
926 return m_auimgr.GetPane( SearchPaneName() ).IsShown();
927 };
928
929 auto designBlockCond =
930 [ this ] (const SELECTION& aSel )
931 {
932 return m_auimgr.GetPane( DesignBlocksPaneName() ).IsShown();
933 };
934
935 auto highContrastCond =
936 [this] ( const SELECTION& )
937 {
938 return GetDisplayOptions().m_ContrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL;
939 };
940
941 auto globalRatsnestCond =
942 [this] (const SELECTION& )
943 {
945 };
946
947 auto curvedRatsnestCond =
948 [this] (const SELECTION& )
949 {
951 };
952
953 auto netHighlightCond =
954 [this]( const SELECTION& )
955 {
957 return !settings->GetHighlightNetCodes().empty();
958 };
959
960 auto enableNetHighlightCond =
961 [this]( const SELECTION& )
962 {
964 return tool && tool->IsNetHighlightSet();
965 };
966
967 mgr->SetConditions( PCB_ACTIONS::toggleHV45Mode, CHECK( constrainedDrawingModeCond ) );
968 mgr->SetConditions( ACTIONS::highContrastMode, CHECK( highContrastCond ) );
969 mgr->SetConditions( PCB_ACTIONS::flipBoard, CHECK( boardFlippedCond ) );
970 mgr->SetConditions( PCB_ACTIONS::showLayersManager, CHECK( layerManagerCond ) );
971 mgr->SetConditions( PCB_ACTIONS::showRatsnest, CHECK( globalRatsnestCond ) );
972 mgr->SetConditions( PCB_ACTIONS::ratsnestLineMode, CHECK( curvedRatsnestCond ) );
973 mgr->SetConditions( PCB_ACTIONS::toggleNetHighlight, CHECK( netHighlightCond )
974 .Enable( enableNetHighlightCond ) );
975 mgr->SetConditions( ACTIONS::showProperties, CHECK( propertiesCond ) );
976 mgr->SetConditions( PCB_ACTIONS::showNetInspector, CHECK( netInspectorCond ) );
977 mgr->SetConditions( PCB_ACTIONS::showSearch, CHECK( searchPaneCond ) );
978 mgr->SetConditions( PCB_ACTIONS::showDesignBlockPanel, CHECK( designBlockCond ) );
979
982
983 auto isArcKeepCenterMode =
984 [this]( const SELECTION& )
985 {
986 return GetPcbNewSettings()->m_ArcEditMode == ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS;
987 };
988
989 auto isArcKeepEndpointMode =
990 [this]( const SELECTION& )
991 {
992 return GetPcbNewSettings()->m_ArcEditMode == ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION;
993 };
994
995 mgr->SetConditions( PCB_ACTIONS::pointEditorArcKeepCenter, CHECK( isArcKeepCenterMode ) );
996 mgr->SetConditions( PCB_ACTIONS::pointEditorArcKeepEndpoint, CHECK( isArcKeepEndpointMode ) );
997
998 auto isHighlightMode =
999 [this]( const SELECTION& )
1000 {
1002 return tool && tool->GetRouterMode() == PNS::RM_MarkObstacles;
1003 };
1004
1005 auto isShoveMode =
1006 [this]( const SELECTION& )
1007 {
1009 return tool && tool->GetRouterMode() == PNS::RM_Shove;
1010 };
1011
1012 auto isWalkaroundMode =
1013 [this]( const SELECTION& )
1014 {
1016 return tool && tool->GetRouterMode() == PNS::RM_Walkaround;
1017 };
1018
1019 mgr->SetConditions( PCB_ACTIONS::routerHighlightMode, CHECK( isHighlightMode ) );
1020 mgr->SetConditions( PCB_ACTIONS::routerShoveMode, CHECK( isShoveMode ) );
1021 mgr->SetConditions( PCB_ACTIONS::routerWalkaroundMode, CHECK( isWalkaroundMode ) );
1022
1023 auto isAutoTrackWidth =
1024 [this]( const SELECTION& )
1025 {
1027 };
1028
1029 mgr->SetConditions( PCB_ACTIONS::autoTrackWidth, CHECK( isAutoTrackWidth ) );
1030
1031 auto haveNetCond =
1032 [] ( const SELECTION& aSel )
1033 {
1034 for( EDA_ITEM* item : aSel )
1035 {
1036 if( BOARD_CONNECTED_ITEM* bci = dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) )
1037 {
1038 if( bci->GetNetCode() > 0 )
1039 return true;
1040 }
1041 }
1042
1043 return false;
1044 };
1045
1046 mgr->SetConditions( PCB_ACTIONS::showNetInRatsnest, ENABLE( haveNetCond ) );
1047 mgr->SetConditions( PCB_ACTIONS::hideNetInRatsnest, ENABLE( haveNetCond ) );
1050
1051 static const std::vector<KICAD_T> trackTypes = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T };
1052 static const std::vector<KICAD_T> padOwnerTypes = { PCB_FOOTPRINT_T, PCB_PAD_T };
1053 static const std::vector<KICAD_T> footprintTypes = { PCB_FOOTPRINT_T };
1054 static const std::vector<KICAD_T> crossProbeTypes = { PCB_PAD_T, PCB_FOOTPRINT_T, PCB_GROUP_T };
1055 static const std::vector<KICAD_T> zoneTypes = { PCB_ZONE_T };
1056
1062
1063
1065 && SELECTION_CONDITIONS::OnlyTypes( zoneTypes );
1066
1068 && SELECTION_CONDITIONS::OnlyTypes( zoneTypes );
1069
1070 mgr->SetConditions( PCB_ACTIONS::zoneDuplicate, ENABLE( singleZoneCond ) );
1071 mgr->SetConditions( PCB_ACTIONS::drawZoneCutout, ENABLE( singleZoneCond ) );
1072 mgr->SetConditions( PCB_ACTIONS::drawSimilarZone, ENABLE( singleZoneCond ) );
1073 mgr->SetConditions( PCB_ACTIONS::zoneMerge, ENABLE( zoneMergeCond ) );
1074
1076
1077#define CURRENT_TOOL( action ) mgr->SetConditions( action, CHECK( cond.CurrentTool( action ) ) )
1078
1079 // These tools can be used at any time to inspect the board
1084
1085 auto isDRCIdle =
1086 [this] ( const SELECTION& )
1087 {
1089 return !( tool && tool->IsDRCRunning() );
1090 };
1091
1092#define CURRENT_EDIT_TOOL( action ) \
1093 mgr->SetConditions( action, ACTION_CONDITIONS().Check( cond.CurrentTool( action ) ) \
1094 .Enable( isDRCIdle ) )
1095
1096 // These tools edit the board, so they must be disabled during some operations
1127
1133
1134#undef CURRENT_TOOL
1135#undef CURRENT_EDIT_TOOL
1136#undef ENABLE
1137#undef CHECK
1138// clang-format on
1139}
1140
1141
1142void PCB_EDIT_FRAME::OnQuit( wxCommandEvent& event )
1143{
1144 if( event.GetId() == wxID_EXIT )
1145 Kiway().OnKiCadExit();
1146
1147 if( event.GetId() == wxID_CLOSE || Kiface().IsSingle() )
1148 Close( false );
1149}
1150
1151
1152void PCB_EDIT_FRAME::ResolveDRCExclusions( bool aCreateMarkers )
1153{
1154 BOARD_COMMIT commit( this );
1155
1156 for( PCB_MARKER* marker : GetBoard()->ResolveDRCExclusions( aCreateMarkers ) )
1157 {
1158 if( marker->GetMarkerType() == MARKER_BASE::MARKER_DRAWING_SHEET )
1159 marker->GetRCItem()->SetItems( GetCanvas()->GetDrawingSheet() );
1160
1161 commit.Add( marker );
1162 }
1163
1164 commit.Push( wxEmptyString, SKIP_UNDO | SKIP_SET_DIRTY );
1165
1166 for( PCB_MARKER* marker : GetBoard()->Markers() )
1167 {
1168 if( marker->GetSeverity() == RPT_SEVERITY_EXCLUSION )
1169 GetCanvas()->GetView()->Update( marker );
1170 }
1171
1173}
1174
1175
1176bool PCB_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
1177{
1178 // Shutdown blocks must be determined and vetoed as early as possible
1179 if( KIPLATFORM::APP::SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION
1180 && IsContentModified() )
1181 {
1182 return false;
1183 }
1184
1186
1187 if( zoneFillerTool->IsBusy() )
1188 {
1189 wxBell();
1190
1191 if( wxWindow* reporter = dynamic_cast<wxWindow*>( zoneFillerTool->GetProgressReporter() ) )
1192 reporter->ShowWithEffect( wxSHOW_EFFECT_EXPAND );
1193
1194 return false;
1195 }
1196
1197 if( Kiface().IsSingle() )
1198 {
1199 auto* fpEditor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_FOOTPRINT_EDITOR, false );
1200
1201 if( fpEditor && !fpEditor->Close() ) // Can close footprint editor?
1202 return false;
1203
1204 auto* fpViewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_FOOTPRINT_VIEWER, false );
1205
1206 if( fpViewer && !fpViewer->Close() ) // Can close footprint viewer?
1207 return false;
1208
1209 // FOOTPRINT_CHOOSER_FRAME is always modal so this shouldn't come up, but better safe than
1210 // sorry.
1211 auto* chooser = (FOOTPRINT_CHOOSER_FRAME*) Kiway().Player( FRAME_FOOTPRINT_CHOOSER, false );
1212
1213 if( chooser && !chooser->Close() ) // Can close footprint chooser?
1214 return false;
1215 }
1216 else
1217 {
1218 auto* fpEditor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_FOOTPRINT_EDITOR, false );
1219
1220 if( fpEditor && fpEditor->IsCurrentFPFromBoard() )
1221 {
1222 if( !fpEditor->CanCloseFPFromBoard( true ) )
1223 return false;
1224 }
1225 }
1226
1227 if( IsContentModified() )
1228 {
1229 wxFileName fileName = GetBoard()->GetFileName();
1230 wxString msg = _( "Save changes to '%s' before closing?" );
1231
1232 if( !HandleUnsavedChanges( this, wxString::Format( msg, fileName.GetFullName() ),
1233 [&]() -> bool
1234 {
1235 return Files_io_from_id( ID_SAVE_BOARD );
1236 } ) )
1237 {
1238 return false;
1239 }
1240 }
1241
1242 return PCB_BASE_EDIT_FRAME::canCloseWindow( aEvent );
1243}
1244
1245
1247{
1248 // On Windows 7 / 32 bits, on OpenGL mode only, Pcbnew crashes
1249 // when closing this frame if a footprint was selected, and the footprint editor called
1250 // to edit this footprint, and when closing pcbnew if this footprint is still selected
1251 // See https://bugs.launchpad.net/kicad/+bug/1655858
1252 // I think this is certainly a OpenGL event fired after frame deletion, so this workaround
1253 // avoid the crash (JPC)
1254 GetCanvas()->SetEvtHandlerEnabled( false );
1255
1257
1258#ifdef KICAD_IPC_API
1259 Pgm().GetApiServer().DeregisterHandler( m_apiHandler.get() );
1260 wxTheApp->Unbind( EDA_EVT_PLUGIN_AVAILABILITY_CHANGED,
1261 &PCB_EDIT_FRAME::onPluginAvailabilityChanged, this );
1262#endif
1263
1264 // Clean up mode-less dialogs.
1265 Unbind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &PCB_EDIT_FRAME::onCloseModelessBookReporterDialogs,
1266 this );
1267
1268 wxWindow* open_dlg = wxWindow::FindWindowByName( DIALOG_DRC_WINDOW_NAME );
1269
1270 if( open_dlg )
1271 open_dlg->Close( true );
1272
1273 if( m_findDialog )
1274 {
1275 m_findDialog->Destroy();
1276 m_findDialog = nullptr;
1277 }
1278
1280 {
1281 m_inspectDrcErrorDlg->Destroy();
1282 m_inspectDrcErrorDlg = nullptr;
1283 }
1284
1286 {
1287 m_inspectClearanceDlg->Destroy();
1288 m_inspectClearanceDlg = nullptr;
1289 }
1290
1292 {
1293 m_inspectConstraintsDlg->Destroy();
1294 m_inspectConstraintsDlg = nullptr;
1295 }
1296
1297 if( m_footprintDiffDlg )
1298 {
1299 m_footprintDiffDlg->Destroy();
1300 m_footprintDiffDlg = nullptr;
1301 }
1302
1303 // Delete the auto save file if it exists.
1304 wxFileName fn = GetBoard()->GetFileName();
1305
1306 // Auto save file name is the normal file name prefixed with 'FILEEXT::AutoSaveFilePrefix'.
1307 fn.SetName( FILEEXT::AutoSaveFilePrefix + fn.GetName() );
1308
1309 // When the auto save feature does not have write access to the board file path, it falls
1310 // back to a platform specific user temporary file path.
1311 if( !fn.IsOk() || !fn.IsDirWritable() )
1312 fn.SetPath( wxFileName::GetTempDir() );
1313
1314 wxLogTrace( traceAutoSave, wxT( "Deleting auto save file <" ) + fn.GetFullPath() + wxT( ">" ) );
1315
1316 // Remove the auto save file on a normal close of Pcbnew.
1317 if( fn.FileExists() && !wxRemoveFile( fn.GetFullPath() ) )
1318 {
1319 wxLogTrace( traceAutoSave, wxT( "The auto save file could not be removed!" ) );
1320 }
1321
1322 // Make sure local settings are persisted
1323 if( Prj().GetLocalSettings().ShouldAutoSave() )
1324 {
1327 }
1328 else
1329 {
1330 wxLogTrace( traceAutoSave, wxT( "Skipping auto-save of migrated local settings" ) );
1331 }
1332
1333 // Do not show the layer manager during closing to avoid flicker
1334 // on some platforms (Windows) that generate useless redraw of items in
1335 // the Layer Manager
1337 {
1338 m_auimgr.GetPane( wxS( "LayersManager" ) ).Show( false );
1339 m_auimgr.GetPane( wxS( "TabbedPanel" ) ).Show( false );
1340 }
1341
1342 // Unlink the old project if needed
1344
1345 // Delete board structs and undo/redo lists, to avoid crash on exit
1346 // when deleting some structs (mainly in undo/redo lists) too late
1347 Clear_Pcb( false, true );
1348
1349 // do not show the window because ScreenPcb will be deleted and we do not
1350 // want any paint event
1351 Show( false );
1352
1354}
1355
1356
1358{
1361 GetCanvas()->Refresh();
1362}
1363
1364
1365void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage )
1366{
1367 static std::mutex dialogMutex; // Local static mutex
1368
1369 std::unique_lock<std::mutex> dialogLock( dialogMutex, std::try_to_lock );
1370
1371 // One dialog at a time.
1372 if( !dialogLock.owns_lock() )
1373 {
1374 if( m_boardSetupDlg && m_boardSetupDlg->IsShown() )
1375 {
1376 m_boardSetupDlg->Raise(); // Brings the existing dialog to the front
1377 }
1378
1379 return;
1380 }
1381
1382 // Make sure everything's up-to-date
1384
1385 DIALOG_BOARD_SETUP dlg( this );
1386
1387 if( !aInitialPage.IsEmpty() )
1388 dlg.SetInitialPage( aInitialPage, wxEmptyString );
1389
1390 // Assign dlg to the m_boardSetupDlg pointer to track its status.
1391 m_boardSetupDlg = &dlg;
1392
1393 // QuasiModal required for Scintilla auto-complete
1394 if( dlg.ShowQuasiModal() == wxID_OK )
1395 {
1396 // Note: We must synchronise time domain properties before nets and classes, otherwise the updates
1397 // called by the board listener events are using stale data
1400
1401 if( !GetBoard()->SynchronizeComponentClasses( std::unordered_set<wxString>() ) )
1402 {
1405 m_infoBar->ShowMessage( _( "Could not load component class assignment rules" ),
1406 wxICON_WARNING, WX_INFOBAR::MESSAGE_TYPE::GENERIC );
1407 }
1408
1409 // We don't know if anything was modified, so err on the side of requiring a save
1410 OnModify();
1411
1413
1416
1417 PCBNEW_SETTINGS* settings = GetPcbNewSettings();
1418 static LSET maskAndPasteLayers = LSET( { F_Mask, F_Paste, B_Mask, B_Paste } );
1419
1421 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
1422 {
1423 int flags = 0;
1424
1425 if( !aItem->IsBOARD_ITEM() )
1426 return flags;
1427
1428 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aItem );
1429
1430 if( item->Type() == PCB_VIA_T || item->Type() == PCB_PAD_T )
1431 {
1432 // Note: KIGFX::REPAINT isn't enough for things that go from invisible
1433 // to visible as they won't be found in the view layer's itemset for
1434 // re-painting.
1435 if( ( GetBoard()->GetVisibleLayers() & maskAndPasteLayers ).any() )
1436 flags |= KIGFX::ALL;
1437 }
1438
1439 if( item->Type() == PCB_TRACE_T || item->Type() == PCB_ARC_T || item->Type() == PCB_VIA_T )
1440 {
1441 if( settings->m_Display.m_TrackClearance == SHOW_WITH_VIA_ALWAYS )
1442 flags |= KIGFX::REPAINT;
1443 }
1444
1445 if( item->Type() == PCB_PAD_T )
1446 {
1447 if( settings->m_Display.m_PadClearance )
1448 flags |= KIGFX::REPAINT;
1449 }
1450
1451 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem ) )
1452 {
1453 if( text->HasTextVars() )
1454 {
1455 text->ClearRenderCache();
1456 text->ClearBoundingBoxCache();
1457 flags |= KIGFX::GEOMETRY | KIGFX::REPAINT;
1458 }
1459 }
1460
1461 return flags;
1462 } );
1463
1464 GetCanvas()->Refresh();
1465
1469
1470 //this event causes the routing tool to reload its design rules information
1472 toolEvent.SetHasPosition( false );
1473 m_toolManager->ProcessEvent( toolEvent );
1474 }
1475
1476 GetCanvas()->SetFocus();
1477
1478 // Reset m_boardSetupDlg after the dialog is closed
1479 m_boardSetupDlg = nullptr;
1480}
1481
1482
1484{
1486}
1487
1488
1490{
1492
1493 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
1494 wxASSERT( cfg );
1495
1496 if( cfg )
1497 {
1501 }
1502}
1503
1504
1506{
1508
1509 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
1510 wxASSERT( cfg );
1511
1512 if( cfg )
1513 {
1514 wxAuiPaneInfo& apperancePane = m_auimgr.GetPane( AppearancePanelName() );
1515 cfg->m_AuiPanels.show_layer_manager = apperancePane.IsShown();
1516
1517 if( m_propertiesPanel )
1518 {
1519 cfg->m_AuiPanels.show_properties = m_propertiesPanel->IsShownOnScreen();
1522 }
1523
1524 // ensure m_show_search is up to date (the pane can be closed)
1525 wxAuiPaneInfo& searchPaneInfo = m_auimgr.GetPane( SearchPaneName() );
1526 m_show_search = searchPaneInfo.IsShown();
1528 cfg->m_AuiPanels.search_panel_height = m_searchPane->GetSize().y;
1529 cfg->m_AuiPanels.search_panel_width = m_searchPane->GetSize().x;
1530 cfg->m_AuiPanels.search_panel_dock_direction = searchPaneInfo.dock_direction;
1531
1533 {
1534 wxAuiPaneInfo& netInspectorhPaneInfo = m_auimgr.GetPane( NetInspectorPanelName() );
1535 m_show_net_inspector = netInspectorhPaneInfo.IsShown();
1537 }
1538
1539 if( m_appearancePanel )
1540 {
1545 }
1546
1547 wxAuiPaneInfo& designBlocksPane = m_auimgr.GetPane( DesignBlocksPaneName() );
1548 cfg->m_AuiPanels.design_blocks_show = designBlocksPane.IsShown();
1549
1550 if( designBlocksPane.IsDocked() )
1552 else
1553 {
1554 cfg->m_AuiPanels.design_blocks_panel_float_height = designBlocksPane.floating_size.y;
1555 cfg->m_AuiPanels.design_blocks_panel_float_width = designBlocksPane.floating_size.x;
1556 }
1557
1559 }
1560}
1561
1562
1564{
1565 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( config() );
1566
1567 return cfg ? cfg->m_RotationAngle : ANGLE_90;
1568}
1569
1570
1572{
1574}
1575
1576
1578{
1579
1580 GetColorSettings()->SetColor( LAYER_GRID, aColor );
1581 GetCanvas()->GetGAL()->SetGridColor( aColor );
1582}
1583
1584
1585void PCB_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer, bool aForceRedraw )
1586{
1587 const PCB_LAYER_ID oldLayer = GetActiveLayer();
1588
1589 if( oldLayer == aLayer && !aForceRedraw )
1590 return;
1591
1593
1595
1596 m_toolManager->PostAction( PCB_ACTIONS::layerChanged ); // notify other tools
1597 GetCanvas()->SetFocus(); // allow capture of hotkeys
1598 GetCanvas()->SetHighContrastLayer( aLayer );
1599
1600 /*
1601 * Only show pad, via and track clearances when a copper layer is active
1602 * and then only show the clearance layer for that copper layer. For
1603 * front/back non-copper layers, show the clearance layer for the outer
1604 * layer on that side.
1605 *
1606 * For pads/vias, this is to avoid clutter when there are pad/via layers
1607 * that vary in flash (i.e. clearance from the hole or pad edge), padstack
1608 * shape on each layer or clearances on each layer.
1609 *
1610 * For tracks, this follows the same logic as pads/vias, but in theory could
1611 * have their own set of independent clearance layers to allow track clearance
1612 * to be shown for more layers.
1613 */
1614 const auto getClearanceLayerForActive = []( PCB_LAYER_ID aActiveLayer ) -> std::optional<int>
1615 {
1616 if( IsCopperLayer( aActiveLayer ) )
1617 return CLEARANCE_LAYER_FOR( aActiveLayer );
1618
1619 return std::nullopt;
1620 };
1621
1622 if( std::optional<int> oldClearanceLayer = getClearanceLayerForActive( oldLayer ) )
1623 GetCanvas()->GetView()->SetLayerVisible( *oldClearanceLayer, false );
1624
1625 if( std::optional<int> newClearanceLayer = getClearanceLayerForActive( aLayer ) )
1626 GetCanvas()->GetView()->SetLayerVisible( *newClearanceLayer, true );
1627
1629 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
1630 {
1631 if( !aItem->IsBOARD_ITEM() )
1632 return 0;
1633
1634 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aItem );
1635
1636 // Note: KIGFX::REPAINT isn't enough for things that go from invisible to visible
1637 // as they won't be found in the view layer's itemset for re-painting.
1638 if( GetDisplayOptions().m_ContrastModeDisplay == HIGH_CONTRAST_MODE::HIDDEN )
1639 {
1640 if( item->IsOnLayer( oldLayer ) || item->IsOnLayer( aLayer ) )
1641 return KIGFX::ALL;
1642 }
1643
1644 if( item->Type() == PCB_VIA_T )
1645 {
1646 PCB_VIA* via = static_cast<PCB_VIA*>( item );
1647
1648 // Vias on a restricted layer set must be redrawn when the active layer
1649 // is changed
1650 if( via->GetViaType() == VIATYPE::BLIND_BURIED
1651 || via->GetViaType() == VIATYPE::MICROVIA )
1652 {
1653 return KIGFX::REPAINT;
1654 }
1655
1656 if( via->GetRemoveUnconnected() )
1657 return KIGFX::ALL;
1658 }
1659 else if( item->Type() == PCB_PAD_T )
1660 {
1661 PAD* pad = static_cast<PAD*>( item );
1662
1663 if( pad->GetRemoveUnconnected() )
1664 return KIGFX::ALL;
1665 }
1666
1667 return 0;
1668 } );
1669
1670 GetCanvas()->Refresh();
1671}
1672
1673
1675{
1677
1678 layerEnum.Choices().Clear();
1679 layerEnum.Undefined( UNDEFINED_LAYER );
1680
1681 for( PCB_LAYER_ID layer : LSET::AllLayersMask().Seq() )
1682 {
1683 // Canonical name
1684 layerEnum.Map( layer, LSET::Name( layer ) );
1685
1686 // User name
1687 layerEnum.Map( layer, GetBoard()->GetLayerName( layer ) );
1688 }
1689
1690 DRC_TOOL* drcTool = m_toolManager->GetTool<DRC_TOOL>();
1691
1692 try
1693 {
1694 drcTool->GetDRCEngine()->InitEngine( GetDesignRulesPath() );
1695 }
1696 catch( PARSE_ERROR& )
1697 {
1698 // Not sure this is the best place to tell the user their rules are buggy, so
1699 // we'll stay quiet for now. Feel free to revisit this decision....
1700 }
1701
1702 UpdateTitle();
1703
1704 wxFileName fn = GetBoard()->GetFileName();
1705
1706 // Display a warning that the file is read only
1707 if( fn.FileExists() && !fn.IsFileWritable() )
1708 {
1711 m_infoBar->ShowMessage( _( "Board file is read only." ),
1713 }
1714
1716
1717 // Sync layer and item visibility
1719
1720 SetElementVisibility( LAYER_RATSNEST, GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
1721
1723
1724 // Apply saved display state to the appearance panel after it has been set up
1725 PROJECT_LOCAL_SETTINGS& localSettings = Prj().GetLocalSettings();
1726
1728
1729 if( GetBoard()->GetDesignSettings().IsLayerEnabled( localSettings.m_ActiveLayer ) )
1730 SetActiveLayer( localSettings.m_ActiveLayer, true );
1731 else
1732 SetActiveLayer( GetActiveLayer(), true ); // Make sure to repaint even if not switching
1733
1734 PROJECT_FILE& projectFile = Prj().GetProjectFile();
1735
1736 m_layerPairSettings->SetLayerPairs( projectFile.m_LayerPairInfos );
1737 m_layerPairSettings->SetCurrentLayerPair( LAYER_PAIR{ F_Cu, B_Cu } );
1738
1739 // Updates any auto dimensions and the auxiliary toolbar tracks/via sizes
1741
1742 // Sync the net inspector now we have connectivity calculated
1745
1746 // Display the loaded board:
1747 Zoom_Automatique( false );
1748
1749 // Invalidate painting as loading the DRC engine will cause clearances to become valid
1751
1752 Refresh();
1753
1754 SetMsgPanel( GetBoard() );
1755 SetStatusText( wxEmptyString );
1756
1757 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "PCB file changes are unsaved" ) );
1758}
1759
1760
1762{
1764}
1765
1766
1768{
1769 return GetBoard()->IsElementVisible( aElement );
1770}
1771
1772
1774{
1775 // Force the RATSNEST visible
1776 if( aElement == LAYER_RATSNEST )
1777 GetCanvas()->GetView()->SetLayerVisible( aElement, true );
1778 else
1779 GetCanvas()->GetView()->SetLayerVisible( aElement , aNewState );
1780
1781 GetBoard()->SetElementVisibility( aElement, aNewState );
1782}
1783
1784
1786{
1787 // call my base class
1789
1790 m_auimgr.GetPane( m_appearancePanel ).Caption( _( "Appearance" ) );
1791 m_auimgr.GetPane( m_selectionFilterPanel ).Caption( _( "Selection Filter" ) );
1792 m_auimgr.GetPane( m_propertiesPanel ).Caption( _( "Properties" ) );
1793 m_auimgr.GetPane( m_netInspectorPanel ).Caption( _( "Net Inspector" ) );
1794 m_auimgr.Update();
1795
1796 UpdateTitle();
1797}
1798
1799
1801{
1803
1804 if( project.m_PcbLastPath[ aType ].IsEmpty() )
1805 return wxEmptyString;
1806
1807 wxFileName absoluteFileName = project.m_PcbLastPath[ aType ];
1808 wxFileName pcbFileName = GetBoard()->GetFileName();
1809
1810 absoluteFileName.MakeAbsolute( pcbFileName.GetPath() );
1811 return absoluteFileName.GetFullPath();
1812}
1813
1814
1815void PCB_EDIT_FRAME::SetLastPath( LAST_PATH_TYPE aType, const wxString& aLastPath )
1816{
1818
1819 wxFileName relativeFileName = aLastPath;
1820 wxFileName pcbFileName = GetBoard()->GetFileName();
1821
1822 relativeFileName.MakeRelativeTo( pcbFileName.GetPath() );
1823
1824 if( relativeFileName.GetFullPath() != project.m_PcbLastPath[ aType ] )
1825 {
1826 project.m_PcbLastPath[ aType ] = relativeFileName.GetFullPath();
1827 OnModify();
1828 }
1829}
1830
1831
1833{
1835 m_ZoneFillsDirty = true;
1836
1837 if( m_isClosing )
1838 return;
1839
1840 Update3DView( true, GetPcbNewSettings()->m_Display.m_Live3DRefresh );
1841
1842 if( !GetTitle().StartsWith( wxT( "*" ) ) )
1843 UpdateTitle();
1844
1845}
1846
1847
1849{
1850 Update3DView( true, true );
1851
1852 std::shared_ptr<CONNECTIVITY_DATA> connectivity = GetBoard()->GetConnectivity();
1853 connectivity->RecalculateRatsnest( nullptr );
1855
1856 std::vector<MSG_PANEL_ITEM> msg_list;
1857 GetBoard()->GetMsgPanelInfo( this, msg_list );
1858 SetMsgPanel( msg_list );
1859}
1860
1861
1863{
1864 wxFileName fn = GetBoard()->GetFileName();
1865 bool readOnly = false;
1866 bool unsaved = false;
1867
1868 if( fn.IsOk() && fn.FileExists() )
1869 readOnly = !fn.IsFileWritable();
1870 else
1871 unsaved = true;
1872
1873 wxString title;
1874
1875 if( IsContentModified() )
1876 title = wxT( "*" );
1877
1878 title += fn.GetName();
1879
1880 if( readOnly )
1881 title += wxS( " " ) + _( "[Read Only]" );
1882
1883 if( unsaved )
1884 title += wxS( " " ) + _( "[Unsaved]" );
1885
1886 title += wxT( " \u2014 " ) + _( "PCB Editor" );
1887
1888 SetTitle( title );
1889}
1890
1891
1893{
1894 // Update the layer manager and other widgets from the board setup
1895 // (layer and items visibility, colors ...)
1896
1897 // Rebuild list of nets (full ratsnest rebuild)
1899
1900 // Update info shown by the horizontal toolbars
1902
1903 LSET activeLayers = GetBoard()->GetEnabledLayers();
1904
1905 if( !activeLayers.test( GetActiveLayer() ) )
1906 SetActiveLayer( activeLayers.Seq().front() );
1907
1909
1911
1912 layerEnum.Choices().Clear();
1913 layerEnum.Undefined( UNDEFINED_LAYER );
1914
1915 for( PCB_LAYER_ID layer : LSET::AllLayersMask().Seq() )
1916 {
1917 // Canonical name
1918 layerEnum.Map( layer, LSET::Name( layer ) );
1919
1920 // User name
1921 layerEnum.Map( layer, GetBoard()->GetLayerName( layer ) );
1922 }
1923
1924 // Sync visibility with canvas
1925 for( PCB_LAYER_ID layer : LSET::AllLayersMask().Seq() )
1926 GetCanvas()->GetView()->SetLayerVisible( layer, GetBoard()->IsLayerVisible( layer ) );
1927
1928 // Stackup and/or color theme may have changed
1931}
1932
1933
1935{
1936 // switches currently used canvas (Cairo / OpenGL).
1937 PCB_BASE_FRAME::SwitchCanvas( aCanvasType );
1938}
1939
1940
1942{
1943 if( !m_findDialog )
1944 {
1945 m_findDialog = new DIALOG_FIND( this );
1948 }
1949
1950 wxString findString;
1951
1952 PCB_SELECTION& selection = m_toolManager->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1953
1954 if( selection.Size() == 1 )
1955 {
1956 EDA_ITEM* front = selection.Front();
1957
1958 switch( front->Type() )
1959 {
1960 case PCB_FOOTPRINT_T:
1961 findString = UnescapeString( static_cast<FOOTPRINT*>( front )->GetValue() );
1962 break;
1963
1964 case PCB_FIELD_T:
1965 case PCB_TEXT_T:
1966 findString = UnescapeString( static_cast<PCB_TEXT*>( front )->GetText() );
1967
1968 if( findString.Contains( wxT( "\n" ) ) )
1969 findString = findString.Before( '\n' );
1970
1971 break;
1972
1973 default:
1974 break;
1975 }
1976 }
1977
1978 m_findDialog->Preload( findString );
1979
1980 m_findDialog->Show( true );
1981}
1982
1983
1984void PCB_EDIT_FRAME::FindNext( bool reverse )
1985{
1986 if( !m_findDialog )
1988
1989 m_findDialog->FindNext( reverse );
1990}
1991
1992
1994{
1995 PCB_PLOT_PARAMS plotSettings = GetPlotSettings();
1996
1997 switch( aID )
1998 {
1999 case ID_GEN_PLOT_GERBER:
2000 plotSettings.SetFormat( PLOT_FORMAT::GERBER );
2001 break;
2002 case ID_GEN_PLOT_DXF:
2003 plotSettings.SetFormat( PLOT_FORMAT::DXF );
2004 break;
2005 case ID_GEN_PLOT_HPGL:
2006 plotSettings.SetFormat( PLOT_FORMAT::HPGL );
2007 break;
2008 case ID_GEN_PLOT_PDF:
2009 plotSettings.SetFormat( PLOT_FORMAT::PDF );
2010 break;
2011 case ID_GEN_PLOT_PS:
2012 plotSettings.SetFormat( PLOT_FORMAT::POST );
2013 break;
2014 case ID_GEN_PLOT_SVG:
2015 plotSettings.SetFormat( PLOT_FORMAT::SVG );
2016 break;
2017 case ID_GEN_PLOT:
2018 /* keep the previous setup */
2019 break;
2020 default:
2021 wxFAIL_MSG( wxT( "ToPlotter(): unexpected plot type" ) ); break;
2022 break;
2023 }
2024
2025 SetPlotSettings( plotSettings );
2026
2027 DIALOG_PLOT dlg( this );
2028 dlg.ShowQuasiModal( );
2029}
2030
2031
2033{
2034 if( Kiface().IsSingle() )
2035 return 0;
2036
2037 // Update PCB requires a netlist. Therefore the schematic editor must be running
2038 // If this is not the case, open the schematic editor
2039 KIWAY_PLAYER* frame = Kiway().Player( FRAME_SCH, true );
2040
2041 // If Kiway() cannot create the eeschema frame, it shows a error message, and
2042 // frame is null
2043 if( !frame )
2044 return -1;
2045
2046 if( !frame->IsShownOnScreen() )
2047 {
2048 wxEventBlocker blocker( this );
2049 wxFileName fn( Prj().GetProjectPath(), Prj().GetProjectName(),
2051
2052 // Maybe the file hasn't been converted to the new s-expression file format so
2053 // see if the legacy schematic file is still in play.
2054 if( !fn.FileExists() )
2055 {
2057
2058 if( !fn.FileExists() )
2059 {
2060 DisplayErrorMessage( this, _( "The schematic for this board cannot be found." ) );
2061 return -2;
2062 }
2063 }
2064
2065 frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
2066
2067 // we show the schematic editor frame, because do not show is seen as
2068 // a not yet opened schematic by Kicad manager, which is not the case
2069 frame->Show( true );
2070
2071 // bring ourselves back to the front
2072 Raise();
2073 }
2074
2075 return 1; //Success!
2076}
2077
2078
2080 const wxString& aAnnotateMessage )
2081{
2082 int standalone = TestStandalone();
2083
2084 if( standalone == 0 )
2085 {
2086 DisplayErrorMessage( this, _( "Cannot update the PCB because PCB editor is opened in "
2087 "stand-alone mode. In order to create or update PCBs from "
2088 "schematics, you must launch the KiCad project manager and "
2089 "create a project." ) );
2090 return false; // Not in standalone mode
2091 }
2092
2093 if( standalone < 0 ) // Problem with Eeschema or the schematic
2094 return false;
2095
2096 Raise(); // Show
2097
2098 std::string payload( aAnnotateMessage );
2099
2100 Kiway().ExpressMail( FRAME_SCH, MAIL_SCH_GET_NETLIST, payload, this );
2101
2102 if( payload == aAnnotateMessage )
2103 {
2104 Raise();
2105 DisplayErrorMessage( this, aAnnotateMessage );
2106 return false;
2107 }
2108
2109 try
2110 {
2111 auto lineReader = new STRING_LINE_READER( payload, _( "Eeschema netlist" ) );
2112 KICAD_NETLIST_READER netlistReader( lineReader, &aNetlist );
2113 netlistReader.LoadNetlist();
2114 }
2115 catch( const IO_ERROR& e )
2116 {
2117 Raise();
2118
2119 // Do not translate extra_info strings. These are for developers
2120 wxString extra_info = e.Problem() + wxT( " : " ) + e.What() + wxT( " at " ) + e.Where();
2121
2122 DisplayErrorMessage( this, _( "Received an error while reading netlist. Please "
2123 "report this issue to the KiCad team using the menu "
2124 "Help->Report Bug."), extra_info );
2125 return false;
2126 }
2127
2128 return true;
2129}
2130
2131
2133{
2134 wxString msg;
2135 wxFileName schematic( Prj().GetProjectPath(), Prj().GetProjectName(),
2137
2138 if( !schematic.FileExists() )
2139 {
2140 wxFileName legacySchematic( Prj().GetProjectPath(), Prj().GetProjectName(),
2142
2143 if( legacySchematic.FileExists() )
2144 {
2145 schematic = legacySchematic;
2146 }
2147 else
2148 {
2149 msg.Printf( _( "Schematic file '%s' not found." ), schematic.GetFullPath() );
2150 DisplayErrorMessage( this, msg );
2151 return;
2152 }
2153 }
2154
2155 if( Kiface().IsSingle() )
2156 {
2157 ExecuteFile( EESCHEMA_EXE, schematic.GetFullPath() );
2158 }
2159 else
2160 {
2161 KIWAY_PLAYER* frame = Kiway().Player( FRAME_SCH, false );
2162
2163 // Please: note: DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers() calls
2164 // Kiway.Player( FRAME_SCH, true )
2165 // therefore, the schematic editor is sometimes running, but the schematic project
2166 // is not loaded, if the library editor was called, and the dialog field editor was used.
2167 // On Linux, it happens the first time the schematic editor is launched, if
2168 // library editor was running, and the dialog field editor was open
2169 // On Windows, it happens always after the library editor was called,
2170 // and the dialog field editor was used
2171 if( !frame )
2172 {
2173 try
2174 {
2175 frame = Kiway().Player( FRAME_SCH, true );
2176 }
2177 catch( const IO_ERROR& err )
2178 {
2179
2180 DisplayErrorMessage( this, _( "Eeschema failed to load." ) + wxS( "\n" ) + err.What() );
2181 return;
2182 }
2183 }
2184
2185 wxEventBlocker blocker( this );
2186
2187 // If Kiway() cannot create the eeschema frame, it shows a error message, and
2188 // frame is null
2189 if( !frame )
2190 return;
2191
2192 if( !frame->IsShownOnScreen() ) // the frame exists, (created by the dialog field editor)
2193 // but no project loaded.
2194 {
2195 frame->OpenProjectFiles( std::vector<wxString>( 1, schematic.GetFullPath() ) );
2196 frame->Show( true );
2197 }
2198
2199 // On Windows, Raise() does not bring the window on screen, when iconized or not shown
2200 // On Linux, Raise() brings the window on screen, but this code works fine
2201 if( frame->IsIconized() )
2202 {
2203 frame->Iconize( false );
2204
2205 // If an iconized frame was created by Pcbnew, Iconize( false ) is not enough
2206 // to show the frame at its normal size: Maximize should be called.
2207 frame->Maximize( false );
2208 }
2209
2210 frame->Raise();
2211 }
2212}
2213
2214
2216{
2217 const ENV_VAR_MAP& vars = Pgm().GetLocalEnvVariables();
2218
2219 // Set the environment variables for python scripts
2220 // note: the string will be encoded UTF8 for python env
2221 for( const std::pair<const wxString, ENV_VAR_ITEM>& var : vars )
2222 UpdatePythonEnvVar( var.first, var.second.GetValue() );
2223
2224 // Because the env vars can be modified by the python scripts (rewritten in UTF8),
2225 // regenerate them (in Unicode) for our normal environment
2226 for( const std::pair<const wxString, ENV_VAR_ITEM>& var : vars )
2227 wxSetEnv( var.first, var.second.GetValue() );
2228}
2229
2230
2232{
2233 wxString evValue;
2234 wxGetEnv( PROJECT_VAR_NAME, &evValue );
2235 UpdatePythonEnvVar( wxString( PROJECT_VAR_NAME ).ToStdString(), evValue );
2236
2237 // Because PROJECT_VAR_NAME can be modified by the python scripts (rewritten in UTF8),
2238 // regenerate it (in Unicode) for our normal environment
2239 wxSetEnv( PROJECT_VAR_NAME, evValue );
2240}
2241
2242
2244{
2245 if( aFootprint == nullptr )
2246 return;
2247
2249
2250 /*
2251 * Make sure dlg is destroyed before GetCanvas->Refresh is called
2252 * later or the refresh will try to modify its properties since
2253 * they share a GL context.
2254 */
2255 {
2256 DIALOG_FOOTPRINT_PROPERTIES dlg( this, aFootprint );
2257
2258 dlg.ShowQuasiModal();
2259 retvalue = dlg.GetReturnValue();
2260 }
2261
2262 /*
2263 * retvalue =
2264 * FP_PROPS_UPDATE_FP to show Update Footprints dialog
2265 * FP_PROPS_CHANGE_FP to show Change Footprints dialog
2266 * FP_PROPS_OK for normal edit
2267 * FP_PROPS_CANCEL if aborted
2268 * FP_PROPS_EDIT_BOARD_FP to load board footprint into Footprint Editor
2269 * FP_PROPS_EDIT_LIBRARY_FP to load library footprint into Footprint Editor
2270 */
2271
2273 {
2274 // If something edited, push a refresh request
2275 GetCanvas()->Refresh();
2276 }
2278 {
2279 if( KIWAY_PLAYER* frame = Kiway().Player( FRAME_FOOTPRINT_EDITOR, true ) )
2280 {
2281 FOOTPRINT_EDIT_FRAME* fp_editor = static_cast<FOOTPRINT_EDIT_FRAME*>( frame );
2282
2283 fp_editor->LoadFootprintFromBoard( aFootprint );
2284 fp_editor->Show( true );
2285 fp_editor->Raise(); // Iconize( false );
2286 }
2287 }
2289 {
2290 if( KIWAY_PLAYER* frame = Kiway().Player( FRAME_FOOTPRINT_EDITOR, true ) )
2291 {
2292 FOOTPRINT_EDIT_FRAME* fp_editor = static_cast<FOOTPRINT_EDIT_FRAME*>( frame );
2293
2294 fp_editor->LoadFootprintFromLibrary( aFootprint->GetFPID() );
2295 fp_editor->Show( true );
2296 fp_editor->Raise(); // Iconize( false );
2297 }
2298 }
2300 {
2301 ShowExchangeFootprintsDialog( aFootprint, true, true );
2302 }
2304 {
2305 ShowExchangeFootprintsDialog( aFootprint, false, true );
2306 }
2307}
2308
2309
2311 bool aSelectedMode )
2312{
2313 DIALOG_EXCHANGE_FOOTPRINTS dialog( this, aFootprint, aUpdateMode, aSelectedMode );
2314
2315 return dialog.ShowQuasiModal();
2316}
2317
2318
2330static void processTextItem( const PCB_TEXT& aSrc, PCB_TEXT& aDest,
2331 bool aResetText, bool aResetTextLayers, bool aResetTextEffects,
2332 bool* aUpdated )
2333{
2334 if( aResetText )
2335 *aUpdated |= aSrc.GetText() != aDest.GetText();
2336 else
2337 aDest.SetText( aSrc.GetText() );
2338
2339 if( aResetTextLayers )
2340 {
2341 *aUpdated |= aSrc.GetLayer() != aDest.GetLayer();
2342 *aUpdated |= aSrc.IsVisible() != aDest.IsVisible();
2343 }
2344 else
2345 {
2346 aDest.SetLayer( aSrc.GetLayer() );
2347 aDest.SetVisible( aSrc.IsVisible() );
2348 }
2349
2350 if( aResetTextEffects )
2351 {
2352 *aUpdated |= aSrc.GetHorizJustify() != aDest.GetHorizJustify();
2353 *aUpdated |= aSrc.GetVertJustify() != aDest.GetVertJustify();
2354 *aUpdated |= aSrc.GetTextSize() != aDest.GetTextSize();
2355 *aUpdated |= aSrc.GetTextThickness() != aDest.GetTextThickness();
2356 *aUpdated |= aSrc.GetTextAngle() != aDest.GetTextAngle();
2357 *aUpdated |= aSrc.GetFPRelativePosition() != aDest.GetFPRelativePosition();
2358 }
2359 else
2360 {
2361 // Careful: SetAttributes() will clobber the position
2362 aDest.SetAttributes( aSrc );
2364 }
2365
2366 aDest.SetLocked( aSrc.IsLocked() );
2367 const_cast<KIID&>( aDest.m_Uuid ) = aSrc.m_Uuid;
2368}
2369
2370
2371static PCB_TEXT* getMatchingTextItem( PCB_TEXT* aRefItem, FOOTPRINT* aFootprint )
2372{
2373 std::vector<PCB_TEXT*> candidates;
2374
2375 for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
2376 {
2377 PCB_TEXT* candidate = dynamic_cast<PCB_TEXT*>( item );
2378
2379 if( candidate && candidate->GetText() == aRefItem->GetText() )
2380 candidates.push_back( candidate );
2381 }
2382
2383 if( candidates.size() == 0 )
2384 return nullptr;
2385
2386 if( candidates.size() == 1 )
2387 return candidates[0];
2388
2389 // Try refining the match by layer
2390 std::vector<PCB_TEXT*> candidatesOnSameLayer;
2391
2392 for( PCB_TEXT* candidate : candidates )
2393 {
2394 if( candidate->GetLayer() == aRefItem->GetLayer() )
2395 candidatesOnSameLayer.push_back( candidate );
2396 }
2397
2398 if( candidatesOnSameLayer.size() == 1 )
2399 return candidatesOnSameLayer[0];
2400
2401 // Last ditch effort: refine by position
2402 std::vector<PCB_TEXT*> candidatesAtSamePos;
2403
2404 for( PCB_TEXT* candidate : candidatesOnSameLayer.size() ? candidatesOnSameLayer : candidates )
2405 {
2406 if( candidate->GetFPRelativePosition() == aRefItem->GetFPRelativePosition() )
2407 candidatesAtSamePos.push_back( candidate );
2408 }
2409
2410 if( candidatesAtSamePos.size() > 0 )
2411 return candidatesAtSamePos[0];
2412 else if( candidatesOnSameLayer.size() > 0 )
2413 return candidatesOnSameLayer[0];
2414 else
2415 return candidates[0];
2416}
2417
2418
2420 BOARD_COMMIT& aCommit, bool deleteExtraTexts,
2421 bool resetTextLayers, bool resetTextEffects,
2422 bool resetTextContent, bool resetFabricationAttrs,
2423 bool reset3DModels, bool* aUpdated )
2424{
2425 EDA_GROUP* parentGroup = aExisting->GetParentGroup();
2426 bool dummyBool = false;
2427
2428 if( !aUpdated )
2429 aUpdated = &dummyBool;
2430
2431 if( parentGroup )
2432 {
2433 parentGroup->RemoveItem( aExisting );
2434 parentGroup->AddItem( aNew );
2435 }
2436
2437 aNew->SetParent( GetBoard() );
2438
2439 PlaceFootprint( aNew, false );
2440
2441 // PlaceFootprint will move the footprint to the cursor position, which we don't want. Copy
2442 // the original position across.
2443 aNew->SetPosition( aExisting->GetPosition() );
2444
2445 if( aNew->GetLayer() != aExisting->GetLayer() )
2446 aNew->Flip( aNew->GetPosition(), GetPcbNewSettings()->m_FlipDirection );
2447
2448 if( aNew->GetOrientation() != aExisting->GetOrientation() )
2449 aNew->SetOrientation( aExisting->GetOrientation() );
2450
2451 aNew->SetLocked( aExisting->IsLocked() );
2452
2453 // Now transfer the net info from "old" pads to the new footprint
2454 for( PAD* newPad : aNew->Pads() )
2455 {
2456 PAD* oldPad = nullptr;
2457
2458 // Pads with no numbers can't be matched. (Then again, they're never connected to a
2459 // net either, so it's just the UUID retention that we can't perform.)
2460 if( newPad->GetNumber().IsEmpty() )
2461 {
2463 continue;
2464 }
2465
2466 // Search for a similar pad to reuse UUID and net info
2467 PAD* last_pad = nullptr;
2468
2469 while( true )
2470 {
2471 oldPad = aExisting->FindPadByNumber( newPad->GetNumber(), last_pad );
2472
2473 if( !oldPad )
2474 break;
2475
2476 if( newPad->IsOnCopperLayer() == oldPad->IsOnCopperLayer() ) // a candidate is found
2477 break;
2478
2479 last_pad = oldPad;
2480 }
2481
2482 if( oldPad )
2483 {
2484 const_cast<KIID&>( newPad->m_Uuid ) = oldPad->m_Uuid;
2485 newPad->SetLocalRatsnestVisible( oldPad->GetLocalRatsnestVisible() );
2486 newPad->SetPinFunction( oldPad->GetPinFunction() );
2487 newPad->SetPinType( oldPad->GetPinType() );
2488 }
2489
2490 if( newPad->IsOnCopperLayer() )
2491 newPad->SetNetCode( oldPad ? oldPad->GetNetCode() : NETINFO_LIST::UNCONNECTED );
2492 else
2493 newPad->SetNetCode( NETINFO_LIST::UNCONNECTED );
2494 }
2495
2496 for( BOARD_ITEM* oldItem : aExisting->GraphicalItems() )
2497 {
2498 PCB_TEXT* oldTextItem = dynamic_cast<PCB_TEXT*>( oldItem );
2499
2500 if( oldTextItem )
2501 {
2502 // Dimensions have PCB_TEXT base but are not treated like texts in the updater
2503 if( dynamic_cast<PCB_DIMENSION_BASE*>( oldTextItem ) )
2504 continue;
2505
2506 PCB_TEXT* newTextItem = getMatchingTextItem( oldTextItem, aNew );
2507
2508 if( newTextItem )
2509 {
2510 processTextItem( *oldTextItem, *newTextItem, resetTextContent, resetTextLayers,
2511 resetTextEffects, aUpdated );
2512 }
2513 else if( deleteExtraTexts )
2514 {
2515 *aUpdated = true;
2516 }
2517 else
2518 {
2519 aNew->Add( static_cast<BOARD_ITEM*>( oldTextItem->Clone() ) );
2520 }
2521 }
2522 }
2523
2524 // Copy reference. The initial text is always used, never resetted
2525 processTextItem( aExisting->Reference(), aNew->Reference(), false, resetTextLayers,
2526 resetTextEffects, aUpdated );
2527
2528 // Copy value
2529 processTextItem( aExisting->Value(), aNew->Value(),
2530 // reset value text only when it is a proxy for the footprint ID
2531 // (cf replacing value "MountingHole-2.5mm" with "MountingHole-4.0mm")
2532 aExisting->GetValue() == aExisting->GetFPID().GetLibItemName().wx_str(),
2533 resetTextLayers, resetTextEffects, aUpdated );
2534
2535 // Copy fields in accordance with the reset* flags
2536 for( PCB_FIELD* oldField : aExisting->GetFields() )
2537 {
2538 // Reference and value are already handled
2539 if( oldField->IsReference() || oldField->IsValue() )
2540 continue;
2541
2542 PCB_FIELD* newField = aNew->GetField( oldField->GetName() );
2543
2544 if( newField )
2545 {
2546 processTextItem( *oldField, *newField, resetTextContent, resetTextLayers,
2547 resetTextEffects, aUpdated );
2548 }
2549 else if( deleteExtraTexts )
2550 {
2551 *aUpdated = true;
2552 }
2553 else
2554 {
2555 newField = new PCB_FIELD( *oldField );
2556 aNew->Add( newField );
2557 processTextItem( *oldField, *newField, true, true, true, aUpdated );
2558 }
2559 }
2560
2561 // Careful; allow-soldermask-bridges is in the m_attributes field but is not presented
2562 // as a fabrication attribute in the GUI....
2563 int existingFabAttrs = aExisting->GetAttributes() & ~FP_ALLOW_SOLDERMASK_BRIDGES;
2564 int libraryFabAttrs = aNew->GetAttributes() & ~FP_ALLOW_SOLDERMASK_BRIDGES;
2565
2566 if( resetFabricationAttrs )
2567 {
2568 // We've replaced the existing footprint with the library one, so the fabrication attrs
2569 // are already reset. Just set the aUpdated flag if appropriate.
2570 if( libraryFabAttrs != existingFabAttrs )
2571 *aUpdated = true;
2572 }
2573 else
2574 {
2575 int solderMaskBridgesFlag = aNew->GetAttributes() & FP_ALLOW_SOLDERMASK_BRIDGES;
2576 aNew->SetAttributes( existingFabAttrs | solderMaskBridgesFlag );
2577 }
2578
2579 if( reset3DModels )
2580 {
2581 // We've replaced the existing footprint with the library one, so the 3D models are
2582 // already reset. Just set the aUpdated flag if appropriate.
2583 if( aNew->Models().size() != aExisting->Models().size() )
2584 {
2585 *aUpdated = true;
2586 }
2587 else
2588 {
2589 for( size_t ii = 0; ii < aNew->Models().size(); ++ii )
2590 {
2591 if( aNew->Models()[ii] != aExisting->Models()[ii] )
2592 {
2593 *aUpdated = true;
2594 break;
2595 }
2596 }
2597 }
2598 }
2599 else
2600 {
2601 aNew->Models() = aExisting->Models(); // Linked list of 3D models.
2602 }
2603
2604 // Updating other parameters
2605 const_cast<KIID&>( aNew->m_Uuid ) = aExisting->m_Uuid;
2606 aNew->SetPath( aExisting->GetPath() );
2607 aNew->SetSheetfile( aExisting->GetSheetfile() );
2608 aNew->SetSheetname( aExisting->GetSheetname() );
2609 aNew->SetFilters( aExisting->GetFilters() );
2610 aNew->SetStaticComponentClass( aExisting->GetComponentClass() );
2611
2612 aCommit.Remove( aExisting );
2613 aCommit.Add( aNew );
2614
2615 aNew->ClearFlags();
2616}
2617
2618
2620{
2622
2624
2625 SetElementVisibility( LAYER_RATSNEST, GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
2626
2628
2629 // Netclass definitions could have changed, either by us or by Eeschema, so we need to
2630 // recompile the implicit rules
2631 DRC_TOOL* drcTool = m_toolManager->GetTool<DRC_TOOL>();
2632 WX_INFOBAR* infobar = GetInfoBar();
2633
2634 try
2635 {
2636 drcTool->GetDRCEngine()->InitEngine( GetDesignRulesPath() );
2637
2638 if( infobar->GetMessageType() == WX_INFOBAR::MESSAGE_TYPE::DRC_RULES_ERROR )
2639 infobar->Dismiss();
2640 }
2641 catch( PARSE_ERROR& )
2642 {
2643 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, _( "Edit design rules" ),
2644 wxEmptyString );
2645
2646 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
2647 [&]( wxHyperlinkEvent& aEvent )
2648 {
2649 ShowBoardSetupDialog( _( "Custom Rules" ) );
2650 } ) );
2651
2652 infobar->RemoveAllButtons();
2653 infobar->AddButton( button );
2654 infobar->AddCloseButton();
2655 infobar->ShowMessage( _( "Could not compile custom design rules." ), wxICON_ERROR,
2657 }
2658
2661
2662 // Update the environment variables in the Python interpreter
2663 if( aFlags & ENVVARS_CHANGED )
2665
2666 Layout();
2667 SendSizeEvent();
2668}
2669
2670
2672{
2674}
2675
2676
2678{
2680}
2681
2682
2684{
2685 // For now, be conservative: Don't allow any API use while the user is changing things
2686 if( GetToolManager()->GetCurrentTool() != GetToolManager()->GetTool<PCB_SELECTION_TOOL>() )
2687 return false;
2688
2690
2691 if( zoneFillerTool->IsBusy() )
2692 return false;
2693
2694 ROUTER_TOOL* routerTool = m_toolManager->GetTool<ROUTER_TOOL>();
2695
2696 if( routerTool->RoutingInProgress() )
2697 return false;
2698
2700}
2701
2702
2703bool ExportBoardToHyperlynx( BOARD* aBoard, const wxFileName& aPath );
2704
2705
2706void PCB_EDIT_FRAME::OnExportHyperlynx( wxCommandEvent& event )
2707{
2708 wxString wildcard = wxT( "*.hyp" );
2709 wxFileName fn = GetBoard()->GetFileName();
2710
2711 fn.SetExt( wxT("hyp") );
2712
2713 wxFileDialog dlg( this, _( "Export Hyperlynx Layout" ), fn.GetPath(), fn.GetFullName(),
2714 wildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
2715
2716 if( dlg.ShowModal() != wxID_OK )
2717 return;
2718
2719 fn = dlg.GetPath();
2720
2721 // always enforce filename extension, user may not have entered it.
2722 fn.SetExt( wxT( "hyp" ) );
2723
2725}
2726
2727
2729{
2730 return GetBoard()->GetFileName();
2731}
2732
2733
2735{
2736 return m_auimgr.GetPane( wxS( "LayersManager" ) ).IsShown();
2737}
2738
2739
2741{
2742 return m_auimgr.GetPane( PropertiesPaneName() ).IsShown();
2743}
2744
2745
2747{
2748 return m_auimgr.GetPane( NetInspectorPanelName() ).IsShown();
2749}
2750
2751
2752void PCB_EDIT_FRAME::onSize( wxSizeEvent& aEvent )
2753{
2754 if( IsShownOnScreen() )
2755 {
2756 // We only need this until the frame is done resizing and the final client size is
2757 // established.
2758 Unbind( wxEVT_SIZE, &PCB_EDIT_FRAME::onSize, this );
2760 }
2761
2762 // Skip() is called in the base class.
2763 EDA_DRAW_FRAME::OnSize( aEvent );
2764}
2765
2766
2768{
2771 _( "Violation Report" ) );
2772
2773 return m_inspectDrcErrorDlg;
2774}
2775
2776
2778{
2781 _( "Clearance Report" ) );
2782
2783 return m_inspectClearanceDlg;
2784}
2785
2786
2788{
2791 _( "Constraints Report" ) );
2792
2794}
2795
2796
2798{
2799 if( !m_footprintDiffDlg )
2801 _( "Compare Footprint with Library" ) );
2802
2803 return m_footprintDiffDlg;
2804}
2805
2806
2808{
2809 if( m_inspectDrcErrorDlg && aEvent.GetString() == INSPECT_DRC_ERROR_DIALOG_NAME )
2810 {
2811 m_inspectDrcErrorDlg->Destroy();
2812 m_inspectDrcErrorDlg = nullptr;
2813 }
2814 else if( m_inspectClearanceDlg && aEvent.GetString() == INSPECT_CLEARANCE_DIALOG_NAME )
2815 {
2816 m_inspectClearanceDlg->Destroy();
2817 m_inspectClearanceDlg = nullptr;
2818 }
2819 else if( m_inspectConstraintsDlg && aEvent.GetString() == INSPECT_CONSTRAINTS_DIALOG_NAME )
2820 {
2821 m_inspectConstraintsDlg->Destroy();
2822 m_inspectConstraintsDlg = nullptr;
2823 }
2824 else if( m_footprintDiffDlg && aEvent.GetString() == INSPECT_CONSTRAINTS_DIALOG_NAME )
2825 {
2826 m_footprintDiffDlg->Destroy();
2827 m_footprintDiffDlg = nullptr;
2828 }
2829}
2830
2831#ifdef KICAD_IPC_API
2832void PCB_EDIT_FRAME::onPluginAvailabilityChanged( wxCommandEvent& aEvt )
2833{
2834 wxLogTrace( traceApi, "PCB frame: EDA_EVT_PLUGIN_AVAILABILITY_CHANGED" );
2836 aEvt.Skip();
2837}
2838#endif
Class PCBNEW_ACTION_PLUGINS.
const KICOMMON_API wxEventTypeTag< wxCommandEvent > EDA_EVT_PLUGIN_AVAILABILITY_CHANGED
Notifies other parts of KiCad when plugin availability changes.
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:110
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
@ icon_pcbnew_32
@ icon_pcbnew_16
constexpr BOX2I BOX2ISafe(const BOX2D &aInput)
Definition: box2.h:929
static TOOL_ACTION toggleGrid
Definition: actions.h:198
static TOOL_ACTION paste
Definition: actions.h:80
static TOOL_ACTION millimetersUnits
Definition: actions.h:206
static TOOL_ACTION unselectAll
Definition: actions.h:83
static TOOL_ACTION togglePolarCoords
Definition: actions.h:209
static TOOL_ACTION copy
Definition: actions.h:78
static TOOL_ACTION pluginsReload
Definition: actions.h:286
static TOOL_ACTION group
Definition: actions.h:235
static TOOL_ACTION pasteSpecial
Definition: actions.h:81
static TOOL_ACTION milsUnits
Definition: actions.h:205
static TOOL_ACTION ungroup
Definition: actions.h:236
static TOOL_ACTION toggleBoundingBoxes
Definition: actions.h:154
static TOOL_ACTION showSearch
Definition: actions.h:115
static TOOL_ACTION undo
Definition: actions.h:75
static TOOL_ACTION duplicate
Definition: actions.h:84
static TOOL_ACTION inchesUnits
Definition: actions.h:204
static TOOL_ACTION highContrastMode
Definition: actions.h:152
static TOOL_ACTION embeddedFiles
Definition: actions.h:289
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:151
static TOOL_ACTION measureTool
Definition: actions.h:247
static TOOL_ACTION doDelete
Definition: actions.h:85
static TOOL_ACTION selectionTool
Definition: actions.h:246
static TOOL_ACTION save
Definition: actions.h:58
static TOOL_ACTION zoomFitScreen
Definition: actions.h:141
static TOOL_ACTION redo
Definition: actions.h:76
static TOOL_ACTION deleteTool
Definition: actions.h:86
static TOOL_ACTION zoomTool
Definition: actions.h:145
static TOOL_ACTION showProperties
Definition: actions.h:261
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
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 ApplyLayerPreset(const wxString &aPresetName)
int GetTabIndex() const
Set the current notebook tab.
void UpdateDisplayOptions()
Return a list of the layer presets created by the user.
void OnColorThemeChanged()
Respond to change in OS's DarkMode.
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:92
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
Definition: base_screen.cpp:70
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.
bool GetLocalRatsnestVisible() const
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:78
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:229
void SetLocked(bool aLocked) override
Definition: board_item.h:320
bool IsLocked() const override
Definition: board_item.cpp:76
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:280
VECTOR2I GetFPRelativePosition() const
Definition: board_item.cpp:328
void SetFPRelativePosition(const VECTOR2I &aPos)
Definition: board_item.cpp:342
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:297
void BuildListOfNets()
Definition: board.h:860
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition: board.cpp:895
void RemoveAllListeners()
Remove all listeners.
Definition: board.cpp:2720
const PAGE_INFO & GetPageSettings() const
Definition: board.h:715
GAL_SET GetVisibleElements() const
Return a set of all the element categories that are visible.
Definition: board.cpp:889
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:185
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
Definition: board.cpp:2150
void SynchronizeTimeDomainProperties()
Ensure that all time domain properties providers are in sync with current settings.
Definition: board.cpp:2144
TITLE_BLOCK & GetTitleBlock()
Definition: board.h:721
const std::map< wxString, wxString > & GetProperties() const
Definition: board.h:369
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
Definition: board.cpp:195
const wxString & GetFileName() const
Definition: board.h:334
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Change the visibility of an element category.
Definition: board.cpp:901
void ClearProject()
Definition: board.cpp:233
PROJECT * GetProject() const
Definition: board.h:511
bool IsEmpty() const
Definition: board.h:393
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:1824
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:829
void UpdateRatsnestExclusions()
Update the visibility flags on the current unconnected ratsnest lines.
Definition: board.cpp:297
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:495
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:92
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Add a new item to the model.
Definition: commit.h:80
Handle actions that are shared between different applications.
Handles action that are shared between different applications.
Definition: common_tools.h:38
void SetCallback(std::function< void(BOARD_ITEM *)> aCallback)
Function to be called on each found event.
Definition: dialog_find.h:63
bool Show(bool show=true) override
The Show method is overridden to make the search combobox focused by default.
void Preload(const wxString &aFindString)
void FindNext(bool reverse)
Finds the next item.
Definition: dialog_find.h:71
enum FP_PROPS_RETVALUE GetReturnValue()
A dialog to set the plot options and create plot files in various formats.
Definition: dialog_plot.h:41
int ShowQuasiModal()
Tool responsible for drawing graphical elements like lines, arcs, circles, etc.
Definition: drawing_tool.h:55
MODE GetDrawingMode() const
Return the current drawing mode of the DRAWING_TOOL or MODE::NONE if not currently in any drawing mod...
std::shared_ptr< DRC_ENGINE > GetDRCEngine()
Definition: drc_tool.h:78
bool IsDRCRunning() const
Check to see if the DRC engine is running the tests.
Definition: drc_tool.h:71
void 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.
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:45
virtual bool RemoveItem(EDA_ITEM *aItem)=0
Remove item from group.
virtual bool AddItem(EDA_ITEM *aItem)=0
Add item to group.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:96
const KIID m_Uuid
Definition: eda_item.h:501
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:108
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:140
EDA_GROUP * GetParentGroup() const
Definition: eda_item.h:114
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:111
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:134
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:174
void SetAttributes(const EDA_TEXT &aSrc, bool aSetPosition=true)
Set the text attributes from another instance.
Definition: eda_text.cpp:426
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:187
virtual void SetVisible(bool aVisible)
Definition: eda_text.cpp:379
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition: eda_text.h:190
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:270
int GetTextThickness() const
Definition: eda_text.h:126
VECTOR2I GetTextSize() const
Definition: eda_text.h:248
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 Units(EDA_UNITS aUnit)
Create a functor that tests if the frame has the specified units.
SELECTION_CONDITION GridVisible()
Create a functor testing if the grid is visible in a frame.
SELECTION_CONDITION PolarCoordinates()
Create a functor testing if polar coordinates are current being used.
SELECTION_CONDITION GridOverrides()
Create a functor testing if the grid overrides wires is enabled in a frame.
SELECTION_CONDITION FullscreenCursor()
Create a functor testing if the cursor is full screen in a frame.
The interactive edit tool.
Definition: edit_tool.h:56
ENUM_MAP & Map(T aValue, const wxString &aName)
Definition: property.h:687
static ENUM_MAP< T > & Instance()
Definition: property.h:681
ENUM_MAP & Undefined(T aValue)
Definition: property.h:694
wxPGChoices & Choices()
Definition: property.h:730
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.
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:2459
void SetLocked(bool isLocked) override
Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: footprint.h:426
EDA_ANGLE GetOrientation() const
Definition: footprint.h:232
void SetOrientation(const EDA_ANGLE &aNewAngle)
Definition: footprint.cpp:2541
wxString GetSheetname() const
Definition: footprint.h:271
void SetPath(const KIID_PATH &aPath)
Definition: footprint.h:269
void SetFilters(const wxString &aFilters)
Definition: footprint.h:278
void SetStaticComponentClass(const COMPONENT_CLASS *aClass) const
Sets the component class object pointer for this footprint.
Definition: footprint.cpp:4041
void SetAttributes(int aAttributes)
Definition: footprint.h:296
void SetSheetfile(const wxString &aSheetfile)
Definition: footprint.h:275
PCB_FIELD & Value()
read/write accessors:
Definition: footprint.h:657
PCB_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this footprint.
Definition: footprint.cpp:582
std::deque< PAD * > & Pads()
Definition: footprint.h:211
int GetAttributes() const
Definition: footprint.h:295
const COMPONENT_CLASS * GetComponentClass() const
Returns the component class for this footprint.
Definition: footprint.cpp:4059
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: footprint.h:241
wxString GetSheetfile() const
Definition: footprint.h:274
const LIB_ID & GetFPID() const
Definition: footprint.h:253
bool IsLocked() const override
Definition: footprint.h:416
PCB_FIELD & Reference()
Definition: footprint.h:658
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: footprint.cpp:1069
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition: footprint.cpp:2400
wxString GetFilters() const
Definition: footprint.h:277
void SetSheetname(const wxString &aSheetname)
Definition: footprint.h:272
void GetFields(std::vector< PCB_FIELD * > &aVector, bool aVisibleOnly) const
Populate a std::vector with PCB_TEXTs.
Definition: footprint.cpp:627
std::vector< FP_3DMODEL > & Models()
Definition: footprint.h:225
const wxString & GetValue() const
Definition: footprint.h:643
const KIID_PATH & GetPath() const
Definition: footprint.h:268
VECTOR2I GetPosition() const override
Definition: footprint.h:229
DRAWINGS & GraphicalItems()
Definition: footprint.h:214
PAD * FindPadByNumber(const wxString &aPadNumber, PAD *aSearchAfterMe=nullptr) const
Return a PAD with a matching number.
Definition: footprint.cpp:1955
void ReadWindowSettings(WINDOW_SETTINGS &aCfg)
Read GAL config options from application-level config.
bool Contains(GAL_LAYER_ID aPos)
Definition: layer_ids.h:426
Handle actions specific to filling copper zones.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:77
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
virtual const wxString Problem() const
what was the problem?
Definition: exceptions.cpp:46
virtual const wxString Where() const
where did the Problem() occur?
Definition: exceptions.cpp:40
Read the new s-expression based KiCad netlist format.
virtual void LoadNetlist() override
Load the contents of the netlist file into aNetlist.
APP_SETTINGS_BASE * KifaceSettings() const
Definition: kiface_base.h:95
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
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:272
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
Definition: view.cpp:520
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:1673
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
Definition: view.h:396
bool IsMirroredX() const
Return true if view is flipped across the X axis.
Definition: view.h:246
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1549
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:216
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition: view.h:635
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:1559
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.
Definition: kiway_player.h:65
virtual bool OpenProjectFiles(const std::vector< wxString > &aFileList, int aCtl=0)
Open a project or set of files given by aFileList.
Definition: kiway_player.h:113
void OnSockRequestServer(wxSocketEvent &evt)
Definition: eda_dde.cpp:99
void OnSockRequest(wxSocketEvent &evt)
Definition: eda_dde.cpp:69
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:285
void OnKiCadExit()
Definition: kiway.cpp:727
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:406
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
Definition: kiway.cpp:527
virtual void CommonSettingsChanged(int aFlags=0)
Call CommonSettingsChanged() on all KIWAY_PLAYERs.
Definition: kiway.cpp:617
int SetLayerSelection(int layer)
PCB_LAYER_ID GetLayerA() const
PCB_LAYER_ID GetLayerB() const
const UTF8 & GetLibItemName() const
Definition: lib_id.h:102
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:297
static const LSET & AllLayersMask()
Definition: lset.cpp:627
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:381
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
Definition: pcb_netlist.h:255
virtual void OnBoardChanged()
Notification from file loader when board changed and connectivity rebuilt.
virtual void SaveSettings()
Save the net inspector settings - called from EDA_EDIT_FRAME when hiding the panel.
virtual void OnParentSetupChanged()
Rebuild inspector data if project settings updated.
Tool relating to pads and pad settings.
Definition: pad_tool.h:37
Definition: pad.h:54
const wxString & GetPinType() const
Definition: pad.h:153
const wxString & GetPinFunction() const
Definition: pad.h:147
bool IsOnCopperLayer() const override
Definition: pad.cpp:1067
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:59
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 toggleHV45Mode
Definition: pcb_actions.h:522
static TOOL_ACTION drawRuleArea
Definition: pcb_actions.h:206
static TOOL_ACTION microwaveCreateGap
Definition: pcb_actions.h:511
static TOOL_ACTION drawBezier
Definition: pcb_actions.h:189
static TOOL_ACTION placeText
Definition: pcb_actions.h:191
static TOOL_ACTION pointEditorArcKeepCenter
Definition: pcb_actions.h:285
static TOOL_ACTION drawOrthogonalDimension
Definition: pcb_actions.h:202
static TOOL_ACTION drawRectangle
Definition: pcb_actions.h:186
static TOOL_ACTION padDisplayMode
Definition: pcb_actions.h:317
static TOOL_ACTION placeReferenceImage
Definition: pcb_actions.h:190
static TOOL_ACTION showRatsnest
Definition: pcb_actions.h:312
static TOOL_ACTION showLayersManager
Definition: pcb_actions.h:436
static TOOL_ACTION toggleNetHighlight
Definition: pcb_actions.h:551
static TOOL_ACTION saveSelectionAsDesignBlock
Definition: pcb_actions.h:445
static TOOL_ACTION drawCircle
Definition: pcb_actions.h:187
static TOOL_ACTION routeDiffPair
Activation of the Push and Shove router (differential pair mode)
Definition: pcb_actions.h:240
static TOOL_ACTION tuneDiffPair
Definition: pcb_actions.h:243
static TOOL_ACTION layerChanged
Definition: pcb_actions.h:370
static TOOL_ACTION ddAppendBoard
Drag and drop.
Definition: pcb_actions.h:580
static TOOL_ACTION highlightNet
Definition: pcb_actions.h:549
static TOOL_ACTION autoTrackWidth
Definition: pcb_actions.h:382
static TOOL_ACTION drawTable
Definition: pcb_actions.h:193
static TOOL_ACTION drawTextBox
Definition: pcb_actions.h:192
static TOOL_ACTION routerHighlightMode
Actions to enable switching modes via hotkey assignments.
Definition: pcb_actions.h:259
static TOOL_ACTION routerWalkaroundMode
Definition: pcb_actions.h:261
static TOOL_ACTION routerShoveMode
Definition: pcb_actions.h:260
static TOOL_ACTION drawZoneCutout
Definition: pcb_actions.h:207
static TOOL_ACTION drawPolygon
Definition: pcb_actions.h:185
static TOOL_ACTION hideNetInRatsnest
Definition: pcb_actions.h:556
static TOOL_ACTION zoneDisplayFilled
Definition: pcb_actions.h:319
static TOOL_ACTION showNetInRatsnest
Definition: pcb_actions.h:557
static TOOL_ACTION drawRadialDimension
Definition: pcb_actions.h:201
static TOOL_ACTION tuneSingleTrack
Definition: pcb_actions.h:242
static TOOL_ACTION viaDisplayMode
Definition: pcb_actions.h:318
static TOOL_ACTION drawLeader
Definition: pcb_actions.h:203
static TOOL_ACTION saveBoardAsDesignBlock
Definition: pcb_actions.h:444
static TOOL_ACTION drillOrigin
Definition: pcb_actions.h:533
static TOOL_ACTION tuneSkew
Definition: pcb_actions.h:244
static TOOL_ACTION trackDisplayMode
Definition: pcb_actions.h:316
static TOOL_ACTION showNetInspector
Definition: pcb_actions.h:437
static TOOL_ACTION microwaveCreateStubArc
Definition: pcb_actions.h:515
static TOOL_ACTION zoneDisplayTriangulated
Definition: pcb_actions.h:322
static TOOL_ACTION placeDesignBlock
Definition: pcb_actions.h:442
static TOOL_ACTION selectUnconnected
Select unconnected footprints from ratsnest of selection.
Definition: pcb_actions.h:85
static TOOL_ACTION zoneDisplayFractured
Definition: pcb_actions.h:321
static TOOL_ACTION drawVia
Definition: pcb_actions.h:205
static TOOL_ACTION drawArc
Definition: pcb_actions.h:188
static TOOL_ACTION zoneDuplicate
Duplicate zone onto another layer.
Definition: pcb_actions.h:397
static TOOL_ACTION graphicsOutlines
Display footprint graphics as outlines.
Definition: pcb_actions.h:494
static TOOL_ACTION drawSimilarZone
Definition: pcb_actions.h:208
static TOOL_ACTION pointEditorArcKeepEndpoint
Definition: pcb_actions.h:286
static TOOL_ACTION showDesignBlockPanel
Definition: pcb_actions.h:443
static TOOL_ACTION drawCenterDimension
Definition: pcb_actions.h:200
static TOOL_ACTION selectSameSheet
Select all components on the same sheet as the selected footprint.
Definition: pcb_actions.h:94
static TOOL_ACTION microwaveCreateStub
Definition: pcb_actions.h:513
static TOOL_ACTION selectNet
Select all connections belonging to a single net.
Definition: pcb_actions.h:79
static TOOL_ACTION microwaveCreateLine
Definition: pcb_actions.h:519
static TOOL_ACTION flipBoard
Definition: pcb_actions.h:372
static TOOL_ACTION zoneDisplayOutline
Definition: pcb_actions.h:320
static TOOL_ACTION ratsnestLineMode
Definition: pcb_actions.h:313
static TOOL_ACTION textOutlines
Display texts as lines.
Definition: pcb_actions.h:497
static TOOL_ACTION highlightNetSelection
Definition: pcb_actions.h:552
static TOOL_ACTION microwaveCreateFunctionShape
Definition: pcb_actions.h:517
static TOOL_ACTION zoneMerge
Definition: pcb_actions.h:394
static TOOL_ACTION unlock
Definition: pcb_actions.h:527
static TOOL_ACTION placeFootprint
Definition: pcb_actions.h:211
static TOOL_ACTION routeSingleTrack
Activation of the Push and Shove router.
Definition: pcb_actions.h:237
static TOOL_ACTION createArray
Tool for creating an array of objects.
Definition: pcb_actions.h:491
static TOOL_ACTION deselectNet
Remove all connections belonging to a single net from the active selection.
Definition: pcb_actions.h:82
static TOOL_ACTION showPythonConsole
Definition: pcb_actions.h:438
static TOOL_ACTION drawLine
Definition: pcb_actions.h:184
static TOOL_ACTION localRatsnestTool
Definition: pcb_actions.h:558
static TOOL_ACTION drawAlignedDimension
Definition: pcb_actions.h:199
static TOOL_ACTION drawZone
Definition: pcb_actions.h:204
static TOOL_ACTION selectOnSchematic
Select symbols/pins on schematic corresponding to selected footprints/pads.
Definition: pcb_actions.h:97
static TOOL_ACTION lock
Definition: pcb_actions.h:526
Common, abstract interface for edit frames.
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
wxString GetDesignRulesPath()
Return the absolute path to the design rules file for the currently-loaded board.
void doCloseWindow() override
void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
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
PANEL_SELECTION_FILTER * m_selectionFilterPanel
void ActivateGalCanvas() override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
virtual const PCB_PLOT_PARAMS & GetPlotSettings() const
Return the PCB_PLOT_PARAMS for the BOARD owned by this frame.
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
PCBNEW_SETTINGS * GetPcbNewSettings() const
virtual PCB_LAYER_ID GetActiveLayer() const
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()
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual void SetPageSettings(const PAGE_INFO &aPageSettings) override
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
BOARD * GetBoard() const
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Return the BOARD_DESIGN_SETTINGS for the open project.
virtual void SetPlotSettings(const PCB_PLOT_PARAMS &aSettings)
void PlaceFootprint(FOOTPRINT *aFootprint, bool aRecreateRatsnest=true)
Place aFootprint at the current cursor position and updates footprint coordinates with the new positi...
virtual void SetActiveLayer(PCB_LAYER_ID aLayer)
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 Get45degMode()
Create a functor that tests whether only 45 degree lines should be allowed.
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 ShowBoardSetupDialog(const wxString &aInitialPage=wxEmptyString)
void SetLastPath(LAST_PATH_TYPE aType, const wxString &aLastPath)
Set the path of the last file successfully read.
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 setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
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 OnExportSTEP(wxCommandEvent &event)
Export the current BOARD to a STEP assembly.
void ExchangeFootprint(FOOTPRINT *aExisting, FOOTPRINT *aNew, BOARD_COMMIT &aCommit, bool deleteExtraTexts=true, bool resetTextLayers=true, bool resetTextEffects=true, bool resetFabricationAttrs=true, bool resetTextContent=true, bool reset3DModels=true, bool *aUpdated=nullptr)
Replace aExisting footprint by aNew footprint using the Existing footprint settings (position,...
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 onBoardLoaded()
Update the state of the GUI after a new board is loaded or created.
void SetGridColor(const COLOR4D &aColor) override
void ProjectChanged() override
Notification event that the project has changed.
wxString GetLastPath(LAST_PATH_TYPE aType)
Get the last path for a particular type.
void OnExportIDF3(wxCommandEvent &event)
Export the current BOARD to a IDFv3 board and lib files.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
void doCloseWindow() override
void ReCreateLayerBox(bool aForceResizeToolbar=true)
Recreate the layer box by clearing the old list and building a new one from the new layer names and c...
void SaveProjectLocalSettings() override
Save changes to the project local settings.
void PythonSyncProjectName()
Synchronize the project name from KiCad's environment into the Python interpreter.
bool m_show_layer_manager_tools
void OnExportVRML(wxCommandEvent &event)
Export the current BOARD to a VRML file.
void ShowFindDialog()
Show the Find dialog.
void onSize(wxSizeEvent &aEvent)
int ShowExchangeFootprintsDialog(FOOTPRINT *aFootprint, bool aUpdateMode, bool aSelectedMode)
int TestStandalone()
Test if standalone mode.
void ShowFootprintPropertiesDialog(FOOTPRINT *aFootprint)
void OnExportHyperlynx(wxCommandEvent &event)
Export the current BOARD to a Hyperlynx HYP file.
bool IsContentModified() const override
Get if the current board has been modified but not saved.
void PythonSyncEnvironmentVariables()
Synchronize the environment variables from KiCad's environment into the Python interpreter.
bool Clear_Pcb(bool doAskAboutUnsavedChanges, bool aFinal=false)
Delete all and reinitialize the current board.
Definition: initpcb.cpp:42
TOOL_ACTION * m_exportNetlistAction
The export board netlist tool action object.
bool FetchNetlistFromSchematic(NETLIST &aNetlist, const wxString &aAnnotateMessage)
wxString GetCurrentFileName() const override
Get the full filename + path of the currently opened file in the frame.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void RecreateCmpFileFromBoard(wxCommandEvent &aEvent)
Recreates a .cmp file from the current loaded board.
DIALOG_BOOK_REPORTER * GetFootprintDiffDialog()
EDA_ANGLE GetRotationAngle() const override
Return the angle used for rotate operations.
COLOR4D GetGridColor() override
void Files_io(wxCommandEvent &event)
Call Files_io_from_id with the wxCommandEvent id.
void UpdateTitle()
Set the main window title bar text.
DIALOG_BOOK_REPORTER * m_footprintDiffDlg
void ExportToGenCAD(wxCommandEvent &event)
Create a file in GenCAD 1.4 format from the current board.
void ActivateGalCanvas() override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
void Process_Special_Functions(wxCommandEvent &event)
Definition: edit.cpp:53
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)
void ToPlotter(int aID)
Open a dialog frame to create plot and drill files relative to the current board.
DIALOG_BOOK_REPORTER * GetInspectConstraintsDialog()
Toolbar configuration for the PCB editor frame.
PCB net inspection panel.
Generic tool for picking an item.
Parameters and options when plotting/printing a board.
void SetFormat(PLOT_FORMAT aFormat)
Tool that displays edit points allowing to modify items by dragging the points.
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:
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:456
Tool useful for viewing footprints.
virtual ENV_VAR_MAP & GetLocalEnvVariables() const
Definition: pgm_base.cpp:933
virtual const wxString & GetExecutablePath() const
Definition: pgm_base.cpp:1048
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:125
The interactive edit tool.
A progress reporter interface for use in multi-threaded environments.
The backing store for a PROJECT, in JSON format.
Definition: project_file.h:74
std::vector< LAYER_PAIR_INFO > m_LayerPairInfos
List of stored 3D viewports (view matrixes)
Definition: project_file.h:210
The project local settings are things that are attached to a particular project, but also might be pa...
wxString m_ActiveLayerPreset
The name of a LAYER_PRESET that is currently activated (or blank if none)
PCB_LAYER_ID m_ActiveLayer
The current (active) board layer for editing.
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
Definition: project.h:209
void IncrementNetclassesTicker()
Definition: project.h:121
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:203
void IncrementTextVarsTicker()
Definition: project.h:118
float SplitterProportion() const
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.
void FocusSearch()
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.
EDA_ITEM * Front() const
Definition: selection.h:172
int Size() const
Returns the number of selected parts.
Definition: selection.h:116
T * GetToolbarSettings(const wxString &aFilename)
Return a handle to the given toolbar settings.
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition: richio.h:253
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:171
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:173
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:55
ACTIONS * m_actions
Definition: tools_holder.h:172
Represent a single user action.
Definition: tool_action.h:304
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:168
void SetHasPosition(bool aHasPosition)
Definition: tool_event.h:258
Master controller class:
Definition: tool_manager.h:62
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
bool RunAction(const std::string &aActionName, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
Definition: tool_manager.h:150
bool InvokeTool(TOOL_ID aToolId)
Call a tool by sending a tool activation event to tool of given ID.
ACTION_MANAGER * GetActionManager() const
Definition: tool_manager.h:306
bool PostAction(const std::string &aActionName, T aParam)
Run the specified action after the current action (coroutine) ends.
Definition: tool_manager.h:235
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Reset all tools (i.e.
std::vector< TOOL_BASE * > Tools()
Definition: tool_manager.h:341
void RegisterTool(TOOL_BASE *aTool)
Add a tool to the manager set and sets it up.
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, APP_SETTINGS_BASE *aSettings, TOOLS_HOLDER *aFrame)
Set the work environment (model, view, view controls and the parent window).
void InitTools()
Initialize all registered tools.
void ShutdownAllTools()
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with...
wxString wx_str() const
Definition: utf8.cpp:45
A modified version of the wxInfoBar class that allows us to:
Definition: wx_infobar.h:76
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
Definition: wx_infobar.cpp:353
@ OUTDATED_SAVE
OUTDATED_SAVE Messages that should be cleared on save.
@ GENERIC
GENERIC Are messages that do not have special handling.
void AddCloseButton(const wxString &aTooltip=_("Hide this message."))
Add the default close button to the infobar on the right side.
Definition: wx_infobar.cpp:343
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
Definition: wx_infobar.cpp:154
Handle actions specific to filling copper zones.
PROGRESS_REPORTER * GetProgressReporter()
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:130
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:194
This file is part of the common library.
#define CHECK(x)
#define ENABLE(x)
#define DIALOG_DRC_WINDOW_NAME
Definition: dialog_drc.h:42
#define _HKI(x)
#define _(s)
Declaration of the eda_3d_viewer class.
static constexpr EDA_ANGLE ANGLE_90
Definition: eda_angle.h:406
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define PCB_EDIT_FRAME_NAME
static const std::vector< KICAD_T > footprintTypes
Definition: edit_tool.cpp:81
static const std::vector< KICAD_T > groupTypes
Definition: edit_tool.cpp:83
static const std::vector< KICAD_T > trackTypes
Definition: edit_tool.cpp:85
KiCad executable names.
const wxString EESCHEMA_EXE
bool ExportBoardToHyperlynx(BOARD *aBoard, const wxFileName &aPath)
@ FP_ALLOW_SOLDERMASK_BRIDGES
Definition: footprint.h:86
#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
@ ID_MAIN_MENUBAR
Definition: gerbview_id.h:38
int ExecuteFile(const wxString &aEditorName, const wxString &aFileName, wxProcess *aCallback, bool aFileForKicad)
Call the executable file aEditorName with the parameter aFileName.
Definition: gestfich.cpp:143
bool m_ShowEventCounters
Shows debugging event counters in various places.
static const std::string LegacySchematicFileExtension
static const std::string LegacyPcbFileExtension
static const std::string KiCadSchematicFileExtension
static const std::string AutoSaveFilePrefix
static const std::string KiCadPcbFileExtension
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
const wxChar *const traceApi
Flag to enable debug output related to the IPC API and its plugin system.
Definition: api_utils.cpp:26
@ ID_ON_GRID_SELECT
Definition: id.h:137
@ ID_GEN_PLOT_DXF
Definition: id.h:93
@ ID_FILE_LIST_CLEAR
Definition: id.h:84
@ ID_EDA_SOCKET_EVENT
Definition: id.h:155
@ ID_GEN_PLOT_PS
Definition: id.h:89
@ ID_EDA_SOCKET_EVENT_SERV
Definition: id.h:154
@ ID_GEN_PLOT_GERBER
Definition: id.h:91
@ ID_ON_ZOOM_SELECT
Definition: id.h:135
@ ID_GEN_PLOT
Definition: id.h:88
@ ID_GEN_PLOT_SVG
Definition: id.h:92
@ ID_GEN_PLOT_HPGL
Definition: id.h:90
@ ID_FILEMAX
Definition: id.h:82
@ ID_FILE1
Definition: id.h:81
@ ID_GEN_PLOT_PDF
Definition: id.h:94
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
PROJECT & Prj()
Definition: kicad.cpp:597
int GetNetnameLayer(int aLayer)
Return a netname layer corresponding to the given layer.
Definition: layer_ids.h:839
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
Definition: layer_ids.h:663
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
Definition: layer_ids.h:228
@ LAYER_GRID
Definition: layer_ids.h:253
@ LAYER_ZONES
Control for copper zone opacity/visibility (color ignored).
Definition: layer_ids.h:294
@ LAYER_RATSNEST
Definition: layer_ids.h:252
#define CLEARANCE_LAYER_FOR(boardLayer)
Definition: layer_ids.h:361
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
@ 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.
static void processTextItem(const PCB_TEXT &aSrc, PCB_TEXT &aDest, bool aResetText, bool aResetTextLayers, bool aResetTextEffects, bool *aUpdated)
copy text settings from aSrc to aDest
#define FOOTPRINT_DIFF_DIALOG_NAME
static PCB_TEXT * getMatchingTextItem(PCB_TEXT *aRefItem, FOOTPRINT *aFootprint)
EVT_MENU_RANGE(ID_POPUP_PCB_SELECT_WIDTH_START_RANGE, ID_POPUP_PCB_SELECT_WIDTH_END_RANGE, PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event) EVT_UPDATE_UI_RANGE(ID_POPUP_PCB_SELECT_WIDTH1
ID_POPUP_PCB_SELECT_WIDTH8
bool ExportBoardToHyperlynx(BOARD *aBoard, const wxFileName &aPath)
#define INSPECT_CLEARANCE_DIALOG_NAME
PCB_EDIT_FRAME::OnUpdateSelectTrackWidth EVT_UPDATE_UI_RANGE(ID_POPUP_PCB_SELECT_VIASIZE1, ID_POPUP_PCB_SELECT_VIASIZE8, PCB_EDIT_FRAME::OnUpdateSelectViaSize) PCB_EDIT_FRAME
#define INSPECT_DRC_ERROR_DIALOG_NAME
#define INSPECT_CONSTRAINTS_DIALOG_NAME
@ ID_POPUP_PCB_SELECT_WIDTH_START_RANGE
Definition: pcbnew_id.h:24
@ ID_POPUP_PCB_SELECT_WIDTH1
Definition: pcbnew_id.h:28
@ ID_POPUP_PCB_SELECT_VIASIZE8
Definition: pcbnew_id.h:51
@ ID_GEN_EXPORT_FILE_HYPERLYNX
Definition: pcbnew_id.h:87
@ ID_IMPORT_NON_KICAD_BOARD
Definition: pcbnew_id.h:19
@ ID_MENU_RECOVER_BOARD_AUTOSAVE
Definition: pcbnew_id.h:80
@ ID_AUX_TOOLBAR_PCB_VIA_SIZE
Definition: pcbnew_id.h:22
@ ID_PCB_GEN_CMP_FILE
Definition: pcbnew_id.h:92
@ ID_MENU_EXPORT_FOOTPRINTS_TO_NEW_LIBRARY
Definition: pcbnew_id.h:82
@ ID_POPUP_PCB_SELECT_WIDTH_END_RANGE
Definition: pcbnew_id.h:78
@ ID_MENU_EXPORT_FOOTPRINTS_TO_LIBRARY
Definition: pcbnew_id.h:81
@ ID_GEN_EXPORT_FILE_VRML
Definition: pcbnew_id.h:85
@ ID_POPUP_PCB_SELECT_VIASIZE1
Definition: pcbnew_id.h:44
@ ID_GEN_EXPORT_FILE_STEP
Definition: pcbnew_id.h:86
@ ID_GEN_EXPORT_FILE_IDF3
Definition: pcbnew_id.h:84
@ ID_AUX_TOOLBAR_PCB_TRACK_WIDTH
Definition: pcbnew_id.h:23
@ ID_GEN_EXPORT_FILE_GENCADFORMAT
Definition: pcbnew_id.h:88
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...
PGM_BASE & Pgm()
The global program "get" accessor.
Definition: pgm_base.cpp:1071
see class PGM_BASE
#define PROJECT_VAR_NAME
A variable name whose value holds the current project directory.
Definition: project.h:40
LAST_PATH_TYPE
For storing PcbNew MRU paths of various types.
Definition: project_file.h:50
@ RPT_SEVERITY_EXCLUSION
#define SKIP_SET_DIRTY
Definition: sch_commit.h:43
#define SKIP_UNDO
Definition: sch_commit.h:41
#define CURRENT_TOOL(action)
std::function< bool(const SELECTION &)> SELECTION_CONDITION
Functor type that checks a specific condition for selected items.
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.
Definition: string_utils.h:408
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
const double IU_PER_MILS
Definition: base_units.h:77
constexpr int mmToIU(double mm) const
Definition: base_units.h:90
A filename or source description, a problem input line, a line number, a byte offset,...
Definition: ki_exception.h:120
@ 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
Definition: tools_holder.h:153
#define ENVVARS_CHANGED
Definition: tools_holder.h:152
wxLogTrace helper definitions.
@ 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_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:110
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition: typeinfo.h:107
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition: typeinfo.h:92
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
Definition: typeinfo.h:90
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition: typeinfo.h:86
@ 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_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
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.